@imqueue/core 1.15.0 → 2.0.1

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/src/redis.d.ts CHANGED
@@ -1,35 +1,36 @@
1
1
  /*!
2
2
  * Extends native redis module to be promise-like
3
3
  *
4
- * Copyright (c) 2018, imqueue.com <support@imqueue.com>
4
+ * I'm Queue Software Project
5
+ * Copyright (C) 2025 imqueue.com <support@imqueue.com>
5
6
  *
6
- * Permission to use, copy, modify, and/or distribute this software for any
7
- * purpose with or without fee is hereby granted, provided that the above
8
- * copyright notice and this permission notice appear in all copies.
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
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
11
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12
- * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
13
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
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
- * @type {IRedisClient}
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
- export interface IRedisClient extends redis.RedisClient {
25
- [name: string]: any;
26
- }
24
+ import Redis from 'ioredis';
27
25
  /**
28
- * Extends default Multi type to allow dynamic properties access on it
26
+ * Extends default Redis type to allow dynamic properties access on it
29
27
  *
30
- * @type {IMulti}
28
+ * @type {IRedisClient}
31
29
  */
32
- export interface IMulti extends redis.Multi {
33
- [name: string]: any;
30
+ export interface IRedisClient extends Redis {
31
+ __ready__?: boolean;
32
+ __imq?: boolean;
34
33
  }
35
- export { redis };
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.redis = void 0;
3
+ exports.Redis = void 0;
4
+ exports.makeRedisSafe = makeRedisSafe;
4
5
  /*!
5
6
  * Extends native redis module to be promise-like
6
7
  *
7
- * Copyright (c) 2018, imqueue.com <support@imqueue.com>
8
+ * I'm Queue Software Project
9
+ * Copyright (C) 2025 imqueue.com <support@imqueue.com>
8
10
  *
9
- * Permission to use, copy, modify, and/or distribute this software for any
10
- * purpose with or without fee is hereby granted, provided that the above
11
- * copyright notice and this permission notice appear in all copies.
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
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
- * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
- * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
- * PERFORMANCE OF THIS SOFTWARE.
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 redis = require("redis");
23
- exports.redis = redis;
24
- const _1 = require(".");
25
- const commands = [...new Set(require('redis-commands').list.map((name) => name.toLowerCase()))].filter((name) => !~['stream', 'multi'].indexOf(name));
26
- /**
27
- * Make redis interfaces promise-like to allow work with
28
- * them through async/await
29
- */
30
- (0, _1.promisify)(redis.RedisClient.prototype, commands);
31
- (0, _1.promisify)(redis.Multi.prototype, commands);
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 = void 0;
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
- * Copyright (c) 2018, imqueue.com <support@imqueue.com>
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
- * Permission to use, copy, modify, and/or distribute this software for any
12
- * purpose with or without fee is hereby granted, provided that the above
13
- * copyright notice and this permission notice appear in all copies.
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
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
16
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
17
- * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
18
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
19
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
20
- * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
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