@nestia/core 14.0.1 → 14.0.3
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/lib/adaptors/McpAdaptor.d.ts +24 -3
- package/lib/adaptors/McpAdaptor.js +72 -34
- package/lib/adaptors/McpAdaptor.js.map +1 -1
- package/lib/adaptors/WebSocketAdaptor.d.ts +37 -0
- package/lib/adaptors/WebSocketAdaptor.js +60 -16
- package/lib/adaptors/WebSocketAdaptor.js.map +1 -1
- package/lib/adaptors/internal/external_context.js +18 -5
- package/lib/adaptors/internal/external_context.js.map +1 -1
- package/lib/decorators/DynamicModule.d.ts +13 -1
- 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 +37 -14
- package/lib/decorators/EncryptedBody.js.map +1 -1
- package/lib/decorators/EncryptedController.d.ts +6 -1
- package/lib/decorators/EncryptedController.js +6 -1
- package/lib/decorators/EncryptedController.js.map +1 -1
- package/lib/decorators/EncryptedModule.d.ts +18 -3
- package/lib/decorators/EncryptedModule.js +18 -3
- package/lib/decorators/EncryptedModule.js.map +1 -1
- package/lib/decorators/EncryptedRoute.d.ts +20 -11
- package/lib/decorators/EncryptedRoute.js +20 -11
- 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 +9 -2
- package/lib/decorators/TypedBody.js +19 -9
- package/lib/decorators/TypedBody.js.map +1 -1
- package/lib/decorators/TypedException.d.ts +10 -0
- package/lib/decorators/TypedFormData.d.ts +59 -1
- package/lib/decorators/TypedFormData.js +5 -0
- 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 +9 -0
- package/lib/decorators/TypedParam.js +9 -0
- package/lib/decorators/TypedParam.js.map +1 -1
- package/lib/decorators/TypedQuery.d.ts +16 -0
- package/lib/decorators/TypedQuery.js +16 -0
- 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/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_path_and_querify.js +3 -7
- 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/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/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 +120 -0
- 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 +40 -0
- package/lib/utils/ExceptionManager.js +34 -0
- package/lib/utils/ExceptionManager.js.map +1 -1
- package/lib/utils/SourceFinder.d.ts +22 -0
- package/lib/utils/SourceFinder.js +34 -7
- package/lib/utils/SourceFinder.js.map +1 -1
- package/lib/utils/VersioningStrategy.d.ts +37 -2
- package/lib/utils/VersioningStrategy.js +30 -9
- 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 +19 -1
- 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 +37 -3
- package/native/transform/core_transform.go +105 -98
- package/native/transform/core_websocket.go +21 -5
- package/native/transform/node_transform.go +11 -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 +21 -0
- package/package.json +9 -7
- package/src/adaptors/McpAdaptor.ts +86 -26
- package/src/adaptors/WebSocketAdaptor.ts +70 -15
- package/src/adaptors/internal/external_context.ts +43 -6
- package/src/decorators/DynamicModule.ts +13 -1
- package/src/decorators/EncryptedBody.ts +37 -13
- package/src/decorators/EncryptedController.ts +6 -1
- package/src/decorators/EncryptedModule.ts +18 -3
- package/src/decorators/EncryptedRoute.ts +21 -12
- 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 +17 -8
- package/src/decorators/TypedException.ts +10 -0
- package/src/decorators/TypedFormData.ts +60 -2
- package/src/decorators/TypedHeaders.ts +5 -0
- package/src/decorators/TypedParam.ts +9 -0
- package/src/decorators/TypedQuery.ts +17 -1
- package/src/decorators/TypedRoute.ts +26 -11
- package/src/decorators/WebSocketRoute.ts +18 -1
- package/src/decorators/doNotThrowTransformError.ts +14 -0
- 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_path_and_querify.ts +3 -9
- package/src/decorators/internal/get_path_and_stringify.ts +3 -9
- 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/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 +120 -0
- 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 +40 -0
- package/src/utils/SourceFinder.ts +38 -7
- package/src/utils/VersioningStrategy.ts +47 -14
|
@@ -17,6 +17,16 @@ function McpRoute(input) {
|
|
|
17
17
|
return descriptor;
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Types and parameter decorator of {@link McpRoute}: the tool configuration and
|
|
22
|
+
* `McpRoute.Params`.
|
|
23
|
+
*
|
|
24
|
+
* @evidence contracts/common.md#principled-implementation Tool metadata retains its definition and default empty-object schema. Params records its argument position and shared checker; successful assert/validate data becomes the tool argument, while errors retain InvalidParams mapping and legacy error-only callbacks retain raw input. The adaptor reads the same metadata field names when registering tools.
|
|
25
|
+
* @evidence contracts/common.md#clear-and-simple-design Two decorators and one config type in one namespace, sharing one `emplace` helper for parameter metadata.
|
|
26
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It uses the reflect metadata API and no NestJS internals; the input schema is filled by the generator, not hardcoded here.
|
|
27
|
+
* @evidence contracts/common.md#meaningful-documentation The comment documents the two call forms, the configuration fields, and the parameter decorator.
|
|
28
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation Tool schemas and parameter metadata are protocol data held on controller methods, without native filesystem access.
|
|
29
|
+
*/
|
|
20
30
|
(function (McpRoute) {
|
|
21
31
|
/**
|
|
22
32
|
* Parameter decorator for an MCP tool's input arguments.
|
|
@@ -25,7 +35,8 @@ function McpRoute(input) {
|
|
|
25
35
|
* `tools/call` request against the TypeScript type `T` using typia. A failed
|
|
26
36
|
* validation surfaces to the client as a JSON-RPC `-32602` (`InvalidParams`)
|
|
27
37
|
* error with structured diagnostics, giving the LLM precise feedback to
|
|
28
|
-
* self-correct.
|
|
38
|
+
* self-correct. Successful assert and validate data becomes the tool
|
|
39
|
+
* argument, so clone validators can supply a copy of the incoming arguments.
|
|
29
40
|
*
|
|
30
41
|
* MCP tools accept exactly one arguments object; applying this decorator more
|
|
31
42
|
* than once on a single method is a compile-time error. The decorated type
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpRoute.js","sourceRoot":"","sources":["../../src/decorators/McpRoute.ts"],"names":[],"mappings":";;;AAEA,4EAAyE;
|
|
1
|
+
{"version":3,"file":"McpRoute.js","sourceRoot":"","sources":["../../src/decorators/McpRoute.ts"],"names":[],"mappings":";;;AAEA,4EAAyE;AAuDzE,kBAAyB,KAAgC;IACvD,MAAM,MAAM,GACV,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;IACtD,OAAO,SAAS,QAAQ,CACtB,OAAe,EACf,YAA6B,EAC7B,UAAwC;;QAExC,OAAO,CAAC,cAAc,CACpB,iBAAiB,EACjB;YACE,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,WAAW,QAAE,MAAM,CAAC,WAAW,mCAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE;YACrE,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,WAAW,EAAE,MAAM,CAAC,WAAW;SACL,EAC5B,UAAU,CAAC,KAAK,CACjB,CAAC;QACF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,WAAiB,QAAQ;IAmBvB;;;;;;;;;;;;;;;;;OAiBG;IACH,SAAgB,MAAM,CACpB,SAAoC;QAEpC,MAAM,QAAQ,GAAG,IAAA,6CAAqB,EAAC,iBAAiB,CAAC,CAAC,SAAS,CAAC,CAAC;QACrE,OAAO,SAAS,cAAc,CAC5B,MAAc,EACd,WAAwC,EACxC,cAAsB;YAEtB,OAAO,CAAC,MAAM,EAAE,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,EAAE,EAAE;gBACjC,QAAQ,EAAE,QAAQ;gBAClB,KAAK,EAAE,cAAc;gBACrB,QAAQ;aACT,CAAC,CAAC;QACL,CAAC,CAAC;IACJ,CAAC;IAfe,SAAA,MAAM,SAerB,CAAA;IAED,gBAAgB;IAChB,MAAM,OAAO,GAAG,CACd,MAAc,EACd,WAA4B,EAC5B,KAAiC,EACjC,EAAE;QACF,MAAM,KAAK,GACT,OAAO,CAAC,cAAc,CAAC,4BAA4B,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QAC5E,IAAI,KAAK,KAAK,SAAS;YAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;;YAEzC,OAAO,CAAC,cAAc,CACpB,4BAA4B,EAC5B,CAAC,KAAK,CAAC,EACP,MAAM,EACN,WAAW,CACZ,CAAC;IACN,CAAC,CAAC;AACJ,CAAC,EAvEgB,QAAQ,aAlCT,QAAQ,GAkCP,QAAQ,QAuExB"}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Plain body decorator.
|
|
3
3
|
*
|
|
4
4
|
* `PlainBody` is a decorator function getting full body text from the HTTP
|
|
5
|
-
* request.
|
|
5
|
+
* request. The transformed assertion's successful string is the decorated
|
|
6
|
+
* argument.
|
|
6
7
|
*
|
|
7
8
|
* If you adjust the regular {@link Body} decorator function to the body
|
|
8
9
|
* parameter, you can't get the full body text because the {@link Body} tries to
|
|
@@ -19,5 +20,10 @@
|
|
|
19
20
|
*
|
|
20
21
|
* @author Jeongho Nam - https://github.com/samchon
|
|
21
22
|
* @returns Parameter decorator
|
|
23
|
+
* @evidence contracts/common.md#principled-implementation The decorator reads text only for text/plain requests; an installed assertion resolves the argument value through the shared body checker, while no assertion retains raw text. Absent input is accepted when its assertion accepts undefined and otherwise continues through the media-type error path.
|
|
24
|
+
* @evidence contracts/common.md#clear-and-simple-design One parameter decorator shares body absence, media recognition, text reading and successful-value resolution with the other request decorators.
|
|
25
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Text comes from the request parser or shared raw-body reader, not a fabricated value; no runtime controller or body identity is special-cased.
|
|
26
|
+
* @evidence contracts/common.md#meaningful-documentation The comment distinguishes full body text from JSON parsing and states that the transformed assertion supplies the argument.
|
|
27
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation HTTP text bodies and decoded string values carry no native filesystem or subprocess boundary.
|
|
22
28
|
*/
|
|
23
29
|
export declare function PlainBody(): ParameterDecorator;
|
|
@@ -15,7 +15,10 @@ const get_text_body_1 = require("./internal/get_text_body");
|
|
|
15
15
|
const is_media_type_1 = require("./internal/is_media_type");
|
|
16
16
|
const is_request_body_undefined_1 = require("./internal/is_request_body_undefined");
|
|
17
17
|
const validate_request_body_1 = require("./internal/validate_request_body");
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Registers the transformed text assertion and binds its successful value. The
|
|
20
|
+
* public overload accepts no runtime assertion; the transform supplies it.
|
|
21
|
+
*/
|
|
19
22
|
function PlainBody(assert) {
|
|
20
23
|
const checker = assert
|
|
21
24
|
? (0, validate_request_body_1.validate_request_body)("PlainBody")({
|
|
@@ -28,16 +31,21 @@ function PlainBody(assert) {
|
|
|
28
31
|
const request = context
|
|
29
32
|
.switchToHttp()
|
|
30
33
|
.getRequest();
|
|
31
|
-
if ((0, is_request_body_undefined_1.is_request_body_undefined)(request)
|
|
32
|
-
(checker
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
if ((0, is_request_body_undefined_1.is_request_body_undefined)(request)) {
|
|
35
|
+
if (checker === null)
|
|
36
|
+
return undefined;
|
|
37
|
+
const result = checker.resolve(undefined);
|
|
38
|
+
if (result.success)
|
|
39
|
+
return result.data;
|
|
40
|
+
}
|
|
41
|
+
if (!(0, is_media_type_1.is_media_type)(request.headers["content-type"], "text/plain"))
|
|
35
42
|
throw new common_1.BadRequestException(`Request body type is not "text/plain".`);
|
|
36
43
|
const value = yield (0, get_text_body_1.get_text_body)(request);
|
|
37
44
|
if (checker) {
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
40
|
-
throw error;
|
|
45
|
+
const result = checker.resolve(value);
|
|
46
|
+
if (!result.success)
|
|
47
|
+
throw result.error;
|
|
48
|
+
return result.data;
|
|
41
49
|
}
|
|
42
50
|
return value;
|
|
43
51
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlainBody.js","sourceRoot":"","sources":["../../src/decorators/PlainBody.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAIwB;AAIxB,4DAAyD;AACzD,4DAAyD;AACzD,oFAAiF;AACjF,4EAAyE;
|
|
1
|
+
{"version":3,"file":"PlainBody.js","sourceRoot":"","sources":["../../src/decorators/PlainBody.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAIwB;AAIxB,4DAAyD;AACzD,4DAAyD;AACzD,oFAAiF;AACjF,4EAAyE;AAgCzE;;;GAGG;AACH,mBACE,MAAmC;IAEnC,MAAM,OAAO,GAAG,MAAM;QACpB,CAAC,CAAC,IAAA,6CAAqB,EAAC,WAAW,CAAC,CAAC;YACjC,IAAI,EAAE,QAAQ;YACd,MAAM;SACP,CAAC;QACJ,CAAC,CAAC,IAAI,CAAC;IACT,OAAO,IAAA,6BAAoB,EAAC,SAAe,SAAS,CAClD,KAAU,EACV,OAAyB;;YAEzB,MAAM,OAAO,GAAqC,OAAO;iBACtD,YAAY,EAAE;iBACd,UAAU,EAAE,CAAC;YAChB,IAAI,IAAA,qDAAyB,EAAC,OAAO,CAAC,EAAE,CAAC;gBACvC,IAAI,OAAO,KAAK,IAAI;oBAAE,OAAO,SAAS,CAAC;gBACvC,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;gBAC1C,IAAI,MAAM,CAAC,OAAO;oBAAE,OAAO,MAAM,CAAC,IAAI,CAAC;YACzC,CAAC;YACD,IAAI,CAAC,IAAA,6BAAa,EAAC,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,YAAY,CAAC;gBAC/D,MAAM,IAAI,4BAAmB,CAAC,wCAAwC,CAAC,CAAC;YAC1E,MAAM,KAAK,GAAW,MAAM,IAAA,6BAAa,EAAC,OAAO,CAAC,CAAC;YACnD,IAAI,OAAO,EAAE,CAAC;gBACZ,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;gBACtC,IAAI,CAAC,MAAM,CAAC,OAAO;oBAAE,MAAM,MAAM,CAAC,KAAK,CAAC;gBACxC,OAAO,MAAM,CAAC,IAAI,CAAC;YACrB,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;KAAA,CAAC,EAAE,CAAC;AACP,CAAC"}
|
|
@@ -12,8 +12,23 @@ import { OpenApi } from "@typia/interface";
|
|
|
12
12
|
* @author Jeongho Nam - https://github.com/samchon
|
|
13
13
|
* @param closure Callback function which can customize the swagger data
|
|
14
14
|
* @returns Method decorator
|
|
15
|
+
* @evidence contracts/common.md#principled-implementation Each use appends the closure to an array of metadata owned by the method, created on first use, so several customizers on one method run in order.
|
|
16
|
+
* @evidence contracts/common.md#clear-and-simple-design One decorator function with one metadata list per method.
|
|
17
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It uses the reflect metadata API; the closure is the caller's.
|
|
18
|
+
* @evidence contracts/common.md#meaningful-documentation The comment documents that the closure receives the document, the operation, and lookup helpers.
|
|
19
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation The callback and endpoint accessors edit an OpenAPI document; their path fields are HTTP routes rather than native file identities.
|
|
15
20
|
*/
|
|
16
21
|
export declare function SwaggerCustomizer(closure: (props: SwaggerCustomizer.IProps) => unknown): MethodDecorator;
|
|
22
|
+
/**
|
|
23
|
+
* Types of {@link SwaggerCustomizer}: the properties the closure receives and
|
|
24
|
+
* the endpoint accessors.
|
|
25
|
+
*
|
|
26
|
+
* @evidence contracts/common.md#principled-implementation The types describe the document, the current operation, and lookups by function or by path and method, which is what a customization needs to edit the generated document.
|
|
27
|
+
* @evidence contracts/common.md#clear-and-simple-design Three types with no runtime members.
|
|
28
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It contains types only.
|
|
29
|
+
* @evidence contracts/common.md#meaningful-documentation Each type and member documents its meaning.
|
|
30
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation The callback and endpoint accessors edit an OpenAPI document; their path fields are HTTP routes rather than native file identities.
|
|
31
|
+
*/
|
|
17
32
|
export declare namespace SwaggerCustomizer {
|
|
18
33
|
/**
|
|
19
34
|
* Properties for the `SwaggerCustomizer` decorator.
|
|
@@ -14,6 +14,11 @@ exports.SwaggerCustomizer = SwaggerCustomizer;
|
|
|
14
14
|
* @author Jeongho Nam - https://github.com/samchon
|
|
15
15
|
* @param closure Callback function which can customize the swagger data
|
|
16
16
|
* @returns Method decorator
|
|
17
|
+
* @evidence contracts/common.md#principled-implementation Each use appends the closure to an array of metadata owned by the method, created on first use, so several customizers on one method run in order.
|
|
18
|
+
* @evidence contracts/common.md#clear-and-simple-design One decorator function with one metadata list per method.
|
|
19
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It uses the reflect metadata API; the closure is the caller's.
|
|
20
|
+
* @evidence contracts/common.md#meaningful-documentation The comment documents that the closure receives the document, the operation, and lookup helpers.
|
|
21
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation The callback and endpoint accessors edit an OpenAPI document; their path fields are HTTP routes rather than native file identities.
|
|
17
22
|
*/
|
|
18
23
|
function SwaggerCustomizer(closure) {
|
|
19
24
|
return function SwaggerCustomizer(target, propertyKey, descriptor) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwaggerCustomizer.js","sourceRoot":"","sources":["../../src/decorators/SwaggerCustomizer.ts"],"names":[],"mappings":";;;AAEA
|
|
1
|
+
{"version":3,"file":"SwaggerCustomizer.js","sourceRoot":"","sources":["../../src/decorators/SwaggerCustomizer.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACH,2BACE,OAAqD;IAErD,OAAO,SAAS,iBAAiB,CAC/B,MAAc,EACd,WAA4B,EAC5B,UAAwC;QAExC,MAAM,KAAK,GAAwD,CAAC,GAAG,EAAE;YACvE,IACE,OAAO,CAAC,cAAc,CAAC,0BAA0B,EAAE,MAAM,EAAE,WAAW,CAAC;gBAEvE,OAAO,OAAO,CAAC,cAAc,CAC3B,0BAA0B,EAC1B,MAAM,EACN,WAAW,CACZ,CAAC;YACJ,MAAM,KAAK,GAAwD,EAAE,CAAC;YACtE,OAAO,CAAC,cAAc,CACpB,0BAA0B,EAC1B,KAAK,EACL,MAAM,EACN,WAAW,CACZ,CAAC;YACF,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,EAAE,CAAC;QACL,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpB,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -9,30 +9,43 @@
|
|
|
9
9
|
* The decorators only affect Swagger document generation. They do not change
|
|
10
10
|
* runtime behavior, validation, or SDK function signatures.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
12
|
+
* Example:
|
|
13
|
+
*
|
|
14
|
+
* ```typescript
|
|
15
|
+
* import core from "@nestia/core";
|
|
16
|
+
* import { Controller } from "@nestjs/common";
|
|
17
|
+
* import typia from "typia";
|
|
18
18
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
19
|
+
* @Controller("bbs/articles")
|
|
20
|
+
* export class BbsArticlesController {
|
|
21
|
+
* // Single response example.
|
|
22
|
+
* @core.SwaggerExample.Response(typia.random<IBbsArticle>())
|
|
23
|
+
* @core.TypedRoute.Post()
|
|
24
|
+
* public async create(
|
|
25
|
+
* // Multiple named parameter examples plus a default one.
|
|
26
|
+
* @core.SwaggerExample.Parameter(typia.random<IBbsArticle.ICreate>())
|
|
27
|
+
* @core.SwaggerExample.Parameter(
|
|
28
|
+
* "x",
|
|
29
|
+
* typia.random<IBbsArticle.ICreate>(),
|
|
30
|
+
* )
|
|
31
|
+
* @core.SwaggerExample.Parameter(
|
|
32
|
+
* "y",
|
|
33
|
+
* typia.random<IBbsArticle.ICreate>(),
|
|
34
|
+
* )
|
|
35
|
+
* @core.TypedBody()
|
|
36
|
+
* input: IBbsArticle.ICreate,
|
|
37
|
+
* ): Promise<IBbsArticle> {
|
|
38
|
+
* // ...
|
|
34
39
|
* }
|
|
35
|
-
*
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
44
|
+
* @evidence contracts/common.md#principled-implementation Examples are stored as metadata on the method or on the parameter position; a call with one argument sets the single example, and a call with a key and a value adds a named example, so both OpenAPI forms are expressible.
|
|
45
|
+
* @evidence contracts/common.md#clear-and-simple-design Two decorators over three private metadata helpers that find or create the record.
|
|
46
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The examples are caller data, and nothing is generated here.
|
|
47
|
+
* @evidence contracts/common.md#meaningful-documentation The comment documents both decorators and the two call forms.
|
|
48
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation Example metadata contains caller values and parameter indices without a native path or process boundary.
|
|
36
49
|
*/
|
|
37
50
|
export declare namespace SwaggerExample {
|
|
38
51
|
/**
|
|
@@ -51,6 +64,11 @@ export declare namespace SwaggerExample {
|
|
|
51
64
|
* document.
|
|
52
65
|
*
|
|
53
66
|
* @template T Type of the example value (typically the route's response DTO).
|
|
67
|
+
* @evidence contracts/common.md#principled-implementation The value or the keyed value is recorded on the method's response example record, which the document generator reads.
|
|
68
|
+
* @evidence contracts/common.md#clear-and-simple-design One decorator with two overloads.
|
|
69
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The value is stored as given.
|
|
70
|
+
* @evidence contracts/common.md#meaningful-documentation The comment documents the overloads with an example.
|
|
71
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation Example metadata contains caller values and parameter indices without a native path or process boundary.
|
|
54
72
|
*/
|
|
55
73
|
function Response<T>(value: T): MethodDecorator;
|
|
56
74
|
function Response<T>(key: string, value: T): MethodDecorator;
|
|
@@ -70,6 +88,11 @@ export declare namespace SwaggerExample {
|
|
|
70
88
|
* `@TypedParam()`, `@TypedQuery()`, etc.); decorator order does not matter.
|
|
71
89
|
*
|
|
72
90
|
* @template T Type of the example value (typically the parameter's DTO).
|
|
91
|
+
* @evidence contracts/common.md#principled-implementation The value or the keyed value is recorded on the record for that parameter index, so several parameters keep separate examples.
|
|
92
|
+
* @evidence contracts/common.md#clear-and-simple-design One decorator with two overloads.
|
|
93
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The value is stored as given.
|
|
94
|
+
* @evidence contracts/common.md#meaningful-documentation The comment documents the overloads with an example.
|
|
95
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation Example metadata contains caller values and parameter indices without a native path or process boundary.
|
|
73
96
|
*/
|
|
74
97
|
function Parameter<T>(value: T): ParameterDecorator;
|
|
75
98
|
function Parameter<T>(key: string, value: T): ParameterDecorator;
|
|
@@ -79,6 +102,12 @@ export declare namespace SwaggerExample {
|
|
|
79
102
|
* Reflects the OpenAPI spec's two example fields: a single default `example`,
|
|
80
103
|
* and/or a named map `examples`. `index` is used internally to associate
|
|
81
104
|
* parameter examples with the right parameter position.
|
|
105
|
+
*
|
|
106
|
+
* @evidence contracts/common.md#principled-implementation The record holds the single example, the named examples, and the parameter index, which is everything the generator needs to attach examples.
|
|
107
|
+
* @evidence contracts/common.md#clear-and-simple-design A flat record whose members are all optional.
|
|
108
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
|
|
109
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the meaning of the members.
|
|
110
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation Example metadata contains caller values and parameter indices without a native path or process boundary.
|
|
82
111
|
*/
|
|
83
112
|
interface IData<T> {
|
|
84
113
|
examples?: Record<string, T>;
|
|
@@ -12,30 +12,43 @@ exports.SwaggerExample = void 0;
|
|
|
12
12
|
* The decorators only affect Swagger document generation. They do not change
|
|
13
13
|
* runtime behavior, validation, or SDK function signatures.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
15
|
+
* Example:
|
|
16
|
+
*
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import core from "@nestia/core";
|
|
19
|
+
* import { Controller } from "@nestjs/common";
|
|
20
|
+
* import typia from "typia";
|
|
21
21
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
22
|
+
* @Controller("bbs/articles")
|
|
23
|
+
* export class BbsArticlesController {
|
|
24
|
+
* // Single response example.
|
|
25
|
+
* @core.SwaggerExample.Response(typia.random<IBbsArticle>())
|
|
26
|
+
* @core.TypedRoute.Post()
|
|
27
|
+
* public async create(
|
|
28
|
+
* // Multiple named parameter examples plus a default one.
|
|
29
|
+
* @core.SwaggerExample.Parameter(typia.random<IBbsArticle.ICreate>())
|
|
30
|
+
* @core.SwaggerExample.Parameter(
|
|
31
|
+
* "x",
|
|
32
|
+
* typia.random<IBbsArticle.ICreate>(),
|
|
33
|
+
* )
|
|
34
|
+
* @core.SwaggerExample.Parameter(
|
|
35
|
+
* "y",
|
|
36
|
+
* typia.random<IBbsArticle.ICreate>(),
|
|
37
|
+
* )
|
|
38
|
+
* @core.TypedBody()
|
|
39
|
+
* input: IBbsArticle.ICreate,
|
|
40
|
+
* ): Promise<IBbsArticle> {
|
|
41
|
+
* // ...
|
|
37
42
|
* }
|
|
38
|
-
*
|
|
43
|
+
* }
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
47
|
+
* @evidence contracts/common.md#principled-implementation Examples are stored as metadata on the method or on the parameter position; a call with one argument sets the single example, and a call with a key and a value adds a named example, so both OpenAPI forms are expressible.
|
|
48
|
+
* @evidence contracts/common.md#clear-and-simple-design Two decorators over three private metadata helpers that find or create the record.
|
|
49
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The examples are caller data, and nothing is generated here.
|
|
50
|
+
* @evidence contracts/common.md#meaningful-documentation The comment documents both decorators and the two call forms.
|
|
51
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation Example metadata contains caller values and parameter indices without a native path or process boundary.
|
|
39
52
|
*/
|
|
40
53
|
var SwaggerExample;
|
|
41
54
|
(function (SwaggerExample) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwaggerExample.js","sourceRoot":"","sources":["../../src/decorators/SwaggerExample.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"SwaggerExample.js","sourceRoot":"","sources":["../../src/decorators/SwaggerExample.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,IAAiB,cAAc,CAwF9B;AAxFD,WAAiB,cAAc;IAyB7B,SAAgB,QAAQ,CAAC,GAAG,IAAW;QACrC,OAAO,SAAS,sBAAsB,CACpC,OAAe,EACf,YAA6B,EAC7B,UAAwC;YAExC,YAAY,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YAClD,OAAO,UAAU,CAAC;QACpB,CAAC,CAAC;IACJ,CAAC;IATe,eAAA,QAAQ,WASvB,CAAA;IA0BD,SAAgB,SAA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AAa,EACc,EAAE;IAC7B,MAAM,KAAK,GAAgC,wBAAwB,CACjE,MAAM,EACN,WAAW,CACZ,CAAC;IACF,MAAM,MAAM,GAA0C,KAAK,CAAC,IAAI,CAC9D,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,KAAK,CACzB,CAAC;IACF,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC;IAExC,MAAM,IAAI,GAA8B,EAAE,KAAK,EAAE,CAAC;IAClD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjB,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,wBAAwB,GAAG,CAC/B,MAAc,EACd,WAA4B,EACC,EAAE;IAC/B,MAAM,KAAK,GAA4C,OAAO,CAAC,cAAc,CAC3E,kCAAkC,EAClC,MAAM,EACN,WAAW,CACZ,CAAC;IACF,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACtC,MAAM,MAAM,GAAgC,EAAE,CAAC;IAC/C,OAAO,CAAC,cAAc,CACpB,kCAAkC,EAClC,MAAM,EACN,MAAM,EACN,WAAW,CACZ,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -4,13 +4,20 @@ import { IRequestBodyValidator } from "../options/IRequestBodyValidator";
|
|
|
4
4
|
*
|
|
5
5
|
* `TypedBody` is a decorator function getting `application/json` typed data
|
|
6
6
|
* from request body. Also, it validates the request body data type through
|
|
7
|
-
* [typia](https://github.com/samchon/typia)
|
|
8
|
-
*
|
|
7
|
+
* [typia](https://github.com/samchon/typia) using the declared TypeScript
|
|
8
|
+
* type.
|
|
9
9
|
*
|
|
10
10
|
* For reference, when the request body data is not following the promised type
|
|
11
11
|
* `T`, `BadRequestException` error (status code: 400) would be thrown.
|
|
12
|
+
* Successful assert and validate callbacks supply the decorated argument; clone
|
|
13
|
+
* validators can therefore return a copy without replacing the raw body.
|
|
12
14
|
*
|
|
13
15
|
* @author Jeongho Nam - https://github.com/samchon
|
|
14
16
|
* @param validator Custom validator if required. Default is `typia.validate()`
|
|
17
|
+
* @evidence contracts/common.md#principled-implementation An absent body with no content type is accepted only when the validator accepts undefined; any other body must be application/json. The checker returns explicitly tagged successful data or the existing validation error, so cloned values reach the argument while raw request.body retains its identity and errors retain their response priority.
|
|
18
|
+
* @evidence contracts/common.md#clear-and-simple-design One parameter decorator composes shared media/absence checks and tagged resolution. The shared internal runner owns descriptor selection and error translation; PlainBody uses the same successful-value protocol for its optional transformed text assertion, preserving raw text when no assertion exists and preserving its absent-input/media error priority.
|
|
19
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The validator is generated from the type by the transform; without it the decorator throws the configuration error unless the guard is turned off.
|
|
20
|
+
* @evidence contracts/common.md#meaningful-documentation The comment documents the decorator, the media type rule, and the validation modes.
|
|
21
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation Parsed HTTP bodies and validation callbacks are independent of native filesystem and process representation.
|
|
15
22
|
*/
|
|
16
23
|
export declare function TypedBody<T>(validator?: IRequestBodyValidator<T>): ParameterDecorator;
|
|
@@ -10,14 +10,21 @@ const validate_request_body_1 = require("./internal/validate_request_body");
|
|
|
10
10
|
*
|
|
11
11
|
* `TypedBody` is a decorator function getting `application/json` typed data
|
|
12
12
|
* from request body. Also, it validates the request body data type through
|
|
13
|
-
* [typia](https://github.com/samchon/typia)
|
|
14
|
-
*
|
|
13
|
+
* [typia](https://github.com/samchon/typia) using the declared TypeScript
|
|
14
|
+
* type.
|
|
15
15
|
*
|
|
16
16
|
* For reference, when the request body data is not following the promised type
|
|
17
17
|
* `T`, `BadRequestException` error (status code: 400) would be thrown.
|
|
18
|
+
* Successful assert and validate callbacks supply the decorated argument; clone
|
|
19
|
+
* validators can therefore return a copy without replacing the raw body.
|
|
18
20
|
*
|
|
19
21
|
* @author Jeongho Nam - https://github.com/samchon
|
|
20
22
|
* @param validator Custom validator if required. Default is `typia.validate()`
|
|
23
|
+
* @evidence contracts/common.md#principled-implementation An absent body with no content type is accepted only when the validator accepts undefined; any other body must be application/json. The checker returns explicitly tagged successful data or the existing validation error, so cloned values reach the argument while raw request.body retains its identity and errors retain their response priority.
|
|
24
|
+
* @evidence contracts/common.md#clear-and-simple-design One parameter decorator composes shared media/absence checks and tagged resolution. The shared internal runner owns descriptor selection and error translation; PlainBody uses the same successful-value protocol for its optional transformed text assertion, preserving raw text when no assertion exists and preserving its absent-input/media error priority.
|
|
25
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The validator is generated from the type by the transform; without it the decorator throws the configuration error unless the guard is turned off.
|
|
26
|
+
* @evidence contracts/common.md#meaningful-documentation The comment documents the decorator, the media type rule, and the validation modes.
|
|
27
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation Parsed HTTP bodies and validation callbacks are independent of native filesystem and process representation.
|
|
21
28
|
*/
|
|
22
29
|
function TypedBody(validator) {
|
|
23
30
|
const checker = (0, validate_request_body_1.validate_request_body)("TypedBody")(validator);
|
|
@@ -25,15 +32,18 @@ function TypedBody(validator) {
|
|
|
25
32
|
const request = context
|
|
26
33
|
.switchToHttp()
|
|
27
34
|
.getRequest();
|
|
28
|
-
if ((0, is_request_body_undefined_1.is_request_body_undefined)(request)
|
|
29
|
-
|
|
30
|
-
|
|
35
|
+
if ((0, is_request_body_undefined_1.is_request_body_undefined)(request)) {
|
|
36
|
+
const result = checker.resolve(undefined);
|
|
37
|
+
if (result.success)
|
|
38
|
+
return result.data;
|
|
39
|
+
}
|
|
40
|
+
if ((0, is_media_type_1.is_media_type)(request.headers["content-type"], "application/json") ===
|
|
31
41
|
false)
|
|
32
42
|
throw new common_1.BadRequestException(`Request body type is not "application/json".`);
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
35
|
-
throw error;
|
|
36
|
-
return
|
|
43
|
+
const result = checker.resolve(request.body);
|
|
44
|
+
if (!result.success)
|
|
45
|
+
throw result.error;
|
|
46
|
+
return result.data;
|
|
37
47
|
})();
|
|
38
48
|
}
|
|
39
49
|
//# sourceMappingURL=TypedBody.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypedBody.js","sourceRoot":"","sources":["../../src/decorators/TypedBody.ts"],"names":[],"mappings":";;;AAAA,2CAIwB;AAKxB,4DAAyD;AACzD,oFAAiF;AACjF,4EAAyE;AAEzE
|
|
1
|
+
{"version":3,"file":"TypedBody.js","sourceRoot":"","sources":["../../src/decorators/TypedBody.ts"],"names":[],"mappings":";;;AAAA,2CAIwB;AAKxB,4DAAyD;AACzD,oFAAiF;AACjF,4EAAyE;AAEzE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,mBACE,SAAoC;IAEpC,MAAM,OAAO,GAAG,IAAA,6CAAqB,EAAC,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC;IAC9D,OAAO,IAAA,6BAAoB,EAAC,SAAS,SAAS,CAC5C,QAAa,EACb,OAAyB;QAEzB,MAAM,OAAO,GAAqC,OAAO;aACtD,YAAY,EAAE;aACd,UAAU,EAAE,CAAC;QAChB,IAAI,IAAA,qDAAyB,EAAC,OAAO,CAAC,EAAE,CAAC;YACvC,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YAC1C,IAAI,MAAM,CAAC,OAAO;gBAAE,OAAO,MAAM,CAAC,IAAI,CAAC;QACzC,CAAC;QACD,IACE,IAAA,6BAAa,EAAC,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,kBAAkB,CAAC;YAClE,KAAK;YAEL,MAAM,IAAI,4BAAmB,CAC3B,8CAA8C,CAC/C,CAAC;QAEJ,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,MAAM,CAAC,OAAO;YAAE,MAAM,MAAM,CAAC,KAAK,CAAC;QACxC,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC,CAAC,EAAE,CAAC;AACP,CAAC"}
|
|
@@ -74,6 +74,16 @@ export declare function TypedException<T>(props: TypedException.IProps<T>): Meth
|
|
|
74
74
|
* @returns Method decorator
|
|
75
75
|
*/
|
|
76
76
|
export declare function TypedException<T>(status: number | "2XX" | "3XX" | "4XX" | "5XX", description?: string | undefined): MethodDecorator & Pick<TypedException.IProps<T>, never>;
|
|
77
|
+
/**
|
|
78
|
+
* Types of {@link TypedException}: the response properties a declaration
|
|
79
|
+
* carries, and its named examples.
|
|
80
|
+
*
|
|
81
|
+
* @evidence contracts/common.md#principled-implementation The decorator records each declared status, description, and example on the method's metadata list, so the document generator can add the responses; the overloads without a type argument return `never` so a missing type argument is a compile error.
|
|
82
|
+
* @evidence contracts/common.md#clear-and-simple-design One decorator whose overloads split the property form and the positional form.
|
|
83
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It records declarations and never changes how the route responds.
|
|
84
|
+
* @evidence contracts/common.md#meaningful-documentation The comment documents the forms and that the status accepts range spellings.
|
|
85
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation Response declarations contain HTTP status codes and examples, without native files or subprocesses.
|
|
86
|
+
*/
|
|
77
87
|
export declare namespace TypedException {
|
|
78
88
|
/** Properties for the exception. */
|
|
79
89
|
interface IProps<T> {
|
|
@@ -57,6 +57,11 @@
|
|
|
57
57
|
* ```
|
|
58
58
|
*
|
|
59
59
|
* @author Jeongho Nam - https://github.com/samchon
|
|
60
|
+
* @evidence contracts/common.md#principled-implementation The body must be multipart; multer parses it through the caller's factory into a `FormData` of fields and `File` objects, uploaded temp files are read and always removed afterwards, multer limits map to 413 or 400 responses, and the assembled form is checked by the transformed validator.
|
|
61
|
+
* @evidence contracts/common.md#clear-and-simple-design One decorator with the multipart decoding, the error mapping, and the file conversion as separate module-private functions, and the multer instance created once by a `Singleton`.
|
|
62
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Errors are mapped by multer's documented codes and by exact busboy messages, and no file name is special-cased; a runtime without `File` is refused up front.
|
|
63
|
+
* @evidence contracts/common.md#meaningful-documentation The comment documents the factory, the memory and disk storage requirement, and the validation.
|
|
64
|
+
* @evidence contracts/portability.md#os-neutral-implementation Uploaded disk paths come from the storage engine and are consumed directly by Node fs readFile and rm; filename is File metadata rather than a reconstructed native path. Structural multer method signatures specify middleware rather than native path spelling.
|
|
60
65
|
* @todo Change to ReadableStream through configuring storage engine of multer
|
|
61
66
|
*/
|
|
62
67
|
export declare namespace TypedFormData {
|
|
@@ -74,12 +79,65 @@ export declare namespace TypedFormData {
|
|
|
74
79
|
* a file path is rejected.
|
|
75
80
|
*/
|
|
76
81
|
function Body<Multer extends IMulterBase>(factory: () => Multer | Promise<Multer>): ParameterDecorator;
|
|
77
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* Base type of the `multer` or `fastify-multer`.
|
|
84
|
+
*
|
|
85
|
+
* @evidence contracts/common.md#principled-implementation The interface names the multer methods that identify a multer instance structurally, so an application can pass its own instance without this package depending on a multer type at runtime.
|
|
86
|
+
* @evidence contracts/common.md#clear-and-simple-design Five method members with no behavior.
|
|
87
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
|
|
88
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states its purpose as the structural stand-in for multer.
|
|
89
|
+
* @evidence contracts/portability.md#os-neutral-implementation Uploaded disk paths come from the storage engine and are consumed directly by Node fs readFile and rm; filename is File metadata rather than a reconstructed native path. Structural multer method signatures specify middleware rather than native path spelling.
|
|
90
|
+
*/
|
|
78
91
|
interface IMulterBase {
|
|
92
|
+
/**
|
|
93
|
+
* Middleware factory for a single file field.
|
|
94
|
+
*
|
|
95
|
+
* @evidence contracts/common.md#principled-implementation The member mirrors multer's single-file middleware factory.
|
|
96
|
+
* @evidence contracts/common.md#clear-and-simple-design One method signature.
|
|
97
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
|
|
98
|
+
* @evidence contracts/common.md#meaningful-documentation The member is named after the multer method it mirrors.
|
|
99
|
+
* @evidence contracts/portability.md#os-neutral-implementation Uploaded disk paths come from the storage engine and are consumed directly by Node fs readFile and rm; filename is File metadata rather than a reconstructed native path. Structural multer method signatures specify middleware rather than native path spelling.
|
|
100
|
+
*/
|
|
79
101
|
single(fieldName: string): any;
|
|
102
|
+
/**
|
|
103
|
+
* Middleware factory for an array of files under one field.
|
|
104
|
+
*
|
|
105
|
+
* @evidence contracts/common.md#principled-implementation The member mirrors multer's array-of-files middleware factory.
|
|
106
|
+
* @evidence contracts/common.md#clear-and-simple-design One method signature.
|
|
107
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
|
|
108
|
+
* @evidence contracts/common.md#meaningful-documentation The member is named after the multer method it mirrors.
|
|
109
|
+
* @evidence contracts/portability.md#os-neutral-implementation Uploaded disk paths come from the storage engine and are consumed directly by Node fs readFile and rm; filename is File metadata rather than a reconstructed native path. Structural multer method signatures specify middleware rather than native path spelling.
|
|
110
|
+
*/
|
|
80
111
|
array(fieldName: string, maxCount?: number): any;
|
|
112
|
+
/**
|
|
113
|
+
* Middleware factory for several named file fields.
|
|
114
|
+
*
|
|
115
|
+
* @evidence contracts/common.md#principled-implementation The member mirrors multer's named-fields middleware factory, which is the one the decorator uses when the transform lists the file fields.
|
|
116
|
+
* @evidence contracts/common.md#clear-and-simple-design One method signature.
|
|
117
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
|
|
118
|
+
* @evidence contracts/common.md#meaningful-documentation The member is named after the multer method it mirrors.
|
|
119
|
+
* @evidence contracts/portability.md#os-neutral-implementation Uploaded disk paths come from the storage engine and are consumed directly by Node fs readFile and rm; filename is File metadata rather than a reconstructed native path. Structural multer method signatures specify middleware rather than native path spelling.
|
|
120
|
+
*/
|
|
81
121
|
fields(fields: readonly object[]): any;
|
|
122
|
+
/**
|
|
123
|
+
* Middleware factory that accepts every file field.
|
|
124
|
+
*
|
|
125
|
+
* @evidence contracts/common.md#principled-implementation The member mirrors multer's accept-any-file middleware factory, which the decorator uses when no transform names the file fields.
|
|
126
|
+
* @evidence contracts/common.md#clear-and-simple-design One method signature.
|
|
127
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
|
|
128
|
+
* @evidence contracts/common.md#meaningful-documentation The member is named after the multer method it mirrors.
|
|
129
|
+
* @evidence contracts/portability.md#os-neutral-implementation Uploaded disk paths come from the storage engine and are consumed directly by Node fs readFile and rm; filename is File metadata rather than a reconstructed native path. Structural multer method signatures specify middleware rather than native path spelling.
|
|
130
|
+
*/
|
|
82
131
|
any(): any;
|
|
132
|
+
/**
|
|
133
|
+
* Middleware factory that accepts text fields only.
|
|
134
|
+
*
|
|
135
|
+
* @evidence contracts/common.md#principled-implementation The member mirrors multer's text-fields-only middleware factory.
|
|
136
|
+
* @evidence contracts/common.md#clear-and-simple-design One method signature.
|
|
137
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
|
|
138
|
+
* @evidence contracts/common.md#meaningful-documentation The member is named after the multer method it mirrors.
|
|
139
|
+
* @evidence contracts/portability.md#os-neutral-implementation Uploaded disk paths come from the storage engine and are consumed directly by Node fs readFile and rm; filename is File metadata rather than a reconstructed native path. Structural multer method signatures specify middleware rather than native path spelling.
|
|
140
|
+
*/
|
|
83
141
|
none(): any;
|
|
84
142
|
}
|
|
85
143
|
}
|
|
@@ -77,6 +77,11 @@ const validate_request_form_data_1 = require("./internal/validate_request_form_d
|
|
|
77
77
|
* ```
|
|
78
78
|
*
|
|
79
79
|
* @author Jeongho Nam - https://github.com/samchon
|
|
80
|
+
* @evidence contracts/common.md#principled-implementation The body must be multipart; multer parses it through the caller's factory into a `FormData` of fields and `File` objects, uploaded temp files are read and always removed afterwards, multer limits map to 413 or 400 responses, and the assembled form is checked by the transformed validator.
|
|
81
|
+
* @evidence contracts/common.md#clear-and-simple-design One decorator with the multipart decoding, the error mapping, and the file conversion as separate module-private functions, and the multer instance created once by a `Singleton`.
|
|
82
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Errors are mapped by multer's documented codes and by exact busboy messages, and no file name is special-cased; a runtime without `File` is refused up front.
|
|
83
|
+
* @evidence contracts/common.md#meaningful-documentation The comment documents the factory, the memory and disk storage requirement, and the validation.
|
|
84
|
+
* @evidence contracts/portability.md#os-neutral-implementation Uploaded disk paths come from the storage engine and are consumed directly by Node fs readFile and rm; filename is File metadata rather than a reconstructed native path. Structural multer method signatures specify middleware rather than native path spelling.
|
|
80
85
|
* @todo Change to ReadableStream through configuring storage engine of multer
|
|
81
86
|
*/
|
|
82
87
|
var TypedFormData;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypedFormData.js","sourceRoot":"","sources":["../../src/decorators/TypedFormData.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAMwB;AAGxB,4CAAoB;AAIpB,kDAA+C;AAC/C,4DAAyD;AACzD,sFAAmF;AAEnF
|
|
1
|
+
{"version":3,"file":"TypedFormData.js","sourceRoot":"","sources":["../../src/decorators/TypedFormData.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAMwB;AAGxB,4CAAoB;AAIpB,kDAA+C;AAC/C,4DAAyD;AACzD,sFAAmF;AAEnF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AACH,IAAiB,aAAa,CAuH7B;AAvHD,WAAiB,aAAa;IAkB5B,gBAAgB;IAChB,SAAgB,IAAI,CAClB,OAAmC,EACnC,KAA4C;QAE5C,IAAI,OAAO,IAAI,KAAK,WAAW;YAC7B,MAAM,IAAI,KAAK,CACb,gIAAgI,CACjI,CAAC;QACJ,MAAM,OAAO,GAAG,IAAA,uDAA0B,EAAC,KAAK,CAAC,CAAC;QAClD,MAAM,QAAQ,GAAG,IAAI,qBAAS,CAAC,GAAS,EAAE,gDACxC,OAAA,MAAM,CAAC,CAA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I,CAAC,IAAI,CAAC;YACvC,CAAC,CAAC,SAAS,CAAC;IAClB,IAAI,KAAK,KAAK,SAAS;QACrB,MAAM,IAAI,KAAK,CACb,sHAAsH,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,+DAA+D,CACpN,CAAC;IACJ,OAAO,IAAI,IAAI,CAAC,CAAC,KAAY,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;AAC9E,CAAC,CAAA,CAAC"}
|
|
@@ -41,5 +41,10 @@ import { IRequestHeadersValidator } from "../options/IRequestHeadersValidator";
|
|
|
41
41
|
*
|
|
42
42
|
* @author Jeongho Nam - https://github.com/samchon
|
|
43
43
|
* @returns Parameter decorator
|
|
44
|
+
* @evidence contracts/common.md#principled-implementation The header record of the request is decoded by the transformed function into the typed object, whose failure is thrown as the response; header names arrive lower-cased from Node, which the generated decoder expects.
|
|
45
|
+
* @evidence contracts/common.md#clear-and-simple-design One parameter decorator built from the shared header validator runner.
|
|
46
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The decoder is generated from the type by the transform; without it the request headers are passed through only when the configuration guard is off.
|
|
47
|
+
* @evidence contracts/common.md#meaningful-documentation The comment documents the decoding, the supported property types, and the validation modes.
|
|
48
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation Header names and decoded values belong to the HTTP protocol and are not native filesystem identities.
|
|
44
49
|
*/
|
|
45
50
|
export declare function TypedHeaders<T extends object>(validator?: IRequestHeadersValidator<T>): ParameterDecorator;
|
|
@@ -45,6 +45,11 @@ const validate_request_headers_1 = require("./internal/validate_request_headers"
|
|
|
45
45
|
*
|
|
46
46
|
* @author Jeongho Nam - https://github.com/samchon
|
|
47
47
|
* @returns Parameter decorator
|
|
48
|
+
* @evidence contracts/common.md#principled-implementation The header record of the request is decoded by the transformed function into the typed object, whose failure is thrown as the response; header names arrive lower-cased from Node, which the generated decoder expects.
|
|
49
|
+
* @evidence contracts/common.md#clear-and-simple-design One parameter decorator built from the shared header validator runner.
|
|
50
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The decoder is generated from the type by the transform; without it the request headers are passed through only when the configuration guard is off.
|
|
51
|
+
* @evidence contracts/common.md#meaningful-documentation The comment documents the decoding, the supported property types, and the validation modes.
|
|
52
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation Header names and decoded values belong to the HTTP protocol and are not native filesystem identities.
|
|
48
53
|
*/
|
|
49
54
|
function TypedHeaders(validator) {
|
|
50
55
|
const checker = (0, validate_request_headers_1.validate_request_headers)(validator);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypedHeaders.js","sourceRoot":"","sources":["../../src/decorators/TypedHeaders.ts"],"names":[],"mappings":";;;AAAA,2CAAwE;AAKxE,kFAA+E;AAE/E
|
|
1
|
+
{"version":3,"file":"TypedHeaders.js","sourceRoot":"","sources":["../../src/decorators/TypedHeaders.ts"],"names":[],"mappings":";;;AAAA,2CAAwE;AAKxE,kFAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,sBACE,SAAuC;IAEvC,MAAM,OAAO,GAAG,IAAA,mDAAwB,EAAC,SAAS,CAAC,CAAC;IACpD,OAAO,IAAA,6BAAoB,EAAC,SAAS,YAAY,CAC/C,QAAa,EACb,OAAyB;QAEzB,MAAM,OAAO,GAAqC,OAAO;aACtD,YAAY,EAAE;aACd,UAAU,EAAE,CAAC;QAChB,MAAM,MAAM,GAAc,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACnD,IAAI,MAAM,YAAY,KAAK;YAAE,MAAM,MAAM,CAAC;QAC1C,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,EAAE,CAAC;AACP,CAAC"}
|