tspace-spear 1.0.0 → 1.0.2
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/License +1 -1
- package/README.md +364 -47
- package/build/lib/core/decorators/context.js +11 -10
- package/build/lib/core/decorators/context.js.map +1 -0
- package/build/lib/core/decorators/controller.js +1 -0
- package/build/lib/core/decorators/controller.js.map +1 -0
- package/build/lib/core/decorators/headers.js +1 -0
- package/build/lib/core/decorators/headers.js.map +1 -0
- package/build/lib/core/decorators/index.d.ts +1 -0
- package/build/lib/core/decorators/index.js +2 -0
- package/build/lib/core/decorators/index.js.map +1 -0
- package/build/lib/core/decorators/methods.js +1 -0
- package/build/lib/core/decorators/methods.js.map +1 -0
- package/build/lib/core/decorators/middleware.d.ts +1 -1
- package/build/lib/core/decorators/middleware.js +1 -0
- package/build/lib/core/decorators/middleware.js.map +1 -0
- package/build/lib/core/decorators/statusCode.js +1 -0
- package/build/lib/core/decorators/statusCode.js.map +1 -0
- package/build/lib/core/decorators/swagger.d.ts +2 -0
- package/build/lib/core/decorators/swagger.js +15 -0
- package/build/lib/core/decorators/swagger.js.map +1 -0
- package/build/lib/core/server/index.d.ts +90 -44
- package/build/lib/core/server/index.js +314 -286
- package/build/lib/core/server/index.js.map +1 -0
- package/build/lib/core/server/parser-factory.d.ts +26 -0
- package/build/lib/core/server/parser-factory.js +428 -0
- package/build/lib/core/server/parser-factory.js.map +1 -0
- package/build/lib/core/server/q.bak.d.ts +0 -0
- package/build/lib/core/server/q.bak.js +965 -0
- package/build/lib/core/server/q.bak.js.map +1 -0
- package/build/lib/core/server/router.d.ts +63 -2
- package/build/lib/core/server/router.js +63 -1
- package/build/lib/core/server/router.js.map +1 -0
- package/build/lib/{types → core/types}/index.d.ts +85 -9
- package/build/lib/{types → core/types}/index.js +1 -0
- package/build/lib/core/types/index.js.map +1 -0
- package/build/lib/index.d.ts +4 -13
- package/build/lib/index.js +7 -23
- package/build/lib/index.js.map +1 -0
- package/build/tests/benchmark.test.d.ts +1 -0
- package/build/tests/benchmark.test.js +135 -0
- package/build/tests/benchmark.test.js.map +1 -0
- package/package.json +30 -19
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"q.bak.js","sourceRoot":"","sources":["../../../../src/lib/core/server/q.bak.ts"],"names":[],"mappings":";AAAA,gCAAgC;AAChC,sBAAsB;AACtB,uBAAuB;AACvB,2BAA2B;AAC3B,4DAA4D;AAC5D,+BAA+B;AAC/B,wCAAwC;AACxC,kBAAkB;AAClB,wBAAwB;AACxB,eAAe;AACf,sBAAsB;AACtB,iBAAiB;AAEjB,YAAY;AACZ,cAAc;AACd,kBAAkB;AAClB,sBAAsB;AACtB,mBAAmB;AACnB,gBAAgB;AAChB,oBAAoB;AACpB,wBAAwB;AACxB,sBAAsB;AACtB,gBAAgB;AAChB,aAAa;AACb,cAAc;AACd,cAAc;AACd,gBAAgB;AAChB,gBAAgB;AAChB,eAAe;AACf,iBAAiB;AACjB,oDAAoD;AAEpD,MAAM;AACN,MAAM;AACN,4EAA4E;AAC5E,MAAM;AACN,kCAAkC;AAClC,cAAc;AACd,iBAAiB;AACjB,uCAAuC;AACvC,6BAA6B;AAC7B,kBAAkB;AAClB,oCAAoC;AACpC,WAAW;AACX,UAAU;AACV,2EAA2E;AAC3E,QAAQ;AACR,MAAM;AACN,gBAAgB;AAEhB,gGAAgG;AAChG,gGAAgG;AAChG,8CAA8C;AAC9C,6FAA6F;AAC7F,8FAA8F;AAC9F,qDAAqD;AACrD,2BAA2B;AAC3B,wBAAwB;AACxB,+BAA+B;AAC/B,wCAAwC;AACxC,2BAA2B;AAC3B,oBAAoB;AACpB,+BAA+B;AAC/B,qCAAqC;AACrC,gCAAgC;AAChC,YAAY;AACZ,YAAY;AACZ,uBAAuB;AACvB,8BAA8B;AAC9B,sBAAsB;AACtB,gBAAgB;AAChB,gDAAgD;AAChD,gBAAgB;AAChB,aAAa;AACb,qBAAqB;AACrB,mBAAmB;AACnB,2CA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;AAEpB,qDAAqD;AACrD,8CAA8C;AAC9C,oCAAoC;AACpC,uDAAuD;AACvD,oBAAoB;AACpB,gBAAgB;AAEhB,yCAAyC;AACzC,iFAAiF;AACjF,gBAAgB;AAEhB,0CAA0C;AAC1C,6DAA6D;AAC7D,gBAAgB;AAEhB,kDAAkD;AAClD,6BAA6B;AAC7B,yBAAyB;AACzB,aAAa;AACb,QAAQ;AAER,yDAAyD;AAEzD,4CAA4C;AAE5C,4CAA4C;AAE5C,8FAA8F;AAC9F,mDAAmD;AACnD,aAAa;AAEb,gDAAgD;AAChD,6CAA6C;AAE7C,wBAAwB;AACxB,QAAQ;AAER,6DAA6D;AAC7D,6BAA6B;AAC7B,qBAAqB;AACrB,gCAAgC;AAChC,+BAA+B;AAE/B,0EAA0E;AAE1E,sHAAsH;AACtH,QAAQ;AACR,IAAI;AAEJ,mBAAmB;AACnB,4CAA4C;AAC5C,uBAAuB"}
|
|
@@ -1,17 +1,78 @@
|
|
|
1
|
-
import { TContext, TNextFunction } from "
|
|
1
|
+
import type { TContext, TMethods, TNextFunction } from "../types";
|
|
2
2
|
declare class Router {
|
|
3
3
|
private _routes;
|
|
4
4
|
get routes(): {
|
|
5
5
|
path: string;
|
|
6
|
-
method:
|
|
6
|
+
method: TMethods;
|
|
7
7
|
handlers: ((ctx: TContext, next: TNextFunction) => any)[];
|
|
8
8
|
}[];
|
|
9
|
+
/**
|
|
10
|
+
* The 'groups' method is used to add the request handler to the router for 'GET' 'POST' 'PUT' 'PATCH' 'DELETE' methods.
|
|
11
|
+
*
|
|
12
|
+
* @param {string} prefix
|
|
13
|
+
* @param {Router} router
|
|
14
|
+
* @returns {void}
|
|
15
|
+
*/
|
|
9
16
|
groups(prefix: `/${string}`, router: (router: Router) => Router): void;
|
|
17
|
+
/**
|
|
18
|
+
* The 'get' method is used to add the request handler to the router for the 'GET' method.
|
|
19
|
+
*
|
|
20
|
+
* @param {string} path
|
|
21
|
+
* @callback {...Function[]} handlers of the middlewares
|
|
22
|
+
* @property {Object} ctx - context { req , res , query , params , cookies , files , body}
|
|
23
|
+
* @property {Function} next - go to next function
|
|
24
|
+
* @returns {this}
|
|
25
|
+
*/
|
|
10
26
|
get(path: `/${string}`, ...handlers: ((ctx: TContext, next: TNextFunction) => any)[]): this;
|
|
27
|
+
/**
|
|
28
|
+
* The 'post' method is used to add the request handler to the router for the 'POST' method.
|
|
29
|
+
*
|
|
30
|
+
* @param {string} path
|
|
31
|
+
* @callback {...Function[]} handlers of the middlewares
|
|
32
|
+
* @property {Object} ctx - context { req , res , query , params , cookies , files , body}
|
|
33
|
+
* @property {Function} next - go to next function
|
|
34
|
+
* @returns {this}
|
|
35
|
+
*/
|
|
11
36
|
post(path: `/${string}`, ...handlers: ((ctx: TContext, next: TNextFunction) => any)[]): this;
|
|
37
|
+
/**
|
|
38
|
+
* The 'put' method is used to add the request handler to the router for the 'PUT' method.
|
|
39
|
+
*
|
|
40
|
+
* @param {string} path
|
|
41
|
+
* @callback {...Function[]} handlers of the middlewares
|
|
42
|
+
* @property {Object} ctx - context { req , res , query , params , cookies , files , body}
|
|
43
|
+
* @property {Function} next - go to next function
|
|
44
|
+
* @returns {this}
|
|
45
|
+
*/
|
|
12
46
|
put(path: `/${string}`, ...handlers: ((ctx: TContext, next: TNextFunction) => any)[]): this;
|
|
47
|
+
/**
|
|
48
|
+
* The 'patch' method is used to add the request handler to the router for the 'PATCH' method.
|
|
49
|
+
*
|
|
50
|
+
* @param {string} path
|
|
51
|
+
* @callback {...Function[]} handlers of the middlewares
|
|
52
|
+
* @property {Object} ctx - context { req , res , query , params , cookies , files , body}
|
|
53
|
+
* @property {Function} next - go to next function
|
|
54
|
+
* @returns {this}
|
|
55
|
+
*/
|
|
13
56
|
patch(path: `/${string}`, ...handlers: ((ctx: TContext, next: TNextFunction) => any)[]): this;
|
|
57
|
+
/**
|
|
58
|
+
* The 'delete' method is used to add the request handler to the router for the 'DELETE' method.
|
|
59
|
+
*
|
|
60
|
+
* @param {string} path
|
|
61
|
+
* @callback {...Function[]} handlers of the middlewares
|
|
62
|
+
* @property {Object} ctx - context { req , res , query , params , cookies , files , body}
|
|
63
|
+
* @property {Function} next - go to next function
|
|
64
|
+
* @returns {this}
|
|
65
|
+
*/
|
|
14
66
|
delete(path: `/${string}`, ...handlers: ((ctx: TContext, next: TNextFunction) => any)[]): this;
|
|
67
|
+
/**
|
|
68
|
+
* The 'all' method is used to add the request handler to the router for 'GET' 'POST' 'PUT' 'PATCH' 'DELETE' methods.
|
|
69
|
+
*
|
|
70
|
+
* @param {string} path
|
|
71
|
+
* @callback {...Function[]} handlers of the middlewares
|
|
72
|
+
* @property {object} ctx - context { req , res , query , params , cookies , files , body}
|
|
73
|
+
* @property {function} next - go to next function
|
|
74
|
+
* @returns {this}
|
|
75
|
+
*/
|
|
15
76
|
all(path: `/${string}`, ...handlers: ((ctx: TContext, next: TNextFunction) => any)[]): this;
|
|
16
77
|
}
|
|
17
78
|
export { Router };
|
|
@@ -8,13 +8,29 @@ class Router {
|
|
|
8
8
|
get routes() {
|
|
9
9
|
return this._routes;
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* The 'groups' method is used to add the request handler to the router for 'GET' 'POST' 'PUT' 'PATCH' 'DELETE' methods.
|
|
13
|
+
*
|
|
14
|
+
* @param {string} prefix
|
|
15
|
+
* @param {Router} router
|
|
16
|
+
* @returns {void}
|
|
17
|
+
*/
|
|
11
18
|
groups(prefix, router) {
|
|
12
|
-
const routes = router(new Router);
|
|
19
|
+
const routes = router(new Router());
|
|
13
20
|
for (const route of routes._routes) {
|
|
14
21
|
route.path = `${prefix}${route.path}`.replace(/^\/+/, '/');
|
|
15
22
|
this._routes.push(route);
|
|
16
23
|
}
|
|
17
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* The 'get' method is used to add the request handler to the router for the 'GET' method.
|
|
27
|
+
*
|
|
28
|
+
* @param {string} path
|
|
29
|
+
* @callback {...Function[]} handlers of the middlewares
|
|
30
|
+
* @property {Object} ctx - context { req , res , query , params , cookies , files , body}
|
|
31
|
+
* @property {Function} next - go to next function
|
|
32
|
+
* @returns {this}
|
|
33
|
+
*/
|
|
18
34
|
get(path, ...handlers) {
|
|
19
35
|
this._routes.push({
|
|
20
36
|
path,
|
|
@@ -23,6 +39,15 @@ class Router {
|
|
|
23
39
|
});
|
|
24
40
|
return this;
|
|
25
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* The 'post' method is used to add the request handler to the router for the 'POST' method.
|
|
44
|
+
*
|
|
45
|
+
* @param {string} path
|
|
46
|
+
* @callback {...Function[]} handlers of the middlewares
|
|
47
|
+
* @property {Object} ctx - context { req , res , query , params , cookies , files , body}
|
|
48
|
+
* @property {Function} next - go to next function
|
|
49
|
+
* @returns {this}
|
|
50
|
+
*/
|
|
26
51
|
post(path, ...handlers) {
|
|
27
52
|
this._routes.push({
|
|
28
53
|
path,
|
|
@@ -31,6 +56,15 @@ class Router {
|
|
|
31
56
|
});
|
|
32
57
|
return this;
|
|
33
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* The 'put' method is used to add the request handler to the router for the 'PUT' method.
|
|
61
|
+
*
|
|
62
|
+
* @param {string} path
|
|
63
|
+
* @callback {...Function[]} handlers of the middlewares
|
|
64
|
+
* @property {Object} ctx - context { req , res , query , params , cookies , files , body}
|
|
65
|
+
* @property {Function} next - go to next function
|
|
66
|
+
* @returns {this}
|
|
67
|
+
*/
|
|
34
68
|
put(path, ...handlers) {
|
|
35
69
|
this._routes.push({
|
|
36
70
|
path,
|
|
@@ -39,6 +73,15 @@ class Router {
|
|
|
39
73
|
});
|
|
40
74
|
return this;
|
|
41
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* The 'patch' method is used to add the request handler to the router for the 'PATCH' method.
|
|
78
|
+
*
|
|
79
|
+
* @param {string} path
|
|
80
|
+
* @callback {...Function[]} handlers of the middlewares
|
|
81
|
+
* @property {Object} ctx - context { req , res , query , params , cookies , files , body}
|
|
82
|
+
* @property {Function} next - go to next function
|
|
83
|
+
* @returns {this}
|
|
84
|
+
*/
|
|
42
85
|
patch(path, ...handlers) {
|
|
43
86
|
this._routes.push({
|
|
44
87
|
path,
|
|
@@ -47,6 +90,15 @@ class Router {
|
|
|
47
90
|
});
|
|
48
91
|
return this;
|
|
49
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* The 'delete' method is used to add the request handler to the router for the 'DELETE' method.
|
|
95
|
+
*
|
|
96
|
+
* @param {string} path
|
|
97
|
+
* @callback {...Function[]} handlers of the middlewares
|
|
98
|
+
* @property {Object} ctx - context { req , res , query , params , cookies , files , body}
|
|
99
|
+
* @property {Function} next - go to next function
|
|
100
|
+
* @returns {this}
|
|
101
|
+
*/
|
|
50
102
|
delete(path, ...handlers) {
|
|
51
103
|
this._routes.push({
|
|
52
104
|
path,
|
|
@@ -55,6 +107,15 @@ class Router {
|
|
|
55
107
|
});
|
|
56
108
|
return this;
|
|
57
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* The 'all' method is used to add the request handler to the router for 'GET' 'POST' 'PUT' 'PATCH' 'DELETE' methods.
|
|
112
|
+
*
|
|
113
|
+
* @param {string} path
|
|
114
|
+
* @callback {...Function[]} handlers of the middlewares
|
|
115
|
+
* @property {object} ctx - context { req , res , query , params , cookies , files , body}
|
|
116
|
+
* @property {function} next - go to next function
|
|
117
|
+
* @returns {this}
|
|
118
|
+
*/
|
|
58
119
|
all(path, ...handlers) {
|
|
59
120
|
this._routes.push({
|
|
60
121
|
path,
|
|
@@ -66,3 +127,4 @@ class Router {
|
|
|
66
127
|
}
|
|
67
128
|
exports.Router = Router;
|
|
68
129
|
exports.default = Router;
|
|
130
|
+
//# sourceMappingURL=router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router.js","sourceRoot":"","sources":["../../../../src/lib/core/server/router.ts"],"names":[],"mappings":";;;AAMA,MAAM,MAAM;IAAZ;QAEY,YAAO,GAIT,EAAE,CAAA;IAgIZ,CAAC;IA9HG,IAAI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I,CAAA;IACf,CAAC;IAEA;;;;;;;;MAQE;IACH,MAAM,CAAC,IAAmB,EAAG,GAAG,QAA6D;QACzF,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;YACd,IAAI;YACJ,MAAM,EAAG,QAAQ;YACjB,QAAQ;SACX,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACf,CAAC;IAED;;;;;;;;OAQG;IACH,GAAG,CAAC,IAAmB,EAAG,GAAG,QAA6D;QACtF,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;YACd,IAAI;YACJ,MAAM,EAAG,KAAK;YACd,QAAQ;SACX,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACf,CAAC;CACJ;AAEQ,wBAAM;AACf,kBAAe,MAAM,CAAA"}
|
|
@@ -1,28 +1,30 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { IncomingMessage, ServerResponse } from "http";
|
|
3
2
|
export type TContext = {
|
|
4
3
|
req: TRequest;
|
|
5
4
|
res: TResponse;
|
|
5
|
+
headers: THeaders;
|
|
6
6
|
query: TQuery;
|
|
7
7
|
params: TParams;
|
|
8
8
|
body: TBody;
|
|
9
9
|
files: TFiles;
|
|
10
10
|
cookies: TCookies;
|
|
11
11
|
};
|
|
12
|
-
export type
|
|
13
|
-
export type
|
|
14
|
-
export type
|
|
15
|
-
export type
|
|
12
|
+
export type THeaders<T = Record<string, string>> = T;
|
|
13
|
+
export type TQuery<T = Record<string, string>> = T;
|
|
14
|
+
export type TParams<T = Record<string, string>> = T;
|
|
15
|
+
export type TBody<T = Record<string, string | number | boolean | undefined | null | any[] | Record<string, string | number | boolean | undefined | null | any[]>>> = T;
|
|
16
|
+
export type TCookies<T = Record<string, any>> = T;
|
|
16
17
|
export type TFiles<T = Record<string, {
|
|
17
18
|
size: number;
|
|
18
19
|
tempFilePath: string;
|
|
19
20
|
tempName: string;
|
|
20
21
|
mimetype: string;
|
|
22
|
+
extension: string;
|
|
21
23
|
name: string;
|
|
22
|
-
}
|
|
24
|
+
}[]>> = T;
|
|
23
25
|
export type TNextFunction<T = any> = (err?: Error) => T | Promise<T>;
|
|
24
26
|
export type TRequest<T = any> = IncomingMessage & Partial<T>;
|
|
25
|
-
type
|
|
27
|
+
type THttpStatus = {
|
|
26
28
|
json: (data?: Record<string, any>) => void;
|
|
27
29
|
error: (err: any) => void;
|
|
28
30
|
ok: (data?: Record<string, any>) => void;
|
|
@@ -50,7 +52,7 @@ export type TResponse<T = any> = ServerResponse & {
|
|
|
50
52
|
json: (data?: Record<string, any>) => void;
|
|
51
53
|
send: (message: string) => void;
|
|
52
54
|
};
|
|
53
|
-
} &
|
|
55
|
+
} & THttpStatus & Partial<T>;
|
|
54
56
|
export type TRouter = {
|
|
55
57
|
method: TMethods;
|
|
56
58
|
path: string;
|
|
@@ -61,7 +63,7 @@ export type IRoute = {
|
|
|
61
63
|
path: string;
|
|
62
64
|
handlers: TContext[];
|
|
63
65
|
};
|
|
64
|
-
export type TMethods = 'get' | 'post' | 'patch' | 'put' | 'delete';
|
|
66
|
+
export type TMethods = 'get' | 'post' | 'patch' | 'put' | 'delete' | 'all';
|
|
65
67
|
export type TApplication = {
|
|
66
68
|
controllers?: (new () => any)[] | {
|
|
67
69
|
folder: string;
|
|
@@ -73,7 +75,81 @@ export type TApplication = {
|
|
|
73
75
|
};
|
|
74
76
|
globalPrefix?: string;
|
|
75
77
|
logger?: boolean;
|
|
78
|
+
cluster?: {
|
|
79
|
+
use: boolean;
|
|
80
|
+
maxWorkers?: number;
|
|
81
|
+
};
|
|
76
82
|
};
|
|
77
83
|
export type TRequestFunction = (ctx: TContext, next: TNextFunction) => any;
|
|
78
84
|
export type TErrorFunction = (err: Error, ctx: TContext) => any;
|
|
85
|
+
type TSwaggerFormat = "string" | "number" | "integer" | "boolean" | "object" | "array" | "date" | "date-time" | "password" | "int32" | "int64" | "float" | "double" | "byte" | "binary" | "base64" | "email" | "uuid" | "uri" | "hostname" | "ipv4" | "ipv6" | "json" | "xml";
|
|
86
|
+
type TSwaggerType = "string" | "number" | "integer" | "boolean" | "object" | "array" | "date" | "date-time" | "file";
|
|
87
|
+
export type TSwaggerDoc = {
|
|
88
|
+
path?: `/${string}`;
|
|
89
|
+
staticUrl?: `${string}`;
|
|
90
|
+
servers?: {
|
|
91
|
+
url: string;
|
|
92
|
+
description?: string;
|
|
93
|
+
}[];
|
|
94
|
+
tags?: string[];
|
|
95
|
+
info?: {
|
|
96
|
+
title?: string;
|
|
97
|
+
description?: string;
|
|
98
|
+
version?: string;
|
|
99
|
+
};
|
|
100
|
+
routes: {
|
|
101
|
+
path: string;
|
|
102
|
+
method: string;
|
|
103
|
+
params: string[];
|
|
104
|
+
}[];
|
|
105
|
+
options: (TSwagger & {
|
|
106
|
+
path: string;
|
|
107
|
+
method: string;
|
|
108
|
+
})[];
|
|
109
|
+
responses?: {
|
|
110
|
+
status: number;
|
|
111
|
+
description: string;
|
|
112
|
+
example?: Record<string, any>;
|
|
113
|
+
}[];
|
|
114
|
+
};
|
|
115
|
+
export type TSwagger = {
|
|
116
|
+
staticUrl?: string;
|
|
117
|
+
description?: string;
|
|
118
|
+
bearerToken?: boolean;
|
|
119
|
+
tags?: string[];
|
|
120
|
+
query?: Record<string, {
|
|
121
|
+
required?: boolean;
|
|
122
|
+
description?: string;
|
|
123
|
+
type: TSwaggerType;
|
|
124
|
+
example?: any;
|
|
125
|
+
}>;
|
|
126
|
+
cookies?: {
|
|
127
|
+
names: string[];
|
|
128
|
+
required?: boolean;
|
|
129
|
+
description?: string;
|
|
130
|
+
};
|
|
131
|
+
body?: {
|
|
132
|
+
required?: boolean;
|
|
133
|
+
description?: string;
|
|
134
|
+
properties: Record<string, {
|
|
135
|
+
type: TSwaggerType;
|
|
136
|
+
example?: any;
|
|
137
|
+
}>;
|
|
138
|
+
};
|
|
139
|
+
files?: {
|
|
140
|
+
required?: boolean;
|
|
141
|
+
description?: string;
|
|
142
|
+
properties: Record<string, {
|
|
143
|
+
type: TSwaggerType;
|
|
144
|
+
format?: TSwaggerFormat;
|
|
145
|
+
items?: any;
|
|
146
|
+
example?: any;
|
|
147
|
+
}>;
|
|
148
|
+
};
|
|
149
|
+
responses?: {
|
|
150
|
+
status: number;
|
|
151
|
+
description: string;
|
|
152
|
+
example?: Record<string, any>;
|
|
153
|
+
}[];
|
|
154
|
+
};
|
|
79
155
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/core/types/index.ts"],"names":[],"mappings":""}
|
package/build/lib/index.d.ts
CHANGED
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The entry point.
|
|
3
3
|
*
|
|
4
|
-
* @module tspace-
|
|
4
|
+
* @module tspace-spear
|
|
5
5
|
*/
|
|
6
6
|
export * from './core/decorators';
|
|
7
|
-
export * from './types';
|
|
7
|
+
export * from './core/types';
|
|
8
8
|
export * from './core/server/router';
|
|
9
9
|
export * from './core/server';
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
import * as router from './core/server/router';
|
|
13
|
-
import * as server from './core/server';
|
|
14
|
-
declare const _default: {
|
|
15
|
-
decorators: typeof decorators;
|
|
16
|
-
types: typeof types;
|
|
17
|
-
router: typeof router;
|
|
18
|
-
server: typeof server;
|
|
19
|
-
};
|
|
20
|
-
export default _default;
|
|
10
|
+
import Spear from './core/server';
|
|
11
|
+
export default Spear;
|
package/build/lib/index.js
CHANGED
|
@@ -10,38 +10,22 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
11
|
o[k2] = m[k];
|
|
12
12
|
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
15
|
};
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
var result = {};
|
|
24
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
-
__setModuleDefault(result, mod);
|
|
26
|
-
return result;
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
18
|
};
|
|
28
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
20
|
/**
|
|
30
21
|
* The entry point.
|
|
31
22
|
*
|
|
32
|
-
* @module tspace-
|
|
23
|
+
* @module tspace-spear
|
|
33
24
|
*/
|
|
34
25
|
__exportStar(require("./core/decorators"), exports);
|
|
35
|
-
__exportStar(require("./types"), exports);
|
|
26
|
+
__exportStar(require("./core/types"), exports);
|
|
36
27
|
__exportStar(require("./core/server/router"), exports);
|
|
37
28
|
__exportStar(require("./core/server"), exports);
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const server = __importStar(require("./core/server"));
|
|
42
|
-
exports.default = {
|
|
43
|
-
decorators,
|
|
44
|
-
types,
|
|
45
|
-
router,
|
|
46
|
-
server
|
|
47
|
-
};
|
|
29
|
+
const server_1 = __importDefault(require("./core/server"));
|
|
30
|
+
exports.default = server_1.default;
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;IAII;AACJ,oDAAiC;AACjC,+CAA4B;AAC5B,uDAAoC;AACpC,gDAA6B;AAE7B,2DAAkC;AAElC,kBAAe,gBAAK,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const autocannon_1 = __importDefault(require("autocannon"));
|
|
16
|
+
const fastify_1 = __importDefault(require("fastify"));
|
|
17
|
+
const express_1 = __importDefault(require("express"));
|
|
18
|
+
const http_1 = __importDefault(require("http"));
|
|
19
|
+
const yargs_1 = __importDefault(require("yargs"));
|
|
20
|
+
const lib_1 = __importDefault(require("../lib"));
|
|
21
|
+
const MESSAGE = 'Hello world!';
|
|
22
|
+
const { argv } = (0, yargs_1.default)(process.argv.slice(2));
|
|
23
|
+
let duration = argv.d || argv.duration;
|
|
24
|
+
let connections = argv.c || argv.connections;
|
|
25
|
+
let pipelining = argv.p || argv.pipelining;
|
|
26
|
+
connections = connections == null ? 100 : Number(connections);
|
|
27
|
+
pipelining = pipelining == null ? 10 : Number(pipelining);
|
|
28
|
+
duration = duration == null ? 10 : Number(duration);
|
|
29
|
+
function runExpress() {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
const port = 3000;
|
|
32
|
+
(0, express_1.default)()
|
|
33
|
+
.get('/', (req, res) => {
|
|
34
|
+
res.setHeader('Content-Type', 'text/plain');
|
|
35
|
+
return res.send(MESSAGE);
|
|
36
|
+
})
|
|
37
|
+
.listen(port, () => {
|
|
38
|
+
console.log(`Server 'Express' running at http://localhost:${port}`);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function runFastify() {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
const port = 3001;
|
|
45
|
+
(0, fastify_1.default)()
|
|
46
|
+
.get('/', (request, reply) => {
|
|
47
|
+
return reply
|
|
48
|
+
.header('Content-Type', 'text/plain')
|
|
49
|
+
.send(MESSAGE);
|
|
50
|
+
})
|
|
51
|
+
.listen({ port }, (err, address) => {
|
|
52
|
+
if (err)
|
|
53
|
+
throw err;
|
|
54
|
+
console.log(`server 'Fastify' running at : http://localhost:${port}`);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function runHttp() {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
const port = 3002;
|
|
61
|
+
const server = http_1.default.createServer((req, res) => {
|
|
62
|
+
res.statusCode = 200;
|
|
63
|
+
res.setHeader('Content-Type', 'text/plain');
|
|
64
|
+
res.end(MESSAGE);
|
|
65
|
+
});
|
|
66
|
+
server.listen(port, () => {
|
|
67
|
+
console.log(`Server 'Http' running at http://localhost:${port}`);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function runSpear() {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
const port = 3100;
|
|
74
|
+
new lib_1.default()
|
|
75
|
+
.get('/', ({ res }) => {
|
|
76
|
+
return res.end(MESSAGE);
|
|
77
|
+
})
|
|
78
|
+
.listen(port, () => console.log(`server 'Spear' running at : http://localhost:${port}`));
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
const url = (port) => `http://localhost:${port}`;
|
|
82
|
+
const urls = [
|
|
83
|
+
{ name: 'express', url: url(3000) },
|
|
84
|
+
{ name: 'fastify', url: url(3001) },
|
|
85
|
+
{ name: 'http', url: url(3002) },
|
|
86
|
+
{ name: 'tspace-spear', url: url(3100) }
|
|
87
|
+
];
|
|
88
|
+
const sleep = (ms) => {
|
|
89
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
90
|
+
};
|
|
91
|
+
const runBenchmark = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
92
|
+
const results = [];
|
|
93
|
+
for (const { name, url } of urls) {
|
|
94
|
+
const result = yield new Promise((resolve, reject) => {
|
|
95
|
+
(0, autocannon_1.default)({
|
|
96
|
+
url,
|
|
97
|
+
connections,
|
|
98
|
+
duration,
|
|
99
|
+
pipelining
|
|
100
|
+
}, (err, result) => {
|
|
101
|
+
if (err)
|
|
102
|
+
return reject(err);
|
|
103
|
+
return resolve(result);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
results.push({
|
|
107
|
+
name,
|
|
108
|
+
url,
|
|
109
|
+
requests: result.requests.total,
|
|
110
|
+
average: result.latency.average
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
console.log({
|
|
114
|
+
connections,
|
|
115
|
+
duration,
|
|
116
|
+
pipelining
|
|
117
|
+
});
|
|
118
|
+
console.table(results);
|
|
119
|
+
});
|
|
120
|
+
function runApps() {
|
|
121
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
122
|
+
yield Promise.all([
|
|
123
|
+
runSpear,
|
|
124
|
+
runFastify,
|
|
125
|
+
runExpress,
|
|
126
|
+
runHttp
|
|
127
|
+
].map(v => v()));
|
|
128
|
+
yield sleep(3000);
|
|
129
|
+
console.log('benchmarking !!');
|
|
130
|
+
yield runBenchmark();
|
|
131
|
+
console.log('benchmarking done !!');
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
runApps();
|
|
135
|
+
//# sourceMappingURL=benchmark.test.js.map
|
|
@@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