@nestia/core 11.0.0-dev.20260305 → 11.0.0-dev.20260312

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 (49) hide show
  1. package/lib/programmers/TypedBodyProgrammer.js +2 -2
  2. package/lib/programmers/TypedBodyProgrammer.js.map +1 -1
  3. package/lib/programmers/TypedQueryBodyProgrammer.js +2 -1
  4. package/lib/programmers/TypedQueryBodyProgrammer.js.map +1 -1
  5. package/lib/programmers/TypedQueryProgrammer.js +2 -1
  6. package/lib/programmers/TypedQueryProgrammer.js.map +1 -1
  7. package/lib/programmers/TypedQueryRouteProgrammer.js +2 -1
  8. package/lib/programmers/TypedQueryRouteProgrammer.js.map +1 -1
  9. package/lib/programmers/TypedRouteProgrammer.js +2 -2
  10. package/lib/programmers/TypedRouteProgrammer.js.map +1 -1
  11. package/package.json +8 -8
  12. package/src/decorators/DynamicModule.ts +44 -44
  13. package/src/decorators/PlainBody.ts +76 -76
  14. package/src/decorators/SwaggerExample.ts +100 -100
  15. package/src/decorators/TypedBody.ts +57 -57
  16. package/src/decorators/TypedException.ts +147 -147
  17. package/src/decorators/TypedHeaders.ts +66 -66
  18. package/src/decorators/TypedParam.ts +77 -77
  19. package/src/decorators/TypedQuery.ts +234 -234
  20. package/src/decorators/WebSocketRoute.ts +242 -242
  21. package/src/decorators/internal/EncryptedConstant.ts +2 -2
  22. package/src/decorators/internal/IWebSocketRouteReflect.ts +23 -23
  23. package/src/decorators/internal/NoTransformConfigureError.ts +2 -2
  24. package/src/decorators/internal/get_path_and_querify.ts +94 -94
  25. package/src/decorators/internal/get_path_and_stringify.ts +110 -110
  26. package/src/decorators/internal/get_text_body.ts +16 -16
  27. package/src/decorators/internal/is_request_body_undefined.ts +12 -12
  28. package/src/decorators/internal/load_controller.ts +45 -45
  29. package/src/decorators/internal/route_error.ts +43 -43
  30. package/src/decorators/internal/validate_request_body.ts +64 -64
  31. package/src/decorators/internal/validate_request_form_data.ts +67 -67
  32. package/src/decorators/internal/validate_request_headers.ts +76 -76
  33. package/src/decorators/internal/validate_request_query.ts +64 -64
  34. package/src/index.ts +5 -5
  35. package/src/options/IRequestBodyValidator.ts +20 -20
  36. package/src/options/IRequestFormDataProps.ts +27 -27
  37. package/src/options/IRequestHeadersValidator.ts +22 -22
  38. package/src/options/IRequestQueryValidator.ts +20 -20
  39. package/src/options/IResponseBodyQuerifier.ts +25 -25
  40. package/src/options/IResponseBodyStringifier.ts +30 -30
  41. package/src/transformers/NodeTransformer.ts +23 -23
  42. package/src/transformers/ParameterTransformer.ts +57 -57
  43. package/src/typings/Creator.ts +3 -3
  44. package/src/typings/get-function-location.d.ts +7 -7
  45. package/src/utils/ArrayUtil.ts +7 -7
  46. package/src/utils/ExceptionManager.ts +115 -115
  47. package/src/utils/Singleton.ts +16 -16
  48. package/src/utils/SourceFinder.ts +54 -54
  49. package/src/utils/VersioningStrategy.ts +27 -27
