@zintrust/core 0.4.28 → 0.4.30

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 (453) hide show
  1. package/bin/z.js +0 -0
  2. package/bin/zin.js +0 -0
  3. package/bin/zintrust.js +0 -0
  4. package/bin/zt.js +0 -0
  5. package/package.json +78 -23
  6. package/src/cli/commands/D1ProxyCommand.d.ts.map +1 -1
  7. package/src/cli/commands/D1ProxyCommand.js +69 -9
  8. package/src/cli/commands/KvProxyCommand.d.ts.map +1 -1
  9. package/src/cli/commands/KvProxyCommand.js +69 -9
  10. package/src/cli/commands/NewCommand.d.ts.map +1 -1
  11. package/src/cli/commands/NewCommand.js +8 -28
  12. package/src/cli/scaffolding/GovernanceScaffolder.d.ts.map +1 -1
  13. package/src/cli/scaffolding/GovernanceScaffolder.js +31 -4
  14. package/src/cli/scaffolding/ProjectScaffolder.d.ts.map +1 -1
  15. package/src/cli/scaffolding/ProjectScaffolder.js +31 -5
  16. package/src/cli/utils/DistPackager.d.ts +2 -2
  17. package/src/cli/utils/DistPackager.js +2 -2
  18. package/src/index.js +3 -3
  19. package/src/zintrust.plugins.js +1 -1
  20. package/app/Controllers/AuthController.d.ts +0 -10
  21. package/app/Controllers/AuthController.d.ts.map +0 -1
  22. package/app/Controllers/AuthController.js +0 -233
  23. package/app/Controllers/TestController.d.ts +0 -22
  24. package/app/Controllers/TestController.d.ts.map +0 -1
  25. package/app/Controllers/TestController.js +0 -188
  26. package/app/Controllers/UserController.d.ts +0 -9
  27. package/app/Controllers/UserController.d.ts.map +0 -1
  28. package/app/Controllers/UserController.js +0 -8
  29. package/app/Controllers/UserQueryBuilderController.d.ts +0 -16
  30. package/app/Controllers/UserQueryBuilderController.d.ts.map +0 -1
  31. package/app/Controllers/UserQueryBuilderController.js +0 -404
  32. package/app/Jobs/AdvancedEmailJobService.d.ts +0 -57
  33. package/app/Jobs/AdvancedEmailJobService.d.ts.map +0 -1
  34. package/app/Jobs/AdvancedEmailJobService.js +0 -185
  35. package/app/Jobs/EmailJobService.d.ts +0 -33
  36. package/app/Jobs/EmailJobService.d.ts.map +0 -1
  37. package/app/Jobs/EmailJobService.js +0 -113
  38. package/app/Middleware/AuthFailureResponder.d.ts +0 -3
  39. package/app/Middleware/AuthFailureResponder.d.ts.map +0 -1
  40. package/app/Middleware/AuthFailureResponder.js +0 -8
  41. package/app/Middleware/ProfilerMiddleware.d.ts +0 -12
  42. package/app/Middleware/ProfilerMiddleware.d.ts.map +0 -1
  43. package/app/Middleware/ProfilerMiddleware.js +0 -47
  44. package/app/Middleware/index.d.ts +0 -59
  45. package/app/Middleware/index.d.ts.map +0 -1
  46. package/app/Middleware/index.js +0 -216
  47. package/app/Models/Post.d.ts +0 -14
  48. package/app/Models/Post.d.ts.map +0 -1
  49. package/app/Models/Post.js +0 -27
  50. package/app/Models/User.d.ts +0 -14
  51. package/app/Models/User.d.ts.map +0 -1
  52. package/app/Models/User.js +0 -44
  53. package/app/Schedules/JobTracking.d.ts +0 -3
  54. package/app/Schedules/JobTracking.d.ts.map +0 -1
  55. package/app/Schedules/JobTracking.js +0 -13
  56. package/app/Schedules/index.d.ts +0 -2
  57. package/app/Schedules/index.d.ts.map +0 -1
  58. package/app/Schedules/index.js +0 -1
  59. package/app/Toolkit/Broadcast/sendBroadcast.d.ts +0 -6
  60. package/app/Toolkit/Broadcast/sendBroadcast.d.ts.map +0 -1
  61. package/app/Toolkit/Broadcast/sendBroadcast.js +0 -5
  62. package/app/Toolkit/Mail/sendWelcomeEmail.d.ts +0 -6
  63. package/app/Toolkit/Mail/sendWelcomeEmail.d.ts.map +0 -1
  64. package/app/Toolkit/Mail/sendWelcomeEmail.js +0 -20
  65. package/app/Toolkit/Notification/sendSlackNotification.d.ts +0 -8
  66. package/app/Toolkit/Notification/sendSlackNotification.d.ts.map +0 -1
  67. package/app/Toolkit/Notification/sendSlackNotification.js +0 -5
  68. package/app/Toolkit/Notification/sendSms.d.ts +0 -6
  69. package/app/Toolkit/Notification/sendSms.d.ts.map +0 -1
  70. package/app/Toolkit/Notification/sendSms.js +0 -5
  71. package/app/Types/controller.d.ts +0 -44
  72. package/app/Types/controller.d.ts.map +0 -1
  73. package/app/Types/controller.js +0 -1
  74. package/app/Workers/AdvancEmailWorker.d.ts +0 -44
  75. package/app/Workers/AdvancEmailWorker.d.ts.map +0 -1
  76. package/app/Workers/AdvancEmailWorker.js +0 -192
  77. package/app/Workers/EmailWorker.d.ts +0 -39
  78. package/app/Workers/EmailWorker.d.ts.map +0 -1
  79. package/app/Workers/EmailWorker.js +0 -199
  80. package/app/Workers/TestWorker.d.ts +0 -16
  81. package/app/Workers/TestWorker.d.ts.map +0 -1
  82. package/app/Workers/TestWorker.js +0 -153
  83. package/build-manifest.json +0 -6410
  84. package/config/broadcast.d.ts +0 -38
  85. package/config/broadcast.d.ts.map +0 -1
  86. package/config/broadcast.js +0 -37
  87. package/config/cache.d.ts +0 -40
  88. package/config/cache.d.ts.map +0 -1
  89. package/config/cache.js +0 -39
  90. package/config/database.d.ts +0 -58
  91. package/config/database.d.ts.map +0 -1
  92. package/config/database.js +0 -65
  93. package/config/mail.d.ts +0 -51
  94. package/config/mail.d.ts.map +0 -1
  95. package/config/mail.js +0 -69
  96. package/config/middleware.d.ts +0 -21
  97. package/config/middleware.d.ts.map +0 -1
  98. package/config/middleware.js +0 -61
  99. package/config/notification.d.ts +0 -33
  100. package/config/notification.d.ts.map +0 -1
  101. package/config/notification.js +0 -33
  102. package/config/queue.d.ts +0 -55
  103. package/config/queue.d.ts.map +0 -1
  104. package/config/queue.js +0 -87
  105. package/config/storage.d.ts +0 -59
  106. package/config/storage.d.ts.map +0 -1
  107. package/config/storage.js +0 -59
  108. package/config/workers.d.ts +0 -54
  109. package/config/workers.d.ts.map +0 -1
  110. package/config/workers.js +0 -83
  111. package/database/factories/UserFactory.d.ts +0 -40
  112. package/database/factories/UserFactory.d.ts.map +0 -1
  113. package/database/factories/UserFactory.js +0 -99
  114. package/database/migrations/20260109074544_create_users_table.d.ts +0 -7
  115. package/database/migrations/20260109074544_create_users_table.d.ts.map +0 -1
  116. package/database/migrations/20260109074544_create_users_table.js +0 -21
  117. package/database/migrations/20260109144731_create_tasks_table.d.ts +0 -7
  118. package/database/migrations/20260109144731_create_tasks_table.d.ts.map +0 -1
  119. package/database/migrations/20260109144731_create_tasks_table.js +0 -19
  120. package/database/migrations/20260109144735_add_done_tasks_table.d.ts +0 -11
  121. package/database/migrations/20260109144735_add_done_tasks_table.d.ts.map +0 -1
  122. package/database/migrations/20260109144735_add_done_tasks_table.js +0 -25
  123. package/database/migrations/20260109150837_add_start_tasks_table.d.ts +0 -11
  124. package/database/migrations/20260109150837_add_start_tasks_table.d.ts.map +0 -1
  125. package/database/migrations/20260109150837_add_start_tasks_table.js +0 -22
  126. package/database/migrations/20260109152114_add_way_tasks_table.d.ts +0 -11
  127. package/database/migrations/20260109152114_add_way_tasks_table.d.ts.map +0 -1
  128. package/database/migrations/20260109152114_add_way_tasks_table.js +0 -22
  129. package/database/migrations/20260218121500_create_jwt_revocations_table.d.ts +0 -7
  130. package/database/migrations/20260218121500_create_jwt_revocations_table.d.ts.map +0 -1
  131. package/database/migrations/20260218121500_create_jwt_revocations_table.js +0 -22
  132. package/database/migrations/20260222120000_add_kind_to_jwt_revocations_table.d.ts +0 -11
  133. package/database/migrations/20260222120000_add_kind_to_jwt_revocations_table.d.ts.map +0 -1
  134. package/database/migrations/20260222120000_add_kind_to_jwt_revocations_table.js +0 -20
  135. package/database/migrations/20260222123000_add_user_id_to_jwt_revocations_table.d.ts +0 -11
  136. package/database/migrations/20260222123000_add_user_id_to_jwt_revocations_table.d.ts.map +0 -1
  137. package/database/migrations/20260222123000_add_user_id_to_jwt_revocations_table.js +0 -20
  138. package/database/migrations/20260327112651_create_posts_table.d.ts +0 -11
  139. package/database/migrations/20260327112651_create_posts_table.d.ts.map +0 -1
  140. package/database/migrations/20260327112651_create_posts_table.js +0 -24
  141. package/database/seeders/DatabaseSeeder.d.ts +0 -5
  142. package/database/seeders/DatabaseSeeder.d.ts.map +0 -1
  143. package/database/seeders/DatabaseSeeder.js +0 -15
  144. package/database/seeders/UserSeeder.d.ts +0 -30
  145. package/database/seeders/UserSeeder.d.ts.map +0 -1
  146. package/database/seeders/UserSeeder.js +0 -97
  147. package/index.d.ts +0 -1
  148. package/index.js +0 -1
  149. package/packages/cache-redis/src/RedisProxyAdapter.d.ts +0 -6
  150. package/packages/cache-redis/src/RedisProxyAdapter.d.ts.map +0 -1
  151. package/packages/cache-redis/src/RedisProxyAdapter.js +0 -144
  152. package/packages/cache-redis/src/index.d.ts +0 -27
  153. package/packages/cache-redis/src/index.d.ts.map +0 -1
  154. package/packages/cache-redis/src/index.js +0 -153
  155. package/packages/db-d1/src/index.d.ts +0 -55
  156. package/packages/db-d1/src/index.d.ts.map +0 -1
  157. package/packages/db-d1/src/index.js +0 -118
  158. package/packages/db-d1/src/register.d.ts +0 -6
  159. package/packages/db-d1/src/register.d.ts.map +0 -1
  160. package/packages/db-d1/src/register.js +0 -8
  161. package/packages/db-mysql/src/common.d.ts +0 -7
  162. package/packages/db-mysql/src/common.d.ts.map +0 -1
  163. package/packages/db-mysql/src/common.js +0 -17
  164. package/packages/db-mysql/src/index.d.ts +0 -43
  165. package/packages/db-mysql/src/index.d.ts.map +0 -1
  166. package/packages/db-mysql/src/index.js +0 -265
  167. package/packages/db-mysql/src/register.d.ts +0 -6
  168. package/packages/db-mysql/src/register.d.ts.map +0 -1
  169. package/packages/db-mysql/src/register.js +0 -32
  170. package/packages/db-postgres/src/index.d.ts +0 -39
  171. package/packages/db-postgres/src/index.d.ts.map +0 -1
  172. package/packages/db-postgres/src/index.js +0 -179
  173. package/packages/db-postgres/src/register.d.ts +0 -6
  174. package/packages/db-postgres/src/register.d.ts.map +0 -1
  175. package/packages/db-postgres/src/register.js +0 -8
  176. package/packages/db-sqlite/src/index.d.ts +0 -9
  177. package/packages/db-sqlite/src/index.d.ts.map +0 -1
  178. package/packages/db-sqlite/src/index.js +0 -7
  179. package/packages/db-sqlite/src/register.d.ts +0 -6
  180. package/packages/db-sqlite/src/register.d.ts.map +0 -1
  181. package/packages/db-sqlite/src/register.js +0 -8
  182. package/packages/db-sqlserver/src/index.d.ts +0 -38
  183. package/packages/db-sqlserver/src/index.d.ts.map +0 -1
  184. package/packages/db-sqlserver/src/index.js +0 -73
  185. package/packages/db-sqlserver/src/register.d.ts +0 -6
  186. package/packages/db-sqlserver/src/register.d.ts.map +0 -1
  187. package/packages/db-sqlserver/src/register.js +0 -21
  188. package/packages/mail-sendgrid/src/register.d.ts +0 -6
  189. package/packages/mail-sendgrid/src/register.d.ts.map +0 -1
  190. package/packages/mail-sendgrid/src/register.js +0 -24
  191. package/packages/mail-smtp/src/register.d.ts +0 -6
  192. package/packages/mail-smtp/src/register.d.ts.map +0 -1
  193. package/packages/mail-smtp/src/register.js +0 -29
  194. package/packages/queue-monitor/src/QueueMonitoringService.d.ts +0 -35
  195. package/packages/queue-monitor/src/QueueMonitoringService.d.ts.map +0 -1
  196. package/packages/queue-monitor/src/QueueMonitoringService.js +0 -194
  197. package/packages/queue-monitor/src/connection.d.ts +0 -3
  198. package/packages/queue-monitor/src/connection.d.ts.map +0 -1
  199. package/packages/queue-monitor/src/connection.js +0 -1
  200. package/packages/queue-monitor/src/dashboard-ui.d.ts +0 -7
  201. package/packages/queue-monitor/src/dashboard-ui.d.ts.map +0 -1
  202. package/packages/queue-monitor/src/dashboard-ui.js +0 -997
  203. package/packages/queue-monitor/src/driver.d.ts +0 -15
  204. package/packages/queue-monitor/src/driver.d.ts.map +0 -1
  205. package/packages/queue-monitor/src/driver.js +0 -115
  206. package/packages/queue-monitor/src/index.d.ts +0 -71
  207. package/packages/queue-monitor/src/index.d.ts.map +0 -1
  208. package/packages/queue-monitor/src/index.js +0 -296
  209. package/packages/queue-monitor/src/metrics.d.ts +0 -27
  210. package/packages/queue-monitor/src/metrics.d.ts.map +0 -1
  211. package/packages/queue-monitor/src/metrics.js +0 -92
  212. package/packages/queue-monitor/src/worker.d.ts +0 -8
  213. package/packages/queue-monitor/src/worker.d.ts.map +0 -1
  214. package/packages/queue-monitor/src/worker.js +0 -35
  215. package/packages/queue-redis/src/BullMQRedisQueue.d.ts +0 -26
  216. package/packages/queue-redis/src/BullMQRedisQueue.d.ts.map +0 -1
  217. package/packages/queue-redis/src/BullMQRedisQueue.js +0 -465
  218. package/packages/queue-redis/src/HttpQueueDriver.d.ts +0 -18
  219. package/packages/queue-redis/src/HttpQueueDriver.d.ts.map +0 -1
  220. package/packages/queue-redis/src/HttpQueueDriver.js +0 -249
  221. package/packages/queue-redis/src/QueueHttpGateway.d.ts +0 -16
  222. package/packages/queue-redis/src/QueueHttpGateway.d.ts.map +0 -1
  223. package/packages/queue-redis/src/QueueHttpGateway.js +0 -217
  224. package/packages/queue-redis/src/RedisPublishClient.d.ts +0 -14
  225. package/packages/queue-redis/src/RedisPublishClient.d.ts.map +0 -1
  226. package/packages/queue-redis/src/RedisPublishClient.js +0 -251
  227. package/packages/queue-redis/src/index.d.ts +0 -12
  228. package/packages/queue-redis/src/index.d.ts.map +0 -1
  229. package/packages/queue-redis/src/index.js +0 -10
  230. package/packages/queue-redis/src/register.d.ts +0 -6
  231. package/packages/queue-redis/src/register.d.ts.map +0 -1
  232. package/packages/queue-redis/src/register.js +0 -21
  233. package/packages/workers/migrations/20260119100000_create_zintrust_workers_table.d.ts +0 -11
  234. package/packages/workers/migrations/20260119100000_create_zintrust_workers_table.d.ts.map +0 -1
  235. package/packages/workers/migrations/20260119100000_create_zintrust_workers_table.js +0 -32
  236. package/packages/workers/migrations/20260123180000_create_queue_jobs_table.d.ts +0 -11
  237. package/packages/workers/migrations/20260123180000_create_queue_jobs_table.d.ts.map +0 -1
  238. package/packages/workers/migrations/20260123180000_create_queue_jobs_table.js +0 -46
  239. package/packages/workers/migrations/20260213142000_create_zintrust_job_tracking_tables.d.ts +0 -7
  240. package/packages/workers/migrations/20260213142000_create_zintrust_job_tracking_tables.d.ts.map +0 -1
  241. package/packages/workers/migrations/20260213142000_create_zintrust_job_tracking_tables.js +0 -44
  242. package/packages/workers/migrations/20260213183000_expand_zintrust_job_tracking_reliability_tables.d.ts +0 -7
  243. package/packages/workers/migrations/20260213183000_expand_zintrust_job_tracking_reliability_tables.d.ts.map +0 -1
  244. package/packages/workers/migrations/20260213183000_expand_zintrust_job_tracking_reliability_tables.js +0 -104
  245. package/packages/workers/src/AnomalyDetection.d.ts +0 -107
  246. package/packages/workers/src/AnomalyDetection.d.ts.map +0 -1
  247. package/packages/workers/src/AnomalyDetection.js +0 -329
  248. package/packages/workers/src/AutoScaler.d.ts +0 -128
  249. package/packages/workers/src/AutoScaler.d.ts.map +0 -1
  250. package/packages/workers/src/AutoScaler.js +0 -425
  251. package/packages/workers/src/BroadcastWorker.d.ts +0 -29
  252. package/packages/workers/src/BroadcastWorker.d.ts.map +0 -1
  253. package/packages/workers/src/BroadcastWorker.js +0 -24
  254. package/packages/workers/src/CanaryController.d.ts +0 -104
  255. package/packages/workers/src/CanaryController.d.ts.map +0 -1
  256. package/packages/workers/src/CanaryController.js +0 -424
  257. package/packages/workers/src/ChaosEngineering.d.ts +0 -80
  258. package/packages/workers/src/ChaosEngineering.d.ts.map +0 -1
  259. package/packages/workers/src/ChaosEngineering.js +0 -229
  260. package/packages/workers/src/CircuitBreaker.d.ts +0 -107
  261. package/packages/workers/src/CircuitBreaker.d.ts.map +0 -1
  262. package/packages/workers/src/CircuitBreaker.js +0 -374
  263. package/packages/workers/src/ClusterLock.d.ts +0 -91
  264. package/packages/workers/src/ClusterLock.d.ts.map +0 -1
  265. package/packages/workers/src/ClusterLock.js +0 -397
  266. package/packages/workers/src/ComplianceManager.d.ts +0 -178
  267. package/packages/workers/src/ComplianceManager.d.ts.map +0 -1
  268. package/packages/workers/src/ComplianceManager.js +0 -556
  269. package/packages/workers/src/DatacenterOrchestrator.d.ts +0 -134
  270. package/packages/workers/src/DatacenterOrchestrator.d.ts.map +0 -1
  271. package/packages/workers/src/DatacenterOrchestrator.js +0 -404
  272. package/packages/workers/src/DeadLetterQueue.d.ts +0 -123
  273. package/packages/workers/src/DeadLetterQueue.d.ts.map +0 -1
  274. package/packages/workers/src/DeadLetterQueue.js +0 -544
  275. package/packages/workers/src/HealthMonitor.d.ts +0 -43
  276. package/packages/workers/src/HealthMonitor.d.ts.map +0 -1
  277. package/packages/workers/src/HealthMonitor.js +0 -312
  278. package/packages/workers/src/MultiQueueWorker.d.ts +0 -90
  279. package/packages/workers/src/MultiQueueWorker.d.ts.map +0 -1
  280. package/packages/workers/src/MultiQueueWorker.js +0 -282
  281. package/packages/workers/src/NotificationWorker.d.ts +0 -29
  282. package/packages/workers/src/NotificationWorker.d.ts.map +0 -1
  283. package/packages/workers/src/NotificationWorker.js +0 -23
  284. package/packages/workers/src/Observability.d.ts +0 -154
  285. package/packages/workers/src/Observability.d.ts.map +0 -1
  286. package/packages/workers/src/Observability.js +0 -538
  287. package/packages/workers/src/PluginManager.d.ts +0 -124
  288. package/packages/workers/src/PluginManager.d.ts.map +0 -1
  289. package/packages/workers/src/PluginManager.js +0 -392
  290. package/packages/workers/src/PriorityQueue.d.ts +0 -118
  291. package/packages/workers/src/PriorityQueue.d.ts.map +0 -1
  292. package/packages/workers/src/PriorityQueue.js +0 -276
  293. package/packages/workers/src/ResourceMonitor.d.ts +0 -165
  294. package/packages/workers/src/ResourceMonitor.d.ts.map +0 -1
  295. package/packages/workers/src/ResourceMonitor.js +0 -632
  296. package/packages/workers/src/SLAMonitor.d.ts +0 -111
  297. package/packages/workers/src/SLAMonitor.d.ts.map +0 -1
  298. package/packages/workers/src/SLAMonitor.js +0 -274
  299. package/packages/workers/src/WorkerFactory.d.ts +0 -226
  300. package/packages/workers/src/WorkerFactory.d.ts.map +0 -1
  301. package/packages/workers/src/WorkerFactory.js +0 -2551
  302. package/packages/workers/src/WorkerInit.d.ts +0 -103
  303. package/packages/workers/src/WorkerInit.d.ts.map +0 -1
  304. package/packages/workers/src/WorkerInit.js +0 -359
  305. package/packages/workers/src/WorkerMetrics.d.ts +0 -116
  306. package/packages/workers/src/WorkerMetrics.d.ts.map +0 -1
  307. package/packages/workers/src/WorkerMetrics.js +0 -570
  308. package/packages/workers/src/WorkerRegistry.d.ts +0 -152
  309. package/packages/workers/src/WorkerRegistry.d.ts.map +0 -1
  310. package/packages/workers/src/WorkerRegistry.js +0 -396
  311. package/packages/workers/src/WorkerShutdown.d.ts +0 -70
  312. package/packages/workers/src/WorkerShutdown.d.ts.map +0 -1
  313. package/packages/workers/src/WorkerShutdown.js +0 -185
  314. package/packages/workers/src/WorkerVersioning.d.ts +0 -108
  315. package/packages/workers/src/WorkerVersioning.d.ts.map +0 -1
  316. package/packages/workers/src/WorkerVersioning.js +0 -300
  317. package/packages/workers/src/config/workerConfig.d.ts +0 -5
  318. package/packages/workers/src/config/workerConfig.d.ts.map +0 -1
  319. package/packages/workers/src/config/workerConfig.js +0 -25
  320. package/packages/workers/src/createQueueWorker.d.ts +0 -31
  321. package/packages/workers/src/createQueueWorker.d.ts.map +0 -1
  322. package/packages/workers/src/createQueueWorker.js +0 -382
  323. package/packages/workers/src/dashboard/index.d.ts +0 -2
  324. package/packages/workers/src/dashboard/index.d.ts.map +0 -1
  325. package/packages/workers/src/dashboard/index.js +0 -1
  326. package/packages/workers/src/dashboard/types.d.ts +0 -123
  327. package/packages/workers/src/dashboard/types.d.ts.map +0 -1
  328. package/packages/workers/src/dashboard/types.js +0 -1
  329. package/packages/workers/src/dashboard/workers-api.d.ts +0 -5
  330. package/packages/workers/src/dashboard/workers-api.d.ts.map +0 -1
  331. package/packages/workers/src/dashboard/workers-api.js +0 -776
  332. package/packages/workers/src/helper/index.d.ts +0 -6
  333. package/packages/workers/src/helper/index.d.ts.map +0 -1
  334. package/packages/workers/src/helper/index.js +0 -10
  335. package/packages/workers/src/http/WorkerApiController.d.ts +0 -39
  336. package/packages/workers/src/http/WorkerApiController.d.ts.map +0 -1
  337. package/packages/workers/src/http/WorkerApiController.js +0 -313
  338. package/packages/workers/src/http/WorkerController.d.ts +0 -375
  339. package/packages/workers/src/http/WorkerController.d.ts.map +0 -1
  340. package/packages/workers/src/http/WorkerController.js +0 -1454
  341. package/packages/workers/src/http/WorkerMonitoringService.d.ts +0 -12
  342. package/packages/workers/src/http/WorkerMonitoringService.d.ts.map +0 -1
  343. package/packages/workers/src/http/WorkerMonitoringService.js +0 -89
  344. package/packages/workers/src/http/middleware/CustomValidation.d.ts +0 -93
  345. package/packages/workers/src/http/middleware/CustomValidation.d.ts.map +0 -1
  346. package/packages/workers/src/http/middleware/CustomValidation.js +0 -270
  347. package/packages/workers/src/http/middleware/DatacenterValidator.d.ts +0 -4
  348. package/packages/workers/src/http/middleware/DatacenterValidator.d.ts.map +0 -1
  349. package/packages/workers/src/http/middleware/DatacenterValidator.js +0 -94
  350. package/packages/workers/src/http/middleware/EditWorkerValidation.d.ts +0 -8
  351. package/packages/workers/src/http/middleware/EditWorkerValidation.d.ts.map +0 -1
  352. package/packages/workers/src/http/middleware/EditWorkerValidation.js +0 -56
  353. package/packages/workers/src/http/middleware/FeaturesValidator.d.ts +0 -4
  354. package/packages/workers/src/http/middleware/FeaturesValidator.d.ts.map +0 -1
  355. package/packages/workers/src/http/middleware/FeaturesValidator.js +0 -61
  356. package/packages/workers/src/http/middleware/InfrastructureValidator.d.ts +0 -32
  357. package/packages/workers/src/http/middleware/InfrastructureValidator.d.ts.map +0 -1
  358. package/packages/workers/src/http/middleware/InfrastructureValidator.js +0 -226
  359. package/packages/workers/src/http/middleware/OptionsValidator.d.ts +0 -4
  360. package/packages/workers/src/http/middleware/OptionsValidator.d.ts.map +0 -1
  361. package/packages/workers/src/http/middleware/OptionsValidator.js +0 -112
  362. package/packages/workers/src/http/middleware/PayloadSanitizer.d.ts +0 -8
  363. package/packages/workers/src/http/middleware/PayloadSanitizer.d.ts.map +0 -1
  364. package/packages/workers/src/http/middleware/PayloadSanitizer.js +0 -42
  365. package/packages/workers/src/http/middleware/ProcessorPathSanitizer.d.ts +0 -4
  366. package/packages/workers/src/http/middleware/ProcessorPathSanitizer.d.ts.map +0 -1
  367. package/packages/workers/src/http/middleware/ProcessorPathSanitizer.js +0 -140
  368. package/packages/workers/src/http/middleware/QueueNameSanitizer.d.ts +0 -4
  369. package/packages/workers/src/http/middleware/QueueNameSanitizer.d.ts.map +0 -1
  370. package/packages/workers/src/http/middleware/QueueNameSanitizer.js +0 -45
  371. package/packages/workers/src/http/middleware/ValidateDriver.d.ts +0 -8
  372. package/packages/workers/src/http/middleware/ValidateDriver.d.ts.map +0 -1
  373. package/packages/workers/src/http/middleware/ValidateDriver.js +0 -20
  374. package/packages/workers/src/http/middleware/VersionSanitizer.d.ts +0 -4
  375. package/packages/workers/src/http/middleware/VersionSanitizer.d.ts.map +0 -1
  376. package/packages/workers/src/http/middleware/VersionSanitizer.js +0 -25
  377. package/packages/workers/src/http/middleware/WorkerNameSanitizer.d.ts +0 -4
  378. package/packages/workers/src/http/middleware/WorkerNameSanitizer.d.ts.map +0 -1
  379. package/packages/workers/src/http/middleware/WorkerNameSanitizer.js +0 -46
  380. package/packages/workers/src/http/middleware/WorkerValidationChain.d.ts +0 -28
  381. package/packages/workers/src/http/middleware/WorkerValidationChain.d.ts.map +0 -1
  382. package/packages/workers/src/http/middleware/WorkerValidationChain.js +0 -186
  383. package/packages/workers/src/index.d.ts +0 -47
  384. package/packages/workers/src/index.d.ts.map +0 -1
  385. package/packages/workers/src/index.js +0 -48
  386. package/packages/workers/src/register.d.ts +0 -10
  387. package/packages/workers/src/register.d.ts.map +0 -1
  388. package/packages/workers/src/register.js +0 -43
  389. package/packages/workers/src/routes/workers.d.ts +0 -13
  390. package/packages/workers/src/routes/workers.d.ts.map +0 -1
  391. package/packages/workers/src/routes/workers.js +0 -126
  392. package/packages/workers/src/storage/WorkerStore.d.ts +0 -52
  393. package/packages/workers/src/storage/WorkerStore.d.ts.map +0 -1
  394. package/packages/workers/src/storage/WorkerStore.js +0 -259
  395. package/packages/workers/src/telemetry/api/TelemetryAPI.d.ts +0 -47
  396. package/packages/workers/src/telemetry/api/TelemetryAPI.d.ts.map +0 -1
  397. package/packages/workers/src/telemetry/api/TelemetryAPI.js +0 -219
  398. package/packages/workers/src/telemetry/api/TelemetryMonitoringService.d.ts +0 -18
  399. package/packages/workers/src/telemetry/api/TelemetryMonitoringService.d.ts.map +0 -1
  400. package/packages/workers/src/telemetry/api/TelemetryMonitoringService.js +0 -140
  401. package/packages/workers/src/telemetry/components/AlertPanel.d.ts +0 -2
  402. package/packages/workers/src/telemetry/components/AlertPanel.d.ts.map +0 -1
  403. package/packages/workers/src/telemetry/components/AlertPanel.js +0 -13
  404. package/packages/workers/src/telemetry/components/CostTracking.d.ts +0 -2
  405. package/packages/workers/src/telemetry/components/CostTracking.d.ts.map +0 -1
  406. package/packages/workers/src/telemetry/components/CostTracking.js +0 -14
  407. package/packages/workers/src/telemetry/components/ResourceUsageChart.d.ts +0 -2
  408. package/packages/workers/src/telemetry/components/ResourceUsageChart.d.ts.map +0 -1
  409. package/packages/workers/src/telemetry/components/ResourceUsageChart.js +0 -11
  410. package/packages/workers/src/telemetry/components/WorkerHealthChart.d.ts +0 -2
  411. package/packages/workers/src/telemetry/components/WorkerHealthChart.d.ts.map +0 -1
  412. package/packages/workers/src/telemetry/components/WorkerHealthChart.js +0 -11
  413. package/packages/workers/src/telemetry/index.d.ts +0 -16
  414. package/packages/workers/src/telemetry/index.d.ts.map +0 -1
  415. package/packages/workers/src/telemetry/index.js +0 -60
  416. package/packages/workers/src/telemetry/routes/dashboard.d.ts +0 -7
  417. package/packages/workers/src/telemetry/routes/dashboard.d.ts.map +0 -1
  418. package/packages/workers/src/telemetry/routes/dashboard.js +0 -608
  419. package/packages/workers/src/type.d.ts +0 -77
  420. package/packages/workers/src/type.d.ts.map +0 -1
  421. package/packages/workers/src/type.js +0 -1
  422. package/packages/workers/src/ui/router/EmbeddedAssets.d.ts +0 -5
  423. package/packages/workers/src/ui/router/EmbeddedAssets.d.ts.map +0 -1
  424. package/packages/workers/src/ui/router/EmbeddedAssets.js +0 -13
  425. package/packages/workers/src/ui/router/ui.d.ts +0 -4
  426. package/packages/workers/src/ui/router/ui.d.ts.map +0 -1
  427. package/packages/workers/src/ui/router/ui.js +0 -208
  428. package/packages/workers/src/ui/types/worker-ui.d.ts +0 -230
  429. package/packages/workers/src/ui/types/worker-ui.d.ts.map +0 -1
  430. package/packages/workers/src/ui/types/worker-ui.js +0 -5
  431. package/routes/DirectTestRoutes.d.ts +0 -25
  432. package/routes/DirectTestRoutes.d.ts.map +0 -1
  433. package/routes/DirectTestRoutes.js +0 -480
  434. package/routes/TestRoutes.d.ts +0 -11
  435. package/routes/TestRoutes.d.ts.map +0 -1
  436. package/routes/TestRoutes.js +0 -25
  437. package/routes/api.d.ts +0 -7
  438. package/routes/api.d.ts.map +0 -1
  439. package/routes/api.js +0 -136
  440. package/routes/apiDev.d.ts +0 -7
  441. package/routes/apiDev.d.ts.map +0 -1
  442. package/routes/apiDev.js +0 -92
  443. package/routes/broadcast.d.ts +0 -9
  444. package/routes/broadcast.d.ts.map +0 -1
  445. package/routes/broadcast.js +0 -27
  446. package/routes/mail.d.ts +0 -12
  447. package/routes/mail.d.ts.map +0 -1
  448. package/routes/mail.js +0 -138
  449. package/routes/storage.d.ts +0 -4
  450. package/routes/storage.d.ts.map +0 -1
  451. package/routes/storage.js +0 -35
  452. package/start.d.ts +0 -1
  453. package/start.js +0 -1
@@ -1,12 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,89 +0,0 @@
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
- });
@@ -1,93 +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 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
@@ -1 +0,0 @@
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"}
@@ -1,270 +0,0 @@
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
- };
@@ -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 withDatacenterValidation: (handler: RouteHandler) => RouteHandler;
4
- //# sourceMappingURL=DatacenterValidator.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,94 +0,0 @@
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
- };
@@ -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
- * 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
@@ -1 +0,0 @@
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"}
@@ -1,56 +0,0 @@
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
- };
@@ -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 withFeaturesValidation: (handler: RouteHandler) => RouteHandler;
4
- //# sourceMappingURL=FeaturesValidator.d.ts.map
@@ -1 +0,0 @@
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;AAgBnF,eAAO,MAAM,sBAAsB,GAAI,SAAS,YAAY,KAAG,YAoD9D,CAAC"}