@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
@@ -1,16 +1,84 @@
1
1
  import { IValidation } from "typia";
2
2
  export type IRequestQueryValidator<T> = IRequestQueryValidator.IAssert<T> | IRequestQueryValidator.IIs<T> | IRequestQueryValidator.IValidate<T>;
3
+ /**
4
+ * The request query validator that the transform passes to `TypedQuery`,
5
+ * `TypedQuery.Body`, and `WebSocketRoute.Query`.
6
+ *
7
+ * The literal `type` field selects which typia function generated the
8
+ * validator: `assert`, `is`, or `validate`. `validate_request_query` turns a
9
+ * failure of any variant into a 400 response.
10
+ *
11
+ * @evidence contracts/common.md#principled-implementation The union is discriminated by the literal `type`, so the runtime selects the assert, is, or validate path with one comparison and the compiler checks that each variant carries the function its tag names.
12
+ * @evidence contracts/common.md#clear-and-simple-design Three variants, one per typia function family, with no shared base because each function has a different shape.
13
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior; the runtime rejects an unknown `type` with an error instead of accepting it.
14
+ * @evidence contracts/common.md#meaningful-documentation The comment names the decorators that receive the validator, the meaning of the discriminant, and the response a failure becomes.
15
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The validator consumes URLSearchParams and describes query data rather than native paths or process arguments.
16
+ */
3
17
  export declare namespace IRequestQueryValidator {
18
+ /**
19
+ * Validator generated from `typia.assert`.
20
+ *
21
+ * @evidence contracts/common.md#principled-implementation The variant tags a function of the `URLSearchParams` of the query string or of an urlencoded body that returns the decoded object or throws the `TypeGuardError` of typia; `validate_request_query` catches the error and converts it to a `BadRequestException` carrying the path, reason, expected type, and value of the first failure, and a message-only one when a required property is missing.
22
+ * @evidence contracts/common.md#clear-and-simple-design A two-member record, the tag and the function.
23
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
24
+ * @evidence contracts/common.md#meaningful-documentation The comment names the typia function the variant comes from; the failure response is stated on the union.
25
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The validator consumes URLSearchParams and describes query data rather than native paths or process arguments.
26
+ */
4
27
  interface IAssert<T> {
5
28
  type: "assert";
29
+ /**
30
+ * The typia assertion function generated for the requested type.
31
+ *
32
+ * @evidence contracts/common.md#principled-implementation The transform generates the function for the type argument of the decorator, taking the `URLSearchParams` of the query string or of an urlencoded body and it returns the decoded object or throws the `TypeGuardError` of typia.
33
+ * @evidence contracts/common.md#clear-and-simple-design One function member with the input the decorator has.
34
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The function is generated from the type, and the runtime never edits its result.
35
+ * @evidence contracts/common.md#meaningful-documentation The comment states that the function is generated for the requested type; its input is in the signature.
36
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The validator consumes URLSearchParams and describes query data rather than native paths or process arguments.
37
+ */
6
38
  assert: (input: URLSearchParams) => T;
7
39
  }
40
+ /**
41
+ * Validator generated from `typia.is`.
42
+ *
43
+ * @evidence contracts/common.md#principled-implementation The variant tags a function of the `URLSearchParams` of the query string or of an urlencoded body that returns the decoded object or `null`; a failing result becomes a `BadRequestException` with only the fixed message, because `typia.is` records no failure detail.
44
+ * @evidence contracts/common.md#clear-and-simple-design A two-member record, the tag and the function.
45
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
46
+ * @evidence contracts/common.md#meaningful-documentation The comment names the typia function the variant comes from.
47
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The validator consumes URLSearchParams and describes query data rather than native paths or process arguments.
48
+ */
8
49
  interface IIs<T> {
9
50
  type: "is";
51
+ /**
52
+ * The typia check function generated for the requested type.
53
+ *
54
+ * @evidence contracts/common.md#principled-implementation The transform generates the function for the type argument of the decorator, taking the `URLSearchParams` of the query string or of an urlencoded body and returning the decoded object or `null`.
55
+ * @evidence contracts/common.md#clear-and-simple-design One function member with the input the decorator has.
56
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The function is generated from the type, and the runtime never edits its result.
57
+ * @evidence contracts/common.md#meaningful-documentation The comment states that the function is generated for the requested type; its result is in the signature.
58
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The validator consumes URLSearchParams and describes query data rather than native paths or process arguments.
59
+ */
10
60
  is: (input: URLSearchParams) => T | null;
11
61
  }
62
+ /**
63
+ * Validator generated from `typia.validate`.
64
+ *
65
+ * @evidence contracts/common.md#principled-implementation The variant tags a function of the `URLSearchParams` of the query string or of an urlencoded body that returns the `IValidation` of typia; a failed result becomes a `BadRequestException` carrying every error of the validation.
66
+ * @evidence contracts/common.md#clear-and-simple-design A two-member record, the tag and the function.
67
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
68
+ * @evidence contracts/common.md#meaningful-documentation The comment names the typia function the variant comes from.
69
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The validator consumes URLSearchParams and describes query data rather than native paths or process arguments.
70
+ */
12
71
  interface IValidate<T> {
13
72
  type: "validate";
73
+ /**
74
+ * The typia validation function generated for the requested type.
75
+ *
76
+ * @evidence contracts/common.md#principled-implementation The transform generates the function for the type argument of the decorator, taking the `URLSearchParams` of the query string or of an urlencoded body and returning the validation result with every error.
77
+ * @evidence contracts/common.md#clear-and-simple-design One function member with the input the decorator has.
78
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The function is generated from the type, and the runtime never edits its result.
79
+ * @evidence contracts/common.md#meaningful-documentation The comment states that the function is generated for the requested type; its result is in the signature.
80
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The validator consumes URLSearchParams and describes query data rather than native paths or process arguments.
81
+ */
14
82
  validate: (input: URLSearchParams) => IValidation<T>;
15
83
  }
16
84
  }
