@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
package/src/config/env.d.ts
CHANGED
|
@@ -6,18 +6,28 @@
|
|
|
6
6
|
* Safe for both Node.js and serverless runtimes (Cloudflare Workers, Deno, Lambda)
|
|
7
7
|
*/
|
|
8
8
|
import type { ProcessLike } from './type';
|
|
9
|
+
export type EnvSource = Record<string, unknown> | (() => Record<string, unknown>);
|
|
9
10
|
export declare const getProcessLike: () => ProcessLike | undefined;
|
|
10
11
|
export declare const dirnameFromExecPath: (execPath: string, platform?: string) => string;
|
|
11
12
|
export declare const get: (key: string, defaultValue?: string) => string;
|
|
12
|
-
export declare const getInt: (key: string, defaultValue
|
|
13
|
+
export declare const getInt: (key: string, defaultValue: number) => number;
|
|
13
14
|
export declare const getFloat: (key: string, defaultValue?: number) => number;
|
|
14
15
|
export declare const getBool: (key: string, defaultValue?: boolean) => boolean;
|
|
16
|
+
export declare const set: (key: string, value: string) => void;
|
|
17
|
+
export declare const unset: (key: string) => void;
|
|
18
|
+
export declare const setSource: (source: EnvSource | null) => void;
|
|
19
|
+
export declare const snapshot: () => Record<string, string>;
|
|
15
20
|
export declare const getDefaultLogLevel: () => "debug" | "info" | "warn" | "error";
|
|
21
|
+
export declare const ZT_PROXY_TIMEOUT_MS: number;
|
|
16
22
|
export declare const Env: Readonly<{
|
|
17
23
|
get: (key: string, defaultValue?: string) => string;
|
|
18
|
-
getInt: (key: string, defaultValue
|
|
24
|
+
getInt: (key: string, defaultValue: number) => number;
|
|
19
25
|
getBool: (key: string, defaultValue?: boolean) => boolean;
|
|
20
26
|
getFloat: (key: string, defaultValue?: number) => number;
|
|
27
|
+
set: (key: string, value: string) => void;
|
|
28
|
+
unset: (key: string) => void;
|
|
29
|
+
setSource: (source: EnvSource | null) => void;
|
|
30
|
+
snapshot: () => Record<string, string>;
|
|
21
31
|
NODE_ENV: NodeJS.ProcessEnv["NODE_ENV"];
|
|
22
32
|
PORT: number;
|
|
23
33
|
HOST: string;
|
|
@@ -49,6 +59,67 @@ export declare const Env: Readonly<{
|
|
|
49
59
|
D1_REMOTE_KEY_ID: string;
|
|
50
60
|
D1_REMOTE_SECRET: string;
|
|
51
61
|
D1_REMOTE_MODE: string;
|
|
62
|
+
MYSQL_PROXY_URL: string;
|
|
63
|
+
MYSQL_PROXY_HOST: string;
|
|
64
|
+
MYSQL_PROXY_PORT: number;
|
|
65
|
+
MYSQL_PROXY_MAX_BODY_BYTES: number;
|
|
66
|
+
MYSQL_PROXY_POOL_LIMIT: number;
|
|
67
|
+
MYSQL_PROXY_KEY_ID: string;
|
|
68
|
+
MYSQL_PROXY_SECRET: string;
|
|
69
|
+
MYSQL_PROXY_TIMEOUT_MS: number;
|
|
70
|
+
MYSQL_PROXY_REQUIRE_SIGNING: boolean;
|
|
71
|
+
MYSQL_PROXY_SIGNING_WINDOW_MS: number;
|
|
72
|
+
POSTGRES_PROXY_URL: string;
|
|
73
|
+
POSTGRES_PROXY_HOST: string;
|
|
74
|
+
POSTGRES_PROXY_PORT: number;
|
|
75
|
+
POSTGRES_PROXY_MAX_BODY_BYTES: number;
|
|
76
|
+
POSTGRES_PROXY_POOL_LIMIT: number;
|
|
77
|
+
POSTGRES_PROXY_KEY_ID: string;
|
|
78
|
+
POSTGRES_PROXY_SECRET: string;
|
|
79
|
+
POSTGRES_PROXY_TIMEOUT_MS: number;
|
|
80
|
+
POSTGRES_PROXY_REQUIRE_SIGNING: boolean;
|
|
81
|
+
POSTGRES_PROXY_SIGNING_WINDOW_MS: number;
|
|
82
|
+
REDIS_PROXY_URL: string;
|
|
83
|
+
REDIS_PROXY_HOST: string;
|
|
84
|
+
REDIS_PROXY_PORT: number;
|
|
85
|
+
REDIS_PROXY_MAX_BODY_BYTES: number;
|
|
86
|
+
REDIS_PROXY_KEY_ID: string;
|
|
87
|
+
REDIS_PROXY_SECRET: string;
|
|
88
|
+
REDIS_PROXY_TIMEOUT_MS: number;
|
|
89
|
+
REDIS_PROXY_REQUIRE_SIGNING: boolean;
|
|
90
|
+
REDIS_PROXY_SIGNING_WINDOW_MS: number;
|
|
91
|
+
USE_REDIS_PROXY: boolean;
|
|
92
|
+
SMTP_PROXY_URL: string;
|
|
93
|
+
SMTP_PROXY_HOST: string;
|
|
94
|
+
SMTP_PROXY_PORT: number;
|
|
95
|
+
SMTP_PROXY_MAX_BODY_BYTES: number;
|
|
96
|
+
SMTP_PROXY_KEY_ID: string;
|
|
97
|
+
SMTP_PROXY_SECRET: string;
|
|
98
|
+
SMTP_PROXY_TIMEOUT_MS: number;
|
|
99
|
+
SMTP_PROXY_REQUIRE_SIGNING: boolean;
|
|
100
|
+
SMTP_PROXY_SIGNING_WINDOW_MS: number;
|
|
101
|
+
USE_SMTP_PROXY: boolean;
|
|
102
|
+
MONGODB_PROXY_URL: string;
|
|
103
|
+
MONGODB_PROXY_HOST: string;
|
|
104
|
+
MONGODB_PROXY_PORT: number;
|
|
105
|
+
MONGODB_PROXY_MAX_BODY_BYTES: number;
|
|
106
|
+
MONGODB_PROXY_KEY_ID: string;
|
|
107
|
+
MONGODB_PROXY_SECRET: string;
|
|
108
|
+
MONGODB_PROXY_TIMEOUT_MS: number;
|
|
109
|
+
MONGODB_PROXY_REQUIRE_SIGNING: boolean;
|
|
110
|
+
MONGODB_PROXY_SIGNING_WINDOW_MS: number;
|
|
111
|
+
USE_MONGODB_PROXY: boolean;
|
|
112
|
+
SQLSERVER_PROXY_URL: string;
|
|
113
|
+
SQLSERVER_PROXY_HOST: string;
|
|
114
|
+
SQLSERVER_PROXY_PORT: number;
|
|
115
|
+
SQLSERVER_PROXY_MAX_BODY_BYTES: number;
|
|
116
|
+
SQLSERVER_PROXY_POOL_LIMIT: number;
|
|
117
|
+
SQLSERVER_PROXY_KEY_ID: string;
|
|
118
|
+
SQLSERVER_PROXY_SECRET: string;
|
|
119
|
+
SQLSERVER_PROXY_TIMEOUT_MS: number;
|
|
120
|
+
SQLSERVER_PROXY_REQUIRE_SIGNING: boolean;
|
|
121
|
+
SQLSERVER_PROXY_SIGNING_WINDOW_MS: number;
|
|
122
|
+
USE_SQLSERVER_PROXY: boolean;
|
|
52
123
|
KV_REMOTE_URL: string;
|
|
53
124
|
KV_REMOTE_KEY_ID: string;
|
|
54
125
|
KV_REMOTE_SECRET: string;
|
|
@@ -59,11 +130,22 @@ export declare const Env: Readonly<{
|
|
|
59
130
|
REDIS_HOST: string;
|
|
60
131
|
REDIS_PORT: number;
|
|
61
132
|
REDIS_PASSWORD: string;
|
|
133
|
+
REDIS_DB: number;
|
|
62
134
|
REDIS_URL: string;
|
|
63
135
|
MONGO_URI: string;
|
|
64
136
|
MONGO_DB: string;
|
|
65
137
|
QUEUE_CONNECTION: string;
|
|
66
138
|
QUEUE_DRIVER: string;
|
|
139
|
+
QUEUE_HTTP_PROXY_ENABLED: boolean;
|
|
140
|
+
QUEUE_HTTP_PROXY_GATEWAY_ENABLED: boolean;
|
|
141
|
+
QUEUE_HTTP_PROXY_URL: string;
|
|
142
|
+
QUEUE_HTTP_PROXY_PATH: string;
|
|
143
|
+
QUEUE_HTTP_PROXY_KEY_ID: string;
|
|
144
|
+
QUEUE_HTTP_PROXY_KEY: string;
|
|
145
|
+
QUEUE_HTTP_PROXY_TIMEOUT_MS: number;
|
|
146
|
+
QUEUE_HTTP_PROXY_MAX_SKEW_MS: number;
|
|
147
|
+
QUEUE_HTTP_PROXY_NONCE_TTL_MS: number;
|
|
148
|
+
QUEUE_HTTP_PROXY_MIDDLEWARE: string;
|
|
67
149
|
RATE_LIMIT_STORE: string;
|
|
68
150
|
RATE_LIMIT_DRIVER: string;
|
|
69
151
|
RATE_LIMIT_KEY_PREFIX: string;
|
|
@@ -86,6 +168,9 @@ export declare const Env: Readonly<{
|
|
|
86
168
|
ENABLE_MICROSERVICES: boolean;
|
|
87
169
|
TOKEN_TTL: number;
|
|
88
170
|
TOKEN_LENGTH: number;
|
|
171
|
+
CSRF_STORE: string;
|
|
172
|
+
CSRF_DRIVER: string;
|
|
173
|
+
CSRF_REDIS_DB: number;
|
|
89
174
|
ENCRYPTION_CIPHER: string;
|
|
90
175
|
ENVIRONMENT: string;
|
|
91
176
|
REQUEST_TIMEOUT: number;
|
|
@@ -97,6 +182,7 @@ export declare const Env: Readonly<{
|
|
|
97
182
|
LOG_LEVEL: "debug" | "info" | "warn" | "error";
|
|
98
183
|
LOG_FORMAT: string;
|
|
99
184
|
LOG_CHANNEL: string;
|
|
185
|
+
DOCKER_WORKER: boolean;
|
|
100
186
|
DISABLE_LOGGING: boolean;
|
|
101
187
|
LOG_HTTP_REQUEST: boolean;
|
|
102
188
|
LOG_TO_FILE: boolean;
|
|
@@ -109,6 +195,7 @@ export declare const Env: Readonly<{
|
|
|
109
195
|
ZINTRUST_ENV_IN_FILE: string;
|
|
110
196
|
ZINTRUST_SECRETS_PROVIDER: string;
|
|
111
197
|
ZINTRUST_ALLOW_AUTO_INSTALL: string;
|
|
198
|
+
WORKER_SHUTDOWN_ON_APP_EXIT: boolean;
|
|
112
199
|
CLOUDFLARE_ACCOUNT_ID: string;
|
|
113
200
|
CLOUDFLARE_API_TOKEN: string;
|
|
114
201
|
CLOUDFLARE_KV_NAMESPACE_ID: string;
|
|
@@ -127,4 +214,5 @@ export declare const Env: Readonly<{
|
|
|
127
214
|
NODE_BIN_DIR: string;
|
|
128
215
|
SAFE_PATH: string;
|
|
129
216
|
}>;
|
|
217
|
+
export declare const buildRedisUrl: () => string;
|
|
130
218
|
//# sourceMappingURL=env.d.ts.map
|
package/src/config/env.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../src/config/env.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../src/config/env.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAuBlF,eAAO,MAAM,cAAc,QAAO,WAAW,GAAG,SAAwB,CAAC;AAEzE,eAAO,MAAM,mBAAmB,GAAI,UAAU,MAAM,EAAE,WAAW,MAAM,KAAG,MAKzE,CAAC;AAGF,eAAO,MAAM,GAAG,GAAI,KAAK,MAAM,EAAE,eAAe,MAAM,KAAG,MAIxD,CAAC;AAEF,eAAO,MAAM,MAAM,GAAI,KAAK,MAAM,EAAE,cAAc,MAAM,KAAG,MAI1D,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,KAAK,MAAM,EAAE,eAAe,MAAM,KAAG,MAI7D,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,KAAK,MAAM,EAAE,eAAe,OAAO,KAAG,OAI7D,CAAC;AAEF,eAAO,MAAM,GAAG,GAAI,KAAK,MAAM,EAAE,OAAO,MAAM,KAAG,IAGhD,CAAC;AAEF,eAAO,MAAM,KAAK,GAAI,KAAK,MAAM,KAAG,IAInC,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,QAAQ,SAAS,GAAG,IAAI,KAAG,IAEpD,CAAC;AAEF,eAAO,MAAM,QAAQ,QAAO,MAAM,CAAC,MAAM,EAAE,MAAM,CAOhD,CAAC;AAEF,eAAO,MAAM,kBAAkB,QAAO,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAKjE,CAAC;AACF,eAAO,MAAM,mBAAmB,QAAuC,CAAC;AAKxE,eAAO,MAAM,GAAG;eA3DS,MAAM,iBAAiB,MAAM,KAAG,MAAM;kBAMnC,MAAM,gBAAgB,MAAM,KAAG,MAAM;mBAYpC,MAAM,iBAAiB,OAAO,KAAG,OAAO;oBANvC,MAAM,iBAAiB,MAAM,KAAG,MAAM;eAY3C,MAAM,SAAS,MAAM,KAAG,IAAI;iBAK1B,MAAM,KAAG,IAAI;wBAMN,SAAS,GAAG,IAAI,KAAG,IAAI;oBAI7B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;cAgCJ,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAuNpB,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgFxF,CAAC;AAEH,eAAO,MAAM,aAAa,QAAO,MAchC,CAAC"}
|
package/src/config/env.js
CHANGED
|
@@ -7,6 +7,24 @@
|
|
|
7
7
|
*/
|
|
8
8
|
// Cache process check once at module load time
|
|
9
9
|
const processLike = typeof process === 'undefined' ? undefined : process;
|
|
10
|
+
let externalEnvSource = null;
|
|
11
|
+
const getEnvSource = () => {
|
|
12
|
+
if (typeof externalEnvSource === 'function')
|
|
13
|
+
return externalEnvSource();
|
|
14
|
+
if (externalEnvSource !== null)
|
|
15
|
+
return externalEnvSource;
|
|
16
|
+
return processLike?.env ?? {};
|
|
17
|
+
};
|
|
18
|
+
const normalizeEnvValue = (value) => {
|
|
19
|
+
if (value === null || value === undefined)
|
|
20
|
+
return '';
|
|
21
|
+
if (typeof value === 'string')
|
|
22
|
+
return value;
|
|
23
|
+
if (typeof value === 'number' || typeof value === 'boolean' || typeof value === 'bigint') {
|
|
24
|
+
return String(value);
|
|
25
|
+
}
|
|
26
|
+
return '';
|
|
27
|
+
};
|
|
10
28
|
export const getProcessLike = () => processLike;
|
|
11
29
|
export const dirnameFromExecPath = (execPath, platform) => {
|
|
12
30
|
const separator = platform === 'win32' ? '\\' : '/';
|
|
@@ -17,34 +35,50 @@ export const dirnameFromExecPath = (execPath, platform) => {
|
|
|
17
35
|
};
|
|
18
36
|
// Private helper functions
|
|
19
37
|
export const get = (key, defaultValue) => {
|
|
20
|
-
const env =
|
|
21
|
-
|
|
38
|
+
const env = getEnvSource();
|
|
39
|
+
const value = normalizeEnvValue(env[key]);
|
|
40
|
+
return value === '' ? (defaultValue ?? '') : value;
|
|
22
41
|
};
|
|
23
42
|
export const getInt = (key, defaultValue) => {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
if (value === undefined || value === null)
|
|
27
|
-
return defaultValue ?? 0;
|
|
28
|
-
if (typeof value === 'string' && value.trim() === '')
|
|
43
|
+
const value = get(key, String(defaultValue ?? 0));
|
|
44
|
+
if (value.trim() === '')
|
|
29
45
|
return defaultValue ?? 0;
|
|
30
46
|
return Number.parseInt(value, 10);
|
|
31
47
|
};
|
|
32
48
|
export const getFloat = (key, defaultValue) => {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
if (value === undefined || value === null)
|
|
36
|
-
return defaultValue ?? 0;
|
|
37
|
-
if (typeof value === 'string' && value.trim() === '')
|
|
49
|
+
const value = get(key, String(defaultValue ?? 0));
|
|
50
|
+
if (value.trim() === '')
|
|
38
51
|
return defaultValue ?? 0;
|
|
39
52
|
return Number.parseFloat(value);
|
|
40
53
|
};
|
|
41
54
|
export const getBool = (key, defaultValue) => {
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
if (value === undefined || value === null)
|
|
55
|
+
const value = get(key, defaultValue === true ? 'true' : 'false');
|
|
56
|
+
if (value.trim() === '')
|
|
45
57
|
return defaultValue ?? false;
|
|
46
58
|
return value.toLowerCase() === 'true' || value === '1';
|
|
47
59
|
};
|
|
60
|
+
export const set = (key, value) => {
|
|
61
|
+
if (processLike?.env === undefined)
|
|
62
|
+
return;
|
|
63
|
+
processLike.env[key] = value;
|
|
64
|
+
};
|
|
65
|
+
export const unset = (key) => {
|
|
66
|
+
if (processLike?.env === undefined)
|
|
67
|
+
return;
|
|
68
|
+
// Use Reflect.deleteProperty to avoid deleting dynamically computed property keys
|
|
69
|
+
Reflect.deleteProperty(processLike.env, key);
|
|
70
|
+
};
|
|
71
|
+
export const setSource = (source) => {
|
|
72
|
+
externalEnvSource = source;
|
|
73
|
+
};
|
|
74
|
+
export const snapshot = () => {
|
|
75
|
+
const env = getEnvSource();
|
|
76
|
+
const out = {};
|
|
77
|
+
for (const [key, value] of Object.entries(env)) {
|
|
78
|
+
out[key] = normalizeEnvValue(value);
|
|
79
|
+
}
|
|
80
|
+
return out;
|
|
81
|
+
};
|
|
48
82
|
export const getDefaultLogLevel = () => {
|
|
49
83
|
const NODE_ENV_VALUE = get('NODE_ENV', 'development');
|
|
50
84
|
if (NODE_ENV_VALUE === 'production')
|
|
@@ -53,6 +87,9 @@ export const getDefaultLogLevel = () => {
|
|
|
53
87
|
return 'error';
|
|
54
88
|
return 'debug';
|
|
55
89
|
};
|
|
90
|
+
export const ZT_PROXY_TIMEOUT_MS = getInt('ZT_PROXY_TIMEOUT_MS', 30000);
|
|
91
|
+
const PROXY_KEY_ID_FALLBACK = get('APP_NAME', 'ZinTrust');
|
|
92
|
+
const PROXY_SECRET_FALLBACK = get('APP_KEY', '');
|
|
56
93
|
// Sealed namespace with all environment configuration
|
|
57
94
|
export const Env = Object.freeze({
|
|
58
95
|
// Helper functions
|
|
@@ -60,6 +97,10 @@ export const Env = Object.freeze({
|
|
|
60
97
|
getInt,
|
|
61
98
|
getBool,
|
|
62
99
|
getFloat,
|
|
100
|
+
set,
|
|
101
|
+
unset,
|
|
102
|
+
setSource,
|
|
103
|
+
snapshot,
|
|
63
104
|
// Core
|
|
64
105
|
NODE_ENV: get('NODE_ENV', 'development'),
|
|
65
106
|
// Prefer PORT, fallback to APP_PORT for compatibility
|
|
@@ -100,6 +141,67 @@ export const Env = Object.freeze({
|
|
|
100
141
|
D1_REMOTE_KEY_ID: get('D1_REMOTE_KEY_ID', ''),
|
|
101
142
|
D1_REMOTE_SECRET: get('D1_REMOTE_SECRET', ''),
|
|
102
143
|
D1_REMOTE_MODE: get('D1_REMOTE_MODE', 'registry'),
|
|
144
|
+
MYSQL_PROXY_URL: get('MYSQL_PROXY_URL', ''),
|
|
145
|
+
MYSQL_PROXY_HOST: get('MYSQL_PROXY_HOST', '127.0.0.1'),
|
|
146
|
+
MYSQL_PROXY_PORT: getInt('MYSQL_PROXY_PORT', 8789),
|
|
147
|
+
MYSQL_PROXY_MAX_BODY_BYTES: getInt('MYSQL_PROXY_MAX_BODY_BYTES', 131072),
|
|
148
|
+
MYSQL_PROXY_POOL_LIMIT: getInt('MYSQL_PROXY_POOL_LIMIT', 10),
|
|
149
|
+
MYSQL_PROXY_KEY_ID: get('MYSQL_PROXY_KEY_ID', PROXY_KEY_ID_FALLBACK),
|
|
150
|
+
MYSQL_PROXY_SECRET: get('MYSQL_PROXY_SECRET', PROXY_SECRET_FALLBACK),
|
|
151
|
+
MYSQL_PROXY_TIMEOUT_MS: getInt('MYSQL_PROXY_TIMEOUT_MS', ZT_PROXY_TIMEOUT_MS),
|
|
152
|
+
MYSQL_PROXY_REQUIRE_SIGNING: getBool('MYSQL_PROXY_REQUIRE_SIGNING', true),
|
|
153
|
+
MYSQL_PROXY_SIGNING_WINDOW_MS: getInt('MYSQL_PROXY_SIGNING_WINDOW_MS', getInt('ZT_PROXY_SIGNING_WINDOW_MS', 60000)),
|
|
154
|
+
POSTGRES_PROXY_URL: get('POSTGRES_PROXY_URL', ''),
|
|
155
|
+
POSTGRES_PROXY_HOST: get('POSTGRES_PROXY_HOST', '127.0.0.1'),
|
|
156
|
+
POSTGRES_PROXY_PORT: getInt('POSTGRES_PROXY_PORT', 8790),
|
|
157
|
+
POSTGRES_PROXY_MAX_BODY_BYTES: getInt('POSTGRES_PROXY_MAX_BODY_BYTES', 131072),
|
|
158
|
+
POSTGRES_PROXY_POOL_LIMIT: getInt('POSTGRES_PROXY_POOL_LIMIT', 10),
|
|
159
|
+
POSTGRES_PROXY_KEY_ID: get('POSTGRES_PROXY_KEY_ID', PROXY_KEY_ID_FALLBACK),
|
|
160
|
+
POSTGRES_PROXY_SECRET: get('POSTGRES_PROXY_SECRET', PROXY_SECRET_FALLBACK),
|
|
161
|
+
POSTGRES_PROXY_TIMEOUT_MS: getInt('POSTGRES_PROXY_TIMEOUT_MS', ZT_PROXY_TIMEOUT_MS),
|
|
162
|
+
POSTGRES_PROXY_REQUIRE_SIGNING: getBool('POSTGRES_PROXY_REQUIRE_SIGNING', true),
|
|
163
|
+
POSTGRES_PROXY_SIGNING_WINDOW_MS: getInt('POSTGRES_PROXY_SIGNING_WINDOW_MS', getInt('ZT_PROXY_SIGNING_WINDOW_MS', 60000)),
|
|
164
|
+
REDIS_PROXY_URL: get('REDIS_PROXY_URL', ''),
|
|
165
|
+
REDIS_PROXY_HOST: get('REDIS_PROXY_HOST', '127.0.0.1'),
|
|
166
|
+
REDIS_PROXY_PORT: getInt('REDIS_PROXY_PORT', 8791),
|
|
167
|
+
REDIS_PROXY_MAX_BODY_BYTES: getInt('REDIS_PROXY_MAX_BODY_BYTES', 131072),
|
|
168
|
+
REDIS_PROXY_KEY_ID: get('REDIS_PROXY_KEY_ID', PROXY_KEY_ID_FALLBACK),
|
|
169
|
+
REDIS_PROXY_SECRET: get('REDIS_PROXY_SECRET', PROXY_SECRET_FALLBACK),
|
|
170
|
+
REDIS_PROXY_TIMEOUT_MS: getInt('REDIS_PROXY_TIMEOUT_MS', ZT_PROXY_TIMEOUT_MS),
|
|
171
|
+
REDIS_PROXY_REQUIRE_SIGNING: getBool('REDIS_PROXY_REQUIRE_SIGNING', true),
|
|
172
|
+
REDIS_PROXY_SIGNING_WINDOW_MS: getInt('REDIS_PROXY_SIGNING_WINDOW_MS', getInt('ZT_PROXY_SIGNING_WINDOW_MS', 60000)),
|
|
173
|
+
USE_REDIS_PROXY: getBool('USE_REDIS_PROXY', false),
|
|
174
|
+
SMTP_PROXY_URL: get('SMTP_PROXY_URL', ''),
|
|
175
|
+
SMTP_PROXY_HOST: get('SMTP_PROXY_HOST', '127.0.0.1'),
|
|
176
|
+
SMTP_PROXY_PORT: getInt('SMTP_PROXY_PORT', 8794),
|
|
177
|
+
SMTP_PROXY_MAX_BODY_BYTES: getInt('SMTP_PROXY_MAX_BODY_BYTES', 131072),
|
|
178
|
+
SMTP_PROXY_KEY_ID: get('SMTP_PROXY_KEY_ID', PROXY_KEY_ID_FALLBACK),
|
|
179
|
+
SMTP_PROXY_SECRET: get('SMTP_PROXY_SECRET', PROXY_SECRET_FALLBACK),
|
|
180
|
+
SMTP_PROXY_TIMEOUT_MS: getInt('SMTP_PROXY_TIMEOUT_MS', ZT_PROXY_TIMEOUT_MS),
|
|
181
|
+
SMTP_PROXY_REQUIRE_SIGNING: getBool('SMTP_PROXY_REQUIRE_SIGNING', true),
|
|
182
|
+
SMTP_PROXY_SIGNING_WINDOW_MS: getInt('SMTP_PROXY_SIGNING_WINDOW_MS', getInt('ZT_PROXY_SIGNING_WINDOW_MS', 60000)),
|
|
183
|
+
USE_SMTP_PROXY: getBool('USE_SMTP_PROXY', false),
|
|
184
|
+
MONGODB_PROXY_URL: get('MONGODB_PROXY_URL', ''),
|
|
185
|
+
MONGODB_PROXY_HOST: get('MONGODB_PROXY_HOST', '127.0.0.1'),
|
|
186
|
+
MONGODB_PROXY_PORT: getInt('MONGODB_PROXY_PORT', 8792),
|
|
187
|
+
MONGODB_PROXY_MAX_BODY_BYTES: getInt('MONGODB_PROXY_MAX_BODY_BYTES', 131072),
|
|
188
|
+
MONGODB_PROXY_KEY_ID: get('MONGODB_PROXY_KEY_ID', PROXY_KEY_ID_FALLBACK),
|
|
189
|
+
MONGODB_PROXY_SECRET: get('MONGODB_PROXY_SECRET', PROXY_SECRET_FALLBACK),
|
|
190
|
+
MONGODB_PROXY_TIMEOUT_MS: getInt('MONGODB_PROXY_TIMEOUT_MS', ZT_PROXY_TIMEOUT_MS),
|
|
191
|
+
MONGODB_PROXY_REQUIRE_SIGNING: getBool('MONGODB_PROXY_REQUIRE_SIGNING', true),
|
|
192
|
+
MONGODB_PROXY_SIGNING_WINDOW_MS: getInt('MONGODB_PROXY_SIGNING_WINDOW_MS', getInt('ZT_PROXY_SIGNING_WINDOW_MS', 60000)),
|
|
193
|
+
USE_MONGODB_PROXY: getBool('USE_MONGODB_PROXY', false),
|
|
194
|
+
SQLSERVER_PROXY_URL: get('SQLSERVER_PROXY_URL', ''),
|
|
195
|
+
SQLSERVER_PROXY_HOST: get('SQLSERVER_PROXY_HOST', '127.0.0.1'),
|
|
196
|
+
SQLSERVER_PROXY_PORT: getInt('SQLSERVER_PROXY_PORT', 8793),
|
|
197
|
+
SQLSERVER_PROXY_MAX_BODY_BYTES: getInt('SQLSERVER_PROXY_MAX_BODY_BYTES', 131072),
|
|
198
|
+
SQLSERVER_PROXY_POOL_LIMIT: getInt('SQLSERVER_PROXY_POOL_LIMIT', 10),
|
|
199
|
+
SQLSERVER_PROXY_KEY_ID: get('SQLSERVER_PROXY_KEY_ID', PROXY_KEY_ID_FALLBACK),
|
|
200
|
+
SQLSERVER_PROXY_SECRET: get('SQLSERVER_PROXY_SECRET', PROXY_SECRET_FALLBACK),
|
|
201
|
+
SQLSERVER_PROXY_TIMEOUT_MS: getInt('SQLSERVER_PROXY_TIMEOUT_MS', ZT_PROXY_TIMEOUT_MS),
|
|
202
|
+
SQLSERVER_PROXY_REQUIRE_SIGNING: getBool('SQLSERVER_PROXY_REQUIRE_SIGNING', true),
|
|
203
|
+
SQLSERVER_PROXY_SIGNING_WINDOW_MS: getInt('SQLSERVER_PROXY_SIGNING_WINDOW_MS', getInt('ZT_PROXY_SIGNING_WINDOW_MS', 60000)),
|
|
204
|
+
USE_SQLSERVER_PROXY: getBool('USE_SQLSERVER_PROXY', false),
|
|
103
205
|
KV_REMOTE_URL: get('KV_REMOTE_URL', ''),
|
|
104
206
|
KV_REMOTE_KEY_ID: get('KV_REMOTE_KEY_ID', ''),
|
|
105
207
|
KV_REMOTE_SECRET: get('KV_REMOTE_SECRET', ''),
|
|
@@ -112,12 +214,23 @@ export const Env = Object.freeze({
|
|
|
112
214
|
REDIS_HOST: get('REDIS_HOST', 'localhost'),
|
|
113
215
|
REDIS_PORT: getInt('REDIS_PORT', 6379),
|
|
114
216
|
REDIS_PASSWORD: get('REDIS_PASSWORD', ''),
|
|
217
|
+
REDIS_DB: getInt('REDIS_DB', 0),
|
|
115
218
|
REDIS_URL: get('REDIS_URL', ''),
|
|
116
219
|
MONGO_URI: get('MONGO_URI'),
|
|
117
220
|
MONGO_DB: get('MONGO_DB', 'zintrust_cache'),
|
|
118
221
|
// Queue
|
|
119
222
|
QUEUE_CONNECTION: get('QUEUE_CONNECTION', ''),
|
|
120
223
|
QUEUE_DRIVER: get('QUEUE_DRIVER', ''),
|
|
224
|
+
QUEUE_HTTP_PROXY_ENABLED: getBool('QUEUE_HTTP_PROXY_ENABLED', false),
|
|
225
|
+
QUEUE_HTTP_PROXY_GATEWAY_ENABLED: getBool('QUEUE_HTTP_PROXY_GATEWAY_ENABLED', true),
|
|
226
|
+
QUEUE_HTTP_PROXY_URL: get('QUEUE_HTTP_PROXY_URL', ''),
|
|
227
|
+
QUEUE_HTTP_PROXY_PATH: get('QUEUE_HTTP_PROXY_PATH', '/api/_sys/queue/rpc'),
|
|
228
|
+
QUEUE_HTTP_PROXY_KEY_ID: get('QUEUE_HTTP_PROXY_KEY_ID', PROXY_KEY_ID_FALLBACK),
|
|
229
|
+
QUEUE_HTTP_PROXY_KEY: get('QUEUE_HTTP_PROXY_KEY', PROXY_SECRET_FALLBACK),
|
|
230
|
+
QUEUE_HTTP_PROXY_TIMEOUT_MS: getInt('QUEUE_HTTP_PROXY_TIMEOUT_MS', ZT_PROXY_TIMEOUT_MS),
|
|
231
|
+
QUEUE_HTTP_PROXY_MAX_SKEW_MS: getInt('QUEUE_HTTP_PROXY_MAX_SKEW_MS', getInt('ZT_PROXY_SIGNING_WINDOW_MS', 60000)),
|
|
232
|
+
QUEUE_HTTP_PROXY_NONCE_TTL_MS: getInt('QUEUE_HTTP_PROXY_NONCE_TTL_MS', 120000),
|
|
233
|
+
QUEUE_HTTP_PROXY_MIDDLEWARE: get('QUEUE_HTTP_PROXY_MIDDLEWARE', ''),
|
|
121
234
|
// Rate Limiting
|
|
122
235
|
RATE_LIMIT_STORE: get('RATE_LIMIT_STORE', ''),
|
|
123
236
|
RATE_LIMIT_DRIVER: get('RATE_LIMIT_DRIVER', ''),
|
|
@@ -145,6 +258,9 @@ export const Env = Object.freeze({
|
|
|
145
258
|
ENABLE_MICROSERVICES: getBool('ENABLE_MICROSERVICES', false),
|
|
146
259
|
TOKEN_TTL: getInt('TOKEN_TTL', 3600000),
|
|
147
260
|
TOKEN_LENGTH: getInt('TOKEN_LENGTH', 32),
|
|
261
|
+
CSRF_STORE: get('CSRF_STORE', ''),
|
|
262
|
+
CSRF_DRIVER: get('CSRF_DRIVER', ''),
|
|
263
|
+
CSRF_REDIS_DB: getInt('CSRF_REDIS_DB', 1),
|
|
148
264
|
// Encryption interop
|
|
149
265
|
ENCRYPTION_CIPHER: get('ENCRYPTION_CIPHER', ''),
|
|
150
266
|
// Deployment
|
|
@@ -160,6 +276,7 @@ export const Env = Object.freeze({
|
|
|
160
276
|
LOG_LEVEL: get('LOG_LEVEL', getDefaultLogLevel()),
|
|
161
277
|
LOG_FORMAT: get('LOG_FORMAT', 'text'),
|
|
162
278
|
LOG_CHANNEL: get('LOG_CHANNEL', ''),
|
|
279
|
+
DOCKER_WORKER: getBool('DOCKER_WORKER', false),
|
|
163
280
|
DISABLE_LOGGING: getBool('DISABLE_LOGGING', false),
|
|
164
281
|
LOG_HTTP_REQUEST: getBool('LOG_HTTP_REQUEST', false),
|
|
165
282
|
LOG_TO_FILE: getBool('LOG_TO_FILE', false),
|
|
@@ -173,6 +290,7 @@ export const Env = Object.freeze({
|
|
|
173
290
|
ZINTRUST_ENV_IN_FILE: get('ZINTRUST_ENV_IN_FILE', '.env'),
|
|
174
291
|
ZINTRUST_SECRETS_PROVIDER: get('ZINTRUST_SECRETS_PROVIDER', ''),
|
|
175
292
|
ZINTRUST_ALLOW_AUTO_INSTALL: get('ZINTRUST_ALLOW_AUTO_INSTALL', ''),
|
|
293
|
+
WORKER_SHUTDOWN_ON_APP_EXIT: getBool('WORKER_SHUTDOWN_ON_APP_EXIT', true),
|
|
176
294
|
// Cloudflare Credentials
|
|
177
295
|
CLOUDFLARE_ACCOUNT_ID: get('CLOUDFLARE_ACCOUNT_ID', ''),
|
|
178
296
|
CLOUDFLARE_API_TOKEN: get('CLOUDFLARE_API_TOKEN', ''),
|
|
@@ -188,9 +306,9 @@ export const Env = Object.freeze({
|
|
|
188
306
|
HOME: get('HOME', ''),
|
|
189
307
|
USERPROFILE: get('USERPROFILE', ''),
|
|
190
308
|
// Template/Misc
|
|
191
|
-
TEMPLATE_COPYRIGHT: get('TEMPLATE_COPYRIGHT',
|
|
309
|
+
TEMPLATE_COPYRIGHT: get('TEMPLATE_COPYRIGHT', `© ${new Date().getFullYear()} ZinTrust Framework. All rights reserved.`),
|
|
192
310
|
SERVICE_NAME: get('SERVICE_NAME', ''),
|
|
193
|
-
APP_MODE: get('APP_MODE', ''),
|
|
311
|
+
APP_MODE: get('APP_MODE', get('NODE_ENV', 'development')),
|
|
194
312
|
APP_PORT: getInt('APP_PORT', 3000),
|
|
195
313
|
RUNTIME: get('RUNTIME', ''),
|
|
196
314
|
// Paths (safely constructed for Node.js environments)
|
|
@@ -213,7 +331,15 @@ export const Env = Object.freeze({
|
|
|
213
331
|
if (processLike.platform === 'win32') {
|
|
214
332
|
return [String.raw `C:\Windows\System32`, String.raw `C:\Windows`, binDir].join(';');
|
|
215
333
|
}
|
|
216
|
-
return [
|
|
334
|
+
return [
|
|
335
|
+
'/opt/homebrew/bin',
|
|
336
|
+
'/usr/local/bin',
|
|
337
|
+
'/usr/bin',
|
|
338
|
+
'/bin',
|
|
339
|
+
'/usr/sbin',
|
|
340
|
+
'/sbin',
|
|
341
|
+
binDir,
|
|
342
|
+
].join(':');
|
|
217
343
|
}
|
|
218
344
|
catch {
|
|
219
345
|
// Fallback for non-Node environments
|
|
@@ -221,3 +347,19 @@ export const Env = Object.freeze({
|
|
|
221
347
|
}
|
|
222
348
|
})(),
|
|
223
349
|
});
|
|
350
|
+
export const buildRedisUrl = () => {
|
|
351
|
+
const raw = get('REDIS_URL', '').trim();
|
|
352
|
+
if (raw !== '')
|
|
353
|
+
return raw;
|
|
354
|
+
const host = get('REDIS_HOST', 'localhost');
|
|
355
|
+
const port = getInt('REDIS_PORT', 6379);
|
|
356
|
+
const password = get('REDIS_PASSWORD', '');
|
|
357
|
+
const db = getInt('REDIS_QUEUE_DB', 0);
|
|
358
|
+
let url = 'redis://';
|
|
359
|
+
if (password.trim() !== '')
|
|
360
|
+
url += `:${encodeURIComponent(password)}@`;
|
|
361
|
+
url += `${host}:${port}`;
|
|
362
|
+
if (db > 0)
|
|
363
|
+
url += `/${db}`;
|
|
364
|
+
return url;
|
|
365
|
+
};
|
package/src/config/index.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export declare const config: Readonly<{
|
|
|
28
28
|
readonly isProduction: () => boolean;
|
|
29
29
|
readonly isTesting: () => boolean;
|
|
30
30
|
readonly debug: boolean;
|
|
31
|
+
readonly dockerWorker: boolean;
|
|
31
32
|
readonly timezone: string;
|
|
32
33
|
readonly requestTimeout: number;
|
|
33
34
|
readonly maxBodySize: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,KAAK,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD;;;GAGG;AACH,eAAO,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,KAAK,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD;;;GAGG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;8BAZc,CAAC;;;;;;;;;;;;;;;;;;;;2EAAC,CAAA;;;;;;;;;;;;;;;;;;;;8BAD2B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA2BomB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;EAHzpB,CAAC;AAEZ,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/config/logger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/config/logger.ts"],"names":[],"mappings":"AASA,UAAU,OAAO;IACf,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAClE;AAiYD,eAAO,MAAM,aAAa,QAAa,OAAO,CAAC,MAAM,EAAE,CAYtD,CAAC;AAEF,eAAO,MAAM,MAAM;qBA5JQ,MAAM,SAAS,OAAO,aAAa,MAAM,KAAG,IAAI;oBAqBjD,MAAM,SAAS,OAAO,aAAa,MAAM,KAAG,IAAI;oBAqBhD,MAAM,SAAS,OAAO,aAAa,MAAM,KAAG,IAAI;qBAqB/C,MAAM,UAAU,OAAO,aAAa,MAAM,KAAG,IAAI;qBA2BjD,MAAM,UAAU,OAAO,aAAa,MAAM,KAAG,IAAI;yBAoDrC,OAAO,CAAC,MAAM,EAAE,CAAC;mBArBtB,MAAM,KAAG,OAAO;EA2ChD,CAAC;AAEH,eAAe,MAAM,CAAC"}
|
package/src/config/logger.js
CHANGED
|
@@ -5,10 +5,42 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { appConfig } from './app.js';
|
|
7
7
|
import { Env } from './env.js';
|
|
8
|
-
const isDevelopment = () => appConfig.isDevelopment();
|
|
9
8
|
const isProduction = () => appConfig.isProduction();
|
|
10
9
|
const getLogFormat = () => Env.get('LOG_FORMAT', 'text');
|
|
11
10
|
const isJsonFormat = (value) => value === 'json';
|
|
11
|
+
// Log level priority: lower means more verbose
|
|
12
|
+
const levelPriority = {
|
|
13
|
+
debug: 0,
|
|
14
|
+
info: 1,
|
|
15
|
+
warn: 2,
|
|
16
|
+
error: 3,
|
|
17
|
+
fatal: 4,
|
|
18
|
+
};
|
|
19
|
+
const getConfiguredLogLevel = () => {
|
|
20
|
+
const raw = Env.get('LOG_LEVEL', Env.LOG_LEVEL ?? 'debug')
|
|
21
|
+
.trim()
|
|
22
|
+
.toLowerCase();
|
|
23
|
+
if (raw === 'debug')
|
|
24
|
+
return 'debug';
|
|
25
|
+
if (raw === 'info')
|
|
26
|
+
return 'info';
|
|
27
|
+
if (raw === 'warn')
|
|
28
|
+
return 'warn';
|
|
29
|
+
if (raw === 'error')
|
|
30
|
+
return 'error';
|
|
31
|
+
return 'info';
|
|
32
|
+
};
|
|
33
|
+
const shouldEmit = (level) => {
|
|
34
|
+
// If global disable, never emit
|
|
35
|
+
if (Env.getBool('DISABLE_LOGGING', false))
|
|
36
|
+
return false;
|
|
37
|
+
// Respect configured LOG_LEVEL
|
|
38
|
+
const configured = getConfiguredLogLevel();
|
|
39
|
+
const lp = levelPriority[level];
|
|
40
|
+
const configuredLp = levelPriority[configured] ?? levelPriority['info'];
|
|
41
|
+
return lp >= configuredLp;
|
|
42
|
+
};
|
|
43
|
+
// TODO developers should be able to customize sensitive fields via config
|
|
12
44
|
const SENSITIVE_FIELDS = new Set([
|
|
13
45
|
'password',
|
|
14
46
|
'token',
|
|
@@ -78,6 +110,9 @@ const getFileWriter = () => {
|
|
|
78
110
|
});
|
|
79
111
|
};
|
|
80
112
|
const shouldLogToFile = () => {
|
|
113
|
+
// Respect global disable
|
|
114
|
+
if (Env.getBool('DISABLE_LOGGING', false))
|
|
115
|
+
return false;
|
|
81
116
|
// Prefer dynamic lookup so late-bound env (tests, some runtimes) is respected.
|
|
82
117
|
const channel = Env.get('LOG_CHANNEL', '').trim().toLowerCase();
|
|
83
118
|
const channelWantsFile = channel === 'file' || channel === 'all';
|
|
@@ -182,26 +217,29 @@ const emitCloudLogs = (event) => {
|
|
|
182
217
|
};
|
|
183
218
|
// Private helper functions
|
|
184
219
|
const logDebug = (message, data, category) => {
|
|
220
|
+
if (!shouldEmit('debug'))
|
|
221
|
+
return;
|
|
185
222
|
String(category);
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
223
|
+
const timestamp = new Date().toISOString();
|
|
224
|
+
const out = formatLogMessage({ level: 'debug', message, data, category });
|
|
225
|
+
writeToFile(buildFileLine({ formatted: out, data }));
|
|
226
|
+
if (isJsonFormat(getLogFormat())) {
|
|
227
|
+
console.debug(out); // eslint-disable-line no-console
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
194
230
|
console.debug(out, data ?? ''); // eslint-disable-line no-console
|
|
195
|
-
emitCloudLogs({
|
|
196
|
-
timestamp,
|
|
197
|
-
level: 'debug',
|
|
198
|
-
message,
|
|
199
|
-
category,
|
|
200
|
-
data: redactSensitiveData(data),
|
|
201
|
-
});
|
|
202
231
|
}
|
|
232
|
+
emitCloudLogs({
|
|
233
|
+
timestamp,
|
|
234
|
+
level: 'debug',
|
|
235
|
+
message,
|
|
236
|
+
category,
|
|
237
|
+
data: redactSensitiveData(data),
|
|
238
|
+
});
|
|
203
239
|
};
|
|
204
240
|
const logInfo = (message, data, category) => {
|
|
241
|
+
if (!shouldEmit('info'))
|
|
242
|
+
return;
|
|
205
243
|
String(category);
|
|
206
244
|
const timestamp = new Date().toISOString();
|
|
207
245
|
const out = formatLogMessage({ level: 'info', message, data, category });
|
|
@@ -221,6 +259,8 @@ const logInfo = (message, data, category) => {
|
|
|
221
259
|
});
|
|
222
260
|
};
|
|
223
261
|
const logWarn = (message, data, category) => {
|
|
262
|
+
if (!shouldEmit('warn'))
|
|
263
|
+
return;
|
|
224
264
|
String(category);
|
|
225
265
|
const timestamp = new Date().toISOString();
|
|
226
266
|
const out = formatLogMessage({ level: 'warn', message, data, category });
|
|
@@ -240,6 +280,8 @@ const logWarn = (message, data, category) => {
|
|
|
240
280
|
});
|
|
241
281
|
};
|
|
242
282
|
const logError = (message, error, category) => {
|
|
283
|
+
if (!shouldEmit('error'))
|
|
284
|
+
return;
|
|
243
285
|
const errorMessage = getErrorMessage(error);
|
|
244
286
|
String(category);
|
|
245
287
|
const timestamp = new Date().toISOString();
|
|
@@ -265,6 +307,8 @@ const logError = (message, error, category) => {
|
|
|
265
307
|
});
|
|
266
308
|
};
|
|
267
309
|
const logFatal = (message, error, category) => {
|
|
310
|
+
if (!shouldEmit('fatal'))
|
|
311
|
+
return;
|
|
268
312
|
const errorMessage = getErrorMessage(error);
|
|
269
313
|
String(category);
|
|
270
314
|
const timestamp = new Date().toISOString();
|
package/src/config/mail.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mail.d.ts","sourceRoot":"","sources":["../../../src/config/mail.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAItE,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACxC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAC3C,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"mail.d.ts","sourceRoot":"","sources":["../../../src/config/mail.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAItE,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACxC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAC3C,CAAC,CAAC;AA6FH,QAAA,MAAM,gBAAgB,QAAO;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACxC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC1C,SAAS,EAAE,CAAC,IAAI,EAAE,eAAe,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,gBAAgB,CAAC;CA6CvE,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAqB7D,eAAO,MAAM,UAAU,EAAE,UAYvB,CAAC"}
|
package/src/config/mail.js
CHANGED
|
@@ -35,16 +35,11 @@ const getMailDriver = (config, name) => {
|
|
|
35
35
|
}
|
|
36
36
|
throw ErrorFactory.createConfigError(`Mail driver not configured: ${selected}`);
|
|
37
37
|
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const baseFrom = {
|
|
44
|
-
address: Env.get('MAIL_FROM_ADDRESS', ''),
|
|
45
|
-
name: Env.get('MAIL_FROM_NAME', ''),
|
|
46
|
-
};
|
|
47
|
-
const baseDrivers = {
|
|
38
|
+
/**
|
|
39
|
+
* Create base mail drivers configuration
|
|
40
|
+
*/
|
|
41
|
+
const createMailDrivers = () => {
|
|
42
|
+
return {
|
|
48
43
|
disabled: {
|
|
49
44
|
driver: 'disabled',
|
|
50
45
|
},
|
|
@@ -97,6 +92,17 @@ const createMailConfig = () => {
|
|
|
97
92
|
region: Env.get('AWS_REGION', 'us-east-1'),
|
|
98
93
|
},
|
|
99
94
|
};
|
|
95
|
+
};
|
|
96
|
+
const createMailConfig = () => {
|
|
97
|
+
const overrides = StartupConfigFileRegistry.get(StartupConfigFile.Mail) ?? {};
|
|
98
|
+
const baseDefault = Env.get('MAIL_CONNECTION', Env.get('MAIL_DRIVER', 'disabled'))
|
|
99
|
+
.trim()
|
|
100
|
+
.toLowerCase();
|
|
101
|
+
const baseFrom = {
|
|
102
|
+
address: Env.get('MAIL_FROM_ADDRESS', ''),
|
|
103
|
+
name: Env.get('MAIL_FROM_NAME', ''),
|
|
104
|
+
};
|
|
105
|
+
const baseDrivers = createMailDrivers();
|
|
100
106
|
const mailConfigObj = {
|
|
101
107
|
/**
|
|
102
108
|
* Default mail driver
|
|
@@ -43,6 +43,11 @@ export declare const MiddlewareKeys: Readonly<{
|
|
|
43
43
|
}>;
|
|
44
44
|
export type MiddlewareKey = keyof typeof MiddlewareKeys;
|
|
45
45
|
export declare function createMiddlewareConfig(): MiddlewareConfigType;
|
|
46
|
+
/**
|
|
47
|
+
* Clear the middleware configuration cache
|
|
48
|
+
* This ensures fresh config loading in watch mode
|
|
49
|
+
*/
|
|
50
|
+
export declare const clearMiddlewareConfigCache: () => void;
|
|
46
51
|
export declare const middlewareConfig: MiddlewareConfigType;
|
|
47
52
|
export default middlewareConfig;
|
|
48
53
|
//# sourceMappingURL=middleware.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../../src/config/middleware.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../../src/config/middleware.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AA+DzD,eAAO,MAAM,cAAc;;;;;CAKjB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,aAAa,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAClE,aAAa,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAClE,qBAAqB,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3E,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;EAiBuB,CAAC;AAEnD,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,cAAc,CAAC;AA0MxD,wBAAgB,sBAAsB,IAAI,oBAAoB,CAkC7D;AAID;;;GAGG;AACH,eAAO,MAAM,0BAA0B,QAAO,IAE7C,CAAC;AAwBF,eAAO,MAAM,gBAAgB,EAAE,oBAY7B,CAAC;AAEH,eAAe,gBAAgB,CAAC"}
|