@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceScaffolder.d.ts","sourceRoot":"","sources":["../../../../src/cli/scaffolding/ServiceScaffolder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IACjC,IAAI,CAAC,EAAE,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC;IAC7C,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AAEH;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,cAAc,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAuB7F;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,MAAM,CAGnF;AAED;;GAEG;
|
|
1
|
+
{"version":3,"file":"ServiceScaffolder.d.ts","sourceRoot":"","sources":["../../../../src/cli/scaffolding/ServiceScaffolder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IACjC,IAAI,CAAC,EAAE,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC;IAC7C,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AAEH;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,cAAc,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAuB7F;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,MAAM,CAGnF;AAED;;GAEG;AAEH,wBAAgB,QAAQ,CACtB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,qBAAqB,CAAC,CA+ChC;AA4SD,eAAO,MAAM,iBAAiB;;;;EAI5B,CAAC"}
|
|
@@ -40,49 +40,50 @@ export function getServicePath(projectRoot, options) {
|
|
|
40
40
|
/**
|
|
41
41
|
* Generate service structure
|
|
42
42
|
*/
|
|
43
|
-
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
44
|
+
export function scaffold(projectRoot, options) {
|
|
44
45
|
try {
|
|
45
46
|
// Validate options
|
|
46
47
|
const validation = validateOptions(options);
|
|
47
48
|
if (!validation.valid) {
|
|
48
|
-
return {
|
|
49
|
+
return Promise.resolve({
|
|
49
50
|
success: false,
|
|
50
51
|
serviceName: options.name,
|
|
51
52
|
servicePath: '',
|
|
52
53
|
filesCreated: [],
|
|
53
54
|
message: `Validation failed: ${validation.errors.join(', ')}`,
|
|
54
|
-
};
|
|
55
|
+
});
|
|
55
56
|
}
|
|
56
57
|
const servicePath = getServicePath(projectRoot, options);
|
|
57
58
|
// Check if service already exists
|
|
58
59
|
if (FileGenerator.directoryExists(servicePath)) {
|
|
59
|
-
return {
|
|
60
|
+
return Promise.resolve({
|
|
60
61
|
success: false,
|
|
61
62
|
serviceName: options.name,
|
|
62
63
|
servicePath,
|
|
63
64
|
filesCreated: [],
|
|
64
65
|
message: `Service '${options.name}' already exists at ${servicePath}`,
|
|
65
|
-
};
|
|
66
|
+
});
|
|
66
67
|
}
|
|
67
68
|
createServiceDirectories(servicePath);
|
|
68
69
|
const filesCreated = createServiceFiles(servicePath, options);
|
|
69
|
-
return {
|
|
70
|
+
return Promise.resolve({
|
|
70
71
|
success: true,
|
|
71
72
|
serviceName: options.name,
|
|
72
73
|
servicePath,
|
|
73
74
|
filesCreated,
|
|
74
75
|
message: `Service '${options.name}' scaffolded successfully`,
|
|
75
|
-
};
|
|
76
|
+
});
|
|
76
77
|
}
|
|
77
78
|
catch (error) {
|
|
78
79
|
Logger.error('Service scaffolding failed', error);
|
|
79
|
-
return {
|
|
80
|
+
return Promise.resolve({
|
|
80
81
|
success: false,
|
|
81
82
|
serviceName: options.name,
|
|
82
83
|
servicePath: '',
|
|
83
84
|
filesCreated: [],
|
|
84
85
|
message: error.message,
|
|
85
|
-
};
|
|
86
|
+
});
|
|
86
87
|
}
|
|
87
88
|
}
|
|
88
89
|
/**
|
|
@@ -164,10 +165,10 @@ import { Application } from '../../boot/Application';
|
|
|
164
165
|
import { Server } from '../../boot/Server';
|
|
165
166
|
import { Logger } from '../../config/logger';
|
|
166
167
|
import { Env } from '../../config/env';
|
|
168
|
+
import { esmDirname } from '../../common/index';
|
|
167
169
|
import * as path from '../../node-singletons/path';
|
|
168
|
-
import { fileURLToPath } from '../../node-singletons/url';
|
|
169
170
|
|
|
170
|
-
const __dirname =
|
|
171
|
+
const __dirname = esmDirname(import.meta.url);
|
|
171
172
|
const app = new Application(path.join(__dirname, '..'));
|
|
172
173
|
const port = Env.getInt('${options.name?.toUpperCase()}_PORT', ${options.port ?? 3001});
|
|
173
174
|
|
|
@@ -289,7 +290,7 @@ DATABASE_CONNECTION=${options.database === 'isolated' ? 'postgresql' : 'shared'}
|
|
|
289
290
|
${options.database === 'isolated' ? `${options.name?.toUpperCase()}_DB_HOST=localhost\n${options.name?.toUpperCase()}_DB_DATABASE=${options.name}\n${options.name?.toUpperCase()}_DB_USER=postgres\n${options.name?.toUpperCase()}_DB_PASSWORD=postgres` : ''}
|
|
290
291
|
|
|
291
292
|
# Authentication
|
|
292
|
-
SERVICE_AUTH_STRATEGY=${options.auth
|
|
293
|
+
SERVICE_AUTH_STRATEGY=${options.auth ?? 'api-key'}
|
|
293
294
|
SERVICE_AUTH_KEY=your-auth-key-here
|
|
294
295
|
|
|
295
296
|
# Tracing
|
|
@@ -12,9 +12,14 @@ export interface Template {
|
|
|
12
12
|
files: TemplateFile[];
|
|
13
13
|
directories: string[];
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* A file that will be copied from a template source into the generated project.
|
|
17
|
+
* `path` -> destination path in the generated project
|
|
18
|
+
* `source` -> template file path (relative to the template root directory)
|
|
19
|
+
*/
|
|
15
20
|
export interface TemplateFile {
|
|
16
21
|
path: string;
|
|
17
|
-
|
|
22
|
+
source: string;
|
|
18
23
|
isTemplate?: boolean;
|
|
19
24
|
}
|
|
20
25
|
/**
|
|
@@ -22,14 +27,16 @@ export interface TemplateFile {
|
|
|
22
27
|
*/
|
|
23
28
|
export declare const TemplateEngine: Readonly<{
|
|
24
29
|
render: (content: string, variables: TemplateVariables) => string;
|
|
25
|
-
renderPath: (path: string, variables: TemplateVariables) => string;
|
|
26
30
|
renderContent: (content: string, variables: TemplateVariables) => string;
|
|
31
|
+
renderPath: (content: string, variables: TemplateVariables) => string;
|
|
27
32
|
mergeVariables: (custom: TemplateVariables, defaults: TemplateVariables) => TemplateVariables;
|
|
28
33
|
hasVariables: (content: string) => boolean;
|
|
29
34
|
extractVariables: (content: string) => string[];
|
|
30
35
|
}>;
|
|
31
36
|
/**
|
|
32
|
-
* Built-in template definitions
|
|
37
|
+
* Built-in template definitions (file-based; no inline contents)
|
|
38
|
+
*
|
|
39
|
+
* `source` paths are relative to your template root directory (wherever the CLI loader reads from).
|
|
33
40
|
*/
|
|
34
41
|
export declare const BUILT_IN_TEMPLATES: Record<string, Template>;
|
|
35
42
|
//# sourceMappingURL=TemplateEngine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateEngine.d.ts","sourceRoot":"","sources":["../../../../src/cli/scaffolding/TemplateEngine.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,iBAAiB;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CACtD;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,
|
|
1
|
+
{"version":3,"file":"TemplateEngine.d.ts","sourceRoot":"","sources":["../../../../src/cli/scaffolding/TemplateEngine.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,iBAAiB;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CACtD;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAmDD;;GAEG;AACH,eAAO,MAAM,cAAc;sBAjDM,MAAM,aAAa,iBAAiB,KAAG,MAAM;6BAA7C,MAAM,aAAa,iBAAiB,KAAG,MAAM;0BAA7C,MAAM,aAAa,iBAAiB,KAAG,MAAM;6BAiBpE,iBAAiB,YACf,iBAAiB,KAC1B,iBAAiB;4BASmB,MAAM,KAAG,OAAO;gCASZ,MAAM,KAAG,MAAM,EAAE;EAmB1D,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAgDvD,CAAC"}
|
|
@@ -16,18 +16,6 @@ const renderTemplate = (content, variables) => {
|
|
|
16
16
|
}
|
|
17
17
|
return result;
|
|
18
18
|
};
|
|
19
|
-
/**
|
|
20
|
-
* Render file path with variables
|
|
21
|
-
*/
|
|
22
|
-
const renderTemplatePath = (path, variables) => {
|
|
23
|
-
return renderTemplate(path, variables);
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Replace template variables in content
|
|
27
|
-
*/
|
|
28
|
-
const renderTemplateContent = (content, variables) => {
|
|
29
|
-
return renderTemplate(content, variables);
|
|
30
|
-
};
|
|
31
19
|
/**
|
|
32
20
|
* Get template variables with default values
|
|
33
21
|
*/
|
|
@@ -60,14 +48,16 @@ const extractTemplateVariables = (content) => {
|
|
|
60
48
|
*/
|
|
61
49
|
export const TemplateEngine = Object.freeze({
|
|
62
50
|
render: renderTemplate,
|
|
63
|
-
|
|
64
|
-
|
|
51
|
+
renderContent: renderTemplate,
|
|
52
|
+
renderPath: renderTemplate,
|
|
65
53
|
mergeVariables: mergeTemplateVariables,
|
|
66
54
|
hasVariables: hasTemplateVariables,
|
|
67
55
|
extractVariables: extractTemplateVariables,
|
|
68
56
|
});
|
|
69
57
|
/**
|
|
70
|
-
* Built-in template definitions
|
|
58
|
+
* Built-in template definitions (file-based; no inline contents)
|
|
59
|
+
*
|
|
60
|
+
* `source` paths are relative to your template root directory (wherever the CLI loader reads from).
|
|
71
61
|
*/
|
|
72
62
|
export const BUILT_IN_TEMPLATES = {
|
|
73
63
|
basic: {
|
|
@@ -85,154 +75,13 @@ export const BUILT_IN_TEMPLATES = {
|
|
|
85
75
|
'database/seeders',
|
|
86
76
|
],
|
|
87
77
|
files: [
|
|
88
|
-
{
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
"main": "dist/index.js",
|
|
96
|
-
"scripts": {
|
|
97
|
-
"dev": "tsx watch src/index.ts",
|
|
98
|
-
"test": "vitest",
|
|
99
|
-
"build": "tsc",
|
|
100
|
-
"start": "node dist/index.js"
|
|
101
|
-
},
|
|
102
|
-
"keywords": [],
|
|
103
|
-
"author": "{{author}}",
|
|
104
|
-
"license": "MIT",
|
|
105
|
-
"dependencies": {
|
|
106
|
-
"@zintrust/framework": "*"
|
|
107
|
-
},
|
|
108
|
-
"devDependencies": {
|
|
109
|
-
"typescript": "^5.3.3",
|
|
110
|
-
"tsx": "^4.6.2",
|
|
111
|
-
"vitest": "^1.1.0"
|
|
112
|
-
}
|
|
113
|
-
}`,
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
path: '.env.example',
|
|
117
|
-
isTemplate: true,
|
|
118
|
-
content: `NODE_ENV=development
|
|
119
|
-
APP_NAME={{projectName}}
|
|
120
|
-
APP_PORT={{port}}
|
|
121
|
-
APP_DEBUG=true
|
|
122
|
-
DB_CONNECTION=sqlite
|
|
123
|
-
DB_DATABASE=./database.sqlite`,
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
path: 'tsconfig.json',
|
|
127
|
-
content: `{
|
|
128
|
-
"compilerOptions": {
|
|
129
|
-
"target": "ES2022",
|
|
130
|
-
"module": "ES2022",
|
|
131
|
-
"lib": ["ES2022"],
|
|
132
|
-
"declaration": true,
|
|
133
|
-
"outDir": "./dist",
|
|
134
|
-
"rootDir": "./",
|
|
135
|
-
"baseUrl": "./",
|
|
136
|
-
"strict": true,
|
|
137
|
-
"skipLibCheck": true,
|
|
138
|
-
"esModuleInterop": true,
|
|
139
|
-
"moduleResolution": "node"
|
|
140
|
-
},
|
|
141
|
-
"include": ["src/**/*"],
|
|
142
|
-
"exclude": ["node_modules", "dist"]
|
|
143
|
-
}`,
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
path: '.gitignore',
|
|
147
|
-
content: `# Node
|
|
148
|
-
node_modules/
|
|
149
|
-
npm-debug.log
|
|
150
|
-
|
|
151
|
-
# Build
|
|
152
|
-
dist/
|
|
153
|
-
build/
|
|
154
|
-
*.tsbuildinfo
|
|
155
|
-
|
|
156
|
-
# Environment
|
|
157
|
-
.env
|
|
158
|
-
.env.local
|
|
159
|
-
.env.*.local
|
|
160
|
-
|
|
161
|
-
# IDE
|
|
162
|
-
.vscode/
|
|
163
|
-
.idea/
|
|
164
|
-
*.swp
|
|
165
|
-
*.swo
|
|
166
|
-
*~
|
|
167
|
-
.DS_Store
|
|
168
|
-
|
|
169
|
-
# Tests
|
|
170
|
-
coverage/
|
|
171
|
-
.nyc_output/
|
|
172
|
-
|
|
173
|
-
# Logs
|
|
174
|
-
logs/
|
|
175
|
-
*.log
|
|
176
|
-
|
|
177
|
-
# Database
|
|
178
|
-
*.sqlite
|
|
179
|
-
*.sqlite3
|
|
180
|
-
|
|
181
|
-
# OS
|
|
182
|
-
.DS_Store
|
|
183
|
-
Thumbs.db`,
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
path: 'README.md',
|
|
187
|
-
isTemplate: true,
|
|
188
|
-
content: `# {{projectName}}
|
|
189
|
-
|
|
190
|
-
{{projectDescription}}
|
|
191
|
-
|
|
192
|
-
## Getting Started
|
|
193
|
-
|
|
194
|
-
\`\`\`bash
|
|
195
|
-
npm install
|
|
196
|
-
npm run dev
|
|
197
|
-
\`\`\`
|
|
198
|
-
|
|
199
|
-
## Development
|
|
200
|
-
|
|
201
|
-
\`\`\`bash
|
|
202
|
-
npm run dev # Start development server
|
|
203
|
-
npm test # Run tests
|
|
204
|
-
npm run build # Build for production
|
|
205
|
-
npm start # Start production server
|
|
206
|
-
\`\`\`
|
|
207
|
-
|
|
208
|
-
## License
|
|
209
|
-
|
|
210
|
-
MIT`,
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
path: 'src/index.ts',
|
|
214
|
-
content: `import { Application } from '@zintrust/framework';
|
|
215
|
-
|
|
216
|
-
const app = new Application(__dirname);
|
|
217
|
-
|
|
218
|
-
app.boot();
|
|
219
|
-
|
|
220
|
-
export default app;`,
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
path: 'routes/api.ts',
|
|
224
|
-
content: `import { Router } from '@zintrust/routing';
|
|
225
|
-
|
|
226
|
-
const registerRoutes = (router: Router): void => {
|
|
227
|
-
router.get('/', async (req, res) => {
|
|
228
|
-
res.json({ message: 'Welcome to {{projectName}}!' });
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
router.get('/health', async (req, res) => {
|
|
232
|
-
res.json({ status: 'healthy', timestamp: new Date().toISOString() });
|
|
233
|
-
});
|
|
234
|
-
}`,
|
|
235
|
-
},
|
|
78
|
+
{ path: 'package.json', source: 'basic/package.json', isTemplate: true },
|
|
79
|
+
{ path: '.env.example', source: 'basic/.env.example', isTemplate: true },
|
|
80
|
+
{ path: 'tsconfig.json', source: 'basic/tsconfig.json' },
|
|
81
|
+
{ path: '.gitignore', source: 'basic/.gitignore' },
|
|
82
|
+
{ path: 'README.md', source: 'basic/README.md', isTemplate: true },
|
|
83
|
+
{ path: 'src/index.ts', source: 'basic/src/index.ts' },
|
|
84
|
+
{ path: 'routes/api.ts', source: 'basic/routes/api.ts', isTemplate: true },
|
|
236
85
|
],
|
|
237
86
|
},
|
|
238
87
|
api: {
|
|
@@ -252,128 +101,9 @@ const registerRoutes = (router: Router): void => {
|
|
|
252
101
|
'services',
|
|
253
102
|
],
|
|
254
103
|
files: [
|
|
255
|
-
{
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
content: `{
|
|
259
|
-
"name": "{{projectName}}",
|
|
260
|
-
"version": "1.0.0",
|
|
261
|
-
"description": "RESTful API {{projectDescription}}",
|
|
262
|
-
"main": "dist/index.js",
|
|
263
|
-
"scripts": {
|
|
264
|
-
"dev": "tsx watch src/index.ts",
|
|
265
|
-
"test": "vitest",
|
|
266
|
-
"build": "tsc",
|
|
267
|
-
"start": "node dist/index.js",
|
|
268
|
-
"microservices:generate": "zintrust microservices:generate"
|
|
269
|
-
},
|
|
270
|
-
"keywords": ["api", "rest"],
|
|
271
|
-
"author": "{{author}}",
|
|
272
|
-
"license": "MIT",
|
|
273
|
-
"dependencies": {
|
|
274
|
-
"@zintrust/framework": "*"
|
|
275
|
-
},
|
|
276
|
-
"devDependencies": {
|
|
277
|
-
"typescript": "^5.3.3",
|
|
278
|
-
"tsx": "^4.6.2",
|
|
279
|
-
"vitest": "^1.1.0"
|
|
280
|
-
}
|
|
281
|
-
}`,
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
path: '.env.example',
|
|
285
|
-
isTemplate: true,
|
|
286
|
-
content: `NODE_ENV=development
|
|
287
|
-
APP_NAME={{projectName}}
|
|
288
|
-
APP_PORT={{port}}
|
|
289
|
-
APP_DEBUG=true
|
|
290
|
-
DB_CONNECTION=postgres
|
|
291
|
-
DB_HOST=localhost
|
|
292
|
-
DB_PORT=5432
|
|
293
|
-
DB_DATABASE={{projectName}}_db
|
|
294
|
-
DB_USERNAME=postgres
|
|
295
|
-
DB_PASSWORD=password`,
|
|
296
|
-
},
|
|
297
|
-
{
|
|
298
|
-
path: 'README.md',
|
|
299
|
-
isTemplate: true,
|
|
300
|
-
content: `# {{projectName}} API
|
|
301
|
-
|
|
302
|
-
{{projectDescription}}
|
|
303
|
-
|
|
304
|
-
REST API built with Zintrust framework.
|
|
305
|
-
|
|
306
|
-
## Features
|
|
307
|
-
|
|
308
|
-
- Full REST API support
|
|
309
|
-
- PostgreSQL database
|
|
310
|
-
- User authentication
|
|
311
|
-
- Comprehensive testing
|
|
312
|
-
- Microservices ready
|
|
313
|
-
|
|
314
|
-
## Getting Started
|
|
315
|
-
|
|
316
|
-
\`\`\`bash
|
|
317
|
-
npm install
|
|
318
|
-
npm run dev
|
|
319
|
-
\`\`\`
|
|
320
|
-
|
|
321
|
-
API will be available at http://localhost:{{port}}
|
|
322
|
-
|
|
323
|
-
## API Documentation
|
|
324
|
-
|
|
325
|
-
### Health Check
|
|
326
|
-
\`GET /health\`
|
|
327
|
-
|
|
328
|
-
### Users
|
|
329
|
-
\`GET /api/users\` - List all users
|
|
330
|
-
\`POST /api/users\` - Create user
|
|
331
|
-
\`GET /api/users/:id\` - Get user
|
|
332
|
-
\`PUT /api/users/:id\` - Update user
|
|
333
|
-
\`DELETE /api/users/:id\` - Delete user
|
|
334
|
-
|
|
335
|
-
## Development
|
|
336
|
-
|
|
337
|
-
\`\`\`bash
|
|
338
|
-
npm run dev # Start development server
|
|
339
|
-
npm test # Run tests
|
|
340
|
-
npm run build # Build for production
|
|
341
|
-
npm start # Start production server
|
|
342
|
-
\`\`\`
|
|
343
|
-
|
|
344
|
-
## License
|
|
345
|
-
|
|
346
|
-
MIT`,
|
|
347
|
-
},
|
|
348
|
-
{
|
|
349
|
-
path: 'src/index.ts',
|
|
350
|
-
content: `import { Application } from '@zintrust/framework';
|
|
351
|
-
|
|
352
|
-
const app = new Application(__dirname);
|
|
353
|
-
|
|
354
|
-
// Load middleware, routes, etc.
|
|
355
|
-
app.boot();
|
|
356
|
-
|
|
357
|
-
export default app;`,
|
|
358
|
-
},
|
|
359
|
-
{
|
|
360
|
-
path: 'routes/api.ts',
|
|
361
|
-
content: `import { Router } from '@zintrust/routing';
|
|
362
|
-
|
|
363
|
-
const registerApiRoutes = (router: Router): void => {
|
|
364
|
-
router.group({ prefix: '/api/v1' }, (r) => {
|
|
365
|
-
// Health check
|
|
366
|
-
r.get('/health', async (req, res) => {
|
|
367
|
-
res.json({ status: 'healthy', timestamp: new Date().toISOString() });
|
|
368
|
-
});
|
|
369
|
-
|
|
370
|
-
// User routes would go here
|
|
371
|
-
r.get('/users', async (req, res) => {
|
|
372
|
-
res.json({ users: [] });
|
|
373
|
-
});
|
|
374
|
-
});
|
|
375
|
-
}`,
|
|
376
|
-
},
|
|
104
|
+
{ path: 'package.json', source: 'api/package.json', isTemplate: true },
|
|
105
|
+
{ path: '.env.example', source: 'api/.env.example', isTemplate: true },
|
|
106
|
+
{ path: 'README.md', source: 'api/README.md', isTemplate: true },
|
|
377
107
|
],
|
|
378
108
|
},
|
|
379
109
|
};
|
|
@@ -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"}
|
|
@@ -0,0 +1,172 @@
|
|
|
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
|
+
import { FileGenerator } from '../scaffolding/FileGenerator';
|
|
10
|
+
import { Logger } from '../../config/logger';
|
|
11
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
12
|
+
import * as path from '../../node-singletons/path';
|
|
13
|
+
const normalizeList = (items) => {
|
|
14
|
+
const out = [];
|
|
15
|
+
for (const raw of items) {
|
|
16
|
+
const v = raw.trim();
|
|
17
|
+
if (v === '')
|
|
18
|
+
continue;
|
|
19
|
+
if (!out.includes(v))
|
|
20
|
+
out.push(v);
|
|
21
|
+
}
|
|
22
|
+
return out;
|
|
23
|
+
};
|
|
24
|
+
export const TemplateGenerator = Object.freeze({
|
|
25
|
+
validateTemplateName(name) {
|
|
26
|
+
const trimmed = name.trim();
|
|
27
|
+
if (trimmed === '') {
|
|
28
|
+
throw ErrorFactory.createValidationError('Template name cannot be empty');
|
|
29
|
+
}
|
|
30
|
+
// Alphanumeric + hyphens only (case-insensitive)
|
|
31
|
+
const re = /^[a-z0-9-]+$/i;
|
|
32
|
+
if (re.exec(trimmed) === null) {
|
|
33
|
+
throw ErrorFactory.createValidationError('Template name must be alphanumeric and may include hyphens only');
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
parseVariablesCsv(csv) {
|
|
37
|
+
if (csv === undefined || csv.trim() === '')
|
|
38
|
+
return [];
|
|
39
|
+
return normalizeList(csv.split(','));
|
|
40
|
+
},
|
|
41
|
+
scaffoldMailMarkdownTemplate(options) {
|
|
42
|
+
this.validateTemplateName(options.name);
|
|
43
|
+
const variables = normalizeList(options.variables);
|
|
44
|
+
const relPath = path.join('src', 'mail', 'markdown', options.category, `${options.name}.md`);
|
|
45
|
+
const filePath = path.join(options.projectRoot, relPath);
|
|
46
|
+
const content = buildMailTemplateContent({
|
|
47
|
+
name: options.name,
|
|
48
|
+
category: options.category,
|
|
49
|
+
variables,
|
|
50
|
+
copyright: options.copyright,
|
|
51
|
+
});
|
|
52
|
+
const wrote = FileGenerator.writeFile(filePath, content, {
|
|
53
|
+
overwrite: options.overwrite === true,
|
|
54
|
+
createDirs: true,
|
|
55
|
+
});
|
|
56
|
+
if (!wrote) {
|
|
57
|
+
return {
|
|
58
|
+
success: false,
|
|
59
|
+
filePath,
|
|
60
|
+
message: `Template already exists (skipped): ${relPath}`,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
success: true,
|
|
65
|
+
filePath,
|
|
66
|
+
message: `Mail template created: ${relPath}`,
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
scaffoldNotificationMarkdownTemplate(options) {
|
|
70
|
+
this.validateTemplateName(options.name);
|
|
71
|
+
const variables = normalizeList(options.variables);
|
|
72
|
+
const channels = normalizeList(options.channels);
|
|
73
|
+
const relPath = path.join('src', 'notification', 'markdown', `${options.name}.md`);
|
|
74
|
+
const filePath = path.join(options.projectRoot, relPath);
|
|
75
|
+
const content = buildNotificationTemplateContent({
|
|
76
|
+
name: options.name,
|
|
77
|
+
channels,
|
|
78
|
+
variables,
|
|
79
|
+
smsVariant: options.smsVariant ?? 'none',
|
|
80
|
+
copyright: options.copyright,
|
|
81
|
+
});
|
|
82
|
+
const wrote = FileGenerator.writeFile(filePath, content, {
|
|
83
|
+
overwrite: options.overwrite === true,
|
|
84
|
+
createDirs: true,
|
|
85
|
+
});
|
|
86
|
+
if (!wrote) {
|
|
87
|
+
return {
|
|
88
|
+
success: false,
|
|
89
|
+
filePath,
|
|
90
|
+
message: `Template already exists (skipped): ${relPath}`,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
success: true,
|
|
95
|
+
filePath,
|
|
96
|
+
message: `Notification template created: ${relPath}`,
|
|
97
|
+
};
|
|
98
|
+
},
|
|
99
|
+
ensureDirectories(projectRoot) {
|
|
100
|
+
try {
|
|
101
|
+
// These are app-side directories, created on-demand.
|
|
102
|
+
FileGenerator.createDirectories(['src/mail/markdown', 'src/notification/markdown'], projectRoot);
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
Logger.error('Failed to ensure template directories', error);
|
|
106
|
+
throw ErrorFactory.createTryCatchError('Failed to ensure template directories', error);
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
const buildMailTemplateContent = (input) => {
|
|
111
|
+
const variablesLine = input.variables.length > 0 ? input.variables.join(', ') : '';
|
|
112
|
+
const varHint = input.variables.length > 0 ? `<!-- Variables: ${variablesLine} -->\n` : '<!-- Variables: -->\n';
|
|
113
|
+
const normalizedVars = normalizeList(input.variables);
|
|
114
|
+
const hasName = normalizedVars.includes('name');
|
|
115
|
+
const nonNameVars = normalizedVars.filter((v) => v !== 'name');
|
|
116
|
+
const dataRows = normalizedVars.map((v) => `- **${v}:** {{${v}}}`).join('\n');
|
|
117
|
+
const dataSection = normalizedVars.length > 0 ? `## Template Data\n\n${dataRows}\n\n` : '';
|
|
118
|
+
const introLine = hasName ? 'Welcome, {{name}}!' : 'Welcome!';
|
|
119
|
+
const exampleLinkVar = nonNameVars.find((v) => v.toLowerCase().includes('link'));
|
|
120
|
+
const exampleExpiryVar = nonNameVars.find((v) => v.toLowerCase().includes('expiry'));
|
|
121
|
+
const actionLine = exampleLinkVar === undefined
|
|
122
|
+
? 'Action link: (add your link here)'
|
|
123
|
+
: `Action link: {{${exampleLinkVar}}}`;
|
|
124
|
+
const expiryLine = exampleExpiryVar === undefined ? '' : `_This link expires in {{${exampleExpiryVar}}}._\n\n`;
|
|
125
|
+
// Keep content intentionally minimal and copy-paste ready.
|
|
126
|
+
// Developers can adjust links/layout and remove sections as needed.
|
|
127
|
+
return `<!-- Mail Template: ${input.name} -->
|
|
128
|
+
<!-- Category: ${input.category} -->
|
|
129
|
+
<!-- Copyright: ${input.copyright} -->
|
|
130
|
+
${varHint}
|
|
131
|
+
# ${introLine}
|
|
132
|
+
|
|
133
|
+
Thanks for reaching out. This is a scaffolded markdown template.
|
|
134
|
+
|
|
135
|
+
${dataSection}## Next Steps
|
|
136
|
+
|
|
137
|
+
- ${actionLine}
|
|
138
|
+
- Customize the sections for your product
|
|
139
|
+
|
|
140
|
+
${expiryLine}---
|
|
141
|
+
|
|
142
|
+
Questions? Contact support.
|
|
143
|
+
`;
|
|
144
|
+
};
|
|
145
|
+
const buildNotificationTemplateContent = (input) => {
|
|
146
|
+
const channelsLine = input.channels.length > 0 ? input.channels.join(', ') : '';
|
|
147
|
+
const variablesLine = input.variables.length > 0 ? input.variables.join(', ') : '';
|
|
148
|
+
const smsLine = input.smsVariant === 'short' ? '<!-- SMS Variant: short -->\n' : '';
|
|
149
|
+
const normalizedVars = normalizeList(input.variables);
|
|
150
|
+
const dataRows = normalizedVars.map((v) => `- **${v}:** {{${v}}}`).join('\n');
|
|
151
|
+
const dataSection = normalizedVars.length > 0 ? `## Template Data\n\n${dataRows}\n\n` : '';
|
|
152
|
+
const smsPreviewVars = normalizedVars.slice(0, 2);
|
|
153
|
+
const smsPreview = smsPreviewVars.length > 0
|
|
154
|
+
? smsPreviewVars.map((v) => `${v}: {{${v}}}`).join(', ')
|
|
155
|
+
: 'add variables as needed';
|
|
156
|
+
const smsVariantBlock = input.smsVariant === 'short'
|
|
157
|
+
? `\n<!-- SMS Variant Start -->\n\n${input.name}: ${smsPreview}\n\n<!-- SMS Variant End -->\n`
|
|
158
|
+
: '';
|
|
159
|
+
return `<!-- Notification Template: ${input.name} -->
|
|
160
|
+
<!-- Copyright: ${input.copyright} -->
|
|
161
|
+
<!-- Channels: ${channelsLine} -->
|
|
162
|
+
<!-- Variables: ${variablesLine} -->
|
|
163
|
+
${smsLine}
|
|
164
|
+
# Notification: ${input.name}
|
|
165
|
+
|
|
166
|
+
This is a scaffolded notification template.
|
|
167
|
+
|
|
168
|
+
${dataSection}---
|
|
169
|
+
|
|
170
|
+
Add your message content here.
|
|
171
|
+
${smsVariantBlock}`;
|
|
172
|
+
};
|
|
@@ -31,4 +31,5 @@ export { ServiceScaffolder } from '../scaffolding/ServiceScaffolder';
|
|
|
31
31
|
export type { ServiceOptions, ServiceScaffoldResult } from '../scaffolding/ServiceScaffolder';
|
|
32
32
|
export { BUILT_IN_TEMPLATES, TemplateEngine } from '../scaffolding/TemplateEngine';
|
|
33
33
|
export type { Template, TemplateFile, TemplateVariables } from '../scaffolding/TemplateEngine';
|
|
34
|
+
export { TemplateGenerator } from '../scaffolding/TemplateGenerator';
|
|
34
35
|
//# sourceMappingURL=index.d.ts.map
|