tspace-spear 1.0.0 → 1.0.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.
Files changed (40) hide show
  1. package/License +1 -1
  2. package/README.md +336 -47
  3. package/build/lib/core/decorators/context.js +10 -9
  4. package/build/lib/core/decorators/context.js.map +1 -0
  5. package/build/lib/core/decorators/controller.js +1 -0
  6. package/build/lib/core/decorators/controller.js.map +1 -0
  7. package/build/lib/core/decorators/headers.js +1 -0
  8. package/build/lib/core/decorators/headers.js.map +1 -0
  9. package/build/lib/core/decorators/index.d.ts +1 -0
  10. package/build/lib/core/decorators/index.js +2 -0
  11. package/build/lib/core/decorators/index.js.map +1 -0
  12. package/build/lib/core/decorators/methods.js +1 -0
  13. package/build/lib/core/decorators/methods.js.map +1 -0
  14. package/build/lib/core/decorators/middleware.d.ts +1 -1
  15. package/build/lib/core/decorators/middleware.js +1 -0
  16. package/build/lib/core/decorators/middleware.js.map +1 -0
  17. package/build/lib/core/decorators/statusCode.js +1 -0
  18. package/build/lib/core/decorators/statusCode.js.map +1 -0
  19. package/build/lib/core/decorators/swagger.d.ts +2 -0
  20. package/build/lib/core/decorators/swagger.js +15 -0
  21. package/build/lib/core/decorators/swagger.js.map +1 -0
  22. package/build/lib/core/server/index.d.ts +53 -24
  23. package/build/lib/core/server/index.js +165 -211
  24. package/build/lib/core/server/index.js.map +1 -0
  25. package/build/lib/core/server/parser-factory.d.ts +26 -0
  26. package/build/lib/core/server/parser-factory.js +413 -0
  27. package/build/lib/core/server/parser-factory.js.map +1 -0
  28. package/build/lib/core/server/router.d.ts +2 -2
  29. package/build/lib/core/server/router.js +1 -0
  30. package/build/lib/core/server/router.js.map +1 -0
  31. package/build/lib/{types → core/types}/index.d.ts +79 -7
  32. package/build/lib/{types → core/types}/index.js +1 -0
  33. package/build/lib/core/types/index.js.map +1 -0
  34. package/build/lib/index.d.ts +4 -13
  35. package/build/lib/index.js +7 -23
  36. package/build/lib/index.js.map +1 -0
  37. package/build/tests/benchmark.test.d.ts +1 -0
  38. package/build/tests/benchmark.test.js +135 -0
  39. package/build/tests/benchmark.test.js.map +1 -0
  40. package/package.json +22 -13
@@ -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 TQuery<T = Record<string, string> | null> = T;
13
- export type TParams<T = Record<string, string> | null> = T;
14
- export type TBody<T = Record<string, string | number | boolean | undefined | null | any[] | Record<string, string | number | boolean | undefined | null | any[]>> | null> = T;
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;
15
16
  export type TCookies<T = Record<string, any> | null> = 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
