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

13
server/node_modules/koa-body/lib/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
import type { KoaBodyMiddlewareOptions } from './types';
import type { Middleware } from 'koa';
import * as Koa from 'koa';
import type { Files } from 'formidable';
export * from './types';
declare module 'koa' {
interface Request extends Koa.BaseRequest {
body?: any;
files?: Files;
}
}
export declare function koaBody(options?: Partial<KoaBodyMiddlewareOptions>): Middleware;
export default koaBody;

120
server/node_modules/koa-body/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,120 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.koaBody = void 0;
const types_1 = require("./types");
const co_body_1 = __importDefault(require("co-body"));
const string_method_to_enum_method_1 = __importDefault(require("./utils/string-method-to-enum-method"));
const throwable_to_error_1 = __importDefault(require("./utils/throwable-to-error"));
const body_type_util_1 = require("./utils/body-type-util");
const parse_with_formidable_1 = __importDefault(require("./utils/parse-with-formidable"));
const patch_util_1 = require("./utils/patch-util");
__exportStar(require("./types"), exports);
function koaBody(options = {}) {
const validatedOptions = types_1.KoaBodyMiddlewareOptionsSchema.parse(options);
const optionsToUse = { ...options, ...validatedOptions };
return async (ctx, next) => {
const isJson = (0, body_type_util_1.isJsonBody)(ctx, optionsToUse);
const isText = (0, body_type_util_1.isTextBody)(ctx, optionsToUse);
const isUrlencoded = (0, body_type_util_1.isUrlencodedBody)(ctx, optionsToUse);
const isMultipart = (0, body_type_util_1.isMultipartBody)(ctx, optionsToUse);
const { encoding, jsonStrict, jsonLimit, includeUnparsed: returnRawBody, formLimit, textLimit, queryString, formidable, onError, patchNode, patchKoa, } = optionsToUse;
// only parse the body on specifically chosen methods
if (validatedOptions.parsedMethods.includes((0, string_method_to_enum_method_1.default)(ctx.method.toUpperCase()))) {
try {
if (isJson) {
const jsonBody = await co_body_1.default.json(ctx, {
encoding,
limit: jsonLimit,
strict: jsonStrict,
returnRawBody,
});
(0, patch_util_1.patchNodeAndKoa)(ctx, jsonBody, {
isText,
includeUnparsed: returnRawBody,
isMultipart,
patchKoa,
patchNode,
});
}
else if (isUrlencoded) {
const urlEncodedBody = await co_body_1.default.form(ctx, {
encoding,
limit: formLimit,
queryString: queryString,
returnRawBody,
});
(0, patch_util_1.patchNodeAndKoa)(ctx, urlEncodedBody, {
isText,
includeUnparsed: returnRawBody,
isMultipart,
patchKoa,
patchNode,
});
}
else if (isText) {
const textBody = await co_body_1.default.text(ctx, {
encoding,
limit: textLimit,
returnRawBody,
});
(0, patch_util_1.patchNodeAndKoa)(ctx, textBody, {
isText,
includeUnparsed: returnRawBody,
isMultipart,
patchKoa,
patchNode,
});
}
else if (isMultipart) {
const multipartBody = await (0, parse_with_formidable_1.default)(ctx, formidable || {});
(0, patch_util_1.patchNodeAndKoa)(ctx, multipartBody, {
isText,
includeUnparsed: returnRawBody,
isMultipart,
patchKoa,
patchNode,
});
}
}
catch (parsingError) {
const error = (0, throwable_to_error_1.default)(parsingError);
if (typeof onError === 'function') {
onError(error, ctx);
}
else {
throw error;
}
}
}
else {
(0, patch_util_1.patchNodeAndKoa)(ctx, {}, {
isText,
includeUnparsed: returnRawBody,
isMultipart,
patchKoa,
patchNode,
});
}
return next();
};
}
exports.koaBody = koaBody;
exports.default = koaBody;
//# sourceMappingURL=index.js.map

1
server/node_modules/koa-body/lib/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,mCAAyD;AAKzD,sDAA6B;AAC7B,wGAAgE;AAChE,oFAA0D;AAC1D,2DAAmG;AACnG,0FAAgE;AAChE,mDAAqD;AAGrD,0CAAwB;AASxB,SAAgB,OAAO,CAAC,UAA6C,EAAE;IACrE,MAAM,gBAAgB,GAAG,sCAA8B,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACvE,MAAM,YAAY,GAAG,EAAE,GAAG,OAAO,EAAE,GAAG,gBAAgB,EAAE,CAAC;IACzD,OAAO,KAAK,EAAE,GAAY,EAAE,IAAU,EAAE,EAAE;QACxC,MAAM,MAAM,GAAG,IAAA,2BAAU,EAAC,GAAG,EAAE,YAAY,CAAC,CAAC;QAC7C,MAAM,MAAM,GAAG,IAAA,2BAAU,EAAC,GAAG,EAAE,YAAY,CAAC,CAAC;QAC7C,MAAM,YAAY,GAAG,IAAA,iCAAgB,EAAC,GAAG,EAAE,YAAY,CAAC,CAAC;QACzD,MAAM,WAAW,GAAG,IAAA,gCAAe,EAAC,GAAG,EAAE,YAAY,CAAC,CAAC;QACvD,MAAM,EACJ,QAAQ,EACR,UAAU,EACV,SAAS,EACT,eAAe,EAAE,aAAa,EAC9B,SAAS,EACT,SAAS,EACT,WAAW,EACX,UAAU,EACV,OAAO,EACP,SAAS,EACT,QAAQ,GACT,GAAG,YAAY,CAAC;QACjB,qDAAqD;QACrD,IAAI,gBAAgB,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAA,sCAAY,EAAC,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE;YACnF,IAAI;gBACF,IAAI,MAAM,EAAE;oBACV,MAAM,QAAQ,GAAG,MAAM,iBAAM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O,YAAY,EAAE;gBACrB,MAAM,KAAK,GAAG,IAAA,4BAAgB,EAAC,YAAY,CAAC,CAAC;gBAC7C,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;oBACjC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;iBACrB;qBAAM;oBACL,MAAM,KAAK,CAAC;iBACb;aACF;SACF;aAAM;YACL,IAAA,4BAAe,EACb,GAA8B,EAC9B,EAAE,EACF;gBACE,MAAM;gBACN,eAAe,EAAE,aAAa;gBAC9B,WAAW;gBACX,QAAQ;gBACR,SAAS;aACV,CACF,CAAC;SACH;QAED,OAAO,IAAI,EAAE,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AAnGD,0BAmGC;AAED,kBAAe,OAAO,CAAC"}

127
server/node_modules/koa-body/lib/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,127 @@
import type { File, Options as FormidableOptions } from 'formidable';
import type { Options as CoBodyOptions } from 'co-body';
import type { Context } from 'koa';
import { z } from 'zod';
export declare enum HttpMethodEnum {
POST = "POST",
GET = "GET",
PUT = "PUT",
PATCH = "PATCH",
DELETE = "DELETE",
HEAD = "HEAD"
}
declare const HttpMethod: z.ZodNativeEnum<typeof HttpMethodEnum>;
export declare type HttpMethod = z.infer<typeof HttpMethod>;
export declare type ExtendedFormidableOptions = FormidableOptions & {
onFileBegin?: (name: string, file: File) => void;
};
export declare const KoaBodyMiddlewareOptionsSchema: z.ZodObject<{
/**
* {Boolean} Patch request body to Node's ctx.req, default false
*
* Note: You can patch request body to Node or Koa in same time if you want.
*/
patchNode: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
/**
* {Boolean} Patch request body to Koa's ctx.request, default true
*
* Note: You can patch request body to Node or Koa in same time if you want.
*/
patchKoa: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
/**
* {String|Integer} The byte (if integer) limit of the JSON body, default 1mb
*/
jsonLimit: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>>;
/**
* {String|Integer} The byte (if integer) limit of the form body, default 56kb
*/
formLimit: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>>;
/**
* {String|Integer} The byte (if integer) limit of the text body, default 56kb
*/
textLimit: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>>;
/**
* {String} Sets encoding for incoming form fields, default utf-8
*/
encoding: z.ZodDefault<z.ZodOptional<z.ZodString>>;
/**
* {Boolean} Parse multipart bodies, default false
*/
multipart: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
/**
* {Boolean} Parse urlencoded bodies, default true
*/
urlencoded: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
/**
* {Boolean} Parse text bodies, default true
*/
text: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
/**
* {Boolean} Parse json bodies, default true
*/
json: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
/**
* Toggles co-body strict mode; if true, only parses arrays or objects, default true
*/
jsonStrict: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
/**
* Toggles co-body returnRawBody mode; if true,
* the raw body will be available using a Symbol for 'unparsedBody'.
*
* ```
// Either:
const unparsed = require('koa-body/unparsed.js');
const unparsed = Symbol.for('unparsedBody');
// Then later, to access:
ctx.request.body[unparsed]
```
* default false
*/
includeUnparsed: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
/**
* {String[]} What HTTP methods to enable body parsing for; should be used in preference to strict mode.
*
* GET, HEAD, and DELETE requests have no defined semantics for the request body,
* but this doesn't mean they may not be valid in certain use cases.
* koa-body will only parse HTTP request bodies for POST, PUT, and PATCH by default
*
* see http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-19#section-6.3
*/
parsedMethods: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof HttpMethodEnum>, "many">>>;
}, "strip", z.ZodTypeAny, {
json: boolean;
encoding: string;
multipart: boolean;
patchNode: boolean;
patchKoa: boolean;
jsonLimit: string | number;
formLimit: string | number;
textLimit: string | number;
urlencoded: boolean;
text: boolean;
jsonStrict: boolean;
includeUnparsed: boolean;
parsedMethods: HttpMethodEnum[];
}, {
json?: boolean | undefined;
encoding?: string | undefined;
multipart?: boolean | undefined;
patchNode?: boolean | undefined;
patchKoa?: boolean | undefined;
jsonLimit?: string | number | undefined;
formLimit?: string | number | undefined;
textLimit?: string | number | undefined;
urlencoded?: boolean | undefined;
text?: boolean | undefined;
jsonStrict?: boolean | undefined;
includeUnparsed?: boolean | undefined;
parsedMethods?: HttpMethodEnum[] | undefined;
}>;
export declare type KoaBodyDirectOptions = z.infer<typeof KoaBodyMiddlewareOptionsSchema>;
export declare type KoaBodyMiddlewareOptions = KoaBodyDirectOptions & {
onError?: (err: Error, ctx: Context) => void;
formidable?: ExtendedFormidableOptions;
queryString?: CoBodyOptions['queryString'];
};
export {};

93
server/node_modules/koa-body/lib/types.js generated vendored Normal file
View File

