@zintrust/core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/z.d.ts +7 -0
- package/bin/z.d.ts.map +1 -0
- package/bin/z.js +6 -0
- package/bin/zin.d.ts +7 -0
- package/bin/zin.d.ts.map +1 -0
- package/bin/zin.js +6 -0
- package/bin/zintrust-microservices.d.ts +7 -0
- package/bin/zintrust-microservices.d.ts.map +1 -0
- package/bin/zintrust-microservices.js +165 -0
- package/bin/zintrust.d.ts +9 -0
- package/bin/zintrust.d.ts.map +1 -0
- package/bin/zintrust.js +51 -0
- package/bin/zt.d.ts +7 -0
- package/bin/zt.d.ts.map +1 -0
- package/bin/zt.js +6 -0
- package/package.json +80 -0
- package/src/boot/Application.d.ts +31 -0
- package/src/boot/Application.d.ts.map +1 -0
- package/src/boot/Application.js +159 -0
- package/src/boot/Server.d.ts +23 -0
- package/src/boot/Server.d.ts.map +1 -0
- package/src/boot/Server.js +236 -0
- package/src/boot/bootstrap.d.ts +7 -0
- package/src/boot/bootstrap.d.ts.map +1 -0
- package/src/boot/bootstrap.js +64 -0
- package/src/builder/BundleOptimizer.d.ts +42 -0
- package/src/builder/BundleOptimizer.d.ts.map +1 -0
- package/src/builder/BundleOptimizer.js +356 -0
- package/src/cache/Cache.d.ts +26 -0
- package/src/cache/Cache.d.ts.map +1 -0
- package/src/cache/Cache.js +89 -0
- package/src/cache/CacheDriver.d.ts +28 -0
- package/src/cache/CacheDriver.d.ts.map +1 -0
- package/src/cache/CacheDriver.js +6 -0
- package/src/cache/drivers/KVDriver.d.ts +12 -0
- package/src/cache/drivers/KVDriver.d.ts.map +1 -0
- package/src/cache/drivers/KVDriver.js +54 -0
- package/src/cache/drivers/MemoryDriver.d.ts +12 -0
- package/src/cache/drivers/MemoryDriver.d.ts.map +1 -0
- package/src/cache/drivers/MemoryDriver.js +50 -0
- package/src/cache/drivers/MongoDriver.d.ts +17 -0
- package/src/cache/drivers/MongoDriver.d.ts.map +1 -0
- package/src/cache/drivers/MongoDriver.js +80 -0
- package/src/cache/drivers/RedisDriver.d.ts +12 -0
- package/src/cache/drivers/RedisDriver.d.ts.map +1 -0
- package/src/cache/drivers/RedisDriver.js +79 -0
- package/src/cli/BaseCommand.d.ts +39 -0
- package/src/cli/BaseCommand.d.ts.map +1 -0
- package/src/cli/BaseCommand.js +58 -0
- package/src/cli/CLI.d.ts +21 -0
- package/src/cli/CLI.d.ts.map +1 -0
- package/src/cli/CLI.js +203 -0
- package/src/cli/ErrorHandler.d.ts +23 -0
- package/src/cli/ErrorHandler.d.ts.map +1 -0
- package/src/cli/ErrorHandler.js +95 -0
- package/src/cli/PromptHelper.d.ts +47 -0
- package/src/cli/PromptHelper.d.ts.map +1 -0
- package/src/cli/PromptHelper.js +155 -0
- package/src/cli/commands/AddCommand.d.ts +15 -0
- package/src/cli/commands/AddCommand.d.ts.map +1 -0
- package/src/cli/commands/AddCommand.js +817 -0
- package/src/cli/commands/ConfigCommand.d.ts +15 -0
- package/src/cli/commands/ConfigCommand.d.ts.map +1 -0
- package/src/cli/commands/ConfigCommand.js +273 -0
- package/src/cli/commands/D1MigrateCommand.d.ts +15 -0
- package/src/cli/commands/D1MigrateCommand.d.ts.map +1 -0
- package/src/cli/commands/D1MigrateCommand.js +73 -0
- package/src/cli/commands/DebugCommand.d.ts +15 -0
- package/src/cli/commands/DebugCommand.d.ts.map +1 -0
- package/src/cli/commands/DebugCommand.js +52 -0
- package/src/cli/commands/FixCommand.d.ts +15 -0
- package/src/cli/commands/FixCommand.d.ts.map +1 -0
- package/src/cli/commands/FixCommand.js +80 -0
- package/src/cli/commands/KeyGenerateCommand.d.ts +9 -0
- package/src/cli/commands/KeyGenerateCommand.d.ts.map +1 -0
- package/src/cli/commands/KeyGenerateCommand.js +76 -0
- package/src/cli/commands/LogsCommand.d.ts +19 -0
- package/src/cli/commands/LogsCommand.d.ts.map +1 -0
- package/src/cli/commands/LogsCommand.js +185 -0
- package/src/cli/commands/MigrateCommand.d.ts +15 -0
- package/src/cli/commands/MigrateCommand.d.ts.map +1 -0
- package/src/cli/commands/MigrateCommand.js +56 -0
- package/src/cli/commands/NewCommand.d.ts +32 -0
- package/src/cli/commands/NewCommand.d.ts.map +1 -0
- package/src/cli/commands/NewCommand.js +280 -0
- package/src/cli/commands/PluginCommand.d.ts +9 -0
- package/src/cli/commands/PluginCommand.d.ts.map +1 -0
- package/src/cli/commands/PluginCommand.js +94 -0
- package/src/cli/commands/PrepareCommand.d.ts +8 -0
- package/src/cli/commands/PrepareCommand.d.ts.map +1 -0
- package/src/cli/commands/PrepareCommand.js +51 -0
- package/src/cli/commands/QACommand.d.ts +33 -0
- package/src/cli/commands/QACommand.d.ts.map +1 -0
- package/src/cli/commands/QACommand.js +490 -0
- package/src/cli/commands/SimulateCommand.d.ts +12 -0
- package/src/cli/commands/SimulateCommand.d.ts.map +1 -0
- package/src/cli/commands/SimulateCommand.js +79 -0
- package/src/cli/commands/StartCommand.d.ts +5 -0
- package/src/cli/commands/StartCommand.d.ts.map +1 -0
- package/src/cli/commands/StartCommand.js +227 -0
- package/src/cli/commands/index.d.ts +11 -0
- package/src/cli/commands/index.d.ts.map +1 -0
- package/src/cli/commands/index.js +10 -0
- package/src/cli/config/ConfigManager.d.ts +42 -0
- package/src/cli/config/ConfigManager.d.ts.map +1 -0
- package/src/cli/config/ConfigManager.js +175 -0
- package/src/cli/config/ConfigSchema.d.ts +195 -0
- package/src/cli/config/ConfigSchema.d.ts.map +1 -0
- package/src/cli/config/ConfigSchema.js +171 -0
- package/src/cli/config/ConfigValidator.d.ts +41 -0
- package/src/cli/config/ConfigValidator.d.ts.map +1 -0
- package/src/cli/config/ConfigValidator.js +200 -0
- package/src/cli/config/index.d.ts +8 -0
- package/src/cli/config/index.d.ts.map +1 -0
- package/src/cli/config/index.js +7 -0
- package/src/cli/debug/Dashboard.d.ts +34 -0
- package/src/cli/debug/Dashboard.d.ts.map +1 -0
- package/src/cli/debug/Dashboard.js +152 -0
- package/src/cli/index.d.ts +14 -0
- package/src/cli/index.d.ts.map +1 -0
- package/src/cli/index.js +14 -0
- package/src/cli/logger/Logger.d.ts +43 -0
- package/src/cli/logger/Logger.d.ts.map +1 -0
- package/src/cli/logger/Logger.js +137 -0
- package/src/cli/scaffolding/ControllerGenerator.d.ts +44 -0
- package/src/cli/scaffolding/ControllerGenerator.d.ts.map +1 -0
- package/src/cli/scaffolding/ControllerGenerator.js +540 -0
- package/src/cli/scaffolding/FactoryGenerator.d.ts +47 -0
- package/src/cli/scaffolding/FactoryGenerator.d.ts.map +1 -0
- package/src/cli/scaffolding/FactoryGenerator.js +356 -0
- package/src/cli/scaffolding/FeatureScaffolder.d.ts +40 -0
- package/src/cli/scaffolding/FeatureScaffolder.d.ts.map +1 -0
- package/src/cli/scaffolding/FeatureScaffolder.js +747 -0
- package/src/cli/scaffolding/FileGenerator.d.ts +31 -0
- package/src/cli/scaffolding/FileGenerator.d.ts.map +1 -0
- package/src/cli/scaffolding/FileGenerator.js +222 -0
- package/src/cli/scaffolding/MigrationGenerator.d.ts +35 -0
- package/src/cli/scaffolding/MigrationGenerator.d.ts.map +1 -0
- package/src/cli/scaffolding/MigrationGenerator.js +257 -0
- package/src/cli/scaffolding/ModelGenerator.d.ts +81 -0
- package/src/cli/scaffolding/ModelGenerator.d.ts.map +1 -0
- package/src/cli/scaffolding/ModelGenerator.js +249 -0
- package/src/cli/scaffolding/ProjectScaffolder.d.ts +66 -0
- package/src/cli/scaffolding/ProjectScaffolder.d.ts.map +1 -0
- package/src/cli/scaffolding/ProjectScaffolder.js +439 -0
- package/src/cli/scaffolding/RequestFactoryGenerator.d.ts +50 -0
- package/src/cli/scaffolding/RequestFactoryGenerator.d.ts.map +1 -0
- package/src/cli/scaffolding/RequestFactoryGenerator.js +465 -0
- package/src/cli/scaffolding/ResponseFactoryGenerator.d.ts +43 -0
- package/src/cli/scaffolding/ResponseFactoryGenerator.d.ts.map +1 -0
- package/src/cli/scaffolding/ResponseFactoryGenerator.js +321 -0
- package/src/cli/scaffolding/RouteGenerator.d.ts +66 -0
- package/src/cli/scaffolding/RouteGenerator.d.ts.map +1 -0
- package/src/cli/scaffolding/RouteGenerator.js +306 -0
- package/src/cli/scaffolding/SeederGenerator.d.ts +47 -0
- package/src/cli/scaffolding/SeederGenerator.d.ts.map +1 -0
- package/src/cli/scaffolding/SeederGenerator.js +286 -0
- package/src/cli/scaffolding/ServiceIntegrationTestGenerator.d.ts +40 -0
- package/src/cli/scaffolding/ServiceIntegrationTestGenerator.d.ts.map +1 -0
- package/src/cli/scaffolding/ServiceIntegrationTestGenerator.js +267 -0
- package/src/cli/scaffolding/ServiceRequestFactoryGenerator.d.ts +45 -0
- package/src/cli/scaffolding/ServiceRequestFactoryGenerator.d.ts.map +1 -0
- package/src/cli/scaffolding/ServiceRequestFactoryGenerator.js +397 -0
- package/src/cli/scaffolding/ServiceScaffolder.d.ts +45 -0
- package/src/cli/scaffolding/ServiceScaffolder.d.ts.map +1 -0
- package/src/cli/scaffolding/ServiceScaffolder.js +367 -0
- package/src/cli/scaffolding/TemplateEngine.d.ts +35 -0
- package/src/cli/scaffolding/TemplateEngine.d.ts.map +1 -0
- package/src/cli/scaffolding/TemplateEngine.js +379 -0
- package/src/cli/scaffolding/WorkflowGenerator.d.ts +31 -0
- package/src/cli/scaffolding/WorkflowGenerator.d.ts.map +1 -0
- package/src/cli/scaffolding/WorkflowGenerator.js +193 -0
- package/src/cli/scaffolding/index.d.ts +34 -0
- package/src/cli/scaffolding/index.d.ts.map +1 -0
- package/src/cli/scaffolding/index.js +18 -0
- package/src/cli/utils/DistPackager.d.ts +8 -0
- package/src/cli/utils/DistPackager.d.ts.map +1 -0
- package/src/cli/utils/DistPackager.js +94 -0
- package/src/cli/utils/EnvFileLoader.d.ts +21 -0
- package/src/cli/utils/EnvFileLoader.d.ts.map +1 -0
- package/src/cli/utils/EnvFileLoader.js +166 -0
- package/src/cli/utils/spawn.d.ts +11 -0
- package/src/cli/utils/spawn.d.ts.map +1 -0
- package/src/cli/utils/spawn.js +81 -0
- package/src/common/index.d.ts +87 -0
- package/src/common/index.d.ts.map +1 -0
- package/src/common/index.js +207 -0
- package/src/config/SecretsManager.d.ts +122 -0
- package/src/config/SecretsManager.d.ts.map +1 -0
- package/src/config/SecretsManager.js +328 -0
- package/src/config/app.d.ts +56 -0
- package/src/config/app.d.ts.map +1 -0
- package/src/config/app.js +77 -0
- package/src/config/cache.d.ts +76 -0
- package/src/config/cache.d.ts.map +1 -0
- package/src/config/cache.js +62 -0
- package/src/config/constants.d.ts +108 -0
- package/src/config/constants.d.ts.map +1 -0
- package/src/config/constants.js +64 -0
- package/src/config/database.d.ts +122 -0
- package/src/config/database.d.ts.map +1 -0
- package/src/config/database.js +89 -0
- package/src/config/env.d.ts +56 -0
- package/src/config/env.d.ts.map +1 -0
- package/src/config/env.js +133 -0
- package/src/config/features.d.ts +27 -0
- package/src/config/features.d.ts.map +1 -0
- package/src/config/features.js +49 -0
- package/src/config/index.d.ts +554 -0
- package/src/config/index.d.ts.map +1 -0
- package/src/config/index.js +31 -0
- package/src/config/logger.d.ts +17 -0
- package/src/config/logger.d.ts.map +1 -0
- package/src/config/logger.js +77 -0
- package/src/config/microservices.d.ts +88 -0
- package/src/config/microservices.d.ts.map +1 -0
- package/src/config/microservices.js +90 -0
- package/src/config/queue.d.ts +107 -0
- package/src/config/queue.d.ts.map +1 -0
- package/src/config/queue.js +74 -0
- package/src/config/security.d.ts +108 -0
- package/src/config/security.d.ts.map +1 -0
- package/src/config/security.js +134 -0
- package/src/config/storage.d.ts +105 -0
- package/src/config/storage.d.ts.map +1 -0
- package/src/config/storage.js +79 -0
- package/src/container/ServiceContainer.d.ts +25 -0
- package/src/container/ServiceContainer.d.ts.map +1 -0
- package/src/container/ServiceContainer.js +75 -0
- package/src/database/migrations/index.d.ts +2 -0
- package/src/database/migrations/index.d.ts.map +1 -0
- package/src/database/migrations/index.js +1 -0
- package/src/exceptions/ZintrustError.d.ts +88 -0
- package/src/exceptions/ZintrustError.d.ts.map +1 -0
- package/src/exceptions/ZintrustError.js +110 -0
- package/src/features/Auth.d.ts +20 -0
- package/src/features/Auth.d.ts.map +1 -0
- package/src/features/Auth.js +32 -0
- package/src/features/Queue.d.ts +21 -0
- package/src/features/Queue.d.ts.map +1 -0
- package/src/features/Queue.js +59 -0
- package/src/functions/cloudflare.d.ts +5 -0
- package/src/functions/cloudflare.d.ts.map +1 -0
- package/src/functions/cloudflare.js +34 -0
- package/src/functions/deno.d.ts +3 -0
- package/src/functions/deno.d.ts.map +1 -0
- package/src/functions/deno.js +31 -0
- package/src/functions/lambda.d.ts +2 -0
- package/src/functions/lambda.d.ts.map +1 -0
- package/src/functions/lambda.js +32 -0
- package/src/http/Controller.d.ts +20 -0
- package/src/http/Controller.d.ts.map +1 -0
- package/src/http/Controller.js +46 -0
- package/src/http/Kernel.d.ts +24 -0
- package/src/http/Kernel.d.ts.map +1 -0
- package/src/http/Kernel.js +72 -0
- package/src/http/Request.d.ts +36 -0
- package/src/http/Request.d.ts.map +1 -0
- package/src/http/Request.js +142 -0
- package/src/http/Response.d.ts +32 -0
- package/src/http/Response.d.ts.map +1 -0
- package/src/http/Response.js +70 -0
- package/src/index.d.ts +43 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +37 -0
- package/src/microservices/MicroserviceBootstrap.d.ts +75 -0
- package/src/microservices/MicroserviceBootstrap.d.ts.map +1 -0
- package/src/microservices/MicroserviceBootstrap.js +285 -0
- package/src/microservices/MicroserviceGenerator.d.ts +27 -0
- package/src/microservices/MicroserviceGenerator.d.ts.map +1 -0
- package/src/microservices/MicroserviceGenerator.js +436 -0
- package/src/microservices/MicroserviceManager.d.ts +68 -0
- package/src/microservices/MicroserviceManager.d.ts.map +1 -0
- package/src/microservices/MicroserviceManager.js +266 -0
- package/src/microservices/PostgresAdapter.d.ts +90 -0
- package/src/microservices/PostgresAdapter.d.ts.map +1 -0
- package/src/microservices/PostgresAdapter.js +286 -0
- package/src/microservices/RequestTracingMiddleware.d.ts +41 -0
- package/src/microservices/RequestTracingMiddleware.d.ts.map +1 -0
- package/src/microservices/RequestTracingMiddleware.js +122 -0
- package/src/microservices/ServiceAuthMiddleware.d.ts +58 -0
- package/src/microservices/ServiceAuthMiddleware.d.ts.map +1 -0
- package/src/microservices/ServiceAuthMiddleware.js +240 -0
- package/src/microservices/ServiceBundler.d.ts +45 -0
- package/src/microservices/ServiceBundler.d.ts.map +1 -0
- package/src/microservices/ServiceBundler.js +297 -0
- package/src/microservices/ServiceHealthMonitor.d.ts +96 -0
- package/src/microservices/ServiceHealthMonitor.d.ts.map +1 -0
- package/src/microservices/ServiceHealthMonitor.js +379 -0
- package/src/middleware/CsrfMiddleware.d.ts +19 -0
- package/src/middleware/CsrfMiddleware.d.ts.map +1 -0
- package/src/middleware/CsrfMiddleware.js +121 -0
- package/src/middleware/MiddlewareStack.d.ts +27 -0
- package/src/middleware/MiddlewareStack.d.ts.map +1 -0
- package/src/middleware/MiddlewareStack.js +43 -0
- package/src/middleware/RateLimiter.d.ts +22 -0
- package/src/middleware/RateLimiter.d.ts.map +1 -0
- package/src/middleware/RateLimiter.js +72 -0
- package/src/middleware/SecurityMiddleware.d.ts +33 -0
- package/src/middleware/SecurityMiddleware.d.ts.map +1 -0
- package/src/middleware/SecurityMiddleware.js +106 -0
- package/src/middleware/index.d.ts +9 -0
- package/src/middleware/index.d.ts.map +1 -0
- package/src/middleware/index.js +8 -0
- package/src/node-singletons/child-process.d.ts +7 -0
- package/src/node-singletons/child-process.d.ts.map +1 -0
- package/src/node-singletons/child-process.js +6 -0
- package/src/node-singletons/crypto.d.ts +7 -0
- package/src/node-singletons/crypto.d.ts.map +1 -0
- package/src/node-singletons/crypto.js +6 -0
- package/src/node-singletons/events.d.ts +7 -0
- package/src/node-singletons/events.d.ts.map +1 -0
- package/src/node-singletons/events.js +6 -0
- package/src/node-singletons/fs.d.ts +12 -0
- package/src/node-singletons/fs.d.ts.map +1 -0
- package/src/node-singletons/fs.js +14 -0
- package/src/node-singletons/http.d.ts +8 -0
- package/src/node-singletons/http.d.ts.map +1 -0
- package/src/node-singletons/http.js +6 -0
- package/src/node-singletons/index.d.ts +30 -0
- package/src/node-singletons/index.d.ts.map +1 -0
- package/src/node-singletons/index.js +31 -0
- package/src/node-singletons/os.d.ts +9 -0
- package/src/node-singletons/os.d.ts.map +1 -0
- package/src/node-singletons/os.js +9 -0
- package/src/node-singletons/path.d.ts +7 -0
- package/src/node-singletons/path.d.ts.map +1 -0
- package/src/node-singletons/path.js +6 -0
- package/src/node-singletons/perf-hooks.d.ts +7 -0
- package/src/node-singletons/perf-hooks.d.ts.map +1 -0
- package/src/node-singletons/perf-hooks.js +6 -0
- package/src/node-singletons/readline.d.ts +10 -0
- package/src/node-singletons/readline.d.ts.map +1 -0
- package/src/node-singletons/readline.js +9 -0
- package/src/node-singletons/url.d.ts +7 -0
- package/src/node-singletons/url.d.ts.map +1 -0
- package/src/node-singletons/url.js +6 -0
- package/src/orm/ConnectionManager.d.ts +118 -0
- package/src/orm/ConnectionManager.d.ts.map +1 -0
- package/src/orm/ConnectionManager.js +401 -0
- package/src/orm/Database.d.ts +31 -0
- package/src/orm/Database.d.ts.map +1 -0
- package/src/orm/Database.js +163 -0
- package/src/orm/DatabaseAdapter.d.ts +96 -0
- package/src/orm/DatabaseAdapter.d.ts.map +1 -0
- package/src/orm/DatabaseAdapter.js +40 -0
- package/src/orm/Model.d.ts +91 -0
- package/src/orm/Model.d.ts.map +1 -0
- package/src/orm/Model.js +206 -0
- package/src/orm/QueryBuilder.d.ts +52 -0
- package/src/orm/QueryBuilder.d.ts.map +1 -0
- package/src/orm/QueryBuilder.js +134 -0
- package/src/orm/Relationships.d.ts +53 -0
- package/src/orm/Relationships.d.ts.map +1 -0
- package/src/orm/Relationships.js +98 -0
- package/src/orm/Schema.d.ts +123 -0
- package/src/orm/Schema.d.ts.map +1 -0
- package/src/orm/Schema.js +169 -0
- package/src/orm/adapters/D1Adapter.d.ts +15 -0
- package/src/orm/adapters/D1Adapter.d.ts.map +1 -0
- package/src/orm/adapters/D1Adapter.js +125 -0
- package/src/orm/adapters/MySQLAdapter.d.ts +16 -0
- package/src/orm/adapters/MySQLAdapter.d.ts.map +1 -0
- package/src/orm/adapters/MySQLAdapter.js +87 -0
- package/src/orm/adapters/PostgreSQLAdapter.d.ts +16 -0
- package/src/orm/adapters/PostgreSQLAdapter.d.ts.map +1 -0
- package/src/orm/adapters/PostgreSQLAdapter.js +87 -0
- package/src/orm/adapters/SQLServerAdapter.d.ts +16 -0
- package/src/orm/adapters/SQLServerAdapter.d.ts.map +1 -0
- package/src/orm/adapters/SQLServerAdapter.js +81 -0
- package/src/orm/adapters/SQLiteAdapter.d.ts +11 -0
- package/src/orm/adapters/SQLiteAdapter.d.ts.map +1 -0
- package/src/orm/adapters/SQLiteAdapter.js +131 -0
- package/src/performance/Benchmark.d.ts +87 -0
- package/src/performance/Benchmark.d.ts.map +1 -0
- package/src/performance/Benchmark.js +304 -0
- package/src/performance/CodeGenerationBenchmark.d.ts +23 -0
- package/src/performance/CodeGenerationBenchmark.d.ts.map +1 -0
- package/src/performance/CodeGenerationBenchmark.js +249 -0
- package/src/performance/Optimizer.d.ts +99 -0
- package/src/performance/Optimizer.d.ts.map +1 -0
- package/src/performance/Optimizer.js +396 -0
- package/src/performance/establish-baseline.d.ts +9 -0
- package/src/performance/establish-baseline.d.ts.map +1 -0
- package/src/performance/establish-baseline.js +55 -0
- package/src/profiling/MemoryProfiler.d.ts +32 -0
- package/src/profiling/MemoryProfiler.d.ts.map +1 -0
- package/src/profiling/MemoryProfiler.js +84 -0
- package/src/profiling/N1Detector.d.ts +16 -0
- package/src/profiling/N1Detector.d.ts.map +1 -0
- package/src/profiling/N1Detector.js +120 -0
- package/src/profiling/QueryLogger.d.ts +107 -0
- package/src/profiling/QueryLogger.d.ts.map +1 -0
- package/src/profiling/QueryLogger.js +148 -0
- package/src/profiling/RequestProfiler.d.ts +30 -0
- package/src/profiling/RequestProfiler.d.ts.map +1 -0
- package/src/profiling/RequestProfiler.js +94 -0
- package/src/profiling/types.d.ts +77 -0
- package/src/profiling/types.d.ts.map +1 -0
- package/src/profiling/types.js +5 -0
- package/src/routing/Router.d.ts +52 -0
- package/src/routing/Router.d.ts.map +1 -0
- package/src/routing/Router.js +191 -0
- package/src/runtime/PluginManager.d.ts +30 -0
- package/src/runtime/PluginManager.d.ts.map +1 -0
- package/src/runtime/PluginManager.js +197 -0
- package/src/runtime/PluginRegistry.d.ts +22 -0
- package/src/runtime/PluginRegistry.d.ts.map +1 -0
- package/src/runtime/PluginRegistry.js +93 -0
- package/src/runtime/RuntimeAdapter.d.ts +126 -0
- package/src/runtime/RuntimeAdapter.d.ts.map +1 -0
- package/src/runtime/RuntimeAdapter.js +127 -0
- package/src/runtime/RuntimeDetector.d.ts +15 -0
- package/src/runtime/RuntimeDetector.d.ts.map +1 -0
- package/src/runtime/RuntimeDetector.js +219 -0
- package/src/runtime/adapters/CloudflareAdapter.d.ts +43 -0
- package/src/runtime/adapters/CloudflareAdapter.d.ts.map +1 -0
- package/src/runtime/adapters/CloudflareAdapter.js +175 -0
- package/src/runtime/adapters/DenoAdapter.d.ts +30 -0
- package/src/runtime/adapters/DenoAdapter.d.ts.map +1 -0
- package/src/runtime/adapters/DenoAdapter.js +191 -0
- package/src/runtime/adapters/FargateAdapter.d.ts +40 -0
- package/src/runtime/adapters/FargateAdapter.d.ts.map +1 -0
- package/src/runtime/adapters/FargateAdapter.js +156 -0
- package/src/runtime/adapters/LambdaAdapter.d.ts +13 -0
- package/src/runtime/adapters/LambdaAdapter.d.ts.map +1 -0
- package/src/runtime/adapters/LambdaAdapter.js +302 -0
- package/src/runtime/adapters/NodeServerAdapter.d.ts +16 -0
- package/src/runtime/adapters/NodeServerAdapter.d.ts.map +1 -0
- package/src/runtime/adapters/NodeServerAdapter.js +199 -0
- package/src/scripts/TemplateSync.d.ts +7 -0
- package/src/scripts/TemplateSync.d.ts.map +1 -0
- package/src/scripts/TemplateSync.js +234 -0
- package/src/security/CsrfTokenManager.d.ts +28 -0
- package/src/security/CsrfTokenManager.d.ts.map +1 -0
- package/src/security/CsrfTokenManager.js +78 -0
- package/src/security/Encryptor.d.ts +15 -0
- package/src/security/Encryptor.d.ts.map +1 -0
- package/src/security/Encryptor.js +142 -0
- package/src/security/JwtManager.d.ts +41 -0
- package/src/security/JwtManager.d.ts.map +1 -0
- package/src/security/JwtManager.js +229 -0
- package/src/security/UrlValidator.d.ts +21 -0
- package/src/security/UrlValidator.d.ts.map +1 -0
- package/src/security/UrlValidator.js +42 -0
- package/src/security/XssProtection.d.ts +24 -0
- package/src/security/XssProtection.d.ts.map +1 -0
- package/src/security/XssProtection.js +133 -0
- package/src/templates/TemplateRegistry.d.ts +40 -0
- package/src/templates/TemplateRegistry.d.ts.map +1 -0
- package/src/templates/TemplateRegistry.js +78 -0
- package/src/templates/TemplateRegistry.ts +91 -0
- package/src/templates/adapters/MySQLAdapter.ts.tpl +97 -0
- package/src/templates/adapters/PostgreSQLAdapter.ts.tpl +101 -0
- package/src/templates/adapters/SQLServerAdapter.ts.tpl +95 -0
- package/src/templates/adapters/SQLiteAdapter.ts.tpl +189 -0
- package/src/templates/features/Auth.ts.tpl +40 -0
- package/src/templates/features/Queue.ts.tpl +75 -0
- package/src/templates/project/basic/.env.example.tpl +26 -0
- package/src/templates/project/basic/.env.tpl +164 -0
- package/src/templates/project/basic/README.md.tpl +13 -0
- package/src/templates/project/basic/app/Controllers/UserController.ts.tpl +155 -0
- package/src/templates/project/basic/app/Middleware/ProfilerMiddleware.ts.tpl +55 -0
- package/src/templates/project/basic/app/Middleware/index.ts.tpl +304 -0
- package/src/templates/project/basic/app/Models/Post.ts.tpl +30 -0
- package/src/templates/project/basic/app/Models/User.ts.tpl +53 -0
- package/src/templates/project/basic/config/SecretsManager.ts.tpl +453 -0
- package/src/templates/project/basic/config/app.ts.tpl +97 -0
- package/src/templates/project/basic/config/cache.ts.tpl +117 -0
- package/src/templates/project/basic/config/constants.ts.tpl +70 -0
- package/src/templates/project/basic/config/database.ts.tpl +152 -0
- package/src/templates/project/basic/config/env.ts.tpl +148 -0
- package/src/templates/project/basic/config/features.ts.tpl +57 -0
- package/src/templates/project/basic/config/index.ts.tpl +36 -0
- package/src/templates/project/basic/config/logger.ts.tpl +95 -0
- package/src/templates/project/basic/config/microservices.ts.tpl +104 -0
- package/src/templates/project/basic/config/queue.ts.tpl +134 -0
- package/src/templates/project/basic/config/security.ts.tpl +149 -0
- package/src/templates/project/basic/config/storage.ts.tpl +136 -0
- package/src/templates/project/basic/database/factories/.gitkeep.tpl +0 -0
- package/src/templates/project/basic/database/migrations/.gitkeep.tpl +0 -0
- package/src/templates/project/basic/database/migrations/index.ts.tpl +2 -0
- package/src/templates/project/basic/database/seeders/.gitkeep.tpl +0 -0
- package/src/templates/project/basic/package.json.tpl +22 -0
- package/src/templates/project/basic/routes/api.ts.tpl +135 -0
- package/src/templates/project/basic/src/index.ts.tpl +49 -0
- package/src/templates/project/basic/template.json +17 -0
- package/src/templates/project/basic/tsconfig.json.tpl +20 -0
- package/src/validation/ValidationError.d.ts +42 -0
- package/src/validation/ValidationError.d.ts.map +1 -0
- package/src/validation/ValidationError.js +53 -0
- package/src/validation/Validator.d.ts +60 -0
- package/src/validation/Validator.d.ts.map +1 -0
- package/src/validation/Validator.js +190 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config Command - Configuration management CLI command
|
|
3
|
+
* Handles configuration operations: get, set, list, reset, edit, export
|
|
4
|
+
*/
|
|
5
|
+
import { IBaseCommand } from '../BaseCommand';
|
|
6
|
+
/**
|
|
7
|
+
* Config Command Factory
|
|
8
|
+
*/
|
|
9
|
+
export declare const ConfigCommand: Readonly<{
|
|
10
|
+
/**
|
|
11
|
+
* Create a new config command instance
|
|
12
|
+
*/
|
|
13
|
+
create(): IBaseCommand;
|
|
14
|
+
}>;
|
|
15
|
+
//# sourceMappingURL=ConfigCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/ConfigCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAA+B,YAAY,EAAE,MAAM,kBAAkB,CAAC;AA2T7E;;GAEG;AACH,eAAO,MAAM,aAAa;IACxB;;OAEG;cACO,YAAY;EA4EtB,CAAC"}
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config Command - Configuration management CLI command
|
|
3
|
+
* Handles configuration operations: get, set, list, reset, edit, export
|
|
4
|
+
*/
|
|
5
|
+
import { BaseCommand } from '../BaseCommand';
|
|
6
|
+
import { ConfigManager } from '../config/ConfigManager';
|
|
7
|
+
import { ConfigValidator } from '../config/ConfigValidator';
|
|
8
|
+
import { ErrorHandler } from '../ErrorHandler';
|
|
9
|
+
import { PromptHelper } from '../PromptHelper';
|
|
10
|
+
import { Logger } from '../../config/logger';
|
|
11
|
+
import chalk from 'chalk';
|
|
12
|
+
const addOptions = (command) => {
|
|
13
|
+
command.argument('[action]', 'Action: get, set, list, reset, edit, export');
|
|
14
|
+
command.argument('[key]', 'Configuration key (for get/set)');
|
|
15
|
+
command.argument('[value]', 'Configuration value (for set)');
|
|
16
|
+
command.option('--global', 'Use global config instead of project config');
|
|
17
|
+
command.option('--json', 'Output as JSON');
|
|
18
|
+
command.option('--show-defaults', 'Show default values in list');
|
|
19
|
+
};
|
|
20
|
+
const getGlobalConfigManager = async () => ConfigManager.getGlobalConfig();
|
|
21
|
+
const getProjectConfigManager = async () => ConfigManager.getProjectConfig();
|
|
22
|
+
const formatConfigValue = (value) => {
|
|
23
|
+
if (value === undefined || value === null)
|
|
24
|
+
return chalk.gray('null');
|
|
25
|
+
if (typeof value === 'object')
|
|
26
|
+
return JSON.stringify(value, null, 2);
|
|
27
|
+
if (typeof value === 'boolean')
|
|
28
|
+
return value ? chalk.green('true') : chalk.red('false');
|
|
29
|
+
if (typeof value === 'number')
|
|
30
|
+
return chalk.yellow(value.toString());
|
|
31
|
+
return String(value);
|
|
32
|
+
};
|
|
33
|
+
const parseConfigValue = (value) => {
|
|
34
|
+
if (value === undefined)
|
|
35
|
+
return undefined;
|
|
36
|
+
if (value === '')
|
|
37
|
+
return '';
|
|
38
|
+
const lower = value.toLowerCase();
|
|
39
|
+
if (lower === 'true')
|
|
40
|
+
return true;
|
|
41
|
+
if (lower === 'false')
|
|
42
|
+
return false;
|
|
43
|
+
if (lower === 'null')
|
|
44
|
+
return null;
|
|
45
|
+
if (/^-?\d+$/.test(value))
|
|
46
|
+
return Number.parseInt(value, 10);
|
|
47
|
+
if (/^-?\d+\.\d+$/.test(value))
|
|
48
|
+
return Number.parseFloat(value);
|
|
49
|
+
if (value.startsWith('{') || value.startsWith('[')) {
|
|
50
|
+
try {
|
|
51
|
+
return JSON.parse(value);
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
Logger.error('Failed to parse JSON config value', error);
|
|
55
|
+
return value;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return value;
|
|
59
|
+
};
|
|
60
|
+
const displayValidationStatus = (cmd, config) => {
|
|
61
|
+
const validation = ConfigValidator.validate(config);
|
|
62
|
+
if (validation?.valid === true) {
|
|
63
|
+
cmd.info(chalk.green(' ✅ Configuration is valid'));
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const errors = validation?.errors ?? [];
|
|
67
|
+
cmd.info(chalk.red(` ❌ Configuration has ${errors.length} errors:`));
|
|
68
|
+
for (const error of errors) {
|
|
69
|
+
cmd.info(chalk.red(` - ${error}`));
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const displayConfigurationKeys = (cmd, keys) => {
|
|
73
|
+
const sorted = keys.slice().sort((a, b) => a.localeCompare(b));
|
|
74
|
+
cmd.info(chalk.cyan('\n Available Keys:'));
|
|
75
|
+
for (const key of sorted) {
|
|
76
|
+
cmd.info(` • ${key}`);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const displayConfigurationValues = (cmd, config) => {
|
|
80
|
+
cmd.info('');
|
|
81
|
+
const entries = Object.entries(config).sort(([a], [b]) => a.localeCompare(b));
|
|
82
|
+
for (const [key, value] of entries) {
|
|
83
|
+
cmd.info(`${chalk.cyan(key)}: ${formatConfigValue(value)}`);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
const handleGet = async (cmd, manager, key) => {
|
|
87
|
+
if (key === undefined) {
|
|
88
|
+
ErrorHandler.usageError('Configuration key is required for "get"');
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (typeof manager.get !== 'function') {
|
|
92
|
+
cmd.warn('Configuration manager does not support "get"');
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const value = manager.get(key);
|
|
96
|
+
if (value === undefined) {
|
|
97
|
+
cmd.warn(`Configuration key "${key}" not found`);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
cmd.info(formatConfigValue(value));
|
|
101
|
+
};
|
|
102
|
+
const handleSet = async (cmd, manager, key, value) => {
|
|
103
|
+
if (key === undefined || value === undefined) {
|
|
104
|
+
ErrorHandler.usageError('Both key and value are required for "set"');
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (typeof manager.set !== 'function') {
|
|
108
|
+
cmd.warn('Configuration manager does not support "set"');
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const parsedValue = parseConfigValue(value);
|
|
112
|
+
const validationError = ConfigValidator.validateValue(key, parsedValue);
|
|
113
|
+
if (validationError) {
|
|
114
|
+
cmd.warn(`Validation error for "${key}": ${validationError}`);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
manager.set(key, parsedValue);
|
|
118
|
+
if (typeof manager.save === 'function') {
|
|
119
|
+
await manager.save();
|
|
120
|
+
}
|
|
121
|
+
cmd.success(`Configuration updated: ${key} = ${value}`);
|
|
122
|
+
};
|
|
123
|
+
const handleList = async (cmd, manager, options) => {
|
|
124
|
+
if (options['json'] === true && typeof manager.export === 'function') {
|
|
125
|
+
cmd.info(manager.export());
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const config = typeof manager.getConfig === 'function' ? manager.getConfig() : {};
|
|
129
|
+
cmd.info(chalk.bold('\n🛠️ Current Configuration:\n'));
|
|
130
|
+
displayValidationStatus(cmd, config);
|
|
131
|
+
displayConfigurationKeys(cmd, Object.keys(config));
|
|
132
|
+
displayConfigurationValues(cmd, config);
|
|
133
|
+
if (options['showDefaults'] === true) {
|
|
134
|
+
cmd.info(chalk.gray('\n(Default values shown above)'));
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
const handleReset = async (cmd, manager) => {
|
|
138
|
+
const confirmed = await PromptHelper.confirm('Are you sure you want to reset configuration to defaults?', false);
|
|
139
|
+
if (!confirmed) {
|
|
140
|
+
cmd.info('Reset cancelled');
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
if (typeof manager.reset === 'function') {
|
|
144
|
+
await manager.reset();
|
|
145
|
+
}
|
|
146
|
+
cmd.success('Configuration reset to defaults');
|
|
147
|
+
};
|
|
148
|
+
const editSingleConfig = async (cmd, manager, selectedKey) => {
|
|
149
|
+
const currentValue = typeof manager.get === 'function' ? manager.get(selectedKey) : undefined;
|
|
150
|
+
let defaultValue = '';
|
|
151
|
+
if (currentValue !== undefined) {
|
|
152
|
+
defaultValue =
|
|
153
|
+
typeof currentValue === 'object' ? JSON.stringify(currentValue) : String(currentValue);
|
|
154
|
+
}
|
|
155
|
+
const newValue = await PromptHelper.textInput(`Enter new value for "${selectedKey}":`, defaultValue);
|
|
156
|
+
if (newValue === undefined)
|
|
157
|
+
return;
|
|
158
|
+
const parsedValue = parseConfigValue(newValue);
|
|
159
|
+
const validationError = ConfigValidator.validateValue(selectedKey, parsedValue);
|
|
160
|
+
if (validationError) {
|
|
161
|
+
cmd.warn(`Validation error: ${validationError}`);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
if (typeof manager.set === 'function') {
|
|
165
|
+
manager.set(selectedKey, parsedValue);
|
|
166
|
+
}
|
|
167
|
+
if (typeof manager.save === 'function') {
|
|
168
|
+
await manager.save();
|
|
169
|
+
}
|
|
170
|
+
cmd.success(`Updated ${selectedKey}`);
|
|
171
|
+
};
|
|
172
|
+
const handleEdit = async (cmd, manager) => {
|
|
173
|
+
cmd.info(chalk.bold('\n📝 Interactive Configuration Editor\n'));
|
|
174
|
+
const config = typeof manager.getConfig === 'function' ? manager.getConfig() : {};
|
|
175
|
+
const keys = Object.keys(config);
|
|
176
|
+
const fallbackKeys = typeof manager.getAllKeys === 'function' ? manager.getAllKeys() : [];
|
|
177
|
+
const availableKeys = keys.length > 0 ? keys : fallbackKeys;
|
|
178
|
+
if (availableKeys.length === 0) {
|
|
179
|
+
cmd.warn('No configuration keys found');
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const menuKeys = [...availableKeys].sort((a, b) => a.localeCompare(b)).concat(['(Done)']);
|
|
183
|
+
while (true) {
|
|
184
|
+
const selectedKey = await PromptHelper.chooseFrom('Select configuration key to edit:', menuKeys);
|
|
185
|
+
if (selectedKey === '' || selectedKey === '(Done)')
|
|
186
|
+
break;
|
|
187
|
+
await editSingleConfig(cmd, manager, selectedKey);
|
|
188
|
+
}
|
|
189
|
+
cmd.success('Configuration editing complete');
|
|
190
|
+
};
|
|
191
|
+
const handleExport = (cmd, manager) => {
|
|
192
|
+
cmd.info(typeof manager.export === 'function' ? manager.export() : '{}');
|
|
193
|
+
};
|
|
194
|
+
const isUnknownArray = (value) => Array.isArray(value);
|
|
195
|
+
const getArg = (args, index) => {
|
|
196
|
+
if (!isUnknownArray(args))
|
|
197
|
+
return undefined;
|
|
198
|
+
const value = args[index];
|
|
199
|
+
return typeof value === 'string' ? value : undefined;
|
|
200
|
+
};
|
|
201
|
+
const executeConfig = async (cmd, options) => {
|
|
202
|
+
const typedCmd = cmd;
|
|
203
|
+
const command = cmd.getCommand();
|
|
204
|
+
const toRecord = (value) => {
|
|
205
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value))
|
|
206
|
+
return {};
|
|
207
|
+
return value;
|
|
208
|
+
};
|
|
209
|
+
const commandOpts = typeof command.opts === 'function' ? toRecord(command.opts()) : {};
|
|
210
|
+
const mergedOptions = {
|
|
211
|
+
...commandOpts,
|
|
212
|
+
...options,
|
|
213
|
+
};
|
|
214
|
+
const action = getArg(options.args, 0) ?? getArg(command.args, 0) ?? 'list';
|
|
215
|
+
const key = getArg(options.args, 1) ?? getArg(command.args, 1);
|
|
216
|
+
const value = getArg(options.args, 2) ?? getArg(command.args, 2);
|
|
217
|
+
const manager = await typedCmd.getConfigManager(mergedOptions['global'] === true);
|
|
218
|
+
await typedCmd.handleAction(action, manager, key, value, mergedOptions);
|
|
219
|
+
};
|
|
220
|
+
/**
|
|
221
|
+
* Config Command Factory
|
|
222
|
+
*/
|
|
223
|
+
export const ConfigCommand = Object.freeze({
|
|
224
|
+
/**
|
|
225
|
+
* Create a new config command instance
|
|
226
|
+
*/
|
|
227
|
+
create() {
|
|
228
|
+
const cmd = BaseCommand.create({
|
|
229
|
+
name: 'config',
|
|
230
|
+
description: 'Manage application configuration',
|
|
231
|
+
addOptions,
|
|
232
|
+
execute: async (options) => executeConfig(cmd, options),
|
|
233
|
+
});
|
|
234
|
+
cmd.getConfigManager = async (isGlobal) => isGlobal ? getGlobalConfigManager() : getProjectConfigManager();
|
|
235
|
+
cmd.handleGet = async (manager, key, value) => handleGet(cmd, manager, key ?? value);
|
|
236
|
+
cmd.handleSet = async (manager, key, value) => handleSet(cmd, manager, key, value);
|
|
237
|
+
cmd.handleList = async (manager, options) => handleList(cmd, manager, options);
|
|
238
|
+
cmd.handleReset = async (manager) => handleReset(cmd, manager);
|
|
239
|
+
cmd.handleEdit = async (manager) => handleEdit(cmd, manager);
|
|
240
|
+
cmd.handleExport = (manager) => handleExport(cmd, manager);
|
|
241
|
+
cmd.handleAction = async (action, manager, key, value, options) => {
|
|
242
|
+
switch (action.toLowerCase()) {
|
|
243
|
+
case 'get':
|
|
244
|
+
await cmd.handleGet(manager, key, value);
|
|
245
|
+
return;
|
|
246
|
+
case 'set':
|
|
247
|
+
await cmd.handleSet(manager, key, value, options);
|
|
248
|
+
return;
|
|
249
|
+
case 'list':
|
|
250
|
+
await cmd.handleList(manager, options ?? {});
|
|
251
|
+
return;
|
|
252
|
+
case 'reset':
|
|
253
|
+
await cmd.handleReset(manager);
|
|
254
|
+
return;
|
|
255
|
+
case 'edit':
|
|
256
|
+
await cmd.handleEdit(manager);
|
|
257
|
+
return;
|
|
258
|
+
case 'export':
|
|
259
|
+
cmd.handleExport(manager);
|
|
260
|
+
return;
|
|
261
|
+
default:
|
|
262
|
+
ErrorHandler.usageError(`Unknown action: ${action}`);
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
cmd.parseConfigValue = (value) => parseConfigValue(value);
|
|
266
|
+
cmd.formatConfigValue = (value) => formatConfigValue(value);
|
|
267
|
+
cmd.displayValidationStatus = (config) => displayValidationStatus(cmd, config);
|
|
268
|
+
cmd.displayConfigurationKeys = (keys) => displayConfigurationKeys(cmd, keys);
|
|
269
|
+
cmd.displayConfigurationValues = (config) => displayConfigurationValues(cmd, config);
|
|
270
|
+
cmd.editSingleConfig = async (manager, selectedKey) => editSingleConfig(cmd, manager, selectedKey);
|
|
271
|
+
return cmd;
|
|
272
|
+
},
|
|
273
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IBaseCommand } from '../BaseCommand';
|
|
2
|
+
/**
|
|
3
|
+
* D1 Migrate Command
|
|
4
|
+
* Run Cloudflare D1 migrations using Wrangler
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* D1 Migrate Command Factory
|
|
8
|
+
*/
|
|
9
|
+
export declare const D1MigrateCommand: Readonly<{
|
|
10
|
+
/**
|
|
11
|
+
* Create a new D1 migrate command instance
|
|
12
|
+
*/
|
|
13
|
+
create(): IBaseCommand;
|
|
14
|
+
}>;
|
|
15
|
+
//# sourceMappingURL=D1MigrateCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"D1MigrateCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/D1MigrateCommand.ts"],"names":[],"mappings":"AAQA,OAAO,EAA+B,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAiD7E;;;GAGG;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB;IAC3B;;OAEG;cACO,YAAY;EAqBtB,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { appConfig } from '../../config/app';
|
|
2
|
+
/**
|
|
3
|
+
* D1 Migrate Command
|
|
4
|
+
* Run Cloudflare D1 migrations using Wrangler
|
|
5
|
+
*/
|
|
6
|
+
import { resolveNpmPath } from '../../common';
|
|
7
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
8
|
+
import { BaseCommand } from '../BaseCommand';
|
|
9
|
+
import { Logger } from '../../config/logger';
|
|
10
|
+
import { execFileSync } from '../../node-singletons/child-process';
|
|
11
|
+
const runWrangler = async (cmd, args) => {
|
|
12
|
+
const npmPath = resolveNpmPath();
|
|
13
|
+
cmd.debug(`Executing: npm exec --yes -- wrangler ${args.join(' ')}`);
|
|
14
|
+
return execFileSync(npmPath, ['exec', '--yes', '--', 'wrangler', ...args], {
|
|
15
|
+
stdio: 'pipe',
|
|
16
|
+
encoding: 'utf8',
|
|
17
|
+
env: appConfig.getSafeEnv(),
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
const executeD1Migrate = async (cmd, options) => {
|
|
21
|
+
const isLocal = options['local'] === true || options['remote'] !== true;
|
|
22
|
+
const dbName = typeof options['database'] === 'string' ? options['database'] : 'zintrust_db';
|
|
23
|
+
const target = isLocal ? '--local' : '--remote';
|
|
24
|
+
cmd.info(`Running D1 migrations for ${dbName} (${isLocal ? 'local' : 'remote'})...`);
|
|
25
|
+
try {
|
|
26
|
+
const output = await runWrangler(cmd, ['d1', 'migrations', 'apply', dbName, target]);
|
|
27
|
+
if (output !== '')
|
|
28
|
+
cmd.info(output);
|
|
29
|
+
cmd.info('✓ D1 migrations completed successfully');
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
Logger.error('D1 Migration failed', error);
|
|
33
|
+
ErrorFactory.createCliError('D1 Migration failed', error);
|
|
34
|
+
const err = error;
|
|
35
|
+
if (err.stdout !== undefined && err.stdout.length > 0)
|
|
36
|
+
cmd.info(err.stdout.toString());
|
|
37
|
+
if (err.stderr !== undefined && err.stderr.length > 0)
|
|
38
|
+
Logger.error('Wrangler stderr', err.stderr.toString());
|
|
39
|
+
if (err.stderr !== undefined && err.stderr.length > 0)
|
|
40
|
+
ErrorFactory.createCliError('Wrangler stderr', err.stderr.toString());
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* D1 Migrate Command
|
|
46
|
+
* Run Cloudflare D1 migrations using Wrangler
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
* D1 Migrate Command Factory
|
|
50
|
+
*/
|
|
51
|
+
export const D1MigrateCommand = Object.freeze({
|
|
52
|
+
/**
|
|
53
|
+
* Create a new D1 migrate command instance
|
|
54
|
+
*/
|
|
55
|
+
create() {
|
|
56
|
+
const addOptions = (command) => {
|
|
57
|
+
command
|
|
58
|
+
.option('--local', 'Run migrations against local D1 database')
|
|
59
|
+
.option('--remote', 'Run migrations against remote D1 database')
|
|
60
|
+
.option('--database <name>', 'D1 database name', 'zintrust_db');
|
|
61
|
+
};
|
|
62
|
+
const cmd = BaseCommand.create({
|
|
63
|
+
name: 'd1:migrate',
|
|
64
|
+
description: 'Run Cloudflare D1 migrations',
|
|
65
|
+
addOptions,
|
|
66
|
+
execute: async (options) => executeD1Migrate(cmd, options),
|
|
67
|
+
});
|
|
68
|
+
cmd.resolveNpmPath = () => resolveNpmPath();
|
|
69
|
+
cmd.getSafeEnv = () => appConfig.getSafeEnv();
|
|
70
|
+
cmd.runWrangler = async (args) => runWrangler(cmd, args);
|
|
71
|
+
return cmd;
|
|
72
|
+
},
|
|
73
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Debug Command
|
|
3
|
+
* Launch debug mode with profiling and monitoring
|
|
4
|
+
*/
|
|
5
|
+
import { IBaseCommand } from '../BaseCommand';
|
|
6
|
+
/**
|
|
7
|
+
* Debug Command Factory
|
|
8
|
+
*/
|
|
9
|
+
export declare const DebugCommand: Readonly<{
|
|
10
|
+
/**
|
|
11
|
+
* Create a new debug command instance
|
|
12
|
+
*/
|
|
13
|
+
create: () => IBaseCommand;
|
|
14
|
+
}>;
|
|
15
|
+
//# sourceMappingURL=DebugCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DebugCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/DebugCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAA+B,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAwD7E;;GAEG;AACH,eAAO,MAAM,YAAY;IACvB;;OAEG;kBApBc,YAAY;EAsB7B,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Debug Command
|
|
3
|
+
* Launch debug mode with profiling and monitoring
|
|
4
|
+
*/
|
|
5
|
+
import { BaseCommand } from '../BaseCommand';
|
|
6
|
+
import { Dashboard } from '../debug/Dashboard';
|
|
7
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
8
|
+
const addOptions = (command) => {
|
|
9
|
+
command
|
|
10
|
+
.option('--port <number>', 'Debug server port', '3000')
|
|
11
|
+
.option('--enable-profiling', 'Enable memory profiling')
|
|
12
|
+
.option('--enable-tracing', 'Enable request tracing');
|
|
13
|
+
};
|
|
14
|
+
const executeDebug = (cmd, options) => {
|
|
15
|
+
cmd.info(`Debug command executed with options: ${JSON.stringify(options)}`);
|
|
16
|
+
try {
|
|
17
|
+
cmd.dashboard = Dashboard.create();
|
|
18
|
+
cmd.dashboard.start();
|
|
19
|
+
process.on('SIGINT', () => {
|
|
20
|
+
cmd.dashboard?.stop();
|
|
21
|
+
process.exit(0);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
cmd.dashboard?.stop();
|
|
26
|
+
throw ErrorFactory.createTryCatchError(`Debug failed: ${error.message}`, error);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Debug Command
|
|
31
|
+
* Launch debug mode with profiling and monitoring
|
|
32
|
+
*/
|
|
33
|
+
const create = () => {
|
|
34
|
+
const ext = (options) => executeDebug(cmd, options);
|
|
35
|
+
const cmd = BaseCommand.create({
|
|
36
|
+
name: 'debug',
|
|
37
|
+
description: 'Launch debug mode with real-time monitoring dashboard',
|
|
38
|
+
addOptions,
|
|
39
|
+
execute: ext,
|
|
40
|
+
});
|
|
41
|
+
cmd.dashboard = undefined;
|
|
42
|
+
return cmd;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Debug Command Factory
|
|
46
|
+
*/
|
|
47
|
+
export const DebugCommand = Object.freeze({
|
|
48
|
+
/**
|
|
49
|
+
* Create a new debug command instance
|
|
50
|
+
*/
|
|
51
|
+
create,
|
|
52
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fix Command - Automated Code Cleanup
|
|
3
|
+
* Runs ESLint fix and other automated tools
|
|
4
|
+
*/
|
|
5
|
+
import { IBaseCommand } from '../BaseCommand';
|
|
6
|
+
/**
|
|
7
|
+
* Fix Command Factory
|
|
8
|
+
*/
|
|
9
|
+
export declare const FixCommand: Readonly<{
|
|
10
|
+
/**
|
|
11
|
+
* Create a new fix command instance
|
|
12
|
+
*/
|
|
13
|
+
create(): IBaseCommand;
|
|
14
|
+
}>;
|
|
15
|
+
//# sourceMappingURL=FixCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FixCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/FixCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAA+B,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAqE7E;;GAEG;AACH,eAAO,MAAM,UAAU;IACrB;;OAEG;cACO,YAAY;EAkBtB,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fix Command - Automated Code Cleanup
|
|
3
|
+
* Runs ESLint fix and other automated tools
|
|
4
|
+
*/
|
|
5
|
+
import { appConfig } from '../../config';
|
|
6
|
+
import { BaseCommand } from '../BaseCommand';
|
|
7
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
8
|
+
import { execFileSync } from '../../node-singletons/child-process';
|
|
9
|
+
import fs from '../../node-singletons/fs';
|
|
10
|
+
import * as path from '../../node-singletons/path';
|
|
11
|
+
const resolveNpmPath = () => {
|
|
12
|
+
const nodeBinDir = path.dirname(process.execPath);
|
|
13
|
+
const candidates = process.platform === 'win32'
|
|
14
|
+
? [path.join(nodeBinDir, 'npm.cmd'), path.join(nodeBinDir, 'npm.exe')]
|
|
15
|
+
: [path.join(nodeBinDir, 'npm')];
|
|
16
|
+
for (const candidate of candidates) {
|
|
17
|
+
if (fs.existsSync(candidate))
|
|
18
|
+
return candidate;
|
|
19
|
+
}
|
|
20
|
+
throw ErrorFactory.createCliError('Unable to locate npm executable. Ensure Node.js (with npm) is installed in the standard location.');
|
|
21
|
+
};
|
|
22
|
+
const runNpmScript = (cmd, args) => {
|
|
23
|
+
const npmPath = resolveNpmPath();
|
|
24
|
+
cmd.debug(`Executing: npm run ${args.join(' ')}`);
|
|
25
|
+
execFileSync(npmPath, ['run', ...args], {
|
|
26
|
+
stdio: 'inherit',
|
|
27
|
+
encoding: 'utf8',
|
|
28
|
+
env: appConfig.getSafeEnv(),
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
const executeFix = async (cmd, options) => {
|
|
32
|
+
cmd.info('Starting automated code fixes...');
|
|
33
|
+
try {
|
|
34
|
+
const isDryRun = options['dryRun'] === true;
|
|
35
|
+
cmd.info('Running ESLint fix...');
|
|
36
|
+
try {
|
|
37
|
+
runNpmScript(cmd, ['lint', '--', isDryRun ? '--fix-dry-run' : '--fix']);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
ErrorFactory.createCliError('ESLint fix failed', error);
|
|
41
|
+
cmd.warn('ESLint fix encountered some issues, continuing...');
|
|
42
|
+
}
|
|
43
|
+
cmd.info('Running Prettier format...');
|
|
44
|
+
try {
|
|
45
|
+
runNpmScript(cmd, ['format']);
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
ErrorFactory.createCliError('Prettier format failed', error);
|
|
49
|
+
cmd.warn('Prettier format encountered some issues.');
|
|
50
|
+
}
|
|
51
|
+
cmd.success('Code fixes completed successfully!');
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
ErrorFactory.createCliError('Fix command failed', error);
|
|
55
|
+
cmd.warn('Some fixes could not be applied automatically.');
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Fix Command Factory
|
|
60
|
+
*/
|
|
61
|
+
export const FixCommand = Object.freeze({
|
|
62
|
+
/**
|
|
63
|
+
* Create a new fix command instance
|
|
64
|
+
*/
|
|
65
|
+
create() {
|
|
66
|
+
const addOptions = (command) => {
|
|
67
|
+
command.option('--dry-run', 'Show what would be fixed without applying changes');
|
|
68
|
+
};
|
|
69
|
+
const cmd = BaseCommand.create({
|
|
70
|
+
name: 'fix',
|
|
71
|
+
description: 'Run automated code fixes',
|
|
72
|
+
addOptions,
|
|
73
|
+
execute: async (options) => executeFix(cmd, options),
|
|
74
|
+
});
|
|
75
|
+
cmd.resolveNpmPath = () => resolveNpmPath();
|
|
76
|
+
cmd.getSafeEnv = () => appConfig.getSafeEnv();
|
|
77
|
+
cmd.runNpmExec = (args) => runNpmScript(cmd, args);
|
|
78
|
+
return cmd;
|
|
79
|
+
},
|
|
80
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KeyGenerateCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/KeyGenerateCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAA+B,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAO7E,eAAO,MAAM,kBAAkB;cACnB,YAAY;EAmEtB,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Key Generate Command
|
|
3
|
+
* Generates and sets the application key
|
|
4
|
+
*/
|
|
5
|
+
import { BaseCommand } from '../BaseCommand';
|
|
6
|
+
import { Logger } from '../../config/logger';
|
|
7
|
+
import * as crypto from '../../node-singletons/crypto';
|
|
8
|
+
import { fsPromises as fs } from '../../node-singletons/fs';
|
|
9
|
+
import * as path from '../../node-singletons/path';
|
|
10
|
+
export const KeyGenerateCommand = Object.freeze({
|
|
11
|
+
create() {
|
|
12
|
+
return BaseCommand.create({
|
|
13
|
+
name: 'key:generate',
|
|
14
|
+
description: 'Set the application key',
|
|
15
|
+
addOptions: (command) => {
|
|
16
|
+
command.option('--show', 'Display the key instead of modifying files');
|
|
17
|
+
command.option('--force', 'Force the operation to run when in production');
|
|
18
|
+
},
|
|
19
|
+
execute: async (options) => {
|
|
20
|
+
const key = generateRandomKey();
|
|
21
|
+
if (options['show'] === true) {
|
|
22
|
+
Logger.info(`Application key: [${key}]`);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const envPath = path.resolve(process.cwd(), '.env');
|
|
26
|
+
try {
|
|
27
|
+
let envContent = '';
|
|
28
|
+
try {
|
|
29
|
+
envContent = await fs.readFile(envPath, 'utf-8');
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
Logger.warn('Could not read .env file, attempting to create from example', { error });
|
|
33
|
+
// If .env doesn't exist, try to copy .env.example
|
|
34
|
+
const examplePath = path.resolve(process.cwd(), '.env.example');
|
|
35
|
+
try {
|
|
36
|
+
envContent = await fs.readFile(examplePath, 'utf-8');
|
|
37
|
+
await fs.writeFile(envPath, envContent);
|
|
38
|
+
Logger.info('.env file created from .env.example');
|
|
39
|
+
}
|
|
40
|
+
catch (copyError) {
|
|
41
|
+
Logger.error('Failed to create .env from example', { error: copyError });
|
|
42
|
+
Logger.warn('.env file not found and .env.example not found. Creating new .env file.');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// Backup existing key if present
|
|
46
|
+
const appKeyMatch = /^APP_KEY=(.*)$/m.exec(envContent);
|
|
47
|
+
const currentKey = appKeyMatch?.[1]?.trim();
|
|
48
|
+
if (currentKey !== undefined && currentKey.length > 0) {
|
|
49
|
+
const oldKey = currentKey;
|
|
50
|
+
if (envContent.includes('APP_KEY_BK=')) {
|
|
51
|
+
envContent = envContent.replace(/^APP_KEY_BK=.*$/m, `APP_KEY_BK=${oldKey}`);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
envContent += `\nAPP_KEY_BK=${oldKey}`;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (envContent.includes('APP_KEY=')) {
|
|
58
|
+
const regex = /^APP_KEY=.*/m;
|
|
59
|
+
envContent = envContent.replace(regex, `APP_KEY=${key}`);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
envContent += `\nAPP_KEY=${key}\n`;
|
|
63
|
+
}
|
|
64
|
+
await fs.writeFile(envPath, envContent);
|
|
65
|
+
Logger.info(`Application key set successfully. [${key}]`);
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
Logger.error('Failed to update .env file', error);
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
function generateRandomKey() {
|
|
75
|
+
return 'base64:' + crypto.randomBytes(32).toString('base64');
|
|
76
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LogsCommand - CLI command for viewing and managing logs
|
|
3
|
+
* Commands: zin logs, zin logs --follow, zin logs --level error, zin logs --clear
|
|
4
|
+
*/
|
|
5
|
+
import { IBaseCommand } from '../BaseCommand';
|
|
6
|
+
import { Command } from 'commander';
|
|
7
|
+
export declare const LogsCommand: Readonly<{
|
|
8
|
+
/**
|
|
9
|
+
* Create a new logs command instance
|
|
10
|
+
*/
|
|
11
|
+
create(): IBaseCommand;
|
|
12
|
+
/**
|
|
13
|
+
* Register the command with Commander
|
|
14
|
+
* @deprecated Use create() instead
|
|
15
|
+
*/
|
|
16
|
+
register(program: Command): void;
|
|
17
|
+
}>;
|
|
18
|
+
export default LogsCommand;
|
|
19
|
+
//# sourceMappingURL=LogsCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogsCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/LogsCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAA+B,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAM7E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA8KpC,eAAO,MAAM,WAAW;IACtB;;OAEG;cACO,YAAY;IAwBtB;;;OAGG;sBACe,OAAO,GAAG,IAAI;EAchC,CAAC;AAEH,eAAe,WAAW,CAAC"}
|