- }> | null> = T;
24
+ }[]> | null> = 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 HttpStatus = {
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
- } & HttpStatus & Partial<T>;
55
+ } & THttpStatus & Partial<T>;
54
56
  export type TRouter = {
55
57
  method: TMethods;
56
58
  path: string;
@@ -76,4 +78,74 @@ export type TApplication = {
76
78
  };
77
79
  export type TRequestFunction = (ctx: TContext, next: TNextFunction) => any;
78
80
  export type TErrorFunction = (err: Error, ctx: TContext) => any;
81
+ 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";
82
+ type TSwaggerType = "string" | "number" | "integer" | "boolean" | "object" | "array" | "date" | "date-time" | "file";
83
+ export type TSwaggerDoc = {
84
+ path?: `/${string}`;
85
+ staticUrl?: `${string}`;
86
+ servers?: {
87
+ url: string;
88
+ description?: string;
89
+ }[];
90
+ tags?: string[];
91
+ info?: {
92
+ title?: string;
93
+ description?: string;
94
+ version?: string;
95
+ };
96
+ routes: {
97
+ path: string;
98
+ method: string;
99
+ params: string[];
100
+ }[];
101
+ options: (TSwagger & {
102
+ path: string;
103
+ method: string;
104
+ })[];
105
+ responses?: {
106
+ status: number;
107
+ description: string;
108
+ example?: Record<string, any>;
109
+ }[];
110
+ };
111
+ export type TSwagger = {
112
+ staticUrl?: string;
113
+ description?: string;
114
+ bearerToken?: boolean;
115
+ tags?: string[];
116
+ query?: Record<string, {
117
+ required?: boolean;
118
+ description?: string;
119
+ type: TSwaggerType;
120
+ example?: any;
121
+ }>;
122
+ cookies?: {
123
+ names: string[];
124
+ required?: boolean;
125
+ description?: string;
126
+ };
127
+ body?: {
128
+ required?: boolean;
129
+ description?: string;
130
+ properties: Record<string, {
131
+ type: TSwaggerType;
132
+ example?: any;
133
+ }>;
134
+ };
135
+ files?: {
136
+ required?: boolean;
137
+ description?: string;
138
+ properties: Record<string, {
139
+ type: TSwaggerType;
140
+ format?: TSwaggerFormat;
141
+ items?: any;
142
+ example?: any;
143
+ }>;
144
+ };
145
+ responses?: {
146
+ status: number;
147
+ description: string;
148
+ example?: Record<string, any>;
149
+ }[];
150
+ };
79
151
  export {};
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/core/types/index.ts"],"names":[],"mappings":""}
@@ -1,20 +1,11 @@
1
1
  /**
2
2
  * The entry point.
3
3
  *
4
- * @module tspace-ez-node
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 * as decorators from './core/decorators';
11
- import * as types from './types';
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;
@@ -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 __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
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-ez-node
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 decorators = __importStar(require("./core/decorators"));
39
- const types = __importStar(require("./types"));
40
- const router = __importStar(require("./core/server/router"));
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.send(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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"benchmark.test.js","sourceRoot":"","sources":["../../src/tests/benchmark.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,4DAAgD;AAChD,sDAA6B;AAC7B,sDAAoD;AACpD,gDAAuB;AACvB,kDAA0B;AAC1B,iDAA0B;AAE1B,MAAM,OAAO,GAAG,cAAc,CAAA;AAE9B,MAAM,EAAE,IAAI,EAAE,GAAwB,IAAA,eAAK,EAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;AAClE,IAAI,QAAQ,GAAG,IAAI,CAAC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e,OAAO;;QAElB,MAAM,OAAO,CAAC,GAAG,CAAC;YACd,QAAQ;YACR,UAAU;YACV,UAAU;YACV,OAAO;SACV,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QAEhB,MAAM,KAAK,CAAC,IAAI,CAAC,CAAA;QACjB,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAA;QAC9B,MAAM,YAAY,EAAE,CAAA;QAEpB,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAA;IACvC,CAAC;CAAA;AAED,OAAO,EAAE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tspace-spear",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Build a REST API with high speed using a native HTTP server for Node.js.",
5
5
  "main": "./build/lib/index.js",
6
6
  "types": "./build/lib/index.d.ts",
@@ -13,15 +13,10 @@
13
13
  },
14
14
  "keywords": [
15
15
  "tspace",
16
- "spear",
17
- "fast",
18
- "http",
19
- "node",
20
- "rest api",
21
- "decorators",
22
- "middlewares",
23
- "controllers",
24
- "routers"
16
+ "tspace-spear",
17
+ "web",
18
+ "framework",
19
+ "web framework"
25
20
  ],
26
21
  "author": "Thanathip (https://github.com/thanathip41)",
27
22
  "license": "MIT",
@@ -31,17 +26,31 @@
31
26
  "homepage": "https://github.com/thanathip41",
32
27
  "scripts": {
33
28
  "build": "tsc",
34
- "prepare": "npm run build"
29
+ "prepare": "npm run build",
30
+ "test": "ts-node src/tests/benchmark.test.ts",
31
+ "test:build": "node build/tests/benchmark.test.js"
35
32
  },
36
33
  "devDependencies": {
34
+ "@types/autocannon": "^7.12.5",
35
+ "@types/express": "^4.17.21",
37
36
  "@types/formidable": "^3.4.5",
37
+ "@types/mime-types": "^2.1.4",
38
38
  "@types/node": "^16.4.0",
39
- "@types/on-finished": "^2.3.4"
39
+ "@types/on-finished": "^2.3.4",
40
+ "@types/swagger-ui-dist": "^3.30.4",
41
+ "@types/yargs": "^17.0.32",
42
+ "autocannon": "^7.15.0",
43
+ "express": "^4.19.2",
44
+ "fastify": "^4.28.1",
45
+ "typescript": "^5.4.5",
46
+ "yargs": "^17.7.2"
40
47
  },
41
48
  "dependencies": {
42
49
  "find-my-way": "^8.1.0",
43
50
  "formidable": "^3.5.1",
51
+ "mime-types": "^2.1.35",
44
52
  "on-finished": "^2.4.1",
45
- "reflect-metadata": "^0.1.14"
53
+ "reflect-metadata": "^0.1.14",
54
+ "swagger-ui-dist": "^5.17.10"
46
55
  }
47
56
  }