@imqueue/core 1.15.0 → 2.0.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/LICENSE +585 -13
- package/README.md +2 -1
- package/eslint.config.mjs +21 -0
- package/index.d.ts +17 -11
- package/index.js +18 -12
- package/package.json +19 -20
- package/src/ClusterManager.d.ts +34 -0
- package/src/ClusterManager.js +13 -0
- package/src/ClusteredRedisQueue.d.ts +61 -22
- package/src/ClusteredRedisQueue.js +157 -31
- package/src/IMQMode.d.ts +17 -11
- package/src/IMQMode.js +17 -11
- package/src/IMessageQueue.d.ts +86 -30
- package/src/RedisQueue.d.ts +44 -41
- package/src/RedisQueue.js +160 -115
- package/src/UDPClusterManager.d.ts +82 -0
- package/src/UDPClusterManager.js +154 -0
- package/src/copyEventEmitter.d.ts +28 -0
- package/src/copyEventEmitter.js +23 -0
- package/src/index.d.ts +20 -11
- package/src/index.js +21 -13
- package/src/profile.d.ts +17 -11
- package/src/profile.js +21 -15
- package/src/promisify.d.ts +18 -11
- package/src/promisify.js +21 -15
- package/src/redis.d.ts +25 -24
- package/src/redis.js +44 -22
- package/src/uuid.js +18 -13
- package/debug.d.ts +0 -0
package/src/redis.d.ts
CHANGED
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Extends native redis module to be promise-like
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* I'm Queue Software Project
|
|
5
|
+
* Copyright (C) 2025 imqueue.com <support@imqueue.com>
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
9
11
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
15
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
16
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
17
|
-
*/
|
|
18
|
-
import * as redis from 'redis';
|
|
19
|
-
/**
|
|
20
|
-
* Extends default RedisClient type to allow dynamic properties access on it
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU General Public License for more details.
|
|
21
16
|
*
|
|
22
|
-
*
|
|
17
|
+
* You should have received a copy of the GNU General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*
|
|
20
|
+
* If you want to use this code in a closed source (commercial) project, you can
|
|
21
|
+
* purchase a proprietary commercial license. Please contact us at
|
|
22
|
+
* <support@imqueue.com> to get commercial licensing options.
|
|
23
23
|
*/
|
|
24
|
-
|
|
25
|
-
[name: string]: any;
|
|
26
|
-
}
|
|
24
|
+
import Redis from 'ioredis';
|
|
27
25
|
/**
|
|
28
|
-
* Extends default
|
|
26
|
+
* Extends default Redis type to allow dynamic properties access on it
|
|
29
27
|
*
|
|
30
|
-
* @type {
|
|
28
|
+
* @type {IRedisClient}
|
|
31
29
|
*/
|
|
32
|
-
export interface
|
|
33
|
-
|
|
30
|
+
export interface IRedisClient extends Redis {
|
|
31
|
+
__ready__?: boolean;
|
|
32
|
+
__imq?: boolean;
|
|
34
33
|
}
|
|
35
|
-
export
|
|
34
|
+
export declare function makeRedisSafe(redis: IRedisClient): IRedisClient;
|
|
35
|
+
export { Redis };
|
|
36
|
+
export default Redis;
|
package/src/redis.js
CHANGED
|
@@ -1,32 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Redis = void 0;
|
|
4
|
+
exports.makeRedisSafe = makeRedisSafe;
|
|
4
5
|
/*!
|
|
5
6
|
* Extends native redis module to be promise-like
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
+
* I'm Queue Software Project
|
|
9
|
+
* Copyright (C) 2025 imqueue.com <support@imqueue.com>
|
|
8
10
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
11
|
+
* This program is free software: you can redistribute it and/or modify
|
|
12
|
+
* it under the terms of the GNU General Public License as published by
|
|
13
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
14
|
+
* (at your option) any later version.
|
|
12
15
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
16
|
+
* This program is distributed in the hope that it will be useful,
|
|
17
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19
|
+
* GNU General Public License for more details.
|
|
20
|
+
*
|
|
21
|
+
* You should have received a copy of the GNU General Public License
|
|
22
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
23
|
+
*
|
|
24
|
+
* If you want to use this code in a closed source (commercial) project, you can
|
|
25
|
+
* purchase a proprietary commercial license. Please contact us at
|
|
26
|
+
* <support@imqueue.com> to get commercial licensing options.
|
|
20
27
|
*/
|
|
21
28
|
/* tslint:disable */
|
|
22
|
-
const
|
|
23
|
-
exports.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
(
|
|
31
|
-
|
|
29
|
+
const ioredis_1 = require("ioredis");
|
|
30
|
+
exports.Redis = ioredis_1.default;
|
|
31
|
+
// istanbul ignore next
|
|
32
|
+
function makeRedisSafe(redis) {
|
|
33
|
+
return new Proxy(redis, {
|
|
34
|
+
get(target, property, receiver) {
|
|
35
|
+
const original = Reflect.get(target, property, receiver);
|
|
36
|
+
if (typeof original === 'function') {
|
|
37
|
+
return async (...args) => {
|
|
38
|
+
try {
|
|
39
|
+
if (target.status !== 'ready') {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
return await original.apply(target, args);
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
return original;
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
exports.default = ioredis_1.default;
|
|
32
54
|
//# sourceMappingURL=redis.js.map
|
package/src/uuid.js
CHANGED
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.uuid =
|
|
3
|
+
exports.uuid = uuid;
|
|
4
4
|
/*!
|
|
5
5
|
* Unified Unique ID Generator
|
|
6
6
|
* Based on solution inspired by Jeff Ward and the comments to it:
|
|
7
7
|
* @see http://stackoverflow.com/a/21963136/1511662
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* I'm Queue Software Project
|
|
10
|
+
* Copyright (C) 2025 imqueue.com <support@imqueue.com>
|
|
11
|
+
*
|
|
12
|
+
* This program is free software: you can redistribute it and/or modify
|
|
13
|
+
* it under the terms of the GNU General Public License as published by
|
|
14
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
15
|
+
* (at your option) any later version.
|
|
10
16
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
17
|
+
* This program is distributed in the hope that it will be useful,
|
|
18
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
19
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
20
|
+
* GNU General Public License for more details.
|
|
14
21
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
22
|
+
* You should have received a copy of the GNU General Public License
|
|
23
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
24
|
+
*
|
|
25
|
+
* If you want to use this code in a closed source (commercial) project, you can
|
|
26
|
+
* purchase a proprietary commercial license. Please contact us at
|
|
27
|
+
* <support@imqueue.com> to get commercial licensing options.
|
|
22
28
|
*/
|
|
23
29
|
const lookupTable = [];
|
|
24
30
|
for (let i = 0; i < 256; i++) {
|
|
@@ -56,5 +62,4 @@ function uuid() {
|
|
|
56
62
|
lookupTable[d3 >> 16 & 0xff] +
|
|
57
63
|
lookupTable[d3 >> 24 & 0xff];
|
|
58
64
|
}
|
|
59
|
-
exports.uuid = uuid;
|
|
60
65
|
//# sourceMappingURL=uuid.js.map
|
package/debug.d.ts
DELETED
|
File without changes
|