@deepkit/http 1.0.1-alpha.68 → 1.0.1-alpha.72
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/dist/cjs/src/decorator.d.ts +8 -6
- package/dist/cjs/src/decorator.js +49 -12
- package/dist/cjs/src/decorator.js.map +1 -1
- package/dist/cjs/src/filter.d.ts +3 -3
- package/dist/cjs/src/filter.js +3 -3
- package/dist/cjs/src/filter.js.map +1 -1
- package/dist/cjs/src/http.d.ts +49 -11
- package/dist/cjs/src/http.js +128 -37
- package/dist/cjs/src/http.js.map +1 -1
- package/dist/cjs/src/kernel.d.ts +3 -3
- package/dist/cjs/src/kernel.js +1 -1
- package/dist/cjs/src/kernel.js.map +1 -1
- package/dist/cjs/src/model.d.ts +11 -3
- package/dist/cjs/src/model.js +58 -26
- package/dist/cjs/src/model.js.map +1 -1
- package/dist/cjs/src/module.js +5 -3
- package/dist/cjs/src/module.js.map +1 -1
- package/dist/cjs/src/router.d.ts +84 -11
- package/dist/cjs/src/router.js +280 -94
- package/dist/cjs/src/router.js.map +1 -1
- package/dist/cjs/src/static-serving.js +15 -8
- package/dist/cjs/src/static-serving.js.map +1 -1
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/src/decorator.d.ts +8 -6
- package/dist/esm/src/decorator.js +47 -11
- package/dist/esm/src/decorator.js.map +1 -1
- package/dist/esm/src/filter.d.ts +3 -3
- package/dist/esm/src/filter.js +4 -4
- package/dist/esm/src/filter.js.map +1 -1
- package/dist/esm/src/http.d.ts +49 -11
- package/dist/esm/src/http.js +101 -23
- package/dist/esm/src/http.js.map +1 -1
- package/dist/esm/src/kernel.d.ts +3 -3
- package/dist/esm/src/kernel.js +2 -2
- package/dist/esm/src/kernel.js.map +1 -1
- package/dist/esm/src/model.d.ts +11 -3
- package/dist/esm/src/model.js +47 -15
- package/dist/esm/src/model.js.map +1 -1
- package/dist/esm/src/module.js +5 -3
- package/dist/esm/src/module.js.map +1 -1
- package/dist/esm/src/router.d.ts +84 -11
- package/dist/esm/src/router.js +278 -94
- package/dist/esm/src/router.js.map +1 -1
- package/dist/esm/src/static-serving.js +16 -9
- package/dist/esm/src/static-serving.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +17 -14
- package/src/decorator.ts +9 -6
- package/src/filter.ts +4 -4
- package/src/http.ts +88 -15
- package/src/kernel.ts +2 -2
- package/src/model.ts +35 -6
- package/src/module.ts +5 -3
- package/src/router.ts +286 -73
- package/src/static-serving.ts +6 -3
- package/coverage/clover.xml +0 -1086
- package/coverage/coverage-final.json +0 -12
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -79
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -126
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -170
- package/coverage/lcov-report/src/controllers.ts.html +0 -113
- package/coverage/lcov-report/src/decorator.ts.html +0 -1280
- package/coverage/lcov-report/src/filter.ts.html +0 -734
- package/coverage/lcov-report/src/http.ts.html +0 -2192
- package/coverage/lcov-report/src/index.html +0 -246
- package/coverage/lcov-report/src/kernel.ts.html +0 -260
- package/coverage/lcov-report/src/middleware.ts.html +0 -428
- package/coverage/lcov-report/src/model.ts.html +0 -937
- package/coverage/lcov-report/src/module.config.ts.html +0 -89
- package/coverage/lcov-report/src/module.ts.html +0 -245
- package/coverage/lcov-report/src/router.ts.html +0 -2318
- package/coverage/lcov-report/tests/index.html +0 -111
- package/coverage/lcov-report/tests/utils.ts.html +0 -176
- package/coverage/lcov.info +0 -2225
- package/dist/cjs/tests/filter.spec.d.ts +0 -1
- package/dist/cjs/tests/filter.spec.js +0 -251
- package/dist/cjs/tests/filter.spec.js.map +0 -1
- package/dist/cjs/tests/middleware.spec.d.ts +0 -1
- package/dist/cjs/tests/middleware.spec.js +0 -471
- package/dist/cjs/tests/middleware.spec.js.map +0 -1
- package/dist/cjs/tests/model.spec.d.ts +0 -1
- package/dist/cjs/tests/model.spec.js +0 -23
- package/dist/cjs/tests/model.spec.js.map +0 -1
- package/dist/cjs/tests/module.spec.d.ts +0 -1
- package/dist/cjs/tests/module.spec.js +0 -46
- package/dist/cjs/tests/module.spec.js.map +0 -1
- package/dist/cjs/tests/router.spec.d.ts +0 -1
- package/dist/cjs/tests/router.spec.js +0 -987
- package/dist/cjs/tests/router.spec.js.map +0 -1
- package/dist/cjs/tests/utils.d.ts +0 -8
- package/dist/cjs/tests/utils.js +0 -30
- package/dist/cjs/tests/utils.js.map +0 -1
- package/dist/esm/tests/filter.spec.d.ts +0 -1
- package/dist/esm/tests/filter.spec.js +0 -249
- package/dist/esm/tests/filter.spec.js.map +0 -1
- package/dist/esm/tests/middleware.spec.d.ts +0 -1
- package/dist/esm/tests/middleware.spec.js +0 -469
- package/dist/esm/tests/middleware.spec.js.map +0 -1
- package/dist/esm/tests/model.spec.d.ts +0 -1
- package/dist/esm/tests/model.spec.js +0 -21
- package/dist/esm/tests/model.spec.js.map +0 -1
- package/dist/esm/tests/module.spec.d.ts +0 -1
- package/dist/esm/tests/module.spec.js +0 -44
- package/dist/esm/tests/module.spec.js.map +0 -1
- package/dist/esm/tests/router.spec.d.ts +0 -1
- package/dist/esm/tests/router.spec.js +0 -985
- package/dist/esm/tests/router.spec.js.map +0 -1
- package/dist/esm/tests/utils.d.ts +0 -8
- package/dist/esm/tests/utils.js +0 -26
- package/dist/esm/tests/utils.js.map +0 -1
- package/tests/filter.spec.ts +0 -181
- package/tests/middleware.spec.ts +0 -440
- package/tests/model.spec.ts +0 -26
- package/tests/module.spec.ts +0 -32
- package/tests/router.spec.ts +0 -781
- package/tests/utils.ts +0 -32
package/dist/cjs/src/model.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Deepkit Framework
|
|
4
|
-
* Copyright (C) 2021 Deepkit UG, Marc J. Schmidt
|
|
5
|
-
*
|
|
6
|
-
* This program is free software: you can redistribute it and/or modify
|
|
7
|
-
* it under the terms of the MIT License.
|
|
8
|
-
*
|
|
9
|
-
* You should have received a copy of the MIT License along with this program.
|
|
10
|
-
*/
|
|
11
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
3
|
if (k2 === undefined) k2 = k;
|
|
13
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -33,11 +24,27 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
33
24
|
};
|
|
34
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
26
|
exports.MemoryHttpResponse = exports.HttpRequest = exports.RequestBuilder = exports.getRegExp = exports.__ΩHttpRegExp = exports.__ΩHttpQueries = exports.__ΩHttpQuery = exports.__ΩHttpBodyValidation = exports.__ΩHttpBody = exports.ValidatedBody = exports.BodyValidationError = exports.__ΩHttpRequestResolvedParameters = exports.__ΩHttpRequestQuery = exports.HttpResponse = void 0;
|
|
27
|
+
function __assignType(fn, args) {
|
|
28
|
+
fn.__type = args;
|
|
29
|
+
return fn;
|
|
30
|
+
}
|
|
31
|
+
const __ΩConcatArray = ['T', 'length', 'separator', 'join', 'start', 'end', 'slice', 'b!P\'4"9\'e"!LP&2#8&1$P\'2%8\'2&8e#!F1\'M'];
|
|
32
|
+
const __ΩReadonlyArray = ['T', 'length', 'toString', 'toLocaleString', () => __ΩConcatArray, 'items', 'concat', () => __ΩConcatArray, 'separator', 'join', 'start', 'end', 'slice', 'searchElement', 'fromIndex', 'indexOf', 'lastIndexOf', 'value', 'index', 'array', '', 'predicate', 'thisArg', 'every', 'some', 'callbackfn', 'forEach', 'map', 'filter', 'previousValue', 'currentValue', 'currentIndex', 'reduce', 'initialValue', 'reduceRight', 'b!P\'4"9P&1#P&1$Pe#!o%"@2&e#!F1\'PPe$!e$!o("J@2&e#!F1\'P&2)8&1*P\'2+8\'2,8e#!F1-Pe#!2.\'2/8\'10Pe#!2.\'2/8\'11PPe$!22\'2324!/526"278!18PPe$!22\'2324#/526"278)18PPe$!22\'2324#/526"278)19PPe$!22\'2324$/52:"278$1;PPe$!22\'2324"/52:"278"F1<PPe$!22\'2324!/526"278"F1=PPe$!22\'2324#/526"278e#!F1=PPe$!2>e$!2?\'2@24e$!/52:e#!1APPe$!2>e$!2?\'2@24e$!/52:e#!2Be#!1APP"2>e$!2?\'2@24"/52:"2B"1APPe$!2>e$!2?\'2@24e$!/52:e#!1CPPe$!2>e$!2?\'2@24e$!/52:e#!2Be#!1CPP"2>e$!2?\'2@24"/52:"2B"1C\'e"!LM'];
|
|
33
|
+
/*
|
|
34
|
+
* Deepkit Framework
|
|
35
|
+
* Copyright (C) 2021 Deepkit UG, Marc J. Schmidt
|
|
36
|
+
*
|
|
37
|
+
* This program is free software: you can redistribute it and/or modify
|
|
38
|
+
* it under the terms of the MIT License.
|
|
39
|
+
*
|
|
40
|
+
* You should have received a copy of the MIT License along with this program.
|
|
41
|
+
*/
|
|
36
42
|
const http_1 = require("http");
|
|
37
43
|
const router_1 = require("./router");
|
|
38
44
|
const querystring = __importStar(require("querystring"));
|
|
39
45
|
const stream_1 = require("stream");
|
|
40
46
|
const type_1 = require("@deepkit/type");
|
|
47
|
+
const core_1 = require("@deepkit/core");
|
|
41
48
|
class HttpResponse extends http_1.ServerResponse {
|
|
42
49
|
status(code) {
|
|
43
50
|
this.writeHead(code);
|
|
@@ -45,7 +52,7 @@ class HttpResponse extends http_1.ServerResponse {
|
|
|
45
52
|
}
|
|
46
53
|
}
|
|
47
54
|
exports.HttpResponse = HttpResponse;
|
|
48
|
-
HttpResponse.__type = ['code', 'status', 'P\'2!"0"5'];
|
|
55
|
+
HttpResponse.__type = ['code', 'status', '!P\'2!"0"5'];
|
|
49
56
|
const __ΩHttpRequestQuery = ['P&&LM'];
|
|
50
57
|
exports.__ΩHttpRequestQuery = __ΩHttpRequestQuery;
|
|
51
58
|
const __ΩHttpRequestResolvedParameters = ['P&"LM'];
|
|
@@ -59,14 +66,14 @@ class BodyValidationError {
|
|
|
59
66
|
}
|
|
60
67
|
getErrors(prefix) {
|
|
61
68
|
if (prefix)
|
|
62
|
-
return this.errors.filter(
|
|
69
|
+
return this.errors.filter(__assignType(v => v.path.startsWith(prefix), ['v', '', 'P"2!"/"']));
|
|
63
70
|
return this.errors;
|
|
64
71
|
}
|
|
65
72
|
getErrorsForPath(path) {
|
|
66
|
-
return this.errors.filter(
|
|
73
|
+
return this.errors.filter(__assignType(v => v.path === path, ['v', '', 'P"2!"/"']));
|
|
67
74
|
}
|
|
68
75
|
getErrorMessageForPath(path) {
|
|
69
|
-
return this.getErrorsForPath(path).map(
|
|
76
|
+
return this.getErrorsForPath(path).map(__assignType(v => v.message, ['v', '', 'P"2!"/"'])).join(', ');
|
|
70
77
|
}
|
|
71
78
|
}
|
|
72
79
|
exports.BodyValidationError = BodyValidationError;
|
|
@@ -96,12 +103,14 @@ function getRegExp(type) {
|
|
|
96
103
|
const options = type_1.metaAnnotation.getForName(type, 'httpRegExp');
|
|
97
104
|
if (!options || !options[0])
|
|
98
105
|
return;
|
|
99
|
-
if (options[0].kind
|
|
100
|
-
return;
|
|
101
|
-
|
|
106
|
+
if (options[0].kind === type_1.ReflectionKind.literal && 'string' === typeof options[0].literal)
|
|
107
|
+
return options[0].literal;
|
|
108
|
+
if (options[0].kind === type_1.ReflectionKind.literal && options[0].literal instanceof RegExp)
|
|
109
|
+
return options[0].literal;
|
|
110
|
+
return;
|
|
102
111
|
}
|
|
103
112
|
exports.getRegExp = getRegExp;
|
|
104
|
-
getRegExp.__type = ['type', 'getRegExp', 'P"2!P
|
|
113
|
+
getRegExp.__type = ['type', 'getRegExp', 'P"2!P&A-J/"'];
|
|
105
114
|
class RequestBuilder {
|
|
106
115
|
constructor(path, method = 'GET') {
|
|
107
116
|
this.path = path;
|
|
@@ -122,12 +131,12 @@ class RequestBuilder {
|
|
|
122
131
|
const url = this.getUrl();
|
|
123
132
|
const bodyContent = this.contentBuffer;
|
|
124
133
|
const writable = new stream_1.Writable({
|
|
125
|
-
write:
|
|
134
|
+
write: __assignType(function write(chunk, encoding, callback) {
|
|
126
135
|
-callback();
|
|
127
|
-
},
|
|
128
|
-
writev:
|
|
136
|
+
}, ['chunk', 'encoding', 'callback', 'write', 'P"2!"2""2#"/$']),
|
|
137
|
+
writev: __assignType(function writev(chunks, callback) {
|
|
129
138
|
callback();
|
|
130
|
-
},
|
|
139
|
+
}, ['chunks', 'callback', 'writev', 'P"2!"2""/#'])
|
|
131
140
|
});
|
|
132
141
|
const request = new (_a = class extends HttpRequest {
|
|
133
142
|
constructor() {
|
|
@@ -148,7 +157,7 @@ class RequestBuilder {
|
|
|
148
157
|
}
|
|
149
158
|
}
|
|
150
159
|
},
|
|
151
|
-
_a.__type = ['size', '_read', 'P\'2
|
|
160
|
+
_a.__type = [() => HttpRequest, 'size', '_read', 'P7!P\'2""0#5'],
|
|
152
161
|
_a)(writable);
|
|
153
162
|
return request;
|
|
154
163
|
}
|
|
@@ -182,7 +191,7 @@ class RequestBuilder {
|
|
|
182
191
|
}
|
|
183
192
|
}
|
|
184
193
|
exports.RequestBuilder = RequestBuilder;
|
|
185
|
-
RequestBuilder.__type = [
|
|
194
|
+
RequestBuilder.__type = ['contentBuffer', function () { return Buffer.alloc(0); }, '_headers', function () { return {}; }, 'queryPath', 'path', 'method', () => "GET", 'constructor', 'getUrl', () => HttpRequest, 'build', 'headers', 'name', 'value', 'header', 'body', 'json', 'query', '!3!<>"P&&LM3#<>$&3%8<P&2&<&2\'<>("0)P"0*PP7+0,PP&&LM2-!0-P&2.P&\'J2/!00P%21!02PP&!J21!01P"23!035'];
|
|
186
195
|
class HttpRequest extends http_1.IncomingMessage {
|
|
187
196
|
constructor() {
|
|
188
197
|
super(...arguments);
|
|
@@ -227,11 +236,35 @@ class HttpRequest extends http_1.IncomingMessage {
|
|
|
227
236
|
}
|
|
228
237
|
}
|
|
229
238
|
exports.HttpRequest = HttpRequest;
|
|
230
|
-
HttpRequest.__type = ['store', function () { return {}; }, () => router_1.UploadedFile, 'uploadedFiles', function () { return {}; }, 'body', 'path', () => RequestBuilder, 'GET', () => RequestBuilder, 'POST', () => RequestBuilder, 'OPTIONS', () => RequestBuilder, 'TRACE', () => RequestBuilder, 'HEAD', () => RequestBuilder, 'PATCH', () => RequestBuilder, 'PUT', () => RequestBuilder, 'DELETE', 'getUrl', 'getMethod', 'getRemoteAddress', 'P&"LM3!>"P&P7#LM3$>%P&"LM3&8P&2\'P7(0)P&2\'P7*0+P&2\'P7,0-P&2\'P7.0/P&2\'P7001P&2\'P7203P&2\'P7405P&2\'P7607P&08P&09P&0:5'];
|
|
239
|
+
HttpRequest.__type = ['store', function () { return {}; }, () => router_1.UploadedFile, 'uploadedFiles', function () { return {}; }, 'body', 'path', () => RequestBuilder, 'GET', () => RequestBuilder, 'POST', () => RequestBuilder, 'OPTIONS', () => RequestBuilder, 'TRACE', () => RequestBuilder, 'HEAD', () => RequestBuilder, 'PATCH', () => RequestBuilder, 'PUT', () => RequestBuilder, 'DELETE', 'getUrl', 'getMethod', 'getRemoteAddress', '!P&"LM3!>"P&P7#LM3$>%P&"LM3&8P&2\'P7(0)P&2\'P7*0+P&2\'P7,0-P&2\'P7.0/P&2\'P7001P&2\'P7203P&2\'P7405P&2\'P7607P&08P&09P&0:5'];
|
|
231
240
|
class MemoryHttpResponse extends HttpResponse {
|
|
232
241
|
constructor() {
|
|
233
242
|
super(...arguments);
|
|
234
243
|
this.body = Buffer.alloc(0);
|
|
244
|
+
this.headers = Object.create(null);
|
|
245
|
+
}
|
|
246
|
+
setHeader(name, value) {
|
|
247
|
+
this.headers[name] = value;
|
|
248
|
+
super.setHeader(name, value);
|
|
249
|
+
return this;
|
|
250
|
+
}
|
|
251
|
+
removeHeader(name) {
|
|
252
|
+
delete this.headers[name];
|
|
253
|
+
super.removeHeader(name);
|
|
254
|
+
}
|
|
255
|
+
getHeader(name) {
|
|
256
|
+
return this.headers[name];
|
|
257
|
+
}
|
|
258
|
+
getHeaders() {
|
|
259
|
+
return this.headers;
|
|
260
|
+
}
|
|
261
|
+
writeHead(statusCode, headersOrReasonPhrase, headers) {
|
|
262
|
+
headers = typeof headersOrReasonPhrase === 'string' ? headers : headersOrReasonPhrase;
|
|
263
|
+
if (headers && !(0, core_1.isArray)(headers))
|
|
264
|
+
this.headers = headers;
|
|
265
|
+
if (typeof headersOrReasonPhrase === 'string')
|
|
266
|
+
return super.writeHead(statusCode, headersOrReasonPhrase, headers);
|
|
267
|
+
return super.writeHead(statusCode, headers);
|
|
235
268
|
}
|
|
236
269
|
get json() {
|
|
237
270
|
const json = this.bodyString;
|
|
@@ -277,9 +310,8 @@ class MemoryHttpResponse extends HttpResponse {
|
|
|
277
310
|
this.body = Buffer.concat([this.body, chunk]);
|
|
278
311
|
}
|
|
279
312
|
return super.end(chunk, encoding, callback);
|
|
280
|
-
// if (callback) callback();
|
|
281
313
|
}
|
|
282
314
|
}
|
|
283
315
|
exports.MemoryHttpResponse = MemoryHttpResponse;
|
|
284
|
-
MemoryHttpResponse.__type = [() =>
|
|
316
|
+
MemoryHttpResponse.__type = [() => HttpResponse, 'body', function () { return Buffer.alloc(0); }, 'headers', function () { return Object.create(null); }, 'name', () => __ΩReadonlyArray, 'value', 'setHeader', 'removeHeader', 'getHeader', 'getHeaders', 'statusCode', 'headersOrReasonPhrase', 'writeHead', 'chunk', 'encoding', 'callback', 'write', 'end', 'P7!!3">#P&P\'&&F-JLM3$>%P&2&P\'&&o\'"J2(!0)P&2&"0*P&2&"0+P!0,P\'2-P&!!FJ2.8P!!FJ2$8!0/!!P"20"21"228"03P"20"218"228"045'];
|
|
285
317
|
//# sourceMappingURL=model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/model.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,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dist/cjs/src/module.js
CHANGED
|
@@ -16,9 +16,10 @@ const decorator_1 = require("./decorator");
|
|
|
16
16
|
class HttpModule extends (0, app_1.createModule)({
|
|
17
17
|
config: module_config_1.HttpConfig,
|
|
18
18
|
providers: [
|
|
19
|
-
router_1.
|
|
19
|
+
router_1.HttpRouter,
|
|
20
20
|
kernel_1.HttpKernel,
|
|
21
21
|
http_1.HttpResultFormatter,
|
|
22
|
+
router_1.HttpRouterRegistry,
|
|
22
23
|
filter_1.HttpRouterFilterResolver,
|
|
23
24
|
{ provide: model_1.HttpResponse, scope: 'http' },
|
|
24
25
|
{ provide: model_1.HttpRequest, scope: 'http' },
|
|
@@ -31,7 +32,8 @@ class HttpModule extends (0, app_1.createModule)({
|
|
|
31
32
|
http_1.httpWorkflow
|
|
32
33
|
],
|
|
33
34
|
exports: [
|
|
34
|
-
router_1.
|
|
35
|
+
router_1.HttpRouter,
|
|
36
|
+
router_1.HttpRouterRegistry,
|
|
35
37
|
kernel_1.HttpKernel,
|
|
36
38
|
http_1.HttpResultFormatter,
|
|
37
39
|
filter_1.HttpRouterFilterResolver,
|
|
@@ -58,5 +60,5 @@ class HttpModule extends (0, app_1.createModule)({
|
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
62
|
exports.HttpModule = HttpModule;
|
|
61
|
-
HttpModule.__type = ['process', () => app_1.AppModule, 'module', () => __ΩClassType, 'controller', 'processController', 'P"0!PP"7"2#n$2%"0&5'];
|
|
63
|
+
HttpModule.__type = ['process', () => app_1.AppModule, 'module', () => __ΩClassType, 'controller', 'processController', '"P"0!PP"7"2#n$2%"0&5'];
|
|
62
64
|
//# sourceMappingURL=module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../src/module.ts"],"names":[],"mappings":";;;iCAU0B,eAAe;AAVzC,iCAAyE;AACzE,mDAA6C;AAC7C,sCAAuD;AACvD,
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","s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W,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;QAC/F,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACjD,CAAC;;AA1CL,gCA2CC"}
|
package/dist/cjs/src/router.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ClassType, CompilerContext } from '@deepkit/core';
|
|
2
|
-
import { ReflectionParameter, SerializationOptions, Serializer, Type } from '@deepkit/type';
|
|
2
|
+
import { ReflectionFunction, ReflectionParameter, SerializationOptions, Serializer, Type } from '@deepkit/type';
|
|
3
|
+
import { HttpDecorator } from './decorator';
|
|
3
4
|
import { HttpRequest, HttpRequestQuery, HttpRequestResolvedParameters } from './model';
|
|
4
5
|
import { InjectorContext, InjectorModule, TagRegistry } from '@deepkit/injector';
|
|
5
6
|
import { LoggerInterface } from '@deepkit/logger';
|
|
@@ -24,7 +25,7 @@ export declare class UploadedFile {
|
|
|
24
25
|
*/
|
|
25
26
|
size: number;
|
|
26
27
|
/**
|
|
27
|
-
* The path this file is being written to.
|
|
28
|
+
* The local path this file is being written to. Will be deleted when request is handled.
|
|
28
29
|
*/
|
|
29
30
|
path: string;
|
|
30
31
|
/**
|
|
@@ -41,7 +42,13 @@ export declare class UploadedFile {
|
|
|
41
42
|
*/
|
|
42
43
|
lastModifiedDate: Date | null;
|
|
43
44
|
}
|
|
44
|
-
export interface
|
|
45
|
+
export interface RouteFunctionControllerAction {
|
|
46
|
+
type: 'function';
|
|
47
|
+
module?: InjectorModule<any>;
|
|
48
|
+
fn: (...args: any[]) => any;
|
|
49
|
+
}
|
|
50
|
+
export interface RouteClassControllerAction {
|
|
51
|
+
type: 'controller';
|
|
45
52
|
module?: InjectorModule<any>;
|
|
46
53
|
controller: ClassType;
|
|
47
54
|
methodName: string;
|
|
@@ -50,7 +57,7 @@ export declare class RouteConfig {
|
|
|
50
57
|
readonly name: string;
|
|
51
58
|
readonly httpMethods: string[];
|
|
52
59
|
readonly path: string;
|
|
53
|
-
readonly action:
|
|
60
|
+
readonly action: RouteClassControllerAction | RouteFunctionControllerAction;
|
|
54
61
|
internal: boolean;
|
|
55
62
|
baseUrl: string;
|
|
56
63
|
responses: {
|
|
@@ -71,14 +78,15 @@ export declare class RouteConfig {
|
|
|
71
78
|
resolverForToken: Map<any, ClassType>;
|
|
72
79
|
middlewares: {
|
|
73
80
|
config: HttpMiddlewareConfig;
|
|
74
|
-
module
|
|
81
|
+
module?: InjectorModule<any>;
|
|
75
82
|
}[];
|
|
76
83
|
resolverForParameterName: Map<string, ClassType>;
|
|
77
84
|
/**
|
|
78
85
|
* An arbitrary data container the user can use to store app specific settings/values.
|
|
79
86
|
*/
|
|
80
87
|
data: Map<any, any>;
|
|
81
|
-
constructor(name: string, httpMethods: string[], path: string, action:
|
|
88
|
+
constructor(name: string, httpMethods: string[], path: string, action: RouteClassControllerAction | RouteFunctionControllerAction, internal?: boolean);
|
|
89
|
+
getReflectionFunction(): ReflectionFunction;
|
|
82
90
|
getSchemaForResponse(statusCode: number): Type | undefined;
|
|
83
91
|
getFullPath(): string;
|
|
84
92
|
}
|
|
@@ -128,21 +136,84 @@ export interface RouteParameterResolverContext {
|
|
|
128
136
|
query: HttpRequestQuery;
|
|
129
137
|
parameters: HttpRequestResolvedParameters;
|
|
130
138
|
}
|
|
131
|
-
export
|
|
139
|
+
export interface HttpRouterFunctionOptions {
|
|
140
|
+
path: string;
|
|
141
|
+
name?: string;
|
|
142
|
+
methods?: string[];
|
|
143
|
+
description?: string;
|
|
144
|
+
category?: string;
|
|
145
|
+
groups?: string[];
|
|
146
|
+
/**
|
|
147
|
+
* An arbitrary data container the user can use to store app specific settings/values.
|
|
148
|
+
*/
|
|
149
|
+
data?: Record<any, any>;
|
|
150
|
+
baseUrl?: string;
|
|
151
|
+
middlewares?: (() => HttpMiddlewareConfig)[];
|
|
152
|
+
serializer?: Serializer;
|
|
153
|
+
serializationOptions?: SerializationOptions;
|
|
154
|
+
resolverForToken?: Map<any, ClassType>;
|
|
155
|
+
resolverForParameterName?: Map<string, ClassType>;
|
|
156
|
+
responses?: {
|
|
157
|
+
statusCode: number;
|
|
158
|
+
description: string;
|
|
159
|
+
type?: Type;
|
|
160
|
+
}[];
|
|
161
|
+
}
|
|
162
|
+
export declare abstract class HttpRouterRegistryFunctionRegistrar {
|
|
163
|
+
protected defaultOptions: Partial<HttpRouterFunctionOptions>;
|
|
164
|
+
abstract addRoute(routeConfig: RouteConfig): void;
|
|
165
|
+
/**
|
|
166
|
+
* Returns a new registrar object with default options that apply to each registered route through this registrar.
|
|
167
|
+
*
|
|
168
|
+
* ```typescript
|
|
169
|
+
* const registry: HttpRouterRegistry = ...;
|
|
170
|
+
*
|
|
171
|
+
* const secretRegistry = registry.forOptions({groups: ['secret']});
|
|
172
|
+
*
|
|
173
|
+
* secretRegistry.get('/admin/groups', () => {
|
|
174
|
+
* });
|
|
175
|
+
*
|
|
176
|
+
* secretRegistry.get('/admin/users', () => {
|
|
177
|
+
* });
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
forOptions(options: Partial<HttpRouterFunctionOptions>): HttpRouterRegistryFunctionRegistrar;
|
|
181
|
+
any(pathOrOptions: string | HttpRouterFunctionOptions, callback: (...args: any[]) => any): void;
|
|
182
|
+
add(decorator: HttpDecorator, callback: (...args: any[]) => any): void;
|
|
183
|
+
get(pathOrOptions: string | HttpRouterFunctionOptions, callback: (...args: any[]) => any): void;
|
|
184
|
+
post(pathOrOptions: string | HttpRouterFunctionOptions, callback: (...args: any[]) => any): void;
|
|
185
|
+
put(pathOrOptions: string | HttpRouterFunctionOptions, callback: (...args: any[]) => any): void;
|
|
186
|
+
patch(pathOrOptions: string | HttpRouterFunctionOptions, callback: (...args: any[]) => any): void;
|
|
187
|
+
delete(pathOrOptions: string | HttpRouterFunctionOptions, callback: (...args: any[]) => any): void;
|
|
188
|
+
options(pathOrOptions: string | HttpRouterFunctionOptions, callback: (...args: any[]) => any): void;
|
|
189
|
+
trace(pathOrOptions: string | HttpRouterFunctionOptions, callback: (...args: any[]) => any): void;
|
|
190
|
+
head(pathOrOptions: string | HttpRouterFunctionOptions, callback: (...args: any[]) => any): void;
|
|
191
|
+
private register;
|
|
192
|
+
}
|
|
193
|
+
export declare class HttpRouterRegistry extends HttpRouterRegistryFunctionRegistrar {
|
|
194
|
+
protected routes: RouteConfig[];
|
|
195
|
+
private buildId;
|
|
196
|
+
getBuildId(): number;
|
|
197
|
+
getRoutes(): RouteConfig[];
|
|
198
|
+
addRouteForController(controller: ClassType, module: InjectorModule<any>): void;
|
|
199
|
+
addRoute(routeConfig: RouteConfig): void;
|
|
200
|
+
}
|
|
201
|
+
export declare class HttpRouter {
|
|
132
202
|
private logger;
|
|
133
203
|
private middlewareRegistry;
|
|
204
|
+
private registry;
|
|
134
205
|
protected fn?: (request: HttpRequest) => ResolvedController | undefined;
|
|
206
|
+
protected buildId: number;
|
|
135
207
|
protected resolveFn?: (name: string, parameters: {
|
|
136
208
|
[name: string]: any;
|
|
137
209
|
}) => string;
|
|
138
|
-
protected routes: RouteConfig[];
|
|
139
210
|
private parseBody;
|
|
140
|
-
constructor(controllers: HttpControllers, logger: LoggerInterface, tagRegistry: TagRegistry, middlewareRegistry?: MiddlewareRegistry);
|
|
211
|
+
constructor(controllers: HttpControllers, logger: LoggerInterface, tagRegistry: TagRegistry, middlewareRegistry?: MiddlewareRegistry, registry?: HttpRouterRegistry);
|
|
141
212
|
getRoutes(): RouteConfig[];
|
|
142
213
|
static forControllers(controllers: (ClassType | {
|
|
143
214
|
module: InjectorModule<any>;
|
|
144
215
|
controller: ClassType;
|
|
145
|
-
})[], tagRegistry?: TagRegistry, middlewareRegistry?: MiddlewareRegistry, module?: InjectorModule<any>):
|
|
216
|
+
})[], tagRegistry?: TagRegistry, middlewareRegistry?: MiddlewareRegistry, module?: InjectorModule<any>): HttpRouter;
|
|
146
217
|
protected getRouteCode(compiler: CompilerContext, routeConfig: RouteConfig): string;
|
|
147
218
|
protected getRouteUrlResolveCode(compiler: CompilerContext, routeConfig: RouteConfig): string;
|
|
148
219
|
addRoute(routeConfig: RouteConfig): void;
|
|
@@ -157,6 +228,8 @@ export declare class Router {
|
|
|
157
228
|
}
|
|
158
229
|
export {};
|
|
159
230
|
export declare type __ΩRouteParameterResolverForInjector = any[];
|
|
160
|
-
export declare type __Ω
|
|
231
|
+
export declare type __ΩRouteFunctionControllerAction = any[];
|
|
232
|
+
export declare type __ΩRouteClassControllerAction = any[];
|
|
161
233
|
export declare type __ΩRouteParameterResolver = any[];
|
|
162
234
|
export declare type __ΩRouteParameterResolverContext = any[];
|
|
235
|
+
export declare type __ΩHttpRouterFunctionOptions = any[];
|