@zintrust/core 0.1.5 → 0.1.6
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.d.ts +2 -2
- package/bin/z.d.ts.map +1 -1
- package/bin/z.js +3 -2
- package/bin/zin.d.ts +2 -2
- package/bin/zin.d.ts.map +1 -1
- package/bin/zin.js +3 -2
- package/bin/zintrust-main.d.ts +9 -0
- package/bin/zintrust-main.d.ts.map +1 -0
- package/bin/zintrust-main.js +101 -0
- package/bin/zintrust-microservices.js +7 -7
- package/bin/zintrust.d.ts +5 -4
- package/bin/zintrust.d.ts.map +1 -1
- package/bin/zintrust.js +7 -87
- package/bin/zt.d.ts +2 -2
- package/bin/zt.d.ts.map +1 -1
- package/bin/zt.js +3 -2
- package/package.json +13 -3
- package/public/index.html +4 -0
- package/src/boot/Application.js +13 -13
- package/src/boot/Server.d.ts.map +1 -1
- package/src/boot/Server.js +47 -39
- package/src/boot/bootstrap.js +71 -36
- package/src/builder/BundleOptimizer.js +3 -3
- package/src/cache/Cache.js +6 -6
- package/src/cache/drivers/KVDriver.js +2 -2
- package/src/cache/drivers/MongoDriver.js +3 -3
- package/src/cache/drivers/RedisDriver.js +3 -3
- package/src/cli/BaseCommand.d.ts +2 -0
- package/src/cli/BaseCommand.d.ts.map +1 -1
- package/src/cli/BaseCommand.js +12 -2
- package/src/cli/CLI.js +23 -23
- package/src/cli/ErrorHandler.d.ts.map +1 -1
- package/src/cli/ErrorHandler.js +14 -8
- package/src/cli/commands/AddCommand.js +15 -15
- package/src/cli/commands/ConfigCommand.js +6 -6
- package/src/cli/commands/D1MigrateCommand.js +6 -6
- package/src/cli/commands/DebugCommand.js +3 -3
- package/src/cli/commands/FixCommand.js +5 -5
- package/src/cli/commands/KeyGenerateCommand.js +5 -5
- package/src/cli/commands/LogsCleanupCommand.js +2 -2
- package/src/cli/commands/LogsCommand.js +6 -6
- package/src/cli/commands/MakeMailTemplateCommand.d.ts.map +1 -1
- package/src/cli/commands/MakeMailTemplateCommand.js +8 -7
- package/src/cli/commands/MakeNotificationTemplateCommand.d.ts.map +1 -1
- package/src/cli/commands/MakeNotificationTemplateCommand.js +8 -7
- package/src/cli/commands/MigrateCommand.js +2 -2
- package/src/cli/commands/NewCommand.js +11 -11
- package/src/cli/commands/PluginCommand.js +3 -3
- package/src/cli/commands/PrepareCommand.js +6 -6
- package/src/cli/commands/QACommand.js +8 -8
- package/src/cli/commands/SecretsCommand.js +3 -3
- package/src/cli/commands/SimulateCommand.js +6 -6
- package/src/cli/commands/StartCommand.js +7 -7
- package/src/cli/commands/TemplatesCommand.js +5 -5
- package/src/cli/commands/index.js +12 -12
- package/src/cli/config/ConfigManager.js +5 -5
- package/src/cli/config/ConfigValidator.js +1 -1
- package/src/cli/config/index.js +3 -3
- package/src/cli/debug/Dashboard.js +3 -3
- package/src/cli/index.js +10 -10
- package/src/cli/logger/Logger.js +2 -2
- package/src/cli/scaffolding/ControllerGenerator.d.ts.map +1 -1
- package/src/cli/scaffolding/ControllerGenerator.js +48 -64
- package/src/cli/scaffolding/FactoryGenerator.js +6 -6
- package/src/cli/scaffolding/FeatureScaffolder.js +8 -8
- package/src/cli/scaffolding/FileGenerator.js +4 -4
- package/src/cli/scaffolding/MigrationGenerator.js +4 -4
- package/src/cli/scaffolding/ModelGenerator.js +5 -5
- package/src/cli/scaffolding/ProjectScaffolder.d.ts.map +1 -1
- package/src/cli/scaffolding/ProjectScaffolder.js +78 -15
- package/src/cli/scaffolding/RequestFactoryGenerator.js +5 -5
- package/src/cli/scaffolding/ResponseFactoryGenerator.js +5 -5
- package/src/cli/scaffolding/RouteGenerator.js +4 -4
- package/src/cli/scaffolding/SeederGenerator.js +7 -7
- package/src/cli/scaffolding/ServiceIntegrationTestGenerator.js +5 -5
- package/src/cli/scaffolding/ServiceRequestFactoryGenerator.js +4 -4
- package/src/cli/scaffolding/ServiceScaffolder.d.ts.map +1 -1
- package/src/cli/scaffolding/ServiceScaffolder.js +24 -23
- package/src/cli/scaffolding/TemplateEngine.d.ts.map +1 -1
- package/src/cli/scaffolding/TemplateEngine.js +0 -2
- package/src/cli/scaffolding/TemplateGenerator.js +4 -4
- package/src/cli/scaffolding/WorkflowGenerator.js +4 -4
- package/src/cli/scaffolding/index.js +16 -16
- package/src/cli/utils/DistPackager.js +4 -4
- package/src/cli/utils/EnvFileLoader.js +2 -2
- package/src/cli/utils/spawn.d.ts.map +1 -1
- package/src/cli/utils/spawn.js +18 -7
- package/src/common/AwsSigV4.js +1 -1
- package/src/common/index.js +5 -5
- package/src/common/uuid.js +2 -2
- package/src/config/FileLogWriter.js +4 -4
- package/src/config/SecretsManager.d.ts +1 -42
- package/src/config/SecretsManager.d.ts.map +1 -1
- package/src/config/SecretsManager.js +2 -2
- package/src/config/StartupConfigValidator.d.ts +1 -9
- package/src/config/StartupConfigValidator.d.ts.map +1 -1
- package/src/config/StartupConfigValidator.js +115 -22
- package/src/config/app.d.ts +1 -1
- package/src/config/app.d.ts.map +1 -1
- package/src/config/app.js +1 -1
- package/src/config/broadcast.d.ts +1 -26
- package/src/config/broadcast.d.ts.map +1 -1
- package/src/config/broadcast.js +1 -1
- package/src/config/cache.d.ts +1 -22
- package/src/config/cache.d.ts.map +1 -1
- package/src/config/cache.js +1 -1
- package/src/config/cloudflare.d.ts +1 -13
- package/src/config/cloudflare.d.ts.map +1 -1
- package/src/config/database.d.ts +2 -47
- package/src/config/database.d.ts.map +1 -1
- package/src/config/database.js +1 -1
- package/src/config/env.d.ts.map +1 -1
- package/src/config/env.js +6 -2
- package/src/config/features.js +2 -2
- package/src/config/index.d.ts +10 -287
- package/src/config/index.d.ts.map +1 -1
- package/src/config/index.js +16 -16
- package/src/config/logger.d.ts.map +1 -1
- package/src/config/logger.js +10 -8
- package/src/config/logging/HttpLogger.js +4 -4
- package/src/config/logging/KvLogger.js +2 -2
- package/src/config/logging/SlackLogger.js +3 -3
- package/src/config/mail.d.ts +1 -27
- package/src/config/mail.d.ts.map +1 -1
- package/src/config/mail.js +1 -1
- package/src/config/microservices.js +1 -1
- package/src/config/middleware.d.ts +2 -6
- package/src/config/middleware.d.ts.map +1 -1
- package/src/config/middleware.js +5 -5
- package/src/config/notification.d.ts +0 -21
- package/src/config/notification.d.ts.map +1 -1
- package/src/config/notification.js +1 -1
- package/src/config/queue.d.ts +1 -39
- package/src/config/queue.d.ts.map +1 -1
- package/src/config/queue.js +1 -1
- package/src/config/security.d.ts +12 -0
- package/src/config/security.d.ts.map +1 -1
- package/src/config/security.js +17 -5
- package/src/config/startup.d.ts +2 -0
- package/src/config/startup.d.ts.map +1 -1
- package/src/config/startup.js +2 -1
- package/src/config/storage.d.ts +1 -48
- package/src/config/storage.d.ts.map +1 -1
- package/src/config/storage.js +1 -1
- package/src/config/type.d.ts +335 -0
- package/src/config/type.d.ts.map +1 -0
- package/src/config/type.js +1 -0
- package/src/container/ServiceContainer.js +1 -1
- package/src/exceptions/ZintrustError.js +1 -1
- package/src/features/Queue.js +2 -2
- package/src/functions/cloudflare.js +4 -4
- package/src/functions/deno.js +4 -4
- package/src/functions/lambda.js +4 -4
- package/src/health/RuntimeHealthProbes.js +3 -3
- package/src/health/StartupHealthChecks.js +9 -9
- package/src/http/Kernel.js +10 -10
- package/src/http/RequestContext.js +2 -2
- package/src/http/Response.js +1 -1
- package/src/index.d.ts +36 -1
- package/src/index.d.ts.map +1 -1
- package/src/index.js +69 -36
- package/src/microservices/MicroserviceBootstrap.js +5 -5
- package/src/microservices/MicroserviceGenerator.js +10 -10
- package/src/microservices/MicroserviceManager.js +4 -4
- package/src/microservices/PostgresAdapter.js +3 -3
- package/src/microservices/RequestTracingMiddleware.js +3 -3
- package/src/microservices/ServiceAuthMiddleware.js +3 -3
- package/src/microservices/ServiceBundler.js +3 -3
- package/src/microservices/ServiceHealthMonitor.js +2 -2
- package/src/middleware/CsrfMiddleware.js +3 -3
- package/src/middleware/ErrorHandlerMiddleware.js +4 -4
- package/src/middleware/LoggingMiddleware.js +3 -3
- package/src/middleware/RateLimiter.js +1 -1
- package/src/middleware/index.js +6 -6
- package/src/node-singletons/http.d.ts +2 -2
- package/src/node-singletons/http.d.ts.map +1 -1
- package/src/node-singletons/http.js +1 -1
- package/src/node-singletons/index.js +14 -14
- package/src/node-singletons/path.d.ts +1 -1
- package/src/node.d.ts +5 -0
- package/src/node.d.ts.map +1 -0
- package/src/node.js +4 -0
- package/src/orm/ConnectionManager.js +3 -3
- package/src/orm/Database.js +8 -8
- package/src/orm/Model.js +5 -5
- package/src/orm/QueryBuilder.js +1 -1
- package/src/orm/Relationships.js +1 -1
- package/src/orm/adapters/D1Adapter.js +5 -5
- package/src/orm/adapters/MySQLAdapter.d.ts.map +1 -1
- package/src/orm/adapters/MySQLAdapter.js +4 -6
- package/src/orm/adapters/PostgreSQLAdapter.d.ts.map +1 -1
- package/src/orm/adapters/PostgreSQLAdapter.js +4 -6
- package/src/orm/adapters/SQLServerAdapter.d.ts.map +1 -1
- package/src/orm/adapters/SQLServerAdapter.js +4 -6
- package/src/orm/adapters/SQLiteAdapter.d.ts.map +1 -1
- package/src/orm/adapters/SQLiteAdapter.js +5 -7
- package/src/performance/CodeGenerationBenchmark.js +5 -5
- package/src/performance/Optimizer.js +3 -3
- package/src/performance/establish-baseline.js +4 -4
- package/src/profiling/RequestProfiler.js +4 -4
- package/src/runtime/PluginManager.js +8 -8
- package/src/runtime/RuntimeDetector.d.ts.map +1 -1
- package/src/runtime/RuntimeDetector.js +22 -12
- package/src/runtime/adapters/CloudflareAdapter.js +3 -3
- package/src/runtime/adapters/DenoAdapter.js +2 -2
- package/src/runtime/adapters/FargateAdapter.js +4 -4
- package/src/runtime/adapters/LambdaAdapter.js +4 -4
- package/src/runtime/adapters/NodeServerAdapter.js +4 -4
- package/src/scheduler/ScheduleRunner.js +2 -2
- package/src/scheduler/index.js +1 -1
- package/src/schedules/index.js +1 -1
- package/src/schedules/log-cleanup.js +2 -2
- package/src/scripts/GenerateEnvArtifacts.js +4 -4
- package/src/scripts/TemplateSync.js +8 -6
- package/src/security/CsrfTokenManager.js +2 -2
- package/src/security/Encryptor.js +3 -3
- package/src/security/Hash.js +2 -2
- package/src/security/JwtManager.js +2 -2
- package/src/security/StartupSecretValidation.js +4 -4
- package/src/security/UrlValidator.js +1 -1
- package/src/security/Xss.js +1 -1
- package/src/security/XssProtection.d.ts.map +1 -1
- package/src/security/XssProtection.js +8 -3
- package/src/templates/adapters/MySQLAdapter.ts.tpl +0 -2
- package/src/templates/adapters/PostgreSQLAdapter.ts.tpl +0 -3
- package/src/templates/adapters/SQLServerAdapter.ts.tpl +0 -2
- package/src/templates/adapters/SQLiteAdapter.ts.tpl +0 -2
- package/src/templates/project/basic/.env.tpl +8 -1
- package/src/templates/project/basic/app/Controllers/UserController.ts.tpl +3 -2
- package/src/templates/project/basic/app/Middleware/ProfilerMiddleware.ts.tpl +3 -2
- package/src/templates/project/basic/app/Middleware/index.ts.tpl +8 -14
- package/src/templates/project/basic/app/Models/Post.ts.tpl +2 -1
- package/src/templates/project/basic/app/Models/User.ts.tpl +1 -1
- package/src/templates/project/basic/app/Toolkit/Broadcast/sendBroadcast.ts.tpl +1 -1
- package/src/templates/project/basic/app/Toolkit/Mail/sendWelcomeEmail.ts.tpl +1 -1
- package/src/templates/project/basic/app/Toolkit/Notification/sendSlackNotification.ts.tpl +1 -1
- package/src/templates/project/basic/app/Toolkit/Notification/sendSms.ts.tpl +1 -1
- package/src/templates/project/basic/config/FileLogWriter.ts.tpl +2 -4
- package/src/templates/project/basic/config/SecretsManager.ts.tpl +6 -39
- package/src/templates/project/basic/config/StartupConfigValidator.ts.tpl +154 -37
- package/src/templates/project/basic/config/app.ts.tpl +1 -5
- package/src/templates/project/basic/config/broadcast.ts.tpl +6 -36
- package/src/templates/project/basic/config/cache.ts.tpl +1 -42
- package/src/templates/project/basic/config/cloudflare.ts.tpl +1 -15
- package/src/templates/project/basic/config/database.ts.tpl +5 -51
- package/src/templates/project/basic/config/env.ts.tpl +6 -7
- package/src/templates/project/basic/config/features.ts.tpl +1 -1
- package/src/templates/project/basic/config/index.ts.tpl +1 -1
- package/src/templates/project/basic/config/logger.ts.tpl +3 -1
- package/src/templates/project/basic/config/logging/HttpLogger.ts.tpl +1 -1
- package/src/templates/project/basic/config/logging/KvLogger.ts.tpl +1 -1
- package/src/templates/project/basic/config/logging/SlackLogger.ts.tpl +1 -1
- package/src/templates/project/basic/config/mail.ts.tpl +1 -57
- package/src/templates/project/basic/config/microservices.ts.tpl +1 -1
- package/src/templates/project/basic/config/middleware.ts.tpl +2 -6
- package/src/templates/project/basic/config/notification.ts.tpl +1 -36
- package/src/templates/project/basic/config/queue.ts.tpl +1 -49
- package/src/templates/project/basic/config/security.ts.tpl +13 -1
- package/src/templates/project/basic/config/startup.ts.tpl +2 -0
- package/src/templates/project/basic/config/storage.ts.tpl +6 -54
- package/src/templates/project/basic/config/type.ts.tpl +414 -0
- package/src/templates/project/basic/package.json.tpl +1 -0
- package/src/templates/project/basic/routes/api.ts.tpl +1 -1
- package/src/templates/project/basic/routes/broadcast.ts.tpl +1 -1
- package/src/templates/project/basic/routes/health.ts.tpl +1 -1
- package/src/templates/project/basic/routes/storage.ts.tpl +1 -1
- package/src/templates/project/basic/src/index.ts.tpl +49 -41
- package/src/templates/project/basic/template.json +1 -1
- package/src/templates/project/basic/tsconfig.json.tpl +3 -1
- package/src/toolkit/Secrets/EnvFile.js +3 -3
- package/src/toolkit/Secrets/Manifest.js +3 -3
- package/src/toolkit/Secrets/index.js +5 -5
- package/src/toolkit/Secrets/providers/AwsSecretsManager.js +2 -2
- package/src/toolkit/Secrets/providers/CloudflareKv.js +1 -1
- package/src/tools/broadcast/Broadcast.js +6 -6
- package/src/tools/broadcast/drivers/BaseDriver.js +1 -1
- package/src/tools/broadcast/drivers/Pusher.d.ts +1 -1
- package/src/tools/broadcast/drivers/Pusher.d.ts.map +1 -1
- package/src/tools/broadcast/drivers/Pusher.js +2 -2
- package/src/tools/broadcast/drivers/Redis.js +1 -1
- package/src/tools/broadcast/drivers/RedisHttps.js +3 -3
- package/src/tools/broadcast/index.js +6 -6
- package/src/tools/http/Http.js +4 -4
- package/src/tools/http/HttpResponse.js +1 -1
- package/src/tools/http/index.js +2 -2
- package/src/tools/mail/Mail.js +8 -8
- package/src/tools/mail/attachments.js +1 -1
- package/src/tools/mail/drivers/BaseDriver.js +1 -1
- package/src/tools/mail/drivers/Mailgun.js +1 -1
- package/src/tools/mail/drivers/SendGrid.js +1 -1
- package/src/tools/mail/drivers/Ses.js +2 -2
- package/src/tools/mail/drivers/Smtp.js +4 -4
- package/src/tools/mail/templates/markdown/index.js +3 -3
- package/src/tools/mail/templates/markdown/registry.js +5 -5
- package/src/tools/mail/templates/markdown/validator.js +1 -1
- package/src/tools/mail/testing.js +1 -1
- package/src/tools/notification/Notification.js +1 -1
- package/src/tools/notification/Registry.js +3 -3
- package/src/tools/notification/Service.js +3 -3
- package/src/tools/notification/config.js +1 -1
- package/src/tools/notification/drivers/BaseDriver.js +1 -1
- package/src/tools/notification/drivers/Slack.js +1 -1
- package/src/tools/notification/drivers/Termii.js +1 -1
- package/src/tools/notification/drivers/Twilio.js +1 -1
- package/src/tools/notification/templates/markdown/index.js +3 -3
- package/src/tools/notification/templates/markdown/registry.js +5 -5
- package/src/tools/notification/testing.js +1 -1
- package/src/tools/notification/testingHelpers.js +2 -2
- package/src/tools/queue/Queue.js +1 -1
- package/src/tools/queue/drivers/InMemory.js +1 -1
- package/src/tools/queue/drivers/Redis.js +2 -2
- package/src/tools/storage/LocalSignedUrl.js +2 -2
- package/src/tools/storage/drivers/Gcs.js +1 -1
- package/src/tools/storage/drivers/Local.js +5 -5
- package/src/tools/storage/drivers/R2.js +2 -2
- package/src/tools/storage/drivers/S3.js +3 -3
- package/src/tools/storage/index.js +6 -6
- package/src/tools/storage/testing.js +1 -1
- package/src/tools/templates/MarkdownRenderer.js +2 -2
- package/src/tools/templates/index.js +1 -1
- package/src/validation/Validator.js +3 -3
package/src/boot/bootstrap.js
CHANGED
|
@@ -3,16 +3,70 @@
|
|
|
3
3
|
* Entry point for running the Zintrust server
|
|
4
4
|
* Sealed namespace for immutability
|
|
5
5
|
*/
|
|
6
|
-
import { Application } from './Application';
|
|
7
|
-
import { Server } from './Server';
|
|
8
|
-
import { Env } from '../config/env';
|
|
9
|
-
import { Logger } from '../config/logger';
|
|
10
|
-
import { ErrorFactory } from '../exceptions/ZintrustError';
|
|
6
|
+
import { Application } from './Application.js';
|
|
7
|
+
import { Server } from './Server.js';
|
|
8
|
+
import { Env } from '../config/env.js';
|
|
9
|
+
import { Logger } from '../config/logger.js';
|
|
10
|
+
import { ErrorFactory } from '../exceptions/ZintrustError.js';
|
|
11
11
|
let appInstance;
|
|
12
12
|
let serverInstance;
|
|
13
13
|
let isShuttingDown = false;
|
|
14
|
+
const logBootstrapErrorDetails = (error) => {
|
|
15
|
+
// Best-effort: surface startup config validation details (already redacted)
|
|
16
|
+
// so container runs show which env vars are missing/misconfigured.
|
|
17
|
+
try {
|
|
18
|
+
const details = error?.details;
|
|
19
|
+
if (details?.errors !== undefined) {
|
|
20
|
+
Logger.error('Startup configuration errors:', details.errors);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
// best-effort logging
|
|
25
|
+
}
|
|
26
|
+
// Best-effort: surface startup health-check report details.
|
|
27
|
+
try {
|
|
28
|
+
const details = error?.details;
|
|
29
|
+
if (details?.report !== undefined) {
|
|
30
|
+
Logger.error('Startup health report:', details.report);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
// best-effort logging
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const startSchedulesIfNeeded = async (app) => {
|
|
38
|
+
try {
|
|
39
|
+
const { RuntimeDetector } = await import('../runtime/RuntimeDetector.js');
|
|
40
|
+
const runtime = RuntimeDetector.detectRuntime();
|
|
41
|
+
if (runtime !== 'nodejs' && runtime !== 'fargate')
|
|
42
|
+
return;
|
|
43
|
+
const { create: createScheduleRunner } = await import('../scheduler/ScheduleRunner.js');
|
|
44
|
+
const schedules = await import('../schedules/index.js');
|
|
45
|
+
const runner = createScheduleRunner();
|
|
46
|
+
for (const schedule of Object.values(schedules)) {
|
|
47
|
+
// Each schedule is expected to export a default ISchedule
|
|
48
|
+
// @ts-ignore
|
|
49
|
+
runner.register(schedule);
|
|
50
|
+
}
|
|
51
|
+
runner.start();
|
|
52
|
+
// Add shutdown hook to stop schedules gracefully
|
|
53
|
+
const shutdownManager = app.getContainer().get('shutdownManager');
|
|
54
|
+
if ((typeof shutdownManager === 'object' || typeof shutdownManager === 'function') &&
|
|
55
|
+
shutdownManager !== null &&
|
|
56
|
+
'add' in shutdownManager &&
|
|
57
|
+
typeof shutdownManager.add === 'function') {
|
|
58
|
+
shutdownManager.add(async () => {
|
|
59
|
+
const scheduleTimeoutMs = Env.getInt('SCHEDULE_SHUTDOWN_TIMEOUT_MS', 30000);
|
|
60
|
+
await runner.stop(scheduleTimeoutMs);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
Logger.warn('Failed to start schedules:', err);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
14
68
|
const withTimeout = async (promise, timeoutMs, label) => {
|
|
15
|
-
if (timeoutMs <= 0)
|
|
69
|
+
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0)
|
|
16
70
|
return promise;
|
|
17
71
|
let timeoutId;
|
|
18
72
|
try {
|
|
@@ -32,9 +86,15 @@ const gracefulShutdown = async (signal) => {
|
|
|
32
86
|
if (isShuttingDown)
|
|
33
87
|
return;
|
|
34
88
|
isShuttingDown = true;
|
|
35
|
-
const timeoutMs =
|
|
89
|
+
const timeoutMs = Env.getInt('SHUTDOWN_TIMEOUT', 1500);
|
|
90
|
+
const forceExitMs = Env.getInt('SHUTDOWN_FORCE_EXIT_MS', 2500);
|
|
36
91
|
Logger.info(`${signal} received, shutting down gracefully...`);
|
|
37
92
|
try {
|
|
93
|
+
const forceExitTimer = globalThis.setTimeout(() => {
|
|
94
|
+
process.exit(0);
|
|
95
|
+
}, forceExitMs);
|
|
96
|
+
// Best-effort: don't keep the process alive just for this timer
|
|
97
|
+
forceExitTimer.unref?.();
|
|
38
98
|
await withTimeout((async () => {
|
|
39
99
|
if (serverInstance !== undefined) {
|
|
40
100
|
await serverInstance.close();
|
|
@@ -43,6 +103,7 @@ const gracefulShutdown = async (signal) => {
|
|
|
43
103
|
await appInstance.shutdown();
|
|
44
104
|
}
|
|
45
105
|
})(), timeoutMs, 'Graceful shutdown timed out');
|
|
106
|
+
globalThis.clearTimeout(forceExitTimer);
|
|
46
107
|
process.exit(0);
|
|
47
108
|
}
|
|
48
109
|
catch (error) {
|
|
@@ -73,39 +134,13 @@ const BootstrapFunctions = Object.freeze({
|
|
|
73
134
|
// Start listening
|
|
74
135
|
await server.listen();
|
|
75
136
|
Logger.info(`Server running at http://${host}:${port}`);
|
|
137
|
+
Logger.info(`Zintrust documentation at http://${host}:${port}/doc`);
|
|
76
138
|
// Start schedules for long-running runtimes (Node.js / Fargate)
|
|
77
|
-
|
|
78
|
-
const runtime = (await import('../runtime/RuntimeDetector')).RuntimeDetector.detectRuntime();
|
|
79
|
-
if (runtime === 'nodejs' || runtime === 'fargate') {
|
|
80
|
-
const { create: createScheduleRunner } = await import('../scheduler/ScheduleRunner');
|
|
81
|
-
const schedules = await import('../schedules');
|
|
82
|
-
const runner = createScheduleRunner();
|
|
83
|
-
for (const schedule of Object.values(schedules)) {
|
|
84
|
-
// Each schedule is expected to export a default ISchedule
|
|
85
|
-
// @ts-ignore
|
|
86
|
-
runner.register(schedule);
|
|
87
|
-
}
|
|
88
|
-
runner.start();
|
|
89
|
-
// Add shutdown hook to stop schedules gracefully
|
|
90
|
-
const shutdownManager = app.getContainer().get('shutdownManager');
|
|
91
|
-
if ((typeof shutdownManager === 'object' || typeof shutdownManager === 'function') &&
|
|
92
|
-
shutdownManager !== null &&
|
|
93
|
-
'add' in shutdownManager &&
|
|
94
|
-
typeof shutdownManager.add === 'function') {
|
|
95
|
-
shutdownManager.add(async () => {
|
|
96
|
-
const scheduleTimeoutMs = Env.getInt('SCHEDULE_SHUTDOWN_TIMEOUT_MS', 30000);
|
|
97
|
-
await runner.stop(scheduleTimeoutMs);
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
catch (err) {
|
|
103
|
-
Logger.warn('Failed to start schedules:', err);
|
|
104
|
-
}
|
|
139
|
+
await startSchedulesIfNeeded(app);
|
|
105
140
|
}
|
|
106
141
|
catch (error) {
|
|
107
142
|
Logger.error('Failed to bootstrap application:', error);
|
|
108
|
-
|
|
143
|
+
logBootstrapErrorDetails(error);
|
|
109
144
|
process.exit(1);
|
|
110
145
|
}
|
|
111
146
|
},
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* - Removing dev dependencies
|
|
7
7
|
* - Inlining configuration
|
|
8
8
|
*/
|
|
9
|
-
import { Logger } from '../config/logger';
|
|
10
|
-
import fs from '../node-singletons/fs';
|
|
11
|
-
import * as path from '../node-singletons/path';
|
|
9
|
+
import { Logger } from '../config/logger.js';
|
|
10
|
+
import fs from '../node-singletons/fs.js';
|
|
11
|
+
import * as path from '../node-singletons/path.js';
|
|
12
12
|
/**
|
|
13
13
|
* Bundle optimizer - reduces deployed package size
|
|
14
14
|
* Sealed namespace for immutability
|
package/src/cache/Cache.js
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* Central cache management and driver resolution
|
|
4
4
|
* Sealed namespace pattern - all exports through Cache namespace
|
|
5
5
|
*/
|
|
6
|
-
import { KVDriver } from './drivers/KVDriver';
|
|
7
|
-
import { MemoryDriver } from './drivers/MemoryDriver';
|
|
8
|
-
import { MongoDriver } from './drivers/MongoDriver';
|
|
9
|
-
import { RedisDriver } from './drivers/RedisDriver';
|
|
10
|
-
import { Env } from '../config/env';
|
|
11
|
-
import { ErrorFactory } from '../exceptions/ZintrustError';
|
|
6
|
+
import { KVDriver } from './drivers/KVDriver.js';
|
|
7
|
+
import { MemoryDriver } from './drivers/MemoryDriver.js';
|
|
8
|
+
import { MongoDriver } from './drivers/MongoDriver.js';
|
|
9
|
+
import { RedisDriver } from './drivers/RedisDriver.js';
|
|
10
|
+
import { Env } from '../config/env.js';
|
|
11
|
+
import { ErrorFactory } from '../exceptions/ZintrustError.js';
|
|
12
12
|
let instance;
|
|
13
13
|
function buildDriver(driver) {
|
|
14
14
|
const maybeCreate = driver.create;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Cloudflare KV Cache Driver
|
|
3
3
|
* Interfaces with the native KV binding in Cloudflare Workers
|
|
4
4
|
*/
|
|
5
|
-
import { Cloudflare } from '../../config/cloudflare';
|
|
6
|
-
import { Logger } from '../../config/logger';
|
|
5
|
+
import { Cloudflare } from '../../config/cloudflare.js';
|
|
6
|
+
import { Logger } from '../../config/logger.js';
|
|
7
7
|
/**
|
|
8
8
|
* Create a new KV driver instance
|
|
9
9
|
*/
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* MongoDB Cache Driver
|
|
3
3
|
* Uses MongoDB Atlas Data API (HTTPS) for zero-dependency integration
|
|
4
4
|
*/
|
|
5
|
-
import { Env } from '../../config/env';
|
|
6
|
-
import { Logger } from '../../config/logger';
|
|
7
|
-
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
5
|
+
import { Env } from '../../config/env.js';
|
|
6
|
+
import { Logger } from '../../config/logger.js';
|
|
7
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
8
8
|
/**
|
|
9
9
|
* MongoDB Cache Driver
|
|
10
10
|
* Uses MongoDB Atlas Data API (HTTPS) for zero-dependency integration
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Redis Cache Driver
|
|
3
3
|
* Zero-dependency implementation using Node.js native net module
|
|
4
4
|
*/
|
|
5
|
-
import { Env } from '../../config/env';
|
|
6
|
-
import { Logger } from '../../config/logger';
|
|
7
|
-
import * as net from '../../node-singletons/net';
|
|
5
|
+
import { Env } from '../../config/env.js';
|
|
6
|
+
import { Logger } from '../../config/logger.js';
|
|
7
|
+
import * as net from '../../node-singletons/net.js';
|
|
8
8
|
/**
|
|
9
9
|
* Create a new Redis driver instance
|
|
10
10
|
*/
|
package/src/cli/BaseCommand.d.ts
CHANGED
|
@@ -32,6 +32,8 @@ export declare const BaseCommand: Readonly<{
|
|
|
32
32
|
create<T extends IBaseCommand = IBaseCommand>(config: {
|
|
33
33
|
name: string;
|
|
34
34
|
description: string;
|
|
35
|
+
/** Optional alias or aliases for the command (e.g. 'make:mail') */
|
|
36
|
+
aliases?: string | string[];
|
|
35
37
|
addOptions?: (command: Command) => void;
|
|
36
38
|
execute: (options: CommandOptions) => void | Promise<void>;
|
|
37
39
|
}): T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseCommand.d.ts","sourceRoot":"","sources":["../../../src/cli/BaseCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,YAAY;IAC3B,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,IAAI,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,KAAK,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;CAC/B;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW;IACtB;;OAEG;WACI,CAAC,SAAS,YAAY,yBAAyB;QACpD,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;QACxC,OAAO,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;KAC5D,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"BaseCommand.d.ts","sourceRoot":"","sources":["../../../src/cli/BaseCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,YAAY;IAC3B,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,IAAI,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,KAAK,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;CAC/B;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW;IACtB;;OAEG;WACI,CAAC,SAAS,YAAY,yBAAyB;QACpD,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,mEAAmE;QACnE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QAC5B,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;QACxC,OAAO,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;KAC5D,GAAG,CAAC;EA6DL,CAAC"}
|
package/src/cli/BaseCommand.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Base Command - Abstract Command Class
|
|
3
3
|
* All CLI commands extend this class
|
|
4
4
|
*/
|
|
5
|
-
import { ErrorHandler } from './ErrorHandler';
|
|
6
|
-
import { ErrorFactory } from '../exceptions/ZintrustError';
|
|
5
|
+
import { ErrorHandler } from './ErrorHandler.js';
|
|
6
|
+
import { ErrorFactory } from '../exceptions/ZintrustError.js';
|
|
7
7
|
import { Command } from 'commander';
|
|
8
8
|
/**
|
|
9
9
|
* Command Factory Helper
|
|
@@ -18,6 +18,16 @@ export const BaseCommand = Object.freeze({
|
|
|
18
18
|
const command = new Command(config.name);
|
|
19
19
|
command.description(config.description);
|
|
20
20
|
command.option('--verbose', 'Enable verbose output');
|
|
21
|
+
if (typeof config.aliases === 'string' && config.aliases.length > 0) {
|
|
22
|
+
command.alias(config.aliases);
|
|
23
|
+
}
|
|
24
|
+
if (Array.isArray(config.aliases)) {
|
|
25
|
+
for (const alias of config.aliases) {
|
|
26
|
+
if (typeof alias === 'string' && alias.length > 0) {
|
|
27
|
+
command.alias(alias);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
21
31
|
// Add custom options
|
|
22
32
|
if (config.addOptions) {
|
|
23
33
|
config.addOptions(command);
|
package/src/cli/CLI.js
CHANGED
|
@@ -2,29 +2,29 @@
|
|
|
2
2
|
* CLI - Main CLI Class
|
|
3
3
|
* Orchestrates all CLI commands using Commander
|
|
4
4
|
*/
|
|
5
|
-
import { AddCommand } from './commands/AddCommand';
|
|
6
|
-
import { ConfigCommand } from './commands/ConfigCommand';
|
|
7
|
-
import { D1MigrateCommand } from './commands/D1MigrateCommand';
|
|
8
|
-
import { DebugCommand } from './commands/DebugCommand';
|
|
9
|
-
import { FixCommand } from './commands/FixCommand';
|
|
10
|
-
import { KeyGenerateCommand } from './commands/KeyGenerateCommand';
|
|
11
|
-
import { MakeMailTemplateCommand } from './commands/MakeMailTemplateCommand';
|
|
12
|
-
import { MakeNotificationTemplateCommand } from './commands/MakeNotificationTemplateCommand';
|
|
13
|
-
import { MigrateCommand } from './commands/MigrateCommand';
|
|
14
|
-
import { NewCommand } from './commands/NewCommand';
|
|
15
|
-
import { PluginCommand } from './commands/PluginCommand';
|
|
16
|
-
import { PrepareCommand } from './commands/PrepareCommand';
|
|
17
|
-
import { QACommand } from './commands/QACommand';
|
|
18
|
-
import { SecretsCommand } from './commands/SecretsCommand';
|
|
19
|
-
import { SimulateCommand } from './commands/SimulateCommand';
|
|
20
|
-
import { StartCommand } from './commands/StartCommand';
|
|
21
|
-
import { TemplatesCommand } from './commands/TemplatesCommand';
|
|
22
|
-
import { ErrorHandler } from './ErrorHandler';
|
|
23
|
-
import { esmDirname } from '../common/index';
|
|
24
|
-
import { Logger } from '../config/logger';
|
|
25
|
-
import { ErrorFactory } from '../exceptions/ZintrustError';
|
|
26
|
-
import { readFileSync } from '../node-singletons/fs';
|
|
27
|
-
import { join } from '../node-singletons/path';
|
|
5
|
+
import { AddCommand } from './commands/AddCommand.js';
|
|
6
|
+
import { ConfigCommand } from './commands/ConfigCommand.js';
|
|
7
|
+
import { D1MigrateCommand } from './commands/D1MigrateCommand.js';
|
|
8
|
+
import { DebugCommand } from './commands/DebugCommand.js';
|
|
9
|
+
import { FixCommand } from './commands/FixCommand.js';
|
|
10
|
+
import { KeyGenerateCommand } from './commands/KeyGenerateCommand.js';
|
|
11
|
+
import { MakeMailTemplateCommand } from './commands/MakeMailTemplateCommand.js';
|
|
12
|
+
import { MakeNotificationTemplateCommand } from './commands/MakeNotificationTemplateCommand.js';
|
|
13
|
+
import { MigrateCommand } from './commands/MigrateCommand.js';
|
|
14
|
+
import { NewCommand } from './commands/NewCommand.js';
|
|
15
|
+
import { PluginCommand } from './commands/PluginCommand.js';
|
|
16
|
+
import { PrepareCommand } from './commands/PrepareCommand.js';
|
|
17
|
+
import { QACommand } from './commands/QACommand.js';
|
|
18
|
+
import { SecretsCommand } from './commands/SecretsCommand.js';
|
|
19
|
+
import { SimulateCommand } from './commands/SimulateCommand.js';
|
|
20
|
+
import { StartCommand } from './commands/StartCommand.js';
|
|
21
|
+
import { TemplatesCommand } from './commands/TemplatesCommand.js';
|
|
22
|
+
import { ErrorHandler } from './ErrorHandler.js';
|
|
23
|
+
import { esmDirname } from '../common/index.js';
|
|
24
|
+
import { Logger } from '../config/logger.js';
|
|
25
|
+
import { ErrorFactory } from '../exceptions/ZintrustError.js';
|
|
26
|
+
import { readFileSync } from '../node-singletons/fs.js';
|
|
27
|
+
import { join } from '../node-singletons/path.js';
|
|
28
28
|
import { Command } from 'commander';
|
|
29
29
|
const __dirname = esmDirname(import.meta.url);
|
|
30
30
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorHandler.d.ts","sourceRoot":"","sources":["../../../src/cli/ErrorHandler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,eAAO,MAAM,UAAU;;;;CAIb,CAAC;
|
|
1
|
+
{"version":3,"file":"ErrorHandler.d.ts","sourceRoot":"","sources":["../../../src/cli/ErrorHandler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,eAAO,MAAM,UAAU;;;;CAIb,CAAC;AAwGX;;GAEG;AACH,eAAO,MAAM,YAAY;oBApGhB,KAAK,GAAG,MAAM,aACX,MAAM,QACX,OAAO,KACX,IAAI;0BAYsB,MAAM,YAAY,MAAM,KAAG,IAAI;oBAY9B,MAAM,KAAG,IAAI;uBA+CV,MAAM,KAAG,IAAI;oBAQb,MAAM,KAAG,IAAI;qBAQf,MAAM,YAAW,OAAO,KAAW,IAAI;sBAvDtC,MAAM,KAAG,IAAI;EAyE3C,CAAC"}
|
package/src/cli/ErrorHandler.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Provides consistent error formatting and proper Unix exit codes
|
|
4
4
|
* Sealed namespace with immutable error handling methods
|
|
5
5
|
*/
|
|
6
|
-
import { Env } from '../config/env';
|
|
7
|
-
import { Logger } from '../config/logger';
|
|
6
|
+
import { Env } from '../config/env.js';
|
|
7
|
+
import { Logger } from '../config/logger.js';
|
|
8
8
|
import chalk from 'chalk';
|
|
9
9
|
export const EXIT_CODES = {
|
|
10
10
|
SUCCESS: 0,
|
|
@@ -47,12 +47,18 @@ const displayBanner = (version) => {
|
|
|
47
47
|
const bannerWidth = 46;
|
|
48
48
|
const env = Env.NODE_ENV || 'development';
|
|
49
49
|
const db = Env.DB_CONNECTION || 'sqlite';
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
const border = chalk.cyanBright;
|
|
51
|
+
const label = chalk.bold.white;
|
|
52
|
+
const frameworkValue = chalk.bold.cyanBright;
|
|
53
|
+
const versionValue = chalk.bold.greenBright;
|
|
54
|
+
const envValue = chalk.bold.yellowBright;
|
|
55
|
+
const dbValue = chalk.bold.magentaBright;
|
|
56
|
+
console.log(border('┌' + '─'.repeat(bannerWidth) + '┐'));
|
|
57
|
+
console.log(`${border('│')} ${label('Framework: ')}${frameworkValue(framework.padEnd(bannerWidth - 12))} ${border('│')}`);
|
|
58
|
+
console.log(`${border('│')} ${label('Version: ')}${versionValue(version.padEnd(bannerWidth - 12))} ${border('│')}`);
|
|
59
|
+
console.log(`${border('│')} ${label('Env: ')}${envValue(env.padEnd(bannerWidth - 12))} ${border('│')}`);
|
|
60
|
+
console.log(`${border('│')} ${label('Database: ')}${dbValue(db.padEnd(bannerWidth - 12))} ${border('│')}`);
|
|
61
|
+
console.log(border('└' + '─'.repeat(bannerWidth) + '┘'));
|
|
56
62
|
console.log();
|
|
57
63
|
/* eslint-enable no-console */
|
|
58
64
|
};
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
* Add Command - Phase 4 Integration
|
|
3
3
|
* Add services and features to existing Zintrust project
|
|
4
4
|
*/
|
|
5
|
-
import { BaseCommand } from '../BaseCommand';
|
|
6
|
-
import { ControllerGenerator } from '../scaffolding/ControllerGenerator';
|
|
7
|
-
import { FactoryGenerator } from '../scaffolding/FactoryGenerator';
|
|
8
|
-
import { FeatureScaffolder } from '../scaffolding/FeatureScaffolder';
|
|
9
|
-
import { MigrationGenerator } from '../scaffolding/MigrationGenerator';
|
|
10
|
-
import { ModelGenerator } from '../scaffolding/ModelGenerator';
|
|
11
|
-
import { RequestFactoryGenerator } from '../scaffolding/RequestFactoryGenerator';
|
|
12
|
-
import { ResponseFactoryGenerator, } from '../scaffolding/ResponseFactoryGenerator';
|
|
13
|
-
import { RouteGenerator } from '../scaffolding/RouteGenerator';
|
|
14
|
-
import { SeederGenerator } from '../scaffolding/SeederGenerator';
|
|
15
|
-
import { ServiceScaffolder } from '../scaffolding/ServiceScaffolder';
|
|
16
|
-
import { WorkflowGenerator } from '../scaffolding/WorkflowGenerator';
|
|
17
|
-
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
18
|
-
import fs from '../../node-singletons/fs';
|
|
19
|
-
import * as path from '../../node-singletons/path';
|
|
5
|
+
import { BaseCommand } from '../BaseCommand.js';
|
|
6
|
+
import { ControllerGenerator } from '../scaffolding/ControllerGenerator.js';
|
|
7
|
+
import { FactoryGenerator } from '../scaffolding/FactoryGenerator.js';
|
|
8
|
+
import { FeatureScaffolder } from '../scaffolding/FeatureScaffolder.js';
|
|
9
|
+
import { MigrationGenerator } from '../scaffolding/MigrationGenerator.js';
|
|
10
|
+
import { ModelGenerator } from '../scaffolding/ModelGenerator.js';
|
|
11
|
+
import { RequestFactoryGenerator } from '../scaffolding/RequestFactoryGenerator.js';
|
|
12
|
+
import { ResponseFactoryGenerator, } from '../scaffolding/ResponseFactoryGenerator.js';
|
|
13
|
+
import { RouteGenerator } from '../scaffolding/RouteGenerator.js';
|
|
14
|
+
import { SeederGenerator } from '../scaffolding/SeederGenerator.js';
|
|
15
|
+
import { ServiceScaffolder } from '../scaffolding/ServiceScaffolder.js';
|
|
16
|
+
import { WorkflowGenerator } from '../scaffolding/WorkflowGenerator.js';
|
|
17
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
18
|
+
import fs from '../../node-singletons/fs.js';
|
|
19
|
+
import * as path from '../../node-singletons/path.js';
|
|
20
20
|
import inquirer from 'inquirer';
|
|
21
21
|
const addOptions = (command) => {
|
|
22
22
|
command
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* Config Command - Configuration management CLI command
|
|
3
3
|
* Handles configuration operations: get, set, list, reset, edit, export
|
|
4
4
|
*/
|
|
5
|
-
import { BaseCommand } from '../BaseCommand';
|
|
6
|
-
import { ConfigManager } from '../config/ConfigManager';
|
|
7
|
-
import { ConfigValidator } from '../config/ConfigValidator';
|
|
8
|
-
import { ErrorHandler } from '../ErrorHandler';
|
|
9
|
-
import { PromptHelper } from '../PromptHelper';
|
|
10
|
-
import { Logger } from '../../config/logger';
|
|
5
|
+
import { BaseCommand } from '../BaseCommand.js';
|
|
6
|
+
import { ConfigManager } from '../config/ConfigManager.js';
|
|
7
|
+
import { ConfigValidator } from '../config/ConfigValidator.js';
|
|
8
|
+
import { ErrorHandler } from '../ErrorHandler.js';
|
|
9
|
+
import { PromptHelper } from '../PromptHelper.js';
|
|
10
|
+
import { Logger } from '../../config/logger.js';
|
|
11
11
|
import chalk from 'chalk';
|
|
12
12
|
const addOptions = (command) => {
|
|
13
13
|
command.argument('[action]', 'Action: get, set, list, reset, edit, export');
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* D1 Migrate Command
|
|
3
3
|
* Run Cloudflare D1 migrations using Wrangler
|
|
4
4
|
*/
|
|
5
|
-
import { BaseCommand } from '../BaseCommand';
|
|
6
|
-
import { resolveNpmPath } from '../../common/index';
|
|
7
|
-
import { appConfig } from '../../config/app';
|
|
8
|
-
import { Logger } from '../../config/logger';
|
|
9
|
-
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
10
|
-
import { execFileSync } from '../../node-singletons/child-process';
|
|
5
|
+
import { BaseCommand } from '../BaseCommand.js';
|
|
6
|
+
import { resolveNpmPath } from '../../common/index.js';
|
|
7
|
+
import { appConfig } from '../../config/app.js';
|
|
8
|
+
import { Logger } from '../../config/logger.js';
|
|
9
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
10
|
+
import { execFileSync } from '../../node-singletons/child-process.js';
|
|
11
11
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
12
12
|
const runWrangler = async (cmd, args) => {
|
|
13
13
|
const npmPath = resolveNpmPath();
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Debug Command
|
|
3
3
|
* Launch debug mode with profiling and monitoring
|
|
4
4
|
*/
|
|
5
|
-
import { BaseCommand } from '../BaseCommand';
|
|
6
|
-
import { Dashboard } from '../debug/Dashboard';
|
|
7
|
-
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
5
|
+
import { BaseCommand } from '../BaseCommand.js';
|
|
6
|
+
import { Dashboard } from '../debug/Dashboard.js';
|
|
7
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
8
8
|
const addOptions = (command) => {
|
|
9
9
|
command
|
|
10
10
|
.option('--port <number>', 'Debug server port', '3000')
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Fix Command - Automated Code Cleanup
|
|
3
3
|
* Runs ESLint fix and other automated tools
|
|
4
4
|
*/
|
|
5
|
-
import { appConfig } from '../../config';
|
|
6
|
-
import { BaseCommand } from '../BaseCommand';
|
|
7
|
-
import { resolveNpmPath } from '../../common/index';
|
|
8
|
-
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
9
|
-
import { execFileSync } from '../../node-singletons/child-process';
|
|
5
|
+
import { appConfig } from '../../config/index.js';
|
|
6
|
+
import { BaseCommand } from '../BaseCommand.js';
|
|
7
|
+
import { resolveNpmPath } from '../../common/index.js';
|
|
8
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
9
|
+
import { execFileSync } from '../../node-singletons/child-process.js';
|
|
10
10
|
const runNpmScript = (cmd, args) => {
|
|
11
11
|
const npmPath = resolveNpmPath();
|
|
12
12
|
cmd.debug(`Executing: npm run ${args.join(' ')}`);
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Key Generate Command
|
|
3
3
|
* Generates and sets the application key
|
|
4
4
|
*/
|
|
5
|
-
import { BaseCommand } from '../BaseCommand';
|
|
6
|
-
import { Logger } from '../../config/logger';
|
|
7
|
-
import * as crypto from '../../node-singletons/crypto';
|
|
8
|
-
import { fsPromises as fs } from '../../node-singletons/fs';
|
|
9
|
-
import * as path from '../../node-singletons/path';
|
|
5
|
+
import { BaseCommand } from '../BaseCommand.js';
|
|
6
|
+
import { Logger } from '../../config/logger.js';
|
|
7
|
+
import * as crypto from '../../node-singletons/crypto.js';
|
|
8
|
+
import { fsPromises as fs } from '../../node-singletons/fs.js';
|
|
9
|
+
import * as path from '../../node-singletons/path.js';
|
|
10
10
|
export const KeyGenerateCommand = Object.freeze({
|
|
11
11
|
create() {
|
|
12
12
|
return BaseCommand.create({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseCommand } from '../BaseCommand';
|
|
2
|
-
import { cleanLogsOnce } from '../../config/logger';
|
|
1
|
+
import { BaseCommand } from '../BaseCommand.js';
|
|
2
|
+
import { cleanLogsOnce } from '../../config/logger.js';
|
|
3
3
|
export const LogsCleanupCommand = Object.freeze({
|
|
4
4
|
create() {
|
|
5
5
|
// Create the command first, then assign the execute implementation so we can
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* LogsCommand - CLI command for viewing and managing logs
|
|
3
3
|
* Commands: zin logs, zin logs --follow, zin logs --level error, zin logs --clear
|
|
4
4
|
*/
|
|
5
|
-
import { BaseCommand } from '../BaseCommand';
|
|
6
|
-
import { Logger as FileLogger } from '../logger/Logger';
|
|
7
|
-
import { Logger } from '../../config/logger';
|
|
8
|
-
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
9
|
-
import fs from '../../node-singletons/fs';
|
|
10
|
-
import * as path from '../../node-singletons/path';
|
|
5
|
+
import { BaseCommand } from '../BaseCommand.js';
|
|
6
|
+
import { Logger as FileLogger } from '../logger/Logger.js';
|
|
7
|
+
import { Logger } from '../../config/logger.js';
|
|
8
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
9
|
+
import fs from '../../node-singletons/fs.js';
|
|
10
|
+
import * as path from '../../node-singletons/path.js';
|
|
11
11
|
import chalk from 'chalk';
|
|
12
12
|
const normalizeLogsOptions = (options) => {
|
|
13
13
|
const level = typeof options['level'] === 'string' ? options['level'] : 'info';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MakeMailTemplateCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/MakeMailTemplateCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAA+B,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAgC7E,eAAO,MAAM,uBAAuB;cACxB,YAAY;
|
|
1
|
+
{"version":3,"file":"MakeMailTemplateCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/MakeMailTemplateCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAA+B,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAgC7E,eAAO,MAAM,uBAAuB;cACxB,YAAY;EA6EtB,CAAC;AAEH,eAAe,uBAAuB,CAAC"}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* make:mail-template
|
|
3
3
|
* Scaffolds a mail markdown template into the project.
|
|
4
4
|
*/
|
|
5
|
-
import { BaseCommand } from '../BaseCommand';
|
|
6
|
-
import { ErrorHandler } from '../ErrorHandler';
|
|
7
|
-
import { PromptHelper } from '../PromptHelper';
|
|
8
|
-
import { FileGenerator } from '../scaffolding/FileGenerator';
|
|
9
|
-
import { TemplateGenerator } from '../scaffolding/TemplateGenerator';
|
|
10
|
-
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
11
|
-
import * as path from '../../node-singletons/path';
|
|
5
|
+
import { BaseCommand } from '../BaseCommand.js';
|
|
6
|
+
import { ErrorHandler } from '../ErrorHandler.js';
|
|
7
|
+
import { PromptHelper } from '../PromptHelper.js';
|
|
8
|
+
import { FileGenerator } from '../scaffolding/FileGenerator.js';
|
|
9
|
+
import { TemplateGenerator } from '../scaffolding/TemplateGenerator.js';
|
|
10
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
11
|
+
import * as path from '../../node-singletons/path.js';
|
|
12
12
|
const addOptions = (command) => {
|
|
13
13
|
command.argument('[name]', 'Template name (alphanumeric + hyphens only)');
|
|
14
14
|
command.option('--category <category>', 'auth|transactional|notifications');
|
|
@@ -21,6 +21,7 @@ export const MakeMailTemplateCommand = Object.freeze({
|
|
|
21
21
|
create() {
|
|
22
22
|
return BaseCommand.create({
|
|
23
23
|
name: 'make:mail-template',
|
|
24
|
+
aliases: 'make:mail',
|
|
24
25
|
description: 'Scaffold a mail markdown template into src/mail/markdown',
|
|
25
26
|
addOptions,
|
|
26
27
|
execute: async (options) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MakeNotificationTemplateCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/MakeNotificationTemplateCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAA+B,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAoH7E,eAAO,MAAM,+BAA+B;cAChC,YAAY;
|
|
1
|
+
{"version":3,"file":"MakeNotificationTemplateCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/MakeNotificationTemplateCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAA+B,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAoH7E,eAAO,MAAM,+BAA+B;cAChC,YAAY;EAsCtB,CAAC;AAEH,eAAe,+BAA+B,CAAC"}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* make:notification-template
|
|
3
3
|
* Scaffolds a notification markdown template into the project.
|
|
4
4
|
*/
|
|
5
|
-
import { BaseCommand } from '../BaseCommand';
|
|
6
|
-
import { ErrorHandler } from '../ErrorHandler';
|
|
7
|
-
import { PromptHelper } from '../PromptHelper';
|
|
8
|
-
import { FileGenerator } from '../scaffolding/FileGenerator';
|
|
9
|
-
import { TemplateGenerator } from '../scaffolding/TemplateGenerator';
|
|
10
|
-
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
11
|
-
import * as path from '../../node-singletons/path';
|
|
5
|
+
import { BaseCommand } from '../BaseCommand.js';
|
|
6
|
+
import { ErrorHandler } from '../ErrorHandler.js';
|
|
7
|
+
import { PromptHelper } from '../PromptHelper.js';
|
|
8
|
+
import { FileGenerator } from '../scaffolding/FileGenerator.js';
|
|
9
|
+
import { TemplateGenerator } from '../scaffolding/TemplateGenerator.js';
|
|
10
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
11
|
+
import * as path from '../../node-singletons/path.js';
|
|
12
12
|
import inquirer from 'inquirer';
|
|
13
13
|
const addOptions = (command) => {
|
|
14
14
|
command.argument('[name]', 'Template name (alphanumeric + hyphens only)');
|
|
@@ -82,6 +82,7 @@ export const MakeNotificationTemplateCommand = Object.freeze({
|
|
|
82
82
|
create() {
|
|
83
83
|
return BaseCommand.create({
|
|
84
84
|
name: 'make:notification-template',
|
|
85
|
+
aliases: 'make:notification',
|
|
85
86
|
description: 'Scaffold a notification markdown template into src/notification/markdown',
|
|
86
87
|
addOptions,
|
|
87
88
|
execute: async (options) => {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Migrate Command
|
|
3
3
|
* Run database migrations
|
|
4
4
|
*/
|
|
5
|
-
import { BaseCommand } from '../BaseCommand';
|
|
6
|
-
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
5
|
+
import { BaseCommand } from '../BaseCommand.js';
|
|
6
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
7
7
|
/**
|
|
8
8
|
* Migrate Command Factory
|
|
9
9
|
*/
|