@nestia/core 14.0.0 → 14.0.2
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/MIGRATION.md +20 -0
- package/README.md +1 -1
- package/lib/adaptors/McpAdaptor.d.ts +29 -3
- package/lib/adaptors/McpAdaptor.js +150 -24
- package/lib/adaptors/McpAdaptor.js.map +1 -1
- package/lib/adaptors/WebSocketAdaptor.d.ts +37 -0
- package/lib/adaptors/WebSocketAdaptor.js +184 -48
- package/lib/adaptors/WebSocketAdaptor.js.map +1 -1
- package/lib/adaptors/internal/RoutePathMatcher.d.ts +1 -0
- package/lib/adaptors/internal/RoutePathMatcher.js +88 -0
- package/lib/adaptors/internal/RoutePathMatcher.js.map +1 -0
- package/lib/adaptors/internal/external_context.d.ts +1 -0
- package/lib/adaptors/internal/external_context.js +56 -0
- package/lib/adaptors/internal/external_context.js.map +1 -0
- package/lib/decorators/DynamicModule.d.ts +12 -0
- package/lib/decorators/DynamicModule.js +12 -0
- package/lib/decorators/DynamicModule.js.map +1 -1
- package/lib/decorators/EncryptedBody.d.ts +14 -6
- package/lib/decorators/EncryptedBody.js +39 -16
- package/lib/decorators/EncryptedBody.js.map +1 -1
- package/lib/decorators/EncryptedController.d.ts +6 -1
- package/lib/decorators/EncryptedController.js +7 -2
- package/lib/decorators/EncryptedController.js.map +1 -1
- package/lib/decorators/EncryptedModule.d.ts +25 -6
- package/lib/decorators/EncryptedModule.js +87 -18
- package/lib/decorators/EncryptedModule.js.map +1 -1
- package/lib/decorators/EncryptedRoute.d.ts +20 -11
- package/lib/decorators/EncryptedRoute.js +27 -13
- package/lib/decorators/EncryptedRoute.js.map +1 -1
- package/lib/decorators/HumanRoute.d.ts +5 -0
- package/lib/decorators/HumanRoute.js +5 -0
- package/lib/decorators/HumanRoute.js.map +1 -1
- package/lib/decorators/McpRoute.d.ts +31 -19
- package/lib/decorators/McpRoute.js +12 -1
- package/lib/decorators/McpRoute.js.map +1 -1
- package/lib/decorators/PlainBody.d.ts +7 -1
- package/lib/decorators/PlainBody.js +16 -8
- package/lib/decorators/PlainBody.js.map +1 -1
- package/lib/decorators/SwaggerCustomizer.d.ts +15 -0
- package/lib/decorators/SwaggerCustomizer.js +5 -0
- package/lib/decorators/SwaggerCustomizer.js.map +1 -1
- package/lib/decorators/SwaggerExample.d.ts +51 -22
- package/lib/decorators/SwaggerExample.js +35 -22
- package/lib/decorators/SwaggerExample.js.map +1 -1
- package/lib/decorators/TypedBody.d.ts +10 -3
- package/lib/decorators/TypedBody.js +20 -10
- package/lib/decorators/TypedBody.js.map +1 -1
- package/lib/decorators/TypedException.d.ts +10 -0
- package/lib/decorators/TypedFormData.d.ts +81 -9
- package/lib/decorators/TypedFormData.js +121 -31
- package/lib/decorators/TypedFormData.js.map +1 -1
- package/lib/decorators/TypedHeaders.d.ts +5 -0
- package/lib/decorators/TypedHeaders.js +5 -0
- package/lib/decorators/TypedHeaders.js.map +1 -1
- package/lib/decorators/TypedParam.d.ts +12 -3
- package/lib/decorators/TypedParam.js +12 -3
- package/lib/decorators/TypedParam.js.map +1 -1
- package/lib/decorators/TypedQuery.d.ts +17 -1
- package/lib/decorators/TypedQuery.js +25 -4
- package/lib/decorators/TypedQuery.js.map +1 -1
- package/lib/decorators/TypedRoute.d.ts +25 -10
- package/lib/decorators/TypedRoute.js +19 -10
- package/lib/decorators/TypedRoute.js.map +1 -1
- package/lib/decorators/WebSocketRoute.d.ts +18 -1
- package/lib/decorators/WebSocketRoute.js +18 -1
- package/lib/decorators/WebSocketRoute.js.map +1 -1
- package/lib/decorators/doNotThrowTransformError.d.ts +14 -0
- package/lib/decorators/doNotThrowTransformError.js +14 -0
- package/lib/decorators/doNotThrowTransformError.js.map +1 -1
- package/lib/decorators/internal/EncryptedConstant.js +13 -2
- package/lib/decorators/internal/EncryptedConstant.js.map +1 -1
- package/lib/decorators/internal/IRequestBodyValidation.d.ts +66 -0
- package/lib/decorators/internal/IRequestBodyValidation.js +3 -0
- package/lib/decorators/internal/IRequestBodyValidation.js.map +1 -0
- package/lib/decorators/internal/IWebSocketRouteReflect.d.ts +93 -1
- package/lib/decorators/internal/get_encryption_password.d.ts +1 -0
- package/lib/decorators/internal/get_encryption_password.js +14 -0
- package/lib/decorators/internal/get_encryption_password.js.map +1 -0
- package/lib/decorators/internal/get_path_and_querify.js +23 -9
- package/lib/decorators/internal/get_path_and_querify.js.map +1 -1
- package/lib/decorators/internal/get_path_and_stringify.js +3 -7
- package/lib/decorators/internal/get_path_and_stringify.js.map +1 -1
- package/lib/decorators/internal/get_text_body.js +9 -3
- package/lib/decorators/internal/get_text_body.js.map +1 -1
- package/lib/decorators/internal/group_entries.d.ts +1 -0
- package/lib/decorators/internal/group_entries.js +19 -0
- package/lib/decorators/internal/group_entries.js.map +1 -0
- package/lib/decorators/internal/load_controller.d.ts +14 -0
- package/lib/decorators/internal/load_controller.js +14 -0
- package/lib/decorators/internal/load_controller.js.map +1 -1
- package/lib/decorators/internal/split_route_arguments.d.ts +1 -0
- package/lib/decorators/internal/split_route_arguments.js +22 -0
- package/lib/decorators/internal/split_route_arguments.js.map +1 -0
- package/lib/decorators/internal/validate_request_body.js +68 -25
- package/lib/decorators/internal/validate_request_body.js.map +1 -1
- package/lib/decorators/internal/validate_request_form_data.js +3 -1
- package/lib/decorators/internal/validate_request_form_data.js.map +1 -1
- package/lib/decorators/internal/validate_request_headers.js +2 -1
- package/lib/decorators/internal/validate_request_headers.js.map +1 -1
- package/lib/decorators/internal/validate_request_query.js +3 -1
- package/lib/decorators/internal/validate_request_query.js.map +1 -1
- package/lib/options/IRequestBodyValidator.d.ts +71 -0
- package/lib/options/IRequestFormDataProps.d.ts +80 -0
- package/lib/options/IRequestHeadersValidator.d.ts +67 -0
- package/lib/options/IRequestQueryValidator.d.ts +68 -0
- package/lib/options/IResponseBodyQuerifier.d.ts +125 -1
- package/lib/options/IResponseBodyStringifier.d.ts +107 -0
- package/lib/typings/Creator.d.ts +10 -0
- package/lib/utils/ArrayUtil.d.ts +21 -0
- package/lib/utils/ArrayUtil.js +22 -1
- package/lib/utils/ArrayUtil.js.map +1 -1
- package/lib/utils/ExceptionManager.d.ts +43 -4
- package/lib/utils/ExceptionManager.js +44 -6
- package/lib/utils/ExceptionManager.js.map +1 -1
- package/lib/utils/SourceFinder.d.ts +22 -0
- package/lib/utils/SourceFinder.js +60 -10
- package/lib/utils/SourceFinder.js.map +1 -1
- package/lib/utils/VersioningStrategy.d.ts +45 -2
- package/lib/utils/VersioningStrategy.js +40 -7
- package/lib/utils/VersioningStrategy.js.map +1 -1
- package/native/go.mod +1 -1
- package/native/go.sum +2 -2
- package/native/plugin/plan.go +68 -2
- package/native/transform/ast.go +23 -3
- package/native/transform/build.go +51 -57
- package/native/transform/buildoutput/output.go +147 -0
- package/native/transform/contributor.go +9 -0
- package/native/transform/core_querify.go +63 -9
- package/native/transform/core_transform.go +180 -98
- package/native/transform/core_websocket.go +111 -14
- package/native/transform/node_transform.go +17 -8
- package/native/transform/package.go +55 -0
- package/native/transform/printer.go +1 -3
- package/native/transform/run.go +18 -0
- package/native/transform/schemaprojection/project.go +213 -0
- package/native/transform/transform.go +29 -18
- package/native/transform/typia_fast.go +6 -0
- package/native/transform.cjs +49 -0
- package/package.json +13 -15
- package/src/adaptors/McpAdaptor.ts +215 -33
- package/src/adaptors/WebSocketAdaptor.ts +202 -52
- package/src/adaptors/internal/RoutePathMatcher.ts +91 -0
- package/src/adaptors/internal/external_context.ts +81 -0
- package/src/decorators/DynamicModule.ts +12 -0
- package/src/decorators/EncryptedBody.ts +39 -15
- package/src/decorators/EncryptedController.ts +12 -3
- package/src/decorators/EncryptedModule.ts +89 -18
- package/src/decorators/EncryptedRoute.ts +27 -16
- package/src/decorators/HumanRoute.ts +5 -0
- package/src/decorators/McpRoute.ts +31 -19
- package/src/decorators/PlainBody.ts +20 -10
- package/src/decorators/SwaggerCustomizer.ts +15 -0
- package/src/decorators/SwaggerExample.ts +51 -22
- package/src/decorators/TypedBody.ts +18 -9
- package/src/decorators/TypedException.ts +10 -0
- package/src/decorators/TypedFormData.ts +207 -45
- package/src/decorators/TypedHeaders.ts +5 -0
- package/src/decorators/TypedParam.ts +12 -3
- package/src/decorators/TypedQuery.ts +35 -7
- package/src/decorators/TypedRoute.ts +25 -10
- package/src/decorators/WebSocketRoute.ts +18 -1
- package/src/decorators/doNotThrowTransformError.ts +14 -0
- package/src/decorators/internal/EncryptedConstant.ts +14 -1
- package/src/decorators/internal/IMcpRouteReflect.ts +7 -1
- package/src/decorators/internal/IRequestBodyValidation.ts +65 -0
- package/src/decorators/internal/IWebSocketRouteReflect.ts +95 -1
- package/src/decorators/internal/get_encryption_password.ts +19 -0
- package/src/decorators/internal/get_path_and_querify.ts +31 -10
- package/src/decorators/internal/get_path_and_stringify.ts +3 -9
- package/src/decorators/internal/get_text_body.ts +8 -4
- package/src/decorators/internal/group_entries.ts +17 -0
- package/src/decorators/internal/load_controller.ts +14 -0
- package/src/decorators/internal/split_route_arguments.ts +20 -0
- package/src/decorators/internal/validate_request_body.ts +87 -34
- package/src/decorators/internal/validate_request_form_data.ts +3 -1
- package/src/decorators/internal/validate_request_headers.ts +2 -2
- package/src/decorators/internal/validate_request_query.ts +3 -2
- package/src/options/IRequestBodyValidator.ts +71 -0
- package/src/options/IRequestFormDataProps.ts +80 -0
- package/src/options/IRequestHeadersValidator.ts +67 -0
- package/src/options/IRequestQueryValidator.ts +68 -0
- package/src/options/IResponseBodyQuerifier.ts +126 -1
- package/src/options/IResponseBodyStringifier.ts +107 -0
- package/src/typings/Creator.ts +10 -0
- package/src/utils/ArrayUtil.ts +22 -3
- package/src/utils/ExceptionManager.ts +50 -6
- package/src/utils/SourceFinder.ts +62 -10
- package/src/utils/VersioningStrategy.ts +55 -11
- package/lib/transform.d.ts +0 -10
- package/lib/transform.js +0 -25
- package/lib/transform.js.map +0 -1
- package/src/transform.ts +0 -26
|
@@ -7,15 +7,11 @@ exports.get_path_and_stringify = void 0;
|
|
|
7
7
|
const common_1 = require("@nestjs/common");
|
|
8
8
|
const typia_1 = __importDefault(require("typia"));
|
|
9
9
|
const NoTransformConfigurationError_1 = require("../NoTransformConfigurationError");
|
|
10
|
+
const split_route_arguments_1 = require("./split_route_arguments");
|
|
10
11
|
/** @internal */
|
|
11
12
|
const get_path_and_stringify = (logger) => (method) => (...args) => {
|
|
12
|
-
const path =
|
|
13
|
-
|
|
14
|
-
Array.isArray(args[0])
|
|
15
|
-
? args[0]
|
|
16
|
-
: null;
|
|
17
|
-
const functor = path === null ? args[0] : args[1];
|
|
18
|
-
return [path !== null && path !== void 0 ? path : undefined, take(logger)(method)(functor)];
|
|
13
|
+
const [path, functor] = (0, split_route_arguments_1.split_route_arguments)(args);
|
|
14
|
+
return [path, take(logger)(method)(functor)];
|
|
19
15
|
};
|
|
20
16
|
exports.get_path_and_stringify = get_path_and_stringify;
|
|
21
17
|
/** @internal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_path_and_stringify.js","sourceRoot":"","sources":["../../../src/decorators/internal/get_path_and_stringify.ts"],"names":[],"mappings":";;;;;;AAAA,2CAA8D;AAC9D,kDAA2D;AAG3D,oFAAiF;
|
|
1
|
+
{"version":3,"file":"get_path_and_stringify.js","sourceRoot":"","sources":["../../../src/decorators/internal/get_path_and_stringify.ts"],"names":[],"mappings":";;;;;;AAAA,2CAA8D;AAC9D,kDAA2D;AAG3D,oFAAiF;AAEjF,mEAAgE;AAEhE,gBAAgB;AACT,MAAM,sBAAsB,GACjC,CAAC,MAAyD,EAAE,EAAE,CAC9D,CAAC,MAAc,EAAE,EAAE,CACnB,CACE,GAAG,IAAW,EAId,EAAE;IACF,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAA,6CAAqB,EAAM,IAAI,CAAC,CAAC;IACzD,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;AAC/C,CAAC,CAAC;AAXS,Q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,MAAM,CAAC,OAAO,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC,IAAI,CAAC;IAChD,IAAI,MAAM,CAAC,OAAO,KAAK,KAAK;QAC1B,MAAM,EAAE,CAAC;YACP,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,MAAM;YACN,IAAI;YACJ,IAAI;SACL,CAAC,CAAC;IACL,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC,CAAC;AAEJ,gBAAgB;AAChB,MAAM,OAAO,GAAG,wDAAwD,CAAC"}
|
|
@@ -16,9 +16,15 @@ exports.get_text_body = void 0;
|
|
|
16
16
|
const raw_body_1 = __importDefault(require("raw-body"));
|
|
17
17
|
/** @internal */
|
|
18
18
|
const get_text_body = (request) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
if (isExpressRequest(request) === false)
|
|
20
|
+
return request.body;
|
|
21
|
+
// a body parser the application registered, such as
|
|
22
|
+
// `app.useBodyParser("text")`, has already consumed the stream
|
|
23
|
+
if (typeof request.body === "string")
|
|
24
|
+
return request.body;
|
|
25
|
+
if (Buffer.isBuffer(request.body))
|
|
26
|
+
return request.body.toString("utf8");
|
|
27
|
+
return (yield (0, raw_body_1.default)(request)).toString("utf8");
|
|
22
28
|
});
|
|
23
29
|
exports.get_text_body = get_text_body;
|
|
24
30
|
/** @internal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_text_body.js","sourceRoot":"","sources":["../../../src/decorators/internal/get_text_body.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,wDAA2B;AAE3B,gBAAgB;AACT,MAAM,aAAa,GAAG,CAC3B,OAAyC,EACxB,EAAE;IACnB,
|
|
1
|
+
{"version":3,"file":"get_text_body.js","sourceRoot":"","sources":["../../../src/decorators/internal/get_text_body.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,wDAA2B;AAE3B,gBAAgB;AACT,MAAM,aAAa,GAAG,CAC3B,OAAyC,EACxB,EAAE;IACnB,IAAI,gBAAgB,CAAC,OAAO,CAAC,KAAK,KAAK;QAAE,OAAO,OAAO,CAAC,IAAc,CAAC;IACvE,oDAAoD;IACpD,+DAA+D;IAC/D,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO,OAAO,CAAC,IAAI,CAAC;IAC1D,IAAI,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,OAAO,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACxE,OAAO,CAAC,MAAM,IAAA,kBAAG,EAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC/C,CAAC,CAAA,CAAC;AATW,QAAA,aAAa,GAAb,aAAa,CASxB;AAEF,gBAAgB;AAChB,MAAM,gBAAgB,GAAG,CACvB,OAAyC,EACb,EAAE,CAAE,OAA2B,CAAC,GAAG,KAAK,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.group_entries = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The entries of a `URLSearchParams` or `FormData` as a plain object: a key
|
|
6
|
+
* given once maps to its value, a repeated key to all of its values in order.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
const group_entries = (source) => {
|
|
11
|
+
const output = {};
|
|
12
|
+
for (const key of new Set(source.keys())) {
|
|
13
|
+
const values = source.getAll(key);
|
|
14
|
+
output[key] = values.length === 1 ? values[0] : values;
|
|
15
|
+
}
|
|
16
|
+
return output;
|
|
17
|
+
};
|
|
18
|
+
exports.group_entries = group_entries;
|
|
19
|
+
//# sourceMappingURL=group_entries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group_entries.js","sourceRoot":"","sources":["../../../src/decorators/internal/group_entries.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACI,MAAM,aAAa,GAAG,CAAQ,MAGpC,EAAmC,EAAE;IACpC,MAAM,MAAM,GAAoC,EAAE,CAAC;IACnD,KAAK,MAAM,GAAG,IAAI,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;QACzC,MAAM,MAAM,GAAY,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC3C,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,MAAM,CAAC;IAC1D,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAVW,QAAA,aAAa,GAAb,aAAa,CAUxB"}
|
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
import { Creator } from "../../typings/Creator";
|
|
2
|
+
/**
|
|
3
|
+
* Finds and imports the controllers under the given paths.
|
|
4
|
+
*
|
|
5
|
+
* A path, a list, or include and exclude lists are matched with globs, imported
|
|
6
|
+
* by file URL, and every export that carries Nest's `path` metadata is a
|
|
7
|
+
* controller. When no compiled `.js` controller is found and the process runs
|
|
8
|
+
* from source under `ttsx`, the TypeScript files are used instead.
|
|
9
|
+
*
|
|
10
|
+
* @evidence contracts/common.md#principled-implementation Files are selected by a filter chosen from the runtime (JavaScript modules, or TypeScript sources without declaration files), each is imported by `file:` URL through a native dynamic import that survives CommonJS downleveling, and a controller is recognized by Nest's own `path` metadata, so no naming convention is assumed.
|
|
11
|
+
* @evidence contracts/common.md#clear-and-simple-design One function with the fallback for the source-run case inside it and the filters and the mount loop as private helpers.
|
|
12
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Discovery follows the metadata Nest itself writes; the `ttsx` fallback is decided by the runtime's own environment variable, not by a project name.
|
|
13
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the path forms, the recognition rule, and the source-run fallback.
|
|
14
|
+
* @evidence contracts/portability.md#os-neutral-implementation SourceFinder returns native absolute file paths and pathToFileURL converts them to escaped file URLs before dynamic import, including drive letters, spaces and URL punctuation. Extension matching selects source formats rather than defining filesystem identity.
|
|
15
|
+
*/
|
|
2
16
|
export declare const load_controllers: (path: string | string[] | {
|
|
3
17
|
include: string[];
|
|
4
18
|
exclude?: string[];
|
|
@@ -12,6 +12,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.load_controllers = void 0;
|
|
13
13
|
const url_1 = require("url");
|
|
14
14
|
const SourceFinder_1 = require("../../utils/SourceFinder");
|
|
15
|
+
/**
|
|
16
|
+
* Finds and imports the controllers under the given paths.
|
|
17
|
+
*
|
|
18
|
+
* A path, a list, or include and exclude lists are matched with globs, imported
|
|
19
|
+
* by file URL, and every export that carries Nest's `path` metadata is a
|
|
20
|
+
* controller. When no compiled `.js` controller is found and the process runs
|
|
21
|
+
* from source under `ttsx`, the TypeScript files are used instead.
|
|
22
|
+
*
|
|
23
|
+
* @evidence contracts/common.md#principled-implementation Files are selected by a filter chosen from the runtime (JavaScript modules, or TypeScript sources without declaration files), each is imported by `file:` URL through a native dynamic import that survives CommonJS downleveling, and a controller is recognized by Nest's own `path` metadata, so no naming convention is assumed.
|
|
24
|
+
* @evidence contracts/common.md#clear-and-simple-design One function with the fallback for the source-run case inside it and the filters and the mount loop as private helpers.
|
|
25
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Discovery follows the metadata Nest itself writes; the `ttsx` fallback is decided by the runtime's own environment variable, not by a project name.
|
|
26
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the path forms, the recognition rule, and the source-run fallback.
|
|
27
|
+
* @evidence contracts/portability.md#os-neutral-implementation SourceFinder returns native absolute file paths and pathToFileURL converts them to escaped file URLs before dynamic import, including drive letters, spaces and URL punctuation. Extension matching selects source formats rather than defining filesystem identity.
|
|
28
|
+
*/
|
|
15
29
|
const load_controllers = (path, isTsNode) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
30
|
var _a;
|
|
17
31
|
const include = Array.isArray(path)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load_controller.js","sourceRoot":"","sources":["../../../src/decorators/internal/load_controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6BAAoC;AAGpC,2DAAwD;
|
|
1
|
+
{"version":3,"file":"load_controller.js","sourceRoot":"","sources":["../../../src/decorators/internal/load_controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6BAAoC;AAGpC,2DAAwD;AAExD;;;;;;;;;;;;;GAaG;AACI,MAAM,gBAAgB,GAAG,CAC9B,IAAmE,EACnE,QAAkB,EACU,EAAE;;IAC9B,MAAM,OAAO,GAAa,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QAC3C,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,OAAO,IAAI,KAAK,QAAQ;YACxB,CAAC,CAAC,IAAI,CAAC,OAAO;YACd,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACb,MAAM,OAAO,GACX,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QAC9C,CAAC,CAAC,OAAC,IAAI,CAAC,OAAO,mCAAI,EAAE,CAAC;QACtB,CAAC,CAAC,EAAE,CAAC;IACT,MAAM,MAAM,GAAG,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,kBAAkB,CAAC;IAC3E,MAAM,OAAO,GAAa,MAAM,2BAAY,CAAC,IAAI,CAAC;QAChD,OAAO;QACP,OAAO;QACP,MAAM;KACP,CAAC,CAAC;IACH,MAAM,WAAW,GAAsB,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC;IAC5D,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,IAAI,QAAQ,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;AACH,SAAS,YAAY;IACnB,OAAO,CACL,OAAO,OAAO,CAAC,GAAG,CAAC,qBAAqB,KAAK,QAAQ;QACrD,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,MAAM,KAAK,CAAC,CAC/C,CAAC;AACJ,CAAC;AAED,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAW,EAAE,CACnD,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;AAE5C,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAW,EAAE;IACnD,MAAM,KAAK,GAAW,IAAI,CAAC,WAAW,EAAE,CAAC;IACzC,OAAO,CACL,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC;QAC5B,yBAAyB,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,CAChD,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.split_route_arguments = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Splits the arguments of a route decorator into its path and its functor.
|
|
6
|
+
*
|
|
7
|
+
* A route decorator is called as `Route()`, `Route(path)`, `Route(functor)`, or
|
|
8
|
+
* `Route(path, functor)`. The first argument is the path when it is absent, a
|
|
9
|
+
* string, or an array of strings, and the functor otherwise.
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
const split_route_arguments = (args) => {
|
|
14
|
+
const path = args[0] === undefined ||
|
|
15
|
+
typeof args[0] === "string" ||
|
|
16
|
+
Array.isArray(args[0])
|
|
17
|
+
? args[0]
|
|
18
|
+
: null;
|
|
19
|
+
return [path !== null && path !== void 0 ? path : undefined, path === null ? args[0] : args[1]];
|
|
20
|
+
};
|
|
21
|
+
exports.split_route_arguments = split_route_arguments;
|
|
22
|
+
//# sourceMappingURL=split_route_arguments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split_route_arguments.js","sourceRoot":"","sources":["../../../src/decorators/internal/split_route_arguments.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;GAQG;AACI,MAAM,qBAAqB,GAAG,CACnC,IAAW,EACkD,EAAE;IAC/D,MAAM,IAAI,GACR,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS;QACrB,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ;QAC3B,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QACT,CAAC,CAAC,IAAI,CAAC;IACX,OAAO,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,SAAS,EAAE,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAChE,CAAC,CAAC;AAVW,QAAA,qBAAqB,GAArB,qBAAqB,CAUhC"}
|
|
@@ -3,15 +3,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.validate_request_body = void 0;
|
|
6
|
+
exports.resolve_request_body = exports.validate_request_body = void 0;
|
|
7
7
|
const common_1 = require("@nestjs/common");
|
|
8
8
|
const typia_1 = __importDefault(require("typia"));
|
|
9
9
|
const NoTransformConfigurationError_1 = require("../NoTransformConfigurationError");
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Builds the shared body checker while preserving successful callback values.
|
|
12
|
+
*
|
|
13
|
+
* The legacy callable returns an error or null; its resolver returns the same
|
|
14
|
+
* validation decision and the callback's successful data without validating
|
|
15
|
+
* twice. Private assert/is/validate adapters preserve each descriptor's error
|
|
16
|
+
* details. Resolver input is untrusted. The descriptor's existing input:T
|
|
17
|
+
* signature is retained for compatibility; adapters cast at invocation and rely
|
|
18
|
+
* on its validation result before exposing successful T data.
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
11
22
|
const validate_request_body = (method) => (validator) => {
|
|
12
23
|
if (!validator) {
|
|
13
24
|
(0, NoTransformConfigurationError_1.NoTransformConfigurationError)(method);
|
|
14
|
-
return () =>
|
|
25
|
+
return create((input) => ({
|
|
26
|
+
success: true,
|
|
27
|
+
data: input,
|
|
28
|
+
}));
|
|
15
29
|
}
|
|
16
30
|
else if (validator.type === "assert")
|
|
17
31
|
return assert(validator.assert);
|
|
@@ -19,46 +33,75 @@ const validate_request_body = (method) => (validator) => {
|
|
|
19
33
|
return is(validator.is);
|
|
20
34
|
else if (validator.type === "validate")
|
|
21
35
|
return validate(validator.validate);
|
|
22
|
-
return () =>
|
|
36
|
+
return create(() => ({
|
|
37
|
+
success: false,
|
|
38
|
+
error: new Error(`Error on nestia.core.${method}(): invalid typed validator.`),
|
|
39
|
+
}));
|
|
23
40
|
};
|
|
24
41
|
exports.validate_request_body = validate_request_body;
|
|
42
|
+
/**
|
|
43
|
+
* Resolves factory checkers or the existing error-only metadata protocol once.
|
|
44
|
+
*
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
const resolve_request_body = (checker, input) => {
|
|
48
|
+
if (checker.resolve)
|
|
49
|
+
return checker.resolve(input);
|
|
50
|
+
const error = checker(input);
|
|
51
|
+
return error === null
|
|
52
|
+
? { success: true, data: input }
|
|
53
|
+
: { success: false, error };
|
|
54
|
+
};
|
|
55
|
+
exports.resolve_request_body = resolve_request_body;
|
|
56
|
+
/** Installs both protocols on one newly created, session-independent checker. */
|
|
57
|
+
const create = (resolve) => Object.assign((input) => {
|
|
58
|
+
const result = resolve(input);
|
|
59
|
+
return result.success ? null : result.error;
|
|
60
|
+
}, { resolve });
|
|
25
61
|
/** @internal */
|
|
26
|
-
const assert = (closure) => (input) => {
|
|
62
|
+
const assert = (closure) => create((input) => {
|
|
27
63
|
try {
|
|
28
|
-
closure(input);
|
|
29
|
-
return null;
|
|
64
|
+
return { success: true, data: closure(input) };
|
|
30
65
|
}
|
|
31
66
|
catch (exp) {
|
|
32
67
|
if ((() => {
|
|
33
68
|
const _io0 = input => "string" === typeof input.name && "string" === typeof input.message && (undefined === input.stack || "string" === typeof input.stack) && true && "string" === typeof input.method && (undefined === input.path || "string" === typeof input.path) && "string" === typeof input.expected && true && (undefined === input.description || "string" === typeof input.description);
|
|
34
69
|
return input => "object" === typeof input && null !== input && _io0(input);
|
|
35
70
|
})()(exp)) {
|
|
36
|
-
return
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
71
|
+
return {
|
|
72
|
+
success: false,
|
|
73
|
+
error: new common_1.BadRequestException({
|
|
74
|
+
path: exp.path,
|
|
75
|
+
reason: exp.message,
|
|
76
|
+
expected: exp.expected,
|
|
77
|
+
value: exp.value,
|
|
78
|
+
message: MESSAGE,
|
|
79
|
+
}),
|
|
80
|
+
};
|
|
43
81
|
}
|
|
44
82
|
throw exp;
|
|
45
83
|
}
|
|
46
|
-
};
|
|
84
|
+
});
|
|
47
85
|
/** @internal */
|
|
48
|
-
const is = (closure) => (input) => {
|
|
86
|
+
const is = (closure) => create((input) => {
|
|
49
87
|
const success = closure(input);
|
|
50
|
-
return success
|
|
51
|
-
}
|
|
88
|
+
return success
|
|
89
|
+
? { success: true, data: input }
|
|
90
|
+
: { success: false, error: new common_1.BadRequestException(MESSAGE) };
|
|
91
|
+
});
|
|
52
92
|
/** @internal */
|
|
53
|
-
const validate = (closure) => (input) => {
|
|
93
|
+
const validate = (closure) => create((input) => {
|
|
54
94
|
const result = closure(input);
|
|
55
95
|
return result.success
|
|
56
|
-
?
|
|
57
|
-
:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
96
|
+
? { success: true, data: result.data }
|
|
97
|
+
: {
|
|
98
|
+
success: false,
|
|
99
|
+
error: new common_1.BadRequestException({
|
|
100
|
+
errors: result.errors,
|
|
101
|
+
message: MESSAGE,
|
|
102
|
+
}),
|
|
103
|
+
};
|
|
104
|
+
});
|
|
62
105
|
/** @internal */
|
|
63
106
|
const MESSAGE = "Request body data is not following the promised type.";
|
|
64
107
|
//# sourceMappingURL=validate_request_body.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate_request_body.js","sourceRoot":"","sources":["../../../src/decorators/internal/validate_request_body.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAqD;AACrD,kDAA2D;AAG3D,oFAAiF;
|
|
1
|
+
{"version":3,"file":"validate_request_body.js","sourceRoot":"","sources":["../../../src/decorators/internal/validate_request_body.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAqD;AACrD,kDAA2D;AAG3D,oFAAiF;AAGjF;;;;;;;;;;;GAWG;AACI,MAAM,qBAAqB,GAChC,CAAC,MAAc,EAAE,EAAE,CACnB,CACE,SAAoC,EACC,EAAE;IACvC,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,IAAA,6DAA6B,EAAC,MAAM,CAAC,CAAC;QACtC,OAAO,MAAM,CAAI,CAAC,KAAc,EAAE,EAAE,CAAC,CAAC;YACpC,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,KAAU;SACjB,CAAC,CAAC,CAAC;IACN,CAAC;SAAM,IAAI,SAAS,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;SACnE,IAAI,SAAS,CAAC,IAAI,KAAK,IAAI;QAAE,OAAO,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;SACrD,IAAI,SAAS,CAAC,IAAI,KAAK,UAAU;QAAE,OAAO,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC5E,OAAO,MAAM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AgB;AAChB,MAAM,OAAO,GAAG,uDAAuD,CAAC"}
|
|
@@ -7,11 +7,13 @@ exports.validate_request_form_data = void 0;
|
|
|
7
7
|
const common_1 = require("@nestjs/common");
|
|
8
8
|
const typia_1 = __importDefault(require("typia"));
|
|
9
9
|
const NoTransformConfigurationError_1 = require("../NoTransformConfigurationError");
|
|
10
|
+
const group_entries_1 = require("./group_entries");
|
|
10
11
|
/** @internal */
|
|
11
12
|
const validate_request_form_data = (props) => {
|
|
12
13
|
if (!props) {
|
|
13
14
|
(0, NoTransformConfigurationError_1.NoTransformConfigurationError)("TypedFormData.Body");
|
|
14
|
-
|
|
15
|
+
// no transform: the fields and files as they arrived
|
|
16
|
+
return (input) => (0, group_entries_1.group_entries)(input);
|
|
15
17
|
}
|
|
16
18
|
else if (props.validator.type === "assert")
|
|
17
19
|
return assert(props.validator.assert);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate_request_form_data.js","sourceRoot":"","sources":["../../../src/decorators/internal/validate_request_form_data.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAqD;AACrD,kDAA2D;AAG3D,oFAAiF;
|
|
1
|
+
{"version":3,"file":"validate_request_form_data.js","sourceRoot":"","sources":["../../../src/decorators/internal/validate_request_form_data.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAqD;AACrD,kDAA2D;AAG3D,oFAAiF;AACjF,mDAAgD;AAEhD,gBAAgB;AACT,MAAM,0BAA0B,GAAG,CACxC,KAAgC,EACE,EAAE;IACpC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,IAAA,6DAA6B,EAAC,oBAAoB,CAAC,CAAC;QACpD,qDAAqD;QACrD,OAAO,CAAC,KAAe,EAAE,EAAE,CAAC,IAAA,6BAAa,EAAC,KAAK,CAAM,CAAC;IACxD,CAAC;SAAM,IAAI,KAAK,CAAC,SAAS,CAAC,IAAI,KAAK,QAAQ;QAC1C,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CA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A4C,EAAE,EAAE,CACpD,CAAC,KAAe,EAA2B,EAAE;IAC3C,MAAM,MAAM,GAAmB,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9C,OAAO,MAAM,CAAC,OAAO;QACnB,CAAC,CAAC,MAAM,CAAC,IAAI;QACb,CAAC,CAAC,IAAI,4BAAmB,CAAC;YACtB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,OAAO,EAAE,OAAO;SACjB,CAAC,CAAC;AACT,CAAC,CAAC;AAEJ,gBAAgB;AAChB,MAAM,OAAO,GAAG,4DAA4D,CAAC"}
|
|
@@ -11,7 +11,8 @@ const NoTransformConfigurationError_1 = require("../NoTransformConfigurationErro
|
|
|
11
11
|
const validate_request_headers = (validator) => {
|
|
12
12
|
if (!validator) {
|
|
13
13
|
(0, NoTransformConfigurationError_1.NoTransformConfigurationError)("TypedHeaders");
|
|
14
|
-
|
|
14
|
+
// no transform: the headers as they arrived
|
|
15
|
+
return (input) => input;
|
|
15
16
|
}
|
|
16
17
|
else if (validator.type === "assert")
|
|
17
18
|
return assert(validator.assert);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate_request_headers.js","sourceRoot":"","sources":["../../../src/decorators/internal/validate_request_headers.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAqD;AACrD,kDAA2D;AAG3D,oFAAiF;AAEjF,gBAAgB;AACT,MAAM,wBAAwB,GAAG,CACtC,SAAuC,EACgC,EAAE;IACzE,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,IAAA,6DAA6B,EAAC,cAAc,CAAC,CAAC;QAC9C,OAAO,CAAC,KAAoD,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"validate_request_headers.js","sourceRoot":"","sources":["../../../src/decorators/internal/validate_request_headers.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAqD;AACrD,kDAA2D;AAG3D,oFAAiF;AAEjF,gBAAgB;AACT,MAAM,wBAAwB,GAAG,CACtC,SAAuC,EACgC,EAAE;IAC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CAAC,KAAK,CAAC,CAAC;IACxC,OAAO,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,4BAAmB,CAAC,OAAO,CAAC,CAAC;AACrE,CAAC,CAAC;AAEJ,gBAAgB;AAChB,MAAM,QAAQ,GACZ,CACE,OAEmB,EACnB,EAAE,CACJ,CACE,KAAoD,EAC3B,EAAE;IAC3B,MAAM,MAAM,GAAmB,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9C,OAAO,MAAM,CAAC,OAAO;QACnB,CAAC,CAAC,MAAM,CAAC,IAAI;QACb,CAAC,CAAC,IAAI,4BAAmB,CAAC;YACtB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,OAAO,EAAE,OAAO;SACjB,CAAC,CAAC;AACT,CAAC,CAAC;AAEJ,gBAAgB;AAChB,MAAM,OAAO,GAAG,0DAA0D,CAAC"}
|
|
@@ -7,11 +7,13 @@ exports.validate_request_query = void 0;
|
|
|
7
7
|
const common_1 = require("@nestjs/common");
|
|
8
8
|
const typia_1 = __importDefault(require("typia"));
|
|
9
9
|
const NoTransformConfigurationError_1 = require("../NoTransformConfigurationError");
|
|
10
|
+
const group_entries_1 = require("./group_entries");
|
|
10
11
|
/** @internal */
|
|
11
12
|
const validate_request_query = (method) => (validator) => {
|
|
12
13
|
if (!validator) {
|
|
13
14
|
(0, NoTransformConfigurationError_1.NoTransformConfigurationError)(method);
|
|
14
|
-
|
|
15
|
+
// no transform: the query as it arrived, repeated keys as arrays
|
|
16
|
+
return (input) => (0, group_entries_1.group_entries)(input);
|
|
15
17
|
}
|
|
16
18
|
else if (validator.type === "assert")
|
|
17
19
|
return assert(validator.assert);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate_request_query.js","sourceRoot":"","sources":["../../../src/decorators/internal/validate_request_query.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAqD;AACrD,kDAA2D;AAG3D,oFAAiF;
|
|
1
|
+
{"version":3,"file":"validate_request_query.js","sourceRoot":"","sources":["../../../src/decorators/internal/validate_request_query.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAqD;AACrD,kDAA2D;AAG3D,oFAAiF;AACjF,mDAAgD;AAEhD,gBAAgB;AACT,MAAM,sBAAsB,GACjC,CAAC,MAAc,EAAE,EAAE,CACnB,CAAI,SAAqC,EAAE,EAAE;IAC3C,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,IAAA,6DAA6B,EAAC,MAAM,CAAC,CAAC;QACtC,iEAAiE;QACjE,OAAO,CAAC,KAAsB,EAAE,EAAE,CAAC,IAAA,6BAAa,EAAC,KAAK,CAAM,CAAC;IAC/D,CAAC;SAAM,IAAI,SAAS,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;SACnE,IAAI,SAAS,CAAC,IAAI,KAAK,IAAI;QAAE,OAAO,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;SACrD,IAAI,SAAS,CAAC,IAAI,KAAK,UAAU;QAAE,OAAO,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC5E,OAAO,GAAG,EAAE,CACV,IAAI,KAAK,CAAC,wBAAwB,MAAM,8BAA8B,CAAC,CAAC;AAC5E,CAAC,CAAC;AAZS,QAAA,sBAAsB,GAAtB,sBAAsB,CAY/B;AAEJ,gBAAgB;AAChB,MAAM,MAAM,GACV,CAAI,OAAsC,EAAE,EAAE,CAC9C,CAAC,KAAsB,EAA2B,EAAE;IAClD,IAAI,CAAC;QACH,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb;;;aAA6B,GAAG,GAAG,CAAC;YAClC,OAAO,IAAI,4BAAmB,CAAC;gBAC7B,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,MAAM,EAAE,GAAG,CAAC,OAAO;gBACnB,QAAQ,EAAE,GAAG,CAAC,Q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AAC,MAAM,CAAC,IAAI;QACb,CAAC,CAAC,IAAI,4BAAmB,CAAC;YACtB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,OAAO,EAAE,OAAO;SACjB,CAAC,CAAC;AACT,CAAC,CAAC;AAEJ,gBAAgB;AAChB,MAAM,OAAO,GAAG,wDAAwD,CAAC;AAEzE,MAAM,yBAAyB,GAAG,CAAC,GAAY,EAAgB,EAAE,CAC/D,GAAG,YAAY,KAAK,IAAI,uBAAuB,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -1,16 +1,87 @@
|
|
|
1
1
|
import { IValidation } from "typia";
|
|
2
2
|
export type IRequestBodyValidator<T> = IRequestBodyValidator.IAssert<T> | IRequestBodyValidator.IIs<T> | IRequestBodyValidator.IValidate<T>;
|
|
3
|
+
/**
|
|
4
|
+
* The request body validator that the transform passes to `TypedBody`,
|
|
5
|
+
* `EncryptedBody`, `PlainBody`, `WebSocketRoute.Header`, and
|
|
6
|
+
* `McpRoute.Params`.
|
|
7
|
+
*
|
|
8
|
+
* The literal `type` field selects which typia function generated the
|
|
9
|
+
* validator: `assert`, `is`, or `validate`. `validate_request_body` turns a
|
|
10
|
+
* failure of any variant into a 400 response. Assert and validate success
|
|
11
|
+
* supply their returned data to the decorated argument; is success keeps the
|
|
12
|
+
* input.
|
|
13
|
+
*
|
|
14
|
+
* @evidence contracts/common.md#principled-implementation The union is discriminated by the literal `type`, so the runtime selects the assert, is, or validate path with one comparison and the compiler checks that each variant carries the function its tag names.
|
|
15
|
+
* @evidence contracts/common.md#clear-and-simple-design Three variants, one per typia function family, with no shared base because each function has a different shape.
|
|
16
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior; the runtime rejects an unknown `type` with an error instead of accepting it.
|
|
17
|
+
* @evidence contracts/common.md#meaningful-documentation The comment names the decorators that receive the validator, the meaning of the discriminant, and the response a failure becomes.
|
|
18
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation The union and callback members describe validation of parsed body values without native platform resources.
|
|
19
|
+
*/
|
|
3
20
|
export declare namespace IRequestBodyValidator {
|
|
21
|
+
/**
|
|
22
|
+
* Validator generated from `typia.assert`.
|
|
23
|
+
*
|
|
24
|
+
* @evidence contracts/common.md#principled-implementation The variant tags a function returning validated data, which may be a clone, or throwing TypeGuardError. The shared runner retains successful data and converts the guard error to BadRequestException carrying the first failure's path, reason, expected type and value.
|
|
25
|
+
* @evidence contracts/common.md#clear-and-simple-design A two-member record, the tag and the function.
|
|
26
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
|
|
27
|
+
* @evidence contracts/common.md#meaningful-documentation The comment names the typia function the variant comes from; the failure response is stated on the union.
|
|
28
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation The union and callback members describe validation of parsed body values without native platform resources.
|
|
29
|
+
*/
|
|
4
30
|
interface IAssert<T> {
|
|
5
31
|
type: "assert";
|
|
32
|
+
/**
|
|
33
|
+
* The typia assertion function generated for the requested type.
|
|
34
|
+
*
|
|
35
|
+
* @evidence contracts/common.md#principled-implementation The generated assertion returns the validated value, including a separate clone for clone modes, or throws TypeGuardError. Successful data becomes the decorated argument without requiring identity with the parsed input.
|
|
36
|
+
* @evidence contracts/common.md#clear-and-simple-design One function member with the input the decorator has.
|
|
37
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The function is generated from the type, and the runtime never edits its result.
|
|
38
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states that the function is generated for the requested type; its input is in the signature.
|
|
39
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation The union and callback members describe validation of parsed body values without native platform resources.
|
|
40
|
+
*/
|
|
6
41
|
assert: (input: T) => T;
|
|
7
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Validator generated from `typia.is`.
|
|
45
|
+
*
|
|
46
|
+
* @evidence contracts/common.md#principled-implementation The variant tags a function of the parsed value that returns a boolean, because the value is already parsed and is returned as it is; a failing result becomes a `BadRequestException` with only the fixed message, because `typia.is` records no failure detail.
|
|
47
|
+
* @evidence contracts/common.md#clear-and-simple-design A two-member record, the tag and the function.
|
|
48
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
|
|
49
|
+
* @evidence contracts/common.md#meaningful-documentation The comment names the typia function the variant comes from.
|
|
50
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation The union and callback members describe validation of parsed body values without native platform resources.
|
|
51
|
+
*/
|
|
8
52
|
interface IIs<T> {
|
|
9
53
|
type: "is";
|
|
54
|
+
/**
|
|
55
|
+
* The typia check function generated for the requested type.
|
|
56
|
+
*
|
|
57
|
+
* @evidence contracts/common.md#principled-implementation The transform generates the function for the type argument of the decorator, taking the parsed value and returning a boolean, because the value is already parsed and is returned as it is.
|
|
58
|
+
* @evidence contracts/common.md#clear-and-simple-design One function member with the input the decorator has.
|
|
59
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The function is generated from the type, and the runtime never edits its result.
|
|
60
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states that the function is generated for the requested type; its result is in the signature.
|
|
61
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation The union and callback members describe validation of parsed body values without native platform resources.
|
|
62
|
+
*/
|
|
10
63
|
is: (input: T) => boolean;
|
|
11
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Validator generated from `typia.validate`.
|
|
67
|
+
*
|
|
68
|
+
* @evidence contracts/common.md#principled-implementation The callback returns IValidation; successful result.data becomes the decorated argument, including a clone, while failure becomes BadRequestException carrying every validation error.
|
|
69
|
+
* @evidence contracts/common.md#clear-and-simple-design A two-member record, the tag and the function.
|
|
70
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
|
|
71
|
+
* @evidence contracts/common.md#meaningful-documentation The comment names the typia function the variant comes from.
|
|
72
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation The union and callback members describe validation of parsed body values without native platform resources.
|
|
73
|
+
*/
|
|
12
74
|
interface IValidate<T> {
|
|
13
75
|
type: "validate";
|
|
76
|
+
/**
|
|
77
|
+
* The typia validation function generated for the requested type.
|
|
78
|
+
*
|
|
79
|
+
* @evidence contracts/common.md#principled-implementation The transform generates the function for the type argument of the decorator, taking the parsed value and returning the validation result with every error.
|
|
80
|
+
* @evidence contracts/common.md#clear-and-simple-design One function member with the input the decorator has.
|
|
81
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The function is generated from the type, and the runtime never edits its result.
|
|
82
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states that the function is generated for the requested type; its result is in the signature.
|
|
83
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation The union and callback members describe validation of parsed body values without native platform resources.
|
|
84
|
+
*/
|
|
14
85
|
validate: (input: T) => IValidation<T>;
|
|
15
86
|
}
|
|
16
87
|
}
|
|
@@ -3,19 +3,99 @@ export interface IRequestFormDataProps<T> {
|
|
|
3
3
|
files: Array<IRequestFormDataProps.IFile>;
|
|
4
4
|
validator: IRequestFormDataProps.IAssert<T> | IRequestFormDataProps.IIs<T> | IRequestFormDataProps.IValidate<T>;
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Properties that the transform passes to `TypedFormData.Body`: the file fields
|
|
8
|
+
* and the validator.
|
|
9
|
+
*
|
|
10
|
+
* `files` names the file fields of the type with their limits, and `validator`
|
|
11
|
+
* validates the `FormData` made from the fields and the uploaded files.
|
|
12
|
+
*
|
|
13
|
+
* @evidence contracts/common.md#principled-implementation The record carries what the multipart handling needs: which fields are files, with how many each may hold, and how to validate the assembled form.
|
|
14
|
+
* @evidence contracts/common.md#clear-and-simple-design A two-member record whose nested types describe the variants and the file entries.
|
|
15
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
|
|
16
|
+
* @evidence contracts/common.md#meaningful-documentation The comment names the two members and the decorator that receives them.
|
|
17
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation FormData validators and file-field names describe multipart protocol data; no member is a native storage path or handle.
|
|
18
|
+
*/
|
|
6
19
|
export declare namespace IRequestFormDataProps {
|
|
20
|
+
/**
|
|
21
|
+
* Validator generated from `typia.assert`.
|
|
22
|
+
*
|
|
23
|
+
* @evidence contracts/common.md#principled-implementation The variant tags a function of `FormData` that returns the decoded object or throws the `TypeGuardError` of typia, which becomes a `BadRequestException` with the path, reason, expected type, and value.
|
|
24
|
+
* @evidence contracts/common.md#clear-and-simple-design A two-member record, the tag and the function.
|
|
25
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
|
|
26
|
+
* @evidence contracts/common.md#meaningful-documentation The comment names the typia function the variant comes from.
|
|
27
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation FormData validators and file-field names describe multipart protocol data; no member is a native storage path or handle.
|
|
28
|
+
*/
|
|
7
29
|
interface IAssert<T> {
|
|
8
30
|
type: "assert";
|
|
31
|
+
/**
|
|
32
|
+
* The typia assertion function generated for the requested type.
|
|
33
|
+
*
|
|
34
|
+
* @evidence contracts/common.md#principled-implementation The transform generates the function for the type argument, taking the form and returning the decoded object or throwing.
|
|
35
|
+
* @evidence contracts/common.md#clear-and-simple-design One function member.
|
|
36
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The function is generated from the type, and the runtime never edits its result.
|
|
37
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states that the function is generated for the requested type.
|
|
38
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation FormData validators and file-field names describe multipart protocol data; no member is a native storage path or handle.
|
|
39
|
+
*/
|
|
9
40
|
assert: (input: FormData) => T;
|
|
10
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Validator generated from `typia.is`.
|
|
44
|
+
*
|
|
45
|
+
* @evidence contracts/common.md#principled-implementation The variant tags a function of `FormData` that returns the decoded object or `null`; `null` becomes a `BadRequestException` with only the fixed message.
|
|
46
|
+
* @evidence contracts/common.md#clear-and-simple-design A two-member record, the tag and the function.
|
|
47
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
|
|
48
|
+
* @evidence contracts/common.md#meaningful-documentation The comment names the typia function the variant comes from.
|
|
49
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation FormData validators and file-field names describe multipart protocol data; no member is a native storage path or handle.
|
|
50
|
+
*/
|
|
11
51
|
interface IIs<T> {
|
|
12
52
|
type: "is";
|
|
53
|
+
/**
|
|
54
|
+
* The typia check function generated for the requested type.
|
|
55
|
+
*
|
|
56
|
+
* @evidence contracts/common.md#principled-implementation The transform generates the function for the type argument, taking the form and returning the decoded object or `null`.
|
|
57
|
+
* @evidence contracts/common.md#clear-and-simple-design One function member.
|
|
58
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The function is generated from the type, and the runtime never edits its result.
|
|
59
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states that the function is generated for the requested type.
|
|
60
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation FormData validators and file-field names describe multipart protocol data; no member is a native storage path or handle.
|
|
61
|
+
*/
|
|
13
62
|
is: (input: FormData) => T | null;
|
|
14
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Validator generated from `typia.validate`.
|
|
66
|
+
*
|
|
67
|
+
* @evidence contracts/common.md#principled-implementation The variant tags a function of `FormData` that returns the `IValidation` of typia; a failure becomes a `BadRequestException` carrying every error.
|
|
68
|
+
* @evidence contracts/common.md#clear-and-simple-design A two-member record, the tag and the function.
|
|
69
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
|
|
70
|
+
* @evidence contracts/common.md#meaningful-documentation The comment names the typia function the variant comes from.
|
|
71
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation FormData validators and file-field names describe multipart protocol data; no member is a native storage path or handle.
|
|
72
|
+
*/
|
|
15
73
|
interface IValidate<T> {
|
|
16
74
|
type: "validate";
|
|
75
|
+
/**
|
|
76
|
+
* The typia validation function generated for the requested type.
|
|
77
|
+
*
|
|
78
|
+
* @evidence contracts/common.md#principled-implementation The transform generates the function for the type argument, taking the form and returning the validation result.
|
|
79
|
+
* @evidence contracts/common.md#clear-and-simple-design One function member.
|
|
80
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The function is generated from the type, and the runtime never edits its result.
|
|
81
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states that the function is generated for the requested type.
|
|
82
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation FormData validators and file-field names describe multipart protocol data; no member is a native storage path or handle.
|
|
83
|
+
*/
|
|
17
84
|
validate: (input: FormData) => IValidation<T>;
|
|
18
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* A file field of a multipart form: its name and the number of files it may
|
|
88
|
+
* hold, or `null` for no limit.
|
|
89
|
+
*
|
|
90
|
+
* A limit of 1 makes the multer field accept one file; any other value leaves
|
|
91
|
+
* the field unlimited.
|
|
92
|
+
*
|
|
93
|
+
* @evidence contracts/common.md#principled-implementation A limit of 1 makes the multer field accept one file and any other value leaves the field unlimited, which is how the runtime configures `multer.fields`.
|
|
94
|
+
* @evidence contracts/common.md#clear-and-simple-design A two-field record with no behavior.
|
|
95
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The values come from the type through the transform, not from a fixture.
|
|
96
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the meaning of the name and of the limit.
|
|
97
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation FormData validators and file-field names describe multipart protocol data; no member is a native storage path or handle.
|
|
98
|
+
*/
|
|
19
99
|
interface IFile {
|
|
20
100
|
name: string;
|
|
21
101
|
limit: number | null;
|