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