@zintrust/core 0.1.0 → 0.1.2
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 +214 -0
- package/bin/zintrust.d.ts.map +1 -1
- package/bin/zintrust.js +18 -1
- package/package.json +4 -34
- package/public/index.html +535 -0
- package/src/boot/Application.d.ts.map +1 -1
- package/src/boot/Application.js +46 -3
- package/src/boot/Server.d.ts.map +1 -1
- package/src/boot/Server.js +3 -4
- package/src/boot/bootstrap.js +77 -6
- package/src/builder/BundleOptimizer.d.ts.map +1 -1
- package/src/builder/BundleOptimizer.js +25 -29
- package/src/cache/Cache.d.ts.map +1 -1
- package/src/cache/Cache.js +4 -2
- package/src/cache/drivers/KVDriver.d.ts.map +1 -1
- package/src/cache/drivers/KVDriver.js +8 -7
- package/src/cache/drivers/MemoryDriver.d.ts.map +1 -1
- package/src/cache/drivers/MemoryDriver.js +5 -0
- package/src/cache/drivers/RedisDriver.js +1 -1
- package/src/cli/BaseCommand.d.ts +2 -2
- package/src/cli/BaseCommand.d.ts.map +1 -1
- package/src/cli/BaseCommand.js +2 -1
- package/src/cli/CLI.d.ts.map +1 -1
- package/src/cli/CLI.js +22 -18
- package/src/cli/ErrorHandler.d.ts.map +1 -1
- package/src/cli/ErrorHandler.js +2 -4
- package/src/cli/commands/AddCommand.d.ts +81 -0
- package/src/cli/commands/AddCommand.d.ts.map +1 -1
- package/src/cli/commands/AddCommand.js +24 -5
- package/src/cli/commands/ConfigCommand.d.ts.map +1 -1
- package/src/cli/commands/ConfigCommand.js +59 -25
- package/src/cli/commands/D1MigrateCommand.d.ts +4 -0
- package/src/cli/commands/D1MigrateCommand.d.ts.map +1 -1
- package/src/cli/commands/D1MigrateCommand.js +6 -4
- package/src/cli/commands/FixCommand.d.ts.map +1 -1
- package/src/cli/commands/FixCommand.js +3 -15
- package/src/cli/commands/LogsCleanupCommand.d.ts +6 -0
- package/src/cli/commands/LogsCleanupCommand.d.ts.map +1 -0
- package/src/cli/commands/LogsCleanupCommand.js +20 -0
- package/src/cli/commands/LogsCommand.d.ts.map +1 -1
- package/src/cli/commands/LogsCommand.js +4 -6
- package/src/cli/commands/MakeMailTemplateCommand.d.ts +10 -0
- package/src/cli/commands/MakeMailTemplateCommand.d.ts.map +1 -0
- package/src/cli/commands/MakeMailTemplateCommand.js +74 -0
- package/src/cli/commands/MakeNotificationTemplateCommand.d.ts +10 -0
- package/src/cli/commands/MakeNotificationTemplateCommand.d.ts.map +1 -0
- package/src/cli/commands/MakeNotificationTemplateCommand.js +113 -0
- package/src/cli/commands/MigrateCommand.d.ts.map +1 -1
- package/src/cli/commands/MigrateCommand.js +3 -3
- package/src/cli/commands/NewCommand.d.ts +4 -0
- package/src/cli/commands/NewCommand.d.ts.map +1 -1
- package/src/cli/commands/NewCommand.js +34 -19
- package/src/cli/commands/PluginCommand.d.ts.map +1 -1
- package/src/cli/commands/PluginCommand.js +8 -4
- package/src/cli/commands/PrepareCommand.d.ts.map +1 -1
- package/src/cli/commands/PrepareCommand.js +1 -1
- package/src/cli/commands/QACommand.d.ts.map +1 -1
- package/src/cli/commands/QACommand.js +16 -26
- package/src/cli/commands/SecretsCommand.d.ts +16 -0
- package/src/cli/commands/SecretsCommand.d.ts.map +1 -0
- package/src/cli/commands/SecretsCommand.js +91 -0
- package/src/cli/commands/StartCommand.d.ts.map +1 -1
- package/src/cli/commands/StartCommand.js +2 -2
- package/src/cli/commands/TemplatesCommand.d.ts +3 -0
- package/src/cli/commands/TemplatesCommand.d.ts.map +1 -0
- package/src/cli/commands/TemplatesCommand.js +65 -0
- package/src/cli/commands/index.d.ts +5 -0
- package/src/cli/commands/index.d.ts.map +1 -1
- package/src/cli/commands/index.js +5 -0
- package/src/cli/config/ConfigManager.js +1 -1
- package/src/cli/index.d.ts +2 -1
- package/src/cli/index.d.ts.map +1 -1
- package/src/cli/index.js +2 -1
- package/src/cli/scaffolding/ControllerGenerator.d.ts.map +1 -1
- package/src/cli/scaffolding/ControllerGenerator.js +11 -10
- package/src/cli/scaffolding/FeatureScaffolder.js +4 -4
- package/src/cli/scaffolding/FileGenerator.js +1 -1
- package/src/cli/scaffolding/MigrationGenerator.d.ts.map +1 -1
- package/src/cli/scaffolding/MigrationGenerator.js +10 -9
- package/src/cli/scaffolding/ModelGenerator.d.ts.map +1 -1
- package/src/cli/scaffolding/ModelGenerator.js +11 -10
- package/src/cli/scaffolding/ProjectScaffolder.d.ts.map +1 -1
- package/src/cli/scaffolding/ProjectScaffolder.js +61 -11
- package/src/cli/scaffolding/ResponseFactoryGenerator.d.ts.map +1 -1
- package/src/cli/scaffolding/ResponseFactoryGenerator.js +2 -1
- package/src/cli/scaffolding/RouteGenerator.d.ts.map +1 -1
- package/src/cli/scaffolding/RouteGenerator.js +15 -14
- package/src/cli/scaffolding/SeederGenerator.js +1 -1
- package/src/cli/scaffolding/ServiceIntegrationTestGenerator.d.ts.map +1 -1
- package/src/cli/scaffolding/ServiceIntegrationTestGenerator.js +7 -6
- package/src/cli/scaffolding/ServiceRequestFactoryGenerator.d.ts +1 -1
- package/src/cli/scaffolding/ServiceRequestFactoryGenerator.d.ts.map +1 -1
- package/src/cli/scaffolding/ServiceRequestFactoryGenerator.js +2 -2
- package/src/cli/scaffolding/ServiceScaffolder.d.ts.map +1 -1
- package/src/cli/scaffolding/ServiceScaffolder.js +13 -12
- package/src/cli/scaffolding/TemplateEngine.d.ts +10 -3
- package/src/cli/scaffolding/TemplateEngine.d.ts.map +1 -1
- package/src/cli/scaffolding/TemplateEngine.js +15 -285
- package/src/cli/scaffolding/TemplateGenerator.d.ts +40 -0
- package/src/cli/scaffolding/TemplateGenerator.d.ts.map +1 -0
- package/src/cli/scaffolding/TemplateGenerator.js +172 -0
- package/src/cli/scaffolding/index.d.ts +1 -0
- package/src/cli/scaffolding/index.d.ts.map +1 -1
- package/src/cli/scaffolding/index.js +1 -0
- package/src/cli/utils/spawn.js +1 -1
- package/src/common/AwsSigV4.d.ts +41 -0
- package/src/common/AwsSigV4.d.ts.map +1 -0
- package/src/common/AwsSigV4.js +69 -0
- package/src/common/index.d.ts +39 -0
- package/src/common/index.d.ts.map +1 -1
- package/src/common/index.js +101 -8
- package/src/common/uuid.d.ts +3 -0
- package/src/common/uuid.d.ts.map +1 -0
- package/src/common/uuid.js +30 -0
- package/src/config/FileLogWriter.d.ts +22 -0
- package/src/config/FileLogWriter.d.ts.map +1 -0
- package/src/config/FileLogWriter.js +192 -0
- package/src/config/SecretsManager.d.ts.map +1 -1
- package/src/config/SecretsManager.js +26 -0
- package/src/config/StartupConfigValidator.d.ts +15 -0
- package/src/config/StartupConfigValidator.d.ts.map +1 -0
- package/src/config/StartupConfigValidator.js +86 -0
- package/src/config/app.d.ts +2 -1
- package/src/config/app.d.ts.map +1 -1
- package/src/config/app.js +65 -15
- package/src/config/broadcast.d.ts +47 -0
- package/src/config/broadcast.d.ts.map +1 -0
- package/src/config/broadcast.js +54 -0
- package/src/config/cache.d.ts +13 -17
- package/src/config/cache.d.ts.map +1 -1
- package/src/config/cache.js +9 -11
- package/src/config/cloudflare.d.ts +26 -0
- package/src/config/cloudflare.d.ts.map +1 -0
- package/src/config/cloudflare.js +38 -0
- package/src/config/env.d.ts +6 -0
- package/src/config/env.d.ts.map +1 -1
- package/src/config/env.js +6 -0
- package/src/config/index.d.ts +52 -28
- package/src/config/index.d.ts.map +1 -1
- package/src/config/index.js +3 -0
- package/src/config/logger.d.ts +2 -0
- package/src/config/logger.d.ts.map +1 -1
- package/src/config/logger.js +270 -11
- package/src/config/logging/HttpLogger.d.ts +23 -0
- package/src/config/logging/HttpLogger.d.ts.map +1 -0
- package/src/config/logging/HttpLogger.js +93 -0
- package/src/config/logging/KvLogger.d.ts +22 -0
- package/src/config/logging/KvLogger.d.ts.map +1 -0
- package/src/config/logging/KvLogger.js +143 -0
- package/src/config/logging/SlackLogger.d.ts +23 -0
- package/src/config/logging/SlackLogger.d.ts.map +1 -0
- package/src/config/logging/SlackLogger.js +119 -0
- package/src/config/mail.d.ts +81 -0
- package/src/config/mail.d.ts.map +1 -0
- package/src/config/mail.js +73 -0
- package/src/config/middleware.d.ts +8 -0
- package/src/config/middleware.d.ts.map +1 -0
- package/src/config/middleware.js +18 -0
- package/src/config/notification.d.ts +62 -0
- package/src/config/notification.d.ts.map +1 -0
- package/src/config/notification.js +43 -0
- package/src/config/security.d.ts.map +1 -1
- package/src/config/security.js +2 -2
- package/src/config/startup.d.ts +23 -0
- package/src/config/startup.d.ts.map +1 -0
- package/src/config/startup.js +15 -0
- package/src/config/storage.d.ts +21 -35
- package/src/config/storage.d.ts.map +1 -1
- package/src/config/storage.js +57 -37
- package/src/database/migrations/index.d.ts +1 -1
- package/src/database/migrations/index.d.ts.map +1 -1
- package/src/database/migrations/index.js +2 -1
- package/src/features/Queue.js +1 -25
- package/src/functions/lambda.d.ts.map +1 -1
- package/src/functions/lambda.js +6 -1
- package/src/health/RuntimeHealthProbes.d.ts +13 -0
- package/src/health/RuntimeHealthProbes.d.ts.map +1 -0
- package/src/health/RuntimeHealthProbes.js +62 -0
- package/src/health/StartupHealthChecks.d.ts +26 -0
- package/src/health/StartupHealthChecks.d.ts.map +1 -0
- package/src/health/StartupHealthChecks.js +124 -0
- package/src/http/ErrorResponse.d.ts +28 -0
- package/src/http/ErrorResponse.d.ts.map +1 -0
- package/src/http/ErrorResponse.js +42 -0
- package/src/http/Kernel.d.ts +5 -0
- package/src/http/Kernel.d.ts.map +1 -1
- package/src/http/Kernel.js +96 -30
- package/src/http/Request.d.ts +1 -1
- package/src/http/Request.d.ts.map +1 -1
- package/src/http/RequestContext.d.ts +20 -0
- package/src/http/RequestContext.d.ts.map +1 -0
- package/src/http/RequestContext.js +77 -0
- package/src/index.d.ts +9 -1
- package/src/index.d.ts.map +1 -1
- package/src/index.js +8 -2
- package/src/microservices/MicroserviceBootstrap.d.ts.map +1 -1
- package/src/microservices/MicroserviceBootstrap.js +6 -5
- package/src/microservices/MicroserviceManager.d.ts.map +1 -1
- package/src/microservices/MicroserviceManager.js +7 -5
- package/src/microservices/PostgresAdapter.d.ts.map +1 -1
- package/src/microservices/PostgresAdapter.js +7 -4
- package/src/microservices/ServiceBundler.d.ts.map +1 -1
- package/src/microservices/ServiceBundler.js +3 -1
- package/src/microservices/ServiceHealthMonitor.d.ts.map +1 -1
- package/src/microservices/ServiceHealthMonitor.js +7 -3
- package/src/middleware/CsrfMiddleware.d.ts.map +1 -1
- package/src/middleware/CsrfMiddleware.js +2 -19
- package/src/middleware/ErrorHandlerMiddleware.d.ts +6 -0
- package/src/middleware/ErrorHandlerMiddleware.d.ts.map +1 -0
- package/src/middleware/ErrorHandlerMiddleware.js +33 -0
- package/src/middleware/LoggingMiddleware.d.ts +9 -0
- package/src/middleware/LoggingMiddleware.d.ts.map +1 -0
- package/src/middleware/LoggingMiddleware.js +36 -0
- package/src/middleware/index.d.ts +2 -0
- package/src/middleware/index.d.ts.map +1 -1
- package/src/middleware/index.js +2 -0
- package/src/node-singletons/async_hooks.d.ts +9 -0
- package/src/node-singletons/async_hooks.d.ts.map +1 -0
- package/src/node-singletons/async_hooks.js +8 -0
- package/src/node-singletons/fs.d.ts +2 -2
- package/src/node-singletons/fs.d.ts.map +1 -1
- package/src/node-singletons/fs.js +2 -2
- package/src/node-singletons/http.d.ts +1 -1
- package/src/node-singletons/http.d.ts.map +1 -1
- package/src/node-singletons/http.js +1 -1
- package/src/node-singletons/index.d.ts +4 -0
- package/src/node-singletons/index.d.ts.map +1 -1
- package/src/node-singletons/index.js +4 -0
- package/src/node-singletons/net.d.ts +9 -0
- package/src/node-singletons/net.d.ts.map +1 -0
- package/src/node-singletons/net.js +8 -0
- package/src/node-singletons/os.d.ts +3 -3
- package/src/node-singletons/os.d.ts.map +1 -1
- package/src/node-singletons/os.js +3 -4
- package/src/node-singletons/path.d.ts +3 -1
- package/src/node-singletons/path.d.ts.map +1 -1
- package/src/node-singletons/path.js +3 -1
- package/src/node-singletons/perf-hooks.d.ts +3 -1
- package/src/node-singletons/perf-hooks.d.ts.map +1 -1
- package/src/node-singletons/perf-hooks.js +3 -1
- package/src/node-singletons/process.d.ts +23 -0
- package/src/node-singletons/process.d.ts.map +1 -0
- package/src/node-singletons/process.js +8 -0
- package/src/node-singletons/readline.d.ts +3 -3
- package/src/node-singletons/readline.d.ts.map +1 -1
- package/src/node-singletons/readline.js +3 -4
- package/src/node-singletons/tls.d.ts +9 -0
- package/src/node-singletons/tls.d.ts.map +1 -0
- package/src/node-singletons/tls.js +8 -0
- package/src/node-singletons/url.d.ts +3 -1
- package/src/node-singletons/url.d.ts.map +1 -1
- package/src/node-singletons/url.js +3 -1
- package/src/orm/ConnectionManager.d.ts +6 -1
- package/src/orm/ConnectionManager.d.ts.map +1 -1
- package/src/orm/ConnectionManager.js +14 -0
- package/src/orm/DatabaseAdapter.d.ts +6 -0
- package/src/orm/DatabaseAdapter.d.ts.map +1 -1
- package/src/orm/QueryBuilder.d.ts +8 -1
- package/src/orm/QueryBuilder.d.ts.map +1 -1
- package/src/orm/QueryBuilder.js +188 -28
- package/src/orm/adapters/D1Adapter.d.ts.map +1 -1
- package/src/orm/adapters/D1Adapter.js +18 -12
- package/src/orm/adapters/MySQLAdapter.d.ts.map +1 -1
- package/src/orm/adapters/MySQLAdapter.js +4 -0
- package/src/orm/adapters/PostgreSQLAdapter.d.ts.map +1 -1
- package/src/orm/adapters/PostgreSQLAdapter.js +4 -0
- package/src/orm/adapters/SQLServerAdapter.d.ts.map +1 -1
- package/src/orm/adapters/SQLServerAdapter.js +4 -0
- package/src/orm/adapters/SQLiteAdapter.d.ts.map +1 -1
- package/src/orm/adapters/SQLiteAdapter.js +4 -0
- package/src/performance/Benchmark.d.ts.map +1 -1
- package/src/performance/Benchmark.js +3 -0
- package/src/performance/CodeGenerationBenchmark.js +3 -3
- package/src/performance/Optimizer.d.ts +1 -1
- package/src/performance/Optimizer.d.ts.map +1 -1
- package/src/performance/Optimizer.js +157 -80
- package/src/performance/establish-baseline.js +3 -3
- package/src/runtime/PluginManager.d.ts +3 -1
- package/src/runtime/PluginManager.d.ts.map +1 -1
- package/src/runtime/PluginManager.js +124 -28
- package/src/runtime/RuntimeDetector.d.ts.map +1 -1
- package/src/runtime/RuntimeDetector.js +47 -5
- package/src/runtime/adapters/CloudflareAdapter.js +2 -2
- package/src/runtime/adapters/DenoAdapter.js +9 -7
- package/src/runtime/adapters/FargateAdapter.d.ts.map +1 -1
- package/src/runtime/adapters/FargateAdapter.js +4 -3
- package/src/runtime/adapters/LambdaAdapter.d.ts.map +1 -1
- package/src/runtime/adapters/LambdaAdapter.js +4 -2
- package/src/runtime/adapters/NodeServerAdapter.d.ts.map +1 -1
- package/src/runtime/adapters/NodeServerAdapter.js +7 -6
- package/src/scheduler/ScheduleRunner.d.ts +18 -0
- package/src/scheduler/ScheduleRunner.d.ts.map +1 -0
- package/src/scheduler/ScheduleRunner.js +155 -0
- package/src/scheduler/index.d.ts +3 -0
- package/src/scheduler/index.d.ts.map +1 -0
- package/src/scheduler/index.js +1 -0
- package/src/scheduler/types.d.ts +16 -0
- package/src/scheduler/types.d.ts.map +1 -0
- package/src/scheduler/types.js +4 -0
- package/src/schedules/index.d.ts +2 -0
- package/src/schedules/index.d.ts.map +1 -0
- package/src/schedules/index.js +1 -0
- package/src/schedules/log-cleanup.d.ts +4 -0
- package/src/schedules/log-cleanup.d.ts.map +1 -0
- package/src/schedules/log-cleanup.js +18 -0
- package/src/scripts/GenerateEnvArtifacts.d.ts +13 -0
- package/src/scripts/GenerateEnvArtifacts.d.ts.map +1 -0
- package/src/scripts/GenerateEnvArtifacts.js +171 -0
- package/src/scripts/TemplateSync.js +109 -70
- package/src/security/CsrfTokenManager.js +1 -1
- package/src/security/Encryptor.js +1 -1
- package/src/security/Hash.d.ts +14 -0
- package/src/security/Hash.d.ts.map +1 -0
- package/src/security/Hash.js +81 -0
- package/src/security/StartupSecretValidation.d.ts +20 -0
- package/src/security/StartupSecretValidation.d.ts.map +1 -0
- package/src/security/StartupSecretValidation.js +61 -0
- package/src/security/UrlValidator.d.ts +0 -1
- package/src/security/UrlValidator.d.ts.map +1 -1
- package/src/security/UrlValidator.js +1 -2
- package/src/security/Xss.d.ts +14 -0
- package/src/security/Xss.d.ts.map +1 -0
- package/src/security/Xss.js +57 -0
- package/src/security/XssProtection.d.ts.map +1 -1
- package/src/security/XssProtection.js +150 -16
- package/src/templates/adapters/MySQLAdapter.ts.tpl +5 -0
- package/src/templates/adapters/PostgreSQLAdapter.ts.tpl +5 -0
- package/src/templates/adapters/SQLServerAdapter.ts.tpl +5 -0
- package/src/templates/adapters/SQLiteAdapter.ts.tpl +5 -0
- package/src/templates/features/Queue.ts.tpl +1 -29
- package/src/templates/project/basic/.env.example.tpl +48 -0
- package/src/templates/project/basic/.env.tpl +89 -94
- package/src/templates/project/basic/app/Toolkit/Broadcast/sendBroadcast.ts.tpl +7 -0
- package/src/templates/project/basic/app/Toolkit/Mail/sendWelcomeEmail.ts.tpl +30 -0
- package/src/templates/project/basic/app/Toolkit/Notification/sendSlackNotification.ts.tpl +10 -0
- package/src/templates/project/basic/app/Toolkit/Notification/sendSms.ts.tpl +13 -0
- package/src/templates/project/basic/config/FileLogWriter.ts.tpl +240 -0
- package/src/templates/project/basic/config/SecretsManager.ts.tpl +32 -1
- package/src/templates/project/basic/config/StartupConfigValidator.ts.tpl +151 -0
- package/src/templates/project/basic/config/app.ts.tpl +84 -15
- package/src/templates/project/basic/config/broadcast.ts.tpl +97 -0
- package/src/templates/project/basic/config/cache.ts.tpl +19 -23
- package/src/templates/project/basic/config/cloudflare.ts.tpl +57 -0
- package/src/templates/project/basic/config/env.ts.tpl +7 -1
- package/src/templates/project/basic/config/index.ts.tpl +3 -0
- package/src/templates/project/basic/config/logger.ts.tpl +301 -11
- package/src/templates/project/basic/config/logging/HttpLogger.ts.tpl +121 -0
- package/src/templates/project/basic/config/logging/KvLogger.ts.tpl +181 -0
- package/src/templates/project/basic/config/logging/SlackLogger.ts.tpl +156 -0
- package/src/templates/project/basic/config/mail.ts.tpl +141 -0
- package/src/templates/project/basic/config/middleware.ts.tpl +27 -0
- package/src/templates/project/basic/config/notification.ts.tpl +86 -0
- package/src/templates/project/basic/config/security.ts.tpl +4 -5
- package/src/templates/project/basic/config/startup.ts.tpl +27 -0
- package/src/templates/project/basic/config/storage.ts.tpl +77 -42
- package/src/templates/project/basic/database/migrations/index.ts.tpl +1 -1
- package/src/templates/project/basic/package.json.tpl +1 -1
- package/src/templates/project/basic/routes/api.ts.tpl +9 -37
- package/src/templates/project/basic/routes/broadcast.ts.tpl +32 -0
- package/src/templates/project/basic/routes/health.ts.tpl +134 -0
- package/src/templates/project/basic/src/index.ts.tpl +38 -11
- package/src/templates/project/basic/template.json +3 -0
- package/src/toolkit/Secrets/EnvFile.d.ts +15 -0
- package/src/toolkit/Secrets/EnvFile.d.ts.map +1 -0
- package/src/toolkit/Secrets/EnvFile.js +63 -0
- package/src/toolkit/Secrets/Manifest.d.ts +24 -0
- package/src/toolkit/Secrets/Manifest.d.ts.map +1 -0
- package/src/toolkit/Secrets/Manifest.js +71 -0
- package/src/toolkit/Secrets/index.d.ts +42 -0
- package/src/toolkit/Secrets/index.d.ts.map +1 -0
- package/src/toolkit/Secrets/index.js +119 -0
- package/src/toolkit/Secrets/providers/AwsSecretsManager.d.ts +14 -0
- package/src/toolkit/Secrets/providers/AwsSecretsManager.d.ts.map +1 -0
- package/src/toolkit/Secrets/providers/AwsSecretsManager.js +131 -0
- package/src/toolkit/Secrets/providers/CloudflareKv.d.ts +9 -0
- package/src/toolkit/Secrets/providers/CloudflareKv.d.ts.map +1 -0
- package/src/toolkit/Secrets/providers/CloudflareKv.js +73 -0
- package/src/tools/broadcast/Broadcast.d.ts +7 -0
- package/src/tools/broadcast/Broadcast.d.ts.map +1 -0
- package/src/tools/broadcast/Broadcast.js +37 -0
- package/src/tools/broadcast/drivers/BaseDriver.d.ts +5 -0
- package/src/tools/broadcast/drivers/BaseDriver.d.ts.map +1 -0
- package/src/tools/broadcast/drivers/BaseDriver.js +8 -0
- package/src/tools/broadcast/drivers/InMemory.d.ts +18 -0
- package/src/tools/broadcast/drivers/InMemory.d.ts.map +1 -0
- package/src/tools/broadcast/drivers/InMemory.js +16 -0
- package/src/tools/broadcast/drivers/Pusher.d.ts +8 -0
- package/src/tools/broadcast/drivers/Pusher.d.ts.map +1 -0
- package/src/tools/broadcast/drivers/Pusher.js +75 -0
- package/src/tools/broadcast/drivers/Redis.d.ts +19 -0
- package/src/tools/broadcast/drivers/Redis.d.ts.map +1 -0
- package/src/tools/broadcast/drivers/Redis.js +73 -0
- package/src/tools/broadcast/drivers/RedisHttps.d.ts +14 -0
- package/src/tools/broadcast/drivers/RedisHttps.d.ts.map +1 -0
- package/src/tools/broadcast/drivers/RedisHttps.js +50 -0
- package/src/tools/broadcast/index.d.ts +7 -0
- package/src/tools/broadcast/index.d.ts.map +1 -0
- package/src/tools/broadcast/index.js +6 -0
- package/src/tools/http/Http.d.ts +51 -0
- package/src/tools/http/Http.d.ts.map +1 -0
- package/src/tools/http/Http.js +171 -0
- package/src/tools/http/HttpResponse.d.ts +32 -0
- package/src/tools/http/HttpResponse.d.ts.map +1 -0
- package/src/tools/http/HttpResponse.js +80 -0
- package/src/tools/http/index.d.ts +15 -0
- package/src/tools/http/index.d.ts.map +1 -0
- package/src/tools/http/index.js +9 -0
- package/src/tools/mail/Mail.d.ts +22 -0
- package/src/tools/mail/Mail.d.ts.map +1 -0
- package/src/tools/mail/Mail.js +105 -0
- package/src/tools/mail/attachments.d.ts +23 -0
- package/src/tools/mail/attachments.d.ts.map +1 -0
- package/src/tools/mail/attachments.js +26 -0
- package/src/tools/mail/drivers/BaseDriver.d.ts +5 -0
- package/src/tools/mail/drivers/BaseDriver.d.ts.map +1 -0
- package/src/tools/mail/drivers/BaseDriver.js +8 -0
- package/src/tools/mail/drivers/Mailgun.d.ts +31 -0
- package/src/tools/mail/drivers/Mailgun.d.ts.map +1 -0
- package/src/tools/mail/drivers/Mailgun.js +81 -0
- package/src/tools/mail/drivers/SendGrid.d.ts +29 -0
- package/src/tools/mail/drivers/SendGrid.d.ts.map +1 -0
- package/src/tools/mail/drivers/SendGrid.js +57 -0
- package/src/tools/mail/drivers/Ses.d.ts +24 -0
- package/src/tools/mail/drivers/Ses.d.ts.map +1 -0
- package/src/tools/mail/drivers/Ses.js +116 -0
- package/src/tools/mail/drivers/Smtp.d.ts +38 -0
- package/src/tools/mail/drivers/Smtp.d.ts.map +1 -0
- package/src/tools/mail/drivers/Smtp.js +327 -0
- package/src/tools/mail/templates/index.d.ts +27 -0
- package/src/tools/mail/templates/index.d.ts.map +1 -0
- package/src/tools/mail/templates/index.js +35 -0
- package/src/tools/mail/templates/markdown/index.d.ts +17 -0
- package/src/tools/mail/templates/markdown/index.d.ts.map +1 -0
- package/src/tools/mail/templates/markdown/index.js +49 -0
- package/src/tools/mail/templates/markdown/registry.d.ts +15 -0
- package/src/tools/mail/templates/markdown/registry.d.ts.map +1 -0
- package/src/tools/mail/templates/markdown/registry.js +34 -0
- package/src/tools/mail/templates/markdown/validator.d.ts +16 -0
- package/src/tools/mail/templates/markdown/validator.d.ts.map +1 -0
- package/src/tools/mail/templates/markdown/validator.js +24 -0
- package/src/tools/mail/testing.d.ts +41 -0
- package/src/tools/mail/testing.d.ts.map +1 -0
- package/src/tools/mail/testing.js +34 -0
- package/src/tools/notification/Driver.d.ts +11 -0
- package/src/tools/notification/Driver.d.ts.map +1 -0
- package/src/tools/notification/Driver.js +1 -0
- package/src/tools/notification/Notification.d.ts +11 -0
- package/src/tools/notification/Notification.d.ts.map +1 -0
- package/src/tools/notification/Notification.js +11 -0
- package/src/tools/notification/Registry.d.ts +10 -0
- package/src/tools/notification/Registry.d.ts.map +1 -0
- package/src/tools/notification/Registry.js +22 -0
- package/src/tools/notification/Service.d.ts +6 -0
- package/src/tools/notification/Service.d.ts.map +1 -0
- package/src/tools/notification/Service.js +18 -0
- package/src/tools/notification/config.d.ts +5 -0
- package/src/tools/notification/config.d.ts.map +1 -0
- package/src/tools/notification/config.js +5 -0
- package/src/tools/notification/drivers/BaseDriver.d.ts +5 -0
- package/src/tools/notification/drivers/BaseDriver.d.ts.map +1 -0
- package/src/tools/notification/drivers/BaseDriver.js +8 -0
- package/src/tools/notification/drivers/Console.d.ts +7 -0
- package/src/tools/notification/drivers/Console.d.ts.map +1 -0
- package/src/tools/notification/drivers/Console.js +13 -0
- package/src/tools/notification/drivers/Slack.d.ts +16 -0
- package/src/tools/notification/drivers/Slack.d.ts.map +1 -0
- package/src/tools/notification/drivers/Slack.js +24 -0
- package/src/tools/notification/drivers/Termii.d.ts +10 -0
- package/src/tools/notification/drivers/Termii.d.ts.map +1 -0
- package/src/tools/notification/drivers/Termii.js +47 -0
- package/src/tools/notification/drivers/Twilio.d.ts +21 -0
- package/src/tools/notification/drivers/Twilio.d.ts.map +1 -0
- package/src/tools/notification/drivers/Twilio.js +48 -0
- package/src/tools/notification/templates/markdown/index.d.ts +15 -0
- package/src/tools/notification/templates/markdown/index.d.ts.map +1 -0
- package/src/tools/notification/templates/markdown/index.js +38 -0
- package/src/tools/notification/templates/markdown/registry.d.ts +15 -0
- package/src/tools/notification/templates/markdown/registry.d.ts.map +1 -0
- package/src/tools/notification/templates/markdown/registry.js +36 -0
- package/src/tools/notification/testing.d.ts +19 -0
- package/src/tools/notification/testing.d.ts.map +1 -0
- package/src/tools/notification/testing.js +35 -0
- package/src/tools/notification/testingHelpers.d.ts +12 -0
- package/src/tools/notification/testingHelpers.d.ts.map +1 -0
- package/src/tools/notification/testingHelpers.js +32 -0
- package/src/tools/queue/Queue.d.ts +23 -0
- package/src/tools/queue/Queue.d.ts.map +1 -0
- package/src/tools/queue/Queue.js +38 -0
- package/src/tools/queue/drivers/InMemory.d.ts +10 -0
- package/src/tools/queue/drivers/InMemory.d.ts.map +1 -0
- package/src/tools/queue/drivers/InMemory.js +55 -0
- package/src/tools/queue/drivers/Redis.d.ts +10 -0
- package/src/tools/queue/drivers/Redis.d.ts.map +1 -0
- package/src/tools/queue/drivers/Redis.js +91 -0
- package/src/tools/storage/drivers/Gcs.d.ts +20 -0
- package/src/tools/storage/drivers/Gcs.d.ts.map +1 -0
- package/src/tools/storage/drivers/Gcs.js +152 -0
- package/src/tools/storage/drivers/Local.d.ts +17 -0
- package/src/tools/storage/drivers/Local.d.ts.map +1 -0
- package/src/tools/storage/drivers/Local.js +63 -0
- package/src/tools/storage/drivers/R2.d.ts +20 -0
- package/src/tools/storage/drivers/R2.d.ts.map +1 -0
- package/src/tools/storage/drivers/R2.js +73 -0
- package/src/tools/storage/drivers/S3.d.ts +26 -0
- package/src/tools/storage/drivers/S3.d.ts.map +1 -0
- package/src/tools/storage/drivers/S3.js +258 -0
- package/src/tools/storage/index.d.ts +24 -0
- package/src/tools/storage/index.d.ts.map +1 -0
- package/src/tools/storage/index.js +112 -0
- package/src/tools/storage/testing.d.ts +23 -0
- package/src/tools/storage/testing.d.ts.map +1 -0
- package/src/tools/storage/testing.js +52 -0
- package/src/tools/templates/MarkdownRenderer.d.ts +14 -0
- package/src/tools/templates/MarkdownRenderer.d.ts.map +1 -0
- package/src/tools/templates/MarkdownRenderer.js +300 -0
- package/src/tools/templates/index.d.ts +5 -0
- package/src/tools/templates/index.d.ts.map +1 -0
- package/src/tools/templates/index.js +4 -0
package/src/boot/bootstrap.js
CHANGED
|
@@ -8,6 +8,48 @@ import { Server } from './Server';
|
|
|
8
8
|
import { Env } from '../config/env';
|
|
9
9
|
import { Logger } from '../config/logger';
|
|
10
10
|
import { ErrorFactory } from '../exceptions/ZintrustError';
|
|
11
|
+
let appInstance;
|
|
12
|
+
let serverInstance;
|
|
13
|
+
let isShuttingDown = false;
|
|
14
|
+
const withTimeout = async (promise, timeoutMs, label) => {
|
|
15
|
+
if (timeoutMs <= 0)
|
|
16
|
+
return promise;
|
|
17
|
+
let timeoutId;
|
|
18
|
+
try {
|
|
19
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
20
|
+
timeoutId = globalThis.setTimeout(() => {
|
|
21
|
+
reject(ErrorFactory.createGeneralError(label, { timeoutMs }));
|
|
22
|
+
}, timeoutMs);
|
|
23
|
+
});
|
|
24
|
+
return await Promise.race([promise, timeoutPromise]);
|
|
25
|
+
}
|
|
26
|
+
finally {
|
|
27
|
+
if (timeoutId !== undefined)
|
|
28
|
+
globalThis.clearTimeout(timeoutId);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const gracefulShutdown = async (signal) => {
|
|
32
|
+
if (isShuttingDown)
|
|
33
|
+
return;
|
|
34
|
+
isShuttingDown = true;
|
|
35
|
+
const timeoutMs = Number(Env.SHUTDOWN_TIMEOUT);
|
|
36
|
+
Logger.info(`${signal} received, shutting down gracefully...`);
|
|
37
|
+
try {
|
|
38
|
+
await withTimeout((async () => {
|
|
39
|
+
if (serverInstance !== undefined) {
|
|
40
|
+
await serverInstance.close();
|
|
41
|
+
}
|
|
42
|
+
if (appInstance !== undefined) {
|
|
43
|
+
await appInstance.shutdown();
|
|
44
|
+
}
|
|
45
|
+
})(), timeoutMs, 'Graceful shutdown timed out');
|
|
46
|
+
process.exit(0);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
Logger.error('Graceful shutdown failed:', error);
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
11
53
|
/**
|
|
12
54
|
* Bootstrap implementation
|
|
13
55
|
*/
|
|
@@ -19,6 +61,7 @@ const BootstrapFunctions = Object.freeze({
|
|
|
19
61
|
try {
|
|
20
62
|
// Create application instance
|
|
21
63
|
const app = Application.create();
|
|
64
|
+
appInstance = app;
|
|
22
65
|
// Boot application
|
|
23
66
|
await app.boot();
|
|
24
67
|
// Get port and host from environment
|
|
@@ -26,9 +69,39 @@ const BootstrapFunctions = Object.freeze({
|
|
|
26
69
|
const host = Env.get('HOST', 'localhost');
|
|
27
70
|
// Create and start server
|
|
28
71
|
const server = Server.create(app, port, host);
|
|
72
|
+
serverInstance = server;
|
|
29
73
|
// Start listening
|
|
30
74
|
await server.listen();
|
|
31
75
|
Logger.info(`Server running at http://${host}:${port}`);
|
|
76
|
+
// Start schedules for long-running runtimes (Node.js / Fargate)
|
|
77
|
+
try {
|
|
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
|
+
}
|
|
32
105
|
}
|
|
33
106
|
catch (error) {
|
|
34
107
|
Logger.error('Failed to bootstrap application:', error);
|
|
@@ -40,13 +113,11 @@ const BootstrapFunctions = Object.freeze({
|
|
|
40
113
|
* Handle graceful shutdown
|
|
41
114
|
*/
|
|
42
115
|
setupShutdownHandler() {
|
|
43
|
-
process.on('SIGTERM', () => {
|
|
44
|
-
|
|
45
|
-
process.exit(0);
|
|
116
|
+
process.on('SIGTERM', async () => {
|
|
117
|
+
await gracefulShutdown('SIGTERM');
|
|
46
118
|
});
|
|
47
|
-
process.on('SIGINT', () => {
|
|
48
|
-
|
|
49
|
-
process.exit(0);
|
|
119
|
+
process.on('SIGINT', async () => {
|
|
120
|
+
await gracefulShutdown('SIGINT');
|
|
50
121
|
});
|
|
51
122
|
},
|
|
52
123
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BundleOptimizer.d.ts","sourceRoot":"","sources":["../../../src/builder/BundleOptimizer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,QAAQ,GAAG,YAAY,GAAG,MAAM,GAAG,SAAS,CAAC;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,KAAK,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC,CAAC;IACH,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC;CACrC;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe;IAC1B;;OAEG;oBACa,mBAAmB,GAAG,gBAAgB;EA0CtD,CAAC;
|
|
1
|
+
{"version":3,"file":"BundleOptimizer.d.ts","sourceRoot":"","sources":["../../../src/builder/BundleOptimizer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,QAAQ,GAAG,YAAY,GAAG,MAAM,GAAG,SAAS,CAAC;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,KAAK,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC,CAAC;IACH,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC;CACrC;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe;IAC1B;;OAEG;oBACa,mBAAmB,GAAG,gBAAgB;EA0CtD,CAAC;AA4XH;;GAEG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAclD"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { Logger } from '../config/logger';
|
|
10
10
|
import fs from '../node-singletons/fs';
|
|
11
|
-
import * as path from 'node
|
|
11
|
+
import * as path from '../node-singletons/path';
|
|
12
12
|
/**
|
|
13
13
|
* Bundle optimizer - reduces deployed package size
|
|
14
14
|
* Sealed namespace for immutability
|
|
@@ -61,19 +61,15 @@ async function getFilesRecursive(dir) {
|
|
|
61
61
|
if (!fs.existsSync(dir)) {
|
|
62
62
|
return [];
|
|
63
63
|
}
|
|
64
|
-
const files = [];
|
|
65
64
|
const entries = await fs.promises.readdir(dir, { withFileTypes: true });
|
|
66
|
-
|
|
65
|
+
const nested = await Promise.all(entries.map(async (entry) => {
|
|
67
66
|
const fullPath = path.join(dir, entry.name);
|
|
68
67
|
if (entry.isDirectory()) {
|
|
69
|
-
|
|
70
|
-
files.push(...subFiles);
|
|
68
|
+
return getFilesRecursive(fullPath);
|
|
71
69
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
return files;
|
|
70
|
+
return [fullPath];
|
|
71
|
+
}));
|
|
72
|
+
return nested.flat();
|
|
77
73
|
}
|
|
78
74
|
/**
|
|
79
75
|
* Generate optimization recommendations
|
|
@@ -129,17 +125,19 @@ function printAnalysis(analysis) {
|
|
|
129
125
|
*/
|
|
130
126
|
async function analyze(distDir, options) {
|
|
131
127
|
const files = await getFilesRecursive(distDir);
|
|
132
|
-
|
|
128
|
+
// Collect sizes concurrently but avoid shared mutable state by computing sizes
|
|
129
|
+
// and then reducing the total afterwards to avoid race conditions.
|
|
133
130
|
const fileAnalysis = await Promise.all(files.map(async (file) => {
|
|
134
131
|
const stats = await fs.promises.stat(file);
|
|
135
132
|
const size = stats.size;
|
|
136
|
-
totalSize += size;
|
|
137
133
|
return {
|
|
138
134
|
path: path.relative(distDir, file),
|
|
139
135
|
size,
|
|
140
136
|
percentage: 0,
|
|
141
137
|
};
|
|
142
138
|
}));
|
|
139
|
+
// Compute total size in a single pass (no shared mutation)
|
|
140
|
+
const totalSize = fileAnalysis.reduce((acc, f) => acc + f.size, 0);
|
|
143
141
|
// Calculate percentages
|
|
144
142
|
fileAnalysis.forEach((f) => {
|
|
145
143
|
f.percentage = totalSize > 0 ? (f.size / totalSize) * 100 : 0;
|
|
@@ -158,9 +156,9 @@ async function analyze(distDir, options) {
|
|
|
158
156
|
*/
|
|
159
157
|
async function removeUnusedAdapters(distDir, options, ...adapters) {
|
|
160
158
|
const adapterDir = path.join(distDir, 'orm', 'adapters');
|
|
161
|
-
|
|
159
|
+
await Promise.all(adapters.map(async (adapter) => {
|
|
162
160
|
const files = [`${adapter}Adapter.js`, `${adapter}Adapter.d.ts`];
|
|
163
|
-
|
|
161
|
+
await Promise.all(files.map(async (file) => {
|
|
164
162
|
const filePath = path.join(adapterDir, file);
|
|
165
163
|
if (fs.existsSync(filePath)) {
|
|
166
164
|
await fs.promises.unlink(filePath);
|
|
@@ -168,8 +166,8 @@ async function removeUnusedAdapters(distDir, options, ...adapters) {
|
|
|
168
166
|
Logger.info(` ✓ Removed ${adapter} adapter`);
|
|
169
167
|
}
|
|
170
168
|
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
169
|
+
}));
|
|
170
|
+
}));
|
|
173
171
|
}
|
|
174
172
|
/**
|
|
175
173
|
* Remove dev dependencies from node_modules
|
|
@@ -189,7 +187,7 @@ async function removeDevDependencies(distDir, options) {
|
|
|
189
187
|
];
|
|
190
188
|
if (!fs.existsSync(nmDir))
|
|
191
189
|
return;
|
|
192
|
-
|
|
190
|
+
await Promise.all(devDeps.map(async (dep) => {
|
|
193
191
|
const depPath = path.join(nmDir, dep);
|
|
194
192
|
if (fs.existsSync(depPath)) {
|
|
195
193
|
await fs.promises.rm(depPath, { recursive: true });
|
|
@@ -197,11 +195,12 @@ async function removeDevDependencies(distDir, options) {
|
|
|
197
195
|
Logger.info(` ✓ Removed ${dep}`);
|
|
198
196
|
}
|
|
199
197
|
}
|
|
200
|
-
}
|
|
198
|
+
}));
|
|
201
199
|
}
|
|
202
200
|
/**
|
|
203
201
|
* Minify JavaScript files
|
|
204
202
|
*/
|
|
203
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
205
204
|
async function minifyJavaScript(_aggressive = false) {
|
|
206
205
|
Logger.info(' → Minifying JavaScript...');
|
|
207
206
|
// In production, would use esbuild or terser
|
|
@@ -240,7 +239,7 @@ async function removeUnusedMiddleware(distDir, options) {
|
|
|
240
239
|
const optionalMiddleware = ['logging.js', 'profiling.js', 'rateLimit.js'];
|
|
241
240
|
if (!fs.existsSync(middlewareDir))
|
|
242
241
|
return;
|
|
243
|
-
|
|
242
|
+
await Promise.all(optionalMiddleware.map(async (file) => {
|
|
244
243
|
const filePath = path.join(middlewareDir, file);
|
|
245
244
|
if (fs.existsSync(filePath)) {
|
|
246
245
|
await fs.promises.unlink(filePath);
|
|
@@ -248,7 +247,7 @@ async function removeUnusedMiddleware(distDir, options) {
|
|
|
248
247
|
Logger.info(` ✓ Removed middleware: ${file}`);
|
|
249
248
|
}
|
|
250
249
|
}
|
|
251
|
-
}
|
|
250
|
+
}));
|
|
252
251
|
}
|
|
253
252
|
/**
|
|
254
253
|
* Inline small files to reduce overhead
|
|
@@ -262,16 +261,13 @@ function inlineSmallFiles(threshold) {
|
|
|
262
261
|
*/
|
|
263
262
|
async function removeFiles(distDir, options, patterns) {
|
|
264
263
|
const files = await getFilesRecursive(distDir);
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
Logger.info(` ✓ Removed ${path.relative(distDir, file)}`);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
264
|
+
const filesToRemove = files.filter((file) => patterns.some((pattern) => file.includes(pattern)));
|
|
265
|
+
await Promise.all(filesToRemove.map(async (file) => {
|
|
266
|
+
await fs.promises.unlink(file);
|
|
267
|
+
if (options.verbose === true) {
|
|
268
|
+
Logger.info(` ✓ Removed ${path.relative(distDir, file)}`);
|
|
273
269
|
}
|
|
274
|
-
}
|
|
270
|
+
}));
|
|
275
271
|
}
|
|
276
272
|
/**
|
|
277
273
|
* Optimize for AWS Lambda (2-3 MB limit for direct upload)
|
package/src/cache/Cache.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cache.d.ts","sourceRoot":"","sources":["../../../src/cache/Cache.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"Cache.d.ts","sourceRoot":"","sources":["../../../src/cache/Cache.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AA+FjD,eAAO,MAAM,KAAK;UA1CC,CAAC,OAAO,MAAM,KAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;UAQlC,CAAC,OAAO,MAAM,SAAS,CAAC,QAAQ,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;kBAOjD,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;iBAOtB,OAAO,CAAC,IAAI,CAAC;eAOb,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;qBAQ3B,WAAW;EAY/B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,KAAK;UAtDC,CAAC,OAAO,MAAM,KAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;UAQlC,CAAC,OAAO,MAAM,SAAS,CAAC,QAAQ,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;kBAOjD,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;iBAOtB,OAAO,CAAC,IAAI,CAAC;eAOb,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;qBAQ3B,WAAW;EAiBP,CAAC"}
|
package/src/cache/Cache.js
CHANGED
|
@@ -42,7 +42,8 @@ function getDriverInstance() {
|
|
|
42
42
|
* Get an item from the cache
|
|
43
43
|
*/
|
|
44
44
|
const get = async (key) => {
|
|
45
|
-
|
|
45
|
+
const value = await getDriverInstance().get(key);
|
|
46
|
+
return value;
|
|
46
47
|
};
|
|
47
48
|
/**
|
|
48
49
|
* Store an item in the cache
|
|
@@ -66,7 +67,8 @@ const clear = async () => {
|
|
|
66
67
|
* Check if an item exists in the cache
|
|
67
68
|
*/
|
|
68
69
|
const has = async (key) => {
|
|
69
|
-
|
|
70
|
+
const exists = await getDriverInstance().has(key);
|
|
71
|
+
return exists;
|
|
70
72
|
};
|
|
71
73
|
/**
|
|
72
74
|
* Get the underlying driver instance
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KVDriver.d.ts","sourceRoot":"","sources":["../../../../src/cache/drivers/KVDriver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"KVDriver.d.ts","sourceRoot":"","sources":["../../../../src/cache/drivers/KVDriver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAoDjD;;GAEG;AACH,eAAO,MAAM,QAAQ;kBAhDF,WAAW;EAkD5B,CAAC"}
|
|
@@ -2,23 +2,23 @@
|
|
|
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';
|
|
5
6
|
import { Logger } from '../../config/logger';
|
|
6
7
|
/**
|
|
7
8
|
* Create a new KV driver instance
|
|
8
9
|
*/
|
|
9
10
|
const create = () => {
|
|
10
11
|
// In Cloudflare Workers, the KV namespace is usually bound to a variable in the environment
|
|
11
|
-
const
|
|
12
|
-
const kv = env === undefined ? undefined : env['CACHE'];
|
|
12
|
+
const kv = Cloudflare.getKVBinding('CACHE');
|
|
13
13
|
return {
|
|
14
14
|
async get(key) {
|
|
15
|
-
if (kv ===
|
|
15
|
+
if (kv === null)
|
|
16
16
|
return null;
|
|
17
17
|
const value = await kv.get(key, { type: 'json' });
|
|
18
|
-
return value;
|
|
18
|
+
return value ?? null;
|
|
19
19
|
},
|
|
20
20
|
async set(key, value, ttl) {
|
|
21
|
-
if (kv ===
|
|
21
|
+
if (kv === null) {
|
|
22
22
|
Logger.warn('KV binding "CACHE" not found. Cache set ignored.');
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
@@ -30,16 +30,17 @@ const create = () => {
|
|
|
30
30
|
await kv.put(key, JSON.stringify(value), options);
|
|
31
31
|
},
|
|
32
32
|
async delete(key) {
|
|
33
|
-
if (kv ===
|
|
33
|
+
if (kv === null)
|
|
34
34
|
return;
|
|
35
35
|
await kv.delete(key);
|
|
36
36
|
},
|
|
37
37
|
async clear() {
|
|
38
38
|
// KV doesn't support clearing all keys easily without listing and deleting
|
|
39
39
|
Logger.warn('KV clear() is not implemented due to Cloudflare KV limitations.');
|
|
40
|
+
await Promise.resolve();
|
|
40
41
|
},
|
|
41
42
|
async has(key) {
|
|
42
|
-
if (kv ===
|
|
43
|
+
if (kv === null)
|
|
43
44
|
return false;
|
|
44
45
|
const value = await kv.get(key);
|
|
45
46
|
return value !== null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryDriver.d.ts","sourceRoot":"","sources":["../../../../src/cache/drivers/MemoryDriver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"MemoryDriver.d.ts","sourceRoot":"","sources":["../../../../src/cache/drivers/MemoryDriver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAuDjD;;GAEG;AACH,eAAO,MAAM,YAAY;kBAnDN,WAAW;EAqD5B,CAAC"}
|
|
@@ -11,6 +11,7 @@ const create = () => {
|
|
|
11
11
|
const storage = new Map();
|
|
12
12
|
return {
|
|
13
13
|
async get(key) {
|
|
14
|
+
await Promise.resolve();
|
|
14
15
|
const item = storage.get(key);
|
|
15
16
|
if (item === undefined)
|
|
16
17
|
return null;
|
|
@@ -23,14 +24,18 @@ const create = () => {
|
|
|
23
24
|
async set(key, value, ttl) {
|
|
24
25
|
const expires = ttl === undefined ? null : Date.now() + ttl * 1000;
|
|
25
26
|
storage.set(key, { value, expires });
|
|
27
|
+
await Promise.resolve();
|
|
26
28
|
},
|
|
27
29
|
async delete(key) {
|
|
28
30
|
storage.delete(key);
|
|
31
|
+
await Promise.resolve();
|
|
29
32
|
},
|
|
30
33
|
async clear() {
|
|
31
34
|
storage.clear();
|
|
35
|
+
await Promise.resolve();
|
|
32
36
|
},
|
|
33
37
|
async has(key) {
|
|
38
|
+
await Promise.resolve();
|
|
34
39
|
const item = storage.get(key);
|
|
35
40
|
if (item === undefined)
|
|
36
41
|
return false;
|
package/src/cli/BaseCommand.d.ts
CHANGED
|
@@ -29,11 +29,11 @@ export declare const BaseCommand: Readonly<{
|
|
|
29
29
|
/**
|
|
30
30
|
* Create a command instance with common logic
|
|
31
31
|
*/
|
|
32
|
-
create(config: {
|
|
32
|
+
create<T extends IBaseCommand = IBaseCommand>(config: {
|
|
33
33
|
name: string;
|
|
34
34
|
description: string;
|
|
35
35
|
addOptions?: (command: Command) => void;
|
|
36
36
|
execute: (options: CommandOptions) => void | Promise<void>;
|
|
37
|
-
}):
|
|
37
|
+
}): T;
|
|
38
38
|
}>;
|
|
39
39
|
//# sourceMappingURL=BaseCommand.d.ts.map
|
|
@@ -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;
|
|
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;EAiDL,CAAC"}
|
package/src/cli/BaseCommand.js
CHANGED
|
@@ -42,7 +42,7 @@ export const BaseCommand = Object.freeze({
|
|
|
42
42
|
});
|
|
43
43
|
return command;
|
|
44
44
|
};
|
|
45
|
-
|
|
45
|
+
const base = {
|
|
46
46
|
name: config.name,
|
|
47
47
|
description: config.description,
|
|
48
48
|
verbose: false,
|
|
@@ -54,5 +54,6 @@ export const BaseCommand = Object.freeze({
|
|
|
54
54
|
warn: (msg) => ErrorHandler.warn(msg),
|
|
55
55
|
debug: (msg) => ErrorHandler.debug(msg, true),
|
|
56
56
|
};
|
|
57
|
+
return base;
|
|
57
58
|
},
|
|
58
59
|
});
|
package/src/cli/CLI.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CLI.d.ts","sourceRoot":"","sources":["../../../src/cli/CLI.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"CLI.d.ts","sourceRoot":"","sources":["../../../src/cli/CLI.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAyBH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,MAAM,WAAW,IAAI;IACnB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,UAAU,IAAI,OAAO,CAAC;CACvB;AAqLD;;;;;;;GAOG;AACH,eAAO,MAAM,GAAG;cACJ,IAAI;EAed,CAAC"}
|
package/src/cli/CLI.js
CHANGED
|
@@ -8,22 +8,25 @@ import { D1MigrateCommand } from './commands/D1MigrateCommand';
|
|
|
8
8
|
import { DebugCommand } from './commands/DebugCommand';
|
|
9
9
|
import { FixCommand } from './commands/FixCommand';
|
|
10
10
|
import { KeyGenerateCommand } from './commands/KeyGenerateCommand';
|
|
11
|
+
import { MakeMailTemplateCommand } from './commands/MakeMailTemplateCommand';
|
|
12
|
+
import { MakeNotificationTemplateCommand } from './commands/MakeNotificationTemplateCommand';
|
|
11
13
|
import { MigrateCommand } from './commands/MigrateCommand';
|
|
12
14
|
import { NewCommand } from './commands/NewCommand';
|
|
13
15
|
import { PluginCommand } from './commands/PluginCommand';
|
|
14
16
|
import { PrepareCommand } from './commands/PrepareCommand';
|
|
15
17
|
import { QACommand } from './commands/QACommand';
|
|
18
|
+
import { SecretsCommand } from './commands/SecretsCommand';
|
|
16
19
|
import { SimulateCommand } from './commands/SimulateCommand';
|
|
17
20
|
import { StartCommand } from './commands/StartCommand';
|
|
21
|
+
import { TemplatesCommand } from './commands/TemplatesCommand';
|
|
18
22
|
import { ErrorHandler } from './ErrorHandler';
|
|
23
|
+
import { esmDirname } from '../common/index';
|
|
19
24
|
import { Logger } from '../config/logger';
|
|
20
25
|
import { ErrorFactory } from '../exceptions/ZintrustError';
|
|
21
26
|
import { readFileSync } from '../node-singletons/fs';
|
|
22
|
-
import {
|
|
23
|
-
import { fileURLToPath } from '../node-singletons/url';
|
|
27
|
+
import { join } from '../node-singletons/path';
|
|
24
28
|
import { Command } from 'commander';
|
|
25
|
-
const
|
|
26
|
-
const __dirname = dirname(__filename);
|
|
29
|
+
const __dirname = esmDirname(import.meta.url);
|
|
27
30
|
/**
|
|
28
31
|
* CLI - Main CLI Class
|
|
29
32
|
* Orchestrates all CLI commands using Commander
|
|
@@ -68,12 +71,16 @@ const registerCommands = (program) => {
|
|
|
68
71
|
MigrateCommand.create(),
|
|
69
72
|
D1MigrateCommand.create(),
|
|
70
73
|
DebugCommand.create(),
|
|
74
|
+
SecretsCommand.create(),
|
|
71
75
|
ConfigCommand.create(),
|
|
72
76
|
PluginCommand.create(),
|
|
73
77
|
QACommand(),
|
|
74
78
|
FixCommand.create(),
|
|
75
79
|
KeyGenerateCommand.create(),
|
|
76
80
|
SimulateCommand,
|
|
81
|
+
TemplatesCommand,
|
|
82
|
+
MakeMailTemplateCommand.create(),
|
|
83
|
+
MakeNotificationTemplateCommand.create(),
|
|
77
84
|
];
|
|
78
85
|
for (const command of commands) {
|
|
79
86
|
program.addCommand(command.getCommand());
|
|
@@ -132,9 +139,19 @@ const handleExecutionError = (error, version, log = true) => {
|
|
|
132
139
|
if (error === version) {
|
|
133
140
|
return;
|
|
134
141
|
}
|
|
142
|
+
const exitCode = getExitCode(error);
|
|
135
143
|
if (error instanceof Error) {
|
|
136
144
|
ErrorHandler.handle(error, undefined, log);
|
|
137
145
|
}
|
|
146
|
+
// Check for commander-specific errors that need special handling
|
|
147
|
+
if (error instanceof Error &&
|
|
148
|
+
'code' in error &&
|
|
149
|
+
typeof error.code === 'string' &&
|
|
150
|
+
error.code.startsWith('commander.')) {
|
|
151
|
+
ErrorFactory.createCliError('CLI execution failed', error);
|
|
152
|
+
process.exit(exitCode);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
138
155
|
throw ErrorFactory.createCliError('Unhandled CLI execution error', error);
|
|
139
156
|
};
|
|
140
157
|
/**
|
|
@@ -162,20 +179,7 @@ const runCLI = async (program, version, args) => {
|
|
|
162
179
|
await program.parseAsync(['node', 'zintrust', ...processedArgs]);
|
|
163
180
|
}
|
|
164
181
|
catch (error) {
|
|
165
|
-
//
|
|
166
|
-
if (error instanceof Error &&
|
|
167
|
-
'code' in error &&
|
|
168
|
-
typeof error.code === 'string' &&
|
|
169
|
-
error.code.startsWith('commander.')) {
|
|
170
|
-
const exitCode = getExitCode(error);
|
|
171
|
-
if (exitCode !== 0) {
|
|
172
|
-
ErrorFactory.createCliError('CLI execution failed', error);
|
|
173
|
-
process.exit(exitCode);
|
|
174
|
-
}
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
// Handle all other errors with proper logging
|
|
178
|
-
ErrorFactory.createCliError('CLI execution failed', error);
|
|
182
|
+
// Handle all errors with proper logging and exit logic
|
|
179
183
|
handleExecutionError(error, version, false);
|
|
180
184
|
}
|
|
181
185
|
};
|
|
@@ -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;AAqGX;;GAEG;AACH,eAAO,MAAM,YAAY;oBAjGhB,KAAK,GAAG,MAAM,aACX,MAAM,QACX,OAAO,KACX,IAAI;0BAYsB,MAAM,YAAY,MAAM,KAAG,IAAI;oBAY9B,MAAM,KAAG,IAAI;uBA4CV,MAAM,KAAG,IAAI;oBAQb,MAAM,KAAG,IAAI;qBAQf,MAAM,YAAW,OAAO,KAAW,IAAI;sBApDtC,MAAM,KAAG,IAAI;EAsE3C,CAAC"}
|
package/src/cli/ErrorHandler.js
CHANGED
|
@@ -17,9 +17,8 @@ export const EXIT_CODES = {
|
|
|
17
17
|
*/
|
|
18
18
|
const handleError = (error, exitCode = EXIT_CODES.RUNTIME_ERROR, log = true) => {
|
|
19
19
|
const message = typeof error === 'string' ? error : error.message;
|
|
20
|
-
const formattedMessage = `${chalk.red('[ERROR]')} ${message}`;
|
|
21
20
|
if (log) {
|
|
22
|
-
Logger.error(
|
|
21
|
+
Logger.error(message);
|
|
23
22
|
}
|
|
24
23
|
process.exit(exitCode);
|
|
25
24
|
};
|
|
@@ -29,8 +28,7 @@ const handleError = (error, exitCode = EXIT_CODES.RUNTIME_ERROR, log = true) =>
|
|
|
29
28
|
const usageError = (message, command) => {
|
|
30
29
|
const helpText = `Run: zin ${command} --help`;
|
|
31
30
|
const hint = command !== undefined && command !== '' ? `\n${chalk.gray(helpText)}` : '';
|
|
32
|
-
|
|
33
|
-
Logger.warn(formattedMessage);
|
|
31
|
+
Logger.error(`${message}${hint}`);
|
|
34
32
|
process.exit(EXIT_CODES.USAGE_ERROR);
|
|
35
33
|
};
|
|
36
34
|
/**
|
|
@@ -3,6 +3,64 @@
|
|
|
3
3
|
* Add services and features to existing Zintrust project
|
|
4
4
|
*/
|
|
5
5
|
import { IBaseCommand } from '../BaseCommand';
|
|
6
|
+
import { ResponseField } from '../scaffolding/ResponseFactoryGenerator';
|
|
7
|
+
interface ServicePromptAnswers {
|
|
8
|
+
name: string;
|
|
9
|
+
domain: string;
|
|
10
|
+
port: number;
|
|
11
|
+
database: 'shared' | 'isolated';
|
|
12
|
+
auth: 'api-key' | 'jwt' | 'none' | 'custom';
|
|
13
|
+
}
|
|
14
|
+
interface FeaturePromptAnswers {
|
|
15
|
+
name: string;
|
|
16
|
+
servicePath: string;
|
|
17
|
+
withTest: boolean;
|
|
18
|
+
}
|
|
19
|
+
interface MigrationPromptAnswers {
|
|
20
|
+
name: string;
|
|
21
|
+
type: string;
|
|
22
|
+
}
|
|
23
|
+
interface ModelPromptAnswers {
|
|
24
|
+
name: string;
|
|
25
|
+
softDelete: boolean;
|
|
26
|
+
timestamps: boolean;
|
|
27
|
+
}
|
|
28
|
+
interface ControllerPromptAnswers {
|
|
29
|
+
name: string;
|
|
30
|
+
type: string;
|
|
31
|
+
}
|
|
32
|
+
interface RoutesPromptAnswers {
|
|
33
|
+
name: string;
|
|
34
|
+
}
|
|
35
|
+
interface FactoryPromptAnswers {
|
|
36
|
+
name: string;
|
|
37
|
+
model: string;
|
|
38
|
+
addRelationships: boolean;
|
|
39
|
+
relationships?: string;
|
|
40
|
+
}
|
|
41
|
+
interface SeederPromptAnswers {
|
|
42
|
+
name: string;
|
|
43
|
+
model: string;
|
|
44
|
+
count: string;
|
|
45
|
+
states: boolean;
|
|
46
|
+
relationships: boolean;
|
|
47
|
+
truncate: boolean;
|
|
48
|
+
}
|
|
49
|
+
interface RequestFactoryPromptAnswers {
|
|
50
|
+
factoryName: string;
|
|
51
|
+
requestName: string;
|
|
52
|
+
endpoint: string;
|
|
53
|
+
method: string;
|
|
54
|
+
withDTO: boolean;
|
|
55
|
+
}
|
|
56
|
+
interface ResponseFactoryPromptAnswers {
|
|
57
|
+
factoryName: string;
|
|
58
|
+
responseName: string;
|
|
59
|
+
responseType: string;
|
|
60
|
+
factoryPath?: string;
|
|
61
|
+
responsePath?: string;
|
|
62
|
+
withDTO: boolean;
|
|
63
|
+
}
|
|
6
64
|
/**
|
|
7
65
|
* Add Command Factory
|
|
8
66
|
*/
|
|
@@ -11,5 +69,28 @@ export declare const AddCommand: Readonly<{
|
|
|
11
69
|
* Create a new add command instance
|
|
12
70
|
*/
|
|
13
71
|
create(): IBaseCommand;
|
|
72
|
+
/**
|
|
73
|
+
* Internal helpers for testing
|
|
74
|
+
* @internal
|
|
75
|
+
*/
|
|
76
|
+
_helpers: {
|
|
77
|
+
promptServiceConfig: (defaultName: string) => Promise<ServicePromptAnswers>;
|
|
78
|
+
promptFeatureConfig: () => Promise<FeaturePromptAnswers>;
|
|
79
|
+
promptMigrationConfig: () => Promise<MigrationPromptAnswers>;
|
|
80
|
+
promptModelConfig: () => Promise<ModelPromptAnswers>;
|
|
81
|
+
promptControllerConfig: () => Promise<ControllerPromptAnswers>;
|
|
82
|
+
promptRoutesConfig: () => Promise<RoutesPromptAnswers>;
|
|
83
|
+
promptFactoryConfig: () => Promise<FactoryPromptAnswers>;
|
|
84
|
+
promptSeederConfig: () => Promise<SeederPromptAnswers>;
|
|
85
|
+
promptRequestFactoryConfig: () => Promise<RequestFactoryPromptAnswers>;
|
|
86
|
+
promptResponseFactoryName: () => Promise<string>;
|
|
87
|
+
promptResponseFactoryConfig: (defaultResponseName: string) => Promise<ResponseFactoryPromptAnswers>;
|
|
88
|
+
promptWorkflowConfig: (defaultName: string) => Promise<{
|
|
89
|
+
name: string;
|
|
90
|
+
platform: "lambda" | "fargate" | "cloudflare" | "deno" | "all";
|
|
91
|
+
}>;
|
|
92
|
+
getDefaultResponseFields: (responseType: string) => ResponseField[];
|
|
93
|
+
};
|
|
14
94
|
}>;
|
|
95
|
+
export {};
|
|
15
96
|
//# sourceMappingURL=AddCommand.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/AddCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAA+B,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"AddCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/AddCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAA+B,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAO7E,OAAO,EAGL,aAAa,EACd,MAAM,2CAA2C,CAAC;AAoCnD,UAAU,oBAAoB;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,QAAQ,GAAG,UAAU,CAAC;IAChC,IAAI,EAAE,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC;CAC7C;AAED,UAAU,oBAAoB;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,sBAAsB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,kBAAkB;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,UAAU,uBAAuB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,mBAAmB;IAC3B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,oBAAoB;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,OAAO,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,mBAAmB;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,2BAA2B;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,UAAU,4BAA4B;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;CAClB;AAi+BD;;GAEG;AACH,eAAO,MAAM,UAAU;IACrB;;OAEG;cACO,YAAY;IAWtB;;;OAGG;;2CAp9B2C,MAAM,KAAG,OAAO,CAAC,oBAAoB,CAAC;mCA2EhD,OAAO,CAAC,oBAAoB,CAAC;qCA8D3B,OAAO,CAAC,sBAAsB,CAAC;iCAmDnC,OAAO,CAAC,kBAAkB,CAAC;sCA4DtB,OAAO,CAAC,uBAAuB,CAAC;kCAwDpC,OAAO,CAAC,mBAAmB,CAAC;mCAkE3B,OAAO,CAAC,oBAAoB,CAAC;kCAuI9B,OAAO,CAAC,mBAAmB,CAAC;0CAkGpB,OAAO,CAAC,2BAA2B,CAAC;yCAwFrC,OAAO,CAAC,MAAM,CAAC;2DAkBpC,MAAM,KAC1B,OAAO,CAAC,4BAA4B,CAAC;4CAoHzB,MAAM,KAClB,OAAO,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,GAAG,YAAY,GAAG,MAAM,GAAG,KAAK,CAAA;SAAE,CAAC;iDAlE5C,MAAM,KAAG,aAAa,EAAE;;EA2OtE,CAAC"}
|