@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/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @zintrust/core v0.1.
|
|
2
|
+
* @zintrust/core v0.1.41
|
|
3
3
|
*
|
|
4
4
|
* ZinTrust Framework - Production-Grade TypeScript Backend
|
|
5
5
|
* Built for performance, type safety, and exceptional developer experience
|
|
6
6
|
*
|
|
7
7
|
* Build Information:
|
|
8
|
-
* Built: 2026-
|
|
8
|
+
* Built: 2026-02-15T07:16:08.895Z
|
|
9
9
|
* Node: >=20.0.0
|
|
10
10
|
* License: MIT
|
|
11
11
|
*
|
|
@@ -20,14 +20,11 @@
|
|
|
20
20
|
* Framework version and build metadata
|
|
21
21
|
* Available at runtime for debugging and health checks
|
|
22
22
|
*/
|
|
23
|
-
export const ZINTRUST_VERSION = '0.1.
|
|
24
|
-
export const ZINTRUST_BUILD_DATE = '2026-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const ZintrustApplication = Application;
|
|
29
|
-
const ZintrustAwsSigV4 = AwsSigV4;
|
|
30
|
-
const ZintrustSignedRequest = SignedRequest;
|
|
23
|
+
export const ZINTRUST_VERSION = '0.1.41';
|
|
24
|
+
export const ZINTRUST_BUILD_DATE = '2026-02-15T07:16:08.864Z'; // Replaced during build
|
|
25
|
+
export { Application } from './boot/Application.js';
|
|
26
|
+
export { AwsSigV4 } from './common/index.js';
|
|
27
|
+
export { SignedRequest } from './security/SignedRequest.js';
|
|
31
28
|
export { Server } from './boot/Server.js';
|
|
32
29
|
export { ServiceContainer } from './container/ServiceContainer.js';
|
|
33
30
|
export { createPaginator, getNextPageUrl, getPrevPageUrl, Paginator } from './database/Paginator.js';
|
|
@@ -58,7 +55,6 @@ export { SQLServerAdapter } from './orm/adapters/SQLServerAdapter.js';
|
|
|
58
55
|
export { Database, resetDatabase, useDatabase, useEnsureDbConnected } from './orm/Database.js';
|
|
59
56
|
export { Model } from './orm/Model.js';
|
|
60
57
|
export { QueryBuilder } from './orm/QueryBuilder.js';
|
|
61
|
-
export { ZintrustApplication as Application };
|
|
62
58
|
// Time Utilities
|
|
63
59
|
export { DateTime } from './time/DateTime.js';
|
|
64
60
|
// Migrations
|
|
@@ -73,7 +69,6 @@ export { DatabaseAdapterRegistry } from './orm/DatabaseAdapterRegistry.js';
|
|
|
73
69
|
// Common
|
|
74
70
|
export { generateSecureJobId, generateUuid, getString, Utilities, } from './common/utility.js';
|
|
75
71
|
export { delay, ensureDirSafe } from './common/index.js';
|
|
76
|
-
export { ZintrustAwsSigV4 as AwsSigV4 };
|
|
77
72
|
// Collections
|
|
78
73
|
export { collect, Collection } from './collections/index.js';
|
|
79
74
|
// HTTP Client
|
|
@@ -92,6 +87,8 @@ export { PrometheusMetrics } from './observability/PrometheusMetrics.js';
|
|
|
92
87
|
export { ValidationError } from './validation/ValidationError.js';
|
|
93
88
|
export { Schema, Validator } from './validation/Validator.js';
|
|
94
89
|
// Security
|
|
90
|
+
export { _ZINTRUST_CLOUDFLARE_D1_PROXY_BUILD_DATE, _ZINTRUST_CLOUDFLARE_D1_PROXY_VERSION, ZintrustD1Proxy, } from './proxy/d1/ZintrustD1Proxy.js';
|
|
91
|
+
export { _ZINTRUST_CLOUDFLARE_KV_PROXY_BUILD_DATE, _ZINTRUST_CLOUDFLARE_KV_PROXY_VERSION, ZintrustKvProxy, } from './proxy/kv/ZintrustKvProxy.js';
|
|
95
92
|
export { CsrfTokenManager } from './security/CsrfTokenManager.js';
|
|
96
93
|
export { EncryptedEnvelope } from './security/EncryptedEnvelope.js';
|
|
97
94
|
export { Encryptor } from './security/Encryptor.js';
|
|
@@ -102,9 +99,10 @@ export { createSanitizer, Sanitizer } from './security/Sanitizer.js';
|
|
|
102
99
|
export { TokenRevocation } from './security/TokenRevocation.js';
|
|
103
100
|
export { Xss } from './security/Xss.js';
|
|
104
101
|
export { XssProtection } from './security/XssProtection.js';
|
|
105
|
-
export { ZintrustSignedRequest as SignedRequest };
|
|
106
102
|
// Exceptions
|
|
107
103
|
export { ErrorFactory } from './exceptions/ZintrustError.js';
|
|
104
|
+
// Runtime services
|
|
105
|
+
export { detectCloudflareWorkers, detectRuntimePlatform, RUNTIME_PLATFORM, RuntimeServices, } from './runtime/RuntimeServices.js';
|
|
108
106
|
// Events
|
|
109
107
|
export { EventDispatcher } from './events/EventDispatcher.js';
|
|
110
108
|
// Sessions
|
|
@@ -128,7 +126,7 @@ export { MicroserviceManager } from './microservices/MicroserviceManager.js';
|
|
|
128
126
|
export { RequestTracingMiddleware } from './microservices/RequestTracingMiddleware.js';
|
|
129
127
|
export { ServiceAuthMiddleware } from './microservices/ServiceAuthMiddleware.js';
|
|
130
128
|
export { HealthCheckHandler, ServiceHealthMonitor } from './microservices/ServiceHealthMonitor.js';
|
|
131
|
-
export { middlewareConfig, MiddlewareKeys } from './config/middleware.js';
|
|
129
|
+
export { clearMiddlewareConfigCache, middlewareConfig, MiddlewareKeys } from './config/middleware.js';
|
|
132
130
|
export { createBaseDrivers, queueConfig } from './config/queue.js';
|
|
133
131
|
export { default as broadcastConfig } from './config/broadcast.js';
|
|
134
132
|
export { default as notificationConfig } from './config/notification.js';
|
|
@@ -177,8 +175,20 @@ export { R2Driver } from './tools/storage/drivers/R2.js';
|
|
|
177
175
|
export { GcsDriver } from './tools/storage/drivers/Gcs.js';
|
|
178
176
|
// Queue drivers (for external registration packages)
|
|
179
177
|
export { RedisQueue } from './tools/queue/drivers/Redis.js';
|
|
178
|
+
export { IdempotencyManager } from './tools/queue/IdempotencyManager.js';
|
|
179
|
+
export { JobHeartbeatStore } from './tools/queue/JobHeartbeatStore.js';
|
|
180
|
+
export { JobReconciliationRunner } from './tools/queue/JobReconciliationRunner.js';
|
|
181
|
+
export { JobRecoveryDaemon } from './tools/queue/JobRecoveryDaemon.js';
|
|
182
|
+
export { JobStateTracker } from './tools/queue/JobStateTracker.js';
|
|
183
|
+
export { autoRegisterJobStateTrackerPersistenceFromEnv, createJobStateTrackerDbPersistence, } from './tools/queue/JobStateTrackerDbPersistence.js';
|
|
180
184
|
export { createLockProvider, getLockProvider, registerLockProvider } from './tools/queue/LockProvider.js';
|
|
181
185
|
export { Queue, resolveLockPrefix } from './tools/queue/Queue.js';
|
|
186
|
+
export { QueueDataRedactor } from './tools/queue/QueueDataRedactor.js';
|
|
187
|
+
export { QueueReliabilityMetrics } from './tools/queue/QueueReliabilityMetrics.js';
|
|
188
|
+
export { QueueReliabilityOrchestrator } from './tools/queue/QueueReliabilityOrchestrator.js';
|
|
189
|
+
export { QueueTracing } from './tools/queue/QueueTracing.js';
|
|
190
|
+
export { StalledJobMonitor } from './tools/queue/StalledJobMonitor.js';
|
|
191
|
+
export { TimeoutManager } from './tools/queue/TimeoutManager.js';
|
|
182
192
|
// Seeders (for database seeding)
|
|
183
193
|
export { SeederLoader } from './seeders/SeederLoader.js';
|
|
184
194
|
// Schedules
|
|
@@ -193,6 +203,10 @@ export { MicroserviceGenerator } from './microservices/MicroserviceGenerator.js'
|
|
|
193
203
|
export { BaseCommand } from './cli/BaseCommand.js';
|
|
194
204
|
export { CLI } from './cli/CLI.js';
|
|
195
205
|
export { ErrorHandler, EXIT_CODES } from './cli/ErrorHandler.js';
|
|
206
|
+
// Proxy utilities (shared across proxy servers)
|
|
207
|
+
export { ErrorHandler as ProxyErrorHandler } from './proxy/ErrorHandler.js';
|
|
208
|
+
export { RequestValidator } from './proxy/RequestValidator.js';
|
|
209
|
+
export { SigningService } from './proxy/SigningService.js';
|
|
196
210
|
// Runtime detection and kernel
|
|
197
211
|
export { getKernel } from './runtime/getKernel.js';
|
|
198
212
|
export { useFileLoader } from './runtime/useFileLoader.js';
|
|
@@ -208,5 +222,7 @@ export { ZintrustLang } from './lang/lang.js';
|
|
|
208
222
|
export { createRedisConnection, workersConfig } from './config/workers.js';
|
|
209
223
|
// Redis config key - Singleton exports
|
|
210
224
|
export { createRedisKey, extractOriginalKey, getBullMQSafeQueueName, getPrefix, isAppKey, RedisKeys, } from './tools/redis/RedisKeyManager.js';
|
|
225
|
+
export { CloudflareSocket } from './sockets/CloudflareSocket.js';
|
|
226
|
+
export { detectRuntime } from './runtime/detectRuntime.js';
|
|
211
227
|
// NOTE: Node-only exports (like FileLogWriter, process) are intentionally not
|
|
212
228
|
// exported from this root entrypoint. Use the '@zintrust/core/node' subpath.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceAuthMiddleware.d.ts","sourceRoot":"","sources":["../../../src/microservices/ServiceAuthMiddleware.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAIhD,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnE;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEjE,MAAM,WAAW,WAAW;IAC1B,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,YAAY,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAC/B,QAAQ,IAAI,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,UAAU;IACrB;;OAEG;oBACa,MAAM,GAAG,WAAW;EA6BpC,CAAC;AAEH,MAAM,WAAW,QAAQ;IACvB,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnE,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CACvD;AAED;;GAEG;AACH,eAAO,MAAM,OAAO;IAClB;;OAEG;oBACa,MAAM,GAAG,QAAQ;EAyDjC,CAAC;AAEH,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CAChC;AAED;;GAEG;AACH,eAAO,MAAM,UAAU;IACrB;;OAEG;sBACe,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,GAAG,WAAW;EAO1D,CAAC;AAEH,MAAM,WAAW,sBAAsB;IACrC,kBAAkB,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,GAAG,IAAI,CAAC;IAChE,UAAU,CACR,QAAQ,EAAE,YAAY,GACrB,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChF;
|
|
1
|
+
{"version":3,"file":"ServiceAuthMiddleware.d.ts","sourceRoot":"","sources":["../../../src/microservices/ServiceAuthMiddleware.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAIhD,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnE;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEjE,MAAM,WAAW,WAAW;IAC1B,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,YAAY,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAC/B,QAAQ,IAAI,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,UAAU;IACrB;;OAEG;oBACa,MAAM,GAAG,WAAW;EA6BpC,CAAC;AAEH,MAAM,WAAW,QAAQ;IACvB,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnE,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CACvD;AAED;;GAEG;AACH,eAAO,MAAM,OAAO;IAClB;;OAEG;oBACa,MAAM,GAAG,QAAQ;EAyDjC,CAAC;AAEH,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CAChC;AAED;;GAEG;AACH,eAAO,MAAM,UAAU;IACrB;;OAEG;sBACe,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,GAAG,WAAW;EAO1D,CAAC;AAEH,MAAM,WAAW,sBAAsB;IACrC,kBAAkB,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,GAAG,IAAI,CAAC;IAChE,UAAU,CACR,QAAQ,EAAE,YAAY,GACrB,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChF;AAkND,eAAO,MAAM,qBAAqB,kCAA+C,CAAC;AAElF,eAAe,qBAAqB,CAAC"}
|
|
@@ -200,9 +200,17 @@ const verifyStrategy = (strategy, auth, context, deps) => {
|
|
|
200
200
|
}
|
|
201
201
|
};
|
|
202
202
|
const createServiceAuthMiddleware = () => {
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
let defaultApiKeyAuth = null;
|
|
204
|
+
let defaultJwtAuth = null;
|
|
205
205
|
let customValidator = null;
|
|
206
|
+
const getApiKeyAuth = () => {
|
|
207
|
+
defaultApiKeyAuth ??= ApiKeyAuth.create();
|
|
208
|
+
return defaultApiKeyAuth;
|
|
209
|
+
};
|
|
210
|
+
const getJwtAuth = () => {
|
|
211
|
+
defaultJwtAuth ??= JwtAuth.create();
|
|
212
|
+
return defaultJwtAuth;
|
|
213
|
+
};
|
|
206
214
|
return {
|
|
207
215
|
/**
|
|
208
216
|
* Register custom auth validator
|
|
@@ -224,8 +232,8 @@ const createServiceAuthMiddleware = () => {
|
|
|
224
232
|
return res.setStatus(401).json({ error: 'Missing or invalid authorization header' });
|
|
225
233
|
}
|
|
226
234
|
const result = verifyStrategy(strategy, auth, context, {
|
|
227
|
-
apiKeyAuth:
|
|
228
|
-
jwtAuth:
|
|
235
|
+
apiKeyAuth: getApiKeyAuth(),
|
|
236
|
+
jwtAuth: getJwtAuth(),
|
|
229
237
|
customValidator,
|
|
230
238
|
});
|
|
231
239
|
if (!result.authenticated) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CsrfMiddleware.d.ts","sourceRoot":"","sources":["../../../src/middleware/CsrfMiddleware.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"CsrfMiddleware.d.ts","sourceRoot":"","sources":["../../../src/middleware/CsrfMiddleware.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAK9D,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AA0CD,eAAO,MAAM,cAAc;IACzB;;OAEG;qBACa,WAAW,GAAQ,UAAU;EA6D7C,CAAC"}
|
|
@@ -12,6 +12,39 @@ const DEFAULT_OPTIONS = {
|
|
|
12
12
|
bodyKey: '_csrf',
|
|
13
13
|
ignoreMethods: ['GET', 'HEAD', 'OPTIONS'],
|
|
14
14
|
};
|
|
15
|
+
// Global cleanup registry to avoid leaking intervals per middleware instance
|
|
16
|
+
// We use WeakRef so the manager (and middleware) can be garbage collected
|
|
17
|
+
// when no longer in use, even if this interval keeps running.
|
|
18
|
+
const canUseWeakRef = typeof WeakRef === 'function';
|
|
19
|
+
const managerRegistry = new Set();
|
|
20
|
+
let globalCleanupTimer = null;
|
|
21
|
+
const ensureCleanupTimer = () => {
|
|
22
|
+
if (globalCleanupTimer !== null)
|
|
23
|
+
return;
|
|
24
|
+
if (typeof setInterval !== 'function')
|
|
25
|
+
return;
|
|
26
|
+
if (globalThis.CF !== undefined)
|
|
27
|
+
return;
|
|
28
|
+
if (!canUseWeakRef)
|
|
29
|
+
return;
|
|
30
|
+
globalCleanupTimer = setInterval(() => {
|
|
31
|
+
if (managerRegistry.size === 0)
|
|
32
|
+
return;
|
|
33
|
+
for (const ref of managerRegistry) {
|
|
34
|
+
const mgr = ref.deref();
|
|
35
|
+
if (mgr) {
|
|
36
|
+
void mgr.cleanup().catch(() => undefined);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
managerRegistry.delete(ref);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}, 3600000);
|
|
43
|
+
// Use helper to handle runtime differences (Node vs others)
|
|
44
|
+
if (globalCleanupTimer !== null && isUnrefableTimer(globalCleanupTimer)) {
|
|
45
|
+
globalCleanupTimer.unref();
|
|
46
|
+
}
|
|
47
|
+
};
|
|
15
48
|
export const CsrfMiddleware = Object.freeze({
|
|
16
49
|
/**
|
|
17
50
|
* Create CSRF protection middleware
|
|
@@ -20,14 +53,10 @@ export const CsrfMiddleware = Object.freeze({
|
|
|
20
53
|
const config = { ...DEFAULT_OPTIONS, ...options };
|
|
21
54
|
const manager = CsrfTokenManager.create();
|
|
22
55
|
const sessions = SessionManager.create();
|
|
23
|
-
|
|
24
|
-
//
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}, 3600000);
|
|
28
|
-
// Node: allow process to exit; other runtimes may not support unref()
|
|
29
|
-
if (isUnrefableTimer(cleanupTimer)) {
|
|
30
|
-
cleanupTimer.unref();
|
|
56
|
+
ensureCleanupTimer();
|
|
57
|
+
// Register for global cleanup instead of creating a local timer
|
|
58
|
+
if (canUseWeakRef) {
|
|
59
|
+
managerRegistry.add(new WeakRef(manager));
|
|
31
60
|
}
|
|
32
61
|
return async (req, res, next) => {
|
|
33
62
|
if (shouldSkipCsrfForRequest(req, config)) {
|
|
@@ -42,7 +71,7 @@ export const CsrfMiddleware = Object.freeze({
|
|
|
42
71
|
const method = req.getMethod();
|
|
43
72
|
// 1. Token Generation (for safe methods)
|
|
44
73
|
if (config.ignoreMethods?.includes(method) ?? false) {
|
|
45
|
-
const token = manager.generateToken(sessionId);
|
|
74
|
+
const token = await manager.generateToken(sessionId);
|
|
46
75
|
// Set cookie for Double Submit Cookie pattern (readable by frontend)
|
|
47
76
|
appendSetCookie(res, `${config.cookieName}=${token}; Path=/; SameSite=Strict`);
|
|
48
77
|
// Also expose in locals for server-side rendering
|
|
@@ -55,7 +84,7 @@ export const CsrfMiddleware = Object.freeze({
|
|
|
55
84
|
const tokenFromBody = req.getBody()?.[config.bodyKey ?? '_csrf'];
|
|
56
85
|
const tokenFromCookie = cookies[config.cookieName ?? 'XSRF-TOKEN'];
|
|
57
86
|
const token = tokenFromHeader || tokenFromBody || tokenFromCookie;
|
|
58
|
-
if (!token || !manager.validateToken(sessionId, token)) {
|
|
87
|
+
if (!token || !(await manager.validateToken(sessionId, token))) {
|
|
59
88
|
Logger.warn(`CSRF validation failed for session ${sessionId}`);
|
|
60
89
|
res.setStatus(403);
|
|
61
90
|
res.json({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorHandlerMiddleware.d.ts","sourceRoot":"","sources":["../../../src/middleware/ErrorHandlerMiddleware.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAU9D,eAAO,MAAM,sBAAsB;cACvB,UAAU;
|
|
1
|
+
{"version":3,"file":"ErrorHandlerMiddleware.d.ts","sourceRoot":"","sources":["../../../src/middleware/ErrorHandlerMiddleware.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAU9D,eAAO,MAAM,sBAAsB;cACvB,UAAU;EAsCpB,CAAC;AAEH,eAAe,sBAAsB,CAAC"}
|
|
@@ -28,7 +28,8 @@ export const ErrorHandlerMiddleware = Object.freeze({
|
|
|
28
28
|
res.setStatus(500);
|
|
29
29
|
if (errorMode === 'html') {
|
|
30
30
|
// Use HTML error page instead of JSON
|
|
31
|
-
ErrorRouting.handleInternalServerErrorWithWrappers
|
|
31
|
+
const handleInternalServerErrorWithWrappers = ErrorRouting.handleInternalServerErrorWithWrappers;
|
|
32
|
+
await handleInternalServerErrorWithWrappers(req, res, error, requestId);
|
|
32
33
|
}
|
|
33
34
|
else {
|
|
34
35
|
res.json(ErrorResponse.internalServerError('Internal server error', requestId, includeStack ? error?.stack : undefined));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ErrorFactory } from '../exceptions/ZintrustError.js';
|
|
2
2
|
import * as path from '../node-singletons/path.js';
|
|
3
|
-
import { pathToFileURL } from 'node
|
|
3
|
+
import { pathToFileURL } from '../node-singletons/url.js';
|
|
4
4
|
function isFunction(value) {
|
|
5
5
|
return typeof value === 'function';
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaCompiler.d.ts","sourceRoot":"","sources":["../../../../src/migrations/schema/SchemaCompiler.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,gBAAgB,EAEhB,oBAAoB,EACpB,eAAe,EACf,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAIlC,KAAK,cAAc,GAAG;IACpB,UAAU,EAAE,gBAAgB,EAAE,CAAC;IAC/B,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,EAAE,eAAe,EAAE,CAAC;IACjC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,cAAc,EAAE,oBAAoB,EAAE,CAAC;IACvC,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B,CAAC;
|
|
1
|
+
{"version":3,"file":"SchemaCompiler.d.ts","sourceRoot":"","sources":["../../../../src/migrations/schema/SchemaCompiler.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,gBAAgB,EAEhB,oBAAoB,EACpB,eAAe,EACf,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAIlC,KAAK,cAAc,GAAG;IACpB,UAAU,EAAE,gBAAgB,EAAE,CAAC;IAC/B,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,EAAE,eAAe,EAAE,CAAC;IACjC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,cAAc,EAAE,oBAAoB,EAAE,CAAC;IACvC,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B,CAAC;AAqVF,eAAO,MAAM,uBAAuB;+BAExB,MAAM,OACT,eAAe,SACb;QAAE,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,GAC/B,MAAM,EAAE;6BAKc,MAAM,SAAS,MAAM,SAAS;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,MAAM;8BAK5D,MAAM,SAAS,MAAM,QAAQ,cAAc,GAAG,MAAM,EAAE;EAIhF,CAAC"}
|
|
@@ -90,7 +90,7 @@ function getAutoIncrementColumnSql(driver, colName, type) {
|
|
|
90
90
|
}
|
|
91
91
|
throw ErrorFactory.createValidationError(`Auto-increment not supported for driver: ${driver}`);
|
|
92
92
|
}
|
|
93
|
-
function formatDefaultValueSql(table, def) {
|
|
93
|
+
function formatDefaultValueSql(driver, table, def) {
|
|
94
94
|
if (def.defaultValue === undefined)
|
|
95
95
|
return null;
|
|
96
96
|
const dv = def.defaultValue;
|
|
@@ -98,8 +98,11 @@ function formatDefaultValueSql(table, def) {
|
|
|
98
98
|
return ColumnType.DEFAULT_NULL;
|
|
99
99
|
if (typeof dv === 'number' && Number.isFinite(dv))
|
|
100
100
|
return `DEFAULT ${dv}`;
|
|
101
|
-
if (typeof dv === 'boolean')
|
|
101
|
+
if (typeof dv === 'boolean') {
|
|
102
|
+
if (driver === AdaptersEnum.postgresql)
|
|
103
|
+
return `DEFAULT ${dv ? 'true' : 'false'}`;
|
|
102
104
|
return `DEFAULT ${dv ? 1 : 0}`;
|
|
105
|
+
}
|
|
103
106
|
if (typeof dv === 'string') {
|
|
104
107
|
if (dv === ColumnType.CURRENT_TIMESTAMP)
|
|
105
108
|
return `DEFAULT ${ColumnType.CURRENT_TIMESTAMP}`;
|
|
@@ -132,7 +135,7 @@ function buildColumnSql(driver, table, def) {
|
|
|
132
135
|
parts.push(ColumnType.UNIQUE);
|
|
133
136
|
if (def.primary === true)
|
|
134
137
|
parts.push(ColumnType.PRIMARY_KEY);
|
|
135
|
-
const defaultSql = formatDefaultValueSql(table, def);
|
|
138
|
+
const defaultSql = formatDefaultValueSql(driver, table, def);
|
|
136
139
|
if (defaultSql !== null)
|
|
137
140
|
parts.push(defaultSql);
|
|
138
141
|
return parts.join(' ');
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* Safe to import in both API and CLI code
|
|
4
4
|
* Exported from node:crypto built-in
|
|
5
5
|
*/
|
|
6
|
-
export { createCipheriv, createDecipheriv, createHash, createHmac, createSign, createVerify, generateKeyPairSync, pbkdf2, pbkdf2Sync, randomBytes, randomInt, scryptSync, timingSafeEqual, } from 'node:crypto';
|
|
6
|
+
export { createCipheriv, createDecipheriv, createHash, createHmac, createSign, createVerify, generateKeyPairSync, pbkdf2, pbkdf2Sync, randomBytes, randomInt, randomUUID, scryptSync, timingSafeEqual, } from 'node:crypto';
|
|
7
7
|
//# sourceMappingURL=crypto.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../../src/node-singletons/crypto.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,MAAM,EACN,UAAU,EACV,WAAW,EACX,SAAS,EACT,UAAU,EACV,eAAe,GAChB,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../../src/node-singletons/crypto.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,MAAM,EACN,UAAU,EACV,WAAW,EACX,SAAS,EACT,UAAU,EACV,UAAU,EACV,eAAe,GAChB,MAAM,aAAa,CAAC"}
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Safe to import in both API and CLI code
|
|
4
4
|
* Exported from node:crypto built-in
|
|
5
5
|
*/
|
|
6
|
-
export { createCipheriv, createDecipheriv, createHash, createHmac, createSign, createVerify, generateKeyPairSync, pbkdf2, pbkdf2Sync, randomBytes, randomInt, scryptSync, timingSafeEqual, } from 'node:crypto';
|
|
6
|
+
export { createCipheriv, createDecipheriv, createHash, createHmac, createSign, createVerify, generateKeyPairSync, pbkdf2, pbkdf2Sync, randomBytes, randomInt, randomUUID, scryptSync, timingSafeEqual, } from 'node:crypto';
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import * as fs from 'node:fs';
|
|
7
7
|
export * as fsPromises from 'node:fs/promises';
|
|
8
8
|
export { appendFileSync, copyFileSync, createReadStream, createWriteStream, existsSync, lstatSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, renameSync, rmSync, statSync, unlinkSync, utimesSync, writeFileSync, } from 'node:fs';
|
|
9
|
-
export type { ReadStream, Stats, WriteStream } from 'node:fs';
|
|
9
|
+
export type { PathLike, ReadStream, Stats, WriteStream, WriteStreamOptions } from 'node:fs';
|
|
10
10
|
export { mkdir, mkdtemp, readFile, realpath, rm, stat, writeFile } from 'node:fs/promises';
|
|
11
11
|
export default fs;
|
|
12
12
|
//# sourceMappingURL=fs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../../src/node-singletons/fs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAK9B,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EACL,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,SAAS,EACT,WAAW,EACX,WAAW,EACX,YAAY,EACZ,UAAU,EACV,MAAM,EACN,QAAQ,EACR,UAAU,EACV,UAAU,EACV,aAAa,GACd,MAAM,SAAS,CAAC;AAEjB,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../../src/node-singletons/fs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAK9B,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EACL,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,SAAS,EACT,WAAW,EACX,WAAW,EACX,YAAY,EACZ,UAAU,EACV,MAAM,EACN,QAAQ,EACR,UAAU,EACV,UAAU,EACV,aAAa,GACd,MAAM,SAAS,CAAC;AAEjB,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE5F,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAG3F,eAAe,EAAE,CAAC"}
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* Exported from node:path built-in
|
|
5
5
|
*/
|
|
6
6
|
import * as path from 'node:path';
|
|
7
|
-
export declare const basename: typeof path.basename, delimiter: ";" | ":", dirname: typeof path.dirname, extname: typeof path.extname, join: typeof path.join, relative: typeof path.relative, resolve: typeof path.resolve, sep: "/" | "\\";
|
|
7
|
+
export declare const basename: typeof path.basename, delimiter: ";" | ":", dirname: typeof path.dirname, extname: typeof path.extname, join: typeof path.join, relative: typeof path.relative, resolve: typeof path.resolve, sep: "/" | "\\", posix: typeof path, win32: typeof path;
|
|
8
8
|
export default path;
|
|
9
9
|
//# sourceMappingURL=path.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../src/node-singletons/path.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,eAAO,MAAQ,QAAQ,wBAAE,SAAS,aAAE,OAAO,uBAAE,OAAO,uBAAE,IAAI,oBAAE,QAAQ,wBAAE,OAAO,uBAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../src/node-singletons/path.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,eAAO,MAAQ,QAAQ,wBAAE,SAAS,aAAE,OAAO,uBAAE,OAAO,uBAAE,IAAI,oBAAE,QAAQ,wBAAE,OAAO,uBAAE,GAAG,cAAE,KAAK,eAAE,KAAK,aAC1F,CAAC;AAEP,eAAe,IAAI,CAAC"}
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* Exported from node:path built-in
|
|
5
5
|
*/
|
|
6
6
|
import * as path from 'node:path';
|
|
7
|
-
export const { basename, delimiter, dirname, extname, join, relative, resolve, sep } = path;
|
|
7
|
+
export const { basename, delimiter, dirname, extname, join, relative, resolve, sep, posix, win32 } = path;
|
|
8
8
|
export default path;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node.js Stream Module Singleton
|
|
3
|
+
* CLI-only: Should not be imported in API/serverless code
|
|
4
|
+
* Exported from node:stream built-in
|
|
5
|
+
*/
|
|
6
|
+
import * as stream from 'node:stream';
|
|
7
|
+
export declare const Readable: typeof stream.Readable, Writable: typeof stream.Writable, Duplex: typeof stream.Duplex, Transform: typeof stream.Transform, PassThrough: typeof stream.PassThrough, pipeline: typeof stream.pipeline, finished: typeof stream.finished;
|
|
8
|
+
export type { DuplexOptions, ReadableOptions, TransformOptions, WritableOptions, } from 'node:stream';
|
|
9
|
+
export type { ReadableStream, WritableStream } from 'node:stream/web';
|
|
10
|
+
export default stream;
|
|
11
|
+
//# sourceMappingURL=stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../src/node-singletons/stream.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,eAAO,MAAQ,QAAQ,0BAAE,QAAQ,0BAAE,MAAM,wBAAE,SAAS,2BAAE,WAAW,6BAAE,QAAQ,0BAAE,QAAQ,wBAAW,CAAC;AAEjG,YAAY,EACV,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,eAAe,GAChB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtE,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node.js Stream Module Singleton
|
|
3
|
+
* CLI-only: Should not be imported in API/serverless code
|
|
4
|
+
* Exported from node:stream built-in
|
|
5
|
+
*/
|
|
6
|
+
import * as stream from 'node:stream';
|
|
7
|
+
export const { Readable, Writable, Duplex, Transform, PassThrough, pipeline, finished } = stream;
|
|
8
|
+
export default stream;
|
|
@@ -46,6 +46,12 @@ export interface RecordDbQuerySpanInput {
|
|
|
46
46
|
driver: string;
|
|
47
47
|
durationMs: number;
|
|
48
48
|
}
|
|
49
|
+
export interface RecordQueueOperationSpanInput {
|
|
50
|
+
queueName: string;
|
|
51
|
+
operation: 'enqueue' | 'dequeue' | 'ack' | 'length' | 'drain';
|
|
52
|
+
durationMs: number;
|
|
53
|
+
status: 'ok' | 'error';
|
|
54
|
+
}
|
|
49
55
|
type HeaderGetter = {
|
|
50
56
|
getHeader(name: string): unknown;
|
|
51
57
|
};
|
|
@@ -57,6 +63,7 @@ export declare const OpenTelemetry: Readonly<{
|
|
|
57
63
|
endHttpServerSpan: (span: Span, input: EndHttpServerSpanInput) => void;
|
|
58
64
|
injectTraceHeaders: (headers: Record<string, string>) => Record<string, string>;
|
|
59
65
|
recordDbQuerySpan: (input: RecordDbQuerySpanInput) => void;
|
|
66
|
+
recordQueueOperationSpan: (input: RecordQueueOperationSpanInput) => void;
|
|
60
67
|
}>;
|
|
61
68
|
export default OpenTelemetry;
|
|
62
69
|
//# sourceMappingURL=OpenTelemetry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenTelemetry.d.ts","sourceRoot":"","sources":["../../../src/observability/OpenTelemetry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"OpenTelemetry.d.ts","sourceRoot":"","sources":["../../../src/observability/OpenTelemetry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAuFxD,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,6BAA6B;IAC5C,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,SAAS,GAAG,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC9D,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,IAAI,GAAG,OAAO,CAAC;CACxB;AAED,KAAK,YAAY,GAAG;IAClB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CAClC,CAAC;AAwMF,eAAO,MAAM,aAAa;qBAtMJ,OAAO;+BAyBK,YAAY,SAAS,wBAAwB,KAAG,WAAW;qBAyB/D,CAAC,OAAO,OAAO,MAAM,MAAM,OAAO,CAAC,CAAC,CAAC,KAAG,OAAO,CAAC,CAAC,CAAC;yBAKpD,IAAI,UAAU,MAAM,SAAS,MAAM,KAAG,IAAI;8BASrC,IAAI,SAAS,sBAAsB,KAAG,IAAI;kCA+BtC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;+BA2BlD,sBAAsB,KAAG,IAAI;sCAkCtB,6BAA6B,KAAG,IAAI;EAmD3E,CAAC;AAEH,eAAe,aAAa,CAAC"}
|
|
@@ -62,9 +62,9 @@ const fallbackPropagation = {
|
|
|
62
62
|
};
|
|
63
63
|
const fallbackTrace = {
|
|
64
64
|
getTracer: () => ({
|
|
65
|
-
startSpan: () => noopSpan,
|
|
65
|
+
startSpan: (_name, _options, _context) => noopSpan,
|
|
66
66
|
}),
|
|
67
|
-
getSpan: () => undefined,
|
|
67
|
+
getSpan: (_ctx) => undefined,
|
|
68
68
|
setSpan: (ctx) => ctx,
|
|
69
69
|
};
|
|
70
70
|
const fallbackSpanKind = {
|
|
@@ -75,6 +75,17 @@ const fallbackSpanStatusCode = {
|
|
|
75
75
|
OK: 1,
|
|
76
76
|
ERROR: 2,
|
|
77
77
|
};
|
|
78
|
+
const resolveSpanStatusCode = () => {
|
|
79
|
+
return otel()?.SpanStatusCode ?? fallbackSpanStatusCode;
|
|
80
|
+
};
|
|
81
|
+
const resolveTracingContext = () => {
|
|
82
|
+
const api = otel();
|
|
83
|
+
return {
|
|
84
|
+
traceApi: api?.trace ?? fallbackTrace,
|
|
85
|
+
activeContext: api?.context?.active() ?? fallbackContext.active(),
|
|
86
|
+
spanKind: api?.SpanKind ?? fallbackSpanKind,
|
|
87
|
+
};
|
|
88
|
+
};
|
|
78
89
|
const otel = () => resolveOpenTelemetryApi();
|
|
79
90
|
const isEnabled = () => {
|
|
80
91
|
return Env.getBool('OTEL_ENABLED', false);
|
|
@@ -210,6 +221,41 @@ const recordDbQuerySpan = (input) => {
|
|
|
210
221
|
// best-effort
|
|
211
222
|
}
|
|
212
223
|
};
|
|
224
|
+
const recordQueueOperationSpan = (input) => {
|
|
225
|
+
if (isEnabled() === false)
|
|
226
|
+
return;
|
|
227
|
+
try {
|
|
228
|
+
const tracing = resolveTracingContext();
|
|
229
|
+
const parentSpan = tracing.traceApi.getSpan(tracing.activeContext);
|
|
230
|
+
if (!parentSpan)
|
|
231
|
+
return;
|
|
232
|
+
const tracer = tracing.traceApi.getTracer('zintrust');
|
|
233
|
+
const now = Date.now();
|
|
234
|
+
const durationMs = Number.isFinite(input.durationMs) ? Math.max(0, input.durationMs) : 0;
|
|
235
|
+
const startTime = now - durationMs;
|
|
236
|
+
const span = tracer.startSpan(`queue.${input.operation}`, {
|
|
237
|
+
kind: tracing.spanKind.CLIENT,
|
|
238
|
+
startTime,
|
|
239
|
+
attributes: {
|
|
240
|
+
'messaging.system': 'zintrust-queue',
|
|
241
|
+
'messaging.operation': input.operation,
|
|
242
|
+
'messaging.destination': input.queueName,
|
|
243
|
+
'zintrust.queue.status': input.status,
|
|
244
|
+
},
|
|
245
|
+
}, tracing.activeContext);
|
|
246
|
+
const statusCode = resolveSpanStatusCode();
|
|
247
|
+
if (input.status === 'error') {
|
|
248
|
+
span.setStatus({ code: statusCode.ERROR });
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
span.setStatus({ code: statusCode.OK });
|
|
252
|
+
}
|
|
253
|
+
span.end(now);
|
|
254
|
+
}
|
|
255
|
+
catch {
|
|
256
|
+
// best-effort
|
|
257
|
+
}
|
|
258
|
+
};
|
|
213
259
|
export const OpenTelemetry = Object.freeze({
|
|
214
260
|
isEnabled,
|
|
215
261
|
startHttpServerSpan,
|
|
@@ -218,5 +264,6 @@ export const OpenTelemetry = Object.freeze({
|
|
|
218
264
|
endHttpServerSpan,
|
|
219
265
|
injectTraceHeaders,
|
|
220
266
|
recordDbQuerySpan,
|
|
267
|
+
recordQueueOperationSpan,
|
|
221
268
|
});
|
|
222
269
|
export default OpenTelemetry;
|
package/src/orm/Database.d.ts
CHANGED
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
import type { SupportedDriver } from '../migrations/enum';
|
|
6
6
|
import type { DatabaseConfig, IDatabaseAdapter, QueryResult } from './DatabaseAdapter';
|
|
7
7
|
import type { IQueryBuilder } from './QueryBuilder';
|
|
8
|
+
export type RawValue = {
|
|
9
|
+
__raw: string;
|
|
10
|
+
};
|
|
8
11
|
export interface IDatabase {
|
|
9
12
|
connect(): Promise<void>;
|
|
10
13
|
disconnect(): Promise<void>;
|
|
@@ -12,6 +15,7 @@ export interface IDatabase {
|
|
|
12
15
|
query(sql: string, parameters?: unknown[], isRead?: boolean): Promise<unknown[]>;
|
|
13
16
|
queryOne(sql: string, parameters?: unknown[], isRead?: boolean): Promise<unknown>;
|
|
14
17
|
execute(sql: string, parameters?: unknown[], isRead?: boolean): Promise<QueryResult>;
|
|
18
|
+
raw(value: string): RawValue;
|
|
15
19
|
transaction<T>(callback: (db: IDatabase) => Promise<T>): Promise<T>;
|
|
16
20
|
table(name: string): IQueryBuilder;
|
|
17
21
|
onBeforeQuery(handler: (query: string, params: unknown[]) => void): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Database.d.ts","sourceRoot":"","sources":["../../../src/orm/Database.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"Database.d.ts","sourceRoot":"","sources":["../../../src/orm/Database.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAUxD,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAE1F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGvD,MAAM,MAAM,QAAQ,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzC,MAAM,WAAW,SAAS;IACxB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,WAAW,IAAI,OAAO,CAAC;IACvB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,OAAO,EAAE,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IACjF,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,OAAO,EAAE,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAClF,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,OAAO,EAAE,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACrF,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC7B,WAAW,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACpE,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC;IACnC,aAAa,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,IAAI,GAAG,IAAI,CAAC;IACzE,YAAY,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAAC;IAC1F,cAAc,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,IAAI,GAAG,IAAI,CAAC;IAC1E,aAAa,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAAC;IAC3F,kBAAkB,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,gBAAgB,CAAC;IACvD,OAAO,IAAI,eAAe,CAAC;IAC3B,SAAS,IAAI,cAAc,CAAC;IAC5B,OAAO,IAAI,IAAI,CAAC;CACjB;AA2eD,eAAO,MAAM,QAAQ;IACnB;;OAEG;oBACa,cAAc,GAAG,SAAS;EAI1C,CAAC;AAIH,eAAO,MAAM,oBAAoB,GAC/B,SAAQ,cAAc,GAAG,SAAqB,EAC9C,uBAA0B,KACzB,OAAO,CAAC,UAAU,CAAC,OAAO,WAAW,CAAC,CAMxC,CAAC;AAEF,wBAAgB,WAAW,CAAC,MAAM,CAAC,EAAE,cAAc,EAAE,UAAU,SAAY,GAAG,SAAS,CAoBtF;AAED,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAWnD"}
|