@tachybase/plugin-adapter-bullmq 0.23.8

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 (644) hide show
  1. package/.turbo/turbo-build.log +3 -0
  2. package/README.md +1 -0
  3. package/client.d.ts +2 -0
  4. package/client.js +1 -0
  5. package/dist/client/index.d.ts +4 -0
  6. package/dist/client/index.js +1 -0
  7. package/dist/externalVersion.js +4 -0
  8. package/dist/index.d.ts +2 -0
  9. package/dist/index.js +39 -0
  10. package/dist/node_modules/@bull-board/api/bullAdapter.d.ts +1 -0
  11. package/dist/node_modules/@bull-board/api/bullAdapter.js +1 -0
  12. package/dist/node_modules/@bull-board/api/bullMQAdapter.d.ts +1 -0
  13. package/dist/node_modules/@bull-board/api/bullMQAdapter.js +1 -0
  14. package/dist/node_modules/@bull-board/api/dist/src/constants/statuses.d.ts +11 -0
  15. package/dist/node_modules/@bull-board/api/dist/src/constants/statuses.js +15 -0
  16. package/dist/node_modules/@bull-board/api/dist/src/handlers/addJob.d.ts +2 -0
  17. package/dist/node_modules/@bull-board/api/dist/src/handlers/addJob.js +18 -0
  18. package/dist/node_modules/@bull-board/api/dist/src/handlers/cleanAll.d.ts +2 -0
  19. package/dist/node_modules/@bull-board/api/dist/src/handlers/cleanAll.js +15 -0
  20. package/dist/node_modules/@bull-board/api/dist/src/handlers/cleanJob.d.ts +2 -0
  21. package/dist/node_modules/@bull-board/api/dist/src/handlers/cleanJob.js +14 -0
  22. package/dist/node_modules/@bull-board/api/dist/src/handlers/emptyQueue.d.ts +2 -0
  23. package/dist/node_modules/@bull-board/api/dist/src/handlers/emptyQueue.js +10 -0
  24. package/dist/node_modules/@bull-board/api/dist/src/handlers/entryPoint.d.ts +5 -0
  25. package/dist/node_modules/@bull-board/api/dist/src/handlers/entryPoint.js +21 -0
  26. package/dist/node_modules/@bull-board/api/dist/src/handlers/error.d.ts +2 -0
  27. package/dist/node_modules/@bull-board/api/dist/src/handlers/error.js +14 -0
  28. package/dist/node_modules/@bull-board/api/dist/src/handlers/job.d.ts +2 -0
  29. package/dist/node_modules/@bull-board/api/dist/src/handlers/job.js +20 -0
  30. package/dist/node_modules/@bull-board/api/dist/src/handlers/jobLogs.d.ts +2 -0
  31. package/dist/node_modules/@bull-board/api/dist/src/handlers/jobLogs.js +16 -0
  32. package/dist/node_modules/@bull-board/api/dist/src/handlers/pauseQueue.d.ts +2 -0
  33. package/dist/node_modules/@bull-board/api/dist/src/handlers/pauseQueue.js +10 -0
  34. package/dist/node_modules/@bull-board/api/dist/src/handlers/promotJob.d.ts +2 -0
  35. package/dist/node_modules/@bull-board/api/dist/src/handlers/promotJob.js +14 -0
  36. package/dist/node_modules/@bull-board/api/dist/src/handlers/promoteAll.d.ts +2 -0
  37. package/dist/node_modules/@bull-board/api/dist/src/handlers/promoteAll.js +10 -0
  38. package/dist/node_modules/@bull-board/api/dist/src/handlers/queues.d.ts +4 -0
  39. package/dist/node_modules/@bull-board/api/dist/src/handlers/queues.js +76 -0
  40. package/dist/node_modules/@bull-board/api/dist/src/handlers/redisStats.d.ts +2 -0
  41. package/dist/node_modules/@bull-board/api/dist/src/handlers/redisStats.js +33 -0
  42. package/dist/node_modules/@bull-board/api/dist/src/handlers/resumeQueue.d.ts +2 -0
  43. package/dist/node_modules/@bull-board/api/dist/src/handlers/resumeQueue.js +10 -0
  44. package/dist/node_modules/@bull-board/api/dist/src/handlers/retryAll.d.ts +2 -0
  45. package/dist/node_modules/@bull-board/api/dist/src/handlers/retryAll.js +12 -0
  46. package/dist/node_modules/@bull-board/api/dist/src/handlers/retryJob.d.ts +2 -0
  47. package/dist/node_modules/@bull-board/api/dist/src/handlers/retryJob.js +15 -0
  48. package/dist/node_modules/@bull-board/api/dist/src/handlers/updateJobData.d.ts +2 -0
  49. package/dist/node_modules/@bull-board/api/dist/src/handlers/updateJobData.js +20 -0
  50. package/dist/node_modules/@bull-board/api/dist/src/index.d.ts +12 -0
  51. package/dist/node_modules/@bull-board/api/dist/src/index.js +1 -0
  52. package/dist/node_modules/@bull-board/api/dist/src/providers/job.d.ts +3 -0
  53. package/dist/node_modules/@bull-board/api/dist/src/providers/job.js +19 -0
  54. package/dist/node_modules/@bull-board/api/dist/src/providers/queue.d.ts +5 -0
  55. package/dist/node_modules/@bull-board/api/dist/src/providers/queue.js +20 -0
  56. package/dist/node_modules/@bull-board/api/dist/src/queueAdapters/base.d.ts +31 -0
  57. package/dist/node_modules/@bull-board/api/dist/src/queueAdapters/base.js +27 -0
  58. package/dist/node_modules/@bull-board/api/dist/src/queueAdapters/bull.d.ts +23 -0
  59. package/dist/node_modules/@bull-board/api/dist/src/queueAdapters/bull.js +87 -0
  60. package/dist/node_modules/@bull-board/api/dist/src/queueAdapters/bullMQ.d.ts +22 -0
  61. package/dist/node_modules/@bull-board/api/dist/src/queueAdapters/bullMQ.js +91 -0
  62. package/dist/node_modules/@bull-board/api/dist/src/queuesApi.d.ts +9 -0
  63. package/dist/node_modules/@bull-board/api/dist/src/queuesApi.js +32 -0
  64. package/dist/node_modules/@bull-board/api/dist/src/routes.d.ts +2 -0
  65. package/dist/node_modules/@bull-board/api/dist/src/routes.js +96 -0
  66. package/dist/node_modules/@bull-board/api/dist/typings/app.d.ts +203 -0
  67. package/dist/node_modules/@bull-board/api/dist/typings/app.js +3 -0
  68. package/dist/node_modules/@bull-board/api/dist/typings/responses.d.ts +8 -0
  69. package/dist/node_modules/@bull-board/api/dist/typings/responses.js +3 -0
  70. package/dist/node_modules/@bull-board/api/dist/typings/utils.d.ts +1 -0
  71. package/dist/node_modules/@bull-board/api/dist/typings/utils.js +3 -0
  72. package/dist/node_modules/@bull-board/api/package.json +1 -0
  73. package/dist/node_modules/@bull-board/koa/dist/KoaAdapter.d.ts +23 -0
  74. package/dist/node_modules/@bull-board/koa/dist/KoaAdapter.js +125 -0
  75. package/dist/node_modules/@bull-board/koa/dist/index.d.ts +1 -0
  76. package/dist/node_modules/@bull-board/koa/dist/index.js +415 -0
  77. package/dist/node_modules/@bull-board/koa/node_modules/.bin/ejs +17 -0
  78. package/dist/node_modules/@bull-board/koa/package.json +1 -0
  79. package/dist/node_modules/bullmq/LICENSE +21 -0
  80. package/dist/node_modules/bullmq/dist/cjs/classes/async-fifo-queue.js +129 -0
  81. package/dist/node_modules/bullmq/dist/cjs/classes/backoffs.js +48 -0
  82. package/dist/node_modules/bullmq/dist/cjs/classes/child-pool.js +71 -0
  83. package/dist/node_modules/bullmq/dist/cjs/classes/child-processor.js +154 -0
  84. package/dist/node_modules/bullmq/dist/cjs/classes/child.js +210 -0
  85. package/dist/node_modules/bullmq/dist/cjs/classes/errors/delayed-error.js +20 -0
  86. package/dist/node_modules/bullmq/dist/cjs/classes/errors/index.js +8 -0
  87. package/dist/node_modules/bullmq/dist/cjs/classes/errors/rate-limit-error.js +19 -0
  88. package/dist/node_modules/bullmq/dist/cjs/classes/errors/unrecoverable-error.js +20 -0
  89. package/dist/node_modules/bullmq/dist/cjs/classes/errors/waiting-children-error.js +20 -0
  90. package/dist/node_modules/bullmq/dist/cjs/classes/flow-producer.js +339 -0
  91. package/dist/node_modules/bullmq/dist/cjs/classes/index.js +25 -0
  92. package/dist/node_modules/bullmq/dist/cjs/classes/job-scheduler.js +221 -0
  93. package/dist/node_modules/bullmq/dist/cjs/classes/job.js +893 -0
  94. package/dist/node_modules/bullmq/dist/cjs/classes/main-base.js +44 -0
  95. package/dist/node_modules/bullmq/dist/cjs/classes/main-worker.d.ts +1 -0
  96. package/dist/node_modules/bullmq/dist/cjs/classes/main-worker.js +10 -0
  97. package/dist/node_modules/bullmq/dist/cjs/classes/main.d.ts +1 -0
  98. package/dist/node_modules/bullmq/dist/cjs/classes/main.js +10 -0
  99. package/dist/node_modules/bullmq/dist/cjs/classes/queue-base.js +155 -0
  100. package/dist/node_modules/bullmq/dist/cjs/classes/queue-events-producer.js +42 -0
  101. package/dist/node_modules/bullmq/dist/cjs/classes/queue-events.js +125 -0
  102. package/dist/node_modules/bullmq/dist/cjs/classes/queue-getters.js +450 -0
  103. package/dist/node_modules/bullmq/dist/cjs/classes/queue-keys.js +43 -0
  104. package/dist/node_modules/bullmq/dist/cjs/classes/queue.js +635 -0
  105. package/dist/node_modules/bullmq/dist/cjs/classes/redis-connection.js +270 -0
  106. package/dist/node_modules/bullmq/dist/cjs/classes/repeat.js +204 -0
  107. package/dist/node_modules/bullmq/dist/cjs/classes/sandbox.js +75 -0
  108. package/dist/node_modules/bullmq/dist/cjs/classes/scripts.js +1035 -0
  109. package/dist/node_modules/bullmq/dist/cjs/classes/worker.js +819 -0
  110. package/dist/node_modules/bullmq/dist/cjs/commands/addDelayedJob-6.lua +119 -0
  111. package/dist/node_modules/bullmq/dist/cjs/commands/addJobScheduler-2.lua +91 -0
  112. package/dist/node_modules/bullmq/dist/cjs/commands/addLog-2.lua +30 -0
  113. package/dist/node_modules/bullmq/dist/cjs/commands/addParentJob-4.lua +104 -0
  114. package/dist/node_modules/bullmq/dist/cjs/commands/addPrioritizedJob-8.lua +117 -0
  115. package/dist/node_modules/bullmq/dist/cjs/commands/addRepeatableJob-2.lua +84 -0
  116. package/dist/node_modules/bullmq/dist/cjs/commands/addStandardJob-8.lua +122 -0
  117. package/dist/node_modules/bullmq/dist/cjs/commands/changeDelay-4.lua +55 -0
  118. package/dist/node_modules/bullmq/dist/cjs/commands/changePriority-7.lua +68 -0
  119. package/dist/node_modules/bullmq/dist/cjs/commands/cleanJobsInSet-3.lua +55 -0
  120. package/dist/node_modules/bullmq/dist/cjs/commands/drain-5.lua +41 -0
  121. package/dist/node_modules/bullmq/dist/cjs/commands/extendLock-2.lua +23 -0
  122. package/dist/node_modules/bullmq/dist/cjs/commands/extendLocks-1.lua +44 -0
  123. package/dist/node_modules/bullmq/dist/cjs/commands/getCounts-1.lua +36 -0
  124. package/dist/node_modules/bullmq/dist/cjs/commands/getCountsPerPriority-4.lua +35 -0
  125. package/dist/node_modules/bullmq/dist/cjs/commands/getJobScheduler-1.lua +19 -0
  126. package/dist/node_modules/bullmq/dist/cjs/commands/getRanges-1.lua +70 -0
  127. package/dist/node_modules/bullmq/dist/cjs/commands/getRateLimitTtl-1.lua +20 -0
  128. package/dist/node_modules/bullmq/dist/cjs/commands/getState-8.lua +65 -0
  129. package/dist/node_modules/bullmq/dist/cjs/commands/getStateV2-8.lua +58 -0
  130. package/dist/node_modules/bullmq/dist/cjs/commands/includes/addBaseMarkerIfNeeded.lua +9 -0
  131. package/dist/node_modules/bullmq/dist/cjs/commands/includes/addDelayMarkerIfNeeded.lua +15 -0
  132. package/dist/node_modules/bullmq/dist/cjs/commands/includes/addJobInTargetList.lua +11 -0
  133. package/dist/node_modules/bullmq/dist/cjs/commands/includes/addJobWithPriority.lua +14 -0
  134. package/dist/node_modules/bullmq/dist/cjs/commands/includes/batches.lua +18 -0
  135. package/dist/node_modules/bullmq/dist/cjs/commands/includes/checkItemInList.lua +12 -0
  136. package/dist/node_modules/bullmq/dist/cjs/commands/includes/cleanList.lua +47 -0
  137. package/dist/node_modules/bullmq/dist/cjs/commands/includes/cleanSet.lua +66 -0
  138. package/dist/node_modules/bullmq/dist/cjs/commands/includes/collectMetrics.lua +46 -0
  139. package/dist/node_modules/bullmq/dist/cjs/commands/includes/deduplicateJob.lua +24 -0
  140. package/dist/node_modules/bullmq/dist/cjs/commands/includes/destructureJobKey.lua +12 -0
  141. package/dist/node_modules/bullmq/dist/cjs/commands/includes/findPage.lua +70 -0
  142. package/dist/node_modules/bullmq/dist/cjs/commands/includes/getDelayedScore.lua +25 -0
  143. package/dist/node_modules/bullmq/dist/cjs/commands/includes/getJobsInZset.lua +13 -0
  144. package/dist/node_modules/bullmq/dist/cjs/commands/includes/getNextDelayedTimestamp.lua +12 -0
  145. package/dist/node_modules/bullmq/dist/cjs/commands/includes/getOrSetMaxEvents.lua +11 -0
  146. package/dist/node_modules/bullmq/dist/cjs/commands/includes/getRateLimitTTL.lua +17 -0
  147. package/dist/node_modules/bullmq/dist/cjs/commands/includes/getTargetQueueList.lua +22 -0
  148. package/dist/node_modules/bullmq/dist/cjs/commands/includes/getTimestamp.lua +19 -0
  149. package/dist/node_modules/bullmq/dist/cjs/commands/includes/getZSetItems.lua +7 -0
  150. package/dist/node_modules/bullmq/dist/cjs/commands/includes/handleDuplicatedJob.lua +26 -0
  151. package/dist/node_modules/bullmq/dist/cjs/commands/includes/isLocked.lua +33 -0
  152. package/dist/node_modules/bullmq/dist/cjs/commands/includes/isQueueMaxed.lua +15 -0
  153. package/dist/node_modules/bullmq/dist/cjs/commands/includes/isQueuePaused.lua +7 -0
  154. package/dist/node_modules/bullmq/dist/cjs/commands/includes/isQueuePausedOrMaxed.lua +18 -0
  155. package/dist/node_modules/bullmq/dist/cjs/commands/includes/moveJobFromPriorityToActive.lua +13 -0
  156. package/dist/node_modules/bullmq/dist/cjs/commands/includes/moveParentFromWaitingChildrenToFailed.lua +53 -0
  157. package/dist/node_modules/bullmq/dist/cjs/commands/includes/moveParentToWaitIfNeeded.lua +55 -0
  158. package/dist/node_modules/bullmq/dist/cjs/commands/includes/prepareJobForProcessing.lua +50 -0
  159. package/dist/node_modules/bullmq/dist/cjs/commands/includes/promoteDelayedJobs.lua +40 -0
  160. package/dist/node_modules/bullmq/dist/cjs/commands/includes/pushBackJobWithPriority.lua +9 -0
  161. package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeDeduplicationKey.lua +11 -0
  162. package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeDeduplicationKeyIfNeeded.lua +14 -0
  163. package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeJob.lua +17 -0
  164. package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeJobFromAnyState.lua +35 -0
  165. package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeJobKeys.lua +8 -0
  166. package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeJobs.lua +13 -0
  167. package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeJobsByMaxAge.lua +16 -0
  168. package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeJobsByMaxCount.lua +15 -0
  169. package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeJobsOnFail.lua +36 -0
  170. package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeListJobs.lua +17 -0
  171. package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeLock.lua +19 -0
  172. package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeParentDependencyKey.lua +90 -0
  173. package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeZSetJobs.lua +27 -0
  174. package/dist/node_modules/bullmq/dist/cjs/commands/includes/storeJob.lua +36 -0
  175. package/dist/node_modules/bullmq/dist/cjs/commands/includes/trimEvents.lua +15 -0
  176. package/dist/node_modules/bullmq/dist/cjs/commands/includes/updateExistingJobsParent.lua +27 -0
  177. package/dist/node_modules/bullmq/dist/cjs/commands/includes/updateJobFields.lua +11 -0
  178. package/dist/node_modules/bullmq/dist/cjs/commands/includes/updateParentDepsIfNeeded.lua +13 -0
  179. package/dist/node_modules/bullmq/dist/cjs/commands/isFinished-3.lua +48 -0
  180. package/dist/node_modules/bullmq/dist/cjs/commands/isJobInList-1.lua +16 -0
  181. package/dist/node_modules/bullmq/dist/cjs/commands/isMaxed-2.lua +17 -0
  182. package/dist/node_modules/bullmq/dist/cjs/commands/moveJobFromActiveToWait-10.lua +60 -0
  183. package/dist/node_modules/bullmq/dist/cjs/commands/moveJobsToWait-8.lua +73 -0
  184. package/dist/node_modules/bullmq/dist/cjs/commands/moveStalledJobsToWait-9.lua +156 -0
  185. package/dist/node_modules/bullmq/dist/cjs/commands/moveToActive-11.lua +93 -0
  186. package/dist/node_modules/bullmq/dist/cjs/commands/moveToDelayed-8.lua +77 -0
  187. package/dist/node_modules/bullmq/dist/cjs/commands/moveToFinished-14.lua +283 -0
  188. package/dist/node_modules/bullmq/dist/cjs/commands/moveToWaitingChildren-5.lua +68 -0
  189. package/dist/node_modules/bullmq/dist/cjs/commands/obliterate-2.lua +118 -0
  190. package/dist/node_modules/bullmq/dist/cjs/commands/paginate-1.lua +49 -0
  191. package/dist/node_modules/bullmq/dist/cjs/commands/pause-7.lua +42 -0
  192. package/dist/node_modules/bullmq/dist/cjs/commands/promote-9.lua +62 -0
  193. package/dist/node_modules/bullmq/dist/cjs/commands/releaseLock-1.lua +19 -0
  194. package/dist/node_modules/bullmq/dist/cjs/commands/removeChildDependency-1.lua +34 -0
  195. package/dist/node_modules/bullmq/dist/cjs/commands/removeJob-2.lua +92 -0
  196. package/dist/node_modules/bullmq/dist/cjs/commands/removeJobScheduler-3.lua +43 -0
  197. package/dist/node_modules/bullmq/dist/cjs/commands/removeRepeatable-3.lua +58 -0
  198. package/dist/node_modules/bullmq/dist/cjs/commands/reprocessJob-8.lua +49 -0
  199. package/dist/node_modules/bullmq/dist/cjs/commands/retryJob-11.lua +82 -0
  200. package/dist/node_modules/bullmq/dist/cjs/commands/saveStacktrace-1.lua +19 -0
  201. package/dist/node_modules/bullmq/dist/cjs/commands/updateData-1.lua +20 -0
  202. package/dist/node_modules/bullmq/dist/cjs/commands/updateProgress-3.lua +33 -0
  203. package/dist/node_modules/bullmq/dist/cjs/commands/updateRepeatableJobMillis-1.lua +28 -0
  204. package/dist/node_modules/bullmq/dist/cjs/enums/child-command.js +10 -0
  205. package/dist/node_modules/bullmq/dist/cjs/enums/error-code.js +15 -0
  206. package/dist/node_modules/bullmq/dist/cjs/enums/index.js +9 -0
  207. package/dist/node_modules/bullmq/dist/cjs/enums/metrics-time.js +15 -0
  208. package/dist/node_modules/bullmq/dist/cjs/enums/parent-command.js +16 -0
  209. package/dist/node_modules/bullmq/dist/cjs/enums/telemetry-attributes.js +48 -0
  210. package/dist/node_modules/bullmq/dist/cjs/index.js +1 -0
  211. package/dist/node_modules/bullmq/dist/cjs/interfaces/advanced-options.js +3 -0
  212. package/dist/node_modules/bullmq/dist/cjs/interfaces/backoff-options.js +3 -0
  213. package/dist/node_modules/bullmq/dist/cjs/interfaces/base-job-options.js +3 -0
  214. package/dist/node_modules/bullmq/dist/cjs/interfaces/child-message.js +3 -0
  215. package/dist/node_modules/bullmq/dist/cjs/interfaces/connection.js +3 -0
  216. package/dist/node_modules/bullmq/dist/cjs/interfaces/debounce-options.js +3 -0
  217. package/dist/node_modules/bullmq/dist/cjs/interfaces/flow-job.js +3 -0
  218. package/dist/node_modules/bullmq/dist/cjs/interfaces/index.js +32 -0
  219. package/dist/node_modules/bullmq/dist/cjs/interfaces/ioredis-events.js +3 -0
  220. package/dist/node_modules/bullmq/dist/cjs/interfaces/job-json.js +3 -0
  221. package/dist/node_modules/bullmq/dist/cjs/interfaces/job-scheduler-json.js +3 -0
  222. package/dist/node_modules/bullmq/dist/cjs/interfaces/keep-jobs.js +3 -0
  223. package/dist/node_modules/bullmq/dist/cjs/interfaces/metrics-options.js +3 -0
  224. package/dist/node_modules/bullmq/dist/cjs/interfaces/metrics.js +3 -0
  225. package/dist/node_modules/bullmq/dist/cjs/interfaces/minimal-job.js +3 -0
  226. package/dist/node_modules/bullmq/dist/cjs/interfaces/parent-message.js +3 -0
  227. package/dist/node_modules/bullmq/dist/cjs/interfaces/parent.js +3 -0
  228. package/dist/node_modules/bullmq/dist/cjs/interfaces/queue-options.js +9 -0
  229. package/dist/node_modules/bullmq/dist/cjs/interfaces/rate-limiter-options.js +3 -0
  230. package/dist/node_modules/bullmq/dist/cjs/interfaces/redis-options.js +3 -0
  231. package/dist/node_modules/bullmq/dist/cjs/interfaces/redis-streams.js +3 -0
  232. package/dist/node_modules/bullmq/dist/cjs/interfaces/repeat-options.js +3 -0
  233. package/dist/node_modules/bullmq/dist/cjs/interfaces/repeatable-job.js +3 -0
  234. package/dist/node_modules/bullmq/dist/cjs/interfaces/repeatable-options.js +3 -0
  235. package/dist/node_modules/bullmq/dist/cjs/interfaces/sandboxed-job-processor.js +3 -0
  236. package/dist/node_modules/bullmq/dist/cjs/interfaces/sandboxed-job.js +3 -0
  237. package/dist/node_modules/bullmq/dist/cjs/interfaces/sandboxed-options.js +3 -0
  238. package/dist/node_modules/bullmq/dist/cjs/interfaces/telemetry.js +3 -0
  239. package/dist/node_modules/bullmq/dist/cjs/interfaces/worker-options.js +3 -0
  240. package/dist/node_modules/bullmq/dist/cjs/scripts/addDelayedJob-6.js +373 -0
  241. package/dist/node_modules/bullmq/dist/cjs/scripts/addJobScheduler-2.js +237 -0
  242. package/dist/node_modules/bullmq/dist/cjs/scripts/addLog-2.js +33 -0
  243. package/dist/node_modules/bullmq/dist/cjs/scripts/addParentJob-4.js +340 -0
  244. package/dist/node_modules/bullmq/dist/cjs/scripts/addPrioritizedJob-8.js +350 -0
  245. package/dist/node_modules/bullmq/dist/cjs/scripts/addRepeatableJob-2.js +230 -0
  246. package/dist/node_modules/bullmq/dist/cjs/scripts/addStandardJob-8.js +354 -0
  247. package/dist/node_modules/bullmq/dist/cjs/scripts/changeDelay-4.js +107 -0
  248. package/dist/node_modules/bullmq/dist/cjs/scripts/changePriority-7.js +122 -0
  249. package/dist/node_modules/bullmq/dist/cjs/scripts/cleanJobsInSet-3.js +350 -0
  250. package/dist/node_modules/bullmq/dist/cjs/scripts/drain-5.js +258 -0
  251. package/dist/node_modules/bullmq/dist/cjs/scripts/extendLock-2.js +30 -0
  252. package/dist/node_modules/bullmq/dist/cjs/scripts/extendLocks-1.js +46 -0
  253. package/dist/node_modules/bullmq/dist/cjs/scripts/getCounts-1.js +42 -0
  254. package/dist/node_modules/bullmq/dist/cjs/scripts/getCountsPerPriority-4.js +46 -0
  255. package/dist/node_modules/bullmq/dist/cjs/scripts/getJobScheduler-1.js +23 -0
  256. package/dist/node_modules/bullmq/dist/cjs/scripts/getRanges-1.js +73 -0
  257. package/dist/node_modules/bullmq/dist/cjs/scripts/getRateLimitTtl-1.js +39 -0
  258. package/dist/node_modules/bullmq/dist/cjs/scripts/getState-8.js +73 -0
  259. package/dist/node_modules/bullmq/dist/cjs/scripts/getStateV2-8.js +57 -0
  260. package/dist/node_modules/bullmq/dist/cjs/scripts/index.js +49 -0
  261. package/dist/node_modules/bullmq/dist/cjs/scripts/isFinished-3.js +49 -0
  262. package/dist/node_modules/bullmq/dist/cjs/scripts/isJobInList-1.js +32 -0
  263. package/dist/node_modules/bullmq/dist/cjs/scripts/isMaxed-2.js +34 -0
  264. package/dist/node_modules/bullmq/dist/cjs/scripts/moveJobFromActiveToWait-10.js +110 -0
  265. package/dist/node_modules/bullmq/dist/cjs/scripts/moveJobsToWait-8.js +118 -0
  266. package/dist/node_modules/bullmq/dist/cjs/scripts/moveStalledJobsToWait-9.js +529 -0
  267. package/dist/node_modules/bullmq/dist/cjs/scripts/moveToActive-11.js +233 -0
  268. package/dist/node_modules/bullmq/dist/cjs/scripts/moveToDelayed-8.js +156 -0
  269. package/dist/node_modules/bullmq/dist/cjs/scripts/moveToFinished-14.js +798 -0
  270. package/dist/node_modules/bullmq/dist/cjs/scripts/moveToWaitingChildren-5.js +83 -0
  271. package/dist/node_modules/bullmq/dist/cjs/scripts/obliterate-2.js +327 -0
  272. package/dist/node_modules/bullmq/dist/cjs/scripts/paginate-1.js +110 -0
  273. package/dist/node_modules/bullmq/dist/cjs/scripts/pause-7.js +67 -0
  274. package/dist/node_modules/bullmq/dist/cjs/scripts/promote-9.js +105 -0
  275. package/dist/node_modules/bullmq/dist/cjs/scripts/releaseLock-1.js +25 -0
  276. package/dist/node_modules/bullmq/dist/cjs/scripts/removeChildDependency-1.js +165 -0
  277. package/dist/node_modules/bullmq/dist/cjs/scripts/removeJob-2.js +292 -0
  278. package/dist/node_modules/bullmq/dist/cjs/scripts/removeJobScheduler-3.js +49 -0
  279. package/dist/node_modules/bullmq/dist/cjs/scripts/removeRepeatable-3.js +63 -0
  280. package/dist/node_modules/bullmq/dist/cjs/scripts/reprocessJob-8.js +96 -0
  281. package/dist/node_modules/bullmq/dist/cjs/scripts/retryJob-11.js +193 -0
  282. package/dist/node_modules/bullmq/dist/cjs/scripts/saveStacktrace-1.js +27 -0
  283. package/dist/node_modules/bullmq/dist/cjs/scripts/updateData-1.js +26 -0
  284. package/dist/node_modules/bullmq/dist/cjs/scripts/updateProgress-3.js +46 -0
  285. package/dist/node_modules/bullmq/dist/cjs/scripts/updateRepeatableJobMillis-1.js +33 -0
  286. package/dist/node_modules/bullmq/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -0
  287. package/dist/node_modules/bullmq/dist/cjs/types/backoff-strategy.js +3 -0
  288. package/dist/node_modules/bullmq/dist/cjs/types/finished-status.js +3 -0
  289. package/dist/node_modules/bullmq/dist/cjs/types/index.js +12 -0
  290. package/dist/node_modules/bullmq/dist/cjs/types/job-json-sandbox.js +3 -0
  291. package/dist/node_modules/bullmq/dist/cjs/types/job-options.js +3 -0
  292. package/dist/node_modules/bullmq/dist/cjs/types/job-scheduler-template-options.js +3 -0
  293. package/dist/node_modules/bullmq/dist/cjs/types/job-type.js +3 -0
  294. package/dist/node_modules/bullmq/dist/cjs/types/minimal-queue.js +3 -0
  295. package/dist/node_modules/bullmq/dist/cjs/types/repeat-strategy.js +3 -0
  296. package/dist/node_modules/bullmq/dist/cjs/utils.js +288 -0
  297. package/dist/node_modules/bullmq/dist/cjs/version.js +5 -0
  298. package/dist/node_modules/bullmq/dist/esm/classes/async-fifo-queue.d.ts +37 -0
  299. package/dist/node_modules/bullmq/dist/esm/classes/async-fifo-queue.js +125 -0
  300. package/dist/node_modules/bullmq/dist/esm/classes/backoffs.d.ts +10 -0
  301. package/dist/node_modules/bullmq/dist/esm/classes/backoffs.js +44 -0
  302. package/dist/node_modules/bullmq/dist/esm/classes/child-pool.d.ts +23 -0
  303. package/dist/node_modules/bullmq/dist/esm/classes/child-pool.js +67 -0
  304. package/dist/node_modules/bullmq/dist/esm/classes/child-processor.d.ts +37 -0
  305. package/dist/node_modules/bullmq/dist/esm/classes/child-processor.js +150 -0
  306. package/dist/node_modules/bullmq/dist/esm/classes/child.d.ts +35 -0
  307. package/dist/node_modules/bullmq/dist/esm/classes/child.js +206 -0
  308. package/dist/node_modules/bullmq/dist/esm/classes/errors/delayed-error.d.ts +11 -0
  309. package/dist/node_modules/bullmq/dist/esm/classes/errors/delayed-error.js +16 -0
  310. package/dist/node_modules/bullmq/dist/esm/classes/errors/index.d.ts +4 -0
  311. package/dist/node_modules/bullmq/dist/esm/classes/errors/index.js +5 -0
  312. package/dist/node_modules/bullmq/dist/esm/classes/errors/rate-limit-error.d.ts +10 -0
  313. package/dist/node_modules/bullmq/dist/esm/classes/errors/rate-limit-error.js +15 -0
  314. package/dist/node_modules/bullmq/dist/esm/classes/errors/unrecoverable-error.d.ts +11 -0
  315. package/dist/node_modules/bullmq/dist/esm/classes/errors/unrecoverable-error.js +16 -0
  316. package/dist/node_modules/bullmq/dist/esm/classes/errors/waiting-children-error.d.ts +11 -0
  317. package/dist/node_modules/bullmq/dist/esm/classes/errors/waiting-children-error.js +16 -0
  318. package/dist/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts +179 -0
  319. package/dist/node_modules/bullmq/dist/esm/classes/flow-producer.js +335 -0
  320. package/dist/node_modules/bullmq/dist/esm/classes/index.d.ts +19 -0
  321. package/dist/node_modules/bullmq/dist/esm/classes/index.js +22 -0
  322. package/dist/node_modules/bullmq/dist/esm/classes/job-scheduler.d.ts +24 -0
  323. package/dist/node_modules/bullmq/dist/esm/classes/job-scheduler.js +216 -0
  324. package/dist/node_modules/bullmq/dist/esm/classes/job.d.ts +425 -0
  325. package/dist/node_modules/bullmq/dist/esm/classes/job.js +889 -0
  326. package/dist/node_modules/bullmq/dist/esm/classes/main-base.d.ts +4 -0
  327. package/dist/node_modules/bullmq/dist/esm/classes/main-base.js +42 -0
  328. package/dist/node_modules/bullmq/dist/esm/classes/main-worker.d.ts +1 -0
  329. package/dist/node_modules/bullmq/dist/esm/classes/main-worker.js +8 -0
  330. package/dist/node_modules/bullmq/dist/esm/classes/main.d.ts +1 -0
  331. package/dist/node_modules/bullmq/dist/esm/classes/main.js +8 -0
  332. package/dist/node_modules/bullmq/dist/esm/classes/queue-base.d.ts +83 -0
  333. package/dist/node_modules/bullmq/dist/esm/classes/queue-base.js +151 -0
  334. package/dist/node_modules/bullmq/dist/esm/classes/queue-events-producer.d.ts +21 -0
  335. package/dist/node_modules/bullmq/dist/esm/classes/queue-events-producer.js +38 -0
  336. package/dist/node_modules/bullmq/dist/esm/classes/queue-events.d.ts +201 -0
  337. package/dist/node_modules/bullmq/dist/esm/classes/queue-events.js +121 -0
  338. package/dist/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts +235 -0
  339. package/dist/node_modules/bullmq/dist/esm/classes/queue-getters.js +447 -0
  340. package/dist/node_modules/bullmq/dist/esm/classes/queue-keys.d.ts +10 -0
  341. package/dist/node_modules/bullmq/dist/esm/classes/queue-keys.js +39 -0
  342. package/dist/node_modules/bullmq/dist/esm/classes/queue.d.ts +406 -0
  343. package/dist/node_modules/bullmq/dist/esm/classes/queue.js +631 -0
  344. package/dist/node_modules/bullmq/dist/esm/classes/redis-connection.d.ts +46 -0
  345. package/dist/node_modules/bullmq/dist/esm/classes/redis-connection.js +266 -0
  346. package/dist/node_modules/bullmq/dist/esm/classes/repeat.d.ts +25 -0
  347. package/dist/node_modules/bullmq/dist/esm/classes/repeat.js +199 -0
  348. package/dist/node_modules/bullmq/dist/esm/classes/sandbox.d.ts +4 -0
  349. package/dist/node_modules/bullmq/dist/esm/classes/sandbox.js +73 -0
  350. package/dist/node_modules/bullmq/dist/esm/classes/scripts.d.ts +160 -0
  351. package/dist/node_modules/bullmq/dist/esm/classes/scripts.js +1031 -0
  352. package/dist/node_modules/bullmq/dist/esm/classes/worker.d.ts +231 -0
  353. package/dist/node_modules/bullmq/dist/esm/classes/worker.js +815 -0
  354. package/dist/node_modules/bullmq/dist/esm/commands/addDelayedJob-6.lua +119 -0
  355. package/dist/node_modules/bullmq/dist/esm/commands/addJobScheduler-2.lua +91 -0
  356. package/dist/node_modules/bullmq/dist/esm/commands/addLog-2.lua +30 -0
  357. package/dist/node_modules/bullmq/dist/esm/commands/addParentJob-4.lua +104 -0
  358. package/dist/node_modules/bullmq/dist/esm/commands/addPrioritizedJob-8.lua +117 -0
  359. package/dist/node_modules/bullmq/dist/esm/commands/addRepeatableJob-2.lua +84 -0
  360. package/dist/node_modules/bullmq/dist/esm/commands/addStandardJob-8.lua +122 -0
  361. package/dist/node_modules/bullmq/dist/esm/commands/changeDelay-4.lua +55 -0
  362. package/dist/node_modules/bullmq/dist/esm/commands/changePriority-7.lua +68 -0
  363. package/dist/node_modules/bullmq/dist/esm/commands/cleanJobsInSet-3.lua +55 -0
  364. package/dist/node_modules/bullmq/dist/esm/commands/drain-5.lua +41 -0
  365. package/dist/node_modules/bullmq/dist/esm/commands/extendLock-2.lua +23 -0
  366. package/dist/node_modules/bullmq/dist/esm/commands/extendLocks-1.lua +44 -0
  367. package/dist/node_modules/bullmq/dist/esm/commands/getCounts-1.lua +36 -0
  368. package/dist/node_modules/bullmq/dist/esm/commands/getCountsPerPriority-4.lua +35 -0
  369. package/dist/node_modules/bullmq/dist/esm/commands/getJobScheduler-1.lua +19 -0
  370. package/dist/node_modules/bullmq/dist/esm/commands/getRanges-1.lua +70 -0
  371. package/dist/node_modules/bullmq/dist/esm/commands/getRateLimitTtl-1.lua +20 -0
  372. package/dist/node_modules/bullmq/dist/esm/commands/getState-8.lua +65 -0
  373. package/dist/node_modules/bullmq/dist/esm/commands/getStateV2-8.lua +58 -0
  374. package/dist/node_modules/bullmq/dist/esm/commands/includes/addBaseMarkerIfNeeded.lua +9 -0
  375. package/dist/node_modules/bullmq/dist/esm/commands/includes/addDelayMarkerIfNeeded.lua +15 -0
  376. package/dist/node_modules/bullmq/dist/esm/commands/includes/addJobInTargetList.lua +11 -0
  377. package/dist/node_modules/bullmq/dist/esm/commands/includes/addJobWithPriority.lua +14 -0
  378. package/dist/node_modules/bullmq/dist/esm/commands/includes/batches.lua +18 -0
  379. package/dist/node_modules/bullmq/dist/esm/commands/includes/checkItemInList.lua +12 -0
  380. package/dist/node_modules/bullmq/dist/esm/commands/includes/cleanList.lua +47 -0
  381. package/dist/node_modules/bullmq/dist/esm/commands/includes/cleanSet.lua +66 -0
  382. package/dist/node_modules/bullmq/dist/esm/commands/includes/collectMetrics.lua +46 -0
  383. package/dist/node_modules/bullmq/dist/esm/commands/includes/deduplicateJob.lua +24 -0
  384. package/dist/node_modules/bullmq/dist/esm/commands/includes/destructureJobKey.lua +12 -0
  385. package/dist/node_modules/bullmq/dist/esm/commands/includes/findPage.lua +70 -0
  386. package/dist/node_modules/bullmq/dist/esm/commands/includes/getDelayedScore.lua +25 -0
  387. package/dist/node_modules/bullmq/dist/esm/commands/includes/getJobsInZset.lua +13 -0
  388. package/dist/node_modules/bullmq/dist/esm/commands/includes/getNextDelayedTimestamp.lua +12 -0
  389. package/dist/node_modules/bullmq/dist/esm/commands/includes/getOrSetMaxEvents.lua +11 -0
  390. package/dist/node_modules/bullmq/dist/esm/commands/includes/getRateLimitTTL.lua +17 -0
  391. package/dist/node_modules/bullmq/dist/esm/commands/includes/getTargetQueueList.lua +22 -0
  392. package/dist/node_modules/bullmq/dist/esm/commands/includes/getTimestamp.lua +19 -0
  393. package/dist/node_modules/bullmq/dist/esm/commands/includes/getZSetItems.lua +7 -0
  394. package/dist/node_modules/bullmq/dist/esm/commands/includes/handleDuplicatedJob.lua +26 -0
  395. package/dist/node_modules/bullmq/dist/esm/commands/includes/isLocked.lua +33 -0
  396. package/dist/node_modules/bullmq/dist/esm/commands/includes/isQueueMaxed.lua +15 -0
  397. package/dist/node_modules/bullmq/dist/esm/commands/includes/isQueuePaused.lua +7 -0
  398. package/dist/node_modules/bullmq/dist/esm/commands/includes/isQueuePausedOrMaxed.lua +18 -0
  399. package/dist/node_modules/bullmq/dist/esm/commands/includes/moveJobFromPriorityToActive.lua +13 -0
  400. package/dist/node_modules/bullmq/dist/esm/commands/includes/moveParentFromWaitingChildrenToFailed.lua +53 -0
  401. package/dist/node_modules/bullmq/dist/esm/commands/includes/moveParentToWaitIfNeeded.lua +55 -0
  402. package/dist/node_modules/bullmq/dist/esm/commands/includes/prepareJobForProcessing.lua +50 -0
  403. package/dist/node_modules/bullmq/dist/esm/commands/includes/promoteDelayedJobs.lua +40 -0
  404. package/dist/node_modules/bullmq/dist/esm/commands/includes/pushBackJobWithPriority.lua +9 -0
  405. package/dist/node_modules/bullmq/dist/esm/commands/includes/removeDeduplicationKey.lua +11 -0
  406. package/dist/node_modules/bullmq/dist/esm/commands/includes/removeDeduplicationKeyIfNeeded.lua +14 -0
  407. package/dist/node_modules/bullmq/dist/esm/commands/includes/removeJob.lua +17 -0
  408. package/dist/node_modules/bullmq/dist/esm/commands/includes/removeJobFromAnyState.lua +35 -0
  409. package/dist/node_modules/bullmq/dist/esm/commands/includes/removeJobKeys.lua +8 -0
  410. package/dist/node_modules/bullmq/dist/esm/commands/includes/removeJobs.lua +13 -0
  411. package/dist/node_modules/bullmq/dist/esm/commands/includes/removeJobsByMaxAge.lua +16 -0
  412. package/dist/node_modules/bullmq/dist/esm/commands/includes/removeJobsByMaxCount.lua +15 -0
  413. package/dist/node_modules/bullmq/dist/esm/commands/includes/removeJobsOnFail.lua +36 -0
  414. package/dist/node_modules/bullmq/dist/esm/commands/includes/removeListJobs.lua +17 -0
  415. package/dist/node_modules/bullmq/dist/esm/commands/includes/removeLock.lua +19 -0
  416. package/dist/node_modules/bullmq/dist/esm/commands/includes/removeParentDependencyKey.lua +90 -0
  417. package/dist/node_modules/bullmq/dist/esm/commands/includes/removeZSetJobs.lua +27 -0
  418. package/dist/node_modules/bullmq/dist/esm/commands/includes/storeJob.lua +36 -0
  419. package/dist/node_modules/bullmq/dist/esm/commands/includes/trimEvents.lua +15 -0
  420. package/dist/node_modules/bullmq/dist/esm/commands/includes/updateExistingJobsParent.lua +27 -0
  421. package/dist/node_modules/bullmq/dist/esm/commands/includes/updateJobFields.lua +11 -0
  422. package/dist/node_modules/bullmq/dist/esm/commands/includes/updateParentDepsIfNeeded.lua +13 -0
  423. package/dist/node_modules/bullmq/dist/esm/commands/isFinished-3.lua +48 -0
  424. package/dist/node_modules/bullmq/dist/esm/commands/isJobInList-1.lua +16 -0
  425. package/dist/node_modules/bullmq/dist/esm/commands/isMaxed-2.lua +17 -0
  426. package/dist/node_modules/bullmq/dist/esm/commands/moveJobFromActiveToWait-10.lua +60 -0
  427. package/dist/node_modules/bullmq/dist/esm/commands/moveJobsToWait-8.lua +73 -0
  428. package/dist/node_modules/bullmq/dist/esm/commands/moveStalledJobsToWait-9.lua +156 -0
  429. package/dist/node_modules/bullmq/dist/esm/commands/moveToActive-11.lua +93 -0
  430. package/dist/node_modules/bullmq/dist/esm/commands/moveToDelayed-8.lua +77 -0
  431. package/dist/node_modules/bullmq/dist/esm/commands/moveToFinished-14.lua +283 -0
  432. package/dist/node_modules/bullmq/dist/esm/commands/moveToWaitingChildren-5.lua +68 -0
  433. package/dist/node_modules/bullmq/dist/esm/commands/obliterate-2.lua +118 -0
  434. package/dist/node_modules/bullmq/dist/esm/commands/paginate-1.lua +49 -0
  435. package/dist/node_modules/bullmq/dist/esm/commands/pause-7.lua +42 -0
  436. package/dist/node_modules/bullmq/dist/esm/commands/promote-9.lua +62 -0
  437. package/dist/node_modules/bullmq/dist/esm/commands/releaseLock-1.lua +19 -0
  438. package/dist/node_modules/bullmq/dist/esm/commands/removeChildDependency-1.lua +34 -0
  439. package/dist/node_modules/bullmq/dist/esm/commands/removeJob-2.lua +92 -0
  440. package/dist/node_modules/bullmq/dist/esm/commands/removeJobScheduler-3.lua +43 -0
  441. package/dist/node_modules/bullmq/dist/esm/commands/removeRepeatable-3.lua +58 -0
  442. package/dist/node_modules/bullmq/dist/esm/commands/reprocessJob-8.lua +49 -0
  443. package/dist/node_modules/bullmq/dist/esm/commands/retryJob-11.lua +82 -0
  444. package/dist/node_modules/bullmq/dist/esm/commands/saveStacktrace-1.lua +19 -0
  445. package/dist/node_modules/bullmq/dist/esm/commands/updateData-1.lua +20 -0
  446. package/dist/node_modules/bullmq/dist/esm/commands/updateProgress-3.lua +33 -0
  447. package/dist/node_modules/bullmq/dist/esm/commands/updateRepeatableJobMillis-1.lua +28 -0
  448. package/dist/node_modules/bullmq/dist/esm/enums/child-command.d.ts +5 -0
  449. package/dist/node_modules/bullmq/dist/esm/enums/child-command.js +7 -0
  450. package/dist/node_modules/bullmq/dist/esm/enums/error-code.d.ts +10 -0
  451. package/dist/node_modules/bullmq/dist/esm/enums/error-code.js +12 -0
  452. package/dist/node_modules/bullmq/dist/esm/enums/index.d.ts +5 -0
  453. package/dist/node_modules/bullmq/dist/esm/enums/index.js +6 -0
  454. package/dist/node_modules/bullmq/dist/esm/enums/metrics-time.d.ts +10 -0
  455. package/dist/node_modules/bullmq/dist/esm/enums/metrics-time.js +12 -0
  456. package/dist/node_modules/bullmq/dist/esm/enums/parent-command.d.ts +11 -0
  457. package/dist/node_modules/bullmq/dist/esm/enums/parent-command.js +13 -0
  458. package/dist/node_modules/bullmq/dist/esm/enums/telemetry-attributes.d.ts +42 -0
  459. package/dist/node_modules/bullmq/dist/esm/enums/telemetry-attributes.js +45 -0
  460. package/dist/node_modules/bullmq/dist/esm/index.d.ts +5 -0
  461. package/dist/node_modules/bullmq/dist/esm/index.js +6 -0
  462. package/dist/node_modules/bullmq/dist/esm/interfaces/advanced-options.d.ts +18 -0
  463. package/dist/node_modules/bullmq/dist/esm/interfaces/advanced-options.js +2 -0
  464. package/dist/node_modules/bullmq/dist/esm/interfaces/backoff-options.d.ts +15 -0
  465. package/dist/node_modules/bullmq/dist/esm/interfaces/backoff-options.js +2 -0
  466. package/dist/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts +100 -0
  467. package/dist/node_modules/bullmq/dist/esm/interfaces/base-job-options.js +2 -0
  468. package/dist/node_modules/bullmq/dist/esm/interfaces/child-message.d.ts +6 -0
  469. package/dist/node_modules/bullmq/dist/esm/interfaces/child-message.js +2 -0
  470. package/dist/node_modules/bullmq/dist/esm/interfaces/connection.d.ts +8 -0
  471. package/dist/node_modules/bullmq/dist/esm/interfaces/connection.js +2 -0
  472. package/dist/node_modules/bullmq/dist/esm/interfaces/debounce-options.d.ts +13 -0
  473. package/dist/node_modules/bullmq/dist/esm/interfaces/debounce-options.js +2 -0
  474. package/dist/node_modules/bullmq/dist/esm/interfaces/flow-job.d.ts +19 -0
  475. package/dist/node_modules/bullmq/dist/esm/interfaces/flow-job.js +2 -0
  476. package/dist/node_modules/bullmq/dist/esm/interfaces/index.d.ts +28 -0
  477. package/dist/node_modules/bullmq/dist/esm/interfaces/index.js +29 -0
  478. package/dist/node_modules/bullmq/dist/esm/interfaces/ioredis-events.d.ts +8 -0
  479. package/dist/node_modules/bullmq/dist/esm/interfaces/ioredis-events.js +2 -0
  480. package/dist/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts +47 -0
  481. package/dist/node_modules/bullmq/dist/esm/interfaces/job-json.js +2 -0
  482. package/dist/node_modules/bullmq/dist/esm/interfaces/job-scheduler-json.d.ts +16 -0
  483. package/dist/node_modules/bullmq/dist/esm/interfaces/job-scheduler-json.js +2 -0
  484. package/dist/node_modules/bullmq/dist/esm/interfaces/keep-jobs.d.ts +17 -0
  485. package/dist/node_modules/bullmq/dist/esm/interfaces/keep-jobs.js +2 -0
  486. package/dist/node_modules/bullmq/dist/esm/interfaces/metrics-options.d.ts +12 -0
  487. package/dist/node_modules/bullmq/dist/esm/interfaces/metrics-options.js +2 -0
  488. package/dist/node_modules/bullmq/dist/esm/interfaces/metrics.d.ts +9 -0
  489. package/dist/node_modules/bullmq/dist/esm/interfaces/metrics.js +2 -0
  490. package/dist/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts +133 -0
  491. package/dist/node_modules/bullmq/dist/esm/interfaces/minimal-job.js +2 -0
  492. package/dist/node_modules/bullmq/dist/esm/interfaces/parent-message.d.ts +8 -0
  493. package/dist/node_modules/bullmq/dist/esm/interfaces/parent-message.js +2 -0
  494. package/dist/node_modules/bullmq/dist/esm/interfaces/parent.d.ts +20 -0
  495. package/dist/node_modules/bullmq/dist/esm/interfaces/parent.js +2 -0
  496. package/dist/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts +97 -0
  497. package/dist/node_modules/bullmq/dist/esm/interfaces/queue-options.js +6 -0
  498. package/dist/node_modules/bullmq/dist/esm/interfaces/rate-limiter-options.d.ts +12 -0
  499. package/dist/node_modules/bullmq/dist/esm/interfaces/rate-limiter-options.js +2 -0
  500. package/dist/node_modules/bullmq/dist/esm/interfaces/redis-options.d.ts +8 -0
  501. package/dist/node_modules/bullmq/dist/esm/interfaces/redis-options.js +2 -0
  502. package/dist/node_modules/bullmq/dist/esm/interfaces/redis-streams.d.ts +4 -0
  503. package/dist/node_modules/bullmq/dist/esm/interfaces/redis-streams.js +2 -0
  504. package/dist/node_modules/bullmq/dist/esm/interfaces/repeat-options.d.ts +51 -0
  505. package/dist/node_modules/bullmq/dist/esm/interfaces/repeat-options.js +2 -0
  506. package/dist/node_modules/bullmq/dist/esm/interfaces/repeatable-job.d.ts +10 -0
  507. package/dist/node_modules/bullmq/dist/esm/interfaces/repeatable-job.js +2 -0
  508. package/dist/node_modules/bullmq/dist/esm/interfaces/repeatable-options.d.ts +7 -0
  509. package/dist/node_modules/bullmq/dist/esm/interfaces/repeatable-options.js +2 -0
  510. package/dist/node_modules/bullmq/dist/esm/interfaces/sandboxed-job-processor.d.ts +5 -0
  511. package/dist/node_modules/bullmq/dist/esm/interfaces/sandboxed-job-processor.js +2 -0
  512. package/dist/node_modules/bullmq/dist/esm/interfaces/sandboxed-job.d.ts +13 -0
  513. package/dist/node_modules/bullmq/dist/esm/interfaces/sandboxed-job.js +2 -0
  514. package/dist/node_modules/bullmq/dist/esm/interfaces/sandboxed-options.d.ts +28 -0
  515. package/dist/node_modules/bullmq/dist/esm/interfaces/sandboxed-options.js +2 -0
  516. package/dist/node_modules/bullmq/dist/esm/interfaces/telemetry.d.ts +150 -0
  517. package/dist/node_modules/bullmq/dist/esm/interfaces/telemetry.js +2 -0
  518. package/dist/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts +133 -0
  519. package/dist/node_modules/bullmq/dist/esm/interfaces/worker-options.js +2 -0
  520. package/dist/node_modules/bullmq/dist/esm/scripts/addDelayedJob-6.d.ts +5 -0
  521. package/dist/node_modules/bullmq/dist/esm/scripts/addDelayedJob-6.js +370 -0
  522. package/dist/node_modules/bullmq/dist/esm/scripts/addJobScheduler-2.d.ts +5 -0
  523. package/dist/node_modules/bullmq/dist/esm/scripts/addJobScheduler-2.js +234 -0
  524. package/dist/node_modules/bullmq/dist/esm/scripts/addLog-2.d.ts +5 -0
  525. package/dist/node_modules/bullmq/dist/esm/scripts/addLog-2.js +30 -0
  526. package/dist/node_modules/bullmq/dist/esm/scripts/addParentJob-4.d.ts +5 -0
  527. package/dist/node_modules/bullmq/dist/esm/scripts/addParentJob-4.js +337 -0
  528. package/dist/node_modules/bullmq/dist/esm/scripts/addPrioritizedJob-8.d.ts +5 -0
  529. package/dist/node_modules/bullmq/dist/esm/scripts/addPrioritizedJob-8.js +347 -0
  530. package/dist/node_modules/bullmq/dist/esm/scripts/addRepeatableJob-2.d.ts +5 -0
  531. package/dist/node_modules/bullmq/dist/esm/scripts/addRepeatableJob-2.js +227 -0
  532. package/dist/node_modules/bullmq/dist/esm/scripts/addStandardJob-8.d.ts +5 -0
  533. package/dist/node_modules/bullmq/dist/esm/scripts/addStandardJob-8.js +351 -0
  534. package/dist/node_modules/bullmq/dist/esm/scripts/changeDelay-4.d.ts +5 -0
  535. package/dist/node_modules/bullmq/dist/esm/scripts/changeDelay-4.js +104 -0
  536. package/dist/node_modules/bullmq/dist/esm/scripts/changePriority-7.d.ts +5 -0
  537. package/dist/node_modules/bullmq/dist/esm/scripts/changePriority-7.js +119 -0
  538. package/dist/node_modules/bullmq/dist/esm/scripts/cleanJobsInSet-3.d.ts +5 -0
  539. package/dist/node_modules/bullmq/dist/esm/scripts/cleanJobsInSet-3.js +347 -0
  540. package/dist/node_modules/bullmq/dist/esm/scripts/drain-5.d.ts +5 -0
  541. package/dist/node_modules/bullmq/dist/esm/scripts/drain-5.js +255 -0
  542. package/dist/node_modules/bullmq/dist/esm/scripts/extendLock-2.d.ts +5 -0
  543. package/dist/node_modules/bullmq/dist/esm/scripts/extendLock-2.js +27 -0
  544. package/dist/node_modules/bullmq/dist/esm/scripts/extendLocks-1.d.ts +5 -0
  545. package/dist/node_modules/bullmq/dist/esm/scripts/extendLocks-1.js +43 -0
  546. package/dist/node_modules/bullmq/dist/esm/scripts/getCounts-1.d.ts +5 -0
  547. package/dist/node_modules/bullmq/dist/esm/scripts/getCounts-1.js +39 -0
  548. package/dist/node_modules/bullmq/dist/esm/scripts/getCountsPerPriority-4.d.ts +5 -0
  549. package/dist/node_modules/bullmq/dist/esm/scripts/getCountsPerPriority-4.js +43 -0
  550. package/dist/node_modules/bullmq/dist/esm/scripts/getJobScheduler-1.d.ts +5 -0
  551. package/dist/node_modules/bullmq/dist/esm/scripts/getJobScheduler-1.js +20 -0
  552. package/dist/node_modules/bullmq/dist/esm/scripts/getRanges-1.d.ts +5 -0
  553. package/dist/node_modules/bullmq/dist/esm/scripts/getRanges-1.js +70 -0
  554. package/dist/node_modules/bullmq/dist/esm/scripts/getRateLimitTtl-1.d.ts +5 -0
  555. package/dist/node_modules/bullmq/dist/esm/scripts/getRateLimitTtl-1.js +36 -0
  556. package/dist/node_modules/bullmq/dist/esm/scripts/getState-8.d.ts +5 -0
  557. package/dist/node_modules/bullmq/dist/esm/scripts/getState-8.js +70 -0
  558. package/dist/node_modules/bullmq/dist/esm/scripts/getStateV2-8.d.ts +5 -0
  559. package/dist/node_modules/bullmq/dist/esm/scripts/getStateV2-8.js +54 -0
  560. package/dist/node_modules/bullmq/dist/esm/scripts/index.d.ts +45 -0
  561. package/dist/node_modules/bullmq/dist/esm/scripts/index.js +46 -0
  562. package/dist/node_modules/bullmq/dist/esm/scripts/isFinished-3.d.ts +5 -0
  563. package/dist/node_modules/bullmq/dist/esm/scripts/isFinished-3.js +46 -0
  564. package/dist/node_modules/bullmq/dist/esm/scripts/isJobInList-1.d.ts +5 -0
  565. package/dist/node_modules/bullmq/dist/esm/scripts/isJobInList-1.js +29 -0
  566. package/dist/node_modules/bullmq/dist/esm/scripts/isMaxed-2.d.ts +5 -0
  567. package/dist/node_modules/bullmq/dist/esm/scripts/isMaxed-2.js +31 -0
  568. package/dist/node_modules/bullmq/dist/esm/scripts/moveJobFromActiveToWait-10.d.ts +5 -0
  569. package/dist/node_modules/bullmq/dist/esm/scripts/moveJobFromActiveToWait-10.js +107 -0
  570. package/dist/node_modules/bullmq/dist/esm/scripts/moveJobsToWait-8.d.ts +5 -0
  571. package/dist/node_modules/bullmq/dist/esm/scripts/moveJobsToWait-8.js +115 -0
  572. package/dist/node_modules/bullmq/dist/esm/scripts/moveStalledJobsToWait-9.d.ts +5 -0
  573. package/dist/node_modules/bullmq/dist/esm/scripts/moveStalledJobsToWait-9.js +526 -0
  574. package/dist/node_modules/bullmq/dist/esm/scripts/moveToActive-11.d.ts +5 -0
  575. package/dist/node_modules/bullmq/dist/esm/scripts/moveToActive-11.js +230 -0
  576. package/dist/node_modules/bullmq/dist/esm/scripts/moveToDelayed-8.d.ts +5 -0
  577. package/dist/node_modules/bullmq/dist/esm/scripts/moveToDelayed-8.js +153 -0
  578. package/dist/node_modules/bullmq/dist/esm/scripts/moveToFinished-14.d.ts +5 -0
  579. package/dist/node_modules/bullmq/dist/esm/scripts/moveToFinished-14.js +795 -0
  580. package/dist/node_modules/bullmq/dist/esm/scripts/moveToWaitingChildren-5.d.ts +5 -0
  581. package/dist/node_modules/bullmq/dist/esm/scripts/moveToWaitingChildren-5.js +80 -0
  582. package/dist/node_modules/bullmq/dist/esm/scripts/obliterate-2.d.ts +5 -0
  583. package/dist/node_modules/bullmq/dist/esm/scripts/obliterate-2.js +324 -0
  584. package/dist/node_modules/bullmq/dist/esm/scripts/paginate-1.d.ts +5 -0
  585. package/dist/node_modules/bullmq/dist/esm/scripts/paginate-1.js +107 -0
  586. package/dist/node_modules/bullmq/dist/esm/scripts/pause-7.d.ts +5 -0
  587. package/dist/node_modules/bullmq/dist/esm/scripts/pause-7.js +64 -0
  588. package/dist/node_modules/bullmq/dist/esm/scripts/promote-9.d.ts +5 -0
  589. package/dist/node_modules/bullmq/dist/esm/scripts/promote-9.js +102 -0
  590. package/dist/node_modules/bullmq/dist/esm/scripts/releaseLock-1.d.ts +5 -0
  591. package/dist/node_modules/bullmq/dist/esm/scripts/releaseLock-1.js +22 -0
  592. package/dist/node_modules/bullmq/dist/esm/scripts/removeChildDependency-1.d.ts +5 -0
  593. package/dist/node_modules/bullmq/dist/esm/scripts/removeChildDependency-1.js +162 -0
  594. package/dist/node_modules/bullmq/dist/esm/scripts/removeJob-2.d.ts +5 -0
  595. package/dist/node_modules/bullmq/dist/esm/scripts/removeJob-2.js +289 -0
  596. package/dist/node_modules/bullmq/dist/esm/scripts/removeJobScheduler-3.d.ts +5 -0
  597. package/dist/node_modules/bullmq/dist/esm/scripts/removeJobScheduler-3.js +46 -0
  598. package/dist/node_modules/bullmq/dist/esm/scripts/removeRepeatable-3.d.ts +5 -0
  599. package/dist/node_modules/bullmq/dist/esm/scripts/removeRepeatable-3.js +60 -0
  600. package/dist/node_modules/bullmq/dist/esm/scripts/reprocessJob-8.d.ts +5 -0
  601. package/dist/node_modules/bullmq/dist/esm/scripts/reprocessJob-8.js +93 -0
  602. package/dist/node_modules/bullmq/dist/esm/scripts/retryJob-11.d.ts +5 -0
  603. package/dist/node_modules/bullmq/dist/esm/scripts/retryJob-11.js +190 -0
  604. package/dist/node_modules/bullmq/dist/esm/scripts/saveStacktrace-1.d.ts +5 -0
  605. package/dist/node_modules/bullmq/dist/esm/scripts/saveStacktrace-1.js +24 -0
  606. package/dist/node_modules/bullmq/dist/esm/scripts/updateData-1.d.ts +5 -0
  607. package/dist/node_modules/bullmq/dist/esm/scripts/updateData-1.js +23 -0
  608. package/dist/node_modules/bullmq/dist/esm/scripts/updateProgress-3.d.ts +5 -0
  609. package/dist/node_modules/bullmq/dist/esm/scripts/updateProgress-3.js +43 -0
  610. package/dist/node_modules/bullmq/dist/esm/scripts/updateRepeatableJobMillis-1.d.ts +5 -0
  611. package/dist/node_modules/bullmq/dist/esm/scripts/updateRepeatableJobMillis-1.js +30 -0
  612. package/dist/node_modules/bullmq/dist/esm/tsconfig.tsbuildinfo +1 -0
  613. package/dist/node_modules/bullmq/dist/esm/types/backoff-strategy.d.ts +2 -0
  614. package/dist/node_modules/bullmq/dist/esm/types/backoff-strategy.js +2 -0
  615. package/dist/node_modules/bullmq/dist/esm/types/finished-status.d.ts +2 -0
  616. package/dist/node_modules/bullmq/dist/esm/types/finished-status.js +2 -0
  617. package/dist/node_modules/bullmq/dist/esm/types/index.d.ts +8 -0
  618. package/dist/node_modules/bullmq/dist/esm/types/index.js +9 -0
  619. package/dist/node_modules/bullmq/dist/esm/types/job-json-sandbox.d.ts +5 -0
  620. package/dist/node_modules/bullmq/dist/esm/types/job-json-sandbox.js +2 -0
  621. package/dist/node_modules/bullmq/dist/esm/types/job-options.d.ts +81 -0
  622. package/dist/node_modules/bullmq/dist/esm/types/job-options.js +2 -0
  623. package/dist/node_modules/bullmq/dist/esm/types/job-scheduler-template-options.d.ts +2 -0
  624. package/dist/node_modules/bullmq/dist/esm/types/job-scheduler-template-options.js +2 -0
  625. package/dist/node_modules/bullmq/dist/esm/types/job-type.d.ts +3 -0
  626. package/dist/node_modules/bullmq/dist/esm/types/job-type.js +2 -0
  627. package/dist/node_modules/bullmq/dist/esm/types/minimal-queue.d.ts +2 -0
  628. package/dist/node_modules/bullmq/dist/esm/types/minimal-queue.js +2 -0
  629. package/dist/node_modules/bullmq/dist/esm/types/repeat-strategy.d.ts +2 -0
  630. package/dist/node_modules/bullmq/dist/esm/types/repeat-strategy.js +2 -0
  631. package/dist/node_modules/bullmq/dist/esm/utils.d.ts +72 -0
  632. package/dist/node_modules/bullmq/dist/esm/utils.js +263 -0
  633. package/dist/node_modules/bullmq/dist/esm/version.d.ts +1 -0
  634. package/dist/node_modules/bullmq/dist/esm/version.js +2 -0
  635. package/dist/node_modules/bullmq/node_modules/.bin/semver +17 -0
  636. package/dist/node_modules/bullmq/node_modules/.bin/uuid +17 -0
  637. package/dist/node_modules/bullmq/package.json +1 -0
  638. package/dist/server/index.d.ts +1 -0
  639. package/dist/server/index.js +33 -0
  640. package/dist/server/plugin.d.ts +11 -0
  641. package/dist/server/plugin.js +63 -0
  642. package/package.json +18 -0
  643. package/server.d.ts +2 -0
  644. package/server.js +1 -0