@@ -1,24 +1,144 @@
1
1
  import { IValidation } from "typia";
2
+ /**
3
+ * The serializer that the transform passes to `TypedQuery.Get`,
4
+ * `TypedQuery.Post`, `TypedQuery.Put`, `TypedQuery.Patch`, and
5
+ * `TypedQuery.Delete` for the urlencoded form of the response body.
6
+ *
7
+ * The literal `type` field selects which generated encoder/validator
8
+ * combination it contains: `stringify` (no validation), `is`, `assert`,
9
+ * `validate`, or `validate.log`. `get_path_and_querify` turns a failing
10
+ * validation into a 500 response, except `validate.log`, which logs the failure
11
+ * and answers with the plain conversion of the data into `URLSearchParams`.
12
+ *
13
+ * @evidence contracts/common.md#principled-implementation The union is discriminated by the literal `type`, so the runtime selects the serializer with one comparison; the transform combines its URLSearchParams encoder with assert, is or validate checks as selected, while stringify performs encoding alone and validate.log reports failures before fallback encoding.
14
+ * @evidence contracts/common.md#clear-and-simple-design Five variants describe plain encoding and the three validation callback shapes, with validate.log sharing the validate shape but selecting a different failure policy.
15
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior; the runtime rejects an unknown `type` with an error instead of accepting it.
16
+ * @evidence contracts/common.md#meaningful-documentation The comment names the decorators that receive the serializer and the response each variant produces on a failed validation.
17
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The variants describe conversion of JavaScript response values to HTTP query text without native file access.
18
+ */
2
19
  export type IResponseBodyQuerifier<T> = IResponseBodyquerifier.IStringify<T> | IResponseBodyquerifier.IIs<T> | IResponseBodyquerifier.IAssert<T> | IResponseBodyquerifier.IValidate<T> | IResponseBodyquerifier.IValidateLog<T>;
