@forklaunch/hyper-express 0.4.5 → 0.4.7
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/lib/index.d.mts +54 -6
- package/lib/index.d.ts +54 -6
- package/lib/index.js +12 -1
- package/lib/index.mjs +12 -1
- package/package.json +4 -4
package/lib/index.d.mts
CHANGED
@@ -9,23 +9,71 @@ export { ParsedQs } from 'qs';
|
|
9
9
|
|
10
10
|
/**
|
11
11
|
* Represents an application built on top of Hyper-Express and Forklaunch.
|
12
|
+
* This class provides a high-performance web server implementation using uWebSockets.js
|
13
|
+
* with Forklaunch's schema validation and API documentation capabilities.
|
12
14
|
*
|
13
|
-
* @template SV -
|
15
|
+
* @template SV - Schema validator type extending AnySchemaValidator
|
16
|
+
*
|
17
|
+
* @example
|
18
|
+
* ```typescript
|
19
|
+
* const app = new Application(schemaValidator, openTelemetryCollector);
|
20
|
+
*
|
21
|
+
* app.get('/users', {
|
22
|
+
* responses: {
|
23
|
+
* 200: { type: 'array', items: { type: 'object' } }
|
24
|
+
* }
|
25
|
+
* }, async (req, res) => {
|
26
|
+
* res.json(await getUsers());
|
27
|
+
* });
|
28
|
+
*
|
29
|
+
* await app.listen(3000);
|
30
|
+
* ```
|
14
31
|
*/
|
15
32
|
declare class Application<SV extends AnySchemaValidator> extends ForklaunchExpressLikeApplication<SV, Server, MiddlewareHandler, Request<Record<string, unknown>>, Response<Record<string, unknown>>, MiddlewareNext> {
|
16
33
|
private readonly docsConfiguration?;
|
17
34
|
/**
|
18
35
|
* Creates an instance of the Application class.
|
19
36
|
*
|
20
|
-
* @param {SV} schemaValidator -
|
37
|
+
* @param {SV} schemaValidator - Schema validator for request/response validation
|
38
|
+
* @param {OpenTelemetryCollector<MetricsDefinition>} openTelemetryCollector - Collector for OpenTelemetry metrics
|
39
|
+
* @param {DocsConfiguration} [docsConfiguration] - Optional configuration for API documentation (Swagger/Scalar)
|
40
|
+
*
|
41
|
+
* @example
|
42
|
+
* ```typescript
|
43
|
+
* const app = new Application(
|
44
|
+
* new SchemaValidator(),
|
45
|
+
* new OpenTelemetryCollector(),
|
46
|
+
* { type: 'swagger' }
|
47
|
+
* );
|
48
|
+
* ```
|
21
49
|
*/
|
22
50
|
constructor(schemaValidator: SV, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, docsConfiguration?: DocsConfiguration | undefined);
|
23
51
|
/**
|
24
|
-
* Starts the server and sets up
|
52
|
+
* Starts the server and sets up API documentation.
|
53
|
+
* Supports multiple listening configurations including port, host, and UNIX socket path.
|
54
|
+
* Automatically sets up Swagger or Scalar documentation based on configuration.
|
55
|
+
*
|
56
|
+
* @param {number | string} arg0 - Port number or UNIX socket path
|
57
|
+
* @param {string | Function} [arg1] - Host name or callback function
|
58
|
+
* @param {Function} [arg2] - Callback function when host is specified
|
59
|
+
* @returns {Promise<uWebsockets.us_listen_socket>} Promise resolving to the listening socket
|
60
|
+
*
|
61
|
+
* @example
|
62
|
+
* ```typescript
|
63
|
+
* // Listen on port 3000
|
64
|
+
* await app.listen(3000);
|
65
|
+
*
|
66
|
+
* // Listen on specific host and port
|
67
|
+
* await app.listen(3000, 'localhost');
|
68
|
+
*
|
69
|
+
* // Listen on UNIX socket
|
70
|
+
* await app.listen('/tmp/app.sock');
|
25
71
|
*
|
26
|
-
*
|
27
|
-
*
|
28
|
-
*
|
72
|
+
* // With callback
|
73
|
+
* await app.listen(3000, (socket) => {
|
74
|
+
* console.log('Server started');
|
75
|
+
* });
|
76
|
+
* ```
|
29
77
|
*/
|
30
78
|
listen(port: number, callback?: (listen_socket: uWebsockets.us_listen_socket) => void): Promise<uWebsockets.us_listen_socket>;
|
31
79
|
listen(port: number, host?: string, callback?: (listen_socket: uWebsockets.us_listen_socket) => void): Promise<uWebsockets.us_listen_socket>;
|
package/lib/index.d.ts
CHANGED
@@ -9,23 +9,71 @@ export { ParsedQs } from 'qs';
|
|
9
9
|
|
10
10
|
/**
|
11
11
|
* Represents an application built on top of Hyper-Express and Forklaunch.
|
12
|
+
* This class provides a high-performance web server implementation using uWebSockets.js
|
13
|
+
* with Forklaunch's schema validation and API documentation capabilities.
|
12
14
|
*
|
13
|
-
* @template SV -
|
15
|
+
* @template SV - Schema validator type extending AnySchemaValidator
|
16
|
+
*
|
17
|
+
* @example
|
18
|
+
* ```typescript
|
19
|
+
* const app = new Application(schemaValidator, openTelemetryCollector);
|
20
|
+
*
|
21
|
+
* app.get('/users', {
|
22
|
+
* responses: {
|
23
|
+
* 200: { type: 'array', items: { type: 'object' } }
|
24
|
+
* }
|
25
|
+
* }, async (req, res) => {
|
26
|
+
* res.json(await getUsers());
|
27
|
+
* });
|
28
|
+
*
|
29
|
+
* await app.listen(3000);
|
30
|
+
* ```
|
14
31
|
*/
|
15
32
|
declare class Application<SV extends AnySchemaValidator> extends ForklaunchExpressLikeApplication<SV, Server, MiddlewareHandler, Request<Record<string, unknown>>, Response<Record<string, unknown>>, MiddlewareNext> {
|
16
33
|
private readonly docsConfiguration?;
|
17
34
|
/**
|
18
35
|
* Creates an instance of the Application class.
|
19
36
|
*
|
20
|
-
* @param {SV} schemaValidator -
|
37
|
+
* @param {SV} schemaValidator - Schema validator for request/response validation
|
38
|
+
* @param {OpenTelemetryCollector<MetricsDefinition>} openTelemetryCollector - Collector for OpenTelemetry metrics
|
39
|
+
* @param {DocsConfiguration} [docsConfiguration] - Optional configuration for API documentation (Swagger/Scalar)
|
40
|
+
*
|
41
|
+
* @example
|
42
|
+
* ```typescript
|
43
|
+
* const app = new Application(
|
44
|
+
* new SchemaValidator(),
|
45
|
+
* new OpenTelemetryCollector(),
|
46
|
+
* { type: 'swagger' }
|
47
|
+
* );
|
48
|
+
* ```
|
21
49
|
*/
|
22
50
|
constructor(schemaValidator: SV, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, docsConfiguration?: DocsConfiguration | undefined);
|
23
51
|
/**
|
24
|
-
* Starts the server and sets up
|
52
|
+
* Starts the server and sets up API documentation.
|
53
|
+
* Supports multiple listening configurations including port, host, and UNIX socket path.
|
54
|
+
* Automatically sets up Swagger or Scalar documentation based on configuration.
|
55
|
+
*
|
56
|
+
* @param {number | string} arg0 - Port number or UNIX socket path
|
57
|
+
* @param {string | Function} [arg1] - Host name or callback function
|
58
|
+
* @param {Function} [arg2] - Callback function when host is specified
|
59
|
+
* @returns {Promise<uWebsockets.us_listen_socket>} Promise resolving to the listening socket
|
60
|
+
*
|
61
|
+
* @example
|
62
|
+
* ```typescript
|
63
|
+
* // Listen on port 3000
|
64
|
+
* await app.listen(3000);
|
65
|
+
*
|
66
|
+
* // Listen on specific host and port
|
67
|
+
* await app.listen(3000, 'localhost');
|
68
|
+
*
|
69
|
+
* // Listen on UNIX socket
|
70
|
+
* await app.listen('/tmp/app.sock');
|
25
71
|
*
|
26
|
-
*
|
27
|
-
*
|
28
|
-
*
|
72
|
+
* // With callback
|
73
|
+
* await app.listen(3000, (socket) => {
|
74
|
+
* console.log('Server started');
|
75
|
+
* });
|
76
|
+
* ```
|
29
77
|
*/
|
30
78
|
listen(port: number, callback?: (listen_socket: uWebsockets.us_listen_socket) => void): Promise<uWebsockets.us_listen_socket>;
|
31
79
|
listen(port: number, host?: string, callback?: (listen_socket: uWebsockets.us_listen_socket) => void): Promise<uWebsockets.us_listen_socket>;
|
package/lib/index.js
CHANGED
@@ -164,7 +164,18 @@ var Application = class extends import_http11.ForklaunchExpressLikeApplication {
|
|
164
164
|
/**
|
165
165
|
* Creates an instance of the Application class.
|
166
166
|
*
|
167
|
-
* @param {SV} schemaValidator -
|
167
|
+
* @param {SV} schemaValidator - Schema validator for request/response validation
|
168
|
+
* @param {OpenTelemetryCollector<MetricsDefinition>} openTelemetryCollector - Collector for OpenTelemetry metrics
|
169
|
+
* @param {DocsConfiguration} [docsConfiguration] - Optional configuration for API documentation (Swagger/Scalar)
|
170
|
+
*
|
171
|
+
* @example
|
172
|
+
* ```typescript
|
173
|
+
* const app = new Application(
|
174
|
+
* new SchemaValidator(),
|
175
|
+
* new OpenTelemetryCollector(),
|
176
|
+
* { type: 'swagger' }
|
177
|
+
* );
|
178
|
+
* ```
|
168
179
|
*/
|
169
180
|
constructor(schemaValidator, openTelemetryCollector, docsConfiguration) {
|
170
181
|
super(schemaValidator, new import_hyper_express_fork.Server(), openTelemetryCollector);
|
package/lib/index.mjs
CHANGED
@@ -154,7 +154,18 @@ var Application = class extends ForklaunchExpressLikeApplication {
|
|
154
154
|
/**
|
155
155
|
* Creates an instance of the Application class.
|
156
156
|
*
|
157
|
-
* @param {SV} schemaValidator -
|
157
|
+
* @param {SV} schemaValidator - Schema validator for request/response validation
|
158
|
+
* @param {OpenTelemetryCollector<MetricsDefinition>} openTelemetryCollector - Collector for OpenTelemetry metrics
|
159
|
+
* @param {DocsConfiguration} [docsConfiguration] - Optional configuration for API documentation (Swagger/Scalar)
|
160
|
+
*
|
161
|
+
* @example
|
162
|
+
* ```typescript
|
163
|
+
* const app = new Application(
|
164
|
+
* new SchemaValidator(),
|
165
|
+
* new OpenTelemetryCollector(),
|
166
|
+
* { type: 'swagger' }
|
167
|
+
* );
|
168
|
+
* ```
|
158
169
|
*/
|
159
170
|
constructor(schemaValidator, openTelemetryCollector, docsConfiguration) {
|
160
171
|
super(schemaValidator, new Server(), openTelemetryCollector);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@forklaunch/hyper-express",
|
3
|
-
"version": "0.4.
|
3
|
+
"version": "0.4.7",
|
4
4
|
"description": "Forklaunch framework for hyper-express.",
|
5
5
|
"homepage": "https://github.com/forklaunch/forklaunch-js#readme",
|
6
6
|
"bugs": {
|
@@ -34,9 +34,9 @@
|
|
34
34
|
"swagger-ui-dist": "^5.20.7",
|
35
35
|
"swagger-ui-express": "^5.0.1",
|
36
36
|
"uWebSockets.js": "github:uNetworking/uWebSockets.js#v20.44.0",
|
37
|
-
"@forklaunch/common": "0.2.
|
38
|
-
"@forklaunch/validator": "0.
|
39
|
-
"@forklaunch/core": "0.
|
37
|
+
"@forklaunch/common": "0.2.7",
|
38
|
+
"@forklaunch/validator": "0.5.0",
|
39
|
+
"@forklaunch/core": "0.7.0"
|
40
40
|
},
|
41
41
|
"devDependencies": {
|
42
42
|
"@eslint/js": "^9.24.0",
|