@imqueue/core 2.0.26 → 3.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.
Files changed (49) hide show
  1. package/.oxfmtrc.json +9 -0
  2. package/.oxlintrc.json +20 -0
  3. package/README.md +73 -63
  4. package/debug_getter.d.ts +1 -9
  5. package/index.d.ts +0 -1
  6. package/index.js +8 -9
  7. package/package.json +20 -67
  8. package/scripts/strip-comment-coverage.mjs +397 -0
  9. package/src/ClusterManager.d.ts +12 -3
  10. package/src/ClusterManager.js +21 -10
  11. package/src/ClusteredRedisQueue.d.ts +45 -14
  12. package/src/ClusteredRedisQueue.js +186 -168
  13. package/src/IMessageQueue.d.ts +89 -96
  14. package/src/IMessageQueue.js +2 -2
  15. package/src/RedisQueue.d.ts +193 -97
  16. package/src/RedisQueue.js +1328 -1068
  17. package/src/UDPClusterManager.d.ts +100 -26
  18. package/src/UDPClusterManager.js +225 -70
  19. package/src/UDPWorker.d.ts +53 -1
  20. package/src/UDPWorker.js +79 -40
  21. package/src/{promisify.d.ts → helpers/buildOptions.d.ts} +8 -15
  22. package/src/helpers/buildOptions.js +39 -0
  23. package/src/{copyEventEmitter.d.ts → helpers/copyEventEmitter.d.ts} +1 -1
  24. package/src/{copyEventEmitter.js → helpers/copyEventEmitter.js} +3 -4
  25. package/src/helpers/envInt.d.ts +32 -0
  26. package/src/helpers/envInt.js +39 -0
  27. package/src/helpers/escapeRegExp.d.ts +30 -0
  28. package/src/helpers/escapeRegExp.js +36 -0
  29. package/src/helpers/index.d.ts +31 -0
  30. package/src/helpers/index.js +48 -0
  31. package/src/helpers/pack.d.ts +7 -0
  32. package/src/helpers/pack.js +37 -0
  33. package/src/helpers/randomInt.d.ts +31 -0
  34. package/src/helpers/randomInt.js +37 -0
  35. package/src/helpers/sha1.d.ts +7 -0
  36. package/src/helpers/sha1.js +39 -0
  37. package/src/helpers/unpack.d.ts +7 -0
  38. package/src/helpers/unpack.js +37 -0
  39. package/src/index.d.ts +1 -14
  40. package/src/index.js +1 -19
  41. package/src/profile.d.ts +28 -38
  42. package/src/profile.js +100 -95
  43. package/src/redis.d.ts +1 -1
  44. package/src/redis.js +4 -2
  45. package/typedoc.json +19 -0
  46. package/eslint.config.mjs +0 -98
  47. package/src/promisify.js +0 -106
  48. package/src/uuid.d.ts +0 -6
  49. package/src/uuid.js +0 -65
