bullmq 1.54.3 → 1.55.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.
- package/README.md +1 -1
- package/dist/classes/backoffs.js.map +1 -1
- package/dist/classes/child-pool.d.ts +2 -0
- package/dist/classes/child-pool.js +20 -20
- package/dist/classes/child-pool.js.map +1 -1
- package/dist/classes/child-processor.d.ts +24 -0
- package/dist/classes/child-processor.js +169 -0
- package/dist/classes/child-processor.js.map +1 -0
- package/dist/classes/flow-producer.d.ts +2 -2
- package/dist/classes/flow-producer.js.map +1 -1
- package/dist/classes/job.d.ts +5 -2
- package/dist/classes/job.js +4 -0
- package/dist/classes/job.js.map +1 -1
- package/dist/classes/master.js +22 -159
- package/dist/classes/master.js.map +1 -1
- package/dist/classes/queue-base.d.ts +2 -2
- package/dist/classes/queue-base.js.map +1 -1
- package/dist/classes/queue-events.js.map +1 -1
- package/dist/classes/queue-scheduler.js.map +1 -1
- package/dist/classes/redis-connection.d.ts +1 -4
- package/dist/classes/redis-connection.js +1 -4
- package/dist/classes/redis-connection.js.map +1 -1
- package/dist/classes/sandbox.d.ts +2 -1
- package/dist/classes/sandbox.js +10 -8
- package/dist/classes/sandbox.js.map +1 -1
- package/dist/classes/scripts.d.ts +3 -4
- package/dist/classes/scripts.js.map +1 -1
- package/dist/classes/worker.d.ts +3 -2
- package/dist/classes/worker.js +13 -13
- package/dist/classes/worker.js.map +1 -1
- package/dist/commands/addJob-9.lua +3 -3
- package/dist/commands/index.d.ts +4 -3
- package/dist/commands/index.js +8 -72
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/moveStalledJobsToWait-8.lua +2 -2
- package/dist/commands/moveToFinished-8.lua +7 -7
- package/dist/commands/removeJob-1.lua +3 -3
- package/dist/commands/script-loader.d.ts +124 -0
- package/dist/commands/script-loader.js +413 -0
- package/dist/commands/script-loader.js.map +1 -0
- package/dist/interfaces/child-command.d.ts +5 -0
- package/dist/interfaces/child-command.js +10 -0
- package/dist/interfaces/child-command.js.map +1 -0
- package/dist/interfaces/child-message.d.ts +6 -0
- package/dist/interfaces/child-message.js +3 -0
- package/dist/interfaces/child-message.js.map +1 -0
- package/dist/interfaces/index.d.ts +7 -0
- package/dist/interfaces/index.js +7 -0
- package/dist/interfaces/index.js.map +1 -1
- package/dist/interfaces/jobs-options.d.ts +2 -0
- package/dist/interfaces/parent-command.d.ts +9 -0
- package/dist/interfaces/parent-command.js +14 -0
- package/dist/interfaces/parent-command.js.map +1 -0
- package/dist/interfaces/parent-message.d.ts +8 -0
- package/dist/interfaces/parent-message.js +3 -0
- package/dist/interfaces/parent-message.js.map +1 -0
- package/dist/utils.d.ts +6 -6
- package/dist/utils.js +25 -1
- package/dist/utils.js.map +1 -1
- package/package.json +16 -14
@@ -0,0 +1,413 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ScriptLoader = exports.ScriptLoaderError = void 0;
|
4
|
+
const crypto_1 = require("crypto");
|
5
|
+
const glob_1 = require("glob");
|
6
|
+
const path = require("path");
|
7
|
+
const fs = require("fs");
|
8
|
+
const util_1 = require("util");
|
9
|
+
const readFile = util_1.promisify(fs.readFile);
|
10
|
+
const readdir = util_1.promisify(fs.readdir);
|
11
|
+
const GlobOptions = { dot: true, silent: false };
|
12
|
+
const IncludeRegex = /^[-]{2,3}[ \t]*@include[ \t]+(["'])(.+?)\1[; \t\n]*$/m;
|
13
|
+
const EmptyLineRegex = /^\s*[\r\n]/gm;
|
14
|
+
class ScriptLoaderError extends Error {
|
15
|
+
constructor(message, path, stack = [], line, position = 0) {
|
16
|
+
super(message);
|
17
|
+
// Ensure the name of this error is the same as the class name
|
18
|
+
this.name = this.constructor.name;
|
19
|
+
Error.captureStackTrace(this, this.constructor);
|
20
|
+
this.includes = stack;
|
21
|
+
this.line = line !== null && line !== void 0 ? line : 0;
|
22
|
+
this.position = position;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
exports.ScriptLoaderError = ScriptLoaderError;
|
26
|
+
const isPossiblyMappedPath = (path) => path && ['~', '<'].includes(path[0]);
|
27
|
+
const hasFilenamePattern = (path) => glob_1.hasMagic(path, GlobOptions);
|
28
|
+
/**
|
29
|
+
* Lua script loader with include support
|
30
|
+
*/
|
31
|
+
class ScriptLoader {
|
32
|
+
constructor() {
|
33
|
+
/**
|
34
|
+
* Map an alias to a path
|
35
|
+
*/
|
36
|
+
this.pathMapper = new Map();
|
37
|
+
this.clientScripts = new WeakMap();
|
38
|
+
/**
|
39
|
+
* Cache commands by dir
|
40
|
+
*/
|
41
|
+
this.commandCache = new Map();
|
42
|
+
}
|
43
|
+
initMapping() {
|
44
|
+
if (!this._rootPath) {
|
45
|
+
this._rootPath = getPkgJsonDir();
|
46
|
+
this.pathMapper.set('~', this._rootPath);
|
47
|
+
this.pathMapper.set('rootDir', this._rootPath);
|
48
|
+
this.pathMapper.set('base', __dirname);
|
49
|
+
}
|
50
|
+
}
|
51
|
+
/**
|
52
|
+
* Add a script path mapping. Allows includes of the form "<includes>/utils.lua" where `includes` is a user
|
53
|
+
* defined path
|
54
|
+
* @param name - the name of the mapping. Note: do not include angle brackets
|
55
|
+
* @param mappedPath - if a relative path is passed, it's relative to the *caller* of this function.
|
56
|
+
* Mapped paths are also accepted, e.g. "~/server/scripts/lua" or "<base>/includes"
|
57
|
+
*/
|
58
|
+
addPathMapping(name, mappedPath) {
|
59
|
+
let resolved;
|
60
|
+
if (isPossiblyMappedPath(mappedPath)) {
|
61
|
+
resolved = this.resolvePath(mappedPath);
|
62
|
+
}
|
63
|
+
else {
|
64
|
+
const caller = getCallerFile();
|
65
|
+
const callerPath = path.dirname(caller);
|
66
|
+
resolved = path.normalize(path.resolve(callerPath, mappedPath));
|
67
|
+
}
|
68
|
+
const last = resolved.length - 1;
|
69
|
+
if (resolved[last] === path.sep) {
|
70
|
+
resolved = resolved.substr(0, last);
|
71
|
+
}
|
72
|
+
this.pathMapper.set(name, resolved);
|
73
|
+
}
|
74
|
+
/**
|
75
|
+
* Path to the project root (directory containing package.json)
|
76
|
+
*/
|
77
|
+
get rootPath() {
|
78
|
+
this.initMapping();
|
79
|
+
return this._rootPath;
|
80
|
+
}
|
81
|
+
/**
|
82
|
+
* Resolve the script path considering path mappings
|
83
|
+
* @param scriptName - the name of the script
|
84
|
+
* @param stack - the include stack, for nicer errors
|
85
|
+
*/
|
86
|
+
resolvePath(scriptName, stack = []) {
|
87
|
+
// initialize map, if not setup already
|
88
|
+
this.initMapping();
|
89
|
+
const first = scriptName[0];
|
90
|
+
if (first === '~') {
|
91
|
+
scriptName = path.join(this._rootPath, scriptName.substr(2));
|
92
|
+
}
|
93
|
+
else if (first === '<') {
|
94
|
+
const p = scriptName.indexOf('>');
|
95
|
+
if (p > 0) {
|
96
|
+
const name = scriptName.substring(1, p);
|
97
|
+
const mappedPath = this.pathMapper.get(name);
|
98
|
+
if (!mappedPath) {
|
99
|
+
throw new ScriptLoaderError(`No path mapping found for "${name}"`, scriptName, stack);
|
100
|
+
}
|
101
|
+
scriptName = path.join(mappedPath, scriptName.substring(p + 1));
|
102
|
+
}
|
103
|
+
}
|
104
|
+
return path.normalize(scriptName);
|
105
|
+
}
|
106
|
+
/**
|
107
|
+
* Recursively collect all scripts included in a file
|
108
|
+
* @param file - the parent file
|
109
|
+
* @param cache - a cache for file metadata to increase efficiency. Since a file can be included
|
110
|
+
* multiple times, we make sure to load it only once.
|
111
|
+
* @param stack - internal stack to prevent circular references
|
112
|
+
*/
|
113
|
+
async resolveDependencies(file, cache, stack = []) {
|
114
|
+
cache = cache !== null && cache !== void 0 ? cache : new Map();
|
115
|
+
if (stack.includes(file.path)) {
|
116
|
+
throw new ScriptLoaderError(`circular reference: "${file.path}"`, file.path, stack);
|
117
|
+
}
|
118
|
+
stack.push(file.path);
|
119
|
+
function findPos(content, match) {
|
120
|
+
const pos = content.indexOf(match);
|
121
|
+
const arr = content.slice(0, pos).split('\n');
|
122
|
+
return {
|
123
|
+
line: arr.length,
|
124
|
+
column: arr[arr.length - 1].length + match.indexOf('@include') + 1,
|
125
|
+
};
|
126
|
+
}
|
127
|
+
function raiseError(msg, match) {
|
128
|
+
const pos = findPos(file.content, match);
|
129
|
+
throw new ScriptLoaderError(msg, file.path, stack, pos.line, pos.column);
|
130
|
+
}
|
131
|
+
let res;
|
132
|
+
let content = file.content;
|
133
|
+
while ((res = IncludeRegex.exec(content)) !== null) {
|
134
|
+
const [match, , reference] = res;
|
135
|
+
const includeFilename = isPossiblyMappedPath(reference)
|
136
|
+
? // mapped paths imply absolute reference
|
137
|
+
this.resolvePath(ensureExt(reference), stack)
|
138
|
+
: // include path is relative to the file being processed
|
139
|
+
path.resolve(path.dirname(file.path), ensureExt(reference));
|
140
|
+
let includePaths;
|
141
|
+
if (hasFilenamePattern(includeFilename)) {
|
142
|
+
const filesMatched = await getFilenamesByPattern(includeFilename);
|
143
|
+
includePaths = filesMatched.map((x) => path.resolve(x));
|
144
|
+
}
|
145
|
+
else {
|
146
|
+
includePaths = [includeFilename];
|
147
|
+
}
|
148
|
+
includePaths = includePaths.filter((file) => path.extname(file) === '.lua');
|
149
|
+
if (includePaths.length === 0) {
|
150
|
+
raiseError(`include not found: "${reference}"`, match);
|
151
|
+
}
|
152
|
+
const tokens = [];
|
153
|
+
for (let i = 0; i < includePaths.length; i++) {
|
154
|
+
const includePath = includePaths[i];
|
155
|
+
const hasInclude = file.includes.find((x) => x.path === includePath);
|
156
|
+
if (hasInclude) {
|
157
|
+
/**
|
158
|
+
* We have something like
|
159
|
+
* --- \@include "a"
|
160
|
+
* ...
|
161
|
+
* --- \@include "a"
|
162
|
+
*/
|
163
|
+
raiseError(`file "${reference}" already included in "${file.path}"`, match);
|
164
|
+
}
|
165
|
+
let includeMetadata = cache.get(includePath);
|
166
|
+
let token;
|
167
|
+
if (!includeMetadata) {
|
168
|
+
const { name, numberOfKeys } = splitFilename(includePath);
|
169
|
+
let childContent;
|
170
|
+
try {
|
171
|
+
const buf = await readFile(includePath, { flag: 'r' });
|
172
|
+
childContent = buf.toString();
|
173
|
+
}
|
174
|
+
catch (err) {
|
175
|
+
if (err.code === 'ENOENT') {
|
176
|
+
raiseError(`include not found: "${reference}"`, match);
|
177
|
+
}
|
178
|
+
else {
|
179
|
+
throw err;
|
180
|
+
}
|
181
|
+
}
|
182
|
+
// this represents a normalized version of the path to make replacement easy
|
183
|
+
token = getPathHash(includePath);
|
184
|
+
includeMetadata = {
|
185
|
+
name,
|
186
|
+
numberOfKeys,
|
187
|
+
path: includePath,
|
188
|
+
content: childContent,
|
189
|
+
token,
|
190
|
+
includes: [],
|
191
|
+
};
|
192
|
+
cache.set(includePath, includeMetadata);
|
193
|
+
}
|
194
|
+
else {
|
195
|
+
token = includeMetadata.token;
|
196
|
+
}
|
197
|
+
tokens.push(token);
|
198
|
+
file.includes.push(includeMetadata);
|
199
|
+
await this.resolveDependencies(includeMetadata, cache, stack);
|
200
|
+
}
|
201
|
+
// Replace @includes with normalized path hashes
|
202
|
+
const substitution = tokens.join('\n');
|
203
|
+
content = content.replace(match, substitution);
|
204
|
+
}
|
205
|
+
file.content = content;
|
206
|
+
cache.set(file.path, file);
|
207
|
+
stack.pop();
|
208
|
+
}
|
209
|
+
/**
|
210
|
+
* Parse a (top-level) lua script
|
211
|
+
* @param filename - the full path to the script
|
212
|
+
* @param content - the content of the script
|
213
|
+
* @param cache - cache
|
214
|
+
*/
|
215
|
+
async parseScript(filename, content, cache) {
|
216
|
+
const meta = cache === null || cache === void 0 ? void 0 : cache.get(filename);
|
217
|
+
if ((meta === null || meta === void 0 ? void 0 : meta.content) === content) {
|
218
|
+
return meta;
|
219
|
+
}
|
220
|
+
const { name, numberOfKeys } = splitFilename(filename);
|
221
|
+
const fileInfo = {
|
222
|
+
path: filename,
|
223
|
+
token: getPathHash(filename),
|
224
|
+
content,
|
225
|
+
name,
|
226
|
+
numberOfKeys,
|
227
|
+
includes: [],
|
228
|
+
};
|
229
|
+
await this.resolveDependencies(fileInfo, cache);
|
230
|
+
return fileInfo;
|
231
|
+
}
|
232
|
+
/**
|
233
|
+
* Construct the final version of a file by interpolating its includes in dependency order.
|
234
|
+
* @param file - the file whose content we want to construct
|
235
|
+
* @param processed - a cache to keep track of which includes have already been processed
|
236
|
+
*/
|
237
|
+
interpolate(file, processed) {
|
238
|
+
processed = processed || new Set();
|
239
|
+
let content = file.content;
|
240
|
+
file.includes.forEach((child) => {
|
241
|
+
const emitted = processed.has(child.path);
|
242
|
+
const fragment = this.interpolate(child, processed);
|
243
|
+
const replacement = emitted ? '' : fragment;
|
244
|
+
if (!replacement) {
|
245
|
+
content = replaceAll(content, child.token, '');
|
246
|
+
}
|
247
|
+
else {
|
248
|
+
// replace the first instance with the dependency
|
249
|
+
content = content.replace(child.token, replacement);
|
250
|
+
// remove the rest
|
251
|
+
content = replaceAll(content, child.token, '');
|
252
|
+
}
|
253
|
+
processed.add(child.path);
|
254
|
+
});
|
255
|
+
return content;
|
256
|
+
}
|
257
|
+
async loadCommand(filename, cache) {
|
258
|
+
filename = path.resolve(filename);
|
259
|
+
let script = cache === null || cache === void 0 ? void 0 : cache.get(filename);
|
260
|
+
if (!script) {
|
261
|
+
const content = (await readFile(filename)).toString();
|
262
|
+
script = await this.parseScript(filename, content, cache);
|
263
|
+
}
|
264
|
+
const lua = removeEmptyLines(this.interpolate(script));
|
265
|
+
const { name, numberOfKeys } = script;
|
266
|
+
return {
|
267
|
+
name,
|
268
|
+
options: { numberOfKeys, lua },
|
269
|
+
};
|
270
|
+
}
|
271
|
+
/**
|
272
|
+
* Load redis lua scripts.
|
273
|
+
* The name of the script must have the following format:
|
274
|
+
*
|
275
|
+
* cmdName-numKeys.lua
|
276
|
+
*
|
277
|
+
* cmdName must be in camel case format.
|
278
|
+
*
|
279
|
+
* For example:
|
280
|
+
* moveToFinish-3.lua
|
281
|
+
*
|
282
|
+
*/
|
283
|
+
async loadScripts(dir, cache) {
|
284
|
+
dir = path.normalize(dir || __dirname);
|
285
|
+
let commands = this.commandCache.get(dir);
|
286
|
+
if (commands) {
|
287
|
+
return commands;
|
288
|
+
}
|
289
|
+
const files = await readdir(dir);
|
290
|
+
const luaFiles = files.filter((file) => path.extname(file) === '.lua');
|
291
|
+
if (luaFiles.length === 0) {
|
292
|
+
/**
|
293
|
+
* To prevent unclarified runtime error "updateDelayset is not a function
|
294
|
+
* @see https://github.com/OptimalBits/bull/issues/920
|
295
|
+
*/
|
296
|
+
throw new ScriptLoaderError('No .lua files found!', dir, []);
|
297
|
+
}
|
298
|
+
commands = [];
|
299
|
+
cache = cache !== null && cache !== void 0 ? cache : new Map();
|
300
|
+
for (let i = 0; i < luaFiles.length; i++) {
|
301
|
+
const file = path.join(dir, luaFiles[i]);
|
302
|
+
const command = await this.loadCommand(file, cache);
|
303
|
+
commands.push(command);
|
304
|
+
}
|
305
|
+
this.commandCache.set(dir, commands);
|
306
|
+
return commands;
|
307
|
+
}
|
308
|
+
/**
|
309
|
+
* Attach all lua scripts in a given directory to a client instance
|
310
|
+
* @param client - redis client to attach script to
|
311
|
+
* @param pathname - the path to the directory containing the scripts
|
312
|
+
*/
|
313
|
+
async load(client, pathname) {
|
314
|
+
let paths = this.clientScripts.get(client);
|
315
|
+
if (!paths) {
|
316
|
+
paths = new Set();
|
317
|
+
this.clientScripts.set(client, paths);
|
318
|
+
}
|
319
|
+
if (!paths.has(pathname)) {
|
320
|
+
paths.add(pathname);
|
321
|
+
const scripts = await this.loadScripts(pathname);
|
322
|
+
scripts.forEach((command) => {
|
323
|
+
// Only define the command if not already defined
|
324
|
+
if (!client[command.name]) {
|
325
|
+
client.defineCommand(command.name, command.options);
|
326
|
+
}
|
327
|
+
});
|
328
|
+
}
|
329
|
+
}
|
330
|
+
/**
|
331
|
+
* Clears the command cache
|
332
|
+
*/
|
333
|
+
clearCache() {
|
334
|
+
this.commandCache.clear();
|
335
|
+
}
|
336
|
+
}
|
337
|
+
exports.ScriptLoader = ScriptLoader;
|
338
|
+
function ensureExt(filename, ext = 'lua') {
|
339
|
+
const foundExt = path.extname(filename);
|
340
|
+
if (foundExt && foundExt !== '.') {
|
341
|
+
return filename;
|
342
|
+
}
|
343
|
+
if (ext && ext[0] !== '.') {
|
344
|
+
ext = `.${ext}`;
|
345
|
+
}
|
346
|
+
return `${filename}${ext}`;
|
347
|
+
}
|
348
|
+
function splitFilename(filePath) {
|
349
|
+
const longName = path.basename(filePath, '.lua');
|
350
|
+
const [name, num] = longName.split('-');
|
351
|
+
const numberOfKeys = num && parseInt(num, 10);
|
352
|
+
return { name, numberOfKeys };
|
353
|
+
}
|
354
|
+
async function getFilenamesByPattern(pattern) {
|
355
|
+
return new Promise((resolve, reject) => {
|
356
|
+
glob_1.glob(pattern, GlobOptions, (err, files) => {
|
357
|
+
return err ? reject(err) : resolve(files);
|
358
|
+
});
|
359
|
+
});
|
360
|
+
}
|
361
|
+
// Determine the project root
|
362
|
+
// https://stackoverflow.com/a/18721515
|
363
|
+
function getPkgJsonDir() {
|
364
|
+
for (const modPath of module.paths) {
|
365
|
+
try {
|
366
|
+
const prospectivePkgJsonDir = path.dirname(modPath);
|
367
|
+
fs.accessSync(modPath, fs.constants.F_OK);
|
368
|
+
return prospectivePkgJsonDir;
|
369
|
+
// eslint-disable-next-line no-empty
|
370
|
+
}
|
371
|
+
catch (e) { }
|
372
|
+
}
|
373
|
+
}
|
374
|
+
// https://stackoverflow.com/a/66842927
|
375
|
+
// some dark magic here :-)
|
376
|
+
// this version is preferred to the simpler version because of
|
377
|
+
// https://github.com/facebook/jest/issues/5303 -
|
378
|
+
// tldr: dont assume you're the only one with the doing something like this
|
379
|
+
function getCallerFile() {
|
380
|
+
const originalFunc = Error.prepareStackTrace;
|
381
|
+
let callerFile;
|
382
|
+
try {
|
383
|
+
Error.prepareStackTrace = (_, stack) => stack;
|
384
|
+
const sites = new Error().stack;
|
385
|
+
const currentFile = sites.shift().getFileName();
|
386
|
+
while (sites.length) {
|
387
|
+
callerFile = sites.shift().getFileName();
|
388
|
+
if (currentFile !== callerFile) {
|
389
|
+
break;
|
390
|
+
}
|
391
|
+
}
|
392
|
+
// eslint-disable-next-line no-empty
|
393
|
+
}
|
394
|
+
catch (e) {
|
395
|
+
}
|
396
|
+
finally {
|
397
|
+
Error.prepareStackTrace = originalFunc;
|
398
|
+
}
|
399
|
+
return callerFile;
|
400
|
+
}
|
401
|
+
function sha1(data) {
|
402
|
+
return crypto_1.createHash('sha1').update(data).digest('hex');
|
403
|
+
}
|
404
|
+
function getPathHash(normalizedPath) {
|
405
|
+
return `@@${sha1(normalizedPath)}`;
|
406
|
+
}
|
407
|
+
function replaceAll(str, find, replace) {
|
408
|
+
return str.replace(new RegExp(find, 'g'), replace);
|
409
|
+
}
|
410
|
+
function removeEmptyLines(str) {
|
411
|
+
return str.replace(EmptyLineRegex, '');
|
412
|
+
}
|
413
|
+
//# sourceMappingURL=script-loader.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"script-loader.js","sourceRoot":"","sources":["../../src/commands/script-loader.ts"],"names":[],"mappings":";;;AAAA,mCAAoC;AACpC,+BAAsC;AACtC,6BAA6B;AAC7B,yBAAyB;AAEzB,+BAAiC;AAEjC,MAAM,QAAQ,GAAG,gBAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;AACxC,MAAM,OAAO,GAAG,gBAAS,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;AAEtC,MAAM,WAAW,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AACjD,MAAM,YAAY,GAAG,uDAAuD,CAAC;AAC7E,MAAM,cAAc,GAAG,cAAc,CAAC;AAuCtC,MAAa,iBAAkB,SAAQ,KAAK;IAS1C,YACE,OAAe,EACf,IAAY,EACZ,QAAkB,EAAE,EACpB,IAAa,EACb,QAAQ,GAAG,CAAC;QAEZ,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,8DAA8D;QAC9D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC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IACzC,OAAO,KAAK,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC;AACrC,CAAC;AAED,SAAS,UAAU,CAAC,GAAW,EAAE,IAAY,EAAE,OAAe;IAC5D,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;AACrD,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAW;IACnC,OAAO,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;AACzC,CAAC"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ChildCommand = void 0;
|
4
|
+
var ChildCommand;
|
5
|
+
(function (ChildCommand) {
|
6
|
+
ChildCommand[ChildCommand["Init"] = 0] = "Init";
|
7
|
+
ChildCommand[ChildCommand["Start"] = 1] = "Start";
|
8
|
+
ChildCommand[ChildCommand["Stop"] = 2] = "Stop";
|
9
|
+
})(ChildCommand = exports.ChildCommand || (exports.ChildCommand = {}));
|
10
|
+
//# sourceMappingURL=child-command.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"child-command.js","sourceRoot":"","sources":["../../src/interfaces/child-command.ts"],"names":[],"mappings":";;;AAAA,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,+CAAI,CAAA;IACJ,iDAAK,CAAA;IACL,+CAAI,CAAA;AACN,CAAC,EAJW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAIvB"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"child-message.js","sourceRoot":"","sources":["../../src/interfaces/child-message.ts"],"names":[],"mappings":""}
|
@@ -1,11 +1,18 @@
|
|
1
1
|
export * from './advanced-options';
|
2
2
|
export * from './backoff-options';
|
3
|
+
export * from './child-command';
|
4
|
+
export * from './child-message';
|
5
|
+
export * from './connection';
|
3
6
|
export * from './flow-job';
|
4
7
|
export * from './jobs-options';
|
8
|
+
export * from './parent-command';
|
9
|
+
export * from './parent-message';
|
10
|
+
export * from './parent';
|
5
11
|
export * from './queue-options';
|
6
12
|
export * from './queue-scheduler-options';
|
7
13
|
export * from './rate-limiter-options';
|
8
14
|
export * from './redis-options';
|
15
|
+
export * from './redis-streams';
|
9
16
|
export * from './repeat-options';
|
10
17
|
export * from './sandboxed-job-processor';
|
11
18
|
export * from './sandboxed-job';
|
package/dist/interfaces/index.js
CHANGED
@@ -3,12 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
4
4
|
tslib_1.__exportStar(require("./advanced-options"), exports);
|
5
5
|
tslib_1.__exportStar(require("./backoff-options"), exports);
|
6
|
+
tslib_1.__exportStar(require("./child-command"), exports);
|
7
|
+
tslib_1.__exportStar(require("./child-message"), exports);
|
8
|
+
tslib_1.__exportStar(require("./connection"), exports);
|
6
9
|
tslib_1.__exportStar(require("./flow-job"), exports);
|
7
10
|
tslib_1.__exportStar(require("./jobs-options"), exports);
|
11
|
+
tslib_1.__exportStar(require("./parent-command"), exports);
|
12
|
+
tslib_1.__exportStar(require("./parent-message"), exports);
|
13
|
+
tslib_1.__exportStar(require("./parent"), exports);
|
8
14
|
tslib_1.__exportStar(require("./queue-options"), exports);
|
9
15
|
tslib_1.__exportStar(require("./queue-scheduler-options"), exports);
|
10
16
|
tslib_1.__exportStar(require("./rate-limiter-options"), exports);
|
11
17
|
tslib_1.__exportStar(require("./redis-options"), exports);
|
18
|
+
tslib_1.__exportStar(require("./redis-streams"), exports);
|
12
19
|
tslib_1.__exportStar(require("./repeat-options"), exports);
|
13
20
|
tslib_1.__exportStar(require("./sandboxed-job-processor"), exports);
|
14
21
|
tslib_1.__exportStar(require("./sandboxed-job"), exports);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":";;;AAAA,6DAAmC;AACnC,4DAAkC;AAClC,qDAA2B;AAC3B,yDAA+B;AAC/B,0DAAgC;AAChC,oEAA0C;AAC1C,iEAAuC;AACvC,0DAAgC;AAChC,2DAAiC;AACjC,oEAA0C;AAC1C,0DAAgC;AAChC,2DAAiC"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":";;;AAAA,6DAAmC;AACnC,4DAAkC;AAClC,0DAAgC;AAChC,0DAAgC;AAChC,uDAA6B;AAC7B,qDAA2B;AAC3B,yDAA+B;AAC/B,2DAAiC;AACjC,2DAAiC;AACjC,mDAAyB;AACzB,0DAAgC;AAChC,oEAA0C;AAC1C,iEAAuC;AACvC,0DAAgC;AAChC,0DAAgC;AAChC,2DAAiC;AACjC,oEAA0C;AAC1C,0DAAgC;AAChC,2DAAiC"}
|
@@ -15,10 +15,12 @@ export interface JobsOptions {
|
|
15
15
|
* An amount of milliseconds to wait until this job can be processed.
|
16
16
|
* Note that for accurate delays, worker and producers
|
17
17
|
* should have their clocks synchronized.
|
18
|
+
* @defaultValue 0
|
18
19
|
*/
|
19
20
|
delay?: number;
|
20
21
|
/**
|
21
22
|
* The total number of attempts to try the job until it completes.
|
23
|
+
* @defaultValue 0
|
22
24
|
*/
|
23
25
|
attempts?: number;
|
24
26
|
/**
|
@@ -0,0 +1,14 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ParentCommand = void 0;
|
4
|
+
var ParentCommand;
|
5
|
+
(function (ParentCommand) {
|
6
|
+
ParentCommand[ParentCommand["InitFailed"] = 0] = "InitFailed";
|
7
|
+
ParentCommand[ParentCommand["InitCompleted"] = 1] = "InitCompleted";
|
8
|
+
ParentCommand[ParentCommand["Completed"] = 2] = "Completed";
|
9
|
+
ParentCommand[ParentCommand["Failed"] = 3] = "Failed";
|
10
|
+
ParentCommand[ParentCommand["Error"] = 4] = "Error";
|
11
|
+
ParentCommand[ParentCommand["Progress"] = 5] = "Progress";
|
12
|
+
ParentCommand[ParentCommand["Log"] = 6] = "Log";
|
13
|
+
})(ParentCommand = exports.ParentCommand || (exports.ParentCommand = {}));
|
14
|
+
//# sourceMappingURL=parent-command.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"parent-command.js","sourceRoot":"","sources":["../../src/interfaces/parent-command.ts"],"names":[],"mappings":";;;AAAA,IAAY,aAQX;AARD,WAAY,aAAa;IACvB,6DAAU,CAAA;IACV,mEAAa,CAAA;IACb,2DAAS,CAAA;IACT,qDAAM,CAAA;IACN,mDAAK,CAAA;IACL,yDAAQ,CAAA;IACR,+CAAG,CAAA;AACL,CAAC,EARW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAQxB"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"parent-message.js","sourceRoot":"","sources":["../../src/interfaces/parent-message.ts"],"names":[],"mappings":""}
|
package/dist/utils.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
2
|
-
import { JobsOptions } from './interfaces
|
3
|
-
import {
|
1
|
+
/// <reference types="node" />
|
2
|
+
import { RedisClient, JobsOptions, QueueOptions, ChildMessage, ParentMessage } from './interfaces';
|
3
|
+
import { ChildProcess } from 'child_process';
|
4
4
|
export declare const errorObject: {
|
5
5
|
[index: string]: any;
|
6
6
|
};
|
@@ -12,9 +12,7 @@ export declare function tryCatch(fn: (...args: any) => any, ctx: any, args: any[
|
|
12
12
|
*/
|
13
13
|
export declare function lengthInUtf8Bytes(str: string): number;
|
14
14
|
export declare function isEmpty(obj: object): boolean;
|
15
|
-
export declare function array2obj(arr: string[]):
|
16
|
-
[index: string]: string;
|
17
|
-
};
|
15
|
+
export declare function array2obj(arr: string[]): Record<string, string>;
|
18
16
|
export declare function delay(ms: number): Promise<void>;
|
19
17
|
export declare function isRedisInstance(obj: any): boolean;
|
20
18
|
export declare function removeAllQueueData(client: RedisClient, queueName: string, prefix?: string): Promise<void | boolean>;
|
@@ -27,3 +25,5 @@ export declare const clientCommandMessageReg: RegExp;
|
|
27
25
|
export declare const DELAY_TIME_5 = 5000;
|
28
26
|
export declare const DELAY_TIME_1 = 100;
|
29
27
|
export declare function isNotConnectionError(error: Error): boolean;
|
28
|
+
export declare const childSend: (proc: NodeJS.Process, msg: ChildMessage) => Promise<void>;
|
29
|
+
export declare const parentSend: (child: ChildProcess, msg: ParentMessage) => Promise<void>;
|
package/dist/utils.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.isNotConnectionError = exports.DELAY_TIME_1 = exports.DELAY_TIME_5 = exports.clientCommandMessageReg = exports.jobIdForGroup = exports.getParentKey = exports.removeAllQueueData = exports.isRedisInstance = exports.delay = exports.array2obj = exports.isEmpty = exports.lengthInUtf8Bytes = exports.tryCatch = exports.errorObject = void 0;
|
3
|
+
exports.parentSend = exports.childSend = exports.isNotConnectionError = exports.DELAY_TIME_1 = exports.DELAY_TIME_5 = exports.clientCommandMessageReg = exports.jobIdForGroup = exports.getParentKey = exports.removeAllQueueData = exports.isRedisInstance = exports.delay = exports.array2obj = exports.isEmpty = exports.lengthInUtf8Bytes = exports.tryCatch = exports.errorObject = void 0;
|
4
4
|
const ioredis_1 = require("ioredis");
|
5
5
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
6
6
|
// @ts-ignore
|
@@ -110,4 +110,28 @@ function isNotConnectionError(error) {
|
|
110
110
|
!errorMessage.includes('ECONNREFUSED'));
|
111
111
|
}
|
112
112
|
exports.isNotConnectionError = isNotConnectionError;
|
113
|
+
exports.childSend = (proc, msg) => {
|
114
|
+
return new Promise((resolve, reject) => {
|
115
|
+
proc.send(msg, (err) => {
|
116
|
+
if (err) {
|
117
|
+
reject(err);
|
118
|
+
}
|
119
|
+
else {
|
120
|
+
resolve();
|
121
|
+
}
|
122
|
+
});
|
123
|
+
});
|
124
|
+
};
|
125
|
+
exports.parentSend = (child, msg) => {
|
126
|
+
return new Promise((resolve, reject) => {
|
127
|
+
child.send(msg, (err) => {
|
128
|
+
if (err) {
|
129
|
+
reject(err);
|
130
|
+
}
|
131
|
+
else {
|
132
|
+
resolve();
|
133
|
+
}
|
134
|
+
});
|
135
|
+
});
|
136
|
+
};
|
113
137
|
//# sourceMappingURL=utils.js.map
|