@vercube/core 0.0.1-alpha.18 → 0.0.1-alpha.19
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.
|
@@ -36,6 +36,12 @@ export declare class HttpServer {
|
|
|
36
36
|
*/
|
|
37
37
|
initialize(config: ConfigTypes.Config): Promise<void>;
|
|
38
38
|
/**
|
|
39
|
+
* Listens for incoming requests on the HTTP server
|
|
40
|
+
*
|
|
41
|
+
* @returns {Promise<void>} A promise that resolves when the server is ready to listen
|
|
42
|
+
*/
|
|
43
|
+
listen(): Promise<void>;
|
|
44
|
+
/**
|
|
39
45
|
* Processes an incoming HTTP request
|
|
40
46
|
*
|
|
41
47
|
* This method:
|
package/dist/index.cjs
CHANGED
|
@@ -34,8 +34,8 @@ const __vercube_logger = __toESM(require("@vercube/logger"));
|
|
|
34
34
|
const c12 = __toESM(require("c12"));
|
|
35
35
|
const defu = __toESM(require("defu"));
|
|
36
36
|
|
|
37
|
-
//#region node_modules/.pnpm/@oxc-project+runtime@0.
|
|
38
|
-
var require_decorate = __commonJS({ "node_modules/.pnpm/@oxc-project+runtime@0.
|
|
37
|
+
//#region node_modules/.pnpm/@oxc-project+runtime@0.63.0/node_modules/@oxc-project/runtime/src/helpers/decorate.js
|
|
38
|
+
var require_decorate = __commonJS({ "node_modules/.pnpm/@oxc-project+runtime@0.63.0/node_modules/@oxc-project/runtime/src/helpers/decorate.js"(exports, module) {
|
|
39
39
|
function __decorate(decorators, target, key, desc) {
|
|
40
40
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
41
41
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -227,7 +227,7 @@ var Router = class {
|
|
|
227
227
|
* This method creates a new router context and triggers
|
|
228
228
|
* the before and after initialization hooks.
|
|
229
229
|
*/
|
|
230
|
-
|
|
230
|
+
initialize() {
|
|
231
231
|
this.gHooksService.trigger(RouterBeforeInitHook);
|
|
232
232
|
this.fRouterContext = (0, rou3.createRouter)();
|
|
233
233
|
this.gHooksService.trigger(RouterAfterInitHook);
|
|
@@ -692,6 +692,13 @@ var HttpServer = class {
|
|
|
692
692
|
port,
|
|
693
693
|
fetch: this.handleRequest.bind(this)
|
|
694
694
|
});
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* Listens for incoming requests on the HTTP server
|
|
698
|
+
*
|
|
699
|
+
* @returns {Promise<void>} A promise that resolves when the server is ready to listen
|
|
700
|
+
*/
|
|
701
|
+
async listen() {
|
|
695
702
|
await this.fServer.ready();
|
|
696
703
|
}
|
|
697
704
|
/**
|
|
@@ -766,7 +773,7 @@ var App = class {
|
|
|
766
773
|
this.fConfig = cfg;
|
|
767
774
|
await this.gHttpServer.initialize(this.fConfig);
|
|
768
775
|
if (this.fConfig.server?.static) this.gStaticRequestHandler.initialize(this.fConfig.server?.static);
|
|
769
|
-
this.gRouter.
|
|
776
|
+
this.gRouter.initialize();
|
|
770
777
|
}
|
|
771
778
|
/**
|
|
772
779
|
* Registers a plugin.
|
|
@@ -787,6 +794,8 @@ var App = class {
|
|
|
787
794
|
if (this.fIsInitialized) throw new Error("App is already initialized");
|
|
788
795
|
await this.resolvePlugins();
|
|
789
796
|
(0, __vercube_di.initializeContainer)(this.container);
|
|
797
|
+
await this.gHttpServer.listen();
|
|
798
|
+
this.fIsInitialized = true;
|
|
790
799
|
}
|
|
791
800
|
/**
|
|
792
801
|
* Resolves and initializes the plugins for the application.
|
|
@@ -1987,6 +1996,7 @@ exports.Header = Header
|
|
|
1987
1996
|
exports.Headers = Headers$1
|
|
1988
1997
|
exports.HooksService = HooksService
|
|
1989
1998
|
exports.HttpError = HttpError
|
|
1999
|
+
exports.HttpServer = HttpServer
|
|
1990
2000
|
exports.InternalServerError = InternalServerError
|
|
1991
2001
|
exports.Listen = Listen
|
|
1992
2002
|
exports.MethodNotAllowedError = MethodNotAllowedError
|
package/dist/index.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export * from "./Decorators/Hooks/Listen.js";
|
|
|
30
30
|
export * from "./Services/Hooks/HooksService.js";
|
|
31
31
|
export * from "./Services/Plugins/BasePlugin.js";
|
|
32
32
|
export * from "./Services/Middleware/BaseMiddleware.js";
|
|
33
|
+
export * from "./Services/HttpServer/HttpServer.js";
|
|
33
34
|
export * from "./Errors/HttpError.js";
|
|
34
35
|
export * from "./Errors/Http/BadRequestError.js";
|
|
35
36
|
export * from "./Errors/Http/ForbiddenError.js";
|
package/dist/index.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { BaseLogger, Logger } from "@vercube/logger";
|
|
|
8
8
|
import { loadConfig } from "c12";
|
|
9
9
|
import { defu } from "defu";
|
|
10
10
|
|
|
11
|
-
//#region node_modules/.pnpm/@oxc-project+runtime@0.
|
|
11
|
+
//#region node_modules/.pnpm/@oxc-project+runtime@0.63.0/node_modules/@oxc-project/runtime/src/helpers/esm/decorate.js
|
|
12
12
|
function __decorate(decorators, target, key, desc) {
|
|
13
13
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14
14
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -197,7 +197,7 @@ var Router = class {
|
|
|
197
197
|
* This method creates a new router context and triggers
|
|
198
198
|
* the before and after initialization hooks.
|
|
199
199
|
*/
|
|
200
|
-
|
|
200
|
+
initialize() {
|
|
201
201
|
this.gHooksService.trigger(RouterBeforeInitHook);
|
|
202
202
|
this.fRouterContext = createRouter();
|
|
203
203
|
this.gHooksService.trigger(RouterAfterInitHook);
|
|
@@ -662,6 +662,13 @@ var HttpServer = class {
|
|
|
662
662
|
port,
|
|
663
663
|
fetch: this.handleRequest.bind(this)
|
|
664
664
|
});
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* Listens for incoming requests on the HTTP server
|
|
668
|
+
*
|
|
669
|
+
* @returns {Promise<void>} A promise that resolves when the server is ready to listen
|
|
670
|
+
*/
|
|
671
|
+
async listen() {
|
|
665
672
|
await this.fServer.ready();
|
|
666
673
|
}
|
|
667
674
|
/**
|
|
@@ -736,7 +743,7 @@ var App = class {
|
|
|
736
743
|
this.fConfig = cfg;
|
|
737
744
|
await this.gHttpServer.initialize(this.fConfig);
|
|
738
745
|
if (this.fConfig.server?.static) this.gStaticRequestHandler.initialize(this.fConfig.server?.static);
|
|
739
|
-
this.gRouter.
|
|
746
|
+
this.gRouter.initialize();
|
|
740
747
|
}
|
|
741
748
|
/**
|
|
742
749
|
* Registers a plugin.
|
|
@@ -757,6 +764,8 @@ var App = class {
|
|
|
757
764
|
if (this.fIsInitialized) throw new Error("App is already initialized");
|
|
758
765
|
await this.resolvePlugins();
|
|
759
766
|
initializeContainer(this.container);
|
|
767
|
+
await this.gHttpServer.listen();
|
|
768
|
+
this.fIsInitialized = true;
|
|
760
769
|
}
|
|
761
770
|
/**
|
|
762
771
|
* Resolves and initializes the plugins for the application.
|
|
@@ -1941,4 +1950,4 @@ let HTTPStatus = /* @__PURE__ */ function(HTTPStatus$1) {
|
|
|
1941
1950
|
}({});
|
|
1942
1951
|
|
|
1943
1952
|
//#endregion
|
|
1944
|
-
export { App, BadRequestError, BaseMiddleware, BasePlugin, Body, Connect, Controller, Delete, ForbiddenError, Get, HTTPStatus, Head, Header, Headers$1 as Headers, HooksService, HttpError, InternalServerError, Listen, MethodNotAllowedError, Middleware, MultipartFormData, NotAcceptableError, NotFoundError, Options, Param, Patch, Post, Put, QueryParam, QueryParams, Redirect, Request, Response$1 as Response, Session, SetHeader, Status, Trace, UnauthorizedError, createApp, createMetadataCtx, createMetadataMethod, defineConfig, initializeMetadata, initializeMetadataMethod, loadVercubeConfig };
|
|
1953
|
+
export { App, BadRequestError, BaseMiddleware, BasePlugin, Body, Connect, Controller, Delete, ForbiddenError, Get, HTTPStatus, Head, Header, Headers$1 as Headers, HooksService, HttpError, HttpServer, InternalServerError, Listen, MethodNotAllowedError, Middleware, MultipartFormData, NotAcceptableError, NotFoundError, Options, Param, Patch, Post, Put, QueryParam, QueryParams, Redirect, Request, Response$1 as Response, Session, SetHeader, Status, Trace, UnauthorizedError, createApp, createMetadataCtx, createMetadataMethod, defineConfig, initializeMetadata, initializeMetadataMethod, loadVercubeConfig };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercube/core",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.19",
|
|
4
4
|
"description": "Core module for Vercube framework",
|
|
5
5
|
"repository": "@vercube/core",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,15 +21,24 @@
|
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@standard-schema/spec": "1.0.0",
|
|
24
|
-
"c12": "3.0.
|
|
24
|
+
"c12": "3.0.3",
|
|
25
25
|
"defu": "6.1.4",
|
|
26
26
|
"pathe": "2.0.3",
|
|
27
27
|
"rou3": "0.5.1",
|
|
28
|
-
"srvx": "0.2.
|
|
29
|
-
"@vercube/di": "0.0.1-alpha.
|
|
30
|
-
"@vercube/logger": "0.0.1-alpha.
|
|
28
|
+
"srvx": "0.2.8",
|
|
29
|
+
"@vercube/di": "0.0.1-alpha.19",
|
|
30
|
+
"@vercube/logger": "0.0.1-alpha.19"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@vitest/coverage-v8": "^1.3.1",
|
|
34
|
+
"vitest": "^1.3.1"
|
|
31
35
|
},
|
|
32
36
|
"publishConfig": {
|
|
33
37
|
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"test": "vitest",
|
|
41
|
+
"test:watch": "vitest watch",
|
|
42
|
+
"test:coverage": "vitest run --coverage"
|
|
34
43
|
}
|
|
35
44
|
}
|