Compare commits
93 commits
v1.0.0
...
developmen
Author | SHA1 | Date | |
---|---|---|---|
bbad13f570 | |||
628855b5d9 | |||
b61a166649 | |||
1d62a62f33 | |||
f5265a4e1d | |||
1ddfc8c769 | |||
0189cc2157 | |||
43d4514bc6 | |||
2cf73e1cb2 | |||
6c4094c27c | |||
165b39ded7 | |||
deb43031a3 | |||
f02bb6b457 | |||
174ab60173 | |||
ff7bf73e93 | |||
9f82926037 | |||
173c444c62 | |||
05d0522a04 | |||
e403d380a8 | |||
0754a99bbb | |||
9c6d71fbc7 | |||
69f5b0c68b | |||
73063edd3f | |||
ce828cd5ef | |||
85eb8470f5 | |||
33d4fd94f2 | |||
edf15bbf47 | |||
131258aa86 | |||
36cdaea265 | |||
61dec47fcb | |||
c926227245 | |||
bb8c2f06fd | |||
69bd8bef0f | |||
acdeb23c92 | |||
3c6d238ab8 | |||
0676dd5698 | |||
fb7a448c29 | |||
7562a377d1 | |||
18df310d77 | |||
fb6972b430 | |||
11c292e072 | |||
86c5e96aef | |||
c5801c4e7a | |||
780d96aa0c | |||
6b59684387 | |||
6291eaa819 | |||
c0f1a3db7e | |||
325f961a99 | |||
88e468525f | |||
0f6dda2a5b | |||
87b66afff9 | |||
a7250ef323 | |||
c8d6cc124d | |||
21cbfb31c9 | |||
1e04e6a295 | |||
5b3d20a8a5 | |||
9aeeb95994 | |||
3d9fd745cd | |||
8cb15dd30a | |||
d7d74bf32b | |||
94c21a6146 | |||
365d40dae5 | |||
005b4f088d | |||
42a551bd74 | |||
c99a4bb2d2 | |||
b27a419c2f | |||
1f8378c8cf | |||
acf791542a | |||
91b633a6de | |||
1fd9eb50b2 | |||
1c58fd15ac | |||
34787649a1 | |||
285bd28139 | |||
0fab8886bb | |||
a20d3a0b53 | |||
8e3eab081d | |||
7763179c82 | |||
fba9f348d5 | |||
6af865440b | |||
0e0280f3ee | |||
d49e08e632 | |||
09a59c2c98 | |||
5a654571f7 | |||
a40da6c09d | |||
cde7ebb867 | |||
5fffb0b81b | |||
c4469de718 | |||
cf8bd4014b | |||
2fca0ec7e2 | |||
8a419a026e | |||
4b4f35b546 | |||
![]() |
9ffa8c4cbc | ||
315ebb7a42 |
813 changed files with 86796 additions and 129 deletions
7
.github/workflows/ci.yaml
vendored
7
.github/workflows/ci.yaml
vendored
|
@ -1,6 +1,5 @@
|
|||
name: ci
|
||||
|
||||
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
|
@ -32,9 +31,6 @@ jobs:
|
|||
registry: ${{ steps.repository.outputs.registry }}
|
||||
username: ${{ secrets.PACKAGES_USER }}
|
||||
password: ${{ secrets.PACKAGES_TOKEN }}
|
||||
-
|
||||
name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
@ -48,5 +44,4 @@ jobs:
|
|||
push: true
|
||||
allow: network.host
|
||||
network: host
|
||||
platforms: linux/amd64
|
||||
tags: ${{ steps.docker.outputs.tags }}
|
||||
tags: ${{ steps.docker.outputs.tags }}
|
||||
|
|
32
Dockerfile
32
Dockerfile
|
@ -4,27 +4,39 @@ FROM forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/node:20.18.1 AS build
|
|||
WORKDIR /app
|
||||
|
||||
COPY package*.json ./
|
||||
COPY . .
|
||||
COPY tsconfig.json ./
|
||||
COPY tsconfig.backend.json ./
|
||||
COPY . .
|
||||
|
||||
#RUN npm install
|
||||
RUN npm install cors
|
||||
RUN npm install -g npm@11.2.0
|
||||
RUN npx tsc # TypeScript Code kompilieren
|
||||
RUN npm install
|
||||
|
||||
RUN npx tsc -p tsconfig.backend.json
|
||||
RUN npx tsc -p tsconfig.frontend.json
|
||||
|
||||
# 2. Rust build-Stage
|
||||
FROM forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/rust:1.74.0 AS rust-build
|
||||
RUN cargo install iching
|
||||
|
||||
# 3. Final node.js runtime-Stage
|
||||
# 3. Final runtime
|
||||
FROM forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/node:20.18.1
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# 4. Copy previous builds
|
||||
COPY --from=build /app .
|
||||
# Copy node_modules and all generated data
|
||||
COPY --from=build /app/node_modules ./node_modules
|
||||
COPY --from=build /app/dist ./dist
|
||||
COPY --from=build /app/frontend/index.html ./dist/frontend/
|
||||
COPY --from=build /app/package.json ./dist/backend/
|
||||
|
||||
# Copy iching library
|
||||
COPY --from=rust-build /usr/local/cargo/bin/iching /usr/local/bin/iching
|
||||
|
||||
# 5. Run app
|
||||
CMD ["npx", "ts-node", "broker.ts"]
|
||||
# Frontend: rename from .js to .mjs
|
||||
RUN find dist/frontend -name "*.js" -exec bash -c 'mv "$0" "${0%.js}.mjs"' {} \;
|
||||
|
||||
#run indefinitely to avoid CrashLoopBackOff
|
||||
#CMD exec /bin/bash -c "trap : TERM INT; sleep infinity & wait"
|
||||
COPY start.sh ./start.sh
|
||||
RUN chmod +x ./start.sh
|
||||
|
||||
CMD ["./start.sh"]
|
49
README.md
49
README.md
|
@ -15,18 +15,51 @@ This app uses the I-Ching library app https://github.com/Velfi/i-ching.git.
|
|||
Properties of the app can be configured in the file config.json. It is possible to configure the mail host and port.
|
||||
It is also possible to configure the intervall of days between the sending of horoscopes and the time of sending. The default is to send one email every seven days at 8 am.
|
||||
|
||||
## First Start
|
||||
The app can be deployed by running:
|
||||
|
||||
```bash
|
||||
$ kubectl apply -f deployment.yaml
|
||||
```
|
||||
|
||||
This will start the deployment of the app in the pod, the service and an ingress for the HTTP frontend server and an ingress for the backend server.
|
||||
When a pod with the app is initally started, one email will be sent to the configured receiver.
|
||||
|
||||
## Backend Server
|
||||
|
||||
The backend server is running inside the pod on the address http://localhost:8090/command. If a POST is sent to this address, the server will run the main logic of this app:
|
||||
An E-Mail with an I-Ching horoscope (provided by the library app) will be sent to the configured email address.
|
||||
|
||||
The backend server can be tested from inside the pod by calling 'curl -X POST http://localhost:8090/iching/api/command' from the console.
|
||||
The backend server has a separate ingress, so API requests can get forwarded to the backend. Also the backend does not need 'rewrite target'.
|
||||
|
||||
## HTTP Server
|
||||
|
||||
The frontend server is running inside the pod on the address http://localhost:8080/iching. It provides an HTML homepage with a button. Upon pressing the button, the backend server will be called (to send an E-Mail).
|
||||
The frontend server has a separate ingress from the backend server, since the frontend server needs the 'rewrite target' annotation: So the Frontend is not running in the root folder but using the sub-path 'iching'.
|
||||
|
||||
## Testing
|
||||
The Jest unit tests can be run with
|
||||
|
||||
```bash
|
||||
$ npm test
|
||||
```
|
||||
```
|
||||
|
||||
## Running the App
|
||||
|
||||
### Locally
|
||||
The app can be deployed locally by running:
|
||||
The app can be deployed by running:
|
||||
```bash
|
||||
$ ./start-local.sh
|
||||
```
|
||||
Der HTTP-Server can be access in a browser with the address http://localhost:8080/.
|
||||
|
||||
### Locally with Docker
|
||||
The app can be deployed by running:
|
||||
```bash
|
||||
$ docker run -e DEPLOY_MODE=docker -p 8080:8080 -p 8090:8090 --rm my-typescript-app
|
||||
```
|
||||
Der HTTP-Server can be access in a browser with the address http://localhost:8080/.
|
||||
|
||||
### In Kubernetes
|
||||
|
||||
The app can be deployed by running:
|
||||
|
||||
```bash
|
||||
$ kubectl apply -f deployment.yaml
|
||||
```
|
||||
Der HTTP-Server can be access in a browser with the address https://192-168-197-2.c-one-infra.de/iching/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { html } from "./broker";
|
||||
import { test, beforeAll, afterAll } from "@jest/globals";
|
||||
//import { test } from "@jest/globals";
|
||||
|
||||
jest.useFakeTimers();
|
||||
|
|
@ -1,10 +1,11 @@
|
|||
import { exec } from 'child_process';
|
||||
import * as fs from 'fs';
|
||||
import * as nodemailer from 'nodemailer';
|
||||
import { fileURLToPath } from 'url';
|
||||
import * as path from 'path';
|
||||
|
||||
// Config for scheduling the next time the main process (sending of horoscope) is run
|
||||
interface Config {
|
||||
daysInterval: number;
|
||||
timeOfDay: string;
|
||||
emailReceiver: string;
|
||||
mailHost: string;
|
||||
mailPort: number;
|
||||
|
@ -19,13 +20,11 @@ interface Node {
|
|||
|
||||
var config : Config;
|
||||
|
||||
const nodemailer = require('nodemailer');
|
||||
|
||||
function executeCommand(): void {
|
||||
export function executeCommand(): void {
|
||||
|
||||
exec('iching divine', (error, stdout, stderr) => {
|
||||
|
||||
console.log(`Begin`);
|
||||
console.log(`I-Ching-Broker: \'iching divine\' called`);
|
||||
|
||||
if (error) {
|
||||
console.error(`Error: ${error.message}`);
|
||||
|
@ -40,17 +39,10 @@ function executeCommand(): void {
|
|||
//Load config once
|
||||
if (config == undefined) {
|
||||
config = loadConfig();
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`Send E-Mail`);
|
||||
console.log(`Horoscope received; sending E-Mail next`);
|
||||
sendEmail(stdout);
|
||||
|
||||
// Calculate next execution time
|
||||
const nextRunDate = calculateNextRunDate(config.daysInterval, config.timeOfDay);
|
||||
console.log(`Next execution: ${nextRunDate}`);
|
||||
|
||||
// Start Scheduling
|
||||
scheduleNextRun(nextRunDate);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -62,7 +54,12 @@ function loadConfig(): Config {
|
|||
|
||||
console.log(`Load Config`);
|
||||
|
||||
const data = fs.readFileSync('config.json', 'utf-8');
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
const configPath = path.join(__dirname, 'config.json');
|
||||
|
||||
const data = fs.readFileSync(configPath, 'utf-8');
|
||||
|
||||
return JSON.parse(data);
|
||||
}
|
||||
|
||||
|
@ -71,61 +68,25 @@ async function sendEmail(content: string) {
|
|||
|
||||
// Create Transporter
|
||||
const transporter = nodemailer.createTransport({
|
||||
host: config.mailHost,
|
||||
port: config.mailPort,
|
||||
host: config.mailHost, //"mailhog.mailhog.svc.cluster.local", //config.mailHost,
|
||||
port: config.mailPort, //1025, //config.mailPort,
|
||||
secure: false
|
||||
});
|
||||
|
||||
try {
|
||||
const info = await transporter.sendMail({
|
||||
from: '"The Oracle" <the.oracle@holy.mountain>',
|
||||
to: config.emailReceiver,
|
||||
to: config.emailReceiver, //"test@mailhog.local", //config.emailReceiver,
|
||||
subject: "Your Horoscope Is Ready",
|
||||
text: content,
|
||||
html: html(content)
|
||||
});
|
||||
|
||||
console.log("E-Mail sent: ", info.messageId);
|
||||
console.log("E-Mail sent: ", info.messageId + "\n\n");
|
||||
} catch (error) {
|
||||
console.error("Error Sending E-Mail:", error);
|
||||
}
|
||||
}
|
||||
console.error("Error Sending E-Mail:", error + "\n\n");
|
||||
|
||||
//Calculate the time for the next execution of the main process, depending on configuration.
|
||||
//Returns the time of the next process loop.
|
||||
function calculateNextRunDate(daysInterval: number, timeOfDay: string): Date {
|
||||
const currentDate = new Date();
|
||||
|
||||
// Splitte die Uhrzeit in Stunden und Minuten
|
||||
const [hours, minutes] = timeOfDay.split(':').map(Number);
|
||||
|
||||
// Berechne das Datum für die nächste Ausführung
|
||||
currentDate.setHours(hours, minutes, 0, 0); // Setze die Uhrzeit auf Y (z.B. 14:30)
|
||||
|
||||
// Wenn die Uhrzeit bereits vorbei ist, verschiebe das Datum auf den nächsten Tag
|
||||
if (currentDate < new Date()) {
|
||||
currentDate.setDate(currentDate.getDate() + 1); // Setze auf den nächsten Tag
|
||||
}
|
||||
|
||||
// Berechne das Datum für den nächsten Ausführungszeitpunkt unter Berücksichtigung von X Tagen
|
||||
currentDate.setDate(currentDate.getDate() + daysInterval);
|
||||
|
||||
return currentDate;
|
||||
}
|
||||
|
||||
//Schedule the next process loop.
|
||||
function scheduleNextRun(nextRunDate: Date) {
|
||||
const now = new Date();
|
||||
const timeUntilNextRun = nextRunDate.getTime() - now.getTime();
|
||||
|
||||
if (timeUntilNextRun > 0) {
|
||||
setTimeout(() => {
|
||||
console.log('Next iteration of Process was scheduled!');
|
||||
|
||||
//run the main process
|
||||
executeCommand();
|
||||
|
||||
}, timeUntilNextRun);
|
||||
console.log("Failed to send this horoscope: \n", content + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,7 +128,7 @@ function parse(input: string): Node {
|
|||
const changingLines: Node = { type: "ChangingLines"};
|
||||
currentNode.child = changingLines;
|
||||
currentNode = changingLines;
|
||||
currentNode.value = line; // + "<br>"; TODO: try without this <br>
|
||||
currentNode.value = line;
|
||||
} else {
|
||||
currentNode.value = currentNode.value + line + "<br>";
|
||||
}
|
||||
|
@ -180,13 +141,11 @@ function parse(input: string): Node {
|
|||
function render(node: Node): string {
|
||||
|
||||
if (node == undefined) {
|
||||
console.log("Rendering of nodes finished!")
|
||||
console.log("I-Ching-Broker: Rendering of nodes finished!")
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
console.log("Render node" + node.type);
|
||||
|
||||
var outputHTML: string = "";
|
||||
|
||||
switch (node.type) {
|
||||
|
@ -209,7 +168,6 @@ function render(node: Node): string {
|
|||
case "ChangingLines" :
|
||||
const regex = new RegExp("~", "g");
|
||||
node.value = node.value?.replace(regex, "");
|
||||
//outputHTML = "<br><p><div style=\"border: 1px dashed gray; border-radius: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px; width: auto; display: inline-block; color: gray; text-align: center; box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.2);\">" + node.value + "</div></p><br>";
|
||||
outputHTML = "<br><br><p><div style=\"padding-left: 20px; padding-right: 20px; padding-top: 20px; display: inline-block; color: gray; text-align: center;\">" + node.value + "</div></p><br>";
|
||||
outputHTML = outputHTML + render(node.child!);
|
||||
return outputHTML;
|
|
@ -1,6 +1,4 @@
|
|||
{
|
||||
"daysInterval": 7,
|
||||
"timeOfDay": "8:00",
|
||||
"emailReceiver": "test@mailhog.local",
|
||||
"mailHost": "mailhog.mailhog.svc.cluster.local",
|
||||
"mailPort": 1025
|
20
backend/server.ts
Normal file
20
backend/server.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
import express from 'express';
|
||||
import cors from 'cors';
|
||||
import { executeCommand } from './broker.js';
|
||||
|
||||
const app = express();
|
||||
const port = 8090;
|
||||
|
||||
app.use(cors());
|
||||
|
||||
app.post('/iching/api/command', (req, res) => {
|
||||
//TODO no logging from inside this method???
|
||||
console.log(`Backend-Server: receiving POST to /iching/api/command`);
|
||||
|
||||
executeCommand();
|
||||
res.status(200).send('Backend-Server: Broker was called\n');
|
||||
});
|
||||
|
||||
app.listen(port, '0.0.0.0', () => {
|
||||
console.log(`Backend-Server running on http://0.0.0.0:${port}`);
|
||||
});
|
|
@ -1,8 +1,18 @@
|
|||
#env:
|
||||
# - name: DEPLOY_MODE
|
||||
# value: "kubernetes"
|
||||
# - name: BACKEND_PORT
|
||||
# value: "8090"
|
||||
|
||||
#---
|
||||
|
||||
# --- DEPLOYMENT --------------------------------------------
|
||||
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: iching-broker-0-0-1
|
||||
namespace: default
|
||||
namespace: argocd
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
|
@ -13,7 +23,82 @@ spec:
|
|||
app: iching-broker
|
||||
spec:
|
||||
containers:
|
||||
- image: forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/iching-broker:main
|
||||
- image: gitea-192-168-197-2.c-one-infra.de/giteaadmin/iching-broker:development
|
||||
name: iching-broker
|
||||
imagePullPolicy: Always
|
||||
|
||||
---
|
||||
|
||||
# --- SERVICE -----------------------------------------------
|
||||
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: iching-service
|
||||
namespace: argocd
|
||||
spec:
|
||||
selector:
|
||||
app: iching-broker
|
||||
ports:
|
||||
- name: frontend
|
||||
port: 80
|
||||
targetPort: 8080
|
||||
- name: backend
|
||||
port: 81
|
||||
targetPort: 8090
|
||||
|
||||
---
|
||||
|
||||
# --- INGRESS: Frontend -------------------------------------
|
||||
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: iching-frontend-ingress
|
||||
namespace: argocd
|
||||
annotations:
|
||||
nginx.ingress.kubernetes.io/rewrite-target: /$2
|
||||
spec:
|
||||
ingressClassName: nginx
|
||||
rules:
|
||||
- host: 192-168-197-2.c-one-infra.de
|
||||
http:
|
||||
paths:
|
||||
- path: /iching(/|$)(.*)
|
||||
pathType: ImplementationSpecific
|
||||
backend:
|
||||
service:
|
||||
name: iching-service
|
||||
port:
|
||||
number: 80
|
||||
tls:
|
||||
- hosts:
|
||||
- 192-168-197-2.c-one-infra.de
|
||||
secretName: argocd-net-tls
|
||||
|
||||
---
|
||||
|
||||
# --- INGRESS: Backend ---------------------------------------
|
||||
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: iching-backend-ingress
|
||||
namespace: argocd
|
||||
spec:
|
||||
ingressClassName: nginx
|
||||
rules:
|
||||
- host: 192-168-197-2.c-one-infra.de
|
||||
http:
|
||||
paths:
|
||||
- path: /iching/api(/|$)(.*)
|
||||
pathType: ImplementationSpecific
|
||||
backend:
|
||||
service:
|
||||
name: iching-service
|
||||
port:
|
||||
number: 81
|
||||
tls:
|
||||
- hosts:
|
||||
- 192-168-197-2.c-one-infra.de
|
||||
secretName: argocd-net-tls
|
||||
|
|
1
frontend/deploy.js
Normal file
1
frontend/deploy.js
Normal file
|
@ -0,0 +1 @@
|
|||
window.DEPLOY_MODE = "k8s"
|
23
frontend/event.ts
Normal file
23
frontend/event.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
function handleClick(): void {
|
||||
console.log("Der Button wurde geklickt!");
|
||||
|
||||
//const deployMode = (window as { DEPLOY_MODE?: 'docker' | 'k8s' }).DEPLOY_MODE ?? 'k8s';
|
||||
const deployMode = (window as { DEPLOY_MODE?: 'docker' | 'k8s' | 'local' }).DEPLOY_MODE ?? 'k8s';
|
||||
|
||||
const endpoint =
|
||||
deployMode === 'docker' || deployMode === 'local'
|
||||
? 'http://localhost:8090/iching/api/command'
|
||||
: '/iching/api/command';
|
||||
|
||||
console.log(`DEPLOY_MODE=${deployMode}, sende POST an: ${endpoint}`);
|
||||
|
||||
fetch(endpoint, { method: 'POST' })
|
||||
.then(res => res.text())
|
||||
.then(text => console.log("HTTP-Server says:", text))
|
||||
.catch(error => console.error("HTTP-Server - Error:", error));
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
const button = document.getElementById("myButton");
|
||||
button?.addEventListener("click", handleClick);
|
||||
});
|
67
frontend/index.html
Normal file
67
frontend/index.html
Normal file
|
@ -0,0 +1,67 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Your I-Ging Horoscope</title>
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background: linear-gradient(to bottom right, #fdf6e3, #e3f2fd);
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.container {
|
||||
text-align: center;
|
||||
background: white;
|
||||
padding: 2rem;
|
||||
border-radius: 1rem;
|
||||
box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin-bottom: 1rem;
|
||||
color: #3f51b5;
|
||||
}
|
||||
|
||||
#myButton {
|
||||
background-color: #3f51b5;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 0.8rem 1.5rem;
|
||||
font-size: 1.1rem;
|
||||
border-radius: 0.5rem;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
#myButton:hover {
|
||||
background-color: #303f9f;
|
||||
}
|
||||
|
||||
.footer {
|
||||
margin-top: 2rem;
|
||||
font-size: 0.9rem;
|
||||
color: #666;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Do you want to know the future?</h1>
|
||||
<h2> ☝️ Look into the future with your personal I-Ging Horoscope! ☝️</h2>
|
||||
<p>Click on the Button to receive your personal Horoscope. 100% accuracy guaranteed!</p>
|
||||
<button id="myButton">✨ Receive Horoscope ✨</button>
|
||||
<div class="footer">🧘 With Love & Fortune from the Cosmos 💫</div>
|
||||
</div>
|
||||
|
||||
<script src="./deploy.js"></script>
|
||||
|
||||
<script type="module" src="./event.mjs"></script>
|
||||
</body>
|
||||
</html>
|
1
mime.types
Normal file
1
mime.types
Normal file
|
@ -0,0 +1 @@
|
|||
application/javascript js
|
1
node_modules/.bin/he
generated
vendored
Symbolic link
1
node_modules/.bin/he
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
|||
../he/bin/he
|
1
node_modules/.bin/http-server
generated
vendored
Symbolic link
1
node_modules/.bin/http-server
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
|||
../http-server/bin/http-server
|
1
node_modules/.bin/mime
generated
vendored
Symbolic link
1
node_modules/.bin/mime
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
|||
../mime/cli.js
|
1
node_modules/.bin/opener
generated
vendored
Symbolic link
1
node_modules/.bin/opener
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
|||
../opener/bin/opener-bin.js
|
1067
node_modules/.package-lock.json
generated
vendored
1067
node_modules/.package-lock.json
generated
vendored
File diff suppressed because it is too large
Load diff
21
node_modules/@types/body-parser/LICENSE
generated
vendored
Normal file
21
node_modules/@types/body-parser/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
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:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
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
|
15
node_modules/@types/body-parser/README.md
generated
vendored
Normal file
15
node_modules/@types/body-parser/README.md
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Installation
|
||||
> `npm install --save @types/body-parser`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for body-parser (https://github.com/expressjs/body-parser).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/body-parser.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Mon, 06 Nov 2023 22:41:05 GMT
|
||||
* Dependencies: [@types/connect](https://npmjs.com/package/@types/connect), [@types/node](https://npmjs.com/package/@types/node)
|
||||
|
||||
# Credits
|
||||
These definitions were written by [Santi Albo](https://github.com/santialbo), [Vilic Vane](https://github.com/vilic), [Jonathan Häberle](https://github.com/dreampulse), [Gevik Babakhani](https://github.com/blendsdk), [Tomasz Łaziuk](https://github.com/tlaziuk), [Jason Walton](https://github.com/jwalton), and [Piotr Błażejewicz](https://github.com/peterblazejewicz).
|
95
node_modules/@types/body-parser/index.d.ts
generated
vendored
Normal file
95
node_modules/@types/body-parser/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,95 @@
|
|||
/// <reference types="node" />
|
||||
|
||||
import { NextHandleFunction } from "connect";
|
||||
import * as http from "http";
|
||||
|
||||
// for docs go to https://github.com/expressjs/body-parser/tree/1.19.0#body-parser
|
||||
|
||||
declare namespace bodyParser {
|
||||
interface BodyParser {
|
||||
/**
|
||||
* @deprecated use individual json/urlencoded middlewares
|
||||
*/
|
||||
(options?: OptionsJson & OptionsText & OptionsUrlencoded): NextHandleFunction;
|
||||
/**
|
||||
* Returns middleware that only parses json and only looks at requests
|
||||
* where the Content-Type header matches the type option.
|
||||
*/
|
||||
json(options?: OptionsJson): NextHandleFunction;
|
||||
/**
|
||||
* Returns middleware that parses all bodies as a Buffer and only looks at requests
|
||||
* where the Content-Type header matches the type option.
|
||||
*/
|
||||
raw(options?: Options): NextHandleFunction;
|
||||
|
||||
/**
|
||||
* Returns middleware that parses all bodies as a string and only looks at requests
|
||||
* where the Content-Type header matches the type option.
|
||||
*/
|
||||
text(options?: OptionsText): NextHandleFunction;
|
||||
/**
|
||||
* Returns middleware that only parses urlencoded bodies and only looks at requests
|
||||
* where the Content-Type header matches the type option
|
||||
*/
|
||||
urlencoded(options?: OptionsUrlencoded): NextHandleFunction;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
/** When set to true, then deflated (compressed) bodies will be inflated; when false, deflated bodies are rejected. Defaults to true. */
|
||||
inflate?: boolean | undefined;
|
||||
/**
|
||||
* Controls the maximum request body size. If this is a number,
|
||||
* then the value specifies the number of bytes; if it is a string,
|
||||
* the value is passed to the bytes library for parsing. Defaults to '100kb'.
|
||||
*/
|
||||
limit?: number | string | undefined;
|
||||
/**
|
||||
* The type option is used to determine what media type the middleware will parse
|
||||
*/
|
||||
type?: string | string[] | ((req: http.IncomingMessage) => any) | undefined;
|
||||
/**
|
||||
* The verify option, if supplied, is called as verify(req, res, buf, encoding),
|
||||
* where buf is a Buffer of the raw request body and encoding is the encoding of the request.
|
||||
*/
|
||||
verify?(req: http.IncomingMessage, res: http.ServerResponse, buf: Buffer, encoding: string): void;
|
||||
}
|
||||
|
||||
interface OptionsJson extends Options {
|
||||
/**
|
||||
* The reviver option is passed directly to JSON.parse as the second argument.
|
||||
*/
|
||||
reviver?(key: string, value: any): any;
|
||||
/**
|
||||
* When set to `true`, will only accept arrays and objects;
|
||||
* when `false` will accept anything JSON.parse accepts. Defaults to `true`.
|
||||
*/
|
||||
strict?: boolean | undefined;
|
||||
}
|
||||
|
||||
interface OptionsText extends Options {
|
||||
/**
|
||||
* Specify the default character set for the text content if the charset
|
||||
* is not specified in the Content-Type header of the request.
|
||||
* Defaults to `utf-8`.
|
||||
*/
|
||||
defaultCharset?: string | undefined;
|
||||
}
|
||||
|
||||
interface OptionsUrlencoded extends Options {
|
||||
/**
|
||||
* The extended option allows to choose between parsing the URL-encoded data
|
||||
* with the querystring library (when `false`) or the qs library (when `true`).
|
||||
*/
|
||||
extended?: boolean | undefined;
|
||||
/**
|
||||
* The parameterLimit option controls the maximum number of parameters
|
||||
* that are allowed in the URL-encoded data. If a request contains more parameters than this value,
|
||||
* a 413 will be returned to the client. Defaults to 1000.
|
||||
*/
|
||||
parameterLimit?: number | undefined;
|
||||
}
|
||||
}
|
||||
|
||||
declare const bodyParser: bodyParser.BodyParser;
|
||||
|
||||
export = bodyParser;
|
58
node_modules/@types/body-parser/package.json
generated
vendored
Normal file
58
node_modules/@types/body-parser/package.json
generated
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
{
|
||||
"name": "@types/body-parser",
|
||||
"version": "1.19.5",
|
||||
"description": "TypeScript definitions for body-parser",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/body-parser",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Santi Albo",
|
||||
"githubUsername": "santialbo",
|
||||
"url": "https://github.com/santialbo"
|
||||
},
|
||||
{
|
||||
"name": "Vilic Vane",
|
||||
"githubUsername": "vilic",
|
||||
"url": "https://github.com/vilic"
|
||||
},
|
||||
{
|
||||
"name": "Jonathan Häberle",
|
||||
"githubUsername": "dreampulse",
|
||||
"url": "https://github.com/dreampulse"
|
||||
},
|
||||
{
|
||||
"name": "Gevik Babakhani",
|
||||
"githubUsername": "blendsdk",
|
||||
"url": "https://github.com/blendsdk"
|
||||
},
|
||||
{
|
||||
"name": "Tomasz Łaziuk",
|
||||
"githubUsername": "tlaziuk",
|
||||
"url": "https://github.com/tlaziuk"
|
||||
},
|
||||
{
|
||||
"name": "Jason Walton",
|
||||
"githubUsername": "jwalton",
|
||||
"url": "https://github.com/jwalton"
|
||||
},
|
||||
{
|
||||
"name": "Piotr Błażejewicz",
|
||||
"githubUsername": "peterblazejewicz",
|
||||
"url": "https://github.com/peterblazejewicz"
|
||||
}
|
||||
],
|
||||
"main": "",
|
||||
"types": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/body-parser"
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {
|
||||
"@types/connect": "*",
|
||||
"@types/node": "*"
|
||||
},
|
||||
"typesPublisherContentHash": "7be737b78c8aabd5436be840558b283182b44c3cf9da24fb1f2ff8f414db5802",
|
||||
"typeScriptVersion": "4.5"
|
||||
}
|
21
node_modules/@types/connect/LICENSE
generated
vendored
Normal file
21
node_modules/@types/connect/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
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:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
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
|
15
node_modules/@types/connect/README.md
generated
vendored
Normal file
15
node_modules/@types/connect/README.md
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Installation
|
||||
> `npm install --save @types/connect`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for connect (https://github.com/senchalabs/connect).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/connect.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Mon, 06 Nov 2023 22:41:05 GMT
|
||||
* Dependencies: [@types/node](https://npmjs.com/package/@types/node)
|
||||
|
||||
# Credits
|
||||
These definitions were written by [Maxime LUCE](https://github.com/SomaticIT), and [Evan Hahn](https://github.com/EvanHahn).
|
91
node_modules/@types/connect/index.d.ts
generated
vendored
Normal file
91
node_modules/@types/connect/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,91 @@
|
|||
/// <reference types="node" />
|
||||
|
||||
import * as http from "http";
|
||||
|
||||
/**
|
||||
* Create a new connect server.
|
||||
*/
|
||||
declare function createServer(): createServer.Server;
|
||||
|
||||
declare namespace createServer {
|
||||
export type ServerHandle = HandleFunction | http.Server;
|
||||
|
||||
export class IncomingMessage extends http.IncomingMessage {
|
||||
originalUrl?: http.IncomingMessage["url"] | undefined;
|
||||
}
|
||||
|
||||
type NextFunction = (err?: any) => void;
|
||||
|
||||
export type SimpleHandleFunction = (req: IncomingMessage, res: http.ServerResponse) => void;
|
||||
export type NextHandleFunction = (req: IncomingMessage, res: http.ServerResponse, next: NextFunction) => void;
|
||||
export type ErrorHandleFunction = (
|
||||
err: any,
|
||||
req: IncomingMessage,
|
||||
res: http.ServerResponse,
|
||||
next: NextFunction,
|
||||
) => void;
|
||||
export type HandleFunction = SimpleHandleFunction | NextHandleFunction | ErrorHandleFunction;
|
||||
|
||||
export interface ServerStackItem {
|
||||
route: string;
|
||||
handle: ServerHandle;
|
||||
}
|
||||
|
||||
export interface Server extends NodeJS.EventEmitter {
|
||||
(req: http.IncomingMessage, res: http.ServerResponse, next?: Function): void;
|
||||
|
||||
route: string;
|
||||
stack: ServerStackItem[];
|
||||
|
||||
/**
|
||||
* Utilize the given middleware `handle` to the given `route`,
|
||||
* defaulting to _/_. This "route" is the mount-point for the
|
||||
* middleware, when given a value other than _/_ the middleware
|
||||
* is only effective when that segment is present in the request's
|
||||
* pathname.
|
||||
*
|
||||
* For example if we were to mount a function at _/admin_, it would
|
||||
* be invoked on _/admin_, and _/admin/settings_, however it would
|
||||
* not be invoked for _/_, or _/posts_.
|
||||
*/
|
||||
use(fn: NextHandleFunction): Server;
|
||||
use(fn: HandleFunction): Server;
|
||||
use(route: string, fn: NextHandleFunction): Server;
|
||||
use(route: string, fn: HandleFunction): Server;
|
||||
|
||||
/**
|
||||
* Handle server requests, punting them down
|
||||
* the middleware stack.
|
||||
*/
|
||||
handle(req: http.IncomingMessage, res: http.ServerResponse, next: Function): void;
|
||||
|
||||
/**
|
||||
* Listen for connections.
|
||||
*
|
||||
* This method takes the same arguments
|
||||
* as node's `http.Server#listen()`.
|
||||
*
|
||||
* HTTP and HTTPS:
|
||||
*
|
||||
* If you run your application both as HTTP
|
||||
* and HTTPS you may wrap them individually,
|
||||
* since your Connect "server" is really just
|
||||
* a JavaScript `Function`.
|
||||
*
|
||||
* var connect = require('connect')
|
||||
* , http = require('http')
|
||||
* , https = require('https');
|
||||
*
|
||||
* var app = connect();
|
||||
*
|
||||
* http.createServer(app).listen(80);
|
||||
* https.createServer(options, app).listen(443);
|
||||
*/
|
||||
listen(port: number, hostname?: string, backlog?: number, callback?: Function): http.Server;
|
||||
listen(port: number, hostname?: string, callback?: Function): http.Server;
|
||||
listen(path: string, callback?: Function): http.Server;
|
||||
listen(handle: any, listeningListener?: Function): http.Server;
|
||||
}
|
||||
}
|
||||
|
||||
export = createServer;
|
32
node_modules/@types/connect/package.json
generated
vendored
Normal file
32
node_modules/@types/connect/package.json
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"name": "@types/connect",
|
||||
"version": "3.4.38",
|
||||
"description": "TypeScript definitions for connect",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/connect",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Maxime LUCE",
|
||||
"githubUsername": "SomaticIT",
|
||||
"url": "https://github.com/SomaticIT"
|
||||
},
|
||||
{
|
||||
"name": "Evan Hahn",
|
||||
"githubUsername": "EvanHahn",
|
||||
"url": "https://github.com/EvanHahn"
|
||||
}
|
||||
],
|
||||
"main": "",
|
||||
"types": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/connect"
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
},
|
||||
"typesPublisherContentHash": "8990242237504bdec53088b79e314b94bec69286df9de56db31f22de403b4092",
|
||||
"typeScriptVersion": "4.5"
|
||||
}
|
21
node_modules/@types/express-serve-static-core/LICENSE
generated
vendored
Normal file
21
node_modules/@types/express-serve-static-core/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
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:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
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
|
15
node_modules/@types/express-serve-static-core/README.md
generated
vendored
Normal file
15
node_modules/@types/express-serve-static-core/README.md
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Installation
|
||||
> `npm install --save @types/express-serve-static-core`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for express-serve-static-core (http://expressjs.com).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express-serve-static-core.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Tue, 28 Jan 2025 05:02:28 GMT
|
||||
* Dependencies: [@types/node](https://npmjs.com/package/@types/node), [@types/qs](https://npmjs.com/package/@types/qs), [@types/range-parser](https://npmjs.com/package/@types/range-parser), [@types/send](https://npmjs.com/package/@types/send)
|
||||
|
||||
# Credits
|
||||
These definitions were written by [Boris Yankov](https://github.com/borisyankov), [Satana Charuwichitratana](https://github.com/micksatana), [Jose Luis Leon](https://github.com/JoseLion), [David Stephens](https://github.com/dwrss), and [Shin Ando](https://github.com/andoshin11).
|
1244
node_modules/@types/express-serve-static-core/index.d.ts
generated
vendored
Normal file
1244
node_modules/@types/express-serve-static-core/index.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
51
node_modules/@types/express-serve-static-core/package.json
generated
vendored
Normal file
51
node_modules/@types/express-serve-static-core/package.json
generated
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
"name": "@types/express-serve-static-core",
|
||||
"version": "5.0.6",
|
||||
"description": "TypeScript definitions for express-serve-static-core",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express-serve-static-core",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Boris Yankov",
|
||||
"githubUsername": "borisyankov",
|
||||
"url": "https://github.com/borisyankov"
|
||||
},
|
||||
{
|
||||
"name": "Satana Charuwichitratana",
|
||||
"githubUsername": "micksatana",
|
||||
"url": "https://github.com/micksatana"
|
||||
},
|
||||
{
|
||||
"name": "Jose Luis Leon",
|
||||
"githubUsername": "JoseLion",
|
||||
"url": "https://github.com/JoseLion"
|
||||
},
|
||||
{
|
||||
"name": "David Stephens",
|
||||
"githubUsername": "dwrss",
|
||||
"url": "https://github.com/dwrss"
|
||||
},
|
||||
{
|
||||
"name": "Shin Ando",
|
||||
"githubUsername": "andoshin11",
|
||||
"url": "https://github.com/andoshin11"
|
||||
}
|
||||
],
|
||||
"main": "",
|
||||
"types": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/express-serve-static-core"
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {
|
||||
"@types/node": "*",
|
||||
"@types/qs": "*",
|
||||
"@types/range-parser": "*",
|
||||
"@types/send": "*"
|
||||
},
|
||||
"peerDependencies": {},
|
||||
"typesPublisherContentHash": "44d5cdf58e5ee1073bddfbf6110c8e09cc6e0712ad27c9ed54d367643bee193b",
|
||||
"typeScriptVersion": "5.0"
|
||||
}
|
21
node_modules/@types/express/LICENSE
generated
vendored
Normal file
21
node_modules/@types/express/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
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:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
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
|
15
node_modules/@types/express/README.md
generated
vendored
Normal file
15
node_modules/@types/express/README.md
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Installation
|
||||
> `npm install --save @types/express`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for express (http://expressjs.com).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Wed, 19 Mar 2025 19:32:12 GMT
|
||||
* Dependencies: [@types/body-parser](https://npmjs.com/package/@types/body-parser), [@types/express-serve-static-core](https://npmjs.com/package/@types/express-serve-static-core), [@types/serve-static](https://npmjs.com/package/@types/serve-static)
|
||||
|
||||
# Credits
|
||||
These definitions were written by [Boris Yankov](https://github.com/borisyankov), [China Medical University Hospital](https://github.com/CMUH), [Puneet Arora](https://github.com/puneetar), and [Dylan Frankland](https://github.com/dfrankland).
|
122
node_modules/@types/express/index.d.ts
generated
vendored
Normal file
122
node_modules/@types/express/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,122 @@
|
|||
/* =================== USAGE ===================
|
||||
|
||||
import express = require("express");
|
||||
var app = express();
|
||||
|
||||
=============================================== */
|
||||
|
||||
/// <reference types="express-serve-static-core" />
|
||||
/// <reference types="serve-static" />
|
||||
|
||||
import * as bodyParser from "body-parser";
|
||||
import * as core from "express-serve-static-core";
|
||||
import * as serveStatic from "serve-static";
|
||||
|
||||
/**
|
||||
* Creates an Express application. The express() function is a top-level function exported by the express module.
|
||||
*/
|
||||
declare function e(): core.Express;
|
||||
|
||||
declare namespace e {
|
||||
/**
|
||||
* This is a built-in middleware function in Express. It parses incoming requests with JSON payloads and is based on body-parser.
|
||||
* @since 4.16.0
|
||||
*/
|
||||
var json: typeof bodyParser.json;
|
||||
|
||||
/**
|
||||
* This is a built-in middleware function in Express. It parses incoming requests with Buffer payloads and is based on body-parser.
|
||||
* @since 4.17.0
|
||||
*/
|
||||
var raw: typeof bodyParser.raw;
|
||||
|
||||
/**
|
||||
* This is a built-in middleware function in Express. It parses incoming requests with text payloads and is based on body-parser.
|
||||
* @since 4.17.0
|
||||
*/
|
||||
var text: typeof bodyParser.text;
|
||||
|
||||
/**
|
||||
* These are the exposed prototypes.
|
||||
*/
|
||||
var application: Application;
|
||||
var request: Request;
|
||||
var response: Response;
|
||||
|
||||
/**
|
||||
* This is a built-in middleware function in Express. It serves static files and is based on serve-static.
|
||||
*/
|
||||
var static: serveStatic.RequestHandlerConstructor<Response>;
|
||||
|
||||
/**
|
||||
* This is a built-in middleware function in Express. It parses incoming requests with urlencoded payloads and is based on body-parser.
|
||||
* @since 4.16.0
|
||||
*/
|
||||
var urlencoded: typeof bodyParser.urlencoded;
|
||||
|
||||
export function Router(options?: RouterOptions): core.Router;
|
||||
|
||||
interface RouterOptions {
|
||||
/**
|
||||
* Enable case sensitivity.
|
||||
*/
|
||||
caseSensitive?: boolean | undefined;
|
||||
|
||||
/**
|
||||
* Preserve the req.params values from the parent router.
|
||||
* If the parent and the child have conflicting param names, the child’s value take precedence.
|
||||
*
|
||||
* @default false
|
||||
* @since 4.5.0
|
||||
*/
|
||||
mergeParams?: boolean | undefined;
|
||||
|
||||
/**
|
||||
* Enable strict routing.
|
||||
*/
|
||||
strict?: boolean | undefined;
|
||||
}
|
||||
|
||||
interface Application extends core.Application {}
|
||||
interface CookieOptions extends core.CookieOptions {}
|
||||
interface Errback extends core.Errback {}
|
||||
interface ErrorRequestHandler<
|
||||
P = core.ParamsDictionary,
|
||||
ResBody = any,
|
||||
ReqBody = any,
|
||||
ReqQuery = core.Query,
|
||||
Locals extends Record<string, any> = Record<string, any>,
|
||||
> extends core.ErrorRequestHandler<P, ResBody, ReqBody, ReqQuery, Locals> {}
|
||||
interface Express extends core.Express {}
|
||||
interface Handler extends core.Handler {}
|
||||
interface IRoute extends core.IRoute {}
|
||||
interface IRouter extends core.IRouter {}
|
||||
interface IRouterHandler<T> extends core.IRouterHandler<T> {}
|
||||
interface IRouterMatcher<T> extends core.IRouterMatcher<T> {}
|
||||
interface MediaType extends core.MediaType {}
|
||||
interface NextFunction extends core.NextFunction {}
|
||||
interface Locals extends core.Locals {}
|
||||
interface Request<
|
||||
P = core.ParamsDictionary,
|
||||
ResBody = any,
|
||||
ReqBody = any,
|
||||
ReqQuery = core.Query,
|
||||
Locals extends Record<string, any> = Record<string, any>,
|
||||
> extends core.Request<P, ResBody, ReqBody, ReqQuery, Locals> {}
|
||||
interface RequestHandler<
|
||||
P = core.ParamsDictionary,
|
||||
ResBody = any,
|
||||
ReqBody = any,
|
||||
ReqQuery = core.Query,
|
||||
Locals extends Record<string, any> = Record<string, any>,
|
||||
> extends core.RequestHandler<P, ResBody, ReqBody, ReqQuery, Locals> {}
|
||||
interface RequestParamHandler extends core.RequestParamHandler {}
|
||||
interface Response<
|
||||
ResBody = any,
|
||||
Locals extends Record<string, any> = Record<string, any>,
|
||||
> extends core.Response<ResBody, Locals> {}
|
||||
interface Router extends core.Router {}
|
||||
interface Send extends core.Send {}
|
||||
}
|
||||
|
||||
export = e;
|
45
node_modules/@types/express/package.json
generated
vendored
Normal file
45
node_modules/@types/express/package.json
generated
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"name": "@types/express",
|
||||
"version": "5.0.1",
|
||||
"description": "TypeScript definitions for express",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Boris Yankov",
|
||||
"githubUsername": "borisyankov",
|
||||
"url": "https://github.com/borisyankov"
|
||||
},
|
||||
{
|
||||
"name": "China Medical University Hospital",
|
||||
"githubUsername": "CMUH",
|
||||
"url": "https://github.com/CMUH"
|
||||
},
|
||||
{
|
||||
"name": "Puneet Arora",
|
||||
"githubUsername": "puneetar",
|
||||
"url": "https://github.com/puneetar"
|
||||
},
|
||||
{
|
||||
"name": "Dylan Frankland",
|
||||
"githubUsername": "dfrankland",
|
||||
"url": "https://github.com/dfrankland"
|
||||
}
|
||||
],
|
||||
"main": "",
|
||||
"types": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/express"
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {
|
||||
"@types/body-parser": "*",
|
||||
"@types/express-serve-static-core": "^5.0.0",
|
||||
"@types/serve-static": "*"
|
||||
},
|
||||
"peerDependencies": {},
|
||||
"typesPublisherContentHash": "fc4e2b97399a28edf0ea8af60a18a56b71622eab908009e7e3a18677f98a80d8",
|
||||
"typeScriptVersion": "5.0"
|
||||
}
|
21
node_modules/@types/http-errors/LICENSE
generated
vendored
Normal file
21
node_modules/@types/http-errors/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
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:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
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
|
15
node_modules/@types/http-errors/README.md
generated
vendored
Normal file
15
node_modules/@types/http-errors/README.md
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Installation
|
||||
> `npm install --save @types/http-errors`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for http-errors (https://github.com/jshttp/http-errors).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/http-errors.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Tue, 07 Nov 2023 03:09:37 GMT
|
||||
* Dependencies: none
|
||||
|
||||
# Credits
|
||||
These definitions were written by [Tanguy Krotoff](https://github.com/tkrotoff), and [BendingBender](https://github.com/BendingBender).
|
77
node_modules/@types/http-errors/index.d.ts
generated
vendored
Normal file
77
node_modules/@types/http-errors/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,77 @@
|
|||
export = createHttpError;
|
||||
|
||||
declare const createHttpError: createHttpError.CreateHttpError & createHttpError.NamedConstructors & {
|
||||
isHttpError: createHttpError.IsHttpError;
|
||||
};
|
||||
|
||||
declare namespace createHttpError {
|
||||
interface HttpError<N extends number = number> extends Error {
|
||||
status: N;
|
||||
statusCode: N;
|
||||
expose: boolean;
|
||||
headers?: {
|
||||
[key: string]: string;
|
||||
} | undefined;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
type UnknownError = Error | string | { [key: string]: any };
|
||||
|
||||
interface HttpErrorConstructor<N extends number = number> {
|
||||
(msg?: string): HttpError<N>;
|
||||
new(msg?: string): HttpError<N>;
|
||||
}
|
||||
|
||||
interface CreateHttpError {
|
||||
<N extends number = number>(arg: N, ...rest: UnknownError[]): HttpError<N>;
|
||||
(...rest: UnknownError[]): HttpError;
|
||||
}
|
||||
|
||||
type IsHttpError = (error: unknown) => error is HttpError;
|
||||
|
||||
type NamedConstructors =
|
||||
& {
|
||||
HttpError: HttpErrorConstructor;
|
||||
}
|
||||
& Record<"BadRequest" | "400", HttpErrorConstructor<400>>
|
||||
& Record<"Unauthorized" | "401", HttpErrorConstructor<401>>
|
||||
& Record<"PaymentRequired" | "402", HttpErrorConstructor<402>>
|
||||
& Record<"Forbidden" | "403", HttpErrorConstructor<403>>
|
||||
& Record<"NotFound" | "404", HttpErrorConstructor<404>>
|
||||
& Record<"MethodNotAllowed" | "405", HttpErrorConstructor<405>>
|
||||
& Record<"NotAcceptable" | "406", HttpErrorConstructor<406>>
|
||||
& Record<"ProxyAuthenticationRequired" | "407", HttpErrorConstructor<407>>
|
||||
& Record<"RequestTimeout" | "408", HttpErrorConstructor<408>>
|
||||
& Record<"Conflict" | "409", HttpErrorConstructor<409>>
|
||||
& Record<"Gone" | "410", HttpErrorConstructor<410>>
|
||||
& Record<"LengthRequired" | "411", HttpErrorConstructor<411>>
|
||||
& Record<"PreconditionFailed" | "412", HttpErrorConstructor<412>>
|
||||
& Record<"PayloadTooLarge" | "413", HttpErrorConstructor<413>>
|
||||
& Record<"URITooLong" | "414", HttpErrorConstructor<414>>
|
||||
& Record<"UnsupportedMediaType" | "415", HttpErrorConstructor<415>>
|
||||
& Record<"RangeNotSatisfiable" | "416", HttpErrorConstructor<416>>
|
||||
& Record<"ExpectationFailed" | "417", HttpErrorConstructor<417>>
|
||||
& Record<"ImATeapot" | "418", HttpErrorConstructor<418>>
|
||||
& Record<"MisdirectedRequest" | "421", HttpErrorConstructor<421>>
|
||||
& Record<"UnprocessableEntity" | "422", HttpErrorConstructor<422>>
|
||||
& Record<"Locked" | "423", HttpErrorConstructor<423>>
|
||||
& Record<"FailedDependency" | "424", HttpErrorConstructor<424>>
|
||||
& Record<"TooEarly" | "425", HttpErrorConstructor<425>>
|
||||
& Record<"UpgradeRequired" | "426", HttpErrorConstructor<426>>
|
||||
& Record<"PreconditionRequired" | "428", HttpErrorConstructor<428>>
|
||||
& Record<"TooManyRequests" | "429", HttpErrorConstructor<429>>
|
||||
& Record<"RequestHeaderFieldsTooLarge" | "431", HttpErrorConstructor<431>>
|
||||
& Record<"UnavailableForLegalReasons" | "451", HttpErrorConstructor<451>>
|
||||
& Record<"InternalServerError" | "500", HttpErrorConstructor<500>>
|
||||
& Record<"NotImplemented" | "501", HttpErrorConstructor<501>>
|
||||
& Record<"BadGateway" | "502", HttpErrorConstructor<502>>
|
||||
& Record<"ServiceUnavailable" | "503", HttpErrorConstructor<503>>
|
||||
& Record<"GatewayTimeout" | "504", HttpErrorConstructor<504>>
|
||||
& Record<"HTTPVersionNotSupported" | "505", HttpErrorConstructor<505>>
|
||||
& Record<"VariantAlsoNegotiates" | "506", HttpErrorConstructor<506>>
|
||||
& Record<"InsufficientStorage" | "507", HttpErrorConstructor<507>>
|
||||
& Record<"LoopDetected" | "508", HttpErrorConstructor<508>>
|
||||
& Record<"BandwidthLimitExceeded" | "509", HttpErrorConstructor<509>>
|
||||
& Record<"NotExtended" | "510", HttpErrorConstructor<510>>
|
||||
& Record<"NetworkAuthenticationRequire" | "511", HttpErrorConstructor<511>>;
|
||||
}
|
30
node_modules/@types/http-errors/package.json
generated
vendored
Normal file
30
node_modules/@types/http-errors/package.json
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"name": "@types/http-errors",
|
||||
"version": "2.0.4",
|
||||
"description": "TypeScript definitions for http-errors",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/http-errors",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Tanguy Krotoff",
|
||||
"githubUsername": "tkrotoff",
|
||||
"url": "https://github.com/tkrotoff"
|
||||
},
|
||||
{
|
||||
"name": "BendingBender",
|
||||
"githubUsername": "BendingBender",
|
||||
"url": "https://github.com/BendingBender"
|
||||
}
|
||||
],
|
||||
"main": "",
|
||||
"types": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/http-errors"
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {},
|
||||
"typesPublisherContentHash": "06e33723b60f818facd3b7dd2025f043142fb7c56ab4832babafeb9470f2086f",
|
||||
"typeScriptVersion": "4.5"
|
||||
}
|
21
node_modules/@types/mime/LICENSE
generated
vendored
Normal file
21
node_modules/@types/mime/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
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:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
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
|
10
node_modules/@types/mime/Mime.d.ts
generated
vendored
Normal file
10
node_modules/@types/mime/Mime.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
import { TypeMap } from "./index";
|
||||
|
||||
export default class Mime {
|
||||
constructor(mimes: TypeMap);
|
||||
|
||||
lookup(path: string, fallback?: string): string;
|
||||
extension(mime: string): string | undefined;
|
||||
load(filepath: string): void;
|
||||
define(mimes: TypeMap): void;
|
||||
}
|
15
node_modules/@types/mime/README.md
generated
vendored
Normal file
15
node_modules/@types/mime/README.md
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Installation
|
||||
> `npm install --save @types/mime`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for mime (https://github.com/broofa/node-mime).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mime/v1.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Tue, 07 Nov 2023 20:08:00 GMT
|
||||
* Dependencies: none
|
||||
|
||||
# Credits
|
||||
These definitions were written by [Jeff Goddard](https://github.com/jedigo), and [Daniel Hritzkiv](https://github.com/dhritzkiv).
|
31
node_modules/@types/mime/index.d.ts
generated
vendored
Normal file
31
node_modules/@types/mime/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
// Originally imported from: https://github.com/soywiz/typescript-node-definitions/mime.d.ts
|
||||
|
||||
export as namespace mime;
|
||||
|
||||
export interface TypeMap {
|
||||
[key: string]: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Look up a mime type based on extension.
|
||||
*
|
||||
* If not found, uses the fallback argument if provided, and otherwise
|
||||
* uses `default_type`.
|
||||
*/
|
||||
export function lookup(path: string, fallback?: string): string;
|
||||
/**
|
||||
* Return a file extensions associated with a mime type.
|
||||
*/
|
||||
export function extension(mime: string): string | undefined;
|
||||
/**
|
||||
* Load an Apache2-style ".types" file.
|
||||
*/
|
||||
export function load(filepath: string): void;
|
||||
export function define(mimes: TypeMap): void;
|
||||
|
||||
export interface Charsets {
|
||||
lookup(mime: string, fallback: string): string;
|
||||
}
|
||||
|
||||
export const charsets: Charsets;
|
||||
export const default_type: string;
|
7
node_modules/@types/mime/lite.d.ts
generated
vendored
Normal file
7
node_modules/@types/mime/lite.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
import { default as Mime } from "./Mime";
|
||||
|
||||
declare const mimelite: Mime;
|
||||
|
||||
export as namespace mimelite;
|
||||
|
||||
export = mimelite;
|
30
node_modules/@types/mime/package.json
generated
vendored
Normal file
30
node_modules/@types/mime/package.json
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"name": "@types/mime",
|
||||
"version": "1.3.5",
|
||||
"description": "TypeScript definitions for mime",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mime",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Jeff Goddard",
|
||||
"githubUsername": "jedigo",
|
||||
"url": "https://github.com/jedigo"
|
||||
},
|
||||
{
|
||||
"name": "Daniel Hritzkiv",
|
||||
"githubUsername": "dhritzkiv",
|
||||
"url": "https://github.com/dhritzkiv"
|
||||
}
|
||||
],
|
||||
"main": "",
|
||||
"types": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/mime"
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {},
|
||||
"typesPublisherContentHash": "2ad7ee9a549e6721825e733c6a1a7e8bee0ca7ba93d9ab922c8f4558def52d77",
|
||||
"typeScriptVersion": "4.5"
|
||||
}
|
21
node_modules/@types/qs/LICENSE
generated
vendored
Normal file
21
node_modules/@types/qs/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
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:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
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
|
15
node_modules/@types/qs/README.md
generated
vendored
Normal file
15
node_modules/@types/qs/README.md
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Installation
|
||||
> `npm install --save @types/qs`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for qs (https://github.com/ljharb/qs).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/qs.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Tue, 14 Jan 2025 01:30:27 GMT
|
||||
* Dependencies: none
|
||||
|
||||
# Credits
|
||||
These definitions were written by [Roman Korneev](https://github.com/RWander), [Leon Yu](https://github.com/leonyu), [Belinda Teh](https://github.com/tehbelinda), [Melvin Lee](https://github.com/zyml), [Arturs Vonda](https://github.com/artursvonda), [Carlos Bonetti](https://github.com/CarlosBonetti), [Dan Smith](https://github.com/dpsmith3), [Hunter Perrin](https://github.com/hperrin), and [Jordan Harband](https://github.com/ljharb).
|
81
node_modules/@types/qs/index.d.ts
generated
vendored
Normal file
81
node_modules/@types/qs/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,81 @@
|
|||
export = QueryString;
|
||||
export as namespace qs;
|
||||
|
||||
declare namespace QueryString {
|
||||
type defaultEncoder = (str: any, defaultEncoder?: any, charset?: string) => string;
|
||||
type defaultDecoder = (str: string, decoder?: any, charset?: string) => string;
|
||||
|
||||
type BooleanOptional = boolean | undefined;
|
||||
|
||||
interface IStringifyBaseOptions {
|
||||
delimiter?: string | undefined;
|
||||
strictNullHandling?: boolean | undefined;
|
||||
skipNulls?: boolean | undefined;
|
||||
encode?: boolean | undefined;
|
||||
encoder?:
|
||||
| ((str: any, defaultEncoder: defaultEncoder, charset: string, type: "key" | "value") => string)
|
||||
| undefined;
|
||||
filter?: Array<string | number> | ((prefix: string, value: any) => any) | undefined;
|
||||
arrayFormat?: "indices" | "brackets" | "repeat" | "comma" | undefined;
|
||||
indices?: boolean | undefined;
|
||||
sort?: ((a: string, b: string) => number) | undefined;
|
||||
serializeDate?: ((d: Date) => string) | undefined;
|
||||
format?: "RFC1738" | "RFC3986" | undefined;
|
||||
encodeValuesOnly?: boolean | undefined;
|
||||
addQueryPrefix?: boolean | undefined;
|
||||
charset?: "utf-8" | "iso-8859-1" | undefined;
|
||||
charsetSentinel?: boolean | undefined;
|
||||
allowEmptyArrays?: boolean | undefined;
|
||||
commaRoundTrip?: boolean | undefined;
|
||||
}
|
||||
|
||||
type IStringifyDynamicOptions<AllowDots extends BooleanOptional> = AllowDots extends true
|
||||
? { allowDots?: AllowDots; encodeDotInKeys?: boolean }
|
||||
: { allowDots?: boolean; encodeDotInKeys?: false };
|
||||
|
||||
type IStringifyOptions<AllowDots extends BooleanOptional = undefined> =
|
||||
& IStringifyBaseOptions
|
||||
& IStringifyDynamicOptions<AllowDots>;
|
||||
|
||||
interface IParseBaseOptions {
|
||||
comma?: boolean | undefined;
|
||||
delimiter?: string | RegExp | undefined;
|
||||
depth?: number | false | undefined;
|
||||
decoder?:
|
||||
| ((str: string, defaultDecoder: defaultDecoder, charset: string, type: "key" | "value") => any)
|
||||
| undefined;
|
||||
arrayLimit?: number | undefined;
|
||||
parseArrays?: boolean | undefined;
|
||||
plainObjects?: boolean | undefined;
|
||||
allowPrototypes?: boolean | undefined;
|
||||
allowSparse?: boolean | undefined;
|
||||
parameterLimit?: number | undefined;
|
||||
strictNullHandling?: boolean | undefined;
|
||||
ignoreQueryPrefix?: boolean | undefined;
|
||||
charset?: "utf-8" | "iso-8859-1" | undefined;
|
||||
charsetSentinel?: boolean | undefined;
|
||||
interpretNumericEntities?: boolean | undefined;
|
||||
allowEmptyArrays?: boolean | undefined;
|
||||
duplicates?: "combine" | "first" | "last" | undefined;
|
||||
strictDepth?: boolean | undefined;
|
||||
}
|
||||
|
||||
type IParseDynamicOptions<AllowDots extends BooleanOptional> = AllowDots extends true
|
||||
? { allowDots?: AllowDots; decodeDotInKeys?: boolean }
|
||||
: { allowDots?: boolean; decodeDotInKeys?: false };
|
||||
|
||||
type IParseOptions<AllowDots extends BooleanOptional = undefined> =
|
||||
& IParseBaseOptions
|
||||
& IParseDynamicOptions<AllowDots>;
|
||||
|
||||
interface ParsedQs {
|
||||
[key: string]: undefined | string | ParsedQs | (string | ParsedQs)[];
|
||||
}
|
||||
|
||||
function stringify(obj: any, options?: IStringifyOptions<BooleanOptional>): string;
|
||||
function parse(str: string, options?: IParseOptions<BooleanOptional> & { decoder?: never | undefined }): ParsedQs;
|
||||
function parse(
|
||||
str: string | Record<string, string>,
|
||||
options?: IParseOptions<BooleanOptional>,
|
||||
): { [key: string]: unknown };
|
||||
}
|
66
node_modules/@types/qs/package.json
generated
vendored
Normal file
66
node_modules/@types/qs/package.json
generated
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
{
|
||||
"name": "@types/qs",
|
||||
"version": "6.9.18",
|
||||
"description": "TypeScript definitions for qs",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/qs",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Roman Korneev",
|
||||
"githubUsername": "RWander",
|
||||
"url": "https://github.com/RWander"
|
||||
},
|
||||
{
|
||||
"name": "Leon Yu",
|
||||
"githubUsername": "leonyu",
|
||||
"url": "https://github.com/leonyu"
|
||||
},
|
||||
{
|
||||
"name": "Belinda Teh",
|
||||
"githubUsername": "tehbelinda",
|
||||
"url": "https://github.com/tehbelinda"
|
||||
},
|
||||
{
|
||||
"name": "Melvin Lee",
|
||||
"githubUsername": "zyml",
|
||||
"url": "https://github.com/zyml"
|
||||
},
|
||||
{
|
||||
"name": "Arturs Vonda",
|
||||
"githubUsername": "artursvonda",
|
||||
"url": "https://github.com/artursvonda"
|
||||
},
|
||||
{
|
||||
"name": "Carlos Bonetti",
|
||||
"githubUsername": "CarlosBonetti",
|
||||
"url": "https://github.com/CarlosBonetti"
|
||||
},
|
||||
{
|
||||
"name": "Dan Smith",
|
||||
"githubUsername": "dpsmith3",
|
||||
"url": "https://github.com/dpsmith3"
|
||||
},
|
||||
{
|
||||
"name": "Hunter Perrin",
|
||||
"githubUsername": "hperrin",
|
||||
"url": "https://github.com/hperrin"
|
||||
},
|
||||
{
|
||||
"name": "Jordan Harband",
|
||||
"githubUsername": "ljharb",
|
||||
"url": "https://github.com/ljharb"
|
||||
}
|
||||
],
|
||||
"main": "",
|
||||
"types": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/qs"
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {},
|
||||
"peerDependencies": {},
|
||||
"typesPublisherContentHash": "2b3ee00ab119740c8d250fb641a3ab35b4a40a86c735d92f5d6ca12894a1ec0f",
|
||||
"typeScriptVersion": "5.0"
|
||||
}
|
21
node_modules/@types/range-parser/LICENSE
generated
vendored
Normal file
21
node_modules/@types/range-parser/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
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:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
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
|
53
node_modules/@types/range-parser/README.md
generated
vendored
Normal file
53
node_modules/@types/range-parser/README.md
generated
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
# Installation
|
||||
> `npm install --save @types/range-parser`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for range-parser (https://github.com/jshttp/range-parser).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/range-parser.
|
||||
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/range-parser/index.d.ts)
|
||||
````ts
|
||||
/**
|
||||
* When ranges are returned, the array has a "type" property which is the type of
|
||||
* range that is required (most commonly, "bytes"). Each array element is an object
|
||||
* with a "start" and "end" property for the portion of the range.
|
||||
*
|
||||
* @returns `-1` when unsatisfiable and `-2` when syntactically invalid, ranges otherwise.
|
||||
*/
|
||||
declare function RangeParser(
|
||||
size: number,
|
||||
str: string,
|
||||
options?: RangeParser.Options,
|
||||
): RangeParser.Result | RangeParser.Ranges;
|
||||
|
||||
declare namespace RangeParser {
|
||||
interface Ranges extends Array<Range> {
|
||||
type: string;
|
||||
}
|
||||
interface Range {
|
||||
start: number;
|
||||
end: number;
|
||||
}
|
||||
interface Options {
|
||||
/**
|
||||
* The "combine" option can be set to `true` and overlapping & adjacent ranges
|
||||
* will be combined into a single range.
|
||||
*/
|
||||
combine?: boolean | undefined;
|
||||
}
|
||||
type ResultUnsatisfiable = -1;
|
||||
type ResultInvalid = -2;
|
||||
type Result = ResultUnsatisfiable | ResultInvalid;
|
||||
}
|
||||
|
||||
export = RangeParser;
|
||||
|
||||
````
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Tue, 07 Nov 2023 09:09:39 GMT
|
||||
* Dependencies: none
|
||||
|
||||
# Credits
|
||||
These definitions were written by [Tomek Łaziuk](https://github.com/tlaziuk).
|
34
node_modules/@types/range-parser/index.d.ts
generated
vendored
Normal file
34
node_modules/@types/range-parser/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* When ranges are returned, the array has a "type" property which is the type of
|
||||
* range that is required (most commonly, "bytes"). Each array element is an object
|
||||
* with a "start" and "end" property for the portion of the range.
|
||||
*
|
||||
* @returns `-1` when unsatisfiable and `-2` when syntactically invalid, ranges otherwise.
|
||||
*/
|
||||
declare function RangeParser(
|
||||
size: number,
|
||||
str: string,
|
||||
options?: RangeParser.Options,
|
||||
): RangeParser.Result | RangeParser.Ranges;
|
||||
|
||||
declare namespace RangeParser {
|
||||
interface Ranges extends Array<Range> {
|
||||
type: string;
|
||||
}
|
||||
interface Range {
|
||||
start: number;
|
||||
end: number;
|
||||
}
|
||||
interface Options {
|
||||
/**
|
||||
* The "combine" option can be set to `true` and overlapping & adjacent ranges
|
||||
* will be combined into a single range.
|
||||
*/
|
||||
combine?: boolean | undefined;
|
||||
}
|
||||
type ResultUnsatisfiable = -1;
|
||||
type ResultInvalid = -2;
|
||||
type Result = ResultUnsatisfiable | ResultInvalid;
|
||||
}
|
||||
|
||||
export = RangeParser;
|
25
node_modules/@types/range-parser/package.json
generated
vendored
Normal file
25
node_modules/@types/range-parser/package.json
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"name": "@types/range-parser",
|
||||
"version": "1.2.7",
|
||||
"description": "TypeScript definitions for range-parser",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/range-parser",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Tomek Łaziuk",
|
||||
"githubUsername": "tlaziuk",
|
||||
"url": "https://github.com/tlaziuk"
|
||||
}
|
||||
],
|
||||
"main": "",
|
||||
"types": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/range-parser"
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {},
|
||||
"typesPublisherContentHash": "85ed88e3afe8da85360c400901b67e99a7c6690c6376c5ab8939ae9dee4b0a93",
|
||||
"typeScriptVersion": "4.5"
|
||||
}
|
21
node_modules/@types/send/LICENSE
generated
vendored
Normal file
21
node_modules/@types/send/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
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:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
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
|
15
node_modules/@types/send/README.md
generated
vendored
Normal file
15
node_modules/@types/send/README.md
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Installation
|
||||
> `npm install --save @types/send`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for send (https://github.com/pillarjs/send).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/send.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Tue, 07 Nov 2023 15:11:36 GMT
|
||||
* Dependencies: [@types/mime](https://npmjs.com/package/@types/mime), [@types/node](https://npmjs.com/package/@types/node)
|
||||
|
||||
# Credits
|
||||
These definitions were written by [Mike Jerred](https://github.com/MikeJerred), and [Piotr Błażejewicz](https://github.com/peterblazejewicz).
|
225
node_modules/@types/send/index.d.ts
generated
vendored
Normal file
225
node_modules/@types/send/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,225 @@
|
|||
/// <reference types="node" />
|
||||
|
||||
import * as fs from "fs";
|
||||
import * as m from "mime";
|
||||
import * as stream from "stream";
|
||||
|
||||
/**
|
||||
* Create a new SendStream for the given path to send to a res.
|
||||
* The req is the Node.js HTTP request and the path is a urlencoded path to send (urlencoded, not the actual file-system path).
|
||||
*/
|
||||
declare function send(req: stream.Readable, path: string, options?: send.SendOptions): send.SendStream;
|
||||
|
||||
declare namespace send {
|
||||
const mime: typeof m;
|
||||
interface SendOptions {
|
||||
/**
|
||||
* Enable or disable accepting ranged requests, defaults to true.
|
||||
* Disabling this will not send Accept-Ranges and ignore the contents of the Range request header.
|
||||
*/
|
||||
acceptRanges?: boolean | undefined;
|
||||
|
||||
/**
|
||||
* Enable or disable setting Cache-Control response header, defaults to true.
|
||||
* Disabling this will ignore the maxAge option.
|
||||
*/
|
||||
cacheControl?: boolean | undefined;
|
||||
|
||||
/**
|
||||
* Set how "dotfiles" are treated when encountered.
|
||||
* A dotfile is a file or directory that begins with a dot (".").
|
||||
* Note this check is done on the path itself without checking if the path actually exists on the disk.
|
||||
* If root is specified, only the dotfiles above the root are checked (i.e. the root itself can be within a dotfile when when set to "deny").
|
||||
* 'allow' No special treatment for dotfiles.
|
||||
* 'deny' Send a 403 for any request for a dotfile.
|
||||
* 'ignore' Pretend like the dotfile does not exist and 404.
|
||||
* The default value is similar to 'ignore', with the exception that this default will not ignore the files within a directory that begins with a dot, for backward-compatibility.
|
||||
*/
|
||||
dotfiles?: "allow" | "deny" | "ignore" | undefined;
|
||||
|
||||
/**
|
||||
* Byte offset at which the stream ends, defaults to the length of the file minus 1.
|
||||
* The end is inclusive in the stream, meaning end: 3 will include the 4th byte in the stream.
|
||||
*/
|
||||
end?: number | undefined;
|
||||
|
||||
/**
|
||||
* Enable or disable etag generation, defaults to true.
|
||||
*/
|
||||
etag?: boolean | undefined;
|
||||
|
||||
/**
|
||||
* If a given file doesn't exist, try appending one of the given extensions, in the given order.
|
||||
* By default, this is disabled (set to false).
|
||||
* An example value that will serve extension-less HTML files: ['html', 'htm'].
|
||||
* This is skipped if the requested file already has an extension.
|
||||
*/
|
||||
extensions?: string[] | string | boolean | undefined;
|
||||
|
||||
/**
|
||||
* Enable or disable the immutable directive in the Cache-Control response header, defaults to false.
|
||||
* If set to true, the maxAge option should also be specified to enable caching.
|
||||
* The immutable directive will prevent supported clients from making conditional requests during the life of the maxAge option to check if the file has changed.
|
||||
* @default false
|
||||
*/
|
||||
immutable?: boolean | undefined;
|
||||
|
||||
/**
|
||||
* By default send supports "index.html" files, to disable this set false or to supply a new index pass a string or an array in preferred order.
|
||||
*/
|
||||
index?: string[] | string | boolean | undefined;
|
||||
|
||||
/**
|
||||
* Enable or disable Last-Modified header, defaults to true.
|
||||
* Uses the file system's last modified value.
|
||||
*/
|
||||
lastModified?: boolean | undefined;
|
||||
|
||||
/**
|
||||
* Provide a max-age in milliseconds for http caching, defaults to 0.
|
||||
* This can also be a string accepted by the ms module.
|
||||
*/
|
||||
maxAge?: string | number | undefined;
|
||||
|
||||
/**
|
||||
* Serve files relative to path.
|
||||
*/
|
||||
root?: string | undefined;
|
||||
|
||||
/**
|
||||
* Byte offset at which the stream starts, defaults to 0.
|
||||
* The start is inclusive, meaning start: 2 will include the 3rd byte in the stream.
|
||||
*/
|
||||
start?: number | undefined;
|
||||
}
|
||||
|
||||
interface SendStream extends stream.Stream {
|
||||
/**
|
||||
* @deprecated pass etag as option
|
||||
* Enable or disable etag generation.
|
||||
*/
|
||||
etag(val: boolean): SendStream;
|
||||
|
||||
/**
|
||||
* @deprecated use dotfiles option
|
||||
* Enable or disable "hidden" (dot) files.
|
||||
*/
|
||||
hidden(val: boolean): SendStream;
|
||||
|
||||
/**
|
||||
* @deprecated pass index as option
|
||||
* Set index `paths`, set to a falsy value to disable index support.
|
||||
*/
|
||||
index(paths: string[] | string): SendStream;
|
||||
|
||||
/**
|
||||
* @deprecated pass root as option
|
||||
* Set root `path`.
|
||||
*/
|
||||
root(paths: string): SendStream;
|
||||
|
||||
/**
|
||||
* @deprecated pass root as option
|
||||
* Set root `path`.
|
||||
*/
|
||||
from(paths: string): SendStream;
|
||||
|
||||
/**
|
||||
* @deprecated pass maxAge as option
|
||||
* Set max-age to `maxAge`.
|
||||
*/
|
||||
maxage(maxAge: string | number): SendStream;
|
||||
|
||||
/**
|
||||
* Emit error with `status`.
|
||||
*/
|
||||
error(status: number, error?: Error): void;
|
||||
|
||||
/**
|
||||
* Check if the pathname ends with "/".
|
||||
*/
|
||||
hasTrailingSlash(): boolean;
|
||||
|
||||
/**
|
||||
* Check if this is a conditional GET request.
|
||||
*/
|
||||
isConditionalGET(): boolean;
|
||||
|
||||
/**
|
||||
* Strip content-* header fields.
|
||||
*/
|
||||
removeContentHeaderFields(): void;
|
||||
|
||||
/**
|
||||
* Respond with 304 not modified.
|
||||
*/
|
||||
notModified(): void;
|
||||
|
||||
/**
|
||||
* Raise error that headers already sent.
|
||||
*/
|
||||
headersAlreadySent(): void;
|
||||
|
||||
/**
|
||||
* Check if the request is cacheable, aka responded with 2xx or 304 (see RFC 2616 section 14.2{5,6}).
|
||||
*/
|
||||
isCachable(): boolean;
|
||||
|
||||
/**
|
||||
* Handle stat() error.
|
||||
*/
|
||||
onStatError(error: Error): void;
|
||||
|
||||
/**
|
||||
* Check if the cache is fresh.
|
||||
*/
|
||||
isFresh(): boolean;
|
||||
|
||||
/**
|
||||
* Check if the range is fresh.
|
||||
*/
|
||||
isRangeFresh(): boolean;
|
||||
|
||||
/**
|
||||
* Redirect to path.
|
||||
*/
|
||||
redirect(path: string): void;
|
||||
|
||||
/**
|
||||
* Pipe to `res`.
|
||||
*/
|
||||
pipe<T extends NodeJS.WritableStream>(res: T): T;
|
||||
|
||||
/**
|
||||
* Transfer `path`.
|
||||
*/
|
||||
send(path: string, stat?: fs.Stats): void;
|
||||
|
||||
/**
|
||||
* Transfer file for `path`.
|
||||
*/
|
||||
sendFile(path: string): void;
|
||||
|
||||
/**
|
||||
* Transfer index for `path`.
|
||||
*/
|
||||
sendIndex(path: string): void;
|
||||
|
||||
/**
|
||||
* Transfer index for `path`.
|
||||
*/
|
||||
stream(path: string, options?: {}): void;
|
||||
|
||||
/**
|
||||
* Set content-type based on `path` if it hasn't been explicitly set.
|
||||
*/
|
||||
type(path: string): void;
|
||||
|
||||
/**
|
||||
* Set response header fields, most fields may be pre-defined.
|
||||
*/
|
||||
setHeader(path: string, stat: fs.Stats): void;
|
||||
}
|
||||
}
|
||||
|
||||
export = send;
|
33
node_modules/@types/send/package.json
generated
vendored
Normal file
33
node_modules/@types/send/package.json
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"name": "@types/send",
|
||||
"version": "0.17.4",
|
||||
"description": "TypeScript definitions for send",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/send",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Mike Jerred",
|
||||
"githubUsername": "MikeJerred",
|
||||
"url": "https://github.com/MikeJerred"
|
||||
},
|
||||
{
|
||||
"name": "Piotr Błażejewicz",
|
||||
"githubUsername": "peterblazejewicz",
|
||||
"url": "https://github.com/peterblazejewicz"
|
||||
}
|
||||
],
|
||||
"main": "",
|
||||
"types": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/send"
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {
|
||||
"@types/mime": "^1",
|
||||
"@types/node": "*"
|
||||
},
|
||||
"typesPublisherContentHash": "80c2c0bda207c1a802cfc46bf20e4f774429c8ae1e9808128c20468d438b895c",
|
||||
"typeScriptVersion": "4.5"
|
||||
}
|
21
node_modules/@types/serve-static/LICENSE
generated
vendored
Normal file
21
node_modules/@types/serve-static/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
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:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
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
|
15
node_modules/@types/serve-static/README.md
generated
vendored
Normal file
15
node_modules/@types/serve-static/README.md
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Installation
|
||||
> `npm install --save @types/serve-static`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for serve-static (https://github.com/expressjs/serve-static).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/serve-static.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Wed, 03 Apr 2024 06:07:52 GMT
|
||||
* Dependencies: [@types/http-errors](https://npmjs.com/package/@types/http-errors), [@types/node](https://npmjs.com/package/@types/node), [@types/send](https://npmjs.com/package/@types/send)
|
||||
|
||||
# Credits
|
||||
These definitions were written by [Uros Smolnik](https://github.com/urossmolnik), [Linus Unnebäck](https://github.com/LinusU), and [Devansh Jethmalani](https://github.com/devanshj).
|
107
node_modules/@types/serve-static/index.d.ts
generated
vendored
Normal file
107
node_modules/@types/serve-static/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,107 @@
|
|||
/// <reference types="node" />
|
||||
import * as http from "http";
|
||||
import { HttpError } from "http-errors";
|
||||
import * as send from "send";
|
||||
|
||||
/**
|
||||
* Create a new middleware function to serve files from within a given root directory.
|
||||
* The file to serve will be determined by combining req.url with the provided root directory.
|
||||
* When a file is not found, instead of sending a 404 response, this module will instead call next() to move on to the next middleware, allowing for stacking and fall-backs.
|
||||
*/
|
||||
declare function serveStatic<R extends http.ServerResponse>(
|
||||
root: string,
|
||||
options?: serveStatic.ServeStaticOptions<R>,
|
||||
): serveStatic.RequestHandler<R>;
|
||||
|
||||
declare namespace serveStatic {
|
||||
var mime: typeof send.mime;
|
||||
interface ServeStaticOptions<R extends http.ServerResponse = http.ServerResponse> {
|
||||
/**
|
||||
* Enable or disable accepting ranged requests, defaults to true.
|
||||
* Disabling this will not send Accept-Ranges and ignore the contents of the Range request header.
|
||||
*/
|
||||
acceptRanges?: boolean | undefined;
|
||||
|
||||
/**
|
||||
* Enable or disable setting Cache-Control response header, defaults to true.
|
||||
* Disabling this will ignore the immutable and maxAge options.
|
||||
*/
|
||||
cacheControl?: boolean | undefined;
|
||||
|
||||
/**
|
||||
* Set how "dotfiles" are treated when encountered. A dotfile is a file or directory that begins with a dot (".").
|
||||
* Note this check is done on the path itself without checking if the path actually exists on the disk.
|
||||
* If root is specified, only the dotfiles above the root are checked (i.e. the root itself can be within a dotfile when when set to "deny").
|
||||
* The default value is 'ignore'.
|
||||
* 'allow' No special treatment for dotfiles
|
||||
* 'deny' Send a 403 for any request for a dotfile
|
||||
* 'ignore' Pretend like the dotfile does not exist and call next()
|
||||
*/
|
||||
dotfiles?: string | undefined;
|
||||
|
||||
/**
|
||||
* Enable or disable etag generation, defaults to true.
|
||||
*/
|
||||
etag?: boolean | undefined;
|
||||
|
||||
/**
|
||||
* Set file extension fallbacks. When set, if a file is not found, the given extensions will be added to the file name and search for.
|
||||
* The first that exists will be served. Example: ['html', 'htm'].
|
||||
* The default value is false.
|
||||
*/
|
||||
extensions?: string[] | false | undefined;
|
||||
|
||||
/**
|
||||
* Let client errors fall-through as unhandled requests, otherwise forward a client error.
|
||||
* The default value is true.
|
||||
*/
|
||||
fallthrough?: boolean | undefined;
|
||||
|
||||
/**
|
||||
* Enable or disable the immutable directive in the Cache-Control response header.
|
||||
* If enabled, the maxAge option should also be specified to enable caching. The immutable directive will prevent supported clients from making conditional requests during the life of the maxAge option to check if the file has changed.
|
||||
*/
|
||||
immutable?: boolean | undefined;
|
||||
|
||||
/**
|
||||
* By default this module will send "index.html" files in response to a request on a directory.
|
||||
* To disable this set false or to supply a new index pass a string or an array in preferred order.
|
||||
*/
|
||||
index?: boolean | string | string[] | undefined;
|
||||
|
||||
/**
|
||||
* Enable or disable Last-Modified header, defaults to true. Uses the file system's last modified value.
|
||||
*/
|
||||
lastModified?: boolean | undefined;
|
||||
|
||||
/**
|
||||
* Provide a max-age in milliseconds for http caching, defaults to 0. This can also be a string accepted by the ms module.
|
||||
*/
|
||||
maxAge?: number | string | undefined;
|
||||
|
||||
/**
|
||||
* Redirect to trailing "/" when the pathname is a dir. Defaults to true.
|
||||
*/
|
||||
redirect?: boolean | undefined;
|
||||
|
||||
/**
|
||||
* Function to set custom headers on response. Alterations to the headers need to occur synchronously.
|
||||
* The function is called as fn(res, path, stat), where the arguments are:
|
||||
* res the response object
|
||||
* path the file path that is being sent
|
||||
* stat the stat object of the file that is being sent
|
||||
*/
|
||||
setHeaders?: ((res: R, path: string, stat: any) => any) | undefined;
|
||||
}
|
||||
|
||||
interface RequestHandler<R extends http.ServerResponse> {
|
||||
(request: http.IncomingMessage, response: R, next: (err?: HttpError) => void): any;
|
||||
}
|
||||
|
||||
interface RequestHandlerConstructor<R extends http.ServerResponse> {
|
||||
(root: string, options?: ServeStaticOptions<R>): RequestHandler<R>;
|
||||
mime: typeof send.mime;
|
||||
}
|
||||
}
|
||||
|
||||
export = serveStatic;
|
39
node_modules/@types/serve-static/package.json
generated
vendored
Normal file
39
node_modules/@types/serve-static/package.json
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"name": "@types/serve-static",
|
||||
"version": "1.15.7",
|
||||
"description": "TypeScript definitions for serve-static",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/serve-static",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Uros Smolnik",
|
||||
"githubUsername": "urossmolnik",
|
||||
"url": "https://github.com/urossmolnik"
|
||||
},
|
||||
{
|
||||
"name": "Linus Unnebäck",
|
||||
"githubUsername": "LinusU",
|
||||
"url": "https://github.com/LinusU"
|
||||
},
|
||||
{
|
||||
"name": "Devansh Jethmalani",
|
||||
"githubUsername": "devanshj",
|
||||
"url": "https://github.com/devanshj"
|
||||
}
|
||||
],
|
||||
"main": "",
|
||||
"types": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/serve-static"
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {
|
||||
"@types/http-errors": "*",
|
||||
"@types/node": "*",
|
||||
"@types/send": "*"
|
||||
},
|
||||
"typesPublisherContentHash": "781872d0ec274d5e3360acd4087e25d9d8440401b99181fe8cd1fc968aa78b14",
|
||||
"typeScriptVersion": "4.7"
|
||||
}
|
250
node_modules/accepts/HISTORY.md
generated
vendored
Normal file
250
node_modules/accepts/HISTORY.md
generated
vendored
Normal file
|
@ -0,0 +1,250 @@
|
|||
2.0.0 / 2024-08-31
|
||||
==================
|
||||
|
||||
* Drop node <18 support
|
||||
* deps: mime-types@^3.0.0
|
||||
* deps: negotiator@^1.0.0
|
||||
|
||||
1.3.8 / 2022-02-02
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.34
|
||||
- deps: mime-db@~1.51.0
|
||||
* deps: negotiator@0.6.3
|
||||
|
||||
1.3.7 / 2019-04-29
|
||||
==================
|
||||
|
||||
* deps: negotiator@0.6.2
|
||||
- Fix sorting charset, encoding, and language with extra parameters
|
||||
|
||||
1.3.6 / 2019-04-28
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.24
|
||||
- deps: mime-db@~1.40.0
|
||||
|
||||
1.3.5 / 2018-02-28
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.18
|
||||
- deps: mime-db@~1.33.0
|
||||
|
||||
1.3.4 / 2017-08-22
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.16
|
||||
- deps: mime-db@~1.29.0
|
||||
|
||||
1.3.3 / 2016-05-02
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.11
|
||||
- deps: mime-db@~1.23.0
|
||||
* deps: negotiator@0.6.1
|
||||
- perf: improve `Accept` parsing speed
|
||||
- perf: improve `Accept-Charset` parsing speed
|
||||
- perf: improve `Accept-Encoding` parsing speed
|
||||
- perf: improve `Accept-Language` parsing speed
|
||||
|
||||
1.3.2 / 2016-03-08
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.10
|
||||
- Fix extension of `application/dash+xml`
|
||||
- Update primary extension for `audio/mp4`
|
||||
- deps: mime-db@~1.22.0
|
||||
|
||||
1.3.1 / 2016-01-19
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.9
|
||||
- deps: mime-db@~1.21.0
|
||||
|
||||
1.3.0 / 2015-09-29
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.7
|
||||
- deps: mime-db@~1.19.0
|
||||
* deps: negotiator@0.6.0
|
||||
- Fix including type extensions in parameters in `Accept` parsing
|
||||
- Fix parsing `Accept` parameters with quoted equals
|
||||
- Fix parsing `Accept` parameters with quoted semicolons
|
||||
- Lazy-load modules from main entry point
|
||||
- perf: delay type concatenation until needed
|
||||
- perf: enable strict mode
|
||||
- perf: hoist regular expressions
|
||||
- perf: remove closures getting spec properties
|
||||
- perf: remove a closure from media type parsing
|
||||
- perf: remove property delete from media type parsing
|
||||
|
||||
1.2.13 / 2015-09-06
|
||||
===================
|
||||
|
||||
* deps: mime-types@~2.1.6
|
||||
- deps: mime-db@~1.18.0
|
||||
|
||||
1.2.12 / 2015-07-30
|
||||
===================
|
||||
|
||||
* deps: mime-types@~2.1.4
|
||||
- deps: mime-db@~1.16.0
|
||||
|
||||
1.2.11 / 2015-07-16
|
||||
===================
|
||||
|
||||
* deps: mime-types@~2.1.3
|
||||
- deps: mime-db@~1.15.0
|
||||
|
||||
1.2.10 / 2015-07-01
|
||||
===================
|
||||
|
||||
* deps: mime-types@~2.1.2
|
||||
- deps: mime-db@~1.14.0
|
||||
|
||||
1.2.9 / 2015-06-08
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.1
|
||||
- perf: fix deopt during mapping
|
||||
|
||||
1.2.8 / 2015-06-07
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.0
|
||||
- deps: mime-db@~1.13.0
|
||||
* perf: avoid argument reassignment & argument slice
|
||||
* perf: avoid negotiator recursive construction
|
||||
* perf: enable strict mode
|
||||
* perf: remove unnecessary bitwise operator
|
||||
|
||||
1.2.7 / 2015-05-10
|
||||
==================
|
||||
|
||||
* deps: negotiator@0.5.3
|
||||
- Fix media type parameter matching to be case-insensitive
|
||||
|
||||
1.2.6 / 2015-05-07
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.11
|
||||
- deps: mime-db@~1.9.1
|
||||
* deps: negotiator@0.5.2
|
||||
- Fix comparing media types with quoted values
|
||||
- Fix splitting media types with quoted commas
|
||||
|
||||
1.2.5 / 2015-03-13
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.10
|
||||
- deps: mime-db@~1.8.0
|
||||
|
||||
1.2.4 / 2015-02-14
|
||||
==================
|
||||
|
||||
* Support Node.js 0.6
|
||||
* deps: mime-types@~2.0.9
|
||||
- deps: mime-db@~1.7.0
|
||||
* deps: negotiator@0.5.1
|
||||
- Fix preference sorting to be stable for long acceptable lists
|
||||
|
||||
1.2.3 / 2015-01-31
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.8
|
||||
- deps: mime-db@~1.6.0
|
||||
|
||||
1.2.2 / 2014-12-30
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.7
|
||||
- deps: mime-db@~1.5.0
|
||||
|
||||
1.2.1 / 2014-12-30
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.5
|
||||
- deps: mime-db@~1.3.1
|
||||
|
||||
1.2.0 / 2014-12-19
|
||||
==================
|
||||
|
||||
* deps: negotiator@0.5.0
|
||||
- Fix list return order when large accepted list
|
||||
- Fix missing identity encoding when q=0 exists
|
||||
- Remove dynamic building of Negotiator class
|
||||
|
||||
1.1.4 / 2014-12-10
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.4
|
||||
- deps: mime-db@~1.3.0
|
||||
|
||||
1.1.3 / 2014-11-09
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.3
|
||||
- deps: mime-db@~1.2.0
|
||||
|
||||
1.1.2 / 2014-10-14
|
||||
==================
|
||||
|
||||
* deps: negotiator@0.4.9
|
||||
- Fix error when media type has invalid parameter
|
||||
|
||||
1.1.1 / 2014-09-28
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.2
|
||||
- deps: mime-db@~1.1.0
|
||||
* deps: negotiator@0.4.8
|
||||
- Fix all negotiations to be case-insensitive
|
||||
- Stable sort preferences of same quality according to client order
|
||||
|
||||
1.1.0 / 2014-09-02
|
||||
==================
|
||||
|
||||
* update `mime-types`
|
||||
|
||||
1.0.7 / 2014-07-04
|
||||
==================
|
||||
|
||||
* Fix wrong type returned from `type` when match after unknown extension
|
||||
|
||||
1.0.6 / 2014-06-24
|
||||
==================
|
||||
|
||||
* deps: negotiator@0.4.7
|
||||
|
||||
1.0.5 / 2014-06-20
|
||||
==================
|
||||
|
||||
* fix crash when unknown extension given
|
||||
|
||||
1.0.4 / 2014-06-19
|
||||
==================
|
||||
|
||||
* use `mime-types`
|
||||
|
||||
1.0.3 / 2014-06-11
|
||||
==================
|
||||
|
||||
* deps: negotiator@0.4.6
|
||||
- Order by specificity when quality is the same
|
||||
|
||||
1.0.2 / 2014-05-29
|
||||
==================
|
||||
|
||||
* Fix interpretation when header not in request
|
||||
* deps: pin negotiator@0.4.5
|
||||
|
||||
1.0.1 / 2014-01-18
|
||||
==================
|
||||
|
||||
* Identity encoding isn't always acceptable
|
||||
* deps: negotiator@~0.4.0
|
||||
|
||||
1.0.0 / 2013-12-27
|
||||
==================
|
||||
|
||||
* Genesis
|
23
node_modules/accepts/LICENSE
generated
vendored
Normal file
23
node_modules/accepts/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
||||
Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||
|
||||
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:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
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.
|
140
node_modules/accepts/README.md
generated
vendored
Normal file
140
node_modules/accepts/README.md
generated
vendored
Normal file
|
@ -0,0 +1,140 @@
|
|||
# accepts
|
||||
|
||||
[![NPM Version][npm-version-image]][npm-url]
|
||||
[![NPM Downloads][npm-downloads-image]][npm-url]
|
||||
[![Node.js Version][node-version-image]][node-version-url]
|
||||
[![Build Status][github-actions-ci-image]][github-actions-ci-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator).
|
||||
Extracted from [koa](https://www.npmjs.com/package/koa) for general use.
|
||||
|
||||
In addition to negotiator, it allows:
|
||||
|
||||
- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])`
|
||||
as well as `('text/html', 'application/json')`.
|
||||
- Allows type shorthands such as `json`.
|
||||
- Returns `false` when no types match
|
||||
- Treats non-existent headers as `*`
|
||||
|
||||
## Installation
|
||||
|
||||
This is a [Node.js](https://nodejs.org/en/) module available through the
|
||||
[npm registry](https://www.npmjs.com/). Installation is done using the
|
||||
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
||||
|
||||
```sh
|
||||
$ npm install accepts
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var accepts = require('accepts')
|
||||
```
|
||||
|
||||
### accepts(req)
|
||||
|
||||
Create a new `Accepts` object for the given `req`.
|
||||
|
||||
#### .charset(charsets)
|
||||
|
||||
Return the first accepted charset. If nothing in `charsets` is accepted,
|
||||
then `false` is returned.
|
||||
|
||||
#### .charsets()
|
||||
|
||||
Return the charsets that the request accepts, in the order of the client's
|
||||
preference (most preferred first).
|
||||
|
||||
#### .encoding(encodings)
|
||||
|
||||
Return the first accepted encoding. If nothing in `encodings` is accepted,
|
||||
then `false` is returned.
|
||||
|
||||
#### .encodings()
|
||||
|
||||
Return the encodings that the request accepts, in the order of the client's
|
||||
preference (most preferred first).
|
||||
|
||||
#### .language(languages)
|
||||
|
||||
Return the first accepted language. If nothing in `languages` is accepted,
|
||||
then `false` is returned.
|
||||
|
||||
#### .languages()
|
||||
|
||||
Return the languages that the request accepts, in the order of the client's
|
||||
preference (most preferred first).
|
||||
|
||||
#### .type(types)
|
||||
|
||||
Return the first accepted type (and it is returned as the same text as what
|
||||
appears in the `types` array). If nothing in `types` is accepted, then `false`
|
||||
is returned.
|
||||
|
||||
The `types` array can contain full MIME types or file extensions. Any value
|
||||
that is not a full MIME type is passed to `require('mime-types').lookup`.
|
||||
|
||||
#### .types()
|
||||
|
||||
Return the types that the request accepts, in the order of the client's
|
||||
preference (most preferred first).
|
||||
|
||||
## Examples
|
||||
|
||||
### Simple type negotiation
|
||||
|
||||
This simple example shows how to use `accepts` to return a different typed
|
||||
respond body based on what the client wants to accept. The server lists it's
|
||||
preferences in order and will get back the best match between the client and
|
||||
server.
|
||||
|
||||
```js
|
||||
var accepts = require('accepts')
|
||||
var http = require('http')
|
||||
|
||||
function app (req, res) {
|
||||
var accept = accepts(req)
|
||||
|
||||
// the order of this list is significant; should be server preferred order
|
||||
switch (accept.type(['json', 'html'])) {
|
||||
case 'json':
|
||||
res.setHeader('Content-Type', 'application/json')
|
||||
res.write('{"hello":"world!"}')
|
||||
break
|
||||
case 'html':
|
||||
res.setHeader('Content-Type', 'text/html')
|
||||
res.write('<b>hello, world!</b>')
|
||||
break
|
||||
default:
|
||||
// the fallback is text/plain, so no need to specify it above
|
||||
res.setHeader('Content-Type', 'text/plain')
|
||||
res.write('hello, world!')
|
||||
break
|
||||
}
|
||||
|
||||
res.end()
|
||||
}
|
||||
|
||||
http.createServer(app).listen(3000)
|
||||
```
|
||||
|
||||
You can test this out with the cURL program:
|
||||
```sh
|
||||
curl -I -H'Accept: text/html' http://localhost:3000/
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/accepts/master
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/accepts?branch=master
|
||||
[github-actions-ci-image]: https://badgen.net/github/checks/jshttp/accepts/master?label=ci
|
||||
[github-actions-ci-url]: https://github.com/jshttp/accepts/actions/workflows/ci.yml
|
||||
[node-version-image]: https://badgen.net/npm/node/accepts
|
||||
[node-version-url]: https://nodejs.org/en/download
|
||||
[npm-downloads-image]: https://badgen.net/npm/dm/accepts
|
||||
[npm-url]: https://npmjs.org/package/accepts
|
||||
[npm-version-image]: https://badgen.net/npm/v/accepts
|
238
node_modules/accepts/index.js
generated
vendored
Normal file
238
node_modules/accepts/index.js
generated
vendored
Normal file
|
@ -0,0 +1,238 @@
|
|||
/*!
|
||||
* accepts
|
||||
* Copyright(c) 2014 Jonathan Ong
|
||||
* Copyright(c) 2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var Negotiator = require('negotiator')
|
||||
var mime = require('mime-types')
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = Accepts
|
||||
|
||||
/**
|
||||
* Create a new Accepts object for the given req.
|
||||
*
|
||||
* @param {object} req
|
||||
* @public
|
||||
*/
|
||||
|
||||
function Accepts (req) {
|
||||
if (!(this instanceof Accepts)) {
|
||||
return new Accepts(req)
|
||||
}
|
||||
|
||||
this.headers = req.headers
|
||||
this.negotiator = new Negotiator(req)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given `type(s)` is acceptable, returning
|
||||
* the best match when true, otherwise `undefined`, in which
|
||||
* case you should respond with 406 "Not Acceptable".
|
||||
*
|
||||
* The `type` value may be a single mime type string
|
||||
* such as "application/json", the extension name
|
||||
* such as "json" or an array `["json", "html", "text/plain"]`. When a list
|
||||
* or array is given the _best_ match, if any is returned.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* // Accept: text/html
|
||||
* this.types('html');
|
||||
* // => "html"
|
||||
*
|
||||
* // Accept: text/*, application/json
|
||||
* this.types('html');
|
||||
* // => "html"
|
||||
* this.types('text/html');
|
||||
* // => "text/html"
|
||||
* this.types('json', 'text');
|
||||
* // => "json"
|
||||
* this.types('application/json');
|
||||
* // => "application/json"
|
||||
*
|
||||
* // Accept: text/*, application/json
|
||||
* this.types('image/png');
|
||||
* this.types('png');
|
||||
* // => undefined
|
||||
*
|
||||
* // Accept: text/*;q=.5, application/json
|
||||
* this.types(['html', 'json']);
|
||||
* this.types('html', 'json');
|
||||
* // => "json"
|
||||
*
|
||||
* @param {String|Array} types...
|
||||
* @return {String|Array|Boolean}
|
||||
* @public
|
||||
*/
|
||||
|
||||
Accepts.prototype.type =
|
||||
Accepts.prototype.types = function (types_) {
|
||||
var types = types_
|
||||
|
||||
// support flattened arguments
|
||||
if (types && !Array.isArray(types)) {
|
||||
types = new Array(arguments.length)
|
||||
for (var i = 0; i < types.length; i++) {
|
||||
types[i] = arguments[i]
|
||||
}
|
||||
}
|
||||
|
||||
// no types, return all requested types
|
||||
if (!types || types.length === 0) {
|
||||
return this.negotiator.mediaTypes()
|
||||
}
|
||||
|
||||
// no accept header, return first given type
|
||||
if (!this.headers.accept) {
|
||||
return types[0]
|
||||
}
|
||||
|
||||
var mimes = types.map(extToMime)
|
||||
var accepts = this.negotiator.mediaTypes(mimes.filter(validMime))
|
||||
var first = accepts[0]
|
||||
|
||||
return first
|
||||
? types[mimes.indexOf(first)]
|
||||
: false
|
||||
}
|
||||
|
||||
/**
|
||||
* Return accepted encodings or best fit based on `encodings`.
|
||||
*
|
||||
* Given `Accept-Encoding: gzip, deflate`
|
||||
* an array sorted by quality is returned:
|
||||
*
|
||||
* ['gzip', 'deflate']
|
||||
*
|
||||
* @param {String|Array} encodings...
|
||||
* @return {String|Array}
|
||||
* @public
|
||||
*/
|
||||
|
||||
Accepts.prototype.encoding =
|
||||
Accepts.prototype.encodings = function (encodings_) {
|
||||
var encodings = encodings_
|
||||
|
||||
// support flattened arguments
|
||||
if (encodings && !Array.isArray(encodings)) {
|
||||
encodings = new Array(arguments.length)
|
||||
for (var i = 0; i < encodings.length; i++) {
|
||||
encodings[i] = arguments[i]
|
||||
}
|
||||
}
|
||||
|
||||
// no encodings, return all requested encodings
|
||||
if (!encodings || encodings.length === 0) {
|
||||
return this.negotiator.encodings()
|
||||
}
|
||||
|
||||
return this.negotiator.encodings(encodings)[0] || false
|
||||
}
|
||||
|
||||
/**
|
||||
* Return accepted charsets or best fit based on `charsets`.
|
||||
*
|
||||
* Given `Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5`
|
||||
* an array sorted by quality is returned:
|
||||
*
|
||||
* ['utf-8', 'utf-7', 'iso-8859-1']
|
||||
*
|
||||
* @param {String|Array} charsets...
|
||||
* @return {String|Array}
|
||||
* @public
|
||||
*/
|
||||
|
||||
Accepts.prototype.charset =
|
||||
Accepts.prototype.charsets = function (charsets_) {
|
||||
var charsets = charsets_
|
||||
|
||||
// support flattened arguments
|
||||
if (charsets && !Array.isArray(charsets)) {
|
||||
charsets = new Array(arguments.length)
|
||||
for (var i = 0; i < charsets.length; i++) {
|
||||
charsets[i] = arguments[i]
|
||||
}
|
||||
}
|
||||
|
||||
// no charsets, return all requested charsets
|
||||
if (!charsets || charsets.length === 0) {
|
||||
return this.negotiator.charsets()
|
||||
}
|
||||
|
||||
return this.negotiator.charsets(charsets)[0] || false
|
||||
}
|
||||
|
||||
/**
|
||||
* Return accepted languages or best fit based on `langs`.
|
||||
*
|
||||
* Given `Accept-Language: en;q=0.8, es, pt`
|
||||
* an array sorted by quality is returned:
|
||||
*
|
||||
* ['es', 'pt', 'en']
|
||||
*
|
||||
* @param {String|Array} langs...
|
||||
* @return {Array|String}
|
||||
* @public
|
||||
*/
|
||||
|
||||
Accepts.prototype.lang =
|
||||
Accepts.prototype.langs =
|
||||
Accepts.prototype.language =
|
||||
Accepts.prototype.languages = function (languages_) {
|
||||
var languages = languages_
|
||||
|
||||
// support flattened arguments
|
||||
if (languages && !Array.isArray(languages)) {
|
||||
languages = new Array(arguments.length)
|
||||
for (var i = 0; i < languages.length; i++) {
|
||||
languages[i] = arguments[i]
|
||||
}
|
||||
}
|
||||
|
||||
// no languages, return all requested languages
|
||||
if (!languages || languages.length === 0) {
|
||||
return this.negotiator.languages()
|
||||
}
|
||||
|
||||
return this.negotiator.languages(languages)[0] || false
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert extnames to mime.
|
||||
*
|
||||
* @param {String} type
|
||||
* @return {String}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function extToMime (type) {
|
||||
return type.indexOf('/') === -1
|
||||
? mime.lookup(type)
|
||||
: type
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if mime is valid.
|
||||
*
|
||||
* @param {String} type
|
||||
* @return {Boolean}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function validMime (type) {
|
||||
return typeof type === 'string'
|
||||
}
|
47
node_modules/accepts/package.json
generated
vendored
Normal file
47
node_modules/accepts/package.json
generated
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
"name": "accepts",
|
||||
"description": "Higher-level content negotiation",
|
||||
"version": "2.0.0",
|
||||
"contributors": [
|
||||
"Douglas Christopher Wilson <doug@somethingdoug.com>",
|
||||
"Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": "jshttp/accepts",
|
||||
"dependencies": {
|
||||
"mime-types": "^3.0.0",
|
||||
"negotiator": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"deep-equal": "1.0.1",
|
||||
"eslint": "7.32.0",
|
||||
"eslint-config-standard": "14.1.1",
|
||||
"eslint-plugin-import": "2.25.4",
|
||||
"eslint-plugin-markdown": "2.2.1",
|
||||
"eslint-plugin-node": "11.1.0",
|
||||
"eslint-plugin-promise": "4.3.1",
|
||||
"eslint-plugin-standard": "4.1.0",
|
||||
"mocha": "9.2.0",
|
||||
"nyc": "15.1.0"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"HISTORY.md",
|
||||
"index.js"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"test": "mocha --reporter spec --check-leaks --bail test/",
|
||||
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
|
||||
"test-cov": "nyc --reporter=html --reporter=text npm test"
|
||||
},
|
||||
"keywords": [
|
||||
"content",
|
||||
"negotiation",
|
||||
"accept",
|
||||
"accepts"
|
||||
]
|
||||
}
|
52
node_modules/basic-auth/HISTORY.md
generated
vendored
Normal file
52
node_modules/basic-auth/HISTORY.md
generated
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
2.0.1 / 2018-09-19
|
||||
==================
|
||||
|
||||
* deps: safe-buffer@5.1.2
|
||||
|
||||
2.0.0 / 2017-09-12
|
||||
==================
|
||||
|
||||
* Drop support for Node.js below 0.8
|
||||
* Remove `auth(ctx)` signature -- pass in header or `auth(ctx.req)`
|
||||
* Use `safe-buffer` for improved Buffer API
|
||||
|
||||
1.1.0 / 2016-11-18
|
||||
==================
|
||||
|
||||
* Add `auth.parse` for low-level string parsing
|
||||
|
||||
1.0.4 / 2016-05-10
|
||||
==================
|
||||
|
||||
* Improve error message when `req` argument is not an object
|
||||
* Improve error message when `req` missing `headers` property
|
||||
|
||||
1.0.3 / 2015-07-01
|
||||
==================
|
||||
|
||||
* Fix regression accepting a Koa context
|
||||
|
||||
1.0.2 / 2015-06-12
|
||||
==================
|
||||
|
||||
* Improve error message when `req` argument missing
|
||||
* perf: enable strict mode
|
||||
* perf: hoist regular expression
|
||||
* perf: parse with regular expressions
|
||||
* perf: remove argument reassignment
|
||||
|
||||
1.0.1 / 2015-05-04
|
||||
==================
|
||||
|
||||
* Update readme
|
||||
|
||||
1.0.0 / 2014-07-01
|
||||
==================
|
||||
|
||||
* Support empty password
|
||||
* Support empty username
|
||||
|
||||
0.0.1 / 2013-11-30
|
||||
==================
|
||||
|
||||
* Initial release
|
24
node_modules/basic-auth/LICENSE
generated
vendored
Normal file
24
node_modules/basic-auth/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
(The MIT License)
|
||||
|
||||
Copyright (c) 2013 TJ Holowaychuk
|
||||
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
||||
Copyright (c) 2015-2016 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||
|
||||
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:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
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.
|
113
node_modules/basic-auth/README.md
generated
vendored
Normal file
113
node_modules/basic-auth/README.md
generated
vendored
Normal file
|
@ -0,0 +1,113 @@
|
|||
# basic-auth
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Node.js Version][node-version-image]][node-version-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
Generic basic auth Authorization header field parser for whatever.
|
||||
|
||||
## Installation
|
||||
|
||||
This is a [Node.js](https://nodejs.org/en/) module available through the
|
||||
[npm registry](https://www.npmjs.com/). Installation is done using the
|
||||
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
||||
|
||||
```
|
||||
$ npm install basic-auth
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
<!-- eslint-disable no-unused-vars -->
|
||||
|
||||
```js
|
||||
var auth = require('basic-auth')
|
||||
```
|
||||
|
||||
### auth(req)
|
||||
|
||||
Get the basic auth credentials from the given request. The `Authorization`
|
||||
header is parsed and if the header is invalid, `undefined` is returned,
|
||||
otherwise an object with `name` and `pass` properties.
|
||||
|
||||
### auth.parse(string)
|
||||
|
||||
Parse a basic auth authorization header string. This will return an object
|
||||
with `name` and `pass` properties, or `undefined` if the string is invalid.
|
||||
|
||||
## Example
|
||||
|
||||
Pass a Node.js request object to the module export. If parsing fails
|
||||
`undefined` is returned, otherwise an object with `.name` and `.pass`.
|
||||
|
||||
<!-- eslint-disable no-unused-vars, no-undef -->
|
||||
|
||||
```js
|
||||
var auth = require('basic-auth')
|
||||
var user = auth(req)
|
||||
// => { name: 'something', pass: 'whatever' }
|
||||
```
|
||||
|
||||
A header string from any other location can also be parsed with
|
||||
`auth.parse`, for example a `Proxy-Authorization` header:
|
||||
|
||||
<!-- eslint-disable no-unused-vars, no-undef -->
|
||||
|
||||
```js
|
||||
var auth = require('basic-auth')
|
||||
var user = auth.parse(req.getHeader('Proxy-Authorization'))
|
||||
```
|
||||
|
||||
### With vanilla node.js http server
|
||||
|
||||
```js
|
||||
var http = require('http')
|
||||
var auth = require('basic-auth')
|
||||
var compare = require('tsscmp')
|
||||
|
||||
// Create server
|
||||
var server = http.createServer(function (req, res) {
|
||||
var credentials = auth(req)
|
||||
|
||||
// Check credentials
|
||||
// The "check" function will typically be against your user store
|
||||
if (!credentials || !check(credentials.name, credentials.pass)) {
|
||||
res.statusCode = 401
|
||||
res.setHeader('WWW-Authenticate', 'Basic realm="example"')
|
||||
res.end('Access denied')
|
||||
} else {
|
||||
res.end('Access granted')
|
||||
}
|
||||
})
|
||||
|
||||
// Basic function to validate credentials for example
|
||||
function check (name, pass) {
|
||||
var valid = true
|
||||
|
||||
// Simple method to prevent short-circut and use timing-safe compare
|
||||
valid = compare(name, 'john') && valid
|
||||
valid = compare(pass, 'secret') && valid
|
||||
|
||||
return valid
|
||||
}
|
||||
|
||||
// Listen
|
||||
server.listen(3000)
|
||||
```
|
||||
|
||||
# License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/basic-auth/master
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/basic-auth?branch=master
|
||||
[downloads-image]: https://badgen.net/npm/dm/basic-auth
|
||||
[downloads-url]: https://npmjs.org/package/basic-auth
|
||||
[node-version-image]: https://badgen.net/npm/node/basic-auth
|
||||
[node-version-url]: https://nodejs.org/en/download
|
||||
[npm-image]: https://badgen.net/npm/v/basic-auth
|
||||
[npm-url]: https://npmjs.org/package/basic-auth
|
||||
[travis-image]: https://badgen.net/travis/jshttp/basic-auth/master
|
||||
[travis-url]: https://travis-ci.org/jshttp/basic-auth
|
133
node_modules/basic-auth/index.js
generated
vendored
Normal file
133
node_modules/basic-auth/index.js
generated
vendored
Normal file
|
@ -0,0 +1,133 @@
|
|||
/*!
|
||||
* basic-auth
|
||||
* Copyright(c) 2013 TJ Holowaychuk
|
||||
* Copyright(c) 2014 Jonathan Ong
|
||||
* Copyright(c) 2015-2016 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var Buffer = require('safe-buffer').Buffer
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = auth
|
||||
module.exports.parse = parse
|
||||
|
||||
/**
|
||||
* RegExp for basic auth credentials
|
||||
*
|
||||
* credentials = auth-scheme 1*SP token68
|
||||
* auth-scheme = "Basic" ; case insensitive
|
||||
* token68 = 1*( ALPHA / DIGIT / "-" / "." / "_" / "~" / "+" / "/" ) *"="
|
||||
* @private
|
||||
*/
|
||||
|
||||
var CREDENTIALS_REGEXP = /^ *(?:[Bb][Aa][Ss][Ii][Cc]) +([A-Za-z0-9._~+/-]+=*) *$/
|
||||
|
||||
/**
|
||||
* RegExp for basic auth user/pass
|
||||
*
|
||||
* user-pass = userid ":" password
|
||||
* userid = *<TEXT excluding ":">
|
||||
* password = *TEXT
|
||||
* @private
|
||||
*/
|
||||
|
||||
var USER_PASS_REGEXP = /^([^:]*):(.*)$/
|
||||
|
||||
/**
|
||||
* Parse the Authorization header field of a request.
|
||||
*
|
||||
* @param {object} req
|
||||
* @return {object} with .name and .pass
|
||||
* @public
|
||||
*/
|
||||
|
||||
function auth (req) {
|
||||
if (!req) {
|
||||
throw new TypeError('argument req is required')
|
||||
}
|
||||
|
||||
if (typeof req !== 'object') {
|
||||
throw new TypeError('argument req is required to be an object')
|
||||
}
|
||||
|
||||
// get header
|
||||
var header = getAuthorization(req)
|
||||
|
||||
// parse header
|
||||
return parse(header)
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode base64 string.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function decodeBase64 (str) {
|
||||
return Buffer.from(str, 'base64').toString()
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Authorization header from request object.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function getAuthorization (req) {
|
||||
if (!req.headers || typeof req.headers !== 'object') {
|
||||
throw new TypeError('argument req is required to have headers property')
|
||||
}
|
||||
|
||||
return req.headers.authorization
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse basic auth to object.
|
||||
*
|
||||
* @param {string} string
|
||||
* @return {object}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function parse (string) {
|
||||
if (typeof string !== 'string') {
|
||||
return undefined
|
||||
}
|
||||
|
||||
// parse header
|
||||
var match = CREDENTIALS_REGEXP.exec(string)
|
||||
|
||||
if (!match) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
// decode user pass
|
||||
var userPass = USER_PASS_REGEXP.exec(decodeBase64(match[1]))
|
||||
|
||||
if (!userPass) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
// return credentials object
|
||||
return new Credentials(userPass[1], userPass[2])
|
||||
}
|
||||
|
||||
/**
|
||||
* Object to represent user credentials.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function Credentials (name, pass) {
|
||||
this.name = name
|
||||
this.pass = pass
|
||||
}
|
41
node_modules/basic-auth/package.json
generated
vendored
Normal file
41
node_modules/basic-auth/package.json
generated
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"name": "basic-auth",
|
||||
"description": "node.js basic auth parser",
|
||||
"version": "2.0.1",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"basic",
|
||||
"auth",
|
||||
"authorization",
|
||||
"basicauth"
|
||||
],
|
||||
"repository": "jshttp/basic-auth",
|
||||
"dependencies": {
|
||||
"safe-buffer": "5.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "5.6.0",
|
||||
"eslint-config-standard": "12.0.0",
|
||||
"eslint-plugin-import": "2.14.0",
|
||||
"eslint-plugin-markdown": "1.0.0-beta.6",
|
||||
"eslint-plugin-node": "7.0.1",
|
||||
"eslint-plugin-promise": "4.0.1",
|
||||
"eslint-plugin-standard": "4.0.0",
|
||||
"istanbul": "0.4.5",
|
||||
"mocha": "5.2.0"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"index.js"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint --plugin markdown --ext js,md .",
|
||||
"test": "mocha --check-leaks --reporter spec --bail",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
|
||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
|
||||
}
|
||||
}
|
731
node_modules/body-parser/HISTORY.md
generated
vendored
Normal file
731
node_modules/body-parser/HISTORY.md
generated
vendored
Normal file
|
@ -0,0 +1,731 @@
|
|||
2.2.0 / 2025-03-27
|
||||
=========================
|
||||
|
||||
* refactor: normalize common options for all parsers
|
||||
* deps:
|
||||
* iconv-lite@^0.6.3
|
||||
|
||||
2.1.0 / 2025-02-10
|
||||
=========================
|
||||
|
||||
* deps:
|
||||
* type-is@^2.0.0
|
||||
* debug@^4.4.0
|
||||
* Removed destroy
|
||||
* refactor: prefix built-in node module imports
|
||||
* use the node require cache instead of custom caching
|
||||
|
||||
2.0.2 / 2024-10-31
|
||||
=========================
|
||||
|
||||
* remove `unpipe` package and use native `unpipe()` method
|
||||
|
||||
2.0.1 / 2024-09-10
|
||||
=========================
|
||||
|
||||
* Restore expected behavior `extended` to `false`
|
||||
|
||||
2.0.0 / 2024-09-10
|
||||
=========================
|
||||
* Propagate changes from 1.20.3
|
||||
* add brotli support #406
|
||||
* Breaking Change: Node.js 18 is the minimum supported version
|
||||
|
||||
2.0.0-beta.2 / 2023-02-23
|
||||
=========================
|
||||
|
||||
This incorporates all changes after 1.19.1 up to 1.20.2.
|
||||
|
||||
* Remove deprecated `bodyParser()` combination middleware
|
||||
* deps: debug@3.1.0
|
||||
- Add `DEBUG_HIDE_DATE` environment variable
|
||||
- Change timer to per-namespace instead of global
|
||||
- Change non-TTY date format
|
||||
- Remove `DEBUG_FD` environment variable support
|
||||
- Support 256 namespace colors
|
||||
* deps: iconv-lite@0.5.2
|
||||
- Add encoding cp720
|
||||
- Add encoding UTF-32
|
||||
* deps: raw-body@3.0.0-beta.1
|
||||
|
||||
2.0.0-beta.1 / 2021-12-17
|
||||
=========================
|
||||
|
||||
* Drop support for Node.js 0.8
|
||||
* `req.body` is no longer always initialized to `{}`
|
||||
- it is left `undefined` unless a body is parsed
|
||||
* `urlencoded` parser now defaults `extended` to `false`
|
||||
* Use `on-finished` to determine when body read
|
||||
|
||||
1.20.3 / 2024-09-10
|
||||
===================
|
||||
|
||||
* deps: qs@6.13.0
|
||||
* add `depth` option to customize the depth level in the parser
|
||||
* IMPORTANT: The default `depth` level for parsing URL-encoded data is now `32` (previously was `Infinity`)
|
||||
|
||||
1.20.2 / 2023-02-21
|
||||
===================
|
||||
|
||||
* Fix strict json error message on Node.js 19+
|
||||
* deps: content-type@~1.0.5
|
||||
- perf: skip value escaping when unnecessary
|
||||
* deps: raw-body@2.5.2
|
||||
|
||||
1.20.1 / 2022-10-06
|
||||
===================
|
||||
|
||||
* deps: qs@6.11.0
|
||||
* perf: remove unnecessary object clone
|
||||
|
||||
1.20.0 / 2022-04-02
|
||||
===================
|
||||
|
||||
* Fix error message for json parse whitespace in `strict`
|
||||
* Fix internal error when inflated body exceeds limit
|
||||
* Prevent loss of async hooks context
|
||||
* Prevent hanging when request already read
|
||||
* deps: depd@2.0.0
|
||||
- Replace internal `eval` usage with `Function` constructor
|
||||
- Use instance methods on `process` to check for listeners
|
||||
* deps: http-errors@2.0.0
|
||||
- deps: depd@2.0.0
|
||||
- deps: statuses@2.0.1
|
||||
* deps: on-finished@2.4.1
|
||||
* deps: qs@6.10.3
|
||||
* deps: raw-body@2.5.1
|
||||
- deps: http-errors@2.0.0
|
||||
|
||||
1.19.2 / 2022-02-15
|
||||
===================
|
||||
|
||||
* deps: bytes@3.1.2
|
||||
* deps: qs@6.9.7
|
||||
* Fix handling of `__proto__` keys
|
||||
* deps: raw-body@2.4.3
|
||||
- deps: bytes@3.1.2
|
||||
|
||||
1.19.1 / 2021-12-10
|
||||
===================
|
||||
|
||||
* deps: bytes@3.1.1
|
||||
* deps: http-errors@1.8.1
|
||||
- deps: inherits@2.0.4
|
||||
- deps: toidentifier@1.0.1
|
||||
- deps: setprototypeof@1.2.0
|
||||
* deps: qs@6.9.6
|
||||
* deps: raw-body@2.4.2
|
||||
- deps: bytes@3.1.1
|
||||
- deps: http-errors@1.8.1
|
||||
* deps: safe-buffer@5.2.1
|
||||
* deps: type-is@~1.6.18
|
||||
|
||||
1.19.0 / 2019-04-25
|
||||
===================
|
||||
|
||||
* deps: bytes@3.1.0
|
||||
- Add petabyte (`pb`) support
|
||||
* deps: http-errors@1.7.2
|
||||
- Set constructor name when possible
|
||||
- deps: setprototypeof@1.1.1
|
||||
- deps: statuses@'>= 1.5.0 < 2'
|
||||
* deps: iconv-lite@0.4.24
|
||||
- Added encoding MIK
|
||||
* deps: qs@6.7.0
|
||||
- Fix parsing array brackets after index
|
||||
* deps: raw-body@2.4.0
|
||||
- deps: bytes@3.1.0
|
||||
- deps: http-errors@1.7.2
|
||||
- deps: iconv-lite@0.4.24
|
||||
* deps: type-is@~1.6.17
|
||||
- deps: mime-types@~2.1.24
|
||||
- perf: prevent internal `throw` on invalid type
|
||||
|
||||
1.18.3 / 2018-05-14
|
||||
===================
|
||||
|
||||
* Fix stack trace for strict json parse error
|
||||
* deps: depd@~1.1.2
|
||||
- perf: remove argument reassignment
|
||||
* deps: http-errors@~1.6.3
|
||||
- deps: depd@~1.1.2
|
||||
- deps: setprototypeof@1.1.0
|
||||
- deps: statuses@'>= 1.3.1 < 2'
|
||||
* deps: iconv-lite@0.4.23
|
||||
- Fix loading encoding with year appended
|
||||
- Fix deprecation warnings on Node.js 10+
|
||||
* deps: qs@6.5.2
|
||||
* deps: raw-body@2.3.3
|
||||
- deps: http-errors@1.6.3
|
||||
- deps: iconv-lite@0.4.23
|
||||
* deps: type-is@~1.6.16
|
||||
- deps: mime-types@~2.1.18
|
||||
|
||||
1.18.2 / 2017-09-22
|
||||
===================
|
||||
|
||||
* deps: debug@2.6.9
|
||||
* perf: remove argument reassignment
|
||||
|
||||
1.18.1 / 2017-09-12
|
||||
===================
|
||||
|
||||
* deps: content-type@~1.0.4
|
||||
- perf: remove argument reassignment
|
||||
- perf: skip parameter parsing when no parameters
|
||||
* deps: iconv-lite@0.4.19
|
||||
- Fix ISO-8859-1 regression
|
||||
- Update Windows-1255
|
||||
* deps: qs@6.5.1
|
||||
- Fix parsing & compacting very deep objects
|
||||
* deps: raw-body@2.3.2
|
||||
- deps: iconv-lite@0.4.19
|
||||
|
||||
1.18.0 / 2017-09-08
|
||||
===================
|
||||
|
||||
* Fix JSON strict violation error to match native parse error
|
||||
* Include the `body` property on verify errors
|
||||
* Include the `type` property on all generated errors
|
||||
* Use `http-errors` to set status code on errors
|
||||
* deps: bytes@3.0.0
|
||||
* deps: debug@2.6.8
|
||||
* deps: depd@~1.1.1
|
||||
- Remove unnecessary `Buffer` loading
|
||||
* deps: http-errors@~1.6.2
|
||||
- deps: depd@1.1.1
|
||||
* deps: iconv-lite@0.4.18
|
||||
- Add support for React Native
|
||||
- Add a warning if not loaded as utf-8
|
||||
- Fix CESU-8 decoding in Node.js 8
|
||||
- Improve speed of ISO-8859-1 encoding
|
||||
* deps: qs@6.5.0
|
||||
* deps: raw-body@2.3.1
|
||||
- Use `http-errors` for standard emitted errors
|
||||
- deps: bytes@3.0.0
|
||||
- deps: iconv-lite@0.4.18
|
||||
- perf: skip buffer decoding on overage chunk
|
||||
* perf: prevent internal `throw` when missing charset
|
||||
|
||||
1.17.2 / 2017-05-17
|
||||
===================
|
||||
|
||||
* deps: debug@2.6.7
|
||||
- Fix `DEBUG_MAX_ARRAY_LENGTH`
|
||||
- deps: ms@2.0.0
|
||||
* deps: type-is@~1.6.15
|
||||
- deps: mime-types@~2.1.15
|
||||
|
||||
1.17.1 / 2017-03-06
|
||||
===================
|
||||
|
||||
* deps: qs@6.4.0
|
||||
- Fix regression parsing keys starting with `[`
|
||||
|
||||
1.17.0 / 2017-03-01
|
||||
===================
|
||||
|
||||
* deps: http-errors@~1.6.1
|
||||
- Make `message` property enumerable for `HttpError`s
|
||||
- deps: setprototypeof@1.0.3
|
||||
* deps: qs@6.3.1
|
||||
- Fix compacting nested arrays
|
||||
|
||||
1.16.1 / 2017-02-10
|
||||
===================
|
||||
|
||||
* deps: debug@2.6.1
|
||||
- Fix deprecation messages in WebStorm and other editors
|
||||
- Undeprecate `DEBUG_FD` set to `1` or `2`
|
||||
|
||||
1.16.0 / 2017-01-17
|
||||
===================
|
||||
|
||||
* deps: debug@2.6.0
|
||||
- Allow colors in workers
|
||||
- Deprecated `DEBUG_FD` environment variable
|
||||
- Fix error when running under React Native
|
||||
- Use same color for same namespace
|
||||
- deps: ms@0.7.2
|
||||
* deps: http-errors@~1.5.1
|
||||
- deps: inherits@2.0.3
|
||||
- deps: setprototypeof@1.0.2
|
||||
- deps: statuses@'>= 1.3.1 < 2'
|
||||
* deps: iconv-lite@0.4.15
|
||||
- Added encoding MS-31J
|
||||
- Added encoding MS-932
|
||||
- Added encoding MS-936
|
||||
- Added encoding MS-949
|
||||
- Added encoding MS-950
|
||||
- Fix GBK/GB18030 handling of Euro character
|
||||
* deps: qs@6.2.1
|
||||
- Fix array parsing from skipping empty values
|
||||
* deps: raw-body@~2.2.0
|
||||
- deps: iconv-lite@0.4.15
|
||||
* deps: type-is@~1.6.14
|
||||
- deps: mime-types@~2.1.13
|
||||
|
||||
1.15.2 / 2016-06-19
|
||||
===================
|
||||
|
||||
* deps: bytes@2.4.0
|
||||
* deps: content-type@~1.0.2
|
||||
- perf: enable strict mode
|
||||
* deps: http-errors@~1.5.0
|
||||
- Use `setprototypeof` module to replace `__proto__` setting
|
||||
- deps: statuses@'>= 1.3.0 < 2'
|
||||
- perf: enable strict mode
|
||||
* deps: qs@6.2.0
|
||||
* deps: raw-body@~2.1.7
|
||||
- deps: bytes@2.4.0
|
||||
- perf: remove double-cleanup on happy path
|
||||
* deps: type-is@~1.6.13
|
||||
- deps: mime-types@~2.1.11
|
||||
|
||||
1.15.1 / 2016-05-05
|
||||
===================
|
||||
|
||||
* deps: bytes@2.3.0
|
||||
- Drop partial bytes on all parsed units
|
||||
- Fix parsing byte string that looks like hex
|
||||
* deps: raw-body@~2.1.6
|
||||
- deps: bytes@2.3.0
|
||||
* deps: type-is@~1.6.12
|
||||
- deps: mime-types@~2.1.10
|
||||
|
||||
1.15.0 / 2016-02-10
|
||||
===================
|
||||
|
||||
* deps: http-errors@~1.4.0
|
||||
- Add `HttpError` export, for `err instanceof createError.HttpError`
|
||||
- deps: inherits@2.0.1
|
||||
- deps: statuses@'>= 1.2.1 < 2'
|
||||
* deps: qs@6.1.0
|
||||
* deps: type-is@~1.6.11
|
||||
- deps: mime-types@~2.1.9
|
||||
|
||||
1.14.2 / 2015-12-16
|
||||
===================
|
||||
|
||||
* deps: bytes@2.2.0
|
||||
* deps: iconv-lite@0.4.13
|
||||
* deps: qs@5.2.0
|
||||
* deps: raw-body@~2.1.5
|
||||
- deps: bytes@2.2.0
|
||||
- deps: iconv-lite@0.4.13
|
||||
* deps: type-is@~1.6.10
|
||||
- deps: mime-types@~2.1.8
|
||||
|
||||
1.14.1 / 2015-09-27
|
||||
===================
|
||||
|
||||
* Fix issue where invalid charset results in 400 when `verify` used
|
||||
* deps: iconv-lite@0.4.12
|
||||
- Fix CESU-8 decoding in Node.js 4.x
|
||||
* deps: raw-body@~2.1.4
|
||||
- Fix masking critical errors from `iconv-lite`
|
||||
- deps: iconv-lite@0.4.12
|
||||
* deps: type-is@~1.6.9
|
||||
- deps: mime-types@~2.1.7
|
||||
|
||||
1.14.0 / 2015-09-16
|
||||
===================
|
||||
|
||||
* Fix JSON strict parse error to match syntax errors
|
||||
* Provide static `require` analysis in `urlencoded` parser
|
||||
* deps: depd@~1.1.0
|
||||
- Support web browser loading
|
||||
* deps: qs@5.1.0
|
||||
* deps: raw-body@~2.1.3
|
||||
- Fix sync callback when attaching data listener causes sync read
|
||||
* deps: type-is@~1.6.8
|
||||
- Fix type error when given invalid type to match against
|
||||
- deps: mime-types@~2.1.6
|
||||
|
||||
1.13.3 / 2015-07-31
|
||||
===================
|
||||
|
||||
* deps: type-is@~1.6.6
|
||||
- deps: mime-types@~2.1.4
|
||||
|
||||
1.13.2 / 2015-07-05
|
||||
===================
|
||||
|
||||
* deps: iconv-lite@0.4.11
|
||||
* deps: qs@4.0.0
|
||||
- Fix dropping parameters like `hasOwnProperty`
|
||||
- Fix user-visible incompatibilities from 3.1.0
|
||||
- Fix various parsing edge cases
|
||||
* deps: raw-body@~2.1.2
|
||||
- Fix error stack traces to skip `makeError`
|
||||
- deps: iconv-lite@0.4.11
|
||||
* deps: type-is@~1.6.4
|
||||
- deps: mime-types@~2.1.2
|
||||
- perf: enable strict mode
|
||||
- perf: remove argument reassignment
|
||||
|
||||
1.13.1 / 2015-06-16
|
||||
===================
|
||||
|
||||
* deps: qs@2.4.2
|
||||
- Downgraded from 3.1.0 because of user-visible incompatibilities
|
||||
|
||||
1.13.0 / 2015-06-14
|
||||
===================
|
||||
|
||||
* Add `statusCode` property on `Error`s, in addition to `status`
|
||||
* Change `type` default to `application/json` for JSON parser
|
||||
* Change `type` default to `application/x-www-form-urlencoded` for urlencoded parser
|
||||
* Provide static `require` analysis
|
||||
* Use the `http-errors` module to generate errors
|
||||
* deps: bytes@2.1.0
|
||||
- Slight optimizations
|
||||
* deps: iconv-lite@0.4.10
|
||||
- The encoding UTF-16 without BOM now defaults to UTF-16LE when detection fails
|
||||
- Leading BOM is now removed when decoding
|
||||
* deps: on-finished@~2.3.0
|
||||
- Add defined behavior for HTTP `CONNECT` requests
|
||||
- Add defined behavior for HTTP `Upgrade` requests
|
||||
- deps: ee-first@1.1.1
|
||||
* deps: qs@3.1.0
|
||||
- Fix dropping parameters like `hasOwnProperty`
|
||||
- Fix various parsing edge cases
|
||||
- Parsed object now has `null` prototype
|
||||
* deps: raw-body@~2.1.1
|
||||
- Use `unpipe` module for unpiping requests
|
||||
- deps: iconv-lite@0.4.10
|
||||
* deps: type-is@~1.6.3
|
||||
- deps: mime-types@~2.1.1
|
||||
- perf: reduce try block size
|
||||
- perf: remove bitwise operations
|
||||
* perf: enable strict mode
|
||||
* perf: remove argument reassignment
|
||||
* perf: remove delete call
|
||||
|
||||
1.12.4 / 2015-05-10
|
||||
===================
|
||||
|
||||
* deps: debug@~2.2.0
|
||||
* deps: qs@2.4.2
|
||||
- Fix allowing parameters like `constructor`
|
||||
* deps: on-finished@~2.2.1
|
||||
* deps: raw-body@~2.0.1
|
||||
- Fix a false-positive when unpiping in Node.js 0.8
|
||||
- deps: bytes@2.0.1
|
||||
* deps: type-is@~1.6.2
|
||||
- deps: mime-types@~2.0.11
|
||||
|
||||
1.12.3 / 2015-04-15
|
||||
===================
|
||||
|
||||
* Slight efficiency improvement when not debugging
|
||||
* deps: depd@~1.0.1
|
||||
* deps: iconv-lite@0.4.8
|
||||
- Add encoding alias UNICODE-1-1-UTF-7
|
||||
* deps: raw-body@1.3.4
|
||||
- Fix hanging callback if request aborts during read
|
||||
- deps: iconv-lite@0.4.8
|
||||
|
||||
1.12.2 / 2015-03-16
|
||||
===================
|
||||
|
||||
* deps: qs@2.4.1
|
||||
- Fix error when parameter `hasOwnProperty` is present
|
||||
|
||||
1.12.1 / 2015-03-15
|
||||
===================
|
||||
|
||||
* deps: debug@~2.1.3
|
||||
- Fix high intensity foreground color for bold
|
||||
- deps: ms@0.7.0
|
||||
* deps: type-is@~1.6.1
|
||||
- deps: mime-types@~2.0.10
|
||||
|
||||
1.12.0 / 2015-02-13
|
||||
===================
|
||||
|
||||
* add `debug` messages
|
||||
* accept a function for the `type` option
|
||||
* use `content-type` to parse `Content-Type` headers
|
||||
* deps: iconv-lite@0.4.7
|
||||
- Gracefully support enumerables on `Object.prototype`
|
||||
* deps: raw-body@1.3.3
|
||||
- deps: iconv-lite@0.4.7
|
||||
* deps: type-is@~1.6.0
|
||||
- fix argument reassignment
|
||||
- fix false-positives in `hasBody` `Transfer-Encoding` check
|
||||
- support wildcard for both type and subtype (`*/*`)
|
||||
- deps: mime-types@~2.0.9
|
||||
|
||||
1.11.0 / 2015-01-30
|
||||
===================
|
||||
|
||||
* make internal `extended: true` depth limit infinity
|
||||
* deps: type-is@~1.5.6
|
||||
- deps: mime-types@~2.0.8
|
||||
|
||||
1.10.2 / 2015-01-20
|
||||
===================
|
||||
|
||||
* deps: iconv-lite@0.4.6
|
||||
- Fix rare aliases of single-byte encodings
|
||||
* deps: raw-body@1.3.2
|
||||
- deps: iconv-lite@0.4.6
|
||||
|
||||
1.10.1 / 2015-01-01
|
||||
===================
|
||||
|
||||
* deps: on-finished@~2.2.0
|
||||
* deps: type-is@~1.5.5
|
||||
- deps: mime-types@~2.0.7
|
||||
|
||||
1.10.0 / 2014-12-02
|
||||
===================
|
||||
|
||||
* make internal `extended: true` array limit dynamic
|
||||
|
||||
1.9.3 / 2014-11-21
|
||||
==================
|
||||
|
||||
* deps: iconv-lite@0.4.5
|
||||
- Fix Windows-31J and X-SJIS encoding support
|
||||
* deps: qs@2.3.3
|
||||
- Fix `arrayLimit` behavior
|
||||
* deps: raw-body@1.3.1
|
||||
- deps: iconv-lite@0.4.5
|
||||
* deps: type-is@~1.5.3
|
||||
- deps: mime-types@~2.0.3
|
||||
|
||||
1.9.2 / 2014-10-27
|
||||
==================
|
||||
|
||||
* deps: qs@2.3.2
|
||||
- Fix parsing of mixed objects and values
|
||||
|
||||
1.9.1 / 2014-10-22
|
||||
==================
|
||||
|
||||
* deps: on-finished@~2.1.1
|
||||
- Fix handling of pipelined requests
|
||||
* deps: qs@2.3.0
|
||||
- Fix parsing of mixed implicit and explicit arrays
|
||||
* deps: type-is@~1.5.2
|
||||
- deps: mime-types@~2.0.2
|
||||
|
||||
1.9.0 / 2014-09-24
|
||||
==================
|
||||
|
||||
* include the charset in "unsupported charset" error message
|
||||
* include the encoding in "unsupported content encoding" error message
|
||||
* deps: depd@~1.0.0
|
||||
|
||||
1.8.4 / 2014-09-23
|
||||
==================
|
||||
|
||||
* fix content encoding to be case-insensitive
|
||||
|
||||
1.8.3 / 2014-09-19
|
||||
==================
|
||||
|
||||
* deps: qs@2.2.4
|
||||
- Fix issue with object keys starting with numbers truncated
|
||||
|
||||
1.8.2 / 2014-09-15
|
||||
==================
|
||||
|
||||
* deps: depd@0.4.5
|
||||
|
||||
1.8.1 / 2014-09-07
|
||||
==================
|
||||
|
||||
* deps: media-typer@0.3.0
|
||||
* deps: type-is@~1.5.1
|
||||
|
||||
1.8.0 / 2014-09-05
|
||||
==================
|
||||
|
||||
* make empty-body-handling consistent between chunked requests
|
||||
- empty `json` produces `{}`
|
||||
- empty `raw` produces `new Buffer(0)`
|
||||
- empty `text` produces `''`
|
||||
- empty `urlencoded` produces `{}`
|
||||
* deps: qs@2.2.3
|
||||
- Fix issue where first empty value in array is discarded
|
||||
* deps: type-is@~1.5.0
|
||||
- fix `hasbody` to be true for `content-length: 0`
|
||||
|
||||
1.7.0 / 2014-09-01
|
||||
==================
|
||||
|
||||
* add `parameterLimit` option to `urlencoded` parser
|
||||
* change `urlencoded` extended array limit to 100
|
||||
* respond with 413 when over `parameterLimit` in `urlencoded`
|
||||
|
||||
1.6.7 / 2014-08-29
|
||||
==================
|
||||
|
||||
* deps: qs@2.2.2
|
||||
- Remove unnecessary cloning
|
||||
|
||||
1.6.6 / 2014-08-27
|
||||
==================
|
||||
|
||||
* deps: qs@2.2.0
|
||||
- Array parsing fix
|
||||
- Performance improvements
|
||||
|
||||
1.6.5 / 2014-08-16
|
||||
==================
|
||||
|
||||
* deps: on-finished@2.1.0
|
||||
|
||||
1.6.4 / 2014-08-14
|
||||
==================
|
||||
|
||||
* deps: qs@1.2.2
|
||||
|
||||
1.6.3 / 2014-08-10
|
||||
==================
|
||||
|
||||
* deps: qs@1.2.1
|
||||
|
||||
1.6.2 / 2014-08-07
|
||||
==================
|
||||
|
||||
* deps: qs@1.2.0
|
||||
- Fix parsing array of objects
|
||||
|
||||
1.6.1 / 2014-08-06
|
||||
==================
|
||||
|
||||
* deps: qs@1.1.0
|
||||
- Accept urlencoded square brackets
|
||||
- Accept empty values in implicit array notation
|
||||
|
||||
1.6.0 / 2014-08-05
|
||||
==================
|
||||
|
||||
* deps: qs@1.0.2
|
||||
- Complete rewrite
|
||||
- Limits array length to 20
|
||||
- Limits object depth to 5
|
||||
- Limits parameters to 1,000
|
||||
|
||||
1.5.2 / 2014-07-27
|
||||
==================
|
||||
|
||||
* deps: depd@0.4.4
|
||||
- Work-around v8 generating empty stack traces
|
||||
|
||||
1.5.1 / 2014-07-26
|
||||
==================
|
||||
|
||||
* deps: depd@0.4.3
|
||||
- Fix exception when global `Error.stackTraceLimit` is too low
|
||||
|
||||
1.5.0 / 2014-07-20
|
||||
==================
|
||||
|
||||
* deps: depd@0.4.2
|
||||
- Add `TRACE_DEPRECATION` environment variable
|
||||
- Remove non-standard grey color from color output
|
||||
- Support `--no-deprecation` argument
|
||||
- Support `--trace-deprecation` argument
|
||||
* deps: iconv-lite@0.4.4
|
||||
- Added encoding UTF-7
|
||||
* deps: raw-body@1.3.0
|
||||
- deps: iconv-lite@0.4.4
|
||||
- Added encoding UTF-7
|
||||
- Fix `Cannot switch to old mode now` error on Node.js 0.10+
|
||||
* deps: type-is@~1.3.2
|
||||
|
||||
1.4.3 / 2014-06-19
|
||||
==================
|
||||
|
||||
* deps: type-is@1.3.1
|
||||
- fix global variable leak
|
||||
|
||||
1.4.2 / 2014-06-19
|
||||
==================
|
||||
|
||||
* deps: type-is@1.3.0
|
||||
- improve type parsing
|
||||
|
||||
1.4.1 / 2014-06-19
|
||||
==================
|
||||
|
||||
* fix urlencoded extended deprecation message
|
||||
|
||||
1.4.0 / 2014-06-19
|
||||
==================
|
||||
|
||||
* add `text` parser
|
||||
* add `raw` parser
|
||||
* check accepted charset in content-type (accepts utf-8)
|
||||
* check accepted encoding in content-encoding (accepts identity)
|
||||
* deprecate `bodyParser()` middleware; use `.json()` and `.urlencoded()` as needed
|
||||
* deprecate `urlencoded()` without provided `extended` option
|
||||
* lazy-load urlencoded parsers
|
||||
* parsers split into files for reduced mem usage
|
||||
* support gzip and deflate bodies
|
||||
- set `inflate: false` to turn off
|
||||
* deps: raw-body@1.2.2
|
||||
- Support all encodings from `iconv-lite`
|
||||
|
||||
1.3.1 / 2014-06-11
|
||||
==================
|
||||
|
||||
* deps: type-is@1.2.1
|
||||
- Switch dependency from mime to mime-types@1.0.0
|
||||
|
||||
1.3.0 / 2014-05-31
|
||||
==================
|
||||
|
||||
* add `extended` option to urlencoded parser
|
||||
|
||||
1.2.2 / 2014-05-27
|
||||
==================
|
||||
|
||||
* deps: raw-body@1.1.6
|
||||
- assert stream encoding on node.js 0.8
|
||||
- assert stream encoding on node.js < 0.10.6
|
||||
- deps: bytes@1
|
||||
|
||||
1.2.1 / 2014-05-26
|
||||
==================
|
||||
|
||||
* invoke `next(err)` after request fully read
|
||||
- prevents hung responses and socket hang ups
|
||||
|
||||
1.2.0 / 2014-05-11
|
||||
==================
|
||||
|
||||
* add `verify` option
|
||||
* deps: type-is@1.2.0
|
||||
- support suffix matching
|
||||
|
||||
1.1.2 / 2014-05-11
|
||||
==================
|
||||
|
||||
* improve json parser speed
|
||||
|
||||
1.1.1 / 2014-05-11
|
||||
==================
|
||||
|
||||
* fix repeated limit parsing with every request
|
||||
|
||||
1.1.0 / 2014-05-10
|
||||
==================
|
||||
|
||||
* add `type` option
|
||||
* deps: pin for safety and consistency
|
||||
|
||||
1.0.2 / 2014-04-14
|
||||
==================
|
||||
|
||||
* use `type-is` module
|
||||
|
||||
1.0.1 / 2014-03-20
|
||||
==================
|
||||
|
||||
* lower default limits to 100kb
|
23
node_modules/body-parser/LICENSE
generated
vendored
Normal file
23
node_modules/body-parser/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
||||
Copyright (c) 2014-2015 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||
|
||||
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:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
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.
|
491
node_modules/body-parser/README.md
generated
vendored
Normal file
491
node_modules/body-parser/README.md
generated
vendored
Normal file
|
@ -0,0 +1,491 @@
|
|||
# body-parser
|
||||
|
||||
[![NPM Version][npm-version-image]][npm-url]
|
||||
[![NPM Downloads][npm-downloads-image]][npm-url]
|
||||
[![Build Status][ci-image]][ci-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
[![OpenSSF Scorecard Badge][ossf-scorecard-badge]][ossf-scorecard-visualizer]
|
||||
|
||||
Node.js body parsing middleware.
|
||||
|
||||
Parse incoming request bodies in a middleware before your handlers, available
|
||||
under the `req.body` property.
|
||||
|
||||
**Note** As `req.body`'s shape is based on user-controlled input, all
|
||||
properties and values in this object are untrusted and should be validated
|
||||
before trusting. For example, `req.body.foo.toString()` may fail in multiple
|
||||
ways, for example the `foo` property may not be there or may not be a string,
|
||||
and `toString` may not be a function and instead a string or other user input.
|
||||
|
||||
[Learn about the anatomy of an HTTP transaction in Node.js](https://nodejs.org/en/docs/guides/anatomy-of-an-http-transaction/).
|
||||
|
||||
_This does not handle multipart bodies_, due to their complex and typically
|
||||
large nature. For multipart bodies, you may be interested in the following
|
||||
modules:
|
||||
|
||||
* [busboy](https://www.npmjs.org/package/busboy#readme) and
|
||||
[connect-busboy](https://www.npmjs.org/package/connect-busboy#readme)
|
||||
* [multiparty](https://www.npmjs.org/package/multiparty#readme) and
|
||||
[connect-multiparty](https://www.npmjs.org/package/connect-multiparty#readme)
|
||||
* [formidable](https://www.npmjs.org/package/formidable#readme)
|
||||
* [multer](https://www.npmjs.org/package/multer#readme)
|
||||
|
||||
This module provides the following parsers:
|
||||
|
||||
* [JSON body parser](#bodyparserjsonoptions)
|
||||
* [Raw body parser](#bodyparserrawoptions)
|
||||
* [Text body parser](#bodyparsertextoptions)
|
||||
* [URL-encoded form body parser](#bodyparserurlencodedoptions)
|
||||
|
||||
Other body parsers you might be interested in:
|
||||
|
||||
- [body](https://www.npmjs.org/package/body#readme)
|
||||
- [co-body](https://www.npmjs.org/package/co-body#readme)
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
$ npm install body-parser
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
const bodyParser = require('body-parser')
|
||||
```
|
||||
|
||||
The `bodyParser` object exposes various factories to create middlewares. All
|
||||
middlewares will populate the `req.body` property with the parsed body when
|
||||
the `Content-Type` request header matches the `type` option.
|
||||
|
||||
The various errors returned by this module are described in the
|
||||
[errors section](#errors).
|
||||
|
||||
### bodyParser.json([options])
|
||||
|
||||
Returns middleware that only parses `json` and only looks at requests where
|
||||
the `Content-Type` header matches the `type` option. This parser accepts any
|
||||
Unicode encoding of the body and supports automatic inflation of `gzip`,
|
||||
`br` (brotli) and `deflate` encodings.
|
||||
|
||||
A new `body` object containing the parsed data is populated on the `request`
|
||||
object after the middleware (i.e. `req.body`).
|
||||
|
||||
#### Options
|
||||
|
||||
The `json` function takes an optional `options` object that may contain any of
|
||||
the following keys:
|
||||
|
||||
##### inflate
|
||||
|
||||
When set to `true`, then deflated (compressed) bodies will be inflated; when
|
||||
`false`, deflated bodies are rejected. Defaults to `true`.
|
||||
|
||||
##### limit
|
||||
|
||||
Controls the maximum request body size. If this is a number, then the value
|
||||
specifies the number of bytes; if it is a string, the value is passed to the
|
||||
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
||||
to `'100kb'`.
|
||||
|
||||
##### reviver
|
||||
|
||||
The `reviver` option is passed directly to `JSON.parse` as the second
|
||||
argument. You can find more information on this argument
|
||||
[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).
|
||||
|
||||
##### strict
|
||||
|
||||
When set to `true`, will only accept arrays and objects; when `false` will
|
||||
accept anything `JSON.parse` accepts. Defaults to `true`.
|
||||
|
||||
##### type
|
||||
|
||||
The `type` option is used to determine what media type the middleware will
|
||||
parse. This option can be a string, array of strings, or a function. If not a
|
||||
function, `type` option is passed directly to the
|
||||
[type-is](https://www.npmjs.org/package/type-is#readme) library and this can
|
||||
be an extension name (like `json`), a mime type (like `application/json`), or
|
||||
a mime type with a wildcard (like `*/*` or `*/json`). If a function, the `type`
|
||||
option is called as `fn(req)` and the request is parsed if it returns a truthy
|
||||
value. Defaults to `application/json`.
|
||||
|
||||
##### verify
|
||||
|
||||
The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`,
|
||||
where `buf` is a `Buffer` of the raw request body and `encoding` is the
|
||||
encoding of the request. The parsing can be aborted by throwing an error.
|
||||
|
||||
### bodyParser.raw([options])
|
||||
|
||||
Returns middleware that parses all bodies as a `Buffer` and only looks at
|
||||
requests where the `Content-Type` header matches the `type` option. This
|
||||
parser supports automatic inflation of `gzip`, `br` (brotli) and `deflate`
|
||||
encodings.
|
||||
|
||||
A new `body` object containing the parsed data is populated on the `request`
|
||||
object after the middleware (i.e. `req.body`). This will be a `Buffer` object
|
||||
of the body.
|
||||
|
||||
#### Options
|
||||
|
||||
The `raw` function takes an optional `options` object that may contain any of
|
||||
the following keys:
|
||||
|
||||
##### inflate
|
||||
|
||||
When set to `true`, then deflated (compressed) bodies will be inflated; when
|
||||
`false`, deflated bodies are rejected. Defaults to `true`.
|
||||
|
||||
##### limit
|
||||
|
||||
Controls the maximum request body size. If this is a number, then the value
|
||||
specifies the number of bytes; if it is a string, the value is passed to the
|
||||
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
||||
to `'100kb'`.
|
||||
|
||||
##### type
|
||||
|
||||
The `type` option is used to determine what media type the middleware will
|
||||
parse. This option can be a string, array of strings, or a function.
|
||||
If not a function, `type` option is passed directly to the
|
||||
[type-is](https://www.npmjs.org/package/type-is#readme) library and this
|
||||
can be an extension name (like `bin`), a mime type (like
|
||||
`application/octet-stream`), or a mime type with a wildcard (like `*/*` or
|
||||
`application/*`). If a function, the `type` option is called as `fn(req)`
|
||||
and the request is parsed if it returns a truthy value. Defaults to
|
||||
`application/octet-stream`.
|
||||
|
||||
##### verify
|
||||
|
||||
The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`,
|
||||
where `buf` is a `Buffer` of the raw request body and `encoding` is the
|
||||
encoding of the request. The parsing can be aborted by throwing an error.
|
||||
|
||||
### bodyParser.text([options])
|
||||
|
||||
Returns middleware that parses all bodies as a string and only looks at
|
||||
requests where the `Content-Type` header matches the `type` option. This
|
||||
parser supports automatic inflation of `gzip`, `br` (brotli) and `deflate`
|
||||
encodings.
|
||||
|
||||
A new `body` string containing the parsed data is populated on the `request`
|
||||
object after the middleware (i.e. `req.body`). This will be a string of the
|
||||
body.
|
||||
|
||||
#### Options
|
||||
|
||||
The `text` function takes an optional `options` object that may contain any of
|
||||
the following keys:
|
||||
|
||||
##### defaultCharset
|
||||
|
||||
Specify the default character set for the text content if the charset is not
|
||||
specified in the `Content-Type` header of the request. Defaults to `utf-8`.
|
||||
|
||||
##### inflate
|
||||
|
||||
When set to `true`, then deflated (compressed) bodies will be inflated; when
|
||||
`false`, deflated bodies are rejected. Defaults to `true`.
|
||||
|
||||
##### limit
|
||||
|
||||
Controls the maximum request body size. If this is a number, then the value
|
||||
specifies the number of bytes; if it is a string, the value is passed to the
|
||||
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
||||
to `'100kb'`.
|
||||
|
||||
##### type
|
||||
|
||||
The `type` option is used to determine what media type the middleware will
|
||||
parse. This option can be a string, array of strings, or a function. If not
|
||||
a function, `type` option is passed directly to the
|
||||
[type-is](https://www.npmjs.org/package/type-is#readme) library and this can
|
||||
be an extension name (like `txt`), a mime type (like `text/plain`), or a mime
|
||||
type with a wildcard (like `*/*` or `text/*`). If a function, the `type`
|
||||
option is called as `fn(req)` and the request is parsed if it returns a
|
||||
truthy value. Defaults to `text/plain`.
|
||||
|
||||
##### verify
|
||||
|
||||
The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`,
|
||||
where `buf` is a `Buffer` of the raw request body and `encoding` is the
|
||||
encoding of the request. The parsing can be aborted by throwing an error.
|
||||
|
||||
### bodyParser.urlencoded([options])
|
||||
|
||||
Returns middleware that only parses `urlencoded` bodies and only looks at
|
||||
requests where the `Content-Type` header matches the `type` option. This
|
||||
parser accepts only UTF-8 encoding of the body and supports automatic
|
||||
inflation of `gzip`, `br` (brotli) and `deflate` encodings.
|
||||
|
||||
A new `body` object containing the parsed data is populated on the `request`
|
||||
object after the middleware (i.e. `req.body`). This object will contain
|
||||
key-value pairs, where the value can be a string or array (when `extended` is
|
||||
`false`), or any type (when `extended` is `true`).
|
||||
|
||||
#### Options
|
||||
|
||||
The `urlencoded` function takes an optional `options` object that may contain
|
||||
any of the following keys:
|
||||
|
||||
##### extended
|
||||
|
||||
The "extended" syntax allows for rich objects and arrays to be encoded into the
|
||||
URL-encoded format, allowing for a JSON-like experience with URL-encoded. For
|
||||
more information, please [see the qs
|
||||
library](https://www.npmjs.org/package/qs#readme).
|
||||
|
||||
Defaults to `false`.
|
||||
|
||||
##### inflate
|
||||
|
||||
When set to `true`, then deflated (compressed) bodies will be inflated; when
|
||||
`false`, deflated bodies are rejected. Defaults to `true`.
|
||||
|
||||
##### limit
|
||||
|
||||
Controls the maximum request body size. If this is a number, then the value
|
||||
specifies the number of bytes; if it is a string, the value is passed to the
|
||||
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
||||
to `'100kb'`.
|
||||
|
||||
##### parameterLimit
|
||||
|
||||
The `parameterLimit` option controls the maximum number of parameters that
|
||||
are allowed in the URL-encoded data. If a request contains more parameters
|
||||
than this value, a 413 will be returned to the client. Defaults to `1000`.
|
||||
|
||||
##### type
|
||||
|
||||
The `type` option is used to determine what media type the middleware will
|
||||
parse. This option can be a string, array of strings, or a function. If not
|
||||
a function, `type` option is passed directly to the
|
||||
[type-is](https://www.npmjs.org/package/type-is#readme) library and this can
|
||||
be an extension name (like `urlencoded`), a mime type (like
|
||||
`application/x-www-form-urlencoded`), or a mime type with a wildcard (like
|
||||
`*/x-www-form-urlencoded`). If a function, the `type` option is called as
|
||||
`fn(req)` and the request is parsed if it returns a truthy value. Defaults
|
||||
to `application/x-www-form-urlencoded`.
|
||||
|
||||
##### verify
|
||||
|
||||
The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`,
|
||||
where `buf` is a `Buffer` of the raw request body and `encoding` is the
|
||||
encoding of the request. The parsing can be aborted by throwing an error.
|
||||
|
||||
##### defaultCharset
|
||||
|
||||
The default charset to parse as, if not specified in content-type. Must be
|
||||
either `utf-8` or `iso-8859-1`. Defaults to `utf-8`.
|
||||
|
||||
##### charsetSentinel
|
||||
|
||||
Whether to let the value of the `utf8` parameter take precedence as the charset
|
||||
selector. It requires the form to contain a parameter named `utf8` with a value
|
||||
of `✓`. Defaults to `false`.
|
||||
|
||||
##### interpretNumericEntities
|
||||
|
||||
Whether to decode numeric entities such as `☺` when parsing an iso-8859-1
|
||||
form. Defaults to `false`.
|
||||
|
||||
|
||||
#### depth
|
||||
|
||||
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.
|
||||
|
||||
## Errors
|
||||
|
||||
The middlewares provided by this module create errors using the
|
||||
[`http-errors` module](https://www.npmjs.com/package/http-errors). The errors
|
||||
will typically have a `status`/`statusCode` property that contains the suggested
|
||||
HTTP response code, an `expose` property to determine if the `message` property
|
||||
should be displayed to the client, a `type` property to determine the type of
|
||||
error without matching against the `message`, and a `body` property containing
|
||||
the read body, if available.
|
||||
|
||||
The following are the common errors created, though any error can come through
|
||||
for various reasons.
|
||||
|
||||
### content encoding unsupported
|
||||
|
||||
This error will occur when the request had a `Content-Encoding` header that
|
||||
contained an encoding but the "inflation" option was set to `false`. The
|
||||
`status` property is set to `415`, the `type` property is set to
|
||||
`'encoding.unsupported'`, and the `charset` property will be set to the
|
||||
encoding that is unsupported.
|
||||
|
||||
### entity parse failed
|
||||
|
||||
This error will occur when the request contained an entity that could not be
|
||||
parsed by the middleware. The `status` property is set to `400`, the `type`
|
||||
property is set to `'entity.parse.failed'`, and the `body` property is set to
|
||||
the entity value that failed parsing.
|
||||
|
||||
### entity verify failed
|
||||
|
||||
This error will occur when the request contained an entity that could not be
|
||||
failed verification by the defined `verify` option. The `status` property is
|
||||
set to `403`, the `type` property is set to `'entity.verify.failed'`, and the
|
||||
`body` property is set to the entity value that failed verification.
|
||||
|
||||
### request aborted
|
||||
|
||||
This error will occur when the request is aborted by the client before reading
|
||||
the body has finished. The `received` property will be set to the number of
|
||||
bytes received before the request was aborted and the `expected` property is
|
||||
set to the number of expected bytes. The `status` property is set to `400`
|
||||
and `type` property is set to `'request.aborted'`.
|
||||
|
||||
### request entity too large
|
||||
|
||||
This error will occur when the request body's size is larger than the "limit"
|
||||
option. The `limit` property will be set to the byte limit and the `length`
|
||||
property will be set to the request body's length. The `status` property is
|
||||
set to `413` and the `type` property is set to `'entity.too.large'`.
|
||||
|
||||
### request size did not match content length
|
||||
|
||||
This error will occur when the request's length did not match the length from
|
||||
the `Content-Length` header. This typically occurs when the request is malformed,
|
||||
typically when the `Content-Length` header was calculated based on characters
|
||||
instead of bytes. The `status` property is set to `400` and the `type` property
|
||||
is set to `'request.size.invalid'`.
|
||||
|
||||
### stream encoding should not be set
|
||||
|
||||
This error will occur when something called the `req.setEncoding` method prior
|
||||
to this middleware. This module operates directly on bytes only and you cannot
|
||||
call `req.setEncoding` when using this module. The `status` property is set to
|
||||
`500` and the `type` property is set to `'stream.encoding.set'`.
|
||||
|
||||
### stream is not readable
|
||||
|
||||
This error will occur when the request is no longer readable when this middleware
|
||||
attempts to read it. This typically means something other than a middleware from
|
||||
this module read the request body already and the middleware was also configured to
|
||||
read the same request. The `status` property is set to `500` and the `type`
|
||||
property is set to `'stream.not.readable'`.
|
||||
|
||||
### too many parameters
|
||||
|
||||
This error will occur when the content of the request exceeds the configured
|
||||
`parameterLimit` for the `urlencoded` parser. The `status` property is set to
|
||||
`413` and the `type` property is set to `'parameters.too.many'`.
|
||||
|
||||
### unsupported charset "BOGUS"
|
||||
|
||||
This error will occur when the request had a charset parameter in the
|
||||
`Content-Type` header, but the `iconv-lite` module does not support it OR the
|
||||
parser does not support it. The charset is contained in the message as well
|
||||
as in the `charset` property. The `status` property is set to `415`, the
|
||||
`type` property is set to `'charset.unsupported'`, and the `charset` property
|
||||
is set to the charset that is unsupported.
|
||||
|
||||
### unsupported content encoding "bogus"
|
||||
|
||||
This error will occur when the request had a `Content-Encoding` header that
|
||||
contained an unsupported encoding. The encoding is contained in the message
|
||||
as well as in the `encoding` property. The `status` property is set to `415`,
|
||||
the `type` property is set to `'encoding.unsupported'`, and the `encoding`
|
||||
property is set to the encoding that is unsupported.
|
||||
|
||||
### The input exceeded the depth
|
||||
|
||||
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.
|
||||
|
||||
## Examples
|
||||
|
||||
### Express/Connect top-level generic
|
||||
|
||||
This example demonstrates adding a generic JSON and URL-encoded parser as a
|
||||
top-level middleware, which will parse the bodies of all incoming requests.
|
||||
This is the simplest setup.
|
||||
|
||||
```js
|
||||
const express = require('express')
|
||||
const bodyParser = require('body-parser')
|
||||
|
||||
const app = express()
|
||||
|
||||
// parse application/x-www-form-urlencoded
|
||||
app.use(bodyParser.urlencoded())
|
||||
|
||||
// parse application/json
|
||||
app.use(bodyParser.json())
|
||||
|
||||
app.use(function (req, res) {
|
||||
res.setHeader('Content-Type', 'text/plain')
|
||||
res.write('you posted:\n')
|
||||
res.end(String(JSON.stringify(req.body, null, 2)))
|
||||
})
|
||||
```
|
||||
|
||||
### Express route-specific
|
||||
|
||||
This example demonstrates adding body parsers specifically to the routes that
|
||||
need them. In general, this is the most recommended way to use body-parser with
|
||||
Express.
|
||||
|
||||
```js
|
||||
const express = require('express')
|
||||
const bodyParser = require('body-parser')
|
||||
|
||||
const app = express()
|
||||
|
||||
// create application/json parser
|
||||
const jsonParser = bodyParser.json()
|
||||
|
||||
// create application/x-www-form-urlencoded parser
|
||||
const urlencodedParser = bodyParser.urlencoded()
|
||||
|
||||
// POST /login gets urlencoded bodies
|
||||
app.post('/login', urlencodedParser, function (req, res) {
|
||||
if (!req.body || !req.body.username) res.sendStatus(400)
|
||||
res.send('welcome, ' + req.body.username)
|
||||
})
|
||||
|
||||
// POST /api/users gets JSON bodies
|
||||
app.post('/api/users', jsonParser, function (req, res) {
|
||||
if (!req.body) res.sendStatus(400)
|
||||
// create user in req.body
|
||||
})
|
||||
```
|
||||
|
||||
### Change accepted type for parsers
|
||||
|
||||
All the parsers accept a `type` option which allows you to change the
|
||||
`Content-Type` that the middleware will parse.
|
||||
|
||||
```js
|
||||
const express = require('express')
|
||||
const bodyParser = require('body-parser')
|
||||
|
||||
const app = express()
|
||||
|
||||
// parse various different custom JSON types as JSON
|
||||
app.use(bodyParser.json({ type: 'application/*+json' }))
|
||||
|
||||
// parse some custom thing into a Buffer
|
||||
app.use(bodyParser.raw({ type: 'application/vnd.custom-type' }))
|
||||
|
||||
// parse an HTML body into a string
|
||||
app.use(bodyParser.text({ type: 'text/html' }))
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[ci-image]: https://badgen.net/github/checks/expressjs/body-parser/master?label=ci
|
||||
[ci-url]: https://github.com/expressjs/body-parser/actions/workflows/ci.yml
|
||||
[coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/body-parser/master
|
||||
[coveralls-url]: https://coveralls.io/r/expressjs/body-parser?branch=master
|
||||
[node-version-image]: https://badgen.net/npm/node/body-parser
|
||||
[node-version-url]: https://nodejs.org/en/download
|
||||
[npm-downloads-image]: https://badgen.net/npm/dm/body-parser
|
||||
[npm-url]: https://npmjs.org/package/body-parser
|
||||
[npm-version-image]: https://badgen.net/npm/v/body-parser
|
||||
[ossf-scorecard-badge]: https://api.scorecard.dev/projects/github.com/expressjs/body-parser/badge
|
||||
[ossf-scorecard-visualizer]: https://ossf.github.io/scorecard-visualizer/#/projects/github.com/expressjs/body-parser
|
80
node_modules/body-parser/index.js
generated
vendored
Normal file
80
node_modules/body-parser/index.js
generated
vendored
Normal file
|
@ -0,0 +1,80 @@
|
|||
/*!
|
||||
* body-parser
|
||||
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* @typedef Parsers
|
||||
* @type {function}
|
||||
* @property {function} json
|
||||
* @property {function} raw
|
||||
* @property {function} text
|
||||
* @property {function} urlencoded
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @type {Parsers}
|
||||
*/
|
||||
|
||||
exports = module.exports = bodyParser
|
||||
|
||||
/**
|
||||
* JSON parser.
|
||||
* @public
|
||||
*/
|
||||
|
||||
Object.defineProperty(exports, 'json', {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: () => require('./lib/types/json')
|
||||
})
|
||||
|
||||
/**
|
||||
* Raw parser.
|
||||
* @public
|
||||
*/
|
||||
|
||||
Object.defineProperty(exports, 'raw', {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: () => require('./lib/types/raw')
|
||||
})
|
||||
|
||||
/**
|
||||
* Text parser.
|
||||
* @public
|
||||
*/
|
||||
|
||||
Object.defineProperty(exports, 'text', {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: () => require('./lib/types/text')
|
||||
})
|
||||
|
||||
/**
|
||||
* URL-encoded parser.
|
||||
* @public
|
||||
*/
|
||||
|
||||
Object.defineProperty(exports, 'urlencoded', {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: () => require('./lib/types/urlencoded')
|
||||
})
|
||||
|
||||
/**
|
||||
* Create a middleware to parse json and urlencoded bodies.
|
||||
*
|
||||
* @param {object} [options]
|
||||
* @return {function}
|
||||
* @deprecated
|
||||
* @public
|
||||
*/
|
||||
|
||||
function bodyParser () {
|
||||
throw new Error('The bodyParser() generic has been split into individual middleware to use instead.')
|
||||
}
|
210
node_modules/body-parser/lib/read.js
generated
vendored
Normal file
210
node_modules/body-parser/lib/read.js
generated
vendored
Normal file
|
@ -0,0 +1,210 @@
|
|||
/*!
|
||||
* body-parser
|
||||
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var createError = require('http-errors')
|
||||
var getBody = require('raw-body')
|
||||
var iconv = require('iconv-lite')
|
||||
var onFinished = require('on-finished')
|
||||
var zlib = require('node:zlib')
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = read
|
||||
|
||||
/**
|
||||
* Read a request into a buffer and parse.
|
||||
*
|
||||
* @param {object} req
|
||||
* @param {object} res
|
||||
* @param {function} next
|
||||
* @param {function} parse
|
||||
* @param {function} debug
|
||||
* @param {object} options
|
||||
* @private
|
||||
*/
|
||||
|
||||
function read (req, res, next, parse, debug, options) {
|
||||
var length
|
||||
var opts = options
|
||||
var stream
|
||||
|
||||
// read options
|
||||
var encoding = opts.encoding !== null
|
||||
? opts.encoding
|
||||
: null
|
||||
var verify = opts.verify
|
||||
|
||||
try {
|
||||
// get the content stream
|
||||
stream = contentstream(req, debug, opts.inflate)
|
||||
length = stream.length
|
||||
stream.length = undefined
|
||||
} catch (err) {
|
||||
return next(err)
|
||||
}
|
||||
|
||||
// set raw-body options
|
||||
opts.length = length
|
||||
opts.encoding = verify
|
||||
? null
|
||||
: encoding
|
||||
|
||||
// assert charset is supported
|
||||
if (opts.encoding === null && encoding !== null && !iconv.encodingExists(encoding)) {
|
||||
return next(createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', {
|
||||
charset: encoding.toLowerCase(),
|
||||
type: 'charset.unsupported'
|
||||
}))
|
||||
}
|
||||
|
||||
// read body
|
||||
debug('read body')
|
||||
getBody(stream, opts, function (error, body) {
|
||||
if (error) {
|
||||
var _error
|
||||
|
||||
if (error.type === 'encoding.unsupported') {
|
||||
// echo back charset
|
||||
_error = createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', {
|
||||
charset: encoding.toLowerCase(),
|
||||
type: 'charset.unsupported'
|
||||
})
|
||||
} else {
|
||||
// set status code on error
|
||||
_error = createError(400, error)
|
||||
}
|
||||
|
||||
// unpipe from stream and destroy
|
||||
if (stream !== req) {
|
||||
req.unpipe()
|
||||
stream.destroy()
|
||||
}
|
||||
|
||||
// read off entire request
|
||||
dump(req, function onfinished () {
|
||||
next(createError(400, _error))
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// verify
|
||||
if (verify) {
|
||||
try {
|
||||
debug('verify body')
|
||||
verify(req, res, body, encoding)
|
||||
} catch (err) {
|
||||
next(createError(403, err, {
|
||||
body: body,
|
||||
type: err.type || 'entity.verify.failed'
|
||||
}))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// parse
|
||||
var str = body
|
||||
try {
|
||||
debug('parse body')
|
||||
str = typeof body !== 'string' && encoding !== null
|
||||
? iconv.decode(body, encoding)
|
||||
: body
|
||||
req.body = parse(str, encoding)
|
||||
} catch (err) {
|
||||
next(createError(400, err, {
|
||||
body: str,
|
||||
type: err.type || 'entity.parse.failed'
|
||||
}))
|
||||
return
|
||||
}
|
||||
|
||||
next()
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the content stream of the request.
|
||||
*
|
||||
* @param {object} req
|
||||
* @param {function} debug
|
||||
* @param {boolean} [inflate=true]
|
||||
* @return {object}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function contentstream (req, debug, inflate) {
|
||||
var encoding = (req.headers['content-encoding'] || 'identity').toLowerCase()
|
||||
var length = req.headers['content-length']
|
||||
|
||||
debug('content-encoding "%s"', encoding)
|
||||
|
||||
if (inflate === false && encoding !== 'identity') {
|
||||
throw createError(415, 'content encoding unsupported', {
|
||||
encoding: encoding,
|
||||
type: 'encoding.unsupported'
|
||||
})
|
||||
}
|
||||
|
||||
if (encoding === 'identity') {
|
||||
req.length = length
|
||||
return req
|
||||
}
|
||||
|
||||
var stream = createDecompressionStream(encoding, debug)
|
||||
req.pipe(stream)
|
||||
return stream
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a decompression stream for the given encoding.
|
||||
* @param {string} encoding
|
||||
* @param {function} debug
|
||||
* @return {object}
|
||||
* @api private
|
||||
*/
|
||||
function createDecompressionStream (encoding, debug) {
|
||||
switch (encoding) {
|
||||
case 'deflate':
|
||||
debug('inflate body')
|
||||
return zlib.createInflate()
|
||||
case 'gzip':
|
||||
debug('gunzip body')
|
||||
return zlib.createGunzip()
|
||||
case 'br':
|
||||
debug('brotli decompress body')
|
||||
return zlib.createBrotliDecompress()
|
||||
default:
|
||||
throw createError(415, 'unsupported content encoding "' + encoding + '"', {
|
||||
encoding: encoding,
|
||||
type: 'encoding.unsupported'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dump the contents of a request.
|
||||
*
|
||||
* @param {object} req
|
||||
* @param {function} callback
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function dump (req, callback) {
|
||||
if (onFinished.isFinished(req)) {
|
||||
callback(null)
|
||||
} else {
|
||||
onFinished(req, callback)
|
||||
req.resume()
|
||||
}
|
||||
}
|
206
node_modules/body-parser/lib/types/json.js
generated
vendored
Normal file
206
node_modules/body-parser/lib/types/json.js
generated
vendored
Normal file
|
@ -0,0 +1,206 @@
|
|||
/*!
|
||||
* body-parser
|
||||
* Copyright(c) 2014 Jonathan Ong
|
||||
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var createError = require('http-errors')
|
||||
var debug = require('debug')('body-parser:json')
|
||||
var isFinished = require('on-finished').isFinished
|
||||
var read = require('../read')
|
||||
var typeis = require('type-is')
|
||||
var { getCharset, normalizeOptions } = require('../utils')
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = json
|
||||
|
||||
/**
|
||||
* RegExp to match the first non-space in a string.
|
||||
*
|
||||
* Allowed whitespace is defined in RFC 7159:
|
||||
*
|
||||
* ws = *(
|
||||
* %x20 / ; Space
|
||||
* %x09 / ; Horizontal tab
|
||||
* %x0A / ; Line feed or New line
|
||||
* %x0D ) ; Carriage return
|
||||
*/
|
||||
|
||||
var FIRST_CHAR_REGEXP = /^[\x20\x09\x0a\x0d]*([^\x20\x09\x0a\x0d])/ // eslint-disable-line no-control-regex
|
||||
|
||||
var JSON_SYNTAX_CHAR = '#'
|
||||
var JSON_SYNTAX_REGEXP = /#+/g
|
||||
|
||||
/**
|
||||
* Create a middleware to parse JSON bodies.
|
||||
*
|
||||
* @param {object} [options]
|
||||
* @return {function}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function json (options) {
|
||||
var { inflate, limit, verify, shouldParse } = normalizeOptions(options, 'application/json')
|
||||
|
||||
var reviver = options?.reviver
|
||||
var strict = options?.strict !== false
|
||||
|
||||
function parse (body) {
|
||||
if (body.length === 0) {
|
||||
// special-case empty json body, as it's a common client-side mistake
|
||||
// TODO: maybe make this configurable or part of "strict" option
|
||||
return {}
|
||||
}
|
||||
|
||||
if (strict) {
|
||||
var first = firstchar(body)
|
||||
|
||||
if (first !== '{' && first !== '[') {
|
||||
debug('strict violation')
|
||||
throw createStrictSyntaxError(body, first)
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
debug('parse json')
|
||||
return JSON.parse(body, reviver)
|
||||
} catch (e) {
|
||||
throw normalizeJsonSyntaxError(e, {
|
||||
message: e.message,
|
||||
stack: e.stack
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return function jsonParser (req, res, next) {
|
||||
if (isFinished(req)) {
|
||||
debug('body already parsed')
|
||||
next()
|
||||
return
|
||||
}
|
||||
|
||||
if (!('body' in req)) {
|
||||
req.body = undefined
|
||||
}
|
||||
|
||||
// skip requests without bodies
|
||||
if (!typeis.hasBody(req)) {
|
||||
debug('skip empty body')
|
||||
next()
|
||||
return
|
||||
}
|
||||
|
||||
debug('content-type %j', req.headers['content-type'])
|
||||
|
||||
// determine if request should be parsed
|
||||
if (!shouldParse(req)) {
|
||||
debug('skip parsing')
|
||||
next()
|
||||
return
|
||||
}
|
||||
|
||||
// assert charset per RFC 7159 sec 8.1
|
||||
var charset = getCharset(req) || 'utf-8'
|
||||
if (charset.slice(0, 4) !== 'utf-') {
|
||||
debug('invalid charset')
|
||||
next(createError(415, 'unsupported charset "' + charset.toUpperCase() + '"', {
|
||||
charset: charset,
|
||||
type: 'charset.unsupported'
|
||||
}))
|
||||
return
|
||||
}
|
||||
|
||||
// read
|
||||
read(req, res, next, parse, debug, {
|
||||
encoding: charset,
|
||||
inflate,
|
||||
limit,
|
||||
verify
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create strict violation syntax error matching native error.
|
||||
*
|
||||
* @param {string} str
|
||||
* @param {string} char
|
||||
* @return {Error}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function createStrictSyntaxError (str, char) {
|
||||
var index = str.indexOf(char)
|
||||
var partial = ''
|
||||
|
||||
if (index !== -1) {
|
||||
partial = str.substring(0, index) + JSON_SYNTAX_CHAR
|
||||
|
||||
for (var i = index + 1; i < str.length; i++) {
|
||||
partial += JSON_SYNTAX_CHAR
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
JSON.parse(partial); /* istanbul ignore next */ throw new SyntaxError('strict violation')
|
||||
} catch (e) {
|
||||
return normalizeJsonSyntaxError(e, {
|
||||
message: e.message.replace(JSON_SYNTAX_REGEXP, function (placeholder) {
|
||||
return str.substring(index, index + placeholder.length)
|
||||
}),
|
||||
stack: e.stack
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the first non-whitespace character in a string.
|
||||
*
|
||||
* @param {string} str
|
||||
* @return {function}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function firstchar (str) {
|
||||
var match = FIRST_CHAR_REGEXP.exec(str)
|
||||
|
||||
return match
|
||||
? match[1]
|
||||
: undefined
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize a SyntaxError for JSON.parse.
|
||||
*
|
||||
* @param {SyntaxError} error
|
||||
* @param {object} obj
|
||||
* @return {SyntaxError}
|
||||
*/
|
||||
|
||||
function normalizeJsonSyntaxError (error, obj) {
|
||||
var keys = Object.getOwnPropertyNames(error)
|
||||
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var key = keys[i]
|
||||
if (key !== 'stack' && key !== 'message') {
|
||||
delete error[key]
|
||||
}
|
||||
}
|
||||
|
||||
// replace stack before message for Node.js 0.10 and below
|
||||
error.stack = obj.stack.replace(error.message, obj.message)
|
||||
error.message = obj.message
|
||||
|
||||
return error
|
||||
}
|
75
node_modules/body-parser/lib/types/raw.js
generated
vendored
Normal file
75
node_modules/body-parser/lib/types/raw.js
generated
vendored
Normal file
|
@ -0,0 +1,75 @@
|
|||
/*!
|
||||
* body-parser
|
||||
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var debug = require('debug')('body-parser:raw')
|
||||
var isFinished = require('on-finished').isFinished
|
||||
var read = require('../read')
|
||||
var typeis = require('type-is')
|
||||
var { normalizeOptions } = require('../utils')
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = raw
|
||||
|
||||
/**
|
||||
* Create a middleware to parse raw bodies.
|
||||
*
|
||||
* @param {object} [options]
|
||||
* @return {function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function raw (options) {
|
||||
var { inflate, limit, verify, shouldParse } = normalizeOptions(options, 'application/octet-stream')
|
||||
|
||||
function parse (buf) {
|
||||
return buf
|
||||
}
|
||||
|
||||
return function rawParser (req, res, next) {
|
||||
if (isFinished(req)) {
|
||||
debug('body already parsed')
|
||||
next()
|
||||
return
|
||||
}
|
||||
|
||||
if (!('body' in req)) {
|
||||
req.body = undefined
|
||||
}
|
||||
|
||||
// skip requests without bodies
|
||||
if (!typeis.hasBody(req)) {
|
||||
debug('skip empty body')
|
||||
next()
|
||||
return
|
||||
}
|
||||
|
||||
debug('content-type %j', req.headers['content-type'])
|
||||
|
||||
// determine if request should be parsed
|
||||
if (!shouldParse(req)) {
|
||||
debug('skip parsing')
|
||||
next()
|
||||
return
|
||||
}
|
||||
|
||||
// read
|
||||
read(req, res, next, parse, debug, {
|
||||
encoding: null,
|
||||
inflate,
|
||||
limit,
|
||||
verify
|
||||
})
|
||||
}
|
||||
}
|
80
node_modules/body-parser/lib/types/text.js
generated
vendored
Normal file
80
node_modules/body-parser/lib/types/text.js
generated
vendored
Normal file
|
@ -0,0 +1,80 @@
|
|||
/*!
|
||||
* body-parser
|
||||
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var debug = require('debug')('body-parser:text')
|
||||
var isFinished = require('on-finished').isFinished
|
||||
var read = require('../read')
|
||||
var typeis = require('type-is')
|
||||
var { getCharset, normalizeOptions } = require('../utils')
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = text
|
||||
|
||||
/**
|
||||
* Create a middleware to parse text bodies.
|
||||
*
|
||||
* @param {object} [options]
|
||||
* @return {function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function text (options) {
|
||||
var { inflate, limit, verify, shouldParse } = normalizeOptions(options, 'text/plain')
|
||||
|
||||
var defaultCharset = options?.defaultCharset || 'utf-8'
|
||||
|
||||
function parse (buf) {
|
||||
return buf
|
||||
}
|
||||
|
||||
return function textParser (req, res, next) {
|
||||
if (isFinished(req)) {
|
||||
debug('body already parsed')
|
||||
next()
|
||||
return
|
||||
}
|
||||
|
||||
if (!('body' in req)) {
|
||||
req.body = undefined
|
||||
}
|
||||
|
||||
// skip requests without bodies
|
||||
if (!typeis.hasBody(req)) {
|
||||
debug('skip empty body')
|
||||
next()
|
||||
return
|
||||
}
|
||||
|
||||
debug('content-type %j', req.headers['content-type'])
|
||||
|
||||
// determine if request should be parsed
|
||||
if (!shouldParse(req)) {
|
||||
debug('skip parsing')
|
||||
next()
|
||||
return
|
||||
}
|
||||
|
||||
// get charset
|
||||
var charset = getCharset(req) || defaultCharset
|
||||
|
||||
// read
|
||||
read(req, res, next, parse, debug, {
|
||||
encoding: charset,
|
||||
inflate,
|
||||
limit,
|
||||
verify
|
||||
})
|
||||
}
|
||||
}
|
177
node_modules/body-parser/lib/types/urlencoded.js
generated
vendored
Normal file
177
node_modules/body-parser/lib/types/urlencoded.js
generated
vendored
Normal file
|
@ -0,0 +1,177 @@
|
|||
/*!
|
||||
* body-parser
|
||||
* Copyright(c) 2014 Jonathan Ong
|
||||
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var createError = require('http-errors')
|
||||
var debug = require('debug')('body-parser:urlencoded')
|
||||
var isFinished = require('on-finished').isFinished
|
||||
var read = require('../read')
|
||||
var typeis = require('type-is')
|
||||
var qs = require('qs')
|
||||
var { getCharset, normalizeOptions } = require('../utils')
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = urlencoded
|
||||
|
||||
/**
|
||||
* Create a middleware to parse urlencoded bodies.
|
||||
*
|
||||
* @param {object} [options]
|
||||
* @return {function}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function urlencoded (options) {
|
||||
var { inflate, limit, verify, shouldParse } = normalizeOptions(options, 'application/x-www-form-urlencoded')
|
||||
|
||||
var defaultCharset = options?.defaultCharset || 'utf-8'
|
||||
if (defaultCharset !== 'utf-8' && defaultCharset !== 'iso-8859-1') {
|
||||
throw new TypeError('option defaultCharset must be either utf-8 or iso-8859-1')
|
||||
}
|
||||
|
||||
// create the appropriate query parser
|
||||
var queryparse = createQueryParser(options)
|
||||
|
||||
function parse (body, encoding) {
|
||||
return body.length
|
||||
? queryparse(body, encoding)
|
||||
: {}
|
||||
}
|
||||
|
||||
return function urlencodedParser (req, res, next) {
|
||||
if (isFinished(req)) {
|
||||
debug('body already parsed')
|
||||
next()
|
||||
return
|
||||
}
|
||||
|
||||
if (!('body' in req)) {
|
||||
req.body = undefined
|
||||
}
|
||||
|
||||
// skip requests without bodies
|
||||
if (!typeis.hasBody(req)) {
|
||||
debug('skip empty body')
|
||||
next()
|
||||
return
|
||||
}
|
||||
|
||||
debug('content-type %j', req.headers['content-type'])
|
||||
|
||||
// determine if request should be parsed
|
||||
if (!shouldParse(req)) {
|
||||
debug('skip parsing')
|
||||
next()
|
||||
return
|
||||
}
|
||||
|
||||
// assert charset
|
||||
var charset = getCharset(req) || defaultCharset
|
||||
if (charset !== 'utf-8' && charset !== 'iso-8859-1') {
|
||||
debug('invalid charset')
|
||||
next(createError(415, 'unsupported charset "' + charset.toUpperCase() + '"', {
|
||||
charset: charset,
|
||||
type: 'charset.unsupported'
|
||||
}))
|
||||
return
|
||||
}
|
||||
|
||||
// read
|
||||
read(req, res, next, parse, debug, {
|
||||
encoding: charset,
|
||||
inflate,
|
||||
limit,
|
||||
verify
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the extended query parser.
|
||||
*
|
||||
* @param {object} options
|
||||
*/
|
||||
|
||||
function createQueryParser (options) {
|
||||
var extended = Boolean(options?.extended)
|
||||
var parameterLimit = options?.parameterLimit !== undefined
|
||||
? options?.parameterLimit
|
||||
: 1000
|
||||
var charsetSentinel = options?.charsetSentinel
|
||||
var interpretNumericEntities = options?.interpretNumericEntities
|
||||
var depth = extended ? (options?.depth !== undefined ? options?.depth : 32) : 0
|
||||
|
||||
if (isNaN(parameterLimit) || parameterLimit < 1) {
|
||||
throw new TypeError('option parameterLimit must be a positive number')
|
||||
}
|
||||
|
||||
if (isNaN(depth) || depth < 0) {
|
||||
throw new TypeError('option depth must be a zero or a positive number')
|
||||
}
|
||||
|
||||
if (isFinite(parameterLimit)) {
|
||||
parameterLimit = parameterLimit | 0
|
||||
}
|
||||
|
||||
return function queryparse (body, encoding) {
|
||||
var paramCount = parameterCount(body, parameterLimit)
|
||||
|
||||
if (paramCount === undefined) {
|
||||
debug('too many parameters')
|
||||
throw createError(413, 'too many parameters', {
|
||||
type: 'parameters.too.many'
|
||||
})
|
||||
}
|
||||
|
||||
var arrayLimit = extended ? Math.max(100, paramCount) : 0
|
||||
|
||||
debug('parse ' + (extended ? 'extended ' : '') + 'urlencoding')
|
||||
try {
|
||||
return qs.parse(body, {
|
||||
allowPrototypes: true,
|
||||
arrayLimit: arrayLimit,
|
||||
depth: depth,
|
||||
charsetSentinel: charsetSentinel,
|
||||
interpretNumericEntities: interpretNumericEntities,
|
||||
charset: encoding,
|
||||
parameterLimit: parameterLimit,
|
||||
strictDepth: true
|
||||
})
|
||||
} catch (err) {
|
||||
if (err instanceof RangeError) {
|
||||
throw createError(400, 'The input exceeded the depth', {
|
||||
type: 'querystring.parse.rangeError'
|
||||
})
|
||||
} else {
|
||||
throw err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Count the number of parameters, stopping once limit reached
|
||||
*
|
||||
* @param {string} body
|
||||
* @param {number} limit
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function parameterCount (body, limit) {
|
||||
var len = body.split('&').length
|
||||
|
||||
return len > limit ? undefined : len - 1
|
||||
}
|
83
node_modules/body-parser/lib/utils.js
generated
vendored
Normal file
83
node_modules/body-parser/lib/utils.js
generated
vendored
Normal file
|
@ -0,0 +1,83 @@
|
|||
'use strict'
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var bytes = require('bytes')
|
||||
var contentType = require('content-type')
|
||||
var typeis = require('type-is')
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
getCharset,
|
||||
normalizeOptions
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the charset of a request.
|
||||
*
|
||||
* @param {object} req
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function getCharset (req) {
|
||||
try {
|
||||
return (contentType.parse(req).parameters.charset || '').toLowerCase()
|
||||
} catch {
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the simple type checker.
|
||||
*
|
||||
* @param {string | string[]} type
|
||||
* @return {function}
|
||||
*/
|
||||
|
||||
function typeChecker (type) {
|
||||
return function checkType (req) {
|
||||
return Boolean(typeis(req, type))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalizes the common options for all parsers.
|
||||
*
|
||||
* @param {object} options options to normalize
|
||||
* @param {string | string[] | function} defaultType default content type(s) or a function to determine it
|
||||
* @returns {object}
|
||||
*/
|
||||
function normalizeOptions (options, defaultType) {
|
||||
if (!defaultType) {
|
||||
// Parsers must define a default content type
|
||||
throw new TypeError('defaultType must be provided')
|
||||
}
|
||||
|
||||
var inflate = options?.inflate !== false
|
||||
var limit = typeof options?.limit !== 'number'
|
||||
? bytes.parse(options?.limit || '100kb')
|
||||
: options?.limit
|
||||
var type = options?.type || defaultType
|
||||
var verify = options?.verify || false
|
||||
|
||||
if (verify !== false && typeof verify !== 'function') {
|
||||
throw new TypeError('option verify must be function')
|
||||
}
|
||||
|
||||
// create the appropriate type checking function
|
||||
var shouldParse = typeof type !== 'function'
|
||||
? typeChecker(type)
|
||||
: type
|
||||
|
||||
return {
|
||||
inflate,
|
||||
limit,
|
||||
verify,
|
||||
shouldParse
|
||||
}
|
||||
}
|
49
node_modules/body-parser/package.json
generated
vendored
Normal file
49
node_modules/body-parser/package.json
generated
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
"name": "body-parser",
|
||||
"description": "Node.js body parsing middleware",
|
||||
"version": "2.2.0",
|
||||
"contributors": [
|
||||
"Douglas Christopher Wilson <doug@somethingdoug.com>",
|
||||
"Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": "expressjs/body-parser",
|
||||
"dependencies": {
|
||||
"bytes": "^3.1.2",
|
||||
"content-type": "^1.0.5",
|
||||
"debug": "^4.4.0",
|
||||
"http-errors": "^2.0.0",
|
||||
"iconv-lite": "^0.6.3",
|
||||
"on-finished": "^2.4.1",
|
||||
"qs": "^6.14.0",
|
||||
"raw-body": "^3.0.0",
|
||||
"type-is": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "8.34.0",
|
||||
"eslint-config-standard": "14.1.1",
|
||||
"eslint-plugin-import": "2.27.5",
|
||||
"eslint-plugin-markdown": "3.0.0",
|
||||
"eslint-plugin-node": "11.1.0",
|
||||
"eslint-plugin-promise": "6.1.1",
|
||||
"eslint-plugin-standard": "4.1.0",
|
||||
"mocha": "^11.1.0",
|
||||
"nyc": "^17.1.0",
|
||||
"supertest": "^7.0.0"
|
||||
},
|
||||
"files": [
|
||||
"lib/",
|
||||
"LICENSE",
|
||||
"HISTORY.md",
|
||||
"index.js"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"test": "mocha --reporter spec --check-leaks test/",
|
||||
"test-ci": "nyc --reporter=lcovonly --reporter=text npm test",
|
||||
"test-cov": "nyc --reporter=html --reporter=text npm test"
|
||||
}
|
||||
}
|
97
node_modules/bytes/History.md
generated
vendored
Normal file
97
node_modules/bytes/History.md
generated
vendored
Normal file
|
@ -0,0 +1,97 @@
|
|||
3.1.2 / 2022-01-27
|
||||
==================
|
||||
|
||||
* Fix return value for un-parsable strings
|
||||
|
||||
3.1.1 / 2021-11-15
|
||||
==================
|
||||
|
||||
* Fix "thousandsSeparator" incorrecting formatting fractional part
|
||||
|
||||
3.1.0 / 2019-01-22
|
||||
==================
|
||||
|
||||
* Add petabyte (`pb`) support
|
||||
|
||||
3.0.0 / 2017-08-31
|
||||
==================
|
||||
|
||||
* Change "kB" to "KB" in format output
|
||||
* Remove support for Node.js 0.6
|
||||
* Remove support for ComponentJS
|
||||
|
||||
2.5.0 / 2017-03-24
|
||||
==================
|
||||
|
||||
* Add option "unit"
|
||||
|
||||
2.4.0 / 2016-06-01
|
||||
==================
|
||||
|
||||
* Add option "unitSeparator"
|
||||
|
||||
2.3.0 / 2016-02-15
|
||||
==================
|
||||
|
||||
* Drop partial bytes on all parsed units
|
||||
* Fix non-finite numbers to `.format` to return `null`
|
||||
* Fix parsing byte string that looks like hex
|
||||
* perf: hoist regular expressions
|
||||
|
||||
2.2.0 / 2015-11-13
|
||||
==================
|
||||
|
||||
* add option "decimalPlaces"
|
||||
* add option "fixedDecimals"
|
||||
|
||||
2.1.0 / 2015-05-21
|
||||
==================
|
||||
|
||||
* add `.format` export
|
||||
* add `.parse` export
|
||||
|
||||
2.0.2 / 2015-05-20
|
||||
==================
|
||||
|
||||
* remove map recreation
|
||||
* remove unnecessary object construction
|
||||
|
||||
2.0.1 / 2015-05-07
|
||||
==================
|
||||
|
||||
* fix browserify require
|
||||
* remove node.extend dependency
|
||||
|
||||
2.0.0 / 2015-04-12
|
||||
==================
|
||||
|
||||
* add option "case"
|
||||
* add option "thousandsSeparator"
|
||||
* return "null" on invalid parse input
|
||||
* support proper round-trip: bytes(bytes(num)) === num
|
||||
* units no longer case sensitive when parsing
|
||||
|
||||
1.0.0 / 2014-05-05
|
||||
==================
|
||||
|
||||
* add negative support. fixes #6
|
||||
|
||||
0.3.0 / 2014-03-19
|
||||
==================
|
||||
|
||||
* added terabyte support
|
||||
|
||||
0.2.1 / 2013-04-01
|
||||
==================
|
||||
|
||||
* add .component
|
||||
|
||||
0.2.0 / 2012-10-28
|
||||
==================
|
||||
|
||||
* bytes(200).should.eql('200b')
|
||||
|
||||
0.1.0 / 2012-07-04
|
||||
==================
|
||||
|
||||
* add bytes to string conversion [yields]
|
23
node_modules/bytes/LICENSE
generated
vendored
Normal file
23
node_modules/bytes/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
(The MIT License)
|
||||
|
||||
Copyright (c) 2012-2014 TJ Holowaychuk <tj@vision-media.ca>
|
||||
Copyright (c) 2015 Jed Watson <jed.watson@me.com>
|
||||
|
||||
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:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
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.
|
152
node_modules/bytes/Readme.md
generated
vendored
Normal file
152
node_modules/bytes/Readme.md
generated
vendored
Normal file
|
@ -0,0 +1,152 @@
|
|||
# Bytes utility
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Build Status][ci-image]][ci-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
Utility to parse a string bytes (ex: `1TB`) to bytes (`1099511627776`) and vice-versa.
|
||||
|
||||
## Installation
|
||||
|
||||
This is a [Node.js](https://nodejs.org/en/) module available through the
|
||||
[npm registry](https://www.npmjs.com/). Installation is done using the
|
||||
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
||||
|
||||
```bash
|
||||
$ npm install bytes
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var bytes = require('bytes');
|
||||
```
|
||||
|
||||
#### bytes(number|string value, [options]): number|string|null
|
||||
|
||||
Default export function. Delegates to either `bytes.format` or `bytes.parse` based on the type of `value`.
|
||||
|
||||
**Arguments**
|
||||
|
||||
| Name | Type | Description |
|
||||
|---------|----------|--------------------|
|
||||
| value | `number`|`string` | Number value to format or string value to parse |
|
||||
| options | `Object` | Conversion options for `format` |
|
||||
|
||||
**Returns**
|
||||
|
||||
| Name | Type | Description |
|
||||
|---------|------------------|-------------------------------------------------|
|
||||
| results | `string`|`number`|`null` | Return null upon error. Numeric value in bytes, or string value otherwise. |
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
bytes(1024);
|
||||
// output: '1KB'
|
||||
|
||||
bytes('1KB');
|
||||
// output: 1024
|
||||
```
|
||||
|
||||
#### bytes.format(number value, [options]): string|null
|
||||
|
||||
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
|
||||
rounded.
|
||||
|
||||
**Arguments**
|
||||
|
||||
| Name | Type | Description |
|
||||
|---------|----------|--------------------|
|
||||
| value | `number` | Value in bytes |
|
||||
| options | `Object` | Conversion options |
|
||||
|
||||
**Options**
|
||||
|
||||
| Property | Type | Description |
|
||||
|-------------------|--------|-----------------------------------------------------------------------------------------|
|
||||
| decimalPlaces | `number`|`null` | Maximum number of decimal places to include in output. Default value to `2`. |
|
||||
| fixedDecimals | `boolean`|`null` | Whether to always display the maximum number of decimal places. Default value to `false` |
|
||||
| thousandsSeparator | `string`|`null` | Example of values: `' '`, `','` and `'.'`... Default value to `''`. |
|
||||
| unit | `string`|`null` | The unit in which the result will be returned (B/KB/MB/GB/TB). Default value to `''` (which means auto detect). |
|
||||
| unitSeparator | `string`|`null` | Separator to use between number and unit. Default value to `''`. |
|
||||
|
||||
**Returns**
|
||||
|
||||
| Name | Type | Description |
|
||||
|---------|------------------|-------------------------------------------------|
|
||||
| results | `string`|`null` | Return null upon error. String value otherwise. |
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
bytes.format(1024);
|
||||
// output: '1KB'
|
||||
|
||||
bytes.format(1000);
|
||||
// output: '1000B'
|
||||
|
||||
bytes.format(1000, {thousandsSeparator: ' '});
|
||||
// output: '1 000B'
|
||||
|
||||
bytes.format(1024 * 1.7, {decimalPlaces: 0});
|
||||
// output: '2KB'
|
||||
|
||||
bytes.format(1024, {unitSeparator: ' '});
|
||||
// output: '1 KB'
|
||||
```
|
||||
|
||||
#### bytes.parse(string|number value): number|null
|
||||
|
||||
Parse the string value into an integer in bytes. If no unit is given, or `value`
|
||||
is a number, it is assumed the value is in bytes.
|
||||
|
||||
Supported units and abbreviations are as follows and are case-insensitive:
|
||||
|
||||
* `b` for bytes
|
||||
* `kb` for kilobytes
|
||||
* `mb` for megabytes
|
||||
* `gb` for gigabytes
|
||||
* `tb` for terabytes
|
||||
* `pb` for petabytes
|
||||
|
||||
The units are in powers of two, not ten. This means 1kb = 1024b according to this parser.
|
||||
|
||||
**Arguments**
|
||||
|
||||
| Name | Type | Description |
|
||||
|---------------|--------|--------------------|
|
||||
| value | `string`|`number` | String to parse, or number in bytes. |
|
||||
|
||||
**Returns**
|
||||
|
||||
| Name | Type | Description |
|
||||
|---------|-------------|-------------------------|
|
||||
| results | `number`|`null` | Return null upon error. Value in bytes otherwise. |
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
bytes.parse('1KB');
|
||||
// output: 1024
|
||||
|
||||
bytes.parse('1024');
|
||||
// output: 1024
|
||||
|
||||
bytes.parse(1024);
|
||||
// output: 1024
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[ci-image]: https://badgen.net/github/checks/visionmedia/bytes.js/master?label=ci
|
||||
[ci-url]: https://github.com/visionmedia/bytes.js/actions?query=workflow%3Aci
|
||||
[coveralls-image]: https://badgen.net/coveralls/c/github/visionmedia/bytes.js/master
|
||||
[coveralls-url]: https://coveralls.io/r/visionmedia/bytes.js?branch=master
|
||||
[downloads-image]: https://badgen.net/npm/dm/bytes
|
||||
[downloads-url]: https://npmjs.org/package/bytes
|
||||
[npm-image]: https://badgen.net/npm/v/bytes
|
||||
[npm-url]: https://npmjs.org/package/bytes
|
170
node_modules/bytes/index.js
generated
vendored
Normal file
170
node_modules/bytes/index.js
generated
vendored
Normal file
|
@ -0,0 +1,170 @@
|
|||
/*!
|
||||
* bytes
|
||||
* Copyright(c) 2012-2014 TJ Holowaychuk
|
||||
* Copyright(c) 2015 Jed Watson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = bytes;
|
||||
module.exports.format = format;
|
||||
module.exports.parse = parse;
|
||||
|
||||
/**
|
||||
* Module variables.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g;
|
||||
|
||||
var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/;
|
||||
|
||||
var map = {
|
||||
b: 1,
|
||||
kb: 1 << 10,
|
||||
mb: 1 << 20,
|
||||
gb: 1 << 30,
|
||||
tb: Math.pow(1024, 4),
|
||||
pb: Math.pow(1024, 5),
|
||||
};
|
||||
|
||||
var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;
|
||||
|
||||
/**
|
||||
* Convert the given value in bytes into a string or parse to string to an integer in bytes.
|
||||
*
|
||||
* @param {string|number} value
|
||||
* @param {{
|
||||
* case: [string],
|
||||
* decimalPlaces: [number]
|
||||
* fixedDecimals: [boolean]
|
||||
* thousandsSeparator: [string]
|
||||
* unitSeparator: [string]
|
||||
* }} [options] bytes options.
|
||||
*
|
||||
* @returns {string|number|null}
|
||||
*/
|
||||
|
||||
function bytes(value, options) {
|
||||
if (typeof value === 'string') {
|
||||
return parse(value);
|
||||
}
|
||||
|
||||
if (typeof value === 'number') {
|
||||
return format(value, options);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 rounded.
|
||||
*
|
||||
* @param {number} value
|
||||
* @param {object} [options]
|
||||
* @param {number} [options.decimalPlaces=2]
|
||||
* @param {number} [options.fixedDecimals=false]
|
||||
* @param {string} [options.thousandsSeparator=]
|
||||
* @param {string} [options.unit=]
|
||||
* @param {string} [options.unitSeparator=]
|
||||
*
|
||||
* @returns {string|null}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function format(value, options) {
|
||||
if (!Number.isFinite(value)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var mag = Math.abs(value);
|
||||
var thousandsSeparator = (options && options.thousandsSeparator) || '';
|
||||
var unitSeparator = (options && options.unitSeparator) || '';
|
||||
var decimalPlaces = (options && options.decimalPlaces !== undefined) ? options.decimalPlaces : 2;
|
||||
var fixedDecimals = Boolean(options && options.fixedDecimals);
|
||||
var unit = (options && options.unit) || '';
|
||||
|
||||
if (!unit || !map[unit.toLowerCase()]) {
|
||||
if (mag >= map.pb) {
|
||||
unit = 'PB';
|
||||
} else if (mag >= map.tb) {
|
||||
unit = 'TB';
|
||||
} else if (mag >= map.gb) {
|
||||
unit = 'GB';
|
||||
} else if (mag >= map.mb) {
|
||||
unit = 'MB';
|
||||
} else if (mag >= map.kb) {
|
||||
unit = 'KB';
|
||||
} else {
|
||||
unit = 'B';
|
||||
}
|
||||
}
|
||||
|
||||
var val = value / map[unit.toLowerCase()];
|
||||
var str = val.toFixed(decimalPlaces);
|
||||
|
||||
if (!fixedDecimals) {
|
||||
str = str.replace(formatDecimalsRegExp, '$1');
|
||||
}
|
||||
|
||||
if (thousandsSeparator) {
|
||||
str = str.split('.').map(function (s, i) {
|
||||
return i === 0
|
||||
? s.replace(formatThousandsRegExp, thousandsSeparator)
|
||||
: s
|
||||
}).join('.');
|
||||
}
|
||||
|
||||
return str + unitSeparator + unit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the string value into an integer in bytes.
|
||||
*
|
||||
* If no unit is given, it is assumed the value is in bytes.
|
||||
*
|
||||
* @param {number|string} val
|
||||
*
|
||||
* @returns {number|null}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function parse(val) {
|
||||
if (typeof val === 'number' && !isNaN(val)) {
|
||||
return val;
|
||||
}
|
||||
|
||||
if (typeof val !== 'string') {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Test if the string passed is valid
|
||||
var results = parseRegExp.exec(val);
|
||||
var floatValue;
|
||||
var unit = 'b';
|
||||
|
||||
if (!results) {
|
||||
// Nothing could be extracted from the given string
|
||||
floatValue = parseInt(val, 10);
|
||||
unit = 'b'
|
||||
} else {
|
||||
// Retrieve the value and the unit
|
||||
floatValue = parseFloat(results[1]);
|
||||
unit = results[4].toLowerCase();
|
||||
}
|
||||
|
||||
if (isNaN(floatValue)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return Math.floor(map[unit] * floatValue);
|
||||
}
|
42
node_modules/bytes/package.json
generated
vendored
Normal file
42
node_modules/bytes/package.json
generated
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
"name": "bytes",
|
||||
"description": "Utility to parse a string bytes to bytes and vice-versa",
|
||||
"version": "3.1.2",
|
||||
"author": "TJ Holowaychuk <tj@vision-media.ca> (http://tjholowaychuk.com)",
|
||||
"contributors": [
|
||||
"Jed Watson <jed.watson@me.com>",
|
||||
"Théo FIDRY <theo.fidry@gmail.com>"
|
||||
],
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"byte",
|
||||
"bytes",
|
||||
"utility",
|
||||
"parse",
|
||||
"parser",
|
||||
"convert",
|
||||
"converter"
|
||||
],
|
||||
"repository": "visionmedia/bytes.js",
|
||||
"devDependencies": {
|
||||
"eslint": "7.32.0",
|
||||
"eslint-plugin-markdown": "2.2.1",
|
||||
"mocha": "9.2.0",
|
||||
"nyc": "15.1.0"
|
||||
},
|
||||
"files": [
|
||||
"History.md",
|
||||
"LICENSE",
|
||||
"Readme.md",
|
||||
"index.js"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"test": "mocha --check-leaks --reporter spec",
|
||||
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
|
||||
"test-cov": "nyc --reporter=html --reporter=text npm test"
|
||||
}
|
||||
}
|
17
node_modules/call-bind-apply-helpers/.eslintrc
generated
vendored
Normal file
17
node_modules/call-bind-apply-helpers/.eslintrc
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "@ljharb",
|
||||
|
||||
"rules": {
|
||||
"func-name-matching": 0,
|
||||
"id-length": 0,
|
||||
"new-cap": [2, {
|
||||
"capIsNewExceptions": [
|
||||
"GetIntrinsic",
|
||||
],
|
||||
}],
|
||||
"no-extra-parens": 0,
|
||||
"no-magic-numbers": 0,
|
||||
},
|
||||
}
|
12
node_modules/call-bind-apply-helpers/.github/FUNDING.yml
generated
vendored
Normal file
12
node_modules/call-bind-apply-helpers/.github/FUNDING.yml
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
# These are supported funding model platforms
|
||||
|
||||
github: [ljharb]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: npm/call-bind-apply-helpers
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
9
node_modules/call-bind-apply-helpers/.nycrc
generated
vendored
Normal file
9
node_modules/call-bind-apply-helpers/.nycrc
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"all": true,
|
||||
"check-coverage": false,
|
||||
"reporter": ["text-summary", "text", "html", "json"],
|
||||
"exclude": [
|
||||
"coverage",
|
||||
"test"
|
||||
]
|
||||
}
|
30
node_modules/call-bind-apply-helpers/CHANGELOG.md
generated
vendored
Normal file
30
node_modules/call-bind-apply-helpers/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [v1.0.2](https://github.com/ljharb/call-bind-apply-helpers/compare/v1.0.1...v1.0.2) - 2025-02-12
|
||||
|
||||
### Commits
|
||||
|
||||
- [types] improve inferred types [`e6f9586`](https://github.com/ljharb/call-bind-apply-helpers/commit/e6f95860a3c72879cb861a858cdfb8138fbedec1)
|
||||
- [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)
|
||||
|
||||
## [v1.0.1](https://github.com/ljharb/call-bind-apply-helpers/compare/v1.0.0...v1.0.1) - 2024-12-08
|
||||
|
||||
### Commits
|
||||
|
||||
- [types] `reflectApply`: fix types [`4efc396`](https://github.com/ljharb/call-bind-apply-helpers/commit/4efc3965351a4f02cc55e836fa391d3d11ef2ef8)
|
||||
- [Fix] `reflectApply`: oops, Reflect is not a function [`83cc739`](https://github.com/ljharb/call-bind-apply-helpers/commit/83cc7395de6b79b7730bdf092f1436f0b1263c75)
|
||||
- [Dev Deps] update `@arethetypeswrong/cli` [`80bd5d3`](https://github.com/ljharb/call-bind-apply-helpers/commit/80bd5d3ae58b4f6b6995ce439dd5a1bcb178a940)
|
||||
|
||||
## v1.0.0 - 2024-12-05
|
||||
|
||||
### Commits
|
||||
|
||||
- Initial implementation, tests, readme [`7879629`](https://github.com/ljharb/call-bind-apply-helpers/commit/78796290f9b7430c9934d6f33d94ae9bc89fce04)
|
||||
- Initial commit [`3f1dc16`](https://github.com/ljharb/call-bind-apply-helpers/commit/3f1dc164afc43285631b114a5f9dd9137b2b952f)
|
||||
- npm init [`081df04`](https://github.com/ljharb/call-bind-apply-helpers/commit/081df048c312fcee400922026f6e97281200a603)
|
||||
- Only apps should have lockfiles [`5b9ca0f`](https://github.com/ljharb/call-bind-apply-helpers/commit/5b9ca0fe8101ebfaf309c549caac4e0a017ed930)
|
21
node_modules/call-bind-apply-helpers/LICENSE
generated
vendored
Normal file
21
node_modules/call-bind-apply-helpers/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2024 Jordan Harband
|
||||
|
||||
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:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
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.
|
62
node_modules/call-bind-apply-helpers/README.md
generated
vendored
Normal file
62
node_modules/call-bind-apply-helpers/README.md
generated
vendored
Normal file
|
@ -0,0 +1,62 @@
|
|||
# call-bind-apply-helpers <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
||||
|
||||
[![github actions][actions-image]][actions-url]
|
||||
[![coverage][codecov-image]][codecov-url]
|
||||
[![dependency status][deps-svg]][deps-url]
|
||||
[![dev dependency status][dev-deps-svg]][dev-deps-url]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
|
||||
[![npm badge][npm-badge-png]][package-url]
|
||||
|
||||
Helper functions around Function call/apply/bind, for use in `call-bind`.
|
||||
|
||||
The only packages that should likely ever use this package directly are `call-bind` and `get-intrinsic`.
|
||||
Please use `call-bind` unless you have a very good reason not to.
|
||||
|
||||
## Getting started
|
||||
|
||||
```sh
|
||||
npm install --save call-bind-apply-helpers
|
||||
```
|
||||
|
||||
## Usage/Examples
|
||||
|
||||
```js
|
||||
const assert = require('assert');
|
||||
const callBindBasic = require('call-bind-apply-helpers');
|
||||
|
||||
function f(a, b) {
|
||||
assert.equal(this, 1);
|
||||
assert.equal(a, 2);
|
||||
assert.equal(b, 3);
|
||||
assert.equal(arguments.length, 2);
|
||||
}
|
||||
|
||||
const fBound = callBindBasic([f, 1]);
|
||||
|
||||
delete Function.prototype.call;
|
||||
delete Function.prototype.bind;
|
||||
|
||||
fBound(2, 3);
|
||||
```
|
||||
|
||||
## Tests
|
||||
|
||||
Clone the repo, `npm install`, and run `npm test`
|
||||
|
||||
[package-url]: https://npmjs.org/package/call-bind-apply-helpers
|
||||
[npm-version-svg]: https://versionbadg.es/ljharb/call-bind-apply-helpers.svg
|
||||
[deps-svg]: https://david-dm.org/ljharb/call-bind-apply-helpers.svg
|
||||
[deps-url]: https://david-dm.org/ljharb/call-bind-apply-helpers
|
||||
[dev-deps-svg]: https://david-dm.org/ljharb/call-bind-apply-helpers/dev-status.svg
|
||||
[dev-deps-url]: https://david-dm.org/ljharb/call-bind-apply-helpers#info=devDependencies
|
||||
[npm-badge-png]: https://nodei.co/npm/call-bind-apply-helpers.png?downloads=true&stars=true
|
||||
[license-image]: https://img.shields.io/npm/l/call-bind-apply-helpers.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: https://img.shields.io/npm/dm/call-bind-apply-helpers.svg
|
||||
[downloads-url]: https://npm-stat.com/charts.html?package=call-bind-apply-helpers
|
||||
[codecov-image]: https://codecov.io/gh/ljharb/call-bind-apply-helpers/branch/main/graphs/badge.svg
|
||||
[codecov-url]: https://app.codecov.io/gh/ljharb/call-bind-apply-helpers/
|
||||
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/call-bind-apply-helpers
|
||||
[actions-url]: https://github.com/ljharb/call-bind-apply-helpers/actions
|
1
node_modules/call-bind-apply-helpers/actualApply.d.ts
generated
vendored
Normal file
1
node_modules/call-bind-apply-helpers/actualApply.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export = Reflect.apply;
|
10
node_modules/call-bind-apply-helpers/actualApply.js
generated
vendored
Normal file
10
node_modules/call-bind-apply-helpers/actualApply.js
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
'use strict';
|
||||
|
||||
var bind = require('function-bind');
|
||||
|
||||
var $apply = require('./functionApply');
|
||||
var $call = require('./functionCall');
|
||||
var $reflectApply = require('./reflectApply');
|
||||
|
||||
/** @type {import('./actualApply')} */
|
||||
module.exports = $reflectApply || bind.call($call, $apply);
|
19
node_modules/call-bind-apply-helpers/applyBind.d.ts
generated
vendored
Normal file
19
node_modules/call-bind-apply-helpers/applyBind.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
import actualApply from './actualApply';
|
||||
|
||||
type TupleSplitHead<T extends any[], N extends number> = T['length'] extends N
|
||||
? T
|
||||
: T extends [...infer R, any]
|
||||
? TupleSplitHead<R, N>
|
||||
: never
|
||||
|
||||
type TupleSplitTail<T, N extends number, O extends any[] = []> = O['length'] extends N
|
||||
? T
|
||||
: T extends [infer F, ...infer R]
|
||||
? TupleSplitTail<[...R], N, [...O, F]>
|
||||
: never
|
||||
|
||||
type TupleSplit<T extends any[], N extends number> = [TupleSplitHead<T, N>, TupleSplitTail<T, N>]
|
||||
|
||||
declare function applyBind(...args: TupleSplit<Parameters<typeof actualApply>, 2>[1]): ReturnType<typeof actualApply>;
|
||||
|
||||
export = applyBind;
|
10
node_modules/call-bind-apply-helpers/applyBind.js
generated
vendored
Normal file
10
node_modules/call-bind-apply-helpers/applyBind.js
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
'use strict';
|
||||
|
||||
var bind = require('function-bind');
|
||||
var $apply = require('./functionApply');
|
||||
var actualApply = require('./actualApply');
|
||||
|
||||
/** @type {import('./applyBind')} */
|
||||
module.exports = function applyBind() {
|
||||
return actualApply(bind, $apply, arguments);
|
||||
};
|
1
node_modules/call-bind-apply-helpers/functionApply.d.ts
generated
vendored
Normal file
1
node_modules/call-bind-apply-helpers/functionApply.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export = Function.prototype.apply;
|
4
node_modules/call-bind-apply-helpers/functionApply.js
generated
vendored
Normal file
4
node_modules/call-bind-apply-helpers/functionApply.js
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
'use strict';
|
||||
|
||||
/** @type {import('./functionApply')} */
|
||||
module.exports = Function.prototype.apply;
|
1
node_modules/call-bind-apply-helpers/functionCall.d.ts
generated
vendored
Normal file
1
node_modules/call-bind-apply-helpers/functionCall.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export = Function.prototype.call;
|
4
node_modules/call-bind-apply-helpers/functionCall.js
generated
vendored
Normal file
4
node_modules/call-bind-apply-helpers/functionCall.js
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
'use strict';
|
||||
|
||||
/** @type {import('./functionCall')} */
|
||||
module.exports = Function.prototype.call;
|
64
node_modules/call-bind-apply-helpers/index.d.ts
generated
vendored
Normal file
64
node_modules/call-bind-apply-helpers/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
type RemoveFromTuple<
|
||||
Tuple extends readonly unknown[],
|
||||
RemoveCount extends number,
|
||||
Index extends 1[] = []
|
||||
> = Index["length"] extends RemoveCount
|
||||
? Tuple
|
||||
: Tuple extends [infer First, ...infer Rest]
|
||||
? RemoveFromTuple<Rest, RemoveCount, [...Index, 1]>
|
||||
: Tuple;
|
||||
|
||||
type ConcatTuples<
|
||||
Prefix extends readonly unknown[],
|
||||
Suffix extends readonly unknown[]
|
||||
> = [...Prefix, ...Suffix];
|
||||
|
||||
type ExtractFunctionParams<T> = T extends (this: infer TThis, ...args: infer P extends readonly unknown[]) => infer R
|
||||
? { thisArg: TThis; params: P; returnType: R }
|
||||
: never;
|
||||
|
||||
type BindFunction<
|
||||
T extends (this: any, ...args: any[]) => any,
|
||||
TThis,
|
||||
TBoundArgs extends readonly unknown[],
|
||||
ReceiverBound extends boolean
|
||||
> = ExtractFunctionParams<T> extends {
|
||||
thisArg: infer OrigThis;
|
||||
params: infer P extends readonly unknown[];
|
||||
returnType: infer R;
|
||||
}
|
||||
? ReceiverBound extends true
|
||||
? (...args: RemoveFromTuple<P, Extract<TBoundArgs["length"], number>>) => R extends [OrigThis, ...infer Rest]
|
||||
? [TThis, ...Rest] // Replace `this` with `thisArg`
|
||||
: R
|
||||
: <U, RemainingArgs extends RemoveFromTuple<P, Extract<TBoundArgs["length"], number>>>(
|
||||
thisArg: U,
|
||||
...args: RemainingArgs
|
||||
) => R extends [OrigThis, ...infer Rest]
|
||||
? [U, ...ConcatTuples<TBoundArgs, Rest>] // Preserve bound args in return type
|
||||
: R
|
||||
: never;
|
||||
|
||||
declare function callBind<
|
||||
const T extends (this: any, ...args: any[]) => any,
|
||||
Extracted extends ExtractFunctionParams<T>,
|
||||
const TBoundArgs extends Partial<Extracted["params"]> & readonly unknown[],
|
||||
const TThis extends Extracted["thisArg"]
|
||||
>(
|
||||
args: [fn: T, thisArg: TThis, ...boundArgs: TBoundArgs]
|
||||
): BindFunction<T, TThis, TBoundArgs, true>;
|
||||
|
||||
declare function callBind<
|
||||
const T extends (this: any, ...args: any[]) => any,
|
||||
Extracted extends ExtractFunctionParams<T>,
|
||||
const TBoundArgs extends Partial<Extracted["params"]> & readonly unknown[]
|
||||
>(
|
||||
args: [fn: T, ...boundArgs: TBoundArgs]
|
||||
): BindFunction<T, Extracted["thisArg"], TBoundArgs, false>;
|
||||
|
||||
declare function callBind<const TArgs extends readonly unknown[]>(
|
||||
args: [fn: Exclude<TArgs[0], Function>, ...rest: TArgs]
|
||||
): never;
|
||||
|
||||
// export as namespace callBind;
|
||||
export = callBind;
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue