alado 3.6.18 → 3.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -2
- package/dist/decorators/http.js +4 -3
- package/dist/decorators/http.js.map +1 -1
- package/dist/decorators/initialize-application.js +2 -1
- package/dist/decorators/initialize-application.js.map +1 -1
- package/dist/dto/alado-configuration-error.d.ts +9 -0
- package/dist/dto/alado-configuration-error.js +17 -0
- package/dist/dto/alado-configuration-error.js.map +1 -0
- package/dist/dto/index.d.ts +1 -0
- package/dist/dto/index.js +1 -0
- package/dist/dto/index.js.map +1 -1
- package/dist/helpers/parser/authenticate.d.ts +7 -1
- package/dist/helpers/parser/authenticate.js +45 -3
- package/dist/helpers/parser/authenticate.js.map +1 -1
- package/dist/helpers/parser/body-parser.d.ts +23 -6
- package/dist/helpers/parser/body-parser.js +149 -80
- package/dist/helpers/parser/body-parser.js.map +1 -1
- package/dist/helpers/parser/xml-parser.js +12 -0
- package/dist/helpers/parser/xml-parser.js.map +1 -1
- package/dist/helpers/service/index.d.ts +1 -0
- package/dist/helpers/service/index.js +1 -0
- package/dist/helpers/service/index.js.map +1 -1
- package/dist/helpers/service/open-api-paths.d.ts +11 -0
- package/dist/helpers/service/open-api-paths.js +49 -0
- package/dist/helpers/service/open-api-paths.js.map +1 -0
- package/dist/helpers/validate/built-in/index.d.ts +1 -0
- package/dist/helpers/validate/built-in/index.js +15 -0
- package/dist/helpers/validate/built-in/index.js.map +1 -1
- package/dist/helpers/validate/built-in/numeric-input.d.ts +17 -0
- package/dist/helpers/validate/built-in/numeric-input.js +74 -0
- package/dist/helpers/validate/built-in/numeric-input.js.map +1 -0
- package/dist/helpers/validate/built-in/validator.d.ts +3 -0
- package/dist/helpers/validate/built-in/validator.js +25 -9
- package/dist/helpers/validate/built-in/validator.js.map +1 -1
- package/dist/helpers/validate/context/validate-request-part.js +10 -0
- package/dist/helpers/validate/context/validate-request-part.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/request-processor/request-processor.d.ts +1 -0
- package/dist/request-processor/request-processor.js +76 -40
- package/dist/request-processor/request-processor.js.map +1 -1
- package/dist/router/router.d.ts +7 -0
- package/dist/router/router.js +31 -3
- package/dist/router/router.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -218,6 +218,8 @@ import { get, query, post, put, patch, del, head } from 'alado';
|
|
|
218
218
|
| `@del(path, options?)` | DELETE |
|
|
219
219
|
| `@head(path, options?)` | HEAD |
|
|
220
220
|
|
|
221
|
+
Routes are registered in declaration order. Registering a second route with the same method and path (also when only the parameter names differ, e.g. `/users/:id` and `/users/:userId`) throws an `AladoConfigurationError` with `code: 'ROUTE_ALREADY_REGISTERED'` at startup, since the second one could never be reached.
|
|
222
|
+
|
|
221
223
|
**Options:**
|
|
222
224
|
|
|
223
225
|
```ts
|
|
@@ -491,6 +493,7 @@ validate.custom(fn); // starts with a custom rule
|
|
|
491
493
|
| ----------- | -------------------------------------------- |
|
|
492
494
|
| `string()` | Must be a string |
|
|
493
495
|
| `number()` | Must be a number (not NaN) |
|
|
496
|
+
| `bigint()` | Must be a bigint |
|
|
494
497
|
| `boolean()` | Must be a boolean |
|
|
495
498
|
| `array()` | Must be an array |
|
|
496
499
|
| `object()` | Must be a plain object (not array, not null) |
|
|
@@ -517,6 +520,10 @@ validate.custom(fn); // starts with a custom rule
|
|
|
517
520
|
| `positive()` | Must be `> 0` |
|
|
518
521
|
| `negative()` | Must be `< 0` |
|
|
519
522
|
|
|
523
|
+
`min`, `max`, `integer`, `positive` and `negative` accept bigints as well.
|
|
524
|
+
|
|
525
|
+
Query and path values always arrive as strings. When a query or path field is validated by a validator built from `validate.number()` or `validate.bigint()`, the string is converted before validation, and the handler gets the converted value. Accepted: decimal numbers with sign, fraction and exponent (`-1.5e3`), `0x` / `0o` / `0b` integers, digit separators (`1_000`), and for `bigint()` an optional `n` suffix (`123n`). Anything else (padded or empty text, `Infinity`, `NaN`, out-of-range values, integers past `Number.MAX_SAFE_INTEGER` for `number()`) stays a string and fails validation. Note that `JSON.stringify` cannot serialise a bigint: convert it before putting it in a response body.
|
|
526
|
+
|
|
520
527
|
**Generic**
|
|
521
528
|
|
|
522
529
|
| Method | Description |
|
|
@@ -949,7 +956,13 @@ The `inputProperty` supports dot-notation and can point to any part of the reque
|
|
|
949
956
|
|
|
950
957
|
The resolved value from `handler` is set at `outputProperty` on the request object, making it available as `req.auth.user` in your handler.
|
|
951
958
|
|
|
952
|
-
|
|
959
|
+
`handler` should return `null`/`undefined` for credentials it does not accept. A thrown error is treated as a failure of the handler: the client gets `error` (or, with `required: false`, the request goes on anonymously) and the error is always logged.
|
|
960
|
+
|
|
961
|
+
The value at `inputProperty` is checked before `handler` runs (the rest of the request is validated only after authentication). If the route declares a validator for that field (for example `body.token` in the request DTO), that validator decides; otherwise only a string is accepted. Anything else, such as an object from a JSON body or an array from a repeated query key, gets the configured `error` and `handler` is not called.
|
|
962
|
+
|
|
963
|
+
When `inputProperty` reads a header, a query parameter or a path parameter, the request body is read only after authentication (and after access control, unless a rule reads `body.*`). A refused request never has its body parsed, and its connection is closed after the error response.
|
|
964
|
+
|
|
965
|
+
**Optional auth** — set `required: false` for soft checking: missing or invalid credentials, or a `handler` that throws, leave the request anonymous instead of refusing it:
|
|
953
966
|
|
|
954
967
|
```ts
|
|
955
968
|
export const optionalAuth: RequestAuthentication = {
|
|
@@ -1140,7 +1153,9 @@ When a request arrives with a `Content-Type` of `text/xml` or `application/xml`,
|
|
|
1140
1153
|
- **Repeated sibling tags collapse into an array.** `<item>a</item><item>b</item>` becomes `item: ['a', 'b']` rather than overwriting the key.
|
|
1141
1154
|
- **Leaf elements become plain strings.** `<name>Daniel</name>` becomes `name: 'Daniel'` — no wrapper object, no type coercion (numeric-looking text like `"10000.00"` is kept exactly as written, since silently converting it to a JS number would lose precision on monetary values).
|
|
1142
1155
|
- **Attributes are namespaced under `@attrs`.** An element like `<amount currency="USD">100</amount>` becomes `{ '@attrs': { currency: 'USD' }, '#text': '100' }`, keeping attribute data separate from element data and text content.
|
|
1156
|
+
- **Text next to child elements is kept under `#text`.** `<p>Total: <b>5</b> EUR</p>` becomes `p: { b: '5', '#text': 'Total: EUR', '@ns': null }` (the text pieces, joined). Whitespace used only for indentation is dropped.
|
|
1143
1157
|
- **CDATA sections are unwrapped automatically**, and their contents treated as plain text.
|
|
1158
|
+
- **One root element.** Text before it, or anything after it other than whitespace and comments, gets `400 Invalid XML body`.
|
|
1144
1159
|
- **Namespaces resolve to local names.** For SOAP envelopes or ISO 20022 style payment messages, elements are keyed by their local name regardless of which prefix the sender used (`soapenv:Body` and `soap:Body` parse identically if they share a namespace). Each element also carries an `@ns` field with its resolved namespace URI, so elements sharing a local name across different namespaces stay distinguishable.
|
|
1145
1160
|
|
|
1146
1161
|
Because the contract is identical to JSON, everything documented under [`defineRequest`](#definerequest) and [DTOs](#dtos) — `@validateProperty`, `@documentProperty`, `@transformProperty`, auto-generated OpenAPI schemas applies to XML bodies without any extra setup.
|
|
@@ -1171,7 +1186,7 @@ const app = initializeApplication({
|
|
|
1171
1186
|
|
|
1172
1187
|
Open `http://localhost:3000/` to view the Swagger UI.
|
|
1173
1188
|
|
|
1174
|
-
The OpenAPI document is served
|
|
1189
|
+
The OpenAPI document is served under `route` as well: `/docs/swagger.json` when `route` is `/docs` (`/swagger.json` only when `route` is `/`). Swagger UI's own files are served only under `route` too (for example `/docs/swagger-ui.css`), so the docs never take over paths of your API. Registering a `GET` route on a path the docs answer (the docs page, `swagger.json`, a Swagger UI file) throws an `AladoConfigurationError` with `code: 'ROUTE_RESERVED_FOR_OPEN_API'`. The docs are public: if they should not be, leave `openApiDoc` disabled in production or keep the docs route behind your proxy's access control. Only web assets from `swagger-ui-dist` are served (no `package.json`, `README` or license files).
|
|
1175
1190
|
|
|
1176
1191
|
Documentation is built from:
|
|
1177
1192
|
|
package/dist/decorators/http.js
CHANGED
|
@@ -44,14 +44,15 @@ function callHttpMethod(httpMethod, path, options = {}) {
|
|
|
44
44
|
};
|
|
45
45
|
if (app) {
|
|
46
46
|
(0, registered_members_1.markRegistered)(key);
|
|
47
|
-
|
|
47
|
+
// routes still waiting were declared before this one: register them first, in their order
|
|
48
48
|
const shadowApp = _injector_1.injector.injected.shadowAppMapping[appId];
|
|
49
49
|
if (Array.isArray(shadowApp) && shadowApp.length) {
|
|
50
50
|
while (shadowApp.length) {
|
|
51
|
-
const
|
|
52
|
-
|
|
51
|
+
const pending = shadowApp.shift();
|
|
52
|
+
pending(app);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
+
fn(app);
|
|
55
56
|
}
|
|
56
57
|
else {
|
|
57
58
|
_injector_1.injector.injected.shadowAppMapping[appId] = _injector_1.injector.injected.shadowAppMapping[appId] || [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/decorators/http.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/decorators/http.ts"],"names":[],"mappings":";;AA2DA,kBAEC;AAED,sBAEC;AAED,oBAEC;AAED,kBAEC;AAED,sBAEC;AAED,kBAEC;AAED,oBAEC;AArFD,mCAAgD;AAChD,yCAAqC;AAGrC,+DAA2D;AAC3D,2CAAwC;AACxC,iEAA6D;AAC7D,6DAAsD;AAEtD,SAAS,cAAc,CAAC,UAAsB,EAAE,IAAY,EAAE,UAAgC,EAAE;IAC9F,IAAA,wCAAkB,GAAE,CAAC;IACrB,MAAM,kBAAkB,GAAW,GAAG,UAAU,IAAI,IAAI,EAAE,CAAC;IAC3D,MAAM,gBAAgB,GAAW,UAAU,CAAC,WAAW,EAAE,CAAC;IAC1D,MAAM,KAAK,GAAW,OAAO,EAAE,KAAK,IAAI,mBAAU,CAAC;IACnD,MAAM,GAAG,GAAgB,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAC7D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AC,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AACzD,CAAC;AAED,SAAgB,GAAG,CAAC,IAAY,EAAE,UAAgC,EAAE;IAClE,OAAO,cAAc,CAAC,mBAAU,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AAC1D,CAAC;AAED,SAAgB,IAAI,CAAC,IAAY,EAAE,UAAgC,EAAE;IACnE,OAAO,cAAc,CAAC,mBAAU,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -32,8 +32,9 @@ function initializeApplication(initializeApplicationOptions) {
|
|
|
32
32
|
}
|
|
33
33
|
const shadowApp = _injector_1.injector.injected.shadowAppMapping[serverOptions.appId || _const_1.DEFAULT_ID];
|
|
34
34
|
if (Array.isArray(shadowApp) && shadowApp.length) {
|
|
35
|
+
// in declaration order: it decides the order of the OpenAPI document and of conflict errors
|
|
35
36
|
while (shadowApp.length) {
|
|
36
|
-
const fn = shadowApp.
|
|
37
|
+
const fn = shadowApp.shift();
|
|
37
38
|
fn(app);
|
|
38
39
|
}
|
|
39
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize-application.js","sourceRoot":"","sources":["../../src/decorators/initialize-application.ts"],"names":[],"mappings":";;AAQA,
|
|
1
|
+
{"version":3,"file":"initialize-application.js","sourceRoot":"","sources":["../../src/decorators/initialize-application.ts"],"names":[],"mappings":";;AAQA,sDAgCC;AAvCD,yCAAqC;AACrC,mCAAoC;AACpC,mCAAqC;AACrC,+DAA2D;AAC3D,iEAA6D;AAC7D,qCAA6D;AAE7D,SAAgB,qBAAqB,CAAC,4BAA0D;IAC9F,IAAA,wCAAkB,GAAE,CAAC;IACrB,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,GAAG,4BAA4B,CAAC;IACpE,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,IAAI,mBAAU,CAAC;QAC7D,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oConfigurationErrorCode = 'ROUTE_ALREADY_REGISTERED' | 'ROUTE_RESERVED_FOR_OPEN_API';
|
|
2
|
+
/**
|
|
3
|
+
* Thrown while the application is being set up (never for a request): the configuration cannot
|
|
4
|
+
* work as written. `code` tells the cases apart without matching the message.
|
|
5
|
+
*/
|
|
6
|
+
export declare class AladoConfigurationError extends Error {
|
|
7
|
+
readonly code: AladoConfigurationErrorCode;
|
|
8
|
+
constructor(code: AladoConfigurationErrorCode, message: string);
|
|
9
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AladoConfigurationError = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Thrown while the application is being set up (never for a request): the configuration cannot
|
|
6
|
+
* work as written. `code` tells the cases apart without matching the message.
|
|
7
|
+
*/
|
|
8
|
+
class AladoConfigurationError extends Error {
|
|
9
|
+
code;
|
|
10
|
+
constructor(code, message) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = 'AladoConfigurationError';
|
|
13
|
+
this.code = code;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.AladoConfigurationError = AladoConfigurationError;
|
|
17
|
+
//# sourceMappingURL=alado-configuration-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alado-configuration-error.js","sourceRoot":"","sources":["../../src/dto/alado-configuration-error.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACH,MAAa,uBAAwB,SAAQ,KAAK;IAChC,IAAI,CAA8B;IAElD,YAAY,IAAiC,EAAE,OAAe;QAC5D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;QACtC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AARD,0DAQC"}
|
package/dist/dto/index.d.ts
CHANGED
package/dist/dto/index.js
CHANGED
|
@@ -24,4 +24,5 @@ __exportStar(require("./access-control-config"), exports);
|
|
|
24
24
|
__exportStar(require("./request-authentication"), exports);
|
|
25
25
|
__exportStar(require("./route"), exports);
|
|
26
26
|
__exportStar(require("./open-api-doc-object"), exports);
|
|
27
|
+
__exportStar(require("./alado-configuration-error"), exports);
|
|
27
28
|
//# sourceMappingURL=index.js.map
|
package/dist/dto/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dto/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,uDAAqC;AACrC,wDAAsC;AACtC,4CAA0B;AAC1B,6CAA2B;AAC3B,wDAAsC;AACtC,0DAAwC;AACxC,2DAAyC;AACzC,0CAAwB;AACxB,wDAAsC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dto/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,uDAAqC;AACrC,wDAAsC;AACtC,4CAA0B;AAC1B,6CAA2B;AAC3B,wDAAsC;AACtC,0DAAwC;AACxC,2DAAyC;AACzC,0CAAwB;AACxB,wDAAsC;AACtC,8DAA4C"}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import { Context } from '../../dto/index.js';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Runs the auth handler. With `required: false` a request is never refused here: credentials that
|
|
4
|
+
* are missing, invalid or make the handler throw leave it anonymous (nothing at outputProperty).
|
|
5
|
+
* A handler is expected to return null/undefined for credentials it does not accept; an exception
|
|
6
|
+
* is a failure of the handler and goes to `onHandlerError` (the client only ever gets `error`).
|
|
7
|
+
*/
|
|
8
|
+
export declare function authenticate(context: Context<any>, request: any, onHandlerError?: (error: unknown) => void): Promise<any>;
|
|
@@ -2,13 +2,54 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.authenticate = authenticate;
|
|
4
4
|
const accessor_1 = require("../accessor");
|
|
5
|
-
|
|
5
|
+
const json_parser_1 = require("./json-parser");
|
|
6
|
+
/**
|
|
7
|
+
* The auth input is checked before the handler sees it: validation of the rest of the request runs
|
|
8
|
+
* only after authentication, so without this a JSON body or a repeated query key could hand the
|
|
9
|
+
* handler an object or an array (e.g. {"$ne": null}, a NoSQL operator) instead of a token.
|
|
10
|
+
* With a validator declared for the field (context.request.<part>.<name>) that validator decides;
|
|
11
|
+
* without one, only a string is accepted.
|
|
12
|
+
*/
|
|
13
|
+
async function isValidAuthInput(context, request, value) {
|
|
14
|
+
const [part, name,] = context.auth.inputProperty.split('.');
|
|
15
|
+
const definition = context.request?.[part]?.[name];
|
|
16
|
+
const handler = definition?.validation?.handler;
|
|
17
|
+
if (typeof handler !== 'function') {
|
|
18
|
+
return typeof value === 'string';
|
|
19
|
+
}
|
|
20
|
+
let input = value;
|
|
21
|
+
if (definition?.isJSON && typeof value === 'string') {
|
|
22
|
+
try {
|
|
23
|
+
input = (0, json_parser_1.parseJson)(value);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
// the validator gets the raw string, as in request validation
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
return Boolean(await handler.apply(request, [input]));
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Runs the auth handler. With `required: false` a request is never refused here: credentials that
|
|
38
|
+
* are missing, invalid or make the handler throw leave it anonymous (nothing at outputProperty).
|
|
39
|
+
* A handler is expected to return null/undefined for credentials it does not accept; an exception
|
|
40
|
+
* is a failure of the handler and goes to `onHandlerError` (the client only ever gets `error`).
|
|
41
|
+
*/
|
|
42
|
+
async function authenticate(context, request, onHandlerError) {
|
|
6
43
|
const { auth } = context;
|
|
7
44
|
const { required, handler, handlerContext, inputProperty, outputProperty, error } = auth;
|
|
45
|
+
const refuse = required ? error : undefined;
|
|
8
46
|
const authData = (0, accessor_1.getProperty)(request, inputProperty);
|
|
9
47
|
if (required && !authData) {
|
|
10
48
|
return error;
|
|
11
49
|
}
|
|
50
|
+
if (authData !== undefined && authData !== null && !(await isValidAuthInput(context, request, authData))) {
|
|
51
|
+
return refuse;
|
|
52
|
+
}
|
|
12
53
|
try {
|
|
13
54
|
const result = await handler.apply(handlerContext || {}, [authData]);
|
|
14
55
|
if (!result && required) {
|
|
@@ -16,9 +57,10 @@ async function authenticate(context, request) {
|
|
|
16
57
|
}
|
|
17
58
|
(0, accessor_1.setProperty)(request, outputProperty, result);
|
|
18
59
|
}
|
|
19
|
-
catch {
|
|
60
|
+
catch (e) {
|
|
61
|
+
onHandlerError?.(e);
|
|
20
62
|
// the configured error, never the exception text (it may describe internals)
|
|
21
|
-
return
|
|
63
|
+
return refuse;
|
|
22
64
|
}
|
|
23
65
|
}
|
|
24
66
|
//# sourceMappingURL=authenticate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate.js","sourceRoot":"","sources":["../../../src/helpers/parser/authenticate.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"authenticate.js","sourceRoot":"","sources":["../../../src/helpers/parser/authenticate.ts"],"names":[],"mappings":";;AA0CA,oCA2BC;AApED,0CAAuD;AACvD,+CAA0C;AAE1C;;;;;;GAMG;AACH,KAAK,UAAU,gBAAgB,CAAC,OAAqB,EAAE,OAAY,EAAE,KAAc;IACjF,MAAM,CACJ,IAAI,EACJ,IAAI,EACL,GAAI,OAAO,CAAC,IAA8B,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACrE,MAAM,UAAU,GAAoC,OAAO,CAAC,OAAe,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IAC5F,MAAM,OAAO,GAAG,UAAU,EAAE,UAAU,EAAE,OAAO,CAAC;IAChD,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;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,CAAC,cAAc,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;QACrE,IAAI,CAAC,MAAM,IAAI,QAAQ,EAAE,CAAC;YACxB,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAA,sBAAW,EAAC,OAAO,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;IAC/C,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC;QACpB,6EAA6E;QAC7E,OAAO,MAAM,CAAC;IAChB,CAAC;AACH,CAAC"}
|
|
@@ -2,18 +2,35 @@ import { IncomingMessage, OutgoingMessage } from 'http';
|
|
|
2
2
|
export declare function mediaType(contentType: string | undefined): string;
|
|
3
3
|
export declare function isXmlContentType(contentType: string | undefined): boolean;
|
|
4
4
|
export declare function isJsonContentType(contentType: string | undefined): boolean;
|
|
5
|
-
type
|
|
5
|
+
type PartHeaders = {
|
|
6
6
|
name: string | null;
|
|
7
|
-
value: string | null;
|
|
8
7
|
filename: string | null;
|
|
9
8
|
mimetype: string | null;
|
|
10
9
|
};
|
|
10
|
+
type MultipartFile = {
|
|
11
|
+
name: string;
|
|
12
|
+
mimetype: string;
|
|
13
|
+
content: Buffer;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Header fields of one part. `headers` is the text before the blank line, read as latin1 (one
|
|
17
|
+
* char per byte); the field name is UTF-8 and is decoded back. filename="" is kept as '': it is
|
|
18
|
+
* what a browser sends for a file input left empty.
|
|
19
|
+
*/
|
|
20
|
+
export declare function parsePartHeaders(headers: string): PartHeaders;
|
|
11
21
|
/**
|
|
12
|
-
* Splits
|
|
13
|
-
*
|
|
14
|
-
*
|
|
22
|
+
* Splits a multipart body without turning it into a string: delimiters are found with
|
|
23
|
+
* Buffer.indexOf, and a file's content is a subarray() of `raw` (same memory, no copy). Every
|
|
24
|
+
* search is bounded by the part it belongs to, so the whole body is scanned once.
|
|
25
|
+
* A part without its closing delimiter (a cut-off body) is dropped.
|
|
15
26
|
*/
|
|
16
|
-
export declare function
|
|
27
|
+
export declare function parseMultipartBody(raw: Buffer, boundary: string): {
|
|
28
|
+
fields: Array<[
|
|
29
|
+
string,
|
|
30
|
+
Buffer
|
|
31
|
+
]>;
|
|
32
|
+
files: MultipartFile[];
|
|
33
|
+
};
|
|
17
34
|
export declare function multipartBoundary(contentType: string): string | null;
|
|
18
35
|
export declare function bodyParser(req: IncomingMessage, res: OutgoingMessage, limit: number, acceptFiles?: boolean): Promise<any>;
|
|
19
36
|
export {};
|
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.mediaType = mediaType;
|
|
4
4
|
exports.isXmlContentType = isXmlContentType;
|
|
5
5
|
exports.isJsonContentType = isJsonContentType;
|
|
6
|
-
exports.
|
|
6
|
+
exports.parsePartHeaders = parsePartHeaders;
|
|
7
|
+
exports.parseMultipartBody = parseMultipartBody;
|
|
7
8
|
exports.multipartBoundary = multipartBoundary;
|
|
8
9
|
exports.bodyParser = bodyParser;
|
|
9
10
|
const _const_1 = require("../../constants/index.js");
|
|
@@ -28,34 +29,88 @@ function isJsonContentType(contentType) {
|
|
|
28
29
|
const partNameRegExp = /(?:^|[;\s])name="([^"]*)"/i;
|
|
29
30
|
const partFilenameRegExp = /(?:^|[;\s])filename="([^"]*)"/i;
|
|
30
31
|
const partContentTypeRegExp = /^content-type:([^\r\n]*)$/im;
|
|
32
|
+
const CRLF = Buffer.from('\r\n');
|
|
33
|
+
const HEADERS_END = Buffer.from('\r\n\r\n');
|
|
31
34
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
+
* Header fields of one part. `headers` is the text before the blank line, read as latin1 (one
|
|
36
|
+
* char per byte); the field name is UTF-8 and is decoded back. filename="" is kept as '': it is
|
|
37
|
+
* what a browser sends for a file input left empty.
|
|
35
38
|
*/
|
|
36
|
-
function
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
const valueStart = headerEnd + 4;
|
|
42
|
-
const valueEnd = item.length - 4;
|
|
43
|
-
const value = valueEnd >= valueStart && item.endsWith('\r\n--') ? item.slice(valueStart, valueEnd) : null;
|
|
44
|
-
const headers = item.slice(0, headerEnd);
|
|
45
|
-
const pick = (regExp) => {
|
|
46
|
-
const match = regExp.exec(headers);
|
|
47
|
-
return match && match[1] ? match[1] : null;
|
|
48
|
-
};
|
|
49
|
-
// filename="" is kept as '': it is what a browser sends for a file input left empty
|
|
50
|
-
const filenameMatch = partFilenameRegExp.exec(headers);
|
|
39
|
+
function parsePartHeaders(headers) {
|
|
40
|
+
const name = partNameRegExp.exec(headers);
|
|
41
|
+
const filename = partFilenameRegExp.exec(headers);
|
|
42
|
+
const mimetype = partContentTypeRegExp.exec(headers);
|
|
51
43
|
return {
|
|
52
|
-
name:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
filename: filenameMatch ? filenameMatch[1] : null,
|
|
56
|
-
mimetype: pick(partContentTypeRegExp),
|
|
44
|
+
name: name && name[1] ? Buffer.from(name[1], 'latin1').toString('utf8') : null,
|
|
45
|
+
filename: filename ? filename[1] : null,
|
|
46
|
+
mimetype: mimetype && mimetype[1].trim() ? mimetype[1].trim() : null,
|
|
57
47
|
};
|
|
58
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Splits a multipart body without turning it into a string: delimiters are found with
|
|
51
|
+
* Buffer.indexOf, and a file's content is a subarray() of `raw` (same memory, no copy). Every
|
|
52
|
+
* search is bounded by the part it belongs to, so the whole body is scanned once.
|
|
53
|
+
* A part without its closing delimiter (a cut-off body) is dropped.
|
|
54
|
+
*/
|
|
55
|
+
function parseMultipartBody(raw, boundary) {
|
|
56
|
+
const fields = [];
|
|
57
|
+
const files = [];
|
|
58
|
+
const dashBoundary = Buffer.from(`--${boundary}`);
|
|
59
|
+
// every delimiter but the first is preceded by a line break, which belongs to it
|
|
60
|
+
const delimiter = Buffer.from(`\r\n--${boundary}`);
|
|
61
|
+
let position = raw.indexOf(dashBoundary);
|
|
62
|
+
if (position === -1) {
|
|
63
|
+
return { fields, files };
|
|
64
|
+
}
|
|
65
|
+
position += dashBoundary.length;
|
|
66
|
+
for (;;) {
|
|
67
|
+
// "--" after a delimiter closes the body; anything after it is an epilogue
|
|
68
|
+
if (raw[position] === 45 && raw[position + 1] === 45) {
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
// the rest of the delimiter line (optional whitespace) up to its line break
|
|
72
|
+
const lineEnd = raw.indexOf(CRLF, position);
|
|
73
|
+
if (lineEnd === -1) {
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
const headersStart = lineEnd + 2;
|
|
77
|
+
const next = raw.indexOf(delimiter, headersStart);
|
|
78
|
+
if (next === -1) {
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
// the blank line ending the headers, looked for inside this part only
|
|
82
|
+
const part = raw.subarray(headersStart, next);
|
|
83
|
+
let headersEnd;
|
|
84
|
+
let valueStart;
|
|
85
|
+
if (part[0] === 13 && part[1] === 10) {
|
|
86
|
+
// a part without any header line
|
|
87
|
+
headersEnd = 0;
|
|
88
|
+
valueStart = 2;
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
headersEnd = part.indexOf(HEADERS_END);
|
|
92
|
+
valueStart = headersEnd + 4;
|
|
93
|
+
}
|
|
94
|
+
if (headersEnd !== -1) {
|
|
95
|
+
const headers = parsePartHeaders(part.toString('latin1', 0, headersEnd));
|
|
96
|
+
const value = part.subarray(valueStart);
|
|
97
|
+
if (headers.name) {
|
|
98
|
+
if (headers.filename === null) {
|
|
99
|
+
fields.push([
|
|
100
|
+
headers.name,
|
|
101
|
+
value,
|
|
102
|
+
]);
|
|
103
|
+
}
|
|
104
|
+
else if (headers.mimetype && (headers.filename !== '' || value.length > 0)) {
|
|
105
|
+
// filename="" without content: a file input left empty, no file was chosen
|
|
106
|
+
files.push({ name: headers.name, mimetype: headers.mimetype, content: value });
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
position = next + delimiter.length;
|
|
111
|
+
}
|
|
112
|
+
return { fields, files };
|
|
113
|
+
}
|
|
59
114
|
// boundary parameter of a multipart Content-Type, unquoted and without the parameters after it
|
|
60
115
|
function multipartBoundary(contentType) {
|
|
61
116
|
const match = /;\s*boundary=(?:"([^"]+)"|([^;\s]+))/i.exec(contentType || '');
|
|
@@ -113,70 +168,84 @@ async function bodyParser(req, res, limit, acceptFiles = true) {
|
|
|
113
168
|
const mime = mediaType(contentType);
|
|
114
169
|
if (mime === _const_1.ContentType.FORM_DATA) {
|
|
115
170
|
const boundary = multipartBoundary(req.headers['content-type']);
|
|
171
|
+
// The body is needed as one Buffer. Joining all chunks at the end holds it twice (chunks plus the
|
|
172
|
+
// joined copy). With a declared Content-Length, the Buffer is allocated at its exact size once half
|
|
173
|
+
// of it has arrived, the chunks so far are copied in and dropped, and the rest is copied as it
|
|
174
|
+
// comes: about 1.5x at the peak. Waiting for half keeps a client from making the server allocate a
|
|
175
|
+
// large body it never sends. Without a declared length (chunked encoding) the chunks are joined.
|
|
176
|
+
const declared = Number.isSafeInteger(declaredLength) && declaredLength > 0 ? declaredLength : 0;
|
|
177
|
+
let whole;
|
|
116
178
|
await new Promise((resolve, reject) => {
|
|
117
|
-
|
|
179
|
+
const collect = collectChunks(req, res, limit, received, reject);
|
|
180
|
+
req.on('data', (chunk) => {
|
|
181
|
+
if (whole) {
|
|
182
|
+
if (received.bytes + chunk.length > whole.length) {
|
|
183
|
+
// more than Content-Length: Node's HTTP parser does not let it through, refuse it anyway
|
|
184
|
+
req.removeAllListeners('data');
|
|
185
|
+
req.removeAllListeners('end');
|
|
186
|
+
reject({ statusCode: 400, message: 'Bad Request' });
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
chunk.copy(whole, received.bytes);
|
|
190
|
+
received.bytes += chunk.length;
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
collect(chunk);
|
|
194
|
+
if (declared && received.bytes * 2 >= declared && received.bytes <= declared) {
|
|
195
|
+
whole = Buffer.allocUnsafe(declared);
|
|
196
|
+
let offset = 0;
|
|
197
|
+
for (const piece of received.chunks) {
|
|
198
|
+
offset += piece.copy(whole, offset);
|
|
199
|
+
}
|
|
200
|
+
received.chunks = [];
|
|
201
|
+
}
|
|
202
|
+
});
|
|
118
203
|
req.once('error', onRequestError(reject));
|
|
119
204
|
req.on('end', () => {
|
|
120
|
-
//
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
205
|
+
// one Buffer for the whole body; files are views into it, nothing is copied as a string
|
|
206
|
+
const raw = whole
|
|
207
|
+
? whole.subarray(0, received.bytes)
|
|
208
|
+
: received.chunks.length === 1
|
|
209
|
+
? received.chunks[0]
|
|
210
|
+
: Buffer.concat(received.chunks, received.bytes);
|
|
211
|
+
received.chunks = [];
|
|
212
|
+
// the latin1 ("binary") text of the body costs as much memory again: built only when read
|
|
213
|
+
let rawBody;
|
|
214
|
+
Object.defineProperty(result, 'rawBody', {
|
|
215
|
+
enumerable: true,
|
|
216
|
+
configurable: true,
|
|
217
|
+
get: () => (rawBody ??= raw.toString('latin1')),
|
|
218
|
+
});
|
|
219
|
+
if (!boundary) {
|
|
220
|
+
resolve();
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
const { fields, files } = parseMultipartBody(raw, boundary);
|
|
224
|
+
for (const [name, value,] of fields) {
|
|
225
|
+
// same keys the JSON and urlencoded parsers drop (__proto__, constructor, ...)
|
|
226
|
+
if (!_const_1.deprecatedJsonPropertiesRegExp.test(name)) {
|
|
227
|
+
result.body[name] = value.toString('utf8');
|
|
139
228
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
if (
|
|
229
|
+
}
|
|
230
|
+
if (acceptFiles) {
|
|
231
|
+
for (const file of files) {
|
|
232
|
+
const key = file.name.trim();
|
|
233
|
+
// a file named __proto__ would otherwise replace the prototype of request.files
|
|
234
|
+
if (_const_1.deprecatedJsonPropertiesRegExp.test(key)) {
|
|
146
235
|
continue;
|
|
147
236
|
}
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
// same keys the JSON and urlencoded parsers drop (__proto__, constructor, ...)
|
|
159
|
-
formData.fields[name] = Buffer.from(value, 'binary').toString('utf8');
|
|
237
|
+
const stream = new stream_1.Readable();
|
|
238
|
+
stream.push(file.content);
|
|
239
|
+
stream.push(null);
|
|
240
|
+
result.files[key] = {
|
|
241
|
+
stream,
|
|
242
|
+
// byte length of the content, not a private field of the stream
|
|
243
|
+
size: file.content.length,
|
|
244
|
+
mimetype: file.mimetype,
|
|
245
|
+
};
|
|
246
|
+
file_signature_1.uploadedFileHeads.set(result.files[key], file.content.subarray(0, file_signature_1.FILE_SIGNATURE_BYTES));
|
|
160
247
|
}
|
|
161
248
|
}
|
|
162
|
-
for (const key in formData.fields) {
|
|
163
|
-
result.body[key] = formData.fields[key];
|
|
164
|
-
}
|
|
165
|
-
formData.files.forEach((file) => {
|
|
166
|
-
const { name, stream, mimetype, size } = file;
|
|
167
|
-
const key = name.trim();
|
|
168
|
-
// a file named __proto__ would otherwise replace the prototype of request.files
|
|
169
|
-
if (_const_1.deprecatedJsonPropertiesRegExp.test(key)) {
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
result.files[key] = {
|
|
173
|
-
stream: stream,
|
|
174
|
-
// byte length of the content, not a private field of the stream
|
|
175
|
-
size,
|
|
176
|
-
mimetype: mimetype.trim(),
|
|
177
|
-
};
|
|
178
|
-
file_signature_1.uploadedFileHeads.set(result.files[key], file.head);
|
|
179
|
-
});
|
|
180
249
|
resolve();
|
|
181
250
|
});
|
|
182
251
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"body-parser.js","sourceRoot":"","sources":["../../../src/helpers/parser/body-parser.ts"],"names":[],"mappings":";;AAUA,8BAEC;AAED,4CAGC;AAGD,8CAGC;AAaD,gDAuBC;AAGD,8CAGC;AAiDD,gCAwIC;AAzPD,mCAAqE;AACrE,mCAAkC;AAElC,6CAAyC;AACzC,+CAA0D;AAC1D,uEAA6F;AAE7F,+GAA+G;AAC/G,sGAAsG;AACtG,SAAgB,SAAS,CAAC,WAA+B;IACvD,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AAChE,CAAC;AAED,SAAgB,gBAAgB,CAAC,WAA+B;IAC9D,MAAM,IAAI,GAAW,SAAS,CAAC,WAAW,CAAC,CAAC;IAC5C,OAAO,IAAI,KAAK,oBAAW,CAAC,GAAG,IAAI,IAAI,KAAK,oBAAW,CAAC,QAAQ,IAAI,8BAA8B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAChH,CAAC;AAED,qGAAqG;AACrG,SAAgB,iBAAiB,CAAC,WAA+B;IAC/D,MAAM,IAAI,GAAW,SAAS,CAAC,WAAW,CAAC,CAAC;IAC5C,OAAO,IAAI,KAAK,oBAAW,CAAC,IAAI,IAAI,+BAA+B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjF,CAAC;AAID,MAAM,cAAc,GAAW,4BAA4B,CAAC;AAC5D,MAAM,kBAAkB,GAAW,gCAAgC,CAAC;AACpE,MAAM,qBAAqB,GAAW,6BAA6B,CAAC;AAEpE;;;;GAIG;AACH,SAAgB,kBAAkB,CAAC,IAAY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