@nestia/core 14.0.0 → 14.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MIGRATION.md +20 -0
- package/README.md +1 -1
- package/lib/adaptors/McpAdaptor.d.ts +29 -3
- package/lib/adaptors/McpAdaptor.js +150 -24
- package/lib/adaptors/McpAdaptor.js.map +1 -1
- package/lib/adaptors/WebSocketAdaptor.d.ts +37 -0
- package/lib/adaptors/WebSocketAdaptor.js +184 -48
- package/lib/adaptors/WebSocketAdaptor.js.map +1 -1
- package/lib/adaptors/internal/RoutePathMatcher.d.ts +1 -0
- package/lib/adaptors/internal/RoutePathMatcher.js +88 -0
- package/lib/adaptors/internal/RoutePathMatcher.js.map +1 -0
- package/lib/adaptors/internal/external_context.d.ts +1 -0
- package/lib/adaptors/internal/external_context.js +56 -0
- package/lib/adaptors/internal/external_context.js.map +1 -0
- package/lib/decorators/DynamicModule.d.ts +12 -0
- package/lib/decorators/DynamicModule.js +12 -0
- package/lib/decorators/DynamicModule.js.map +1 -1
- package/lib/decorators/EncryptedBody.d.ts +14 -6
- package/lib/decorators/EncryptedBody.js +39 -16
- package/lib/decorators/EncryptedBody.js.map +1 -1
- package/lib/decorators/EncryptedController.d.ts +6 -1
- package/lib/decorators/EncryptedController.js +7 -2
- package/lib/decorators/EncryptedController.js.map +1 -1
- package/lib/decorators/EncryptedModule.d.ts +25 -6
- package/lib/decorators/EncryptedModule.js +87 -18
- package/lib/decorators/EncryptedModule.js.map +1 -1
- package/lib/decorators/EncryptedRoute.d.ts +20 -11
- package/lib/decorators/EncryptedRoute.js +27 -13
- package/lib/decorators/EncryptedRoute.js.map +1 -1
- package/lib/decorators/HumanRoute.d.ts +5 -0
- package/lib/decorators/HumanRoute.js +5 -0
- package/lib/decorators/HumanRoute.js.map +1 -1
- package/lib/decorators/McpRoute.d.ts +31 -19
- package/lib/decorators/McpRoute.js +12 -1
- package/lib/decorators/McpRoute.js.map +1 -1
- package/lib/decorators/PlainBody.d.ts +7 -1
- package/lib/decorators/PlainBody.js +16 -8
- package/lib/decorators/PlainBody.js.map +1 -1
- package/lib/decorators/SwaggerCustomizer.d.ts +15 -0
- package/lib/decorators/SwaggerCustomizer.js +5 -0
- package/lib/decorators/SwaggerCustomizer.js.map +1 -1
- package/lib/decorators/SwaggerExample.d.ts +51 -22
- package/lib/decorators/SwaggerExample.js +35 -22
- package/lib/decorators/SwaggerExample.js.map +1 -1
- package/lib/decorators/TypedBody.d.ts +10 -3
- package/lib/decorators/TypedBody.js +20 -10
- package/lib/decorators/TypedBody.js.map +1 -1
- package/lib/decorators/TypedException.d.ts +10 -0
- package/lib/decorators/TypedFormData.d.ts +81 -9
- package/lib/decorators/TypedFormData.js +121 -31
- package/lib/decorators/TypedFormData.js.map +1 -1
- package/lib/decorators/TypedHeaders.d.ts +5 -0
- package/lib/decorators/TypedHeaders.js +5 -0
- package/lib/decorators/TypedHeaders.js.map +1 -1
- package/lib/decorators/TypedParam.d.ts +12 -3
- package/lib/decorators/TypedParam.js +12 -3
- package/lib/decorators/TypedParam.js.map +1 -1
- package/lib/decorators/TypedQuery.d.ts +17 -1
- package/lib/decorators/TypedQuery.js +25 -4
- package/lib/decorators/TypedQuery.js.map +1 -1
- package/lib/decorators/TypedRoute.d.ts +25 -10
- package/lib/decorators/TypedRoute.js +19 -10
- package/lib/decorators/TypedRoute.js.map +1 -1
- package/lib/decorators/WebSocketRoute.d.ts +18 -1
- package/lib/decorators/WebSocketRoute.js +18 -1
- package/lib/decorators/WebSocketRoute.js.map +1 -1
- package/lib/decorators/doNotThrowTransformError.d.ts +14 -0
- package/lib/decorators/doNotThrowTransformError.js +14 -0
- package/lib/decorators/doNotThrowTransformError.js.map +1 -1
- package/lib/decorators/internal/EncryptedConstant.js +13 -2
- package/lib/decorators/internal/EncryptedConstant.js.map +1 -1
- package/lib/decorators/internal/IRequestBodyValidation.d.ts +66 -0
- package/lib/decorators/internal/IRequestBodyValidation.js +3 -0
- package/lib/decorators/internal/IRequestBodyValidation.js.map +1 -0
- package/lib/decorators/internal/IWebSocketRouteReflect.d.ts +93 -1
- package/lib/decorators/internal/get_encryption_password.d.ts +1 -0
- package/lib/decorators/internal/get_encryption_password.js +14 -0
- package/lib/decorators/internal/get_encryption_password.js.map +1 -0
- package/lib/decorators/internal/get_path_and_querify.js +23 -9
- package/lib/decorators/internal/get_path_and_querify.js.map +1 -1
- package/lib/decorators/internal/get_path_and_stringify.js +3 -7
- package/lib/decorators/internal/get_path_and_stringify.js.map +1 -1
- package/lib/decorators/internal/get_text_body.js +9 -3
- package/lib/decorators/internal/get_text_body.js.map +1 -1
- package/lib/decorators/internal/group_entries.d.ts +1 -0
- package/lib/decorators/internal/group_entries.js +19 -0
- package/lib/decorators/internal/group_entries.js.map +1 -0
- package/lib/decorators/internal/load_controller.d.ts +14 -0
- package/lib/decorators/internal/load_controller.js +14 -0
- package/lib/decorators/internal/load_controller.js.map +1 -1
- package/lib/decorators/internal/split_route_arguments.d.ts +1 -0
- package/lib/decorators/internal/split_route_arguments.js +22 -0
- package/lib/decorators/internal/split_route_arguments.js.map +1 -0
- package/lib/decorators/internal/validate_request_body.js +68 -25
- package/lib/decorators/internal/validate_request_body.js.map +1 -1
- package/lib/decorators/internal/validate_request_form_data.js +3 -1
- package/lib/decorators/internal/validate_request_form_data.js.map +1 -1
- package/lib/decorators/internal/validate_request_headers.js +2 -1
- package/lib/decorators/internal/validate_request_headers.js.map +1 -1
- package/lib/decorators/internal/validate_request_query.js +3 -1
- package/lib/decorators/internal/validate_request_query.js.map +1 -1
- package/lib/options/IRequestBodyValidator.d.ts +71 -0
- package/lib/options/IRequestFormDataProps.d.ts +80 -0
- package/lib/options/IRequestHeadersValidator.d.ts +67 -0
- package/lib/options/IRequestQueryValidator.d.ts +68 -0
- package/lib/options/IResponseBodyQuerifier.d.ts +125 -1
- package/lib/options/IResponseBodyStringifier.d.ts +107 -0
- package/lib/typings/Creator.d.ts +10 -0
- package/lib/utils/ArrayUtil.d.ts +21 -0
- package/lib/utils/ArrayUtil.js +22 -1
- package/lib/utils/ArrayUtil.js.map +1 -1
- package/lib/utils/ExceptionManager.d.ts +43 -4
- package/lib/utils/ExceptionManager.js +44 -6
- package/lib/utils/ExceptionManager.js.map +1 -1
- package/lib/utils/SourceFinder.d.ts +22 -0
- package/lib/utils/SourceFinder.js +60 -10
- package/lib/utils/SourceFinder.js.map +1 -1
- package/lib/utils/VersioningStrategy.d.ts +45 -2
- package/lib/utils/VersioningStrategy.js +40 -7
- package/lib/utils/VersioningStrategy.js.map +1 -1
- package/native/go.mod +1 -1
- package/native/go.sum +2 -2
- package/native/plugin/plan.go +68 -2
- package/native/transform/ast.go +23 -3
- package/native/transform/build.go +51 -57
- package/native/transform/buildoutput/output.go +147 -0
- package/native/transform/contributor.go +9 -0
- package/native/transform/core_querify.go +63 -9
- package/native/transform/core_transform.go +180 -98
- package/native/transform/core_websocket.go +111 -14
- package/native/transform/node_transform.go +17 -8
- package/native/transform/package.go +55 -0
- package/native/transform/printer.go +1 -3
- package/native/transform/run.go +18 -0
- package/native/transform/schemaprojection/project.go +213 -0
- package/native/transform/transform.go +29 -18
- package/native/transform/typia_fast.go +6 -0
- package/native/transform.cjs +49 -0
- package/package.json +13 -15
- package/src/adaptors/McpAdaptor.ts +215 -33
- package/src/adaptors/WebSocketAdaptor.ts +202 -52
- package/src/adaptors/internal/RoutePathMatcher.ts +91 -0
- package/src/adaptors/internal/external_context.ts +81 -0
- package/src/decorators/DynamicModule.ts +12 -0
- package/src/decorators/EncryptedBody.ts +39 -15
- package/src/decorators/EncryptedController.ts +12 -3
- package/src/decorators/EncryptedModule.ts +89 -18
- package/src/decorators/EncryptedRoute.ts +27 -16
- package/src/decorators/HumanRoute.ts +5 -0
- package/src/decorators/McpRoute.ts +31 -19
- package/src/decorators/PlainBody.ts +20 -10
- package/src/decorators/SwaggerCustomizer.ts +15 -0
- package/src/decorators/SwaggerExample.ts +51 -22
- package/src/decorators/TypedBody.ts +18 -9
- package/src/decorators/TypedException.ts +10 -0
- package/src/decorators/TypedFormData.ts +207 -45
- package/src/decorators/TypedHeaders.ts +5 -0
- package/src/decorators/TypedParam.ts +12 -3
- package/src/decorators/TypedQuery.ts +35 -7
- package/src/decorators/TypedRoute.ts +25 -10
- package/src/decorators/WebSocketRoute.ts +18 -1
- package/src/decorators/doNotThrowTransformError.ts +14 -0
- package/src/decorators/internal/EncryptedConstant.ts +14 -1
- package/src/decorators/internal/IMcpRouteReflect.ts +7 -1
- package/src/decorators/internal/IRequestBodyValidation.ts +65 -0
- package/src/decorators/internal/IWebSocketRouteReflect.ts +95 -1
- package/src/decorators/internal/get_encryption_password.ts +19 -0
- package/src/decorators/internal/get_path_and_querify.ts +31 -10
- package/src/decorators/internal/get_path_and_stringify.ts +3 -9
- package/src/decorators/internal/get_text_body.ts +8 -4
- package/src/decorators/internal/group_entries.ts +17 -0
- package/src/decorators/internal/load_controller.ts +14 -0
- package/src/decorators/internal/split_route_arguments.ts +20 -0
- package/src/decorators/internal/validate_request_body.ts +87 -34
- package/src/decorators/internal/validate_request_form_data.ts +3 -1
- package/src/decorators/internal/validate_request_headers.ts +2 -2
- package/src/decorators/internal/validate_request_query.ts +3 -2
- package/src/options/IRequestBodyValidator.ts +71 -0
- package/src/options/IRequestFormDataProps.ts +80 -0
- package/src/options/IRequestHeadersValidator.ts +67 -0
- package/src/options/IRequestQueryValidator.ts +68 -0
- package/src/options/IResponseBodyQuerifier.ts +126 -1
- package/src/options/IResponseBodyStringifier.ts +107 -0
- package/src/typings/Creator.ts +10 -0
- package/src/utils/ArrayUtil.ts +22 -3
- package/src/utils/ExceptionManager.ts +50 -6
- package/src/utils/SourceFinder.ts +62 -10
- package/src/utils/VersioningStrategy.ts +55 -11
- package/lib/transform.d.ts +0 -10
- package/lib/transform.js +0 -25
- package/lib/transform.js.map +0 -1
- package/src/transform.ts +0 -26
|
@@ -1,16 +1,83 @@
|
|
|
1
1
|
import { IValidation } from "typia";
|
|
2
2
|
export type IRequestHeadersValidator<T> = IRequestHeadersValidator.IAssert<T> | IRequestHeadersValidator.IIs<T> | IRequestHeadersValidator.IValidate<T>;
|
|
3
|
+
/**
|
|
4
|
+
* The request headers validator that the transform passes to `TypedHeaders`.
|
|
5
|
+
*
|
|
6
|
+
* The literal `type` field selects which typia function generated the
|
|
7
|
+
* validator: `assert`, `is`, or `validate`. `validate_request_headers` turns a
|
|
8
|
+
* failure of any variant into a 400 response.
|
|
9
|
+
*
|
|
10
|
+
* @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.
|
|
11
|
+
* @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.
|
|
12
|
+
* @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.
|
|
13
|
+
* @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.
|
|
14
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation The validator consumes HTTP header records and returns decoded values independently of native filesystem or process spelling.
|
|
15
|
+
*/
|
|
3
16
|
export declare namespace IRequestHeadersValidator {
|
|
17
|
+
/**
|
|
18
|
+
* Validator generated from `typia.assert`.
|
|
19
|
+
*
|
|
20
|
+
* @evidence contracts/common.md#principled-implementation The variant tags a function of the header record of the request, whose values are strings, string arrays, or undefined that returns the decoded object or throws the `TypeGuardError` of typia; `validate_request_headers` catches the error and converts it to a `BadRequestException` carrying the path, reason, expected type, and value of the first failure.
|
|
21
|
+
* @evidence contracts/common.md#clear-and-simple-design A two-member record, the tag and the function.
|
|
22
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
|
|
23
|
+
* @evidence contracts/common.md#meaningful-documentation The comment names the typia function the variant comes from; the failure response is stated on the union.
|
|
24
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation The validator consumes HTTP header records and returns decoded values independently of native filesystem or process spelling.
|
|
25
|
+
*/
|
|
4
26
|
interface IAssert<T> {
|
|
5
27
|
type: "assert";
|
|
28
|
+
/**
|
|
29
|
+
* The typia assertion function generated for the requested type.
|
|
30
|
+
*
|
|
31
|
+
* @evidence contracts/common.md#principled-implementation The transform generates the function for the type argument of the decorator, taking the header record of the request, whose values are strings, string arrays, or undefined and it returns the decoded object or throws the `TypeGuardError` of typia.
|
|
32
|
+
* @evidence contracts/common.md#clear-and-simple-design One function member with the input the decorator has.
|
|
33
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The function is generated from the type, and the runtime never edits its result.
|
|
34
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states that the function is generated for the requested type; its input is in the signature.
|
|
35
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation The validator consumes HTTP header records and returns decoded values independently of native filesystem or process spelling.
|
|
36
|
+
*/
|
|
6
37
|
assert: (input: Record<string, string | string[] | undefined>) => T;
|
|
7
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Validator generated from `typia.is`.
|
|
41
|
+
*
|
|
42
|
+
* @evidence contracts/common.md#principled-implementation The variant tags a function of the header record of the request, whose values are strings, string arrays, or undefined 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.
|
|
43
|
+
* @evidence contracts/common.md#clear-and-simple-design A two-member record, the tag and the function.
|
|
44
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
|
|
45
|
+
* @evidence contracts/common.md#meaningful-documentation The comment names the typia function the variant comes from.
|
|
46
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation The validator consumes HTTP header records and returns decoded values independently of native filesystem or process spelling.
|
|
47
|
+
*/
|
|
8
48
|
interface IIs<T> {
|
|
9
49
|
type: "is";
|
|
50
|
+
/**
|
|
51
|
+
* The typia check function generated for the requested type.
|
|
52
|
+
*
|
|
53
|
+
* @evidence contracts/common.md#principled-implementation The transform generates the function for the type argument of the decorator, taking the header record of the request, whose values are strings, string arrays, or undefined and returning the decoded object or `null`.
|
|
54
|
+
* @evidence contracts/common.md#clear-and-simple-design One function member with the input the decorator has.
|
|
55
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The function is generated from the type, and the runtime never edits its result.
|
|
56
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states that the function is generated for the requested type; its result is in the signature.
|
|
57
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation The validator consumes HTTP header records and returns decoded values independently of native filesystem or process spelling.
|
|
58
|
+
*/
|
|
10
59
|
is: (input: Record<string, string | string[] | undefined>) => T | null;
|
|
11
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Validator generated from `typia.validate`.
|
|
63
|
+
*
|
|
64
|
+
* @evidence contracts/common.md#principled-implementation The variant tags a function of the header record of the request, whose values are strings, string arrays, or undefined that returns the `IValidation` of typia; a failed result becomes a `BadRequestException` carrying every error of the validation.
|
|
65
|
+
* @evidence contracts/common.md#clear-and-simple-design A two-member record, the tag and the function.
|
|
66
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
|
|
67
|
+
* @evidence contracts/common.md#meaningful-documentation The comment names the typia function the variant comes from.
|
|
68
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation The validator consumes HTTP header records and returns decoded values independently of native filesystem or process spelling.
|
|
69
|
+
*/
|
|
12
70
|
interface IValidate<T> {
|
|
13
71
|
type: "validate";
|
|
72
|
+
/**
|
|
73
|
+
* The typia validation function generated for the requested type.
|
|
74
|
+
*
|
|
75
|
+
* @evidence contracts/common.md#principled-implementation The transform generates the function for the type argument of the decorator, taking the header record of the request, whose values are strings, string arrays, or undefined and returning the validation result with every error.
|
|
76
|
+
* @evidence contracts/common.md#clear-and-simple-design One function member with the input the decorator has.
|
|
77
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The function is generated from the type, and the runtime never edits its result.
|
|
78
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states that the function is generated for the requested type; its result is in the signature.
|
|
79
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation The validator consumes HTTP header records and returns decoded values independently of native filesystem or process spelling.
|
|
80
|
+
*/
|
|
14
81
|
validate: (input: Record<string, string | string[] | undefined>) => IValidation<T>;
|
|
15
82
|
}
|
|
16
83
|
}
|
|
@@ -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,20 +1,144 @@
|
|
|
1
1
|
import { IValidation } from "typia";
|
|
2
|
-
|
|
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
|
+
*/
|
|
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
|
+
*/
|
|
119
|
+
validate: (input: T) => IValidation<URLSearchParams>;
|
|
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
|
+
*/
|
|
131
|
+
interface IValidateLog<T> {
|
|
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
|
+
*/
|
|
18
142
|
validate: (input: T) => IValidation<URLSearchParams>;
|
|
19
143
|
}
|
|
20
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
|
}
|
package/lib/typings/Creator.d.ts
CHANGED
|
@@ -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
|
};
|
package/lib/utils/ArrayUtil.d.ts
CHANGED
|
@@ -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
|
}
|
package/lib/utils/ArrayUtil.js
CHANGED
|
@@ -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((
|
|
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,
|
|
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"}
|