@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.
- package/bin/z.js +0 -0
- package/bin/zin.js +0 -0
- package/bin/zintrust.js +0 -0
- package/bin/zt.js +0 -0
- package/package.json +2 -2
- package/public/index.html +2 -2
- package/src/boot/Application.d.ts.map +1 -1
- package/src/boot/Application.js +101 -74
- package/src/boot/bootstrap.js +2 -6
- package/src/cli/PromptHelper.js +2 -2
- package/src/cli/commands/MigrateWorkerCommand.d.ts.map +1 -1
- package/src/cli/commands/MigrateWorkerCommand.js +1 -1
- package/src/cli/commands/StartCommand.d.ts.map +1 -1
- package/src/cli/commands/StartCommand.js +16 -4
- package/src/cli/utils/EnvFileLoader.d.ts +2 -1
- package/src/cli/utils/EnvFileLoader.d.ts.map +1 -1
- package/src/cli/utils/EnvFileLoader.js +8 -8
- package/src/cli/utils/spawn.d.ts.map +1 -1
- package/src/cli/utils/spawn.js +17 -10
- package/src/cli/workers/QueueWorkRunner.d.ts.map +1 -1
- package/src/cli/workers/QueueWorkRunner.js +5 -5
- package/src/common/ExternalServiceUtils.d.ts.map +1 -1
- package/src/common/ExternalServiceUtils.js +7 -2
- package/src/config/env.d.ts +5 -0
- package/src/config/env.d.ts.map +1 -1
- package/src/config/env.js +7 -1
- package/src/config/index.d.ts +1 -1
- package/src/config/logger.d.ts.map +1 -1
- package/src/config/logger.js +60 -16
- package/src/config/queue.d.ts +1 -1
- package/src/config/queue.d.ts.map +1 -1
- package/src/config/queue.js +11 -6
- package/src/config/redis.d.ts.map +1 -1
- package/src/config/redis.js +3 -2
- package/src/config/type.d.ts +9 -5
- package/src/config/type.d.ts.map +1 -1
- package/src/config/workers.d.ts.map +1 -1
- package/src/config/workers.js +4 -0
- package/src/index.d.ts +3 -2
- package/src/index.d.ts.map +1 -1
- package/src/index.js +3 -4
- package/src/lang/lang.d.ts +3 -0
- package/src/lang/lang.d.ts.map +1 -1
- package/src/lang/lang.js +3 -0
- package/src/middleware/CsrfMiddleware.d.ts.map +1 -1
- package/src/middleware/CsrfMiddleware.js +26 -11
- package/src/orm/Model.d.ts.map +1 -1
- package/src/orm/Model.js +17 -6
- package/src/routes/errorPages.js +1 -1
- package/src/runtime/PluginAutoImports.d.ts.map +1 -1
- package/src/runtime/PluginAutoImports.js +33 -7
- package/src/security/CsrfTokenManager.d.ts +18 -9
- package/src/security/CsrfTokenManager.d.ts.map +1 -1
- package/src/security/CsrfTokenManager.js +192 -11
- package/src/templates/project/basic/app/Middleware/index.ts.tpl +1 -1
- package/src/templates/project/basic/config/queue.ts.tpl +2 -2
- package/src/toolkit/Secrets/providers/AwsSecretsManager.d.ts.map +1 -1
- package/src/toolkit/Secrets/providers/AwsSecretsManager.js +4 -2
- package/src/tools/queue/AdvancedQueue.d.ts +2 -1
- package/src/tools/queue/AdvancedQueue.d.ts.map +1 -1
- package/src/tools/queue/AdvancedQueue.js +2 -1
- package/src/tools/queue/LockProvider.d.ts +4 -0
- package/src/tools/queue/LockProvider.d.ts.map +1 -1
- package/src/tools/queue/LockProvider.js +16 -0
- package/src/tools/queue/Queue.d.ts +38 -2
- package/src/tools/queue/Queue.d.ts.map +1 -1
- package/src/tools/queue/Queue.js +3 -2
- package/src/tools/queue/QueueExtensions.d.ts +2 -1
- package/src/tools/queue/QueueExtensions.d.ts.map +1 -1
- package/src/tools/redis/RedisKeyManager.d.ts +3 -0
- package/src/tools/redis/RedisKeyManager.d.ts.map +1 -1
- 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.
|
|
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.
|
|
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:
|
|
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:
|
|
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;
|
|
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"}
|
package/src/boot/Application.js
CHANGED
|
@@ -23,10 +23,8 @@ const ShutdownManager = Object.freeze({
|
|
|
23
23
|
hooks.push(hook);
|
|
24
24
|
},
|
|
25
25
|
async run() {
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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
|
}
|
package/src/boot/bootstrap.js
CHANGED
|
@@ -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
|
|
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
|
|
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({
|
package/src/cli/PromptHelper.js
CHANGED
|
@@ -59,7 +59,7 @@ export const PromptHelper = Object.freeze({
|
|
|
59
59
|
default: defaultDb,
|
|
60
60
|
},
|
|
61
61
|
]);
|
|
62
|
-
return answer
|
|
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
|
|
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;
|
|
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(
|
|
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;
|
|
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('
|
|
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
|
|
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
|
-
|
|
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?:
|
|
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":"
|
|
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 '
|
|
8
|
+
return 'development';
|
|
9
9
|
// Per spec: any other value is treated as development.
|
|
10
|
-
return '
|
|
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['
|
|
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?.['
|
|
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;
|
|
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"}
|
package/src/cli/utils/spawn.js
CHANGED
|
@@ -58,12 +58,21 @@ export const SpawnUtil = Object.freeze({
|
|
|
58
58
|
throw wrapped;
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
|
-
const onSigint = () =>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
87
|
-
|
|
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":"
|
|
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
|
|
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(
|
|
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:
|
|
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(
|
|
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 (
|
|
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,
|
|
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
|
|
26
|
+
return fallback;
|
|
22
27
|
};
|
|
23
28
|
/**
|
|
24
29
|
* Validate required parameters for external service calls
|
package/src/config/env.d.ts
CHANGED
|
@@ -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;
|
package/src/config/env.d.ts.map
CHANGED
|
@@ -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
|
|
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)
|
package/src/config/index.d.ts
CHANGED
|
@@ -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: (
|
|
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":"
|
|
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"}
|