20
+ /**
21
+ * The variant records of {@link IResponseBodyQuerifier}.
22
+ *
23
+ * The lowercase q is the spelling of the exported namespace name, which
24
+ * existing code may reference.
25
+ *
26
+ * @evidence contracts/common.md#principled-implementation The namespace declares the five variant records that IResponseBodyQuerifier combines, so the union and its variants are one public family.
27
+ * @evidence contracts/common.md#clear-and-simple-design Five records with no runtime members.
28
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It contains types only; the spelling is kept because renaming an exported identifier is a breaking change.
29
+ * @evidence contracts/common.md#meaningful-documentation The comment states what the namespace holds and why its name has a lowercase q.
30
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The variants describe conversion of JavaScript response values to HTTP query text without native file access.
31
+ */
3
32
  export declare namespace IResponseBodyquerifier {
33
+ /**
34
+ * Generated URLSearchParams encoder without validation.
35
+ *
36
+ * @evidence contracts/common.md#principled-implementation The variant tags a function that serializes the data as it is, so a value of the wrong type is serialized as far as its shape allows without this variant performing validation.
37
+ * @evidence contracts/common.md#clear-and-simple-design A two-member record, the tag and the function.
38
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
39
+ * @evidence contracts/common.md#meaningful-documentation The comment identifies how validation and URLSearchParams encoding are combined.
40
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The variants describe conversion of JavaScript response values to HTTP query text without native file access.
41
+ */
4
42
  interface IStringify<T> {
5
43
  type: "stringify";
44
+ /**
45
+ * The generated function of the variant, taking the response data.
46
+ *
47
+ * @evidence contracts/common.md#principled-implementation The transform generates the function for the return type of the route method, and the runtime uses the result as the response body as it is.
48
+ * @evidence contracts/common.md#clear-and-simple-design One function member.
49
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The function is generated from the type, and the runtime never edits its result.
50
+ * @evidence contracts/common.md#meaningful-documentation The comment states that the function is generated for the return type; its result is in the signature.
51
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The variants describe conversion of JavaScript response values to HTTP query text without native file access.
52
+ */
6
53
  stringify: (input: T) => URLSearchParams;
7
54
  }
55
+ /**
56
+ * Generated URLSearchParams encoder guarded by a typia is check.
57
+ *
58
+ * @evidence contracts/common.md#principled-implementation The variant tags a function that returns the encoded URLSearchParams, or `null` when the data is not of the type; `null` becomes a 500 `InternalServerErrorException` with a fixed message.
59
+ * @evidence contracts/common.md#clear-and-simple-design A two-member record, the tag and the function.
60
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
61
+ * @evidence contracts/common.md#meaningful-documentation The comment identifies how validation and URLSearchParams encoding are combined.
62
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The variants describe conversion of JavaScript response values to HTTP query text without native file access.
63
+ */
8
64
  interface IIs<T> {
9
65
  type: "is";
66
+ /**
67
+ * The generated function of the variant, taking the response data.
68
+ *
69
+ * @evidence contracts/common.md#principled-implementation The transform generates the function for the return type of the route method, and it returns the serialized text or `null`.
70
+ * @evidence contracts/common.md#clear-and-simple-design One function member.
71
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The function is generated from the type, and the runtime never edits its result.
72
+ * @evidence contracts/common.md#meaningful-documentation The comment states that the function is generated for the return type; its result is in the signature.
73
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The variants describe conversion of JavaScript response values to HTTP query text without native file access.
74
+ */
10
75
  is: (input: T) => URLSearchParams | null;
11
76
  }
77
+ /**
78
+ * Generated URLSearchParams encoder preceded by a typia assertion.
79
+ *
80
+ * @evidence contracts/common.md#principled-implementation The variant tags a function that returns the serialized text or throws the `TypeGuardError` of typia, which becomes a 500 `InternalServerErrorException` with the path, reason, expected type, and value.
81
+ * @evidence contracts/common.md#clear-and-simple-design A two-member record, the tag and the function.
82
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
83
+ * @evidence contracts/common.md#meaningful-documentation The comment identifies how validation and URLSearchParams encoding are combined.
84
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The variants describe conversion of JavaScript response values to HTTP query text without native file access.
85
+ */
12
86
  interface IAssert<T> {
13
87
  type: "assert";
88
+ /**
89
+ * The generated function of the variant, taking the response data.
90
+ *
91
+ * @evidence contracts/common.md#principled-implementation The transform generates the function for the return type of the route method, and it returns the encoded URLSearchParams or throws.
92
+ * @evidence contracts/common.md#clear-and-simple-design One function member.
93
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The function is generated from the type, and the runtime never edits its result.
94
+ * @evidence contracts/common.md#meaningful-documentation The comment states that the function is generated for the return type; its result is in the signature.
95
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The variants describe conversion of JavaScript response values to HTTP query text without native file access.
96
+ */
14
97
  assert: (input: T) => URLSearchParams;
15
98
  }
99
+ /**
100
+ * Generated URLSearchParams encoder wrapped in a typia validation result.
101
+ *
102
+ * @evidence contracts/common.md#principled-implementation The variant tags a function that returns IValidation<URLSearchParams>; a failure becomes a 500 `InternalServerErrorException` carrying every error.
103
+ * @evidence contracts/common.md#clear-and-simple-design A two-member record, the tag and the function.
104
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
105
+ * @evidence contracts/common.md#meaningful-documentation The comment identifies how validation and URLSearchParams encoding are combined.
106
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The variants describe conversion of JavaScript response values to HTTP query text without native file access.
107
+ */
16
108
  interface IValidate<T> {
17
109
  type: "validate";
110
+ /**
111
+ * The generated function of the variant, taking the response data.
112
+ *
113
+ * @evidence contracts/common.md#principled-implementation The transform generates the function for the return type of the route method, and it returns the validation result.
114
+ * @evidence contracts/common.md#clear-and-simple-design One function member.
115
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The function is generated from the type, and the runtime never edits its result.
116
+ * @evidence contracts/common.md#meaningful-documentation The comment states that the function is generated for the return type; its result is in the signature.
117
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The variants describe conversion of JavaScript response values to HTTP query text without native file access.
118
+ */
18
119
  validate: (input: T) => IValidation<URLSearchParams>;
19
120
  }
121
+ /**
122
+ * Generated validation and URLSearchParams encoding for the `validate.log`
123
+ * mode.
124
+ *
125
+ * @evidence contracts/common.md#principled-implementation The variant tags the same function shape as `validate`, but a failure is passed to the logger registered with `TypedRoute.setValidateErrorLogger` and the response is the plain conversion of the data into `URLSearchParams`, so a validation failure never changes the status.
126
+ * @evidence contracts/common.md#clear-and-simple-design A two-member record, the tag and the function.
127
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
128
+ * @evidence contracts/common.md#meaningful-documentation The comment identifies how validation and URLSearchParams encoding are combined.
129
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The variants describe conversion of JavaScript response values to HTTP query text without native file access.
130
+ */
20
131
  interface IValidateLog<T> {
21
132
  type: "validate.log";
133
+ /**
134
+ * The generated function of the variant, taking the response data.
135
+ *
136
+ * @evidence contracts/common.md#principled-implementation The transform generates the function for the return type of the route method, and it returns the validation result.
137
+ * @evidence contracts/common.md#clear-and-simple-design One function member.
138
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The function is generated from the type, and the runtime never edits its result.
139
+ * @evidence contracts/common.md#meaningful-documentation The comment states that the function is generated for the return type; its result is in the signature.
140
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The variants describe conversion of JavaScript response values to HTTP query text without native file access.
141
+ */
22
142
  validate: (input: T) => IValidation<URLSearchParams>;
23
143
  }
24
144
  }
@@ -1,24 +1,131 @@
1
1
  import { IValidation } from "typia";
2
2
  export type IResponseBodyStringifier<T> = IResponseBodyStringifier.IStringify<T> | IResponseBodyStringifier.IIs<T> | IResponseBodyStringifier.IAssert<T> | IResponseBodyStringifier.IValidate<T> | IResponseBodyStringifier.IValidateLog<T>;
