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

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;
};