@upstash/redis 0.2.0 → 0.2.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.
@@ -354,6 +354,9 @@ function upstash(url, token) {
354
354
  function srem() {
355
355
  return fetchData(options, 'srem', ...arguments);
356
356
  }
357
+ function sscan() {
358
+ return fetchData(options, 'sscan', ...arguments);
359
+ }
357
360
  function sunion() {
358
361
  return fetchData(options, 'sunion', ...arguments);
359
362
  }
@@ -423,6 +426,9 @@ function upstash(url, token) {
423
426
  function zrevrank() {
424
427
  return fetchData(options, 'zrevrank', ...arguments);
425
428
  }
429
+ function zscan() {
430
+ return fetchData(options, 'zscan', ...arguments);
431
+ }
426
432
  function zscore() {
427
433
  return fetchData(options, 'zscore', ...arguments);
428
434
  }
@@ -526,6 +532,7 @@ function upstash(url, token) {
526
532
  spop,
527
533
  srandmember,
528
534
  srem,
535
+ sscan,
529
536
  sunion,
530
537
  sunionstore,
531
538
  // SORTED SETS
@@ -549,6 +556,7 @@ function upstash(url, token) {
549
556
  zrevrangebylex,
550
557
  zrevrangebyscore,
551
558
  zrevrank,
559
+ zscan,
552
560
  zscore,
553
561
  zunionstore,
554
562
  };
@@ -24,10 +24,6 @@ declare type BITPOS2 = (key: string, bit: Bit, start: number) => MethodReturn;
24
24
  declare type BITPOS3 = (key: string, bit: Bit, start: number, end: number) => MethodReturn;
25
25
  declare type PING1 = () => MethodReturn;
26
26
  declare type PING2 = (message: string) => MethodReturn;
27
- declare type HSCAN1 = (key: string, cursor: number | string) => MethodReturn;
28
- declare type HSCAN2 = (key: string, cursor: number | string, match: 'MATCH', pattern: string) => MethodReturn;
29
- declare type HSCAN3 = (key: string, cursor: number | string, count: 'COUNT', value: number | string) => MethodReturn;
30
- declare type HSCAN4 = (key: string, cursor: number | string, match: 'MATCH', pattern: string, count: 'COUNT', value: number | string) => MethodReturn;
31
27
  declare type SCAN1 = (cursor: number | string) => MethodReturn;
32
28
  declare type SCAN2 = (cursor: number | string, match: 'MATCH', pattern: string) => MethodReturn;
33
29
  declare type SCAN3 = (cursor: number | string, count: 'COUNT', value: number | string) => MethodReturn;
@@ -38,6 +34,10 @@ declare type FLUSHDB1 = () => MethodReturn;
38
34
  declare type FLUSHDB2 = (mode: 'ASYNC' | 'SYNC') => MethodReturn;
39
35
  declare type INFO1 = () => MethodReturn;
40
36
  declare type INFO2 = (section: string) => MethodReturn;
37
+ declare type XSCAN1 = (key: string, cursor: number | string) => MethodReturn;
38
+ declare type XSCAN2 = (key: string, cursor: number | string, match: 'MATCH', pattern: string) => MethodReturn;
39
+ declare type XSCAN3 = (key: string, cursor: number | string, count: 'COUNT', value: number | string) => MethodReturn;
40
+ declare type XSCAN4 = (key: string, cursor: number | string, match: 'MATCH', pattern: string, count: 'COUNT', value: number | string) => MethodReturn;
41
41
  declare type SPOP1 = (key: string) => MethodReturn;
42
42
  declare type SPOP2 = (key: string, count: number) => MethodReturn;
43
43
  declare type SRANDMEMBER1 = (key: string) => MethodReturn;
@@ -97,7 +97,7 @@ export declare type Upstash = {
97
97
  hlen: (key: string) => MethodReturn;
98
98
  hmget: (key: string, ...field: any) => MethodReturn;
99
99
  hmset: (key: string, ...fieldValue: any) => MethodReturn;
100
- hscan: HSCAN1 & HSCAN2 & HSCAN3 & HSCAN4;
100
+ hscan: XSCAN1 & XSCAN2 & XSCAN3 & XSCAN4;
101
101
  hset: (key: string, ...fieldValue: any) => MethodReturn;
102
102
  hsetnx: (key: string, field: string, value: string) => MethodReturn;
103
103
  hvals: (key: string) => MethodReturn;
@@ -149,6 +149,7 @@ export declare type Upstash = {
149
149
  spop: SPOP1 & SPOP2;
150
150
  srandmember: SRANDMEMBER1 & SRANDMEMBER2;
151
151
  srem: (key: string, ...member: any) => MethodReturn;
152
+ sscan: XSCAN1 & XSCAN2 & XSCAN3 & XSCAN4;
152
153
  sunion: (...key: any) => MethodReturn;
153
154
  sunionstore: (destination: string, ...key: any) => MethodReturn;
154
155
  zadd: (key: string, ...scoreMember: any) => MethodReturn;
@@ -171,6 +172,7 @@ export declare type Upstash = {
171
172
  zrevrangebylex: ZREVRANGEBYLEX1 & ZREVRANGEBYLEX2;
172
173
  zrevrangebyscore: ZREVRANGEBYSCORE1 & ZREVRANGEBYSCORE2 & ZREVRANGEBYSCORE3 & ZREVRANGEBYSCORE4;
173
174
  zrevrank: (key: string, member: string) => MethodReturn;
175
+ zscan: XSCAN1 & XSCAN2 & XSCAN3 & XSCAN4;
174
176
  zscore: (key: string, member: string) => MethodReturn;
175
177
  zunionstore: (destination: string, ...numkeys: any) => MethodReturn;
176
178
  };
@@ -349,6 +349,9 @@ function upstash(url, token) {
349
349
  function srem() {
350
350
  return fetchData(options, 'srem', ...arguments);
351
351
  }
352
+ function sscan() {
353
+ return fetchData(options, 'sscan', ...arguments);
354
+ }
352
355
  function sunion() {
353
356
  return fetchData(options, 'sunion', ...arguments);
354
357
  }
@@ -418,6 +421,9 @@ function upstash(url, token) {
418
421
  function zrevrank() {
419
422
  return fetchData(options, 'zrevrank', ...arguments);
420
423
  }
424
+ function zscan() {
425
+ return fetchData(options, 'zscan', ...arguments);
426
+ }
421
427
  function zscore() {
422
428
  return fetchData(options, 'zscore', ...arguments);
423
429
  }
@@ -521,6 +527,7 @@ function upstash(url, token) {
521
527
  spop,
522
528
  srandmember,
523
529
  srem,
530
+ sscan,
524
531
  sunion,
525
532
  sunionstore,
526
533
  // SORTED SETS
@@ -544,6 +551,7 @@ function upstash(url, token) {
544
551
  zrevrangebylex,
545
552
  zrevrangebyscore,
546
553
  zrevrank,
554
+ zscan,
547
555
  zscore,
548
556
  zunionstore,
549
557
  };
@@ -24,10 +24,6 @@ declare type BITPOS2 = (key: string, bit: Bit, start: number) => MethodReturn;
24
24
  declare type BITPOS3 = (key: string, bit: Bit, start: number, end: number) => MethodReturn;
25
25
  declare type PING1 = () => MethodReturn;
26
26
  declare type PING2 = (message: string) => MethodReturn;
27
- declare type HSCAN1 = (key: string, cursor: number | string) => MethodReturn;
28
- declare type HSCAN2 = (key: string, cursor: number | string, match: 'MATCH', pattern: string) => MethodReturn;
29
- declare type HSCAN3 = (key: string, cursor: number | string, count: 'COUNT', value: number | string) => MethodReturn;
30
- declare type HSCAN4 = (key: string, cursor: number | string, match: 'MATCH', pattern: string, count: 'COUNT', value: number | string) => MethodReturn;
31
27
  declare type SCAN1 = (cursor: number | string) => MethodReturn;
32
28
  declare type SCAN2 = (cursor: number | string, match: 'MATCH', pattern: string) => MethodReturn;
33
29
  declare type SCAN3 = (cursor: number | string, count: 'COUNT', value: number | string) => MethodReturn;
@@ -38,6 +34,10 @@ declare type FLUSHDB1 = () => MethodReturn;
38
34
  declare type FLUSHDB2 = (mode: 'ASYNC' | 'SYNC') => MethodReturn;
39
35
  declare type INFO1 = () => MethodReturn;
40
36
  declare type INFO2 = (section: string) => MethodReturn;
37
+ declare type XSCAN1 = (key: string, cursor: number | string) => MethodReturn;
38
+ declare type XSCAN2 = (key: string, cursor: number | string, match: 'MATCH', pattern: string) => MethodReturn;
39
+ declare type XSCAN3 = (key: string, cursor: number | string, count: 'COUNT', value: number | string) => MethodReturn;
40
+ declare type XSCAN4 = (key: string, cursor: number | string, match: 'MATCH', pattern: string, count: 'COUNT', value: number | string) => MethodReturn;
41
41
  declare type SPOP1 = (key: string) => MethodReturn;
42
42
  declare type SPOP2 = (key: string, count: number) => MethodReturn;
43
43
  declare type SRANDMEMBER1 = (key: string) => MethodReturn;
@@ -97,7 +97,7 @@ export declare type Upstash = {
97
97
  hlen: (key: string) => MethodReturn;
98
98
  hmget: (key: string, ...field: any) => MethodReturn;
99
99
  hmset: (key: string, ...fieldValue: any) => MethodReturn;
100
- hscan: HSCAN1 & HSCAN2 & HSCAN3 & HSCAN4;
100
+ hscan: XSCAN1 & XSCAN2 & XSCAN3 & XSCAN4;
101
101
  hset: (key: string, ...fieldValue: any) => MethodReturn;
102
102
  hsetnx: (key: string, field: string, value: string) => MethodReturn;
103
103
  hvals: (key: string) => MethodReturn;
@@ -149,6 +149,7 @@ export declare type Upstash = {
149
149
  spop: SPOP1 & SPOP2;
150
150
  srandmember: SRANDMEMBER1 & SRANDMEMBER2;
151
151
  srem: (key: string, ...member: any) => MethodReturn;
152
+ sscan: XSCAN1 & XSCAN2 & XSCAN3 & XSCAN4;
152
153
  sunion: (...key: any) => MethodReturn;
153
154
  sunionstore: (destination: string, ...key: any) => MethodReturn;
154
155
  zadd: (key: string, ...scoreMember: any) => MethodReturn;
@@ -171,6 +172,7 @@ export declare type Upstash = {
171
172
  zrevrangebylex: ZREVRANGEBYLEX1 & ZREVRANGEBYLEX2;
172
173
  zrevrangebyscore: ZREVRANGEBYSCORE1 & ZREVRANGEBYSCORE2 & ZREVRANGEBYSCORE3 & ZREVRANGEBYSCORE4;
173
174
  zrevrank: (key: string, member: string) => MethodReturn;
175
+ zscan: XSCAN1 & XSCAN2 & XSCAN3 & XSCAN4;
174
176
  zscore: (key: string, member: string) => MethodReturn;
175
177
  zunionstore: (destination: string, ...numkeys: any) => MethodReturn;
176
178
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@upstash/redis",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "An HTTP/REST based Redis client built on top of Upstash REST API.",
5
5
  "author": "Adem ilter <adem@upstash.com>",
6
6
  "license": "MIT",
package/src/client.ts CHANGED
@@ -412,6 +412,9 @@ function upstash(url?: string | ClientObjectProps, token?: string): Upstash {
412
412
  function srem(): MethodReturn {
413
413
  return fetchData(options, 'srem', ...arguments);
414
414
  }
415
+ function sscan(): MethodReturn {
416
+ return fetchData(options, 'sscan', ...arguments);
417
+ }
415
418
  function sunion(): MethodReturn {
416
419
  return fetchData(options, 'sunion', ...arguments);
417
420
  }
@@ -483,6 +486,9 @@ function upstash(url?: string | ClientObjectProps, token?: string): Upstash {
483
486
  function zrevrank(): MethodReturn {
484
487
  return fetchData(options, 'zrevrank', ...arguments);
485
488
  }
489
+ function zscan(): MethodReturn {
490
+ return fetchData(options, 'zscan', ...arguments);
491
+ }
486
492
  function zscore(): MethodReturn {
487
493
  return fetchData(options, 'zscore', ...arguments);
488
494
  }
@@ -587,6 +593,7 @@ function upstash(url?: string | ClientObjectProps, token?: string): Upstash {
587
593
  spop,
588
594
  srandmember,
589
595
  srem,
596
+ sscan,
590
597
  sunion,
591
598
  sunionstore,
592
599
  // SORTED SETS
@@ -610,6 +617,7 @@ function upstash(url?: string | ClientObjectProps, token?: string): Upstash {
610
617
  zrevrangebylex,
611
618
  zrevrangebyscore,
612
619
  zrevrank,
620
+ zscan,
613
621
  zscore,
614
622
  zunionstore,
615
623
  };
package/src/types.ts CHANGED
@@ -50,21 +50,18 @@ type BITPOS3 = (
50
50
  type PING1 = () => MethodReturn;
51
51
  type PING2 = (message: string) => MethodReturn;
52
52
 
53
- type HSCAN1 = (key: string, cursor: number | string) => MethodReturn;
54
- type HSCAN2 = (
55
- key: string,
53
+ type SCAN1 = (cursor: number | string) => MethodReturn;
54
+ type SCAN2 = (
56
55
  cursor: number | string,
57
56
  match: 'MATCH',
58
57
  pattern: string
59
58
  ) => MethodReturn;
60
- type HSCAN3 = (
61
- key: string,
59
+ type SCAN3 = (
62
60
  cursor: number | string,
63
61
  count: 'COUNT',
64
62
  value: number | string
65
63
  ) => MethodReturn;
66
- type HSCAN4 = (
67
- key: string,
64
+ type SCAN4 = (
68
65
  cursor: number | string,
69
66
  match: 'MATCH',
70
67
  pattern: string,
@@ -72,18 +69,30 @@ type HSCAN4 = (
72
69
  value: number | string
73
70
  ) => MethodReturn;
74
71
 
75
- type SCAN1 = (cursor: number | string) => MethodReturn;
76
- type SCAN2 = (
72
+ type FLUSHALL1 = () => MethodReturn;
73
+ type FLUSHALL2 = (mode: 'ASYNC') => MethodReturn;
74
+
75
+ type FLUSHDB1 = () => MethodReturn;
76
+ type FLUSHDB2 = (mode: 'ASYNC' | 'SYNC') => MethodReturn;
77
+
78
+ type INFO1 = () => MethodReturn;
79
+ type INFO2 = (section: string) => MethodReturn;
80
+
81
+ type XSCAN1 = (key: string, cursor: number | string) => MethodReturn;
82
+ type XSCAN2 = (
83
+ key: string,
77
84
  cursor: number | string,
78
85
  match: 'MATCH',
79
86
  pattern: string
80
87
  ) => MethodReturn;
81
- type SCAN3 = (
88
+ type XSCAN3 = (
89
+ key: string,
82
90
  cursor: number | string,
83
91
  count: 'COUNT',
84
92
  value: number | string
85
93
  ) => MethodReturn;
86
- type SCAN4 = (
94
+ type XSCAN4 = (
95
+ key: string,
87
96
  cursor: number | string,
88
97
  match: 'MATCH',
89
98
  pattern: string,
@@ -91,15 +100,6 @@ type SCAN4 = (
91
100
  value: number | string
92
101
  ) => MethodReturn;
93
102
 
94
- type FLUSHALL1 = () => MethodReturn;
95
- type FLUSHALL2 = (mode: 'ASYNC') => MethodReturn;
96
-
97
- type FLUSHDB1 = () => MethodReturn;
98
- type FLUSHDB2 = (mode: 'ASYNC' | 'SYNC') => MethodReturn;
99
-
100
- type INFO1 = () => MethodReturn;
101
- type INFO2 = (section: string) => MethodReturn;
102
-
103
103
  type SPOP1 = (key: string) => MethodReturn;
104
104
  type SPOP2 = (key: string, count: number) => MethodReturn;
105
105
 
@@ -280,7 +280,7 @@ export type Upstash = {
280
280
  hlen: (key: string) => MethodReturn;
281
281
  hmget: (key: string, ...field: any) => MethodReturn;
282
282
  hmset: (key: string, ...fieldValue: any) => MethodReturn;
283
- hscan: HSCAN1 & HSCAN2 & HSCAN3 & HSCAN4;
283
+ hscan: XSCAN1 & XSCAN2 & XSCAN3 & XSCAN4;
284
284
  hset: (key: string, ...fieldValue: any) => MethodReturn;
285
285
  hsetnx: (key: string, field: string, value: string) => MethodReturn;
286
286
  hvals: (key: string) => MethodReturn;
@@ -352,6 +352,7 @@ export type Upstash = {
352
352
  spop: SPOP1 & SPOP2;
353
353
  srandmember: SRANDMEMBER1 & SRANDMEMBER2;
354
354
  srem: (key: string, ...member: any) => MethodReturn;
355
+ sscan: XSCAN1 & XSCAN2 & XSCAN3 & XSCAN4;
355
356
  sunion: (...key: any) => MethodReturn;
356
357
  sunionstore: (destination: string, ...key: any) => MethodReturn;
357
358
  //
@@ -402,6 +403,7 @@ export type Upstash = {
402
403
  ZREVRANGEBYSCORE3 &
403
404
  ZREVRANGEBYSCORE4;
404
405
  zrevrank: (key: string, member: string) => MethodReturn;
406
+ zscan: XSCAN1 & XSCAN2 & XSCAN3 & XSCAN4;
405
407
  zscore: (key: string, member: string) => MethodReturn;
406
408
  // TODO: fix args
407
409
  zunionstore: (destination: string, ...numkeys: any) => MethodReturn;