@vercube/core 0.0.12 → 0.0.14

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/dist/index.d.mts CHANGED
@@ -48,6 +48,12 @@ declare namespace ConfigTypes {
48
48
  duration?: number;
49
49
  };
50
50
  }
51
+ /**
52
+ * Helper type to create a fully typed runtime configuration.
53
+ * This allows users to define their own runtime configuration structure
54
+ * while maintaining type safety.
55
+ */
56
+ type CreateRuntimeConfig<T = Record<string, unknown>> = RuntimeConfig & T;
51
57
  /**
52
58
  * Configuration options for experimental features.
53
59
  * These options may change or be removed in future versions.
@@ -149,7 +155,7 @@ declare namespace ConfigTypes {
149
155
  /**
150
156
  * Runtime configuration for the application.
151
157
  */
152
- runtime?: RuntimeConfig & RuntimeUserConfig;
158
+ runtime?: CreateRuntimeConfig<RuntimeUserConfig>;
153
159
  /**
154
160
  * Experimental features configuration.
155
161
  */
@@ -199,6 +205,12 @@ declare class App {
199
205
  * @param {Container} container - The dependency injection container.
200
206
  */
201
207
  set container(container: Container);
208
+ /**
209
+ * Gets the application config.
210
+ * This method is used to get the application config without runtime config.
211
+ * @returns {ConfigTypes.Config} The application config.
212
+ */
213
+ get config(): ConfigTypes.Config;
202
214
  /**
203
215
  * Initializes the application.
204
216
  *
@@ -249,7 +261,7 @@ declare function createApp(cfg?: ConfigTypes.Config): Promise<App>;
249
261
  * @param {ConfigTypes.Config} config - The configuration object to validate
250
262
  * @returns {ConfigTypes.Config} The validated configuration object
251
263
  */
252
- declare function defineConfig(config: ConfigTypes.Config): ConfigTypes.Config;
264
+ declare function defineConfig<T = Record<string, unknown>>(config: ConfigTypes.Config<T>): ConfigTypes.Config<T>;
253
265
  //#endregion
254
266
  //#region src/Config/Loader.d.ts
255
267
  /**
@@ -1037,7 +1049,7 @@ declare class Router {
1037
1049
  * RuntimeConfig class manages the runtime configuration for the Vercube application.
1038
1050
  * This class provides a centralized way to access and modify runtime configuration settings.
1039
1051
  */
1040
- declare class RuntimeConfig$1 {
1052
+ declare class RuntimeConfig$1<T = Record<string, unknown>> {
1041
1053
  /**
1042
1054
  * Private field to store the runtime configuration object.
1043
1055
  * @private
@@ -1045,14 +1057,14 @@ declare class RuntimeConfig$1 {
1045
1057
  private fRuntimeConfig;
1046
1058
  /**
1047
1059
  * Gets the current runtime configuration.
1048
- * @returns {ConfigTypes.Config['runtime']} The current runtime configuration object.
1060
+ * @returns {ConfigTypes.CreateRuntimeConfig<T> | undefined} The current runtime configuration object.
1049
1061
  */
1050
- get runtimeConfig(): ConfigTypes.Config['runtime'];
1062
+ get runtimeConfig(): ConfigTypes.CreateRuntimeConfig<T> | undefined;
1051
1063
  /**
1052
1064
  * Sets the runtime configuration.
1053
- * @param {ConfigTypes.RuntimeConfig} value - The new runtime configuration object to set.
1065
+ * @param {ConfigTypes.CreateRuntimeConfig<T>} value - The new runtime configuration object to set.
1054
1066
  */
1055
- set runtimeConfig(value: ConfigTypes.Config['runtime']);
1067
+ set runtimeConfig(value: ConfigTypes.CreateRuntimeConfig<T> | undefined);
1056
1068
  }
1057
1069
  //#endregion
1058
1070
  //#region src/Errors/HttpError.d.ts
package/dist/index.mjs CHANGED
@@ -36,8 +36,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
36
36
  }) : target, mod));
37
37
 
