Spaces:
Sleeping
Sleeping
Orel MAZOR
commited on
Commit
·
d4f5807
1
Parent(s):
5cb69a2
tiny-agent
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .continue/.DS_Store +0 -0
- .continue/models/local-models.yaml +1 -1
- config.json +1 -1
- gradio_mcp_example.py +26 -0
- my-agent/agent.json +16 -0
- node_modules/.bin/is-docker +1 -0
- node_modules/.bin/is-inside-container +1 -0
- node_modules/.bin/mcp-remote +1 -0
- node_modules/.bin/mcp-remote-client +1 -0
- node_modules/.bin/mime +1 -0
- node_modules/.package-lock.json +970 -0
- node_modules/accepts/HISTORY.md +243 -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/array-flatten/LICENSE +21 -0
- node_modules/array-flatten/README.md +43 -0
- node_modules/array-flatten/array-flatten.js +64 -0
- node_modules/array-flatten/package.json +39 -0
- node_modules/body-parser/HISTORY.md +672 -0
- node_modules/body-parser/LICENSE +23 -0
- node_modules/body-parser/README.md +476 -0
- node_modules/body-parser/SECURITY.md +25 -0
- node_modules/body-parser/index.js +156 -0
- node_modules/body-parser/lib/read.js +205 -0
- node_modules/body-parser/lib/types/json.js +247 -0
- node_modules/body-parser/lib/types/raw.js +101 -0
- node_modules/body-parser/lib/types/text.js +121 -0
- node_modules/body-parser/lib/types/urlencoded.js +307 -0
- node_modules/body-parser/package.json +56 -0
- node_modules/bundle-name/index.js +5 -0
- node_modules/bundle-name/license +9 -0
- node_modules/bundle-name/package.json +45 -0
- node_modules/bundle-name/readme.md +23 -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
.continue/.DS_Store
CHANGED
Binary files a/.continue/.DS_Store and b/.continue/.DS_Store differ
|
|
.continue/models/local-models.yaml
CHANGED
@@ -3,7 +3,7 @@ version: 0.0.1
|
|
3 |
schema: v1
|
4 |
models:
|
5 |
- provider: ollama
|
6 |
-
model: unsloth/
|
7 |
defaultCompletionOptions:
|
8 |
contextLength: 8192
|
9 |
name: Ollama Devstral-Small
|
|
|
3 |
schema: v1
|
4 |
models:
|
5 |
- provider: ollama
|
6 |
+
model: hf.co/unsloth/Devstral-Small-2505-GGUF:UD-Q4_K_XL
|
7 |
defaultCompletionOptions:
|
8 |
contextLength: 8192
|
9 |
name: Ollama Devstral-Small
|
config.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
{
|
2 |
"mcpServers": {
|
3 |
"mcp": {
|
4 |
-
"url": "
|
5 |
}
|
6 |
}
|
7 |
}
|
|
|
1 |
{
|
2 |
"mcpServers": {
|
3 |
"mcp": {
|
4 |
+
"url": "https://huggingface.co/spaces/Coool2/mcp-sentiment/tree/main"
|
5 |
}
|
6 |
}
|
7 |
}
|
gradio_mcp_example.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import os
|
3 |
+
|
4 |
+
from smolagents import InferenceClientModel, CodeAgent, MCPClient
|
5 |
+
|
6 |
+
|
7 |
+
try:
|
8 |
+
mcp_client = MCPClient(
|
9 |
+
{"url": "https://abidlabs-mcp-tool-http.hf.space/gradio_api/mcp/sse"}
|
10 |
+
)
|
11 |
+
tools = mcp_client.get_tools()
|
12 |
+
|
13 |
+
model = InferenceClientModel(token=os.getenv("HUGGINGFACE_API_TOKEN"))
|
14 |
+
agent = CodeAgent(tools=[*tools], model=model, additional_authorized_imports=["json", "ast", "urllib", "base64"])
|
15 |
+
|
16 |
+
demo = gr.ChatInterface(
|
17 |
+
fn=lambda message, history: str(agent.run(message)),
|
18 |
+
type="messages",
|
19 |
+
examples=["Analyze the sentiment of the following text 'This is awesome'"],
|
20 |
+
title="Agent with MCP Tools",
|
21 |
+
description="This is a simple agent that uses MCP tools to answer questions.",
|
22 |
+
)
|
23 |
+
|
24 |
+
demo.launch()
|
25 |
+
finally:
|
26 |
+
mcp_client.disconnect()
|
my-agent/agent.json
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"model": "Qwen/Qwen2.5-72B-Instruct",
|
3 |
+
"provider": "nebius",
|
4 |
+
"servers": [
|
5 |
+
{
|
6 |
+
"type": "stdio",
|
7 |
+
"config": {
|
8 |
+
"command": "npx",
|
9 |
+
"args": [
|
10 |
+
"mcp-remote",
|
11 |
+
"http://localhost:7860/gradio_api/mcp/sse"
|
12 |
+
]
|
13 |
+
}
|
14 |
+
}
|
15 |
+
]
|
16 |
+
}
|
node_modules/.bin/is-docker
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
../is-docker/cli.js
|
node_modules/.bin/is-inside-container
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
../is-inside-container/cli.js
|
node_modules/.bin/mcp-remote
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
../mcp-remote/dist/proxy.js
|
node_modules/.bin/mcp-remote-client
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
../mcp-remote/dist/client.js
|
node_modules/.bin/mime
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
../mime/cli.js
|
node_modules/.package-lock.json
ADDED
@@ -0,0 +1,970 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "mcp-sentiment",
|
3 |
+
"lockfileVersion": 3,
|
4 |
+
"requires": true,
|
5 |
+
"packages": {
|
6 |
+
"node_modules/accepts": {
|
7 |
+
"version": "1.3.8",
|
8 |
+
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
|
9 |
+
"integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
|
10 |
+
"license": "MIT",
|
11 |
+
"dependencies": {
|
12 |
+
"mime-types": "~2.1.34",
|
13 |
+
"negotiator": "0.6.3"
|
14 |
+
},
|
15 |
+
"engines": {
|
16 |
+
"node": ">= 0.6"
|
17 |
+
}
|
18 |
+
},
|
19 |
+
"node_modules/array-flatten": {
|
20 |
+
"version": "1.1.1",
|
21 |
+
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
22 |
+
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==",
|
23 |
+
"license": "MIT"
|
24 |
+
},
|
25 |
+
"node_modules/body-parser": {
|
26 |
+
"version": "1.20.3",
|
27 |
+
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz",
|
28 |
+
"integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==",
|
29 |
+
"license": "MIT",
|
30 |
+
"dependencies": {
|
31 |
+
"bytes": "3.1.2",
|
32 |
+
"content-type": "~1.0.5",
|
33 |
+
"debug": "2.6.9",
|
34 |
+
"depd": "2.0.0",
|
35 |
+
"destroy": "1.2.0",
|
36 |
+
"http-errors": "2.0.0",
|
37 |
+
"iconv-lite": "0.4.24",
|
38 |
+
"on-finished": "2.4.1",
|
39 |
+
"qs": "6.13.0",
|
40 |
+
"raw-body": "2.5.2",
|
41 |
+
"type-is": "~1.6.18",
|
42 |
+
"unpipe": "1.0.0"
|
43 |
+
},
|
44 |
+
"engines": {
|
45 |
+
"node": ">= 0.8",
|
46 |
+
"npm": "1.2.8000 || >= 1.4.16"
|
47 |
+
}
|
48 |
+
},
|
49 |
+
"node_modules/bundle-name": {
|
50 |
+
"version": "4.1.0",
|
51 |
+
"resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-4.1.0.tgz",
|
52 |
+
"integrity": "sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==",
|
53 |
+
"license": "MIT",
|
54 |
+
"dependencies": {
|
55 |
+
"run-applescript": "^7.0.0"
|
56 |
+
},
|
57 |
+
"engines": {
|
58 |
+
"node": ">=18"
|
59 |
+
},
|
60 |
+
"funding": {
|
61 |
+
"url": "https://github.com/sponsors/sindresorhus"
|
62 |
+
}
|
63 |
+
},
|
64 |
+
"node_modules/bytes": {
|
65 |
+
"version": "3.1.2",
|
66 |
+
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
|
67 |
+
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
|
68 |
+
"license": "MIT",
|
69 |
+
"engines": {
|
70 |
+
"node": ">= 0.8"
|
71 |
+
}
|
72 |
+
},
|
73 |
+
"node_modules/call-bind-apply-helpers": {
|
74 |
+
"version": "1.0.2",
|
75 |
+
"resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
|
76 |
+
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
|
77 |
+
"license": "MIT",
|
78 |
+
"dependencies": {
|
79 |
+
"es-errors": "^1.3.0",
|
80 |
+
"function-bind": "^1.1.2"
|
81 |
+
},
|
82 |
+
"engines": {
|
83 |
+
"node": ">= 0.4"
|
84 |
+
}
|
85 |
+
},
|
86 |
+
"node_modules/call-bound": {
|
87 |
+
"version": "1.0.4",
|
88 |
+
"resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",
|
89 |
+
"integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
|
90 |
+
"license": "MIT",
|
91 |
+
"dependencies": {
|
92 |
+
"call-bind-apply-helpers": "^1.0.2",
|
93 |
+
"get-intrinsic": "^1.3.0"
|
94 |
+
},
|
95 |
+
"engines": {
|
96 |
+
"node": ">= 0.4"
|
97 |
+
},
|
98 |
+
"funding": {
|
99 |
+
"url": "https://github.com/sponsors/ljharb"
|
100 |
+
}
|
101 |
+
},
|
102 |
+
"node_modules/content-disposition": {
|
103 |
+
"version": "0.5.4",
|
104 |
+
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
|
105 |
+
"integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
|
106 |
+
"license": "MIT",
|
107 |
+
"dependencies": {
|
108 |
+
"safe-buffer": "5.2.1"
|
109 |
+
},
|
110 |
+
"engines": {
|
111 |
+
"node": ">= 0.6"
|
112 |
+
}
|
113 |
+
},
|
114 |
+
"node_modules/content-type": {
|
115 |
+
"version": "1.0.5",
|
116 |
+
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
|
117 |
+
"integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
|
118 |
+
"license": "MIT",
|
119 |
+
"engines": {
|
120 |
+
"node": ">= 0.6"
|
121 |
+
}
|
122 |
+
},
|
123 |
+
"node_modules/cookie": {
|
124 |
+
"version": "0.7.1",
|
125 |
+
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.1.tgz",
|
126 |
+
"integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==",
|
127 |
+
"license": "MIT",
|
128 |
+
"engines": {
|
129 |
+
"node": ">= 0.6"
|
130 |
+
}
|
131 |
+
},
|
132 |
+
"node_modules/cookie-signature": {
|
133 |
+
"version": "1.0.6",
|
134 |
+
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
|
135 |
+
"integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==",
|
136 |
+
"license": "MIT"
|
137 |
+
},
|
138 |
+
"node_modules/debug": {
|
139 |
+
"version": "2.6.9",
|
140 |
+
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
141 |
+
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
142 |
+
"license": "MIT",
|
143 |
+
"dependencies": {
|
144 |
+
"ms": "2.0.0"
|
145 |
+
}
|
146 |
+
},
|
147 |
+
"node_modules/default-browser": {
|
148 |
+
"version": "5.2.1",
|
149 |
+
"resolved": "https://registry.npmjs.org/default-browser/-/default-browser-5.2.1.tgz",
|
150 |
+
"integrity": "sha512-WY/3TUME0x3KPYdRRxEJJvXRHV4PyPoUsxtZa78lwItwRQRHhd2U9xOscaT/YTf8uCXIAjeJOFBVEh/7FtD8Xg==",
|
151 |
+
"license": "MIT",
|
152 |
+
"dependencies": {
|
153 |
+
"bundle-name": "^4.1.0",
|
154 |
+
"default-browser-id": "^5.0.0"
|
155 |
+
},
|
156 |
+
"engines": {
|
157 |
+
"node": ">=18"
|
158 |
+
},
|
159 |
+
"funding": {
|
160 |
+
"url": "https://github.com/sponsors/sindresorhus"
|
161 |
+
}
|
162 |
+
},
|
163 |
+
"node_modules/default-browser-id": {
|
164 |
+
"version": "5.0.0",
|
165 |
+
"resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-5.0.0.tgz",
|
166 |
+
"integrity": "sha512-A6p/pu/6fyBcA1TRz/GqWYPViplrftcW2gZC9q79ngNCKAeR/X3gcEdXQHl4KNXV+3wgIJ1CPkJQ3IHM6lcsyA==",
|
167 |
+
"license": "MIT",
|
168 |
+
"engines": {
|
169 |
+
"node": ">=18"
|
170 |
+
},
|
171 |
+
"funding": {
|
172 |
+
"url": "https://github.com/sponsors/sindresorhus"
|
173 |
+
}
|
174 |
+
},
|
175 |
+
"node_modules/define-lazy-prop": {
|
176 |
+
"version": "3.0.0",
|
177 |
+
"resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz",
|
178 |
+
"integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==",
|
179 |
+
"license": "MIT",
|
180 |
+
"engines": {
|
181 |
+
"node": ">=12"
|
182 |
+
},
|
183 |
+
"funding": {
|
184 |
+
"url": "https://github.com/sponsors/sindresorhus"
|
185 |
+
}
|
186 |
+
},
|
187 |
+
"node_modules/depd": {
|
188 |
+
"version": "2.0.0",
|
189 |
+
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
|
190 |
+
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
|
191 |
+
"license": "MIT",
|
192 |
+
"engines": {
|
193 |
+
"node": ">= 0.8"
|
194 |
+
}
|
195 |
+
},
|
196 |
+
"node_modules/destroy": {
|
197 |
+
"version": "1.2.0",
|
198 |
+
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
|
199 |
+
"integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
|
200 |
+
"license": "MIT",
|
201 |
+
"engines": {
|
202 |
+
"node": ">= 0.8",
|
203 |
+
"npm": "1.2.8000 || >= 1.4.16"
|
204 |
+
}
|
205 |
+
},
|
206 |
+
"node_modules/dunder-proto": {
|
207 |
+
"version": "1.0.1",
|
208 |
+
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
209 |
+
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
|
210 |
+
"license": "MIT",
|
211 |
+
"dependencies": {
|
212 |
+
"call-bind-apply-helpers": "^1.0.1",
|
213 |
+
"es-errors": "^1.3.0",
|
214 |
+
"gopd": "^1.2.0"
|
215 |
+
},
|
216 |
+
"engines": {
|
217 |
+
"node": ">= 0.4"
|
218 |
+
}
|
219 |
+
},
|
220 |
+
"node_modules/ee-first": {
|
221 |
+
"version": "1.1.1",
|
222 |
+
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
223 |
+
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
|
224 |
+
"license": "MIT"
|
225 |
+
},
|
226 |
+
"node_modules/encodeurl": {
|
227 |
+
"version": "2.0.0",
|
228 |
+
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
|
229 |
+
"integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
|
230 |
+
"license": "MIT",
|
231 |
+
"engines": {
|
232 |
+
"node": ">= 0.8"
|
233 |
+
}
|
234 |
+
},
|
235 |
+
"node_modules/es-define-property": {
|
236 |
+
"version": "1.0.1",
|
237 |
+
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
|
238 |
+
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
|
239 |
+
"license": "MIT",
|
240 |
+
"engines": {
|
241 |
+
"node": ">= 0.4"
|
242 |
+
}
|
243 |
+
},
|
244 |
+
"node_modules/es-errors": {
|
245 |
+
"version": "1.3.0",
|
246 |
+
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
|
247 |
+
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
|
248 |
+
"license": "MIT",
|
249 |
+
"engines": {
|
250 |
+
"node": ">= 0.4"
|
251 |
+
}
|
252 |
+
},
|
253 |
+
"node_modules/es-object-atoms": {
|
254 |
+
"version": "1.1.1",
|
255 |
+
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
|
256 |
+
"integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
|
257 |
+
"license": "MIT",
|
258 |
+
"dependencies": {
|
259 |
+
"es-errors": "^1.3.0"
|
260 |
+
},
|
261 |
+
"engines": {
|
262 |
+
"node": ">= 0.4"
|
263 |
+
}
|
264 |
+
},
|
265 |
+
"node_modules/escape-html": {
|
266 |
+
"version": "1.0.3",
|
267 |
+
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
268 |
+
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
|
269 |
+
"license": "MIT"
|
270 |
+
},
|
271 |
+
"node_modules/etag": {
|
272 |
+
"version": "1.8.1",
|
273 |
+
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
|
274 |
+
"integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
|
275 |
+
"license": "MIT",
|
276 |
+
"engines": {
|
277 |
+
"node": ">= 0.6"
|
278 |
+
}
|
279 |
+
},
|
280 |
+
"node_modules/express": {
|
281 |
+
"version": "4.21.2",
|
282 |
+
"resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz",
|
283 |
+
"integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==",
|
284 |
+
"license": "MIT",
|
285 |
+
"dependencies": {
|
286 |
+
"accepts": "~1.3.8",
|
287 |
+
"array-flatten": "1.1.1",
|
288 |
+
"body-parser": "1.20.3",
|
289 |
+
"content-disposition": "0.5.4",
|
290 |
+
"content-type": "~1.0.4",
|
291 |
+
"cookie": "0.7.1",
|
292 |
+
"cookie-signature": "1.0.6",
|
293 |
+
"debug": "2.6.9",
|
294 |
+
"depd": "2.0.0",
|
295 |
+
"encodeurl": "~2.0.0",
|
296 |
+
"escape-html": "~1.0.3",
|
297 |
+
"etag": "~1.8.1",
|
298 |
+
"finalhandler": "1.3.1",
|
299 |
+
"fresh": "0.5.2",
|
300 |
+
"http-errors": "2.0.0",
|
301 |
+
"merge-descriptors": "1.0.3",
|
302 |
+
"methods": "~1.1.2",
|
303 |
+
"on-finished": "2.4.1",
|
304 |
+
"parseurl": "~1.3.3",
|
305 |
+
"path-to-regexp": "0.1.12",
|
306 |
+
"proxy-addr": "~2.0.7",
|
307 |
+
"qs": "6.13.0",
|
308 |
+
"range-parser": "~1.2.1",
|
309 |
+
"safe-buffer": "5.2.1",
|
310 |
+
"send": "0.19.0",
|
311 |
+
"serve-static": "1.16.2",
|
312 |
+
"setprototypeof": "1.2.0",
|
313 |
+
"statuses": "2.0.1",
|
314 |
+
"type-is": "~1.6.18",
|
315 |
+
"utils-merge": "1.0.1",
|
316 |
+
"vary": "~1.1.2"
|
317 |
+
},
|
318 |
+
"engines": {
|
319 |
+
"node": ">= 0.10.0"
|
320 |
+
},
|
321 |
+
"funding": {
|
322 |
+
"type": "opencollective",
|
323 |
+
"url": "https://opencollective.com/express"
|
324 |
+
}
|
325 |
+
},
|
326 |
+
"node_modules/finalhandler": {
|
327 |
+
"version": "1.3.1",
|
328 |
+
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz",
|
329 |
+
"integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==",
|
330 |
+
"license": "MIT",
|
331 |
+
"dependencies": {
|
332 |
+
"debug": "2.6.9",
|
333 |
+
"encodeurl": "~2.0.0",
|
334 |
+
"escape-html": "~1.0.3",
|
335 |
+
"on-finished": "2.4.1",
|
336 |
+
"parseurl": "~1.3.3",
|
337 |
+
"statuses": "2.0.1",
|
338 |
+
"unpipe": "~1.0.0"
|
339 |
+
},
|
340 |
+
"engines": {
|
341 |
+
"node": ">= 0.8"
|
342 |
+
}
|
343 |
+
},
|
344 |
+
"node_modules/forwarded": {
|
345 |
+
"version": "0.2.0",
|
346 |
+
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
347 |
+
"integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
|
348 |
+
"license": "MIT",
|
349 |
+
"engines": {
|
350 |
+
"node": ">= 0.6"
|
351 |
+
}
|
352 |
+
},
|
353 |
+
"node_modules/fresh": {
|
354 |
+
"version": "0.5.2",
|
355 |
+
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
|
356 |
+
"integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
|
357 |
+
"license": "MIT",
|
358 |
+
"engines": {
|
359 |
+
"node": ">= 0.6"
|
360 |
+
}
|
361 |
+
},
|
362 |
+
"node_modules/function-bind": {
|
363 |
+
"version": "1.1.2",
|
364 |
+
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
365 |
+
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
366 |
+
"license": "MIT",
|
367 |
+
"funding": {
|
368 |
+
"url": "https://github.com/sponsors/ljharb"
|
369 |
+
}
|
370 |
+
},
|
371 |
+
"node_modules/get-intrinsic": {
|
372 |
+
"version": "1.3.0",
|
373 |
+
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
|
374 |
+
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
|
375 |
+
"license": "MIT",
|
376 |
+
"dependencies": {
|
377 |
+
"call-bind-apply-helpers": "^1.0.2",
|
378 |
+
"es-define-property": "^1.0.1",
|
379 |
+
"es-errors": "^1.3.0",
|
380 |
+
"es-object-atoms": "^1.1.1",
|
381 |
+
"function-bind": "^1.1.2",
|
382 |
+
"get-proto": "^1.0.1",
|
383 |
+
"gopd": "^1.2.0",
|
384 |
+
"has-symbols": "^1.1.0",
|
385 |
+
"hasown": "^2.0.2",
|
386 |
+
"math-intrinsics": "^1.1.0"
|
387 |
+
},
|
388 |
+
"engines": {
|
389 |
+
"node": ">= 0.4"
|
390 |
+
},
|
391 |
+
"funding": {
|
392 |
+
"url": "https://github.com/sponsors/ljharb"
|
393 |
+
}
|
394 |
+
},
|
395 |
+
"node_modules/get-proto": {
|
396 |
+
"version": "1.0.1",
|
397 |
+
"resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
|
398 |
+
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
|
399 |
+
"license": "MIT",
|
400 |
+
"dependencies": {
|
401 |
+
"dunder-proto": "^1.0.1",
|
402 |
+
"es-object-atoms": "^1.0.0"
|
403 |
+
},
|
404 |
+
"engines": {
|
405 |
+
"node": ">= 0.4"
|
406 |
+
}
|
407 |
+
},
|
408 |
+
"node_modules/gopd": {
|
409 |
+
"version": "1.2.0",
|
410 |
+
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
|
411 |
+
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
|
412 |
+
"license": "MIT",
|
413 |
+
"engines": {
|
414 |
+
"node": ">= 0.4"
|
415 |
+
},
|
416 |
+
"funding": {
|
417 |
+
"url": "https://github.com/sponsors/ljharb"
|
418 |
+
}
|
419 |
+
},
|
420 |
+
"node_modules/has-symbols": {
|
421 |
+
"version": "1.1.0",
|
422 |
+
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
|
423 |
+
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
|
424 |
+
"license": "MIT",
|
425 |
+
"engines": {
|
426 |
+
"node": ">= 0.4"
|
427 |
+
},
|
428 |
+
"funding": {
|
429 |
+
"url": "https://github.com/sponsors/ljharb"
|
430 |
+
}
|
431 |
+
},
|
432 |
+
"node_modules/hasown": {
|
433 |
+
"version": "2.0.2",
|
434 |
+
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
|
435 |
+
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
|
436 |
+
"license": "MIT",
|
437 |
+
"dependencies": {
|
438 |
+
"function-bind": "^1.1.2"
|
439 |
+
},
|
440 |
+
"engines": {
|
441 |
+
"node": ">= 0.4"
|
442 |
+
}
|
443 |
+
},
|
444 |
+
"node_modules/http-errors": {
|
445 |
+
"version": "2.0.0",
|
446 |
+
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
|
447 |
+
"integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
|
448 |
+
"license": "MIT",
|
449 |
+
"dependencies": {
|
450 |
+
"depd": "2.0.0",
|
451 |
+
"inherits": "2.0.4",
|
452 |
+
"setprototypeof": "1.2.0",
|
453 |
+
"statuses": "2.0.1",
|
454 |
+
"toidentifier": "1.0.1"
|
455 |
+
},
|
456 |
+
"engines": {
|
457 |
+
"node": ">= 0.8"
|
458 |
+
}
|
459 |
+
},
|
460 |
+
"node_modules/iconv-lite": {
|
461 |
+
"version": "0.4.24",
|
462 |
+
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
463 |
+
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
|
464 |
+
"license": "MIT",
|
465 |
+
"dependencies": {
|
466 |
+
"safer-buffer": ">= 2.1.2 < 3"
|
467 |
+
},
|
468 |
+
"engines": {
|
469 |
+
"node": ">=0.10.0"
|
470 |
+
}
|
471 |
+
},
|
472 |
+
"node_modules/inherits": {
|
473 |
+
"version": "2.0.4",
|
474 |
+
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
475 |
+
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
476 |
+
"license": "ISC"
|
477 |
+
},
|
478 |
+
"node_modules/ipaddr.js": {
|
479 |
+
"version": "1.9.1",
|
480 |
+
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
|
481 |
+
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
|
482 |
+
"license": "MIT",
|
483 |
+
"engines": {
|
484 |
+
"node": ">= 0.10"
|
485 |
+
}
|
486 |
+
},
|
487 |
+
"node_modules/is-docker": {
|
488 |
+
"version": "3.0.0",
|
489 |
+
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz",
|
490 |
+
"integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==",
|
491 |
+
"license": "MIT",
|
492 |
+
"bin": {
|
493 |
+
"is-docker": "cli.js"
|
494 |
+
},
|
495 |
+
"engines": {
|
496 |
+
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
497 |
+
},
|
498 |
+
"funding": {
|
499 |
+
"url": "https://github.com/sponsors/sindresorhus"
|
500 |
+
}
|
501 |
+
},
|
502 |
+
"node_modules/is-inside-container": {
|
503 |
+
"version": "1.0.0",
|
504 |
+
"resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz",
|
505 |
+
"integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==",
|
506 |
+
"license": "MIT",
|
507 |
+
"dependencies": {
|
508 |
+
"is-docker": "^3.0.0"
|
509 |
+
},
|
510 |
+
"bin": {
|
511 |
+
"is-inside-container": "cli.js"
|
512 |
+
},
|
513 |
+
"engines": {
|
514 |
+
"node": ">=14.16"
|
515 |
+
},
|
516 |
+
"funding": {
|
517 |
+
"url": "https://github.com/sponsors/sindresorhus"
|
518 |
+
}
|
519 |
+
},
|
520 |
+
"node_modules/is-wsl": {
|
521 |
+
"version": "3.1.0",
|
522 |
+
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.0.tgz",
|
523 |
+
"integrity": "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==",
|
524 |
+
"license": "MIT",
|
525 |
+
"dependencies": {
|
526 |
+
"is-inside-container": "^1.0.0"
|
527 |
+
},
|
528 |
+
"engines": {
|
529 |
+
"node": ">=16"
|
530 |
+
},
|
531 |
+
"funding": {
|
532 |
+
"url": "https://github.com/sponsors/sindresorhus"
|
533 |
+
}
|
534 |
+
},
|
535 |
+
"node_modules/math-intrinsics": {
|
536 |
+
"version": "1.1.0",
|
537 |
+
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
|
538 |
+
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
|
539 |
+
"license": "MIT",
|
540 |
+
"engines": {
|
541 |
+
"node": ">= 0.4"
|
542 |
+
}
|
543 |
+
},
|
544 |
+
"node_modules/mcp-remote": {
|
545 |
+
"version": "0.1.16",
|
546 |
+
"resolved": "https://registry.npmjs.org/mcp-remote/-/mcp-remote-0.1.16.tgz",
|
547 |
+
"integrity": "sha512-LfJ79BgtXYG+Ujfdx3t1HtyKkJZRV0wAMZDlmoaFgEag9MVAU+3RxHmIKjqlaVFxPWnb+ep8VlXkdY8Xlvg84A==",
|
548 |
+
"dependencies": {
|
549 |
+
"express": "^4.21.2",
|
550 |
+
"open": "^10.1.0"
|
551 |
+
},
|
552 |
+
"bin": {
|
553 |
+
"mcp-remote": "dist/proxy.js",
|
554 |
+
"mcp-remote-client": "dist/client.js"
|
555 |
+
}
|
556 |
+
},
|
557 |
+
"node_modules/media-typer": {
|
558 |
+
"version": "0.3.0",
|
559 |
+
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
560 |
+
"integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
|
561 |
+
"license": "MIT",
|
562 |
+
"engines": {
|
563 |
+
"node": ">= 0.6"
|
564 |
+
}
|
565 |
+
},
|
566 |
+
"node_modules/merge-descriptors": {
|
567 |
+
"version": "1.0.3",
|
568 |
+
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz",
|
569 |
+
"integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==",
|
570 |
+
"license": "MIT",
|
571 |
+
"funding": {
|
572 |
+
"url": "https://github.com/sponsors/sindresorhus"
|
573 |
+
}
|
574 |
+
},
|
575 |
+
"node_modules/methods": {
|
576 |
+
"version": "1.1.2",
|
577 |
+
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
|
578 |
+
"integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
|
579 |
+
"license": "MIT",
|
580 |
+
"engines": {
|
581 |
+
"node": ">= 0.6"
|
582 |
+
}
|
583 |
+
},
|
584 |
+
"node_modules/mime": {
|
585 |
+
"version": "1.6.0",
|
586 |
+
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
|
587 |
+
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
|
588 |
+
"license": "MIT",
|
589 |
+
"bin": {
|
590 |
+
"mime": "cli.js"
|
591 |
+
},
|
592 |
+
"engines": {
|
593 |
+
"node": ">=4"
|
594 |
+
}
|
595 |
+
},
|
596 |
+
"node_modules/mime-db": {
|
597 |
+
"version": "1.52.0",
|
598 |
+
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
599 |
+
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
600 |
+
"license": "MIT",
|
601 |
+
"engines": {
|
602 |
+
"node": ">= 0.6"
|
603 |
+
}
|
604 |
+
},
|
605 |
+
"node_modules/mime-types": {
|
606 |
+
"version": "2.1.35",
|
607 |
+
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
608 |
+
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
609 |
+
"license": "MIT",
|
610 |
+
"dependencies": {
|
611 |
+
"mime-db": "1.52.0"
|
612 |
+
},
|
613 |
+
"engines": {
|
614 |
+
"node": ">= 0.6"
|
615 |
+
}
|
616 |
+
},
|
617 |
+
"node_modules/ms": {
|
618 |
+
"version": "2.0.0",
|
619 |
+
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
620 |
+
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
|
621 |
+
"license": "MIT"
|
622 |
+
},
|
623 |
+
"node_modules/negotiator": {
|
624 |
+
"version": "0.6.3",
|
625 |
+
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
|
626 |
+
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
|
627 |
+
"license": "MIT",
|
628 |
+
"engines": {
|
629 |
+
"node": ">= 0.6"
|
630 |
+
}
|
631 |
+
},
|
632 |
+
"node_modules/object-inspect": {
|
633 |
+
"version": "1.13.4",
|
634 |
+
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
|
635 |
+
"integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
|
636 |
+
"license": "MIT",
|
637 |
+
"engines": {
|
638 |
+
"node": ">= 0.4"
|
639 |
+
},
|
640 |
+
"funding": {
|
641 |
+
"url": "https://github.com/sponsors/ljharb"
|
642 |
+
}
|
643 |
+
},
|
644 |
+
"node_modules/on-finished": {
|
645 |
+
"version": "2.4.1",
|
646 |
+
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
|
647 |
+
"integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
|
648 |
+
"license": "MIT",
|
649 |
+
"dependencies": {
|
650 |
+
"ee-first": "1.1.1"
|
651 |
+
},
|
652 |
+
"engines": {
|
653 |
+
"node": ">= 0.8"
|
654 |
+
}
|
655 |
+
},
|
656 |
+
"node_modules/open": {
|
657 |
+
"version": "10.1.2",
|
658 |
+
"resolved": "https://registry.npmjs.org/open/-/open-10.1.2.tgz",
|
659 |
+
"integrity": "sha512-cxN6aIDPz6rm8hbebcP7vrQNhvRcveZoJU72Y7vskh4oIm+BZwBECnx5nTmrlres1Qapvx27Qo1Auukpf8PKXw==",
|
660 |
+
"license": "MIT",
|
661 |
+
"dependencies": {
|
662 |
+
"default-browser": "^5.2.1",
|
663 |
+
"define-lazy-prop": "^3.0.0",
|
664 |
+
"is-inside-container": "^1.0.0",
|
665 |
+
"is-wsl": "^3.1.0"
|
666 |
+
},
|
667 |
+
"engines": {
|
668 |
+
"node": ">=18"
|
669 |
+
},
|
670 |
+
"funding": {
|
671 |
+
"url": "https://github.com/sponsors/sindresorhus"
|
672 |
+
}
|
673 |
+
},
|
674 |
+
"node_modules/parseurl": {
|
675 |
+
"version": "1.3.3",
|
676 |
+
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
677 |
+
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
|
678 |
+
"license": "MIT",
|
679 |
+
"engines": {
|
680 |
+
"node": ">= 0.8"
|
681 |
+
}
|
682 |
+
},
|
683 |
+
"node_modules/path-to-regexp": {
|
684 |
+
"version": "0.1.12",
|
685 |
+
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz",
|
686 |
+
"integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==",
|
687 |
+
"license": "MIT"
|
688 |
+
},
|
689 |
+
"node_modules/proxy-addr": {
|
690 |
+
"version": "2.0.7",
|
691 |
+
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
|
692 |
+
"integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
|
693 |
+
"license": "MIT",
|
694 |
+
"dependencies": {
|
695 |
+
"forwarded": "0.2.0",
|
696 |
+
"ipaddr.js": "1.9.1"
|
697 |
+
},
|
698 |
+
"engines": {
|
699 |
+
"node": ">= 0.10"
|
700 |
+
}
|
701 |
+
},
|
702 |
+
"node_modules/qs": {
|
703 |
+
"version": "6.13.0",
|
704 |
+
"resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz",
|
705 |
+
"integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==",
|
706 |
+
"license": "BSD-3-Clause",
|
707 |
+
"dependencies": {
|
708 |
+
"side-channel": "^1.0.6"
|
709 |
+
},
|
710 |
+
"engines": {
|
711 |
+
"node": ">=0.6"
|
712 |
+
},
|
713 |
+
"funding": {
|
714 |
+
"url": "https://github.com/sponsors/ljharb"
|
715 |
+
}
|
716 |
+
},
|
717 |
+
"node_modules/range-parser": {
|
718 |
+
"version": "1.2.1",
|
719 |
+
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
|
720 |
+
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
|
721 |
+
"license": "MIT",
|
722 |
+
"engines": {
|
723 |
+
"node": ">= 0.6"
|
724 |
+
}
|
725 |
+
},
|
726 |
+
"node_modules/raw-body": {
|
727 |
+
"version": "2.5.2",
|
728 |
+
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz",
|
729 |
+
"integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==",
|
730 |
+
"license": "MIT",
|
731 |
+
"dependencies": {
|
732 |
+
"bytes": "3.1.2",
|
733 |
+
"http-errors": "2.0.0",
|
734 |
+
"iconv-lite": "0.4.24",
|
735 |
+
"unpipe": "1.0.0"
|
736 |
+
},
|
737 |
+
"engines": {
|
738 |
+
"node": ">= 0.8"
|
739 |
+
}
|
740 |
+
},
|
741 |
+
"node_modules/run-applescript": {
|
742 |
+
"version": "7.0.0",
|
743 |
+
"resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.0.0.tgz",
|
744 |
+
"integrity": "sha512-9by4Ij99JUr/MCFBUkDKLWK3G9HVXmabKz9U5MlIAIuvuzkiOicRYs8XJLxX+xahD+mLiiCYDqF9dKAgtzKP1A==",
|
745 |
+
"license": "MIT",
|
746 |
+
"engines": {
|
747 |
+
"node": ">=18"
|
748 |
+
},
|
749 |
+
"funding": {
|
750 |
+
"url": "https://github.com/sponsors/sindresorhus"
|
751 |
+
}
|
752 |
+
},
|
753 |
+
"node_modules/safe-buffer": {
|
754 |
+
"version": "5.2.1",
|
755 |
+
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
756 |
+
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
757 |
+
"funding": [
|
758 |
+
{
|
759 |
+
"type": "github",
|
760 |
+
"url": "https://github.com/sponsors/feross"
|
761 |
+
},
|
762 |
+
{
|
763 |
+
"type": "patreon",
|
764 |
+
"url": "https://www.patreon.com/feross"
|
765 |
+
},
|
766 |
+
{
|
767 |
+
"type": "consulting",
|
768 |
+
"url": "https://feross.org/support"
|
769 |
+
}
|
770 |
+
],
|
771 |
+
"license": "MIT"
|
772 |
+
},
|
773 |
+
"node_modules/safer-buffer": {
|
774 |
+
"version": "2.1.2",
|
775 |
+
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
776 |
+
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
|
777 |
+
"license": "MIT"
|
778 |
+
},
|
779 |
+
"node_modules/send": {
|
780 |
+
"version": "0.19.0",
|
781 |
+
"resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz",
|
782 |
+
"integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==",
|
783 |
+
"license": "MIT",
|
784 |
+
"dependencies": {
|
785 |
+
"debug": "2.6.9",
|
786 |
+
"depd": "2.0.0",
|
787 |
+
"destroy": "1.2.0",
|
788 |
+
"encodeurl": "~1.0.2",
|
789 |
+
"escape-html": "~1.0.3",
|
790 |
+
"etag": "~1.8.1",
|
791 |
+
"fresh": "0.5.2",
|
792 |
+
"http-errors": "2.0.0",
|
793 |
+
"mime": "1.6.0",
|
794 |
+
"ms": "2.1.3",
|
795 |
+
"on-finished": "2.4.1",
|
796 |
+
"range-parser": "~1.2.1",
|
797 |
+
"statuses": "2.0.1"
|
798 |
+
},
|
799 |
+
"engines": {
|
800 |
+
"node": ">= 0.8.0"
|
801 |
+
}
|
802 |
+
},
|
803 |
+
"node_modules/send/node_modules/encodeurl": {
|
804 |
+
"version": "1.0.2",
|
805 |
+
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
|
806 |
+
"integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
|
807 |
+
"license": "MIT",
|
808 |
+
"engines": {
|
809 |
+
"node": ">= 0.8"
|
810 |
+
}
|
811 |
+
},
|
812 |
+
"node_modules/send/node_modules/ms": {
|
813 |
+
"version": "2.1.3",
|
814 |
+
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
815 |
+
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
816 |
+
"license": "MIT"
|
817 |
+
},
|
818 |
+
"node_modules/serve-static": {
|
819 |
+
"version": "1.16.2",
|
820 |
+
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz",
|
821 |
+
"integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==",
|
822 |
+
"license": "MIT",
|
823 |
+
"dependencies": {
|
824 |
+
"encodeurl": "~2.0.0",
|
825 |
+
"escape-html": "~1.0.3",
|
826 |
+
"parseurl": "~1.3.3",
|
827 |
+
"send": "0.19.0"
|
828 |
+
},
|
829 |
+
"engines": {
|
830 |
+
"node": ">= 0.8.0"
|
831 |
+
}
|
832 |
+
},
|
833 |
+
"node_modules/setprototypeof": {
|
834 |
+
"version": "1.2.0",
|
835 |
+
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
|
836 |
+
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
|
837 |
+
"license": "ISC"
|
838 |
+
},
|
839 |
+
"node_modules/side-channel": {
|
840 |
+
"version": "1.1.0",
|
841 |
+
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz",
|
842 |
+
"integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==",
|
843 |
+
"license": "MIT",
|
844 |
+
"dependencies": {
|
845 |
+
"es-errors": "^1.3.0",
|
846 |
+
"object-inspect": "^1.13.3",
|
847 |
+
"side-channel-list": "^1.0.0",
|
848 |
+
"side-channel-map": "^1.0.1",
|
849 |
+
"side-channel-weakmap": "^1.0.2"
|
850 |
+
},
|
851 |
+
"engines": {
|
852 |
+
"node": ">= 0.4"
|
853 |
+
},
|
854 |
+
"funding": {
|
855 |
+
"url": "https://github.com/sponsors/ljharb"
|
856 |
+
}
|
857 |
+
},
|
858 |
+
"node_modules/side-channel-list": {
|
859 |
+
"version": "1.0.0",
|
860 |
+
"resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz",
|
861 |
+
"integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==",
|
862 |
+
"license": "MIT",
|
863 |
+
"dependencies": {
|
864 |
+
"es-errors": "^1.3.0",
|
865 |
+
"object-inspect": "^1.13.3"
|
866 |
+
},
|
867 |
+
"engines": {
|
868 |
+
"node": ">= 0.4"
|
869 |
+
},
|
870 |
+
"funding": {
|
871 |
+
"url": "https://github.com/sponsors/ljharb"
|
872 |
+
}
|
873 |
+
},
|
874 |
+
"node_modules/side-channel-map": {
|
875 |
+
"version": "1.0.1",
|
876 |
+
"resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",
|
877 |
+
"integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
|
878 |
+
"license": "MIT",
|
879 |
+
"dependencies": {
|
880 |
+
"call-bound": "^1.0.2",
|
881 |
+
"es-errors": "^1.3.0",
|
882 |
+
"get-intrinsic": "^1.2.5",
|
883 |
+
"object-inspect": "^1.13.3"
|
884 |
+
},
|
885 |
+
"engines": {
|
886 |
+
"node": ">= 0.4"
|
887 |
+
},
|
888 |
+
"funding": {
|
889 |
+
"url": "https://github.com/sponsors/ljharb"
|
890 |
+
}
|
891 |
+
},
|
892 |
+
"node_modules/side-channel-weakmap": {
|
893 |
+
"version": "1.0.2",
|
894 |
+
"resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
|
895 |
+
"integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
|
896 |
+
"license": "MIT",
|
897 |
+
"dependencies": {
|
898 |
+
"call-bound": "^1.0.2",
|
899 |
+
"es-errors": "^1.3.0",
|
900 |
+
"get-intrinsic": "^1.2.5",
|
901 |
+
"object-inspect": "^1.13.3",
|
902 |
+
"side-channel-map": "^1.0.1"
|
903 |
+
},
|
904 |
+
"engines": {
|
905 |
+
"node": ">= 0.4"
|
906 |
+
},
|
907 |
+
"funding": {
|
908 |
+
"url": "https://github.com/sponsors/ljharb"
|
909 |
+
}
|
910 |
+
},
|
911 |
+
"node_modules/statuses": {
|
912 |
+
"version": "2.0.1",
|
913 |
+
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
|
914 |
+
"integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
|
915 |
+
"license": "MIT",
|
916 |
+
"engines": {
|
917 |
+
"node": ">= 0.8"
|
918 |
+
}
|
919 |
+
},
|
920 |
+
"node_modules/toidentifier": {
|
921 |
+
"version": "1.0.1",
|
922 |
+
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
|
923 |
+
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
|
924 |
+
"license": "MIT",
|
925 |
+
"engines": {
|
926 |
+
"node": ">=0.6"
|
927 |
+
}
|
928 |
+
},
|
929 |
+
"node_modules/type-is": {
|
930 |
+
"version": "1.6.18",
|
931 |
+
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
|
932 |
+
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
|
933 |
+
"license": "MIT",
|
934 |
+
"dependencies": {
|
935 |
+
"media-typer": "0.3.0",
|
936 |
+
"mime-types": "~2.1.24"
|
937 |
+
},
|
938 |
+
"engines": {
|
939 |
+
"node": ">= 0.6"
|
940 |
+
}
|
941 |
+
},
|
942 |
+
"node_modules/unpipe": {
|
943 |
+
"version": "1.0.0",
|
944 |
+
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
945 |
+
"integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
|
946 |
+
"license": "MIT",
|
947 |
+
"engines": {
|
948 |
+
"node": ">= 0.8"
|
949 |
+
}
|
950 |
+
},
|
951 |
+
"node_modules/utils-merge": {
|
952 |
+
"version": "1.0.1",
|
953 |
+
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
|
954 |
+
"integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
|
955 |
+
"license": "MIT",
|
956 |
+
"engines": {
|
957 |
+
"node": ">= 0.4.0"
|
958 |
+
}
|
959 |
+
},
|
960 |
+
"node_modules/vary": {
|
961 |
+
"version": "1.1.2",
|
962 |
+
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
963 |
+
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
|
964 |
+
"license": "MIT",
|
965 |
+
"engines": {
|
966 |
+
"node": ">= 0.8"
|
967 |
+
}
|
968 |
+
}
|
969 |
+
}
|
970 |
+
}
|
node_modules/accepts/HISTORY.md
ADDED
@@ -0,0 +1,243 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
1.3.8 / 2022-02-02
|
2 |
+
==================
|
3 |
+
|
4 |
+
* deps: mime-types@~2.1.34
|
5 |
+
- deps: mime-db@~1.51.0
|
6 |
+
* deps: [email protected]
|
7 |
+
|
8 |
+
1.3.7 / 2019-04-29
|
9 |
+
==================
|
10 |
+
|
11 |
+
* deps: [email protected]
|
12 |
+
- Fix sorting charset, encoding, and language with extra parameters
|
13 |
+
|
14 |
+
1.3.6 / 2019-04-28
|
15 |
+
==================
|
16 |
+
|
17 |
+
* deps: mime-types@~2.1.24
|
18 |
+
- deps: mime-db@~1.40.0
|
19 |
+
|
20 |
+
1.3.5 / 2018-02-28
|
21 |
+
==================
|
22 |
+
|
23 |
+
* deps: mime-types@~2.1.18
|
24 |
+
- deps: mime-db@~1.33.0
|
25 |
+
|
26 |
+
1.3.4 / 2017-08-22
|
27 |
+
==================
|
28 |
+
|
29 |
+
* deps: mime-types@~2.1.16
|
30 |
+
- deps: mime-db@~1.29.0
|
31 |
+
|
32 |
+
1.3.3 / 2016-05-02
|
33 |
+
==================
|
34 |
+
|
35 |
+
* deps: mime-types@~2.1.11
|
36 |
+
- deps: mime-db@~1.23.0
|
37 |
+
* deps: [email protected]
|
38 |
+
- perf: improve `Accept` parsing speed
|
39 |
+
- perf: improve `Accept-Charset` parsing speed
|
40 |
+
- perf: improve `Accept-Encoding` parsing speed
|
41 |
+
- perf: improve `Accept-Language` parsing speed
|
42 |
+
|
43 |
+
1.3.2 / 2016-03-08
|
44 |
+
==================
|
45 |
+
|
46 |
+
* deps: mime-types@~2.1.10
|
47 |
+
- Fix extension of `application/dash+xml`
|
48 |
+
- Update primary extension for `audio/mp4`
|
49 |
+
- deps: mime-db@~1.22.0
|
50 |
+
|
51 |
+
1.3.1 / 2016-01-19
|
52 |
+
==================
|
53 |
+
|
54 |
+
* deps: mime-types@~2.1.9
|
55 |
+
- deps: mime-db@~1.21.0
|
56 |
+
|
57 |
+
1.3.0 / 2015-09-29
|
58 |
+
==================
|
59 |
+
|
60 |
+
* deps: mime-types@~2.1.7
|
61 |
+
- deps: mime-db@~1.19.0
|
62 |
+
* deps: [email protected]
|
63 |
+
- Fix including type extensions in parameters in `Accept` parsing
|
64 |
+
- Fix parsing `Accept` parameters with quoted equals
|
65 |
+
- Fix parsing `Accept` parameters with quoted semicolons
|
66 |
+
- Lazy-load modules from main entry point
|
67 |
+
- perf: delay type concatenation until needed
|
68 |
+
- perf: enable strict mode
|
69 |
+
- perf: hoist regular expressions
|
70 |
+
- perf: remove closures getting spec properties
|
71 |
+
- perf: remove a closure from media type parsing
|
72 |
+
- perf: remove property delete from media type parsing
|
73 |
+
|
74 |
+
1.2.13 / 2015-09-06
|
75 |
+
===================
|
76 |
+
|
77 |
+
* deps: mime-types@~2.1.6
|
78 |
+
- deps: mime-db@~1.18.0
|
79 |
+
|
80 |
+
1.2.12 / 2015-07-30
|
81 |
+
===================
|
82 |
+
|
83 |
+
* deps: mime-types@~2.1.4
|
84 |
+
- deps: mime-db@~1.16.0
|
85 |
+
|
86 |
+
1.2.11 / 2015-07-16
|
87 |
+
===================
|
88 |
+
|
89 |
+
* deps: mime-types@~2.1.3
|
90 |
+
- deps: mime-db@~1.15.0
|
91 |
+
|
92 |
+
1.2.10 / 2015-07-01
|
93 |
+
===================
|
94 |
+
|
95 |
+
* deps: mime-types@~2.1.2
|
96 |
+
- deps: mime-db@~1.14.0
|
97 |
+
|
98 |
+
1.2.9 / 2015-06-08
|
99 |
+
==================
|
100 |
+
|
101 |
+
* deps: mime-types@~2.1.1
|
102 |
+
- perf: fix deopt during mapping
|
103 |
+
|
104 |
+
1.2.8 / 2015-06-07
|
105 |
+
==================
|
106 |
+
|
107 |
+
* deps: mime-types@~2.1.0
|
108 |
+
- deps: mime-db@~1.13.0
|
109 |
+
* perf: avoid argument reassignment & argument slice
|
110 |
+
* perf: avoid negotiator recursive construction
|
111 |
+
* perf: enable strict mode
|
112 |
+
* perf: remove unnecessary bitwise operator
|
113 |
+
|
114 |
+
1.2.7 / 2015-05-10
|
115 |
+
==================
|
116 |
+
|
117 |
+
* deps: [email protected]
|
118 |
+
- Fix media type parameter matching to be case-insensitive
|
119 |
+
|
120 |
+
1.2.6 / 2015-05-07
|
121 |
+
==================
|
122 |
+
|
123 |
+
* deps: mime-types@~2.0.11
|
124 |
+
- deps: mime-db@~1.9.1
|
125 |
+
* deps: [email protected]
|
126 |
+
- Fix comparing media types with quoted values
|
127 |
+
- Fix splitting media types with quoted commas
|
128 |
+
|
129 |
+
1.2.5 / 2015-03-13
|
130 |
+
==================
|
131 |
+
|
132 |
+
* deps: mime-types@~2.0.10
|
133 |
+
- deps: mime-db@~1.8.0
|
134 |
+
|
135 |
+
1.2.4 / 2015-02-14
|
136 |
+
==================
|
137 |
+
|
138 |
+
* Support Node.js 0.6
|
139 |
+
* deps: mime-types@~2.0.9
|
140 |
+
- deps: mime-db@~1.7.0
|
141 |
+
* deps: [email protected]
|
142 |
+
- Fix preference sorting to be stable for long acceptable lists
|
143 |
+
|
144 |
+
1.2.3 / 2015-01-31
|
145 |
+
==================
|
146 |
+
|
147 |
+
* deps: mime-types@~2.0.8
|
148 |
+
- deps: mime-db@~1.6.0
|
149 |
+
|
150 |
+
1.2.2 / 2014-12-30
|
151 |
+
==================
|
152 |
+
|
153 |
+
* deps: mime-types@~2.0.7
|
154 |
+
- deps: mime-db@~1.5.0
|
155 |
+
|
156 |
+
1.2.1 / 2014-12-30
|
157 |
+
==================
|
158 |
+
|
159 |
+
* deps: mime-types@~2.0.5
|
160 |
+
- deps: mime-db@~1.3.1
|
161 |
+
|
162 |
+
1.2.0 / 2014-12-19
|
163 |
+
==================
|
164 |
+
|
165 |
+
* deps: [email protected]
|
166 |
+
- Fix list return order when large accepted list
|
167 |
+
- Fix missing identity encoding when q=0 exists
|
168 |
+
- Remove dynamic building of Negotiator class
|
169 |
+
|
170 |
+
1.1.4 / 2014-12-10
|
171 |
+
==================
|
172 |
+
|
173 |
+
* deps: mime-types@~2.0.4
|
174 |
+
- deps: mime-db@~1.3.0
|
175 |
+
|
176 |
+
1.1.3 / 2014-11-09
|
177 |
+
==================
|
178 |
+
|
179 |
+
* deps: mime-types@~2.0.3
|
180 |
+
- deps: mime-db@~1.2.0
|
181 |
+
|
182 |
+
1.1.2 / 2014-10-14
|
183 |
+
==================
|
184 |
+
|
185 |
+
* deps: [email protected]
|
186 |
+
- Fix error when media type has invalid parameter
|
187 |
+
|
188 |
+
1.1.1 / 2014-09-28
|
189 |
+
==================
|
190 |
+
|
191 |
+
* deps: mime-types@~2.0.2
|
192 |
+
- deps: mime-db@~1.1.0
|
193 |
+
* deps: [email protected]
|
194 |
+
- Fix all negotiations to be case-insensitive
|
195 |
+
- Stable sort preferences of same quality according to client order
|
196 |
+
|
197 |
+
1.1.0 / 2014-09-02
|
198 |
+
==================
|
199 |
+
|
200 |
+
* update `mime-types`
|
201 |
+
|
202 |
+
1.0.7 / 2014-07-04
|
203 |
+
==================
|
204 |
+
|
205 |
+
* Fix wrong type returned from `type` when match after unknown extension
|
206 |
+
|
207 |
+
1.0.6 / 2014-06-24
|
208 |
+
==================
|
209 |
+
|
210 |
+
* deps: [email protected]
|
211 |
+
|
212 |
+
1.0.5 / 2014-06-20
|
213 |
+
==================
|
214 |
+
|
215 |
+
* fix crash when unknown extension given
|
216 |
+
|
217 |
+
1.0.4 / 2014-06-19
|
218 |
+
==================
|
219 |
+
|
220 |
+
* use `mime-types`
|
221 |
+
|
222 |
+
1.0.3 / 2014-06-11
|
223 |
+
==================
|
224 |
+
|
225 |
+
* deps: [email protected]
|
226 |
+
- Order by specificity when quality is the same
|
227 |
+
|
228 |
+
1.0.2 / 2014-05-29
|
229 |
+
==================
|
230 |
+
|
231 |
+
* Fix interpretation when header not in request
|
232 |
+
* deps: pin [email protected]
|
233 |
+
|
234 |
+
1.0.1 / 2014-01-18
|
235 |
+
==================
|
236 |
+
|
237 |
+
* Identity encoding isn't always acceptable
|
238 |
+
* deps: negotiator@~0.4.0
|
239 |
+
|
240 |
+
1.0.0 / 2013-12-27
|
241 |
+
==================
|
242 |
+
|
243 |
+
* 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 types 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 {String}
|
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": "1.3.8",
|
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": "~2.1.34",
|
13 |
+
"negotiator": "0.6.3"
|
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/array-flatten/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
The MIT License (MIT)
|
2 |
+
|
3 |
+
Copyright (c) 2014 Blake Embrey ([email protected])
|
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
|
13 |
+
all 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
|
21 |
+
THE SOFTWARE.
|
node_modules/array-flatten/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Array Flatten
|
2 |
+
|
3 |
+
[![NPM version][npm-image]][npm-url]
|
4 |
+
[![NPM downloads][downloads-image]][downloads-url]
|
5 |
+
[![Build status][travis-image]][travis-url]
|
6 |
+
[![Test coverage][coveralls-image]][coveralls-url]
|
7 |
+
|
8 |
+
> Flatten an array of nested arrays into a single flat array. Accepts an optional depth.
|
9 |
+
|
10 |
+
## Installation
|
11 |
+
|
12 |
+
```
|
13 |
+
npm install array-flatten --save
|
14 |
+
```
|
15 |
+
|
16 |
+
## Usage
|
17 |
+
|
18 |
+
```javascript
|
19 |
+
var flatten = require('array-flatten')
|
20 |
+
|
21 |
+
flatten([1, [2, [3, [4, [5], 6], 7], 8], 9])
|
22 |
+
//=> [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
23 |
+
|
24 |
+
flatten([1, [2, [3, [4, [5], 6], 7], 8], 9], 2)
|
25 |
+
//=> [1, 2, 3, [4, [5], 6], 7, 8, 9]
|
26 |
+
|
27 |
+
(function () {
|
28 |
+
flatten(arguments) //=> [1, 2, 3]
|
29 |
+
})(1, [2, 3])
|
30 |
+
```
|
31 |
+
|
32 |
+
## License
|
33 |
+
|
34 |
+
MIT
|
35 |
+
|
36 |
+
[npm-image]: https://img.shields.io/npm/v/array-flatten.svg?style=flat
|
37 |
+
[npm-url]: https://npmjs.org/package/array-flatten
|
38 |
+
[downloads-image]: https://img.shields.io/npm/dm/array-flatten.svg?style=flat
|
39 |
+
[downloads-url]: https://npmjs.org/package/array-flatten
|
40 |
+
[travis-image]: https://img.shields.io/travis/blakeembrey/array-flatten.svg?style=flat
|
41 |
+
[travis-url]: https://travis-ci.org/blakeembrey/array-flatten
|
42 |
+
[coveralls-image]: https://img.shields.io/coveralls/blakeembrey/array-flatten.svg?style=flat
|
43 |
+
[coveralls-url]: https://coveralls.io/r/blakeembrey/array-flatten?branch=master
|
node_modules/array-flatten/array-flatten.js
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'use strict'
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Expose `arrayFlatten`.
|
5 |
+
*/
|
6 |
+
module.exports = arrayFlatten
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Recursive flatten function with depth.
|
10 |
+
*
|
11 |
+
* @param {Array} array
|
12 |
+
* @param {Array} result
|
13 |
+
* @param {Number} depth
|
14 |
+
* @return {Array}
|
15 |
+
*/
|
16 |
+
function flattenWithDepth (array, result, depth) {
|
17 |
+
for (var i = 0; i < array.length; i++) {
|
18 |
+
var value = array[i]
|
19 |
+
|
20 |
+
if (depth > 0 && Array.isArray(value)) {
|
21 |
+
flattenWithDepth(value, result, depth - 1)
|
22 |
+
} else {
|
23 |
+
result.push(value)
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
return result
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Recursive flatten function. Omitting depth is slightly faster.
|
32 |
+
*
|
33 |
+
* @param {Array} array
|
34 |
+
* @param {Array} result
|
35 |
+
* @return {Array}
|
36 |
+
*/
|
37 |
+
function flattenForever (array, result) {
|
38 |
+
for (var i = 0; i < array.length; i++) {
|
39 |
+
var value = array[i]
|
40 |
+
|
41 |
+
if (Array.isArray(value)) {
|
42 |
+
flattenForever(value, result)
|
43 |
+
} else {
|
44 |
+
result.push(value)
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
return result
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Flatten an array, with the ability to define a depth.
|
53 |
+
*
|
54 |
+
* @param {Array} array
|
55 |
+
* @param {Number} depth
|
56 |
+
* @return {Array}
|
57 |
+
*/
|
58 |
+
function arrayFlatten (array, depth) {
|
59 |
+
if (depth == null) {
|
60 |
+
return flattenForever(array, [])
|
61 |
+
}
|
62 |
+
|
63 |
+
return flattenWithDepth(array, [], depth)
|
64 |
+
}
|
node_modules/array-flatten/package.json
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "array-flatten",
|
3 |
+
"version": "1.1.1",
|
4 |
+
"description": "Flatten an array of nested arrays into a single flat array",
|
5 |
+
"main": "array-flatten.js",
|
6 |
+
"files": [
|
7 |
+
"array-flatten.js",
|
8 |
+
"LICENSE"
|
9 |
+
],
|
10 |
+
"scripts": {
|
11 |
+
"test": "istanbul cover _mocha -- -R spec"
|
12 |
+
},
|
13 |
+
"repository": {
|
14 |
+
"type": "git",
|
15 |
+
"url": "git://github.com/blakeembrey/array-flatten.git"
|
16 |
+
},
|
17 |
+
"keywords": [
|
18 |
+
"array",
|
19 |
+
"flatten",
|
20 |
+
"arguments",
|
21 |
+
"depth"
|
22 |
+
],
|
23 |
+
"author": {
|
24 |
+
"name": "Blake Embrey",
|
25 |
+
"email": "[email protected]",
|
26 |
+
"url": "http://blakeembrey.me"
|
27 |
+
},
|
28 |
+
"license": "MIT",
|
29 |
+
"bugs": {
|
30 |
+
"url": "https://github.com/blakeembrey/array-flatten/issues"
|
31 |
+
},
|
32 |
+
"homepage": "https://github.com/blakeembrey/array-flatten",
|
33 |
+
"devDependencies": {
|
34 |
+
"istanbul": "^0.3.13",
|
35 |
+
"mocha": "^2.2.4",
|
36 |
+
"pre-commit": "^1.0.7",
|
37 |
+
"standard": "^3.7.3"
|
38 |
+
}
|
39 |
+
}
|
node_modules/body-parser/HISTORY.md
ADDED
@@ -0,0 +1,672 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
1.20.3 / 2024-09-10
|
2 |
+
===================
|
3 |
+
|
4 |
+
* deps: [email protected]
|
5 |
+
* add `depth` option to customize the depth level in the parser
|
6 |
+
* IMPORTANT: The default `depth` level for parsing URL-encoded data is now `32` (previously was `Infinity`)
|
7 |
+
|
8 |
+
1.20.2 / 2023-02-21
|
9 |
+
===================
|
10 |
+
|
11 |
+
* Fix strict json error message on Node.js 19+
|
12 |
+
* deps: content-type@~1.0.5
|
13 |
+
- perf: skip value escaping when unnecessary
|
14 |
+
* deps: [email protected]
|
15 |
+
|
16 |
+
1.20.1 / 2022-10-06
|
17 |
+
===================
|
18 |
+
|
19 |
+
* deps: [email protected]
|
20 |
+
* perf: remove unnecessary object clone
|
21 |
+
|
22 |
+
1.20.0 / 2022-04-02
|
23 |
+
===================
|
24 |
+
|
25 |
+
* Fix error message for json parse whitespace in `strict`
|
26 |
+
* Fix internal error when inflated body exceeds limit
|
27 |
+
* Prevent loss of async hooks context
|
28 |
+
* Prevent hanging when request already read
|
29 |
+
* deps: [email protected]
|
30 |
+
- Replace internal `eval` usage with `Function` constructor
|
31 |
+
- Use instance methods on `process` to check for listeners
|
32 |
+
* deps: [email protected]
|
33 |
+
- deps: [email protected]
|
34 |
+
- deps: [email protected]
|
35 |
+
* deps: [email protected]
|
36 |
+
* deps: [email protected]
|
37 |
+
* deps: [email protected]
|
38 |
+
- deps: [email protected]
|
39 |
+
|
40 |
+
1.19.2 / 2022-02-15
|
41 |
+
===================
|
42 |
+
|
43 |
+
* deps: [email protected]
|
44 |
+
* deps: [email protected]
|
45 |
+
* Fix handling of `__proto__` keys
|
46 |
+
* deps: [email protected]
|
47 |
+
- deps: [email protected]
|
48 |
+
|
49 |
+
1.19.1 / 2021-12-10
|
50 |
+
===================
|
51 |
+
|
52 |
+
* deps: [email protected]
|
53 |
+
* deps: [email protected]
|
54 |
+
- deps: [email protected]
|
55 |
+
- deps: [email protected]
|
56 |
+
- deps: [email protected]
|
57 |
+
* deps: [email protected]
|
58 |
+
* deps: [email protected]
|
59 |
+
- deps: [email protected]
|
60 |
+
- deps: [email protected]
|
61 |
+
* deps: [email protected]
|
62 |
+
* deps: type-is@~1.6.18
|
63 |
+
|
64 |
+
1.19.0 / 2019-04-25
|
65 |
+
===================
|
66 |
+
|
67 |
+
* deps: [email protected]
|
68 |
+
- Add petabyte (`pb`) support
|
69 |
+
* deps: [email protected]
|
70 |
+
- Set constructor name when possible
|
71 |
+
- deps: [email protected]
|
72 |
+
- deps: statuses@'>= 1.5.0 < 2'
|
73 |
+
* deps: [email protected]
|
74 |
+
- Added encoding MIK
|
75 |
+
* deps: [email protected]
|
76 |
+
- Fix parsing array brackets after index
|
77 |
+
* deps: [email protected]
|
78 |
+
- deps: [email protected]
|
79 |
+
- deps: [email protected]
|
80 |
+
- deps: [email protected]
|
81 |
+
* deps: type-is@~1.6.17
|
82 |
+
- deps: mime-types@~2.1.24
|
83 |
+
- perf: prevent internal `throw` on invalid type
|
84 |
+
|
85 |
+
1.18.3 / 2018-05-14
|
86 |
+
===================
|
87 |
+
|
88 |
+
* Fix stack trace for strict json parse error
|
89 |
+
* deps: depd@~1.1.2
|
90 |
+
- perf: remove argument reassignment
|
91 |
+
* deps: http-errors@~1.6.3
|
92 |
+
- deps: depd@~1.1.2
|
93 |
+
- deps: [email protected]
|
94 |
+
- deps: statuses@'>= 1.3.1 < 2'
|
95 |
+
* deps: [email protected]
|
96 |
+
- Fix loading encoding with year appended
|
97 |
+
- Fix deprecation warnings on Node.js 10+
|
98 |
+
* deps: [email protected]
|
99 |
+
* deps: [email protected]
|
100 |
+
- deps: [email protected]
|
101 |
+
- deps: [email protected]
|
102 |
+
* deps: type-is@~1.6.16
|
103 |
+
- deps: mime-types@~2.1.18
|
104 |
+
|
105 |
+
1.18.2 / 2017-09-22
|
106 |
+
===================
|
107 |
+
|
108 |
+
* deps: [email protected]
|
109 |
+
* perf: remove argument reassignment
|
110 |
+
|
111 |
+
1.18.1 / 2017-09-12
|
112 |
+
===================
|
113 |
+
|
114 |
+
* deps: content-type@~1.0.4
|
115 |
+
- perf: remove argument reassignment
|
116 |
+
- perf: skip parameter parsing when no parameters
|
117 |
+
* deps: [email protected]
|
118 |
+
- Fix ISO-8859-1 regression
|
119 |
+
- Update Windows-1255
|
120 |
+
* deps: [email protected]
|
121 |
+
- Fix parsing & compacting very deep objects
|
122 |
+
* deps: [email protected]
|
123 |
+
- deps: [email protected]
|
124 |
+
|
125 |
+
1.18.0 / 2017-09-08
|
126 |
+
===================
|
127 |
+
|
128 |
+
* Fix JSON strict violation error to match native parse error
|
129 |
+
* Include the `body` property on verify errors
|
130 |
+
* Include the `type` property on all generated errors
|
131 |
+
* Use `http-errors` to set status code on errors
|
132 |
+
* deps: [email protected]
|
133 |
+
* deps: [email protected]
|
134 |
+
* deps: depd@~1.1.1
|
135 |
+
- Remove unnecessary `Buffer` loading
|
136 |
+
* deps: http-errors@~1.6.2
|
137 |
+
- deps: [email protected]
|
138 |
+
* deps: [email protected]
|
139 |
+
- Add support for React Native
|
140 |
+
- Add a warning if not loaded as utf-8
|
141 |
+
- Fix CESU-8 decoding in Node.js 8
|
142 |
+
- Improve speed of ISO-8859-1 encoding
|
143 |
+
* deps: [email protected]
|
144 |
+
* deps: [email protected]
|
145 |
+
- Use `http-errors` for standard emitted errors
|
146 |
+
- deps: [email protected]
|
147 |
+
- deps: [email protected]
|
148 |
+
- perf: skip buffer decoding on overage chunk
|
149 |
+
* perf: prevent internal `throw` when missing charset
|
150 |
+
|
151 |
+
1.17.2 / 2017-05-17
|
152 |
+
===================
|
153 |
+
|
154 |
+
* deps: [email protected]
|
155 |
+
- Fix `DEBUG_MAX_ARRAY_LENGTH`
|
156 |
+
- deps: [email protected]
|
157 |
+
* deps: type-is@~1.6.15
|
158 |
+
- deps: mime-types@~2.1.15
|
159 |
+
|
160 |
+
1.17.1 / 2017-03-06
|
161 |
+
===================
|
162 |
+
|
163 |
+
* deps: [email protected]
|
164 |
+
- Fix regression parsing keys starting with `[`
|
165 |
+
|
166 |
+
1.17.0 / 2017-03-01
|
167 |
+
===================
|
168 |
+
|
169 |
+
* deps: http-errors@~1.6.1
|
170 |
+
- Make `message` property enumerable for `HttpError`s
|
171 |
+
- deps: [email protected]
|
172 |
+
* deps: [email protected]
|
173 |
+
- Fix compacting nested arrays
|
174 |
+
|
175 |
+
1.16.1 / 2017-02-10
|
176 |
+
===================
|
177 |
+
|
178 |
+
* deps: [email protected]
|
179 |
+
- Fix deprecation messages in WebStorm and other editors
|
180 |
+
- Undeprecate `DEBUG_FD` set to `1` or `2`
|
181 |
+
|
182 |
+
1.16.0 / 2017-01-17
|
183 |
+
===================
|
184 |
+
|
185 |
+
* deps: [email protected]
|
186 |
+
- Allow colors in workers
|
187 |
+
- Deprecated `DEBUG_FD` environment variable
|
188 |
+
- Fix error when running under React Native
|
189 |
+
- Use same color for same namespace
|
190 |
+
- deps: [email protected]
|
191 |
+
* deps: http-errors@~1.5.1
|
192 |
+
- deps: [email protected]
|
193 |
+
- deps: [email protected]
|
194 |
+
- deps: statuses@'>= 1.3.1 < 2'
|
195 |
+
* deps: [email protected]
|
196 |
+
- Added encoding MS-31J
|
197 |
+
- Added encoding MS-932
|
198 |
+
- Added encoding MS-936
|
199 |
+
- Added encoding MS-949
|
200 |
+
- Added encoding MS-950
|
201 |
+
- Fix GBK/GB18030 handling of Euro character
|
202 |
+
* deps: [email protected]
|
203 |
+
- Fix array parsing from skipping empty values
|
204 |
+
* deps: raw-body@~2.2.0
|
205 |
+
- deps: [email protected]
|
206 |
+
* deps: type-is@~1.6.14
|
207 |
+
- deps: mime-types@~2.1.13
|
208 |
+
|
209 |
+
1.15.2 / 2016-06-19
|
210 |
+
===================
|
211 |
+
|
212 |
+
* deps: [email protected]
|
213 |
+
* deps: content-type@~1.0.2
|
214 |
+
- perf: enable strict mode
|
215 |
+
* deps: http-errors@~1.5.0
|
216 |
+
- Use `setprototypeof` module to replace `__proto__` setting
|
217 |
+
- deps: statuses@'>= 1.3.0 < 2'
|
218 |
+
- perf: enable strict mode
|
219 |
+
* deps: [email protected]
|
220 |
+
* deps: raw-body@~2.1.7
|
221 |
+
- deps: [email protected]
|
222 |
+
- perf: remove double-cleanup on happy path
|
223 |
+
* deps: type-is@~1.6.13
|
224 |
+
- deps: mime-types@~2.1.11
|
225 |
+
|
226 |
+
1.15.1 / 2016-05-05
|
227 |
+
===================
|
228 |
+
|
229 |
+
* deps: [email protected]
|
230 |
+
- Drop partial bytes on all parsed units
|
231 |
+
- Fix parsing byte string that looks like hex
|
232 |
+
* deps: raw-body@~2.1.6
|
233 |
+
- deps: [email protected]
|
234 |
+
* deps: type-is@~1.6.12
|
235 |
+
- deps: mime-types@~2.1.10
|
236 |
+
|
237 |
+
1.15.0 / 2016-02-10
|
238 |
+
===================
|
239 |
+
|
240 |
+
* deps: http-errors@~1.4.0
|
241 |
+
- Add `HttpError` export, for `err instanceof createError.HttpError`
|
242 |
+
- deps: [email protected]
|
243 |
+
- deps: statuses@'>= 1.2.1 < 2'
|
244 |
+
* deps: [email protected]
|
245 |
+
* deps: type-is@~1.6.11
|
246 |
+
- deps: mime-types@~2.1.9
|
247 |
+
|
248 |
+
1.14.2 / 2015-12-16
|
249 |
+
===================
|
250 |
+
|
251 |
+
* deps: [email protected]
|
252 |
+
* deps: [email protected]
|
253 |
+
* deps: [email protected]
|
254 |
+
* deps: raw-body@~2.1.5
|
255 |
+
- deps: [email protected]
|
256 |
+
- deps: [email protected]
|
257 |
+
* deps: type-is@~1.6.10
|
258 |
+
- deps: mime-types@~2.1.8
|
259 |
+
|
260 |
+
1.14.1 / 2015-09-27
|
261 |
+
===================
|
262 |
+
|
263 |
+
* Fix issue where invalid charset results in 400 when `verify` used
|
264 |
+
* deps: [email protected]
|
265 |
+
- Fix CESU-8 decoding in Node.js 4.x
|
266 |
+
* deps: raw-body@~2.1.4
|
267 |
+
- Fix masking critical errors from `iconv-lite`
|
268 |
+
- deps: [email protected]
|
269 |
+
* deps: type-is@~1.6.9
|
270 |
+
- deps: mime-types@~2.1.7
|
271 |
+
|
272 |
+
1.14.0 / 2015-09-16
|
273 |
+
===================
|
274 |
+
|
275 |
+
* Fix JSON strict parse error to match syntax errors
|
276 |
+
* Provide static `require` analysis in `urlencoded` parser
|
277 |
+
* deps: depd@~1.1.0
|
278 |
+
- Support web browser loading
|
279 |
+
* deps: [email protected]
|
280 |
+
* deps: raw-body@~2.1.3
|
281 |
+
- Fix sync callback when attaching data listener causes sync read
|
282 |
+
* deps: type-is@~1.6.8
|
283 |
+
- Fix type error when given invalid type to match against
|
284 |
+
- deps: mime-types@~2.1.6
|
285 |
+
|
286 |
+
1.13.3 / 2015-07-31
|
287 |
+
===================
|
288 |
+
|
289 |
+
* deps: type-is@~1.6.6
|
290 |
+
- deps: mime-types@~2.1.4
|
291 |
+
|
292 |
+
1.13.2 / 2015-07-05
|
293 |
+
===================
|
294 |
+
|
295 |
+
* deps: [email protected]
|
296 |
+
* deps: [email protected]
|
297 |
+
- Fix dropping parameters like `hasOwnProperty`
|
298 |
+
- Fix user-visible incompatibilities from 3.1.0
|
299 |
+
- Fix various parsing edge cases
|
300 |
+
* deps: raw-body@~2.1.2
|
301 |
+
- Fix error stack traces to skip `makeError`
|
302 |
+
- deps: [email protected]
|
303 |
+
* deps: type-is@~1.6.4
|
304 |
+
- deps: mime-types@~2.1.2
|
305 |
+
- perf: enable strict mode
|
306 |
+
- perf: remove argument reassignment
|
307 |
+
|
308 |
+
1.13.1 / 2015-06-16
|
309 |
+
===================
|
310 |
+
|
311 |
+
* deps: [email protected]
|
312 |
+
- Downgraded from 3.1.0 because of user-visible incompatibilities
|
313 |
+
|
314 |
+
1.13.0 / 2015-06-14
|
315 |
+
===================
|
316 |
+
|
317 |
+
* Add `statusCode` property on `Error`s, in addition to `status`
|
318 |
+
* Change `type` default to `application/json` for JSON parser
|
319 |
+
* Change `type` default to `application/x-www-form-urlencoded` for urlencoded parser
|
320 |
+
* Provide static `require` analysis
|
321 |
+
* Use the `http-errors` module to generate errors
|
322 |
+
* deps: [email protected]
|
323 |
+
- Slight optimizations
|
324 |
+
* deps: [email protected]
|
325 |
+
- The encoding UTF-16 without BOM now defaults to UTF-16LE when detection fails
|
326 |
+
- Leading BOM is now removed when decoding
|
327 |
+
* deps: on-finished@~2.3.0
|
328 |
+
- Add defined behavior for HTTP `CONNECT` requests
|
329 |
+
- Add defined behavior for HTTP `Upgrade` requests
|
330 |
+
- deps: [email protected]
|
331 |
+
* deps: [email protected]
|
332 |
+
- Fix dropping parameters like `hasOwnProperty`
|
333 |
+
- Fix various parsing edge cases
|
334 |
+
- Parsed object now has `null` prototype
|
335 |
+
* deps: raw-body@~2.1.1
|
336 |
+
- Use `unpipe` module for unpiping requests
|
337 |
+
- deps: [email protected]
|
338 |
+
* deps: type-is@~1.6.3
|
339 |
+
- deps: mime-types@~2.1.1
|
340 |
+
- perf: reduce try block size
|
341 |
+
- perf: remove bitwise operations
|
342 |
+
* perf: enable strict mode
|
343 |
+
* perf: remove argument reassignment
|
344 |
+
* perf: remove delete call
|
345 |
+
|
346 |
+
1.12.4 / 2015-05-10
|
347 |
+
===================
|
348 |
+
|
349 |
+
* deps: debug@~2.2.0
|
350 |
+
* deps: [email protected]
|
351 |
+
- Fix allowing parameters like `constructor`
|
352 |
+
* deps: on-finished@~2.2.1
|
353 |
+
* deps: raw-body@~2.0.1
|
354 |
+
- Fix a false-positive when unpiping in Node.js 0.8
|
355 |
+
- deps: [email protected]
|
356 |
+
* deps: type-is@~1.6.2
|
357 |
+
- deps: mime-types@~2.0.11
|
358 |
+
|
359 |
+
1.12.3 / 2015-04-15
|
360 |
+
===================
|
361 |
+
|
362 |
+
* Slight efficiency improvement when not debugging
|
363 |
+
* deps: depd@~1.0.1
|
364 |
+
* deps: [email protected]
|
365 |
+
- Add encoding alias UNICODE-1-1-UTF-7
|
366 |
+
* deps: [email protected]
|
367 |
+
- Fix hanging callback if request aborts during read
|
368 |
+
- deps: [email protected]
|
369 |
+
|
370 |
+
1.12.2 / 2015-03-16
|
371 |
+
===================
|
372 |
+
|
373 |
+
* deps: [email protected]
|
374 |
+
- Fix error when parameter `hasOwnProperty` is present
|
375 |
+
|
376 |
+
1.12.1 / 2015-03-15
|
377 |
+
===================
|
378 |
+
|
379 |
+
* deps: debug@~2.1.3
|
380 |
+
- Fix high intensity foreground color for bold
|
381 |
+
- deps: [email protected]
|
382 |
+
* deps: type-is@~1.6.1
|
383 |
+
- deps: mime-types@~2.0.10
|
384 |
+
|
385 |
+
1.12.0 / 2015-02-13
|
386 |
+
===================
|
387 |
+
|
388 |
+
* add `debug` messages
|
389 |
+
* accept a function for the `type` option
|
390 |
+
* use `content-type` to parse `Content-Type` headers
|
391 |
+
* deps: [email protected]
|
392 |
+
- Gracefully support enumerables on `Object.prototype`
|
393 |
+
* deps: [email protected]
|
394 |
+
- deps: [email protected]
|
395 |
+
* deps: type-is@~1.6.0
|
396 |
+
- fix argument reassignment
|
397 |
+
- fix false-positives in `hasBody` `Transfer-Encoding` check
|
398 |
+
- support wildcard for both type and subtype (`*/*`)
|
399 |
+
- deps: mime-types@~2.0.9
|
400 |
+
|
401 |
+
1.11.0 / 2015-01-30
|
402 |
+
===================
|
403 |
+
|
404 |
+
* make internal `extended: true` depth limit infinity
|
405 |
+
* deps: type-is@~1.5.6
|
406 |
+
- deps: mime-types@~2.0.8
|
407 |
+
|
408 |
+
1.10.2 / 2015-01-20
|
409 |
+
===================
|
410 |
+
|
411 |
+
* deps: [email protected]
|
412 |
+
- Fix rare aliases of single-byte encodings
|
413 |
+
* deps: [email protected]
|
414 |
+
- deps: [email protected]
|
415 |
+
|
416 |
+
1.10.1 / 2015-01-01
|
417 |
+
===================
|
418 |
+
|
419 |
+
* deps: on-finished@~2.2.0
|
420 |
+
* deps: type-is@~1.5.5
|
421 |
+
- deps: mime-types@~2.0.7
|
422 |
+
|
423 |
+
1.10.0 / 2014-12-02
|
424 |
+
===================
|
425 |
+
|
426 |
+
* make internal `extended: true` array limit dynamic
|
427 |
+
|
428 |
+
1.9.3 / 2014-11-21
|
429 |
+
==================
|
430 |
+
|
431 |
+
* deps: [email protected]
|
432 |
+
- Fix Windows-31J and X-SJIS encoding support
|
433 |
+
* deps: [email protected]
|
434 |
+
- Fix `arrayLimit` behavior
|
435 |
+
* deps: [email protected]
|
436 |
+
- deps: [email protected]
|
437 |
+
* deps: type-is@~1.5.3
|
438 |
+
- deps: mime-types@~2.0.3
|
439 |
+
|
440 |
+
1.9.2 / 2014-10-27
|
441 |
+
==================
|
442 |
+
|
443 |
+
* deps: [email protected]
|
444 |
+
- Fix parsing of mixed objects and values
|
445 |
+
|
446 |
+
1.9.1 / 2014-10-22
|
447 |
+
==================
|
448 |
+
|
449 |
+
* deps: on-finished@~2.1.1
|
450 |
+
- Fix handling of pipelined requests
|
451 |
+
* deps: [email protected]
|
452 |
+
- Fix parsing of mixed implicit and explicit arrays
|
453 |
+
* deps: type-is@~1.5.2
|
454 |
+
- deps: mime-types@~2.0.2
|
455 |
+
|
456 |
+
1.9.0 / 2014-09-24
|
457 |
+
==================
|
458 |
+
|
459 |
+
* include the charset in "unsupported charset" error message
|
460 |
+
* include the encoding in "unsupported content encoding" error message
|
461 |
+
* deps: depd@~1.0.0
|
462 |
+
|
463 |
+
1.8.4 / 2014-09-23
|
464 |
+
==================
|
465 |
+
|
466 |
+
* fix content encoding to be case-insensitive
|
467 |
+
|
468 |
+
1.8.3 / 2014-09-19
|
469 |
+
==================
|
470 |
+
|
471 |
+
* deps: [email protected]
|
472 |
+
- Fix issue with object keys starting with numbers truncated
|
473 |
+
|
474 |
+
1.8.2 / 2014-09-15
|
475 |
+
==================
|
476 |
+
|
477 |
+
* deps: [email protected]
|
478 |
+
|
479 |
+
1.8.1 / 2014-09-07
|
480 |
+
==================
|
481 |
+
|
482 |
+
* deps: [email protected]
|
483 |
+
* deps: type-is@~1.5.1
|
484 |
+
|
485 |
+
1.8.0 / 2014-09-05
|
486 |
+
==================
|
487 |
+
|
488 |
+
* make empty-body-handling consistent between chunked requests
|
489 |
+
- empty `json` produces `{}`
|
490 |
+
- empty `raw` produces `new Buffer(0)`
|
491 |
+
- empty `text` produces `''`
|
492 |
+
- empty `urlencoded` produces `{}`
|
493 |
+
* deps: [email protected]
|
494 |
+
- Fix issue where first empty value in array is discarded
|
495 |
+
* deps: type-is@~1.5.0
|
496 |
+
- fix `hasbody` to be true for `content-length: 0`
|
497 |
+
|
498 |
+
1.7.0 / 2014-09-01
|
499 |
+
==================
|
500 |
+
|
501 |
+
* add `parameterLimit` option to `urlencoded` parser
|
502 |
+
* change `urlencoded` extended array limit to 100
|
503 |
+
* respond with 413 when over `parameterLimit` in `urlencoded`
|
504 |
+
|
505 |
+
1.6.7 / 2014-08-29
|
506 |
+
==================
|
507 |
+
|
508 |
+
* deps: [email protected]
|
509 |
+
- Remove unnecessary cloning
|
510 |
+
|
511 |
+
1.6.6 / 2014-08-27
|
512 |
+
==================
|
513 |
+
|
514 |
+
* deps: [email protected]
|
515 |
+
- Array parsing fix
|
516 |
+
- Performance improvements
|
517 |
+
|
518 |
+
1.6.5 / 2014-08-16
|
519 |
+
==================
|
520 |
+
|
521 |
+
* deps: [email protected]
|
522 |
+
|
523 |
+
1.6.4 / 2014-08-14
|
524 |
+
==================
|
525 |
+
|
526 |
+
* deps: [email protected]
|
527 |
+
|
528 |
+
1.6.3 / 2014-08-10
|
529 |
+
==================
|
530 |
+
|
531 |
+
* deps: [email protected]
|
532 |
+
|
533 |
+
1.6.2 / 2014-08-07
|
534 |
+
==================
|
535 |
+
|
536 |
+
* deps: [email protected]
|
537 |
+
- Fix parsing array of objects
|
538 |
+
|
539 |
+
1.6.1 / 2014-08-06
|
540 |
+
==================
|
541 |
+
|
542 |
+
* deps: [email protected]
|
543 |
+
- Accept urlencoded square brackets
|
544 |
+
- Accept empty values in implicit array notation
|
545 |
+
|
546 |
+
1.6.0 / 2014-08-05
|
547 |
+
==================
|
548 |
+
|
549 |
+
* deps: [email protected]
|
550 |
+
- Complete rewrite
|
551 |
+
- Limits array length to 20
|
552 |
+
- Limits object depth to 5
|
553 |
+
- Limits parameters to 1,000
|
554 |
+
|
555 |
+
1.5.2 / 2014-07-27
|
556 |
+
==================
|
557 |
+
|
558 |
+
* deps: [email protected]
|
559 |
+
- Work-around v8 generating empty stack traces
|
560 |
+
|
561 |
+
1.5.1 / 2014-07-26
|
562 |
+
==================
|
563 |
+
|
564 |
+
* deps: [email protected]
|
565 |
+
- Fix exception when global `Error.stackTraceLimit` is too low
|
566 |
+
|
567 |
+
1.5.0 / 2014-07-20
|
568 |
+
==================
|
569 |
+
|
570 |
+
* deps: [email protected]
|
571 |
+
- Add `TRACE_DEPRECATION` environment variable
|
572 |
+
- Remove non-standard grey color from color output
|
573 |
+
- Support `--no-deprecation` argument
|
574 |
+
- Support `--trace-deprecation` argument
|
575 |
+
* deps: [email protected]
|
576 |
+
- Added encoding UTF-7
|
577 |
+
* deps: [email protected]
|
578 |
+
- deps: [email protected]
|
579 |
+
- Added encoding UTF-7
|
580 |
+
- Fix `Cannot switch to old mode now` error on Node.js 0.10+
|
581 |
+
* deps: type-is@~1.3.2
|
582 |
+
|
583 |
+
1.4.3 / 2014-06-19
|
584 |
+
==================
|
585 |
+
|
586 |
+
* deps: [email protected]
|
587 |
+
- fix global variable leak
|
588 |
+
|
589 |
+
1.4.2 / 2014-06-19
|
590 |
+
==================
|
591 |
+
|
592 |
+
* deps: [email protected]
|
593 |
+
- improve type parsing
|
594 |
+
|
595 |
+
1.4.1 / 2014-06-19
|
596 |
+
==================
|
597 |
+
|
598 |
+
* fix urlencoded extended deprecation message
|
599 |
+
|
600 |
+
1.4.0 / 2014-06-19
|
601 |
+
==================
|
602 |
+
|
603 |
+
* add `text` parser
|
604 |
+
* add `raw` parser
|
605 |
+
* check accepted charset in content-type (accepts utf-8)
|
606 |
+
* check accepted encoding in content-encoding (accepts identity)
|
607 |
+
* deprecate `bodyParser()` middleware; use `.json()` and `.urlencoded()` as needed
|
608 |
+
* deprecate `urlencoded()` without provided `extended` option
|
609 |
+
* lazy-load urlencoded parsers
|
610 |
+
* parsers split into files for reduced mem usage
|
611 |
+
* support gzip and deflate bodies
|
612 |
+
- set `inflate: false` to turn off
|
613 |
+
* deps: [email protected]
|
614 |
+
- Support all encodings from `iconv-lite`
|
615 |
+
|
616 |
+
1.3.1 / 2014-06-11
|
617 |
+
==================
|
618 |
+
|
619 |
+
* deps: [email protected]
|
620 |
+
- Switch dependency from mime to [email protected]
|
621 |
+
|
622 |
+
1.3.0 / 2014-05-31
|
623 |
+
==================
|
624 |
+
|
625 |
+
* add `extended` option to urlencoded parser
|
626 |
+
|
627 |
+
1.2.2 / 2014-05-27
|
628 |
+
==================
|
629 |
+
|
630 |
+
* deps: [email protected]
|
631 |
+
- assert stream encoding on node.js 0.8
|
632 |
+
- assert stream encoding on node.js < 0.10.6
|
633 |
+
- deps: bytes@1
|
634 |
+
|
635 |
+
1.2.1 / 2014-05-26
|
636 |
+
==================
|
637 |
+
|
638 |
+
* invoke `next(err)` after request fully read
|
639 |
+
- prevents hung responses and socket hang ups
|
640 |
+
|
641 |
+
1.2.0 / 2014-05-11
|
642 |
+
==================
|
643 |
+
|
644 |
+
* add `verify` option
|
645 |
+
* deps: [email protected]
|
646 |
+
- support suffix matching
|
647 |
+
|
648 |
+
1.1.2 / 2014-05-11
|
649 |
+
==================
|
650 |
+
|
651 |
+
* improve json parser speed
|
652 |
+
|
653 |
+
1.1.1 / 2014-05-11
|
654 |
+
==================
|
655 |
+
|
656 |
+
* fix repeated limit parsing with every request
|
657 |
+
|
658 |
+
1.1.0 / 2014-05-10
|
659 |
+
==================
|
660 |
+
|
661 |
+
* add `type` option
|
662 |
+
* deps: pin for safety and consistency
|
663 |
+
|
664 |
+
1.0.2 / 2014-04-14
|
665 |
+
==================
|
666 |
+
|
667 |
+
* use `type-is` module
|
668 |
+
|
669 |
+
1.0.1 / 2014-03-20
|
670 |
+
==================
|
671 |
+
|
672 |
+
* 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,476 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
var 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, or an empty
|
60 |
+
object (`{}`) if there was no body to parse, the `Content-Type` was not matched,
|
61 |
+
or an error occurred.
|
62 |
+
|
63 |
+
The various errors returned by this module are described in the
|
64 |
+
[errors section](#errors).
|
65 |
+
|
66 |
+
### bodyParser.json([options])
|
67 |
+
|
68 |
+
Returns middleware that only parses `json` and only looks at requests where
|
69 |
+
the `Content-Type` header matches the `type` option. This parser accepts any
|
70 |
+
Unicode encoding of the body and supports automatic inflation of `gzip` and
|
71 |
+
`deflate` encodings.
|
72 |
+
|
73 |
+
A new `body` object containing the parsed data is populated on the `request`
|
74 |
+
object after the middleware (i.e. `req.body`).
|
75 |
+
|
76 |
+
#### Options
|
77 |
+
|
78 |
+
The `json` function takes an optional `options` object that may contain any of
|
79 |
+
the following keys:
|
80 |
+
|
81 |
+
##### inflate
|
82 |
+
|
83 |
+
When set to `true`, then deflated (compressed) bodies will be inflated; when
|
84 |
+
`false`, deflated bodies are rejected. Defaults to `true`.
|
85 |
+
|
86 |
+
##### limit
|
87 |
+
|
88 |
+
Controls the maximum request body size. If this is a number, then the value
|
89 |
+
specifies the number of bytes; if it is a string, the value is passed to the
|
90 |
+
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
91 |
+
to `'100kb'`.
|
92 |
+
|
93 |
+
##### reviver
|
94 |
+
|
95 |
+
The `reviver` option is passed directly to `JSON.parse` as the second
|
96 |
+
argument. You can find more information on this argument
|
97 |
+
[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).
|
98 |
+
|
99 |
+
##### strict
|
100 |
+
|
101 |
+
When set to `true`, will only accept arrays and objects; when `false` will
|
102 |
+
accept anything `JSON.parse` accepts. Defaults to `true`.
|
103 |
+
|
104 |
+
##### type
|
105 |
+
|
106 |
+
The `type` option is used to determine what media type the middleware will
|
107 |
+
parse. This option can be a string, array of strings, or a function. If not a
|
108 |
+
function, `type` option is passed directly to the
|
109 |
+
[type-is](https://www.npmjs.org/package/type-is#readme) library and this can
|
110 |
+
be an extension name (like `json`), a mime type (like `application/json`), or
|
111 |
+
a mime type with a wildcard (like `*/*` or `*/json`). If a function, the `type`
|
112 |
+
option is called as `fn(req)` and the request is parsed if it returns a truthy
|
113 |
+
value. Defaults to `application/json`.
|
114 |
+
|
115 |
+
##### verify
|
116 |
+
|
117 |
+
The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`,
|
118 |
+
where `buf` is a `Buffer` of the raw request body and `encoding` is the
|
119 |
+
encoding of the request. The parsing can be aborted by throwing an error.
|
120 |
+
|
121 |
+
### bodyParser.raw([options])
|
122 |
+
|
123 |
+
Returns middleware that parses all bodies as a `Buffer` and only looks at
|
124 |
+
requests where the `Content-Type` header matches the `type` option. This
|
125 |
+
parser supports automatic inflation of `gzip` and `deflate` encodings.
|
126 |
+
|
127 |
+
A new `body` object containing the parsed data is populated on the `request`
|
128 |
+
object after the middleware (i.e. `req.body`). This will be a `Buffer` object
|
129 |
+
of the body.
|
130 |
+
|
131 |
+
#### Options
|
132 |
+
|
133 |
+
The `raw` function takes an optional `options` object that may contain any of
|
134 |
+
the following keys:
|
135 |
+
|
136 |
+
##### inflate
|
137 |
+
|
138 |
+
When set to `true`, then deflated (compressed) bodies will be inflated; when
|
139 |
+
`false`, deflated bodies are rejected. Defaults to `true`.
|
140 |
+
|
141 |
+
##### limit
|
142 |
+
|
143 |
+
Controls the maximum request body size. If this is a number, then the value
|
144 |
+
specifies the number of bytes; if it is a string, the value is passed to the
|
145 |
+
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
146 |
+
to `'100kb'`.
|
147 |
+
|
148 |
+
##### type
|
149 |
+
|
150 |
+
The `type` option is used to determine what media type the middleware will
|
151 |
+
parse. This option can be a string, array of strings, or a function.
|
152 |
+
If not a function, `type` option is passed directly to the
|
153 |
+
[type-is](https://www.npmjs.org/package/type-is#readme) library and this
|
154 |
+
can be an extension name (like `bin`), a mime type (like
|
155 |
+
`application/octet-stream`), or a mime type with a wildcard (like `*/*` or
|
156 |
+
`application/*`). If a function, the `type` option is called as `fn(req)`
|
157 |
+
and the request is parsed if it returns a truthy value. Defaults to
|
158 |
+
`application/octet-stream`.
|
159 |
+
|
160 |
+
##### verify
|
161 |
+
|
162 |
+
The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`,
|
163 |
+
where `buf` is a `Buffer` of the raw request body and `encoding` is the
|
164 |
+
encoding of the request. The parsing can be aborted by throwing an error.
|
165 |
+
|
166 |
+
### bodyParser.text([options])
|
167 |
+
|
168 |
+
Returns middleware that parses all bodies as a string and only looks at
|
169 |
+
requests where the `Content-Type` header matches the `type` option. This
|
170 |
+
parser supports automatic inflation of `gzip` and `deflate` 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` 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` option allows to choose between parsing the URL-encoded data
|
235 |
+
with the `querystring` library (when `false`) or the `qs` library (when
|
236 |
+
`true`). The "extended" syntax allows for rich objects and arrays to be
|
237 |
+
encoded into the URL-encoded format, allowing for a JSON-like experience
|
238 |
+
with URL-encoded. For more information, please
|
239 |
+
[see the qs library](https://www.npmjs.org/package/qs#readme).
|
240 |
+
|
241 |
+
Defaults to `true`, but using the default has been deprecated. Please
|
242 |
+
research into the difference between `qs` and `querystring` and choose the
|
243 |
+
appropriate setting.
|
244 |
+
|
245 |
+
##### inflate
|
246 |
+
|
247 |
+
When set to `true`, then deflated (compressed) bodies will be inflated; when
|
248 |
+
`false`, deflated bodies are rejected. Defaults to `true`.
|
249 |
+
|
250 |
+
##### limit
|
251 |
+
|
252 |
+
Controls the maximum request body size. If this is a number, then the value
|
253 |
+
specifies the number of bytes; if it is a string, the value is passed to the
|
254 |
+
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
255 |
+
to `'100kb'`.
|
256 |
+
|
257 |
+
##### parameterLimit
|
258 |
+
|
259 |
+
The `parameterLimit` option controls the maximum number of parameters that
|
260 |
+
are allowed in the URL-encoded data. If a request contains more parameters
|
261 |
+
than this value, a 413 will be returned to the client. Defaults to `1000`.
|
262 |
+
|
263 |
+
##### type
|
264 |
+
|
265 |
+
The `type` option is used to determine what media type the middleware will
|
266 |
+
parse. This option can be a string, array of strings, or a function. If not
|
267 |
+
a function, `type` option is passed directly to the
|
268 |
+
[type-is](https://www.npmjs.org/package/type-is#readme) library and this can
|
269 |
+
be an extension name (like `urlencoded`), a mime type (like
|
270 |
+
`application/x-www-form-urlencoded`), or a mime type with a wildcard (like
|
271 |
+
`*/x-www-form-urlencoded`). If a function, the `type` option is called as
|
272 |
+
`fn(req)` and the request is parsed if it returns a truthy value. Defaults
|
273 |
+
to `application/x-www-form-urlencoded`.
|
274 |
+
|
275 |
+
##### verify
|
276 |
+
|
277 |
+
The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`,
|
278 |
+
where `buf` is a `Buffer` of the raw request body and `encoding` is the
|
279 |
+
encoding of the request. The parsing can be aborted by throwing an error.
|
280 |
+
|
281 |
+
#### depth
|
282 |
+
|
283 |
+
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.
|
284 |
+
|
285 |
+
## Errors
|
286 |
+
|
287 |
+
The middlewares provided by this module create errors using the
|
288 |
+
[`http-errors` module](https://www.npmjs.com/package/http-errors). The errors
|
289 |
+
will typically have a `status`/`statusCode` property that contains the suggested
|
290 |
+
HTTP response code, an `expose` property to determine if the `message` property
|
291 |
+
should be displayed to the client, a `type` property to determine the type of
|
292 |
+
error without matching against the `message`, and a `body` property containing
|
293 |
+
the read body, if available.
|
294 |
+
|
295 |
+
The following are the common errors created, though any error can come through
|
296 |
+
for various reasons.
|
297 |
+
|
298 |
+
### content encoding unsupported
|
299 |
+
|
300 |
+
This error will occur when the request had a `Content-Encoding` header that
|
301 |
+
contained an encoding but the "inflation" option was set to `false`. The
|
302 |
+
`status` property is set to `415`, the `type` property is set to
|
303 |
+
`'encoding.unsupported'`, and the `charset` property will be set to the
|
304 |
+
encoding that is unsupported.
|
305 |
+
|
306 |
+
### entity parse failed
|
307 |
+
|
308 |
+
This error will occur when the request contained an entity that could not be
|
309 |
+
parsed by the middleware. The `status` property is set to `400`, the `type`
|
310 |
+
property is set to `'entity.parse.failed'`, and the `body` property is set to
|
311 |
+
the entity value that failed parsing.
|
312 |
+
|
313 |
+
### entity verify failed
|
314 |
+
|
315 |
+
This error will occur when the request contained an entity that could not be
|
316 |
+
failed verification by the defined `verify` option. The `status` property is
|
317 |
+
set to `403`, the `type` property is set to `'entity.verify.failed'`, and the
|
318 |
+
`body` property is set to the entity value that failed verification.
|
319 |
+
|
320 |
+
### request aborted
|
321 |
+
|
322 |
+
This error will occur when the request is aborted by the client before reading
|
323 |
+
the body has finished. The `received` property will be set to the number of
|
324 |
+
bytes received before the request was aborted and the `expected` property is
|
325 |
+
set to the number of expected bytes. The `status` property is set to `400`
|
326 |
+
and `type` property is set to `'request.aborted'`.
|
327 |
+
|
328 |
+
### request entity too large
|
329 |
+
|
330 |
+
This error will occur when the request body's size is larger than the "limit"
|
331 |
+
option. The `limit` property will be set to the byte limit and the `length`
|
332 |
+
property will be set to the request body's length. The `status` property is
|
333 |
+
set to `413` and the `type` property is set to `'entity.too.large'`.
|
334 |
+
|
335 |
+
### request size did not match content length
|
336 |
+
|
337 |
+
This error will occur when the request's length did not match the length from
|
338 |
+
the `Content-Length` header. This typically occurs when the request is malformed,
|
339 |
+
typically when the `Content-Length` header was calculated based on characters
|
340 |
+
instead of bytes. The `status` property is set to `400` and the `type` property
|
341 |
+
is set to `'request.size.invalid'`.
|
342 |
+
|
343 |
+
### stream encoding should not be set
|
344 |
+
|
345 |
+
This error will occur when something called the `req.setEncoding` method prior
|
346 |
+
to this middleware. This module operates directly on bytes only and you cannot
|
347 |
+
call `req.setEncoding` when using this module. The `status` property is set to
|
348 |
+
`500` and the `type` property is set to `'stream.encoding.set'`.
|
349 |
+
|
350 |
+
### stream is not readable
|
351 |
+
|
352 |
+
This error will occur when the request is no longer readable when this middleware
|
353 |
+
attempts to read it. This typically means something other than a middleware from
|
354 |
+
this module read the request body already and the middleware was also configured to
|
355 |
+
read the same request. The `status` property is set to `500` and the `type`
|
356 |
+
property is set to `'stream.not.readable'`.
|
357 |
+
|
358 |
+
### too many parameters
|
359 |
+
|
360 |
+
This error will occur when the content of the request exceeds the configured
|
361 |
+
`parameterLimit` for the `urlencoded` parser. The `status` property is set to
|
362 |
+
`413` and the `type` property is set to `'parameters.too.many'`.
|
363 |
+
|
364 |
+
### unsupported charset "BOGUS"
|
365 |
+
|
366 |
+
This error will occur when the request had a charset parameter in the
|
367 |
+
`Content-Type` header, but the `iconv-lite` module does not support it OR the
|
368 |
+
parser does not support it. The charset is contained in the message as well
|
369 |
+
as in the `charset` property. The `status` property is set to `415`, the
|
370 |
+
`type` property is set to `'charset.unsupported'`, and the `charset` property
|
371 |
+
is set to the charset that is unsupported.
|
372 |
+
|
373 |
+
### unsupported content encoding "bogus"
|
374 |
+
|
375 |
+
This error will occur when the request had a `Content-Encoding` header that
|
376 |
+
contained an unsupported encoding. The encoding is contained in the message
|
377 |
+
as well as in the `encoding` property. The `status` property is set to `415`,
|
378 |
+
the `type` property is set to `'encoding.unsupported'`, and the `encoding`
|
379 |
+
property is set to the encoding that is unsupported.
|
380 |
+
|
381 |
+
### The input exceeded the depth
|
382 |
+
|
383 |
+
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.
|
384 |
+
|
385 |
+
## Examples
|
386 |
+
|
387 |
+
### Express/Connect top-level generic
|
388 |
+
|
389 |
+
This example demonstrates adding a generic JSON and URL-encoded parser as a
|
390 |
+
top-level middleware, which will parse the bodies of all incoming requests.
|
391 |
+
This is the simplest setup.
|
392 |
+
|
393 |
+
```js
|
394 |
+
var express = require('express')
|
395 |
+
var bodyParser = require('body-parser')
|
396 |
+
|
397 |
+
var app = express()
|
398 |
+
|
399 |
+
// parse application/x-www-form-urlencoded
|
400 |
+
app.use(bodyParser.urlencoded({ extended: false }))
|
401 |
+
|
402 |
+
// parse application/json
|
403 |
+
app.use(bodyParser.json())
|
404 |
+
|
405 |
+
app.use(function (req, res) {
|
406 |
+
res.setHeader('Content-Type', 'text/plain')
|
407 |
+
res.write('you posted:\n')
|
408 |
+
res.end(JSON.stringify(req.body, null, 2))
|
409 |
+
})
|
410 |
+
```
|
411 |
+
|
412 |
+
### Express route-specific
|
413 |
+
|
414 |
+
This example demonstrates adding body parsers specifically to the routes that
|
415 |
+
need them. In general, this is the most recommended way to use body-parser with
|
416 |
+
Express.
|
417 |
+
|
418 |
+
```js
|
419 |
+
var express = require('express')
|
420 |
+
var bodyParser = require('body-parser')
|
421 |
+
|
422 |
+
var app = express()
|
423 |
+
|
424 |
+
// create application/json parser
|
425 |
+
var jsonParser = bodyParser.json()
|
426 |
+
|
427 |
+
// create application/x-www-form-urlencoded parser
|
428 |
+
var urlencodedParser = bodyParser.urlencoded({ extended: false })
|
429 |
+
|
430 |
+
// POST /login gets urlencoded bodies
|
431 |
+
app.post('/login', urlencodedParser, function (req, res) {
|
432 |
+
res.send('welcome, ' + req.body.username)
|
433 |
+
})
|
434 |
+
|
435 |
+
// POST /api/users gets JSON bodies
|
436 |
+
app.post('/api/users', jsonParser, function (req, res) {
|
437 |
+
// create user in req.body
|
438 |
+
})
|
439 |
+
```
|
440 |
+
|
441 |
+
### Change accepted type for parsers
|
442 |
+
|
443 |
+
All the parsers accept a `type` option which allows you to change the
|
444 |
+
`Content-Type` that the middleware will parse.
|
445 |
+
|
446 |
+
```js
|
447 |
+
var express = require('express')
|
448 |
+
var bodyParser = require('body-parser')
|
449 |
+
|
450 |
+
var app = express()
|
451 |
+
|
452 |
+
// parse various different custom JSON types as JSON
|
453 |
+
app.use(bodyParser.json({ type: 'application/*+json' }))
|
454 |
+
|
455 |
+
// parse some custom thing into a Buffer
|
456 |
+
app.use(bodyParser.raw({ type: 'application/vnd.custom-type' }))
|
457 |
+
|
458 |
+
// parse an HTML body into a string
|
459 |
+
app.use(bodyParser.text({ type: 'text/html' }))
|
460 |
+
```
|
461 |
+
|
462 |
+
## License
|
463 |
+
|
464 |
+
[MIT](LICENSE)
|
465 |
+
|
466 |
+
[ci-image]: https://badgen.net/github/checks/expressjs/body-parser/master?label=ci
|
467 |
+
[ci-url]: https://github.com/expressjs/body-parser/actions/workflows/ci.yml
|
468 |
+
[coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/body-parser/master
|
469 |
+
[coveralls-url]: https://coveralls.io/r/expressjs/body-parser?branch=master
|
470 |
+
[node-version-image]: https://badgen.net/npm/node/body-parser
|
471 |
+
[node-version-url]: https://nodejs.org/en/download
|
472 |
+
[npm-downloads-image]: https://badgen.net/npm/dm/body-parser
|
473 |
+
[npm-url]: https://npmjs.org/package/body-parser
|
474 |
+
[npm-version-image]: https://badgen.net/npm/v/body-parser
|
475 |
+
[ossf-scorecard-badge]: https://api.scorecard.dev/projects/github.com/expressjs/body-parser/badge
|
476 |
+
[ossf-scorecard-visualizer]: https://ossf.github.io/scorecard-visualizer/#/projects/github.com/expressjs/body-parser
|
node_modules/body-parser/SECURITY.md
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Security Policies and Procedures
|
2 |
+
|
3 |
+
## Reporting a Bug
|
4 |
+
|
5 |
+
The Express team and community take all security bugs seriously. Thank you
|
6 |
+
for improving the security of Express. We appreciate your efforts and
|
7 |
+
responsible disclosure and will make every effort to acknowledge your
|
8 |
+
contributions.
|
9 |
+
|
10 |
+
Report security bugs by emailing the current owner(s) of `body-parser`. This
|
11 |
+
information can be found in the npm registry using the command
|
12 |
+
`npm owner ls body-parser`.
|
13 |
+
If unsure or unable to get the information from the above, open an issue
|
14 |
+
in the [project issue tracker](https://github.com/expressjs/body-parser/issues)
|
15 |
+
asking for the current contact information.
|
16 |
+
|
17 |
+
To ensure the timely response to your report, please ensure that the entirety
|
18 |
+
of the report is contained within the email body and not solely behind a web
|
19 |
+
link or an attachment.
|
20 |
+
|
21 |
+
At least one owner will acknowledge your email within 48 hours, and will send a
|
22 |
+
more detailed response within 48 hours indicating the next steps in handling
|
23 |
+
your report. After the initial reply to your report, the owners will
|
24 |
+
endeavor to keep you informed of the progress towards a fix and full
|
25 |
+
announcement, and may ask for additional information or guidance.
|
node_modules/body-parser/index.js
ADDED
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 deprecate = require('depd')('body-parser')
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Cache of loaded parsers.
|
18 |
+
* @private
|
19 |
+
*/
|
20 |
+
|
21 |
+
var parsers = Object.create(null)
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @typedef Parsers
|
25 |
+
* @type {function}
|
26 |
+
* @property {function} json
|
27 |
+
* @property {function} raw
|
28 |
+
* @property {function} text
|
29 |
+
* @property {function} urlencoded
|
30 |
+
*/
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Module exports.
|
34 |
+
* @type {Parsers}
|
35 |
+
*/
|
36 |
+
|
37 |
+
exports = module.exports = deprecate.function(bodyParser,
|
38 |
+
'bodyParser: use individual json/urlencoded middlewares')
|
39 |
+
|
40 |
+
/**
|
41 |
+
* JSON parser.
|
42 |
+
* @public
|
43 |
+
*/
|
44 |
+
|
45 |
+
Object.defineProperty(exports, 'json', {
|
46 |
+
configurable: true,
|
47 |
+
enumerable: true,
|
48 |
+
get: createParserGetter('json')
|
49 |
+
})
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Raw parser.
|
53 |
+
* @public
|
54 |
+
*/
|
55 |
+
|
56 |
+
Object.defineProperty(exports, 'raw', {
|
57 |
+
configurable: true,
|
58 |
+
enumerable: true,
|
59 |
+
get: createParserGetter('raw')
|
60 |
+
})
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Text parser.
|
64 |
+
* @public
|
65 |
+
*/
|
66 |
+
|
67 |
+
Object.defineProperty(exports, 'text', {
|
68 |
+
configurable: true,
|
69 |
+
enumerable: true,
|
70 |
+
get: createParserGetter('text')
|
71 |
+
})
|
72 |
+
|
73 |
+
/**
|
74 |
+
* URL-encoded parser.
|
75 |
+
* @public
|
76 |
+
*/
|
77 |
+
|
78 |
+
Object.defineProperty(exports, 'urlencoded', {
|
79 |
+
configurable: true,
|
80 |
+
enumerable: true,
|
81 |
+
get: createParserGetter('urlencoded')
|
82 |
+
})
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Create a middleware to parse json and urlencoded bodies.
|
86 |
+
*
|
87 |
+
* @param {object} [options]
|
88 |
+
* @return {function}
|
89 |
+
* @deprecated
|
90 |
+
* @public
|
91 |
+
*/
|
92 |
+
|
93 |
+
function bodyParser (options) {
|
94 |
+
// use default type for parsers
|
95 |
+
var opts = Object.create(options || null, {
|
96 |
+
type: {
|
97 |
+
configurable: true,
|
98 |
+
enumerable: true,
|
99 |
+
value: undefined,
|
100 |
+
writable: true
|
101 |
+
}
|
102 |
+
})
|
103 |
+
|
104 |
+
var _urlencoded = exports.urlencoded(opts)
|
105 |
+
var _json = exports.json(opts)
|
106 |
+
|
107 |
+
return function bodyParser (req, res, next) {
|
108 |
+
_json(req, res, function (err) {
|
109 |
+
if (err) return next(err)
|
110 |
+
_urlencoded(req, res, next)
|
111 |
+
})
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Create a getter for loading a parser.
|
117 |
+
* @private
|
118 |
+
*/
|
119 |
+
|
120 |
+
function createParserGetter (name) {
|
121 |
+
return function get () {
|
122 |
+
return loadParser(name)
|
123 |
+
}
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Load a parser module.
|
128 |
+
* @private
|
129 |
+
*/
|
130 |
+
|
131 |
+
function loadParser (parserName) {
|
132 |
+
var parser = parsers[parserName]
|
133 |
+
|
134 |
+
if (parser !== undefined) {
|
135 |
+
return parser
|
136 |
+
}
|
137 |
+
|
138 |
+
// this uses a switch for static require analysis
|
139 |
+
switch (parserName) {
|
140 |
+
case 'json':
|
141 |
+
parser = require('./lib/types/json')
|
142 |
+
break
|
143 |
+
case 'raw':
|
144 |
+
parser = require('./lib/types/raw')
|
145 |
+
break
|
146 |
+
case 'text':
|
147 |
+
parser = require('./lib/types/text')
|
148 |
+
break
|
149 |
+
case 'urlencoded':
|
150 |
+
parser = require('./lib/types/urlencoded')
|
151 |
+
break
|
152 |
+
}
|
153 |
+
|
154 |
+
// store to prevent invoking require()
|
155 |
+
return (parsers[parserName] = parser)
|
156 |
+
}
|
node_modules/body-parser/lib/read.js
ADDED
@@ -0,0 +1,205 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 destroy = require('destroy')
|
16 |
+
var getBody = require('raw-body')
|
17 |
+
var iconv = require('iconv-lite')
|
18 |
+
var onFinished = require('on-finished')
|
19 |
+
var unpipe = require('unpipe')
|
20 |
+
var zlib = require('zlib')
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Module exports.
|
24 |
+
*/
|
25 |
+
|
26 |
+
module.exports = read
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Read a request into a buffer and parse.
|
30 |
+
*
|
31 |
+
* @param {object} req
|
32 |
+
* @param {object} res
|
33 |
+
* @param {function} next
|
34 |
+
* @param {function} parse
|
35 |
+
* @param {function} debug
|
36 |
+
* @param {object} options
|
37 |
+
* @private
|
38 |
+
*/
|
39 |
+
|
40 |
+
function read (req, res, next, parse, debug, options) {
|
41 |
+
var length
|
42 |
+
var opts = options
|
43 |
+
var stream
|
44 |
+
|
45 |
+
// flag as parsed
|
46 |
+
req._body = true
|
47 |
+
|
48 |
+
// read options
|
49 |
+
var encoding = opts.encoding !== null
|
50 |
+
? opts.encoding
|
51 |
+
: null
|
52 |
+
var verify = opts.verify
|
53 |
+
|
54 |
+
try {
|
55 |
+
// get the content stream
|
56 |
+
stream = contentstream(req, debug, opts.inflate)
|
57 |
+
length = stream.length
|
58 |
+
stream.length = undefined
|
59 |
+
} catch (err) {
|
60 |
+
return next(err)
|
61 |
+
}
|
62 |
+
|
63 |
+
// set raw-body options
|
64 |
+
opts.length = length
|
65 |
+
opts.encoding = verify
|
66 |
+
? null
|
67 |
+
: encoding
|
68 |
+
|
69 |
+
// assert charset is supported
|
70 |
+
if (opts.encoding === null && encoding !== null && !iconv.encodingExists(encoding)) {
|
71 |
+
return next(createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', {
|
72 |
+
charset: encoding.toLowerCase(),
|
73 |
+
type: 'charset.unsupported'
|
74 |
+
}))
|
75 |
+
}
|
76 |
+
|
77 |
+
// read body
|
78 |
+
debug('read body')
|
79 |
+
getBody(stream, opts, function (error, body) {
|
80 |
+
if (error) {
|
81 |
+
var _error
|
82 |
+
|
83 |
+
if (error.type === 'encoding.unsupported') {
|
84 |
+
// echo back charset
|
85 |
+
_error = createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', {
|
86 |
+
charset: encoding.toLowerCase(),
|
87 |
+
type: 'charset.unsupported'
|
88 |
+
})
|
89 |
+
} else {
|
90 |
+
// set status code on error
|
91 |
+
_error = createError(400, error)
|
92 |
+
}
|
93 |
+
|
94 |
+
// unpipe from stream and destroy
|
95 |
+
if (stream !== req) {
|
96 |
+
unpipe(req)
|
97 |
+
destroy(stream, true)
|
98 |
+
}
|
99 |
+
|
100 |
+
// read off entire request
|
101 |
+
dump(req, function onfinished () {
|
102 |
+
next(createError(400, _error))
|
103 |
+
})
|
104 |
+
return
|
105 |
+
}
|
106 |
+
|
107 |
+
// verify
|
108 |
+
if (verify) {
|
109 |
+
try {
|
110 |
+
debug('verify body')
|
111 |
+
verify(req, res, body, encoding)
|
112 |
+
} catch (err) {
|
113 |
+
next(createError(403, err, {
|
114 |
+
body: body,
|
115 |
+
type: err.type || 'entity.verify.failed'
|
116 |
+
}))
|
117 |
+
return
|
118 |
+
}
|
119 |
+
}
|
120 |
+
|
121 |
+
// parse
|
122 |
+
var str = body
|
123 |
+
try {
|
124 |
+
debug('parse body')
|
125 |
+
str = typeof body !== 'string' && encoding !== null
|
126 |
+
? iconv.decode(body, encoding)
|
127 |
+
: body
|
128 |
+
req.body = parse(str)
|
129 |
+
} catch (err) {
|
130 |
+
next(createError(400, err, {
|
131 |
+
body: str,
|
132 |
+
type: err.type || 'entity.parse.failed'
|
133 |
+
}))
|
134 |
+
return
|
135 |
+
}
|
136 |
+
|
137 |
+
next()
|
138 |
+
})
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Get the content stream of the request.
|
143 |
+
*
|
144 |
+
* @param {object} req
|
145 |
+
* @param {function} debug
|
146 |
+
* @param {boolean} [inflate=true]
|
147 |
+
* @return {object}
|
148 |
+
* @api private
|
149 |
+
*/
|
150 |
+
|
151 |
+
function contentstream (req, debug, inflate) {
|
152 |
+
var encoding = (req.headers['content-encoding'] || 'identity').toLowerCase()
|
153 |
+
var length = req.headers['content-length']
|
154 |
+
var stream
|
155 |
+
|
156 |
+
debug('content-encoding "%s"', encoding)
|
157 |
+
|
158 |
+
if (inflate === false && encoding !== 'identity') {
|
159 |
+
throw createError(415, 'content encoding unsupported', {
|
160 |
+
encoding: encoding,
|
161 |
+
type: 'encoding.unsupported'
|
162 |
+
})
|
163 |
+
}
|
164 |
+
|
165 |
+
switch (encoding) {
|
166 |
+
case 'deflate':
|
167 |
+
stream = zlib.createInflate()
|
168 |
+
debug('inflate body')
|
169 |
+
req.pipe(stream)
|
170 |
+
break
|
171 |
+
case 'gzip':
|
172 |
+
stream = zlib.createGunzip()
|
173 |
+
debug('gunzip body')
|
174 |
+
req.pipe(stream)
|
175 |
+
break
|
176 |
+
case 'identity':
|
177 |
+
stream = req
|
178 |
+
stream.length = length
|
179 |
+
break
|
180 |
+
default:
|
181 |
+
throw createError(415, 'unsupported content encoding "' + encoding + '"', {
|
182 |
+
encoding: encoding,
|
183 |
+
type: 'encoding.unsupported'
|
184 |
+
})
|
185 |
+
}
|
186 |
+
|
187 |
+
return stream
|
188 |
+
}
|
189 |
+
|
190 |
+
/**
|
191 |
+
* Dump the contents of a request.
|
192 |
+
*
|
193 |
+
* @param {object} req
|
194 |
+
* @param {function} callback
|
195 |
+
* @api private
|
196 |
+
*/
|
197 |
+
|
198 |
+
function dump (req, callback) {
|
199 |
+
if (onFinished.isFinished(req)) {
|
200 |
+
callback(null)
|
201 |
+
} else {
|
202 |
+
onFinished(req, callback)
|
203 |
+
req.resume()
|
204 |
+
}
|
205 |
+
}
|
node_modules/body-parser/lib/types/json.js
ADDED
@@ -0,0 +1,247 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bytes = require('bytes')
|
16 |
+
var contentType = require('content-type')
|
17 |
+
var createError = require('http-errors')
|
18 |
+
var debug = require('debug')('body-parser:json')
|
19 |
+
var read = require('../read')
|
20 |
+
var typeis = require('type-is')
|
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 opts = options || {}
|
55 |
+
|
56 |
+
var limit = typeof opts.limit !== 'number'
|
57 |
+
? bytes.parse(opts.limit || '100kb')
|
58 |
+
: opts.limit
|
59 |
+
var inflate = opts.inflate !== false
|
60 |
+
var reviver = opts.reviver
|
61 |
+
var strict = opts.strict !== false
|
62 |
+
var type = opts.type || 'application/json'
|
63 |
+
var verify = opts.verify || false
|
64 |
+
|
65 |
+
if (verify !== false && typeof verify !== 'function') {
|
66 |
+
throw new TypeError('option verify must be function')
|
67 |
+
}
|
68 |
+
|
69 |
+
// create the appropriate type checking function
|
70 |
+
var shouldParse = typeof type !== 'function'
|
71 |
+
? typeChecker(type)
|
72 |
+
: type
|
73 |
+
|
74 |
+
function parse (body) {
|
75 |
+
if (body.length === 0) {
|
76 |
+
// special-case empty json body, as it's a common client-side mistake
|
77 |
+
// TODO: maybe make this configurable or part of "strict" option
|
78 |
+
return {}
|
79 |
+
}
|
80 |
+
|
81 |
+
if (strict) {
|
82 |
+
var first = firstchar(body)
|
83 |
+
|
84 |
+
if (first !== '{' && first !== '[') {
|
85 |
+
debug('strict violation')
|
86 |
+
throw createStrictSyntaxError(body, first)
|
87 |
+
}
|
88 |
+
}
|
89 |
+
|
90 |
+
try {
|
91 |
+
debug('parse json')
|
92 |
+
return JSON.parse(body, reviver)
|
93 |
+
} catch (e) {
|
94 |
+
throw normalizeJsonSyntaxError(e, {
|
95 |
+
message: e.message,
|
96 |
+
stack: e.stack
|
97 |
+
})
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
return function jsonParser (req, res, next) {
|
102 |
+
if (req._body) {
|
103 |
+
debug('body already parsed')
|
104 |
+
next()
|
105 |
+
return
|
106 |
+
}
|
107 |
+
|
108 |
+
req.body = req.body || {}
|
109 |
+
|
110 |
+
// skip requests without bodies
|
111 |
+
if (!typeis.hasBody(req)) {
|
112 |
+
debug('skip empty body')
|
113 |
+
next()
|
114 |
+
return
|
115 |
+
}
|
116 |
+
|
117 |
+
debug('content-type %j', req.headers['content-type'])
|
118 |
+
|
119 |
+
// determine if request should be parsed
|
120 |
+
if (!shouldParse(req)) {
|
121 |
+
debug('skip parsing')
|
122 |
+
next()
|
123 |
+
return
|
124 |
+
}
|
125 |
+
|
126 |
+
// assert charset per RFC 7159 sec 8.1
|
127 |
+
var charset = getCharset(req) || 'utf-8'
|
128 |
+
if (charset.slice(0, 4) !== 'utf-') {
|
129 |
+
debug('invalid charset')
|
130 |
+
next(createError(415, 'unsupported charset "' + charset.toUpperCase() + '"', {
|
131 |
+
charset: charset,
|
132 |
+
type: 'charset.unsupported'
|
133 |
+
}))
|
134 |
+
return
|
135 |
+
}
|
136 |
+
|
137 |
+
// read
|
138 |
+
read(req, res, next, parse, debug, {
|
139 |
+
encoding: charset,
|
140 |
+
inflate: inflate,
|
141 |
+
limit: limit,
|
142 |
+
verify: verify
|
143 |
+
})
|
144 |
+
}
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Create strict violation syntax error matching native error.
|
149 |
+
*
|
150 |
+
* @param {string} str
|
151 |
+
* @param {string} char
|
152 |
+
* @return {Error}
|
153 |
+
* @private
|
154 |
+
*/
|
155 |
+
|
156 |
+
function createStrictSyntaxError (str, char) {
|
157 |
+
var index = str.indexOf(char)
|
158 |
+
var partial = ''
|
159 |
+
|
160 |
+
if (index !== -1) {
|
161 |
+
partial = str.substring(0, index) + JSON_SYNTAX_CHAR
|
162 |
+
|
163 |
+
for (var i = index + 1; i < str.length; i++) {
|
164 |
+
partial += JSON_SYNTAX_CHAR
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
try {
|
169 |
+
JSON.parse(partial); /* istanbul ignore next */ throw new SyntaxError('strict violation')
|
170 |
+
} catch (e) {
|
171 |
+
return normalizeJsonSyntaxError(e, {
|
172 |
+
message: e.message.replace(JSON_SYNTAX_REGEXP, function (placeholder) {
|
173 |
+
return str.substring(index, index + placeholder.length)
|
174 |
+
}),
|
175 |
+
stack: e.stack
|
176 |
+
})
|
177 |
+
}
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Get the first non-whitespace character in a string.
|
182 |
+
*
|
183 |
+
* @param {string} str
|
184 |
+
* @return {function}
|
185 |
+
* @private
|
186 |
+
*/
|
187 |
+
|
188 |
+
function firstchar (str) {
|
189 |
+
var match = FIRST_CHAR_REGEXP.exec(str)
|
190 |
+
|
191 |
+
return match
|
192 |
+
? match[1]
|
193 |
+
: undefined
|
194 |
+
}
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Get the charset of a request.
|
198 |
+
*
|
199 |
+
* @param {object} req
|
200 |
+
* @api private
|
201 |
+
*/
|
202 |
+
|
203 |
+
function getCharset (req) {
|
204 |
+
try {
|
205 |
+
return (contentType.parse(req).parameters.charset || '').toLowerCase()
|
206 |
+
} catch (e) {
|
207 |
+
return undefined
|
208 |
+
}
|
209 |
+
}
|
210 |
+
|
211 |
+
/**
|
212 |
+
* Normalize a SyntaxError for JSON.parse.
|
213 |
+
*
|
214 |
+
* @param {SyntaxError} error
|
215 |
+
* @param {object} obj
|
216 |
+
* @return {SyntaxError}
|
217 |
+
*/
|
218 |
+
|
219 |
+
function normalizeJsonSyntaxError (error, obj) {
|
220 |
+
var keys = Object.getOwnPropertyNames(error)
|
221 |
+
|
222 |
+
for (var i = 0; i < keys.length; i++) {
|
223 |
+
var key = keys[i]
|
224 |
+
if (key !== 'stack' && key !== 'message') {
|
225 |
+
delete error[key]
|
226 |
+
}
|
227 |
+
}
|
228 |
+
|
229 |
+
// replace stack before message for Node.js 0.10 and below
|
230 |
+
error.stack = obj.stack.replace(error.message, obj.message)
|
231 |
+
error.message = obj.message
|
232 |
+
|
233 |
+
return error
|
234 |
+
}
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Get the simple type checker.
|
238 |
+
*
|
239 |
+
* @param {string} type
|
240 |
+
* @return {function}
|
241 |
+
*/
|
242 |
+
|
243 |
+
function typeChecker (type) {
|
244 |
+
return function checkType (req) {
|
245 |
+
return Boolean(typeis(req, type))
|
246 |
+
}
|
247 |
+
}
|
node_modules/body-parser/lib/types/raw.js
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bytes = require('bytes')
|
14 |
+
var debug = require('debug')('body-parser:raw')
|
15 |
+
var read = require('../read')
|
16 |
+
var typeis = require('type-is')
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Module exports.
|
20 |
+
*/
|
21 |
+
|
22 |
+
module.exports = raw
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Create a middleware to parse raw bodies.
|
26 |
+
*
|
27 |
+
* @param {object} [options]
|
28 |
+
* @return {function}
|
29 |
+
* @api public
|
30 |
+
*/
|
31 |
+
|
32 |
+
function raw (options) {
|
33 |
+
var opts = options || {}
|
34 |
+
|
35 |
+
var inflate = opts.inflate !== false
|
36 |
+
var limit = typeof opts.limit !== 'number'
|
37 |
+
? bytes.parse(opts.limit || '100kb')
|
38 |
+
: opts.limit
|
39 |
+
var type = opts.type || 'application/octet-stream'
|
40 |
+
var verify = opts.verify || false
|
41 |
+
|
42 |
+
if (verify !== false && typeof verify !== 'function') {
|
43 |
+
throw new TypeError('option verify must be function')
|
44 |
+
}
|
45 |
+
|
46 |
+
// create the appropriate type checking function
|
47 |
+
var shouldParse = typeof type !== 'function'
|
48 |
+
? typeChecker(type)
|
49 |
+
: type
|
50 |
+
|
51 |
+
function parse (buf) {
|
52 |
+
return buf
|
53 |
+
}
|
54 |
+
|
55 |
+
return function rawParser (req, res, next) {
|
56 |
+
if (req._body) {
|
57 |
+
debug('body already parsed')
|
58 |
+
next()
|
59 |
+
return
|
60 |
+
}
|
61 |
+
|
62 |
+
req.body = req.body || {}
|
63 |
+
|
64 |
+
// skip requests without bodies
|
65 |
+
if (!typeis.hasBody(req)) {
|
66 |
+
debug('skip empty body')
|
67 |
+
next()
|
68 |
+
return
|
69 |
+
}
|
70 |
+
|
71 |
+
debug('content-type %j', req.headers['content-type'])
|
72 |
+
|
73 |
+
// determine if request should be parsed
|
74 |
+
if (!shouldParse(req)) {
|
75 |
+
debug('skip parsing')
|
76 |
+
next()
|
77 |
+
return
|
78 |
+
}
|
79 |
+
|
80 |
+
// read
|
81 |
+
read(req, res, next, parse, debug, {
|
82 |
+
encoding: null,
|
83 |
+
inflate: inflate,
|
84 |
+
limit: limit,
|
85 |
+
verify: verify
|
86 |
+
})
|
87 |
+
}
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Get the simple type checker.
|
92 |
+
*
|
93 |
+
* @param {string} type
|
94 |
+
* @return {function}
|
95 |
+
*/
|
96 |
+
|
97 |
+
function typeChecker (type) {
|
98 |
+
return function checkType (req) {
|
99 |
+
return Boolean(typeis(req, type))
|
100 |
+
}
|
101 |
+
}
|
node_modules/body-parser/lib/types/text.js
ADDED
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bytes = require('bytes')
|
14 |
+
var contentType = require('content-type')
|
15 |
+
var debug = require('debug')('body-parser:text')
|
16 |
+
var read = require('../read')
|
17 |
+
var typeis = require('type-is')
|
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 opts = options || {}
|
35 |
+
|
36 |
+
var defaultCharset = opts.defaultCharset || 'utf-8'
|
37 |
+
var inflate = opts.inflate !== false
|
38 |
+
var limit = typeof opts.limit !== 'number'
|
39 |
+
? bytes.parse(opts.limit || '100kb')
|
40 |
+
: opts.limit
|
41 |
+
var type = opts.type || 'text/plain'
|
42 |
+
var verify = opts.verify || false
|
43 |
+
|
44 |
+
if (verify !== false && typeof verify !== 'function') {
|
45 |
+
throw new TypeError('option verify must be function')
|
46 |
+
}
|
47 |
+
|
48 |
+
// create the appropriate type checking function
|
49 |
+
var shouldParse = typeof type !== 'function'
|
50 |
+
? typeChecker(type)
|
51 |
+
: type
|
52 |
+
|
53 |
+
function parse (buf) {
|
54 |
+
return buf
|
55 |
+
}
|
56 |
+
|
57 |
+
return function textParser (req, res, next) {
|
58 |
+
if (req._body) {
|
59 |
+
debug('body already parsed')
|
60 |
+
next()
|
61 |
+
return
|
62 |
+
}
|
63 |
+
|
64 |
+
req.body = req.body || {}
|
65 |
+
|
66 |
+
// skip requests without bodies
|
67 |
+
if (!typeis.hasBody(req)) {
|
68 |
+
debug('skip empty body')
|
69 |
+
next()
|
70 |
+
return
|
71 |
+
}
|
72 |
+
|
73 |
+
debug('content-type %j', req.headers['content-type'])
|
74 |
+
|
75 |
+
// determine if request should be parsed
|
76 |
+
if (!shouldParse(req)) {
|
77 |
+
debug('skip parsing')
|
78 |
+
next()
|
79 |
+
return
|
80 |
+
}
|
81 |
+
|
82 |
+
// get charset
|
83 |
+
var charset = getCharset(req) || defaultCharset
|
84 |
+
|
85 |
+
// read
|
86 |
+
read(req, res, next, parse, debug, {
|
87 |
+
encoding: charset,
|
88 |
+
inflate: inflate,
|
89 |
+
limit: limit,
|
90 |
+
verify: verify
|
91 |
+
})
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Get the charset of a request.
|
97 |
+
*
|
98 |
+
* @param {object} req
|
99 |
+
* @api private
|
100 |
+
*/
|
101 |
+
|
102 |
+
function getCharset (req) {
|
103 |
+
try {
|
104 |
+
return (contentType.parse(req).parameters.charset || '').toLowerCase()
|
105 |
+
} catch (e) {
|
106 |
+
return undefined
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Get the simple type checker.
|
112 |
+
*
|
113 |
+
* @param {string} type
|
114 |
+
* @return {function}
|
115 |
+
*/
|
116 |
+
|
117 |
+
function typeChecker (type) {
|
118 |
+
return function checkType (req) {
|
119 |
+
return Boolean(typeis(req, type))
|
120 |
+
}
|
121 |
+
}
|
node_modules/body-parser/lib/types/urlencoded.js
ADDED
@@ -0,0 +1,307 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 bytes = require('bytes')
|
16 |
+
var contentType = require('content-type')
|
17 |
+
var createError = require('http-errors')
|
18 |
+
var debug = require('debug')('body-parser:urlencoded')
|
19 |
+
var deprecate = require('depd')('body-parser')
|
20 |
+
var read = require('../read')
|
21 |
+
var typeis = require('type-is')
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Module exports.
|
25 |
+
*/
|
26 |
+
|
27 |
+
module.exports = urlencoded
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Cache of parser modules.
|
31 |
+
*/
|
32 |
+
|
33 |
+
var parsers = Object.create(null)
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Create a middleware to parse urlencoded bodies.
|
37 |
+
*
|
38 |
+
* @param {object} [options]
|
39 |
+
* @return {function}
|
40 |
+
* @public
|
41 |
+
*/
|
42 |
+
|
43 |
+
function urlencoded (options) {
|
44 |
+
var opts = options || {}
|
45 |
+
|
46 |
+
// notice because option default will flip in next major
|
47 |
+
if (opts.extended === undefined) {
|
48 |
+
deprecate('undefined extended: provide extended option')
|
49 |
+
}
|
50 |
+
|
51 |
+
var extended = opts.extended !== false
|
52 |
+
var inflate = opts.inflate !== false
|
53 |
+
var limit = typeof opts.limit !== 'number'
|
54 |
+
? bytes.parse(opts.limit || '100kb')
|
55 |
+
: opts.limit
|
56 |
+
var type = opts.type || 'application/x-www-form-urlencoded'
|
57 |
+
var verify = opts.verify || false
|
58 |
+
var depth = typeof opts.depth !== 'number'
|
59 |
+
? Number(opts.depth || 32)
|
60 |
+
: opts.depth
|
61 |
+
|
62 |
+
if (verify !== false && typeof verify !== 'function') {
|
63 |
+
throw new TypeError('option verify must be function')
|
64 |
+
}
|
65 |
+
|
66 |
+
// create the appropriate query parser
|
67 |
+
var queryparse = extended
|
68 |
+
? extendedparser(opts)
|
69 |
+
: simpleparser(opts)
|
70 |
+
|
71 |
+
// create the appropriate type checking function
|
72 |
+
var shouldParse = typeof type !== 'function'
|
73 |
+
? typeChecker(type)
|
74 |
+
: type
|
75 |
+
|
76 |
+
function parse (body) {
|
77 |
+
return body.length
|
78 |
+
? queryparse(body)
|
79 |
+
: {}
|
80 |
+
}
|
81 |
+
|
82 |
+
return function urlencodedParser (req, res, next) {
|
83 |
+
if (req._body) {
|
84 |
+
debug('body already parsed')
|
85 |
+
next()
|
86 |
+
return
|
87 |
+
}
|
88 |
+
|
89 |
+
req.body = req.body || {}
|
90 |
+
|
91 |
+
// skip requests without bodies
|
92 |
+
if (!typeis.hasBody(req)) {
|
93 |
+
debug('skip empty body')
|
94 |
+
next()
|
95 |
+
return
|
96 |
+
}
|
97 |
+
|
98 |
+
debug('content-type %j', req.headers['content-type'])
|
99 |
+
|
100 |
+
// determine if request should be parsed
|
101 |
+
if (!shouldParse(req)) {
|
102 |
+
debug('skip parsing')
|
103 |
+
next()
|
104 |
+
return
|
105 |
+
}
|
106 |
+
|
107 |
+
// assert charset
|
108 |
+
var charset = getCharset(req) || 'utf-8'
|
109 |
+
if (charset !== 'utf-8') {
|
110 |
+
debug('invalid charset')
|
111 |
+
next(createError(415, 'unsupported charset "' + charset.toUpperCase() + '"', {
|
112 |
+
charset: charset,
|
113 |
+
type: 'charset.unsupported'
|
114 |
+
}))
|
115 |
+
return
|
116 |
+
}
|
117 |
+
|
118 |
+
// read
|
119 |
+
read(req, res, next, parse, debug, {
|
120 |
+
debug: debug,
|
121 |
+
encoding: charset,
|
122 |
+
inflate: inflate,
|
123 |
+
limit: limit,
|
124 |
+
verify: verify,
|
125 |
+
depth: depth
|
126 |
+
})
|
127 |
+
}
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Get the extended query parser.
|
132 |
+
*
|
133 |
+
* @param {object} options
|
134 |
+
*/
|
135 |
+
|
136 |
+
function extendedparser (options) {
|
137 |
+
var parameterLimit = options.parameterLimit !== undefined
|
138 |
+
? options.parameterLimit
|
139 |
+
: 1000
|
140 |
+
|
141 |
+
var depth = typeof options.depth !== 'number'
|
142 |
+
? Number(options.depth || 32)
|
143 |
+
: options.depth
|
144 |
+
var parse = parser('qs')
|
145 |
+
|
146 |
+
if (isNaN(parameterLimit) || parameterLimit < 1) {
|
147 |
+
throw new TypeError('option parameterLimit must be a positive number')
|
148 |
+
}
|
149 |
+
|
150 |
+
if (isNaN(depth) || depth < 0) {
|
151 |
+
throw new TypeError('option depth must be a zero or a positive number')
|
152 |
+
}
|
153 |
+
|
154 |
+
if (isFinite(parameterLimit)) {
|
155 |
+
parameterLimit = parameterLimit | 0
|
156 |
+
}
|
157 |
+
|
158 |
+
return function queryparse (body) {
|
159 |
+
var paramCount = parameterCount(body, parameterLimit)
|
160 |
+
|
161 |
+
if (paramCount === undefined) {
|
162 |
+
debug('too many parameters')
|
163 |
+
throw createError(413, 'too many parameters', {
|
164 |
+
type: 'parameters.too.many'
|
165 |
+
})
|
166 |
+
}
|
167 |
+
|
168 |
+
var arrayLimit = Math.max(100, paramCount)
|
169 |
+
|
170 |
+
debug('parse extended urlencoding')
|
171 |
+
try {
|
172 |
+
return parse(body, {
|
173 |
+
allowPrototypes: true,
|
174 |
+
arrayLimit: arrayLimit,
|
175 |
+
depth: depth,
|
176 |
+
strictDepth: true,
|
177 |
+
parameterLimit: parameterLimit
|
178 |
+
})
|
179 |
+
} catch (err) {
|
180 |
+
if (err instanceof RangeError) {
|
181 |
+
throw createError(400, 'The input exceeded the depth', {
|
182 |
+
type: 'querystring.parse.rangeError'
|
183 |
+
})
|
184 |
+
} else {
|
185 |
+
throw err
|
186 |
+
}
|
187 |
+
}
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Get the charset of a request.
|
193 |
+
*
|
194 |
+
* @param {object} req
|
195 |
+
* @api private
|
196 |
+
*/
|
197 |
+
|
198 |
+
function getCharset (req) {
|
199 |
+
try {
|
200 |
+
return (contentType.parse(req).parameters.charset || '').toLowerCase()
|
201 |
+
} catch (e) {
|
202 |
+
return undefined
|
203 |
+
}
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Count the number of parameters, stopping once limit reached
|
208 |
+
*
|
209 |
+
* @param {string} body
|
210 |
+
* @param {number} limit
|
211 |
+
* @api private
|
212 |
+
*/
|
213 |
+
|
214 |
+
function parameterCount (body, limit) {
|
215 |
+
var count = 0
|
216 |
+
var index = 0
|
217 |
+
|
218 |
+
while ((index = body.indexOf('&', index)) !== -1) {
|
219 |
+
count++
|
220 |
+
index++
|
221 |
+
|
222 |
+
if (count === limit) {
|
223 |
+
return undefined
|
224 |
+
}
|
225 |
+
}
|
226 |
+
|
227 |
+
return count
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Get parser for module name dynamically.
|
232 |
+
*
|
233 |
+
* @param {string} name
|
234 |
+
* @return {function}
|
235 |
+
* @api private
|
236 |
+
*/
|
237 |
+
|
238 |
+
function parser (name) {
|
239 |
+
var mod = parsers[name]
|
240 |
+
|
241 |
+
if (mod !== undefined) {
|
242 |
+
return mod.parse
|
243 |
+
}
|
244 |
+
|
245 |
+
// this uses a switch for static require analysis
|
246 |
+
switch (name) {
|
247 |
+
case 'qs':
|
248 |
+
mod = require('qs')
|
249 |
+
break
|
250 |
+
case 'querystring':
|
251 |
+
mod = require('querystring')
|
252 |
+
break
|
253 |
+
}
|
254 |
+
|
255 |
+
// store to prevent invoking require()
|
256 |
+
parsers[name] = mod
|
257 |
+
|
258 |
+
return mod.parse
|
259 |
+
}
|
260 |
+
|
261 |
+
/**
|
262 |
+
* Get the simple query parser.
|
263 |
+
*
|
264 |
+
* @param {object} options
|
265 |
+
*/
|
266 |
+
|
267 |
+
function simpleparser (options) {
|
268 |
+
var parameterLimit = options.parameterLimit !== undefined
|
269 |
+
? options.parameterLimit
|
270 |
+
: 1000
|
271 |
+
var parse = parser('querystring')
|
272 |
+
|
273 |
+
if (isNaN(parameterLimit) || parameterLimit < 1) {
|
274 |
+
throw new TypeError('option parameterLimit must be a positive number')
|
275 |
+
}
|
276 |
+
|
277 |
+
if (isFinite(parameterLimit)) {
|
278 |
+
parameterLimit = parameterLimit | 0
|
279 |
+
}
|
280 |
+
|
281 |
+
return function queryparse (body) {
|
282 |
+
var paramCount = parameterCount(body, parameterLimit)
|
283 |
+
|
284 |
+
if (paramCount === undefined) {
|
285 |
+
debug('too many parameters')
|
286 |
+
throw createError(413, 'too many parameters', {
|
287 |
+
type: 'parameters.too.many'
|
288 |
+
})
|
289 |
+
}
|
290 |
+
|
291 |
+
debug('parse urlencoding')
|
292 |
+
return parse(body, undefined, undefined, { maxKeys: parameterLimit })
|
293 |
+
}
|
294 |
+
}
|
295 |
+
|
296 |
+
/**
|
297 |
+
* Get the simple type checker.
|
298 |
+
*
|
299 |
+
* @param {string} type
|
300 |
+
* @return {function}
|
301 |
+
*/
|
302 |
+
|
303 |
+
function typeChecker (type) {
|
304 |
+
return function checkType (req) {
|
305 |
+
return Boolean(typeis(req, type))
|
306 |
+
}
|
307 |
+
}
|
node_modules/body-parser/package.json
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "body-parser",
|
3 |
+
"description": "Node.js body parsing middleware",
|
4 |
+
"version": "1.20.3",
|
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": "2.6.9",
|
15 |
+
"depd": "2.0.0",
|
16 |
+
"destroy": "1.2.0",
|
17 |
+
"http-errors": "2.0.0",
|
18 |
+
"iconv-lite": "0.4.24",
|
19 |
+
"on-finished": "2.4.1",
|
20 |
+
"qs": "6.13.0",
|
21 |
+
"raw-body": "2.5.2",
|
22 |
+
"type-is": "~1.6.18",
|
23 |
+
"unpipe": "1.0.0"
|
24 |
+
},
|
25 |
+
"devDependencies": {
|
26 |
+
"eslint": "8.34.0",
|
27 |
+
"eslint-config-standard": "14.1.1",
|
28 |
+
"eslint-plugin-import": "2.27.5",
|
29 |
+
"eslint-plugin-markdown": "3.0.0",
|
30 |
+
"eslint-plugin-node": "11.1.0",
|
31 |
+
"eslint-plugin-promise": "6.1.1",
|
32 |
+
"eslint-plugin-standard": "4.1.0",
|
33 |
+
"methods": "1.1.2",
|
34 |
+
"mocha": "10.2.0",
|
35 |
+
"nyc": "15.1.0",
|
36 |
+
"safe-buffer": "5.2.1",
|
37 |
+
"supertest": "6.3.3"
|
38 |
+
},
|
39 |
+
"files": [
|
40 |
+
"lib/",
|
41 |
+
"LICENSE",
|
42 |
+
"HISTORY.md",
|
43 |
+
"SECURITY.md",
|
44 |
+
"index.js"
|
45 |
+
],
|
46 |
+
"engines": {
|
47 |
+
"node": ">= 0.8",
|
48 |
+
"npm": "1.2.8000 || >= 1.4.16"
|
49 |
+
},
|
50 |
+
"scripts": {
|
51 |
+
"lint": "eslint .",
|
52 |
+
"test": "mocha --require test/support/env --reporter spec --check-leaks --bail test/",
|
53 |
+
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
|
54 |
+
"test-cov": "nyc --reporter=html --reporter=text npm test"
|
55 |
+
}
|
56 |
+
}
|
node_modules/bundle-name/index.js
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import {runAppleScript} from 'run-applescript';
|
2 |
+
|
3 |
+
export default async function bundleName(bundleId) {
|
4 |
+
return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string\ntell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
|
5 |
+
}
|
node_modules/bundle-name/license
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
MIT License
|
2 |
+
|
3 |
+
Copyright (c) Sindre Sorhus <[email protected]> (https://sindresorhus.com)
|
4 |
+
|
5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6 |
+
|
7 |
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8 |
+
|
9 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
node_modules/bundle-name/package.json
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "bundle-name",
|
3 |
+
"version": "4.1.0",
|
4 |
+
"description": "Get bundle name from a bundle identifier (macOS): `com.apple.Safari` → `Safari`",
|
5 |
+
"license": "MIT",
|
6 |
+
"repository": "sindresorhus/bundle-name",
|
7 |
+
"funding": "https://github.com/sponsors/sindresorhus",
|
8 |
+
"author": {
|
9 |
+
"name": "Sindre Sorhus",
|
10 |
+
"email": "[email protected]",
|
11 |
+
"url": "https://sindresorhus.com"
|
12 |
+
},
|
13 |
+
"type": "module",
|
14 |
+
"exports": "./index.js",
|
15 |
+
"sideEffects": false,
|
16 |
+
"engines": {
|
17 |
+
"node": ">=18"
|
18 |
+
},
|
19 |
+
"scripts": {
|
20 |
+
"test": "xo && ava"
|
21 |
+
},
|
22 |
+
"files": [
|
23 |
+
"index.js"
|
24 |
+
],
|
25 |
+
"keywords": [
|
26 |
+
"macos",
|
27 |
+
"plist",
|
28 |
+
"applescript",
|
29 |
+
"bundle",
|
30 |
+
"bundleid",
|
31 |
+
"bundlename",
|
32 |
+
"id",
|
33 |
+
"identifier",
|
34 |
+
"CFBundleName",
|
35 |
+
"CFBundleIdentifier",
|
36 |
+
"uti"
|
37 |
+
],
|
38 |
+
"dependencies": {
|
39 |
+
"run-applescript": "^7.0.0"
|
40 |
+
},
|
41 |
+
"devDependencies": {
|
42 |
+
"ava": "^6.0.1",
|
43 |
+
"xo": "^0.56.0"
|
44 |
+
}
|
45 |
+
}
|
node_modules/bundle-name/readme.md
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# bundle-name
|
2 |
+
|
3 |
+
> Get [bundle name](https://developer.apple.com/library/Mac/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/plist/info/CFBundleName) from a [bundle identifier](https://developer.apple.com/library/Mac/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/plist/info/CFBundleIdentifier) (macOS): `com.apple.Safari` → `Safari`
|
4 |
+
|
5 |
+
## Install
|
6 |
+
|
7 |
+
```sh
|
8 |
+
npm install bundle-name
|
9 |
+
```
|
10 |
+
|
11 |
+
## Usage
|
12 |
+
|
13 |
+
```js
|
14 |
+
import bundleName from 'bundle-name';
|
15 |
+
|
16 |
+
console.log(await bundleName('com.apple.Safari'));
|
17 |
+
//=> 'Safari'
|
18 |
+
```
|
19 |
+
|
20 |
+
## Related
|
21 |
+
|
22 |
+
- [bundle-name-cli](https://github.com/sindresorhus/bundle-name-cli) - CLI for this module
|
23 |
+
- [bundle-id](https://github.com/sindresorhus/bundle-id) - Get bundle identifier from a bundle name
|
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 |
+
};
|