@zintrust/core 0.1.49 → 0.1.50

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.
Files changed (341) hide show
  1. package/package.json +1 -9
  2. package/src/config/index.d.ts +1 -1
  3. package/src/config/index.d.ts.map +1 -1
  4. package/src/config/index.js +30 -10
  5. package/src/index.d.ts +0 -2
  6. package/src/index.d.ts.map +1 -1
  7. package/src/index.js +3 -5
  8. package/src/proxy/d1/ZintrustD1Proxy.d.ts +2 -2
  9. package/src/proxy/d1/ZintrustD1Proxy.d.ts.map +1 -1
  10. package/src/proxy/d1/ZintrustD1Proxy.js +39 -2
  11. package/src/proxy/kv/ZintrustKvProxy.d.ts +2 -2
  12. package/src/proxy/kv/ZintrustKvProxy.d.ts.map +1 -1
  13. package/src/proxy/kv/ZintrustKvProxy.js +38 -2
  14. package/src/security/JwtManager.js +1 -1
  15. package/src/zintrust.comon.d.ts +9 -0
  16. package/src/zintrust.comon.d.ts.map +1 -0
  17. package/src/zintrust.comon.js +15 -0
  18. package/src/zintrust.plugins.d.ts +9 -3
  19. package/src/zintrust.plugins.d.ts.map +1 -1
  20. package/src/zintrust.plugins.js +10 -3
  21. package/src/zintrust.plugins.wg.d.ts +1 -0
  22. package/src/zintrust.plugins.wg.d.ts.map +1 -1
  23. package/src/zintrust.plugins.wg.js +1 -0
  24. package/app/Controllers/AuthController.d.ts +0 -10
  25. package/app/Controllers/AuthController.d.ts.map +0 -1
  26. package/app/Controllers/AuthController.js +0 -223
  27. package/app/Controllers/UserController.d.ts +0 -9
  28. package/app/Controllers/UserController.d.ts.map +0 -1
  29. package/app/Controllers/UserController.js +0 -8
  30. package/app/Controllers/UserQueryBuilderController.d.ts +0 -16
  31. package/app/Controllers/UserQueryBuilderController.d.ts.map +0 -1
  32. package/app/Controllers/UserQueryBuilderController.js +0 -404
  33. package/app/Middleware/ProfilerMiddleware.d.ts +0 -12
  34. package/app/Middleware/ProfilerMiddleware.d.ts.map +0 -1
  35. package/app/Middleware/ProfilerMiddleware.js +0 -47
  36. package/app/Middleware/index.d.ts +0 -59
  37. package/app/Middleware/index.d.ts.map +0 -1
  38. package/app/Middleware/index.js +0 -215
  39. package/app/Models/Post.d.ts +0 -14
  40. package/app/Models/Post.d.ts.map +0 -1
  41. package/app/Models/Post.js +0 -27
  42. package/app/Models/User.d.ts +0 -14
  43. package/app/Models/User.d.ts.map +0 -1
  44. package/app/Models/User.js +0 -44
  45. package/app/Schedules/JobTracking.d.ts +0 -3
  46. package/app/Schedules/JobTracking.d.ts.map +0 -1
  47. package/app/Schedules/JobTracking.js +0 -13
  48. package/app/Schedules/index.d.ts +0 -2
  49. package/app/Schedules/index.d.ts.map +0 -1
  50. package/app/Schedules/index.js +0 -1
  51. package/app/Toolkit/Broadcast/sendBroadcast.d.ts +0 -6
  52. package/app/Toolkit/Broadcast/sendBroadcast.d.ts.map +0 -1
  53. package/app/Toolkit/Broadcast/sendBroadcast.js +0 -5
  54. package/app/Toolkit/Mail/sendWelcomeEmail.d.ts +0 -6
  55. package/app/Toolkit/Mail/sendWelcomeEmail.d.ts.map +0 -1
  56. package/app/Toolkit/Mail/sendWelcomeEmail.js +0 -20
  57. package/app/Toolkit/Notification/sendSlackNotification.d.ts +0 -8
  58. package/app/Toolkit/Notification/sendSlackNotification.d.ts.map +0 -1
  59. package/app/Toolkit/Notification/sendSlackNotification.js +0 -5
  60. package/app/Toolkit/Notification/sendSms.d.ts +0 -6
  61. package/app/Toolkit/Notification/sendSms.d.ts.map +0 -1
  62. package/app/Toolkit/Notification/sendSms.js +0 -5
  63. package/app/Types/controller.d.ts +0 -44
  64. package/app/Types/controller.d.ts.map +0 -1
  65. package/app/Types/controller.js +0 -1
  66. package/config/broadcast.d.ts +0 -38
  67. package/config/broadcast.d.ts.map +0 -1
  68. package/config/broadcast.js +0 -37
  69. package/config/cache.d.ts +0 -40
  70. package/config/cache.d.ts.map +0 -1
  71. package/config/cache.js +0 -39
  72. package/config/database.d.ts +0 -58
  73. package/config/database.d.ts.map +0 -1
  74. package/config/database.js +0 -65
  75. package/config/mail.d.ts +0 -51
  76. package/config/mail.d.ts.map +0 -1
  77. package/config/mail.js +0 -69
  78. package/config/middleware.d.ts +0 -11
  79. package/config/middleware.d.ts.map +0 -1
  80. package/config/middleware.js +0 -30
  81. package/config/notification.d.ts +0 -33
  82. package/config/notification.d.ts.map +0 -1
  83. package/config/notification.js +0 -33
  84. package/config/queue.d.ts +0 -55
  85. package/config/queue.d.ts.map +0 -1
  86. package/config/queue.js +0 -87
  87. package/config/storage.d.ts +0 -59
  88. package/config/storage.d.ts.map +0 -1
  89. package/config/storage.js +0 -59
  90. package/config/workers.d.ts +0 -54
  91. package/config/workers.d.ts.map +0 -1
  92. package/config/workers.js +0 -83
  93. package/packages/cloudflare-d1-proxy/src/index.d.ts +0 -48
  94. package/packages/cloudflare-d1-proxy/src/index.d.ts.map +0 -1
  95. package/packages/cloudflare-d1-proxy/src/index.js +0 -387
  96. package/packages/cloudflare-kv-proxy/src/index.d.ts +0 -44
  97. package/packages/cloudflare-kv-proxy/src/index.d.ts.map +0 -1
  98. package/packages/cloudflare-kv-proxy/src/index.js +0 -325
  99. package/packages/queue-monitor/src/QueueMonitoringService.d.ts +0 -35
  100. package/packages/queue-monitor/src/QueueMonitoringService.d.ts.map +0 -1
  101. package/packages/queue-monitor/src/QueueMonitoringService.js +0 -194
  102. package/packages/queue-monitor/src/connection.d.ts +0 -3
  103. package/packages/queue-monitor/src/connection.d.ts.map +0 -1
  104. package/packages/queue-monitor/src/connection.js +0 -1
  105. package/packages/queue-monitor/src/dashboard-ui.d.ts +0 -7
  106. package/packages/queue-monitor/src/dashboard-ui.d.ts.map +0 -1
  107. package/packages/queue-monitor/src/dashboard-ui.js +0 -997
  108. package/packages/queue-monitor/src/driver.d.ts +0 -15
  109. package/packages/queue-monitor/src/driver.d.ts.map +0 -1
  110. package/packages/queue-monitor/src/driver.js +0 -115
  111. package/packages/queue-monitor/src/index.d.ts +0 -71
  112. package/packages/queue-monitor/src/index.d.ts.map +0 -1
  113. package/packages/queue-monitor/src/index.js +0 -296
  114. package/packages/queue-monitor/src/metrics.d.ts +0 -27
  115. package/packages/queue-monitor/src/metrics.d.ts.map +0 -1
  116. package/packages/queue-monitor/src/metrics.js +0 -92
  117. package/packages/queue-monitor/src/worker.d.ts +0 -8
  118. package/packages/queue-monitor/src/worker.d.ts.map +0 -1
  119. package/packages/queue-monitor/src/worker.js +0 -35
  120. package/packages/queue-redis/src/BullMQRedisQueue.d.ts +0 -26
  121. package/packages/queue-redis/src/BullMQRedisQueue.d.ts.map +0 -1
  122. package/packages/queue-redis/src/BullMQRedisQueue.js +0 -463
  123. package/packages/queue-redis/src/HttpQueueDriver.d.ts +0 -18
  124. package/packages/queue-redis/src/HttpQueueDriver.d.ts.map +0 -1
  125. package/packages/queue-redis/src/HttpQueueDriver.js +0 -249
  126. package/packages/queue-redis/src/QueueHttpGateway.d.ts +0 -16
  127. package/packages/queue-redis/src/QueueHttpGateway.d.ts.map +0 -1
  128. package/packages/queue-redis/src/QueueHttpGateway.js +0 -217
  129. package/packages/queue-redis/src/RedisPublishClient.d.ts +0 -14
  130. package/packages/queue-redis/src/RedisPublishClient.d.ts.map +0 -1
  131. package/packages/queue-redis/src/RedisPublishClient.js +0 -251
  132. package/packages/queue-redis/src/index.d.ts +0 -12
  133. package/packages/queue-redis/src/index.d.ts.map +0 -1
  134. package/packages/queue-redis/src/index.js +0 -10
  135. package/packages/queue-redis/src/register.d.ts +0 -6
  136. package/packages/queue-redis/src/register.d.ts.map +0 -1
  137. package/packages/queue-redis/src/register.js +0 -21
  138. package/packages/workers/migrations/20260119100000_create_zintrust_workers_table.d.ts +0 -11
  139. package/packages/workers/migrations/20260119100000_create_zintrust_workers_table.d.ts.map +0 -1
  140. package/packages/workers/migrations/20260119100000_create_zintrust_workers_table.js +0 -32
  141. package/packages/workers/migrations/20260123180000_create_queue_jobs_table.d.ts +0 -11
  142. package/packages/workers/migrations/20260123180000_create_queue_jobs_table.d.ts.map +0 -1
  143. package/packages/workers/migrations/20260123180000_create_queue_jobs_table.js +0 -46
  144. package/packages/workers/migrations/20260213142000_create_zintrust_job_tracking_tables.d.ts +0 -7
  145. package/packages/workers/migrations/20260213142000_create_zintrust_job_tracking_tables.d.ts.map +0 -1
  146. package/packages/workers/migrations/20260213142000_create_zintrust_job_tracking_tables.js +0 -44
  147. package/packages/workers/migrations/20260213183000_expand_zintrust_job_tracking_reliability_tables.d.ts +0 -7
  148. package/packages/workers/migrations/20260213183000_expand_zintrust_job_tracking_reliability_tables.d.ts.map +0 -1
  149. package/packages/workers/migrations/20260213183000_expand_zintrust_job_tracking_reliability_tables.js +0 -104
  150. package/packages/workers/src/AnomalyDetection.d.ts +0 -107
  151. package/packages/workers/src/AnomalyDetection.d.ts.map +0 -1
  152. package/packages/workers/src/AnomalyDetection.js +0 -329
  153. package/packages/workers/src/AutoScaler.d.ts +0 -128
  154. package/packages/workers/src/AutoScaler.d.ts.map +0 -1
  155. package/packages/workers/src/AutoScaler.js +0 -425
  156. package/packages/workers/src/BroadcastWorker.d.ts +0 -24
  157. package/packages/workers/src/BroadcastWorker.d.ts.map +0 -1
  158. package/packages/workers/src/BroadcastWorker.js +0 -24
  159. package/packages/workers/src/CanaryController.d.ts +0 -104
  160. package/packages/workers/src/CanaryController.d.ts.map +0 -1
  161. package/packages/workers/src/CanaryController.js +0 -424
  162. package/packages/workers/src/ChaosEngineering.d.ts +0 -80
  163. package/packages/workers/src/ChaosEngineering.d.ts.map +0 -1
  164. package/packages/workers/src/ChaosEngineering.js +0 -229
  165. package/packages/workers/src/CircuitBreaker.d.ts +0 -107
  166. package/packages/workers/src/CircuitBreaker.d.ts.map +0 -1
  167. package/packages/workers/src/CircuitBreaker.js +0 -374
  168. package/packages/workers/src/ClusterLock.d.ts +0 -91
  169. package/packages/workers/src/ClusterLock.d.ts.map +0 -1
  170. package/packages/workers/src/ClusterLock.js +0 -397
  171. package/packages/workers/src/ComplianceManager.d.ts +0 -178
  172. package/packages/workers/src/ComplianceManager.d.ts.map +0 -1
  173. package/packages/workers/src/ComplianceManager.js +0 -556
  174. package/packages/workers/src/DatacenterOrchestrator.d.ts +0 -134
  175. package/packages/workers/src/DatacenterOrchestrator.d.ts.map +0 -1
  176. package/packages/workers/src/DatacenterOrchestrator.js +0 -404
  177. package/packages/workers/src/DeadLetterQueue.d.ts +0 -123
  178. package/packages/workers/src/DeadLetterQueue.d.ts.map +0 -1
  179. package/packages/workers/src/DeadLetterQueue.js +0 -544
  180. package/packages/workers/src/HealthMonitor.d.ts +0 -43
  181. package/packages/workers/src/HealthMonitor.d.ts.map +0 -1
  182. package/packages/workers/src/HealthMonitor.js +0 -312
  183. package/packages/workers/src/MultiQueueWorker.d.ts +0 -90
  184. package/packages/workers/src/MultiQueueWorker.d.ts.map +0 -1
  185. package/packages/workers/src/MultiQueueWorker.js +0 -282
  186. package/packages/workers/src/NotificationWorker.d.ts +0 -24
  187. package/packages/workers/src/NotificationWorker.d.ts.map +0 -1
  188. package/packages/workers/src/NotificationWorker.js +0 -23
  189. package/packages/workers/src/Observability.d.ts +0 -154
  190. package/packages/workers/src/Observability.d.ts.map +0 -1
  191. package/packages/workers/src/Observability.js +0 -538
  192. package/packages/workers/src/PluginManager.d.ts +0 -124
  193. package/packages/workers/src/PluginManager.d.ts.map +0 -1
  194. package/packages/workers/src/PluginManager.js +0 -392
  195. package/packages/workers/src/PriorityQueue.d.ts +0 -118
  196. package/packages/workers/src/PriorityQueue.d.ts.map +0 -1
  197. package/packages/workers/src/PriorityQueue.js +0 -276
  198. package/packages/workers/src/ResourceMonitor.d.ts +0 -165
  199. package/packages/workers/src/ResourceMonitor.d.ts.map +0 -1
  200. package/packages/workers/src/ResourceMonitor.js +0 -632
  201. package/packages/workers/src/SLAMonitor.d.ts +0 -111
  202. package/packages/workers/src/SLAMonitor.d.ts.map +0 -1
  203. package/packages/workers/src/SLAMonitor.js +0 -274
  204. package/packages/workers/src/WorkerFactory.d.ts +0 -218
  205. package/packages/workers/src/WorkerFactory.d.ts.map +0 -1
  206. package/packages/workers/src/WorkerFactory.js +0 -2253
  207. package/packages/workers/src/WorkerInit.d.ts +0 -86
  208. package/packages/workers/src/WorkerInit.d.ts.map +0 -1
  209. package/packages/workers/src/WorkerInit.js +0 -307
  210. package/packages/workers/src/WorkerMetrics.d.ts +0 -116
  211. package/packages/workers/src/WorkerMetrics.d.ts.map +0 -1
  212. package/packages/workers/src/WorkerMetrics.js +0 -570
  213. package/packages/workers/src/WorkerRegistry.d.ts +0 -152
  214. package/packages/workers/src/WorkerRegistry.d.ts.map +0 -1
  215. package/packages/workers/src/WorkerRegistry.js +0 -396
  216. package/packages/workers/src/WorkerShutdown.d.ts +0 -70
  217. package/packages/workers/src/WorkerShutdown.d.ts.map +0 -1
  218. package/packages/workers/src/WorkerShutdown.js +0 -185
  219. package/packages/workers/src/WorkerVersioning.d.ts +0 -108
  220. package/packages/workers/src/WorkerVersioning.d.ts.map +0 -1
  221. package/packages/workers/src/WorkerVersioning.js +0 -300
  222. package/packages/workers/src/config/workerConfig.d.ts +0 -5
  223. package/packages/workers/src/config/workerConfig.d.ts.map +0 -1
  224. package/packages/workers/src/config/workerConfig.js +0 -25
  225. package/packages/workers/src/createQueueWorker.d.ts +0 -26
  226. package/packages/workers/src/createQueueWorker.d.ts.map +0 -1
  227. package/packages/workers/src/createQueueWorker.js +0 -367
  228. package/packages/workers/src/dashboard/index.d.ts +0 -2
  229. package/packages/workers/src/dashboard/index.d.ts.map +0 -1
  230. package/packages/workers/src/dashboard/index.js +0 -1
  231. package/packages/workers/src/dashboard/types.d.ts +0 -123
  232. package/packages/workers/src/dashboard/types.d.ts.map +0 -1
  233. package/packages/workers/src/dashboard/types.js +0 -1
  234. package/packages/workers/src/dashboard/workers-api.d.ts +0 -5
  235. package/packages/workers/src/dashboard/workers-api.d.ts.map +0 -1
  236. package/packages/workers/src/dashboard/workers-api.js +0 -738
  237. package/packages/workers/src/helper/index.d.ts +0 -6
  238. package/packages/workers/src/helper/index.d.ts.map +0 -1
  239. package/packages/workers/src/helper/index.js +0 -10
  240. package/packages/workers/src/http/WorkerApiController.d.ts +0 -39
  241. package/packages/workers/src/http/WorkerApiController.d.ts.map +0 -1
  242. package/packages/workers/src/http/WorkerApiController.js +0 -313
  243. package/packages/workers/src/http/WorkerController.d.ts +0 -375
  244. package/packages/workers/src/http/WorkerController.d.ts.map +0 -1
  245. package/packages/workers/src/http/WorkerController.js +0 -1454
  246. package/packages/workers/src/http/WorkerMonitoringService.d.ts +0 -12
  247. package/packages/workers/src/http/WorkerMonitoringService.d.ts.map +0 -1
  248. package/packages/workers/src/http/WorkerMonitoringService.js +0 -89
  249. package/packages/workers/src/http/middleware/CustomValidation.d.ts +0 -93
  250. package/packages/workers/src/http/middleware/CustomValidation.d.ts.map +0 -1
  251. package/packages/workers/src/http/middleware/CustomValidation.js +0 -270
  252. package/packages/workers/src/http/middleware/DatacenterValidator.d.ts +0 -4
  253. package/packages/workers/src/http/middleware/DatacenterValidator.d.ts.map +0 -1
  254. package/packages/workers/src/http/middleware/DatacenterValidator.js +0 -94
  255. package/packages/workers/src/http/middleware/EditWorkerValidation.d.ts +0 -8
  256. package/packages/workers/src/http/middleware/EditWorkerValidation.d.ts.map +0 -1
  257. package/packages/workers/src/http/middleware/EditWorkerValidation.js +0 -56
  258. package/packages/workers/src/http/middleware/FeaturesValidator.d.ts +0 -4
  259. package/packages/workers/src/http/middleware/FeaturesValidator.d.ts.map +0 -1
  260. package/packages/workers/src/http/middleware/FeaturesValidator.js +0 -61
  261. package/packages/workers/src/http/middleware/InfrastructureValidator.d.ts +0 -32
  262. package/packages/workers/src/http/middleware/InfrastructureValidator.d.ts.map +0 -1
  263. package/packages/workers/src/http/middleware/InfrastructureValidator.js +0 -226
  264. package/packages/workers/src/http/middleware/OptionsValidator.d.ts +0 -4
  265. package/packages/workers/src/http/middleware/OptionsValidator.d.ts.map +0 -1
  266. package/packages/workers/src/http/middleware/OptionsValidator.js +0 -112
  267. package/packages/workers/src/http/middleware/PayloadSanitizer.d.ts +0 -8
  268. package/packages/workers/src/http/middleware/PayloadSanitizer.d.ts.map +0 -1
  269. package/packages/workers/src/http/middleware/PayloadSanitizer.js +0 -42
  270. package/packages/workers/src/http/middleware/ProcessorPathSanitizer.d.ts +0 -4
  271. package/packages/workers/src/http/middleware/ProcessorPathSanitizer.d.ts.map +0 -1
  272. package/packages/workers/src/http/middleware/ProcessorPathSanitizer.js +0 -140
  273. package/packages/workers/src/http/middleware/QueueNameSanitizer.d.ts +0 -4
  274. package/packages/workers/src/http/middleware/QueueNameSanitizer.d.ts.map +0 -1
  275. package/packages/workers/src/http/middleware/QueueNameSanitizer.js +0 -45
  276. package/packages/workers/src/http/middleware/ValidateDriver.d.ts +0 -8
  277. package/packages/workers/src/http/middleware/ValidateDriver.d.ts.map +0 -1
  278. package/packages/workers/src/http/middleware/ValidateDriver.js +0 -20
  279. package/packages/workers/src/http/middleware/VersionSanitizer.d.ts +0 -4
  280. package/packages/workers/src/http/middleware/VersionSanitizer.d.ts.map +0 -1
  281. package/packages/workers/src/http/middleware/VersionSanitizer.js +0 -25
  282. package/packages/workers/src/http/middleware/WorkerNameSanitizer.d.ts +0 -4
  283. package/packages/workers/src/http/middleware/WorkerNameSanitizer.d.ts.map +0 -1
  284. package/packages/workers/src/http/middleware/WorkerNameSanitizer.js +0 -46
  285. package/packages/workers/src/http/middleware/WorkerValidationChain.d.ts +0 -28
  286. package/packages/workers/src/http/middleware/WorkerValidationChain.d.ts.map +0 -1
  287. package/packages/workers/src/http/middleware/WorkerValidationChain.js +0 -186
  288. package/packages/workers/src/index.d.ts +0 -47
  289. package/packages/workers/src/index.d.ts.map +0 -1
  290. package/packages/workers/src/index.js +0 -48
  291. package/packages/workers/src/routes/workers.d.ts +0 -13
  292. package/packages/workers/src/routes/workers.d.ts.map +0 -1
  293. package/packages/workers/src/routes/workers.js +0 -126
  294. package/packages/workers/src/storage/WorkerStore.d.ts +0 -52
  295. package/packages/workers/src/storage/WorkerStore.d.ts.map +0 -1
  296. package/packages/workers/src/storage/WorkerStore.js +0 -259
  297. package/packages/workers/src/telemetry/api/TelemetryAPI.d.ts +0 -47
  298. package/packages/workers/src/telemetry/api/TelemetryAPI.d.ts.map +0 -1
  299. package/packages/workers/src/telemetry/api/TelemetryAPI.js +0 -219
  300. package/packages/workers/src/telemetry/api/TelemetryMonitoringService.d.ts +0 -18
  301. package/packages/workers/src/telemetry/api/TelemetryMonitoringService.d.ts.map +0 -1
  302. package/packages/workers/src/telemetry/api/TelemetryMonitoringService.js +0 -140
  303. package/packages/workers/src/telemetry/components/AlertPanel.d.ts +0 -2
  304. package/packages/workers/src/telemetry/components/AlertPanel.d.ts.map +0 -1
  305. package/packages/workers/src/telemetry/components/AlertPanel.js +0 -13
  306. package/packages/workers/src/telemetry/components/CostTracking.d.ts +0 -2
  307. package/packages/workers/src/telemetry/components/CostTracking.d.ts.map +0 -1
  308. package/packages/workers/src/telemetry/components/CostTracking.js +0 -14
  309. package/packages/workers/src/telemetry/components/ResourceUsageChart.d.ts +0 -2
  310. package/packages/workers/src/telemetry/components/ResourceUsageChart.d.ts.map +0 -1
  311. package/packages/workers/src/telemetry/components/ResourceUsageChart.js +0 -11
  312. package/packages/workers/src/telemetry/components/WorkerHealthChart.d.ts +0 -2
  313. package/packages/workers/src/telemetry/components/WorkerHealthChart.d.ts.map +0 -1
  314. package/packages/workers/src/telemetry/components/WorkerHealthChart.js +0 -11
  315. package/packages/workers/src/telemetry/index.d.ts +0 -16
  316. package/packages/workers/src/telemetry/index.d.ts.map +0 -1
  317. package/packages/workers/src/telemetry/index.js +0 -60
  318. package/packages/workers/src/telemetry/routes/dashboard.d.ts +0 -7
  319. package/packages/workers/src/telemetry/routes/dashboard.d.ts.map +0 -1
  320. package/packages/workers/src/telemetry/routes/dashboard.js +0 -608
  321. package/packages/workers/src/type.d.ts +0 -77
  322. package/packages/workers/src/type.d.ts.map +0 -1
  323. package/packages/workers/src/type.js +0 -1
  324. package/packages/workers/src/ui/router/EmbeddedAssets.d.ts +0 -5
  325. package/packages/workers/src/ui/router/EmbeddedAssets.d.ts.map +0 -1
  326. package/packages/workers/src/ui/router/EmbeddedAssets.js +0 -13
  327. package/packages/workers/src/ui/router/ui.d.ts +0 -4
  328. package/packages/workers/src/ui/router/ui.d.ts.map +0 -1
  329. package/packages/workers/src/ui/router/ui.js +0 -208
  330. package/packages/workers/src/ui/types/worker-ui.d.ts +0 -230
  331. package/packages/workers/src/ui/types/worker-ui.d.ts.map +0 -1
  332. package/packages/workers/src/ui/types/worker-ui.js +0 -5
  333. package/routes/api.d.ts +0 -7
  334. package/routes/api.d.ts.map +0 -1
  335. package/routes/api.js +0 -136
  336. package/routes/broadcast.d.ts +0 -9
  337. package/routes/broadcast.d.ts.map +0 -1
  338. package/routes/broadcast.js +0 -27
  339. package/routes/storage.d.ts +0 -4
  340. package/routes/storage.d.ts.map +0 -1
  341. package/routes/storage.js +0 -35
