@forklaunch/hyper-express 0.1.0 → 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.
- package/LICENSE +21 -0
- package/lib/config.d.ts +2 -0
- package/lib/config.d.ts.map +1 -0
- package/lib/config.js +1 -0
- package/lib/eslint.config.d.mts +3 -0
- package/lib/eslint.config.d.mts.map +1 -0
- package/lib/eslint.config.mjs +10 -0
- package/lib/index.d.ts +23 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +25 -0
- package/lib/jest.config.d.ts +4 -0
- package/lib/jest.config.d.ts.map +1 -0
- package/lib/jest.config.js +21 -0
- package/lib/src/hyperExpressApplication.d.ts +36 -0
- package/lib/src/hyperExpressApplication.d.ts.map +1 -0
- package/lib/src/hyperExpressApplication.js +69 -0
- package/lib/src/hyperExpressRouter.d.ts +10 -0
- package/lib/src/hyperExpressRouter.d.ts.map +1 -0
- package/lib/src/hyperExpressRouter.js +22 -0
- package/lib/src/middleware/contentParse.middleware.d.ts +8 -0
- package/lib/src/middleware/contentParse.middleware.d.ts.map +1 -0
- package/lib/src/middleware/contentParse.middleware.js +26 -0
- package/lib/src/middleware/enrichResponseTransmission.middleware.d.ts +14 -0
- package/lib/src/middleware/enrichResponseTransmission.middleware.d.ts.map +1 -0
- package/{dist/middleware/response.middleware.js → lib/src/middleware/enrichResponseTransmission.middleware.js} +19 -17
- package/lib/src/middleware/polyfillGetHeaders.middleware.d.ts +3 -0
- package/lib/src/middleware/polyfillGetHeaders.middleware.d.ts.map +1 -0
- package/lib/src/middleware/polyfillGetHeaders.middleware.js +8 -0
- package/{dist → lib/src}/middleware/swagger.middleware.d.ts +2 -1
- package/lib/src/middleware/swagger.middleware.d.ts.map +1 -0
- package/{dist → lib/src}/middleware/swagger.middleware.js +9 -19
- package/lib/src/types/hyperExpress.types.d.ts +42 -0
- package/lib/src/types/hyperExpress.types.d.ts.map +1 -0
- package/lib/tests/typebox.forklaunch.hyperExpress.test.d.ts +2 -0
- package/lib/tests/typebox.forklaunch.hyperExpress.test.d.ts.map +1 -0
- package/{dist/tests/zod.forklaunch.hyperExpress.test.js → lib/tests/typebox.forklaunch.hyperExpress.test.js} +23 -51
- package/lib/tests/zod.forklaunch.hyperExpress.test.d.ts +2 -0
- package/lib/tests/zod.forklaunch.hyperExpress.test.d.ts.map +1 -0
- package/{dist/tests/typebox.forklaunch.hyperExpress.test.js → lib/tests/zod.forklaunch.hyperExpress.test.js} +22 -52
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/vitest.config.d.ts +3 -0
- package/lib/vitest.config.d.ts.map +1 -0
- package/lib/vitest.config.js +7 -0
- package/package.json +32 -19
- package/.prettierignore +0 -2
- package/.prettierrc +0 -7
- package/dist/forklaunch.hyperExpress.d.ts +0 -192
- package/dist/forklaunch.hyperExpress.js +0 -358
- package/dist/forklaunch.hyperExpress.js.map +0 -1
- package/dist/jest.config.d.ts +0 -3
- package/dist/jest.config.js.map +0 -1
- package/dist/main.js +0 -90
- package/dist/main.js.map +0 -1
- package/dist/middleware/contentParse.middleware.d.ts +0 -7
- package/dist/middleware/contentParse.middleware.js +0 -30
- package/dist/middleware/contentParse.middleware.js.map +0 -1
- package/dist/middleware/response.middleware.d.ts +0 -12
- package/dist/middleware/response.middleware.js.map +0 -1
- package/dist/middleware/swagger.middleware.js.map +0 -1
- package/dist/tests/typebox.forklaunch.hyperExpress.test.d.ts +0 -1
- package/dist/tests/typebox.forklaunch.hyperExpress.test.js.map +0 -1
- package/dist/tests/zod.forklaunch.hyperExpress.test.d.ts +0 -1
- package/dist/tests/zod.forklaunch.hyperExpress.test.js.map +0 -1
- package/dist/types/forklaunch.hyperExpress.types.d.ts +0 -67
- package/dist/types/forklaunch.hyperExpress.types.js +0 -3
- package/dist/types/forklaunch.hyperExpress.types.js.map +0 -1
- package/eslint.config.mjs +0 -12
- package/forklaunch.hyperExpress.ts +0 -649
- package/jest.config.ts +0 -10
- package/main.ts +0 -97
- package/tests/typebox.forklaunch.hyperExpress.test.ts +0 -164
- package/tests/zod.forklaunch.hyperExpress.test.ts +0 -164
- /package/{dist/main.d.ts → lib/src/types/hyperExpress.types.js} +0 -0
@@ -1,56 +1,29 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
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
|
-
|
35
|
-
|
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:
|
14
|
+
200: string
|
42
15
|
}
|
43
|
-
}, (
|
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:
|
23
|
+
test: string
|
51
24
|
},
|
52
25
|
responses: {
|
53
|
-
200:
|
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:
|
35
|
+
test: string
|
63
36
|
},
|
64
37
|
responses: {
|
65
|
-
200:
|
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:
|
47
|
+
test: string
|
75
48
|
},
|
76
49
|
responses: {
|
77
|
-
200:
|
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:
|
59
|
+
200: string
|
87
60
|
}
|
88
|
-
}, (
|
61
|
+
}, (_req, res) => {
|
89
62
|
res.status(200).send('Hello World');
|
90
63
|
});
|
91
64
|
forklaunchApplication.use(forklaunchRouterInstance);
|
92
|
-
await forklaunchApplication.listen(
|
93
|
-
console.log('
|
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:
|
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:
|
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:
|
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:
|
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:
|
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
|
-
|
111
|
+
forklaunchApplication.internal.shutdown();
|
139
112
|
});
|
140
113
|
});
|
141
|
-
//# sourceMappingURL=zod.forklaunch.hyperExpress.test.js.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
|
-
|
2
|
-
|
3
|
-
|
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
|
-
|
35
|
-
|
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:
|
14
|
+
200: string
|
42
15
|
}
|
43
|
-
}, (
|
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:
|
23
|
+
test: string
|
51
24
|
},
|
52
25
|
responses: {
|
53
|
-
200:
|
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:
|
35
|
+
test: string
|
63
36
|
},
|
64
37
|
responses: {
|
65
|
-
200:
|
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:
|
47
|
+
test: string
|
75
48
|
},
|
76
49
|
responses: {
|
77
|
-
200:
|
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:
|
59
|
+
200: string
|
87
60
|
}
|
88
|
-
}, (
|
61
|
+
}, (_req, res) => {
|
89
62
|
res.status(200).send('Hello World');
|
90
63
|
});
|
91
64
|
forklaunchApplication.use(forklaunchRouterInstance);
|
92
|
-
await forklaunchApplication.listen(
|
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:
|
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:
|
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:
|
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:
|
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:
|
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
|
-
|
109
|
+
forklaunchApplication.internal.shutdown();
|
139
110
|
});
|
140
111
|
});
|
141
|
-
//# sourceMappingURL=typebox.forklaunch.hyperExpress.test.js.map
|