@nestia/core 4.4.2-dev.20241217 → 4.4.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.
Files changed (74) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +87 -87
  3. package/package.json +3 -3
  4. package/src/adaptors/WebSocketAdaptor.ts +426 -426
  5. package/src/decorators/DynamicModule.ts +43 -43
  6. package/src/decorators/EncryptedBody.ts +101 -101
  7. package/src/decorators/EncryptedController.ts +38 -38
  8. package/src/decorators/EncryptedModule.ts +100 -100
  9. package/src/decorators/EncryptedRoute.ts +219 -219
  10. package/src/decorators/NoTransformConfigurationError.ts +32 -32
  11. package/src/decorators/PlainBody.ts +79 -79
  12. package/src/decorators/SwaggerCustomizer.ts +115 -115
  13. package/src/decorators/SwaggerExample.ts +100 -100
  14. package/src/decorators/TypedBody.ts +59 -59
  15. package/src/decorators/TypedException.ts +128 -128
  16. package/src/decorators/TypedFormData.ts +195 -195
  17. package/src/decorators/TypedHeaders.ts +64 -64
  18. package/src/decorators/TypedParam.ts +77 -77
  19. package/src/decorators/TypedQuery.ts +245 -245
  20. package/src/decorators/TypedRoute.ts +214 -214
  21. package/src/decorators/WebSocketRoute.ts +242 -242
  22. package/src/decorators/internal/EncryptedConstant.ts +4 -4
  23. package/src/decorators/internal/IWebSocketRouteReflect.ts +23 -23
  24. package/src/decorators/internal/NoTransformConfigureError.ts +2 -2
  25. package/src/decorators/internal/get_path_and_querify.ts +108 -108
  26. package/src/decorators/internal/get_path_and_stringify.ts +122 -122
  27. package/src/decorators/internal/get_text_body.ts +20 -20
  28. package/src/decorators/internal/headers_to_object.ts +13 -13
  29. package/src/decorators/internal/is_request_body_undefined.ts +14 -14
  30. package/src/decorators/internal/load_controller.ts +49 -49
  31. package/src/decorators/internal/route_error.ts +45 -45
  32. package/src/decorators/internal/validate_request_body.ts +74 -74
  33. package/src/decorators/internal/validate_request_form_data.ts +77 -77
  34. package/src/decorators/internal/validate_request_headers.ts +86 -86
  35. package/src/decorators/internal/validate_request_query.ts +74 -74
  36. package/src/index.ts +5 -5
  37. package/src/module.ts +21 -21
  38. package/src/options/INestiaTransformOptions.ts +38 -38
  39. package/src/options/INestiaTransformProject.ts +8 -8
  40. package/src/options/IRequestBodyValidator.ts +20 -20
  41. package/src/options/IRequestFormDataProps.ts +27 -27
  42. package/src/options/IRequestHeadersValidator.ts +22 -22
  43. package/src/options/IRequestQueryValidator.ts +20 -20
  44. package/src/options/IResponseBodyQuerifier.ts +25 -25
  45. package/src/options/IResponseBodyStringifier.ts +30 -30
  46. package/src/programmers/PlainBodyProgrammer.ts +70 -70
  47. package/src/programmers/TypedBodyProgrammer.ts +142 -142
  48. package/src/programmers/TypedFormDataBodyProgrammer.ts +118 -118
  49. package/src/programmers/TypedHeadersProgrammer.ts +63 -63
  50. package/src/programmers/TypedParamProgrammer.ts +33 -33
  51. package/src/programmers/TypedQueryBodyProgrammer.ts +112 -112
  52. package/src/programmers/TypedQueryProgrammer.ts +114 -114
  53. package/src/programmers/TypedQueryRouteProgrammer.ts +105 -105
  54. package/src/programmers/TypedRouteProgrammer.ts +94 -94
  55. package/src/programmers/http/HttpAssertQuerifyProgrammer.ts +72 -72
  56. package/src/programmers/http/HttpIsQuerifyProgrammer.ts +75 -75
  57. package/src/programmers/http/HttpQuerifyProgrammer.ts +108 -108
  58. package/src/programmers/http/HttpValidateQuerifyProgrammer.ts +76 -76
  59. package/src/programmers/internal/CoreMetadataUtil.ts +21 -21
  60. package/src/transform.ts +35 -35
  61. package/src/transformers/FileTransformer.ts +110 -110
  62. package/src/transformers/MethodTransformer.ts +103 -103
  63. package/src/transformers/NodeTransformer.ts +23 -23
  64. package/src/transformers/ParameterDecoratorTransformer.ts +143 -143
  65. package/src/transformers/ParameterTransformer.ts +57 -57
  66. package/src/transformers/TypedRouteTransformer.ts +85 -85
  67. package/src/transformers/WebSocketRouteTransformer.ts +120 -120
  68. package/src/typings/Creator.ts +3 -3
  69. package/src/typings/get-function-location.d.ts +7 -7
  70. package/src/utils/ArrayUtil.ts +7 -7
  71. package/src/utils/ExceptionManager.ts +112 -112
  72. package/src/utils/Singleton.ts +20 -20
  73. package/src/utils/SourceFinder.ts +57 -57
  74. package/src/utils/VersioningStrategy.ts +27 -27
