@deepkit/http 1.0.1-alpha.59 → 1.0.1-alpha.63
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/coverage/clover.xml +1086 -0
- package/coverage/coverage-final.json +12 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +79 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +126 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +170 -0
- package/coverage/lcov-report/src/controllers.ts.html +113 -0
- package/coverage/lcov-report/src/decorator.ts.html +1280 -0
- package/coverage/lcov-report/src/filter.ts.html +734 -0
- package/coverage/lcov-report/src/http.ts.html +2192 -0
- package/coverage/lcov-report/src/index.html +246 -0
- package/coverage/lcov-report/src/kernel.ts.html +260 -0
- package/coverage/lcov-report/src/middleware.ts.html +428 -0
- package/coverage/lcov-report/src/model.ts.html +937 -0
- package/coverage/lcov-report/src/module.config.ts.html +89 -0
- package/coverage/lcov-report/src/module.ts.html +245 -0
- package/coverage/lcov-report/src/router.ts.html +2318 -0
- package/coverage/lcov-report/tests/index.html +111 -0
- package/coverage/lcov-report/tests/utils.ts.html +176 -0
- package/coverage/lcov.info +2225 -0
- package/dist/cjs/index.js +5 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/src/controllers.d.ts +4 -4
- package/dist/cjs/src/controllers.js +3 -0
- package/dist/cjs/src/controllers.js.map +1 -1
- package/dist/cjs/src/decorator.d.ts +29 -94
- package/dist/cjs/src/decorator.js +53 -118
- package/dist/cjs/src/decorator.js.map +1 -1
- package/dist/cjs/src/filter.d.ts +1 -0
- package/dist/cjs/src/filter.js +11 -17
- package/dist/cjs/src/filter.js.map +1 -1
- package/dist/cjs/src/http.d.ts +5 -3
- package/dist/cjs/src/http.js +91 -55
- package/dist/cjs/src/http.js.map +1 -1
- package/dist/cjs/src/kernel.d.ts +3 -3
- package/dist/cjs/src/kernel.js +5 -25
- package/dist/cjs/src/kernel.js.map +1 -1
- package/dist/cjs/src/logger.d.ts +2 -2
- package/dist/cjs/src/logger.js +4 -8
- package/dist/cjs/src/logger.js.map +1 -1
- package/dist/cjs/src/middleware.d.ts +5 -1
- package/dist/cjs/src/middleware.js +15 -3
- package/dist/cjs/src/middleware.js.map +1 -1
- package/dist/cjs/src/model.d.ts +62 -2
- package/dist/cjs/src/model.js +101 -26
- package/dist/cjs/src/model.js.map +1 -1
- package/dist/cjs/src/module.config.d.ts +3 -4
- package/dist/cjs/src/module.config.js +8 -6
- package/dist/cjs/src/module.config.js.map +1 -1
- package/dist/cjs/src/module.d.ts +2 -3
- package/dist/cjs/src/module.js +4 -2
- package/dist/cjs/src/module.js.map +1 -1
- package/dist/cjs/src/router.d.ts +24 -53
- package/dist/cjs/src/router.js +140 -159
- package/dist/cjs/src/router.js.map +1 -1
- package/dist/cjs/src/static-serving.d.ts +1 -0
- package/dist/cjs/src/static-serving.js +46 -39
- package/dist/cjs/src/static-serving.js.map +1 -1
- package/dist/cjs/src/utils.js +1 -0
- package/dist/cjs/tests/filter.spec.js +61 -47
- package/dist/cjs/tests/filter.spec.js.map +1 -1
- package/dist/cjs/tests/middleware.spec.d.ts +1 -1
- package/dist/cjs/tests/middleware.spec.js +157 -145
- package/dist/cjs/tests/middleware.spec.js.map +1 -1
- package/dist/cjs/tests/model.spec.js +4 -4
- package/dist/cjs/tests/model.spec.js.map +1 -1
- package/dist/cjs/tests/module.spec.js +4 -3
- package/dist/cjs/tests/module.spec.js.map +1 -1
- package/dist/cjs/tests/router.spec.d.ts +1 -1
- package/dist/cjs/tests/router.spec.js +298 -333
- package/dist/cjs/tests/router.spec.js.map +1 -1
- package/dist/cjs/tests/utils.js +5 -2
- package/dist/cjs/tests/utils.js.map +1 -1
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/src/controllers.d.ts +4 -4
- package/dist/esm/src/controllers.js +3 -0
- package/dist/esm/src/controllers.js.map +1 -1
- package/dist/esm/src/decorator.d.ts +29 -94
- package/dist/esm/src/decorator.js +49 -114
- package/dist/esm/src/decorator.js.map +1 -1
- package/dist/esm/src/filter.d.ts +1 -0
- package/dist/esm/src/filter.js +11 -18
- package/dist/esm/src/filter.js.map +1 -1
- package/dist/esm/src/http.d.ts +5 -3
- package/dist/esm/src/http.js +89 -55
- package/dist/esm/src/http.js.map +1 -1
- package/dist/esm/src/kernel.d.ts +3 -3
- package/dist/esm/src/kernel.js +6 -27
- package/dist/esm/src/kernel.js.map +1 -1
- package/dist/esm/src/logger.d.ts +2 -2
- package/dist/esm/src/logger.js +4 -9
- package/dist/esm/src/logger.js.map +1 -1
- package/dist/esm/src/middleware.d.ts +5 -1
- package/dist/esm/src/middleware.js +12 -0
- package/dist/esm/src/middleware.js.map +1 -1
- package/dist/esm/src/model.d.ts +62 -2
- package/dist/esm/src/model.js +92 -24
- package/dist/esm/src/model.js.map +1 -1
- package/dist/esm/src/module.config.d.ts +3 -4
- package/dist/esm/src/module.config.js +6 -5
- package/dist/esm/src/module.config.js.map +1 -1
- package/dist/esm/src/module.d.ts +2 -3
- package/dist/esm/src/module.js +5 -3
- package/dist/esm/src/module.js.map +1 -1
- package/dist/esm/src/router.d.ts +24 -53
- package/dist/esm/src/router.js +136 -155
- package/dist/esm/src/router.js.map +1 -1
- package/dist/esm/src/static-serving.d.ts +1 -0
- package/dist/esm/src/static-serving.js +39 -32
- package/dist/esm/src/static-serving.js.map +1 -1
- package/dist/esm/src/utils.js +1 -0
- package/dist/esm/tests/filter.spec.js +14 -0
- package/dist/esm/tests/filter.spec.js.map +1 -1
- package/dist/esm/tests/middleware.spec.d.ts +1 -1
- package/dist/esm/tests/middleware.spec.js +60 -48
- package/dist/esm/tests/middleware.spec.js.map +1 -1
- package/dist/esm/tests/module.spec.js +1 -0
- package/dist/esm/tests/module.spec.js.map +1 -1
- package/dist/esm/tests/router.spec.d.ts +1 -1
- package/dist/esm/tests/router.spec.js +167 -202
- package/dist/esm/tests/router.spec.js.map +1 -1
- package/dist/esm/tests/utils.js +4 -1
- package/dist/esm/tests/utils.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +14 -15
- package/src/controllers.ts +3 -3
- package/src/decorator.ts +42 -131
- package/src/filter.ts +0 -2
- package/src/http.ts +35 -36
- package/src/kernel.ts +4 -5
- package/src/logger.ts +2 -4
- package/src/middleware.ts +2 -1
- package/src/model.ts +80 -8
- package/src/module.config.ts +3 -6
- package/src/module.ts +2 -2
- package/src/router.ts +121 -161
- package/src/static-serving.ts +14 -12
- package/tests/middleware.spec.ts +0 -1
- package/tests/router.spec.ts +131 -133
- package/tsconfig.json +2 -1
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { ClassType } from '@deepkit/core';
|
|
2
|
-
import { ClassDecoratorResult,
|
|
2
|
+
import { ClassDecoratorResult, DecoratorAndFetchSignature, DualDecorator, ExtractApiDataType, ExtractClass, PropertyDecoratorFn, ReceiveType, SerializationOptions, Serializer, Type, UnionToIntersection } from '@deepkit/type';
|
|
3
3
|
import { RouteParameterResolver } from './router';
|
|
4
4
|
import { HttpMiddleware, HttpMiddlewareConfig, HttpMiddlewareFn } from './middleware';
|
|
5
|
-
export interface ControllerOptions {
|
|
6
|
-
name: string;
|
|
7
|
-
}
|
|
8
5
|
declare type HttpActionMiddleware = (() => HttpMiddlewareConfig) | ClassType<HttpMiddleware> | HttpMiddlewareFn;
|
|
9
6
|
declare class HttpController {
|
|
10
7
|
baseUrl: string;
|
|
@@ -38,18 +35,9 @@ export declare class HttpAction {
|
|
|
38
35
|
groups: string[];
|
|
39
36
|
serializer?: Serializer;
|
|
40
37
|
middlewares: (() => HttpMiddlewareConfig)[];
|
|
41
|
-
serializationOptions?:
|
|
42
|
-
parameterRegularExpressions: {
|
|
43
|
-
[name: string]: any;
|
|
44
|
-
};
|
|
38
|
+
serializationOptions?: SerializationOptions;
|
|
45
39
|
resolverForToken: Map<any, ClassType>;
|
|
46
40
|
resolverForParameterName: Map<string, ClassType>;
|
|
47
|
-
/**
|
|
48
|
-
* This is only filled when the user used @http.body() for example on an method argument.
|
|
49
|
-
*/
|
|
50
|
-
parameters: {
|
|
51
|
-
[name: string]: HttpActionParameter;
|
|
52
|
-
};
|
|
53
41
|
/**
|
|
54
42
|
* An arbitrary data container the user can use to store app specific settings/values.
|
|
55
43
|
*/
|
|
@@ -57,7 +45,7 @@ export declare class HttpAction {
|
|
|
57
45
|
responses: {
|
|
58
46
|
statusCode: number;
|
|
59
47
|
description: string;
|
|
60
|
-
type?:
|
|
48
|
+
type?: Type;
|
|
61
49
|
}[];
|
|
62
50
|
}
|
|
63
51
|
export declare class HttpDecorator {
|
|
@@ -116,11 +104,10 @@ export declare class HttpDecorator {
|
|
|
116
104
|
export declare const httpClass: ClassDecoratorResult<typeof HttpDecorator>;
|
|
117
105
|
export declare class HttpActionDecorator {
|
|
118
106
|
t: HttpAction;
|
|
119
|
-
onDecorator(target: ClassType, property: string): void;
|
|
107
|
+
onDecorator(target: ClassType, property: string | undefined, parameterIndexOrDescriptor?: any): void;
|
|
120
108
|
name(name: string): void;
|
|
121
|
-
setParameter(name: string, parameter: HttpActionParameter): void;
|
|
122
109
|
description(description: string): void;
|
|
123
|
-
serialization(options:
|
|
110
|
+
serialization(options: SerializationOptions): void;
|
|
124
111
|
serializer(serializer: Serializer): void;
|
|
125
112
|
middleware(...middlewares: HttpActionMiddleware[]): void;
|
|
126
113
|
/**
|
|
@@ -169,29 +156,28 @@ export declare class HttpActionDecorator {
|
|
|
169
156
|
ANY(path?: string): void;
|
|
170
157
|
/**
|
|
171
158
|
* Adds additional information about what HTTP status codes are available in this route.
|
|
172
|
-
* You can add additionally a description and a
|
|
173
|
-
*
|
|
174
|
-
* The class type is used for serialization for responses with the given statusCode.
|
|
159
|
+
* You can add additionally a description and a response body type.
|
|
175
160
|
*
|
|
176
|
-
*
|
|
161
|
+
* The type is used for serialization for responses with the given statusCode.
|
|
177
162
|
*
|
|
178
|
-
*
|
|
163
|
+
* This information is available in Deepkit API console.
|
|
179
164
|
*
|
|
180
165
|
* ```typescript
|
|
181
166
|
*
|
|
182
|
-
* @http.GET().response(200, 'All ok'
|
|
167
|
+
* @http.GET().response<boolean>(200, 'All ok')
|
|
183
168
|
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
169
|
+
* interface User {
|
|
170
|
+
* username: string;
|
|
186
171
|
* }
|
|
187
|
-
* @http.GET().response(200, 'User object'
|
|
172
|
+
* @http.GET().response<User>(200, 'User object')
|
|
188
173
|
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
174
|
+
* interface HttpErrorMessage {
|
|
175
|
+
* error: string;
|
|
176
|
+
* }
|
|
177
|
+
* @http.GET().response<HttpErrorMessage>(500, 'Error')
|
|
192
178
|
* ```
|
|
193
179
|
*/
|
|
194
|
-
response(statusCode: number, description?: string,
|
|
180
|
+
response<T>(statusCode: number, description?: string, type?: ReceiveType<T>): void;
|
|
195
181
|
/**
|
|
196
182
|
* Adds a parameter resolver for parameters based on the class type. Use .resolveParameterByName() for name-based resolving.
|
|
197
183
|
*
|
|
@@ -236,68 +222,17 @@ export declare class HttpActionDecorator {
|
|
|
236
222
|
* ```
|
|
237
223
|
*/
|
|
238
224
|
resolveParameterByName(name: string, resolver: ClassType<RouteParameterResolver>): void;
|
|
239
|
-
regexp(parameterName: string, regex: any): void;
|
|
240
225
|
}
|
|
241
|
-
declare
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
* }
|
|
254
|
-
*
|
|
255
|
-
* class Controller {
|
|
256
|
-
* @http.GET()
|
|
257
|
-
* myAction(@http.body() body: MyActionBody) {
|
|
258
|
-
* console.log('body', body.name);
|
|
259
|
-
* }
|
|
260
|
-
* }
|
|
261
|
-
* ```
|
|
262
|
-
*/
|
|
263
|
-
body(): void;
|
|
264
|
-
query(path?: string): void;
|
|
265
|
-
get optional(): void;
|
|
266
|
-
/**
|
|
267
|
-
* Marks the argument as query parameter. Data from the query string is parsed
|
|
268
|
-
* and deserialized to the defined type.
|
|
269
|
-
* Define a `path` if you want to parse a subset of the query string only.
|
|
270
|
-
*
|
|
271
|
-
* Note: Make sure the defined parameter type has optional properties,
|
|
272
|
-
* otherwise it's always required to pass a query string.
|
|
273
|
-
*
|
|
274
|
-
* @example
|
|
275
|
-
* ```typescript
|
|
276
|
-
* class MyActionQueries {
|
|
277
|
-
* @t.optional name?: string;
|
|
278
|
-
* }
|
|
279
|
-
*
|
|
280
|
-
* class Controller {
|
|
281
|
-
* @http.GET('my-action')
|
|
282
|
-
* myAction(@http.queries() query: MyActionQueries) {
|
|
283
|
-
* console.log('query', query.name);
|
|
284
|
-
* }
|
|
285
|
-
* }
|
|
286
|
-
*
|
|
287
|
-
* // Open via, e.g.
|
|
288
|
-
* // -> /my-action?name=Peter
|
|
289
|
-
* ```
|
|
290
|
-
*
|
|
291
|
-
*/
|
|
292
|
-
queries(path?: string): void;
|
|
293
|
-
}
|
|
294
|
-
export declare const httpAction: PropertyDecoratorResult<typeof HttpActionDecorator>;
|
|
295
|
-
export declare const httpActionParameter: PropertyDecoratorResult<typeof HttpActionParameterDecorator>;
|
|
296
|
-
export declare const http: import("@deepkit/type").Merge<Omit<import("@deepkit/type").FluidDecorator<HttpDecorator, import("@deepkit/type").ClassDecoratorFn> & ((classType: import("@deepkit/core").AbstractClassType<any>) => void) & {
|
|
297
|
-
_fetch: (classType: ClassType<any>) => HttpController | undefined;
|
|
298
|
-
} & import("@deepkit/type").FluidDecorator<HttpActionDecorator, import("@deepkit/type").PropertyDecoratorFn> & ((prototype: object, property: string, parameterIndexOrDescriptor?: any) => void) & {
|
|
299
|
-
_fetch: (classType: ClassType<any>, property: string, parameterIndexOrDescriptor?: any) => HttpAction | undefined;
|
|
300
|
-
} & import("@deepkit/type").FluidDecorator<HttpActionParameterDecorator, import("@deepkit/type").PropertyDecoratorFn> & {
|
|
301
|
-
_fetch: (classType: ClassType<any>, property: string, parameterIndexOrDescriptor?: any) => HttpActionParameter | undefined;
|
|
302
|
-
}, "t" | "_fetch">>;
|
|
226
|
+
declare type HttpActionFluidDecorator<T, D extends Function> = {
|
|
227
|
+
[name in keyof T]: name extends 'response' ? <T2>(statusCode: number, description?: string, type?: ReceiveType<T2>) => D & HttpActionFluidDecorator<T, D> : T[name] extends (...args: infer K) => any ? (...args: K) => D & HttpActionFluidDecorator<T, D> : D & HttpActionFluidDecorator<T, D> & {
|
|
228
|
+
_data: ExtractApiDataType<T>;
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
declare type HttpActionPropertyDecoratorResult = HttpActionFluidDecorator<ExtractClass<typeof HttpActionDecorator>, PropertyDecoratorFn> & DecoratorAndFetchSignature<typeof HttpActionDecorator, PropertyDecoratorFn>;
|
|
232
|
+
export declare const httpAction: HttpActionPropertyDecoratorResult;
|
|
233
|
+
declare type HttpMerge<U> = {
|
|
234
|
+
[K in keyof U]: K extends 'response' ? <T2>(statusCode: number, description?: string, type?: ReceiveType<T2>) => PropertyDecoratorFn & U : U[K] extends ((...a: infer A) => infer R) ? R extends DualDecorator ? (...a: A) => PropertyDecoratorFn & R & U : (...a: A) => R : never;
|
|
235
|
+
};
|
|
236
|
+
declare type MergedHttp<T extends any[]> = HttpMerge<Omit<UnionToIntersection<T[number]>, '_fetch' | 't'>>;
|
|
237
|
+
export declare const http: MergedHttp<[typeof httpClass, typeof httpAction]>;
|
|
303
238
|
export {};
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
import { __ΩClassType as __ΩClassType } from '@deepkit/core';
|
|
2
|
+
import { __ΩSerializationOptions as __ΩSerializationOptions } from '@deepkit/type';
|
|
3
|
+
import { __ΩRouteParameterResolver as __ΩRouteParameterResolver } from './router';
|
|
4
|
+
import { __ΩReceiveType as __ΩReceiveType } from '@deepkit/type';
|
|
5
|
+
import { __ΩHttpMiddleware as __ΩHttpMiddleware } from './middleware';
|
|
6
|
+
import { __ΩHttpMiddlewareFn as __ΩHttpMiddlewareFn } from './middleware';
|
|
7
|
+
import { __ΩExtractApiDataType as __ΩExtractApiDataType } from '@deepkit/type';
|
|
8
|
+
import { __ΩExtractClass as __ΩExtractClass } from '@deepkit/type';
|
|
9
|
+
import { __ΩPropertyDecoratorFn as __ΩPropertyDecoratorFn } from '@deepkit/type';
|
|
10
|
+
import { __ΩDecoratorAndFetchSignature as __ΩDecoratorAndFetchSignature } from '@deepkit/type';
|
|
11
|
+
import { __ΩDualDecorator as __ΩDualDecorator } from '@deepkit/type';
|
|
12
|
+
import { __ΩUnionToIntersection as __ΩUnionToIntersection } from '@deepkit/type';
|
|
13
|
+
var __ΩPick = ['T', 'K', 'l+e#!e"!fRb!b"Pde""N#!'];
|
|
14
|
+
var __ΩExclude = ['T', 'U', 'l6!Re$!RPe#!e$"qk#%QRb!b"Pde"!p)'];
|
|
15
|
+
var __ΩOmit = ['T', 'K', () => __ΩPick, () => __ΩExclude, 'b!b"e!!e!!ge!"o$#o##'];
|
|
1
16
|
/*
|
|
2
17
|
* Deepkit Framework
|
|
3
18
|
* Copyright (C) 2021 Deepkit UG, Marc J. Schmidt
|
|
@@ -8,11 +23,13 @@
|
|
|
8
23
|
* You should have received a copy of the MIT License along with this program.
|
|
9
24
|
*/
|
|
10
25
|
import { isClass, urlJoin } from '@deepkit/core';
|
|
11
|
-
import { createClassDecoratorContext, createPropertyDecoratorContext,
|
|
12
|
-
import { httpMiddleware } from './middleware';
|
|
26
|
+
import { createClassDecoratorContext, createPropertyDecoratorContext, isDecoratorContext, mergeDecorator, resolveReceiveType, Serializer } from '@deepkit/type';
|
|
27
|
+
import { httpMiddleware, HttpMiddlewareConfig } from './middleware';
|
|
28
|
+
var __ΩHttpActionMiddleware = [() => HttpMiddlewareConfig, '', () => __ΩClassType, () => __ΩHttpMiddleware, () => __ΩHttpMiddlewareFn, 'PPP7!/"n$o#"n%J'];
|
|
13
29
|
function isMiddlewareClassTypeOrFn(v) {
|
|
14
30
|
return isClass(v) || !isDecoratorContext(httpMiddleware, v);
|
|
15
31
|
}
|
|
32
|
+
isMiddlewareClassTypeOrFn.__type = [() => __ΩHttpActionMiddleware, 'v', 'isMiddlewareClassTypeOrFn', 'Pn!2"!/#'];
|
|
16
33
|
class HttpController {
|
|
17
34
|
constructor() {
|
|
18
35
|
this.baseUrl = '';
|
|
@@ -48,12 +65,14 @@ class HttpController {
|
|
|
48
65
|
throw new Error(`No action with methodName ${methodName} found`);
|
|
49
66
|
}
|
|
50
67
|
}
|
|
68
|
+
HttpController.__type = ['baseUrl', function () { return ''; }, 'groups', function () { return []; }, () => HttpMiddlewareConfig, '', 'middlewares', function () { return []; }, () => __ΩClassType, 'resolverForToken', function () { return new Map(); }, () => __ΩClassType, 'resolverForParameterName', function () { return new Map(); }, () => HttpAction, 'action', 'getUrl', () => HttpAction, 'addAction', () => HttpAction, 'getActions', 'methodName', 'removeAction', () => HttpAction, 'getAction', '&3!>"&F3#>$PP7%/&F3\'>("n)E3*>+&n,E3->.PP7/20&01PP7220"03PP74D05P&26$07P&26P78095'];
|
|
51
69
|
export class HttpActionParameter {
|
|
52
70
|
constructor() {
|
|
53
71
|
this.name = '';
|
|
54
72
|
this.optional = false;
|
|
55
73
|
}
|
|
56
74
|
}
|
|
75
|
+
HttpActionParameter.__type = ['name', function () { return ''; }, "body", "query", "queries", 'type', 'typePath', 'optional', function () { return false; }, '&3!>"P.#.$.%J3&8&3\'8)3(>)5'];
|
|
57
76
|
export class HttpAction {
|
|
58
77
|
constructor() {
|
|
59
78
|
this.name = '';
|
|
@@ -64,13 +83,8 @@ export class HttpAction {
|
|
|
64
83
|
this.methodName = '';
|
|
65
84
|
this.groups = [];
|
|
66
85
|
this.middlewares = [];
|
|
67
|
-
this.parameterRegularExpressions = {};
|
|
68
86
|
this.resolverForToken = new Map();
|
|
69
87
|
this.resolverForParameterName = new Map();
|
|
70
|
-
/**
|
|
71
|
-
* This is only filled when the user used @http.body() for example on an method argument.
|
|
72
|
-
*/
|
|
73
|
-
this.parameters = {};
|
|
74
88
|
/**
|
|
75
89
|
* An arbitrary data container the user can use to store app specific settings/values.
|
|
76
90
|
*/
|
|
@@ -78,6 +92,7 @@ export class HttpAction {
|
|
|
78
92
|
this.responses = [];
|
|
79
93
|
}
|
|
80
94
|
}
|
|
95
|
+
HttpAction.__type = ['name', function () { return ''; }, 'description', function () { return ''; }, 'category', function () { return ''; }, 'path', function () { return ''; }, 'httpMethods', function () { return []; }, 'methodName', function () { return ''; }, 'groups', function () { return []; }, () => Serializer, 'serializer', () => HttpMiddlewareConfig, '', 'middlewares', function () { return []; }, () => __ΩSerializationOptions, 'serializationOptions', () => __ΩClassType, 'resolverForToken', function () { return new Map(); }, () => __ΩClassType, 'resolverForParameterName', function () { return new Map(); }, 'statusCode', 'type', 'responses', function () { return []; }, '&3!>"&3#>$&3%>&&3\'>(&F3)>*&3+>,&F3->.P7/308PP71/2F33>4n5368"n7E38>9&n:E3;><P\'4=&4#"4>8MF3?>@5'];
|
|
81
96
|
export class HttpDecorator {
|
|
82
97
|
constructor() {
|
|
83
98
|
this.t = new HttpController;
|
|
@@ -89,7 +104,7 @@ export class HttpDecorator {
|
|
|
89
104
|
this.t.groups.push(...group);
|
|
90
105
|
}
|
|
91
106
|
middleware(...middlewares) {
|
|
92
|
-
this.t.middlewares.push(...middlewares.map(v => isMiddlewareClassTypeOrFn(v) ? httpMiddleware.for(v) : v));
|
|
107
|
+
this.t.middlewares.push(...middlewares.map(Object.assign(v => isMiddlewareClassTypeOrFn(v) ? httpMiddleware.for(v) : v, { __type: ['v', '', 'P"2!"/"'] })));
|
|
93
108
|
}
|
|
94
109
|
/**
|
|
95
110
|
* Adds a parameter resolver for parameters based on the class type. Use .resolveParameterByName() for name-based resolving.
|
|
@@ -145,21 +160,21 @@ export class HttpDecorator {
|
|
|
145
160
|
this.t.addAction(action);
|
|
146
161
|
}
|
|
147
162
|
}
|
|
163
|
+
HttpDecorator.__type = ['baseUrl', () => "", 'controller', 'group', () => __ΩHttpActionMiddleware, 'middlewares', 'middleware', () => __ΩClassType, 'classType', () => __ΩClassType, () => __ΩRouteParameterResolver, 'resolver', 'resolveParameter', 'name', () => __ΩClassType, () => __ΩRouteParameterResolver, 'resolveParameterByName', () => HttpAction, 'action', 'setAction', 'P&2!>""0#P&@2$"0$Pn%@2&"0\'PPn(&"J2)n+o*"2,"0-P&2.n0o/"2,"01PP7223"045'];
|
|
148
164
|
export const httpClass = createClassDecoratorContext(HttpDecorator);
|
|
149
165
|
export class HttpActionDecorator {
|
|
150
166
|
constructor() {
|
|
151
167
|
this.t = new HttpAction;
|
|
152
168
|
}
|
|
153
|
-
onDecorator(target, property) {
|
|
169
|
+
onDecorator(target, property, parameterIndexOrDescriptor) {
|
|
170
|
+
if (!property)
|
|
171
|
+
return;
|
|
154
172
|
this.t.methodName = property;
|
|
155
173
|
httpClass.setAction(this.t)(target);
|
|
156
174
|
}
|
|
157
175
|
name(name) {
|
|
158
176
|
this.t.name = name;
|
|
159
177
|
}
|
|
160
|
-
setParameter(name, parameter) {
|
|
161
|
-
this.t.parameters[name] = parameter;
|
|
162
|
-
}
|
|
163
178
|
description(description) {
|
|
164
179
|
this.t.description = description;
|
|
165
180
|
}
|
|
@@ -170,7 +185,7 @@ export class HttpActionDecorator {
|
|
|
170
185
|
this.t.serializer = serializer;
|
|
171
186
|
}
|
|
172
187
|
middleware(...middlewares) {
|
|
173
|
-
this.t.middlewares.push(...middlewares.map(v => isMiddlewareClassTypeOrFn(v) ? httpMiddleware.for(v) : v));
|
|
188
|
+
this.t.middlewares.push(...middlewares.map(Object.assign(v => isMiddlewareClassTypeOrFn(v) ? httpMiddleware.for(v) : v, { __type: ['v', '', 'P"2!"/"'] })));
|
|
174
189
|
}
|
|
175
190
|
/**
|
|
176
191
|
* Allows to change the HttpAction object and composite multiple properties into one function.
|
|
@@ -241,12 +256,12 @@ export class HttpActionDecorator {
|
|
|
241
256
|
this.t.path = path;
|
|
242
257
|
}
|
|
243
258
|
OPTIONS(path = '') {
|
|
244
|
-
this.t.httpMethods.push('
|
|
259
|
+
this.t.httpMethods.push('OPTIONS');
|
|
245
260
|
if (path)
|
|
246
261
|
this.t.path = path;
|
|
247
262
|
}
|
|
248
263
|
TRACE(path = '') {
|
|
249
|
-
this.t.httpMethods.push('
|
|
264
|
+
this.t.httpMethods.push('TRACE');
|
|
250
265
|
if (path)
|
|
251
266
|
this.t.path = path;
|
|
252
267
|
}
|
|
@@ -262,31 +277,29 @@ export class HttpActionDecorator {
|
|
|
262
277
|
}
|
|
263
278
|
/**
|
|
264
279
|
* Adds additional information about what HTTP status codes are available in this route.
|
|
265
|
-
* You can add additionally a description and a
|
|
266
|
-
*
|
|
267
|
-
* The class type is used for serialization for responses with the given statusCode.
|
|
280
|
+
* You can add additionally a description and a response body type.
|
|
268
281
|
*
|
|
269
|
-
*
|
|
282
|
+
* The type is used for serialization for responses with the given statusCode.
|
|
270
283
|
*
|
|
271
|
-
*
|
|
284
|
+
* This information is available in Deepkit API console.
|
|
272
285
|
*
|
|
273
286
|
* ```typescript
|
|
274
287
|
*
|
|
275
|
-
* @http.GET().response(200, 'All ok'
|
|
288
|
+
* @http.GET().response<boolean>(200, 'All ok')
|
|
276
289
|
*
|
|
277
|
-
*
|
|
278
|
-
*
|
|
290
|
+
* interface User {
|
|
291
|
+
* username: string;
|
|
279
292
|
* }
|
|
280
|
-
* @http.GET().response(200, 'User object'
|
|
293
|
+
* @http.GET().response<User>(200, 'User object')
|
|
281
294
|
*
|
|
282
|
-
*
|
|
283
|
-
*
|
|
284
|
-
*
|
|
295
|
+
* interface HttpErrorMessage {
|
|
296
|
+
* error: string;
|
|
297
|
+
* }
|
|
298
|
+
* @http.GET().response<HttpErrorMessage>(500, 'Error')
|
|
285
299
|
* ```
|
|
286
300
|
*/
|
|
287
|
-
response(statusCode, description = '',
|
|
288
|
-
|
|
289
|
-
this.t.responses.push({ statusCode, description, type });
|
|
301
|
+
response(statusCode, description = '', type) {
|
|
302
|
+
this.t.responses.push({ statusCode, description, type: type ? resolveReceiveType(type) : undefined });
|
|
290
303
|
}
|
|
291
304
|
/**
|
|
292
305
|
* Adds a parameter resolver for parameters based on the class type. Use .resolveParameterByName() for name-based resolving.
|
|
@@ -336,90 +349,12 @@ export class HttpActionDecorator {
|
|
|
336
349
|
resolveParameterByName(name, resolver) {
|
|
337
350
|
this.t.resolverForParameterName.set(name, resolver);
|
|
338
351
|
}
|
|
339
|
-
regexp(parameterName, regex) {
|
|
340
|
-
this.t.parameterRegularExpressions[parameterName] = regex;
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
class HttpActionParameterDecorator {
|
|
344
|
-
constructor() {
|
|
345
|
-
this.t = new HttpActionParameter();
|
|
346
|
-
}
|
|
347
|
-
onDecorator(target, propertyName, parameterIndex) {
|
|
348
|
-
if (!propertyName)
|
|
349
|
-
throw new Error('@http action parameter decorator can only be used on method arguments.');
|
|
350
|
-
if (parameterIndex === undefined)
|
|
351
|
-
throw new Error('@http action parameter decorator can only be used on method arguments.');
|
|
352
|
-
const schema = getClassSchema(target);
|
|
353
|
-
const property = schema.getMethodProperties(propertyName)[parameterIndex];
|
|
354
|
-
this.t.name = property.name;
|
|
355
|
-
if (this.t.typePath === undefined) {
|
|
356
|
-
this.t.typePath = property.name;
|
|
357
|
-
}
|
|
358
|
-
httpAction.setParameter(property.name, this.t)(target.prototype, propertyName);
|
|
359
|
-
}
|
|
360
|
-
/**
|
|
361
|
-
* Marks the argument as body parameter. Data from the client sent in the body
|
|
362
|
-
* will be tried to parsed (JSON/form data) and deserialized to the defined type.
|
|
363
|
-
* Make sure the class type as a schema assigned.
|
|
364
|
-
*
|
|
365
|
-
* @example
|
|
366
|
-
* ```typescript
|
|
367
|
-
* class MyActionBody {
|
|
368
|
-
* @t name!: string;
|
|
369
|
-
* }
|
|
370
|
-
*
|
|
371
|
-
* class Controller {
|
|
372
|
-
* @http.GET()
|
|
373
|
-
* myAction(@http.body() body: MyActionBody) {
|
|
374
|
-
* console.log('body', body.name);
|
|
375
|
-
* }
|
|
376
|
-
* }
|
|
377
|
-
* ```
|
|
378
|
-
*/
|
|
379
|
-
body() {
|
|
380
|
-
this.t.type = 'body';
|
|
381
|
-
this.t.typePath = ''; //root
|
|
382
|
-
}
|
|
383
|
-
query(path) {
|
|
384
|
-
this.t.typePath = path; //undefined === propertyName
|
|
385
|
-
this.t.type = 'query';
|
|
386
|
-
}
|
|
387
|
-
get optional() {
|
|
388
|
-
this.t.optional = true;
|
|
389
|
-
return;
|
|
390
|
-
}
|
|
391
|
-
/**
|
|
392
|
-
* Marks the argument as query parameter. Data from the query string is parsed
|
|
393
|
-
* and deserialized to the defined type.
|
|
394
|
-
* Define a `path` if you want to parse a subset of the query string only.
|
|
395
|
-
*
|
|
396
|
-
* Note: Make sure the defined parameter type has optional properties,
|
|
397
|
-
* otherwise it's always required to pass a query string.
|
|
398
|
-
*
|
|
399
|
-
* @example
|
|
400
|
-
* ```typescript
|
|
401
|
-
* class MyActionQueries {
|
|
402
|
-
* @t.optional name?: string;
|
|
403
|
-
* }
|
|
404
|
-
*
|
|
405
|
-
* class Controller {
|
|
406
|
-
* @http.GET('my-action')
|
|
407
|
-
* myAction(@http.queries() query: MyActionQueries) {
|
|
408
|
-
* console.log('query', query.name);
|
|
409
|
-
* }
|
|
410
|
-
* }
|
|
411
|
-
*
|
|
412
|
-
* // Open via, e.g.
|
|
413
|
-
* // -> /my-action?name=Peter
|
|
414
|
-
* ```
|
|
415
|
-
*
|
|
416
|
-
*/
|
|
417
|
-
queries(path = '') {
|
|
418
|
-
this.t.typePath = path; //'' === root
|
|
419
|
-
this.t.type = 'queries';
|
|
420
|
-
}
|
|
421
352
|
}
|
|
353
|
+
HttpActionDecorator.__type = [() => __ΩClassType, 'target', 'property', 'parameterIndexOrDescriptor', 'onDecorator', 'name', 'description', () => __ΩSerializationOptions, 'options', 'serialization', () => Serializer, 'serializer', () => __ΩHttpActionMiddleware, 'middlewares', 'middleware', () => HttpAction, 'action', '', 'use', 'value', 'data', 'category', 'group', 'path', () => "", 'GET', () => "", 'HEAD', () => "", 'POST', () => "", 'PUT', () => "", 'DELETE', () => "", 'OPTIONS', () => "", 'TRACE', () => "", 'PATCH', () => "", 'ANY', 'statusCode', () => "", () => __ΩReceiveType, 'type', 'response', () => __ΩClassType, 'classType', () => __ΩClassType, () => __ΩRouteParameterResolver, 'resolver', 'resolveParameter', () => __ΩClassType, () => __ΩRouteParameterResolver, 'resolveParameterByName', 'Pn!2"P&-J2#"2$8"0%P&2&"0&P&2\'"0\'Pn(2)"0*PP7+2,"0,Pn-@2."0/PPP7021$/223"03P&2&"24"05P&26"06P&@27"07P&28>9"0:P&28>;"0<P&28>="0>P&28>?"0@P&28>A"0BP&28>C"0DP&28>E"0FP&28>G"0HP&28>I"0JP\'2K&2\'>L"oM"2N8"0OPPnP&"J2QnSoR"2T"0UP&2&nWoV"2T"0X5'];
|
|
354
|
+
var __ΩHttpActionFluidDecorator = ['T', 'D', "response", 'statusCode', 'description', () => __ΩReceiveType, 'type', 0, '', 'args', 0, 0, () => __ΩExtractApiDataType, '_data', 'l\u00A1P\'2$&2%8"o&"2\'8Pe)"e)!e)"o(#K/)RPe#!@2*Pe+"e+!e+"o+#K/)RPe*"e*!e*"o,#Pe+!o-"4.MKRPde(!e%!fPh"!@2*"/)qkC[QRPe#!.#qk#tQRPde#!p\u008DRb!b"Pde"!gN\u0099!'];
|
|
355
|
+
var __ΩHttpActionPropertyDecoratorResult = [() => __ΩHttpActionFluidDecorator, () => __ΩExtractClass, () => HttpActionDecorator, () => __ΩPropertyDecoratorFn, () => __ΩDecoratorAndFetchSignature, () => HttpActionDecorator, () => __ΩPropertyDecoratorFn, 'Pi#o""n$o!#i&n\'o%#K'];
|
|
422
356
|
export const httpAction = createPropertyDecoratorContext(HttpActionDecorator);
|
|
423
|
-
|
|
424
|
-
|
|
357
|
+
var __ΩHttpMerge = ['U', "response", 'statusCode', 'description', () => __ΩReceiveType, 'type', () => __ΩPropertyDecoratorFn, '', 'a', () => __ΩDualDecorator, () => __ΩPropertyDecoratorFn, 'l\u00A3P\'2#&2$8"o%"2&8Pn\'e)!K/(RPe\'!@2)Pn+e&!e/!K/(RPe\'!@2)e%!/(RPe#!n*qk<PQRPde#"p]R!RPdde(!e%!fPh"!@2)h""/(qkiqQRPe#!."qk#sQRPde#!p\u008FRb!Pde"!gN\u009B!'];
|
|
358
|
+
var __ΩMergedHttp = ['T', () => __ΩHttpMerge, () => __ΩOmit, () => __ΩUnionToIntersection, "_fetch", "t", 'b!e!!\'fo$"P.%.&Jo##o""'];
|
|
359
|
+
export const http = mergeDecorator(httpClass, httpAction);
|
|
425
360
|
//# sourceMappingURL=decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../../src/decorator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../../src/decorator.ts"],"names":[],"mappings":"6CAU4C,eAAe;mEAkBpD,eAAe;uEACiB,UAAU;iDAD1C,eAAe;uDAEiE,cAAc;2DAAd,cAAc;+DAF9F,eAAe;mDAAf,eAAe;iEAAf,eAAe;+EAAf,eAAe;qDAAf,eAAe;iEAAf,eAAe;;;;AA5BtB;;;;;;;;GAQG;AAEH,OAAO,EAAa,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAEH,2BAA2B,EAC3B,8BAA8B,EAK9B,kBAAkB,EAClB,cAAc,EAGd,kBAAkB,EAElB,UAAU,EAGb,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,cAAc,EAAkB,oBAAoB,EAAoB,MAAM,cAAc,CAAC;;AAItG,SAAS,yBAAyB,CAAC,CAAuB;IACtD,OAAO,OAAO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AAI,CAAC,CAAC,CAAC,WAAW,GAAG,EAAE,CAAC;QACxB,IAAI,IAAI;YAAE,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC;IACjC,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,QAAQ,CAAI,UAAkB,EAAE,cAAsB,EAAE,EAAE,IAAqB;QAC3E,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;IAC1G,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,gBAAgB,CAAC,SAAmC,EAAE,QAA2C;QAC7F,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACrD,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,sBAAsB,CAAC,IAAY,EAAE,QAA2C;QAC5E,IAAI,CAAC,CAAC,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACxD,CAAC;;;;;AAWL,MAAM,CAAC,MAAM,UAAU,GAAsC,8BAA8B,CAAC,mBAAmB,CAAC,CAAC;;;AAMjH,MAAM,CAAC,MAAM,IAAI,GAAsD,cAAc,CAAC,SAAS,EAAE,UAAU,CAA6D,CAAC"}
|
package/dist/esm/src/filter.d.ts
CHANGED
package/dist/esm/src/filter.js
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
import { Router } from './router';
|
|
11
|
-
import { injectable } from '@deepkit/injector';
|
|
1
|
+
import { __ΩClassType as __ΩClassType } from '@deepkit/core';
|
|
2
|
+
import { AppModule } from '@deepkit/app';
|
|
3
|
+
import { RouteConfig, Router } from './router';
|
|
4
|
+
var __ΩHttpRouteFilterRoute = ['path', 'pathRegExp', "GET", "HEAD", "POST", "PATCH", "PUT", "DELETE", "OPTIONS", "TRACE", 'httpMethod', 'category', 'group', 'P&4!8A4"8P.#.$.%.&.\'.(.).*J4+8&4,8&4-8M'];
|
|
5
|
+
export { __ΩHttpRouteFilterRoute as __ΩHttpRouteFilterRoute };
|
|
12
6
|
export class HttpRouteFilterModel {
|
|
13
7
|
constructor() {
|
|
14
8
|
this.controllers = [];
|
|
@@ -33,6 +27,7 @@ export class HttpRouteFilterModel {
|
|
|
33
27
|
this.moduleClasses = [];
|
|
34
28
|
}
|
|
35
29
|
}
|
|
30
|
+
HttpRouteFilterModel.__type = [() => __ΩClassType, 'controllers', function () { return []; }, () => __ΩClassType, 'excludeControllers', function () { return []; }, () => __ΩHttpRouteFilterRoute, 'routes', function () { return []; }, () => __ΩHttpRouteFilterRoute, 'excludeRoutes', function () { return []; }, 'routeNames', function () { return []; }, 'excludeRouteNames', function () { return []; }, () => AppModule, 'modules', function () { return []; }, () => AppModule, 'excludeModules', function () { return []; }, () => __ΩClassType, () => AppModule, 'moduleClasses', function () { return []; }, () => __ΩClassType, () => AppModule, 'excludeModuleClasses', function () { return []; }, 'reset', 'n!F3">#n$F3%>&n\'F3(>)n*F3+>,&F3->.&F3/>0P"71F32>3P"74F35>6P"78o7"F39>:P"7<o;"F3=>>P"0?5'];
|
|
36
31
|
function match(routeConfig, route) {
|
|
37
32
|
if (route.httpMethod && routeConfig.httpMethods.includes(route.httpMethod))
|
|
38
33
|
return true;
|
|
@@ -48,7 +43,8 @@ function match(routeConfig, route) {
|
|
|
48
43
|
}
|
|
49
44
|
return false;
|
|
50
45
|
}
|
|
51
|
-
|
|
46
|
+
match.__type = [() => RouteConfig, 'routeConfig', () => __ΩHttpRouteFilterRoute, 'route', 'match', 'PP7!2"n#2$)/%'];
|
|
47
|
+
export class HttpRouterFilterResolver {
|
|
52
48
|
constructor(router) {
|
|
53
49
|
this.router = router;
|
|
54
50
|
}
|
|
@@ -148,12 +144,8 @@ let HttpRouterFilterResolver = class HttpRouterFilterResolver {
|
|
|
148
144
|
}
|
|
149
145
|
return result;
|
|
150
146
|
}
|
|
151
|
-
}
|
|
152
|
-
HttpRouterFilterResolver =
|
|
153
|
-
injectable,
|
|
154
|
-
__metadata("design:paramtypes", [Router])
|
|
155
|
-
], HttpRouterFilterResolver);
|
|
156
|
-
export { HttpRouterFilterResolver };
|
|
147
|
+
}
|
|
148
|
+
HttpRouterFilterResolver.__type = [() => Router, 'router', 'constructor', () => HttpRouteFilterModel, 'filter', () => RouteConfig, 'resolve', 'PP7!2"<"0#PP7$2%P7&F0\'5'];
|
|
157
149
|
/**
|
|
158
150
|
* A class to describe a filter for routes.
|
|
159
151
|
*/
|
|
@@ -206,4 +198,5 @@ export class HttpRouteFilter {
|
|
|
206
198
|
return this;
|
|
207
199
|
}
|
|
208
200
|
}
|
|
201
|
+
HttpRouteFilter.__type = ['reset', () => __ΩClassType, 'controllers', 'forControllers', () => __ΩClassType, 'excludeControllers', () => __ΩHttpRouteFilterRoute, 'routes', 'forRoutes', () => __ΩHttpRouteFilterRoute, 'excludeRoutes', 'names', 'forRouteNames', 'excludeRouteNames', () => AppModule, 'modules', 'forModules', () => AppModule, 'excludeModules', () => __ΩClassType, () => AppModule, 'moduleClasses', 'forModuleClasses', () => __ΩClassType, () => AppModule, 'excludeModuleClasses', 'P!0!Pn"@2#!0$Pn%@2#!0&Pn\'@2(!0)Pn*@2(!0+P&@2,!0-P&@2,!0.PP"7/@20!01PP"72@20!03PP"75o4"@26!07PP"79o8"@26!0:5'];
|
|
209
202
|
//# sourceMappingURL=filter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../../../src/filter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../../../src/filter.ts"],"names":[],"mappings":"6CAA0B,eAAe;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;;;AAU/C,MAAM,OAAO,oBAAoB;IAAjC;QACI,gBAAW,GAAgB,EAAE,CAAC;QAC9B,uBAAkB,GAAgB,EAAE,CAAC;QAErC,WAAM,GAA2B,EAAE,CAAC;QACpC,kBAAa,GAA2B,EAAE,CAAC;QAE3C,eAAU,GAAa,EAAE,CAAC;QAC1B,sBAAiB,GAAa,EAAE,CAAC;QAEjC,YAAO,GAAqB,EAAE,CAAC;QAC/B,mBAAc,GAAqB,EAAE,CAAC;QAEtC,kBAAa,GAAgC,EAAE,CAAC;QAChD,yBAAoB,GAAgC,EAAE,CAAC;KAe1D;IAbG,KAAK;QACD,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAC;QAE7B,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;QAExB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,iBAAiB,GAAG,EAAE,CAAC;QAE5B,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;IAC5B,CAAC;;uFA3B0B,EAAE,oEACK,EAAE,mEAEH,EAAE,0EACK,EAAE,wCAEnB,EAAE,+CACK,EAAE,sDAEJ,EAAE,6DACK,EAAE,gFAEQ,EAAE,uFACK,EAAE;AAiB1D,SAAS,KAAK,CAAC,WAAwB,EAAE,KAA2B;IAChE,IAAI,KAAK,CAAC,UAAU,IAAI,WAAW,CAAC,WAAW,CAAC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AAiB,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;QAC5C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,UAAU,CAAC,GAAG,OAAyB;QACnC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,cAAc,CAAC,GAAG,OAAyB;QACvC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,gBAAgB,CAAC,GAAG,aAA0C;QAC1D,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,oBAAoB,CAAC,GAAG,aAA0C;QAC9D,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC;QACvD,OAAO,IAAI,CAAC;IAChB,CAAC"}
|
package/dist/esm/src/http.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ClassType, CustomError } from '@deepkit/core';
|
|
|
3
3
|
import { OutgoingHttpHeaders, ServerResponse } from 'http';
|
|
4
4
|
import { HttpRequest, HttpResponse } from './model';
|
|
5
5
|
import { InjectorContext } from '@deepkit/injector';
|
|
6
|
-
import {
|
|
6
|
+
import { LoggerInterface } from '@deepkit/logger';
|
|
7
7
|
import { RouteConfig, RouteParameterResolverForInjector, Router } from './router';
|
|
8
8
|
import { WorkflowEvent } from '@deepkit/workflow';
|
|
9
9
|
import type { ElementStruct } from '@deepkit/template';
|
|
@@ -211,10 +211,10 @@ export declare class HttpResultFormatter {
|
|
|
211
211
|
}
|
|
212
212
|
export declare class HttpListener {
|
|
213
213
|
protected router: Router;
|
|
214
|
-
protected logger:
|
|
214
|
+
protected logger: LoggerInterface;
|
|
215
215
|
protected resultFormatter: HttpResultFormatter;
|
|
216
216
|
protected stopwatch?: Stopwatch | undefined;
|
|
217
|
-
constructor(router: Router, logger:
|
|
217
|
+
constructor(router: Router, logger: LoggerInterface, resultFormatter: HttpResultFormatter, stopwatch?: Stopwatch | undefined);
|
|
218
218
|
onRequest(event: typeof httpWorkflow.onRequest.event): void;
|
|
219
219
|
onRoute(event: typeof httpWorkflow.onRoute.event): Promise<void>;
|
|
220
220
|
onRouteForward(event: typeof httpWorkflow.onRoute.event): void;
|
|
@@ -232,3 +232,5 @@ export declare class HttpListener {
|
|
|
232
232
|
onResponse(event: typeof httpWorkflow.onResponse.event): Promise<void>;
|
|
233
233
|
}
|
|
234
234
|
export {};
|
|
235
|
+
export declare type __ΩSupportedHttpResult = any[];
|
|
236
|
+
export declare type __ΩHttpResultFormatterContext = any[];
|