bullmq 1.59.4 → 1.63.0

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 (102) hide show
  1. package/dist/bullmq.d.ts +98 -37
  2. package/dist/cjs/classes/backoffs.d.ts +1 -1
  3. package/dist/cjs/classes/child-processor.d.ts +1 -1
  4. package/dist/cjs/classes/child-processor.js +2 -1
  5. package/dist/cjs/classes/child-processor.js.map +1 -1
  6. package/dist/cjs/classes/compat.d.ts +3 -0
  7. package/dist/cjs/classes/compat.js +3 -0
  8. package/dist/cjs/classes/compat.js.map +1 -1
  9. package/dist/cjs/classes/flow-producer.d.ts +1 -2
  10. package/dist/cjs/classes/flow-producer.js.map +1 -1
  11. package/dist/cjs/classes/job.d.ts +3 -34
  12. package/dist/cjs/classes/job.js.map +1 -1
  13. package/dist/cjs/classes/master.js.map +1 -1
  14. package/dist/cjs/classes/queue-events.js +1 -2
  15. package/dist/cjs/classes/queue-events.js.map +1 -1
  16. package/dist/cjs/classes/queue-getters.d.ts +9 -9
  17. package/dist/cjs/classes/queue-getters.js.map +1 -1
  18. package/dist/cjs/classes/queue-scheduler.d.ts +18 -5
  19. package/dist/cjs/classes/queue-scheduler.js +15 -0
  20. package/dist/cjs/classes/queue-scheduler.js.map +1 -1
  21. package/dist/cjs/classes/queue.d.ts +43 -6
  22. package/dist/cjs/classes/queue.js +15 -0
  23. package/dist/cjs/classes/queue.js.map +1 -1
  24. package/dist/cjs/classes/sandbox.d.ts +1 -1
  25. package/dist/cjs/classes/sandbox.js.map +1 -1
  26. package/dist/cjs/classes/scripts.d.ts +16 -3
  27. package/dist/cjs/classes/scripts.js +15 -22
  28. package/dist/cjs/classes/scripts.js.map +1 -1
  29. package/dist/cjs/classes/worker.d.ts +7 -7
  30. package/dist/cjs/classes/worker.js.map +1 -1
  31. package/dist/cjs/commands/getState-7.lua +5 -11
  32. package/dist/cjs/commands/includes/checkItemInList.lua +12 -0
  33. package/dist/cjs/commands/includes/updateParentDepsIfNeeded.lua +2 -1
  34. package/dist/cjs/commands/isJobInList-1.lua +11 -15
  35. package/dist/cjs/commands/moveToFinished-8.lua +2 -1
  36. package/dist/cjs/commands/obliterate-2.lua +1 -1
  37. package/dist/cjs/commands/releaseLock-1.lua +7 -7
  38. package/dist/cjs/commands/removeJob-1.lua +2 -2
  39. package/dist/cjs/commands/updateDelaySet-7.lua +1 -1
  40. package/dist/cjs/interfaces/child-message.d.ts +1 -1
  41. package/dist/cjs/interfaces/index.d.ts +1 -0
  42. package/dist/cjs/interfaces/index.js +1 -0
  43. package/dist/cjs/interfaces/index.js.map +1 -1
  44. package/dist/cjs/interfaces/job-json.d.ts +32 -0
  45. package/dist/cjs/interfaces/job-json.js +3 -0
  46. package/dist/cjs/interfaces/job-json.js.map +1 -0
  47. package/dist/cjs/interfaces/parent-message.d.ts +2 -2
  48. package/dist/cjs/interfaces/queue-options.d.ts +1 -1
  49. package/dist/cjs/interfaces/queue-scheduler-options.d.ts +1 -1
  50. package/dist/cjs/interfaces/sandboxed-job.d.ts +1 -1
  51. package/dist/cjs/interfaces/worker-options.d.ts +4 -2
  52. package/dist/esm/classes/backoffs.d.ts +1 -1
  53. package/dist/esm/classes/child-processor.d.ts +1 -1
  54. package/dist/esm/classes/child-processor.js +2 -1
  55. package/dist/esm/classes/child-processor.js.map +1 -1
  56. package/dist/esm/classes/compat.d.ts +3 -0
  57. package/dist/esm/classes/compat.js +3 -0
  58. package/dist/esm/classes/compat.js.map +1 -1
  59. package/dist/esm/classes/flow-producer.d.ts +1 -2
  60. package/dist/esm/classes/flow-producer.js.map +1 -1
  61. package/dist/esm/classes/job.d.ts +3 -34
  62. package/dist/esm/classes/job.js.map +1 -1
  63. package/dist/esm/classes/master.js.map +1 -1
  64. package/dist/esm/classes/queue-events.js +1 -2
  65. package/dist/esm/classes/queue-events.js.map +1 -1
  66. package/dist/esm/classes/queue-getters.d.ts +9 -9
  67. package/dist/esm/classes/queue-getters.js.map +1 -1
  68. package/dist/esm/classes/queue-scheduler.d.ts +18 -5
  69. package/dist/esm/classes/queue-scheduler.js +15 -0
  70. package/dist/esm/classes/queue-scheduler.js.map +1 -1
  71. package/dist/esm/classes/queue.d.ts +43 -6
  72. package/dist/esm/classes/queue.js +15 -0
  73. package/dist/esm/classes/queue.js.map +1 -1
  74. package/dist/esm/classes/sandbox.d.ts +1 -1
  75. package/dist/esm/classes/sandbox.js.map +1 -1
  76. package/dist/esm/classes/scripts.d.ts +16 -3
  77. package/dist/esm/classes/scripts.js +15 -22
  78. package/dist/esm/classes/scripts.js.map +1 -1
  79. package/dist/esm/classes/worker.d.ts +7 -7
  80. package/dist/esm/classes/worker.js.map +1 -1
  81. package/dist/esm/commands/getState-7.lua +5 -11
  82. package/dist/esm/commands/includes/checkItemInList.lua +12 -0
  83. package/dist/esm/commands/includes/updateParentDepsIfNeeded.lua +2 -1
  84. package/dist/esm/commands/isJobInList-1.lua +11 -15
  85. package/dist/esm/commands/moveToFinished-8.lua +2 -1
  86. package/dist/esm/commands/obliterate-2.lua +1 -1
  87. package/dist/esm/commands/releaseLock-1.lua +7 -7
  88. package/dist/esm/commands/removeJob-1.lua +2 -2
  89. package/dist/esm/commands/updateDelaySet-7.lua +1 -1
  90. package/dist/esm/interfaces/child-message.d.ts +1 -1
  91. package/dist/esm/interfaces/index.d.ts +1 -0
  92. package/dist/esm/interfaces/index.js +1 -0
  93. package/dist/esm/interfaces/index.js.map +1 -1
  94. package/dist/esm/interfaces/job-json.d.ts +32 -0
  95. package/dist/esm/interfaces/job-json.js +1 -0
  96. package/dist/esm/interfaces/job-json.js.map +1 -0
  97. package/dist/esm/interfaces/parent-message.d.ts +2 -2
  98. package/dist/esm/interfaces/queue-options.d.ts +1 -1
  99. package/dist/esm/interfaces/queue-scheduler-options.d.ts +1 -1
  100. package/dist/esm/interfaces/sandboxed-job.d.ts +1 -1
  101. package/dist/esm/interfaces/worker-options.d.ts +4 -2
  102. package/package.json +1 -1
