@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
package/main.ts DELETED
@@ -1,97 +0,0 @@
1
- import { TypeboxSchemaValidator, string } from '@forklaunch/validator/typebox';
2
- import forklaunchExpress, { forklaunchRouter } from './forklaunch.hyperExpress';
3
-
4
- const typeboxSchemaValidator = new TypeboxSchemaValidator();
5
-
6
- const forklaunchApplication = forklaunchExpress(typeboxSchemaValidator);
7
- const forklaunchRouterInstance = forklaunchRouter(
8
- '/testpath',
9
- typeboxSchemaValidator
10
- );
11
-
12
- forklaunchRouterInstance.get(
13
- '/test',
14
- {
15
- name: 'Test',
16
- summary: 'Test Summary',
17
- responses: {
18
- 200: string
19
- }
20
- },
21
- (req, res) => {
22
- res.status(200).send('Hello World');
23
- }
24
- );
25
-
26
- forklaunchRouterInstance.post(
27
- '/test',
28
- {
29
- name: 'Test',
30
- summary: 'Test Summary',
31
- body: {
32
- test: string
33
- },
34
- responses: {
35
- 200: string
36
- }
37
- },
38
- (req, res) => {
39
- res.status(200).send(req.body.test);
40
- }
41
- );
42
-
43
- forklaunchRouterInstance.put(
44
- '/test',
45
- {
46
- name: 'Test',
47
- summary: 'Test Summary',
48
- body: {
49
- test: string
50
- },
51
- responses: {
52
- 200: string
53
- }
54
- },
55
- (req, res) => {
56
- res.status(200).send(req.body.test);
57
- }
58
- );
59
-
60
- forklaunchRouterInstance.patch(
61
- '/test',
62
- {
63
- name: 'Test',
64
- summary: 'Test Summary',
65
- body: {
66
- test: string
67
- },
68
- responses: {
69
- 200: string
70
- }
71
- },
72
- (req, res) => {
73
- res.status(200).send(req.body.test);
74
- }
75
- );
76
-
77
- forklaunchRouterInstance.delete(
78
- '/test',
79
- {
80
- name: 'Test',
81
- summary: 'Test Summary',
82
- responses: {
83
- 200: string
84
- }
85
- },
86
- (req, res) => {
87
- res.status(200).send('Hello World');
88
- }
89
- );
90
-
91
- forklaunchApplication.use(forklaunchRouterInstance);
92
-
93
- console.log(forklaunchApplication.internal.routes);
94
-
95
- forklaunchApplication.listen(6934, () => {
96
- console.log('Server started');
97
- });
@@ -1,164 +0,0 @@
1
- import { TypeboxSchemaValidator, string } from '@forklaunch/validator/typebox';
2
- import { killPortProcess } from 'kill-port-process';
3
- import forklaunchExpress, {
4
- Application,
5
- Router,
6
- forklaunchRouter
7
- } from '../forklaunch.hyperExpress';
8
-
9
- const typeboxSchemaValidator = new TypeboxSchemaValidator();
10
-
11
- describe('Forklaunch Hyper-Express Tests', () => {
12
- let forklaunchApplication: Application<TypeboxSchemaValidator>;
13
- let forklaunchRouterInstance: Router<TypeboxSchemaValidator>;
14
-
15
- beforeAll(async () => {
16
- await killPortProcess(6934);
17
-
18
- forklaunchApplication = forklaunchExpress(typeboxSchemaValidator);
19
- forklaunchRouterInstance = forklaunchRouter(
20
- '/testpath',
21
- typeboxSchemaValidator
22
- );
23
-
24
- forklaunchRouterInstance.get(
25
- '/test',
26
- {
27
- name: 'Test',
28
- summary: 'Test Summary',
29
- responses: {
30
- 200: string
31
- }
32
- },
33
- (req, res) => {
34
- res.status(200).send('Hello World');
35
- }
36
- );
37
-
38
- forklaunchRouterInstance.post(
39
- '/test',
40
- {
41
- name: 'Test',
42
- summary: 'Test Summary',
43
- body: {
44
- test: string
45
- },
46
- responses: {
47
- 200: string
48
- }
49
- },
50
- (req, res) => {
51
- res.status(200).send(req.body.test);
52
- }
53
- );
54
-
55
- forklaunchRouterInstance.put(
56
- '/test',
57
- {
58
- name: 'Test',
59
- summary: 'Test Summary',
60
- body: {
61
- test: string
62
- },
63
- responses: {
64
- 200: string
65
- }
66
- },
67
- (req, res) => {
68
- res.status(200).send(req.body.test);
69
- }
70
- );
71
-
72
- forklaunchRouterInstance.patch(
73
- '/test',
74
- {
75
- name: 'Test',
76
- summary: 'Test Summary',
77
- body: {
78
- test: string
79
- },
80
- responses: {
81
- 200: string
82
- }
83
- },
84
- (req, res) => {
85
- res.status(200).send(req.body.test);
86
- }
87
- );
88
-
89
- forklaunchRouterInstance.delete(
90
- '/test',
91
- {
92
- name: 'Test',
93
- summary: 'Test Summary',
94
- responses: {
95
- 200: string
96
- }
97
- },
98
- (req, res) => {
99
- res.status(200).send('Hello World');
100
- }
101
- );
102
-
103
- forklaunchApplication.use(forklaunchRouterInstance);
104
-
105
- await forklaunchApplication.listen(6934, () => {
106
- console.log('Server started');
107
- });
108
- });
109
-
110
- test('Get', async () => {
111
- const testGet = await fetch('http://localhost:6934/testpath/test', {
112
- method: 'GET'
113
- });
114
-
115
- expect(testGet.status).toBe(200);
116
- expect(await testGet.text()).toBe('Hello World');
117
- });
118
-
119
- test('Post', async () => {
120
- const testPost = await fetch('http://localhost:6934/testpath/test', {
121
- method: 'POST',
122
- body: JSON.stringify({ test: 'Hello World' }),
123
- headers: { 'Content-Type': 'application/json' }
124
- });
125
-
126
- expect(testPost.status).toBe(200);
127
- expect(await testPost.text()).toBe('Hello World');
128
- });
129
-
130
- test('Put', async () => {
131
- const testPut = await fetch('http://localhost:6934/testpath/test', {
132
- method: 'PUT',
133
- body: JSON.stringify({ test: 'Hello World' }),
134
- headers: { 'Content-Type': 'application/json' }
135
- });
136
-
137
- expect(testPut.status).toBe(200);
138
- expect(await testPut.text()).toBe('Hello World');
139
- });
140
-
141
- test('Patch', async () => {
142
- const testPatch = await fetch('http://localhost:6934/testpath/test', {
143
- method: 'PATCH',
144
- body: JSON.stringify({ test: 'Hello World' }),
145
- headers: { 'Content-Type': 'application/json' }
146
- });
147
-
148
- expect(testPatch.status).toBe(200);
149
- expect(await testPatch.text()).toBe('Hello World');
150
- });
151
-
152
- test('Delete', async () => {
153
- const testDelete = await fetch('http://localhost:6934/testpath/test', {
154
- method: 'DELETE'
155
- });
156
-
157
- expect(testDelete.status).toBe(200);
158
- expect(await testDelete.text()).toBe('Hello World');
159
- });
160
-
161
- afterAll(async () => {
162
- setTimeout(async () => await killPortProcess(6934), 500);
163
- });
164
- });
@@ -1,164 +0,0 @@
1
- import { ZodSchemaValidator, string } from '@forklaunch/validator/zod';
2
- import { killPortProcess } from 'kill-port-process';
3
- import forklaunchExpress, {
4
- Application,
5
- Router,
6
- forklaunchRouter
7
- } from '../forklaunch.hyperExpress';
8
-
9
- const zodSchemaValidator = new ZodSchemaValidator();
10
-
11
- describe('Forklaunch Hyper-Express Tests', () => {
12
- let forklaunchApplication: Application<ZodSchemaValidator>;
13
- let forklaunchRouterInstance: Router<ZodSchemaValidator>;
14
-
15
- beforeAll(async () => {
16
- await killPortProcess(6935);
17
-
18
- forklaunchApplication = forklaunchExpress(zodSchemaValidator);
19
- forklaunchRouterInstance = forklaunchRouter(
20
- '/testpath',
21
- zodSchemaValidator
22
- );
23
-
24
- forklaunchRouterInstance.get(
25
- '/test',
26
- {
27
- name: 'Test',
28
- summary: 'Test Summary',
29
- responses: {
30
- 200: string
31
- }
32
- },
33
- (req, res) => {
34
- res.status(200).send('Hello World');
35
- }
36
- );
37
-
38
- forklaunchRouterInstance.post(
39
- '/test',
40
- {
41
- name: 'Test',
42
- summary: 'Test Summary',
43
- body: {
44
- test: string
45
- },
46
- responses: {
47
- 200: string
48
- }
49
- },
50
- (req, res) => {
51
- res.status(200).send(req.body.test);
52
- }
53
- );
54
-
55
- forklaunchRouterInstance.put(
56
- '/test',
57
- {
58
- name: 'Test',
59
- summary: 'Test Summary',
60
- body: {
61
- test: string
62
- },
63
- responses: {
64
- 200: string
65
- }
66
- },
67
- (req, res) => {
68
- res.status(200).send(req.body.test);
69
- }
70
- );
71
-
72
- forklaunchRouterInstance.patch(
73
- '/test',
74
- {
75
- name: 'Test',
76
- summary: 'Test Summary',
77
- body: {
78
- test: string
79
- },
80
- responses: {
81
- 200: string
82
- }
83
- },
84
- (req, res) => {
85
- res.status(200).send(req.body.test);
86
- }
87
- );
88
-
89
- forklaunchRouterInstance.delete(
90
- '/test',
91
- {
92
- name: 'Test',
93
- summary: 'Test Summary',
94
- responses: {
95
- 200: string
96
- }
97
- },
98
- (req, res) => {
99
- res.status(200).send('Hello World');
100
- }
101
- );
102
-
103
- forklaunchApplication.use(forklaunchRouterInstance);
104
-
105
- await forklaunchApplication.listen(6935, () => {
106
- console.log('Server started');
107
- });
108
- });
109
-
110
- test('Get', async () => {
111
- const testGet = await fetch('http://localhost:6934/testpath/test', {
112
- method: 'GET'
113
- });
114
-
115
- expect(testGet.status).toBe(200);
116
- expect(await testGet.text()).toBe('Hello World');
117
- });
118
-
119
- test('Post', async () => {
120
- const testPost = await fetch('http://localhost:6934/testpath/test', {
121
- method: 'POST',
122
- body: JSON.stringify({ test: 'Hello World' }),
123
- headers: { 'Content-Type': 'application/json' }
124
- });
125
-
126
- expect(testPost.status).toBe(200);
127
- expect(await testPost.text()).toBe('Hello World');
128
- });
129
-
130
- test('Put', async () => {
131
- const testPut = await fetch('http://localhost:6934/testpath/test', {
132
- method: 'PUT',
133
- body: JSON.stringify({ test: 'Hello World' }),
134
- headers: { 'Content-Type': 'application/json' }
135
- });
136
-
137
- expect(testPut.status).toBe(200);
138
- expect(await testPut.text()).toBe('Hello World');
139
- });
140
-
141
- test('Patch', async () => {
142
- const testPatch = await fetch('http://localhost:6934/testpath/test', {
143
- method: 'PATCH',
144
- body: JSON.stringify({ test: 'Hello World' }),
145
- headers: { 'Content-Type': 'application/json' }
146
- });
147
-
148
- expect(testPatch.status).toBe(200);
149
- expect(await testPatch.text()).toBe('Hello World');
150
- });
151
-
152
- test('Delete', async () => {
153
- const testDelete = await fetch('http://localhost:6934/testpath/test', {
154
- method: 'DELETE'
155
- });
156
-
157
- expect(testDelete.status).toBe(200);
158
- expect(await testDelete.text()).toBe('Hello World');
159
- });
160
-
161
- afterAll(async () => {
162
- setTimeout(async () => await killPortProcess(6935), 500);
163
- });
164
- });