@@ -0,0 +1,1035 @@
1
+ /**
2
+ * Includes all the scripts needed by the queue and jobs.
3
+ */
4
+ /*eslint-env node */
5
+ 'use strict';
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.raw2NextJobData = exports.Scripts = void 0;
8
+ const msgpackr_1 = require("msgpackr");
9
+ const packer = new msgpackr_1.Packr({
10
+ useRecords: false,
11
+ encodeUndefinedAsNil: true,
12
+ });
13
+ const pack = packer.pack;
14
+ const enums_1 = require("../enums");
15
+ const utils_1 = require("../utils");
16
+ const version_1 = require("../version");
17
+ class Scripts {
18
+ constructor(queue) {
19
+ this.queue = queue;
20
+ this.version = version_1.version;
21
+ const queueKeys = this.queue.keys;
22
+ this.moveToFinishedKeys = [
23
+ queueKeys.wait,
24
+ queueKeys.active,
25
+ queueKeys.prioritized,
26
+ queueKeys.events,
27
+ queueKeys.stalled,
28
+ queueKeys.limiter,
29
+ queueKeys.delayed,
30
+ queueKeys.paused,
31
+ queueKeys.meta,
32
+ queueKeys.pc,
33
+ undefined,
34
+ undefined,
35
+ undefined,
36
+ undefined,
37
+ ];
38
+ }
39
+ execCommand(client, commandName, args) {
40
+ const commandNameWithVersion = `${commandName}:${this.version}`;
41
+ return client[commandNameWithVersion](args);
42
+ }
43
+ async isJobInList(listKey, jobId) {
44
+ const client = await this.queue.client;
45
+ let result;
46
+ if ((0, utils_1.isRedisVersionLowerThan)(this.queue.redisVersion, '6.0.6')) {
47
+ result = await this.execCommand(client, 'isJobInList', [listKey, jobId]);
48
+ }
49
+ else {
50
+ result = await client.lpos(listKey, jobId);
51
+ }
52
+ return Number.isInteger(result);
53
+ }
54
+ addDelayedJob(client, job, encodedOpts, args) {
55
+ const queueKeys = this.queue.keys;
56
+ const keys = [
57
+ queueKeys.marker,
58
+ queueKeys.meta,
59
+ queueKeys.id,
60
+ queueKeys.delayed,
61
+ queueKeys.completed,
62
+ queueKeys.events,
63
+ ];
64
+ keys.push(pack(args), job.data, encodedOpts);
65
+ return this.execCommand(client, 'addDelayedJob', keys);
66
+ }
67
+ addPrioritizedJob(client, job, encodedOpts, args) {
68
+ const queueKeys = this.queue.keys;
69
+ const keys = [
70
+ queueKeys.marker,
71
+ queueKeys.meta,
72
+ queueKeys.id,
73
+ queueKeys.prioritized,
74
+ queueKeys.completed,
75
+ queueKeys.active,
76
+ queueKeys.events,
77
+ queueKeys.pc,
78
+ ];
79
+ keys.push(pack(args), job.data, encodedOpts);
80
+ return this.execCommand(client, 'addPrioritizedJob', keys);
81
+ }
82
+ addParentJob(client, job, encodedOpts, args) {
83
+ const queueKeys = this.queue.keys;
84
+ const keys = [
85
+ queueKeys.meta,
86
+ queueKeys.id,
87
+ queueKeys.completed,
88
+ queueKeys.events,
89
+ ];
90
+ keys.push(pack(args), job.data, encodedOpts);
91
+ return this.execCommand(client, 'addParentJob', keys);
92
+ }
93
+ addStandardJob(client, job, encodedOpts, args) {
94
+ const queueKeys = this.queue.keys;
95
+ const keys = [
96
+ queueKeys.wait,
97
+ queueKeys.paused,
98
+ queueKeys.meta,
99
+ queueKeys.id,
100
+ queueKeys.completed,
101
+ queueKeys.active,
102
+ queueKeys.events,
103
+ queueKeys.marker,
104
+ ];
105
+ keys.push(pack(args), job.data, encodedOpts);
106
+ return this.execCommand(client, 'addStandardJob', keys);
107
+ }
108
+ async addJob(client, job, opts, jobId, parentOpts = {}) {
109
+ const queueKeys = this.queue.keys;
110
+ const parent = job.parent
111
+ ? Object.assign(Object.assign({}, job.parent), { fpof: opts.fpof, rdof: opts.rdof, idof: opts.idof }) : null;
112
+ const args = [
113
+ queueKeys[''],
114
+ typeof jobId !== 'undefined' ? jobId : '',
115
+ job.name,
116
+ job.timestamp,
117
+ job.parentKey || null,
118
+ parentOpts.waitChildrenKey || null,
119
+ parentOpts.parentDependenciesKey || null,
120
+ parent,
121
+ job.repeatJobKey,
122
+ job.deduplicationId ? `${queueKeys.de}:${job.deduplicationId}` : null,
123
+ ];
124
+ let encodedOpts;
125
+ if (opts.repeat) {
126
+ const repeat = Object.assign({}, opts.repeat);
127
+ if (repeat.startDate) {
128
+ repeat.startDate = +new Date(repeat.startDate);
129
+ }
130
+ if (repeat.endDate) {
131
+ repeat.endDate = +new Date(repeat.endDate);
132
+ }
133
+ encodedOpts = pack(Object.assign(Object.assign({}, opts), { repeat }));
134
+ }
135
+ else {
136
+ encodedOpts = pack(opts);
137
+ }
138
+ let result;
139
+ if (parentOpts.waitChildrenKey) {
140
+ result = await this.addParentJob(client, job, encodedOpts, args);
141
+ }
142
+ else if (typeof opts.delay == 'number') {
143
+ result = await this.addDelayedJob(client, job, encodedOpts, args);
144
+ }
145
+ else if (opts.priority) {
146
+ result = await this.addPrioritizedJob(client, job, encodedOpts, args);
147
+ }
148
+ else {
149
+ result = await this.addStandardJob(client, job, encodedOpts, args);
150
+ }
151
+ if (result < 0) {
152
+ throw this.finishedErrors({
153
+ code: result,
154
+ parentKey: parentOpts.parentKey,
155
+ command: 'addJob',
156
+ });
157
+ }
158
+ return result;
159
+ }
160
+ pauseArgs(pause) {
161
+ let src = 'wait', dst = 'paused';
162
+ if (!pause) {
163
+ src = 'paused';
164
+ dst = 'wait';
165
+ }
166
+ const keys = [src, dst, 'meta', 'prioritized'].map((name) => this.queue.toKey(name));
167
+ keys.push(this.queue.keys.events, this.queue.keys.delayed, this.queue.keys.marker);
168
+ const args = [pause ? 'paused' : 'resumed'];
169
+ return keys.concat(args);
170
+ }
171
+ async pause(pause) {
172
+ const client = await this.queue.client;
173
+ const args = this.pauseArgs(pause);
174
+ return this.execCommand(client, 'pause', args);
175
+ }
176
+ addRepeatableJobArgs(customKey, nextMillis, opts, legacyCustomKey) {
177
+ const queueKeys = this.queue.keys;
178
+ const keys = [
179
+ queueKeys.repeat,
180
+ queueKeys.delayed,
181
+ ];
182
+ const args = [
183
+ nextMillis,
184
+ pack(opts),
185
+ legacyCustomKey,
186
+ customKey,
187
+ queueKeys[''],
188
+ ];
189
+ return keys.concat(args);
190
+ }
191
+ async addRepeatableJob(customKey, nextMillis, opts, legacyCustomKey) {
192
+ const client = await this.queue.client;
193
+ const args = this.addRepeatableJobArgs(customKey, nextMillis, opts, legacyCustomKey);
194
+ return this.execCommand(client, 'addRepeatableJob', args);
195
+ }
196
+ async addJobScheduler(client, jobSchedulerId, nextMillis, templateData, templateOpts, opts) {
197
+ const queueKeys = this.queue.keys;
198
+ const keys = [
199
+ queueKeys.repeat,
200
+ queueKeys.delayed,
201
+ ];
202
+ const args = [
203
+ nextMillis,
204
+ pack(opts),
205
+ jobSchedulerId,
206
+ templateData,
207
+ pack(templateOpts),
208
+ queueKeys[''],
209
+ ];
210
+ return this.execCommand(client, 'addJobScheduler', keys.concat(args));
211
+ }
212
+ async updateRepeatableJobMillis(client, customKey, nextMillis, legacyCustomKey) {
213
+ const args = [
214
+ this.queue.keys.repeat,
215
+ nextMillis,
216
+ customKey,
217
+ legacyCustomKey,
218
+ ];
219
+ return this.execCommand(client, 'updateRepeatableJobMillis', args);
220
+ }
221
+ async updateJobSchedulerNextMillis(client, jobSchedulerId, nextMillis) {
222
+ return client.zadd(this.queue.keys.repeat, nextMillis, jobSchedulerId);
223
+ }
224
+ removeRepeatableArgs(legacyRepeatJobId, repeatConcatOptions, repeatJobKey) {
225
+ const queueKeys = this.queue.keys;
226
+ const keys = [queueKeys.repeat, queueKeys.delayed, queueKeys.events];
227
+ const args = [
228
+ legacyRepeatJobId,
229
+ this.getRepeatConcatOptions(repeatConcatOptions, repeatJobKey),
230
+ repeatJobKey,
231
+ queueKeys[''],
232
+ ];
233
+ return keys.concat(args);
234
+ }
235
+ // TODO: remove this check in next breaking change
236
+ getRepeatConcatOptions(repeatConcatOptions, repeatJobKey) {
237
+ if (repeatJobKey && repeatJobKey.split(':').length > 2) {
238
+ return repeatJobKey;
239
+ }
240
+ return repeatConcatOptions;
241
+ }
242
+ async removeRepeatable(legacyRepeatJobId, repeatConcatOptions, repeatJobKey) {
243
+ const client = await this.queue.client;
244
+ const args = this.removeRepeatableArgs(legacyRepeatJobId, repeatConcatOptions, repeatJobKey);
245
+ return this.execCommand(client, 'removeRepeatable', args);
246
+ }
247
+ async removeJobScheduler(jobSchedulerId) {
248
+ const client = await this.queue.client;
249
+ const queueKeys = this.queue.keys;
250
+ const keys = [queueKeys.repeat, queueKeys.delayed, queueKeys.events];
251
+ const args = [jobSchedulerId, queueKeys['']];
252
+ return this.execCommand(client, 'removeJobScheduler', keys.concat(args));
253
+ }
254
+ removeArgs(jobId, removeChildren) {
255
+ const keys = ['', 'meta'].map(name => this.queue.toKey(name));
256
+ const args = [jobId, removeChildren ? 1 : 0];
257
+ return keys.concat(args);
258
+ }
259
+ async remove(jobId, removeChildren) {
260
+ const client = await this.queue.client;
261
+ const args = this.removeArgs(jobId, removeChildren);
262
+ const result = await this.execCommand(client, 'removeJob', args);
263
+ if (result < 0) {
264
+ throw this.finishedErrors({
265
+ code: result,
266
+ jobId,
267
+ command: 'removeJob',
268
+ });
269
+ }
270
+ return result;
271
+ }
272
+ async extendLock(jobId, token, duration, client) {
273
+ client = client || (await this.queue.client);
274
+ const args = [
275
+ this.queue.toKey(jobId) + ':lock',
276
+ this.queue.keys.stalled,
277
+ token,
278
+ duration,
279
+ jobId,
280
+ ];
281
+ return this.execCommand(client, 'extendLock', args);
282
+ }
283
+ async extendLocks(jobIds, tokens, duration) {
284
+ const client = await this.queue.client;
285
+ const args = [
286
+ this.queue.keys.stalled,
287
+ this.queue.toKey(''),
288
+ pack(tokens),
289
+ pack(jobIds),
290
+ duration,
291
+ ];
292
+ return this.execCommand(client, 'extendLocks', args);
293
+ }
294
+ async updateData(job, data) {
295
+ const client = await this.queue.client;
296
+ const keys = [this.queue.toKey(job.id)];
297
+ const dataJson = JSON.stringify(data);
298
+ const result = await this.execCommand(client, 'updateData', keys.concat([dataJson]));
299
+ if (result < 0) {
300
+ throw this.finishedErrors({
301
+ code: result,
302
+ jobId: job.id,
303
+ command: 'updateData',
304
+ });
305
+ }
306
+ }
307
+ async updateProgress(jobId, progress) {
308
+ const client = await this.queue.client;
309
+ const keys = [
310
+ this.queue.toKey(jobId),
311
+ this.queue.keys.events,
312
+ this.queue.keys.meta,
313
+ ];
314
+ const progressJson = JSON.stringify(progress);
315
+ const result = await this.execCommand(client, 'updateProgress', keys.concat([jobId, progressJson]));
316
+ if (result < 0) {
317
+ throw this.finishedErrors({
318
+ code: result,
319
+ jobId,
320
+ command: 'updateProgress',
321
+ });
322
+ }
323
+ }
324
+ async addLog(jobId, logRow, keepLogs) {
325
+ const client = await this.queue.client;
326
+ const keys = [
327
+ this.queue.toKey(jobId),
328
+ this.queue.toKey(jobId) + ':logs',
329
+ ];
330
+ const result = await this.execCommand(client, 'addLog', keys.concat([jobId, logRow, keepLogs ? keepLogs : '']));
331
+ if (result < 0) {
332
+ throw this.finishedErrors({
333
+ code: result,
334
+ jobId,
335
+ command: 'addLog',
336
+ });
337
+ }
338
+ return result;
339
+ }
340
+ moveToFinishedArgs(job, val, propVal, shouldRemove, target, token, timestamp, fetchNext = true, fieldsToUpdate) {
341
+ var _a, _b, _c, _d, _e, _f;
342
+ const queueKeys = this.queue.keys;
343
+ const opts = this.queue.opts;
344
+ const workerKeepJobs = target === 'completed' ? opts.removeOnComplete : opts.removeOnFail;
345
+ const metricsKey = this.queue.toKey(`metrics:${target}`);
346
+ const keys = this.moveToFinishedKeys;
347
+ keys[10] = queueKeys[target];
348
+ keys[11] = this.queue.toKey((_a = job.id) !== null && _a !== void 0 ? _a : '');
349
+ keys[12] = metricsKey;
350
+ keys[13] = this.queue.keys.marker;
351
+ const keepJobs = this.getKeepJobs(shouldRemove, workerKeepJobs);
352
+ const args = [
353
+ job.id,
354
+ timestamp,
355
+ propVal,
356
+ typeof val === 'undefined' ? 'null' : val,
357
+ target,
358
+ !fetchNext || this.queue.closing ? 0 : 1,
359
+ queueKeys[''],
360
+ pack({
361
+ token,
362
+ keepJobs,
363
+ limiter: opts.limiter,
364
+ lockDuration: opts.lockDuration,
365
+ attempts: job.opts.attempts,
366
+ maxMetricsSize: ((_b = opts.metrics) === null || _b === void 0 ? void 0 : _b.maxDataPoints)
367
+ ? (_c = opts.metrics) === null || _c === void 0 ? void 0 : _c.maxDataPoints
368
+ : '',
369
+ fpof: !!((_d = job.opts) === null || _d === void 0 ? void 0 : _d.failParentOnFailure),
370
+ idof: !!((_e = job.opts) === null || _e === void 0 ? void 0 : _e.ignoreDependencyOnFailure),
371
+ rdof: !!((_f = job.opts) === null || _f === void 0 ? void 0 : _f.removeDependencyOnFailure),
372
+ }),
373
+ fieldsToUpdate ? pack((0, utils_1.objectToFlatArray)(fieldsToUpdate)) : void 0,
374
+ ];
375
+ return keys.concat(args);
376
+ }
377
+ getKeepJobs(shouldRemove, workerKeepJobs) {
378
+ if (typeof shouldRemove === 'undefined') {
379
+ return workerKeepJobs || { count: shouldRemove ? 0 : -1 };
380
+ }
381
+ return typeof shouldRemove === 'object'
382
+ ? shouldRemove
383
+ : typeof shouldRemove === 'number'
384
+ ? { count: shouldRemove }
385
+ : { count: shouldRemove ? 0 : -1 };
386
+ }
387
+ async moveToFinished(jobId, args) {
388
+ const client = await this.queue.client;
389
+ const result = await this.execCommand(client, 'moveToFinished', args);
390
+ if (result < 0) {
391
+ throw this.finishedErrors({
392
+ code: result,
393
+ jobId,
394
+ command: 'moveToFinished',
395
+ state: 'active',
396
+ });
397
+ }
398
+ else {
399
+ if (typeof result !== 'undefined') {
400
+ return raw2NextJobData(result);
401
+ }
402
+ }
403
+ }
404
+ drainArgs(delayed) {
405
+ const queueKeys = this.queue.keys;
406
+ const keys = [
407
+ queueKeys.wait,
408
+ queueKeys.paused,
409
+ delayed ? queueKeys.delayed : '',
410
+ queueKeys.prioritized,
411
+ queueKeys.repeat,
412
+ ];
413
+ const args = [queueKeys['']];
414
+ return keys.concat(args);
415
+ }
416
+ async drain(delayed) {
417
+ const client = await this.queue.client;
418
+ const args = this.drainArgs(delayed);
419
+ return this.execCommand(client, 'drain', args);
420
+ }
421
+ removeChildDependencyArgs(jobId, parentKey) {
422
+ const queueKeys = this.queue.keys;
423
+ const keys = [queueKeys['']];
424
+ const args = [this.queue.toKey(jobId), parentKey];
425
+ return keys.concat(args);
426
+ }
427
+ async removeChildDependency(jobId, parentKey) {
428
+ const client = await this.queue.client;
429
+ const args = this.removeChildDependencyArgs(jobId, parentKey);
430
+ const result = await this.execCommand(client, 'removeChildDependency', args);
431
+ switch (result) {
432
+ case 0:
433
+ return true;
434
+ case 1:
435
+ return false;
436
+ default:
437
+ throw this.finishedErrors({
438
+ code: result,
439
+ jobId,
440
+ parentKey,
441
+ command: 'removeChildDependency',
442
+ });
443
+ }
444
+ }
445
+ getRangesArgs(types, start, end, asc) {
446
+ const queueKeys = this.queue.keys;
447
+ const transformedTypes = types.map(type => {
448
+ return type === 'waiting' ? 'wait' : type;
449
+ });
450
+ const keys = [queueKeys['']];
451
+ const args = [start, end, asc ? '1' : '0', ...transformedTypes];
452
+ return keys.concat(args);
453
+ }
454
+ async getRanges(types, start = 0, end = 1, asc = false) {
455
+ const client = await this.queue.client;
456
+ const args = this.getRangesArgs(types, start, end, asc);
457
+ return await this.execCommand(client, 'getRanges', args);
458
+ }
459
+ getCountsArgs(types) {
460
+ const queueKeys = this.queue.keys;
461
+ const transformedTypes = types.map(type => {
462
+ return type === 'waiting' ? 'wait' : type;
463
+ });
464
+ const keys = [queueKeys['']];
465
+ const args = [...transformedTypes];
466
+ return keys.concat(args);
467
+ }
468
+ async getCounts(types) {
469
+ const client = await this.queue.client;
470
+ const args = this.getCountsArgs(types);
471
+ return await this.execCommand(client, 'getCounts', args);
472
+ }
473
+ getCountsPerPriorityArgs(priorities) {
474
+ const keys = [
475
+ this.queue.keys.wait,
476
+ this.queue.keys.paused,
477
+ this.queue.keys.meta,
478
+ this.queue.keys.prioritized,
479
+ ];
480
+ const args = priorities;
481
+ return keys.concat(args);
482
+ }
483
+ async getCountsPerPriority(priorities) {
484
+ const client = await this.queue.client;
485
+ const args = this.getCountsPerPriorityArgs(priorities);
486
+ return await this.execCommand(client, 'getCountsPerPriority', args);
487
+ }
488
+ moveToCompletedArgs(job, returnvalue, removeOnComplete, token, fetchNext = false) {
489
+ const timestamp = Date.now();
490
+ return this.moveToFinishedArgs(job, returnvalue, 'returnvalue', removeOnComplete, 'completed', token, timestamp, fetchNext);
491
+ }
492
+ moveToFailedArgs(job, failedReason, removeOnFailed, token, fetchNext = false, fieldsToUpdate) {
493
+ const timestamp = Date.now();
494
+ return this.moveToFinishedArgs(job, failedReason, 'failedReason', removeOnFailed, 'failed', token, timestamp, fetchNext, fieldsToUpdate);
495
+ }
496
+ async isFinished(jobId, returnValue = false) {
497
+ const client = await this.queue.client;
498
+ const keys = ['completed', 'failed', jobId].map((key) => {
499
+ return this.queue.toKey(key);
500
+ });
501
+ return this.execCommand(client, 'isFinished', keys.concat([jobId, returnValue ? '1' : '']));
502
+ }
503
+ async getState(jobId) {
504
+ const client = await this.queue.client;
505
+ const keys = [
506
+ 'completed',
507
+ 'failed',
508
+ 'delayed',
509
+ 'active',
510
+ 'wait',
511
+ 'paused',
512
+ 'waiting-children',
513
+ 'prioritized',
514
+ ].map((key) => {
515
+ return this.queue.toKey(key);
516
+ });
517
+ if ((0, utils_1.isRedisVersionLowerThan)(this.queue.redisVersion, '6.0.6')) {
518
+ return this.execCommand(client, 'getState', keys.concat([jobId]));
519
+ }
520
+ return this.execCommand(client, 'getStateV2', keys.concat([jobId]));
521
+ }
522
+ async changeDelay(jobId, delay) {
523
+ const client = await this.queue.client;
524
+ const args = this.changeDelayArgs(jobId, delay);
525
+ const result = await this.execCommand(client, 'changeDelay', args);
526
+ if (result < 0) {
527
+ throw this.finishedErrors({
528
+ code: result,
529
+ jobId,
530
+ command: 'changeDelay',
531
+ state: 'delayed',
532
+ });
533
+ }
534
+ }
535
+ changeDelayArgs(jobId, delay) {
536
+ const timestamp = Date.now();
537
+ const keys = [
538
+ this.queue.keys.delayed,
539
+ this.queue.keys.meta,
540
+ this.queue.keys.marker,
541
+ this.queue.keys.events,
542
+ ];
543
+ return keys.concat([
544
+ delay,
545
+ JSON.stringify(timestamp),
546
+ jobId,
547
+ this.queue.toKey(jobId),
548
+ ]);
549
+ }
550
+ async changePriority(jobId, priority = 0, lifo = false) {
551
+ const client = await this.queue.client;
552
+ const args = this.changePriorityArgs(jobId, priority, lifo);
553
+ const result = await this.execCommand(client, 'changePriority', args);
554
+ if (result < 0) {
555
+ throw this.finishedErrors({
556
+ code: result,
557
+ jobId,
558
+ command: 'changePriority',
559
+ });
560
+ }
561
+ }
562
+ changePriorityArgs(jobId, priority = 0, lifo = false) {
563
+ const keys = [
564
+ this.queue.keys.wait,
565
+ this.queue.keys.paused,
566
+ this.queue.keys.meta,
567
+ this.queue.keys.prioritized,
568
+ this.queue.keys.active,
569
+ this.queue.keys.pc,
570
+ this.queue.keys.marker,
571
+ ];
572
+ return keys.concat([priority, this.queue.toKey(''), jobId, lifo ? 1 : 0]);
573
+ }
574
+ moveToDelayedArgs(jobId, timestamp, token, delay, opts = {}) {
575
+ const queueKeys = this.queue.keys;
576
+ const keys = [
577
+ queueKeys.marker,
578
+ queueKeys.active,
579
+ queueKeys.prioritized,
580
+ queueKeys.delayed,
581
+ this.queue.toKey(jobId),
582
+ queueKeys.events,
583
+ queueKeys.meta,
584
+ queueKeys.stalled,
585
+ ];
586
+ return keys.concat([
587
+ this.queue.keys[''],
588
+ timestamp,
589
+ jobId,
590
+ token,
591
+ delay,
592
+ opts.skipAttempt ? '1' : '0',
593
+ opts.fieldsToUpdate
594
+ ? pack((0, utils_1.objectToFlatArray)(opts.fieldsToUpdate))
595
+ : void 0,
596
+ ]);
597
+ }
598
+ moveToWaitingChildrenArgs(jobId, token, opts) {
599
+ const timestamp = Date.now();
600
+ const childKey = (0, utils_1.getParentKey)(opts.child);
601
+ const keys = [
602
+ `${jobId}:lock`,
603
+ 'active',
604
+ 'waiting-children',
605
+ jobId,
606
+ 'stalled',
607
+ ].map(name => {
608
+ return this.queue.toKey(name);
609
+ });
610
+ return keys.concat([
611
+ token,
612
+ childKey !== null && childKey !== void 0 ? childKey : '',
613
+ JSON.stringify(timestamp),
614
+ jobId,
615
+ ]);
616
+ }
617
+ isMaxedArgs() {
618
+ const queueKeys = this.queue.keys;
619
+ const keys = [queueKeys.meta, queueKeys.active];
620
+ return keys;
621
+ }
622
+ async isMaxed() {
623
+ const client = await this.queue.client;
624
+ const args = this.isMaxedArgs();
625
+ return !!(await this.execCommand(client, 'isMaxed', args));
626
+ }
627
+ async moveToDelayed(jobId, timestamp, delay, token = '0', opts = {}) {
628
+ const client = await this.queue.client;
629
+ const args = this.moveToDelayedArgs(jobId, timestamp, token, delay, opts);
630
+ const result = await this.execCommand(client, 'moveToDelayed', args);
631
+ if (result < 0) {
632
+ throw this.finishedErrors({
633
+ code: result,
634
+ jobId,
635
+ command: 'moveToDelayed',
636
+ state: 'active',
637
+ });
638
+ }
639
+ }
640
+ /**
641
+ * Move parent job to waiting-children state.
642
+ *
643
+ * @returns true if job is successfully moved, false if there are pending dependencies.
644
+ * @throws JobNotExist
645
+ * This exception is thrown if jobId is missing.
646
+ * @throws JobLockNotExist
647
+ * This exception is thrown if job lock is missing.
648
+ * @throws JobNotInState
649
+ * This exception is thrown if job is not in active state.
650
+ */
651
+ async moveToWaitingChildren(jobId, token, opts = {}) {
652
+ const client = await this.queue.client;
653
+ const args = this.moveToWaitingChildrenArgs(jobId, token, opts);
654
+ const result = await this.execCommand(client, 'moveToWaitingChildren', args);
655
+ switch (result) {
656
+ case 0:
657
+ return true;
658
+ case 1:
659
+ return false;
660
+ default:
661
+ throw this.finishedErrors({
662
+ code: result,
663
+ jobId,
664
+ command: 'moveToWaitingChildren',
665
+ state: 'active',
666
+ });
667
+ }
668
+ }
669
+ getRateLimitTtlArgs(maxJobs) {
670
+ const keys = [this.queue.keys.limiter];
671
+ return keys.concat([maxJobs !== null && maxJobs !== void 0 ? maxJobs : '0']);
672
+ }
673
+ async getRateLimitTtl(maxJobs) {
674
+ const client = await this.queue.client;
675
+ const args = this.getRateLimitTtlArgs(maxJobs);
676
+ return this.execCommand(client, 'getRateLimitTtl', args);
677
+ }
678
+ /**
679
+ * Remove jobs in a specific state.
680
+ *
681
+ * @returns Id jobs from the deleted records.
682
+ */
683
+ async cleanJobsInSet(set, timestamp, limit = 0) {
684
+ const client = await this.queue.client;
685
+ return this.execCommand(client, 'cleanJobsInSet', [
686
+ this.queue.toKey(set),
687
+ this.queue.toKey('events'),
688
+ this.queue.toKey('repeat'),
689
+ this.queue.toKey(''),
690
+ timestamp,
691
+ limit,
692
+ set,
693
+ ]);
694
+ }
695
+ getJobSchedulerArgs(id) {
696
+ const keys = [this.queue.keys.repeat];
697
+ return keys.concat([id]);
698
+ }
699
+ async getJobScheduler(id) {
700
+ const client = await this.queue.client;
701
+ const args = this.getJobSchedulerArgs(id);
702
+ return this.execCommand(client, 'getJobScheduler', args);
703
+ }
704
+ retryJobArgs(jobId, lifo, token, fieldsToUpdate) {
705
+ const keys = [
706
+ this.queue.keys.active,
707
+ this.queue.keys.wait,
708
+ this.queue.keys.paused,
709
+ this.queue.toKey(jobId),
710
+ this.queue.keys.meta,
711
+ this.queue.keys.events,
712
+ this.queue.keys.delayed,
713
+ this.queue.keys.prioritized,
714
+ this.queue.keys.pc,
715
+ this.queue.keys.marker,
716
+ this.queue.keys.stalled,
717
+ ];
718
+ const pushCmd = (lifo ? 'R' : 'L') + 'PUSH';
719
+ return keys.concat([
720
+ this.queue.toKey(''),
721
+ Date.now(),
722
+ pushCmd,
723
+ jobId,
724
+ token,
725
+ fieldsToUpdate ? pack((0, utils_1.objectToFlatArray)(fieldsToUpdate)) : void 0,
726
+ ]);
727
+ }
728
+ async retryJob(jobId, lifo, token, fieldsToUpdate) {
729
+ const client = await this.queue.client;
730
+ const args = this.retryJobArgs(jobId, lifo, token, fieldsToUpdate);
731
+ const result = await this.execCommand(client, 'retryJob', args);
732
+ if (result < 0) {
733
+ throw this.finishedErrors({
734
+ code: result,
735
+ jobId,
736
+ command: 'retryJob',
737
+ state: 'active',
738
+ });
739
+ }
740
+ }
741
+ moveJobsToWaitArgs(state, count, timestamp) {
742
+ const keys = [
743
+ this.queue.toKey(''),
744
+ this.queue.keys.events,
745
+ this.queue.toKey(state),
746
+ this.queue.toKey('wait'),
747
+ this.queue.toKey('paused'),
748
+ this.queue.keys.meta,
749
+ this.queue.keys.active,
750
+ this.queue.keys.marker,
751
+ ];
752
+ const args = [count, timestamp, state];
753
+ return keys.concat(args);
754
+ }
755
+ async retryJobs(state = 'failed', count = 1000, timestamp = new Date().getTime()) {
756
+ const client = await this.queue.client;
757
+ const args = this.moveJobsToWaitArgs(state, count, timestamp);
758
+ return this.execCommand(client, 'moveJobsToWait', args);
759
+ }
760
+ async promoteJobs(count = 1000) {
761
+ const client = await this.queue.client;
762
+ const args = this.moveJobsToWaitArgs('delayed', count, Number.MAX_VALUE);
763
+ return this.execCommand(client, 'moveJobsToWait', args);
764
+ }
765
+ /**
766
+ * Attempts to reprocess a job
767
+ *
768
+ * @param job -
769
+ * @param state - The expected job state. If the job is not found
770
+ * on the provided state, then it's not reprocessed. Supported states: 'failed', 'completed'
771
+ *
772
+ * @returns Returns a promise that evaluates to a return code:
773
+ * 1 means the operation was a success
774
+ * 0 means the job does not exist
775
+ * -1 means the job is currently locked and can't be retried.
776
+ * -2 means the job was not found in the expected set
777
+ */
778
+ async reprocessJob(job, state) {
779
+ const client = await this.queue.client;
780
+ const keys = [
781
+ this.queue.toKey(job.id),
782
+ this.queue.keys.events,
783
+ this.queue.toKey(state),
784
+ this.queue.keys.wait,
785
+ this.queue.keys.meta,
786
+ this.queue.keys.paused,
787
+ this.queue.keys.active,
788
+ this.queue.keys.marker,
789
+ ];
790
+ const args = [
791
+ job.id,
792
+ (job.opts.lifo ? 'R' : 'L') + 'PUSH',
793
+ state === 'failed' ? 'failedReason' : 'returnvalue',
794
+ state,
795
+ ];
796
+ const result = await this.execCommand(client, 'reprocessJob', keys.concat(args));
797
+ switch (result) {
798
+ case 1:
799
+ return;
800
+ default:
801
+ throw this.finishedErrors({
802
+ code: result,
803
+ jobId: job.id,
804
+ command: 'reprocessJob',
805
+ state,
806
+ });
807
+ }
808
+ }
809
+ async moveToActive(client, token, name) {
810
+ const opts = this.queue.opts;
811
+ const queueKeys = this.queue.keys;
812
+ const keys = [
813
+ queueKeys.wait,
814
+ queueKeys.active,
815
+ queueKeys.prioritized,
816
+ queueKeys.events,
817
+ queueKeys.stalled,
818
+ queueKeys.limiter,
819
+ queueKeys.delayed,
820
+ queueKeys.paused,
821
+ queueKeys.meta,
822
+ queueKeys.pc,
823
+ queueKeys.marker,
824
+ ];
825
+ const args = [
826
+ queueKeys[''],
827
+ Date.now(),
828
+ pack({
829
+ token,
830
+ lockDuration: opts.lockDuration,
831
+ limiter: opts.limiter,
832
+ name,
833
+ }),
834
+ ];
835
+ const result = await this.execCommand(client, 'moveToActive', keys.concat(args));
836
+ return raw2NextJobData(result);
837
+ }
838
+ async promote(jobId) {
839
+ const client = await this.queue.client;
840
+ const keys = [
841
+ this.queue.keys.delayed,
842
+ this.queue.keys.wait,
843
+ this.queue.keys.paused,
844
+ this.queue.keys.meta,
845
+ this.queue.keys.prioritized,
846
+ this.queue.keys.active,
847
+ this.queue.keys.pc,
848
+ this.queue.keys.events,
849
+ this.queue.keys.marker,
850
+ ];
851
+ const args = [this.queue.toKey(''), jobId];
852
+ const code = await this.execCommand(client, 'promote', keys.concat(args));
853
+ if (code < 0) {
854
+ throw this.finishedErrors({
855
+ code,
856
+ jobId,
857
+ command: 'promote',
858
+ state: 'delayed',
859
+ });
860
+ }
861
+ }
862
+ moveStalledJobsToWaitArgs() {
863
+ const opts = this.queue.opts;
864
+ const keys = [
865
+ this.queue.keys.stalled,
866
+ this.queue.keys.wait,
867
+ this.queue.keys.active,
868
+ this.queue.keys.failed,
869
+ this.queue.keys['stalled-check'],
870
+ this.queue.keys.meta,
871
+ this.queue.keys.paused,
872
+ this.queue.keys.marker,
873
+ this.queue.keys.events,
874
+ ];
875
+ const args = [
876
+ opts.maxStalledCount,
877
+ this.queue.toKey(''),
878
+ Date.now(),
879
+ opts.stalledInterval,
880
+ ];
881
+ return keys.concat(args);
882
+ }
883
+ /**
884
+ * Looks for unlocked jobs in the active queue.
885
+ *
886
+ * The job was being worked on, but the worker process died and it failed to renew the lock.
887
+ * We call these jobs 'stalled'. This is the most common case. We resolve these by moving them
888
+ * back to wait to be re-processed. To prevent jobs from cycling endlessly between active and wait,
889
+ * (e.g. if the job handler keeps crashing),
890
+ * we limit the number stalled job recoveries to settings.maxStalledCount.
891
+ */
892
+ async moveStalledJobsToWait() {
893
+ const client = await this.queue.client;
894
+ const args = this.moveStalledJobsToWaitArgs();
895
+ return this.execCommand(client, 'moveStalledJobsToWait', args);
896
+ }
897
+ /**
898
+ * Moves a job back from Active to Wait.
899
+ * This script is used when a job has been manually rate limited and needs
900
+ * to be moved back to wait from active status.
901
+ *
902
+ * @param client - Redis client
903
+ * @param jobId - Job id
904
+ * @returns
905
+ */
906
+ async moveJobFromActiveToWait(jobId, token) {
907
+ const client = await this.queue.client;
908
+ const lockKey = `${this.queue.toKey(jobId)}:lock`;
909
+ const keys = [
910
+ this.queue.keys.active,
911
+ this.queue.keys.wait,
912
+ this.queue.keys.stalled,
913
+ lockKey,
914
+ this.queue.keys.paused,
915
+ this.queue.keys.meta,
916
+ this.queue.keys.limiter,
917
+ this.queue.keys.prioritized,
918
+ this.queue.keys.marker,
919
+ this.queue.keys.events,
920
+ ];
921
+ const args = [jobId, token, this.queue.toKey(jobId)];
922
+ const pttl = await this.execCommand(client, 'moveJobFromActiveToWait', keys.concat(args));
923
+ return pttl < 0 ? 0 : pttl;
924
+ }
925
+ async obliterate(opts) {
926
+ const client = await this.queue.client;
927
+ const keys = [
928
+ this.queue.keys.meta,
929
+ this.queue.toKey(''),
930
+ ];
931
+ const args = [opts.count, opts.force ? 'force' : null];
932
+ const result = await this.execCommand(client, 'obliterate', keys.concat(args));
933
+ if (result < 0) {
934
+ switch (result) {
935
+ case -1:
936
+ throw new Error('Cannot obliterate non-paused queue');
937
+ case -2:
938
+ throw new Error('Cannot obliterate queue with active jobs');
939
+ }
940
+ }
941
+ return result;
942
+ }
943
+ /**
944
+ * Paginate a set or hash keys.
945
+ * @param opts
946
+ *
947
+ */
948
+ async paginate(key, opts) {
949
+ const client = await this.queue.client;
950
+ const keys = [key];
951
+ const maxIterations = 5;
952
+ const pageSize = opts.end >= 0 ? opts.end - opts.start + 1 : Infinity;
953
+ let cursor = '0', offset = 0, items, total, rawJobs, page = [], jobs = [];
954
+ do {
955
+ const args = [
956
+ opts.start + page.length,
957
+ opts.end,
958
+ cursor,
959
+ offset,
960
+ maxIterations,
961
+ ];
962
+ if (opts.fetchJobs) {
963
+ args.push(1);
964
+ }
965
+ [cursor, offset, items, total, rawJobs] = await this.execCommand(client, 'paginate', keys.concat(args));
966
+ page = page.concat(items);
967
+ if (rawJobs && rawJobs.length) {
968
+ jobs = jobs.concat(rawJobs.map(utils_1.array2obj));
969
+ }
970
+ // Important to keep this coercive inequality (!=) instead of strict inequality (!==)
971
+ } while (cursor != '0' && page.length < pageSize);
972
+ // If we get an array of arrays, it means we are paginating a hash
973
+ if (page.length && Array.isArray(page[0])) {
974
+ const result = [];
975
+ for (let index = 0; index < page.length; index++) {
976
+ const [id, value] = page[index];
977
+ try {
978
+ result.push({ id, v: JSON.parse(value) });
979
+ }
980
+ catch (err) {
981
+ result.push({ id, err: err.message });
982
+ }
983
+ }
984
+ return {
985
+ cursor,
986
+ items: result,
987
+ total,
988
+ jobs,
989
+ };
990
+ }
991
+ else {
992
+ return {
993
+ cursor,
994
+ items: page.map(item => ({ id: item })),
995
+ total,
996
+ jobs,
997
+ };
998
+ }
999
+ }
1000
+ finishedErrors({ code, jobId, parentKey, command, state, }) {
1001
+ switch (code) {
1002
+ case enums_1.ErrorCode.JobNotExist:
1003
+ return new Error(`Missing key for job ${jobId}. ${command}`);
1004
+ case enums_1.ErrorCode.JobLockNotExist:
1005
+ return new Error(`Missing lock for job ${jobId}. ${command}`);
1006
+ case enums_1.ErrorCode.JobNotInState:
1007
+ return new Error(`Job ${jobId} is not in the ${state} state. ${command}`);
1008
+ case enums_1.ErrorCode.JobPendingDependencies:
1009
+ return new Error(`Job ${jobId} has pending dependencies. ${command}`);
1010
+ case enums_1.ErrorCode.ParentJobNotExist:
1011
+ return new Error(`Missing key for parent job ${parentKey}. ${command}`);
1012
+ case enums_1.ErrorCode.JobLockMismatch:
1013
+ return new Error(`Lock mismatch for job ${jobId}. Cmd ${command} from ${state}`);
1014
+ case enums_1.ErrorCode.ParentJobCannotBeReplaced:
1015
+ return new Error(`The parent job ${parentKey} cannot be replaced. ${command}`);
1016
+ case enums_1.ErrorCode.JobBelongsToJobScheduler:
1017
+ return new Error(`Job ${jobId} belongs to a job scheduler and cannot be removed directly. ${command}`);
1018
+ default:
1019
+ return new Error(`Unknown code ${code} error for ${jobId}. ${command}`);
1020
+ }
1021
+ }
1022
+ }
1023
+ exports.Scripts = Scripts;
1024
+ function raw2NextJobData(raw) {
1025
+ if (raw) {
1026
+ const result = [null, raw[1], raw[2], raw[3]];
1027
+ if (raw[0]) {
1028
+ result[0] = (0, utils_1.array2obj)(raw[0]);
1029
+ }
1030
+ return result;
1031
+ }
1032
+ return [];
1033
+ }
1034
+ exports.raw2NextJobData = raw2NextJobData;
1035
+ //# sourceMappingURL=scripts.js.map