3
+ /**
4
+ * The serializer that the transform passes to `TypedRoute` and `EncryptedRoute`
5
+ * for the JSON text of the response body.
6
+ *
7
+ * The literal `type` field selects which typia function generated it:
8
+ * `stringify` (no validation), `is`, `assert`, `validate`, or `validate.log`.
9
+ * `get_path_and_stringify` turns a failing validation into a 500 response,
10
+ * except `validate.log`, which logs the failure and answers with
11
+ * `JSON.stringify` of the data.
12
+ *
13
+ * @evidence contracts/common.md#principled-implementation The union is discriminated by the literal `type`, so the runtime selects the serializer with one comparison; the five variants are the typia stringify families, of which four validate the data and one does not.
14
+ * @evidence contracts/common.md#clear-and-simple-design Five variants, one per typia function family, with no shared base because each function has a different shape.
15
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior; the runtime rejects an unknown `type` with an error instead of accepting it.
16
+ * @evidence contracts/common.md#meaningful-documentation The comment names the decorators that receive the serializer and the response each variant produces on a failed validation.
17
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The variants describe JSON serialization and validation callbacks without native file or process representations.
18
+ */
3
19
  export declare namespace IResponseBodyStringifier {
20
+ /**
21
+ * Serializer generated from `typia.json.stringify`, without validation.
22
+ *
23
+ * @evidence contracts/common.md#principled-implementation The variant tags a function that serializes the data as it is, so a value of the wrong type is serialized as far as its shape allows without this variant performing validation.
24
+ * @evidence contracts/common.md#clear-and-simple-design A two-member record, the tag and the function.
25
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
26
+ * @evidence contracts/common.md#meaningful-documentation The comment names the typia function the variant comes from.
27
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The variants describe JSON serialization and validation callbacks without native file or process representations.
28
+ */
4
29
  interface IStringify<T> {
5
30
  type: "stringify";
31
+ /**
32
+ * The generated function of the variant, taking the response data.
33
+ *
34
+ * @evidence contracts/common.md#principled-implementation The transform generates the function for the return type of the route method, and the runtime uses the result as the response body as it is.
35
+ * @evidence contracts/common.md#clear-and-simple-design One function member.
36
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The function is generated from the type, and the runtime never edits its result.
37
+ * @evidence contracts/common.md#meaningful-documentation The comment states that the function is generated for the return type; its result is in the signature.
38
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The variants describe JSON serialization and validation callbacks without native file or process representations.
39
+ */
6
40
  stringify: (input: T) => string;
7
41
  }
42
+ /**
43
+ * Serializer generated from `typia.json.isStringify`.
44
+ *
45
+ * @evidence contracts/common.md#principled-implementation The variant tags a function that returns the serialized text, or `null` when the data is not of the type; `null` becomes a 500 `InternalServerErrorException` with a fixed message.
46
+ * @evidence contracts/common.md#clear-and-simple-design A two-member record, the tag and the function.
47
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
48
+ * @evidence contracts/common.md#meaningful-documentation The comment names the typia function the variant comes from.
49
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The variants describe JSON serialization and validation callbacks without native file or process representations.
50
+ */
8
51
  interface IIs<T> {
9
52
  type: "is";
53
+ /**
54
+ * The generated function of the variant, taking the response data.
55
+ *
56
+ * @evidence contracts/common.md#principled-implementation The transform generates the function for the return type of the route method, and it returns the serialized text or `null`.
57
+ * @evidence contracts/common.md#clear-and-simple-design One function member.
58
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The function is generated from the type, and the runtime never edits its result.
59
+ * @evidence contracts/common.md#meaningful-documentation The comment states that the function is generated for the return type; its result is in the signature.
60
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The variants describe JSON serialization and validation callbacks without native file or process representations.
61
+ */
10
62
  is: (input: T) => string | null;
11
63
  }
64
+ /**
65
+ * Serializer generated from `typia.json.assertStringify`.
66
+ *
67
+ * @evidence contracts/common.md#principled-implementation The variant tags a function that returns the serialized text or throws the `TypeGuardError` of typia, which becomes a 500 `InternalServerErrorException` with the path, reason, expected type, and value.
68
+ * @evidence contracts/common.md#clear-and-simple-design A two-member record, the tag and the function.
69
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
70
+ * @evidence contracts/common.md#meaningful-documentation The comment names the typia function the variant comes from.
71
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The variants describe JSON serialization and validation callbacks without native file or process representations.
72
+ */
12
73
  interface IAssert<T> {
13
74
  type: "assert";
75
+ /**
76
+ * The generated function of the variant, taking the response data.
77
+ *
78
+ * @evidence contracts/common.md#principled-implementation The transform generates the function for the return type of the route method, and it returns the serialized text or throws.
79
+ * @evidence contracts/common.md#clear-and-simple-design One function member.
80
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The function is generated from the type, and the runtime never edits its result.
81
+ * @evidence contracts/common.md#meaningful-documentation The comment states that the function is generated for the return type; its result is in the signature.
82
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The variants describe JSON serialization and validation callbacks without native file or process representations.
83
+ */
14
84
  assert: (input: T) => string;
15
85
  }
86
+ /**
87
+ * Serializer generated from `typia.json.validateStringify`.
88
+ *
89
+ * @evidence contracts/common.md#principled-implementation The variant tags a function that returns the `IValidation` of the text; a failure becomes a 500 `InternalServerErrorException` carrying every error.
90
+ * @evidence contracts/common.md#clear-and-simple-design A two-member record, the tag and the function.
91
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
92
+ * @evidence contracts/common.md#meaningful-documentation The comment names the typia function the variant comes from.
93
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The variants describe JSON serialization and validation callbacks without native file or process representations.
94
+ */
16
95
  interface IValidate<T> {
17
96
  type: "validate";
97
+ /**
98
+ * The generated function of the variant, taking the response data.
99
+ *
100
+ * @evidence contracts/common.md#principled-implementation The transform generates the function for the return type of the route method, and it returns the validation result.
101
+ * @evidence contracts/common.md#clear-and-simple-design One function member.
102
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The function is generated from the type, and the runtime never edits its result.
103
+ * @evidence contracts/common.md#meaningful-documentation The comment states that the function is generated for the return type; its result is in the signature.
104
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The variants describe JSON serialization and validation callbacks without native file or process representations.
105
+ */
18
106
  validate: (input: T) => IValidation<string>;
19
107
  }
108
+ /**
109
+ * Serializer generated from `typia.json.validateStringify`, for the
110
+ * `validate.log` mode.
111
+ *
112
+ * @evidence contracts/common.md#principled-implementation The variant tags the same function shape as `validate`, but a failure is passed to the logger registered with `TypedRoute.setValidateErrorLogger` and the response is `JSON.stringify` of the data, so a validation failure never changes the status.
113
+ * @evidence contracts/common.md#clear-and-simple-design A two-member record, the tag and the function.
114
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
115
+ * @evidence contracts/common.md#meaningful-documentation The comment names the typia function the variant comes from.
116
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The variants describe JSON serialization and validation callbacks without native file or process representations.
117
+ */
20
118
  interface IValidateLog<T> {
21
119
  type: "validate.log";
120
+ /**
121
+ * The generated function of the variant, taking the response data.
122
+ *
123
+ * @evidence contracts/common.md#principled-implementation The transform generates the function for the return type of the route method, and it returns the validation result.
124
+ * @evidence contracts/common.md#clear-and-simple-design One function member.
125
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The function is generated from the type, and the runtime never edits its result.
126
+ * @evidence contracts/common.md#meaningful-documentation The comment states that the function is generated for the return type; its result is in the signature.
127
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The variants describe JSON serialization and validation callbacks without native file or process representations.
128
+ */
22
129
  validate: (input: T) => IValidation<string>;
23
130
  }
24
131
  }
