@nestia/core 14.0.1 → 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.
Files changed (156) hide show
  1. package/lib/adaptors/McpAdaptor.d.ts +24 -3
  2. package/lib/adaptors/McpAdaptor.js +72 -34
  3. package/lib/adaptors/McpAdaptor.js.map +1 -1
  4. package/lib/adaptors/WebSocketAdaptor.d.ts +37 -0
  5. package/lib/adaptors/WebSocketAdaptor.js +60 -16
  6. package/lib/adaptors/WebSocketAdaptor.js.map +1 -1
  7. package/lib/adaptors/internal/external_context.js +18 -5
  8. package/lib/adaptors/internal/external_context.js.map +1 -1
  9. package/lib/decorators/DynamicModule.d.ts +12 -0
  10. package/lib/decorators/DynamicModule.js +12 -0
  11. package/lib/decorators/DynamicModule.js.map +1 -1
  12. package/lib/decorators/EncryptedBody.d.ts +14 -6
  13. package/lib/decorators/EncryptedBody.js +37 -14
  14. package/lib/decorators/EncryptedBody.js.map +1 -1
  15. package/lib/decorators/EncryptedController.d.ts +6 -1
  16. package/lib/decorators/EncryptedController.js +6 -1
  17. package/lib/decorators/EncryptedController.js.map +1 -1
  18. package/lib/decorators/EncryptedModule.d.ts +18 -3
  19. package/lib/decorators/EncryptedModule.js +18 -3
  20. package/lib/decorators/EncryptedModule.js.map +1 -1
  21. package/lib/decorators/EncryptedRoute.d.ts +20 -11
  22. package/lib/decorators/EncryptedRoute.js +20 -11
  23. package/lib/decorators/EncryptedRoute.js.map +1 -1
  24. package/lib/decorators/HumanRoute.d.ts +5 -0
  25. package/lib/decorators/HumanRoute.js +5 -0
  26. package/lib/decorators/HumanRoute.js.map +1 -1
  27. package/lib/decorators/McpRoute.d.ts +31 -19
  28. package/lib/decorators/McpRoute.js +12 -1
  29. package/lib/decorators/McpRoute.js.map +1 -1
  30. package/lib/decorators/PlainBody.d.ts +7 -1
  31. package/lib/decorators/PlainBody.js +16 -8
  32. package/lib/decorators/PlainBody.js.map +1 -1
  33. package/lib/decorators/SwaggerCustomizer.d.ts +15 -0
  34. package/lib/decorators/SwaggerCustomizer.js +5 -0
  35. package/lib/decorators/SwaggerCustomizer.js.map +1 -1
  36. package/lib/decorators/SwaggerExample.d.ts +51 -22
  37. package/lib/decorators/SwaggerExample.js +35 -22
  38. package/lib/decorators/SwaggerExample.js.map +1 -1
  39. package/lib/decorators/TypedBody.d.ts +9 -2
  40. package/lib/decorators/TypedBody.js +19 -9
  41. package/lib/decorators/TypedBody.js.map +1 -1
  42. package/lib/decorators/TypedException.d.ts +10 -0
  43. package/lib/decorators/TypedFormData.d.ts +59 -1
  44. package/lib/decorators/TypedFormData.js +5 -0
  45. package/lib/decorators/TypedFormData.js.map +1 -1
  46. package/lib/decorators/TypedHeaders.d.ts +5 -0
  47. package/lib/decorators/TypedHeaders.js +5 -0
  48. package/lib/decorators/TypedHeaders.js.map +1 -1
  49. package/lib/decorators/TypedParam.d.ts +9 -0
  50. package/lib/decorators/TypedParam.js +9 -0
  51. package/lib/decorators/TypedParam.js.map +1 -1
  52. package/lib/decorators/TypedQuery.d.ts +16 -0
  53. package/lib/decorators/TypedQuery.js +16 -0
  54. package/lib/decorators/TypedQuery.js.map +1 -1
  55. package/lib/decorators/TypedRoute.d.ts +25 -10
  56. package/lib/decorators/TypedRoute.js +19 -10
  57. package/lib/decorators/TypedRoute.js.map +1 -1
  58. package/lib/decorators/WebSocketRoute.d.ts +18 -1
  59. package/lib/decorators/WebSocketRoute.js +18 -1
  60. package/lib/decorators/WebSocketRoute.js.map +1 -1
  61. package/lib/decorators/doNotThrowTransformError.d.ts +14 -0
  62. package/lib/decorators/doNotThrowTransformError.js +14 -0
  63. package/lib/decorators/doNotThrowTransformError.js.map +1 -1
  64. package/lib/decorators/internal/IRequestBodyValidation.d.ts +66 -0
  65. package/lib/decorators/internal/IRequestBodyValidation.js +3 -0
  66. package/lib/decorators/internal/IRequestBodyValidation.js.map +1 -0
  67. package/lib/decorators/internal/IWebSocketRouteReflect.d.ts +93 -1
  68. package/lib/decorators/internal/get_path_and_querify.js +3 -7
  69. package/lib/decorators/internal/get_path_and_querify.js.map +1 -1
  70. package/lib/decorators/internal/get_path_and_stringify.js +3 -7
  71. package/lib/decorators/internal/get_path_and_stringify.js.map +1 -1
  72. package/lib/decorators/internal/load_controller.d.ts +14 -0
  73. package/lib/decorators/internal/load_controller.js +14 -0
  74. package/lib/decorators/internal/load_controller.js.map +1 -1
  75. package/lib/decorators/internal/split_route_arguments.d.ts +1 -0
  76. package/lib/decorators/internal/split_route_arguments.js +22 -0
  77. package/lib/decorators/internal/split_route_arguments.js.map +1 -0
  78. package/lib/decorators/internal/validate_request_body.js +68 -25
  79. package/lib/decorators/internal/validate_request_body.js.map +1 -1
  80. package/lib/options/IRequestBodyValidator.d.ts +71 -0
  81. package/lib/options/IRequestFormDataProps.d.ts +80 -0
  82. package/lib/options/IRequestHeadersValidator.d.ts +67 -0
  83. package/lib/options/IRequestQueryValidator.d.ts +68 -0
  84. package/lib/options/IResponseBodyQuerifier.d.ts +120 -0
  85. package/lib/options/IResponseBodyStringifier.d.ts +107 -0
  86. package/lib/typings/Creator.d.ts +10 -0
  87. package/lib/utils/ArrayUtil.d.ts +21 -0
  88. package/lib/utils/ArrayUtil.js +22 -1
  89. package/lib/utils/ArrayUtil.js.map +1 -1
  90. package/lib/utils/ExceptionManager.d.ts +40 -0
  91. package/lib/utils/ExceptionManager.js +34 -0
  92. package/lib/utils/ExceptionManager.js.map +1 -1
  93. package/lib/utils/SourceFinder.d.ts +22 -0
  94. package/lib/utils/SourceFinder.js +34 -7
  95. package/lib/utils/SourceFinder.js.map +1 -1
  96. package/lib/utils/VersioningStrategy.d.ts +36 -1
  97. package/lib/utils/VersioningStrategy.js +30 -9
  98. package/lib/utils/VersioningStrategy.js.map +1 -1
  99. package/native/go.mod +1 -1
  100. package/native/go.sum +2 -2
  101. package/native/plugin/plan.go +68 -2
  102. package/native/transform/ast.go +19 -1
  103. package/native/transform/build.go +51 -57
  104. package/native/transform/buildoutput/output.go +147 -0
  105. package/native/transform/contributor.go +9 -0
  106. package/native/transform/core_querify.go +37 -3
  107. package/native/transform/core_transform.go +105 -98
  108. package/native/transform/core_websocket.go +21 -5
  109. package/native/transform/node_transform.go +11 -8
  110. package/native/transform/package.go +55 -0
  111. package/native/transform/printer.go +1 -3
  112. package/native/transform/run.go +18 -0
  113. package/native/transform/schemaprojection/project.go +213 -0
  114. package/native/transform/transform.go +21 -0
  115. package/package.json +5 -4
  116. package/src/adaptors/McpAdaptor.ts +86 -26
  117. package/src/adaptors/WebSocketAdaptor.ts +66 -14
  118. package/src/adaptors/internal/external_context.ts +37 -6
  119. package/src/decorators/DynamicModule.ts +12 -0
  120. package/src/decorators/EncryptedBody.ts +37 -13
  121. package/src/decorators/EncryptedController.ts +6 -1
  122. package/src/decorators/EncryptedModule.ts +18 -3
  123. package/src/decorators/EncryptedRoute.ts +20 -11
  124. package/src/decorators/HumanRoute.ts +5 -0
  125. package/src/decorators/McpRoute.ts +31 -19
  126. package/src/decorators/PlainBody.ts +20 -10
  127. package/src/decorators/SwaggerCustomizer.ts +15 -0
  128. package/src/decorators/SwaggerExample.ts +51 -22
  129. package/src/decorators/TypedBody.ts +17 -8
  130. package/src/decorators/TypedException.ts +10 -0
  131. package/src/decorators/TypedFormData.ts +59 -1
  132. package/src/decorators/TypedHeaders.ts +5 -0
  133. package/src/decorators/TypedParam.ts +9 -0
  134. package/src/decorators/TypedQuery.ts +16 -0
  135. package/src/decorators/TypedRoute.ts +25 -10
  136. package/src/decorators/WebSocketRoute.ts +18 -1
  137. package/src/decorators/doNotThrowTransformError.ts +14 -0
  138. package/src/decorators/internal/IMcpRouteReflect.ts +7 -1
  139. package/src/decorators/internal/IRequestBodyValidation.ts +65 -0
  140. package/src/decorators/internal/IWebSocketRouteReflect.ts +95 -1
  141. package/src/decorators/internal/get_path_and_querify.ts +3 -9
  142. package/src/decorators/internal/get_path_and_stringify.ts +3 -9
  143. package/src/decorators/internal/load_controller.ts +14 -0
  144. package/src/decorators/internal/split_route_arguments.ts +20 -0
  145. package/src/decorators/internal/validate_request_body.ts +87 -34
  146. package/src/options/IRequestBodyValidator.ts +71 -0
  147. package/src/options/IRequestFormDataProps.ts +80 -0
  148. package/src/options/IRequestHeadersValidator.ts +67 -0
  149. package/src/options/IRequestQueryValidator.ts +68 -0
  150. package/src/options/IResponseBodyQuerifier.ts +120 -0
  151. package/src/options/IResponseBodyStringifier.ts +107 -0
  152. package/src/typings/Creator.ts +10 -0
  153. package/src/utils/ArrayUtil.ts +22 -3
  154. package/src/utils/ExceptionManager.ts +40 -0
  155. package/src/utils/SourceFinder.ts +38 -7
  156. package/src/utils/VersioningStrategy.ts +43 -13
