@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.
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 +13 -1
  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 +37 -2
  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 +9 -7
  116. package/src/adaptors/McpAdaptor.ts +86 -26
  117. package/src/adaptors/WebSocketAdaptor.ts +70 -15
  118. package/src/adaptors/internal/external_context.ts +43 -6
  119. package/src/decorators/DynamicModule.ts +13 -1
  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 +21 -12
  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 +60 -2
  132. package/src/decorators/TypedHeaders.ts +5 -0
  133. package/src/decorators/TypedParam.ts +9 -0
  134. package/src/decorators/TypedQuery.ts +17 -1
  135. package/src/decorators/TypedRoute.ts +26 -11
  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 +47 -14
@@ -19,6 +19,15 @@
19
19
  *
20
20
  * @author Jeongho Nam - https://github.com/samchon
21
21
  * @param name URL Parameter name
22
+ * @param assert Conversion and assertion supplied by the compile-time transform
23
+ * @param validate Emit an errors array on validation failure when true;
24
+ * otherwise expose the first failure as flat path, reason, expected and value
25
+ * fields.
22
26
  * @returns Parameter decorator
27
+ * @evidence contracts/common.md#principled-implementation The path parameter arrives as a string and is converted by the assertion function the transform generated for the declared type, so a value of the wrong type produces a 400 that names the parameter; the `validate` flag only changes the error body from the flat form to an `errors` array.
28
+ * @evidence contracts/common.md#clear-and-simple-design One decorator with one conversion function and one error-shaping branch.
29
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The conversion is generated from the declared type; without the transform the raw string is returned only when the configuration guard is off.
30
+ * @evidence contracts/common.md#meaningful-documentation The comment documents the supported types and the two error shapes.
31
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The named path segment is an HTTP route parameter whose text is decoded by the generated validator; no native path is resolved.
23
32
  */
24
33
  export declare function TypedParam<T extends boolean | bigint | number | string | null>(name: string, assert?: (value: string) => T, validate?: boolean): ParameterDecorator;
