@nestia/core 10.0.2 → 11.0.0-dev.20260305
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/LICENSE +21 -21
- package/README.md +93 -93
- package/lib/adaptors/WebSocketAdaptor.js.map +1 -1
- package/lib/decorators/DynamicModule.js +54 -10
- package/lib/decorators/DynamicModule.js.map +1 -1
- package/lib/decorators/EncryptedBody.js +2 -2
- package/lib/decorators/EncryptedBody.js.map +1 -1
- package/lib/decorators/EncryptedController.d.ts +1 -1
- package/lib/decorators/EncryptedModule.d.ts +1 -1
- package/lib/decorators/EncryptedModule.js +54 -10
- package/lib/decorators/EncryptedModule.js.map +1 -1
- package/lib/decorators/EncryptedRoute.js +2 -2
- package/lib/decorators/EncryptedRoute.js.map +1 -1
- package/lib/decorators/HumanRoute.d.ts +1 -2
- package/lib/decorators/HumanRoute.js +1 -2
- package/lib/decorators/HumanRoute.js.map +1 -1
- package/lib/decorators/NoTransformConfigurationError.js +1 -1
- package/lib/decorators/NoTransformConfigurationError.js.map +1 -1
- package/lib/decorators/SwaggerCustomizer.d.ts +1 -1
- package/lib/decorators/TypedFormData.js.map +1 -1
- package/lib/decorators/TypedParam.js +1 -1
- package/lib/decorators/TypedParam.js.map +1 -1
- package/lib/decorators/internal/get_path_and_querify.js +1 -1
- package/lib/decorators/internal/get_path_and_querify.js.map +1 -1
- package/lib/decorators/internal/get_path_and_stringify.js +1 -1
- package/lib/decorators/internal/get_path_and_stringify.js.map +1 -1
- package/lib/decorators/internal/headers_to_object.js.map +1 -1
- package/lib/decorators/internal/validate_request_body.js +1 -1
- package/lib/decorators/internal/validate_request_body.js.map +1 -1
- package/lib/decorators/internal/validate_request_form_data.js +1 -1
- package/lib/decorators/internal/validate_request_form_data.js.map +1 -1
- package/lib/decorators/internal/validate_request_headers.js +1 -1
- package/lib/decorators/internal/validate_request_headers.js.map +1 -1
- package/lib/decorators/internal/validate_request_query.js +1 -1
- package/lib/decorators/internal/validate_request_query.js.map +1 -1
- package/lib/module.d.ts +1 -0
- package/lib/module.js +1 -0
- package/lib/module.js.map +1 -1
- package/lib/options/INestiaTransformProject.d.ts +1 -1
- package/lib/programmers/PlainBodyProgrammer.js +5 -8
- package/lib/programmers/PlainBodyProgrammer.js.map +1 -1
- package/lib/programmers/TypedBodyProgrammer.js +13 -21
- package/lib/programmers/TypedBodyProgrammer.js.map +1 -1
- package/lib/programmers/TypedFormDataBodyProgrammer.js +11 -20
- package/lib/programmers/TypedFormDataBodyProgrammer.js.map +1 -1
- package/lib/programmers/TypedHeadersProgrammer.js +4 -6
- package/lib/programmers/TypedHeadersProgrammer.js.map +1 -1
- package/lib/programmers/TypedParamProgrammer.js +2 -2
- package/lib/programmers/TypedParamProgrammer.js.map +1 -1
- package/lib/programmers/TypedQueryBodyProgrammer.js +9 -16
- package/lib/programmers/TypedQueryBodyProgrammer.js.map +1 -1
- package/lib/programmers/TypedQueryProgrammer.js +9 -16
- package/lib/programmers/TypedQueryProgrammer.js.map +1 -1
- package/lib/programmers/TypedQueryRouteProgrammer.js +6 -10
- package/lib/programmers/TypedQueryRouteProgrammer.js.map +1 -1
- package/lib/programmers/TypedRouteProgrammer.js +8 -13
- package/lib/programmers/TypedRouteProgrammer.js.map +1 -1
- package/lib/programmers/http/HttpAssertQuerifyProgrammer.d.ts +1 -1
- package/lib/programmers/http/HttpAssertQuerifyProgrammer.js +5 -7
- package/lib/programmers/http/HttpAssertQuerifyProgrammer.js.map +1 -1
- package/lib/programmers/http/HttpIsQuerifyProgrammer.d.ts +1 -1
- package/lib/programmers/http/HttpIsQuerifyProgrammer.js +5 -7
- package/lib/programmers/http/HttpIsQuerifyProgrammer.js.map +1 -1
- package/lib/programmers/http/HttpQuerifyProgrammer.d.ts +1 -1
- package/lib/programmers/http/HttpQuerifyProgrammer.js +13 -19
- package/lib/programmers/http/HttpQuerifyProgrammer.js.map +1 -1
- package/lib/programmers/http/HttpValidateQuerifyProgrammer.d.ts +1 -1
- package/lib/programmers/http/HttpValidateQuerifyProgrammer.js +6 -8
- package/lib/programmers/http/HttpValidateQuerifyProgrammer.js.map +1 -1
- package/lib/programmers/internal/CoreMetadataUtil.d.ts +3 -3
- package/lib/programmers/internal/CoreMetadataUtil.js.map +1 -1
- package/lib/transform.d.ts +1 -1
- package/lib/transform.js.map +1 -1
- package/lib/transformers/FileTransformer.js +2 -2
- package/lib/transformers/FileTransformer.js.map +1 -1
- package/lib/transformers/MethodTransformer.js.map +1 -1
- package/lib/transformers/ParameterDecoratorTransformer.js +1 -1
- package/lib/transformers/ParameterDecoratorTransformer.js.map +1 -1
- package/lib/transformers/TypedRouteTransformer.js +1 -1
- package/lib/transformers/TypedRouteTransformer.js.map +1 -1
- package/lib/transformers/WebSocketRouteTransformer.js +1 -1
- package/lib/transformers/WebSocketRouteTransformer.js.map +1 -1
- package/package.json +34 -26
- package/src/adaptors/WebSocketAdaptor.ts +429 -429
- package/src/decorators/DynamicModule.ts +44 -44
- package/src/decorators/EncryptedBody.ts +96 -97
- package/src/decorators/EncryptedController.ts +40 -40
- package/src/decorators/EncryptedModule.ts +98 -98
- package/src/decorators/EncryptedRoute.ts +212 -213
- package/src/decorators/HumanRoute.ts +21 -22
- package/src/decorators/NoTransformConfigurationError.ts +34 -34
- package/src/decorators/PlainBody.ts +76 -76
- package/src/decorators/SwaggerCustomizer.ts +97 -97
- package/src/decorators/SwaggerExample.ts +100 -100
- package/src/decorators/TypedBody.ts +57 -57
- package/src/decorators/TypedException.ts +147 -147
- package/src/decorators/TypedFormData.ts +187 -195
- package/src/decorators/TypedHeaders.ts +66 -66
- package/src/decorators/TypedParam.ts +77 -77
- package/src/decorators/TypedQuery.ts +234 -234
- package/src/decorators/TypedRoute.ts +196 -196
- package/src/decorators/WebSocketRoute.ts +242 -242
- package/src/decorators/internal/EncryptedConstant.ts +2 -2
- package/src/decorators/internal/IWebSocketRouteReflect.ts +23 -23
- package/src/decorators/internal/NoTransformConfigureError.ts +2 -2
- package/src/decorators/internal/get_path_and_querify.ts +94 -94
- package/src/decorators/internal/get_path_and_stringify.ts +110 -110
- package/src/decorators/internal/get_text_body.ts +16 -16
- package/src/decorators/internal/headers_to_object.ts +11 -11
- package/src/decorators/internal/is_request_body_undefined.ts +12 -12
- package/src/decorators/internal/load_controller.ts +45 -45
- package/src/decorators/internal/route_error.ts +43 -43
- package/src/decorators/internal/validate_request_body.ts +64 -64
- package/src/decorators/internal/validate_request_form_data.ts +67 -67
- package/src/decorators/internal/validate_request_headers.ts +76 -76
- package/src/decorators/internal/validate_request_query.ts +64 -64
- package/src/index.ts +5 -5
- package/src/module.ts +23 -22
- package/src/options/INestiaTransformOptions.ts +34 -34
- package/src/options/INestiaTransformProject.ts +10 -8
- package/src/options/IRequestBodyValidator.ts +20 -20
- package/src/options/IRequestFormDataProps.ts +27 -27
- package/src/options/IRequestHeadersValidator.ts +22 -22
- package/src/options/IRequestQueryValidator.ts +20 -20
- package/src/options/IResponseBodyQuerifier.ts +25 -25
- package/src/options/IResponseBodyStringifier.ts +30 -30
- package/src/programmers/PlainBodyProgrammer.ts +72 -70
- package/src/programmers/TypedBodyProgrammer.ts +144 -142
- package/src/programmers/TypedFormDataBodyProgrammer.ts +118 -118
- package/src/programmers/TypedHeadersProgrammer.ts +65 -63
- package/src/programmers/TypedParamProgrammer.ts +33 -33
- package/src/programmers/TypedQueryBodyProgrammer.ts +111 -109
- package/src/programmers/TypedQueryProgrammer.ts +113 -111
- package/src/programmers/TypedQueryRouteProgrammer.ts +104 -102
- package/src/programmers/TypedRouteProgrammer.ts +96 -94
- package/src/programmers/http/HttpAssertQuerifyProgrammer.ts +74 -72
- package/src/programmers/http/HttpIsQuerifyProgrammer.ts +77 -75
- package/src/programmers/http/HttpQuerifyProgrammer.ts +110 -108
- package/src/programmers/http/HttpValidateQuerifyProgrammer.ts +78 -76
- package/src/programmers/internal/CoreMetadataUtil.ts +21 -21
- package/src/transform.ts +35 -35
- package/src/transformers/FileTransformer.ts +109 -110
- package/src/transformers/MethodTransformer.ts +103 -103
- package/src/transformers/NodeTransformer.ts +23 -23
- package/src/transformers/ParameterDecoratorTransformer.ts +143 -143
- package/src/transformers/ParameterTransformer.ts +57 -57
- package/src/transformers/TypedRouteTransformer.ts +85 -85
- package/src/transformers/WebSocketRouteTransformer.ts +120 -120
- package/src/typings/Creator.ts +3 -3
- package/src/typings/get-function-location.d.ts +7 -7
- package/src/utils/ArrayUtil.ts +7 -7
- package/src/utils/ExceptionManager.ts +115 -115
- package/src/utils/Singleton.ts +16 -16
- package/src/utils/SourceFinder.ts +54 -54
- package/src/utils/VersioningStrategy.ts +27 -27
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
export interface INestiaTransformOptions {
|
|
2
|
-
validate?: INestiaTransformOptions.Validate;
|
|
3
|
-
stringify?: INestiaTransformOptions.Stringify | null;
|
|
4
|
-
llm?: INestiaTransformOptions.ILlm;
|
|
5
|
-
throws?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export namespace INestiaTransformOptions {
|
|
8
|
-
export type Validate =
|
|
9
|
-
// NORMAL
|
|
10
|
-
| "assert"
|
|
11
|
-
| "is"
|
|
12
|
-
| "validate"
|
|
13
|
-
// STRICT
|
|
14
|
-
| "assertEquals"
|
|
15
|
-
| "equals"
|
|
16
|
-
| "validateEquals"
|
|
17
|
-
// CLONE
|
|
18
|
-
| "assertClone"
|
|
19
|
-
| "validateClone"
|
|
20
|
-
// PRUNE
|
|
21
|
-
| "assertPrune"
|
|
22
|
-
| "validatePrune";
|
|
23
|
-
|
|
24
|
-
export type Stringify =
|
|
25
|
-
| "stringify"
|
|
26
|
-
| "assert"
|
|
27
|
-
| "is"
|
|
28
|
-
| "validate"
|
|
29
|
-
| "validate.log";
|
|
30
|
-
|
|
31
|
-
export interface ILlm {
|
|
32
|
-
strict?: boolean;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
1
|
+
export interface INestiaTransformOptions {
|
|
2
|
+
validate?: INestiaTransformOptions.Validate;
|
|
3
|
+
stringify?: INestiaTransformOptions.Stringify | null;
|
|
4
|
+
llm?: INestiaTransformOptions.ILlm;
|
|
5
|
+
throws?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export namespace INestiaTransformOptions {
|
|
8
|
+
export type Validate =
|
|
9
|
+
// NORMAL
|
|
10
|
+
| "assert"
|
|
11
|
+
| "is"
|
|
12
|
+
| "validate"
|
|
13
|
+
// STRICT
|
|
14
|
+
| "assertEquals"
|
|
15
|
+
| "equals"
|
|
16
|
+
| "validateEquals"
|
|
17
|
+
// CLONE
|
|
18
|
+
| "assertClone"
|
|
19
|
+
| "validateClone"
|
|
20
|
+
// PRUNE
|
|
21
|
+
| "assertPrune"
|
|
22
|
+
| "validatePrune";
|
|
23
|
+
|
|
24
|
+
export type Stringify =
|
|
25
|
+
| "stringify"
|
|
26
|
+
| "assert"
|
|
27
|
+
| "is"
|
|
28
|
+
| "validate"
|
|
29
|
+
| "validate.log";
|
|
30
|
+
|
|
31
|
+
export interface ILlm {
|
|
32
|
+
strict?: boolean;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { ITypiaContext } from "typia/
|
|
2
|
-
|
|
3
|
-
import { INestiaTransformOptions } from "./INestiaTransformOptions";
|
|
4
|
-
|
|
5
|
-
export interface INestiaTransformContext
|
|
6
|
-
|
|
7
|
-
options
|
|
8
|
-
|
|
1
|
+
import { ITypiaContext } from "@typia/core";
|
|
2
|
+
|
|
3
|
+
import { INestiaTransformOptions } from "./INestiaTransformOptions";
|
|
4
|
+
|
|
5
|
+
export interface INestiaTransformContext extends Omit<
|
|
6
|
+
ITypiaContext,
|
|
7
|
+
"options"
|
|
8
|
+
> {
|
|
9
|
+
options: INestiaTransformOptions;
|
|
10
|
+
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { IValidation } from "typia";
|
|
2
|
-
|
|
3
|
-
export type IRequestBodyValidator<T> =
|
|
4
|
-
| IRequestBodyValidator.IAssert<T>
|
|
5
|
-
| IRequestBodyValidator.IIs<T>
|
|
6
|
-
| IRequestBodyValidator.IValidate<T>;
|
|
7
|
-
export namespace IRequestBodyValidator {
|
|
8
|
-
export interface IAssert<T> {
|
|
9
|
-
type: "assert";
|
|
10
|
-
assert: (input: T) => T;
|
|
11
|
-
}
|
|
12
|
-
export interface IIs<T> {
|
|
13
|
-
type: "is";
|
|
14
|
-
is: (input: T) => boolean;
|
|
15
|
-
}
|
|
16
|
-
export interface IValidate<T> {
|
|
17
|
-
type: "validate";
|
|
18
|
-
validate: (input: T) => IValidation<T>;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
1
|
+
import { IValidation } from "typia";
|
|
2
|
+
|
|
3
|
+
export type IRequestBodyValidator<T> =
|
|
4
|
+
| IRequestBodyValidator.IAssert<T>
|
|
5
|
+
| IRequestBodyValidator.IIs<T>
|
|
6
|
+
| IRequestBodyValidator.IValidate<T>;
|
|
7
|
+
export namespace IRequestBodyValidator {
|
|
8
|
+
export interface IAssert<T> {
|
|
9
|
+
type: "assert";
|
|
10
|
+
assert: (input: T) => T;
|
|
11
|
+
}
|
|
12
|
+
export interface IIs<T> {
|
|
13
|
+
type: "is";
|
|
14
|
+
is: (input: T) => boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface IValidate<T> {
|
|
17
|
+
type: "validate";
|
|
18
|
+
validate: (input: T) => IValidation<T>;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { IValidation } from "typia";
|
|
2
|
-
|
|
3
|
-
export interface IRequestFormDataProps<T> {
|
|
4
|
-
files: Array<IRequestFormDataProps.IFile>;
|
|
5
|
-
validator:
|
|
6
|
-
| IRequestFormDataProps.IAssert<T>
|
|
7
|
-
| IRequestFormDataProps.IIs<T>
|
|
8
|
-
| IRequestFormDataProps.IValidate<T>;
|
|
9
|
-
}
|
|
10
|
-
export namespace IRequestFormDataProps {
|
|
11
|
-
export interface IAssert<T> {
|
|
12
|
-
type: "assert";
|
|
13
|
-
assert: (input: FormData) => T;
|
|
14
|
-
}
|
|
15
|
-
export interface IIs<T> {
|
|
16
|
-
type: "is";
|
|
17
|
-
is: (input: FormData) => T | null;
|
|
18
|
-
}
|
|
19
|
-
export interface IValidate<T> {
|
|
20
|
-
type: "validate";
|
|
21
|
-
validate: (input: FormData) => IValidation<T>;
|
|
22
|
-
}
|
|
23
|
-
export interface IFile {
|
|
24
|
-
name: string;
|
|
25
|
-
limit: number | null;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
1
|
+
import { IValidation } from "typia";
|
|
2
|
+
|
|
3
|
+
export interface IRequestFormDataProps<T> {
|
|
4
|
+
files: Array<IRequestFormDataProps.IFile>;
|
|
5
|
+
validator:
|
|
6
|
+
| IRequestFormDataProps.IAssert<T>
|
|
7
|
+
| IRequestFormDataProps.IIs<T>
|
|
8
|
+
| IRequestFormDataProps.IValidate<T>;
|
|
9
|
+
}
|
|
10
|
+
export namespace IRequestFormDataProps {
|
|
11
|
+
export interface IAssert<T> {
|
|
12
|
+
type: "assert";
|
|
13
|
+
assert: (input: FormData) => T;
|
|
14
|
+
}
|
|
15
|
+
export interface IIs<T> {
|
|
16
|
+
type: "is";
|
|
17
|
+
is: (input: FormData) => T | null;
|
|
18
|
+
}
|
|
19
|
+
export interface IValidate<T> {
|
|
20
|
+
type: "validate";
|
|
21
|
+
validate: (input: FormData) => IValidation<T>;
|
|
22
|
+
}
|
|
23
|
+
export interface IFile {
|
|
24
|
+
name: string;
|
|
25
|
+
limit: number | null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { IValidation } from "typia";
|
|
2
|
-
|
|
3
|
-
export type IRequestHeadersValidator<T> =
|
|
4
|
-
| IRequestHeadersValidator.IAssert<T>
|
|
5
|
-
| IRequestHeadersValidator.IIs<T>
|
|
6
|
-
| IRequestHeadersValidator.IValidate<T>;
|
|
7
|
-
export namespace IRequestHeadersValidator {
|
|
8
|
-
export interface IAssert<T> {
|
|
9
|
-
type: "assert";
|
|
10
|
-
assert: (input: Record<string, string | string[] | undefined>) => T;
|
|
11
|
-
}
|
|
12
|
-
export interface IIs<T> {
|
|
13
|
-
type: "is";
|
|
14
|
-
is: (input: Record<string, string | string[] | undefined>) => T | null;
|
|
15
|
-
}
|
|
16
|
-
export interface IValidate<T> {
|
|
17
|
-
type: "validate";
|
|
18
|
-
validate: (
|
|
19
|
-
input: Record<string, string | string[] | undefined>,
|
|
20
|
-
) => IValidation<T>;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
1
|
+
import { IValidation } from "typia";
|
|
2
|
+
|
|
3
|
+
export type IRequestHeadersValidator<T> =
|
|
4
|
+
| IRequestHeadersValidator.IAssert<T>
|
|
5
|
+
| IRequestHeadersValidator.IIs<T>
|
|
6
|
+
| IRequestHeadersValidator.IValidate<T>;
|
|
7
|
+
export namespace IRequestHeadersValidator {
|
|
8
|
+
export interface IAssert<T> {
|
|
9
|
+
type: "assert";
|
|
10
|
+
assert: (input: Record<string, string | string[] | undefined>) => T;
|
|
11
|
+
}
|
|
12
|
+
export interface IIs<T> {
|
|
13
|
+
type: "is";
|
|
14
|
+
is: (input: Record<string, string | string[] | undefined>) => T | null;
|
|
15
|
+
}
|
|
16
|
+
export interface IValidate<T> {
|
|
17
|
+
type: "validate";
|
|
18
|
+
validate: (
|
|
19
|
+
input: Record<string, string | string[] | undefined>,
|
|
20
|
+
) => IValidation<T>;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { IValidation } from "typia";
|
|
2
|
-
|
|
3
|
-
export type IRequestQueryValidator<T> =
|
|
4
|
-
| IRequestQueryValidator.IAssert<T>
|
|
5
|
-
| IRequestQueryValidator.IIs<T>
|
|
6
|
-
| IRequestQueryValidator.IValidate<T>;
|
|
7
|
-
export namespace IRequestQueryValidator {
|
|
8
|
-
export interface IAssert<T> {
|
|
9
|
-
type: "assert";
|
|
10
|
-
assert: (input: URLSearchParams) => T;
|
|
11
|
-
}
|
|
12
|
-
export interface IIs<T> {
|
|
13
|
-
type: "is";
|
|
14
|
-
is: (input: URLSearchParams) => T | null;
|
|
15
|
-
}
|
|
16
|
-
export interface IValidate<T> {
|
|
17
|
-
type: "validate";
|
|
18
|
-
validate: (input: URLSearchParams) => IValidation<T>;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
1
|
+
import { IValidation } from "typia";
|
|
2
|
+
|
|
3
|
+
export type IRequestQueryValidator<T> =
|
|
4
|
+
| IRequestQueryValidator.IAssert<T>
|
|
5
|
+
| IRequestQueryValidator.IIs<T>
|
|
6
|
+
| IRequestQueryValidator.IValidate<T>;
|
|
7
|
+
export namespace IRequestQueryValidator {
|
|
8
|
+
export interface IAssert<T> {
|
|
9
|
+
type: "assert";
|
|
10
|
+
assert: (input: URLSearchParams) => T;
|
|
11
|
+
}
|
|
12
|
+
export interface IIs<T> {
|
|
13
|
+
type: "is";
|
|
14
|
+
is: (input: URLSearchParams) => T | null;
|
|
15
|
+
}
|
|
16
|
+
export interface IValidate<T> {
|
|
17
|
+
type: "validate";
|
|
18
|
+
validate: (input: URLSearchParams) => IValidation<T>;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { IValidation } from "typia";
|
|
2
|
-
|
|
3
|
-
export type IResponseBodyQuerifier<T> =
|
|
4
|
-
| IResponseBodyquerifier.IStringify<T>
|
|
5
|
-
| IResponseBodyquerifier.IIs<T>
|
|
6
|
-
| IResponseBodyquerifier.IAssert<T>
|
|
7
|
-
| IResponseBodyquerifier.IValidate<T>;
|
|
8
|
-
export namespace IResponseBodyquerifier {
|
|
9
|
-
export interface IStringify<T> {
|
|
10
|
-
type: "stringify";
|
|
11
|
-
stringify: (input: T) => URLSearchParams;
|
|
12
|
-
}
|
|
13
|
-
export interface IIs<T> {
|
|
14
|
-
type: "is";
|
|
15
|
-
is: (input: T) => URLSearchParams | null;
|
|
16
|
-
}
|
|
17
|
-
export interface IAssert<T> {
|
|
18
|
-
type: "assert";
|
|
19
|
-
assert: (input: T) => URLSearchParams;
|
|
20
|
-
}
|
|
21
|
-
export interface IValidate<T> {
|
|
22
|
-
type: "validate";
|
|
23
|
-
validate: (input: T) => IValidation<URLSearchParams>;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
1
|
+
import { IValidation } from "typia";
|
|
2
|
+
|
|
3
|
+
export type IResponseBodyQuerifier<T> =
|
|
4
|
+
| IResponseBodyquerifier.IStringify<T>
|
|
5
|
+
| IResponseBodyquerifier.IIs<T>
|
|
6
|
+
| IResponseBodyquerifier.IAssert<T>
|
|
7
|
+
| IResponseBodyquerifier.IValidate<T>;
|
|
8
|
+
export namespace IResponseBodyquerifier {
|
|
9
|
+
export interface IStringify<T> {
|
|
10
|
+
type: "stringify";
|
|
11
|
+
stringify: (input: T) => URLSearchParams;
|
|
12
|
+
}
|
|
13
|
+
export interface IIs<T> {
|
|
14
|
+
type: "is";
|
|
15
|
+
is: (input: T) => URLSearchParams | null;
|
|
16
|
+
}
|
|
17
|
+
export interface IAssert<T> {
|
|
18
|
+
type: "assert";
|
|
19
|
+
assert: (input: T) => URLSearchParams;
|
|
20
|
+
}
|
|
21
|
+
export interface IValidate<T> {
|
|
22
|
+
type: "validate";
|
|
23
|
+
validate: (input: T) => IValidation<URLSearchParams>;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { IValidation } from "typia";
|
|
2
|
-
|
|
3
|
-
export type IResponseBodyStringifier<T> =
|
|
4
|
-
| IResponseBodyStringifier.IStringify<T>
|
|
5
|
-
| IResponseBodyStringifier.IIs<T>
|
|
6
|
-
| IResponseBodyStringifier.IAssert<T>
|
|
7
|
-
| IResponseBodyStringifier.IValidate<T>
|
|
8
|
-
| IResponseBodyStringifier.IValidateLog<T>;
|
|
9
|
-
export namespace IResponseBodyStringifier {
|
|
10
|
-
export interface IStringify<T> {
|
|
11
|
-
type: "stringify";
|
|
12
|
-
stringify: (input: T) => string;
|
|
13
|
-
}
|
|
14
|
-
export interface IIs<T> {
|
|
15
|
-
type: "is";
|
|
16
|
-
is: (input: T) => string | null;
|
|
17
|
-
}
|
|
18
|
-
export interface IAssert<T> {
|
|
19
|
-
type: "assert";
|
|
20
|
-
assert: (input: T) => string;
|
|
21
|
-
}
|
|
22
|
-
export interface IValidate<T> {
|
|
23
|
-
type: "validate";
|
|
24
|
-
validate: (input: T) => IValidation<string>;
|
|
25
|
-
}
|
|
26
|
-
export interface IValidateLog<T> {
|
|
27
|
-
type: "validate.log";
|
|
28
|
-
validate: (input: T) => IValidation<string>;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
1
|
+
import { IValidation } from "typia";
|
|
2
|
+
|
|
3
|
+
export type IResponseBodyStringifier<T> =
|
|
4
|
+
| IResponseBodyStringifier.IStringify<T>
|
|
5
|
+
| IResponseBodyStringifier.IIs<T>
|
|
6
|
+
| IResponseBodyStringifier.IAssert<T>
|
|
7
|
+
| IResponseBodyStringifier.IValidate<T>
|
|
8
|
+
| IResponseBodyStringifier.IValidateLog<T>;
|
|
9
|
+
export namespace IResponseBodyStringifier {
|
|
10
|
+
export interface IStringify<T> {
|
|
11
|
+
type: "stringify";
|
|
12
|
+
stringify: (input: T) => string;
|
|
13
|
+
}
|
|
14
|
+
export interface IIs<T> {
|
|
15
|
+
type: "is";
|
|
16
|
+
is: (input: T) => string | null;
|
|
17
|
+
}
|
|
18
|
+
export interface IAssert<T> {
|
|
19
|
+
type: "assert";
|
|
20
|
+
assert: (input: T) => string;
|
|
21
|
+
}
|
|
22
|
+
export interface IValidate<T> {
|
|
23
|
+
type: "validate";
|
|
24
|
+
validate: (input: T) => IValidation<string>;
|
|
25
|
+
}
|
|
26
|
+
export interface IValidateLog<T> {
|
|
27
|
+
type: "validate.log";
|
|
28
|
+
validate: (input: T) => IValidation<string>;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -1,70 +1,72 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
metadata.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
1
|
+
import {
|
|
2
|
+
AssertProgrammer,
|
|
3
|
+
MetadataCollection,
|
|
4
|
+
MetadataFactory,
|
|
5
|
+
MetadataSchema,
|
|
6
|
+
TransformerError,
|
|
7
|
+
} from "@typia/core";
|
|
8
|
+
import ts from "typescript";
|
|
9
|
+
|
|
10
|
+
import { INestiaTransformContext } from "../options/INestiaTransformProject";
|
|
11
|
+
|
|
12
|
+
export namespace PlainBodyProgrammer {
|
|
13
|
+
export const generate = (props: {
|
|
14
|
+
context: INestiaTransformContext;
|
|
15
|
+
modulo: ts.LeftHandSideExpression;
|
|
16
|
+
type: ts.Type;
|
|
17
|
+
}): ts.Expression => {
|
|
18
|
+
const result = MetadataFactory.analyze({
|
|
19
|
+
checker: props.context.checker,
|
|
20
|
+
transformer: props.context.transformer,
|
|
21
|
+
options: {
|
|
22
|
+
escape: false,
|
|
23
|
+
constant: true,
|
|
24
|
+
absorb: true,
|
|
25
|
+
validate,
|
|
26
|
+
},
|
|
27
|
+
components: new MetadataCollection(),
|
|
28
|
+
type: props.type,
|
|
29
|
+
});
|
|
30
|
+
if (result.success === false)
|
|
31
|
+
throw TransformerError.from({
|
|
32
|
+
code: "nestia.core.TypedParam",
|
|
33
|
+
errors: result.errors,
|
|
34
|
+
});
|
|
35
|
+
return AssertProgrammer.write({
|
|
36
|
+
context: {
|
|
37
|
+
...props.context,
|
|
38
|
+
options: {
|
|
39
|
+
numeric: false,
|
|
40
|
+
finite: false,
|
|
41
|
+
functional: false,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
modulo: props.modulo,
|
|
45
|
+
config: {
|
|
46
|
+
equals: false,
|
|
47
|
+
guard: false,
|
|
48
|
+
},
|
|
49
|
+
type: props.type,
|
|
50
|
+
name: undefined,
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const validate = (metadata: MetadataSchema): string[] => {
|
|
56
|
+
const errors: string[] = [];
|
|
57
|
+
const insert = (msg: string) => errors.push(msg);
|
|
58
|
+
|
|
59
|
+
const expected: number =
|
|
60
|
+
(metadata.atomics.some((a) => a.type === "string") ? 1 : 0) +
|
|
61
|
+
metadata.templates.length +
|
|
62
|
+
metadata.constants
|
|
63
|
+
.filter((c) => c.type === "string")
|
|
64
|
+
.map((c) => c.values.length)
|
|
65
|
+
.reduce((a, b) => a + b, 0);
|
|
66
|
+
if (expected === 0 || expected !== metadata.size())
|
|
67
|
+
insert(`only string type is allowed`);
|
|
68
|
+
if (metadata.nullable === true) insert(`do not allow nullable type`);
|
|
69
|
+
else if (metadata.any === true) insert(`do not allow any type`);
|
|
70
|
+
|
|
71
|
+
return errors;
|
|
72
|
+
};
|