@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,893 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Job = exports.PRIORITY_LIMIT = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const util_1 = require("util");
6
+ const utils_1 = require("../utils");
7
+ const backoffs_1 = require("./backoffs");
8
+ const scripts_1 = require("./scripts");
9
+ const unrecoverable_error_1 = require("./errors/unrecoverable-error");
10
+ const enums_1 = require("../enums");
11
+ const logger = (0, util_1.debuglog)('bull');
12
+ // Simple options decode map.
13
+ const optsDecodeMap = {
14
+ de: 'deduplication',
15
+ fpof: 'failParentOnFailure',
16
+ idof: 'ignoreDependencyOnFailure',
17
+ kl: 'keepLogs',
18
+ rdof: 'removeDependencyOnFailure',
19
+ };
20
+ const optsEncodeMap = Object.assign(Object.assign({}, (0, utils_1.invertObject)(optsDecodeMap)), {
21
+ /*/ Legacy for backwards compatibility */ debounce: 'de' });
22
+ exports.PRIORITY_LIMIT = 2 ** 21;
23
+ /**
24
+ * Job
25
+ *
26
+ * This class represents a Job in the queue. Normally job are implicitly created when
27
+ * you add a job to the queue with methods such as Queue.addJob( ... )
28
+ *
29
+ * A Job instance is also passed to the Worker's process function.
30
+ *
31
+ * @class Job
32
+ */
33
+ class Job {
34
+ constructor(queue,
35
+ /**
36
+ * The name of the Job
37
+ */
38
+ name,
39
+ /**
40
+ * The payload for this job.
41
+ */
42
+ data,
43
+ /**
44
+ * The options object for this job.
45
+ */
46
+ opts = {}, id) {
47
+ this.queue = queue;
48
+ this.name = name;
49
+ this.data = data;
50
+ this.opts = opts;
51
+ this.id = id;
52
+ /**
53
+ * The progress a job has performed so far.
54
+ * @defaultValue 0
55
+ */
56
+ this.progress = 0;
57
+ /**
58
+ * The value returned by the processor when processing this job.
59
+ * @defaultValue null
60
+ */
61
+ this.returnvalue = null;
62
+ /**
63
+ * Stacktrace for the error (for failed jobs).
64
+ * @defaultValue null
65
+ */
66
+ this.stacktrace = null;
67
+ /**
68
+ * An amount of milliseconds to wait until this job can be processed.
69
+ * @defaultValue 0
70
+ */
71
+ this.delay = 0;
72
+ /**
73
+ * Ranges from 0 (highest priority) to 2 097 152 (lowest priority). Note that
74
+ * using priorities has a slight impact on performance,
75
+ * so do not use it if not required.
76
+ * @defaultValue 0
77
+ */
78
+ this.priority = 0;
79
+ /**
80
+ * Number of attempts when job is moved to active.
81
+ * @defaultValue 0
82
+ */
83
+ this.attemptsStarted = 0;
84
+ /**
85
+ * Number of attempts after the job has failed.
86
+ * @defaultValue 0
87
+ */
88
+ this.attemptsMade = 0;
89
+ const _a = this.opts, { repeatJobKey } = _a, restOpts = tslib_1.__rest(_a, ["repeatJobKey"]);
90
+ this.opts = Object.assign({
91
+ attempts: 0,
92
+ }, restOpts);
93
+ this.delay = this.opts.delay;
94
+ this.priority = this.opts.priority || 0;
95
+ this.repeatJobKey = repeatJobKey;
96
+ this.timestamp = opts.timestamp ? opts.timestamp : Date.now();
97
+ this.opts.backoff = backoffs_1.Backoffs.normalize(opts.backoff);
98
+ this.parentKey = (0, utils_1.getParentKey)(opts.parent);
99
+ this.parent = opts.parent
100
+ ? { id: opts.parent.id, queueKey: opts.parent.queue }
101
+ : undefined;
102
+ this.debounceId = opts.debounce ? opts.debounce.id : undefined;
103
+ this.deduplicationId = opts.deduplication
104
+ ? opts.deduplication.id
105
+ : this.debounceId;
106
+ this.toKey = queue.toKey.bind(queue);
107
+ this.setScripts();
108
+ this.queueQualifiedName = queue.qualifiedName;
109
+ }
110
+ /**
111
+ * Creates a new job and adds it to the queue.
112
+ *
113
+ * @param queue - the queue where to add the job.
114
+ * @param name - the name of the job.
115
+ * @param data - the payload of the job.
116
+ * @param opts - the options bag for this job.
117
+ * @returns
118
+ */
119
+ static async create(queue, name, data, opts) {
120
+ const client = await queue.client;
121
+ const job = new this(queue, name, data, opts, opts && opts.jobId);
122
+ job.id = await job.addJob(client, {
123
+ parentKey: job.parentKey,
124
+ parentDependenciesKey: job.parentKey
125
+ ? `${job.parentKey}:dependencies`
126
+ : '',
127
+ });
128
+ return job;
129
+ }
130
+ /**
131
+ * Creates a bulk of jobs and adds them atomically to the given queue.
132
+ *
133
+ * @param queue -the queue were to add the jobs.
134
+ * @param jobs - an array of jobs to be added to the queue.
135
+ * @returns
136
+ */
137
+ static async createBulk(queue, jobs) {
138
+ const client = await queue.client;
139
+ const jobInstances = jobs.map(job => { var _a; return new this(queue, job.name, job.data, job.opts, (_a = job.opts) === null || _a === void 0 ? void 0 : _a.jobId); });
140
+ const pipeline = client.pipeline();
141
+ for (const job of jobInstances) {
142
+ job.addJob(pipeline, {
143
+ parentKey: job.parentKey,
144
+ parentDependenciesKey: job.parentKey
145
+ ? `${job.parentKey}:dependencies`
146
+ : '',
147
+ });
148
+ }
149
+ const results = (await pipeline.exec());
150
+ for (let index = 0; index < results.length; ++index) {
151
+ const [err, id] = results[index];
152
+ if (err) {
153
+ throw err;
154
+ }
155
+ jobInstances[index].id = id;
156
+ }
157
+ return jobInstances;
158
+ }
159
+ /**
160
+ * Instantiates a Job from a JobJsonRaw object (coming from a deserialized JSON object)
161
+ *
162
+ * @param queue - the queue where the job belongs to.
163
+ * @param json - the plain object containing the job.
164
+ * @param jobId - an optional job id (overrides the id coming from the JSON object)
165
+ * @returns
166
+ */
167
+ static fromJSON(queue, json, jobId) {
168
+ const data = JSON.parse(json.data || '{}');
169
+ const opts = Job.optsFromJSON(json.opts);
170
+ const job = new this(queue, json.name, data, opts, json.id || jobId);
171
+ job.progress = JSON.parse(json.progress || '0');
172
+ job.delay = parseInt(json.delay);
173
+ job.timestamp = parseInt(json.timestamp);
174
+ if (json.finishedOn) {
175
+ job.finishedOn = parseInt(json.finishedOn);
176
+ }
177
+ if (json.processedOn) {
178
+ job.processedOn = parseInt(json.processedOn);
179
+ }
180
+ if (json.rjk) {
181
+ job.repeatJobKey = json.rjk;
182
+ }
183
+ if (json.deid) {
184
+ job.debounceId = json.deid;
185
+ job.deduplicationId = json.deid;
186
+ }
187
+ job.failedReason = json.failedReason;
188
+ job.attemptsStarted = parseInt(json.ats || '0');
189
+ job.attemptsMade = parseInt(json.attemptsMade || json.atm || '0');
190
+ job.stacktrace = getTraces(json.stacktrace);
191
+ if (typeof json.returnvalue === 'string') {
192
+ job.returnvalue = getReturnValue(json.returnvalue);
193
+ }
194
+ if (json.parentKey) {
195
+ job.parentKey = json.parentKey;
196
+ }
197
+ if (json.parent) {
198
+ job.parent = JSON.parse(json.parent);
199
+ }
200
+ if (json.pb) {
201
+ job.processedBy = json.pb;
202
+ }
203
+ if (json.nrjid) {
204
+ job.nextRepeatableJobId = json.nrjid;
205
+ }
206
+ return job;
207
+ }
208
+ setScripts() {
209
+ this.scripts = new scripts_1.Scripts(this.queue);
210
+ }
211
+ static optsFromJSON(rawOpts) {
212
+ const opts = JSON.parse(rawOpts || '{}');
213
+ const optionEntries = Object.entries(opts);
214
+ const options = {};
215
+ for (const item of optionEntries) {
216
+ const [attributeName, value] = item;
217
+ if (optsDecodeMap[attributeName]) {
218
+ options[optsDecodeMap[attributeName]] =
219
+ value;
220
+ }
221
+ else {
222
+ if (attributeName === 'tm') {
223
+ options.telemetry = Object.assign(Object.assign({}, options.telemetry), { metadata: value });
224
+ }
225
+ else if (attributeName === 'omc') {
226
+ options.telemetry = Object.assign(Object.assign({}, options.telemetry), { omitContext: value });
227
+ }
228
+ else {
229
+ options[attributeName] = value;
230
+ }
231
+ }
232
+ }
233
+ return options;
234
+ }
235
+ /**
236
+ * Fetches a Job from the queue given the passed job id.
237
+ *
238
+ * @param queue - the queue where the job belongs to.
239
+ * @param jobId - the job id.
240
+ * @returns
241
+ */
242
+ static async fromId(queue, jobId) {
243
+ // jobId can be undefined if moveJob returns undefined
244
+ if (jobId) {
245
+ const client = await queue.client;
246
+ const jobData = await client.hgetall(queue.toKey(jobId));
247
+ return (0, utils_1.isEmpty)(jobData)
248
+ ? undefined
249
+ : this.fromJSON(queue, jobData, jobId);
250
+ }
251
+ }
252
+ /**
253
+ * addJobLog
254
+ *
255
+ * @param queue Queue instance
256
+ * @param jobId Job id
257
+ * @param logRow Log row
258
+ * @param keepLogs optional maximum number of logs to keep
259
+ *
260
+ * @returns The total number of log entries for this job so far.
261
+ */
262
+ static addJobLog(queue, jobId, logRow, keepLogs) {
263
+ const scripts = queue.scripts;
264
+ return scripts.addLog(jobId, logRow, keepLogs);
265
+ }
266
+ toJSON() {
267
+ const _a = this, { queue, scripts } = _a, withoutQueueAndScripts = tslib_1.__rest(_a, ["queue", "scripts"]);
268
+ return withoutQueueAndScripts;
269
+ }
270
+ /**
271
+ * Prepares a job to be serialized for storage in Redis.
272
+ * @returns
273
+ */
274
+ asJSON() {
275
+ return (0, utils_1.removeUndefinedFields)({
276
+ id: this.id,
277
+ name: this.name,
278
+ data: JSON.stringify(typeof this.data === 'undefined' ? {} : this.data),
279
+ opts: Job.optsAsJSON(this.opts),
280
+ parent: this.parent ? Object.assign({}, this.parent) : undefined,
281
+ parentKey: this.parentKey,
282
+ progress: this.progress,
283
+ attemptsMade: this.attemptsMade,
284
+ attemptsStarted: this.attemptsStarted,
285
+ finishedOn: this.finishedOn,
286
+ processedOn: this.processedOn,
287
+ timestamp: this.timestamp,
288
+ failedReason: JSON.stringify(this.failedReason),
289
+ stacktrace: JSON.stringify(this.stacktrace),
290
+ debounceId: this.debounceId,
291
+ deduplicationId: this.deduplicationId,
292
+ repeatJobKey: this.repeatJobKey,
293
+ returnvalue: JSON.stringify(this.returnvalue),
294
+ nrjid: this.nextRepeatableJobId,
295
+ });
296
+ }
297
+ static optsAsJSON(opts = {}) {
298
+ const optionEntries = Object.entries(opts);
299
+ const options = {};
300
+ for (const [attributeName, value] of optionEntries) {
301
+ if (typeof value === 'undefined') {
302
+ continue;
303
+ }
304
+ if (attributeName in optsEncodeMap) {
305
+ const compressableAttribute = attributeName;
306
+ const key = optsEncodeMap[compressableAttribute];
307
+ options[key] = value;
308
+ }
309
+ else {
310
+ // Handle complex compressable fields separately
311
+ if (attributeName === 'telemetry') {
312
+ options.tm = value.metadata;
313
+ options.omc = value.omitContext;
314
+ }
315
+ else {
316
+ options[attributeName] = value;
317
+ }
318
+ }
319
+ }
320
+ return options;
321
+ }
322
+ /**
323
+ * Prepares a job to be passed to Sandbox.
324
+ * @returns
325
+ */
326
+ asJSONSandbox() {
327
+ return Object.assign(Object.assign({}, this.asJSON()), { queueName: this.queueName, prefix: this.prefix });
328
+ }
329
+ /**
330
+ * Updates a job's data
331
+ *
332
+ * @param data - the data that will replace the current jobs data.
333
+ */
334
+ updateData(data) {
335
+ this.data = data;
336
+ return this.scripts.updateData(this, data);
337
+ }
338
+ /**
339
+ * Updates a job's progress
340
+ *
341
+ * @param progress - number or object to be saved as progress.
342
+ */
343
+ async updateProgress(progress) {
344
+ this.progress = progress;
345
+ await this.scripts.updateProgress(this.id, progress);
346
+ this.queue.emit('progress', this, progress);
347
+ }
348
+ /**
349
+ * Logs one row of log data.
350
+ *
351
+ * @param logRow - string with log data to be logged.
352
+ * @returns The total number of log entries for this job so far.
353
+ */
354
+ async log(logRow) {
355
+ return Job.addJobLog(this.queue, this.id, logRow, this.opts.keepLogs);
356
+ }
357
+ /**
358
+ * Removes child dependency from parent when child is not yet finished
359
+ *
360
+ * @returns True if the relationship existed and if it was removed.
361
+ */
362
+ async removeChildDependency() {
363
+ const childDependencyIsRemoved = await this.scripts.removeChildDependency(this.id, this.parentKey);
364
+ if (childDependencyIsRemoved) {
365
+ this.parent = undefined;
366
+ this.parentKey = undefined;
367
+ return true;
368
+ }
369
+ return false;
370
+ }
371
+ /**
372
+ * Clears job's logs
373
+ *
374
+ * @param keepLogs - the amount of log entries to preserve
375
+ */
376
+ async clearLogs(keepLogs) {
377
+ const client = await this.queue.client;
378
+ const logsKey = this.toKey(this.id) + ':logs';
379
+ if (keepLogs) {
380
+ await client.ltrim(logsKey, -keepLogs, -1);
381
+ }
382
+ else {
383
+ await client.del(logsKey);
384
+ }
385
+ }
386
+ /**
387
+ * Completely remove the job from the queue.
388
+ * Note, this call will throw an exception if the job
389
+ * is being processed when the call is performed.
390
+ *
391
+ * @param opts - Options to remove a job
392
+ */
393
+ async remove({ removeChildren = true } = {}) {
394
+ await this.queue.waitUntilReady();
395
+ const queue = this.queue;
396
+ const job = this;
397
+ const removed = await this.scripts.remove(job.id, removeChildren);
398
+ if (removed) {
399
+ queue.emit('removed', job);
400
+ }
401
+ else {
402
+ throw new Error(`Job ${this.id} could not be removed because it is locked by another worker`);
403
+ }
404
+ }
405
+ /**
406
+ * Extend the lock for this job.
407
+ *
408
+ * @param token - unique token for the lock
409
+ * @param duration - lock duration in milliseconds
410
+ */
411
+ extendLock(token, duration) {
412
+ return this.scripts.extendLock(this.id, token, duration);
413
+ }
414
+ /**
415
+ * Moves a job to the completed queue.
416
+ * Returned job to be used with Queue.prototype.nextJobFromJobData.
417
+ *
418
+ * @param returnValue - The jobs success message.
419
+ * @param token - Worker token used to acquire completed job.
420
+ * @param fetchNext - True when wanting to fetch the next job.
421
+ * @returns Returns the jobData of the next job in the waiting queue or void.
422
+ */
423
+ async moveToCompleted(returnValue, token, fetchNext = true) {
424
+ await this.queue.waitUntilReady();
425
+ this.returnvalue = returnValue || void 0;
426
+ const stringifiedReturnValue = (0, utils_1.tryCatch)(JSON.stringify, JSON, [
427
+ returnValue,
428
+ ]);
429
+ if (stringifiedReturnValue === utils_1.errorObject) {
430
+ throw utils_1.errorObject.value;
431
+ }
432
+ const args = this.scripts.moveToCompletedArgs(this, stringifiedReturnValue, this.opts.removeOnComplete, token, fetchNext);
433
+ const result = await this.scripts.moveToFinished(this.id, args);
434
+ this.finishedOn = args[this.scripts.moveToFinishedKeys.length + 1];
435
+ this.attemptsMade += 1;
436
+ return result;
437
+ }
438
+ async shouldRetryJob(err) {
439
+ if (this.attemptsMade + 1 < this.opts.attempts &&
440
+ !this.discarded &&
441
+ !(err instanceof unrecoverable_error_1.UnrecoverableError || err.name == 'UnrecoverableError')) {
442
+ const opts = this.queue.opts;
443
+ const delay = await backoffs_1.Backoffs.calculate(this.opts.backoff, this.attemptsMade + 1, err, this, opts.settings && opts.settings.backoffStrategy);
444
+ return [delay == -1 ? false : true, delay == -1 ? 0 : delay];
445
+ }
446
+ else {
447
+ return [false, 0];
448
+ }
449
+ }
450
+ /**
451
+ * Moves a job to the failed queue.
452
+ *
453
+ * @param err - the jobs error message.
454
+ * @param token - token to check job is locked by current worker
455
+ * @param fetchNext - true when wanting to fetch the next job
456
+ * @returns Returns the jobData of the next job in the waiting queue or void.
457
+ */
458
+ async moveToFailed(err, token, fetchNext = false) {
459
+ this.failedReason = err === null || err === void 0 ? void 0 : err.message;
460
+ return this.queue.trace(enums_1.SpanKind.INTERNAL, this.getSpanOperation('moveToFailed'), this.queue.name, async (span, dstPropagationMedatadata) => {
461
+ var _a, _b;
462
+ let tm;
463
+ if (!((_b = (_a = this.opts) === null || _a === void 0 ? void 0 : _a.telemetry) === null || _b === void 0 ? void 0 : _b.omitContext) && dstPropagationMedatadata) {
464
+ tm = dstPropagationMedatadata;
465
+ }
466
+ let result;
467
+ this.updateStacktrace(err);
468
+ const fieldsToUpdate = {
469
+ failedReason: this.failedReason,
470
+ stacktrace: JSON.stringify(this.stacktrace),
471
+ tm,
472
+ };
473
+ //
474
+ // Check if an automatic retry should be performed
475
+ //
476
+ let finishedOn;
477
+ const [shouldRetry, retryDelay] = await this.shouldRetryJob(err);
478
+ if (shouldRetry) {
479
+ if (retryDelay) {
480
+ // Retry with delay
481
+ result = await this.scripts.moveToDelayed(this.id, Date.now(), retryDelay, token, { fieldsToUpdate });
482
+ }
483
+ else {
484
+ // Retry immediately
485
+ result = await this.scripts.retryJob(this.id, this.opts.lifo, token, {
486
+ fieldsToUpdate,
487
+ });
488
+ }
489
+ }
490
+ else {
491
+ const args = this.scripts.moveToFailedArgs(this, this.failedReason, this.opts.removeOnFail, token, fetchNext, fieldsToUpdate);
492
+ result = await this.scripts.moveToFinished(this.id, args);
493
+ finishedOn = args[this.scripts.moveToFinishedKeys.length + 1];
494
+ }
495
+ if (finishedOn && typeof finishedOn === 'number') {
496
+ this.finishedOn = finishedOn;
497
+ }
498
+ if (retryDelay && typeof retryDelay === 'number') {
499
+ this.delay = retryDelay;
500
+ }
501
+ this.attemptsMade += 1;
502
+ return result;
503
+ });
504
+ }
505
+ getSpanOperation(command) {
506
+ switch (command) {
507
+ case 'moveToDelayed':
508
+ return 'delay';
509
+ case 'retryJob':
510
+ return 'retry';
511
+ case 'moveToFinished':
512
+ return 'fail';
513
+ }
514
+ }
515
+ /**
516
+ * @returns true if the job has completed.
517
+ */
518
+ isCompleted() {
519
+ return this.isInZSet('completed');
520
+ }
521
+ /**
522
+ * @returns true if the job has failed.
523
+ */
524
+ isFailed() {
525
+ return this.isInZSet('failed');
526
+ }
527
+ /**
528
+ * @returns true if the job is delayed.
529
+ */
530
+ isDelayed() {
531
+ return this.isInZSet('delayed');
532
+ }
533
+ /**
534
+ * @returns true if the job is waiting for children.
535
+ */
536
+ isWaitingChildren() {
537
+ return this.isInZSet('waiting-children');
538
+ }
539
+ /**
540
+ * @returns true of the job is active.
541
+ */
542
+ isActive() {
543
+ return this.isInList('active');
544
+ }
545
+ /**
546
+ * @returns true if the job is waiting.
547
+ */
548
+ async isWaiting() {
549
+ return (await this.isInList('wait')) || (await this.isInList('paused'));
550
+ }
551
+ /**
552
+ * @returns the queue name this job belongs to.
553
+ */
554
+ get queueName() {
555
+ return this.queue.name;
556
+ }
557
+ /**
558
+ * @returns the prefix that is used.
559
+ */
560
+ get prefix() {
561
+ return this.queue.opts.prefix;
562
+ }
563
+ /**
564
+ * Get current state.
565
+ *
566
+ * @returns Returns one of these values:
567
+ * 'completed', 'failed', 'delayed', 'active', 'waiting', 'waiting-children', 'unknown'.
568
+ */
569
+ getState() {
570
+ return this.scripts.getState(this.id);
571
+ }
572
+ /**
573
+ * Change delay of a delayed job.
574
+ *
575
+ * @param delay - milliseconds to be added to current time.
576
+ * @returns void
577
+ */
578
+ async changeDelay(delay) {
579
+ await this.scripts.changeDelay(this.id, delay);
580
+ this.delay = delay;
581
+ }
582
+ /**
583
+ * Change job priority.
584
+ *
585
+ * @param opts - options containing priority and lifo values.
586
+ * @returns void
587
+ */
588
+ async changePriority(opts) {
589
+ await this.scripts.changePriority(this.id, opts.priority, opts.lifo);
590
+ this.priority = opts.priority || 0;
591
+ }
592
+ /**
593
+ * Get this jobs children result values if any.
594
+ *
595
+ * @returns Object mapping children job keys with their values.
596
+ */
597
+ async getChildrenValues() {
598
+ const client = await this.queue.client;
599
+ const result = (await client.hgetall(this.toKey(`${this.id}:processed`)));
600
+ if (result) {
601
+ return (0, utils_1.parseObjectValues)(result);
602
+ }
603
+ }
604
+ /**
605
+ * Get this jobs children failure values if any.
606
+ *
607
+ * @returns Object mapping children job keys with their failure values.
608
+ */
609
+ async getFailedChildrenValues() {
610
+ const client = await this.queue.client;
611
+ return client.hgetall(this.toKey(`${this.id}:failed`));
612
+ }
613
+ /**
614
+ * Get children job keys if this job is a parent and has children.
615
+ * @remarks
616
+ * Count options before Redis v7.2 works as expected with any quantity of entries
617
+ * on processed/unprocessed dependencies, since v7.2 you must consider that count
618
+ * won't have any effect until processed/unprocessed dependencies have a length
619
+ * greater than 127
620
+ * @see https://redis.io/docs/management/optimization/memory-optimization/#redis--72
621
+ * @returns dependencies separated by processed and unprocessed.
622
+ */
623
+ async getDependencies(opts = {}) {
624
+ const client = await this.queue.client;
625
+ const multi = client.multi();
626
+ if (!opts.processed && !opts.unprocessed) {
627
+ multi.hgetall(this.toKey(`${this.id}:processed`));
628
+ multi.smembers(this.toKey(`${this.id}:dependencies`));
629
+ const [[err1, processed], [err2, unprocessed]] = (await multi.exec());
630
+ const transformedProcessed = (0, utils_1.parseObjectValues)(processed);
631
+ return { processed: transformedProcessed, unprocessed };
632
+ }
633
+ else {
634
+ const defaultOpts = {
635
+ cursor: 0,
636
+ count: 20,
637
+ };
638
+ if (opts.processed) {
639
+ const processedOpts = Object.assign(Object.assign({}, defaultOpts), opts.processed);
640
+ multi.hscan(this.toKey(`${this.id}:processed`), processedOpts.cursor, 'COUNT', processedOpts.count);
641
+ }
642
+ if (opts.unprocessed) {
643
+ const unprocessedOpts = Object.assign(Object.assign({}, defaultOpts), opts.unprocessed);
644
+ multi.sscan(this.toKey(`${this.id}:dependencies`), unprocessedOpts.cursor, 'COUNT', unprocessedOpts.count);
645
+ }
646
+ const [result1, result2] = (await multi.exec());
647
+ const [processedCursor, processed = []] = opts.processed
648
+ ? result1[1]
649
+ : [];
650
+ const [unprocessedCursor, unprocessed = []] = opts.unprocessed
651
+ ? opts.processed
652
+ ? result2[1]
653
+ : result1[1]
654
+ : [];
655
+ const transformedProcessed = {};
656
+ for (let index = 0; index < processed.length; ++index) {
657
+ if (index % 2) {
658
+ transformedProcessed[processed[index - 1]] = JSON.parse(processed[index]);
659
+ }
660
+ }
661
+ return Object.assign(Object.assign({}, (processedCursor
662
+ ? {
663
+ processed: transformedProcessed,
664
+ nextProcessedCursor: Number(processedCursor),
665
+ }
666
+ : {})), (unprocessedCursor
667
+ ? { unprocessed, nextUnprocessedCursor: Number(unprocessedCursor) }
668
+ : {}));
669
+ }
670
+ }
671
+ /**
672
+ * Get children job counts if this job is a parent and has children.
673
+ *
674
+ * @returns dependencies count separated by processed and unprocessed.
675
+ */
676
+ async getDependenciesCount(opts = {}) {
677
+ const client = await this.queue.client;
678
+ const multi = client.multi();
679
+ const updatedOpts = !opts.processed && !opts.unprocessed
680
+ ? { processed: true, unprocessed: true }
681
+ : opts;
682
+ if (updatedOpts.processed) {
683
+ multi.hlen(this.toKey(`${this.id}:processed`));
684
+ }
685
+ if (updatedOpts.unprocessed) {
686
+ multi.scard(this.toKey(`${this.id}:dependencies`));
687
+ }
688
+ const [[err1, result1] = [], [err2, result2] = []] = (await multi.exec());
689
+ const processed = updatedOpts.processed ? result1 : undefined;
690
+ const unprocessed = updatedOpts.unprocessed
691
+ ? updatedOpts.processed
692
+ ? result2
693
+ : result1
694
+ : undefined;
695
+ return Object.assign(Object.assign({}, (updatedOpts.processed
696
+ ? {
697
+ processed,
698
+ }
699
+ : {})), (updatedOpts.unprocessed ? { unprocessed } : {}));
700
+ }
701
+ /**
702
+ * Returns a promise the resolves when the job has completed (containing the return value of the job),
703
+ * or rejects when the job has failed (containing the failedReason).
704
+ *
705
+ * @param queueEvents - Instance of QueueEvents.
706
+ * @param ttl - Time in milliseconds to wait for job to finish before timing out.
707
+ */
708
+ async waitUntilFinished(queueEvents, ttl) {
709
+ await this.queue.waitUntilReady();
710
+ const jobId = this.id;
711
+ return new Promise(async (resolve, reject) => {
712
+ let timeout;
713
+ if (ttl) {
714
+ timeout = setTimeout(() => onFailed(
715
+ /* eslint-disable max-len */
716
+ `Job wait ${this.name} timed out before finishing, no finish notification arrived after ${ttl}ms (id=${jobId})`), ttl);
717
+ }
718
+ function onCompleted(args) {
719
+ removeListeners();
720
+ resolve(args.returnvalue);
721
+ }
722
+ function onFailed(args) {
723
+ removeListeners();
724
+ reject(new Error(args.failedReason || args));
725
+ }
726
+ const completedEvent = `completed:${jobId}`;
727
+ const failedEvent = `failed:${jobId}`;
728
+ queueEvents.on(completedEvent, onCompleted);
729
+ queueEvents.on(failedEvent, onFailed);
730
+ this.queue.on('closing', onFailed);
731
+ const removeListeners = () => {
732
+ clearInterval(timeout);
733
+ queueEvents.removeListener(completedEvent, onCompleted);
734
+ queueEvents.removeListener(failedEvent, onFailed);
735
+ this.queue.removeListener('closing', onFailed);
736
+ };
737
+ // Poll once right now to see if the job has already finished. The job may have been completed before we were able
738
+ // to register the event handlers on the QueueEvents, so we check here to make sure we're not waiting for an event
739
+ // that has already happened. We block checking the job until the queue events object is actually listening to
740
+ // Redis so there's no chance that it will miss events.
741
+ await queueEvents.waitUntilReady();
742
+ const [status, result] = (await this.scripts.isFinished(jobId, true));
743
+ const finished = status != 0;
744
+ if (finished) {
745
+ if (status == -1 || status == 2) {
746
+ onFailed({ failedReason: result });
747
+ }
748
+ else {
749
+ onCompleted({ returnvalue: getReturnValue(result) });
750
+ }
751
+ }
752
+ });
753
+ }
754
+ /**
755
+ * Moves the job to the delay set.
756
+ *
757
+ * @param timestamp - timestamp when the job should be moved back to "wait"
758
+ * @param token - token to check job is locked by current worker
759
+ * @returns
760
+ */
761
+ async moveToDelayed(timestamp, token) {
762
+ const now = Date.now();
763
+ const delay = timestamp - now;
764
+ const finalDelay = delay > 0 ? delay : 0;
765
+ const movedToDelayed = await this.scripts.moveToDelayed(this.id, now, finalDelay, token, { skipAttempt: true });
766
+ this.delay = finalDelay;
767
+ return movedToDelayed;
768
+ }
769
+ /**
770
+ * Moves the job to the waiting-children set.
771
+ *
772
+ * @param token - Token to check job is locked by current worker
773
+ * @param opts - The options bag for moving a job to waiting-children.
774
+ * @returns true if the job was moved
775
+ */
776
+ async moveToWaitingChildren(token, opts = {}) {
777
+ const movedToWaitingChildren = await this.scripts.moveToWaitingChildren(this.id, token, opts);
778
+ return movedToWaitingChildren;
779
+ }
780
+ /**
781
+ * Promotes a delayed job so that it starts to be processed as soon as possible.
782
+ */
783
+ async promote() {
784
+ const jobId = this.id;
785
+ await this.scripts.promote(jobId);
786
+ this.delay = 0;
787
+ }
788
+ /**
789
+ * Attempts to retry the job. Only a job that has failed or completed can be retried.
790
+ *
791
+ * @param state - completed / failed
792
+ * @returns If resolved and return code is 1, then the queue emits a waiting event
793
+ * otherwise the operation was not a success and throw the corresponding error. If the promise
794
+ * rejects, it indicates that the script failed to execute
795
+ */
796
+ retry(state = 'failed') {
797
+ this.failedReason = null;
798
+ this.finishedOn = null;
799
+ this.processedOn = null;
800
+ this.returnvalue = null;
801
+ return this.scripts.reprocessJob(this, state);
802
+ }
803
+ /**
804
+ * Marks a job to not be retried if it fails (even if attempts has been configured)
805
+ */
806
+ discard() {
807
+ this.discarded = true;
808
+ }
809
+ async isInZSet(set) {
810
+ const client = await this.queue.client;
811
+ const score = await client.zscore(this.queue.toKey(set), this.id);
812
+ return score !== null;
813
+ }
814
+ async isInList(list) {
815
+ return this.scripts.isJobInList(this.queue.toKey(list), this.id);
816
+ }
817
+ /**
818
+ * Adds the job to Redis.
819
+ *
820
+ * @param client -
821
+ * @param parentOpts -
822
+ * @returns
823
+ */
824
+ addJob(client, parentOpts) {
825
+ const jobData = this.asJSON();
826
+ this.validateOptions(jobData);
827
+ return this.scripts.addJob(client, jobData, jobData.opts, this.id, parentOpts);
828
+ }
829
+ validateOptions(jobData) {
830
+ var _a;
831
+ const exceedLimit = this.opts.sizeLimit &&
832
+ (0, utils_1.lengthInUtf8Bytes)(jobData.data) > this.opts.sizeLimit;
833
+ if (exceedLimit) {
834
+ throw new Error(`The size of job ${this.name} exceeds the limit ${this.opts.sizeLimit} bytes`);
835
+ }
836
+ if (this.opts.delay && this.opts.repeat && !((_a = this.opts.repeat) === null || _a === void 0 ? void 0 : _a.count)) {
837
+ throw new Error(`Delay and repeat options could not be used together`);
838
+ }
839
+ if (this.opts.removeDependencyOnFailure && this.opts.failParentOnFailure) {
840
+ throw new Error(`RemoveDependencyOnFailure and failParentOnFailure options can not be used together`);
841
+ }
842
+ if (this.opts.removeDependencyOnFailure &&
843
+ this.opts.ignoreDependencyOnFailure) {
844
+ throw new Error(`RemoveDependencyOnFailure and ignoreDependencyOnFailure options can not be used together`);
845
+ }
846
+ if (this.opts.failParentOnFailure && this.opts.ignoreDependencyOnFailure) {
847
+ throw new Error(`FailParentOnFailure and ignoreDependencyOnFailure options can not be used together`);
848
+ }
849
+ if (`${parseInt(this.id, 10)}` === this.id) {
850
+ throw new Error('Custom Ids cannot be integers');
851
+ }
852
+ if (this.opts.priority) {
853
+ if (Math.trunc(this.opts.priority) !== this.opts.priority) {
854
+ throw new Error(`Priority should not be float`);
855
+ }
856
+ if (this.opts.priority > exports.PRIORITY_LIMIT) {
857
+ throw new Error(`Priority should be between 0 and ${exports.PRIORITY_LIMIT}`);
858
+ }
859
+ }
860
+ }
861
+ updateStacktrace(err) {
862
+ this.stacktrace = this.stacktrace || [];
863
+ if (err === null || err === void 0 ? void 0 : err.stack) {
864
+ this.stacktrace.push(err.stack);
865
+ if (this.opts.stackTraceLimit === 0) {
866
+ this.stacktrace = [];
867
+ }
868
+ else if (this.opts.stackTraceLimit) {
869
+ this.stacktrace = this.stacktrace.slice(-this.opts.stackTraceLimit);
870
+ }
871
+ }
872
+ }
873
+ }
874
+ exports.Job = Job;
875
+ function getTraces(stacktrace) {
876
+ const traces = (0, utils_1.tryCatch)(JSON.parse, JSON, [stacktrace]);
877
+ if (traces === utils_1.errorObject || !(traces instanceof Array)) {
878
+ return [];
879
+ }
880
+ else {
881
+ return traces;
882
+ }
883
+ }
884
+ function getReturnValue(_value) {
885
+ const value = (0, utils_1.tryCatch)(JSON.parse, JSON, [_value]);
886
+ if (value !== utils_1.errorObject) {
887
+ return value;
888
+ }
889
+ else {
890
+ logger('corrupted returnvalue: ' + _value, value);
891
+ }
892
+ }
893
+ //# sourceMappingURL=job.js.map