tspace-spear 1.0.9 → 1.1.1
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/build/lib/core/decorators/context.js +25 -49
- package/build/lib/core/decorators/context.js.map +1 -1
- package/build/lib/core/decorators/headers.js +3 -14
- package/build/lib/core/decorators/headers.js.map +1 -1
- package/build/lib/core/decorators/statusCode.js +3 -14
- package/build/lib/core/decorators/statusCode.js.map +1 -1
- package/build/lib/core/decorators/swagger.js +4 -1
- package/build/lib/core/decorators/swagger.js.map +1 -1
- package/build/lib/core/server/index.d.ts +32 -20
- package/build/lib/core/server/index.js +275 -262
- package/build/lib/core/server/index.js.map +1 -1
- package/build/lib/core/server/parser-factory.js +85 -91
- package/build/lib/core/server/parser-factory.js.map +1 -1
- package/build/lib/core/server/router.js +1 -3
- package/build/lib/core/server/router.js.map +1 -1
- package/build/lib/core/types/index.d.ts +7 -0
- package/build/tests/benchmark.test.js +50 -71
- package/build/tests/benchmark.test.js.map +1 -1
- package/package.json +60 -61
|
@@ -1,26 +1,14 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.Cookies = exports.Query = exports.Params = exports.Files = exports.Body = void 0;
|
|
13
4
|
const Body = (...bodyParms) => {
|
|
14
5
|
return function (target, key, descriptor) {
|
|
15
6
|
const originalMethod = descriptor.value;
|
|
16
|
-
descriptor.value = function (ctx, next) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
ctx.body = Object.keys(body).length ? body : {};
|
|
22
|
-
return yield originalMethod.call(this, ctx, next);
|
|
23
|
-
});
|
|
7
|
+
descriptor.value = async function (ctx, next) {
|
|
8
|
+
const q = ctx?.body ?? {};
|
|
9
|
+
const body = bodyParms.reduce((acc, key) => (q[key] != null ? { ...acc, [key]: q[key] } : acc), {});
|
|
10
|
+
ctx.body = Object.keys(body).length ? body : {};
|
|
11
|
+
return await originalMethod.call(this, ctx, next);
|
|
24
12
|
};
|
|
25
13
|
return descriptor;
|
|
26
14
|
};
|
|
@@ -29,14 +17,11 @@ exports.Body = Body;
|
|
|
29
17
|
const Files = (...filesParms) => {
|
|
30
18
|
return function (target, key, descriptor) {
|
|
31
19
|
const originalMethod = descriptor.value;
|
|
32
|
-
descriptor.value = function (ctx, next) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
ctx.files = Object.keys(files).length ? files : {};
|
|
38
|
-
return yield originalMethod.call(this, ctx, next);
|
|
39
|
-
});
|
|
20
|
+
descriptor.value = async function (ctx, next) {
|
|
21
|
+
const q = ctx?.files ?? {};
|
|
22
|
+
const files = filesParms.reduce((acc, key) => (q[key] != null ? { ...acc, [key]: q[key] } : acc), {});
|
|
23
|
+
ctx.files = Object.keys(files).length ? files : {};
|
|
24
|
+
return await originalMethod.call(this, ctx, next);
|
|
40
25
|
};
|
|
41
26
|
return descriptor;
|
|
42
27
|
};
|
|
@@ -45,14 +30,11 @@ exports.Files = Files;
|
|
|
45
30
|
const Params = (...paramsData) => {
|
|
46
31
|
return function (target, key, descriptor) {
|
|
47
32
|
const originalMethod = descriptor.value;
|
|
48
|
-
descriptor.value = function (ctx, next) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
ctx.params = Object.keys(params).length ? params : {};
|
|
54
|
-
return yield originalMethod.call(this, ctx, next);
|
|
55
|
-
});
|
|
33
|
+
descriptor.value = async function (ctx, next) {
|
|
34
|
+
const q = ctx?.params ?? {};
|
|
35
|
+
const params = paramsData.reduce((acc, key) => (q[key] != null ? { ...acc, [key]: q[key] } : acc), {});
|
|
36
|
+
ctx.params = Object.keys(params).length ? params : {};
|
|
37
|
+
return await originalMethod.call(this, ctx, next);
|
|
56
38
|
};
|
|
57
39
|
return descriptor;
|
|
58
40
|
};
|
|
@@ -61,14 +43,11 @@ exports.Params = Params;
|
|
|
61
43
|
const Query = (...queryParms) => {
|
|
62
44
|
return function (target, key, descriptor) {
|
|
63
45
|
const originalMethod = descriptor.value;
|
|
64
|
-
descriptor.value = function (ctx, next) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
ctx.query = Object.keys(query).length ? query : {};
|
|
70
|
-
return yield originalMethod.call(this, ctx, next);
|
|
71
|
-
});
|
|
46
|
+
descriptor.value = async function (ctx, next) {
|
|
47
|
+
const q = ctx?.query ?? {};
|
|
48
|
+
const query = queryParms.reduce((acc, key) => (q[key] != null ? { ...acc, [key]: q[key] } : acc), {});
|
|
49
|
+
ctx.query = Object.keys(query).length ? query : {};
|
|
50
|
+
return await originalMethod.call(this, ctx, next);
|
|
72
51
|
};
|
|
73
52
|
return descriptor;
|
|
74
53
|
};
|
|
@@ -77,14 +56,11 @@ exports.Query = Query;
|
|
|
77
56
|
const Cookies = (...cookiesParms) => {
|
|
78
57
|
return function (target, key, descriptor) {
|
|
79
58
|
const originalMethod = descriptor.value;
|
|
80
|
-
descriptor.value = function (ctx, next) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
ctx.cookies = Object.keys(cookies).length ? cookies : {};
|
|
86
|
-
return yield originalMethod.call(this, ctx, next);
|
|
87
|
-
});
|
|
59
|
+
descriptor.value = async function (ctx, next) {
|
|
60
|
+
const q = ctx?.cookies ?? {};
|
|
61
|
+
const cookies = cookiesParms.reduce((acc, key) => (q[key] != null ? { ...acc, [key]: q[key] } : acc), {});
|
|
62
|
+
ctx.cookies = Object.keys(cookies).length ? cookies : {};
|
|
63
|
+
return await originalMethod.call(this, ctx, next);
|
|
88
64
|
};
|
|
89
65
|
return descriptor;
|
|
90
66
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/lib/core/decorators/context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/lib/core/decorators/context.ts"],"names":[],"mappings":";;;AAEO,MAAM,IAAI,GAAG,CAAC,GAAG,SAAoB,EAAE,EAAE;IAC5C,OAAO,UAAS,MAAW,EAAE,GAAW,EAAE,UAA8B;QACpE,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;QAExC,UAAU,CAAC,KAAK,GAAG,KAAK,WAAU,GAAc,EAAG,IAAmB;YAClE,MAAM,CAAC,GAAG,GAAG,EAAE,IAAI,IAAI,EAAE,CAAA;YACzB,MAAM,IAAI,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAA;YACnG,GAAG,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAA;YAE/C,OAAO,MAAM,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAG,IAAI,CAAC,CAAC;QACvD,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, _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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.WriteHeader = void 0;
|
|
13
4
|
const WriteHeader = (statusCode, contentType) => {
|
|
14
5
|
return (target, key, descriptor) => {
|
|
15
6
|
const originalMethod = descriptor.value;
|
|
16
|
-
descriptor.value = function (ctx, next) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return yield originalMethod.call(this, ctx, next);
|
|
20
|
-
});
|
|
7
|
+
descriptor.value = async function (ctx, next) {
|
|
8
|
+
ctx.res.writeHead(...[statusCode, contentType]);
|
|
9
|
+
return await originalMethod.call(this, ctx, next);
|
|
21
10
|
};
|
|
22
11
|
return descriptor;
|
|
23
12
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"headers.js","sourceRoot":"","sources":["../../../../src/lib/core/decorators/headers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"headers.js","sourceRoot":"","sources":["../../../../src/lib/core/decorators/headers.ts"],"names":[],"mappings":";;;AAGO,MAAO,WAAW,GAAG,CAAC,UAAmB,EAAG,WAAiC,EAAE,EAAE;IACpF,OAAO,CAAC,MAAW,EAAE,GAAW,EAAE,UAA8B,EAAE,EAAE;QAChE,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;QAExC,UAAU,CAAC,KAAK,GAAG,KAAK,WAAU,GAAc,EAAG,IAAmB;YAClE,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAE,UAAU,EAAG,WAAW,CAAE,CAAC,CAAA;YAClD,OAAO,MAAM,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAG,IAAI,CAAC,CAAC;QACvD,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACtB,CAAC,CAAC;AACN,CAAC,CAAA;AAXa,QAAA,WAAW,eAWxB"}
|
|
@@ -1,24 +1,13 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.StatusCode = void 0;
|
|
13
4
|
const StatusCode = (statusCode) => {
|
|
14
5
|
return (target, key, descriptor) => {
|
|
15
6
|
const originalMethod = descriptor.value;
|
|
16
7
|
statusCode = statusCode < 100 ? 100 : statusCode > 599 ? 599 : statusCode;
|
|
17
|
-
descriptor.value = function (ctx, next) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return yield originalMethod.call(this, ctx, next);
|
|
21
|
-
});
|
|
8
|
+
descriptor.value = async function (ctx, next) {
|
|
9
|
+
ctx.res.writeHead(statusCode, { 'Content-Type': 'application/json' });
|
|
10
|
+
return await originalMethod.call(this, ctx, next);
|
|
22
11
|
};
|
|
23
12
|
return descriptor;
|
|
24
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statusCode.js","sourceRoot":"","sources":["../../../../src/lib/core/decorators/statusCode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"statusCode.js","sourceRoot":"","sources":["../../../../src/lib/core/decorators/statusCode.ts"],"names":[],"mappings":";;;AAEO,MAAO,UAAU,GAAG,CAAC,UAAmB,EAAE,EAAE;IAC/C,OAAO,CAAC,MAAW,EAAE,GAAW,EAAE,UAA8B,EAAE,EAAE;QAChE,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;QAExC,UAAU,GAAG,UAAU,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC;QAE1E,UAAU,CAAC,KAAK,GAAG,KAAK,WAAU,GAAc,EAAG,IAAmB;YAClE,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,UAAU,EAAG,EAAE,cAAc,EAAE,kBAAkB,EAAC,CAAC,CAAA;YACrE,OAAO,MAAM,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAG,IAAI,CAAC,CAAC;QACvD,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACtB,CAAC,CAAC;AACN,CAAC,CAAA;AAba,QAAA,UAAU,cAavB"}
|
|
@@ -7,7 +7,10 @@ const Swagger = (data) => {
|
|
|
7
7
|
const swaggers = Reflect.hasMetadata("swaggers", controller)
|
|
8
8
|
? Reflect.getMetadata("swaggers", controller)
|
|
9
9
|
: [];
|
|
10
|
-
swaggers.push(
|
|
10
|
+
swaggers.push({
|
|
11
|
+
handler: propertyKey,
|
|
12
|
+
...data
|
|
13
|
+
});
|
|
11
14
|
Reflect.defineMetadata("swaggers", swaggers, controller);
|
|
12
15
|
};
|
|
13
16
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swagger.js","sourceRoot":"","sources":["../../../../src/lib/core/decorators/swagger.ts"],"names":[],"mappings":";;;AAEO,MAAM,OAAO,GAAG,CAAC,IAAe,EAAE,EAAE;IACvC,OAAO,CAAC,MAAW,EAAE,WAAgB,EAAE,EAAE;QACrC,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC;QAEtC,MAAM,QAAQ,GAAU,OAAO,CAAC,WAAW,CAAC,UAAU,EAAE,UAAU,CAAC;YACnE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,UAAU,EAAE,UAAU,CAAC;YAC7C,CAAC,CAAC,EAAE,CAAC;QAEL,QAAQ,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"swagger.js","sourceRoot":"","sources":["../../../../src/lib/core/decorators/swagger.ts"],"names":[],"mappings":";;;AAEO,MAAM,OAAO,GAAG,CAAC,IAAe,EAAE,EAAE;IACvC,OAAO,CAAC,MAAW,EAAE,WAAgB,EAAE,EAAE;QACrC,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC;QAEtC,MAAM,QAAQ,GAAU,OAAO,CAAC,WAAW,CAAC,UAAU,EAAE,UAAU,CAAC;YACnE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,UAAU,EAAE,UAAU,CAAC;YAC7C,CAAC,CAAC,EAAE,CAAC;QAEL,QAAQ,CAAC,IAAI,CAAC;YACV,OAAO,EAAE,WAAW;YACpB,GAAG,IAAI;SACV,CAAC,CAAC;QAEH,OAAO,CAAC,cAAc,CAAC,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IAC3D,CAAC,CAAA;AACL,CAAC,CAAA;AAfU,QAAA,OAAO,WAejB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Server, ServerResponse } from 'http';
|
|
2
|
-
import findMyWayRouter from 'find-my-way';
|
|
2
|
+
import findMyWayRouter, { Instance } from 'find-my-way';
|
|
3
3
|
import { Router } from './router';
|
|
4
4
|
import type { TContext, TNextFunction, TApplication } from '../types';
|
|
5
5
|
/**
|
|
@@ -33,8 +33,18 @@ declare class Spear {
|
|
|
33
33
|
private _onListeners;
|
|
34
34
|
private _fileUploadOptions;
|
|
35
35
|
constructor({ controllers, middlewares, globalPrefix, logger, cluster }?: TApplication);
|
|
36
|
+
/**
|
|
37
|
+
* The get 'instance' method is used to get the instance of Spear.
|
|
38
|
+
*
|
|
39
|
+
* @returns {this}
|
|
40
|
+
*/
|
|
36
41
|
get instance(): this;
|
|
37
|
-
|
|
42
|
+
/**
|
|
43
|
+
* The get 'routers' method is used get the all routers.
|
|
44
|
+
*
|
|
45
|
+
* @returns {Instance<findMyWayRouter.HTTPVersion.V1>}
|
|
46
|
+
*/
|
|
47
|
+
get routers(): Instance<findMyWayRouter.HTTPVersion.V1>;
|
|
38
48
|
/**
|
|
39
49
|
* The 'use' method is used to add the middleware into the request pipeline.
|
|
40
50
|
*
|
|
@@ -57,16 +67,25 @@ declare class Spear {
|
|
|
57
67
|
exceptPath?: string[] | RegExp;
|
|
58
68
|
}): this;
|
|
59
69
|
/**
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
* The 'useBodyParser' method is a middleware used to parse the request body of incoming HTTP requests.
|
|
71
|
+
* @param {object?}
|
|
72
|
+
* @property {array?} except the body parser with some methods
|
|
73
|
+
* @returns {this}
|
|
74
|
+
*/
|
|
75
|
+
useBodyParser({ except }?: {
|
|
76
|
+
except?: ('GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE')[];
|
|
77
|
+
}): this;
|
|
78
|
+
/**
|
|
79
|
+
* The 'useFileUpload' method is a middleware used to handler file uploads. It adds a file upload of incoming HTTP requests.
|
|
80
|
+
*
|
|
81
|
+
* @param {?Object}
|
|
82
|
+
* @property {?number} limits
|
|
83
|
+
* @property {?string} tempFileDir
|
|
84
|
+
* @property {?Object} removeTempFile
|
|
85
|
+
* @property {boolean} removeTempFile.remove
|
|
86
|
+
* @property {number} removeTempFile.ms
|
|
87
|
+
* @returns
|
|
88
|
+
*/
|
|
70
89
|
useFileUpload({ limit, tempFileDir, removeTempFile }?: {
|
|
71
90
|
limit?: number;
|
|
72
91
|
tempFileDir?: string;
|
|
@@ -75,12 +94,6 @@ declare class Spear {
|
|
|
75
94
|
ms: number;
|
|
76
95
|
};
|
|
77
96
|
}): this;
|
|
78
|
-
/**
|
|
79
|
-
* The 'useBodyParser' method is a middleware used to parse the request body of incoming HTTP requests.
|
|
80
|
-
*
|
|
81
|
-
* @returns {this}
|
|
82
|
-
*/
|
|
83
|
-
useBodyParser(): this;
|
|
84
97
|
/**
|
|
85
98
|
* The 'useCookiesParser' method is a middleware used to parses cookies attached to the client request object.
|
|
86
99
|
*
|
|
@@ -163,8 +176,7 @@ declare class Spear {
|
|
|
163
176
|
* @param {function} notfound
|
|
164
177
|
* @returns
|
|
165
178
|
*/
|
|
166
|
-
notFoundHandler(
|
|
167
|
-
low(path: string, ...handlers: ((ctx: TContext, next: TNextFunction) => any)[]): this;
|
|
179
|
+
notFoundHandler(fn: (ctx: TContext) => any): this;
|
|
168
180
|
/**
|
|
169
181
|
* The 'get' method is used to add the request handler to the router for the 'GET' method.
|
|
170
182
|
*
|