@@ -28,7 +28,16 @@ const NoTransformConfigurationError_1 = require("./NoTransformConfigurationError
28
28
  *
29
29
  * @author Jeongho Nam - https://github.com/samchon
30
30
  * @param name URL Parameter name
31
+ * @param assert Conversion and assertion supplied by the compile-time transform
32
+ * @param validate Emit an errors array on validation failure when true;
33
+ * otherwise expose the first failure as flat path, reason, expected and value
34
+ * fields.
31
35
  * @returns Parameter decorator
36
+ * @evidence contracts/common.md#principled-implementation The path parameter arrives as a string and is converted by the assertion function the transform generated for the declared type, so a value of the wrong type produces a 400 that names the parameter; the `validate` flag only changes the error body from the flat form to an `errors` array.
37
+ * @evidence contracts/common.md#clear-and-simple-design One decorator with one conversion function and one error-shaping branch.
38
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The conversion is generated from the declared type; without the transform the raw string is returned only when the configuration guard is off.
39
+ * @evidence contracts/common.md#meaningful-documentation The comment documents the supported types and the two error shapes.
40
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The named path segment is an HTTP route parameter whose text is decoded by the generated validator; no native path is resolved.
32
41
  */
33
42
  function TypedParam(name, assert, validate) {
34
43
  if (assert === undefined) {
@@ -1 +1 @@
1
- {"version":3,"file":"TypedParam.js","sourceRoot":"","sources":["../../src/decorators/TypedParam.ts"],"names":[],"mappings":";;;;;;AAAA,2CAIwB;AAGxB,kDAA2D;AAE3D,mFAAgF;AAEhF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,oBACE,IAAY,EACZ,MAA6B,EAC7B,QAAkB;IAElB,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,IAAA,6DAA6B,EAAC,YAAY,CAAC,CAAC;QAC5C,MAAM,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,KAAU,CAAC;IACjC,CAAC;IAED,OAAO,IAAA,6BAAoB,EAAC,SAAS,UAAU,CAC7C,EAAO,EACP,OAAyB;;QAEzB,MAAM,OAAO,GAAqC,OAAO;aACtD,YAAY,EAAE;aACd,UAAU,EAAE,CAAC;QAChB,MAAM,GAAG,GAAY,OAAO,CAAC,MAAc,CAAC,IAAI,CAAC,CAAC;QAClD,IAAI,CAAC;YACH,OAAO,MAAM,CAAC,GAAG,CAAC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AG,CAAC,CAAC;QACrB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb;;;iBAA6B,GAAG,GAAG,CAAC;gBAClC,MAAM,KAAK,GAAuB;oBAChC,IAAI,QAAE,GAAG,CAAC,IAAI,mCAAI,QAAQ;oBAC1B,QAAQ,EAAE,GAAG,CAAC,QAAQ;oBACtB,KAAK,EAAE,GAAG,CAAC,KAAK;iBACjB,CAAC;gBACF,MAAM,IAAI,4BAAmB,iBAC3B,OAAO,EAAE,mCAAmC,IAAI,IAAI,IACjD,CAAC,QAAQ,KAAK,IAAI;oBACnB,CAAC,CAAC;wBACE,MAAM,EAAE,CAAC,KAAK,CAAC;qBAChB;oBACH,CAAC,iCACM,KAAK,KACR,MAAM,EAAE,GAAG,CAAC,OAAO,GACpB,CAAC,EACN,CAAC;YACL,CAAC;YACD,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACX,CAAC"}
@@ -19,8 +19,24 @@ import { IResponseBodyQuerifier } from "../options/IResponseBodyQuerifier";
19
19
  *
20
20
  * @author Jeongho Nam - https://github.com/samchon
21
21
  * @returns Parameter decorator
22
+ * @evidence contracts/common.md#principled-implementation The query string is read from the request URL after the first question mark, grouped by the transformed decoder into the typed object, and a failure is thrown as the 400 response; the decoder receives a `URLSearchParams`, so both Express and Fastify requests are handled by the same code.
23
+ * @evidence contracts/common.md#clear-and-simple-design One parameter decorator on top of the shared query validator runner.
24
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The decoder is generated from the type by the transform; without it the grouped raw query is returned only when the configuration guard is off.
25
+ * @evidence contracts/common.md#meaningful-documentation The comment documents the supported property types and the validation modes.
26
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Query decoding and response encoding operate on URLSearchParams and HTTP route metadata rather than native filesystem paths.
22
27
  */
23
28
  export declare function TypedQuery<T extends object>(validator?: IRequestQueryValidator<T>): ParameterDecorator;
29
+ /**
30
+ * Variants of {@link TypedQuery}: `TypedQuery.Body` reads an urlencoded body,
31
+ * and `TypedQuery.Get`, `Post`, `Put`, `Patch`, and `Delete` return the value
32
+ * as an urlencoded response.
33
+ *
34
+ * @evidence contracts/common.md#principled-implementation `Body` requires the `application/x-www-form-urlencoded` media type and decodes the parsed body, and the route decorators serialize the returned value through the querifier the transform chose and set the response content type.
35
+ * @evidence contracts/common.md#clear-and-simple-design One body decorator and one generator that creates the five route decorators, with a small adapter class for parsed bodies.
36
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The route decorators copy typia's marker properties onto themselves exactly as `TypedRoute` does, which mutates only these exported functions.
37
+ * @evidence contracts/common.md#meaningful-documentation The comment documents the body decorator and the route decorators.
38
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Query decoding and response encoding operate on URLSearchParams and HTTP route metadata rather than native filesystem paths.
39
+ */
24
40
  export declare namespace TypedQuery {
25
41
  /**
26
42
  * Request body decorator.
@@ -31,6 +31,11 @@ const validate_request_query_1 = require("./internal/validate_request_query");
31
31
  *
32
32
  * @author Jeongho Nam - https://github.com/samchon
33
33
  * @returns Parameter decorator
34
+ * @evidence contracts/common.md#principled-implementation The query string is read from the request URL after the first question mark, grouped by the transformed decoder into the typed object, and a failure is thrown as the 400 response; the decoder receives a `URLSearchParams`, so both Express and Fastify requests are handled by the same code.
35
+ * @evidence contracts/common.md#clear-and-simple-design One parameter decorator on top of the shared query validator runner.
36
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The decoder is generated from the type by the transform; without it the grouped raw query is returned only when the configuration guard is off.
37
+ * @evidence contracts/common.md#meaningful-documentation The comment documents the supported property types and the validation modes.
38
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Query decoding and response encoding operate on URLSearchParams and HTTP route metadata rather than native filesystem paths.
34
39
  */
35
40
  function TypedQuery(validator) {
36
41
  const checker = (0, validate_request_query_1.validate_request_query)("TypedQuery")(validator);
@@ -45,6 +50,17 @@ function TypedQuery(validator) {
45
50
  return output;
46
51
  })();
47
52
  }
53
+ /**
54
+ * Variants of {@link TypedQuery}: `TypedQuery.Body` reads an urlencoded body,
55
+ * and `TypedQuery.Get`, `Post`, `Put`, `Patch`, and `Delete` return the value
56
+ * as an urlencoded response.
57
+ *
58
+ * @evidence contracts/common.md#principled-implementation `Body` requires the `application/x-www-form-urlencoded` media type and decodes the parsed body, and the route decorators serialize the returned value through the querifier the transform chose and set the response content type.
59
+ * @evidence contracts/common.md#clear-and-simple-design One body decorator and one generator that creates the five route decorators, with a small adapter class for parsed bodies.
60
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The route decorators copy typia's marker properties onto themselves exactly as `TypedRoute` does, which mutates only these exported functions.
61
+ * @evidence contracts/common.md#meaningful-documentation The comment documents the body decorator and the route decorators.
62
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Query decoding and response encoding operate on URLSearchParams and HTTP route metadata rather than native filesystem paths.
63
+ */
48
64
  (function (TypedQuery) {
49
65
  /**
50
66
  * Request body decorator.
@@ -1 +1 @@
1
- {"version":3,"file":"TypedQuery.js","sourceRoot":"","sources":["../../src/decorators/TypedQuery.ts"],"names":[],"mappings":";;;;;;AAAA,2CAawB;AAIxB,8CAAiD;AACjD,kDAA0B;AAI1B,6CAA0C;AAC1C,0EAAuE;AACvE,4DAAyD;AACzD,wDAAqD;AACrD,8EAA2E;AAE3E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,oBACE,SAAqC;IAErC,MAAM,OAAO,GAAG,IAAA,+CAAsB,EAAC,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC;IAChE,OAAO,IAAA,6BAAoB,EAAC,SAAS,UAAU,CAC7C,QAAa,EACb,OAAyB;QAEzB,MAAM,OAAO,GAAqC,OAAO;aACtD,YAAY,EAAE;aACd,UAAU,EAAE,CAAC;QAChB,MAAM,MAAM,GAAoB,IAAI,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;QAEvE,MAAM,MAAM,GAAc,OAAO,CAAC,MAA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,CAAC;QACtD,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,mCAAmC,CAAC,CAAC;QAErE,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CACvB,IAAA,eAAG,EAAC,CAAC,KAAK,EAAE,EAAE,CACZ,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CACnE,EACD,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,KAAK,EAAL,cAAK;IACL,GAAG,EAAH,YAAG;IACH,MAAM,EAAN,eAAM;CACP,CAAC"}
@@ -3,17 +3,21 @@ import { IResponseBodyStringifier } from "../options/IResponseBodyStringifier";
3
3
  /**
4
4
  * Type safe router decorator functions.
5
5
  *
6
- * `TypedRoute` is a module containing router decorator functions which can
7
- * boost up JSON string conversion speed about 200x times faster than
8
- * `class-transformer`. Furthermore, such JSON string conversion is even type
9
- * safe through [typia](https://github.com/samchon/typia).
6
+ * `TypedRoute` provides router decorators that serialize response values with
7
+ * [typia](https://github.com/samchon/typia) functions generated from the
8
+ * declared return type.
10
9
  *
11
- * For reference, if you try to invalid data that is not following the promised
12
- * type `T`, 500 internal server error would be thrown. Also, as `TypedRoute`
13
- * composes JSON string through `typia.assertStringify<T>()` function, it is not
14
- * possible to modify response data through interceptors.
10
+ * The default assert serializer rejects a response outside the declared type
11
+ * with a 500 error. The configured stringify mode can choose a different
12
+ * validation policy; `validate.log` logs failures and returns JSON text.
13
+ * Interceptors that run after this serializer receive the serialized string.
15
14
  *
16
15
  * @author Jeongho Nam - https://github.com/samchon
16
+ * @evidence contracts/common.md#principled-implementation Each method decorator combines Nest's router decorator, a JSON content type, and an interceptor that stringifies the returned value with the function the transform selected, so the JSON text is produced by generated code; an error thrown by the handler is routed to the registered exception converters.
17
+ * @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.
18
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The loop after the namespace copies the marker properties of typia's stringify functions onto the decorators for the transform, which mutates only these exported functions; the logger is a module variable, not a patched global.
19
+ * @evidence contracts/common.md#meaningful-documentation The comment documents the decorator family, the path and stringify arguments, and the validation modes.
20
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Routing paths and serialized response values are HTTP protocol data; the interceptor and logger do not define a native file or subprocess boundary.
17
21
  */
18
22
  export declare namespace TypedRoute {
19
23
  /**
@@ -39,7 +43,7 @@ export declare namespace TypedRoute {
39
43
  <T>(path: string | string[], stringify?: IResponseBodyStringifier<T>): MethodDecorator;
40
44
  };
41
45
  /**
42
- * Router decorator function for the PATH method.
46
+ * Router decorator function for the PATCH method.
43
47
  *
44
48
  * @param path Path of the HTTP request
45
49
  * @returns Method decorator
@@ -77,7 +81,7 @@ export declare namespace TypedRoute {
77
81
  * If you've configured the transformation option to `validate.log` in the
78
82
  * `tsconfig.json` file, then the error log information of the response
79
83
  * validation failure would be logged through this function instead of
80
- * throwing the 400 bad request error.
84
+ * throwing the 500 internal server error.
81
85
  *
82
86
  * By the way, be careful. If you've configured the response transformation
83
87
  * option to be `validate.log`, client may get wrong response data. Therefore,
@@ -85,6 +89,11 @@ export declare namespace TypedRoute {
85
89
  *
86
90
  * @default console.log
87
91
  * @param func Logger function
92
+ * @evidence contracts/common.md#principled-implementation It replaces the module's logger variable, which the `validate.log` mode calls when a response fails validation, and the default is `console.log`.
93
+ * @evidence contracts/common.md#clear-and-simple-design One assignment.
94
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It changes only the logger variable.
95
+ * @evidence contracts/common.md#meaningful-documentation The comment states which mode uses the logger.
96
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Routing paths and serialized response values are HTTP protocol data; the interceptor and logger do not define a native file or subprocess boundary.
88
97
  */
89
98
  function setValidateErrorLogger(func: (log: IValidateErrorLog) => void): void;
90
99
  /**
@@ -99,6 +108,12 @@ export declare namespace TypedRoute {
99
108
  * information `IValidateErrorLog` would be logged through the
100
109
  * {@link setValidateErrorLogger} function instead of throwing the 400 bad
101
110
  * request error.
111
+ *
112
+ * @evidence contracts/common.md#principled-implementation The record carries the method, the path, the validation errors, and the offending data, which is what a logger needs to report a response that failed its type.
113
+ * @evidence contracts/common.md#clear-and-simple-design A flat record with no behavior.
114
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
115
+ * @evidence contracts/common.md#meaningful-documentation Each member documents its meaning.
116
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Routing paths and serialized response values are HTTP protocol data; the interceptor and logger do not define a native file or subprocess boundary.
102
117
  */
103
118
  interface IValidateErrorLog {
104
119
  /** HTTP method of the request. */
@@ -12,17 +12,21 @@ const route_error_1 = require("./internal/route_error");
12
12
  /**
13
13
  * Type safe router decorator functions.
14
14
  *
15
- * `TypedRoute` is a module containing router decorator functions which can
16
- * boost up JSON string conversion speed about 200x times faster than
17
- * `class-transformer`. Furthermore, such JSON string conversion is even type
18
- * safe through [typia](https://github.com/samchon/typia).
15
+ * `TypedRoute` provides router decorators that serialize response values with
16
+ * [typia](https://github.com/samchon/typia) functions generated from the
17
+ * declared return type.
19
18
  *
20
- * For reference, if you try to invalid data that is not following the promised
21
- * type `T`, 500 internal server error would be thrown. Also, as `TypedRoute`
22
- * composes JSON string through `typia.assertStringify<T>()` function, it is not
23
- * possible to modify response data through interceptors.
19
+ * The default assert serializer rejects a response outside the declared type
20
+ * with a 500 error. The configured stringify mode can choose a different
21
+ * validation policy; `validate.log` logs failures and returns JSON text.
22
+ * Interceptors that run after this serializer receive the serialized string.
24
23
  *
25
24
  * @author Jeongho Nam - https://github.com/samchon
25
+ * @evidence contracts/common.md#principled-implementation Each method decorator combines Nest's router decorator, a JSON content type, and an interceptor that stringifies the returned value with the function the transform selected, so the JSON text is produced by generated code; an error thrown by the handler is routed to the registered exception converters.
26
+ * @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.
27
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The loop after the namespace copies the marker properties of typia's stringify functions onto the decorators for the transform, which mutates only these exported functions; the logger is a module variable, not a patched global.
28
+ * @evidence contracts/common.md#meaningful-documentation The comment documents the decorator family, the path and stringify arguments, and the validation modes.
29
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Routing paths and serialized response values are HTTP protocol data; the interceptor and logger do not define a native file or subprocess boundary.
26
30
  */
27
31
  var TypedRoute;
28
32
  (function (TypedRoute) {
@@ -41,7 +45,7 @@ var TypedRoute;
41
45
  */
42
46
  TypedRoute.Post = Generator("Post");
43
47
  /**
44
- * Router decorator function for the PATH method.
48
+ * Router decorator function for the PATCH method.
45
49
  *
46
50
  * @param path Path of the HTTP request
47
51
  * @returns Method decorator
@@ -67,7 +71,7 @@ var TypedRoute;
67
71
  * If you've configured the transformation option to `validate.log` in the
68
72
  * `tsconfig.json` file, then the error log information of the response
69
73
  * validation failure would be logged through this function instead of
70
- * throwing the 400 bad request error.
74
+ * throwing the 500 internal server error.
71
75
  *
72
76
  * By the way, be careful. If you've configured the response transformation
73
77
  * option to be `validate.log`, client may get wrong response data. Therefore,
@@ -75,6 +79,11 @@ var TypedRoute;
75
79
  *
76
80
  * @default console.log
77
81
  * @param func Logger function
82
+ * @evidence contracts/common.md#principled-implementation It replaces the module's logger variable, which the `validate.log` mode calls when a response fails validation, and the default is `console.log`.
83
+ * @evidence contracts/common.md#clear-and-simple-design One assignment.
84
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It changes only the logger variable.
85
+ * @evidence contracts/common.md#meaningful-documentation The comment states which mode uses the logger.
86
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Routing paths and serialized response values are HTTP protocol data; the interceptor and logger do not define a native file or subprocess boundary.
78
87
  */
79
88
  function setValidateErrorLogger(func) {
80
89
  TypedRoute.__logger = func;
@@ -1 +1 @@
1
- {"version":3,"file":"TypedRoute.js","sourceRoot":"","sources":["../../src/decorators/TypedRoute.ts"],"names":[],"mappings":";;;;;;AAAA,2CAYwB;AAGxB,8CAAiD;AACjD,kDAA2C;AAG3C,8EAA2E;AAC3E,wDAAqD;AAErD;;;;;;;;;;;;;;GAcG;AACH,IAAiB,UAAU,CAiH1B;AAjHD,WAAiB,UAAU;IACzB;;;;;OAKG;IACU,cAAG,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAEpC;;;;;OAKG;IACU,eAAI,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;IAEtC;;;;;OAKG;IACU,gBAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IAExC;;;;;OAKG;IACU,cAAG,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAEpC;;;;;OAKG;IACU,iBAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;IAE1C;;;;;;;;;;;;;;OAcG;IACH,SAAgB,sBAAsB,CACpC,IAAsC;QAEtC,mBAAQ,GAAG,IAAI,CAAC;IAClB,CAAC;IAJe,WAAA,sBAAsB,yBAIrC,CAAA;IA6BD,gBAAgB;IACL,mBAAQ,GAAqC,OAAO,CAAC,GAAG,CAAC;IAEpE,gBAAgB;IAChB,SAAS,SAAS,CAAC,MAAmD;QAQpE,SAAS,KAAK,CAAC,GAAG,IAAW;YAC3B,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,GAAG,IAAA,+CAAsB,EAAC,GAAG,EAAE,CAAC,mBAAQ,CAAC,CAC9D,cAAc,MAAM,EAAE,CACvB,CAAC,GAAG,IAAI,CAAC,CAAC;YACX,OAAO,IAAA,wBAAe,EACpB,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,EACrB,I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kBAAkB,CAAC,CAAC;QAEpD,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CACvB,IAAA,eAAG,EAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,EAClE,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,KAAK,EAAL,cAAK;IACL,GAAG,EAAH,YAAG;IACH,MAAM,EAAN,eAAM;CACP,CAAC"}
@@ -33,8 +33,23 @@ import { IRequestQueryValidator } from "../options/IRequestQueryValidator";
33
33
  * @author Jeongho Nam - https://github.com/samchon
34
34
  * @param path Path(s) of the WebSocket request
35
35
  * @returns Method decorator
36
+ * @evidence contracts/common.md#principled-implementation The decorator records the route paths as metadata on the method, with an empty list for no path, and the adapter reads that metadata to build the route table.
37
+ * @evidence contracts/common.md#clear-and-simple-design One decorator function that writes one metadata object.
38
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It uses the reflect metadata API and does not touch the server.
39
+ * @evidence contracts/common.md#meaningful-documentation The comment documents the path forms and the required parameters.
40
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The route and parameter metadata describe WebSocket handshakes and HTTP URL fields; native files and processes are not represented.
36
41
  */
37
42
  export declare function WebSocketRoute(path?: undefined | string | string[]): MethodDecorator;
43
+ /**
44
+ * Parameter decorators of {@link WebSocketRoute}: `Acceptor`, `Driver`,
45
+ * `Header`, `Param`, and `Query`.
46
+ *
47
+ * @evidence contracts/common.md#principled-implementation Each decorator appends category and position metadata. Header registration stores the shared checker whose resolver preserves successful callback data for the decorated argument without replacing the acceptor header; legacy error-only callbacks retain raw input. Param and query keep their own decoder contracts, and every rejected handshake retains its original error handling.
48
+ * @evidence contracts/common.md#clear-and-simple-design Five decorators sharing one `emplace` helper for the metadata list.
49
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The validators are generated from the types; without the transform the raw values are passed only when the configuration guard is off.
50
+ * @evidence contracts/common.md#meaningful-documentation Each decorator documents its meaning.
51
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The route and parameter metadata describe WebSocket handshakes and HTTP URL fields; native files and processes are not represented.
52
+ */
38
53
  export declare namespace WebSocketRoute {
39
54
  /**
40
55
  * Acceptor parameter decorator.
@@ -81,7 +96,9 @@ export declare namespace WebSocketRoute {
81
96
  *
82
97
  * Also, this `@WebSocketRoute.Header()` decorator is optional, and can be
83
98
  * substituted by `@WebSocketRoute.Acceptor()` decorated parameter by
84
- * accessting to the {@link WebSocketAcceptor.header} property.
99
+ * accessing the {@link WebSocketAcceptor.header} property. Clone validators
100
+ * supply a separate decorated argument; the acceptor keeps its original
101
+ * header.
85
102
  */
86
103
  function Header<T>(validator?: IRequestBodyValidator<T>): ParameterDecorator;
87
104
  /**
@@ -37,6 +37,11 @@ const validate_request_query_1 = require("./internal/validate_request_query");
37
37
  * @author Jeongho Nam - https://github.com/samchon
38
38
  * @param path Path(s) of the WebSocket request
39
39
  * @returns Method decorator
40
+ * @evidence contracts/common.md#principled-implementation The decorator records the route paths as metadata on the method, with an empty list for no path, and the adapter reads that metadata to build the route table.
41
+ * @evidence contracts/common.md#clear-and-simple-design One decorator function that writes one metadata object.
42
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It uses the reflect metadata API and does not touch the server.
43
+ * @evidence contracts/common.md#meaningful-documentation The comment documents the path forms and the required parameters.
44
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The route and parameter metadata describe WebSocket handshakes and HTTP URL fields; native files and processes are not represented.
40
45
  */
41
46
  function WebSocketRoute(path) {
42
47
  return function WebSocketRoute(_target, _propertyKey, descriptor) {
@@ -46,6 +51,16 @@ function WebSocketRoute(path) {
46
51
  return descriptor;
47
52
  };
48
53
  }
54
+ /**
55
+ * Parameter decorators of {@link WebSocketRoute}: `Acceptor`, `Driver`,
56
+ * `Header`, `Param`, and `Query`.
57
+ *
58
+ * @evidence contracts/common.md#principled-implementation Each decorator appends category and position metadata. Header registration stores the shared checker whose resolver preserves successful callback data for the decorated argument without replacing the acceptor header; legacy error-only callbacks retain raw input. Param and query keep their own decoder contracts, and every rejected handshake retains its original error handling.
59
+ * @evidence contracts/common.md#clear-and-simple-design Five decorators sharing one `emplace` helper for the metadata list.
60
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The validators are generated from the types; without the transform the raw values are passed only when the configuration guard is off.
61
+ * @evidence contracts/common.md#meaningful-documentation Each decorator documents its meaning.
62
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The route and parameter metadata describe WebSocket handshakes and HTTP URL fields; native files and processes are not represented.
63
+ */
49
64
  (function (WebSocketRoute) {
50
65
  /**
51
66
  * Acceptor parameter decorator.
@@ -108,7 +123,9 @@ function WebSocketRoute(path) {
108
123
  *
109
124
  * Also, this `@WebSocketRoute.Header()` decorator is optional, and can be
110
125
  * substituted by `@WebSocketRoute.Acceptor()` decorated parameter by
111
- * accessting to the {@link WebSocketAcceptor.header} property.
126
+ * accessing the {@link WebSocketAcceptor.header} property. Clone validators
127
+ * supply a separate decorated argument; the acceptor keeps its original
128
+ * header.
112
129
  */
113
130
  function Header(validator) {
114
131
  const validate = (0, validate_request_body_1.validate_request_body)("WebSocketRoute.Header")(validator);
@@ -1 +1 @@
1
- {"version":3,"file":"WebSocketRoute.js","sourceRoot":"","sources":["../../src/decorators/WebSocketRoute.ts"],"names":[],"mappings":";;;AAEA,mFAAgF;AAEhF,4EAAyE;AACzE,8EAA2E;AAE3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBACE,IAAoC;IAEpC,OAAO,SAAS,cAAc,CAC5B,OAAe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EAAE,cAAc;gBACrB,KAAK;gBACL,MAAM;aACP,CAAC,CAAC;QACL,CAAC,CAAC;IACJ,CAAC;IApBe,eAAA,KAAK,QAoBpB,CAAA;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,SAAgB,KAAK,CACnB,SAAqC;QAErC,MAAM,QAAQ,GAAG,IAAA,+CAAsB,EAAC,sBAAsB,CAAC,CAAC,SAAS,CAAC,CAAC;QAC3E,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,OAAO;gBACjB,KAAK,EAAE,cAAc;gBACrB,QAAQ;aACT,CAAC,CAAC;QACL,CAAC,CAAC;IACJ,CAAC;IAfe,eAAA,KAAK,QAepB,CAAA;IAED,gBAAgB;IAChB,MAAM,OAAO,GAAG,CACd,MAAc,EACd,WAA4B,EAC5B,KAAuC,EACvC,EAAE;QACF,MAAM,KAAK,GACT,OAAO,CAAC,cAAc,CACpB,kCAAkC,EAClC,MAAM,EACN,WAAW,CACZ,CAAC;QACJ,IAAI,KAAK,KAAK,SAAS;YAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;;YAEzC,OAAO,CAAC,cAAc,CACpB,kCAAkC,EAClC,CAAC,KAAK,CAAC,EACP,MAAM,EACN,WAAW,CACZ,CAAC;IACN,CAAC,CAAC;AACJ,CAAC,EAxLgB,cAAc,aA5Bf,cAAc,GA4Bb,cAAc,QAwL9B"}
@@ -1 +1,15 @@
1
+ /**
2
+ * Chooses whether a decorator called without the compile-time transform throws.
3
+ *
4
+ * The initial configuration throws with instructions to build with `ttsc`.
5
+ * Calling this setter with `false`, including its omitted-argument default,
6
+ * silences the error. Passing `true` restores throwing for subsequent decorator
7
+ * construction. Decorators already constructed keep their selected callbacks.
8
+ *
9
+ * @evidence contracts/common.md#principled-implementation The function sets the one flag that `NoTransformConfigurationError` reads, so the choice is made once for the process.
10
+ * @evidence contracts/common.md#clear-and-simple-design One setter with a boolean parameter.
11
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It changes an exported flag of this package and nothing foreign.
12
+ * @evidence contracts/common.md#meaningful-documentation The comment states the default and the effect of the flag.
13
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation This setter changes an in-memory validation configuration flag and performs no filesystem or process operation.
14
+ */
1
15
  export declare const doNotThrowTransformError: (value?: boolean) => void;
@@ -2,6 +2,20 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.doNotThrowTransformError = void 0;
4
4
  const NoTransformConfigurationError_1 = require("./NoTransformConfigurationError");
5
+ /**
6
+ * Chooses whether a decorator called without the compile-time transform throws.
7
+ *
8
+ * The initial configuration throws with instructions to build with `ttsc`.
9
+ * Calling this setter with `false`, including its omitted-argument default,
10
+ * silences the error. Passing `true` restores throwing for subsequent decorator
11
+ * construction. Decorators already constructed keep their selected callbacks.
12
+ *
13
+ * @evidence contracts/common.md#principled-implementation The function sets the one flag that `NoTransformConfigurationError` reads, so the choice is made once for the process.
14
+ * @evidence contracts/common.md#clear-and-simple-design One setter with a boolean parameter.
15
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It changes an exported flag of this package and nothing foreign.
16
+ * @evidence contracts/common.md#meaningful-documentation The comment states the default and the effect of the flag.
17
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation This setter changes an in-memory validation configuration flag and performs no filesystem or process operation.
18
+ */
5
19
  const doNotThrowTransformError = (value = false) => {
6
20
  NoTransformConfigurationError_1.NoTransformConfigurationError.throws = value;
7
21
  };
@@ -1 +1 @@
1
- {"version":3,"file":"doNotThrowTransformError.js","sourceRoot":"","sources":["../../src/decorators/doNotThrowTransformError.ts"],"names":[],"mappings":";;;AAAA,mFAAgF;AAEzE,MAAM,wBAAwB,GAAG,CAAC,KAAK,GAAY,KAAK,EAAE,EAAE;IACjE,6DAA6B,CAAC,MAAM,GAAG,KAAK,CAAC;AAC/C,CAAC,CAAC;AAFW,QAAA,wBAAwB,GAAxB,wBAAwB,CAEnC"}
1
+ {"version":3,"file":"doNotThrowTransformError.js","sourceRoot":"","sources":["../../src/decorators/doNotThrowTransformError.ts"],"names":[],"mappings":";;;AAAA,mFAAgF;AAEhF;;;;;;;;;;;;;GAaG;AACI,MAAM,wBAAwB,GAAG,CAAC,KAAK,GAAY,KAAK,EAAE,EAAE;IACjE,6DAA6B,CAAC,MAAM,GAAG,KAAK,CAAC;AAC/C,CAAC,CAAC;AAFW,QAAA,wBAAwB,GAAxB,wBAAwB,CAEnC"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Internal request validation callable with an optional successful-value
3
+ * resolver.
4
+ *
5
+ * The callable preserves the legacy error-or-null metadata contract. Factory
6
+ * validators also expose `resolve` so consumers can retain clone results
7
+ * without treating a valid Error, null or undefined value as a failure.
8
+ *
9
+ * @evidence contracts/common.md#principled-implementation Resolver input is untrusted unknown and only successful data is T. Existing public descriptor callbacks retain their input:T signature; the private adapter casts once at that compatibility boundary and relies on the callback's validation decision, without asserting input validity beforehand. Assert returns and validation.data are retained; is and legacy null success retain accepted input. Errors preserve 400 details and non-guard throws, and explicit tags permit successful Error/null/undefined.
10
+ * @evidence contracts/common.md#clear-and-simple-design One callable interface and namespace separate compatibility from successful data. The private factory installs both operations on one newly created function; descriptor adapters own their existing error translation, and the shared resolver chooses the supported protocol without request-result caching or double validation.
11
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The private constructor composes an owned function and resolver without modifying foreign callbacks or public descriptors. Unknown descriptor tags reject; legacy error-only callbacks remain supported without an invented replacement value or data sentinel.
12
+ * @evidence contracts/common.md#meaningful-documentation This type explains optional resolution and tagged values; private factory/resolver native comments explain construction, single-call behavior and legacy fallback. The owning type reviews those internal operations rather than exposing them to obtain standalone documentation hosts.
13
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The callable and tagged result describe validated JavaScript values, not native file identities or process handles.
14
+ */
15
+ export interface IRequestBodyValidation<T> {
16
+ (input: T): Error | null;
17
+ /**
18
+ * Resolves validation once, retaining its successful value when supported.
19
+ *
20
+ * @evidence contracts/common.md#principled-implementation The optional operation returns a discriminated result so successful Error, null or undefined data cannot be confused with validation failure; absence identifies legacy error-only callbacks.
21
+ * @evidence contracts/common.md#clear-and-simple-design One optional function supplements the existing callable without changing its failure protocol.
22
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The member records a real factory-owned capability rather than requiring it on legacy callbacks or using raw-data sentinels.
23
+ * @evidence contracts/common.md#meaningful-documentation The comment states single validation and successful-value retention; the owning interface explains compatibility.
24
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The callable and tagged result describe validated JavaScript values, not native file identities or process handles.
25
+ */
26
+ resolve?: (input: unknown) => IRequestBodyValidation.IResult<T>;
27
+ }
28
+ export declare namespace IRequestBodyValidation {
29
+ /**
30
+ * Successful data or a validation error, distinguished independently of data.
31
+ *
32
+ * @evidence contracts/common.md#principled-implementation The success literal distinguishes a valid Error, null or undefined from a rejected value; failure alone carries the error consumers throw.
33
+ * @evidence contracts/common.md#clear-and-simple-design A two-variant union gives consumers one exhaustive success check.
34
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The result uses no data sentinel or consumer-specific exception.
35
+ * @evidence contracts/common.md#meaningful-documentation The description states the distinction that the union preserves.
36
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The callable and tagged result describe validated JavaScript values, not native file identities or process handles.
37
+ */
38
+ type IResult<T> = {
39
+ success: true;
40
+ data: T;
41
+ } | {
42
+ success: false;
43
+ error: Error;
44
+ };
45
+ /**
46
+ * A factory-owned checker whose resolver is always present.
47
+ *
48
+ * @evidence contracts/common.md#principled-implementation Factory callers can resolve successful data directly because construction installs the resolver together with the legacy callable.
49
+ * @evidence contracts/common.md#clear-and-simple-design This interface strengthens only the optional member of the compatibility interface.
50
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The required member describes the actual factory result rather than asserting a resolver exists on foreign legacy callbacks.
51
+ * @evidence contracts/common.md#meaningful-documentation The comment identifies which owner guarantees resolver availability.
52
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The callable and tagged result describe validated JavaScript values, not native file identities or process handles.
53
+ */
54
+ interface IResolved<T> extends IRequestBodyValidation<T> {
55
+ /**
56
+ * Resolves validation and retains successful data.
57
+ *
58
+ * @evidence contracts/common.md#principled-implementation Factory construction installs this operation with its callable, making successful callback data available without running validation twice.
59
+ * @evidence contracts/common.md#clear-and-simple-design The required function strengthens only the compatibility interface's optional resolver.
60
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The mandatory resolver applies only to the owned factory result, never to an arbitrary legacy callback.
61
+ * @evidence contracts/common.md#meaningful-documentation The description identifies the operation's result and the owning interface states its construction guarantee.
62
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The callable and tagged result describe validated JavaScript values, not native file identities or process handles.
63
+ */
64
+ resolve: (input: unknown) => IResult<T>;
65
+ }
66
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IRequestBodyValidation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IRequestBodyValidation.js","sourceRoot":"","sources":["../../../src/decorators/internal/IRequestBodyValidation.ts"],"names":[],"mappings":""}
@@ -1,20 +1,112 @@
1
+ import { IRequestBodyValidation } from "./IRequestBodyValidation";
2
+ /**
3
+ * The metadata `@WebSocketRoute()` writes on a method: its route paths.
4
+ *
5
+ * @evidence contracts/common.md#principled-implementation The record holds the paths, which the adapter turns into the route table; the parameter records are a separate metadata list.
6
+ * @evidence contracts/common.md#clear-and-simple-design A one-member record and a namespace of the parameter record types.
7
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
8
+ * @evidence contracts/common.md#meaningful-documentation The comment states which metadata the type describes.
9
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Handshake paths, parameter positions and callback signatures describe protocol metadata without native filesystem identities.
10
+ */
1
11
  export interface IWebSocketRouteReflect {
2
12
  paths: string[];
3
13
  }
4
14
  export declare namespace IWebSocketRouteReflect {
15
+ /**
16
+ * A parameter record: one of acceptor, driver, header, param, or query.
17
+ *
18
+ * @evidence contracts/common.md#principled-implementation The union is discriminated by the `category` literal, so the adapter can build the argument list with one comparison per parameter.
19
+ * @evidence contracts/common.md#clear-and-simple-design A union of five records.
20
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
21
+ * @evidence contracts/common.md#meaningful-documentation The comment lists the categories.
22
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Handshake paths, parameter positions and callback signatures describe protocol metadata without native filesystem identities.
23
+ */
5
24
  export type IArgument = IAcceptor | IDriver | IHeader | IParam | IQuery;
25
+ /**
26
+ * The record of an acceptor parameter, which receives the WebSocket acceptor.
27
+ *
28
+ * @evidence contracts/common.md#principled-implementation The record has only the category and the position, because the adapter supplies the acceptor itself.
29
+ * @evidence contracts/common.md#clear-and-simple-design It extends the shared base and adds nothing.
30
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
31
+ * @evidence contracts/common.md#meaningful-documentation The comment states which argument it stands for.
32
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Handshake paths, parameter positions and callback signatures describe protocol metadata without native filesystem identities.
33
+ */
6
34
  export interface IAcceptor extends IBase<"acceptor"> {
7
35
  }
36
+ /**
37
+ * The record of a driver parameter, which receives the remote driver of the
38
+ * connection.
39
+ *
40
+ * @evidence contracts/common.md#principled-implementation The record has only the category and the position, because the adapter supplies the driver from the acceptor.
41
+ * @evidence contracts/common.md#clear-and-simple-design It extends the shared base and adds nothing.
42
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
43
+ * @evidence contracts/common.md#meaningful-documentation The comment states which argument it stands for.
44
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Handshake paths, parameter positions and callback signatures describe protocol metadata without native filesystem identities.
45
+ */
8
46
  export interface IDriver extends IBase<"driver"> {
9
47
  }
48
+ /**
49
+ * The record of a header parameter: the position and the validator of the
50
+ * handshake header.
51
+ *
52
+ * @evidence contracts/common.md#principled-implementation The callable retains its error-or-null signature. An optional resolver carries successful callback data to the route argument; legacy callbacks without it preserve the raw header and any validation error rejects the handshake.
53
+ * @evidence contracts/common.md#clear-and-simple-design It extends the shared base with one function member.
54
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
55
+ * @evidence contracts/common.md#meaningful-documentation The comment states which argument it stands for and what the validator returns.
56
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Handshake paths, parameter positions and callback signatures describe protocol metadata without native filesystem identities.
57
+ */
10
58
  export interface IHeader extends IBase<"header"> {
11
- validate: (input?: any) => Error | null;
59
+ /**
60
+ * Validates the handshake header and returns an error, or `null` when it is
61
+ * valid. Factory-owned callbacks also resolve successful data for the
62
+ * decorated argument without replacing the acceptor's raw header.
63
+ */
64
+ validate: ((input?: any) => Error | null) & Pick<IRequestBodyValidation<any>, "resolve">;
12
65
  }
66
+ /**
67
+ * The record of a path parameter: its position, the field name, and the
68
+ * conversion function.
69
+ *
70
+ * @evidence contracts/common.md#principled-implementation The field names the placeholder of the path, and the function converts the matched text to the declared type.
71
+ * @evidence contracts/common.md#clear-and-simple-design It extends the shared base with two members.
72
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
73
+ * @evidence contracts/common.md#meaningful-documentation The comment states which argument it stands for.
74
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Handshake paths, parameter positions and callback signatures describe protocol metadata without native filesystem identities.
75
+ */
13
76
  export interface IParam extends IBase<"param"> {
14
77
  field: string;
78
+ /**
79
+ * Converts the matched path text to the declared type, or throws.
80
+ *
81
+ * @evidence contracts/common.md#principled-implementation The function is the assertion the transform generated for the declared type, and a throw rejects the handshake.
82
+ * @evidence contracts/common.md#clear-and-simple-design One function member.
83
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
84
+ * @evidence contracts/common.md#meaningful-documentation The comment states the conversion and the failure.
85
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Handshake paths, parameter positions and callback signatures describe protocol metadata without native filesystem identities.
86
+ */
15
87
  assert: (value: string) => any;
16
88
  }
89
+ /**
90
+ * The record of a query parameter: the position and the validator of the
91
+ * query string.
92
+ *
93
+ * @evidence contracts/common.md#principled-implementation The validator receives the `URLSearchParams` after the first question mark of the path and returns the typed object or an error.
94
+ * @evidence contracts/common.md#clear-and-simple-design It extends the shared base with one function member.
95
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
96
+ * @evidence contracts/common.md#meaningful-documentation The comment states which argument it stands for.
97
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Handshake paths, parameter positions and callback signatures describe protocol metadata without native filesystem identities.
98
+ */
17
99
  export interface IQuery extends IBase<"query"> {
100
+ /**
101
+ * Validates the query of the handshake and returns the typed object, or an
102
+ * error.
103
+ *
104
+ * @evidence contracts/common.md#principled-implementation The function is the query decoder generated for the declared type, and an `Error` result rejects the handshake.
105
+ * @evidence contracts/common.md#clear-and-simple-design One function member.
106
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
107
+ * @evidence contracts/common.md#meaningful-documentation The comment states the result.
108
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Handshake paths, parameter positions and callback signatures describe protocol metadata without native filesystem identities.
109
+ */
18
110
  validate: (input: URLSearchParams) => any | Error;
19
111
  }
20
112
  interface IBase<Category extends string> {