@@ -1,61 +0,0 @@
1
- import { Logger } from '../../../../../src/index.js';
2
- const VALID_FEATURES = new Set([
3
- 'clustering',
4
- 'metrics',
5
- 'autoScaling',
6
- 'circuitBreaker',
7
- 'deadLetterQueue',
8
- 'resourceMonitoring',
9
- 'compliance',
10
- 'observability',
11
- 'plugins',
12
- 'versioning',
13
- 'datacenterOrchestration',
14
- ]);
15
- export const withFeaturesValidation = (handler) => {
16
- return async (req, res) => {
17
- try {
18
- const data = req.data();
19
- const features = data['features'];
20
- if (!features) {
21
- return handler(req, res); // Skip validation if features is not provided
22
- }
23
- const isPlainObject = Object.prototype.toString.call(features) === '[object Object]' && !Array.isArray(features);
24
- if (!isPlainObject) {
25
- return res.setStatus(400).json({
26
- error: 'Invalid features configuration',
27
- message: 'Features must be an object',
28
- code: 'INVALID_FEATURES_TYPE',
29
- });
30
- }
31
- // Validate each feature key and value
32
- const featuresObj = features;
33
- const featureKeys = Object.keys(featuresObj);
34
- for (const key of featureKeys) {
35
- if (!VALID_FEATURES.has(key)) {
36
- return res.setStatus(400).json({
37
- error: 'Invalid feature',
38
- message: `Unknown feature: ${key}. Valid features are: ${Array.from(VALID_FEATURES).join(', ')}`,
39
- code: 'INVALID_FEATURE',
40
- });
41
- }
42
- const value = featuresObj[key];
43
- if (typeof value !== 'boolean') {
44
- return res.setStatus(400).json({
45
- error: 'Invalid feature value',
46
- message: `Feature ${key} must be a boolean (true or false)`,
47
- code: 'INVALID_FEATURE_VALUE',
48
- });
49
- }
50
- }
51
- return handler(req, res);
52
- }
53
- catch (error) {
54
- Logger.error('Features validation failed', error);
55
- return res.setStatus(500).json({
56
- error: 'Internal validation error',
57
- code: 'VALIDATION_ERROR',
58
- });
59
- }
60
- };
61
- };
@@ -1,32 +0,0 @@
1
- import { type IRequest, type IResponse } from '../../../../../src/index.js';
2
- export type RouteHandler = (req: IRequest, res: IResponse) => Promise<void> | void;
3
- export interface InfrastructureConfig {
4
- persistence: {
5
- driver: string;
6
- };
7
- redis: {
8
- env: boolean;
9
- host: string;
10
- port: string;
11
- db: string;
12
- password: string;
13
- };
14
- deadLetterQueue: {
15
- policy: string;
16
- };
17
- compliance: {
18
- config: {
19
- retentionDays: number;
20
- };
21
- };
22
- observability: {
23
- enabled: boolean;
24
- };
25
- autoScaler: {
26
- enabled: boolean;
27
- minWorkers: number;
28
- maxWorkers: number;
29
- };
30
- }
31
- export declare const withInfrastructureValidation: (handler: RouteHandler) => RouteHandler;
32
- //# sourceMappingURL=InfrastructureValidator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InfrastructureValidator.d.ts","sourceRoot":"","sources":["../../../../../../packages/workers/src/http/middleware/InfrastructureValidator.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;AAKnF,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE;QACX,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,KAAK,EAAE;QACL,GAAG,EAAE,OAAO,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,MAAM,CAAC;QACX,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,eAAe,EAAE;QACf,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,UAAU,EAAE;QACV,MAAM,EAAE;YACN,aAAa,EAAE,MAAM,CAAC;SACvB,CAAC;KACH,CAAC;IACF,aAAa,EAAE;QACb,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;IACF,UAAU,EAAE;QACV,OAAO,EAAE,OAAO,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAuKD,eAAO,MAAM,4BAA4B,GAAI,SAAS,YAAY,KAAG,YA6FpE,CAAC"}
@@ -1,226 +0,0 @@
1
- import { Logger } from '../../../../../src/index.js';
2
- const VALID_DRIVERS = new Set(['database', 'redis', 'memory']);
3
- const VALID_DEAD_LETTER_POLICIES = new Set(['expire', 'retry', 'dead-letter']);
4
- const validatePersistence = (persistence) => {
5
- if (!persistence)
6
- return 'Persistence configuration is required';
7
- // Validate persistence driver
8
- if (!persistence.driver) {
9
- return 'Persistence driver is required';
10
- }
11
- if (!VALID_DRIVERS.has(persistence.driver)) {
12
- return 'Persistence driver must be one of: database, redis, memory';
13
- }
14
- return null;
15
- };
16
- const validateRedis = (redis) => {
17
- if (!redis)
18
- return 'Redis configuration is required';
19
- // Validate env flag
20
- if (typeof redis.env !== 'boolean') {
21
- return 'Redis env flag must be a boolean';
22
- }
23
- // Validate required fields when not using env
24
- if (!redis.env) {
25
- const requiredFieldsError = validateRequiredRedisFields(redis);
26
- if (requiredFieldsError)
27
- return requiredFieldsError;
28
- }
29
- // Validate string fields
30
- return validateRedisStringFields(redis);
31
- };
32
- const validateRequiredRedisFields = (redis) => {
33
- if (!redis.host || typeof redis.host !== 'string') {
34
- return 'Redis host is required when env is false';
35
- }
36
- if (redis.port === undefined || redis.port === null) {
37
- return 'Redis port is required when env is false';
38
- }
39
- if (typeof redis.port !== 'string' && typeof redis.port !== 'number') {
40
- return 'Redis port must be a string or number';
41
- }
42
- if (!redis.db || typeof redis.db !== 'string') {
43
- return 'Redis db is required when env is false';
44
- }
45
- return null;
46
- };
47
- const validateRedisStringFields = (redis) => {
48
- if (redis.host && typeof redis.host !== 'string') {
49
- return 'Redis host must be a string';
50
- }
51
- if (redis.port && typeof redis.port !== 'string' && typeof redis.port !== 'number') {
52
- return 'Redis port must be a string or number';
53
- }
54
- if (redis.db && typeof redis.db !== 'string') {
55
- return 'Redis db must be a string';
56
- }
57
- if (redis.password && typeof redis.password !== 'string') {
58
- return 'Redis password must be a string';
59
- }
60
- return null;
61
- };
62
- const validateDeadLetterQueue = (deadLetterQueue) => {
63
- if (!deadLetterQueue)
64
- return 'DeadLetterQueue configuration is required';
65
- // Validate policy
66
- if (!deadLetterQueue.policy) {
67
- return 'DeadLetterQueue policy is required';
68
- }
69
- if (!VALID_DEAD_LETTER_POLICIES.has(deadLetterQueue.policy)) {
70
- return 'Policy must be one of: expire, retry, dead-letter';
71
- }
72
- return null;
73
- };
74
- const validateCompliance = (compliance) => {
75
- if (!compliance)
76
- return 'Compliance configuration is required';
77
- if (!compliance.config) {
78
- return 'Compliance config is required';
79
- }
80
- if (typeof compliance.config.retentionDays !== 'number' || compliance.config.retentionDays < 0) {
81
- return 'Retention days must be a non-negative number';
82
- }
83
- const MAX_RETENTION_DAYS = 3650; // ~10 years
84
- if (compliance.config.retentionDays > MAX_RETENTION_DAYS) {
85
- return `Retention days cannot exceed ${MAX_RETENTION_DAYS}`;
86
- }
87
- return null;
88
- };
89
- const validateObservability = (observability) => {
90
- if (!observability)
91
- return 'Observability configuration is required';
92
- if (typeof observability.enabled !== 'boolean') {
93
- return 'Observability enabled flag must be a boolean';
94
- }
95
- return null;
96
- };
97
- const validateAutoScaler = (autoScaler) => {
98
- if (!autoScaler)
99
- return 'AutoScaler configuration is required';
100
- if (typeof autoScaler.enabled !== 'boolean') {
101
- return 'AutoScaler enabled flag must be a boolean';
102
- }
103
- if (autoScaler.enabled) {
104
- const minWorkersError = validateWorkerCount(autoScaler.minWorkers, 'minWorkers');
105
- if (minWorkersError)
106
- return minWorkersError;
107
- const maxWorkersError = validateWorkerCount(autoScaler.maxWorkers, 'maxWorkers');
108
- if (maxWorkersError)
109
- return maxWorkersError;
110
- if (autoScaler.minWorkers > autoScaler.maxWorkers) {
111
- return 'AutoScaler minWorkers cannot be greater than maxWorkers';
112
- }
113
- const MAX_AUTOSCALER_WORKERS = 1000;
114
- if (autoScaler.maxWorkers > MAX_AUTOSCALER_WORKERS) {
115
- return `AutoScaler maxWorkers cannot exceed ${MAX_AUTOSCALER_WORKERS}`;
116
- }
117
- }
118
- return null;
119
- };
120
- const validateWorkerCount = (value, fieldName) => {
121
- if (typeof value !== 'number') {
122
- return `AutoScaler ${fieldName} must be a number`;
123
- }
124
- if (!Number.isInteger(value)) {
125
- return `AutoScaler ${fieldName} must be a whole number (integer)`;
126
- }
127
- if (value < 0) {
128
- return `AutoScaler ${fieldName} must be a non-negative number`;
129
- }
130
- return null;
131
- };
132
- const sanitizeInfrastructure = (infrastructure) => {
133
- return {
134
- ...infrastructure,
135
- autoScaler: {
136
- ...infrastructure.autoScaler,
137
- minWorkers: Math.floor(infrastructure.autoScaler.minWorkers),
138
- maxWorkers: Math.floor(infrastructure.autoScaler.maxWorkers),
139
- },
140
- };
141
- };
142
- export const withInfrastructureValidation = (handler) => {
143
- return async (req, res) => {
144
- try {
145
- const data = req.data();
146
- const infrastructure = data['infrastructure'];
147
- if (!infrastructure) {
148
- return res.setStatus(400).json({
149
- error: 'Infrastructure configuration is required',
150
- code: 'MISSING_INFRASTRUCTURE',
151
- });
152
- }
153
- // Validate persistence
154
- const persistenceError = validatePersistence(infrastructure.persistence);
155
- if (persistenceError) {
156
- return res.setStatus(400).json({
157
- error: 'Invalid persistence configuration',
158
- message: persistenceError,
159
- code: 'INVALID_PERSISTENCE_CONFIG',
160
- });
161
- }
162
- // Validate redis
163
- const redisError = validateRedis(infrastructure.redis);
164
- if (redisError) {
165
- return res.setStatus(400).json({
166
- error: 'Invalid redis configuration',
167
- message: redisError,
168
- code: 'INVALID_REDIS_CONFIG',
169
- });
170
- }
171
- // Validate deadLetterQueue
172
- const deadLetterQueueError = validateDeadLetterQueue(infrastructure.deadLetterQueue);
173
- if (deadLetterQueueError) {
174
- return res.setStatus(400).json({
175
- error: 'Invalid deadLetterQueue configuration',
176
- message: deadLetterQueueError,
177
- code: 'INVALID_DEAD_LETTER_QUEUE_CONFIG',
178
- });
179
- }
180
- // Validate compliance
181
- const complianceError = validateCompliance(infrastructure.compliance);
182
- if (complianceError) {
183
- return res.setStatus(400).json({
184
- error: 'Invalid compliance configuration',
185
- message: complianceError,
186
- code: 'INVALID_COMPLIANCE_CONFIG',
187
- });
188
- }
189
- // Validate observability
190
- const observabilityError = validateObservability(infrastructure.observability);
191
- if (observabilityError) {
192
- return res.setStatus(400).json({
193
- error: 'Invalid observability configuration',
194
- message: observabilityError,
195
- code: 'INVALID_OBSERVABILITY_CONFIG',
196
- });
197
- }
198
- // Validate autoScaler
199
- const autoScalerError = validateAutoScaler(infrastructure.autoScaler);
200
- if (autoScalerError) {
201
- return res.setStatus(400).json({
202
- error: 'Invalid autoScaler configuration',
203
- message: autoScalerError,
204
- code: 'INVALID_AUTO_SCALER_CONFIG',
205
- });
206
- }
207
- // Sanitize infrastructure values
208
- const currentBody = req.getBody();
209
- const sanitizedInfrastructure = sanitizeInfrastructure(infrastructure);
210
- // Update the infrastructure in the request body
211
- const updatedBody = {
212
- ...currentBody,
213
- infrastructure: sanitizedInfrastructure,
214
- };
215
- req.setBody(updatedBody);
216
- return handler(req, res);
217
- }
218
- catch (error) {
219
- Logger.error('Infrastructure validation failed', error);
220
- return res.setStatus(500).json({
221
- error: 'Internal validation error',
222
- code: 'VALIDATION_ERROR',
223
- });
224
- }
225
- };
226
- };
@@ -1,4 +0,0 @@
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 withOptionsValidation: (handler: RouteHandler) => RouteHandler;
4
- //# sourceMappingURL=OptionsValidator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OptionsValidator.d.ts","sourceRoot":"","sources":["../../../../../../packages/workers/src/http/middleware/OptionsValidator.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;AAqFnF,eAAO,MAAM,qBAAqB,GAAI,SAAS,YAAY,KAAG,YAwD7D,CAAC"}
@@ -1,112 +0,0 @@
1
- import { Logger } from '../../../../../src/index.js';
2
- const validateConcurrency = (concurrency) => {
3
- if (concurrency === undefined || concurrency === null) {
4
- return 'Concurrency is required';
5
- }
6
- if (typeof concurrency !== 'number') {
7
- return 'Concurrency must be a number';
8
- }
9
- if (!Number.isInteger(concurrency)) {
10
- return 'Concurrency must be a whole number (integer)';
11
- }
12
- if (concurrency < 1) {
13
- return 'Concurrency must be at least 1';
14
- }
15
- const MAX_CONCURRENCY = 200;
16
- if (concurrency > MAX_CONCURRENCY) {
17
- return `Concurrency cannot exceed ${MAX_CONCURRENCY}`;
18
- }
19
- return null;
20
- };
21
- const validateLimiter = (limiter) => {
22
- if (!limiter) {
23
- return 'Limiter configuration is required';
24
- }
25
- // Validate max
26
- if (limiter.max === undefined || limiter.max === null) {
27
- return 'Limiter max is required';
28
- }
29
- if (typeof limiter.max !== 'number') {
30
- return 'Limiter max must be a number';
31
- }
32
- if (!Number.isInteger(limiter.max)) {
33
- return 'Limiter max must be a whole number (integer)';
34
- }
35
- if (limiter.max < 1) {
36
- return 'Limiter max must be at least 1';
37
- }
38
- const MAX_LIMITER_MAX = 100000;
39
- if (limiter.max > MAX_LIMITER_MAX) {
40
- return `Limiter max cannot exceed ${MAX_LIMITER_MAX}`;
41
- }
42
- // Validate duration
43
- if (limiter.duration === undefined || limiter.duration === null) {
44
- return 'Limiter duration is required';
45
- }
46
- if (typeof limiter.duration !== 'number') {
47
- return 'Limiter duration must be a number';
48
- }
49
- if (!Number.isInteger(limiter.duration)) {
50
- return 'Limiter duration must be a whole number (integer)';
51
- }
52
- if (limiter.duration < 1000) {
53
- return 'Limiter duration must be at least 1000ms';
54
- }
55
- const MAX_LIMITER_DURATION = 24 * 60 * 60 * 1000; // 1 day
56
- if (limiter.duration > MAX_LIMITER_DURATION) {
57
- return `Limiter duration cannot exceed ${MAX_LIMITER_DURATION} ms`;
58
- }
59
- return null;
60
- };
61
- export const withOptionsValidation = (handler) => {
62
- return async (req, res) => {
63
- try {
64
- const data = req.data();
65
- const options = data['options'];
66
- if (!options) {
67
- return res.setStatus(400).json({
68
- error: 'Options configuration is required',
69
- code: 'MISSING_OPTIONS',
70
- });
71
- }
72
- // Validate concurrency
73
- const concurrencyError = validateConcurrency(options.concurrency);
74
- if (concurrencyError) {
75
- return res.setStatus(400).json({
76
- error: 'Invalid concurrency',
77
- message: concurrencyError,
78
- code: 'INVALID_CONCURRENCY',
79
- });
80
- }
81
- // Validate limiter
82
- const limiterError = validateLimiter(options.limiter);
83
- if (limiterError) {
84
- return res.setStatus(400).json({
85
- error: 'Invalid limiter configuration',
86
- message: limiterError,
87
- code: 'INVALID_LIMITER_CONFIG',
88
- });
89
- }
90
- // Sanitize concurrency to ensure it's an integer
91
- const currentBody = req.getBody();
92
- const sanitizedOptions = {
93
- ...options,
94
- concurrency: Math.floor(options.concurrency),
95
- limiter: {
96
- ...options.limiter,
97
- max: Math.floor(options.limiter.max),
98
- duration: Math.floor(options.limiter.duration),
99
- },
100
- };
101
- req.setBody({ ...currentBody, options: sanitizedOptions });
102
- return handler(req, res);
103
- }
104
- catch (error) {
105
- Logger.error('Options validation failed', error);
106
- return res.setStatus(500).json({
107
- error: 'Internal validation error',
108
- code: 'VALIDATION_ERROR',
109
- });
110
- }
111
- };
112
- };
@@ -1,8 +0,0 @@
1
- import { type IRequest, type IResponse } from '../../../../../src/index.js';
2
- export type RouteHandler = (req: IRequest, res: IResponse) => Promise<void> | void;
3
- /**
4
- * Middleware to strip unknown properties from the request body.
5
- * Only properties included in the allowedKeys list are preserved.
6
- */
7
- export declare const withStrictPayloadKeys: (allowedKeys: string[], handler: RouteHandler) => RouteHandler;
8
- //# sourceMappingURL=PayloadSanitizer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PayloadSanitizer.d.ts","sourceRoot":"","sources":["../../../../../../packages/workers/src/http/middleware/PayloadSanitizer.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;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAChC,aAAa,MAAM,EAAE,EACrB,SAAS,YAAY,KACpB,YAwCF,CAAC"}
@@ -1,42 +0,0 @@
1
- import { Logger } from '../../../../../src/index.js';
2
- /**
3
- * Middleware to strip unknown properties from the request body.
4
- * Only properties included in the allowedKeys list are preserved.
5
- */
6
- export const withStrictPayloadKeys = (allowedKeys, handler) => {
7
- const allowedSet = new Set(allowedKeys);
8
- return async (req, res) => {
9
- try {
10
- const data = req.data();
11
- if (!data || typeof data !== 'object' || Array.isArray(data)) {
12
- // If body is not an object, skip stripping or strictly enforce object?
13
- // For worker creation, it must be an object.
14
- // Let's rely on downstream validators to complain if data is missing/wrong type.
15
- return handler(req, res);
16
- }
17
- const body = data;
18
- const strippedBody = {};
19
- let hasUnknowns = false;
20
- for (const key of Object.keys(body)) {
21
- if (allowedSet.has(key)) {
22
- strippedBody[key] = body[key];
23
- }
24
- else {
25
- hasUnknowns = true;
26
- }
27
- }
28
- if (hasUnknowns) {
29
- // Update the body with sanitized version
30
- req.setBody(strippedBody);
31
- }
32
- return handler(req, res);
33
- }
34
- catch (error) {
35
- Logger.error('Strict payload validation failed', error);
36
- return res.setStatus(500).json({
37
- error: 'Internal validation error',
38
- code: 'VALIDATION_ERROR',
39
- });
40
- }
41
- };
42
- };
@@ -1,4 +0,0 @@
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 withProcessorPathValidation: (handler: RouteHandler) => RouteHandler;
4
- //# sourceMappingURL=ProcessorPathSanitizer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProcessorPathSanitizer.d.ts","sourceRoot":"","sources":["../../../../../../packages/workers/src/http/middleware/ProcessorPathSanitizer.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,QAAQ,EACb,KAAK,SAAS,EACf,MAAM,gBAAgB,CAAC;AAExB,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AA4GnF,eAAO,MAAM,2BAA2B,GAAI,SAAS,YAAY,KAAG,YAwDnE,CAAC"}
@@ -1,140 +0,0 @@
1
- import { Logger, NodeSingletons, workersConfig, } from '../../../../../src/index.js';
2
- const PROCESSOR_PATH_PATTERN = /^[a-zA-Z0-9/_.-]+\.(ts|js|mjs|cjs)$/;
3
- const isUrlSpec = (value) => {
4
- if (value.startsWith('url:'))
5
- return true;
6
- return value.includes('://');
7
- };
8
- const normalizeUrlSpec = (value) => {
9
- return value.startsWith('url:') ? value.slice(4) : value;
10
- };
11
- const isAllowedRemoteHost = (host) => {
12
- const allowlist = workersConfig.processorSpec.remoteAllowlist;
13
- return allowlist.map((value) => value.toLowerCase()).includes(host.toLowerCase());
14
- };
15
- const decodeProcessorPath = (processor) => {
16
- return processor
17
- .replaceAll('&#x2F;', '/') // HTML hex entity for /
18
- .replaceAll('%2F', '/') // URL encoding for /
19
- .replaceAll('&#x2E;', '.') // HTML hex entity for .
20
- .replaceAll('%2E', '.') // URL encoding for .
21
- .replaceAll('&#x5F;', '_') // HTML hex entity for _
22
- .replaceAll('%5F', '_') // URL encoding for _
23
- .replaceAll('&#x2D;', '-') // HTML hex entity for -
24
- .replaceAll('%2D', '-'); // URL encoding for -
25
- };
26
- const validateUrlSpec = (processor) => {
27
- const normalized = normalizeUrlSpec(processor);
28
- let parsed;
29
- try {
30
- parsed = new URL(normalized);
31
- }
32
- catch {
33
- return {
34
- isValid: false,
35
- error: { error: 'Invalid processor url', code: 'INVALID_PROCESSOR_URL' },
36
- };
37
- }
38
- if (parsed.protocol === 'file:') {
39
- const path = NodeSingletons.path;
40
- const baseDir = path.resolve(process.cwd());
41
- const resolved = path.resolve(baseDir, decodeURIComponent(parsed.pathname));
42
- if (!resolved.startsWith(baseDir)) {
43
- return {
44
- isValid: false,
45
- error: { error: 'Invalid processor path', code: 'INVALID_PROCESSOR_PATH_TRAVERSAL' },
46
- };
47
- }
48
- }
49
- else {
50
- if (parsed.protocol !== 'https:') {
51
- return {
52
- isValid: false,
53
- error: { error: 'Invalid processor url', code: 'INVALID_PROCESSOR_URL' },
54
- };
55
- }
56
- if (!isAllowedRemoteHost(parsed.host)) {
57
- return {
58
- isValid: false,
59
- error: { error: 'Invalid processor url host', code: 'INVALID_PROCESSOR_URL_HOST' },
60
- };
61
- }
62
- }
63
- return { isValid: true };
64
- };
65
- const validateRelativePath = (processor) => {
66
- if (processor.includes('..') || processor.startsWith('/')) {
67
- return {
68
- isValid: false,
69
- error: { error: 'Invalid processor path', code: 'INVALID_PROCESSOR_PATH' },
70
- };
71
- }
72
- if (!PROCESSOR_PATH_PATTERN.test(processor)) {
73
- return {
74
- isValid: false,
75
- error: { error: 'Invalid processor path', code: 'INVALID_PROCESSOR_EXTENSION' },
76
- };
77
- }
78
- return { isValid: true };
79
- };
80
- const sanitizeAndResolvePath = (processor) => {
81
- const sanitizedProcessor = processor.replaceAll(/[^a-zA-Z0-9/_.-]/g, '');
82
- const path = NodeSingletons.path;
83
- const baseDir = path.resolve(process.cwd());
84
- const resolved = path.resolve(baseDir, sanitizedProcessor);
85
- if (!resolved.startsWith(baseDir)) {
86
- return { isValid: false, sanitized: processor };
87
- }
88
- return { isValid: true, sanitized: sanitizedProcessor };
89
- };
90
- export const withProcessorPathValidation = (handler) => {
91
- return async (req, res) => {
92
- try {
93
- const data = req.data();
94
- let processor = data['processor'];
95
- if (!processor) {
96
- return res.setStatus(400).json({
97
- error: 'Processor spec is required',
98
- code: 'MISSING_PROCESSOR_SPEC',
99
- });
100
- }
101
- // Decode URL-encoded characters
102
- processor = decodeProcessorPath(processor);
103
- // Trim whitespace
104
- processor = processor.trim();
105
- const isUrl = isUrlSpec(processor);
106
- let validation;
107
- if (isUrl) {
108
- validation = validateUrlSpec(processor);
109
- }
110
- else {
111
- validation = validateRelativePath(processor);
112
- if (validation.isValid) {
113
- const pathValidation = sanitizeAndResolvePath(processor);
114
- if (pathValidation.isValid) {
115
- processor = pathValidation.sanitized;
116
- }
117
- else {
118
- validation = {
119
- isValid: false,
120
- error: { error: 'Invalid processor path', code: 'INVALID_PROCESSOR_PATH_TRAVERSAL' },
121
- };
122
- }
123
- }
124
- }
125
- if (!validation.isValid) {
126
- return res.setStatus(400).json(validation.error);
127
- }
128
- const currentBody = req.getBody();
129
- req.setBody({ ...currentBody, processor });
130
- return handler(req, res);
131
- }
132
- catch (error) {
133
- Logger.error('Processor path validation failed', error);
134
- return res.setStatus(500).json({
135
- error: 'Internal validation error',
136
- code: 'VALIDATION_ERROR',
137
- });
138
- }
139
- };
140
- };
@@ -1,4 +0,0 @@
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 withQueueNameValidation: (handler: RouteHandler) => RouteHandler;
4
- //# sourceMappingURL=QueueNameSanitizer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"QueueNameSanitizer.d.ts","sourceRoot":"","sources":["../../../../../../packages/workers/src/http/middleware/QueueNameSanitizer.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;AAInF,eAAO,MAAM,uBAAuB,GAAI,SAAS,YAAY,KAAG,YAgD/D,CAAC"}