@nestia/core 2.2.0-dev.20231008 → 2.2.0
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/lib/decorators/TypedQuery.d.ts +56 -0
- package/lib/decorators/TypedQuery.js +164 -0
- package/lib/decorators/TypedQuery.js.map +1 -1
- package/lib/decorators/internal/get_path_and_querify.d.ts +1 -0
- package/lib/decorators/internal/get_path_and_querify.js +164 -0
- package/lib/decorators/internal/get_path_and_querify.js.map +1 -0
- package/lib/options/IResponseBodyQuerifier.d.ts +20 -0
- package/lib/options/IResponseBodyQuerifier.js +3 -0
- package/lib/options/IResponseBodyQuerifier.js.map +1 -0
- package/lib/programmers/TypedQueryRouteProgrammer.d.ts +5 -0
- package/lib/programmers/TypedQueryRouteProgrammer.js +50 -0
- package/lib/programmers/TypedQueryRouteProgrammer.js.map +1 -0
- package/lib/programmers/http/HttpAssertQuerifyProgrammer.d.ts +5 -0
- package/lib/programmers/http/HttpAssertQuerifyProgrammer.js +39 -0
- package/lib/programmers/http/HttpAssertQuerifyProgrammer.js.map +1 -0
- package/lib/programmers/http/HttpIsQuerifyProgrammer.d.ts +5 -0
- package/lib/programmers/http/HttpIsQuerifyProgrammer.js +37 -0
- package/lib/programmers/http/HttpIsQuerifyProgrammer.js.map +1 -0
- package/lib/programmers/http/HttpQuerifyProgrammer.d.ts +5 -0
- package/lib/programmers/http/HttpQuerifyProgrammer.js +80 -0
- package/lib/programmers/http/HttpQuerifyProgrammer.js.map +1 -0
- package/lib/programmers/http/HttpValidateQuerifyProgrammer.d.ts +5 -0
- package/lib/programmers/http/HttpValidateQuerifyProgrammer.js +38 -0
- package/lib/programmers/http/HttpValidateQuerifyProgrammer.js.map +1 -0
- package/lib/transformers/TypedRouteTransformer.js +13 -6
- package/lib/transformers/TypedRouteTransformer.js.map +1 -1
- package/package.json +11 -11
- package/src/decorators/TypedQuery.ts +126 -0
- package/src/decorators/internal/get_path_and_querify.ts +104 -0
- package/src/options/IResponseBodyQuerifier.ts +25 -0
- package/src/programmers/TypedQueryRouteProgrammer.ts +55 -0
- package/src/programmers/http/HttpAssertQuerifyProgrammer.ts +59 -0
- package/src/programmers/http/HttpIsQuerifyProgrammer.ts +63 -0
- package/src/programmers/http/HttpQuerifyProgrammer.ts +105 -0
- package/src/programmers/http/HttpValidateQuerifyProgrammer.ts +64 -0
- package/src/transformers/TypedRouteTransformer.ts +15 -8
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IRequestQueryValidator } from "../options/IRequestQueryValidator";
|
|
2
|
+
import { IResponseBodyQuerifier } from "../options/IResponseBodyQuerifier";
|
|
2
3
|
/**
|
|
3
4
|
* Type safe URL query decorator.
|
|
4
5
|
*
|
|
@@ -21,4 +22,59 @@ import { IRequestQueryValidator } from "../options/IRequestQueryValidator";
|
|
|
21
22
|
export declare function TypedQuery<T extends object>(validator?: IRequestQueryValidator<T>): ParameterDecorator;
|
|
22
23
|
export declare namespace TypedQuery {
|
|
23
24
|
function Body<T extends object>(validator?: IRequestQueryValidator<T>): ParameterDecorator;
|
|
25
|
+
/**
|
|
26
|
+
* Router decorator function for the GET method.
|
|
27
|
+
*
|
|
28
|
+
* @param path Path of the HTTP request
|
|
29
|
+
* @returns Method decorator
|
|
30
|
+
*/
|
|
31
|
+
const Get: {
|
|
32
|
+
(path?: string | string[]): MethodDecorator;
|
|
33
|
+
<T>(stringify?: IResponseBodyQuerifier<T> | undefined): MethodDecorator;
|
|
34
|
+
<T_1>(path: string | string[], stringify?: IResponseBodyQuerifier<T_1> | undefined): MethodDecorator;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Router decorator function for the POST method.
|
|
38
|
+
*
|
|
39
|
+
* @param path Path of the HTTP request
|
|
40
|
+
* @returns Method decorator
|
|
41
|
+
*/
|
|
42
|
+
const Post: {
|
|
43
|
+
(path?: string | string[]): MethodDecorator;
|
|
44
|
+
<T>(stringify?: IResponseBodyQuerifier<T> | undefined): MethodDecorator;
|
|
45
|
+
<T_1>(path: string | string[], stringify?: IResponseBodyQuerifier<T_1> | undefined): MethodDecorator;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Router decorator function for the PATH method.
|
|
49
|
+
*
|
|
50
|
+
* @param path Path of the HTTP request
|
|
51
|
+
* @returns Method decorator
|
|
52
|
+
*/
|
|
53
|
+
const Patch: {
|
|
54
|
+
(path?: string | string[]): MethodDecorator;
|
|
55
|
+
<T>(stringify?: IResponseBodyQuerifier<T> | undefined): MethodDecorator;
|
|
56
|
+
<T_1>(path: string | string[], stringify?: IResponseBodyQuerifier<T_1> | undefined): MethodDecorator;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Router decorator function for the PUT method.
|
|
60
|
+
*
|
|
61
|
+
* @param path Path of the HTTP request
|
|
62
|
+
* @returns Method decorator
|
|
63
|
+
*/
|
|
64
|
+
const Put: {
|
|
65
|
+
(path?: string | string[]): MethodDecorator;
|
|
66
|
+
<T>(stringify?: IResponseBodyQuerifier<T> | undefined): MethodDecorator;
|
|
67
|
+
<T_1>(path: string | string[], stringify?: IResponseBodyQuerifier<T_1> | undefined): MethodDecorator;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Router decorator function for the DELETE method.
|
|
71
|
+
*
|
|
72
|
+
* @param path Path of the HTTP request
|
|
73
|
+
* @returns Method decorator
|
|
74
|
+
*/
|
|
75
|
+
const Delete: {
|
|
76
|
+
(path?: string | string[]): MethodDecorator;
|
|
77
|
+
<T>(stringify?: IResponseBodyQuerifier<T> | undefined): MethodDecorator;
|
|
78
|
+
<T_1>(path: string | string[], stringify?: IResponseBodyQuerifier<T_1> | undefined): MethodDecorator;
|
|
79
|
+
};
|
|
24
80
|
}
|
|
@@ -1,11 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
+
if (!m) return o;
|
|
5
|
+
var i = m.call(o), r, ar = [], e;
|
|
6
|
+
try {
|
|
7
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
+
}
|
|
9
|
+
catch (error) { e = { error: error }; }
|
|
10
|
+
finally {
|
|
11
|
+
try {
|
|
12
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
+
}
|
|
14
|
+
finally { if (e) throw e.error; }
|
|
15
|
+
}
|
|
16
|
+
return ar;
|
|
17
|
+
};
|
|
18
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
19
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
20
|
+
if (ar || !(i in from)) {
|
|
21
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
22
|
+
ar[i] = from[i];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
26
|
+
};
|
|
27
|
+
var __values = (this && this.__values) || function(o) {
|
|
28
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
29
|
+
if (m) return m.call(o);
|
|
30
|
+
if (o && typeof o.length === "number") return {
|
|
31
|
+
next: function () {
|
|
32
|
+
if (o && i >= o.length) o = void 0;
|
|
33
|
+
return { value: o && o[i++], done: !o };
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
37
|
+
};
|
|
2
38
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
40
|
};
|
|
5
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
42
|
exports.TypedQuery = void 0;
|
|
7
43
|
var common_1 = require("@nestjs/common");
|
|
44
|
+
var rxjs_1 = require("rxjs");
|
|
8
45
|
var typia_1 = __importDefault(require("typia"));
|
|
46
|
+
var get_path_and_querify_1 = require("./internal/get_path_and_querify");
|
|
47
|
+
var route_error_1 = require("./internal/route_error");
|
|
9
48
|
var validate_request_query_1 = require("./internal/validate_request_query");
|
|
10
49
|
/**
|
|
11
50
|
* Type safe URL query decorator.
|
|
@@ -41,6 +80,7 @@ function TypedQuery(validator) {
|
|
|
41
80
|
}
|
|
42
81
|
exports.TypedQuery = TypedQuery;
|
|
43
82
|
(function (TypedQuery) {
|
|
83
|
+
var e_1, _a, e_2, _b, e_3, _c;
|
|
44
84
|
function Body(validator) {
|
|
45
85
|
var checker = (0, validate_request_query_1.validate_request_query)(validator);
|
|
46
86
|
return (0, common_1.createParamDecorator)(function TypedQueryBody(_unknown, context) {
|
|
@@ -62,6 +102,98 @@ exports.TypedQuery = TypedQuery;
|
|
|
62
102
|
Object.assign(Body, typia_1.default.http.assertQuery);
|
|
63
103
|
Object.assign(Body, typia_1.default.http.isQuery);
|
|
64
104
|
Object.assign(Body, typia_1.default.http.validateQuery);
|
|
105
|
+
/**
|
|
106
|
+
* Router decorator function for the GET method.
|
|
107
|
+
*
|
|
108
|
+
* @param path Path of the HTTP request
|
|
109
|
+
* @returns Method decorator
|
|
110
|
+
*/
|
|
111
|
+
TypedQuery.Get = Generator("Get");
|
|
112
|
+
/**
|
|
113
|
+
* Router decorator function for the POST method.
|
|
114
|
+
*
|
|
115
|
+
* @param path Path of the HTTP request
|
|
116
|
+
* @returns Method decorator
|
|
117
|
+
*/
|
|
118
|
+
TypedQuery.Post = Generator("Post");
|
|
119
|
+
/**
|
|
120
|
+
* Router decorator function for the PATH method.
|
|
121
|
+
*
|
|
122
|
+
* @param path Path of the HTTP request
|
|
123
|
+
* @returns Method decorator
|
|
124
|
+
*/
|
|
125
|
+
TypedQuery.Patch = Generator("Patch");
|
|
126
|
+
/**
|
|
127
|
+
* Router decorator function for the PUT method.
|
|
128
|
+
*
|
|
129
|
+
* @param path Path of the HTTP request
|
|
130
|
+
* @returns Method decorator
|
|
131
|
+
*/
|
|
132
|
+
TypedQuery.Put = Generator("Put");
|
|
133
|
+
/**
|
|
134
|
+
* Router decorator function for the DELETE method.
|
|
135
|
+
*
|
|
136
|
+
* @param path Path of the HTTP request
|
|
137
|
+
* @returns Method decorator
|
|
138
|
+
*/
|
|
139
|
+
TypedQuery.Delete = Generator("Delete");
|
|
140
|
+
/**
|
|
141
|
+
* @internal
|
|
142
|
+
*/
|
|
143
|
+
function Generator(method) {
|
|
144
|
+
function route() {
|
|
145
|
+
var args = [];
|
|
146
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
147
|
+
args[_i] = arguments[_i];
|
|
148
|
+
}
|
|
149
|
+
var _a = __read((0, get_path_and_querify_1.get_path_and_querify)("TypedQuery.".concat(method)).apply(void 0, __spreadArray([], __read(args), false)), 2), path = _a[0], stringify = _a[1];
|
|
150
|
+
return (0, common_1.applyDecorators)(ROUTERS[method](path), (0, common_1.UseInterceptors)(new TypedQueryRouteInterceptor(stringify)));
|
|
151
|
+
}
|
|
152
|
+
return route;
|
|
153
|
+
}
|
|
154
|
+
try {
|
|
155
|
+
for (var _d = __values([typia_1.default.assert, typia_1.default.is, typia_1.default.validate]), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
156
|
+
var method = _e.value;
|
|
157
|
+
try {
|
|
158
|
+
for (var _f = (e_2 = void 0, __values(Object.entries(method))), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
159
|
+
var _h = __read(_g.value, 2), key = _h[0], value = _h[1];
|
|
160
|
+
try {
|
|
161
|
+
for (var _j = (e_3 = void 0, __values([
|
|
162
|
+
TypedQuery.Get,
|
|
163
|
+
TypedQuery.Delete,
|
|
164
|
+
TypedQuery.Post,
|
|
165
|
+
TypedQuery.Put,
|
|
166
|
+
TypedQuery.Patch,
|
|
167
|
+
])), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
168
|
+
var deco = _k.value;
|
|
169
|
+
deco[key] = value;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
173
|
+
finally {
|
|
174
|
+
try {
|
|
175
|
+
if (_k && !_k.done && (_c = _j.return)) _c.call(_j);
|
|
176
|
+
}
|
|
177
|
+
finally { if (e_3) throw e_3.error; }
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
182
|
+
finally {
|
|
183
|
+
try {
|
|
184
|
+
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
185
|
+
}
|
|
186
|
+
finally { if (e_2) throw e_2.error; }
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
191
|
+
finally {
|
|
192
|
+
try {
|
|
193
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
194
|
+
}
|
|
195
|
+
finally { if (e_1) throw e_1.error; }
|
|
196
|
+
}
|
|
65
197
|
})(TypedQuery || (exports.TypedQuery = TypedQuery = {}));
|
|
66
198
|
Object.assign(TypedQuery, typia_1.default.http.assertQuery);
|
|
67
199
|
Object.assign(TypedQuery, typia_1.default.http.isQuery);
|
|
@@ -73,6 +205,9 @@ function tail(url) {
|
|
|
73
205
|
var index = url.indexOf("?");
|
|
74
206
|
return index === -1 ? "" : url.substring(index + 1);
|
|
75
207
|
}
|
|
208
|
+
/**
|
|
209
|
+
* @internal
|
|
210
|
+
*/
|
|
76
211
|
function isApplicationQuery(text) {
|
|
77
212
|
return (text !== undefined &&
|
|
78
213
|
text
|
|
@@ -80,6 +215,9 @@ function isApplicationQuery(text) {
|
|
|
80
215
|
.map(function (str) { return str.trim(); })
|
|
81
216
|
.some(function (str) { return str === "application/x-www-form-urlencoded"; }));
|
|
82
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* @internal
|
|
220
|
+
*/
|
|
83
221
|
var FakeURLSearchParams = /** @class */ (function () {
|
|
84
222
|
function FakeURLSearchParams(target) {
|
|
85
223
|
this.target = target;
|
|
@@ -106,4 +244,30 @@ var FakeURLSearchParams = /** @class */ (function () {
|
|
|
106
244
|
};
|
|
107
245
|
return FakeURLSearchParams;
|
|
108
246
|
}());
|
|
247
|
+
/**
|
|
248
|
+
* @internal
|
|
249
|
+
*/
|
|
250
|
+
var TypedQueryRouteInterceptor = /** @class */ (function () {
|
|
251
|
+
function TypedQueryRouteInterceptor(toSearchParams) {
|
|
252
|
+
this.toSearchParams = toSearchParams;
|
|
253
|
+
}
|
|
254
|
+
TypedQueryRouteInterceptor.prototype.intercept = function (context, next) {
|
|
255
|
+
var _this = this;
|
|
256
|
+
var http = context.switchToHttp();
|
|
257
|
+
var response = http.getResponse();
|
|
258
|
+
response.header("Content-Type", "application/x-www-form-urlencoded");
|
|
259
|
+
return next.handle().pipe((0, rxjs_1.map)(function (value) { return _this.toSearchParams(value).toString(); }), (0, rxjs_1.catchError)(function (err) { return (0, route_error_1.route_error)(http.getRequest(), err); }));
|
|
260
|
+
};
|
|
261
|
+
return TypedQueryRouteInterceptor;
|
|
262
|
+
}());
|
|
263
|
+
/**
|
|
264
|
+
* @internal
|
|
265
|
+
*/
|
|
266
|
+
var ROUTERS = {
|
|
267
|
+
Get: common_1.Get,
|
|
268
|
+
Post: common_1.Post,
|
|
269
|
+
Patch: common_1.Patch,
|
|
270
|
+
Put: common_1.Put,
|
|
271
|
+
Delete: common_1.Delete,
|
|
272
|
+
};
|
|
109
273
|
//# sourceMappingURL=TypedQuery.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypedQuery.js","sourceRoot":"","sources":["../../src/decorators/TypedQuery.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TypedQuery.js","sourceRoot":"","sources":["../../src/decorators/TypedQuery.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAawB;AAIxB,6BAAuC;AAEvC,gDAA0B;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AI,CAAC,WAAW,EAAE,CAAC;QACtD,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,mCAAmC,CAAC,CAAC;QAErE,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CACrB,IAAA,UAAG,EAAC,UAAC,KAAK,IAAK,OAAA,KAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,EAArC,CAAqC,CAAC,EACrD,IAAA,iBAAU,EAAC,UAAC,GAAG,IAAK,OAAA,IAAA,yBAAW,EAAC,IAAI,CAAC,UAAU,EAAE,EAAE,GAAG,CAAC,EAAnC,CAAmC,CAAC,CAC3D,CAAC;IACN,CAAC;IACL,iCAAC;AAAD,CAAC,AAfD,IAeC;AAED;;GAEG;AACH,IAAM,OAAO,GAAG;IACZ,GAAG,cAAA;IACH,IAAI,eAAA;IACJ,KAAK,gBAAA;IACL,GAAG,cAAA;IACH,MAAM,iBAAA;CACT,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __values = (this && this.__values) || function(o) {
|
|
3
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
4
|
+
if (m) return m.call(o);
|
|
5
|
+
if (o && typeof o.length === "number") return {
|
|
6
|
+
next: function () {
|
|
7
|
+
if (o && i >= o.length) o = void 0;
|
|
8
|
+
return { value: o && o[i++], done: !o };
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
12
|
+
};
|
|
13
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
14
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
15
|
+
if (!m) return o;
|
|
16
|
+
var i = m.call(o), r, ar = [], e;
|
|
17
|
+
try {
|
|
18
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
19
|
+
}
|
|
20
|
+
catch (error) { e = { error: error }; }
|
|
21
|
+
finally {
|
|
22
|
+
try {
|
|
23
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
24
|
+
}
|
|
25
|
+
finally { if (e) throw e.error; }
|
|
26
|
+
}
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
30
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
31
|
+
};
|
|
32
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
+
exports.get_path_and_querify = void 0;
|
|
34
|
+
var common_1 = require("@nestjs/common");
|
|
35
|
+
var typia_1 = __importDefault(require("typia"));
|
|
36
|
+
var NoTransformConfigureError_1 = require("./NoTransformConfigureError");
|
|
37
|
+
/**
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
var get_path_and_querify = function (method) {
|
|
41
|
+
return function () {
|
|
42
|
+
var args = [];
|
|
43
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
44
|
+
args[_i] = arguments[_i];
|
|
45
|
+
}
|
|
46
|
+
var path = args[0] === undefined ||
|
|
47
|
+
typeof args[0] === "string" ||
|
|
48
|
+
Array.isArray(args[0])
|
|
49
|
+
? args[0]
|
|
50
|
+
: null;
|
|
51
|
+
var functor = path === null ? args[0] : args[1];
|
|
52
|
+
return [path !== null && path !== void 0 ? path : undefined, take(method)(functor)];
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
exports.get_path_and_querify = get_path_and_querify;
|
|
56
|
+
/**
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
var take = function (method) {
|
|
60
|
+
return function (functor) {
|
|
61
|
+
if (functor === undefined)
|
|
62
|
+
throw (0, NoTransformConfigureError_1.NoTransformConfigureError)(method);
|
|
63
|
+
else if (functor === null)
|
|
64
|
+
return querify;
|
|
65
|
+
else if (functor.type === "stringify")
|
|
66
|
+
return functor.stringify;
|
|
67
|
+
else if (functor.type === "assert")
|
|
68
|
+
return assert(functor.assert);
|
|
69
|
+
else if (functor.type === "is")
|
|
70
|
+
return is(functor.is);
|
|
71
|
+
else if (functor.type === "validate")
|
|
72
|
+
return validate(functor.validate);
|
|
73
|
+
throw new Error("Error on nestia.core.".concat(method, "(): invalid typed stringify function."));
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
var querify = function (input) {
|
|
77
|
+
var e_1, _a, e_2, _b;
|
|
78
|
+
var output = new URLSearchParams();
|
|
79
|
+
try {
|
|
80
|
+
for (var _c = __values(Object.entries(input)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
81
|
+
var _e = __read(_d.value, 2), key = _e[0], value = _e[1];
|
|
82
|
+
if (key === undefined)
|
|
83
|
+
continue;
|
|
84
|
+
else if (Array.isArray(value))
|
|
85
|
+
try {
|
|
86
|
+
for (var value_1 = (e_2 = void 0, __values(value)), value_1_1 = value_1.next(); !value_1_1.done; value_1_1 = value_1.next()) {
|
|
87
|
+
var elem = value_1_1.value;
|
|
88
|
+
output.append(key, String(elem));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
92
|
+
finally {
|
|
93
|
+
try {
|
|
94
|
+
if (value_1_1 && !value_1_1.done && (_b = value_1.return)) _b.call(value_1);
|
|
95
|
+
}
|
|
96
|
+
finally { if (e_2) throw e_2.error; }
|
|
97
|
+
}
|
|
98
|
+
else
|
|
99
|
+
output.append(key, String(value));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
103
|
+
finally {
|
|
104
|
+
try {
|
|
105
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
106
|
+
}
|
|
107
|
+
finally { if (e_1) throw e_1.error; }
|
|
108
|
+
}
|
|
109
|
+
return output;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* @internal
|
|
113
|
+
*/
|
|
114
|
+
var assert = function (closure) {
|
|
115
|
+
return function (data) {
|
|
116
|
+
try {
|
|
117
|
+
return closure(data);
|
|
118
|
+
}
|
|
119
|
+
catch (exp) {
|
|
120
|
+
if ((function (input) {
|
|
121
|
+
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); };
|
|
122
|
+
return "object" === typeof input && null !== input && $io0(input);
|
|
123
|
+
})(exp))
|
|
124
|
+
throw new common_1.InternalServerErrorException({
|
|
125
|
+
path: exp.path,
|
|
126
|
+
reason: exp.message,
|
|
127
|
+
expected: exp.expected,
|
|
128
|
+
value: exp.value,
|
|
129
|
+
message: MESSAGE,
|
|
130
|
+
});
|
|
131
|
+
throw exp;
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* @internal
|
|
137
|
+
*/
|
|
138
|
+
var is = function (closure) {
|
|
139
|
+
return function (data) {
|
|
140
|
+
var result = closure(data);
|
|
141
|
+
if (result === null)
|
|
142
|
+
throw new common_1.InternalServerErrorException(MESSAGE);
|
|
143
|
+
return result;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* @internal
|
|
148
|
+
*/
|
|
149
|
+
var validate = function (closure) {
|
|
150
|
+
return function (data) {
|
|
151
|
+
var result = closure(data);
|
|
152
|
+
if (result.success === false)
|
|
153
|
+
throw new common_1.InternalServerErrorException({
|
|
154
|
+
errors: result.errors,
|
|
155
|
+
message: MESSAGE,
|
|
156
|
+
});
|
|
157
|
+
return result.data;
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* @internal
|
|
162
|
+
*/
|
|
163
|
+
var MESSAGE = "Response body data is not following the promised type.";
|
|
164
|
+
//# sourceMappingURL=get_path_and_querify.js.map
|
|
@@ -0,0 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AAC,OAAO;oBACnB,QAAQ,EAAE,GAAG,CAAC,QAAQ;oBACtB,KAAK,EAAE,GAAG,CAAC,KAAK;oBAChB,OAAO,EAAE,OAAO;iBACnB,CAAC,CAAC;YACP,MAAM,GAAG,CAAC;SACb;IACL,CAAC;AAdD,CAcC,CAAC;AAEN;;GAEG;AACH,IAAM,EAAE,GACJ,UAAI,OAA4C;IAChD,OAAA,UAAC,IAAO;QACJ,IAAM,MAAM,GAA2B,OAAO,CAAC,IAAI,CAAC,CAAC;QACrD,IAAI,MAAM,KAAK,IAAI;YAAE,MAAM,IAAI,qCAA4B,CAAC,OAAO,CAAC,CAAC;QACrE,OAAO,MAAM,CAAC;IAClB,CAAC;AAJD,CAIC,CAAC;AAEN;;GAEG;AACH,IAAM,QAAQ,GACV,UAAI,OAAkD;IACtD,OAAA,UAAC,IAAO;QACJ,IAAM,MAAM,GAAiC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC3D,IAAI,MAAM,CAAC,OAAO,KAAK,KAAK;YACxB,MAAM,IAAI,qCAA4B,CAAC;gBACnC,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,OAAO,EAAE,OAAO;aACnB,CAAC,CAAC;QACP,OAAO,MAAM,CAAC,IAAI,CAAC;IACvB,CAAC;AARD,CAQC,CAAC;AAEN;;GAEG;AACH,IAAM,OAAO,GAAG,wDAAwD,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IValidation } from "typia";
|
|
2
|
+
export type IResponseBodyQuerifier<T> = IResponseBodyquerifier.IStringify<T> | IResponseBodyquerifier.IIs<T> | IResponseBodyquerifier.IAssert<T> | IResponseBodyquerifier.IValidate<T>;
|
|
3
|
+
export declare namespace IResponseBodyquerifier {
|
|
4
|
+
interface IStringify<T> {
|
|
5
|
+
type: "stringify";
|
|
6
|
+
stringify: (input: T) => URLSearchParams;
|
|
7
|
+
}
|
|
8
|
+
interface IIs<T> {
|
|
9
|
+
type: "is";
|
|
10
|
+
is: (input: T) => URLSearchParams | null;
|
|
11
|
+
}
|
|
12
|
+
interface IAssert<T> {
|
|
13
|
+
type: "assert";
|
|
14
|
+
assert: (input: T) => URLSearchParams;
|
|
15
|
+
}
|
|
16
|
+
interface IValidate<T> {
|
|
17
|
+
type: "validate";
|
|
18
|
+
validate: (input: T) => IValidation<URLSearchParams>;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IResponseBodyQuerifier.js","sourceRoot":"","sources":["../../src/options/IResponseBodyQuerifier.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import { INestiaTransformProject } from "../options/INestiaTransformProject";
|
|
3
|
+
export declare namespace TypedQueryRouteProgrammer {
|
|
4
|
+
const generate: (project: INestiaTransformProject) => (modulo: ts.LeftHandSideExpression) => (type: ts.Type) => ts.Expression;
|
|
5
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.TypedQueryRouteProgrammer = void 0;
|
|
18
|
+
var typescript_1 = __importDefault(require("typescript"));
|
|
19
|
+
var HttpAssertQuerifyProgrammer_1 = require("./http/HttpAssertQuerifyProgrammer");
|
|
20
|
+
var HttpIsQuerifyProgrammer_1 = require("./http/HttpIsQuerifyProgrammer");
|
|
21
|
+
var HttpQuerifyProgrammer_1 = require("./http/HttpQuerifyProgrammer");
|
|
22
|
+
var HttpValidateQuerifyProgrammer_1 = require("./http/HttpValidateQuerifyProgrammer");
|
|
23
|
+
var TypedQueryRouteProgrammer;
|
|
24
|
+
(function (TypedQueryRouteProgrammer) {
|
|
25
|
+
TypedQueryRouteProgrammer.generate = function (project) {
|
|
26
|
+
return function (modulo) {
|
|
27
|
+
return function (type) {
|
|
28
|
+
// GENERATE STRINGIFY PLAN
|
|
29
|
+
var parameter = function (key, programmer) {
|
|
30
|
+
return typescript_1.default.factory.createObjectLiteralExpression([
|
|
31
|
+
typescript_1.default.factory.createPropertyAssignment(typescript_1.default.factory.createIdentifier("type"), typescript_1.default.factory.createStringLiteral(key)),
|
|
32
|
+
typescript_1.default.factory.createPropertyAssignment(typescript_1.default.factory.createIdentifier(key), programmer(__assign(__assign({}, project), { options: {} }))(modulo)(type)),
|
|
33
|
+
]);
|
|
34
|
+
};
|
|
35
|
+
// RETURNS
|
|
36
|
+
if (project.options.stringify === "is")
|
|
37
|
+
return parameter("is", HttpIsQuerifyProgrammer_1.HttpIsQuerifyProgrammer.write);
|
|
38
|
+
else if (project.options.stringify === "validate")
|
|
39
|
+
return parameter("validate", HttpValidateQuerifyProgrammer_1.HttpValidateQuerifyProgrammer.write);
|
|
40
|
+
else if (project.options.stringify === "stringify")
|
|
41
|
+
return parameter("stringify", HttpQuerifyProgrammer_1.HttpQuerifyProgrammer.write);
|
|
42
|
+
else if (project.options.stringify === null)
|
|
43
|
+
return typescript_1.default.factory.createNull();
|
|
44
|
+
// ASSERT IS DEFAULT
|
|
45
|
+
return parameter("assert", HttpAssertQuerifyProgrammer_1.HttpAssertQuerifyProgrammer.write);
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
})(TypedQueryRouteProgrammer || (exports.TypedQueryRouteProgrammer = TypedQueryRouteProgrammer = {}));
|
|
50
|
+
//# sourceMappingURL=TypedQueryRouteProgrammer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypedQueryRouteProgrammer.js","sourceRoot":"","sources":["../../src/programmers/TypedQueryRouteProgrammer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,0DAA4B;AAK5B,kFAAiF;AACjF,0EAAyE;AACzE,sEAAqE;AACrE,sFAAqF;AAErF,IAAiB,yBAAyB,CA4CzC;AA5CD,WAAiB,yBAAyB;IACzB,kCAAQ,GACjB,UAAC,OAAgC;QACjC,OAAA,UAAC,MAAiC;YAClC,OAAA,UAAC,IAAa;gBACV,0BAA0B;gBAC1B,IAAM,SAAS,GAAG,UACd,GAAW,EACX,UAIwC;oBAExC,OAAA,oBAAE,CAAC,OAAO,CAAC,6BAA6B,CAAC;wBACrC,oBAAE,CAAC,OAAO,CAAC,wBAAwB,CAC/B,oBAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,MAAM,CAAC,EACnC,oBAAE,CAAC,OAAO,CAAC,mBAAmB,CAAC,GAAG,CAAC,CACtC;wBACD,oBAAE,CAAC,OAAO,CAAC,wBAAwB,CAC/B,oBAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAChC,UAAU,uBACH,OAAO,KACV,OAAO,EAAE,EAAE,IACb,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CACnB;qBACJ,CAAC;gBAZF,CAYE,CAAC;gBAEP,UAAU;gBACV,IAAI,OAAO,CAAC,OAAO,CAAC,SAAS,KAAK,IAAI;oBAClC,OAAO,SAAS,CAAC,IAAI,EAAE,iDAAuB,CAAC,KAAK,CAAC,CAAC;qBACrD,IAAI,OAAO,CAAC,OAAO,CAAC,SAAS,KAAK,UAAU;oBAC7C,OAAO,SAAS,CACZ,UAAU,EACV,6DAA6B,CAAC,KAAK,CACtC,CAAC;qBACD,IAAI,OAAO,CAAC,OAAO,CAAC,SAAS,KAAK,WAAW;oBAC9C,OAAO,SAAS,CAAC,WAAW,EAAE,6CAAqB,CAAC,KAAK,CAAC,CAAC;qBAC1D,IAAI,OAAO,CAAC,OAAO,CAAC,SAAS,KAAK,IAAI;oBACvC,OAAO,oBAAE,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;gBAEnC,oBAAoB;gBACpB,OAAO,SAAS,CAAC,QAAQ,EAAE,yDAA2B,CAAC,KAAK,CAAC,CAAC;YAClE,CAAC;QAvCD,CAuCC;IAxCD,CAwCC,CAAC;AACV,CAAC,EA5CgB,yBAAyB,yCAAzB,yBAAyB,QA4CzC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import { IProject } from "typia/lib/transformers/IProject";
|
|
3
|
+
export declare namespace HttpAssertQuerifyProgrammer {
|
|
4
|
+
const write: (project: IProject) => (modulo: ts.LeftHandSideExpression) => (type: ts.Type, name?: string) => ts.ArrowFunction;
|
|
5
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.HttpAssertQuerifyProgrammer = void 0;
|
|
18
|
+
var typescript_1 = __importDefault(require("typescript"));
|
|
19
|
+
var IdentifierFactory_1 = require("typia/lib/factories/IdentifierFactory");
|
|
20
|
+
var StatementFactory_1 = require("typia/lib/factories/StatementFactory");
|
|
21
|
+
var AssertProgrammer_1 = require("typia/lib/programmers/AssertProgrammer");
|
|
22
|
+
var HttpQuerifyProgrammer_1 = require("./HttpQuerifyProgrammer");
|
|
23
|
+
var HttpAssertQuerifyProgrammer;
|
|
24
|
+
(function (HttpAssertQuerifyProgrammer) {
|
|
25
|
+
HttpAssertQuerifyProgrammer.write = function (project) {
|
|
26
|
+
return function (modulo) {
|
|
27
|
+
return function (type, name) {
|
|
28
|
+
return typescript_1.default.factory.createArrowFunction(undefined, undefined, [IdentifierFactory_1.IdentifierFactory.parameter("input")], undefined, undefined, typescript_1.default.factory.createBlock([
|
|
29
|
+
StatementFactory_1.StatementFactory.constant("assert", AssertProgrammer_1.AssertProgrammer.write(__assign(__assign({}, project), { options: __assign(__assign({}, project.options), { functional: false, numeric: false }) }))(modulo)(false)(type, name)),
|
|
30
|
+
StatementFactory_1.StatementFactory.constant("stringify", HttpQuerifyProgrammer_1.HttpQuerifyProgrammer.write(__assign(__assign({}, project), { options: __assign(__assign({}, project.options), { functional: false, numeric: false }) }))(modulo)(type)),
|
|
31
|
+
typescript_1.default.factory.createReturnStatement(typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier("stringify"), undefined, [
|
|
32
|
+
typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier("assert"), undefined, [typescript_1.default.factory.createIdentifier("input")]),
|
|
33
|
+
])),
|
|
34
|
+
]));
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
})(HttpAssertQuerifyProgrammer || (exports.HttpAssertQuerifyProgrammer = HttpAssertQuerifyProgrammer = {}));
|
|
39
|
+
//# sourceMappingURL=HttpAssertQuerifyProgrammer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpAssertQuerifyProgrammer.js","sourceRoot":"","sources":["../../../src/programmers/http/HttpAssertQuerifyProgrammer.ts"],"names":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,CACzC;qBACJ,CACJ,CACJ;iBACJ,CAAC,CACL;YA3CD,CA2CC;QA5CL,CA4CK;IA7CL,CA6CK,CAAC;AACd,CAAC,EAjDgB,2BAA2B,2CAA3B,2BAA2B,QAiD3C"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.HttpIsQuerifyProgrammer = void 0;
|
|
18
|
+
var typescript_1 = __importDefault(require("typescript"));
|
|
19
|
+
var IdentifierFactory_1 = require("typia/lib/factories/IdentifierFactory");
|
|
20
|
+
var StatementFactory_1 = require("typia/lib/factories/StatementFactory");
|
|
21
|
+
var IsProgrammer_1 = require("typia/lib/programmers/IsProgrammer");
|
|
22
|
+
var HttpQuerifyProgrammer_1 = require("./HttpQuerifyProgrammer");
|
|
23
|
+
var HttpIsQuerifyProgrammer;
|
|
24
|
+
(function (HttpIsQuerifyProgrammer) {
|
|
25
|
+
HttpIsQuerifyProgrammer.write = function (project) {
|
|
26
|
+
return function (modulo) {
|
|
27
|
+
return function (type) {
|
|
28
|
+
return typescript_1.default.factory.createArrowFunction(undefined, undefined, [IdentifierFactory_1.IdentifierFactory.parameter("input")], undefined, undefined, typescript_1.default.factory.createBlock([
|
|
29
|
+
StatementFactory_1.StatementFactory.constant("is", IsProgrammer_1.IsProgrammer.write(__assign(__assign({}, project), { options: __assign(__assign({}, project.options), { functional: false, numeric: false }) }))(modulo)(false)(type)),
|
|
30
|
+
StatementFactory_1.StatementFactory.constant("stringify", HttpQuerifyProgrammer_1.HttpQuerifyProgrammer.write(__assign(__assign({}, project), { options: __assign(__assign({}, project.options), { functional: false, numeric: false }) }))(modulo)(type)),
|
|
31
|
+
typescript_1.default.factory.createReturnStatement(typescript_1.default.factory.createConditionalExpression(typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier("is"), undefined, [typescript_1.default.factory.createIdentifier("input")]), undefined, typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier("stringify"), undefined, [typescript_1.default.factory.createIdentifier("input")]), undefined, typescript_1.default.factory.createNull())),
|
|
32
|
+
]));
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
})(HttpIsQuerifyProgrammer || (exports.HttpIsQuerifyProgrammer = HttpIsQuerifyProgrammer = {}));
|
|
37
|
+
//# sourceMappingURL=HttpIsQuerifyProgrammer.js.map
|