@nestia/core 1.4.4 → 1.4.6

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 (33) hide show
  1. package/lib/decorators/EncryptedRoute.d.ts +4 -4
  2. package/lib/decorators/EncryptedRoute.js +4 -4
  3. package/lib/decorators/TypedBody.d.ts +1 -1
  4. package/lib/decorators/TypedBody.js +1 -1
  5. package/lib/decorators/TypedHeaders.d.ts +42 -0
  6. package/lib/decorators/TypedHeaders.js +114 -0
  7. package/lib/decorators/TypedHeaders.js.map +1 -0
  8. package/lib/decorators/TypedQuery.d.ts +10 -3
  9. package/lib/decorators/TypedQuery.js +9 -2
  10. package/lib/decorators/TypedQuery.js.map +1 -1
  11. package/lib/decorators/TypedRoute.d.ts +5 -4
  12. package/lib/decorators/TypedRoute.js +5 -4
  13. package/lib/decorators/TypedRoute.js.map +1 -1
  14. package/lib/module.d.ts +1 -0
  15. package/lib/module.js +1 -0
  16. package/lib/module.js.map +1 -1
  17. package/lib/programmers/TypedHeadersProgrammer.d.ts +5 -0
  18. package/lib/programmers/TypedHeadersProgrammer.js +300 -0
  19. package/lib/programmers/TypedHeadersProgrammer.js.map +1 -0
  20. package/lib/programmers/TypedQueryProgrammer.js +23 -11
  21. package/lib/programmers/TypedQueryProgrammer.js.map +1 -1
  22. package/lib/transformers/ParameterDecoratorTransformer.js +6 -0
  23. package/lib/transformers/ParameterDecoratorTransformer.js.map +1 -1
  24. package/package.json +3 -3
  25. package/src/decorators/EncryptedRoute.ts +4 -4
  26. package/src/decorators/TypedBody.ts +1 -1
  27. package/src/decorators/TypedHeaders.ts +95 -0
  28. package/src/decorators/TypedQuery.ts +10 -3
  29. package/src/decorators/TypedRoute.ts +5 -4
  30. package/src/module.ts +1 -0
  31. package/src/programmers/TypedHeadersProgrammer.ts +304 -0
  32. package/src/programmers/TypedQueryProgrammer.ts +44 -21
  33. package/src/transformers/ParameterDecoratorTransformer.ts +5 -0
@@ -7,10 +7,10 @@ import { IResponseBodyStringifier } from "../options/IResponseBodyStringifier";
7
7
  * up JSON string conversion speed about 50x times faster than `class-transformer`,