@@ -1,74 +1,74 @@
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
- /**
8
- * @internal
9
- */
10
- export const validate_request_query =
11
- (method: string) =>
12
- <T>(validator?: IRequestQueryValidator<T>) => {
13
- if (!validator) {
14
- NoTransformConfigurationError(method);
15
- return (input: URLSearchParams) =>
16
- Object.fromEntries(input.entries()) as T;
17
- } else if (validator.type === "assert") return assert(validator.assert);
18
- else if (validator.type === "is") return is(validator.is);
19
- else if (validator.type === "validate") return validate(validator.validate);
20
- return () =>
21
- new Error(`Error on nestia.core.${method}(): invalid typed validator.`);
22
- };
23
-
24
- /**
25
- * @internal
26
- */
27
- const assert =
28
- <T>(closure: (input: URLSearchParams) => T) =>
29
- (input: URLSearchParams): T | BadRequestException => {
30
- try {
31
- return closure(input);
32
- } catch (exp) {
33
- if (typia.is<TypeGuardError>(exp)) {
34
- return new BadRequestException({
35
- path: exp.path,
36
- reason: exp.message,
37
- expected: exp.expected,
38
- value: exp.value,
39
- message: MESSAGE,
40
- });
41
- }
42
- throw exp;
43
- }
44
- };
45
-
46
- /**
47
- * @internal
48
- */
49
- const is =
50
- <T>(closure: (input: URLSearchParams) => T | null) =>
51
- (input: URLSearchParams): T | BadRequestException => {
52
- const result: T | null = closure(input);
53
- return result !== null ? result : new BadRequestException(MESSAGE);
54
- };
55
-
56
- /**
57
- * @internal
58
- */
59
- const validate =
60
- <T>(closure: (input: URLSearchParams) => IValidation<T>) =>
61
- (input: URLSearchParams): T | BadRequestException => {
62
- const result: IValidation<T> = closure(input);
63
- return result.success
64
- ? result.data
65
- : new BadRequestException({
66
- errors: result.errors,
67
- message: MESSAGE,
68
- });
69
- };
70
-
71
- /**
72
- * @internal
73
- */
74
- 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
+ /**
8
+ * @internal
9
+ */
10
+ export const validate_request_query =
11
+ (method: string) =>
12
+ <T>(validator?: IRequestQueryValidator<T>) => {
13
+ if (!validator) {
14
+ NoTransformConfigurationError(method);
15
+ return (input: URLSearchParams) =>
16
+ Object.fromEntries(input.entries()) as T;
17
+ } else if (validator.type === "assert") return assert(validator.assert);
18
+ else if (validator.type === "is") return is(validator.is);
19
+ else if (validator.type === "validate") return validate(validator.validate);
20
+ return () =>
21
+ new Error(`Error on nestia.core.${method}(): invalid typed validator.`);
22
+ };
23
+
24
+ /**
25
+ * @internal
26
+ */
27
+ const assert =
28
+ <T>(closure: (input: URLSearchParams) => T) =>
29
+ (input: URLSearchParams): T | BadRequestException => {
30
+ try {
31
+ return closure(input);
32
+ } catch (exp) {
33
+ if (typia.is<TypeGuardError>(exp)) {
34
+ return new BadRequestException({
35
+ path: exp.path,
36
+ reason: exp.message,
37
+ expected: exp.expected,
38
+ value: exp.value,
39
+ message: MESSAGE,
40
+ });
41
+ }
42
+ throw exp;
43
+ }
44
+ };
45
+
46
+ /**
47
+ * @internal
48
+ */
49
+ const is =
50
+ <T>(closure: (input: URLSearchParams) => T | null) =>
51
+ (input: URLSearchParams): T | BadRequestException => {
52
+ const result: T | null = closure(input);
53
+ return result !== null ? result : new BadRequestException(MESSAGE);
54
+ };
55
+
56
+ /**
57
+ * @internal
58
+ */
59
+ const validate =
60
+ <T>(closure: (input: URLSearchParams) => IValidation<T>) =>
61
+ (input: URLSearchParams): T | BadRequestException => {
62
+ const result: IValidation<T> = closure(input);
63
+ return result.success
64
+ ? result.data
65
+ : new BadRequestException({
66
+ errors: result.errors,
67
+ message: MESSAGE,
68
+ });
69
+ };
70
+
71
+ /**
72
+ * @internal
73
+ */
74
+ 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;
package/src/module.ts CHANGED
@@ -1,21 +1,21 @@
1
- export * from "./decorators/DynamicModule";
2
- export * from "./utils/ExceptionManager";
3
-
4
- export * from "./decorators/TypedRoute";
5
- export * from "./decorators/TypedBody";
6
- export * from "./decorators/TypedQuery";
7
- export * from "./decorators/TypedException";
8
- export * from "./decorators/TypedHeaders";
9
- export * from "./decorators/TypedFormData";
10
- export * from "./decorators/TypedParam";
11
-
12
- export * from "./decorators/EncryptedController";
13
- export * from "./decorators/EncryptedRoute";
14
- export * from "./decorators/EncryptedBody";
15
- export * from "./decorators/EncryptedModule";
16
- export * from "./decorators/PlainBody";
17
- export * from "./decorators/SwaggerCustomizer";
18
- export * from "./decorators/SwaggerExample";
19
-
20
- export * from "./adaptors/WebSocketAdaptor";
21
- export * from "./decorators/WebSocketRoute";
1
+ export * from "./decorators/DynamicModule";
2
+ export * from "./utils/ExceptionManager";
3
+
4
+ export * from "./decorators/TypedRoute";
5
+ export * from "./decorators/TypedBody";
6
+ export * from "./decorators/TypedQuery";
7
+ export * from "./decorators/TypedException";
8
+ export * from "./decorators/TypedHeaders";
9
+ export * from "./decorators/TypedFormData";
10
+ export * from "./decorators/TypedParam";
11
+
12
+ export * from "./decorators/EncryptedController";
13
+ export * from "./decorators/EncryptedRoute";
14
+ export * from "./decorators/EncryptedBody";
15
+ export * from "./decorators/EncryptedModule";
16
+ export * from "./decorators/PlainBody";
17
+ export * from "./decorators/SwaggerCustomizer";
18
+ export * from "./decorators/SwaggerExample";
19
+
20
+ export * from "./adaptors/WebSocketAdaptor";
21
+ export * from "./decorators/WebSocketRoute";
@@ -1,38 +1,38 @@
1
- import { ILlmSchema } from "@samchon/openapi";
2
-
3
- export interface INestiaTransformOptions {
4
- validate?: INestiaTransformOptions.Validate;
5
- stringify?: INestiaTransformOptions.Stringify | null;
6
- llm?: INestiaTransformOptions.ILlm<"chatgpt" | "gemini" | "3.0">;
7
- throws?: boolean;
8
- }
9
- export namespace INestiaTransformOptions {
10
- export type Validate =
11
- // NORMAL
12
- | "assert"
13
- | "is"
14
- | "validate"
15
- // STRICT
16
- | "assertEquals"
17
- | "equals"
18
- | "validateEquals"
19
- // CLONE
20
- | "assertClone"
21
- | "validateClone"
22
- // PRUNE
23
- | "assertPrune"
24
- | "validatePrune";
25
-
26
- export type Stringify =
27
- | "stringify"
28
- | "assert"
29
- | "is"
30
- | "validate"
31
- | "validate.log";
32
-
33
- export interface ILlm<Model extends ILlmSchema.Model> {
34
- model: Model;
35
- strict?: Model extends "chatgpt" ? boolean : never;
36
- recursive?: Model extends "gemini" | "3.0" ? false | number : never;
37
- }
38
- }
1
+ import { ILlmSchema } from "@samchon/openapi";
2
+
3
+ export interface INestiaTransformOptions {
4
+ validate?: INestiaTransformOptions.Validate;
5
+ stringify?: INestiaTransformOptions.Stringify | null;
6
+ llm?: INestiaTransformOptions.ILlm<"chatgpt" | "gemini" | "3.0">;
7
+ throws?: boolean;
8
+ }
9
+ export namespace INestiaTransformOptions {
10
+ export type Validate =
11
+ // NORMAL
12
+ | "assert"
13
+ | "is"
14
+ | "validate"
15
+ // STRICT
16
+ | "assertEquals"
17
+ | "equals"
18
+ | "validateEquals"
19
+ // CLONE
20
+ | "assertClone"
21
+ | "validateClone"
22
+ // PRUNE
23
+ | "assertPrune"
24
+ | "validatePrune";
25
+
26
+ export type Stringify =
27
+ | "stringify"
28
+ | "assert"
29
+ | "is"
30
+ | "validate"
31
+ | "validate.log";
32
+
33
+ export interface ILlm<Model extends ILlmSchema.Model> {
34
+ model: Model;
35
+ strict?: Model extends "chatgpt" ? boolean : never;
36
+ recursive?: Model extends "gemini" | "3.0" ? false | number : never;
37
+ }
38
+ }
@@ -1,8 +1,8 @@
1
- import { ITypiaContext } from "typia/lib/transformers/ITypiaContext";
2
-
3
- import { INestiaTransformOptions } from "./INestiaTransformOptions";
4
-
5
- export interface INestiaTransformContext
6
- extends Omit<ITypiaContext, "options"> {
7
- options: INestiaTransformOptions;
8
- }
1
+ import { ITypiaContext } from "typia/lib/transformers/ITypiaContext";
2
+
3
+ import { INestiaTransformOptions } from "./INestiaTransformOptions";
4
+
5
+ export interface INestiaTransformContext
6
+ extends Omit<ITypiaContext, "options"> {
7
+ options: INestiaTransformOptions;
8
+ }
@@ -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
+ }