@zintrust/core 0.1.41 → 0.1.43
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/app/Controllers/AuthController.d.ts +10 -0
- package/app/Controllers/AuthController.d.ts.map +1 -0
- package/app/Controllers/AuthController.js +201 -0
- package/app/Controllers/UserController.d.ts +9 -0
- package/app/Controllers/UserController.d.ts.map +1 -0
- package/app/Controllers/UserController.js +8 -0
- package/app/Controllers/UserQueryBuilderController.d.ts +16 -0
- package/app/Controllers/UserQueryBuilderController.d.ts.map +1 -0
- package/app/Controllers/UserQueryBuilderController.js +404 -0
- package/app/Middleware/ProfilerMiddleware.d.ts +12 -0
- package/app/Middleware/ProfilerMiddleware.d.ts.map +1 -0
- package/app/Middleware/ProfilerMiddleware.js +47 -0
- package/app/Middleware/index.d.ts +59 -0
- package/app/Middleware/index.d.ts.map +1 -0
- package/app/Middleware/index.js +215 -0
- package/app/Models/Post.d.ts +14 -0
- package/app/Models/Post.d.ts.map +1 -0
- package/app/Models/Post.js +27 -0
- package/app/Models/User.d.ts +14 -0
- package/app/Models/User.d.ts.map +1 -0
- package/app/Models/User.js +44 -0
- package/app/Schedules/JobTracking.d.ts +3 -0
- package/app/Schedules/JobTracking.d.ts.map +1 -0
- package/app/Schedules/JobTracking.js +13 -0
- package/app/Schedules/index.d.ts +2 -0
- package/app/Schedules/index.d.ts.map +1 -0
- package/app/Schedules/index.js +1 -0
- package/app/Toolkit/Broadcast/sendBroadcast.d.ts +6 -0
- package/app/Toolkit/Broadcast/sendBroadcast.d.ts.map +1 -0
- package/app/Toolkit/Broadcast/sendBroadcast.js +5 -0
- package/app/Toolkit/Mail/sendWelcomeEmail.d.ts +6 -0
- package/app/Toolkit/Mail/sendWelcomeEmail.d.ts.map +1 -0
- package/app/Toolkit/Mail/sendWelcomeEmail.js +20 -0
- package/app/Toolkit/Notification/sendSlackNotification.d.ts +8 -0
- package/app/Toolkit/Notification/sendSlackNotification.d.ts.map +1 -0
- package/app/Toolkit/Notification/sendSlackNotification.js +5 -0
- package/app/Toolkit/Notification/sendSms.d.ts +6 -0
- package/app/Toolkit/Notification/sendSms.d.ts.map +1 -0
- package/app/Toolkit/Notification/sendSms.js +5 -0
- package/app/Types/controller.d.ts +42 -0
- package/app/Types/controller.d.ts.map +1 -0
- package/app/Types/controller.js +1 -0
- package/config/broadcast.d.ts +38 -0
- package/config/broadcast.d.ts.map +1 -0
- package/config/broadcast.js +37 -0
- package/config/cache.d.ts +40 -0
- package/config/cache.d.ts.map +1 -0
- package/config/cache.js +39 -0
- package/config/database.d.ts +58 -0
- package/config/database.d.ts.map +1 -0
- package/config/database.js +65 -0
- package/config/mail.d.ts +51 -0
- package/config/mail.d.ts.map +1 -0
- package/config/mail.js +69 -0
- package/config/middleware.d.ts +11 -0
- package/config/middleware.d.ts.map +1 -0
- package/config/middleware.js +30 -0
- package/config/notification.d.ts +33 -0
- package/config/notification.d.ts.map +1 -0
- package/config/notification.js +33 -0
- package/config/queue.d.ts +55 -0
- package/config/queue.d.ts.map +1 -0
- package/config/queue.js +87 -0
- package/config/storage.d.ts +59 -0
- package/config/storage.d.ts.map +1 -0
- package/config/storage.js +59 -0
- package/config/workers.d.ts +54 -0
- package/config/workers.d.ts.map +1 -0
- package/config/workers.js +83 -0
- package/package.json +27 -5
- package/packages/cloudflare-d1-proxy/src/index.d.ts +48 -0
- package/packages/cloudflare-d1-proxy/src/index.d.ts.map +1 -0
- package/packages/cloudflare-d1-proxy/src/index.js +387 -0
- package/packages/cloudflare-kv-proxy/src/index.d.ts +44 -0
- package/packages/cloudflare-kv-proxy/src/index.d.ts.map +1 -0
- package/packages/cloudflare-kv-proxy/src/index.js +325 -0
- package/packages/queue-monitor/src/QueueMonitoringService.d.ts +35 -0
- package/packages/queue-monitor/src/QueueMonitoringService.d.ts.map +1 -0
- package/packages/queue-monitor/src/QueueMonitoringService.js +194 -0
- package/packages/queue-monitor/src/connection.d.ts +3 -0
- package/packages/queue-monitor/src/connection.d.ts.map +1 -0
- package/packages/queue-monitor/src/connection.js +1 -0
- package/packages/queue-monitor/src/dashboard-ui.d.ts +7 -0
- package/packages/queue-monitor/src/dashboard-ui.d.ts.map +1 -0
- package/packages/queue-monitor/src/dashboard-ui.js +997 -0
- package/packages/queue-monitor/src/driver.d.ts +15 -0
- package/packages/queue-monitor/src/driver.d.ts.map +1 -0
- package/packages/queue-monitor/src/driver.js +115 -0
- package/packages/queue-monitor/src/index.d.ts +71 -0
- package/packages/queue-monitor/src/index.d.ts.map +1 -0
- package/packages/queue-monitor/src/index.js +296 -0
- package/packages/queue-monitor/src/metrics.d.ts +27 -0
- package/packages/queue-monitor/src/metrics.d.ts.map +1 -0
- package/packages/queue-monitor/src/metrics.js +92 -0
- package/packages/queue-monitor/src/worker.d.ts +8 -0
- package/packages/queue-monitor/src/worker.d.ts.map +1 -0
- package/packages/queue-monitor/src/worker.js +35 -0
- package/packages/queue-redis/src/BullMQRedisQueue.d.ts +26 -0
- package/packages/queue-redis/src/BullMQRedisQueue.d.ts.map +1 -0
- package/packages/queue-redis/src/BullMQRedisQueue.js +463 -0
- package/packages/queue-redis/src/HttpQueueDriver.d.ts +18 -0
- package/packages/queue-redis/src/HttpQueueDriver.d.ts.map +1 -0
- package/packages/queue-redis/src/HttpQueueDriver.js +249 -0
- package/packages/queue-redis/src/QueueHttpGateway.d.ts +16 -0
- package/packages/queue-redis/src/QueueHttpGateway.d.ts.map +1 -0
- package/packages/queue-redis/src/QueueHttpGateway.js +217 -0
- package/packages/queue-redis/src/RedisPublishClient.d.ts +14 -0
- package/packages/queue-redis/src/RedisPublishClient.d.ts.map +1 -0
- package/packages/queue-redis/src/RedisPublishClient.js +251 -0
- package/packages/queue-redis/src/index.d.ts +12 -0
- package/packages/queue-redis/src/index.d.ts.map +1 -0
- package/packages/queue-redis/src/index.js +10 -0
- package/packages/queue-redis/src/register.d.ts +6 -0
- package/packages/queue-redis/src/register.d.ts.map +1 -0
- package/packages/queue-redis/src/register.js +21 -0
- package/packages/workers/migrations/20260119100000_create_zintrust_workers_table.d.ts +11 -0
- package/packages/workers/migrations/20260119100000_create_zintrust_workers_table.d.ts.map +1 -0
- package/packages/workers/migrations/20260119100000_create_zintrust_workers_table.js +32 -0
- package/packages/workers/migrations/20260123180000_create_queue_jobs_table.d.ts +11 -0
- package/packages/workers/migrations/20260123180000_create_queue_jobs_table.d.ts.map +1 -0
- package/packages/workers/migrations/20260123180000_create_queue_jobs_table.js +46 -0
- package/packages/workers/migrations/20260213142000_create_zintrust_job_tracking_tables.d.ts +7 -0
- package/packages/workers/migrations/20260213142000_create_zintrust_job_tracking_tables.d.ts.map +1 -0
- package/packages/workers/migrations/20260213142000_create_zintrust_job_tracking_tables.js +44 -0
- package/packages/workers/migrations/20260213183000_expand_zintrust_job_tracking_reliability_tables.d.ts +7 -0
- package/packages/workers/migrations/20260213183000_expand_zintrust_job_tracking_reliability_tables.d.ts.map +1 -0
- package/packages/workers/migrations/20260213183000_expand_zintrust_job_tracking_reliability_tables.js +104 -0
- package/packages/workers/src/AnomalyDetection.d.ts +107 -0
- package/packages/workers/src/AnomalyDetection.d.ts.map +1 -0
- package/packages/workers/src/AnomalyDetection.js +329 -0
- package/packages/workers/src/AutoScaler.d.ts +128 -0
- package/packages/workers/src/AutoScaler.d.ts.map +1 -0
- package/packages/workers/src/AutoScaler.js +425 -0
- package/packages/workers/src/BroadcastWorker.d.ts +24 -0
- package/packages/workers/src/BroadcastWorker.d.ts.map +1 -0
- package/packages/workers/src/BroadcastWorker.js +24 -0
- package/packages/workers/src/CanaryController.d.ts +104 -0
- package/packages/workers/src/CanaryController.d.ts.map +1 -0
- package/packages/workers/src/CanaryController.js +424 -0
- package/packages/workers/src/ChaosEngineering.d.ts +80 -0
- package/packages/workers/src/ChaosEngineering.d.ts.map +1 -0
- package/packages/workers/src/ChaosEngineering.js +229 -0
- package/packages/workers/src/CircuitBreaker.d.ts +107 -0
- package/packages/workers/src/CircuitBreaker.d.ts.map +1 -0
- package/packages/workers/src/CircuitBreaker.js +374 -0
- package/packages/workers/src/ClusterLock.d.ts +91 -0
- package/packages/workers/src/ClusterLock.d.ts.map +1 -0
- package/packages/workers/src/ClusterLock.js +397 -0
- package/packages/workers/src/ComplianceManager.d.ts +178 -0
- package/packages/workers/src/ComplianceManager.d.ts.map +1 -0
- package/packages/workers/src/ComplianceManager.js +556 -0
- package/packages/workers/src/DatacenterOrchestrator.d.ts +134 -0
- package/packages/workers/src/DatacenterOrchestrator.d.ts.map +1 -0
- package/packages/workers/src/DatacenterOrchestrator.js +404 -0
- package/packages/workers/src/DeadLetterQueue.d.ts +123 -0
- package/packages/workers/src/DeadLetterQueue.d.ts.map +1 -0
- package/packages/workers/src/DeadLetterQueue.js +544 -0
- package/packages/workers/src/HealthMonitor.d.ts +43 -0
- package/packages/workers/src/HealthMonitor.d.ts.map +1 -0
- package/packages/workers/src/HealthMonitor.js +312 -0
- package/packages/workers/src/MultiQueueWorker.d.ts +90 -0
- package/packages/workers/src/MultiQueueWorker.d.ts.map +1 -0
- package/packages/workers/src/MultiQueueWorker.js +282 -0
- package/packages/workers/src/NotificationWorker.d.ts +24 -0
- package/packages/workers/src/NotificationWorker.d.ts.map +1 -0
- package/packages/workers/src/NotificationWorker.js +23 -0
- package/packages/workers/src/Observability.d.ts +154 -0
- package/packages/workers/src/Observability.d.ts.map +1 -0
- package/packages/workers/src/Observability.js +538 -0
- package/packages/workers/src/PluginManager.d.ts +124 -0
- package/packages/workers/src/PluginManager.d.ts.map +1 -0
- package/packages/workers/src/PluginManager.js +392 -0
- package/packages/workers/src/PriorityQueue.d.ts +118 -0
- package/packages/workers/src/PriorityQueue.d.ts.map +1 -0
- package/packages/workers/src/PriorityQueue.js +276 -0
- package/packages/workers/src/ResourceMonitor.d.ts +165 -0
- package/packages/workers/src/ResourceMonitor.d.ts.map +1 -0
- package/packages/workers/src/ResourceMonitor.js +632 -0
- package/packages/workers/src/SLAMonitor.d.ts +111 -0
- package/packages/workers/src/SLAMonitor.d.ts.map +1 -0
- package/packages/workers/src/SLAMonitor.js +274 -0
- package/packages/workers/src/WorkerFactory.d.ts +218 -0
- package/packages/workers/src/WorkerFactory.d.ts.map +1 -0
- package/packages/workers/src/WorkerFactory.js +2253 -0
- package/packages/workers/src/WorkerInit.d.ts +86 -0
- package/packages/workers/src/WorkerInit.d.ts.map +1 -0
- package/packages/workers/src/WorkerInit.js +307 -0
- package/packages/workers/src/WorkerMetrics.d.ts +116 -0
- package/packages/workers/src/WorkerMetrics.d.ts.map +1 -0
- package/packages/workers/src/WorkerMetrics.js +570 -0
- package/packages/workers/src/WorkerRegistry.d.ts +152 -0
- package/packages/workers/src/WorkerRegistry.d.ts.map +1 -0
- package/packages/workers/src/WorkerRegistry.js +396 -0
- package/packages/workers/src/WorkerShutdown.d.ts +70 -0
- package/packages/workers/src/WorkerShutdown.d.ts.map +1 -0
- package/packages/workers/src/WorkerShutdown.js +185 -0
- package/packages/workers/src/WorkerVersioning.d.ts +108 -0
- package/packages/workers/src/WorkerVersioning.d.ts.map +1 -0
- package/packages/workers/src/WorkerVersioning.js +300 -0
- package/packages/workers/src/config/workerConfig.d.ts +5 -0
- package/packages/workers/src/config/workerConfig.d.ts.map +1 -0
- package/packages/workers/src/config/workerConfig.js +25 -0
- package/packages/workers/src/createQueueWorker.d.ts +26 -0
- package/packages/workers/src/createQueueWorker.d.ts.map +1 -0
- package/packages/workers/src/createQueueWorker.js +367 -0
- package/packages/workers/src/dashboard/index.d.ts +2 -0
- package/packages/workers/src/dashboard/index.d.ts.map +1 -0
- package/packages/workers/src/dashboard/index.js +1 -0
- package/packages/workers/src/dashboard/types.d.ts +123 -0
- package/packages/workers/src/dashboard/types.d.ts.map +1 -0
- package/packages/workers/src/dashboard/types.js +1 -0
- package/packages/workers/src/dashboard/workers-api.d.ts +5 -0
- package/packages/workers/src/dashboard/workers-api.d.ts.map +1 -0
- package/packages/workers/src/dashboard/workers-api.js +738 -0
- package/packages/workers/src/helper/index.d.ts +6 -0
- package/packages/workers/src/helper/index.d.ts.map +1 -0
- package/packages/workers/src/helper/index.js +10 -0
- package/packages/workers/src/http/WorkerApiController.d.ts +39 -0
- package/packages/workers/src/http/WorkerApiController.d.ts.map +1 -0
- package/packages/workers/src/http/WorkerApiController.js +313 -0
- package/packages/workers/src/http/WorkerController.d.ts +375 -0
- package/packages/workers/src/http/WorkerController.d.ts.map +1 -0
- package/packages/workers/src/http/WorkerController.js +1454 -0
- package/packages/workers/src/http/WorkerMonitoringService.d.ts +12 -0
- package/packages/workers/src/http/WorkerMonitoringService.d.ts.map +1 -0
- package/packages/workers/src/http/WorkerMonitoringService.js +89 -0
- package/packages/workers/src/http/middleware/CustomValidation.d.ts +93 -0
- package/packages/workers/src/http/middleware/CustomValidation.d.ts.map +1 -0
- package/packages/workers/src/http/middleware/CustomValidation.js +270 -0
- package/packages/workers/src/http/middleware/DatacenterValidator.d.ts +4 -0
- package/packages/workers/src/http/middleware/DatacenterValidator.d.ts.map +1 -0
- package/packages/workers/src/http/middleware/DatacenterValidator.js +94 -0
- package/packages/workers/src/http/middleware/EditWorkerValidation.d.ts +8 -0
- package/packages/workers/src/http/middleware/EditWorkerValidation.d.ts.map +1 -0
- package/packages/workers/src/http/middleware/EditWorkerValidation.js +56 -0
- package/packages/workers/src/http/middleware/FeaturesValidator.d.ts +4 -0
- package/packages/workers/src/http/middleware/FeaturesValidator.d.ts.map +1 -0
- package/packages/workers/src/http/middleware/FeaturesValidator.js +60 -0
- package/packages/workers/src/http/middleware/InfrastructureValidator.d.ts +32 -0
- package/packages/workers/src/http/middleware/InfrastructureValidator.d.ts.map +1 -0
- package/packages/workers/src/http/middleware/InfrastructureValidator.js +226 -0
- package/packages/workers/src/http/middleware/OptionsValidator.d.ts +4 -0
- package/packages/workers/src/http/middleware/OptionsValidator.d.ts.map +1 -0
- package/packages/workers/src/http/middleware/OptionsValidator.js +112 -0
- package/packages/workers/src/http/middleware/PayloadSanitizer.d.ts +8 -0
- package/packages/workers/src/http/middleware/PayloadSanitizer.d.ts.map +1 -0
- package/packages/workers/src/http/middleware/PayloadSanitizer.js +42 -0
- package/packages/workers/src/http/middleware/ProcessorPathSanitizer.d.ts +4 -0
- package/packages/workers/src/http/middleware/ProcessorPathSanitizer.d.ts.map +1 -0
- package/packages/workers/src/http/middleware/ProcessorPathSanitizer.js +140 -0
- package/packages/workers/src/http/middleware/QueueNameSanitizer.d.ts +4 -0
- package/packages/workers/src/http/middleware/QueueNameSanitizer.d.ts.map +1 -0
- package/packages/workers/src/http/middleware/QueueNameSanitizer.js +45 -0
- package/packages/workers/src/http/middleware/ValidateDriver.d.ts +8 -0
- package/packages/workers/src/http/middleware/ValidateDriver.d.ts.map +1 -0
- package/packages/workers/src/http/middleware/ValidateDriver.js +20 -0
- package/packages/workers/src/http/middleware/VersionSanitizer.d.ts +4 -0
- package/packages/workers/src/http/middleware/VersionSanitizer.d.ts.map +1 -0
- package/packages/workers/src/http/middleware/VersionSanitizer.js +25 -0
- package/packages/workers/src/http/middleware/WorkerNameSanitizer.d.ts +4 -0
- package/packages/workers/src/http/middleware/WorkerNameSanitizer.d.ts.map +1 -0
- package/packages/workers/src/http/middleware/WorkerNameSanitizer.js +46 -0
- package/packages/workers/src/http/middleware/WorkerValidationChain.d.ts +28 -0
- package/packages/workers/src/http/middleware/WorkerValidationChain.d.ts.map +1 -0
- package/packages/workers/src/http/middleware/WorkerValidationChain.js +186 -0
- package/packages/workers/src/index.d.ts +47 -0
- package/packages/workers/src/index.d.ts.map +1 -0
- package/packages/workers/src/index.js +48 -0
- package/packages/workers/src/routes/workers.d.ts +13 -0
- package/packages/workers/src/routes/workers.d.ts.map +1 -0
- package/packages/workers/src/routes/workers.js +126 -0
- package/packages/workers/src/storage/WorkerStore.d.ts +52 -0
- package/packages/workers/src/storage/WorkerStore.d.ts.map +1 -0
- package/packages/workers/src/storage/WorkerStore.js +259 -0
- package/packages/workers/src/telemetry/api/TelemetryAPI.d.ts +47 -0
- package/packages/workers/src/telemetry/api/TelemetryAPI.d.ts.map +1 -0
- package/packages/workers/src/telemetry/api/TelemetryAPI.js +219 -0
- package/packages/workers/src/telemetry/api/TelemetryMonitoringService.d.ts +18 -0
- package/packages/workers/src/telemetry/api/TelemetryMonitoringService.d.ts.map +1 -0
- package/packages/workers/src/telemetry/api/TelemetryMonitoringService.js +140 -0
- package/packages/workers/src/telemetry/components/AlertPanel.d.ts +2 -0
- package/packages/workers/src/telemetry/components/AlertPanel.d.ts.map +1 -0
- package/packages/workers/src/telemetry/components/AlertPanel.js +13 -0
- package/packages/workers/src/telemetry/components/CostTracking.d.ts +2 -0
- package/packages/workers/src/telemetry/components/CostTracking.d.ts.map +1 -0
- package/packages/workers/src/telemetry/components/CostTracking.js +14 -0
- package/packages/workers/src/telemetry/components/ResourceUsageChart.d.ts +2 -0
- package/packages/workers/src/telemetry/components/ResourceUsageChart.d.ts.map +1 -0
- package/packages/workers/src/telemetry/components/ResourceUsageChart.js +11 -0
- package/packages/workers/src/telemetry/components/WorkerHealthChart.d.ts +2 -0
- package/packages/workers/src/telemetry/components/WorkerHealthChart.d.ts.map +1 -0
- package/packages/workers/src/telemetry/components/WorkerHealthChart.js +11 -0
- package/packages/workers/src/telemetry/index.d.ts +16 -0
- package/packages/workers/src/telemetry/index.d.ts.map +1 -0
- package/packages/workers/src/telemetry/index.js +60 -0
- package/packages/workers/src/telemetry/routes/dashboard.d.ts +7 -0
- package/packages/workers/src/telemetry/routes/dashboard.d.ts.map +1 -0
- package/packages/workers/src/telemetry/routes/dashboard.js +608 -0
- package/packages/workers/src/type.d.ts +77 -0
- package/packages/workers/src/type.d.ts.map +1 -0
- package/packages/workers/src/type.js +1 -0
- package/packages/workers/src/ui/router/EmbeddedAssets.d.ts +5 -0
- package/packages/workers/src/ui/router/EmbeddedAssets.d.ts.map +1 -0
- package/packages/workers/src/ui/router/EmbeddedAssets.js +13 -0
- package/packages/workers/src/ui/router/ui.d.ts +4 -0
- package/packages/workers/src/ui/router/ui.d.ts.map +1 -0
- package/packages/workers/src/ui/router/ui.js +208 -0
- package/packages/workers/src/ui/types/worker-ui.d.ts +230 -0
- package/packages/workers/src/ui/types/worker-ui.d.ts.map +1 -0
- package/packages/workers/src/ui/types/worker-ui.js +5 -0
- package/routes/api.d.ts +7 -0
- package/routes/api.d.ts.map +1 -0
- package/routes/api.js +129 -0
- package/routes/broadcast.d.ts +9 -0
- package/routes/broadcast.d.ts.map +1 -0
- package/routes/broadcast.js +27 -0
- package/routes/storage.d.ts +4 -0
- package/routes/storage.d.ts.map +1 -0
- package/routes/storage.js +35 -0
- package/src/boot/bootstrap.js +27 -11
- package/src/boot/registry/runtime.d.ts.map +1 -1
- package/src/boot/registry/runtime.js +11 -0
- package/src/cache/Cache.d.ts.map +1 -1
- package/src/cache/Cache.js +40 -8
- package/src/cache/drivers/KVRemoteDriver.d.ts +1 -1
- package/src/cache/drivers/KVRemoteDriver.d.ts.map +1 -1
- package/src/cache/drivers/KVRemoteDriver.js +259 -44
- package/src/cache/drivers/MemoryDriver.d.ts.map +1 -1
- package/src/cache/drivers/MemoryDriver.js +10 -2
- package/src/cache/drivers/RedisDriver.d.ts.map +1 -1
- package/src/cache/drivers/RedisDriver.js +256 -33
- package/src/cli/CLI.d.ts.map +1 -1
- package/src/cli/CLI.js +12 -0
- package/src/cli/commands/ConfigCommand.d.ts.map +1 -1
- package/src/cli/commands/ConfigCommand.js +3 -5
- package/src/cli/commands/D1LearnCommand.d.ts +9 -0
- package/src/cli/commands/D1LearnCommand.d.ts.map +1 -0
- package/src/cli/commands/D1LearnCommand.js +143 -0
- package/src/cli/commands/D1MigrateCommand.d.ts.map +1 -1
- package/src/cli/commands/D1MigrateCommand.js +55 -16
- package/src/cli/commands/InitContainerCommand.d.ts.map +1 -1
- package/src/cli/commands/InitContainerCommand.js +30 -15
- package/src/cli/commands/InitEcosystemCommand.d.ts +6 -0
- package/src/cli/commands/InitEcosystemCommand.d.ts.map +1 -0
- package/src/cli/commands/InitEcosystemCommand.js +51 -0
- package/src/cli/commands/MigrateCommand.d.ts.map +1 -1
- package/src/cli/commands/MigrateCommand.js +78 -36
- package/src/cli/commands/MigrateWorkerCommand.d.ts.map +1 -1
- package/src/cli/commands/MigrateWorkerCommand.js +36 -2
- package/src/cli/commands/NewCommand.d.ts.map +1 -1
- package/src/cli/commands/NewCommand.js +33 -0
- package/src/cli/commands/PutCommand.d.ts +6 -0
- package/src/cli/commands/PutCommand.d.ts.map +1 -0
- package/src/cli/commands/PutCommand.js +173 -0
- package/src/cli/commands/QueueRecoveryCommand.d.ts.map +1 -1
- package/src/cli/commands/QueueRecoveryCommand.js +113 -14
- package/src/cli/commands/ScheduleListCommand.d.ts +6 -0
- package/src/cli/commands/ScheduleListCommand.d.ts.map +1 -0
- package/src/cli/commands/ScheduleListCommand.js +62 -0
- package/src/cli/commands/ScheduleRunCommand.d.ts +6 -0
- package/src/cli/commands/ScheduleRunCommand.d.ts.map +1 -0
- package/src/cli/commands/ScheduleRunCommand.js +32 -0
- package/src/cli/commands/ScheduleStartCommand.d.ts +6 -0
- package/src/cli/commands/ScheduleStartCommand.d.ts.map +1 -0
- package/src/cli/commands/ScheduleStartCommand.js +40 -0
- package/src/cli/commands/SecretsCommand.d.ts.map +1 -1
- package/src/cli/commands/SecretsCommand.js +2 -2
- package/src/cli/commands/StartCommand.d.ts.map +1 -1
- package/src/cli/commands/StartCommand.js +23 -1
- package/src/cli/commands/schedule/ScheduleCliSupport.d.ts +6 -0
- package/src/cli/commands/schedule/ScheduleCliSupport.d.ts.map +1 -0
- package/src/cli/commands/schedule/ScheduleCliSupport.js +55 -0
- package/src/cli/config/ConfigManager.d.ts.map +1 -1
- package/src/cli/config/ConfigManager.js +8 -1
- package/src/cli/d1/D1SqlMigrations.d.ts.map +1 -1
- package/src/cli/d1/D1SqlMigrations.js +11 -1
- package/src/cli/d1/WranglerConfig.d.ts.map +1 -1
- package/src/cli/d1/WranglerConfig.js +34 -2
- package/src/cli/scaffolding/ProjectScaffolder.d.ts.map +1 -1
- package/src/cli/scaffolding/ProjectScaffolder.js +65 -73
- package/src/cli/services/VersionChecker.d.ts.map +1 -1
- package/src/cli/services/VersionChecker.js +5 -1
- package/src/cli/utils/DatabaseCliUtils.d.ts.map +1 -1
- package/src/cli/utils/DatabaseCliUtils.js +6 -1
- package/src/cli/utils/DistPackager.d.ts.map +1 -1
- package/src/cli/utils/DistPackager.js +25 -0
- package/src/cli/utils/EnvFileLoader.d.ts +1 -0
- package/src/cli/utils/EnvFileLoader.d.ts.map +1 -1
- package/src/cli/utils/EnvFileLoader.js +47 -14
- package/src/cli.d.ts +5 -0
- package/src/cli.d.ts.map +1 -0
- package/src/cli.js +4 -0
- package/src/collections/index.d.ts +2 -2
- package/src/collections/index.d.ts.map +1 -1
- package/src/collections/index.js +1 -1
- package/src/common/RemoteSignedJson.d.ts.map +1 -1
- package/src/common/RemoteSignedJson.js +58 -25
- package/src/common/utility.d.ts.map +1 -1
- package/src/common/utility.js +2 -6
- package/src/config/cache.js +1 -1
- package/src/config/cloudflare.d.ts.map +1 -1
- package/src/config/cloudflare.js +19 -8
- package/src/config/env.d.ts +7 -0
- package/src/config/env.d.ts.map +1 -1
- package/src/config/env.js +10 -2
- package/src/config/queue.js +1 -1
- package/src/functions/cloudflare.d.ts.map +1 -1
- package/src/functions/cloudflare.js +4 -2
- package/src/helper/index.d.ts +225 -0
- package/src/helper/index.d.ts.map +1 -0
- package/src/helper/index.js +347 -0
- package/src/index.d.ts +3 -6
- package/src/index.d.ts.map +1 -1
- package/src/index.js +7 -9
- package/src/middleware/JwtAuthMiddleware.d.ts.map +1 -1
- package/src/middleware/JwtAuthMiddleware.js +11 -5
- package/src/migrations/MigrationDiscovery.d.ts.map +1 -1
- package/src/migrations/MigrationDiscovery.js +2 -1
- package/src/orm/DatabaseAdapter.d.ts +1 -0
- package/src/orm/DatabaseAdapter.d.ts.map +1 -1
- package/src/orm/SchemaStatemenWriter.d.ts +15 -0
- package/src/orm/SchemaStatemenWriter.d.ts.map +1 -0
- package/src/orm/SchemaStatemenWriter.js +78 -0
- package/src/orm/adapters/D1Adapter.d.ts.map +1 -1
- package/src/orm/adapters/D1Adapter.js +52 -2
- package/src/orm/adapters/D1RemoteAdapter.d.ts.map +1 -1
- package/src/orm/adapters/D1RemoteAdapter.js +137 -89
- package/src/orm/adapters/MySQLProxyAdapter.d.ts.map +1 -1
- package/src/orm/adapters/MySQLProxyAdapter.js +100 -81
- package/src/orm/adapters/PostgreSQLProxyAdapter.d.ts.map +1 -1
- package/src/orm/adapters/PostgreSQLProxyAdapter.js +26 -10
- package/src/orm/adapters/SqlProxyAdapterUtils.d.ts.map +1 -1
- package/src/orm/adapters/SqlProxyAdapterUtils.js +2 -1
- package/src/orm/adapters/SqlProxyRegistryMode.d.ts +12 -0
- package/src/orm/adapters/SqlProxyRegistryMode.d.ts.map +1 -0
- package/src/orm/adapters/SqlProxyRegistryMode.js +24 -0
- package/src/orm/adapters/SqlServerProxyAdapter.d.ts +3 -0
- package/src/orm/adapters/SqlServerProxyAdapter.d.ts.map +1 -1
- package/src/orm/adapters/SqlServerProxyAdapter.js +125 -117
- package/src/orm/migrations/MigrationStore.js +1 -1
- package/src/proxy/ProxyRequestParsing.d.ts +9 -0
- package/src/proxy/ProxyRequestParsing.d.ts.map +1 -0
- package/src/proxy/ProxyRequestParsing.js +16 -0
- package/src/proxy/RequestValidator.d.ts.map +1 -1
- package/src/proxy/RequestValidator.js +2 -1
- package/src/proxy/SigningService.js +2 -2
- package/src/proxy/SqlProxyDbOverrides.d.ts +17 -0
- package/src/proxy/SqlProxyDbOverrides.d.ts.map +1 -0
- package/src/proxy/SqlProxyDbOverrides.js +1 -0
- package/src/proxy/SqlProxyServerDeps.d.ts +12 -0
- package/src/proxy/SqlProxyServerDeps.d.ts.map +1 -0
- package/src/proxy/SqlProxyServerDeps.js +9 -0
- package/src/proxy/StatementPayloadValidator.d.ts +13 -0
- package/src/proxy/StatementPayloadValidator.d.ts.map +1 -0
- package/src/proxy/StatementPayloadValidator.js +18 -0
- package/src/proxy/StatementRegistryLoader.d.ts +2 -0
- package/src/proxy/StatementRegistryLoader.d.ts.map +1 -0
- package/src/proxy/StatementRegistryLoader.js +36 -0
- package/src/proxy/StatementRegistryResolver.d.ts +15 -0
- package/src/proxy/StatementRegistryResolver.d.ts.map +1 -0
- package/src/proxy/StatementRegistryResolver.js +34 -0
- package/src/proxy/d1/ZintrustD1Proxy.d.ts +2 -1
- package/src/proxy/d1/ZintrustD1Proxy.d.ts.map +1 -1
- package/src/proxy/d1/ZintrustD1Proxy.js +2 -1
- package/src/proxy/isMutatingSql.d.ts +2 -0
- package/src/proxy/isMutatingSql.d.ts.map +1 -0
- package/src/proxy/isMutatingSql.js +12 -0
- package/src/proxy/kv/ZintrustKvProxy.d.ts +2 -1
- package/src/proxy/kv/ZintrustKvProxy.d.ts.map +1 -1
- package/src/proxy/kv/ZintrustKvProxy.js +2 -1
- package/src/proxy/mysql/MySqlProxyServer.d.ts +2 -8
- package/src/proxy/mysql/MySqlProxyServer.d.ts.map +1 -1
- package/src/proxy/mysql/MySqlProxyServer.js +84 -51
- package/src/proxy/postgres/PostgresProxyServer.d.ts +2 -8
- package/src/proxy/postgres/PostgresProxyServer.d.ts.map +1 -1
- package/src/proxy/postgres/PostgresProxyServer.js +86 -48
- package/src/proxy/smtp/SmtpProxyServer.d.ts.map +1 -1
- package/src/proxy/smtp/SmtpProxyServer.js +6 -5
- package/src/proxy/sqlserver/SqlServerProxyServer.d.ts +2 -8
- package/src/proxy/sqlserver/SqlServerProxyServer.d.ts.map +1 -1
- package/src/proxy/sqlserver/SqlServerProxyServer.js +84 -49
- package/src/proxy.d.ts +4 -0
- package/src/proxy.d.ts.map +1 -0
- package/src/proxy.js +3 -0
- package/src/runtime/RuntimeAdapter.d.ts.map +1 -1
- package/src/runtime/RuntimeAdapter.js +30 -12
- package/src/runtime/adapters/CloudflareAdapter.d.ts.map +1 -1
- package/src/runtime/adapters/CloudflareAdapter.js +15 -4
- package/src/scheduler/Schedule.d.ts +36 -0
- package/src/scheduler/Schedule.d.ts.map +1 -0
- package/src/scheduler/Schedule.js +197 -0
- package/src/scheduler/ScheduleHttpGateway.d.ts +8 -0
- package/src/scheduler/ScheduleHttpGateway.d.ts.map +1 -0
- package/src/scheduler/ScheduleHttpGateway.js +196 -0
- package/src/scheduler/ScheduleRunner.d.ts +6 -0
- package/src/scheduler/ScheduleRunner.d.ts.map +1 -1
- package/src/scheduler/ScheduleRunner.js +166 -29
- package/src/scheduler/SchedulerRuntime.d.ts +15 -0
- package/src/scheduler/SchedulerRuntime.d.ts.map +1 -0
- package/src/scheduler/SchedulerRuntime.js +79 -0
- package/src/scheduler/cron/Cron.d.ts +19 -0
- package/src/scheduler/cron/Cron.d.ts.map +1 -0
- package/src/scheduler/cron/Cron.js +200 -0
- package/src/scheduler/leader/SchedulerLeader.d.ts +14 -0
- package/src/scheduler/leader/SchedulerLeader.d.ts.map +1 -0
- package/src/scheduler/leader/SchedulerLeader.js +187 -0
- package/src/scheduler/state/ScheduleStateStore.d.ts +27 -0
- package/src/scheduler/state/ScheduleStateStore.d.ts.map +1 -0
- package/src/scheduler/state/ScheduleStateStore.js +27 -0
- package/src/scheduler/types.d.ts +10 -0
- package/src/scheduler/types.d.ts.map +1 -1
- package/src/schedules/index.d.ts +1 -0
- package/src/schedules/index.d.ts.map +1 -1
- package/src/schedules/index.js +1 -0
- package/src/schedules/job-tracking-cleanup.d.ts +4 -0
- package/src/schedules/job-tracking-cleanup.d.ts.map +1 -0
- package/src/schedules/job-tracking-cleanup.js +116 -0
- package/src/schedules/log-cleanup.d.ts +1 -2
- package/src/schedules/log-cleanup.d.ts.map +1 -1
- package/src/schedules/log-cleanup.js +12 -15
- package/src/security/Sanitizer.d.ts.map +1 -1
- package/src/security/Sanitizer.js +1 -9
- package/src/security/SignedRequest.d.ts.map +1 -1
- package/src/security/SignedRequest.js +2 -2
- package/src/security/TokenRevocation.d.ts +19 -2
- package/src/security/TokenRevocation.d.ts.map +1 -1
- package/src/security/TokenRevocation.js +558 -30
- package/src/templates/docker/docker-compose.ecosystem.yml.tpl +301 -0
- package/src/templates/docker/docker-compose.schedules.yml.tpl +84 -0
- package/src/templates/project/basic/app/Controllers/AuthController.ts.tpl +11 -3
- package/src/templates/project/basic/app/Schedules/index.ts.tpl +0 -0
- package/src/templates/project/basic/config/database.ts.tpl +1 -1
- package/src/templates/project/basic/config/middleware.ts.tpl +23 -22
- package/src/templates/project/basic/wrangler.jsonc.tpl +28 -0
- package/src/toolkit/Secrets/Manifest.d.ts.map +1 -1
- package/src/toolkit/Secrets/Manifest.js +5 -7
- package/src/tools/mail/drivers/Smtp.d.ts.map +1 -1
- package/src/tools/mail/drivers/Smtp.js +7 -1
- package/src/tools/queue/JobReconciliationRunner.d.ts.map +1 -1
- package/src/tools/queue/JobReconciliationRunner.js +7 -39
- package/src/tools/queue/JobRecoveryDaemon.d.ts.map +1 -1
- package/src/tools/queue/JobRecoveryDaemon.js +116 -18
- package/src/tools/queue/JobStateTracker.d.ts +10 -1
- package/src/tools/queue/JobStateTracker.d.ts.map +1 -1
- package/src/tools/queue/JobStateTracker.js +24 -2
- package/src/tools/queue/JobStateTrackerDbPersistence.d.ts.map +1 -1
- package/src/tools/queue/JobStateTrackerDbPersistence.js +93 -2
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type SnapshotData = {
|
|
2
|
+
type: string;
|
|
3
|
+
ts: string;
|
|
4
|
+
monitoring: unknown;
|
|
5
|
+
workers: unknown;
|
|
6
|
+
};
|
|
7
|
+
export declare const WorkerMonitoringService: Readonly<{
|
|
8
|
+
subscribe(callback: (data: SnapshotData) => void): void;
|
|
9
|
+
unsubscribe(callback: (data: SnapshotData) => void): void;
|
|
10
|
+
}>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=WorkerMonitoringService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkerMonitoringService.d.ts","sourceRoot":"","sources":["../../../../../packages/workers/src/http/WorkerMonitoringService.ts"],"names":[],"mappings":"AAIA,KAAK,YAAY,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAoFF,eAAO,MAAM,uBAAuB;wBACd,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,GAAG,IAAI;0BAQjC,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,GAAG,IAAI;EAOzD,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { Logger, NodeSingletons, workersConfig } from '../../../../src/index.js';
|
|
2
|
+
import { HealthMonitor } from '../HealthMonitor.js';
|
|
3
|
+
import { getWorkers } from '../dashboard/workers-api.js';
|
|
4
|
+
const createFallbackEmitter = () => {
|
|
5
|
+
const listeners = new Map();
|
|
6
|
+
return {
|
|
7
|
+
on(event, listener) {
|
|
8
|
+
const set = listeners.get(event) ?? new Set();
|
|
9
|
+
set.add(listener);
|
|
10
|
+
listeners.set(event, set);
|
|
11
|
+
},
|
|
12
|
+
off(event, listener) {
|
|
13
|
+
const set = listeners.get(event);
|
|
14
|
+
if (!set)
|
|
15
|
+
return;
|
|
16
|
+
set.delete(listener);
|
|
17
|
+
if (set.size === 0)
|
|
18
|
+
listeners.delete(event);
|
|
19
|
+
},
|
|
20
|
+
emit(event, payload) {
|
|
21
|
+
const set = listeners.get(event);
|
|
22
|
+
if (!set)
|
|
23
|
+
return false;
|
|
24
|
+
for (const listener of set)
|
|
25
|
+
listener(payload);
|
|
26
|
+
return true;
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
// Internal state
|
|
31
|
+
const EventEmitterCtor = NodeSingletons?.EventEmitter;
|
|
32
|
+
const emitter = typeof EventEmitterCtor === 'function' ? new EventEmitterCtor() : createFallbackEmitter();
|
|
33
|
+
emitter.setMaxListeners?.(Infinity);
|
|
34
|
+
let interval = null;
|
|
35
|
+
let subscribers = 0;
|
|
36
|
+
const INTERVAL_MS = workersConfig?.intervalMs || 5000;
|
|
37
|
+
const broadcastSnapshot = async () => {
|
|
38
|
+
try {
|
|
39
|
+
if (subscribers <= 0)
|
|
40
|
+
return;
|
|
41
|
+
const monitoring = await HealthMonitor.getSummary();
|
|
42
|
+
// Fetch full workers listing optimized for dashboard
|
|
43
|
+
const workersPayload = await getWorkers({ page: 1, limit: 200 });
|
|
44
|
+
const payload = {
|
|
45
|
+
type: 'snapshot',
|
|
46
|
+
ts: new Date().toISOString(),
|
|
47
|
+
monitoring,
|
|
48
|
+
workers: workersPayload,
|
|
49
|
+
};
|
|
50
|
+
emitter.emit('snapshot', payload);
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
Logger.error('WorkerMonitoringService.broadcastSnapshot failed', err);
|
|
54
|
+
emitter.emit('error', err);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const startPolling = () => {
|
|
58
|
+
if (interval)
|
|
59
|
+
return;
|
|
60
|
+
Logger.debug('Starting WorkerMonitoringService polling');
|
|
61
|
+
// Initial fetch
|
|
62
|
+
void broadcastSnapshot();
|
|
63
|
+
interval = setInterval(() => {
|
|
64
|
+
void broadcastSnapshot();
|
|
65
|
+
}, INTERVAL_MS);
|
|
66
|
+
};
|
|
67
|
+
const stopPolling = () => {
|
|
68
|
+
if (interval) {
|
|
69
|
+
Logger.debug('Stopping WorkerMonitoringService polling');
|
|
70
|
+
clearInterval(interval);
|
|
71
|
+
interval = null;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
export const WorkerMonitoringService = Object.freeze({
|
|
75
|
+
subscribe(callback) {
|
|
76
|
+
emitter.on('snapshot', callback);
|
|
77
|
+
subscribers++;
|
|
78
|
+
if (subscribers === 1) {
|
|
79
|
+
startPolling();
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
unsubscribe(callback) {
|
|
83
|
+
emitter.off('snapshot', callback);
|
|
84
|
+
subscribers--;
|
|
85
|
+
if (subscribers <= 0) {
|
|
86
|
+
stopPolling();
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
});
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { type IRequest, type IResponse } from '../../../../../src/index.js';
|
|
2
|
+
export type RouteHandler = (req: IRequest, res: IResponse) => Promise<void> | void;
|
|
3
|
+
export interface ValidationSchema {
|
|
4
|
+
[key: string]: {
|
|
5
|
+
required?: boolean;
|
|
6
|
+
default?: unknown;
|
|
7
|
+
type?: 'string' | 'number' | 'boolean' | 'object' | 'array';
|
|
8
|
+
minLength?: number;
|
|
9
|
+
maxLength?: number;
|
|
10
|
+
min?: number;
|
|
11
|
+
max?: number;
|
|
12
|
+
pattern?: RegExp;
|
|
13
|
+
allowedValues?: unknown[];
|
|
14
|
+
custom?: (value: unknown) => string | null;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export declare const withCustomValidation: (schema: ValidationSchema, handler: RouteHandler) => RouteHandler;
|
|
18
|
+
/**
|
|
19
|
+
* Predefined validation schemas for common use cases
|
|
20
|
+
*/
|
|
21
|
+
export declare const ValidationSchemas: {
|
|
22
|
+
/**
|
|
23
|
+
* Schema for pagination parameters
|
|
24
|
+
*/
|
|
25
|
+
pagination: {
|
|
26
|
+
page: {
|
|
27
|
+
type: "number";
|
|
28
|
+
min: number;
|
|
29
|
+
default: number;
|
|
30
|
+
};
|
|
31
|
+
limit: {
|
|
32
|
+
type: "number";
|
|
33
|
+
min: number;
|
|
34
|
+
max: number;
|
|
35
|
+
default: number;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Schema for date range filtering
|
|
40
|
+
*/
|
|
41
|
+
dateRange: {
|
|
42
|
+
startDate: {
|
|
43
|
+
type: "string";
|
|
44
|
+
pattern: RegExp;
|
|
45
|
+
};
|
|
46
|
+
endDate: {
|
|
47
|
+
type: "string";
|
|
48
|
+
pattern: RegExp;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Schema for sorting parameters
|
|
53
|
+
*/
|
|
54
|
+
sorting: {
|
|
55
|
+
sortBy: {
|
|
56
|
+
type: "string";
|
|
57
|
+
allowedValues: string[];
|
|
58
|
+
default: string;
|
|
59
|
+
};
|
|
60
|
+
sortOrder: {
|
|
61
|
+
type: "string";
|
|
62
|
+
allowedValues: string[];
|
|
63
|
+
default: string;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Schema for worker filtering
|
|
68
|
+
*/
|
|
69
|
+
workerFilter: {
|
|
70
|
+
status: {
|
|
71
|
+
type: "string";
|
|
72
|
+
allowedValues: string[];
|
|
73
|
+
optional: boolean;
|
|
74
|
+
};
|
|
75
|
+
queueName: {
|
|
76
|
+
type: "string";
|
|
77
|
+
minLength: number;
|
|
78
|
+
maxLength: number;
|
|
79
|
+
optional: boolean;
|
|
80
|
+
};
|
|
81
|
+
driver: {
|
|
82
|
+
type: "string";
|
|
83
|
+
allowedValues: string[];
|
|
84
|
+
optional: boolean;
|
|
85
|
+
};
|
|
86
|
+
search: {
|
|
87
|
+
type: "string";
|
|
88
|
+
maxLength: number;
|
|
89
|
+
optional: boolean;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=CustomValidation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomValidation.d.ts","sourceRoot":"","sources":["../../../../../../packages/workers/src/http/middleware/CustomValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEvE,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAEnF,MAAM,WAAW,gBAAgB;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG;QACb,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;QAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,aAAa,CAAC,EAAE,OAAO,EAAE,CAAC;QAC1B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,GAAG,IAAI,CAAC;KAC5C,CAAC;CACH;AAsND,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,gBAAgB,EACxB,SAAS,YAAY,KACpB,YA8CF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB;IAC5B;;OAEG;;;;;;;;;;;;;;IAeH;;OAEG;;;;;;;;;;;IAYH;;OAEG;;;;;;;;;;;;;IAcH;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;CAwBJ,CAAC"}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import { Logger } from '../../../../../src/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Custom validation middleware that accepts a validation schema
|
|
4
|
+
* Provides flexible validation for any request data structure
|
|
5
|
+
*/
|
|
6
|
+
const validateRequiredField = (fieldName, value, fieldSchema) => {
|
|
7
|
+
if (fieldSchema.required && (value === undefined || value === null)) {
|
|
8
|
+
return {
|
|
9
|
+
field: fieldName,
|
|
10
|
+
message: `${fieldName} is required`,
|
|
11
|
+
code: 'MISSING_REQUIRED_FIELD',
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
return null;
|
|
15
|
+
};
|
|
16
|
+
const validateFieldType = (fieldName, value, fieldSchema) => {
|
|
17
|
+
if (!fieldSchema.type)
|
|
18
|
+
return null;
|
|
19
|
+
const actualType = Array.isArray(value) ? 'array' : typeof value;
|
|
20
|
+
if (actualType !== fieldSchema.type) {
|
|
21
|
+
return {
|
|
22
|
+
field: fieldName,
|
|
23
|
+
message: `${fieldName} must be of type ${fieldSchema.type}`,
|
|
24
|
+
code: 'INVALID_TYPE',
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
};
|
|
29
|
+
const validateStringField = (fieldName, value, fieldSchema) => {
|
|
30
|
+
const errors = [];
|
|
31
|
+
if (fieldSchema.minLength !== undefined && value.length < fieldSchema.minLength) {
|
|
32
|
+
errors.push({
|
|
33
|
+
field: fieldName,
|
|
34
|
+
message: `${fieldName} must be at least ${fieldSchema.minLength} characters long`,
|
|
35
|
+
code: 'STRING_TOO_SHORT',
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
if (fieldSchema.maxLength !== undefined && value.length > fieldSchema.maxLength) {
|
|
39
|
+
errors.push({
|
|
40
|
+
field: fieldName,
|
|
41
|
+
message: `${fieldName} must be at most ${fieldSchema.maxLength} characters long`,
|
|
42
|
+
code: 'STRING_TOO_LONG',
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
if (fieldSchema.pattern && !fieldSchema.pattern.test(value)) {
|
|
46
|
+
errors.push({
|
|
47
|
+
field: fieldName,
|
|
48
|
+
message: `${fieldName} format is invalid`,
|
|
49
|
+
code: 'INVALID_FORMAT',
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return errors;
|
|
53
|
+
};
|
|
54
|
+
const validateNumberField = (fieldName, value, fieldSchema) => {
|
|
55
|
+
const errors = [];
|
|
56
|
+
if (fieldSchema.min !== undefined && value < fieldSchema.min) {
|
|
57
|
+
errors.push({
|
|
58
|
+
field: fieldName,
|
|
59
|
+
message: `${fieldName} must be at least ${fieldSchema.min}`,
|
|
60
|
+
code: 'NUMBER_TOO_SMALL',
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
if (fieldSchema.max !== undefined && value > fieldSchema.max) {
|
|
64
|
+
errors.push({
|
|
65
|
+
field: fieldName,
|
|
66
|
+
message: `${fieldName} must be at most ${fieldSchema.max}`,
|
|
67
|
+
code: 'NUMBER_TOO_LARGE',
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return errors;
|
|
71
|
+
};
|
|
72
|
+
const validateArrayField = (fieldName, value, fieldSchema) => {
|
|
73
|
+
const errors = [];
|
|
74
|
+
if (fieldSchema.minLength !== undefined && value.length < fieldSchema.minLength) {
|
|
75
|
+
errors.push({
|
|
76
|
+
field: fieldName,
|
|
77
|
+
message: `${fieldName} must contain at least ${fieldSchema.minLength} items`,
|
|
78
|
+
code: 'ARRAY_TOO_SHORT',
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
if (fieldSchema.maxLength !== undefined && value.length > fieldSchema.maxLength) {
|
|
82
|
+
errors.push({
|
|
83
|
+
field: fieldName,
|
|
84
|
+
message: `${fieldName} must contain at most ${fieldSchema.maxLength} items`,
|
|
85
|
+
code: 'ARRAY_TOO_LONG',
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return errors;
|
|
89
|
+
};
|
|
90
|
+
const validateAllowedValues = (fieldName, value, fieldSchema) => {
|
|
91
|
+
if (fieldSchema.allowedValues && !fieldSchema.allowedValues.includes(value)) {
|
|
92
|
+
return {
|
|
93
|
+
field: fieldName,
|
|
94
|
+
message: `${fieldName} must be one of: ${fieldSchema.allowedValues.join(', ')}`,
|
|
95
|
+
code: 'INVALID_VALUE',
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
return null;
|
|
99
|
+
};
|
|
100
|
+
const validateCustomRule = (fieldName, value, fieldSchema) => {
|
|
101
|
+
if (fieldSchema.custom) {
|
|
102
|
+
const customError = fieldSchema.custom(value);
|
|
103
|
+
if (customError) {
|
|
104
|
+
return {
|
|
105
|
+
field: fieldName,
|
|
106
|
+
message: customError,
|
|
107
|
+
code: 'CUSTOM_VALIDATION_FAILED',
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return null;
|
|
112
|
+
};
|
|
113
|
+
const validateField = (fieldName, value, fieldSchema) => {
|
|
114
|
+
const errors = [];
|
|
115
|
+
// Check required field
|
|
116
|
+
const requiredError = validateRequiredField(fieldName, value, fieldSchema);
|
|
117
|
+
if (requiredError) {
|
|
118
|
+
errors.push(requiredError);
|
|
119
|
+
return errors; // Skip other validations for missing required field
|
|
120
|
+
}
|
|
121
|
+
// Skip validation if field is not provided and not required
|
|
122
|
+
if (value === undefined || value === null) {
|
|
123
|
+
return errors;
|
|
124
|
+
}
|
|
125
|
+
// Type validation
|
|
126
|
+
const typeError = validateFieldType(fieldName, value, fieldSchema);
|
|
127
|
+
if (typeError) {
|
|
128
|
+
errors.push(typeError);
|
|
129
|
+
return errors; // Skip other validations for wrong type
|
|
130
|
+
}
|
|
131
|
+
// String validations
|
|
132
|
+
if (typeof value === 'string') {
|
|
133
|
+
errors.push(...validateStringField(fieldName, value, fieldSchema));
|
|
134
|
+
}
|
|
135
|
+
// Number validations
|
|
136
|
+
if (typeof value === 'number') {
|
|
137
|
+
errors.push(...validateNumberField(fieldName, value, fieldSchema));
|
|
138
|
+
}
|
|
139
|
+
// Array validations
|
|
140
|
+
if (Array.isArray(value)) {
|
|
141
|
+
errors.push(...validateArrayField(fieldName, value, fieldSchema));
|
|
142
|
+
}
|
|
143
|
+
// Allowed values validation
|
|
144
|
+
const allowedValuesError = validateAllowedValues(fieldName, value, fieldSchema);
|
|
145
|
+
if (allowedValuesError) {
|
|
146
|
+
errors.push(allowedValuesError);
|
|
147
|
+
}
|
|
148
|
+
// Custom validation
|
|
149
|
+
const customError = validateCustomRule(fieldName, value, fieldSchema);
|
|
150
|
+
if (customError) {
|
|
151
|
+
errors.push(customError);
|
|
152
|
+
}
|
|
153
|
+
return errors;
|
|
154
|
+
};
|
|
155
|
+
export const withCustomValidation = (schema, handler) => {
|
|
156
|
+
return async (req, res) => {
|
|
157
|
+
try {
|
|
158
|
+
const currentBody = req.getBody();
|
|
159
|
+
const data = { ...req.data() };
|
|
160
|
+
// Apply defaults from schema into request body when missing
|
|
161
|
+
for (const [fieldName, fieldSchema] of Object.entries(schema)) {
|
|
162
|
+
if ((data[fieldName] === undefined || data[fieldName] === null) &&
|
|
163
|
+
fieldSchema.default !== undefined) {
|
|
164
|
+
data[fieldName] = fieldSchema.default;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
// Persist defaults back into request body so downstream handlers see them
|
|
168
|
+
req.setBody({ ...currentBody, ...data });
|
|
169
|
+
const errors = [];
|
|
170
|
+
// Validate each field in the schema
|
|
171
|
+
for (const [fieldName, fieldSchema] of Object.entries(schema)) {
|
|
172
|
+
const value = data[fieldName];
|
|
173
|
+
const fieldErrors = validateField(fieldName, value, fieldSchema);
|
|
174
|
+
errors.push(...fieldErrors);
|
|
175
|
+
}
|
|
176
|
+
// Return errors if any validation failed
|
|
177
|
+
if (errors.length > 0) {
|
|
178
|
+
return res.setStatus(400).json({
|
|
179
|
+
error: 'Validation failed',
|
|
180
|
+
message: 'Request data validation failed',
|
|
181
|
+
code: 'VALIDATION_FAILED',
|
|
182
|
+
details: errors,
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
return handler(req, res);
|
|
186
|
+
}
|
|
187
|
+
catch (error) {
|
|
188
|
+
Logger.error('Custom validation failed', error);
|
|
189
|
+
return res.setStatus(500).json({
|
|
190
|
+
error: 'Internal validation error',
|
|
191
|
+
code: 'VALIDATION_ERROR',
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* Predefined validation schemas for common use cases
|
|
198
|
+
*/
|
|
199
|
+
export const ValidationSchemas = {
|
|
200
|
+
/**
|
|
201
|
+
* Schema for pagination parameters
|
|
202
|
+
*/
|
|
203
|
+
pagination: {
|
|
204
|
+
page: {
|
|
205
|
+
type: 'number',
|
|
206
|
+
min: 1,
|
|
207
|
+
default: 1,
|
|
208
|
+
},
|
|
209
|
+
limit: {
|
|
210
|
+
type: 'number',
|
|
211
|
+
min: 1,
|
|
212
|
+
max: 100,
|
|
213
|
+
default: 20,
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
/**
|
|
217
|
+
* Schema for date range filtering
|
|
218
|
+
*/
|
|
219
|
+
dateRange: {
|
|
220
|
+
startDate: {
|
|
221
|
+
type: 'string',
|
|
222
|
+
pattern: /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z$/,
|
|
223
|
+
},
|
|
224
|
+
endDate: {
|
|
225
|
+
type: 'string',
|
|
226
|
+
pattern: /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z$/,
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
/**
|
|
230
|
+
* Schema for sorting parameters
|
|
231
|
+
*/
|
|
232
|
+
sorting: {
|
|
233
|
+
sortBy: {
|
|
234
|
+
type: 'string',
|
|
235
|
+
allowedValues: ['name', 'status', 'createdAt', 'updatedAt', 'queueName'],
|
|
236
|
+
default: 'createdAt',
|
|
237
|
+
},
|
|
238
|
+
sortOrder: {
|
|
239
|
+
type: 'string',
|
|
240
|
+
allowedValues: ['asc', 'desc'],
|
|
241
|
+
default: 'desc',
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
/**
|
|
245
|
+
* Schema for worker filtering
|
|
246
|
+
*/
|
|
247
|
+
workerFilter: {
|
|
248
|
+
status: {
|
|
249
|
+
type: 'string',
|
|
250
|
+
allowedValues: ['running', 'stopped', 'failed', 'paused', ''],
|
|
251
|
+
optional: true,
|
|
252
|
+
},
|
|
253
|
+
queueName: {
|
|
254
|
+
type: 'string',
|
|
255
|
+
minLength: 3,
|
|
256
|
+
maxLength: 50,
|
|
257
|
+
optional: true,
|
|
258
|
+
},
|
|
259
|
+
driver: {
|
|
260
|
+
type: 'string',
|
|
261
|
+
allowedValues: ['db', 'database', 'redis', 'memory', ''],
|
|
262
|
+
optional: true,
|
|
263
|
+
},
|
|
264
|
+
search: {
|
|
265
|
+
type: 'string',
|
|
266
|
+
maxLength: 100,
|
|
267
|
+
optional: true,
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type IRequest, type IResponse } from '../../../../../src/index.js';
|
|
2
|
+
export type RouteHandler = (req: IRequest, res: IResponse) => Promise<void> | void;
|
|
3
|
+
export declare const withDatacenterValidation: (handler: RouteHandler) => RouteHandler;
|
|
4
|
+
//# sourceMappingURL=DatacenterValidator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatacenterValidator.d.ts","sourceRoot":"","sources":["../../../../../../packages/workers/src/http/middleware/DatacenterValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEvE,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAqEnF,eAAO,MAAM,wBAAwB,GAAI,SAAS,YAAY,KAAG,YAoDhE,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Logger } from '../../../../../src/index.js';
|
|
2
|
+
const validateRegion = (region) => {
|
|
3
|
+
// Allow custom region names but validate format
|
|
4
|
+
return /^[a-z0-9-]+$/.test(region) && region.length >= 3 && region.length <= 20;
|
|
5
|
+
};
|
|
6
|
+
const validatePrimaryRegion = (primaryRegion) => {
|
|
7
|
+
if (!primaryRegion) {
|
|
8
|
+
return 'Primary region is required';
|
|
9
|
+
}
|
|
10
|
+
if (!validateRegion(primaryRegion)) {
|
|
11
|
+
return 'Primary region must be 3-20 characters, lowercase letters, numbers, and hyphens only';
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
};
|
|
15
|
+
const validateSecondaryRegions = (secondaryRegions) => {
|
|
16
|
+
if (!Array.isArray(secondaryRegions)) {
|
|
17
|
+
return 'Secondary regions must be an array';
|
|
18
|
+
}
|
|
19
|
+
for (const region of secondaryRegions) {
|
|
20
|
+
if (!validateRegion(region)) {
|
|
21
|
+
return `Secondary region '${region}' must be 3-20 characters, lowercase letters, numbers, and hyphens only`;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
};
|
|
26
|
+
const validateAffinityRules = (affinityRules) => {
|
|
27
|
+
if (!affinityRules) {
|
|
28
|
+
return 'Affinity rules are required';
|
|
29
|
+
}
|
|
30
|
+
if (typeof affinityRules.preferLocal !== 'boolean') {
|
|
31
|
+
return 'Affinity rule preferLocal must be a boolean';
|
|
32
|
+
}
|
|
33
|
+
if (typeof affinityRules.maxLatency !== 'number' || affinityRules.maxLatency < 0) {
|
|
34
|
+
return 'Affinity rule maxLatency must be a non-negative number';
|
|
35
|
+
}
|
|
36
|
+
if (!Array.isArray(affinityRules.avoidRegions)) {
|
|
37
|
+
return 'Affinity rule avoidRegions must be an array';
|
|
38
|
+
}
|
|
39
|
+
for (const region of affinityRules.avoidRegions) {
|
|
40
|
+
if (!validateRegion(region)) {
|
|
41
|
+
return `Avoid region '${region}' must be 3-20 characters, lowercase letters, numbers, and hyphens only`;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
};
|
|
46
|
+
export const withDatacenterValidation = (handler) => {
|
|
47
|
+
return async (req, res) => {
|
|
48
|
+
try {
|
|
49
|
+
const data = req.data();
|
|
50
|
+
const datacenter = data['datacenter'];
|
|
51
|
+
if (!datacenter) {
|
|
52
|
+
return res.setStatus(400).json({
|
|
53
|
+
error: 'Datacenter configuration is required',
|
|
54
|
+
code: 'MISSING_DATACENTER',
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
// Validate primary region
|
|
58
|
+
const primaryRegionError = validatePrimaryRegion(datacenter.primaryRegion);
|
|
59
|
+
if (primaryRegionError) {
|
|
60
|
+
return res.setStatus(400).json({
|
|
61
|
+
error: 'Invalid primary region',
|
|
62
|
+
message: primaryRegionError,
|
|
63
|
+
code: 'INVALID_PRIMARY_REGION',
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
// Validate secondary regions
|
|
67
|
+
const secondaryRegionsError = validateSecondaryRegions(datacenter.secondaryRegions);
|
|
68
|
+
if (secondaryRegionsError) {
|
|
69
|
+
return res.setStatus(400).json({
|
|
70
|
+
error: 'Invalid secondary regions',
|
|
71
|
+
message: secondaryRegionsError,
|
|
72
|
+
code: 'INVALID_SECONDARY_REGIONS',
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
// Validate affinity rules
|
|
76
|
+
const affinityRulesError = validateAffinityRules(datacenter.affinityRules);
|
|
77
|
+
if (affinityRulesError) {
|
|
78
|
+
return res.setStatus(400).json({
|
|
79
|
+
error: 'Invalid affinity rules',
|
|
80
|
+
message: affinityRulesError,
|
|
81
|
+
code: 'INVALID_AFFINITY_RULES',
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return handler(req, res);
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
Logger.error('Datacenter validation failed', error);
|
|
88
|
+
return res.setStatus(500).json({
|
|
89
|
+
error: 'Internal validation error',
|
|
90
|
+
code: 'VALIDATION_ERROR',
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type IRequest, type IResponse } from '../../../../../src/index.js';
|
|
2
|
+
export type RouteHandler = (req: IRequest, res: IResponse) => Promise<void> | void;
|
|
3
|
+
/**
|
|
4
|
+
* Composite middleware for worker edit validation
|
|
5
|
+
* Maps processorSpec to processor for validation and validates all editable fields
|
|
6
|
+
*/
|
|
7
|
+
export declare const withEditWorkerValidation: (handler: RouteHandler) => RouteHandler;
|
|
8
|
+
//# sourceMappingURL=EditWorkerValidation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditWorkerValidation.d.ts","sourceRoot":"","sources":["../../../../../../packages/workers/src/http/middleware/EditWorkerValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEvE,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAYnF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,GAAI,SAAS,YAAY,KAAG,YAwDhE,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Logger } from '../../../../../src/index.js';
|
|
2
|
+
// Import individual validators
|
|
3
|
+
import { withDatacenterValidation } from './DatacenterValidator.js';
|
|
4
|
+
import { withFeaturesValidation } from './FeaturesValidator.js';
|
|
5
|
+
import { withInfrastructureValidation } from './InfrastructureValidator.js';
|
|
6
|
+
import { withStrictPayloadKeys } from './PayloadSanitizer.js';
|
|
7
|
+
import { withProcessorPathValidation } from './ProcessorPathSanitizer.js';
|
|
8
|
+
import { withQueueNameValidation } from './QueueNameSanitizer.js';
|
|
9
|
+
import { withVersionValidation } from './VersionSanitizer.js';
|
|
10
|
+
import { withWorkerNameValidation } from './WorkerNameSanitizer.js';
|
|
11
|
+
/**
|
|
12
|
+
* Composite middleware for worker edit validation
|
|
13
|
+
* Maps processorSpec to processor for validation and validates all editable fields
|
|
14
|
+
*/
|
|
15
|
+
export const withEditWorkerValidation = (handler) => {
|
|
16
|
+
return async (req, res) => {
|
|
17
|
+
try {
|
|
18
|
+
const data = req.data();
|
|
19
|
+
const currentBody = req.getBody();
|
|
20
|
+
// Map processorSpec/processorSpec to processor for validation if provided
|
|
21
|
+
let mappedBody = { ...currentBody };
|
|
22
|
+
if (data['processorSpec'] && !data['processor']) {
|
|
23
|
+
mappedBody = {
|
|
24
|
+
...mappedBody,
|
|
25
|
+
processor: data['processorSpec'],
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
// Update the request body with mapped fields
|
|
29
|
+
req.setBody(mappedBody);
|
|
30
|
+
// Apply validation with mapped fields, skipping options validation for editing
|
|
31
|
+
return withStrictPayloadKeys([
|
|
32
|
+
'name',
|
|
33
|
+
'queueName',
|
|
34
|
+
'processor', // Validated field (mapped from processorSpec)
|
|
35
|
+
'processorSpec',
|
|
36
|
+
'version',
|
|
37
|
+
'options', // Skip strict validation for editing
|
|
38
|
+
'infrastructure',
|
|
39
|
+
'features',
|
|
40
|
+
'datacenter',
|
|
41
|
+
'concurrency', // Original field
|
|
42
|
+
'region',
|
|
43
|
+
'autoStart',
|
|
44
|
+
'activeStatus',
|
|
45
|
+
'status',
|
|
46
|
+
], withProcessorPathValidation(withWorkerNameValidation(withQueueNameValidation(withVersionValidation(withInfrastructureValidation(withFeaturesValidation(withDatacenterValidation(handler))))))))(req, res);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
Logger.error('Edit worker validation failed', error);
|
|
50
|
+
return res.setStatus(500).json({
|
|
51
|
+
error: 'Internal validation error',
|
|
52
|
+
code: 'VALIDATION_ERROR',
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type IRequest, type IResponse } from '../../../../../src/index.js';
|
|
2
|
+
export type RouteHandler = (req: IRequest, res: IResponse) => Promise<void> | void;
|
|
3
|
+
export declare const withFeaturesValidation: (handler: RouteHandler) => RouteHandler;
|
|
4
|
+
//# sourceMappingURL=FeaturesValidator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeaturesValidator.d.ts","sourceRoot":"","sources":["../../../../../../packages/workers/src/http/middleware/FeaturesValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEvE,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AA8BnF,eAAO,MAAM,sBAAsB,GAAI,SAAS,YAAY,KAAG,YAiD9D,CAAC"}
|