@@ -0,0 +1,93 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.KoaBodyMiddlewareOptionsSchema = exports.HttpMethodEnum = void 0;
const zod_1 = require("zod");
var HttpMethodEnum;
(function (HttpMethodEnum) {
HttpMethodEnum["POST"] = "POST";
HttpMethodEnum["GET"] = "GET";
HttpMethodEnum["PUT"] = "PUT";
HttpMethodEnum["PATCH"] = "PATCH";
HttpMethodEnum["DELETE"] = "DELETE";
HttpMethodEnum["HEAD"] = "HEAD";
})(HttpMethodEnum = exports.HttpMethodEnum || (exports.HttpMethodEnum = {}));
const HttpMethod = zod_1.z.nativeEnum(HttpMethodEnum);
exports.KoaBodyMiddlewareOptionsSchema = zod_1.z.object({
/**
* {Boolean} Patch request body to Node's ctx.req, default false
*
* Note: You can patch request body to Node or Koa in same time if you want.
*/
patchNode: zod_1.z.boolean().optional().default(false),
/**
* {Boolean} Patch request body to Koa's ctx.request, default true
*
* Note: You can patch request body to Node or Koa in same time if you want.
*/
patchKoa: zod_1.z.boolean().optional().default(true),
/**
* {String|Integer} The byte (if integer) limit of the JSON body, default 1mb
*/
jsonLimit: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]).optional().default('1mb'),
/**
* {String|Integer} The byte (if integer) limit of the form body, default 56kb
*/
formLimit: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]).optional().default('56kb'),
/**
* {String|Integer} The byte (if integer) limit of the text body, default 56kb
*/
textLimit: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]).optional().default('56kb'),
/**
* {String} Sets encoding for incoming form fields, default utf-8
*/
encoding: zod_1.z.string().optional().default('utf-8'),
/**
* {Boolean} Parse multipart bodies, default false
*/
multipart: zod_1.z.boolean().optional().default(false),
/**
* {Boolean} Parse urlencoded bodies, default true
*/
urlencoded: zod_1.z.boolean().optional().default(true),
/**
* {Boolean} Parse text bodies, default true
*/
text: zod_1.z.boolean().optional().default(true),
/**
* {Boolean} Parse json bodies, default true
*/
json: zod_1.z.boolean().optional().default(true),
/**
* Toggles co-body strict mode; if true, only parses arrays or objects, default true
*/
jsonStrict: zod_1.z.boolean().optional().default(true),
/**
* Toggles co-body returnRawBody mode; if true,
* the raw body will be available using a Symbol for 'unparsedBody'.
*
* ```
// Either:
const unparsed = require('koa-body/unparsed.js');
const unparsed = Symbol.for('unparsedBody');
// Then later, to access:
ctx.request.body[unparsed]
```
* default false
*/
includeUnparsed: zod_1.z.boolean().optional().default(false),
/**
* {String[]} What HTTP methods to enable body parsing for; should be used in preference to strict mode.
*
* GET, HEAD, and DELETE requests have no defined semantics for the request body,
* but this doesn't mean they may not be valid in certain use cases.
* koa-body will only parse HTTP request bodies for POST, PUT, and PATCH by default
*
* see http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-19#section-6.3
*/
parsedMethods: zod_1.z
.array(HttpMethod)
.optional()
.default([HttpMethodEnum.POST, HttpMethodEnum.PUT, HttpMethodEnum.PATCH]),
});
//# sourceMappingURL=types.js.map

1
server/node_modules/koa-body/lib/types.js.map generated vendored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AE,CAAC,OAAO,CAAC,OAAO,CAAC;IAChD;;OAEG;IACH,SAAS,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IAEhD;;OAEG;IACH,UAAU,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAEhD;;OAEG;IACH,IAAI,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAE1C;;OAEG;IACH,IAAI,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAC1C;;OAEG;IACH,UAAU,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAEhD;;;;;;;;;;;;;SAaK;IACL,eAAe,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IAEtD;;;;;;;;OAQG;IACH,aAAa,EAAE,OAAC;SACb,KAAK,CAAC,UAAU,CAAC;SACjB,QAAQ,EAAE;SACV,OAAO,CAAC,CAAC,cAAc,CAAC,IAAI,EAAE,cAAc,CAAC,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;CAC5E,CAAC,CAAC"}

2
server/node_modules/koa-body/lib/unparsed.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
declare const _default: symbol;
export default _default;

4
server/node_modules/koa-body/lib/unparsed.js generated vendored Normal file
View File

@@ -0,0 +1,4 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = Symbol.for('unparsedBody');
//# sourceMappingURL=unparsed.js.map

1
server/node_modules/koa-body/lib/unparsed.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"unparsed.js","sourceRoot":"","sources":["../src/unparsed.ts"],"names":[],"mappings":";;AAAA,kBAAe,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC"}

View File

@@ -0,0 +1,6 @@
import type { KoaBodyMiddlewareOptions } from '../types';
import type { Context } from 'koa';
export declare function isJsonBody(ctx: Context, options: KoaBodyMiddlewareOptions): string | false | null;
export declare function isUrlencodedBody(ctx: Context, options: KoaBodyMiddlewareOptions): string | false | null;
export declare function isTextBody(ctx: Context, options: KoaBodyMiddlewareOptions): string | false | null;
export declare function isMultipartBody(ctx: Context, options: KoaBodyMiddlewareOptions): string | false | null;

View File

