@zintrust/core 0.1.39 → 0.1.41
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 +8 -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 -262
- package/src/boot/Server.d.ts +1 -1
- package/src/boot/Server.d.ts.map +1 -1
- package/src/boot/bootstrap.js +23 -9
- 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 +353 -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 +82 -34
- package/src/cli/ErrorHandler.js +1 -1
- 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/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 +216 -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/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/QueueRecoveryCommand.d.ts +6 -0
- package/src/cli/commands/QueueRecoveryCommand.d.ts.map +1 -0
- package/src/cli/commands/QueueRecoveryCommand.js +513 -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/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 +145 -18
- 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/d1/D1SqlMigrations.d.ts.map +1 -1
- package/src/cli/d1/D1SqlMigrations.js +3 -0
- 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/utils/EnvFileLoader.d.ts +2 -1
- package/src/cli/utils/EnvFileLoader.d.ts.map +1 -1
- package/src/cli/utils/EnvFileLoader.js +22 -21
- package/src/cli/utils/spawn.d.ts.map +1 -1
- package/src/cli/utils/spawn.js +17 -10
- package/src/cli/workers/QueueWorkRunner.js +1 -1
- package/src/common/ExternalServiceUtils.d.ts.map +1 -1
- package/src/common/ExternalServiceUtils.js +7 -2
- 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 +39 -13
- 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/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 +48 -0
- package/src/config/database.d.ts.map +1 -1
- package/src/config/database.js +48 -13
- package/src/config/env.d.ts +90 -2
- package/src/config/env.d.ts.map +1 -1
- package/src/config/env.js +160 -18
- package/src/config/index.d.ts +1 -0
- package/src/config/index.d.ts.map +1 -1
- package/src/config/logger.d.ts.map +1 -1
- package/src/config/logger.js +60 -16
- 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 +19 -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/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 +25 -53
- package/src/index.d.ts.map +1 -1
- package/src/index.js +30 -14
- 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 +39 -10
- package/src/middleware/ErrorHandlerMiddleware.d.ts.map +1 -1
- package/src/middleware/ErrorHandlerMiddleware.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/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/adapters/D1RemoteAdapter.d.ts.map +1 -1
- package/src/orm/adapters/D1RemoteAdapter.js +14 -1
- 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 +143 -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 +147 -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 +35 -0
- package/src/orm/adapters/SqlServerProxyAdapter.d.ts +3 -0
- package/src/orm/adapters/SqlServerProxyAdapter.d.ts.map +1 -0
- package/src/orm/adapters/SqlServerProxyAdapter.js +146 -0
- 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/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 +25 -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/d1/ZintrustD1Proxy.d.ts +2 -0
- package/src/proxy/d1/ZintrustD1Proxy.d.ts.map +1 -0
- package/src/proxy/d1/ZintrustD1Proxy.js +1 -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/kv/ZintrustKvProxy.d.ts +2 -0
- package/src/proxy/kv/ZintrustKvProxy.d.ts.map +1 -0
- package/src/proxy/kv/ZintrustKvProxy.js +1 -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 +14 -0
- package/src/proxy/mysql/MySqlProxyServer.d.ts.map +1 -0
- package/src/proxy/mysql/MySqlProxyServer.js +169 -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 +14 -0
- package/src/proxy/postgres/PostgresProxyServer.d.ts.map +1 -0
- package/src/proxy/postgres/PostgresProxyServer.js +140 -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 +289 -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 +14 -0
- package/src/proxy/sqlserver/SqlServerProxyServer.d.ts.map +1 -0
- package/src/proxy/sqlserver/SqlServerProxyServer.js +168 -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/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/scripts/TemplateImportsCheck.js +2 -2
- package/src/scripts/TemplateSync.js +3 -4
- package/src/security/CsrfTokenManager.d.ts +18 -9
- package/src/security/CsrfTokenManager.d.ts.map +1 -1
- package/src/security/CsrfTokenManager.js +204 -11
- 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/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/project/basic/app/Middleware/index.ts.tpl +1 -1
- package/src/templates/project/basic/src/zintrust.plugins.wg.ts.tpl +8 -0
- package/src/toolkit/Secrets/providers/AwsSecretsManager.d.ts.map +1 -1
- package/src/toolkit/Secrets/providers/AwsSecretsManager.js +4 -2
- package/src/tools/mail/drivers/Smtp.d.ts.map +1 -1
- package/src/tools/mail/drivers/Smtp.js +223 -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 +88 -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 +205 -0
- package/src/tools/queue/JobStateTracker.d.ts +131 -0
- package/src/tools/queue/JobStateTracker.d.ts.map +1 -0
- package/src/tools/queue/JobStateTracker.js +387 -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 +148 -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/redis/RedisKeyManager.d.ts +3 -0
- package/src/tools/redis/RedisKeyManager.d.ts.map +1 -1
- package/src/tools/redis/RedisKeyManager.js +15 -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 @@
|
|
|
1
|
+
{"version":3,"file":"ProxyConfig.d.ts","sourceRoot":"","sources":["../../../src/proxy/ProxyConfig.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type ProxyRegistration = Readonly<{
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
}>;
|
|
5
|
+
export declare const ProxyRegistry: Readonly<{
|
|
6
|
+
register: (proxy: ProxyRegistration) => void;
|
|
7
|
+
get: (name: string) => ProxyRegistration | undefined;
|
|
8
|
+
list: () => ProxyRegistration[];
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=ProxyRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProxyRegistry.d.ts","sourceRoot":"","sources":["../../../src/proxy/ProxyRegistry.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC,CAAC;AAYH,eAAO,MAAM,aAAa;sBARD,iBAAiB,KAAG,IAAI;gBAI9B,MAAM,KAAG,iBAAiB,GAAG,SAAS;gBAExC,iBAAiB,EAAE;EAMlC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const registry = new Map();
|
|
2
|
+
const register = (proxy) => {
|
|
3
|
+
registry.set(proxy.name, proxy);
|
|
4
|
+
};
|
|
5
|
+
const get = (name) => registry.get(name);
|
|
6
|
+
const list = () => Array.from(registry.values());
|
|
7
|
+
export const ProxyRegistry = Object.freeze({
|
|
8
|
+
register,
|
|
9
|
+
get,
|
|
10
|
+
list,
|
|
11
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type IncomingMessage, type Server } from '../node-singletons/http';
|
|
2
|
+
import type { ProxyBackend } from './ProxyBackend';
|
|
3
|
+
export type ProxyServerOptions = Readonly<{
|
|
4
|
+
host: string;
|
|
5
|
+
port: number;
|
|
6
|
+
maxBodyBytes: number;
|
|
7
|
+
backend: ProxyBackend;
|
|
8
|
+
verify?: (req: IncomingMessage, body: string) => Promise<{
|
|
9
|
+
ok: true;
|
|
10
|
+
} | {
|
|
11
|
+
ok: false;
|
|
12
|
+
status: number;
|
|
13
|
+
message: string;
|
|
14
|
+
}>;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const createProxyServer: (options: ProxyServerOptions) => Readonly<{
|
|
17
|
+
start: () => Promise<void>;
|
|
18
|
+
stop: () => Promise<void>;
|
|
19
|
+
server: Server;
|
|
20
|
+
}>;
|
|
21
|
+
//# sourceMappingURL=ProxyServer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProxyServer.d.ts","sourceRoot":"","sources":["../../../src/proxy/ProxyServer.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,MAAM,EAEZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,YAAY,EAA+B,MAAM,qBAAqB,CAAC;AAErF,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,YAAY,CAAC;IACtB,MAAM,CAAC,EAAE,CACP,GAAG,EAAE,eAAe,EACpB,IAAI,EAAE,MAAM,KACT,OAAO,CAAC;QAAE,EAAE,EAAE,IAAI,CAAA;KAAE,GAAG;QAAE,EAAE,EAAE,KAAK,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC7E,CAAC,CAAC;AA0CH,eAAO,MAAM,iBAAiB,GAC5B,SAAS,kBAAkB,KAC1B,QAAQ,CAAC;IACV,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;CAChB,CAsDA,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { ErrorFactory } from '../exceptions/ZintrustError.js';
|
|
2
|
+
import { createServer, } from '../node-singletons/http.js';
|
|
3
|
+
const readBody = async (req, maxBodyBytes) => {
|
|
4
|
+
const chunks = [];
|
|
5
|
+
let size = 0;
|
|
6
|
+
for await (const chunk of req) {
|
|
7
|
+
const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
8
|
+
size += buffer.length;
|
|
9
|
+
if (size > maxBodyBytes) {
|
|
10
|
+
throw ErrorFactory.createValidationError('Body too large');
|
|
11
|
+
}
|
|
12
|
+
chunks.push(buffer);
|
|
13
|
+
}
|
|
14
|
+
return Buffer.concat(chunks).toString('utf8');
|
|
15
|
+
};
|
|
16
|
+
const respond = (res, response) => {
|
|
17
|
+
res.writeHead(response.status, {
|
|
18
|
+
'Content-Type': 'application/json; charset=utf-8',
|
|
19
|
+
'Cache-Control': 'no-store',
|
|
20
|
+
...response.headers,
|
|
21
|
+
});
|
|
22
|
+
res.end(JSON.stringify(response.body));
|
|
23
|
+
};
|
|
24
|
+
const toProxyRequest = (req, body) => {
|
|
25
|
+
const url = new URL(req.url ?? '/', `http://${req.headers.host ?? 'localhost'}`);
|
|
26
|
+
const headers = {};
|
|
27
|
+
for (const [key, value] of Object.entries(req.headers)) {
|
|
28
|
+
headers[key.toLowerCase()] = Array.isArray(value) ? value.join(',') : value;
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
method: req.method ?? 'POST',
|
|
32
|
+
path: url.pathname,
|
|
33
|
+
headers,
|
|
34
|
+
body,
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export const createProxyServer = (options) => {
|
|
38
|
+
const server = createServer(async (req, res) => {
|
|
39
|
+
try {
|
|
40
|
+
const body = await readBody(req, options.maxBodyBytes);
|
|
41
|
+
if ((req.url ?? '').startsWith('/health')) {
|
|
42
|
+
const response = await options.backend.health();
|
|
43
|
+
respond(res, response);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (options.verify) {
|
|
47
|
+
const verified = await options.verify(req, body);
|
|
48
|
+
if (!verified.ok) {
|
|
49
|
+
respond(res, {
|
|
50
|
+
status: verified.status,
|
|
51
|
+
body: { code: 'UNAUTHORIZED', message: verified.message },
|
|
52
|
+
});
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const request = toProxyRequest(req, body);
|
|
57
|
+
const response = await options.backend.handle(request);
|
|
58
|
+
respond(res, response);
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
respond(res, {
|
|
62
|
+
status: 500,
|
|
63
|
+
body: { code: 'PROXY_ERROR', message: String(error) },
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
const start = async () => new Promise((resolve) => {
|
|
68
|
+
server.listen(options.port, options.host, () => resolve());
|
|
69
|
+
});
|
|
70
|
+
const stop = async () => new Promise((resolve, reject) => {
|
|
71
|
+
server.close((error) => {
|
|
72
|
+
if (error) {
|
|
73
|
+
reject(error);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
resolve();
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
return Object.freeze({
|
|
80
|
+
start,
|
|
81
|
+
stop,
|
|
82
|
+
server,
|
|
83
|
+
});
|
|
84
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { IncomingMessage } from '../node-singletons/http';
|
|
2
|
+
import type { ProxySigningConfig } from './ProxyConfig';
|
|
3
|
+
export type BaseProxyConfig = {
|
|
4
|
+
host: string;
|
|
5
|
+
port: number;
|
|
6
|
+
maxBodyBytes: number;
|
|
7
|
+
};
|
|
8
|
+
export type BaseProxyOverrides = Partial<{
|
|
9
|
+
host: string;
|
|
10
|
+
port: number;
|
|
11
|
+
maxBodyBytes: number;
|
|
12
|
+
requireSigning: boolean;
|
|
13
|
+
keyId: string;
|
|
14
|
+
secret: string;
|
|
15
|
+
signingWindowMs: number;
|
|
16
|
+
}>;
|
|
17
|
+
export declare const resolveBaseConfig: (overrides: BaseProxyOverrides, prefix: string, defaults?: {
|
|
18
|
+
host?: string;
|
|
19
|
+
port?: number;
|
|
20
|
+
maxBodyBytes?: number;
|
|
21
|
+
}) => BaseProxyConfig;
|
|
22
|
+
export declare const resolveBaseSigningConfig: (overrides: BaseProxyOverrides, prefix: string) => {
|
|
23
|
+
keyId: string;
|
|
24
|
+
secret: string;
|
|
25
|
+
requireSigning: boolean;
|
|
26
|
+
signingWindowMs: number;
|
|
27
|
+
};
|
|
28
|
+
export declare const verifyRequestSignature: (req: IncomingMessage, body: string, config: {
|
|
29
|
+
signing: ProxySigningConfig;
|
|
30
|
+
}, serviceName: string) => Promise<{
|
|
31
|
+
ok: boolean;
|
|
32
|
+
error?: {
|
|
33
|
+
status: number;
|
|
34
|
+
message: string;
|
|
35
|
+
};
|
|
36
|
+
}>;
|
|
37
|
+
//# sourceMappingURL=ProxyServerUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProxyServerUtils.d.ts","sourceRoot":"","sources":["../../../src/proxy/ProxyServerUtils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAI7D,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC,CAAC;AAEH,eAAO,MAAM,iBAAiB,GAC5B,WAAW,kBAAkB,EAC7B,QAAQ,MAAM,EACd,WAAW;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,KACjE,eAUF,CAAC;AAEF,eAAO,MAAM,wBAAwB,GACnC,WAAW,kBAAkB,EAC7B,QAAQ,MAAM,KACb;IACD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;CAOtB,CAAC;AAEL,eAAO,MAAM,sBAAsB,GACjC,KAAK,eAAe,EACpB,MAAM,MAAM,EACZ,QAAQ;IAAE,OAAO,EAAE,kBAAkB,CAAA;CAAE,EACvC,aAAa,MAAM,KAClB,OAAO,CAAC;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CA8BtE,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Env } from '../config/env.js';
|
|
2
|
+
import { Logger } from '../config/logger.js';
|
|
3
|
+
import { resolveProxySigningConfig } from './ProxySigningConfigResolver.js';
|
|
4
|
+
import { extractSigningHeaders, verifyProxySignatureIfNeeded } from './ProxySigningRequest.js';
|
|
5
|
+
export const resolveBaseConfig = (overrides, prefix, defaults) => {
|
|
6
|
+
const host = overrides.host ?? Env.get(`${prefix}_PROXY_HOST`, Env.HOST ?? defaults?.host ?? '127.0.0.1');
|
|
7
|
+
const port = overrides.port ?? Env.getInt(`${prefix}_PROXY_PORT`, Env.PORT ?? defaults?.port ?? 3000);
|
|
8
|
+
const maxBodyBytes = overrides.maxBodyBytes ??
|
|
9
|
+
Env.getInt(`${prefix}_PROXY_MAX_BODY_BYTES`, Env.MAX_BODY_SIZE ?? defaults?.maxBodyBytes ?? 0);
|
|
10
|
+
return { host, port, maxBodyBytes };
|
|
11
|
+
};
|
|
12
|
+
export const resolveBaseSigningConfig = (overrides, prefix) => resolveProxySigningConfig(overrides, {
|
|
13
|
+
keyIdEnvVar: `${prefix}_PROXY_KEY_ID`,
|
|
14
|
+
secretEnvVar: `${prefix}_PROXY_SECRET`,
|
|
15
|
+
requireEnvVar: `${prefix}_PROXY_REQUIRE_SIGNING`,
|
|
16
|
+
windowEnvVar: `${prefix}_PROXY_SIGNING_WINDOW_MS`,
|
|
17
|
+
});
|
|
18
|
+
export const verifyRequestSignature = async (req, body, config, serviceName) => {
|
|
19
|
+
const headers = extractSigningHeaders(req);
|
|
20
|
+
const hasAnySigningHeader = Object.values(headers).some((value) => typeof value === 'string' && value.trim() !== '');
|
|
21
|
+
Logger.debug(`[${serviceName}] Verifying request signature`, {
|
|
22
|
+
path: req.url ?? '',
|
|
23
|
+
method: req.method ?? 'POST',
|
|
24
|
+
requireSigning: config.signing.require,
|
|
25
|
+
hasAnySigningHeader,
|
|
26
|
+
configuredKeyId: config.signing.keyId,
|
|
27
|
+
hasConfiguredSecret: config.signing.secret.trim() !== '',
|
|
28
|
+
bodyBytes: body.length,
|
|
29
|
+
});
|
|
30
|
+
const verified = await verifyProxySignatureIfNeeded(req, body, config.signing);
|
|
31
|
+
if (!verified.ok) {
|
|
32
|
+
const error = verified.error ?? { status: 401, message: 'Unauthorized' };
|
|
33
|
+
Logger.warn(`[${serviceName}] Signature verification failed`, {
|
|
34
|
+
path: req.url ?? '',
|
|
35
|
+
method: req.method ?? 'POST',
|
|
36
|
+
status: error.status,
|
|
37
|
+
message: error.message,
|
|
38
|
+
});
|
|
39
|
+
return { ok: false, error };
|
|
40
|
+
}
|
|
41
|
+
return { ok: true };
|
|
42
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
type SigningOverrideLike = Partial<{
|
|
2
|
+
requireSigning: boolean;
|
|
3
|
+
keyId: string;
|
|
4
|
+
secret: string;
|
|
5
|
+
signingWindowMs: number;
|
|
6
|
+
}>;
|
|
7
|
+
type ResolveSigningConfigOptions = {
|
|
8
|
+
keyIdEnvVar: string;
|
|
9
|
+
secretEnvVar: string;
|
|
10
|
+
requireEnvVar: string;
|
|
11
|
+
windowEnvVar: string;
|
|
12
|
+
defaultRequire?: boolean;
|
|
13
|
+
defaultWindowMs?: number;
|
|
14
|
+
};
|
|
15
|
+
export declare const resolveProxySigningConfig: (overrides: SigningOverrideLike | undefined, options: ResolveSigningConfigOptions) => {
|
|
16
|
+
keyId: string;
|
|
17
|
+
secret: string;
|
|
18
|
+
requireSigning: boolean;
|
|
19
|
+
signingWindowMs: number;
|
|
20
|
+
};
|
|
21
|
+
export default resolveProxySigningConfig;
|
|
22
|
+
//# sourceMappingURL=ProxySigningConfigResolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProxySigningConfigResolver.d.ts","sourceRoot":"","sources":["../../../src/proxy/ProxySigningConfigResolver.ts"],"names":[],"mappings":"AAGA,KAAK,mBAAmB,GAAG,OAAO,CAAC;IACjC,cAAc,EAAE,OAAO,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC,CAAC;AAEH,KAAK,2BAA2B,GAAG;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,yBAAyB,GACpC,WAAW,mBAAmB,GAAG,SAAS,EAC1C,SAAS,2BAA2B,KACnC;IACD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;CA4BzB,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Env } from '../config/env.js';
|
|
2
|
+
import { normalizeSigningCredentials } from './SigningService.js';
|
|
3
|
+
export const resolveProxySigningConfig = (overrides, options) => {
|
|
4
|
+
const normalizedOverrides = overrides ?? {};
|
|
5
|
+
const appName = Env.get('APP_NAME', Env.APP_NAME ?? 'ZinTrust');
|
|
6
|
+
const appKey = Env.get('APP_KEY', Env.APP_KEY ?? '');
|
|
7
|
+
const envKeyId = Env.get(options.keyIdEnvVar, appName);
|
|
8
|
+
const envSecret = Env.get(options.secretEnvVar, appKey);
|
|
9
|
+
const keyIdRaw = normalizedOverrides.keyId ?? (envKeyId.trim() === '' ? appName : envKeyId);
|
|
10
|
+
const secretRaw = normalizedOverrides.secret ?? (envSecret.trim() === '' ? appKey : envSecret);
|
|
11
|
+
const secret = secretRaw.trim() === '' ? appKey : secretRaw;
|
|
12
|
+
const creds = normalizeSigningCredentials({ keyId: keyIdRaw, secret });
|
|
13
|
+
const requireSigning = normalizedOverrides.requireSigning ??
|
|
14
|
+
Env.getBool(options.requireEnvVar, options.defaultRequire ?? true);
|
|
15
|
+
const signingWindowMs = normalizedOverrides.signingWindowMs ??
|
|
16
|
+
Env.getInt(options.windowEnvVar, options.defaultWindowMs ?? 60000);
|
|
17
|
+
return {
|
|
18
|
+
keyId: creds.keyId,
|
|
19
|
+
secret: creds.secret,
|
|
20
|
+
requireSigning,
|
|
21
|
+
signingWindowMs,
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export default resolveProxySigningConfig;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IncomingMessage } from '../node-singletons/http';
|
|
2
|
+
import type { ProxySigningConfig } from './ProxyConfig';
|
|
3
|
+
export declare const normalizeHeaderValue: (value: string | string[] | undefined) => string | undefined;
|
|
4
|
+
export declare const extractSigningHeaders: (req: IncomingMessage) => Record<string, string | undefined>;
|
|
5
|
+
export declare const verifyProxySignatureIfNeeded: (req: IncomingMessage, body: string, signing: ProxySigningConfig) => Promise<{
|
|
6
|
+
ok: boolean;
|
|
7
|
+
error?: {
|
|
8
|
+
status: number;
|
|
9
|
+
message: string;
|
|
10
|
+
};
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=ProxySigningRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProxySigningRequest.d.ts","sourceRoot":"","sources":["../../../src/proxy/ProxySigningRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAG7D,eAAO,MAAM,oBAAoB,GAAI,OAAO,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,KAAG,MAAM,GAAG,SAGpF,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,KAAK,eAAe,KACnB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAMlC,CAAC;AAEH,eAAO,MAAM,4BAA4B,GACvC,KAAK,eAAe,EACpB,MAAM,MAAM,EACZ,SAAS,kBAAkB,KAC1B,OAAO,CAAC;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAqBtE,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SigningService } from './SigningService.js';
|
|
2
|
+
export const normalizeHeaderValue = (value) => {
|
|
3
|
+
if (Array.isArray(value))
|
|
4
|
+
return value.join(',');
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
7
|
+
export const extractSigningHeaders = (req) => ({
|
|
8
|
+
'x-zt-key-id': normalizeHeaderValue(req.headers['x-zt-key-id']),
|
|
9
|
+
'x-zt-timestamp': normalizeHeaderValue(req.headers['x-zt-timestamp']),
|
|
10
|
+
'x-zt-nonce': normalizeHeaderValue(req.headers['x-zt-nonce']),
|
|
11
|
+
'x-zt-body-sha256': normalizeHeaderValue(req.headers['x-zt-body-sha256']),
|
|
12
|
+
'x-zt-signature': normalizeHeaderValue(req.headers['x-zt-signature']),
|
|
13
|
+
});
|
|
14
|
+
export const verifyProxySignatureIfNeeded = async (req, body, signing) => {
|
|
15
|
+
const headers = extractSigningHeaders(req);
|
|
16
|
+
if (!SigningService.shouldVerify(signing, headers)) {
|
|
17
|
+
return { ok: true };
|
|
18
|
+
}
|
|
19
|
+
const url = new URL(req.url ?? '/', `http://${req.headers.host ?? 'localhost'}`);
|
|
20
|
+
const verified = await SigningService.verify({
|
|
21
|
+
method: req.method ?? 'POST',
|
|
22
|
+
url,
|
|
23
|
+
body,
|
|
24
|
+
headers,
|
|
25
|
+
signing,
|
|
26
|
+
});
|
|
27
|
+
if (!verified.ok) {
|
|
28
|
+
return { ok: false, error: { status: verified.status, message: verified.message } };
|
|
29
|
+
}
|
|
30
|
+
return { ok: true };
|
|
31
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type ValidationError = Readonly<{
|
|
2
|
+
code: string;
|
|
3
|
+
message: string;
|
|
4
|
+
}>;
|
|
5
|
+
export declare const RequestValidator: Readonly<{
|
|
6
|
+
parseJson: (body: string) => {
|
|
7
|
+
ok: true;
|
|
8
|
+
value: Record<string, unknown>;
|
|
9
|
+
} | {
|
|
10
|
+
ok: false;
|
|
11
|
+
error: ValidationError;
|
|
12
|
+
};
|
|
13
|
+
requirePost: (method: string | undefined) => ValidationError | null;
|
|
14
|
+
}>;
|
|
15
|
+
//# sourceMappingURL=RequestValidator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RequestValidator.d.ts","sourceRoot":"","sources":["../../../src/proxy/RequestValidator.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AA4B1E,eAAO,MAAM,gBAAgB;sBAtBrB,MAAM,KACX;QAAE,EAAE,EAAE,IAAI,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GAAG;QAAE,EAAE,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,eAAe,CAAA;KAAE;0BAgB1D,MAAM,GAAG,SAAS,KAAG,eAAe,GAAG,IAAI;EAQtE,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const isRecord = (value) => typeof value === 'object' && value !== null;
|
|
2
|
+
const parseJson = (body) => {
|
|
3
|
+
if (body.trim() === '') {
|
|
4
|
+
return { ok: false, error: { code: 'VALIDATION_ERROR', message: 'Body is required' } };
|
|
5
|
+
}
|
|
6
|
+
try {
|
|
7
|
+
const parsed = JSON.parse(body);
|
|
8
|
+
if (!isRecord(parsed)) {
|
|
9
|
+
return { ok: false, error: { code: 'VALIDATION_ERROR', message: 'Body must be an object' } };
|
|
10
|
+
}
|
|
11
|
+
return { ok: true, value: parsed };
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
return { ok: false, error: { code: 'INVALID_JSON', message: String(error) } };
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const requirePost = (method) => {
|
|
18
|
+
if (method === 'POST')
|
|
19
|
+
return null;
|
|
20
|
+
return { code: 'METHOD_NOT_ALLOWED', message: 'POST only' };
|
|
21
|
+
};
|
|
22
|
+
export const RequestValidator = Object.freeze({
|
|
23
|
+
parseJson,
|
|
24
|
+
requirePost,
|
|
25
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ProxySigningConfig } from './ProxyConfig';
|
|
2
|
+
export type SigningHeaders = Headers | Record<string, string | undefined>;
|
|
3
|
+
export type SigningVerificationResult = {
|
|
4
|
+
ok: true;
|
|
5
|
+
} | {
|
|
6
|
+
ok: false;
|
|
7
|
+
status: number;
|
|
8
|
+
code: string;
|
|
9
|
+
message: string;
|
|
10
|
+
};
|
|
11
|
+
export type SigningCredentials = Readonly<{
|
|
12
|
+
keyId: string;
|
|
13
|
+
secret: string;
|
|
14
|
+
}>;
|
|
15
|
+
type SigningServiceApi = Readonly<{
|
|
16
|
+
normalizeConfig: (signing: ProxySigningConfig) => ProxySigningConfig;
|
|
17
|
+
shouldVerify: (signing: ProxySigningConfig, headers: SigningHeaders) => boolean;
|
|
18
|
+
verify: (params: {
|
|
19
|
+
method: string;
|
|
20
|
+
url: string | URL;
|
|
21
|
+
body: string | Uint8Array;
|
|
22
|
+
headers: SigningHeaders;
|
|
23
|
+
signing: ProxySigningConfig;
|
|
24
|
+
}) => Promise<SigningVerificationResult>;
|
|
25
|
+
verifyWithKeyProvider: (params: {
|
|
26
|
+
method: string;
|
|
27
|
+
url: string | URL;
|
|
28
|
+
body: string | Uint8Array;
|
|
29
|
+
headers: SigningHeaders;
|
|
30
|
+
windowMs: number;
|
|
31
|
+
getSecretForKeyId: (keyId: string) => string | undefined | Promise<string | undefined>;
|
|
32
|
+
verifyNonce?: (keyId: string, nonce: string, ttlMs: number) => Promise<boolean>;
|
|
33
|
+
}) => Promise<SigningVerificationResult>;
|
|
34
|
+
}>;
|
|
35
|
+
export declare const normalizeSigningConfig: (signing: ProxySigningConfig) => ProxySigningConfig;
|
|
36
|
+
export declare const normalizeSigningCredentials: (input: SigningCredentials) => SigningCredentials;
|
|
37
|
+
export declare const SigningService: SigningServiceApi;
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=SigningService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SigningService.d.ts","sourceRoot":"","sources":["../../../src/proxy/SigningService.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAI7D,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAE1E,MAAM,MAAM,yBAAyB,GACjC;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GACZ;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjE,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC,CAAC;AAEH,KAAK,iBAAiB,GAAG,QAAQ,CAAC;IAChC,eAAe,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,kBAAkB,CAAC;IACrE,YAAY,EAAE,CAAC,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC;IAChF,MAAM,EAAE,CAAC,MAAM,EAAE;QACf,MAAM,EAAE,MAAM,CAAC;QACf,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;QAClB,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;QAC1B,OAAO,EAAE,cAAc,CAAC;QACxB,OAAO,EAAE,kBAAkB,CAAC;KAC7B,KAAK,OAAO,CAAC,yBAAyB,CAAC,CAAC;IACzC,qBAAqB,EAAE,CAAC,MAAM,EAAE;QAC9B,MAAM,EAAE,MAAM,CAAC;QACf,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;QAClB,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;QAC1B,OAAO,EAAE,cAAc,CAAC;QACxB,QAAQ,EAAE,MAAM,CAAC;QACjB,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;QACvF,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;KACjF,KAAK,OAAO,CAAC,yBAAyB,CAAC,CAAC;CAC1C,CAAC,CAAC;AAyCH,eAAO,MAAM,sBAAsB,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,kBAErB,CAAC;AAElD,eAAO,MAAM,2BAA2B,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,kBAKvE,CAAC;AA0FH,eAAO,MAAM,cAAc,EAAE,iBAK3B,CAAC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { Env } from '../config/env.js';
|
|
2
|
+
import { SignedRequest } from '../security/SignedRequest.js';
|
|
3
|
+
const getHeader = (headers, name) => {
|
|
4
|
+
if (typeof headers.get === 'function') {
|
|
5
|
+
const value = headers.get(name);
|
|
6
|
+
return value ?? undefined;
|
|
7
|
+
}
|
|
8
|
+
return headers[name];
|
|
9
|
+
};
|
|
10
|
+
const hasSigningHeaders = (headers) => Boolean((getHeader(headers, 'x-zt-key-id') ?? '') ||
|
|
11
|
+
(getHeader(headers, 'x-zt-timestamp') ?? '') ||
|
|
12
|
+
(getHeader(headers, 'x-zt-nonce') ?? '') ||
|
|
13
|
+
(getHeader(headers, 'x-zt-body-sha256') ?? '') ||
|
|
14
|
+
getHeader(headers, 'x-zt-signature'));
|
|
15
|
+
const normalizeKeyId = (keyId) => {
|
|
16
|
+
const trimmed = keyId.trim();
|
|
17
|
+
if (trimmed !== '')
|
|
18
|
+
return trimmed.toLowerCase();
|
|
19
|
+
const appNameRaw = Env.APP_NAME ?? 'zintrust';
|
|
20
|
+
const normalized = (appNameRaw.trim() === '' ? 'zintrust' : appNameRaw)
|
|
21
|
+
.toLowerCase()
|
|
22
|
+
.replaceAll(/\s+/g, '_');
|
|
23
|
+
return normalized;
|
|
24
|
+
};
|
|
25
|
+
const normalizeSecret = (secret) => {
|
|
26
|
+
const trimmed = secret.trim();
|
|
27
|
+
if (trimmed !== '')
|
|
28
|
+
return trimmed;
|
|
29
|
+
return Env.APP_KEY ?? '';
|
|
30
|
+
};
|
|
31
|
+
const normalizeConfig = (signing) => ({
|
|
32
|
+
...signing,
|
|
33
|
+
keyId: normalizeKeyId(signing.keyId),
|
|
34
|
+
secret: normalizeSecret(signing.secret),
|
|
35
|
+
});
|
|
36
|
+
export const normalizeSigningConfig = (signing) => normalizeConfig(signing);
|
|
37
|
+
export const normalizeSigningCredentials = (input) => ({
|
|
38
|
+
keyId: normalizeKeyId(input.keyId),
|
|
39
|
+
secret: normalizeSecret(input.secret),
|
|
40
|
+
});
|
|
41
|
+
const shouldVerify = (signing, headers) => {
|
|
42
|
+
const normalized = normalizeConfig(signing);
|
|
43
|
+
if (normalized.require)
|
|
44
|
+
return true;
|
|
45
|
+
if (normalized.keyId.trim() !== '' &&
|
|
46
|
+
normalized.secret.trim() !== '' &&
|
|
47
|
+
hasSigningHeaders(headers)) {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
return false;
|
|
51
|
+
};
|
|
52
|
+
const mapVerifyResult = (result) => {
|
|
53
|
+
if (result.ok)
|
|
54
|
+
return { ok: true };
|
|
55
|
+
if (result.code === 'MISSING_HEADER' || result.code === 'INVALID_TIMESTAMP') {
|
|
56
|
+
return { ok: false, status: 401, code: result.code, message: result.message };
|
|
57
|
+
}
|
|
58
|
+
if (result.code === 'EXPIRED') {
|
|
59
|
+
return { ok: false, status: 401, code: result.code, message: result.message };
|
|
60
|
+
}
|
|
61
|
+
if (result.code === 'UNKNOWN_KEY') {
|
|
62
|
+
return { ok: false, status: 403, code: result.code, message: result.message };
|
|
63
|
+
}
|
|
64
|
+
if (result.code === 'REPLAYED') {
|
|
65
|
+
return { ok: false, status: 409, code: result.code, message: result.message };
|
|
66
|
+
}
|
|
67
|
+
return { ok: false, status: 403, code: result.code, message: result.message };
|
|
68
|
+
};
|
|
69
|
+
const verify = async (params) => {
|
|
70
|
+
const signing = normalizeConfig(params.signing);
|
|
71
|
+
if (signing.require && (signing.keyId.trim() === '' || signing.secret.trim() === '')) {
|
|
72
|
+
return {
|
|
73
|
+
ok: false,
|
|
74
|
+
status: 500,
|
|
75
|
+
code: 'SIGNING_REQUIRED',
|
|
76
|
+
message: 'Proxy signing is required but not configured',
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
const result = await SignedRequest.verify({
|
|
80
|
+
method: params.method,
|
|
81
|
+
url: params.url,
|
|
82
|
+
body: params.body,
|
|
83
|
+
headers: params.headers,
|
|
84
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
85
|
+
getSecretForKeyId: async (keyId) => keyId.trim().toLowerCase() === signing.keyId ? signing.secret : undefined,
|
|
86
|
+
windowMs: signing.windowMs,
|
|
87
|
+
});
|
|
88
|
+
return mapVerifyResult(result);
|
|
89
|
+
};
|
|
90
|
+
const verifyWithKeyProvider = async (params) => {
|
|
91
|
+
const result = await SignedRequest.verify({
|
|
92
|
+
method: params.method,
|
|
93
|
+
url: params.url,
|
|
94
|
+
body: params.body,
|
|
95
|
+
headers: params.headers,
|
|
96
|
+
windowMs: params.windowMs,
|
|
97
|
+
getSecretForKeyId: params.getSecretForKeyId,
|
|
98
|
+
verifyNonce: params.verifyNonce,
|
|
99
|
+
});
|
|
100
|
+
return mapVerifyResult(result);
|
|
101
|
+
};
|
|
102
|
+
export const SigningService = Object.freeze({
|
|
103
|
+
normalizeConfig,
|
|
104
|
+
shouldVerify,
|
|
105
|
+
verify,
|
|
106
|
+
verifyWithKeyProvider,
|
|
107
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type SqlPayloadValidation = {
|
|
2
|
+
valid: true;
|
|
3
|
+
sql: string;
|
|
4
|
+
params: unknown[];
|
|
5
|
+
} | {
|
|
6
|
+
valid: false;
|
|
7
|
+
error: {
|
|
8
|
+
code: string;
|
|
9
|
+
message: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export declare const validateSqlPayload: (payload: Record<string, unknown>) => SqlPayloadValidation;
|
|
13
|
+
//# sourceMappingURL=SqlPayloadValidator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SqlPayloadValidator.d.ts","sourceRoot":"","sources":["../../../src/proxy/SqlPayloadValidator.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAC5B;IACE,KAAK,EAAE,IAAI,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,OAAO,EAAE,CAAC;CACnB,GACD;IACE,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAC1C,CAAC;AAEN,eAAO,MAAM,kBAAkB,GAAI,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,oBAerE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const validateSqlPayload = (payload) => {
|
|
2
|
+
const sql = payload['sql'];
|
|
3
|
+
const params = Array.isArray(payload['params']) ? payload['params'] : [];
|
|
4
|
+
if (typeof sql !== 'string') {
|
|
5
|
+
return {
|
|
6
|
+
valid: false,
|
|
7
|
+
error: {
|
|
8
|
+
code: 'VALIDATION_ERROR',
|
|
9
|
+
message: 'sql must be a string',
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
return { valid: true, sql, params };
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZintrustD1Proxy.d.ts","sourceRoot":"","sources":["../../../../src/proxy/d1/ZintrustD1Proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wCAAwC,EACxC,qCAAqC,EACrC,eAAe,GAChB,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { _ZINTRUST_CLOUDFLARE_D1_PROXY_BUILD_DATE, _ZINTRUST_CLOUDFLARE_D1_PROXY_VERSION, ZintrustD1Proxy, } from '../../../packages/cloudflare-d1-proxy/src/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/proxy/d1/register.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZintrustKvProxy.d.ts","sourceRoot":"","sources":["../../../../src/proxy/kv/ZintrustKvProxy.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wCAAwC,EACxC,qCAAqC,EACrC,eAAe,GAChB,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { _ZINTRUST_CLOUDFLARE_KV_PROXY_BUILD_DATE, _ZINTRUST_CLOUDFLARE_KV_PROXY_VERSION, ZintrustKvProxy, } from '../../../packages/cloudflare-kv-proxy/src/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/proxy/kv/register.ts"],"names":[],"mappings":""}
|