power-queues 1.0.9 → 2.0.2
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 +145 -1
- package/dist/index.cjs +782 -0
- package/dist/index.d.cts +285 -0
- package/dist/index.d.ts +285 -5
- package/dist/index.js +765 -10
- package/package.json +65 -11
- package/LICENSE +0 -21
- package/dist/index.js.map +0 -1
- package/dist/src/Processor.d.ts +0 -7
- package/dist/src/Processor.js +0 -16
- package/dist/src/Processor.js.map +0 -1
- package/dist/src/Queue.d.ts +0 -32
- package/dist/src/Queue.js +0 -254
- package/dist/src/Queue.js.map +0 -1
- package/dist/src/QueueProcessor.d.ts +0 -11
- package/dist/src/QueueProcessor.js +0 -34
- package/dist/src/QueueProcessor.js.map +0 -1
- package/dist/src/index.d.ts +0 -5
- package/dist/src/index.js +0 -10
- package/dist/src/index.js.map +0 -1
- package/dist/src/types.d.ts +0 -30
- package/dist/src/types.js +0 -3
- package/dist/src/types.js.map +0 -1
- package/dist/tsconfig.build.tsbuildinfo +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "power-queues",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Base classes for implementing custom queues in redis under high load conditions based on nestjs.",
|
|
5
5
|
"author": "ihor-bielchenko",
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,23 +12,77 @@
|
|
|
12
12
|
"url": "https://github.com/ihor-bielchenko/power-queues/issues"
|
|
13
13
|
},
|
|
14
14
|
"homepage": "https://github.com/ihor-bielchenko/power-queues#readme",
|
|
15
|
-
"
|
|
15
|
+
"type": "module",
|
|
16
|
+
"main": "dist/index.cjs",
|
|
17
|
+
"module": "dist/index.js",
|
|
16
18
|
"types": "dist/index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"import": "./dist/index.js",
|
|
22
|
+
"require": "./dist/index.cjs",
|
|
23
|
+
"default": "./dist/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
17
26
|
"files": [
|
|
18
27
|
"dist"
|
|
19
28
|
],
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=14"
|
|
31
|
+
},
|
|
20
32
|
"keywords": [
|
|
21
|
-
"nestjs",
|
|
22
|
-
"ioredis",
|
|
23
|
-
"queue",
|
|
24
33
|
"redis",
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
34
|
+
"redis-client",
|
|
35
|
+
"redis-wrapper",
|
|
36
|
+
"redis-abstraction",
|
|
37
|
+
"redis-utility",
|
|
38
|
+
"redis-helper",
|
|
39
|
+
"redis-queue",
|
|
40
|
+
"redis-list",
|
|
41
|
+
"redis-bulk",
|
|
42
|
+
"redis-scan",
|
|
43
|
+
"redis-mget",
|
|
44
|
+
"redis-ttl",
|
|
45
|
+
"redis-expire",
|
|
46
|
+
"redis-delete",
|
|
47
|
+
"redis-keys",
|
|
48
|
+
"redis-pattern",
|
|
49
|
+
"redis-pipeline",
|
|
50
|
+
"redis-multi",
|
|
51
|
+
"redis-atomic",
|
|
52
|
+
"json-serialization",
|
|
53
|
+
"safe-serialization",
|
|
54
|
+
"key-schema",
|
|
55
|
+
"key-builder",
|
|
56
|
+
"pattern-validation",
|
|
57
|
+
"key-validation",
|
|
58
|
+
"list-iterator",
|
|
59
|
+
"lpop-count",
|
|
60
|
+
"mget-chunked",
|
|
61
|
+
"nodejs",
|
|
62
|
+
"node",
|
|
63
|
+
"typescript",
|
|
64
|
+
"ts",
|
|
65
|
+
"esm",
|
|
66
|
+
"cjs",
|
|
67
|
+
"async",
|
|
68
|
+
"await",
|
|
69
|
+
"queue",
|
|
70
|
+
"cache",
|
|
71
|
+
"key-value",
|
|
72
|
+
"data-store",
|
|
73
|
+
"lightweight",
|
|
74
|
+
"abstraction-layer",
|
|
75
|
+
"typed-client",
|
|
76
|
+
"high-performance",
|
|
77
|
+
"atomic-operations",
|
|
78
|
+
"transactional",
|
|
79
|
+
"chunked-operations",
|
|
80
|
+
"safe-redis",
|
|
81
|
+
"power-redis"
|
|
28
82
|
],
|
|
29
83
|
"dependencies": {
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"uuid": "^
|
|
84
|
+
"full-utils": "^2.0.2",
|
|
85
|
+
"power-redis": "^2.0.2",
|
|
86
|
+
"uuid": "^13.0.0"
|
|
33
87
|
}
|
|
34
88
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Ihor Bielchenko
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,+CAA4C;AAW3C,0FAXQ,qBAAS,OAWR;AAVV,yDAAsD;AAWrD,+FAXQ,+BAAc,OAWR;AAVf,uCAAoC;AAWnC,sFAXQ,aAAK,OAWR"}
|
package/dist/src/Processor.d.ts
DELETED
package/dist/src/Processor.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Processor = void 0;
|
|
4
|
-
class Processor {
|
|
5
|
-
async execute(queueName, task) {
|
|
6
|
-
return true;
|
|
7
|
-
}
|
|
8
|
-
methods() {
|
|
9
|
-
return [];
|
|
10
|
-
}
|
|
11
|
-
method(index) {
|
|
12
|
-
return this.methods()[index];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.Processor = Processor;
|
|
16
|
-
//# sourceMappingURL=Processor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Processor.js","sourceRoot":"","sources":["../../src/Processor.ts"],"names":[],"mappings":";;;AAEA,MAAa,SAAS;IAGrB,KAAK,CAAC,OAAO,CAAC,SAAiB,EAAE,IAAmB;QACnD,OAAO,IAAI,CAAC;IACb,CAAC;IAED,OAAO;QACN,OAAO,EAAE,CAAC;IACX,CAAC;IAED,MAAM,CAAC,KAAa;QACnB,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;CACD;AAdD,8BAcC"}
|
package/dist/src/Queue.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { LockOptsInterface, DistLockInterface, TasksInterface, TaskInterface } from './types';
|
|
2
|
-
export declare class Queue {
|
|
3
|
-
readonly redisService: any;
|
|
4
|
-
readonly attempts: number;
|
|
5
|
-
readonly portion: number;
|
|
6
|
-
readonly timeout: number;
|
|
7
|
-
running: boolean;
|
|
8
|
-
wait(ms: number): Promise<unknown>;
|
|
9
|
-
key(...parts: Array<string | number>): string;
|
|
10
|
-
connection(db: string): any;
|
|
11
|
-
checkConnection(db: string): boolean;
|
|
12
|
-
start(db: string, queue: string, attempt?: number): void;
|
|
13
|
-
drop(db: string, pattern: string): Promise<number>;
|
|
14
|
-
unlock(db: string, key: string, token: string): Promise<boolean>;
|
|
15
|
-
lock(db: string, key: string, opts?: LockOptsInterface): Promise<DistLockInterface | null>;
|
|
16
|
-
write(db: string, key: string, value: any, ttlMs?: number): Promise<any>;
|
|
17
|
-
addOne(db: string, key: string, task: TaskInterface): Promise<void>;
|
|
18
|
-
addMany(db: string, key: string, data: TasksInterface): Promise<void>;
|
|
19
|
-
protected onStart(queue: string, portion: Array<TaskInterface>): Promise<void>;
|
|
20
|
-
protected onSuccess(queue: string, task: TaskInterface, result: any): Promise<void>;
|
|
21
|
-
protected onError(queue: string, task: TaskInterface, err: any): Promise<void>;
|
|
22
|
-
protected onFatal(queue: string, task: TaskInterface, err: any): Promise<void>;
|
|
23
|
-
protected onEnd(queue: string, result: any): Promise<void>;
|
|
24
|
-
protected beforeExecute(queue: string, task: TaskInterface): Promise<any>;
|
|
25
|
-
protected afterExecute(queue: string, portion: Array<TaskInterface>, result: any): Promise<any>;
|
|
26
|
-
protected callback(queue: string, task: TaskInterface): Promise<any>;
|
|
27
|
-
protected execute(queue: string, task: TaskInterface): Promise<any>;
|
|
28
|
-
protected retry(db: string, queue: string, task: TaskInterface): Promise<void>;
|
|
29
|
-
private select;
|
|
30
|
-
private process;
|
|
31
|
-
private loop;
|
|
32
|
-
}
|
package/dist/src/Queue.js
DELETED
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Queue = void 0;
|
|
4
|
-
const crypto = require("crypto");
|
|
5
|
-
const uuid_1 = require("uuid");
|
|
6
|
-
const full_utils_1 = require("full-utils");
|
|
7
|
-
const UNLOCK_LUA = `
|
|
8
|
-
if redis.call("GET", KEYS[1]) == ARGV[1] then
|
|
9
|
-
return redis.call("DEL", KEYS[1])
|
|
10
|
-
else
|
|
11
|
-
return 0
|
|
12
|
-
end
|
|
13
|
-
`;
|
|
14
|
-
const EXTEND_LUA = `
|
|
15
|
-
if redis.call("GET", KEYS[1]) == ARGV[1] then
|
|
16
|
-
return redis.call("PEXPIRE", KEYS[1], ARGV[2])
|
|
17
|
-
else
|
|
18
|
-
return 0
|
|
19
|
-
end
|
|
20
|
-
`;
|
|
21
|
-
class Queue {
|
|
22
|
-
constructor() {
|
|
23
|
-
this.attempts = 2;
|
|
24
|
-
this.portion = 1;
|
|
25
|
-
this.running = false;
|
|
26
|
-
}
|
|
27
|
-
wait(ms) {
|
|
28
|
-
return new Promise((r) => setTimeout(r, ms));
|
|
29
|
-
}
|
|
30
|
-
key(...parts) {
|
|
31
|
-
return parts.join(':');
|
|
32
|
-
}
|
|
33
|
-
connection(db) {
|
|
34
|
-
return this.redisService['clients'].get(db);
|
|
35
|
-
}
|
|
36
|
-
checkConnection(db) {
|
|
37
|
-
return !!this.connection(db)
|
|
38
|
-
&& (this.connection(db).status === 'ready'
|
|
39
|
-
|| this.connection(db).status === 'connecting');
|
|
40
|
-
}
|
|
41
|
-
start(db, queue, attempt = 0) {
|
|
42
|
-
if (this.running) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
this.running = true;
|
|
46
|
-
this.loop(db, queue, attempt).catch((err) => {
|
|
47
|
-
this.running = false;
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
async drop(db, pattern) {
|
|
51
|
-
if (!this.checkConnection(db)) {
|
|
52
|
-
throw new Error(`Redis connection error "${db}".`);
|
|
53
|
-
}
|
|
54
|
-
try {
|
|
55
|
-
let cursor = '0', total = 0;
|
|
56
|
-
do {
|
|
57
|
-
const [next, keys] = await this.connection(db).scan(cursor, 'MATCH', pattern, 'COUNT', 500);
|
|
58
|
-
cursor = next;
|
|
59
|
-
if ((0, full_utils_1.isArrFilled)(keys)) {
|
|
60
|
-
total += keys.length;
|
|
61
|
-
for (let i = 0; i < keys.length; i += 500) {
|
|
62
|
-
const chunk = keys.slice(i, i + 500);
|
|
63
|
-
if (typeof this.connection(db).unlink === 'function') {
|
|
64
|
-
await this.connection(db).unlink(...chunk);
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
await this.connection(db).del(...chunk);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
} while (cursor !== '0');
|
|
72
|
-
return total;
|
|
73
|
-
}
|
|
74
|
-
catch (err) {
|
|
75
|
-
}
|
|
76
|
-
throw new Error(`Redis clear error "${db}".`);
|
|
77
|
-
}
|
|
78
|
-
async unlock(db, key, token) {
|
|
79
|
-
return Number(await this.connection(db).eval(UNLOCK_LUA, 1, key, token)) === 1;
|
|
80
|
-
}
|
|
81
|
-
async lock(db, key, opts) {
|
|
82
|
-
if (!this.checkConnection(db)) {
|
|
83
|
-
throw new Error(`Redis connection error "${db}".`);
|
|
84
|
-
}
|
|
85
|
-
const token = crypto.randomBytes(16).toString('hex');
|
|
86
|
-
const retries = Math.max(0, opts?.retries ?? 5);
|
|
87
|
-
const minDelay = Math.max(5, opts?.minDelayMs ?? 20);
|
|
88
|
-
const maxDelay = Math.max(minDelay, opts?.maxDelayMs ?? 60);
|
|
89
|
-
const ttlMs = Number(opts?.ttlMs ?? 3000);
|
|
90
|
-
const lockKey = this.key('lock', key);
|
|
91
|
-
let attempt = 0;
|
|
92
|
-
while (attempt < retries) {
|
|
93
|
-
const ok = await this.connection(db).set(lockKey, token, 'PX', ttlMs, 'NX');
|
|
94
|
-
if (ok === 'OK') {
|
|
95
|
-
return {
|
|
96
|
-
token,
|
|
97
|
-
key: lockKey,
|
|
98
|
-
ttlMs: opts.ttlMs,
|
|
99
|
-
unlock: async () => await this.unlock(db, lockKey, token),
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
attempt++;
|
|
103
|
-
if (attempt < retries) {
|
|
104
|
-
await this.wait(minDelay + Math.floor(Math.random() * (maxDelay - minDelay + 1)));
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
return null;
|
|
108
|
-
}
|
|
109
|
-
async write(db, key, value, ttlMs) {
|
|
110
|
-
if (!this.checkConnection(db)) {
|
|
111
|
-
throw new Error(`Redis connection error "${db}".`);
|
|
112
|
-
}
|
|
113
|
-
const payload = ((0, full_utils_1.isArr)(value) || (0, full_utils_1.isObj)(value))
|
|
114
|
-
? (0, full_utils_1.toJSON)(value)
|
|
115
|
-
: String(value);
|
|
116
|
-
return (0, full_utils_1.isNumP)(ttlMs)
|
|
117
|
-
? await this.connection(db).set(key, payload, 'EX', ttlMs)
|
|
118
|
-
: await this.connection(db).set(key, payload);
|
|
119
|
-
}
|
|
120
|
-
async addOne(db, key, task) {
|
|
121
|
-
if (!this.checkConnection(db)) {
|
|
122
|
-
throw new Error(`Redis connection error "${db}".`);
|
|
123
|
-
}
|
|
124
|
-
const opts = task.opts || {};
|
|
125
|
-
const id = task.id || (0, uuid_1.v4)();
|
|
126
|
-
await this.connection(db).rpush(key, (0, full_utils_1.toJSON)({
|
|
127
|
-
...task,
|
|
128
|
-
opts: {
|
|
129
|
-
...opts,
|
|
130
|
-
attempt: opts.attempt || 0,
|
|
131
|
-
},
|
|
132
|
-
id,
|
|
133
|
-
enqueuedAt: Date.now(),
|
|
134
|
-
}));
|
|
135
|
-
}
|
|
136
|
-
async addMany(db, key, data) {
|
|
137
|
-
if (!this.checkConnection(db)) {
|
|
138
|
-
throw new Error(`Redis connection error "${db}".`);
|
|
139
|
-
}
|
|
140
|
-
const opts = data.opts || {};
|
|
141
|
-
const id = data.id || (0, uuid_1.v4)();
|
|
142
|
-
if (opts.progress) {
|
|
143
|
-
await this.write(db, this.key(id, 'ready'), 0, 300000);
|
|
144
|
-
await this.write(db, this.key(id, 'total'), data.payloads.length, 300000);
|
|
145
|
-
}
|
|
146
|
-
await this.connection(db).rpush(key, ...data
|
|
147
|
-
.payloads
|
|
148
|
-
.map((payload) => {
|
|
149
|
-
return (0, full_utils_1.toJSON)({
|
|
150
|
-
payload,
|
|
151
|
-
opts: {
|
|
152
|
-
...opts,
|
|
153
|
-
attempt: opts.attempt || 0,
|
|
154
|
-
},
|
|
155
|
-
id,
|
|
156
|
-
enqueuedAt: Date.now(),
|
|
157
|
-
});
|
|
158
|
-
}));
|
|
159
|
-
}
|
|
160
|
-
async onStart(queue, portion) {
|
|
161
|
-
}
|
|
162
|
-
async onSuccess(queue, task, result) {
|
|
163
|
-
}
|
|
164
|
-
async onError(queue, task, err) {
|
|
165
|
-
}
|
|
166
|
-
async onFatal(queue, task, err) {
|
|
167
|
-
}
|
|
168
|
-
async onEnd(queue, result) {
|
|
169
|
-
}
|
|
170
|
-
async beforeExecute(queue, task) {
|
|
171
|
-
return task;
|
|
172
|
-
}
|
|
173
|
-
async afterExecute(queue, portion, result) {
|
|
174
|
-
return result;
|
|
175
|
-
}
|
|
176
|
-
async callback(queue, task) {
|
|
177
|
-
return true;
|
|
178
|
-
}
|
|
179
|
-
async execute(queue, task) {
|
|
180
|
-
return await this.callback(queue, task);
|
|
181
|
-
}
|
|
182
|
-
async retry(db, queue, task) {
|
|
183
|
-
try {
|
|
184
|
-
const attempt = (task.opts?.attempt || 0) + 1;
|
|
185
|
-
const key = this.key('queue', queue, attempt);
|
|
186
|
-
await this.connection(db).rpush(key, (0, full_utils_1.toJSON)({
|
|
187
|
-
...task,
|
|
188
|
-
opts: {
|
|
189
|
-
...task.opts || {},
|
|
190
|
-
attempt,
|
|
191
|
-
},
|
|
192
|
-
}));
|
|
193
|
-
}
|
|
194
|
-
catch (err) {
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
async select(db, queue, attempt) {
|
|
198
|
-
const arr = await this.connection(db).rpop(this.key('queue', queue, attempt), this.portion);
|
|
199
|
-
if (!(0, full_utils_1.isArrFilled)(arr)) {
|
|
200
|
-
return null;
|
|
201
|
-
}
|
|
202
|
-
return arr
|
|
203
|
-
.map((item) => {
|
|
204
|
-
try {
|
|
205
|
-
const v = (0, full_utils_1.fromJSON)(item);
|
|
206
|
-
if (!(0, full_utils_1.isObjFilled)(v)) {
|
|
207
|
-
return null;
|
|
208
|
-
}
|
|
209
|
-
return v;
|
|
210
|
-
}
|
|
211
|
-
catch (err) {
|
|
212
|
-
}
|
|
213
|
-
return null;
|
|
214
|
-
})
|
|
215
|
-
.filter((item) => !!item);
|
|
216
|
-
}
|
|
217
|
-
async process(db, queue, task) {
|
|
218
|
-
let res;
|
|
219
|
-
try {
|
|
220
|
-
await this.onSuccess(queue, task, res = await this.execute(queue, await this.beforeExecute(queue, task)));
|
|
221
|
-
}
|
|
222
|
-
catch (err) {
|
|
223
|
-
await this.onError(queue, task, err);
|
|
224
|
-
if (task.opts?.attempt < (this.attempts - 1)) {
|
|
225
|
-
await this.retry(db, queue, task);
|
|
226
|
-
}
|
|
227
|
-
else {
|
|
228
|
-
await this.onFatal(queue, task, err);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
await this.onEnd(queue, res);
|
|
232
|
-
return res;
|
|
233
|
-
}
|
|
234
|
-
async loop(db, queue, attempt) {
|
|
235
|
-
while (this.running) {
|
|
236
|
-
if (!this.checkConnection(db)) {
|
|
237
|
-
await this.wait(1000);
|
|
238
|
-
continue;
|
|
239
|
-
}
|
|
240
|
-
const tasks = await this.select(db, queue, attempt);
|
|
241
|
-
if (!(0, full_utils_1.isArrFilled)(tasks)) {
|
|
242
|
-
await this.wait(1000);
|
|
243
|
-
continue;
|
|
244
|
-
}
|
|
245
|
-
await this.onStart(queue, tasks);
|
|
246
|
-
await this.afterExecute(queue, tasks, await Promise.all(tasks.map((task) => this.process(db, queue, task))));
|
|
247
|
-
if (this.timeout > 0) {
|
|
248
|
-
await this.wait(this.timeout);
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
exports.Queue = Queue;
|
|
254
|
-
//# sourceMappingURL=Queue.js.map
|
package/dist/src/Queue.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Queue.js","sourceRoot":"","sources":["../../src/Queue.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AACjC,+BAAkC;AAClC,2CAQoB;AAQpB,MAAM,UAAU,GAAG;;;;;;CAMlB,CAAC;AAEF,MAAM,UAAU,GAAG;;;;;;CAMlB,CAAC;AAEF,MAAa,KAAK;IAAlB;QAEiB,aAAQ,GAAW,CAAC,CAAC;QACrB,YAAO,GAAW,CAAC,CAAC;QAE7B,YAAO,GAAG,KAAK,CAAC;IA8QxB,CAAC;IA5QA,IAAI,CAAC,EAAU;QACd,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED,GAAG,CAAC,GAAG,KAA6B;QACnC,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IAED,UAAU,CAAC,EAAU;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,eAAe,CAAC,EAAU;QACzB,OAAO,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;eACxB,CAAE,IAAI,CAAC,UAAU,CAAC,EAAE,CAAS,CAAC,MAAM,KAAK,OAAO;mBAC9C,IAAI,CAAC,UAAU,CAAC,EAAE,CAAS,CAAC,MAAM,KAAK,YAAY,CAAC,CAAC;IAC5D,CAAC;IAED,KAAK,CAAC,EAAU,EAAE,KAAa,EAAE,UAAkB,CAAC;QACnD,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,OAAO;QACR,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI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Aa,EAAE,OAAe;QAC5D,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;YACrB,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,EAAE,CAAC;gBAC/B,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACtB,SAAS;YACV,CAAC;YACD,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;YAEpD,IAAI,CAAC,IAAA,wBAAW,EAAC,KAAK,CAAC,EAAE,CAAC;gBACzB,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACtB,SAAS;YACV,CAAC;YACD,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YACjC,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAmB,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YAE5H,IAAI,IAAI,CAAC,OAAO,GAAG,CAAC,EAAE,CAAC;gBACtB,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC/B,CAAC;QACF,CAAC;IACF,CAAC;CACD;AAnRD,sBAmRC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Queue } from './Queue';
|
|
2
|
-
import { Processor } from './Processor';
|
|
3
|
-
import { TaskInterface } from './types';
|
|
4
|
-
export declare class QueueProcessor extends Queue {
|
|
5
|
-
private processors;
|
|
6
|
-
protected methods: Array<Function>;
|
|
7
|
-
setProcessors(processors: Processor[]): this;
|
|
8
|
-
getProcessors(): Processor[];
|
|
9
|
-
getProcessor(name: string): Processor | null;
|
|
10
|
-
protected execute(queue: string, task: TaskInterface): Promise<any>;
|
|
11
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.QueueProcessor = void 0;
|
|
4
|
-
const Queue_1 = require("./Queue");
|
|
5
|
-
class QueueProcessor extends Queue_1.Queue {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.processors = [];
|
|
9
|
-
this.methods = [];
|
|
10
|
-
}
|
|
11
|
-
setProcessors(processors) {
|
|
12
|
-
this.processors = [...processors];
|
|
13
|
-
return this;
|
|
14
|
-
}
|
|
15
|
-
getProcessors() {
|
|
16
|
-
return [...this.processors];
|
|
17
|
-
}
|
|
18
|
-
getProcessor(name) {
|
|
19
|
-
return this.getProcessors().find((processor) => processor.name === name) ?? null;
|
|
20
|
-
}
|
|
21
|
-
async execute(queue, task) {
|
|
22
|
-
const processor = this.getProcessor(task.opts?.processor);
|
|
23
|
-
if (!processor) {
|
|
24
|
-
throw new Error('Неизвестный процессор.');
|
|
25
|
-
}
|
|
26
|
-
const method = processor.method(task.opts?.method);
|
|
27
|
-
if (!method) {
|
|
28
|
-
throw new Error('Неизвестный метод.');
|
|
29
|
-
}
|
|
30
|
-
return await method.call(processor, queue, task);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.QueueProcessor = QueueProcessor;
|
|
34
|
-
//# sourceMappingURL=QueueProcessor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QueueProcessor.js","sourceRoot":"","sources":["../../src/QueueProcessor.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAIhC,MAAa,cAAe,SAAQ,aAAK;IAAzC;;QACS,eAAU,GAAqB,EAAE,CAAC;QAChC,YAAO,GAAoB,EAAE,CAAC;IA4BzC,CAAC;IA1BA,aAAa,CAAC,UAAuB;QACpC,IAAI,CAAC,UAAU,GAAG,CAAE,GAAG,UAAU,CAAE,CAAC;QACpC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,aAAa;QACZ,OAAO,CAAE,GAAG,IAAI,CAAC,UAAU,CAAE,CAAC;IAC/B,CAAC;IAED,YAAY,CAAC,IAAY;QACxB,OAAO,IAAI,CAAC,aAAa,EAAE,CAAC,IAAI,CAAC,CAAC,SAAoB,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,IAAI,CAAC;IAC7F,CAAC;IAES,KAAK,CAAC,OAAO,CAAC,KAAa,EAAE,IAAmB;QACzD,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAE1D,IAAI,CAAC,SAAS,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC3C,CAAC;QACD,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAEnD,IAAI,CAAC,MAAM,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACvC,CAAC;QACD,OAAO,MAAM,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;CACD;AA9BD,wCA8BC"}
|
package/dist/src/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Processor } from './Processor';
|
|
2
|
-
import { QueueProcessor } from './QueueProcessor';
|
|
3
|
-
import { Queue } from './Queue';
|
|
4
|
-
import { DistLockInterface, LockOptsInterface, TaskOptsInterface, TaskInterface } from './types';
|
|
5
|
-
export { Processor, QueueProcessor, Queue, DistLockInterface, LockOptsInterface, TaskOptsInterface, TaskInterface, };
|
package/dist/src/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Queue = exports.QueueProcessor = exports.Processor = void 0;
|
|
4
|
-
const Processor_1 = require("./Processor");
|
|
5
|
-
Object.defineProperty(exports, "Processor", { enumerable: true, get: function () { return Processor_1.Processor; } });
|
|
6
|
-
const QueueProcessor_1 = require("./QueueProcessor");
|
|
7
|
-
Object.defineProperty(exports, "QueueProcessor", { enumerable: true, get: function () { return QueueProcessor_1.QueueProcessor; } });
|
|
8
|
-
const Queue_1 = require("./Queue");
|
|
9
|
-
Object.defineProperty(exports, "Queue", { enumerable: true, get: function () { return Queue_1.Queue; } });
|
|
10
|
-
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AAWvC,0FAXQ,qBAAS,OAWR;AAVV,qDAAkD;AAWjD,+FAXQ,+BAAc,OAWR;AAVf,mCAAgC;AAW/B,sFAXQ,aAAK,OAWR"}
|
package/dist/src/types.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export interface DistLockInterface {
|
|
2
|
-
key: string;
|
|
3
|
-
token: string;
|
|
4
|
-
ttlMs: number;
|
|
5
|
-
unlock: () => Promise<boolean>;
|
|
6
|
-
}
|
|
7
|
-
export interface LockOptsInterface {
|
|
8
|
-
ttlMs: number;
|
|
9
|
-
retries?: number;
|
|
10
|
-
minDelayMs?: number;
|
|
11
|
-
maxDelayMs?: number;
|
|
12
|
-
}
|
|
13
|
-
export interface TaskOptsInterface {
|
|
14
|
-
attempt?: number;
|
|
15
|
-
method?: number;
|
|
16
|
-
processor?: string;
|
|
17
|
-
progress?: boolean;
|
|
18
|
-
}
|
|
19
|
-
export interface TaskInterface {
|
|
20
|
-
payload: any;
|
|
21
|
-
id?: string;
|
|
22
|
-
opts?: TaskOptsInterface;
|
|
23
|
-
enqueuedAt?: number;
|
|
24
|
-
}
|
|
25
|
-
export interface TasksInterface {
|
|
26
|
-
payloads: Array<any>;
|
|
27
|
-
id?: string;
|
|
28
|
-
opts?: TaskOptsInterface;
|
|
29
|
-
enqueuedAt?: number;
|
|
30
|
-
}
|
package/dist/src/types.js
DELETED
package/dist/src/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|