@@ -0,0 +1,27 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isMultipartBody = exports.isTextBody = exports.isUrlencodedBody = exports.isJsonBody = void 0;
const jsonTypes = [
'application/json',
'application/json-patch+json',
'application/vnd.api+json',
'application/csp-report',
'application/reports+json',
];
function isJsonBody(ctx, options) {
return options.json && ctx.is(jsonTypes);
}
exports.isJsonBody = isJsonBody;
function isUrlencodedBody(ctx, options) {
return options.urlencoded && ctx.is('urlencoded');
}
exports.isUrlencodedBody = isUrlencodedBody;
function isTextBody(ctx, options) {
return options.text && ctx.is('text/*');
}
exports.isTextBody = isTextBody;
function isMultipartBody(ctx, options) {
return options.multipart && ctx.is('multipart');
}
exports.isMultipartBody = isMultipartBody;
//# sourceMappingURL=body-type-util.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"body-type-util.js","sourceRoot":"","sources":["../../src/utils/body-type-util.ts"],"names":[],"mappings":";;;AAGA,MAAM,SAAS,GAAG;IAChB,kBAAkB;IAClB,6BAA6B;IAC7B,0BAA0B;IAC1B,wBAAwB;IACxB,0BAA0B;CAC3B,CAAC;AAEF,SAAgB,UAAU,CAAC,GAAY,EAAE,OAAiC;IACxE,OAAO,OAAO,CAAC,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC;AAC3C,CAAC;AAFD,gCAEC;AAED,SAAgB,gBAAgB,CAAC,GAAY,EAAE,OAAiC;IAC9E,OAAO,OAAO,CAAC,UAAU,IAAI,GAAG,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC;AACpD,CAAC;AAFD,4CAEC;AAED,SAAgB,UAAU,CAAC,GAAY,EAAE,OAAiC;IACxE,OAAO,OAAO,CAAC,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;AAC1C,CAAC;AAFD,gCAEC;AAED,SAAgB,eAAe,CAAC,GAAY,EAAE,OAAiC;IAC7E,OAAO,OAAO,CAAC,SAAS,IAAI,GAAG,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC;AAClD,CAAC;AAFD,0CAEC"}

View File

@@ -0,0 +1,8 @@
import type { Fields, Files } from 'formidable';
import type { Context } from 'koa';
import type { ExtendedFormidableOptions } from '../types';
export declare type ParseWithFormidableResult = {
fields: Fields;
files: Files;
};
export default function parseWithFormidable(ctx: Context, options: ExtendedFormidableOptions): Promise<ParseWithFormidableResult>;

View File

@@ -0,0 +1,24 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const formidable_1 = __importDefault(require("formidable"));
function parseWithFormidable(ctx, options) {
const { onFileBegin, ...directOptions } = options;
const form = (0, formidable_1.default)({ multiples: true, ...directOptions });
if (onFileBegin) {
form.on('fileBegin', onFileBegin);
}
return new Promise((resolve, reject) => {
form.parse(ctx.req, (error, fields, files) => {
if (error) {
reject(error);
return;
}
resolve({ fields, files });
});
});
}
exports.default = parseWithFormidable;
//# sourceMappingURL=parse-with-formidable.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"parse-with-formidable.js","sourceRoot":"","sources":["../../src/utils/parse-with-formidable.ts"],"names":[],"mappings":";;;;;AACA,4DAAoC;AASpC,SAAwB,mBAAmB,CACzC,GAAY,EACZ,OAAkC;IAElC,MAAM,EAAE,WAAW,EAAE,GAAG,aAAa,EAAE,GAAG,OAAO,CAAC;IAClD,MAAM,IAAI,GAAG,IAAA,oBAAU,EAAC,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,aAAa,EAAE,CAAC,CAAC;IAC/D,IAAI,WAAW,EAAE;QACf,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;KACnC;IACD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE;YAC3C,IAAI,KAAK,EAAE;gBACT,MAAM,CAAC,KAAK,CAAC,CAAC;gBACd,OAAO;aACR;YACD,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAlBD,sCAkBC"}

21
server/node_modules/koa-body/lib/utils/patch-util.d.ts generated vendored Normal file
View File

@@ -0,0 +1,21 @@
import type { Context } from 'koa';
import type { Files } from 'formidable';
declare type PatchOptions = {
isMultipart: string | boolean | null;
isText: string | boolean | null;
includeUnparsed: boolean;
patchNode: boolean;
patchKoa: boolean;
};
export declare type ContextWithBodyAndFiles = Context & {
req: {
body?: any;
files?: Files;
};
request: {
body?: any;
files?: Files;
};
};
export declare function patchNodeAndKoa(ctx: ContextWithBodyAndFiles, body: any, options: PatchOptions): void;
export {};