@@ -1,64 +1,64 @@
1
- import { BadRequestException } from "@nestjs/common";
2
- import typia, { IValidation, TypeGuardError } from "typia";
3
-
4
- import { IRequestBodyValidator } from "../../options/IRequestBodyValidator";
5
- import { NoTransformConfigurationError } from "../NoTransformConfigurationError";
6
-
7
- /** @internal */
8
- export const validate_request_body =
9
- (method: string) =>
10
- <T>(validator?: IRequestBodyValidator<T>): ((input: T) => Error | null) => {
11
- if (!validator) {
12
- NoTransformConfigurationError(method);
13
- return () => null;
14
- } else if (validator.type === "assert") return assert(validator.assert);
15
- else if (validator.type === "is") return is(validator.is);
16
- else if (validator.type === "validate") return validate(validator.validate);
17
- return () =>
18
- new Error(`Error on nestia.core.${method}(): invalid typed validator.`);
19
- };
20
-
21
- /** @internal */
22
- const assert =
23
- <T>(closure: (data: T) => T) =>
24
- (input: T) => {
25
- try {
26
- closure(input);
27
- return null;
28
- } catch (exp) {
29
- if (typia.is<TypeGuardError>(exp)) {
30
- return new BadRequestException({
31
- path: exp.path,
32
- reason: exp.message,
33
- expected: exp.expected,
34
- value: exp.value,
35
- message: MESSAGE,
36
- });
37
- }
38
- throw exp;
39
- }
40
- };
41
-
42
- /** @internal */
43
- const is =
44
- <T>(closure: (data: T) => boolean) =>
45
- (input: T) => {
46
- const success: boolean = closure(input);
47
- return success ? null : new BadRequestException(MESSAGE);
48
- };
49
-
50
- /** @internal */
51
- const validate =
52
- <T>(closure: (data: T) => IValidation<T>) =>
53
- (input: T) => {
54
- const result: IValidation<T> = closure(input);
55
- return result.success
56
- ? null
57
- : new BadRequestException({
58
- errors: result.errors,
59
- message: MESSAGE,
60
- });
61
- };
62
-
63
- /** @internal */
64
- const MESSAGE = "Request body data is not following the promised type.";
1
+ import { BadRequestException } from "@nestjs/common";
2
+ import typia, { IValidation, TypeGuardError } from "typia";
3
+
4
+ import { IRequestBodyValidator } from "../../options/IRequestBodyValidator";
5
+ import { NoTransformConfigurationError } from "../NoTransformConfigurationError";
6
+
7
+ /** @internal */
8
+ export const validate_request_body =
9
+ (method: string) =>
10
+ <T>(validator?: IRequestBodyValidator<T>): ((input: T) => Error | null) => {
11
+ if (!validator) {
12
+ NoTransformConfigurationError(method);
13
+ return () => null;
14
+ } else if (validator.type === "assert") return assert(validator.assert);
15
+ else if (validator.type === "is") return is(validator.is);
16
+ else if (validator.type === "validate") return validate(validator.validate);
17
+ return () =>
18
+ new Error(`Error on nestia.core.${method}(): invalid typed validator.`);
19
+ };
20
+
21
+ /** @internal */
22
+ const assert =
23
+ <T>(closure: (data: T) => T) =>
24
+ (input: T) => {
25
+ try {
26
+ closure(input);
27
+ return null;
28
+ } catch (exp) {
29
+ if (typia.is<TypeGuardError>(exp)) {
30
+ return new BadRequestException({
31
+ path: exp.path,
32
+ reason: exp.message,
33
+ expected: exp.expected,
34
+ value: exp.value,
35
+ message: MESSAGE,
36
+ });
37
+ }
38
+ throw exp;
39
+ }
40
+ };
41
+
42
+ /** @internal */
43
+ const is =
44
+ <T>(closure: (data: T) => boolean) =>
45
+ (input: T) => {
46
+ const success: boolean = closure(input);
47
+ return success ? null : new BadRequestException(MESSAGE);
48
+ };
49
+
50
+ /** @internal */
51
+ const validate =
52
+ <T>(closure: (data: T) => IValidation<T>) =>
53
+ (input: T) => {
54
+ const result: IValidation<T> = closure(input);
55
+ return result.success
56
+ ? null
57
+ : new BadRequestException({
58
+ errors: result.errors,
59
+ message: MESSAGE,
60
+ });
61
+ };
62
+
63
+ /** @internal */
64
+ const MESSAGE = "Request body data is not following the promised type.";
@@ -1,67 +1,67 @@
1
- import { BadRequestException } from "@nestjs/common";
2
- import typia, { IValidation, TypeGuardError } from "typia";
3
-
4
- import { IRequestFormDataProps } from "../../options/IRequestFormDataProps";
5
- import { NoTransformConfigurationError } from "../NoTransformConfigurationError";
6
-
7
- /** @internal */
8
- export const validate_request_form_data = <T>(
9
- props?: IRequestFormDataProps<T>,
10
- ): ((value: FormData) => T | Error) => {
11
- if (!props) {
12
- NoTransformConfigurationError("TypedFormData.Body");
13
- return (input: FormData) => Object.entries(input) as T;
14
- } else if (props.validator.type === "assert")
15
- return assert(props.validator.assert);
16
- else if (props.validator.type === "is") return is(props.validator.is);
17
- else if (props.validator.type === "validate")
18
- return validate(props.validator.validate);
19
- return () =>
20
- new Error(
21
- `Error on nestia.core.TypedFormData.Body(): invalid typed validator.`,
22
- );
23
- };
24
-
25
- /** @internal */
26
- const assert =
27
- <T>(closure: (input: FormData) => T) =>
28
- (input: FormData): T | BadRequestException => {
29
- try {
30
- return closure(input);
31
- } catch (exp) {
32
- if (typia.is<TypeGuardError>(exp)) {
33
- return new BadRequestException({
34
- path: exp.path,
35
- reason: exp.message,
36
- expected: exp.expected,
37
- value: exp.value,
38
- message: MESSAGE,
39
- });
40
- }
41
- throw exp;
42
- }
43
- };
44
-
45
- /** @internal */
46
- const is =
47
- <T>(closure: (input: FormData) => T | null) =>
48
- (input: FormData): T | BadRequestException => {
49
- const result: T | null = closure(input);
50
- return result !== null ? result : new BadRequestException(MESSAGE);
51
- };
52
-
53
- /** @internal */
54
- const validate =
55
- <T>(closure: (input: FormData) => IValidation<T>) =>
56
- (input: FormData): T | BadRequestException => {
57
- const result: IValidation<T> = closure(input);
58
- return result.success
59
- ? result.data
60
- : new BadRequestException({
61
- errors: result.errors,
62
- message: MESSAGE,
63
- });
64
- };
65
-
66
- /** @internal */
67
- const MESSAGE = "Request multipart data is not following the promised type.";
1
+ import { BadRequestException } from "@nestjs/common";
2
+ import typia, { IValidation, TypeGuardError } from "typia";
3
+
4
+ import { IRequestFormDataProps } from "../../options/IRequestFormDataProps";
5
+ import { NoTransformConfigurationError } from "../NoTransformConfigurationError";
6
+
7
+ /** @internal */
8
+ export const validate_request_form_data = <T>(
9
+ props?: IRequestFormDataProps<T>,
10
+ ): ((value: FormData) => T | Error) => {
11
+ if (!props) {
12
+ NoTransformConfigurationError("TypedFormData.Body");
13
+ return (input: FormData) => Object.entries(input) as T;
14
+ } else if (props.validator.type === "assert")
15
+ return assert(props.validator.assert);
16
+ else if (props.validator.type === "is") return is(props.validator.is);
17
+ else if (props.validator.type === "validate")
18
+ return validate(props.validator.validate);
19
+ return () =>
20
+ new Error(
21
+ `Error on nestia.core.TypedFormData.Body(): invalid typed validator.`,
22
+ );
23
+ };
24
+
25
+ /** @internal */
26
+ const assert =
27
+ <T>(closure: (input: FormData) => T) =>
28
+ (input: FormData): T | BadRequestException => {
29
+ try {
30
+ return closure(input);
31
+ } catch (exp) {
32
+ if (typia.is<TypeGuardError>(exp)) {
33
+ return new BadRequestException({
34
+ path: exp.path,
35
+ reason: exp.message,
36
+ expected: exp.expected,
37
+ value: exp.value,
38
+ message: MESSAGE,
39
+ });
40
+ }
41
+ throw exp;
42
+ }
43
+ };
44
+
45
+ /** @internal */
46
+ const is =
47
+ <T>(closure: (input: FormData) => T | null) =>
48
+ (input: FormData): T | BadRequestException => {
49
+ const result: T | null = closure(input);
50
+ return result !== null ? result : new BadRequestException(MESSAGE);
51
+ };
52
+
53
+ /** @internal */
54
+ const validate =
55
+ <T>(closure: (input: FormData) => IValidation<T>) =>
56
+ (input: FormData): T | BadRequestException => {
57
+ const result: IValidation<T> = closure(input);
58
+ return result.success
59
+ ? result.data
60
+ : new BadRequestException({
61
+ errors: result.errors,
62
+ message: MESSAGE,
63
+ });
64
+ };
65
+
66
+ /** @internal */
67
+ const MESSAGE = "Request multipart data is not following the promised type.";
@@ -1,76 +1,76 @@
1
- import { BadRequestException } from "@nestjs/common";
2
- import typia, { IValidation, TypeGuardError } from "typia";
3
-
4
- import { IRequestHeadersValidator } from "../../options/IRequestHeadersValidator";
5
- import { NoTransformConfigurationError } from "../NoTransformConfigurationError";
6
-
7
- /** @internal */
8
- export const validate_request_headers = <T>(
9
- validator?: IRequestHeadersValidator<T>,
10
- ): ((input: Record<string, string | string[] | undefined>) => T | Error) => {
11
- if (!validator) {
12
- NoTransformConfigurationError("TypedHeaders");
13
- return (input: Record<string, string | string[] | undefined>) =>
14
- Object.entries(input) as T;
15
- } else if (validator.type === "assert") return assert(validator.assert);
16
- else if (validator.type === "is") return is(validator.is);
17
- else if (validator.type === "validate") return validate(validator.validate);
18
- return () =>
19
- new Error(`Error on nestia.core.TypedHeaders(): invalid typed validator.`);
20
- };
21
-
22
- /** @internal */
23
- const assert =
24
- <T>(closure: (input: Record<string, string | string[] | undefined>) => T) =>
25
- (
26
- input: Record<string, string | string[] | undefined>,
27
- ): T | BadRequestException => {
28
- try {
29
- return closure(input);
30
- } catch (exp) {
31
- if (typia.is<TypeGuardError>(exp)) {
32
- return new BadRequestException({
33
- path: exp.path,
34
- reason: exp.message,
35
- expected: exp.expected,
36
- value: exp.value,
37
- message: MESSAGE,
38
- });
39
- }
40
- throw exp;
41
- }
42
- };
43
-
44
- /** @internal */
45
- const is =
46
- <T>(
47
- closure: (input: Record<string, string | string[] | undefined>) => T | null,
48
- ) =>
49
- (
50
- input: Record<string, string | string[] | undefined>,
51
- ): T | BadRequestException => {
52
- const result: T | null = closure(input);
53
- return result !== null ? result : new BadRequestException(MESSAGE);
54
- };
55
-
56
- /** @internal */
57
- const validate =
58
- <T>(
59
- closure: (
60
- input: Record<string, string | string[] | undefined>,
61
- ) => IValidation<T>,
62
- ) =>
63
- (
64
- input: Record<string, string | string[] | undefined>,
65
- ): T | BadRequestException => {
66
- const result: IValidation<T> = closure(input);
67
- return result.success
68
- ? result.data
69
- : new BadRequestException({
70
- errors: result.errors,
71
- message: MESSAGE,
72
- });
73
- };
74
-
75
- /** @internal */
76
- const MESSAGE = "Request headers data is not following the promised type.";
1
+ import { BadRequestException } from "@nestjs/common";
2
+ import typia, { IValidation, TypeGuardError } from "typia";
3
+
4
+ import { IRequestHeadersValidator } from "../../options/IRequestHeadersValidator";
5
+ import { NoTransformConfigurationError } from "../NoTransformConfigurationError";
6
+
7
+ /** @internal */
8
+ export const validate_request_headers = <T>(
9
+ validator?: IRequestHeadersValidator<T>,
10
+ ): ((input: Record<string, string | string[] | undefined>) => T | Error) => {
11
+ if (!validator) {
12
+ NoTransformConfigurationError("TypedHeaders");
13
+ return (input: Record<string, string | string[] | undefined>) =>
14
+ Object.entries(input) as T;
15
+ } else if (validator.type === "assert") return assert(validator.assert);
16
+ else if (validator.type === "is") return is(validator.is);
17
+ else if (validator.type === "validate") return validate(validator.validate);
18
+ return () =>
19
+ new Error(`Error on nestia.core.TypedHeaders(): invalid typed validator.`);
20
+ };
21
+
22
+ /** @internal */
23
+ const assert =
24
+ <T>(closure: (input: Record<string, string | string[] | undefined>) => T) =>
25
+ (
26
+ input: Record<string, string | string[] | undefined>,
27
+ ): T | BadRequestException => {
28
+ try {
29
+ return closure(input);
30
+ } catch (exp) {
31
+ if (typia.is<TypeGuardError>(exp)) {
32
+ return new BadRequestException({
33
+ path: exp.path,
34
+ reason: exp.message,
35
+ expected: exp.expected,
36
+ value: exp.value,
37
+ message: MESSAGE,
38
+ });
39
+ }
40
+ throw exp;
41
+ }
42
+ };
43
+
44
+ /** @internal */
45
+ const is =
46
+ <T>(
47
+ closure: (input: Record<string, string | string[] | undefined>) => T | null,
48
+ ) =>
49
+ (
50
+ input: Record<string, string | string[] | undefined>,
51
+ ): T | BadRequestException => {
52
+ const result: T | null = closure(input);
53
+ return result !== null ? result : new BadRequestException(MESSAGE);
54
+ };
55
+
56
+ /** @internal */
57
+ const validate =
58
+ <T>(
59
+ closure: (
60
+ input: Record<string, string | string[] | undefined>,
61
+ ) => IValidation<T>,
62
+ ) =>
63
+ (
64
+ input: Record<string, string | string[] | undefined>,
65
+ ): T | BadRequestException => {
66
+ const result: IValidation<T> = closure(input);
67
+ return result.success
68
+ ? result.data
69
+ : new BadRequestException({
70
+ errors: result.errors,
71
+ message: MESSAGE,
72
+ });
73
+ };
74
+
75
+ /** @internal */
76
+ const MESSAGE = "Request headers data is not following the promised type.";
@@ -1,64 +1,64 @@
1
- import { BadRequestException } from "@nestjs/common";
2
- import typia, { IValidation, TypeGuardError } from "typia";
3
-
4
- import { IRequestQueryValidator } from "../../options/IRequestQueryValidator";
5
- import { NoTransformConfigurationError } from "../NoTransformConfigurationError";
6
-
7
- /** @internal */
8
- export const validate_request_query =
9
- (method: string) =>
10
- <T>(validator?: IRequestQueryValidator<T>) => {
11
- if (!validator) {
12
- NoTransformConfigurationError(method);
13
- return (input: URLSearchParams) =>
14
- Object.fromEntries(input.entries()) as T;
15
- } else if (validator.type === "assert") return assert(validator.assert);
16
- else if (validator.type === "is") return is(validator.is);
17
- else if (validator.type === "validate") return validate(validator.validate);
18
- return () =>
19
- new Error(`Error on nestia.core.${method}(): invalid typed validator.`);
20
- };
21
-
22
- /** @internal */
23
- const assert =
24
- <T>(closure: (input: URLSearchParams) => T) =>
25
- (input: URLSearchParams): T | BadRequestException => {
26
- try {
27
- return closure(input);
28
- } catch (exp) {
29
- if (typia.is<TypeGuardError>(exp)) {
30
- return new BadRequestException({
31
- path: exp.path,
32
- reason: exp.message,
33
- expected: exp.expected,
34
- value: exp.value,
35
- message: MESSAGE,
36
- });
37
- }
38
- throw exp;
39
- }
40
- };
41
-
42
- /** @internal */
43
- const is =
44
- <T>(closure: (input: URLSearchParams) => T | null) =>
45
- (input: URLSearchParams): T | BadRequestException => {
46
- const result: T | null = closure(input);
47
- return result !== null ? result : new BadRequestException(MESSAGE);
48
- };
49
-
50
- /** @internal */
51
- const validate =
52
- <T>(closure: (input: URLSearchParams) => IValidation<T>) =>
53
- (input: URLSearchParams): T | BadRequestException => {
54
- const result: IValidation<T> = closure(input);
55
- return result.success
56
- ? result.data
57
- : new BadRequestException({
58
- errors: result.errors,
59
- message: MESSAGE,
60
- });
61
- };
62
-
63
- /** @internal */
64
- const MESSAGE = "Request query data is not following the promised type.";
1
+ import { BadRequestException } from "@nestjs/common";
2
+ import typia, { IValidation, TypeGuardError } from "typia";
3
+
4
+ import { IRequestQueryValidator } from "../../options/IRequestQueryValidator";
5
+ import { NoTransformConfigurationError } from "../NoTransformConfigurationError";
6
+
7
+ /** @internal */
8
+ export const validate_request_query =
9
+ (method: string) =>
10
+ <T>(validator?: IRequestQueryValidator<T>) => {
11
+ if (!validator) {
12
+ NoTransformConfigurationError(method);
13
+ return (input: URLSearchParams) =>
14
+ Object.fromEntries(input.entries()) as T;
15
+ } else if (validator.type === "assert") return assert(validator.assert);
16
+ else if (validator.type === "is") return is(validator.is);
17
+ else if (validator.type === "validate") return validate(validator.validate);
18
+ return () =>
19
+ new Error(`Error on nestia.core.${method}(): invalid typed validator.`);
20
+ };
21
+
22
+ /** @internal */
23
+ const assert =
24
+ <T>(closure: (input: URLSearchParams) => T) =>
25
+ (input: URLSearchParams): T | BadRequestException => {
26
+ try {
27
+ return closure(input);
28
+ } catch (exp) {
29
+ if (typia.is<TypeGuardError>(exp)) {
30
+ return new BadRequestException({
31
+ path: exp.path,
32
+ reason: exp.message,
33
+ expected: exp.expected,
34
+ value: exp.value,
35
+ message: MESSAGE,
36
+ });
37
+ }
38
+ throw exp;
39
+ }
40
+ };
41
+
42
+ /** @internal */
43
+ const is =
44
+ <T>(closure: (input: URLSearchParams) => T | null) =>
45
+ (input: URLSearchParams): T | BadRequestException => {
46
+ const result: T | null = closure(input);
47
+ return result !== null ? result : new BadRequestException(MESSAGE);
48
+ };
49
+
50
+ /** @internal */
51
+ const validate =
52
+ <T>(closure: (input: URLSearchParams) => IValidation<T>) =>
53
+ (input: URLSearchParams): T | BadRequestException => {
54
+ const result: IValidation<T> = closure(input);
55
+ return result.success
56
+ ? result.data
57
+ : new BadRequestException({
58
+ errors: result.errors,
59
+ message: MESSAGE,
60
+ });
61
+ };
62
+
63
+ /** @internal */
64
+ const MESSAGE = "Request query data is not following the promised type.";
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
- import * as core from "./module";
2
-
3
- export * from "./module";
4
-
5
- export default core;
1
+ import * as core from "./module";
2
+
3
+ export * from "./module";
4
+
5
+ export default core;
@@ -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
+ }