@@ -32,27 +32,21 @@ if redis.call("ZSCORE", KEYS[3], ARGV[1]) ~= false then
32
32
  return "delayed"
33
33
  end
34
34
 
35
- local function item_in_list (list, item)
36
- for _, v in pairs(list) do
37
- if v == item then
38
- return 1
39
- end
40
- end
41
- return nil
42
- end
35
+ -- Includes
36
+ --- @include "includes/checkItemInList"
43
37
 
44
38
  local active_items = redis.call("LRANGE", KEYS[4] , 0, -1)
45
- if item_in_list(active_items, ARGV[1]) ~= nil then
39
+ if checkItemInList(active_items, ARGV[1]) ~= nil then
46
40
  return "active"
47
41
  end
48
42
 
49
43
  local wait_items = redis.call("LRANGE", KEYS[5] , 0, -1)
50
- if item_in_list(wait_items, ARGV[1]) ~= nil then
44
+ if checkItemInList(wait_items, ARGV[1]) ~= nil then
51
45
  return "waiting"
52
46
  end
53
47
 
54
48
  local paused_items = redis.call("LRANGE", KEYS[6] , 0, -1)
55
- if item_in_list(paused_items, ARGV[1]) ~= nil then
49
+ if checkItemInList(paused_items, ARGV[1]) ~= nil then
56
50
  return "waiting"