42
server/node_modules/koa-body/lib/utils/patch-util.js generated vendored Normal file
View File

@@ -0,0 +1,42 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.patchNodeAndKoa = void 0;
const unparsed_1 = __importDefault(require("../unparsed"));
function patchNodeAndKoa(ctx, body, options) {
const { patchKoa, patchNode, isMultipart, includeUnparsed, isText } = options;
if (patchNode) {
if (isMultipart) {
ctx.req.body = body.fields;
ctx.req.files = body.files;
}
else if (includeUnparsed) {
ctx.req.body = body.parsed || {};
if (!isText) {
ctx.req.body[unparsed_1.default] = body.raw;
}
}
else {
ctx.req.body = body;
}
}
if (patchKoa) {
if (isMultipart) {
ctx.request.body = body.fields;
ctx.request.files = body.files;
}
else if (includeUnparsed) {
ctx.request.body = body.parsed || {};
if (!isText) {
ctx.request.body[unparsed_1.default] = body.raw;
}
}
else {
ctx.request.body = body;
}
}
}
exports.patchNodeAndKoa = patchNodeAndKoa;
//# sourceMappingURL=patch-util.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"patch-util.js","sourceRoot":"","sources":["../../src/utils/patch-util.ts"],"names":[],"mappings":";;;;;;AACA,2DAAyC;AAsBzC,SAAgB,eAAe,CAAC,GAA4B,EAAE,IAAS,EAAE,OAAqB;IAC5F,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAE9E,IAAI,SAAS,EAAE;QACb,IAAI,WAAW,EAAE;YACf,GAAG,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;YAC3B,GAAG,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;SAC5B;aAAM,IAAI,eAAe,EAAE;YAC1B,GAAG,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;YACjC,IAAI,CAAC,MAAM,EAAE;gBACX,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,kBAAc,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC;aACzC;SACF;aAAM;YACL,GAAG,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC;SACrB;KACF;IACD,IAAI,QAAQ,EAAE;QACZ,IAAI,WAAW,EAAE;YACf,GAAG,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;YAC/B,GAAG,CAAC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;SAChC;aAAM,IAAI,eAAe,EAAE;YAC1B,GAAG,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;YACrC,IAAI,CAAC,MAAM,EAAE;gBACX,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAc,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC;aAC7C;SACF;aAAM;YACL,GAAG,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;SACzB;KACF;AACH,CAAC;AA7BD,0CA6BC"}

View File

@@ -0,0 +1,2 @@
import { HttpMethodEnum } from '../types';
export default function toHttpMethod(method: string): HttpMethodEnum;

View File

@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const types_1 = require("../types");
function toHttpMethod(method) {
return types_1.HttpMethodEnum[method];
}
exports.default = toHttpMethod;
//# sourceMappingURL=string-method-to-enum-method.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"string-method-to-enum-method.js","sourceRoot":"","sources":["../../src/utils/string-method-to-enum-method.ts"],"names":[],"mappings":";;AAAA,oCAA0C;AAE1C,SAAwB,YAAY,CAAC,MAAc;IACjD,OAAO,sBAAc,CAAC,MAAqC,CAAC,CAAC;AAC/D,CAAC;AAFD,+BAEC"}

View File

@@ -0,0 +1 @@
export default function throwableToError(e: unknown): Error;

View File

@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function throwableToError(e) {
if (e instanceof Error) {
return e;
}
const error = new Error(typeof e === 'object' ? JSON.stringify(e) : '' + e);
error.name = typeof e;
error.stack = undefined;
return error;
}
exports.default = throwableToError;
//# sourceMappingURL=throwable-to-error.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"throwable-to-error.js","sourceRoot":"","sources":["../../src/utils/throwable-to-error.ts"],"names":[],"mappings":";;AAAA,SAAwB,gBAAgB,CAAC,CAAU;IACjD,IAAI,CAAC,YAAY,KAAK,EAAE;QACtB,OAAO,CAAC,CAAC;KACV;IAED,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;IAC5E,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC;IACtB,KAAK,CAAC,KAAK,GAAG,SAAS,CAAC;IAExB,OAAO,KAAK,CAAC;AACf,CAAC;AAVD,mCAUC"}