@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
|
@@ -8,6 +8,7 @@ import { WranglerConfig } from '../d1/WranglerConfig.js';
|
|
|
8
8
|
import { WranglerD1 } from '../d1/WranglerD1.js';
|
|
9
9
|
import { PromptHelper } from '../PromptHelper.js';
|
|
10
10
|
import { confirmProductionRun, mapConnectionToOrmConfig, parseRollbackSteps, } from '../utils/DatabaseCliUtils.js';
|
|
11
|
+
import { EnvFileLoader } from '../utils/EnvFileLoader.js';
|
|
11
12
|
import { readEnvString } from '../../common/ExternalServiceUtils.js';
|
|
12
13
|
import { databaseConfig } from '../../config/database.js';
|
|
13
14
|
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
@@ -52,7 +53,7 @@ const getServiceArgs = (options) => {
|
|
|
52
53
|
return { service: serviceArg, includeGlobal };
|
|
53
54
|
};
|
|
54
55
|
const isDestructiveAction = (options) => options['fresh'] === true || options['reset'] === true || options['rollback'] === true;
|
|
55
|
-
const
|
|
56
|
+
const isWranglerD1Driver = (driver) => driver === 'd1';
|
|
56
57
|
const describeTargetDatabase = (conn) => {
|
|
57
58
|
switch (conn.driver) {
|
|
58
59
|
case 'sqlite':
|
|
@@ -189,33 +190,47 @@ const runD1Actions = async (params) => {
|
|
|
189
190
|
cmd.info(output);
|
|
190
191
|
cmd.success('D1 migrations completed successfully');
|
|
191
192
|
};
|
|
192
|
-
const
|
|
193
|
-
|
|
194
|
-
if (isD1Driver(conn.driver)) {
|
|
193
|
+
const logOptionsForConn = (cmd, conn, options) => {
|
|
194
|
+
if (isWranglerD1Driver(conn.driver)) {
|
|
195
195
|
cmd.debug(`Migrate command executed with options: ${JSON.stringify(options)}`);
|
|
196
|
+
return;
|
|
196
197
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
198
|
+
const optionsForLog = { ...options };
|
|
199
|
+
delete optionsForLog['database'];
|
|
200
|
+
delete optionsForLog['local'];
|
|
201
|
+
delete optionsForLog['remote'];
|
|
202
|
+
cmd.debug(`Migrate command executed with options: ${JSON.stringify(optionsForLog)}`);
|
|
203
|
+
};
|
|
204
|
+
const warnIfAdapterMissing = (cmd, conn) => {
|
|
205
|
+
if (conn.driver === 'mysql' && DatabaseAdapterRegistry.get('mysql') === undefined) {
|
|
206
|
+
cmd.warn('MySQL adapter is not installed/registered; migrations may not hit a real MySQL DB.');
|
|
207
|
+
cmd.warn('Install via `zin plugin install adapter:mysql` (or `zin add db:mysql`).');
|
|
208
|
+
cmd.debug('[debug] Expected a side-effect import in src/zintrust.plugins.ts like: import "@zintrust/db-mysql/register";');
|
|
203
209
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
await runD1Actions({
|
|
208
|
-
options,
|
|
209
|
-
cmd,
|
|
210
|
-
projectRoot: process.cwd(),
|
|
211
|
-
globalDir,
|
|
212
|
-
extension,
|
|
213
|
-
separateTracking,
|
|
214
|
-
service,
|
|
215
|
-
includeGlobal,
|
|
216
|
-
});
|
|
217
|
-
return;
|
|
210
|
+
if (conn.driver === 'postgresql' && DatabaseAdapterRegistry.get('postgresql') === undefined) {
|
|
211
|
+
cmd.warn('PostgreSQL adapter is not installed/registered; migrations may not hit a real PostgreSQL DB.');
|
|
212
|
+
cmd.warn('Install via `zin plugin install adapter:postgres` (or `zin add db:postgres`).');
|
|
218
213
|
}
|
|
214
|
+
};
|
|
215
|
+
const withD1RemoteSqlMode = async (fn) => {
|
|
216
|
+
if (typeof process === 'undefined' || process.env === undefined)
|
|
217
|
+
return fn();
|
|
218
|
+
const prev = process.env['D1_REMOTE_MODE'];
|
|
219
|
+
process.env['D1_REMOTE_MODE'] = 'sql';
|
|
220
|
+
try {
|
|
221
|
+
return await fn();
|
|
222
|
+
}
|
|
223
|
+
finally {
|
|
224
|
+
if (prev === undefined) {
|
|
225
|
+
delete process.env['D1_REMOTE_MODE'];
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
process.env['D1_REMOTE_MODE'] = prev;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
const runOrmMigrationsForConn = async (params) => {
|
|
233
|
+
const { conn, options, cmd, interactive, globalDir, extension, separateTracking, service, includeGlobal, } = params;
|
|
219
234
|
const ormConfig = mapConnectionToOrmConfig(conn);
|
|
220
235
|
const destructive = isDestructiveAction(options);
|
|
221
236
|
const force = options['force'] === true;
|
|
@@ -231,18 +246,7 @@ const processConnection = async (conn, options, cmd, interactive) => {
|
|
|
231
246
|
cmd.info(`[i] Target database: ${describeTargetDatabase(conn)}`);
|
|
232
247
|
cmd.info('[i] Migration tracking table: migrations');
|
|
233
248
|
cmd.debug(`[debug] Registered database adapters: ${DatabaseAdapterRegistry.list().join(', ')}`);
|
|
234
|
-
|
|
235
|
-
// Adapters are registered via side-effect imports in src/zintrust.plugins.ts
|
|
236
|
-
// (generated by `zin plugin install`) and are loaded at CLI startup.
|
|
237
|
-
if (conn.driver === 'mysql' && DatabaseAdapterRegistry.get('mysql') === undefined) {
|
|
238
|
-
cmd.warn('MySQL adapter is not installed/registered; migrations may not hit a real MySQL DB.');
|
|
239
|
-
cmd.warn('Install via `zin plugin install adapter:mysql` (or `zin add db:mysql`).');
|
|
240
|
-
cmd.debug('[debug] Expected a side-effect import in src/zintrust.plugins.ts like: import "@zintrust/db-mysql/register";');
|
|
241
|
-
}
|
|
242
|
-
if (conn.driver === 'postgresql' && DatabaseAdapterRegistry.get('postgresql') === undefined) {
|
|
243
|
-
cmd.warn('PostgreSQL adapter is not installed/registered; migrations may not hit a real PostgreSQL DB.');
|
|
244
|
-
cmd.warn('Install via `zin plugin install adapter:postgres` (or `zin add db:postgres`).');
|
|
245
|
-
}
|
|
249
|
+
warnIfAdapterMissing(cmd, conn);
|
|
246
250
|
const db = Database.create(ormConfig);
|
|
247
251
|
await db.connect();
|
|
248
252
|
try {
|
|
@@ -261,7 +265,45 @@ const processConnection = async (conn, options, cmd, interactive) => {
|
|
|
261
265
|
await db.disconnect();
|
|
262
266
|
}
|
|
263
267
|
};
|
|
268
|
+
const processConnection = async (conn, options, cmd, interactive) => {
|
|
269
|
+
// Avoid confusion: `--database` is a D1-only option (Wrangler binding name), not DB_DATABASE.
|
|
270
|
+
logOptionsForConn(cmd, conn, options);
|
|
271
|
+
const { globalDir, extension, separateTracking } = getMigrationDirs();
|
|
272
|
+
const { service, includeGlobal } = getServiceArgs(options);
|
|
273
|
+
if (isWranglerD1Driver(conn.driver)) {
|
|
274
|
+
await runD1Actions({
|
|
275
|
+
options,
|
|
276
|
+
cmd,
|
|
277
|
+
projectRoot: process.cwd(),
|
|
278
|
+
globalDir,
|
|
279
|
+
extension,
|
|
280
|
+
separateTracking,
|
|
281
|
+
service,
|
|
282
|
+
includeGlobal,
|
|
283
|
+
});
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
const run = async () => runOrmMigrationsForConn({
|
|
287
|
+
conn,
|
|
288
|
+
options,
|
|
289
|
+
cmd,
|
|
290
|
+
interactive,
|
|
291
|
+
globalDir,
|
|
292
|
+
extension,
|
|
293
|
+
separateTracking,
|
|
294
|
+
service,
|
|
295
|
+
includeGlobal,
|
|
296
|
+
});
|
|
297
|
+
if (conn.driver === 'd1-remote') {
|
|
298
|
+
cmd.info('[i] d1-remote migrations: using SQL mode automatically for this CLI run');
|
|
299
|
+
await withD1RemoteSqlMode(run);
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
await run();
|
|
303
|
+
};
|
|
264
304
|
const executeMigrate = async (options, cmd) => {
|
|
305
|
+
// Ensure .env overlays are loaded for CLI runs (needed for d1-remote signing fallbacks).
|
|
306
|
+
EnvFileLoader.ensureLoaded();
|
|
265
307
|
const interactive = getInteractive(options);
|
|
266
308
|
const targets = [];
|
|
267
309
|
if (options['all'] === true) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrateWorkerCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/MigrateWorkerCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"MigrateWorkerCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/MigrateWorkerCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAiNrE,eAAO,MAAM,oBAAoB;cACrB,YAAY;EAUtB,CAAC"}
|
|
@@ -9,6 +9,19 @@ import { Migrator } from '../../migrations/Migrator.js';
|
|
|
9
9
|
import * as path from '../../node-singletons/path.js';
|
|
10
10
|
import { Database } from '../../orm/Database.js';
|
|
11
11
|
import { DatabaseAdapterRegistry } from '../../orm/DatabaseAdapterRegistry.js';
|
|
12
|
+
const isBuiltInDriver = (driver) => driver === 'sqlite' ||
|
|
13
|
+
driver === 'mysql' ||
|
|
14
|
+
driver === 'postgresql' ||
|
|
15
|
+
driver === 'sqlserver' ||
|
|
16
|
+
driver === 'd1' ||
|
|
17
|
+
driver === 'd1-remote';
|
|
18
|
+
const getWorkerPersistenceConnectionName = () => {
|
|
19
|
+
if (typeof process === 'undefined')
|
|
20
|
+
return 'default';
|
|
21
|
+
const raw = process.env?.['WORKER_PERSISTENCE_DB_CONNECTION'];
|
|
22
|
+
const value = typeof raw === 'string' ? raw.trim() : '';
|
|
23
|
+
return value.length > 0 ? value : 'default';
|
|
24
|
+
};
|
|
12
25
|
const addOptions = (command) => {
|
|
13
26
|
command
|
|
14
27
|
.option('--status', 'Display migration status (applied, pending, failed)')
|
|
@@ -80,10 +93,16 @@ const runForConnection = async (conn, options, cmd, interactive) => {
|
|
|
80
93
|
});
|
|
81
94
|
if (!proceed)
|
|
82
95
|
return;
|
|
83
|
-
if (!DatabaseAdapterRegistry.has(conn.driver)) {
|
|
96
|
+
if (!isBuiltInDriver(conn.driver) && !DatabaseAdapterRegistry.has(conn.driver)) {
|
|
84
97
|
cmd.warn(`Missing adapter for driver: ${conn.driver}`);
|
|
85
98
|
cmd.warn(`Install via 'zin plugin install adapter:${conn.driver}' (or 'zin add db:${conn.driver}').`);
|
|
86
99
|
}
|
|
100
|
+
const previousD1RemoteMode = typeof process === 'undefined' ? undefined : process.env['D1_REMOTE_MODE'];
|
|
101
|
+
if (conn.driver === 'd1-remote' && typeof process !== 'undefined') {
|
|
102
|
+
// Important: set BEFORE Database.create() so D1RemoteAdapter is constructed in SQL mode.
|
|
103
|
+
// Registry mode uses /zin/d1/statement, which is not appropriate for migrations.
|
|
104
|
+
process.env['D1_REMOTE_MODE'] = 'sql';
|
|
105
|
+
}
|
|
87
106
|
const ormConfig = mapConnectionToOrmConfig(conn);
|
|
88
107
|
const db = Database.create(ormConfig);
|
|
89
108
|
await db.connect();
|
|
@@ -98,6 +117,14 @@ const runForConnection = async (conn, options, cmd, interactive) => {
|
|
|
98
117
|
await runActions(migrator, options, cmd, conn.driver);
|
|
99
118
|
}
|
|
100
119
|
finally {
|
|
120
|
+
if (conn.driver === 'd1-remote' && typeof process !== 'undefined') {
|
|
121
|
+
if (previousD1RemoteMode === undefined) {
|
|
122
|
+
delete process.env['D1_REMOTE_MODE'];
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
process.env['D1_REMOTE_MODE'] = previousD1RemoteMode;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
101
128
|
await db.disconnect();
|
|
102
129
|
}
|
|
103
130
|
};
|
|
@@ -110,7 +137,14 @@ const executeMigrateWorker = async (options, cmd) => {
|
|
|
110
137
|
}
|
|
111
138
|
}
|
|
112
139
|
else {
|
|
113
|
-
|
|
140
|
+
const selected = getWorkerPersistenceConnectionName();
|
|
141
|
+
const hasSelected = selected.length > 0;
|
|
142
|
+
const connections = databaseConfig.connections;
|
|
143
|
+
const configured = hasSelected ? connections[selected] : undefined;
|
|
144
|
+
targets.push({
|
|
145
|
+
name: hasSelected ? selected : 'default',
|
|
146
|
+
config: configured ?? databaseConfig.getConnection(),
|
|
147
|
+
});
|
|
114
148
|
}
|
|
115
149
|
let sequence = Promise.resolve();
|
|
116
150
|
for (const { name, config } of targets) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MongoDBProxyCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/MongoDBProxyCommand.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA4DpC,eAAO,MAAM,mBAAmB;cACpB,OAAO;EAoEjB,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Env } from '../../config/env.js';
|
|
2
|
+
import { Logger } from '../../config/logger.js';
|
|
3
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
4
|
+
import { Command } from 'commander';
|
|
5
|
+
const startWatchMode = async (options) => {
|
|
6
|
+
Logger.info('Starting MongoDB proxy in watch mode...');
|
|
7
|
+
const { watch } = await import('node:fs');
|
|
8
|
+
const { spawn } = await import('node:child_process');
|
|
9
|
+
let child = null;
|
|
10
|
+
const optionFlagMap = {
|
|
11
|
+
host: '--host',
|
|
12
|
+
port: '--port',
|
|
13
|
+
mongoUri: '--mongo-uri',
|
|
14
|
+
mongoDb: '--mongo-db',
|
|
15
|
+
keyId: '--key-id',
|
|
16
|
+
secret: '--secret',
|
|
17
|
+
requireSigning: '--require-signing',
|
|
18
|
+
signingWindowMs: '--signing-window-ms',
|
|
19
|
+
};
|
|
20
|
+
const startProxy = () => {
|
|
21
|
+
if (child) {
|
|
22
|
+
child.kill();
|
|
23
|
+
}
|
|
24
|
+
const args = ['run', 'cli', 'proxy:mongodb'];
|
|
25
|
+
Object.entries(options).forEach(([key, value]) => {
|
|
26
|
+
if (key !== 'watch') {
|
|
27
|
+
const flag = optionFlagMap[key] ?? `--${key}`;
|
|
28
|
+
if (typeof value === 'boolean') {
|
|
29
|
+
if (value) {
|
|
30
|
+
args.push(flag);
|
|
31
|
+
}
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (value !== undefined && value !== null) {
|
|
35
|
+
args.push(flag, String(value));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
child = spawn('npm', args, { stdio: 'inherit' });
|
|
40
|
+
};
|
|
41
|
+
const watcher = watch('./src', { recursive: true }, (_eventType, filename) => {
|
|
42
|
+
if (filename !== null && (filename.endsWith('.ts') || filename.endsWith('.js'))) {
|
|
43
|
+
Logger.info(`File changed: ${String(filename)}, restarting proxy...`);
|
|
44
|
+
startProxy();
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
startProxy();
|
|
48
|
+
process.on('SIGINT', () => {
|
|
49
|
+
watcher.close();
|
|
50
|
+
if (child)
|
|
51
|
+
child.kill();
|
|
52
|
+
process.exit(0);
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
export const MongoDBProxyCommand = Object.freeze({
|
|
56
|
+
create() {
|
|
57
|
+
const cmd = new Command('proxy:mongodb');
|
|
58
|
+
cmd.description('Start MongoDB HTTP proxy server');
|
|
59
|
+
const configureOptions = () => {
|
|
60
|
+
cmd.option('--host <host>', 'Proxy host', Env.get('MONGODB_PROXY_HOST', '127.0.0.1'));
|
|
61
|
+
cmd.option('--port <port>', 'Proxy port', String(Env.getInt('MONGODB_PROXY_PORT', 8792)));
|
|
62
|
+
cmd.option('--mongo-uri <uri>', 'MongoDB connection URI', Env.get('MONGO_URI', ''));
|
|
63
|
+
cmd.option('--mongo-db <database>', 'MongoDB database name', Env.get('MONGO_DB', ''));
|
|
64
|
+
cmd.option('--key-id <keyId>', 'Signing key ID', Env.get('MONGODB_PROXY_KEY_ID', 'default'));
|
|
65
|
+
cmd.option('--secret <secret>', 'Signing secret', Env.get('MONGODB_PROXY_SECRET', ''));
|
|
66
|
+
cmd.option('--require-signing', 'Require request signing', Env.MONGODB_PROXY_REQUIRE_SIGNING);
|
|
67
|
+
cmd.option('--signing-window-ms <ms>', 'Signing window in milliseconds', String(Env.getInt('MONGODB_PROXY_SIGNING_WINDOW_MS', 60000)));
|
|
68
|
+
cmd.option('--watch', 'Watch mode: restart on file changes');
|
|
69
|
+
};
|
|
70
|
+
const buildServerConfig = (options) => ({
|
|
71
|
+
host: String(options['host']),
|
|
72
|
+
port: Number(options['port']),
|
|
73
|
+
mongoUri: String(options['mongoUri']),
|
|
74
|
+
mongoDb: String(options['mongoDb']),
|
|
75
|
+
keyId: String(options['keyId']),
|
|
76
|
+
secret: String(options['secret']),
|
|
77
|
+
requireSigning: Boolean(options['requireSigning']),
|
|
78
|
+
signingWindowMs: Number(options['signingWindowMs']),
|
|
79
|
+
});
|
|
80
|
+
const startNormalMode = async (options) => {
|
|
81
|
+
const { MongoDBProxyServer } = await import('../../proxy/mongodb/MongoDBProxyServer.js');
|
|
82
|
+
if (options['mongoUri'] === undefined || options['mongoDb'] === undefined) {
|
|
83
|
+
throw ErrorFactory.createValidationError('MongoDB URI and database name are required. Set MONGO_URI and MONGO_DB or pass --mongo-uri and --mongo-db');
|
|
84
|
+
}
|
|
85
|
+
await MongoDBProxyServer.start(buildServerConfig(options));
|
|
86
|
+
};
|
|
87
|
+
const execute = async (options) => {
|
|
88
|
+
if (options['watch'] === true) {
|
|
89
|
+
await startWatchMode(options);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
await startNormalMode(options);
|
|
93
|
+
};
|
|
94
|
+
configureOptions();
|
|
95
|
+
cmd.action(execute);
|
|
96
|
+
return cmd;
|
|
97
|
+
},
|
|
98
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MySqlProxyCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/MySqlProxyCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,kBAAkB,CAAC;AA0BrE,eAAO,MAAM,iBAAiB;cAClB,YAAY;EAatB,CAAC;AAEH,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { BaseCommand } from '../BaseCommand.js';
|
|
2
|
+
import { addSqlProxyOptions, runSqlProxyCommand, } from '../commands/SqlProxyCommandUtils.js';
|
|
3
|
+
import { Env } from '../../config/env.js';
|
|
4
|
+
import { MySqlProxyServer } from '../../proxy/mysql/MySqlProxyServer.js';
|
|
5
|
+
const addOptions = (command) => {
|
|
6
|
+
addSqlProxyOptions(command, {
|
|
7
|
+
hostDefault: Env.MYSQL_PROXY_HOST,
|
|
8
|
+
portDefault: Env.MYSQL_PROXY_PORT,
|
|
9
|
+
maxBodyBytesDefault: Env.MYSQL_PROXY_MAX_BODY_BYTES,
|
|
10
|
+
dbVendorLabel: 'MySQL',
|
|
11
|
+
requireSigningDefault: Env.MYSQL_PROXY_REQUIRE_SIGNING,
|
|
12
|
+
keyIdDefault: Env.MYSQL_PROXY_KEY_ID,
|
|
13
|
+
secretDefault: Env.MYSQL_PROXY_SECRET,
|
|
14
|
+
signingWindowMsDefault: Env.MYSQL_PROXY_SIGNING_WINDOW_MS,
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
export const MySqlProxyCommand = Object.freeze({
|
|
18
|
+
create() {
|
|
19
|
+
return BaseCommand.create({
|
|
20
|
+
name: 'proxy:mysql',
|
|
21
|
+
aliases: ['mysql:proxy', 'mysql-proxy', 'proxy:my'],
|
|
22
|
+
description: 'Start the MySQL HTTP proxy for Cloudflare Workers',
|
|
23
|
+
addOptions,
|
|
24
|
+
execute: async (options) => {
|
|
25
|
+
await runSqlProxyCommand(options, async (input) => {
|
|
26
|
+
await MySqlProxyServer.start(input);
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
export default MySqlProxyCommand;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PostgresProxyCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/PostgresProxyCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,kBAAkB,CAAC;AA0BrE,eAAO,MAAM,oBAAoB;cACrB,YAAY;EAatB,CAAC;AAEH,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { BaseCommand } from '../BaseCommand.js';
|
|
2
|
+
import { addSqlProxyOptions, runSqlProxyCommand, } from '../commands/SqlProxyCommandUtils.js';
|
|
3
|
+
import { Env } from '../../config/env.js';
|
|
4
|
+
import { PostgresProxyServer } from '../../proxy/postgres/PostgresProxyServer.js';
|
|
5
|
+
const addOptions = (command) => {
|
|
6
|
+
addSqlProxyOptions(command, {
|
|
7
|
+
hostDefault: Env.POSTGRES_PROXY_HOST,
|
|
8
|
+
portDefault: Env.POSTGRES_PROXY_PORT,
|
|
9
|
+
maxBodyBytesDefault: Env.POSTGRES_PROXY_MAX_BODY_BYTES,
|
|
10
|
+
dbVendorLabel: 'PostgreSQL',
|
|
11
|
+
requireSigningDefault: Env.POSTGRES_PROXY_REQUIRE_SIGNING,
|
|
12
|
+
keyIdDefault: Env.POSTGRES_PROXY_KEY_ID,
|
|
13
|
+
secretDefault: Env.POSTGRES_PROXY_SECRET,
|
|
14
|
+
signingWindowMsDefault: Env.POSTGRES_PROXY_SIGNING_WINDOW_MS,
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
export const PostgresProxyCommand = Object.freeze({
|
|
18
|
+
create() {
|
|
19
|
+
return BaseCommand.create({
|
|
20
|
+
name: 'proxy:postgres',
|
|
21
|
+
aliases: ['postgres:proxy', 'postgres-proxy', 'proxy:pg', 'pg:proxy', 'pg-proxy'],
|
|
22
|
+
description: 'Start the PostgreSQL HTTP proxy for Cloudflare Workers',
|
|
23
|
+
addOptions,
|
|
24
|
+
execute: async (options) => {
|
|
25
|
+
await runSqlProxyCommand(options, async (input) => {
|
|
26
|
+
await PostgresProxyServer.start(input);
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
export default PostgresProxyCommand;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IBaseCommand } from '../BaseCommand';
|
|
2
|
+
import '../../proxy/d1/register';
|
|
3
|
+
import '../../proxy/kv/register';
|
|
4
|
+
import '../../proxy/mysql/register';
|
|
5
|
+
import '../../proxy/postgres/register';
|
|
6
|
+
import '../../proxy/redis/register';
|
|
7
|
+
import '../../proxy/smtp/register';
|
|
8
|
+
export declare const ProxyCommand: Readonly<{
|
|
9
|
+
create(): IBaseCommand;
|
|
10
|
+
}>;
|
|
11
|
+
export default ProxyCommand;
|
|
12
|
+
//# sourceMappingURL=ProxyCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProxyCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/ProxyCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAMrE,OAAO,oBAAoB,CAAC;AAC5B,OAAO,oBAAoB,CAAC;AAC5B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,0BAA0B,CAAC;AAClC,OAAO,uBAAuB,CAAC;AAC/B,OAAO,sBAAsB,CAAC;AAyD9B,eAAO,MAAM,YAAY;cACb,YAAY;EAyBtB,CAAC;AAEH,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { BaseCommand } from '../BaseCommand.js';
|
|
2
|
+
import { SpawnUtil } from '../utils/spawn.js';
|
|
3
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
4
|
+
import * as path from '../../node-singletons/path.js';
|
|
5
|
+
import { ProxyRegistry } from '../../proxy/ProxyRegistry.js';
|
|
6
|
+
import '../../proxy/d1/register.js';
|
|
7
|
+
import '../../proxy/kv/register.js';
|
|
8
|
+
import '../../proxy/mysql/register.js';
|
|
9
|
+
import '../../proxy/postgres/register.js';
|
|
10
|
+
import '../../proxy/redis/register.js';
|
|
11
|
+
import '../../proxy/smtp/register.js';
|
|
12
|
+
const PROXY_TARGET_MAP = Object.freeze({
|
|
13
|
+
mysql: 'proxy:mysql',
|
|
14
|
+
my: 'proxy:mysql',
|
|
15
|
+
postgres: 'proxy:postgres',
|
|
16
|
+
postgresql: 'proxy:postgres',
|
|
17
|
+
pg: 'proxy:postgres',
|
|
18
|
+
redis: 'proxy:redis',
|
|
19
|
+
smtp: 'proxy:smtp',
|
|
20
|
+
mail: 'proxy:smtp',
|
|
21
|
+
mongodb: 'proxy:mongodb',
|
|
22
|
+
mongo: 'proxy:mongodb',
|
|
23
|
+
sqlserver: 'proxy:sqlserver',
|
|
24
|
+
mssql: 'proxy:sqlserver',
|
|
25
|
+
});
|
|
26
|
+
const addOptions = (command) => {
|
|
27
|
+
command.argument('[target]', 'Proxy target (e.g. postgres, mysql, redis, smtp)');
|
|
28
|
+
};
|
|
29
|
+
const parseForwardArgs = () => {
|
|
30
|
+
const argv = process.argv.slice(2);
|
|
31
|
+
const proxyIndex = argv.indexOf('proxy');
|
|
32
|
+
if (proxyIndex < 0) {
|
|
33
|
+
return { target: null, extra: [] };
|
|
34
|
+
}
|
|
35
|
+
const target = argv[proxyIndex + 1] ?? null;
|
|
36
|
+
const extra = argv.slice(proxyIndex + 2);
|
|
37
|
+
return { target, extra };
|
|
38
|
+
};
|
|
39
|
+
const dispatchProxyTarget = async (targetRaw) => {
|
|
40
|
+
const target = targetRaw.trim().toLowerCase();
|
|
41
|
+
const mapped = PROXY_TARGET_MAP[target];
|
|
42
|
+
if (!mapped) {
|
|
43
|
+
throw ErrorFactory.createCliError(`Unknown proxy target '${targetRaw}'. Use one of: ${Object.keys(PROXY_TARGET_MAP).join(', ')}`);
|
|
44
|
+
}
|
|
45
|
+
const { extra } = parseForwardArgs();
|
|
46
|
+
const exitCode = await SpawnUtil.spawnAndWait({
|
|
47
|
+
command: 'tsx',
|
|
48
|
+
args: [path.join('bin', 'zin.ts'), mapped, ...extra],
|
|
49
|
+
env: {
|
|
50
|
+
...process.env,
|
|
51
|
+
},
|
|
52
|
+
forwardSignals: false,
|
|
53
|
+
});
|
|
54
|
+
process.exit(exitCode);
|
|
55
|
+
};
|
|
56
|
+
export const ProxyCommand = Object.freeze({
|
|
57
|
+
create() {
|
|
58
|
+
const cmd = BaseCommand.create({
|
|
59
|
+
name: 'proxy',
|
|
60
|
+
description: 'List available proxy servers',
|
|
61
|
+
addOptions,
|
|
62
|
+
execute: async (options) => {
|
|
63
|
+
const firstArg = Array.isArray(options.args) ? options.args[0] : undefined;
|
|
64
|
+
if (typeof firstArg === 'string' && firstArg.trim() !== '') {
|
|
65
|
+
await dispatchProxyTarget(firstArg);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const list = ProxyRegistry.list();
|
|
69
|
+
if (list.length === 0) {
|
|
70
|
+
throw ErrorFactory.createCliError('No proxies registered');
|
|
71
|
+
}
|
|
72
|
+
for (const proxy of list) {
|
|
73
|
+
cmd.info(`${proxy.name}: ${proxy.description}`);
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
return cmd;
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
export default ProxyCommand;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type NumberExpectation = 'positive' | 'non-negative';
|
|
2
|
+
export declare const parseIntOption: (raw: string | undefined, name: string, expectation?: NumberExpectation) => number | undefined;
|
|
3
|
+
export declare const trimOption: (value: string | undefined) => string | undefined;
|
|
4
|
+
export declare const maybeRunProxyWatchMode: (watch: boolean | undefined) => Promise<void>;
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=ProxyCommandUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProxyCommandUtils.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/ProxyCommandUtils.ts"],"names":[],"mappings":"AAIA,KAAK,iBAAiB,GAAG,UAAU,GAAG,cAAc,CAAC;AAErD,eAAO,MAAM,cAAc,GACzB,KAAK,MAAM,GAAG,SAAS,EACvB,MAAM,MAAM,EACZ,cAAa,iBAA8B,KAC1C,MAAM,GAAG,SAeX,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,GAAG,SAAS,KAAG,MAAM,GAAG,SAA0B,CAAC;AAU3F,eAAO,MAAM,sBAAsB,GAAU,OAAO,OAAO,GAAG,SAAS,KAAG,OAAO,CAAC,IAAI,CAerF,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { SpawnUtil } from '../utils/spawn.js';
|
|
2
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
3
|
+
import * as path from '../../node-singletons/path.js';
|
|
4
|
+
export const parseIntOption = (raw, name, expectation = 'positive') => {
|
|
5
|
+
if (raw === undefined)
|
|
6
|
+
return undefined;
|
|
7
|
+
const parsed = Number.parseInt(raw, 10);
|
|
8
|
+
const isValid = expectation === 'non-negative'
|
|
9
|
+
? Number.isFinite(parsed) && parsed >= 0
|
|
10
|
+
: Number.isFinite(parsed) && parsed > 0;
|
|
11
|
+
if (!isValid) {
|
|
12
|
+
const expected = expectation === 'non-negative' ? 'a non-negative number' : 'a positive number';
|
|
13
|
+
throw ErrorFactory.createCliError(`Invalid --${name} '${raw}'. Expected ${expected}.`);
|
|
14
|
+
}
|
|
15
|
+
return parsed;
|
|
16
|
+
};
|
|
17
|
+
export const trimOption = (value) => value?.trim();
|
|
18
|
+
const isWatchChild = () => process.env['ZINTRUST_PROXY_WATCH_CHILD'] === '1';
|
|
19
|
+
const buildWatchArgs = () => {
|
|
20
|
+
const rawArgs = process.argv.slice(2);
|
|
21
|
+
const filtered = rawArgs.filter((arg) => arg !== '--watch');
|
|
22
|
+
return ['watch', path.join('bin', 'zin.ts'), ...filtered];
|
|
23
|
+
};
|
|
24
|
+
export const maybeRunProxyWatchMode = async (watch) => {
|
|
25
|
+
if (watch !== true || isWatchChild())
|
|
26
|
+
return;
|
|
27
|
+
const args = buildWatchArgs();
|
|
28
|
+
const exitCode = await SpawnUtil.spawnAndWait({
|
|
29
|
+
command: 'tsx',
|
|
30
|
+
args,
|
|
31
|
+
env: {
|
|
32
|
+
...process.env,
|
|
33
|
+
ZINTRUST_PROXY_WATCH_CHILD: '1',
|
|
34
|
+
},
|
|
35
|
+
forwardSignals: false,
|
|
36
|
+
});
|
|
37
|
+
process.exit(exitCode);
|
|
38
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PutCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/PutCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAmNvF,eAAO,MAAM,UAAU;cACX,YAAY;EAWtB,CAAC;AAEH,eAAe,UAAU,CAAC"}
|