57
51
  end
58
52
 
@@ -0,0 +1,12 @@
1
+ --[[
2
+ Functions to check if a item belongs to a list.
3
+ ]]
4
+
5
+ local function checkItemInList(list, item)
6
+ for _, v in pairs(list) do
7
+ if v == item then
8
+ return 1
9
+ end
10
+ end
11
+ return nil
12
+ end
@@ -2,7 +2,8 @@
2
2
  Validate and move or add dependencies to parent.
3
3
  ]]
4
4
 
5
- local function updateParentDepsIfNeeded(parentKey, parentQueueKey, parentDependenciesKey, parentId, jobIdKey, returnvalue )
5
+ local function updateParentDepsIfNeeded(parentKey, parentQueueKey, parentDependenciesKey,
6
+ parentId, jobIdKey, returnvalue )
6
7
  local processedSet = parentKey .. ":processed"
7
8
  rcall("HSET", processedSet, jobIdKey, returnvalue)
8
9
  local activeParent = rcall("ZSCORE", parentQueueKey .. ":waiting-children", parentId)
@@ -1,20 +1,16 @@
1
1
  --[[
2
- Checks if job is in a given list.
2
+ Checks if job is in a given list.
3
3
 
4
- Input:
5
- KEYS[1]
6
- ARGV[1]
4
+ Input:
5
+ KEYS[1]
6
+ ARGV[1]
7
7
 
8
- Output:
9
- 1 if element found in the list.
8
+ Output:
9
+ 1 if element found in the list.
10
10
  ]]
11
- local function item_in_list (list, item)
12
- for _, v in pairs(list) do
13
- if v == item then
14
- return 1
15
- end
16
- end
17
- return nil
18
- end
11
+
12
+ -- Includes
13
+ --- @include "includes/checkItemInList"
14
+
19
15
  local items = redis.call("LRANGE", KEYS[1] , 0, -1)
20
- return item_in_list(items, ARGV[1])
16
+ return checkItemInList(items, ARGV[1])
@@ -105,7 +105,8 @@ if rcall("EXISTS",jobIdKey) == 1 then -- // Make sure job exists
105
105
  if removeJobs ~= 1 then
106
106
  -- Add to complete/failed set
107
107
  rcall("ZADD", KEYS[2], ARGV[2], jobId)
108
- rcall("HMSET", jobIdKey, ARGV[3], ARGV[4], "finishedOn", ARGV[2]) -- "returnvalue" / "failedReason" and "finishedOn"
108
+ rcall("HMSET", jobIdKey, ARGV[3], ARGV[4], "finishedOn",
109
+ ARGV[2]) -- "returnvalue" / "failedReason" and "finishedOn"
109
110
 
110
111
  -- Remove old jobs?
111
112
  if removeJobs and removeJobs > 1 then
@@ -15,7 +15,7 @@
15
15
 
16
16
  -- The queue needs to be "paused" or it will return an error
17
17
  -- If the queue has currently active jobs then the script by default will return error,
18
- -- however this behaviour can be overrided using the `force` option.
18
+ -- however this behaviour can be overrided using the 'force' option.
19
19
  local maxCount = tonumber(ARGV[1])
20
20
  local baseKey = KEYS[2]
21
21
 
@@ -1,14 +1,14 @@
1
1
  --[[
2
2
  Release lock
3
3
 
4
- Input:
5
- KEYS[1] 'lock',
4
+ Input:
5
+ KEYS[1] 'lock',
6
+
7
+ ARGV[1] token
8
+ ARGV[2] lock duration in milliseconds
6
9
 
7
- ARGV[1] token
8
- ARGV[2] lock duration in milliseconds
9
-
10
- Output:
11
- "OK" if lock extented succesfully.
10
+ Output:
11
+ "OK" if lock extented succesfully.
12
12
  ]]
13
13
  local rcall = redis.call
14
14
 
@@ -2,11 +2,11 @@
2
2
  Remove a job from all the queues it may be in as well as all its data.
3
3
  In order to be able to remove a job, it cannot be active.
4
4
 
