Spaces:
Sleeping
Sleeping
Merge pull request #36 from sandramsc/sandramsc-dev
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- README.md +15 -0
- backend/node_modules/.bin/mime +1 -0
- backend/node_modules/.bin/mkdirp +1 -0
- backend/node_modules/.bin/openai +1 -0
- backend/node_modules/.package-lock.json +1148 -0
- backend/node_modules/@types/body-parser/LICENSE +21 -0
- backend/node_modules/@types/body-parser/README.md +15 -0
- backend/node_modules/@types/body-parser/index.d.ts +95 -0
- backend/node_modules/@types/body-parser/package.json +58 -0
- backend/node_modules/@types/connect/LICENSE +21 -0
- backend/node_modules/@types/connect/README.md +15 -0
- backend/node_modules/@types/connect/index.d.ts +91 -0
- backend/node_modules/@types/connect/package.json +32 -0
- backend/node_modules/@types/express-serve-static-core/LICENSE +21 -0
- backend/node_modules/@types/express-serve-static-core/README.md +15 -0
- backend/node_modules/@types/express-serve-static-core/index.d.ts +1284 -0
- backend/node_modules/@types/express-serve-static-core/package.json +55 -0
- backend/node_modules/@types/express/LICENSE +21 -0
- backend/node_modules/@types/express/README.md +15 -0
- backend/node_modules/@types/express/index.d.ts +128 -0
- backend/node_modules/@types/express/package.json +45 -0
- backend/node_modules/@types/http-errors/LICENSE +21 -0
- backend/node_modules/@types/http-errors/README.md +15 -0
- backend/node_modules/@types/http-errors/index.d.ts +77 -0
- backend/node_modules/@types/http-errors/package.json +30 -0
- backend/node_modules/@types/mime/LICENSE +21 -0
- backend/node_modules/@types/mime/Mime.d.ts +10 -0
- backend/node_modules/@types/mime/README.md +15 -0
- backend/node_modules/@types/mime/index.d.ts +31 -0
- backend/node_modules/@types/mime/lite.d.ts +7 -0
- backend/node_modules/@types/mime/package.json +30 -0
- backend/node_modules/@types/multer/LICENSE +21 -0
- backend/node_modules/@types/multer/README.md +15 -0
- backend/node_modules/@types/multer/index.d.ts +316 -0
- backend/node_modules/@types/multer/package.json +62 -0
- backend/node_modules/@types/node-fetch/LICENSE +21 -0
- backend/node_modules/@types/node-fetch/README.md +15 -0
- backend/node_modules/@types/node-fetch/externals.d.ts +32 -0
- backend/node_modules/@types/node-fetch/index.d.ts +238 -0
- backend/node_modules/@types/node-fetch/package.json +83 -0
- backend/node_modules/@types/node/LICENSE +21 -0
- backend/node_modules/@types/node/README.md +15 -0
- backend/node_modules/@types/node/assert.d.ts +985 -0
- backend/node_modules/@types/node/assert/strict.d.ts +8 -0
- backend/node_modules/@types/node/async_hooks.d.ts +522 -0
- backend/node_modules/@types/node/buffer.d.ts +0 -0
- backend/node_modules/@types/node/child_process.d.ts +1544 -0
- backend/node_modules/@types/node/cluster.d.ts +578 -0
- backend/node_modules/@types/node/console.d.ts +452 -0
- backend/node_modules/@types/node/constants.d.ts +19 -0
README.md
CHANGED
@@ -109,6 +109,21 @@ To deploy DocVerifyRAG using Docker, follow these steps:
|
|
109 |
|
110 |
Access the web interface and follow the prompts to upload documents, classify them, and verify metadata. The AI-powered anomaly detection system will automatically flag any discrepancies or errors in the document metadata, providing accurate and reliable document management solutions for hospitals.
|
111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
## Authors
|
113 |
|
114 |
| Name | Link |
|
|
|
109 |
|
110 |
Access the web interface and follow the prompts to upload documents, classify them, and verify metadata. The AI-powered anomaly detection system will automatically flag any discrepancies or errors in the document metadata, providing accurate and reliable document management solutions for hospitals.
|
111 |
|
112 |
+
## Higging Face configuration
|
113 |
+
|
114 |
+
---
|
115 |
+
title: Docverifyrag
|
116 |
+
emoji: 🐠
|
117 |
+
colorFrom: indigo
|
118 |
+
colorTo: indigo
|
119 |
+
sdk: streamlit
|
120 |
+
sdk_version: 1.33.0
|
121 |
+
app_file: app.py
|
122 |
+
pinned: false
|
123 |
+
---
|
124 |
+
|
125 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
126 |
+
|
127 |
## Authors
|
128 |
|
129 |
| Name | Link |
|
backend/node_modules/.bin/mime
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
../mime/cli.js
|
backend/node_modules/.bin/mkdirp
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
../mkdirp/bin/cmd.js
|
backend/node_modules/.bin/openai
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
../openai/bin/cli
|
backend/node_modules/.package-lock.json
ADDED
@@ -0,0 +1,1148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "backend",
|
3 |
+
"lockfileVersion": 3,
|
4 |
+
"requires": true,
|
5 |
+
"packages": {
|
6 |
+
"node_modules/@types/body-parser": {
|
7 |
+
"version": "1.19.5",
|
8 |
+
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz",
|
9 |
+
"integrity": "sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==",
|
10 |
+
"dependencies": {
|
11 |
+
"@types/connect": "*",
|
12 |
+
"@types/node": "*"
|
13 |
+
}
|
14 |
+
},
|
15 |
+
"node_modules/@types/connect": {
|
16 |
+
"version": "3.4.38",
|
17 |
+
"resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz",
|
18 |
+
"integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==",
|
19 |
+
"dependencies": {
|
20 |
+
"@types/node": "*"
|
21 |
+
}
|
22 |
+
},
|
23 |
+
"node_modules/@types/express": {
|
24 |
+
"version": "4.17.21",
|
25 |
+
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz",
|
26 |
+
"integrity": "sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==",
|
27 |
+
"dev": true,
|
28 |
+
"dependencies": {
|
29 |
+
"@types/body-parser": "*",
|
30 |
+
"@types/express-serve-static-core": "^4.17.33",
|
31 |
+
"@types/qs": "*",
|
32 |
+
"@types/serve-static": "*"
|
33 |
+
}
|
34 |
+
},
|
35 |
+
"node_modules/@types/express-serve-static-core": {
|
36 |
+
"version": "4.19.0",
|
37 |
+
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.0.tgz",
|
38 |
+
"integrity": "sha512-bGyep3JqPCRry1wq+O5n7oiBgGWmeIJXPjXXCo8EK0u8duZGSYar7cGqd3ML2JUsLGeB7fmc06KYo9fLGWqPvQ==",
|
39 |
+
"dev": true,
|
40 |
+
"dependencies": {
|
41 |
+
"@types/node": "*",
|
42 |
+
"@types/qs": "*",
|
43 |
+
"@types/range-parser": "*",
|
44 |
+
"@types/send": "*"
|
45 |
+
}
|
46 |
+
},
|
47 |
+
"node_modules/@types/http-errors": {
|
48 |
+
"version": "2.0.4",
|
49 |
+
"resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz",
|
50 |
+
"integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==",
|
51 |
+
"dev": true
|
52 |
+
},
|
53 |
+
"node_modules/@types/mime": {
|
54 |
+
"version": "1.3.5",
|
55 |
+
"resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz",
|
56 |
+
"integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==",
|
57 |
+
"dev": true
|
58 |
+
},
|
59 |
+
"node_modules/@types/multer": {
|
60 |
+
"version": "1.4.11",
|
61 |
+
"resolved": "https://registry.npmjs.org/@types/multer/-/multer-1.4.11.tgz",
|
62 |
+
"integrity": "sha512-svK240gr6LVWvv3YGyhLlA+6LRRWA4mnGIU7RcNmgjBYFl6665wcXrRfxGp5tEPVHUNm5FMcmq7too9bxCwX/w==",
|
63 |
+
"dev": true,
|
64 |
+
"dependencies": {
|
65 |
+
"@types/express": "*"
|
66 |
+
}
|
67 |
+
},
|
68 |
+
"node_modules/@types/node": {
|
69 |
+
"version": "18.19.31",
|
70 |
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.31.tgz",
|
71 |
+
"integrity": "sha512-ArgCD39YpyyrtFKIqMDvjz79jto5fcI/SVUs2HwB+f0dAzq68yqOdyaSivLiLugSziTpNXLQrVb7RZFmdZzbhA==",
|
72 |
+
"dependencies": {
|
73 |
+
"undici-types": "~5.26.4"
|
74 |
+
}
|
75 |
+
},
|
76 |
+
"node_modules/@types/node-fetch": {
|
77 |
+
"version": "2.6.11",
|
78 |
+
"resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.11.tgz",
|
79 |
+
"integrity": "sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==",
|
80 |
+
"dependencies": {
|
81 |
+
"@types/node": "*",
|
82 |
+
"form-data": "^4.0.0"
|
83 |
+
}
|
84 |
+
},
|
85 |
+
"node_modules/@types/qs": {
|
86 |
+
"version": "6.9.15",
|
87 |
+
"resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.15.tgz",
|
88 |
+
"integrity": "sha512-uXHQKES6DQKKCLh441Xv/dwxOq1TVS3JPUMlEqoEglvlhR6Mxnlew/Xq/LRVHpLyk7iK3zODe1qYHIMltO7XGg==",
|
89 |
+
"dev": true
|
90 |
+
},
|
91 |
+
"node_modules/@types/range-parser": {
|
92 |
+
"version": "1.2.7",
|
93 |
+
"resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz",
|
94 |
+
"integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==",
|
95 |
+
"dev": true
|
96 |
+
},
|
97 |
+
"node_modules/@types/send": {
|
98 |
+
"version": "0.17.4",
|
99 |
+
"resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz",
|
100 |
+
"integrity": "sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==",
|
101 |
+
"dev": true,
|
102 |
+
"dependencies": {
|
103 |
+
"@types/mime": "^1",
|
104 |
+
"@types/node": "*"
|
105 |
+
}
|
106 |
+
},
|
107 |
+
"node_modules/@types/serve-static": {
|
108 |
+
"version": "1.15.7",
|
109 |
+
"resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.7.tgz",
|
110 |
+
"integrity": "sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw==",
|
111 |
+
"dev": true,
|
112 |
+
"dependencies": {
|
113 |
+
"@types/http-errors": "*",
|
114 |
+
"@types/node": "*",
|
115 |
+
"@types/send": "*"
|
116 |
+
}
|
117 |
+
},
|
118 |
+
"node_modules/abort-controller": {
|
119 |
+
"version": "3.0.0",
|
120 |
+
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
|
121 |
+
"integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
|
122 |
+
"dependencies": {
|
123 |
+
"event-target-shim": "^5.0.0"
|
124 |
+
},
|
125 |
+
"engines": {
|
126 |
+
"node": ">=6.5"
|
127 |
+
}
|
128 |
+
},
|
129 |
+
"node_modules/accepts": {
|
130 |
+
"version": "1.3.8",
|
131 |
+
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
|
132 |
+
"integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
|
133 |
+
"dependencies": {
|
134 |
+
"mime-types": "~2.1.34",
|
135 |
+
"negotiator": "0.6.3"
|
136 |
+
},
|
137 |
+
"engines": {
|
138 |
+
"node": ">= 0.6"
|
139 |
+
}
|
140 |
+
},
|
141 |
+
"node_modules/agentkeepalive": {
|
142 |
+
"version": "4.5.0",
|
143 |
+
"resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz",
|
144 |
+
"integrity": "sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==",
|
145 |
+
"dependencies": {
|
146 |
+
"humanize-ms": "^1.2.1"
|
147 |
+
},
|
148 |
+
"engines": {
|
149 |
+
"node": ">= 8.0.0"
|
150 |
+
}
|
151 |
+
},
|
152 |
+
"node_modules/append-field": {
|
153 |
+
"version": "1.0.0",
|
154 |
+
"resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz",
|
155 |
+
"integrity": "sha512-klpgFSWLW1ZEs8svjfb7g4qWY0YS5imI82dTg+QahUvJ8YqAY0P10Uk8tTyh9ZGuYEZEMaeJYCF5BFuX552hsw=="
|
156 |
+
},
|
157 |
+
"node_modules/array-flatten": {
|
158 |
+
"version": "1.1.1",
|
159 |
+
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
160 |
+
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg=="
|
161 |
+
},
|
162 |
+
"node_modules/asynckit": {
|
163 |
+
"version": "0.4.0",
|
164 |
+
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
165 |
+
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
166 |
+
},
|
167 |
+
"node_modules/body-parser": {
|
168 |
+
"version": "1.20.2",
|
169 |
+
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz",
|
170 |
+
"integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==",
|
171 |
+
"dependencies": {
|
172 |
+
"bytes": "3.1.2",
|
173 |
+
"content-type": "~1.0.5",
|
174 |
+
"debug": "2.6.9",
|
175 |
+
"depd": "2.0.0",
|
176 |
+
"destroy": "1.2.0",
|
177 |
+
"http-errors": "2.0.0",
|
178 |
+
"iconv-lite": "0.4.24",
|
179 |
+
"on-finished": "2.4.1",
|
180 |
+
"qs": "6.11.0",
|
181 |
+
"raw-body": "2.5.2",
|
182 |
+
"type-is": "~1.6.18",
|
183 |
+
"unpipe": "1.0.0"
|
184 |
+
},
|
185 |
+
"engines": {
|
186 |
+
"node": ">= 0.8",
|
187 |
+
"npm": "1.2.8000 || >= 1.4.16"
|
188 |
+
}
|
189 |
+
},
|
190 |
+
"node_modules/buffer-from": {
|
191 |
+
"version": "1.1.2",
|
192 |
+
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
|
193 |
+
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="
|
194 |
+
},
|
195 |
+
"node_modules/busboy": {
|
196 |
+
"version": "1.6.0",
|
197 |
+
"resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz",
|
198 |
+
"integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==",
|
199 |
+
"dependencies": {
|
200 |
+
"streamsearch": "^1.1.0"
|
201 |
+
},
|
202 |
+
"engines": {
|
203 |
+
"node": ">=10.16.0"
|
204 |
+
}
|
205 |
+
},
|
206 |
+
"node_modules/bytes": {
|
207 |
+
"version": "3.1.2",
|
208 |
+
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
|
209 |
+
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
|
210 |
+
"engines": {
|
211 |
+
"node": ">= 0.8"
|
212 |
+
}
|
213 |
+
},
|
214 |
+
"node_modules/call-bind": {
|
215 |
+
"version": "1.0.7",
|
216 |
+
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz",
|
217 |
+
"integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==",
|
218 |
+
"dependencies": {
|
219 |
+
"es-define-property": "^1.0.0",
|
220 |
+
"es-errors": "^1.3.0",
|
221 |
+
"function-bind": "^1.1.2",
|
222 |
+
"get-intrinsic": "^1.2.4",
|
223 |
+
"set-function-length": "^1.2.1"
|
224 |
+
},
|
225 |
+
"engines": {
|
226 |
+
"node": ">= 0.4"
|
227 |
+
},
|
228 |
+
"funding": {
|
229 |
+
"url": "https://github.com/sponsors/ljharb"
|
230 |
+
}
|
231 |
+
},
|
232 |
+
"node_modules/combined-stream": {
|
233 |
+
"version": "1.0.8",
|
234 |
+
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
235 |
+
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
236 |
+
"dependencies": {
|
237 |
+
"delayed-stream": "~1.0.0"
|
238 |
+
},
|
239 |
+
"engines": {
|
240 |
+
"node": ">= 0.8"
|
241 |
+
}
|
242 |
+
},
|
243 |
+
"node_modules/concat-stream": {
|
244 |
+
"version": "1.6.2",
|
245 |
+
"resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz",
|
246 |
+
"integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==",
|
247 |
+
"engines": [
|
248 |
+
"node >= 0.8"
|
249 |
+
],
|
250 |
+
"dependencies": {
|
251 |
+
"buffer-from": "^1.0.0",
|
252 |
+
"inherits": "^2.0.3",
|
253 |
+
"readable-stream": "^2.2.2",
|
254 |
+
"typedarray": "^0.0.6"
|
255 |
+
}
|
256 |
+
},
|
257 |
+
"node_modules/content-disposition": {
|
258 |
+
"version": "0.5.4",
|
259 |
+
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
|
260 |
+
"integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
|
261 |
+
"dependencies": {
|
262 |
+
"safe-buffer": "5.2.1"
|
263 |
+
},
|
264 |
+
"engines": {
|
265 |
+
"node": ">= 0.6"
|
266 |
+
}
|
267 |
+
},
|
268 |
+
"node_modules/content-type": {
|
269 |
+
"version": "1.0.5",
|
270 |
+
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
|
271 |
+
"integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
|
272 |
+
"engines": {
|
273 |
+
"node": ">= 0.6"
|
274 |
+
}
|
275 |
+
},
|
276 |
+
"node_modules/cookie": {
|
277 |
+
"version": "0.6.0",
|
278 |
+
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz",
|
279 |
+
"integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==",
|
280 |
+
"engines": {
|
281 |
+
"node": ">= 0.6"
|
282 |
+
}
|
283 |
+
},
|
284 |
+
"node_modules/cookie-signature": {
|
285 |
+
"version": "1.0.6",
|
286 |
+
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
|
287 |
+
"integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ=="
|
288 |
+
},
|
289 |
+
"node_modules/core-util-is": {
|
290 |
+
"version": "1.0.3",
|
291 |
+
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
|
292 |
+
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
|
293 |
+
},
|
294 |
+
"node_modules/cors": {
|
295 |
+
"version": "2.8.5",
|
296 |
+
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
|
297 |
+
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
|
298 |
+
"dependencies": {
|
299 |
+
"object-assign": "^4",
|
300 |
+
"vary": "^1"
|
301 |
+
},
|
302 |
+
"engines": {
|
303 |
+
"node": ">= 0.10"
|
304 |
+
}
|
305 |
+
},
|
306 |
+
"node_modules/debug": {
|
307 |
+
"version": "2.6.9",
|
308 |
+
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
309 |
+
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
310 |
+
"dependencies": {
|
311 |
+
"ms": "2.0.0"
|
312 |
+
}
|
313 |
+
},
|
314 |
+
"node_modules/define-data-property": {
|
315 |
+
"version": "1.1.4",
|
316 |
+
"resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz",
|
317 |
+
"integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==",
|
318 |
+
"dependencies": {
|
319 |
+
"es-define-property": "^1.0.0",
|
320 |
+
"es-errors": "^1.3.0",
|
321 |
+
"gopd": "^1.0.1"
|
322 |
+
},
|
323 |
+
"engines": {
|
324 |
+
"node": ">= 0.4"
|
325 |
+
},
|
326 |
+
"funding": {
|
327 |
+
"url": "https://github.com/sponsors/ljharb"
|
328 |
+
}
|
329 |
+
},
|
330 |
+
"node_modules/delayed-stream": {
|
331 |
+
"version": "1.0.0",
|
332 |
+
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
333 |
+
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
|
334 |
+
"engines": {
|
335 |
+
"node": ">=0.4.0"
|
336 |
+
}
|
337 |
+
},
|
338 |
+
"node_modules/depd": {
|
339 |
+
"version": "2.0.0",
|
340 |
+
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
|
341 |
+
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
|
342 |
+
"engines": {
|
343 |
+
"node": ">= 0.8"
|
344 |
+
}
|
345 |
+
},
|
346 |
+
"node_modules/destroy": {
|
347 |
+
"version": "1.2.0",
|
348 |
+
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
|
349 |
+
"integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
|
350 |
+
"engines": {
|
351 |
+
"node": ">= 0.8",
|
352 |
+
"npm": "1.2.8000 || >= 1.4.16"
|
353 |
+
}
|
354 |
+
},
|
355 |
+
"node_modules/ee-first": {
|
356 |
+
"version": "1.1.1",
|
357 |
+
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
358 |
+
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
|
359 |
+
},
|
360 |
+
"node_modules/encodeurl": {
|
361 |
+
"version": "1.0.2",
|
362 |
+
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
|
363 |
+
"integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
|
364 |
+
"engines": {
|
365 |
+
"node": ">= 0.8"
|
366 |
+
}
|
367 |
+
},
|
368 |
+
"node_modules/es-define-property": {
|
369 |
+
"version": "1.0.0",
|
370 |
+
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz",
|
371 |
+
"integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==",
|
372 |
+
"dependencies": {
|
373 |
+
"get-intrinsic": "^1.2.4"
|
374 |
+
},
|
375 |
+
"engines": {
|
376 |
+
"node": ">= 0.4"
|
377 |
+
}
|
378 |
+
},
|
379 |
+
"node_modules/es-errors": {
|
380 |
+
"version": "1.3.0",
|
381 |
+
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
|
382 |
+
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
|
383 |
+
"engines": {
|
384 |
+
"node": ">= 0.4"
|
385 |
+
}
|
386 |
+
},
|
387 |
+
"node_modules/escape-html": {
|
388 |
+
"version": "1.0.3",
|
389 |
+
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
390 |
+
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="
|
391 |
+
},
|
392 |
+
"node_modules/etag": {
|
393 |
+
"version": "1.8.1",
|
394 |
+
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
|
395 |
+
"integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
|
396 |
+
"engines": {
|
397 |
+
"node": ">= 0.6"
|
398 |
+
}
|
399 |
+
},
|
400 |
+
"node_modules/event-target-shim": {
|
401 |
+
"version": "5.0.1",
|
402 |
+
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
|
403 |
+
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==",
|
404 |
+
"engines": {
|
405 |
+
"node": ">=6"
|
406 |
+
}
|
407 |
+
},
|
408 |
+
"node_modules/express": {
|
409 |
+
"version": "4.19.2",
|
410 |
+
"resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz",
|
411 |
+
"integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==",
|
412 |
+
"dependencies": {
|
413 |
+
"accepts": "~1.3.8",
|
414 |
+
"array-flatten": "1.1.1",
|
415 |
+
"body-parser": "1.20.2",
|
416 |
+
"content-disposition": "0.5.4",
|
417 |
+
"content-type": "~1.0.4",
|
418 |
+
"cookie": "0.6.0",
|
419 |
+
"cookie-signature": "1.0.6",
|
420 |
+
"debug": "2.6.9",
|
421 |
+
"depd": "2.0.0",
|
422 |
+
"encodeurl": "~1.0.2",
|
423 |
+
"escape-html": "~1.0.3",
|
424 |
+
"etag": "~1.8.1",
|
425 |
+
"finalhandler": "1.2.0",
|
426 |
+
"fresh": "0.5.2",
|
427 |
+
"http-errors": "2.0.0",
|
428 |
+
"merge-descriptors": "1.0.1",
|
429 |
+
"methods": "~1.1.2",
|
430 |
+
"on-finished": "2.4.1",
|
431 |
+
"parseurl": "~1.3.3",
|
432 |
+
"path-to-regexp": "0.1.7",
|
433 |
+
"proxy-addr": "~2.0.7",
|
434 |
+
"qs": "6.11.0",
|
435 |
+
"range-parser": "~1.2.1",
|
436 |
+
"safe-buffer": "5.2.1",
|
437 |
+
"send": "0.18.0",
|
438 |
+
"serve-static": "1.15.0",
|
439 |
+
"setprototypeof": "1.2.0",
|
440 |
+
"statuses": "2.0.1",
|
441 |
+
"type-is": "~1.6.18",
|
442 |
+
"utils-merge": "1.0.1",
|
443 |
+
"vary": "~1.1.2"
|
444 |
+
},
|
445 |
+
"engines": {
|
446 |
+
"node": ">= 0.10.0"
|
447 |
+
}
|
448 |
+
},
|
449 |
+
"node_modules/finalhandler": {
|
450 |
+
"version": "1.2.0",
|
451 |
+
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz",
|
452 |
+
"integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==",
|
453 |
+
"dependencies": {
|
454 |
+
"debug": "2.6.9",
|
455 |
+
"encodeurl": "~1.0.2",
|
456 |
+
"escape-html": "~1.0.3",
|
457 |
+
"on-finished": "2.4.1",
|
458 |
+
"parseurl": "~1.3.3",
|
459 |
+
"statuses": "2.0.1",
|
460 |
+
"unpipe": "~1.0.0"
|
461 |
+
},
|
462 |
+
"engines": {
|
463 |
+
"node": ">= 0.8"
|
464 |
+
}
|
465 |
+
},
|
466 |
+
"node_modules/form-data": {
|
467 |
+
"version": "4.0.0",
|
468 |
+
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
469 |
+
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
|
470 |
+
"dependencies": {
|
471 |
+
"asynckit": "^0.4.0",
|
472 |
+
"combined-stream": "^1.0.8",
|
473 |
+
"mime-types": "^2.1.12"
|
474 |
+
},
|
475 |
+
"engines": {
|
476 |
+
"node": ">= 6"
|
477 |
+
}
|
478 |
+
},
|
479 |
+
"node_modules/form-data-encoder": {
|
480 |
+
"version": "1.7.2",
|
481 |
+
"resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.2.tgz",
|
482 |
+
"integrity": "sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A=="
|
483 |
+
},
|
484 |
+
"node_modules/formdata-node": {
|
485 |
+
"version": "4.4.1",
|
486 |
+
"resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-4.4.1.tgz",
|
487 |
+
"integrity": "sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==",
|
488 |
+
"dependencies": {
|
489 |
+
"node-domexception": "1.0.0",
|
490 |
+
"web-streams-polyfill": "4.0.0-beta.3"
|
491 |
+
},
|
492 |
+
"engines": {
|
493 |
+
"node": ">= 12.20"
|
494 |
+
}
|
495 |
+
},
|
496 |
+
"node_modules/formdata-node/node_modules/web-streams-polyfill": {
|
497 |
+
"version": "4.0.0-beta.3",
|
498 |
+
"resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz",
|
499 |
+
"integrity": "sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==",
|
500 |
+
"engines": {
|
501 |
+
"node": ">= 14"
|
502 |
+
}
|
503 |
+
},
|
504 |
+
"node_modules/forwarded": {
|
505 |
+
"version": "0.2.0",
|
506 |
+
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
507 |
+
"integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
|
508 |
+
"engines": {
|
509 |
+
"node": ">= 0.6"
|
510 |
+
}
|
511 |
+
},
|
512 |
+
"node_modules/fresh": {
|
513 |
+
"version": "0.5.2",
|
514 |
+
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
|
515 |
+
"integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
|
516 |
+
"engines": {
|
517 |
+
"node": ">= 0.6"
|
518 |
+
}
|
519 |
+
},
|
520 |
+
"node_modules/function-bind": {
|
521 |
+
"version": "1.1.2",
|
522 |
+
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
523 |
+
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
524 |
+
"funding": {
|
525 |
+
"url": "https://github.com/sponsors/ljharb"
|
526 |
+
}
|
527 |
+
},
|
528 |
+
"node_modules/get-intrinsic": {
|
529 |
+
"version": "1.2.4",
|
530 |
+
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz",
|
531 |
+
"integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==",
|
532 |
+
"dependencies": {
|
533 |
+
"es-errors": "^1.3.0",
|
534 |
+
"function-bind": "^1.1.2",
|
535 |
+
"has-proto": "^1.0.1",
|
536 |
+
"has-symbols": "^1.0.3",
|
537 |
+
"hasown": "^2.0.0"
|
538 |
+
},
|
539 |
+
"engines": {
|
540 |
+
"node": ">= 0.4"
|
541 |
+
},
|
542 |
+
"funding": {
|
543 |
+
"url": "https://github.com/sponsors/ljharb"
|
544 |
+
}
|
545 |
+
},
|
546 |
+
"node_modules/gopd": {
|
547 |
+
"version": "1.0.1",
|
548 |
+
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",
|
549 |
+
"integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==",
|
550 |
+
"dependencies": {
|
551 |
+
"get-intrinsic": "^1.1.3"
|
552 |
+
},
|
553 |
+
"funding": {
|
554 |
+
"url": "https://github.com/sponsors/ljharb"
|
555 |
+
}
|
556 |
+
},
|
557 |
+
"node_modules/has-property-descriptors": {
|
558 |
+
"version": "1.0.2",
|
559 |
+
"resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz",
|
560 |
+
"integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==",
|
561 |
+
"dependencies": {
|
562 |
+
"es-define-property": "^1.0.0"
|
563 |
+
},
|
564 |
+
"funding": {
|
565 |
+
"url": "https://github.com/sponsors/ljharb"
|
566 |
+
}
|
567 |
+
},
|
568 |
+
"node_modules/has-proto": {
|
569 |
+
"version": "1.0.3",
|
570 |
+
"resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz",
|
571 |
+
"integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==",
|
572 |
+
"engines": {
|
573 |
+
"node": ">= 0.4"
|
574 |
+
},
|
575 |
+
"funding": {
|
576 |
+
"url": "https://github.com/sponsors/ljharb"
|
577 |
+
}
|
578 |
+
},
|
579 |
+
"node_modules/has-symbols": {
|
580 |
+
"version": "1.0.3",
|
581 |
+
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
|
582 |
+
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
|
583 |
+
"engines": {
|
584 |
+
"node": ">= 0.4"
|
585 |
+
},
|
586 |
+
"funding": {
|
587 |
+
"url": "https://github.com/sponsors/ljharb"
|
588 |
+
}
|
589 |
+
},
|
590 |
+
"node_modules/hasown": {
|
591 |
+
"version": "2.0.2",
|
592 |
+
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
|
593 |
+
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
|
594 |
+
"dependencies": {
|
595 |
+
"function-bind": "^1.1.2"
|
596 |
+
},
|
597 |
+
"engines": {
|
598 |
+
"node": ">= 0.4"
|
599 |
+
}
|
600 |
+
},
|
601 |
+
"node_modules/http-errors": {
|
602 |
+
"version": "2.0.0",
|
603 |
+
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
|
604 |
+
"integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
|
605 |
+
"dependencies": {
|
606 |
+
"depd": "2.0.0",
|
607 |
+
"inherits": "2.0.4",
|
608 |
+
"setprototypeof": "1.2.0",
|
609 |
+
"statuses": "2.0.1",
|
610 |
+
"toidentifier": "1.0.1"
|
611 |
+
},
|
612 |
+
"engines": {
|
613 |
+
"node": ">= 0.8"
|
614 |
+
}
|
615 |
+
},
|
616 |
+
"node_modules/humanize-ms": {
|
617 |
+
"version": "1.2.1",
|
618 |
+
"resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz",
|
619 |
+
"integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==",
|
620 |
+
"dependencies": {
|
621 |
+
"ms": "^2.0.0"
|
622 |
+
}
|
623 |
+
},
|
624 |
+
"node_modules/iconv-lite": {
|
625 |
+
"version": "0.4.24",
|
626 |
+
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
627 |
+
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
|
628 |
+
"dependencies": {
|
629 |
+
"safer-buffer": ">= 2.1.2 < 3"
|
630 |
+
},
|
631 |
+
"engines": {
|
632 |
+
"node": ">=0.10.0"
|
633 |
+
}
|
634 |
+
},
|
635 |
+
"node_modules/inherits": {
|
636 |
+
"version": "2.0.4",
|
637 |
+
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
638 |
+
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
639 |
+
},
|
640 |
+
"node_modules/ipaddr.js": {
|
641 |
+
"version": "1.9.1",
|
642 |
+
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
|
643 |
+
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
|
644 |
+
"engines": {
|
645 |
+
"node": ">= 0.10"
|
646 |
+
}
|
647 |
+
},
|
648 |
+
"node_modules/isarray": {
|
649 |
+
"version": "1.0.0",
|
650 |
+
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
|
651 |
+
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="
|
652 |
+
},
|
653 |
+
"node_modules/media-typer": {
|
654 |
+
"version": "0.3.0",
|
655 |
+
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
656 |
+
"integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
|
657 |
+
"engines": {
|
658 |
+
"node": ">= 0.6"
|
659 |
+
}
|
660 |
+
},
|
661 |
+
"node_modules/merge-descriptors": {
|
662 |
+
"version": "1.0.1",
|
663 |
+
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
|
664 |
+
"integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w=="
|
665 |
+
},
|
666 |
+
"node_modules/methods": {
|
667 |
+
"version": "1.1.2",
|
668 |
+
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
|
669 |
+
"integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
|
670 |
+
"engines": {
|
671 |
+
"node": ">= 0.6"
|
672 |
+
}
|
673 |
+
},
|
674 |
+
"node_modules/mime": {
|
675 |
+
"version": "1.6.0",
|
676 |
+
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
|
677 |
+
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
|
678 |
+
"bin": {
|
679 |
+
"mime": "cli.js"
|
680 |
+
},
|
681 |
+
"engines": {
|
682 |
+
"node": ">=4"
|
683 |
+
}
|
684 |
+
},
|
685 |
+
"node_modules/mime-db": {
|
686 |
+
"version": "1.52.0",
|
687 |
+
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
688 |
+
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
689 |
+
"engines": {
|
690 |
+
"node": ">= 0.6"
|
691 |
+
}
|
692 |
+
},
|
693 |
+
"node_modules/mime-types": {
|
694 |
+
"version": "2.1.35",
|
695 |
+
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
696 |
+
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
697 |
+
"dependencies": {
|
698 |
+
"mime-db": "1.52.0"
|
699 |
+
},
|
700 |
+
"engines": {
|
701 |
+
"node": ">= 0.6"
|
702 |
+
}
|
703 |
+
},
|
704 |
+
"node_modules/minimist": {
|
705 |
+
"version": "1.2.8",
|
706 |
+
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
|
707 |
+
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
|
708 |
+
"funding": {
|
709 |
+
"url": "https://github.com/sponsors/ljharb"
|
710 |
+
}
|
711 |
+
},
|
712 |
+
"node_modules/mkdirp": {
|
713 |
+
"version": "0.5.6",
|
714 |
+
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz",
|
715 |
+
"integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==",
|
716 |
+
"dependencies": {
|
717 |
+
"minimist": "^1.2.6"
|
718 |
+
},
|
719 |
+
"bin": {
|
720 |
+
"mkdirp": "bin/cmd.js"
|
721 |
+
}
|
722 |
+
},
|
723 |
+
"node_modules/ms": {
|
724 |
+
"version": "2.0.0",
|
725 |
+
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
726 |
+
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
|
727 |
+
},
|
728 |
+
"node_modules/multer": {
|
729 |
+
"version": "1.4.5-lts.1",
|
730 |
+
"resolved": "https://registry.npmjs.org/multer/-/multer-1.4.5-lts.1.tgz",
|
731 |
+
"integrity": "sha512-ywPWvcDMeH+z9gQq5qYHCCy+ethsk4goepZ45GLD63fOu0YcNecQxi64nDs3qluZB+murG3/D4dJ7+dGctcCQQ==",
|
732 |
+
"dependencies": {
|
733 |
+
"append-field": "^1.0.0",
|
734 |
+
"busboy": "^1.0.0",
|
735 |
+
"concat-stream": "^1.5.2",
|
736 |
+
"mkdirp": "^0.5.4",
|
737 |
+
"object-assign": "^4.1.1",
|
738 |
+
"type-is": "^1.6.4",
|
739 |
+
"xtend": "^4.0.0"
|
740 |
+
},
|
741 |
+
"engines": {
|
742 |
+
"node": ">= 6.0.0"
|
743 |
+
}
|
744 |
+
},
|
745 |
+
"node_modules/negotiator": {
|
746 |
+
"version": "0.6.3",
|
747 |
+
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
|
748 |
+
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
|
749 |
+
"engines": {
|
750 |
+
"node": ">= 0.6"
|
751 |
+
}
|
752 |
+
},
|
753 |
+
"node_modules/node-domexception": {
|
754 |
+
"version": "1.0.0",
|
755 |
+
"resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz",
|
756 |
+
"integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==",
|
757 |
+
"funding": [
|
758 |
+
{
|
759 |
+
"type": "github",
|
760 |
+
"url": "https://github.com/sponsors/jimmywarting"
|
761 |
+
},
|
762 |
+
{
|
763 |
+
"type": "github",
|
764 |
+
"url": "https://paypal.me/jimmywarting"
|
765 |
+
}
|
766 |
+
],
|
767 |
+
"engines": {
|
768 |
+
"node": ">=10.5.0"
|
769 |
+
}
|
770 |
+
},
|
771 |
+
"node_modules/node-fetch": {
|
772 |
+
"version": "2.7.0",
|
773 |
+
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
|
774 |
+
"integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
|
775 |
+
"dependencies": {
|
776 |
+
"whatwg-url": "^5.0.0"
|
777 |
+
},
|
778 |
+
"engines": {
|
779 |
+
"node": "4.x || >=6.0.0"
|
780 |
+
},
|
781 |
+
"peerDependencies": {
|
782 |
+
"encoding": "^0.1.0"
|
783 |
+
},
|
784 |
+
"peerDependenciesMeta": {
|
785 |
+
"encoding": {
|
786 |
+
"optional": true
|
787 |
+
}
|
788 |
+
}
|
789 |
+
},
|
790 |
+
"node_modules/object-assign": {
|
791 |
+
"version": "4.1.1",
|
792 |
+
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
793 |
+
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
|
794 |
+
"engines": {
|
795 |
+
"node": ">=0.10.0"
|
796 |
+
}
|
797 |
+
},
|
798 |
+
"node_modules/object-inspect": {
|
799 |
+
"version": "1.13.1",
|
800 |
+
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz",
|
801 |
+
"integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==",
|
802 |
+
"funding": {
|
803 |
+
"url": "https://github.com/sponsors/ljharb"
|
804 |
+
}
|
805 |
+
},
|
806 |
+
"node_modules/on-finished": {
|
807 |
+
"version": "2.4.1",
|
808 |
+
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
|
809 |
+
"integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
|
810 |
+
"dependencies": {
|
811 |
+
"ee-first": "1.1.1"
|
812 |
+
},
|
813 |
+
"engines": {
|
814 |
+
"node": ">= 0.8"
|
815 |
+
}
|
816 |
+
},
|
817 |
+
"node_modules/openai": {
|
818 |
+
"version": "4.35.0",
|
819 |
+
"resolved": "https://registry.npmjs.org/openai/-/openai-4.35.0.tgz",
|
820 |
+
"integrity": "sha512-K8GY7k4h+dT2GSmn3JGSjkwElpo8cPa4eQ6p++uK1HSrrIBp6NalD3A3DIamvX1AnIyrKqe8M//HoQWgjntUiA==",
|
821 |
+
"dependencies": {
|
822 |
+
"@types/node": "^18.11.18",
|
823 |
+
"@types/node-fetch": "^2.6.4",
|
824 |
+
"abort-controller": "^3.0.0",
|
825 |
+
"agentkeepalive": "^4.2.1",
|
826 |
+
"form-data-encoder": "1.7.2",
|
827 |
+
"formdata-node": "^4.3.2",
|
828 |
+
"node-fetch": "^2.6.7",
|
829 |
+
"web-streams-polyfill": "^3.2.1"
|
830 |
+
},
|
831 |
+
"bin": {
|
832 |
+
"openai": "bin/cli"
|
833 |
+
}
|
834 |
+
},
|
835 |
+
"node_modules/parseurl": {
|
836 |
+
"version": "1.3.3",
|
837 |
+
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
838 |
+
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
|
839 |
+
"engines": {
|
840 |
+
"node": ">= 0.8"
|
841 |
+
}
|
842 |
+
},
|
843 |
+
"node_modules/path-to-regexp": {
|
844 |
+
"version": "0.1.7",
|
845 |
+
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
|
846 |
+
"integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ=="
|
847 |
+
},
|
848 |
+
"node_modules/process-nextick-args": {
|
849 |
+
"version": "2.0.1",
|
850 |
+
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
851 |
+
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
|
852 |
+
},
|
853 |
+
"node_modules/proxy-addr": {
|
854 |
+
"version": "2.0.7",
|
855 |
+
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
|
856 |
+
"integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
|
857 |
+
"dependencies": {
|
858 |
+
"forwarded": "0.2.0",
|
859 |
+
"ipaddr.js": "1.9.1"
|
860 |
+
},
|
861 |
+
"engines": {
|
862 |
+
"node": ">= 0.10"
|
863 |
+
}
|
864 |
+
},
|
865 |
+
"node_modules/qs": {
|
866 |
+
"version": "6.11.0",
|
867 |
+
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
|
868 |
+
"integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
|
869 |
+
"dependencies": {
|
870 |
+
"side-channel": "^1.0.4"
|
871 |
+
},
|
872 |
+
"engines": {
|
873 |
+
"node": ">=0.6"
|
874 |
+
},
|
875 |
+
"funding": {
|
876 |
+
"url": "https://github.com/sponsors/ljharb"
|
877 |
+
}
|
878 |
+
},
|
879 |
+
"node_modules/range-parser": {
|
880 |
+
"version": "1.2.1",
|
881 |
+
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
|
882 |
+
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
|
883 |
+
"engines": {
|
884 |
+
"node": ">= 0.6"
|
885 |
+
}
|
886 |
+
},
|
887 |
+
"node_modules/raw-body": {
|
888 |
+
"version": "2.5.2",
|
889 |
+
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz",
|
890 |
+
"integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==",
|
891 |
+
"dependencies": {
|
892 |
+
"bytes": "3.1.2",
|
893 |
+
"http-errors": "2.0.0",
|
894 |
+
"iconv-lite": "0.4.24",
|
895 |
+
"unpipe": "1.0.0"
|
896 |
+
},
|
897 |
+
"engines": {
|
898 |
+
"node": ">= 0.8"
|
899 |
+
}
|
900 |
+
},
|
901 |
+
"node_modules/readable-stream": {
|
902 |
+
"version": "2.3.8",
|
903 |
+
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",
|
904 |
+
"integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
|
905 |
+
"dependencies": {
|
906 |
+
"core-util-is": "~1.0.0",
|
907 |
+
"inherits": "~2.0.3",
|
908 |
+
"isarray": "~1.0.0",
|
909 |
+
"process-nextick-args": "~2.0.0",
|
910 |
+
"safe-buffer": "~5.1.1",
|
911 |
+
"string_decoder": "~1.1.1",
|
912 |
+
"util-deprecate": "~1.0.1"
|
913 |
+
}
|
914 |
+
},
|
915 |
+
"node_modules/readable-stream/node_modules/safe-buffer": {
|
916 |
+
"version": "5.1.2",
|
917 |
+
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
918 |
+
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
919 |
+
},
|
920 |
+
"node_modules/safe-buffer": {
|
921 |
+
"version": "5.2.1",
|
922 |
+
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
923 |
+
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
924 |
+
"funding": [
|
925 |
+
{
|
926 |
+
"type": "github",
|
927 |
+
"url": "https://github.com/sponsors/feross"
|
928 |
+
},
|
929 |
+
{
|
930 |
+
"type": "patreon",
|
931 |
+
"url": "https://www.patreon.com/feross"
|
932 |
+
},
|
933 |
+
{
|
934 |
+
"type": "consulting",
|
935 |
+
"url": "https://feross.org/support"
|
936 |
+
}
|
937 |
+
]
|
938 |
+
},
|
939 |
+
"node_modules/safer-buffer": {
|
940 |
+
"version": "2.1.2",
|
941 |
+
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
942 |
+
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
943 |
+
},
|
944 |
+
"node_modules/send": {
|
945 |
+
"version": "0.18.0",
|
946 |
+
"resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz",
|
947 |
+
"integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==",
|
948 |
+
"dependencies": {
|
949 |
+
"debug": "2.6.9",
|
950 |
+
"depd": "2.0.0",
|
951 |
+
"destroy": "1.2.0",
|
952 |
+
"encodeurl": "~1.0.2",
|
953 |
+
"escape-html": "~1.0.3",
|
954 |
+
"etag": "~1.8.1",
|
955 |
+
"fresh": "0.5.2",
|
956 |
+
"http-errors": "2.0.0",
|
957 |
+
"mime": "1.6.0",
|
958 |
+
"ms": "2.1.3",
|
959 |
+
"on-finished": "2.4.1",
|
960 |
+
"range-parser": "~1.2.1",
|
961 |
+
"statuses": "2.0.1"
|
962 |
+
},
|
963 |
+
"engines": {
|
964 |
+
"node": ">= 0.8.0"
|
965 |
+
}
|
966 |
+
},
|
967 |
+
"node_modules/send/node_modules/ms": {
|
968 |
+
"version": "2.1.3",
|
969 |
+
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
970 |
+
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
|
971 |
+
},
|
972 |
+
"node_modules/serve-static": {
|
973 |
+
"version": "1.15.0",
|
974 |
+
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz",
|
975 |
+
"integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==",
|
976 |
+
"dependencies": {
|
977 |
+
"encodeurl": "~1.0.2",
|
978 |
+
"escape-html": "~1.0.3",
|
979 |
+
"parseurl": "~1.3.3",
|
980 |
+
"send": "0.18.0"
|
981 |
+
},
|
982 |
+
"engines": {
|
983 |
+
"node": ">= 0.8.0"
|
984 |
+
}
|
985 |
+
},
|
986 |
+
"node_modules/set-function-length": {
|
987 |
+
"version": "1.2.2",
|
988 |
+
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",
|
989 |
+
"integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==",
|
990 |
+
"dependencies": {
|
991 |
+
"define-data-property": "^1.1.4",
|
992 |
+
"es-errors": "^1.3.0",
|
993 |
+
"function-bind": "^1.1.2",
|
994 |
+
"get-intrinsic": "^1.2.4",
|
995 |
+
"gopd": "^1.0.1",
|
996 |
+
"has-property-descriptors": "^1.0.2"
|
997 |
+
},
|
998 |
+
"engines": {
|
999 |
+
"node": ">= 0.4"
|
1000 |
+
}
|
1001 |
+
},
|
1002 |
+
"node_modules/setprototypeof": {
|
1003 |
+
"version": "1.2.0",
|
1004 |
+
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
|
1005 |
+
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
|
1006 |
+
},
|
1007 |
+
"node_modules/side-channel": {
|
1008 |
+
"version": "1.0.6",
|
1009 |
+
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz",
|
1010 |
+
"integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==",
|
1011 |
+
"dependencies": {
|
1012 |
+
"call-bind": "^1.0.7",
|
1013 |
+
"es-errors": "^1.3.0",
|
1014 |
+
"get-intrinsic": "^1.2.4",
|
1015 |
+
"object-inspect": "^1.13.1"
|
1016 |
+
},
|
1017 |
+
"engines": {
|
1018 |
+
"node": ">= 0.4"
|
1019 |
+
},
|
1020 |
+
"funding": {
|
1021 |
+
"url": "https://github.com/sponsors/ljharb"
|
1022 |
+
}
|
1023 |
+
},
|
1024 |
+
"node_modules/statuses": {
|
1025 |
+
"version": "2.0.1",
|
1026 |
+
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
|
1027 |
+
"integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
|
1028 |
+
"engines": {
|
1029 |
+
"node": ">= 0.8"
|
1030 |
+
}
|
1031 |
+
},
|
1032 |
+
"node_modules/streamsearch": {
|
1033 |
+
"version": "1.1.0",
|
1034 |
+
"resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz",
|
1035 |
+
"integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==",
|
1036 |
+
"engines": {
|
1037 |
+
"node": ">=10.0.0"
|
1038 |
+
}
|
1039 |
+
},
|
1040 |
+
"node_modules/string_decoder": {
|
1041 |
+
"version": "1.1.1",
|
1042 |
+
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
1043 |
+
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
|
1044 |
+
"dependencies": {
|
1045 |
+
"safe-buffer": "~5.1.0"
|
1046 |
+
}
|
1047 |
+
},
|
1048 |
+
"node_modules/string_decoder/node_modules/safe-buffer": {
|
1049 |
+
"version": "5.1.2",
|
1050 |
+
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
1051 |
+
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
1052 |
+
},
|
1053 |
+
"node_modules/toidentifier": {
|
1054 |
+
"version": "1.0.1",
|
1055 |
+
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
|
1056 |
+
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
|
1057 |
+
"engines": {
|
1058 |
+
"node": ">=0.6"
|
1059 |
+
}
|
1060 |
+
},
|
1061 |
+
"node_modules/tr46": {
|
1062 |
+
"version": "0.0.3",
|
1063 |
+
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
1064 |
+
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
|
1065 |
+
},
|
1066 |
+
"node_modules/type-is": {
|
1067 |
+
"version": "1.6.18",
|
1068 |
+
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
|
1069 |
+
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
|
1070 |
+
"dependencies": {
|
1071 |
+
"media-typer": "0.3.0",
|
1072 |
+
"mime-types": "~2.1.24"
|
1073 |
+
},
|
1074 |
+
"engines": {
|
1075 |
+
"node": ">= 0.6"
|
1076 |
+
}
|
1077 |
+
},
|
1078 |
+
"node_modules/typedarray": {
|
1079 |
+
"version": "0.0.6",
|
1080 |
+
"resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
|
1081 |
+
"integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA=="
|
1082 |
+
},
|
1083 |
+
"node_modules/undici-types": {
|
1084 |
+
"version": "5.26.5",
|
1085 |
+
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
|
1086 |
+
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="
|
1087 |
+
},
|
1088 |
+
"node_modules/unpipe": {
|
1089 |
+
"version": "1.0.0",
|
1090 |
+
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
1091 |
+
"integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
|
1092 |
+
"engines": {
|
1093 |
+
"node": ">= 0.8"
|
1094 |
+
}
|
1095 |
+
},
|
1096 |
+
"node_modules/util-deprecate": {
|
1097 |
+
"version": "1.0.2",
|
1098 |
+
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
1099 |
+
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
|
1100 |
+
},
|
1101 |
+
"node_modules/utils-merge": {
|
1102 |
+
"version": "1.0.1",
|
1103 |
+
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
|
1104 |
+
"integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
|
1105 |
+
"engines": {
|
1106 |
+
"node": ">= 0.4.0"
|
1107 |
+
}
|
1108 |
+
},
|
1109 |
+
"node_modules/vary": {
|
1110 |
+
"version": "1.1.2",
|
1111 |
+
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
1112 |
+
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
|
1113 |
+
"engines": {
|
1114 |
+
"node": ">= 0.8"
|
1115 |
+
}
|
1116 |
+
},
|
1117 |
+
"node_modules/web-streams-polyfill": {
|
1118 |
+
"version": "3.3.3",
|
1119 |
+
"resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz",
|
1120 |
+
"integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==",
|
1121 |
+
"engines": {
|
1122 |
+
"node": ">= 8"
|
1123 |
+
}
|
1124 |
+
},
|
1125 |
+
"node_modules/webidl-conversions": {
|
1126 |
+
"version": "3.0.1",
|
1127 |
+
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
1128 |
+
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
|
1129 |
+
},
|
1130 |
+
"node_modules/whatwg-url": {
|
1131 |
+
"version": "5.0.0",
|
1132 |
+
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
|
1133 |
+
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
|
1134 |
+
"dependencies": {
|
1135 |
+
"tr46": "~0.0.3",
|
1136 |
+
"webidl-conversions": "^3.0.0"
|
1137 |
+
}
|
1138 |
+
},
|
1139 |
+
"node_modules/xtend": {
|
1140 |
+
"version": "4.0.2",
|
1141 |
+
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
|
1142 |
+
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==",
|
1143 |
+
"engines": {
|
1144 |
+
"node": ">=0.4"
|
1145 |
+
}
|
1146 |
+
}
|
1147 |
+
}
|
1148 |
+
}
|
backend/node_modules/@types/body-parser/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
|
backend/node_modules/@types/body-parser/README.md
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Installation
|
2 |
+
> `npm install --save @types/body-parser`
|
3 |
+
|
4 |
+
# Summary
|
5 |
+
This package contains type definitions for body-parser (https://github.com/expressjs/body-parser).
|
6 |
+
|
7 |
+
# Details
|
8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/body-parser.
|
9 |
+
|
10 |
+
### Additional Details
|
11 |
+
* Last updated: Mon, 06 Nov 2023 22:41:05 GMT
|
12 |
+
* Dependencies: [@types/connect](https://npmjs.com/package/@types/connect), [@types/node](https://npmjs.com/package/@types/node)
|
13 |
+
|
14 |
+
# Credits
|
15 |
+
These definitions were written by [Santi Albo](https://github.com/santialbo), [Vilic Vane](https://github.com/vilic), [Jonathan Häberle](https://github.com/dreampulse), [Gevik Babakhani](https://github.com/blendsdk), [Tomasz Łaziuk](https://github.com/tlaziuk), [Jason Walton](https://github.com/jwalton), and [Piotr Błażejewicz](https://github.com/peterblazejewicz).
|
backend/node_modules/@types/body-parser/index.d.ts
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/// <reference types="node" />
|
2 |
+
|
3 |
+
import { NextHandleFunction } from "connect";
|
4 |
+
import * as http from "http";
|
5 |
+
|
6 |
+
// for docs go to https://github.com/expressjs/body-parser/tree/1.19.0#body-parser
|
7 |
+
|
8 |
+
declare namespace bodyParser {
|
9 |
+
interface BodyParser {
|
10 |
+
/**
|
11 |
+
* @deprecated use individual json/urlencoded middlewares
|
12 |
+
*/
|
13 |
+
(options?: OptionsJson & OptionsText & OptionsUrlencoded): NextHandleFunction;
|
14 |
+
/**
|
15 |
+
* Returns middleware that only parses json and only looks at requests
|
16 |
+
* where the Content-Type header matches the type option.
|
17 |
+
*/
|
18 |
+
json(options?: OptionsJson): NextHandleFunction;
|
19 |
+
/**
|
20 |
+
* Returns middleware that parses all bodies as a Buffer and only looks at requests
|
21 |
+
* where the Content-Type header matches the type option.
|
22 |
+
*/
|
23 |
+
raw(options?: Options): NextHandleFunction;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Returns middleware that parses all bodies as a string and only looks at requests
|
27 |
+
* where the Content-Type header matches the type option.
|
28 |
+
*/
|
29 |
+
text(options?: OptionsText): NextHandleFunction;
|
30 |
+
/**
|
31 |
+
* Returns middleware that only parses urlencoded bodies and only looks at requests
|
32 |
+
* where the Content-Type header matches the type option
|
33 |
+
*/
|
34 |
+
urlencoded(options?: OptionsUrlencoded): NextHandleFunction;
|
35 |
+
}
|
36 |
+
|
37 |
+
interface Options {
|
38 |
+
/** When set to true, then deflated (compressed) bodies will be inflated; when false, deflated bodies are rejected. Defaults to true. */
|
39 |
+
inflate?: boolean | undefined;
|
40 |
+
/**
|
41 |
+
* Controls the maximum request body size. If this is a number,
|
42 |
+
* then the value specifies the number of bytes; if it is a string,
|
43 |
+
* the value is passed to the bytes library for parsing. Defaults to '100kb'.
|
44 |
+
*/
|
45 |
+
limit?: number | string | undefined;
|
46 |
+
/**
|
47 |
+
* The type option is used to determine what media type the middleware will parse
|
48 |
+
*/
|
49 |
+
type?: string | string[] | ((req: http.IncomingMessage) => any) | undefined;
|
50 |
+
/**
|
51 |
+
* The verify option, if supplied, is called as verify(req, res, buf, encoding),
|
52 |
+
* where buf is a Buffer of the raw request body and encoding is the encoding of the request.
|
53 |
+
*/
|
54 |
+
verify?(req: http.IncomingMessage, res: http.ServerResponse, buf: Buffer, encoding: string): void;
|
55 |
+
}
|
56 |
+
|
57 |
+
interface OptionsJson extends Options {
|
58 |
+
/**
|
59 |
+
* The reviver option is passed directly to JSON.parse as the second argument.
|
60 |
+
*/
|
61 |
+
reviver?(key: string, value: any): any;
|
62 |
+
/**
|
63 |
+
* When set to `true`, will only accept arrays and objects;
|
64 |
+
* when `false` will accept anything JSON.parse accepts. Defaults to `true`.
|
65 |
+
*/
|
66 |
+
strict?: boolean | undefined;
|
67 |
+
}
|
68 |
+
|
69 |
+
interface OptionsText extends Options {
|
70 |
+
/**
|
71 |
+
* Specify the default character set for the text content if the charset
|
72 |
+
* is not specified in the Content-Type header of the request.
|
73 |
+
* Defaults to `utf-8`.
|
74 |
+
*/
|
75 |
+
defaultCharset?: string | undefined;
|
76 |
+
}
|
77 |
+
|
78 |
+
interface OptionsUrlencoded extends Options {
|
79 |
+
/**
|
80 |
+
* The extended option allows to choose between parsing the URL-encoded data
|
81 |
+
* with the querystring library (when `false`) or the qs library (when `true`).
|
82 |
+
*/
|
83 |
+
extended?: boolean | undefined;
|
84 |
+
/**
|
85 |
+
* The parameterLimit option controls the maximum number of parameters
|
86 |
+
* that are allowed in the URL-encoded data. If a request contains more parameters than this value,
|
87 |
+
* a 413 will be returned to the client. Defaults to 1000.
|
88 |
+
*/
|
89 |
+
parameterLimit?: number | undefined;
|
90 |
+
}
|
91 |
+
}
|
92 |
+
|
93 |
+
declare const bodyParser: bodyParser.BodyParser;
|
94 |
+
|
95 |
+
export = bodyParser;
|
backend/node_modules/@types/body-parser/package.json
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "@types/body-parser",
|
3 |
+
"version": "1.19.5",
|
4 |
+
"description": "TypeScript definitions for body-parser",
|
5 |
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/body-parser",
|
6 |
+
"license": "MIT",
|
7 |
+
"contributors": [
|
8 |
+
{
|
9 |
+
"name": "Santi Albo",
|
10 |
+
"githubUsername": "santialbo",
|
11 |
+
"url": "https://github.com/santialbo"
|
12 |
+
},
|
13 |
+
{
|
14 |
+
"name": "Vilic Vane",
|
15 |
+
"githubUsername": "vilic",
|
16 |
+
"url": "https://github.com/vilic"
|
17 |
+
},
|
18 |
+
{
|
19 |
+
"name": "Jonathan Häberle",
|
20 |
+
"githubUsername": "dreampulse",
|
21 |
+
"url": "https://github.com/dreampulse"
|
22 |
+
},
|
23 |
+
{
|
24 |
+
"name": "Gevik Babakhani",
|
25 |
+
"githubUsername": "blendsdk",
|
26 |
+
"url": "https://github.com/blendsdk"
|
27 |
+
},
|
28 |
+
{
|
29 |
+
"name": "Tomasz Łaziuk",
|
30 |
+
"githubUsername": "tlaziuk",
|
31 |
+
"url": "https://github.com/tlaziuk"
|
32 |
+
},
|
33 |
+
{
|
34 |
+
"name": "Jason Walton",
|
35 |
+
"githubUsername": "jwalton",
|
36 |
+
"url": "https://github.com/jwalton"
|
37 |
+
},
|
38 |
+
{
|
39 |
+
"name": "Piotr Błażejewicz",
|
40 |
+
"githubUsername": "peterblazejewicz",
|
41 |
+
"url": "https://github.com/peterblazejewicz"
|
42 |
+
}
|
43 |
+
],
|
44 |
+
"main": "",
|
45 |
+
"types": "index.d.ts",
|
46 |
+
"repository": {
|
47 |
+
"type": "git",
|
48 |
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
49 |
+
"directory": "types/body-parser"
|
50 |
+
},
|
51 |
+
"scripts": {},
|
52 |
+
"dependencies": {
|
53 |
+
"@types/connect": "*",
|
54 |
+
"@types/node": "*"
|
55 |
+
},
|
56 |
+
"typesPublisherContentHash": "7be737b78c8aabd5436be840558b283182b44c3cf9da24fb1f2ff8f414db5802",
|
57 |
+
"typeScriptVersion": "4.5"
|
58 |
+
}
|
backend/node_modules/@types/connect/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
|
backend/node_modules/@types/connect/README.md
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Installation
|
2 |
+
> `npm install --save @types/connect`
|
3 |
+
|
4 |
+
# Summary
|
5 |
+
This package contains type definitions for connect (https://github.com/senchalabs/connect).
|
6 |
+
|
7 |
+
# Details
|
8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/connect.
|
9 |
+
|
10 |
+
### Additional Details
|
11 |
+
* Last updated: Mon, 06 Nov 2023 22:41:05 GMT
|
12 |
+
* Dependencies: [@types/node](https://npmjs.com/package/@types/node)
|
13 |
+
|
14 |
+
# Credits
|
15 |
+
These definitions were written by [Maxime LUCE](https://github.com/SomaticIT), and [Evan Hahn](https://github.com/EvanHahn).
|
backend/node_modules/@types/connect/index.d.ts
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/// <reference types="node" />
|
2 |
+
|
3 |
+
import * as http from "http";
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Create a new connect server.
|
7 |
+
*/
|
8 |
+
declare function createServer(): createServer.Server;
|
9 |
+
|
10 |
+
declare namespace createServer {
|
11 |
+
export type ServerHandle = HandleFunction | http.Server;
|
12 |
+
|
13 |
+
export class IncomingMessage extends http.IncomingMessage {
|
14 |
+
originalUrl?: http.IncomingMessage["url"] | undefined;
|
15 |
+
}
|
16 |
+
|
17 |
+
type NextFunction = (err?: any) => void;
|
18 |
+
|
19 |
+
export type SimpleHandleFunction = (req: IncomingMessage, res: http.ServerResponse) => void;
|
20 |
+
export type NextHandleFunction = (req: IncomingMessage, res: http.ServerResponse, next: NextFunction) => void;
|
21 |
+
export type ErrorHandleFunction = (
|
22 |
+
err: any,
|
23 |
+
req: IncomingMessage,
|
24 |
+
res: http.ServerResponse,
|
25 |
+
next: NextFunction,
|
26 |
+
) => void;
|
27 |
+
export type HandleFunction = SimpleHandleFunction | NextHandleFunction | ErrorHandleFunction;
|
28 |
+
|
29 |
+
export interface ServerStackItem {
|
30 |
+
route: string;
|
31 |
+
handle: ServerHandle;
|
32 |
+
}
|
33 |
+
|
34 |
+
export interface Server extends NodeJS.EventEmitter {
|
35 |
+
(req: http.IncomingMessage, res: http.ServerResponse, next?: Function): void;
|
36 |
+
|
37 |
+
route: string;
|
38 |
+
stack: ServerStackItem[];
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Utilize the given middleware `handle` to the given `route`,
|
42 |
+
* defaulting to _/_. This "route" is the mount-point for the
|
43 |
+
* middleware, when given a value other than _/_ the middleware
|
44 |
+
* is only effective when that segment is present in the request's
|
45 |
+
* pathname.
|
46 |
+
*
|
47 |
+
* For example if we were to mount a function at _/admin_, it would
|
48 |
+
* be invoked on _/admin_, and _/admin/settings_, however it would
|
49 |
+
* not be invoked for _/_, or _/posts_.
|
50 |
+
*/
|
51 |
+
use(fn: NextHandleFunction): Server;
|
52 |
+
use(fn: HandleFunction): Server;
|
53 |
+
use(route: string, fn: NextHandleFunction): Server;
|
54 |
+
use(route: string, fn: HandleFunction): Server;
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Handle server requests, punting them down
|
58 |
+
* the middleware stack.
|
59 |
+
*/
|
60 |
+
handle(req: http.IncomingMessage, res: http.ServerResponse, next: Function): void;
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Listen for connections.
|
64 |
+
*
|
65 |
+
* This method takes the same arguments
|
66 |
+
* as node's `http.Server#listen()`.
|
67 |
+
*
|
68 |
+
* HTTP and HTTPS:
|
69 |
+
*
|
70 |
+
* If you run your application both as HTTP
|
71 |
+
* and HTTPS you may wrap them individually,
|
72 |
+
* since your Connect "server" is really just
|
73 |
+
* a JavaScript `Function`.
|
74 |
+
*
|
75 |
+
* var connect = require('connect')
|
76 |
+
* , http = require('http')
|
77 |
+
* , https = require('https');
|
78 |
+
*
|
79 |
+
* var app = connect();
|
80 |
+
*
|
81 |
+
* http.createServer(app).listen(80);
|
82 |
+
* https.createServer(options, app).listen(443);
|
83 |
+
*/
|
84 |
+
listen(port: number, hostname?: string, backlog?: number, callback?: Function): http.Server;
|
85 |
+
listen(port: number, hostname?: string, callback?: Function): http.Server;
|
86 |
+
listen(path: string, callback?: Function): http.Server;
|
87 |
+
listen(handle: any, listeningListener?: Function): http.Server;
|
88 |
+
}
|
89 |
+
}
|
90 |
+
|
91 |
+
export = createServer;
|
backend/node_modules/@types/connect/package.json
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "@types/connect",
|
3 |
+
"version": "3.4.38",
|
4 |
+
"description": "TypeScript definitions for connect",
|
5 |
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/connect",
|
6 |
+
"license": "MIT",
|
7 |
+
"contributors": [
|
8 |
+
{
|
9 |
+
"name": "Maxime LUCE",
|
10 |
+
"githubUsername": "SomaticIT",
|
11 |
+
"url": "https://github.com/SomaticIT"
|
12 |
+
},
|
13 |
+
{
|
14 |
+
"name": "Evan Hahn",
|
15 |
+
"githubUsername": "EvanHahn",
|
16 |
+
"url": "https://github.com/EvanHahn"
|
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/connect"
|
25 |
+
},
|
26 |
+
"scripts": {},
|
27 |
+
"dependencies": {
|
28 |
+
"@types/node": "*"
|
29 |
+
},
|
30 |
+
"typesPublisherContentHash": "8990242237504bdec53088b79e314b94bec69286df9de56db31f22de403b4092",
|
31 |
+
"typeScriptVersion": "4.5"
|
32 |
+
}
|
backend/node_modules/@types/express-serve-static-core/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
|
backend/node_modules/@types/express-serve-static-core/README.md
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Installation
|
2 |
+
> `npm install --save @types/express-serve-static-core`
|
3 |
+
|
4 |
+
# Summary
|
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: Thu, 04 Apr 2024 22:35:44 GMT
|
12 |
+
* Dependencies: [@types/node](https://npmjs.com/package/@types/node), [@types/qs](https://npmjs.com/package/@types/qs), [@types/range-parser](https://npmjs.com/package/@types/range-parser), [@types/send](https://npmjs.com/package/@types/send)
|
13 |
+
|
14 |
+
# Credits
|
15 |
+
These definitions were written by [Boris Yankov](https://github.com/borisyankov), [Satana Charuwichitratana](https://github.com/micksatana), [Sami Jaber](https://github.com/samijaber), [Jose Luis Leon](https://github.com/JoseLion), [David Stephens](https://github.com/dwrss), and [Shin Ando](https://github.com/andoshin11).
|
backend/node_modules/@types/express-serve-static-core/index.d.ts
ADDED
@@ -0,0 +1,1284 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// This extracts the core definitions from express to prevent a circular dependency between express and serve-static
|
2 |
+
/// <reference types="node" />
|
3 |
+
|
4 |
+
import { SendOptions } from "send";
|
5 |
+
|
6 |
+
declare global {
|
7 |
+
namespace Express {
|
8 |
+
// These open interfaces may be extended in an application-specific manner via declaration merging.
|
9 |
+
// See for example method-override.d.ts (https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/method-override/index.d.ts)
|
10 |
+
interface Request {}
|
11 |
+
interface Response {}
|
12 |
+
interface Locals {}
|
13 |
+
interface Application {}
|
14 |
+
}
|
15 |
+
}
|
16 |
+
|
17 |
+
import { EventEmitter } from "events";
|
18 |
+
import * as http from "http";
|
19 |
+
import { ParsedQs } from "qs";
|
20 |
+
import { Options as RangeParserOptions, Ranges as RangeParserRanges, Result as RangeParserResult } from "range-parser";
|
21 |
+
|
22 |
+
export {};
|
23 |
+
|
24 |
+
export type Query = ParsedQs;
|
25 |
+
|
26 |
+
export interface NextFunction {
|
27 |
+
(err?: any): void;
|
28 |
+
/**
|
29 |
+
* "Break-out" of a router by calling {next('router')};
|
30 |
+
* @see {https://expressjs.com/en/guide/using-middleware.html#middleware.router}
|
31 |
+
*/
|
32 |
+
(deferToNext: "router"): void;
|
33 |
+
/**
|
34 |
+
* "Break-out" of a route by calling {next('route')};
|
35 |
+
* @see {https://expressjs.com/en/guide/using-middleware.html#middleware.application}
|
36 |
+
*/
|
37 |
+
(deferToNext: "route"): void;
|
38 |
+
}
|
39 |
+
|
40 |
+
export interface Dictionary<T> {
|
41 |
+
[key: string]: T;
|
42 |
+
}
|
43 |
+
|
44 |
+
export interface ParamsDictionary {
|
45 |
+
[key: string]: string;
|
46 |
+
}
|
47 |
+
export type ParamsArray = string[];
|
48 |
+
export type Params = ParamsDictionary | ParamsArray;
|
49 |
+
|
50 |
+
export interface Locals extends Express.Locals {}
|
51 |
+
|
52 |
+
export interface RequestHandler<
|
53 |
+
P = ParamsDictionary,
|
54 |
+
ResBody = any,
|
55 |
+
ReqBody = any,
|
56 |
+
ReqQuery = ParsedQs,
|
57 |
+
LocalsObj extends Record<string, any> = Record<string, any>,
|
58 |
+
> {
|
59 |
+
// tslint:disable-next-line callable-types (This is extended from and can't extend from a type alias in ts<2.2)
|
60 |
+
(
|
61 |
+
req: Request<P, ResBody, ReqBody, ReqQuery, LocalsObj>,
|
62 |
+
res: Response<ResBody, LocalsObj>,
|
63 |
+
next: NextFunction,
|
64 |
+
): void;
|
65 |
+
}
|
66 |
+
|
67 |
+
export type ErrorRequestHandler<
|
68 |
+
P = ParamsDictionary,
|
69 |
+
ResBody = any,
|
70 |
+
ReqBody = any,
|
71 |
+
ReqQuery = ParsedQs,
|
72 |
+
LocalsObj extends Record<string, any> = Record<string, any>,
|
73 |
+
> = (
|
74 |
+
err: any,
|
75 |
+
req: Request<P, ResBody, ReqBody, ReqQuery, LocalsObj>,
|
76 |
+
res: Response<ResBody, LocalsObj>,
|
77 |
+
next: NextFunction,
|
78 |
+
) => void;
|
79 |
+
|
80 |
+
export type PathParams = string | RegExp | Array<string | RegExp>;
|
81 |
+
|
82 |
+
export type RequestHandlerParams<
|
83 |
+
P = ParamsDictionary,
|
84 |
+
ResBody = any,
|
85 |
+
ReqBody = any,
|
86 |
+
ReqQuery = ParsedQs,
|
87 |
+
LocalsObj extends Record<string, any> = Record<string, any>,
|
88 |
+
> =
|
89 |
+
| RequestHandler<P, ResBody, ReqBody, ReqQuery, LocalsObj>
|
90 |
+
| ErrorRequestHandler<P, ResBody, ReqBody, ReqQuery, LocalsObj>
|
91 |
+
| Array<RequestHandler<P> | ErrorRequestHandler<P>>;
|
92 |
+
|
93 |
+
type RemoveTail<S extends string, Tail extends string> = S extends `${infer P}${Tail}` ? P : S;
|
94 |
+
type GetRouteParameter<S extends string> = RemoveTail<
|
95 |
+
RemoveTail<RemoveTail<S, `/${string}`>, `-${string}`>,
|
96 |
+
`.${string}`
|
97 |
+
>;
|
98 |
+
|
99 |
+
// prettier-ignore
|
100 |
+
export type RouteParameters<Route extends string> = string extends Route ? ParamsDictionary
|
101 |
+
: Route extends `${string}(${string}` ? ParamsDictionary // TODO: handling for regex parameters
|
102 |
+
: Route extends `${string}:${infer Rest}` ?
|
103 |
+
& (
|
104 |
+
GetRouteParameter<Rest> extends never ? ParamsDictionary
|
105 |
+
: GetRouteParameter<Rest> extends `${infer ParamName}?` ? { [P in ParamName]?: string }
|
106 |
+
: { [P in GetRouteParameter<Rest>]: string }
|
107 |
+
)
|
108 |
+
& (Rest extends `${GetRouteParameter<Rest>}${infer Next}` ? RouteParameters<Next> : unknown)
|
109 |
+
: {};
|
110 |
+
|
111 |
+
/* eslint-disable @definitelytyped/no-unnecessary-generics */
|
112 |
+
export interface IRouterMatcher<
|
113 |
+
T,
|
114 |
+
Method extends "all" | "get" | "post" | "put" | "delete" | "patch" | "options" | "head" = any,
|
115 |
+
> {
|
116 |
+
<
|
117 |
+
Route extends string,
|
118 |
+
P = RouteParameters<Route>,
|
119 |
+
ResBody = any,
|
120 |
+
ReqBody = any,
|
121 |
+
ReqQuery = ParsedQs,
|
122 |
+
LocalsObj extends Record<string, any> = Record<string, any>,
|
123 |
+
>(
|
124 |
+
// (it's used as the default type parameter for P)
|
125 |
+
path: Route,
|
126 |
+
// (This generic is meant to be passed explicitly.)
|
127 |
+
...handlers: Array<RequestHandler<P, ResBody, ReqBody, ReqQuery, LocalsObj>>
|
128 |
+
): T;
|
129 |
+
<
|
130 |
+
Path extends string,
|
131 |
+
P = RouteParameters<Path>,
|
132 |
+
ResBody = any,
|
133 |
+
ReqBody = any,
|
134 |
+
ReqQuery = ParsedQs,
|
135 |
+
LocalsObj extends Record<string, any> = Record<string, any>,
|
136 |
+
>(
|
137 |
+
// (it's used as the default type parameter for P)
|
138 |
+
path: Path,
|
139 |
+
// (This generic is meant to be passed explicitly.)
|
140 |
+
...handlers: Array<RequestHandlerParams<P, ResBody, ReqBody, ReqQuery, LocalsObj>>
|
141 |
+
): T;
|
142 |
+
<
|
143 |
+
P = ParamsDictionary,
|
144 |
+
ResBody = any,
|
145 |
+
ReqBody = any,
|
146 |
+
ReqQuery = ParsedQs,
|
147 |
+
LocalsObj extends Record<string, any> = Record<string, any>,
|
148 |
+
>(
|
149 |
+
path: PathParams,
|
150 |
+
// (This generic is meant to be passed explicitly.)
|
151 |
+
...handlers: Array<RequestHandler<P, ResBody, ReqBody, ReqQuery, LocalsObj>>
|
152 |
+
): T;
|
153 |
+
<
|
154 |
+
P = ParamsDictionary,
|
155 |
+
ResBody = any,
|
156 |
+
ReqBody = any,
|
157 |
+
ReqQuery = ParsedQs,
|
158 |
+
LocalsObj extends Record<string, any> = Record<string, any>,
|
159 |
+
>(
|
160 |
+
path: PathParams,
|
161 |
+
// (This generic is meant to be passed explicitly.)
|
162 |
+
...handlers: Array<RequestHandlerParams<P, ResBody, ReqBody, ReqQuery, LocalsObj>>
|
163 |
+
): T;
|
164 |
+
(path: PathParams, subApplication: Application): T;
|
165 |
+
}
|
166 |
+
|
167 |
+
export interface IRouterHandler<T, Route extends string = string> {
|
168 |
+
(...handlers: Array<RequestHandler<RouteParameters<Route>>>): T;
|
169 |
+
(...handlers: Array<RequestHandlerParams<RouteParameters<Route>>>): T;
|
170 |
+
<
|
171 |
+
P = RouteParameters<Route>,
|
172 |
+
ResBody = any,
|
173 |
+
ReqBody = any,
|
174 |
+
ReqQuery = ParsedQs,
|
175 |
+
LocalsObj extends Record<string, any> = Record<string, any>,
|
176 |
+
>(
|
177 |
+
// (This generic is meant to be passed explicitly.)
|
178 |
+
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
179 |
+
...handlers: Array<RequestHandler<P, ResBody, ReqBody, ReqQuery, LocalsObj>>
|
180 |
+
): T;
|
181 |
+
<
|
182 |
+
P = RouteParameters<Route>,
|
183 |
+
ResBody = any,
|
184 |
+
ReqBody = any,
|
185 |
+
ReqQuery = ParsedQs,
|
186 |
+
LocalsObj extends Record<string, any> = Record<string, any>,
|
187 |
+
>(
|
188 |
+
// (This generic is meant to be passed explicitly.)
|
189 |
+
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
190 |
+
...handlers: Array<RequestHandlerParams<P, ResBody, ReqBody, ReqQuery, LocalsObj>>
|
191 |
+
): T;
|
192 |
+
<
|
193 |
+
P = ParamsDictionary,
|
194 |
+
ResBody = any,
|
195 |
+
ReqBody = any,
|
196 |
+
ReqQuery = ParsedQs,
|
197 |
+
LocalsObj extends Record<string, any> = Record<string, any>,
|
198 |
+
>(
|
199 |
+
// (This generic is meant to be passed explicitly.)
|
200 |
+
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
201 |
+
...handlers: Array<RequestHandler<P, ResBody, ReqBody, ReqQuery, LocalsObj>>
|
202 |
+
): T;
|
203 |
+
<
|
204 |
+
P = ParamsDictionary,
|
205 |
+
ResBody = any,
|
206 |
+
ReqBody = any,
|
207 |
+
ReqQuery = ParsedQs,
|
208 |
+
LocalsObj extends Record<string, any> = Record<string, any>,
|
209 |
+
>(
|
210 |
+
// (This generic is meant to be passed explicitly.)
|
211 |
+
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
212 |
+
...handlers: Array<RequestHandlerParams<P, ResBody, ReqBody, ReqQuery, LocalsObj>>
|
213 |
+
): T;
|
214 |
+
}
|
215 |
+
/* eslint-enable @definitelytyped/no-unnecessary-generics */
|
216 |
+
|
217 |
+
export interface IRouter extends RequestHandler {
|
218 |
+
/**
|
219 |
+
* Map the given param placeholder `name`(s) to the given callback(s).
|
220 |
+
*
|
221 |
+
* Parameter mapping is used to provide pre-conditions to routes
|
222 |
+
* which use normalized placeholders. For example a _:user_id_ parameter
|
223 |
+
* could automatically load a user's information from the database without
|
224 |
+
* any additional code,
|
225 |
+
*
|
226 |
+
* The callback uses the samesignature as middleware, the only differencing
|
227 |
+
* being that the value of the placeholder is passed, in this case the _id_
|
228 |
+
* of the user. Once the `next()` function is invoked, just like middleware
|
229 |
+
* it will continue on to execute the route, or subsequent parameter functions.
|
230 |
+
*
|
231 |
+
* app.param('user_id', function(req, res, next, id){
|
232 |
+
* User.find(id, function(err, user){
|
233 |
+
* if (err) {
|
234 |
+
* next(err);
|
235 |
+
* } else if (user) {
|
236 |
+
* req.user = user;
|
237 |
+
* next();
|
238 |
+
* } else {
|
239 |
+
* next(new Error('failed to load user'));
|
240 |
+
* }
|
241 |
+
* });
|
242 |
+
* });
|
243 |
+
*/
|
244 |
+
param(name: string, handler: RequestParamHandler): this;
|
245 |
+
|
246 |
+
/**
|
247 |
+
* Alternatively, you can pass only a callback, in which case you have the opportunity to alter the app.param()
|
248 |
+
*
|
249 |
+
* @deprecated since version 4.11
|
250 |
+
*/
|
251 |
+
param(callback: (name: string, matcher: RegExp) => RequestParamHandler): this;
|
252 |
+
|
253 |
+
/**
|
254 |
+
* Special-cased "all" method, applying the given route `path`,
|
255 |
+
* middleware, and callback to _every_ HTTP method.
|
256 |
+
*/
|
257 |
+
all: IRouterMatcher<this, "all">;
|
258 |
+
get: IRouterMatcher<this, "get">;
|
259 |
+
post: IRouterMatcher<this, "post">;
|
260 |
+
put: IRouterMatcher<this, "put">;
|
261 |
+
delete: IRouterMatcher<this, "delete">;
|
262 |
+
patch: IRouterMatcher<this, "patch">;
|
263 |
+
options: IRouterMatcher<this, "options">;
|
264 |
+
head: IRouterMatcher<this, "head">;
|
265 |
+
|
266 |
+
checkout: IRouterMatcher<this>;
|
267 |
+
connect: IRouterMatcher<this>;
|
268 |
+
copy: IRouterMatcher<this>;
|
269 |
+
lock: IRouterMatcher<this>;
|
270 |
+
merge: IRouterMatcher<this>;
|
271 |
+
mkactivity: IRouterMatcher<this>;
|
272 |
+
mkcol: IRouterMatcher<this>;
|
273 |
+
move: IRouterMatcher<this>;
|
274 |
+
"m-search": IRouterMatcher<this>;
|
275 |
+
notify: IRouterMatcher<this>;
|
276 |
+
propfind: IRouterMatcher<this>;
|
277 |
+
proppatch: IRouterMatcher<this>;
|
278 |
+
purge: IRouterMatcher<this>;
|
279 |
+
report: IRouterMatcher<this>;
|
280 |
+
search: IRouterMatcher<this>;
|
281 |
+
subscribe: IRouterMatcher<this>;
|
282 |
+
trace: IRouterMatcher<this>;
|
283 |
+
unlock: IRouterMatcher<this>;
|
284 |
+
unsubscribe: IRouterMatcher<this>;
|
285 |
+
link: IRouterMatcher<this>;
|
286 |
+
unlink: IRouterMatcher<this>;
|
287 |
+
|
288 |
+
use: IRouterHandler<this> & IRouterMatcher<this>;
|
289 |
+
|
290 |
+
route<T extends string>(prefix: T): IRoute<T>;
|
291 |
+
route(prefix: PathParams): IRoute;
|
292 |
+
/**
|
293 |
+
* Stack of configured routes
|
294 |
+
*/
|
295 |
+
stack: any[];
|
296 |
+
}
|
297 |
+
|
298 |
+
export interface IRoute<Route extends string = string> {
|
299 |
+
path: string;
|
300 |
+
stack: any;
|
301 |
+
all: IRouterHandler<this, Route>;
|
302 |
+
get: IRouterHandler<this, Route>;
|
303 |
+
post: IRouterHandler<this, Route>;
|
304 |
+
put: IRouterHandler<this, Route>;
|
305 |
+
delete: IRouterHandler<this, Route>;
|
306 |
+
patch: IRouterHandler<this, Route>;
|
307 |
+
options: IRouterHandler<this, Route>;
|
308 |
+
head: IRouterHandler<this, Route>;
|
309 |
+
|
310 |
+
checkout: IRouterHandler<this, Route>;
|
311 |
+
copy: IRouterHandler<this, Route>;
|
312 |
+
lock: IRouterHandler<this, Route>;
|
313 |
+
merge: IRouterHandler<this, Route>;
|
314 |
+
mkactivity: IRouterHandler<this, Route>;
|
315 |
+
mkcol: IRouterHandler<this, Route>;
|
316 |
+
move: IRouterHandler<this, Route>;
|
317 |
+
"m-search": IRouterHandler<this, Route>;
|
318 |
+
notify: IRouterHandler<this, Route>;
|
319 |
+
purge: IRouterHandler<this, Route>;
|
320 |
+
report: IRouterHandler<this, Route>;
|
321 |
+
search: IRouterHandler<this, Route>;
|
322 |
+
subscribe: IRouterHandler<this, Route>;
|
323 |
+
trace: IRouterHandler<this, Route>;
|
324 |
+
unlock: IRouterHandler<this, Route>;
|
325 |
+
unsubscribe: IRouterHandler<this, Route>;
|
326 |
+
}
|
327 |
+
|
328 |
+
export interface Router extends IRouter {}
|
329 |
+
|
330 |
+
/**
|
331 |
+
* Options passed down into `res.cookie`
|
332 |
+
* @link https://expressjs.com/en/api.html#res.cookie
|
333 |
+
*/
|
334 |
+
export interface CookieOptions {
|
335 |
+
/** Convenient option for setting the expiry time relative to the current time in **milliseconds**. */
|
336 |
+
maxAge?: number | undefined;
|
337 |
+
/** Indicates if the cookie should be signed. */
|
338 |
+
signed?: boolean | undefined;
|
339 |
+
/** Expiry date of the cookie in GMT. If not specified or set to 0, creates a session cookie. */
|
340 |
+
expires?: Date | undefined;
|
341 |
+
/** Flags the cookie to be accessible only by the web server. */
|
342 |
+
httpOnly?: boolean | undefined;
|
343 |
+
/** Path for the cookie. Defaults to “/”. */
|
344 |
+
path?: string | undefined;
|
345 |
+
/** Domain name for the cookie. Defaults to the domain name of the app. */
|
346 |
+
domain?: string | undefined;
|
347 |
+
/** Marks the cookie to be used with HTTPS only. */
|
348 |
+
secure?: boolean | undefined;
|
349 |
+
/** A synchronous function used for cookie value encoding. Defaults to encodeURIComponent. */
|
350 |
+
encode?: ((val: string) => string) | undefined;
|
351 |
+
/**
|
352 |
+
* Value of the “SameSite” Set-Cookie attribute.
|
353 |
+
* @link https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00#section-4.1.1.
|
354 |
+
*/
|
355 |
+
sameSite?: boolean | "lax" | "strict" | "none" | undefined;
|
356 |
+
/**
|
357 |
+
* Value of the “Priority” Set-Cookie attribute.
|
358 |
+
* @link https://datatracker.ietf.org/doc/html/draft-west-cookie-priority-00#section-4.3
|
359 |
+
*/
|
360 |
+
priority?: "low" | "medium" | "high";
|
361 |
+
/** Marks the cookie to use partioned storage. */
|
362 |
+
partitioned?: boolean | undefined;
|
363 |
+
}
|
364 |
+
|
365 |
+
export interface ByteRange {
|
366 |
+
start: number;
|
367 |
+
end: number;
|
368 |
+
}
|
369 |
+
|
370 |
+
export interface RequestRanges extends RangeParserRanges {}
|
371 |
+
|
372 |
+
export type Errback = (err: Error) => void;
|
373 |
+
|
374 |
+
/**
|
375 |
+
* @param P For most requests, this should be `ParamsDictionary`, but if you're
|
376 |
+
* using this in a route handler for a route that uses a `RegExp` or a wildcard
|
377 |
+
* `string` path (e.g. `'/user/*'`), then `req.params` will be an array, in
|
378 |
+
* which case you should use `ParamsArray` instead.
|
379 |
+
*
|
380 |
+
* @see https://expressjs.com/en/api.html#req.params
|
381 |
+
*
|
382 |
+
* @example
|
383 |
+
* app.get('/user/:id', (req, res) => res.send(req.params.id)); // implicitly `ParamsDictionary`
|
384 |
+
* app.get<ParamsArray>(/user\/(.*)/, (req, res) => res.send(req.params[0]));
|
385 |
+
* app.get<ParamsArray>('/user/*', (req, res) => res.send(req.params[0]));
|
386 |
+
*/
|
387 |
+
export interface Request<
|
388 |
+
P = ParamsDictionary,
|
389 |
+
ResBody = any,
|
390 |
+
ReqBody = any,
|
391 |
+
ReqQuery = ParsedQs,
|
392 |
+
LocalsObj extends Record<string, any> = Record<string, any>,
|
393 |
+
> extends http.IncomingMessage, Express.Request {
|
394 |
+
/**
|
395 |
+
* Return request header.
|
396 |
+
*
|
397 |
+
* The `Referrer` header field is special-cased,
|
398 |
+
* both `Referrer` and `Referer` are interchangeable.
|
399 |
+
*
|
400 |
+
* Examples:
|
401 |
+
*
|
402 |
+
* req.get('Content-Type');
|
403 |
+
* // => "text/plain"
|
404 |
+
*
|
405 |
+
* req.get('content-type');
|
406 |
+
* // => "text/plain"
|
407 |
+
*
|
408 |
+
* req.get('Something');
|
409 |
+
* // => undefined
|
410 |
+
*
|
411 |
+
* Aliased as `req.header()`.
|
412 |
+
*/
|
413 |
+
get(name: "set-cookie"): string[] | undefined;
|
414 |
+
get(name: string): string | undefined;
|
415 |
+
|
416 |
+
header(name: "set-cookie"): string[] | undefined;
|
417 |
+
header(name: string): string | undefined;
|
418 |
+
|
419 |
+
/**
|
420 |
+
* Check if the given `type(s)` is acceptable, returning
|
421 |
+
* the best match when true, otherwise `undefined`, in which
|
422 |
+
* case you should respond with 406 "Not Acceptable".
|
423 |
+
*
|
424 |
+
* The `type` value may be a single mime type string
|
425 |
+
* such as "application/json", the extension name
|
426 |
+
* such as "json", a comma-delimted list such as "json, html, text/plain",
|
427 |
+
* or an array `["json", "html", "text/plain"]`. When a list
|
428 |
+
* or array is given the _best_ match, if any is returned.
|
429 |
+
*
|
430 |
+
* Examples:
|
431 |
+
*
|
432 |
+
* // Accept: text/html
|
433 |
+
* req.accepts('html');
|
434 |
+
* // => "html"
|
435 |
+
*
|
436 |
+
* // Accept: text/*, application/json
|
437 |
+
* req.accepts('html');
|
438 |
+
* // => "html"
|
439 |
+
* req.accepts('text/html');
|
440 |
+
* // => "text/html"
|
441 |
+
* req.accepts('json, text');
|
442 |
+
* // => "json"
|
443 |
+
* req.accepts('application/json');
|
444 |
+
* // => "application/json"
|
445 |
+
*
|
446 |
+
* // Accept: text/*, application/json
|
447 |
+
* req.accepts('image/png');
|
448 |
+
* req.accepts('png');
|
449 |
+
* // => false
|
450 |
+
*
|
451 |
+
* // Accept: text/*;q=.5, application/json
|
452 |
+
* req.accepts(['html', 'json']);
|
453 |
+
* req.accepts('html, json');
|
454 |
+
* // => "json"
|
455 |
+
*/
|
456 |
+
accepts(): string[];
|
457 |
+
accepts(type: string): string | false;
|
458 |
+
accepts(type: string[]): string | false;
|
459 |
+
accepts(...type: string[]): string | false;
|
460 |
+
|
461 |
+
/**
|
462 |
+
* Returns the first accepted charset of the specified character sets,
|
463 |
+
* based on the request's Accept-Charset HTTP header field.
|
464 |
+
* If none of the specified charsets is accepted, returns false.
|
465 |
+
*
|
466 |
+
* For more information, or if you have issues or concerns, see accepts.
|
467 |
+
*/
|
468 |
+
acceptsCharsets(): string[];
|
469 |
+
acceptsCharsets(charset: string): string | false;
|
470 |
+
acceptsCharsets(charset: string[]): string | false;
|
471 |
+
acceptsCharsets(...charset: string[]): string | false;
|
472 |
+
|
473 |
+
/**
|
474 |
+
* Returns the first accepted encoding of the specified encodings,
|
475 |
+
* based on the request's Accept-Encoding HTTP header field.
|
476 |
+
* If none of the specified encodings is accepted, returns false.
|
477 |
+
*
|
478 |
+
* For more information, or if you have issues or concerns, see accepts.
|
479 |
+
*/
|
480 |
+
acceptsEncodings(): string[];
|
481 |
+
acceptsEncodings(encoding: string): string | false;
|
482 |
+
acceptsEncodings(encoding: string[]): string | false;
|
483 |
+
acceptsEncodings(...encoding: string[]): string | false;
|
484 |
+
|
485 |
+
/**
|
486 |
+
* Returns the first accepted language of the specified languages,
|
487 |
+
* based on the request's Accept-Language HTTP header field.
|
488 |
+
* If none of the specified languages is accepted, returns false.
|
489 |
+
*
|
490 |
+
* For more information, or if you have issues or concerns, see accepts.
|
491 |
+
*/
|
492 |
+
acceptsLanguages(): string[];
|
493 |
+
acceptsLanguages(lang: string): string | false;
|
494 |
+
acceptsLanguages(lang: string[]): string | false;
|
495 |
+
acceptsLanguages(...lang: string[]): string | false;
|
496 |
+
|
497 |
+
/**
|
498 |
+
* Parse Range header field, capping to the given `size`.
|
499 |
+
*
|
500 |
+
* Unspecified ranges such as "0-" require knowledge of your resource length. In
|
501 |
+
* the case of a byte range this is of course the total number of bytes.
|
502 |
+
* If the Range header field is not given `undefined` is returned.
|
503 |
+
* If the Range header field is given, return value is a result of range-parser.
|
504 |
+
* See more ./types/range-parser/index.d.ts
|
505 |
+
*
|
506 |
+
* NOTE: remember that ranges are inclusive, so for example "Range: users=0-3"
|
507 |
+
* should respond with 4 users when available, not 3.
|
508 |
+
*/
|
509 |
+
range(size: number, options?: RangeParserOptions): RangeParserRanges | RangeParserResult | undefined;
|
510 |
+
|
511 |
+
/**
|
512 |
+
* Return an array of Accepted media types
|
513 |
+
* ordered from highest quality to lowest.
|
514 |
+
*/
|
515 |
+
accepted: MediaType[];
|
516 |
+
|
517 |
+
/**
|
518 |
+
* @deprecated since 4.11 Use either req.params, req.body or req.query, as applicable.
|
519 |
+
*
|
520 |
+
* Return the value of param `name` when present or `defaultValue`.
|
521 |
+
*
|
522 |
+
* - Checks route placeholders, ex: _/user/:id_
|
523 |
+
* - Checks body params, ex: id=12, {"id":12}
|
524 |
+
* - Checks query string params, ex: ?id=12
|
525 |
+
*
|
526 |
+
* To utilize request bodies, `req.body`
|
527 |
+
* should be an object. This can be done by using
|
528 |
+
* the `connect.bodyParser()` middleware.
|
529 |
+
*/
|
530 |
+
param(name: string, defaultValue?: any): string;
|
531 |
+
|
532 |
+
/**
|
533 |
+
* Check if the incoming request contains the "Content-Type"
|
534 |
+
* header field, and it contains the give mime `type`.
|
535 |
+
*
|
536 |
+
* Examples:
|
537 |
+
*
|
538 |
+
* // With Content-Type: text/html; charset=utf-8
|
539 |
+
* req.is('html');
|
540 |
+
* req.is('text/html');
|
541 |
+
* req.is('text/*');
|
542 |
+
* // => true
|
543 |
+
*
|
544 |
+
* // When Content-Type is application/json
|
545 |
+
* req.is('json');
|
546 |
+
* req.is('application/json');
|
547 |
+
* req.is('application/*');
|
548 |
+
* // => true
|
549 |
+
*
|
550 |
+
* req.is('html');
|
551 |
+
* // => false
|
552 |
+
*/
|
553 |
+
is(type: string | string[]): string | false | null;
|
554 |
+
|
555 |
+
/**
|
556 |
+
* Return the protocol string "http" or "https"
|
557 |
+
* when requested with TLS. When the "trust proxy"
|
558 |
+
* setting is enabled the "X-Forwarded-Proto" header
|
559 |
+
* field will be trusted. If you're running behind
|
560 |
+
* a reverse proxy that supplies https for you this
|
561 |
+
* may be enabled.
|
562 |
+
*/
|
563 |
+
protocol: string;
|
564 |
+
|
565 |
+
/**
|
566 |
+
* Short-hand for:
|
567 |
+
*
|
568 |
+
* req.protocol == 'https'
|
569 |
+
*/
|
570 |
+
secure: boolean;
|
571 |
+
|
572 |
+
/**
|
573 |
+
* Return the remote address, or when
|
574 |
+
* "trust proxy" is `true` return
|
575 |
+
* the upstream addr.
|
576 |
+
*
|
577 |
+
* Value may be undefined if the `req.socket` is destroyed
|
578 |
+
* (for example, if the client disconnected).
|
579 |
+
*/
|
580 |
+
ip: string | undefined;
|
581 |
+
|
582 |
+
/**
|
583 |
+
* When "trust proxy" is `true`, parse
|
584 |
+
* the "X-Forwarded-For" ip address list.
|
585 |
+
*
|
586 |
+
* For example if the value were "client, proxy1, proxy2"
|
587 |
+
* you would receive the array `["client", "proxy1", "proxy2"]`
|
588 |
+
* where "proxy2" is the furthest down-stream.
|
589 |
+
*/
|
590 |
+
ips: string[];
|
591 |
+
|
592 |
+
/**
|
593 |
+
* Return subdomains as an array.
|
594 |
+
*
|
595 |
+
* Subdomains are the dot-separated parts of the host before the main domain of
|
596 |
+
* the app. By default, the domain of the app is assumed to be the last two
|
597 |
+
* parts of the host. This can be changed by setting "subdomain offset".
|
598 |
+
*
|
599 |
+
* For example, if the domain is "tobi.ferrets.example.com":
|
600 |
+
* If "subdomain offset" is not set, req.subdomains is `["ferrets", "tobi"]`.
|
601 |
+
* If "subdomain offset" is 3, req.subdomains is `["tobi"]`.
|
602 |
+
*/
|
603 |
+
subdomains: string[];
|
604 |
+
|
605 |
+
/**
|
606 |
+
* Short-hand for `url.parse(req.url).pathname`.
|
607 |
+
*/
|
608 |
+
path: string;
|
609 |
+
|
610 |
+
/**
|
611 |
+
* Parse the "Host" header field hostname.
|
612 |
+
*/
|
613 |
+
hostname: string;
|
614 |
+
|
615 |
+
/**
|
616 |
+
* @deprecated Use hostname instead.
|
617 |
+
*/
|
618 |
+
host: string;
|
619 |
+
|
620 |
+
/**
|
621 |
+
* Check if the request is fresh, aka
|
622 |
+
* Last-Modified and/or the ETag
|
623 |
+
* still match.
|
624 |
+
*/
|
625 |
+
fresh: boolean;
|
626 |
+
|
627 |
+
/**
|
628 |
+
* Check if the request is stale, aka
|
629 |
+
* "Last-Modified" and / or the "ETag" for the
|
630 |
+
* resource has changed.
|
631 |
+
*/
|
632 |
+
stale: boolean;
|
633 |
+
|
634 |
+
/**
|
635 |
+
* Check if the request was an _XMLHttpRequest_.
|
636 |
+
*/
|
637 |
+
xhr: boolean;
|
638 |
+
|
639 |
+
// body: { username: string; password: string; remember: boolean; title: string; };
|
640 |
+
body: ReqBody;
|
641 |
+
|
642 |
+
// cookies: { string; remember: boolean; };
|
643 |
+
cookies: any;
|
644 |
+
|
645 |
+
method: string;
|
646 |
+
|
647 |
+
params: P;
|
648 |
+
|
649 |
+
query: ReqQuery;
|
650 |
+
|
651 |
+
route: any;
|
652 |
+
|
653 |
+
signedCookies: any;
|
654 |
+
|
655 |
+
originalUrl: string;
|
656 |
+
|
657 |
+
url: string;
|
658 |
+
|
659 |
+
baseUrl: string;
|
660 |
+
|
661 |
+
app: Application;
|
662 |
+
|
663 |
+
/**
|
664 |
+
* After middleware.init executed, Request will contain res and next properties
|
665 |
+
* See: express/lib/middleware/init.js
|
666 |
+
*/
|
667 |
+
res?: Response<ResBody, LocalsObj> | undefined;
|
668 |
+
next?: NextFunction | undefined;
|
669 |
+
}
|
670 |
+
|
671 |
+
export interface MediaType {
|
672 |
+
value: string;
|
673 |
+
quality: number;
|
674 |
+
type: string;
|
675 |
+
subtype: string;
|
676 |
+
}
|
677 |
+
|
678 |
+
export type Send<ResBody = any, T = Response<ResBody>> = (body?: ResBody) => T;
|
679 |
+
|
680 |
+
export interface SendFileOptions extends SendOptions {
|
681 |
+
/** Object containing HTTP headers to serve with the file. */
|
682 |
+
headers?: Record<string, unknown>;
|
683 |
+
}
|
684 |
+
|
685 |
+
export interface DownloadOptions extends SendOptions {
|
686 |
+
/** Object containing HTTP headers to serve with the file. The header `Content-Disposition` will be overridden by the filename argument. */
|
687 |
+
headers?: Record<string, unknown>;
|
688 |
+
}
|
689 |
+
|
690 |
+
export interface Response<
|
691 |
+
ResBody = any,
|
692 |
+
LocalsObj extends Record<string, any> = Record<string, any>,
|
693 |
+
StatusCode extends number = number,
|
694 |
+
> extends http.ServerResponse, Express.Response {
|
695 |
+
/**
|
696 |
+
* Set status `code`.
|
697 |
+
*/
|
698 |
+
status(code: StatusCode): this;
|
699 |
+
|
700 |
+
/**
|
701 |
+
* Set the response HTTP status code to `statusCode` and send its string representation as the response body.
|
702 |
+
* @link http://expressjs.com/4x/api.html#res.sendStatus
|
703 |
+
*
|
704 |
+
* Examples:
|
705 |
+
*
|
706 |
+
* res.sendStatus(200); // equivalent to res.status(200).send('OK')
|
707 |
+
* res.sendStatus(403); // equivalent to res.status(403).send('Forbidden')
|
708 |
+
* res.sendStatus(404); // equivalent to res.status(404).send('Not Found')
|
709 |
+
* res.sendStatus(500); // equivalent to res.status(500).send('Internal Server Error')
|
710 |
+
*/
|
711 |
+
sendStatus(code: StatusCode): this;
|
712 |
+
|
713 |
+
/**
|
714 |
+
* Set Link header field with the given `links`.
|
715 |
+
*
|
716 |
+
* Examples:
|
717 |
+
*
|
718 |
+
* res.links({
|
719 |
+
* next: 'http://api.example.com/users?page=2',
|
720 |
+
* last: 'http://api.example.com/users?page=5'
|
721 |
+
* });
|
722 |
+
*/
|
723 |
+
links(links: any): this;
|
724 |
+
|
725 |
+
/**
|
726 |
+
* Send a response.
|
727 |
+
*
|
728 |
+
* Examples:
|
729 |
+
*
|
730 |
+
* res.send(new Buffer('wahoo'));
|
731 |
+
* res.send({ some: 'json' });
|
732 |
+
* res.send('<p>some html</p>');
|
733 |
+
* res.status(404).send('Sorry, cant find that');
|
734 |
+
*/
|
735 |
+
send: Send<ResBody, this>;
|
736 |
+
|
737 |
+
/**
|
738 |
+
* Send JSON response.
|
739 |
+
*
|
740 |
+
* Examples:
|
741 |
+
*
|
742 |
+
* res.json(null);
|
743 |
+
* res.json({ user: 'tj' });
|
744 |
+
* res.status(500).json('oh noes!');
|
745 |
+
* res.status(404).json('I dont have that');
|
746 |
+
*/
|
747 |
+
json: Send<ResBody, this>;
|
748 |
+
|
749 |
+
/**
|
750 |
+
* Send JSON response with JSONP callback support.
|
751 |
+
*
|
752 |
+
* Examples:
|
753 |
+
*
|
754 |
+
* res.jsonp(null);
|
755 |
+
* res.jsonp({ user: 'tj' });
|
756 |
+
* res.status(500).jsonp('oh noes!');
|
757 |
+
* res.status(404).jsonp('I dont have that');
|
758 |
+
*/
|
759 |
+
jsonp: Send<ResBody, this>;
|
760 |
+
|
761 |
+
/**
|
762 |
+
* Transfer the file at the given `path`.
|
763 |
+
*
|
764 |
+
* Automatically sets the _Content-Type_ response header field.
|
765 |
+
* The callback `fn(err)` is invoked when the transfer is complete
|
766 |
+
* or when an error occurs. Be sure to check `res.headersSent`
|
767 |
+
* if you wish to attempt responding, as the header and some data
|
768 |
+
* may have already been transferred.
|
769 |
+
*
|
770 |
+
* Options:
|
771 |
+
*
|
772 |
+
* - `maxAge` defaulting to 0 (can be string converted by `ms`)
|
773 |
+
* - `root` root directory for relative filenames
|
774 |
+
* - `headers` object of headers to serve with file
|
775 |
+
* - `dotfiles` serve dotfiles, defaulting to false; can be `"allow"` to send them
|
776 |
+
*
|
777 |
+
* Other options are passed along to `send`.
|
778 |
+
*
|
779 |
+
* Examples:
|
780 |
+
*
|
781 |
+
* The following example illustrates how `res.sendFile()` may
|
782 |
+
* be used as an alternative for the `static()` middleware for
|
783 |
+
* dynamic situations. The code backing `res.sendFile()` is actually
|
784 |
+
* the same code, so HTTP cache support etc is identical.
|
785 |
+
*
|
786 |
+
* app.get('/user/:uid/photos/:file', function(req, res){
|
787 |
+
* var uid = req.params.uid
|
788 |
+
* , file = req.params.file;
|
789 |
+
*
|
790 |
+
* req.user.mayViewFilesFrom(uid, function(yes){
|
791 |
+
* if (yes) {
|
792 |
+
* res.sendFile('/uploads/' + uid + '/' + file);
|
793 |
+
* } else {
|
794 |
+
* res.send(403, 'Sorry! you cant see that.');
|
795 |
+
* }
|
796 |
+
* });
|
797 |
+
* });
|
798 |
+
*
|
799 |
+
* @api public
|
800 |
+
*/
|
801 |
+
sendFile(path: string, fn?: Errback): void;
|
802 |
+
sendFile(path: string, options: SendFileOptions, fn?: Errback): void;
|
803 |
+
|
804 |
+
/**
|
805 |
+
* @deprecated Use sendFile instead.
|
806 |
+
*/
|
807 |
+
sendfile(path: string): void;
|
808 |
+
/**
|
809 |
+
* @deprecated Use sendFile instead.
|
810 |
+
*/
|
811 |
+
sendfile(path: string, options: SendFileOptions): void;
|
812 |
+
/**
|
813 |
+
* @deprecated Use sendFile instead.
|
814 |
+
*/
|
815 |
+
sendfile(path: string, fn: Errback): void;
|
816 |
+
/**
|
817 |
+
* @deprecated Use sendFile instead.
|
818 |
+
*/
|
819 |
+
sendfile(path: string, options: SendFileOptions, fn: Errback): void;
|
820 |
+
|
821 |
+
/**
|
822 |
+
* Transfer the file at the given `path` as an attachment.
|
823 |
+
*
|
824 |
+
* Optionally providing an alternate attachment `filename`,
|
825 |
+
* and optional callback `fn(err)`. The callback is invoked
|
826 |
+
* when the data transfer is complete, or when an error has
|
827 |
+
* ocurred. Be sure to check `res.headersSent` if you plan to respond.
|
828 |
+
*
|
829 |
+
* The optional options argument passes through to the underlying
|
830 |
+
* res.sendFile() call, and takes the exact same parameters.
|
831 |
+
*
|
832 |
+
* This method uses `res.sendfile()`.
|
833 |
+
*/
|
834 |
+
download(path: string, fn?: Errback): void;
|
835 |
+
download(path: string, filename: string, fn?: Errback): void;
|
836 |
+
download(path: string, filename: string, options: DownloadOptions, fn?: Errback): void;
|
837 |
+
|
838 |
+
/**
|
839 |
+
* Set _Content-Type_ response header with `type` through `mime.lookup()`
|
840 |
+
* when it does not contain "/", or set the Content-Type to `type` otherwise.
|
841 |
+
*
|
842 |
+
* Examples:
|
843 |
+
*
|
844 |
+
* res.type('.html');
|
845 |
+
* res.type('html');
|
846 |
+
* res.type('json');
|
847 |
+
* res.type('application/json');
|
848 |
+
* res.type('png');
|
849 |
+
*/
|
850 |
+
contentType(type: string): this;
|
851 |
+
|
852 |
+
/**
|
853 |
+
* Set _Content-Type_ response header with `type` through `mime.lookup()`
|
854 |
+
* when it does not contain "/", or set the Content-Type to `type` otherwise.
|
855 |
+
*
|
856 |
+
* Examples:
|
857 |
+
*
|
858 |
+
* res.type('.html');
|
859 |
+
* res.type('html');
|
860 |
+
* res.type('json');
|
861 |
+
* res.type('application/json');
|
862 |
+
* res.type('png');
|
863 |
+
*/
|
864 |
+
type(type: string): this;
|
865 |
+
|
866 |
+
/**
|
867 |
+
* Respond to the Acceptable formats using an `obj`
|
868 |
+
* of mime-type callbacks.
|
869 |
+
*
|
870 |
+
* This method uses `req.accepted`, an array of
|
871 |
+
* acceptable types ordered by their quality values.
|
872 |
+
* When "Accept" is not present the _first_ callback
|
873 |
+
* is invoked, otherwise the first match is used. When
|
874 |
+
* no match is performed the server responds with
|
875 |
+
* 406 "Not Acceptable".
|
876 |
+
*
|
877 |
+
* Content-Type is set for you, however if you choose
|
878 |
+
* you may alter this within the callback using `res.type()`
|
879 |
+
* or `res.set('Content-Type', ...)`.
|
880 |
+
*
|
881 |
+
* res.format({
|
882 |
+
* 'text/plain': function(){
|
883 |
+
* res.send('hey');
|
884 |
+
* },
|
885 |
+
*
|
886 |
+
* 'text/html': function(){
|
887 |
+
* res.send('<p>hey</p>');
|
888 |
+
* },
|
889 |
+
*
|
890 |
+
* 'appliation/json': function(){
|
891 |
+
* res.send({ message: 'hey' });
|
892 |
+
* }
|
893 |
+
* });
|
894 |
+
*
|
895 |
+
* In addition to canonicalized MIME types you may
|
896 |
+
* also use extnames mapped to these types:
|
897 |
+
*
|
898 |
+
* res.format({
|
899 |
+
* text: function(){
|
900 |
+
* res.send('hey');
|
901 |
+
* },
|
902 |
+
*
|
903 |
+
* html: function(){
|
904 |
+
* res.send('<p>hey</p>');
|
905 |
+
* },
|
906 |
+
*
|
907 |
+
* json: function(){
|
908 |
+
* res.send({ message: 'hey' });
|
909 |
+
* }
|
910 |
+
* });
|
911 |
+
*
|
912 |
+
* By default Express passes an `Error`
|
913 |
+
* with a `.status` of 406 to `next(err)`
|
914 |
+
* if a match is not made. If you provide
|
915 |
+
* a `.default` callback it will be invoked
|
916 |
+
* instead.
|
917 |
+
*/
|
918 |
+
format(obj: any): this;
|
919 |
+
|
920 |
+
/**
|
921 |
+
* Set _Content-Disposition_ header to _attachment_ with optional `filename`.
|
922 |
+
*/
|
923 |
+
attachment(filename?: string): this;
|
924 |
+
|
925 |
+
/**
|
926 |
+
* Set header `field` to `val`, or pass
|
927 |
+
* an object of header fields.
|
928 |
+
*
|
929 |
+
* Examples:
|
930 |
+
*
|
931 |
+
* res.set('Foo', ['bar', 'baz']);
|
932 |
+
* res.set('Accept', 'application/json');
|
933 |
+
* res.set({ Accept: 'text/plain', 'X-API-Key': 'tobi' });
|
934 |
+
*
|
935 |
+
* Aliased as `res.header()`.
|
936 |
+
*/
|
937 |
+
set(field: any): this;
|
938 |
+
set(field: string, value?: string | string[]): this;
|
939 |
+
|
940 |
+
header(field: any): this;
|
941 |
+
header(field: string, value?: string | string[]): this;
|
942 |
+
|
943 |
+
// Property indicating if HTTP headers has been sent for the response.
|
944 |
+
headersSent: boolean;
|
945 |
+
|
946 |
+
/** Get value for header `field`. */
|
947 |
+
get(field: string): string | undefined;
|
948 |
+
|
949 |
+
/** Clear cookie `name`. */
|
950 |
+
clearCookie(name: string, options?: CookieOptions): this;
|
951 |
+
|
952 |
+
/**
|
953 |
+
* Set cookie `name` to `val`, with the given `options`.
|
954 |
+
*
|
955 |
+
* Options:
|
956 |
+
*
|
957 |
+
* - `maxAge` max-age in milliseconds, converted to `expires`
|
958 |
+
* - `signed` sign the cookie
|
959 |
+
* - `path` defaults to "/"
|
960 |
+
*
|
961 |
+
* Examples:
|
962 |
+
*
|
963 |
+
* // "Remember Me" for 15 minutes
|
964 |
+
* res.cookie('rememberme', '1', { expires: new Date(Date.now() + 900000), httpOnly: true });
|
965 |
+
*
|
966 |
+
* // save as above
|
967 |
+
* res.cookie('rememberme', '1', { maxAge: 900000, httpOnly: true })
|
968 |
+
*/
|
969 |
+
cookie(name: string, val: string, options: CookieOptions): this;
|
970 |
+
cookie(name: string, val: any, options: CookieOptions): this;
|
971 |
+
cookie(name: string, val: any): this;
|
972 |
+
|
973 |
+
/**
|
974 |
+
* Set the location header to `url`.
|
975 |
+
*
|
976 |
+
* The given `url` can also be the name of a mapped url, for
|
977 |
+
* example by default express supports "back" which redirects
|
978 |
+
* to the _Referrer_ or _Referer_ headers or "/".
|
979 |
+
*
|
980 |
+
* Examples:
|
981 |
+
*
|
982 |
+
* res.location('/foo/bar').;
|
983 |
+
* res.location('http://example.com');
|
984 |
+
* res.location('../login'); // /blog/post/1 -> /blog/login
|
985 |
+
*
|
986 |
+
* Mounting:
|
987 |
+
*
|
988 |
+
* When an application is mounted and `res.location()`
|
989 |
+
* is given a path that does _not_ lead with "/" it becomes
|
990 |
+
* relative to the mount-point. For example if the application
|
991 |
+
* is mounted at "/blog", the following would become "/blog/login".
|
992 |
+
*
|
993 |
+
* res.location('login');
|
994 |
+
*
|
995 |
+
* While the leading slash would result in a location of "/login":
|
996 |
+
*
|
997 |
+
* res.location('/login');
|
998 |
+
*/
|
999 |
+
location(url: string): this;
|
1000 |
+
|
1001 |
+
/**
|
1002 |
+
* Redirect to the given `url` with optional response `status`
|
1003 |
+
* defaulting to 302.
|
1004 |
+
*
|
1005 |
+
* The resulting `url` is determined by `res.location()`, so
|
1006 |
+
* it will play nicely with mounted apps, relative paths,
|
1007 |
+
* `"back"` etc.
|
1008 |
+
*
|
1009 |
+
* Examples:
|
1010 |
+
*
|
1011 |
+
* res.redirect('back');
|
1012 |
+
* res.redirect('/foo/bar');
|
1013 |
+
* res.redirect('http://example.com');
|
1014 |
+
* res.redirect(301, 'http://example.com');
|
1015 |
+
* res.redirect('http://example.com', 301);
|
1016 |
+
* res.redirect('../login'); // /blog/post/1 -> /blog/login
|
1017 |
+
*/
|
1018 |
+
redirect(url: string): void;
|
1019 |
+
redirect(status: number, url: string): void;
|
1020 |
+
/** @deprecated use res.redirect(status, url) instead */
|
1021 |
+
redirect(url: string, status: number): void;
|
1022 |
+
|
1023 |
+
/**
|
1024 |
+
* Render `view` with the given `options` and optional callback `fn`.
|
1025 |
+
* When a callback function is given a response will _not_ be made
|
1026 |
+
* automatically, otherwise a response of _200_ and _text/html_ is given.
|
1027 |
+
*
|
1028 |
+
* Options:
|
1029 |
+
*
|
1030 |
+
* - `cache` boolean hinting to the engine it should cache
|
1031 |
+
* - `filename` filename of the view being rendered
|
1032 |
+
*/
|
1033 |
+
render(view: string, options?: object, callback?: (err: Error, html: string) => void): void;
|
1034 |
+
render(view: string, callback?: (err: Error, html: string) => void): void;
|
1035 |
+
|
1036 |
+
locals: LocalsObj & Locals;
|
1037 |
+
|
1038 |
+
charset: string;
|
1039 |
+
|
1040 |
+
/**
|
1041 |
+
* Adds the field to the Vary response header, if it is not there already.
|
1042 |
+
* Examples:
|
1043 |
+
*
|
1044 |
+
* res.vary('User-Agent').render('docs');
|
1045 |
+
*/
|
1046 |
+
vary(field: string): this;
|
1047 |
+
|
1048 |
+
app: Application;
|
1049 |
+
|
1050 |
+
/**
|
1051 |
+
* Appends the specified value to the HTTP response header field.
|
1052 |
+
* If the header is not already set, it creates the header with the specified value.
|
1053 |
+
* The value parameter can be a string or an array.
|
1054 |
+
*
|
1055 |
+
* Note: calling res.set() after res.append() will reset the previously-set header value.
|
1056 |
+
*
|
1057 |
+
* @since 4.11.0
|
1058 |
+
*/
|
1059 |
+
append(field: string, value?: string[] | string): this;
|
1060 |
+
|
1061 |
+
/**
|
1062 |
+
* After middleware.init executed, Response will contain req property
|
1063 |
+
* See: express/lib/middleware/init.js
|
1064 |
+
*/
|
1065 |
+
req: Request;
|
1066 |
+
}
|
1067 |
+
|
1068 |
+
export interface Handler extends RequestHandler {}
|
1069 |
+
|
1070 |
+
export type RequestParamHandler = (req: Request, res: Response, next: NextFunction, value: any, name: string) => any;
|
1071 |
+
|
1072 |
+
export type ApplicationRequestHandler<T> =
|
1073 |
+
& IRouterHandler<T>
|
1074 |
+
& IRouterMatcher<T>
|
1075 |
+
& ((...handlers: RequestHandlerParams[]) => T);
|
1076 |
+
|
1077 |
+
export interface Application<
|
1078 |
+
LocalsObj extends Record<string, any> = Record<string, any>,
|
1079 |
+
> extends EventEmitter, IRouter, Express.Application {
|
1080 |
+
/**
|
1081 |
+
* Express instance itself is a request handler, which could be invoked without
|
1082 |
+
* third argument.
|
1083 |
+
*/
|
1084 |
+
(req: Request | http.IncomingMessage, res: Response | http.ServerResponse): any;
|
1085 |
+
|
1086 |
+
/**
|
1087 |
+
* Initialize the server.
|
1088 |
+
*
|
1089 |
+
* - setup default configuration
|
1090 |
+
* - setup default middleware
|
1091 |
+
* - setup route reflection methods
|
1092 |
+
*/
|
1093 |
+
init(): void;
|
1094 |
+
|
1095 |
+
/**
|
1096 |
+
* Initialize application configuration.
|
1097 |
+
*/
|
1098 |
+
defaultConfiguration(): void;
|
1099 |
+
|
1100 |
+
/**
|
1101 |
+
* Register the given template engine callback `fn`
|
1102 |
+
* as `ext`.
|
1103 |
+
*
|
1104 |
+
* By default will `require()` the engine based on the
|
1105 |
+
* file extension. For example if you try to render
|
1106 |
+
* a "foo.jade" file Express will invoke the following internally:
|
1107 |
+
*
|
1108 |
+
* app.engine('jade', require('jade').__express);
|
1109 |
+
*
|
1110 |
+
* For engines that do not provide `.__express` out of the box,
|
1111 |
+
* or if you wish to "map" a different extension to the template engine
|
1112 |
+
* you may use this method. For example mapping the EJS template engine to
|
1113 |
+
* ".html" files:
|
1114 |
+
*
|
1115 |
+
* app.engine('html', require('ejs').renderFile);
|
1116 |
+
*
|
1117 |
+
* In this case EJS provides a `.renderFile()` method with
|
1118 |
+
* the same signature that Express expects: `(path, options, callback)`,
|
1119 |
+
* though note that it aliases this method as `ejs.__express` internally
|
1120 |
+
* so if you're using ".ejs" extensions you dont need to do anything.
|
1121 |
+
*
|
1122 |
+
* Some template engines do not follow this convention, the
|
1123 |
+
* [Consolidate.js](https://github.com/visionmedia/consolidate.js)
|
1124 |
+
* library was created to map all of node's popular template
|
1125 |
+
* engines to follow this convention, thus allowing them to
|
1126 |
+
* work seamlessly within Express.
|
1127 |
+
*/
|
1128 |
+
engine(
|
1129 |
+
ext: string,
|
1130 |
+
fn: (path: string, options: object, callback: (e: any, rendered?: string) => void) => void,
|
1131 |
+
): this;
|
1132 |
+
|
1133 |
+
/**
|
1134 |
+
* Assign `setting` to `val`, or return `setting`'s value.
|
1135 |
+
*
|
1136 |
+
* app.set('foo', 'bar');
|
1137 |
+
* app.get('foo');
|
1138 |
+
* // => "bar"
|
1139 |
+
* app.set('foo', ['bar', 'baz']);
|
1140 |
+
* app.get('foo');
|
1141 |
+
* // => ["bar", "baz"]
|
1142 |
+
*
|
1143 |
+
* Mounted servers inherit their parent server's settings.
|
1144 |
+
*/
|
1145 |
+
set(setting: string, val: any): this;
|
1146 |
+
get: ((name: string) => any) & IRouterMatcher<this>;
|
1147 |
+
|
1148 |
+
param(name: string | string[], handler: RequestParamHandler): this;
|
1149 |
+
|
1150 |
+
/**
|
1151 |
+
* Alternatively, you can pass only a callback, in which case you have the opportunity to alter the app.param()
|
1152 |
+
*
|
1153 |
+
* @deprecated since version 4.11
|
1154 |
+
*/
|
1155 |
+
param(callback: (name: string, matcher: RegExp) => RequestParamHandler): this;
|
1156 |
+
|
1157 |
+
/**
|
1158 |
+
* Return the app's absolute pathname
|
1159 |
+
* based on the parent(s) that have
|
1160 |
+
* mounted it.
|
1161 |
+
*
|
1162 |
+
* For example if the application was
|
1163 |
+
* mounted as "/admin", which itself
|
1164 |
+
* was mounted as "/blog" then the
|
1165 |
+
* return value would be "/blog/admin".
|
1166 |
+
*/
|
1167 |
+
path(): string;
|
1168 |
+
|
1169 |
+
/**
|
1170 |
+
* Check if `setting` is enabled (truthy).
|
1171 |
+
*
|
1172 |
+
* app.enabled('foo')
|
1173 |
+
* // => false
|
1174 |
+
*
|
1175 |
+
* app.enable('foo')
|
1176 |
+
* app.enabled('foo')
|
1177 |
+
* // => true
|
1178 |
+
*/
|
1179 |
+
enabled(setting: string): boolean;
|
1180 |
+
|
1181 |
+
/**
|
1182 |
+
* Check if `setting` is disabled.
|
1183 |
+
*
|
1184 |
+
* app.disabled('foo')
|
1185 |
+
* // => true
|
1186 |
+
*
|
1187 |
+
* app.enable('foo')
|
1188 |
+
* app.disabled('foo')
|
1189 |
+
* // => false
|
1190 |
+
*/
|
1191 |
+
disabled(setting: string): boolean;
|
1192 |
+
|
1193 |
+
/** Enable `setting`. */
|
1194 |
+
enable(setting: string): this;
|
1195 |
+
|
1196 |
+
/** Disable `setting`. */
|
1197 |
+
disable(setting: string): this;
|
1198 |
+
|
1199 |
+
/**
|
1200 |
+
* Render the given view `name` name with `options`
|
1201 |
+
* and a callback accepting an error and the
|
1202 |
+
* rendered template string.
|
1203 |
+
*
|
1204 |
+
* Example:
|
1205 |
+
*
|
1206 |
+
* app.render('email', { name: 'Tobi' }, function(err, html){
|
1207 |
+
* // ...
|
1208 |
+
* })
|
1209 |
+
*/
|
1210 |
+
render(name: string, options?: object, callback?: (err: Error, html: string) => void): void;
|
1211 |
+
render(name: string, callback: (err: Error, html: string) => void): void;
|
1212 |
+
|
1213 |
+
/**
|
1214 |
+
* Listen for connections.
|
1215 |
+
*
|
1216 |
+
* A node `http.Server` is returned, with this
|
1217 |
+
* application (which is a `Function`) as its
|
1218 |
+
* callback. If you wish to create both an HTTP
|
1219 |
+
* and HTTPS server you may do so with the "http"
|
1220 |
+
* and "https" modules as shown here:
|
1221 |
+
*
|
1222 |
+
* var http = require('http')
|
1223 |
+
* , https = require('https')
|
1224 |
+
* , express = require('express')
|
1225 |
+
* , app = express();
|
1226 |
+
*
|
1227 |
+
* http.createServer(app).listen(80);
|
1228 |
+
* https.createServer({ ... }, app).listen(443);
|
1229 |
+
*/
|
1230 |
+
listen(port: number, hostname: string, backlog: number, callback?: () => void): http.Server;
|
1231 |
+
listen(port: number, hostname: string, callback?: () => void): http.Server;
|
1232 |
+
listen(port: number, callback?: () => void): http.Server;
|
1233 |
+
listen(callback?: () => void): http.Server;
|
1234 |
+
listen(path: string, callback?: () => void): http.Server;
|
1235 |
+
listen(handle: any, listeningListener?: () => void): http.Server;
|
1236 |
+
|
1237 |
+
router: string;
|
1238 |
+
|
1239 |
+
settings: any;
|
1240 |
+
|
1241 |
+
resource: any;
|
1242 |
+
|
1243 |
+
map: any;
|
1244 |
+
|
1245 |
+
locals: LocalsObj & Locals;
|
1246 |
+
|
1247 |
+
/**
|
1248 |
+
* The app.routes object houses all of the routes defined mapped by the
|
1249 |
+
* associated HTTP verb. This object may be used for introspection
|
1250 |
+
* capabilities, for example Express uses this internally not only for
|
1251 |
+
* routing but to provide default OPTIONS behaviour unless app.options()
|
1252 |
+
* is used. Your application or framework may also remove routes by
|
1253 |
+
* simply by removing them from this object.
|
1254 |
+
*/
|
1255 |
+
routes: any;
|
1256 |
+
|
1257 |
+
/**
|
1258 |
+
* Used to get all registered routes in Express Application
|
1259 |
+
*/
|
1260 |
+
_router: any;
|
1261 |
+
|
1262 |
+
use: ApplicationRequestHandler<this>;
|
1263 |
+
|
1264 |
+
/**
|
1265 |
+
* The mount event is fired on a sub-app, when it is mounted on a parent app.
|
1266 |
+
* The parent app is passed to the callback function.
|
1267 |
+
*
|
1268 |
+
* NOTE:
|
1269 |
+
* Sub-apps will:
|
1270 |
+
* - Not inherit the value of settings that have a default value. You must set the value in the sub-app.
|
1271 |
+
* - Inherit the value of settings with no default value.
|
1272 |
+
*/
|
1273 |
+
on: (event: string, callback: (parent: Application) => void) => this;
|
1274 |
+
|
1275 |
+
/**
|
1276 |
+
* The app.mountpath property contains one or more path patterns on which a sub-app was mounted.
|
1277 |
+
*/
|
1278 |
+
mountpath: string | string[];
|
1279 |
+
}
|
1280 |
+
|
1281 |
+
export interface Express extends Application {
|
1282 |
+
request: Request;
|
1283 |
+
response: Response;
|
1284 |
+
}
|
backend/node_modules/@types/express-serve-static-core/package.json
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "@types/express-serve-static-core",
|
3 |
+
"version": "4.19.0",
|
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",
|
7 |
+
"contributors": [
|
8 |
+
{
|
9 |
+
"name": "Boris Yankov",
|
10 |
+
"githubUsername": "borisyankov",
|
11 |
+
"url": "https://github.com/borisyankov"
|
12 |
+
},
|
13 |
+
{
|
14 |
+
"name": "Satana Charuwichitratana",
|
15 |
+
"githubUsername": "micksatana",
|
16 |
+
"url": "https://github.com/micksatana"
|
17 |
+
},
|
18 |
+
{
|
19 |
+
"name": "Sami Jaber",
|
20 |
+
"githubUsername": "samijaber",
|
21 |
+
"url": "https://github.com/samijaber"
|
22 |
+
},
|
23 |
+
{
|
24 |
+
"name": "Jose Luis Leon",
|
25 |
+
"githubUsername": "JoseLion",
|
26 |
+
"url": "https://github.com/JoseLion"
|
27 |
+
},
|
28 |
+
{
|
29 |
+
"name": "David Stephens",
|
30 |
+
"githubUsername": "dwrss",
|
31 |
+
"url": "https://github.com/dwrss"
|
32 |
+
},
|
33 |
+
{
|
34 |
+
"name": "Shin Ando",
|
35 |
+
"githubUsername": "andoshin11",
|
36 |
+
"url": "https://github.com/andoshin11"
|
37 |
+
}
|
38 |
+
],
|
39 |
+
"main": "",
|
40 |
+
"types": "index.d.ts",
|
41 |
+
"repository": {
|
42 |
+
"type": "git",
|
43 |
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
44 |
+
"directory": "types/express-serve-static-core"
|
45 |
+
},
|
46 |
+
"scripts": {},
|
47 |
+
"dependencies": {
|
48 |
+
"@types/node": "*",
|
49 |
+
"@types/qs": "*",
|
50 |
+
"@types/range-parser": "*",
|
51 |
+
"@types/send": "*"
|
52 |
+
},
|
53 |
+
"typesPublisherContentHash": "a69ff76a4af51a72b9c21aef5507a22ae657992a35a887436806eeedff4c5348",
|
54 |
+
"typeScriptVersion": "4.7"
|
55 |
+
}
|
backend/node_modules/@types/express/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
|
backend/node_modules/@types/express/README.md
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Installation
|
2 |
+
> `npm install --save @types/express`
|
3 |
+
|
4 |
+
# Summary
|
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: Tue, 07 Nov 2023 03:09:36 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), [China Medical University Hospital](https://github.com/CMUH), [Puneet Arora](https://github.com/puneetar), and [Dylan Frankland](https://github.com/dfrankland).
|
backend/node_modules/@types/express/index.d.ts
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* =================== USAGE ===================
|
2 |
+
|
3 |
+
import express = require("express");
|
4 |
+
var app = express();
|
5 |
+
|
6 |
+
=============================================== */
|
7 |
+
|
8 |
+
/// <reference types="express-serve-static-core" />
|
9 |
+
/// <reference types="serve-static" />
|
10 |
+
|
11 |
+
import * as bodyParser from "body-parser";
|
12 |
+
import * as core from "express-serve-static-core";
|
13 |
+
import * as qs from "qs";
|
14 |
+
import * as serveStatic from "serve-static";
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Creates an Express application. The express() function is a top-level function exported by the express module.
|
18 |
+
*/
|
19 |
+
declare function e(): core.Express;
|
20 |
+
|
21 |
+
declare namespace e {
|
22 |
+
/**
|
23 |
+
* This is a built-in middleware function in Express. It parses incoming requests with JSON payloads and is based on body-parser.
|
24 |
+
* @since 4.16.0
|
25 |
+
*/
|
26 |
+
var json: typeof bodyParser.json;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* This is a built-in middleware function in Express. It parses incoming requests with Buffer payloads and is based on body-parser.
|
30 |
+
* @since 4.17.0
|
31 |
+
*/
|
32 |
+
var raw: typeof bodyParser.raw;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* This is a built-in middleware function in Express. It parses incoming requests with text payloads and is based on body-parser.
|
36 |
+
* @since 4.17.0
|
37 |
+
*/
|
38 |
+
var text: typeof bodyParser.text;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* These are the exposed prototypes.
|
42 |
+
*/
|
43 |
+
var application: Application;
|
44 |
+
var request: Request;
|
45 |
+
var response: Response;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* This is a built-in middleware function in Express. It serves static files and is based on serve-static.
|
49 |
+
*/
|
50 |
+
var static: serveStatic.RequestHandlerConstructor<Response>;
|
51 |
+
|
52 |
+
/**
|
53 |
+
* This is a built-in middleware function in Express. It parses incoming requests with urlencoded payloads and is based on body-parser.
|
54 |
+
* @since 4.16.0
|
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 {
|
66 |
+
/**
|
67 |
+
* Enable case sensitivity.
|
68 |
+
*/
|
69 |
+
caseSensitive?: boolean | undefined;
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Preserve the req.params values from the parent router.
|
73 |
+
* If the parent and the child have conflicting param names, the child’s value take precedence.
|
74 |
+
*
|
75 |
+
* @default false
|
76 |
+
* @since 4.5.0
|
77 |
+
*/
|
78 |
+
mergeParams?: boolean | undefined;
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Enable strict routing.
|
82 |
+
*/
|
83 |
+
strict?: boolean | undefined;
|
84 |
+
}
|
85 |
+
|
86 |
+
interface Application extends core.Application {}
|
87 |
+
interface CookieOptions extends core.CookieOptions {}
|
88 |
+
interface Errback extends core.Errback {}
|
89 |
+
interface ErrorRequestHandler<
|
90 |
+
P = core.ParamsDictionary,
|
91 |
+
ResBody = any,
|
92 |
+
ReqBody = any,
|
93 |
+
ReqQuery = core.Query,
|
94 |
+
Locals extends Record<string, any> = Record<string, any>,
|
95 |
+
> extends core.ErrorRequestHandler<P, ResBody, ReqBody, ReqQuery, Locals> {}
|
96 |
+
interface Express extends core.Express {}
|
97 |
+
interface Handler extends core.Handler {}
|
98 |
+
interface IRoute extends core.IRoute {}
|
99 |
+
interface IRouter extends core.IRouter {}
|
100 |
+
interface IRouterHandler<T> extends core.IRouterHandler<T> {}
|
101 |
+
interface IRouterMatcher<T> extends core.IRouterMatcher<T> {}
|
102 |
+
interface MediaType extends core.MediaType {}
|
103 |
+
interface NextFunction extends core.NextFunction {}
|
104 |
+
interface Locals extends core.Locals {}
|
105 |
+
interface Request<
|
106 |
+
P = core.ParamsDictionary,
|
107 |
+
ResBody = any,
|
108 |
+
ReqBody = any,
|
109 |
+
ReqQuery = core.Query,
|
110 |
+
Locals extends Record<string, any> = Record<string, any>,
|
111 |
+
> extends core.Request<P, ResBody, ReqBody, ReqQuery, Locals> {}
|
112 |
+
interface RequestHandler<
|
113 |
+
P = core.ParamsDictionary,
|
114 |
+
ResBody = any,
|
115 |
+
ReqBody = any,
|
116 |
+
ReqQuery = core.Query,
|
117 |
+
Locals extends Record<string, any> = Record<string, any>,
|
118 |
+
> extends core.RequestHandler<P, ResBody, ReqBody, ReqQuery, Locals> {}
|
119 |
+
interface RequestParamHandler extends core.RequestParamHandler {}
|
120 |
+
interface Response<
|
121 |
+
ResBody = any,
|
122 |
+
Locals extends Record<string, any> = Record<string, any>,
|
123 |
+
> extends core.Response<ResBody, Locals> {}
|
124 |
+
interface Router extends core.Router {}
|
125 |
+
interface Send extends core.Send {}
|
126 |
+
}
|
127 |
+
|
128 |
+
export = e;
|
backend/node_modules/@types/express/package.json
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "@types/express",
|
3 |
+
"version": "4.17.21",
|
4 |
+
"description": "TypeScript definitions for express",
|
5 |
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express",
|
6 |
+
"license": "MIT",
|
7 |
+
"contributors": [
|
8 |
+
{
|
9 |
+
"name": "Boris Yankov",
|
10 |
+
"githubUsername": "borisyankov",
|
11 |
+
"url": "https://github.com/borisyankov"
|
12 |
+
},
|
13 |
+
{
|
14 |
+
"name": "China Medical University Hospital",
|
15 |
+
"githubUsername": "CMUH",
|
16 |
+
"url": "https://github.com/CMUH"
|
17 |
+
},
|
18 |
+
{
|
19 |
+
"name": "Puneet Arora",
|
20 |
+
"githubUsername": "puneetar",
|
21 |
+
"url": "https://github.com/puneetar"
|
22 |
+
},
|
23 |
+
{
|
24 |
+
"name": "Dylan Frankland",
|
25 |
+
"githubUsername": "dfrankland",
|
26 |
+
"url": "https://github.com/dfrankland"
|
27 |
+
}
|
28 |
+
],
|
29 |
+
"main": "",
|
30 |
+
"types": "index.d.ts",
|
31 |
+
"repository": {
|
32 |
+
"type": "git",
|
33 |
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
34 |
+
"directory": "types/express"
|
35 |
+
},
|
36 |
+
"scripts": {},
|
37 |
+
"dependencies": {
|
38 |
+
"@types/body-parser": "*",
|
39 |
+
"@types/express-serve-static-core": "^4.17.33",
|
40 |
+
"@types/qs": "*",
|
41 |
+
"@types/serve-static": "*"
|
42 |
+
},
|
43 |
+
"typesPublisherContentHash": "fa18ce9be07653182e2674f9a13cf8347ffb270031a7a8d22ba0e785bbc16ce4",
|
44 |
+
"typeScriptVersion": "4.5"
|
45 |
+
}
|
backend/node_modules/@types/http-errors/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
|
backend/node_modules/@types/http-errors/README.md
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Installation
|
2 |
+
> `npm install --save @types/http-errors`
|
3 |
+
|
4 |
+
# Summary
|
5 |
+
This package contains type definitions for http-errors (https://github.com/jshttp/http-errors).
|
6 |
+
|
7 |
+
# Details
|
8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/http-errors.
|
9 |
+
|
10 |
+
### Additional Details
|
11 |
+
* Last updated: Tue, 07 Nov 2023 03:09:37 GMT
|
12 |
+
* Dependencies: none
|
13 |
+
|
14 |
+
# Credits
|
15 |
+
These definitions were written by [Tanguy Krotoff](https://github.com/tkrotoff), and [BendingBender](https://github.com/BendingBender).
|
backend/node_modules/@types/http-errors/index.d.ts
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
export = createHttpError;
|
2 |
+
|
3 |
+
declare const createHttpError: createHttpError.CreateHttpError & createHttpError.NamedConstructors & {
|
4 |
+
isHttpError: createHttpError.IsHttpError;
|
5 |
+
};
|
6 |
+
|
7 |
+
declare namespace createHttpError {
|
8 |
+
interface HttpError<N extends number = number> extends Error {
|
9 |
+
status: N;
|
10 |
+
statusCode: N;
|
11 |
+
expose: boolean;
|
12 |
+
headers?: {
|
13 |
+
[key: string]: string;
|
14 |
+
} | undefined;
|
15 |
+
[key: string]: any;
|
16 |
+
}
|
17 |
+
|
18 |
+
type UnknownError = Error | string | { [key: string]: any };
|
19 |
+
|
20 |
+
interface HttpErrorConstructor<N extends number = number> {
|
21 |
+
(msg?: string): HttpError<N>;
|
22 |
+
new(msg?: string): HttpError<N>;
|
23 |
+
}
|
24 |
+
|
25 |
+
interface CreateHttpError {
|
26 |
+
<N extends number = number>(arg: N, ...rest: UnknownError[]): HttpError<N>;
|
27 |
+
(...rest: UnknownError[]): HttpError;
|
28 |
+
}
|
29 |
+
|
30 |
+
type IsHttpError = (error: unknown) => error is HttpError;
|
31 |
+
|
32 |
+
type NamedConstructors =
|
33 |
+
& {
|
34 |
+
HttpError: HttpErrorConstructor;
|
35 |
+
}
|
36 |
+
& Record<"BadRequest" | "400", HttpErrorConstructor<400>>
|
37 |
+
& Record<"Unauthorized" | "401", HttpErrorConstructor<401>>
|
38 |
+
& Record<"PaymentRequired" | "402", HttpErrorConstructor<402>>
|
39 |
+
& Record<"Forbidden" | "403", HttpErrorConstructor<403>>
|
40 |
+
& Record<"NotFound" | "404", HttpErrorConstructor<404>>
|
41 |
+
& Record<"MethodNotAllowed" | "405", HttpErrorConstructor<405>>
|
42 |
+
& Record<"NotAcceptable" | "406", HttpErrorConstructor<406>>
|
43 |
+
& Record<"ProxyAuthenticationRequired" | "407", HttpErrorConstructor<407>>
|
44 |
+
& Record<"RequestTimeout" | "408", HttpErrorConstructor<408>>
|
45 |
+
& Record<"Conflict" | "409", HttpErrorConstructor<409>>
|
46 |
+
& Record<"Gone" | "410", HttpErrorConstructor<410>>
|
47 |
+
& Record<"LengthRequired" | "411", HttpErrorConstructor<411>>
|
48 |
+
& Record<"PreconditionFailed" | "412", HttpErrorConstructor<412>>
|
49 |
+
& Record<"PayloadTooLarge" | "413", HttpErrorConstructor<413>>
|
50 |
+
& Record<"URITooLong" | "414", HttpErrorConstructor<414>>
|
51 |
+
& Record<"UnsupportedMediaType" | "415", HttpErrorConstructor<415>>
|
52 |
+
& Record<"RangeNotSatisfiable" | "416", HttpErrorConstructor<416>>
|
53 |
+
& Record<"ExpectationFailed" | "417", HttpErrorConstructor<417>>
|
54 |
+
& Record<"ImATeapot" | "418", HttpErrorConstructor<418>>
|
55 |
+
& Record<"MisdirectedRequest" | "421", HttpErrorConstructor<421>>
|
56 |
+
& Record<"UnprocessableEntity" | "422", HttpErrorConstructor<422>>
|
57 |
+
& Record<"Locked" | "423", HttpErrorConstructor<423>>
|
58 |
+
& Record<"FailedDependency" | "424", HttpErrorConstructor<424>>
|
59 |
+
& Record<"TooEarly" | "425", HttpErrorConstructor<425>>
|
60 |
+
& Record<"UpgradeRequired" | "426", HttpErrorConstructor<426>>
|
61 |
+
& Record<"PreconditionRequired" | "428", HttpErrorConstructor<428>>
|
62 |
+
& Record<"TooManyRequests" | "429", HttpErrorConstructor<429>>
|
63 |
+
& Record<"RequestHeaderFieldsTooLarge" | "431", HttpErrorConstructor<431>>
|
64 |
+
& Record<"UnavailableForLegalReasons" | "451", HttpErrorConstructor<451>>
|
65 |
+
& Record<"InternalServerError" | "500", HttpErrorConstructor<500>>
|
66 |
+
& Record<"NotImplemented" | "501", HttpErrorConstructor<501>>
|
67 |
+
& Record<"BadGateway" | "502", HttpErrorConstructor<502>>
|
68 |
+
& Record<"ServiceUnavailable" | "503", HttpErrorConstructor<503>>
|
69 |
+
& Record<"GatewayTimeout" | "504", HttpErrorConstructor<504>>
|
70 |
+
& Record<"HTTPVersionNotSupported" | "505", HttpErrorConstructor<505>>
|
71 |
+
& Record<"VariantAlsoNegotiates" | "506", HttpErrorConstructor<506>>
|
72 |
+
& Record<"InsufficientStorage" | "507", HttpErrorConstructor<507>>
|
73 |
+
& Record<"LoopDetected" | "508", HttpErrorConstructor<508>>
|
74 |
+
& Record<"BandwidthLimitExceeded" | "509", HttpErrorConstructor<509>>
|
75 |
+
& Record<"NotExtended" | "510", HttpErrorConstructor<510>>
|
76 |
+
& Record<"NetworkAuthenticationRequire" | "511", HttpErrorConstructor<511>>;
|
77 |
+
}
|
backend/node_modules/@types/http-errors/package.json
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "@types/http-errors",
|
3 |
+
"version": "2.0.4",
|
4 |
+
"description": "TypeScript definitions for http-errors",
|
5 |
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/http-errors",
|
6 |
+
"license": "MIT",
|
7 |
+
"contributors": [
|
8 |
+
{
|
9 |
+
"name": "Tanguy Krotoff",
|
10 |
+
"githubUsername": "tkrotoff",
|
11 |
+
"url": "https://github.com/tkrotoff"
|
12 |
+
},
|
13 |
+
{
|
14 |
+
"name": "BendingBender",
|
15 |
+
"githubUsername": "BendingBender",
|
16 |
+
"url": "https://github.com/BendingBender"
|
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/http-errors"
|
25 |
+
},
|
26 |
+
"scripts": {},
|
27 |
+
"dependencies": {},
|
28 |
+
"typesPublisherContentHash": "06e33723b60f818facd3b7dd2025f043142fb7c56ab4832babafeb9470f2086f",
|
29 |
+
"typeScriptVersion": "4.5"
|
30 |
+
}
|
backend/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
|
backend/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 |
+
}
|
backend/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).
|
backend/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;
|
backend/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;
|
backend/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 |
+
}
|
backend/node_modules/@types/multer/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
|
backend/node_modules/@types/multer/README.md
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Installation
|
2 |
+
> `npm install --save @types/multer`
|
3 |
+
|
4 |
+
# Summary
|
5 |
+
This package contains type definitions for multer (https://github.com/expressjs/multer).
|
6 |
+
|
7 |
+
# Details
|
8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/multer.
|
9 |
+
|
10 |
+
### Additional Details
|
11 |
+
* Last updated: Mon, 20 Nov 2023 23:36:24 GMT
|
12 |
+
* Dependencies: [@types/express](https://npmjs.com/package/@types/express)
|
13 |
+
|
14 |
+
# Credits
|
15 |
+
These definitions were written by [jt000](https://github.com/jt000), [vilicvane](https://github.com/vilic), [David Broder-Rodgers](https://github.com/DavidBR-SW), [Michael Ledin](https://github.com/mxl), [HyunSeob Lee](https://github.com/hyunseob), [Pierre Tchuente](https://github.com/PierreTchuente), [Oliver Emery](https://github.com/thrymgjol), and [Piotr Błażejewicz](https://github.com/peterblazejewicz).
|
backend/node_modules/@types/multer/index.d.ts
ADDED
@@ -0,0 +1,316 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Request, RequestHandler } from "express";
|
2 |
+
import { Readable } from "stream";
|
3 |
+
|
4 |
+
declare global {
|
5 |
+
namespace Express {
|
6 |
+
namespace Multer {
|
7 |
+
/** Object containing file metadata and access information. */
|
8 |
+
interface File {
|
9 |
+
/** Name of the form field associated with this file. */
|
10 |
+
fieldname: string;
|
11 |
+
/** Name of the file on the uploader's computer. */
|
12 |
+
originalname: string;
|
13 |
+
/**
|
14 |
+
* Value of the `Content-Transfer-Encoding` header for this file.
|
15 |
+
* @deprecated since July 2015
|
16 |
+
* @see RFC 7578, Section 4.7
|
17 |
+
*/
|
18 |
+
encoding: string;
|
19 |
+
/** Value of the `Content-Type` header for this file. */
|
20 |
+
mimetype: string;
|
21 |
+
/** Size of the file in bytes. */
|
22 |
+
size: number;
|
23 |
+
/**
|
24 |
+
* A readable stream of this file. Only available to the `_handleFile`
|
25 |
+
* callback for custom `StorageEngine`s.
|
26 |
+
*/
|
27 |
+
stream: Readable;
|
28 |
+
/** `DiskStorage` only: Directory to which this file has been uploaded. */
|
29 |
+
destination: string;
|
30 |
+
/** `DiskStorage` only: Name of this file within `destination`. */
|
31 |
+
filename: string;
|
32 |
+
/** `DiskStorage` only: Full path to the uploaded file. */
|
33 |
+
path: string;
|
34 |
+
/** `MemoryStorage` only: A Buffer containing the entire file. */
|
35 |
+
buffer: Buffer;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
interface Request {
|
40 |
+
/** `Multer.File` object populated by `single()` middleware. */
|
41 |
+
file?: Multer.File | undefined;
|
42 |
+
/**
|
43 |
+
* Array or dictionary of `Multer.File` object populated by `array()`,
|
44 |
+
* `fields()`, and `any()` middleware.
|
45 |
+
*/
|
46 |
+
files?:
|
47 |
+
| {
|
48 |
+
[fieldname: string]: Multer.File[];
|
49 |
+
}
|
50 |
+
| Multer.File[]
|
51 |
+
| undefined;
|
52 |
+
}
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Returns a Multer instance that provides several methods for generating
|
58 |
+
* middleware that process files uploaded in `multipart/form-data` format.
|
59 |
+
*
|
60 |
+
* The `StorageEngine` specified in `storage` will be used to store files. If
|
61 |
+
* `storage` is not set and `dest` is, files will be stored in `dest` on the
|
62 |
+
* local file system with random names. If neither are set, files will be stored
|
63 |
+
* in memory.
|
64 |
+
*
|
65 |
+
* In addition to files, all generated middleware process all text fields in
|
66 |
+
* the request. For each non-file field, the `Request.body` object will be
|
67 |
+
* populated with an entry mapping the field name to its string value, or array
|
68 |
+
* of string values if multiple fields share the same name.
|
69 |
+
*/
|
70 |
+
declare function multer(options?: multer.Options): multer.Multer;
|
71 |
+
|
72 |
+
declare namespace multer {
|
73 |
+
/**
|
74 |
+
* @see {@link https://github.com/expressjs/multer#api}
|
75 |
+
*/
|
76 |
+
interface Multer {
|
77 |
+
/**
|
78 |
+
* Returns middleware that processes a single file associated with the
|
79 |
+
* given form field.
|
80 |
+
*
|
81 |
+
* The `Request` object will be populated with a `file` object containing
|
82 |
+
* information about the processed file.
|
83 |
+
*
|
84 |
+
* @param fieldName Name of the multipart form field to process.
|
85 |
+
*/
|
86 |
+
single(fieldName: string): RequestHandler;
|
87 |
+
/**
|
88 |
+
* Returns middleware that processes multiple files sharing the same field
|
89 |
+
* name.
|
90 |
+
*
|
91 |
+
* The `Request` object will be populated with a `files` array containing
|
92 |
+
* an information object for each processed file.
|
93 |
+
*
|
94 |
+
* @param fieldName Shared name of the multipart form fields to process.
|
95 |
+
* @param maxCount Optional. Maximum number of files to process. (default: Infinity)
|
96 |
+
* @throws `MulterError('LIMIT_UNEXPECTED_FILE')` if more than `maxCount` files are associated with `fieldName`
|
97 |
+
*/
|
98 |
+
array(fieldName: string, maxCount?: number): RequestHandler;
|
99 |
+
/**
|
100 |
+
* Returns middleware that processes multiple files associated with the
|
101 |
+
* given form fields.
|
102 |
+
*
|
103 |
+
* The `Request` object will be populated with a `files` object which
|
104 |
+
* maps each field name to an array of the associated file information
|
105 |
+
* objects.
|
106 |
+
*
|
107 |
+
* @param fields Array of `Field` objects describing multipart form fields to process.
|
108 |
+
* @throws `MulterError('LIMIT_UNEXPECTED_FILE')` if more than `maxCount` files are associated with `fieldName` for any field.
|
109 |
+
*/
|
110 |
+
fields(fields: readonly Field[]): RequestHandler;
|
111 |
+
/**
|
112 |
+
* Returns middleware that processes all files contained in the multipart
|
113 |
+
* request.
|
114 |
+
*
|
115 |
+
* The `Request` object will be populated with a `files` array containing
|
116 |
+
* an information object for each processed file.
|
117 |
+
*/
|
118 |
+
any(): RequestHandler;
|
119 |
+
/**
|
120 |
+
* Returns middleware that accepts only non-file multipart form fields.
|
121 |
+
*
|
122 |
+
* @throws `MulterError('LIMIT_UNEXPECTED_FILE')` if any file is encountered.
|
123 |
+
*/
|
124 |
+
none(): RequestHandler;
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Returns a `StorageEngine` implementation configured to store files on
|
129 |
+
* the local file system.
|
130 |
+
*
|
131 |
+
* A string or function may be specified to determine the destination
|
132 |
+
* directory, and a function to determine filenames. If no options are set,
|
133 |
+
* files will be stored in the system's temporary directory with random 32
|
134 |
+
* character filenames.
|
135 |
+
*/
|
136 |
+
function diskStorage(options: DiskStorageOptions): StorageEngine;
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Returns a `StorageEngine` implementation configured to store files in
|
140 |
+
* memory as `Buffer` objects.
|
141 |
+
*/
|
142 |
+
function memoryStorage(): StorageEngine;
|
143 |
+
|
144 |
+
type ErrorCode =
|
145 |
+
| "LIMIT_PART_COUNT"
|
146 |
+
| "LIMIT_FILE_SIZE"
|
147 |
+
| "LIMIT_FILE_COUNT"
|
148 |
+
| "LIMIT_FIELD_KEY"
|
149 |
+
| "LIMIT_FIELD_VALUE"
|
150 |
+
| "LIMIT_FIELD_COUNT"
|
151 |
+
| "LIMIT_UNEXPECTED_FILE";
|
152 |
+
|
153 |
+
class MulterError extends Error {
|
154 |
+
constructor(code: ErrorCode, field?: string);
|
155 |
+
/** Name of the MulterError constructor. */
|
156 |
+
name: string;
|
157 |
+
/** Identifying error code. */
|
158 |
+
code: ErrorCode;
|
159 |
+
/** Descriptive error message. */
|
160 |
+
message: string;
|
161 |
+
/** Name of the multipart form field associated with this error. */
|
162 |
+
field?: string | undefined;
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* a function to control which files should be uploaded and which should be skipped
|
167 |
+
* pass a boolean to indicate if the file should be accepted
|
168 |
+
* pass an error if something goes wrong
|
169 |
+
*/
|
170 |
+
interface FileFilterCallback {
|
171 |
+
(error: Error): void;
|
172 |
+
(error: null, acceptFile: boolean): void;
|
173 |
+
}
|
174 |
+
|
175 |
+
/** Options for initializing a Multer instance. */
|
176 |
+
interface Options {
|
177 |
+
/**
|
178 |
+
* A `StorageEngine` responsible for processing files uploaded via Multer.
|
179 |
+
* Takes precedence over `dest`.
|
180 |
+
*/
|
181 |
+
storage?: StorageEngine | undefined;
|
182 |
+
/**
|
183 |
+
* The destination directory for uploaded files. If `storage` is not set
|
184 |
+
* and `dest` is, Multer will create a `DiskStorage` instance configured
|
185 |
+
* to store files at `dest` with random filenames.
|
186 |
+
*
|
187 |
+
* Ignored if `storage` is set.
|
188 |
+
*/
|
189 |
+
dest?: string | undefined;
|
190 |
+
/**
|
191 |
+
* An object specifying various limits on incoming data. This object is
|
192 |
+
* passed to Busboy directly, and the details of properties can be found
|
193 |
+
* at https://github.com/mscdex/busboy#busboy-methods.
|
194 |
+
*/
|
195 |
+
limits?: {
|
196 |
+
/** Maximum size of each form field name in bytes. (Default: 100) */
|
197 |
+
fieldNameSize?: number | undefined;
|
198 |
+
/** Maximum size of each form field value in bytes. (Default: 1048576) */
|
199 |
+
fieldSize?: number | undefined;
|
200 |
+
/** Maximum number of non-file form fields. (Default: Infinity) */
|
201 |
+
fields?: number | undefined;
|
202 |
+
/** Maximum size of each file in bytes. (Default: Infinity) */
|
203 |
+
fileSize?: number | undefined;
|
204 |
+
/** Maximum number of file fields. (Default: Infinity) */
|
205 |
+
files?: number | undefined;
|
206 |
+
/** Maximum number of parts (non-file fields + files). (Default: Infinity) */
|
207 |
+
parts?: number | undefined;
|
208 |
+
/** Maximum number of headers. (Default: 2000) */
|
209 |
+
headerPairs?: number | undefined;
|
210 |
+
} | undefined;
|
211 |
+
/** Preserve the full path of the original filename rather than the basename. (Default: false) */
|
212 |
+
preservePath?: boolean | undefined;
|
213 |
+
/**
|
214 |
+
* Optional function to control which files are uploaded. This is called
|
215 |
+
* for every file that is processed.
|
216 |
+
*
|
217 |
+
* @param req The Express `Request` object.
|
218 |
+
* @param file Object containing information about the processed file.
|
219 |
+
* @param callback a function to control which files should be uploaded and which should be skipped.
|
220 |
+
*/
|
221 |
+
fileFilter?(
|
222 |
+
req: Request,
|
223 |
+
file: Express.Multer.File,
|
224 |
+
callback: FileFilterCallback,
|
225 |
+
): void;
|
226 |
+
}
|
227 |
+
|
228 |
+
/**
|
229 |
+
* Implementations of this interface are responsible for storing files
|
230 |
+
* encountered by Multer and returning information on how to access them
|
231 |
+
* once stored. Implementations must also provide a method for removing
|
232 |
+
* files in the event that an error occurs.
|
233 |
+
*/
|
234 |
+
interface StorageEngine {
|
235 |
+
/**
|
236 |
+
* Store the file described by `file`, then invoke the callback with
|
237 |
+
* information about the stored file.
|
238 |
+
*
|
239 |
+
* File contents are available as a stream via `file.stream`. Information
|
240 |
+
* passed to the callback will be merged with `file` for subsequent
|
241 |
+
* middleware.
|
242 |
+
*
|
243 |
+
* @param req The Express `Request` object.
|
244 |
+
* @param file Object with `stream`, `fieldname`, `originalname`, `encoding`, and `mimetype` defined.
|
245 |
+
* @param callback Callback to specify file information.
|
246 |
+
*/
|
247 |
+
_handleFile(
|
248 |
+
req: Request,
|
249 |
+
file: Express.Multer.File,
|
250 |
+
callback: (error?: any, info?: Partial<Express.Multer.File>) => void,
|
251 |
+
): void;
|
252 |
+
/**
|
253 |
+
* Remove the file described by `file`, then invoke the callback with.
|
254 |
+
*
|
255 |
+
* `file` contains all the properties available to `_handleFile`, as
|
256 |
+
* well as those returned by `_handleFile`.
|
257 |
+
*
|
258 |
+
* @param req The Express `Request` object.
|
259 |
+
* @param file Object containing information about the processed file.
|
260 |
+
* @param callback Callback to indicate completion.
|
261 |
+
*/
|
262 |
+
_removeFile(
|
263 |
+
req: Request,
|
264 |
+
file: Express.Multer.File,
|
265 |
+
callback: (error: Error | null) => void,
|
266 |
+
): void;
|
267 |
+
}
|
268 |
+
|
269 |
+
interface DiskStorageOptions {
|
270 |
+
/**
|
271 |
+
* A string or function that determines the destination path for uploaded
|
272 |
+
* files. If a string is passed and the directory does not exist, Multer
|
273 |
+
* attempts to create it recursively. If neither a string or a function
|
274 |
+
* is passed, the destination defaults to `os.tmpdir()`.
|
275 |
+
*
|
276 |
+
* @param req The Express `Request` object.
|
277 |
+
* @param file Object containing information about the processed file.
|
278 |
+
* @param callback Callback to determine the destination path.
|
279 |
+
*/
|
280 |
+
destination?:
|
281 |
+
| string
|
282 |
+
| ((
|
283 |
+
req: Request,
|
284 |
+
file: Express.Multer.File,
|
285 |
+
callback: (error: Error | null, destination: string) => void,
|
286 |
+
) => void)
|
287 |
+
| undefined;
|
288 |
+
/**
|
289 |
+
* A function that determines the name of the uploaded file. If nothing
|
290 |
+
* is passed, Multer will generate a 32 character pseudorandom hex string
|
291 |
+
* with no extension.
|
292 |
+
*
|
293 |
+
* @param req The Express `Request` object.
|
294 |
+
* @param file Object containing information about the processed file.
|
295 |
+
* @param callback Callback to determine the name of the uploaded file.
|
296 |
+
*/
|
297 |
+
filename?(
|
298 |
+
req: Request,
|
299 |
+
file: Express.Multer.File,
|
300 |
+
callback: (error: Error | null, filename: string) => void,
|
301 |
+
): void;
|
302 |
+
}
|
303 |
+
|
304 |
+
/**
|
305 |
+
* An object describing a field name and the maximum number of files with
|
306 |
+
* that field name to accept.
|
307 |
+
*/
|
308 |
+
interface Field {
|
309 |
+
/** The field name. */
|
310 |
+
name: string;
|
311 |
+
/** Optional maximum number of files per field to accept. (Default: Infinity) */
|
312 |
+
maxCount?: number | undefined;
|
313 |
+
}
|
314 |
+
}
|
315 |
+
|
316 |
+
export = multer;
|
backend/node_modules/@types/multer/package.json
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "@types/multer",
|
3 |
+
"version": "1.4.11",
|
4 |
+
"description": "TypeScript definitions for multer",
|
5 |
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/multer",
|
6 |
+
"license": "MIT",
|
7 |
+
"contributors": [
|
8 |
+
{
|
9 |
+
"name": "jt000",
|
10 |
+
"githubUsername": "jt000",
|
11 |
+
"url": "https://github.com/jt000"
|
12 |
+
},
|
13 |
+
{
|
14 |
+
"name": "vilicvane",
|
15 |
+
"githubUsername": "vilic",
|
16 |
+
"url": "https://github.com/vilic"
|
17 |
+
},
|
18 |
+
{
|
19 |
+
"name": "David Broder-Rodgers",
|
20 |
+
"githubUsername": "DavidBR-SW",
|
21 |
+
"url": "https://github.com/DavidBR-SW"
|
22 |
+
},
|
23 |
+
{
|
24 |
+
"name": "Michael Ledin",
|
25 |
+
"githubUsername": "mxl",
|
26 |
+
"url": "https://github.com/mxl"
|
27 |
+
},
|
28 |
+
{
|
29 |
+
"name": "HyunSeob Lee",
|
30 |
+
"githubUsername": "hyunseob",
|
31 |
+
"url": "https://github.com/hyunseob"
|
32 |
+
},
|
33 |
+
{
|
34 |
+
"name": "Pierre Tchuente",
|
35 |
+
"githubUsername": "PierreTchuente",
|
36 |
+
"url": "https://github.com/PierreTchuente"
|
37 |
+
},
|
38 |
+
{
|
39 |
+
"name": "Oliver Emery",
|
40 |
+
"githubUsername": "thrymgjol",
|
41 |
+
"url": "https://github.com/thrymgjol"
|
42 |
+
},
|
43 |
+
{
|
44 |
+
"name": "Piotr Błażejewicz",
|
45 |
+
"githubUsername": "peterblazejewicz",
|
46 |
+
"url": "https://github.com/peterblazejewicz"
|
47 |
+
}
|
48 |
+
],
|
49 |
+
"main": "",
|
50 |
+
"types": "index.d.ts",
|
51 |
+
"repository": {
|
52 |
+
"type": "git",
|
53 |
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
54 |
+
"directory": "types/multer"
|
55 |
+
},
|
56 |
+
"scripts": {},
|
57 |
+
"dependencies": {
|
58 |
+
"@types/express": "*"
|
59 |
+
},
|
60 |
+
"typesPublisherContentHash": "b37b2751db6482b0d3da4c4b7dd8d1bfd189749a4393f0cccb635e743fccab7a",
|
61 |
+
"typeScriptVersion": "4.5"
|
62 |
+
}
|
backend/node_modules/@types/node-fetch/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
|
backend/node_modules/@types/node-fetch/README.md
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Installation
|
2 |
+
> `npm install --save @types/node-fetch`
|
3 |
+
|
4 |
+
# Summary
|
5 |
+
This package contains type definitions for node-fetch (https://github.com/bitinn/node-fetch).
|
6 |
+
|
7 |
+
# Details
|
8 |
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-fetch.
|
9 |
+
|
10 |
+
### Additional Details
|
11 |
+
* Last updated: Tue, 16 Jan 2024 23:07:00 GMT
|
12 |
+
* Dependencies: [@types/node](https://npmjs.com/package/@types/node), [form-data](https://npmjs.com/package/form-data)
|
13 |
+
|
14 |
+
# Credits
|
15 |
+
These definitions were written by [Torsten Werner](https://github.com/torstenwerner), [Niklas Lindgren](https://github.com/nikcorg), [Vinay Bedre](https://github.com/vinaybedre), [Antonio Román](https://github.com/kyranet), [Andrew Leedham](https://github.com/AndrewLeedham), [Jason Li](https://github.com/JasonLi914), [Steve Faulkner](https://github.com/southpolesteve), [ExE Boss](https://github.com/ExE-Boss), [Alex Savin](https://github.com/alexandrusavin), [Alexis Tyler](https://github.com/OmgImAlexis), [Jakub Kisielewski](https://github.com/kbkk), and [David Glasser](https://github.com/glasser).
|
backend/node_modules/@types/node-fetch/externals.d.ts
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// `AbortSignal` is defined here to prevent a dependency on a particular
|
2 |
+
// implementation like the `abort-controller` package, and to avoid requiring
|
3 |
+
// the `dom` library in `tsconfig.json`.
|
4 |
+
|
5 |
+
export interface AbortSignal {
|
6 |
+
aborted: boolean;
|
7 |
+
reason: any;
|
8 |
+
|
9 |
+
addEventListener: (
|
10 |
+
type: "abort",
|
11 |
+
listener: (this: AbortSignal, event: any) => any,
|
12 |
+
options?: boolean | {
|
13 |
+
capture?: boolean | undefined;
|
14 |
+
once?: boolean | undefined;
|
15 |
+
passive?: boolean | undefined;
|
16 |
+
},
|
17 |
+
) => void;
|
18 |
+
|
19 |
+
removeEventListener: (
|
20 |
+
type: "abort",
|
21 |
+
listener: (this: AbortSignal, event: any) => any,
|
22 |
+
options?: boolean | {
|
23 |
+
capture?: boolean | undefined;
|
24 |
+
},
|
25 |
+
) => void;
|
26 |
+
|
27 |
+
dispatchEvent: (event: any) => boolean;
|
28 |
+
|
29 |
+
onabort: null | ((this: AbortSignal, event: any) => any);
|
30 |
+
|
31 |
+
throwIfAborted(): void;
|
32 |
+
}
|
backend/node_modules/@types/node-fetch/index.d.ts
ADDED
@@ -0,0 +1,238 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/// <reference types="node" />
|
2 |
+
|
3 |
+
import FormData = require("form-data");
|
4 |
+
import { RequestOptions } from "http";
|
5 |
+
import { URL, URLSearchParams } from "url";
|
6 |
+
import { AbortSignal } from "./externals";
|
7 |
+
|
8 |
+
declare class Request extends Body {
|
9 |
+
constructor(input: RequestInfo, init?: RequestInit);
|
10 |
+
clone(): Request;
|
11 |
+
context: RequestContext;
|
12 |
+
headers: Headers;
|
13 |
+
method: string;
|
14 |
+
redirect: RequestRedirect;
|
15 |
+
referrer: string;
|
16 |
+
url: string;
|
17 |
+
|
18 |
+
// node-fetch extensions to the whatwg/fetch spec
|
19 |
+
agent?: RequestOptions["agent"] | ((parsedUrl: URL) => RequestOptions["agent"]);
|
20 |
+
compress: boolean;
|
21 |
+
counter: number;
|
22 |
+
follow: number;
|
23 |
+
hostname: string;
|
24 |
+
port?: number | undefined;
|
25 |
+
protocol: string;
|
26 |
+
size: number;
|
27 |
+
timeout: number;
|
28 |
+
}
|
29 |
+
|
30 |
+
interface RequestInit {
|
31 |
+
// whatwg/fetch standard options
|
32 |
+
body?: BodyInit | undefined;
|
33 |
+
headers?: HeadersInit | undefined;
|
34 |
+
method?: string | undefined;
|
35 |
+
redirect?: RequestRedirect | undefined;
|
36 |
+
signal?: AbortSignal | null | undefined;
|
37 |
+
|
38 |
+
// node-fetch extensions
|
39 |
+
agent?: RequestOptions["agent"] | ((parsedUrl: URL) => RequestOptions["agent"]); // =null http.Agent instance, allows custom proxy, certificate etc.
|
40 |
+
compress?: boolean | undefined; // =true support gzip/deflate content encoding. false to disable
|
41 |
+
follow?: number | undefined; // =20 maximum redirect count. 0 to not follow redirect
|
42 |
+
size?: number | undefined; // =0 maximum response body size in bytes. 0 to disable
|
43 |
+
timeout?: number | undefined; // =0 req/res timeout in ms, it resets on redirect. 0 to disable (OS limit applies)
|
44 |
+
|
45 |
+
// node-fetch does not support mode, cache or credentials options
|
46 |
+
}
|
47 |
+
|
48 |
+
type RequestContext =
|
49 |
+
| "audio"
|
50 |
+
| "beacon"
|
51 |
+
| "cspreport"
|
52 |
+
| "download"
|
53 |
+
| "embed"
|
54 |
+
| "eventsource"
|
55 |
+
| "favicon"
|
56 |
+
| "fetch"
|
57 |
+
| "font"
|
58 |
+
| "form"
|
59 |
+
| "frame"
|
60 |
+
| "hyperlink"
|
61 |
+
| "iframe"
|
62 |
+
| "image"
|
63 |
+
| "imageset"
|
64 |
+
| "import"
|
65 |
+
| "internal"
|
66 |
+
| "location"
|
67 |
+
| "manifest"
|
68 |
+
| "object"
|
69 |
+
| "ping"
|
70 |
+
| "plugin"
|
71 |
+
| "prefetch"
|
72 |
+
| "script"
|
73 |
+
| "serviceworker"
|
74 |
+
| "sharedworker"
|
75 |
+
| "style"
|
76 |
+
| "subresource"
|
77 |
+
| "track"
|
78 |
+
| "video"
|
79 |
+
| "worker"
|
80 |
+
| "xmlhttprequest"
|
81 |
+
| "xslt";
|
82 |
+
type RequestMode = "cors" | "no-cors" | "same-origin";
|
83 |
+
type RequestRedirect = "error" | "follow" | "manual";
|
84 |
+
type RequestCredentials = "omit" | "include" | "same-origin";
|
85 |
+
|
86 |
+
type RequestCache =
|
87 |
+
| "default"
|
88 |
+
| "force-cache"
|
89 |
+
| "no-cache"
|
90 |
+
| "no-store"
|
91 |
+
| "only-if-cached"
|
92 |
+
| "reload";
|
93 |
+
|
94 |
+
declare class Headers implements Iterable<[string, string]> {
|
95 |
+
constructor(init?: HeadersInit);
|
96 |
+
forEach(callback: (value: string, name: string) => void): void;
|
97 |
+
append(name: string, value: string): void;
|
98 |
+
delete(name: string): void;
|
99 |
+
get(name: string): string | null;
|
100 |
+
has(name: string): boolean;
|
101 |
+
raw(): { [k: string]: string[] };
|
102 |
+
set(name: string, value: string): void;
|
103 |
+
|
104 |
+
// Iterable methods
|
105 |
+
entries(): IterableIterator<[string, string]>;
|
106 |
+
keys(): IterableIterator<string>;
|
107 |
+
values(): IterableIterator<string>;
|
108 |
+
[Symbol.iterator](): Iterator<[string, string]>;
|
109 |
+
}
|
110 |
+
|
111 |
+
type BlobPart = ArrayBuffer | ArrayBufferView | Blob | string;
|
112 |
+
|
113 |
+
interface BlobOptions {
|
114 |
+
type?: string | undefined;
|
115 |
+
endings?: "transparent" | "native" | undefined;
|
116 |
+
}
|
117 |
+
|
118 |
+
declare class Blob {
|
119 |
+
constructor(blobParts?: BlobPart[], options?: BlobOptions);
|
120 |
+
readonly type: string;
|
121 |
+
readonly size: number;
|
122 |
+
slice(start?: number, end?: number): Blob;
|
123 |
+
text(): Promise<string>;
|
124 |
+
}
|
125 |
+
|
126 |
+
declare class Body {
|
127 |
+
constructor(body?: any, opts?: { size?: number | undefined; timeout?: number | undefined });
|
128 |
+
arrayBuffer(): Promise<ArrayBuffer>;
|
129 |
+
blob(): Promise<Blob>;
|
130 |
+
body: NodeJS.ReadableStream;
|
131 |
+
bodyUsed: boolean;
|
132 |
+
buffer(): Promise<Buffer>;
|
133 |
+
json(): Promise<any>;
|
134 |
+
size: number;
|
135 |
+
text(): Promise<string>;
|
136 |
+
textConverted(): Promise<string>;
|
137 |
+
timeout: number;
|
138 |
+
}
|
139 |
+
|
140 |
+
interface SystemError extends Error {
|
141 |
+
code?: string | undefined;
|
142 |
+
}
|
143 |
+
|
144 |
+
declare class AbortError extends Error {
|
145 |
+
readonly name: "AbortError";
|
146 |
+
constructor(message: string);
|
147 |
+
readonly type: "aborted";
|
148 |
+
}
|
149 |
+
|
150 |
+
declare class FetchError extends Error {
|
151 |
+
name: "FetchError";
|
152 |
+
constructor(message: string, type: string, systemError?: SystemError);
|
153 |
+
type: string;
|
154 |
+
code?: string | undefined;
|
155 |
+
errno?: string | undefined;
|
156 |
+
}
|
157 |
+
|
158 |
+
declare class Response extends Body {
|
159 |
+
constructor(body?: BodyInit, init?: ResponseInit);
|
160 |
+
static error(): Response;
|
161 |
+
static redirect(url: string, status: number): Response;
|
162 |
+
clone(): Response;
|
163 |
+
headers: Headers;
|
164 |
+
ok: boolean;
|
165 |
+
redirected: boolean;
|
166 |
+
status: number;
|
167 |
+
statusText: string;
|
168 |
+
type: ResponseType;
|
169 |
+
url: string;
|
170 |
+
}
|
171 |
+
|
172 |
+
type ResponseType =
|
173 |
+
| "basic"
|
174 |
+
| "cors"
|
175 |
+
| "default"
|
176 |
+
| "error"
|
177 |
+
| "opaque"
|
178 |
+
| "opaqueredirect";
|
179 |
+
|
180 |
+
interface ResponseInit {
|
181 |
+
headers?: HeadersInit | undefined;
|
182 |
+
size?: number | undefined;
|
183 |
+
status?: number | undefined;
|
184 |
+
statusText?: string | undefined;
|
185 |
+
timeout?: number | undefined;
|
186 |
+
url?: string | undefined;
|
187 |
+
counter?: number | undefined;
|
188 |
+
}
|
189 |
+
|
190 |
+
interface URLLike {
|
191 |
+
href: string;
|
192 |
+
}
|
193 |
+
|
194 |
+
type HeadersInit = Headers | string[][] | { [key: string]: string | string[] };
|
195 |
+
type BodyInit =
|
196 |
+
| ArrayBuffer
|
197 |
+
| ArrayBufferView
|
198 |
+
| NodeJS.ReadableStream
|
199 |
+
| string
|
200 |
+
| URLSearchParams
|
201 |
+
| FormData;
|
202 |
+
type RequestInfo = string | URLLike | Request;
|
203 |
+
|
204 |
+
declare function fetch(
|
205 |
+
url: RequestInfo,
|
206 |
+
init?: RequestInit,
|
207 |
+
): Promise<Response>;
|
208 |
+
|
209 |
+
declare namespace fetch {
|
210 |
+
export {
|
211 |
+
AbortError,
|
212 |
+
Blob,
|
213 |
+
Body,
|
214 |
+
BodyInit,
|
215 |
+
FetchError,
|
216 |
+
Headers,
|
217 |
+
HeadersInit,
|
218 |
+
// HeaderInit is exported to support backwards compatibility. See PR #34382
|
219 |
+
HeadersInit as HeaderInit,
|
220 |
+
Request,
|
221 |
+
RequestCache,
|
222 |
+
RequestContext,
|
223 |
+
RequestCredentials,
|
224 |
+
RequestInfo,
|
225 |
+
RequestInit,
|
226 |
+
RequestMode,
|
227 |
+
RequestRedirect,
|
228 |
+
Response,
|
229 |
+
ResponseInit,
|
230 |
+
ResponseType,
|
231 |
+
};
|
232 |
+
export function isRedirect(code: number): boolean;
|
233 |
+
|
234 |
+
import _default = fetch;
|
235 |
+
export { _default as default };
|
236 |
+
}
|
237 |
+
|
238 |
+
export = fetch;
|
backend/node_modules/@types/node-fetch/package.json
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "@types/node-fetch",
|
3 |
+
"version": "2.6.11",
|
4 |
+
"description": "TypeScript definitions for node-fetch",
|
5 |
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-fetch",
|
6 |
+
"license": "MIT",
|
7 |
+
"contributors": [
|
8 |
+
{
|
9 |
+
"name": "Torsten Werner",
|
10 |
+
"githubUsername": "torstenwerner",
|
11 |
+
"url": "https://github.com/torstenwerner"
|
12 |
+
},
|
13 |
+
{
|
14 |
+
"name": "Niklas Lindgren",
|
15 |
+
"githubUsername": "nikcorg",
|
16 |
+
"url": "https://github.com/nikcorg"
|
17 |
+
},
|
18 |
+
{
|
19 |
+
"name": "Vinay Bedre",
|
20 |
+
"githubUsername": "vinaybedre",
|
21 |
+
"url": "https://github.com/vinaybedre"
|
22 |
+
},
|
23 |
+
{
|
24 |
+
"name": "Antonio Román",
|
25 |
+
"githubUsername": "kyranet",
|
26 |
+
"url": "https://github.com/kyranet"
|
27 |
+
},
|
28 |
+
{
|
29 |
+
"name": "Andrew Leedham",
|
30 |
+
"githubUsername": "AndrewLeedham",
|
31 |
+
"url": "https://github.com/AndrewLeedham"
|
32 |
+
},
|
33 |
+
{
|
34 |
+
"name": "Jason Li",
|
35 |
+
"githubUsername": "JasonLi914",
|
36 |
+
"url": "https://github.com/JasonLi914"
|
37 |
+
},
|
38 |
+
{
|
39 |
+
"name": "Steve Faulkner",
|
40 |
+
"githubUsername": "southpolesteve",
|
41 |
+
"url": "https://github.com/southpolesteve"
|
42 |
+
},
|
43 |
+
{
|
44 |
+
"name": "ExE Boss",
|
45 |
+
"githubUsername": "ExE-Boss",
|
46 |
+
"url": "https://github.com/ExE-Boss"
|
47 |
+
},
|
48 |
+
{
|
49 |
+
"name": "Alex Savin",
|
50 |
+
"githubUsername": "alexandrusavin",
|
51 |
+
"url": "https://github.com/alexandrusavin"
|
52 |
+
},
|
53 |
+
{
|
54 |
+
"name": "Alexis Tyler",
|
55 |
+
"githubUsername": "OmgImAlexis",
|
56 |
+
"url": "https://github.com/OmgImAlexis"
|
57 |
+
},
|
58 |
+
{
|
59 |
+
"name": "Jakub Kisielewski",
|
60 |
+
"githubUsername": "kbkk",
|
61 |
+
"url": "https://github.com/kbkk"
|
62 |
+
},
|
63 |
+
{
|
64 |
+
"name": "David Glasser",
|
65 |
+
"githubUsername": "glasser",
|
66 |
+
"url": "https://github.com/glasser"
|
67 |
+
}
|
68 |
+
],
|
69 |
+
"main": "",
|
70 |
+
"types": "index.d.ts",
|
71 |
+
"repository": {
|
72 |
+
"type": "git",
|
73 |
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
74 |
+
"directory": "types/node-fetch"
|
75 |
+
},
|
76 |
+
"scripts": {},
|
77 |
+
"dependencies": {
|
78 |
+
"@types/node": "*",
|
79 |
+
"form-data": "^4.0.0"
|
80 |
+
},
|
81 |
+
"typesPublisherContentHash": "912e2c03935d0f960f529de6f688e52c77e78b7ca935198cd500804e69ea371f",
|
82 |
+
"typeScriptVersion": "4.6"
|
83 |
+
}
|
backend/node_modules/@types/node/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
|
backend/node_modules/@types/node/README.md
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Installation
|
2 |
+
> `npm install --save @types/node`
|
3 |
+
|
4 |
+
# Summary
|
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/v18.
|
9 |
+
|
10 |
+
### Additional Details
|
11 |
+
* Last updated: Tue, 09 Apr 2024 04:08:23 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), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [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), [Yongsheng Zhang](https://github.com/ZYSzys), [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).
|
backend/node_modules/@types/node/assert.d.ts
ADDED
@@ -0,0 +1,985 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* The `assert` module provides a set of assertion functions for verifying
|
3 |
+
* invariants.
|
4 |
+
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/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 |
+
/**
|
15 |
+
* Indicates the failure of an assertion. All errors thrown by the `assert` module
|
16 |
+
* will be instances of the `AssertionError` class.
|
17 |
+
*/
|
18 |
+
class AssertionError extends Error {
|
19 |
+
actual: unknown;
|
20 |
+
expected: unknown;
|
21 |
+
operator: string;
|
22 |
+
generatedMessage: boolean;
|
23 |
+
code: "ERR_ASSERTION";
|
24 |
+
constructor(options?: {
|
25 |
+
/** If provided, the error message is set to this value. */
|
26 |
+
message?: string | undefined;
|
27 |
+
/** The `actual` property on the error instance. */
|
28 |
+
actual?: unknown | undefined;
|
29 |
+
/** The `expected` property on the error instance. */
|
30 |
+
expected?: unknown | undefined;
|
31 |
+
/** The `operator` property on the error instance. */
|
32 |
+
operator?: string | undefined;
|
33 |
+
/** If provided, the generated stack trace omits frames before this function. */
|
34 |
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
35 |
+
stackStartFn?: Function | undefined;
|
36 |
+
});
|
37 |
+
}
|
38 |
+
/**
|
39 |
+
* This feature is currently experimental and behavior might still change.
|
40 |
+
* @since v14.2.0, v12.19.0
|
41 |
+
* @experimental
|
42 |
+
*/
|
43 |
+
class CallTracker {
|
44 |
+
/**
|
45 |
+
* The wrapper function is expected to be called exactly `exact` times. If the
|
46 |
+
* function has not been called exactly `exact` times when `tracker.verify()` is called, then `tracker.verify()` will throw an
|
47 |
+
* error.
|
48 |
+
*
|
49 |
+
* ```js
|
50 |
+
* import assert from 'assert';
|
51 |
+
*
|
52 |
+
* // Creates call tracker.
|
53 |
+
* const tracker = new assert.CallTracker();
|
54 |
+
*
|
55 |
+
* function func() {}
|
56 |
+
*
|
57 |
+
* // Returns a function that wraps func() that must be called exact times
|
58 |
+
* // before tracker.verify().
|
59 |
+
* const callsfunc = tracker.calls(func);
|
60 |
+
* ```
|
61 |
+
* @since v14.2.0, v12.19.0
|
62 |
+
* @param [fn='A no-op function']
|
63 |
+
* @param [exact=1]
|
64 |
+
* @return that wraps `fn`.
|
65 |
+
*/
|
66 |
+
calls(exact?: number): () => void;
|
67 |
+
calls<Func extends (...args: any[]) => any>(fn?: Func, exact?: number): Func;
|
68 |
+
/**
|
69 |
+
* Example:
|
70 |
+
*
|
71 |
+
* ```js
|
72 |
+
* import assert from 'node:assert';
|
73 |
+
*
|
74 |
+
* const tracker = new assert.CallTracker();
|
75 |
+
*
|
76 |
+
* function func() {}
|
77 |
+
* const callsfunc = tracker.calls(func);
|
78 |
+
* callsfunc(1, 2, 3);
|
79 |
+
*
|
80 |
+
* assert.deepStrictEqual(tracker.getCalls(callsfunc),
|
81 |
+
* [{ thisArg: this, arguments: [1, 2, 3 ] }]);
|
82 |
+
* ```
|
83 |
+
*
|
84 |
+
* @since v18.8.0, v16.18.0
|
85 |
+
* @param fn
|
86 |
+
* @returns An Array with the calls to a tracked function.
|
87 |
+
*/
|
88 |
+
getCalls(fn: Function): CallTrackerCall[];
|
89 |
+
/**
|
90 |
+
* The arrays contains information about the expected and actual number of calls of
|
91 |
+
* the functions that have not been called the expected number of times.
|
92 |
+
*
|
93 |
+
* ```js
|
94 |
+
* import assert from 'assert';
|
95 |
+
*
|
96 |
+
* // Creates call tracker.
|
97 |
+
* const tracker = new assert.CallTracker();
|
98 |
+
*
|
99 |
+
* function func() {}
|
100 |
+
*
|
101 |
+
* function foo() {}
|
102 |
+
*
|
103 |
+
* // Returns a function that wraps func() that must be called exact times
|
104 |
+
* // before tracker.verify().
|
105 |
+
* const callsfunc = tracker.calls(func, 2);
|
106 |
+
*
|
107 |
+
* // Returns an array containing information on callsfunc()
|
108 |
+
* tracker.report();
|
109 |
+
* // [
|
110 |
+
* // {
|
111 |
+
* // message: 'Expected the func function to be executed 2 time(s) but was
|
112 |
+
* // executed 0 time(s).',
|
113 |
+
* // actual: 0,
|
114 |
+
* // expected: 2,
|
115 |
+
* // operator: 'func',
|
116 |
+
* // stack: stack trace
|
117 |
+
* // }
|
118 |
+
* // ]
|
119 |
+
* ```
|
120 |
+
* @since v14.2.0, v12.19.0
|
121 |
+
* @return of objects containing information about the wrapper functions returned by `calls`.
|
122 |
+
*/
|
123 |
+
report(): CallTrackerReportInformation[];
|
124 |
+
/**
|
125 |
+
* Reset calls of the call tracker.
|
126 |
+
* If a tracked function is passed as an argument, the calls will be reset for it.
|
127 |
+
* If no arguments are passed, all tracked functions will be reset.
|
128 |
+
*
|
129 |
+
* ```js
|
130 |
+
* import assert from 'node:assert';
|
131 |
+
*
|
132 |
+
* const tracker = new assert.CallTracker();
|
133 |
+
*
|
134 |
+
* function func() {}
|
135 |
+
* const callsfunc = tracker.calls(func);
|
136 |
+
*
|
137 |
+
* callsfunc();
|
138 |
+
* // Tracker was called once
|
139 |
+
* tracker.getCalls(callsfunc).length === 1;
|
140 |
+
*
|
141 |
+
* tracker.reset(callsfunc);
|
142 |
+
* tracker.getCalls(callsfunc).length === 0;
|
143 |
+
* ```
|
144 |
+
*
|
145 |
+
* @since v18.8.0, v16.18.0
|
146 |
+
* @param fn a tracked function to reset.
|
147 |
+
*/
|
148 |
+
reset(fn?: Function): void;
|
149 |
+
/**
|
150 |
+
* Iterates through the list of functions passed to `tracker.calls()` and will throw an error for functions that
|
151 |
+
* have not been called the expected number of times.
|
152 |
+
*
|
153 |
+
* ```js
|
154 |
+
* import assert from 'assert';
|
155 |
+
*
|
156 |
+
* // Creates call tracker.
|
157 |
+
* const tracker = new assert.CallTracker();
|
158 |
+
*
|
159 |
+
* function func() {}
|
160 |
+
*
|
161 |
+
* // Returns a function that wraps func() that must be called exact times
|
162 |
+
* // before tracker.verify().
|
163 |
+
* const callsfunc = tracker.calls(func, 2);
|
164 |
+
*
|
165 |
+
* callsfunc();
|
166 |
+
*
|
167 |
+
* // Will throw an error since callsfunc() was only called once.
|
168 |
+
* tracker.verify();
|
169 |
+
* ```
|
170 |
+
* @since v14.2.0, v12.19.0
|
171 |
+
*/
|
172 |
+
verify(): void;
|
173 |
+
}
|
174 |
+
interface CallTrackerCall {
|
175 |
+
thisArg: object;
|
176 |
+
arguments: unknown[];
|
177 |
+
}
|
178 |
+
interface CallTrackerReportInformation {
|
179 |
+
message: string;
|
180 |
+
/** The actual number of times the function was called. */
|
181 |
+
actual: number;
|
182 |
+
/** The number of times the function was expected to be called. */
|
183 |
+
expected: number;
|
184 |
+
/** The name of the function that is wrapped. */
|
185 |
+
operator: string;
|
186 |
+
/** A stack trace of the function. */
|
187 |
+
stack: object;
|
188 |
+
}
|
189 |
+
type AssertPredicate = RegExp | (new() => object) | ((thrown: unknown) => boolean) | object | Error;
|
190 |
+
/**
|
191 |
+
* Throws an `AssertionError` with the provided error message or a default
|
192 |
+
* error message. If the `message` parameter is an instance of an `Error` then
|
193 |
+
* it will be thrown instead of the `AssertionError`.
|
194 |
+
*
|
195 |
+
* ```js
|
196 |
+
* import assert from 'assert/strict';
|
197 |
+
*
|
198 |
+
* assert.fail();
|
199 |
+
* // AssertionError [ERR_ASSERTION]: Failed
|
200 |
+
*
|
201 |
+
* assert.fail('boom');
|
202 |
+
* // AssertionError [ERR_ASSERTION]: boom
|
203 |
+
*
|
204 |
+
* assert.fail(new TypeError('need array'));
|
205 |
+
* // TypeError: need array
|
206 |
+
* ```
|
207 |
+
*
|
208 |
+
* Using `assert.fail()` with more than two arguments is possible but deprecated.
|
209 |
+
* See below for further details.
|
210 |
+
* @since v0.1.21
|
211 |
+
* @param [message='Failed']
|
212 |
+
*/
|
213 |
+
function fail(message?: string | Error): never;
|
214 |
+
/** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */
|
215 |
+
function fail(
|
216 |
+
actual: unknown,
|
217 |
+
expected: unknown,
|
218 |
+
message?: string | Error,
|
219 |
+
operator?: string,
|
220 |
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
221 |
+
stackStartFn?: Function,
|
222 |
+
): never;
|
223 |
+
/**
|
224 |
+
* Tests if `value` is truthy. It is equivalent to`assert.equal(!!value, true, message)`.
|
225 |
+
*
|
226 |
+
* If `value` is not truthy, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is `undefined`, a default
|
227 |
+
* error message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`.
|
228 |
+
* If no arguments are passed in at all `message` will be set to the string:`` 'No value argument passed to `assert.ok()`' ``.
|
229 |
+
*
|
230 |
+
* Be aware that in the `repl` the error message will be different to the one
|
231 |
+
* thrown in a file! See below for further details.
|
232 |
+
*
|
233 |
+
* ```js
|
234 |
+
* import assert from 'assert/strict';
|
235 |
+
*
|
236 |
+
* assert.ok(true);
|
237 |
+
* // OK
|
238 |
+
* assert.ok(1);
|
239 |
+
* // OK
|
240 |
+
*
|
241 |
+
* assert.ok();
|
242 |
+
* // AssertionError: No value argument passed to `assert.ok()`
|
243 |
+
*
|
244 |
+
* assert.ok(false, 'it\'s false');
|
245 |
+
* // AssertionError: it's false
|
246 |
+
*
|
247 |
+
* // In the repl:
|
248 |
+
* assert.ok(typeof 123 === 'string');
|
249 |
+
* // AssertionError: false == true
|
250 |
+
*
|
251 |
+
* // In a file (e.g. test.js):
|
252 |
+
* assert.ok(typeof 123 === 'string');
|
253 |
+
* // AssertionError: The expression evaluated to a falsy value:
|
254 |
+
* //
|
255 |
+
* // assert.ok(typeof 123 === 'string')
|
256 |
+
*
|
257 |
+
* assert.ok(false);
|
258 |
+
* // AssertionError: The expression evaluated to a falsy value:
|
259 |
+
* //
|
260 |
+
* // assert.ok(false)
|
261 |
+
*
|
262 |
+
* assert.ok(0);
|
263 |
+
* // AssertionError: The expression evaluated to a falsy value:
|
264 |
+
* //
|
265 |
+
* // assert.ok(0)
|
266 |
+
* ```
|
267 |
+
*
|
268 |
+
* ```js
|
269 |
+
* import assert from 'assert/strict';
|
270 |
+
*
|
271 |
+
* // Using `assert()` works the same:
|
272 |
+
* assert(0);
|
273 |
+
* // AssertionError: The expression evaluated to a falsy value:
|
274 |
+
* //
|
275 |
+
* // assert(0)
|
276 |
+
* ```
|
277 |
+
* @since v0.1.21
|
278 |
+
*/
|
279 |
+
function ok(value: unknown, message?: string | Error): asserts value;
|
280 |
+
/**
|
281 |
+
* **Strict assertion mode**
|
282 |
+
*
|
283 |
+
* An alias of {@link strictEqual}.
|
284 |
+
*
|
285 |
+
* **Legacy assertion mode**
|
286 |
+
*
|
287 |
+
* > Stability: 3 - Legacy: Use {@link strictEqual} instead.
|
288 |
+
*
|
289 |
+
* Tests shallow, coercive equality between the `actual` and `expected` parameters
|
290 |
+
* using the [`==` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality). `NaN` is specially handled
|
291 |
+
* and treated as being identical if both sides are `NaN`.
|
292 |
+
*
|
293 |
+
* ```js
|
294 |
+
* import assert from 'assert';
|
295 |
+
*
|
296 |
+
* assert.equal(1, 1);
|
297 |
+
* // OK, 1 == 1
|
298 |
+
* assert.equal(1, '1');
|
299 |
+
* // OK, 1 == '1'
|
300 |
+
* assert.equal(NaN, NaN);
|
301 |
+
* // OK
|
302 |
+
*
|
303 |
+
* assert.equal(1, 2);
|
304 |
+
* // AssertionError: 1 == 2
|
305 |
+
* assert.equal({ a: { b: 1 } }, { a: { b: 1 } });
|
306 |
+
* // AssertionError: { a: { b: 1 } } == { a: { b: 1 } }
|
307 |
+
* ```
|
308 |
+
*
|
309 |
+
* If the values are not equal, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is undefined, a default
|
310 |
+
* error message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`.
|
311 |
+
* @since v0.1.21
|
312 |
+
*/
|
313 |
+
function equal(actual: unknown, expected: unknown, message?: string | Error): void;
|
314 |
+
/**
|
315 |
+
* **Strict assertion mode**
|
316 |
+
*
|
317 |
+
* An alias of {@link notStrictEqual}.
|
318 |
+
*
|
319 |
+
* **Legacy assertion mode**
|
320 |
+
*
|
321 |
+
* > Stability: 3 - Legacy: Use {@link notStrictEqual} instead.
|
322 |
+
*
|
323 |
+
* Tests shallow, coercive inequality with the [`!=` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Inequality). `NaN` is
|
324 |
+
* specially handled and treated as being identical if both sides are `NaN`.
|
325 |
+
*
|
326 |
+
* ```js
|
327 |
+
* import assert from 'assert';
|
328 |
+
*
|
329 |
+
* assert.notEqual(1, 2);
|
330 |
+
* // OK
|
331 |
+
*
|
332 |
+
* assert.notEqual(1, 1);
|
333 |
+
* // AssertionError: 1 != 1
|
334 |
+
*
|
335 |
+
* assert.notEqual(1, '1');
|
336 |
+
* // AssertionError: 1 != '1'
|
337 |
+
* ```
|
338 |
+
*
|
339 |
+
* If the values are equal, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is undefined, a default error
|
340 |
+
* message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`.
|
341 |
+
* @since v0.1.21
|
342 |
+
*/
|
343 |
+
function notEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
344 |
+
/**
|
345 |
+
* **Strict assertion mode**
|
346 |
+
*
|
347 |
+
* An alias of {@link deepStrictEqual}.
|
348 |
+
*
|
349 |
+
* **Legacy assertion mode**
|
350 |
+
*
|
351 |
+
* > Stability: 3 - Legacy: Use {@link deepStrictEqual} instead.
|
352 |
+
*
|
353 |
+
* Tests for deep equality between the `actual` and `expected` parameters. Consider
|
354 |
+
* using {@link deepStrictEqual} instead. {@link deepEqual} can have
|
355 |
+
* surprising results.
|
356 |
+
*
|
357 |
+
* _Deep equality_ means that the enumerable "own" properties of child objects
|
358 |
+
* are also recursively evaluated by the following rules.
|
359 |
+
* @since v0.1.21
|
360 |
+
*/
|
361 |
+
function deepEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
362 |
+
/**
|
363 |
+
* **Strict assertion mode**
|
364 |
+
*
|
365 |
+
* An alias of {@link notDeepStrictEqual}.
|
366 |
+
*
|
367 |
+
* **Legacy assertion mode**
|
368 |
+
*
|
369 |
+
* > Stability: 3 - Legacy: Use {@link notDeepStrictEqual} instead.
|
370 |
+
*
|
371 |
+
* Tests for any deep inequality. Opposite of {@link deepEqual}.
|
372 |
+
*
|
373 |
+
* ```js
|
374 |
+
* import assert from 'assert';
|
375 |
+
*
|
376 |
+
* const obj1 = {
|
377 |
+
* a: {
|
378 |
+
* b: 1
|
379 |
+
* }
|
380 |
+
* };
|
381 |
+
* const obj2 = {
|
382 |
+
* a: {
|
383 |
+
* b: 2
|
384 |
+
* }
|
385 |
+
* };
|
386 |
+
* const obj3 = {
|
387 |
+
* a: {
|
388 |
+
* b: 1
|
389 |
+
* }
|
390 |
+
* };
|
391 |
+
* const obj4 = Object.create(obj1);
|
392 |
+
*
|
393 |
+
* assert.notDeepEqual(obj1, obj1);
|
394 |
+
* // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }
|
395 |
+
*
|
396 |
+
* assert.notDeepEqual(obj1, obj2);
|
397 |
+
* // OK
|
398 |
+
*
|
399 |
+
* assert.notDeepEqual(obj1, obj3);
|
400 |
+
* // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }
|
401 |
+
*
|
402 |
+
* assert.notDeepEqual(obj1, obj4);
|
403 |
+
* // OK
|
404 |
+
* ```
|
405 |
+
*
|
406 |
+
* If the values are deeply equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a default
|
407 |
+
* error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown
|
408 |
+
* instead of the `AssertionError`.
|
409 |
+
* @since v0.1.21
|
410 |
+
*/
|
411 |
+
function notDeepEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
412 |
+
/**
|
413 |
+
* Tests strict equality between the `actual` and `expected` parameters as
|
414 |
+
* determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
|
415 |
+
*
|
416 |
+
* ```js
|
417 |
+
* import assert from 'assert/strict';
|
418 |
+
*
|
419 |
+
* assert.strictEqual(1, 2);
|
420 |
+
* // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:
|
421 |
+
* //
|
422 |
+
* // 1 !== 2
|
423 |
+
*
|
424 |
+
* assert.strictEqual(1, 1);
|
425 |
+
* // OK
|
426 |
+
*
|
427 |
+
* assert.strictEqual('Hello foobar', 'Hello World!');
|
428 |
+
* // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:
|
429 |
+
* // + actual - expected
|
430 |
+
* //
|
431 |
+
* // + 'Hello foobar'
|
432 |
+
* // - 'Hello World!'
|
433 |
+
* // ^
|
434 |
+
*
|
435 |
+
* const apples = 1;
|
436 |
+
* const oranges = 2;
|
437 |
+
* assert.strictEqual(apples, oranges, `apples ${apples} !== oranges ${oranges}`);
|
438 |
+
* // AssertionError [ERR_ASSERTION]: apples 1 !== oranges 2
|
439 |
+
*
|
440 |
+
* assert.strictEqual(1, '1', new TypeError('Inputs are not identical'));
|
441 |
+
* // TypeError: Inputs are not identical
|
442 |
+
* ```
|
443 |
+
*
|
444 |
+
* If the values are not strictly equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a
|
445 |
+
* default error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown
|
446 |
+
* instead of the `AssertionError`.
|
447 |
+
* @since v0.1.21
|
448 |
+
*/
|
449 |
+
function strictEqual<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
|
450 |
+
/**
|
451 |
+
* Tests strict inequality between the `actual` and `expected` parameters as
|
452 |
+
* determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
|
453 |
+
*
|
454 |
+
* ```js
|
455 |
+
* import assert from 'assert/strict';
|
456 |
+
*
|
457 |
+
* assert.notStrictEqual(1, 2);
|
458 |
+
* // OK
|
459 |
+
*
|
460 |
+
* assert.notStrictEqual(1, 1);
|
461 |
+
* // AssertionError [ERR_ASSERTION]: Expected "actual" to be strictly unequal to:
|
462 |
+
* //
|
463 |
+
* // 1
|
464 |
+
*
|
465 |
+
* assert.notStrictEqual(1, '1');
|
466 |
+
* // OK
|
467 |
+
* ```
|
468 |
+
*
|
469 |
+
* If the values are strictly equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a
|
470 |
+
* default error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown
|
471 |
+
* instead of the `AssertionError`.
|
472 |
+
* @since v0.1.21
|
473 |
+
*/
|
474 |
+
function notStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
475 |
+
/**
|
476 |
+
* Tests for deep equality between the `actual` and `expected` parameters.
|
477 |
+
* "Deep" equality means that the enumerable "own" properties of child objects
|
478 |
+
* are recursively evaluated also by the following rules.
|
479 |
+
* @since v1.2.0
|
480 |
+
*/
|
481 |
+
function deepStrictEqual<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
|
482 |
+
/**
|
483 |
+
* Tests for deep strict inequality. Opposite of {@link deepStrictEqual}.
|
484 |
+
*
|
485 |
+
* ```js
|
486 |
+
* import assert from 'assert/strict';
|
487 |
+
*
|
488 |
+
* assert.notDeepStrictEqual({ a: 1 }, { a: '1' });
|
489 |
+
* // OK
|
490 |
+
* ```
|
491 |
+
*
|
492 |
+
* If the values are deeply and strictly equal, an `AssertionError` is thrown
|
493 |
+
* with a `message` property set equal to the value of the `message` parameter. If
|
494 |
+
* the `message` parameter is undefined, a default error message is assigned. If
|
495 |
+
* the `message` parameter is an instance of an `Error` then it will be thrown
|
496 |
+
* instead of the `AssertionError`.
|
497 |
+
* @since v1.2.0
|
498 |
+
*/
|
499 |
+
function notDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
500 |
+
/**
|
501 |
+
* Expects the function `fn` to throw an error.
|
502 |
+
*
|
503 |
+
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
|
504 |
+
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function,
|
505 |
+
* a validation object where each property will be tested for strict deep equality,
|
506 |
+
* or an instance of error where each property will be tested for strict deep
|
507 |
+
* equality including the non-enumerable `message` and `name` properties. When
|
508 |
+
* using an object, it is also possible to use a regular expression, when
|
509 |
+
* validating against a string property. See below for examples.
|
510 |
+
*
|
511 |
+
* If specified, `message` will be appended to the message provided by the`AssertionError` if the `fn` call fails to throw or in case the error validation
|
512 |
+
* fails.
|
513 |
+
*
|
514 |
+
* Custom validation object/error instance:
|
515 |
+
*
|
516 |
+
* ```js
|
517 |
+
* import assert from 'assert/strict';
|
518 |
+
*
|
519 |
+
* const err = new TypeError('Wrong value');
|
520 |
+
* err.code = 404;
|
521 |
+
* err.foo = 'bar';
|
522 |
+
* err.info = {
|
523 |
+
* nested: true,
|
524 |
+
* baz: 'text'
|
525 |
+
* };
|
526 |
+
* err.reg = /abc/i;
|
527 |
+
*
|
528 |
+
* assert.throws(
|
529 |
+
* () => {
|
530 |
+
* throw err;
|
531 |
+
* },
|
532 |
+
* {
|
533 |
+
* name: 'TypeError',
|
534 |
+
* message: 'Wrong value',
|
535 |
+
* info: {
|
536 |
+
* nested: true,
|
537 |
+
* baz: 'text'
|
538 |
+
* }
|
539 |
+
* // Only properties on the validation object will be tested for.
|
540 |
+
* // Using nested objects requires all properties to be present. Otherwise
|
541 |
+
* // the validation is going to fail.
|
542 |
+
* }
|
543 |
+
* );
|
544 |
+
*
|
545 |
+
* // Using regular expressions to validate error properties:
|
546 |
+
* throws(
|
547 |
+
* () => {
|
548 |
+
* throw err;
|
549 |
+
* },
|
550 |
+
* {
|
551 |
+
* // The `name` and `message` properties are strings and using regular
|
552 |
+
* // expressions on those will match against the string. If they fail, an
|
553 |
+
* // error is thrown.
|
554 |
+
* name: /^TypeError$/,
|
555 |
+
* message: /Wrong/,
|
556 |
+
* foo: 'bar',
|
557 |
+
* info: {
|
558 |
+
* nested: true,
|
559 |
+
* // It is not possible to use regular expressions for nested properties!
|
560 |
+
* baz: 'text'
|
561 |
+
* },
|
562 |
+
* // The `reg` property contains a regular expression and only if the
|
563 |
+
* // validation object contains an identical regular expression, it is going
|
564 |
+
* // to pass.
|
565 |
+
* reg: /abc/i
|
566 |
+
* }
|
567 |
+
* );
|
568 |
+
*
|
569 |
+
* // Fails due to the different `message` and `name` properties:
|
570 |
+
* throws(
|
571 |
+
* () => {
|
572 |
+
* const otherErr = new Error('Not found');
|
573 |
+
* // Copy all enumerable properties from `err` to `otherErr`.
|
574 |
+
* for (const [key, value] of Object.entries(err)) {
|
575 |
+
* otherErr[key] = value;
|
576 |
+
* }
|
577 |
+
* throw otherErr;
|
578 |
+
* },
|
579 |
+
* // The error's `message` and `name` properties will also be checked when using
|
580 |
+
* // an error as validation object.
|
581 |
+
* err
|
582 |
+
* );
|
583 |
+
* ```
|
584 |
+
*
|
585 |
+
* Validate instanceof using constructor:
|
586 |
+
*
|
587 |
+
* ```js
|
588 |
+
* import assert from 'assert/strict';
|
589 |
+
*
|
590 |
+
* assert.throws(
|
591 |
+
* () => {
|
592 |
+
* throw new Error('Wrong value');
|
593 |
+
* },
|
594 |
+
* Error
|
595 |
+
* );
|
596 |
+
* ```
|
597 |
+
*
|
598 |
+
* Validate error message using [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions):
|
599 |
+
*
|
600 |
+
* Using a regular expression runs `.toString` on the error object, and will
|
601 |
+
* therefore also include the error name.
|
602 |
+
*
|
603 |
+
* ```js
|
604 |
+
* import assert from 'assert/strict';
|
605 |
+
*
|
606 |
+
* assert.throws(
|
607 |
+
* () => {
|
608 |
+
* throw new Error('Wrong value');
|
609 |
+
* },
|
610 |
+
* /^Error: Wrong value$/
|
611 |
+
* );
|
612 |
+
* ```
|
613 |
+
*
|
614 |
+
* Custom error validation:
|
615 |
+
*
|
616 |
+
* The function must return `true` to indicate all internal validations passed.
|
617 |
+
* It will otherwise fail with an `AssertionError`.
|
618 |
+
*
|
619 |
+
* ```js
|
620 |
+
* import assert from 'assert/strict';
|
621 |
+
*
|
622 |
+
* assert.throws(
|
623 |
+
* () => {
|
624 |
+
* throw new Error('Wrong value');
|
625 |
+
* },
|
626 |
+
* (err) => {
|
627 |
+
* assert(err instanceof Error);
|
628 |
+
* assert(/value/.test(err));
|
629 |
+
* // Avoid returning anything from validation functions besides `true`.
|
630 |
+
* // Otherwise, it's not clear what part of the validation failed. Instead,
|
631 |
+
* // throw an error about the specific validation that failed (as done in this
|
632 |
+
* // example) and add as much helpful debugging information to that error as
|
633 |
+
* // possible.
|
634 |
+
* return true;
|
635 |
+
* },
|
636 |
+
* 'unexpected error'
|
637 |
+
* );
|
638 |
+
* ```
|
639 |
+
*
|
640 |
+
* `error` cannot be a string. If a string is provided as the second
|
641 |
+
* argument, then `error` is assumed to be omitted and the string will be used for`message` instead. This can lead to easy-to-miss mistakes. Using the same
|
642 |
+
* message as the thrown error message is going to result in an`ERR_AMBIGUOUS_ARGUMENT` error. Please read the example below carefully if using
|
643 |
+
* a string as the second argument gets considered:
|
644 |
+
*
|
645 |
+
* ```js
|
646 |
+
* import assert from 'assert/strict';
|
647 |
+
*
|
648 |
+
* function throwingFirst() {
|
649 |
+
* throw new Error('First');
|
650 |
+
* }
|
651 |
+
*
|
652 |
+
* function throwingSecond() {
|
653 |
+
* throw new Error('Second');
|
654 |
+
* }
|
655 |
+
*
|
656 |
+
* function notThrowing() {}
|
657 |
+
*
|
658 |
+
* // The second argument is a string and the input function threw an Error.
|
659 |
+
* // The first case will not throw as it does not match for the error message
|
660 |
+
* // thrown by the input function!
|
661 |
+
* assert.throws(throwingFirst, 'Second');
|
662 |
+
* // In the next example the message has no benefit over the message from the
|
663 |
+
* // error and since it is not clear if the user intended to actually match
|
664 |
+
* // against the error message, Node.js throws an `ERR_AMBIGUOUS_ARGUMENT` error.
|
665 |
+
* assert.throws(throwingSecond, 'Second');
|
666 |
+
* // TypeError [ERR_AMBIGUOUS_ARGUMENT]
|
667 |
+
*
|
668 |
+
* // The string is only used (as message) in case the function does not throw:
|
669 |
+
* assert.throws(notThrowing, 'Second');
|
670 |
+
* // AssertionError [ERR_ASSERTION]: Missing expected exception: Second
|
671 |
+
*
|
672 |
+
* // If it was intended to match for the error message do this instead:
|
673 |
+
* // It does not throw because the error messages match.
|
674 |
+
* assert.throws(throwingSecond, /Second$/);
|
675 |
+
*
|
676 |
+
* // If the error message does not match, an AssertionError is thrown.
|
677 |
+
* assert.throws(throwingFirst, /Second$/);
|
678 |
+
* // AssertionError [ERR_ASSERTION]
|
679 |
+
* ```
|
680 |
+
*
|
681 |
+
* Due to the confusing error-prone notation, avoid a string as the second
|
682 |
+
* argument.
|
683 |
+
* @since v0.1.21
|
684 |
+
*/
|
685 |
+
function throws(block: () => unknown, message?: string | Error): void;
|
686 |
+
function throws(block: () => unknown, error: AssertPredicate, message?: string | Error): void;
|
687 |
+
/**
|
688 |
+
* Asserts that the function `fn` does not throw an error.
|
689 |
+
*
|
690 |
+
* Using `assert.doesNotThrow()` is actually not useful because there
|
691 |
+
* is no benefit in catching an error and then rethrowing it. Instead, consider
|
692 |
+
* adding a comment next to the specific code path that should not throw and keep
|
693 |
+
* error messages as expressive as possible.
|
694 |
+
*
|
695 |
+
* When `assert.doesNotThrow()` is called, it will immediately call the `fn`function.
|
696 |
+
*
|
697 |
+
* If an error is thrown and it is the same type as that specified by the `error`parameter, then an `AssertionError` is thrown. If the error is of a
|
698 |
+
* different type, or if the `error` parameter is undefined, the error is
|
699 |
+
* propagated back to the caller.
|
700 |
+
*
|
701 |
+
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
|
702 |
+
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) or a validation
|
703 |
+
* function. See {@link throws} for more details.
|
704 |
+
*
|
705 |
+
* The following, for instance, will throw the `TypeError` because there is no
|
706 |
+
* matching error type in the assertion:
|
707 |
+
*
|
708 |
+
* ```js
|
709 |
+
* import assert from 'assert/strict';
|
710 |
+
*
|
711 |
+
* assert.doesNotThrow(
|
712 |
+
* () => {
|
713 |
+
* throw new TypeError('Wrong value');
|
714 |
+
* },
|
715 |
+
* SyntaxError
|
716 |
+
* );
|
717 |
+
* ```
|
718 |
+
*
|
719 |
+
* However, the following will result in an `AssertionError` with the message
|
720 |
+
* 'Got unwanted exception...':
|
721 |
+
*
|
722 |
+
* ```js
|
723 |
+
* import assert from 'assert/strict';
|
724 |
+
*
|
725 |
+
* assert.doesNotThrow(
|
726 |
+
* () => {
|
727 |
+
* throw new TypeError('Wrong value');
|
728 |
+
* },
|
729 |
+
* TypeError
|
730 |
+
* );
|
731 |
+
* ```
|
732 |
+
*
|
733 |
+
* If an `AssertionError` is thrown and a value is provided for the `message`parameter, the value of `message` will be appended to the `AssertionError` message:
|
734 |
+
*
|
735 |
+
* ```js
|
736 |
+
* import assert from 'assert/strict';
|
737 |
+
*
|
738 |
+
* assert.doesNotThrow(
|
739 |
+
* () => {
|
740 |
+
* throw new TypeError('Wrong value');
|
741 |
+
* },
|
742 |
+
* /Wrong value/,
|
743 |
+
* 'Whoops'
|
744 |
+
* );
|
745 |
+
* // Throws: AssertionError: Got unwanted exception: Whoops
|
746 |
+
* ```
|
747 |
+
* @since v0.1.21
|
748 |
+
*/
|
749 |
+
function doesNotThrow(block: () => unknown, message?: string | Error): void;
|
750 |
+
function doesNotThrow(block: () => unknown, error: AssertPredicate, message?: string | Error): void;
|
751 |
+
/**
|
752 |
+
* Throws `value` if `value` is not `undefined` or `null`. This is useful when
|
753 |
+
* testing the `error` argument in callbacks. The stack trace contains all frames
|
754 |
+
* from the error passed to `ifError()` including the potential new frames for`ifError()` itself.
|
755 |
+
*
|
756 |
+
* ```js
|
757 |
+
* import assert from 'assert/strict';
|
758 |
+
*
|
759 |
+
* assert.ifError(null);
|
760 |
+
* // OK
|
761 |
+
* assert.ifError(0);
|
762 |
+
* // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 0
|
763 |
+
* assert.ifError('error');
|
764 |
+
* // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 'error'
|
765 |
+
* assert.ifError(new Error());
|
766 |
+
* // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: Error
|
767 |
+
*
|
768 |
+
* // Create some random error frames.
|
769 |
+
* let err;
|
770 |
+
* (function errorFrame() {
|
771 |
+
* err = new Error('test error');
|
772 |
+
* })();
|
773 |
+
*
|
774 |
+
* (function ifErrorFrame() {
|
775 |
+
* assert.ifError(err);
|
776 |
+
* })();
|
777 |
+
* // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: test error
|
778 |
+
* // at ifErrorFrame
|
779 |
+
* // at errorFrame
|
780 |
+
* ```
|
781 |
+
* @since v0.1.97
|
782 |
+
*/
|
783 |
+
function ifError(value: unknown): asserts value is null | undefined;
|
784 |
+
/**
|
785 |
+
* Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately
|
786 |
+
* calls the function and awaits the returned promise to complete. It will then
|
787 |
+
* check that the promise is rejected.
|
788 |
+
*
|
789 |
+
* If `asyncFn` is a function and it throws an error synchronously,`assert.rejects()` will return a rejected `Promise` with that error. If the
|
790 |
+
* function does not return a promise, `assert.rejects()` will return a rejected`Promise` with an `ERR_INVALID_RETURN_VALUE` error. In both cases the error
|
791 |
+
* handler is skipped.
|
792 |
+
*
|
793 |
+
* Besides the async nature to await the completion behaves identically to {@link throws}.
|
794 |
+
*
|
795 |
+
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
|
796 |
+
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function,
|
797 |
+
* an object where each property will be tested for, or an instance of error where
|
798 |
+
* each property will be tested for including the non-enumerable `message` and`name` properties.
|
799 |
+
*
|
800 |
+
* If specified, `message` will be the message provided by the `AssertionError` if the `asyncFn` fails to reject.
|
801 |
+
*
|
802 |
+
* ```js
|
803 |
+
* import assert from 'assert/strict';
|
804 |
+
*
|
805 |
+
* await assert.rejects(
|
806 |
+
* async () => {
|
807 |
+
* throw new TypeError('Wrong value');
|
808 |
+
* },
|
809 |
+
* {
|
810 |
+
* name: 'TypeError',
|
811 |
+
* message: 'Wrong value'
|
812 |
+
* }
|
813 |
+
* );
|
814 |
+
* ```
|
815 |
+
*
|
816 |
+
* ```js
|
817 |
+
* import assert from 'assert/strict';
|
818 |
+
*
|
819 |
+
* await assert.rejects(
|
820 |
+
* async () => {
|
821 |
+
* throw new TypeError('Wrong value');
|
822 |
+
* },
|
823 |
+
* (err) => {
|
824 |
+
* assert.strictEqual(err.name, 'TypeError');
|
825 |
+
* assert.strictEqual(err.message, 'Wrong value');
|
826 |
+
* return true;
|
827 |
+
* }
|
828 |
+
* );
|
829 |
+
* ```
|
830 |
+
*
|
831 |
+
* ```js
|
832 |
+
* import assert from 'assert/strict';
|
833 |
+
*
|
834 |
+
* assert.rejects(
|
835 |
+
* Promise.reject(new Error('Wrong value')),
|
836 |
+
* Error
|
837 |
+
* ).then(() => {
|
838 |
+
* // ...
|
839 |
+
* });
|
840 |
+
* ```
|
841 |
+
*
|
842 |
+
* `error` cannot be a string. If a string is provided as the second
|
843 |
+
* argument, then `error` is assumed to be omitted and the string will be used for`message` instead. This can lead to easy-to-miss mistakes. Please read the
|
844 |
+
* example in {@link throws} carefully if using a string as the second
|
845 |
+
* argument gets considered.
|
846 |
+
* @since v10.0.0
|
847 |
+
*/
|
848 |
+
function rejects(block: (() => Promise<unknown>) | Promise<unknown>, message?: string | Error): Promise<void>;
|
849 |
+
function rejects(
|
850 |
+
block: (() => Promise<unknown>) | Promise<unknown>,
|
851 |
+
error: AssertPredicate,
|
852 |
+
message?: string | Error,
|
853 |
+
): Promise<void>;
|
854 |
+
/**
|
855 |
+
* Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately
|
856 |
+
* calls the function and awaits the returned promise to complete. It will then
|
857 |
+
* check that the promise is not rejected.
|
858 |
+
*
|
859 |
+
* If `asyncFn` is a function and it throws an error synchronously,`assert.doesNotReject()` will return a rejected `Promise` with that error. If
|
860 |
+
* the function does not return a promise, `assert.doesNotReject()` will return a
|
861 |
+
* rejected `Promise` with an `ERR_INVALID_RETURN_VALUE` error. In both cases
|
862 |
+
* the error handler is skipped.
|
863 |
+
*
|
864 |
+
* Using `assert.doesNotReject()` is actually not useful because there is little
|
865 |
+
* benefit in catching a rejection and then rejecting it again. Instead, consider
|
866 |
+
* adding a comment next to the specific code path that should not reject and keep
|
867 |
+
* error messages as expressive as possible.
|
868 |
+
*
|
869 |
+
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
|
870 |
+
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) or a validation
|
871 |
+
* function. See {@link throws} for more details.
|
872 |
+
*
|
873 |
+
* Besides the async nature to await the completion behaves identically to {@link doesNotThrow}.
|
874 |
+
*
|
875 |
+
* ```js
|
876 |
+
* import assert from 'assert/strict';
|
877 |
+
*
|
878 |
+
* await assert.doesNotReject(
|
879 |
+
* async () => {
|
880 |
+
* throw new TypeError('Wrong value');
|
881 |
+
* },
|
882 |
+
* SyntaxError
|
883 |
+
* );
|
884 |
+
* ```
|
885 |
+
*
|
886 |
+
* ```js
|
887 |
+
* import assert from 'assert/strict';
|
888 |
+
*
|
889 |
+
* assert.doesNotReject(Promise.reject(new TypeError('Wrong value')))
|
890 |
+
* .then(() => {
|
891 |
+
* // ...
|
892 |
+
* });
|
893 |
+
* ```
|
894 |
+
* @since v10.0.0
|
895 |
+
*/
|
896 |
+
function doesNotReject(
|
897 |
+
block: (() => Promise<unknown>) | Promise<unknown>,
|
898 |
+
message?: string | Error,
|
899 |
+
): Promise<void>;
|
900 |
+
function doesNotReject(
|
901 |
+
block: (() => Promise<unknown>) | Promise<unknown>,
|
902 |
+
error: AssertPredicate,
|
903 |
+
message?: string | Error,
|
904 |
+
): Promise<void>;
|
905 |
+
/**
|
906 |
+
* Expects the `string` input to match the regular expression.
|
907 |
+
*
|
908 |
+
* ```js
|
909 |
+
* import assert from 'assert/strict';
|
910 |
+
*
|
911 |
+
* assert.match('I will fail', /pass/);
|
912 |
+
* // AssertionError [ERR_ASSERTION]: The input did not match the regular ...
|
913 |
+
*
|
914 |
+
* assert.match(123, /pass/);
|
915 |
+
* // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string.
|
916 |
+
*
|
917 |
+
* assert.match('I will pass', /pass/);
|
918 |
+
* // OK
|
919 |
+
* ```
|
920 |
+
*
|
921 |
+
* If the values do not match, or if the `string` argument is of another type than`string`, an `AssertionError` is thrown with a `message` property set equal
|
922 |
+
* to the value of the `message` parameter. If the `message` parameter is
|
923 |
+
* undefined, a default error message is assigned. If the `message` parameter is an
|
924 |
+
* instance of an `Error` then it will be thrown instead of the `AssertionError`.
|
925 |
+
* @since v13.6.0, v12.16.0
|
926 |
+
*/
|
927 |
+
function match(value: string, regExp: RegExp, message?: string | Error): void;
|
928 |
+
/**
|
929 |
+
* Expects the `string` input not to match the regular expression.
|
930 |
+
*
|
931 |
+
* ```js
|
932 |
+
* import assert from 'assert/strict';
|
933 |
+
*
|
934 |
+
* assert.doesNotMatch('I will fail', /fail/);
|
935 |
+
* // AssertionError [ERR_ASSERTION]: The input was expected to not match the ...
|
936 |
+
*
|
937 |
+
* assert.doesNotMatch(123, /pass/);
|
938 |
+
* // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string.
|
939 |
+
*
|
940 |
+
* assert.doesNotMatch('I will pass', /different/);
|
941 |
+
* // OK
|
942 |
+
* ```
|
943 |
+
*
|
944 |
+
* If the values do match, or if the `string` argument is of another type than`string`, an `AssertionError` is thrown with a `message` property set equal
|
945 |
+
* to the value of the `message` parameter. If the `message` parameter is
|
946 |
+
* undefined, a default error message is assigned. If the `message` parameter is an
|
947 |
+
* instance of an `Error` then it will be thrown instead of the `AssertionError`.
|
948 |
+
* @since v13.6.0, v12.16.0
|
949 |
+
*/
|
950 |
+
function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
|
951 |
+
const strict:
|
952 |
+
& Omit<
|
953 |
+
typeof assert,
|
954 |
+
| "equal"
|
955 |
+
| "notEqual"
|
956 |
+
| "deepEqual"
|
957 |
+
| "notDeepEqual"
|
958 |
+
| "ok"
|
959 |
+
| "strictEqual"
|
960 |
+
| "deepStrictEqual"
|
961 |
+
| "ifError"
|
962 |
+
| "strict"
|
963 |
+
>
|
964 |
+
& {
|
965 |
+
(value: unknown, message?: string | Error): asserts value;
|
966 |
+
equal: typeof strictEqual;
|
967 |
+
notEqual: typeof notStrictEqual;
|
968 |
+
deepEqual: typeof deepStrictEqual;
|
969 |
+
notDeepEqual: typeof notDeepStrictEqual;
|
970 |
+
// Mapped types and assertion functions are incompatible?
|
971 |
+
// TS2775: Assertions require every name in the call target
|
972 |
+
// to be declared with an explicit type annotation.
|
973 |
+
ok: typeof ok;
|
974 |
+
strictEqual: typeof strictEqual;
|
975 |
+
deepStrictEqual: typeof deepStrictEqual;
|
976 |
+
ifError: typeof ifError;
|
977 |
+
strict: typeof strict;
|
978 |
+
};
|
979 |
+
}
|
980 |
+
export = assert;
|
981 |
+
}
|
982 |
+
declare module "node:assert" {
|
983 |
+
import assert = require("assert");
|
984 |
+
export = assert;
|
985 |
+
}
|
backend/node_modules/@types/node/assert/strict.d.ts
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
}
|
backend/node_modules/@types/node/async_hooks.d.ts
ADDED
@@ -0,0 +1,522 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* The `async_hooks` module provides an API to track asynchronous resources. It
|
3 |
+
* can be accessed using:
|
4 |
+
*
|
5 |
+
* ```js
|
6 |
+
* import async_hooks from 'async_hooks';
|
7 |
+
* ```
|
8 |
+
* @experimental
|
9 |
+
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/async_hooks.js)
|
10 |
+
*/
|
11 |
+
declare module "async_hooks" {
|
12 |
+
/**
|
13 |
+
* ```js
|
14 |
+
* import { executionAsyncId } from 'async_hooks';
|
15 |
+
*
|
16 |
+
* console.log(executionAsyncId()); // 1 - bootstrap
|
17 |
+
* fs.open(path, 'r', (err, fd) => {
|
18 |
+
* console.log(executionAsyncId()); // 6 - open()
|
19 |
+
* });
|
20 |
+
* ```
|
21 |
+
*
|
22 |
+
* The ID returned from `executionAsyncId()` is related to execution timing, not
|
23 |
+
* causality (which is covered by `triggerAsyncId()`):
|
24 |
+
*
|
25 |
+
* ```js
|
26 |
+
* const server = net.createServer((conn) => {
|
27 |
+
* // Returns the ID of the server, not of the new connection, because the
|
28 |
+
* // callback runs in the execution scope of the server's MakeCallback().
|
29 |
+
* async_hooks.executionAsyncId();
|
30 |
+
*
|
31 |
+
* }).listen(port, () => {
|
32 |
+
* // Returns the ID of a TickObject (process.nextTick()) because all
|
33 |
+
* // callbacks passed to .listen() are wrapped in a nextTick().
|
34 |
+
* async_hooks.executionAsyncId();
|
35 |
+
* });
|
36 |
+
* ```
|
37 |
+
*
|
38 |
+
* Promise contexts may not get precise `executionAsyncIds` by default.
|
39 |
+
* See the section on `promise execution tracking`.
|
40 |
+
* @since v8.1.0
|
41 |
+
* @return The `asyncId` of the current execution context. Useful to track when something calls.
|
42 |
+
*/
|
43 |
+
function executionAsyncId(): number;
|
44 |
+
/**
|
45 |
+
* Resource objects returned by `executionAsyncResource()` are most often internal
|
46 |
+
* Node.js handle objects with undocumented APIs. Using any functions or properties
|
47 |
+
* on the object is likely to crash your application and should be avoided.
|
48 |
+
*
|
49 |
+
* Using `executionAsyncResource()` in the top-level execution context will
|
50 |
+
* return an empty object as there is no handle or request object to use,
|
51 |
+
* but having an object representing the top-level can be helpful.
|
52 |
+
*
|
53 |
+
* ```js
|
54 |
+
* import { open } from 'fs';
|
55 |
+
* import { executionAsyncId, executionAsyncResource } from 'async_hooks';
|
56 |
+
*
|
57 |
+
* console.log(executionAsyncId(), executionAsyncResource()); // 1 {}
|
58 |
+
* open(new URL(import.meta.url), 'r', (err, fd) => {
|
59 |
+
* console.log(executionAsyncId(), executionAsyncResource()); // 7 FSReqWrap
|
60 |
+
* });
|
61 |
+
* ```
|
62 |
+
*
|
63 |
+
* This can be used to implement continuation local storage without the
|
64 |
+
* use of a tracking `Map` to store the metadata:
|
65 |
+
*
|
66 |
+
* ```js
|
67 |
+
* import { createServer } from 'http';
|
68 |
+
* import {
|
69 |
+
* executionAsyncId,
|
70 |
+
* executionAsyncResource,
|
71 |
+
* createHook
|
72 |
+
* } from 'async_hooks';
|
73 |
+
* const sym = Symbol('state'); // Private symbol to avoid pollution
|
74 |
+
*
|
75 |
+
* createHook({
|
76 |
+
* init(asyncId, type, triggerAsyncId, resource) {
|
77 |
+
* const cr = executionAsyncResource();
|
78 |
+
* if (cr) {
|
79 |
+
* resource[sym] = cr[sym];
|
80 |
+
* }
|
81 |
+
* }
|
82 |
+
* }).enable();
|
83 |
+
*
|
84 |
+
* const server = createServer((req, res) => {
|
85 |
+
* executionAsyncResource()[sym] = { state: req.url };
|
86 |
+
* setTimeout(function() {
|
87 |
+
* res.end(JSON.stringify(executionAsyncResource()[sym]));
|
88 |
+
* }, 100);
|
89 |
+
* }).listen(3000);
|
90 |
+
* ```
|
91 |
+
* @since v13.9.0, v12.17.0
|
92 |
+
* @return The resource representing the current execution. Useful to store data within the resource.
|
93 |
+
*/
|
94 |
+
function executionAsyncResource(): object;
|
95 |
+
/**
|
96 |
+
* ```js
|
97 |
+
* const server = net.createServer((conn) => {
|
98 |
+
* // The resource that caused (or triggered) this callback to be called
|
99 |
+
* // was that of the new connection. Thus the return value of triggerAsyncId()
|
100 |
+
* // is the asyncId of "conn".
|
101 |
+
* async_hooks.triggerAsyncId();
|
102 |
+
*
|
103 |
+
* }).listen(port, () => {
|
104 |
+
* // Even though all callbacks passed to .listen() are wrapped in a nextTick()
|
105 |
+
* // the callback itself exists because the call to the server's .listen()
|
106 |
+
* // was made. So the return value would be the ID of the server.
|
107 |
+
* async_hooks.triggerAsyncId();
|
108 |
+
* });
|
109 |
+
* ```
|
110 |
+
*
|
111 |
+
* Promise contexts may not get valid `triggerAsyncId`s by default. See
|
112 |
+
* the section on `promise execution tracking`.
|
113 |
+
* @return The ID of the resource responsible for calling the callback that is currently being executed.
|
114 |
+
*/
|
115 |
+
function triggerAsyncId(): number;
|
116 |
+
interface HookCallbacks {
|
117 |
+
/**
|
118 |
+
* Called when a class is constructed that has the possibility to emit an asynchronous event.
|
119 |
+
* @param asyncId a unique ID for the async resource
|
120 |
+
* @param type the type of the async resource
|
121 |
+
* @param triggerAsyncId the unique ID of the async resource in whose execution context this async resource was created
|
122 |
+
* @param resource reference to the resource representing the async operation, needs to be released during destroy
|
123 |
+
*/
|
124 |
+
init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void;
|
125 |
+
/**
|
126 |
+
* When an asynchronous operation is initiated or completes a callback is called to notify the user.
|
127 |
+
* The before callback is called just before said callback is executed.
|
128 |
+
* @param asyncId the unique identifier assigned to the resource about to execute the callback.
|
129 |
+
*/
|
130 |
+
before?(asyncId: number): void;
|
131 |
+
/**
|
132 |
+
* Called immediately after the callback specified in before is completed.
|
133 |
+
* @param asyncId the unique identifier assigned to the resource which has executed the callback.
|
134 |
+
*/
|
135 |
+
after?(asyncId: number): void;
|
136 |
+
/**
|
137 |
+
* Called when a promise has resolve() called. This may not be in the same execution id
|
138 |
+
* as the promise itself.
|
139 |
+
* @param asyncId the unique id for the promise that was resolve()d.
|
140 |
+
*/
|
141 |
+
promiseResolve?(asyncId: number): void;
|
142 |
+
/**
|
143 |
+
* Called after the resource corresponding to asyncId is destroyed
|
144 |
+
* @param asyncId a unique ID for the async resource
|
145 |
+
*/
|
146 |
+
destroy?(asyncId: number): void;
|
147 |
+
}
|
148 |
+
interface AsyncHook {
|
149 |
+
/**
|
150 |
+
* Enable the callbacks for a given AsyncHook instance. If no callbacks are provided enabling is a noop.
|
151 |
+
*/
|
152 |
+
enable(): this;
|
153 |
+
/**
|
154 |
+
* Disable the callbacks for a given AsyncHook instance from the global pool of AsyncHook callbacks to be executed. Once a hook has been disabled it will not be called again until enabled.
|
155 |
+
*/
|
156 |
+
disable(): this;
|
157 |
+
}
|
158 |
+
/**
|
159 |
+
* Registers functions to be called for different lifetime events of each async
|
160 |
+
* operation.
|
161 |
+
*
|
162 |
+
* The callbacks `init()`/`before()`/`after()`/`destroy()` are called for the
|
163 |
+
* respective asynchronous event during a resource's lifetime.
|
164 |
+
*
|
165 |
+
* All callbacks are optional. For example, if only resource cleanup needs to
|
166 |
+
* be tracked, then only the `destroy` callback needs to be passed. The
|
167 |
+
* specifics of all functions that can be passed to `callbacks` is in the `Hook Callbacks` section.
|
168 |
+
*
|
169 |
+
* ```js
|
170 |
+
* import { createHook } from 'async_hooks';
|
171 |
+
*
|
172 |
+
* const asyncHook = createHook({
|
173 |
+
* init(asyncId, type, triggerAsyncId, resource) { },
|
174 |
+
* destroy(asyncId) { }
|
175 |
+
* });
|
176 |
+
* ```
|
177 |
+
*
|
178 |
+
* The callbacks will be inherited via the prototype chain:
|
179 |
+
*
|
180 |
+
* ```js
|
181 |
+
* class MyAsyncCallbacks {
|
182 |
+
* init(asyncId, type, triggerAsyncId, resource) { }
|
183 |
+
* destroy(asyncId) {}
|
184 |
+
* }
|
185 |
+
*
|
186 |
+
* class MyAddedCallbacks extends MyAsyncCallbacks {
|
187 |
+
* before(asyncId) { }
|
188 |
+
* after(asyncId) { }
|
189 |
+
* }
|
190 |
+
*
|
191 |
+
* const asyncHook = async_hooks.createHook(new MyAddedCallbacks());
|
192 |
+
* ```
|
193 |
+
*
|
194 |
+
* Because promises are asynchronous resources whose lifecycle is tracked
|
195 |
+
* via the async hooks mechanism, the `init()`, `before()`, `after()`, and`destroy()` callbacks _must not_ be async functions that return promises.
|
196 |
+
* @since v8.1.0
|
197 |
+
* @param callbacks The `Hook Callbacks` to register
|
198 |
+
* @return Instance used for disabling and enabling hooks
|
199 |
+
*/
|
200 |
+
function createHook(callbacks: HookCallbacks): AsyncHook;
|
201 |
+
interface AsyncResourceOptions {
|
202 |
+
/**
|
203 |
+
* The ID of the execution context that created this async event.
|
204 |
+
* @default executionAsyncId()
|
205 |
+
*/
|
206 |
+
triggerAsyncId?: number | undefined;
|
207 |
+
/**
|
208 |
+
* Disables automatic `emitDestroy` when the object is garbage collected.
|
209 |
+
* This usually does not need to be set (even if `emitDestroy` is called
|
210 |
+
* manually), unless the resource's `asyncId` is retrieved and the
|
211 |
+
* sensitive API's `emitDestroy` is called with it.
|
212 |
+
* @default false
|
213 |
+
*/
|
214 |
+
requireManualDestroy?: boolean | undefined;
|
215 |
+
}
|
216 |
+
/**
|
217 |
+
* The class `AsyncResource` is designed to be extended by the embedder's async
|
218 |
+
* resources. Using this, users can easily trigger the lifetime events of their
|
219 |
+
* own resources.
|
220 |
+
*
|
221 |
+
* The `init` hook will trigger when an `AsyncResource` is instantiated.
|
222 |
+
*
|
223 |
+
* The following is an overview of the `AsyncResource` API.
|
224 |
+
*
|
225 |
+
* ```js
|
226 |
+
* import { AsyncResource, executionAsyncId } from 'async_hooks';
|
227 |
+
*
|
228 |
+
* // AsyncResource() is meant to be extended. Instantiating a
|
229 |
+
* // new AsyncResource() also triggers init. If triggerAsyncId is omitted then
|
230 |
+
* // async_hook.executionAsyncId() is used.
|
231 |
+
* const asyncResource = new AsyncResource(
|
232 |
+
* type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false }
|
233 |
+
* );
|
234 |
+
*
|
235 |
+
* // Run a function in the execution context of the resource. This will
|
236 |
+
* // * establish the context of the resource
|
237 |
+
* // * trigger the AsyncHooks before callbacks
|
238 |
+
* // * call the provided function `fn` with the supplied arguments
|
239 |
+
* // * trigger the AsyncHooks after callbacks
|
240 |
+
* // * restore the original execution context
|
241 |
+
* asyncResource.runInAsyncScope(fn, thisArg, ...args);
|
242 |
+
*
|
243 |
+
* // Call AsyncHooks destroy callbacks.
|
244 |
+
* asyncResource.emitDestroy();
|
245 |
+
*
|
246 |
+
* // Return the unique ID assigned to the AsyncResource instance.
|
247 |
+
* asyncResource.asyncId();
|
248 |
+
*
|
249 |
+
* // Return the trigger ID for the AsyncResource instance.
|
250 |
+
* asyncResource.triggerAsyncId();
|
251 |
+
* ```
|
252 |
+
*/
|
253 |
+
class AsyncResource {
|
254 |
+
/**
|
255 |
+
* AsyncResource() is meant to be extended. Instantiating a
|
256 |
+
* new AsyncResource() also triggers init. If triggerAsyncId is omitted then
|
257 |
+
* async_hook.executionAsyncId() is used.
|
258 |
+
* @param type The type of async event.
|
259 |
+
* @param triggerAsyncId The ID of the execution context that created
|
260 |
+
* this async event (default: `executionAsyncId()`), or an
|
261 |
+
* AsyncResourceOptions object (since v9.3.0)
|
262 |
+
*/
|
263 |
+
constructor(type: string, triggerAsyncId?: number | AsyncResourceOptions);
|
264 |
+
/**
|
265 |
+
* Binds the given function to the current execution context.
|
266 |
+
*
|
267 |
+
* The returned function will have an `asyncResource` property referencing
|
268 |
+
* the `AsyncResource` to which the function is bound.
|
269 |
+
* @since v14.8.0, v12.19.0
|
270 |
+
* @param fn The function to bind to the current execution context.
|
271 |
+
* @param type An optional name to associate with the underlying `AsyncResource`.
|
272 |
+
*/
|
273 |
+
static bind<Func extends (this: ThisArg, ...args: any[]) => any, ThisArg>(
|
274 |
+
fn: Func,
|
275 |
+
type?: string,
|
276 |
+
thisArg?: ThisArg,
|
277 |
+
): Func & {
|
278 |
+
asyncResource: AsyncResource;
|
279 |
+
};
|
280 |
+
/**
|
281 |
+
* Binds the given function to execute to this `AsyncResource`'s scope.
|
282 |
+
*
|
283 |
+
* The returned function will have an `asyncResource` property referencing
|
284 |
+
* the `AsyncResource` to which the function is bound.
|
285 |
+
* @since v14.8.0, v12.19.0
|
286 |
+
* @param fn The function to bind to the current `AsyncResource`.
|
287 |
+
*/
|
288 |
+
bind<Func extends (...args: any[]) => any>(
|
289 |
+
fn: Func,
|
290 |
+
): Func & {
|
291 |
+
asyncResource: AsyncResource;
|
292 |
+
};
|
293 |
+
/**
|
294 |
+
* Call the provided function with the provided arguments in the execution context
|
295 |
+
* of the async resource. This will establish the context, trigger the AsyncHooks
|
296 |
+
* before callbacks, call the function, trigger the AsyncHooks after callbacks, and
|
297 |
+
* then restore the original execution context.
|
298 |
+
* @since v9.6.0
|
299 |
+
* @param fn The function to call in the execution context of this async resource.
|
300 |
+
* @param thisArg The receiver to be used for the function call.
|
301 |
+
* @param args Optional arguments to pass to the function.
|
302 |
+
*/
|
303 |
+
runInAsyncScope<This, Result>(
|
304 |
+
fn: (this: This, ...args: any[]) => Result,
|
305 |
+
thisArg?: This,
|
306 |
+
...args: any[]
|
307 |
+
): Result;
|
308 |
+
/**
|
309 |
+
* Call all `destroy` hooks. This should only ever be called once. An error will
|
310 |
+
* be thrown if it is called more than once. This **must** be manually called. If
|
311 |
+
* the resource is left to be collected by the GC then the `destroy` hooks will
|
312 |
+
* never be called.
|
313 |
+
* @return A reference to `asyncResource`.
|
314 |
+
*/
|
315 |
+
emitDestroy(): this;
|
316 |
+
/**
|
317 |
+
* @return The unique `asyncId` assigned to the resource.
|
318 |
+
*/
|
319 |
+
asyncId(): number;
|
320 |
+
/**
|
321 |
+
* @return The same `triggerAsyncId` that is passed to the `AsyncResource` constructor.
|
322 |
+
*/
|
323 |
+
triggerAsyncId(): number;
|
324 |
+
}
|
325 |
+
/**
|
326 |
+
* This class creates stores that stay coherent through asynchronous operations.
|
327 |
+
*
|
328 |
+
* While you can create your own implementation on top of the `async_hooks` module,`AsyncLocalStorage` should be preferred as it is a performant and memory safe
|
329 |
+
* implementation that involves significant optimizations that are non-obvious to
|
330 |
+
* implement.
|
331 |
+
*
|
332 |
+
* The following example uses `AsyncLocalStorage` to build a simple logger
|
333 |
+
* that assigns IDs to incoming HTTP requests and includes them in messages
|
334 |
+
* logged within each request.
|
335 |
+
*
|
336 |
+
* ```js
|
337 |
+
* import http from 'http';
|
338 |
+
* import { AsyncLocalStorage } from 'async_hooks';
|
339 |
+
*
|
340 |
+
* const asyncLocalStorage = new AsyncLocalStorage();
|
341 |
+
*
|
342 |
+
* function logWithId(msg) {
|
343 |
+
* const id = asyncLocalStorage.getStore();
|
344 |
+
* console.log(`${id !== undefined ? id : '-'}:`, msg);
|
345 |
+
* }
|
346 |
+
*
|
347 |
+
* let idSeq = 0;
|
348 |
+
* http.createServer((req, res) => {
|
349 |
+
* asyncLocalStorage.run(idSeq++, () => {
|
350 |
+
* logWithId('start');
|
351 |
+
* // Imagine any chain of async operations here
|
352 |
+
* setImmediate(() => {
|
353 |
+
* logWithId('finish');
|
354 |
+
* res.end();
|
355 |
+
* });
|
356 |
+
* });
|
357 |
+
* }).listen(8080);
|
358 |
+
*
|
359 |
+
* http.get('http://localhost:8080');
|
360 |
+
* http.get('http://localhost:8080');
|
361 |
+
* // Prints:
|
362 |
+
* // 0: start
|
363 |
+
* // 1: start
|
364 |
+
* // 0: finish
|
365 |
+
* // 1: finish
|
366 |
+
* ```
|
367 |
+
*
|
368 |
+
* Each instance of `AsyncLocalStorage` maintains an independent storage context.
|
369 |
+
* Multiple instances can safely exist simultaneously without risk of interfering
|
370 |
+
* with each other's data.
|
371 |
+
* @since v13.10.0, v12.17.0
|
372 |
+
*/
|
373 |
+
class AsyncLocalStorage<T> {
|
374 |
+
/**
|
375 |
+
* Binds the given function to the current execution context.
|
376 |
+
* @since v18.16.0
|
377 |
+
* @param fn The function to bind to the current execution context.
|
378 |
+
* @returns A new function that calls `fn` within the captured execution context.
|
379 |
+
*/
|
380 |
+
static bind<Func extends (...args: any[]) => any>(fn: Func): Func & {
|
381 |
+
asyncResource: AsyncResource;
|
382 |
+
};
|
383 |
+
/**
|
384 |
+
* Captures the current execution context and returns a function that accepts a function as an argument.
|
385 |
+
* Whenever the returned function is called, it calls the function passed to it within the captured context.
|
386 |
+
* @since v18.16.0
|
387 |
+
*/
|
388 |
+
static snapshot(): (<R, TArgs extends any[]>(fn: (...args: TArgs) => R, ...args: TArgs) => R) & {
|
389 |
+
asyncResource: AsyncResource;
|
390 |
+
};
|
391 |
+
/**
|
392 |
+
* Disables the instance of `AsyncLocalStorage`. All subsequent calls
|
393 |
+
* to `asyncLocalStorage.getStore()` will return `undefined` until`asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again.
|
394 |
+
*
|
395 |
+
* When calling `asyncLocalStorage.disable()`, all current contexts linked to the
|
396 |
+
* instance will be exited.
|
397 |
+
*
|
398 |
+
* Calling `asyncLocalStorage.disable()` is required before the`asyncLocalStorage` can be garbage collected. This does not apply to stores
|
399 |
+
* provided by the `asyncLocalStorage`, as those objects are garbage collected
|
400 |
+
* along with the corresponding async resources.
|
401 |
+
*
|
402 |
+
* Use this method when the `asyncLocalStorage` is not in use anymore
|
403 |
+
* in the current process.
|
404 |
+
* @since v13.10.0, v12.17.0
|
405 |
+
* @experimental
|
406 |
+
*/
|
407 |
+
disable(): void;
|
408 |
+
/**
|
409 |
+
* Returns the current store.
|
410 |
+
* If called outside of an asynchronous context initialized by
|
411 |
+
* calling `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()`, it
|
412 |
+
* returns `undefined`.
|
413 |
+
* @since v13.10.0, v12.17.0
|
414 |
+
*/
|
415 |
+
getStore(): T | undefined;
|
416 |
+
/**
|
417 |
+
* Runs a function synchronously within a context and returns its
|
418 |
+
* return value. The store is not accessible outside of the callback function.
|
419 |
+
* The store is accessible to any asynchronous operations created within the
|
420 |
+
* callback.
|
421 |
+
*
|
422 |
+
* The optional `args` are passed to the callback function.
|
423 |
+
*
|
424 |
+
* If the callback function throws an error, the error is thrown by `run()` too.
|
425 |
+
* The stacktrace is not impacted by this call and the context is exited.
|
426 |
+
*
|
427 |
+
* Example:
|
428 |
+
*
|
429 |
+
* ```js
|
430 |
+
* const store = { id: 2 };
|
431 |
+
* try {
|
432 |
+
* asyncLocalStorage.run(store, () => {
|
433 |
+
* asyncLocalStorage.getStore(); // Returns the store object
|
434 |
+
* setTimeout(() => {
|
435 |
+
* asyncLocalStorage.getStore(); // Returns the store object
|
436 |
+
* }, 200);
|
437 |
+
* throw new Error();
|
438 |
+
* });
|
439 |
+
* } catch (e) {
|
440 |
+
* asyncLocalStorage.getStore(); // Returns undefined
|
441 |
+
* // The error will be caught here
|
442 |
+
* }
|
443 |
+
* ```
|
444 |
+
* @since v13.10.0, v12.17.0
|
445 |
+
*/
|
446 |
+
run<R>(store: T, callback: () => R): R;
|
447 |
+
run<R, TArgs extends any[]>(store: T, callback: (...args: TArgs) => R, ...args: TArgs): R;
|
448 |
+
/**
|
449 |
+
* Runs a function synchronously outside of a context and returns its
|
450 |
+
* return value. The store is not accessible within the callback function or
|
451 |
+
* the asynchronous operations created within the callback. Any `getStore()`call done within the callback function will always return `undefined`.
|
452 |
+
*
|
453 |
+
* The optional `args` are passed to the callback function.
|
454 |
+
*
|
455 |
+
* If the callback function throws an error, the error is thrown by `exit()` too.
|
456 |
+
* The stacktrace is not impacted by this call and the context is re-entered.
|
457 |
+
*
|
458 |
+
* Example:
|
459 |
+
*
|
460 |
+
* ```js
|
461 |
+
* // Within a call to run
|
462 |
+
* try {
|
463 |
+
* asyncLocalStorage.getStore(); // Returns the store object or value
|
464 |
+
* asyncLocalStorage.exit(() => {
|
465 |
+
* asyncLocalStorage.getStore(); // Returns undefined
|
466 |
+
* throw new Error();
|
467 |
+
* });
|
468 |
+
* } catch (e) {
|
469 |
+
* asyncLocalStorage.getStore(); // Returns the same object or value
|
470 |
+
* // The error will be caught here
|
471 |
+
* }
|
472 |
+
* ```
|
473 |
+
* @since v13.10.0, v12.17.0
|
474 |
+
* @experimental
|
475 |
+
*/
|
476 |
+
exit<R, TArgs extends any[]>(callback: (...args: TArgs) => R, ...args: TArgs): R;
|
477 |
+
/**
|
478 |
+
* Transitions into the context for the remainder of the current
|
479 |
+
* synchronous execution and then persists the store through any following
|
480 |
+
* asynchronous calls.
|
481 |
+
*
|
482 |
+
* Example:
|
483 |
+
*
|
484 |
+
* ```js
|
485 |
+
* const store = { id: 1 };
|
486 |
+
* // Replaces previous store with the given store object
|
487 |
+
* asyncLocalStorage.enterWith(store);
|
488 |
+
* asyncLocalStorage.getStore(); // Returns the store object
|
489 |
+
* someAsyncOperation(() => {
|
490 |
+
* asyncLocalStorage.getStore(); // Returns the same object
|
491 |
+
* });
|
492 |
+
* ```
|
493 |
+
*
|
494 |
+
* This transition will continue for the _entire_ synchronous execution.
|
495 |
+
* This means that if, for example, the context is entered within an event
|
496 |
+
* handler subsequent event handlers will also run within that context unless
|
497 |
+
* specifically bound to another context with an `AsyncResource`. That is why`run()` should be preferred over `enterWith()` unless there are strong reasons
|
498 |
+
* to use the latter method.
|
499 |
+
*
|
500 |
+
* ```js
|
501 |
+
* const store = { id: 1 };
|
502 |
+
*
|
503 |
+
* emitter.on('my-event', () => {
|
504 |
+
* asyncLocalStorage.enterWith(store);
|
505 |
+
* });
|
506 |
+
* emitter.on('my-event', () => {
|
507 |
+
* asyncLocalStorage.getStore(); // Returns the same object
|
508 |
+
* });
|
509 |
+
*
|
510 |
+
* asyncLocalStorage.getStore(); // Returns undefined
|
511 |
+
* emitter.emit('my-event');
|
512 |
+
* asyncLocalStorage.getStore(); // Returns the same object
|
513 |
+
* ```
|
514 |
+
* @since v13.11.0, v12.17.0
|
515 |
+
* @experimental
|
516 |
+
*/
|
517 |
+
enterWith(store: T): void;
|
518 |
+
}
|
519 |
+
}
|
520 |
+
declare module "node:async_hooks" {
|
521 |
+
export * from "async_hooks";
|
522 |
+
}
|
backend/node_modules/@types/node/buffer.d.ts
ADDED
The diff for this file is too large to render.
See raw diff
|
|
backend/node_modules/@types/node/child_process.d.ts
ADDED
@@ -0,0 +1,1544 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* The `child_process` module provides the ability to spawn subprocesses in
|
3 |
+
* a manner that is similar, but not identical, to [`popen(3)`](http://man7.org/linux/man-pages/man3/popen.3.html). This capability
|
4 |
+
* is primarily provided by the {@link spawn} function:
|
5 |
+
*
|
6 |
+
* ```js
|
7 |
+
* const { spawn } = require('child_process');
|
8 |
+
* const ls = spawn('ls', ['-lh', '/usr']);
|
9 |
+
*
|
10 |
+
* ls.stdout.on('data', (data) => {
|
11 |
+
* console.log(`stdout: ${data}`);
|
12 |
+
* });
|
13 |
+
*
|
14 |
+
* ls.stderr.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
|
31 |
+
* variable if `env` is in the `options` object. Otherwise, `process.env.PATH` is
|
32 |
+
* used. If `options.env` is set without `PATH`, lookup on Unix is performed
|
33 |
+
* on a default search path search of `/usr/bin:/bin` (see your operating system's
|
34 |
+
* manual for execvpe/execvp), on Windows the current processes environment
|
35 |
+
* variable `PATH` is used.
|
36 |
+
*
|
37 |
+
* On Windows, environment variables are case-insensitive. Node.js
|
38 |
+
* lexicographically sorts the `env` keys and uses the first one that
|
39 |
+
* case-insensitively matches. Only first (in lexicographic order) entry will be
|
40 |
+
* passed to the subprocess. This might lead to issues on Windows when passing
|
41 |
+
* objects to the `env` option that have multiple variants of the same key, such as`PATH` and `Path`.
|
42 |
+
*
|
43 |
+
* The {@link spawn} method spawns the child process asynchronously,
|
44 |
+
* without blocking the Node.js event loop. The {@link spawnSync} function provides equivalent functionality in a synchronous manner that blocks
|
45 |
+
* the event loop until the spawned process either exits or is terminated.
|
46 |
+
*
|
47 |
+
* For convenience, the `child_process` module provides a handful of synchronous
|
48 |
+
* and asynchronous alternatives to {@link spawn} and {@link spawnSync}. Each of these alternatives are implemented on
|
49 |
+
* top of {@link spawn} or {@link spawnSync}.
|
50 |
+
*
|
51 |
+
* * {@link exec}: spawns a shell and runs a command within that
|
52 |
+
* shell, passing the `stdout` and `stderr` to a callback function when
|
53 |
+
* complete.
|
54 |
+
* * {@link execFile}: similar to {@link exec} except
|
55 |
+
* that it spawns the command directly without first spawning a shell by
|
56 |
+
* default.
|
57 |
+
* * {@link fork}: spawns a new Node.js process and invokes a
|
58 |
+
* specified module with an IPC communication channel established that allows
|
59 |
+
* sending messages between parent and child.
|
60 |
+
* * {@link execSync}: a synchronous version of {@link exec} that will block the Node.js event loop.
|
61 |
+
* * {@link execFileSync}: a synchronous version of {@link execFile} that will block the Node.js event loop.
|
62 |
+
*
|
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/v18.0.0/lib/child_process.js)
|
67 |
+
*/
|
68 |
+
declare module "child_process" {
|
69 |
+
import { ObjectEncodingOptions } from "node:fs";
|
70 |
+
import { Abortable, EventEmitter } from "node:events";
|
71 |
+
import * as net from "node:net";
|
72 |
+
import { Pipe, Readable, Stream, Writable } from "node:stream";
|
73 |
+
import { URL } from "node:url";
|
74 |
+
type Serializable = string | object | number | boolean | bigint;
|
75 |
+
type SendHandle = net.Socket | net.Server;
|
76 |
+
/**
|
77 |
+
* Instances of the `ChildProcess` represent spawned child processes.
|
78 |
+
*
|
79 |
+
* Instances of `ChildProcess` are not intended to be created directly. Rather,
|
80 |
+
* use the {@link spawn}, {@link exec},{@link execFile}, or {@link fork} methods to create
|
81 |
+
* instances of `ChildProcess`.
|
82 |
+
* @since v2.2.0
|
83 |
+
*/
|
84 |
+
class ChildProcess extends EventEmitter {
|
85 |
+
/**
|
86 |
+
* A `Writable Stream` that represents the child process's `stdin`.
|
87 |
+
*
|
88 |
+
* If a child process waits to read all of its input, the child will not continue
|
89 |
+
* until this stream has been closed via `end()`.
|
90 |
+
*
|
91 |
+
* If the child was spawned with `stdio[0]` set to anything other than `'pipe'`,
|
92 |
+
* then this will be `null`.
|
93 |
+
*
|
94 |
+
* `subprocess.stdin` is an alias for `subprocess.stdio[0]`. Both properties will
|
95 |
+
* refer to the same value.
|
96 |
+
*
|
97 |
+
* The `subprocess.stdin` property can be `undefined` if the child process could
|
98 |
+
* not be successfully spawned.
|
99 |
+
* @since v0.1.90
|
100 |
+
*/
|
101 |
+
stdin: Writable | null;
|
102 |
+
/**
|
103 |
+
* A `Readable Stream` that represents the child process's `stdout`.
|
104 |
+
*
|
105 |
+
* If the child was spawned with `stdio[1]` set to anything other than `'pipe'`,
|
106 |
+
* then this will be `null`.
|
107 |
+
*
|
108 |
+
* `subprocess.stdout` is an alias for `subprocess.stdio[1]`. Both properties will
|
109 |
+
* refer to the same value.
|
110 |
+
*
|
111 |
+
* ```js
|
112 |
+
* const { spawn } = require('child_process');
|
113 |
+
*
|
114 |
+
* const subprocess = spawn('ls');
|
115 |
+
*
|
116 |
+
* subprocess.stdout.on('data', (data) => {
|
117 |
+
* console.log(`Received chunk ${data}`);
|
118 |
+
* });
|
119 |
+
* ```
|
120 |
+
*
|
121 |
+
* The `subprocess.stdout` property can be `null` if the child process could
|
122 |
+
* not be successfully spawned.
|
123 |
+
* @since v0.1.90
|
124 |
+
*/
|
125 |
+
stdout: Readable | null;
|
126 |
+
/**
|
127 |
+
* A `Readable Stream` that represents the child process's `stderr`.
|
128 |
+
*
|
129 |
+
* If the child was spawned with `stdio[2]` set to anything other than `'pipe'`,
|
130 |
+
* then this will be `null`.
|
131 |
+
*
|
132 |
+
* `subprocess.stderr` is an alias for `subprocess.stdio[2]`. Both properties will
|
133 |
+
* refer to the same value.
|
134 |
+
*
|
135 |
+
* The `subprocess.stderr` property can be `null` if the child process could
|
136 |
+
* not be successfully spawned.
|
137 |
+
* @since v0.1.90
|
138 |
+
*/
|
139 |
+
stderr: Readable | null;
|
140 |
+
/**
|
141 |
+
* The `subprocess.channel` property is a reference to the child's IPC channel. If
|
142 |
+
* no IPC channel currently exists, this property is `undefined`.
|
143 |
+
* @since v7.1.0
|
144 |
+
*/
|
145 |
+
readonly channel?: Pipe | null | undefined;
|
146 |
+
/**
|
147 |
+
* A sparse array of pipes to the child process, corresponding with positions in
|
148 |
+
* the `stdio` option passed to {@link spawn} that have been set
|
149 |
+
* to the value `'pipe'`. `subprocess.stdio[0]`, `subprocess.stdio[1]`, and`subprocess.stdio[2]` are also available as `subprocess.stdin`,`subprocess.stdout`, and `subprocess.stderr`,
|
150 |
+
* respectively.
|
151 |
+
*
|
152 |
+
* In the following example, only the child's fd `1` (stdout) is configured as a
|
153 |
+
* pipe, so only the parent's `subprocess.stdio[1]` is a stream, all other values
|
154 |
+
* in the array are `null`.
|
155 |
+
*
|
156 |
+
* ```js
|
157 |
+
* const assert = require('assert');
|
158 |
+
* const fs = require('fs');
|
159 |
+
* const child_process = require('child_process');
|
160 |
+
*
|
161 |
+
* const subprocess = child_process.spawn('ls', {
|
162 |
+
* stdio: [
|
163 |
+
* 0, // Use parent's stdin for child.
|
164 |
+
* 'pipe', // Pipe child's stdout to parent.
|
165 |
+
* fs.openSync('err.out', 'w'), // Direct child's stderr to a file.
|
166 |
+
* ]
|
167 |
+
* });
|
168 |
+
*
|
169 |
+
* assert.strictEqual(subprocess.stdio[0], null);
|
170 |
+
* assert.strictEqual(subprocess.stdio[0], subprocess.stdin);
|
171 |
+
*
|
172 |
+
* assert(subprocess.stdout);
|
173 |
+
* assert.strictEqual(subprocess.stdio[1], subprocess.stdout);
|
174 |
+
*
|
175 |
+
* assert.strictEqual(subprocess.stdio[2], null);
|
176 |
+
* assert.strictEqual(subprocess.stdio[2], subprocess.stderr);
|
177 |
+
* ```
|
178 |
+
*
|
179 |
+
* The `subprocess.stdio` property can be `undefined` if the child process could
|
180 |
+
* not be successfully spawned.
|
181 |
+
* @since v0.7.10
|
182 |
+
*/
|
183 |
+
readonly stdio: [
|
184 |
+
Writable | null,
|
185 |
+
// stdin
|
186 |
+
Readable | null,
|
187 |
+
// stdout
|
188 |
+
Readable | null,
|
189 |
+
// stderr
|
190 |
+
Readable | Writable | null | undefined,
|
191 |
+
// extra
|
192 |
+
Readable | Writable | null | undefined, // extra
|
193 |
+
];
|
194 |
+
/**
|
195 |
+
* The `subprocess.killed` property indicates whether the child process
|
196 |
+
* successfully received a signal from `subprocess.kill()`. The `killed` property
|
197 |
+
* does not indicate that the child process has been terminated.
|
198 |
+
* @since v0.5.10
|
199 |
+
*/
|
200 |
+
readonly killed: boolean;
|
201 |
+
/**
|
202 |
+
* Returns the process identifier (PID) of the child process. If the child process
|
203 |
+
* fails to spawn due to errors, then the value is `undefined` and `error` is
|
204 |
+
* emitted.
|
205 |
+
*
|
206 |
+
* ```js
|
207 |
+
* const { spawn } = require('child_process');
|
208 |
+
* const grep = spawn('grep', ['ssh']);
|
209 |
+
*
|
210 |
+
* console.log(`Spawned child pid: ${grep.pid}`);
|
211 |
+
* grep.stdin.end();
|
212 |
+
* ```
|
213 |
+
* @since v0.1.90
|
214 |
+
*/
|
215 |
+
readonly pid?: number | undefined;
|
216 |
+
/**
|
217 |
+
* The `subprocess.connected` property indicates whether it is still possible to
|
218 |
+
* send and receive messages from a child process. When `subprocess.connected` is`false`, it is no longer possible to send or receive messages.
|
219 |
+
* @since v0.7.2
|
220 |
+
*/
|
221 |
+
readonly connected: boolean;
|
222 |
+
/**
|
223 |
+
* The `subprocess.exitCode` property indicates the exit code of the child process.
|
224 |
+
* If the child process is still running, the field will be `null`.
|
225 |
+
*/
|
226 |
+
readonly exitCode: number | null;
|
227 |
+
/**
|
228 |
+
* The `subprocess.signalCode` property indicates the signal received by
|
229 |
+
* the child process if any, else `null`.
|
230 |
+
*/
|
231 |
+
readonly signalCode: NodeJS.Signals | null;
|
232 |
+
/**
|
233 |
+
* The `subprocess.spawnargs` property represents the full list of command-line
|
234 |
+
* arguments the child process was launched with.
|
235 |
+
*/
|
236 |
+
readonly spawnargs: string[];
|
237 |
+
/**
|
238 |
+
* The `subprocess.spawnfile` property indicates the executable file name of
|
239 |
+
* the child process that is launched.
|
240 |
+
*
|
241 |
+
* For {@link fork}, its value will be equal to `process.execPath`.
|
242 |
+
* For {@link spawn}, its value will be the name of
|
243 |
+
* the executable file.
|
244 |
+
* For {@link exec}, its value will be the name of the shell
|
245 |
+
* in which the child process is launched.
|
246 |
+
*/
|
247 |
+
readonly spawnfile: string;
|
248 |
+
/**
|
249 |
+
* The `subprocess.kill()` method sends a signal to the child process. If no
|
250 |
+
* argument is given, the process will be sent the `'SIGTERM'` signal. See [`signal(7)`](http://man7.org/linux/man-pages/man7/signal.7.html) for a list of available signals. This function
|
251 |
+
* returns `true` if [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) succeeds, and `false` otherwise.
|
252 |
+
*
|
253 |
+
* ```js
|
254 |
+
* const { spawn } = require('child_process');
|
255 |
+
* const grep = spawn('grep', ['ssh']);
|
256 |
+
*
|
257 |
+
* grep.on('close', (code, signal) => {
|
258 |
+
* console.log(
|
259 |
+
* `child process terminated due to receipt of signal ${signal}`);
|
260 |
+
* });
|
261 |
+
*
|
262 |
+
* // Send SIGHUP to process.
|
263 |
+
* grep.kill('SIGHUP');
|
264 |
+
* ```
|
265 |
+
*
|
266 |
+
* The `ChildProcess` object may emit an `'error'` event if the signal
|
267 |
+
* cannot be delivered. Sending a signal to a child process that has already exited
|
268 |
+
* is not an error but may have unforeseen consequences. Specifically, if the
|
269 |
+
* process identifier (PID) has been reassigned to another process, the signal will
|
270 |
+
* be delivered to that process instead which can have unexpected results.
|
271 |
+
*
|
272 |
+
* While the function is called `kill`, the signal delivered to the child process
|
273 |
+
* may not actually terminate the process.
|
274 |
+
*
|
275 |
+
* See [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) for reference.
|
276 |
+
*
|
277 |
+
* On Windows, where POSIX signals do not exist, the `signal` argument will be
|
278 |
+
* ignored, and the process will be killed forcefully and abruptly (similar to`'SIGKILL'`).
|
279 |
+
* See `Signal Events` for more details.
|
280 |
+
*
|
281 |
+
* On Linux, child processes of child processes will not be terminated
|
282 |
+
* when attempting to kill their parent. This is likely to happen when running a
|
283 |
+
* new process in a shell or with the use of the `shell` option of `ChildProcess`:
|
284 |
+
*
|
285 |
+
* ```js
|
286 |
+
* 'use strict';
|
287 |
+
* const { spawn } = require('child_process');
|
288 |
+
*
|
289 |
+
* const subprocess = spawn(
|
290 |
+
* 'sh',
|
291 |
+
* [
|
292 |
+
* '-c',
|
293 |
+
* `node -e "setInterval(() => {
|
294 |
+
* console.log(process.pid, 'is alive')
|
295 |
+
* }, 500);"`,
|
296 |
+
* ], {
|
297 |
+
* stdio: ['inherit', 'inherit', 'inherit']
|
298 |
+
* }
|
299 |
+
* );
|
300 |
+
*
|
301 |
+
* setTimeout(() => {
|
302 |
+
* subprocess.kill(); // Does not terminate the Node.js process in the shell.
|
303 |
+
* }, 2000);
|
304 |
+
* ```
|
305 |
+
* @since v0.1.90
|
306 |
+
*/
|
307 |
+
kill(signal?: NodeJS.Signals | number): boolean;
|
308 |
+
/**
|
309 |
+
* Calls {@link ChildProcess.kill} with `'SIGTERM'`.
|
310 |
+
* @since v18.18.0
|
311 |
+
*/
|
312 |
+
[Symbol.dispose](): void;
|
313 |
+
/**
|
314 |
+
* When an IPC channel has been established between the parent and child (
|
315 |
+
* i.e. when using {@link fork}), the `subprocess.send()` method can
|
316 |
+
* be used to send messages to the child process. When the child process is a
|
317 |
+
* Node.js instance, these messages can be received via the `'message'` event.
|
318 |
+
*
|
319 |
+
* The message goes through serialization and parsing. The resulting
|
320 |
+
* message might not be the same as what is originally sent.
|
321 |
+
*
|
322 |
+
* For example, in the parent script:
|
323 |
+
*
|
324 |
+
* ```js
|
325 |
+
* const cp = require('child_process');
|
326 |
+
* const n = cp.fork(`${__dirname}/sub.js`);
|
327 |
+
*
|
328 |
+
* n.on('message', (m) => {
|
329 |
+
* console.log('PARENT got message:', m);
|
330 |
+
* });
|
331 |
+
*
|
332 |
+
* // Causes the child to print: CHILD got message: { hello: 'world' }
|
333 |
+
* n.send({ hello: 'world' });
|
334 |
+
* ```
|
335 |
+
*
|
336 |
+
* And then the child script, `'sub.js'` might look like this:
|
337 |
+
*
|
338 |
+
* ```js
|
339 |
+
* process.on('message', (m) => {
|
340 |
+
* console.log('CHILD got message:', m);
|
341 |
+
* });
|
342 |
+
*
|
343 |
+
* // Causes the parent to print: PARENT got message: { foo: 'bar', baz: null }
|
344 |
+
* process.send({ foo: 'bar', baz: NaN });
|
345 |
+
* ```
|
346 |
+
*
|
347 |
+
* Child Node.js processes will have a `process.send()` method of their own
|
348 |
+
* that allows the child to send messages back to the parent.
|
349 |
+
*
|
350 |
+
* There is a special case when sending a `{cmd: 'NODE_foo'}` message. Messages
|
351 |
+
* containing a `NODE_` prefix in the `cmd` property are reserved for use within
|
352 |
+
* Node.js core and will not be emitted in the child's `'message'` event. Rather, such messages are emitted using the`'internalMessage'` event and are consumed internally by Node.js.
|
353 |
+
* Applications should avoid using such messages or listening for`'internalMessage'` events as it is subject to change without notice.
|
354 |
+
*
|
355 |
+
* The optional `sendHandle` argument that may be passed to `subprocess.send()` is
|
356 |
+
* for passing a TCP server or socket object to the child process. The child will
|
357 |
+
* receive the object as the second argument passed to the callback function
|
358 |
+
* registered on the `'message'` event. Any data that is received
|
359 |
+
* and buffered in the socket will not be sent to the child.
|
360 |
+
*
|
361 |
+
* The optional `callback` is a function that is invoked after the message is
|
362 |
+
* sent but before the child may have received it. The function is called with a
|
363 |
+
* single argument: `null` on success, or an `Error` object on failure.
|
364 |
+
*
|
365 |
+
* If no `callback` function is provided and the message cannot be sent, an`'error'` event will be emitted by the `ChildProcess` object. This can
|
366 |
+
* happen, for instance, when the child process has already exited.
|
367 |
+
*
|
368 |
+
* `subprocess.send()` will return `false` if the channel has closed or when the
|
369 |
+
* backlog of unsent messages exceeds a threshold that makes it unwise to send
|
370 |
+
* more. Otherwise, the method returns `true`. The `callback` function can be
|
371 |
+
* used to implement flow control.
|
372 |
+
*
|
373 |
+
* #### Example: sending a server object
|
374 |
+
*
|
375 |
+
* The `sendHandle` argument can be used, for instance, to pass the handle of
|
376 |
+
* a TCP server object to the child process as illustrated in the example below:
|
377 |
+
*
|
378 |
+
* ```js
|
379 |
+
* const subprocess = require('child_process').fork('subprocess.js');
|
380 |
+
*
|
381 |
+
* // Open up the server object and send the handle.
|
382 |
+
* const server = require('net').createServer();
|
383 |
+
* server.on('connection', (socket) => {
|
384 |
+
* socket.end('handled by parent');
|
385 |
+
* });
|
386 |
+
* server.listen(1337, () => {
|
387 |
+
* subprocess.send('server', server);
|
388 |
+
* });
|
389 |
+
* ```
|
390 |
+
*
|
391 |
+
* The child would then receive the server object as:
|
392 |
+
*
|
393 |
+
* ```js
|
394 |
+
* process.on('message', (m, server) => {
|
395 |
+
* if (m === 'server') {
|
396 |
+
* server.on('connection', (socket) => {
|
397 |
+
* socket.end('handled by child');
|
398 |
+
* });
|
399 |
+
* }
|
400 |
+
* });
|
401 |
+
* ```
|
402 |
+
*
|
403 |
+
* Once the server is now shared between the parent and child, some connections
|
404 |
+
* can be handled by the parent and some by the child.
|
405 |
+
*
|
406 |
+
* While the example above uses a server created using the `net` module, `dgram`module servers use exactly the same workflow with the exceptions of listening on
|
407 |
+
* a `'message'` event instead of `'connection'` and using `server.bind()` instead
|
408 |
+
* of `server.listen()`. This is, however, currently only supported on Unix
|
409 |
+
* platforms.
|
410 |
+
*
|
411 |
+
* #### Example: sending a socket object
|
412 |
+
*
|
413 |
+
* Similarly, the `sendHandler` argument can be used to pass the handle of a
|
414 |
+
* socket to the child process. The example below spawns two children that each
|
415 |
+
* handle connections with "normal" or "special" priority:
|
416 |
+
*
|
417 |
+
* ```js
|
418 |
+
* const { fork } = require('child_process');
|
419 |
+
* const normal = fork('subprocess.js', ['normal']);
|
420 |
+
* const special = fork('subprocess.js', ['special']);
|
421 |
+
*
|
422 |
+
* // Open up the server and send sockets to child. Use pauseOnConnect to prevent
|
423 |
+
* // the sockets from being read before they are sent to the child process.
|
424 |
+
* const server = require('net').createServer({ pauseOnConnect: true });
|
425 |
+
* server.on('connection', (socket) => {
|
426 |
+
*
|
427 |
+
* // If this is special priority...
|
428 |
+
* if (socket.remoteAddress === '74.125.127.100') {
|
429 |
+
* special.send('socket', socket);
|
430 |
+
* return;
|
431 |
+
* }
|
432 |
+
* // This is normal priority.
|
433 |
+
* normal.send('socket', socket);
|
434 |
+
* });
|
435 |
+
* server.listen(1337);
|
436 |
+
* ```
|
437 |
+
*
|
438 |
+
* The `subprocess.js` would receive the socket handle as the second argument
|
439 |
+
* passed to the event callback function:
|
440 |
+
*
|
441 |
+
* ```js
|
442 |
+
* process.on('message', (m, socket) => {
|
443 |
+
* if (m === 'socket') {
|
444 |
+
* if (socket) {
|
445 |
+
* // Check that the client socket exists.
|
446 |
+
* // It is possible for the socket to be closed between the time it is
|
447 |
+
* // sent and the time it is received in the child process.
|
448 |
+
* socket.end(`Request handled with ${process.argv[2]} priority`);
|
449 |
+
* }
|
450 |
+
* }
|
451 |
+
* });
|
452 |
+
* ```
|
453 |
+
*
|
454 |
+
* Do not use `.maxConnections` on a socket that has been passed to a subprocess.
|
455 |
+
* The parent cannot track when the socket is destroyed.
|
456 |
+
*
|
457 |
+
* Any `'message'` handlers in the subprocess should verify that `socket` exists,
|
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 options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties:
|
462 |
+
*/
|
463 |
+
send(message: Serializable, callback?: (error: Error | null) => void): boolean;
|
464 |
+
send(message: Serializable, sendHandle?: SendHandle, callback?: (error: Error | null) => void): boolean;
|
465 |
+
send(
|
466 |
+
message: Serializable,
|
467 |
+
sendHandle?: SendHandle,
|
468 |
+
options?: MessageOptions,
|
469 |
+
callback?: (error: Error | null) => void,
|
470 |
+
): boolean;
|
471 |
+
/**
|
472 |
+
* Closes the IPC channel between parent and child, allowing the child to exit
|
473 |
+
* gracefully once there are no other connections keeping it alive. After calling
|
474 |
+
* this method the `subprocess.connected` and `process.connected` properties in
|
475 |
+
* both the parent and child (respectively) will be set to `false`, and it will be
|
476 |
+
* no longer possible to pass messages between the processes.
|
477 |
+
*
|
478 |
+
* The `'disconnect'` event will be emitted when there are no messages in the
|
479 |
+
* process of being received. This will most often be triggered immediately after
|
480 |
+
* calling `subprocess.disconnect()`.
|
481 |
+
*
|
482 |
+
* When the child process is a Node.js instance (e.g. spawned using {@link fork}), the `process.disconnect()` method can be invoked
|
483 |
+
* within the child process to close the IPC channel as well.
|
484 |
+
* @since v0.7.2
|
485 |
+
*/
|
486 |
+
disconnect(): void;
|
487 |
+
/**
|
488 |
+
* By default, the parent will wait for the detached child to exit. To prevent the
|
489 |
+
* parent from waiting for a given `subprocess` to exit, use the`subprocess.unref()` method. Doing so will cause the parent's event loop to not
|
490 |
+
* include the child in its reference count, allowing the parent to exit
|
491 |
+
* independently of the child, unless there is an established IPC channel between
|
492 |
+
* the child and the parent.
|
493 |
+
*
|
494 |
+
* ```js
|
495 |
+
* const { spawn } = require('child_process');
|
496 |
+
*
|
497 |
+
* const subprocess = spawn(process.argv[0], ['child_program.js'], {
|
498 |
+
* detached: true,
|
499 |
+
* stdio: 'ignore'
|
500 |
+
* });
|
501 |
+
*
|
502 |
+
* subprocess.unref();
|
503 |
+
* ```
|
504 |
+
* @since v0.7.10
|
505 |
+
*/
|
506 |
+
unref(): void;
|
507 |
+
/**
|
508 |
+
* Calling `subprocess.ref()` after making a call to `subprocess.unref()` will
|
509 |
+
* restore the removed reference count for the child process, forcing the parent
|
510 |
+
* to wait for the child to exit before exiting itself.
|
511 |
+
*
|
512 |
+
* ```js
|
513 |
+
* const { spawn } = require('child_process');
|
514 |
+
*
|
515 |
+
* const subprocess = spawn(process.argv[0], ['child_program.js'], {
|
516 |
+
* detached: true,
|
517 |
+
* stdio: 'ignore'
|
518 |
+
* });
|
519 |
+
*
|
520 |
+
* subprocess.unref();
|
521 |
+
* subprocess.ref();
|
522 |
+
* ```
|
523 |
+
* @since v0.7.10
|
524 |
+
*/
|
525 |
+
ref(): void;
|
526 |
+
/**
|
527 |
+
* events.EventEmitter
|
528 |
+
* 1. close
|
529 |
+
* 2. disconnect
|
530 |
+
* 3. error
|
531 |
+
* 4. exit
|
532 |
+
* 5. message
|
533 |
+
* 6. spawn
|
534 |
+
*/
|
535 |
+
addListener(event: string, listener: (...args: any[]) => void): this;
|
536 |
+
addListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
537 |
+
addListener(event: "disconnect", listener: () => void): this;
|
538 |
+
addListener(event: "error", listener: (err: Error) => void): this;
|
539 |
+
addListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
540 |
+
addListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
541 |
+
addListener(event: "spawn", listener: () => void): this;
|
542 |
+
emit(event: string | symbol, ...args: any[]): boolean;
|
543 |
+
emit(event: "close", code: number | null, signal: NodeJS.Signals | null): boolean;
|
544 |
+
emit(event: "disconnect"): boolean;
|
545 |
+
emit(event: "error", err: Error): boolean;
|
546 |
+
emit(event: "exit", code: number | null, signal: NodeJS.Signals | null): boolean;
|
547 |
+
emit(event: "message", message: Serializable, sendHandle: SendHandle): boolean;
|
548 |
+
emit(event: "spawn", listener: () => void): boolean;
|
549 |
+
on(event: string, listener: (...args: any[]) => void): this;
|
550 |
+
on(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
551 |
+
on(event: "disconnect", listener: () => void): this;
|
552 |
+
on(event: "error", listener: (err: Error) => void): this;
|
553 |
+
on(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
554 |
+
on(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
555 |
+
on(event: "spawn", listener: () => void): this;
|
556 |
+
once(event: string, listener: (...args: any[]) => void): this;
|
557 |
+
once(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
558 |
+
once(event: "disconnect", listener: () => void): this;
|
559 |
+
once(event: "error", listener: (err: Error) => void): this;
|
560 |
+
once(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
561 |
+
once(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
562 |
+
once(event: "spawn", listener: () => void): this;
|
563 |
+
prependListener(event: string, listener: (...args: any[]) => void): this;
|
564 |
+
prependListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
565 |
+
prependListener(event: "disconnect", listener: () => void): this;
|
566 |
+
prependListener(event: "error", listener: (err: Error) => void): this;
|
567 |
+
prependListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
568 |
+
prependListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
569 |
+
prependListener(event: "spawn", listener: () => void): this;
|
570 |
+
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
571 |
+
prependOnceListener(
|
572 |
+
event: "close",
|
573 |
+
listener: (code: number | null, signal: NodeJS.Signals | null) => void,
|
574 |
+
): this;
|
575 |
+
prependOnceListener(event: "disconnect", listener: () => void): this;
|
576 |
+
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
577 |
+
prependOnceListener(
|
578 |
+
event: "exit",
|
579 |
+
listener: (code: number | null, signal: NodeJS.Signals | null) => void,
|
580 |
+
): this;
|
581 |
+
prependOnceListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
582 |
+
prependOnceListener(event: "spawn", listener: () => void): this;
|
583 |
+
}
|
584 |
+
// return this object when stdio option is undefined or not specified
|
585 |
+
interface ChildProcessWithoutNullStreams extends ChildProcess {
|
586 |
+
stdin: Writable;
|
587 |
+
stdout: Readable;
|
588 |
+
stderr: Readable;
|
589 |
+
readonly stdio: [
|
590 |
+
Writable,
|
591 |
+
Readable,
|
592 |
+
Readable,
|
593 |
+
// stderr
|
594 |
+
Readable | Writable | null | undefined,
|
595 |
+
// extra, no modification
|
596 |
+
Readable | Writable | null | undefined, // extra, no modification
|
597 |
+
];
|
598 |
+
}
|
599 |
+
// return this object when stdio option is a tuple of 3
|
600 |
+
interface ChildProcessByStdio<I extends null | Writable, O extends null | Readable, E extends null | Readable>
|
601 |
+
extends ChildProcess
|
602 |
+
{
|
603 |
+
stdin: I;
|
604 |
+
stdout: O;
|
605 |
+
stderr: E;
|
606 |
+
readonly stdio: [
|
607 |
+
I,
|
608 |
+
O,
|
609 |
+
E,
|
610 |
+
Readable | Writable | null | undefined,
|
611 |
+
// extra, no modification
|
612 |
+
Readable | Writable | null | undefined, // extra, no modification
|
613 |
+
];
|
614 |
+
}
|
615 |
+
interface MessageOptions {
|
616 |
+
keepOpen?: boolean | undefined;
|
617 |
+
}
|
618 |
+
type IOType = "overlapped" | "pipe" | "ignore" | "inherit";
|
619 |
+
type StdioOptions = IOType | Array<IOType | "ipc" | Stream | number | null | undefined>;
|
620 |
+
type SerializationType = "json" | "advanced";
|
621 |
+
interface MessagingOptions extends Abortable {
|
622 |
+
/**
|
623 |
+
* Specify the kind of serialization used for sending messages between processes.
|
624 |
+
* @default 'json'
|
625 |
+
*/
|
626 |
+
serialization?: SerializationType | undefined;
|
627 |
+
/**
|
628 |
+
* The signal value to be used when the spawned process will be killed by the abort signal.
|
629 |
+
* @default 'SIGTERM'
|
630 |
+
*/
|
631 |
+
killSignal?: NodeJS.Signals | number | undefined;
|
632 |
+
/**
|
633 |
+
* In milliseconds the maximum amount of time the process is allowed to run.
|
634 |
+
*/
|
635 |
+
timeout?: number | undefined;
|
636 |
+
}
|
637 |
+
interface ProcessEnvOptions {
|
638 |
+
uid?: number | undefined;
|
639 |
+
gid?: number | undefined;
|
640 |
+
cwd?: string | URL | undefined;
|
641 |
+
env?: NodeJS.ProcessEnv | undefined;
|
642 |
+
}
|
643 |
+
interface CommonOptions extends ProcessEnvOptions {
|
644 |
+
/**
|
645 |
+
* @default false
|
646 |
+
*/
|
647 |
+
windowsHide?: boolean | undefined;
|
648 |
+
/**
|
649 |
+
* @default 0
|
650 |
+
*/
|
651 |
+
timeout?: number | undefined;
|
652 |
+
}
|
653 |
+
interface CommonSpawnOptions extends CommonOptions, MessagingOptions, Abortable {
|
654 |
+
argv0?: string | undefined;
|
655 |
+
/**
|
656 |
+
* Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings.
|
657 |
+
* If passed as an array, the first element is used for `stdin`, the second for
|
658 |
+
* `stdout`, and the third for `stderr`. A fourth element can be used to
|
659 |
+
* specify the `stdio` behavior beyond the standard streams. See
|
660 |
+
* {@link ChildProcess.stdio} for more information.
|
661 |
+
*
|
662 |
+
* @default 'pipe'
|
663 |
+
*/
|
664 |
+
stdio?: StdioOptions | undefined;
|
665 |
+
shell?: boolean | string | undefined;
|
666 |
+
windowsVerbatimArguments?: boolean | undefined;
|
667 |
+
}
|
668 |
+
interface SpawnOptions extends CommonSpawnOptions {
|
669 |
+
detached?: boolean | undefined;
|
670 |
+
}
|
671 |
+
interface SpawnOptionsWithoutStdio extends SpawnOptions {
|
672 |
+
stdio?: StdioPipeNamed | StdioPipe[] | undefined;
|
673 |
+
}
|
674 |
+
type StdioNull = "inherit" | "ignore" | Stream;
|
675 |
+
type StdioPipeNamed = "pipe" | "overlapped";
|
676 |
+
type StdioPipe = undefined | null | StdioPipeNamed;
|
677 |
+
interface SpawnOptionsWithStdioTuple<
|
678 |
+
Stdin extends StdioNull | StdioPipe,
|
679 |
+
Stdout extends StdioNull | StdioPipe,
|
680 |
+
Stderr extends StdioNull | StdioPipe,
|
681 |
+
> extends SpawnOptions {
|
682 |
+
stdio: [Stdin, Stdout, Stderr];
|
683 |
+
}
|
684 |
+
/**
|
685 |
+
* The `child_process.spawn()` method spawns a new process using the given`command`, with command-line arguments in `args`. If omitted, `args` defaults
|
686 |
+
* to an empty array.
|
687 |
+
*
|
688 |
+
* **If the `shell` option is enabled, do not pass unsanitized user input to this**
|
689 |
+
* **function. Any input containing shell metacharacters may be used to trigger**
|
690 |
+
* **arbitrary command execution.**
|
691 |
+
*
|
692 |
+
* A third argument may be used to specify additional options, with these defaults:
|
693 |
+
*
|
694 |
+
* ```js
|
695 |
+
* const defaults = {
|
696 |
+
* cwd: undefined,
|
697 |
+
* env: process.env
|
698 |
+
* };
|
699 |
+
* ```
|
700 |
+
*
|
701 |
+
* Use `cwd` to specify the working directory from which the process is spawned.
|
702 |
+
* If not given, the default is to inherit the current working directory. If given,
|
703 |
+
* but the path does not exist, the child process emits an `ENOENT` error
|
704 |
+
* and exits immediately. `ENOENT` is also emitted when the command
|
705 |
+
* does not exist.
|
706 |
+
*
|
707 |
+
* Use `env` to specify environment variables that will be visible to the new
|
708 |
+
* process, the default is `process.env`.
|
709 |
+
*
|
710 |
+
* `undefined` values in `env` will be ignored.
|
711 |
+
*
|
712 |
+
* Example of running `ls -lh /usr`, capturing `stdout`, `stderr`, and the
|
713 |
+
* exit code:
|
714 |
+
*
|
715 |
+
* ```js
|
716 |
+
* const { spawn } = require('child_process');
|
717 |
+
* const ls = spawn('ls', ['-lh', '/usr']);
|
718 |
+
*
|
719 |
+
* ls.stdout.on('data', (data) => {
|
720 |
+
* console.log(`stdout: ${data}`);
|
721 |
+
* });
|
722 |
+
*
|
723 |
+
* ls.stderr.on('data', (data) => {
|
724 |
+
* console.error(`stderr: ${data}`);
|
725 |
+
* });
|
726 |
+
*
|
727 |
+
* ls.on('close', (code) => {
|
728 |
+
* console.log(`child process exited with code ${code}`);
|
729 |
+
* });
|
730 |
+
* ```
|
731 |
+
*
|
732 |
+
* Example: A very elaborate way to run `ps ax | grep ssh`
|
733 |
+
*
|
734 |
+
* ```js
|
735 |
+
* const { spawn } = require('child_process');
|
736 |
+
* const ps = spawn('ps', ['ax']);
|
737 |
+
* const grep = spawn('grep', ['ssh']);
|
738 |
+
*
|
739 |
+
* ps.stdout.on('data', (data) => {
|
740 |
+
* grep.stdin.write(data);
|
741 |
+
* });
|
742 |
+
*
|
743 |
+
* ps.stderr.on('data', (data) => {
|
744 |
+
* console.error(`ps stderr: ${data}`);
|
745 |
+
* });
|
746 |
+
*
|
747 |
+
* ps.on('close', (code) => {
|
748 |
+
* if (code !== 0) {
|
749 |
+
* console.log(`ps process exited with code ${code}`);
|
750 |
+
* }
|
751 |
+
* grep.stdin.end();
|
752 |
+
* });
|
753 |
+
*
|
754 |
+
* grep.stdout.on('data', (data) => {
|
755 |
+
* console.log(data.toString());
|
756 |
+
* });
|
757 |
+
*
|
758 |
+
* grep.stderr.on('data', (data) => {
|
759 |
+
* console.error(`grep stderr: ${data}`);
|
760 |
+
* });
|
761 |
+
*
|
762 |
+
* grep.on('close', (code) => {
|
763 |
+
* if (code !== 0) {
|
764 |
+
* console.log(`grep process exited with code ${code}`);
|
765 |
+
* }
|
766 |
+
* });
|
767 |
+
* ```
|
768 |
+
*
|
769 |
+
* Example of checking for failed `spawn`:
|
770 |
+
*
|
771 |
+
* ```js
|
772 |
+
* const { spawn } = require('child_process');
|
773 |
+
* const subprocess = spawn('bad_command');
|
774 |
+
*
|
775 |
+
* subprocess.on('error', (err) => {
|
776 |
+
* console.error('Failed to start subprocess.');
|
777 |
+
* });
|
778 |
+
* ```
|
779 |
+
*
|
780 |
+
* Certain platforms (macOS, Linux) will use the value of `argv[0]` for the process
|
781 |
+
* title while others (Windows, SunOS) will use `command`.
|
782 |
+
*
|
783 |
+
* Node.js currently overwrites `argv[0]` with `process.execPath` on startup, so`process.argv[0]` in a Node.js child process will not match the `argv0`parameter passed to `spawn` from the parent,
|
784 |
+
* retrieve it with the`process.argv0` property instead.
|
785 |
+
*
|
786 |
+
* If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except
|
787 |
+
* the error passed to the callback will be an `AbortError`:
|
788 |
+
*
|
789 |
+
* ```js
|
790 |
+
* const { spawn } = require('child_process');
|
791 |
+
* const controller = new AbortController();
|
792 |
+
* const { signal } = controller;
|
793 |
+
* const grep = spawn('grep', ['ssh'], { signal });
|
794 |
+
* grep.on('error', (err) => {
|
795 |
+
* // This will be called with err being an AbortError if the controller aborts
|
796 |
+
* });
|
797 |
+
* controller.abort(); // Stops the child process
|
798 |
+
* ```
|
799 |
+
* @since v0.1.90
|
800 |
+
* @param command The command to run.
|
801 |
+
* @param args List of string arguments.
|
802 |
+
*/
|
803 |
+
function spawn(command: string, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams;
|
804 |
+
function spawn(
|
805 |
+
command: string,
|
806 |
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>,
|
807 |
+
): ChildProcessByStdio<Writable, Readable, Readable>;
|
808 |
+
function spawn(
|
809 |
+
command: string,
|
810 |
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>,
|
811 |
+
): ChildProcessByStdio<Writable, Readable, null>;
|
812 |
+
function spawn(
|
813 |
+
command: string,
|
814 |
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>,
|
815 |
+
): ChildProcessByStdio<Writable, null, Readable>;
|
816 |
+
function spawn(
|
817 |
+
command: string,
|
818 |
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,
|
819 |
+
): ChildProcessByStdio<null, Readable, Readable>;
|
820 |
+
function spawn(
|
821 |
+
command: string,
|
822 |
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>,
|
823 |
+
): ChildProcessByStdio<Writable, null, null>;
|
824 |
+
function spawn(
|
825 |
+
command: string,
|
826 |
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>,
|
827 |
+
): ChildProcessByStdio<null, Readable, null>;
|
828 |
+
function spawn(
|
829 |
+
command: string,
|
830 |
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>,
|
831 |
+
): ChildProcessByStdio<null, null, Readable>;
|
832 |
+
function spawn(
|
833 |
+
command: string,
|
834 |
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>,
|
835 |
+
): ChildProcessByStdio<null, null, null>;
|
836 |
+
function spawn(command: string, options: SpawnOptions): ChildProcess;
|
837 |
+
// overloads of spawn with 'args'
|
838 |
+
function spawn(
|
839 |
+
command: string,
|
840 |
+
args?: readonly string[],
|
841 |
+
options?: SpawnOptionsWithoutStdio,
|
842 |
+
): ChildProcessWithoutNullStreams;
|
843 |
+
function spawn(
|
844 |
+
command: string,
|
845 |
+
args: readonly string[],
|
846 |
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>,
|
847 |
+
): ChildProcessByStdio<Writable, Readable, Readable>;
|
848 |
+
function spawn(
|
849 |
+
command: string,
|
850 |
+
args: readonly string[],
|
851 |
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>,
|
852 |
+
): ChildProcessByStdio<Writable, Readable, null>;
|
853 |
+
function spawn(
|
854 |
+
command: string,
|
855 |
+
args: readonly string[],
|
856 |
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>,
|
857 |
+
): ChildProcessByStdio<Writable, null, Readable>;
|
858 |
+
function spawn(
|
859 |
+
command: string,
|
860 |
+
args: readonly string[],
|
861 |
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,
|
862 |
+
): ChildProcessByStdio<null, Readable, Readable>;
|
863 |
+
function spawn(
|
864 |
+
command: string,
|
865 |
+
args: readonly string[],
|
866 |
+
options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>,
|
867 |
+
): ChildProcessByStdio<Writable, null, null>;
|
868 |
+
function spawn(
|
869 |
+
command: string,
|
870 |
+
args: readonly string[],
|
871 |
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>,
|
872 |
+
): ChildProcessByStdio<null, Readable, null>;
|
873 |
+
function spawn(
|
874 |
+
command: string,
|
875 |
+
args: readonly string[],
|
876 |
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>,
|
877 |
+
): ChildProcessByStdio<null, null, Readable>;
|
878 |
+
function spawn(
|
879 |
+
command: string,
|
880 |
+
args: readonly string[],
|
881 |
+
options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>,
|
882 |
+
): ChildProcessByStdio<null, null, null>;
|
883 |
+
function spawn(command: string, args: readonly string[], options: SpawnOptions): ChildProcess;
|
884 |
+
interface ExecOptions extends CommonOptions {
|
885 |
+
shell?: string | undefined;
|
886 |
+
signal?: AbortSignal | undefined;
|
887 |
+
maxBuffer?: number | undefined;
|
888 |
+
killSignal?: NodeJS.Signals | number | undefined;
|
889 |
+
}
|
890 |
+
interface ExecOptionsWithStringEncoding extends ExecOptions {
|
891 |
+
encoding: BufferEncoding;
|
892 |
+
}
|
893 |
+
interface ExecOptionsWithBufferEncoding extends ExecOptions {
|
894 |
+
encoding: BufferEncoding | null; // specify `null`.
|
895 |
+
}
|
896 |
+
interface ExecException extends Error {
|
897 |
+
cmd?: string | undefined;
|
898 |
+
killed?: boolean | undefined;
|
899 |
+
code?: number | undefined;
|
900 |
+
signal?: NodeJS.Signals | undefined;
|
901 |
+
}
|
902 |
+
/**
|
903 |
+
* Spawns a shell then executes the `command` within that shell, buffering any
|
904 |
+
* generated output. The `command` string passed to the exec function is processed
|
905 |
+
* directly by the shell and special characters (vary based on [shell](https://en.wikipedia.org/wiki/List_of_command-line_interpreters))
|
906 |
+
* need to be dealt with accordingly:
|
907 |
+
*
|
908 |
+
* ```js
|
909 |
+
* const { exec } = require('child_process');
|
910 |
+
*
|
911 |
+
* exec('"/path/to/test file/test.sh" arg1 arg2');
|
912 |
+
* // Double quotes are used so that the space in the path is not interpreted as
|
913 |
+
* // a delimiter of multiple arguments.
|
914 |
+
*
|
915 |
+
* exec('echo "The \\$HOME variable is $HOME"');
|
916 |
+
* // The $HOME variable is escaped in the first instance, but not in the second.
|
917 |
+
* ```
|
918 |
+
*
|
919 |
+
* **Never pass unsanitized user input to this function. Any input containing shell**
|
920 |
+
* **metacharacters may be used to trigger arbitrary command execution.**
|
921 |
+
*
|
922 |
+
* If a `callback` function is provided, it is called with the arguments`(error, stdout, stderr)`. On success, `error` will be `null`. On error,`error` will be an instance of `Error`. The
|
923 |
+
* `error.code` property will be
|
924 |
+
* the exit code of the process. By convention, any exit code other than `0`indicates an error. `error.signal` will be the signal that terminated the
|
925 |
+
* process.
|
926 |
+
*
|
927 |
+
* The `stdout` and `stderr` arguments passed to the callback will contain the
|
928 |
+
* stdout and stderr output of the child process. By default, Node.js will decode
|
929 |
+
* the output as UTF-8 and pass strings to the callback. The `encoding` option
|
930 |
+
* can be used to specify the character encoding used to decode the stdout and
|
931 |
+
* stderr output. If `encoding` is `'buffer'`, or an unrecognized character
|
932 |
+
* encoding, `Buffer` objects will be passed to the callback instead.
|
933 |
+
*
|
934 |
+
* ```js
|
935 |
+
* const { exec } = require('child_process');
|
936 |
+
* exec('cat *.js missing_file | wc -l', (error, stdout, stderr) => {
|
937 |
+
* if (error) {
|
938 |
+
* console.error(`exec error: ${error}`);
|
939 |
+
* return;
|
940 |
+
* }
|
941 |
+
* console.log(`stdout: ${stdout}`);
|
942 |
+
* console.error(`stderr: ${stderr}`);
|
943 |
+
* });
|
944 |
+
* ```
|
945 |
+
*
|
946 |
+
* If `timeout` is greater than `0`, the parent will send the signal
|
947 |
+
* identified by the `killSignal` property (the default is `'SIGTERM'`) if the
|
948 |
+
* child runs longer than `timeout` milliseconds.
|
949 |
+
*
|
950 |
+
* Unlike the [`exec(3)`](http://man7.org/linux/man-pages/man3/exec.3.html) POSIX system call, `child_process.exec()` does not replace
|
951 |
+
* the existing process and uses a shell to execute the command.
|
952 |
+
*
|
953 |
+
* If this method is invoked as its `util.promisify()` ed version, it returns
|
954 |
+
* a `Promise` for an `Object` with `stdout` and `stderr` properties. The returned`ChildProcess` instance is attached to the `Promise` as a `child` property. In
|
955 |
+
* case of an error (including any error resulting in an exit code other than 0), a
|
956 |
+
* rejected promise is returned, with the same `error` object given in the
|
957 |
+
* callback, but with two additional properties `stdout` and `stderr`.
|
958 |
+
*
|
959 |
+
* ```js
|
960 |
+
* const util = require('util');
|
961 |
+
* const exec = util.promisify(require('child_process').exec);
|
962 |
+
*
|
963 |
+
* async function lsExample() {
|
964 |
+
* const { stdout, stderr } = await exec('ls');
|
965 |
+
* console.log('stdout:', stdout);
|
966 |
+
* console.error('stderr:', stderr);
|
967 |
+
* }
|
968 |
+
* lsExample();
|
969 |
+
* ```
|
970 |
+
*
|
971 |
+
* If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except
|
972 |
+
* the error passed to the callback will be an `AbortError`:
|
973 |
+
*
|
974 |
+
* ```js
|
975 |
+
* const { exec } = require('child_process');
|
976 |
+
* const controller = new AbortController();
|
977 |
+
* const { signal } = controller;
|
978 |
+
* const child = exec('grep ssh', { signal }, (error) => {
|
979 |
+
* console.log(error); // an AbortError
|
980 |
+
* });
|
981 |
+
* controller.abort();
|
982 |
+
* ```
|
983 |
+
* @since v0.1.90
|
984 |
+
* @param command The command to run, with space-separated arguments.
|
985 |
+
* @param callback called with the output when process terminates.
|
986 |
+
*/
|
987 |
+
function exec(
|
988 |
+
command: string,
|
989 |
+
callback?: (error: ExecException | null, stdout: string, stderr: string) => void,
|
990 |
+
): ChildProcess;
|
991 |
+
// `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`.
|
992 |
+
function exec(
|
993 |
+
command: string,
|
994 |
+
options: {
|
995 |
+
encoding: "buffer" | null;
|
996 |
+
} & ExecOptions,
|
997 |
+
callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void,
|
998 |
+
): ChildProcess;
|
999 |
+
// `options` with well known `encoding` means stdout/stderr are definitely `string`.
|
1000 |
+
function exec(
|
1001 |
+
command: string,
|
1002 |
+
options: {
|
1003 |
+
encoding: BufferEncoding;
|
1004 |
+
} & ExecOptions,
|
1005 |
+
callback?: (error: ExecException | null, stdout: string, stderr: string) => void,
|
1006 |
+
): ChildProcess;
|
1007 |
+
// `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`.
|
1008 |
+
// There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`.
|
1009 |
+
function exec(
|
1010 |
+
command: string,
|
1011 |
+
options: {
|
1012 |
+
encoding: BufferEncoding;
|
1013 |
+
} & ExecOptions,
|
1014 |
+
callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
1015 |
+
): ChildProcess;
|
1016 |
+
// `options` without an `encoding` means stdout/stderr are definitely `string`.
|
1017 |
+
function exec(
|
1018 |
+
command: string,
|
1019 |
+
options: ExecOptions,
|
1020 |
+
callback?: (error: ExecException | null, stdout: string, stderr: string) => void,
|
1021 |
+
): ChildProcess;
|
1022 |
+
// fallback if nothing else matches. Worst case is always `string | Buffer`.
|
1023 |
+
function exec(
|
1024 |
+
command: string,
|
1025 |
+
options: (ObjectEncodingOptions & ExecOptions) | undefined | null,
|
1026 |
+
callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
1027 |
+
): ChildProcess;
|
1028 |
+
interface PromiseWithChild<T> extends Promise<T> {
|
1029 |
+
child: ChildProcess;
|
1030 |
+
}
|
1031 |
+
namespace exec {
|
1032 |
+
function __promisify__(command: string): PromiseWithChild<{
|
1033 |
+
stdout: string;
|
1034 |
+
stderr: string;
|
1035 |
+
}>;
|
1036 |
+
function __promisify__(
|
1037 |
+
command: string,
|
1038 |
+
options: {
|
1039 |
+
encoding: "buffer" | null;
|
1040 |
+
} & ExecOptions,
|
1041 |
+
): PromiseWithChild<{
|
1042 |
+
stdout: Buffer;
|
1043 |
+
stderr: Buffer;
|
1044 |
+
}>;
|
1045 |
+
function __promisify__(
|
1046 |
+
command: string,
|
1047 |
+
options: {
|
1048 |
+
encoding: BufferEncoding;
|
1049 |
+
} & ExecOptions,
|
1050 |
+
): PromiseWithChild<{
|
1051 |
+
stdout: string;
|
1052 |
+
stderr: string;
|
1053 |
+
}>;
|
1054 |
+
function __promisify__(
|
1055 |
+
command: string,
|
1056 |
+
options: ExecOptions,
|
1057 |
+
): PromiseWithChild<{
|
1058 |
+
stdout: string;
|
1059 |
+
stderr: string;
|
1060 |
+
}>;
|
1061 |
+
function __promisify__(
|
1062 |
+
command: string,
|
1063 |
+
options?: (ObjectEncodingOptions & ExecOptions) | null,
|
1064 |
+
): PromiseWithChild<{
|
1065 |
+
stdout: string | Buffer;
|
1066 |
+
stderr: string | Buffer;
|
1067 |
+
}>;
|
1068 |
+
}
|
1069 |
+
interface ExecFileOptions extends CommonOptions, Abortable {
|
1070 |
+
maxBuffer?: number | undefined;
|
1071 |
+
killSignal?: NodeJS.Signals | number | undefined;
|
1072 |
+
windowsVerbatimArguments?: boolean | undefined;
|
1073 |
+
shell?: boolean | string | undefined;
|
1074 |
+
signal?: AbortSignal | undefined;
|
1075 |
+
}
|
1076 |
+
interface ExecFileOptionsWithStringEncoding extends ExecFileOptions {
|
1077 |
+
encoding: BufferEncoding;
|
1078 |
+
}
|
1079 |
+
interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions {
|
1080 |
+
encoding: "buffer" | null;
|
1081 |
+
}
|
1082 |
+
interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions {
|
1083 |
+
encoding: BufferEncoding;
|
1084 |
+
}
|
1085 |
+
type ExecFileException =
|
1086 |
+
& Omit<ExecException, "code">
|
1087 |
+
& Omit<NodeJS.ErrnoException, "code">
|
1088 |
+
& { code?: string | number | undefined | null };
|
1089 |
+
/**
|
1090 |
+
* The `child_process.execFile()` function is similar to {@link exec} except that it does not spawn a shell by default. Rather, the specified
|
1091 |
+
* executable `file` is spawned directly as a new process making it slightly more
|
1092 |
+
* efficient than {@link exec}.
|
1093 |
+
*
|
1094 |
+
* The same options as {@link exec} are supported. Since a shell is
|
1095 |
+
* not spawned, behaviors such as I/O redirection and file globbing are not
|
1096 |
+
* supported.
|
1097 |
+
*
|
1098 |
+
* ```js
|
1099 |
+
* const { execFile } = require('child_process');
|
1100 |
+
* const child = execFile('node', ['--version'], (error, stdout, stderr) => {
|
1101 |
+
* if (error) {
|
1102 |
+
* throw error;
|
1103 |
+
* }
|
1104 |
+
* console.log(stdout);
|
1105 |
+
* });
|
1106 |
+
* ```
|
1107 |
+
*
|
1108 |
+
* The `stdout` and `stderr` arguments passed to the callback will contain the
|
1109 |
+
* stdout and stderr output of the child process. By default, Node.js will decode
|
1110 |
+
* the output as UTF-8 and pass strings to the callback. The `encoding` option
|
1111 |
+
* can be used to specify the character encoding used to decode the stdout and
|
1112 |
+
* stderr output. If `encoding` is `'buffer'`, or an unrecognized character
|
1113 |
+
* encoding, `Buffer` objects will be passed to the callback instead.
|
1114 |
+
*
|
1115 |
+
* If this method is invoked as its `util.promisify()` ed version, it returns
|
1116 |
+
* a `Promise` for an `Object` with `stdout` and `stderr` properties. The returned`ChildProcess` instance is attached to the `Promise` as a `child` property. In
|
1117 |
+
* case of an error (including any error resulting in an exit code other than 0), a
|
1118 |
+
* rejected promise is returned, with the same `error` object given in the
|
1119 |
+
* callback, but with two additional properties `stdout` and `stderr`.
|
1120 |
+
*
|
1121 |
+
* ```js
|
1122 |
+
* const util = require('util');
|
1123 |
+
* const execFile = util.promisify(require('child_process').execFile);
|
1124 |
+
* async function getVersion() {
|
1125 |
+
* const { stdout } = await execFile('node', ['--version']);
|
1126 |
+
* console.log(stdout);
|
1127 |
+
* }
|
1128 |
+
* getVersion();
|
1129 |
+
* ```
|
1130 |
+
*
|
1131 |
+
* **If the `shell` option is enabled, do not pass unsanitized user input to this**
|
1132 |
+
* **function. Any input containing shell metacharacters may be used to trigger**
|
1133 |
+
* **arbitrary command execution.**
|
1134 |
+
*
|
1135 |
+
* If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except
|
1136 |
+
* the error passed to the callback will be an `AbortError`:
|
1137 |
+
*
|
1138 |
+
* ```js
|
1139 |
+
* const { execFile } = require('child_process');
|
1140 |
+
* const controller = new AbortController();
|
1141 |
+
* const { signal } = controller;
|
1142 |
+
* const child = execFile('node', ['--version'], { signal }, (error) => {
|
1143 |
+
* console.log(error); // an AbortError
|
1144 |
+
* });
|
1145 |
+
* controller.abort();
|
1146 |
+
* ```
|
1147 |
+
* @since v0.1.91
|
1148 |
+
* @param file The name or path of the executable file to run.
|
1149 |
+
* @param args List of string arguments.
|
1150 |
+
* @param callback Called with the output when process terminates.
|
1151 |
+
*/
|
1152 |
+
function execFile(file: string): ChildProcess;
|
1153 |
+
function execFile(
|
1154 |
+
file: string,
|
1155 |
+
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
1156 |
+
): ChildProcess;
|
1157 |
+
function execFile(file: string, args?: readonly string[] | null): ChildProcess;
|
1158 |
+
function execFile(
|
1159 |
+
file: string,
|
1160 |
+
args: readonly string[] | undefined | null,
|
1161 |
+
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
1162 |
+
): ChildProcess;
|
1163 |
+
// no `options` definitely means stdout/stderr are `string`.
|
1164 |
+
function execFile(
|
1165 |
+
file: string,
|
1166 |
+
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
1167 |
+
): ChildProcess;
|
1168 |
+
function execFile(
|
1169 |
+
file: string,
|
1170 |
+
args: readonly string[] | undefined | null,
|
1171 |
+
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
1172 |
+
): ChildProcess;
|
1173 |
+
// `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`.
|
1174 |
+
function execFile(
|
1175 |
+
file: string,
|
1176 |
+
options: ExecFileOptionsWithBufferEncoding,
|
1177 |
+
callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void,
|
1178 |
+
): ChildProcess;
|
1179 |
+
function execFile(
|
1180 |
+
file: string,
|
1181 |
+
args: readonly string[] | undefined | null,
|
1182 |
+
options: ExecFileOptionsWithBufferEncoding,
|
1183 |
+
callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void,
|
1184 |
+
): ChildProcess;
|
1185 |
+
// `options` with well known `encoding` means stdout/stderr are definitely `string`.
|
1186 |
+
function execFile(
|
1187 |
+
file: string,
|
1188 |
+
options: ExecFileOptionsWithStringEncoding,
|
1189 |
+
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
1190 |
+
): ChildProcess;
|
1191 |
+
function execFile(
|
1192 |
+
file: string,
|
1193 |
+
args: readonly string[] | undefined | null,
|
1194 |
+
options: ExecFileOptionsWithStringEncoding,
|
1195 |
+
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
1196 |
+
): ChildProcess;
|
1197 |
+
// `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`.
|
1198 |
+
// There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`.
|
1199 |
+
function execFile(
|
1200 |
+
file: string,
|
1201 |
+
options: ExecFileOptionsWithOtherEncoding,
|
1202 |
+
callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
1203 |
+
): ChildProcess;
|
1204 |
+
function execFile(
|
1205 |
+
file: string,
|
1206 |
+
args: readonly string[] | undefined | null,
|
1207 |
+
options: ExecFileOptionsWithOtherEncoding,
|
1208 |
+
callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
1209 |
+
): ChildProcess;
|
1210 |
+
// `options` without an `encoding` means stdout/stderr are definitely `string`.
|
1211 |
+
function execFile(
|
1212 |
+
file: string,
|
1213 |
+
options: ExecFileOptions,
|
1214 |
+
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
1215 |
+
): ChildProcess;
|
1216 |
+
function execFile(
|
1217 |
+
file: string,
|
1218 |
+
args: readonly string[] | undefined | null,
|
1219 |
+
options: ExecFileOptions,
|
1220 |
+
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
1221 |
+
): ChildProcess;
|
1222 |
+
// fallback if nothing else matches. Worst case is always `string | Buffer`.
|
1223 |
+
function execFile(
|
1224 |
+
file: string,
|
1225 |
+
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
1226 |
+
callback:
|
1227 |
+
| ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void)
|
1228 |
+
| undefined
|
1229 |
+
| null,
|
1230 |
+
): ChildProcess;
|
1231 |
+
function execFile(
|
1232 |
+
file: string,
|
1233 |
+
args: readonly string[] | undefined | null,
|
1234 |
+
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
1235 |
+
callback:
|
1236 |
+
| ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void)
|
1237 |
+
| undefined
|
1238 |
+
| null,
|
1239 |
+
): ChildProcess;
|
1240 |
+
namespace execFile {
|
1241 |
+
function __promisify__(file: string): PromiseWithChild<{
|
1242 |
+
stdout: string;
|
1243 |
+
stderr: string;
|
1244 |
+
}>;
|
1245 |
+
function __promisify__(
|
1246 |
+
file: string,
|
1247 |
+
args: readonly string[] | undefined | null,
|
1248 |
+
): PromiseWithChild<{
|
1249 |
+
stdout: string;
|
1250 |
+
stderr: string;
|
1251 |
+
}>;
|
1252 |
+
function __promisify__(
|
1253 |
+
file: string,
|
1254 |
+
options: ExecFileOptionsWithBufferEncoding,
|
1255 |
+
): PromiseWithChild<{
|
1256 |
+
stdout: Buffer;
|
1257 |
+
stderr: Buffer;
|
1258 |
+
}>;
|
1259 |
+
function __promisify__(
|
1260 |
+
file: string,
|
1261 |
+
args: readonly string[] | undefined | null,
|
1262 |
+
options: ExecFileOptionsWithBufferEncoding,
|
1263 |
+
): PromiseWithChild<{
|
1264 |
+
stdout: Buffer;
|
1265 |
+
stderr: Buffer;
|
1266 |
+
}>;
|
1267 |
+
function __promisify__(
|
1268 |
+
file: string,
|
1269 |
+
options: ExecFileOptionsWithStringEncoding,
|
1270 |
+
): PromiseWithChild<{
|
1271 |
+
stdout: string;
|
1272 |
+
stderr: string;
|
1273 |
+
}>;
|
1274 |
+
function __promisify__(
|
1275 |
+
file: string,
|
1276 |
+
args: readonly string[] | undefined | null,
|
1277 |
+
options: ExecFileOptionsWithStringEncoding,
|
1278 |
+
): PromiseWithChild<{
|
1279 |
+
stdout: string;
|
1280 |
+
stderr: string;
|
1281 |
+
}>;
|
1282 |
+
function __promisify__(
|
1283 |
+
file: string,
|
1284 |
+
options: ExecFileOptionsWithOtherEncoding,
|
1285 |
+
): PromiseWithChild<{
|
1286 |
+
stdout: string | Buffer;
|
1287 |
+
stderr: string | Buffer;
|
1288 |
+
}>;
|
1289 |
+
function __promisify__(
|
1290 |
+
file: string,
|
1291 |
+
args: readonly string[] | undefined | null,
|
1292 |
+
options: ExecFileOptionsWithOtherEncoding,
|
1293 |
+
): PromiseWithChild<{
|
1294 |
+
stdout: string | Buffer;
|
1295 |
+
stderr: string | Buffer;
|
1296 |
+
}>;
|
1297 |
+
function __promisify__(
|
1298 |
+
file: string,
|
1299 |
+
options: ExecFileOptions,
|
1300 |
+
): PromiseWithChild<{
|
1301 |
+
stdout: string;
|
1302 |
+
stderr: string;
|
1303 |
+
}>;
|
1304 |
+
function __promisify__(
|
1305 |
+
file: string,
|
1306 |
+
args: readonly string[] | undefined | null,
|
1307 |
+
options: ExecFileOptions,
|
1308 |
+
): PromiseWithChild<{
|
1309 |
+
stdout: string;
|
1310 |
+
stderr: string;
|
1311 |
+
}>;
|
1312 |
+
function __promisify__(
|
1313 |
+
file: string,
|
1314 |
+
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
1315 |
+
): PromiseWithChild<{
|
1316 |
+
stdout: string | Buffer;
|
1317 |
+
stderr: string | Buffer;
|
1318 |
+
}>;
|
1319 |
+
function __promisify__(
|
1320 |
+
file: string,
|
1321 |
+
args: readonly string[] | undefined | null,
|
1322 |
+
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
1323 |
+
): PromiseWithChild<{
|
1324 |
+
stdout: string | Buffer;
|
1325 |
+
stderr: string | Buffer;
|
1326 |
+
}>;
|
1327 |
+
}
|
1328 |
+
interface ForkOptions extends ProcessEnvOptions, MessagingOptions, Abortable {
|
1329 |
+
execPath?: string | undefined;
|
1330 |
+
execArgv?: string[] | undefined;
|
1331 |
+
silent?: boolean | undefined;
|
1332 |
+
/**
|
1333 |
+
* Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings.
|
1334 |
+
* If passed as an array, the first element is used for `stdin`, the second for
|
1335 |
+
* `stdout`, and the third for `stderr`. A fourth element can be used to
|
1336 |
+
* specify the `stdio` behavior beyond the standard streams. See
|
1337 |
+
* {@link ChildProcess.stdio} for more information.
|
1338 |
+
*
|
1339 |
+
* @default 'pipe'
|
1340 |
+
*/
|
1341 |
+
stdio?: StdioOptions | undefined;
|
1342 |
+
detached?: boolean | undefined;
|
1343 |
+
windowsVerbatimArguments?: boolean | undefined;
|
1344 |
+
}
|
1345 |
+
/**
|
1346 |
+
* The `child_process.fork()` method is a special case of {@link spawn} used specifically to spawn new Node.js processes.
|
1347 |
+
* Like {@link spawn}, a `ChildProcess` object is returned. The
|
1348 |
+
* returned `ChildProcess` will have an additional communication channel
|
1349 |
+
* built-in that allows messages to be passed back and forth between the parent and
|
1350 |
+
* child. See `subprocess.send()` for details.
|
1351 |
+
*
|
1352 |
+
* Keep in mind that spawned Node.js child processes are
|
1353 |
+
* independent of the parent with exception of the IPC communication channel
|
1354 |
+
* that is established between the two. Each process has its own memory, with
|
1355 |
+
* their own V8 instances. Because of the additional resource allocations
|
1356 |
+
* required, spawning a large number of child Node.js processes is not
|
1357 |
+
* recommended.
|
1358 |
+
*
|
1359 |
+
* By default, `child_process.fork()` will spawn new Node.js instances using the `process.execPath` of the parent process. The `execPath` property in the`options` object allows for an alternative
|
1360 |
+
* execution path to be used.
|
1361 |
+
*
|
1362 |
+
* Node.js processes launched with a custom `execPath` will communicate with the
|
1363 |
+
* parent process using the file descriptor (fd) identified using the
|
1364 |
+
* environment variable `NODE_CHANNEL_FD` on the child process.
|
1365 |
+
*
|
1366 |
+
* Unlike the [`fork(2)`](http://man7.org/linux/man-pages/man2/fork.2.html) POSIX system call, `child_process.fork()` does not clone the
|
1367 |
+
* current process.
|
1368 |
+
*
|
1369 |
+
* The `shell` option available in {@link spawn} is not supported by`child_process.fork()` and will be ignored if set.
|
1370 |
+
*
|
1371 |
+
* If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except
|
1372 |
+
* the error passed to the callback will be an `AbortError`:
|
1373 |
+
*
|
1374 |
+
* ```js
|
1375 |
+
* if (process.argv[2] === 'child') {
|
1376 |
+
* setTimeout(() => {
|
1377 |
+
* console.log(`Hello from ${process.argv[2]}!`);
|
1378 |
+
* }, 1_000);
|
1379 |
+
* } else {
|
1380 |
+
* const { fork } = require('child_process');
|
1381 |
+
* const controller = new AbortController();
|
1382 |
+
* const { signal } = controller;
|
1383 |
+
* const child = fork(__filename, ['child'], { signal });
|
1384 |
+
* child.on('error', (err) => {
|
1385 |
+
* // This will be called with err being an AbortError if the controller aborts
|
1386 |
+
* });
|
1387 |
+
* controller.abort(); // Stops the child process
|
1388 |
+
* }
|
1389 |
+
* ```
|
1390 |
+
* @since v0.5.0
|
1391 |
+
* @param modulePath The module to run in the child.
|
1392 |
+
* @param args List of string arguments.
|
1393 |
+
*/
|
1394 |
+
function fork(modulePath: string, options?: ForkOptions): ChildProcess;
|
1395 |
+
function fork(modulePath: string, args?: readonly string[], options?: ForkOptions): ChildProcess;
|
1396 |
+
interface SpawnSyncOptions extends CommonSpawnOptions {
|
1397 |
+
input?: string | NodeJS.ArrayBufferView | undefined;
|
1398 |
+
maxBuffer?: number | undefined;
|
1399 |
+
encoding?: BufferEncoding | "buffer" | null | undefined;
|
1400 |
+
}
|
1401 |
+
interface SpawnSyncOptionsWithStringEncoding extends SpawnSyncOptions {
|
1402 |
+
encoding: BufferEncoding;
|
1403 |
+
}
|
1404 |
+
interface SpawnSyncOptionsWithBufferEncoding extends SpawnSyncOptions {
|
1405 |
+
encoding?: "buffer" | null | undefined;
|
1406 |
+
}
|
1407 |
+
interface SpawnSyncReturns<T> {
|
1408 |
+
pid: number;
|
1409 |
+
output: Array<T | null>;
|
1410 |
+
stdout: T;
|
1411 |
+
stderr: T;
|
1412 |
+
status: number | null;
|
1413 |
+
signal: NodeJS.Signals | null;
|
1414 |
+
error?: Error | undefined;
|
1415 |
+
}
|
1416 |
+
/**
|
1417 |
+
* The `child_process.spawnSync()` method is generally identical to {@link spawn} with the exception that the function will not return
|
1418 |
+
* until the child process has fully closed. When a timeout has been encountered
|
1419 |
+
* and `killSignal` is sent, the method won't return until the process has
|
1420 |
+
* completely exited. If the process intercepts and handles the `SIGTERM` signal
|
1421 |
+
* and doesn't exit, the parent process will wait until the child process has
|
1422 |
+
* exited.
|
1423 |
+
*
|
1424 |
+
* **If the `shell` option is enabled, do not pass unsanitized user input to this**
|
1425 |
+
* **function. Any input containing shell metacharacters may be used to trigger**
|
1426 |
+
* **arbitrary command execution.**
|
1427 |
+
* @since v0.11.12
|
1428 |
+
* @param command The command to run.
|
1429 |
+
* @param args List of string arguments.
|
1430 |
+
*/
|
1431 |
+
function spawnSync(command: string): SpawnSyncReturns<Buffer>;
|
1432 |
+
function spawnSync(command: string, options: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
|
1433 |
+
function spawnSync(command: string, options: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
|
1434 |
+
function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns<string | Buffer>;
|
1435 |
+
function spawnSync(command: string, args: readonly string[]): SpawnSyncReturns<Buffer>;
|
1436 |
+
function spawnSync(
|
1437 |
+
command: string,
|
1438 |
+
args: readonly string[],
|
1439 |
+
options: SpawnSyncOptionsWithStringEncoding,
|
1440 |
+
): SpawnSyncReturns<string>;
|
1441 |
+
function spawnSync(
|
1442 |
+
command: string,
|
1443 |
+
args: readonly string[],
|
1444 |
+
options: SpawnSyncOptionsWithBufferEncoding,
|
1445 |
+
): SpawnSyncReturns<Buffer>;
|
1446 |
+
function spawnSync(
|
1447 |
+
command: string,
|
1448 |
+
args?: readonly string[],
|
1449 |
+
options?: SpawnSyncOptions,
|
1450 |
+
): SpawnSyncReturns<string | Buffer>;
|
1451 |
+
interface CommonExecOptions extends CommonOptions {
|
1452 |
+
input?: string | NodeJS.ArrayBufferView | undefined;
|
1453 |
+
/**
|
1454 |
+
* Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings.
|
1455 |
+
* If passed as an array, the first element is used for `stdin`, the second for
|
1456 |
+
* `stdout`, and the third for `stderr`. A fourth element can be used to
|
1457 |
+
* specify the `stdio` behavior beyond the standard streams. See
|
1458 |
+
* {@link ChildProcess.stdio} for more information.
|
1459 |
+
*
|
1460 |
+
* @default 'pipe'
|
1461 |
+
*/
|
1462 |
+
stdio?: StdioOptions | undefined;
|
1463 |
+
killSignal?: NodeJS.Signals | number | undefined;
|
1464 |
+
maxBuffer?: number | undefined;
|
1465 |
+
encoding?: BufferEncoding | "buffer" | null | undefined;
|
1466 |
+
}
|
1467 |
+
interface ExecSyncOptions extends CommonExecOptions {
|
1468 |
+
shell?: string | undefined;
|
1469 |
+
}
|
1470 |
+
interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions {
|
1471 |
+
encoding: BufferEncoding;
|
1472 |
+
}
|
1473 |
+
interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions {
|
1474 |
+
encoding?: "buffer" | null | undefined;
|
1475 |
+
}
|
1476 |
+
/**
|
1477 |
+
* The `child_process.execSync()` method is generally identical to {@link exec} with the exception that the method will not return
|
1478 |
+
* until the child process has fully closed. When a timeout has been encountered
|
1479 |
+
* and `killSignal` is sent, the method won't return until the process has
|
1480 |
+
* completely exited. If the child process intercepts and handles the `SIGTERM`signal and doesn't exit, the parent process will wait until the child process
|
1481 |
+
* has exited.
|
1482 |
+
*
|
1483 |
+
* If the process times out or has a non-zero exit code, this method will throw.
|
1484 |
+
* The `Error` object will contain the entire result from {@link spawnSync}.
|
1485 |
+
*
|
1486 |
+
* **Never pass unsanitized user input to this function. Any input containing shell**
|
1487 |
+
* **metacharacters may be used to trigger arbitrary command execution.**
|
1488 |
+
* @since v0.11.12
|
1489 |
+
* @param command The command to run.
|
1490 |
+
* @return The stdout from the command.
|
1491 |
+
*/
|
1492 |
+
function execSync(command: string): Buffer;
|
1493 |
+
function execSync(command: string, options: ExecSyncOptionsWithStringEncoding): string;
|
1494 |
+
function execSync(command: string, options: ExecSyncOptionsWithBufferEncoding): Buffer;
|
1495 |
+
function execSync(command: string, options?: ExecSyncOptions): string | Buffer;
|
1496 |
+
interface ExecFileSyncOptions extends CommonExecOptions {
|
1497 |
+
shell?: boolean | string | undefined;
|
1498 |
+
}
|
1499 |
+
interface ExecFileSyncOptionsWithStringEncoding extends ExecFileSyncOptions {
|
1500 |
+
encoding: BufferEncoding;
|
1501 |
+
}
|
1502 |
+
interface ExecFileSyncOptionsWithBufferEncoding extends ExecFileSyncOptions {
|
1503 |
+
encoding?: "buffer" | null; // specify `null`.
|
1504 |
+
}
|
1505 |
+
/**
|
1506 |
+
* The `child_process.execFileSync()` method is generally identical to {@link execFile} with the exception that the method will not
|
1507 |
+
* return until the child process has fully closed. When a timeout has been
|
1508 |
+
* encountered and `killSignal` is sent, the method won't return until the process
|
1509 |
+
* has completely exited.
|
1510 |
+
*
|
1511 |
+
* If the child process intercepts and handles the `SIGTERM` signal and
|
1512 |
+
* does not exit, the parent process will still wait until the child process has
|
1513 |
+
* exited.
|
1514 |
+
*
|
1515 |
+
* If the process times out or has a non-zero exit code, this method will throw an `Error` that will include the full result of the underlying {@link spawnSync}.
|
1516 |
+
*
|
1517 |
+
* **If the `shell` option is enabled, do not pass unsanitized user input to this**
|
1518 |
+
* **function. Any input containing shell metacharacters may be used to trigger**
|
1519 |
+
* **arbitrary command execution.**
|
1520 |
+
* @since v0.11.12
|
1521 |
+
* @param file The name or path of the executable file to run.
|
1522 |
+
* @param args List of string arguments.
|
1523 |
+
* @return The stdout from the command.
|
1524 |
+
*/
|
1525 |
+
function execFileSync(file: string): Buffer;
|
1526 |
+
function execFileSync(file: string, options: ExecFileSyncOptionsWithStringEncoding): string;
|
1527 |
+
function execFileSync(file: string, options: ExecFileSyncOptionsWithBufferEncoding): Buffer;
|
1528 |
+
function execFileSync(file: string, options?: ExecFileSyncOptions): string | Buffer;
|
1529 |
+
function execFileSync(file: string, args: readonly string[]): Buffer;
|
1530 |
+
function execFileSync(
|
1531 |
+
file: string,
|
1532 |
+
args: readonly string[],
|
1533 |
+
options: ExecFileSyncOptionsWithStringEncoding,
|
1534 |
+
): string;
|
1535 |
+
function execFileSync(
|
1536 |
+
file: string,
|
1537 |
+
args: readonly string[],
|
1538 |
+
options: ExecFileSyncOptionsWithBufferEncoding,
|
1539 |
+
): Buffer;
|
1540 |
+
function execFileSync(file: string, args?: readonly string[], options?: ExecFileSyncOptions): string | Buffer;
|
1541 |
+
}
|
1542 |
+
declare module "node:child_process" {
|
1543 |
+
export * from "child_process";
|
1544 |
+
}
|
backend/node_modules/@types/node/cluster.d.ts
ADDED
@@ -0,0 +1,578 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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-v18.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
|
8 |
+
* server ports.
|
9 |
+
*
|
10 |
+
* ```js
|
11 |
+
* import cluster from 'node:cluster';
|
12 |
+
* import http from 'node:http';
|
13 |
+
* import { availableParallelism } from 'node:os';
|
14 |
+
* import process from 'node:process';
|
15 |
+
*
|
16 |
+
* const numCPUs = availableParallelism();
|
17 |
+
*
|
18 |
+
* if (cluster.isPrimary) {
|
19 |
+
* console.log(`Primary ${process.pid} is running`);
|
20 |
+
*
|
21 |
+
* // Fork workers.
|
22 |
+
* for (let i = 0; i < numCPUs; i++) {
|
23 |
+
* cluster.fork();
|
24 |
+
* }
|
25 |
+
*
|
26 |
+
* cluster.on('exit', (worker, code, signal) => {
|
27 |
+
* console.log(`worker ${worker.process.pid} died`);
|
28 |
+
* });
|
29 |
+
* } else {
|
30 |
+
* // Workers can share any TCP connection
|
31 |
+
* // In this case it is an HTTP server
|
32 |
+
* http.createServer((req, res) => {
|
33 |
+
* res.writeHead(200);
|
34 |
+
* res.end('hello world\n');
|
35 |
+
* }).listen(8000);
|
36 |
+
*
|
37 |
+
* console.log(`Worker ${process.pid} started`);
|
38 |
+
* }
|
39 |
+
* ```
|
40 |
+
*
|
41 |
+
* Running Node.js will now share port 8000 between the workers:
|
42 |
+
*
|
43 |
+
* ```console
|
44 |
+
* $ node server.js
|
45 |
+
* Primary 3596 is running
|
46 |
+
* Worker 4324 started
|
47 |
+
* Worker 4520 started
|
48 |
+
* Worker 6056 started
|
49 |
+
* Worker 5644 started
|
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/v18.19.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?: 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-v18.x/api/child_process.html#child_processspawncommand-args-options)'s
|
84 |
+
* [`stdio`](https://nodejs.org/docs/latest-v18.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-v18.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 |
+
*
|
140 |
+
* While a worker is alive, this is the key that indexes it in `cluster.workers`.
|
141 |
+
* @since v0.8.0
|
142 |
+
*/
|
143 |
+
id: number;
|
144 |
+
/**
|
145 |
+
* All workers are created using [`child_process.fork()`](https://nodejs.org/docs/latest-v18.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-v18.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-v18.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 |
+
*
|
163 |
+
* This example will echo back all messages from the primary:
|
164 |
+
*
|
165 |
+
* ```js
|
166 |
+
* if (cluster.isPrimary) {
|
167 |
+
* const worker = cluster.fork();
|
168 |
+
* worker.send('hi there');
|
169 |
+
*
|
170 |
+
* } else if (cluster.isWorker) {
|
171 |
+
* process.on('message', (msg) => {
|
172 |
+
* process.send(msg);
|
173 |
+
* });
|
174 |
+
* }
|
175 |
+
* ```
|
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 |
+
/**
|
192 |
+
* This function will kill the worker. In the primary worker, it does this by
|
193 |
+
* disconnecting the `worker.process`, and once disconnected, killing with `signal`. In the worker, it does it by killing the process with `signal`.
|
194 |
+
*
|
195 |
+
* The `kill()` function kills the worker process without waiting for a graceful
|
196 |
+
* disconnect, it has the same behavior as `worker.process.kill()`.
|
197 |
+
*
|
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-v18.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 |
+
*/
|
205 |
+
kill(signal?: string): void;
|
206 |
+
destroy(signal?: string): void;
|
207 |
+
/**
|
208 |
+
* In a worker, this function will close all servers, wait for the `'close'` event
|
209 |
+
* on those servers, and then disconnect the IPC channel.
|
210 |
+
*
|
211 |
+
* In the primary, an internal message is sent to the worker causing it to call `.disconnect()` on itself.
|
212 |
+
*
|
213 |
+
* Causes `.exitedAfterDisconnect` to be set.
|
214 |
+
*
|
215 |
+
* After a server is closed, it will no longer accept new connections,
|
216 |
+
* but connections may be accepted by any other listening worker. Existing
|
217 |
+
* connections will be allowed to close as usual. When no more connections exist,
|
218 |
+
* see `server.close()`, the IPC channel to the worker will close allowing it
|
219 |
+
* to die gracefully.
|
220 |
+
*
|
221 |
+
* The above applies _only_ to server connections, client connections are not
|
222 |
+
* automatically closed by workers, and disconnect does not wait for them to close
|
223 |
+
* before exiting.
|
224 |
+
*
|
225 |
+
* In a worker, `process.disconnect` exists, but it is not this function;
|
226 |
+
* it is `disconnect()`.
|
227 |
+
*
|
228 |
+
* Because long living server connections may block workers from disconnecting, it
|
229 |
+
* may be useful to send a message, so application specific actions may be taken to
|
230 |
+
* close them. It also may be useful to implement a timeout, killing a worker if
|
231 |
+
* the `'disconnect'` event has not been emitted after some time.
|
232 |
+
*
|
233 |
+
* ```js
|
234 |
+
* if (cluster.isPrimary) {
|
235 |
+
* const worker = cluster.fork();
|
236 |
+
* let timeout;
|
237 |
+
*
|
238 |
+
* worker.on('listening', (address) => {
|
239 |
+
* worker.send('shutdown');
|
240 |
+
* worker.disconnect();
|
241 |
+
* timeout = setTimeout(() => {
|
242 |
+
* worker.kill();
|
243 |
+
* }, 2000);
|
244 |
+
* });
|
245 |
+
*
|
246 |
+
* worker.on('disconnect', () => {
|
247 |
+
* clearTimeout(timeout);
|
248 |
+
* });
|
249 |
+
*
|
250 |
+
* } else if (cluster.isWorker) {
|
251 |
+
* const net = require('node:net');
|
252 |
+
* const server = net.createServer((socket) => {
|
253 |
+
* // Connections never end
|
254 |
+
* });
|
255 |
+
*
|
256 |
+
* server.listen(8000);
|
257 |
+
*
|
258 |
+
* process.on('message', (msg) => {
|
259 |
+
* if (msg === 'shutdown') {
|
260 |
+
* // Initiate graceful close of any connections to server
|
261 |
+
* }
|
262 |
+
* });
|
263 |
+
* }
|
264 |
+
* ```
|
265 |
+
* @since v0.7.7
|
266 |
+
* @return A reference to `worker`.
|
267 |
+
*/
|
268 |
+
disconnect(): void;
|
269 |
+
/**
|
270 |
+
* This function returns `true` if the worker is connected to its primary via its
|
271 |
+
* IPC channel, `false` otherwise. A worker is connected to its primary after it
|
272 |
+
* has been created. It is disconnected after the `'disconnect'` event is emitted.
|
273 |
+
* @since v0.11.14
|
274 |
+
*/
|
275 |
+
isConnected(): boolean;
|
276 |
+
/**
|
277 |
+
* This function returns `true` if the worker's process has terminated (either
|
278 |
+
* because of exiting or being signaled). Otherwise, it returns `false`.
|
279 |
+
*
|
280 |
+
* ```js
|
281 |
+
* import cluster from 'node:cluster';
|
282 |
+
* import http from 'node:http';
|
283 |
+
* import { availableParallelism } from 'node:os';
|
284 |
+
* import process from 'node:process';
|
285 |
+
*
|
286 |
+
* const numCPUs = availableParallelism();
|
287 |
+
*
|
288 |
+
* if (cluster.isPrimary) {
|
289 |
+
* console.log(`Primary ${process.pid} is running`);
|
290 |
+
*
|
291 |
+
* // Fork workers.
|
292 |
+
* for (let i = 0; i < numCPUs; i++) {
|
293 |
+
* cluster.fork();
|
294 |
+
* }
|
295 |
+
*
|
296 |
+
* cluster.on('fork', (worker) => {
|
297 |
+
* console.log('worker is dead:', worker.isDead());
|
298 |
+
* });
|
299 |
+
*
|
300 |
+
* cluster.on('exit', (worker, code, signal) => {
|
301 |
+
* console.log('worker is dead:', worker.isDead());
|
302 |
+
* });
|
303 |
+
* } else {
|
304 |
+
* // Workers can share any TCP connection. In this case, it is an HTTP server.
|
305 |
+
* http.createServer((req, res) => {
|
306 |
+
* res.writeHead(200);
|
307 |
+
* res.end(`Current process\n ${process.pid}`);
|
308 |
+
* process.kill(process.pid);
|
309 |
+
* }).listen(8000);
|
310 |
+
* }
|
311 |
+
* ```
|
312 |
+
* @since v0.11.14
|
313 |
+
*/
|
314 |
+
isDead(): boolean;
|
315 |
+
/**
|
316 |
+
* This property is `true` if the worker exited due to `.disconnect()`.
|
317 |
+
* If the worker exited any other way, it is `false`. If the
|
318 |
+
* worker has not exited, it is `undefined`.
|
319 |
+
*
|
320 |
+
* The boolean `worker.exitedAfterDisconnect` allows distinguishing between
|
321 |
+
* voluntary and accidental exit, the primary may choose not to respawn a worker
|
322 |
+
* based on this value.
|
323 |
+
*
|
324 |
+
* ```js
|
325 |
+
* cluster.on('exit', (worker, code, signal) => {
|
326 |
+
* if (worker.exitedAfterDisconnect === true) {
|
327 |
+
* console.log('Oh, it was just voluntary – no need to worry');
|
328 |
+
* }
|
329 |
+
* });
|
330 |
+
*
|
331 |
+
* // kill worker
|
332 |
+
* worker.kill();
|
333 |
+
* ```
|
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 global
|
414 |
+
* setting and effectively frozen once either the first worker is spawned, or [`.setupPrimary()`](https://nodejs.org/docs/latest-v18.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-v18.x/api/cluster.html#clustersetupprimarysettings)
|
426 |
+
* (or [`.fork()`](https://nodejs.org/docs/latest-v18.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-v18.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-v18.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-v18.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 | undefined;
|
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> | undefined;
|
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 |
+
// the handle is a net.Socket or net.Server object, or undefined.
|
553 |
+
prependListener(
|
554 |
+
event: "message",
|
555 |
+
listener: (worker: Worker, message: any, handle?: net.Socket | net.Server) => void,
|
556 |
+
): this;
|
557 |
+
prependListener(event: "online", listener: (worker: Worker) => void): this;
|
558 |
+
prependListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
559 |
+
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
560 |
+
prependOnceListener(event: "disconnect", listener: (worker: Worker) => void): this;
|
561 |
+
prependOnceListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
|
562 |
+
prependOnceListener(event: "fork", listener: (worker: Worker) => void): this;
|
563 |
+
prependOnceListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
|
564 |
+
// the handle is a net.Socket or net.Server object, or undefined.
|
565 |
+
prependOnceListener(
|
566 |
+
event: "message",
|
567 |
+
listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void,
|
568 |
+
): this;
|
569 |
+
prependOnceListener(event: "online", listener: (worker: Worker) => void): this;
|
570 |
+
prependOnceListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
|
571 |
+
}
|
572 |
+
const cluster: Cluster;
|
573 |
+
export default cluster;
|
574 |
+
}
|
575 |
+
declare module "node:cluster" {
|
576 |
+
export * from "cluster";
|
577 |
+
export { default as default } from "cluster";
|
578 |
+
}
|
backend/node_modules/@types/node/console.d.ts
ADDED
@@ -0,0 +1,452 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* The `node:console` module provides a simple debugging console that is similar to
|
3 |
+
* the JavaScript console mechanism provided by web browsers.
|
4 |
+
*
|
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-v18.x/api/process.html#processstdout) and
|
9 |
+
* [`process.stderr`](https://nodejs.org/docs/latest-v18.x/api/process.html#processstderr). The global `console` can be used without calling `require('node:console')`.
|
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-v18.x/api/process.html#a-note-on-process-io) for
|
14 |
+
* more information.
|
15 |
+
*
|
16 |
+
* Example using the global `console`:
|
17 |
+
*
|
18 |
+
* ```js
|
19 |
+
* console.log('hello world');
|
20 |
+
* // Prints: hello world, to stdout
|
21 |
+
* console.log('hello %s', 'world');
|
22 |
+
* // Prints: hello world, to stdout
|
23 |
+
* console.error(new Error('Whoops, something bad happened'));
|
24 |
+
* // Prints error message and stack trace to stderr:
|
25 |
+
* // Error: Whoops, something bad happened
|
26 |
+
* // at [eval]:5:15
|
27 |
+
* // at Script.runInThisContext (node:vm:132:18)
|
28 |
+
* // at Object.runInThisContext (node:vm:309:38)
|
29 |
+
* // at node:internal/process/execution:77:19
|
30 |
+
* // at [eval]-wrapper:6:22
|
31 |
+
* // at evalScript (node:internal/process/execution:76:60)
|
32 |
+
* // at node:internal/main/eval_string:23:3
|
33 |
+
*
|
34 |
+
* const name = 'Will Robinson';
|
35 |
+
* console.warn(`Danger ${name}! Danger!`);
|
36 |
+
* // Prints: Danger Will Robinson! Danger!, to stderr
|
37 |
+
* ```
|
38 |
+
*
|
39 |
+
* Example using the `Console` class:
|
40 |
+
*
|
41 |
+
* ```js
|
42 |
+
* const out = getStreamSomehow();
|
43 |
+
* const err = getStreamSomehow();
|
44 |
+
* const myConsole = new console.Console(out, err);
|
45 |
+
*
|
46 |
+
* myConsole.log('hello world');
|
47 |
+
* // Prints: hello world, to out
|
48 |
+
* myConsole.log('hello %s', 'world');
|
49 |
+
* // Prints: hello world, to out
|
50 |
+
* myConsole.error(new Error('Whoops, something bad happened'));
|
51 |
+
* // Prints: [Error: Whoops, something bad happened], to err
|
52 |
+
*
|
53 |
+
* const name = 'Will Robinson';
|
54 |
+
* myConsole.warn(`Danger ${name}! Danger!`);
|
55 |
+
* // Prints: Danger Will Robinson! Danger!, to err
|
56 |
+
* ```
|
57 |
+
* @see [source](https://github.com/nodejs/node/blob/v18.20.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-v18.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-v18.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-v18.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-v18.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-v18.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-v18.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-v18.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-v18.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}
|
330 |
+
* is called. The profile is then added to the Profile panel of the inspector.
|
331 |
+
*
|
332 |
+
* ```js
|
333 |
+
* console.profile('MyLabel');
|
334 |
+
* // Some code
|
335 |
+
* console.profileEnd('MyLabel');
|
336 |
+
* // Adds the profile 'MyLabel' to the Profiles panel of the inspector.
|
337 |
+
* ```
|
338 |
+
* @since v8.0.0
|
339 |
+
*/
|
340 |
+
profile(label?: string): void;
|
341 |
+
/**
|
342 |
+
* This method does not display anything unless used in the inspector. Stops the current
|
343 |
+
* JavaScript CPU profiling session if one has been started and prints the report to the
|
344 |
+
* Profiles panel of the inspector. See {@link profile} for an example.
|
345 |
+
*
|
346 |
+
* If this method is called without a label, the most recently started profile is stopped.
|
347 |
+
* @since v8.0.0
|
348 |
+
*/
|
349 |
+
profileEnd(label?: string): void;
|
350 |
+
/**
|
351 |
+
* This method does not display anything unless used in the inspector. The `console.timeStamp()`
|
352 |
+
* method adds an event with the label `'label'` to the Timeline panel of the inspector.
|
353 |
+
* @since v8.0.0
|
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-v18.x/api/process.html#processstdout) and
|
365 |
+
* [`process.stderr`](https://nodejs.org/docs/latest-v18.x/api/process.html#processstderr). The global `console` can be used without calling `require('console')`.
|
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-v18.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/v18.19.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-v18.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 |
+
}
|
backend/node_modules/@types/node/constants.d.ts
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */
|
2 |
+
declare module "constants" {
|
3 |
+
import { constants as osConstants, SignalConstants } from "node:os";
|
4 |
+
import { constants as cryptoConstants } from "node:crypto";
|
5 |
+
import { constants as fsConstants } from "node:fs";
|
6 |
+
|
7 |
+
const exp:
|
8 |
+
& typeof osConstants.errno
|
9 |
+
& typeof osConstants.priority
|
10 |
+
& SignalConstants
|
11 |
+
& typeof cryptoConstants
|
12 |
+
& typeof fsConstants;
|
13 |
+
export = exp;
|
14 |
+
}
|
15 |
+
|
16 |
+
declare module "node:constants" {
|
17 |
+
import constants = require("constants");
|
18 |
+
export = constants;
|
19 |
+
}
|