@nestia/core 2.4.3 → 3.0.0-dev.20231209

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 (67) hide show
  1. package/lib/decorators/EncryptedBody.js +13 -11
  2. package/lib/decorators/EncryptedBody.js.map +1 -1
  3. package/lib/decorators/EncryptedRoute.js +29 -12
  4. package/lib/decorators/EncryptedRoute.js.map +1 -1
  5. package/lib/decorators/internal/get_binary_body.d.ts +1 -0
  6. package/lib/decorators/internal/get_binary_body.js +66 -0
  7. package/lib/decorators/internal/get_binary_body.js.map +1 -0
  8. package/package.json +3 -3
  9. package/src/decorators/DynamicModule.ts +39 -39
  10. package/src/decorators/EncryptedBody.ts +17 -12
  11. package/src/decorators/EncryptedController.ts +38 -38
  12. package/src/decorators/EncryptedModule.ts +79 -79
  13. package/src/decorators/EncryptedRoute.ts +38 -14
  14. package/src/decorators/PlainBody.ts +72 -72
  15. package/src/decorators/TypedBody.ts +59 -59
  16. package/src/decorators/TypedException.ts +89 -89
  17. package/src/decorators/TypedHeaders.ts +69 -69
  18. package/src/decorators/TypedParam.ts +65 -65
  19. package/src/decorators/TypedQuery.ts +246 -246
  20. package/src/decorators/TypedRoute.ts +144 -144
  21. package/src/decorators/internal/EncryptedConstant.ts +4 -4
  22. package/src/decorators/internal/NoTransformConfigureError.ts +8 -8
  23. package/src/decorators/internal/get_binary_body.ts +18 -0
  24. package/src/decorators/internal/get_path_and_querify.ts +103 -103
  25. package/src/decorators/internal/get_path_and_stringify.ts +91 -91
  26. package/src/decorators/internal/get_text_body.ts +20 -20
  27. package/src/decorators/internal/headers_to_object.ts +13 -13
  28. package/src/decorators/internal/load_controller.ts +51 -51
  29. package/src/decorators/internal/route_error.ts +45 -45
  30. package/src/decorators/internal/validate_request_body.ts +57 -57
  31. package/src/decorators/internal/validate_request_headers.ts +68 -68
  32. package/src/decorators/internal/validate_request_query.ts +56 -56
  33. package/src/index.ts +5 -5
  34. package/src/module.ts +14 -14
  35. package/src/options/INestiaTransformOptions.ts +17 -17
  36. package/src/options/INestiaTransformProject.ts +7 -7
  37. package/src/options/IRequestBodyValidator.ts +20 -20
  38. package/src/options/IRequestHeadersValidator.ts +22 -22
  39. package/src/options/IRequestQueryValidator.ts +20 -20
  40. package/src/options/IResponseBodyQuerifier.ts +25 -25
  41. package/src/options/IResponseBodyStringifier.ts +25 -25
  42. package/src/programmers/PlainBodyProgrammer.ts +52 -52
  43. package/src/programmers/TypedBodyProgrammer.ts +108 -108
  44. package/src/programmers/TypedExceptionProgrammer.ts +72 -72
  45. package/src/programmers/TypedHeadersProgrammer.ts +56 -56
  46. package/src/programmers/TypedParamProgrammer.ts +24 -24
  47. package/src/programmers/TypedQueryBodyProgrammer.ts +56 -56
  48. package/src/programmers/TypedQueryProgrammer.ts +56 -56
  49. package/src/programmers/TypedQueryRouteProgrammer.ts +51 -51
  50. package/src/programmers/TypedRouteProgrammer.ts +51 -51
  51. package/src/programmers/http/HttpAssertQuerifyProgrammer.ts +58 -58
  52. package/src/programmers/http/HttpIsQuerifyProgrammer.ts +62 -62
  53. package/src/programmers/http/HttpQuerifyProgrammer.ts +96 -96
  54. package/src/programmers/http/HttpValidateQuerifyProgrammer.ts +63 -63
  55. package/src/programmers/internal/CoreMetadataUtil.ts +21 -21
  56. package/src/transform.ts +35 -35
  57. package/src/transformers/FileTransformer.ts +66 -66
  58. package/src/transformers/MethodTransformer.ts +94 -94
  59. package/src/transformers/NodeTransformer.ts +16 -16
  60. package/src/transformers/ParameterDecoratorTransformer.ts +121 -121
  61. package/src/transformers/ParameterTransformer.ts +48 -48
  62. package/src/transformers/TypedExceptionTransformer.ts +49 -49
  63. package/src/transformers/TypedRouteTransformer.ts +95 -95
  64. package/src/typings/Creator.ts +3 -3
  65. package/src/utils/ExceptionManager.ts +112 -112
  66. package/src/utils/Singleton.ts +20 -20
  67. package/src/utils/SourceFinder.ts +57 -57