5
- Input:
5
+ Input:
6
6
  KEYS[1] jobId
7
7
  ARGV[1] jobId
8
8
 
9
- Events:
9
+ Events:
10
10
  'removed'
11
11
  ]]
12
12
 
@@ -2,7 +2,7 @@
2
2
  Updates the delay set, by picking a delayed job that should
3
3
  be processed now.
4
4
 
5
- Input:
5
+ Input:
6
6
  KEYS[1] 'delayed'
7
7
  KEYS[2] 'wait'
8
8
  KEYS[3] 'priority'
@@ -1,4 +1,4 @@
1
- import { ParentCommand } from '.';
1
+ import { ParentCommand } from './parent-command';
2
2
  export interface ChildMessage {
3
3
  cmd: ParentCommand;
4
4
  value?: any;
@@ -4,6 +4,7 @@ export * from './child-command';
4
4
  export * from './child-message';
5
5
  export * from './connection';
6
6
  export * from './flow-job';
7
+ export * from './job-json';
7
8
  export * from './jobs-options';
8
9
  export * from './parent-command';
9
10
  export * from './parent-message';
@@ -4,6 +4,7 @@ export * from './child-command';
4
4
  export * from './child-message';
5
5
  export * from './connection';
6
6
  export * from './flow-job';
7
+ export * from './job-json';
7
8
  export * from './jobs-options';
8
9
  export * from './parent-command';
9
10
  export * from './parent-message';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { JobsOptions } from './jobs-options';
2
+ export interface JobJson {
3
+ id: string;
4
+ name: string;
5
+ data: string;
6
+ opts: JobsOptions;
7
+ progress: number | object;
8
+ attemptsMade: number;
9
+ finishedOn?: number;
10
+ processedOn?: number;
11
+ timestamp: number;
12
+ failedReason: string;
13
+ stacktrace: string;
14
+ returnvalue: string;
15
+ parentKey?: string;
16
+ }
17
+ export interface JobJsonRaw {
18
+ id: string;
19
+ name: string;
20
+ data: string;
21
+ opts: string;
22
+ progress: string;
23
+ attemptsMade: string;
24
+ finishedOn?: string;
25
+ processedOn?: string;
26
+ timestamp: string;
27
+ failedReason: string;
28
+ stacktrace: string[];
29
+ returnvalue: string;
30
+ parentKey?: string;
31
+ parent?: string;
32
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=job-json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"job-json.js","sourceRoot":"","sources":["../../../src/interfaces/job-json.ts"],"names":[],"mappings":""}
@@ -1,5 +1,5 @@
1
- import { ChildCommand } from '.';
2
- import { JobJson } from '../classes';
1
+ import { ChildCommand } from './child-command';
2
+ import { JobJson } from './job-json';
3
3
  export interface ParentMessage {
4
4
  cmd: ChildCommand;
5
5
  value?: any;
@@ -1,4 +1,4 @@
1
- import { JobsOptions } from '../interfaces';
1
+ import { JobsOptions } from './jobs-options';
2
2
  import { ConnectionOptions } from './redis-options';
3
3
  export declare enum ClientType {
4
4
  blocking = "blocking",
@@ -1,4 +1,4 @@
1
- import { QueueBaseOptions } from '../interfaces';
1
+ import { QueueBaseOptions } from './queue-options';
2
2
  /**
3
3
  * Options for customizing the behaviour of the scheduler.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { JobJson } from '../classes/job';
1
+ import { JobJson } from './job-json';
2
2
  import { JobsOptions } from './jobs-options';
3
3
  /**
4
4
  * @see {@link https://docs.bullmq.io/guide/workers/sandboxed-processors}
@@ -1,5 +1,7 @@
1
- import { Job } from '../classes';
2
- import { AdvancedOptions, QueueBaseOptions, RateLimiterOptions } from './';
1
+ import { Job } from '../classes/job';
2
+ import { AdvancedOptions } from './advanced-options';
3
+ import { QueueBaseOptions } from './queue-options';
4
+ import { RateLimiterOptions } from './rate-limiter-options';
3
5
  /**
4
6
  * An async function that receives `Job`s and handles them.
5
7
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bullmq",
3
- "version": "1.59.4",
3
+ "version": "1.63.0",
4
4
  "description": "Queue for messages and jobs based on Redis",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",