@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,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Seeder Generator - Phase 6.2
|
|
3
|
+
* Generates database seeders for populating development/staging databases
|
|
4
|
+
* Uses factory generators for consistent data generation
|
|
5
|
+
*/
|
|
6
|
+
export interface SeederField {
|
|
7
|
+
name: string;
|
|
8
|
+
type: string;
|
|
9
|
+
faker?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface SeederOptions {
|
|
12
|
+
seederName: string;
|
|
13
|
+
modelName: string;
|
|
14
|
+
factoryName?: string;
|
|
15
|
+
seedersPath: string;
|
|
16
|
+
count?: number;
|
|
17
|
+
relationships?: string[];
|
|
18
|
+
truncate?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface SeederGeneratorResult {
|
|
21
|
+
success: boolean;
|
|
22
|
+
filePath: string;
|
|
23
|
+
message: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Seeder Generator - Creates database seeders using factory classes
|
|
27
|
+
* Enables rapid database population for development and staging
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* Validate seeder options
|
|
31
|
+
*/
|
|
32
|
+
export declare function validateOptions(options: SeederOptions): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Generate a database seeder
|
|
35
|
+
*/
|
|
36
|
+
export declare function generateSeeder(options: SeederOptions): Promise<SeederGeneratorResult>;
|
|
37
|
+
/**
|
|
38
|
+
* Get available seeder options
|
|
39
|
+
*/
|
|
40
|
+
export declare function getAvailableOptions(): string[];
|
|
41
|
+
export declare const SeederGenerator: Readonly<{
|
|
42
|
+
validateOptions: typeof validateOptions;
|
|
43
|
+
generateSeeder: typeof generateSeeder;
|
|
44
|
+
getAvailableOptions: typeof getAvailableOptions;
|
|
45
|
+
}>;
|
|
46
|
+
export default SeederGenerator;
|
|
47
|
+
//# sourceMappingURL=SeederGenerator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SeederGenerator.d.ts","sourceRoot":"","sources":["../../../../src/cli/scaffolding/SeederGenerator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AAEH;;GAEG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAmC3E;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAyB3F;AA+OD;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,EAAE,CAQ9C;AAED,eAAO,MAAM,eAAe;;;;EAI1B,CAAC;AAEH,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Seeder Generator - Phase 6.2
|
|
3
|
+
* Generates database seeders for populating development/staging databases
|
|
4
|
+
* Uses factory generators for consistent data generation
|
|
5
|
+
*/
|
|
6
|
+
import { FileGenerator } from '../scaffolding/FileGenerator';
|
|
7
|
+
import { CommonUtils } from '../../common/index';
|
|
8
|
+
import { Logger } from '../../config/logger';
|
|
9
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
10
|
+
import { fsPromises as fs } from '../../node-singletons/fs';
|
|
11
|
+
import * as path from 'node:path';
|
|
12
|
+
/**
|
|
13
|
+
* Seeder Generator - Creates database seeders using factory classes
|
|
14
|
+
* Enables rapid database population for development and staging
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Validate seeder options
|
|
18
|
+
*/
|
|
19
|
+
export async function validateOptions(options) {
|
|
20
|
+
if (options.seederName === undefined || options.seederName.trim() === '') {
|
|
21
|
+
throw ErrorFactory.createCliError('Seeder name is required');
|
|
22
|
+
}
|
|
23
|
+
if (!options.seederName.endsWith('Seeder')) {
|
|
24
|
+
throw ErrorFactory.createCliError('Seeder name must end with "Seeder" (e.g., UserSeeder)');
|
|
25
|
+
}
|
|
26
|
+
if (!/^[A-Z][a-zA-Z\d]*Seeder$/.test(options.seederName)) {
|
|
27
|
+
throw ErrorFactory.createCliError('Seeder name must be PascalCase ending with "Seeder"');
|
|
28
|
+
}
|
|
29
|
+
if (options.modelName === undefined || options.modelName.trim() === '') {
|
|
30
|
+
throw ErrorFactory.createCliError('Model name is required');
|
|
31
|
+
}
|
|
32
|
+
if (!/^[A-Z][a-zA-Z\d]*$/.test(options.modelName)) {
|
|
33
|
+
throw ErrorFactory.createCliError('Model name must be PascalCase (e.g., User, Post)');
|
|
34
|
+
}
|
|
35
|
+
if (options.count !== undefined && (options.count < 1 || options.count > 100000)) {
|
|
36
|
+
throw ErrorFactory.createCliError('Count must be between 1 and 100000');
|
|
37
|
+
}
|
|
38
|
+
// Verify seeders path exists
|
|
39
|
+
const pathStat = await fs.stat(options.seedersPath).catch(() => null);
|
|
40
|
+
if (pathStat === null) {
|
|
41
|
+
throw ErrorFactory.createCliError(`Seeders path does not exist: ${options.seedersPath}`);
|
|
42
|
+
}
|
|
43
|
+
if (!pathStat.isDirectory()) {
|
|
44
|
+
throw ErrorFactory.createCliError(`Seeders path is not a directory: ${options.seedersPath}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Generate a database seeder
|
|
49
|
+
*/
|
|
50
|
+
export async function generateSeeder(options) {
|
|
51
|
+
try {
|
|
52
|
+
await validateOptions(options);
|
|
53
|
+
const seederCode = buildSeederCode(options);
|
|
54
|
+
const fileName = `${options.seederName}.ts`;
|
|
55
|
+
const filePath = path.join(options.seedersPath, fileName);
|
|
56
|
+
FileGenerator.writeFile(filePath, seederCode, { overwrite: true });
|
|
57
|
+
Logger.info(`✅ Created seeder: ${fileName}`);
|
|
58
|
+
return {
|
|
59
|
+
success: true,
|
|
60
|
+
filePath,
|
|
61
|
+
message: `Seeder '${options.seederName}' created successfully`,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
Logger.error('Seeder generation failed', error);
|
|
66
|
+
return {
|
|
67
|
+
success: false,
|
|
68
|
+
filePath: '',
|
|
69
|
+
message: error.message,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Build complete seeder code
|
|
75
|
+
*/
|
|
76
|
+
function buildSeederCode(options) {
|
|
77
|
+
const imports = buildImports(options);
|
|
78
|
+
const className = options.seederName;
|
|
79
|
+
const count = options.count ?? 10;
|
|
80
|
+
const truncate = options.truncate === false ? 'false' : 'true';
|
|
81
|
+
const relationshipMethods = buildRelationshipMethods(options);
|
|
82
|
+
return `/**
|
|
83
|
+
* ${className}
|
|
84
|
+
* Seeder for populating ${options.modelName} table with test data
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
${imports}
|
|
88
|
+
|
|
89
|
+
export const ${className} = Object.freeze({
|
|
90
|
+
${buildSeederObjectBody(options, count, truncate, relationshipMethods)}
|
|
91
|
+
});
|
|
92
|
+
`;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Build seeder object body
|
|
96
|
+
*/
|
|
97
|
+
function buildSeederObjectBody(options, count, truncate, relationshipMethods) {
|
|
98
|
+
const factoryName = getFactoryName(options);
|
|
99
|
+
const modelLower = options.modelName.toLowerCase();
|
|
100
|
+
return `${buildSeederRunMethod(options, count, truncate, factoryName, modelLower)},
|
|
101
|
+
|
|
102
|
+
${buildSeederGetRecordsMethod(factoryName)},
|
|
103
|
+
|
|
104
|
+
${buildSeederWithStatesMethod(options, count, factoryName, modelLower)},
|
|
105
|
+
|
|
106
|
+
${buildSeederWithRelationshipsMethod(options, count, factoryName, modelLower, relationshipMethods)},
|
|
107
|
+
|
|
108
|
+
${buildSeederResetMethod(options)}`;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Build seeder run method
|
|
112
|
+
*/
|
|
113
|
+
function buildSeederRunMethod(options, count, truncate, factoryName, modelLower) {
|
|
114
|
+
const tableName = getTableName(options.modelName);
|
|
115
|
+
return ` /**
|
|
116
|
+
* Run the seeder
|
|
117
|
+
* Populates the ${modelLower} table with ${count} records
|
|
118
|
+
*/
|
|
119
|
+
async run(): Promise<void> {
|
|
120
|
+
const count = ${count};
|
|
121
|
+
const factory = ${factoryName}.new();
|
|
122
|
+
|
|
123
|
+
// Optionally truncate the table before seeding
|
|
124
|
+
if (${truncate}) {
|
|
125
|
+
// await Table.query().delete();
|
|
126
|
+
// Or use: await database.raw('TRUNCATE TABLE ${tableName}');
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Generate and create records
|
|
130
|
+
const records = factory.count(count);
|
|
131
|
+
|
|
132
|
+
for (const record of records) {
|
|
133
|
+
// Insert using Query Builder (recommended)
|
|
134
|
+
// await ${options.modelName}.create(record);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
Logger.info(\`✅ Seeded \${count} ${modelLower} records\`);
|
|
138
|
+
}`;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Build seeder getRecords method
|
|
142
|
+
*/
|
|
143
|
+
function buildSeederGetRecordsMethod(factoryName) {
|
|
144
|
+
return ` /**
|
|
145
|
+
* Get records from this seeder
|
|
146
|
+
*/
|
|
147
|
+
async getRecords(count: number): Promise<Record<string, unknown>[]> {
|
|
148
|
+
const factory = ${factoryName}.new();
|
|
149
|
+
return factory.count(count);
|
|
150
|
+
}`;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Build seeder with states method
|
|
154
|
+
*/
|
|
155
|
+
function buildSeederWithStatesMethod(options, count, factoryName, modelLower) {
|
|
156
|
+
return ` /**
|
|
157
|
+
* Seed with specific states
|
|
158
|
+
*/
|
|
159
|
+
async seedWithStates(): Promise<void> {
|
|
160
|
+
const factory = ${factoryName}.new();
|
|
161
|
+
|
|
162
|
+
// Create active records (50%)
|
|
163
|
+
const active = factory.state('active').count(Math.ceil(${count} * 0.5));
|
|
164
|
+
for (const record of active) {
|
|
165
|
+
// await ${options.modelName}.create(record);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Create inactive records (30%)
|
|
169
|
+
const inactive = factory.state('inactive').count(Math.ceil(${count} * 0.3));
|
|
170
|
+
for (const record of inactive) {
|
|
171
|
+
// await ${options.modelName}.create(record);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Create deleted records (20%)
|
|
175
|
+
const deleted = factory.state('deleted').count(Math.ceil(${count} * 0.2));
|
|
176
|
+
for (const record of deleted) {
|
|
177
|
+
// await ${options.modelName}.create(record);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
Logger.info(\`✅ Seeded ${count} ${modelLower} records with state distribution\`);
|
|
181
|
+
}`;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Build seeder with relationships method
|
|
185
|
+
*/
|
|
186
|
+
function buildSeederWithRelationshipsMethod(_options, count, factoryName, modelLower, relationshipMethods) {
|
|
187
|
+
return ` /**
|
|
188
|
+
* Seed with relationships
|
|
189
|
+
*/
|
|
190
|
+
async seedWithRelationships(): Promise<void> {
|
|
191
|
+
const factory = ${factoryName}.new();
|
|
192
|
+
|
|
193
|
+
${relationshipMethods}
|
|
194
|
+
|
|
195
|
+
Logger.info(\`✅ Seeded ${count} ${modelLower} records with relationships\`);
|
|
196
|
+
}`;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Build seeder reset method
|
|
200
|
+
*/
|
|
201
|
+
function buildSeederResetMethod(options) {
|
|
202
|
+
const tableName = getTableName(options.modelName);
|
|
203
|
+
return ` /**
|
|
204
|
+
* Reset seeder (truncate table)
|
|
205
|
+
*/
|
|
206
|
+
async reset(): Promise<void> {
|
|
207
|
+
// await database.raw('TRUNCATE TABLE ${tableName}');
|
|
208
|
+
Logger.info(\`✅ Truncated ${tableName} table\`);
|
|
209
|
+
}`;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Build import statements
|
|
213
|
+
*/
|
|
214
|
+
function buildImports(options) {
|
|
215
|
+
const factoryName = getFactoryName(options);
|
|
216
|
+
return `import { Logger } from '../../config/logger';
|
|
217
|
+
import { ${factoryName} } from '@database/factories/${factoryName}';
|
|
218
|
+
import { ${options.modelName} } from '@app/Models/${options.modelName}';`;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Build relationship seeding methods
|
|
222
|
+
*/
|
|
223
|
+
function buildRelationshipMethods(options) {
|
|
224
|
+
if (options.relationships === undefined || options.relationships.length === 0) {
|
|
225
|
+
return ` const factory = new ${getFactoryName(options)}();
|
|
226
|
+
const records = factory.count(${options.count ?? 10});
|
|
227
|
+
|
|
228
|
+
// Create records with relationships (implement as needed)
|
|
229
|
+
for (const record of records) {
|
|
230
|
+
// await ${options.modelName}.create(record);
|
|
231
|
+
}`;
|
|
232
|
+
}
|
|
233
|
+
const relationshipCode = options.relationships
|
|
234
|
+
.map((rel) => {
|
|
235
|
+
const relId = `${CommonUtils.camelCase(rel)}Id`;
|
|
236
|
+
return ` // Seed with ${rel} relationships
|
|
237
|
+
const ${CommonUtils.camelCase(rel)}s = await ${rel}.all();
|
|
238
|
+
if (${CommonUtils.camelCase(rel)}s.length > 0) {
|
|
239
|
+
const factory = new ${getFactoryName(options)}();
|
|
240
|
+
const records = factory
|
|
241
|
+
.count(Math.min(${options.count ?? 10}, ${CommonUtils.camelCase(rel)}s.length))
|
|
242
|
+
.get();
|
|
243
|
+
|
|
244
|
+
for (let i = 0; i < records.length; i++) {
|
|
245
|
+
records[i].${relId} = ${CommonUtils.camelCase(rel)}s[i].id;
|
|
246
|
+
// await ${options.modelName}.create(records[i]);
|
|
247
|
+
}
|
|
248
|
+
}`;
|
|
249
|
+
})
|
|
250
|
+
.join('\n\n');
|
|
251
|
+
return relationshipCode;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Get factory name from model name
|
|
255
|
+
*/
|
|
256
|
+
function getFactoryName(options) {
|
|
257
|
+
return options.factoryName ?? `${options.modelName}Factory`;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Get database table name from model name
|
|
261
|
+
*/
|
|
262
|
+
function getTableName(modelName) {
|
|
263
|
+
// Convert PascalCase to snake_case
|
|
264
|
+
return (modelName
|
|
265
|
+
.replaceAll(/([A-Z])/g, '_$1')
|
|
266
|
+
.toLowerCase()
|
|
267
|
+
.replace(/^_/, '') + 's');
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Get available seeder options
|
|
271
|
+
*/
|
|
272
|
+
export function getAvailableOptions() {
|
|
273
|
+
return [
|
|
274
|
+
'Truncate table before seeding (default: true)',
|
|
275
|
+
'Custom record count (default: 10, max: 100000)',
|
|
276
|
+
'Relationship seeding',
|
|
277
|
+
'State-based distribution (active, inactive, deleted)',
|
|
278
|
+
'Batch operations for large datasets',
|
|
279
|
+
];
|
|
280
|
+
}
|
|
281
|
+
export const SeederGenerator = Object.freeze({
|
|
282
|
+
validateOptions,
|
|
283
|
+
generateSeeder,
|
|
284
|
+
getAvailableOptions,
|
|
285
|
+
});
|
|
286
|
+
export default SeederGenerator;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service Integration Test Generator
|
|
3
|
+
* Generates integration tests for service-to-service communication
|
|
4
|
+
*/
|
|
5
|
+
export interface ServiceEndpoint {
|
|
6
|
+
path: string;
|
|
7
|
+
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
8
|
+
name: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ServiceIntegrationTestOptions {
|
|
12
|
+
name: string;
|
|
13
|
+
serviceName: string;
|
|
14
|
+
baseUrl?: string;
|
|
15
|
+
endpoints: ServiceEndpoint[];
|
|
16
|
+
authType?: 'none' | 'api-key' | 'jwt';
|
|
17
|
+
consumerService?: string;
|
|
18
|
+
testPath: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ServiceIntegrationTestResult {
|
|
21
|
+
success: boolean;
|
|
22
|
+
testFile: string;
|
|
23
|
+
message: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Validate integration test options
|
|
27
|
+
*/
|
|
28
|
+
export declare function validateOptions(options: ServiceIntegrationTestOptions): {
|
|
29
|
+
valid: boolean;
|
|
30
|
+
errors: string[];
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Generate service integration tests
|
|
34
|
+
*/
|
|
35
|
+
export declare function generateIntegrationTest(options: ServiceIntegrationTestOptions): Promise<ServiceIntegrationTestResult>;
|
|
36
|
+
export declare const ServiceIntegrationTestGenerator: Readonly<{
|
|
37
|
+
validateOptions: typeof validateOptions;
|
|
38
|
+
generateIntegrationTest: typeof generateIntegrationTest;
|
|
39
|
+
}>;
|
|
40
|
+
//# sourceMappingURL=ServiceIntegrationTestGenerator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceIntegrationTestGenerator.d.ts","sourceRoot":"","sources":["../../../../src/cli/scaffolding/ServiceIntegrationTestGenerator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,6BAA6B;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,eAAe,EAAE,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,KAAK,CAAC;IACtC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,6BAA6B,GAAG;IACvE,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAuBA;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,4BAA4B,CAAC,CAuBvC;AA4ND,eAAO,MAAM,+BAA+B;;;EAG1C,CAAC"}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service Integration Test Generator
|
|
3
|
+
* Generates integration tests for service-to-service communication
|
|
4
|
+
*/
|
|
5
|
+
import { FileGenerator } from '../scaffolding/FileGenerator';
|
|
6
|
+
import { CommonUtils } from '../../common/index';
|
|
7
|
+
import { Logger } from '../../config/logger';
|
|
8
|
+
import * as path from 'node:path';
|
|
9
|
+
/**
|
|
10
|
+
* Validate integration test options
|
|
11
|
+
*/
|
|
12
|
+
export function validateOptions(options) {
|
|
13
|
+
const errors = [];
|
|
14
|
+
if (options.name === undefined || options.name.trim() === '') {
|
|
15
|
+
errors.push('Integration test name is required');
|
|
16
|
+
}
|
|
17
|
+
else if (!/^[A-Z][a-zA-Z\d]*Service$/.test(options.name)) {
|
|
18
|
+
errors.push('Integration test name must be PascalCase and end with Service');
|
|
19
|
+
}
|
|
20
|
+
if (options.serviceName === undefined || options.serviceName.trim() === '') {
|
|
21
|
+
errors.push('Service name is required');
|
|
22
|
+
}
|
|
23
|
+
else if (!/^[a-z\d-]+$/.test(options.serviceName)) {
|
|
24
|
+
errors.push('Service name must be lowercase alphanumeric with hyphens');
|
|
25
|
+
}
|
|
26
|
+
if (options.endpoints === undefined || options.endpoints.length === 0) {
|
|
27
|
+
errors.push('At least one endpoint is required');
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
valid: errors.length === 0,
|
|
31
|
+
errors,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Generate service integration tests
|
|
36
|
+
*/
|
|
37
|
+
export async function generateIntegrationTest(options) {
|
|
38
|
+
try {
|
|
39
|
+
const testCode = buildTestCode(options);
|
|
40
|
+
const fileName = `${CommonUtils.camelCase(options.name)}.test.ts`;
|
|
41
|
+
const filePath = path.join(options.testPath, fileName);
|
|
42
|
+
FileGenerator.writeFile(filePath, testCode, { overwrite: true });
|
|
43
|
+
Logger.info(`✅ Created service integration test: ${fileName}`);
|
|
44
|
+
return {
|
|
45
|
+
success: true,
|
|
46
|
+
testFile: filePath,
|
|
47
|
+
message: `Service integration test '${options.name}' created successfully`,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
Logger.error('Service integration test generation failed', error);
|
|
52
|
+
return {
|
|
53
|
+
success: false,
|
|
54
|
+
testFile: '',
|
|
55
|
+
message: error.message,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Build complete test code
|
|
61
|
+
*/
|
|
62
|
+
function buildTestCode(options) {
|
|
63
|
+
const baseUrl = getBaseUrl(options);
|
|
64
|
+
const endpointTests = buildEndpointTests(options);
|
|
65
|
+
const consumerNote = getConsumerNote(options);
|
|
66
|
+
return `/**
|
|
67
|
+
* ${CommonUtils.camelCase(options.name)} Integration Tests
|
|
68
|
+
* Tests service-to-service communication
|
|
69
|
+
* Service: ${options.serviceName}${consumerNote}
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
import { describe, it, expect, beforeAll, afterAll, vi } from 'vitest';
|
|
73
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
74
|
+
|
|
75
|
+
interface ServiceConfig {
|
|
76
|
+
baseUrl: string;
|
|
77
|
+
timeout?: number;
|
|
78
|
+
headers?: Record<string, string>;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
interface TestContext {
|
|
82
|
+
baseUrl: string;
|
|
83
|
+
authToken?: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
${buildServiceClientObject()}
|
|
87
|
+
|
|
88
|
+
${buildTestHelpers()}
|
|
89
|
+
|
|
90
|
+
describe('${options.name} Integration', () => {
|
|
91
|
+
let client: any;
|
|
92
|
+
const context: TestContext = {
|
|
93
|
+
baseUrl: '${baseUrl}',
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
beforeAll(async () => {
|
|
97
|
+
client = ServiceClient.create({
|
|
98
|
+
baseUrl: context.baseUrl,
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// Optional: Setup auth or other prerequisites
|
|
102
|
+
if ('${options.authType}' === 'jwt') {
|
|
103
|
+
context.authToken = 'test-token';
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
${endpointTests}
|
|
108
|
+
});
|
|
109
|
+
`;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Get base URL for tests
|
|
113
|
+
*/
|
|
114
|
+
function getBaseUrl(options) {
|
|
115
|
+
return options.baseUrl !== undefined && options.baseUrl !== ''
|
|
116
|
+
? options.baseUrl
|
|
117
|
+
: 'http://localhost:3001';
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Build endpoint tests
|
|
121
|
+
*/
|
|
122
|
+
function buildEndpointTests(options) {
|
|
123
|
+
return options.endpoints.map((ep) => buildEndpointTest(ep, options)).join('\n\n ');
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Get consumer note for header
|
|
127
|
+
*/
|
|
128
|
+
function getConsumerNote(options) {
|
|
129
|
+
return options.consumerService === undefined
|
|
130
|
+
? ''
|
|
131
|
+
: `\n * Consumer Service: ${options.consumerService}\n`;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Build ServiceClient object code
|
|
135
|
+
*/
|
|
136
|
+
function buildServiceClientObject() {
|
|
137
|
+
return `/**
|
|
138
|
+
* Service client for making inter-service calls
|
|
139
|
+
*/
|
|
140
|
+
export const ServiceClient = {
|
|
141
|
+
/**
|
|
142
|
+
* Create a new service client instance
|
|
143
|
+
*/
|
|
144
|
+
create(config: ServiceConfig) {
|
|
145
|
+
const baseUrl = config.baseUrl;
|
|
146
|
+
const timeout = config.timeout !== undefined ? config.timeout : 5000;
|
|
147
|
+
const defaultHeaders = {
|
|
148
|
+
'Content-Type': 'application/json',
|
|
149
|
+
...config.headers,
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
const client = {
|
|
153
|
+
/**
|
|
154
|
+
* Make HTTP request
|
|
155
|
+
*/
|
|
156
|
+
async request<T>(
|
|
157
|
+
method: string,
|
|
158
|
+
path: string,
|
|
159
|
+
data?: Record<string, unknown>,
|
|
160
|
+
headers?: Record<string, string>
|
|
161
|
+
): Promise<{ status: number; body: T; headers: Record<string, string> }> {
|
|
162
|
+
const url = \\\`\\\${baseUrl}\\\${path}\\\`;
|
|
163
|
+
|
|
164
|
+
try {
|
|
165
|
+
const response = await fetch(url, {
|
|
166
|
+
method,
|
|
167
|
+
headers: { ...defaultHeaders, ...headers },
|
|
168
|
+
body: data ? JSON.stringify(data) : undefined,
|
|
169
|
+
signal: AbortSignal.timeout(timeout),
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
const body = await response.json();
|
|
173
|
+
|
|
174
|
+
return {
|
|
175
|
+
status: response.status,
|
|
176
|
+
body: body as T,
|
|
177
|
+
headers: Object.fromEntries(response.headers.entries()),
|
|
178
|
+
};
|
|
179
|
+
} catch (error) {
|
|
180
|
+
throw ErrorFactory.createTryCatchError(
|
|
181
|
+
\\\`Service call failed: \\\${(error as Error).message}\\\`,
|
|
182
|
+
error
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
|
|
187
|
+
${buildClientMethods()}
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
return client;
|
|
191
|
+
}
|
|
192
|
+
};`;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Build client methods for ServiceClient
|
|
196
|
+
*/
|
|
197
|
+
function buildClientMethods() {
|
|
198
|
+
return ` /**
|
|
199
|
+
* GET request
|
|
200
|
+
*/
|
|
201
|
+
async get<T>(path: string, headers?: Record<string, string>): Promise<{ status: number; body: T }> {
|
|
202
|
+
const res = await client.request<T>('GET', path, undefined, headers);
|
|
203
|
+
return { status: res.status, body: res.body };
|
|
204
|
+
},
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* POST request
|
|
208
|
+
*/
|
|
209
|
+
async post<T>(path: string, data: Record<string, unknown>, headers?: Record<string, string>): Promise<{ status: number; body: T }> {
|
|
210
|
+
const res = await client.request<T>('POST', path, data, headers);
|
|
211
|
+
return { status: res.status, body: res.body };
|
|
212
|
+
},
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* PUT request
|
|
216
|
+
*/
|
|
217
|
+
async put<T>(path: string, data: Record<string, unknown>, headers?: Record<string, string>): Promise<{ status: number; body: T }> {
|
|
218
|
+
const res = await client.request<T>('PUT', path, data, headers);
|
|
219
|
+
return { status: res.status, body: res.body };
|
|
220
|
+
},
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* PATCH request
|
|
224
|
+
*/
|
|
225
|
+
async patch<T>(path: string, data: Record<string, unknown>, headers?: Record<string, string>): Promise<{ status: number; body: T }> {
|
|
226
|
+
const res = await client.request<T>('PATCH', path, data, headers);
|
|
227
|
+
return { status: res.status, body: res.body };
|
|
228
|
+
},
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* DELETE request
|
|
232
|
+
*/
|
|
233
|
+
async delete<T>(path: string, headers?: Record<string, string>): Promise<{ status: number; body: T }> {
|
|
234
|
+
const res = await client.request<T>('DELETE', path, undefined, headers);
|
|
235
|
+
return { status: res.status, body: res.body };
|
|
236
|
+
}`;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Build test helpers
|
|
240
|
+
*/
|
|
241
|
+
function buildTestHelpers() {
|
|
242
|
+
return `/**
|
|
243
|
+
* Test helper functions
|
|
244
|
+
*/
|
|
245
|
+
function createClient(config: ServiceConfig) {
|
|
246
|
+
return ServiceClient.create(config);
|
|
247
|
+
}`;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Build single endpoint test
|
|
251
|
+
*/
|
|
252
|
+
function buildEndpointTest(endpoint, _options) {
|
|
253
|
+
const testName = endpoint.name || `should handle ${endpoint.method} ${endpoint.path}`;
|
|
254
|
+
const method = endpoint.method.toLowerCase();
|
|
255
|
+
const hasBody = ['post', 'put', 'patch'].includes(method);
|
|
256
|
+
const bodyArg = hasBody ? ', { test: true }' : '';
|
|
257
|
+
return `it('${testName}', async () => {
|
|
258
|
+
const response = await client.${method}('${endpoint.path}'${bodyArg});
|
|
259
|
+
|
|
260
|
+
expect(response.status).toBeLessThan(500);
|
|
261
|
+
expect(response.body).toBeDefined();
|
|
262
|
+
});`;
|
|
263
|
+
}
|
|
264
|
+
export const ServiceIntegrationTestGenerator = Object.freeze({
|
|
265
|
+
validateOptions,
|
|
266
|
+
generateIntegrationTest,
|
|
267
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ServiceRequestFactoryGenerator - Generate inter-service request factories
|
|
3
|
+
* Creates type-safe factories for testing service-to-service API calls
|
|
4
|
+
*/
|
|
5
|
+
export interface ServiceRequestField {
|
|
6
|
+
name: string;
|
|
7
|
+
type: 'string' | 'number' | 'boolean' | 'array' | 'object' | 'date' | 'email' | 'url' | 'uuid';
|
|
8
|
+
required?: boolean;
|
|
9
|
+
validation?: string[];
|
|
10
|
+
example?: string | number | boolean;
|
|
11
|
+
description?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ServiceRequestOptions {
|
|
14
|
+
name: string;
|
|
15
|
+
serviceName: string;
|
|
16
|
+
endpoint: string;
|
|
17
|
+
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
18
|
+
fields: ServiceRequestField[];
|
|
19
|
+
factoryPath: string;
|
|
20
|
+
authenticated?: boolean;
|
|
21
|
+
headers?: Record<string, string>;
|
|
22
|
+
description?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface ServiceRequestFactoryResult {
|
|
25
|
+
success: boolean;
|
|
26
|
+
factoryName: string;
|
|
27
|
+
factoryFile: string;
|
|
28
|
+
message: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Validate options
|
|
32
|
+
*/
|
|
33
|
+
export declare function validateOptions(options: ServiceRequestOptions): {
|
|
34
|
+
valid: boolean;
|
|
35
|
+
errors: string[];
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Generate request factory file
|
|
39
|
+
*/
|
|
40
|
+
export declare function generateRequestFactory(options: ServiceRequestOptions): Promise<ServiceRequestFactoryResult>;
|
|
41
|
+
export declare const ServiceRequestFactoryGenerator: Readonly<{
|
|
42
|
+
validateOptions: typeof validateOptions;
|
|
43
|
+
generateRequestFactory: typeof generateRequestFactory;
|
|
44
|
+
}>;
|
|
45
|
+
//# sourceMappingURL=ServiceRequestFactoryGenerator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceRequestFactoryGenerator.d.ts","sourceRoot":"","sources":["../../../../src/cli/scaffolding/ServiceRequestFactoryGenerator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;IAC/F,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IACpD,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,qBAAqB,GAAG;IAC/D,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CA8BA;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,2BAA2B,CAAC,CAkCtC;AA8WD,eAAO,MAAM,8BAA8B;;;EAGzC,CAAC"}
|