@imqueue/core 2.0.18 → 2.0.19

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.
@@ -0,0 +1,9 @@
1
+ declare class DebugGetter {
2
+ name: string;
3
+ static propertiesMap: Record<string, string>;
4
+ private get property();
5
+ private set property(value);
6
+ constructor(name: string);
7
+ addProperty(value: string): void;
8
+ removeProperty(): void;
9
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imqueue/core",
3
- "version": "2.0.18",
3
+ "version": "2.0.19",
4
4
  "description": "Simple JSON-based messaging queue for inter service communication",
5
5
  "keywords": [
6
6
  "message-queue",
package/src/RedisQueue.js CHANGED
@@ -581,7 +581,7 @@ class RedisQueue extends events_1.EventEmitter {
581
581
  enableOfflineQueue: true,
582
582
  autoResendUnfulfilledCommands: true,
583
583
  });
584
- context[channel] = (0, _1.makeRedisSafe)(redis);
584
+ context[channel] = (0, _1.makeRedisSafe)(redis, options.verbose ? options.logger : undefined);
585
585
  context[channel].__imq = true;
586
586
  for (const event of [
587
587
  'wait',
package/src/redis.d.ts CHANGED
@@ -22,6 +22,7 @@
22
22
  * <support@imqueue.com> to get commercial licensing options.
23
23
  */
24
24
  import Redis from 'ioredis';
25
+ import { ILogger } from './IMessageQueue';
25
26
  /**
26
27
  * Extends default Redis type to allow dynamic properties access on it
27
28
  *
@@ -31,6 +32,6 @@ export interface IRedisClient extends Redis {
31
32
  __ready__?: boolean;
32
33
  __imq?: boolean;
33
34
  }
34
- export declare function makeRedisSafe(redis: IRedisClient): IRedisClient;
35
+ export declare function makeRedisSafe(redis: IRedisClient, logger?: ILogger): IRedisClient;
35
36
  export { Redis };
36
37
  export default Redis;
package/src/redis.js CHANGED
@@ -29,7 +29,7 @@ exports.makeRedisSafe = makeRedisSafe;
29
29
  const ioredis_1 = require("ioredis");
30
30
  exports.Redis = ioredis_1.default;
31
31
  // istanbul ignore next
32
- function makeRedisSafe(redis) {
32
+ function makeRedisSafe(redis, logger) {
33
33
  return new Proxy(redis, {
34
34
  get(target, property, receiver) {
35
35
  const original = Reflect.get(target, property, receiver);
@@ -37,11 +37,13 @@ function makeRedisSafe(redis) {
37
37
  return async (...args) => {
38
38
  try {
39
39
  if (target.status !== 'ready') {
40
+ logger === null || logger === void 0 ? void 0 : logger.warn('Redis client is not ready yet, while ', `executing command: "${String(property)}"`);
40
41
  return null;
41
42
  }
42
43
  return await original.apply(target, args);
43
44
  }
44
45
  catch (err) {
46
+ logger === null || logger === void 0 ? void 0 : logger.error(err);
45
47
  return null;
46
48
  }
47
49
  };