@zintrust/core 0.4.49 → 0.4.51
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/README.md +2 -0
- package/package.json +1 -3
- package/src/boot/registry/runtime.d.ts.map +1 -1
- package/src/boot/registry/runtime.js +27 -7
- package/src/boot.d.ts +0 -1
- package/src/boot.d.ts.map +1 -1
- package/src/boot.js +30 -1
- package/src/cli/OptionalCliExtensions.d.ts.map +1 -1
- package/src/cli/OptionalCliExtensions.js +10 -0
- package/src/cli/commands/MigrateCommand.js +1 -1
- package/src/index.js +3 -3
- package/src/orm/adapters/D1Adapter.js +2 -2
- package/src/runtime/WorkersModule.d.ts +3 -1
- package/src/runtime/WorkersModule.d.ts.map +1 -1
- package/src/runtime/WorkersModule.js +7 -3
- package/src/runtime/resolveNodeProjectRoot.d.ts +3 -0
- package/src/runtime/resolveNodeProjectRoot.d.ts.map +1 -0
- package/src/runtime/resolveNodeProjectRoot.js +18 -0
- package/src/start.d.ts.map +1 -1
- package/src/start.js +2 -17
- package/src/tools/redis/RedisTransport.d.ts +1 -0
- package/src/tools/redis/RedisTransport.d.ts.map +1 -1
- package/src/tools/redis/RedisTransport.js +18 -2
- package/src/zintrust.comon.d.ts +11 -0
- package/src/zintrust.comon.d.ts.map +1 -0
- package/src/zintrust.comon.js +17 -0
- package/src/zintrust.plugins.d.ts +7 -3
- package/src/zintrust.plugins.d.ts.map +1 -1
- package/src/zintrust.plugins.js +9 -3
- package/src/zintrust.plugins.wg.d.ts +1 -0
- package/src/zintrust.plugins.wg.d.ts.map +1 -1
- package/src/zintrust.plugins.wg.js +3 -0
package/README.md
CHANGED
|
@@ -43,6 +43,8 @@ import '@zintrust/core/boot';
|
|
|
43
43
|
export {};
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
+
In Node mode, `@zintrust/core/boot` now loads the project env files before it hands off to the stock bootstrap lifecycle, using the same env-file parsing semantics as the CLI startup path.
|
|
47
|
+
|
|
46
48
|
Use a full custom bootstrap only when you intentionally need behavior different from the stock ZinTrust bootstrap. If you replace it completely, you are also responsible for running any worker startup lifecycle that your app depends on.
|
|
47
49
|
|
|
48
50
|
## Install adapters (database/cache/etc.)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zintrust/core",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.51",
|
|
4
4
|
"description": "Production-grade TypeScript backend framework for JavaScript",
|
|
5
5
|
"homepage": "https://zintrust.com",
|
|
6
6
|
"repository": {
|
|
@@ -57,8 +57,6 @@
|
|
|
57
57
|
"./package.json": "./package.json"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@cloudflare/containers": "^0.2.0",
|
|
61
|
-
"@zintrust/workers": "0.4.49",
|
|
62
60
|
"bcryptjs": "^3.0.3",
|
|
63
61
|
"bullmq": "^5.71.1",
|
|
64
62
|
"chalk": "^5.6.2",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/boot/registry/runtime.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -10,6 +10,7 @@ import { FeatureFlags } from '../../config/features.js';
|
|
|
10
10
|
import { Logger } from '../../config/logger.js';
|
|
11
11
|
import notificationConfig from '../../config/notification.js';
|
|
12
12
|
import { StartupConfigValidator } from '../../config/StartupConfigValidator.js';
|
|
13
|
+
import { isNonEmptyString } from '../../helper/index.js';
|
|
13
14
|
import { existsSync } from '../../node-singletons/fs.js';
|
|
14
15
|
import * as path from '../../node-singletons/path.js';
|
|
15
16
|
import { pathToFileURL } from '../../node-singletons/url.js';
|
|
@@ -278,8 +279,24 @@ const initializeQueueMonitor = async (router) => {
|
|
|
278
279
|
}
|
|
279
280
|
const redisConfig = extractRedisConfigFromQueueConfig();
|
|
280
281
|
const { QueueMonitor } = queueMonitorModule;
|
|
282
|
+
const resolveKnownQueues = async () => {
|
|
283
|
+
try {
|
|
284
|
+
const workersModule = (await loadWorkersModule());
|
|
285
|
+
const records = await workersModule?.WorkerFactory?.listPersistedRecords?.();
|
|
286
|
+
if (!Array.isArray(records)) {
|
|
287
|
+
return [];
|
|
288
|
+
}
|
|
289
|
+
return Array.from(new Set(records
|
|
290
|
+
.map((record) => record.queueName)
|
|
291
|
+
.filter((queueName) => isNonEmptyString(queueName)))).sort((left, right) => left.localeCompare(right));
|
|
292
|
+
}
|
|
293
|
+
catch {
|
|
294
|
+
return [];
|
|
295
|
+
}
|
|
296
|
+
};
|
|
281
297
|
const monitor = QueueMonitor.create({
|
|
282
298
|
...monitorConfig,
|
|
299
|
+
knownQueues: resolveKnownQueues,
|
|
283
300
|
redis: redisConfig,
|
|
284
301
|
});
|
|
285
302
|
try {
|
|
@@ -292,7 +309,7 @@ const initializeQueueMonitor = async (router) => {
|
|
|
292
309
|
Logger.info(`Queue Monitor enqueue endpoint at http://127.0.0.1:${appConfig.port}/test/enqueue`);
|
|
293
310
|
};
|
|
294
311
|
const initializeWorkers = async (router) => {
|
|
295
|
-
const workers = await loadWorkersModule();
|
|
312
|
+
const workers = await loadWorkersModule({ allowWhenDisabled: true });
|
|
296
313
|
if (workers?.WorkerInit !== undefined && typeof workers.registerWorkerRoutes === 'function') {
|
|
297
314
|
workers.registerWorkerRoutes(router, undefined, { middleware: undefined });
|
|
298
315
|
}
|
|
@@ -403,16 +420,19 @@ export const createLifecycle = (params) => {
|
|
|
403
420
|
await initializeArtifactDirectories(params.resolvedBasePath);
|
|
404
421
|
await registerMasterRoutes(params.resolvedBasePath, params.router);
|
|
405
422
|
await initializeSystemDebugger();
|
|
406
|
-
if (Cloudflare.getWorkersEnv() === null &&
|
|
407
|
-
appConfig.dockerWorker === false &&
|
|
408
|
-
appConfig.worker === true) {
|
|
423
|
+
if (Cloudflare.getWorkersEnv() === null && appConfig.dockerWorker === false) {
|
|
409
424
|
await initializeWorkers(params.router);
|
|
410
425
|
await initializeQueueMonitor(params.router);
|
|
411
|
-
|
|
412
|
-
|
|
426
|
+
if (appConfig.worker === true) {
|
|
427
|
+
await initializeQueueHttpGateway(params.router);
|
|
428
|
+
await initializeScheduleHttpGateway(params.router);
|
|
429
|
+
}
|
|
430
|
+
else {
|
|
431
|
+
Logger.info('Skipping worker execution/gateway initialization (WORKER_ENABLED=false).');
|
|
432
|
+
}
|
|
413
433
|
}
|
|
414
434
|
else if (!appConfig.dockerWorker) {
|
|
415
|
-
Logger.info('Skipping worker
|
|
435
|
+
Logger.info('Skipping local worker dashboards in Cloudflare Workers runtime.');
|
|
416
436
|
}
|
|
417
437
|
// Register service providers
|
|
418
438
|
// Bootstrap services
|
package/src/boot.d.ts
CHANGED
package/src/boot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boot.d.ts","sourceRoot":"","sources":["../../src/boot.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"boot.d.ts","sourceRoot":"","sources":["../../src/boot.ts"],"names":[],"mappings":"AAoCA,OAAO,EAAE,CAAC"}
|
package/src/boot.js
CHANGED
|
@@ -1 +1,30 @@
|
|
|
1
|
-
import './
|
|
1
|
+
import { isNodeRuntime } from './runtime/detectRuntime.js';
|
|
2
|
+
import { resolveNodeProjectRoot } from './runtime/resolveNodeProjectRoot.js';
|
|
3
|
+
const ensureNodeBootstrapEnv = async () => {
|
|
4
|
+
if (!isNodeRuntime())
|
|
5
|
+
return;
|
|
6
|
+
const projectRoot = await resolveNodeProjectRoot();
|
|
7
|
+
if ((process.env?.['ZINTRUST_PROJECT_ROOT'] ?? '').trim() === '') {
|
|
8
|
+
process.env['ZINTRUST_PROJECT_ROOT'] = projectRoot;
|
|
9
|
+
}
|
|
10
|
+
const [{ EnvFileLoader }, { Logger }, { existsSync }, path] = await Promise.all([
|
|
11
|
+
import('./cli/utils/EnvFileLoader.js'),
|
|
12
|
+
import('./config/logger.js'),
|
|
13
|
+
import('./node-singletons/fs.js'),
|
|
14
|
+
import('./node-singletons/path.js'),
|
|
15
|
+
]);
|
|
16
|
+
const state = EnvFileLoader.ensureLoaded({
|
|
17
|
+
cwd: projectRoot,
|
|
18
|
+
includeCwd: true,
|
|
19
|
+
});
|
|
20
|
+
if (state.loadedFiles.length > 0)
|
|
21
|
+
return;
|
|
22
|
+
const resolvedDotEnv = path.join(projectRoot, '.env');
|
|
23
|
+
Logger.warn('Node bootstrap started without loaded env files.', {
|
|
24
|
+
projectRoot,
|
|
25
|
+
resolvedDotEnv: existsSync(resolvedDotEnv) ? resolvedDotEnv : 'missing',
|
|
26
|
+
entry: '@zintrust/core/boot',
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
await ensureNodeBootstrapEnv();
|
|
30
|
+
await import('./boot/bootstrap.js');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptionalCliExtensions.d.ts","sourceRoot":"","sources":["../../../src/cli/OptionalCliExtensions.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B,CAAC;AAEF,KAAK,8BAA8B,GAAG,SAAS,GAAG,SAAS,GAAG,gBAAgB,GAAG,SAAS,CAAC;AAE3F,MAAM,MAAM,0BAA0B,GAAG,QAAQ,CAAC;IAChD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,8BAA8B,CAAC;CACxC,CAAC,CAAC;AAEH,KAAK,+BAA+B,GAAG,QAAQ,CAAC;IAC9C,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"OptionalCliExtensions.d.ts","sourceRoot":"","sources":["../../../src/cli/OptionalCliExtensions.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B,CAAC;AAEF,KAAK,8BAA8B,GAAG,SAAS,GAAG,SAAS,GAAG,gBAAgB,GAAG,SAAS,CAAC;AAE3F,MAAM,MAAM,0BAA0B,GAAG,QAAQ,CAAC;IAChD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,8BAA8B,CA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
|
|
77
77
|
},
|
|
78
|
+
{
|
|
79
|
+
packageName: '@zintrust/expose',
|
|
80
|
+
specifier: '@zintrust/expose/register',
|
|
81
|
+
commands: ['expose', 'exp'],
|
|
82
|
+
installCommand: 'npm install @zintrust/expose',
|
|
83
|
+
localCandidates: [
|
|
84
|
+
path.join(packageRoot, 'packages', 'expose', 'src', 'register.ts'),
|
|
85
|
+
path.join(packageRoot, 'packages', 'expose', 'src', 'register.js'),
|
|
86
|
+
],
|
|
87
|
+
},
|
|
78
88
|
]);
|
|
79
89
|
const getProjectLocalCandidates = (entry) => {
|
|
80
90
|
const projectRoot = resolveProjectRoot();
|
|
@@ -215,7 +215,7 @@ const warnIfAdapterMissing = (cmd, conn) => {
|
|
|
215
215
|
if (conn.driver === 'mysql' && DatabaseAdapterRegistry.get('mysql') === undefined) {
|
|
216
216
|
cmd.warn('MySQL adapter is not installed/registered; migrations may not hit a real MySQL DB.');
|
|
217
217
|
cmd.warn('Install via `zin plugin install adapter:mysql` (or `zin add db:mysql`).');
|
|
218
|
-
cmd.debug('[debug] Expected a side-effect import in src/zintrust.plugins.ts like: import "
|
|
218
|
+
cmd.debug('[debug] Expected a side-effect import in src/zintrust.plugins.ts like: import "../../../packages/db-mysql/src/register";');
|
|
219
219
|
}
|
|
220
220
|
if (conn.driver === 'postgresql' && DatabaseAdapterRegistry.get('postgresql') === undefined) {
|
|
221
221
|
cmd.warn('PostgreSQL adapter is not installed/registered; migrations may not hit a real PostgreSQL DB.');
|
package/src/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @zintrust/core v0.4.
|
|
2
|
+
* @zintrust/core v0.4.51
|
|
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-
|
|
8
|
+
* Built: 2026-04-04T14:42:05.898Z
|
|
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-
|
|
24
|
+
export const ZINTRUST_BUILD_DATE = '2026-04-04T14:42:05.863Z'; // 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';
|
|
@@ -63,12 +63,12 @@ export const D1Adapter = Object.freeze({
|
|
|
63
63
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
64
64
|
async connect() {
|
|
65
65
|
connected = true;
|
|
66
|
-
Logger.
|
|
66
|
+
Logger.debug('✓ D1 connected');
|
|
67
67
|
},
|
|
68
68
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
69
69
|
async disconnect() {
|
|
70
70
|
connected = false;
|
|
71
|
-
Logger.
|
|
71
|
+
Logger.debug('✓ D1 disconnected');
|
|
72
72
|
},
|
|
73
73
|
async query(sql, parameters) {
|
|
74
74
|
if (!connected)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
type WorkersModule = typeof import('../../packages/workers/src/index.js');
|
|
2
2
|
type QueueMonitorModule = typeof import('../../packages/queue-monitor/src/index.js');
|
|
3
|
-
export declare const loadWorkersModule: (
|
|
3
|
+
export declare const loadWorkersModule: (options?: {
|
|
4
|
+
allowWhenDisabled?: boolean;
|
|
5
|
+
}) => Promise<WorkersModule>;
|
|
4
6
|
export declare const loadQueueMonitorModule: () => Promise<QueueMonitorModule>;
|
|
5
7
|
export {};
|
|
6
8
|
//# sourceMappingURL=WorkersModule.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkersModule.d.ts","sourceRoot":"","sources":["../../../src/runtime/WorkersModule.ts"],"names":[],"mappings":"AAOA,KAAK,aAAa,GAAG,cAAc,mBAAmB,CAAC,CAAC;AACxD,KAAK,kBAAkB,GAAG,cAAc,yBAAyB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"WorkersModule.d.ts","sourceRoot":"","sources":["../../../src/runtime/WorkersModule.ts"],"names":[],"mappings":"AAOA,KAAK,aAAa,GAAG,cAAc,mBAAmB,CAAC,CAAC;AACxD,KAAK,kBAAkB,GAAG,cAAc,yBAAyB,CAAC,CAAC;AA+WnE,eAAO,MAAM,iBAAiB,GAC5B,UAAS;IAAE,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAAO,KAC5C,OAAO,CAAC,aAAa,CA2BvB,CAAC;AA4CF,eAAO,MAAM,sBAAsB,QAAa,OAAO,CAAC,kBAAkB,CAkBzE,CAAC"}
|
|
@@ -203,6 +203,7 @@ let patchAfterFailureAttempted = false;
|
|
|
203
203
|
let queueMonitorModulePromise;
|
|
204
204
|
let queueMonitorPatchAfterFailureAttempted = false;
|
|
205
205
|
let workersResolverDiagnosticLogged = false;
|
|
206
|
+
let workersDisabledByEnvLogged = false;
|
|
206
207
|
const resolvePackageEntryForDebug = (packageName) => {
|
|
207
208
|
if (!isNodeRuntime())
|
|
208
209
|
return null;
|
|
@@ -306,9 +307,12 @@ const tryLocalFallback = async () => {
|
|
|
306
307
|
}
|
|
307
308
|
return null;
|
|
308
309
|
};
|
|
309
|
-
export const loadWorkersModule = async () => {
|
|
310
|
-
if (shouldDisableWorkerModules()) {
|
|
311
|
-
|
|
310
|
+
export const loadWorkersModule = async (options = {}) => {
|
|
311
|
+
if (shouldDisableWorkerModules() && options.allowWhenDisabled !== true) {
|
|
312
|
+
if (!workersDisabledByEnvLogged) {
|
|
313
|
+
workersDisabledByEnvLogged = true;
|
|
314
|
+
Logger.info('Skipping @zintrust/workers module import (workers disabled by env).');
|
|
315
|
+
}
|
|
312
316
|
workersModulePromise ??= Promise.resolve(createDisabledWorkersModule());
|
|
313
317
|
return workersModulePromise;
|
|
314
318
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveNodeProjectRoot.d.ts","sourceRoot":"","sources":["../../../src/runtime/resolveNodeProjectRoot.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB,QAAa,OAAO,CAAC,MAAM,CAe7D,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { isNonEmptyString } from '../helper/index.js';
|
|
2
|
+
export const resolveNodeProjectRoot = async () => {
|
|
3
|
+
const configuredRoot = process.env?.['ZINTRUST_PROJECT_ROOT'] ?? '';
|
|
4
|
+
if (isNonEmptyString(configuredRoot))
|
|
5
|
+
return configuredRoot.trim();
|
|
6
|
+
const { existsSync } = await import('../node-singletons/fs.js');
|
|
7
|
+
const path = await import('../node-singletons/path.js');
|
|
8
|
+
let current = process.cwd();
|
|
9
|
+
while (true) {
|
|
10
|
+
if (existsSync(path.join(current, 'package.json')))
|
|
11
|
+
return current;
|
|
12
|
+
const parent = path.dirname(current);
|
|
13
|
+
if (parent === current)
|
|
14
|
+
return process.cwd();
|
|
15
|
+
current = parent;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export default resolveNodeProjectRoot;
|
package/src/start.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/start.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/start.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,gCAAgC,CAAC;AAwBxC,eAAO,MAAM,UAAU,GAAI,eAAe,MAAM,KAAG,OAYlD,CAAC;AAEF,eAAO,MAAM,0BAA0B,GAAI,eAAe,OAAO,KAAG,oBASnE,CAAC;AAoEF,eAAO,MAAM,qBAAqB,GAChC,eAAe,MAAM,EACrB,eAAe,OAAO,KACrB,OAAO,CAAC,oBAAoB,CAS9B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,KAAK,QAAa,OAAO,CAAC,IAAI,CAO1C,CAAC;AAEF;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEpE;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAElD;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC"}
|
package/src/start.js
CHANGED
|
@@ -3,6 +3,7 @@ import { isArray, isNonEmptyString, isObject } from './helper/index.js';
|
|
|
3
3
|
import { ZintrustLang } from './lang/lang.js';
|
|
4
4
|
import { normalizeActiveServiceRuntime, } from './microservices/ServiceManifest.js';
|
|
5
5
|
import { ProjectRuntime } from './runtime/ProjectRuntime.js';
|
|
6
|
+
import { resolveNodeProjectRoot } from './runtime/resolveNodeProjectRoot.js';
|
|
6
7
|
import { isNodeRuntime } from './runtime/detectRuntime.js';
|
|
7
8
|
const isAbsolutePath = (value) => value.startsWith('/') || /^[A-Za-z]:[\\/]/.test(value);
|
|
8
9
|
const fileUrlToPathLike = (value) => {
|
|
@@ -48,22 +49,6 @@ const normalizeStandaloneEnvPaths = (value) => {
|
|
|
48
49
|
.map((item) => item.trim())
|
|
49
50
|
.filter((item) => item !== '');
|
|
50
51
|
};
|
|
51
|
-
const resolveStandaloneProjectRoot = async () => {
|
|
52
|
-
const configuredRoot = process.env?.['ZINTRUST_PROJECT_ROOT'] ?? '';
|
|
53
|
-
if (isNonEmptyString(configuredRoot))
|
|
54
|
-
return configuredRoot;
|
|
55
|
-
const { existsSync } = await import('./node-singletons/fs.js');
|
|
56
|
-
const path = await import('./node-singletons/path.js');
|
|
57
|
-
let current = process.cwd();
|
|
58
|
-
while (true) {
|
|
59
|
-
if (existsSync(path.join(current, 'package.json')))
|
|
60
|
-
return current;
|
|
61
|
-
const parent = path.dirname(current);
|
|
62
|
-
if (parent === current)
|
|
63
|
-
return process.cwd();
|
|
64
|
-
current = parent;
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
52
|
const resolveServiceEnvPath = async (importMetaUrl, activeService, projectRoot) => {
|
|
68
53
|
const path = await import('./node-singletons/path.js');
|
|
69
54
|
if (isObject(activeService) && isNonEmptyString(activeService['configRoot'])) {
|
|
@@ -87,7 +72,7 @@ const ensureStandaloneServiceEnv = async (importMetaUrl, activeService) => {
|
|
|
87
72
|
if (!isNodeRuntime())
|
|
88
73
|
return;
|
|
89
74
|
const { EnvFileLoader } = await import('./cli/utils/EnvFileLoader.js');
|
|
90
|
-
const projectRoot = await
|
|
75
|
+
const projectRoot = await resolveNodeProjectRoot();
|
|
91
76
|
const envPaths = await resolveConfiguredEnvPaths(projectRoot, activeService, importMetaUrl);
|
|
92
77
|
const rootEnv = !isObject(activeService) || activeService['rootEnv'] !== false;
|
|
93
78
|
EnvFileLoader.ensureLoaded({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RedisTransport.d.ts","sourceRoot":"","sources":["../../../../src/tools/redis/RedisTransport.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAIhD,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEpD,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC,CAAC;AASH,KAAK,oBAAoB,GAAG;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,IAAI,EAAE,MAAM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
4
|
import { SignedRequest } from '../../security/SignedRequest.js';
|
|
5
5
|
const loggedSelections = new Set();
|
|
6
|
+
const readEnvString = (key, fallback = '') => {
|
|
7
|
+
if (typeof Env.get === 'function') {
|
|
8
|
+
return Env.get(key, fallback);
|
|
9
|
+
}
|
|
10
|
+
const value = Env[key];
|
|
11
|
+
return typeof value === 'string' ? value : fallback;
|
|
12
|
+
};
|
|
13
|
+
const readEnvBool = (key, fallback = false) => {
|
|
14
|
+
if (typeof Env.getBool === 'function') {
|
|
15
|
+
return Env.getBool(key, fallback);
|
|
16
|
+
}
|
|
17
|
+
const value = Env[key];
|
|
18
|
+
return typeof value === 'boolean' ? value : fallback;
|
|
19
|
+
};
|
|
6
20
|
const resolveSigningPrefix = (baseUrl) => {
|
|
7
21
|
try {
|
|
8
22
|
const parsed = new URL(baseUrl);
|
|
@@ -35,7 +49,7 @@ const buildSigningUrl = (requestUrl, baseUrl) => {
|
|
|
35
49
|
return requestUrl;
|
|
36
50
|
};
|
|
37
51
|
const resolveProxyBaseUrl = () => {
|
|
38
|
-
const explicit =
|
|
52
|
+
const explicit = readEnvString('REDIS_PROXY_URL', '').trim();
|
|
39
53
|
if (explicit !== '')
|
|
40
54
|
return explicit;
|
|
41
55
|
return `http://${Env.REDIS_PROXY_HOST}:${Env.REDIS_PROXY_PORT}`;
|
|
@@ -205,7 +219,9 @@ const createPipeline = (settings) => {
|
|
|
205
219
|
return pipeline;
|
|
206
220
|
};
|
|
207
221
|
export const resolveRedisTransportMode = () => {
|
|
208
|
-
return
|
|
222
|
+
return readEnvBool('USE_REDIS_PROXY', false) || readEnvString('REDIS_PROXY_URL', '').trim() !== ''
|
|
223
|
+
? 'proxy'
|
|
224
|
+
: 'direct';
|
|
209
225
|
};
|
|
210
226
|
export const createRedisProxyConnection = (config, options) => {
|
|
211
227
|
const settings = resolveProxySettings();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import '../packages/db-d1/src/register.js';
|
|
2
|
+
import '../packages/db-mysql/src/register.js';
|
|
3
|
+
import '../packages/db-postgres/src/register.js';
|
|
4
|
+
import '../packages/db-sqlite/src/register.js';
|
|
5
|
+
import '../packages/db-sqlserver/src/register.js';
|
|
6
|
+
import '../packages/mail-sendgrid/src/register.js';
|
|
7
|
+
import '../packages/mail-smtp/src/register.js';
|
|
8
|
+
import '../packages/queue-monitor/src/index.js';
|
|
9
|
+
import '../packages/queue-redis/src/register.js';
|
|
10
|
+
import '../packages/workers/src/register.js';
|
|
11
|
+
//# sourceMappingURL=zintrust.comon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zintrust.comon.d.ts","sourceRoot":"","sources":["../../src/zintrust.comon.ts"],"names":[],"mappings":"AAQA,OAAO,mCAAmC,CAAC;AAC3C,OAAO,sCAAsC,CAAC;AAC9C,OAAO,yCAAyC,CAAC;AACjD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,0CAA0C,CAAC;AAClD,OAAO,2CAA2C,CAAC;AACnD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,wCAAwC,CAAC;AAChD,OAAO,yCAAyC,CAAC;AACjD,OAAO,qCAAqC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* eslint-disable no-restricted-imports */
|
|
2
|
+
// /**
|
|
3
|
+
// * ZinTrust comon plugin auto-imports
|
|
4
|
+
// *
|
|
5
|
+
// * This file is managed by `zin plugin install` and contains side-effect
|
|
6
|
+
// * imports that register optional adapters/drivers into core registries.
|
|
7
|
+
// */
|
|
8
|
+
import '../packages/db-d1/src/register.js';
|
|
9
|
+
import '../packages/db-mysql/src/register.js';
|
|
10
|
+
import '../packages/db-postgres/src/register.js';
|
|
11
|
+
import '../packages/db-sqlite/src/register.js';
|
|
12
|
+
import '../packages/db-sqlserver/src/register.js';
|
|
13
|
+
import '../packages/mail-sendgrid/src/register.js';
|
|
14
|
+
import '../packages/mail-smtp/src/register.js';
|
|
15
|
+
import '@zintrust/queue-monitor';
|
|
16
|
+
import '../packages/queue-redis/src/register.js';
|
|
17
|
+
import '../packages/workers/src/register.js';
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* ZinTrust plugin auto-imports
|
|
3
|
+
*
|
|
4
|
+
* In real projects, this file is managed by `zin plugin install` and contains
|
|
5
|
+
* side-effect imports (e.g. `@zintrust/db-sqlite/register`) that register
|
|
6
|
+
* optional adapters/drivers into core registries.
|
|
7
|
+
*
|
|
5
8
|
*/
|
|
9
|
+
export type {};
|
|
6
10
|
export declare const __zintrustGeneratedPluginStub = "zintrust.plugins.ts";
|
|
7
11
|
declare const _default: {};
|
|
8
12
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zintrust.plugins.d.ts","sourceRoot":"","sources":["../../src/zintrust.plugins.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"zintrust.plugins.d.ts","sourceRoot":"","sources":["../../src/zintrust.plugins.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,YAAY,EAAE,CAAC;AAgBf,eAAO,MAAM,6BAA6B,wBAAwB,CAAC;;AACnE,wBAAkB"}
|
package/src/zintrust.plugins.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* ZinTrust plugin auto-imports
|
|
3
|
+
*
|
|
4
|
+
* In real projects, this file is managed by `zin plugin install` and contains
|
|
5
|
+
* side-effect imports (e.g. `@zintrust/db-sqlite/register`) that register
|
|
6
|
+
* optional adapters/drivers into core registries.
|
|
7
|
+
*
|
|
5
8
|
*/
|
|
9
|
+
import * as SystemDebuggerRuntime from './runtime/plugins/system-debugger-runtime.js';
|
|
10
|
+
globalThis.__zintrust_system_debugger_plugin_requested__ = true;
|
|
11
|
+
globalThis.__zintrust_system_debugger_runtime__ = SystemDebuggerRuntime;
|
|
6
12
|
export const __zintrustGeneratedPluginStub = 'zintrust.plugins.ts';
|
|
7
13
|
export default {};
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* This file is created by scripts/ensure-worker-plugins.mjs when missing.
|
|
4
4
|
* It allows optional runtime plugin imports to resolve in CI/scaffolded setups.
|
|
5
5
|
*/
|
|
6
|
+
export type {};
|
|
6
7
|
export declare const __zintrustGeneratedPluginStub = "zintrust.plugins.wg.ts";
|
|
7
8
|
declare const _default: {};
|
|
8
9
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zintrust.plugins.wg.d.ts","sourceRoot":"","sources":["../../src/zintrust.plugins.wg.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"zintrust.plugins.wg.d.ts","sourceRoot":"","sources":["../../src/zintrust.plugins.wg.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,YAAY,EAAE,CAAC;AAgBf,eAAO,MAAM,6BAA6B,2BAA2B,CAAC;;AACtE,wBAAkB"}
|
|
@@ -3,5 +3,8 @@
|
|
|
3
3
|
* This file is created by scripts/ensure-worker-plugins.mjs when missing.
|
|
4
4
|
* It allows optional runtime plugin imports to resolve in CI/scaffolded setups.
|
|
5
5
|
*/
|
|
6
|
+
import * as SystemDebuggerRuntime from './runtime/plugins/system-debugger-runtime.js';
|
|
7
|
+
globalThis.__zintrust_system_debugger_plugin_requested__ = true;
|
|
8
|
+
globalThis.__zintrust_system_debugger_runtime__ = SystemDebuggerRuntime;
|
|
6
9
|
export const __zintrustGeneratedPluginStub = 'zintrust.plugins.wg.ts';
|
|
7
10
|
export default {};
|