redis-smq-common 1.0.6 → 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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 2.0.0
4
+
5
+ * feat(redis-client): support offset and count for zrangebyscore() (2ec00e0)
6
+
3
7
  ## 1.0.6 (2023-02-15)
4
8
 
5
9
  * fix: use path.resolve() to fix 'no such file or directory' error (2d33599)
@@ -27,7 +27,7 @@ export declare class IoredisClient extends RedisClient {
27
27
  punsubscribe(channel: string): void;
28
28
  subscribe(channel: string): void;
29
29
  unsubscribe(channel: string): void;
30
- zrangebyscore(key: string, min: number | string, max: number | string, cb: ICallback<string[]>): void;
30
+ zrangebyscore(key: string, min: number | string, max: number | string, offset: number, count: number, cb: ICallback<string[]>): void;
31
31
  smembers(key: string, cb: ICallback<string[]>): void;
32
32
  sadd(key: string, member: string, cb: ICallback<number>): void;
33
33
  srem(key: string, member: string, cb: ICallback<number>): void;
@@ -87,8 +87,8 @@ class IoredisClient extends redis_client_1.RedisClient {
87
87
  unsubscribe(channel) {
88
88
  this.client.unsubscribe(channel);
89
89
  }
90
- zrangebyscore(key, min, max, cb) {
91
- this.client.zrangebyscore(key, min, max, cb);
90
+ zrangebyscore(key, min, max, offset, count, cb) {
91
+ this.client.zrangebyscore(key, min, max, 'LIMIT', offset, count, cb);
92
92
  }
93
93
  smembers(key, cb) {
94
94
  this.client.smembers(key, cb);
@@ -27,7 +27,7 @@ export declare class NodeRedisV3Client extends RedisClient {
27
27
  punsubscribe(channel: string): void;
28
28
  subscribe(channel: string): void;
29
29
  unsubscribe(channel: string): void;
30
- zrangebyscore(key: string, min: number | string, max: number | string, cb: ICallback<string[]>): void;
30
+ zrangebyscore(key: string, min: number | string, max: number | string, offset: number, count: number, cb: ICallback<string[]>): void;
31
31
  smembers(key: string, cb: ICallback<string[]>): void;
32
32
  sadd(key: string, member: string, cb: ICallback<number>): void;
33
33
  srem(key: string, member: string, cb: ICallback<number>): void;
@@ -114,8 +114,8 @@ class NodeRedisV3Client extends redis_client_1.RedisClient {
114
114
  unsubscribe(channel) {
115
115
  this.client.unsubscribe(channel);
116
116
  }
117
- zrangebyscore(key, min, max, cb) {
118
- this.client.zrangebyscore(key, min, max, cb);
117
+ zrangebyscore(key, min, max, offset, count, cb) {
118
+ this.client.zrangebyscore(key, min, max, 'LIMIT', offset, count, cb);
119
119
  }
120
120
  smembers(key, cb) {
121
121
  this.client.smembers(key, cb);
@@ -23,7 +23,7 @@ export declare class NodeRedisV4Client extends RedisClient {
23
23
  punsubscribe(channel: string): void;
24
24
  subscribe(channel: string): void;
25
25
  unsubscribe(channel: string): void;
26
- zrangebyscore(key: string, min: number | string, max: number | string, cb: ICallback<string[]>): void;
26
+ zrangebyscore(key: string, min: number | string, max: number | string, offset: number, count: number, cb: ICallback<string[]>): void;
27
27
  smembers(key: string, cb: ICallback<string[]>): void;
28
28
  sscan(key: string, options: {
29
29
  MATCH?: string;
@@ -82,9 +82,14 @@ class NodeRedisV4Client extends redis_client_1.RedisClient {
82
82
  unsubscribe(channel) {
83
83
  this.client.unsubscribe(channel).catch(() => void 0);
84
84
  }
85
- zrangebyscore(key, min, max, cb) {
85
+ zrangebyscore(key, min, max, offset, count, cb) {
86
86
  this.client
87
- .zRangeByScore(key, min, max)
87
+ .zRangeByScore(key, min, max, {
88
+ LIMIT: {
89
+ offset,
90
+ count,
91
+ },
92
+ })
88
93
  .then((reply) => cb(null, reply))
89
94
  .catch(cb);
90
95
  }
@@ -31,7 +31,7 @@ export declare abstract class RedisClient extends EventEmitter {
31
31
  abstract punsubscribe(channel: string): void;
32
32
  abstract subscribe(channel: string): void;
33
33
  abstract unsubscribe(channel: string): void;
34
- abstract zrangebyscore(key: string, min: number | string, max: number | string, cb: ICallback<string[]>): void;
34
+ abstract zrangebyscore(key: string, min: number | string, max: number | string, offset: number, count: number, cb: ICallback<string[]>): void;
35
35
  abstract smembers(key: string, cb: ICallback<string[]>): void;
36
36
  abstract sscan(key: string, options: {
37
37
  MATCH?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "redis-smq-common",
3
- "version": "1.0.6",
3
+ "version": "2.0.0",
4
4
  "description": "RedisSMQ shared components that may be used by integrated applications and extensions.",
5
5
  "author": "Weyoss <weyoss@protonmail.com>",
6
6
  "license": "MIT",