node_modules ignore

This commit is contained in:
2025-05-08 23:43:47 +02:00
parent e19d52f172
commit 4574544c9f
65041 changed files with 10593536 additions and 0 deletions

21
server/node_modules/co-body/LICENSE.txt generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2013-present cojs and the contributors.
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.

82
server/node_modules/co-body/Readme.md generated vendored Normal file
View File

@@ -0,0 +1,82 @@
# co-body
[![NPM version][npm-image]][npm-url]
[![CI](https://github.com/cojs/co-body/actions/workflows/node.yml/badge.svg)](https://github.com/cojs/co-body/actions/workflows/node.yml)
[![Test coverage][codecov-image]][codecov-url]
[![npm download][download-image]][download-url]
[npm-image]: https://img.shields.io/npm/v/co-body.svg?style=flat-square
[npm-url]: https://npmjs.org/package/co-body
[codecov-image]: https://codecov.io/github/cojs/co-body/coverage.svg?branch=master
[codecov-url]: https://codecov.io/github/cojs/co-body?branch=master
[download-image]: https://img.shields.io/npm/dm/co-body.svg?style=flat-square
[download-url]: https://npmjs.org/package/co-body
> Parse request bodies with generators inspired by [Raynos/body](https://github.com/Raynos/body).
## Installation
```bash
$ npm install co-body
```
## Options
- `limit` number or string representing the request size limit (1mb for json and 56kb for form-urlencoded)
- `strict` when set to `true`, JSON parser will only accept arrays and objects; when `false` will accept anything `JSON.parse` accepts. Defaults to `true`. (also `strict` mode will always return object).
- `onProtoPoisoning` Defines what action the `co-body` lib must take when parsing a JSON object with `__proto__`. This functionality is provided by [bourne](https://github.com/hapijs/bourne).
See [Prototype-Poisoning](https://fastify.dev/docs/latest/Guides/Prototype-Poisoning/) for more details about prototype poisoning attacks.
Possible values are `'error'`, `'remove'` and `'ignore'`.
Default to `'error'`, it will throw a `SyntaxError` when `Prototype-Poisoning` happen.
- `queryString` an object of options when parsing query strings and form data. See [qs](https://github.com/hapijs/qs) for more information.
- `returnRawBody` when set to `true`, the return value of `co-body` will be an object with two properties: `{ parsed: /* parsed value */, raw: /* raw body */}`.
- `jsonTypes` is used to determine what media type **co-body** will parse as **json**, this option is passed directly to the [type-is](https://github.com/jshttp/type-is) library.
- `formTypes` is used to determine what media type **co-body** will parse as **form**, this option is passed directly to the [type-is](https://github.com/jshttp/type-is) library.
- `textTypes` is used to determine what media type **co-body** will parse as **text**, this option is passed directly to the [type-is](https://github.com/jshttp/type-is) library.
more options available via [raw-body](https://github.com/stream-utils/raw-body#getrawbodystream-options-callback):
## Example
```js
// application/json
var body = await parse.json(req);
// explicit limit
var body = await parse.json(req, { limit: '10kb' });
// application/x-www-form-urlencoded
var body = await parse.form(req);
// text/plain
var body = await parse.text(req);
// either
var body = await parse(req);
// custom type
var body = await parse(req, { textTypes: ['text', 'html'] });
```
## Koa
This lib also supports `ctx.req` in Koa (or other libraries),
so that you may simply use `this` instead of `this.req`.
```js
// application/json
var body = await parse.json(this);
// application/x-www-form-urlencoded
var body = await parse.form(this);
// text/plain
var body = await parse.text(this);
// either
var body = await parse(this);
```
# License
[MIT](LICENSE.txt)

6
server/node_modules/co-body/index.js generated vendored Normal file
View File

@@ -0,0 +1,6 @@
'use strict';
exports = module.exports = require('./lib/any');
exports.json = require('./lib/json');
exports.form = require('./lib/form');
exports.text = require('./lib/text');

51
server/node_modules/co-body/lib/any.js generated vendored Normal file
View File

@@ -0,0 +1,51 @@
'use strict';
/**
* Module dependencies.
*/
const typeis = require('type-is');
const json = require('./json');
const form = require('./form');
const text = require('./text');
const jsonTypes = [ 'json', 'application/*+json', 'application/csp-report' ];
const formTypes = [ 'urlencoded' ];
const textTypes = [ 'text' ];
/**
* Return a Promise which parses form and json requests
* depending on the Content-Type.
*
* Pass a node request or an object with `.req`,
* such as a koa Context.
*
* @param {Request} req
* @param {Options} [opts]
* @return {Function}
* @api public
*/
module.exports = async function(req, opts) {
req = req.req || req;
opts = opts || {};
// json
const jsonType = opts.jsonTypes || jsonTypes;
if (typeis(req, jsonType)) return json(req, opts);
// form
const formType = opts.formTypes || formTypes;
if (typeis(req, formType)) return form(req, opts);
// text
const textType = opts.textTypes || textTypes;
if (typeis(req, textType)) return text(req, opts);
// invalid
const type = req.headers['content-type'] || '';
const message = type ? 'Unsupported content-type: ' + type : 'Missing content-type';
const err = new Error(message);
err.status = 415;
throw err;
};

49
server/node_modules/co-body/lib/form.js generated vendored Normal file
View File

@@ -0,0 +1,49 @@
'use strict';
/**
* Module dependencies.
*/
const raw = require('raw-body');
const inflate = require('inflation');
const qs = require('qs');
const utils = require('./utils');
/**
* Return a Promise which parses x-www-form-urlencoded requests.
*
* Pass a node request or an object with `.req`,
* such as a koa Context.
*
* @param {Request} req
* @param {Options} [opts]
* @return {Function}
* @api public
*/
module.exports = async function(req, opts) {
req = req.req || req;
opts = utils.clone(opts);
const queryString = opts.queryString || {};
// keep compatibility with qs@4
if (queryString.allowDots === undefined) queryString.allowDots = true;
// defaults
const len = req.headers['content-length'];
const encoding = req.headers['content-encoding'] || 'identity';
if (len && encoding === 'identity') opts.length = ~~len;
opts.encoding = opts.encoding || 'utf8';
opts.limit = opts.limit || '56kb';
opts.qs = opts.qs || qs;
const str = await raw(inflate(req), opts);
try {
const parsed = opts.qs.parse(str, queryString);
return opts.returnRawBody ? { parsed, raw: str } : parsed;
} catch (err) {
err.status = 400;
err.body = str;
throw err;
}
};

61
server/node_modules/co-body/lib/json.js generated vendored Normal file
View File

@@ -0,0 +1,61 @@
'use strict';
/**
* Module dependencies.
*/
const raw = require('raw-body');
const inflate = require('inflation');
const bourne = require('@hapi/bourne');
const utils = require('./utils');
// Allowed whitespace is defined in RFC 7159
// http://www.rfc-editor.org/rfc/rfc7159.txt
const strictJSONReg = /^[\x20\x09\x0a\x0d]*(\[|\{)/;
/**
* Return a Promise which parses json requests.
*
* Pass a node request or an object with `.req`,
* such as a koa Context.
*
* @param {Request} req
* @param {Options} [opts]
* @return {Function}
* @api public
*/
module.exports = async function(req, opts) {
req = req.req || req;
opts = utils.clone(opts);
// defaults
const len = req.headers['content-length'];
const encoding = req.headers['content-encoding'] || 'identity';
if (len && encoding === 'identity') opts.length = ~~len;
opts.encoding = opts.encoding || 'utf8';
opts.limit = opts.limit || '1mb';
const strict = opts.strict !== false;
const protoAction = opts.onProtoPoisoning || 'error';
const str = await raw(inflate(req), opts);
try {
const parsed = parse(str);
return opts.returnRawBody ? { parsed, raw: str } : parsed;
} catch (err) {
err.status = 400;
err.body = str;
throw err;
}
function parse(str) {
if (!strict) return str ? bourne.parse(str, { protoAction }) : str;
// strict mode always return object
if (!str) return {};
// strict JSON test
if (!strictJSONReg.test(str)) {
throw new SyntaxError('invalid JSON, only supports object and array');
}
return bourne.parse(str, { protoAction });
}
};

37
server/node_modules/co-body/lib/text.js generated vendored Normal file
View File

@@ -0,0 +1,37 @@
'use strict';
/**
* Module dependencies.
*/
const raw = require('raw-body');
const inflate = require('inflation');
const utils = require('./utils');
/**
* Return a Promise which parses text/plain requests.
*
* Pass a node request or an object with `.req`,
* such as a koa Context.
*
* @param {Request} req
* @param {Options} [opts]
* @return {Function}
* @api public
*/
module.exports = async function(req, opts) {
req = req.req || req;
opts = utils.clone(opts);
// defaults
const len = req.headers['content-length'];
const encoding = req.headers['content-encoding'] || 'identity';
if (len && encoding === 'identity') opts.length = ~~len;
opts.encoding = opts.encoding === undefined ? 'utf8' : opts.encoding;
opts.limit = opts.limit || '1mb';
const str = await raw(inflate(req), opts);
// ensure return the same format with json / form
return opts.returnRawBody ? { parsed: str, raw: str } : str;
};

14
server/node_modules/co-body/lib/utils.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
'use strict';
/**
* Module dependencies.
*/
exports.clone = function(opts) {
const options = {};
opts = opts || {};
for (const key in opts) {
options[key] = opts[key];
}
return options;
};

45
server/node_modules/co-body/package.json generated vendored Normal file
View File

@@ -0,0 +1,45 @@
{
"name": "co-body",
"version": "6.2.0",
"repository": "cojs/co-body",
"description": "request body parsing for co",
"keywords": [
"request",
"parse",
"parser",
"json",
"co",
"generators",
"urlencoded"
],
"dependencies": {
"@hapi/bourne": "^3.0.0",
"inflation": "^2.0.0",
"qs": "^6.5.2",
"raw-body": "^2.3.3",
"type-is": "^1.6.16"
},
"devDependencies": {
"egg-bin": "^4.7.0",
"eslint": "^4.19.1",
"eslint-config-egg": "^7.0.0",
"koa": "^1.6.0",
"safe-qs": "^6.0.1",
"should": "^11.2.0",
"supertest": "^3.1.0"
},
"license": "MIT",
"scripts": {
"lint": "eslint .",
"test": "egg-bin test -r should",
"cov": "eslint . && egg-bin cov -r should",
"ci": "npm run lint && npm run cov"
},
"files": [
"index.js",
"lib/"
],
"engines": {
"node": ">=8.0.0"
}
}