@zintrust/core 0.1.40 → 0.1.42
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/zintrust-main.d.ts.map +1 -1
- package/bin/zintrust-main.js +22 -1
- package/package.json +24 -4
- package/public/error-pages/404.html +2 -2
- package/src/auth/Auth.js +1 -1
- package/src/boot/Application.d.ts +1 -16
- package/src/boot/Application.d.ts.map +1 -1
- package/src/boot/Application.js +2 -290
- package/src/boot/Server.d.ts +1 -1
- package/src/boot/Server.d.ts.map +1 -1
- package/src/boot/bootstrap.js +50 -16
- package/src/boot/registry/registerRoute.d.ts +6 -0
- package/src/boot/registry/registerRoute.d.ts.map +1 -0
- package/src/boot/registry/registerRoute.js +96 -0
- package/src/boot/registry/runtime.d.ts +15 -0
- package/src/boot/registry/runtime.d.ts.map +1 -0
- package/src/boot/registry/runtime.js +364 -0
- package/src/boot/registry/type.d.ts +25 -0
- package/src/boot/registry/type.d.ts.map +1 -0
- package/src/boot/registry/type.js +1 -0
- package/src/boot/registry/worker.d.ts +6 -0
- package/src/boot/registry/worker.d.ts.map +1 -0
- package/src/boot/registry/worker.js +35 -0
- package/src/cache/drivers/KVRemoteDriver.d.ts.map +1 -1
- package/src/cache/drivers/KVRemoteDriver.js +14 -1
- package/src/cli/CLI.d.ts.map +1 -1
- package/src/cli/CLI.js +94 -34
- package/src/cli/ErrorHandler.js +1 -1
- package/src/cli/commands/ConfigCommand.d.ts.map +1 -1
- package/src/cli/commands/ConfigCommand.js +3 -5
- package/src/cli/commands/ContainerProxiesCommand.d.ts +5 -0
- package/src/cli/commands/ContainerProxiesCommand.d.ts.map +1 -0
- package/src/cli/commands/ContainerProxiesCommand.js +77 -0
- package/src/cli/commands/ContainerWorkersCommand.d.ts +5 -0
- package/src/cli/commands/ContainerWorkersCommand.d.ts.map +1 -0
- package/src/cli/commands/ContainerWorkersCommand.js +57 -0
- package/src/cli/commands/D1LearnCommand.d.ts +9 -0
- package/src/cli/commands/D1LearnCommand.d.ts.map +1 -0
- package/src/cli/commands/D1LearnCommand.js +143 -0
- package/src/cli/commands/D1MigrateCommand.d.ts.map +1 -1
- package/src/cli/commands/D1MigrateCommand.js +55 -16
- package/src/cli/commands/DeployCommand.d.ts +16 -0
- package/src/cli/commands/DeployCommand.d.ts.map +1 -0
- package/src/cli/commands/DeployCommand.js +110 -0
- package/src/cli/commands/DeployContainerProxiesCommand.d.ts +5 -0
- package/src/cli/commands/DeployContainerProxiesCommand.d.ts.map +1 -0
- package/src/cli/commands/DeployContainerProxiesCommand.js +27 -0
- package/src/cli/commands/DeployContainerWorkersCommand.d.ts +5 -0
- package/src/cli/commands/DeployContainerWorkersCommand.d.ts.map +1 -0
- package/src/cli/commands/DeployContainerWorkersCommand.js +27 -0
- package/src/cli/commands/DockerComposeCommandUtils.d.ts +3 -0
- package/src/cli/commands/DockerComposeCommandUtils.d.ts.map +1 -0
- package/src/cli/commands/DockerComposeCommandUtils.js +34 -0
- package/src/cli/commands/DoctorArchitectureCommand.d.ts +5 -0
- package/src/cli/commands/DoctorArchitectureCommand.d.ts.map +1 -0
- package/src/cli/commands/DoctorArchitectureCommand.js +54 -0
- package/src/cli/commands/InitContainerCommand.d.ts +5 -0
- package/src/cli/commands/InitContainerCommand.d.ts.map +1 -0
- package/src/cli/commands/InitContainerCommand.js +231 -0
- package/src/cli/commands/InitEcosystemCommand.d.ts +6 -0
- package/src/cli/commands/InitEcosystemCommand.d.ts.map +1 -0
- package/src/cli/commands/InitEcosystemCommand.js +51 -0
- package/src/cli/commands/InitProducerCommand.d.ts +5 -0
- package/src/cli/commands/InitProducerCommand.d.ts.map +1 -0
- package/src/cli/commands/InitProducerCommand.js +47 -0
- package/src/cli/commands/InitProxyCommand.d.ts +5 -0
- package/src/cli/commands/InitProxyCommand.d.ts.map +1 -0
- package/src/cli/commands/InitProxyCommand.js +442 -0
- package/src/cli/commands/MigrateCommand.d.ts.map +1 -1
- package/src/cli/commands/MigrateCommand.js +78 -36
- package/src/cli/commands/MigrateWorkerCommand.d.ts.map +1 -1
- package/src/cli/commands/MigrateWorkerCommand.js +36 -2
- package/src/cli/commands/MongoDBProxyCommand.d.ts +5 -0
- package/src/cli/commands/MongoDBProxyCommand.d.ts.map +1 -0
- package/src/cli/commands/MongoDBProxyCommand.js +98 -0
- package/src/cli/commands/MySqlProxyCommand.d.ts +6 -0
- package/src/cli/commands/MySqlProxyCommand.d.ts.map +1 -0
- package/src/cli/commands/MySqlProxyCommand.js +32 -0
- package/src/cli/commands/PostgresProxyCommand.d.ts +6 -0
- package/src/cli/commands/PostgresProxyCommand.d.ts.map +1 -0
- package/src/cli/commands/PostgresProxyCommand.js +32 -0
- package/src/cli/commands/ProxyCommand.d.ts +12 -0
- package/src/cli/commands/ProxyCommand.d.ts.map +1 -0
- package/src/cli/commands/ProxyCommand.js +80 -0
- package/src/cli/commands/ProxyCommandUtils.d.ts +6 -0
- package/src/cli/commands/ProxyCommandUtils.d.ts.map +1 -0
- package/src/cli/commands/ProxyCommandUtils.js +38 -0
- package/src/cli/commands/PutCommand.d.ts +6 -0
- package/src/cli/commands/PutCommand.d.ts.map +1 -0
- package/src/cli/commands/PutCommand.js +173 -0
- package/src/cli/commands/QueueRecoveryCommand.d.ts +6 -0
- package/src/cli/commands/QueueRecoveryCommand.d.ts.map +1 -0
- package/src/cli/commands/QueueRecoveryCommand.js +612 -0
- package/src/cli/commands/RedisProxyCommand.d.ts +6 -0
- package/src/cli/commands/RedisProxyCommand.d.ts.map +1 -0
- package/src/cli/commands/RedisProxyCommand.js +53 -0
- package/src/cli/commands/ScheduleListCommand.d.ts +6 -0
- package/src/cli/commands/ScheduleListCommand.d.ts.map +1 -0
- package/src/cli/commands/ScheduleListCommand.js +62 -0
- package/src/cli/commands/ScheduleRunCommand.d.ts +6 -0
- package/src/cli/commands/ScheduleRunCommand.d.ts.map +1 -0
- package/src/cli/commands/ScheduleRunCommand.js +32 -0
- package/src/cli/commands/ScheduleStartCommand.d.ts +6 -0
- package/src/cli/commands/ScheduleStartCommand.d.ts.map +1 -0
- package/src/cli/commands/ScheduleStartCommand.js +40 -0
- package/src/cli/commands/SecretsCommand.d.ts.map +1 -1
- package/src/cli/commands/SecretsCommand.js +2 -2
- package/src/cli/commands/SmtpProxyCommand.d.ts +6 -0
- package/src/cli/commands/SmtpProxyCommand.d.ts.map +1 -0
- package/src/cli/commands/SmtpProxyCommand.js +56 -0
- package/src/cli/commands/SqlProxyCommandUtils.d.ts +46 -0
- package/src/cli/commands/SqlProxyCommandUtils.d.ts.map +1 -0
- package/src/cli/commands/SqlProxyCommandUtils.js +48 -0
- package/src/cli/commands/SqlServerProxyCommand.d.ts +5 -0
- package/src/cli/commands/SqlServerProxyCommand.d.ts.map +1 -0
- package/src/cli/commands/SqlServerProxyCommand.js +85 -0
- package/src/cli/commands/StartCommand.d.ts.map +1 -1
- package/src/cli/commands/StartCommand.js +132 -17
- package/src/cli/commands/WorkerCommands.d.ts +1 -0
- package/src/cli/commands/WorkerCommands.d.ts.map +1 -1
- package/src/cli/commands/WorkerCommands.js +140 -6
- package/src/cli/commands/index.d.ts +2 -0
- package/src/cli/commands/index.d.ts.map +1 -1
- package/src/cli/commands/index.js +2 -0
- package/src/cli/commands/runner/index.d.ts +2 -2
- package/src/cli/commands/runner/index.d.ts.map +1 -1
- package/src/cli/commands/runner/index.js +15 -4
- package/src/cli/commands/schedule/ScheduleCliSupport.d.ts +6 -0
- package/src/cli/commands/schedule/ScheduleCliSupport.d.ts.map +1 -0
- package/src/cli/commands/schedule/ScheduleCliSupport.js +55 -0
- package/src/cli/config/ConfigManager.d.ts.map +1 -1
- package/src/cli/config/ConfigManager.js +8 -1
- package/src/cli/d1/D1SqlMigrations.d.ts.map +1 -1
- package/src/cli/d1/D1SqlMigrations.js +14 -1
- package/src/cli/d1/WranglerConfig.d.ts.map +1 -1
- package/src/cli/d1/WranglerConfig.js +34 -2
- package/src/cli/index.d.ts +4 -0
- package/src/cli/index.d.ts.map +1 -1
- package/src/cli/index.js +4 -0
- package/src/cli/scaffolding/ProjectScaffolder.d.ts.map +1 -1
- package/src/cli/scaffolding/ProjectScaffolder.js +2 -0
- package/src/cli/scaffolding/ServiceScaffolder.d.ts.map +1 -1
- package/src/cli/scaffolding/ServiceScaffolder.js +1 -0
- package/src/cli/services/VersionChecker.d.ts.map +1 -1
- package/src/cli/services/VersionChecker.js +5 -1
- package/src/cli/utils/DatabaseCliUtils.d.ts.map +1 -1
- package/src/cli/utils/DatabaseCliUtils.js +6 -1
- package/src/cli/utils/EnvFileLoader.d.ts.map +1 -1
- package/src/cli/utils/EnvFileLoader.js +35 -15
- package/src/cli/workers/QueueWorkRunner.js +1 -1
- package/src/cli.d.ts +5 -0
- package/src/cli.d.ts.map +1 -0
- package/src/cli.js +4 -0
- package/src/collections/index.d.ts +2 -2
- package/src/collections/index.d.ts.map +1 -1
- package/src/collections/index.js +1 -1
- package/src/common/HealthRoutes.d.ts.map +1 -1
- package/src/common/HealthRoutes.js +50 -2
- package/src/common/RemoteSignedJson.d.ts +1 -0
- package/src/common/RemoteSignedJson.d.ts.map +1 -1
- package/src/common/RemoteSignedJson.js +81 -29
- package/src/common/index.d.ts +1 -0
- package/src/common/index.d.ts.map +1 -1
- package/src/common/index.js +12 -1
- package/src/common/utility.d.ts.map +1 -1
- package/src/common/utility.js +2 -6
- package/src/config/FileLogWriter.d.ts.map +1 -1
- package/src/config/FileLogWriter.js +21 -6
- package/src/config/app.d.ts +4 -0
- package/src/config/app.d.ts.map +1 -1
- package/src/config/app.js +4 -0
- package/src/config/cache.d.ts.map +1 -1
- package/src/config/cache.js +22 -2
- package/src/config/cloudflare.d.ts +5 -1
- package/src/config/cloudflare.d.ts.map +1 -1
- package/src/config/cloudflare.js +67 -8
- package/src/config/database.d.ts.map +1 -1
- package/src/config/database.js +48 -13
- package/src/config/env.d.ts +87 -2
- package/src/config/env.d.ts.map +1 -1
- package/src/config/env.js +158 -19
- package/src/config/index.d.ts +1 -0
- package/src/config/index.d.ts.map +1 -1
- package/src/config/mail.d.ts.map +1 -1
- package/src/config/mail.js +16 -10
- package/src/config/middleware.d.ts +5 -0
- package/src/config/middleware.d.ts.map +1 -1
- package/src/config/middleware.js +19 -1
- package/src/config/queue.d.ts.map +1 -1
- package/src/config/queue.js +70 -9
- package/src/config/redis.d.ts.map +1 -1
- package/src/config/redis.js +48 -13
- package/src/config/storage.d.ts.map +1 -1
- package/src/config/storage.js +1 -0
- package/src/config/type.d.ts +18 -0
- package/src/config/type.d.ts.map +1 -1
- package/src/config/workers.d.ts.map +1 -1
- package/src/config/workers.js +122 -16
- package/src/functions/cloudflare.d.ts.map +1 -1
- package/src/functions/cloudflare.js +55 -1
- package/src/health/StartupHealthChecks.js +1 -1
- package/src/helper/index.d.ts +225 -0
- package/src/helper/index.d.ts.map +1 -0
- package/src/helper/index.js +347 -0
- package/src/http/FileUpload.d.ts +3 -2
- package/src/http/FileUpload.d.ts.map +1 -1
- package/src/http/Kernel.d.ts.map +1 -1
- package/src/http/Kernel.js +2 -1
- package/src/http/error-pages/ErrorPageRenderer.d.ts +4 -0
- package/src/http/error-pages/ErrorPageRenderer.d.ts.map +1 -1
- package/src/http/error-pages/ErrorPageRenderer.js +141 -1
- package/src/http/middleware/BodyParsingMiddleware.d.ts.map +1 -1
- package/src/http/middleware/BodyParsingMiddleware.js +33 -6
- package/src/index.d.ts +26 -57
- package/src/index.d.ts.map +1 -1
- package/src/index.js +32 -18
- package/src/microservices/ServiceAuthMiddleware.d.ts.map +1 -1
- package/src/microservices/ServiceAuthMiddleware.js +12 -4
- package/src/middleware/CsrfMiddleware.d.ts.map +1 -1
- package/src/middleware/CsrfMiddleware.js +30 -16
- package/src/middleware/ErrorHandlerMiddleware.d.ts.map +1 -1
- package/src/middleware/ErrorHandlerMiddleware.js +2 -1
- package/src/migrations/MigrationDiscovery.d.ts.map +1 -1
- package/src/migrations/MigrationDiscovery.js +2 -1
- package/src/migrations/MigrationLoader.js +1 -1
- package/src/migrations/schema/SchemaCompiler.d.ts.map +1 -1
- package/src/migrations/schema/SchemaCompiler.js +6 -3
- package/src/node-singletons/crypto.d.ts +1 -1
- package/src/node-singletons/crypto.d.ts.map +1 -1
- package/src/node-singletons/crypto.js +1 -1
- package/src/node-singletons/fs.d.ts +1 -1
- package/src/node-singletons/fs.d.ts.map +1 -1
- package/src/node-singletons/path.d.ts +1 -1
- package/src/node-singletons/path.d.ts.map +1 -1
- package/src/node-singletons/path.js +1 -1
- package/src/node-singletons/stream.d.ts +11 -0
- package/src/node-singletons/stream.d.ts.map +1 -0
- package/src/node-singletons/stream.js +8 -0
- package/src/observability/OpenTelemetry.d.ts +7 -0
- package/src/observability/OpenTelemetry.d.ts.map +1 -1
- package/src/observability/OpenTelemetry.js +49 -2
- package/src/orm/Database.d.ts +4 -0
- package/src/orm/Database.d.ts.map +1 -1
- package/src/orm/Database.js +80 -9
- package/src/orm/DatabaseAdapter.d.ts +1 -0
- package/src/orm/DatabaseAdapter.d.ts.map +1 -1
- package/src/orm/DatabaseRuntimeRegistration.d.ts.map +1 -1
- package/src/orm/DatabaseRuntimeRegistration.js +2 -0
- package/src/orm/QueryBuilder.d.ts +1 -0
- package/src/orm/QueryBuilder.d.ts.map +1 -1
- package/src/orm/QueryBuilder.js +33 -3
- package/src/orm/SchemaCompiler.d.ts.map +1 -1
- package/src/orm/SchemaCompiler.js +6 -3
- package/src/orm/SchemaStatemenWriter.d.ts +15 -0
- package/src/orm/SchemaStatemenWriter.d.ts.map +1 -0
- package/src/orm/SchemaStatemenWriter.js +78 -0
- package/src/orm/adapters/D1Adapter.d.ts.map +1 -1
- package/src/orm/adapters/D1Adapter.js +52 -2
- package/src/orm/adapters/D1RemoteAdapter.d.ts.map +1 -1
- package/src/orm/adapters/D1RemoteAdapter.js +150 -89
- package/src/orm/adapters/MongoDBProxyAdapter.d.ts +3 -0
- package/src/orm/adapters/MongoDBProxyAdapter.d.ts.map +1 -0
- package/src/orm/adapters/MongoDBProxyAdapter.js +128 -0
- package/src/orm/adapters/MySQLProxyAdapter.d.ts +11 -0
- package/src/orm/adapters/MySQLProxyAdapter.d.ts.map +1 -0
- package/src/orm/adapters/MySQLProxyAdapter.js +162 -0
- package/src/orm/adapters/PostgreSQLProxyAdapter.d.ts +11 -0
- package/src/orm/adapters/PostgreSQLProxyAdapter.d.ts.map +1 -0
- package/src/orm/adapters/PostgreSQLProxyAdapter.js +163 -0
- package/src/orm/adapters/ProxyCache.d.ts +9 -0
- package/src/orm/adapters/ProxyCache.d.ts.map +1 -0
- package/src/orm/adapters/ProxyCache.js +24 -0
- package/src/orm/adapters/ProxySignedRequest.d.ts +11 -0
- package/src/orm/adapters/ProxySignedRequest.d.ts.map +1 -0
- package/src/orm/adapters/ProxySignedRequest.js +30 -0
- package/src/orm/adapters/ProxySigningPath.d.ts +3 -0
- package/src/orm/adapters/ProxySigningPath.d.ts.map +1 -0
- package/src/orm/adapters/ProxySigningPath.js +25 -0
- package/src/orm/adapters/SqlProxyAdapterUtils.d.ts +19 -0
- package/src/orm/adapters/SqlProxyAdapterUtils.d.ts.map +1 -0
- package/src/orm/adapters/SqlProxyAdapterUtils.js +36 -0
- package/src/orm/adapters/SqlProxyRegistryMode.d.ts +12 -0
- package/src/orm/adapters/SqlProxyRegistryMode.d.ts.map +1 -0
- package/src/orm/adapters/SqlProxyRegistryMode.js +24 -0
- package/src/orm/adapters/SqlServerProxyAdapter.d.ts +6 -0
- package/src/orm/adapters/SqlServerProxyAdapter.d.ts.map +1 -0
- package/src/orm/adapters/SqlServerProxyAdapter.js +154 -0
- package/src/orm/migrations/MigrationStore.js +1 -1
- package/src/performance/Optimizer.d.ts +1 -0
- package/src/performance/Optimizer.d.ts.map +1 -1
- package/src/performance/Optimizer.js +21 -8
- package/src/proxy/ErrorHandler.d.ts +11 -0
- package/src/proxy/ErrorHandler.d.ts.map +1 -0
- package/src/proxy/ErrorHandler.js +7 -0
- package/src/proxy/PoolManager.d.ts +8 -0
- package/src/proxy/PoolManager.d.ts.map +1 -0
- package/src/proxy/PoolManager.js +18 -0
- package/src/proxy/ProxyBackend.d.ts +18 -0
- package/src/proxy/ProxyBackend.d.ts.map +1 -0
- package/src/proxy/ProxyBackend.js +1 -0
- package/src/proxy/ProxyConfig.d.ts +12 -0
- package/src/proxy/ProxyConfig.d.ts.map +1 -0
- package/src/proxy/ProxyConfig.js +1 -0
- package/src/proxy/ProxyRegistry.d.ts +10 -0
- package/src/proxy/ProxyRegistry.d.ts.map +1 -0
- package/src/proxy/ProxyRegistry.js +11 -0
- package/src/proxy/ProxyRequestParsing.d.ts +9 -0
- package/src/proxy/ProxyRequestParsing.d.ts.map +1 -0
- package/src/proxy/ProxyRequestParsing.js +16 -0
- package/src/proxy/ProxyServer.d.ts +21 -0
- package/src/proxy/ProxyServer.d.ts.map +1 -0
- package/src/proxy/ProxyServer.js +84 -0
- package/src/proxy/ProxyServerUtils.d.ts +37 -0
- package/src/proxy/ProxyServerUtils.d.ts.map +1 -0
- package/src/proxy/ProxyServerUtils.js +42 -0
- package/src/proxy/ProxySigningConfigResolver.d.ts +22 -0
- package/src/proxy/ProxySigningConfigResolver.d.ts.map +1 -0
- package/src/proxy/ProxySigningConfigResolver.js +24 -0
- package/src/proxy/ProxySigningRequest.d.ts +12 -0
- package/src/proxy/ProxySigningRequest.d.ts.map +1 -0
- package/src/proxy/ProxySigningRequest.js +31 -0
- package/src/proxy/RequestValidator.d.ts +15 -0
- package/src/proxy/RequestValidator.d.ts.map +1 -0
- package/src/proxy/RequestValidator.js +26 -0
- package/src/proxy/SigningService.d.ts +39 -0
- package/src/proxy/SigningService.d.ts.map +1 -0
- package/src/proxy/SigningService.js +107 -0
- package/src/proxy/SqlPayloadValidator.d.ts +13 -0
- package/src/proxy/SqlPayloadValidator.d.ts.map +1 -0
- package/src/proxy/SqlPayloadValidator.js +14 -0
- package/src/proxy/SqlProxyDbOverrides.d.ts +17 -0
- package/src/proxy/SqlProxyDbOverrides.d.ts.map +1 -0
- package/src/proxy/SqlProxyDbOverrides.js +1 -0
- package/src/proxy/SqlProxyServerDeps.d.ts +12 -0
- package/src/proxy/SqlProxyServerDeps.d.ts.map +1 -0
- package/src/proxy/SqlProxyServerDeps.js +9 -0
- package/src/proxy/StatementPayloadValidator.d.ts +13 -0
- package/src/proxy/StatementPayloadValidator.d.ts.map +1 -0
- package/src/proxy/StatementPayloadValidator.js +18 -0
- package/src/proxy/StatementRegistryLoader.d.ts +2 -0
- package/src/proxy/StatementRegistryLoader.d.ts.map +1 -0
- package/src/proxy/StatementRegistryLoader.js +36 -0
- package/src/proxy/StatementRegistryResolver.d.ts +15 -0
- package/src/proxy/StatementRegistryResolver.d.ts.map +1 -0
- package/src/proxy/StatementRegistryResolver.js +34 -0
- package/src/proxy/d1/ZintrustD1Proxy.d.ts +3 -0
- package/src/proxy/d1/ZintrustD1Proxy.d.ts.map +1 -0
- package/src/proxy/d1/ZintrustD1Proxy.js +2 -0
- package/src/proxy/d1/register.d.ts +2 -0
- package/src/proxy/d1/register.d.ts.map +1 -0
- package/src/proxy/d1/register.js +5 -0
- package/src/proxy/isMutatingSql.d.ts +2 -0
- package/src/proxy/isMutatingSql.d.ts.map +1 -0
- package/src/proxy/isMutatingSql.js +12 -0
- package/src/proxy/kv/ZintrustKvProxy.d.ts +3 -0
- package/src/proxy/kv/ZintrustKvProxy.d.ts.map +1 -0
- package/src/proxy/kv/ZintrustKvProxy.js +2 -0
- package/src/proxy/kv/register.d.ts +2 -0
- package/src/proxy/kv/register.d.ts.map +1 -0
- package/src/proxy/kv/register.js +5 -0
- package/src/proxy/mongodb/MongoDBProxyServer.d.ts +33 -0
- package/src/proxy/mongodb/MongoDBProxyServer.d.ts.map +1 -0
- package/src/proxy/mongodb/MongoDBProxyServer.js +202 -0
- package/src/proxy/mongodb/register.d.ts +2 -0
- package/src/proxy/mongodb/register.d.ts.map +1 -0
- package/src/proxy/mongodb/register.js +5 -0
- package/src/proxy/mysql/MySqlProxyServer.d.ts +8 -0
- package/src/proxy/mysql/MySqlProxyServer.d.ts.map +1 -0
- package/src/proxy/mysql/MySqlProxyServer.js +202 -0
- package/src/proxy/mysql/register.d.ts +2 -0
- package/src/proxy/mysql/register.d.ts.map +1 -0
- package/src/proxy/mysql/register.js +5 -0
- package/src/proxy/postgres/PostgresProxyServer.d.ts +8 -0
- package/src/proxy/postgres/PostgresProxyServer.d.ts.map +1 -0
- package/src/proxy/postgres/PostgresProxyServer.js +178 -0
- package/src/proxy/postgres/register.d.ts +2 -0
- package/src/proxy/postgres/register.d.ts.map +1 -0
- package/src/proxy/postgres/register.js +5 -0
- package/src/proxy/redis/RedisProxyServer.d.ts +12 -0
- package/src/proxy/redis/RedisProxyServer.d.ts.map +1 -0
- package/src/proxy/redis/RedisProxyServer.js +192 -0
- package/src/proxy/redis/register.d.ts +2 -0
- package/src/proxy/redis/register.d.ts.map +1 -0
- package/src/proxy/redis/register.js +5 -0
- package/src/proxy/smtp/SmtpProxyServer.d.ts +19 -0
- package/src/proxy/smtp/SmtpProxyServer.d.ts.map +1 -0
- package/src/proxy/smtp/SmtpProxyServer.js +290 -0
- package/src/proxy/smtp/register.d.ts +2 -0
- package/src/proxy/smtp/register.d.ts.map +1 -0
- package/src/proxy/smtp/register.js +5 -0
- package/src/proxy/sqlserver/SqlServerProxyServer.d.ts +8 -0
- package/src/proxy/sqlserver/SqlServerProxyServer.d.ts.map +1 -0
- package/src/proxy/sqlserver/SqlServerProxyServer.js +203 -0
- package/src/proxy/sqlserver/register.d.ts +2 -0
- package/src/proxy/sqlserver/register.d.ts.map +1 -0
- package/src/proxy/sqlserver/register.js +5 -0
- package/src/proxy.d.ts +4 -0
- package/src/proxy.d.ts.map +1 -0
- package/src/proxy.js +3 -0
- package/src/routes/doc.d.ts.map +1 -1
- package/src/routes/doc.js +16 -2
- package/src/routes/error.d.ts +5 -4
- package/src/routes/error.d.ts.map +1 -1
- package/src/routes/error.js +15 -13
- package/src/routes/errorPages.d.ts +2 -0
- package/src/routes/errorPages.d.ts.map +1 -1
- package/src/routes/errorPages.js +144 -4
- package/src/runtime/PluginAutoImports.d.ts +1 -0
- package/src/runtime/PluginAutoImports.d.ts.map +1 -1
- package/src/runtime/PluginAutoImports.js +94 -9
- package/src/runtime/RuntimeAdapter.d.ts +8 -9
- package/src/runtime/RuntimeAdapter.d.ts.map +1 -1
- package/src/runtime/RuntimeAdapter.js +120 -34
- package/src/runtime/RuntimeServices.d.ts +47 -0
- package/src/runtime/RuntimeServices.d.ts.map +1 -0
- package/src/runtime/RuntimeServices.js +164 -0
- package/src/runtime/StartupConfigFileRegistry.d.ts +4 -4
- package/src/runtime/StartupConfigFileRegistry.d.ts.map +1 -1
- package/src/runtime/StartupConfigFileRegistry.js +12 -0
- package/src/runtime/WorkerAdapterImports.d.ts +5 -0
- package/src/runtime/WorkerAdapterImports.d.ts.map +1 -0
- package/src/runtime/WorkerAdapterImports.js +17 -0
- package/src/runtime/WorkersModule.d.ts +6 -0
- package/src/runtime/WorkersModule.d.ts.map +1 -0
- package/src/runtime/WorkersModule.js +278 -0
- package/src/runtime/adapters/CloudflareAdapter.d.ts.map +1 -1
- package/src/runtime/adapters/CloudflareAdapter.js +19 -2
- package/src/runtime/adapters/DenoAdapter.js +1 -0
- package/src/runtime/adapters/FargateAdapter.js +1 -1
- package/src/runtime/adapters/LambdaAdapter.js +1 -1
- package/src/runtime/adapters/NodeServerAdapter.js +1 -1
- package/src/runtime/detectRuntime.d.ts +10 -0
- package/src/runtime/detectRuntime.d.ts.map +1 -0
- package/src/runtime/detectRuntime.js +57 -0
- package/src/runtime/useFileLoader.d.ts.map +1 -1
- package/src/runtime/useFileLoader.js +16 -0
- package/src/scheduler/Schedule.d.ts +36 -0
- package/src/scheduler/Schedule.d.ts.map +1 -0
- package/src/scheduler/Schedule.js +197 -0
- package/src/scheduler/ScheduleHttpGateway.d.ts +8 -0
- package/src/scheduler/ScheduleHttpGateway.d.ts.map +1 -0
- package/src/scheduler/ScheduleHttpGateway.js +196 -0
- package/src/scheduler/ScheduleRunner.d.ts +6 -0
- package/src/scheduler/ScheduleRunner.d.ts.map +1 -1
- package/src/scheduler/ScheduleRunner.js +166 -29
- package/src/scheduler/SchedulerRuntime.d.ts +15 -0
- package/src/scheduler/SchedulerRuntime.d.ts.map +1 -0
- package/src/scheduler/SchedulerRuntime.js +79 -0
- package/src/scheduler/cron/Cron.d.ts +19 -0
- package/src/scheduler/cron/Cron.d.ts.map +1 -0
- package/src/scheduler/cron/Cron.js +200 -0
- package/src/scheduler/leader/SchedulerLeader.d.ts +14 -0
- package/src/scheduler/leader/SchedulerLeader.d.ts.map +1 -0
- package/src/scheduler/leader/SchedulerLeader.js +187 -0
- package/src/scheduler/state/ScheduleStateStore.d.ts +27 -0
- package/src/scheduler/state/ScheduleStateStore.d.ts.map +1 -0
- package/src/scheduler/state/ScheduleStateStore.js +27 -0
- package/src/scheduler/types.d.ts +10 -0
- package/src/scheduler/types.d.ts.map +1 -1
- package/src/schedules/index.d.ts +1 -0
- package/src/schedules/index.d.ts.map +1 -1
- package/src/schedules/index.js +1 -0
- package/src/schedules/job-tracking-cleanup.d.ts +4 -0
- package/src/schedules/job-tracking-cleanup.d.ts.map +1 -0
- package/src/schedules/job-tracking-cleanup.js +116 -0
- package/src/schedules/log-cleanup.d.ts +1 -2
- package/src/schedules/log-cleanup.d.ts.map +1 -1
- package/src/schedules/log-cleanup.js +12 -15
- package/src/scripts/TemplateImportsCheck.js +2 -2
- package/src/scripts/TemplateSync.js +3 -4
- package/src/security/CsrfTokenManager.d.ts.map +1 -1
- package/src/security/CsrfTokenManager.js +12 -0
- package/src/security/Hash.d.ts +1 -1
- package/src/security/Hash.d.ts.map +1 -1
- package/src/security/Hash.js +31 -36
- package/src/security/Sanitizer.d.ts.map +1 -1
- package/src/security/Sanitizer.js +1 -9
- package/src/security/SignedRequest.d.ts.map +1 -1
- package/src/security/SignedRequest.js +2 -2
- package/src/seeders/SeederLoader.js +1 -1
- package/src/session/SessionManager.d.ts +3 -0
- package/src/session/SessionManager.d.ts.map +1 -1
- package/src/session/SessionManager.js +49 -10
- package/src/sockets/CloudflareSocket.d.ts +24 -0
- package/src/sockets/CloudflareSocket.d.ts.map +1 -0
- package/src/sockets/CloudflareSocket.js +259 -0
- package/src/start.d.ts.map +1 -1
- package/src/start.js +1 -8
- package/src/templates/docker/docker-compose.ecosystem.yml.tpl +301 -0
- package/src/templates/docker/docker-compose.schedules.yml.tpl +84 -0
- package/src/templates/project/basic/app/Schedules/index.ts.tpl +0 -0
- package/src/templates/project/basic/config/database.ts.tpl +1 -1
- package/src/templates/project/basic/src/zintrust.plugins.wg.ts.tpl +8 -0
- package/src/toolkit/Secrets/Manifest.d.ts.map +1 -1
- package/src/toolkit/Secrets/Manifest.js +5 -7
- package/src/tools/mail/drivers/Smtp.d.ts.map +1 -1
- package/src/tools/mail/drivers/Smtp.js +229 -18
- package/src/tools/mail/index.d.ts.map +1 -1
- package/src/tools/mail/index.js +5 -4
- package/src/tools/mail/template-loader.d.ts.map +1 -1
- package/src/tools/mail/template-loader.js +197 -29
- package/src/tools/mail/templates/auth-password-reset.d.ts +3 -0
- package/src/tools/mail/templates/auth-password-reset.d.ts.map +1 -0
- package/src/tools/mail/templates/auth-password-reset.js +231 -0
- package/src/tools/mail/templates/auth-welcome.d.ts +3 -0
- package/src/tools/mail/templates/auth-welcome.d.ts.map +1 -0
- package/src/tools/mail/templates/auth-welcome.js +236 -0
- package/src/tools/mail/templates/general.d.ts +3 -0
- package/src/tools/mail/templates/general.d.ts.map +1 -0
- package/src/tools/mail/templates/general.js +109 -0
- package/src/tools/mail/templates/index.js +2 -2
- package/src/tools/mail/templates/job-completed.d.ts +3 -0
- package/src/tools/mail/templates/job-completed.d.ts.map +1 -0
- package/src/tools/mail/templates/job-completed.js +188 -0
- package/src/tools/mail/templates/notifications-new-comment.d.ts +3 -0
- package/src/tools/mail/templates/notifications-new-comment.d.ts.map +1 -0
- package/src/tools/mail/templates/notifications-new-comment.js +228 -0
- package/src/tools/mail/templates/password-reset.d.ts +3 -0
- package/src/tools/mail/templates/password-reset.d.ts.map +1 -0
- package/src/tools/mail/templates/password-reset.js +221 -0
- package/src/tools/mail/templates/performance-report.d.ts +3 -0
- package/src/tools/mail/templates/performance-report.d.ts.map +1 -0
- package/src/tools/mail/templates/performance-report.js +258 -0
- package/src/tools/mail/templates/welcome.d.ts +3 -0
- package/src/tools/mail/templates/welcome.d.ts.map +1 -0
- package/src/tools/mail/templates/welcome.js +187 -0
- package/src/tools/mail/templates/worker-alert.d.ts +3 -0
- package/src/tools/mail/templates/worker-alert.d.ts.map +1 -0
- package/src/tools/mail/templates/worker-alert.js +229 -0
- package/src/tools/notification/Notification.js +1 -1
- package/src/tools/notification/testingHelpers.js +6 -5
- package/src/tools/queue/AdvancedQueue.js +2 -6
- package/src/tools/queue/IdempotencyManager.d.ts +6 -0
- package/src/tools/queue/IdempotencyManager.d.ts.map +1 -0
- package/src/tools/queue/IdempotencyManager.js +36 -0
- package/src/tools/queue/JobHeartbeatStore.d.ts +16 -0
- package/src/tools/queue/JobHeartbeatStore.d.ts.map +1 -0
- package/src/tools/queue/JobHeartbeatStore.js +67 -0
- package/src/tools/queue/JobReconciliationRunner.d.ts +16 -0
- package/src/tools/queue/JobReconciliationRunner.d.ts.map +1 -0
- package/src/tools/queue/JobReconciliationRunner.js +56 -0
- package/src/tools/queue/JobRecoveryDaemon.d.ts +27 -0
- package/src/tools/queue/JobRecoveryDaemon.d.ts.map +1 -0
- package/src/tools/queue/JobRecoveryDaemon.js +303 -0
- package/src/tools/queue/JobStateTracker.d.ts +140 -0
- package/src/tools/queue/JobStateTracker.d.ts.map +1 -0
- package/src/tools/queue/JobStateTracker.js +409 -0
- package/src/tools/queue/JobStateTrackerDbPersistence.d.ts +12 -0
- package/src/tools/queue/JobStateTrackerDbPersistence.d.ts.map +1 -0
- package/src/tools/queue/JobStateTrackerDbPersistence.js +239 -0
- package/src/tools/queue/Queue.d.ts.map +1 -1
- package/src/tools/queue/Queue.js +160 -16
- package/src/tools/queue/QueueDataRedactor.d.ts +6 -0
- package/src/tools/queue/QueueDataRedactor.d.ts.map +1 -0
- package/src/tools/queue/QueueDataRedactor.js +45 -0
- package/src/tools/queue/QueueExtensions.d.ts.map +1 -1
- package/src/tools/queue/QueueExtensions.js +2 -1
- package/src/tools/queue/QueueReliabilityMetrics.d.ts +38 -0
- package/src/tools/queue/QueueReliabilityMetrics.d.ts.map +1 -0
- package/src/tools/queue/QueueReliabilityMetrics.js +131 -0
- package/src/tools/queue/QueueReliabilityOrchestrator.d.ts +7 -0
- package/src/tools/queue/QueueReliabilityOrchestrator.d.ts.map +1 -0
- package/src/tools/queue/QueueReliabilityOrchestrator.js +59 -0
- package/src/tools/queue/QueueRuntimeRegistration.d.ts +1 -9
- package/src/tools/queue/QueueRuntimeRegistration.d.ts.map +1 -1
- package/src/tools/queue/QueueRuntimeRegistration.js +75 -4
- package/src/tools/queue/QueueTracing.d.ts +32 -0
- package/src/tools/queue/QueueTracing.d.ts.map +1 -0
- package/src/tools/queue/QueueTracing.js +151 -0
- package/src/tools/queue/StalledJobMonitor.d.ts +5 -0
- package/src/tools/queue/StalledJobMonitor.d.ts.map +1 -0
- package/src/tools/queue/StalledJobMonitor.js +21 -0
- package/src/tools/queue/TimeoutManager.d.ts +14 -0
- package/src/tools/queue/TimeoutManager.d.ts.map +1 -0
- package/src/tools/queue/TimeoutManager.js +77 -0
- package/src/tools/queue/drivers/Redis.d.ts +1 -0
- package/src/tools/queue/drivers/Redis.d.ts.map +1 -1
- package/src/tools/queue/drivers/Redis.js +1 -0
- package/src/tools/queue/index.d.ts +10 -0
- package/src/tools/queue/index.d.ts.map +1 -1
- package/src/tools/queue/index.js +10 -0
- package/src/tools/storage/drivers/R2.d.ts +13 -0
- package/src/tools/storage/drivers/R2.d.ts.map +1 -1
- package/src/tools/storage/drivers/R2.js +29 -0
- package/src/zintrust.plugins.d.ts +9 -0
- package/src/zintrust.plugins.d.ts.map +1 -0
- package/src/zintrust.plugins.js +7 -0
- package/src/zintrust.plugins.wg.d.ts +9 -0
- package/src/zintrust.plugins.wg.d.ts.map +1 -0
- package/src/zintrust.plugins.wg.js +7 -0
|
@@ -0,0 +1,612 @@
|
|
|
1
|
+
import { BaseCommand } from '../BaseCommand.js';
|
|
2
|
+
import { databaseConfig } from '../../config/database.js';
|
|
3
|
+
import { Logger } from '../../config/logger.js';
|
|
4
|
+
import { queueConfig } from '../../config/queue.js';
|
|
5
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
6
|
+
import { resetDatabase, useDatabase } from '../../orm/Database.js';
|
|
7
|
+
import { registerDatabasesFromRuntimeConfig } from '../../orm/DatabaseRuntimeRegistration.js';
|
|
8
|
+
import { JobRecoveryDaemon } from '../../tools/queue/JobRecoveryDaemon.js';
|
|
9
|
+
import { JobStateTracker } from '../../tools/queue/JobStateTracker.js';
|
|
10
|
+
import { Queue } from '../../tools/queue/Queue.js';
|
|
11
|
+
import { QueueReliabilityOrchestrator } from '../../tools/queue/QueueReliabilityOrchestrator.js';
|
|
12
|
+
import { registerQueuesFromRuntimeConfig } from '../../tools/queue/QueueRuntimeRegistration.js';
|
|
13
|
+
const toSafeObject = (value) => {
|
|
14
|
+
if (value !== null && value !== undefined && typeof value === 'object') {
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
return {};
|
|
18
|
+
};
|
|
19
|
+
const parseJson = (value) => {
|
|
20
|
+
if (typeof value !== 'string')
|
|
21
|
+
return value;
|
|
22
|
+
const trimmed = value.trim();
|
|
23
|
+
if (trimmed === '')
|
|
24
|
+
return undefined;
|
|
25
|
+
try {
|
|
26
|
+
return JSON.parse(trimmed);
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const toAttempts = (value) => {
|
|
33
|
+
const parsed = Number(value);
|
|
34
|
+
if (Number.isFinite(parsed))
|
|
35
|
+
return Math.max(0, parsed);
|
|
36
|
+
return 0;
|
|
37
|
+
};
|
|
38
|
+
const toMaxAttempts = (value) => {
|
|
39
|
+
const parsed = Number(value);
|
|
40
|
+
if (Number.isFinite(parsed) && parsed > 0)
|
|
41
|
+
return Math.floor(parsed);
|
|
42
|
+
return undefined;
|
|
43
|
+
};
|
|
44
|
+
const toOptionalString = (value) => {
|
|
45
|
+
if (typeof value !== 'string')
|
|
46
|
+
return undefined;
|
|
47
|
+
return value;
|
|
48
|
+
};
|
|
49
|
+
const toCreatedAt = (value) => {
|
|
50
|
+
const parsed = toOptionalString(value);
|
|
51
|
+
return parsed ?? new Date().toISOString();
|
|
52
|
+
};
|
|
53
|
+
const toUpdatedAt = (value, createdAt) => {
|
|
54
|
+
const parsed = toOptionalString(value);
|
|
55
|
+
return parsed ?? createdAt;
|
|
56
|
+
};
|
|
57
|
+
const normalizeStatus = (value) => {
|
|
58
|
+
const normalized = (value ?? '').trim().toLowerCase();
|
|
59
|
+
const statuses = [
|
|
60
|
+
'pending',
|
|
61
|
+
'active',
|
|
62
|
+
'enqueued',
|
|
63
|
+
'completed',
|
|
64
|
+
'failed',
|
|
65
|
+
'stalled',
|
|
66
|
+
'timeout',
|
|
67
|
+
'pending_recovery',
|
|
68
|
+
'dead_letter',
|
|
69
|
+
'manual_review',
|
|
70
|
+
'delayed',
|
|
71
|
+
];
|
|
72
|
+
const matched = statuses.find((entry) => entry === normalized);
|
|
73
|
+
return matched ?? 'pending_recovery';
|
|
74
|
+
};
|
|
75
|
+
const toRecordFromPersisted = (row) => {
|
|
76
|
+
const createdAt = toCreatedAt(row.created_at);
|
|
77
|
+
const updatedAt = toUpdatedAt(row.updated_at, createdAt);
|
|
78
|
+
return {
|
|
79
|
+
queueName: row.queue_name,
|
|
80
|
+
jobId: row.job_id,
|
|
81
|
+
status: normalizeStatus(row.status),
|
|
82
|
+
attempts: toAttempts(row.attempts),
|
|
83
|
+
maxAttempts: toMaxAttempts(row.max_attempts),
|
|
84
|
+
payload: parseJson(row.payload_json),
|
|
85
|
+
result: parseJson(row.result_json),
|
|
86
|
+
lastError: toOptionalString(row.last_error),
|
|
87
|
+
lastErrorCode: toOptionalString(row.last_error_code),
|
|
88
|
+
retryAt: toOptionalString(row.retry_at),
|
|
89
|
+
timeoutAt: toOptionalString(row.timeout_at),
|
|
90
|
+
expectedCompletionAt: toOptionalString(row.expected_completion_at),
|
|
91
|
+
workerName: toOptionalString(row.worker_name),
|
|
92
|
+
workerInstanceId: toOptionalString(row.worker_instance_id),
|
|
93
|
+
workerRegion: toOptionalString(row.worker_region),
|
|
94
|
+
workerVersion: toOptionalString(row.worker_version),
|
|
95
|
+
recoveredAt: toOptionalString(row.recovered_at),
|
|
96
|
+
idempotencyKey: toOptionalString(row.idempotency_key),
|
|
97
|
+
createdAt,
|
|
98
|
+
startedAt: toOptionalString(row.started_at),
|
|
99
|
+
completedAt: toOptionalString(row.completed_at),
|
|
100
|
+
updatedAt,
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
const getRecoverableStatuses = () => {
|
|
104
|
+
return new Set(['pending_recovery']);
|
|
105
|
+
};
|
|
106
|
+
const getAllStatuses = () => {
|
|
107
|
+
return new Set([
|
|
108
|
+
'pending',
|
|
109
|
+
'active',
|
|
110
|
+
'enqueued',
|
|
111
|
+
'completed',
|
|
112
|
+
'failed',
|
|
113
|
+
'stalled',
|
|
114
|
+
'timeout',
|
|
115
|
+
'pending_recovery',
|
|
116
|
+
'dead_letter',
|
|
117
|
+
'manual_review',
|
|
118
|
+
'delayed',
|
|
119
|
+
]);
|
|
120
|
+
};
|
|
121
|
+
const parseLimit = (raw) => {
|
|
122
|
+
if (raw === undefined)
|
|
123
|
+
return 50;
|
|
124
|
+
const parsed = Number.parseInt(raw, 10);
|
|
125
|
+
if (Number.isFinite(parsed) && parsed > 0) {
|
|
126
|
+
return Math.min(5000, parsed);
|
|
127
|
+
}
|
|
128
|
+
throw ErrorFactory.createConfigError(`Invalid --limit value: ${raw}`);
|
|
129
|
+
};
|
|
130
|
+
const parseStatus = (raw) => {
|
|
131
|
+
if (raw === undefined || raw.trim().length === 0)
|
|
132
|
+
return undefined;
|
|
133
|
+
const normalized = raw.trim().toLowerCase();
|
|
134
|
+
if (getAllStatuses().has(normalized))
|
|
135
|
+
return normalized;
|
|
136
|
+
throw ErrorFactory.createConfigError(`Invalid --status value: ${raw}`);
|
|
137
|
+
};
|
|
138
|
+
const formatRows = (headers, rows) => {
|
|
139
|
+
const widths = headers.map((header, index) => {
|
|
140
|
+
const maxRow = Math.max(...rows.map((row) => (row[index] ?? '').length), 0);
|
|
141
|
+
return Math.max(header.length, maxRow);
|
|
142
|
+
});
|
|
143
|
+
const line = (values) => values.map((value, index) => value.padEnd(widths[index] ?? value.length)).join(' | ');
|
|
144
|
+
const divider = widths.map((width) => '-'.repeat(width)).join('-+-');
|
|
145
|
+
return [line(headers), divider, ...rows.map((row) => line(row))].join('\n');
|
|
146
|
+
};
|
|
147
|
+
const listFromMemory = (input) => {
|
|
148
|
+
return JobStateTracker.list({
|
|
149
|
+
queueName: input.queueName,
|
|
150
|
+
status: input.status,
|
|
151
|
+
limit: input.limit,
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
const toRecordFromUnknown = (raw) => {
|
|
155
|
+
if (raw === null || raw === undefined || typeof raw !== 'object')
|
|
156
|
+
return null;
|
|
157
|
+
const row = raw;
|
|
158
|
+
const queueName = typeof row['queueName'] === 'string' ? row['queueName'] : '';
|
|
159
|
+
const jobId = typeof row['jobId'] === 'string' ? row['jobId'] : '';
|
|
160
|
+
if (queueName.trim().length === 0 || jobId.trim().length === 0)
|
|
161
|
+
return null;
|
|
162
|
+
const attemptsRaw = row['attempts'];
|
|
163
|
+
const attempts = typeof attemptsRaw === 'number' && Number.isFinite(attemptsRaw) ? Math.max(0, attemptsRaw) : 0;
|
|
164
|
+
return {
|
|
165
|
+
queueName,
|
|
166
|
+
jobId,
|
|
167
|
+
status: normalizeStatus(typeof row['status'] === 'string' ? row['status'] : undefined),
|
|
168
|
+
attempts,
|
|
169
|
+
maxAttempts: toMaxAttempts(row['maxAttempts']),
|
|
170
|
+
payload: row['payload'],
|
|
171
|
+
result: row['result'],
|
|
172
|
+
lastError: toOptionalString(row['lastError']),
|
|
173
|
+
lastErrorCode: toOptionalString(row['lastErrorCode']),
|
|
174
|
+
retryAt: toOptionalString(row['retryAt']),
|
|
175
|
+
timeoutAt: toOptionalString(row['timeoutAt']),
|
|
176
|
+
expectedCompletionAt: toOptionalString(row['expectedCompletionAt']),
|
|
177
|
+
workerName: toOptionalString(row['workerName']),
|
|
178
|
+
workerInstanceId: toOptionalString(row['workerInstanceId']),
|
|
179
|
+
workerRegion: toOptionalString(row['workerRegion']),
|
|
180
|
+
workerVersion: toOptionalString(row['workerVersion']),
|
|
181
|
+
recoveredAt: toOptionalString(row['recoveredAt']),
|
|
182
|
+
idempotencyKey: toOptionalString(row['idempotencyKey']),
|
|
183
|
+
createdAt: toCreatedAt(row['createdAt']),
|
|
184
|
+
startedAt: toOptionalString(row['startedAt']),
|
|
185
|
+
completedAt: toOptionalString(row['completedAt']),
|
|
186
|
+
updatedAt: toUpdatedAt(row['updatedAt'], toCreatedAt(row['createdAt'])),
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
const resolveTrackerApiBaseUrl = () => {
|
|
190
|
+
const explicit = (process.env['QUEUE_TRACKER_API_URL'] ?? '').trim();
|
|
191
|
+
if (explicit.length > 0)
|
|
192
|
+
return explicit;
|
|
193
|
+
const appUrl = (process.env['APP_URL'] ?? '').trim();
|
|
194
|
+
if (appUrl.length > 0)
|
|
195
|
+
return appUrl;
|
|
196
|
+
return 'http://127.0.0.1:7777';
|
|
197
|
+
};
|
|
198
|
+
const listFromServer = async (input) => {
|
|
199
|
+
const baseUrl = resolveTrackerApiBaseUrl();
|
|
200
|
+
const url = new URL('/_debug/queue/tracker', baseUrl);
|
|
201
|
+
url.searchParams.set('limit', String(input.limit));
|
|
202
|
+
if (input.queueName !== undefined && input.queueName.trim().length > 0) {
|
|
203
|
+
url.searchParams.set('queue', input.queueName.trim());
|
|
204
|
+
}
|
|
205
|
+
if (input.status !== undefined) {
|
|
206
|
+
url.searchParams.set('status', input.status);
|
|
207
|
+
}
|
|
208
|
+
const response = await fetch(url.toString(), {
|
|
209
|
+
method: 'GET',
|
|
210
|
+
});
|
|
211
|
+
if (!response.ok) {
|
|
212
|
+
throw ErrorFactory.createConnectionError(`Tracker API returned HTTP ${response.status}`, {
|
|
213
|
+
status: response.status,
|
|
214
|
+
url: url.toString(),
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
const json = (await response.json());
|
|
218
|
+
const rawRecords = Array.isArray(json.records) ? json.records : [];
|
|
219
|
+
return rawRecords
|
|
220
|
+
.map(toRecordFromUnknown)
|
|
221
|
+
.filter((row) => row !== null);
|
|
222
|
+
};
|
|
223
|
+
const listFromPersistence = async (input) => {
|
|
224
|
+
const db = useDatabase(undefined, process.env['JOB_TRACKING_DB_CONNECTION'] ?? 'default');
|
|
225
|
+
let query = db
|
|
226
|
+
.table(process.env['JOB_TRACKING_DB_TABLE'] ?? 'zintrust_jobs')
|
|
227
|
+
.orderBy('updated_at', 'DESC')
|
|
228
|
+
.limit(input.limit);
|
|
229
|
+
if (input.queueName !== undefined && input.queueName.trim().length > 0) {
|
|
230
|
+
query = query.where('queue_name', '=', input.queueName.trim());
|
|
231
|
+
}
|
|
232
|
+
if (input.status !== undefined) {
|
|
233
|
+
query = query.where('status', '=', input.status);
|
|
234
|
+
}
|
|
235
|
+
const rows = await query.get();
|
|
236
|
+
return (rows ?? []).map(toRecordFromPersisted);
|
|
237
|
+
};
|
|
238
|
+
const printJobList = (rows, asJson) => {
|
|
239
|
+
if (asJson) {
|
|
240
|
+
Logger.info(JSON.stringify(rows, null, 2));
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
if (rows.length === 0) {
|
|
244
|
+
Logger.info('No jobs found for the provided filters');
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
const table = formatRows(['Job ID', 'Queue', 'Status', 'Attempts', 'Updated'], rows.map((row) => [row.jobId, row.queueName, row.status, String(row.attempts), row.updatedAt]));
|
|
248
|
+
Logger.info(`\n${table}`);
|
|
249
|
+
};
|
|
250
|
+
const runListJobs = async (options) => {
|
|
251
|
+
const memoryRows = listFromMemory({
|
|
252
|
+
queueName: options.queueName,
|
|
253
|
+
status: options.status,
|
|
254
|
+
limit: options.limit,
|
|
255
|
+
});
|
|
256
|
+
if (options.source === 'memory') {
|
|
257
|
+
printJobList(memoryRows, options.asJson);
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
if (options.source === 'db') {
|
|
261
|
+
const rows = await listFromPersistence({
|
|
262
|
+
queueName: options.queueName,
|
|
263
|
+
status: options.status,
|
|
264
|
+
limit: options.limit,
|
|
265
|
+
});
|
|
266
|
+
printJobList(rows, options.asJson);
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
if (options.source === 'server') {
|
|
270
|
+
const rows = await listFromServer({
|
|
271
|
+
queueName: options.queueName,
|
|
272
|
+
status: options.status,
|
|
273
|
+
limit: options.limit,
|
|
274
|
+
});
|
|
275
|
+
printJobList(rows, options.asJson);
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
if (memoryRows.length > 0) {
|
|
279
|
+
printJobList(memoryRows, options.asJson);
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
const isTestRuntime = (process.env['NODE_ENV'] ?? '').trim().toLowerCase() === 'test' ||
|
|
283
|
+
Boolean(process.env['VITEST']);
|
|
284
|
+
if (isTestRuntime) {
|
|
285
|
+
printJobList(memoryRows, options.asJson);
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
try {
|
|
289
|
+
const serverRows = await listFromServer({
|
|
290
|
+
queueName: options.queueName,
|
|
291
|
+
status: options.status,
|
|
292
|
+
limit: options.limit,
|
|
293
|
+
});
|
|
294
|
+
if (serverRows.length > 0) {
|
|
295
|
+
Logger.info('Tracker list sourced from running app process memory');
|
|
296
|
+
printJobList(serverRows, options.asJson);
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
catch (error) {
|
|
301
|
+
Logger.warn('Failed to fetch tracker list from running app', {
|
|
302
|
+
error: error instanceof Error ? error.message : String(error),
|
|
303
|
+
trackerApiUrl: resolveTrackerApiBaseUrl(),
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
printJobList(memoryRows, options.asJson);
|
|
307
|
+
};
|
|
308
|
+
const loadFromPersistence = async (jobId, queueName) => {
|
|
309
|
+
const db = useDatabase(undefined, process.env['JOB_TRACKING_DB_CONNECTION'] ?? 'default');
|
|
310
|
+
let query = db
|
|
311
|
+
.table(process.env['JOB_TRACKING_DB_TABLE'] ?? 'zintrust_jobs')
|
|
312
|
+
.where('job_id', '=', jobId);
|
|
313
|
+
if (queueName !== undefined && queueName.trim().length > 0) {
|
|
314
|
+
query = query.where('queue_name', '=', queueName.trim());
|
|
315
|
+
}
|
|
316
|
+
const row = await query.orderBy('updated_at', 'DESC').first();
|
|
317
|
+
if (row === null || row === undefined)
|
|
318
|
+
return null;
|
|
319
|
+
return toRecordFromPersisted(row);
|
|
320
|
+
};
|
|
321
|
+
const findRecord = async (jobId, queueName, allowDbLookup) => {
|
|
322
|
+
const normalizedQueue = queueName?.trim();
|
|
323
|
+
if (normalizedQueue !== undefined && normalizedQueue.length > 0) {
|
|
324
|
+
const exact = JobStateTracker.get(normalizedQueue, jobId);
|
|
325
|
+
if (exact)
|
|
326
|
+
return exact;
|
|
327
|
+
}
|
|
328
|
+
const memoryMatches = JobStateTracker.list({ limit: 50000 }).filter((row) => {
|
|
329
|
+
if (row.jobId !== jobId)
|
|
330
|
+
return false;
|
|
331
|
+
if (normalizedQueue !== undefined && normalizedQueue.length > 0) {
|
|
332
|
+
return row.queueName === normalizedQueue;
|
|
333
|
+
}
|
|
334
|
+
return true;
|
|
335
|
+
});
|
|
336
|
+
if (memoryMatches.length > 0) {
|
|
337
|
+
return memoryMatches[0] ?? null;
|
|
338
|
+
}
|
|
339
|
+
if (!allowDbLookup)
|
|
340
|
+
return null;
|
|
341
|
+
try {
|
|
342
|
+
return await loadFromPersistence(jobId, normalizedQueue);
|
|
343
|
+
}
|
|
344
|
+
catch (error) {
|
|
345
|
+
Logger.warn('Failed to load job from persistence', {
|
|
346
|
+
jobId,
|
|
347
|
+
queueName: normalizedQueue,
|
|
348
|
+
error,
|
|
349
|
+
});
|
|
350
|
+
return null;
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
const runRecoveryOnce = async () => {
|
|
354
|
+
const result = await JobRecoveryDaemon.runOnce();
|
|
355
|
+
Logger.info('Queue recovery run completed', result);
|
|
356
|
+
};
|
|
357
|
+
const isDuplicateJobIdError = (error) => {
|
|
358
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
359
|
+
const normalized = message.toLowerCase();
|
|
360
|
+
return normalized.includes('jobid') && normalized.includes('already exists');
|
|
361
|
+
};
|
|
362
|
+
const validatePushable = (record) => {
|
|
363
|
+
if (record.status === 'enqueued') {
|
|
364
|
+
Logger.info('Job is already enqueued; nothing to push', {
|
|
365
|
+
jobId: record.jobId,
|
|
366
|
+
queueName: record.queueName,
|
|
367
|
+
});
|
|
368
|
+
return { ok: false };
|
|
369
|
+
}
|
|
370
|
+
if (record.status !== 'pending_recovery') {
|
|
371
|
+
Logger.error(`Refusing to push job in status ${record.status}. Only pending_recovery can be pushed.`);
|
|
372
|
+
if (typeof process !== 'undefined')
|
|
373
|
+
process.exitCode = 1;
|
|
374
|
+
return { ok: false };
|
|
375
|
+
}
|
|
376
|
+
return { ok: true };
|
|
377
|
+
};
|
|
378
|
+
const runPushForJob = async (record, options) => {
|
|
379
|
+
if (!validatePushable(record).ok)
|
|
380
|
+
return;
|
|
381
|
+
const basePayload = toSafeObject(record.payload);
|
|
382
|
+
const hasPayload = record.payload !== undefined &&
|
|
383
|
+
record.payload !== null &&
|
|
384
|
+
typeof record.payload === 'object' &&
|
|
385
|
+
Object.keys(basePayload).length > 0;
|
|
386
|
+
if (options.dryRun) {
|
|
387
|
+
Logger.info('Dry-run: skipping enqueue for target job', {
|
|
388
|
+
jobId: record.jobId,
|
|
389
|
+
queueName: record.queueName,
|
|
390
|
+
status: record.status,
|
|
391
|
+
});
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
if (!hasPayload) {
|
|
395
|
+
Logger.error(`Cannot push job because payload is missing in tracker/persistence store: ${record.jobId}. ` +
|
|
396
|
+
'Rehydrate payload_json first (or use policy recovery states) before pushing.');
|
|
397
|
+
if (typeof process !== 'undefined')
|
|
398
|
+
process.exitCode = 1;
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
const payload = {
|
|
402
|
+
...basePayload,
|
|
403
|
+
uniqueId: record.jobId,
|
|
404
|
+
attempts: typeof record.maxAttempts === 'number' ? record.maxAttempts : 3,
|
|
405
|
+
_currentAttempts: Math.max(0, Math.floor(record.attempts ?? 0)),
|
|
406
|
+
timestamp: Date.now(),
|
|
407
|
+
};
|
|
408
|
+
let replayJobId;
|
|
409
|
+
try {
|
|
410
|
+
replayJobId = await Queue.enqueue(record.queueName, payload, 'default');
|
|
411
|
+
}
|
|
412
|
+
catch (error) {
|
|
413
|
+
if (isDuplicateJobIdError(error)) {
|
|
414
|
+
replayJobId = record.jobId;
|
|
415
|
+
}
|
|
416
|
+
else {
|
|
417
|
+
throw error;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
await JobStateTracker.handedOffToQueue({
|
|
421
|
+
queueName: record.queueName,
|
|
422
|
+
jobId: record.jobId,
|
|
423
|
+
reason: `CLI pushed job as ${replayJobId}`,
|
|
424
|
+
});
|
|
425
|
+
Logger.info('Target job pushed to queue', {
|
|
426
|
+
originalJobId: record.jobId,
|
|
427
|
+
replayJobId,
|
|
428
|
+
queueName: record.queueName,
|
|
429
|
+
});
|
|
430
|
+
};
|
|
431
|
+
const isTestRuntime = () => (process.env['NODE_ENV'] ?? '').trim().toLowerCase() === 'test' || Boolean(process.env['VITEST']);
|
|
432
|
+
const cleanupOneOffCli = async () => {
|
|
433
|
+
try {
|
|
434
|
+
QueueReliabilityOrchestrator.stop();
|
|
435
|
+
}
|
|
436
|
+
catch {
|
|
437
|
+
// ignore
|
|
438
|
+
}
|
|
439
|
+
try {
|
|
440
|
+
await resetDatabase();
|
|
441
|
+
}
|
|
442
|
+
catch {
|
|
443
|
+
// ignore
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
const runRecoverOneForJob = async (record, options) => {
|
|
447
|
+
if (options.dryRun) {
|
|
448
|
+
Logger.info('Dry-run: skipping policy recovery for target job', {
|
|
449
|
+
jobId: record.jobId,
|
|
450
|
+
queueName: record.queueName,
|
|
451
|
+
status: record.status,
|
|
452
|
+
attempts: record.attempts,
|
|
453
|
+
maxAttempts: record.maxAttempts,
|
|
454
|
+
});
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
const outcome = await JobRecoveryDaemon.recoverOne(record);
|
|
458
|
+
Logger.info('Target job recovery completed', {
|
|
459
|
+
jobId: record.jobId,
|
|
460
|
+
queueName: record.queueName,
|
|
461
|
+
outcome,
|
|
462
|
+
});
|
|
463
|
+
};
|
|
464
|
+
const resolveExecutionOptions = (options) => {
|
|
465
|
+
const jobIdRaw = typeof options.jobId === 'string' ? options.jobId.trim() : '';
|
|
466
|
+
const hasJobId = jobIdRaw.length > 0;
|
|
467
|
+
const sourceRaw = (options.source ?? 'auto').trim().toLowerCase();
|
|
468
|
+
let source = 'auto';
|
|
469
|
+
if (sourceRaw === 'db') {
|
|
470
|
+
source = 'db';
|
|
471
|
+
}
|
|
472
|
+
else if (sourceRaw === 'server') {
|
|
473
|
+
source = 'server';
|
|
474
|
+
}
|
|
475
|
+
else if (sourceRaw === 'memory') {
|
|
476
|
+
source = 'memory';
|
|
477
|
+
}
|
|
478
|
+
if (options.source !== undefined &&
|
|
479
|
+
sourceRaw !== 'memory' &&
|
|
480
|
+
sourceRaw !== 'db' &&
|
|
481
|
+
sourceRaw !== 'server' &&
|
|
482
|
+
sourceRaw !== 'auto') {
|
|
483
|
+
throw ErrorFactory.createConfigError(`Invalid --source value: ${options.source}`);
|
|
484
|
+
}
|
|
485
|
+
return {
|
|
486
|
+
list: options.list === true,
|
|
487
|
+
runOnce: options.once === true,
|
|
488
|
+
start: options.start === true,
|
|
489
|
+
hasJobId,
|
|
490
|
+
jobId: hasJobId ? jobIdRaw : undefined,
|
|
491
|
+
queueName: typeof options.queue === 'string' ? options.queue.trim() : undefined,
|
|
492
|
+
status: parseStatus(options.status),
|
|
493
|
+
limit: parseLimit(options.limit),
|
|
494
|
+
source,
|
|
495
|
+
asJson: options.json === true,
|
|
496
|
+
dryRun: options.dryRun === true,
|
|
497
|
+
push: options.push === true,
|
|
498
|
+
allowDbLookup: options.dbLookup !== false,
|
|
499
|
+
};
|
|
500
|
+
};
|
|
501
|
+
const maybeRunListMode = async (resolved) => {
|
|
502
|
+
if (!resolved.list)
|
|
503
|
+
return false;
|
|
504
|
+
await runListJobs({
|
|
505
|
+
queueName: resolved.queueName,
|
|
506
|
+
status: resolved.status,
|
|
507
|
+
limit: resolved.limit,
|
|
508
|
+
source: resolved.source,
|
|
509
|
+
asJson: resolved.asJson,
|
|
510
|
+
});
|
|
511
|
+
return true;
|
|
512
|
+
};
|
|
513
|
+
const maybeRunDefaultRecovery = async (resolved) => {
|
|
514
|
+
if (resolved.runOnce || resolved.start || resolved.hasJobId)
|
|
515
|
+
return false;
|
|
516
|
+
await runRecoveryOnce();
|
|
517
|
+
return true;
|
|
518
|
+
};
|
|
519
|
+
const runTargetedRecovery = async (resolved) => {
|
|
520
|
+
if (!resolved.hasJobId || resolved.jobId === undefined)
|
|
521
|
+
return;
|
|
522
|
+
const record = await findRecord(resolved.jobId, resolved.queueName, resolved.allowDbLookup);
|
|
523
|
+
if (record === null) {
|
|
524
|
+
Logger.error(`Job not found in tracker${resolved.allowDbLookup ? ' or persistence store' : ''}: ${resolved.jobId}`);
|
|
525
|
+
if (typeof process !== 'undefined')
|
|
526
|
+
process.exitCode = 1;
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
if (record.status === 'enqueued' && !resolved.push) {
|
|
530
|
+
Logger.info('Job already enqueued; nothing to recover', {
|
|
531
|
+
jobId: record.jobId,
|
|
532
|
+
queueName: record.queueName,
|
|
533
|
+
});
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
if (!resolved.push && !getRecoverableStatuses().has(record.status)) {
|
|
537
|
+
Logger.error(`Job status is not recoverable via policy runner: ${record.status}. Use --push to force requeue.`);
|
|
538
|
+
if (typeof process !== 'undefined')
|
|
539
|
+
process.exitCode = 1;
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
if (resolved.push) {
|
|
543
|
+
await runPushForJob(record, { dryRun: resolved.dryRun });
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
await runRecoverOneForJob(record, { dryRun: resolved.dryRun });
|
|
547
|
+
};
|
|
548
|
+
const finalizeRecoveryExecution = async (resolved) => {
|
|
549
|
+
if (resolved.runOnce) {
|
|
550
|
+
await runRecoveryOnce();
|
|
551
|
+
}
|
|
552
|
+
if (resolved.start) {
|
|
553
|
+
QueueReliabilityOrchestrator.start();
|
|
554
|
+
Logger.info('Queue reliability orchestrator is running');
|
|
555
|
+
}
|
|
556
|
+
};
|
|
557
|
+
const executeQueueRecovery = async (options) => {
|
|
558
|
+
const resolved = resolveExecutionOptions(options);
|
|
559
|
+
if (await maybeRunListMode(resolved))
|
|
560
|
+
return;
|
|
561
|
+
// Ensure DB connections exist for optional persistence lookups.
|
|
562
|
+
// (CLI commands don't run full app bootstrap.)
|
|
563
|
+
registerDatabasesFromRuntimeConfig(databaseConfig);
|
|
564
|
+
const envDefault = (process.env['QUEUE_DRIVER'] ?? '').toString().trim().toLowerCase();
|
|
565
|
+
const cliQueueConfig = {
|
|
566
|
+
...queueConfig,
|
|
567
|
+
default: (envDefault.length > 0
|
|
568
|
+
? envDefault
|
|
569
|
+
: queueConfig.default),
|
|
570
|
+
};
|
|
571
|
+
await registerQueuesFromRuntimeConfig(cliQueueConfig);
|
|
572
|
+
if (!resolved.start) {
|
|
573
|
+
// Queue registration may auto-start orchestrator when JOB_RELIABILITY_AUTOSTART=true.
|
|
574
|
+
// For one-off CLI runs, stop it to avoid noisy intervals.
|
|
575
|
+
QueueReliabilityOrchestrator.stop();
|
|
576
|
+
}
|
|
577
|
+
if (await maybeRunDefaultRecovery(resolved))
|
|
578
|
+
return;
|
|
579
|
+
await runTargetedRecovery(resolved);
|
|
580
|
+
await finalizeRecoveryExecution(resolved);
|
|
581
|
+
if (!resolved.start) {
|
|
582
|
+
await cleanupOneOffCli();
|
|
583
|
+
if (!isTestRuntime() && typeof process !== 'undefined') {
|
|
584
|
+
process.exit(process.exitCode ?? 0);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
};
|
|
588
|
+
export const QueueRecoveryCommand = Object.freeze({
|
|
589
|
+
create() {
|
|
590
|
+
return BaseCommand.create({
|
|
591
|
+
name: 'queue:recovery',
|
|
592
|
+
description: 'Run queue recovery once, start orchestrator, or recover/push a specific job',
|
|
593
|
+
addOptions: (command) => {
|
|
594
|
+
command
|
|
595
|
+
.option('--list', 'List tracked jobs')
|
|
596
|
+
.option('--once', 'Run recovery daemon one time')
|
|
597
|
+
.option('--start', 'Start queue reliability orchestrator intervals')
|
|
598
|
+
.option('--job-id <id>', 'Target specific job id')
|
|
599
|
+
.option('--queue <name>', 'Queue name for targeted job lookup')
|
|
600
|
+
.option('--status <status>', 'Filter listed jobs by status')
|
|
601
|
+
.option('--limit <count>', 'Limit listed jobs (default: 50, max: 5000)')
|
|
602
|
+
.option('--source <source>', 'List source: auto|memory|server|db (default: auto)')
|
|
603
|
+
.option('--json', 'Render list output as JSON')
|
|
604
|
+
.option('--push', 'Force direct requeue of target job payload')
|
|
605
|
+
.option('--dry-run', 'Log actions without enqueueing/recovering')
|
|
606
|
+
.option('--no-db-lookup', 'Disable fallback DB lookup for target job');
|
|
607
|
+
},
|
|
608
|
+
execute: executeQueueRecovery,
|
|
609
|
+
});
|
|
610
|
+
},
|
|
611
|
+
});
|
|
612
|
+
export default QueueRecoveryCommand;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RedisProxyCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/RedisProxyCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAmDrE,eAAO,MAAM,iBAAiB;cAClB,YAAY;EAoCtB,CAAC;AAEH,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { BaseCommand } from '../BaseCommand.js';
|
|
2
|
+
import { maybeRunProxyWatchMode, parseIntOption, trimOption, } from '../commands/ProxyCommandUtils.js';
|
|
3
|
+
import { Env } from '../../config/env.js';
|
|
4
|
+
import { RedisProxyServer } from '../../proxy/redis/RedisProxyServer.js';
|
|
5
|
+
const addOptions = (command) => {
|
|
6
|
+
command.option('--host <host>', 'Host to bind', Env.get('REDIS_PROXY_HOST', '127.0.0.1'));
|
|
7
|
+
command.option('--port <port>', 'Port to bind', String(Env.getInt('REDIS_PROXY_PORT', 8791)));
|
|
8
|
+
command.option('--max-body-bytes <bytes>', 'Max request size in bytes', String(Env.getInt('REDIS_PROXY_MAX_BODY_BYTES', 131072)));
|
|
9
|
+
command.option('--watch', 'Auto-restart proxy on file changes');
|
|
10
|
+
command.option('--redis-host <host>', 'Redis host');
|
|
11
|
+
command.option('--redis-port <port>', 'Redis port');
|
|
12
|
+
command.option('--redis-password <password>', 'Redis password');
|
|
13
|
+
command.option('--redis-db <db>', 'Redis database');
|
|
14
|
+
command.option('--require-signing', 'Require signed requests', Env.REDIS_PROXY_REQUIRE_SIGNING);
|
|
15
|
+
command.option('--key-id <id>', 'Signing key id', Env.get('REDIS_PROXY_KEY_ID', ''));
|
|
16
|
+
command.option('--secret <secret>', 'Signing secret', Env.get('REDIS_PROXY_SECRET', ''));
|
|
17
|
+
command.option('--signing-window-ms <ms>', 'Signing time window in ms', String(Env.getInt('REDIS_PROXY_SIGNING_WINDOW_MS', 60000)));
|
|
18
|
+
};
|
|
19
|
+
export const RedisProxyCommand = Object.freeze({
|
|
20
|
+
create() {
|
|
21
|
+
return BaseCommand.create({
|
|
22
|
+
name: 'proxy:redis',
|
|
23
|
+
aliases: ['redis:proxy', 'redis-proxy', 'proxy:red'],
|
|
24
|
+
description: 'Start the Redis HTTP proxy for Cloudflare Workers',
|
|
25
|
+
addOptions,
|
|
26
|
+
execute: async (options) => {
|
|
27
|
+
await maybeRunProxyWatchMode(options.watch);
|
|
28
|
+
const host = trimOption(options.host);
|
|
29
|
+
const port = parseIntOption(options.port, 'port');
|
|
30
|
+
const maxBodyBytes = parseIntOption(options.maxBodyBytes, 'max-body-bytes');
|
|
31
|
+
const redisHost = trimOption(options.redisHost);
|
|
32
|
+
const redisPort = parseIntOption(options.redisPort, 'redis-port', 'non-negative');
|
|
33
|
+
const redisPassword = options.redisPassword;
|
|
34
|
+
const redisDb = parseIntOption(options.redisDb, 'redis-db', 'non-negative');
|
|
35
|
+
const signingWindowMs = parseIntOption(options.signingWindowMs, 'signing-window-ms');
|
|
36
|
+
await RedisProxyServer.start({
|
|
37
|
+
host,
|
|
38
|
+
port,
|
|
39
|
+
maxBodyBytes,
|
|
40
|
+
redisHost,
|
|
41
|
+
redisPort,
|
|
42
|
+
redisPassword,
|
|
43
|
+
redisDb,
|
|
44
|
+
requireSigning: options.requireSigning === true,
|
|
45
|
+
keyId: options.keyId,
|
|
46
|
+
secret: options.secret,
|
|
47
|
+
signingWindowMs,
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
export default RedisProxyCommand;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScheduleListCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/ScheduleListCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAsErE,eAAO,MAAM,mBAAmB;cACpB,YAAY;EAUtB,CAAC;AAEH,eAAe,mBAAmB,CAAC"}
|