@forklaunch/hyper-express 0.1.22 → 0.1.23
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/eslint.config.d.mts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
declare const _default: ({
|
2
2
|
readonly rules: Readonly<import("eslint").Linter.RulesRecord>;
|
3
|
-
} | import(".pnpm/@typescript-eslint+utils@8.
|
3
|
+
} | import(".pnpm/@typescript-eslint+utils@8.14.0_eslint@9.14.0_typescript@5.6.3/node_modules/@typescript-eslint/utils/ts-eslint").FlatConfig.Config | {
|
4
4
|
languageOptions: {
|
5
5
|
globals: {
|
6
6
|
readonly AbortController: false;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ForklaunchExpressLikeApplication
|
1
|
+
import { ForklaunchExpressLikeApplication } from '@forklaunch/core/http';
|
2
2
|
import { AnySchemaValidator } from '@forklaunch/validator';
|
3
3
|
import { MiddlewareHandler, Server } from 'hyper-express';
|
4
4
|
import * as uWebsockets from 'uWebSockets.js';
|
@@ -7,21 +7,13 @@ import * as uWebsockets from 'uWebSockets.js';
|
|
7
7
|
*
|
8
8
|
* @template SV - A type that extends AnySchemaValidator.
|
9
9
|
*/
|
10
|
-
export declare class Application<SV extends AnySchemaValidator> extends ForklaunchExpressLikeApplication<SV, Server> {
|
10
|
+
export declare class Application<SV extends AnySchemaValidator> extends ForklaunchExpressLikeApplication<SV, Server, MiddlewareHandler> {
|
11
11
|
/**
|
12
12
|
* Creates an instance of the Application class.
|
13
13
|
*
|
14
14
|
* @param {SV} schemaValidator - The schema validator.
|
15
15
|
*/
|
16
16
|
constructor(schemaValidator: SV);
|
17
|
-
/**
|
18
|
-
* Registers middleware or routers to the application.
|
19
|
-
*
|
20
|
-
* @param {ForklaunchRouter<SV> | MiddlewareHandler<SV> | MiddlewareHandler<SV>[]} router - The router or middleware to register.
|
21
|
-
* @param {...(ForklaunchRouter<SV> | MiddlewareHandler<SV> | MiddlewareHandler<SV>[])} args - Additional arguments.
|
22
|
-
* @returns {this} - The application instance.
|
23
|
-
*/
|
24
|
-
use(router: ForklaunchRouter<SV> | MiddlewareHandler | MiddlewareHandler[], ...args: (ForklaunchRouter<SV> | MiddlewareHandler | MiddlewareHandler[])[]): this;
|
25
17
|
/**
|
26
18
|
* Starts the server and sets up Swagger documentation.
|
27
19
|
*
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"hyperExpressApplication.d.ts","sourceRoot":"","sources":["../../src/hyperExpressApplication.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,
|
1
|
+
{"version":3,"file":"hyperExpressApplication.d.ts","sourceRoot":"","sources":["../../src/hyperExpressApplication.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAEjC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC;AAG9C;;;;GAIG;AACH,qBAAa,WAAW,CACtB,EAAE,SAAS,kBAAkB,CAC7B,SAAQ,gCAAgC,CAAC,EAAE,EAAE,MAAM,EAAE,iBAAiB,CAAC;IACvE;;;;OAIG;gBACS,eAAe,EAAE,EAAE;IAI/B;;;;;;OAMG;IACH,MAAM,CACJ,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,CAAC,aAAa,EAAE,WAAW,CAAC,gBAAgB,KAAK,IAAI,GAC/D,OAAO,CAAC,WAAW,CAAC,gBAAgB,CAAC;IACxC,MAAM,CACJ,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,CAAC,aAAa,EAAE,WAAW,CAAC,gBAAgB,KAAK,IAAI,GAC/D,OAAO,CAAC,WAAW,CAAC,gBAAgB,CAAC;IACxC,MAAM,CACJ,SAAS,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,CAAC,aAAa,EAAE,WAAW,CAAC,gBAAgB,KAAK,IAAI,GAC/D,OAAO,CAAC,WAAW,CAAC,gBAAgB,CAAC;CA0CzC"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ForklaunchExpressLikeApplication, generateSwaggerDocument
|
1
|
+
import { ForklaunchExpressLikeApplication, generateSwaggerDocument } from '@forklaunch/core/http';
|
2
2
|
import { Server } from 'hyper-express';
|
3
3
|
import { swagger, swaggerRedirect } from './middleware/swagger.middleware';
|
4
4
|
/**
|
@@ -15,35 +15,6 @@ export class Application extends ForklaunchExpressLikeApplication {
|
|
15
15
|
constructor(schemaValidator) {
|
16
16
|
super(schemaValidator, new Server());
|
17
17
|
}
|
18
|
-
/**
|
19
|
-
* Registers middleware or routers to the application.
|
20
|
-
*
|
21
|
-
* @param {ForklaunchRouter<SV> | MiddlewareHandler<SV> | MiddlewareHandler<SV>[]} router - The router or middleware to register.
|
22
|
-
* @param {...(ForklaunchRouter<SV> | MiddlewareHandler<SV> | MiddlewareHandler<SV>[])} args - Additional arguments.
|
23
|
-
* @returns {this} - The application instance.
|
24
|
-
*/
|
25
|
-
use(router, ...args) {
|
26
|
-
// if (router instanceof Router) {
|
27
|
-
if (isForklaunchRouter(router)) {
|
28
|
-
const hyperExpressRouter = router;
|
29
|
-
this.routers.push(hyperExpressRouter);
|
30
|
-
this.internal.use(hyperExpressRouter.basePath, hyperExpressRouter.internal);
|
31
|
-
return this;
|
32
|
-
}
|
33
|
-
else {
|
34
|
-
const hyperExpressRouter = args.pop();
|
35
|
-
if (!isForklaunchRouter(router)) {
|
36
|
-
throw new Error('Last argument must be a router');
|
37
|
-
}
|
38
|
-
args.forEach((arg) => {
|
39
|
-
if (isForklaunchRouter(arg)) {
|
40
|
-
throw new Error('Only one router is allowed');
|
41
|
-
}
|
42
|
-
});
|
43
|
-
this.internal.use(hyperExpressRouter.basePath, ...args, hyperExpressRouter.internal);
|
44
|
-
return this;
|
45
|
-
}
|
46
|
-
}
|
47
18
|
listen(arg0, arg1, arg2) {
|
48
19
|
if (typeof arg0 === 'number') {
|
49
20
|
const port = arg0 || Number(process.env.PORT);
|