@@ -6,6 +6,11 @@ import { ModuleMetadata } from "@nestjs/common/interfaces";
6
6
  * controller classes dynamically just by specifying their directory path.
7
7
  *
8
8
  * @author Jeongho Nam - https://github.com/samchon
9
+ * @evidence contracts/common.md#principled-implementation The namespace builds a Nest module whose controllers are found on disk at startup instead of listed in code, using the shared loader.
10
+ * @evidence contracts/common.md#clear-and-simple-design One function that delegates discovery to `load_controllers` and decorates a class with the result.
11
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Paths are caller input, and no controller name is assumed.
12
+ * @evidence contracts/common.md#meaningful-documentation The comment describes the purpose and the path forms.
13
+ * @evidence contracts/portability.md#os-neutral-implementation Controller discovery delegates native path handling to SourceFinder and conversion of import paths to file URLs to load_controllers; module metadata contains controller constructors rather than filesystem identities.
9
14
  */
10
15
  export declare namespace DynamicModule {
11
16
  /**
@@ -18,7 +23,14 @@ export declare namespace DynamicModule {
18
23
  *
19
24
  * @param path Path of controllers
20
25
  * @param metadata Additional metadata except controllers
26
+ * @param isTsNode Select TypeScript source files explicitly; otherwise
27
+ * compiled JavaScript is tried first, with a source fallback under `ttsx`.
21
28
  * @returns Module instance
29
+ * @evidence contracts/common.md#principled-implementation Controllers are loaded from the paths, given as a path, a list, or include and exclude lists, and then a class decorated with `@Module` and those controllers is returned, so Nest treats the result as an ordinary module.
30
+ * @evidence contracts/common.md#clear-and-simple-design A short function whose discovery details live in `load_controllers`.
31
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It calls Nest's public `Module` decorator with the metadata; nothing is patched.
32
+ * @evidence contracts/common.md#meaningful-documentation The comment documents the path forms and the `isTsNode` option.
33
+ * @evidence contracts/portability.md#os-neutral-implementation Controller discovery delegates native path handling to SourceFinder and conversion of import paths to file URLs to load_controllers; module metadata contains controller constructors rather than filesystem identities.
22
34
  */
23
35
  function mount(path: string | string[] | {
24
36
  include: string[];
@@ -57,6 +57,11 @@ const load_controller_1 = require("./internal/load_controller");
57
57
  * controller classes dynamically just by specifying their directory path.
58
58
  *
59
59
  * @author Jeongho Nam - https://github.com/samchon
60
+ * @evidence contracts/common.md#principled-implementation The namespace builds a Nest module whose controllers are found on disk at startup instead of listed in code, using the shared loader.
61
+ * @evidence contracts/common.md#clear-and-simple-design One function that delegates discovery to `load_controllers` and decorates a class with the result.
62
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Paths are caller input, and no controller name is assumed.
63
+ * @evidence contracts/common.md#meaningful-documentation The comment describes the purpose and the path forms.
64
+ * @evidence contracts/portability.md#os-neutral-implementation Controller discovery delegates native path handling to SourceFinder and conversion of import paths to file URLs to load_controllers; module metadata contains controller constructors rather than filesystem identities.
60
65
  */
61
66
  var DynamicModule;
62
67
  (function (DynamicModule) {
@@ -70,7 +75,14 @@ var DynamicModule;
70
75
  *
71
76
  * @param path Path of controllers
72
77
  * @param metadata Additional metadata except controllers
78
+ * @param isTsNode Select TypeScript source files explicitly; otherwise
79
+ * compiled JavaScript is tried first, with a source fallback under `ttsx`.
73
80
  * @returns Module instance
81
+ * @evidence contracts/common.md#principled-implementation Controllers are loaded from the paths, given as a path, a list, or include and exclude lists, and then a class decorated with `@Module` and those controllers is returned, so Nest treats the result as an ordinary module.
82
+ * @evidence contracts/common.md#clear-and-simple-design A short function whose discovery details live in `load_controllers`.
83
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It calls Nest's public `Module` decorator with the metadata; nothing is patched.
84
+ * @evidence contracts/common.md#meaningful-documentation The comment documents the path forms and the `isTsNode` option.
85
+ * @evidence contracts/portability.md#os-neutral-implementation Controller discovery delegates native path handling to SourceFinder and conversion of import paths to file URLs to load_controllers; module metadata contains controller constructors rather than filesystem identities.
74
86
  */
75
87
  function mount(path_1) {
76
88
  return __awaiter(this, arguments, void 0, function* (path, metadata = {}, isTsNode) {
@@ -1 +1 @@
1
- {"version":3,"file":"DynamicModule.js","sourceRoot":"","sources":["../../src/decorators/DynamicModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAwC;AAIxC,gEAA8D;AAE9D;;;;;;;GAOG;AACH,IAAiB,aAAa,CA6B7B;AA7BD,WAAiB,aAAa;IAC5B;;;;;;;;;;;OAWG;IACH,SAAsB,KAAK;6DACzB,IAAmE,EACnE,QAAQ,GAAwC,EAAE,EAClD,QAAkB;YAElB,mBAAmB;YACnB,MAAM,WAAW,GAAsB,MAAM,IAAA,kCAAgB,EAC3D,IAAI,EACJ,QAAQ,CACT,CAAC;YAEF,yBAAyB;gBAEnB,YAAY;wCADjB,IAAA,eAAM,kCAAM,QAAQ,KAAE,WAAW,IAAG;;;;;;;;;oBACrC,6KAAqB;;;oBAAf,uDAAY;;;;YAClB,OAAO,YAAY,CAAC;QACtB,CAAC;KAAA;IAfqB,cAAA,KAAK,QAe1B,CAAA;AACH,CAAC,EA7BgB,aAAa,aAAb,aAAa,GAAb,aAAa,QA6B7B"}
1
+ {"version":3,"file":"DynamicModule.js","sourceRoot":"","sources":["../../src/decorators/DynamicModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAwC;AAIxC,gEAA8D;AAE9D;;;;;;;;;;;;GAYG;AACH,IAAiB,aAAa,CAoC7B;AApCD,WAAiB,aAAa;IAC5B;;;;;;;;;;;;;;;;;;OAkBG;IACH,SAAsB,KAAK;6DACzB,IAAmE,EACnE,QAAQ,GAAwC,EAAE,EAClD,QAAkB;YAElB,mBAAmB;YACnB,MAAM,WAAW,GAAsB,MAAM,IAAA,kCAAgB,EAC3D,IAAI,EACJ,QAAQ,CACT,CAAC;YAEF,yBAAyB;gBAEnB,YAAY;wCADjB,IAAA,eAAM,kCAAM,QAAQ,KAAE,WAAW,IAAG;;;;;;;;;oBACrC,6KAAqB;;;oBAAf,uDAAY;;;;YAClB,OAAO,YAAY,CAAC;QACtB,CAAC;KAAA;IAfqB,cAAA,KAAK,QAe1B,CAAA;AACH,CAAC,EApCgB,aAAa,aAAb,aAAa,GAAb,aAAa,QAoC7B"}
@@ -3,21 +3,29 @@ import { IRequestBodyValidator } from "../options/IRequestBodyValidator";
3
3
  * Encrypted body decorator.
4
4
  *
5
5
  * `EncryptedBody` is a decorator function getting `application/json` typed data
6
- * from request body which has been encrypted by AES-128/256 algorithm. Also,
7
- * `EncryptedBody` validates the request body data type through
8
- * [typia](https://github.com/samchon/typia) ad the validation speed is maximum
9
- * 15,000x times faster than `class-validator`.
6
+ * from request body which has been encrypted by AES-128/192/256 algorithm.
7
+ * Also, `EncryptedBody` validates the request body data type through
8
+ * [typia](https://github.com/samchon/typia) using the declared TypeScript
9
+ * type.
10
10
  *
11
11
  * For reference, when the request body data is not following the promised type
12
12
  * `T`, `BadRequestException` error (status code: 400) would be thrown. Also,
13
- * `EncryptedRoute` decrypts request body using those options.
13
+ * This decorator decrypts the request body using these options.
14
14
  *
15
- * - AES-128/256
15
+ * - AES-128/192/256
16
16
  * - CBC mode
17
17
  * - PKCS #5 Padding
18
18
  * - Base64 Encoding
19
19
  *
20
+ * Successful validator data becomes the decorated argument, including copies
21
+ * returned by clone validators after decryption and JSON parsing.
22
+ *
20
23
  * @author Jeongho Nam - https://github.com/samchon
21
24
  * @returns Parameter decorator
25
+ * @evidence contracts/common.md#principled-implementation The body must be `text/plain` ciphertext; it is decrypted with the password of the controller or module, the plain text is parsed as JSON and validated by the transformed validator, and a decryption or parse failure becomes a 400 with one fixed message that does not echo the ciphertext and does not tell the two failures apart; a key or initialization vector the cipher itself refuses is the server's configuration, independent of the request, and is thrown as it is.
26
+ * @evidence contracts/common.md#clear-and-simple-design One parameter decorator composes shared text reading, password lookup and validator resolution; the successfully resolved data becomes the argument without repeating validation or changing decryption error handling.
27
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The algorithm comes from `AesPkcs5` of the fetcher, the same one the client uses, and no key is embedded; a missing password is an error rather than a plain pass-through.
28
+ * @evidence contracts/common.md#meaningful-documentation The comment describes the protocol and the requirement of a password on the controller or module, and the private decode helper documents why every decryption failure collapses into one response.
29
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Ciphertext parsing, AES decryption and request validation operate on HTTP values, with no native filesystem or subprocess boundary.
22
30
  */
23
31
  export declare function EncryptedBody<T>(validator?: IRequestBodyValidator<T>): ParameterDecorator;
@@ -22,22 +22,30 @@ const validate_request_body_1 = require("./internal/validate_request_body");
22
22
  * Encrypted body decorator.
23
23
  *
24
24
  * `EncryptedBody` is a decorator function getting `application/json` typed data
25
- * from request body which has been encrypted by AES-128/256 algorithm. Also,
26
- * `EncryptedBody` validates the request body data type through
27
- * [typia](https://github.com/samchon/typia) ad the validation speed is maximum
28
- * 15,000x times faster than `class-validator`.
25
+ * from request body which has been encrypted by AES-128/192/256 algorithm.
26
+ * Also, `EncryptedBody` validates the request body data type through
27
+ * [typia](https://github.com/samchon/typia) using the declared TypeScript
28
+ * type.
29
29
  *
30
30
  * For reference, when the request body data is not following the promised type
31
31
  * `T`, `BadRequestException` error (status code: 400) would be thrown. Also,
32
- * `EncryptedRoute` decrypts request body using those options.
32
+ * This decorator decrypts the request body using these options.
33
33
  *
34
- * - AES-128/256
34
+ * - AES-128/192/256
35
35
  * - CBC mode
36
36
  * - PKCS #5 Padding
37
37
  * - Base64 Encoding
38
38
  *
39
+ * Successful validator data becomes the decorated argument, including copies
40
+ * returned by clone validators after decryption and JSON parsing.
41
+ *
39
42
  * @author Jeongho Nam - https://github.com/samchon
40
43
  * @returns Parameter decorator
44
+ * @evidence contracts/common.md#principled-implementation The body must be `text/plain` ciphertext; it is decrypted with the password of the controller or module, the plain text is parsed as JSON and validated by the transformed validator, and a decryption or parse failure becomes a 400 with one fixed message that does not echo the ciphertext and does not tell the two failures apart; a key or initialization vector the cipher itself refuses is the server's configuration, independent of the request, and is thrown as it is.
45
+ * @evidence contracts/common.md#clear-and-simple-design One parameter decorator composes shared text reading, password lookup and validator resolution; the successfully resolved data becomes the argument without repeating validation or changing decryption error handling.
46
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The algorithm comes from `AesPkcs5` of the fetcher, the same one the client uses, and no key is embedded; a missing password is an error rather than a plain pass-through.
47
+ * @evidence contracts/common.md#meaningful-documentation The comment describes the protocol and the requirement of a password on the controller or module, and the private decode helper documents why every decryption failure collapses into one response.
48
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Ciphertext parsing, AES decryption and request validation operate on HTTP values, with no native filesystem or subprocess boundary.
41
49
  */
42
50
  function EncryptedBody(validator) {
43
51
  const checker = (0, validate_request_body_1.validate_request_body)("EncryptedBody")(validator);
@@ -59,10 +67,10 @@ function EncryptedBody(validator) {
59
67
  : param;
60
68
  // PARSE AND VALIDATE DATA
61
69
  const data = decode(body, password.key, password.iv);
62
- const error = checker(data);
63
- if (error !== null)
64
- throw error;
65
- return data;
70
+ const result = checker.resolve(data);
71
+ if (!result.success)
72
+ throw result.error;
73
+ return result.data;
66
74
  });
67
75
  })();
68
76
  }
@@ -79,9 +87,13 @@ function EncryptedBody(validator) {
79
87
  *
80
88
  * Both failure modes must therefore collapse into one indistinguishable
81
89
  * `BadRequestException` (identical status, message, and body). Only the
82
- * downstream type validation of an already-parsed body may report its own
83
- * distinct error, because reaching it requires plaintext the attacker cannot
84
- * forge without already knowing it.
90
+ * downstream type validation of an already-parsed body reports its own distinct
91
+ * error. AES-CBC provides no authentication; collapsing parse and padding
92
+ * errors does not establish ciphertext authenticity.
93
+ *
94
+ * A key or initialization vector the cipher refuses is thrown as it is. It says
95
+ * nothing about the body, so it opens no oracle, and it is a defect of the
96
+ * server's configuration that a 400 would blame on the client.
85
97
  *
86
98
  * @internal
87
99
  */
@@ -90,10 +102,21 @@ const decode = (body, key, iv) => {
90
102
  return JSON.parse(AesPkcs5_1.AesPkcs5.decrypt(body, key, iv));
91
103
  }
92
104
  catch (exp) {
93
- if (exp instanceof Error)
105
+ // A password the cipher itself refuses is the server's configuration, which
106
+ // no request body can influence, so it is no oracle and no client's fault.
107
+ if (exp instanceof Error && PASSWORD_ERRORS.has(exp.code))
108
+ throw exp;
109
+ else if (exp instanceof Error)
94
110
  throw new common_1.BadRequestException("Failed to decrypt the request body. Check your body content or encryption password.");
95
111
  else
96
112
  throw exp;
97
113
  }
98
114
  };
115
+ /** The error codes of a key or an initialization vector the cipher refuses. */
116
+ const PASSWORD_ERRORS = new Set([
117
+ "ERR_INVALID_ARG_TYPE",
118
+ "ERR_CRYPTO_INVALID_IV",
119
+ "ERR_CRYPTO_INVALID_KEYLEN",
120
+ "ERR_CRYPTO_UNKNOWN_CIPHER",
121
+ ]);
99
122
  //# sourceMappingURL=EncryptedBody.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EncryptedBody.js","sourceRoot":"","sources":["../../src/decorators/EncryptedBody.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,2DAAwD;AACxD,2CAIwB;AAKxB,kDAA+C;AAC/C,gFAA6E;AAC7E,4DAAyD;AACzD,oEAAiE;AACjE,4DAAyD;AACzD,4EAAyE;AAEzE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,uBACE,SAAoC;IAEpC,MAAM,OAAO,GAAG,IAAA,6CAAqB,EAAC,eAAe,CAAC,CAAC,SAAS,CAAC,CAAC;IAClE,OAAO,IAAA,6BAAoB,EAAC,SAAe,aAAa,CACtD,QAAa,EACb,OAAyB;;YAEzB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tB,uBAAuB;IACvB,2BAA2B;IAC3B,2BAA2B;CAC5B,CAAC,CAAC"}
@@ -3,7 +3,7 @@ import { IEncryptionPassword } from "@nestia/fetcher";
3
3
  * Encrypted controller.
4
4
  *
5
5
  * `EncryptedController` is an extension of the {@link nest.Controller} class
6
- * decorator function who configures encryption password of the AES-128/256
6
+ * decorator function who configures encryption password of the AES-128/192/256
7
7
  * algorithm. The encryption algorithm and password would be used by
8
8
  * {@link EncryptedRoute} and {@link EncryptedBody} to encrypt the request and
9
9
  * response body of the HTTP protocol.
@@ -24,5 +24,10 @@ import { IEncryptionPassword } from "@nestia/fetcher";
24
24
  * @param path Path of the HTTP request
25
25
  * @param password Encryption password or its getter function
26
26
  * @returns Class decorator
27
+ * @evidence contracts/common.md#principled-implementation The decorator stores the password as metadata on the class and then applies Nest's `Controller(path)`, so the encrypted decorators can find the password by reading the class.
28
+ * @evidence contracts/common.md#clear-and-simple-design One decorator that composes a metadata write with the standard decorator.
29
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It uses Nest's public `Controller` decorator and the reflect metadata API.
30
+ * @evidence contracts/common.md#meaningful-documentation The comment states the password forms and the encrypted decorators it enables.
31
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Controller paths are HTTP routing metadata and passwords are in-memory values; neither is a native filesystem path.
27
32
  */
28
33
  export declare function EncryptedController(path: string, password: IEncryptionPassword | IEncryptionPassword.Closure): ClassDecorator;
@@ -7,7 +7,7 @@ const EncryptedConstant_1 = require("./internal/EncryptedConstant");
7
7
  * Encrypted controller.
8
8
  *
9
9
  * `EncryptedController` is an extension of the {@link nest.Controller} class
10
- * decorator function who configures encryption password of the AES-128/256
10
+ * decorator function who configures encryption password of the AES-128/192/256
11
11
  * algorithm. The encryption algorithm and password would be used by
12
12
  * {@link EncryptedRoute} and {@link EncryptedBody} to encrypt the request and
13
13
  * response body of the HTTP protocol.
@@ -28,6 +28,11 @@ const EncryptedConstant_1 = require("./internal/EncryptedConstant");
28
28
  * @param path Path of the HTTP request
29
29
  * @param password Encryption password or its getter function
30
30
  * @returns Class decorator
31
+ * @evidence contracts/common.md#principled-implementation The decorator stores the password as metadata on the class and then applies Nest's `Controller(path)`, so the encrypted decorators can find the password by reading the class.
32
+ * @evidence contracts/common.md#clear-and-simple-design One decorator that composes a metadata write with the standard decorator.
33
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It uses Nest's public `Controller` decorator and the reflect metadata API.
34
+ * @evidence contracts/common.md#meaningful-documentation The comment states the password forms and the encrypted decorators it enables.
35
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Controller paths are HTTP routing metadata and passwords are in-memory values; neither is a native filesystem path.
31
36
  */
32
37
  function EncryptedController(path, password) {
33
38
  return function (target) {
@@ -1 +1 @@
1
- {"version":3,"file":"EncryptedController.js","sourceRoot":"","sources":["../../src/decorators/EncryptedController.ts"],"names":[],"mappings":";;;AACA,2CAA4C;AAE5C,oEAAkF;AAElF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,6BACE,IAAY,EACZ,QAA2D;IAE3D,OAAO,UAAU,MAAW;QAC1B,OAAO,CAAC,cAAc,CACpB,sDAAkC,EAClC,QAAQ,EACR,MAAM,CACP,CAAC;QACF,IAAA,mBAAU,EAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"EncryptedController.js","sourceRoot":"","sources":["../../src/decorators/EncryptedController.ts"],"names":[],"mappings":";;;AACA,2CAA4C;AAE5C,oEAAkF;AAElF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,6BACE,IAAY,EACZ,QAA2D;IAE3D,OAAO,UAAU,MAAW;QAC1B,OAAO,CAAC,cAAc,CACpB,sDAAkC,EAClC,QAAQ,EACR,MAAM,CACP,CAAC;QACF,IAAA,mBAAU,EAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC,CAAC;AACJ,CAAC"}
@@ -4,9 +4,9 @@ import { Module } from "@nestjs/common";
4
4
  * Encrypted module.
5
5
  *
6
6
  * `EncryptedModule` is an extension of the {@link Module} class decorator
7
- * function who configures encryption password of the AES-128/256 algorithm. The
8
- * encryption algorithm and password would be used by {@link EncryptedRoute} and
9
- * {@link EncryptedBody} to encrypt the request and response bod of the HTTP
7
+ * function who configures encryption password of the AES-128/192/256 algorithm.
8
+ * The encryption algorithm and password would be used by {@link EncryptedRoute}
9
+ * and {@link EncryptedBody} to encrypt the request and response bod of the HTTP
10
10
  * protocol.
11
11
  *
12
12
  * By using this `EncryptedModule` decorator function, all of the
@@ -33,8 +33,23 @@ import { Module } from "@nestjs/common";
33
33
  * @param metadata Module configuration metadata
34
34
  * @param password Encryption password or its getter function
35
35
  * @returns Class decorator
36
+ * @evidence contracts/common.md#principled-implementation A visited set breaks import cycles, the controllers of each visited module get the password as metadata, asynchronous modules are awaited through the same promise Nest awaits, and a forward reference is resolved once its class exists.
37
+ * @evidence contracts/common.md#clear-and-simple-design One decorator whose traversal is a private function; the dynamic-module helper is in the merged namespace.
38
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The traversal uses the public metadata keys of Nest modules; no module name is special-cased.
39
+ * @evidence contracts/common.md#meaningful-documentation The comment states which module shapes are followed.
40
+ * @evidence contracts/portability.md#os-neutral-implementation The decorator traverses Nest module metadata in memory; its dynamic helper delegates native paths and file-URL imports to load_controllers instead of composing platform-specific import strings.
36
41
  */
37
42
  export declare function EncryptedModule(metadata: Parameters<typeof Module>[0], password: IEncryptionPassword.Closure): ClassDecorator;
43
+ /**
44
+ * Helpers of {@link EncryptedModule}, namely `dynamic`, which builds an
45
+ * encrypted module from controller paths.
46
+ *
47
+ * @evidence contracts/common.md#principled-implementation `dynamic` loads the controllers with the shared loader, wraps an object password into a closure, and returns a class decorated by `EncryptedModule`.
48
+ * @evidence contracts/common.md#clear-and-simple-design One function that reuses the loader and the decorator.
49
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Paths and password are caller input.
50
+ * @evidence contracts/common.md#meaningful-documentation The comment documents the path forms and the password argument.
51
+ * @evidence contracts/portability.md#os-neutral-implementation The decorator traverses Nest module metadata in memory; its dynamic helper delegates native paths and file-URL imports to load_controllers instead of composing platform-specific import strings.
52
+ */
38
53
  export declare namespace EncryptedModule {
39
54
  /**
40
55
  * Dynamic encrypted module.
@@ -55,9 +55,9 @@ const load_controller_1 = require("./internal/load_controller");
55
55
  * Encrypted module.
56
56
  *
57
57
  * `EncryptedModule` is an extension of the {@link Module} class decorator
58
- * function who configures encryption password of the AES-128/256 algorithm. The
59
- * encryption algorithm and password would be used by {@link EncryptedRoute} and
60
- * {@link EncryptedBody} to encrypt the request and response bod of the HTTP
58
+ * function who configures encryption password of the AES-128/192/256 algorithm.
59
+ * The encryption algorithm and password would be used by {@link EncryptedRoute}
60
+ * and {@link EncryptedBody} to encrypt the request and response bod of the HTTP
61
61
  * protocol.
62
62
  *
63
63
  * By using this `EncryptedModule` decorator function, all of the
@@ -84,6 +84,11 @@ const load_controller_1 = require("./internal/load_controller");
84
84
  * @param metadata Module configuration metadata
85
85
  * @param password Encryption password or its getter function
86
86
  * @returns Class decorator
87
+ * @evidence contracts/common.md#principled-implementation A visited set breaks import cycles, the controllers of each visited module get the password as metadata, asynchronous modules are awaited through the same promise Nest awaits, and a forward reference is resolved once its class exists.
88
+ * @evidence contracts/common.md#clear-and-simple-design One decorator whose traversal is a private function; the dynamic-module helper is in the merged namespace.
89
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The traversal uses the public metadata keys of Nest modules; no module name is special-cased.
90
+ * @evidence contracts/common.md#meaningful-documentation The comment states which module shapes are followed.
91
+ * @evidence contracts/portability.md#os-neutral-implementation The decorator traverses Nest module metadata in memory; its dynamic helper delegates native paths and file-URL imports to load_controllers instead of composing platform-specific import strings.
87
92
  */
88
93
  function EncryptedModule(metadata, password) {
89
94
  return function (target) {
@@ -91,6 +96,16 @@ function EncryptedModule(metadata, password) {
91
96
  iterate(password)(target);
92
97
  };
93
98
  }
99
+ /**
100
+ * Helpers of {@link EncryptedModule}, namely `dynamic`, which builds an
101
+ * encrypted module from controller paths.
102
+ *
103
+ * @evidence contracts/common.md#principled-implementation `dynamic` loads the controllers with the shared loader, wraps an object password into a closure, and returns a class decorated by `EncryptedModule`.
104
+ * @evidence contracts/common.md#clear-and-simple-design One function that reuses the loader and the decorator.
105
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Paths and password are caller input.
106
+ * @evidence contracts/common.md#meaningful-documentation The comment documents the path forms and the password argument.
107
+ * @evidence contracts/portability.md#os-neutral-implementation The decorator traverses Nest module metadata in memory; its dynamic helper delegates native paths and file-URL imports to load_controllers instead of composing platform-specific import strings.
108
+ */
94
109
  (function (EncryptedModule) {
95
110
  /**
96
111
  * Dynamic encrypted module.
@@ -1 +1 @@
1
- {"version":3,"file":"EncryptedModule.js","sourceRoot":"","sources":["../../src/decorators/EncryptedModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAAwC;AAGxC,oEAAuE;AACvE,gEAA8D;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,yBACE,QAAsC,EACtC,QAAqC;IAErC,OAAO,UAAU,MAAW;QAC1B,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;QACzB,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC,CAAC;AACJ,CAAC;AAED,WAAiB,eAAe;IAC9B;;;;;;;;;;;;OAYG;IACH,SAAsB,OAAO;6DAC3B,IAAmE,EACnE,QAA2D,EAC3D,OAAO,GAAsD,EAAE,EAC/D,QAAkB;YAElB,mBAAmB;YACnB,MAAM,WAAW,GAAsB,MAAM,IAAA,kCAAgB,EAC3D,IAAI,EACJ,QAAQ,CACT,CAAC;YAEF,0BAA0B;gBAKpB,YAAY;wCAJjB,eAAe,iC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S;gBAAE,KAAK,CAAC,MAAM,CAAC,CAAC;;gBACnC,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC3D,CAAC;aAAM,CAAC;YACN,MAAM,OAAO,GAAG,KAIf,CAAC;YACF,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACtB,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACzB,WAAW,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QACnC,CAAC;IACH,CAAC,CAAC;IACF,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
@@ -4,22 +4,26 @@ import { TypedRoute } from "./TypedRoute";
4
4
  * Encrypted router decorator functions.
5
5
  *
6
6
  * `EncryptedRoute` is a module containing router decorator functions which
7
- * encrypts response body data through AES-128/256 encryption. Furthermore, they
8
- * can boost up JSON string conversion speed about 50x times faster than
9
- * `class-transformer`, even type safe through
10
- * [typia](https://github.com/samchon/typia).
7
+ * encrypts response body data through AES-128/192/256 encryption after
8
+ * serializing it with a [typia](https://github.com/samchon/typia) function
9
+ * generated from the declared return type.
11
10
  *
12
- * For reference, if you try to invalid data that is not following the promised
13
- * type `T`, 500 internal server error would be thrown. Also, as
14
- * `EncryptedRoute` composes JSON string through `typia.assertStringify<T>()`
15
- * function, it is not possible to modify response data through interceptors.
11
+ * The default assert serializer rejects a response outside the declared type
12
+ * with a 500 error. The configured stringify mode chooses the validation policy
13
+ * before encryption; `validate.log` logs failures and serializes the original
14
+ * value. Interceptors running afterwards receive ciphertext.
16
15
  *
17
- * - AES-128/256
16
+ * - AES-128/192/256
18
17
  * - CBC mode
19
18
  * - PKCS #5 Padding
20
19
  * - Base64 Encoding
21
20
  *
22
21
  * @author Jeongho Nam - https://github.com/samchon
22
+ * @evidence contracts/common.md#principled-implementation Each route method decorates Nest's router decorator with an interceptor that serializes the value as the transform chose, encrypts it with the password of the controller or module, and answers `text/plain` on success only, so an error keeps its own JSON type.
23
+ * @evidence contracts/common.md#clear-and-simple-design One generator function creates the five HTTP-method decorators, and the interceptor and the router table are module-private.
24
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The password lookup and the serializer come from shared modules; the loop after the namespace copies the marker properties of typia's stringify functions onto the five decorators as the transform expects, which mutates only these exported functions.
25
+ * @evidence contracts/common.md#meaningful-documentation The comment documents the decorator family and its password requirement.
26
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Route paths and serialized ciphertext are HTTP protocol values; response interception does not access native files or launch a process.
23
27
  */
24
28
  export declare namespace EncryptedRoute {
25
29
  /**
@@ -34,7 +38,7 @@ export declare namespace EncryptedRoute {
34
38
  <T>(path: string | string[], stringify?: IResponseBodyStringifier<T> | null): MethodDecorator;
35
39
  };
36
40
  /**
37
- * Encrypted router decorator function for the GET method.
41
+ * Encrypted router decorator function for the POST method.
38
42
  *
39
43
  * @param paths Path(s) of the HTTP request
40
44
  * @returns Method decorator
@@ -83,7 +87,7 @@ export declare namespace EncryptedRoute {
83
87
  * If you've configured the transformation option to `validate.log` in the
84
88
  * `tsconfig.json` file, then the error log information of the response
85
89
  * validation failure would be logged through this function instead of
86
- * throwing the 400 bad request error.
90
+ * throwing the 500 internal server error.
87
91
  *
88
92
  * By the way, be careful. If you've configured the response transformation
89
93
  * option to be `validate.log`, client may get wrong response data. Therefore,
@@ -91,6 +95,11 @@ export declare namespace EncryptedRoute {
91
95
  *
92
96
  * @default console.log
93
97
  * @param func Logger function
98
+ * @evidence contracts/common.md#principled-implementation It stores the logger in `TypedRoute`, which owns the single logger both route families use.
99
+ * @evidence contracts/common.md#clear-and-simple-design A one-line delegation, so the logger has one owner.
100
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It changes only the logger variable.
101
+ * @evidence contracts/common.md#meaningful-documentation The comment states which validate mode uses the logger.
102
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Route paths and serialized ciphertext are HTTP protocol values; response interception does not access native files or launch a process.
94
103
  */
95
104
  function setValidateErrorLogger(func: (log: IValidateErrorLog) => void): void;
96
105
  export import IValidateErrorLog = TypedRoute.IValidateErrorLog;
@@ -18,22 +18,26 @@ const route_error_1 = require("./internal/route_error");
18
18
  * Encrypted router decorator functions.
19
19
  *
20
20
  * `EncryptedRoute` is a module containing router decorator functions which
21
- * encrypts response body data through AES-128/256 encryption. Furthermore, they
22
- * can boost up JSON string conversion speed about 50x times faster than
23
- * `class-transformer`, even type safe through
24
- * [typia](https://github.com/samchon/typia).
21
+ * encrypts response body data through AES-128/192/256 encryption after
22
+ * serializing it with a [typia](https://github.com/samchon/typia) function
23
+ * generated from the declared return type.
25
24
  *
26
- * For reference, if you try to invalid data that is not following the promised
27
- * type `T`, 500 internal server error would be thrown. Also, as
28
- * `EncryptedRoute` composes JSON string through `typia.assertStringify<T>()`
29
- * function, it is not possible to modify response data through interceptors.
25
+ * The default assert serializer rejects a response outside the declared type
26
+ * with a 500 error. The configured stringify mode chooses the validation policy
27
+ * before encryption; `validate.log` logs failures and serializes the original
28
+ * value. Interceptors running afterwards receive ciphertext.
30
29
  *
31
- * - AES-128/256
30
+ * - AES-128/192/256
32
31
  * - CBC mode
33
32
  * - PKCS #5 Padding
34
33
  * - Base64 Encoding
35
34
  *
36
35
  * @author Jeongho Nam - https://github.com/samchon
36
+ * @evidence contracts/common.md#principled-implementation Each route method decorates Nest's router decorator with an interceptor that serializes the value as the transform chose, encrypts it with the password of the controller or module, and answers `text/plain` on success only, so an error keeps its own JSON type.
37
+ * @evidence contracts/common.md#clear-and-simple-design One generator function creates the five HTTP-method decorators, and the interceptor and the router table are module-private.
38
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The password lookup and the serializer come from shared modules; the loop after the namespace copies the marker properties of typia's stringify functions onto the five decorators as the transform expects, which mutates only these exported functions.
39
+ * @evidence contracts/common.md#meaningful-documentation The comment documents the decorator family and its password requirement.
40
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Route paths and serialized ciphertext are HTTP protocol values; response interception does not access native files or launch a process.
37
41
  */
38
42
  var EncryptedRoute;
39
43
  (function (EncryptedRoute) {
@@ -45,7 +49,7 @@ var EncryptedRoute;
45
49
  */
46
50
  EncryptedRoute.Get = Generator("Get");
47
51
  /**
48
- * Encrypted router decorator function for the GET method.
52
+ * Encrypted router decorator function for the POST method.
49
53
  *
50
54
  * @param paths Path(s) of the HTTP request
51
55
  * @returns Method decorator
@@ -78,7 +82,7 @@ var EncryptedRoute;
78
82
  * If you've configured the transformation option to `validate.log` in the
79
83
  * `tsconfig.json` file, then the error log information of the response
80
84
  * validation failure would be logged through this function instead of
81
- * throwing the 400 bad request error.
85
+ * throwing the 500 internal server error.
82
86
  *
83
87
  * By the way, be careful. If you've configured the response transformation
84
88
  * option to be `validate.log`, client may get wrong response data. Therefore,
@@ -86,6 +90,11 @@ var EncryptedRoute;
86
90
  *
87
91
  * @default console.log
88
92
  * @param func Logger function
93
+ * @evidence contracts/common.md#principled-implementation It stores the logger in `TypedRoute`, which owns the single logger both route families use.
94
+ * @evidence contracts/common.md#clear-and-simple-design A one-line delegation, so the logger has one owner.
95
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It changes only the logger variable.
96
+ * @evidence contracts/common.md#meaningful-documentation The comment states which validate mode uses the logger.
97
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Route paths and serialized ciphertext are HTTP protocol values; response interception does not access native files or launch a process.
89
98
  */
90
99
  function setValidateErrorLogger(func) {
91
100
  TypedRoute_1.TypedRoute.setValidateErrorLogger(func);
@@ -1 +1 @@
1
- {"version":3,"file":"EncryptedRoute.js","sourceRoot":"","sources":["../../src/decorators/EncryptedRoute.ts"],"names":[],"mappings":";;;;;;AACA,2DAAwD;AACxD,2CAWwB;AAGxB,8CAAiD;AACjD,kDAA0B;AAG1B,kDAA+C;AAC/C,6CAA0C;AAC1C,gFAA6E;AAC7E,8EAA2E;AAC3E,oEAAiE;AACjE,wDAAqD;AAErD;;;;;;;;;;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E,CAAC;YACtD,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;YAC9C,OAAO,mBAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;QAC3D,CAAC,CAAC,EACF,IAAA,sBAAU,EAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,yBAAW,EAAC,IAAI,CAAC,UAAU,EAAE,EAAE,GAAG,CAAC,CAAC,CACzD,CAAC;IACJ,CAAC;CACF;AAED,gBAAgB;AAChB,MAAM,OAAO,GAAG;IACd,GAAG,EAAH,YAAG;IACH,IAAI,EAAJ,aAAI;IACJ,GAAG,EAAH,YAAG;IACH,KAAK,EAAL,cAAK;IACL,MAAM,EAAN,eAAM;CACP,CAAC"}
@@ -11,5 +11,10 @@
11
11
  *
12
12
  * @author Jeongho Nam - https://github.com/samchon
13
13
  * @returns Method decorator
14
+ * @evidence contracts/common.md#principled-implementation The decorator marks the operation with the `x-samchon-human` extension through `SwaggerCustomizer`, so the generated document carries the mark without another metadata path.
15
+ * @evidence contracts/common.md#clear-and-simple-design One call to the customizer.
16
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The extension name is the documented contract of the generated document.
17
+ * @evidence contracts/common.md#meaningful-documentation The comment states that a marked API is left out of the LLM function calling schema.
18
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The OpenAPI extension is an in-memory document property and has no native path or process representation.
14
19
  */
15
20
  export declare function HumanRoute(): MethodDecorator;
@@ -15,6 +15,11 @@ const SwaggerCustomizer_1 = require("./SwaggerCustomizer");
15
15
  *
16
16
  * @author Jeongho Nam - https://github.com/samchon
17
17
  * @returns Method decorator
18
+ * @evidence contracts/common.md#principled-implementation The decorator marks the operation with the `x-samchon-human` extension through `SwaggerCustomizer`, so the generated document carries the mark without another metadata path.
19
+ * @evidence contracts/common.md#clear-and-simple-design One call to the customizer.
20
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The extension name is the documented contract of the generated document.
21
+ * @evidence contracts/common.md#meaningful-documentation The comment states that a marked API is left out of the LLM function calling schema.
22
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The OpenAPI extension is an in-memory document property and has no native path or process representation.
18
23
  */
19
24
  function HumanRoute() {
20
25
  return (0, SwaggerCustomizer_1.SwaggerCustomizer)((props) => {
@@ -1 +1 @@
1
- {"version":3,"file":"HumanRoute.js","sourceRoot":"","sources":["../../src/decorators/HumanRoute.ts"],"names":[],"mappings":";;;AAAA,2DAAwD;AAExD;;;;;;;;;;;;;GAaG;AACH;IACE,OAAO,IAAA,qCAAiB,EAAC,CAAC,KAAK,EAAE,EAAE;QACjC,KAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC;IACxC,CAAC,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"HumanRoute.js","sourceRoot":"","sources":["../../src/decorators/HumanRoute.ts"],"names":[],"mappings":";;;AAAA,2DAAwD;AAExD;;;;;;;;;;;;;;;;;;GAkBG;AACH;IACE,OAAO,IAAA,qCAAiB,EAAC,CAAC,KAAK,EAAE,EAAE;QACjC,KAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC;IACxC,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -22,31 +22,42 @@ import { IRequestBodyValidator } from "../options/IRequestBodyValidator";
22
22
  * the {@link INestApplication} instance at bootstrap. The decorator alone only
23
23
  * stores reflection metadata.
24
24
  *
25
- * @author wildduck - https://github.com/wildduck2
26
- * @example
27
- * ```typescript
28
- * import core from "@nestia/core";
25
+ * Example:
26
+ *
27
+ * ```typescript
28
+ * import core from "@nestia/core";
29
29
  *
30
- * @Controller()
31
- * export class WeatherController {
32
- * /**
33
- * * Return current weather for a city.
34
- * *
35
- * * @title Get weather
36
- * *\/
37
- * @core.McpRoute("get_weather")
38
- * public async get(
39
- * @core.McpRoute.Params() params: { city: string },
40
- * ): Promise<{ temp: number }> {
41
- * return { temp: 22 };
42
- * }
30
+ * @Controller()
31
+ * export class WeatherController {
32
+ * /**
33
+ * * Return current weather for a city.
34
+ * *
35
+ * * @title Get weather
36
+ * *\/
37
+ * @core.McpRoute("get_weather")
38
+ * public async get(
39
+ * @core.McpRoute.Params() params: { city: string },
40
+ * ): Promise<{ temp: number }> {
41
+ * return { temp: 22 };
43
42
  * }
44
- * ```;
43
+ * }
44
+ * ```
45
45
  *
46
+ * @author wildduck - https://github.com/wildduck2
46
47
  * @param name Unique tool identifier exposed to MCP clients via `tools/list`.
47
48
  * @returns Method decorator.
48
49
  */
49
50
  export declare function McpRoute(name: string): MethodDecorator;
51
+ /**
52
+ * Types and parameter decorator of {@link McpRoute}: the tool configuration and
53
+ * `McpRoute.Params`.
54
+ *
55
+ * @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.
56
+ * @evidence contracts/common.md#clear-and-simple-design Two decorators and one config type in one namespace, sharing one `emplace` helper for parameter metadata.
57
+ * @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.
58
+ * @evidence contracts/common.md#meaningful-documentation The comment documents the two call forms, the configuration fields, and the parameter decorator.
59
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Tool schemas and parameter metadata are protocol data held on controller methods, without native filesystem access.
60
+ */
50
61
  export declare namespace McpRoute {
51
62
  /**
52
63
  * Parameter decorator for an MCP tool's input arguments.
@@ -55,7 +66,8 @@ export declare namespace McpRoute {
55
66
  * `tools/call` request against the TypeScript type `T` using typia. A failed
56
67
  * validation surfaces to the client as a JSON-RPC `-32602` (`InvalidParams`)
57
68
  * error with structured diagnostics, giving the LLM precise feedback to
58
- * self-correct.
69
+ * self-correct. Successful assert and validate data becomes the tool
70
+ * argument, so clone validators can supply a copy of the incoming arguments.
59
71
  *
60
72
  * MCP tools accept exactly one arguments object; applying this decorator more
61
73
  * than once on a single method is a compile-time error. The decorated type