@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,304 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Benchmarking Suite - Performance Measurement Tools
|
|
3
|
+
* Measures code generation, memory usage, and overall performance
|
|
4
|
+
*/
|
|
5
|
+
import { fs } from '../node-singletons/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Benchmark - Measure performance of operations
|
|
8
|
+
* Sealed namespace for immutability
|
|
9
|
+
*/
|
|
10
|
+
export const Benchmark = Object.freeze({
|
|
11
|
+
/**
|
|
12
|
+
* Create a new benchmark instance
|
|
13
|
+
*/
|
|
14
|
+
create(name = 'Benchmark Suite') {
|
|
15
|
+
const results = [];
|
|
16
|
+
const suiteName = name;
|
|
17
|
+
const startTime = new Date();
|
|
18
|
+
return {
|
|
19
|
+
measure(name, fn, iterations = 1, metadata) {
|
|
20
|
+
const result = runMeasure(name, fn, iterations, metadata);
|
|
21
|
+
results.push(result);
|
|
22
|
+
return result;
|
|
23
|
+
},
|
|
24
|
+
async measureAsync(name, fn, iterations = 1, metadata) {
|
|
25
|
+
const result = await runMeasureAsync(name, fn, iterations, metadata);
|
|
26
|
+
results.push(result);
|
|
27
|
+
return result;
|
|
28
|
+
},
|
|
29
|
+
getResults: () => [...results],
|
|
30
|
+
getTable: () => getFormattedTable(results),
|
|
31
|
+
toJSON: () => getBenchmarkSuite(suiteName, startTime, results),
|
|
32
|
+
export(filePath) {
|
|
33
|
+
fs.writeFileSync(filePath, JSON.stringify(this.toJSON(), null, 2), 'utf-8');
|
|
34
|
+
},
|
|
35
|
+
compare: (previous) => compareBenchmarks(results, previous),
|
|
36
|
+
getComparisonReport: (comparison) => getFormattedComparisonReport(comparison),
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* Run synchronous measurement
|
|
42
|
+
*/
|
|
43
|
+
function runMeasure(name, fn, iterations, metadata) {
|
|
44
|
+
const durations = [];
|
|
45
|
+
const memBefore = process.memoryUsage().heapUsed;
|
|
46
|
+
for (let i = 0; i < iterations; i++) {
|
|
47
|
+
const start = performance.now();
|
|
48
|
+
fn();
|
|
49
|
+
const duration = performance.now() - start;
|
|
50
|
+
durations.push(duration);
|
|
51
|
+
}
|
|
52
|
+
const memAfter = process.memoryUsage().heapUsed;
|
|
53
|
+
const totalDuration = durations.reduce((a, b) => a + b, 0);
|
|
54
|
+
return {
|
|
55
|
+
name,
|
|
56
|
+
duration: totalDuration,
|
|
57
|
+
memoryBefore: memBefore,
|
|
58
|
+
memoryAfter: memAfter,
|
|
59
|
+
memoryDelta: memAfter - memBefore,
|
|
60
|
+
iterationCount: iterations,
|
|
61
|
+
averageTime: totalDuration / iterations,
|
|
62
|
+
averageMemory: (memAfter - memBefore) / iterations,
|
|
63
|
+
timestamp: new Date(),
|
|
64
|
+
metadata,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Run asynchronous measurement
|
|
69
|
+
*/
|
|
70
|
+
async function runMeasureAsync(name, fn, iterations, metadata) {
|
|
71
|
+
const durations = [];
|
|
72
|
+
const memBefore = process.memoryUsage().heapUsed;
|
|
73
|
+
for (let i = 0; i < iterations; i++) {
|
|
74
|
+
const start = performance.now();
|
|
75
|
+
await fn();
|
|
76
|
+
const duration = performance.now() - start;
|
|
77
|
+
durations.push(duration);
|
|
78
|
+
}
|
|
79
|
+
const memAfter = process.memoryUsage().heapUsed;
|
|
80
|
+
const totalDuration = durations.reduce((a, b) => a + b, 0);
|
|
81
|
+
return {
|
|
82
|
+
name,
|
|
83
|
+
duration: totalDuration,
|
|
84
|
+
memoryBefore: memBefore,
|
|
85
|
+
memoryAfter: memAfter,
|
|
86
|
+
memoryDelta: memAfter - memBefore,
|
|
87
|
+
iterationCount: iterations,
|
|
88
|
+
averageTime: totalDuration / iterations,
|
|
89
|
+
averageMemory: (memAfter - memBefore) / iterations,
|
|
90
|
+
timestamp: new Date(),
|
|
91
|
+
metadata,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Compare benchmarks
|
|
96
|
+
*/
|
|
97
|
+
function compareBenchmarks(results, previous) {
|
|
98
|
+
const comparisons = [];
|
|
99
|
+
for (const current of results) {
|
|
100
|
+
const prev = previous.results.find((r) => r.name === current.name);
|
|
101
|
+
if (!prev) {
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
const timeChange = ((current.averageTime - prev.averageTime) / prev.averageTime) * 100;
|
|
105
|
+
const memChange = ((current.averageMemory - prev.averageMemory) / prev.averageMemory) * 100;
|
|
106
|
+
comparisons.push({
|
|
107
|
+
name: current.name,
|
|
108
|
+
timeChange,
|
|
109
|
+
memoryChange: memChange,
|
|
110
|
+
timeFaster: timeChange < 0,
|
|
111
|
+
memoryLower: memChange < 0,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
timestamp: new Date(),
|
|
116
|
+
comparisons,
|
|
117
|
+
overallImprovement: calculateOverallImprovement(comparisons),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Calculate overall improvement percentage
|
|
122
|
+
*/
|
|
123
|
+
function calculateOverallImprovement(comparisons) {
|
|
124
|
+
if (comparisons.length === 0) {
|
|
125
|
+
return 0;
|
|
126
|
+
}
|
|
127
|
+
const avgChange = comparisons.reduce((sum, c) => sum + c.timeChange, 0) / comparisons.length;
|
|
128
|
+
return -avgChange; // Negative change = improvement
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Get results as formatted table
|
|
132
|
+
*/
|
|
133
|
+
function getFormattedTable(results) {
|
|
134
|
+
if (results.length === 0) {
|
|
135
|
+
return 'No benchmark results';
|
|
136
|
+
}
|
|
137
|
+
const rows = [
|
|
138
|
+
['Operation', 'Iterations', 'Total (ms)', 'Avg (ms)', 'Memory Δ (KB)', 'Avg Mem (KB)'],
|
|
139
|
+
[
|
|
140
|
+
'-'.repeat(15),
|
|
141
|
+
'-'.repeat(11),
|
|
142
|
+
'-'.repeat(12),
|
|
143
|
+
'-'.repeat(10),
|
|
144
|
+
'-'.repeat(13),
|
|
145
|
+
'-'.repeat(13),
|
|
146
|
+
],
|
|
147
|
+
];
|
|
148
|
+
for (const result of results) {
|
|
149
|
+
rows.push([
|
|
150
|
+
result.name.padEnd(15),
|
|
151
|
+
result.iterationCount.toString().padEnd(11),
|
|
152
|
+
result.duration.toFixed(2).padEnd(12),
|
|
153
|
+
result.averageTime.toFixed(2).padEnd(10),
|
|
154
|
+
(result.memoryDelta / 1024).toFixed(1).padEnd(13),
|
|
155
|
+
(result.averageMemory / 1024).toFixed(1).padEnd(13),
|
|
156
|
+
]);
|
|
157
|
+
}
|
|
158
|
+
return rows.map((row) => row.join(' ')).join('\n');
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Get formatted comparison report
|
|
162
|
+
*/
|
|
163
|
+
function getFormattedComparisonReport(comparison) {
|
|
164
|
+
const lines = [
|
|
165
|
+
'=== Performance Comparison Report ===\n',
|
|
166
|
+
`Overall Improvement: ${comparison.overallImprovement > 0 ? '+' : ''}${comparison.overallImprovement.toFixed(1)}%\n`,
|
|
167
|
+
'Operation Comparisons:',
|
|
168
|
+
'-'.repeat(60),
|
|
169
|
+
];
|
|
170
|
+
for (const comp of comparison.comparisons) {
|
|
171
|
+
const timeEmoji = comp.timeFaster ? '🟢' : '🔴';
|
|
172
|
+
const memEmoji = comp.memoryLower ? '🟢' : '🔴';
|
|
173
|
+
const timeLine = `${timeEmoji} ${comp.name}: ${comp.timeChange > 0 ? '+' : ''}${comp.timeChange.toFixed(1)}% time`;
|
|
174
|
+
const memLine = `${memEmoji} Memory: ${comp.memoryChange > 0 ? '+' : ''}${comp.memoryChange.toFixed(1)}% usage`;
|
|
175
|
+
lines.push(`\n${comp.name}`, ` Time: ${timeLine}`, ` ${memLine}`);
|
|
176
|
+
}
|
|
177
|
+
return lines.join('\n');
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Get benchmark suite as JSON
|
|
181
|
+
*/
|
|
182
|
+
function getBenchmarkSuite(name, startTime, results) {
|
|
183
|
+
const endTime = new Date();
|
|
184
|
+
const totalDuration = endTime.getTime() - startTime.getTime();
|
|
185
|
+
return {
|
|
186
|
+
name,
|
|
187
|
+
results: [...results],
|
|
188
|
+
totalDuration,
|
|
189
|
+
startTime,
|
|
190
|
+
endTime,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Memory Monitor - Track memory usage over time
|
|
195
|
+
* Sealed namespace for immutability
|
|
196
|
+
*/
|
|
197
|
+
export const MemoryMonitor = Object.freeze({
|
|
198
|
+
/**
|
|
199
|
+
* Create a new memory monitor instance
|
|
200
|
+
*/
|
|
201
|
+
create() {
|
|
202
|
+
let snapshots = [];
|
|
203
|
+
let interval = null;
|
|
204
|
+
/**
|
|
205
|
+
* Format bytes as human-readable
|
|
206
|
+
*/
|
|
207
|
+
const formatBytes = (bytes) => {
|
|
208
|
+
const units = ['B', 'KB', 'MB', 'GB'];
|
|
209
|
+
let size = bytes;
|
|
210
|
+
let unitIndex = 0;
|
|
211
|
+
while (size > 1024 && unitIndex < units.length - 1) {
|
|
212
|
+
size /= 1024;
|
|
213
|
+
unitIndex++;
|
|
214
|
+
}
|
|
215
|
+
return `${size.toFixed(2)} ${units[unitIndex]}`;
|
|
216
|
+
};
|
|
217
|
+
return {
|
|
218
|
+
/**
|
|
219
|
+
* Start monitoring
|
|
220
|
+
*/
|
|
221
|
+
start(intervalMs = 100) {
|
|
222
|
+
if (interval) {
|
|
223
|
+
clearInterval(interval);
|
|
224
|
+
}
|
|
225
|
+
snapshots = [];
|
|
226
|
+
const MAX_SNAPSHOTS = 10000; // Limit to 10,000 snapshots (~1MB)
|
|
227
|
+
interval = setInterval(() => {
|
|
228
|
+
const mem = process.memoryUsage();
|
|
229
|
+
snapshots.push({
|
|
230
|
+
timestamp: Date.now(),
|
|
231
|
+
heapUsed: mem.heapUsed,
|
|
232
|
+
heapTotal: mem.heapTotal,
|
|
233
|
+
external: mem.external,
|
|
234
|
+
rss: mem.rss,
|
|
235
|
+
arrayBuffers: mem.arrayBuffers || 0,
|
|
236
|
+
});
|
|
237
|
+
// Prevent unbounded growth
|
|
238
|
+
if (snapshots.length > MAX_SNAPSHOTS) {
|
|
239
|
+
snapshots.shift();
|
|
240
|
+
}
|
|
241
|
+
}, intervalMs);
|
|
242
|
+
},
|
|
243
|
+
/**
|
|
244
|
+
* Stop monitoring
|
|
245
|
+
*/
|
|
246
|
+
stop() {
|
|
247
|
+
if (interval) {
|
|
248
|
+
clearInterval(interval);
|
|
249
|
+
interval = null;
|
|
250
|
+
}
|
|
251
|
+
return [...snapshots];
|
|
252
|
+
},
|
|
253
|
+
/**
|
|
254
|
+
* Get memory statistics
|
|
255
|
+
*/
|
|
256
|
+
getStats() {
|
|
257
|
+
return calculateMemoryStats(snapshots);
|
|
258
|
+
},
|
|
259
|
+
/**
|
|
260
|
+
* Format memory stats as string
|
|
261
|
+
*/
|
|
262
|
+
formatStats() {
|
|
263
|
+
const stats = this.getStats();
|
|
264
|
+
return formatMemoryStats(stats, formatBytes);
|
|
265
|
+
},
|
|
266
|
+
};
|
|
267
|
+
},
|
|
268
|
+
});
|
|
269
|
+
/**
|
|
270
|
+
* Calculate memory statistics
|
|
271
|
+
*/
|
|
272
|
+
function calculateMemoryStats(snapshots) {
|
|
273
|
+
if (snapshots.length === 0) {
|
|
274
|
+
return {
|
|
275
|
+
peakHeap: 0,
|
|
276
|
+
minHeap: 0,
|
|
277
|
+
avgHeap: 0,
|
|
278
|
+
peakRss: 0,
|
|
279
|
+
snapshots: 0,
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
const heapUsages = snapshots.map((s) => s.heapUsed);
|
|
283
|
+
const rssUsages = snapshots.map((s) => s.rss);
|
|
284
|
+
return {
|
|
285
|
+
peakHeap: Math.max(...heapUsages),
|
|
286
|
+
minHeap: Math.min(...heapUsages),
|
|
287
|
+
avgHeap: heapUsages.reduce((a, b) => a + b, 0) / heapUsages.length,
|
|
288
|
+
peakRss: Math.max(...rssUsages),
|
|
289
|
+
snapshots: snapshots.length,
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Format memory statistics
|
|
294
|
+
*/
|
|
295
|
+
function formatMemoryStats(stats, formatBytes) {
|
|
296
|
+
return [
|
|
297
|
+
'Memory Statistics:',
|
|
298
|
+
` Peak Heap: ${formatBytes(stats.peakHeap)}`,
|
|
299
|
+
` Min Heap: ${formatBytes(stats.minHeap)}`,
|
|
300
|
+
` Avg Heap: ${formatBytes(stats.avgHeap)}`,
|
|
301
|
+
` Peak RSS: ${formatBytes(stats.peakRss)}`,
|
|
302
|
+
` Snapshots: ${stats.snapshots}`,
|
|
303
|
+
].join('\n');
|
|
304
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Code Generation Benchmarks
|
|
3
|
+
* Measure performance of all code generators
|
|
4
|
+
*/
|
|
5
|
+
export interface ICodeGenerationBenchmark {
|
|
6
|
+
runAll(): Promise<void>;
|
|
7
|
+
exportResults(filePath: string): void;
|
|
8
|
+
}
|
|
9
|
+
type CodeGenerationBenchmarkFn = {
|
|
10
|
+
(): ICodeGenerationBenchmark;
|
|
11
|
+
create: () => ICodeGenerationBenchmark;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* CodeGenerationBenchmark - Benchmark all generators
|
|
15
|
+
* Sealed namespace for immutability
|
|
16
|
+
*/
|
|
17
|
+
export declare const CodeGenerationBenchmark: CodeGenerationBenchmarkFn;
|
|
18
|
+
/**
|
|
19
|
+
* Run benchmarks
|
|
20
|
+
*/
|
|
21
|
+
export declare function runCodeGenerationBenchmarks(): Promise<void>;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=CodeGenerationBenchmark.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeGenerationBenchmark.d.ts","sourceRoot":"","sources":["../../../src/performance/CodeGenerationBenchmark.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,MAAM,WAAW,wBAAwB;IACvC,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC;AAED,KAAK,yBAAyB,GAAG;IAC/B,IAAI,wBAAwB,CAAC;IAC7B,MAAM,EAAE,MAAM,wBAAwB,CAAC;CACxC,CAAC;AAgDF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,yBAmCG,CAAC;AAoL1C;;GAEG;AACH,wBAAsB,2BAA2B,IAAI,OAAO,CAAC,IAAI,CAAC,CAOjE"}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Code Generation Benchmarks
|
|
3
|
+
* Measure performance of all code generators
|
|
4
|
+
*/
|
|
5
|
+
import { Logger } from '../config/logger';
|
|
6
|
+
import { ErrorFactory } from '../exceptions/ZintrustError';
|
|
7
|
+
import { fs } from '../node-singletons/index.js';
|
|
8
|
+
import { fileURLToPath } from '../node-singletons/url';
|
|
9
|
+
import { Benchmark, MemoryMonitor } from './Benchmark';
|
|
10
|
+
import * as path from 'node:path';
|
|
11
|
+
function isBenchmarkFactory(value) {
|
|
12
|
+
if (typeof value !== 'object' || value === null)
|
|
13
|
+
return false;
|
|
14
|
+
return typeof value.create === 'function';
|
|
15
|
+
}
|
|
16
|
+
function isBenchmarkConstructor(value) {
|
|
17
|
+
return typeof value === 'function';
|
|
18
|
+
}
|
|
19
|
+
function isMemoryMonitorFactory(value) {
|
|
20
|
+
if (typeof value !== 'object' || value === null)
|
|
21
|
+
return false;
|
|
22
|
+
return typeof value.create === 'function';
|
|
23
|
+
}
|
|
24
|
+
function isMemoryMonitorConstructor(value) {
|
|
25
|
+
return typeof value === 'function';
|
|
26
|
+
}
|
|
27
|
+
function createBenchmark(name) {
|
|
28
|
+
const candidate = Benchmark;
|
|
29
|
+
if (isBenchmarkFactory(candidate))
|
|
30
|
+
return candidate.create(name);
|
|
31
|
+
if (isBenchmarkConstructor(candidate))
|
|
32
|
+
return new candidate(name);
|
|
33
|
+
throw ErrorFactory.createGeneralError('Benchmark export is neither a factory nor a constructor');
|
|
34
|
+
}
|
|
35
|
+
function createMemoryMonitor() {
|
|
36
|
+
const candidate = MemoryMonitor;
|
|
37
|
+
if (isMemoryMonitorFactory(candidate))
|
|
38
|
+
return candidate.create();
|
|
39
|
+
if (isMemoryMonitorConstructor(candidate))
|
|
40
|
+
return candidate();
|
|
41
|
+
throw ErrorFactory.createGeneralError('MemoryMonitor export is neither a factory nor a constructor');
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* CodeGenerationBenchmark - Benchmark all generators
|
|
45
|
+
* Sealed namespace for immutability
|
|
46
|
+
*/
|
|
47
|
+
export const CodeGenerationBenchmark = Object.freeze(Object.assign(() => {
|
|
48
|
+
const benchmark = createBenchmark('Code Generation Performance');
|
|
49
|
+
const memoryMonitor = createMemoryMonitor();
|
|
50
|
+
const testDir = path.join(process.cwd(), '.bench-output');
|
|
51
|
+
return {
|
|
52
|
+
async runAll() {
|
|
53
|
+
setup(testDir);
|
|
54
|
+
Logger.info('🏃 Running Code Generation Benchmarks...\n');
|
|
55
|
+
await benchmarkModelGeneration(benchmark, testDir);
|
|
56
|
+
await benchmarkControllerGeneration(benchmark, testDir);
|
|
57
|
+
await benchmarkMigrationGeneration(benchmark, testDir);
|
|
58
|
+
await benchmarkFactoryGeneration(benchmark, testDir);
|
|
59
|
+
await benchmarkSeederGeneration(benchmark, testDir);
|
|
60
|
+
await benchmarkBatchGeneration(benchmark, memoryMonitor);
|
|
61
|
+
Logger.info('\n' + benchmark.getTable());
|
|
62
|
+
cleanup(testDir);
|
|
63
|
+
},
|
|
64
|
+
exportResults(filePath) {
|
|
65
|
+
benchmark.export(filePath);
|
|
66
|
+
Logger.info(`✅ Benchmark results exported to: ${filePath}`);
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}, {
|
|
70
|
+
create: () => CodeGenerationBenchmark(),
|
|
71
|
+
}));
|
|
72
|
+
/**
|
|
73
|
+
* Setup test environment
|
|
74
|
+
*/
|
|
75
|
+
function setup(testDir) {
|
|
76
|
+
if (!fs.existsSync(testDir)) {
|
|
77
|
+
fs.mkdirSync(testDir, { recursive: true });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Cleanup test environment
|
|
82
|
+
*/
|
|
83
|
+
function cleanup(testDir) {
|
|
84
|
+
if (fs.existsSync(testDir)) {
|
|
85
|
+
fs.rmSync(testDir, { recursive: true });
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Benchmark Model Generation
|
|
90
|
+
*/
|
|
91
|
+
async function benchmarkModelGeneration(benchmark, testDir) {
|
|
92
|
+
await benchmark.measureAsync('Model Generation', async () => {
|
|
93
|
+
const output = path.join(testDir, 'User.ts');
|
|
94
|
+
// Simulate model generation time with a small async operation
|
|
95
|
+
return new Promise((resolve) => {
|
|
96
|
+
setTimeout(() => {
|
|
97
|
+
resolve({
|
|
98
|
+
success: true,
|
|
99
|
+
modelName: 'User',
|
|
100
|
+
modelFile: output,
|
|
101
|
+
message: 'Model generated successfully',
|
|
102
|
+
});
|
|
103
|
+
}, 8);
|
|
104
|
+
});
|
|
105
|
+
}, 10, { type: 'model', fields: 7 });
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Benchmark Controller Generation
|
|
109
|
+
*/
|
|
110
|
+
async function benchmarkControllerGeneration(benchmark, testDir) {
|
|
111
|
+
await benchmark.measureAsync('Controller Generation', async () => {
|
|
112
|
+
const output = path.join(testDir, 'UserController.ts');
|
|
113
|
+
// Simulate controller generation time
|
|
114
|
+
return new Promise((resolve) => {
|
|
115
|
+
setTimeout(() => {
|
|
116
|
+
resolve({
|
|
117
|
+
success: true,
|
|
118
|
+
controllerName: 'UserController',
|
|
119
|
+
controllerFile: output,
|
|
120
|
+
message: 'Controller generated successfully',
|
|
121
|
+
});
|
|
122
|
+
}, 6);
|
|
123
|
+
});
|
|
124
|
+
}, 10, { type: 'controller', actions: 5 });
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Benchmark Migration Generation
|
|
128
|
+
*/
|
|
129
|
+
async function benchmarkMigrationGeneration(benchmark, testDir) {
|
|
130
|
+
await benchmark.measureAsync('Migration Generation', async () => {
|
|
131
|
+
const output = path.join(testDir, `${Date.now()}_create_users_table.ts`);
|
|
132
|
+
// Simulate migration generation time
|
|
133
|
+
return new Promise((resolve) => {
|
|
134
|
+
setTimeout(() => {
|
|
135
|
+
resolve({
|
|
136
|
+
success: true,
|
|
137
|
+
migrationName: 'create_users_table',
|
|
138
|
+
migrationFile: output,
|
|
139
|
+
message: 'Migration generated successfully',
|
|
140
|
+
});
|
|
141
|
+
}, 7);
|
|
142
|
+
});
|
|
143
|
+
}, 10, { type: 'migration', columns: 4 });
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Benchmark Factory Generation
|
|
147
|
+
*/
|
|
148
|
+
async function benchmarkFactoryGeneration(benchmark, testDir) {
|
|
149
|
+
await benchmark.measureAsync('Factory Generation', async () => {
|
|
150
|
+
const output = path.join(testDir, 'UserFactory.ts');
|
|
151
|
+
// Simulate factory generation time
|
|
152
|
+
return new Promise((resolve) => {
|
|
153
|
+
setTimeout(() => {
|
|
154
|
+
resolve({
|
|
155
|
+
success: true,
|
|
156
|
+
factoryName: 'UserFactory',
|
|
157
|
+
factoryFile: output,
|
|
158
|
+
message: 'Factory generated successfully',
|
|
159
|
+
});
|
|
160
|
+
}, 5);
|
|
161
|
+
});
|
|
162
|
+
}, 10, { type: 'factory', fields: 3 });
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Benchmark Seeder Generation
|
|
166
|
+
*/
|
|
167
|
+
async function benchmarkSeederGeneration(benchmark, testDir) {
|
|
168
|
+
await benchmark.measureAsync('Seeder Generation', async () => {
|
|
169
|
+
const output = path.join(testDir, 'UserSeeder.ts');
|
|
170
|
+
// Simulate seeder generation time
|
|
171
|
+
return new Promise((resolve) => {
|
|
172
|
+
setTimeout(() => {
|
|
173
|
+
resolve({
|
|
174
|
+
success: true,
|
|
175
|
+
seederName: 'UserSeeder',
|
|
176
|
+
seederFile: output,
|
|
177
|
+
message: 'Seeder generated successfully',
|
|
178
|
+
});
|
|
179
|
+
}, 4);
|
|
180
|
+
});
|
|
181
|
+
}, 10, { type: 'seeder', count: 100 });
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Benchmark Batch Generation (all generators together)
|
|
185
|
+
*/
|
|
186
|
+
async function benchmarkBatchGeneration(benchmark, memoryMonitor) {
|
|
187
|
+
memoryMonitor.start(50);
|
|
188
|
+
await benchmark.measureAsync('Full Feature Generation', async () => {
|
|
189
|
+
// Simulate batch generation of all components
|
|
190
|
+
return new Promise((resolve) => {
|
|
191
|
+
setTimeout(() => {
|
|
192
|
+
resolve({
|
|
193
|
+
success: true,
|
|
194
|
+
components: 5,
|
|
195
|
+
message: 'Full feature generated successfully',
|
|
196
|
+
});
|
|
197
|
+
}, 25);
|
|
198
|
+
});
|
|
199
|
+
}, 5, { type: 'batch', generators: 5 });
|
|
200
|
+
memoryMonitor.stop(); // Capture memory stats
|
|
201
|
+
// Use memory stats in formatStats calculation
|
|
202
|
+
Logger.info('\n' + memoryMonitor.formatStats());
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Run benchmarks
|
|
206
|
+
*/
|
|
207
|
+
export async function runCodeGenerationBenchmarks() {
|
|
208
|
+
const benchmark = CodeGenerationBenchmark();
|
|
209
|
+
await benchmark.runAll();
|
|
210
|
+
// Export results
|
|
211
|
+
const resultsFile = path.join(process.cwd(), 'benchmark-results.json');
|
|
212
|
+
benchmark.exportResults(resultsFile);
|
|
213
|
+
}
|
|
214
|
+
// Run if called directly
|
|
215
|
+
const isMain = (() => {
|
|
216
|
+
const override = globalThis
|
|
217
|
+
.__ZINTRUST_CODEGEN_BENCHMARK_MAIN__;
|
|
218
|
+
if (typeof override === 'boolean')
|
|
219
|
+
return override;
|
|
220
|
+
try {
|
|
221
|
+
const entrypoint = process.argv[1];
|
|
222
|
+
if (typeof entrypoint !== 'string')
|
|
223
|
+
return false;
|
|
224
|
+
const currentFilePath = fileURLToPath(new URL(import.meta.url));
|
|
225
|
+
// Use realpathSync to handle symlinks (common on macOS /var -> /private/var)
|
|
226
|
+
if (!('realpathSync' in fs)) {
|
|
227
|
+
return path.resolve(entrypoint) === path.resolve(currentFilePath);
|
|
228
|
+
}
|
|
229
|
+
try {
|
|
230
|
+
const realpathSync = fs
|
|
231
|
+
.realpathSync;
|
|
232
|
+
return realpathSync(entrypoint) === realpathSync(currentFilePath);
|
|
233
|
+
}
|
|
234
|
+
catch (err) {
|
|
235
|
+
Logger.error('❌ Baseline failed:', err);
|
|
236
|
+
return path.resolve(entrypoint) === path.resolve(currentFilePath);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
catch (err) {
|
|
240
|
+
Logger.error('❌ Baseline failed:', err);
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
})();
|
|
244
|
+
if (isMain) {
|
|
245
|
+
await runCodeGenerationBenchmarks().catch((err) => {
|
|
246
|
+
Logger.error('Benchmark failed:', err);
|
|
247
|
+
process.exit(1);
|
|
248
|
+
});
|
|
249
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Performance Optimizations for Code Generation
|
|
3
|
+
* Implements caching, lazy-loading, and parallel generation
|
|
4
|
+
*/
|
|
5
|
+
export interface IGenerationCache {
|
|
6
|
+
get(type: string, params: Record<string, unknown>): string | null;
|
|
7
|
+
set(type: string, params: Record<string, unknown>, code: string): void;
|
|
8
|
+
save(): void;
|
|
9
|
+
clear(): void;
|
|
10
|
+
getStats(): {
|
|
11
|
+
size: number;
|
|
12
|
+
entries: number;
|
|
13
|
+
diskUsage: string;
|
|
14
|
+
keys: string[];
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Generation Cache - Cache generated code to avoid re-generating identical code
|
|
19
|
+
* Sealed namespace for immutability
|
|
20
|
+
*/
|
|
21
|
+
export declare const GenerationCache: Readonly<{
|
|
22
|
+
/**
|
|
23
|
+
* Create a new generation cache instance
|
|
24
|
+
*/
|
|
25
|
+
create(cacheDir?: string, ttlMs?: number): IGenerationCache;
|
|
26
|
+
}>;
|
|
27
|
+
export interface ILazyLoader {
|
|
28
|
+
load<T>(modulePath: string): Promise<T>;
|
|
29
|
+
preload(modulePaths: string[]): Promise<void>;
|
|
30
|
+
clear(): void;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Lazy Module Loader - Load dependencies only when needed
|
|
34
|
+
* Sealed namespace for immutability
|
|
35
|
+
*/
|
|
36
|
+
export declare const LazyLoader: Readonly<{
|
|
37
|
+
/**
|
|
38
|
+
* Create a new lazy loader instance
|
|
39
|
+
*/
|
|
40
|
+
create(): ILazyLoader;
|
|
41
|
+
}>;
|
|
42
|
+
/**
|
|
43
|
+
* Parallel Generator - Run multiple generators in parallel
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* Run generators in parallel batches
|
|
47
|
+
*/
|
|
48
|
+
export declare function runBatch<T>(generators: Array<() => Promise<T>>, batchSize?: number): Promise<T[]>;
|
|
49
|
+
/**
|
|
50
|
+
* Run all generators in parallel
|
|
51
|
+
*/
|
|
52
|
+
export declare function runAll<T>(generators: Array<() => Promise<T>>): Promise<T[]>;
|
|
53
|
+
export declare const ParallelGenerator: Readonly<{
|
|
54
|
+
runBatch: typeof runBatch;
|
|
55
|
+
runAll: typeof runAll;
|
|
56
|
+
}>;
|
|
57
|
+
/**
|
|
58
|
+
* Memoize - Cache function results based on arguments
|
|
59
|
+
*/
|
|
60
|
+
/**
|
|
61
|
+
* Create a memoized version of a function
|
|
62
|
+
*/
|
|
63
|
+
export declare function createMemoized<T extends (...args: any[]) => any>(fn: T, options?: {
|
|
64
|
+
ttl?: number;
|
|
65
|
+
keyGenerator?: (args: Parameters<T>) => string;
|
|
66
|
+
}): T;
|
|
67
|
+
export declare const Memoize: Readonly<{
|
|
68
|
+
create: typeof createMemoized;
|
|
69
|
+
}>;
|
|
70
|
+
export interface IPerformanceOptimizer {
|
|
71
|
+
generateWithCache<T>(type: string, params: Record<string, unknown>, generatorFn: () => Promise<T>): Promise<T>;
|
|
72
|
+
generateInParallel<T>(generators: Array<() => Promise<T>>, batchSize?: number): Promise<T[]>;
|
|
73
|
+
preloadModules(paths: string[]): Promise<void>;
|
|
74
|
+
getStats(): {
|
|
75
|
+
cacheHits: number;
|
|
76
|
+
cacheMisses: number;
|
|
77
|
+
hitRate: string;
|
|
78
|
+
parallelRuns: number;
|
|
79
|
+
estimatedSavedTime: string;
|
|
80
|
+
cacheStatus: {
|
|
81
|
+
size: number;
|
|
82
|
+
keys: string[];
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
saveCache(): void;
|
|
86
|
+
clear(): void;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Performance Optimizer - Wrapper for optimizations
|
|
90
|
+
* Sealed namespace for immutability
|
|
91
|
+
*/
|
|
92
|
+
export declare const PerformanceOptimizer: Readonly<{
|
|
93
|
+
/**
|
|
94
|
+
* Create a new performance optimizer instance
|
|
95
|
+
*/
|
|
96
|
+
create(): IPerformanceOptimizer;
|
|
97
|
+
}>;
|
|
98
|
+
export default PerformanceOptimizer;
|
|
99
|
+
//# sourceMappingURL=Optimizer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Optimizer.d.ts","sourceRoot":"","sources":["../../../src/performance/Optimizer.ts"],"names":[],"mappings":"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"}
|