@zintrust/core 0.1.38 → 0.1.40

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.
Files changed (72) hide show
  1. package/bin/z.js +0 -0
  2. package/bin/zin.js +0 -0
  3. package/bin/zintrust.js +0 -0
  4. package/bin/zt.js +0 -0
  5. package/package.json +2 -2
  6. package/public/index.html +2 -2
  7. package/src/boot/Application.d.ts.map +1 -1
  8. package/src/boot/Application.js +101 -74
  9. package/src/boot/bootstrap.js +2 -6
  10. package/src/cli/PromptHelper.js +2 -2
  11. package/src/cli/commands/MigrateWorkerCommand.d.ts.map +1 -1
  12. package/src/cli/commands/MigrateWorkerCommand.js +1 -1
  13. package/src/cli/commands/StartCommand.d.ts.map +1 -1
  14. package/src/cli/commands/StartCommand.js +16 -4
  15. package/src/cli/utils/EnvFileLoader.d.ts +2 -1
  16. package/src/cli/utils/EnvFileLoader.d.ts.map +1 -1
  17. package/src/cli/utils/EnvFileLoader.js +8 -8
  18. package/src/cli/utils/spawn.d.ts.map +1 -1
  19. package/src/cli/utils/spawn.js +17 -10
  20. package/src/cli/workers/QueueWorkRunner.d.ts.map +1 -1
  21. package/src/cli/workers/QueueWorkRunner.js +5 -5
  22. package/src/common/ExternalServiceUtils.d.ts.map +1 -1
  23. package/src/common/ExternalServiceUtils.js +7 -2
  24. package/src/config/env.d.ts +5 -0
  25. package/src/config/env.d.ts.map +1 -1
  26. package/src/config/env.js +7 -1
  27. package/src/config/index.d.ts +1 -1
  28. package/src/config/logger.d.ts.map +1 -1
  29. package/src/config/logger.js +60 -16
  30. package/src/config/queue.d.ts +1 -1
  31. package/src/config/queue.d.ts.map +1 -1
  32. package/src/config/queue.js +11 -6
  33. package/src/config/redis.d.ts.map +1 -1
  34. package/src/config/redis.js +3 -2
  35. package/src/config/type.d.ts +9 -5
  36. package/src/config/type.d.ts.map +1 -1
  37. package/src/config/workers.d.ts.map +1 -1
  38. package/src/config/workers.js +4 -0
  39. package/src/index.d.ts +3 -2
  40. package/src/index.d.ts.map +1 -1
  41. package/src/index.js +3 -4
  42. package/src/lang/lang.d.ts +3 -0
  43. package/src/lang/lang.d.ts.map +1 -1
  44. package/src/lang/lang.js +3 -0
  45. package/src/middleware/CsrfMiddleware.d.ts.map +1 -1
  46. package/src/middleware/CsrfMiddleware.js +26 -11
  47. package/src/orm/Model.d.ts.map +1 -1
  48. package/src/orm/Model.js +17 -6
  49. package/src/routes/errorPages.js +1 -1
  50. package/src/runtime/PluginAutoImports.d.ts.map +1 -1
  51. package/src/runtime/PluginAutoImports.js +33 -7
  52. package/src/security/CsrfTokenManager.d.ts +18 -9
  53. package/src/security/CsrfTokenManager.d.ts.map +1 -1
  54. package/src/security/CsrfTokenManager.js +192 -11
  55. package/src/templates/project/basic/app/Middleware/index.ts.tpl +1 -1
  56. package/src/templates/project/basic/config/queue.ts.tpl +2 -2
  57. package/src/toolkit/Secrets/providers/AwsSecretsManager.d.ts.map +1 -1
  58. package/src/toolkit/Secrets/providers/AwsSecretsManager.js +4 -2
  59. package/src/tools/queue/AdvancedQueue.d.ts +2 -1
  60. package/src/tools/queue/AdvancedQueue.d.ts.map +1 -1
  61. package/src/tools/queue/AdvancedQueue.js +2 -1
  62. package/src/tools/queue/LockProvider.d.ts +4 -0
  63. package/src/tools/queue/LockProvider.d.ts.map +1 -1
  64. package/src/tools/queue/LockProvider.js +16 -0
  65. package/src/tools/queue/Queue.d.ts +38 -2
  66. package/src/tools/queue/Queue.d.ts.map +1 -1
  67. package/src/tools/queue/Queue.js +3 -2
  68. package/src/tools/queue/QueueExtensions.d.ts +2 -1
  69. package/src/tools/queue/QueueExtensions.d.ts.map +1 -1
  70. package/src/tools/redis/RedisKeyManager.d.ts +3 -0
  71. package/src/tools/redis/RedisKeyManager.d.ts.map +1 -1
  72. package/src/tools/redis/RedisKeyManager.js +23 -8
package/bin/z.js CHANGED
File without changes
package/bin/zin.js CHANGED
File without changes
package/bin/zintrust.js CHANGED
File without changes
package/bin/zt.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zintrust/core",
3
- "version": "0.1.38",
3
+ "version": "0.1.40",
4
4
  "description": "Production-grade TypeScript backend framework for JavaScript",
5
5
  "homepage": "https://zintrust.com",
6
6
  "repository": {
@@ -36,7 +36,7 @@
36
36
  "bcrypt": "^6.0.0",
37
37
  "chalk": "^5.6.2",
38
38
  "commander": "^14.0.2",
39
- "inquirer": "^13.2.1",
39
+ "inquirer": "^13.2.2",
40
40
  "jsonwebtoken": "^9.0.3"
41
41
  },