package/eslint.config.mjs DELETED
@@ -1,98 +0,0 @@
1
- /*!
2
- * I'm Queue Software Project
3
- * Copyright (C) 2025 imqueue.com <support@imqueue.com>
4
- *
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
17
- *
18
- * If you want to use this code in a closed source (commercial) project, you can
19
- * purchase a proprietary commercial license. Please contact us at
20
- * <support@imqueue.com> to get commercial licensing options.
21
- */
22
- import typescriptEslintEslintPlugin from "@typescript-eslint/eslint-plugin";
23
- import tsParser from "@typescript-eslint/parser";
24
- import path from "node:path";
25
- import { fileURLToPath } from "node:url";
26
- import js from "@eslint/js";
27
- import { FlatCompat } from "@eslint/eslintrc";
28
-
29
- const __filename = fileURLToPath(import.meta.url);
30
- const __dirname = path.dirname(__filename);
31
- const compat = new FlatCompat({
32
- baseDirectory: __dirname,
33
- recommendedConfig: js.configs.recommended,
34
- allConfig: js.configs.all
35
- });
36
-
37
- export default [...compat.extends(
38
- "plugin:@typescript-eslint/recommended",
39
- "plugin:@typescript-eslint/recommended-requiring-type-checking",
40
- ), {
41
- plugins: {
42
- "@typescript-eslint": typescriptEslintEslintPlugin,
43
- },
44
-
45
- languageOptions: {
46
- parser: tsParser,
47
- ecmaVersion: 5,
48
- sourceType: "module",
49
-
50
- parserOptions: {
51
- project: "tsconfig.json",
52
- },
53
- },
54
-
55
- rules: {
56
- "@typescript-eslint/interface-name-prefix": "off",
57
- "@typescript-eslint/explicit-function-return-type": ["warn"],
58
- "@typescript-eslint/explicit-module-boundary-types": "off",
59
- "@typescript-eslint/no-unsafe-member-access": "off",
60
- "@typescript-eslint/no-explicit-any": "off",
61
- "@typescript-eslint/no-unsafe-assignment": "warn",
62
- "@typescript-eslint/no-unsafe-argument": "warn",
63
- "no-trailing-spaces": "warn",
64
- "no-unused-vars": "off",
65
- "@typescript-eslint/no-unused-vars": ["warn"],
66
- "semi": ["warn", "always"],
67
-
68
- "no-console": ["warn", {
69
- allow: ["warn", "error", "info"],
70
- }],
71
-
72
- "no-debugger": "error",
73
- "arrow-parens": ["warn", "as-needed"],
74
-
75
- "quotes": ["error", "single", {
76
- avoidEscape: true,
77
- allowTemplateLiterals: true,
78
- }],
79
-
80
- "comma-dangle": ["warn", {
81
- arrays: "always-multiline",
82
- objects: "always-multiline",
83
- imports: "always-multiline",
84
- exports: "always-multiline",
85
- functions: "always-multiline",
86
- }],
87
-
88
- "max-len": ["warn", {
89
- code: 80,
90
- ignoreComments: true,
91
- ignoreRegExpLiterals: true,
92
- ignoreTrailingComments: true,
93
- ignoreTemplateLiterals: true,
94
- ignoreStrings: true,
95
- ignoreUrls: true,
96
- }],
97
- },
98
- }];
package/src/promisify.js DELETED
@@ -1,106 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.propertiesOf = propertiesOf;
4
- exports.promisify = promisify;
5
- /*!
6
- * Makes callback handling function promise-like
7
- *
8
- * I'm Queue Software Project
9
- * Copyright (C) 2025 imqueue.com <support@imqueue.com>
10
- *
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.
15
- *
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.
27
- */
28
- /**
29
- * Returns entire list of the given object properties including
30
- * entire prototype chain
31
- *
32
- * @param {any} obj
33
- * @returns {string[]}
34
- */
35
- function propertiesOf(obj) {
36
- const props = [];
37
- // noinspection JSAssignmentUsedAsCondition
38
- do {
39
- Object.getOwnPropertyNames(obj).forEach((prop) => {
40
- if (!~props.indexOf(prop)) {
41
- props.push(prop);
42
- }
43
- });
44
- } while (obj = Object.getPrototypeOf(obj));
45
- return props;
46
- }
47
- // istanbul ignore next
48
- /**
49
- * Makes a callback function able to resolve or reject with given
50
- * resolve and reject functions
51
- *
52
- * @param {(...args: any[]) => any} resolve
53
- * @param {(...args: any[]) => any} reject
54
- * @return {(...args: any[]) => any}
55
- */
56
- function makeCallback(resolve, reject) {
57
- return function callback(err, ...args) {
58
- if (err) {
59
- return reject(err);
60
- }
61
- resolve(args.length === 1 ? args[0] : args);
62
- };
63
- }
64
- // istanbul ignore next
65
- /**
66
- * Makes given method promised
67
- *
68
- * @access private
69
- * @param {(...args: any[]) => any} method
70
- * @return {(...args: any[]) => Promise<any>}
71
- */
72
- function makePromised(method) {
73
- return function asyncMethod(...args) {
74
- const callback = args[args.length - 1];
75
- if (typeof callback === 'function') {
76
- return method.apply(this, args);
77
- }
78
- return new Promise((resolve, reject) => {
79
- method.call(this, ...args, makeCallback(resolve, reject));
80
- });
81
- };
82
- }
83
- /**
84
- * Makes given object methods promise-like
85
- *
86
- * @param {any} obj - source object to modify
87
- * @param {string[]} restrict - stick promise-like behavior to a given
88
- * restricted list of methods
89
- * @return {void}
90
- */
91
- function promisify(obj, restrict) {
92
- for (const prop of propertiesOf(obj)) {
93
- try {
94
- if (typeof obj[prop] !== 'function' ||
95
- (restrict && !~restrict.indexOf(prop.toLowerCase()))) {
96
- continue;
97
- }
98
- }
99
- catch (err) {
100
- /* istanbul ignore next */
101
- continue;
102
- }
103
- obj[prop] = makePromised(obj[prop]);
104
- }
105
- }
106
- //# sourceMappingURL=promisify.js.map
package/src/uuid.d.ts DELETED
@@ -1,6 +0,0 @@
1
- /**
2
- * Generates and returns Unified Unique Identifier
3
- *
4
- * @returns {string}
5
- */
6
- export declare function uuid(): string;
package/src/uuid.js DELETED
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.uuid = uuid;
4
- /*!
5
- * Unified Unique ID Generator
6
- * Based on solution inspired by Jeff Ward and the comments to it:
7
- * @see http://stackoverflow.com/a/21963136/1511662
8
- *
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.
16
- *
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.
21
- *
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.
28
- */
29
- const lookupTable = [];
30
- for (let i = 0; i < 256; i++) {
31
- lookupTable[i] = (i < 16 ? '0' : '') + (i).toString(16);
32
- }
33
- const rand = Math.random.bind(Math);
34
- /**
35
- * Generates and returns Unified Unique Identifier
36
- *
37
- * @returns {string}
38
- */
39
- function uuid() {
40
- const d0 = rand() * 0x100000000 >>> 0;
41
- const d1 = rand() * 0x100000000 >>> 0;
42
- const d2 = rand() * 0x100000000 >>> 0;
43
- const d3 = rand() * 0x100000000 >>> 0;
44
- return lookupTable[d0 & 0xff] +
45
- lookupTable[d0 >> 8 & 0xff] +
46
- lookupTable[d0 >> 16 & 0xff] +
47
- lookupTable[d0 >> 24 & 0xff] +
48
- '-' +
49
- lookupTable[d1 & 0xff] +
50
- lookupTable[d1 >> 8 & 0xff] +
51
- '-' +
52
- lookupTable[d1 >> 16 & 0x0f | 0x40] +
53
- lookupTable[d1 >> 24 & 0xff] +
54
- '-' +
55
- lookupTable[d2 & 0x3f | 0x80] +
56
- lookupTable[d2 >> 8 & 0xff] +
57
- '-' +
58
- lookupTable[d2 >> 16 & 0xff] +
59
- lookupTable[d2 >> 24 & 0xff] +
60
- lookupTable[d3 & 0xff] +
61
- lookupTable[d3 >> 8 & 0xff] +
62
- lookupTable[d3 >> 16 & 0xff] +
63
- lookupTable[d3 >> 24 & 0xff];
64
- }
65
- //# sourceMappingURL=uuid.js.map