@forklaunch/hyper-express 0.1.1 → 0.1.3

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 (72) hide show
  1. package/lib/config.d.ts +2 -0
  2. package/lib/config.d.ts.map +1 -0
  3. package/lib/config.js +1 -0
  4. package/lib/eslint.config.d.mts +3 -0
  5. package/lib/eslint.config.d.mts.map +1 -0
  6. package/lib/eslint.config.mjs +10 -0
  7. package/lib/index.d.ts +23 -0
  8. package/lib/index.d.ts.map +1 -0
  9. package/lib/index.js +25 -0
  10. package/lib/jest.config.d.ts +4 -0
  11. package/lib/jest.config.d.ts.map +1 -0
  12. package/lib/jest.config.js +19 -0
  13. package/lib/src/hyperExpressApplication.d.ts +36 -0
  14. package/lib/src/hyperExpressApplication.d.ts.map +1 -0
  15. package/lib/src/hyperExpressApplication.js +70 -0
  16. package/lib/src/hyperExpressRouter.d.ts +10 -0
  17. package/lib/src/hyperExpressRouter.d.ts.map +1 -0
  18. package/lib/src/hyperExpressRouter.js +22 -0
  19. package/lib/src/middleware/contentParse.middleware.d.ts +8 -0
  20. package/lib/src/middleware/contentParse.middleware.d.ts.map +1 -0
  21. package/lib/src/middleware/contentParse.middleware.js +26 -0
  22. package/lib/src/middleware/enrichResponseTransmission.middleware.d.ts +14 -0
  23. package/lib/src/middleware/enrichResponseTransmission.middleware.d.ts.map +1 -0
  24. package/{dist/middleware/response.middleware.js → lib/src/middleware/enrichResponseTransmission.middleware.js} +19 -17
  25. package/lib/src/middleware/polyfillGetHeaders.middleware.d.ts +3 -0
  26. package/lib/src/middleware/polyfillGetHeaders.middleware.d.ts.map +1 -0
  27. package/lib/src/middleware/polyfillGetHeaders.middleware.js +8 -0
  28. package/{dist → lib/src}/middleware/swagger.middleware.d.ts +1 -0
  29. package/lib/src/middleware/swagger.middleware.d.ts.map +1 -0
  30. package/{dist → lib/src}/middleware/swagger.middleware.js +9 -19
  31. package/lib/src/types/hyperExpress.types.d.ts +42 -0
  32. package/lib/src/types/hyperExpress.types.d.ts.map +1 -0
  33. package/lib/tests/typebox.forklaunch.hyperExpress.test.d.ts +2 -0
  34. package/lib/tests/typebox.forklaunch.hyperExpress.test.d.ts.map +1 -0
  35. package/{dist/tests/zod.forklaunch.hyperExpress.test.js → lib/tests/typebox.forklaunch.hyperExpress.test.js} +23 -53
  36. package/lib/tests/zod.forklaunch.hyperExpress.test.d.ts +2 -0
  37. package/lib/tests/zod.forklaunch.hyperExpress.test.d.ts.map +1 -0
  38. package/{dist/tests/typebox.forklaunch.hyperExpress.test.js → lib/tests/zod.forklaunch.hyperExpress.test.js} +22 -54
  39. package/lib/tsconfig.tsbuildinfo +1 -0
  40. package/lib/vitest.config.d.ts +3 -0
  41. package/lib/vitest.config.d.ts.map +1 -0
  42. package/lib/vitest.config.js +7 -0
  43. package/package.json +27 -14
  44. package/.prettierignore +0 -2
  45. package/.prettierrc +0 -7
  46. package/dist/forklaunch.hyperExpress.d.ts +0 -192
  47. package/dist/forklaunch.hyperExpress.js +0 -358
  48. package/dist/forklaunch.hyperExpress.js.map +0 -1
  49. package/dist/jest.config.d.ts +0 -3
  50. package/dist/jest.config.js.map +0 -1
  51. package/dist/main.js +0 -90
  52. package/dist/main.js.map +0 -1
  53. package/dist/middleware/contentParse.middleware.d.ts +0 -7
  54. package/dist/middleware/contentParse.middleware.js +0 -30
  55. package/dist/middleware/contentParse.middleware.js.map +0 -1
  56. package/dist/middleware/response.middleware.d.ts +0 -12
  57. package/dist/middleware/response.middleware.js.map +0 -1
  58. package/dist/middleware/swagger.middleware.js.map +0 -1
  59. package/dist/tests/typebox.forklaunch.hyperExpress.test.d.ts +0 -1
  60. package/dist/tests/typebox.forklaunch.hyperExpress.test.js.map +0 -1
  61. package/dist/tests/zod.forklaunch.hyperExpress.test.d.ts +0 -1
  62. package/dist/tests/zod.forklaunch.hyperExpress.test.js.map +0 -1
  63. package/dist/types/forklaunch.hyperExpress.types.d.ts +0 -67
  64. package/dist/types/forklaunch.hyperExpress.types.js +0 -3
  65. package/dist/types/forklaunch.hyperExpress.types.js.map +0 -1
  66. package/eslint.config.mjs +0 -12
  67. package/forklaunch.hyperExpress.ts +0 -649
  68. package/jest.config.ts +0 -10
  69. package/main.ts +0 -97
  70. package/tests/typebox.forklaunch.hyperExpress.test.ts +0 -164
  71. package/tests/zod.forklaunch.hyperExpress.test.ts +0 -164
  72. /package/{dist/main.d.ts → lib/src/types/hyperExpress.types.js} +0 -0
