@zintrust/core 0.4.52 → 0.4.54

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zintrust/core",
3
- "version": "0.4.52",
3
+ "version": "0.4.54",
4
4
  "description": "Production-grade TypeScript backend framework for JavaScript",
5
5
  "homepage": "https://zintrust.com",
6
6
  "repository": {
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/boot/registry/runtime.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAOvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAuN9C,eAAO,MAAM,8BAA8B,GAAI,iBAAiB,gBAAgB,KAAG,IA4BlF,CAAC;AAmPF,eAAO,MAAM,eAAe,GAAI,QAAQ;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,eAAe,EAAE,gBAAgB,CAAC;IAClC,SAAS,EAAE,MAAM,OAAO,CAAC;IACzB,SAAS,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACrC,KAAG;IAAE,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CA+E7D,CAAC"}
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/boot/registry/runtime.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAOvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAuO9C,eAAO,MAAM,8BAA8B,GAAI,iBAAiB,gBAAgB,KAAG,IA4BlF,CAAC;AAsPF,eAAO,MAAM,eAAe,GAAI,QAAQ;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,eAAe,EAAE,gBAAgB,CAAC;IAClC,SAAS,EAAE,MAAM,OAAO,CAAC;IACzB,SAAS,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACrC,KAAG;IAAE,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CA+E7D,CAAC"}
@@ -61,13 +61,17 @@ const loadLocalSystemDebuggerModule = async () => {
61
61
  return tryImportOptional('@runtime/plugins/system-debugger-runtime');
62
62
  };
63
63
  const loadRuntimeQueueConfig = async () => {
64
+ const startupQueueConfig = getStartupQueueConfig();
65
+ if (startupQueueConfig !== undefined) {
66
+ return startupQueueConfig;
67
+ }
64
68
  try {
65
69
  const modulePath = '@runtime-config/queue';
66
70
  const loaded = (await import(modulePath));
67
- return loaded.default ?? queueConfig ?? undefined;
71
+ return loaded.default ?? getQueueConfig();
68
72
  }
69
73
  catch {
70
- return queueConfig ?? undefined;
74
+ return getQueueConfig();
71
75
  }
72
76
  };
73
77
  const readRuntimeConfig = (key, fallback) => {
@@ -79,6 +83,14 @@ const readRuntimeConfig = (key, fallback) => {
79
83
  return fallback;
80
84
  }
81
85
  };
86
+ const getStartupQueueConfig = () => {
87
+ const startupQueueConfig = StartupConfigFileRegistry.get?.(StartupConfigFile.Queue);
88
+ return startupQueueConfig ?? undefined;
89
+ };
90
+ const getQueueConfig = () => {
91
+ return (getStartupQueueConfig() ??
92
+ readRuntimeConfig('queueConfig', RuntimeConfig.queueConfig));
93
+ };
82
94
  const appConfig = readRuntimeConfig('appConfig', {
83
95
  port: 7777,
84
96
  dockerWorker: false,
@@ -86,7 +98,6 @@ const appConfig = readRuntimeConfig('appConfig', {
86
98
  });
87
99
  // exported solely for tests to exercise the default detectRuntime handler
88
100
  const cacheConfig = readRuntimeConfig('cacheConfig', RuntimeConfig.cacheConfig);
89
- const queueConfig = readRuntimeConfig('queueConfig', RuntimeConfig.queueConfig);
90
101
  const storageConfig = readRuntimeConfig('storageConfig', RuntimeConfig.storageConfig);
91
102
  const getDatabaseConfig = () => {
92
103
  return readRuntimeConfig('databaseConfig', liveDatabaseConfig);
@@ -96,7 +107,7 @@ const dbLoader = async () => {
96
107
  registerDatabasesFromRuntimeConfig(getDatabaseConfig());
97
108
  };
98
109
  const queuesLoader = async () => {
99
- await registerQueuesFromRuntimeConfig(queueConfig);
110
+ await registerQueuesFromRuntimeConfig(getQueueConfig());
100
111
  };
101
112
  // eslint-disable-next-line @typescript-eslint/require-await
102
113
  const cachesLoader = async () => {
@@ -225,8 +236,9 @@ const initializeArtifactDirectories = async (resolvedBasePath) => {
225
236
  }
226
237
  }
227
238
  };
228
- const extractRedisConfigFromQueueConfig = () => {
229
- const redisConfig = queueConfig.drivers?.redis ?? {};
239
+ const extractRedisConfigFromQueueConfig = (runtimeQueueConfig) => {
240
+ const redisConfig = (runtimeQueueConfig ?? getQueueConfig())
241
+ .drivers?.redis ?? {};
230
242
  const redisHost = typeof redisConfig['host'] === 'string' ? redisConfig['host'] : '127.0.0.1';
231
243
  const redisPort = typeof redisConfig['port'] === 'number' && Number.isFinite(redisConfig['port'])
232
244
  ? redisConfig['port']
@@ -277,7 +289,7 @@ const initializeQueueMonitor = async (router) => {
277
289
  Logger.debug('Queue Monitor is enabled in configuration but module failed to load or is invalid. Skipping Queue Monitor initialization.');
278
290
  return;
279
291
  }
280
- const redisConfig = extractRedisConfigFromQueueConfig();
292
+ const redisConfig = extractRedisConfigFromQueueConfig(runQueueConfig);
281
293
  const { QueueMonitor } = queueMonitorModule;
282
294
  const resolveKnownQueues = async () => {
283
295
  try {
package/src/boot.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"boot.d.ts","sourceRoot":"","sources":["../../src/boot.ts"],"names":[],"mappings":"AA4CA,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"boot.d.ts","sourceRoot":"","sources":["../../src/boot.ts"],"names":[],"mappings":"AAoCA,OAAO,EAAE,CAAC"}
package/src/boot.js CHANGED
@@ -1,12 +1,7 @@
1
+ import { isNodeRuntime } from './runtime/detectRuntime.js';
1
2
  import { resolveNodeProjectRoot } from './runtime/resolveNodeProjectRoot.js';
2
- const isNodeProcessRuntime = () => {
3
- return (typeof process !== 'undefined' &&
4
- typeof process === 'object' &&
5
- process !== null &&
6
- typeof process.versions === 'object');
7
- };
8
3
  const ensureNodeBootstrapEnv = async () => {
9
- if (!isNodeProcessRuntime())
4
+ if (!isNodeRuntime())
10
5
  return;
11
6
  const projectRoot = await resolveNodeProjectRoot();
12
7
  if ((process.env?.['ZINTRUST_PROJECT_ROOT'] ?? '').trim() === '') {
package/src/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @zintrust/core v0.4.52
2
+ * @zintrust/core v0.4.54
3
3
  *
4
4
  * ZinTrust Framework - Production-Grade TypeScript Backend
5
5
  * Built for performance, type safety, and exceptional developer experience
6
6
  *
7
7
  * Build Information:
8
- * Built: 2026-04-04T14:55:22.232Z
8
+ * Built: 2026-04-04T15:24:52.580Z
9
9
  * Node: >=20.0.0
10
10
  * License: MIT
11
11
  *
@@ -21,7 +21,7 @@
21
21
  * Available at runtime for debugging and health checks
22
22
  */
23
23
  export const ZINTRUST_VERSION = '0.1.41';
24
- export const ZINTRUST_BUILD_DATE = '2026-04-04T14:55:22.199Z'; // Replaced during build
24
+ export const ZINTRUST_BUILD_DATE = '2026-04-04T15:24:52.546Z'; // Replaced during build
25
25
  export { Application } from './boot/Application.js';
26
26
  export { AwsSigV4 } from './common/index.js';
27
27
  export { SignedRequest } from './security/SignedRequest.js';
@@ -1 +1 @@
1
- {"version":3,"file":"detectRuntime.d.ts","sourceRoot":"","sources":["../../../src/runtime/detectRuntime.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,WAAW,GAAG,oBAAoB,GAAG,YAAY,GAAG,aAAa,CAAC;AAE9E,eAAO,MAAM,aAAa,QAAO,OAWhC,CAAC;AAUF,eAAO,MAAM,cAAc,QAAO,WA6BjC,CAAC;AAEF,eAAO,MAAM,aAAa,QAAO;IAC/B,YAAY,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;CAwBhB,CAAC"}
1
+ {"version":3,"file":"detectRuntime.d.ts","sourceRoot":"","sources":["../../../src/runtime/detectRuntime.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,WAAW,GAAG,oBAAoB,GAAG,YAAY,GAAG,aAAa,CAAC;AA4B9E,eAAO,MAAM,aAAa,QAAO,OAUhC,CAAC;AAEF,eAAO,MAAM,cAAc,QAAO,WA4BjC,CAAC;AAEF,eAAO,MAAM,aAAa,QAAO;IAC/B,YAAY,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;CAkBhB,CAAC"}
@@ -1,29 +1,39 @@
1
- import { appConfig } from '../config/index.js';
2
1
  import { ZintrustLang } from '../lang/lang.js';
2
+ const getGlobalThis = () => {
3
+ if (typeof globalThis === ZintrustLang.UNDEFINED) {
4
+ return undefined;
5
+ }
6
+ return globalThis;
7
+ };
8
+ const isCloudflareRuntime = () => {
9
+ const globalRef = getGlobalThis();
10
+ // @ts-ignore - navigator is available in workers
11
+ if (typeof navigator !== 'undefined' && navigator.userAgent === 'Cloudflare-Workers') {
12
+ return true;
13
+ }
14
+ return (typeof globalRef !== ZintrustLang.UNDEFINED &&
15
+ globalRef !== null &&
16
+ ((globalRef.caches !== undefined &&
17
+ typeof globalRef.caches !== ZintrustLang.UNDEFINED) ||
18
+ typeof globalRef.WebSocketPair === 'function' ||
19
+ typeof globalRef.CF !== ZintrustLang.UNDEFINED));
20
+ };
3
21
  export const isNodeRuntime = () => {
4
22
  // Avoid importing any `node:*` modules so this file remains Worker-safe.
5
23
  // In Workers/Deno, `process` is typically undefined.
6
- const detectRuntime = appConfig.detectRuntime() !== 'cloudflare';
7
- return (detectRuntime &&
24
+ return (!isCloudflareRuntime() &&
8
25
  typeof process !== ZintrustLang.UNDEFINED &&
9
26
  typeof process === ZintrustLang.OBJECT &&
10
27
  process !== null &&
11
28
  typeof process.versions === ZintrustLang.OBJECT);
12
29
  };
13
- const getGlobalThis = () => {
14
- if (typeof globalThis === ZintrustLang.UNDEFINED) {
15
- return undefined;
16
- }
17
- return globalThis;
18
- };
19
30
  export const getRuntimeMode = () => {
20
31
  // 1. Explicit override via env var (if available)
21
32
  if (typeof process !== 'undefined' && process.env?.['RUNTIME_MODE'] !== undefined) {
22
33
  return process.env['RUNTIME_MODE'];
23
34
  }
24
35
  // 2. Detect Cloudflare Workers
25
- // @ts-ignore - navigator is available in workers
26
- if (typeof navigator !== 'undefined' && navigator.userAgent === 'Cloudflare-Workers') {
36
+ if (isCloudflareRuntime()) {
27
37
  return 'cloudflare-workers';
28
38
  }
29
39
  // 3. Detect Container (Docker/Kubernetes)
@@ -44,12 +54,7 @@ export const getRuntimeMode = () => {
44
54
  export const detectRuntime = () => {
45
55
  const globalRef = getGlobalThis();
46
56
  const isNode = isNodeRuntime();
47
- const isCloudflare = typeof globalRef !== ZintrustLang.UNDEFINED &&
48
- globalRef !== null &&
49
- ((globalRef.caches !== undefined &&
50
- typeof globalRef.caches !== ZintrustLang.UNDEFINED) ||
51
- typeof globalRef.WebSocketPair === 'function' ||
52
- typeof globalRef.CF !== ZintrustLang.UNDEFINED);
57
+ const isCloudflare = isCloudflareRuntime();
53
58
  const isDeno = typeof globalRef !== ZintrustLang.UNDEFINED &&
54
59
  globalRef !== null &&
55
60
  typeof globalRef.Deno !== ZintrustLang.UNDEFINED;