8
8
  * even type safe through [typia](https://github.com/samchon/typia).
9
9
  *
10
- * For reference, router functions of `EncryptedRoute` can convert custom error classes
11
- * to regular {@link nest.HttpException} class automatically, through
12
- * {@link ExceptionManager}. Also, `EncryptedRoute` encrypts response body using those
13
- * options.
10
+ * For reference, if you try to invalid data that is not following the promised
11
+ * type `T`, 500 internal server error would be thrown. Also, as `EncryptedRoute`
12
+ * composes JSON string through `typia.assertStringify<T>()` function, it is not
13
+ * possible to modify response data through interceptors.
14
14
  *
15
15
  * - AES-128/256
16
16
  * - CBC mode
@@ -56,10 +56,10 @@ var route_error_1 = require("./internal/route_error");
56
56
  * up JSON string conversion speed about 50x times faster than `class-transformer`,
57
57
  * even type safe through [typia](https://github.com/samchon/typia).
58
58
  *
59
- * For reference, router functions of `EncryptedRoute` can convert custom error classes
60
- * to regular {@link nest.HttpException} class automatically, through
61
- * {@link ExceptionManager}. Also, `EncryptedRoute` encrypts response body using those
62
- * options.
59
+ * For reference, if you try to invalid data that is not following the promised
60
+ * type `T`, 500 internal server error would be thrown. Also, as `EncryptedRoute`
61
+ * composes JSON string through `typia.assertStringify<T>()` function, it is not
62
+ * possible to modify response data through interceptors.
63
63
  *
64
64
  * - AES-128/256
65
65
  * - CBC mode
@@ -5,7 +5,7 @@ import { IRequestBodyValidator } from "../options/IRequestBodyValidator";
5
5
  * `TypedBody` is a decoratur function getting `application/json` typed data from
6
6
  * request body. Also, it validates the request body data type through
7
7
  * [typia](https://github.com/samchon/typia) and the validation speed is
8
- * maximum 15,000x times faster than `class-validator`.
8
+ * maximum 20,000x times faster than `class-validator`.
9
9
  *
10
10
  * For reference, when the request body data is not following the promised type `T`,
11
11
  * `BadRequestException` error (status code: 400) would be thrown.
@@ -10,7 +10,7 @@ var validate_request_body_1 = require("./internal/validate_request_body");
10
10
  * `TypedBody` is a decoratur function getting `application/json` typed data from
11
11
  * request body. Also, it validates the request body data type through
12
12
  * [typia](https://github.com/samchon/typia) and the validation speed is
13
- * maximum 15,000x times faster than `class-validator`.
13
+ * maximum 20,000x times faster than `class-validator`.
14
14
  *
15
15
  * For reference, when the request body data is not following the promised type `T`,
16
16
  * `BadRequestException` error (status code: 400) would be thrown.
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Type safe HTTP headers decorator.
3
+ *
4
+ * `TypedHeaders` is a decorator function that can parse HTTP headers. It is almost
5
+ * same with {@link nest.Headers}, but it can automatically cast property type following
6
+ * its DTO definition. Also, `TypedHeaders` performs type validation.
7
+ *
8
+ * For reference, target type `T` must follow such restrictions. Also, if actual HTTP
9
+ * header values are different with their promised type `T`, `BadRequestException`
10
+ * error (status code: 400) would be thrown.
11
+ *
12
+ * 1. Type `T` must be an object type
13
+ * 2. Do not allow dynamic property
14
+ * 3. Property key must be lower case
15
+ * 4. Property value cannot be `null`, but `undefined` is possible
16
+ * 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
17
+ * 6. By the way, union type never be not allowed
18
+ * 7. Property `set-cookie` must be array type
19
+ * 8. Those properties cannot be array type
20
+ * - age
21
+ * - authorization
22
+ * - content-length
23
+ * - content-type
24
+ * - etag
25
+ * - expires
26
+ * - from
27
+ * - host
28
+ * - if-modified-since
29
+ * - if-unmodified-since
30
+ * - last-modified
31
+ * - location
32
+ * - max-forwards
33
+ * - proxy-authorization
34
+ * - referer
35
+ * - retry-after
36
+ * - server
37
+ * - user-agent
38
+ *
39
+ * @returns Parameter decorator
40
+ * @author Jeongho Nam - https://github.com/samchon
41
+ */
42
+ export declare function TypedHeaders<T extends object>(decoder?: (headers: Record<string, string | string[] | undefined>) => T): ParameterDecorator;
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.TypedHeaders = void 0;
27
+ var common_1 = require("@nestjs/common");
28
+ var typia_1 = __importStar(require("typia"));
29
+ var TransformError_1 = require("./internal/TransformError");
30
+ /**
31
+ * Type safe HTTP headers decorator.
32
+ *
33
+ * `TypedHeaders` is a decorator function that can parse HTTP headers. It is almost
34
+ * same with {@link nest.Headers}, but it can automatically cast property type following
35
+ * its DTO definition. Also, `TypedHeaders` performs type validation.
36
+ *
37
+ * For reference, target type `T` must follow such restrictions. Also, if actual HTTP
38
+ * header values are different with their promised type `T`, `BadRequestException`
39
+ * error (status code: 400) would be thrown.
40
+ *
41
+ * 1. Type `T` must be an object type
42
+ * 2. Do not allow dynamic property
43
+ * 3. Property key must be lower case
44
+ * 4. Property value cannot be `null`, but `undefined` is possible
45
+ * 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
46
+ * 6. By the way, union type never be not allowed
47
+ * 7. Property `set-cookie` must be array type
48
+ * 8. Those properties cannot be array type
49
+ * - age
50
+ * - authorization
51
+ * - content-length
52
+ * - content-type
53
+ * - etag
54
+ * - expires
55
+ * - from
56
+ * - host
57
+ * - if-modified-since
58
+ * - if-unmodified-since
59
+ * - last-modified
60
+ * - location
61
+ * - max-forwards
62
+ * - proxy-authorization
63
+ * - referer
64
+ * - retry-after
65
+ * - server
66
+ * - user-agent
67
+ *
68
+ * @returns Parameter decorator
69
+ * @author Jeongho Nam - https://github.com/samchon
70
+ */
71
+ function TypedHeaders(decoder) {
72
+ if (decoder === undefined)
73
+ throw (0, TransformError_1.TransformError)("TypedHeaders");
74
+ return (0, common_1.createParamDecorator)(function TypedHeaders(_unknown, context) {
75
+ var request = context
76
+ .switchToHttp()
77
+ .getRequest();
78
+ try {
79
+ return decoder(request.headers);
80
+ }
81
+ catch (exp) {
82
+ if ((function (input) {
83
+ var $io0 = function (input) { return "string" === typeof input.method && (undefined === input.path || "string" === typeof input.path) && "string" === typeof input.expected && true && "string" === typeof input.name && "string" === typeof input.message && (undefined === input.stack || "string" === typeof input.stack); };
84
+ return "object" === typeof input && null !== input && $io0(input);
85
+ })(exp))
86
+ throw new common_1.BadRequestException({
87
+ path: exp.path,
88
+ reason: exp.message,
89
+ expected: exp.expected,
90
+ value: exp.value,
91
+ message: "Request query parameters are not following the promised type.",
92
+ });
93
+ throw exp;
94
+ }
95
+ })();
96
+ }
97
+ exports.TypedHeaders = TypedHeaders;
98
+ /**
99
+ * @internal
100
+ */
101
+ (function (TypedHeaders) {
102
+ TypedHeaders.boolean = function (value) {
103
+ return value !== undefined ? value === "true" : undefined;
104
+ };
105
+ TypedHeaders.bigint = function (value) {
106
+ return value !== undefined ? BigInt(value) : undefined;
107
+ };
108
+ TypedHeaders.number = function (value) {
109
+ return value !== undefined ? Number(value) : undefined;
110
+ };
111
+ TypedHeaders.string = function (value) { return value; };
112
+ })(TypedHeaders || (exports.TypedHeaders = TypedHeaders = {}));
113
+ Object.assign(TypedHeaders, typia_1.assert);
114
+ //# sourceMappingURL=TypedHeaders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TypedHeaders.js","sourceRoot":"","sources":["../../src/decorators/TypedHeaders.ts"],"names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AAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS;IAA/C,CAA+C,CAAC;IACvC,mBAAM,GAAG,UAAC,KAAyB,IAAK,OAAA,KAAK,EAAL,CAAK,CAAC;AAC/D,CAAC,EARgB,YAAY,4BAAZ,YAAY,QAQ5B;AACD,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,cAAM,CAAC,CAAC"}
@@ -5,10 +5,17 @@
5
5
  * same with {@link nest.Query}, but it can automatically cast property type following
6
6
  * its DTO definition. Also, `TypedQuery` performs type validation.
7
7
  *
8
- * For referecen, when URL query parameters are different with their promised
9
- * type `T`, `BadRequestException` error (status code: 400) would be thrown.
8
+ * For reference, target type `T` must follw such restriction. Also, if actual URL
9
+ * query parameter values are different with their promised type `T`,
10
+ * `BadRequestException` error (status code: 400) would be thrown.
11
+ *
12
+ * 1. Type `T` must be an object type
13
+ * 2. Do not allow dynamic property
14
+ * 3. Prpoerty value cannot be `undefined`, but `null` is possible
15
+ * 4. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
16
+ * 5. By the way, union type never be not allowed
10
17
  *
11
18
  * @returns Parameter decorator
12
19
  * @author Jeongho Nam - https://github.com/samchon
13
20
  */
14
- export declare function TypedQuery<T>(decoder?: (params: URLSearchParams) => T): ParameterDecorator;
21
+ export declare function TypedQuery<T extends object>(decoder?: (params: URLSearchParams) => T): ParameterDecorator;
@@ -34,8 +34,15 @@ var TransformError_1 = require("./internal/TransformError");
34
34
  * same with {@link nest.Query}, but it can automatically cast property type following
35
35
  * its DTO definition. Also, `TypedQuery` performs type validation.
36
36
  *
37
- * For referecen, when URL query parameters are different with their promised
38
- * type `T`, `BadRequestException` error (status code: 400) would be thrown.
37
+ * For reference, target type `T` must follw such restriction. Also, if actual URL
38
+ * query parameter values are different with their promised type `T`,
39
+ * `BadRequestException` error (status code: 400) would be thrown.
40
+ *
41
+ * 1. Type `T` must be an object type
42
+ * 2. Do not allow dynamic property
43
+ * 3. Prpoerty value cannot be `undefined`, but `null` is possible
44
+ * 4. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
45
+ * 5. By the way, union type never be not allowed
39
46
  *
40
47
  * @returns Parameter decorator
41
48
  * @author Jeongho Nam - https://github.com/samchon
@@ -1 +1 @@
1
- {"version":3,"file":"TypedQuery.js","sourceRoot":"","sources":["../../src/decorators/TypedQuery.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAIwB;AAIxB,6CAAsD;AAEtD,4DAA2D;AAE3D;;;;;;;;;;;;GAYG;AACH,SAAgB,UAAU,CACtB,OAAwC;IAExC,IAAI,OAAO,KAAK,SAAS;QAAE,MAAM,IAAA,+BAAc,EAAC,YAAY,CAAC,CAAC;IAE9D,OAAO,IAAA,6BAAoB,EAAC,SAAS,UAAU,CAC3C,QAAa,EACb,OAAyB;QAEzB,IAAM,OAAO,GAAqC,OAAO;aACpD,YAAY,EAAE;aACd,UAAU,EAAE,CAAC;QAClB,IAAM,MAAM,GAAoB,IAAI,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;QAEvE,IAAI;YACA,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;SAC1B;QAAC,OAAO,GAAG,EAAE;YACV;;;eAA6B,GAAG;gBAC5B,MAAM,IAAI,4BAAmB,CAAC;oBAC1B,IAAI,EAAE,GAAG,CAAC,IAAI;oBACd,MAAM,EAAE,GAAG,CAAC,OAAO;oBACnB,QAAQ,EAAE,GAAG,CAAC,QAAQ;oBACtB,KAAK,EAAE,GAAG,CAAC,KAAK;oBAChB,OAAO,EACH,+DAA+D;iBACtE,CAAC,CAAC;YACP,MAAM,GAAG,CAAC;SACb;IACL,CAAC,CAAC,EAAE,CAAC;AACT,CAAC;AA7BD,gCA6BC;AAED;;GAEG;AACH,WAAiB,UAAU;IACvB,SAAgB,OAAO,CAAC,GAAkB;QACtC,IAAI,GAAG,KAAK,IAAI;YAAE,OAAO,SAAS,CAAC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AC,EApBgB,UAAU,0BAAV,UAAU,QAoB1B;AACD,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,cAAM,CAAC,CAAC;AAElC;;GAEG;AACH,SAAS,IAAI,CAAC,GAAW;IACrB,IAAM,KAAK,GAAW,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACvC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AACxD,CAAC"}
@@ -3,13 +3,14 @@ import { IResponseBodyStringifier } from "../options/IResponseBodyStringifier";
3
3
  * Type safe router decorator functions.
4
4
  *
5
5
  * `TypedRoute` is a module containing router decorator functions which can boost up
6
- * JSON string conversion speed about 50x times faster than `class-transformer`.
6
+ * JSON string conversion speed about 200x times faster than `class-transformer`.
7
7
  * Furthermore, such JSON string conversion is even type safe through
8
8
  * [typia](https://github.com/samchon/typia).
9
9
  *
10
- * For reference, router functions of `TypedRoute` can convert custom error classes to
11
- * the regular {@link nest.HttpException} class automatically, through
12
- * {@link ExceptionManager}.
10
+ * For reference, if you try to invalid data that is not following the promised
11
+ * type `T`, 500 internal server error would be thrown. Also, as `TypedRoute` composes
12
+ * JSON string through `typia.assertStringify<T>()` function, it is not possible to
13
+ * modify response data through interceptors.
13
14
  *
14
15
  * @author Jeongho Nam - https://github.com/samchon
15
16
  */
@@ -47,13 +47,14 @@ var route_error_1 = require("./internal/route_error");
47
47
  * Type safe router decorator functions.
48
48
  *
49
49
  * `TypedRoute` is a module containing router decorator functions which can boost up
50
- * JSON string conversion speed about 50x times faster than `class-transformer`.
50
+ * JSON string conversion speed about 200x times faster than `class-transformer`.
51
51
  * Furthermore, such JSON string conversion is even type safe through
52
52
  * [typia](https://github.com/samchon/typia).
53
53
  *
54
- * For reference, router functions of `TypedRoute` can convert custom error classes to
55
- * the regular {@link nest.HttpException} class automatically, through
56
- * {@link ExceptionManager}.
54
+ * For reference, if you try to invalid data that is not following the promised
55
+ * type `T`, 500 internal server error would be thrown. Also, as `TypedRoute` composes
56
+ * JSON string through `typia.assertStringify<T>()` function, it is not possible to
57
+ * modify response data through interceptors.
57
58
  *
58
59
  * @author Jeongho Nam - https://github.com/samchon
59
60
  */
@@ -1 +1 @@
1
- {"version":3,"file":"TypedRoute.js","sourceRoot":"","sources":["../../src/decorators/TypedRoute.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAWwB;AAGxB,4CAAiD;AAEjD,+BAKe;AAGf,4EAA2E;AAC3E,sDAAqD;AAErD;;;;;;;;;;;;;GAaG;AACH,IAAiB,UAAU,CAiE1B;AAjED,WAAiB,UAAU;IACvB;;;;;OAKG;IACU,cAAG,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAEpC;;;;;OAKG;IACU,eAAI,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;IAEtC;;;;;OAKG;IACU,gBAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IAExC;;;;;OAKG;IACU,cAAG,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAEpC;;;;;OAKG;IACU,iBAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;IAE1C;;OAEG;IACH,SAAS,SAAS,CAAC,MAAmD;QAUlE,SAAS,KAAK;YAAC,cAAc;iBAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;gBAAd,yBAAc;;YACnB,IAAA,KAAA,OAAoB,IAAA,+CAAsB,EAC5C,qBAAc,MAAM,CAAE,CACzB,wCAAI,IAAI,cAAC,EAFH,IAAI,QAAA,EAAE,SAAS,QAEZ,CAAC;YACX,OAAO,IAAA,wBAAe,EAClB,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,EACrB,IAAA,wBAAe,EAAC,IAAI,qBAAqB,CAAC,SAAS,CAAC,CAAC,CACxD,CAAC;QACN,CAAC;QACD,OAAO,KA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AU,EAAE,EAAE,GAAG,CAAC,EAAnC,CAAmC,CAAC,CAC3D,CAAC;IACN,CAAC;IACL,4BAAC;AAAD,CAAC,AAbD,IAaC;AAED;;GAEG;AACH,IAAM,OAAO,GAAG;IACZ,GAAG,cAAA;IACH,IAAI,eAAA;IACJ,KAAK,gBAAA;IACL,GAAG,cAAA;IACH,MAAM,iBAAA;CACT,CAAC"}
package/lib/module.d.ts CHANGED
@@ -6,6 +6,7 @@ export * from "./decorators/EncryptedRoute";
6
6
  export * from "./utils/ExceptionManager";
7
7
  export * from "./decorators/PlainBody";
8
8
  export * from "./decorators/TypedBody";
9
+ export * from "./decorators/TypedHeaders";
9
10
  export * from "./decorators/TypedParam";
10
11
  export * from "./decorators/TypedRoute";
11
12
  export * from "./decorators/TypedQuery";
package/lib/module.js CHANGED
@@ -22,6 +22,7 @@ __exportStar(require("./decorators/EncryptedRoute"), exports);
22
22
  __exportStar(require("./utils/ExceptionManager"), exports);
23
23
  __exportStar(require("./decorators/PlainBody"), exports);
24
24
  __exportStar(require("./decorators/TypedBody"), exports);
25
+ __exportStar(require("./decorators/TypedHeaders"), exports);
25
26
  __exportStar(require("./decorators/TypedParam"), exports);
26
27
  __exportStar(require("./decorators/TypedRoute"), exports);
27
28
  __exportStar(require("./decorators/TypedQuery"), exports);
package/lib/module.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA2C;AAC3C,6DAA2C;AAC3C,mEAAiD;AACjD,+DAA6C;AAC7C,8DAA4C;AAC5C,2DAAyC;AACzC,yDAAuC;AACvC,yDAAuC;AACvC,0DAAwC;AACxC,0DAAwC;AACxC,0DAAwC;AACxC,oEAAkD"}
1
+ {"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA2C;AAC3C,6DAA2C;AAC3C,mEAAiD;AACjD,+DAA6C;AAC7C,8DAA4C;AAC5C,2DAAyC;AACzC,yDAAuC;AACvC,yDAAuC;AACvC,4DAA0C;AAC1C,0DAAwC;AACxC,0DAAwC;AACxC,0DAAwC;AACxC,oEAAkD"}
@@ -0,0 +1,5 @@
1
+ import ts from "typescript";
2
+ import { INestiaTransformProject } from "../options/INestiaTransformProject";
3
+ export declare namespace TypedHeadersProgrammer {
4
+ const generate: (project: INestiaTransformProject) => (modulo: ts.LeftHandSideExpression) => (type: ts.Type) => ts.Expression;
5
+ }