@@ -1,68 +1,68 @@
1
- import { BadRequestException } from "@nestjs/common";
2
- import typia, { IValidation, TypeGuardError } from "typia";
3
-
4
- import { IRequestHeadersValidator } from "../../options/IRequestHeadersValidator";
5
- import { NoTransformConfigureError } from "./NoTransformConfigureError";
6
-
7
- export const validate_request_headers = <T>(
8
- validator?: IRequestHeadersValidator<T>,
9
- ) => {
10
- if (!validator) return () => NoTransformConfigureError("TypedHeaders");
11
- else if (validator.type === "assert") return assert(validator.assert);
12
- else if (validator.type === "is") return is(validator.is);
13
- else if (validator.type === "validate") return validate(validator.validate);
14
- return () =>
15
- new Error(`Error on nestia.core.TypedHeaders(): invalid typed validator.`);
16
- };
17
-
18
- const assert =
19
- <T>(closure: (input: Record<string, string | string[] | undefined>) => T) =>
20
- (
21
- input: Record<string, string | string[] | undefined>,
22
- ): T | BadRequestException => {
23
- try {
24
- return closure(input);
25
- } catch (exp) {
26
- if (typia.is<TypeGuardError>(exp)) {
27
- return new BadRequestException({
28
- path: exp.path,
29
- reason: exp.message,
30
- expected: exp.expected,
31
- value: exp.value,
32
- message: MESSAGE,
33
- });
34
- }
35
- throw exp;
36
- }
37
- };
38
-
39
- const is =
40
- <T>(
41
- closure: (input: Record<string, string | string[] | undefined>) => T | null,
42
- ) =>
43
- (
44
- input: Record<string, string | string[] | undefined>,
45
- ): T | BadRequestException => {
46
- const result: T | null = closure(input);
47
- return result !== null ? result : new BadRequestException(MESSAGE);
48
- };
49
-
50
- const validate =
51
- <T>(
52
- closure: (
53
- input: Record<string, string | string[] | undefined>,
54
- ) => IValidation<T>,
55
- ) =>
56
- (
57
- input: Record<string, string | string[] | undefined>,
58
- ): T | BadRequestException => {
59
- const result: IValidation<T> = closure(input);
60
- return result.success
61
- ? result.data
62
- : new BadRequestException({
63
- errors: result.errors,
64
- message: MESSAGE,
65
- });
66
- };
67
-
68
- 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 { NoTransformConfigureError } from "./NoTransformConfigureError";
6
+
7
+ export const validate_request_headers = <T>(
8
+ validator?: IRequestHeadersValidator<T>,
9
+ ) => {
10
+ if (!validator) return () => NoTransformConfigureError("TypedHeaders");
11
+ else if (validator.type === "assert") return assert(validator.assert);
12
+ else if (validator.type === "is") return is(validator.is);
13
+ else if (validator.type === "validate") return validate(validator.validate);
14
+ return () =>
15
+ new Error(`Error on nestia.core.TypedHeaders(): invalid typed validator.`);
16
+ };
17
+
18
+ const assert =
19
+ <T>(closure: (input: Record<string, string | string[] | undefined>) => T) =>
20
+ (
21
+ input: Record<string, string | string[] | undefined>,
22
+ ): T | BadRequestException => {
23
+ try {
24
+ return closure(input);
25
+ } catch (exp) {
26
+ if (typia.is<TypeGuardError>(exp)) {
27
+ return new BadRequestException({
28
+ path: exp.path,
29
+ reason: exp.message,
30
+ expected: exp.expected,
31
+ value: exp.value,
32
+ message: MESSAGE,
33
+ });
34
+ }
35
+ throw exp;
36
+ }
37
+ };
38
+
39
+ const is =
40
+ <T>(
41
+ closure: (input: Record<string, string | string[] | undefined>) => T | null,
42
+ ) =>
43
+ (
44
+ input: Record<string, string | string[] | undefined>,
45
+ ): T | BadRequestException => {
46
+ const result: T | null = closure(input);
47
+ return result !== null ? result : new BadRequestException(MESSAGE);
48
+ };
49
+
50
+ const validate =
51
+ <T>(
52
+ closure: (
53
+ input: Record<string, string | string[] | undefined>,
54
+ ) => IValidation<T>,
55
+ ) =>
56
+ (
57
+ input: Record<string, string | string[] | undefined>,
58
+ ): T | BadRequestException => {
59
+ const result: IValidation<T> = closure(input);
60
+ return result.success
61
+ ? result.data
62
+ : new BadRequestException({
63
+ errors: result.errors,
64
+ message: MESSAGE,
65
+ });
66
+ };
67
+
68
+ const MESSAGE = "Request headers data is not following the promised type.";
@@ -1,56 +1,56 @@
1
- import { BadRequestException } from "@nestjs/common";
2
- import typia, { IValidation, TypeGuardError } from "typia";
3
-
4
- import { IRequestQueryValidator } from "../../options/IRequestQueryValidator";
5
- import { NoTransformConfigureError } from "./NoTransformConfigureError";
6
-
7
- export const validate_request_query = <T>(
8
- validator?: IRequestQueryValidator<T>,
9
- ) => {
10
- if (!validator) return () => NoTransformConfigureError("TypedQuery");
11
- else if (validator.type === "assert") return assert(validator.assert);
12
- else if (validator.type === "is") return is(validator.is);
13
- else if (validator.type === "validate") return validate(validator.validate);
14
- return () =>
15
- new Error(`Error on nestia.core.TypedQuery(): invalid typed validator.`);
16
- };
17
-
18
- const assert =
19
- <T>(closure: (input: URLSearchParams) => T) =>
20
- (input: URLSearchParams): T | BadRequestException => {
21
- try {
22
- return closure(input);
23
- } catch (exp) {
24
- if (typia.is<TypeGuardError>(exp)) {
25
- return new BadRequestException({
26
- path: exp.path,
27
- reason: exp.message,
28
- expected: exp.expected,
29
- value: exp.value,
30
- message: MESSAGE,
31
- });
32
- }
33
- throw exp;
34
- }
35
- };
36
-
37
- const is =
38
- <T>(closure: (input: URLSearchParams) => T | null) =>
39
- (input: URLSearchParams): T | BadRequestException => {
40
- const result: T | null = closure(input);
41
- return result !== null ? result : new BadRequestException(MESSAGE);
42
- };
43
-
44
- const validate =
45
- <T>(closure: (input: URLSearchParams) => IValidation<T>) =>
46
- (input: URLSearchParams): T | BadRequestException => {
47
- const result: IValidation<T> = closure(input);
48
- return result.success
49
- ? result.data
50
- : new BadRequestException({
51
- errors: result.errors,
52
- message: MESSAGE,
53
- });
54
- };
55
-
56
- 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 { NoTransformConfigureError } from "./NoTransformConfigureError";
6
+
7
+ export const validate_request_query = <T>(
8
+ validator?: IRequestQueryValidator<T>,
9
+ ) => {
10
+ if (!validator) return () => NoTransformConfigureError("TypedQuery");
11
+ else if (validator.type === "assert") return assert(validator.assert);
12
+ else if (validator.type === "is") return is(validator.is);
13
+ else if (validator.type === "validate") return validate(validator.validate);
14
+ return () =>
15
+ new Error(`Error on nestia.core.TypedQuery(): invalid typed validator.`);
16
+ };
17
+
18
+ const assert =
19
+ <T>(closure: (input: URLSearchParams) => T) =>
20
+ (input: URLSearchParams): T | BadRequestException => {
21
+ try {
22
+ return closure(input);
23
+ } catch (exp) {
24
+ if (typia.is<TypeGuardError>(exp)) {
25
+ return new BadRequestException({
26
+ path: exp.path,
27
+ reason: exp.message,
28
+ expected: exp.expected,
29
+ value: exp.value,
30
+ message: MESSAGE,
31
+ });
32
+ }
33
+ throw exp;
34
+ }
35
+ };
36
+
37
+ const is =
38
+ <T>(closure: (input: URLSearchParams) => T | null) =>
39
+ (input: URLSearchParams): T | BadRequestException => {
40
+ const result: T | null = closure(input);
41
+ return result !== null ? result : new BadRequestException(MESSAGE);
42
+ };
43
+
44
+ const validate =
45
+ <T>(closure: (input: URLSearchParams) => IValidation<T>) =>
46
+ (input: URLSearchParams): T | BadRequestException => {
47
+ const result: IValidation<T> = closure(input);
48
+ return result.success
49
+ ? result.data
50
+ : new BadRequestException({
51
+ errors: result.errors,
52
+ message: MESSAGE,
53
+ });
54
+ };
55
+
56
+ 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,14 +1,14 @@
1
- export * from "./decorators/DynamicModule";
2
- export * from "./decorators/EncryptedBody";
3
- export * from "./decorators/EncryptedController";
4
- export * from "./decorators/EncryptedModule";
5
- export * from "./decorators/EncryptedRoute";
6
- export * from "./utils/ExceptionManager";
7
- export * from "./decorators/PlainBody";
8
- export * from "./decorators/TypedBody";
9
- export * from "./decorators/TypedException";
10
- export * from "./decorators/TypedHeaders";
11
- export * from "./decorators/TypedParam";
12
- export * from "./decorators/TypedRoute";
13
- export * from "./decorators/TypedQuery";
14
- export * from "./options/INestiaTransformOptions";
1
+ export * from "./decorators/DynamicModule";
2
+ export * from "./decorators/EncryptedBody";
3
+ export * from "./decorators/EncryptedController";
4
+ export * from "./decorators/EncryptedModule";
5
+ export * from "./decorators/EncryptedRoute";
6
+ export * from "./utils/ExceptionManager";
7
+ export * from "./decorators/PlainBody";
8
+ export * from "./decorators/TypedBody";
9
+ export * from "./decorators/TypedException";
10
+ export * from "./decorators/TypedHeaders";
11
+ export * from "./decorators/TypedParam";
12
+ export * from "./decorators/TypedRoute";
13
+ export * from "./decorators/TypedQuery";
14
+ export * from "./options/INestiaTransformOptions";
@@ -1,17 +1,17 @@
1
- export interface INestiaTransformOptions {
2
- validate?: // NORMAL
3
- | "assert"
4
- | "is"
5
- | "validate"
6
- // STRICT
7
- | "assertEquals"
8
- | "equals"
9
- | "validateEquals"
10
- // CLONE
11
- | "assertClone"
12
- | "validateClone"
13
- // PRUNE
14
- | "assertPrune"
15
- | "validatePrune";
16
- stringify?: "stringify" | "assert" | "is" | "validate" | null;
17
- }
1
+ export interface INestiaTransformOptions {
2
+ validate?: // NORMAL
3
+ | "assert"
4
+ | "is"
5
+ | "validate"
6
+ // STRICT
7
+ | "assertEquals"
8
+ | "equals"
9
+ | "validateEquals"
10
+ // CLONE
11
+ | "assertClone"
12
+ | "validateClone"
13
+ // PRUNE
14
+ | "assertPrune"
15
+ | "validatePrune";
16
+ stringify?: "stringify" | "assert" | "is" | "validate" | null;
17
+ }
@@ -1,7 +1,7 @@
1
- import { IProject } from "typia/lib/transformers/IProject";
2
-
3
- import { INestiaTransformOptions } from "./INestiaTransformOptions";
4
-
5
- export interface INestiaTransformProject extends Omit<IProject, "options"> {
6
- options: INestiaTransformOptions;
7
- }
1
+ import { IProject } from "typia/lib/transformers/IProject";
2
+
3
+ import { INestiaTransformOptions } from "./INestiaTransformOptions";
4
+
5
+ export interface INestiaTransformProject extends Omit<IProject, "options"> {
6
+ options: INestiaTransformOptions;
7
+ }
@@ -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,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,25 +1,25 @@
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
- export namespace IResponseBodyStringifier {
9
- export interface IStringify<T> {
10
- type: "stringify";
11
- stringify: (input: T) => string;
12
- }
13
- export interface IIs<T> {
14
- type: "is";
15
- is: (input: T) => string | null;
16
- }
17
- export interface IAssert<T> {
18
- type: "assert";
19
- assert: (input: T) => string;
20
- }
21
- export interface IValidate<T> {
22
- type: "validate";
23
- validate: (input: T) => IValidation<string>;
24
- }
25
- }
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
+ export namespace IResponseBodyStringifier {
9
+ export interface IStringify<T> {
10
+ type: "stringify";
11
+ stringify: (input: T) => string;
12
+ }
13
+ export interface IIs<T> {
14
+ type: "is";
15
+ is: (input: T) => string | null;
16
+ }
17
+ export interface IAssert<T> {
18
+ type: "assert";
19
+ assert: (input: T) => string;
20
+ }
21
+ export interface IValidate<T> {
22
+ type: "validate";
23
+ validate: (input: T) => IValidation<string>;
24
+ }
25
+ }