@zintrust/core 0.1.1 → 0.1.3
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 +3 -3
- package/bin/zintrust.d.ts.map +1 -1
- package/bin/zintrust.js +18 -1
- package/package.json +15 -1
- 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 +6 -4
- package/src/cache/drivers/KVDriver.d.ts.map +1 -1
- package/src/cache/drivers/KVDriver.js +6 -6
- 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 +11 -4
- package/src/cli/commands/AddCommand.js +1 -1
- package/src/cli/commands/ConfigCommand.d.ts.map +1 -1
- package/src/cli/commands/ConfigCommand.js +34 -4
- 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 +4 -3
- package/src/cli/commands/FixCommand.d.ts.map +1 -1
- package/src/cli/commands/FixCommand.js +3 -16
- 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 +1 -1
- 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/NewCommand.d.ts +4 -0
- package/src/cli/commands/NewCommand.d.ts.map +1 -1
- package/src/cli/commands/NewCommand.js +33 -20
- 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 +11 -20
- 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.js +1 -1
- package/src/cli/scaffolding/FeatureScaffolder.js +4 -4
- package/src/cli/scaffolding/FileGenerator.js +1 -1
- package/src/cli/scaffolding/ModelGenerator.js +1 -1
- 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 +3 -2
- package/src/cli/scaffolding/RouteGenerator.js +1 -1
- package/src/cli/scaffolding/ServiceIntegrationTestGenerator.js +1 -1
- package/src/cli/scaffolding/ServiceScaffolder.js +2 -2
- 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 +37 -11
- 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/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/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/MicroserviceManager.d.ts.map +1 -1
- package/src/microservices/MicroserviceManager.js +9 -6
- package/src/microservices/PostgresAdapter.d.ts.map +1 -1
- package/src/microservices/PostgresAdapter.js +3 -1
- package/src/microservices/ServiceBundler.d.ts.map +1 -1
- package/src/microservices/ServiceBundler.js +6 -4
- package/src/microservices/ServiceHealthMonitor.js +2 -2
- 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/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 +150 -75
- 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 -6
- package/src/runtime/adapters/CloudflareAdapter.js +2 -2
- package/src/runtime/adapters/FargateAdapter.d.ts.map +1 -1
- package/src/runtime/adapters/FargateAdapter.js +2 -1
- 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 +2 -1
- 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 +155 -17
- 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 +44 -21
- 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 +11 -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/routes/storage.ts.tpl +42 -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 +49 -0
- package/src/tools/http/Http.d.ts.map +1 -0
- package/src/tools/http/Http.js +169 -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/LocalSignedUrl.d.ts +12 -0
- package/src/tools/storage/LocalSignedUrl.d.ts.map +1 -0
- package/src/tools/storage/LocalSignedUrl.js +108 -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 +18 -0
- package/src/tools/storage/drivers/Local.d.ts.map +1 -0
- package/src/tools/storage/drivers/Local.js +89 -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 +111 -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
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Secrets Command
|
|
3
|
+
*
|
|
4
|
+
* CLI-first secrets sync using the core internal toolkit.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* zin secrets pull --provider aws|cloudflare [--manifest secrets.manifest.json] [--out .env.pull] [--dry-run]
|
|
8
|
+
* zin secrets push --provider aws|cloudflare [--manifest secrets.manifest.json] [--in .env] [--dry-run]
|
|
9
|
+
* zin secrets doctor --provider aws|cloudflare
|
|
10
|
+
*/
|
|
11
|
+
import { BaseCommand } from '../BaseCommand';
|
|
12
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
13
|
+
import { SecretsToolkit } from '../../toolkit/Secrets';
|
|
14
|
+
const isUnknownArray = (value) => Array.isArray(value);
|
|
15
|
+
const getArg = (args, index) => {
|
|
16
|
+
if (!isUnknownArray(args))
|
|
17
|
+
return undefined;
|
|
18
|
+
const v = args[index];
|
|
19
|
+
return typeof v === 'string' ? v : undefined;
|
|
20
|
+
};
|
|
21
|
+
const coerceProvider = (provider) => provider === 'aws' || provider === 'cloudflare' ? provider : undefined;
|
|
22
|
+
const parseOptions = (options) => {
|
|
23
|
+
const cwd = process.cwd();
|
|
24
|
+
const action = getArg(options.args, 0) ?? 'pull';
|
|
25
|
+
const provider = typeof options.provider === 'string' ? coerceProvider(options.provider) : undefined;
|
|
26
|
+
const manifestPath = typeof options.manifest === 'string' ? options.manifest : undefined;
|
|
27
|
+
const outFile = typeof options.out === 'string' ? options.out : undefined;
|
|
28
|
+
const inFile = typeof options.in === 'string' ? options.in : undefined;
|
|
29
|
+
const dryRun = options.dryRun === true;
|
|
30
|
+
return { cwd, action, provider, manifestPath, outFile, inFile, dryRun };
|
|
31
|
+
};
|
|
32
|
+
const addOptions = (command) => {
|
|
33
|
+
command
|
|
34
|
+
.argument('[action]', 'pull | push | doctor', 'pull')
|
|
35
|
+
.option('--provider <provider>', 'aws | cloudflare')
|
|
36
|
+
.option('--manifest <path>', 'Manifest path (default: secrets.manifest.json)', 'secrets.manifest.json')
|
|
37
|
+
.option('--out <path>', 'Output env file for pull (default: .env.pull)', '.env.pull')
|
|
38
|
+
.option('--in <path>', 'Input env file for push (default: .env)', '.env')
|
|
39
|
+
.option('--dry-run', 'Do not write/upload, just show what would change');
|
|
40
|
+
};
|
|
41
|
+
const execute = async (cmd, options) => {
|
|
42
|
+
const parsed = parseOptions(options);
|
|
43
|
+
switch (parsed.action) {
|
|
44
|
+
case 'pull': {
|
|
45
|
+
const result = await SecretsToolkit.pull({
|
|
46
|
+
cwd: parsed.cwd,
|
|
47
|
+
provider: parsed.provider,
|
|
48
|
+
manifestPath: parsed.manifestPath,
|
|
49
|
+
outFile: parsed.outFile,
|
|
50
|
+
dryRun: parsed.dryRun,
|
|
51
|
+
});
|
|
52
|
+
cmd.success(`Pulled ${result.keys.length} keys to ${result.outFile}${parsed.dryRun ? ' (dry-run)' : ''}`);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
case 'push': {
|
|
56
|
+
const result = await SecretsToolkit.push({
|
|
57
|
+
cwd: parsed.cwd,
|
|
58
|
+
provider: parsed.provider,
|
|
59
|
+
manifestPath: parsed.manifestPath,
|
|
60
|
+
inFile: parsed.inFile,
|
|
61
|
+
dryRun: parsed.dryRun,
|
|
62
|
+
});
|
|
63
|
+
cmd.success(`Pushed ${result.keys.length} keys from ${result.inFile}${parsed.dryRun ? ' (dry-run)' : ''}`);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
case 'doctor': {
|
|
67
|
+
const result = SecretsToolkit.doctor({ provider: parsed.provider });
|
|
68
|
+
if (result.ok) {
|
|
69
|
+
cmd.success(`Secrets doctor OK (${result.provider})`);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
cmd.warn(`Secrets doctor failed (${result.provider}). Missing: ${result.missing.join(', ')}`);
|
|
73
|
+
}
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
default:
|
|
77
|
+
throw ErrorFactory.createCliError(`Unknown secrets action: ${parsed.action}`);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
export const SecretsCommand = Object.freeze({
|
|
81
|
+
create() {
|
|
82
|
+
const cmd = BaseCommand.create({
|
|
83
|
+
name: 'secrets',
|
|
84
|
+
description: 'Pull/push secrets to local .env.pull via core toolkit',
|
|
85
|
+
addOptions,
|
|
86
|
+
execute: async (options) => execute(cmd, options),
|
|
87
|
+
});
|
|
88
|
+
return cmd;
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
export default SecretsCommand;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StartCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/StartCommand.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StartCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/StartCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAmSvF,eAAO,MAAM,YAAY;cACb,YAAY;EAsBtB,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { resolveNpmPath } from '../../common';
|
|
2
1
|
import { BaseCommand } from '../BaseCommand';
|
|
3
2
|
import { EnvFileLoader } from '../utils/EnvFileLoader';
|
|
4
3
|
import { SpawnUtil } from '../utils/spawn';
|
|
4
|
+
import { resolveNpmPath } from '../../common/index';
|
|
5
5
|
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
6
6
|
import { existsSync, readFileSync } from '../../node-singletons/fs';
|
|
7
|
-
import * as path from 'node
|
|
7
|
+
import * as path from '../../node-singletons/path';
|
|
8
8
|
const isValidModeInput = (value) => value === 'development' ||
|
|
9
9
|
value === 'dev' ||
|
|
10
10
|
value === 'production' ||
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TemplatesCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/TemplatesCommand.ts"],"names":[],"mappings":"AAgCA,eAAO,MAAM,gBAAgB,yCAqC3B,CAAC;AAEH,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { BaseCommand } from '../BaseCommand';
|
|
2
|
+
import { ErrorHandler } from '../ErrorHandler';
|
|
3
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
4
|
+
import { listTemplates as listMail, renderTemplate as renderMail } from '../../tools/mail/templates/markdown';
|
|
5
|
+
import { listTemplates as listNotification, renderTemplate as renderNotification, } from '../../tools/notification/templates/markdown';
|
|
6
|
+
const listForScope = (scope) => {
|
|
7
|
+
let items = [];
|
|
8
|
+
if (scope === 'mail' || scope === 'all')
|
|
9
|
+
items = items.concat(listMail());
|
|
10
|
+
if (scope === 'notification' || scope === 'all')
|
|
11
|
+
items = items.concat(listNotification());
|
|
12
|
+
items.sort((a, b) => a.localeCompare(b));
|
|
13
|
+
return items;
|
|
14
|
+
};
|
|
15
|
+
const renderByScope = (name, scope) => {
|
|
16
|
+
if (scope === 'mail')
|
|
17
|
+
return renderMail(name);
|
|
18
|
+
if (scope === 'notification')
|
|
19
|
+
return renderNotification(name);
|
|
20
|
+
try {
|
|
21
|
+
return renderMail(name);
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
try {
|
|
25
|
+
return renderNotification(name);
|
|
26
|
+
}
|
|
27
|
+
catch (error_) {
|
|
28
|
+
throw ErrorFactory.createTryCatchError('Template render failed', error_);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
export const TemplatesCommand = BaseCommand.create({
|
|
33
|
+
name: 'templates',
|
|
34
|
+
description: 'Manage and render markdown templates (mail & notification)',
|
|
35
|
+
addOptions: (command) => {
|
|
36
|
+
command.argument('<action>', 'Action: list|render');
|
|
37
|
+
command.argument('[scope]', 'Scope: mail|notification|all', 'all');
|
|
38
|
+
command.argument('[name]', 'Template name when action=render');
|
|
39
|
+
},
|
|
40
|
+
execute: (options) => {
|
|
41
|
+
const action = options.args?.[0];
|
|
42
|
+
const scope = options.args?.[1] ?? 'all';
|
|
43
|
+
const name = options.args?.[2];
|
|
44
|
+
const handleList = (sc) => {
|
|
45
|
+
const items = listForScope(sc);
|
|
46
|
+
items.forEach((it) => ErrorHandler.info(it));
|
|
47
|
+
};
|
|
48
|
+
const handleRender = (nm, sc) => {
|
|
49
|
+
if (nm === null || nm === undefined || nm === '')
|
|
50
|
+
throw ErrorFactory.createValidationError('Template name required');
|
|
51
|
+
const out = renderByScope(nm, sc);
|
|
52
|
+
ErrorHandler.info(out.html);
|
|
53
|
+
};
|
|
54
|
+
if (action === 'list') {
|
|
55
|
+
handleList(scope);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (action === 'render') {
|
|
59
|
+
handleRender(name, scope);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
throw ErrorFactory.createValidationError(`Unknown action: ${String(action)}`);
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
export default TemplatesCommand;
|
|
@@ -4,8 +4,13 @@
|
|
|
4
4
|
export { AddCommand } from '../commands/AddCommand';
|
|
5
5
|
export { ConfigCommand } from '../commands/ConfigCommand';
|
|
6
6
|
export { DebugCommand } from '../commands/DebugCommand';
|
|
7
|
+
export { LogsCleanupCommand } from '../commands/LogsCleanupCommand';
|
|
8
|
+
export { MakeMailTemplateCommand } from '../commands/MakeMailTemplateCommand';
|
|
9
|
+
export { MakeNotificationTemplateCommand } from '../commands/MakeNotificationTemplateCommand';
|
|
7
10
|
export { MigrateCommand } from '../commands/MigrateCommand';
|
|
8
11
|
export { NewCommand } from '../commands/NewCommand';
|
|
9
12
|
export { PrepareCommand } from '../commands/PrepareCommand';
|
|
13
|
+
export { SecretsCommand } from '../commands/SecretsCommand';
|
|
10
14
|
export { StartCommand } from '../commands/StartCommand';
|
|
15
|
+
export { TemplatesCommand } from '../commands/TemplatesCommand';
|
|
11
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,+BAA+B,EAAE,MAAM,+CAA+C,CAAC;AAChG,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -4,7 +4,12 @@
|
|
|
4
4
|
export { AddCommand } from '../commands/AddCommand';
|
|
5
5
|
export { ConfigCommand } from '../commands/ConfigCommand';
|
|
6
6
|
export { DebugCommand } from '../commands/DebugCommand';
|
|
7
|
+
export { LogsCleanupCommand } from '../commands/LogsCleanupCommand';
|
|
8
|
+
export { MakeMailTemplateCommand } from '../commands/MakeMailTemplateCommand';
|
|
9
|
+
export { MakeNotificationTemplateCommand } from '../commands/MakeNotificationTemplateCommand';
|
|
7
10
|
export { MigrateCommand } from '../commands/MigrateCommand';
|
|
8
11
|
export { NewCommand } from '../commands/NewCommand';
|
|
9
12
|
export { PrepareCommand } from '../commands/PrepareCommand';
|
|
13
|
+
export { SecretsCommand } from '../commands/SecretsCommand';
|
|
10
14
|
export { StartCommand } from '../commands/StartCommand';
|
|
15
|
+
export { TemplatesCommand } from '../commands/TemplatesCommand';
|
|
@@ -6,7 +6,7 @@ import { ConfigPaths, DEFAULT_CONFIG, getConfigValue, setConfigValue, } from '..
|
|
|
6
6
|
import { Logger } from '../../config/logger';
|
|
7
7
|
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
8
8
|
import { fsPromises as fs } from '../../node-singletons/fs';
|
|
9
|
-
import * as path from 'node
|
|
9
|
+
import * as path from '../../node-singletons/path';
|
|
10
10
|
/**
|
|
11
11
|
* Deep merge helper
|
|
12
12
|
*/
|
package/src/cli/index.d.ts
CHANGED
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export { BaseCommand, type CommandOptions } from './BaseCommand';
|
|
6
6
|
export { CLI } from './CLI';
|
|
7
|
-
export {
|
|
7
|
+
export { ErrorHandler, EXIT_CODES } from './ErrorHandler';
|
|
8
8
|
export { PromptHelper, type PromptOptions } from './PromptHelper';
|
|
9
9
|
export { AddCommand } from './commands/AddCommand';
|
|
10
10
|
export { ConfigCommand } from './commands/ConfigCommand';
|
|
11
11
|
export { DebugCommand } from './commands/DebugCommand';
|
|
12
12
|
export { MigrateCommand } from './commands/MigrateCommand';
|
|
13
13
|
export { NewCommand } from './commands/NewCommand';
|
|
14
|
+
export { SecretsCommand } from './commands/SecretsCommand';
|
|
14
15
|
//# sourceMappingURL=index.d.ts.map
|
package/src/cli/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGrE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC"}
|
package/src/cli/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export { BaseCommand } from './BaseCommand';
|
|
6
6
|
export { CLI } from './CLI';
|
|
7
|
-
export {
|
|
7
|
+
export { ErrorHandler, EXIT_CODES } from './ErrorHandler';
|
|
8
8
|
export { PromptHelper } from './PromptHelper';
|
|
9
9
|
// Export commands
|
|
10
10
|
export { AddCommand } from './commands/AddCommand';
|
|
@@ -12,3 +12,4 @@ export { ConfigCommand } from './commands/ConfigCommand';
|
|
|
12
12
|
export { DebugCommand } from './commands/DebugCommand';
|
|
13
13
|
export { MigrateCommand } from './commands/MigrateCommand';
|
|
14
14
|
export { NewCommand } from './commands/NewCommand';
|
|
15
|
+
export { SecretsCommand } from './commands/SecretsCommand';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { FileGenerator } from '../scaffolding/FileGenerator';
|
|
6
6
|
import { Logger } from '../../config/logger';
|
|
7
|
-
import * as path from 'node
|
|
7
|
+
import * as path from '../../node-singletons/path';
|
|
8
8
|
/**
|
|
9
9
|
* ControllerGenerator creates HTTP request handlers
|
|
10
10
|
*/
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { FileGenerator } from '../scaffolding/FileGenerator';
|
|
6
6
|
import { Logger } from '../../config/logger';
|
|
7
|
-
import * as path from 'node
|
|
7
|
+
import * as path from '../../node-singletons/path';
|
|
8
8
|
/**
|
|
9
9
|
* FeatureScaffolder adds features to services
|
|
10
10
|
*/
|
|
@@ -208,7 +208,7 @@ const PAYMENTS_TEMPLATE = `/**
|
|
|
208
208
|
* Handles payment processing and transactions
|
|
209
209
|
*/
|
|
210
210
|
|
|
211
|
-
import { randomBytes } from 'node
|
|
211
|
+
import { randomBytes } from '../../node-singletons/crypto';
|
|
212
212
|
|
|
213
213
|
export interface PaymentConfig {
|
|
214
214
|
provider: 'stripe' | 'paypal' | 'square';
|
|
@@ -429,7 +429,7 @@ const EMAIL_TEMPLATE = `/**
|
|
|
429
429
|
* Handles email sending
|
|
430
430
|
*/
|
|
431
431
|
|
|
432
|
-
import { randomBytes } from 'node
|
|
432
|
+
import { randomBytes } from '../../node-singletons/crypto';
|
|
433
433
|
|
|
434
434
|
export interface EmailConfig {
|
|
435
435
|
provider: 'sendgrid' | 'mailgun' | 'nodemailer';
|
|
@@ -547,7 +547,7 @@ const QUEUE_TEMPLATE = `/**
|
|
|
547
547
|
* Job queue processing
|
|
548
548
|
*/
|
|
549
549
|
|
|
550
|
-
import { randomBytes } from 'node
|
|
550
|
+
import { randomBytes } from '../../node-singletons/crypto';
|
|
551
551
|
|
|
552
552
|
export interface Job {
|
|
553
553
|
id: string;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { Logger } from '../../config/logger';
|
|
7
7
|
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
8
8
|
import fs from '../../node-singletons/fs';
|
|
9
|
-
import * as path from 'node
|
|
9
|
+
import * as path from '../../node-singletons/path';
|
|
10
10
|
/**
|
|
11
11
|
* Create a directory recursively
|
|
12
12
|
*/
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { FileGenerator } from '../scaffolding/FileGenerator';
|
|
6
6
|
import { CommonUtils } from '../../common/index';
|
|
7
7
|
import { Logger } from '../../config/logger';
|
|
8
|
-
import * as path from 'node
|
|
8
|
+
import * as path from '../../node-singletons/path';
|
|
9
9
|
/**
|
|
10
10
|
* Validate model options
|
|
11
11
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectScaffolder.d.ts","sourceRoot":"","sources":["../../../../src/cli/scaffolding/ProjectScaffolder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,cAAc,GAAG,sBAAsB,CAAC;AAEpD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,cAAc,CAAC,OAAO,EAAE,sBAAsB,GAAG,IAAI,CAAC;IACtD,YAAY,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,eAAe,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAAC;IACpE,cAAc,IAAI,MAAM,CAAC;IACzB,sBAAsB,IAAI,OAAO,CAAC;IAClC,iBAAiB,IAAI,MAAM,CAAC;IAC5B,WAAW,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,MAAM,CAAC;IACtD,gBAAgB,IAAI,OAAO,CAAC;IAC5B,aAAa,IAAI,OAAO,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;CAC3E;
|
|
1
|
+
{"version":3,"file":"ProjectScaffolder.d.ts","sourceRoot":"","sources":["../../../../src/cli/scaffolding/ProjectScaffolder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,cAAc,GAAG,sBAAsB,CAAC;AAEpD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,cAAc,CAAC,OAAO,EAAE,sBAAsB,GAAG,IAAI,CAAC;IACtD,YAAY,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,eAAe,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAAC;IACpE,cAAc,IAAI,MAAM,CAAC;IACzB,sBAAsB,IAAI,OAAO,CAAC;IAClC,iBAAiB,IAAI,MAAM,CAAC;IAC5B,WAAW,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,MAAM,CAAC;IACtD,gBAAgB,IAAI,OAAO,CAAC;IAC5B,aAAa,IAAI,OAAO,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;CAC3E;AAqWD,wBAAgB,qBAAqB,IAAI,MAAM,EAAE,CAEhD;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAMrE;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG;IAChE,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAsBA;AAwID;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,GAAE,MAAsB,GAAG,kBAAkB,CAsB/F;AAED,wBAAsB,eAAe,CACnC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,qBAAqB,CAAC,CAEhC;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;EAM5B,CAAC"}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Project Scaffolder - New project generation
|
|
3
3
|
* Handles directory structure and boilerplate file creation
|
|
4
4
|
*/
|
|
5
|
+
import { esmDirname } from '../../common/index';
|
|
5
6
|
import { Logger } from '../../config/logger';
|
|
6
7
|
import fs from '../../node-singletons/fs';
|
|
7
|
-
import
|
|
8
|
-
import * as path from 'node:path';
|
|
8
|
+
import * as path from '../../node-singletons/path';
|
|
9
9
|
const createDirectories = (projectPath, directories) => {
|
|
10
10
|
let count = 0;
|
|
11
11
|
if (!fs.existsSync(projectPath)) {
|
|
@@ -22,11 +22,42 @@ const createDirectories = (projectPath, directories) => {
|
|
|
22
22
|
return count;
|
|
23
23
|
};
|
|
24
24
|
const createFiles = (projectPath, files, variables) => {
|
|
25
|
+
const renderPathVar = (value) => {
|
|
26
|
+
if (value === undefined || value === null)
|
|
27
|
+
return '';
|
|
28
|
+
if (typeof value === 'string')
|
|
29
|
+
return value;
|
|
30
|
+
if (typeof value === 'number' || typeof value === 'bigint')
|
|
31
|
+
return value.toString();
|
|
32
|
+
if (typeof value === 'boolean')
|
|
33
|
+
return value ? 'true' : 'false';
|
|
34
|
+
return '';
|
|
35
|
+
};
|
|
36
|
+
const renderContentVar = (value) => {
|
|
37
|
+
if (value === undefined || value === null)
|
|
38
|
+
return '';
|
|
39
|
+
if (typeof value === 'string')
|
|
40
|
+
return value;
|
|
41
|
+
if (typeof value === 'number' || typeof value === 'bigint')
|
|
42
|
+
return value.toString();
|
|
43
|
+
if (typeof value === 'boolean')
|
|
44
|
+
return value ? 'true' : 'false';
|
|
45
|
+
if (typeof value === 'symbol')
|
|
46
|
+
return value.toString();
|
|
47
|
+
if (typeof value === 'function')
|
|
48
|
+
return '[Function]';
|
|
49
|
+
try {
|
|
50
|
+
return JSON.stringify(value);
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return '';
|
|
54
|
+
}
|
|
55
|
+
};
|
|
25
56
|
let count = 0;
|
|
26
57
|
for (const [file, content] of Object.entries(files)) {
|
|
27
|
-
const renderedPath = file.replaceAll(/\{\{\s*(\w+)\s*\}\}/g, (_m, key) =>
|
|
58
|
+
const renderedPath = file.replaceAll(/\{\{\s*(\w+)\s*\}\}/g, (_m, key) => renderPathVar(variables[key]));
|
|
28
59
|
const fullPath = path.join(projectPath, renderedPath);
|
|
29
|
-
const rendered = content.replaceAll(/\{\{\s*(\w+)\s*\}\}/g, (_m, key) =>
|
|
60
|
+
const rendered = content.replaceAll(/\{\{\s*(\w+)\s*\}\}/g, (_m, key) => renderContentVar(variables[key]));
|
|
30
61
|
fs.mkdirSync(path.dirname(fullPath), { recursive: true });
|
|
31
62
|
fs.writeFileSync(fullPath, rendered);
|
|
32
63
|
count++;
|
|
@@ -65,9 +96,9 @@ const createEnvFile = (projectPath, variables) => {
|
|
|
65
96
|
if (fs.existsSync(fullPath)) {
|
|
66
97
|
return true;
|
|
67
98
|
}
|
|
68
|
-
const name =
|
|
99
|
+
const name = typeof variables['projectName'] === 'string' ? variables['projectName'] : 'zintrust-app';
|
|
69
100
|
const port = Number(variables['port'] ?? 3000);
|
|
70
|
-
const database =
|
|
101
|
+
const database = typeof variables['database'] === 'string' ? variables['database'] : 'sqlite';
|
|
71
102
|
const baseLines = [
|
|
72
103
|
'NODE_ENV=development',
|
|
73
104
|
`APP_NAME=${name}`,
|
|
@@ -125,8 +156,7 @@ const createEnvFile = (projectPath, variables) => {
|
|
|
125
156
|
}
|
|
126
157
|
};
|
|
127
158
|
const getProjectTemplatesRoot = () => {
|
|
128
|
-
const
|
|
129
|
-
const thisDir = path.dirname(thisFile);
|
|
159
|
+
const thisDir = esmDirname(import.meta.url);
|
|
130
160
|
// src/cli/scaffolding/ -> src/templates/project/
|
|
131
161
|
return path.resolve(thisDir, '..', '..', 'templates', 'project');
|
|
132
162
|
};
|
|
@@ -209,6 +239,9 @@ const BASIC_TEMPLATE = {
|
|
|
209
239
|
'config',
|
|
210
240
|
'database/migrations',
|
|
211
241
|
'database/seeders',
|
|
242
|
+
'logs',
|
|
243
|
+
'storage',
|
|
244
|
+
'tmp',
|
|
212
245
|
'public',
|
|
213
246
|
'routes',
|
|
214
247
|
'src',
|
|
@@ -220,7 +253,16 @@ const BASIC_TEMPLATE = {
|
|
|
220
253
|
const API_TEMPLATE = {
|
|
221
254
|
name: 'api',
|
|
222
255
|
description: 'API-focused Zintrust project structure',
|
|
223
|
-
directories: [
|
|
256
|
+
directories: [
|
|
257
|
+
'app/Controllers',
|
|
258
|
+
'app/Middleware',
|
|
259
|
+
'app/Models',
|
|
260
|
+
'logs',
|
|
261
|
+
'storage',
|
|
262
|
+
'tmp',
|
|
263
|
+
'routes',
|
|
264
|
+
'tests',
|
|
265
|
+
],
|
|
224
266
|
files: {},
|
|
225
267
|
};
|
|
226
268
|
const MICROSERVICE_TEMPLATE = {
|
|
@@ -230,6 +272,9 @@ const MICROSERVICE_TEMPLATE = {
|
|
|
230
272
|
'app/Controllers',
|
|
231
273
|
'app/Middleware',
|
|
232
274
|
'app/Models',
|
|
275
|
+
'logs',
|
|
276
|
+
'storage',
|
|
277
|
+
'tmp',
|
|
233
278
|
'routes',
|
|
234
279
|
'tests',
|
|
235
280
|
'src/services',
|
|
@@ -247,6 +292,9 @@ const FULLSTACK_TEMPLATE = {
|
|
|
247
292
|
'config',
|
|
248
293
|
'database/migrations',
|
|
249
294
|
'database/seeders',
|
|
295
|
+
'logs',
|
|
296
|
+
'storage',
|
|
297
|
+
'tmp',
|
|
250
298
|
'public',
|
|
251
299
|
'routes',
|
|
252
300
|
'src',
|
|
@@ -318,7 +366,7 @@ const createFilesForState = (state) => {
|
|
|
318
366
|
? { ...templateFiles }
|
|
319
367
|
: {};
|
|
320
368
|
// Backward-compatible defaults for templates that don't ship these files yet.
|
|
321
|
-
if (!Object.
|
|
369
|
+
if (!Object.hasOwn(files, '.gitignore')) {
|
|
322
370
|
files['.gitignore'] = `node_modules/
|
|
323
371
|
dist/
|
|
324
372
|
.env
|
|
@@ -326,10 +374,12 @@ dist/
|
|
|
326
374
|
.DS_Store
|
|
327
375
|
coverage/
|
|
328
376
|
logs/
|
|
377
|
+
storage/
|
|
378
|
+
tmp/
|
|
329
379
|
*.log
|
|
330
380
|
`;
|
|
331
381
|
}
|
|
332
|
-
if (!Object.
|
|
382
|
+
if (!Object.hasOwn(files, 'README.md')) {
|
|
333
383
|
files['README.md'] = `# {{projectName}}
|
|
334
384
|
|
|
335
385
|
Starter Task API built with Zintrust.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResponseFactoryGenerator.d.ts","sourceRoot":"","sources":["../../../../src/cli/scaffolding/ResponseFactoryGenerator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EACA,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,MAAM,GACN,MAAM,GACN,MAAM,GACN,OAAO,GACP,yBAAyB,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,aAAa,EAAE,CAAC;IACzB,YAAY,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,WAAW,GAAG,QAAQ,CAAC;IAC5D,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBpF;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,8BAA8B,CAAC,CAkCzC;
|
|
1
|
+
{"version":3,"file":"ResponseFactoryGenerator.d.ts","sourceRoot":"","sources":["../../../../src/cli/scaffolding/ResponseFactoryGenerator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EACA,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,MAAM,GACN,MAAM,GACN,MAAM,GACN,OAAO,GACP,yBAAyB,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,aAAa,EAAE,CAAC;IACzB,YAAY,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,WAAW,GAAG,QAAQ,CAAC;IAC5D,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBpF;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,8BAA8B,CAAC,CAkCzC;AAoRD;;;GAGG;AACH,eAAO,MAAM,wBAAwB;;;EAGnC,CAAC"}
|
|
@@ -6,7 +6,7 @@ import { FileGenerator } from '../scaffolding/FileGenerator';
|
|
|
6
6
|
import { Logger } from '../../config/logger';
|
|
7
7
|
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
8
8
|
import { fsPromises as fs } from '../../node-singletons/fs';
|
|
9
|
-
import * as path from 'node
|
|
9
|
+
import * as path from '../../node-singletons/path';
|
|
10
10
|
/**
|
|
11
11
|
* Validate response factory options
|
|
12
12
|
*/
|
|
@@ -187,6 +187,7 @@ export default ${factoryName};
|
|
|
187
187
|
/**
|
|
188
188
|
* Generate response DTO code
|
|
189
189
|
*/
|
|
190
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
190
191
|
async function generateResponseDTO(options) {
|
|
191
192
|
if (options.responsesPath === undefined) {
|
|
192
193
|
throw ErrorFactory.createCliError('Responses path is required');
|
|
@@ -240,7 +241,7 @@ export default ${options.responseName};
|
|
|
240
241
|
`;
|
|
241
242
|
FileGenerator.writeFile(dtoPath, dtoCode);
|
|
242
243
|
Logger.info(`✅ Generated response DTO: ${options.responseName}`);
|
|
243
|
-
return
|
|
244
|
+
return dtoPath;
|
|
244
245
|
}
|
|
245
246
|
/**
|
|
246
247
|
* Generate field assignments for the factory
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { FileGenerator } from '../scaffolding/FileGenerator';
|
|
6
6
|
import { CommonUtils } from '../../common/index';
|
|
7
7
|
import { Logger } from '../../config/logger';
|
|
8
|
-
import * as path from 'node
|
|
8
|
+
import * as path from '../../node-singletons/path';
|
|
9
9
|
/**
|
|
10
10
|
* Validate integration test options
|
|
11
11
|
*/
|
|
@@ -165,10 +165,10 @@ import { Application } from '../../boot/Application';
|
|
|
165
165
|
import { Server } from '../../boot/Server';
|
|
166
166
|
import { Logger } from '../../config/logger';
|
|
167
167
|
import { Env } from '../../config/env';
|
|
168
|
+
import { esmDirname } from '../../common/index';
|
|
168
169
|
import * as path from '../../node-singletons/path';
|
|
169
|
-
import { fileURLToPath } from '../../node-singletons/url';
|
|
170
170
|
|
|
171
|
-
const __dirname =
|
|
171
|
+
const __dirname = esmDirname(import.meta.url);
|
|
172
172
|
const app = new Application(path.join(__dirname, '..'));
|
|
173
173
|
const port = Env.getInt('${options.name?.toUpperCase()}_PORT', ${options.port ?? 3001});
|
|
174
174
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template Generator
|
|
3
|
+
* Scaffolds mail and notification markdown templates into the application source.
|
|
4
|
+
*
|
|
5
|
+
* Notes:
|
|
6
|
+
* - Generates into application folders (default: src/mail/markdown and src/notification/markdown)
|
|
7
|
+
* - Uses FileGenerator for consistent file I/O + logging
|
|
8
|
+
*/
|
|
9
|
+
export type MailTemplateCategory = 'auth' | 'transactional' | 'notifications';
|
|
10
|
+
export type NotificationChannel = 'mail' | 'sms' | 'slack' | 'discord';
|
|
11
|
+
export interface MailTemplateScaffoldOptions {
|
|
12
|
+
name: string;
|
|
13
|
+
category: MailTemplateCategory;
|
|
14
|
+
variables: string[];
|
|
15
|
+
copyright: string;
|
|
16
|
+
projectRoot: string;
|
|
17
|
+
overwrite?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface NotificationTemplateScaffoldOptions {
|
|
20
|
+
name: string;
|
|
21
|
+
channels: NotificationChannel[];
|
|
22
|
+
variables: string[];
|
|
23
|
+
copyright: string;
|
|
24
|
+
projectRoot: string;
|
|
25
|
+
smsVariant?: 'short' | 'none';
|
|
26
|
+
overwrite?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface TemplateScaffoldResult {
|
|
29
|
+
success: boolean;
|
|
30
|
+
filePath: string;
|
|
31
|
+
message: string;
|
|
32
|
+
}
|
|
33
|
+
export declare const TemplateGenerator: Readonly<{
|
|
34
|
+
validateTemplateName(name: string): void;
|
|
35
|
+
parseVariablesCsv(csv: string | undefined): string[];
|
|
36
|
+
scaffoldMailMarkdownTemplate(options: MailTemplateScaffoldOptions): TemplateScaffoldResult;
|
|
37
|
+
scaffoldNotificationMarkdownTemplate(options: NotificationTemplateScaffoldOptions): TemplateScaffoldResult;
|
|
38
|
+
ensureDirectories(projectRoot: string): void;
|
|
39
|
+
}>;
|
|
40
|
+
//# sourceMappingURL=TemplateGenerator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TemplateGenerator.d.ts","sourceRoot":"","sources":["../../../../src/cli/scaffolding/TemplateGenerator.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,eAAe,GAAG,eAAe,CAAC;AAC9E,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,SAAS,CAAC;AAEvE,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,mCAAmC;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,mBAAmB,EAAE,CAAC;IAChC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAYD,eAAO,MAAM,iBAAiB;+BACD,MAAM,GAAG,IAAI;2BAejB,MAAM,GAAG,SAAS,GAAG,MAAM,EAAE;0CAKd,2BAA2B,GAAG,sBAAsB;kDAqC/E,mCAAmC,GAC3C,sBAAsB;mCAqCM,MAAM,GAAG,IAAI;EAY5C,CAAC"}
|