Spaces:
Runtime error
Runtime error
Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- dist/bot/handlers.js +3 -11
- dist/config.js +0 -1
- dist/index.js +0 -8
- dist/server/streamer.js +39 -13
- node_modules/.package-lock.json +293 -254
- node_modules/@types/express-serve-static-core/README.md +1 -1
- node_modules/@types/express-serve-static-core/index.d.ts +80 -50
- node_modules/@types/express-serve-static-core/package.json +2 -2
- node_modules/@types/express/README.md +3 -3
- node_modules/@types/express/index.d.ts +6 -0
- node_modules/@types/express/package.json +5 -4
- node_modules/@types/mime-types/README.md +2 -8
- node_modules/@types/mime-types/index.d.ts +0 -6
- node_modules/@types/mime-types/package.json +3 -9
- node_modules/@types/mime/LICENSE +21 -0
- node_modules/@types/mime/Mime.d.ts +10 -0
- node_modules/@types/mime/README.md +15 -0
- node_modules/@types/mime/index.d.ts +31 -0
- node_modules/@types/mime/lite.d.ts +7 -0
- node_modules/@types/mime/package.json +30 -0
- node_modules/@types/mongoose/package.json +1 -1
- node_modules/@types/node/README.md +3 -3
- node_modules/@types/node/assert.d.ts +248 -141
- node_modules/@types/node/assert/strict.d.ts +4 -101
- node_modules/@types/node/async_hooks.d.ts +12 -30
- node_modules/@types/node/buffer.buffer.d.ts +8 -3
- node_modules/@types/node/buffer.d.ts +170 -44
- node_modules/@types/node/child_process.d.ts +78 -31
- node_modules/@types/node/cluster.d.ts +332 -241
- node_modules/@types/node/compatibility/disposable.d.ts +16 -0
- node_modules/@types/node/compatibility/index.d.ts +9 -0
- node_modules/@types/node/compatibility/indexable.d.ts +20 -0
- node_modules/@types/node/console.d.ts +350 -49
- node_modules/@types/node/constants.d.ts +4 -3
- node_modules/@types/node/crypto.d.ts +0 -0
- node_modules/@types/node/dgram.d.ts +51 -18
- node_modules/@types/node/diagnostics_channel.d.ts +6 -4
- node_modules/@types/node/dns.d.ts +128 -179
- node_modules/@types/node/dns/promises.d.ts +9 -33
- node_modules/@types/node/domain.d.ts +17 -13
- node_modules/@types/node/events.d.ts +725 -802
- node_modules/@types/node/fs.d.ts +0 -0
- node_modules/@types/node/fs/promises.d.ts +46 -105
- node_modules/@types/node/globals.d.ts +30 -8
- node_modules/@types/node/globals.typedarray.d.ts +0 -63
- node_modules/@types/node/http.d.ts +266 -384
- node_modules/@types/node/http2.d.ts +716 -565
- node_modules/@types/node/https.d.ts +241 -68
- node_modules/@types/node/index.d.ts +6 -28
- node_modules/@types/node/inspector.generated.d.ts +0 -0
dist/bot/handlers.js
CHANGED
|
@@ -4,9 +4,7 @@ exports.setupHandlers = void 0;
|
|
| 4 |
const telegram_1 = require("telegram");
|
| 5 |
const client_1 = require("./client");
|
| 6 |
const config_1 = require("../config");
|
| 7 |
-
const file_1 = require("../models/file");
|
| 8 |
const events_1 = require("telegram/events");
|
| 9 |
-
const generateShortId = () => Math.random().toString(36).substring(2, 10);
|
| 10 |
const setupHandlers = () => {
|
| 11 |
client_1.client.addEventHandler(async (event) => {
|
| 12 |
const message = event.message;
|
|
@@ -29,15 +27,9 @@ const setupHandlers = () => {
|
|
| 29 |
: null;
|
| 30 |
if (!newMsgId)
|
| 31 |
throw new Error("Could not get stored message ID in Bin Channel");
|
| 32 |
-
//
|
| 33 |
-
|
| 34 |
-
const
|
| 35 |
-
fileId,
|
| 36 |
-
fileName: message.file?.name || "unknown",
|
| 37 |
-
fileSize: Number(message.file?.size) || 0,
|
| 38 |
-
mimeType: message.file?.mimeType || "application/octet-stream",
|
| 39 |
-
});
|
| 40 |
-
await fileDoc.save();
|
| 41 |
const streamUrl = `${(0, config_1.getBaseUrl)()}/download/${fileId}`;
|
| 42 |
await message.reply({ message: `Here is your stream link:\n\n${streamUrl}` });
|
| 43 |
}
|
|
|
|
| 4 |
const telegram_1 = require("telegram");
|
| 5 |
const client_1 = require("./client");
|
| 6 |
const config_1 = require("../config");
|
|
|
|
| 7 |
const events_1 = require("telegram/events");
|
|
|
|
| 8 |
const setupHandlers = () => {
|
| 9 |
client_1.client.addEventHandler(async (event) => {
|
| 10 |
const message = event.message;
|
|
|
|
| 27 |
: null;
|
| 28 |
if (!newMsgId)
|
| 29 |
throw new Error("Could not get stored message ID in Bin Channel");
|
| 30 |
+
// Stateless URL Encoding: Base64 encode the precise Message ID in the Bin Channel
|
| 31 |
+
// We use base64url to ensure it is URL-safe
|
| 32 |
+
const fileId = Buffer.from(newMsgId.toString()).toString("base64url");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
const streamUrl = `${(0, config_1.getBaseUrl)()}/download/${fileId}`;
|
| 34 |
await message.reply({ message: `Here is your stream link:\n\n${streamUrl}` });
|
| 35 |
}
|
dist/config.js
CHANGED
|
@@ -8,7 +8,6 @@ exports.config = {
|
|
| 8 |
botToken: process.env.BOT_TOKEN,
|
| 9 |
binChannel: process.env.BIN_CHANNEL,
|
| 10 |
port: Number(process.env.PORT) || 8080,
|
| 11 |
-
mongoUrl: process.env.DATABASE_URL,
|
| 12 |
fqdn: process.env.FQDN,
|
| 13 |
hasSSL: process.env.HAS_SSL?.toLowerCase() === "true" || false,
|
| 14 |
noPort: process.env.NO_PORT?.toLowerCase() === "true" || false,
|
|
|
|
| 8 |
botToken: process.env.BOT_TOKEN,
|
| 9 |
binChannel: process.env.BIN_CHANNEL,
|
| 10 |
port: Number(process.env.PORT) || 8080,
|
|
|
|
| 11 |
fqdn: process.env.FQDN,
|
| 12 |
hasSSL: process.env.HAS_SSL?.toLowerCase() === "true" || false,
|
| 13 |
noPort: process.env.NO_PORT?.toLowerCase() === "true" || false,
|
dist/index.js
CHANGED
|
@@ -1,18 +1,10 @@
|
|
| 1 |
"use strict";
|
| 2 |
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
| 3 |
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
| 4 |
-
};
|
| 5 |
Object.defineProperty(exports, "__esModule", { value: true });
|
| 6 |
-
const mongoose_1 = __importDefault(require("mongoose"));
|
| 7 |
-
const config_1 = require("./config");
|
| 8 |
const client_1 = require("./bot/client");
|
| 9 |
const handlers_1 = require("./bot/handlers");
|
| 10 |
const streamer_1 = require("./server/streamer");
|
| 11 |
const init = async () => {
|
| 12 |
try {
|
| 13 |
-
console.log("Connecting to MongoDB...");
|
| 14 |
-
await mongoose_1.default.connect(config_1.config.mongoUrl);
|
| 15 |
-
console.log("Connected to database successfully!");
|
| 16 |
console.log("Starting services...");
|
| 17 |
await (0, client_1.startBot)();
|
| 18 |
(0, handlers_1.setupHandlers)();
|
|
|
|
| 1 |
"use strict";
|
|
|
|
|
|
|
|
|
|
| 2 |
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
|
|
|
| 3 |
const client_1 = require("./bot/client");
|
| 4 |
const handlers_1 = require("./bot/handlers");
|
| 5 |
const streamer_1 = require("./server/streamer");
|
| 6 |
const init = async () => {
|
| 7 |
try {
|
|
|
|
|
|
|
|
|
|
| 8 |
console.log("Starting services...");
|
| 9 |
await (0, client_1.startBot)();
|
| 10 |
(0, handlers_1.setupHandlers)();
|
dist/server/streamer.js
CHANGED
|
@@ -7,7 +7,6 @@ exports.startServer = exports.app = void 0;
|
|
| 7 |
const express_1 = __importDefault(require("express"));
|
| 8 |
const cors_1 = __importDefault(require("cors"));
|
| 9 |
const config_1 = require("../config");
|
| 10 |
-
const file_1 = require("../models/file");
|
| 11 |
const client_1 = require("../bot/client");
|
| 12 |
exports.app = (0, express_1.default)();
|
| 13 |
exports.app.use((0, cors_1.default)());
|
|
@@ -15,14 +14,28 @@ exports.app.use((0, cors_1.default)());
|
|
| 15 |
// This requires streaming chunks using client.iterDownload
|
| 16 |
exports.app.get("/download/:id", async (req, res) => {
|
| 17 |
try {
|
| 18 |
-
const
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
|
|
|
| 22 |
return;
|
| 23 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
const reqRange = req.headers.range;
|
| 25 |
-
const fileSize = fileDoc.fileSize;
|
| 26 |
let start = 0;
|
| 27 |
let end = fileSize - 1;
|
| 28 |
if (reqRange) {
|
|
@@ -31,20 +44,33 @@ exports.app.get("/download/:id", async (req, res) => {
|
|
| 31 |
end = parts[1] ? parseInt(parts[1], 10) : fileSize - 1;
|
| 32 |
}
|
| 33 |
const chunkSize = end - start + 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
res.writeHead(reqRange ? 206 : 200, {
|
| 35 |
"Content-Range": `bytes ${start}-${end}/${fileSize}`,
|
| 36 |
"Accept-Ranges": "bytes",
|
| 37 |
"Content-Length": chunkSize,
|
| 38 |
-
"Content-Type":
|
| 39 |
-
"Content-Disposition": `inline; filename="${
|
| 40 |
});
|
| 41 |
-
const messages = await client_1.client.getMessages(config_1.config.binChannel, {
|
| 42 |
-
ids: [Number(fileDoc.fileId)]
|
| 43 |
-
});
|
| 44 |
-
const fileMessage = messages[0];
|
| 45 |
for await (const chunk of client_1.client.iterDownload({
|
| 46 |
file: fileMessage.media,
|
| 47 |
-
requestSize: 1024 *
|
| 48 |
offset: require("big-integer")(start),
|
| 49 |
limit: chunkSize,
|
| 50 |
})) {
|
|
|
|
| 7 |
const express_1 = __importDefault(require("express"));
|
| 8 |
const cors_1 = __importDefault(require("cors"));
|
| 9 |
const config_1 = require("../config");
|
|
|
|
| 10 |
const client_1 = require("../bot/client");
|
| 11 |
exports.app = (0, express_1.default)();
|
| 12 |
exports.app.use((0, cors_1.default)());
|
|
|
|
| 14 |
// This requires streaming chunks using client.iterDownload
|
| 15 |
exports.app.get("/download/:id", async (req, res) => {
|
| 16 |
try {
|
| 17 |
+
const fileIdBase64 = req.params.id;
|
| 18 |
+
// Decode our Stateless URL Hash back into a real Telegram Message ID
|
| 19 |
+
const messageId = Number(Buffer.from(fileIdBase64, 'base64url').toString('utf8'));
|
| 20 |
+
if (isNaN(messageId)) {
|
| 21 |
+
res.status(400).json({ error: "Invalid stream link format." });
|
| 22 |
return;
|
| 23 |
}
|
| 24 |
+
const messages = await client_1.client.getMessages(config_1.config.binChannel, {
|
| 25 |
+
ids: [messageId]
|
| 26 |
+
});
|
| 27 |
+
const fileMessage = messages[0];
|
| 28 |
+
if (!fileMessage || !fileMessage.media) {
|
| 29 |
+
res.status(404).json({ error: "File not found in Telegram." });
|
| 30 |
+
return;
|
| 31 |
+
}
|
| 32 |
+
const document = fileMessage.document || fileMessage.photo || fileMessage.video;
|
| 33 |
+
if (!document) {
|
| 34 |
+
res.status(404).json({ error: "Unsupported media format." });
|
| 35 |
+
return;
|
| 36 |
+
}
|
| 37 |
+
const fileSize = Number(document.size);
|
| 38 |
const reqRange = req.headers.range;
|
|
|
|
| 39 |
let start = 0;
|
| 40 |
let end = fileSize - 1;
|
| 41 |
if (reqRange) {
|
|
|
|
| 44 |
end = parts[1] ? parseInt(parts[1], 10) : fileSize - 1;
|
| 45 |
}
|
| 46 |
const chunkSize = end - start + 1;
|
| 47 |
+
// Try extracting mimeType from attributes if available
|
| 48 |
+
let mimeType = "application/octet-stream";
|
| 49 |
+
let fileName = "tg-stream-file";
|
| 50 |
+
if (fileMessage.document && fileMessage.document.mimeType) {
|
| 51 |
+
mimeType = fileMessage.document.mimeType;
|
| 52 |
+
const nameAttr = fileMessage.document.attributes?.find((attr) => attr.fileName);
|
| 53 |
+
if (nameAttr)
|
| 54 |
+
fileName = nameAttr.fileName;
|
| 55 |
+
}
|
| 56 |
+
else if (fileMessage.photo) {
|
| 57 |
+
mimeType = "image/jpeg";
|
| 58 |
+
fileName = `tg-image-${messageId}.jpg`;
|
| 59 |
+
}
|
| 60 |
+
else if (fileMessage.video) {
|
| 61 |
+
mimeType = "video/mp4";
|
| 62 |
+
fileName = `tg-video-${messageId}.mp4`;
|
| 63 |
+
}
|
| 64 |
res.writeHead(reqRange ? 206 : 200, {
|
| 65 |
"Content-Range": `bytes ${start}-${end}/${fileSize}`,
|
| 66 |
"Accept-Ranges": "bytes",
|
| 67 |
"Content-Length": chunkSize,
|
| 68 |
+
"Content-Type": mimeType,
|
| 69 |
+
"Content-Disposition": `inline; filename="${fileName}"`,
|
| 70 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
for await (const chunk of client_1.client.iterDownload({
|
| 72 |
file: fileMessage.media,
|
| 73 |
+
requestSize: 1024 * 512, // 512KB chunks are safer for PaaS limits
|
| 74 |
offset: require("big-integer")(start),
|
| 75 |
limit: chunkSize,
|
| 76 |
})) {
|
node_modules/.package-lock.json
CHANGED
|
@@ -55,6 +55,7 @@
|
|
| 55 |
"version": "1.4.6",
|
| 56 |
"resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.4.6.tgz",
|
| 57 |
"integrity": "sha512-y+x3H1xBZd38n10NZF/rEBlvDOOMQ6LKUTHqr8R9VkJ+mmQOYtJFxIlkkK8fZrtOiL6VixbOBWMbZGBdal3Z1g==",
|
|
|
|
| 58 |
"license": "MIT",
|
| 59 |
"dependencies": {
|
| 60 |
"sparse-bitfield": "^3.0.3"
|
|
@@ -120,21 +121,22 @@
|
|
| 120 |
}
|
| 121 |
},
|
| 122 |
"node_modules/@types/express": {
|
| 123 |
-
"version": "
|
| 124 |
-
"resolved": "https://registry.npmjs.org/@types/express/-/express-
|
| 125 |
-
"integrity": "sha512-
|
| 126 |
"dev": true,
|
| 127 |
"license": "MIT",
|
| 128 |
"dependencies": {
|
| 129 |
"@types/body-parser": "*",
|
| 130 |
-
"@types/express-serve-static-core": "^
|
| 131 |
-
"@types/
|
|
|
|
| 132 |
}
|
| 133 |
},
|
| 134 |
"node_modules/@types/express-serve-static-core": {
|
| 135 |
-
"version": "
|
| 136 |
-
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-
|
| 137 |
-
"integrity": "sha512-
|
| 138 |
"dev": true,
|
| 139 |
"license": "MIT",
|
| 140 |
"dependencies": {
|
|
@@ -151,17 +153,25 @@
|
|
| 151 |
"dev": true,
|
| 152 |
"license": "MIT"
|
| 153 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
"node_modules/@types/mime-types": {
|
| 155 |
-
"version": "
|
| 156 |
-
"resolved": "https://registry.npmjs.org/@types/mime-types/-/mime-types-
|
| 157 |
-
"integrity": "sha512-
|
| 158 |
"dev": true,
|
| 159 |
"license": "MIT"
|
| 160 |
},
|
| 161 |
"node_modules/@types/mongoose": {
|
| 162 |
-
"version": "5.11.
|
| 163 |
-
"resolved": "https://registry.npmjs.org/@types/mongoose/-/mongoose-5.11.
|
| 164 |
-
"integrity": "sha512-
|
|
|
|
| 165 |
"dev": true,
|
| 166 |
"license": "MIT",
|
| 167 |
"dependencies": {
|
|
@@ -169,13 +179,13 @@
|
|
| 169 |
}
|
| 170 |
},
|
| 171 |
"node_modules/@types/node": {
|
| 172 |
-
"version": "
|
| 173 |
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-
|
| 174 |
-
"integrity": "sha512-
|
| 175 |
"dev": true,
|
| 176 |
"license": "MIT",
|
| 177 |
"dependencies": {
|
| 178 |
-
"undici-types": "~
|
| 179 |
}
|
| 180 |
},
|
| 181 |
"node_modules/@types/qs": {
|
|
@@ -203,13 +213,25 @@
|
|
| 203 |
}
|
| 204 |
},
|
| 205 |
"node_modules/@types/serve-static": {
|
| 206 |
-
"version": "
|
| 207 |
-
"resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-
|
| 208 |
-
"integrity": "sha512-
|
| 209 |
"dev": true,
|
| 210 |
"license": "MIT",
|
| 211 |
"dependencies": {
|
| 212 |
"@types/http-errors": "*",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 213 |
"@types/node": "*"
|
| 214 |
}
|
| 215 |
},
|
|
@@ -217,25 +239,27 @@
|
|
| 217 |
"version": "7.0.3",
|
| 218 |
"resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.3.tgz",
|
| 219 |
"integrity": "sha512-CiJJvcRtIgzadHCYXw7dqEnMNRjhGZlYK05Mj9OyktqV8uVT8fD2BFOB7S1uwBE3Kj2Z+4UyPmFw/Ixgw/LAlA==",
|
|
|
|
| 220 |
"license": "MIT"
|
| 221 |
},
|
| 222 |
"node_modules/@types/whatwg-url": {
|
| 223 |
"version": "13.0.0",
|
| 224 |
"resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-13.0.0.tgz",
|
| 225 |
"integrity": "sha512-N8WXpbE6Wgri7KUSvrmQcqrMllKZ9uxkYWMt+mCSGwNc0Hsw9VQTW7ApqI4XNrx6/SaM2QQJCzMPDEXE058s+Q==",
|
|
|
|
| 226 |
"license": "MIT",
|
| 227 |
"dependencies": {
|
| 228 |
"@types/webidl-conversions": "*"
|
| 229 |
}
|
| 230 |
},
|
| 231 |
"node_modules/accepts": {
|
| 232 |
-
"version": "
|
| 233 |
-
"resolved": "https://registry.npmjs.org/accepts/-/accepts-
|
| 234 |
-
"integrity": "sha512-
|
| 235 |
"license": "MIT",
|
| 236 |
"dependencies": {
|
| 237 |
-
"mime-types": "
|
| 238 |
-
"negotiator": "
|
| 239 |
},
|
| 240 |
"engines": {
|
| 241 |
"node": ">= 0.6"
|
|
@@ -301,6 +325,12 @@
|
|
| 301 |
"dev": true,
|
| 302 |
"license": "MIT"
|
| 303 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 304 |
"node_modules/async-mutex": {
|
| 305 |
"version": "0.3.2",
|
| 306 |
"resolved": "https://registry.npmjs.org/async-mutex/-/async-mutex-0.3.2.tgz",
|
|
@@ -350,33 +380,34 @@
|
|
| 350 |
}
|
| 351 |
},
|
| 352 |
"node_modules/body-parser": {
|
| 353 |
-
"version": "
|
| 354 |
-
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-
|
| 355 |
-
"integrity": "sha512-
|
| 356 |
"license": "MIT",
|
| 357 |
"dependencies": {
|
| 358 |
-
"bytes": "
|
| 359 |
-
"content-type": "
|
| 360 |
-
"debug": "
|
| 361 |
-
"
|
| 362 |
-
"
|
| 363 |
-
"
|
| 364 |
-
"
|
| 365 |
-
"
|
| 366 |
-
"
|
|
|
|
|
|
|
|
|
|
| 367 |
},
|
| 368 |
"engines": {
|
| 369 |
-
"node": ">=
|
| 370 |
-
|
| 371 |
-
"funding": {
|
| 372 |
-
"type": "opencollective",
|
| 373 |
-
"url": "https://opencollective.com/express"
|
| 374 |
}
|
| 375 |
},
|
| 376 |
"node_modules/bson": {
|
| 377 |
"version": "7.2.0",
|
| 378 |
"resolved": "https://registry.npmjs.org/bson/-/bson-7.2.0.tgz",
|
| 379 |
"integrity": "sha512-YCEo7KjMlbNlyHhz7zAZNDpIpQbd+wOEHJYezv0nMYTn4x31eIUM2yomNNubclAt63dObUzKHWsBLJ9QcZNSnQ==",
|
|
|
|
| 380 |
"license": "Apache-2.0",
|
| 381 |
"engines": {
|
| 382 |
"node": ">=20.19.0"
|
|
@@ -501,16 +532,15 @@
|
|
| 501 |
}
|
| 502 |
},
|
| 503 |
"node_modules/content-disposition": {
|
| 504 |
-
"version": "
|
| 505 |
-
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-
|
| 506 |
-
"integrity": "sha512-
|
| 507 |
"license": "MIT",
|
| 508 |
-
"
|
| 509 |
-
"
|
| 510 |
},
|
| 511 |
-
"
|
| 512 |
-
"
|
| 513 |
-
"url": "https://opencollective.com/express"
|
| 514 |
}
|
| 515 |
},
|
| 516 |
"node_modules/content-type": {
|
|
@@ -532,13 +562,10 @@
|
|
| 532 |
}
|
| 533 |
},
|
| 534 |
"node_modules/cookie-signature": {
|
| 535 |
-
"version": "1.
|
| 536 |
-
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.
|
| 537 |
-
"integrity": "sha512-
|
| 538 |
-
"license": "MIT"
|
| 539 |
-
"engines": {
|
| 540 |
-
"node": ">=6.6.0"
|
| 541 |
-
}
|
| 542 |
},
|
| 543 |
"node_modules/core-js": {
|
| 544 |
"version": "2.6.12",
|
|
@@ -586,22 +613,20 @@
|
|
| 586 |
}
|
| 587 |
},
|
| 588 |
"node_modules/debug": {
|
| 589 |
-
"version": "
|
| 590 |
-
"resolved": "https://registry.npmjs.org/debug/-/debug-
|
| 591 |
-
"integrity": "sha512-
|
| 592 |
"license": "MIT",
|
| 593 |
"dependencies": {
|
| 594 |
-
"ms": "
|
| 595 |
-
},
|
| 596 |
-
"engines": {
|
| 597 |
-
"node": ">=6.0"
|
| 598 |
-
},
|
| 599 |
-
"peerDependenciesMeta": {
|
| 600 |
-
"supports-color": {
|
| 601 |
-
"optional": true
|
| 602 |
-
}
|
| 603 |
}
|
| 604 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 605 |
"node_modules/depd": {
|
| 606 |
"version": "2.0.0",
|
| 607 |
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
|
|
@@ -611,6 +636,16 @@
|
|
| 611 |
"node": ">= 0.8"
|
| 612 |
}
|
| 613 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 614 |
"node_modules/diff": {
|
| 615 |
"version": "4.0.4",
|
| 616 |
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.4.tgz",
|
|
@@ -677,9 +712,9 @@
|
|
| 677 |
}
|
| 678 |
},
|
| 679 |
"node_modules/dotenv": {
|
| 680 |
-
"version": "
|
| 681 |
-
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-
|
| 682 |
-
"integrity": "sha512-
|
| 683 |
"license": "BSD-2-Clause",
|
| 684 |
"engines": {
|
| 685 |
"node": ">=12"
|
|
@@ -855,42 +890,45 @@
|
|
| 855 |
}
|
| 856 |
},
|
| 857 |
"node_modules/express": {
|
| 858 |
-
"version": "
|
| 859 |
-
"resolved": "https://registry.npmjs.org/express/-/express-
|
| 860 |
-
"integrity": "sha512-
|
| 861 |
-
"license": "MIT",
|
| 862 |
-
"dependencies": {
|
| 863 |
-
"accepts": "
|
| 864 |
-
"
|
| 865 |
-
"
|
| 866 |
-
"content-
|
| 867 |
-
"
|
| 868 |
-
"cookie
|
| 869 |
-
"
|
| 870 |
-
"
|
| 871 |
-
"
|
| 872 |
-
"
|
| 873 |
-
"
|
| 874 |
-
"
|
| 875 |
-
"
|
| 876 |
-
"
|
| 877 |
-
"
|
| 878 |
-
"
|
| 879 |
-
"
|
| 880 |
-
"
|
| 881 |
-
"parseurl": "
|
| 882 |
-
"
|
| 883 |
-
"
|
| 884 |
-
"
|
| 885 |
-
"
|
| 886 |
-
"
|
| 887 |
-
"
|
| 888 |
-
"
|
| 889 |
-
"
|
| 890 |
-
"
|
| 891 |
-
|
| 892 |
-
|
| 893 |
-
"
|
|
|
|
|
|
|
|
|
|
| 894 |
},
|
| 895 |
"funding": {
|
| 896 |
"type": "opencollective",
|
|
@@ -920,24 +958,21 @@
|
|
| 920 |
}
|
| 921 |
},
|
| 922 |
"node_modules/finalhandler": {
|
| 923 |
-
"version": "
|
| 924 |
-
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-
|
| 925 |
-
"integrity": "sha512-
|
| 926 |
"license": "MIT",
|
| 927 |
"dependencies": {
|
| 928 |
-
"debug": "
|
| 929 |
-
"encodeurl": "
|
| 930 |
-
"escape-html": "
|
| 931 |
-
"on-finished": "
|
| 932 |
-
"parseurl": "
|
| 933 |
-
"statuses": "
|
|
|
|
| 934 |
},
|
| 935 |
"engines": {
|
| 936 |
-
"node": ">=
|
| 937 |
-
},
|
| 938 |
-
"funding": {
|
| 939 |
-
"type": "opencollective",
|
| 940 |
-
"url": "https://opencollective.com/express"
|
| 941 |
}
|
| 942 |
},
|
| 943 |
"node_modules/forwarded": {
|
|
@@ -950,12 +985,12 @@
|
|
| 950 |
}
|
| 951 |
},
|
| 952 |
"node_modules/fresh": {
|
| 953 |
-
"version": "
|
| 954 |
-
"resolved": "https://registry.npmjs.org/fresh/-/fresh-
|
| 955 |
-
"integrity": "sha512-
|
| 956 |
"license": "MIT",
|
| 957 |
"engines": {
|
| 958 |
-
"node": ">= 0.
|
| 959 |
}
|
| 960 |
},
|
| 961 |
"node_modules/function-bind": {
|
|
@@ -1098,19 +1133,15 @@
|
|
| 1098 |
}
|
| 1099 |
},
|
| 1100 |
"node_modules/iconv-lite": {
|
| 1101 |
-
"version": "0.
|
| 1102 |
-
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.
|
| 1103 |
-
"integrity": "sha512-
|
| 1104 |
"license": "MIT",
|
| 1105 |
"dependencies": {
|
| 1106 |
-
"safer-buffer": ">= 2.1.2 < 3
|
| 1107 |
},
|
| 1108 |
"engines": {
|
| 1109 |
"node": ">=0.10.0"
|
| 1110 |
-
},
|
| 1111 |
-
"funding": {
|
| 1112 |
-
"type": "opencollective",
|
| 1113 |
-
"url": "https://opencollective.com/express"
|
| 1114 |
}
|
| 1115 |
},
|
| 1116 |
"node_modules/ieee754": {
|
|
@@ -1214,12 +1245,6 @@
|
|
| 1214 |
"node": ">=0.10.0"
|
| 1215 |
}
|
| 1216 |
},
|
| 1217 |
-
"node_modules/is-promise": {
|
| 1218 |
-
"version": "4.0.0",
|
| 1219 |
-
"resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz",
|
| 1220 |
-
"integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==",
|
| 1221 |
-
"license": "MIT"
|
| 1222 |
-
},
|
| 1223 |
"node_modules/is-typedarray": {
|
| 1224 |
"version": "1.0.0",
|
| 1225 |
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
|
|
@@ -1230,6 +1255,7 @@
|
|
| 1230 |
"version": "3.2.0",
|
| 1231 |
"resolved": "https://registry.npmjs.org/kareem/-/kareem-3.2.0.tgz",
|
| 1232 |
"integrity": "sha512-VS8MWZz/cT+SqBCpVfNN4zoVz5VskR3N4+sTmUXme55e9avQHntpwpNq0yjnosISXqwJ3AQVjlbI4Dyzv//JtA==",
|
|
|
|
| 1233 |
"license": "Apache-2.0",
|
| 1234 |
"engines": {
|
| 1235 |
"node": ">=18.0.0"
|
|
@@ -1258,32 +1284,39 @@
|
|
| 1258 |
}
|
| 1259 |
},
|
| 1260 |
"node_modules/media-typer": {
|
| 1261 |
-
"version": "
|
| 1262 |
-
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-
|
| 1263 |
-
"integrity": "sha512-
|
| 1264 |
"license": "MIT",
|
| 1265 |
"engines": {
|
| 1266 |
-
"node": ">= 0.
|
| 1267 |
}
|
| 1268 |
},
|
| 1269 |
"node_modules/memory-pager": {
|
| 1270 |
"version": "1.5.0",
|
| 1271 |
"resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz",
|
| 1272 |
"integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==",
|
|
|
|
| 1273 |
"license": "MIT"
|
| 1274 |
},
|
| 1275 |
"node_modules/merge-descriptors": {
|
| 1276 |
-
"version": "
|
| 1277 |
-
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-
|
| 1278 |
-
"integrity": "sha512-
|
| 1279 |
"license": "MIT",
|
| 1280 |
-
"engines": {
|
| 1281 |
-
"node": ">=18"
|
| 1282 |
-
},
|
| 1283 |
"funding": {
|
| 1284 |
"url": "https://github.com/sponsors/sindresorhus"
|
| 1285 |
}
|
| 1286 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1287 |
"node_modules/mime": {
|
| 1288 |
"version": "3.0.0",
|
| 1289 |
"resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz",
|
|
@@ -1297,34 +1330,31 @@
|
|
| 1297 |
}
|
| 1298 |
},
|
| 1299 |
"node_modules/mime-db": {
|
| 1300 |
-
"version": "1.
|
| 1301 |
-
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.
|
| 1302 |
-
"integrity": "sha512-
|
| 1303 |
"license": "MIT",
|
| 1304 |
"engines": {
|
| 1305 |
"node": ">= 0.6"
|
| 1306 |
}
|
| 1307 |
},
|
| 1308 |
"node_modules/mime-types": {
|
| 1309 |
-
"version": "
|
| 1310 |
-
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-
|
| 1311 |
-
"integrity": "sha512-
|
| 1312 |
"license": "MIT",
|
| 1313 |
"dependencies": {
|
| 1314 |
-
"mime-db": "
|
| 1315 |
},
|
| 1316 |
"engines": {
|
| 1317 |
-
"node": ">=
|
| 1318 |
-
},
|
| 1319 |
-
"funding": {
|
| 1320 |
-
"type": "opencollective",
|
| 1321 |
-
"url": "https://opencollective.com/express"
|
| 1322 |
}
|
| 1323 |
},
|
| 1324 |
"node_modules/mongodb": {
|
| 1325 |
"version": "7.0.0",
|
| 1326 |
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-7.0.0.tgz",
|
| 1327 |
"integrity": "sha512-vG/A5cQrvGGvZm2mTnCSz1LUcbOPl83hfB6bxULKQ8oFZauyox/2xbZOoGNl+64m8VBrETkdGCDBdOsCr3F3jg==",
|
|
|
|
| 1328 |
"license": "Apache-2.0",
|
| 1329 |
"dependencies": {
|
| 1330 |
"@mongodb-js/saslprep": "^1.3.0",
|
|
@@ -1371,6 +1401,7 @@
|
|
| 1371 |
"version": "7.0.1",
|
| 1372 |
"resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-7.0.1.tgz",
|
| 1373 |
"integrity": "sha512-h0AZ9A7IDVwwHyMxmdMXKy+9oNlF0zFoahHiX3vQ8e3KFcSP3VmsmfvtRSuLPxmyv2vjIDxqty8smTgie/SNRQ==",
|
|
|
|
| 1374 |
"license": "Apache-2.0",
|
| 1375 |
"dependencies": {
|
| 1376 |
"@types/whatwg-url": "^13.0.0",
|
|
@@ -1384,6 +1415,7 @@
|
|
| 1384 |
"version": "9.2.3",
|
| 1385 |
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-9.2.3.tgz",
|
| 1386 |
"integrity": "sha512-4XFKKkXUOsdY+p07eJyio4mk0rzZOT4n5r5tLqZNeRZ/IsS68vS8Szw8uShX4p7S687XGGc+MFAp+6K1OIN0aw==",
|
|
|
|
| 1387 |
"license": "MIT",
|
| 1388 |
"dependencies": {
|
| 1389 |
"kareem": "3.2.0",
|
|
@@ -1405,6 +1437,7 @@
|
|
| 1405 |
"version": "0.9.0",
|
| 1406 |
"resolved": "https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz",
|
| 1407 |
"integrity": "sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==",
|
|
|
|
| 1408 |
"license": "MIT",
|
| 1409 |
"engines": {
|
| 1410 |
"node": ">=4.0.0"
|
|
@@ -1414,6 +1447,7 @@
|
|
| 1414 |
"version": "6.0.0",
|
| 1415 |
"resolved": "https://registry.npmjs.org/mquery/-/mquery-6.0.0.tgz",
|
| 1416 |
"integrity": "sha512-b2KQNsmgtkscfeDgkYMcWGn9vZI9YoXh802VDEwE6qc50zxBFQ0Oo8ROkawbPAsXCY1/Z1yp0MagqsZStPWJjw==",
|
|
|
|
| 1417 |
"license": "MIT",
|
| 1418 |
"engines": {
|
| 1419 |
"node": ">=20.19.0"
|
|
@@ -1432,9 +1466,9 @@
|
|
| 1432 |
"license": "ISC"
|
| 1433 |
},
|
| 1434 |
"node_modules/negotiator": {
|
| 1435 |
-
"version": "
|
| 1436 |
-
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-
|
| 1437 |
-
"integrity": "sha512-
|
| 1438 |
"license": "MIT",
|
| 1439 |
"engines": {
|
| 1440 |
"node": ">= 0.6"
|
|
@@ -1551,14 +1585,10 @@
|
|
| 1551 |
"license": "MIT"
|
| 1552 |
},
|
| 1553 |
"node_modules/path-to-regexp": {
|
| 1554 |
-
"version": "
|
| 1555 |
-
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-
|
| 1556 |
-
"integrity": "sha512-
|
| 1557 |
-
"license": "MIT"
|
| 1558 |
-
"funding": {
|
| 1559 |
-
"type": "opencollective",
|
| 1560 |
-
"url": "https://opencollective.com/express"
|
| 1561 |
-
}
|
| 1562 |
},
|
| 1563 |
"node_modules/proxy-addr": {
|
| 1564 |
"version": "2.0.7",
|
|
@@ -1577,15 +1607,16 @@
|
|
| 1577 |
"version": "2.3.1",
|
| 1578 |
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
|
| 1579 |
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
|
|
|
|
| 1580 |
"license": "MIT",
|
| 1581 |
"engines": {
|
| 1582 |
"node": ">=6"
|
| 1583 |
}
|
| 1584 |
},
|
| 1585 |
"node_modules/qs": {
|
| 1586 |
-
"version": "6.
|
| 1587 |
-
"resolved": "https://registry.npmjs.org/qs/-/qs-6.
|
| 1588 |
-
"integrity": "sha512-
|
| 1589 |
"license": "BSD-3-Clause",
|
| 1590 |
"dependencies": {
|
| 1591 |
"side-channel": "^1.1.0"
|
|
@@ -1607,18 +1638,18 @@
|
|
| 1607 |
}
|
| 1608 |
},
|
| 1609 |
"node_modules/raw-body": {
|
| 1610 |
-
"version": "
|
| 1611 |
-
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-
|
| 1612 |
-
"integrity": "sha512-
|
| 1613 |
"license": "MIT",
|
| 1614 |
"dependencies": {
|
| 1615 |
"bytes": "~3.1.2",
|
| 1616 |
"http-errors": "~2.0.1",
|
| 1617 |
-
"iconv-lite": "~0.
|
| 1618 |
"unpipe": "~1.0.0"
|
| 1619 |
},
|
| 1620 |
"engines": {
|
| 1621 |
-
"node": ">= 0.
|
| 1622 |
}
|
| 1623 |
},
|
| 1624 |
"node_modules/readline2": {
|
|
@@ -1657,22 +1688,6 @@
|
|
| 1657 |
"node": ">=0.10.0"
|
| 1658 |
}
|
| 1659 |
},
|
| 1660 |
-
"node_modules/router": {
|
| 1661 |
-
"version": "2.2.0",
|
| 1662 |
-
"resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz",
|
| 1663 |
-
"integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==",
|
| 1664 |
-
"license": "MIT",
|
| 1665 |
-
"dependencies": {
|
| 1666 |
-
"debug": "^4.4.0",
|
| 1667 |
-
"depd": "^2.0.0",
|
| 1668 |
-
"is-promise": "^4.0.0",
|
| 1669 |
-
"parseurl": "^1.3.3",
|
| 1670 |
-
"path-to-regexp": "^8.0.0"
|
| 1671 |
-
},
|
| 1672 |
-
"engines": {
|
| 1673 |
-
"node": ">= 18"
|
| 1674 |
-
}
|
| 1675 |
-
},
|
| 1676 |
"node_modules/run-async": {
|
| 1677 |
"version": "0.1.0",
|
| 1678 |
"resolved": "https://registry.npmjs.org/run-async/-/run-async-0.1.0.tgz",
|
|
@@ -1687,6 +1702,26 @@
|
|
| 1687 |
"resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-3.1.2.tgz",
|
| 1688 |
"integrity": "sha512-1I1+G2gteLB8Tkt8YI1sJvSIfa0lWuRtC8GjvtyPBcLSF5jBCCJJqKrpER5JU5r6Bhe+i9/pK3VMuUcXu0kdwQ=="
|
| 1689 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1690 |
"node_modules/safer-buffer": {
|
| 1691 |
"version": "2.1.2",
|
| 1692 |
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
|
@@ -1694,48 +1729,54 @@
|
|
| 1694 |
"license": "MIT"
|
| 1695 |
},
|
| 1696 |
"node_modules/send": {
|
| 1697 |
-
"version": "
|
| 1698 |
-
"resolved": "https://registry.npmjs.org/send/-/send-
|
| 1699 |
-
"integrity": "sha512-
|
| 1700 |
-
"license": "MIT",
|
| 1701 |
-
"dependencies": {
|
| 1702 |
-
"debug": "
|
| 1703 |
-
"
|
| 1704 |
-
"
|
| 1705 |
-
"
|
| 1706 |
-
"
|
| 1707 |
-
"
|
| 1708 |
-
"
|
| 1709 |
-
"
|
| 1710 |
-
"
|
| 1711 |
-
"
|
| 1712 |
-
"
|
|
|
|
|
|
|
| 1713 |
},
|
| 1714 |
"engines": {
|
| 1715 |
-
"node": ">=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1716 |
},
|
| 1717 |
-
"
|
| 1718 |
-
"
|
| 1719 |
-
"url": "https://opencollective.com/express"
|
| 1720 |
}
|
| 1721 |
},
|
| 1722 |
"node_modules/serve-static": {
|
| 1723 |
-
"version": "
|
| 1724 |
-
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-
|
| 1725 |
-
"integrity": "sha512-
|
| 1726 |
"license": "MIT",
|
| 1727 |
"dependencies": {
|
| 1728 |
-
"encodeurl": "
|
| 1729 |
-
"escape-html": "
|
| 1730 |
-
"parseurl": "
|
| 1731 |
-
"send": "
|
| 1732 |
},
|
| 1733 |
"engines": {
|
| 1734 |
-
"node": ">=
|
| 1735 |
-
},
|
| 1736 |
-
"funding": {
|
| 1737 |
-
"type": "opencollective",
|
| 1738 |
-
"url": "https://opencollective.com/express"
|
| 1739 |
}
|
| 1740 |
},
|
| 1741 |
"node_modules/setprototypeof": {
|
|
@@ -1820,6 +1861,7 @@
|
|
| 1820 |
"version": "17.1.3",
|
| 1821 |
"resolved": "https://registry.npmjs.org/sift/-/sift-17.1.3.tgz",
|
| 1822 |
"integrity": "sha512-Rtlj66/b0ICeFzYTuNvX/EF1igRbbnGSvEyT79McoZa/DeGhMyC5pWKOEsZKnpkqtSeovd5FL/bjHWC3CIIvCQ==",
|
|
|
|
| 1823 |
"license": "MIT"
|
| 1824 |
},
|
| 1825 |
"node_modules/slide": {
|
|
@@ -1859,6 +1901,7 @@
|
|
| 1859 |
"version": "3.0.3",
|
| 1860 |
"resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",
|
| 1861 |
"integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==",
|
|
|
|
| 1862 |
"license": "MIT",
|
| 1863 |
"dependencies": {
|
| 1864 |
"memory-pager": "^1.0.2"
|
|
@@ -1959,6 +2002,7 @@
|
|
| 1959 |
"version": "5.1.1",
|
| 1960 |
"resolved": "https://registry.npmjs.org/tr46/-/tr46-5.1.1.tgz",
|
| 1961 |
"integrity": "sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw==",
|
|
|
|
| 1962 |
"license": "MIT",
|
| 1963 |
"dependencies": {
|
| 1964 |
"punycode": "^2.3.1"
|
|
@@ -2033,14 +2077,13 @@
|
|
| 2033 |
"license": "ISC"
|
| 2034 |
},
|
| 2035 |
"node_modules/type-is": {
|
| 2036 |
-
"version": "
|
| 2037 |
-
"resolved": "https://registry.npmjs.org/type-is/-/type-is-
|
| 2038 |
-
"integrity": "sha512-
|
| 2039 |
"license": "MIT",
|
| 2040 |
"dependencies": {
|
| 2041 |
-
"
|
| 2042 |
-
"
|
| 2043 |
-
"mime-types": "^3.0.0"
|
| 2044 |
},
|
| 2045 |
"engines": {
|
| 2046 |
"node": ">= 0.6"
|
|
@@ -2070,9 +2113,9 @@
|
|
| 2070 |
}
|
| 2071 |
},
|
| 2072 |
"node_modules/undici-types": {
|
| 2073 |
-
"version": "
|
| 2074 |
-
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-
|
| 2075 |
-
"integrity": "sha512-
|
| 2076 |
"dev": true,
|
| 2077 |
"license": "MIT"
|
| 2078 |
},
|
|
@@ -2098,6 +2141,15 @@
|
|
| 2098 |
"node": ">=6.14.2"
|
| 2099 |
}
|
| 2100 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2101 |
"node_modules/v8-compile-cache-lib": {
|
| 2102 |
"version": "3.0.1",
|
| 2103 |
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
|
|
@@ -2118,6 +2170,7 @@
|
|
| 2118 |
"version": "7.0.0",
|
| 2119 |
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
|
| 2120 |
"integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
|
|
|
|
| 2121 |
"license": "BSD-2-Clause",
|
| 2122 |
"engines": {
|
| 2123 |
"node": ">=12"
|
|
@@ -2140,25 +2193,11 @@
|
|
| 2140 |
"node": ">=4.0.0"
|
| 2141 |
}
|
| 2142 |
},
|
| 2143 |
-
"node_modules/websocket/node_modules/debug": {
|
| 2144 |
-
"version": "2.6.9",
|
| 2145 |
-
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
| 2146 |
-
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
| 2147 |
-
"license": "MIT",
|
| 2148 |
-
"dependencies": {
|
| 2149 |
-
"ms": "2.0.0"
|
| 2150 |
-
}
|
| 2151 |
-
},
|
| 2152 |
-
"node_modules/websocket/node_modules/ms": {
|
| 2153 |
-
"version": "2.0.0",
|
| 2154 |
-
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
| 2155 |
-
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
|
| 2156 |
-
"license": "MIT"
|
| 2157 |
-
},
|
| 2158 |
"node_modules/whatwg-url": {
|
| 2159 |
"version": "14.2.0",
|
| 2160 |
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.2.0.tgz",
|
| 2161 |
"integrity": "sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw==",
|
|
|
|
| 2162 |
"license": "MIT",
|
| 2163 |
"dependencies": {
|
| 2164 |
"tr46": "^5.1.0",
|
|
|
|
| 55 |
"version": "1.4.6",
|
| 56 |
"resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.4.6.tgz",
|
| 57 |
"integrity": "sha512-y+x3H1xBZd38n10NZF/rEBlvDOOMQ6LKUTHqr8R9VkJ+mmQOYtJFxIlkkK8fZrtOiL6VixbOBWMbZGBdal3Z1g==",
|
| 58 |
+
"dev": true,
|
| 59 |
"license": "MIT",
|
| 60 |
"dependencies": {
|
| 61 |
"sparse-bitfield": "^3.0.3"
|
|
|
|
| 121 |
}
|
| 122 |
},
|
| 123 |
"node_modules/@types/express": {
|
| 124 |
+
"version": "4.17.25",
|
| 125 |
+
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.25.tgz",
|
| 126 |
+
"integrity": "sha512-dVd04UKsfpINUnK0yBoYHDF3xu7xVH4BuDotC/xGuycx4CgbP48X/KF/586bcObxT0HENHXEU8Nqtu6NR+eKhw==",
|
| 127 |
"dev": true,
|
| 128 |
"license": "MIT",
|
| 129 |
"dependencies": {
|
| 130 |
"@types/body-parser": "*",
|
| 131 |
+
"@types/express-serve-static-core": "^4.17.33",
|
| 132 |
+
"@types/qs": "*",
|
| 133 |
+
"@types/serve-static": "^1"
|
| 134 |
}
|
| 135 |
},
|
| 136 |
"node_modules/@types/express-serve-static-core": {
|
| 137 |
+
"version": "4.19.8",
|
| 138 |
+
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.8.tgz",
|
| 139 |
+
"integrity": "sha512-02S5fmqeoKzVZCHPZid4b8JH2eM5HzQLZWN2FohQEy/0eXTq8VXZfSN6Pcr3F6N9R/vNrj7cpgbhjie6m/1tCA==",
|
| 140 |
"dev": true,
|
| 141 |
"license": "MIT",
|
| 142 |
"dependencies": {
|
|
|
|
| 153 |
"dev": true,
|
| 154 |
"license": "MIT"
|
| 155 |
},
|
| 156 |
+
"node_modules/@types/mime": {
|
| 157 |
+
"version": "1.3.5",
|
| 158 |
+
"resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz",
|
| 159 |
+
"integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==",
|
| 160 |
+
"dev": true,
|
| 161 |
+
"license": "MIT"
|
| 162 |
+
},
|
| 163 |
"node_modules/@types/mime-types": {
|
| 164 |
+
"version": "2.1.4",
|
| 165 |
+
"resolved": "https://registry.npmjs.org/@types/mime-types/-/mime-types-2.1.4.tgz",
|
| 166 |
+
"integrity": "sha512-lfU4b34HOri+kAY5UheuFMWPDOI+OPceBSHZKp69gEyTL/mmJ4cnU6Y/rlme3UL3GyOn6Y42hyIEw0/q8sWx5w==",
|
| 167 |
"dev": true,
|
| 168 |
"license": "MIT"
|
| 169 |
},
|
| 170 |
"node_modules/@types/mongoose": {
|
| 171 |
+
"version": "5.11.97",
|
| 172 |
+
"resolved": "https://registry.npmjs.org/@types/mongoose/-/mongoose-5.11.97.tgz",
|
| 173 |
+
"integrity": "sha512-cqwOVYT3qXyLiGw7ueU2kX9noE8DPGRY6z8eUxudhXY8NZ7DMKYAxyZkLSevGfhCX3dO/AoX5/SO9lAzfjon0Q==",
|
| 174 |
+
"deprecated": "Mongoose publishes its own types, so you do not need to install this package.",
|
| 175 |
"dev": true,
|
| 176 |
"license": "MIT",
|
| 177 |
"dependencies": {
|
|
|
|
| 179 |
}
|
| 180 |
},
|
| 181 |
"node_modules/@types/node": {
|
| 182 |
+
"version": "20.19.35",
|
| 183 |
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.35.tgz",
|
| 184 |
+
"integrity": "sha512-Uarfe6J91b9HAUXxjvSOdiO2UPOKLm07Q1oh0JHxoZ1y8HoqxDAu3gVrsrOHeiio0kSsoVBt4wFrKOm0dKxVPQ==",
|
| 185 |
"dev": true,
|
| 186 |
"license": "MIT",
|
| 187 |
"dependencies": {
|
| 188 |
+
"undici-types": "~6.21.0"
|
| 189 |
}
|
| 190 |
},
|
| 191 |
"node_modules/@types/qs": {
|
|
|
|
| 213 |
}
|
| 214 |
},
|
| 215 |
"node_modules/@types/serve-static": {
|
| 216 |
+
"version": "1.15.10",
|
| 217 |
+
"resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.10.tgz",
|
| 218 |
+
"integrity": "sha512-tRs1dB+g8Itk72rlSI2ZrW6vZg0YrLI81iQSTkMmOqnqCaNr/8Ek4VwWcN5vZgCYWbg/JJSGBlUaYGAOP73qBw==",
|
| 219 |
"dev": true,
|
| 220 |
"license": "MIT",
|
| 221 |
"dependencies": {
|
| 222 |
"@types/http-errors": "*",
|
| 223 |
+
"@types/node": "*",
|
| 224 |
+
"@types/send": "<1"
|
| 225 |
+
}
|
| 226 |
+
},
|
| 227 |
+
"node_modules/@types/serve-static/node_modules/@types/send": {
|
| 228 |
+
"version": "0.17.6",
|
| 229 |
+
"resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.6.tgz",
|
| 230 |
+
"integrity": "sha512-Uqt8rPBE8SY0RK8JB1EzVOIZ32uqy8HwdxCnoCOsYrvnswqmFZ/k+9Ikidlk/ImhsdvBsloHbAlewb2IEBV/Og==",
|
| 231 |
+
"dev": true,
|
| 232 |
+
"license": "MIT",
|
| 233 |
+
"dependencies": {
|
| 234 |
+
"@types/mime": "^1",
|
| 235 |
"@types/node": "*"
|
| 236 |
}
|
| 237 |
},
|
|
|
|
| 239 |
"version": "7.0.3",
|
| 240 |
"resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.3.tgz",
|
| 241 |
"integrity": "sha512-CiJJvcRtIgzadHCYXw7dqEnMNRjhGZlYK05Mj9OyktqV8uVT8fD2BFOB7S1uwBE3Kj2Z+4UyPmFw/Ixgw/LAlA==",
|
| 242 |
+
"dev": true,
|
| 243 |
"license": "MIT"
|
| 244 |
},
|
| 245 |
"node_modules/@types/whatwg-url": {
|
| 246 |
"version": "13.0.0",
|
| 247 |
"resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-13.0.0.tgz",
|
| 248 |
"integrity": "sha512-N8WXpbE6Wgri7KUSvrmQcqrMllKZ9uxkYWMt+mCSGwNc0Hsw9VQTW7ApqI4XNrx6/SaM2QQJCzMPDEXE058s+Q==",
|
| 249 |
+
"dev": true,
|
| 250 |
"license": "MIT",
|
| 251 |
"dependencies": {
|
| 252 |
"@types/webidl-conversions": "*"
|
| 253 |
}
|
| 254 |
},
|
| 255 |
"node_modules/accepts": {
|
| 256 |
+
"version": "1.3.8",
|
| 257 |
+
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
|
| 258 |
+
"integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
|
| 259 |
"license": "MIT",
|
| 260 |
"dependencies": {
|
| 261 |
+
"mime-types": "~2.1.34",
|
| 262 |
+
"negotiator": "0.6.3"
|
| 263 |
},
|
| 264 |
"engines": {
|
| 265 |
"node": ">= 0.6"
|
|
|
|
| 325 |
"dev": true,
|
| 326 |
"license": "MIT"
|
| 327 |
},
|
| 328 |
+
"node_modules/array-flatten": {
|
| 329 |
+
"version": "1.1.1",
|
| 330 |
+
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
| 331 |
+
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==",
|
| 332 |
+
"license": "MIT"
|
| 333 |
+
},
|
| 334 |
"node_modules/async-mutex": {
|
| 335 |
"version": "0.3.2",
|
| 336 |
"resolved": "https://registry.npmjs.org/async-mutex/-/async-mutex-0.3.2.tgz",
|
|
|
|
| 380 |
}
|
| 381 |
},
|
| 382 |
"node_modules/body-parser": {
|
| 383 |
+
"version": "1.20.4",
|
| 384 |
+
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.4.tgz",
|
| 385 |
+
"integrity": "sha512-ZTgYYLMOXY9qKU/57FAo8F+HA2dGX7bqGc71txDRC1rS4frdFI5R7NhluHxH6M0YItAP0sHB4uqAOcYKxO6uGA==",
|
| 386 |
"license": "MIT",
|
| 387 |
"dependencies": {
|
| 388 |
+
"bytes": "~3.1.2",
|
| 389 |
+
"content-type": "~1.0.5",
|
| 390 |
+
"debug": "2.6.9",
|
| 391 |
+
"depd": "2.0.0",
|
| 392 |
+
"destroy": "~1.2.0",
|
| 393 |
+
"http-errors": "~2.0.1",
|
| 394 |
+
"iconv-lite": "~0.4.24",
|
| 395 |
+
"on-finished": "~2.4.1",
|
| 396 |
+
"qs": "~6.14.0",
|
| 397 |
+
"raw-body": "~2.5.3",
|
| 398 |
+
"type-is": "~1.6.18",
|
| 399 |
+
"unpipe": "~1.0.0"
|
| 400 |
},
|
| 401 |
"engines": {
|
| 402 |
+
"node": ">= 0.8",
|
| 403 |
+
"npm": "1.2.8000 || >= 1.4.16"
|
|
|
|
|
|
|
|
|
|
| 404 |
}
|
| 405 |
},
|
| 406 |
"node_modules/bson": {
|
| 407 |
"version": "7.2.0",
|
| 408 |
"resolved": "https://registry.npmjs.org/bson/-/bson-7.2.0.tgz",
|
| 409 |
"integrity": "sha512-YCEo7KjMlbNlyHhz7zAZNDpIpQbd+wOEHJYezv0nMYTn4x31eIUM2yomNNubclAt63dObUzKHWsBLJ9QcZNSnQ==",
|
| 410 |
+
"dev": true,
|
| 411 |
"license": "Apache-2.0",
|
| 412 |
"engines": {
|
| 413 |
"node": ">=20.19.0"
|
|
|
|
| 532 |
}
|
| 533 |
},
|
| 534 |
"node_modules/content-disposition": {
|
| 535 |
+
"version": "0.5.4",
|
| 536 |
+
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
|
| 537 |
+
"integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
|
| 538 |
"license": "MIT",
|
| 539 |
+
"dependencies": {
|
| 540 |
+
"safe-buffer": "5.2.1"
|
| 541 |
},
|
| 542 |
+
"engines": {
|
| 543 |
+
"node": ">= 0.6"
|
|
|
|
| 544 |
}
|
| 545 |
},
|
| 546 |
"node_modules/content-type": {
|
|
|
|
| 562 |
}
|
| 563 |
},
|
| 564 |
"node_modules/cookie-signature": {
|
| 565 |
+
"version": "1.0.7",
|
| 566 |
+
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz",
|
| 567 |
+
"integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==",
|
| 568 |
+
"license": "MIT"
|
|
|
|
|
|
|
|
|
|
| 569 |
},
|
| 570 |
"node_modules/core-js": {
|
| 571 |
"version": "2.6.12",
|
|
|
|
| 613 |
}
|
| 614 |
},
|
| 615 |
"node_modules/debug": {
|
| 616 |
+
"version": "2.6.9",
|
| 617 |
+
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
| 618 |
+
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
| 619 |
"license": "MIT",
|
| 620 |
"dependencies": {
|
| 621 |
+
"ms": "2.0.0"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 622 |
}
|
| 623 |
},
|
| 624 |
+
"node_modules/debug/node_modules/ms": {
|
| 625 |
+
"version": "2.0.0",
|
| 626 |
+
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
| 627 |
+
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
|
| 628 |
+
"license": "MIT"
|
| 629 |
+
},
|
| 630 |
"node_modules/depd": {
|
| 631 |
"version": "2.0.0",
|
| 632 |
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
|
|
|
|
| 636 |
"node": ">= 0.8"
|
| 637 |
}
|
| 638 |
},
|
| 639 |
+
"node_modules/destroy": {
|
| 640 |
+
"version": "1.2.0",
|
| 641 |
+
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
|
| 642 |
+
"integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
|
| 643 |
+
"license": "MIT",
|
| 644 |
+
"engines": {
|
| 645 |
+
"node": ">= 0.8",
|
| 646 |
+
"npm": "1.2.8000 || >= 1.4.16"
|
| 647 |
+
}
|
| 648 |
+
},
|
| 649 |
"node_modules/diff": {
|
| 650 |
"version": "4.0.4",
|
| 651 |
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.4.tgz",
|
|
|
|
| 712 |
}
|
| 713 |
},
|
| 714 |
"node_modules/dotenv": {
|
| 715 |
+
"version": "16.6.1",
|
| 716 |
+
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz",
|
| 717 |
+
"integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==",
|
| 718 |
"license": "BSD-2-Clause",
|
| 719 |
"engines": {
|
| 720 |
"node": ">=12"
|
|
|
|
| 890 |
}
|
| 891 |
},
|
| 892 |
"node_modules/express": {
|
| 893 |
+
"version": "4.22.1",
|
| 894 |
+
"resolved": "https://registry.npmjs.org/express/-/express-4.22.1.tgz",
|
| 895 |
+
"integrity": "sha512-F2X8g9P1X7uCPZMA3MVf9wcTqlyNp7IhH5qPCI0izhaOIYXaW9L535tGA3qmjRzpH+bZczqq7hVKxTR4NWnu+g==",
|
| 896 |
+
"license": "MIT",
|
| 897 |
+
"dependencies": {
|
| 898 |
+
"accepts": "~1.3.8",
|
| 899 |
+
"array-flatten": "1.1.1",
|
| 900 |
+
"body-parser": "~1.20.3",
|
| 901 |
+
"content-disposition": "~0.5.4",
|
| 902 |
+
"content-type": "~1.0.4",
|
| 903 |
+
"cookie": "~0.7.1",
|
| 904 |
+
"cookie-signature": "~1.0.6",
|
| 905 |
+
"debug": "2.6.9",
|
| 906 |
+
"depd": "2.0.0",
|
| 907 |
+
"encodeurl": "~2.0.0",
|
| 908 |
+
"escape-html": "~1.0.3",
|
| 909 |
+
"etag": "~1.8.1",
|
| 910 |
+
"finalhandler": "~1.3.1",
|
| 911 |
+
"fresh": "~0.5.2",
|
| 912 |
+
"http-errors": "~2.0.0",
|
| 913 |
+
"merge-descriptors": "1.0.3",
|
| 914 |
+
"methods": "~1.1.2",
|
| 915 |
+
"on-finished": "~2.4.1",
|
| 916 |
+
"parseurl": "~1.3.3",
|
| 917 |
+
"path-to-regexp": "~0.1.12",
|
| 918 |
+
"proxy-addr": "~2.0.7",
|
| 919 |
+
"qs": "~6.14.0",
|
| 920 |
+
"range-parser": "~1.2.1",
|
| 921 |
+
"safe-buffer": "5.2.1",
|
| 922 |
+
"send": "~0.19.0",
|
| 923 |
+
"serve-static": "~1.16.2",
|
| 924 |
+
"setprototypeof": "1.2.0",
|
| 925 |
+
"statuses": "~2.0.1",
|
| 926 |
+
"type-is": "~1.6.18",
|
| 927 |
+
"utils-merge": "1.0.1",
|
| 928 |
+
"vary": "~1.1.2"
|
| 929 |
+
},
|
| 930 |
+
"engines": {
|
| 931 |
+
"node": ">= 0.10.0"
|
| 932 |
},
|
| 933 |
"funding": {
|
| 934 |
"type": "opencollective",
|
|
|
|
| 958 |
}
|
| 959 |
},
|
| 960 |
"node_modules/finalhandler": {
|
| 961 |
+
"version": "1.3.2",
|
| 962 |
+
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz",
|
| 963 |
+
"integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==",
|
| 964 |
"license": "MIT",
|
| 965 |
"dependencies": {
|
| 966 |
+
"debug": "2.6.9",
|
| 967 |
+
"encodeurl": "~2.0.0",
|
| 968 |
+
"escape-html": "~1.0.3",
|
| 969 |
+
"on-finished": "~2.4.1",
|
| 970 |
+
"parseurl": "~1.3.3",
|
| 971 |
+
"statuses": "~2.0.2",
|
| 972 |
+
"unpipe": "~1.0.0"
|
| 973 |
},
|
| 974 |
"engines": {
|
| 975 |
+
"node": ">= 0.8"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 976 |
}
|
| 977 |
},
|
| 978 |
"node_modules/forwarded": {
|
|
|
|
| 985 |
}
|
| 986 |
},
|
| 987 |
"node_modules/fresh": {
|
| 988 |
+
"version": "0.5.2",
|
| 989 |
+
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
|
| 990 |
+
"integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
|
| 991 |
"license": "MIT",
|
| 992 |
"engines": {
|
| 993 |
+
"node": ">= 0.6"
|
| 994 |
}
|
| 995 |
},
|
| 996 |
"node_modules/function-bind": {
|
|
|
|
| 1133 |
}
|
| 1134 |
},
|
| 1135 |
"node_modules/iconv-lite": {
|
| 1136 |
+
"version": "0.4.24",
|
| 1137 |
+
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
| 1138 |
+
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
|
| 1139 |
"license": "MIT",
|
| 1140 |
"dependencies": {
|
| 1141 |
+
"safer-buffer": ">= 2.1.2 < 3"
|
| 1142 |
},
|
| 1143 |
"engines": {
|
| 1144 |
"node": ">=0.10.0"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1145 |
}
|
| 1146 |
},
|
| 1147 |
"node_modules/ieee754": {
|
|
|
|
| 1245 |
"node": ">=0.10.0"
|
| 1246 |
}
|
| 1247 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1248 |
"node_modules/is-typedarray": {
|
| 1249 |
"version": "1.0.0",
|
| 1250 |
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
|
|
|
|
| 1255 |
"version": "3.2.0",
|
| 1256 |
"resolved": "https://registry.npmjs.org/kareem/-/kareem-3.2.0.tgz",
|
| 1257 |
"integrity": "sha512-VS8MWZz/cT+SqBCpVfNN4zoVz5VskR3N4+sTmUXme55e9avQHntpwpNq0yjnosISXqwJ3AQVjlbI4Dyzv//JtA==",
|
| 1258 |
+
"dev": true,
|
| 1259 |
"license": "Apache-2.0",
|
| 1260 |
"engines": {
|
| 1261 |
"node": ">=18.0.0"
|
|
|
|
| 1284 |
}
|
| 1285 |
},
|
| 1286 |
"node_modules/media-typer": {
|
| 1287 |
+
"version": "0.3.0",
|
| 1288 |
+
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
| 1289 |
+
"integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
|
| 1290 |
"license": "MIT",
|
| 1291 |
"engines": {
|
| 1292 |
+
"node": ">= 0.6"
|
| 1293 |
}
|
| 1294 |
},
|
| 1295 |
"node_modules/memory-pager": {
|
| 1296 |
"version": "1.5.0",
|
| 1297 |
"resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz",
|
| 1298 |
"integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==",
|
| 1299 |
+
"dev": true,
|
| 1300 |
"license": "MIT"
|
| 1301 |
},
|
| 1302 |
"node_modules/merge-descriptors": {
|
| 1303 |
+
"version": "1.0.3",
|
| 1304 |
+
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz",
|
| 1305 |
+
"integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==",
|
| 1306 |
"license": "MIT",
|
|
|
|
|
|
|
|
|
|
| 1307 |
"funding": {
|
| 1308 |
"url": "https://github.com/sponsors/sindresorhus"
|
| 1309 |
}
|
| 1310 |
},
|
| 1311 |
+
"node_modules/methods": {
|
| 1312 |
+
"version": "1.1.2",
|
| 1313 |
+
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
|
| 1314 |
+
"integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
|
| 1315 |
+
"license": "MIT",
|
| 1316 |
+
"engines": {
|
| 1317 |
+
"node": ">= 0.6"
|
| 1318 |
+
}
|
| 1319 |
+
},
|
| 1320 |
"node_modules/mime": {
|
| 1321 |
"version": "3.0.0",
|
| 1322 |
"resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz",
|
|
|
|
| 1330 |
}
|
| 1331 |
},
|
| 1332 |
"node_modules/mime-db": {
|
| 1333 |
+
"version": "1.52.0",
|
| 1334 |
+
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
| 1335 |
+
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
| 1336 |
"license": "MIT",
|
| 1337 |
"engines": {
|
| 1338 |
"node": ">= 0.6"
|
| 1339 |
}
|
| 1340 |
},
|
| 1341 |
"node_modules/mime-types": {
|
| 1342 |
+
"version": "2.1.35",
|
| 1343 |
+
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
| 1344 |
+
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
| 1345 |
"license": "MIT",
|
| 1346 |
"dependencies": {
|
| 1347 |
+
"mime-db": "1.52.0"
|
| 1348 |
},
|
| 1349 |
"engines": {
|
| 1350 |
+
"node": ">= 0.6"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1351 |
}
|
| 1352 |
},
|
| 1353 |
"node_modules/mongodb": {
|
| 1354 |
"version": "7.0.0",
|
| 1355 |
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-7.0.0.tgz",
|
| 1356 |
"integrity": "sha512-vG/A5cQrvGGvZm2mTnCSz1LUcbOPl83hfB6bxULKQ8oFZauyox/2xbZOoGNl+64m8VBrETkdGCDBdOsCr3F3jg==",
|
| 1357 |
+
"dev": true,
|
| 1358 |
"license": "Apache-2.0",
|
| 1359 |
"dependencies": {
|
| 1360 |
"@mongodb-js/saslprep": "^1.3.0",
|
|
|
|
| 1401 |
"version": "7.0.1",
|
| 1402 |
"resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-7.0.1.tgz",
|
| 1403 |
"integrity": "sha512-h0AZ9A7IDVwwHyMxmdMXKy+9oNlF0zFoahHiX3vQ8e3KFcSP3VmsmfvtRSuLPxmyv2vjIDxqty8smTgie/SNRQ==",
|
| 1404 |
+
"dev": true,
|
| 1405 |
"license": "Apache-2.0",
|
| 1406 |
"dependencies": {
|
| 1407 |
"@types/whatwg-url": "^13.0.0",
|
|
|
|
| 1415 |
"version": "9.2.3",
|
| 1416 |
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-9.2.3.tgz",
|
| 1417 |
"integrity": "sha512-4XFKKkXUOsdY+p07eJyio4mk0rzZOT4n5r5tLqZNeRZ/IsS68vS8Szw8uShX4p7S687XGGc+MFAp+6K1OIN0aw==",
|
| 1418 |
+
"dev": true,
|
| 1419 |
"license": "MIT",
|
| 1420 |
"dependencies": {
|
| 1421 |
"kareem": "3.2.0",
|
|
|
|
| 1437 |
"version": "0.9.0",
|
| 1438 |
"resolved": "https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz",
|
| 1439 |
"integrity": "sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==",
|
| 1440 |
+
"dev": true,
|
| 1441 |
"license": "MIT",
|
| 1442 |
"engines": {
|
| 1443 |
"node": ">=4.0.0"
|
|
|
|
| 1447 |
"version": "6.0.0",
|
| 1448 |
"resolved": "https://registry.npmjs.org/mquery/-/mquery-6.0.0.tgz",
|
| 1449 |
"integrity": "sha512-b2KQNsmgtkscfeDgkYMcWGn9vZI9YoXh802VDEwE6qc50zxBFQ0Oo8ROkawbPAsXCY1/Z1yp0MagqsZStPWJjw==",
|
| 1450 |
+
"dev": true,
|
| 1451 |
"license": "MIT",
|
| 1452 |
"engines": {
|
| 1453 |
"node": ">=20.19.0"
|
|
|
|
| 1466 |
"license": "ISC"
|
| 1467 |
},
|
| 1468 |
"node_modules/negotiator": {
|
| 1469 |
+
"version": "0.6.3",
|
| 1470 |
+
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
|
| 1471 |
+
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
|
| 1472 |
"license": "MIT",
|
| 1473 |
"engines": {
|
| 1474 |
"node": ">= 0.6"
|
|
|
|
| 1585 |
"license": "MIT"
|
| 1586 |
},
|
| 1587 |
"node_modules/path-to-regexp": {
|
| 1588 |
+
"version": "0.1.12",
|
| 1589 |
+
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz",
|
| 1590 |
+
"integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==",
|
| 1591 |
+
"license": "MIT"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1592 |
},
|
| 1593 |
"node_modules/proxy-addr": {
|
| 1594 |
"version": "2.0.7",
|
|
|
|
| 1607 |
"version": "2.3.1",
|
| 1608 |
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
|
| 1609 |
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
|
| 1610 |
+
"dev": true,
|
| 1611 |
"license": "MIT",
|
| 1612 |
"engines": {
|
| 1613 |
"node": ">=6"
|
| 1614 |
}
|
| 1615 |
},
|
| 1616 |
"node_modules/qs": {
|
| 1617 |
+
"version": "6.14.2",
|
| 1618 |
+
"resolved": "https://registry.npmjs.org/qs/-/qs-6.14.2.tgz",
|
| 1619 |
+
"integrity": "sha512-V/yCWTTF7VJ9hIh18Ugr2zhJMP01MY7c5kh4J870L7imm6/DIzBsNLTXzMwUA3yZ5b/KBqLx8Kp3uRvd7xSe3Q==",
|
| 1620 |
"license": "BSD-3-Clause",
|
| 1621 |
"dependencies": {
|
| 1622 |
"side-channel": "^1.1.0"
|
|
|
|
| 1638 |
}
|
| 1639 |
},
|
| 1640 |
"node_modules/raw-body": {
|
| 1641 |
+
"version": "2.5.3",
|
| 1642 |
+
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz",
|
| 1643 |
+
"integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==",
|
| 1644 |
"license": "MIT",
|
| 1645 |
"dependencies": {
|
| 1646 |
"bytes": "~3.1.2",
|
| 1647 |
"http-errors": "~2.0.1",
|
| 1648 |
+
"iconv-lite": "~0.4.24",
|
| 1649 |
"unpipe": "~1.0.0"
|
| 1650 |
},
|
| 1651 |
"engines": {
|
| 1652 |
+
"node": ">= 0.8"
|
| 1653 |
}
|
| 1654 |
},
|
| 1655 |
"node_modules/readline2": {
|
|
|
|
| 1688 |
"node": ">=0.10.0"
|
| 1689 |
}
|
| 1690 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1691 |
"node_modules/run-async": {
|
| 1692 |
"version": "0.1.0",
|
| 1693 |
"resolved": "https://registry.npmjs.org/run-async/-/run-async-0.1.0.tgz",
|
|
|
|
| 1702 |
"resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-3.1.2.tgz",
|
| 1703 |
"integrity": "sha512-1I1+G2gteLB8Tkt8YI1sJvSIfa0lWuRtC8GjvtyPBcLSF5jBCCJJqKrpER5JU5r6Bhe+i9/pK3VMuUcXu0kdwQ=="
|
| 1704 |
},
|
| 1705 |
+
"node_modules/safe-buffer": {
|
| 1706 |
+
"version": "5.2.1",
|
| 1707 |
+
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
| 1708 |
+
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
| 1709 |
+
"funding": [
|
| 1710 |
+
{
|
| 1711 |
+
"type": "github",
|
| 1712 |
+
"url": "https://github.com/sponsors/feross"
|
| 1713 |
+
},
|
| 1714 |
+
{
|
| 1715 |
+
"type": "patreon",
|
| 1716 |
+
"url": "https://www.patreon.com/feross"
|
| 1717 |
+
},
|
| 1718 |
+
{
|
| 1719 |
+
"type": "consulting",
|
| 1720 |
+
"url": "https://feross.org/support"
|
| 1721 |
+
}
|
| 1722 |
+
],
|
| 1723 |
+
"license": "MIT"
|
| 1724 |
+
},
|
| 1725 |
"node_modules/safer-buffer": {
|
| 1726 |
"version": "2.1.2",
|
| 1727 |
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
|
|
|
| 1729 |
"license": "MIT"
|
| 1730 |
},
|
| 1731 |
"node_modules/send": {
|
| 1732 |
+
"version": "0.19.2",
|
| 1733 |
+
"resolved": "https://registry.npmjs.org/send/-/send-0.19.2.tgz",
|
| 1734 |
+
"integrity": "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==",
|
| 1735 |
+
"license": "MIT",
|
| 1736 |
+
"dependencies": {
|
| 1737 |
+
"debug": "2.6.9",
|
| 1738 |
+
"depd": "2.0.0",
|
| 1739 |
+
"destroy": "1.2.0",
|
| 1740 |
+
"encodeurl": "~2.0.0",
|
| 1741 |
+
"escape-html": "~1.0.3",
|
| 1742 |
+
"etag": "~1.8.1",
|
| 1743 |
+
"fresh": "~0.5.2",
|
| 1744 |
+
"http-errors": "~2.0.1",
|
| 1745 |
+
"mime": "1.6.0",
|
| 1746 |
+
"ms": "2.1.3",
|
| 1747 |
+
"on-finished": "~2.4.1",
|
| 1748 |
+
"range-parser": "~1.2.1",
|
| 1749 |
+
"statuses": "~2.0.2"
|
| 1750 |
},
|
| 1751 |
"engines": {
|
| 1752 |
+
"node": ">= 0.8.0"
|
| 1753 |
+
}
|
| 1754 |
+
},
|
| 1755 |
+
"node_modules/send/node_modules/mime": {
|
| 1756 |
+
"version": "1.6.0",
|
| 1757 |
+
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
|
| 1758 |
+
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
|
| 1759 |
+
"license": "MIT",
|
| 1760 |
+
"bin": {
|
| 1761 |
+
"mime": "cli.js"
|
| 1762 |
},
|
| 1763 |
+
"engines": {
|
| 1764 |
+
"node": ">=4"
|
|
|
|
| 1765 |
}
|
| 1766 |
},
|
| 1767 |
"node_modules/serve-static": {
|
| 1768 |
+
"version": "1.16.3",
|
| 1769 |
+
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.3.tgz",
|
| 1770 |
+
"integrity": "sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==",
|
| 1771 |
"license": "MIT",
|
| 1772 |
"dependencies": {
|
| 1773 |
+
"encodeurl": "~2.0.0",
|
| 1774 |
+
"escape-html": "~1.0.3",
|
| 1775 |
+
"parseurl": "~1.3.3",
|
| 1776 |
+
"send": "~0.19.1"
|
| 1777 |
},
|
| 1778 |
"engines": {
|
| 1779 |
+
"node": ">= 0.8.0"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1780 |
}
|
| 1781 |
},
|
| 1782 |
"node_modules/setprototypeof": {
|
|
|
|
| 1861 |
"version": "17.1.3",
|
| 1862 |
"resolved": "https://registry.npmjs.org/sift/-/sift-17.1.3.tgz",
|
| 1863 |
"integrity": "sha512-Rtlj66/b0ICeFzYTuNvX/EF1igRbbnGSvEyT79McoZa/DeGhMyC5pWKOEsZKnpkqtSeovd5FL/bjHWC3CIIvCQ==",
|
| 1864 |
+
"dev": true,
|
| 1865 |
"license": "MIT"
|
| 1866 |
},
|
| 1867 |
"node_modules/slide": {
|
|
|
|
| 1901 |
"version": "3.0.3",
|
| 1902 |
"resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",
|
| 1903 |
"integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==",
|
| 1904 |
+
"dev": true,
|
| 1905 |
"license": "MIT",
|
| 1906 |
"dependencies": {
|
| 1907 |
"memory-pager": "^1.0.2"
|
|
|
|
| 2002 |
"version": "5.1.1",
|
| 2003 |
"resolved": "https://registry.npmjs.org/tr46/-/tr46-5.1.1.tgz",
|
| 2004 |
"integrity": "sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw==",
|
| 2005 |
+
"dev": true,
|
| 2006 |
"license": "MIT",
|
| 2007 |
"dependencies": {
|
| 2008 |
"punycode": "^2.3.1"
|
|
|
|
| 2077 |
"license": "ISC"
|
| 2078 |
},
|
| 2079 |
"node_modules/type-is": {
|
| 2080 |
+
"version": "1.6.18",
|
| 2081 |
+
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
|
| 2082 |
+
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
|
| 2083 |
"license": "MIT",
|
| 2084 |
"dependencies": {
|
| 2085 |
+
"media-typer": "0.3.0",
|
| 2086 |
+
"mime-types": "~2.1.24"
|
|
|
|
| 2087 |
},
|
| 2088 |
"engines": {
|
| 2089 |
"node": ">= 0.6"
|
|
|
|
| 2113 |
}
|
| 2114 |
},
|
| 2115 |
"node_modules/undici-types": {
|
| 2116 |
+
"version": "6.21.0",
|
| 2117 |
+
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
|
| 2118 |
+
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
|
| 2119 |
"dev": true,
|
| 2120 |
"license": "MIT"
|
| 2121 |
},
|
|
|
|
| 2141 |
"node": ">=6.14.2"
|
| 2142 |
}
|
| 2143 |
},
|
| 2144 |
+
"node_modules/utils-merge": {
|
| 2145 |
+
"version": "1.0.1",
|
| 2146 |
+
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
|
| 2147 |
+
"integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
|
| 2148 |
+
"license": "MIT",
|
| 2149 |
+
"engines": {
|
| 2150 |
+
"node": ">= 0.4.0"
|
| 2151 |
+
}
|
| 2152 |
+
},
|
| 2153 |
"node_modules/v8-compile-cache-lib": {
|
| 2154 |
"version": "3.0.1",
|
| 2155 |
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
|
|
|
|
| 2170 |
"version": "7.0.0",
|
| 2171 |
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
|
| 2172 |
"integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
|
| 2173 |
+
"dev": true,
|
| 2174 |
"license": "BSD-2-Clause",
|
| 2175 |
"engines": {
|
| 2176 |
"node": ">=12"
|
|
|
|
| 2193 |
"node": ">=4.0.0"
|
| 2194 |
}
|
| 2195 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2196 |
"node_modules/whatwg-url": {
|
| 2197 |
"version": "14.2.0",
|
| 2198 |
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.2.0.tgz",
|
| 2199 |
"integrity": "sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw==",
|
| 2200 |
+
"dev": true,
|
| 2201 |
"license": "MIT",
|
| 2202 |
"dependencies": {
|
| 2203 |
"tr46": "^5.1.0",
|
node_modules/@types/express-serve-static-core/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
| 5 |
This package contains type definitions for express-serve-static-core (http://expressjs.com).
|
| 6 |
|
| 7 |
# Details
|
| 8 |
-
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express-serve-static-core.
|
| 9 |
|
| 10 |
### Additional Details
|
| 11 |
* Last updated: Sat, 10 Jan 2026 09:35:12 GMT
|
|
|
|
| 5 |
This package contains type definitions for express-serve-static-core (http://expressjs.com).
|
| 6 |
|
| 7 |
# Details
|
| 8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express-serve-static-core/v4.
|
| 9 |
|
| 10 |
### Additional Details
|
| 11 |
* Last updated: Sat, 10 Jan 2026 09:35:12 GMT
|
node_modules/@types/express-serve-static-core/index.d.ts
CHANGED
|
@@ -42,13 +42,9 @@ export interface Dictionary<T> {
|
|
| 42 |
}
|
| 43 |
|
| 44 |
export interface ParamsDictionary {
|
| 45 |
-
[key: string]: string | string[];
|
| 46 |
-
[key: number]: string;
|
| 47 |
-
}
|
| 48 |
-
export interface ParamsFlatDictionary {
|
| 49 |
[key: string | number]: string;
|
| 50 |
}
|
| 51 |
-
export type Params = ParamsDictionary
|
| 52 |
|
| 53 |
export interface Locals extends Express.Locals {}
|
| 54 |
|
|
@@ -64,7 +60,7 @@ export interface RequestHandler<
|
|
| 64 |
req: Request<P, ResBody, ReqBody, ReqQuery, LocalsObj>,
|
| 65 |
res: Response<ResBody, LocalsObj>,
|
| 66 |
next: NextFunction,
|
| 67 |
-
):
|
| 68 |
}
|
| 69 |
|
| 70 |
export type ErrorRequestHandler<
|
|
@@ -78,7 +74,7 @@ export type ErrorRequestHandler<
|
|
| 78 |
req: Request<P, ResBody, ReqBody, ReqQuery, LocalsObj>,
|
| 79 |
res: Response<ResBody, LocalsObj>,
|
| 80 |
next: NextFunction,
|
| 81 |
-
) =>
|
| 82 |
|
| 83 |
export type PathParams = string | RegExp | Array<string | RegExp>;
|
| 84 |
|
|
@@ -99,26 +95,16 @@ type GetRouteParameter<S extends string> = RemoveTail<
|
|
| 99 |
`.${string}`
|
| 100 |
>;
|
| 101 |
|
| 102 |
-
//
|
| 103 |
-
export type RouteParameters<Route extends string
|
| 104 |
-
|
| 105 |
-
? ParseRouteParameters<Required> & Partial<ParseRouteParameters<Optional>> & RouteParameters<Next>
|
| 106 |
-
: ParseRouteParameters<Route>
|
| 107 |
-
: ParamsFlatDictionary;
|
| 108 |
-
|
| 109 |
-
type ParseRouteParameters<Route extends string> = string extends Route ? ParamsDictionary
|
| 110 |
: Route extends `${string}:${infer Rest}` ?
|
| 111 |
& (
|
| 112 |
GetRouteParameter<Rest> extends never ? ParamsDictionary
|
|
|
|
| 113 |
: { [P in GetRouteParameter<Rest>]: string }
|
| 114 |
)
|
| 115 |
& (Rest extends `${GetRouteParameter<Rest>}${infer Next}` ? RouteParameters<Next> : unknown)
|
| 116 |
-
: Route extends `${string}*${infer Rest}` ?
|
| 117 |
-
& (
|
| 118 |
-
GetRouteParameter<Rest> extends never ? ParamsDictionary
|
| 119 |
-
: { [P in GetRouteParameter<Rest>]: string[] }
|
| 120 |
-
)
|
| 121 |
-
& (Rest extends `${GetRouteParameter<Rest>}${infer Next}` ? RouteParameters<Next> : unknown)
|
| 122 |
: {};
|
| 123 |
|
| 124 |
/* eslint-disable @definitelytyped/no-unnecessary-generics */
|
|
@@ -127,7 +113,7 @@ export interface IRouterMatcher<
|
|
| 127 |
Method extends "all" | "get" | "post" | "put" | "delete" | "patch" | "options" | "head" = any,
|
| 128 |
> {
|
| 129 |
<
|
| 130 |
-
Route extends string
|
| 131 |
P = RouteParameters<Route>,
|
| 132 |
ResBody = any,
|
| 133 |
ReqBody = any,
|
|
@@ -140,7 +126,7 @@ export interface IRouterMatcher<
|
|
| 140 |
...handlers: Array<RequestHandler<P, ResBody, ReqBody, ReqQuery, LocalsObj>>
|
| 141 |
): T;
|
| 142 |
<
|
| 143 |
-
Path extends string
|
| 144 |
P = RouteParameters<Path>,
|
| 145 |
ResBody = any,
|
| 146 |
ReqBody = any,
|
|
@@ -177,7 +163,7 @@ export interface IRouterMatcher<
|
|
| 177 |
(path: PathParams, subApplication: Application): T;
|
| 178 |
}
|
| 179 |
|
| 180 |
-
export interface IRouterHandler<T, Route extends string
|
| 181 |
(...handlers: Array<RequestHandler<RouteParameters<Route>>>): T;
|
| 182 |
(...handlers: Array<RequestHandlerParams<RouteParameters<Route>>>): T;
|
| 183 |
<
|
|
@@ -256,6 +242,13 @@ export interface IRouter extends RequestHandler {
|
|
| 256 |
*/
|
| 257 |
param(name: string, handler: RequestParamHandler): this;
|
| 258 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 259 |
/**
|
| 260 |
* Special-cased "all" method, applying the given route `path`,
|
| 261 |
* middleware, and callback to _every_ HTTP method.
|
|
@@ -293,7 +286,7 @@ export interface IRouter extends RequestHandler {
|
|
| 293 |
|
| 294 |
use: IRouterHandler<this> & IRouterMatcher<this>;
|
| 295 |
|
| 296 |
-
route<T extends string
|
| 297 |
route(prefix: PathParams): IRoute;
|
| 298 |
/**
|
| 299 |
* Stack of configured routes
|
|
@@ -312,7 +305,7 @@ export interface ILayer {
|
|
| 312 |
handle: (req: Request, res: Response, next: NextFunction) => any;
|
| 313 |
}
|
| 314 |
|
| 315 |
-
export interface IRoute<Route extends string
|
| 316 |
path: string;
|
| 317 |
stack: ILayer[];
|
| 318 |
all: IRouterHandler<this, Route>;
|
|
@@ -353,7 +346,7 @@ export interface CookieOptions {
|
|
| 353 |
maxAge?: number | undefined;
|
| 354 |
/** Indicates if the cookie should be signed. */
|
| 355 |
signed?: boolean | undefined;
|
| 356 |
-
/** Expiry date of the cookie in GMT. If not specified
|
| 357 |
expires?: Date | undefined;
|
| 358 |
/** Flags the cookie to be accessible only by the web server. */
|
| 359 |
httpOnly?: boolean | undefined;
|
|
@@ -388,17 +381,6 @@ export interface RequestRanges extends RangeParserRanges {}
|
|
| 388 |
|
| 389 |
export type Errback = (err: Error) => void;
|
| 390 |
|
| 391 |
-
/**
|
| 392 |
-
* @param P For most requests, this should be `ParamsDictionary`, but if you're
|
| 393 |
-
* using this in a route handler for a route that uses a `RegExp`, then `req.params`
|
| 394 |
-
* will only contains strings, in which case you should use `ParamsFlatDictionary` instead.
|
| 395 |
-
*
|
| 396 |
-
* @example
|
| 397 |
-
* app.get('/user/:id', (req, res) => res.send(req.params.id)); // implicitly `ParamsDictionary`, parameter is string
|
| 398 |
-
* app.get('/user/*id', (req, res) => res.send(req.params.id)); // implicitly `ParamsDictionary`, parameter is string[]
|
| 399 |
-
* app.get(/user\/(?<id>.*)/, (req, res) => res.send(req.params.id)); // implicitly `ParamsFlatDictionary`, parameter is string
|
| 400 |
-
* app.get(/user\/(.*)/, (req, res) => res.send(req.params[0])); // implicitly `ParamsFlatDictionary`, parameter is string
|
| 401 |
-
*/
|
| 402 |
export interface Request<
|
| 403 |
P = ParamsDictionary,
|
| 404 |
ResBody = any,
|
|
@@ -529,6 +511,21 @@ export interface Request<
|
|
| 529 |
*/
|
| 530 |
accepted: MediaType[];
|
| 531 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 532 |
/**
|
| 533 |
* Check if the incoming request contains the "Content-Type"
|
| 534 |
* header field, and it contains the give mime `type`.
|
|
@@ -608,12 +605,12 @@ export interface Request<
|
|
| 608 |
readonly path: string;
|
| 609 |
|
| 610 |
/**
|
| 611 |
-
*
|
| 612 |
*/
|
| 613 |
readonly hostname: string;
|
| 614 |
|
| 615 |
/**
|
| 616 |
-
*
|
| 617 |
*/
|
| 618 |
readonly host: string;
|
| 619 |
|
|
@@ -801,6 +798,23 @@ export interface Response<
|
|
| 801 |
sendFile(path: string, fn?: Errback): void;
|
| 802 |
sendFile(path: string, options: SendFileOptions, fn?: Errback): void;
|
| 803 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 804 |
/**
|
| 805 |
* Transfer the file at the given `path` as an attachment.
|
| 806 |
*
|
|
@@ -812,7 +826,7 @@ export interface Response<
|
|
| 812 |
* The optional options argument passes through to the underlying
|
| 813 |
* res.sendFile() call, and takes the exact same parameters.
|
| 814 |
*
|
| 815 |
-
* This method uses `res.
|
| 816 |
*/
|
| 817 |
download(path: string, fn?: Errback): void;
|
| 818 |
download(path: string, filename: string, fn?: Errback): void;
|
|
@@ -956,6 +970,10 @@ export interface Response<
|
|
| 956 |
/**
|
| 957 |
* Set the location header to `url`.
|
| 958 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 959 |
* Examples:
|
| 960 |
*
|
| 961 |
* res.location('/foo/bar').;
|
|
@@ -982,17 +1000,22 @@ export interface Response<
|
|
| 982 |
* defaulting to 302.
|
| 983 |
*
|
| 984 |
* The resulting `url` is determined by `res.location()`, so
|
| 985 |
-
* it will play nicely with mounted apps, relative paths,
|
|
|
|
| 986 |
*
|
| 987 |
* Examples:
|
| 988 |
*
|
|
|
|
| 989 |
* res.redirect('/foo/bar');
|
| 990 |
* res.redirect('http://example.com');
|
| 991 |
* res.redirect(301, 'http://example.com');
|
|
|
|
| 992 |
* res.redirect('../login'); // /blog/post/1 -> /blog/login
|
| 993 |
*/
|
| 994 |
redirect(url: string): void;
|
| 995 |
redirect(status: number, url: string): void;
|
|
|
|
|
|
|
| 996 |
|
| 997 |
/**
|
| 998 |
* Render `view` with the given `options` and optional callback `fn`.
|
|
@@ -1121,6 +1144,13 @@ export interface Application<
|
|
| 1121 |
|
| 1122 |
param(name: string | string[], handler: RequestParamHandler): this;
|
| 1123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1124 |
/**
|
| 1125 |
* Return the app's absolute pathname
|
| 1126 |
* based on the parent(s) that have
|
|
@@ -1194,14 +1224,14 @@ export interface Application<
|
|
| 1194 |
* http.createServer(app).listen(80);
|
| 1195 |
* https.createServer({ ... }, app).listen(443);
|
| 1196 |
*/
|
| 1197 |
-
listen(port: number, hostname: string, backlog: number, callback?: (
|
| 1198 |
-
listen(port: number, hostname: string, callback?: (
|
| 1199 |
-
listen(port: number, callback?: (
|
| 1200 |
-
listen(callback?: (
|
| 1201 |
-
listen(path: string, callback?: (
|
| 1202 |
-
listen(handle: any, listeningListener?: (
|
| 1203 |
-
|
| 1204 |
-
router:
|
| 1205 |
|
| 1206 |
settings: any;
|
| 1207 |
|
|
|
|
| 42 |
}
|
| 43 |
|
| 44 |
export interface ParamsDictionary {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
[key: string | number]: string;
|
| 46 |
}
|
| 47 |
+
export type Params = ParamsDictionary;
|
| 48 |
|
| 49 |
export interface Locals extends Express.Locals {}
|
| 50 |
|
|
|
|
| 60 |
req: Request<P, ResBody, ReqBody, ReqQuery, LocalsObj>,
|
| 61 |
res: Response<ResBody, LocalsObj>,
|
| 62 |
next: NextFunction,
|
| 63 |
+
): void;
|
| 64 |
}
|
| 65 |
|
| 66 |
export type ErrorRequestHandler<
|
|
|
|
| 74 |
req: Request<P, ResBody, ReqBody, ReqQuery, LocalsObj>,
|
| 75 |
res: Response<ResBody, LocalsObj>,
|
| 76 |
next: NextFunction,
|
| 77 |
+
) => void;
|
| 78 |
|
| 79 |
export type PathParams = string | RegExp | Array<string | RegExp>;
|
| 80 |
|
|
|
|
| 95 |
`.${string}`
|
| 96 |
>;
|
| 97 |
|
| 98 |
+
// prettier-ignore
|
| 99 |
+
export type RouteParameters<Route extends string> = string extends Route ? ParamsDictionary
|
| 100 |
+
: Route extends `${string}(${string}` ? ParamsDictionary // TODO: handling for regex parameters
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
: Route extends `${string}:${infer Rest}` ?
|
| 102 |
& (
|
| 103 |
GetRouteParameter<Rest> extends never ? ParamsDictionary
|
| 104 |
+
: GetRouteParameter<Rest> extends `${infer ParamName}?` ? { [P in ParamName]?: string }
|
| 105 |
: { [P in GetRouteParameter<Rest>]: string }
|
| 106 |
)
|
| 107 |
& (Rest extends `${GetRouteParameter<Rest>}${infer Next}` ? RouteParameters<Next> : unknown)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
: {};
|
| 109 |
|
| 110 |
/* eslint-disable @definitelytyped/no-unnecessary-generics */
|
|
|
|
| 113 |
Method extends "all" | "get" | "post" | "put" | "delete" | "patch" | "options" | "head" = any,
|
| 114 |
> {
|
| 115 |
<
|
| 116 |
+
Route extends string,
|
| 117 |
P = RouteParameters<Route>,
|
| 118 |
ResBody = any,
|
| 119 |
ReqBody = any,
|
|
|
|
| 126 |
...handlers: Array<RequestHandler<P, ResBody, ReqBody, ReqQuery, LocalsObj>>
|
| 127 |
): T;
|
| 128 |
<
|
| 129 |
+
Path extends string,
|
| 130 |
P = RouteParameters<Path>,
|
| 131 |
ResBody = any,
|
| 132 |
ReqBody = any,
|
|
|
|
| 163 |
(path: PathParams, subApplication: Application): T;
|
| 164 |
}
|
| 165 |
|
| 166 |
+
export interface IRouterHandler<T, Route extends string = string> {
|
| 167 |
(...handlers: Array<RequestHandler<RouteParameters<Route>>>): T;
|
| 168 |
(...handlers: Array<RequestHandlerParams<RouteParameters<Route>>>): T;
|
| 169 |
<
|
|
|
|
| 242 |
*/
|
| 243 |
param(name: string, handler: RequestParamHandler): this;
|
| 244 |
|
| 245 |
+
/**
|
| 246 |
+
* Alternatively, you can pass only a callback, in which case you have the opportunity to alter the app.param()
|
| 247 |
+
*
|
| 248 |
+
* @deprecated since version 4.11
|
| 249 |
+
*/
|
| 250 |
+
param(callback: (name: string, matcher: RegExp) => RequestParamHandler): this;
|
| 251 |
+
|
| 252 |
/**
|
| 253 |
* Special-cased "all" method, applying the given route `path`,
|
| 254 |
* middleware, and callback to _every_ HTTP method.
|
|
|
|
| 286 |
|
| 287 |
use: IRouterHandler<this> & IRouterMatcher<this>;
|
| 288 |
|
| 289 |
+
route<T extends string>(prefix: T): IRoute<T>;
|
| 290 |
route(prefix: PathParams): IRoute;
|
| 291 |
/**
|
| 292 |
* Stack of configured routes
|
|
|
|
| 305 |
handle: (req: Request, res: Response, next: NextFunction) => any;
|
| 306 |
}
|
| 307 |
|
| 308 |
+
export interface IRoute<Route extends string = string> {
|
| 309 |
path: string;
|
| 310 |
stack: ILayer[];
|
| 311 |
all: IRouterHandler<this, Route>;
|
|
|
|
| 346 |
maxAge?: number | undefined;
|
| 347 |
/** Indicates if the cookie should be signed. */
|
| 348 |
signed?: boolean | undefined;
|
| 349 |
+
/** Expiry date of the cookie in GMT. If not specified or set to 0, creates a session cookie. */
|
| 350 |
expires?: Date | undefined;
|
| 351 |
/** Flags the cookie to be accessible only by the web server. */
|
| 352 |
httpOnly?: boolean | undefined;
|
|
|
|
| 381 |
|
| 382 |
export type Errback = (err: Error) => void;
|
| 383 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 384 |
export interface Request<
|
| 385 |
P = ParamsDictionary,
|
| 386 |
ResBody = any,
|
|
|
|
| 511 |
*/
|
| 512 |
accepted: MediaType[];
|
| 513 |
|
| 514 |
+
/**
|
| 515 |
+
* @deprecated since 4.11 Use either req.params, req.body or req.query, as applicable.
|
| 516 |
+
*
|
| 517 |
+
* Return the value of param `name` when present or `defaultValue`.
|
| 518 |
+
*
|
| 519 |
+
* - Checks route placeholders, ex: _/user/:id_
|
| 520 |
+
* - Checks body params, ex: id=12, {"id":12}
|
| 521 |
+
* - Checks query string params, ex: ?id=12
|
| 522 |
+
*
|
| 523 |
+
* To utilize request bodies, `req.body`
|
| 524 |
+
* should be an object. This can be done by using
|
| 525 |
+
* the `connect.bodyParser()` middleware.
|
| 526 |
+
*/
|
| 527 |
+
param(name: string, defaultValue?: any): string;
|
| 528 |
+
|
| 529 |
/**
|
| 530 |
* Check if the incoming request contains the "Content-Type"
|
| 531 |
* header field, and it contains the give mime `type`.
|
|
|
|
| 605 |
readonly path: string;
|
| 606 |
|
| 607 |
/**
|
| 608 |
+
* Parse the "Host" header field hostname.
|
| 609 |
*/
|
| 610 |
readonly hostname: string;
|
| 611 |
|
| 612 |
/**
|
| 613 |
+
* @deprecated Use hostname instead.
|
| 614 |
*/
|
| 615 |
readonly host: string;
|
| 616 |
|
|
|
|
| 798 |
sendFile(path: string, fn?: Errback): void;
|
| 799 |
sendFile(path: string, options: SendFileOptions, fn?: Errback): void;
|
| 800 |
|
| 801 |
+
/**
|
| 802 |
+
* @deprecated Use sendFile instead.
|
| 803 |
+
*/
|
| 804 |
+
sendfile(path: string): void;
|
| 805 |
+
/**
|
| 806 |
+
* @deprecated Use sendFile instead.
|
| 807 |
+
*/
|
| 808 |
+
sendfile(path: string, options: SendFileOptions): void;
|
| 809 |
+
/**
|
| 810 |
+
* @deprecated Use sendFile instead.
|
| 811 |
+
*/
|
| 812 |
+
sendfile(path: string, fn: Errback): void;
|
| 813 |
+
/**
|
| 814 |
+
* @deprecated Use sendFile instead.
|
| 815 |
+
*/
|
| 816 |
+
sendfile(path: string, options: SendFileOptions, fn: Errback): void;
|
| 817 |
+
|
| 818 |
/**
|
| 819 |
* Transfer the file at the given `path` as an attachment.
|
| 820 |
*
|
|
|
|
| 826 |
* The optional options argument passes through to the underlying
|
| 827 |
* res.sendFile() call, and takes the exact same parameters.
|
| 828 |
*
|
| 829 |
+
* This method uses `res.sendfile()`.
|
| 830 |
*/
|
| 831 |
download(path: string, fn?: Errback): void;
|
| 832 |
download(path: string, filename: string, fn?: Errback): void;
|
|
|
|
| 970 |
/**
|
| 971 |
* Set the location header to `url`.
|
| 972 |
*
|
| 973 |
+
* The given `url` can also be the name of a mapped url, for
|
| 974 |
+
* example by default express supports "back" which redirects
|
| 975 |
+
* to the _Referrer_ or _Referer_ headers or "/".
|
| 976 |
+
*
|
| 977 |
* Examples:
|
| 978 |
*
|
| 979 |
* res.location('/foo/bar').;
|
|
|
|
| 1000 |
* defaulting to 302.
|
| 1001 |
*
|
| 1002 |
* The resulting `url` is determined by `res.location()`, so
|
| 1003 |
+
* it will play nicely with mounted apps, relative paths,
|
| 1004 |
+
* `"back"` etc.
|
| 1005 |
*
|
| 1006 |
* Examples:
|
| 1007 |
*
|
| 1008 |
+
* res.redirect('back');
|
| 1009 |
* res.redirect('/foo/bar');
|
| 1010 |
* res.redirect('http://example.com');
|
| 1011 |
* res.redirect(301, 'http://example.com');
|
| 1012 |
+
* res.redirect('http://example.com', 301);
|
| 1013 |
* res.redirect('../login'); // /blog/post/1 -> /blog/login
|
| 1014 |
*/
|
| 1015 |
redirect(url: string): void;
|
| 1016 |
redirect(status: number, url: string): void;
|
| 1017 |
+
/** @deprecated use res.redirect(status, url) instead */
|
| 1018 |
+
redirect(url: string, status: number): void;
|
| 1019 |
|
| 1020 |
/**
|
| 1021 |
* Render `view` with the given `options` and optional callback `fn`.
|
|
|
|
| 1144 |
|
| 1145 |
param(name: string | string[], handler: RequestParamHandler): this;
|
| 1146 |
|
| 1147 |
+
/**
|
| 1148 |
+
* Alternatively, you can pass only a callback, in which case you have the opportunity to alter the app.param()
|
| 1149 |
+
*
|
| 1150 |
+
* @deprecated since version 4.11
|
| 1151 |
+
*/
|
| 1152 |
+
param(callback: (name: string, matcher: RegExp) => RequestParamHandler): this;
|
| 1153 |
+
|
| 1154 |
/**
|
| 1155 |
* Return the app's absolute pathname
|
| 1156 |
* based on the parent(s) that have
|
|
|
|
| 1224 |
* http.createServer(app).listen(80);
|
| 1225 |
* https.createServer({ ... }, app).listen(443);
|
| 1226 |
*/
|
| 1227 |
+
listen(port: number, hostname: string, backlog: number, callback?: () => void): http.Server;
|
| 1228 |
+
listen(port: number, hostname: string, callback?: () => void): http.Server;
|
| 1229 |
+
listen(port: number, callback?: () => void): http.Server;
|
| 1230 |
+
listen(callback?: () => void): http.Server;
|
| 1231 |
+
listen(path: string, callback?: () => void): http.Server;
|
| 1232 |
+
listen(handle: any, listeningListener?: () => void): http.Server;
|
| 1233 |
+
|
| 1234 |
+
router: string;
|
| 1235 |
|
| 1236 |
settings: any;
|
| 1237 |
|
node_modules/@types/express-serve-static-core/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "@types/express-serve-static-core",
|
| 3 |
-
"version": "
|
| 4 |
"description": "TypeScript definitions for express-serve-static-core",
|
| 5 |
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express-serve-static-core",
|
| 6 |
"license": "MIT",
|
|
@@ -46,6 +46,6 @@
|
|
| 46 |
"@types/send": "*"
|
| 47 |
},
|
| 48 |
"peerDependencies": {},
|
| 49 |
-
"typesPublisherContentHash": "
|
| 50 |
"typeScriptVersion": "5.2"
|
| 51 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"name": "@types/express-serve-static-core",
|
| 3 |
+
"version": "4.19.8",
|
| 4 |
"description": "TypeScript definitions for express-serve-static-core",
|
| 5 |
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express-serve-static-core",
|
| 6 |
"license": "MIT",
|
|
|
|
| 46 |
"@types/send": "*"
|
| 47 |
},
|
| 48 |
"peerDependencies": {},
|
| 49 |
+
"typesPublisherContentHash": "239eaebf1ca974a76fca799db9b418767c926de37604da25b62ea51f1919676a",
|
| 50 |
"typeScriptVersion": "5.2"
|
| 51 |
}
|
node_modules/@types/express/README.md
CHANGED
|
@@ -5,11 +5,11 @@
|
|
| 5 |
This package contains type definitions for express (http://expressjs.com).
|
| 6 |
|
| 7 |
# Details
|
| 8 |
-
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express.
|
| 9 |
|
| 10 |
### Additional Details
|
| 11 |
-
* Last updated: Mon,
|
| 12 |
-
* Dependencies: [@types/body-parser](https://npmjs.com/package/@types/body-parser), [@types/express-serve-static-core](https://npmjs.com/package/@types/express-serve-static-core), [@types/serve-static](https://npmjs.com/package/@types/serve-static)
|
| 13 |
|
| 14 |
# Credits
|
| 15 |
These definitions were written by [Boris Yankov](https://github.com/borisyankov), [Puneet Arora](https://github.com/puneetar), [Dylan Frankland](https://github.com/dfrankland), and [Sebastian Beltran](https://github.com/bjohansebas).
|
|
|
|
| 5 |
This package contains type definitions for express (http://expressjs.com).
|
| 6 |
|
| 7 |
# Details
|
| 8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express/v4.
|
| 9 |
|
| 10 |
### Additional Details
|
| 11 |
+
* Last updated: Mon, 27 Oct 2025 20:34:59 GMT
|
| 12 |
+
* Dependencies: [@types/body-parser](https://npmjs.com/package/@types/body-parser), [@types/express-serve-static-core](https://npmjs.com/package/@types/express-serve-static-core), [@types/qs](https://npmjs.com/package/@types/qs), [@types/serve-static](https://npmjs.com/package/@types/serve-static)
|
| 13 |
|
| 14 |
# Credits
|
| 15 |
These definitions were written by [Boris Yankov](https://github.com/borisyankov), [Puneet Arora](https://github.com/puneetar), [Dylan Frankland](https://github.com/dfrankland), and [Sebastian Beltran](https://github.com/bjohansebas).
|
node_modules/@types/express/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
| 10 |
|
| 11 |
import bodyParser = require("body-parser");
|
| 12 |
import * as core from "express-serve-static-core";
|
|
|
|
| 13 |
import serveStatic = require("serve-static");
|
| 14 |
|
| 15 |
/**
|
|
@@ -54,6 +55,11 @@ declare namespace e {
|
|
| 54 |
*/
|
| 55 |
var urlencoded: typeof bodyParser.urlencoded;
|
| 56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
export function Router(options?: RouterOptions): core.Router;
|
| 58 |
|
| 59 |
interface RouterOptions {
|
|
|
|
| 10 |
|
| 11 |
import bodyParser = require("body-parser");
|
| 12 |
import * as core from "express-serve-static-core";
|
| 13 |
+
import * as qs from "qs";
|
| 14 |
import serveStatic = require("serve-static");
|
| 15 |
|
| 16 |
/**
|
|
|
|
| 55 |
*/
|
| 56 |
var urlencoded: typeof bodyParser.urlencoded;
|
| 57 |
|
| 58 |
+
/**
|
| 59 |
+
* This is a built-in middleware function in Express. It parses incoming request query parameters.
|
| 60 |
+
*/
|
| 61 |
+
export function query(options: qs.IParseOptions | typeof qs.parse): Handler;
|
| 62 |
+
|
| 63 |
export function Router(options?: RouterOptions): core.Router;
|
| 64 |
|
| 65 |
interface RouterOptions {
|
node_modules/@types/express/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "@types/express",
|
| 3 |
-
"version": "
|
| 4 |
"description": "TypeScript definitions for express",
|
| 5 |
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express",
|
| 6 |
"license": "MIT",
|
|
@@ -36,10 +36,11 @@
|
|
| 36 |
"scripts": {},
|
| 37 |
"dependencies": {
|
| 38 |
"@types/body-parser": "*",
|
| 39 |
-
"@types/express-serve-static-core": "^
|
| 40 |
-
"@types/
|
|
|
|
| 41 |
},
|
| 42 |
"peerDependencies": {},
|
| 43 |
-
"typesPublisherContentHash": "
|
| 44 |
"typeScriptVersion": "5.2"
|
| 45 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"name": "@types/express",
|
| 3 |
+
"version": "4.17.25",
|
| 4 |
"description": "TypeScript definitions for express",
|
| 5 |
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express",
|
| 6 |
"license": "MIT",
|
|
|
|
| 36 |
"scripts": {},
|
| 37 |
"dependencies": {
|
| 38 |
"@types/body-parser": "*",
|
| 39 |
+
"@types/express-serve-static-core": "^4.17.33",
|
| 40 |
+
"@types/qs": "*",
|
| 41 |
+
"@types/serve-static": "^1"
|
| 42 |
},
|
| 43 |
"peerDependencies": {},
|
| 44 |
+
"typesPublisherContentHash": "875cd41acf5e799aefe604cb91b2b033db9e38e44df52044870814402a054994",
|
| 45 |
"typeScriptVersion": "5.2"
|
| 46 |
}
|
node_modules/@types/mime-types/README.md
CHANGED
|
@@ -9,26 +9,20 @@ Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree
|
|
| 9 |
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mime-types/index.d.ts)
|
| 10 |
````ts
|
| 11 |
export function lookup(filenameOrExt: string): string | false;
|
| 12 |
-
|
| 13 |
export function contentType(filenameOrExt: string): string | false;
|
| 14 |
-
|
| 15 |
export function extension(typeString: string): string | false;
|
| 16 |
-
|
| 17 |
export function charset(typeString: string): string | false;
|
| 18 |
-
|
| 19 |
export namespace charsets {
|
| 20 |
const lookup: typeof charset;
|
| 21 |
}
|
| 22 |
-
|
| 23 |
export const types: { [key: string]: string };
|
| 24 |
-
|
| 25 |
export const extensions: { [key: string]: string[] };
|
| 26 |
|
| 27 |
````
|
| 28 |
|
| 29 |
### Additional Details
|
| 30 |
-
* Last updated:
|
| 31 |
* Dependencies: none
|
| 32 |
|
| 33 |
# Credits
|
| 34 |
-
These definitions were written by [Gyusun Yeom](https://github.com/Perlmint)
|
|
|
|
| 9 |
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mime-types/index.d.ts)
|
| 10 |
````ts
|
| 11 |
export function lookup(filenameOrExt: string): string | false;
|
|
|
|
| 12 |
export function contentType(filenameOrExt: string): string | false;
|
|
|
|
| 13 |
export function extension(typeString: string): string | false;
|
|
|
|
| 14 |
export function charset(typeString: string): string | false;
|
|
|
|
| 15 |
export namespace charsets {
|
| 16 |
const lookup: typeof charset;
|
| 17 |
}
|
|
|
|
| 18 |
export const types: { [key: string]: string };
|
|
|
|
| 19 |
export const extensions: { [key: string]: string[] };
|
| 20 |
|
| 21 |
````
|
| 22 |
|
| 23 |
### Additional Details
|
| 24 |
+
* Last updated: Tue, 07 Nov 2023 09:09:39 GMT
|
| 25 |
* Dependencies: none
|
| 26 |
|
| 27 |
# Credits
|
| 28 |
+
These definitions were written by [Gyusun Yeom](https://github.com/Perlmint).
|
node_modules/@types/mime-types/index.d.ts
CHANGED
|
@@ -1,15 +1,9 @@
|
|
| 1 |
export function lookup(filenameOrExt: string): string | false;
|
| 2 |
-
|
| 3 |
export function contentType(filenameOrExt: string): string | false;
|
| 4 |
-
|
| 5 |
export function extension(typeString: string): string | false;
|
| 6 |
-
|
| 7 |
export function charset(typeString: string): string | false;
|
| 8 |
-
|
| 9 |
export namespace charsets {
|
| 10 |
const lookup: typeof charset;
|
| 11 |
}
|
| 12 |
-
|
| 13 |
export const types: { [key: string]: string };
|
| 14 |
-
|
| 15 |
export const extensions: { [key: string]: string[] };
|
|
|
|
| 1 |
export function lookup(filenameOrExt: string): string | false;
|
|
|
|
| 2 |
export function contentType(filenameOrExt: string): string | false;
|
|
|
|
| 3 |
export function extension(typeString: string): string | false;
|
|
|
|
| 4 |
export function charset(typeString: string): string | false;
|
|
|
|
| 5 |
export namespace charsets {
|
| 6 |
const lookup: typeof charset;
|
| 7 |
}
|
|
|
|
| 8 |
export const types: { [key: string]: string };
|
|
|
|
| 9 |
export const extensions: { [key: string]: string[] };
|
node_modules/@types/mime-types/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "@types/mime-types",
|
| 3 |
-
"version": "
|
| 4 |
"description": "TypeScript definitions for mime-types",
|
| 5 |
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mime-types",
|
| 6 |
"license": "MIT",
|
|
@@ -9,11 +9,6 @@
|
|
| 9 |
"name": "Gyusun Yeom",
|
| 10 |
"githubUsername": "Perlmint",
|
| 11 |
"url": "https://github.com/Perlmint"
|
| 12 |
-
},
|
| 13 |
-
{
|
| 14 |
-
"name": "Sebastian Beltran",
|
| 15 |
-
"githubUsername": "bjohansebas",
|
| 16 |
-
"url": "https://github.com/bjohansebas"
|
| 17 |
}
|
| 18 |
],
|
| 19 |
"main": "",
|
|
@@ -25,7 +20,6 @@
|
|
| 25 |
},
|
| 26 |
"scripts": {},
|
| 27 |
"dependencies": {},
|
| 28 |
-
"
|
| 29 |
-
"
|
| 30 |
-
"typeScriptVersion": "5.1"
|
| 31 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"name": "@types/mime-types",
|
| 3 |
+
"version": "2.1.4",
|
| 4 |
"description": "TypeScript definitions for mime-types",
|
| 5 |
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mime-types",
|
| 6 |
"license": "MIT",
|
|
|
|
| 9 |
"name": "Gyusun Yeom",
|
| 10 |
"githubUsername": "Perlmint",
|
| 11 |
"url": "https://github.com/Perlmint"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
}
|
| 13 |
],
|
| 14 |
"main": "",
|
|
|
|
| 20 |
},
|
| 21 |
"scripts": {},
|
| 22 |
"dependencies": {},
|
| 23 |
+
"typesPublisherContentHash": "4fc952c6b156849cee9d95c0ab6082b55a05cd04a2e69589aab53982b696da9c",
|
| 24 |
+
"typeScriptVersion": "4.5"
|
|
|
|
| 25 |
}
|
node_modules/@types/mime/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) Microsoft Corporation.
|
| 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
|
node_modules/@types/mime/Mime.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { TypeMap } from "./index";
|
| 2 |
+
|
| 3 |
+
export default class Mime {
|
| 4 |
+
constructor(mimes: TypeMap);
|
| 5 |
+
|
| 6 |
+
lookup(path: string, fallback?: string): string;
|
| 7 |
+
extension(mime: string): string | undefined;
|
| 8 |
+
load(filepath: string): void;
|
| 9 |
+
define(mimes: TypeMap): void;
|
| 10 |
+
}
|
node_modules/@types/mime/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Installation
|
| 2 |
+
> `npm install --save @types/mime`
|
| 3 |
+
|
| 4 |
+
# Summary
|
| 5 |
+
This package contains type definitions for mime (https://github.com/broofa/node-mime).
|
| 6 |
+
|
| 7 |
+
# Details
|
| 8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mime/v1.
|
| 9 |
+
|
| 10 |
+
### Additional Details
|
| 11 |
+
* Last updated: Tue, 07 Nov 2023 20:08:00 GMT
|
| 12 |
+
* Dependencies: none
|
| 13 |
+
|
| 14 |
+
# Credits
|
| 15 |
+
These definitions were written by [Jeff Goddard](https://github.com/jedigo), and [Daniel Hritzkiv](https://github.com/dhritzkiv).
|
node_modules/@types/mime/index.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Originally imported from: https://github.com/soywiz/typescript-node-definitions/mime.d.ts
|
| 2 |
+
|
| 3 |
+
export as namespace mime;
|
| 4 |
+
|
| 5 |
+
export interface TypeMap {
|
| 6 |
+
[key: string]: string[];
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
/**
|
| 10 |
+
* Look up a mime type based on extension.
|
| 11 |
+
*
|
| 12 |
+
* If not found, uses the fallback argument if provided, and otherwise
|
| 13 |
+
* uses `default_type`.
|
| 14 |
+
*/
|
| 15 |
+
export function lookup(path: string, fallback?: string): string;
|
| 16 |
+
/**
|
| 17 |
+
* Return a file extensions associated with a mime type.
|
| 18 |
+
*/
|
| 19 |
+
export function extension(mime: string): string | undefined;
|
| 20 |
+
/**
|
| 21 |
+
* Load an Apache2-style ".types" file.
|
| 22 |
+
*/
|
| 23 |
+
export function load(filepath: string): void;
|
| 24 |
+
export function define(mimes: TypeMap): void;
|
| 25 |
+
|
| 26 |
+
export interface Charsets {
|
| 27 |
+
lookup(mime: string, fallback: string): string;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
export const charsets: Charsets;
|
| 31 |
+
export const default_type: string;
|
node_modules/@types/mime/lite.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { default as Mime } from "./Mime";
|
| 2 |
+
|
| 3 |
+
declare const mimelite: Mime;
|
| 4 |
+
|
| 5 |
+
export as namespace mimelite;
|
| 6 |
+
|
| 7 |
+
export = mimelite;
|
node_modules/@types/mime/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@types/mime",
|
| 3 |
+
"version": "1.3.5",
|
| 4 |
+
"description": "TypeScript definitions for mime",
|
| 5 |
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mime",
|
| 6 |
+
"license": "MIT",
|
| 7 |
+
"contributors": [
|
| 8 |
+
{
|
| 9 |
+
"name": "Jeff Goddard",
|
| 10 |
+
"githubUsername": "jedigo",
|
| 11 |
+
"url": "https://github.com/jedigo"
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"name": "Daniel Hritzkiv",
|
| 15 |
+
"githubUsername": "dhritzkiv",
|
| 16 |
+
"url": "https://github.com/dhritzkiv"
|
| 17 |
+
}
|
| 18 |
+
],
|
| 19 |
+
"main": "",
|
| 20 |
+
"types": "index.d.ts",
|
| 21 |
+
"repository": {
|
| 22 |
+
"type": "git",
|
| 23 |
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
| 24 |
+
"directory": "types/mime"
|
| 25 |
+
},
|
| 26 |
+
"scripts": {},
|
| 27 |
+
"dependencies": {},
|
| 28 |
+
"typesPublisherContentHash": "2ad7ee9a549e6721825e733c6a1a7e8bee0ca7ba93d9ab922c8f4558def52d77",
|
| 29 |
+
"typeScriptVersion": "4.5"
|
| 30 |
+
}
|
node_modules/@types/mongoose/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "@types/mongoose",
|
| 3 |
-
"version": "5.11.
|
| 4 |
"typings": null,
|
| 5 |
"description": "Stub TypeScript definitions entry for mongoose, which provides its own types definitions",
|
| 6 |
"main": "",
|
|
|
|
| 1 |
{
|
| 2 |
"name": "@types/mongoose",
|
| 3 |
+
"version": "5.11.97",
|
| 4 |
"typings": null,
|
| 5 |
"description": "Stub TypeScript definitions entry for mongoose, which provides its own types definitions",
|
| 6 |
"main": "",
|
node_modules/@types/node/README.md
CHANGED
|
@@ -5,11 +5,11 @@
|
|
| 5 |
This package contains type definitions for node (https://nodejs.org/).
|
| 6 |
|
| 7 |
# Details
|
| 8 |
-
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
| 9 |
|
| 10 |
### Additional Details
|
| 11 |
-
* Last updated:
|
| 12 |
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
| 13 |
|
| 14 |
# Credits
|
| 15 |
-
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [Alberto Schiabel](https://github.com/jkomyno), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [David Junger](https://github.com/touffy), [Mohsen Azimi](https://github.com/mohsen1), [Nikita Galkin](https://github.com/galkin), [Sebastian Silbermann](https://github.com/eps1lon), [Wilco Bakker](https://github.com/WilcoBakker), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina), [Dmitry Semigradsky](https://github.com/Semigradsky)
|
|
|
|
| 5 |
This package contains type definitions for node (https://nodejs.org/).
|
| 6 |
|
| 7 |
# Details
|
| 8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v20.
|
| 9 |
|
| 10 |
### Additional Details
|
| 11 |
+
* Last updated: Thu, 26 Feb 2026 18:47:04 GMT
|
| 12 |
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
| 13 |
|
| 14 |
# Credits
|
| 15 |
+
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [Alberto Schiabel](https://github.com/jkomyno), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [David Junger](https://github.com/touffy), [Mohsen Azimi](https://github.com/mohsen1), [Nikita Galkin](https://github.com/galkin), [Sebastian Silbermann](https://github.com/eps1lon), [Wilco Bakker](https://github.com/WilcoBakker), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina), and [Dmitry Semigradsky](https://github.com/Semigradsky).
|
node_modules/@types/node/assert.d.ts
CHANGED
|
@@ -1,17 +1,15 @@
|
|
| 1 |
/**
|
| 2 |
* The `node:assert` module provides a set of assertion functions for verifying
|
| 3 |
* invariants.
|
| 4 |
-
* @see [source](https://github.com/nodejs/node/blob/
|
| 5 |
*/
|
| 6 |
-
declare module "
|
| 7 |
-
import strict = require("node:assert/strict");
|
| 8 |
/**
|
| 9 |
-
* An alias of {@link
|
| 10 |
* @since v0.5.9
|
| 11 |
* @param value The input that is checked for being truthy.
|
| 12 |
*/
|
| 13 |
function assert(value: unknown, message?: string | Error): asserts value;
|
| 14 |
-
const kOptions: unique symbol;
|
| 15 |
namespace assert {
|
| 16 |
type AssertMethodNames =
|
| 17 |
| "deepEqual"
|
|
@@ -28,159 +26,194 @@ declare module "node:assert" {
|
|
| 28 |
| "notEqual"
|
| 29 |
| "notStrictEqual"
|
| 30 |
| "ok"
|
| 31 |
-
| "partialDeepStrictEqual"
|
| 32 |
| "rejects"
|
| 33 |
| "strictEqual"
|
| 34 |
| "throws";
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
| 36 |
/**
|
| 37 |
-
*
|
| 38 |
-
* @default 'simple'
|
| 39 |
*/
|
| 40 |
-
|
| 41 |
/**
|
| 42 |
-
*
|
| 43 |
-
* corresponding strict methods.
|
| 44 |
-
* @default true
|
| 45 |
*/
|
| 46 |
-
|
| 47 |
/**
|
| 48 |
-
*
|
| 49 |
-
* comparison in deep equality checks.
|
| 50 |
-
* @since v24.9.0
|
| 51 |
-
* @default false
|
| 52 |
*/
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
}
|
| 61 |
/**
|
| 62 |
-
*
|
| 63 |
-
*
|
|
|
|
|
|
|
| 64 |
*/
|
| 65 |
-
|
| 66 |
/**
|
| 67 |
-
*
|
|
|
|
|
|
|
| 68 |
*
|
| 69 |
* ```js
|
| 70 |
-
*
|
| 71 |
-
* const assertInstance = new Assert({ diff: 'full' });
|
| 72 |
-
* assertInstance.deepStrictEqual({ a: 1 }, { a: 2 });
|
| 73 |
-
* // Shows a full diff in the error message.
|
| 74 |
-
* ```
|
| 75 |
*
|
| 76 |
-
*
|
| 77 |
-
*
|
| 78 |
-
*
|
| 79 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
*
|
| 81 |
* ```js
|
| 82 |
-
*
|
| 83 |
*
|
| 84 |
-
*
|
| 85 |
-
* myAssert.strictEqual({ a: 1 }, { b: { c: 1 } });
|
| 86 |
*
|
| 87 |
-
*
|
| 88 |
-
* const
|
| 89 |
-
*
|
| 90 |
-
* ```
|
| 91 |
*
|
| 92 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
*
|
| 94 |
* ```js
|
| 95 |
-
*
|
| 96 |
-
* constructor(a) {
|
| 97 |
-
* this.a = a;
|
| 98 |
-
* }
|
| 99 |
-
* }
|
| 100 |
*
|
| 101 |
-
*
|
| 102 |
-
*
|
| 103 |
-
* this.a = a;
|
| 104 |
-
* }
|
| 105 |
-
* }
|
| 106 |
*
|
| 107 |
-
*
|
| 108 |
-
* const bar = new Bar(1);
|
| 109 |
*
|
| 110 |
-
* //
|
| 111 |
-
*
|
| 112 |
-
*
|
| 113 |
*
|
| 114 |
-
* //
|
| 115 |
-
*
|
| 116 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
* ```
|
| 118 |
-
*
|
| 119 |
-
*
|
| 120 |
-
* (diff: 'simple', non-strict mode).
|
| 121 |
-
* To maintain custom options when using destructured methods, avoid
|
| 122 |
-
* destructuring and call methods directly on the instance.
|
| 123 |
-
* @since v24.6.0
|
| 124 |
-
*/
|
| 125 |
-
new(
|
| 126 |
-
options?: AssertOptions & { strict?: true | undefined },
|
| 127 |
-
): AssertStrict;
|
| 128 |
-
new(
|
| 129 |
-
options: AssertOptions,
|
| 130 |
-
): Assert;
|
| 131 |
-
};
|
| 132 |
-
interface AssertionErrorOptions {
|
| 133 |
-
/**
|
| 134 |
-
* If provided, the error message is set to this value.
|
| 135 |
-
*/
|
| 136 |
-
message?: string | undefined;
|
| 137 |
-
/**
|
| 138 |
-
* The `actual` property on the error instance.
|
| 139 |
-
*/
|
| 140 |
-
actual?: unknown;
|
| 141 |
-
/**
|
| 142 |
-
* The `expected` property on the error instance.
|
| 143 |
*/
|
| 144 |
-
|
| 145 |
/**
|
| 146 |
-
*
|
| 147 |
-
*
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
*/
|
| 152 |
-
|
| 153 |
/**
|
| 154 |
-
*
|
| 155 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
*/
|
| 157 |
-
|
| 158 |
}
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
*/
|
| 171 |
-
expected: unknown;
|
| 172 |
-
/**
|
| 173 |
-
* Indicates if the message was auto-generated (`true`) or not.
|
| 174 |
-
*/
|
| 175 |
-
generatedMessage: boolean;
|
| 176 |
-
/**
|
| 177 |
-
* Value is always `ERR_ASSERTION` to show that the error is an assertion error.
|
| 178 |
-
*/
|
| 179 |
-
code: "ERR_ASSERTION";
|
| 180 |
-
/**
|
| 181 |
-
* Set to the passed in operator value.
|
| 182 |
-
*/
|
| 183 |
operator: string;
|
|
|
|
|
|
|
| 184 |
}
|
| 185 |
type AssertPredicate = RegExp | (new() => object) | ((thrown: unknown) => boolean) | object | Error;
|
| 186 |
/**
|
|
@@ -200,10 +233,22 @@ declare module "node:assert" {
|
|
| 200 |
* assert.fail(new TypeError('need array'));
|
| 201 |
* // TypeError: need array
|
| 202 |
* ```
|
|
|
|
|
|
|
|
|
|
| 203 |
* @since v0.1.21
|
| 204 |
* @param [message='Failed']
|
| 205 |
*/
|
| 206 |
function fail(message?: string | Error): never;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 207 |
/**
|
| 208 |
* Tests if `value` is truthy. It is equivalent to `assert.equal(!!value, true, message)`.
|
| 209 |
*
|
|
@@ -771,7 +816,7 @@ declare module "node:assert" {
|
|
| 771 |
* check that the promise is rejected.
|
| 772 |
*
|
| 773 |
* If `asyncFn` is a function and it throws an error synchronously, `assert.rejects()` will return a rejected `Promise` with that error. If the
|
| 774 |
-
* function does not return a promise, `assert.rejects()` will return a rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-
|
| 775 |
* error. In both cases the error handler is skipped.
|
| 776 |
*
|
| 777 |
* Besides the async nature to await the completion behaves identically to {@link throws}.
|
|
@@ -841,7 +886,7 @@ declare module "node:assert" {
|
|
| 841 |
*
|
| 842 |
* If `asyncFn` is a function and it throws an error synchronously, `assert.doesNotReject()` will return a rejected `Promise` with that error. If
|
| 843 |
* the function does not return a promise, `assert.doesNotReject()` will return a
|
| 844 |
-
* rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-
|
| 845 |
* the error handler is skipped.
|
| 846 |
*
|
| 847 |
* Using `assert.doesNotReject()` is actually not useful because there is little
|
|
@@ -904,7 +949,7 @@ declare module "node:assert" {
|
|
| 904 |
* If the values do not match, or if the `string` argument is of another type than `string`, an `{@link AssertionError}` is thrown with a `message` property set equal
|
| 905 |
* to the value of the `message` parameter. If the `message` parameter is
|
| 906 |
* undefined, a default error message is assigned. If the `message` parameter is an
|
| 907 |
-
* instance of an [Error](https://nodejs.org/docs/latest-
|
| 908 |
* @since v13.6.0, v12.16.0
|
| 909 |
*/
|
| 910 |
function match(value: string, regExp: RegExp, message?: string | Error): void;
|
|
@@ -927,29 +972,91 @@ declare module "node:assert" {
|
|
| 927 |
* If the values do match, or if the `string` argument is of another type than `string`, an `{@link AssertionError}` is thrown with a `message` property set equal
|
| 928 |
* to the value of the `message` parameter. If the `message` parameter is
|
| 929 |
* undefined, a default error message is assigned. If the `message` parameter is an
|
| 930 |
-
* instance of an [Error](https://nodejs.org/docs/latest-
|
| 931 |
* @since v13.6.0, v12.16.0
|
| 932 |
*/
|
| 933 |
function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
|
| 934 |
/**
|
| 935 |
-
*
|
| 936 |
-
*
|
| 937 |
-
*
|
| 938 |
-
*
|
| 939 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 940 |
*
|
| 941 |
-
*
|
| 942 |
-
*
|
| 943 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 944 |
*/
|
| 945 |
-
|
| 946 |
-
|
| 947 |
-
|
| 948 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 949 |
}
|
| 950 |
export = assert;
|
| 951 |
}
|
| 952 |
-
declare module "assert" {
|
| 953 |
-
import assert = require("
|
| 954 |
export = assert;
|
| 955 |
}
|
|
|
|
| 1 |
/**
|
| 2 |
* The `node:assert` module provides a set of assertion functions for verifying
|
| 3 |
* invariants.
|
| 4 |
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/assert.js)
|
| 5 |
*/
|
| 6 |
+
declare module "assert" {
|
|
|
|
| 7 |
/**
|
| 8 |
+
* An alias of {@link ok}.
|
| 9 |
* @since v0.5.9
|
| 10 |
* @param value The input that is checked for being truthy.
|
| 11 |
*/
|
| 12 |
function assert(value: unknown, message?: string | Error): asserts value;
|
|
|
|
| 13 |
namespace assert {
|
| 14 |
type AssertMethodNames =
|
| 15 |
| "deepEqual"
|
|
|
|
| 26 |
| "notEqual"
|
| 27 |
| "notStrictEqual"
|
| 28 |
| "ok"
|
|
|
|
| 29 |
| "rejects"
|
| 30 |
| "strictEqual"
|
| 31 |
| "throws";
|
| 32 |
+
/**
|
| 33 |
+
* Indicates the failure of an assertion. All errors thrown by the `node:assert` module will be instances of the `AssertionError` class.
|
| 34 |
+
*/
|
| 35 |
+
class AssertionError extends Error {
|
| 36 |
/**
|
| 37 |
+
* Set to the `actual` argument for methods such as {@link assert.strictEqual()}.
|
|
|
|
| 38 |
*/
|
| 39 |
+
actual: unknown;
|
| 40 |
/**
|
| 41 |
+
* Set to the `expected` argument for methods such as {@link assert.strictEqual()}.
|
|
|
|
|
|
|
| 42 |
*/
|
| 43 |
+
expected: unknown;
|
| 44 |
/**
|
| 45 |
+
* Set to the passed in operator value.
|
|
|
|
|
|
|
|
|
|
| 46 |
*/
|
| 47 |
+
operator: string;
|
| 48 |
+
/**
|
| 49 |
+
* Indicates if the message was auto-generated (`true`) or not.
|
| 50 |
+
*/
|
| 51 |
+
generatedMessage: boolean;
|
| 52 |
+
/**
|
| 53 |
+
* Value is always `ERR_ASSERTION` to show that the error is an assertion error.
|
| 54 |
+
*/
|
| 55 |
+
code: "ERR_ASSERTION";
|
| 56 |
+
constructor(options?: {
|
| 57 |
+
/** If provided, the error message is set to this value. */
|
| 58 |
+
message?: string | undefined;
|
| 59 |
+
/** The `actual` property on the error instance. */
|
| 60 |
+
actual?: unknown | undefined;
|
| 61 |
+
/** The `expected` property on the error instance. */
|
| 62 |
+
expected?: unknown | undefined;
|
| 63 |
+
/** The `operator` property on the error instance. */
|
| 64 |
+
operator?: string | undefined;
|
| 65 |
+
/** If provided, the generated stack trace omits frames before this function. */
|
| 66 |
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
| 67 |
+
stackStartFn?: Function | undefined;
|
| 68 |
+
});
|
| 69 |
}
|
| 70 |
/**
|
| 71 |
+
* This feature is deprecated and will be removed in a future version.
|
| 72 |
+
* Please consider using alternatives such as the `mock` helper function.
|
| 73 |
+
* @since v14.2.0, v12.19.0
|
| 74 |
+
* @deprecated Deprecated
|
| 75 |
*/
|
| 76 |
+
class CallTracker {
|
| 77 |
/**
|
| 78 |
+
* The wrapper function is expected to be called exactly `exact` times. If the
|
| 79 |
+
* function has not been called exactly `exact` times when `tracker.verify()` is called, then `tracker.verify()` will throw an
|
| 80 |
+
* error.
|
| 81 |
*
|
| 82 |
* ```js
|
| 83 |
+
* import assert from 'node:assert';
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
*
|
| 85 |
+
* // Creates call tracker.
|
| 86 |
+
* const tracker = new assert.CallTracker();
|
| 87 |
+
*
|
| 88 |
+
* function func() {}
|
| 89 |
+
*
|
| 90 |
+
* // Returns a function that wraps func() that must be called exact times
|
| 91 |
+
* // before tracker.verify().
|
| 92 |
+
* const callsfunc = tracker.calls(func);
|
| 93 |
+
* ```
|
| 94 |
+
* @since v14.2.0, v12.19.0
|
| 95 |
+
* @param [fn='A no-op function']
|
| 96 |
+
* @param [exact=1]
|
| 97 |
+
* @return A function that wraps `fn`.
|
| 98 |
+
*/
|
| 99 |
+
calls(exact?: number): () => void;
|
| 100 |
+
calls(fn: undefined, exact?: number): () => void;
|
| 101 |
+
calls<Func extends (...args: any[]) => any>(fn: Func, exact?: number): Func;
|
| 102 |
+
calls<Func extends (...args: any[]) => any>(fn?: Func, exact?: number): Func | (() => void);
|
| 103 |
+
/**
|
| 104 |
+
* Example:
|
| 105 |
*
|
| 106 |
* ```js
|
| 107 |
+
* import assert from 'node:assert';
|
| 108 |
*
|
| 109 |
+
* const tracker = new assert.CallTracker();
|
|
|
|
| 110 |
*
|
| 111 |
+
* function func() {}
|
| 112 |
+
* const callsfunc = tracker.calls(func);
|
| 113 |
+
* callsfunc(1, 2, 3);
|
|
|
|
| 114 |
*
|
| 115 |
+
* assert.deepStrictEqual(tracker.getCalls(callsfunc),
|
| 116 |
+
* [{ thisArg: undefined, arguments: [1, 2, 3] }]);
|
| 117 |
+
* ```
|
| 118 |
+
* @since v18.8.0, v16.18.0
|
| 119 |
+
* @return An array with all the calls to a tracked function.
|
| 120 |
+
*/
|
| 121 |
+
getCalls(fn: Function): CallTrackerCall[];
|
| 122 |
+
/**
|
| 123 |
+
* The arrays contains information about the expected and actual number of calls of
|
| 124 |
+
* the functions that have not been called the expected number of times.
|
| 125 |
*
|
| 126 |
* ```js
|
| 127 |
+
* import assert from 'node:assert';
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
*
|
| 129 |
+
* // Creates call tracker.
|
| 130 |
+
* const tracker = new assert.CallTracker();
|
|
|
|
|
|
|
|
|
|
| 131 |
*
|
| 132 |
+
* function func() {}
|
|
|
|
| 133 |
*
|
| 134 |
+
* // Returns a function that wraps func() that must be called exact times
|
| 135 |
+
* // before tracker.verify().
|
| 136 |
+
* const callsfunc = tracker.calls(func, 2);
|
| 137 |
*
|
| 138 |
+
* // Returns an array containing information on callsfunc()
|
| 139 |
+
* console.log(tracker.report());
|
| 140 |
+
* // [
|
| 141 |
+
* // {
|
| 142 |
+
* // message: 'Expected the func function to be executed 2 time(s) but was
|
| 143 |
+
* // executed 0 time(s).',
|
| 144 |
+
* // actual: 0,
|
| 145 |
+
* // expected: 2,
|
| 146 |
+
* // operator: 'func',
|
| 147 |
+
* // stack: stack trace
|
| 148 |
+
* // }
|
| 149 |
+
* // ]
|
| 150 |
* ```
|
| 151 |
+
* @since v14.2.0, v12.19.0
|
| 152 |
+
* @return An array of objects containing information about the wrapper functions returned by {@link tracker.calls()}.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
*/
|
| 154 |
+
report(): CallTrackerReportInformation[];
|
| 155 |
/**
|
| 156 |
+
* Reset calls of the call tracker. If a tracked function is passed as an argument, the calls will be reset for it.
|
| 157 |
+
* If no arguments are passed, all tracked functions will be reset.
|
| 158 |
+
*
|
| 159 |
+
* ```js
|
| 160 |
+
* import assert from 'node:assert';
|
| 161 |
+
*
|
| 162 |
+
* const tracker = new assert.CallTracker();
|
| 163 |
+
*
|
| 164 |
+
* function func() {}
|
| 165 |
+
* const callsfunc = tracker.calls(func);
|
| 166 |
+
*
|
| 167 |
+
* callsfunc();
|
| 168 |
+
* // Tracker was called once
|
| 169 |
+
* assert.strictEqual(tracker.getCalls(callsfunc).length, 1);
|
| 170 |
+
*
|
| 171 |
+
* tracker.reset(callsfunc);
|
| 172 |
+
* assert.strictEqual(tracker.getCalls(callsfunc).length, 0);
|
| 173 |
+
* ```
|
| 174 |
+
* @since v18.8.0, v16.18.0
|
| 175 |
+
* @param fn a tracked function to reset.
|
| 176 |
*/
|
| 177 |
+
reset(fn?: Function): void;
|
| 178 |
/**
|
| 179 |
+
* Iterates through the list of functions passed to {@link tracker.calls()} and will throw an error for functions that
|
| 180 |
+
* have not been called the expected number of times.
|
| 181 |
+
*
|
| 182 |
+
* ```js
|
| 183 |
+
* import assert from 'node:assert';
|
| 184 |
+
*
|
| 185 |
+
* // Creates call tracker.
|
| 186 |
+
* const tracker = new assert.CallTracker();
|
| 187 |
+
*
|
| 188 |
+
* function func() {}
|
| 189 |
+
*
|
| 190 |
+
* // Returns a function that wraps func() that must be called exact times
|
| 191 |
+
* // before tracker.verify().
|
| 192 |
+
* const callsfunc = tracker.calls(func, 2);
|
| 193 |
+
*
|
| 194 |
+
* callsfunc();
|
| 195 |
+
*
|
| 196 |
+
* // Will throw an error since callsfunc() was only called once.
|
| 197 |
+
* tracker.verify();
|
| 198 |
+
* ```
|
| 199 |
+
* @since v14.2.0, v12.19.0
|
| 200 |
*/
|
| 201 |
+
verify(): void;
|
| 202 |
}
|
| 203 |
+
interface CallTrackerCall {
|
| 204 |
+
thisArg: object;
|
| 205 |
+
arguments: unknown[];
|
| 206 |
+
}
|
| 207 |
+
interface CallTrackerReportInformation {
|
| 208 |
+
message: string;
|
| 209 |
+
/** The actual number of times the function was called. */
|
| 210 |
+
actual: number;
|
| 211 |
+
/** The number of times the function was expected to be called. */
|
| 212 |
+
expected: number;
|
| 213 |
+
/** The name of the function that is wrapped. */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
operator: string;
|
| 215 |
+
/** A stack trace of the function. */
|
| 216 |
+
stack: object;
|
| 217 |
}
|
| 218 |
type AssertPredicate = RegExp | (new() => object) | ((thrown: unknown) => boolean) | object | Error;
|
| 219 |
/**
|
|
|
|
| 233 |
* assert.fail(new TypeError('need array'));
|
| 234 |
* // TypeError: need array
|
| 235 |
* ```
|
| 236 |
+
*
|
| 237 |
+
* Using `assert.fail()` with more than two arguments is possible but deprecated.
|
| 238 |
+
* See below for further details.
|
| 239 |
* @since v0.1.21
|
| 240 |
* @param [message='Failed']
|
| 241 |
*/
|
| 242 |
function fail(message?: string | Error): never;
|
| 243 |
+
/** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */
|
| 244 |
+
function fail(
|
| 245 |
+
actual: unknown,
|
| 246 |
+
expected: unknown,
|
| 247 |
+
message?: string | Error,
|
| 248 |
+
operator?: string,
|
| 249 |
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
| 250 |
+
stackStartFn?: Function,
|
| 251 |
+
): never;
|
| 252 |
/**
|
| 253 |
* Tests if `value` is truthy. It is equivalent to `assert.equal(!!value, true, message)`.
|
| 254 |
*
|
|
|
|
| 816 |
* check that the promise is rejected.
|
| 817 |
*
|
| 818 |
* If `asyncFn` is a function and it throws an error synchronously, `assert.rejects()` will return a rejected `Promise` with that error. If the
|
| 819 |
+
* function does not return a promise, `assert.rejects()` will return a rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v20.x/api/errors.html#err_invalid_return_value)
|
| 820 |
* error. In both cases the error handler is skipped.
|
| 821 |
*
|
| 822 |
* Besides the async nature to await the completion behaves identically to {@link throws}.
|
|
|
|
| 886 |
*
|
| 887 |
* If `asyncFn` is a function and it throws an error synchronously, `assert.doesNotReject()` will return a rejected `Promise` with that error. If
|
| 888 |
* the function does not return a promise, `assert.doesNotReject()` will return a
|
| 889 |
+
* rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v20.x/api/errors.html#err_invalid_return_value) error. In both cases
|
| 890 |
* the error handler is skipped.
|
| 891 |
*
|
| 892 |
* Using `assert.doesNotReject()` is actually not useful because there is little
|
|
|
|
| 949 |
* If the values do not match, or if the `string` argument is of another type than `string`, an `{@link AssertionError}` is thrown with a `message` property set equal
|
| 950 |
* to the value of the `message` parameter. If the `message` parameter is
|
| 951 |
* undefined, a default error message is assigned. If the `message` parameter is an
|
| 952 |
+
* instance of an [Error](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`.
|
| 953 |
* @since v13.6.0, v12.16.0
|
| 954 |
*/
|
| 955 |
function match(value: string, regExp: RegExp, message?: string | Error): void;
|
|
|
|
| 972 |
* If the values do match, or if the `string` argument is of another type than `string`, an `{@link AssertionError}` is thrown with a `message` property set equal
|
| 973 |
* to the value of the `message` parameter. If the `message` parameter is
|
| 974 |
* undefined, a default error message is assigned. If the `message` parameter is an
|
| 975 |
+
* instance of an [Error](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`.
|
| 976 |
* @since v13.6.0, v12.16.0
|
| 977 |
*/
|
| 978 |
function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
|
| 979 |
/**
|
| 980 |
+
* In strict assertion mode, non-strict methods behave like their corresponding strict methods. For example,
|
| 981 |
+
* {@link deepEqual} will behave like {@link deepStrictEqual}.
|
| 982 |
+
*
|
| 983 |
+
* In strict assertion mode, error messages for objects display a diff. In legacy assertion mode, error
|
| 984 |
+
* messages for objects display the objects, often truncated.
|
| 985 |
+
*
|
| 986 |
+
* To use strict assertion mode:
|
| 987 |
+
*
|
| 988 |
+
* ```js
|
| 989 |
+
* import { strict as assert } from 'node:assert';COPY
|
| 990 |
+
* import assert from 'node:assert/strict';
|
| 991 |
+
* ```
|
| 992 |
*
|
| 993 |
+
* Example error diff:
|
| 994 |
+
*
|
| 995 |
+
* ```js
|
| 996 |
+
* import { strict as assert } from 'node:assert';
|
| 997 |
+
*
|
| 998 |
+
* assert.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]);
|
| 999 |
+
* // AssertionError: Expected inputs to be strictly deep-equal:
|
| 1000 |
+
* // + actual - expected ... Lines skipped
|
| 1001 |
+
* //
|
| 1002 |
+
* // [
|
| 1003 |
+
* // [
|
| 1004 |
+
* // ...
|
| 1005 |
+
* // 2,
|
| 1006 |
+
* // + 3
|
| 1007 |
+
* // - '3'
|
| 1008 |
+
* // ],
|
| 1009 |
+
* // ...
|
| 1010 |
+
* // 5
|
| 1011 |
+
* // ]
|
| 1012 |
+
* ```
|
| 1013 |
+
*
|
| 1014 |
+
* To deactivate the colors, use the `NO_COLOR` or `NODE_DISABLE_COLORS` environment variables. This will also
|
| 1015 |
+
* deactivate the colors in the REPL. For more on color support in terminal environments, read the tty
|
| 1016 |
+
* `getColorDepth()` documentation.
|
| 1017 |
+
*
|
| 1018 |
+
* @since v15.0.0, v13.9.0, v12.16.2, v9.9.0
|
| 1019 |
*/
|
| 1020 |
+
namespace strict {
|
| 1021 |
+
type AssertionError = assert.AssertionError;
|
| 1022 |
+
type AssertPredicate = assert.AssertPredicate;
|
| 1023 |
+
type CallTrackerCall = assert.CallTrackerCall;
|
| 1024 |
+
type CallTrackerReportInformation = assert.CallTrackerReportInformation;
|
| 1025 |
+
}
|
| 1026 |
+
const strict:
|
| 1027 |
+
& Omit<
|
| 1028 |
+
typeof assert,
|
| 1029 |
+
| "equal"
|
| 1030 |
+
| "notEqual"
|
| 1031 |
+
| "deepEqual"
|
| 1032 |
+
| "notDeepEqual"
|
| 1033 |
+
| "ok"
|
| 1034 |
+
| "strictEqual"
|
| 1035 |
+
| "deepStrictEqual"
|
| 1036 |
+
| "ifError"
|
| 1037 |
+
| "strict"
|
| 1038 |
+
| "AssertionError"
|
| 1039 |
+
>
|
| 1040 |
+
& {
|
| 1041 |
+
(value: unknown, message?: string | Error): asserts value;
|
| 1042 |
+
equal: typeof strictEqual;
|
| 1043 |
+
notEqual: typeof notStrictEqual;
|
| 1044 |
+
deepEqual: typeof deepStrictEqual;
|
| 1045 |
+
notDeepEqual: typeof notDeepStrictEqual;
|
| 1046 |
+
// Mapped types and assertion functions are incompatible?
|
| 1047 |
+
// TS2775: Assertions require every name in the call target
|
| 1048 |
+
// to be declared with an explicit type annotation.
|
| 1049 |
+
ok: typeof ok;
|
| 1050 |
+
strictEqual: typeof strictEqual;
|
| 1051 |
+
deepStrictEqual: typeof deepStrictEqual;
|
| 1052 |
+
ifError: typeof ifError;
|
| 1053 |
+
strict: typeof strict;
|
| 1054 |
+
AssertionError: typeof AssertionError;
|
| 1055 |
+
};
|
| 1056 |
}
|
| 1057 |
export = assert;
|
| 1058 |
}
|
| 1059 |
+
declare module "node:assert" {
|
| 1060 |
+
import assert = require("assert");
|
| 1061 |
export = assert;
|
| 1062 |
}
|
node_modules/@types/node/assert/strict.d.ts
CHANGED
|
@@ -1,105 +1,8 @@
|
|
| 1 |
-
/
|
| 2 |
-
|
| 3 |
-
* strict methods. For example, `assert.deepEqual()` will behave like
|
| 4 |
-
* `assert.deepStrictEqual()`.
|
| 5 |
-
*
|
| 6 |
-
* In strict assertion mode, error messages for objects display a diff. In legacy
|
| 7 |
-
* assertion mode, error messages for objects display the objects, often truncated.
|
| 8 |
-
*
|
| 9 |
-
* To use strict assertion mode:
|
| 10 |
-
*
|
| 11 |
-
* ```js
|
| 12 |
-
* import { strict as assert } from 'node:assert';
|
| 13 |
-
* ```
|
| 14 |
-
*
|
| 15 |
-
* ```js
|
| 16 |
-
* import assert from 'node:assert/strict';
|
| 17 |
-
* ```
|
| 18 |
-
*
|
| 19 |
-
* Example error diff:
|
| 20 |
-
*
|
| 21 |
-
* ```js
|
| 22 |
-
* import { strict as assert } from 'node:assert';
|
| 23 |
-
*
|
| 24 |
-
* assert.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]);
|
| 25 |
-
* // AssertionError: Expected inputs to be strictly deep-equal:
|
| 26 |
-
* // + actual - expected ... Lines skipped
|
| 27 |
-
* //
|
| 28 |
-
* // [
|
| 29 |
-
* // [
|
| 30 |
-
* // ...
|
| 31 |
-
* // 2,
|
| 32 |
-
* // + 3
|
| 33 |
-
* // - '3'
|
| 34 |
-
* // ],
|
| 35 |
-
* // ...
|
| 36 |
-
* // 5
|
| 37 |
-
* // ]
|
| 38 |
-
* ```
|
| 39 |
-
*
|
| 40 |
-
* To deactivate the colors, use the `NO_COLOR` or `NODE_DISABLE_COLORS`
|
| 41 |
-
* environment variables. This will also deactivate the colors in the REPL. For
|
| 42 |
-
* more on color support in terminal environments, read the tty
|
| 43 |
-
* [`getColorDepth()`](https://nodejs.org/docs/latest-v25.x/api/tty.html#writestreamgetcolordepthenv) documentation.
|
| 44 |
-
* @since v15.0.0
|
| 45 |
-
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/assert/strict.js)
|
| 46 |
-
*/
|
| 47 |
-
declare module "node:assert/strict" {
|
| 48 |
-
import {
|
| 49 |
-
Assert,
|
| 50 |
-
AssertionError,
|
| 51 |
-
AssertionErrorOptions,
|
| 52 |
-
AssertOptions,
|
| 53 |
-
AssertPredicate,
|
| 54 |
-
AssertStrict,
|
| 55 |
-
deepStrictEqual,
|
| 56 |
-
doesNotMatch,
|
| 57 |
-
doesNotReject,
|
| 58 |
-
doesNotThrow,
|
| 59 |
-
fail,
|
| 60 |
-
ifError,
|
| 61 |
-
match,
|
| 62 |
-
notDeepStrictEqual,
|
| 63 |
-
notStrictEqual,
|
| 64 |
-
ok,
|
| 65 |
-
partialDeepStrictEqual,
|
| 66 |
-
rejects,
|
| 67 |
-
strictEqual,
|
| 68 |
-
throws,
|
| 69 |
-
} from "node:assert";
|
| 70 |
-
function strict(value: unknown, message?: string | Error): asserts value;
|
| 71 |
-
namespace strict {
|
| 72 |
-
export {
|
| 73 |
-
Assert,
|
| 74 |
-
AssertionError,
|
| 75 |
-
AssertionErrorOptions,
|
| 76 |
-
AssertOptions,
|
| 77 |
-
AssertPredicate,
|
| 78 |
-
AssertStrict,
|
| 79 |
-
deepStrictEqual,
|
| 80 |
-
deepStrictEqual as deepEqual,
|
| 81 |
-
doesNotMatch,
|
| 82 |
-
doesNotReject,
|
| 83 |
-
doesNotThrow,
|
| 84 |
-
fail,
|
| 85 |
-
ifError,
|
| 86 |
-
match,
|
| 87 |
-
notDeepStrictEqual,
|
| 88 |
-
notDeepStrictEqual as notDeepEqual,
|
| 89 |
-
notStrictEqual,
|
| 90 |
-
notStrictEqual as notEqual,
|
| 91 |
-
ok,
|
| 92 |
-
partialDeepStrictEqual,
|
| 93 |
-
rejects,
|
| 94 |
-
strict,
|
| 95 |
-
strictEqual,
|
| 96 |
-
strictEqual as equal,
|
| 97 |
-
throws,
|
| 98 |
-
};
|
| 99 |
-
}
|
| 100 |
export = strict;
|
| 101 |
}
|
| 102 |
-
declare module "assert/strict" {
|
| 103 |
-
import strict
|
| 104 |
export = strict;
|
| 105 |
}
|
|
|
|
| 1 |
+
declare module "assert/strict" {
|
| 2 |
+
import { strict } from "node:assert";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
export = strict;
|
| 4 |
}
|
| 5 |
+
declare module "node:assert/strict" {
|
| 6 |
+
import { strict } from "node:assert";
|
| 7 |
export = strict;
|
| 8 |
}
|
node_modules/@types/node/async_hooks.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
| 2 |
* We strongly discourage the use of the `async_hooks` API.
|
| 3 |
* Other APIs that can cover most of its use cases include:
|
| 4 |
*
|
| 5 |
-
* * [`AsyncLocalStorage`](https://nodejs.org/docs/latest-
|
| 6 |
-
* * [`process.getActiveResourcesInfo()`](https://nodejs.org/docs/latest-
|
| 7 |
*
|
| 8 |
* The `node:async_hooks` module provides an API to track asynchronous resources.
|
| 9 |
* It can be accessed using:
|
|
@@ -12,9 +12,9 @@
|
|
| 12 |
* import async_hooks from 'node:async_hooks';
|
| 13 |
* ```
|
| 14 |
* @experimental
|
| 15 |
-
* @see [source](https://github.com/nodejs/node/blob/
|
| 16 |
*/
|
| 17 |
-
declare module "
|
| 18 |
/**
|
| 19 |
* ```js
|
| 20 |
* import { executionAsyncId } from 'node:async_hooks';
|
|
@@ -44,7 +44,7 @@ declare module "node:async_hooks" {
|
|
| 44 |
* ```
|
| 45 |
*
|
| 46 |
* Promise contexts may not get precise `executionAsyncIds` by default.
|
| 47 |
-
* See the section on [promise execution tracking](https://nodejs.org/docs/latest-
|
| 48 |
* @since v8.1.0
|
| 49 |
* @return The `asyncId` of the current execution context. Useful to track when something calls.
|
| 50 |
*/
|
|
@@ -77,7 +77,7 @@ declare module "node:async_hooks" {
|
|
| 77 |
* executionAsyncId,
|
| 78 |
* executionAsyncResource,
|
| 79 |
* createHook,
|
| 80 |
-
* } from '
|
| 81 |
* const sym = Symbol('state'); // Private symbol to avoid pollution
|
| 82 |
*
|
| 83 |
* createHook({
|
|
@@ -117,7 +117,7 @@ declare module "node:async_hooks" {
|
|
| 117 |
* ```
|
| 118 |
*
|
| 119 |
* Promise contexts may not get valid `triggerAsyncId`s by default. See
|
| 120 |
-
* the section on [promise execution tracking](https://nodejs.org/docs/latest-
|
| 121 |
* @return The ID of the resource responsible for calling the callback that is currently being executed.
|
| 122 |
*/
|
| 123 |
function triggerAsyncId(): number;
|
|
@@ -320,16 +320,6 @@ declare module "node:async_hooks" {
|
|
| 320 |
*/
|
| 321 |
triggerAsyncId(): number;
|
| 322 |
}
|
| 323 |
-
interface AsyncLocalStorageOptions {
|
| 324 |
-
/**
|
| 325 |
-
* The default value to be used when no store is provided.
|
| 326 |
-
*/
|
| 327 |
-
defaultValue?: any;
|
| 328 |
-
/**
|
| 329 |
-
* A name for the `AsyncLocalStorage` value.
|
| 330 |
-
*/
|
| 331 |
-
name?: string | undefined;
|
| 332 |
-
}
|
| 333 |
/**
|
| 334 |
* This class creates stores that stay coherent through asynchronous operations.
|
| 335 |
*
|
|
@@ -368,8 +358,8 @@ declare module "node:async_hooks" {
|
|
| 368 |
* http.get('http://localhost:8080');
|
| 369 |
* // Prints:
|
| 370 |
* // 0: start
|
| 371 |
-
* // 0: finish
|
| 372 |
* // 1: start
|
|
|
|
| 373 |
* // 1: finish
|
| 374 |
* ```
|
| 375 |
*
|
|
@@ -379,14 +369,10 @@ declare module "node:async_hooks" {
|
|
| 379 |
* @since v13.10.0, v12.17.0
|
| 380 |
*/
|
| 381 |
class AsyncLocalStorage<T> {
|
| 382 |
-
/**
|
| 383 |
-
* Creates a new instance of `AsyncLocalStorage`. Store is only provided within a
|
| 384 |
-
* `run()` call or after an `enterWith()` call.
|
| 385 |
-
*/
|
| 386 |
-
constructor(options?: AsyncLocalStorageOptions);
|
| 387 |
/**
|
| 388 |
* Binds the given function to the current execution context.
|
| 389 |
* @since v19.8.0
|
|
|
|
| 390 |
* @param fn The function to bind to the current execution context.
|
| 391 |
* @return A new function that calls `fn` within the captured execution context.
|
| 392 |
*/
|
|
@@ -417,6 +403,7 @@ declare module "node:async_hooks" {
|
|
| 417 |
* console.log(asyncLocalStorage.run(321, () => foo.get())); // returns 123
|
| 418 |
* ```
|
| 419 |
* @since v19.8.0
|
|
|
|
| 420 |
* @return A new function with the signature `(fn: (...args) : R, ...args) : R`.
|
| 421 |
*/
|
| 422 |
static snapshot(): <R, TArgs extends any[]>(fn: (...args: TArgs) => R, ...args: TArgs) => R;
|
|
@@ -445,11 +432,6 @@ declare module "node:async_hooks" {
|
|
| 445 |
* @since v13.10.0, v12.17.0
|
| 446 |
*/
|
| 447 |
getStore(): T | undefined;
|
| 448 |
-
/**
|
| 449 |
-
* The name of the `AsyncLocalStorage` instance if provided.
|
| 450 |
-
* @since v24.0.0
|
| 451 |
-
*/
|
| 452 |
-
readonly name: string;
|
| 453 |
/**
|
| 454 |
* Runs a function synchronously within a context and returns its
|
| 455 |
* return value. The store is not accessible outside of the callback function.
|
|
@@ -618,6 +600,6 @@ declare module "node:async_hooks" {
|
|
| 618 |
const VERIFYREQUEST: number;
|
| 619 |
}
|
| 620 |
}
|
| 621 |
-
declare module "async_hooks" {
|
| 622 |
-
export * from "
|
| 623 |
}
|
|
|
|
| 2 |
* We strongly discourage the use of the `async_hooks` API.
|
| 3 |
* Other APIs that can cover most of its use cases include:
|
| 4 |
*
|
| 5 |
+
* * [`AsyncLocalStorage`](https://nodejs.org/docs/latest-v20.x/api/async_context.html#class-asynclocalstorage) tracks async context
|
| 6 |
+
* * [`process.getActiveResourcesInfo()`](https://nodejs.org/docs/latest-v20.x/api/process.html#processgetactiveresourcesinfo) tracks active resources
|
| 7 |
*
|
| 8 |
* The `node:async_hooks` module provides an API to track asynchronous resources.
|
| 9 |
* It can be accessed using:
|
|
|
|
| 12 |
* import async_hooks from 'node:async_hooks';
|
| 13 |
* ```
|
| 14 |
* @experimental
|
| 15 |
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/async_hooks.js)
|
| 16 |
*/
|
| 17 |
+
declare module "async_hooks" {
|
| 18 |
/**
|
| 19 |
* ```js
|
| 20 |
* import { executionAsyncId } from 'node:async_hooks';
|
|
|
|
| 44 |
* ```
|
| 45 |
*
|
| 46 |
* Promise contexts may not get precise `executionAsyncIds` by default.
|
| 47 |
+
* See the section on [promise execution tracking](https://nodejs.org/docs/latest-v20.x/api/async_hooks.html#promise-execution-tracking).
|
| 48 |
* @since v8.1.0
|
| 49 |
* @return The `asyncId` of the current execution context. Useful to track when something calls.
|
| 50 |
*/
|
|
|
|
| 77 |
* executionAsyncId,
|
| 78 |
* executionAsyncResource,
|
| 79 |
* createHook,
|
| 80 |
+
* } from 'async_hooks';
|
| 81 |
* const sym = Symbol('state'); // Private symbol to avoid pollution
|
| 82 |
*
|
| 83 |
* createHook({
|
|
|
|
| 117 |
* ```
|
| 118 |
*
|
| 119 |
* Promise contexts may not get valid `triggerAsyncId`s by default. See
|
| 120 |
+
* the section on [promise execution tracking](https://nodejs.org/docs/latest-v20.x/api/async_hooks.html#promise-execution-tracking).
|
| 121 |
* @return The ID of the resource responsible for calling the callback that is currently being executed.
|
| 122 |
*/
|
| 123 |
function triggerAsyncId(): number;
|
|
|
|
| 320 |
*/
|
| 321 |
triggerAsyncId(): number;
|
| 322 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 323 |
/**
|
| 324 |
* This class creates stores that stay coherent through asynchronous operations.
|
| 325 |
*
|
|
|
|
| 358 |
* http.get('http://localhost:8080');
|
| 359 |
* // Prints:
|
| 360 |
* // 0: start
|
|
|
|
| 361 |
* // 1: start
|
| 362 |
+
* // 0: finish
|
| 363 |
* // 1: finish
|
| 364 |
* ```
|
| 365 |
*
|
|
|
|
| 369 |
* @since v13.10.0, v12.17.0
|
| 370 |
*/
|
| 371 |
class AsyncLocalStorage<T> {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 372 |
/**
|
| 373 |
* Binds the given function to the current execution context.
|
| 374 |
* @since v19.8.0
|
| 375 |
+
* @experimental
|
| 376 |
* @param fn The function to bind to the current execution context.
|
| 377 |
* @return A new function that calls `fn` within the captured execution context.
|
| 378 |
*/
|
|
|
|
| 403 |
* console.log(asyncLocalStorage.run(321, () => foo.get())); // returns 123
|
| 404 |
* ```
|
| 405 |
* @since v19.8.0
|
| 406 |
+
* @experimental
|
| 407 |
* @return A new function with the signature `(fn: (...args) : R, ...args) : R`.
|
| 408 |
*/
|
| 409 |
static snapshot(): <R, TArgs extends any[]>(fn: (...args: TArgs) => R, ...args: TArgs) => R;
|
|
|
|
| 432 |
* @since v13.10.0, v12.17.0
|
| 433 |
*/
|
| 434 |
getStore(): T | undefined;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 435 |
/**
|
| 436 |
* Runs a function synchronously within a context and returns its
|
| 437 |
* return value. The store is not accessible outside of the callback function.
|
|
|
|
| 600 |
const VERIFYREQUEST: number;
|
| 601 |
}
|
| 602 |
}
|
| 603 |
+
declare module "node:async_hooks" {
|
| 604 |
+
export * from "async_hooks";
|
| 605 |
}
|
node_modules/@types/node/buffer.buffer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
declare module "
|
| 2 |
type ImplicitArrayBuffer<T extends WithImplicitCoercion<ArrayBufferLike>> = T extends
|
| 3 |
{ valueOf(): infer V extends ArrayBufferLike } ? V : T;
|
| 4 |
global {
|
|
@@ -176,8 +176,7 @@ declare module "node:buffer" {
|
|
| 176 |
*
|
| 177 |
* If `totalLength` is provided, it is coerced to an unsigned integer. If the
|
| 178 |
* combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is
|
| 179 |
-
* truncated to `totalLength`.
|
| 180 |
-
* less than `totalLength`, the remaining space is filled with zeros.
|
| 181 |
*
|
| 182 |
* ```js
|
| 183 |
* import { Buffer } from 'node:buffer';
|
|
@@ -463,4 +462,10 @@ declare module "node:buffer" {
|
|
| 463 |
*/
|
| 464 |
type AllowSharedBuffer = Buffer<ArrayBufferLike>;
|
| 465 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 466 |
}
|
|
|
|
| 1 |
+
declare module "buffer" {
|
| 2 |
type ImplicitArrayBuffer<T extends WithImplicitCoercion<ArrayBufferLike>> = T extends
|
| 3 |
{ valueOf(): infer V extends ArrayBufferLike } ? V : T;
|
| 4 |
global {
|
|
|
|
| 176 |
*
|
| 177 |
* If `totalLength` is provided, it is coerced to an unsigned integer. If the
|
| 178 |
* combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is
|
| 179 |
+
* truncated to `totalLength`.
|
|
|
|
| 180 |
*
|
| 181 |
* ```js
|
| 182 |
* import { Buffer } from 'node:buffer';
|
|
|
|
| 462 |
*/
|
| 463 |
type AllowSharedBuffer = Buffer<ArrayBufferLike>;
|
| 464 |
}
|
| 465 |
+
/** @deprecated Use `Buffer.allocUnsafeSlow()` instead. */
|
| 466 |
+
var SlowBuffer: {
|
| 467 |
+
/** @deprecated Use `Buffer.allocUnsafeSlow()` instead. */
|
| 468 |
+
new(size: number): Buffer<ArrayBuffer>;
|
| 469 |
+
prototype: Buffer;
|
| 470 |
+
};
|
| 471 |
}
|
node_modules/@types/node/buffer.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
/**
|
| 2 |
* `Buffer` objects are used to represent a fixed-length sequence of bytes. Many
|
| 3 |
* Node.js APIs support `Buffer`s.
|
|
@@ -41,10 +46,11 @@
|
|
| 41 |
* // Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74].
|
| 42 |
* const buf7 = Buffer.from('tést', 'latin1');
|
| 43 |
* ```
|
| 44 |
-
* @see [source](https://github.com/nodejs/node/blob/
|
| 45 |
*/
|
| 46 |
-
declare module "
|
| 47 |
-
import {
|
|
|
|
| 48 |
/**
|
| 49 |
* This function returns `true` if `input` contains only valid UTF-8-encoded data,
|
| 50 |
* including the case in which `input` is empty.
|
|
@@ -116,15 +122,121 @@ declare module "node:buffer" {
|
|
| 116 |
* Resolves a `'blob:nodedata:...'` an associated `Blob` object registered using
|
| 117 |
* a prior call to `URL.createObjectURL()`.
|
| 118 |
* @since v16.7.0
|
|
|
|
| 119 |
* @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
|
| 120 |
*/
|
| 121 |
export function resolveObjectURL(id: string): Blob | undefined;
|
| 122 |
export { type AllowSharedBuffer, Buffer, type NonSharedBuffer };
|
| 123 |
-
/**
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
export type WithImplicitCoercion<T> =
|
| 129 |
| T
|
| 130 |
| { valueOf(): T }
|
|
@@ -1769,42 +1881,56 @@ declare module "node:buffer" {
|
|
| 1769 |
includes(value: string | number | Buffer, encoding: BufferEncoding): boolean;
|
| 1770 |
}
|
| 1771 |
var Buffer: BufferConstructor;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1772 |
}
|
| 1773 |
-
// #region web types
|
| 1774 |
-
export type BlobPart = NodeJS.BufferSource | Blob | string;
|
| 1775 |
-
export interface BlobPropertyBag {
|
| 1776 |
-
endings?: "native" | "transparent";
|
| 1777 |
-
type?: string;
|
| 1778 |
-
}
|
| 1779 |
-
export interface FilePropertyBag extends BlobPropertyBag {
|
| 1780 |
-
lastModified?: number;
|
| 1781 |
-
}
|
| 1782 |
-
export interface Blob {
|
| 1783 |
-
readonly size: number;
|
| 1784 |
-
readonly type: string;
|
| 1785 |
-
arrayBuffer(): Promise<ArrayBuffer>;
|
| 1786 |
-
bytes(): Promise<NodeJS.NonSharedUint8Array>;
|
| 1787 |
-
slice(start?: number, end?: number, contentType?: string): Blob;
|
| 1788 |
-
stream(): ReadableStream<NodeJS.NonSharedUint8Array>;
|
| 1789 |
-
text(): Promise<string>;
|
| 1790 |
-
}
|
| 1791 |
-
export var Blob: {
|
| 1792 |
-
prototype: Blob;
|
| 1793 |
-
new(blobParts?: BlobPart[], options?: BlobPropertyBag): Blob;
|
| 1794 |
-
};
|
| 1795 |
-
export interface File extends Blob {
|
| 1796 |
-
readonly lastModified: number;
|
| 1797 |
-
readonly name: string;
|
| 1798 |
-
readonly webkitRelativePath: string;
|
| 1799 |
-
}
|
| 1800 |
-
export var File: {
|
| 1801 |
-
prototype: File;
|
| 1802 |
-
new(fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): File;
|
| 1803 |
-
};
|
| 1804 |
-
export import atob = globalThis.atob;
|
| 1805 |
-
export import btoa = globalThis.btoa;
|
| 1806 |
-
// #endregion
|
| 1807 |
}
|
| 1808 |
-
declare module "buffer" {
|
| 1809 |
-
export * from "
|
| 1810 |
}
|
|
|
|
| 1 |
+
// If lib.dom.d.ts or lib.webworker.d.ts is loaded, then use the global types.
|
| 2 |
+
// Otherwise, use the types from node.
|
| 3 |
+
type _Blob = typeof globalThis extends { onmessage: any; Blob: any } ? {} : import("buffer").Blob;
|
| 4 |
+
type _File = typeof globalThis extends { onmessage: any; File: any } ? {} : import("buffer").File;
|
| 5 |
+
|
| 6 |
/**
|
| 7 |
* `Buffer` objects are used to represent a fixed-length sequence of bytes. Many
|
| 8 |
* Node.js APIs support `Buffer`s.
|
|
|
|
| 46 |
* // Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74].
|
| 47 |
* const buf7 = Buffer.from('tést', 'latin1');
|
| 48 |
* ```
|
| 49 |
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/buffer.js)
|
| 50 |
*/
|
| 51 |
+
declare module "buffer" {
|
| 52 |
+
import { BinaryLike } from "node:crypto";
|
| 53 |
+
import { ReadableStream as WebReadableStream } from "node:stream/web";
|
| 54 |
/**
|
| 55 |
* This function returns `true` if `input` contains only valid UTF-8-encoded data,
|
| 56 |
* including the case in which `input` is empty.
|
|
|
|
| 122 |
* Resolves a `'blob:nodedata:...'` an associated `Blob` object registered using
|
| 123 |
* a prior call to `URL.createObjectURL()`.
|
| 124 |
* @since v16.7.0
|
| 125 |
+
* @experimental
|
| 126 |
* @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
|
| 127 |
*/
|
| 128 |
export function resolveObjectURL(id: string): Blob | undefined;
|
| 129 |
export { type AllowSharedBuffer, Buffer, type NonSharedBuffer };
|
| 130 |
+
/**
|
| 131 |
+
* @experimental
|
| 132 |
+
*/
|
| 133 |
+
export interface BlobOptions {
|
| 134 |
+
/**
|
| 135 |
+
* One of either `'transparent'` or `'native'`. When set to `'native'`, line endings in string source parts
|
| 136 |
+
* will be converted to the platform native line-ending as specified by `import { EOL } from 'node:node:os'`.
|
| 137 |
+
*/
|
| 138 |
+
endings?: "transparent" | "native";
|
| 139 |
+
/**
|
| 140 |
+
* The Blob content-type. The intent is for `type` to convey
|
| 141 |
+
* the MIME media type of the data, however no validation of the type format
|
| 142 |
+
* is performed.
|
| 143 |
+
*/
|
| 144 |
+
type?: string | undefined;
|
| 145 |
+
}
|
| 146 |
+
/**
|
| 147 |
+
* A [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) encapsulates immutable, raw data that can be safely shared across
|
| 148 |
+
* multiple worker threads.
|
| 149 |
+
* @since v15.7.0, v14.18.0
|
| 150 |
+
*/
|
| 151 |
+
export class Blob {
|
| 152 |
+
/**
|
| 153 |
+
* The total size of the `Blob` in bytes.
|
| 154 |
+
* @since v15.7.0, v14.18.0
|
| 155 |
+
*/
|
| 156 |
+
readonly size: number;
|
| 157 |
+
/**
|
| 158 |
+
* The content-type of the `Blob`.
|
| 159 |
+
* @since v15.7.0, v14.18.0
|
| 160 |
+
*/
|
| 161 |
+
readonly type: string;
|
| 162 |
+
/**
|
| 163 |
+
* Creates a new `Blob` object containing a concatenation of the given sources.
|
| 164 |
+
*
|
| 165 |
+
* {ArrayBuffer}, {TypedArray}, {DataView}, and {Buffer} sources are copied into
|
| 166 |
+
* the 'Blob' and can therefore be safely modified after the 'Blob' is created.
|
| 167 |
+
*
|
| 168 |
+
* String sources are also copied into the `Blob`.
|
| 169 |
+
*/
|
| 170 |
+
constructor(sources: Array<ArrayBuffer | BinaryLike | Blob>, options?: BlobOptions);
|
| 171 |
+
/**
|
| 172 |
+
* Returns a promise that fulfills with an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) containing a copy of
|
| 173 |
+
* the `Blob` data.
|
| 174 |
+
* @since v15.7.0, v14.18.0
|
| 175 |
+
*/
|
| 176 |
+
arrayBuffer(): Promise<ArrayBuffer>;
|
| 177 |
+
/**
|
| 178 |
+
* The `blob.bytes()` method returns the byte of the `Blob` object as a `Promise<Uint8Array>`.
|
| 179 |
+
*
|
| 180 |
+
* ```js
|
| 181 |
+
* const blob = new Blob(['hello']);
|
| 182 |
+
* blob.bytes().then((bytes) => {
|
| 183 |
+
* console.log(bytes); // Outputs: Uint8Array(5) [ 104, 101, 108, 108, 111 ]
|
| 184 |
+
* });
|
| 185 |
+
* ```
|
| 186 |
+
* @since v20.16.0
|
| 187 |
+
*/
|
| 188 |
+
bytes(): Promise<Uint8Array>;
|
| 189 |
+
/**
|
| 190 |
+
* Creates and returns a new `Blob` containing a subset of this `Blob` objects
|
| 191 |
+
* data. The original `Blob` is not altered.
|
| 192 |
+
* @since v15.7.0, v14.18.0
|
| 193 |
+
* @param start The starting index.
|
| 194 |
+
* @param end The ending index.
|
| 195 |
+
* @param type The content-type for the new `Blob`
|
| 196 |
+
*/
|
| 197 |
+
slice(start?: number, end?: number, type?: string): Blob;
|
| 198 |
+
/**
|
| 199 |
+
* Returns a promise that fulfills with the contents of the `Blob` decoded as a
|
| 200 |
+
* UTF-8 string.
|
| 201 |
+
* @since v15.7.0, v14.18.0
|
| 202 |
+
*/
|
| 203 |
+
text(): Promise<string>;
|
| 204 |
+
/**
|
| 205 |
+
* Returns a new `ReadableStream` that allows the content of the `Blob` to be read.
|
| 206 |
+
* @since v16.7.0
|
| 207 |
+
*/
|
| 208 |
+
stream(): WebReadableStream;
|
| 209 |
+
}
|
| 210 |
+
export interface FileOptions {
|
| 211 |
+
/**
|
| 212 |
+
* One of either `'transparent'` or `'native'`. When set to `'native'`, line endings in string source parts will be
|
| 213 |
+
* converted to the platform native line-ending as specified by `import { EOL } from 'node:node:os'`.
|
| 214 |
+
*/
|
| 215 |
+
endings?: "native" | "transparent";
|
| 216 |
+
/** The File content-type. */
|
| 217 |
+
type?: string;
|
| 218 |
+
/** The last modified date of the file. `Default`: Date.now(). */
|
| 219 |
+
lastModified?: number;
|
| 220 |
+
}
|
| 221 |
+
/**
|
| 222 |
+
* A [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) provides information about files.
|
| 223 |
+
* @since v19.2.0, v18.13.0
|
| 224 |
+
*/
|
| 225 |
+
export class File extends Blob {
|
| 226 |
+
constructor(sources: Array<BinaryLike | Blob>, fileName: string, options?: FileOptions);
|
| 227 |
+
/**
|
| 228 |
+
* The name of the `File`.
|
| 229 |
+
* @since v19.2.0, v18.13.0
|
| 230 |
+
*/
|
| 231 |
+
readonly name: string;
|
| 232 |
+
/**
|
| 233 |
+
* The last modified date of the `File`.
|
| 234 |
+
* @since v19.2.0, v18.13.0
|
| 235 |
+
*/
|
| 236 |
+
readonly lastModified: number;
|
| 237 |
+
}
|
| 238 |
+
export import atob = globalThis.atob;
|
| 239 |
+
export import btoa = globalThis.btoa;
|
| 240 |
export type WithImplicitCoercion<T> =
|
| 241 |
| T
|
| 242 |
| { valueOf(): T }
|
|
|
|
| 1881 |
includes(value: string | number | Buffer, encoding: BufferEncoding): boolean;
|
| 1882 |
}
|
| 1883 |
var Buffer: BufferConstructor;
|
| 1884 |
+
/**
|
| 1885 |
+
* Decodes a string of Base64-encoded data into bytes, and encodes those bytes
|
| 1886 |
+
* into a string using Latin-1 (ISO-8859-1).
|
| 1887 |
+
*
|
| 1888 |
+
* The `data` may be any JavaScript-value that can be coerced into a string.
|
| 1889 |
+
*
|
| 1890 |
+
* **This function is only provided for compatibility with legacy web platform APIs**
|
| 1891 |
+
* **and should never be used in new code, because they use strings to represent**
|
| 1892 |
+
* **binary data and predate the introduction of typed arrays in JavaScript.**
|
| 1893 |
+
* **For code running using Node.js APIs, converting between base64-encoded strings**
|
| 1894 |
+
* **and binary data should be performed using `Buffer.from(str, 'base64')` and `buf.toString('base64')`.**
|
| 1895 |
+
* @since v15.13.0, v14.17.0
|
| 1896 |
+
* @legacy Use `Buffer.from(data, 'base64')` instead.
|
| 1897 |
+
* @param data The Base64-encoded input string.
|
| 1898 |
+
*/
|
| 1899 |
+
function atob(data: string): string;
|
| 1900 |
+
/**
|
| 1901 |
+
* Decodes a string into bytes using Latin-1 (ISO-8859), and encodes those bytes
|
| 1902 |
+
* into a string using Base64.
|
| 1903 |
+
*
|
| 1904 |
+
* The `data` may be any JavaScript-value that can be coerced into a string.
|
| 1905 |
+
*
|
| 1906 |
+
* **This function is only provided for compatibility with legacy web platform APIs**
|
| 1907 |
+
* **and should never be used in new code, because they use strings to represent**
|
| 1908 |
+
* **binary data and predate the introduction of typed arrays in JavaScript.**
|
| 1909 |
+
* **For code running using Node.js APIs, converting between base64-encoded strings**
|
| 1910 |
+
* **and binary data should be performed using `Buffer.from(str, 'base64')` and `buf.toString('base64')`.**
|
| 1911 |
+
* @since v15.13.0, v14.17.0
|
| 1912 |
+
* @legacy Use `buf.toString('base64')` instead.
|
| 1913 |
+
* @param data An ASCII (Latin1) string.
|
| 1914 |
+
*/
|
| 1915 |
+
function btoa(data: string): string;
|
| 1916 |
+
interface Blob extends _Blob {}
|
| 1917 |
+
/**
|
| 1918 |
+
* `Blob` class is a global reference for `import { Blob } from 'node:node:buffer'`
|
| 1919 |
+
* https://nodejs.org/api/buffer.html#class-blob
|
| 1920 |
+
* @since v18.0.0
|
| 1921 |
+
*/
|
| 1922 |
+
var Blob: typeof globalThis extends { onmessage: any; Blob: infer T } ? T
|
| 1923 |
+
: typeof import("buffer").Blob;
|
| 1924 |
+
interface File extends _File {}
|
| 1925 |
+
/**
|
| 1926 |
+
* `File` class is a global reference for `import { File } from 'node:node:buffer'`
|
| 1927 |
+
* https://nodejs.org/api/buffer.html#class-file
|
| 1928 |
+
* @since v20.0.0
|
| 1929 |
+
*/
|
| 1930 |
+
var File: typeof globalThis extends { onmessage: any; File: infer T } ? T
|
| 1931 |
+
: typeof import("buffer").File;
|
| 1932 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1933 |
}
|
| 1934 |
+
declare module "node:buffer" {
|
| 1935 |
+
export * from "buffer";
|
| 1936 |
}
|
node_modules/@types/node/child_process.d.ts
CHANGED
|
@@ -5,7 +5,6 @@
|
|
| 5 |
*
|
| 6 |
* ```js
|
| 7 |
* import { spawn } from 'node:child_process';
|
| 8 |
-
* import { once } from 'node:events';
|
| 9 |
* const ls = spawn('ls', ['-lh', '/usr']);
|
| 10 |
*
|
| 11 |
* ls.stdout.on('data', (data) => {
|
|
@@ -16,15 +15,16 @@
|
|
| 16 |
* console.error(`stderr: ${data}`);
|
| 17 |
* });
|
| 18 |
*
|
| 19 |
-
*
|
| 20 |
-
*
|
|
|
|
| 21 |
* ```
|
| 22 |
*
|
| 23 |
* By default, pipes for `stdin`, `stdout`, and `stderr` are established between
|
| 24 |
* the parent Node.js process and the spawned subprocess. These pipes have
|
| 25 |
* limited (and platform-specific) capacity. If the subprocess writes to
|
| 26 |
* stdout in excess of that limit without the output being captured, the
|
| 27 |
-
* subprocess blocks
|
| 28 |
* identical to the behavior of pipes in the shell. Use the `{ stdio: 'ignore' }` option if the output will not be consumed.
|
| 29 |
*
|
| 30 |
* The command lookup is performed using the `options.env.PATH` environment
|
|
@@ -63,25 +63,17 @@
|
|
| 63 |
* For certain use cases, such as automating shell scripts, the `synchronous counterparts` may be more convenient. In many cases, however,
|
| 64 |
* the synchronous methods can have significant impact on performance due to
|
| 65 |
* stalling the event loop while spawned processes complete.
|
| 66 |
-
* @see [source](https://github.com/nodejs/node/blob/
|
| 67 |
*/
|
| 68 |
-
declare module "
|
| 69 |
import { NonSharedBuffer } from "node:buffer";
|
|
|
|
| 70 |
import * as dgram from "node:dgram";
|
| 71 |
-
import { Abortable, EventEmitter, InternalEventEmitter } from "node:events";
|
| 72 |
import * as net from "node:net";
|
| 73 |
import { Readable, Stream, Writable } from "node:stream";
|
| 74 |
import { URL } from "node:url";
|
| 75 |
type Serializable = string | object | number | boolean | bigint;
|
| 76 |
type SendHandle = net.Socket | net.Server | dgram.Socket | undefined;
|
| 77 |
-
interface ChildProcessEventMap {
|
| 78 |
-
"close": [code: number | null, signal: NodeJS.Signals | null];
|
| 79 |
-
"disconnect": [];
|
| 80 |
-
"error": [err: Error];
|
| 81 |
-
"exit": [code: number | null, signal: NodeJS.Signals | null];
|
| 82 |
-
"message": [message: Serializable, sendHandle: SendHandle];
|
| 83 |
-
"spawn": [];
|
| 84 |
-
}
|
| 85 |
/**
|
| 86 |
* Instances of the `ChildProcess` represent spawned child processes.
|
| 87 |
*
|
|
@@ -90,7 +82,7 @@ declare module "node:child_process" {
|
|
| 90 |
* instances of `ChildProcess`.
|
| 91 |
* @since v2.2.0
|
| 92 |
*/
|
| 93 |
-
class ChildProcess
|
| 94 |
/**
|
| 95 |
* A `Writable Stream` that represents the child process's `stdin`.
|
| 96 |
*
|
|
@@ -382,12 +374,12 @@ declare module "node:child_process" {
|
|
| 382 |
* a TCP server object to the child process as illustrated in the example below:
|
| 383 |
*
|
| 384 |
* ```js
|
| 385 |
-
* import
|
| 386 |
-
*
|
| 387 |
-
* const subprocess = fork('subprocess.js');
|
| 388 |
*
|
| 389 |
* // Open up the server object and send the handle.
|
| 390 |
-
*
|
|
|
|
| 391 |
* server.on('connection', (socket) => {
|
| 392 |
* socket.end('handled by parent');
|
| 393 |
* });
|
|
@@ -422,14 +414,14 @@ declare module "node:child_process" {
|
|
| 422 |
* handle connections with "normal" or "special" priority:
|
| 423 |
*
|
| 424 |
* ```js
|
| 425 |
-
* import { createServer } from 'node:net';
|
| 426 |
* import { fork } from 'node:child_process';
|
| 427 |
* const normal = fork('subprocess.js', ['normal']);
|
| 428 |
* const special = fork('subprocess.js', ['special']);
|
| 429 |
*
|
| 430 |
* // Open up the server and send sockets to child. Use pauseOnConnect to prevent
|
| 431 |
* // the sockets from being read before they are sent to the child process.
|
| 432 |
-
*
|
|
|
|
| 433 |
* server.on('connection', (socket) => {
|
| 434 |
*
|
| 435 |
* // If this is special priority...
|
|
@@ -466,7 +458,7 @@ declare module "node:child_process" {
|
|
| 466 |
* as the connection may have been closed during the time it takes to send the
|
| 467 |
* connection to the child.
|
| 468 |
* @since v0.5.9
|
| 469 |
-
* @param sendHandle `undefined`, or a [`net.Socket`](https://nodejs.org/docs/latest-
|
| 470 |
* @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties:
|
| 471 |
*/
|
| 472 |
send(message: Serializable, callback?: (error: Error | null) => void): boolean;
|
|
@@ -532,8 +524,64 @@ declare module "node:child_process" {
|
|
| 532 |
* @since v0.7.10
|
| 533 |
*/
|
| 534 |
ref(): void;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 535 |
}
|
| 536 |
-
interface ChildProcess extends InternalEventEmitter<ChildProcessEventMap> {}
|
| 537 |
// return this object when stdio option is undefined or not specified
|
| 538 |
interface ChildProcessWithoutNullStreams extends ChildProcess {
|
| 539 |
stdin: Writable;
|
|
@@ -671,7 +719,6 @@ declare module "node:child_process" {
|
|
| 671 |
*
|
| 672 |
* ```js
|
| 673 |
* import { spawn } from 'node:child_process';
|
| 674 |
-
* import { once } from 'node:events';
|
| 675 |
* const ls = spawn('ls', ['-lh', '/usr']);
|
| 676 |
*
|
| 677 |
* ls.stdout.on('data', (data) => {
|
|
@@ -682,8 +729,9 @@ declare module "node:child_process" {
|
|
| 682 |
* console.error(`stderr: ${data}`);
|
| 683 |
* });
|
| 684 |
*
|
| 685 |
-
*
|
| 686 |
-
*
|
|
|
|
| 687 |
* ```
|
| 688 |
*
|
| 689 |
* Example: A very elaborate way to run `ps ax | grep ssh`
|
|
@@ -1057,8 +1105,7 @@ declare module "node:child_process" {
|
|
| 1057 |
*
|
| 1058 |
* ```js
|
| 1059 |
* import util from 'node:util';
|
| 1060 |
-
*
|
| 1061 |
-
* const execFile = util.promisify(child_process.execFile);
|
| 1062 |
* async function getVersion() {
|
| 1063 |
* const { stdout } = await execFile('node', ['--version']);
|
| 1064 |
* console.log(stdout);
|
|
@@ -1423,6 +1470,6 @@ declare module "node:child_process" {
|
|
| 1423 |
options?: ExecFileSyncOptions,
|
| 1424 |
): string | NonSharedBuffer;
|
| 1425 |
}
|
| 1426 |
-
declare module "child_process" {
|
| 1427 |
-
export * from "
|
| 1428 |
}
|
|
|
|
| 5 |
*
|
| 6 |
* ```js
|
| 7 |
* import { spawn } from 'node:child_process';
|
|
|
|
| 8 |
* const ls = spawn('ls', ['-lh', '/usr']);
|
| 9 |
*
|
| 10 |
* ls.stdout.on('data', (data) => {
|
|
|
|
| 15 |
* console.error(`stderr: ${data}`);
|
| 16 |
* });
|
| 17 |
*
|
| 18 |
+
* ls.on('close', (code) => {
|
| 19 |
+
* console.log(`child process exited with code ${code}`);
|
| 20 |
+
* });
|
| 21 |
* ```
|
| 22 |
*
|
| 23 |
* By default, pipes for `stdin`, `stdout`, and `stderr` are established between
|
| 24 |
* the parent Node.js process and the spawned subprocess. These pipes have
|
| 25 |
* limited (and platform-specific) capacity. If the subprocess writes to
|
| 26 |
* stdout in excess of that limit without the output being captured, the
|
| 27 |
+
* subprocess blocks waiting for the pipe buffer to accept more data. This is
|
| 28 |
* identical to the behavior of pipes in the shell. Use the `{ stdio: 'ignore' }` option if the output will not be consumed.
|
| 29 |
*
|
| 30 |
* The command lookup is performed using the `options.env.PATH` environment
|
|
|
|
| 63 |
* For certain use cases, such as automating shell scripts, the `synchronous counterparts` may be more convenient. In many cases, however,
|
| 64 |
* the synchronous methods can have significant impact on performance due to
|
| 65 |
* stalling the event loop while spawned processes complete.
|
| 66 |
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/child_process.js)
|
| 67 |
*/
|
| 68 |
+
declare module "child_process" {
|
| 69 |
import { NonSharedBuffer } from "node:buffer";
|
| 70 |
+
import { Abortable, EventEmitter } from "node:events";
|
| 71 |
import * as dgram from "node:dgram";
|
|
|
|
| 72 |
import * as net from "node:net";
|
| 73 |
import { Readable, Stream, Writable } from "node:stream";
|
| 74 |
import { URL } from "node:url";
|
| 75 |
type Serializable = string | object | number | boolean | bigint;
|
| 76 |
type SendHandle = net.Socket | net.Server | dgram.Socket | undefined;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
/**
|
| 78 |
* Instances of the `ChildProcess` represent spawned child processes.
|
| 79 |
*
|
|
|
|
| 82 |
* instances of `ChildProcess`.
|
| 83 |
* @since v2.2.0
|
| 84 |
*/
|
| 85 |
+
class ChildProcess extends EventEmitter {
|
| 86 |
/**
|
| 87 |
* A `Writable Stream` that represents the child process's `stdin`.
|
| 88 |
*
|
|
|
|
| 374 |
* a TCP server object to the child process as illustrated in the example below:
|
| 375 |
*
|
| 376 |
* ```js
|
| 377 |
+
* import child_process from 'node:child_process';
|
| 378 |
+
* const subprocess = child_process.fork('subprocess.js');
|
|
|
|
| 379 |
*
|
| 380 |
* // Open up the server object and send the handle.
|
| 381 |
+
* import net from 'node:net';
|
| 382 |
+
* const server = net.createServer();
|
| 383 |
* server.on('connection', (socket) => {
|
| 384 |
* socket.end('handled by parent');
|
| 385 |
* });
|
|
|
|
| 414 |
* handle connections with "normal" or "special" priority:
|
| 415 |
*
|
| 416 |
* ```js
|
|
|
|
| 417 |
* import { fork } from 'node:child_process';
|
| 418 |
* const normal = fork('subprocess.js', ['normal']);
|
| 419 |
* const special = fork('subprocess.js', ['special']);
|
| 420 |
*
|
| 421 |
* // Open up the server and send sockets to child. Use pauseOnConnect to prevent
|
| 422 |
* // the sockets from being read before they are sent to the child process.
|
| 423 |
+
* import net from 'node:net';
|
| 424 |
+
* const server = net.createServer({ pauseOnConnect: true });
|
| 425 |
* server.on('connection', (socket) => {
|
| 426 |
*
|
| 427 |
* // If this is special priority...
|
|
|
|
| 458 |
* as the connection may have been closed during the time it takes to send the
|
| 459 |
* connection to the child.
|
| 460 |
* @since v0.5.9
|
| 461 |
+
* @param sendHandle `undefined`, or a [`net.Socket`](https://nodejs.org/docs/latest-v20.x/api/net.html#class-netsocket), [`net.Server`](https://nodejs.org/docs/latest-v20.x/api/net.html#class-netserver), or [`dgram.Socket`](https://nodejs.org/docs/latest-v20.x/api/dgram.html#class-dgramsocket) object.
|
| 462 |
* @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties:
|
| 463 |
*/
|
| 464 |
send(message: Serializable, callback?: (error: Error | null) => void): boolean;
|
|
|
|
| 524 |
* @since v0.7.10
|
| 525 |
*/
|
| 526 |
ref(): void;
|
| 527 |
+
/**
|
| 528 |
+
* events.EventEmitter
|
| 529 |
+
* 1. close
|
| 530 |
+
* 2. disconnect
|
| 531 |
+
* 3. error
|
| 532 |
+
* 4. exit
|
| 533 |
+
* 5. message
|
| 534 |
+
* 6. spawn
|
| 535 |
+
*/
|
| 536 |
+
addListener(event: string, listener: (...args: any[]) => void): this;
|
| 537 |
+
addListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
| 538 |
+
addListener(event: "disconnect", listener: () => void): this;
|
| 539 |
+
addListener(event: "error", listener: (err: Error) => void): this;
|
| 540 |
+
addListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
| 541 |
+
addListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
| 542 |
+
addListener(event: "spawn", listener: () => void): this;
|
| 543 |
+
emit(event: string | symbol, ...args: any[]): boolean;
|
| 544 |
+
emit(event: "close", code: number | null, signal: NodeJS.Signals | null): boolean;
|
| 545 |
+
emit(event: "disconnect"): boolean;
|
| 546 |
+
emit(event: "error", err: Error): boolean;
|
| 547 |
+
emit(event: "exit", code: number | null, signal: NodeJS.Signals | null): boolean;
|
| 548 |
+
emit(event: "message", message: Serializable, sendHandle: SendHandle): boolean;
|
| 549 |
+
emit(event: "spawn", listener: () => void): boolean;
|
| 550 |
+
on(event: string, listener: (...args: any[]) => void): this;
|
| 551 |
+
on(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
| 552 |
+
on(event: "disconnect", listener: () => void): this;
|
| 553 |
+
on(event: "error", listener: (err: Error) => void): this;
|
| 554 |
+
on(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
| 555 |
+
on(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
| 556 |
+
on(event: "spawn", listener: () => void): this;
|
| 557 |
+
once(event: string, listener: (...args: any[]) => void): this;
|
| 558 |
+
once(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
| 559 |
+
once(event: "disconnect", listener: () => void): this;
|
| 560 |
+
once(event: "error", listener: (err: Error) => void): this;
|
| 561 |
+
once(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
| 562 |
+
once(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
| 563 |
+
once(event: "spawn", listener: () => void): this;
|
| 564 |
+
prependListener(event: string, listener: (...args: any[]) => void): this;
|
| 565 |
+
prependListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
| 566 |
+
prependListener(event: "disconnect", listener: () => void): this;
|
| 567 |
+
prependListener(event: "error", listener: (err: Error) => void): this;
|
| 568 |
+
prependListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
| 569 |
+
prependListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
| 570 |
+
prependListener(event: "spawn", listener: () => void): this;
|
| 571 |
+
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
| 572 |
+
prependOnceListener(
|
| 573 |
+
event: "close",
|
| 574 |
+
listener: (code: number | null, signal: NodeJS.Signals | null) => void,
|
| 575 |
+
): this;
|
| 576 |
+
prependOnceListener(event: "disconnect", listener: () => void): this;
|
| 577 |
+
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
| 578 |
+
prependOnceListener(
|
| 579 |
+
event: "exit",
|
| 580 |
+
listener: (code: number | null, signal: NodeJS.Signals | null) => void,
|
| 581 |
+
): this;
|
| 582 |
+
prependOnceListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
| 583 |
+
prependOnceListener(event: "spawn", listener: () => void): this;
|
| 584 |
}
|
|
|
|
| 585 |
// return this object when stdio option is undefined or not specified
|
| 586 |
interface ChildProcessWithoutNullStreams extends ChildProcess {
|
| 587 |
stdin: Writable;
|
|
|
|
| 719 |
*
|
| 720 |
* ```js
|
| 721 |
* import { spawn } from 'node:child_process';
|
|
|
|
| 722 |
* const ls = spawn('ls', ['-lh', '/usr']);
|
| 723 |
*
|
| 724 |
* ls.stdout.on('data', (data) => {
|
|
|
|
| 729 |
* console.error(`stderr: ${data}`);
|
| 730 |
* });
|
| 731 |
*
|
| 732 |
+
* ls.on('close', (code) => {
|
| 733 |
+
* console.log(`child process exited with code ${code}`);
|
| 734 |
+
* });
|
| 735 |
* ```
|
| 736 |
*
|
| 737 |
* Example: A very elaborate way to run `ps ax | grep ssh`
|
|
|
|
| 1105 |
*
|
| 1106 |
* ```js
|
| 1107 |
* import util from 'node:util';
|
| 1108 |
+
* const execFile = util.promisify(require('node:child_process').execFile);
|
|
|
|
| 1109 |
* async function getVersion() {
|
| 1110 |
* const { stdout } = await execFile('node', ['--version']);
|
| 1111 |
* console.log(stdout);
|
|
|
|
| 1470 |
options?: ExecFileSyncOptions,
|
| 1471 |
): string | NonSharedBuffer;
|
| 1472 |
}
|
| 1473 |
+
declare module "node:child_process" {
|
| 1474 |
+
export * from "child_process";
|
| 1475 |
}
|
node_modules/@types/node/cluster.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
/**
|
| 2 |
* Clusters of Node.js processes can be used to run multiple instances of Node.js
|
| 3 |
* that can distribute workloads among their application threads. When process isolation
|
| 4 |
-
* is not needed, use the [`worker_threads`](https://nodejs.org/docs/latest-
|
| 5 |
* module instead, which allows running multiple application threads within a single Node.js instance.
|
| 6 |
*
|
| 7 |
* The cluster module allows easy creation of child processes that all share
|
|
@@ -50,13 +50,90 @@
|
|
| 50 |
* ```
|
| 51 |
*
|
| 52 |
* On Windows, it is not yet possible to set up a named pipe server in a worker.
|
| 53 |
-
* @see [source](https://github.com/nodejs/node/blob/
|
| 54 |
*/
|
| 55 |
-
declare module "
|
| 56 |
-
import * as
|
| 57 |
-
import
|
| 58 |
-
|
| 59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
/**
|
| 61 |
* Each new worker is given its own unique id, this id is stored in the `id`.
|
| 62 |
*
|
|
@@ -65,21 +142,21 @@ declare module "node:cluster" {
|
|
| 65 |
*/
|
| 66 |
id: number;
|
| 67 |
/**
|
| 68 |
-
* All workers are created using [`child_process.fork()`](https://nodejs.org/docs/latest-
|
| 69 |
* from this function is stored as `.process`. In a worker, the global `process` is stored.
|
| 70 |
*
|
| 71 |
-
* See: [Child Process module](https://nodejs.org/docs/latest-
|
| 72 |
*
|
| 73 |
* Workers will call `process.exit(0)` if the `'disconnect'` event occurs
|
| 74 |
* on `process` and `.exitedAfterDisconnect` is not `true`. This protects against
|
| 75 |
* accidental disconnection.
|
| 76 |
* @since v0.7.0
|
| 77 |
*/
|
| 78 |
-
process:
|
| 79 |
/**
|
| 80 |
* Send a message to a worker or primary, optionally with a handle.
|
| 81 |
*
|
| 82 |
-
* In the primary, this sends a message to a specific worker. It is identical to [`ChildProcess.send()`](https://nodejs.org/docs/latest-
|
| 83 |
*
|
| 84 |
* In a worker, this sends a message to the primary. It is identical to `process.send()`.
|
| 85 |
*
|
|
@@ -99,16 +176,16 @@ declare module "node:cluster" {
|
|
| 99 |
* @since v0.7.0
|
| 100 |
* @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles.
|
| 101 |
*/
|
| 102 |
-
send(message:
|
| 103 |
send(
|
| 104 |
-
message:
|
| 105 |
-
sendHandle:
|
| 106 |
callback?: (error: Error | null) => void,
|
| 107 |
): boolean;
|
| 108 |
send(
|
| 109 |
-
message:
|
| 110 |
-
sendHandle:
|
| 111 |
-
options?:
|
| 112 |
callback?: (error: Error | null) => void,
|
| 113 |
): boolean;
|
| 114 |
/**
|
|
@@ -121,7 +198,7 @@ declare module "node:cluster" {
|
|
| 121 |
* This method is aliased as `worker.destroy()` for backwards compatibility.
|
| 122 |
*
|
| 123 |
* In a worker, `process.kill()` exists, but it is not this function;
|
| 124 |
-
* it is [`kill()`](https://nodejs.org/docs/latest-
|
| 125 |
* @since v0.9.12
|
| 126 |
* @param [signal='SIGTERM'] Name of the kill signal to send to the worker process.
|
| 127 |
*/
|
|
@@ -155,7 +232,6 @@ declare module "node:cluster" {
|
|
| 155 |
*
|
| 156 |
* ```js
|
| 157 |
* import net from 'node:net';
|
| 158 |
-
*
|
| 159 |
* if (cluster.isPrimary) {
|
| 160 |
* const worker = cluster.fork();
|
| 161 |
* let timeout;
|
|
@@ -258,229 +334,244 @@ declare module "node:cluster" {
|
|
| 258 |
* @since v6.0.0
|
| 259 |
*/
|
| 260 |
exitedAfterDisconnect: boolean;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 261 |
}
|
| 262 |
-
interface
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
|
| 435 |
-
|
| 436 |
-
|
| 437 |
-
|
| 438 |
-
|
| 439 |
-
|
| 440 |
-
|
| 441 |
-
|
| 442 |
-
|
| 443 |
-
/**
|
| 444 |
-
* A reference to the current worker object. Not available in the primary process.
|
| 445 |
-
*
|
| 446 |
-
* ```js
|
| 447 |
-
* import cluster from 'node:cluster';
|
| 448 |
-
*
|
| 449 |
-
* if (cluster.isPrimary) {
|
| 450 |
-
* console.log('I am primary');
|
| 451 |
-
* cluster.fork();
|
| 452 |
-
* cluster.fork();
|
| 453 |
-
* } else if (cluster.isWorker) {
|
| 454 |
-
* console.log(`I am worker #${cluster.worker.id}`);
|
| 455 |
-
* }
|
| 456 |
-
* ```
|
| 457 |
-
* @since v0.7.0
|
| 458 |
-
*/
|
| 459 |
-
readonly worker?: Worker;
|
| 460 |
-
/**
|
| 461 |
-
* A hash that stores the active worker objects, keyed by `id` field. This makes it easy to loop through all the workers. It is only available in the primary process.
|
| 462 |
-
*
|
| 463 |
-
* A worker is removed from `cluster.workers` after the worker has disconnected _and_ exited. The order between these two events cannot be determined in advance. However, it
|
| 464 |
-
* is guaranteed that the removal from the `cluster.workers` list happens before the last `'disconnect'` or `'exit'` event is emitted.
|
| 465 |
-
*
|
| 466 |
-
* ```js
|
| 467 |
-
* import cluster from 'node:cluster';
|
| 468 |
-
*
|
| 469 |
-
* for (const worker of Object.values(cluster.workers)) {
|
| 470 |
-
* worker.send('big announcement to all workers');
|
| 471 |
-
* }
|
| 472 |
-
* ```
|
| 473 |
-
* @since v0.7.0
|
| 474 |
-
*/
|
| 475 |
-
readonly workers?: NodeJS.Dict<Worker>;
|
| 476 |
-
readonly SCHED_NONE: number;
|
| 477 |
-
readonly SCHED_RR: number;
|
| 478 |
-
}
|
| 479 |
}
|
| 480 |
-
|
| 481 |
-
export
|
| 482 |
}
|
| 483 |
-
declare module "cluster" {
|
| 484 |
-
|
| 485 |
-
export
|
| 486 |
}
|
|
|
|
| 1 |
/**
|
| 2 |
* Clusters of Node.js processes can be used to run multiple instances of Node.js
|
| 3 |
* that can distribute workloads among their application threads. When process isolation
|
| 4 |
+
* is not needed, use the [`worker_threads`](https://nodejs.org/docs/latest-v20.x/api/worker_threads.html)
|
| 5 |
* module instead, which allows running multiple application threads within a single Node.js instance.
|
| 6 |
*
|
| 7 |
* The cluster module allows easy creation of child processes that all share
|
|
|
|
| 50 |
* ```
|
| 51 |
*
|
| 52 |
* On Windows, it is not yet possible to set up a named pipe server in a worker.
|
| 53 |
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/cluster.js)
|
| 54 |
*/
|
| 55 |
+
declare module "cluster" {
|
| 56 |
+
import * as child from "node:child_process";
|
| 57 |
+
import EventEmitter = require("node:events");
|
| 58 |
+
import * as net from "node:net";
|
| 59 |
+
type SerializationType = "json" | "advanced";
|
| 60 |
+
export interface ClusterSettings {
|
| 61 |
+
/**
|
| 62 |
+
* List of string arguments passed to the Node.js executable.
|
| 63 |
+
* @default process.execArgv
|
| 64 |
+
*/
|
| 65 |
+
execArgv?: string[] | undefined;
|
| 66 |
+
/**
|
| 67 |
+
* File path to worker file.
|
| 68 |
+
* @default process.argv[1]
|
| 69 |
+
*/
|
| 70 |
+
exec?: string | undefined;
|
| 71 |
+
/**
|
| 72 |
+
* String arguments passed to worker.
|
| 73 |
+
* @default process.argv.slice(2)
|
| 74 |
+
*/
|
| 75 |
+
args?: readonly string[] | undefined;
|
| 76 |
+
/**
|
| 77 |
+
* Whether or not to send output to parent's stdio.
|
| 78 |
+
* @default false
|
| 79 |
+
*/
|
| 80 |
+
silent?: boolean | undefined;
|
| 81 |
+
/**
|
| 82 |
+
* Configures the stdio of forked processes. Because the cluster module relies on IPC to function, this configuration must
|
| 83 |
+
* contain an `'ipc'` entry. When this option is provided, it overrides `silent`. See [`child_prcess.spawn()`](https://nodejs.org/docs/latest-v20.x/api/child_process.html#child_processspawncommand-args-options)'s
|
| 84 |
+
* [`stdio`](https://nodejs.org/docs/latest-v20.x/api/child_process.html#optionsstdio).
|
| 85 |
+
*/
|
| 86 |
+
stdio?: any[] | undefined;
|
| 87 |
+
/**
|
| 88 |
+
* Sets the user identity of the process. (See [`setuid(2)`](https://man7.org/linux/man-pages/man2/setuid.2.html).)
|
| 89 |
+
*/
|
| 90 |
+
uid?: number | undefined;
|
| 91 |
+
/**
|
| 92 |
+
* Sets the group identity of the process. (See [`setgid(2)`](https://man7.org/linux/man-pages/man2/setgid.2.html).)
|
| 93 |
+
*/
|
| 94 |
+
gid?: number | undefined;
|
| 95 |
+
/**
|
| 96 |
+
* Sets inspector port of worker. This can be a number, or a function that takes no arguments and returns a number.
|
| 97 |
+
* By default each worker gets its own port, incremented from the primary's `process.debugPort`.
|
| 98 |
+
*/
|
| 99 |
+
inspectPort?: number | (() => number) | undefined;
|
| 100 |
+
/**
|
| 101 |
+
* Specify the kind of serialization used for sending messages between processes. Possible values are `'json'` and `'advanced'`.
|
| 102 |
+
* See [Advanced serialization for `child_process`](https://nodejs.org/docs/latest-v20.x/api/child_process.html#advanced-serialization) for more details.
|
| 103 |
+
* @default false
|
| 104 |
+
*/
|
| 105 |
+
serialization?: SerializationType | undefined;
|
| 106 |
+
/**
|
| 107 |
+
* Current working directory of the worker process.
|
| 108 |
+
* @default undefined (inherits from parent process)
|
| 109 |
+
*/
|
| 110 |
+
cwd?: string | undefined;
|
| 111 |
+
/**
|
| 112 |
+
* Hide the forked processes console window that would normally be created on Windows systems.
|
| 113 |
+
* @default false
|
| 114 |
+
*/
|
| 115 |
+
windowsHide?: boolean | undefined;
|
| 116 |
+
}
|
| 117 |
+
export interface Address {
|
| 118 |
+
address: string;
|
| 119 |
+
port: number;
|
| 120 |
+
/**
|
| 121 |
+
* The `addressType` is one of:
|
| 122 |
+
*
|
| 123 |
+
* * `4` (TCPv4)
|
| 124 |
+
* * `6` (TCPv6)
|
| 125 |
+
* * `-1` (Unix domain socket)
|
| 126 |
+
* * `'udp4'` or `'udp6'` (UDPv4 or UDPv6)
|
| 127 |
+
*/
|
| 128 |
+
addressType: 4 | 6 | -1 | "udp4" | "udp6";
|
| 129 |
+
}
|
| 130 |
+
/**
|
| 131 |
+
* A `Worker` object contains all public information and method about a worker.
|
| 132 |
+
* In the primary it can be obtained using `cluster.workers`. In a worker
|
| 133 |
+
* it can be obtained using `cluster.worker`.
|
| 134 |
+
* @since v0.7.0
|
| 135 |
+
*/
|
| 136 |
+
export class Worker extends EventEmitter {
|
| 137 |
/**
|
| 138 |
* Each new worker is given its own unique id, this id is stored in the `id`.
|
| 139 |
*
|
|
|
|
| 142 |
*/
|
| 143 |
id: number;
|
| 144 |
/**
|
| 145 |
+
* All workers are created using [`child_process.fork()`](https://nodejs.org/docs/latest-v20.x/api/child_process.html#child_processforkmodulepath-args-options), the returned object
|
| 146 |
* from this function is stored as `.process`. In a worker, the global `process` is stored.
|
| 147 |
*
|
| 148 |
+
* See: [Child Process module](https://nodejs.org/docs/latest-v20.x/api/child_process.html#child_processforkmodulepath-args-options).
|
| 149 |
*
|
| 150 |
* Workers will call `process.exit(0)` if the `'disconnect'` event occurs
|
| 151 |
* on `process` and `.exitedAfterDisconnect` is not `true`. This protects against
|
| 152 |
* accidental disconnection.
|
| 153 |
* @since v0.7.0
|
| 154 |
*/
|
| 155 |
+
process: child.ChildProcess;
|
| 156 |
/**
|
| 157 |
* Send a message to a worker or primary, optionally with a handle.
|
| 158 |
*
|
| 159 |
+
* In the primary, this sends a message to a specific worker. It is identical to [`ChildProcess.send()`](https://nodejs.org/docs/latest-v20.x/api/child_process.html#subprocesssendmessage-sendhandle-options-callback).
|
| 160 |
*
|
| 161 |
* In a worker, this sends a message to the primary. It is identical to `process.send()`.
|
| 162 |
*
|
|
|
|
| 176 |
* @since v0.7.0
|
| 177 |
* @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles.
|
| 178 |
*/
|
| 179 |
+
send(message: child.Serializable, callback?: (error: Error | null) => void): boolean;
|
| 180 |
send(
|
| 181 |
+
message: child.Serializable,
|
| 182 |
+
sendHandle: child.SendHandle,
|
| 183 |
callback?: (error: Error | null) => void,
|
| 184 |
): boolean;
|
| 185 |
send(
|
| 186 |
+
message: child.Serializable,
|
| 187 |
+
sendHandle: child.SendHandle,
|
| 188 |
+
options?: child.MessageOptions,
|
| 189 |
callback?: (error: Error | null) => void,
|
| 190 |
): boolean;
|
| 191 |
/**
|
|
|
|
| 198 |
* This method is aliased as `worker.destroy()` for backwards compatibility.
|
| 199 |
*
|
| 200 |
* In a worker, `process.kill()` exists, but it is not this function;
|
| 201 |
+
* it is [`kill()`](https://nodejs.org/docs/latest-v20.x/api/process.html#processkillpid-signal).
|
| 202 |
* @since v0.9.12
|
| 203 |
* @param [signal='SIGTERM'] Name of the kill signal to send to the worker process.
|
| 204 |
*/
|
|
|
|
| 232 |
*
|
| 233 |
* ```js
|
| 234 |
* import net from 'node:net';
|
|
|
|
| 235 |
* if (cluster.isPrimary) {
|
| 236 |
* const worker = cluster.fork();
|
| 237 |
* let timeout;
|
|
|
|
| 334 |
* @since v6.0.0
|
| 335 |
*/
|
| 336 |
exitedAfterDisconnect: boolean;
|
| 337 |
+
/**
|
| 338 |
+
* events.EventEmitter
|
| 339 |
+
* 1. disconnect
|
| 340 |
+
* 2. error
|
| 341 |
+
* 3. exit
|
| 342 |
+
* 4. listening
|
| 343 |
+
* 5. message
|
| 344 |
+
* 6. online
|
| 345 |
+
*/
|
| 346 |
+
addListener(event: string, listener: (...args: any[]) => void): this;
|
| 347 |
+
addListener(event: "disconnect", listener: () => void): this;
|
| 348 |
+
addListener(event: "error", listener: (error: Error) => void): this;
|
| 349 |
+
addListener(event: "exit", listener: (code: number, signal: string) => void): this;
|
| 350 |
+
addListener(event: "listening", listener: (address: Address) => void): this;
|
| 351 |
+
addListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
| 352 |
+
addListener(event: "online", listener: () => void): this;
|
| 353 |
+
emit(event: string | symbol, ...args: any[]): boolean;
|
| 354 |
+
emit(event: "disconnect"): boolean;
|
| 355 |
+
emit(event: "error", error: Error): boolean;
|
| 356 |
+
emit(event: "exit", code: number, signal: string): boolean;
|
| 357 |
+
emit(event: "listening", address: Address): boolean;
|
| 358 |
+
emit(event: "message", message: any, handle: net.Socket | net.Server): boolean;
|
| 359 |
+
emit(event: "online"): boolean;
|
| 360 |
+
on(event: string, listener: (...args: any[]) => void): this;
|
| 361 |
+
on(event: "disconnect", listener: () => void): this;
|
| 362 |
+
on(event: "error", listener: (error: Error) => void): this;
|
| 363 |
+
on(event: "exit", listener: (code: number, signal: string) => void): this;
|
| 364 |
+
on(event: "listening", listener: (address: Address) => void): this;
|
| 365 |
+
on(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
| 366 |
+
on(event: "online", listener: () => void): this;
|
| 367 |
+
once(event: string, listener: (...args: any[]) => void): this;
|
| 368 |
+
once(event: "disconnect", listener: () => void): this;
|
| 369 |
+
once(event: "error", listener: (error: Error) => void): this;
|
| 370 |
+
once(event: "exit", listener: (code: number, signal: string) => void): this;
|
| 371 |
+
once(event: "listening", listener: (address: Address) => void): this;
|
| 372 |
+
once(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
| 373 |
+
once(event: "online", listener: () => void): this;
|
| 374 |
+
prependListener(event: string, listener: (...args: any[]) => void): this;
|
| 375 |
+
prependListener(event: "disconnect", listener: () => void): this;
|
| 376 |
+
prependListener(event: "error", listener: (error: Error) => void): this;
|
| 377 |
+
prependListener(event: "exit", listener: (code: number, signal: string) => void): this;
|
| 378 |
+
prependListener(event: "listening", listener: (address: Address) => void): this;
|
| 379 |
+
prependListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
| 380 |
+
prependListener(event: "online", listener: () => void): this;
|
| 381 |
+
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
| 382 |
+
prependOnceListener(event: "disconnect", listener: () => void): this;
|
| 383 |
+
prependOnceListener(event: "error", listener: (error: Error) => void): this;
|
| 384 |
+
prependOnceListener(event: "exit", listener: (code: number, signal: string) => void): this;
|
| 385 |
+
prependOnceListener(event: "listening", listener: (address: Address) => void): this;
|
| 386 |
+
prependOnceListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
| 387 |
+
prependOnceListener(event: "online", listener: () => void): this;
|
| 388 |
}
|
| 389 |
+
export interface Cluster extends EventEmitter {
|
| 390 |
+
disconnect(callback?: () => void): void;
|
| 391 |
+
/**
|
| 392 |
+
* Spawn a new worker process.
|
| 393 |
+
*
|
| 394 |
+
* This can only be called from the primary process.
|
| 395 |
+
* @param env Key/value pairs to add to worker process environment.
|
| 396 |
+
* @since v0.6.0
|
| 397 |
+
*/
|
| 398 |
+
fork(env?: any): Worker;
|
| 399 |
+
/** @deprecated since v16.0.0 - use isPrimary. */
|
| 400 |
+
readonly isMaster: boolean;
|
| 401 |
+
/**
|
| 402 |
+
* True if the process is a primary. This is determined by the `process.env.NODE_UNIQUE_ID`. If `process.env.NODE_UNIQUE_ID`
|
| 403 |
+
* is undefined, then `isPrimary` is `true`.
|
| 404 |
+
* @since v16.0.0
|
| 405 |
+
*/
|
| 406 |
+
readonly isPrimary: boolean;
|
| 407 |
+
/**
|
| 408 |
+
* True if the process is not a primary (it is the negation of `cluster.isPrimary`).
|
| 409 |
+
* @since v0.6.0
|
| 410 |
+
*/
|
| 411 |
+
readonly isWorker: boolean;
|
| 412 |
+
/**
|
| 413 |
+
* The scheduling policy, either `cluster.SCHED_RR` for round-robin or `cluster.SCHED_NONE` to leave it to the operating system. This is a
|
| 414 |
+
* global setting and effectively frozen once either the first worker is spawned, or [`.setupPrimary()`](https://nodejs.org/docs/latest-v20.x/api/cluster.html#clustersetupprimarysettings)
|
| 415 |
+
* is called, whichever comes first.
|
| 416 |
+
*
|
| 417 |
+
* `SCHED_RR` is the default on all operating systems except Windows. Windows will change to `SCHED_RR` once libuv is able to effectively distribute
|
| 418 |
+
* IOCP handles without incurring a large performance hit.
|
| 419 |
+
*
|
| 420 |
+
* `cluster.schedulingPolicy` can also be set through the `NODE_CLUSTER_SCHED_POLICY` environment variable. Valid values are `'rr'` and `'none'`.
|
| 421 |
+
* @since v0.11.2
|
| 422 |
+
*/
|
| 423 |
+
schedulingPolicy: number;
|
| 424 |
+
/**
|
| 425 |
+
* After calling [`.setupPrimary()`](https://nodejs.org/docs/latest-v20.x/api/cluster.html#clustersetupprimarysettings)
|
| 426 |
+
* (or [`.fork()`](https://nodejs.org/docs/latest-v20.x/api/cluster.html#clusterforkenv)) this settings object will contain
|
| 427 |
+
* the settings, including the default values.
|
| 428 |
+
*
|
| 429 |
+
* This object is not intended to be changed or set manually.
|
| 430 |
+
* @since v0.7.1
|
| 431 |
+
*/
|
| 432 |
+
readonly settings: ClusterSettings;
|
| 433 |
+
/** @deprecated since v16.0.0 - use [`.setupPrimary()`](https://nodejs.org/docs/latest-v20.x/api/cluster.html#clustersetupprimarysettings) instead. */
|
| 434 |
+
setupMaster(settings?: ClusterSettings): void;
|
| 435 |
+
/**
|
| 436 |
+
* `setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in `cluster.settings`.
|
| 437 |
+
*
|
| 438 |
+
* Any settings changes only affect future calls to [`.fork()`](https://nodejs.org/docs/latest-v20.x/api/cluster.html#clusterforkenv)
|
| 439 |
+
* and have no effect on workers that are already running.
|
| 440 |
+
*
|
| 441 |
+
* The only attribute of a worker that cannot be set via `.setupPrimary()` is the `env` passed to
|
| 442 |
+
* [`.fork()`](https://nodejs.org/docs/latest-v20.x/api/cluster.html#clusterforkenv).
|
| 443 |
+
*
|
| 444 |
+
* The defaults above apply to the first call only; the defaults for later calls are the current values at the time of
|
| 445 |
+
* `cluster.setupPrimary()` is called.
|
| 446 |
+
*
|
| 447 |
+
* ```js
|
| 448 |
+
* import cluster from 'node:cluster';
|
| 449 |
+
*
|
| 450 |
+
* cluster.setupPrimary({
|
| 451 |
+
* exec: 'worker.js',
|
| 452 |
+
* args: ['--use', 'https'],
|
| 453 |
+
* silent: true,
|
| 454 |
+
* });
|
| 455 |
+
* cluster.fork(); // https worker
|
| 456 |
+
* cluster.setupPrimary({
|
| 457 |
+
* exec: 'worker.js',
|
| 458 |
+
* args: ['--use', 'http'],
|
| 459 |
+
* });
|
| 460 |
+
* cluster.fork(); // http worker
|
| 461 |
+
* ```
|
| 462 |
+
*
|
| 463 |
+
* This can only be called from the primary process.
|
| 464 |
+
* @since v16.0.0
|
| 465 |
+
*/
|
| 466 |
+
setupPrimary(settings?: ClusterSettings): void;
|
| 467 |
+
/**
|
| 468 |
+
* A reference to the current worker object. Not available in the primary process.
|
| 469 |
+
*
|
| 470 |
+
* ```js
|
| 471 |
+
* import cluster from 'node:cluster';
|
| 472 |
+
*
|
| 473 |
+
* if (cluster.isPrimary) {
|
| 474 |
+
* console.log('I am primary');
|
| 475 |
+
* cluster.fork();
|
| 476 |
+
* cluster.fork();
|
| 477 |
+
* } else if (cluster.isWorker) {
|
| 478 |
+
* console.log(`I am worker #${cluster.worker.id}`);
|
| 479 |
+
* }
|
| 480 |
+
* ```
|
| 481 |
+
* @since v0.7.0
|
| 482 |
+
*/
|
| 483 |
+
readonly worker?: Worker;
|
| 484 |
+
/**
|
| 485 |
+
* A hash that stores the active worker objects, keyed by `id` field. This makes it easy to loop through all the workers. It is only available in the primary process.
|
| 486 |
+
*
|
| 487 |
+
* A worker is removed from `cluster.workers` after the worker has disconnected _and_ exited. The order between these two events cannot be determined in advance. However, it
|
| 488 |
+
* is guaranteed that the removal from the `cluster.workers` list happens before the last `'disconnect'` or `'exit'` event is emitted.
|
| 489 |
+
*
|
| 490 |
+
* ```js
|
| 491 |
+
* import cluster from 'node:cluster';
|
| 492 |
+
*
|
| 493 |
+
* for (const worker of Object.values(cluster.workers)) {
|
| 494 |
+
* worker.send('big announcement to all workers');
|
| 495 |
+
* }
|
| 496 |
+
* ```
|
| 497 |
+
* @since v0.7.0
|
| 498 |
+
*/
|
| 499 |
+
readonly workers?: NodeJS.Dict<Worker>;
|
| 500 |
+
readonly SCHED_NONE: number;
|
| 501 |
+
readonly SCHED_RR: number;
|
| 502 |
+
/**
|
| 503 |
+
* events.EventEmitter
|
| 504 |
+
* 1. disconnect
|
| 505 |
+
* 2. exit
|
| 506 |
+
* 3. fork
|
| 507 |
+
* 4. listening
|
| 508 |
+
* 5. message
|
| 509 |
+
* 6. online
|
| 510 |
+
* 7. setup
|
| 511 |
+
*/
|
| 512 |
+
addListener(event: string, listener: (...args: any[]) => void): this;
|
| 513 |
+
addListener(event: "disconnect", listener: (worker: Worker) => void): this;
|
| 514 |
+
addListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
|
| 515 |
+
addListener(event: "fork", listener: (worker: Worker) => void): this;
|
| 516 |
+
addListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
| 517 |
+
addListener(
|
| 518 |
+
event: "message",
|
| 519 |
+
listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void,
|
| 520 |
+
): this; // the handle is a net.Socket or net.Server object, or undefined.
|
| 521 |
+
addListener(event: "online", listener: (worker: Worker) => void): this;
|
| 522 |
+
addListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
| 523 |
+
emit(event: string | symbol, ...args: any[]): boolean;
|
| 524 |
+
emit(event: "disconnect", worker: Worker): boolean;
|
| 525 |
+
emit(event: "exit", worker: Worker, code: number, signal: string): boolean;
|
| 526 |
+
emit(event: "fork", worker: Worker): boolean;
|
| 527 |
+
emit(event: "listening", worker: Worker, address: Address): boolean;
|
| 528 |
+
emit(event: "message", worker: Worker, message: any, handle: net.Socket | net.Server): boolean;
|
| 529 |
+
emit(event: "online", worker: Worker): boolean;
|
| 530 |
+
emit(event: "setup", settings: ClusterSettings): boolean;
|
| 531 |
+
on(event: string, listener: (...args: any[]) => void): this;
|
| 532 |
+
on(event: "disconnect", listener: (worker: Worker) => void): this;
|
| 533 |
+
on(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
|
| 534 |
+
on(event: "fork", listener: (worker: Worker) => void): this;
|
| 535 |
+
on(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
| 536 |
+
on(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
| 537 |
+
on(event: "online", listener: (worker: Worker) => void): this;
|
| 538 |
+
on(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
| 539 |
+
once(event: string, listener: (...args: any[]) => void): this;
|
| 540 |
+
once(event: "disconnect", listener: (worker: Worker) => void): this;
|
| 541 |
+
once(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
|
| 542 |
+
once(event: "fork", listener: (worker: Worker) => void): this;
|
| 543 |
+
once(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
| 544 |
+
once(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
| 545 |
+
once(event: "online", listener: (worker: Worker) => void): this;
|
| 546 |
+
once(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
| 547 |
+
prependListener(event: string, listener: (...args: any[]) => void): this;
|
| 548 |
+
prependListener(event: "disconnect", listener: (worker: Worker) => void): this;
|
| 549 |
+
prependListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
|
| 550 |
+
prependListener(event: "fork", listener: (worker: Worker) => void): this;
|
| 551 |
+
prependListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
| 552 |
+
prependListener(
|
| 553 |
+
event: "message",
|
| 554 |
+
listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void,
|
| 555 |
+
): this;
|
| 556 |
+
prependListener(event: "online", listener: (worker: Worker) => void): this;
|
| 557 |
+
prependListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
| 558 |
+
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
| 559 |
+
prependOnceListener(event: "disconnect", listener: (worker: Worker) => void): this;
|
| 560 |
+
prependOnceListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
|
| 561 |
+
prependOnceListener(event: "fork", listener: (worker: Worker) => void): this;
|
| 562 |
+
prependOnceListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
| 563 |
+
// the handle is a net.Socket or net.Server object, or undefined.
|
| 564 |
+
prependOnceListener(
|
| 565 |
+
event: "message",
|
| 566 |
+
listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void,
|
| 567 |
+
): this;
|
| 568 |
+
prependOnceListener(event: "online", listener: (worker: Worker) => void): this;
|
| 569 |
+
prependOnceListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 570 |
}
|
| 571 |
+
const cluster: Cluster;
|
| 572 |
+
export default cluster;
|
| 573 |
}
|
| 574 |
+
declare module "node:cluster" {
|
| 575 |
+
export * from "cluster";
|
| 576 |
+
export { default as default } from "cluster";
|
| 577 |
}
|
node_modules/@types/node/compatibility/disposable.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Polyfills for the explicit resource management types added in TypeScript 5.2.
|
| 2 |
+
// TODO: remove once this package no longer supports TS 5.1, and replace with a
|
| 3 |
+
// <reference> to TypeScript's disposable library in index.d.ts.
|
| 4 |
+
|
| 5 |
+
interface SymbolConstructor {
|
| 6 |
+
readonly dispose: unique symbol;
|
| 7 |
+
readonly asyncDispose: unique symbol;
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
interface Disposable {
|
| 11 |
+
[Symbol.dispose](): void;
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
interface AsyncDisposable {
|
| 15 |
+
[Symbol.asyncDispose](): PromiseLike<void>;
|
| 16 |
+
}
|
node_modules/@types/node/compatibility/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Declaration files in this directory contain types relating to TypeScript library features
|
| 2 |
+
// that are not included in all TypeScript versions supported by DefinitelyTyped, but
|
| 3 |
+
// which can be made backwards-compatible without needing `typesVersions`.
|
| 4 |
+
// If adding declarations to this directory, please specify which versions of TypeScript require them,
|
| 5 |
+
// so that they can be removed when no longer needed.
|
| 6 |
+
|
| 7 |
+
/// <reference path="disposable.d.ts" />
|
| 8 |
+
/// <reference path="indexable.d.ts" />
|
| 9 |
+
/// <reference path="iterators.d.ts" />
|
node_modules/@types/node/compatibility/indexable.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Polyfill for ES2022's .at() method on string/array prototypes, added to TypeScript in 4.6.
|
| 2 |
+
|
| 3 |
+
interface RelativeIndexable<T> {
|
| 4 |
+
at(index: number): T | undefined;
|
| 5 |
+
}
|
| 6 |
+
|
| 7 |
+
interface String extends RelativeIndexable<string> {}
|
| 8 |
+
interface Array<T> extends RelativeIndexable<T> {}
|
| 9 |
+
interface ReadonlyArray<T> extends RelativeIndexable<T> {}
|
| 10 |
+
interface Int8Array extends RelativeIndexable<number> {}
|
| 11 |
+
interface Uint8Array extends RelativeIndexable<number> {}
|
| 12 |
+
interface Uint8ClampedArray extends RelativeIndexable<number> {}
|
| 13 |
+
interface Int16Array extends RelativeIndexable<number> {}
|
| 14 |
+
interface Uint16Array extends RelativeIndexable<number> {}
|
| 15 |
+
interface Int32Array extends RelativeIndexable<number> {}
|
| 16 |
+
interface Uint32Array extends RelativeIndexable<number> {}
|
| 17 |
+
interface Float32Array extends RelativeIndexable<number> {}
|
| 18 |
+
interface Float64Array extends RelativeIndexable<number> {}
|
| 19 |
+
interface BigInt64Array extends RelativeIndexable<bigint> {}
|
| 20 |
+
interface BigUint64Array extends RelativeIndexable<bigint> {}
|
node_modules/@types/node/console.d.ts
CHANGED
|
@@ -5,12 +5,12 @@
|
|
| 5 |
* The module exports two specific components:
|
| 6 |
*
|
| 7 |
* * A `Console` class with methods such as `console.log()`, `console.error()`, and `console.warn()` that can be used to write to any Node.js stream.
|
| 8 |
-
* * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-
|
| 9 |
-
* [`process.stderr`](https://nodejs.org/docs/latest-
|
| 10 |
*
|
| 11 |
* _**Warning**_: The global console object's methods are neither consistently
|
| 12 |
* synchronous like the browser APIs they resemble, nor are they consistently
|
| 13 |
-
* asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-
|
| 14 |
* more information.
|
| 15 |
*
|
| 16 |
* Example using the global `console`:
|
|
@@ -54,63 +54,276 @@
|
|
| 54 |
* myConsole.warn(`Danger ${name}! Danger!`);
|
| 55 |
* // Prints: Danger Will Robinson! Danger!, to err
|
| 56 |
* ```
|
| 57 |
-
* @see [source](https://github.com/nodejs/node/blob/
|
| 58 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
declare module "node:console" {
|
| 60 |
import { InspectOptions } from "node:util";
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
/**
|
| 66 |
-
*
|
| 67 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
*/
|
| 69 |
-
|
| 70 |
/**
|
| 71 |
-
*
|
| 72 |
-
*
|
| 73 |
-
*
|
| 74 |
-
*
|
| 75 |
-
*
|
|
|
|
|
|
|
|
|
|
| 76 |
*/
|
| 77 |
-
|
| 78 |
/**
|
| 79 |
-
*
|
| 80 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
*/
|
| 82 |
-
|
| 83 |
/**
|
| 84 |
-
*
|
| 85 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
*/
|
| 87 |
-
groupIndentation?: number | undefined;
|
| 88 |
-
}
|
| 89 |
-
interface Console {
|
| 90 |
-
readonly Console: {
|
| 91 |
-
prototype: Console;
|
| 92 |
-
new(stdout: NodeJS.WritableStream, stderr?: NodeJS.WritableStream, ignoreErrors?: boolean): Console;
|
| 93 |
-
new(options: ConsoleOptions): Console;
|
| 94 |
-
};
|
| 95 |
-
assert(condition?: unknown, ...data: any[]): void;
|
| 96 |
-
clear(): void;
|
| 97 |
-
count(label?: string): void;
|
| 98 |
countReset(label?: string): void;
|
| 99 |
-
|
| 100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
dirxml(...data: any[]): void;
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
groupEnd(): void;
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
time(label?: string): void;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
timeEnd(label?: string): void;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
timeLog(label?: string, ...data: any[]): void;
|
| 112 |
-
|
| 113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
/**
|
| 115 |
* This method does not display anything unless used in the inspector. The `console.profile()`
|
| 116 |
* method starts a JavaScript CPU profile with an optional label until {@link profileEnd}
|
|
@@ -141,11 +354,99 @@ declare module "node:console" {
|
|
| 141 |
*/
|
| 142 |
timeStamp(label?: string): void;
|
| 143 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
}
|
| 145 |
-
|
| 146 |
-
export = console;
|
| 147 |
-
}
|
| 148 |
-
declare module "console" {
|
| 149 |
-
import console = require("node:console");
|
| 150 |
-
export = console;
|
| 151 |
}
|
|
|
|
| 5 |
* The module exports two specific components:
|
| 6 |
*
|
| 7 |
* * A `Console` class with methods such as `console.log()`, `console.error()`, and `console.warn()` that can be used to write to any Node.js stream.
|
| 8 |
+
* * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v20.x/api/process.html#processstdout) and
|
| 9 |
+
* [`process.stderr`](https://nodejs.org/docs/latest-v20.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module.
|
| 10 |
*
|
| 11 |
* _**Warning**_: The global console object's methods are neither consistently
|
| 12 |
* synchronous like the browser APIs they resemble, nor are they consistently
|
| 13 |
+
* asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v20.x/api/process.html#a-note-on-process-io) for
|
| 14 |
* more information.
|
| 15 |
*
|
| 16 |
* Example using the global `console`:
|
|
|
|
| 54 |
* myConsole.warn(`Danger ${name}! Danger!`);
|
| 55 |
* // Prints: Danger Will Robinson! Danger!, to err
|
| 56 |
* ```
|
| 57 |
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/console.js)
|
| 58 |
*/
|
| 59 |
+
declare module "console" {
|
| 60 |
+
import console = require("node:console");
|
| 61 |
+
export = console;
|
| 62 |
+
}
|
| 63 |
declare module "node:console" {
|
| 64 |
import { InspectOptions } from "node:util";
|
| 65 |
+
global {
|
| 66 |
+
// This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build
|
| 67 |
+
interface Console {
|
| 68 |
+
Console: console.ConsoleConstructor;
|
| 69 |
/**
|
| 70 |
+
* `console.assert()` writes a message if `value` is [falsy](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) or omitted. It only
|
| 71 |
+
* writes a message and does not otherwise affect execution. The output always
|
| 72 |
+
* starts with `"Assertion failed"`. If provided, `message` is formatted using
|
| 73 |
+
* [`util.format()`](https://nodejs.org/docs/latest-v20.x/api/util.html#utilformatformat-args).
|
| 74 |
+
*
|
| 75 |
+
* If `value` is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy), nothing happens.
|
| 76 |
+
*
|
| 77 |
+
* ```js
|
| 78 |
+
* console.assert(true, 'does nothing');
|
| 79 |
+
*
|
| 80 |
+
* console.assert(false, 'Whoops %s work', 'didn\'t');
|
| 81 |
+
* // Assertion failed: Whoops didn't work
|
| 82 |
+
*
|
| 83 |
+
* console.assert();
|
| 84 |
+
* // Assertion failed
|
| 85 |
+
* ```
|
| 86 |
+
* @since v0.1.101
|
| 87 |
+
* @param value The value tested for being truthy.
|
| 88 |
+
* @param message All arguments besides `value` are used as error message.
|
| 89 |
*/
|
| 90 |
+
assert(value: any, message?: string, ...optionalParams: any[]): void;
|
| 91 |
/**
|
| 92 |
+
* When `stdout` is a TTY, calling `console.clear()` will attempt to clear the
|
| 93 |
+
* TTY. When `stdout` is not a TTY, this method does nothing.
|
| 94 |
+
*
|
| 95 |
+
* The specific operation of `console.clear()` can vary across operating systems
|
| 96 |
+
* and terminal types. For most Linux operating systems, `console.clear()` operates similarly to the `clear` shell command. On Windows, `console.clear()` will clear only the output in the
|
| 97 |
+
* current terminal viewport for the Node.js
|
| 98 |
+
* binary.
|
| 99 |
+
* @since v8.3.0
|
| 100 |
*/
|
| 101 |
+
clear(): void;
|
| 102 |
/**
|
| 103 |
+
* Maintains an internal counter specific to `label` and outputs to `stdout` the
|
| 104 |
+
* number of times `console.count()` has been called with the given `label`.
|
| 105 |
+
*
|
| 106 |
+
* ```js
|
| 107 |
+
* > console.count()
|
| 108 |
+
* default: 1
|
| 109 |
+
* undefined
|
| 110 |
+
* > console.count('default')
|
| 111 |
+
* default: 2
|
| 112 |
+
* undefined
|
| 113 |
+
* > console.count('abc')
|
| 114 |
+
* abc: 1
|
| 115 |
+
* undefined
|
| 116 |
+
* > console.count('xyz')
|
| 117 |
+
* xyz: 1
|
| 118 |
+
* undefined
|
| 119 |
+
* > console.count('abc')
|
| 120 |
+
* abc: 2
|
| 121 |
+
* undefined
|
| 122 |
+
* > console.count()
|
| 123 |
+
* default: 3
|
| 124 |
+
* undefined
|
| 125 |
+
* >
|
| 126 |
+
* ```
|
| 127 |
+
* @since v8.3.0
|
| 128 |
+
* @param [label='default'] The display label for the counter.
|
| 129 |
*/
|
| 130 |
+
count(label?: string): void;
|
| 131 |
/**
|
| 132 |
+
* Resets the internal counter specific to `label`.
|
| 133 |
+
*
|
| 134 |
+
* ```js
|
| 135 |
+
* > console.count('abc');
|
| 136 |
+
* abc: 1
|
| 137 |
+
* undefined
|
| 138 |
+
* > console.countReset('abc');
|
| 139 |
+
* undefined
|
| 140 |
+
* > console.count('abc');
|
| 141 |
+
* abc: 1
|
| 142 |
+
* undefined
|
| 143 |
+
* >
|
| 144 |
+
* ```
|
| 145 |
+
* @since v8.3.0
|
| 146 |
+
* @param [label='default'] The display label for the counter.
|
| 147 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
countReset(label?: string): void;
|
| 149 |
+
/**
|
| 150 |
+
* The `console.debug()` function is an alias for {@link log}.
|
| 151 |
+
* @since v8.0.0
|
| 152 |
+
*/
|
| 153 |
+
debug(message?: any, ...optionalParams: any[]): void;
|
| 154 |
+
/**
|
| 155 |
+
* Uses [`util.inspect()`](https://nodejs.org/docs/latest-v20.x/api/util.html#utilinspectobject-options) on `obj` and prints the resulting string to `stdout`.
|
| 156 |
+
* This function bypasses any custom `inspect()` function defined on `obj`.
|
| 157 |
+
* @since v0.1.101
|
| 158 |
+
*/
|
| 159 |
+
dir(obj: any, options?: InspectOptions): void;
|
| 160 |
+
/**
|
| 161 |
+
* This method calls `console.log()` passing it the arguments received.
|
| 162 |
+
* This method does not produce any XML formatting.
|
| 163 |
+
* @since v8.0.0
|
| 164 |
+
*/
|
| 165 |
dirxml(...data: any[]): void;
|
| 166 |
+
/**
|
| 167 |
+
* Prints to `stderr` with newline. Multiple arguments can be passed, with the
|
| 168 |
+
* first used as the primary message and all additional used as substitution
|
| 169 |
+
* values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html)
|
| 170 |
+
* (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v20.x/api/util.html#utilformatformat-args)).
|
| 171 |
+
*
|
| 172 |
+
* ```js
|
| 173 |
+
* const code = 5;
|
| 174 |
+
* console.error('error #%d', code);
|
| 175 |
+
* // Prints: error #5, to stderr
|
| 176 |
+
* console.error('error', code);
|
| 177 |
+
* // Prints: error 5, to stderr
|
| 178 |
+
* ```
|
| 179 |
+
*
|
| 180 |
+
* If formatting elements (e.g. `%d`) are not found in the first string then
|
| 181 |
+
* [`util.inspect()`](https://nodejs.org/docs/latest-v20.x/api/util.html#utilinspectobject-options) is called on each argument and the
|
| 182 |
+
* resulting string values are concatenated. See [`util.format()`](https://nodejs.org/docs/latest-v20.x/api/util.html#utilformatformat-args)
|
| 183 |
+
* for more information.
|
| 184 |
+
* @since v0.1.100
|
| 185 |
+
*/
|
| 186 |
+
error(message?: any, ...optionalParams: any[]): void;
|
| 187 |
+
/**
|
| 188 |
+
* Increases indentation of subsequent lines by spaces for `groupIndentation` length.
|
| 189 |
+
*
|
| 190 |
+
* If one or more `label`s are provided, those are printed first without the
|
| 191 |
+
* additional indentation.
|
| 192 |
+
* @since v8.5.0
|
| 193 |
+
*/
|
| 194 |
+
group(...label: any[]): void;
|
| 195 |
+
/**
|
| 196 |
+
* An alias for {@link group}.
|
| 197 |
+
* @since v8.5.0
|
| 198 |
+
*/
|
| 199 |
+
groupCollapsed(...label: any[]): void;
|
| 200 |
+
/**
|
| 201 |
+
* Decreases indentation of subsequent lines by spaces for `groupIndentation` length.
|
| 202 |
+
* @since v8.5.0
|
| 203 |
+
*/
|
| 204 |
groupEnd(): void;
|
| 205 |
+
/**
|
| 206 |
+
* The `console.info()` function is an alias for {@link log}.
|
| 207 |
+
* @since v0.1.100
|
| 208 |
+
*/
|
| 209 |
+
info(message?: any, ...optionalParams: any[]): void;
|
| 210 |
+
/**
|
| 211 |
+
* Prints to `stdout` with newline. Multiple arguments can be passed, with the
|
| 212 |
+
* first used as the primary message and all additional used as substitution
|
| 213 |
+
* values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html)
|
| 214 |
+
* (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v20.x/api/util.html#utilformatformat-args)).
|
| 215 |
+
*
|
| 216 |
+
* ```js
|
| 217 |
+
* const count = 5;
|
| 218 |
+
* console.log('count: %d', count);
|
| 219 |
+
* // Prints: count: 5, to stdout
|
| 220 |
+
* console.log('count:', count);
|
| 221 |
+
* // Prints: count: 5, to stdout
|
| 222 |
+
* ```
|
| 223 |
+
*
|
| 224 |
+
* See [`util.format()`](https://nodejs.org/docs/latest-v20.x/api/util.html#utilformatformat-args) for more information.
|
| 225 |
+
* @since v0.1.100
|
| 226 |
+
*/
|
| 227 |
+
log(message?: any, ...optionalParams: any[]): void;
|
| 228 |
+
/**
|
| 229 |
+
* Try to construct a table with the columns of the properties of `tabularData` (or use `properties`) and rows of `tabularData` and log it. Falls back to just
|
| 230 |
+
* logging the argument if it can't be parsed as tabular.
|
| 231 |
+
*
|
| 232 |
+
* ```js
|
| 233 |
+
* // These can't be parsed as tabular data
|
| 234 |
+
* console.table(Symbol());
|
| 235 |
+
* // Symbol()
|
| 236 |
+
*
|
| 237 |
+
* console.table(undefined);
|
| 238 |
+
* // undefined
|
| 239 |
+
*
|
| 240 |
+
* console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }]);
|
| 241 |
+
* // ┌─────────┬─────┬─────┐
|
| 242 |
+
* // │ (index) │ a │ b │
|
| 243 |
+
* // ├─────────┼─────┼─────┤
|
| 244 |
+
* // │ 0 │ 1 │ 'Y' │
|
| 245 |
+
* // │ 1 │ 'Z' │ 2 │
|
| 246 |
+
* // └─────────┴─────┴─────┘
|
| 247 |
+
*
|
| 248 |
+
* console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }], ['a']);
|
| 249 |
+
* // ┌─────────┬─────┐
|
| 250 |
+
* // │ (index) │ a │
|
| 251 |
+
* // ├─────────┼─────┤
|
| 252 |
+
* // │ 0 │ 1 │
|
| 253 |
+
* // │ 1 │ 'Z' │
|
| 254 |
+
* // └─────────┴─────┘
|
| 255 |
+
* ```
|
| 256 |
+
* @since v10.0.0
|
| 257 |
+
* @param properties Alternate properties for constructing the table.
|
| 258 |
+
*/
|
| 259 |
+
table(tabularData: any, properties?: readonly string[]): void;
|
| 260 |
+
/**
|
| 261 |
+
* Starts a timer that can be used to compute the duration of an operation. Timers
|
| 262 |
+
* are identified by a unique `label`. Use the same `label` when calling {@link timeEnd} to stop the timer and output the elapsed time in
|
| 263 |
+
* suitable time units to `stdout`. For example, if the elapsed
|
| 264 |
+
* time is 3869ms, `console.timeEnd()` displays "3.869s".
|
| 265 |
+
* @since v0.1.104
|
| 266 |
+
* @param [label='default']
|
| 267 |
+
*/
|
| 268 |
time(label?: string): void;
|
| 269 |
+
/**
|
| 270 |
+
* Stops a timer that was previously started by calling {@link time} and
|
| 271 |
+
* prints the result to `stdout`:
|
| 272 |
+
*
|
| 273 |
+
* ```js
|
| 274 |
+
* console.time('bunch-of-stuff');
|
| 275 |
+
* // Do a bunch of stuff.
|
| 276 |
+
* console.timeEnd('bunch-of-stuff');
|
| 277 |
+
* // Prints: bunch-of-stuff: 225.438ms
|
| 278 |
+
* ```
|
| 279 |
+
* @since v0.1.104
|
| 280 |
+
* @param [label='default']
|
| 281 |
+
*/
|
| 282 |
timeEnd(label?: string): void;
|
| 283 |
+
/**
|
| 284 |
+
* For a timer that was previously started by calling {@link time}, prints
|
| 285 |
+
* the elapsed time and other `data` arguments to `stdout`:
|
| 286 |
+
*
|
| 287 |
+
* ```js
|
| 288 |
+
* console.time('process');
|
| 289 |
+
* const value = expensiveProcess1(); // Returns 42
|
| 290 |
+
* console.timeLog('process', value);
|
| 291 |
+
* // Prints "process: 365.227ms 42".
|
| 292 |
+
* doExpensiveProcess2(value);
|
| 293 |
+
* console.timeEnd('process');
|
| 294 |
+
* ```
|
| 295 |
+
* @since v10.7.0
|
| 296 |
+
* @param [label='default']
|
| 297 |
+
*/
|
| 298 |
timeLog(label?: string, ...data: any[]): void;
|
| 299 |
+
/**
|
| 300 |
+
* Prints to `stderr` the string `'Trace: '`, followed by the [`util.format()`](https://nodejs.org/docs/latest-v20.x/api/util.html#utilformatformat-args)
|
| 301 |
+
* formatted message and stack trace to the current position in the code.
|
| 302 |
+
*
|
| 303 |
+
* ```js
|
| 304 |
+
* console.trace('Show me');
|
| 305 |
+
* // Prints: (stack trace will vary based on where trace is called)
|
| 306 |
+
* // Trace: Show me
|
| 307 |
+
* // at repl:2:9
|
| 308 |
+
* // at REPLServer.defaultEval (repl.js:248:27)
|
| 309 |
+
* // at bound (domain.js:287:14)
|
| 310 |
+
* // at REPLServer.runBound [as eval] (domain.js:300:12)
|
| 311 |
+
* // at REPLServer.<anonymous> (repl.js:412:12)
|
| 312 |
+
* // at emitOne (events.js:82:20)
|
| 313 |
+
* // at REPLServer.emit (events.js:169:7)
|
| 314 |
+
* // at REPLServer.Interface._onLine (readline.js:210:10)
|
| 315 |
+
* // at REPLServer.Interface._line (readline.js:549:8)
|
| 316 |
+
* // at REPLServer.Interface._ttyWrite (readline.js:826:14)
|
| 317 |
+
* ```
|
| 318 |
+
* @since v0.1.104
|
| 319 |
+
*/
|
| 320 |
+
trace(message?: any, ...optionalParams: any[]): void;
|
| 321 |
+
/**
|
| 322 |
+
* The `console.warn()` function is an alias for {@link error}.
|
| 323 |
+
* @since v0.1.100
|
| 324 |
+
*/
|
| 325 |
+
warn(message?: any, ...optionalParams: any[]): void;
|
| 326 |
+
// --- Inspector mode only ---
|
| 327 |
/**
|
| 328 |
* This method does not display anything unless used in the inspector. The `console.profile()`
|
| 329 |
* method starts a JavaScript CPU profile with an optional label until {@link profileEnd}
|
|
|
|
| 354 |
*/
|
| 355 |
timeStamp(label?: string): void;
|
| 356 |
}
|
| 357 |
+
/**
|
| 358 |
+
* The `console` module provides a simple debugging console that is similar to the
|
| 359 |
+
* JavaScript console mechanism provided by web browsers.
|
| 360 |
+
*
|
| 361 |
+
* The module exports two specific components:
|
| 362 |
+
*
|
| 363 |
+
* * A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream.
|
| 364 |
+
* * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v20.x/api/process.html#processstdout) and
|
| 365 |
+
* [`process.stderr`](https://nodejs.org/docs/latest-v20.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module.
|
| 366 |
+
*
|
| 367 |
+
* _**Warning**_: The global console object's methods are neither consistently
|
| 368 |
+
* synchronous like the browser APIs they resemble, nor are they consistently
|
| 369 |
+
* asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v20.x/api/process.html#a-note-on-process-io) for
|
| 370 |
+
* more information.
|
| 371 |
+
*
|
| 372 |
+
* Example using the global `console`:
|
| 373 |
+
*
|
| 374 |
+
* ```js
|
| 375 |
+
* console.log('hello world');
|
| 376 |
+
* // Prints: hello world, to stdout
|
| 377 |
+
* console.log('hello %s', 'world');
|
| 378 |
+
* // Prints: hello world, to stdout
|
| 379 |
+
* console.error(new Error('Whoops, something bad happened'));
|
| 380 |
+
* // Prints error message and stack trace to stderr:
|
| 381 |
+
* // Error: Whoops, something bad happened
|
| 382 |
+
* // at [eval]:5:15
|
| 383 |
+
* // at Script.runInThisContext (node:vm:132:18)
|
| 384 |
+
* // at Object.runInThisContext (node:vm:309:38)
|
| 385 |
+
* // at node:internal/process/execution:77:19
|
| 386 |
+
* // at [eval]-wrapper:6:22
|
| 387 |
+
* // at evalScript (node:internal/process/execution:76:60)
|
| 388 |
+
* // at node:internal/main/eval_string:23:3
|
| 389 |
+
*
|
| 390 |
+
* const name = 'Will Robinson';
|
| 391 |
+
* console.warn(`Danger ${name}! Danger!`);
|
| 392 |
+
* // Prints: Danger Will Robinson! Danger!, to stderr
|
| 393 |
+
* ```
|
| 394 |
+
*
|
| 395 |
+
* Example using the `Console` class:
|
| 396 |
+
*
|
| 397 |
+
* ```js
|
| 398 |
+
* const out = getStreamSomehow();
|
| 399 |
+
* const err = getStreamSomehow();
|
| 400 |
+
* const myConsole = new console.Console(out, err);
|
| 401 |
+
*
|
| 402 |
+
* myConsole.log('hello world');
|
| 403 |
+
* // Prints: hello world, to out
|
| 404 |
+
* myConsole.log('hello %s', 'world');
|
| 405 |
+
* // Prints: hello world, to out
|
| 406 |
+
* myConsole.error(new Error('Whoops, something bad happened'));
|
| 407 |
+
* // Prints: [Error: Whoops, something bad happened], to err
|
| 408 |
+
*
|
| 409 |
+
* const name = 'Will Robinson';
|
| 410 |
+
* myConsole.warn(`Danger ${name}! Danger!`);
|
| 411 |
+
* // Prints: Danger Will Robinson! Danger!, to err
|
| 412 |
+
* ```
|
| 413 |
+
* @see [source](https://github.com/nodejs/node/blob/v20.11.1/lib/console.js)
|
| 414 |
+
*/
|
| 415 |
+
namespace console {
|
| 416 |
+
interface ConsoleConstructorOptions {
|
| 417 |
+
stdout: NodeJS.WritableStream;
|
| 418 |
+
stderr?: NodeJS.WritableStream | undefined;
|
| 419 |
+
/**
|
| 420 |
+
* Ignore errors when writing to the underlying streams.
|
| 421 |
+
* @default true
|
| 422 |
+
*/
|
| 423 |
+
ignoreErrors?: boolean | undefined;
|
| 424 |
+
/**
|
| 425 |
+
* Set color support for this `Console` instance. Setting to true enables coloring while inspecting
|
| 426 |
+
* values. Setting to `false` disables coloring while inspecting values. Setting to `'auto'` makes color
|
| 427 |
+
* support depend on the value of the `isTTY` property and the value returned by `getColorDepth()` on the
|
| 428 |
+
* respective stream. This option can not be used, if `inspectOptions.colors` is set as well.
|
| 429 |
+
* @default auto
|
| 430 |
+
*/
|
| 431 |
+
colorMode?: boolean | "auto" | undefined;
|
| 432 |
+
/**
|
| 433 |
+
* Specifies options that are passed along to
|
| 434 |
+
* [`util.inspect()`](https://nodejs.org/docs/latest-v20.x/api/util.html#utilinspectobject-options).
|
| 435 |
+
*/
|
| 436 |
+
inspectOptions?: InspectOptions | undefined;
|
| 437 |
+
/**
|
| 438 |
+
* Set group indentation.
|
| 439 |
+
* @default 2
|
| 440 |
+
*/
|
| 441 |
+
groupIndentation?: number | undefined;
|
| 442 |
+
}
|
| 443 |
+
interface ConsoleConstructor {
|
| 444 |
+
prototype: Console;
|
| 445 |
+
new(stdout: NodeJS.WritableStream, stderr?: NodeJS.WritableStream, ignoreErrors?: boolean): Console;
|
| 446 |
+
new(options: ConsoleConstructorOptions): Console;
|
| 447 |
+
}
|
| 448 |
+
}
|
| 449 |
+
var console: Console;
|
| 450 |
}
|
| 451 |
+
export = globalThis.console;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 452 |
}
|
node_modules/@types/node/constants.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
* to the `constants` property exposed by the relevant module. For instance,
|
| 5 |
* `require('node:fs').constants` and `require('node:os').constants`.
|
| 6 |
*/
|
| 7 |
-
declare module "
|
| 8 |
const constants:
|
| 9 |
& typeof import("node:os").constants.dlopen
|
| 10 |
& typeof import("node:os").constants.errno
|
|
@@ -14,7 +14,8 @@ declare module "node:constants" {
|
|
| 14 |
& typeof import("node:crypto").constants;
|
| 15 |
export = constants;
|
| 16 |
}
|
| 17 |
-
|
| 18 |
-
|
|
|
|
| 19 |
export = constants;
|
| 20 |
}
|
|
|
|
| 4 |
* to the `constants` property exposed by the relevant module. For instance,
|
| 5 |
* `require('node:fs').constants` and `require('node:os').constants`.
|
| 6 |
*/
|
| 7 |
+
declare module "constants" {
|
| 8 |
const constants:
|
| 9 |
& typeof import("node:os").constants.dlopen
|
| 10 |
& typeof import("node:os").constants.errno
|
|
|
|
| 14 |
& typeof import("node:crypto").constants;
|
| 15 |
export = constants;
|
| 16 |
}
|
| 17 |
+
|
| 18 |
+
declare module "node:constants" {
|
| 19 |
+
import constants = require("constants");
|
| 20 |
export = constants;
|
| 21 |
}
|
node_modules/@types/node/crypto.d.ts
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
node_modules/@types/node/dgram.d.ts
CHANGED
|
@@ -23,13 +23,13 @@
|
|
| 23 |
* server.bind(41234);
|
| 24 |
* // Prints: server listening 0.0.0.0:41234
|
| 25 |
* ```
|
| 26 |
-
* @see [source](https://github.com/nodejs/node/blob/
|
| 27 |
*/
|
| 28 |
-
declare module "
|
| 29 |
import { NonSharedBuffer } from "node:buffer";
|
|
|
|
| 30 |
import * as dns from "node:dns";
|
| 31 |
-
import { Abortable, EventEmitter
|
| 32 |
-
import { AddressInfo, BlockList } from "node:net";
|
| 33 |
interface RemoteInfo {
|
| 34 |
address: string;
|
| 35 |
family: "IPv4" | "IPv6";
|
|
@@ -46,7 +46,6 @@ declare module "node:dgram" {
|
|
| 46 |
interface SocketOptions extends Abortable {
|
| 47 |
type: SocketType;
|
| 48 |
reuseAddr?: boolean | undefined;
|
| 49 |
-
reusePort?: boolean | undefined;
|
| 50 |
/**
|
| 51 |
* @default false
|
| 52 |
*/
|
|
@@ -60,8 +59,6 @@ declare module "node:dgram" {
|
|
| 60 |
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
|
| 61 |
) => void)
|
| 62 |
| undefined;
|
| 63 |
-
receiveBlockList?: BlockList | undefined;
|
| 64 |
-
sendBlockList?: BlockList | undefined;
|
| 65 |
}
|
| 66 |
/**
|
| 67 |
* Creates a `dgram.Socket` object. Once the socket is created, calling `socket.bind()` will instruct the socket to begin listening for datagram
|
|
@@ -88,13 +85,6 @@ declare module "node:dgram" {
|
|
| 88 |
*/
|
| 89 |
function createSocket(type: SocketType, callback?: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): Socket;
|
| 90 |
function createSocket(options: SocketOptions, callback?: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): Socket;
|
| 91 |
-
interface SocketEventMap {
|
| 92 |
-
"close": [];
|
| 93 |
-
"connect": [];
|
| 94 |
-
"error": [err: Error];
|
| 95 |
-
"listening": [];
|
| 96 |
-
"message": [msg: NonSharedBuffer, rinfo: RemoteInfo];
|
| 97 |
-
}
|
| 98 |
/**
|
| 99 |
* Encapsulates the datagram functionality.
|
| 100 |
*
|
|
@@ -102,7 +92,7 @@ declare module "node:dgram" {
|
|
| 102 |
* The `new` keyword is not to be used to create `dgram.Socket` instances.
|
| 103 |
* @since v0.1.99
|
| 104 |
*/
|
| 105 |
-
class Socket
|
| 106 |
/**
|
| 107 |
* Tells the kernel to join a multicast group at the given `multicastAddress` and `multicastInterface` using the `IP_ADD_MEMBERSHIP` socket option. If the `multicastInterface` argument is not
|
| 108 |
* specified, the operating system will choose
|
|
@@ -551,14 +541,57 @@ declare module "node:dgram" {
|
|
| 551 |
* @since v13.1.0, v12.16.0
|
| 552 |
*/
|
| 553 |
dropSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 554 |
/**
|
| 555 |
* Calls `socket.close()` and returns a promise that fulfills when the socket has closed.
|
| 556 |
* @since v20.5.0
|
| 557 |
*/
|
| 558 |
[Symbol.asyncDispose](): Promise<void>;
|
| 559 |
}
|
| 560 |
-
interface Socket extends InternalEventEmitter<SocketEventMap> {}
|
| 561 |
}
|
| 562 |
-
declare module "dgram" {
|
| 563 |
-
export * from "
|
| 564 |
}
|
|
|
|
| 23 |
* server.bind(41234);
|
| 24 |
* // Prints: server listening 0.0.0.0:41234
|
| 25 |
* ```
|
| 26 |
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/dgram.js)
|
| 27 |
*/
|
| 28 |
+
declare module "dgram" {
|
| 29 |
import { NonSharedBuffer } from "node:buffer";
|
| 30 |
+
import { AddressInfo } from "node:net";
|
| 31 |
import * as dns from "node:dns";
|
| 32 |
+
import { Abortable, EventEmitter } from "node:events";
|
|
|
|
| 33 |
interface RemoteInfo {
|
| 34 |
address: string;
|
| 35 |
family: "IPv4" | "IPv6";
|
|
|
|
| 46 |
interface SocketOptions extends Abortable {
|
| 47 |
type: SocketType;
|
| 48 |
reuseAddr?: boolean | undefined;
|
|
|
|
| 49 |
/**
|
| 50 |
* @default false
|
| 51 |
*/
|
|
|
|
| 59 |
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
|
| 60 |
) => void)
|
| 61 |
| undefined;
|
|
|
|
|
|
|
| 62 |
}
|
| 63 |
/**
|
| 64 |
* Creates a `dgram.Socket` object. Once the socket is created, calling `socket.bind()` will instruct the socket to begin listening for datagram
|
|
|
|
| 85 |
*/
|
| 86 |
function createSocket(type: SocketType, callback?: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): Socket;
|
| 87 |
function createSocket(options: SocketOptions, callback?: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): Socket;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
/**
|
| 89 |
* Encapsulates the datagram functionality.
|
| 90 |
*
|
|
|
|
| 92 |
* The `new` keyword is not to be used to create `dgram.Socket` instances.
|
| 93 |
* @since v0.1.99
|
| 94 |
*/
|
| 95 |
+
class Socket extends EventEmitter {
|
| 96 |
/**
|
| 97 |
* Tells the kernel to join a multicast group at the given `multicastAddress` and `multicastInterface` using the `IP_ADD_MEMBERSHIP` socket option. If the `multicastInterface` argument is not
|
| 98 |
* specified, the operating system will choose
|
|
|
|
| 541 |
* @since v13.1.0, v12.16.0
|
| 542 |
*/
|
| 543 |
dropSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void;
|
| 544 |
+
/**
|
| 545 |
+
* events.EventEmitter
|
| 546 |
+
* 1. close
|
| 547 |
+
* 2. connect
|
| 548 |
+
* 3. error
|
| 549 |
+
* 4. listening
|
| 550 |
+
* 5. message
|
| 551 |
+
*/
|
| 552 |
+
addListener(event: string, listener: (...args: any[]) => void): this;
|
| 553 |
+
addListener(event: "close", listener: () => void): this;
|
| 554 |
+
addListener(event: "connect", listener: () => void): this;
|
| 555 |
+
addListener(event: "error", listener: (err: Error) => void): this;
|
| 556 |
+
addListener(event: "listening", listener: () => void): this;
|
| 557 |
+
addListener(event: "message", listener: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): this;
|
| 558 |
+
emit(event: string | symbol, ...args: any[]): boolean;
|
| 559 |
+
emit(event: "close"): boolean;
|
| 560 |
+
emit(event: "connect"): boolean;
|
| 561 |
+
emit(event: "error", err: Error): boolean;
|
| 562 |
+
emit(event: "listening"): boolean;
|
| 563 |
+
emit(event: "message", msg: NonSharedBuffer, rinfo: RemoteInfo): boolean;
|
| 564 |
+
on(event: string, listener: (...args: any[]) => void): this;
|
| 565 |
+
on(event: "close", listener: () => void): this;
|
| 566 |
+
on(event: "connect", listener: () => void): this;
|
| 567 |
+
on(event: "error", listener: (err: Error) => void): this;
|
| 568 |
+
on(event: "listening", listener: () => void): this;
|
| 569 |
+
on(event: "message", listener: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): this;
|
| 570 |
+
once(event: string, listener: (...args: any[]) => void): this;
|
| 571 |
+
once(event: "close", listener: () => void): this;
|
| 572 |
+
once(event: "connect", listener: () => void): this;
|
| 573 |
+
once(event: "error", listener: (err: Error) => void): this;
|
| 574 |
+
once(event: "listening", listener: () => void): this;
|
| 575 |
+
once(event: "message", listener: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): this;
|
| 576 |
+
prependListener(event: string, listener: (...args: any[]) => void): this;
|
| 577 |
+
prependListener(event: "close", listener: () => void): this;
|
| 578 |
+
prependListener(event: "connect", listener: () => void): this;
|
| 579 |
+
prependListener(event: "error", listener: (err: Error) => void): this;
|
| 580 |
+
prependListener(event: "listening", listener: () => void): this;
|
| 581 |
+
prependListener(event: "message", listener: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): this;
|
| 582 |
+
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
| 583 |
+
prependOnceListener(event: "close", listener: () => void): this;
|
| 584 |
+
prependOnceListener(event: "connect", listener: () => void): this;
|
| 585 |
+
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
| 586 |
+
prependOnceListener(event: "listening", listener: () => void): this;
|
| 587 |
+
prependOnceListener(event: "message", listener: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): this;
|
| 588 |
/**
|
| 589 |
* Calls `socket.close()` and returns a promise that fulfills when the socket has closed.
|
| 590 |
* @since v20.5.0
|
| 591 |
*/
|
| 592 |
[Symbol.asyncDispose](): Promise<void>;
|
| 593 |
}
|
|
|
|
| 594 |
}
|
| 595 |
+
declare module "node:dgram" {
|
| 596 |
+
export * from "dgram";
|
| 597 |
}
|
node_modules/@types/node/diagnostics_channel.d.ts
CHANGED
|
@@ -20,9 +20,9 @@
|
|
| 20 |
* should generally include the module name to avoid collisions with data from
|
| 21 |
* other modules.
|
| 22 |
* @since v15.1.0, v14.17.0
|
| 23 |
-
* @see [source](https://github.com/nodejs/node/blob/
|
| 24 |
*/
|
| 25 |
-
declare module "
|
| 26 |
import { AsyncLocalStorage } from "node:async_hooks";
|
| 27 |
/**
|
| 28 |
* Check if there are active subscribers to the named channel. This is helpful if
|
|
@@ -189,6 +189,7 @@ declare module "node:diagnostics_channel" {
|
|
| 189 |
* });
|
| 190 |
* ```
|
| 191 |
* @since v15.1.0, v14.17.0
|
|
|
|
| 192 |
* @param onMessage The handler to receive channel messages
|
| 193 |
*/
|
| 194 |
subscribe(onMessage: ChannelListener): void;
|
|
@@ -209,6 +210,7 @@ declare module "node:diagnostics_channel" {
|
|
| 209 |
* channel.unsubscribe(onMessage);
|
| 210 |
* ```
|
| 211 |
* @since v15.1.0, v14.17.0
|
|
|
|
| 212 |
* @param onMessage The previous subscribed handler to remove
|
| 213 |
* @return `true` if the handler was found, `false` otherwise.
|
| 214 |
*/
|
|
@@ -571,6 +573,6 @@ declare module "node:diagnostics_channel" {
|
|
| 571 |
readonly hasSubscribers: boolean;
|
| 572 |
}
|
| 573 |
}
|
| 574 |
-
declare module "diagnostics_channel" {
|
| 575 |
-
export * from "
|
| 576 |
}
|
|
|
|
| 20 |
* should generally include the module name to avoid collisions with data from
|
| 21 |
* other modules.
|
| 22 |
* @since v15.1.0, v14.17.0
|
| 23 |
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/diagnostics_channel.js)
|
| 24 |
*/
|
| 25 |
+
declare module "diagnostics_channel" {
|
| 26 |
import { AsyncLocalStorage } from "node:async_hooks";
|
| 27 |
/**
|
| 28 |
* Check if there are active subscribers to the named channel. This is helpful if
|
|
|
|
| 189 |
* });
|
| 190 |
* ```
|
| 191 |
* @since v15.1.0, v14.17.0
|
| 192 |
+
* @deprecated Since v18.7.0,v16.17.0 - Use {@link subscribe(name, onMessage)}
|
| 193 |
* @param onMessage The handler to receive channel messages
|
| 194 |
*/
|
| 195 |
subscribe(onMessage: ChannelListener): void;
|
|
|
|
| 210 |
* channel.unsubscribe(onMessage);
|
| 211 |
* ```
|
| 212 |
* @since v15.1.0, v14.17.0
|
| 213 |
+
* @deprecated Since v18.7.0,v16.17.0 - Use {@link unsubscribe(name, onMessage)}
|
| 214 |
* @param onMessage The previous subscribed handler to remove
|
| 215 |
* @return `true` if the handler was found, `false` otherwise.
|
| 216 |
*/
|
|
|
|
| 573 |
readonly hasSubscribers: boolean;
|
| 574 |
}
|
| 575 |
}
|
| 576 |
+
declare module "node:diagnostics_channel" {
|
| 577 |
+
export * from "diagnostics_channel";
|
| 578 |
}
|
node_modules/@types/node/dns.d.ts
CHANGED
|
@@ -41,27 +41,28 @@
|
|
| 41 |
* });
|
| 42 |
* ```
|
| 43 |
*
|
| 44 |
-
* See the [Implementation considerations section](https://nodejs.org/docs/latest-
|
| 45 |
-
* @see [source](https://github.com/nodejs/node/blob/
|
| 46 |
*/
|
| 47 |
-
declare module "
|
|
|
|
| 48 |
// Supported getaddrinfo flags.
|
| 49 |
/**
|
| 50 |
* Limits returned address types to the types of non-loopback addresses configured on the system. For example, IPv4 addresses are
|
| 51 |
* only returned if the current system has at least one IPv4 address configured.
|
| 52 |
*/
|
| 53 |
-
const ADDRCONFIG: number;
|
| 54 |
/**
|
| 55 |
* If the IPv6 family was specified, but no IPv6 addresses were found, then return IPv4 mapped IPv6 addresses. It is not supported
|
| 56 |
* on some operating systems (e.g. FreeBSD 10.1).
|
| 57 |
*/
|
| 58 |
-
const V4MAPPED: number;
|
| 59 |
/**
|
| 60 |
* If `dns.V4MAPPED` is specified, return resolved IPv6 addresses as
|
| 61 |
* well as IPv4 mapped IPv6 addresses.
|
| 62 |
*/
|
| 63 |
-
const ALL: number;
|
| 64 |
-
interface LookupOptions {
|
| 65 |
/**
|
| 66 |
* The record family. Must be `4`, `6`, or `0`. For backward compatibility reasons, `'IPv4'` and `'IPv6'` are interpreted
|
| 67 |
* as `4` and `6` respectively. The value 0 indicates that either an IPv4 or IPv6 address is returned. If the value `0` is used
|
|
@@ -70,7 +71,7 @@ declare module "node:dns" {
|
|
| 70 |
*/
|
| 71 |
family?: number | "IPv4" | "IPv6" | undefined;
|
| 72 |
/**
|
| 73 |
-
* One or more [supported `getaddrinfo`](https://nodejs.org/docs/latest-
|
| 74 |
* passed by bitwise `OR`ing their values.
|
| 75 |
*/
|
| 76 |
hints?: number | undefined;
|
|
@@ -83,27 +84,26 @@ declare module "node:dns" {
|
|
| 83 |
* When `verbatim`, the resolved addresses are return unsorted. When `ipv4first`, the resolved addresses are sorted
|
| 84 |
* by placing IPv4 addresses before IPv6 addresses. When `ipv6first`, the resolved addresses are sorted by placing IPv6
|
| 85 |
* addresses before IPv4 addresses. Default value is configurable using
|
| 86 |
-
* {@link setDefaultResultOrder} or [`--dns-result-order`](https://nodejs.org/docs/latest-
|
| 87 |
* @default `verbatim` (addresses are not reordered)
|
| 88 |
-
* @since v22.1.0
|
| 89 |
*/
|
| 90 |
order?: "ipv4first" | "ipv6first" | "verbatim" | undefined;
|
| 91 |
/**
|
| 92 |
* When `true`, the callback receives IPv4 and IPv6 addresses in the order the DNS resolver returned them. When `false`, IPv4
|
| 93 |
* addresses are placed before IPv6 addresses. This option will be deprecated in favor of `order`. When both are specified,
|
| 94 |
* `order` has higher precedence. New code should only use `order`. Default value is configurable using {@link setDefaultResultOrder}
|
|
|
|
| 95 |
* @default true (addresses are not reordered)
|
| 96 |
-
* @deprecated Please use `order` option
|
| 97 |
*/
|
| 98 |
verbatim?: boolean | undefined;
|
| 99 |
}
|
| 100 |
-
interface LookupOneOptions extends LookupOptions {
|
| 101 |
all?: false | undefined;
|
| 102 |
}
|
| 103 |
-
interface LookupAllOptions extends LookupOptions {
|
| 104 |
all: true;
|
| 105 |
}
|
| 106 |
-
interface LookupAddress {
|
| 107 |
/**
|
| 108 |
* A string representation of an IPv4 or IPv6 address.
|
| 109 |
*/
|
|
@@ -132,7 +132,7 @@ declare module "node:dns" {
|
|
| 132 |
* The implementation uses an operating system facility that can associate names
|
| 133 |
* with addresses and vice versa. This implementation can have subtle but
|
| 134 |
* important consequences on the behavior of any Node.js program. Please take some
|
| 135 |
-
* time to consult the [Implementation considerations section](https://nodejs.org/docs/latest-
|
| 136 |
* before using `dns.lookup()`.
|
| 137 |
*
|
| 138 |
* Example usage:
|
|
@@ -154,35 +154,35 @@ declare module "node:dns" {
|
|
| 154 |
* // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}]
|
| 155 |
* ```
|
| 156 |
*
|
| 157 |
-
* If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-
|
| 158 |
* version, and `all` is not set to `true`, it returns a `Promise` for an `Object` with `address` and `family` properties.
|
| 159 |
* @since v0.1.90
|
| 160 |
*/
|
| 161 |
-
function lookup(
|
| 162 |
hostname: string,
|
| 163 |
family: number,
|
| 164 |
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
|
| 165 |
): void;
|
| 166 |
-
function lookup(
|
| 167 |
hostname: string,
|
| 168 |
options: LookupOneOptions,
|
| 169 |
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
|
| 170 |
): void;
|
| 171 |
-
function lookup(
|
| 172 |
hostname: string,
|
| 173 |
options: LookupAllOptions,
|
| 174 |
callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void,
|
| 175 |
): void;
|
| 176 |
-
function lookup(
|
| 177 |
hostname: string,
|
| 178 |
options: LookupOptions,
|
| 179 |
callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void,
|
| 180 |
): void;
|
| 181 |
-
function lookup(
|
| 182 |
hostname: string,
|
| 183 |
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
|
| 184 |
): void;
|
| 185 |
-
namespace lookup {
|
| 186 |
function __promisify__(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
|
| 187 |
function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise<LookupAddress>;
|
| 188 |
function __promisify__(hostname: string, options: LookupOptions): Promise<LookupAddress | LookupAddress[]>;
|
|
@@ -194,7 +194,7 @@ declare module "node:dns" {
|
|
| 194 |
* If `address` is not a valid IP address, a `TypeError` will be thrown.
|
| 195 |
* The `port` will be coerced to a number. If it is not a legal port, a `TypeError` will be thrown.
|
| 196 |
*
|
| 197 |
-
* On an error, `err` is an [`Error`](https://nodejs.org/docs/latest-
|
| 198 |
* where `err.code` is the error code.
|
| 199 |
*
|
| 200 |
* ```js
|
|
@@ -205,16 +205,16 @@ declare module "node:dns" {
|
|
| 205 |
* });
|
| 206 |
* ```
|
| 207 |
*
|
| 208 |
-
* If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-
|
| 209 |
* version, it returns a `Promise` for an `Object` with `hostname` and `service` properties.
|
| 210 |
* @since v0.11.14
|
| 211 |
*/
|
| 212 |
-
function lookupService(
|
| 213 |
address: string,
|
| 214 |
port: number,
|
| 215 |
callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void,
|
| 216 |
): void;
|
| 217 |
-
namespace lookupService {
|
| 218 |
function __promisify__(
|
| 219 |
address: string,
|
| 220 |
port: number,
|
|
@@ -223,23 +223,25 @@ declare module "node:dns" {
|
|
| 223 |
service: string;
|
| 224 |
}>;
|
| 225 |
}
|
| 226 |
-
interface ResolveOptions {
|
| 227 |
ttl: boolean;
|
| 228 |
}
|
| 229 |
-
interface ResolveWithTtlOptions extends ResolveOptions {
|
| 230 |
ttl: true;
|
| 231 |
}
|
| 232 |
-
interface RecordWithTtl {
|
| 233 |
address: string;
|
| 234 |
ttl: number;
|
| 235 |
}
|
| 236 |
-
|
|
|
|
|
|
|
| 237 |
type: "A";
|
| 238 |
}
|
| 239 |
-
interface AnyAaaaRecord extends RecordWithTtl {
|
| 240 |
type: "AAAA";
|
| 241 |
}
|
| 242 |
-
interface CaaRecord {
|
| 243 |
critical: number;
|
| 244 |
issue?: string | undefined;
|
| 245 |
issuewild?: string | undefined;
|
|
@@ -247,17 +249,17 @@ declare module "node:dns" {
|
|
| 247 |
contactemail?: string | undefined;
|
| 248 |
contactphone?: string | undefined;
|
| 249 |
}
|
| 250 |
-
interface AnyCaaRecord extends CaaRecord {
|
| 251 |
type: "CAA";
|
| 252 |
}
|
| 253 |
-
interface MxRecord {
|
| 254 |
priority: number;
|
| 255 |
exchange: string;
|
| 256 |
}
|
| 257 |
-
interface AnyMxRecord extends MxRecord {
|
| 258 |
type: "MX";
|
| 259 |
}
|
| 260 |
-
interface NaptrRecord {
|
| 261 |
flags: string;
|
| 262 |
service: string;
|
| 263 |
regexp: string;
|
|
@@ -265,10 +267,10 @@ declare module "node:dns" {
|
|
| 265 |
order: number;
|
| 266 |
preference: number;
|
| 267 |
}
|
| 268 |
-
interface AnyNaptrRecord extends NaptrRecord {
|
| 269 |
type: "NAPTR";
|
| 270 |
}
|
| 271 |
-
interface SoaRecord {
|
| 272 |
nsname: string;
|
| 273 |
hostmaster: string;
|
| 274 |
serial: number;
|
|
@@ -277,44 +279,35 @@ declare module "node:dns" {
|
|
| 277 |
expire: number;
|
| 278 |
minttl: number;
|
| 279 |
}
|
| 280 |
-
interface AnySoaRecord extends SoaRecord {
|
| 281 |
type: "SOA";
|
| 282 |
}
|
| 283 |
-
interface SrvRecord {
|
| 284 |
priority: number;
|
| 285 |
weight: number;
|
| 286 |
port: number;
|
| 287 |
name: string;
|
| 288 |
}
|
| 289 |
-
interface AnySrvRecord extends SrvRecord {
|
| 290 |
type: "SRV";
|
| 291 |
}
|
| 292 |
-
interface
|
| 293 |
-
certUsage: number;
|
| 294 |
-
selector: number;
|
| 295 |
-
match: number;
|
| 296 |
-
data: ArrayBuffer;
|
| 297 |
-
}
|
| 298 |
-
interface AnyTlsaRecord extends TlsaRecord {
|
| 299 |
-
type: "TLSA";
|
| 300 |
-
}
|
| 301 |
-
interface AnyTxtRecord {
|
| 302 |
type: "TXT";
|
| 303 |
entries: string[];
|
| 304 |
}
|
| 305 |
-
interface AnyNsRecord {
|
| 306 |
type: "NS";
|
| 307 |
value: string;
|
| 308 |
}
|
| 309 |
-
interface AnyPtrRecord {
|
| 310 |
type: "PTR";
|
| 311 |
value: string;
|
| 312 |
}
|
| 313 |
-
interface AnyCnameRecord {
|
| 314 |
type: "CNAME";
|
| 315 |
value: string;
|
| 316 |
}
|
| 317 |
-
type AnyRecord =
|
| 318 |
| AnyARecord
|
| 319 |
| AnyAaaaRecord
|
| 320 |
| AnyCaaRecord
|
|
@@ -325,7 +318,6 @@ declare module "node:dns" {
|
|
| 325 |
| AnyPtrRecord
|
| 326 |
| AnySoaRecord
|
| 327 |
| AnySrvRecord
|
| 328 |
-
| AnyTlsaRecord
|
| 329 |
| AnyTxtRecord;
|
| 330 |
/**
|
| 331 |
* Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array
|
|
@@ -334,62 +326,57 @@ declare module "node:dns" {
|
|
| 334 |
*
|
| 335 |
* <omitted>
|
| 336 |
*
|
| 337 |
-
* On error, `err` is an [`Error`](https://nodejs.org/docs/latest-
|
| 338 |
* where `err.code` is one of the `DNS error codes`.
|
| 339 |
* @since v0.1.27
|
| 340 |
* @param hostname Host name to resolve.
|
| 341 |
* @param [rrtype='A'] Resource record type.
|
| 342 |
*/
|
| 343 |
-
function resolve(
|
| 344 |
hostname: string,
|
| 345 |
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
| 346 |
): void;
|
| 347 |
-
function resolve(
|
| 348 |
hostname: string,
|
| 349 |
rrtype: "A" | "AAAA" | "CNAME" | "NS" | "PTR",
|
| 350 |
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
| 351 |
): void;
|
| 352 |
-
function resolve(
|
| 353 |
hostname: string,
|
| 354 |
rrtype: "ANY",
|
| 355 |
callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void,
|
| 356 |
): void;
|
| 357 |
-
function resolve(
|
| 358 |
hostname: string,
|
| 359 |
rrtype: "CAA",
|
| 360 |
callback: (err: NodeJS.ErrnoException | null, address: CaaRecord[]) => void,
|
| 361 |
): void;
|
| 362 |
-
function resolve(
|
| 363 |
hostname: string,
|
| 364 |
rrtype: "MX",
|
| 365 |
callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void,
|
| 366 |
): void;
|
| 367 |
-
function resolve(
|
| 368 |
hostname: string,
|
| 369 |
rrtype: "NAPTR",
|
| 370 |
callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void,
|
| 371 |
): void;
|
| 372 |
-
function resolve(
|
| 373 |
hostname: string,
|
| 374 |
rrtype: "SOA",
|
| 375 |
callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void,
|
| 376 |
): void;
|
| 377 |
-
function resolve(
|
| 378 |
hostname: string,
|
| 379 |
rrtype: "SRV",
|
| 380 |
callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void,
|
| 381 |
): void;
|
| 382 |
-
function resolve(
|
| 383 |
-
hostname: string,
|
| 384 |
-
rrtype: "TLSA",
|
| 385 |
-
callback: (err: NodeJS.ErrnoException | null, addresses: TlsaRecord[]) => void,
|
| 386 |
-
): void;
|
| 387 |
-
function resolve(
|
| 388 |
hostname: string,
|
| 389 |
rrtype: "TXT",
|
| 390 |
callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void,
|
| 391 |
): void;
|
| 392 |
-
function resolve(
|
| 393 |
hostname: string,
|
| 394 |
rrtype: string,
|
| 395 |
callback: (
|
|
@@ -401,12 +388,11 @@ declare module "node:dns" {
|
|
| 401 |
| NaptrRecord[]
|
| 402 |
| SoaRecord
|
| 403 |
| SrvRecord[]
|
| 404 |
-
| TlsaRecord[]
|
| 405 |
| string[][]
|
| 406 |
| AnyRecord[],
|
| 407 |
) => void,
|
| 408 |
): void;
|
| 409 |
-
namespace resolve {
|
| 410 |
function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise<string[]>;
|
| 411 |
function __promisify__(hostname: string, rrtype: "ANY"): Promise<AnyRecord[]>;
|
| 412 |
function __promisify__(hostname: string, rrtype: "CAA"): Promise<CaaRecord[]>;
|
|
@@ -414,7 +400,6 @@ declare module "node:dns" {
|
|
| 414 |
function __promisify__(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
|
| 415 |
function __promisify__(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
|
| 416 |
function __promisify__(hostname: string, rrtype: "SRV"): Promise<SrvRecord[]>;
|
| 417 |
-
function __promisify__(hostname: string, rrtype: "TLSA"): Promise<TlsaRecord[]>;
|
| 418 |
function __promisify__(hostname: string, rrtype: "TXT"): Promise<string[][]>;
|
| 419 |
function __promisify__(
|
| 420 |
hostname: string,
|
|
@@ -426,7 +411,6 @@ declare module "node:dns" {
|
|
| 426 |
| NaptrRecord[]
|
| 427 |
| SoaRecord
|
| 428 |
| SrvRecord[]
|
| 429 |
-
| TlsaRecord[]
|
| 430 |
| string[][]
|
| 431 |
| AnyRecord[]
|
| 432 |
>;
|
|
@@ -437,21 +421,21 @@ declare module "node:dns" {
|
|
| 437 |
* @since v0.1.16
|
| 438 |
* @param hostname Host name to resolve.
|
| 439 |
*/
|
| 440 |
-
function resolve4(
|
| 441 |
hostname: string,
|
| 442 |
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
| 443 |
): void;
|
| 444 |
-
function resolve4(
|
| 445 |
hostname: string,
|
| 446 |
options: ResolveWithTtlOptions,
|
| 447 |
callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void,
|
| 448 |
): void;
|
| 449 |
-
function resolve4(
|
| 450 |
hostname: string,
|
| 451 |
options: ResolveOptions,
|
| 452 |
callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void,
|
| 453 |
): void;
|
| 454 |
-
namespace resolve4 {
|
| 455 |
function __promisify__(hostname: string): Promise<string[]>;
|
| 456 |
function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
|
| 457 |
function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
|
|
@@ -462,21 +446,21 @@ declare module "node:dns" {
|
|
| 462 |
* @since v0.1.16
|
| 463 |
* @param hostname Host name to resolve.
|
| 464 |
*/
|
| 465 |
-
function resolve6(
|
| 466 |
hostname: string,
|
| 467 |
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
| 468 |
): void;
|
| 469 |
-
function resolve6(
|
| 470 |
hostname: string,
|
| 471 |
options: ResolveWithTtlOptions,
|
| 472 |
callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void,
|
| 473 |
): void;
|
| 474 |
-
function resolve6(
|
| 475 |
hostname: string,
|
| 476 |
options: ResolveOptions,
|
| 477 |
callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void,
|
| 478 |
): void;
|
| 479 |
-
namespace resolve6 {
|
| 480 |
function __promisify__(hostname: string): Promise<string[]>;
|
| 481 |
function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
|
| 482 |
function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
|
|
@@ -486,11 +470,11 @@ declare module "node:dns" {
|
|
| 486 |
* will contain an array of canonical name records available for the `hostname` (e.g. `['bar.example.com']`).
|
| 487 |
* @since v0.3.2
|
| 488 |
*/
|
| 489 |
-
function resolveCname(
|
| 490 |
hostname: string,
|
| 491 |
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
| 492 |
): void;
|
| 493 |
-
namespace resolveCname {
|
| 494 |
function __promisify__(hostname: string): Promise<string[]>;
|
| 495 |
}
|
| 496 |
/**
|
|
@@ -499,11 +483,11 @@ declare module "node:dns" {
|
|
| 499 |
* available for the `hostname` (e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'}, {critical: 128, issue: 'pki.example.com'}]`).
|
| 500 |
* @since v15.0.0, v14.17.0
|
| 501 |
*/
|
| 502 |
-
function resolveCaa(
|
| 503 |
hostname: string,
|
| 504 |
callback: (err: NodeJS.ErrnoException | null, records: CaaRecord[]) => void,
|
| 505 |
): void;
|
| 506 |
-
namespace resolveCaa {
|
| 507 |
function __promisify__(hostname: string): Promise<CaaRecord[]>;
|
| 508 |
}
|
| 509 |
/**
|
|
@@ -511,11 +495,11 @@ declare module "node:dns" {
|
|
| 511 |
* contain an array of objects containing both a `priority` and `exchange` property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`).
|
| 512 |
* @since v0.1.27
|
| 513 |
*/
|
| 514 |
-
function resolveMx(
|
| 515 |
hostname: string,
|
| 516 |
callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void,
|
| 517 |
): void;
|
| 518 |
-
namespace resolveMx {
|
| 519 |
function __promisify__(hostname: string): Promise<MxRecord[]>;
|
| 520 |
}
|
| 521 |
/**
|
|
@@ -541,11 +525,11 @@ declare module "node:dns" {
|
|
| 541 |
* ```
|
| 542 |
* @since v0.9.12
|
| 543 |
*/
|
| 544 |
-
function resolveNaptr(
|
| 545 |
hostname: string,
|
| 546 |
callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void,
|
| 547 |
): void;
|
| 548 |
-
namespace resolveNaptr {
|
| 549 |
function __promisify__(hostname: string): Promise<NaptrRecord[]>;
|
| 550 |
}
|
| 551 |
/**
|
|
@@ -553,11 +537,11 @@ declare module "node:dns" {
|
|
| 553 |
* contain an array of name server records available for `hostname` (e.g. `['ns1.example.com', 'ns2.example.com']`).
|
| 554 |
* @since v0.1.90
|
| 555 |
*/
|
| 556 |
-
function resolveNs(
|
| 557 |
hostname: string,
|
| 558 |
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
| 559 |
): void;
|
| 560 |
-
namespace resolveNs {
|
| 561 |
function __promisify__(hostname: string): Promise<string[]>;
|
| 562 |
}
|
| 563 |
/**
|
|
@@ -565,11 +549,11 @@ declare module "node:dns" {
|
|
| 565 |
* be an array of strings containing the reply records.
|
| 566 |
* @since v6.0.0
|
| 567 |
*/
|
| 568 |
-
function resolvePtr(
|
| 569 |
hostname: string,
|
| 570 |
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
| 571 |
): void;
|
| 572 |
-
namespace resolvePtr {
|
| 573 |
function __promisify__(hostname: string): Promise<string[]>;
|
| 574 |
}
|
| 575 |
/**
|
|
@@ -598,11 +582,11 @@ declare module "node:dns" {
|
|
| 598 |
* ```
|
| 599 |
* @since v0.11.10
|
| 600 |
*/
|
| 601 |
-
function resolveSoa(
|
| 602 |
hostname: string,
|
| 603 |
callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void,
|
| 604 |
): void;
|
| 605 |
-
namespace resolveSoa {
|
| 606 |
function __promisify__(hostname: string): Promise<SoaRecord>;
|
| 607 |
}
|
| 608 |
/**
|
|
@@ -624,40 +608,13 @@ declare module "node:dns" {
|
|
| 624 |
* ```
|
| 625 |
* @since v0.1.27
|
| 626 |
*/
|
| 627 |
-
function resolveSrv(
|
| 628 |
hostname: string,
|
| 629 |
callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void,
|
| 630 |
): void;
|
| 631 |
-
namespace resolveSrv {
|
| 632 |
function __promisify__(hostname: string): Promise<SrvRecord[]>;
|
| 633 |
}
|
| 634 |
-
/**
|
| 635 |
-
* Uses the DNS protocol to resolve certificate associations (`TLSA` records) for
|
| 636 |
-
* the `hostname`. The `records` argument passed to the `callback` function is an
|
| 637 |
-
* array of objects with these properties:
|
| 638 |
-
*
|
| 639 |
-
* * `certUsage`
|
| 640 |
-
* * `selector`
|
| 641 |
-
* * `match`
|
| 642 |
-
* * `data`
|
| 643 |
-
*
|
| 644 |
-
* ```js
|
| 645 |
-
* {
|
| 646 |
-
* certUsage: 3,
|
| 647 |
-
* selector: 1,
|
| 648 |
-
* match: 1,
|
| 649 |
-
* data: [ArrayBuffer]
|
| 650 |
-
* }
|
| 651 |
-
* ```
|
| 652 |
-
* @since v23.9.0, v22.15.0
|
| 653 |
-
*/
|
| 654 |
-
function resolveTlsa(
|
| 655 |
-
hostname: string,
|
| 656 |
-
callback: (err: NodeJS.ErrnoException | null, addresses: TlsaRecord[]) => void,
|
| 657 |
-
): void;
|
| 658 |
-
namespace resolveTlsa {
|
| 659 |
-
function __promisify__(hostname: string): Promise<TlsaRecord[]>;
|
| 660 |
-
}
|
| 661 |
/**
|
| 662 |
* Uses the DNS protocol to resolve text queries (`TXT` records) for the `hostname`. The `records` argument passed to the `callback` function is a
|
| 663 |
* two-dimensional array of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of
|
|
@@ -665,11 +622,11 @@ declare module "node:dns" {
|
|
| 665 |
* treated separately.
|
| 666 |
* @since v0.1.27
|
| 667 |
*/
|
| 668 |
-
function resolveTxt(
|
| 669 |
hostname: string,
|
| 670 |
callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void,
|
| 671 |
): void;
|
| 672 |
-
namespace resolveTxt {
|
| 673 |
function __promisify__(hostname: string): Promise<string[][]>;
|
| 674 |
}
|
| 675 |
/**
|
|
@@ -702,27 +659,27 @@ declare module "node:dns" {
|
|
| 702 |
* DNS server operators may choose not to respond to `ANY` queries. It may be better to call individual methods like {@link resolve4}, {@link resolveMx}, and so on. For more details, see
|
| 703 |
* [RFC 8482](https://tools.ietf.org/html/rfc8482).
|
| 704 |
*/
|
| 705 |
-
function resolveAny(
|
| 706 |
hostname: string,
|
| 707 |
callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void,
|
| 708 |
): void;
|
| 709 |
-
namespace resolveAny {
|
| 710 |
function __promisify__(hostname: string): Promise<AnyRecord[]>;
|
| 711 |
}
|
| 712 |
/**
|
| 713 |
* Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an
|
| 714 |
* array of host names.
|
| 715 |
*
|
| 716 |
-
* On error, `err` is an [`Error`](https://nodejs.org/docs/latest-
|
| 717 |
-
* one of the [DNS error codes](https://nodejs.org/docs/latest-
|
| 718 |
* @since v0.1.16
|
| 719 |
*/
|
| 720 |
-
function reverse(
|
| 721 |
ip: string,
|
| 722 |
callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void,
|
| 723 |
): void;
|
| 724 |
/**
|
| 725 |
-
* Get the default value for `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-
|
| 726 |
* The value could be:
|
| 727 |
*
|
| 728 |
* * `ipv4first`: for `order` defaulting to `ipv4first`.
|
|
@@ -730,7 +687,7 @@ declare module "node:dns" {
|
|
| 730 |
* * `verbatim`: for `order` defaulting to `verbatim`.
|
| 731 |
* @since v18.17.0
|
| 732 |
*/
|
| 733 |
-
function getDefaultResultOrder(): "ipv4first" | "ipv6first" | "verbatim";
|
| 734 |
/**
|
| 735 |
* Sets the IP address and port of servers to be used when performing DNS
|
| 736 |
* resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted
|
|
@@ -759,7 +716,7 @@ declare module "node:dns" {
|
|
| 759 |
* @since v0.11.3
|
| 760 |
* @param servers array of [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952#section-6) formatted addresses
|
| 761 |
*/
|
| 762 |
-
function setServers(servers: readonly string[]): void;
|
| 763 |
/**
|
| 764 |
* Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6),
|
| 765 |
* that are currently configured for DNS resolution. A string will include a port
|
|
@@ -775,9 +732,9 @@ declare module "node:dns" {
|
|
| 775 |
* ```
|
| 776 |
* @since v0.11.3
|
| 777 |
*/
|
| 778 |
-
function getServers(): string[];
|
| 779 |
/**
|
| 780 |
-
* Set the default value of `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-
|
| 781 |
* The value could be:
|
| 782 |
*
|
| 783 |
* * `ipv4first`: sets default `order` to `ipv4first`.
|
|
@@ -785,39 +742,39 @@ declare module "node:dns" {
|
|
| 785 |
* * `verbatim`: sets default `order` to `verbatim`.
|
| 786 |
*
|
| 787 |
* The default is `verbatim` and {@link setDefaultResultOrder} have higher
|
| 788 |
-
* priority than [`--dns-result-order`](https://nodejs.org/docs/latest-
|
| 789 |
-
* [worker threads](https://nodejs.org/docs/latest-
|
| 790 |
* thread won't affect the default dns orders in workers.
|
| 791 |
* @since v16.4.0, v14.18.0
|
| 792 |
* @param order must be `'ipv4first'`, `'ipv6first'` or `'verbatim'`.
|
| 793 |
*/
|
| 794 |
-
function setDefaultResultOrder(order: "ipv4first" | "ipv6first" | "verbatim"): void;
|
| 795 |
// Error codes
|
| 796 |
-
const NODATA: "ENODATA";
|
| 797 |
-
const FORMERR: "EFORMERR";
|
| 798 |
-
const SERVFAIL: "ESERVFAIL";
|
| 799 |
-
const NOTFOUND: "ENOTFOUND";
|
| 800 |
-
const NOTIMP: "ENOTIMP";
|
| 801 |
-
const REFUSED: "EREFUSED";
|
| 802 |
-
const BADQUERY: "EBADQUERY";
|
| 803 |
-
const BADNAME: "EBADNAME";
|
| 804 |
-
const BADFAMILY: "EBADFAMILY";
|
| 805 |
-
const BADRESP: "EBADRESP";
|
| 806 |
-
const CONNREFUSED: "ECONNREFUSED";
|
| 807 |
-
const TIMEOUT: "ETIMEOUT";
|
| 808 |
-
const EOF: "EOF";
|
| 809 |
-
const FILE: "EFILE";
|
| 810 |
-
const NOMEM: "ENOMEM";
|
| 811 |
-
const DESTRUCTION: "EDESTRUCTION";
|
| 812 |
-
const BADSTR: "EBADSTR";
|
| 813 |
-
const BADFLAGS: "EBADFLAGS";
|
| 814 |
-
const NONAME: "ENONAME";
|
| 815 |
-
const BADHINTS: "EBADHINTS";
|
| 816 |
-
const NOTINITIALIZED: "ENOTINITIALIZED";
|
| 817 |
-
const LOADIPHLPAPI: "ELOADIPHLPAPI";
|
| 818 |
-
const ADDRGETNETWORKPARAMS: "EADDRGETNETWORKPARAMS";
|
| 819 |
-
const CANCELLED: "ECANCELLED";
|
| 820 |
-
interface ResolverOptions {
|
| 821 |
/**
|
| 822 |
* Query timeout in milliseconds, or `-1` to use the default timeout.
|
| 823 |
*/
|
|
@@ -827,17 +784,12 @@ declare module "node:dns" {
|
|
| 827 |
* @default 4
|
| 828 |
*/
|
| 829 |
tries?: number | undefined;
|
| 830 |
-
/**
|
| 831 |
-
* The max retry timeout, in milliseconds.
|
| 832 |
-
* @default 0
|
| 833 |
-
*/
|
| 834 |
-
maxTimeout?: number | undefined;
|
| 835 |
}
|
| 836 |
/**
|
| 837 |
* An independent resolver for DNS requests.
|
| 838 |
*
|
| 839 |
* Creating a new resolver uses the default server settings. Setting
|
| 840 |
-
* the servers used for a resolver using [`resolver.setServers()`](https://nodejs.org/docs/latest-
|
| 841 |
* other resolvers:
|
| 842 |
*
|
| 843 |
* ```js
|
|
@@ -871,7 +823,7 @@ declare module "node:dns" {
|
|
| 871 |
* * `resolver.setServers()`
|
| 872 |
* @since v8.3.0
|
| 873 |
*/
|
| 874 |
-
class Resolver {
|
| 875 |
constructor(options?: ResolverOptions);
|
| 876 |
/**
|
| 877 |
* Cancel all outstanding DNS queries made by this resolver. The corresponding
|
|
@@ -892,7 +844,6 @@ declare module "node:dns" {
|
|
| 892 |
resolvePtr: typeof resolvePtr;
|
| 893 |
resolveSoa: typeof resolveSoa;
|
| 894 |
resolveSrv: typeof resolveSrv;
|
| 895 |
-
resolveTlsa: typeof resolveTlsa;
|
| 896 |
resolveTxt: typeof resolveTxt;
|
| 897 |
reverse: typeof reverse;
|
| 898 |
/**
|
|
@@ -913,10 +864,8 @@ declare module "node:dns" {
|
|
| 913 |
setLocalAddress(ipv4?: string, ipv6?: string): void;
|
| 914 |
setServers: typeof setServers;
|
| 915 |
}
|
|
|
|
| 916 |
}
|
| 917 |
declare module "node:dns" {
|
| 918 |
-
export *
|
| 919 |
-
}
|
| 920 |
-
declare module "dns" {
|
| 921 |
-
export * from "node:dns";
|
| 922 |
}
|
|
|
|
| 41 |
* });
|
| 42 |
* ```
|
| 43 |
*
|
| 44 |
+
* See the [Implementation considerations section](https://nodejs.org/docs/latest-v20.x/api/dns.html#implementation-considerations) for more information.
|
| 45 |
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/dns.js)
|
| 46 |
*/
|
| 47 |
+
declare module "dns" {
|
| 48 |
+
import * as dnsPromises from "node:dns/promises";
|
| 49 |
// Supported getaddrinfo flags.
|
| 50 |
/**
|
| 51 |
* Limits returned address types to the types of non-loopback addresses configured on the system. For example, IPv4 addresses are
|
| 52 |
* only returned if the current system has at least one IPv4 address configured.
|
| 53 |
*/
|
| 54 |
+
export const ADDRCONFIG: number;
|
| 55 |
/**
|
| 56 |
* If the IPv6 family was specified, but no IPv6 addresses were found, then return IPv4 mapped IPv6 addresses. It is not supported
|
| 57 |
* on some operating systems (e.g. FreeBSD 10.1).
|
| 58 |
*/
|
| 59 |
+
export const V4MAPPED: number;
|
| 60 |
/**
|
| 61 |
* If `dns.V4MAPPED` is specified, return resolved IPv6 addresses as
|
| 62 |
* well as IPv4 mapped IPv6 addresses.
|
| 63 |
*/
|
| 64 |
+
export const ALL: number;
|
| 65 |
+
export interface LookupOptions {
|
| 66 |
/**
|
| 67 |
* The record family. Must be `4`, `6`, or `0`. For backward compatibility reasons, `'IPv4'` and `'IPv6'` are interpreted
|
| 68 |
* as `4` and `6` respectively. The value 0 indicates that either an IPv4 or IPv6 address is returned. If the value `0` is used
|
|
|
|
| 71 |
*/
|
| 72 |
family?: number | "IPv4" | "IPv6" | undefined;
|
| 73 |
/**
|
| 74 |
+
* One or more [supported `getaddrinfo`](https://nodejs.org/docs/latest-v20.x/api/dns.html#supported-getaddrinfo-flags) flags. Multiple flags may be
|
| 75 |
* passed by bitwise `OR`ing their values.
|
| 76 |
*/
|
| 77 |
hints?: number | undefined;
|
|
|
|
| 84 |
* When `verbatim`, the resolved addresses are return unsorted. When `ipv4first`, the resolved addresses are sorted
|
| 85 |
* by placing IPv4 addresses before IPv6 addresses. When `ipv6first`, the resolved addresses are sorted by placing IPv6
|
| 86 |
* addresses before IPv4 addresses. Default value is configurable using
|
| 87 |
+
* {@link setDefaultResultOrder} or [`--dns-result-order`](https://nodejs.org/docs/latest-v20.x/api/cli.html#--dns-result-orderorder).
|
| 88 |
* @default `verbatim` (addresses are not reordered)
|
|
|
|
| 89 |
*/
|
| 90 |
order?: "ipv4first" | "ipv6first" | "verbatim" | undefined;
|
| 91 |
/**
|
| 92 |
* When `true`, the callback receives IPv4 and IPv6 addresses in the order the DNS resolver returned them. When `false`, IPv4
|
| 93 |
* addresses are placed before IPv6 addresses. This option will be deprecated in favor of `order`. When both are specified,
|
| 94 |
* `order` has higher precedence. New code should only use `order`. Default value is configurable using {@link setDefaultResultOrder}
|
| 95 |
+
* or [`--dns-result-order`](https://nodejs.org/docs/latest-v20.x/api/cli.html#--dns-result-orderorder).
|
| 96 |
* @default true (addresses are not reordered)
|
|
|
|
| 97 |
*/
|
| 98 |
verbatim?: boolean | undefined;
|
| 99 |
}
|
| 100 |
+
export interface LookupOneOptions extends LookupOptions {
|
| 101 |
all?: false | undefined;
|
| 102 |
}
|
| 103 |
+
export interface LookupAllOptions extends LookupOptions {
|
| 104 |
all: true;
|
| 105 |
}
|
| 106 |
+
export interface LookupAddress {
|
| 107 |
/**
|
| 108 |
* A string representation of an IPv4 or IPv6 address.
|
| 109 |
*/
|
|
|
|
| 132 |
* The implementation uses an operating system facility that can associate names
|
| 133 |
* with addresses and vice versa. This implementation can have subtle but
|
| 134 |
* important consequences on the behavior of any Node.js program. Please take some
|
| 135 |
+
* time to consult the [Implementation considerations section](https://nodejs.org/docs/latest-v20.x/api/dns.html#implementation-considerations)
|
| 136 |
* before using `dns.lookup()`.
|
| 137 |
*
|
| 138 |
* Example usage:
|
|
|
|
| 154 |
* // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}]
|
| 155 |
* ```
|
| 156 |
*
|
| 157 |
+
* If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v20.x/api/util.html#utilpromisifyoriginal) ed
|
| 158 |
* version, and `all` is not set to `true`, it returns a `Promise` for an `Object` with `address` and `family` properties.
|
| 159 |
* @since v0.1.90
|
| 160 |
*/
|
| 161 |
+
export function lookup(
|
| 162 |
hostname: string,
|
| 163 |
family: number,
|
| 164 |
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
|
| 165 |
): void;
|
| 166 |
+
export function lookup(
|
| 167 |
hostname: string,
|
| 168 |
options: LookupOneOptions,
|
| 169 |
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
|
| 170 |
): void;
|
| 171 |
+
export function lookup(
|
| 172 |
hostname: string,
|
| 173 |
options: LookupAllOptions,
|
| 174 |
callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void,
|
| 175 |
): void;
|
| 176 |
+
export function lookup(
|
| 177 |
hostname: string,
|
| 178 |
options: LookupOptions,
|
| 179 |
callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void,
|
| 180 |
): void;
|
| 181 |
+
export function lookup(
|
| 182 |
hostname: string,
|
| 183 |
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
|
| 184 |
): void;
|
| 185 |
+
export namespace lookup {
|
| 186 |
function __promisify__(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
|
| 187 |
function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise<LookupAddress>;
|
| 188 |
function __promisify__(hostname: string, options: LookupOptions): Promise<LookupAddress | LookupAddress[]>;
|
|
|
|
| 194 |
* If `address` is not a valid IP address, a `TypeError` will be thrown.
|
| 195 |
* The `port` will be coerced to a number. If it is not a legal port, a `TypeError` will be thrown.
|
| 196 |
*
|
| 197 |
+
* On an error, `err` is an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object,
|
| 198 |
* where `err.code` is the error code.
|
| 199 |
*
|
| 200 |
* ```js
|
|
|
|
| 205 |
* });
|
| 206 |
* ```
|
| 207 |
*
|
| 208 |
+
* If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v20.x/api/util.html#utilpromisifyoriginal) ed
|
| 209 |
* version, it returns a `Promise` for an `Object` with `hostname` and `service` properties.
|
| 210 |
* @since v0.11.14
|
| 211 |
*/
|
| 212 |
+
export function lookupService(
|
| 213 |
address: string,
|
| 214 |
port: number,
|
| 215 |
callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void,
|
| 216 |
): void;
|
| 217 |
+
export namespace lookupService {
|
| 218 |
function __promisify__(
|
| 219 |
address: string,
|
| 220 |
port: number,
|
|
|
|
| 223 |
service: string;
|
| 224 |
}>;
|
| 225 |
}
|
| 226 |
+
export interface ResolveOptions {
|
| 227 |
ttl: boolean;
|
| 228 |
}
|
| 229 |
+
export interface ResolveWithTtlOptions extends ResolveOptions {
|
| 230 |
ttl: true;
|
| 231 |
}
|
| 232 |
+
export interface RecordWithTtl {
|
| 233 |
address: string;
|
| 234 |
ttl: number;
|
| 235 |
}
|
| 236 |
+
/** @deprecated Use `AnyARecord` or `AnyAaaaRecord` instead. */
|
| 237 |
+
export type AnyRecordWithTtl = AnyARecord | AnyAaaaRecord;
|
| 238 |
+
export interface AnyARecord extends RecordWithTtl {
|
| 239 |
type: "A";
|
| 240 |
}
|
| 241 |
+
export interface AnyAaaaRecord extends RecordWithTtl {
|
| 242 |
type: "AAAA";
|
| 243 |
}
|
| 244 |
+
export interface CaaRecord {
|
| 245 |
critical: number;
|
| 246 |
issue?: string | undefined;
|
| 247 |
issuewild?: string | undefined;
|
|
|
|
| 249 |
contactemail?: string | undefined;
|
| 250 |
contactphone?: string | undefined;
|
| 251 |
}
|
| 252 |
+
export interface AnyCaaRecord extends CaaRecord {
|
| 253 |
type: "CAA";
|
| 254 |
}
|
| 255 |
+
export interface MxRecord {
|
| 256 |
priority: number;
|
| 257 |
exchange: string;
|
| 258 |
}
|
| 259 |
+
export interface AnyMxRecord extends MxRecord {
|
| 260 |
type: "MX";
|
| 261 |
}
|
| 262 |
+
export interface NaptrRecord {
|
| 263 |
flags: string;
|
| 264 |
service: string;
|
| 265 |
regexp: string;
|
|
|
|
| 267 |
order: number;
|
| 268 |
preference: number;
|
| 269 |
}
|
| 270 |
+
export interface AnyNaptrRecord extends NaptrRecord {
|
| 271 |
type: "NAPTR";
|
| 272 |
}
|
| 273 |
+
export interface SoaRecord {
|
| 274 |
nsname: string;
|
| 275 |
hostmaster: string;
|
| 276 |
serial: number;
|
|
|
|
| 279 |
expire: number;
|
| 280 |
minttl: number;
|
| 281 |
}
|
| 282 |
+
export interface AnySoaRecord extends SoaRecord {
|
| 283 |
type: "SOA";
|
| 284 |
}
|
| 285 |
+
export interface SrvRecord {
|
| 286 |
priority: number;
|
| 287 |
weight: number;
|
| 288 |
port: number;
|
| 289 |
name: string;
|
| 290 |
}
|
| 291 |
+
export interface AnySrvRecord extends SrvRecord {
|
| 292 |
type: "SRV";
|
| 293 |
}
|
| 294 |
+
export interface AnyTxtRecord {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 295 |
type: "TXT";
|
| 296 |
entries: string[];
|
| 297 |
}
|
| 298 |
+
export interface AnyNsRecord {
|
| 299 |
type: "NS";
|
| 300 |
value: string;
|
| 301 |
}
|
| 302 |
+
export interface AnyPtrRecord {
|
| 303 |
type: "PTR";
|
| 304 |
value: string;
|
| 305 |
}
|
| 306 |
+
export interface AnyCnameRecord {
|
| 307 |
type: "CNAME";
|
| 308 |
value: string;
|
| 309 |
}
|
| 310 |
+
export type AnyRecord =
|
| 311 |
| AnyARecord
|
| 312 |
| AnyAaaaRecord
|
| 313 |
| AnyCaaRecord
|
|
|
|
| 318 |
| AnyPtrRecord
|
| 319 |
| AnySoaRecord
|
| 320 |
| AnySrvRecord
|
|
|
|
| 321 |
| AnyTxtRecord;
|
| 322 |
/**
|
| 323 |
* Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array
|
|
|
|
| 326 |
*
|
| 327 |
* <omitted>
|
| 328 |
*
|
| 329 |
+
* On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object,
|
| 330 |
* where `err.code` is one of the `DNS error codes`.
|
| 331 |
* @since v0.1.27
|
| 332 |
* @param hostname Host name to resolve.
|
| 333 |
* @param [rrtype='A'] Resource record type.
|
| 334 |
*/
|
| 335 |
+
export function resolve(
|
| 336 |
hostname: string,
|
| 337 |
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
| 338 |
): void;
|
| 339 |
+
export function resolve(
|
| 340 |
hostname: string,
|
| 341 |
rrtype: "A" | "AAAA" | "CNAME" | "NS" | "PTR",
|
| 342 |
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
| 343 |
): void;
|
| 344 |
+
export function resolve(
|
| 345 |
hostname: string,
|
| 346 |
rrtype: "ANY",
|
| 347 |
callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void,
|
| 348 |
): void;
|
| 349 |
+
export function resolve(
|
| 350 |
hostname: string,
|
| 351 |
rrtype: "CAA",
|
| 352 |
callback: (err: NodeJS.ErrnoException | null, address: CaaRecord[]) => void,
|
| 353 |
): void;
|
| 354 |
+
export function resolve(
|
| 355 |
hostname: string,
|
| 356 |
rrtype: "MX",
|
| 357 |
callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void,
|
| 358 |
): void;
|
| 359 |
+
export function resolve(
|
| 360 |
hostname: string,
|
| 361 |
rrtype: "NAPTR",
|
| 362 |
callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void,
|
| 363 |
): void;
|
| 364 |
+
export function resolve(
|
| 365 |
hostname: string,
|
| 366 |
rrtype: "SOA",
|
| 367 |
callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void,
|
| 368 |
): void;
|
| 369 |
+
export function resolve(
|
| 370 |
hostname: string,
|
| 371 |
rrtype: "SRV",
|
| 372 |
callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void,
|
| 373 |
): void;
|
| 374 |
+
export function resolve(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 375 |
hostname: string,
|
| 376 |
rrtype: "TXT",
|
| 377 |
callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void,
|
| 378 |
): void;
|
| 379 |
+
export function resolve(
|
| 380 |
hostname: string,
|
| 381 |
rrtype: string,
|
| 382 |
callback: (
|
|
|
|
| 388 |
| NaptrRecord[]
|
| 389 |
| SoaRecord
|
| 390 |
| SrvRecord[]
|
|
|
|
| 391 |
| string[][]
|
| 392 |
| AnyRecord[],
|
| 393 |
) => void,
|
| 394 |
): void;
|
| 395 |
+
export namespace resolve {
|
| 396 |
function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise<string[]>;
|
| 397 |
function __promisify__(hostname: string, rrtype: "ANY"): Promise<AnyRecord[]>;
|
| 398 |
function __promisify__(hostname: string, rrtype: "CAA"): Promise<CaaRecord[]>;
|
|
|
|
| 400 |
function __promisify__(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
|
| 401 |
function __promisify__(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
|
| 402 |
function __promisify__(hostname: string, rrtype: "SRV"): Promise<SrvRecord[]>;
|
|
|
|
| 403 |
function __promisify__(hostname: string, rrtype: "TXT"): Promise<string[][]>;
|
| 404 |
function __promisify__(
|
| 405 |
hostname: string,
|
|
|
|
| 411 |
| NaptrRecord[]
|
| 412 |
| SoaRecord
|
| 413 |
| SrvRecord[]
|
|
|
|
| 414 |
| string[][]
|
| 415 |
| AnyRecord[]
|
| 416 |
>;
|
|
|
|
| 421 |
* @since v0.1.16
|
| 422 |
* @param hostname Host name to resolve.
|
| 423 |
*/
|
| 424 |
+
export function resolve4(
|
| 425 |
hostname: string,
|
| 426 |
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
| 427 |
): void;
|
| 428 |
+
export function resolve4(
|
| 429 |
hostname: string,
|
| 430 |
options: ResolveWithTtlOptions,
|
| 431 |
callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void,
|
| 432 |
): void;
|
| 433 |
+
export function resolve4(
|
| 434 |
hostname: string,
|
| 435 |
options: ResolveOptions,
|
| 436 |
callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void,
|
| 437 |
): void;
|
| 438 |
+
export namespace resolve4 {
|
| 439 |
function __promisify__(hostname: string): Promise<string[]>;
|
| 440 |
function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
|
| 441 |
function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
|
|
|
|
| 446 |
* @since v0.1.16
|
| 447 |
* @param hostname Host name to resolve.
|
| 448 |
*/
|
| 449 |
+
export function resolve6(
|
| 450 |
hostname: string,
|
| 451 |
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
| 452 |
): void;
|
| 453 |
+
export function resolve6(
|
| 454 |
hostname: string,
|
| 455 |
options: ResolveWithTtlOptions,
|
| 456 |
callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void,
|
| 457 |
): void;
|
| 458 |
+
export function resolve6(
|
| 459 |
hostname: string,
|
| 460 |
options: ResolveOptions,
|
| 461 |
callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void,
|
| 462 |
): void;
|
| 463 |
+
export namespace resolve6 {
|
| 464 |
function __promisify__(hostname: string): Promise<string[]>;
|
| 465 |
function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
|
| 466 |
function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
|
|
|
|
| 470 |
* will contain an array of canonical name records available for the `hostname` (e.g. `['bar.example.com']`).
|
| 471 |
* @since v0.3.2
|
| 472 |
*/
|
| 473 |
+
export function resolveCname(
|
| 474 |
hostname: string,
|
| 475 |
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
| 476 |
): void;
|
| 477 |
+
export namespace resolveCname {
|
| 478 |
function __promisify__(hostname: string): Promise<string[]>;
|
| 479 |
}
|
| 480 |
/**
|
|
|
|
| 483 |
* available for the `hostname` (e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'}, {critical: 128, issue: 'pki.example.com'}]`).
|
| 484 |
* @since v15.0.0, v14.17.0
|
| 485 |
*/
|
| 486 |
+
export function resolveCaa(
|
| 487 |
hostname: string,
|
| 488 |
callback: (err: NodeJS.ErrnoException | null, records: CaaRecord[]) => void,
|
| 489 |
): void;
|
| 490 |
+
export namespace resolveCaa {
|
| 491 |
function __promisify__(hostname: string): Promise<CaaRecord[]>;
|
| 492 |
}
|
| 493 |
/**
|
|
|
|
| 495 |
* contain an array of objects containing both a `priority` and `exchange` property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`).
|
| 496 |
* @since v0.1.27
|
| 497 |
*/
|
| 498 |
+
export function resolveMx(
|
| 499 |
hostname: string,
|
| 500 |
callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void,
|
| 501 |
): void;
|
| 502 |
+
export namespace resolveMx {
|
| 503 |
function __promisify__(hostname: string): Promise<MxRecord[]>;
|
| 504 |
}
|
| 505 |
/**
|
|
|
|
| 525 |
* ```
|
| 526 |
* @since v0.9.12
|
| 527 |
*/
|
| 528 |
+
export function resolveNaptr(
|
| 529 |
hostname: string,
|
| 530 |
callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void,
|
| 531 |
): void;
|
| 532 |
+
export namespace resolveNaptr {
|
| 533 |
function __promisify__(hostname: string): Promise<NaptrRecord[]>;
|
| 534 |
}
|
| 535 |
/**
|
|
|
|
| 537 |
* contain an array of name server records available for `hostname` (e.g. `['ns1.example.com', 'ns2.example.com']`).
|
| 538 |
* @since v0.1.90
|
| 539 |
*/
|
| 540 |
+
export function resolveNs(
|
| 541 |
hostname: string,
|
| 542 |
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
| 543 |
): void;
|
| 544 |
+
export namespace resolveNs {
|
| 545 |
function __promisify__(hostname: string): Promise<string[]>;
|
| 546 |
}
|
| 547 |
/**
|
|
|
|
| 549 |
* be an array of strings containing the reply records.
|
| 550 |
* @since v6.0.0
|
| 551 |
*/
|
| 552 |
+
export function resolvePtr(
|
| 553 |
hostname: string,
|
| 554 |
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
| 555 |
): void;
|
| 556 |
+
export namespace resolvePtr {
|
| 557 |
function __promisify__(hostname: string): Promise<string[]>;
|
| 558 |
}
|
| 559 |
/**
|
|
|
|
| 582 |
* ```
|
| 583 |
* @since v0.11.10
|
| 584 |
*/
|
| 585 |
+
export function resolveSoa(
|
| 586 |
hostname: string,
|
| 587 |
callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void,
|
| 588 |
): void;
|
| 589 |
+
export namespace resolveSoa {
|
| 590 |
function __promisify__(hostname: string): Promise<SoaRecord>;
|
| 591 |
}
|
| 592 |
/**
|
|
|
|
| 608 |
* ```
|
| 609 |
* @since v0.1.27
|
| 610 |
*/
|
| 611 |
+
export function resolveSrv(
|
| 612 |
hostname: string,
|
| 613 |
callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void,
|
| 614 |
): void;
|
| 615 |
+
export namespace resolveSrv {
|
| 616 |
function __promisify__(hostname: string): Promise<SrvRecord[]>;
|
| 617 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 618 |
/**
|
| 619 |
* Uses the DNS protocol to resolve text queries (`TXT` records) for the `hostname`. The `records` argument passed to the `callback` function is a
|
| 620 |
* two-dimensional array of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of
|
|
|
|
| 622 |
* treated separately.
|
| 623 |
* @since v0.1.27
|
| 624 |
*/
|
| 625 |
+
export function resolveTxt(
|
| 626 |
hostname: string,
|
| 627 |
callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void,
|
| 628 |
): void;
|
| 629 |
+
export namespace resolveTxt {
|
| 630 |
function __promisify__(hostname: string): Promise<string[][]>;
|
| 631 |
}
|
| 632 |
/**
|
|
|
|
| 659 |
* DNS server operators may choose not to respond to `ANY` queries. It may be better to call individual methods like {@link resolve4}, {@link resolveMx}, and so on. For more details, see
|
| 660 |
* [RFC 8482](https://tools.ietf.org/html/rfc8482).
|
| 661 |
*/
|
| 662 |
+
export function resolveAny(
|
| 663 |
hostname: string,
|
| 664 |
callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void,
|
| 665 |
): void;
|
| 666 |
+
export namespace resolveAny {
|
| 667 |
function __promisify__(hostname: string): Promise<AnyRecord[]>;
|
| 668 |
}
|
| 669 |
/**
|
| 670 |
* Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an
|
| 671 |
* array of host names.
|
| 672 |
*
|
| 673 |
+
* On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object, where `err.code` is
|
| 674 |
+
* one of the [DNS error codes](https://nodejs.org/docs/latest-v20.x/api/dns.html#error-codes).
|
| 675 |
* @since v0.1.16
|
| 676 |
*/
|
| 677 |
+
export function reverse(
|
| 678 |
ip: string,
|
| 679 |
callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void,
|
| 680 |
): void;
|
| 681 |
/**
|
| 682 |
+
* Get the default value for `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromiseslookuphostname-options).
|
| 683 |
* The value could be:
|
| 684 |
*
|
| 685 |
* * `ipv4first`: for `order` defaulting to `ipv4first`.
|
|
|
|
| 687 |
* * `verbatim`: for `order` defaulting to `verbatim`.
|
| 688 |
* @since v18.17.0
|
| 689 |
*/
|
| 690 |
+
export function getDefaultResultOrder(): "ipv4first" | "ipv6first" | "verbatim";
|
| 691 |
/**
|
| 692 |
* Sets the IP address and port of servers to be used when performing DNS
|
| 693 |
* resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted
|
|
|
|
| 716 |
* @since v0.11.3
|
| 717 |
* @param servers array of [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952#section-6) formatted addresses
|
| 718 |
*/
|
| 719 |
+
export function setServers(servers: readonly string[]): void;
|
| 720 |
/**
|
| 721 |
* Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6),
|
| 722 |
* that are currently configured for DNS resolution. A string will include a port
|
|
|
|
| 732 |
* ```
|
| 733 |
* @since v0.11.3
|
| 734 |
*/
|
| 735 |
+
export function getServers(): string[];
|
| 736 |
/**
|
| 737 |
+
* Set the default value of `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromiseslookuphostname-options).
|
| 738 |
* The value could be:
|
| 739 |
*
|
| 740 |
* * `ipv4first`: sets default `order` to `ipv4first`.
|
|
|
|
| 742 |
* * `verbatim`: sets default `order` to `verbatim`.
|
| 743 |
*
|
| 744 |
* The default is `verbatim` and {@link setDefaultResultOrder} have higher
|
| 745 |
+
* priority than [`--dns-result-order`](https://nodejs.org/docs/latest-v20.x/api/cli.html#--dns-result-orderorder). When using
|
| 746 |
+
* [worker threads](https://nodejs.org/docs/latest-v20.x/api/worker_threads.html), {@link setDefaultResultOrder} from the main
|
| 747 |
* thread won't affect the default dns orders in workers.
|
| 748 |
* @since v16.4.0, v14.18.0
|
| 749 |
* @param order must be `'ipv4first'`, `'ipv6first'` or `'verbatim'`.
|
| 750 |
*/
|
| 751 |
+
export function setDefaultResultOrder(order: "ipv4first" | "ipv6first" | "verbatim"): void;
|
| 752 |
// Error codes
|
| 753 |
+
export const NODATA: "ENODATA";
|
| 754 |
+
export const FORMERR: "EFORMERR";
|
| 755 |
+
export const SERVFAIL: "ESERVFAIL";
|
| 756 |
+
export const NOTFOUND: "ENOTFOUND";
|
| 757 |
+
export const NOTIMP: "ENOTIMP";
|
| 758 |
+
export const REFUSED: "EREFUSED";
|
| 759 |
+
export const BADQUERY: "EBADQUERY";
|
| 760 |
+
export const BADNAME: "EBADNAME";
|
| 761 |
+
export const BADFAMILY: "EBADFAMILY";
|
| 762 |
+
export const BADRESP: "EBADRESP";
|
| 763 |
+
export const CONNREFUSED: "ECONNREFUSED";
|
| 764 |
+
export const TIMEOUT: "ETIMEOUT";
|
| 765 |
+
export const EOF: "EOF";
|
| 766 |
+
export const FILE: "EFILE";
|
| 767 |
+
export const NOMEM: "ENOMEM";
|
| 768 |
+
export const DESTRUCTION: "EDESTRUCTION";
|
| 769 |
+
export const BADSTR: "EBADSTR";
|
| 770 |
+
export const BADFLAGS: "EBADFLAGS";
|
| 771 |
+
export const NONAME: "ENONAME";
|
| 772 |
+
export const BADHINTS: "EBADHINTS";
|
| 773 |
+
export const NOTINITIALIZED: "ENOTINITIALIZED";
|
| 774 |
+
export const LOADIPHLPAPI: "ELOADIPHLPAPI";
|
| 775 |
+
export const ADDRGETNETWORKPARAMS: "EADDRGETNETWORKPARAMS";
|
| 776 |
+
export const CANCELLED: "ECANCELLED";
|
| 777 |
+
export interface ResolverOptions {
|
| 778 |
/**
|
| 779 |
* Query timeout in milliseconds, or `-1` to use the default timeout.
|
| 780 |
*/
|
|
|
|
| 784 |
* @default 4
|
| 785 |
*/
|
| 786 |
tries?: number | undefined;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 787 |
}
|
| 788 |
/**
|
| 789 |
* An independent resolver for DNS requests.
|
| 790 |
*
|
| 791 |
* Creating a new resolver uses the default server settings. Setting
|
| 792 |
+
* the servers used for a resolver using [`resolver.setServers()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnssetserversservers) does not affect
|
| 793 |
* other resolvers:
|
| 794 |
*
|
| 795 |
* ```js
|
|
|
|
| 823 |
* * `resolver.setServers()`
|
| 824 |
* @since v8.3.0
|
| 825 |
*/
|
| 826 |
+
export class Resolver {
|
| 827 |
constructor(options?: ResolverOptions);
|
| 828 |
/**
|
| 829 |
* Cancel all outstanding DNS queries made by this resolver. The corresponding
|
|
|
|
| 844 |
resolvePtr: typeof resolvePtr;
|
| 845 |
resolveSoa: typeof resolveSoa;
|
| 846 |
resolveSrv: typeof resolveSrv;
|
|
|
|
| 847 |
resolveTxt: typeof resolveTxt;
|
| 848 |
reverse: typeof reverse;
|
| 849 |
/**
|
|
|
|
| 864 |
setLocalAddress(ipv4?: string, ipv6?: string): void;
|
| 865 |
setServers: typeof setServers;
|
| 866 |
}
|
| 867 |
+
export { dnsPromises as promises };
|
| 868 |
}
|
| 869 |
declare module "node:dns" {
|
| 870 |
+
export * from "dns";
|
|
|
|
|
|
|
|
|
|
| 871 |
}
|
node_modules/@types/node/dns/promises.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
/**
|
| 2 |
* The `dns.promises` API provides an alternative set of asynchronous DNS methods
|
| 3 |
* that return `Promise` objects rather than using callbacks. The API is accessible
|
| 4 |
-
* via `import { promises
|
| 5 |
* @since v10.6.0
|
| 6 |
*/
|
| 7 |
-
declare module "
|
| 8 |
import {
|
| 9 |
AnyRecord,
|
| 10 |
CaaRecord,
|
|
@@ -20,7 +20,6 @@ declare module "node:dns/promises" {
|
|
| 20 |
ResolveWithTtlOptions,
|
| 21 |
SoaRecord,
|
| 22 |
SrvRecord,
|
| 23 |
-
TlsaRecord,
|
| 24 |
} from "node:dns";
|
| 25 |
/**
|
| 26 |
* Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6),
|
|
@@ -97,8 +96,8 @@ declare module "node:dns/promises" {
|
|
| 97 |
* On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object, where `err.code` is the error code.
|
| 98 |
*
|
| 99 |
* ```js
|
| 100 |
-
* import
|
| 101 |
-
*
|
| 102 |
* console.log(result.hostname, result.service);
|
| 103 |
* // Prints: localhost ssh
|
| 104 |
* });
|
|
@@ -134,7 +133,6 @@ declare module "node:dns/promises" {
|
|
| 134 |
function resolve(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
|
| 135 |
function resolve(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
|
| 136 |
function resolve(hostname: string, rrtype: "SRV"): Promise<SrvRecord[]>;
|
| 137 |
-
function resolve(hostname: string, rrtype: "TLSA"): Promise<TlsaRecord[]>;
|
| 138 |
function resolve(hostname: string, rrtype: "TXT"): Promise<string[][]>;
|
| 139 |
function resolve(hostname: string, rrtype: string): Promise<
|
| 140 |
| string[]
|
|
@@ -143,7 +141,6 @@ declare module "node:dns/promises" {
|
|
| 143 |
| NaptrRecord[]
|
| 144 |
| SoaRecord
|
| 145 |
| SrvRecord[]
|
| 146 |
-
| TlsaRecord[]
|
| 147 |
| string[][]
|
| 148 |
| AnyRecord[]
|
| 149 |
>;
|
|
@@ -297,27 +294,6 @@ declare module "node:dns/promises" {
|
|
| 297 |
* @since v10.6.0
|
| 298 |
*/
|
| 299 |
function resolveSrv(hostname: string): Promise<SrvRecord[]>;
|
| 300 |
-
/**
|
| 301 |
-
* Uses the DNS protocol to resolve certificate associations (`TLSA` records) for
|
| 302 |
-
* the `hostname`. On success, the `Promise` is resolved with an array of objectsAdd commentMore actions
|
| 303 |
-
* with these properties:
|
| 304 |
-
*
|
| 305 |
-
* * `certUsage`
|
| 306 |
-
* * `selector`
|
| 307 |
-
* * `match`
|
| 308 |
-
* * `data`
|
| 309 |
-
*
|
| 310 |
-
* ```js
|
| 311 |
-
* {
|
| 312 |
-
* certUsage: 3,
|
| 313 |
-
* selector: 1,
|
| 314 |
-
* match: 1,
|
| 315 |
-
* data: [ArrayBuffer]
|
| 316 |
-
* }
|
| 317 |
-
* ```
|
| 318 |
-
* @since v23.9.0, v22.15.0
|
| 319 |
-
*/
|
| 320 |
-
function resolveTlsa(hostname: string): Promise<TlsaRecord[]>;
|
| 321 |
/**
|
| 322 |
* Uses the DNS protocol to resolve text queries (`TXT` records) for the `hostname`. On success, the `Promise` is resolved with a two-dimensional array
|
| 323 |
* of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of
|
|
@@ -420,8 +396,9 @@ declare module "node:dns/promises" {
|
|
| 420 |
* other resolvers:
|
| 421 |
*
|
| 422 |
* ```js
|
| 423 |
-
* import
|
| 424 |
-
* const
|
|
|
|
| 425 |
* resolver.setServers(['4.4.4.4']);
|
| 426 |
*
|
| 427 |
* // This request will use the server at 4.4.4.4, independent of global settings.
|
|
@@ -476,7 +453,6 @@ declare module "node:dns/promises" {
|
|
| 476 |
resolvePtr: typeof resolvePtr;
|
| 477 |
resolveSoa: typeof resolveSoa;
|
| 478 |
resolveSrv: typeof resolveSrv;
|
| 479 |
-
resolveTlsa: typeof resolveTlsa;
|
| 480 |
resolveTxt: typeof resolveTxt;
|
| 481 |
reverse: typeof reverse;
|
| 482 |
/**
|
|
@@ -498,6 +474,6 @@ declare module "node:dns/promises" {
|
|
| 498 |
setServers: typeof setServers;
|
| 499 |
}
|
| 500 |
}
|
| 501 |
-
declare module "dns/promises" {
|
| 502 |
-
export * from "
|
| 503 |
}
|
|
|
|
| 1 |
/**
|
| 2 |
* The `dns.promises` API provides an alternative set of asynchronous DNS methods
|
| 3 |
* that return `Promise` objects rather than using callbacks. The API is accessible
|
| 4 |
+
* via `import { promises } from 'node:dns'` or `import dnsPromises from 'node:dns/promises'`.
|
| 5 |
* @since v10.6.0
|
| 6 |
*/
|
| 7 |
+
declare module "dns/promises" {
|
| 8 |
import {
|
| 9 |
AnyRecord,
|
| 10 |
CaaRecord,
|
|
|
|
| 20 |
ResolveWithTtlOptions,
|
| 21 |
SoaRecord,
|
| 22 |
SrvRecord,
|
|
|
|
| 23 |
} from "node:dns";
|
| 24 |
/**
|
| 25 |
* Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6),
|
|
|
|
| 96 |
* On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object, where `err.code` is the error code.
|
| 97 |
*
|
| 98 |
* ```js
|
| 99 |
+
* import dns from 'node:dns';
|
| 100 |
+
* dns.promises.lookupService('127.0.0.1', 22).then((result) => {
|
| 101 |
* console.log(result.hostname, result.service);
|
| 102 |
* // Prints: localhost ssh
|
| 103 |
* });
|
|
|
|
| 133 |
function resolve(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
|
| 134 |
function resolve(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
|
| 135 |
function resolve(hostname: string, rrtype: "SRV"): Promise<SrvRecord[]>;
|
|
|
|
| 136 |
function resolve(hostname: string, rrtype: "TXT"): Promise<string[][]>;
|
| 137 |
function resolve(hostname: string, rrtype: string): Promise<
|
| 138 |
| string[]
|
|
|
|
| 141 |
| NaptrRecord[]
|
| 142 |
| SoaRecord
|
| 143 |
| SrvRecord[]
|
|
|
|
| 144 |
| string[][]
|
| 145 |
| AnyRecord[]
|
| 146 |
>;
|
|
|
|
| 294 |
* @since v10.6.0
|
| 295 |
*/
|
| 296 |
function resolveSrv(hostname: string): Promise<SrvRecord[]>;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 297 |
/**
|
| 298 |
* Uses the DNS protocol to resolve text queries (`TXT` records) for the `hostname`. On success, the `Promise` is resolved with a two-dimensional array
|
| 299 |
* of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of
|
|
|
|
| 396 |
* other resolvers:
|
| 397 |
*
|
| 398 |
* ```js
|
| 399 |
+
* import dns from 'node:dns';
|
| 400 |
+
* const { Resolver } = dns.promises;
|
| 401 |
+
* const resolver = new Resolver();
|
| 402 |
* resolver.setServers(['4.4.4.4']);
|
| 403 |
*
|
| 404 |
* // This request will use the server at 4.4.4.4, independent of global settings.
|
|
|
|
| 453 |
resolvePtr: typeof resolvePtr;
|
| 454 |
resolveSoa: typeof resolveSoa;
|
| 455 |
resolveSrv: typeof resolveSrv;
|
|
|
|
| 456 |
resolveTxt: typeof resolveTxt;
|
| 457 |
reverse: typeof reverse;
|
| 458 |
/**
|
|
|
|
| 474 |
setServers: typeof setServers;
|
| 475 |
}
|
| 476 |
}
|
| 477 |
+
declare module "node:dns/promises" {
|
| 478 |
+
export * from "dns/promises";
|
| 479 |
}
|
node_modules/@types/node/domain.d.ts
CHANGED
|
@@ -12,10 +12,10 @@
|
|
| 12 |
* will be notified, rather than losing the context of the error in the `process.on('uncaughtException')` handler, or causing the program to
|
| 13 |
* exit immediately with an error code.
|
| 14 |
* @deprecated Since v1.4.2 - Deprecated
|
| 15 |
-
* @see [source](https://github.com/nodejs/node/blob/
|
| 16 |
*/
|
| 17 |
-
declare module "
|
| 18 |
-
import
|
| 19 |
/**
|
| 20 |
* The `Domain` class encapsulates the functionality of routing errors and
|
| 21 |
* uncaught exceptions to the active `Domain` object.
|
|
@@ -24,9 +24,10 @@ declare module "node:domain" {
|
|
| 24 |
*/
|
| 25 |
class Domain extends EventEmitter {
|
| 26 |
/**
|
| 27 |
-
* An array of event emitters that have been explicitly added
|
|
|
|
| 28 |
*/
|
| 29 |
-
members: EventEmitter
|
| 30 |
/**
|
| 31 |
* The `enter()` method is plumbing used by the `run()`, `bind()`, and `intercept()` methods to set the active domain. It sets `domain.active` and `process.domain` to the domain, and implicitly
|
| 32 |
* pushes the domain onto the domain
|
|
@@ -90,17 +91,20 @@ declare module "node:domain" {
|
|
| 90 |
* will be routed to the domain's `'error'` event, just like with implicit
|
| 91 |
* binding.
|
| 92 |
*
|
| 93 |
-
*
|
| 94 |
-
*
|
| 95 |
-
*
|
|
|
|
|
|
|
|
|
|
| 96 |
*/
|
| 97 |
-
add(emitter: EventEmitter): void;
|
| 98 |
/**
|
| 99 |
* The opposite of {@link add}. Removes domain handling from the
|
| 100 |
* specified emitter.
|
| 101 |
-
* @param emitter emitter to be removed from the domain
|
| 102 |
*/
|
| 103 |
-
remove(emitter: EventEmitter): void;
|
| 104 |
/**
|
| 105 |
* The returned function will be a wrapper around the supplied callback
|
| 106 |
* function. When the returned function is called, any errors that are
|
|
@@ -161,6 +165,6 @@ declare module "node:domain" {
|
|
| 161 |
}
|
| 162 |
function create(): Domain;
|
| 163 |
}
|
| 164 |
-
declare module "domain" {
|
| 165 |
-
export * from "
|
| 166 |
}
|
|
|
|
| 12 |
* will be notified, rather than losing the context of the error in the `process.on('uncaughtException')` handler, or causing the program to
|
| 13 |
* exit immediately with an error code.
|
| 14 |
* @deprecated Since v1.4.2 - Deprecated
|
| 15 |
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/domain.js)
|
| 16 |
*/
|
| 17 |
+
declare module "domain" {
|
| 18 |
+
import EventEmitter = require("node:events");
|
| 19 |
/**
|
| 20 |
* The `Domain` class encapsulates the functionality of routing errors and
|
| 21 |
* uncaught exceptions to the active `Domain` object.
|
|
|
|
| 24 |
*/
|
| 25 |
class Domain extends EventEmitter {
|
| 26 |
/**
|
| 27 |
+
* An array of timers and event emitters that have been explicitly added
|
| 28 |
+
* to the domain.
|
| 29 |
*/
|
| 30 |
+
members: Array<EventEmitter | NodeJS.Timer>;
|
| 31 |
/**
|
| 32 |
* The `enter()` method is plumbing used by the `run()`, `bind()`, and `intercept()` methods to set the active domain. It sets `domain.active` and `process.domain` to the domain, and implicitly
|
| 33 |
* pushes the domain onto the domain
|
|
|
|
| 91 |
* will be routed to the domain's `'error'` event, just like with implicit
|
| 92 |
* binding.
|
| 93 |
*
|
| 94 |
+
* This also works with timers that are returned from `setInterval()` and `setTimeout()`. If their callback function throws, it will be caught by
|
| 95 |
+
* the domain `'error'` handler.
|
| 96 |
+
*
|
| 97 |
+
* If the Timer or `EventEmitter` was already bound to a domain, it is removed
|
| 98 |
+
* from that one, and bound to this one instead.
|
| 99 |
+
* @param emitter emitter or timer to be added to the domain
|
| 100 |
*/
|
| 101 |
+
add(emitter: EventEmitter | NodeJS.Timer): void;
|
| 102 |
/**
|
| 103 |
* The opposite of {@link add}. Removes domain handling from the
|
| 104 |
* specified emitter.
|
| 105 |
+
* @param emitter emitter or timer to be removed from the domain
|
| 106 |
*/
|
| 107 |
+
remove(emitter: EventEmitter | NodeJS.Timer): void;
|
| 108 |
/**
|
| 109 |
* The returned function will be a wrapper around the supplied callback
|
| 110 |
* function. When the returned function is called, any errors that are
|
|
|
|
| 165 |
}
|
| 166 |
function create(): Domain;
|
| 167 |
}
|
| 168 |
+
declare module "node:domain" {
|
| 169 |
+
export * from "domain";
|
| 170 |
}
|
node_modules/@types/node/events.d.ts
CHANGED
|
@@ -32,47 +32,58 @@
|
|
| 32 |
* });
|
| 33 |
* myEmitter.emit('event');
|
| 34 |
* ```
|
| 35 |
-
* @see [source](https://github.com/nodejs/node/blob/
|
| 36 |
*/
|
| 37 |
-
declare module "
|
| 38 |
import { AsyncResource, AsyncResourceOptions } from "node:async_hooks";
|
| 39 |
-
// #region Event map helpers
|
| 40 |
-
type EventMap<T> = Record<keyof T, any[]>;
|
| 41 |
-
type IfEventMap<Events extends EventMap<Events>, True, False> = {} extends Events ? False : True;
|
| 42 |
-
type Args<Events extends EventMap<Events>, EventName extends string | symbol> = IfEventMap<
|
| 43 |
-
Events,
|
| 44 |
-
EventName extends keyof Events ? Events[EventName]
|
| 45 |
-
: EventName extends keyof EventEmitterEventMap ? EventEmitterEventMap[EventName]
|
| 46 |
-
: any[],
|
| 47 |
-
any[]
|
| 48 |
-
>;
|
| 49 |
-
type EventNames<Events extends EventMap<Events>, EventName extends string | symbol> = IfEventMap<
|
| 50 |
-
Events,
|
| 51 |
-
EventName | (keyof Events & (string | symbol)) | keyof EventEmitterEventMap,
|
| 52 |
-
string | symbol
|
| 53 |
-
>;
|
| 54 |
-
type Listener<Events extends EventMap<Events>, EventName extends string | symbol> = IfEventMap<
|
| 55 |
-
Events,
|
| 56 |
-
(
|
| 57 |
-
...args: EventName extends keyof Events ? Events[EventName]
|
| 58 |
-
: EventName extends keyof EventEmitterEventMap ? EventEmitterEventMap[EventName]
|
| 59 |
-
: any[]
|
| 60 |
-
) => void,
|
| 61 |
-
(...args: any[]) => void
|
| 62 |
-
>;
|
| 63 |
-
interface EventEmitterEventMap {
|
| 64 |
-
newListener: [eventName: string | symbol, listener: (...args: any[]) => void];
|
| 65 |
-
removeListener: [eventName: string | symbol, listener: (...args: any[]) => void];
|
| 66 |
-
}
|
| 67 |
-
// #endregion
|
| 68 |
interface EventEmitterOptions {
|
| 69 |
/**
|
| 70 |
-
*
|
| 71 |
-
* [automatic capturing of promise rejection](https://nodejs.org/docs/latest-v25.x/api/events.html#capture-rejections-of-promises).
|
| 72 |
-
* @default false
|
| 73 |
*/
|
| 74 |
captureRejections?: boolean | undefined;
|
| 75 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
/**
|
| 77 |
* The `EventEmitter` class is defined and exposed by the `node:events` module:
|
| 78 |
*
|
|
@@ -86,632 +97,132 @@ declare module "node:events" {
|
|
| 86 |
* It supports the following option:
|
| 87 |
* @since v0.1.26
|
| 88 |
*/
|
| 89 |
-
class EventEmitter<T extends EventMap<T> =
|
| 90 |
constructor(options?: EventEmitterOptions);
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
namespace NodeJS {
|
| 95 |
-
interface EventEmitter<T extends EventMap<T> = any> {
|
| 96 |
-
/**
|
| 97 |
-
* The `Symbol.for('nodejs.rejection')` method is called in case a
|
| 98 |
-
* promise rejection happens when emitting an event and
|
| 99 |
-
* `captureRejections` is enabled on the emitter.
|
| 100 |
-
* It is possible to use `events.captureRejectionSymbol` in
|
| 101 |
-
* place of `Symbol.for('nodejs.rejection')`.
|
| 102 |
-
*
|
| 103 |
-
* ```js
|
| 104 |
-
* import { EventEmitter, captureRejectionSymbol } from 'node:events';
|
| 105 |
-
*
|
| 106 |
-
* class MyClass extends EventEmitter {
|
| 107 |
-
* constructor() {
|
| 108 |
-
* super({ captureRejections: true });
|
| 109 |
-
* }
|
| 110 |
-
*
|
| 111 |
-
* [captureRejectionSymbol](err, event, ...args) {
|
| 112 |
-
* console.log('rejection happened for', event, 'with', err, ...args);
|
| 113 |
-
* this.destroy(err);
|
| 114 |
-
* }
|
| 115 |
-
*
|
| 116 |
-
* destroy(err) {
|
| 117 |
-
* // Tear the resource down here.
|
| 118 |
-
* }
|
| 119 |
-
* }
|
| 120 |
-
* ```
|
| 121 |
-
* @since v13.4.0, v12.16.0
|
| 122 |
-
*/
|
| 123 |
-
[EventEmitter.captureRejectionSymbol]?(error: Error, event: string | symbol, ...args: any[]): void;
|
| 124 |
-
/**
|
| 125 |
-
* Alias for `emitter.on(eventName, listener)`.
|
| 126 |
-
* @since v0.1.26
|
| 127 |
-
*/
|
| 128 |
-
addListener<E extends string | symbol>(eventName: EventNames<T, E>, listener: Listener<T, E>): this;
|
| 129 |
-
/**
|
| 130 |
-
* Synchronously calls each of the listeners registered for the event named
|
| 131 |
-
* `eventName`, in the order they were registered, passing the supplied arguments
|
| 132 |
-
* to each.
|
| 133 |
-
*
|
| 134 |
-
* Returns `true` if the event had listeners, `false` otherwise.
|
| 135 |
-
*
|
| 136 |
-
* ```js
|
| 137 |
-
* import { EventEmitter } from 'node:events';
|
| 138 |
-
* const myEmitter = new EventEmitter();
|
| 139 |
-
*
|
| 140 |
-
* // First listener
|
| 141 |
-
* myEmitter.on('event', function firstListener() {
|
| 142 |
-
* console.log('Helloooo! first listener');
|
| 143 |
-
* });
|
| 144 |
-
* // Second listener
|
| 145 |
-
* myEmitter.on('event', function secondListener(arg1, arg2) {
|
| 146 |
-
* console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
|
| 147 |
-
* });
|
| 148 |
-
* // Third listener
|
| 149 |
-
* myEmitter.on('event', function thirdListener(...args) {
|
| 150 |
-
* const parameters = args.join(', ');
|
| 151 |
-
* console.log(`event with parameters ${parameters} in third listener`);
|
| 152 |
-
* });
|
| 153 |
-
*
|
| 154 |
-
* console.log(myEmitter.listeners('event'));
|
| 155 |
-
*
|
| 156 |
-
* myEmitter.emit('event', 1, 2, 3, 4, 5);
|
| 157 |
-
*
|
| 158 |
-
* // Prints:
|
| 159 |
-
* // [
|
| 160 |
-
* // [Function: firstListener],
|
| 161 |
-
* // [Function: secondListener],
|
| 162 |
-
* // [Function: thirdListener]
|
| 163 |
-
* // ]
|
| 164 |
-
* // Helloooo! first listener
|
| 165 |
-
* // event with parameters 1, 2 in second listener
|
| 166 |
-
* // event with parameters 1, 2, 3, 4, 5 in third listener
|
| 167 |
-
* ```
|
| 168 |
-
* @since v0.1.26
|
| 169 |
-
*/
|
| 170 |
-
emit<E extends string | symbol>(eventName: EventNames<T, E>, ...args: Args<T, E>): boolean;
|
| 171 |
-
/**
|
| 172 |
-
* Returns an array listing the events for which the emitter has registered
|
| 173 |
-
* listeners.
|
| 174 |
-
*
|
| 175 |
-
* ```js
|
| 176 |
-
* import { EventEmitter } from 'node:events';
|
| 177 |
-
*
|
| 178 |
-
* const myEE = new EventEmitter();
|
| 179 |
-
* myEE.on('foo', () => {});
|
| 180 |
-
* myEE.on('bar', () => {});
|
| 181 |
-
*
|
| 182 |
-
* const sym = Symbol('symbol');
|
| 183 |
-
* myEE.on(sym, () => {});
|
| 184 |
-
*
|
| 185 |
-
* console.log(myEE.eventNames());
|
| 186 |
-
* // Prints: [ 'foo', 'bar', Symbol(symbol) ]
|
| 187 |
-
* ```
|
| 188 |
-
* @since v6.0.0
|
| 189 |
-
*/
|
| 190 |
-
eventNames(): (string | symbol)[];
|
| 191 |
-
/**
|
| 192 |
-
* Returns the current max listener value for the `EventEmitter` which is either
|
| 193 |
-
* set by `emitter.setMaxListeners(n)` or defaults to
|
| 194 |
-
* `events.defaultMaxListeners`.
|
| 195 |
-
* @since v1.0.0
|
| 196 |
-
*/
|
| 197 |
-
getMaxListeners(): number;
|
| 198 |
-
/**
|
| 199 |
-
* Returns the number of listeners listening for the event named `eventName`.
|
| 200 |
-
* If `listener` is provided, it will return how many times the listener is found
|
| 201 |
-
* in the list of the listeners of the event.
|
| 202 |
-
* @since v3.2.0
|
| 203 |
-
* @param eventName The name of the event being listened for
|
| 204 |
-
* @param listener The event handler function
|
| 205 |
-
*/
|
| 206 |
-
listenerCount<E extends string | symbol>(
|
| 207 |
-
eventName: EventNames<T, E>,
|
| 208 |
-
listener?: Listener<T, E>,
|
| 209 |
-
): number;
|
| 210 |
-
/**
|
| 211 |
-
* Returns a copy of the array of listeners for the event named `eventName`.
|
| 212 |
-
*
|
| 213 |
-
* ```js
|
| 214 |
-
* server.on('connection', (stream) => {
|
| 215 |
-
* console.log('someone connected!');
|
| 216 |
-
* });
|
| 217 |
-
* console.log(util.inspect(server.listeners('connection')));
|
| 218 |
-
* // Prints: [ [Function] ]
|
| 219 |
-
* ```
|
| 220 |
-
* @since v0.1.26
|
| 221 |
-
*/
|
| 222 |
-
listeners<E extends string | symbol>(eventName: EventNames<T, E>): Listener<T, E>[];
|
| 223 |
-
/**
|
| 224 |
-
* Alias for `emitter.removeListener()`.
|
| 225 |
-
* @since v10.0.0
|
| 226 |
-
*/
|
| 227 |
-
off<E extends string | symbol>(eventName: EventNames<T, E>, listener: Listener<T, E>): this;
|
| 228 |
-
/**
|
| 229 |
-
* Adds the `listener` function to the end of the listeners array for the
|
| 230 |
-
* event named `eventName`. No checks are made to see if the `listener` has
|
| 231 |
-
* already been added. Multiple calls passing the same combination of `eventName`
|
| 232 |
-
* and `listener` will result in the `listener` being added, and called, multiple
|
| 233 |
-
* times.
|
| 234 |
-
*
|
| 235 |
-
* ```js
|
| 236 |
-
* server.on('connection', (stream) => {
|
| 237 |
-
* console.log('someone connected!');
|
| 238 |
-
* });
|
| 239 |
-
* ```
|
| 240 |
-
*
|
| 241 |
-
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
| 242 |
-
*
|
| 243 |
-
* By default, event listeners are invoked in the order they are added. The
|
| 244 |
-
* `emitter.prependListener()` method can be used as an alternative to add the
|
| 245 |
-
* event listener to the beginning of the listeners array.
|
| 246 |
-
*
|
| 247 |
-
* ```js
|
| 248 |
-
* import { EventEmitter } from 'node:events';
|
| 249 |
-
* const myEE = new EventEmitter();
|
| 250 |
-
* myEE.on('foo', () => console.log('a'));
|
| 251 |
-
* myEE.prependListener('foo', () => console.log('b'));
|
| 252 |
-
* myEE.emit('foo');
|
| 253 |
-
* // Prints:
|
| 254 |
-
* // b
|
| 255 |
-
* // a
|
| 256 |
-
* ```
|
| 257 |
-
* @since v0.1.101
|
| 258 |
-
* @param eventName The name of the event.
|
| 259 |
-
* @param listener The callback function
|
| 260 |
-
*/
|
| 261 |
-
on<E extends string | symbol>(eventName: EventNames<T, E>, listener: Listener<T, E>): this;
|
| 262 |
-
/**
|
| 263 |
-
* Adds a **one-time** `listener` function for the event named `eventName`. The
|
| 264 |
-
* next time `eventName` is triggered, this listener is removed and then invoked.
|
| 265 |
-
*
|
| 266 |
-
* ```js
|
| 267 |
-
* server.once('connection', (stream) => {
|
| 268 |
-
* console.log('Ah, we have our first user!');
|
| 269 |
-
* });
|
| 270 |
-
* ```
|
| 271 |
-
*
|
| 272 |
-
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
| 273 |
-
*
|
| 274 |
-
* By default, event listeners are invoked in the order they are added. The
|
| 275 |
-
* `emitter.prependOnceListener()` method can be used as an alternative to add the
|
| 276 |
-
* event listener to the beginning of the listeners array.
|
| 277 |
-
*
|
| 278 |
-
* ```js
|
| 279 |
-
* import { EventEmitter } from 'node:events';
|
| 280 |
-
* const myEE = new EventEmitter();
|
| 281 |
-
* myEE.once('foo', () => console.log('a'));
|
| 282 |
-
* myEE.prependOnceListener('foo', () => console.log('b'));
|
| 283 |
-
* myEE.emit('foo');
|
| 284 |
-
* // Prints:
|
| 285 |
-
* // b
|
| 286 |
-
* // a
|
| 287 |
-
* ```
|
| 288 |
-
* @since v0.3.0
|
| 289 |
-
* @param eventName The name of the event.
|
| 290 |
-
* @param listener The callback function
|
| 291 |
-
*/
|
| 292 |
-
once<E extends string | symbol>(eventName: EventNames<T, E>, listener: Listener<T, E>): this;
|
| 293 |
-
/**
|
| 294 |
-
* Adds the `listener` function to the _beginning_ of the listeners array for the
|
| 295 |
-
* event named `eventName`. No checks are made to see if the `listener` has
|
| 296 |
-
* already been added. Multiple calls passing the same combination of `eventName`
|
| 297 |
-
* and `listener` will result in the `listener` being added, and called, multiple
|
| 298 |
-
* times.
|
| 299 |
-
*
|
| 300 |
-
* ```js
|
| 301 |
-
* server.prependListener('connection', (stream) => {
|
| 302 |
-
* console.log('someone connected!');
|
| 303 |
-
* });
|
| 304 |
-
* ```
|
| 305 |
-
*
|
| 306 |
-
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
| 307 |
-
* @since v6.0.0
|
| 308 |
-
* @param eventName The name of the event.
|
| 309 |
-
* @param listener The callback function
|
| 310 |
-
*/
|
| 311 |
-
prependListener<E extends string | symbol>(eventName: EventNames<T, E>, listener: Listener<T, E>): this;
|
| 312 |
-
/**
|
| 313 |
-
* Adds a **one-time** `listener` function for the event named `eventName` to the
|
| 314 |
-
* _beginning_ of the listeners array. The next time `eventName` is triggered, this
|
| 315 |
-
* listener is removed, and then invoked.
|
| 316 |
-
*
|
| 317 |
-
* ```js
|
| 318 |
-
* server.prependOnceListener('connection', (stream) => {
|
| 319 |
-
* console.log('Ah, we have our first user!');
|
| 320 |
-
* });
|
| 321 |
-
* ```
|
| 322 |
-
*
|
| 323 |
-
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
| 324 |
-
* @since v6.0.0
|
| 325 |
-
* @param eventName The name of the event.
|
| 326 |
-
* @param listener The callback function
|
| 327 |
-
*/
|
| 328 |
-
prependOnceListener<E extends string | symbol>(
|
| 329 |
-
eventName: EventNames<T, E>,
|
| 330 |
-
listener: Listener<T, E>,
|
| 331 |
-
): this;
|
| 332 |
-
/**
|
| 333 |
-
* Returns a copy of the array of listeners for the event named `eventName`,
|
| 334 |
-
* including any wrappers (such as those created by `.once()`).
|
| 335 |
-
*
|
| 336 |
-
* ```js
|
| 337 |
-
* import { EventEmitter } from 'node:events';
|
| 338 |
-
* const emitter = new EventEmitter();
|
| 339 |
-
* emitter.once('log', () => console.log('log once'));
|
| 340 |
-
*
|
| 341 |
-
* // Returns a new Array with a function `onceWrapper` which has a property
|
| 342 |
-
* // `listener` which contains the original listener bound above
|
| 343 |
-
* const listeners = emitter.rawListeners('log');
|
| 344 |
-
* const logFnWrapper = listeners[0];
|
| 345 |
-
*
|
| 346 |
-
* // Logs "log once" to the console and does not unbind the `once` event
|
| 347 |
-
* logFnWrapper.listener();
|
| 348 |
-
*
|
| 349 |
-
* // Logs "log once" to the console and removes the listener
|
| 350 |
-
* logFnWrapper();
|
| 351 |
-
*
|
| 352 |
-
* emitter.on('log', () => console.log('log persistently'));
|
| 353 |
-
* // Will return a new Array with a single function bound by `.on()` above
|
| 354 |
-
* const newListeners = emitter.rawListeners('log');
|
| 355 |
-
*
|
| 356 |
-
* // Logs "log persistently" twice
|
| 357 |
-
* newListeners[0]();
|
| 358 |
-
* emitter.emit('log');
|
| 359 |
-
* ```
|
| 360 |
-
* @since v9.4.0
|
| 361 |
-
*/
|
| 362 |
-
rawListeners<E extends string | symbol>(eventName: EventNames<T, E>): Listener<T, E>[];
|
| 363 |
-
/**
|
| 364 |
-
* Removes all listeners, or those of the specified `eventName`.
|
| 365 |
-
*
|
| 366 |
-
* It is bad practice to remove listeners added elsewhere in the code,
|
| 367 |
-
* particularly when the `EventEmitter` instance was created by some other
|
| 368 |
-
* component or module (e.g. sockets or file streams).
|
| 369 |
-
*
|
| 370 |
-
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
| 371 |
-
* @since v0.1.26
|
| 372 |
-
*/
|
| 373 |
-
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
| 374 |
-
removeAllListeners<E extends string | symbol>(eventName?: EventNames<T, E>): this;
|
| 375 |
-
/**
|
| 376 |
-
* Removes the specified `listener` from the listener array for the event named
|
| 377 |
-
* `eventName`.
|
| 378 |
-
*
|
| 379 |
-
* ```js
|
| 380 |
-
* const callback = (stream) => {
|
| 381 |
-
* console.log('someone connected!');
|
| 382 |
-
* };
|
| 383 |
-
* server.on('connection', callback);
|
| 384 |
-
* // ...
|
| 385 |
-
* server.removeListener('connection', callback);
|
| 386 |
-
* ```
|
| 387 |
-
*
|
| 388 |
-
* `removeListener()` will remove, at most, one instance of a listener from the
|
| 389 |
-
* listener array. If any single listener has been added multiple times to the
|
| 390 |
-
* listener array for the specified `eventName`, then `removeListener()` must be
|
| 391 |
-
* called multiple times to remove each instance.
|
| 392 |
-
*
|
| 393 |
-
* Once an event is emitted, all listeners attached to it at the
|
| 394 |
-
* time of emitting are called in order. This implies that any
|
| 395 |
-
* `removeListener()` or `removeAllListeners()` calls _after_ emitting and
|
| 396 |
-
* _before_ the last listener finishes execution will not remove them from
|
| 397 |
-
* `emit()` in progress. Subsequent events behave as expected.
|
| 398 |
-
*
|
| 399 |
-
* ```js
|
| 400 |
-
* import { EventEmitter } from 'node:events';
|
| 401 |
-
* class MyEmitter extends EventEmitter {}
|
| 402 |
-
* const myEmitter = new MyEmitter();
|
| 403 |
-
*
|
| 404 |
-
* const callbackA = () => {
|
| 405 |
-
* console.log('A');
|
| 406 |
-
* myEmitter.removeListener('event', callbackB);
|
| 407 |
-
* };
|
| 408 |
-
*
|
| 409 |
-
* const callbackB = () => {
|
| 410 |
-
* console.log('B');
|
| 411 |
-
* };
|
| 412 |
-
*
|
| 413 |
-
* myEmitter.on('event', callbackA);
|
| 414 |
-
*
|
| 415 |
-
* myEmitter.on('event', callbackB);
|
| 416 |
-
*
|
| 417 |
-
* // callbackA removes listener callbackB but it will still be called.
|
| 418 |
-
* // Internal listener array at time of emit [callbackA, callbackB]
|
| 419 |
-
* myEmitter.emit('event');
|
| 420 |
-
* // Prints:
|
| 421 |
-
* // A
|
| 422 |
-
* // B
|
| 423 |
-
*
|
| 424 |
-
* // callbackB is now removed.
|
| 425 |
-
* // Internal listener array [callbackA]
|
| 426 |
-
* myEmitter.emit('event');
|
| 427 |
-
* // Prints:
|
| 428 |
-
* // A
|
| 429 |
-
* ```
|
| 430 |
-
*
|
| 431 |
-
* Because listeners are managed using an internal array, calling this will
|
| 432 |
-
* change the position indexes of any listener registered _after_ the listener
|
| 433 |
-
* being removed. This will not impact the order in which listeners are called,
|
| 434 |
-
* but it means that any copies of the listener array as returned by
|
| 435 |
-
* the `emitter.listeners()` method will need to be recreated.
|
| 436 |
-
*
|
| 437 |
-
* When a single function has been added as a handler multiple times for a single
|
| 438 |
-
* event (as in the example below), `removeListener()` will remove the most
|
| 439 |
-
* recently added instance. In the example the `once('ping')`
|
| 440 |
-
* listener is removed:
|
| 441 |
-
*
|
| 442 |
-
* ```js
|
| 443 |
-
* import { EventEmitter } from 'node:events';
|
| 444 |
-
* const ee = new EventEmitter();
|
| 445 |
-
*
|
| 446 |
-
* function pong() {
|
| 447 |
-
* console.log('pong');
|
| 448 |
-
* }
|
| 449 |
-
*
|
| 450 |
-
* ee.on('ping', pong);
|
| 451 |
-
* ee.once('ping', pong);
|
| 452 |
-
* ee.removeListener('ping', pong);
|
| 453 |
-
*
|
| 454 |
-
* ee.emit('ping');
|
| 455 |
-
* ee.emit('ping');
|
| 456 |
-
* ```
|
| 457 |
-
*
|
| 458 |
-
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
| 459 |
-
* @since v0.1.26
|
| 460 |
-
*/
|
| 461 |
-
removeListener<E extends string | symbol>(eventName: EventNames<T, E>, listener: Listener<T, E>): this;
|
| 462 |
-
/**
|
| 463 |
-
* By default `EventEmitter`s will print a warning if more than `10` listeners are
|
| 464 |
-
* added for a particular event. This is a useful default that helps finding
|
| 465 |
-
* memory leaks. The `emitter.setMaxListeners()` method allows the limit to be
|
| 466 |
-
* modified for this specific `EventEmitter` instance. The value can be set to
|
| 467 |
-
* `Infinity` (or `0`) to indicate an unlimited number of listeners.
|
| 468 |
-
*
|
| 469 |
-
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
| 470 |
-
* @since v0.3.5
|
| 471 |
-
*/
|
| 472 |
-
setMaxListeners(n: number): this;
|
| 473 |
-
}
|
| 474 |
-
}
|
| 475 |
-
}
|
| 476 |
-
namespace EventEmitter {
|
| 477 |
-
export { EventEmitter, EventEmitterEventMap, EventEmitterOptions };
|
| 478 |
-
}
|
| 479 |
-
namespace EventEmitter {
|
| 480 |
-
interface Abortable {
|
| 481 |
-
signal?: AbortSignal | undefined;
|
| 482 |
-
}
|
| 483 |
-
/**
|
| 484 |
-
* See how to write a custom [rejection handler](https://nodejs.org/docs/latest-v25.x/api/events.html#emittersymbolfornodejsrejectionerr-eventname-args).
|
| 485 |
-
* @since v13.4.0, v12.16.0
|
| 486 |
-
*/
|
| 487 |
-
const captureRejectionSymbol: unique symbol;
|
| 488 |
-
/**
|
| 489 |
-
* Change the default `captureRejections` option on all new `EventEmitter` objects.
|
| 490 |
-
* @since v13.4.0, v12.16.0
|
| 491 |
-
*/
|
| 492 |
-
let captureRejections: boolean;
|
| 493 |
/**
|
| 494 |
-
*
|
| 495 |
-
* event
|
| 496 |
-
*
|
| 497 |
-
*
|
| 498 |
-
* property can be used. If this value is not a positive number, a `RangeError`
|
| 499 |
-
* is thrown.
|
| 500 |
*
|
| 501 |
-
*
|
| 502 |
-
*
|
| 503 |
-
* the change is made. However, calling `emitter.setMaxListeners(n)` still has
|
| 504 |
-
* precedence over `events.defaultMaxListeners`.
|
| 505 |
*
|
| 506 |
-
*
|
| 507 |
-
*
|
| 508 |
-
*
|
| 509 |
-
* `EventEmitter`, the `emitter.getMaxListeners()` and `emitter.setMaxListeners()`
|
| 510 |
-
* methods can be used to temporarily avoid this warning:
|
| 511 |
*
|
| 512 |
-
*
|
| 513 |
-
* still possible to use `emitter.setMaxListeners(n)` to set a warning limit
|
| 514 |
-
* for individual `AbortSignal` instances, per default `AbortSignal` instances will not warn.
|
| 515 |
*
|
| 516 |
-
*
|
| 517 |
-
*
|
| 518 |
-
*
|
| 519 |
-
*
|
| 520 |
-
*
|
| 521 |
-
*
|
| 522 |
-
*
|
|
|
|
|
|
|
|
|
|
| 523 |
* });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 524 |
* ```
|
| 525 |
*
|
| 526 |
-
* The `
|
| 527 |
-
*
|
|
|
|
| 528 |
*
|
| 529 |
-
*
|
| 530 |
-
*
|
| 531 |
-
* the event emitter instance, the event's name and the number of attached
|
| 532 |
-
* listeners, respectively.
|
| 533 |
-
* Its `name` property is set to `'MaxListenersExceededWarning'`.
|
| 534 |
-
* @since v0.11.2
|
| 535 |
-
*/
|
| 536 |
-
let defaultMaxListeners: number;
|
| 537 |
-
/**
|
| 538 |
-
* This symbol shall be used to install a listener for only monitoring `'error'`
|
| 539 |
-
* events. Listeners installed using this symbol are called before the regular
|
| 540 |
-
* `'error'` listeners are called.
|
| 541 |
*
|
| 542 |
-
*
|
| 543 |
-
* `'error'` event is emitted. Therefore, the process will still crash if no
|
| 544 |
-
* regular `'error'` listener is installed.
|
| 545 |
-
* @since v13.6.0, v12.17.0
|
| 546 |
-
*/
|
| 547 |
-
const errorMonitor: unique symbol;
|
| 548 |
-
/**
|
| 549 |
-
* Listens once to the `abort` event on the provided `signal`.
|
| 550 |
*
|
| 551 |
-
*
|
| 552 |
-
*
|
| 553 |
-
*
|
| 554 |
-
* this since it would violate the web standard. Additionally, the original
|
| 555 |
-
* API makes it easy to forget to remove listeners.
|
| 556 |
*
|
| 557 |
-
*
|
| 558 |
-
* two issues by listening to the event such that `stopImmediatePropagation` does
|
| 559 |
-
* not prevent the listener from running.
|
| 560 |
*
|
| 561 |
-
*
|
|
|
|
|
|
|
|
|
|
| 562 |
*
|
| 563 |
* ```js
|
| 564 |
-
* import {
|
| 565 |
*
|
| 566 |
-
*
|
| 567 |
-
*
|
|
|
|
|
|
|
| 568 |
* try {
|
| 569 |
-
*
|
| 570 |
-
*
|
| 571 |
-
*
|
| 572 |
-
*
|
| 573 |
-
*
|
| 574 |
-
*
|
|
|
|
|
|
|
| 575 |
* }
|
| 576 |
* }
|
|
|
|
|
|
|
|
|
|
|
|
|
| 577 |
* ```
|
| 578 |
-
* @since
|
| 579 |
-
* @return Disposable that removes the `abort` listener.
|
| 580 |
*/
|
| 581 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 582 |
/**
|
| 583 |
-
*
|
| 584 |
-
*
|
| 585 |
-
*
|
| 586 |
-
* the emitter.
|
| 587 |
*
|
| 588 |
-
*
|
| 589 |
-
* event target. This is useful for debugging and diagnostic purposes.
|
| 590 |
*
|
| 591 |
-
*
|
| 592 |
-
*
|
|
|
|
|
|
|
|
|
|
| 593 |
*
|
| 594 |
-
* {
|
| 595 |
-
*
|
| 596 |
-
*
|
| 597 |
-
*
|
| 598 |
-
* console.log(
|
| 599 |
-
* }
|
| 600 |
-
* {
|
| 601 |
-
* const et = new EventTarget();
|
| 602 |
-
* const listener = () => console.log('Events are fun');
|
| 603 |
-
* et.addEventListener('foo', listener);
|
| 604 |
-
* console.log(getEventListeners(et, 'foo')); // [ [Function: listener] ]
|
| 605 |
* }
|
|
|
|
| 606 |
* ```
|
| 607 |
-
* @since v15.2.0, v14.17.0
|
| 608 |
-
*/
|
| 609 |
-
function getEventListeners(emitter: EventEmitter, name: string | symbol): ((...args: any[]) => void)[];
|
| 610 |
-
function getEventListeners(emitter: EventTarget, name: string): ((...args: any[]) => void)[];
|
| 611 |
-
/**
|
| 612 |
-
* Returns the currently set max amount of listeners.
|
| 613 |
*
|
| 614 |
-
*
|
| 615 |
-
* the
|
|
|
|
|
|
|
| 616 |
*
|
| 617 |
-
*
|
| 618 |
-
* event target. If the number of event handlers on a single EventTarget exceeds
|
| 619 |
-
* the max set, the EventTarget will print a warning.
|
| 620 |
*
|
| 621 |
* ```js
|
| 622 |
-
* import {
|
|
|
|
| 623 |
*
|
| 624 |
-
*
|
| 625 |
-
*
|
| 626 |
-
*
|
| 627 |
-
* setMaxListeners(11, ee);
|
| 628 |
-
* console.log(getMaxListeners(ee)); // 11
|
| 629 |
-
* }
|
| 630 |
-
* {
|
| 631 |
-
* const et = new EventTarget();
|
| 632 |
-
* console.log(getMaxListeners(et)); // 10
|
| 633 |
-
* setMaxListeners(11, et);
|
| 634 |
-
* console.log(getMaxListeners(et)); // 11
|
| 635 |
-
* }
|
| 636 |
-
* ```
|
| 637 |
-
* @since v19.9.0
|
| 638 |
-
*/
|
| 639 |
-
function getMaxListeners(emitter: EventEmitter | EventTarget): number;
|
| 640 |
-
/**
|
| 641 |
-
* A class method that returns the number of listeners for the given `eventName`
|
| 642 |
-
* registered on the given `emitter`.
|
| 643 |
-
*
|
| 644 |
-
* ```js
|
| 645 |
-
* import { EventEmitter, listenerCount } from 'node:events';
|
| 646 |
-
*
|
| 647 |
-
* const myEmitter = new EventEmitter();
|
| 648 |
-
* myEmitter.on('event', () => {});
|
| 649 |
-
* myEmitter.on('event', () => {});
|
| 650 |
-
* console.log(listenerCount(myEmitter, 'event'));
|
| 651 |
-
* // Prints: 2
|
| 652 |
-
* ```
|
| 653 |
-
* @since v0.9.12
|
| 654 |
-
* @deprecated Use `emitter.listenerCount()` instead.
|
| 655 |
-
* @param emitter The emitter to query
|
| 656 |
-
* @param eventName The event name
|
| 657 |
-
*/
|
| 658 |
-
function listenerCount(emitter: EventEmitter, eventName: string | symbol): number;
|
| 659 |
-
interface OnOptions extends Abortable {
|
| 660 |
-
/**
|
| 661 |
-
* Names of events that will end the iteration.
|
| 662 |
-
*/
|
| 663 |
-
close?: readonly string[] | undefined;
|
| 664 |
-
/**
|
| 665 |
-
* The high watermark. The emitter is paused every time the size of events
|
| 666 |
-
* being buffered is higher than it. Supported only on emitters implementing
|
| 667 |
-
* `pause()` and `resume()` methods.
|
| 668 |
-
* @default Number.MAX_SAFE_INTEGER
|
| 669 |
-
*/
|
| 670 |
-
highWaterMark?: number | undefined;
|
| 671 |
-
/**
|
| 672 |
-
* The low watermark. The emitter is resumed every time the size of events
|
| 673 |
-
* being buffered is lower than it. Supported only on emitters implementing
|
| 674 |
-
* `pause()` and `resume()` methods.
|
| 675 |
-
* @default 1
|
| 676 |
-
*/
|
| 677 |
-
lowWaterMark?: number | undefined;
|
| 678 |
-
}
|
| 679 |
-
/**
|
| 680 |
-
* ```js
|
| 681 |
-
* import { on, EventEmitter } from 'node:events';
|
| 682 |
-
* import process from 'node:process';
|
| 683 |
-
*
|
| 684 |
-
* const ee = new EventEmitter();
|
| 685 |
-
*
|
| 686 |
-
* // Emit later on
|
| 687 |
-
* process.nextTick(() => {
|
| 688 |
-
* ee.emit('foo', 'bar');
|
| 689 |
-
* ee.emit('foo', 42);
|
| 690 |
-
* });
|
| 691 |
-
*
|
| 692 |
-
* for await (const event of on(ee, 'foo')) {
|
| 693 |
-
* // The execution of this inner block is synchronous and it
|
| 694 |
-
* // processes one event at a time (even with await). Do not use
|
| 695 |
-
* // if concurrent execution is required.
|
| 696 |
-
* console.log(event); // prints ['bar'] [42]
|
| 697 |
-
* }
|
| 698 |
-
* // Unreachable here
|
| 699 |
-
* ```
|
| 700 |
-
*
|
| 701 |
-
* Returns an `AsyncIterator` that iterates `eventName` events. It will throw
|
| 702 |
-
* if the `EventEmitter` emits `'error'`. It removes all listeners when
|
| 703 |
-
* exiting the loop. The `value` returned by each iteration is an array
|
| 704 |
-
* composed of the emitted event arguments.
|
| 705 |
-
*
|
| 706 |
-
* An `AbortSignal` can be used to cancel waiting on events:
|
| 707 |
-
*
|
| 708 |
-
* ```js
|
| 709 |
-
* import { on, EventEmitter } from 'node:events';
|
| 710 |
-
* import process from 'node:process';
|
| 711 |
-
*
|
| 712 |
-
* const ac = new AbortController();
|
| 713 |
-
*
|
| 714 |
-
* (async () => {
|
| 715 |
* const ee = new EventEmitter();
|
| 716 |
*
|
| 717 |
* // Emit later on
|
|
@@ -731,106 +242,116 @@ declare module "node:events" {
|
|
| 731 |
*
|
| 732 |
* process.nextTick(() => ac.abort());
|
| 733 |
* ```
|
| 734 |
-
* @since v13.6.0, v12.16.0
|
| 735 |
-
* @returns `AsyncIterator` that iterates `eventName` events emitted by the `emitter`
|
| 736 |
-
*/
|
| 737 |
-
function on(
|
| 738 |
-
emitter: EventEmitter,
|
| 739 |
-
eventName: string | symbol,
|
| 740 |
-
options?: OnOptions,
|
| 741 |
-
): NodeJS.AsyncIterator<any[]>;
|
| 742 |
-
function on(
|
| 743 |
-
emitter: EventTarget,
|
| 744 |
-
eventName: string,
|
| 745 |
-
options?: OnOptions,
|
| 746 |
-
): NodeJS.AsyncIterator<any[]>;
|
| 747 |
-
interface OnceOptions extends Abortable {}
|
| 748 |
-
/**
|
| 749 |
-
* Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given
|
| 750 |
-
* event or that is rejected if the `EventEmitter` emits `'error'` while waiting.
|
| 751 |
-
* The `Promise` will resolve with an array of all the arguments emitted to the
|
| 752 |
-
* given event.
|
| 753 |
*
|
| 754 |
-
*
|
| 755 |
-
* [EventTarget][WHATWG-EventTarget] interface, which has no special
|
| 756 |
-
* `'error'` event semantics and does not listen to the `'error'` event.
|
| 757 |
*
|
| 758 |
* ```js
|
| 759 |
-
* import {
|
| 760 |
* import process from 'node:process';
|
| 761 |
*
|
| 762 |
* const ee = new EventEmitter();
|
| 763 |
*
|
|
|
|
| 764 |
* process.nextTick(() => {
|
| 765 |
-
* ee.emit('
|
| 766 |
-
*
|
| 767 |
-
*
|
| 768 |
-
* const [value] = await once(ee, 'myevent');
|
| 769 |
-
* console.log(value);
|
| 770 |
-
*
|
| 771 |
-
* const err = new Error('kaboom');
|
| 772 |
-
* process.nextTick(() => {
|
| 773 |
-
* ee.emit('error', err);
|
| 774 |
* });
|
| 775 |
*
|
| 776 |
-
*
|
| 777 |
-
*
|
| 778 |
-
* } catch (err) {
|
| 779 |
-
* console.error('error happened', err);
|
| 780 |
* }
|
|
|
|
|
|
|
| 781 |
* ```
|
| 782 |
-
*
|
| 783 |
-
*
|
| 784 |
-
*
|
| 785 |
-
|
| 786 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 787 |
*
|
| 788 |
* ```js
|
| 789 |
-
* import { EventEmitter,
|
| 790 |
*
|
| 791 |
-
* const
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 792 |
*
|
| 793 |
-
*
|
| 794 |
-
*
|
| 795 |
-
* .catch((err) => console.error('error', err.message));
|
| 796 |
*
|
| 797 |
-
*
|
|
|
|
| 798 |
*
|
| 799 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 800 |
* ```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 801 |
*
|
| 802 |
-
*
|
|
|
|
| 803 |
*
|
| 804 |
-
* ``
|
| 805 |
-
*
|
|
|
|
| 806 |
*
|
| 807 |
-
*
|
| 808 |
-
*
|
| 809 |
*
|
| 810 |
-
*
|
| 811 |
-
*
|
| 812 |
-
*
|
| 813 |
-
*
|
| 814 |
-
*
|
| 815 |
-
*
|
| 816 |
-
*
|
| 817 |
-
*
|
| 818 |
-
*
|
| 819 |
-
*
|
| 820 |
-
*
|
| 821 |
* }
|
| 822 |
-
*
|
| 823 |
-
* foo(ee, 'foo', ac.signal);
|
| 824 |
-
* ac.abort(); // Prints: Waiting for the event was canceled!
|
| 825 |
* ```
|
| 826 |
-
* @since
|
| 827 |
*/
|
| 828 |
-
|
| 829 |
-
emitter: EventEmitter,
|
| 830 |
-
eventName: string | symbol,
|
| 831 |
-
options?: OnceOptions,
|
| 832 |
-
): Promise<any[]>;
|
| 833 |
-
function once(emitter: EventTarget, eventName: string, options?: OnceOptions): Promise<any[]>;
|
| 834 |
/**
|
| 835 |
* ```js
|
| 836 |
* import { setMaxListeners, EventEmitter } from 'node:events';
|
|
@@ -842,113 +363,174 @@ declare module "node:events" {
|
|
| 842 |
* ```
|
| 843 |
* @since v15.4.0
|
| 844 |
* @param n A non-negative number. The maximum number of listeners per `EventTarget` event.
|
| 845 |
-
* @param eventTargets Zero or more
|
| 846 |
-
* or `EventEmitter` instances. If none are specified, `n` is set as the default
|
| 847 |
-
* max for all newly created `EventTarget` and `EventEmitter` objects.
|
| 848 |
* objects.
|
| 849 |
*/
|
| 850 |
-
|
| 851 |
-
/**
|
| 852 |
-
* This is the interface from which event-emitting Node.js APIs inherit in the types package.
|
| 853 |
-
* **It is not intended for consumer use.**
|
| 854 |
-
*
|
| 855 |
-
* It provides event-mapped definitions similar to EventEmitter, except that its signatures
|
| 856 |
-
* are deliberately permissive: they provide type _hinting_, but not rigid type-checking,
|
| 857 |
-
* for compatibility reasons.
|
| 858 |
-
*
|
| 859 |
-
* Classes that inherit directly from EventEmitter in JavaScript can inherit directly from
|
| 860 |
-
* this interface in the type definitions. Classes that are more than one inheritance level
|
| 861 |
-
* away from EventEmitter (eg. `net.Socket` > `stream.Duplex` > `EventEmitter`) must instead
|
| 862 |
-
* copy these method definitions into the derived class. Search "#region InternalEventEmitter"
|
| 863 |
-
* for examples.
|
| 864 |
-
* @internal
|
| 865 |
-
*/
|
| 866 |
-
interface InternalEventEmitter<T extends EventMap<T>> extends EventEmitter {
|
| 867 |
-
addListener<E extends keyof T>(eventName: E, listener: (...args: T[E]) => void): this;
|
| 868 |
-
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
| 869 |
-
emit<E extends keyof T>(eventName: E, ...args: T[E]): boolean;
|
| 870 |
-
emit(eventName: string | symbol, ...args: any[]): boolean;
|
| 871 |
-
listenerCount<E extends keyof T>(eventName: E, listener?: (...args: T[E]) => void): number;
|
| 872 |
-
listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
|
| 873 |
-
listeners<E extends keyof T>(eventName: E): ((...args: T[E]) => void)[];
|
| 874 |
-
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
| 875 |
-
off<E extends keyof T>(eventName: E, listener: (...args: T[E]) => void): this;
|
| 876 |
-
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
| 877 |
-
on<E extends keyof T>(eventName: E, listener: (...args: T[E]) => void): this;
|
| 878 |
-
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
| 879 |
-
once<E extends keyof T>(eventName: E, listener: (...args: T[E]) => void): this;
|
| 880 |
-
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
| 881 |
-
prependListener<E extends keyof T>(eventName: E, listener: (...args: T[E]) => void): this;
|
| 882 |
-
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
| 883 |
-
prependOnceListener<E extends keyof T>(eventName: E, listener: (...args: T[E]) => void): this;
|
| 884 |
-
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
| 885 |
-
rawListeners<E extends keyof T>(eventName: E): ((...args: T[E]) => void)[];
|
| 886 |
-
rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
| 887 |
-
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
| 888 |
-
removeAllListeners<E extends keyof T>(eventName?: E): this;
|
| 889 |
-
removeAllListeners(eventName?: string | symbol): this;
|
| 890 |
-
removeListener<E extends keyof T>(eventName: E, listener: (...args: T[E]) => void): this;
|
| 891 |
-
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
| 892 |
-
}
|
| 893 |
-
interface EventEmitterReferencingAsyncResource extends AsyncResource {
|
| 894 |
-
readonly eventEmitter: EventEmitterAsyncResource;
|
| 895 |
-
}
|
| 896 |
-
interface EventEmitterAsyncResourceOptions extends AsyncResourceOptions, EventEmitterOptions {
|
| 897 |
-
/**
|
| 898 |
-
* The type of async event.
|
| 899 |
-
* @default new.target.name
|
| 900 |
-
*/
|
| 901 |
-
name?: string | undefined;
|
| 902 |
-
}
|
| 903 |
/**
|
| 904 |
-
*
|
| 905 |
-
* require manual async tracking. Specifically, all events emitted by instances
|
| 906 |
-
* of `events.EventEmitterAsyncResource` will run within its [async context](https://nodejs.org/docs/latest-v25.x/api/async_context.html).
|
| 907 |
-
*
|
| 908 |
-
* ```js
|
| 909 |
-
* import { EventEmitterAsyncResource, EventEmitter } from 'node:events';
|
| 910 |
-
* import { notStrictEqual, strictEqual } from 'node:assert';
|
| 911 |
-
* import { executionAsyncId, triggerAsyncId } from 'node:async_hooks';
|
| 912 |
*
|
| 913 |
-
*
|
| 914 |
-
*
|
|
|
|
|
|
|
|
|
|
| 915 |
*
|
| 916 |
-
*
|
| 917 |
-
*
|
| 918 |
-
*
|
| 919 |
-
* strictEqual(triggerAsyncId(), ee1.triggerAsyncId);
|
| 920 |
-
* });
|
| 921 |
*
|
| 922 |
-
*
|
| 923 |
*
|
| 924 |
-
*
|
| 925 |
-
*
|
| 926 |
-
* ee2.on('foo', () => {
|
| 927 |
-
* notStrictEqual(executionAsyncId(), ee2.asyncId);
|
| 928 |
-
* notStrictEqual(triggerAsyncId(), ee2.triggerAsyncId);
|
| 929 |
-
* });
|
| 930 |
*
|
| 931 |
-
*
|
| 932 |
-
*
|
| 933 |
-
*
|
| 934 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 935 |
* ```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 936 |
*
|
| 937 |
-
*
|
| 938 |
-
*
|
| 939 |
-
* @since
|
| 940 |
*/
|
| 941 |
-
|
| 942 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 943 |
/**
|
| 944 |
-
*
|
| 945 |
*/
|
| 946 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 947 |
/**
|
| 948 |
-
* The
|
| 949 |
-
*
|
|
|
|
| 950 |
*/
|
| 951 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 952 |
/**
|
| 953 |
* Call all `destroy` hooks. This should only ever be called once. An error will
|
| 954 |
* be thrown if it is called more than once. This **must** be manually called. If
|
|
@@ -957,17 +539,25 @@ declare module "node:events" {
|
|
| 957 |
*/
|
| 958 |
emitDestroy(): void;
|
| 959 |
/**
|
| 960 |
-
* The
|
| 961 |
-
*
|
|
|
|
|
|
|
|
|
|
| 962 |
*/
|
| 963 |
readonly triggerAsyncId: number;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 964 |
}
|
| 965 |
/**
|
| 966 |
* The `NodeEventTarget` is a Node.js-specific extension to `EventTarget`
|
| 967 |
* that emulates a subset of the `EventEmitter` API.
|
| 968 |
* @since v14.5.0
|
| 969 |
*/
|
| 970 |
-
interface NodeEventTarget extends EventTarget {
|
| 971 |
/**
|
| 972 |
* Node.js-specific extension to the `EventTarget` class that emulates the
|
| 973 |
* equivalent `EventEmitter` API. The only difference between `addListener()` and
|
|
@@ -1041,14 +631,347 @@ declare module "node:events" {
|
|
| 1041 |
*/
|
| 1042 |
removeListener(type: string, listener: (arg: any) => void, options?: EventListenerOptions): this;
|
| 1043 |
}
|
| 1044 |
-
|
| 1045 |
-
|
| 1046 |
-
|
| 1047 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1048 |
}
|
| 1049 |
export = EventEmitter;
|
| 1050 |
}
|
| 1051 |
-
declare module "events" {
|
| 1052 |
-
import events = require("
|
| 1053 |
export = events;
|
| 1054 |
}
|
|
|
|
| 32 |
* });
|
| 33 |
* myEmitter.emit('event');
|
| 34 |
* ```
|
| 35 |
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/events.js)
|
| 36 |
*/
|
| 37 |
+
declare module "events" {
|
| 38 |
import { AsyncResource, AsyncResourceOptions } from "node:async_hooks";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
interface EventEmitterOptions {
|
| 40 |
/**
|
| 41 |
+
* Enables automatic capturing of promise rejection.
|
|
|
|
|
|
|
| 42 |
*/
|
| 43 |
captureRejections?: boolean | undefined;
|
| 44 |
}
|
| 45 |
+
interface StaticEventEmitterOptions {
|
| 46 |
+
/**
|
| 47 |
+
* Can be used to cancel awaiting events.
|
| 48 |
+
*/
|
| 49 |
+
signal?: AbortSignal | undefined;
|
| 50 |
+
}
|
| 51 |
+
interface StaticEventEmitterIteratorOptions extends StaticEventEmitterOptions {
|
| 52 |
+
/**
|
| 53 |
+
* Names of events that will end the iteration.
|
| 54 |
+
*/
|
| 55 |
+
close?: string[] | undefined;
|
| 56 |
+
/**
|
| 57 |
+
* The high watermark. The emitter is paused every time the size of events being buffered is higher than it.
|
| 58 |
+
* Supported only on emitters implementing `pause()` and `resume()` methods.
|
| 59 |
+
* @default Number.MAX_SAFE_INTEGER
|
| 60 |
+
*/
|
| 61 |
+
highWaterMark?: number | undefined;
|
| 62 |
+
/**
|
| 63 |
+
* The low watermark. The emitter is resumed every time the size of events being buffered is lower than it.
|
| 64 |
+
* Supported only on emitters implementing `pause()` and `resume()` methods.
|
| 65 |
+
* @default 1
|
| 66 |
+
*/
|
| 67 |
+
lowWaterMark?: number | undefined;
|
| 68 |
+
}
|
| 69 |
+
interface EventEmitter<T extends EventMap<T> = DefaultEventMap> extends NodeJS.EventEmitter<T> {}
|
| 70 |
+
type EventMap<T> = Record<keyof T, any[]> | DefaultEventMap;
|
| 71 |
+
type DefaultEventMap = [never];
|
| 72 |
+
type AnyRest = [...args: any[]];
|
| 73 |
+
type Args<K, T> = T extends DefaultEventMap ? AnyRest : (
|
| 74 |
+
K extends keyof T ? T[K] : never
|
| 75 |
+
);
|
| 76 |
+
type Key<K, T> = T extends DefaultEventMap ? string | symbol : K | keyof T;
|
| 77 |
+
type Key2<K, T> = T extends DefaultEventMap ? string | symbol : K & keyof T;
|
| 78 |
+
type Listener<K, T, F> = T extends DefaultEventMap ? F : (
|
| 79 |
+
K extends keyof T ? (
|
| 80 |
+
T[K] extends unknown[] ? (...args: T[K]) => void : never
|
| 81 |
+
)
|
| 82 |
+
: never
|
| 83 |
+
);
|
| 84 |
+
type Listener1<K, T> = Listener<K, T, (...args: any[]) => void>;
|
| 85 |
+
type Listener2<K, T> = Listener<K, T, Function>;
|
| 86 |
+
|
| 87 |
/**
|
| 88 |
* The `EventEmitter` class is defined and exposed by the `node:events` module:
|
| 89 |
*
|
|
|
|
| 97 |
* It supports the following option:
|
| 98 |
* @since v0.1.26
|
| 99 |
*/
|
| 100 |
+
class EventEmitter<T extends EventMap<T> = DefaultEventMap> {
|
| 101 |
constructor(options?: EventEmitterOptions);
|
| 102 |
+
|
| 103 |
+
[EventEmitter.captureRejectionSymbol]?<K>(error: Error, event: Key<K, T>, ...args: Args<K, T>): void;
|
| 104 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
/**
|
| 106 |
+
* Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given
|
| 107 |
+
* event or that is rejected if the `EventEmitter` emits `'error'` while waiting.
|
| 108 |
+
* The `Promise` will resolve with an array of all the arguments emitted to the
|
| 109 |
+
* given event.
|
|
|
|
|
|
|
| 110 |
*
|
| 111 |
+
* This method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special`'error'` event
|
| 112 |
+
* semantics and does not listen to the `'error'` event.
|
|
|
|
|
|
|
| 113 |
*
|
| 114 |
+
* ```js
|
| 115 |
+
* import { once, EventEmitter } from 'node:events';
|
| 116 |
+
* import process from 'node:process';
|
|
|
|
|
|
|
| 117 |
*
|
| 118 |
+
* const ee = new EventEmitter();
|
|
|
|
|
|
|
| 119 |
*
|
| 120 |
+
* process.nextTick(() => {
|
| 121 |
+
* ee.emit('myevent', 42);
|
| 122 |
+
* });
|
| 123 |
+
*
|
| 124 |
+
* const [value] = await once(ee, 'myevent');
|
| 125 |
+
* console.log(value);
|
| 126 |
+
*
|
| 127 |
+
* const err = new Error('kaboom');
|
| 128 |
+
* process.nextTick(() => {
|
| 129 |
+
* ee.emit('error', err);
|
| 130 |
* });
|
| 131 |
+
*
|
| 132 |
+
* try {
|
| 133 |
+
* await once(ee, 'myevent');
|
| 134 |
+
* } catch (err) {
|
| 135 |
+
* console.error('error happened', err);
|
| 136 |
+
* }
|
| 137 |
* ```
|
| 138 |
*
|
| 139 |
+
* The special handling of the `'error'` event is only used when `events.once()` is used to wait for another event. If `events.once()` is used to wait for the
|
| 140 |
+
* '`error'` event itself, then it is treated as any other kind of event without
|
| 141 |
+
* special handling:
|
| 142 |
*
|
| 143 |
+
* ```js
|
| 144 |
+
* import { EventEmitter, once } from 'node:events';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
*
|
| 146 |
+
* const ee = new EventEmitter();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
*
|
| 148 |
+
* once(ee, 'error')
|
| 149 |
+
* .then(([err]) => console.log('ok', err.message))
|
| 150 |
+
* .catch((err) => console.error('error', err.message));
|
|
|
|
|
|
|
| 151 |
*
|
| 152 |
+
* ee.emit('error', new Error('boom'));
|
|
|
|
|
|
|
| 153 |
*
|
| 154 |
+
* // Prints: ok boom
|
| 155 |
+
* ```
|
| 156 |
+
*
|
| 157 |
+
* An `AbortSignal` can be used to cancel waiting for the event:
|
| 158 |
*
|
| 159 |
* ```js
|
| 160 |
+
* import { EventEmitter, once } from 'node:events';
|
| 161 |
*
|
| 162 |
+
* const ee = new EventEmitter();
|
| 163 |
+
* const ac = new AbortController();
|
| 164 |
+
*
|
| 165 |
+
* async function foo(emitter, event, signal) {
|
| 166 |
* try {
|
| 167 |
+
* await once(emitter, event, { signal });
|
| 168 |
+
* console.log('event emitted!');
|
| 169 |
+
* } catch (error) {
|
| 170 |
+
* if (error.name === 'AbortError') {
|
| 171 |
+
* console.error('Waiting for the event was canceled!');
|
| 172 |
+
* } else {
|
| 173 |
+
* console.error('There was an error', error.message);
|
| 174 |
+
* }
|
| 175 |
* }
|
| 176 |
* }
|
| 177 |
+
*
|
| 178 |
+
* foo(ee, 'foo', ac.signal);
|
| 179 |
+
* ac.abort(); // Abort waiting for the event
|
| 180 |
+
* ee.emit('foo'); // Prints: Waiting for the event was canceled!
|
| 181 |
* ```
|
| 182 |
+
* @since v11.13.0, v10.16.0
|
|
|
|
| 183 |
*/
|
| 184 |
+
static once(
|
| 185 |
+
emitter: NodeJS.EventEmitter,
|
| 186 |
+
eventName: string | symbol,
|
| 187 |
+
options?: StaticEventEmitterOptions,
|
| 188 |
+
): Promise<any[]>;
|
| 189 |
+
static once(emitter: EventTarget, eventName: string, options?: StaticEventEmitterOptions): Promise<any[]>;
|
| 190 |
/**
|
| 191 |
+
* ```js
|
| 192 |
+
* import { on, EventEmitter } from 'node:events';
|
| 193 |
+
* import process from 'node:process';
|
|
|
|
| 194 |
*
|
| 195 |
+
* const ee = new EventEmitter();
|
|
|
|
| 196 |
*
|
| 197 |
+
* // Emit later on
|
| 198 |
+
* process.nextTick(() => {
|
| 199 |
+
* ee.emit('foo', 'bar');
|
| 200 |
+
* ee.emit('foo', 42);
|
| 201 |
+
* });
|
| 202 |
*
|
| 203 |
+
* for await (const event of on(ee, 'foo')) {
|
| 204 |
+
* // The execution of this inner block is synchronous and it
|
| 205 |
+
* // processes one event at a time (even with await). Do not use
|
| 206 |
+
* // if concurrent execution is required.
|
| 207 |
+
* console.log(event); // prints ['bar'] [42]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 208 |
* }
|
| 209 |
+
* // Unreachable here
|
| 210 |
* ```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
*
|
| 212 |
+
* Returns an `AsyncIterator` that iterates `eventName` events. It will throw
|
| 213 |
+
* if the `EventEmitter` emits `'error'`. It removes all listeners when
|
| 214 |
+
* exiting the loop. The `value` returned by each iteration is an array
|
| 215 |
+
* composed of the emitted event arguments.
|
| 216 |
*
|
| 217 |
+
* An `AbortSignal` can be used to cancel waiting on events:
|
|
|
|
|
|
|
| 218 |
*
|
| 219 |
* ```js
|
| 220 |
+
* import { on, EventEmitter } from 'node:events';
|
| 221 |
+
* import process from 'node:process';
|
| 222 |
*
|
| 223 |
+
* const ac = new AbortController();
|
| 224 |
+
*
|
| 225 |
+
* (async () => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
* const ee = new EventEmitter();
|
| 227 |
*
|
| 228 |
* // Emit later on
|
|
|
|
| 242 |
*
|
| 243 |
* process.nextTick(() => ac.abort());
|
| 244 |
* ```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 245 |
*
|
| 246 |
+
* Use the `close` option to specify an array of event names that will end the iteration:
|
|
|
|
|
|
|
| 247 |
*
|
| 248 |
* ```js
|
| 249 |
+
* import { on, EventEmitter } from 'node:events';
|
| 250 |
* import process from 'node:process';
|
| 251 |
*
|
| 252 |
* const ee = new EventEmitter();
|
| 253 |
*
|
| 254 |
+
* // Emit later on
|
| 255 |
* process.nextTick(() => {
|
| 256 |
+
* ee.emit('foo', 'bar');
|
| 257 |
+
* ee.emit('foo', 42);
|
| 258 |
+
* ee.emit('close');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 259 |
* });
|
| 260 |
*
|
| 261 |
+
* for await (const event of on(ee, 'foo', { close: ['close'] })) {
|
| 262 |
+
* console.log(event); // prints ['bar'] [42]
|
|
|
|
|
|
|
| 263 |
* }
|
| 264 |
+
* // the loop will exit after 'close' is emitted
|
| 265 |
+
* console.log('done'); // prints 'done'
|
| 266 |
* ```
|
| 267 |
+
* @since v13.6.0, v12.16.0
|
| 268 |
+
* @return An `AsyncIterator` that iterates `eventName` events emitted by the `emitter`
|
| 269 |
+
*/
|
| 270 |
+
static on(
|
| 271 |
+
emitter: NodeJS.EventEmitter,
|
| 272 |
+
eventName: string | symbol,
|
| 273 |
+
options?: StaticEventEmitterIteratorOptions,
|
| 274 |
+
): NodeJS.AsyncIterator<any[]>;
|
| 275 |
+
static on(
|
| 276 |
+
emitter: EventTarget,
|
| 277 |
+
eventName: string,
|
| 278 |
+
options?: StaticEventEmitterIteratorOptions,
|
| 279 |
+
): NodeJS.AsyncIterator<any[]>;
|
| 280 |
+
/**
|
| 281 |
+
* A class method that returns the number of listeners for the given `eventName` registered on the given `emitter`.
|
| 282 |
*
|
| 283 |
* ```js
|
| 284 |
+
* import { EventEmitter, listenerCount } from 'node:events';
|
| 285 |
*
|
| 286 |
+
* const myEmitter = new EventEmitter();
|
| 287 |
+
* myEmitter.on('event', () => {});
|
| 288 |
+
* myEmitter.on('event', () => {});
|
| 289 |
+
* console.log(listenerCount(myEmitter, 'event'));
|
| 290 |
+
* // Prints: 2
|
| 291 |
+
* ```
|
| 292 |
+
* @since v0.9.12
|
| 293 |
+
* @deprecated Since v3.2.0 - Use `listenerCount` instead.
|
| 294 |
+
* @param emitter The emitter to query
|
| 295 |
+
* @param eventName The event name
|
| 296 |
+
*/
|
| 297 |
+
static listenerCount(emitter: NodeJS.EventEmitter, eventName: string | symbol): number;
|
| 298 |
+
/**
|
| 299 |
+
* Returns a copy of the array of listeners for the event named `eventName`.
|
| 300 |
*
|
| 301 |
+
* For `EventEmitter`s this behaves exactly the same as calling `.listeners` on
|
| 302 |
+
* the emitter.
|
|
|
|
| 303 |
*
|
| 304 |
+
* For `EventTarget`s this is the only way to get the event listeners for the
|
| 305 |
+
* event target. This is useful for debugging and diagnostic purposes.
|
| 306 |
*
|
| 307 |
+
* ```js
|
| 308 |
+
* import { getEventListeners, EventEmitter } from 'node:events';
|
| 309 |
+
*
|
| 310 |
+
* {
|
| 311 |
+
* const ee = new EventEmitter();
|
| 312 |
+
* const listener = () => console.log('Events are fun');
|
| 313 |
+
* ee.on('foo', listener);
|
| 314 |
+
* console.log(getEventListeners(ee, 'foo')); // [ [Function: listener] ]
|
| 315 |
+
* }
|
| 316 |
+
* {
|
| 317 |
+
* const et = new EventTarget();
|
| 318 |
+
* const listener = () => console.log('Events are fun');
|
| 319 |
+
* et.addEventListener('foo', listener);
|
| 320 |
+
* console.log(getEventListeners(et, 'foo')); // [ [Function: listener] ]
|
| 321 |
+
* }
|
| 322 |
* ```
|
| 323 |
+
* @since v15.2.0, v14.17.0
|
| 324 |
+
*/
|
| 325 |
+
static getEventListeners(emitter: EventTarget | NodeJS.EventEmitter, name: string | symbol): Function[];
|
| 326 |
+
/**
|
| 327 |
+
* Returns the currently set max amount of listeners.
|
| 328 |
*
|
| 329 |
+
* For `EventEmitter`s this behaves exactly the same as calling `.getMaxListeners` on
|
| 330 |
+
* the emitter.
|
| 331 |
*
|
| 332 |
+
* For `EventTarget`s this is the only way to get the max event listeners for the
|
| 333 |
+
* event target. If the number of event handlers on a single EventTarget exceeds
|
| 334 |
+
* the max set, the EventTarget will print a warning.
|
| 335 |
*
|
| 336 |
+
* ```js
|
| 337 |
+
* import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events';
|
| 338 |
*
|
| 339 |
+
* {
|
| 340 |
+
* const ee = new EventEmitter();
|
| 341 |
+
* console.log(getMaxListeners(ee)); // 10
|
| 342 |
+
* setMaxListeners(11, ee);
|
| 343 |
+
* console.log(getMaxListeners(ee)); // 11
|
| 344 |
+
* }
|
| 345 |
+
* {
|
| 346 |
+
* const et = new EventTarget();
|
| 347 |
+
* console.log(getMaxListeners(et)); // 10
|
| 348 |
+
* setMaxListeners(11, et);
|
| 349 |
+
* console.log(getMaxListeners(et)); // 11
|
| 350 |
* }
|
|
|
|
|
|
|
|
|
|
| 351 |
* ```
|
| 352 |
+
* @since v19.9.0
|
| 353 |
*/
|
| 354 |
+
static getMaxListeners(emitter: EventTarget | NodeJS.EventEmitter): number;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 355 |
/**
|
| 356 |
* ```js
|
| 357 |
* import { setMaxListeners, EventEmitter } from 'node:events';
|
|
|
|
| 363 |
* ```
|
| 364 |
* @since v15.4.0
|
| 365 |
* @param n A non-negative number. The maximum number of listeners per `EventTarget` event.
|
| 366 |
+
* @param eventTargets Zero or more {EventTarget} or {EventEmitter} instances. If none are specified, `n` is set as the default max for all newly created {EventTarget} and {EventEmitter}
|
|
|
|
|
|
|
| 367 |
* objects.
|
| 368 |
*/
|
| 369 |
+
static setMaxListeners(n?: number, ...eventTargets: Array<EventTarget | NodeJS.EventEmitter>): void;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 370 |
/**
|
| 371 |
+
* Listens once to the `abort` event on the provided `signal`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 372 |
*
|
| 373 |
+
* Listening to the `abort` event on abort signals is unsafe and may
|
| 374 |
+
* lead to resource leaks since another third party with the signal can
|
| 375 |
+
* call `e.stopImmediatePropagation()`. Unfortunately Node.js cannot change
|
| 376 |
+
* this since it would violate the web standard. Additionally, the original
|
| 377 |
+
* API makes it easy to forget to remove listeners.
|
| 378 |
*
|
| 379 |
+
* This API allows safely using `AbortSignal`s in Node.js APIs by solving these
|
| 380 |
+
* two issues by listening to the event such that `stopImmediatePropagation` does
|
| 381 |
+
* not prevent the listener from running.
|
|
|
|
|
|
|
| 382 |
*
|
| 383 |
+
* Returns a disposable so that it may be unsubscribed from more easily.
|
| 384 |
*
|
| 385 |
+
* ```js
|
| 386 |
+
* import { addAbortListener } from 'node:events';
|
|
|
|
|
|
|
|
|
|
|
|
|
| 387 |
*
|
| 388 |
+
* function example(signal) {
|
| 389 |
+
* let disposable;
|
| 390 |
+
* try {
|
| 391 |
+
* signal.addEventListener('abort', (e) => e.stopImmediatePropagation());
|
| 392 |
+
* disposable = addAbortListener(signal, (e) => {
|
| 393 |
+
* // Do something when signal is aborted.
|
| 394 |
+
* });
|
| 395 |
+
* } finally {
|
| 396 |
+
* disposable?.[Symbol.dispose]();
|
| 397 |
+
* }
|
| 398 |
+
* }
|
| 399 |
* ```
|
| 400 |
+
* @since v20.5.0
|
| 401 |
+
* @experimental
|
| 402 |
+
* @return Disposable that removes the `abort` listener.
|
| 403 |
+
*/
|
| 404 |
+
static addAbortListener(signal: AbortSignal, resource: (event: Event) => void): Disposable;
|
| 405 |
+
/**
|
| 406 |
+
* This symbol shall be used to install a listener for only monitoring `'error'` events. Listeners installed using this symbol are called before the regular `'error'` listeners are called.
|
| 407 |
*
|
| 408 |
+
* Installing a listener using this symbol does not change the behavior once an `'error'` event is emitted. Therefore, the process will still crash if no
|
| 409 |
+
* regular `'error'` listener is installed.
|
| 410 |
+
* @since v13.6.0, v12.17.0
|
| 411 |
*/
|
| 412 |
+
static readonly errorMonitor: unique symbol;
|
| 413 |
+
/**
|
| 414 |
+
* Value: `Symbol.for('nodejs.rejection')`
|
| 415 |
+
*
|
| 416 |
+
* See how to write a custom `rejection handler`.
|
| 417 |
+
* @since v13.4.0, v12.16.0
|
| 418 |
+
*/
|
| 419 |
+
static readonly captureRejectionSymbol: unique symbol;
|
| 420 |
+
/**
|
| 421 |
+
* Value: [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type)
|
| 422 |
+
*
|
| 423 |
+
* Change the default `captureRejections` option on all new `EventEmitter` objects.
|
| 424 |
+
* @since v13.4.0, v12.16.0
|
| 425 |
+
*/
|
| 426 |
+
static captureRejections: boolean;
|
| 427 |
+
/**
|
| 428 |
+
* By default, a maximum of `10` listeners can be registered for any single
|
| 429 |
+
* event. This limit can be changed for individual `EventEmitter` instances
|
| 430 |
+
* using the `emitter.setMaxListeners(n)` method. To change the default
|
| 431 |
+
* for _all_`EventEmitter` instances, the `events.defaultMaxListeners` property
|
| 432 |
+
* can be used. If this value is not a positive number, a `RangeError` is thrown.
|
| 433 |
+
*
|
| 434 |
+
* Take caution when setting the `events.defaultMaxListeners` because the
|
| 435 |
+
* change affects _all_ `EventEmitter` instances, including those created before
|
| 436 |
+
* the change is made. However, calling `emitter.setMaxListeners(n)` still has
|
| 437 |
+
* precedence over `events.defaultMaxListeners`.
|
| 438 |
+
*
|
| 439 |
+
* This is not a hard limit. The `EventEmitter` instance will allow
|
| 440 |
+
* more listeners to be added but will output a trace warning to stderr indicating
|
| 441 |
+
* that a "possible EventEmitter memory leak" has been detected. For any single
|
| 442 |
+
* `EventEmitter`, the `emitter.getMaxListeners()` and `emitter.setMaxListeners()` methods can be used to
|
| 443 |
+
* temporarily avoid this warning:
|
| 444 |
+
*
|
| 445 |
+
* ```js
|
| 446 |
+
* import { EventEmitter } from 'node:events';
|
| 447 |
+
* const emitter = new EventEmitter();
|
| 448 |
+
* emitter.setMaxListeners(emitter.getMaxListeners() + 1);
|
| 449 |
+
* emitter.once('event', () => {
|
| 450 |
+
* // do stuff
|
| 451 |
+
* emitter.setMaxListeners(Math.max(emitter.getMaxListeners() - 1, 0));
|
| 452 |
+
* });
|
| 453 |
+
* ```
|
| 454 |
+
*
|
| 455 |
+
* The `--trace-warnings` command-line flag can be used to display the
|
| 456 |
+
* stack trace for such warnings.
|
| 457 |
+
*
|
| 458 |
+
* The emitted warning can be inspected with `process.on('warning')` and will
|
| 459 |
+
* have the additional `emitter`, `type`, and `count` properties, referring to
|
| 460 |
+
* the event emitter instance, the event's name and the number of attached
|
| 461 |
+
* listeners, respectively.
|
| 462 |
+
* Its `name` property is set to `'MaxListenersExceededWarning'`.
|
| 463 |
+
* @since v0.11.2
|
| 464 |
+
*/
|
| 465 |
+
static defaultMaxListeners: number;
|
| 466 |
+
}
|
| 467 |
+
import internal = require("node:events");
|
| 468 |
+
namespace EventEmitter {
|
| 469 |
+
// Should just be `export { EventEmitter }`, but that doesn't work in TypeScript 3.4
|
| 470 |
+
export { internal as EventEmitter };
|
| 471 |
+
export interface Abortable {
|
| 472 |
/**
|
| 473 |
+
* When provided the corresponding `AbortController` can be used to cancel an asynchronous action.
|
| 474 |
*/
|
| 475 |
+
signal?: AbortSignal | undefined;
|
| 476 |
+
}
|
| 477 |
+
|
| 478 |
+
export interface EventEmitterReferencingAsyncResource extends AsyncResource {
|
| 479 |
+
readonly eventEmitter: EventEmitterAsyncResource;
|
| 480 |
+
}
|
| 481 |
+
|
| 482 |
+
export interface EventEmitterAsyncResourceOptions extends AsyncResourceOptions, EventEmitterOptions {
|
| 483 |
/**
|
| 484 |
+
* The type of async event, this is required when instantiating `EventEmitterAsyncResource`
|
| 485 |
+
* directly rather than as a child class.
|
| 486 |
+
* @default new.target.name if instantiated as a child class.
|
| 487 |
*/
|
| 488 |
+
name?: string | undefined;
|
| 489 |
+
}
|
| 490 |
+
|
| 491 |
+
/**
|
| 492 |
+
* Integrates `EventEmitter` with `AsyncResource` for `EventEmitter`s that
|
| 493 |
+
* require manual async tracking. Specifically, all events emitted by instances
|
| 494 |
+
* of `events.EventEmitterAsyncResource` will run within its `async context`.
|
| 495 |
+
*
|
| 496 |
+
* ```js
|
| 497 |
+
* import { EventEmitterAsyncResource, EventEmitter } from 'node:events';
|
| 498 |
+
* import { notStrictEqual, strictEqual } from 'node:assert';
|
| 499 |
+
* import { executionAsyncId, triggerAsyncId } from 'node:async_hooks';
|
| 500 |
+
*
|
| 501 |
+
* // Async tracking tooling will identify this as 'Q'.
|
| 502 |
+
* const ee1 = new EventEmitterAsyncResource({ name: 'Q' });
|
| 503 |
+
*
|
| 504 |
+
* // 'foo' listeners will run in the EventEmitters async context.
|
| 505 |
+
* ee1.on('foo', () => {
|
| 506 |
+
* strictEqual(executionAsyncId(), ee1.asyncId);
|
| 507 |
+
* strictEqual(triggerAsyncId(), ee1.triggerAsyncId);
|
| 508 |
+
* });
|
| 509 |
+
*
|
| 510 |
+
* const ee2 = new EventEmitter();
|
| 511 |
+
*
|
| 512 |
+
* // 'foo' listeners on ordinary EventEmitters that do not track async
|
| 513 |
+
* // context, however, run in the same async context as the emit().
|
| 514 |
+
* ee2.on('foo', () => {
|
| 515 |
+
* notStrictEqual(executionAsyncId(), ee2.asyncId);
|
| 516 |
+
* notStrictEqual(triggerAsyncId(), ee2.triggerAsyncId);
|
| 517 |
+
* });
|
| 518 |
+
*
|
| 519 |
+
* Promise.resolve().then(() => {
|
| 520 |
+
* ee1.emit('foo');
|
| 521 |
+
* ee2.emit('foo');
|
| 522 |
+
* });
|
| 523 |
+
* ```
|
| 524 |
+
*
|
| 525 |
+
* The `EventEmitterAsyncResource` class has the same methods and takes the
|
| 526 |
+
* same options as `EventEmitter` and `AsyncResource` themselves.
|
| 527 |
+
* @since v17.4.0, v16.14.0
|
| 528 |
+
*/
|
| 529 |
+
export class EventEmitterAsyncResource extends EventEmitter {
|
| 530 |
+
/**
|
| 531 |
+
* @param options Only optional in child class.
|
| 532 |
+
*/
|
| 533 |
+
constructor(options?: EventEmitterAsyncResourceOptions);
|
| 534 |
/**
|
| 535 |
* Call all `destroy` hooks. This should only ever be called once. An error will
|
| 536 |
* be thrown if it is called more than once. This **must** be manually called. If
|
|
|
|
| 539 |
*/
|
| 540 |
emitDestroy(): void;
|
| 541 |
/**
|
| 542 |
+
* The unique `asyncId` assigned to the resource.
|
| 543 |
+
*/
|
| 544 |
+
readonly asyncId: number;
|
| 545 |
+
/**
|
| 546 |
+
* The same triggerAsyncId that is passed to the AsyncResource constructor.
|
| 547 |
*/
|
| 548 |
readonly triggerAsyncId: number;
|
| 549 |
+
/**
|
| 550 |
+
* The returned `AsyncResource` object has an additional `eventEmitter` property
|
| 551 |
+
* that provides a reference to this `EventEmitterAsyncResource`.
|
| 552 |
+
*/
|
| 553 |
+
readonly asyncResource: EventEmitterReferencingAsyncResource;
|
| 554 |
}
|
| 555 |
/**
|
| 556 |
* The `NodeEventTarget` is a Node.js-specific extension to `EventTarget`
|
| 557 |
* that emulates a subset of the `EventEmitter` API.
|
| 558 |
* @since v14.5.0
|
| 559 |
*/
|
| 560 |
+
export interface NodeEventTarget extends EventTarget {
|
| 561 |
/**
|
| 562 |
* Node.js-specific extension to the `EventTarget` class that emulates the
|
| 563 |
* equivalent `EventEmitter` API. The only difference between `addListener()` and
|
|
|
|
| 631 |
*/
|
| 632 |
removeListener(type: string, listener: (arg: any) => void, options?: EventListenerOptions): this;
|
| 633 |
}
|
| 634 |
+
}
|
| 635 |
+
global {
|
| 636 |
+
namespace NodeJS {
|
| 637 |
+
interface EventEmitter<T extends EventMap<T> = DefaultEventMap> {
|
| 638 |
+
[EventEmitter.captureRejectionSymbol]?<K>(error: Error, event: Key<K, T>, ...args: Args<K, T>): void;
|
| 639 |
+
/**
|
| 640 |
+
* Alias for `emitter.on(eventName, listener)`.
|
| 641 |
+
* @since v0.1.26
|
| 642 |
+
*/
|
| 643 |
+
addListener<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
|
| 644 |
+
/**
|
| 645 |
+
* Adds the `listener` function to the end of the listeners array for the event
|
| 646 |
+
* named `eventName`. No checks are made to see if the `listener` has already
|
| 647 |
+
* been added. Multiple calls passing the same combination of `eventName` and
|
| 648 |
+
* `listener` will result in the `listener` being added, and called, multiple times.
|
| 649 |
+
*
|
| 650 |
+
* ```js
|
| 651 |
+
* server.on('connection', (stream) => {
|
| 652 |
+
* console.log('someone connected!');
|
| 653 |
+
* });
|
| 654 |
+
* ```
|
| 655 |
+
*
|
| 656 |
+
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
| 657 |
+
*
|
| 658 |
+
* By default, event listeners are invoked in the order they are added. The `emitter.prependListener()` method can be used as an alternative to add the
|
| 659 |
+
* event listener to the beginning of the listeners array.
|
| 660 |
+
*
|
| 661 |
+
* ```js
|
| 662 |
+
* import { EventEmitter } from 'node:events';
|
| 663 |
+
* const myEE = new EventEmitter();
|
| 664 |
+
* myEE.on('foo', () => console.log('a'));
|
| 665 |
+
* myEE.prependListener('foo', () => console.log('b'));
|
| 666 |
+
* myEE.emit('foo');
|
| 667 |
+
* // Prints:
|
| 668 |
+
* // b
|
| 669 |
+
* // a
|
| 670 |
+
* ```
|
| 671 |
+
* @since v0.1.101
|
| 672 |
+
* @param eventName The name of the event.
|
| 673 |
+
* @param listener The callback function
|
| 674 |
+
*/
|
| 675 |
+
on<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
|
| 676 |
+
/**
|
| 677 |
+
* Adds a **one-time** `listener` function for the event named `eventName`. The
|
| 678 |
+
* next time `eventName` is triggered, this listener is removed and then invoked.
|
| 679 |
+
*
|
| 680 |
+
* ```js
|
| 681 |
+
* server.once('connection', (stream) => {
|
| 682 |
+
* console.log('Ah, we have our first user!');
|
| 683 |
+
* });
|
| 684 |
+
* ```
|
| 685 |
+
*
|
| 686 |
+
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
| 687 |
+
*
|
| 688 |
+
* By default, event listeners are invoked in the order they are added. The `emitter.prependOnceListener()` method can be used as an alternative to add the
|
| 689 |
+
* event listener to the beginning of the listeners array.
|
| 690 |
+
*
|
| 691 |
+
* ```js
|
| 692 |
+
* import { EventEmitter } from 'node:events';
|
| 693 |
+
* const myEE = new EventEmitter();
|
| 694 |
+
* myEE.once('foo', () => console.log('a'));
|
| 695 |
+
* myEE.prependOnceListener('foo', () => console.log('b'));
|
| 696 |
+
* myEE.emit('foo');
|
| 697 |
+
* // Prints:
|
| 698 |
+
* // b
|
| 699 |
+
* // a
|
| 700 |
+
* ```
|
| 701 |
+
* @since v0.3.0
|
| 702 |
+
* @param eventName The name of the event.
|
| 703 |
+
* @param listener The callback function
|
| 704 |
+
*/
|
| 705 |
+
once<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
|
| 706 |
+
/**
|
| 707 |
+
* Removes the specified `listener` from the listener array for the event named `eventName`.
|
| 708 |
+
*
|
| 709 |
+
* ```js
|
| 710 |
+
* const callback = (stream) => {
|
| 711 |
+
* console.log('someone connected!');
|
| 712 |
+
* };
|
| 713 |
+
* server.on('connection', callback);
|
| 714 |
+
* // ...
|
| 715 |
+
* server.removeListener('connection', callback);
|
| 716 |
+
* ```
|
| 717 |
+
*
|
| 718 |
+
* `removeListener()` will remove, at most, one instance of a listener from the
|
| 719 |
+
* listener array. If any single listener has been added multiple times to the
|
| 720 |
+
* listener array for the specified `eventName`, then `removeListener()` must be
|
| 721 |
+
* called multiple times to remove each instance.
|
| 722 |
+
*
|
| 723 |
+
* Once an event is emitted, all listeners attached to it at the
|
| 724 |
+
* time of emitting are called in order. This implies that any `removeListener()` or `removeAllListeners()` calls _after_ emitting and _before_ the last listener finishes execution
|
| 725 |
+
* will not remove them from`emit()` in progress. Subsequent events behave as expected.
|
| 726 |
+
*
|
| 727 |
+
* ```js
|
| 728 |
+
* import { EventEmitter } from 'node:events';
|
| 729 |
+
* class MyEmitter extends EventEmitter {}
|
| 730 |
+
* const myEmitter = new MyEmitter();
|
| 731 |
+
*
|
| 732 |
+
* const callbackA = () => {
|
| 733 |
+
* console.log('A');
|
| 734 |
+
* myEmitter.removeListener('event', callbackB);
|
| 735 |
+
* };
|
| 736 |
+
*
|
| 737 |
+
* const callbackB = () => {
|
| 738 |
+
* console.log('B');
|
| 739 |
+
* };
|
| 740 |
+
*
|
| 741 |
+
* myEmitter.on('event', callbackA);
|
| 742 |
+
*
|
| 743 |
+
* myEmitter.on('event', callbackB);
|
| 744 |
+
*
|
| 745 |
+
* // callbackA removes listener callbackB but it will still be called.
|
| 746 |
+
* // Internal listener array at time of emit [callbackA, callbackB]
|
| 747 |
+
* myEmitter.emit('event');
|
| 748 |
+
* // Prints:
|
| 749 |
+
* // A
|
| 750 |
+
* // B
|
| 751 |
+
*
|
| 752 |
+
* // callbackB is now removed.
|
| 753 |
+
* // Internal listener array [callbackA]
|
| 754 |
+
* myEmitter.emit('event');
|
| 755 |
+
* // Prints:
|
| 756 |
+
* // A
|
| 757 |
+
* ```
|
| 758 |
+
*
|
| 759 |
+
* Because listeners are managed using an internal array, calling this will
|
| 760 |
+
* change the position indices of any listener registered _after_ the listener
|
| 761 |
+
* being removed. This will not impact the order in which listeners are called,
|
| 762 |
+
* but it means that any copies of the listener array as returned by
|
| 763 |
+
* the `emitter.listeners()` method will need to be recreated.
|
| 764 |
+
*
|
| 765 |
+
* When a single function has been added as a handler multiple times for a single
|
| 766 |
+
* event (as in the example below), `removeListener()` will remove the most
|
| 767 |
+
* recently added instance. In the example the `once('ping')` listener is removed:
|
| 768 |
+
*
|
| 769 |
+
* ```js
|
| 770 |
+
* import { EventEmitter } from 'node:events';
|
| 771 |
+
* const ee = new EventEmitter();
|
| 772 |
+
*
|
| 773 |
+
* function pong() {
|
| 774 |
+
* console.log('pong');
|
| 775 |
+
* }
|
| 776 |
+
*
|
| 777 |
+
* ee.on('ping', pong);
|
| 778 |
+
* ee.once('ping', pong);
|
| 779 |
+
* ee.removeListener('ping', pong);
|
| 780 |
+
*
|
| 781 |
+
* ee.emit('ping');
|
| 782 |
+
* ee.emit('ping');
|
| 783 |
+
* ```
|
| 784 |
+
*
|
| 785 |
+
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
| 786 |
+
* @since v0.1.26
|
| 787 |
+
*/
|
| 788 |
+
removeListener<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
|
| 789 |
+
/**
|
| 790 |
+
* Alias for `emitter.removeListener()`.
|
| 791 |
+
* @since v10.0.0
|
| 792 |
+
*/
|
| 793 |
+
off<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
|
| 794 |
+
/**
|
| 795 |
+
* Removes all listeners, or those of the specified `eventName`.
|
| 796 |
+
*
|
| 797 |
+
* It is bad practice to remove listeners added elsewhere in the code,
|
| 798 |
+
* particularly when the `EventEmitter` instance was created by some other
|
| 799 |
+
* component or module (e.g. sockets or file streams).
|
| 800 |
+
*
|
| 801 |
+
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
| 802 |
+
* @since v0.1.26
|
| 803 |
+
*/
|
| 804 |
+
removeAllListeners(eventName?: Key<unknown, T>): this;
|
| 805 |
+
/**
|
| 806 |
+
* By default `EventEmitter`s will print a warning if more than `10` listeners are
|
| 807 |
+
* added for a particular event. This is a useful default that helps finding
|
| 808 |
+
* memory leaks. The `emitter.setMaxListeners()` method allows the limit to be
|
| 809 |
+
* modified for this specific `EventEmitter` instance. The value can be set to `Infinity` (or `0`) to indicate an unlimited number of listeners.
|
| 810 |
+
*
|
| 811 |
+
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
| 812 |
+
* @since v0.3.5
|
| 813 |
+
*/
|
| 814 |
+
setMaxListeners(n: number): this;
|
| 815 |
+
/**
|
| 816 |
+
* Returns the current max listener value for the `EventEmitter` which is either
|
| 817 |
+
* set by `emitter.setMaxListeners(n)` or defaults to {@link EventEmitter.defaultMaxListeners}.
|
| 818 |
+
* @since v1.0.0
|
| 819 |
+
*/
|
| 820 |
+
getMaxListeners(): number;
|
| 821 |
+
/**
|
| 822 |
+
* Returns a copy of the array of listeners for the event named `eventName`.
|
| 823 |
+
*
|
| 824 |
+
* ```js
|
| 825 |
+
* server.on('connection', (stream) => {
|
| 826 |
+
* console.log('someone connected!');
|
| 827 |
+
* });
|
| 828 |
+
* console.log(util.inspect(server.listeners('connection')));
|
| 829 |
+
* // Prints: [ [Function] ]
|
| 830 |
+
* ```
|
| 831 |
+
* @since v0.1.26
|
| 832 |
+
*/
|
| 833 |
+
listeners<K>(eventName: Key<K, T>): Array<Listener2<K, T>>;
|
| 834 |
+
/**
|
| 835 |
+
* Returns a copy of the array of listeners for the event named `eventName`,
|
| 836 |
+
* including any wrappers (such as those created by `.once()`).
|
| 837 |
+
*
|
| 838 |
+
* ```js
|
| 839 |
+
* import { EventEmitter } from 'node:events';
|
| 840 |
+
* const emitter = new EventEmitter();
|
| 841 |
+
* emitter.once('log', () => console.log('log once'));
|
| 842 |
+
*
|
| 843 |
+
* // Returns a new Array with a function `onceWrapper` which has a property
|
| 844 |
+
* // `listener` which contains the original listener bound above
|
| 845 |
+
* const listeners = emitter.rawListeners('log');
|
| 846 |
+
* const logFnWrapper = listeners[0];
|
| 847 |
+
*
|
| 848 |
+
* // Logs "log once" to the console and does not unbind the `once` event
|
| 849 |
+
* logFnWrapper.listener();
|
| 850 |
+
*
|
| 851 |
+
* // Logs "log once" to the console and removes the listener
|
| 852 |
+
* logFnWrapper();
|
| 853 |
+
*
|
| 854 |
+
* emitter.on('log', () => console.log('log persistently'));
|
| 855 |
+
* // Will return a new Array with a single function bound by `.on()` above
|
| 856 |
+
* const newListeners = emitter.rawListeners('log');
|
| 857 |
+
*
|
| 858 |
+
* // Logs "log persistently" twice
|
| 859 |
+
* newListeners[0]();
|
| 860 |
+
* emitter.emit('log');
|
| 861 |
+
* ```
|
| 862 |
+
* @since v9.4.0
|
| 863 |
+
*/
|
| 864 |
+
rawListeners<K>(eventName: Key<K, T>): Array<Listener2<K, T>>;
|
| 865 |
+
/**
|
| 866 |
+
* Synchronously calls each of the listeners registered for the event named `eventName`, in the order they were registered, passing the supplied arguments
|
| 867 |
+
* to each.
|
| 868 |
+
*
|
| 869 |
+
* Returns `true` if the event had listeners, `false` otherwise.
|
| 870 |
+
*
|
| 871 |
+
* ```js
|
| 872 |
+
* import { EventEmitter } from 'node:events';
|
| 873 |
+
* const myEmitter = new EventEmitter();
|
| 874 |
+
*
|
| 875 |
+
* // First listener
|
| 876 |
+
* myEmitter.on('event', function firstListener() {
|
| 877 |
+
* console.log('Helloooo! first listener');
|
| 878 |
+
* });
|
| 879 |
+
* // Second listener
|
| 880 |
+
* myEmitter.on('event', function secondListener(arg1, arg2) {
|
| 881 |
+
* console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
|
| 882 |
+
* });
|
| 883 |
+
* // Third listener
|
| 884 |
+
* myEmitter.on('event', function thirdListener(...args) {
|
| 885 |
+
* const parameters = args.join(', ');
|
| 886 |
+
* console.log(`event with parameters ${parameters} in third listener`);
|
| 887 |
+
* });
|
| 888 |
+
*
|
| 889 |
+
* console.log(myEmitter.listeners('event'));
|
| 890 |
+
*
|
| 891 |
+
* myEmitter.emit('event', 1, 2, 3, 4, 5);
|
| 892 |
+
*
|
| 893 |
+
* // Prints:
|
| 894 |
+
* // [
|
| 895 |
+
* // [Function: firstListener],
|
| 896 |
+
* // [Function: secondListener],
|
| 897 |
+
* // [Function: thirdListener]
|
| 898 |
+
* // ]
|
| 899 |
+
* // Helloooo! first listener
|
| 900 |
+
* // event with parameters 1, 2 in second listener
|
| 901 |
+
* // event with parameters 1, 2, 3, 4, 5 in third listener
|
| 902 |
+
* ```
|
| 903 |
+
* @since v0.1.26
|
| 904 |
+
*/
|
| 905 |
+
emit<K>(eventName: Key<K, T>, ...args: Args<K, T>): boolean;
|
| 906 |
+
/**
|
| 907 |
+
* Returns the number of listeners listening for the event named `eventName`.
|
| 908 |
+
* If `listener` is provided, it will return how many times the listener is found
|
| 909 |
+
* in the list of the listeners of the event.
|
| 910 |
+
* @since v3.2.0
|
| 911 |
+
* @param eventName The name of the event being listened for
|
| 912 |
+
* @param listener The event handler function
|
| 913 |
+
*/
|
| 914 |
+
listenerCount<K>(eventName: Key<K, T>, listener?: Listener2<K, T>): number;
|
| 915 |
+
/**
|
| 916 |
+
* Adds the `listener` function to the _beginning_ of the listeners array for the
|
| 917 |
+
* event named `eventName`. No checks are made to see if the `listener` has
|
| 918 |
+
* already been added. Multiple calls passing the same combination of `eventName`
|
| 919 |
+
* and `listener` will result in the `listener` being added, and called, multiple times.
|
| 920 |
+
*
|
| 921 |
+
* ```js
|
| 922 |
+
* server.prependListener('connection', (stream) => {
|
| 923 |
+
* console.log('someone connected!');
|
| 924 |
+
* });
|
| 925 |
+
* ```
|
| 926 |
+
*
|
| 927 |
+
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
| 928 |
+
* @since v6.0.0
|
| 929 |
+
* @param eventName The name of the event.
|
| 930 |
+
* @param listener The callback function
|
| 931 |
+
*/
|
| 932 |
+
prependListener<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
|
| 933 |
+
/**
|
| 934 |
+
* Adds a **one-time**`listener` function for the event named `eventName` to the _beginning_ of the listeners array. The next time `eventName` is triggered, this
|
| 935 |
+
* listener is removed, and then invoked.
|
| 936 |
+
*
|
| 937 |
+
* ```js
|
| 938 |
+
* server.prependOnceListener('connection', (stream) => {
|
| 939 |
+
* console.log('Ah, we have our first user!');
|
| 940 |
+
* });
|
| 941 |
+
* ```
|
| 942 |
+
*
|
| 943 |
+
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
| 944 |
+
* @since v6.0.0
|
| 945 |
+
* @param eventName The name of the event.
|
| 946 |
+
* @param listener The callback function
|
| 947 |
+
*/
|
| 948 |
+
prependOnceListener<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
|
| 949 |
+
/**
|
| 950 |
+
* Returns an array listing the events for which the emitter has registered
|
| 951 |
+
* listeners. The values in the array are strings or `Symbol`s.
|
| 952 |
+
*
|
| 953 |
+
* ```js
|
| 954 |
+
* import { EventEmitter } from 'node:events';
|
| 955 |
+
*
|
| 956 |
+
* const myEE = new EventEmitter();
|
| 957 |
+
* myEE.on('foo', () => {});
|
| 958 |
+
* myEE.on('bar', () => {});
|
| 959 |
+
*
|
| 960 |
+
* const sym = Symbol('symbol');
|
| 961 |
+
* myEE.on(sym, () => {});
|
| 962 |
+
*
|
| 963 |
+
* console.log(myEE.eventNames());
|
| 964 |
+
* // Prints: [ 'foo', 'bar', Symbol(symbol) ]
|
| 965 |
+
* ```
|
| 966 |
+
* @since v6.0.0
|
| 967 |
+
*/
|
| 968 |
+
eventNames(): Array<(string | symbol) & Key2<unknown, T>>;
|
| 969 |
+
}
|
| 970 |
+
}
|
| 971 |
}
|
| 972 |
export = EventEmitter;
|
| 973 |
}
|
| 974 |
+
declare module "node:events" {
|
| 975 |
+
import events = require("events");
|
| 976 |
export = events;
|
| 977 |
}
|
node_modules/@types/node/fs.d.ts
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
node_modules/@types/node/fs/promises.d.ts
CHANGED
|
@@ -8,10 +8,11 @@
|
|
| 8 |
* concurrent modifications on the same file or data corruption may occur.
|
| 9 |
* @since v10.0.0
|
| 10 |
*/
|
| 11 |
-
declare module "
|
| 12 |
import { NonSharedBuffer } from "node:buffer";
|
| 13 |
import { Abortable } from "node:events";
|
| 14 |
-
import {
|
|
|
|
| 15 |
import {
|
| 16 |
BigIntStats,
|
| 17 |
BigIntStatsFs,
|
|
@@ -20,10 +21,6 @@ declare module "node:fs/promises" {
|
|
| 20 |
CopyOptions,
|
| 21 |
Dir,
|
| 22 |
Dirent,
|
| 23 |
-
EncodingOption,
|
| 24 |
-
GlobOptions,
|
| 25 |
-
GlobOptionsWithFileTypes,
|
| 26 |
-
GlobOptionsWithoutFileTypes,
|
| 27 |
MakeDirectoryOptions,
|
| 28 |
Mode,
|
| 29 |
ObjectEncodingOptions,
|
|
@@ -32,9 +29,9 @@ declare module "node:fs/promises" {
|
|
| 32 |
PathLike,
|
| 33 |
ReadOptions,
|
| 34 |
ReadOptionsWithBuffer,
|
| 35 |
-
ReadPosition,
|
| 36 |
ReadStream,
|
| 37 |
ReadVResult,
|
|
|
|
| 38 |
RmOptions,
|
| 39 |
StatFsOptions,
|
| 40 |
StatOptions,
|
|
@@ -42,12 +39,11 @@ declare module "node:fs/promises" {
|
|
| 42 |
StatsFs,
|
| 43 |
TimeLike,
|
| 44 |
WatchEventType,
|
| 45 |
-
WatchOptions
|
| 46 |
WriteStream,
|
| 47 |
WriteVResult,
|
| 48 |
} from "node:fs";
|
| 49 |
-
import {
|
| 50 |
-
import { ReadableStream } from "node:stream/web";
|
| 51 |
interface FileChangeInfo<T extends string | Buffer> {
|
| 52 |
eventType: WatchEventType;
|
| 53 |
filename: T | null;
|
|
@@ -74,7 +70,7 @@ declare module "node:fs/promises" {
|
|
| 74 |
* @default `buffer.byteLength`
|
| 75 |
*/
|
| 76 |
length?: number | null;
|
| 77 |
-
position?:
|
| 78 |
}
|
| 79 |
interface CreateReadStreamOptions extends Abortable {
|
| 80 |
encoding?: BufferEncoding | null | undefined;
|
|
@@ -93,7 +89,11 @@ declare module "node:fs/promises" {
|
|
| 93 |
flush?: boolean | undefined;
|
| 94 |
}
|
| 95 |
interface ReadableWebStreamOptions {
|
| 96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
}
|
| 98 |
// TODO: Add `EventEmitter` close
|
| 99 |
interface FileHandle {
|
|
@@ -237,7 +237,7 @@ declare module "node:fs/promises" {
|
|
| 237 |
buffer: T,
|
| 238 |
offset?: number | null,
|
| 239 |
length?: number | null,
|
| 240 |
-
position?:
|
| 241 |
): Promise<FileReadResult<T>>;
|
| 242 |
read<T extends NodeJS.ArrayBufferView>(
|
| 243 |
buffer: T,
|
|
@@ -247,8 +247,7 @@ declare module "node:fs/promises" {
|
|
| 247 |
options?: ReadOptionsWithBuffer<T>,
|
| 248 |
): Promise<FileReadResult<T>>;
|
| 249 |
/**
|
| 250 |
-
* Returns a
|
| 251 |
-
* contents.
|
| 252 |
*
|
| 253 |
* An error will be thrown if this method is called more than once or is called
|
| 254 |
* after the `FileHandle` is closed or closing.
|
|
@@ -269,6 +268,7 @@ declare module "node:fs/promises" {
|
|
| 269 |
* While the `ReadableStream` will read the file to completion, it will not
|
| 270 |
* close the `FileHandle` automatically. User code must still call the`fileHandle.close()` method.
|
| 271 |
* @since v17.0.0
|
|
|
|
| 272 |
*/
|
| 273 |
readableWebStream(options?: ReadableWebStreamOptions): ReadableStream;
|
| 274 |
/**
|
|
@@ -426,13 +426,6 @@ declare module "node:fs/promises" {
|
|
| 426 |
bytesWritten: number;
|
| 427 |
buffer: TBuffer;
|
| 428 |
}>;
|
| 429 |
-
write<TBuffer extends Uint8Array>(
|
| 430 |
-
buffer: TBuffer,
|
| 431 |
-
options?: { offset?: number; length?: number; position?: number },
|
| 432 |
-
): Promise<{
|
| 433 |
-
bytesWritten: number;
|
| 434 |
-
buffer: TBuffer;
|
| 435 |
-
}>;
|
| 436 |
write(
|
| 437 |
data: string,
|
| 438 |
position?: number | null,
|
|
@@ -489,9 +482,8 @@ declare module "node:fs/promises" {
|
|
| 489 |
*/
|
| 490 |
close(): Promise<void>;
|
| 491 |
/**
|
| 492 |
-
*
|
| 493 |
-
*
|
| 494 |
-
* @since v20.4.0, v18.8.0
|
| 495 |
*/
|
| 496 |
[Symbol.asyncDispose](): Promise<void>;
|
| 497 |
}
|
|
@@ -600,7 +592,7 @@ declare module "node:fs/promises" {
|
|
| 600 |
* @since v10.0.0
|
| 601 |
* @return Fulfills with `undefined` upon success.
|
| 602 |
*/
|
| 603 |
-
function rmdir(path: PathLike): Promise<void>;
|
| 604 |
/**
|
| 605 |
* Removes files and directories (modeled on the standard POSIX `rm` utility).
|
| 606 |
* @since v14.14.0
|
|
@@ -959,7 +951,7 @@ declare module "node:fs/promises" {
|
|
| 959 |
* The `fsPromises.mkdtemp()` method will append the six randomly selected
|
| 960 |
* characters directly to the `prefix` string. For instance, given a directory `/tmp`, if the intention is to create a temporary directory _within_ `/tmp`, the `prefix` must end with a trailing
|
| 961 |
* platform-specific path separator
|
| 962 |
-
* (`import { sep } from 'node:path'`).
|
| 963 |
* @since v10.0.0
|
| 964 |
* @return Fulfills with a string containing the file system path of the newly created temporary directory.
|
| 965 |
*/
|
|
@@ -979,40 +971,6 @@ declare module "node:fs/promises" {
|
|
| 979 |
prefix: string,
|
| 980 |
options?: ObjectEncodingOptions | BufferEncoding | null,
|
| 981 |
): Promise<string | NonSharedBuffer>;
|
| 982 |
-
interface DisposableTempDir extends AsyncDisposable {
|
| 983 |
-
/**
|
| 984 |
-
* The path of the created directory.
|
| 985 |
-
*/
|
| 986 |
-
path: string;
|
| 987 |
-
/**
|
| 988 |
-
* A function which removes the created directory.
|
| 989 |
-
*/
|
| 990 |
-
remove(): Promise<void>;
|
| 991 |
-
/**
|
| 992 |
-
* The same as `remove`.
|
| 993 |
-
*/
|
| 994 |
-
[Symbol.asyncDispose](): Promise<void>;
|
| 995 |
-
}
|
| 996 |
-
/**
|
| 997 |
-
* The resulting Promise holds an async-disposable object whose `path` property
|
| 998 |
-
* holds the created directory path. When the object is disposed, the directory
|
| 999 |
-
* and its contents will be removed asynchronously if it still exists. If the
|
| 1000 |
-
* directory cannot be deleted, disposal will throw an error. The object has an
|
| 1001 |
-
* async `remove()` method which will perform the same task.
|
| 1002 |
-
*
|
| 1003 |
-
* Both this function and the disposal function on the resulting object are
|
| 1004 |
-
* async, so it should be used with `await` + `await using` as in
|
| 1005 |
-
* `await using dir = await fsPromises.mkdtempDisposable('prefix')`.
|
| 1006 |
-
*
|
| 1007 |
-
* <!-- TODO: link MDN docs for disposables once https://github.com/mdn/content/pull/38027 lands -->
|
| 1008 |
-
*
|
| 1009 |
-
* For detailed information, see the documentation of `fsPromises.mkdtemp()`.
|
| 1010 |
-
*
|
| 1011 |
-
* The optional `options` argument can be a string specifying an encoding, or an
|
| 1012 |
-
* object with an `encoding` property specifying the character encoding to use.
|
| 1013 |
-
* @since v24.4.0
|
| 1014 |
-
*/
|
| 1015 |
-
function mkdtempDisposable(prefix: PathLike, options?: EncodingOption): Promise<DisposableTempDir>;
|
| 1016 |
/**
|
| 1017 |
* Asynchronously writes data to a file, replacing the file if it already exists. `data` can be a string, a buffer, an
|
| 1018 |
* [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an
|
|
@@ -1234,16 +1192,6 @@ declare module "node:fs/promises" {
|
|
| 1234 |
* @return Fulfills with an {fs.Dir}.
|
| 1235 |
*/
|
| 1236 |
function opendir(path: PathLike, options?: OpenDirOptions): Promise<Dir>;
|
| 1237 |
-
interface WatchOptions extends _WatchOptions {
|
| 1238 |
-
maxQueue?: number | undefined;
|
| 1239 |
-
overflow?: "ignore" | "throw" | undefined;
|
| 1240 |
-
}
|
| 1241 |
-
interface WatchOptionsWithBufferEncoding extends WatchOptions {
|
| 1242 |
-
encoding: "buffer";
|
| 1243 |
-
}
|
| 1244 |
-
interface WatchOptionsWithStringEncoding extends WatchOptions {
|
| 1245 |
-
encoding?: BufferEncoding | undefined;
|
| 1246 |
-
}
|
| 1247 |
/**
|
| 1248 |
* Returns an async iterator that watches for changes on `filename`, where `filename`is either a file or a directory.
|
| 1249 |
*
|
|
@@ -1276,16 +1224,33 @@ declare module "node:fs/promises" {
|
|
| 1276 |
*/
|
| 1277 |
function watch(
|
| 1278 |
filename: PathLike,
|
| 1279 |
-
options
|
| 1280 |
-
|
| 1281 |
-
|
| 1282 |
-
|
| 1283 |
-
|
| 1284 |
-
):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1285 |
function watch(
|
| 1286 |
filename: PathLike,
|
| 1287 |
-
options: WatchOptions |
|
| 1288 |
-
):
|
| 1289 |
/**
|
| 1290 |
* Asynchronously copies the entire directory structure from `src` to `dest`,
|
| 1291 |
* including subdirectories and files.
|
|
@@ -1299,31 +1264,7 @@ declare module "node:fs/promises" {
|
|
| 1299 |
* @return Fulfills with `undefined` upon success.
|
| 1300 |
*/
|
| 1301 |
function cp(source: string | URL, destination: string | URL, opts?: CopyOptions): Promise<void>;
|
| 1302 |
-
/**
|
| 1303 |
-
* ```js
|
| 1304 |
-
* import { glob } from 'node:fs/promises';
|
| 1305 |
-
*
|
| 1306 |
-
* for await (const entry of glob('*.js'))
|
| 1307 |
-
* console.log(entry);
|
| 1308 |
-
* ```
|
| 1309 |
-
* @since v22.0.0
|
| 1310 |
-
* @returns An AsyncIterator that yields the paths of files
|
| 1311 |
-
* that match the pattern.
|
| 1312 |
-
*/
|
| 1313 |
-
function glob(pattern: string | readonly string[]): NodeJS.AsyncIterator<string>;
|
| 1314 |
-
function glob(
|
| 1315 |
-
pattern: string | readonly string[],
|
| 1316 |
-
options: GlobOptionsWithFileTypes,
|
| 1317 |
-
): NodeJS.AsyncIterator<Dirent>;
|
| 1318 |
-
function glob(
|
| 1319 |
-
pattern: string | readonly string[],
|
| 1320 |
-
options: GlobOptionsWithoutFileTypes,
|
| 1321 |
-
): NodeJS.AsyncIterator<string>;
|
| 1322 |
-
function glob(
|
| 1323 |
-
pattern: string | readonly string[],
|
| 1324 |
-
options: GlobOptions,
|
| 1325 |
-
): NodeJS.AsyncIterator<Dirent | string>;
|
| 1326 |
}
|
| 1327 |
-
declare module "fs/promises" {
|
| 1328 |
-
export * from "
|
| 1329 |
}
|
|
|
|
| 8 |
* concurrent modifications on the same file or data corruption may occur.
|
| 9 |
* @since v10.0.0
|
| 10 |
*/
|
| 11 |
+
declare module "fs/promises" {
|
| 12 |
import { NonSharedBuffer } from "node:buffer";
|
| 13 |
import { Abortable } from "node:events";
|
| 14 |
+
import { Stream } from "node:stream";
|
| 15 |
+
import { ReadableStream } from "node:stream/web";
|
| 16 |
import {
|
| 17 |
BigIntStats,
|
| 18 |
BigIntStatsFs,
|
|
|
|
| 21 |
CopyOptions,
|
| 22 |
Dir,
|
| 23 |
Dirent,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
MakeDirectoryOptions,
|
| 25 |
Mode,
|
| 26 |
ObjectEncodingOptions,
|
|
|
|
| 29 |
PathLike,
|
| 30 |
ReadOptions,
|
| 31 |
ReadOptionsWithBuffer,
|
|
|
|
| 32 |
ReadStream,
|
| 33 |
ReadVResult,
|
| 34 |
+
RmDirOptions,
|
| 35 |
RmOptions,
|
| 36 |
StatFsOptions,
|
| 37 |
StatOptions,
|
|
|
|
| 39 |
StatsFs,
|
| 40 |
TimeLike,
|
| 41 |
WatchEventType,
|
| 42 |
+
WatchOptions,
|
| 43 |
WriteStream,
|
| 44 |
WriteVResult,
|
| 45 |
} from "node:fs";
|
| 46 |
+
import { Interface as ReadlineInterface } from "node:readline";
|
|
|
|
| 47 |
interface FileChangeInfo<T extends string | Buffer> {
|
| 48 |
eventType: WatchEventType;
|
| 49 |
filename: T | null;
|
|
|
|
| 70 |
* @default `buffer.byteLength`
|
| 71 |
*/
|
| 72 |
length?: number | null;
|
| 73 |
+
position?: number | null;
|
| 74 |
}
|
| 75 |
interface CreateReadStreamOptions extends Abortable {
|
| 76 |
encoding?: BufferEncoding | null | undefined;
|
|
|
|
| 89 |
flush?: boolean | undefined;
|
| 90 |
}
|
| 91 |
interface ReadableWebStreamOptions {
|
| 92 |
+
/**
|
| 93 |
+
* Whether to open a normal or a `'bytes'` stream.
|
| 94 |
+
* @since v20.0.0
|
| 95 |
+
*/
|
| 96 |
+
type?: "bytes" | undefined;
|
| 97 |
}
|
| 98 |
// TODO: Add `EventEmitter` close
|
| 99 |
interface FileHandle {
|
|
|
|
| 237 |
buffer: T,
|
| 238 |
offset?: number | null,
|
| 239 |
length?: number | null,
|
| 240 |
+
position?: number | null,
|
| 241 |
): Promise<FileReadResult<T>>;
|
| 242 |
read<T extends NodeJS.ArrayBufferView>(
|
| 243 |
buffer: T,
|
|
|
|
| 247 |
options?: ReadOptionsWithBuffer<T>,
|
| 248 |
): Promise<FileReadResult<T>>;
|
| 249 |
/**
|
| 250 |
+
* Returns a `ReadableStream` that may be used to read the files data.
|
|
|
|
| 251 |
*
|
| 252 |
* An error will be thrown if this method is called more than once or is called
|
| 253 |
* after the `FileHandle` is closed or closing.
|
|
|
|
| 268 |
* While the `ReadableStream` will read the file to completion, it will not
|
| 269 |
* close the `FileHandle` automatically. User code must still call the`fileHandle.close()` method.
|
| 270 |
* @since v17.0.0
|
| 271 |
+
* @experimental
|
| 272 |
*/
|
| 273 |
readableWebStream(options?: ReadableWebStreamOptions): ReadableStream;
|
| 274 |
/**
|
|
|
|
| 426 |
bytesWritten: number;
|
| 427 |
buffer: TBuffer;
|
| 428 |
}>;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 429 |
write(
|
| 430 |
data: string,
|
| 431 |
position?: number | null,
|
|
|
|
| 482 |
*/
|
| 483 |
close(): Promise<void>;
|
| 484 |
/**
|
| 485 |
+
* An alias for {@link FileHandle.close()}.
|
| 486 |
+
* @since v20.4.0
|
|
|
|
| 487 |
*/
|
| 488 |
[Symbol.asyncDispose](): Promise<void>;
|
| 489 |
}
|
|
|
|
| 592 |
* @since v10.0.0
|
| 593 |
* @return Fulfills with `undefined` upon success.
|
| 594 |
*/
|
| 595 |
+
function rmdir(path: PathLike, options?: RmDirOptions): Promise<void>;
|
| 596 |
/**
|
| 597 |
* Removes files and directories (modeled on the standard POSIX `rm` utility).
|
| 598 |
* @since v14.14.0
|
|
|
|
| 951 |
* The `fsPromises.mkdtemp()` method will append the six randomly selected
|
| 952 |
* characters directly to the `prefix` string. For instance, given a directory `/tmp`, if the intention is to create a temporary directory _within_ `/tmp`, the `prefix` must end with a trailing
|
| 953 |
* platform-specific path separator
|
| 954 |
+
* (`import { sep } from 'node:node:path'`).
|
| 955 |
* @since v10.0.0
|
| 956 |
* @return Fulfills with a string containing the file system path of the newly created temporary directory.
|
| 957 |
*/
|
|
|
|
| 971 |
prefix: string,
|
| 972 |
options?: ObjectEncodingOptions | BufferEncoding | null,
|
| 973 |
): Promise<string | NonSharedBuffer>;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 974 |
/**
|
| 975 |
* Asynchronously writes data to a file, replacing the file if it already exists. `data` can be a string, a buffer, an
|
| 976 |
* [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an
|
|
|
|
| 1192 |
* @return Fulfills with an {fs.Dir}.
|
| 1193 |
*/
|
| 1194 |
function opendir(path: PathLike, options?: OpenDirOptions): Promise<Dir>;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1195 |
/**
|
| 1196 |
* Returns an async iterator that watches for changes on `filename`, where `filename`is either a file or a directory.
|
| 1197 |
*
|
|
|
|
| 1224 |
*/
|
| 1225 |
function watch(
|
| 1226 |
filename: PathLike,
|
| 1227 |
+
options:
|
| 1228 |
+
| (WatchOptions & {
|
| 1229 |
+
encoding: "buffer";
|
| 1230 |
+
})
|
| 1231 |
+
| "buffer",
|
| 1232 |
+
): AsyncIterable<FileChangeInfo<NonSharedBuffer>>;
|
| 1233 |
+
/**
|
| 1234 |
+
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
| 1235 |
+
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
| 1236 |
+
* @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
|
| 1237 |
+
* If `encoding` is not supplied, the default of `'utf8'` is used.
|
| 1238 |
+
* If `persistent` is not supplied, the default of `true` is used.
|
| 1239 |
+
* If `recursive` is not supplied, the default of `false` is used.
|
| 1240 |
+
*/
|
| 1241 |
+
function watch(filename: PathLike, options?: WatchOptions | BufferEncoding): AsyncIterable<FileChangeInfo<string>>;
|
| 1242 |
+
/**
|
| 1243 |
+
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
| 1244 |
+
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
| 1245 |
+
* @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
|
| 1246 |
+
* If `encoding` is not supplied, the default of `'utf8'` is used.
|
| 1247 |
+
* If `persistent` is not supplied, the default of `true` is used.
|
| 1248 |
+
* If `recursive` is not supplied, the default of `false` is used.
|
| 1249 |
+
*/
|
| 1250 |
function watch(
|
| 1251 |
filename: PathLike,
|
| 1252 |
+
options: WatchOptions | string,
|
| 1253 |
+
): AsyncIterable<FileChangeInfo<string>> | AsyncIterable<FileChangeInfo<NonSharedBuffer>>;
|
| 1254 |
/**
|
| 1255 |
* Asynchronously copies the entire directory structure from `src` to `dest`,
|
| 1256 |
* including subdirectories and files.
|
|
|
|
| 1264 |
* @return Fulfills with `undefined` upon success.
|
| 1265 |
*/
|
| 1266 |
function cp(source: string | URL, destination: string | URL, opts?: CopyOptions): Promise<void>;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1267 |
}
|
| 1268 |
+
declare module "node:fs/promises" {
|
| 1269 |
+
export * from "fs/promises";
|
| 1270 |
}
|
node_modules/@types/node/globals.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
declare var global: typeof globalThis;
|
| 2 |
|
| 3 |
declare var process: NodeJS.Process;
|
|
|
|
| 4 |
|
| 5 |
interface ErrorConstructor {
|
| 6 |
/**
|
|
@@ -104,6 +105,31 @@ declare namespace NodeJS {
|
|
| 104 |
syscall?: string | undefined;
|
| 105 |
}
|
| 106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
interface RefCounted {
|
| 108 |
ref(): this;
|
| 109 |
unref(): this;
|
|
@@ -133,18 +159,14 @@ declare namespace NodeJS {
|
|
| 133 |
}
|
| 134 |
|
| 135 |
/** An iterable iterator returned by the Node.js API. */
|
| 136 |
-
|
|
|
|
| 137 |
[Symbol.iterator](): NodeJS.Iterator<T, TReturn, TNext>;
|
| 138 |
}
|
| 139 |
|
| 140 |
/** An async iterable iterator returned by the Node.js API. */
|
| 141 |
-
|
|
|
|
| 142 |
[Symbol.asyncIterator](): NodeJS.AsyncIterator<T, TReturn, TNext>;
|
| 143 |
}
|
| 144 |
-
|
| 145 |
-
/** The [`BufferSource`](https://webidl.spec.whatwg.org/#BufferSource) type from the Web IDL specification. */
|
| 146 |
-
type BufferSource = NonSharedArrayBufferView | ArrayBuffer;
|
| 147 |
-
|
| 148 |
-
/** The [`AllowSharedBufferSource`](https://webidl.spec.whatwg.org/#AllowSharedBufferSource) type from the Web IDL specification. */
|
| 149 |
-
type AllowSharedBufferSource = ArrayBufferView | ArrayBufferLike;
|
| 150 |
}
|
|
|
|
| 1 |
declare var global: typeof globalThis;
|
| 2 |
|
| 3 |
declare var process: NodeJS.Process;
|
| 4 |
+
declare var console: Console;
|
| 5 |
|
| 6 |
interface ErrorConstructor {
|
| 7 |
/**
|
|
|
|
| 105 |
syscall?: string | undefined;
|
| 106 |
}
|
| 107 |
|
| 108 |
+
interface ReadableStream extends EventEmitter {
|
| 109 |
+
readable: boolean;
|
| 110 |
+
read(size?: number): string | Buffer;
|
| 111 |
+
setEncoding(encoding: BufferEncoding): this;
|
| 112 |
+
pause(): this;
|
| 113 |
+
resume(): this;
|
| 114 |
+
isPaused(): boolean;
|
| 115 |
+
pipe<T extends WritableStream>(destination: T, options?: { end?: boolean | undefined }): T;
|
| 116 |
+
unpipe(destination?: WritableStream): this;
|
| 117 |
+
unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
|
| 118 |
+
wrap(oldStream: ReadableStream): this;
|
| 119 |
+
[Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
interface WritableStream extends EventEmitter {
|
| 123 |
+
writable: boolean;
|
| 124 |
+
write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
|
| 125 |
+
write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
|
| 126 |
+
end(cb?: () => void): this;
|
| 127 |
+
end(data: string | Uint8Array, cb?: () => void): this;
|
| 128 |
+
end(str: string, encoding?: BufferEncoding, cb?: () => void): this;
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
interface ReadWriteStream extends ReadableStream, WritableStream {}
|
| 132 |
+
|
| 133 |
interface RefCounted {
|
| 134 |
ref(): this;
|
| 135 |
unref(): this;
|
|
|
|
| 159 |
}
|
| 160 |
|
| 161 |
/** An iterable iterator returned by the Node.js API. */
|
| 162 |
+
// Default TReturn/TNext in v20 is `any`, for compatibility with the previously-used IterableIterator.
|
| 163 |
+
interface Iterator<T, TReturn = any, TNext = any> extends IteratorObject<T, TReturn, TNext> {
|
| 164 |
[Symbol.iterator](): NodeJS.Iterator<T, TReturn, TNext>;
|
| 165 |
}
|
| 166 |
|
| 167 |
/** An async iterable iterator returned by the Node.js API. */
|
| 168 |
+
// Default TReturn/TNext in v20 is `any`, for compatibility with the previously-used AsyncIterableIterator.
|
| 169 |
+
interface AsyncIterator<T, TReturn = any, TNext = any> extends AsyncIteratorObject<T, TReturn, TNext> {
|
| 170 |
[Symbol.asyncIterator](): NodeJS.AsyncIterator<T, TReturn, TNext>;
|
| 171 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
}
|
node_modules/@types/node/globals.typedarray.d.ts
CHANGED
|
@@ -12,7 +12,6 @@ declare global {
|
|
| 12 |
| Int32Array<TArrayBuffer>
|
| 13 |
| BigUint64Array<TArrayBuffer>
|
| 14 |
| BigInt64Array<TArrayBuffer>
|
| 15 |
-
| Float16Array<TArrayBuffer>
|
| 16 |
| Float32Array<TArrayBuffer>
|
| 17 |
| Float64Array<TArrayBuffer>;
|
| 18 |
type ArrayBufferView<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> =
|
|
@@ -21,81 +20,19 @@ declare global {
|
|
| 21 |
|
| 22 |
// The following aliases are required to allow use of non-shared ArrayBufferViews in @types/node
|
| 23 |
// while maintaining compatibility with TS <=5.6.
|
| 24 |
-
// TODO: remove once @types/node no longer supports TS 5.6, and replace with native types.
|
| 25 |
-
/**
|
| 26 |
-
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
| 27 |
-
* TypeScript versions earlier than 5.7.
|
| 28 |
-
*/
|
| 29 |
type NonSharedUint8Array = Uint8Array<ArrayBuffer>;
|
| 30 |
-
/**
|
| 31 |
-
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
| 32 |
-
* TypeScript versions earlier than 5.7.
|
| 33 |
-
*/
|
| 34 |
type NonSharedUint8ClampedArray = Uint8ClampedArray<ArrayBuffer>;
|
| 35 |
-
/**
|
| 36 |
-
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
| 37 |
-
* TypeScript versions earlier than 5.7.
|
| 38 |
-
*/
|
| 39 |
type NonSharedUint16Array = Uint16Array<ArrayBuffer>;
|
| 40 |
-
/**
|
| 41 |
-
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
| 42 |
-
* TypeScript versions earlier than 5.7.
|
| 43 |
-
*/
|
| 44 |
type NonSharedUint32Array = Uint32Array<ArrayBuffer>;
|
| 45 |
-
/**
|
| 46 |
-
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
| 47 |
-
* TypeScript versions earlier than 5.7.
|
| 48 |
-
*/
|
| 49 |
type NonSharedInt8Array = Int8Array<ArrayBuffer>;
|
| 50 |
-
/**
|
| 51 |
-
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
| 52 |
-
* TypeScript versions earlier than 5.7.
|
| 53 |
-
*/
|
| 54 |
type NonSharedInt16Array = Int16Array<ArrayBuffer>;
|
| 55 |
-
/**
|
| 56 |
-
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
| 57 |
-
* TypeScript versions earlier than 5.7.
|
| 58 |
-
*/
|
| 59 |
type NonSharedInt32Array = Int32Array<ArrayBuffer>;
|
| 60 |
-
/**
|
| 61 |
-
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
| 62 |
-
* TypeScript versions earlier than 5.7.
|
| 63 |
-
*/
|
| 64 |
type NonSharedBigUint64Array = BigUint64Array<ArrayBuffer>;
|
| 65 |
-
/**
|
| 66 |
-
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
| 67 |
-
* TypeScript versions earlier than 5.7.
|
| 68 |
-
*/
|
| 69 |
type NonSharedBigInt64Array = BigInt64Array<ArrayBuffer>;
|
| 70 |
-
/**
|
| 71 |
-
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
| 72 |
-
* TypeScript versions earlier than 5.7.
|
| 73 |
-
*/
|
| 74 |
-
type NonSharedFloat16Array = Float16Array<ArrayBuffer>;
|
| 75 |
-
/**
|
| 76 |
-
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
| 77 |
-
* TypeScript versions earlier than 5.7.
|
| 78 |
-
*/
|
| 79 |
type NonSharedFloat32Array = Float32Array<ArrayBuffer>;
|
| 80 |
-
/**
|
| 81 |
-
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
| 82 |
-
* TypeScript versions earlier than 5.7.
|
| 83 |
-
*/
|
| 84 |
type NonSharedFloat64Array = Float64Array<ArrayBuffer>;
|
| 85 |
-
/**
|
| 86 |
-
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
| 87 |
-
* TypeScript versions earlier than 5.7.
|
| 88 |
-
*/
|
| 89 |
type NonSharedDataView = DataView<ArrayBuffer>;
|
| 90 |
-
/**
|
| 91 |
-
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
| 92 |
-
* TypeScript versions earlier than 5.7.
|
| 93 |
-
*/
|
| 94 |
type NonSharedTypedArray = TypedArray<ArrayBuffer>;
|
| 95 |
-
/**
|
| 96 |
-
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
| 97 |
-
* TypeScript versions earlier than 5.7.
|
| 98 |
-
*/
|
| 99 |
type NonSharedArrayBufferView = ArrayBufferView<ArrayBuffer>;
|
| 100 |
}
|
| 101 |
}
|
|
|
|
| 12 |
| Int32Array<TArrayBuffer>
|
| 13 |
| BigUint64Array<TArrayBuffer>
|
| 14 |
| BigInt64Array<TArrayBuffer>
|
|
|
|
| 15 |
| Float32Array<TArrayBuffer>
|
| 16 |
| Float64Array<TArrayBuffer>;
|
| 17 |
type ArrayBufferView<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> =
|
|
|
|
| 20 |
|
| 21 |
// The following aliases are required to allow use of non-shared ArrayBufferViews in @types/node
|
| 22 |
// while maintaining compatibility with TS <=5.6.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
type NonSharedUint8Array = Uint8Array<ArrayBuffer>;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
type NonSharedUint8ClampedArray = Uint8ClampedArray<ArrayBuffer>;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
type NonSharedUint16Array = Uint16Array<ArrayBuffer>;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
type NonSharedUint32Array = Uint32Array<ArrayBuffer>;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
type NonSharedInt8Array = Int8Array<ArrayBuffer>;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
type NonSharedInt16Array = Int16Array<ArrayBuffer>;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
type NonSharedInt32Array = Int32Array<ArrayBuffer>;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
type NonSharedBigUint64Array = BigUint64Array<ArrayBuffer>;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
type NonSharedBigInt64Array = BigInt64Array<ArrayBuffer>;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
type NonSharedFloat32Array = Float32Array<ArrayBuffer>;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
type NonSharedFloat64Array = Float64Array<ArrayBuffer>;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
type NonSharedDataView = DataView<ArrayBuffer>;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
type NonSharedTypedArray = TypedArray<ArrayBuffer>;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
type NonSharedArrayBufferView = ArrayBufferView<ArrayBuffer>;
|
| 37 |
}
|
| 38 |
}
|
node_modules/@types/node/http.d.ts
CHANGED
|
@@ -37,15 +37,15 @@
|
|
| 37 |
* 'Host', 'example.com',
|
| 38 |
* 'accepT', '*' ]
|
| 39 |
* ```
|
| 40 |
-
* @see [source](https://github.com/nodejs/node/blob/
|
| 41 |
*/
|
| 42 |
-
declare module "
|
| 43 |
import { NonSharedBuffer } from "node:buffer";
|
| 44 |
-
import { LookupOptions } from "node:dns";
|
| 45 |
-
import { EventEmitter } from "node:events";
|
| 46 |
-
import * as net from "node:net";
|
| 47 |
import * as stream from "node:stream";
|
| 48 |
import { URL } from "node:url";
|
|
|
|
|
|
|
|
|
|
| 49 |
// incoming headers will never contain number
|
| 50 |
interface IncomingHttpHeaders extends NodeJS.Dict<string | string[]> {
|
| 51 |
accept?: string | undefined;
|
|
@@ -147,7 +147,6 @@ declare module "node:http" {
|
|
| 147 |
"content-range"?: string | undefined;
|
| 148 |
"content-security-policy"?: string | undefined;
|
| 149 |
"content-security-policy-report-only"?: string | undefined;
|
| 150 |
-
"content-type"?: string | undefined;
|
| 151 |
cookie?: string | string[] | undefined;
|
| 152 |
dav?: string | string[] | undefined;
|
| 153 |
dnt?: string | undefined;
|
|
@@ -219,7 +218,7 @@ declare module "node:http" {
|
|
| 219 |
insecureHTTPParser?: boolean | undefined;
|
| 220 |
localAddress?: string | undefined;
|
| 221 |
localPort?: number | undefined;
|
| 222 |
-
lookup?:
|
| 223 |
/**
|
| 224 |
* @default 16384
|
| 225 |
*/
|
|
@@ -228,7 +227,6 @@ declare module "node:http" {
|
|
| 228 |
path?: string | null | undefined;
|
| 229 |
port?: number | string | null | undefined;
|
| 230 |
protocol?: string | null | undefined;
|
| 231 |
-
setDefaultHeaders?: boolean | undefined;
|
| 232 |
setHost?: boolean | undefined;
|
| 233 |
signal?: AbortSignal | undefined;
|
| 234 |
socketPath?: string | undefined;
|
|
@@ -269,13 +267,6 @@ declare module "node:http" {
|
|
| 269 |
* @since v18.0.0
|
| 270 |
*/
|
| 271 |
keepAliveTimeout?: number | undefined;
|
| 272 |
-
/**
|
| 273 |
-
* An additional buffer time added to the
|
| 274 |
-
* `server.keepAliveTimeout` to extend the internal socket timeout.
|
| 275 |
-
* @since 24.6.0
|
| 276 |
-
* @default 1000
|
| 277 |
-
*/
|
| 278 |
-
keepAliveTimeoutBuffer?: number | undefined;
|
| 279 |
/**
|
| 280 |
* Sets the interval value in milliseconds to check for request and headers timeout in incomplete requests.
|
| 281 |
* @default 30000
|
|
@@ -340,57 +331,24 @@ declare module "node:http" {
|
|
| 340 |
* If the header's value is an array, the items will be joined using `; `.
|
| 341 |
*/
|
| 342 |
uniqueHeaders?: Array<string | string[]> | undefined;
|
| 343 |
-
/**
|
| 344 |
-
* A callback which receives an
|
| 345 |
-
* incoming request and returns a boolean, to control which upgrade attempts
|
| 346 |
-
* should be accepted. Accepted upgrades will fire an `'upgrade'` event (or
|
| 347 |
-
* their sockets will be destroyed, if no listener is registered) while
|
| 348 |
-
* rejected upgrades will fire a `'request'` event like any non-upgrade
|
| 349 |
-
* request.
|
| 350 |
-
* @since v24.9.0
|
| 351 |
-
* @default () => server.listenerCount('upgrade') > 0
|
| 352 |
-
*/
|
| 353 |
-
shouldUpgradeCallback?: ((request: InstanceType<Request>) => boolean) | undefined;
|
| 354 |
/**
|
| 355 |
* If set to `true`, an error is thrown when writing to an HTTP response which does not have a body.
|
| 356 |
* @default false
|
| 357 |
* @since v18.17.0, v20.2.0
|
| 358 |
*/
|
| 359 |
rejectNonStandardBodyWrites?: boolean | undefined;
|
| 360 |
-
/**
|
| 361 |
-
* If set to `true`, requests without `Content-Length`
|
| 362 |
-
* or `Transfer-Encoding` headers (indicating no body) will be initialized with an
|
| 363 |
-
* already-ended body stream, so they will never emit any stream events
|
| 364 |
-
* (like `'data'` or `'end'`). You can use `req.readableEnded` to detect this case.
|
| 365 |
-
* @since v25.1.0
|
| 366 |
-
* @default false
|
| 367 |
-
*/
|
| 368 |
-
optimizeEmptyRequests?: boolean | undefined;
|
| 369 |
}
|
| 370 |
type RequestListener<
|
| 371 |
Request extends typeof IncomingMessage = typeof IncomingMessage,
|
| 372 |
Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
|
| 373 |
-
> = (
|
| 374 |
-
interface ServerEventMap<
|
| 375 |
-
Request extends typeof IncomingMessage = typeof IncomingMessage,
|
| 376 |
-
Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
|
| 377 |
-
> extends net.ServerEventMap {
|
| 378 |
-
"checkContinue": Parameters<RequestListener<Request, Response>>;
|
| 379 |
-
"checkExpectation": Parameters<RequestListener<Request, Response>>;
|
| 380 |
-
"clientError": [exception: Error, socket: stream.Duplex];
|
| 381 |
-
"connect": [request: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer];
|
| 382 |
-
"connection": [socket: net.Socket];
|
| 383 |
-
"dropRequest": [request: InstanceType<Request>, socket: stream.Duplex];
|
| 384 |
-
"request": Parameters<RequestListener<Request, Response>>;
|
| 385 |
-
"upgrade": [req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer];
|
| 386 |
-
}
|
| 387 |
/**
|
| 388 |
* @since v0.1.17
|
| 389 |
*/
|
| 390 |
class Server<
|
| 391 |
Request extends typeof IncomingMessage = typeof IncomingMessage,
|
| 392 |
Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
|
| 393 |
-
> extends
|
| 394 |
constructor(requestListener?: RequestListener<Request, Response>);
|
| 395 |
constructor(options: ServerOptions<Request, Response>, requestListener?: RequestListener<Request, Response>);
|
| 396 |
/**
|
|
@@ -407,8 +365,8 @@ declare module "node:http" {
|
|
| 407 |
* @since v0.9.12
|
| 408 |
* @param [msecs=0 (no timeout)]
|
| 409 |
*/
|
| 410 |
-
setTimeout(msecs?: number, callback?: (socket:
|
| 411 |
-
setTimeout(callback: (socket:
|
| 412 |
/**
|
| 413 |
* Limits maximum incoming headers count. If set to 0, no limit will be applied.
|
| 414 |
* @since v0.7.0
|
|
@@ -453,18 +411,12 @@ declare module "node:http" {
|
|
| 453 |
/**
|
| 454 |
* The number of milliseconds of inactivity a server needs to wait for additional
|
| 455 |
* incoming data, after it has finished writing the last response, before a socket
|
| 456 |
-
* will be destroyed.
|
| 457 |
-
*
|
| 458 |
-
* This timeout value is combined with the
|
| 459 |
-
* `server.keepAliveTimeoutBuffer` option to determine the actual socket
|
| 460 |
-
* timeout, calculated as:
|
| 461 |
-
* socketTimeout = keepAliveTimeout + keepAliveTimeoutBuffer
|
| 462 |
-
* If the server receives new data before the keep-alive timeout has fired, it
|
| 463 |
-
* will reset the regular inactivity timeout, i.e., `server.timeout`.
|
| 464 |
*
|
| 465 |
* A value of `0` will disable the keep-alive timeout behavior on incoming
|
| 466 |
* connections.
|
| 467 |
-
* A value of `0` makes the
|
| 468 |
* to 8.0.0, which did not have a keep-alive timeout.
|
| 469 |
*
|
| 470 |
* The socket timeout logic is set up on connection, so changing this value only
|
|
@@ -472,18 +424,6 @@ declare module "node:http" {
|
|
| 472 |
* @since v8.0.0
|
| 473 |
*/
|
| 474 |
keepAliveTimeout: number;
|
| 475 |
-
/**
|
| 476 |
-
* An additional buffer time added to the
|
| 477 |
-
* `server.keepAliveTimeout` to extend the internal socket timeout.
|
| 478 |
-
*
|
| 479 |
-
* This buffer helps reduce connection reset (`ECONNRESET`) errors by increasing
|
| 480 |
-
* the socket timeout slightly beyond the advertised keep-alive timeout.
|
| 481 |
-
*
|
| 482 |
-
* This option applies only to new incoming connections.
|
| 483 |
-
* @since v24.6.0
|
| 484 |
-
* @default 1000
|
| 485 |
-
*/
|
| 486 |
-
keepAliveTimeoutBuffer: number;
|
| 487 |
/**
|
| 488 |
* Sets the timeout value in milliseconds for receiving the entire request from
|
| 489 |
* the client.
|
|
@@ -508,64 +448,126 @@ declare module "node:http" {
|
|
| 508 |
* @since v18.2.0
|
| 509 |
*/
|
| 510 |
closeIdleConnections(): void;
|
| 511 |
-
|
| 512 |
-
addListener
|
| 513 |
-
|
| 514 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 515 |
): this;
|
| 516 |
-
addListener(
|
| 517 |
-
|
| 518 |
-
|
| 519 |
-
|
| 520 |
-
|
| 521 |
-
listener?: (...args: ServerEventMap<Request, Response>[E]) => void,
|
| 522 |
-
): number;
|
| 523 |
-
listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
|
| 524 |
-
listeners<E extends keyof ServerEventMap>(
|
| 525 |
-
eventName: E,
|
| 526 |
-
): ((...args: ServerEventMap<Request, Response>[E]) => void)[];
|
| 527 |
-
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
| 528 |
-
off<E extends keyof ServerEventMap>(
|
| 529 |
-
eventName: E,
|
| 530 |
-
listener: (...args: ServerEventMap<Request, Response>[E]) => void,
|
| 531 |
): this;
|
| 532 |
-
|
| 533 |
-
|
| 534 |
-
|
| 535 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 536 |
): this;
|
| 537 |
-
on(
|
| 538 |
-
|
| 539 |
-
|
| 540 |
-
|
|
|
|
| 541 |
): this;
|
| 542 |
-
once(
|
| 543 |
-
|
| 544 |
-
|
| 545 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 546 |
): this;
|
| 547 |
-
|
| 548 |
-
|
| 549 |
-
|
| 550 |
-
|
|
|
|
| 551 |
): this;
|
| 552 |
-
|
| 553 |
-
|
| 554 |
-
|
| 555 |
-
|
| 556 |
-
|
| 557 |
-
|
| 558 |
-
|
| 559 |
-
|
| 560 |
-
|
| 561 |
-
|
| 562 |
-
listener: (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 563 |
): this;
|
| 564 |
-
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
| 565 |
-
// #endregion
|
| 566 |
-
}
|
| 567 |
-
interface OutgoingMessageEventMap extends stream.WritableEventMap {
|
| 568 |
-
"prefinish": [];
|
| 569 |
}
|
| 570 |
/**
|
| 571 |
* This class serves as the parent class of {@link ClientRequest} and {@link ServerResponse}. It is an abstract outgoing message from
|
|
@@ -573,7 +575,6 @@ declare module "node:http" {
|
|
| 573 |
* @since v0.1.17
|
| 574 |
*/
|
| 575 |
class OutgoingMessage<Request extends IncomingMessage = IncomingMessage> extends stream.Writable {
|
| 576 |
-
constructor();
|
| 577 |
readonly req: Request;
|
| 578 |
chunkedEncoding: boolean;
|
| 579 |
shouldKeepAlive: boolean;
|
|
@@ -593,7 +594,7 @@ declare module "node:http" {
|
|
| 593 |
* @since v0.3.0
|
| 594 |
* @deprecated Since v15.12.0,v14.17.1 - Use `socket` instead.
|
| 595 |
*/
|
| 596 |
-
readonly connection:
|
| 597 |
/**
|
| 598 |
* Reference to the underlying socket. Usually, users will not want to access
|
| 599 |
* this property.
|
|
@@ -601,7 +602,8 @@ declare module "node:http" {
|
|
| 601 |
* After calling `outgoingMessage.end()`, this property will be nulled.
|
| 602 |
* @since v0.3.0
|
| 603 |
*/
|
| 604 |
-
readonly socket:
|
|
|
|
| 605 |
/**
|
| 606 |
* Once a socket is associated with the message and is connected, `socket.setTimeout()` will be called with `msecs` as the first parameter.
|
| 607 |
* @since v0.9.12
|
|
@@ -759,61 +761,6 @@ declare module "node:http" {
|
|
| 759 |
* @since v1.6.0
|
| 760 |
*/
|
| 761 |
flushHeaders(): void;
|
| 762 |
-
// #region InternalEventEmitter
|
| 763 |
-
addListener<E extends keyof OutgoingMessageEventMap>(
|
| 764 |
-
eventName: E,
|
| 765 |
-
listener: (...args: OutgoingMessageEventMap[E]) => void,
|
| 766 |
-
): this;
|
| 767 |
-
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
| 768 |
-
emit<E extends keyof OutgoingMessageEventMap>(eventName: E, ...args: OutgoingMessageEventMap[E]): boolean;
|
| 769 |
-
emit(eventName: string | symbol, ...args: any[]): boolean;
|
| 770 |
-
listenerCount<E extends keyof OutgoingMessageEventMap>(
|
| 771 |
-
eventName: E,
|
| 772 |
-
listener?: (...args: OutgoingMessageEventMap[E]) => void,
|
| 773 |
-
): number;
|
| 774 |
-
listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
|
| 775 |
-
listeners<E extends keyof OutgoingMessageEventMap>(
|
| 776 |
-
eventName: E,
|
| 777 |
-
): ((...args: OutgoingMessageEventMap[E]) => void)[];
|
| 778 |
-
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
| 779 |
-
off<E extends keyof OutgoingMessageEventMap>(
|
| 780 |
-
eventName: E,
|
| 781 |
-
listener: (...args: OutgoingMessageEventMap[E]) => void,
|
| 782 |
-
): this;
|
| 783 |
-
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
| 784 |
-
on<E extends keyof OutgoingMessageEventMap>(
|
| 785 |
-
eventName: E,
|
| 786 |
-
listener: (...args: OutgoingMessageEventMap[E]) => void,
|
| 787 |
-
): this;
|
| 788 |
-
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
| 789 |
-
once<E extends keyof OutgoingMessageEventMap>(
|
| 790 |
-
eventName: E,
|
| 791 |
-
listener: (...args: OutgoingMessageEventMap[E]) => void,
|
| 792 |
-
): this;
|
| 793 |
-
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
| 794 |
-
prependListener<E extends keyof OutgoingMessageEventMap>(
|
| 795 |
-
eventName: E,
|
| 796 |
-
listener: (...args: OutgoingMessageEventMap[E]) => void,
|
| 797 |
-
): this;
|
| 798 |
-
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
| 799 |
-
prependOnceListener<E extends keyof OutgoingMessageEventMap>(
|
| 800 |
-
eventName: E,
|
| 801 |
-
listener: (...args: OutgoingMessageEventMap[E]) => void,
|
| 802 |
-
): this;
|
| 803 |
-
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
| 804 |
-
rawListeners<E extends keyof OutgoingMessageEventMap>(
|
| 805 |
-
eventName: E,
|
| 806 |
-
): ((...args: OutgoingMessageEventMap[E]) => void)[];
|
| 807 |
-
rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
| 808 |
-
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
| 809 |
-
removeAllListeners<E extends keyof OutgoingMessageEventMap>(eventName?: E): this;
|
| 810 |
-
removeAllListeners(eventName?: string | symbol): this;
|
| 811 |
-
removeListener<E extends keyof OutgoingMessageEventMap>(
|
| 812 |
-
eventName: E,
|
| 813 |
-
listener: (...args: OutgoingMessageEventMap[E]) => void,
|
| 814 |
-
): this;
|
| 815 |
-
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
| 816 |
-
// #endregion
|
| 817 |
}
|
| 818 |
/**
|
| 819 |
* This object is created internally by an HTTP server, not by the user. It is
|
|
@@ -858,8 +805,8 @@ declare module "node:http" {
|
|
| 858 |
*/
|
| 859 |
strictContentLength: boolean;
|
| 860 |
constructor(req: Request);
|
| 861 |
-
assignSocket(socket:
|
| 862 |
-
detachSocket(socket:
|
| 863 |
/**
|
| 864 |
* Sends an HTTP/1.1 100 Continue message to the client, indicating that
|
| 865 |
* the request body should be sent. See the `'checkContinue'` event on `Server`.
|
|
@@ -971,25 +918,14 @@ declare module "node:http" {
|
|
| 971 |
writeProcessing(callback?: () => void): void;
|
| 972 |
}
|
| 973 |
interface InformationEvent {
|
|
|
|
|
|
|
| 974 |
httpVersion: string;
|
| 975 |
httpVersionMajor: number;
|
| 976 |
httpVersionMinor: number;
|
| 977 |
-
statusCode: number;
|
| 978 |
-
statusMessage: string;
|
| 979 |
headers: IncomingHttpHeaders;
|
| 980 |
rawHeaders: string[];
|
| 981 |
}
|
| 982 |
-
interface ClientRequestEventMap extends stream.WritableEventMap {
|
| 983 |
-
/** @deprecated Listen for the `'close'` event instead. */
|
| 984 |
-
"abort": [];
|
| 985 |
-
"connect": [response: IncomingMessage, socket: net.Socket, head: NonSharedBuffer];
|
| 986 |
-
"continue": [];
|
| 987 |
-
"information": [info: InformationEvent];
|
| 988 |
-
"response": [response: IncomingMessage];
|
| 989 |
-
"socket": [socket: net.Socket];
|
| 990 |
-
"timeout": [];
|
| 991 |
-
"upgrade": [response: IncomingMessage, socket: net.Socket, head: NonSharedBuffer];
|
| 992 |
-
}
|
| 993 |
/**
|
| 994 |
* This object is created internally and returned from {@link request}. It
|
| 995 |
* represents an _in-progress_ request whose header has already been queued. The
|
|
@@ -1046,7 +982,6 @@ declare module "node:http" {
|
|
| 1046 |
*
|
| 1047 |
* ```js
|
| 1048 |
* import http from 'node:http';
|
| 1049 |
-
* const agent = new http.Agent({ keepAlive: true });
|
| 1050 |
*
|
| 1051 |
* // Server has a 5 seconds keep-alive timeout by default
|
| 1052 |
* http
|
|
@@ -1113,7 +1048,7 @@ declare module "node:http" {
|
|
| 1113 |
* @deprecated Since v14.1.0,v13.14.0 - Use `destroy` instead.
|
| 1114 |
*/
|
| 1115 |
abort(): void;
|
| 1116 |
-
onSocket(socket:
|
| 1117 |
/**
|
| 1118 |
* Once a socket is assigned to this request and is connected `socket.setTimeout()` will be called.
|
| 1119 |
* @since v0.5.9
|
|
@@ -1145,63 +1080,126 @@ declare module "node:http" {
|
|
| 1145 |
* @since v15.13.0, v14.17.0
|
| 1146 |
*/
|
| 1147 |
getRawHeaderNames(): string[];
|
| 1148 |
-
/
|
| 1149 |
-
|
| 1150 |
-
|
| 1151 |
-
|
|
|
|
|
|
|
|
|
|
| 1152 |
): this;
|
| 1153 |
-
addListener(
|
| 1154 |
-
|
| 1155 |
-
|
| 1156 |
-
|
| 1157 |
-
|
| 1158 |
-
|
| 1159 |
-
|
| 1160 |
-
|
| 1161 |
-
listeners<E extends keyof ClientRequestEventMap>(eventName: E): ((...args: ClientRequestEventMap[E]) => void)[];
|
| 1162 |
-
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
| 1163 |
-
off<E extends keyof ClientRequestEventMap>(
|
| 1164 |
-
eventName: E,
|
| 1165 |
-
listener: (...args: ClientRequestEventMap[E]) => void,
|
| 1166 |
): this;
|
| 1167 |
-
|
| 1168 |
-
|
| 1169 |
-
|
| 1170 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1171 |
): this;
|
| 1172 |
-
on(
|
| 1173 |
-
|
| 1174 |
-
|
| 1175 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1176 |
): this;
|
| 1177 |
-
|
| 1178 |
-
|
| 1179 |
-
|
| 1180 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1181 |
): this;
|
| 1182 |
-
|
| 1183 |
-
|
| 1184 |
-
|
| 1185 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1186 |
): this;
|
| 1187 |
-
|
| 1188 |
-
|
| 1189 |
-
|
| 1190 |
-
|
| 1191 |
-
|
| 1192 |
-
|
| 1193 |
-
|
| 1194 |
-
|
| 1195 |
-
|
| 1196 |
-
|
| 1197 |
-
|
|
|
|
|
|
|
|
|
|
| 1198 |
): this;
|
| 1199 |
-
|
| 1200 |
-
|
| 1201 |
-
|
| 1202 |
-
|
| 1203 |
-
|
| 1204 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1205 |
}
|
| 1206 |
/**
|
| 1207 |
* An `IncomingMessage` object is created by {@link Server} or {@link ClientRequest} and passed as the first argument to the `'request'` and `'response'` event respectively. It may be used to
|
|
@@ -1214,7 +1212,7 @@ declare module "node:http" {
|
|
| 1214 |
* @since v0.1.17
|
| 1215 |
*/
|
| 1216 |
class IncomingMessage extends stream.Readable {
|
| 1217 |
-
constructor(socket:
|
| 1218 |
/**
|
| 1219 |
* The `message.aborted` property will be `true` if the request has
|
| 1220 |
* been aborted.
|
|
@@ -1262,7 +1260,7 @@ declare module "node:http" {
|
|
| 1262 |
* @since v0.1.90
|
| 1263 |
* @deprecated Since v16.0.0 - Use `socket`.
|
| 1264 |
*/
|
| 1265 |
-
connection:
|
| 1266 |
/**
|
| 1267 |
* The `net.Socket` object associated with the connection.
|
| 1268 |
*
|
|
@@ -1274,7 +1272,7 @@ declare module "node:http" {
|
|
| 1274 |
* type other than `net.Socket` or internally nulled.
|
| 1275 |
* @since v0.3.0
|
| 1276 |
*/
|
| 1277 |
-
socket:
|
| 1278 |
/**
|
| 1279 |
* The request/response headers object.
|
| 1280 |
*
|
|
@@ -1436,71 +1434,8 @@ declare module "node:http" {
|
|
| 1436 |
* @since v0.3.0
|
| 1437 |
*/
|
| 1438 |
destroy(error?: Error): this;
|
| 1439 |
-
// #region InternalEventEmitter
|
| 1440 |
-
addListener<E extends keyof IncomingMessageEventMap>(
|
| 1441 |
-
eventName: E,
|
| 1442 |
-
listener: (...args: IncomingMessageEventMap[E]) => void,
|
| 1443 |
-
): this;
|
| 1444 |
-
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
| 1445 |
-
emit<E extends keyof IncomingMessageEventMap>(eventName: E, ...args: IncomingMessageEventMap[E]): boolean;
|
| 1446 |
-
emit(eventName: string | symbol, ...args: any[]): boolean;
|
| 1447 |
-
listenerCount<E extends keyof IncomingMessageEventMap>(
|
| 1448 |
-
eventName: E,
|
| 1449 |
-
listener?: (...args: IncomingMessageEventMap[E]) => void,
|
| 1450 |
-
): number;
|
| 1451 |
-
listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
|
| 1452 |
-
listeners<E extends keyof IncomingMessageEventMap>(
|
| 1453 |
-
eventName: E,
|
| 1454 |
-
): ((...args: IncomingMessageEventMap[E]) => void)[];
|
| 1455 |
-
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
| 1456 |
-
off<E extends keyof IncomingMessageEventMap>(
|
| 1457 |
-
eventName: E,
|
| 1458 |
-
listener: (...args: IncomingMessageEventMap[E]) => void,
|
| 1459 |
-
): this;
|
| 1460 |
-
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
| 1461 |
-
on<E extends keyof IncomingMessageEventMap>(
|
| 1462 |
-
eventName: E,
|
| 1463 |
-
listener: (...args: IncomingMessageEventMap[E]) => void,
|
| 1464 |
-
): this;
|
| 1465 |
-
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
| 1466 |
-
once<E extends keyof IncomingMessageEventMap>(
|
| 1467 |
-
eventName: E,
|
| 1468 |
-
listener: (...args: IncomingMessageEventMap[E]) => void,
|
| 1469 |
-
): this;
|
| 1470 |
-
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
| 1471 |
-
prependListener<E extends keyof IncomingMessageEventMap>(
|
| 1472 |
-
eventName: E,
|
| 1473 |
-
listener: (...args: IncomingMessageEventMap[E]) => void,
|
| 1474 |
-
): this;
|
| 1475 |
-
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
| 1476 |
-
prependOnceListener<E extends keyof IncomingMessageEventMap>(
|
| 1477 |
-
eventName: E,
|
| 1478 |
-
listener: (...args: IncomingMessageEventMap[E]) => void,
|
| 1479 |
-
): this;
|
| 1480 |
-
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
| 1481 |
-
rawListeners<E extends keyof IncomingMessageEventMap>(
|
| 1482 |
-
eventName: E,
|
| 1483 |
-
): ((...args: IncomingMessageEventMap[E]) => void)[];
|
| 1484 |
-
rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
| 1485 |
-
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
| 1486 |
-
removeAllListeners<E extends keyof IncomingMessageEventMap>(eventName?: E): this;
|
| 1487 |
-
removeAllListeners(eventName?: string | symbol): this;
|
| 1488 |
-
removeListener<E extends keyof IncomingMessageEventMap>(
|
| 1489 |
-
eventName: E,
|
| 1490 |
-
listener: (...args: IncomingMessageEventMap[E]) => void,
|
| 1491 |
-
): this;
|
| 1492 |
-
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
| 1493 |
-
// #endregion
|
| 1494 |
-
}
|
| 1495 |
-
interface ProxyEnv extends NodeJS.ProcessEnv {
|
| 1496 |
-
HTTP_PROXY?: string | undefined;
|
| 1497 |
-
HTTPS_PROXY?: string | undefined;
|
| 1498 |
-
NO_PROXY?: string | undefined;
|
| 1499 |
-
http_proxy?: string | undefined;
|
| 1500 |
-
https_proxy?: string | undefined;
|
| 1501 |
-
no_proxy?: string | undefined;
|
| 1502 |
}
|
| 1503 |
-
interface AgentOptions extends NodeJS.PartialOptions<
|
| 1504 |
/**
|
| 1505 |
* Keep sockets around in a pool to be used by other requests in the future. Default = false
|
| 1506 |
*/
|
|
@@ -1510,16 +1445,6 @@ declare module "node:http" {
|
|
| 1510 |
* Only relevant if keepAlive is set to true.
|
| 1511 |
*/
|
| 1512 |
keepAliveMsecs?: number | undefined;
|
| 1513 |
-
/**
|
| 1514 |
-
* Milliseconds to subtract from
|
| 1515 |
-
* the server-provided `keep-alive: timeout=...` hint when determining socket
|
| 1516 |
-
* expiration time. This buffer helps ensure the agent closes the socket
|
| 1517 |
-
* slightly before the server does, reducing the chance of sending a request
|
| 1518 |
-
* on a socket that’s about to be closed by the server.
|
| 1519 |
-
* @since v24.7.0
|
| 1520 |
-
* @default 1000
|
| 1521 |
-
*/
|
| 1522 |
-
agentKeepAliveTimeoutBuffer?: number | undefined;
|
| 1523 |
/**
|
| 1524 |
* Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity
|
| 1525 |
*/
|
|
@@ -1541,22 +1466,6 @@ declare module "node:http" {
|
|
| 1541 |
* @default `lifo`
|
| 1542 |
*/
|
| 1543 |
scheduling?: "fifo" | "lifo" | undefined;
|
| 1544 |
-
/**
|
| 1545 |
-
* Environment variables for proxy configuration. See
|
| 1546 |
-
* [Built-in Proxy Support](https://nodejs.org/docs/latest-v25.x/api/http.html#built-in-proxy-support) for details.
|
| 1547 |
-
* @since v24.5.0
|
| 1548 |
-
*/
|
| 1549 |
-
proxyEnv?: ProxyEnv | undefined;
|
| 1550 |
-
/**
|
| 1551 |
-
* Default port to use when the port is not specified in requests.
|
| 1552 |
-
* @since v24.5.0
|
| 1553 |
-
*/
|
| 1554 |
-
defaultPort?: number | undefined;
|
| 1555 |
-
/**
|
| 1556 |
-
* The protocol to use for the agent.
|
| 1557 |
-
* @since v24.5.0
|
| 1558 |
-
*/
|
| 1559 |
-
protocol?: string | undefined;
|
| 1560 |
}
|
| 1561 |
/**
|
| 1562 |
* An `Agent` is responsible for managing connection persistence
|
|
@@ -1612,7 +1521,7 @@ declare module "node:http" {
|
|
| 1612 |
* });
|
| 1613 |
* ```
|
| 1614 |
*
|
| 1615 |
-
* `options` in [`socket.connect()`](https://nodejs.org/docs/latest-
|
| 1616 |
*
|
| 1617 |
* To configure any of them, a custom {@link Agent} instance must be created.
|
| 1618 |
*
|
|
@@ -1652,13 +1561,13 @@ declare module "node:http" {
|
|
| 1652 |
* removed from the array on `'timeout'`.
|
| 1653 |
* @since v0.11.4
|
| 1654 |
*/
|
| 1655 |
-
readonly freeSockets: NodeJS.ReadOnlyDict<
|
| 1656 |
/**
|
| 1657 |
* An object which contains arrays of sockets currently in use by the
|
| 1658 |
* agent. Do not modify.
|
| 1659 |
* @since v0.3.6
|
| 1660 |
*/
|
| 1661 |
-
readonly sockets: NodeJS.ReadOnlyDict<
|
| 1662 |
/**
|
| 1663 |
* An object which contains queues of requests that have not yet been assigned to
|
| 1664 |
* sockets. Do not modify.
|
|
@@ -1680,34 +1589,20 @@ declare module "node:http" {
|
|
| 1680 |
/**
|
| 1681 |
* Produces a socket/stream to be used for HTTP requests.
|
| 1682 |
*
|
| 1683 |
-
* By default, this function
|
| 1684 |
-
*
|
| 1685 |
-
* signature is **not** used by this default implementation.
|
| 1686 |
*
|
| 1687 |
-
*
|
| 1688 |
-
*
|
| 1689 |
*
|
| 1690 |
-
*
|
| 1691 |
-
*
|
| 1692 |
-
*
|
| 1693 |
-
* and pass the created socket/stream to it (e.g., `callback(null, newSocket)`).
|
| 1694 |
-
* If an error occurs during socket creation, it should be passed as the first
|
| 1695 |
-
* argument to the `callback` (e.g., `callback(err)`).
|
| 1696 |
*
|
| 1697 |
-
*
|
| 1698 |
-
* this internal `callback`. The `callback` provided by the agent has a signature
|
| 1699 |
-
* of `(err, stream)`.
|
| 1700 |
* @since v0.11.4
|
| 1701 |
-
* @param options Options containing connection details. Check
|
| 1702 |
-
*
|
| 1703 |
-
* this object is passed to the custom `createConnection` function.
|
| 1704 |
-
* @param callback (Optional, primarily for custom agents) A function to be
|
| 1705 |
-
* called by a custom `createConnection` implementation when the socket is
|
| 1706 |
-
* created, especially for asynchronous operations.
|
| 1707 |
-
* @returns The created socket. This is returned by the default
|
| 1708 |
-
* implementation or by a custom synchronous `createConnection` implementation.
|
| 1709 |
-
* If a custom `createConnection` uses the `callback` for asynchronous
|
| 1710 |
-
* operation, this return value might not be the primary way to obtain the socket.
|
| 1711 |
*/
|
| 1712 |
createConnection(
|
| 1713 |
options: ClientRequestArgs,
|
|
@@ -2148,20 +2043,7 @@ declare module "node:http" {
|
|
| 2148 |
* Defaults to 16KB. Configurable using the `--max-http-header-size` CLI option.
|
| 2149 |
*/
|
| 2150 |
const maxHeaderSize: number;
|
| 2151 |
-
/**
|
| 2152 |
-
* A browser-compatible implementation of `WebSocket`.
|
| 2153 |
-
* @since v22.5.0
|
| 2154 |
-
*/
|
| 2155 |
-
const WebSocket: typeof import("undici-types").WebSocket;
|
| 2156 |
-
/**
|
| 2157 |
-
* @since v22.5.0
|
| 2158 |
-
*/
|
| 2159 |
-
const CloseEvent: typeof import("undici-types").CloseEvent;
|
| 2160 |
-
/**
|
| 2161 |
-
* @since v22.5.0
|
| 2162 |
-
*/
|
| 2163 |
-
const MessageEvent: typeof import("undici-types").MessageEvent;
|
| 2164 |
}
|
| 2165 |
-
declare module "http" {
|
| 2166 |
-
export * from "
|
| 2167 |
}
|
|
|
|
| 37 |
* 'Host', 'example.com',
|
| 38 |
* 'accepT', '*' ]
|
| 39 |
* ```
|
| 40 |
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/http.js)
|
| 41 |
*/
|
| 42 |
+
declare module "http" {
|
| 43 |
import { NonSharedBuffer } from "node:buffer";
|
|
|
|
|
|
|
|
|
|
| 44 |
import * as stream from "node:stream";
|
| 45 |
import { URL } from "node:url";
|
| 46 |
+
import { LookupOptions } from "node:dns";
|
| 47 |
+
import { EventEmitter } from "node:events";
|
| 48 |
+
import { LookupFunction, Server as NetServer, Socket, TcpSocketConnectOpts } from "node:net";
|
| 49 |
// incoming headers will never contain number
|
| 50 |
interface IncomingHttpHeaders extends NodeJS.Dict<string | string[]> {
|
| 51 |
accept?: string | undefined;
|
|
|
|
| 147 |
"content-range"?: string | undefined;
|
| 148 |
"content-security-policy"?: string | undefined;
|
| 149 |
"content-security-policy-report-only"?: string | undefined;
|
|
|
|
| 150 |
cookie?: string | string[] | undefined;
|
| 151 |
dav?: string | string[] | undefined;
|
| 152 |
dnt?: string | undefined;
|
|
|
|
| 218 |
insecureHTTPParser?: boolean | undefined;
|
| 219 |
localAddress?: string | undefined;
|
| 220 |
localPort?: number | undefined;
|
| 221 |
+
lookup?: LookupFunction | undefined;
|
| 222 |
/**
|
| 223 |
* @default 16384
|
| 224 |
*/
|
|
|
|
| 227 |
path?: string | null | undefined;
|
| 228 |
port?: number | string | null | undefined;
|
| 229 |
protocol?: string | null | undefined;
|
|
|
|
| 230 |
setHost?: boolean | undefined;
|
| 231 |
signal?: AbortSignal | undefined;
|
| 232 |
socketPath?: string | undefined;
|
|
|
|
| 267 |
* @since v18.0.0
|
| 268 |
*/
|
| 269 |
keepAliveTimeout?: number | undefined;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 270 |
/**
|
| 271 |
* Sets the interval value in milliseconds to check for request and headers timeout in incomplete requests.
|
| 272 |
* @default 30000
|
|
|
|
| 331 |
* If the header's value is an array, the items will be joined using `; `.
|
| 332 |
*/
|
| 333 |
uniqueHeaders?: Array<string | string[]> | undefined;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 334 |
/**
|
| 335 |
* If set to `true`, an error is thrown when writing to an HTTP response which does not have a body.
|
| 336 |
* @default false
|
| 337 |
* @since v18.17.0, v20.2.0
|
| 338 |
*/
|
| 339 |
rejectNonStandardBodyWrites?: boolean | undefined;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 340 |
}
|
| 341 |
type RequestListener<
|
| 342 |
Request extends typeof IncomingMessage = typeof IncomingMessage,
|
| 343 |
Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
|
| 344 |
+
> = (req: InstanceType<Request>, res: InstanceType<Response> & { req: InstanceType<Request> }) => void;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 345 |
/**
|
| 346 |
* @since v0.1.17
|
| 347 |
*/
|
| 348 |
class Server<
|
| 349 |
Request extends typeof IncomingMessage = typeof IncomingMessage,
|
| 350 |
Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
|
| 351 |
+
> extends NetServer {
|
| 352 |
constructor(requestListener?: RequestListener<Request, Response>);
|
| 353 |
constructor(options: ServerOptions<Request, Response>, requestListener?: RequestListener<Request, Response>);
|
| 354 |
/**
|
|
|
|
| 365 |
* @since v0.9.12
|
| 366 |
* @param [msecs=0 (no timeout)]
|
| 367 |
*/
|
| 368 |
+
setTimeout(msecs?: number, callback?: (socket: Socket) => void): this;
|
| 369 |
+
setTimeout(callback: (socket: Socket) => void): this;
|
| 370 |
/**
|
| 371 |
* Limits maximum incoming headers count. If set to 0, no limit will be applied.
|
| 372 |
* @since v0.7.0
|
|
|
|
| 411 |
/**
|
| 412 |
* The number of milliseconds of inactivity a server needs to wait for additional
|
| 413 |
* incoming data, after it has finished writing the last response, before a socket
|
| 414 |
+
* will be destroyed. If the server receives new data before the keep-alive
|
| 415 |
+
* timeout has fired, it will reset the regular inactivity timeout, i.e., `server.timeout`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 416 |
*
|
| 417 |
* A value of `0` will disable the keep-alive timeout behavior on incoming
|
| 418 |
* connections.
|
| 419 |
+
* A value of `0` makes the http server behave similarly to Node.js versions prior
|
| 420 |
* to 8.0.0, which did not have a keep-alive timeout.
|
| 421 |
*
|
| 422 |
* The socket timeout logic is set up on connection, so changing this value only
|
|
|
|
| 424 |
* @since v8.0.0
|
| 425 |
*/
|
| 426 |
keepAliveTimeout: number;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 427 |
/**
|
| 428 |
* Sets the timeout value in milliseconds for receiving the entire request from
|
| 429 |
* the client.
|
|
|
|
| 448 |
* @since v18.2.0
|
| 449 |
*/
|
| 450 |
closeIdleConnections(): void;
|
| 451 |
+
addListener(event: string, listener: (...args: any[]) => void): this;
|
| 452 |
+
addListener(event: "close", listener: () => void): this;
|
| 453 |
+
addListener(event: "connection", listener: (socket: Socket) => void): this;
|
| 454 |
+
addListener(event: "error", listener: (err: Error) => void): this;
|
| 455 |
+
addListener(event: "listening", listener: () => void): this;
|
| 456 |
+
addListener(event: "checkContinue", listener: RequestListener<Request, Response>): this;
|
| 457 |
+
addListener(event: "checkExpectation", listener: RequestListener<Request, Response>): this;
|
| 458 |
+
addListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this;
|
| 459 |
+
addListener(
|
| 460 |
+
event: "connect",
|
| 461 |
+
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer) => void,
|
| 462 |
): this;
|
| 463 |
+
addListener(event: "dropRequest", listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
|
| 464 |
+
addListener(event: "request", listener: RequestListener<Request, Response>): this;
|
| 465 |
+
addListener(
|
| 466 |
+
event: "upgrade",
|
| 467 |
+
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer) => void,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 468 |
): this;
|
| 469 |
+
emit(event: string, ...args: any[]): boolean;
|
| 470 |
+
emit(event: "close"): boolean;
|
| 471 |
+
emit(event: "connection", socket: Socket): boolean;
|
| 472 |
+
emit(event: "error", err: Error): boolean;
|
| 473 |
+
emit(event: "listening"): boolean;
|
| 474 |
+
emit(
|
| 475 |
+
event: "checkContinue",
|
| 476 |
+
req: InstanceType<Request>,
|
| 477 |
+
res: InstanceType<Response> & { req: InstanceType<Request> },
|
| 478 |
+
): boolean;
|
| 479 |
+
emit(
|
| 480 |
+
event: "checkExpectation",
|
| 481 |
+
req: InstanceType<Request>,
|
| 482 |
+
res: InstanceType<Response> & { req: InstanceType<Request> },
|
| 483 |
+
): boolean;
|
| 484 |
+
emit(event: "clientError", err: Error, socket: stream.Duplex): boolean;
|
| 485 |
+
emit(event: "connect", req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer): boolean;
|
| 486 |
+
emit(event: "dropRequest", req: InstanceType<Request>, socket: stream.Duplex): boolean;
|
| 487 |
+
emit(
|
| 488 |
+
event: "request",
|
| 489 |
+
req: InstanceType<Request>,
|
| 490 |
+
res: InstanceType<Response> & { req: InstanceType<Request> },
|
| 491 |
+
): boolean;
|
| 492 |
+
emit(event: "upgrade", req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer): boolean;
|
| 493 |
+
on(event: string, listener: (...args: any[]) => void): this;
|
| 494 |
+
on(event: "close", listener: () => void): this;
|
| 495 |
+
on(event: "connection", listener: (socket: Socket) => void): this;
|
| 496 |
+
on(event: "error", listener: (err: Error) => void): this;
|
| 497 |
+
on(event: "listening", listener: () => void): this;
|
| 498 |
+
on(event: "checkContinue", listener: RequestListener<Request, Response>): this;
|
| 499 |
+
on(event: "checkExpectation", listener: RequestListener<Request, Response>): this;
|
| 500 |
+
on(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this;
|
| 501 |
+
on(
|
| 502 |
+
event: "connect",
|
| 503 |
+
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer) => void,
|
| 504 |
): this;
|
| 505 |
+
on(event: "dropRequest", listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
|
| 506 |
+
on(event: "request", listener: RequestListener<Request, Response>): this;
|
| 507 |
+
on(
|
| 508 |
+
event: "upgrade",
|
| 509 |
+
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer) => void,
|
| 510 |
): this;
|
| 511 |
+
once(event: string, listener: (...args: any[]) => void): this;
|
| 512 |
+
once(event: "close", listener: () => void): this;
|
| 513 |
+
once(event: "connection", listener: (socket: Socket) => void): this;
|
| 514 |
+
once(event: "error", listener: (err: Error) => void): this;
|
| 515 |
+
once(event: "listening", listener: () => void): this;
|
| 516 |
+
once(event: "checkContinue", listener: RequestListener<Request, Response>): this;
|
| 517 |
+
once(event: "checkExpectation", listener: RequestListener<Request, Response>): this;
|
| 518 |
+
once(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this;
|
| 519 |
+
once(
|
| 520 |
+
event: "connect",
|
| 521 |
+
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer) => void,
|
| 522 |
): this;
|
| 523 |
+
once(event: "dropRequest", listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
|
| 524 |
+
once(event: "request", listener: RequestListener<Request, Response>): this;
|
| 525 |
+
once(
|
| 526 |
+
event: "upgrade",
|
| 527 |
+
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer) => void,
|
| 528 |
): this;
|
| 529 |
+
prependListener(event: string, listener: (...args: any[]) => void): this;
|
| 530 |
+
prependListener(event: "close", listener: () => void): this;
|
| 531 |
+
prependListener(event: "connection", listener: (socket: Socket) => void): this;
|
| 532 |
+
prependListener(event: "error", listener: (err: Error) => void): this;
|
| 533 |
+
prependListener(event: "listening", listener: () => void): this;
|
| 534 |
+
prependListener(event: "checkContinue", listener: RequestListener<Request, Response>): this;
|
| 535 |
+
prependListener(event: "checkExpectation", listener: RequestListener<Request, Response>): this;
|
| 536 |
+
prependListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this;
|
| 537 |
+
prependListener(
|
| 538 |
+
event: "connect",
|
| 539 |
+
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer) => void,
|
| 540 |
+
): this;
|
| 541 |
+
prependListener(
|
| 542 |
+
event: "dropRequest",
|
| 543 |
+
listener: (req: InstanceType<Request>, socket: stream.Duplex) => void,
|
| 544 |
+
): this;
|
| 545 |
+
prependListener(event: "request", listener: RequestListener<Request, Response>): this;
|
| 546 |
+
prependListener(
|
| 547 |
+
event: "upgrade",
|
| 548 |
+
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer) => void,
|
| 549 |
+
): this;
|
| 550 |
+
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
| 551 |
+
prependOnceListener(event: "close", listener: () => void): this;
|
| 552 |
+
prependOnceListener(event: "connection", listener: (socket: Socket) => void): this;
|
| 553 |
+
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
| 554 |
+
prependOnceListener(event: "listening", listener: () => void): this;
|
| 555 |
+
prependOnceListener(event: "checkContinue", listener: RequestListener<Request, Response>): this;
|
| 556 |
+
prependOnceListener(event: "checkExpectation", listener: RequestListener<Request, Response>): this;
|
| 557 |
+
prependOnceListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this;
|
| 558 |
+
prependOnceListener(
|
| 559 |
+
event: "connect",
|
| 560 |
+
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer) => void,
|
| 561 |
+
): this;
|
| 562 |
+
prependOnceListener(
|
| 563 |
+
event: "dropRequest",
|
| 564 |
+
listener: (req: InstanceType<Request>, socket: stream.Duplex) => void,
|
| 565 |
+
): this;
|
| 566 |
+
prependOnceListener(event: "request", listener: RequestListener<Request, Response>): this;
|
| 567 |
+
prependOnceListener(
|
| 568 |
+
event: "upgrade",
|
| 569 |
+
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer) => void,
|
| 570 |
): this;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 571 |
}
|
| 572 |
/**
|
| 573 |
* This class serves as the parent class of {@link ClientRequest} and {@link ServerResponse}. It is an abstract outgoing message from
|
|
|
|
| 575 |
* @since v0.1.17
|
| 576 |
*/
|
| 577 |
class OutgoingMessage<Request extends IncomingMessage = IncomingMessage> extends stream.Writable {
|
|
|
|
| 578 |
readonly req: Request;
|
| 579 |
chunkedEncoding: boolean;
|
| 580 |
shouldKeepAlive: boolean;
|
|
|
|
| 594 |
* @since v0.3.0
|
| 595 |
* @deprecated Since v15.12.0,v14.17.1 - Use `socket` instead.
|
| 596 |
*/
|
| 597 |
+
readonly connection: Socket | null;
|
| 598 |
/**
|
| 599 |
* Reference to the underlying socket. Usually, users will not want to access
|
| 600 |
* this property.
|
|
|
|
| 602 |
* After calling `outgoingMessage.end()`, this property will be nulled.
|
| 603 |
* @since v0.3.0
|
| 604 |
*/
|
| 605 |
+
readonly socket: Socket | null;
|
| 606 |
+
constructor();
|
| 607 |
/**
|
| 608 |
* Once a socket is associated with the message and is connected, `socket.setTimeout()` will be called with `msecs` as the first parameter.
|
| 609 |
* @since v0.9.12
|
|
|
|
| 761 |
* @since v1.6.0
|
| 762 |
*/
|
| 763 |
flushHeaders(): void;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 764 |
}
|
| 765 |
/**
|
| 766 |
* This object is created internally by an HTTP server, not by the user. It is
|
|
|
|
| 805 |
*/
|
| 806 |
strictContentLength: boolean;
|
| 807 |
constructor(req: Request);
|
| 808 |
+
assignSocket(socket: Socket): void;
|
| 809 |
+
detachSocket(socket: Socket): void;
|
| 810 |
/**
|
| 811 |
* Sends an HTTP/1.1 100 Continue message to the client, indicating that
|
| 812 |
* the request body should be sent. See the `'checkContinue'` event on `Server`.
|
|
|
|
| 918 |
writeProcessing(callback?: () => void): void;
|
| 919 |
}
|
| 920 |
interface InformationEvent {
|
| 921 |
+
statusCode: number;
|
| 922 |
+
statusMessage: string;
|
| 923 |
httpVersion: string;
|
| 924 |
httpVersionMajor: number;
|
| 925 |
httpVersionMinor: number;
|
|
|
|
|
|
|
| 926 |
headers: IncomingHttpHeaders;
|
| 927 |
rawHeaders: string[];
|
| 928 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 929 |
/**
|
| 930 |
* This object is created internally and returned from {@link request}. It
|
| 931 |
* represents an _in-progress_ request whose header has already been queued. The
|
|
|
|
| 982 |
*
|
| 983 |
* ```js
|
| 984 |
* import http from 'node:http';
|
|
|
|
| 985 |
*
|
| 986 |
* // Server has a 5 seconds keep-alive timeout by default
|
| 987 |
* http
|
|
|
|
| 1048 |
* @deprecated Since v14.1.0,v13.14.0 - Use `destroy` instead.
|
| 1049 |
*/
|
| 1050 |
abort(): void;
|
| 1051 |
+
onSocket(socket: Socket): void;
|
| 1052 |
/**
|
| 1053 |
* Once a socket is assigned to this request and is connected `socket.setTimeout()` will be called.
|
| 1054 |
* @since v0.5.9
|
|
|
|
| 1080 |
* @since v15.13.0, v14.17.0
|
| 1081 |
*/
|
| 1082 |
getRawHeaderNames(): string[];
|
| 1083 |
+
/**
|
| 1084 |
+
* @deprecated
|
| 1085 |
+
*/
|
| 1086 |
+
addListener(event: "abort", listener: () => void): this;
|
| 1087 |
+
addListener(
|
| 1088 |
+
event: "connect",
|
| 1089 |
+
listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void,
|
| 1090 |
): this;
|
| 1091 |
+
addListener(event: "continue", listener: () => void): this;
|
| 1092 |
+
addListener(event: "information", listener: (info: InformationEvent) => void): this;
|
| 1093 |
+
addListener(event: "response", listener: (response: IncomingMessage) => void): this;
|
| 1094 |
+
addListener(event: "socket", listener: (socket: Socket) => void): this;
|
| 1095 |
+
addListener(event: "timeout", listener: () => void): this;
|
| 1096 |
+
addListener(
|
| 1097 |
+
event: "upgrade",
|
| 1098 |
+
listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1099 |
): this;
|
| 1100 |
+
addListener(event: "close", listener: () => void): this;
|
| 1101 |
+
addListener(event: "drain", listener: () => void): this;
|
| 1102 |
+
addListener(event: "error", listener: (err: Error) => void): this;
|
| 1103 |
+
addListener(event: "finish", listener: () => void): this;
|
| 1104 |
+
addListener(event: "pipe", listener: (src: stream.Readable) => void): this;
|
| 1105 |
+
addListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
| 1106 |
+
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 1107 |
+
/**
|
| 1108 |
+
* @deprecated
|
| 1109 |
+
*/
|
| 1110 |
+
on(event: "abort", listener: () => void): this;
|
| 1111 |
+
on(
|
| 1112 |
+
event: "connect",
|
| 1113 |
+
listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void,
|
| 1114 |
): this;
|
| 1115 |
+
on(event: "continue", listener: () => void): this;
|
| 1116 |
+
on(event: "information", listener: (info: InformationEvent) => void): this;
|
| 1117 |
+
on(event: "response", listener: (response: IncomingMessage) => void): this;
|
| 1118 |
+
on(event: "socket", listener: (socket: Socket) => void): this;
|
| 1119 |
+
on(event: "timeout", listener: () => void): this;
|
| 1120 |
+
on(
|
| 1121 |
+
event: "upgrade",
|
| 1122 |
+
listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void,
|
| 1123 |
): this;
|
| 1124 |
+
on(event: "close", listener: () => void): this;
|
| 1125 |
+
on(event: "drain", listener: () => void): this;
|
| 1126 |
+
on(event: "error", listener: (err: Error) => void): this;
|
| 1127 |
+
on(event: "finish", listener: () => void): this;
|
| 1128 |
+
on(event: "pipe", listener: (src: stream.Readable) => void): this;
|
| 1129 |
+
on(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
| 1130 |
+
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 1131 |
+
/**
|
| 1132 |
+
* @deprecated
|
| 1133 |
+
*/
|
| 1134 |
+
once(event: "abort", listener: () => void): this;
|
| 1135 |
+
once(
|
| 1136 |
+
event: "connect",
|
| 1137 |
+
listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void,
|
| 1138 |
): this;
|
| 1139 |
+
once(event: "continue", listener: () => void): this;
|
| 1140 |
+
once(event: "information", listener: (info: InformationEvent) => void): this;
|
| 1141 |
+
once(event: "response", listener: (response: IncomingMessage) => void): this;
|
| 1142 |
+
once(event: "socket", listener: (socket: Socket) => void): this;
|
| 1143 |
+
once(event: "timeout", listener: () => void): this;
|
| 1144 |
+
once(
|
| 1145 |
+
event: "upgrade",
|
| 1146 |
+
listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void,
|
| 1147 |
): this;
|
| 1148 |
+
once(event: "close", listener: () => void): this;
|
| 1149 |
+
once(event: "drain", listener: () => void): this;
|
| 1150 |
+
once(event: "error", listener: (err: Error) => void): this;
|
| 1151 |
+
once(event: "finish", listener: () => void): this;
|
| 1152 |
+
once(event: "pipe", listener: (src: stream.Readable) => void): this;
|
| 1153 |
+
once(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
| 1154 |
+
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 1155 |
+
/**
|
| 1156 |
+
* @deprecated
|
| 1157 |
+
*/
|
| 1158 |
+
prependListener(event: "abort", listener: () => void): this;
|
| 1159 |
+
prependListener(
|
| 1160 |
+
event: "connect",
|
| 1161 |
+
listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void,
|
| 1162 |
): this;
|
| 1163 |
+
prependListener(event: "continue", listener: () => void): this;
|
| 1164 |
+
prependListener(event: "information", listener: (info: InformationEvent) => void): this;
|
| 1165 |
+
prependListener(event: "response", listener: (response: IncomingMessage) => void): this;
|
| 1166 |
+
prependListener(event: "socket", listener: (socket: Socket) => void): this;
|
| 1167 |
+
prependListener(event: "timeout", listener: () => void): this;
|
| 1168 |
+
prependListener(
|
| 1169 |
+
event: "upgrade",
|
| 1170 |
+
listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void,
|
| 1171 |
+
): this;
|
| 1172 |
+
prependListener(event: "close", listener: () => void): this;
|
| 1173 |
+
prependListener(event: "drain", listener: () => void): this;
|
| 1174 |
+
prependListener(event: "error", listener: (err: Error) => void): this;
|
| 1175 |
+
prependListener(event: "finish", listener: () => void): this;
|
| 1176 |
+
prependListener(event: "pipe", listener: (src: stream.Readable) => void): this;
|
| 1177 |
+
prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
| 1178 |
+
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 1179 |
+
/**
|
| 1180 |
+
* @deprecated
|
| 1181 |
+
*/
|
| 1182 |
+
prependOnceListener(event: "abort", listener: () => void): this;
|
| 1183 |
+
prependOnceListener(
|
| 1184 |
+
event: "connect",
|
| 1185 |
+
listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void,
|
| 1186 |
+
): this;
|
| 1187 |
+
prependOnceListener(event: "continue", listener: () => void): this;
|
| 1188 |
+
prependOnceListener(event: "information", listener: (info: InformationEvent) => void): this;
|
| 1189 |
+
prependOnceListener(event: "response", listener: (response: IncomingMessage) => void): this;
|
| 1190 |
+
prependOnceListener(event: "socket", listener: (socket: Socket) => void): this;
|
| 1191 |
+
prependOnceListener(event: "timeout", listener: () => void): this;
|
| 1192 |
+
prependOnceListener(
|
| 1193 |
+
event: "upgrade",
|
| 1194 |
+
listener: (response: IncomingMessage, socket: Socket, head: NonSharedBuffer) => void,
|
| 1195 |
+
): this;
|
| 1196 |
+
prependOnceListener(event: "close", listener: () => void): this;
|
| 1197 |
+
prependOnceListener(event: "drain", listener: () => void): this;
|
| 1198 |
+
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
| 1199 |
+
prependOnceListener(event: "finish", listener: () => void): this;
|
| 1200 |
+
prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this;
|
| 1201 |
+
prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
| 1202 |
+
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 1203 |
}
|
| 1204 |
/**
|
| 1205 |
* An `IncomingMessage` object is created by {@link Server} or {@link ClientRequest} and passed as the first argument to the `'request'` and `'response'` event respectively. It may be used to
|
|
|
|
| 1212 |
* @since v0.1.17
|
| 1213 |
*/
|
| 1214 |
class IncomingMessage extends stream.Readable {
|
| 1215 |
+
constructor(socket: Socket);
|
| 1216 |
/**
|
| 1217 |
* The `message.aborted` property will be `true` if the request has
|
| 1218 |
* been aborted.
|
|
|
|
| 1260 |
* @since v0.1.90
|
| 1261 |
* @deprecated Since v16.0.0 - Use `socket`.
|
| 1262 |
*/
|
| 1263 |
+
connection: Socket;
|
| 1264 |
/**
|
| 1265 |
* The `net.Socket` object associated with the connection.
|
| 1266 |
*
|
|
|
|
| 1272 |
* type other than `net.Socket` or internally nulled.
|
| 1273 |
* @since v0.3.0
|
| 1274 |
*/
|
| 1275 |
+
socket: Socket;
|
| 1276 |
/**
|
| 1277 |
* The request/response headers object.
|
| 1278 |
*
|
|
|
|
| 1434 |
* @since v0.3.0
|
| 1435 |
*/
|
| 1436 |
destroy(error?: Error): this;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1437 |
}
|
| 1438 |
+
interface AgentOptions extends NodeJS.PartialOptions<TcpSocketConnectOpts> {
|
| 1439 |
/**
|
| 1440 |
* Keep sockets around in a pool to be used by other requests in the future. Default = false
|
| 1441 |
*/
|
|
|
|
| 1445 |
* Only relevant if keepAlive is set to true.
|
| 1446 |
*/
|
| 1447 |
keepAliveMsecs?: number | undefined;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1448 |
/**
|
| 1449 |
* Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity
|
| 1450 |
*/
|
|
|
|
| 1466 |
* @default `lifo`
|
| 1467 |
*/
|
| 1468 |
scheduling?: "fifo" | "lifo" | undefined;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1469 |
}
|
| 1470 |
/**
|
| 1471 |
* An `Agent` is responsible for managing connection persistence
|
|
|
|
| 1521 |
* });
|
| 1522 |
* ```
|
| 1523 |
*
|
| 1524 |
+
* `options` in [`socket.connect()`](https://nodejs.org/docs/latest-v20.x/api/net.html#socketconnectoptions-connectlistener) are also supported.
|
| 1525 |
*
|
| 1526 |
* To configure any of them, a custom {@link Agent} instance must be created.
|
| 1527 |
*
|
|
|
|
| 1561 |
* removed from the array on `'timeout'`.
|
| 1562 |
* @since v0.11.4
|
| 1563 |
*/
|
| 1564 |
+
readonly freeSockets: NodeJS.ReadOnlyDict<Socket[]>;
|
| 1565 |
/**
|
| 1566 |
* An object which contains arrays of sockets currently in use by the
|
| 1567 |
* agent. Do not modify.
|
| 1568 |
* @since v0.3.6
|
| 1569 |
*/
|
| 1570 |
+
readonly sockets: NodeJS.ReadOnlyDict<Socket[]>;
|
| 1571 |
/**
|
| 1572 |
* An object which contains queues of requests that have not yet been assigned to
|
| 1573 |
* sockets. Do not modify.
|
|
|
|
| 1589 |
/**
|
| 1590 |
* Produces a socket/stream to be used for HTTP requests.
|
| 1591 |
*
|
| 1592 |
+
* By default, this function is the same as `net.createConnection()`. However,
|
| 1593 |
+
* custom agents may override this method in case greater flexibility is desired.
|
|
|
|
| 1594 |
*
|
| 1595 |
+
* A socket/stream can be supplied in one of two ways: by returning the
|
| 1596 |
+
* socket/stream from this function, or by passing the socket/stream to `callback`.
|
| 1597 |
*
|
| 1598 |
+
* This method is guaranteed to return an instance of the `net.Socket` class,
|
| 1599 |
+
* a subclass of `stream.Duplex`, unless the user specifies a socket
|
| 1600 |
+
* type other than `net.Socket`.
|
|
|
|
|
|
|
|
|
|
| 1601 |
*
|
| 1602 |
+
* `callback` has a signature of `(err, stream)`.
|
|
|
|
|
|
|
| 1603 |
* @since v0.11.4
|
| 1604 |
+
* @param options Options containing connection details. Check `createConnection` for the format of the options
|
| 1605 |
+
* @param callback Callback function that receives the created socket
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1606 |
*/
|
| 1607 |
createConnection(
|
| 1608 |
options: ClientRequestArgs,
|
|
|
|
| 2043 |
* Defaults to 16KB. Configurable using the `--max-http-header-size` CLI option.
|
| 2044 |
*/
|
| 2045 |
const maxHeaderSize: number;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2046 |
}
|
| 2047 |
+
declare module "node:http" {
|
| 2048 |
+
export * from "http";
|
| 2049 |
}
|
node_modules/@types/node/http2.d.ts
CHANGED
|
@@ -6,11 +6,11 @@
|
|
| 6 |
* import http2 from 'node:http2';
|
| 7 |
* ```
|
| 8 |
* @since v8.4.0
|
| 9 |
-
* @see [source](https://github.com/nodejs/node/blob/
|
| 10 |
*/
|
| 11 |
-
declare module "
|
| 12 |
import { NonSharedBuffer } from "node:buffer";
|
| 13 |
-
import
|
| 14 |
import * as fs from "node:fs";
|
| 15 |
import * as net from "node:net";
|
| 16 |
import * as stream from "node:stream";
|
|
@@ -22,35 +22,40 @@ declare module "node:http2" {
|
|
| 22 |
OutgoingHttpHeaders,
|
| 23 |
ServerResponse,
|
| 24 |
} from "node:http";
|
| 25 |
-
|
|
|
|
| 26 |
":status"?: number | undefined;
|
| 27 |
}
|
| 28 |
-
interface IncomingHttpHeaders extends Http1IncomingHttpHeaders {
|
| 29 |
":path"?: string | undefined;
|
| 30 |
":method"?: string | undefined;
|
| 31 |
":authority"?: string | undefined;
|
| 32 |
":scheme"?: string | undefined;
|
| 33 |
}
|
| 34 |
// Http2Stream
|
| 35 |
-
interface
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
localWindowSize?: number | undefined;
|
| 37 |
state?: number | undefined;
|
| 38 |
localClose?: number | undefined;
|
| 39 |
remoteClose?: number | undefined;
|
| 40 |
-
/** @deprecated */
|
| 41 |
sumDependencyWeight?: number | undefined;
|
| 42 |
-
/** @deprecated */
|
| 43 |
weight?: number | undefined;
|
| 44 |
}
|
| 45 |
-
interface ServerStreamResponseOptions {
|
| 46 |
endStream?: boolean | undefined;
|
| 47 |
waitForTrailers?: boolean | undefined;
|
| 48 |
}
|
| 49 |
-
interface StatOptions {
|
| 50 |
offset: number;
|
| 51 |
length: number;
|
| 52 |
}
|
| 53 |
-
interface ServerStreamFileResponseOptions {
|
| 54 |
statCheck?:
|
| 55 |
| ((stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions) => void)
|
| 56 |
| undefined;
|
|
@@ -58,20 +63,10 @@ declare module "node:http2" {
|
|
| 58 |
offset?: number | undefined;
|
| 59 |
length?: number | undefined;
|
| 60 |
}
|
| 61 |
-
interface ServerStreamFileResponseOptionsWithError extends ServerStreamFileResponseOptions {
|
| 62 |
onError?: ((err: NodeJS.ErrnoException) => void) | undefined;
|
| 63 |
}
|
| 64 |
-
interface
|
| 65 |
-
"aborted": [];
|
| 66 |
-
"data": [chunk: string | NonSharedBuffer];
|
| 67 |
-
"frameError": [type: number, code: number, id: number];
|
| 68 |
-
"ready": [];
|
| 69 |
-
"streamClosed": [code: number];
|
| 70 |
-
"timeout": [];
|
| 71 |
-
"trailers": [trailers: IncomingHttpHeaders, flags: number];
|
| 72 |
-
"wantTrailers": [];
|
| 73 |
-
}
|
| 74 |
-
interface Http2Stream extends stream.Duplex {
|
| 75 |
/**
|
| 76 |
* Set to `true` if the `Http2Stream` instance was aborted abnormally. When set,
|
| 77 |
* the `'aborted'` event will have been emitted.
|
|
@@ -158,9 +153,10 @@ declare module "node:http2" {
|
|
| 158 |
*/
|
| 159 |
close(code?: number, callback?: () => void): void;
|
| 160 |
/**
|
| 161 |
-
*
|
|
|
|
| 162 |
*/
|
| 163 |
-
priority(options:
|
| 164 |
/**
|
| 165 |
* ```js
|
| 166 |
* import http2 from 'node:http2';
|
|
@@ -199,122 +195,160 @@ declare module "node:http2" {
|
|
| 199 |
* @since v10.0.0
|
| 200 |
*/
|
| 201 |
sendTrailers(headers: OutgoingHttpHeaders): void;
|
| 202 |
-
|
| 203 |
-
addListener
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
): this;
|
| 207 |
-
addListener(
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
):
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
):
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
):
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
):
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
): this;
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
): this;
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
): this;
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
"
|
| 256 |
-
"
|
| 257 |
-
"
|
| 258 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 259 |
}
|
| 260 |
-
interface ClientHttp2Stream extends Http2Stream {
|
| 261 |
-
|
| 262 |
-
addListener
|
| 263 |
-
|
| 264 |
-
listener: (
|
| 265 |
-
): this;
|
| 266 |
-
addListener(
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
):
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
listener: (
|
| 281 |
-
): this;
|
| 282 |
-
|
| 283 |
-
on
|
| 284 |
-
|
| 285 |
-
listener: (
|
| 286 |
-
): this;
|
| 287 |
-
on(
|
| 288 |
-
once
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 316 |
}
|
| 317 |
-
interface ServerHttp2Stream extends Http2Stream {
|
| 318 |
/**
|
| 319 |
* True if headers were sent, false otherwise (read-only).
|
| 320 |
* @since v8.4.0
|
|
@@ -363,7 +397,7 @@ declare module "node:http2" {
|
|
| 363 |
): void;
|
| 364 |
pushStream(
|
| 365 |
headers: OutgoingHttpHeaders,
|
| 366 |
-
options?:
|
| 367 |
callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void,
|
| 368 |
): void;
|
| 369 |
/**
|
|
@@ -396,7 +430,7 @@ declare module "node:http2" {
|
|
| 396 |
* ```
|
| 397 |
* @since v8.4.0
|
| 398 |
*/
|
| 399 |
-
respond(headers?: OutgoingHttpHeaders
|
| 400 |
/**
|
| 401 |
* Initiates a response whose data is read from the given file descriptor. No
|
| 402 |
* validation is performed on the given file descriptor. If an error occurs while
|
|
@@ -584,7 +618,7 @@ declare module "node:http2" {
|
|
| 584 |
): void;
|
| 585 |
}
|
| 586 |
// Http2Session
|
| 587 |
-
interface Settings {
|
| 588 |
headerTableSize?: number | undefined;
|
| 589 |
enablePush?: boolean | undefined;
|
| 590 |
initialWindowSize?: number | undefined;
|
|
@@ -593,14 +627,15 @@ declare module "node:http2" {
|
|
| 593 |
maxHeaderListSize?: number | undefined;
|
| 594 |
enableConnectProtocol?: boolean | undefined;
|
| 595 |
}
|
| 596 |
-
interface ClientSessionRequestOptions {
|
| 597 |
endStream?: boolean | undefined;
|
| 598 |
exclusive?: boolean | undefined;
|
| 599 |
parent?: number | undefined;
|
|
|
|
| 600 |
waitForTrailers?: boolean | undefined;
|
| 601 |
signal?: AbortSignal | undefined;
|
| 602 |
}
|
| 603 |
-
interface SessionState {
|
| 604 |
effectiveLocalWindowSize?: number | undefined;
|
| 605 |
effectiveRecvDataLength?: number | undefined;
|
| 606 |
nextStreamID?: number | undefined;
|
|
@@ -611,24 +646,7 @@ declare module "node:http2" {
|
|
| 611 |
deflateDynamicTableSize?: number | undefined;
|
| 612 |
inflateDynamicTableSize?: number | undefined;
|
| 613 |
}
|
| 614 |
-
interface
|
| 615 |
-
"close": [];
|
| 616 |
-
"connect": [session: Http2Session, socket: net.Socket | tls.TLSSocket];
|
| 617 |
-
"error": [err: Error];
|
| 618 |
-
"frameError": [type: number, code: number, id: number];
|
| 619 |
-
"goaway": [errorCode: number, lastStreamID: number, opaqueData?: NonSharedBuffer];
|
| 620 |
-
"localSettings": [settings: Settings];
|
| 621 |
-
"ping": [payload: Buffer];
|
| 622 |
-
"remoteSettings": [settings: Settings];
|
| 623 |
-
"stream": [
|
| 624 |
-
stream: Http2Stream,
|
| 625 |
-
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
|
| 626 |
-
flags: number,
|
| 627 |
-
rawHeaders: string[],
|
| 628 |
-
];
|
| 629 |
-
"timeout": [];
|
| 630 |
-
}
|
| 631 |
-
interface Http2Session extends InternalEventEmitter<Http2SessionEventMap> {
|
| 632 |
/**
|
| 633 |
* Value will be `undefined` if the `Http2Session` is not yet connected to a
|
| 634 |
* socket, `h2c` if the `Http2Session` is not connected to a `TLSSocket`, or
|
|
@@ -830,19 +848,86 @@ declare module "node:http2" {
|
|
| 830 |
* @since v9.4.0
|
| 831 |
*/
|
| 832 |
unref(): void;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 833 |
}
|
| 834 |
-
interface
|
| 835 |
-
"altsvc": [alt: string, origin: string, streamId: number];
|
| 836 |
-
"connect": [session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket];
|
| 837 |
-
"origin": [origins: string[]];
|
| 838 |
-
"stream": [
|
| 839 |
-
stream: ClientHttp2Stream,
|
| 840 |
-
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
|
| 841 |
-
flags: number,
|
| 842 |
-
rawHeaders: string[],
|
| 843 |
-
];
|
| 844 |
-
}
|
| 845 |
-
interface ClientHttp2Session extends Http2Session {
|
| 846 |
/**
|
| 847 |
* For HTTP/2 Client `Http2Session` instances only, the `http2session.request()` creates and returns an `Http2Stream` instance that can be used to send an
|
| 848 |
* HTTP/2 request to the connected server.
|
|
@@ -888,82 +973,94 @@ declare module "node:http2" {
|
|
| 888 |
* * `:path` \= `/`
|
| 889 |
* @since v8.4.0
|
| 890 |
*/
|
| 891 |
-
request(
|
| 892 |
-
|
| 893 |
-
|
| 894 |
-
|
| 895 |
-
|
| 896 |
-
|
| 897 |
-
|
| 898 |
-
|
| 899 |
-
|
| 900 |
-
|
| 901 |
-
|
| 902 |
-
|
| 903 |
-
|
| 904 |
-
|
| 905 |
-
|
| 906 |
-
):
|
| 907 |
-
|
| 908 |
-
|
| 909 |
-
|
| 910 |
-
|
| 911 |
-
|
| 912 |
-
|
| 913 |
-
|
| 914 |
-
|
| 915 |
-
):
|
| 916 |
-
|
| 917 |
-
on
|
| 918 |
-
|
| 919 |
-
|
| 920 |
-
|
| 921 |
-
|
| 922 |
-
|
| 923 |
-
|
| 924 |
-
|
| 925 |
-
|
| 926 |
-
|
| 927 |
-
|
| 928 |
-
|
| 929 |
-
|
| 930 |
-
): this;
|
| 931 |
-
|
| 932 |
-
|
| 933 |
-
|
| 934 |
-
|
| 935 |
-
|
| 936 |
-
|
| 937 |
-
|
| 938 |
-
|
| 939 |
-
|
| 940 |
-
|
| 941 |
-
|
| 942 |
-
|
| 943 |
-
|
| 944 |
-
|
| 945 |
-
|
| 946 |
-
|
| 947 |
-
|
| 948 |
-
|
| 949 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 950 |
}
|
| 951 |
-
interface AlternativeServiceOptions {
|
| 952 |
origin: number | string | url.URL;
|
| 953 |
}
|
| 954 |
-
interface
|
| 955 |
-
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
| 956 |
-
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
| 957 |
-
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
| 958 |
-
Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
|
| 959 |
-
> extends Http2SessionEventMap {
|
| 960 |
-
"connect": [
|
| 961 |
-
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
|
| 962 |
-
socket: net.Socket | tls.TLSSocket,
|
| 963 |
-
];
|
| 964 |
-
"stream": [stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number, rawHeaders: string[]];
|
| 965 |
-
}
|
| 966 |
-
interface ServerHttp2Session<
|
| 967 |
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
| 968 |
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
| 969 |
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
|
@@ -1064,87 +1161,76 @@ declare module "node:http2" {
|
|
| 1064 |
}
|
| 1065 |
>
|
| 1066 |
): void;
|
| 1067 |
-
|
| 1068 |
-
|
| 1069 |
-
eventName: E,
|
| 1070 |
listener: (
|
| 1071 |
-
|
|
|
|
| 1072 |
) => void,
|
| 1073 |
): this;
|
| 1074 |
-
addListener(
|
| 1075 |
-
|
| 1076 |
-
|
| 1077 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1078 |
): boolean;
|
| 1079 |
-
emit(
|
| 1080 |
-
|
| 1081 |
-
|
| 1082 |
-
|
| 1083 |
-
...args: ServerHttp2SessionEventMap<Http1Request, Http1Response, Http2Request, Http2Response>[E]
|
| 1084 |
-
) => void,
|
| 1085 |
-
): number;
|
| 1086 |
-
listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
|
| 1087 |
-
listeners<E extends keyof ServerHttp2SessionEventMap>(
|
| 1088 |
-
eventName: E,
|
| 1089 |
-
): ((
|
| 1090 |
-
...args: ServerHttp2SessionEventMap<Http1Request, Http1Response, Http2Request, Http2Response>[E]
|
| 1091 |
-
) => void)[];
|
| 1092 |
-
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
| 1093 |
-
off<E extends keyof ServerHttp2SessionEventMap>(
|
| 1094 |
-
eventName: E,
|
| 1095 |
listener: (
|
| 1096 |
-
|
|
|
|
| 1097 |
) => void,
|
| 1098 |
): this;
|
| 1099 |
-
|
| 1100 |
-
|
| 1101 |
-
|
| 1102 |
-
listener: (
|
| 1103 |
-
...args: ServerHttp2SessionEventMap<Http1Request, Http1Response, Http2Request, Http2Response>[E]
|
| 1104 |
-
) => void,
|
| 1105 |
): this;
|
| 1106 |
-
on(
|
| 1107 |
-
once
|
| 1108 |
-
|
| 1109 |
listener: (
|
| 1110 |
-
|
|
|
|
| 1111 |
) => void,
|
| 1112 |
): this;
|
| 1113 |
-
once(
|
| 1114 |
-
|
| 1115 |
-
|
| 1116 |
-
listener: (
|
| 1117 |
-
...args: ServerHttp2SessionEventMap<Http1Request, Http1Response, Http2Request, Http2Response>[E]
|
| 1118 |
-
) => void,
|
| 1119 |
): this;
|
| 1120 |
-
|
| 1121 |
-
|
| 1122 |
-
|
| 1123 |
listener: (
|
| 1124 |
-
|
|
|
|
| 1125 |
) => void,
|
| 1126 |
): this;
|
| 1127 |
-
|
| 1128 |
-
|
| 1129 |
-
|
| 1130 |
-
):
|
| 1131 |
-
|
| 1132 |
-
|
| 1133 |
-
|
| 1134 |
-
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
| 1135 |
-
removeAllListeners<E extends keyof ServerHttp2SessionEventMap>(eventName?: E): this;
|
| 1136 |
-
removeAllListeners(eventName?: string | symbol): this;
|
| 1137 |
-
removeListener<E extends keyof ServerHttp2SessionEventMap>(
|
| 1138 |
-
eventName: E,
|
| 1139 |
listener: (
|
| 1140 |
-
|
|
|
|
| 1141 |
) => void,
|
| 1142 |
): this;
|
| 1143 |
-
|
| 1144 |
-
|
|
|
|
|
|
|
|
|
|
| 1145 |
}
|
| 1146 |
// Http2Server
|
| 1147 |
-
interface SessionOptions {
|
| 1148 |
/**
|
| 1149 |
* Sets the maximum dynamic table size for deflating header fields.
|
| 1150 |
* @default 4Kib
|
|
@@ -1213,16 +1299,8 @@ declare module "node:http2" {
|
|
| 1213 |
* @default 100000
|
| 1214 |
*/
|
| 1215 |
unknownProtocolTimeout?: number | undefined;
|
| 1216 |
-
/**
|
| 1217 |
-
* If `true`, it turns on strict leading
|
| 1218 |
-
* and trailing whitespace validation for HTTP/2 header field names and values
|
| 1219 |
-
* as per [RFC-9113](https://www.rfc-editor.org/rfc/rfc9113.html#section-8.2.1).
|
| 1220 |
-
* @since v24.2.0
|
| 1221 |
-
* @default true
|
| 1222 |
-
*/
|
| 1223 |
-
strictFieldWhitespaceValidation?: boolean | undefined;
|
| 1224 |
}
|
| 1225 |
-
interface ClientSessionOptions extends SessionOptions {
|
| 1226 |
/**
|
| 1227 |
* Sets the maximum number of reserved push streams the client will accept at any given time.
|
| 1228 |
* Once the current number of currently reserved push streams exceeds reaches this limit,
|
|
@@ -1244,33 +1322,31 @@ declare module "node:http2" {
|
|
| 1244 |
*/
|
| 1245 |
protocol?: "http:" | "https:" | undefined;
|
| 1246 |
}
|
| 1247 |
-
interface ServerSessionOptions<
|
| 1248 |
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
| 1249 |
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
| 1250 |
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
| 1251 |
Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
|
| 1252 |
> extends SessionOptions {
|
| 1253 |
-
streamResetBurst?: number | undefined;
|
| 1254 |
-
streamResetRate?: number | undefined;
|
| 1255 |
Http1IncomingMessage?: Http1Request | undefined;
|
| 1256 |
Http1ServerResponse?: Http1Response | undefined;
|
| 1257 |
Http2ServerRequest?: Http2Request | undefined;
|
| 1258 |
Http2ServerResponse?: Http2Response | undefined;
|
| 1259 |
}
|
| 1260 |
-
interface SecureClientSessionOptions extends ClientSessionOptions, tls.ConnectionOptions {}
|
| 1261 |
-
interface SecureServerSessionOptions<
|
| 1262 |
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
| 1263 |
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
| 1264 |
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
| 1265 |
Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
|
| 1266 |
> extends ServerSessionOptions<Http1Request, Http1Response, Http2Request, Http2Response>, tls.TlsOptions {}
|
| 1267 |
-
interface ServerOptions<
|
| 1268 |
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
| 1269 |
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
| 1270 |
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
| 1271 |
Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
|
| 1272 |
> extends ServerSessionOptions<Http1Request, Http1Response, Http2Request, Http2Response> {}
|
| 1273 |
-
interface SecureServerOptions<
|
| 1274 |
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
| 1275 |
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
| 1276 |
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
|
@@ -1279,7 +1355,7 @@ declare module "node:http2" {
|
|
| 1279 |
allowHTTP1?: boolean | undefined;
|
| 1280 |
origins?: string[] | undefined;
|
| 1281 |
}
|
| 1282 |
-
interface
|
| 1283 |
setTimeout(msec?: number, callback?: () => void): this;
|
| 1284 |
/**
|
| 1285 |
* Throws ERR_HTTP2_INVALID_SETTING_VALUE for invalid settings values.
|
|
@@ -1287,194 +1363,243 @@ declare module "node:http2" {
|
|
| 1287 |
*/
|
| 1288 |
updateSettings(settings: Settings): void;
|
| 1289 |
}
|
| 1290 |
-
interface
|
| 1291 |
-
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
| 1292 |
-
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
| 1293 |
-
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
| 1294 |
-
Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
|
| 1295 |
-
> extends net.ServerEventMap, Pick<Http2SessionEventMap, "stream" | "timeout"> {
|
| 1296 |
-
"checkContinue": [request: InstanceType<Http2Request>, response: InstanceType<Http2Response>];
|
| 1297 |
-
"request": [request: InstanceType<Http2Request>, response: InstanceType<Http2Response>];
|
| 1298 |
-
"session": [session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>];
|
| 1299 |
-
"sessionError": [err: Error];
|
| 1300 |
-
}
|
| 1301 |
-
interface Http2Server<
|
| 1302 |
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
| 1303 |
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
| 1304 |
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
| 1305 |
Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
|
| 1306 |
-
> extends net.Server,
|
| 1307 |
-
|
| 1308 |
-
|
| 1309 |
-
|
| 1310 |
-
|
| 1311 |
-
|
| 1312 |
-
|
|
|
|
| 1313 |
): this;
|
| 1314 |
-
addListener(
|
| 1315 |
-
|
| 1316 |
-
|
| 1317 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1318 |
): boolean;
|
| 1319 |
-
emit(
|
| 1320 |
-
|
| 1321 |
-
|
| 1322 |
-
|
| 1323 |
-
|
| 1324 |
-
|
| 1325 |
-
|
| 1326 |
-
|
| 1327 |
-
|
| 1328 |
-
|
| 1329 |
-
|
| 1330 |
-
|
| 1331 |
-
off<E extends keyof Http2ServerEventMap>(
|
| 1332 |
-
eventName: E,
|
| 1333 |
-
listener: (
|
| 1334 |
-
...args: Http2ServerEventMap<Http1Request, Http1Response, Http2Request, Http2Response>[E]
|
| 1335 |
-
) => void,
|
| 1336 |
): this;
|
| 1337 |
-
|
| 1338 |
-
|
| 1339 |
-
|
| 1340 |
-
listener: (
|
| 1341 |
-
...args: Http2ServerEventMap<Http1Request, Http1Response, Http2Request, Http2Response>[E]
|
| 1342 |
-
) => void,
|
| 1343 |
): this;
|
| 1344 |
-
on(
|
| 1345 |
-
|
| 1346 |
-
|
| 1347 |
-
listener: (
|
| 1348 |
-
...args: Http2ServerEventMap<Http1Request, Http1Response, Http2Request, Http2Response>[E]
|
| 1349 |
-
) => void,
|
| 1350 |
): this;
|
| 1351 |
-
|
| 1352 |
-
|
| 1353 |
-
|
| 1354 |
-
listener: (
|
| 1355 |
-
...args: Http2ServerEventMap<Http1Request, Http1Response, Http2Request, Http2Response>[E]
|
| 1356 |
-
) => void,
|
| 1357 |
): this;
|
| 1358 |
-
|
| 1359 |
-
|
| 1360 |
-
|
| 1361 |
-
|
| 1362 |
-
|
| 1363 |
-
) => void,
|
| 1364 |
): this;
|
| 1365 |
-
|
| 1366 |
-
|
| 1367 |
-
|
| 1368 |
-
): ((...args: Http2ServerEventMap<Http1Request, Http1Response, Http2Request, Http2Response>[E]) => void)[];
|
| 1369 |
-
rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
| 1370 |
-
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
| 1371 |
-
removeAllListeners<E extends keyof Http2ServerEventMap>(eventName?: E): this;
|
| 1372 |
-
removeAllListeners(eventName?: string | symbol): this;
|
| 1373 |
-
removeListener<E extends keyof Http2ServerEventMap>(
|
| 1374 |
-
eventName: E,
|
| 1375 |
-
listener: (
|
| 1376 |
-
...args: Http2ServerEventMap<Http1Request, Http1Response, Http2Request, Http2Response>[E]
|
| 1377 |
-
) => void,
|
| 1378 |
): this;
|
| 1379 |
-
|
| 1380 |
-
|
| 1381 |
-
|
| 1382 |
-
|
| 1383 |
-
|
| 1384 |
-
|
| 1385 |
-
|
| 1386 |
-
|
| 1387 |
-
|
| 1388 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1389 |
}
|
| 1390 |
-
interface Http2SecureServer<
|
| 1391 |
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
| 1392 |
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
| 1393 |
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
| 1394 |
Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
|
| 1395 |
-
> extends tls.Server,
|
| 1396 |
-
|
| 1397 |
-
|
| 1398 |
-
|
| 1399 |
-
|
| 1400 |
-
|
| 1401 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1402 |
): this;
|
| 1403 |
-
addListener(
|
| 1404 |
-
|
| 1405 |
-
|
| 1406 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1407 |
): boolean;
|
| 1408 |
-
emit(
|
| 1409 |
-
|
| 1410 |
-
|
| 1411 |
-
|
| 1412 |
-
|
| 1413 |
-
|
| 1414 |
-
|
| 1415 |
-
|
| 1416 |
-
|
| 1417 |
-
|
| 1418 |
-
|
| 1419 |
-
|
| 1420 |
-
|
| 1421 |
-
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
| 1422 |
-
off<E extends keyof Http2SecureServerEventMap>(
|
| 1423 |
-
eventName: E,
|
| 1424 |
-
listener: (
|
| 1425 |
-
...args: Http2SecureServerEventMap<Http1Request, Http1Response, Http2Request, Http2Response>[E]
|
| 1426 |
-
) => void,
|
| 1427 |
): this;
|
| 1428 |
-
|
| 1429 |
-
|
| 1430 |
-
|
| 1431 |
-
listener: (
|
| 1432 |
-
...args: Http2SecureServerEventMap<Http1Request, Http1Response, Http2Request, Http2Response>[E]
|
| 1433 |
-
) => void,
|
| 1434 |
): this;
|
| 1435 |
-
on(
|
| 1436 |
-
|
| 1437 |
-
|
| 1438 |
-
listener: (
|
| 1439 |
-
...args: Http2SecureServerEventMap<Http1Request, Http1Response, Http2Request, Http2Response>[E]
|
| 1440 |
-
) => void,
|
| 1441 |
): this;
|
| 1442 |
-
|
| 1443 |
-
|
| 1444 |
-
|
| 1445 |
-
listener: (
|
| 1446 |
-
...args: Http2SecureServerEventMap<Http1Request, Http1Response, Http2Request, Http2Response>[E]
|
| 1447 |
-
) => void,
|
| 1448 |
): this;
|
| 1449 |
-
|
| 1450 |
-
|
| 1451 |
-
|
| 1452 |
-
|
| 1453 |
-
|
| 1454 |
-
) => void,
|
| 1455 |
): this;
|
| 1456 |
-
|
| 1457 |
-
|
| 1458 |
-
|
| 1459 |
-
): ((
|
| 1460 |
-
...args: Http2SecureServerEventMap<Http1Request, Http1Response, Http2Request, Http2Response>[E]
|
| 1461 |
-
) => void)[];
|
| 1462 |
-
rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
| 1463 |
-
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
| 1464 |
-
removeAllListeners<E extends keyof Http2SecureServerEventMap>(eventName?: E): this;
|
| 1465 |
-
removeAllListeners(eventName?: string | symbol): this;
|
| 1466 |
-
removeListener<E extends keyof Http2SecureServerEventMap>(
|
| 1467 |
-
eventName: E,
|
| 1468 |
-
listener: (
|
| 1469 |
-
...args: Http2SecureServerEventMap<Http1Request, Http1Response, Http2Request, Http2Response>[E]
|
| 1470 |
-
) => void,
|
| 1471 |
): this;
|
| 1472 |
-
|
| 1473 |
-
|
| 1474 |
-
|
| 1475 |
-
|
| 1476 |
-
"
|
| 1477 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1478 |
}
|
| 1479 |
/**
|
| 1480 |
* A `Http2ServerRequest` object is created by {@link Server} or {@link SecureServer} and passed as the first argument to the `'request'` event. It may be used to access a request status,
|
|
@@ -1482,7 +1607,7 @@ declare module "node:http2" {
|
|
| 1482 |
* data.
|
| 1483 |
* @since v8.4.0
|
| 1484 |
*/
|
| 1485 |
-
class Http2ServerRequest extends stream.Readable {
|
| 1486 |
constructor(
|
| 1487 |
stream: ServerHttp2Stream,
|
| 1488 |
headers: IncomingHttpHeaders,
|
|
@@ -1673,69 +1798,56 @@ declare module "node:http2" {
|
|
| 1673 |
* @since v8.4.0
|
| 1674 |
*/
|
| 1675 |
setTimeout(msecs: number, callback?: () => void): void;
|
| 1676 |
-
read(size?: number):
|
| 1677 |
-
|
| 1678 |
-
addListener
|
| 1679 |
-
|
| 1680 |
-
|
| 1681 |
-
): this;
|
| 1682 |
-
addListener(
|
| 1683 |
-
|
| 1684 |
-
emit(
|
| 1685 |
-
|
| 1686 |
-
|
| 1687 |
-
|
| 1688 |
-
):
|
| 1689 |
-
|
| 1690 |
-
|
| 1691 |
-
|
| 1692 |
-
|
| 1693 |
-
|
| 1694 |
-
|
| 1695 |
-
|
| 1696 |
-
|
| 1697 |
-
): this;
|
| 1698 |
-
|
| 1699 |
-
|
| 1700 |
-
|
| 1701 |
-
|
| 1702 |
-
): this;
|
| 1703 |
-
|
| 1704 |
-
once
|
| 1705 |
-
|
| 1706 |
-
|
| 1707 |
-
): this;
|
| 1708 |
-
|
| 1709 |
-
prependListener
|
| 1710 |
-
|
| 1711 |
-
|
| 1712 |
-
): this;
|
| 1713 |
-
|
| 1714 |
-
prependOnceListener
|
| 1715 |
-
|
| 1716 |
-
|
| 1717 |
-
): this;
|
| 1718 |
-
prependOnceListener(
|
| 1719 |
-
rawListeners<E extends keyof Http2ServerRequestEventMap>(
|
| 1720 |
-
eventName: E,
|
| 1721 |
-
): ((...args: Http2ServerRequestEventMap[E]) => void)[];
|
| 1722 |
-
rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
| 1723 |
-
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
| 1724 |
-
removeAllListeners<E extends keyof Http2ServerRequestEventMap>(eventName?: E): this;
|
| 1725 |
-
removeAllListeners(eventName?: string | symbol): this;
|
| 1726 |
-
removeListener<E extends keyof Http2ServerRequestEventMap>(
|
| 1727 |
-
eventName: E,
|
| 1728 |
-
listener: (...args: Http2ServerRequestEventMap[E]) => void,
|
| 1729 |
-
): this;
|
| 1730 |
-
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
| 1731 |
-
// #endregion
|
| 1732 |
}
|
| 1733 |
/**
|
| 1734 |
* This object is created internally by an HTTP server, not by the user. It is
|
| 1735 |
* passed as the second parameter to the `'request'` event.
|
| 1736 |
* @since v8.4.0
|
| 1737 |
*/
|
| 1738 |
-
class Http2ServerResponse<Request extends Http2ServerRequest = Http2ServerRequest> extends stream.Writable {
|
| 1739 |
constructor(stream: ServerHttp2Stream);
|
| 1740 |
/**
|
| 1741 |
* See `response.socket`.
|
|
@@ -1751,7 +1863,7 @@ declare module "node:http2" {
|
|
| 1751 |
* If there were no previous values for the header, this is equivalent to calling {@link setHeader}.
|
| 1752 |
*
|
| 1753 |
* Attempting to set a header field name or value that contains invalid characters will result in a
|
| 1754 |
-
* [TypeError](https://nodejs.org/docs/latest-
|
| 1755 |
*
|
| 1756 |
* ```js
|
| 1757 |
* // Returns headers including "set-cookie: a" and "set-cookie: b"
|
|
@@ -2083,8 +2195,8 @@ declare module "node:http2" {
|
|
| 2083 |
* will result in a `TypeError` being thrown.
|
| 2084 |
* @since v8.4.0
|
| 2085 |
*/
|
| 2086 |
-
writeHead(statusCode: number, headers?: OutgoingHttpHeaders
|
| 2087 |
-
writeHead(statusCode: number, statusMessage: string, headers?: OutgoingHttpHeaders
|
| 2088 |
/**
|
| 2089 |
* Call `http2stream.pushStream()` with the given headers, and wrap the
|
| 2090 |
* given `Http2Stream` on a newly created `Http2ServerResponse` as the callback
|
|
@@ -2099,8 +2211,50 @@ declare module "node:http2" {
|
|
| 2099 |
headers: OutgoingHttpHeaders,
|
| 2100 |
callback: (err: Error | null, res: Http2ServerResponse) => void,
|
| 2101 |
): void;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2102 |
}
|
| 2103 |
-
namespace constants {
|
| 2104 |
const NGHTTP2_SESSION_SERVER: number;
|
| 2105 |
const NGHTTP2_SESSION_CLIENT: number;
|
| 2106 |
const NGHTTP2_STREAM_STATE_IDLE: number;
|
|
@@ -2320,13 +2474,13 @@ declare module "node:http2" {
|
|
| 2320 |
* This symbol can be set as a property on the HTTP/2 headers object with
|
| 2321 |
* an array value in order to provide a list of headers considered sensitive.
|
| 2322 |
*/
|
| 2323 |
-
const sensitiveHeaders: symbol;
|
| 2324 |
/**
|
| 2325 |
* Returns an object containing the default settings for an `Http2Session` instance. This method returns a new object instance every time it is called
|
| 2326 |
* so instances returned may be safely modified for use.
|
| 2327 |
* @since v8.4.0
|
| 2328 |
*/
|
| 2329 |
-
function getDefaultSettings(): Settings;
|
| 2330 |
/**
|
| 2331 |
* Returns a `Buffer` instance containing serialized representation of the given
|
| 2332 |
* HTTP/2 settings as specified in the [HTTP/2](https://tools.ietf.org/html/rfc7540) specification. This is intended
|
|
@@ -2342,14 +2496,14 @@ declare module "node:http2" {
|
|
| 2342 |
* ```
|
| 2343 |
* @since v8.4.0
|
| 2344 |
*/
|
| 2345 |
-
function getPackedSettings(settings: Settings): NonSharedBuffer;
|
| 2346 |
/**
|
| 2347 |
* Returns a `HTTP/2 Settings Object` containing the deserialized settings from
|
| 2348 |
* the given `Buffer` as generated by `http2.getPackedSettings()`.
|
| 2349 |
* @since v8.4.0
|
| 2350 |
* @param buf The packed settings.
|
| 2351 |
*/
|
| 2352 |
-
function getUnpackedSettings(buf: Uint8Array): Settings;
|
| 2353 |
/**
|
| 2354 |
* Returns a `net.Server` instance that creates and manages `Http2Session` instances.
|
| 2355 |
*
|
|
@@ -2379,10 +2533,10 @@ declare module "node:http2" {
|
|
| 2379 |
* @since v8.4.0
|
| 2380 |
* @param onRequestHandler See `Compatibility API`
|
| 2381 |
*/
|
| 2382 |
-
function createServer(
|
| 2383 |
onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
|
| 2384 |
): Http2Server;
|
| 2385 |
-
function createServer<
|
| 2386 |
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
| 2387 |
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
| 2388 |
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
|
@@ -2419,10 +2573,10 @@ declare module "node:http2" {
|
|
| 2419 |
* @since v8.4.0
|
| 2420 |
* @param onRequestHandler See `Compatibility API`
|
| 2421 |
*/
|
| 2422 |
-
function createSecureServer(
|
| 2423 |
onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
|
| 2424 |
): Http2SecureServer;
|
| 2425 |
-
function createSecureServer<
|
| 2426 |
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
| 2427 |
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
| 2428 |
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
|
@@ -2447,11 +2601,11 @@ declare module "node:http2" {
|
|
| 2447 |
* is used). Userinfo (user ID and password), path, querystring, and fragment details in the URL will be ignored.
|
| 2448 |
* @param listener Will be registered as a one-time listener of the {@link 'connect'} event.
|
| 2449 |
*/
|
| 2450 |
-
function connect(
|
| 2451 |
authority: string | url.URL,
|
| 2452 |
listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
|
| 2453 |
): ClientHttp2Session;
|
| 2454 |
-
function connect(
|
| 2455 |
authority: string | url.URL,
|
| 2456 |
options?: ClientSessionOptions | SecureClientSessionOptions,
|
| 2457 |
listener?: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
|
|
@@ -2462,7 +2616,7 @@ declare module "node:http2" {
|
|
| 2462 |
* @param options Any `{@link createServer}` options can be provided.
|
| 2463 |
* @since v20.12.0
|
| 2464 |
*/
|
| 2465 |
-
function performServerHandshake<
|
| 2466 |
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
| 2467 |
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
| 2468 |
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
|
@@ -2473,8 +2627,5 @@ declare module "node:http2" {
|
|
| 2473 |
): ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>;
|
| 2474 |
}
|
| 2475 |
declare module "node:http2" {
|
| 2476 |
-
export
|
| 2477 |
-
}
|
| 2478 |
-
declare module "http2" {
|
| 2479 |
-
export * from "node:http2";
|
| 2480 |
}
|
|
|
|
| 6 |
* import http2 from 'node:http2';
|
| 7 |
* ```
|
| 8 |
* @since v8.4.0
|
| 9 |
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/http2.js)
|
| 10 |
*/
|
| 11 |
+
declare module "http2" {
|
| 12 |
import { NonSharedBuffer } from "node:buffer";
|
| 13 |
+
import EventEmitter = require("node:events");
|
| 14 |
import * as fs from "node:fs";
|
| 15 |
import * as net from "node:net";
|
| 16 |
import * as stream from "node:stream";
|
|
|
|
| 22 |
OutgoingHttpHeaders,
|
| 23 |
ServerResponse,
|
| 24 |
} from "node:http";
|
| 25 |
+
export { OutgoingHttpHeaders } from "node:http";
|
| 26 |
+
export interface IncomingHttpStatusHeader {
|
| 27 |
":status"?: number | undefined;
|
| 28 |
}
|
| 29 |
+
export interface IncomingHttpHeaders extends Http1IncomingHttpHeaders {
|
| 30 |
":path"?: string | undefined;
|
| 31 |
":method"?: string | undefined;
|
| 32 |
":authority"?: string | undefined;
|
| 33 |
":scheme"?: string | undefined;
|
| 34 |
}
|
| 35 |
// Http2Stream
|
| 36 |
+
export interface StreamPriorityOptions {
|
| 37 |
+
exclusive?: boolean | undefined;
|
| 38 |
+
parent?: number | undefined;
|
| 39 |
+
weight?: number | undefined;
|
| 40 |
+
silent?: boolean | undefined;
|
| 41 |
+
}
|
| 42 |
+
export interface StreamState {
|
| 43 |
localWindowSize?: number | undefined;
|
| 44 |
state?: number | undefined;
|
| 45 |
localClose?: number | undefined;
|
| 46 |
remoteClose?: number | undefined;
|
|
|
|
| 47 |
sumDependencyWeight?: number | undefined;
|
|
|
|
| 48 |
weight?: number | undefined;
|
| 49 |
}
|
| 50 |
+
export interface ServerStreamResponseOptions {
|
| 51 |
endStream?: boolean | undefined;
|
| 52 |
waitForTrailers?: boolean | undefined;
|
| 53 |
}
|
| 54 |
+
export interface StatOptions {
|
| 55 |
offset: number;
|
| 56 |
length: number;
|
| 57 |
}
|
| 58 |
+
export interface ServerStreamFileResponseOptions {
|
| 59 |
statCheck?:
|
| 60 |
| ((stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions) => void)
|
| 61 |
| undefined;
|
|
|
|
| 63 |
offset?: number | undefined;
|
| 64 |
length?: number | undefined;
|
| 65 |
}
|
| 66 |
+
export interface ServerStreamFileResponseOptionsWithError extends ServerStreamFileResponseOptions {
|
| 67 |
onError?: ((err: NodeJS.ErrnoException) => void) | undefined;
|
| 68 |
}
|
| 69 |
+
export interface Http2Stream extends stream.Duplex {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
/**
|
| 71 |
* Set to `true` if the `Http2Stream` instance was aborted abnormally. When set,
|
| 72 |
* the `'aborted'` event will have been emitted.
|
|
|
|
| 153 |
*/
|
| 154 |
close(code?: number, callback?: () => void): void;
|
| 155 |
/**
|
| 156 |
+
* Updates the priority for this `Http2Stream` instance.
|
| 157 |
+
* @since v8.4.0
|
| 158 |
*/
|
| 159 |
+
priority(options: StreamPriorityOptions): void;
|
| 160 |
/**
|
| 161 |
* ```js
|
| 162 |
* import http2 from 'node:http2';
|
|
|
|
| 195 |
* @since v10.0.0
|
| 196 |
*/
|
| 197 |
sendTrailers(headers: OutgoingHttpHeaders): void;
|
| 198 |
+
addListener(event: "aborted", listener: () => void): this;
|
| 199 |
+
addListener(event: "close", listener: () => void): this;
|
| 200 |
+
addListener(event: "data", listener: (chunk: NonSharedBuffer | string) => void): this;
|
| 201 |
+
addListener(event: "drain", listener: () => void): this;
|
| 202 |
+
addListener(event: "end", listener: () => void): this;
|
| 203 |
+
addListener(event: "error", listener: (err: Error) => void): this;
|
| 204 |
+
addListener(event: "finish", listener: () => void): this;
|
| 205 |
+
addListener(event: "frameError", listener: (frameType: number, errorCode: number) => void): this;
|
| 206 |
+
addListener(event: "pipe", listener: (src: stream.Readable) => void): this;
|
| 207 |
+
addListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
| 208 |
+
addListener(event: "streamClosed", listener: (code: number) => void): this;
|
| 209 |
+
addListener(event: "timeout", listener: () => void): this;
|
| 210 |
+
addListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this;
|
| 211 |
+
addListener(event: "wantTrailers", listener: () => void): this;
|
| 212 |
+
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 213 |
+
emit(event: "aborted"): boolean;
|
| 214 |
+
emit(event: "close"): boolean;
|
| 215 |
+
emit(event: "data", chunk: NonSharedBuffer | string): boolean;
|
| 216 |
+
emit(event: "drain"): boolean;
|
| 217 |
+
emit(event: "end"): boolean;
|
| 218 |
+
emit(event: "error", err: Error): boolean;
|
| 219 |
+
emit(event: "finish"): boolean;
|
| 220 |
+
emit(event: "frameError", frameType: number, errorCode: number): boolean;
|
| 221 |
+
emit(event: "pipe", src: stream.Readable): boolean;
|
| 222 |
+
emit(event: "unpipe", src: stream.Readable): boolean;
|
| 223 |
+
emit(event: "streamClosed", code: number): boolean;
|
| 224 |
+
emit(event: "timeout"): boolean;
|
| 225 |
+
emit(event: "trailers", trailers: IncomingHttpHeaders, flags: number): boolean;
|
| 226 |
+
emit(event: "wantTrailers"): boolean;
|
| 227 |
+
emit(event: string | symbol, ...args: any[]): boolean;
|
| 228 |
+
on(event: "aborted", listener: () => void): this;
|
| 229 |
+
on(event: "close", listener: () => void): this;
|
| 230 |
+
on(event: "data", listener: (chunk: NonSharedBuffer | string) => void): this;
|
| 231 |
+
on(event: "drain", listener: () => void): this;
|
| 232 |
+
on(event: "end", listener: () => void): this;
|
| 233 |
+
on(event: "error", listener: (err: Error) => void): this;
|
| 234 |
+
on(event: "finish", listener: () => void): this;
|
| 235 |
+
on(event: "frameError", listener: (frameType: number, errorCode: number) => void): this;
|
| 236 |
+
on(event: "pipe", listener: (src: stream.Readable) => void): this;
|
| 237 |
+
on(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
| 238 |
+
on(event: "streamClosed", listener: (code: number) => void): this;
|
| 239 |
+
on(event: "timeout", listener: () => void): this;
|
| 240 |
+
on(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this;
|
| 241 |
+
on(event: "wantTrailers", listener: () => void): this;
|
| 242 |
+
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 243 |
+
once(event: "aborted", listener: () => void): this;
|
| 244 |
+
once(event: "close", listener: () => void): this;
|
| 245 |
+
once(event: "data", listener: (chunk: NonSharedBuffer | string) => void): this;
|
| 246 |
+
once(event: "drain", listener: () => void): this;
|
| 247 |
+
once(event: "end", listener: () => void): this;
|
| 248 |
+
once(event: "error", listener: (err: Error) => void): this;
|
| 249 |
+
once(event: "finish", listener: () => void): this;
|
| 250 |
+
once(event: "frameError", listener: (frameType: number, errorCode: number) => void): this;
|
| 251 |
+
once(event: "pipe", listener: (src: stream.Readable) => void): this;
|
| 252 |
+
once(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
| 253 |
+
once(event: "streamClosed", listener: (code: number) => void): this;
|
| 254 |
+
once(event: "timeout", listener: () => void): this;
|
| 255 |
+
once(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this;
|
| 256 |
+
once(event: "wantTrailers", listener: () => void): this;
|
| 257 |
+
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 258 |
+
prependListener(event: "aborted", listener: () => void): this;
|
| 259 |
+
prependListener(event: "close", listener: () => void): this;
|
| 260 |
+
prependListener(event: "data", listener: (chunk: NonSharedBuffer | string) => void): this;
|
| 261 |
+
prependListener(event: "drain", listener: () => void): this;
|
| 262 |
+
prependListener(event: "end", listener: () => void): this;
|
| 263 |
+
prependListener(event: "error", listener: (err: Error) => void): this;
|
| 264 |
+
prependListener(event: "finish", listener: () => void): this;
|
| 265 |
+
prependListener(event: "frameError", listener: (frameType: number, errorCode: number) => void): this;
|
| 266 |
+
prependListener(event: "pipe", listener: (src: stream.Readable) => void): this;
|
| 267 |
+
prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
| 268 |
+
prependListener(event: "streamClosed", listener: (code: number) => void): this;
|
| 269 |
+
prependListener(event: "timeout", listener: () => void): this;
|
| 270 |
+
prependListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this;
|
| 271 |
+
prependListener(event: "wantTrailers", listener: () => void): this;
|
| 272 |
+
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 273 |
+
prependOnceListener(event: "aborted", listener: () => void): this;
|
| 274 |
+
prependOnceListener(event: "close", listener: () => void): this;
|
| 275 |
+
prependOnceListener(event: "data", listener: (chunk: NonSharedBuffer | string) => void): this;
|
| 276 |
+
prependOnceListener(event: "drain", listener: () => void): this;
|
| 277 |
+
prependOnceListener(event: "end", listener: () => void): this;
|
| 278 |
+
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
| 279 |
+
prependOnceListener(event: "finish", listener: () => void): this;
|
| 280 |
+
prependOnceListener(event: "frameError", listener: (frameType: number, errorCode: number) => void): this;
|
| 281 |
+
prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this;
|
| 282 |
+
prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
| 283 |
+
prependOnceListener(event: "streamClosed", listener: (code: number) => void): this;
|
| 284 |
+
prependOnceListener(event: "timeout", listener: () => void): this;
|
| 285 |
+
prependOnceListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this;
|
| 286 |
+
prependOnceListener(event: "wantTrailers", listener: () => void): this;
|
| 287 |
+
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 288 |
}
|
| 289 |
+
export interface ClientHttp2Stream extends Http2Stream {
|
| 290 |
+
addListener(event: "continue", listener: () => {}): this;
|
| 291 |
+
addListener(
|
| 292 |
+
event: "headers",
|
| 293 |
+
listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void,
|
| 294 |
+
): this;
|
| 295 |
+
addListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
|
| 296 |
+
addListener(
|
| 297 |
+
event: "response",
|
| 298 |
+
listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void,
|
| 299 |
+
): this;
|
| 300 |
+
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 301 |
+
emit(event: "continue"): boolean;
|
| 302 |
+
emit(event: "headers", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean;
|
| 303 |
+
emit(event: "push", headers: IncomingHttpHeaders, flags: number): boolean;
|
| 304 |
+
emit(event: "response", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean;
|
| 305 |
+
emit(event: string | symbol, ...args: any[]): boolean;
|
| 306 |
+
on(event: "continue", listener: () => {}): this;
|
| 307 |
+
on(
|
| 308 |
+
event: "headers",
|
| 309 |
+
listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void,
|
| 310 |
+
): this;
|
| 311 |
+
on(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
|
| 312 |
+
on(
|
| 313 |
+
event: "response",
|
| 314 |
+
listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void,
|
| 315 |
+
): this;
|
| 316 |
+
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 317 |
+
once(event: "continue", listener: () => {}): this;
|
| 318 |
+
once(
|
| 319 |
+
event: "headers",
|
| 320 |
+
listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void,
|
| 321 |
+
): this;
|
| 322 |
+
once(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
|
| 323 |
+
once(
|
| 324 |
+
event: "response",
|
| 325 |
+
listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void,
|
| 326 |
+
): this;
|
| 327 |
+
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 328 |
+
prependListener(event: "continue", listener: () => {}): this;
|
| 329 |
+
prependListener(
|
| 330 |
+
event: "headers",
|
| 331 |
+
listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void,
|
| 332 |
+
): this;
|
| 333 |
+
prependListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
|
| 334 |
+
prependListener(
|
| 335 |
+
event: "response",
|
| 336 |
+
listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void,
|
| 337 |
+
): this;
|
| 338 |
+
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 339 |
+
prependOnceListener(event: "continue", listener: () => {}): this;
|
| 340 |
+
prependOnceListener(
|
| 341 |
+
event: "headers",
|
| 342 |
+
listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void,
|
| 343 |
+
): this;
|
| 344 |
+
prependOnceListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
|
| 345 |
+
prependOnceListener(
|
| 346 |
+
event: "response",
|
| 347 |
+
listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void,
|
| 348 |
+
): this;
|
| 349 |
+
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 350 |
}
|
| 351 |
+
export interface ServerHttp2Stream extends Http2Stream {
|
| 352 |
/**
|
| 353 |
* True if headers were sent, false otherwise (read-only).
|
| 354 |
* @since v8.4.0
|
|
|
|
| 397 |
): void;
|
| 398 |
pushStream(
|
| 399 |
headers: OutgoingHttpHeaders,
|
| 400 |
+
options?: StreamPriorityOptions,
|
| 401 |
callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void,
|
| 402 |
): void;
|
| 403 |
/**
|
|
|
|
| 430 |
* ```
|
| 431 |
* @since v8.4.0
|
| 432 |
*/
|
| 433 |
+
respond(headers?: OutgoingHttpHeaders, options?: ServerStreamResponseOptions): void;
|
| 434 |
/**
|
| 435 |
* Initiates a response whose data is read from the given file descriptor. No
|
| 436 |
* validation is performed on the given file descriptor. If an error occurs while
|
|
|
|
| 618 |
): void;
|
| 619 |
}
|
| 620 |
// Http2Session
|
| 621 |
+
export interface Settings {
|
| 622 |
headerTableSize?: number | undefined;
|
| 623 |
enablePush?: boolean | undefined;
|
| 624 |
initialWindowSize?: number | undefined;
|
|
|
|
| 627 |
maxHeaderListSize?: number | undefined;
|
| 628 |
enableConnectProtocol?: boolean | undefined;
|
| 629 |
}
|
| 630 |
+
export interface ClientSessionRequestOptions {
|
| 631 |
endStream?: boolean | undefined;
|
| 632 |
exclusive?: boolean | undefined;
|
| 633 |
parent?: number | undefined;
|
| 634 |
+
weight?: number | undefined;
|
| 635 |
waitForTrailers?: boolean | undefined;
|
| 636 |
signal?: AbortSignal | undefined;
|
| 637 |
}
|
| 638 |
+
export interface SessionState {
|
| 639 |
effectiveLocalWindowSize?: number | undefined;
|
| 640 |
effectiveRecvDataLength?: number | undefined;
|
| 641 |
nextStreamID?: number | undefined;
|
|
|
|
| 646 |
deflateDynamicTableSize?: number | undefined;
|
| 647 |
inflateDynamicTableSize?: number | undefined;
|
| 648 |
}
|
| 649 |
+
export interface Http2Session extends EventEmitter {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 650 |
/**
|
| 651 |
* Value will be `undefined` if the `Http2Session` is not yet connected to a
|
| 652 |
* socket, `h2c` if the `Http2Session` is not connected to a `TLSSocket`, or
|
|
|
|
| 848 |
* @since v9.4.0
|
| 849 |
*/
|
| 850 |
unref(): void;
|
| 851 |
+
addListener(event: "close", listener: () => void): this;
|
| 852 |
+
addListener(event: "error", listener: (err: Error) => void): this;
|
| 853 |
+
addListener(
|
| 854 |
+
event: "frameError",
|
| 855 |
+
listener: (frameType: number, errorCode: number, streamID: number) => void,
|
| 856 |
+
): this;
|
| 857 |
+
addListener(
|
| 858 |
+
event: "goaway",
|
| 859 |
+
listener: (errorCode: number, lastStreamID: number, opaqueData?: NonSharedBuffer) => void,
|
| 860 |
+
): this;
|
| 861 |
+
addListener(event: "localSettings", listener: (settings: Settings) => void): this;
|
| 862 |
+
addListener(event: "ping", listener: () => void): this;
|
| 863 |
+
addListener(event: "remoteSettings", listener: (settings: Settings) => void): this;
|
| 864 |
+
addListener(event: "timeout", listener: () => void): this;
|
| 865 |
+
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 866 |
+
emit(event: "close"): boolean;
|
| 867 |
+
emit(event: "error", err: Error): boolean;
|
| 868 |
+
emit(event: "frameError", frameType: number, errorCode: number, streamID: number): boolean;
|
| 869 |
+
emit(event: "goaway", errorCode: number, lastStreamID: number, opaqueData?: NonSharedBuffer): boolean;
|
| 870 |
+
emit(event: "localSettings", settings: Settings): boolean;
|
| 871 |
+
emit(event: "ping"): boolean;
|
| 872 |
+
emit(event: "remoteSettings", settings: Settings): boolean;
|
| 873 |
+
emit(event: "timeout"): boolean;
|
| 874 |
+
emit(event: string | symbol, ...args: any[]): boolean;
|
| 875 |
+
on(event: "close", listener: () => void): this;
|
| 876 |
+
on(event: "error", listener: (err: Error) => void): this;
|
| 877 |
+
on(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this;
|
| 878 |
+
on(
|
| 879 |
+
event: "goaway",
|
| 880 |
+
listener: (errorCode: number, lastStreamID: number, opaqueData?: NonSharedBuffer) => void,
|
| 881 |
+
): this;
|
| 882 |
+
on(event: "localSettings", listener: (settings: Settings) => void): this;
|
| 883 |
+
on(event: "ping", listener: () => void): this;
|
| 884 |
+
on(event: "remoteSettings", listener: (settings: Settings) => void): this;
|
| 885 |
+
on(event: "timeout", listener: () => void): this;
|
| 886 |
+
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 887 |
+
once(event: "close", listener: () => void): this;
|
| 888 |
+
once(event: "error", listener: (err: Error) => void): this;
|
| 889 |
+
once(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this;
|
| 890 |
+
once(
|
| 891 |
+
event: "goaway",
|
| 892 |
+
listener: (errorCode: number, lastStreamID: number, opaqueData?: NonSharedBuffer) => void,
|
| 893 |
+
): this;
|
| 894 |
+
once(event: "localSettings", listener: (settings: Settings) => void): this;
|
| 895 |
+
once(event: "ping", listener: () => void): this;
|
| 896 |
+
once(event: "remoteSettings", listener: (settings: Settings) => void): this;
|
| 897 |
+
once(event: "timeout", listener: () => void): this;
|
| 898 |
+
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 899 |
+
prependListener(event: "close", listener: () => void): this;
|
| 900 |
+
prependListener(event: "error", listener: (err: Error) => void): this;
|
| 901 |
+
prependListener(
|
| 902 |
+
event: "frameError",
|
| 903 |
+
listener: (frameType: number, errorCode: number, streamID: number) => void,
|
| 904 |
+
): this;
|
| 905 |
+
prependListener(
|
| 906 |
+
event: "goaway",
|
| 907 |
+
listener: (errorCode: number, lastStreamID: number, opaqueData?: NonSharedBuffer) => void,
|
| 908 |
+
): this;
|
| 909 |
+
prependListener(event: "localSettings", listener: (settings: Settings) => void): this;
|
| 910 |
+
prependListener(event: "ping", listener: () => void): this;
|
| 911 |
+
prependListener(event: "remoteSettings", listener: (settings: Settings) => void): this;
|
| 912 |
+
prependListener(event: "timeout", listener: () => void): this;
|
| 913 |
+
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 914 |
+
prependOnceListener(event: "close", listener: () => void): this;
|
| 915 |
+
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
| 916 |
+
prependOnceListener(
|
| 917 |
+
event: "frameError",
|
| 918 |
+
listener: (frameType: number, errorCode: number, streamID: number) => void,
|
| 919 |
+
): this;
|
| 920 |
+
prependOnceListener(
|
| 921 |
+
event: "goaway",
|
| 922 |
+
listener: (errorCode: number, lastStreamID: number, opaqueData?: NonSharedBuffer) => void,
|
| 923 |
+
): this;
|
| 924 |
+
prependOnceListener(event: "localSettings", listener: (settings: Settings) => void): this;
|
| 925 |
+
prependOnceListener(event: "ping", listener: () => void): this;
|
| 926 |
+
prependOnceListener(event: "remoteSettings", listener: (settings: Settings) => void): this;
|
| 927 |
+
prependOnceListener(event: "timeout", listener: () => void): this;
|
| 928 |
+
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 929 |
}
|
| 930 |
+
export interface ClientHttp2Session extends Http2Session {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 931 |
/**
|
| 932 |
* For HTTP/2 Client `Http2Session` instances only, the `http2session.request()` creates and returns an `Http2Stream` instance that can be used to send an
|
| 933 |
* HTTP/2 request to the connected server.
|
|
|
|
| 973 |
* * `:path` \= `/`
|
| 974 |
* @since v8.4.0
|
| 975 |
*/
|
| 976 |
+
request(headers?: OutgoingHttpHeaders, options?: ClientSessionRequestOptions): ClientHttp2Stream;
|
| 977 |
+
addListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
|
| 978 |
+
addListener(event: "origin", listener: (origins: string[]) => void): this;
|
| 979 |
+
addListener(
|
| 980 |
+
event: "connect",
|
| 981 |
+
listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
|
| 982 |
+
): this;
|
| 983 |
+
addListener(
|
| 984 |
+
event: "stream",
|
| 985 |
+
listener: (
|
| 986 |
+
stream: ClientHttp2Stream,
|
| 987 |
+
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
|
| 988 |
+
flags: number,
|
| 989 |
+
) => void,
|
| 990 |
+
): this;
|
| 991 |
+
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 992 |
+
emit(event: "altsvc", alt: string, origin: string, stream: number): boolean;
|
| 993 |
+
emit(event: "origin", origins: readonly string[]): boolean;
|
| 994 |
+
emit(event: "connect", session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket): boolean;
|
| 995 |
+
emit(
|
| 996 |
+
event: "stream",
|
| 997 |
+
stream: ClientHttp2Stream,
|
| 998 |
+
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
|
| 999 |
+
flags: number,
|
| 1000 |
+
): boolean;
|
| 1001 |
+
emit(event: string | symbol, ...args: any[]): boolean;
|
| 1002 |
+
on(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
|
| 1003 |
+
on(event: "origin", listener: (origins: string[]) => void): this;
|
| 1004 |
+
on(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
|
| 1005 |
+
on(
|
| 1006 |
+
event: "stream",
|
| 1007 |
+
listener: (
|
| 1008 |
+
stream: ClientHttp2Stream,
|
| 1009 |
+
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
|
| 1010 |
+
flags: number,
|
| 1011 |
+
) => void,
|
| 1012 |
+
): this;
|
| 1013 |
+
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 1014 |
+
once(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
|
| 1015 |
+
once(event: "origin", listener: (origins: string[]) => void): this;
|
| 1016 |
+
once(
|
| 1017 |
+
event: "connect",
|
| 1018 |
+
listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
|
| 1019 |
+
): this;
|
| 1020 |
+
once(
|
| 1021 |
+
event: "stream",
|
| 1022 |
+
listener: (
|
| 1023 |
+
stream: ClientHttp2Stream,
|
| 1024 |
+
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
|
| 1025 |
+
flags: number,
|
| 1026 |
+
) => void,
|
| 1027 |
+
): this;
|
| 1028 |
+
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 1029 |
+
prependListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
|
| 1030 |
+
prependListener(event: "origin", listener: (origins: string[]) => void): this;
|
| 1031 |
+
prependListener(
|
| 1032 |
+
event: "connect",
|
| 1033 |
+
listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
|
| 1034 |
+
): this;
|
| 1035 |
+
prependListener(
|
| 1036 |
+
event: "stream",
|
| 1037 |
+
listener: (
|
| 1038 |
+
stream: ClientHttp2Stream,
|
| 1039 |
+
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
|
| 1040 |
+
flags: number,
|
| 1041 |
+
) => void,
|
| 1042 |
+
): this;
|
| 1043 |
+
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 1044 |
+
prependOnceListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
|
| 1045 |
+
prependOnceListener(event: "origin", listener: (origins: string[]) => void): this;
|
| 1046 |
+
prependOnceListener(
|
| 1047 |
+
event: "connect",
|
| 1048 |
+
listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
|
| 1049 |
+
): this;
|
| 1050 |
+
prependOnceListener(
|
| 1051 |
+
event: "stream",
|
| 1052 |
+
listener: (
|
| 1053 |
+
stream: ClientHttp2Stream,
|
| 1054 |
+
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
|
| 1055 |
+
flags: number,
|
| 1056 |
+
) => void,
|
| 1057 |
+
): this;
|
| 1058 |
+
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 1059 |
}
|
| 1060 |
+
export interface AlternativeServiceOptions {
|
| 1061 |
origin: number | string | url.URL;
|
| 1062 |
}
|
| 1063 |
+
export interface ServerHttp2Session<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1064 |
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
| 1065 |
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
| 1066 |
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
|
|
|
| 1161 |
}
|
| 1162 |
>
|
| 1163 |
): void;
|
| 1164 |
+
addListener(
|
| 1165 |
+
event: "connect",
|
|
|
|
| 1166 |
listener: (
|
| 1167 |
+
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
|
| 1168 |
+
socket: net.Socket | tls.TLSSocket,
|
| 1169 |
) => void,
|
| 1170 |
): this;
|
| 1171 |
+
addListener(
|
| 1172 |
+
event: "stream",
|
| 1173 |
+
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
|
| 1174 |
+
): this;
|
| 1175 |
+
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 1176 |
+
emit(
|
| 1177 |
+
event: "connect",
|
| 1178 |
+
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
|
| 1179 |
+
socket: net.Socket | tls.TLSSocket,
|
| 1180 |
): boolean;
|
| 1181 |
+
emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
|
| 1182 |
+
emit(event: string | symbol, ...args: any[]): boolean;
|
| 1183 |
+
on(
|
| 1184 |
+
event: "connect",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1185 |
listener: (
|
| 1186 |
+
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
|
| 1187 |
+
socket: net.Socket | tls.TLSSocket,
|
| 1188 |
) => void,
|
| 1189 |
): this;
|
| 1190 |
+
on(
|
| 1191 |
+
event: "stream",
|
| 1192 |
+
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
|
|
|
|
|
|
|
|
|
|
| 1193 |
): this;
|
| 1194 |
+
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 1195 |
+
once(
|
| 1196 |
+
event: "connect",
|
| 1197 |
listener: (
|
| 1198 |
+
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
|
| 1199 |
+
socket: net.Socket | tls.TLSSocket,
|
| 1200 |
) => void,
|
| 1201 |
): this;
|
| 1202 |
+
once(
|
| 1203 |
+
event: "stream",
|
| 1204 |
+
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
|
|
|
|
|
|
|
|
|
|
| 1205 |
): this;
|
| 1206 |
+
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 1207 |
+
prependListener(
|
| 1208 |
+
event: "connect",
|
| 1209 |
listener: (
|
| 1210 |
+
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
|
| 1211 |
+
socket: net.Socket | tls.TLSSocket,
|
| 1212 |
) => void,
|
| 1213 |
): this;
|
| 1214 |
+
prependListener(
|
| 1215 |
+
event: "stream",
|
| 1216 |
+
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
|
| 1217 |
+
): this;
|
| 1218 |
+
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 1219 |
+
prependOnceListener(
|
| 1220 |
+
event: "connect",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1221 |
listener: (
|
| 1222 |
+
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
|
| 1223 |
+
socket: net.Socket | tls.TLSSocket,
|
| 1224 |
) => void,
|
| 1225 |
): this;
|
| 1226 |
+
prependOnceListener(
|
| 1227 |
+
event: "stream",
|
| 1228 |
+
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
|
| 1229 |
+
): this;
|
| 1230 |
+
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 1231 |
}
|
| 1232 |
// Http2Server
|
| 1233 |
+
export interface SessionOptions {
|
| 1234 |
/**
|
| 1235 |
* Sets the maximum dynamic table size for deflating header fields.
|
| 1236 |
* @default 4Kib
|
|
|
|
| 1299 |
* @default 100000
|
| 1300 |
*/
|
| 1301 |
unknownProtocolTimeout?: number | undefined;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1302 |
}
|
| 1303 |
+
export interface ClientSessionOptions extends SessionOptions {
|
| 1304 |
/**
|
| 1305 |
* Sets the maximum number of reserved push streams the client will accept at any given time.
|
| 1306 |
* Once the current number of currently reserved push streams exceeds reaches this limit,
|
|
|
|
| 1322 |
*/
|
| 1323 |
protocol?: "http:" | "https:" | undefined;
|
| 1324 |
}
|
| 1325 |
+
export interface ServerSessionOptions<
|
| 1326 |
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
| 1327 |
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
| 1328 |
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
| 1329 |
Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
|
| 1330 |
> extends SessionOptions {
|
|
|
|
|
|
|
| 1331 |
Http1IncomingMessage?: Http1Request | undefined;
|
| 1332 |
Http1ServerResponse?: Http1Response | undefined;
|
| 1333 |
Http2ServerRequest?: Http2Request | undefined;
|
| 1334 |
Http2ServerResponse?: Http2Response | undefined;
|
| 1335 |
}
|
| 1336 |
+
export interface SecureClientSessionOptions extends ClientSessionOptions, tls.ConnectionOptions {}
|
| 1337 |
+
export interface SecureServerSessionOptions<
|
| 1338 |
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
| 1339 |
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
| 1340 |
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
| 1341 |
Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
|
| 1342 |
> extends ServerSessionOptions<Http1Request, Http1Response, Http2Request, Http2Response>, tls.TlsOptions {}
|
| 1343 |
+
export interface ServerOptions<
|
| 1344 |
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
| 1345 |
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
| 1346 |
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
| 1347 |
Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
|
| 1348 |
> extends ServerSessionOptions<Http1Request, Http1Response, Http2Request, Http2Response> {}
|
| 1349 |
+
export interface SecureServerOptions<
|
| 1350 |
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
| 1351 |
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
| 1352 |
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
|
|
|
| 1355 |
allowHTTP1?: boolean | undefined;
|
| 1356 |
origins?: string[] | undefined;
|
| 1357 |
}
|
| 1358 |
+
interface HTTP2ServerCommon {
|
| 1359 |
setTimeout(msec?: number, callback?: () => void): this;
|
| 1360 |
/**
|
| 1361 |
* Throws ERR_HTTP2_INVALID_SETTING_VALUE for invalid settings values.
|
|
|
|
| 1363 |
*/
|
| 1364 |
updateSettings(settings: Settings): void;
|
| 1365 |
}
|
| 1366 |
+
export interface Http2Server<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1367 |
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
| 1368 |
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
| 1369 |
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
| 1370 |
Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
|
| 1371 |
+
> extends net.Server, HTTP2ServerCommon {
|
| 1372 |
+
addListener(
|
| 1373 |
+
event: "checkContinue",
|
| 1374 |
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
| 1375 |
+
): this;
|
| 1376 |
+
addListener(
|
| 1377 |
+
event: "request",
|
| 1378 |
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
| 1379 |
): this;
|
| 1380 |
+
addListener(
|
| 1381 |
+
event: "session",
|
| 1382 |
+
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
|
| 1383 |
+
): this;
|
| 1384 |
+
addListener(event: "sessionError", listener: (err: Error) => void): this;
|
| 1385 |
+
addListener(
|
| 1386 |
+
event: "stream",
|
| 1387 |
+
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
|
| 1388 |
+
): this;
|
| 1389 |
+
addListener(event: "timeout", listener: () => void): this;
|
| 1390 |
+
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 1391 |
+
emit(
|
| 1392 |
+
event: "checkContinue",
|
| 1393 |
+
request: InstanceType<Http2Request>,
|
| 1394 |
+
response: InstanceType<Http2Response>,
|
| 1395 |
): boolean;
|
| 1396 |
+
emit(event: "request", request: InstanceType<Http2Request>, response: InstanceType<Http2Response>): boolean;
|
| 1397 |
+
emit(
|
| 1398 |
+
event: "session",
|
| 1399 |
+
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
|
| 1400 |
+
): boolean;
|
| 1401 |
+
emit(event: "sessionError", err: Error): boolean;
|
| 1402 |
+
emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
|
| 1403 |
+
emit(event: "timeout"): boolean;
|
| 1404 |
+
emit(event: string | symbol, ...args: any[]): boolean;
|
| 1405 |
+
on(
|
| 1406 |
+
event: "checkContinue",
|
| 1407 |
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1408 |
): this;
|
| 1409 |
+
on(
|
| 1410 |
+
event: "request",
|
| 1411 |
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
|
|
|
|
|
|
|
|
|
| 1412 |
): this;
|
| 1413 |
+
on(
|
| 1414 |
+
event: "session",
|
| 1415 |
+
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
|
|
|
|
|
|
|
|
|
|
| 1416 |
): this;
|
| 1417 |
+
on(event: "sessionError", listener: (err: Error) => void): this;
|
| 1418 |
+
on(
|
| 1419 |
+
event: "stream",
|
| 1420 |
+
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
|
|
|
|
|
|
|
| 1421 |
): this;
|
| 1422 |
+
on(event: "timeout", listener: () => void): this;
|
| 1423 |
+
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 1424 |
+
once(
|
| 1425 |
+
event: "checkContinue",
|
| 1426 |
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
|
|
|
| 1427 |
): this;
|
| 1428 |
+
once(
|
| 1429 |
+
event: "request",
|
| 1430 |
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1431 |
): this;
|
| 1432 |
+
once(
|
| 1433 |
+
event: "session",
|
| 1434 |
+
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
|
| 1435 |
+
): this;
|
| 1436 |
+
once(event: "sessionError", listener: (err: Error) => void): this;
|
| 1437 |
+
once(
|
| 1438 |
+
event: "stream",
|
| 1439 |
+
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
|
| 1440 |
+
): this;
|
| 1441 |
+
once(event: "timeout", listener: () => void): this;
|
| 1442 |
+
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 1443 |
+
prependListener(
|
| 1444 |
+
event: "checkContinue",
|
| 1445 |
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
| 1446 |
+
): this;
|
| 1447 |
+
prependListener(
|
| 1448 |
+
event: "request",
|
| 1449 |
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
| 1450 |
+
): this;
|
| 1451 |
+
prependListener(
|
| 1452 |
+
event: "session",
|
| 1453 |
+
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
|
| 1454 |
+
): this;
|
| 1455 |
+
prependListener(event: "sessionError", listener: (err: Error) => void): this;
|
| 1456 |
+
prependListener(
|
| 1457 |
+
event: "stream",
|
| 1458 |
+
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
|
| 1459 |
+
): this;
|
| 1460 |
+
prependListener(event: "timeout", listener: () => void): this;
|
| 1461 |
+
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 1462 |
+
prependOnceListener(
|
| 1463 |
+
event: "checkContinue",
|
| 1464 |
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
| 1465 |
+
): this;
|
| 1466 |
+
prependOnceListener(
|
| 1467 |
+
event: "request",
|
| 1468 |
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
| 1469 |
+
): this;
|
| 1470 |
+
prependOnceListener(
|
| 1471 |
+
event: "session",
|
| 1472 |
+
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
|
| 1473 |
+
): this;
|
| 1474 |
+
prependOnceListener(event: "sessionError", listener: (err: Error) => void): this;
|
| 1475 |
+
prependOnceListener(
|
| 1476 |
+
event: "stream",
|
| 1477 |
+
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
|
| 1478 |
+
): this;
|
| 1479 |
+
prependOnceListener(event: "timeout", listener: () => void): this;
|
| 1480 |
+
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 1481 |
}
|
| 1482 |
+
export interface Http2SecureServer<
|
| 1483 |
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
| 1484 |
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
| 1485 |
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
| 1486 |
Http2Response extends typeof Http2ServerResponse<InstanceType<Http2Request>> = typeof Http2ServerResponse,
|
| 1487 |
+
> extends tls.Server, HTTP2ServerCommon {
|
| 1488 |
+
addListener(
|
| 1489 |
+
event: "checkContinue",
|
| 1490 |
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
| 1491 |
+
): this;
|
| 1492 |
+
addListener(
|
| 1493 |
+
event: "request",
|
| 1494 |
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
| 1495 |
+
): this;
|
| 1496 |
+
addListener(
|
| 1497 |
+
event: "session",
|
| 1498 |
+
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
|
| 1499 |
): this;
|
| 1500 |
+
addListener(event: "sessionError", listener: (err: Error) => void): this;
|
| 1501 |
+
addListener(
|
| 1502 |
+
event: "stream",
|
| 1503 |
+
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
|
| 1504 |
+
): this;
|
| 1505 |
+
addListener(event: "timeout", listener: () => void): this;
|
| 1506 |
+
addListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
|
| 1507 |
+
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 1508 |
+
emit(
|
| 1509 |
+
event: "checkContinue",
|
| 1510 |
+
request: InstanceType<Http2Request>,
|
| 1511 |
+
response: InstanceType<Http2Response>,
|
| 1512 |
): boolean;
|
| 1513 |
+
emit(event: "request", request: InstanceType<Http2Request>, response: InstanceType<Http2Response>): boolean;
|
| 1514 |
+
emit(
|
| 1515 |
+
event: "session",
|
| 1516 |
+
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
|
| 1517 |
+
): boolean;
|
| 1518 |
+
emit(event: "sessionError", err: Error): boolean;
|
| 1519 |
+
emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
|
| 1520 |
+
emit(event: "timeout"): boolean;
|
| 1521 |
+
emit(event: "unknownProtocol", socket: tls.TLSSocket): boolean;
|
| 1522 |
+
emit(event: string | symbol, ...args: any[]): boolean;
|
| 1523 |
+
on(
|
| 1524 |
+
event: "checkContinue",
|
| 1525 |
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1526 |
): this;
|
| 1527 |
+
on(
|
| 1528 |
+
event: "request",
|
| 1529 |
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
|
|
|
|
|
|
|
|
|
| 1530 |
): this;
|
| 1531 |
+
on(
|
| 1532 |
+
event: "session",
|
| 1533 |
+
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
|
|
|
|
|
|
|
|
|
|
| 1534 |
): this;
|
| 1535 |
+
on(event: "sessionError", listener: (err: Error) => void): this;
|
| 1536 |
+
on(
|
| 1537 |
+
event: "stream",
|
| 1538 |
+
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
|
|
|
|
|
|
|
| 1539 |
): this;
|
| 1540 |
+
on(event: "timeout", listener: () => void): this;
|
| 1541 |
+
on(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
|
| 1542 |
+
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 1543 |
+
once(
|
| 1544 |
+
event: "checkContinue",
|
| 1545 |
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
| 1546 |
): this;
|
| 1547 |
+
once(
|
| 1548 |
+
event: "request",
|
| 1549 |
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1550 |
): this;
|
| 1551 |
+
once(
|
| 1552 |
+
event: "session",
|
| 1553 |
+
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
|
| 1554 |
+
): this;
|
| 1555 |
+
once(event: "sessionError", listener: (err: Error) => void): this;
|
| 1556 |
+
once(
|
| 1557 |
+
event: "stream",
|
| 1558 |
+
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
|
| 1559 |
+
): this;
|
| 1560 |
+
once(event: "timeout", listener: () => void): this;
|
| 1561 |
+
once(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
|
| 1562 |
+
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 1563 |
+
prependListener(
|
| 1564 |
+
event: "checkContinue",
|
| 1565 |
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
| 1566 |
+
): this;
|
| 1567 |
+
prependListener(
|
| 1568 |
+
event: "request",
|
| 1569 |
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
| 1570 |
+
): this;
|
| 1571 |
+
prependListener(
|
| 1572 |
+
event: "session",
|
| 1573 |
+
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
|
| 1574 |
+
): this;
|
| 1575 |
+
prependListener(event: "sessionError", listener: (err: Error) => void): this;
|
| 1576 |
+
prependListener(
|
| 1577 |
+
event: "stream",
|
| 1578 |
+
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
|
| 1579 |
+
): this;
|
| 1580 |
+
prependListener(event: "timeout", listener: () => void): this;
|
| 1581 |
+
prependListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
|
| 1582 |
+
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 1583 |
+
prependOnceListener(
|
| 1584 |
+
event: "checkContinue",
|
| 1585 |
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
| 1586 |
+
): this;
|
| 1587 |
+
prependOnceListener(
|
| 1588 |
+
event: "request",
|
| 1589 |
+
listener: (request: InstanceType<Http2Request>, response: InstanceType<Http2Response>) => void,
|
| 1590 |
+
): this;
|
| 1591 |
+
prependOnceListener(
|
| 1592 |
+
event: "session",
|
| 1593 |
+
listener: (session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>) => void,
|
| 1594 |
+
): this;
|
| 1595 |
+
prependOnceListener(event: "sessionError", listener: (err: Error) => void): this;
|
| 1596 |
+
prependOnceListener(
|
| 1597 |
+
event: "stream",
|
| 1598 |
+
listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void,
|
| 1599 |
+
): this;
|
| 1600 |
+
prependOnceListener(event: "timeout", listener: () => void): this;
|
| 1601 |
+
prependOnceListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
|
| 1602 |
+
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 1603 |
}
|
| 1604 |
/**
|
| 1605 |
* A `Http2ServerRequest` object is created by {@link Server} or {@link SecureServer} and passed as the first argument to the `'request'` event. It may be used to access a request status,
|
|
|
|
| 1607 |
* data.
|
| 1608 |
* @since v8.4.0
|
| 1609 |
*/
|
| 1610 |
+
export class Http2ServerRequest extends stream.Readable {
|
| 1611 |
constructor(
|
| 1612 |
stream: ServerHttp2Stream,
|
| 1613 |
headers: IncomingHttpHeaders,
|
|
|
|
| 1798 |
* @since v8.4.0
|
| 1799 |
*/
|
| 1800 |
setTimeout(msecs: number, callback?: () => void): void;
|
| 1801 |
+
read(size?: number): NonSharedBuffer | string | null;
|
| 1802 |
+
addListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
|
| 1803 |
+
addListener(event: "close", listener: () => void): this;
|
| 1804 |
+
addListener(event: "data", listener: (chunk: NonSharedBuffer | string) => void): this;
|
| 1805 |
+
addListener(event: "end", listener: () => void): this;
|
| 1806 |
+
addListener(event: "readable", listener: () => void): this;
|
| 1807 |
+
addListener(event: "error", listener: (err: Error) => void): this;
|
| 1808 |
+
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 1809 |
+
emit(event: "aborted", hadError: boolean, code: number): boolean;
|
| 1810 |
+
emit(event: "close"): boolean;
|
| 1811 |
+
emit(event: "data", chunk: NonSharedBuffer | string): boolean;
|
| 1812 |
+
emit(event: "end"): boolean;
|
| 1813 |
+
emit(event: "readable"): boolean;
|
| 1814 |
+
emit(event: "error", err: Error): boolean;
|
| 1815 |
+
emit(event: string | symbol, ...args: any[]): boolean;
|
| 1816 |
+
on(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
|
| 1817 |
+
on(event: "close", listener: () => void): this;
|
| 1818 |
+
on(event: "data", listener: (chunk: NonSharedBuffer | string) => void): this;
|
| 1819 |
+
on(event: "end", listener: () => void): this;
|
| 1820 |
+
on(event: "readable", listener: () => void): this;
|
| 1821 |
+
on(event: "error", listener: (err: Error) => void): this;
|
| 1822 |
+
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 1823 |
+
once(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
|
| 1824 |
+
once(event: "close", listener: () => void): this;
|
| 1825 |
+
once(event: "data", listener: (chunk: NonSharedBuffer | string) => void): this;
|
| 1826 |
+
once(event: "end", listener: () => void): this;
|
| 1827 |
+
once(event: "readable", listener: () => void): this;
|
| 1828 |
+
once(event: "error", listener: (err: Error) => void): this;
|
| 1829 |
+
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 1830 |
+
prependListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
|
| 1831 |
+
prependListener(event: "close", listener: () => void): this;
|
| 1832 |
+
prependListener(event: "data", listener: (chunk: NonSharedBuffer | string) => void): this;
|
| 1833 |
+
prependListener(event: "end", listener: () => void): this;
|
| 1834 |
+
prependListener(event: "readable", listener: () => void): this;
|
| 1835 |
+
prependListener(event: "error", listener: (err: Error) => void): this;
|
| 1836 |
+
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 1837 |
+
prependOnceListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
|
| 1838 |
+
prependOnceListener(event: "close", listener: () => void): this;
|
| 1839 |
+
prependOnceListener(event: "data", listener: (chunk: NonSharedBuffer | string) => void): this;
|
| 1840 |
+
prependOnceListener(event: "end", listener: () => void): this;
|
| 1841 |
+
prependOnceListener(event: "readable", listener: () => void): this;
|
| 1842 |
+
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
| 1843 |
+
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1844 |
}
|
| 1845 |
/**
|
| 1846 |
* This object is created internally by an HTTP server, not by the user. It is
|
| 1847 |
* passed as the second parameter to the `'request'` event.
|
| 1848 |
* @since v8.4.0
|
| 1849 |
*/
|
| 1850 |
+
export class Http2ServerResponse<Request extends Http2ServerRequest = Http2ServerRequest> extends stream.Writable {
|
| 1851 |
constructor(stream: ServerHttp2Stream);
|
| 1852 |
/**
|
| 1853 |
* See `response.socket`.
|
|
|
|
| 1863 |
* If there were no previous values for the header, this is equivalent to calling {@link setHeader}.
|
| 1864 |
*
|
| 1865 |
* Attempting to set a header field name or value that contains invalid characters will result in a
|
| 1866 |
+
* [TypeError](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-typeerror) being thrown.
|
| 1867 |
*
|
| 1868 |
* ```js
|
| 1869 |
* // Returns headers including "set-cookie: a" and "set-cookie: b"
|
|
|
|
| 2195 |
* will result in a `TypeError` being thrown.
|
| 2196 |
* @since v8.4.0
|
| 2197 |
*/
|
| 2198 |
+
writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this;
|
| 2199 |
+
writeHead(statusCode: number, statusMessage: string, headers?: OutgoingHttpHeaders): this;
|
| 2200 |
/**
|
| 2201 |
* Call `http2stream.pushStream()` with the given headers, and wrap the
|
| 2202 |
* given `Http2Stream` on a newly created `Http2ServerResponse` as the callback
|
|
|
|
| 2211 |
headers: OutgoingHttpHeaders,
|
| 2212 |
callback: (err: Error | null, res: Http2ServerResponse) => void,
|
| 2213 |
): void;
|
| 2214 |
+
addListener(event: "close", listener: () => void): this;
|
| 2215 |
+
addListener(event: "drain", listener: () => void): this;
|
| 2216 |
+
addListener(event: "error", listener: (error: Error) => void): this;
|
| 2217 |
+
addListener(event: "finish", listener: () => void): this;
|
| 2218 |
+
addListener(event: "pipe", listener: (src: stream.Readable) => void): this;
|
| 2219 |
+
addListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
| 2220 |
+
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 2221 |
+
emit(event: "close"): boolean;
|
| 2222 |
+
emit(event: "drain"): boolean;
|
| 2223 |
+
emit(event: "error", error: Error): boolean;
|
| 2224 |
+
emit(event: "finish"): boolean;
|
| 2225 |
+
emit(event: "pipe", src: stream.Readable): boolean;
|
| 2226 |
+
emit(event: "unpipe", src: stream.Readable): boolean;
|
| 2227 |
+
emit(event: string | symbol, ...args: any[]): boolean;
|
| 2228 |
+
on(event: "close", listener: () => void): this;
|
| 2229 |
+
on(event: "drain", listener: () => void): this;
|
| 2230 |
+
on(event: "error", listener: (error: Error) => void): this;
|
| 2231 |
+
on(event: "finish", listener: () => void): this;
|
| 2232 |
+
on(event: "pipe", listener: (src: stream.Readable) => void): this;
|
| 2233 |
+
on(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
| 2234 |
+
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 2235 |
+
once(event: "close", listener: () => void): this;
|
| 2236 |
+
once(event: "drain", listener: () => void): this;
|
| 2237 |
+
once(event: "error", listener: (error: Error) => void): this;
|
| 2238 |
+
once(event: "finish", listener: () => void): this;
|
| 2239 |
+
once(event: "pipe", listener: (src: stream.Readable) => void): this;
|
| 2240 |
+
once(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
| 2241 |
+
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 2242 |
+
prependListener(event: "close", listener: () => void): this;
|
| 2243 |
+
prependListener(event: "drain", listener: () => void): this;
|
| 2244 |
+
prependListener(event: "error", listener: (error: Error) => void): this;
|
| 2245 |
+
prependListener(event: "finish", listener: () => void): this;
|
| 2246 |
+
prependListener(event: "pipe", listener: (src: stream.Readable) => void): this;
|
| 2247 |
+
prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
| 2248 |
+
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 2249 |
+
prependOnceListener(event: "close", listener: () => void): this;
|
| 2250 |
+
prependOnceListener(event: "drain", listener: () => void): this;
|
| 2251 |
+
prependOnceListener(event: "error", listener: (error: Error) => void): this;
|
| 2252 |
+
prependOnceListener(event: "finish", listener: () => void): this;
|
| 2253 |
+
prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this;
|
| 2254 |
+
prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
| 2255 |
+
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
| 2256 |
}
|
| 2257 |
+
export namespace constants {
|
| 2258 |
const NGHTTP2_SESSION_SERVER: number;
|
| 2259 |
const NGHTTP2_SESSION_CLIENT: number;
|
| 2260 |
const NGHTTP2_STREAM_STATE_IDLE: number;
|
|
|
|
| 2474 |
* This symbol can be set as a property on the HTTP/2 headers object with
|
| 2475 |
* an array value in order to provide a list of headers considered sensitive.
|
| 2476 |
*/
|
| 2477 |
+
export const sensitiveHeaders: symbol;
|
| 2478 |
/**
|
| 2479 |
* Returns an object containing the default settings for an `Http2Session` instance. This method returns a new object instance every time it is called
|
| 2480 |
* so instances returned may be safely modified for use.
|
| 2481 |
* @since v8.4.0
|
| 2482 |
*/
|
| 2483 |
+
export function getDefaultSettings(): Settings;
|
| 2484 |
/**
|
| 2485 |
* Returns a `Buffer` instance containing serialized representation of the given
|
| 2486 |
* HTTP/2 settings as specified in the [HTTP/2](https://tools.ietf.org/html/rfc7540) specification. This is intended
|
|
|
|
| 2496 |
* ```
|
| 2497 |
* @since v8.4.0
|
| 2498 |
*/
|
| 2499 |
+
export function getPackedSettings(settings: Settings): NonSharedBuffer;
|
| 2500 |
/**
|
| 2501 |
* Returns a `HTTP/2 Settings Object` containing the deserialized settings from
|
| 2502 |
* the given `Buffer` as generated by `http2.getPackedSettings()`.
|
| 2503 |
* @since v8.4.0
|
| 2504 |
* @param buf The packed settings.
|
| 2505 |
*/
|
| 2506 |
+
export function getUnpackedSettings(buf: Uint8Array): Settings;
|
| 2507 |
/**
|
| 2508 |
* Returns a `net.Server` instance that creates and manages `Http2Session` instances.
|
| 2509 |
*
|
|
|
|
| 2533 |
* @since v8.4.0
|
| 2534 |
* @param onRequestHandler See `Compatibility API`
|
| 2535 |
*/
|
| 2536 |
+
export function createServer(
|
| 2537 |
onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
|
| 2538 |
): Http2Server;
|
| 2539 |
+
export function createServer<
|
| 2540 |
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
| 2541 |
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
| 2542 |
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
|
|
|
| 2573 |
* @since v8.4.0
|
| 2574 |
* @param onRequestHandler See `Compatibility API`
|
| 2575 |
*/
|
| 2576 |
+
export function createSecureServer(
|
| 2577 |
onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void,
|
| 2578 |
): Http2SecureServer;
|
| 2579 |
+
export function createSecureServer<
|
| 2580 |
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
| 2581 |
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
| 2582 |
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
|
|
|
| 2601 |
* is used). Userinfo (user ID and password), path, querystring, and fragment details in the URL will be ignored.
|
| 2602 |
* @param listener Will be registered as a one-time listener of the {@link 'connect'} event.
|
| 2603 |
*/
|
| 2604 |
+
export function connect(
|
| 2605 |
authority: string | url.URL,
|
| 2606 |
listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
|
| 2607 |
): ClientHttp2Session;
|
| 2608 |
+
export function connect(
|
| 2609 |
authority: string | url.URL,
|
| 2610 |
options?: ClientSessionOptions | SecureClientSessionOptions,
|
| 2611 |
listener?: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void,
|
|
|
|
| 2616 |
* @param options Any `{@link createServer}` options can be provided.
|
| 2617 |
* @since v20.12.0
|
| 2618 |
*/
|
| 2619 |
+
export function performServerHandshake<
|
| 2620 |
Http1Request extends typeof IncomingMessage = typeof IncomingMessage,
|
| 2621 |
Http1Response extends typeof ServerResponse<InstanceType<Http1Request>> = typeof ServerResponse,
|
| 2622 |
Http2Request extends typeof Http2ServerRequest = typeof Http2ServerRequest,
|
|
|
|
| 2627 |
): ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>;
|
| 2628 |
}
|
| 2629 |
declare module "node:http2" {
|
| 2630 |
+
export * from "http2";
|
|
|
|
|
|
|
|
|
|
| 2631 |
}
|
node_modules/@types/node/https.d.ts
CHANGED
|
@@ -1,35 +1,29 @@
|
|
| 1 |
/**
|
| 2 |
* HTTPS is the HTTP protocol over TLS/SSL. In Node.js this is implemented as a
|
| 3 |
* separate module.
|
| 4 |
-
* @see [source](https://github.com/nodejs/node/blob/
|
| 5 |
*/
|
| 6 |
-
declare module "
|
| 7 |
-
import
|
| 8 |
import { Duplex } from "node:stream";
|
| 9 |
import * as tls from "node:tls";
|
|
|
|
| 10 |
import { URL } from "node:url";
|
| 11 |
interface ServerOptions<
|
| 12 |
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
|
| 13 |
Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
|
| 14 |
> extends http.ServerOptions<Request, Response>, tls.TlsOptions {}
|
| 15 |
interface RequestOptions extends http.RequestOptions, tls.SecureContextOptions {
|
| 16 |
-
checkServerIdentity?:
|
| 17 |
-
| ((hostname: string, cert: tls.DetailedPeerCertificate) => Error | undefined)
|
| 18 |
-
| undefined;
|
| 19 |
rejectUnauthorized?: boolean | undefined; // Defaults to true
|
| 20 |
servername?: string | undefined; // SNI TLS Extension
|
| 21 |
}
|
| 22 |
interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions {
|
|
|
|
| 23 |
maxCachedSessions?: number | undefined;
|
| 24 |
}
|
| 25 |
/**
|
| 26 |
* An `Agent` object for HTTPS similar to `http.Agent`. See {@link request} for more information.
|
| 27 |
-
*
|
| 28 |
-
* Like `http.Agent`, the `createConnection(options[, callback])` method can be overridden
|
| 29 |
-
* to customize how TLS connections are established.
|
| 30 |
-
*
|
| 31 |
-
* > See `agent.createConnection()` for details on overriding this method,
|
| 32 |
-
* > including asynchronous socket creation with a callback.
|
| 33 |
* @since v0.4.5
|
| 34 |
*/
|
| 35 |
class Agent extends http.Agent {
|
|
@@ -41,10 +35,10 @@ declare module "node:https" {
|
|
| 41 |
): Duplex | null | undefined;
|
| 42 |
getName(options?: RequestOptions): string;
|
| 43 |
}
|
| 44 |
-
interface
|
| 45 |
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
|
| 46 |
Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
|
| 47 |
-
> extends http.
|
| 48 |
/**
|
| 49 |
* See `http.Server` for more information.
|
| 50 |
* @since v0.3.4
|
|
@@ -68,66 +62,245 @@ declare module "node:https" {
|
|
| 68 |
* @since v18.2.0
|
| 69 |
*/
|
| 70 |
closeIdleConnections(): void;
|
| 71 |
-
|
| 72 |
-
addListener
|
| 73 |
-
|
| 74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
): this;
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
eventName: E,
|
| 81 |
-
listener?: (...args: ServerEventMap<Request, Response>[E]) => void,
|
| 82 |
-
): number;
|
| 83 |
-
listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
|
| 84 |
-
listeners<E extends keyof ServerEventMap>(
|
| 85 |
-
eventName: E,
|
| 86 |
-
): ((...args: ServerEventMap<Request, Response>[E]) => void)[];
|
| 87 |
-
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
| 88 |
-
off<E extends keyof ServerEventMap>(
|
| 89 |
-
eventName: E,
|
| 90 |
-
listener: (...args: ServerEventMap<Request, Response>[E]) => void,
|
| 91 |
): this;
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
|
|
|
| 96 |
): this;
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
|
|
|
|
|
|
|
|
|
| 101 |
): this;
|
| 102 |
-
once(
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
|
|
|
|
|
|
| 106 |
): this;
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
): this;
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
): this;
|
| 124 |
-
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
| 125 |
-
// #endregion
|
| 126 |
}
|
| 127 |
-
interface Server<
|
| 128 |
-
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
|
| 129 |
-
Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
|
| 130 |
-
> extends http.Server<Request, Response> {}
|
| 131 |
/**
|
| 132 |
* ```js
|
| 133 |
* // curl -k https://localhost:8000/
|
|
@@ -400,6 +573,6 @@ declare module "node:https" {
|
|
| 400 |
): http.ClientRequest;
|
| 401 |
let globalAgent: Agent;
|
| 402 |
}
|
| 403 |
-
declare module "https" {
|
| 404 |
-
export * from "
|
| 405 |
}
|
|
|
|
| 1 |
/**
|
| 2 |
* HTTPS is the HTTP protocol over TLS/SSL. In Node.js this is implemented as a
|
| 3 |
* separate module.
|
| 4 |
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/https.js)
|
| 5 |
*/
|
| 6 |
+
declare module "https" {
|
| 7 |
+
import { NonSharedBuffer } from "node:buffer";
|
| 8 |
import { Duplex } from "node:stream";
|
| 9 |
import * as tls from "node:tls";
|
| 10 |
+
import * as http from "node:http";
|
| 11 |
import { URL } from "node:url";
|
| 12 |
interface ServerOptions<
|
| 13 |
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
|
| 14 |
Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
|
| 15 |
> extends http.ServerOptions<Request, Response>, tls.TlsOptions {}
|
| 16 |
interface RequestOptions extends http.RequestOptions, tls.SecureContextOptions {
|
| 17 |
+
checkServerIdentity?: typeof tls.checkServerIdentity | undefined;
|
|
|
|
|
|
|
| 18 |
rejectUnauthorized?: boolean | undefined; // Defaults to true
|
| 19 |
servername?: string | undefined; // SNI TLS Extension
|
| 20 |
}
|
| 21 |
interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions {
|
| 22 |
+
rejectUnauthorized?: boolean | undefined;
|
| 23 |
maxCachedSessions?: number | undefined;
|
| 24 |
}
|
| 25 |
/**
|
| 26 |
* An `Agent` object for HTTPS similar to `http.Agent`. See {@link request} for more information.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
* @since v0.4.5
|
| 28 |
*/
|
| 29 |
class Agent extends http.Agent {
|
|
|
|
| 35 |
): Duplex | null | undefined;
|
| 36 |
getName(options?: RequestOptions): string;
|
| 37 |
}
|
| 38 |
+
interface Server<
|
| 39 |
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
|
| 40 |
Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
|
| 41 |
+
> extends http.Server<Request, Response> {}
|
| 42 |
/**
|
| 43 |
* See `http.Server` for more information.
|
| 44 |
* @since v0.3.4
|
|
|
|
| 62 |
* @since v18.2.0
|
| 63 |
*/
|
| 64 |
closeIdleConnections(): void;
|
| 65 |
+
addListener(event: string, listener: (...args: any[]) => void): this;
|
| 66 |
+
addListener(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: tls.TLSSocket) => void): this;
|
| 67 |
+
addListener(
|
| 68 |
+
event: "newSession",
|
| 69 |
+
listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void,
|
| 70 |
+
): this;
|
| 71 |
+
addListener(
|
| 72 |
+
event: "OCSPRequest",
|
| 73 |
+
listener: (
|
| 74 |
+
certificate: NonSharedBuffer,
|
| 75 |
+
issuer: NonSharedBuffer,
|
| 76 |
+
callback: (err: Error | null, resp: Buffer | null) => void,
|
| 77 |
+
) => void,
|
| 78 |
+
): this;
|
| 79 |
+
addListener(
|
| 80 |
+
event: "resumeSession",
|
| 81 |
+
listener: (
|
| 82 |
+
sessionId: NonSharedBuffer,
|
| 83 |
+
callback: (err: Error | null, sessionData: Buffer | null) => void,
|
| 84 |
+
) => void,
|
| 85 |
+
): this;
|
| 86 |
+
addListener(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this;
|
| 87 |
+
addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
|
| 88 |
+
addListener(event: "close", listener: () => void): this;
|
| 89 |
+
addListener(event: "connection", listener: (socket: Duplex) => void): this;
|
| 90 |
+
addListener(event: "error", listener: (err: Error) => void): this;
|
| 91 |
+
addListener(event: "listening", listener: () => void): this;
|
| 92 |
+
addListener(event: "checkContinue", listener: http.RequestListener<Request, Response>): this;
|
| 93 |
+
addListener(event: "checkExpectation", listener: http.RequestListener<Request, Response>): this;
|
| 94 |
+
addListener(event: "clientError", listener: (err: Error, socket: Duplex) => void): this;
|
| 95 |
+
addListener(
|
| 96 |
+
event: "connect",
|
| 97 |
+
listener: (req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer) => void,
|
| 98 |
+
): this;
|
| 99 |
+
addListener(event: "request", listener: http.RequestListener<Request, Response>): this;
|
| 100 |
+
addListener(
|
| 101 |
+
event: "upgrade",
|
| 102 |
+
listener: (req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer) => void,
|
| 103 |
+
): this;
|
| 104 |
+
emit(event: string, ...args: any[]): boolean;
|
| 105 |
+
emit(event: "keylog", line: NonSharedBuffer, tlsSocket: tls.TLSSocket): boolean;
|
| 106 |
+
emit(
|
| 107 |
+
event: "newSession",
|
| 108 |
+
sessionId: NonSharedBuffer,
|
| 109 |
+
sessionData: NonSharedBuffer,
|
| 110 |
+
callback: () => void,
|
| 111 |
+
): boolean;
|
| 112 |
+
emit(
|
| 113 |
+
event: "OCSPRequest",
|
| 114 |
+
certificate: NonSharedBuffer,
|
| 115 |
+
issuer: NonSharedBuffer,
|
| 116 |
+
callback: (err: Error | null, resp: Buffer | null) => void,
|
| 117 |
+
): boolean;
|
| 118 |
+
emit(
|
| 119 |
+
event: "resumeSession",
|
| 120 |
+
sessionId: NonSharedBuffer,
|
| 121 |
+
callback: (err: Error | null, sessionData: Buffer | null) => void,
|
| 122 |
+
): boolean;
|
| 123 |
+
emit(event: "secureConnection", tlsSocket: tls.TLSSocket): boolean;
|
| 124 |
+
emit(event: "tlsClientError", err: Error, tlsSocket: tls.TLSSocket): boolean;
|
| 125 |
+
emit(event: "close"): boolean;
|
| 126 |
+
emit(event: "connection", socket: Duplex): boolean;
|
| 127 |
+
emit(event: "error", err: Error): boolean;
|
| 128 |
+
emit(event: "listening"): boolean;
|
| 129 |
+
emit(
|
| 130 |
+
event: "checkContinue",
|
| 131 |
+
req: InstanceType<Request>,
|
| 132 |
+
res: InstanceType<Response>,
|
| 133 |
+
): boolean;
|
| 134 |
+
emit(
|
| 135 |
+
event: "checkExpectation",
|
| 136 |
+
req: InstanceType<Request>,
|
| 137 |
+
res: InstanceType<Response>,
|
| 138 |
+
): boolean;
|
| 139 |
+
emit(event: "clientError", err: Error, socket: Duplex): boolean;
|
| 140 |
+
emit(event: "connect", req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer): boolean;
|
| 141 |
+
emit(
|
| 142 |
+
event: "request",
|
| 143 |
+
req: InstanceType<Request>,
|
| 144 |
+
res: InstanceType<Response>,
|
| 145 |
+
): boolean;
|
| 146 |
+
emit(event: "upgrade", req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer): boolean;
|
| 147 |
+
on(event: string, listener: (...args: any[]) => void): this;
|
| 148 |
+
on(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: tls.TLSSocket) => void): this;
|
| 149 |
+
on(
|
| 150 |
+
event: "newSession",
|
| 151 |
+
listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void,
|
| 152 |
+
): this;
|
| 153 |
+
on(
|
| 154 |
+
event: "OCSPRequest",
|
| 155 |
+
listener: (
|
| 156 |
+
certificate: NonSharedBuffer,
|
| 157 |
+
issuer: NonSharedBuffer,
|
| 158 |
+
callback: (err: Error | null, resp: Buffer | null) => void,
|
| 159 |
+
) => void,
|
| 160 |
+
): this;
|
| 161 |
+
on(
|
| 162 |
+
event: "resumeSession",
|
| 163 |
+
listener: (
|
| 164 |
+
sessionId: NonSharedBuffer,
|
| 165 |
+
callback: (err: Error | null, sessionData: Buffer | null) => void,
|
| 166 |
+
) => void,
|
| 167 |
+
): this;
|
| 168 |
+
on(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this;
|
| 169 |
+
on(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
|
| 170 |
+
on(event: "close", listener: () => void): this;
|
| 171 |
+
on(event: "connection", listener: (socket: Duplex) => void): this;
|
| 172 |
+
on(event: "error", listener: (err: Error) => void): this;
|
| 173 |
+
on(event: "listening", listener: () => void): this;
|
| 174 |
+
on(event: "checkContinue", listener: http.RequestListener<Request, Response>): this;
|
| 175 |
+
on(event: "checkExpectation", listener: http.RequestListener<Request, Response>): this;
|
| 176 |
+
on(event: "clientError", listener: (err: Error, socket: Duplex) => void): this;
|
| 177 |
+
on(
|
| 178 |
+
event: "connect",
|
| 179 |
+
listener: (req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer) => void,
|
| 180 |
): this;
|
| 181 |
+
on(event: "request", listener: http.RequestListener<Request, Response>): this;
|
| 182 |
+
on(
|
| 183 |
+
event: "upgrade",
|
| 184 |
+
listener: (req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer) => void,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
): this;
|
| 186 |
+
once(event: string, listener: (...args: any[]) => void): this;
|
| 187 |
+
once(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: tls.TLSSocket) => void): this;
|
| 188 |
+
once(
|
| 189 |
+
event: "newSession",
|
| 190 |
+
listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void,
|
| 191 |
): this;
|
| 192 |
+
once(
|
| 193 |
+
event: "OCSPRequest",
|
| 194 |
+
listener: (
|
| 195 |
+
certificate: NonSharedBuffer,
|
| 196 |
+
issuer: NonSharedBuffer,
|
| 197 |
+
callback: (err: Error | null, resp: Buffer | null) => void,
|
| 198 |
+
) => void,
|
| 199 |
): this;
|
| 200 |
+
once(
|
| 201 |
+
event: "resumeSession",
|
| 202 |
+
listener: (
|
| 203 |
+
sessionId: NonSharedBuffer,
|
| 204 |
+
callback: (err: Error | null, sessionData: Buffer | null) => void,
|
| 205 |
+
) => void,
|
| 206 |
): this;
|
| 207 |
+
once(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this;
|
| 208 |
+
once(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
|
| 209 |
+
once(event: "close", listener: () => void): this;
|
| 210 |
+
once(event: "connection", listener: (socket: Duplex) => void): this;
|
| 211 |
+
once(event: "error", listener: (err: Error) => void): this;
|
| 212 |
+
once(event: "listening", listener: () => void): this;
|
| 213 |
+
once(event: "checkContinue", listener: http.RequestListener<Request, Response>): this;
|
| 214 |
+
once(event: "checkExpectation", listener: http.RequestListener<Request, Response>): this;
|
| 215 |
+
once(event: "clientError", listener: (err: Error, socket: Duplex) => void): this;
|
| 216 |
+
once(
|
| 217 |
+
event: "connect",
|
| 218 |
+
listener: (req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer) => void,
|
| 219 |
): this;
|
| 220 |
+
once(event: "request", listener: http.RequestListener<Request, Response>): this;
|
| 221 |
+
once(
|
| 222 |
+
event: "upgrade",
|
| 223 |
+
listener: (req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer) => void,
|
| 224 |
+
): this;
|
| 225 |
+
prependListener(event: string, listener: (...args: any[]) => void): this;
|
| 226 |
+
prependListener(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: tls.TLSSocket) => void): this;
|
| 227 |
+
prependListener(
|
| 228 |
+
event: "newSession",
|
| 229 |
+
listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void,
|
| 230 |
+
): this;
|
| 231 |
+
prependListener(
|
| 232 |
+
event: "OCSPRequest",
|
| 233 |
+
listener: (
|
| 234 |
+
certificate: NonSharedBuffer,
|
| 235 |
+
issuer: NonSharedBuffer,
|
| 236 |
+
callback: (err: Error | null, resp: Buffer | null) => void,
|
| 237 |
+
) => void,
|
| 238 |
+
): this;
|
| 239 |
+
prependListener(
|
| 240 |
+
event: "resumeSession",
|
| 241 |
+
listener: (
|
| 242 |
+
sessionId: NonSharedBuffer,
|
| 243 |
+
callback: (err: Error | null, sessionData: Buffer | null) => void,
|
| 244 |
+
) => void,
|
| 245 |
+
): this;
|
| 246 |
+
prependListener(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this;
|
| 247 |
+
prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
|
| 248 |
+
prependListener(event: "close", listener: () => void): this;
|
| 249 |
+
prependListener(event: "connection", listener: (socket: Duplex) => void): this;
|
| 250 |
+
prependListener(event: "error", listener: (err: Error) => void): this;
|
| 251 |
+
prependListener(event: "listening", listener: () => void): this;
|
| 252 |
+
prependListener(event: "checkContinue", listener: http.RequestListener<Request, Response>): this;
|
| 253 |
+
prependListener(event: "checkExpectation", listener: http.RequestListener<Request, Response>): this;
|
| 254 |
+
prependListener(event: "clientError", listener: (err: Error, socket: Duplex) => void): this;
|
| 255 |
+
prependListener(
|
| 256 |
+
event: "connect",
|
| 257 |
+
listener: (req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer) => void,
|
| 258 |
+
): this;
|
| 259 |
+
prependListener(event: "request", listener: http.RequestListener<Request, Response>): this;
|
| 260 |
+
prependListener(
|
| 261 |
+
event: "upgrade",
|
| 262 |
+
listener: (req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer) => void,
|
| 263 |
+
): this;
|
| 264 |
+
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
| 265 |
+
prependOnceListener(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: tls.TLSSocket) => void): this;
|
| 266 |
+
prependOnceListener(
|
| 267 |
+
event: "newSession",
|
| 268 |
+
listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void,
|
| 269 |
+
): this;
|
| 270 |
+
prependOnceListener(
|
| 271 |
+
event: "OCSPRequest",
|
| 272 |
+
listener: (
|
| 273 |
+
certificate: NonSharedBuffer,
|
| 274 |
+
issuer: NonSharedBuffer,
|
| 275 |
+
callback: (err: Error | null, resp: Buffer | null) => void,
|
| 276 |
+
) => void,
|
| 277 |
+
): this;
|
| 278 |
+
prependOnceListener(
|
| 279 |
+
event: "resumeSession",
|
| 280 |
+
listener: (
|
| 281 |
+
sessionId: NonSharedBuffer,
|
| 282 |
+
callback: (err: Error | null, sessionData: Buffer | null) => void,
|
| 283 |
+
) => void,
|
| 284 |
+
): this;
|
| 285 |
+
prependOnceListener(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this;
|
| 286 |
+
prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
|
| 287 |
+
prependOnceListener(event: "close", listener: () => void): this;
|
| 288 |
+
prependOnceListener(event: "connection", listener: (socket: Duplex) => void): this;
|
| 289 |
+
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
| 290 |
+
prependOnceListener(event: "listening", listener: () => void): this;
|
| 291 |
+
prependOnceListener(event: "checkContinue", listener: http.RequestListener<Request, Response>): this;
|
| 292 |
+
prependOnceListener(event: "checkExpectation", listener: http.RequestListener<Request, Response>): this;
|
| 293 |
+
prependOnceListener(event: "clientError", listener: (err: Error, socket: Duplex) => void): this;
|
| 294 |
+
prependOnceListener(
|
| 295 |
+
event: "connect",
|
| 296 |
+
listener: (req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer) => void,
|
| 297 |
+
): this;
|
| 298 |
+
prependOnceListener(event: "request", listener: http.RequestListener<Request, Response>): this;
|
| 299 |
+
prependOnceListener(
|
| 300 |
+
event: "upgrade",
|
| 301 |
+
listener: (req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer) => void,
|
| 302 |
): this;
|
|
|
|
|
|
|
| 303 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 304 |
/**
|
| 305 |
* ```js
|
| 306 |
* // curl -k https://localhost:8000/
|
|
|
|
| 573 |
): http.ClientRequest;
|
| 574 |
let globalAgent: Agent;
|
| 575 |
}
|
| 576 |
+
declare module "node:https" {
|
| 577 |
+
export * from "https";
|
| 578 |
}
|
node_modules/@types/node/index.d.ts
CHANGED
|
@@ -22,38 +22,24 @@
|
|
| 22 |
* IN THE SOFTWARE.
|
| 23 |
*/
|
| 24 |
|
| 25 |
-
// NOTE: These definitions support Node.js and TypeScript 5.
|
| 26 |
|
| 27 |
-
// Reference required TypeScript
|
| 28 |
/// <reference lib="es2020" />
|
| 29 |
-
/// <reference lib="esnext.disposable" />
|
| 30 |
-
/// <reference lib="esnext.float16" />
|
| 31 |
|
| 32 |
-
//
|
| 33 |
-
/// <reference path="compatibility/
|
| 34 |
|
| 35 |
-
// Definitions
|
| 36 |
/// <reference path="globals.typedarray.d.ts" />
|
| 37 |
/// <reference path="buffer.buffer.d.ts" />
|
| 38 |
|
| 39 |
// Definitions for Node.js modules that are not specific to any version of TypeScript:
|
| 40 |
/// <reference path="globals.d.ts" />
|
| 41 |
/// <reference path="web-globals/abortcontroller.d.ts" />
|
| 42 |
-
/// <reference path="web-globals/blob.d.ts" />
|
| 43 |
-
/// <reference path="web-globals/console.d.ts" />
|
| 44 |
-
/// <reference path="web-globals/crypto.d.ts" />
|
| 45 |
/// <reference path="web-globals/domexception.d.ts" />
|
| 46 |
-
/// <reference path="web-globals/encoding.d.ts" />
|
| 47 |
/// <reference path="web-globals/events.d.ts" />
|
| 48 |
/// <reference path="web-globals/fetch.d.ts" />
|
| 49 |
-
/// <reference path="web-globals/importmeta.d.ts" />
|
| 50 |
-
/// <reference path="web-globals/messaging.d.ts" />
|
| 51 |
-
/// <reference path="web-globals/navigator.d.ts" />
|
| 52 |
-
/// <reference path="web-globals/performance.d.ts" />
|
| 53 |
-
/// <reference path="web-globals/storage.d.ts" />
|
| 54 |
-
/// <reference path="web-globals/streams.d.ts" />
|
| 55 |
-
/// <reference path="web-globals/timers.d.ts" />
|
| 56 |
-
/// <reference path="web-globals/url.d.ts" />
|
| 57 |
/// <reference path="assert.d.ts" />
|
| 58 |
/// <reference path="assert/strict.d.ts" />
|
| 59 |
/// <reference path="async_hooks.d.ts" />
|
|
@@ -74,32 +60,25 @@
|
|
| 74 |
/// <reference path="http.d.ts" />
|
| 75 |
/// <reference path="http2.d.ts" />
|
| 76 |
/// <reference path="https.d.ts" />
|
| 77 |
-
/// <reference path="inspector.d.ts" />
|
| 78 |
/// <reference path="inspector.generated.d.ts" />
|
| 79 |
-
/// <reference path="inspector/promises.d.ts" />
|
| 80 |
/// <reference path="module.d.ts" />
|
| 81 |
/// <reference path="net.d.ts" />
|
| 82 |
/// <reference path="os.d.ts" />
|
| 83 |
/// <reference path="path.d.ts" />
|
| 84 |
-
/// <reference path="path/posix.d.ts" />
|
| 85 |
-
/// <reference path="path/win32.d.ts" />
|
| 86 |
/// <reference path="perf_hooks.d.ts" />
|
| 87 |
/// <reference path="process.d.ts" />
|
| 88 |
/// <reference path="punycode.d.ts" />
|
| 89 |
/// <reference path="querystring.d.ts" />
|
| 90 |
-
/// <reference path="quic.d.ts" />
|
| 91 |
/// <reference path="readline.d.ts" />
|
| 92 |
/// <reference path="readline/promises.d.ts" />
|
| 93 |
/// <reference path="repl.d.ts" />
|
| 94 |
/// <reference path="sea.d.ts" />
|
| 95 |
-
/// <reference path="sqlite.d.ts" />
|
| 96 |
/// <reference path="stream.d.ts" />
|
| 97 |
-
/// <reference path="stream/consumers.d.ts" />
|
| 98 |
/// <reference path="stream/promises.d.ts" />
|
|
|
|
| 99 |
/// <reference path="stream/web.d.ts" />
|
| 100 |
/// <reference path="string_decoder.d.ts" />
|
| 101 |
/// <reference path="test.d.ts" />
|
| 102 |
-
/// <reference path="test/reporters.d.ts" />
|
| 103 |
/// <reference path="timers.d.ts" />
|
| 104 |
/// <reference path="timers/promises.d.ts" />
|
| 105 |
/// <reference path="tls.d.ts" />
|
|
@@ -107,7 +86,6 @@
|
|
| 107 |
/// <reference path="tty.d.ts" />
|
| 108 |
/// <reference path="url.d.ts" />
|
| 109 |
/// <reference path="util.d.ts" />
|
| 110 |
-
/// <reference path="util/types.d.ts" />
|
| 111 |
/// <reference path="v8.d.ts" />
|
| 112 |
/// <reference path="vm.d.ts" />
|
| 113 |
/// <reference path="wasi.d.ts" />
|
|
|
|
| 22 |
* IN THE SOFTWARE.
|
| 23 |
*/
|
| 24 |
|
| 25 |
+
// NOTE: These definitions support Node.js and TypeScript 5.7+.
|
| 26 |
|
| 27 |
+
// Reference required TypeScript libs:
|
| 28 |
/// <reference lib="es2020" />
|
|
|
|
|
|
|
| 29 |
|
| 30 |
+
// TypeScript backwards-compatibility definitions:
|
| 31 |
+
/// <reference path="compatibility/index.d.ts" />
|
| 32 |
|
| 33 |
+
// Definitions specific to TypeScript 5.7+:
|
| 34 |
/// <reference path="globals.typedarray.d.ts" />
|
| 35 |
/// <reference path="buffer.buffer.d.ts" />
|
| 36 |
|
| 37 |
// Definitions for Node.js modules that are not specific to any version of TypeScript:
|
| 38 |
/// <reference path="globals.d.ts" />
|
| 39 |
/// <reference path="web-globals/abortcontroller.d.ts" />
|
|
|
|
|
|
|
|
|
|
| 40 |
/// <reference path="web-globals/domexception.d.ts" />
|
|
|
|
| 41 |
/// <reference path="web-globals/events.d.ts" />
|
| 42 |
/// <reference path="web-globals/fetch.d.ts" />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
/// <reference path="assert.d.ts" />
|
| 44 |
/// <reference path="assert/strict.d.ts" />
|
| 45 |
/// <reference path="async_hooks.d.ts" />
|
|
|
|
| 60 |
/// <reference path="http.d.ts" />
|
| 61 |
/// <reference path="http2.d.ts" />
|
| 62 |
/// <reference path="https.d.ts" />
|
|
|
|
| 63 |
/// <reference path="inspector.generated.d.ts" />
|
|
|
|
| 64 |
/// <reference path="module.d.ts" />
|
| 65 |
/// <reference path="net.d.ts" />
|
| 66 |
/// <reference path="os.d.ts" />
|
| 67 |
/// <reference path="path.d.ts" />
|
|
|
|
|
|
|
| 68 |
/// <reference path="perf_hooks.d.ts" />
|
| 69 |
/// <reference path="process.d.ts" />
|
| 70 |
/// <reference path="punycode.d.ts" />
|
| 71 |
/// <reference path="querystring.d.ts" />
|
|
|
|
| 72 |
/// <reference path="readline.d.ts" />
|
| 73 |
/// <reference path="readline/promises.d.ts" />
|
| 74 |
/// <reference path="repl.d.ts" />
|
| 75 |
/// <reference path="sea.d.ts" />
|
|
|
|
| 76 |
/// <reference path="stream.d.ts" />
|
|
|
|
| 77 |
/// <reference path="stream/promises.d.ts" />
|
| 78 |
+
/// <reference path="stream/consumers.d.ts" />
|
| 79 |
/// <reference path="stream/web.d.ts" />
|
| 80 |
/// <reference path="string_decoder.d.ts" />
|
| 81 |
/// <reference path="test.d.ts" />
|
|
|
|
| 82 |
/// <reference path="timers.d.ts" />
|
| 83 |
/// <reference path="timers/promises.d.ts" />
|
| 84 |
/// <reference path="tls.d.ts" />
|
|
|
|
| 86 |
/// <reference path="tty.d.ts" />
|
| 87 |
/// <reference path="url.d.ts" />
|
| 88 |
/// <reference path="util.d.ts" />
|
|
|
|
| 89 |
/// <reference path="v8.d.ts" />
|
| 90 |
/// <reference path="vm.d.ts" />
|
| 91 |
/// <reference path="wasi.d.ts" />
|
node_modules/@types/node/inspector.generated.d.ts
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|