38
38
  //#endregion
39
- //#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/decorate.js
40
- var require_decorate = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/decorate.js"(exports, module) {
39
+ //#region ../../node_modules/.pnpm/@oxc-project+runtime@0.75.0/node_modules/@oxc-project/runtime/src/helpers/decorate.js
40
+ var require_decorate = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.75.0/node_modules/@oxc-project/runtime/src/helpers/decorate.js"(exports, module) {
41
41
  function __decorate(decorators, target, key, desc) {
42
42
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
43
43
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -141,7 +141,7 @@ var HooksService = class {
141
141
  });
142
142
  if (timeout !== null) waitTimeout = setTimeout(() => {
143
143
  this.off(eventId);
144
- reject(new Error(`Waiting for event timeout - ${type.name}`));
144
+ reject(/* @__PURE__ */ new Error(`Waiting for event timeout - ${type.name}`));
145
145
  }, timeout);
146
146
  });
147
147
  }
@@ -300,7 +300,7 @@ var HttpError = class HttpError extends Error {
300
300
  Object.setPrototypeOf(this, HttpError.prototype);
301
301
  if (status) this.status = status;
302
302
  if (message) this.message = message;
303
- this.stack = new Error().stack;
303
+ this.stack = (/* @__PURE__ */ new Error()).stack;
304
304
  }
305
305
  };
306
306
 
@@ -872,14 +872,14 @@ var RuntimeConfig = class {
872
872
  fRuntimeConfig;
873
873
  /**
874
874
  * Gets the current runtime configuration.
875
- * @returns {ConfigTypes.Config['runtime']} The current runtime configuration object.
875
+ * @returns {ConfigTypes.CreateRuntimeConfig<T> | undefined} The current runtime configuration object.
876
876
  */
877
877
  get runtimeConfig() {
878
878
  return this.fRuntimeConfig;
879
879
  }
880
880
  /**
881
881
  * Sets the runtime configuration.
882
- * @param {ConfigTypes.RuntimeConfig} value - The new runtime configuration object to set.
882
+ * @param {ConfigTypes.CreateRuntimeConfig<T>} value - The new runtime configuration object to set.
883
883
  */
884
884
  set runtimeConfig(value) {
885
885
  this.fRuntimeConfig = value;
@@ -921,6 +921,17 @@ var App = class {
921
921
  this.fInternalContainer = container;
922
922
  }
923
923
  /**
924
+ * Gets the application config.
925
+ * This method is used to get the application config without runtime config.
926
+ * @returns {ConfigTypes.Config} The application config.
927
+ */
928
+ get config() {
929
+ return {
930
+ ...this.fConfig,
931
+ runtime: void 0
932
+ };
933
+ }
934
+ /**
924
935
  * Initializes the application.
925
936
  *
926
937
  * @returns {Promise<void>} A promise that resolves when the application is initialized.
@@ -1111,8 +1122,8 @@ function generateRandomHash() {
1111
1122
  */
1112
1123
  const defaultConfig = {
1113
1124
  logLevel: "debug",
1114
- production: false,
1115
- dev: false,
1125
+ production: process.env.NODE_ENV === "production",
1126
+ dev: process.env.NODE_ENV !== "production",
1116
1127
  build: {
1117
1128
  root: process.cwd(),
1118
1129
  entry: "src/index.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercube/core",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "Core module for Vercube framework",
5
5
  "repository": "@vercube/core",
6
6
  "license": "MIT",
@@ -22,10 +22,10 @@
22
22
  "c12": "3.0.4",
23
23
  "defu": "6.1.4",
24
24
  "pathe": "2.0.3",
25
- "rou3": "0.6.3",
25
+ "rou3": "0.7.3",
26
26
  "srvx": "0.8.0",
27
- "@vercube/di": "0.0.12",
28
- "@vercube/logger": "0.0.12"
27
+ "@vercube/di": "0.0.14",
28
+ "@vercube/logger": "0.0.14"
29
29
  },
30
30
  "publishConfig": {
31
31
  "access": "public"