42
42
  "overrides": {
package/public/index.html CHANGED
@@ -424,7 +424,7 @@
424
424
  'zin new my-api',
425
425
  'cd my-api',
426
426
  'zin start',
427
- 'curl http://localhost:3000/health',
427
+ 'curl http://localhost:7777/health',
428
428
  'zin debug',
429
429
  ],
430
430
  },
@@ -434,7 +434,7 @@
434
434
  lines: [
435
435
  'docker build -t my-api:latest .',
436
436
  'docker run --rm -p 3000:3000 my-api:latest',
437
- 'curl http://localhost:3000/health',
437
+ 'curl http://localhost:7777/health',
438
438
  ],
439
439
  },
440
440
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Application.d.ts","sourceRoot":"","sources":["../../../src/boot/Application.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAGtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAOrE,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,qBAAqB,CAAC;AAK3D,MAAM,WAAW,YAAY;IAC3B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,QAAQ,IAAI,OAAO,CAAC;IACpB,aAAa,IAAI,OAAO,CAAC;IACzB,YAAY,IAAI,OAAO,CAAC;IACxB,SAAS,IAAI,OAAO,CAAC;IACrB,cAAc,IAAI,MAAM,CAAC;IACzB,SAAS,IAAI,OAAO,CAAC;IACrB,YAAY,IAAI,iBAAiB,CAAC;IAClC,kBAAkB,IAAI,gBAAgB,CAAC;IACvC,WAAW,IAAI,MAAM,CAAC;CACvB;AA8ZD;;GAEG;AACH,eAAO,MAAM,WAAW;IACtB;;OAEG;sBACe,MAAM,GAAG,YAAY;EA0CvC,CAAC;AAEH,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"Application.d.ts","sourceRoot":"","sources":["../../../src/boot/Application.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAGtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAOrE,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,qBAAqB,CAAC;AAK3D,MAAM,WAAW,YAAY;IAC3B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,QAAQ,IAAI,OAAO,CAAC;IACpB,aAAa,IAAI,OAAO,CAAC;IACzB,YAAY,IAAI,OAAO,CAAC;IACxB,SAAS,IAAI,OAAO,CAAC;IACrB,cAAc,IAAI,MAAM,CAAC;IACzB,SAAS,IAAI,OAAO,CAAC;IACrB,YAAY,IAAI,iBAAiB,CAAC;IAClC,kBAAkB,IAAI,gBAAgB,CAAC;IACvC,WAAW,IAAI,MAAM,CAAC;CACvB;AAicD;;GAEG;AACH,eAAO,MAAM,WAAW;IACtB;;OAEG;sBACe,MAAM,GAAG,YAAY;EA0CvC,CAAC;AAEH,eAAe,WAAW,CAAC"}
@@ -23,10 +23,8 @@ const ShutdownManager = Object.freeze({
23
23
  hooks.push(hook);
24
24
  },
25
25
  async run() {
26
- for (const hook of hooks) {
27
- // eslint-disable-next-line no-await-in-loop
28
- await hook();
29
- }
26
+ // Run hooks in parallel for better performance
27
+ await Promise.all(hooks.map(async (hook) => hook()));
30
28
  },
31
29
  });
32
30
  },
@@ -58,82 +56,110 @@ const registerCoreInstances = (params) => {
58
56
  params.container.singleton('container', params.container);
59
57
  params.container.singleton('shutdownManager', params.shutdownManager);
60
58
  };