@@ -1,56 +1,27 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
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
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- const zod_1 = require("@forklaunch/validator/zod");
27
- const kill_port_process_1 = require("kill-port-process");
28
- const forklaunch_hyperExpress_1 = __importStar(require("../forklaunch.hyperExpress"));
29
- const zodSchemaValidator = new zod_1.ZodSchemaValidator();
1
+ import { SchemaValidator, string } from '@forklaunch/validator/typebox';
2
+ import { forklaunchExpress, forklaunchRouter } from '../index';
3
+ const typeboxSchemaValidator = SchemaValidator();
4
+ const forklaunchApplication = forklaunchExpress(typeboxSchemaValidator);
5
+ const forklaunchRouterInstance = forklaunchRouter('/testpath', typeboxSchemaValidator);
30
6
  describe('Forklaunch Hyper-Express Tests', () => {
31
- let forklaunchApplication;
32
- let forklaunchRouterInstance;
33
7
  beforeAll(async () => {
34
- await (0, kill_port_process_1.killPortProcess)(6935);
35
- forklaunchApplication = (0, forklaunch_hyperExpress_1.default)(zodSchemaValidator);
36
- forklaunchRouterInstance = (0, forklaunch_hyperExpress_1.forklaunchRouter)('/testpath', zodSchemaValidator);
37
8
  forklaunchRouterInstance.get('/test', {
38
9
  name: 'Test',
39
10
  summary: 'Test Summary',
40
11
  responses: {
41
- 200: zod_1.string
12
+ 200: string
42
13
  }
43
- }, (req, res) => {
14
+ }, (_req, res) => {
44
15
  res.status(200).send('Hello World');
45
16
  });
46
17
  forklaunchRouterInstance.post('/test', {
47
18
  name: 'Test',
48
19
  summary: 'Test Summary',
49
20
  body: {
50
- test: zod_1.string
21
+ test: string
51
22
  },
52
23
  responses: {
53
- 200: zod_1.string
24
+ 200: string
54
25
  }
55
26
  }, (req, res) => {
56
27
  res.status(200).send(req.body.test);
@@ -59,10 +30,10 @@ describe('Forklaunch Hyper-Express Tests', () => {
59
30
  name: 'Test',
60
31
  summary: 'Test Summary',
61
32
  body: {
62
- test: zod_1.string
33
+ test: string
63
34
  },
64
35
  responses: {
65
- 200: zod_1.string
36
+ 200: string
66
37
  }
67
38
  }, (req, res) => {
68
39
  res.status(200).send(req.body.test);
@@ -71,10 +42,10 @@ describe('Forklaunch Hyper-Express Tests', () => {
71
42
  name: 'Test',
72
43
  summary: 'Test Summary',
73
44
  body: {
74
- test: zod_1.string
45
+ test: string
75
46
  },
76
47
  responses: {
77
- 200: zod_1.string
48
+ 200: string
78
49
  }
79
50
  }, (req, res) => {
80
51
  res.status(200).send(req.body.test);
@@ -83,25 +54,25 @@ describe('Forklaunch Hyper-Express Tests', () => {
83
54
  name: 'Test',
84
55
  summary: 'Test Summary',
85
56
  responses: {
86
- 200: zod_1.string
57
+ 200: string
87
58
  }
88
- }, (req, res) => {
59
+ }, (_req, res) => {
89
60
  res.status(200).send('Hello World');
90
61
  });
91
62
  forklaunchApplication.use(forklaunchRouterInstance);
92
- await forklaunchApplication.listen(6935, () => {
93
- console.log('Server started');
63
+ await forklaunchApplication.listen(6936, () => {
64
+ console.log('server started on 6936');
94
65
  });
95
66
  });
96
67
  test('Get', async () => {
97
- const testGet = await fetch('http://localhost:6934/testpath/test', {
68
+ const testGet = await fetch('http://localhost:6936/testpath/test', {
98
69
  method: 'GET'
99
70
  });
100
71
  expect(testGet.status).toBe(200);
101
72
  expect(await testGet.text()).toBe('Hello World');
102
73
  });
103
74
  test('Post', async () => {
104
- const testPost = await fetch('http://localhost:6934/testpath/test', {
75
+ const testPost = await fetch('http://localhost:6936/testpath/test', {
105
76
  method: 'POST',
106
77
  body: JSON.stringify({ test: 'Hello World' }),
107
78
  headers: { 'Content-Type': 'application/json' }
@@ -110,7 +81,7 @@ describe('Forklaunch Hyper-Express Tests', () => {
110
81
  expect(await testPost.text()).toBe('Hello World');
111
82
  });
112
83
  test('Put', async () => {
113
- const testPut = await fetch('http://localhost:6934/testpath/test', {
84
+ const testPut = await fetch('http://localhost:6936/testpath/test', {
114
85
  method: 'PUT',
115
86
  body: JSON.stringify({ test: 'Hello World' }),
116
87
  headers: { 'Content-Type': 'application/json' }
@@ -119,7 +90,7 @@ describe('Forklaunch Hyper-Express Tests', () => {
119
90
  expect(await testPut.text()).toBe('Hello World');
120
91
  });
121
92
  test('Patch', async () => {
122
- const testPatch = await fetch('http://localhost:6934/testpath/test', {
93
+ const testPatch = await fetch('http://localhost:6936/testpath/test', {
123
94
  method: 'PATCH',
124
95
  body: JSON.stringify({ test: 'Hello World' }),
125
96
  headers: { 'Content-Type': 'application/json' }
@@ -128,14 +99,13 @@ describe('Forklaunch Hyper-Express Tests', () => {
128
99
  expect(await testPatch.text()).toBe('Hello World');
129
100
  });
130
101
  test('Delete', async () => {
131
- const testDelete = await fetch('http://localhost:6934/testpath/test', {
102
+ const testDelete = await fetch('http://localhost:6936/testpath/test', {
132
103
  method: 'DELETE'
133
104
  });
134
105
  expect(testDelete.status).toBe(200);
135
106
  expect(await testDelete.text()).toBe('Hello World');
136
107
  });
137
108
  afterAll(async () => {
138
- setTimeout(async () => await (0, kill_port_process_1.killPortProcess)(6935), 500);
109
+ forklaunchApplication.internal.shutdown();
139
110
  });
140
111
  });
141
- //# sourceMappingURL=zod.forklaunch.hyperExpress.test.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=zod.forklaunch.hyperExpress.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zod.forklaunch.hyperExpress.test.d.ts","sourceRoot":"","sources":["../../tests/zod.forklaunch.hyperExpress.test.ts"],"names":[],"mappings":""}
@@ -1,56 +1,27 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
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
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- const typebox_1 = require("@forklaunch/validator/typebox");
27
- const kill_port_process_1 = require("kill-port-process");
28
- const forklaunch_hyperExpress_1 = __importStar(require("../forklaunch.hyperExpress"));
29
- const typeboxSchemaValidator = new typebox_1.TypeboxSchemaValidator();
1
+ import { SchemaValidator, string } from '@forklaunch/validator/zod';
2
+ import { forklaunchExpress, forklaunchRouter } from '../index';
3
+ const zodSchemaValidator = SchemaValidator();
4
+ const forklaunchApplication = forklaunchExpress(zodSchemaValidator);
5
+ const forklaunchRouterInstance = forklaunchRouter('/testpath', zodSchemaValidator);
30
6
  describe('Forklaunch Hyper-Express Tests', () => {
31
- let forklaunchApplication;
32
- let forklaunchRouterInstance;
33
7
  beforeAll(async () => {
34
- await (0, kill_port_process_1.killPortProcess)(6934);
35
- forklaunchApplication = (0, forklaunch_hyperExpress_1.default)(typeboxSchemaValidator);
36
- forklaunchRouterInstance = (0, forklaunch_hyperExpress_1.forklaunchRouter)('/testpath', typeboxSchemaValidator);
37
8
  forklaunchRouterInstance.get('/test', {
38
9
  name: 'Test',
39
10
  summary: 'Test Summary',
40
11
  responses: {
41
- 200: typebox_1.string
12
+ 200: string
42
13
  }
43
- }, (req, res) => {
14
+ }, (_req, res) => {
44
15
  res.status(200).send('Hello World');
45
16
  });
46
17
  forklaunchRouterInstance.post('/test', {
47
18
  name: 'Test',
48
19
  summary: 'Test Summary',
49
20
  body: {
50
- test: typebox_1.string
21
+ test: string
51
22
  },
52
23
  responses: {
53
- 200: typebox_1.string
24
+ 200: string
54
25
  }
55
26
  }, (req, res) => {
56
27
  res.status(200).send(req.body.test);
@@ -59,10 +30,10 @@ describe('Forklaunch Hyper-Express Tests', () => {
59
30
  name: 'Test',
60
31
  summary: 'Test Summary',
61
32
  body: {
62
- test: typebox_1.string
33
+ test: string
63
34
  },
64
35
  responses: {
65
- 200: typebox_1.string
36
+ 200: string
66
37
  }
67
38
  }, (req, res) => {
68
39
  res.status(200).send(req.body.test);
@@ -71,10 +42,10 @@ describe('Forklaunch Hyper-Express Tests', () => {
71
42
  name: 'Test',
72
43
  summary: 'Test Summary',
73
44
  body: {
74
- test: typebox_1.string
45
+ test: string
75
46
  },
76
47
  responses: {
77
- 200: typebox_1.string
48
+ 200: string
78
49
  }
79
50
  }, (req, res) => {
80
51
  res.status(200).send(req.body.test);
@@ -83,25 +54,23 @@ describe('Forklaunch Hyper-Express Tests', () => {
83
54
  name: 'Test',
84
55
  summary: 'Test Summary',
85
56
  responses: {
86
- 200: typebox_1.string
57
+ 200: string
87
58
  }
88
- }, (req, res) => {
59
+ }, (_req, res) => {
89
60
  res.status(200).send('Hello World');
90
61
  });
91
62
  forklaunchApplication.use(forklaunchRouterInstance);
92
- await forklaunchApplication.listen(6934, () => {
93
- console.log('Server started');
94
- });
63
+ await forklaunchApplication.listen(6937, () => { });
95
64
  });
96
65
  test('Get', async () => {
97
- const testGet = await fetch('http://localhost:6934/testpath/test', {
66
+ const testGet = await fetch('http://localhost:6937/testpath/test', {
98
67
  method: 'GET'
99
68
  });
100
69
  expect(testGet.status).toBe(200);
101
70
  expect(await testGet.text()).toBe('Hello World');
102
71
  });
103
72
  test('Post', async () => {
104
- const testPost = await fetch('http://localhost:6934/testpath/test', {
73
+ const testPost = await fetch('http://localhost:6937/testpath/test', {
105
74
  method: 'POST',
106
75
  body: JSON.stringify({ test: 'Hello World' }),
107
76
  headers: { 'Content-Type': 'application/json' }
@@ -110,7 +79,7 @@ describe('Forklaunch Hyper-Express Tests', () => {
110
79
  expect(await testPost.text()).toBe('Hello World');
111
80
  });
112
81
  test('Put', async () => {
113
- const testPut = await fetch('http://localhost:6934/testpath/test', {
82
+ const testPut = await fetch('http://localhost:6937/testpath/test', {
114
83
  method: 'PUT',
115
84
  body: JSON.stringify({ test: 'Hello World' }),
116
85
  headers: { 'Content-Type': 'application/json' }
@@ -119,7 +88,7 @@ describe('Forklaunch Hyper-Express Tests', () => {
119
88
  expect(await testPut.text()).toBe('Hello World');
120
89
  });
121
90
  test('Patch', async () => {
122
- const testPatch = await fetch('http://localhost:6934/testpath/test', {
91
+ const testPatch = await fetch('http://localhost:6937/testpath/test', {
123
92
  method: 'PATCH',
124
93
  body: JSON.stringify({ test: 'Hello World' }),
125
94
  headers: { 'Content-Type': 'application/json' }
@@ -128,14 +97,13 @@ describe('Forklaunch Hyper-Express Tests', () => {
128
97
  expect(await testPatch.text()).toBe('Hello World');
129
98
  });
130
99
  test('Delete', async () => {
131
- const testDelete = await fetch('http://localhost:6934/testpath/test', {
100
+ const testDelete = await fetch('http://localhost:6937/testpath/test', {
132
101
  method: 'DELETE'
133
102
  });
134
103
  expect(testDelete.status).toBe(200);
135
104
  expect(await testDelete.text()).toBe('Hello World');
136
105
  });
137
106
  afterAll(async () => {
138
- setTimeout(async () => await (0, kill_port_process_1.killPortProcess)(6934), 500);
107
+ forklaunchApplication.internal.shutdown();
139
108
  });
140
109
  });
141
- //# sourceMappingURL=typebox.forklaunch.hyperExpress.test.js.map