@@ -1,3 +1,13 @@
1
+ /**
2
+ * A class constructor: anything that can be called with `new` to build an
3
+ * instance of `T`.
4
+ *
5
+ * @evidence contracts/common.md#principled-implementation The construct signature with rest arguments is the standard TypeScript spelling of a class type.
6
+ * @evidence contracts/common.md#clear-and-simple-design One construct signature.
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 what the type stands for.
9
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The construct signature represents JavaScript class construction rather than a native resource boundary.
10
+ */
1
11
  export type Creator<T extends object> = {
2
12
  new (...args: any[]): T;
3
13
  };
@@ -1,3 +1,24 @@
1
+ /**
2
+ * Array helpers of the core runtime.
3
+ *
4
+ * @evidence contracts/common.md#principled-implementation The namespace holds the one membership helper the adapters use.
5
+ * @evidence contracts/common.md#clear-and-simple-design One function.
6
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a plain helper with no special cases.
7
+ * @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
8
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Array membership uses JavaScript SameValueZero comparisons with no native filesystem or process access.
9
+ */
1
10
  export declare namespace ArrayUtil {
11
+ /**
12
+ * Reports whether the array contains every one of the items.
13
+ *
14
+ * Membership is decided by `Array.prototype.includes`, so an item that is
15
+ * `undefined` or `NaN` is found when the array holds it.
16
+ *
17
+ * @evidence contracts/common.md#principled-implementation `Array.prototype.includes` compares by SameValueZero, so the result is the conjunction over the items of membership, an item that is `undefined` or `NaN` is found when the array holds it, and no items yields true; an earlier `find` compared the found element with `undefined` and could not report an `undefined` member.
18
+ * @evidence contracts/common.md#clear-and-simple-design One `every` over `includes`.
19
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts No item is special-cased.
20
+ * @evidence contracts/common.md#meaningful-documentation The comment states the conjunction and the comparison rule.
21
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Array membership uses JavaScript SameValueZero comparisons with no native filesystem or process access.
22
+ */
2
23
  function has<T>(array: T[], ...items: T[]): boolean;
3
24
  }
@@ -1,10 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ArrayUtil = void 0;
4
+ /**
5
+ * Array helpers of the core runtime.
6
+ *
7
+ * @evidence contracts/common.md#principled-implementation The namespace holds the one membership helper the adapters use.
8
+ * @evidence contracts/common.md#clear-and-simple-design One function.
9
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a plain helper with no special cases.
10
+ * @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
11
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Array membership uses JavaScript SameValueZero comparisons with no native filesystem or process access.
12
+ */
4
13
  var ArrayUtil;