61
- const registerFrameworkShutdownHooks = (shutdownManager) => {
62
- // Register framework-level shutdown hooks for long-lived resources
63
- // ConnectionManager may not be initialized; shutdownIfInitialized is safe
64
- // Use dynamic import without top-level await to avoid transforming the module into an async module
65
- import('../orm/ConnectionManager.js')
66
- .then((mod) => {
67
- shutdownManager.add(async () => mod.ConnectionManager.shutdownIfInitialized());
68
- })
69
- .catch(() => {
70
- /* ignore import failures in restrictive runtimes */
71
- });
72
- import('../orm/Database.js')
73
- .then((mod) => {
74
- shutdownManager.add(() => mod.resetDatabase());
75
- })
76
- .catch(() => {
77
- /* ignore import failures in restrictive runtimes */
78
- });
79
- import('../cache/Cache.js')
80
- .then((mod) => {
81
- shutdownManager.add(() => mod.Cache.reset());
82
- })
83
- .catch(() => {
84
- /* ignore import failures in restrictive runtimes */
85
- });
86
- // Flush file logging streams
87
- import('../config/FileLogWriter.js')
88
- .then((mod) => {
89
- shutdownManager.add(() => mod.FileLogWriter.flush());
90
- })
91
- .catch(() => {
92
- /* ignore import failures in restrictive runtimes */
93
- });
94
- import('../tools/broadcast/BroadcastRegistry.js')
95
- .then((mod) => {
96
- shutdownManager.add(() => mod.BroadcastRegistry.reset());
97
- })
98
- .catch(() => {
99
- /* ignore import failures in restrictive runtimes */
100
- });
101
- import('../tools/storage/StorageDiskRegistry.js')
102
- .then((mod) => {
103
- shutdownManager.add(() => mod.StorageDiskRegistry.reset());
104
- })
105
- .catch(() => {
106
- /* ignore import failures in restrictive runtimes */
59
+ /**
60
+ * Helper: Register ConnectionManager shutdown hook
61
+ */
62
+ const registerConnectionManagerHook = (shutdownManager) => {
63
+ shutdownManager.add(async () => {
64
+ try {
65
+ const mod = await import('../orm/ConnectionManager.js');
66
+ await mod.ConnectionManager.shutdownIfInitialized();
67
+ }
68
+ catch {
69
+ /* ignore import failures in restrictive runtimes */
70
+ }
107
71
  });
108
- import('../tools/notification/NotificationChannelRegistry.js')
109
- .then((mod) => {
110
- shutdownManager.add(() => mod.NotificationChannelRegistry.reset());
111
- })
112
- .catch(() => {
113
- /* ignore import failures in restrictive runtimes */
72
+ };
73
+ /**
74
+ * Helper: Register Worker management system shutdown hook
75
+ */
76
+ const registerWorkerShutdownHook = async (shutdownManager) => {
77
+ // Ensure worker management system is asked to shutdown BEFORE databases are reset.
78
+ // This prevents workers from trying to access DB connections that have already
79
+ // been closed by subsequent shutdown hooks.
80
+ shutdownManager.add(async () => {
81
+ try {
82
+ const mod = (await import('@zintrust/workers'));
83
+ const isShuttingDown = typeof mod.WorkerShutdown.isShuttingDown === 'function'
84
+ ? mod.WorkerShutdown.isShuttingDown()
85
+ : (mod.WorkerShutdown.getShutdownState?.().isShuttingDown ?? false);
86
+ const completedAt = mod.WorkerShutdown.getShutdownState?.().completedAt ?? null;
87
+ if (isShuttingDown || completedAt !== null)
88
+ return;
89
+ await mod.WorkerShutdown.shutdown({
90
+ signal: 'APP_SHUTDOWN',
91
+ timeout: 5000,
92
+ forceExit: false,
93
+ });
94
+ }
95
+ catch {
96
+ /* ignore import failures in restrictive runtimes */
97
+ }
114
98
  });
115
- import('../tools/mail/MailDriverRegistry.js')
116
- .then((mod) => {
117
- shutdownManager.add(() => mod.MailDriverRegistry.reset());
118
- })
119
- .catch(() => {
120
- /* ignore import failures in restrictive runtimes */
99
+ return Promise.resolve(); // NOSONAR
100
+ };
101
+ /**
102
+ * Helper: Register Database reset hook
103
+ */
104
+ const registerDatabaseResetHook = (shutdownManager) => {
105
+ shutdownManager.add(async () => {
106
+ try {
107
+ const mod = await import('../orm/Database.js');
108
+ mod.resetDatabase();
109
+ }
110
+ catch {
111
+ /* ignore import failures in restrictive runtimes */
112
+ }
121
113
  });
122
- import('../tools/queue/Queue.js')
123
- .then((mod) => {
124
- shutdownManager.add(() => mod.Queue.reset());
125
- })
126
- .catch(() => {
127
- /* ignore import failures in restrictive runtimes */
114
+ };
115
+ /**
116
+ * Helper: Register generic reset hook for modules with reset() method
117
+ */
118
+ const registerResetHook = (shutdownManager, modulePath, exportName) => {
119
+ shutdownManager.add(async () => {
120
+ try {
121
+ const mod = (await import(modulePath));
122
+ const resetModule = mod[exportName];
123
+ if (resetModule?.reset) {
124
+ resetModule.reset();
125
+ }
126
+ }
127
+ catch {
128
+ /* ignore import failures in restrictive runtimes */
129
+ }
128
130
  });
129
- import('@zintrust/workers')
130
- .then((mod) => {
131
- shutdownManager.add(async () => mod.WorkerShutdown.shutdown({ signal: 'APP_SHUTDOWN', timeout: 5000, forceExit: false }));
132
- })
133
- .catch(() => {
134
- /* ignore import failures in restrictive runtimes */
131
+ };
132
+ /**
133
+ * Helper: Register FileLogWriter flush hook
134
+ */
135
+ const registerFileLogFlushHook = (shutdownManager) => {
136
+ shutdownManager.add(async () => {
137
+ try {
138
+ const mod = await import('../config/FileLogWriter.js');
139
+ mod.FileLogWriter.flush();
140
+ }
141
+ catch {
142
+ /* ignore import failures in restrictive runtimes */
143
+ }
135
144
  });
136
145
  };
146
+ const registerFrameworkShutdownHooks = (shutdownManager) => {
147
+ // Register framework-level shutdown hooks for long-lived resources
148
+ registerConnectionManagerHook(shutdownManager);
149
+ // Ensure worker management system is asked to shutdown BEFORE databases are reset
150
+ void registerWorkerShutdownHook(shutdownManager);
151
+ // Database and cache reset
152
+ registerDatabaseResetHook(shutdownManager);
153
+ registerResetHook(shutdownManager, '@cache/Cache', 'Cache');
154
+ // File logging
155
+ registerFileLogFlushHook(shutdownManager);
156
+ // Registry resets
157
+ registerResetHook(shutdownManager, '@broadcast/BroadcastRegistry', 'BroadcastRegistry');
158
+ registerResetHook(shutdownManager, '@storage/StorageDiskRegistry', 'StorageDiskRegistry');
159
+ registerResetHook(shutdownManager, '@notification/NotificationChannelRegistry', 'NotificationChannelRegistry');
160
+ registerResetHook(shutdownManager, '@mail/MailDriverRegistry', 'MailDriverRegistry');
161
+ registerResetHook(shutdownManager, '@tools/queue/Queue', 'Queue');
162
+ };
137
163
  const tryImportRoutesFromAppBase = async (resolvedBasePath) => {
138
164
  if (resolvedBasePath === '')
139
165
  return undefined;
@@ -148,6 +174,7 @@ const tryImportRoutesFromAppBase = async (resolvedBasePath) => {
148
174
  for (const candidate of candidates) {
149
175
  try {
150
176
  const url = pathToFileURL(candidate).href;
177
+ // Intentionally sequential to find the first working candidates
151
178
  // eslint-disable-next-line no-await-in-loop
152
179
  return (await import(url));
153
180
  }
@@ -103,9 +103,7 @@ const gracefulShutdown = async (signal) => {
103
103
  // Shutdown worker management system FIRST (before database closes)
104
104
  if (appConfig.detectRuntime() === 'nodejs' || appConfig.detectRuntime() === 'lambda') {
105
105
  try {
106
- const { createRequire } = await import('../node-singletons/module.js');
107
- const require = createRequire(import.meta.url);
108
- const workers = require('@zintrust/workers');
106
+ const workers = await import('@zintrust/workers');
109
107
  const workerBudgetMs = Math.min(15000, remainingMs());
110
108
  await withTimeout(workers.WorkerShutdown.shutdown({
111
109
  signal,
@@ -142,9 +140,7 @@ async function useWorkerStarter() {
142
140
  // Initialize worker management system
143
141
  let workerInit = null;
144
142
  try {
145
- const { createRequire } = await import('../node-singletons/module.js');
146
- const require = createRequire(import.meta.url);
147
- const workers = require('@zintrust/workers');
143
+ const workers = await import('@zintrust/workers');
148
144
  if (workers?.WorkerInit !== undefined) {
149
145
  workerInit = workers.WorkerInit;
150
146
  await workers.WorkerInit.initialize({
@@ -59,7 +59,7 @@ export const PromptHelper = Object.freeze({
59
59
  default: defaultDb,
60
60
  },
61
61
  ]);
62
- return answer.database;
62
+ return answer['database'];
63
63
  },
64
64
  /**
65
65
  * Ask for port number
@@ -134,7 +134,7 @@ export const PromptHelper = Object.freeze({
134
134
  default: defaultChoice,
135
135
  },
136
136
  ]);
137
- return answer.choice;
137
+ return answer['choice'];
138
138
  },
139
139
  /**
140
140
  * Get text input
@@ -1 +1 @@
1
- {"version":3,"file":"MigrateWorkerCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/MigrateWorkerCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAmKrE,eAAO,MAAM,oBAAoB;cACrB,YAAY;EAUtB,CAAC"}
1
+ {"version":3,"file":"MigrateWorkerCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/MigrateWorkerCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAqKrE,eAAO,MAAM,oBAAoB;cACrB,YAAY;EAUtB,CAAC"}
@@ -82,7 +82,7 @@ const runForConnection = async (conn, options, cmd, interactive) => {
82
82
  return;
83
83
  if (!DatabaseAdapterRegistry.has(conn.driver)) {
84
84
  cmd.warn(`Missing adapter for driver: ${conn.driver}`);
85
- cmd.warn('Install via `zin plugin install adapter:postgres` (or `zin add db:postgres`).');
85
+ cmd.warn(`Install via 'zin plugin install adapter:${conn.driver}' (or 'zin add db:${conn.driver}').`);
86
86
  }
87
87
  const ormConfig = mapConnectionToOrmConfig(conn);
88
88
  const db = Database.create(ormConfig);
@@ -1 +1 @@
1
- {"version":3,"file":"StartCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/StartCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAqavF,eAAO,MAAM,YAAY;cACb,YAAY;EAyBtB,CAAC"}
1
+ {"version":3,"file":"StartCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/StartCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAobvF,eAAO,MAAM,YAAY;cACb,YAAY;EAyBtB,CAAC"}
@@ -21,12 +21,12 @@ const normalizeMode = (value) => {
21
21
  return 'development';
22
22
  };
23
23
  const resolveModeFromAppMode = () => {
24
- const raw = readEnvString('APP_MODE').trim();
24
+ const raw = readEnvString('NODE_ENV').trim();
25
25
  const normalized = raw.toLowerCase();
26
26
  if (normalized === 'production' || normalized === 'pro' || normalized === 'prod') {
27
27
  return 'production';
28
28
  }
29
- // Per spec: any other APP_MODE is treated as development.
29
+ // Per spec: any other NODE_ENV is treated as development.
30
30
  return 'development';
31
31
  };
32
32
  const resolveMode = (options) => {
@@ -159,12 +159,24 @@ const resolveNodeDevCommand = (cwd, packageJson) => {
159
159
  };
160
160
  const resolveNodeProdCommand = (cwd) => {
161
161
  const compiledBoot = path.join(cwd, 'dist/src/boot/bootstrap.js');
162
+ const runFromSourceEnv = process.env['ZINTRUST_RUN_FROM_SOURCE'] ?? '';
163
+ const runFromSource = runFromSourceEnv === '1' || runFromSourceEnv.toLowerCase() === 'true';
162
164
  let compiled;
163
- if (existsSync(compiledBoot)) {
165
+ if (existsSync(compiledBoot) && !runFromSource) {
164
166
  compiled = 'dist/src/boot/bootstrap.js';
165
167
  }
168
+ // If compiled app isn't available (or the env forces running from source),
169
+ // fall back to running the source entry with `tsx` so developers can test
170
+ // core files with production semantics without building.
166
171
  if (compiled === undefined) {
167
- throw ErrorFactory.createCliError("Error: Compiled app not found at dist/src/boot/bootstrap.js Run 'npm run build' first.");
172
+ const bootstrap = resolveBootstrapEntryTs(cwd);
173
+ if (bootstrap !== undefined) {
174
+ return { command: 'tsx', args: [bootstrap] };
175
+ }
176
+ if (existsSync(path.join(cwd, 'src/index.ts'))) {
177
+ return { command: 'tsx', args: ['src/index.ts'] };
178
+ }
179
+ throw ErrorFactory.createCliError("Error: Compiled app not found at dist/src/boot/bootstrap.js. Run 'npm run build' first or set ZINTRUST_RUN_FROM_SOURCE=1 to run source in production.");
168
180
  }
169
181
  return { command: 'node', args: [compiled] };
170
182
  };
@@ -1,3 +1,4 @@
1
+ type node_env = 'development' | 'production' | 'testing';
1
2
  type LoadOptions = {
2
3
  cwd?: string;
3
4
  overrideExisting?: boolean;
@@ -7,7 +8,7 @@ type LoadState = {
7
8
  mode?: string;
8
9
  };
9
10
  type CliOverrides = {
10
- nodeEnv?: 'development' | 'production' | 'testing';
11
+ nodeEnv?: node_env;
11
12
  port?: number;
12
13
  runtime?: string;
13
14
  };
@@ -1 +1 @@
1
- {"version":3,"file":"EnvFileLoader.d.ts","sourceRoot":"","sources":["../../../../src/cli/utils/EnvFileLoader.ts"],"names":[],"mappings":"AAgHA,KAAK,WAAW,GAAG;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,KAAK,SAAS,GAAG;IACf,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,OAAO,CAAC,EAAE,aAAa,GAAG,YAAY,GAAG,SAAS,CAAC;IACnD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAsFF,eAAO,MAAM,aAAa;qBA7DH,WAAW,KAAQ,SAAS;wBA8B1B,SAAS;mCAEI,YAAY,KAAG,IAAI;oBA2BpC,SAAS;EAO5B,CAAC"}
1
+ {"version":3,"file":"EnvFileLoader.d.ts","sourceRoot":"","sources":["../../../../src/cli/utils/EnvFileLoader.ts"],"names":[],"mappings":"AAQA,KAAK,QAAQ,GAAG,aAAa,GAAG,YAAY,GAAG,SAAS,CAAC;AAoGzD,KAAK,WAAW,GAAG;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,KAAK,SAAS,GAAG;IACf,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AA2FF,eAAO,MAAM,aAAa;qBAlEH,WAAW,KAAQ,SAAS;wBAmC1B,SAAS;mCAEI,YAAY,KAAG,IAAI;oBA2BpC,SAAS;EAO5B,CAAC"}
@@ -5,9 +5,9 @@ const normalizeAppMode = (value) => {
5
5
  if (normalized === 'production' || normalized === 'pro' || normalized === 'prod')
6
6
  return 'production';
7
7
  if (normalized === 'dev' || normalized === 'development')
8
- return 'dev';
8
+ return 'development';
9
9
  // Per spec: any other value is treated as development.
10
- return 'dev';
10
+ return 'development';
11
11
  };
12
12
  const stripInlineComment = (value) => {
13
13
  let inSingle = false;
@@ -69,10 +69,6 @@ const applyToProcessEnv = (values, overrideExisting) => {
69
69
  if (typeof process.env['PORT'] !== 'string' && typeof process.env['APP_PORT'] === 'string') {
70
70
  process.env['PORT'] = process.env['APP_PORT'];
71
71
  }
72
- if (typeof process.env['NODE_ENV'] !== 'string' && typeof process.env['APP_MODE'] === 'string') {
73
- const mode = normalizeAppMode(process.env['APP_MODE']);
74
- process.env['NODE_ENV'] = mode === 'production' ? 'production' : 'development';
75
- }
76
72
  };
77
73
  const readEnvFileIfExists = (cwd, filename) => {
78
74
  const fullPath = join(cwd, filename);
@@ -82,11 +78,11 @@ const readEnvFileIfExists = (cwd, filename) => {
82
78
  return parseEnvFile(raw);
83
79
  };
84
80
  const resolveAppMode = (cwd) => {
85
- const existing = process.env['APP_MODE'];
81
+ const existing = process.env['NODE_ENV'];
86
82
  if (typeof existing === 'string' && existing.trim() !== '')
87
83
  return normalizeAppMode(existing);
88
84
  const fromDotEnv = readEnvFileIfExists(cwd, '.env');
89
- const value = fromDotEnv?.['APP_MODE'];
85
+ const value = fromDotEnv?.['NODE_ENV'];
90
86
  if (typeof value === 'string' && value.trim() !== '')
91
87
  return normalizeAppMode(value);
92
88
  return undefined;
@@ -132,6 +128,10 @@ const load = (options = {}) => {
132
128
  // .env is primary: overlays only fill missing values and never override base.
133
129
  applyToProcessEnv(parsed, baseApplied ? false : overrideExisting);
134
130
  }
131
+ // Set NODE_ENV to the normalized mode if we have one (after applying files)
132
+ if (mode !== undefined) {
133
+ process.env['NODE_ENV'] = mode;
134
+ }
135
135
  cached = { loadedFiles: files, mode };
136
136
  return cached;
137
137
  };
@@ -1 +1 @@
1
- {"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../../src/cli/utils/spawn.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AA8BD,eAAO,MAAM,SAAS;wBACM,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;EAwE7D,CAAC"}
1
+ {"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../../src/cli/utils/spawn.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AA8BD,eAAO,MAAM,SAAS;wBACM,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;EA+E7D,CAAC"}
@@ -58,12 +58,21 @@ export const SpawnUtil = Object.freeze({
58
58
  throw wrapped;
59
59
  }
60
60
  };
61
- const onSigint = () => forwardSignal('SIGINT');
62
- const onSigterm = () => forwardSignal('SIGTERM');
63
- if (forwardSignals) {
64
- process.on('SIGINT', onSigint);
65
- process.on('SIGTERM', onSigterm);
66
- }
61
+ const onSigint = () => {
62
+ if (forwardSignals) {
63
+ forwardSignal('SIGINT');
64
+ }
65
+ // If not forwarding, handle to prevent the parent from exiting before the child
66
+ // finishes its graceful shutdown (child receives SIGINT directly in TTY).
67
+ };
68
+ const onSigterm = () => {
69
+ if (forwardSignals) {
70
+ forwardSignal('SIGTERM');
71
+ }
72
+ // Same rationale as SIGINT: keep parent alive while waiting for child to exit.
73
+ };
74
+ process.on('SIGINT', onSigint);
75
+ process.on('SIGTERM', onSigterm);
67
76
  try {
68
77
  const result = await new Promise((resolve, reject) => {
69
78
  child.once('error', (error) => {
@@ -83,10 +92,8 @@ export const SpawnUtil = Object.freeze({
83
92
  throw ErrorFactory.createTryCatchError('Failed to spawn child process', error);
84
93
  }
85
94
  finally {
86
- if (forwardSignals) {
87
- process.off('SIGINT', onSigint);
88
- process.off('SIGTERM', onSigterm);
89
- }
95
+ process.off('SIGINT', onSigint);
96
+ process.off('SIGTERM', onSigterm);
90
97
  }
91
98
  },
92
99
  });
@@ -1 +1 @@
1
- {"version":3,"file":"QueueWorkRunner.d.ts","sourceRoot":"","sources":["../../../../src/cli/workers/QueueWorkRunner.ts"],"names":[],"mappings":"AAsBA,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,cAAc,CAAC;AAoBzD,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0EAA0E;IAC1E,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AA0QF,eAAO,MAAM,eAAe;iBACP,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC;qBAuCzD,OAAO,GAAG,aAAa;EAUxC,CAAC;AAEH,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"QueueWorkRunner.d.ts","sourceRoot":"","sources":["../../../../src/cli/workers/QueueWorkRunner.ts"],"names":[],"mappings":"AAuBA,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,cAAc,CAAC;AAoBzD,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0EAA0E;IAC1E,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AA0QF,eAAO,MAAM,eAAe;iBACP,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC;qBAuCzD,OAAO,GAAG,aAAa;EAUxC,CAAC;AAEH,eAAe,eAAe,CAAC"}
@@ -52,23 +52,23 @@ let lockProviderCache = null;
52
52
  const getLockProviderForQueue = () => {
53
53
  if (lockProviderCache)
54
54
  return lockProviderCache;
55
- const providerName = Env.get('QUEUE_LOCK_PROVIDER', ZintrustLang.REDIS).trim();
55
+ const providerDrive = queueConfig.default;
56
56
  const prefix = resolveLockPrefix();
57
57
  const defaultTtl = Env.getInt('QUEUE_DEFAULT_DEDUP_TTL', ZintrustLang.ZINTRUST_LOCKS_TTL);
58
- const existing = getLockProvider(providerName);
58
+ const existing = getLockProvider(providerDrive);
59
59
  if (existing) {
60
60
  lockProviderCache = existing;
61
61
  return existing;
62
62
  }
63
63
  const provider = createLockProvider({
64
- type: providerName === ZintrustLang.REDIS ? ZintrustLang.REDIS : ZintrustLang.MEMORY,
64
+ type: providerDrive === ZintrustLang.REDIS ? ZintrustLang.REDIS : ZintrustLang.MEMORY,
65
65
  prefix: prefix.length > 0 ? prefix : ZintrustLang.ZINTRUST_LOCKS_PREFIX,
66
66
  defaultTtl,
67
67
  });
68
- registerLockProvider(providerName, provider);
68
+ registerLockProvider(providerDrive, provider);
69
69
  // Also register under the literal memory name to ensure callers that expect
70
70
  // a 'memory'-named provider (tests or other runtime code) can find it.
71
- if (providerName !== ZintrustLang.MEMORY) {
71
+ if (providerDrive !== ZintrustLang.MEMORY) {
72
72
  try {
73
73
  registerLockProvider(ZintrustLang.MEMORY, provider);
74
74
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ExternalServiceUtils.d.ts","sourceRoot":"","sources":["../../../src/common/ExternalServiceUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,EAAE,iBAAa,KAAG,MAS1D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,GACjC,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,UAAU,MAAM,EAAE,KACjB,IAWF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,SAAS,MAAM,EAAE,SAAS,MAAM,KAAG,KAEjE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,GAAU,KAAK,MAAM,EAAE,SAAS,WAAW,KAAG,OAAO,CAAC,QAAQ,CAcnF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,EAChC,SAAS,OAAO,EAChB,OAAO,CAAC,EACR,QAAQ,MAAM,KACb;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAY9C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW;IACtB;;OAEG;iBACU,MAAM;IAMnB;;OAEG;oBACa,MAAM;IAItB;;OAEG;8BACuB,MAAM,GAAG,OAAO;IAI1C;;OAEG;gCAEO,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,OAAO,GAAG,WAAW,eACpD,MAAM,UACX,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;IAYjC;;OAEG;+BAEO,WAAW,GAAG,WAAW,eACpB,MAAM,SACZ,KAAK,UACJ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;CASlC,CAAC"}
1
+ {"version":3,"file":"ExternalServiceUtils.d.ts","sourceRoot":"","sources":["../../../src/common/ExternalServiceUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,EAAE,iBAAa,KAAG,MAe1D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,GACjC,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,UAAU,MAAM,EAAE,KACjB,IAWF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,SAAS,MAAM,EAAE,SAAS,MAAM,KAAG,KAEjE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,GAAU,KAAK,MAAM,EAAE,SAAS,WAAW,KAAG,OAAO,CAAC,QAAQ,CAcnF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,EAChC,SAAS,OAAO,EAChB,OAAO,CAAC,EACR,QAAQ,MAAM,KACb;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAY9C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW;IACtB;;OAEG;iBACU,MAAM;IAMnB;;OAEG;oBACa,MAAM;IAItB;;OAEG;8BACuB,MAAM,GAAG,OAAO;IAI1C;;OAEG;gCAEO,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,OAAO,GAAG,WAAW,eACpD,MAAM,UACX,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;IAYjC;;OAEG;+BAEO,WAAW,GAAG,WAAW,eACpB,MAAM,SACZ,KAAK,UACJ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;CASlC,CAAC"}
@@ -11,14 +11,19 @@ import { ErrorFactory } from '../exceptions/ZintrustError.js';
11
11
  export const readEnvString = (key, fallback = '') => {
12
12
  const anyEnv = Env;
13
13
  const fromEnv = typeof anyEnv.get === 'function' ? anyEnv.get(key, '') : '';
14
- if (typeof fromEnv === 'string' && fromEnv.trim() !== '')
14
+ if (typeof fromEnv === 'string' && fromEnv.trim() !== '') {
15
15
  return fromEnv;
16
+ }
17
+ const getEnv = anyEnv[key];
18
+ if (typeof getEnv === 'string' && getEnv.trim() !== '') {
19
+ return getEnv;
20
+ }
16
21
  if (typeof process !== 'undefined') {
17
22
  const raw = process.env?.[key];
18
23
  if (typeof raw === 'string')
19
24
  return raw;
20
25
  }
21
- return fromEnv ?? fallback;
26
+ return fallback;
22
27
  };
23
28
  /**
24
29
  * Validate required parameters for external service calls
@@ -86,12 +86,17 @@ export declare const Env: Readonly<{
86
86
  ENABLE_MICROSERVICES: boolean;
87
87
  TOKEN_TTL: number;
88
88
  TOKEN_LENGTH: number;
89
+ CSRF_STORE: string;
90
+ CSRF_DRIVER: string;
91
+ CSRF_REDIS_DB: number;
89
92
  ENCRYPTION_CIPHER: string;
90
93
  ENVIRONMENT: string;
91
94
  REQUEST_TIMEOUT: number;
92
95
  APP_TIMEZONE: string;
93
96
  MAX_BODY_SIZE: number;
94
97
  SHUTDOWN_TIMEOUT: number;
98
+ SSE_HEARTBEAT_INTERVAL: number;
99
+ SSE_SNAPSHOT_INTERVAL: number;
95
100
  LOG_LEVEL: "debug" | "info" | "warn" | "error";
96
101
  LOG_FORMAT: string;
97
102
  LOG_CHANNEL: string;
@@ -1 +1 @@
1
- {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../src/config/env.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAMhD,eAAO,MAAM,cAAc,QAAO,WAAW,GAAG,SAAwB,CAAC;AAEzE,eAAO,MAAM,mBAAmB,GAAI,UAAU,MAAM,EAAE,WAAW,MAAM,KAAG,MAKzE,CAAC;AAGF,eAAO,MAAM,GAAG,GAAI,KAAK,MAAM,EAAE,eAAe,MAAM,KAAG,MAGxD,CAAC;AAEF,eAAO,MAAM,MAAM,GAAI,KAAK,MAAM,EAAE,eAAe,MAAM,KAAG,MAM3D,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,KAAK,MAAM,EAAE,eAAe,MAAM,KAAG,MAM7D,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,KAAK,MAAM,EAAE,eAAe,OAAO,KAAG,OAK7D,CAAC;AAEF,eAAO,MAAM,kBAAkB,QAAO,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAKjE,CAAC;AAGF,eAAO,MAAM,GAAG;eApCS,MAAM,iBAAiB,MAAM,KAAG,MAAM;kBAKnC,MAAM,iBAAiB,MAAM,KAAG,MAAM;mBAgBrC,MAAM,iBAAiB,OAAO,KAAG,OAAO;oBARvC,MAAM,iBAAiB,MAAM,KAAG,MAAM;cA+BtB,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eA6GpB,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmExF,CAAC"}
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../src/config/env.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAMhD,eAAO,MAAM,cAAc,QAAO,WAAW,GAAG,SAAwB,CAAC;AAEzE,eAAO,MAAM,mBAAmB,GAAI,UAAU,MAAM,EAAE,WAAW,MAAM,KAAG,MAKzE,CAAC;AAGF,eAAO,MAAM,GAAG,GAAI,KAAK,MAAM,EAAE,eAAe,MAAM,KAAG,MAGxD,CAAC;AAEF,eAAO,MAAM,MAAM,GAAI,KAAK,MAAM,EAAE,eAAe,MAAM,KAAG,MAM3D,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,KAAK,MAAM,EAAE,eAAe,MAAM,KAAG,MAM7D,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,KAAK,MAAM,EAAE,eAAe,OAAO,KAAG,OAK7D,CAAC;AAEF,eAAO,MAAM,kBAAkB,QAAO,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAKjE,CAAC;AAGF,eAAO,MAAM,GAAG;eApCS,MAAM,iBAAiB,MAAM,KAAG,MAAM;kBAKnC,MAAM,iBAAiB,MAAM,KAAG,MAAM;mBAgBrC,MAAM,iBAAiB,OAAO,KAAG,OAAO;oBARvC,MAAM,iBAAiB,MAAM,KAAG,MAAM;cA+BtB,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAoHpB,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmExF,CAAC"}
package/src/config/env.js CHANGED
@@ -145,6 +145,9 @@ export const Env = Object.freeze({
145
145
  ENABLE_MICROSERVICES: getBool('ENABLE_MICROSERVICES', false),
146
146
  TOKEN_TTL: getInt('TOKEN_TTL', 3600000),
147
147
  TOKEN_LENGTH: getInt('TOKEN_LENGTH', 32),
148
+ CSRF_STORE: get('CSRF_STORE', ''),
149
+ CSRF_DRIVER: get('CSRF_DRIVER', ''),
150
+ CSRF_REDIS_DB: getInt('CSRF_REDIS_DB', 1),
148
151
  // Encryption interop
149
152
  ENCRYPTION_CIPHER: get('ENCRYPTION_CIPHER', ''),
150
153
  // Deployment
@@ -153,6 +156,9 @@ export const Env = Object.freeze({
153
156
  APP_TIMEZONE: get('APP_TIMEZONE', 'UTC'),
154
157
  MAX_BODY_SIZE: getInt('MAX_BODY_SIZE', 10485760),
155
158
  SHUTDOWN_TIMEOUT: getInt('SHUTDOWN_TIMEOUT', 10000),
159
+ // SSE
160
+ SSE_HEARTBEAT_INTERVAL: getInt('SSE_HEARTBEAT_INTERVAL', 15000),
161
+ SSE_SNAPSHOT_INTERVAL: getInt('SSE_SNAPSHOT_INTERVAL', 5000),
156
162
  // Logging
157
163
  LOG_LEVEL: get('LOG_LEVEL', getDefaultLogLevel()),
158
164
  LOG_FORMAT: get('LOG_FORMAT', 'text'),
@@ -187,7 +193,7 @@ export const Env = Object.freeze({
187
193
  // Template/Misc
188
194
  TEMPLATE_COPYRIGHT: get('TEMPLATE_COPYRIGHT', '© 2025 ZinTrust Framework. All rights reserved.'),
189
195
  SERVICE_NAME: get('SERVICE_NAME', ''),
190
- APP_MODE: get('APP_MODE', ''),
196
+ APP_MODE: get('APP_MODE', get('NODE_ENV', 'development')),
191
197
  APP_PORT: getInt('APP_PORT', 3000),
192
198
  RUNTIME: get('RUNTIME', ''),
193
199
  // Paths (safely constructed for Node.js environments)
@@ -217,7 +217,7 @@ export declare const config: Readonly<{
217
217
  readonly queue: {
218
218
  default: import("./type").QueueDriverName;
219
219
  drivers: import("./type").QueueDriversConfig;
220
- getDriver: (this: import("./type").QueueConfigWithDrivers) => import("./type").QueueDriversConfig[import("./type").QueueDriverName];
220
+ getDriver: (driverConfig: import("./type").QueueConfigWithDrivers) => import("./type").QueueDriversConfig[import("./type").QueueDriverName];
221
221
  failed: {
222
222
  database: string;
223
223
  table: string;
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/config/logger.ts"],"names":[],"mappings":"AAQA,UAAU,OAAO;IACf,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAClE;AA4VD,eAAO,MAAM,aAAa,QAAa,OAAO,CAAC,MAAM,EAAE,CAYtD,CAAC;AAEF,eAAO,MAAM,MAAM;qBAzJQ,MAAM,SAAS,OAAO,aAAa,MAAM,KAAG,IAAI;oBAsBjD,MAAM,SAAS,OAAO,aAAa,MAAM,KAAG,IAAI;oBAoBhD,MAAM,SAAS,OAAO,aAAa,MAAM,KAAG,IAAI;qBAoB/C,MAAM,UAAU,OAAO,aAAa,MAAM,KAAG,IAAI;qBA0BjD,MAAM,UAAU,OAAO,aAAa,MAAM,KAAG,IAAI;yBAmDrC,OAAO,CAAC,MAAM,EAAE,CAAC;mBArBtB,MAAM,KAAG,OAAO;EA2ChD,CAAC;AAEH,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/config/logger.ts"],"names":[],"mappings":"AASA,UAAU,OAAO;IACf,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAClE;AAiYD,eAAO,MAAM,aAAa,QAAa,OAAO,CAAC,MAAM,EAAE,CAYtD,CAAC;AAEF,eAAO,MAAM,MAAM;qBA5JQ,MAAM,SAAS,OAAO,aAAa,MAAM,KAAG,IAAI;oBAqBjD,MAAM,SAAS,OAAO,aAAa,MAAM,KAAG,IAAI;oBAqBhD,MAAM,SAAS,OAAO,aAAa,MAAM,KAAG,IAAI;qBAqB/C,MAAM,UAAU,OAAO,aAAa,MAAM,KAAG,IAAI;qBA2BjD,MAAM,UAAU,OAAO,aAAa,MAAM,KAAG,IAAI;yBAoDrC,OAAO,CAAC,MAAM,EAAE,CAAC;mBArBtB,MAAM,KAAG,OAAO;EA2ChD,CAAC;AAEH,eAAe,MAAM,CAAC"}