5
14
  (function (ArrayUtil) {
15
+ /**
16
+ * Reports whether the array contains every one of the items.
17
+ *
18
+ * Membership is decided by `Array.prototype.includes`, so an item that is
19
+ * `undefined` or `NaN` is found when the array holds it.
20
+ *
21
+ * @evidence contracts/common.md#principled-implementation `Array.prototype.includes` compares by SameValueZero, so the result is the conjunction over the items of membership, an item that is `undefined` or `NaN` is found when the array holds it, and no items yields true; an earlier `find` compared the found element with `undefined` and could not report an `undefined` member.
22
+ * @evidence contracts/common.md#clear-and-simple-design One `every` over `includes`.
23
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts No item is special-cased.
24
+ * @evidence contracts/common.md#meaningful-documentation The comment states the conjunction and the comparison rule.
25
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Array membership uses JavaScript SameValueZero comparisons with no native filesystem or process access.
26
+ */
6
27
  function has(array, ...items) {
7
- return items.every((elem) => array.find((org) => org === elem) !== undefined);
28
+ return items.every((item) => array.includes(item));
8
29
  }
9
30
  ArrayUtil.has = has;
10
31
  })(ArrayUtil || (exports.ArrayUtil = ArrayUtil = {}));
@@ -1 +1 @@
1
- {"version":3,"file":"ArrayUtil.js","sourceRoot":"","sources":["../../src/utils/ArrayUtil.ts"],"names":[],"mappings":";;;AAAA,IAAiB,SAAS,CAMzB;AAND,WAAiB,SAAS;IACxB,SAAgB,GAAG,CAAI,KAAU,EAAE,GAAG,KAAU;QAC9C,OAAO,KAAK,CAAC,KAAK,CAChB,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,KAAK,IAAI,CAAC,KAAK,SAAS,CAC1D,CAAC;IACJ,CAAC;IAJe,UAAA,GAAG,MAIlB,CAAA;AACH,CAAC,EANgB,SAAS,aAAT,SAAS,GAAT,SAAS,QAMzB"}
1
+ {"version":3,"file":"ArrayUtil.js","sourceRoot":"","sources":["../../src/utils/ArrayUtil.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;GAQG;AACH,IAAiB,SAAS,CAgBzB;AAhBD,WAAiB,SAAS;IACxB;;;;;;;;;;;OAWG;IACH,SAAgB,GAAG,CAAI,KAAU,EAAE,GAAG,KAAU;QAC9C,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IACrD,CAAC;IAFe,UAAA,GAAG,MAElB,CAAA;AACH,CAAC,EAhBgB,SAAS,aAAT,SAAS,GAAT,SAAS,QAgBzB"}
@@ -25,6 +25,11 @@ import { Creator } from "../typings/Creator";
25
25
  * - `@nestia/fetcher.HttpError`
26
26
  *
27
27
  * @author Jeongho Nam - https://github.com/samchon
28
+ * @evidence contracts/common.md#principled-implementation Converters are kept as an ordered list of class and closure, and an error is converted by the first class it is an instance of; the insertion keeps every subclass before its superclasses so the most specific converter wins, and `HttpError` from the fetcher is registered by default.
29
+ * @evidence contracts/common.md#clear-and-simple-design One namespace with the two collections and four operations; the listener set and the tuple list are the only state.
30
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The registration is public and explicit; no error class is special-cased except the default `HttpError` conversion.
31
+ * @evidence contracts/common.md#meaningful-documentation The comment documents the converter and listener concepts with an example.
32
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Converter ordering and listener registration operate on JavaScript class and function identity, not native path or process identity.
28
33
  */
29
34
  export declare namespace ExceptionManager {
30
35
  /**
@@ -35,6 +40,11 @@ export declare namespace ExceptionManager {
35
40
  *
36
41
  * @param creator Target error class
37
42
  * @param closure A closure function converting to the `HttpException` class
43
+ * @evidence contracts/common.md#principled-implementation An existing entry for the same class is removed first, then the new entry is placed before the first registered class that it extends, so specificity order holds however the calls are ordered.
44
+ * @evidence contracts/common.md#clear-and-simple-design One function over one list.
45
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The order rule is derived from the prototype chain, not from a list of known classes.
46
+ * @evidence contracts/common.md#meaningful-documentation The comment states the replacement and ordering rules.
47
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Converter ordering and listener registration operate on JavaScript class and function identity, not native path or process identity.
38
48
  */
39
49
  function insert<T extends Error>(creator: Creator<T>, closure: Closure<T>): void;
40
50
  /**
@@ -42,9 +52,33 @@ export declare namespace ExceptionManager {
42
52
  *
43
53
  * @param creator Target error class
44
54
  * @returns Whether be erased or not
55
+ * @evidence contracts/common.md#principled-implementation The entry for the class is found by identity and removed, and the result says whether anything was removed.
56
+ * @evidence contracts/common.md#clear-and-simple-design One search and one removal.
57
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It removes only the named class's entry.
58
+ * @evidence contracts/common.md#meaningful-documentation The comment states the parameter and the boolean result.
59
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Converter ordering and listener registration operate on JavaScript class and function identity, not native path or process identity.
45
60
  */
46
61
  function erase<T extends Error>(creator: Creator<T>): boolean;
62
+ /**
63
+ * Registers a listener called with every error thrown by a typed route, after
64
+ * the response conversion.
65
+ *
66
+ * @evidence contracts/common.md#principled-implementation The listener is added to a set, so the same function registered twice is called once.
67
+ * @evidence contracts/common.md#clear-and-simple-design One set insertion.
68
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The listener only observes; the route notifies it after the current turn and ignores its errors.
69
+ * @evidence contracts/common.md#meaningful-documentation The comment states when listeners are called.
70
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Converter ordering and listener registration operate on JavaScript class and function identity, not native path or process identity.
71
+ */
47
72
  function on(closure: (error: any) => any): void;
73
+ /**
74
+ * Unregisters a listener added with {@link on}.
75
+ *
76
+ * @evidence contracts/common.md#principled-implementation The listener is removed from the set by identity.
77
+ * @evidence contracts/common.md#clear-and-simple-design One set deletion.
78
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It removes only the named listener.
79
+ * @evidence contracts/common.md#meaningful-documentation The comment names the counterpart operation.
80
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Converter ordering and listener registration operate on JavaScript class and function identity, not native path or process identity.
81
+ */
48
82
  function off(closure: (error: any) => any): void;
49
83
  /**
50
84
  * Type of a closure function converting to the regular
@@ -54,6 +88,12 @@ export declare namespace ExceptionManager {
54
88
  * from custom error to the regular {@link nest.HttpException} instance. It
55
89
  * would be used in the {@link ExceptionManager} with {@link TypedRoute} or
56
90
  * {@link EncryptedRoute}.
91
+ *
92
+ * @evidence contracts/common.md#principled-implementation A converter is a function from the caught error to an `HttpException`, whose status and body become the response.
93
+ * @evidence contracts/common.md#clear-and-simple-design One call signature.
94
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
95
+ * @evidence contracts/common.md#meaningful-documentation The comment documents the parameter and the return value.
96
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Converter ordering and listener registration operate on JavaScript class and function identity, not native path or process identity.
57
97
  */
58
98
  interface Closure<T extends Error> {
59
99
  /**
@@ -28,6 +28,11 @@ const common_1 = require("@nestjs/common");
28
28
  * - `@nestia/fetcher.HttpError`
29
29
  *
30
30
  * @author Jeongho Nam - https://github.com/samchon
31
+ * @evidence contracts/common.md#principled-implementation Converters are kept as an ordered list of class and closure, and an error is converted by the first class it is an instance of; the insertion keeps every subclass before its superclasses so the most specific converter wins, and `HttpError` from the fetcher is registered by default.
32
+ * @evidence contracts/common.md#clear-and-simple-design One namespace with the two collections and four operations; the listener set and the tuple list are the only state.
33
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The registration is public and explicit; no error class is special-cased except the default `HttpError` conversion.
34
+ * @evidence contracts/common.md#meaningful-documentation The comment documents the converter and listener concepts with an example.
35
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Converter ordering and listener registration operate on JavaScript class and function identity, not native path or process identity.
31
36
  */
32
37
  var ExceptionManager;
33
38
  (function (ExceptionManager) {
@@ -39,6 +44,11 @@ var ExceptionManager;
39
44
  *
40
45
  * @param creator Target error class
41
46
  * @param closure A closure function converting to the `HttpException` class
47
+ * @evidence contracts/common.md#principled-implementation An existing entry for the same class is removed first, then the new entry is placed before the first registered class that it extends, so specificity order holds however the calls are ordered.
48
+ * @evidence contracts/common.md#clear-and-simple-design One function over one list.
49
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The order rule is derived from the prototype chain, not from a list of known classes.
50
+ * @evidence contracts/common.md#meaningful-documentation The comment states the replacement and ordering rules.
51
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Converter ordering and listener registration operate on JavaScript class and function identity, not native path or process identity.
42
52
  */
43
53
  function insert(creator, closure) {
44
54
  const index = ExceptionManager.tuples.findIndex((tuple) => tuple[0] === creator);
@@ -58,6 +68,11 @@ var ExceptionManager;
58
68
  *
59
69
  * @param creator Target error class
60
70
  * @returns Whether be erased or not
71
+ * @evidence contracts/common.md#principled-implementation The entry for the class is found by identity and removed, and the result says whether anything was removed.
72
+ * @evidence contracts/common.md#clear-and-simple-design One search and one removal.
73
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It removes only the named class's entry.
74
+ * @evidence contracts/common.md#meaningful-documentation The comment states the parameter and the boolean result.
75
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Converter ordering and listener registration operate on JavaScript class and function identity, not native path or process identity.
61
76
  */
62
77
  function erase(creator) {
63
78
  const index = ExceptionManager.tuples.findIndex((tuple) => tuple[0] === creator);
@@ -67,10 +82,29 @@ var ExceptionManager;
67
82
  return true;
68
83
  }
69
84
  ExceptionManager.erase = erase;
85
+ /**
86
+ * Registers a listener called with every error thrown by a typed route, after
87
+ * the response conversion.
88
+ *
89
+ * @evidence contracts/common.md#principled-implementation The listener is added to a set, so the same function registered twice is called once.
90
+ * @evidence contracts/common.md#clear-and-simple-design One set insertion.
91
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The listener only observes; the route notifies it after the current turn and ignores its errors.
92
+ * @evidence contracts/common.md#meaningful-documentation The comment states when listeners are called.
93
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Converter ordering and listener registration operate on JavaScript class and function identity, not native path or process identity.
94
+ */
70
95
  function on(closure) {
71
96
  ExceptionManager.listeners.add(closure);
72
97
  }
73
98
  ExceptionManager.on = on;
99
+ /**
100
+ * Unregisters a listener added with {@link on}.
101
+ *
102
+ * @evidence contracts/common.md#principled-implementation The listener is removed from the set by identity.
103
+ * @evidence contracts/common.md#clear-and-simple-design One set deletion.
104
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It removes only the named listener.
105
+ * @evidence contracts/common.md#meaningful-documentation The comment names the counterpart operation.
106
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Converter ordering and listener registration operate on JavaScript class and function identity, not native path or process identity.
107
+ */
74
108
  function off(closure) {
75
109
  ExceptionManager.listeners.delete(closure);
76
110
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ExceptionManager.js","sourceRoot":"","sources":["../../src/utils/ExceptionManager.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAC5C,2CAA+C;AAI/C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,IAAiB,gBAAgB,CA2EhC;AA3ED,WAAiB,gBAAgB;IAC/B;;;;;;;;OAQG;IACH,SAAgB,MAAM,CACpB,OAAmB,EACnB,OAAmB;QAEnB,MAAM,KAAK,GAAW,uBAAM,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC;QACxE,IAAI,KAAK,KAAK,CAAC,CAAC;YAAE,uBAAM,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAE1C,wEAAwE;QACxE,mEAAmE;QACnE,MAAM,QAAQ,GAAW,uBAAM,CAAC,SAAS,CACvC,CAAC,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,YAAY,UAAU,CAC1D,CAAC;QACF,IAAI,QAAQ,KAAK,CAAC,CAAC;YAAE,uBAAM,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;;YAChD,uBAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IACtD,CAAC;IAde,iBAAA,MAAM,SAcrB,CAAA;IAED;;;;;OAKG;IACH,SAAgB,KAAK,CAAkB,OAAmB;QACxD,MAAM,KAAK,GAAW,uBAAM,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC;QACxE,IAAI,KAAK,KAAK,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;QAE/B,uBAAM,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;IANe,iBAAA,KAAK,QAMpB,CAAA;IAED,SAAgB,EAAE,CAAC,OAA4B;QAC7C,0BAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;IAFe,iBAAA,EAAE,KAEjB,CAAA;IAED,SAAgB,GAAG,CAAC,OAA4B;QAC9C,0BAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAFe,iBAAA,GAAG,MAElB,CAAA;IAwBD,gBAAgB;IACH,uBAAM,GAAwC,EAAE,CAAC;IAE9D,gBAAgB;IACH,0BAAS,GAA6B,IAAI,GAAG,EAAE,CAAC;AAC/D,CAAC,EA3EgB,gBAAgB,aAAhB,gBAAgB,GAAhB,gBAAgB,QA2EhC;AAED,gBAAgB,CAAC,MAAM,CACrB,mBAAS,EACT,CAAC,KAAK,EAAE,EAAE,CACR,IAAI,sBAAa,CACf;IACE,IAAI,EAAE,KAAK,CAAC,IAAI;IAChB,OAAO,EAAE,KAAK,CAAC,OAAO;CACvB,EACD,KAAK,CAAC,MAAM,CACb,CACJ,CAAC"}
1
+ {"version":3,"file":"ExceptionManager.js","sourceRoot":"","sources":["../../src/utils/ExceptionManager.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAC5C,2CAA+C;AAI/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,IAAiB,gBAAgB,CA8GhC;AA9GD,WAAiB,gBAAgB;IAC/B;;;;;;;;;;;;;OAaG;IACH,SAAgB,MAAM,CACpB,OAAmB,EACnB,OAAmB;QAEnB,MAAM,KAAK,GAAW,uBAAM,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC;QACxE,IAAI,KAAK,KAAK,CAAC,CAAC;YAAE,uBAAM,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAE1C,wEAAwE;QACxE,mEAAmE;QACnE,MAAM,QAAQ,GAAW,uBAAM,CAAC,SAAS,CACvC,CAAC,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,YAAY,UAAU,CAC1D,CAAC;QACF,IAAI,QAAQ,KAAK,CAAC,CAAC;YAAE,uBAAM,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;;YAChD,uBAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IACtD,CAAC;IAde,iBAAA,MAAM,SAcrB,CAAA;IAED;;;;;;;;;;OAUG;IACH,SAAgB,KAAK,CAAkB,OAAmB;QACxD,MAAM,KAAK,GAAW,uBAAM,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC;QACxE,IAAI,KAAK,KAAK,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;QAE/B,uBAAM,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;IANe,iBAAA,KAAK,QAMpB,CAAA;IAED;;;;;;;;;OASG;IACH,SAAgB,EAAE,CAAC,OAA4B;QAC7C,0BAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;IAFe,iBAAA,EAAE,KAEjB,CAAA;IAED;;;;;;;;OAQG;IACH,SAAgB,GAAG,CAAC,OAA4B;QAC9C,0BAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAFe,iBAAA,GAAG,MAElB,CAAA;IA8BD,gBAAgB;IACH,uBAAM,GAAwC,EAAE,CAAC;IAE9D,gBAAgB;IACH,0BAAS,GAA6B,IAAI,GAAG,EAAE,CAAC;AAC/D,CAAC,EA9GgB,gBAAgB,aAAhB,gBAAgB,GAAhB,gBAAgB,QA8GhC;AAED,gBAAgB,CAAC,MAAM,CACrB,mBAAS,EACT,CAAC,KAAK,EAAE,EAAE,CACR,IAAI,sBAAa,CACf;IACE,IAAI,EAAE,KAAK,CAAC,IAAI;IAChB,OAAO,EAAE,KAAK,CAAC,OAAO;CACvB,EACD,KAAK,CAAC,MAAM,CACb,CACJ,CAAC"}