Skip to content

Commit 14bc82e

Browse files
authoredSep 27, 2024··
fix(deps): update dependency @upstash/redis to v1.34.0 (#713)
1 parent 8c8e6a7 commit 14bc82e

File tree

4 files changed

+27
-22
lines changed

4 files changed

+27
-22
lines changed
 

Diff for: ‎.changeset/six-teachers-teach.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@vercel/kv": major
3+
---
4+
5+
BREAKING: Updates @upstash/redis to v1.34.0 which contains a small breaking change in the public API. The cursor field in scan commands is now returned as `string` instead of `number`.

Diff for: ‎packages/kv/src/index.test.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import defaultKv, { kv, VercelKV, createClient } from '.';
22

3-
let scanReturnValues: [number, string[]][] = [[0, []]];
3+
let scanReturnValues: [string, string[]][] = [['0', []]];
44
jest.mock('@upstash/redis', () => ({
55
Redis: jest.fn(() => ({
66
get: jest.fn().mockResolvedValue('bar'),
@@ -14,7 +14,7 @@ jest.mock('@upstash/redis', () => ({
1414

1515
describe('@vercel/kv', () => {
1616
beforeEach(() => {
17-
scanReturnValues = [[0, []]];
17+
scanReturnValues = [['0', []]];
1818
jest.clearAllMocks();
1919
});
2020

@@ -78,9 +78,9 @@ describe('@vercel/kv', () => {
7878

7979
it('supports iteration', async () => {
8080
scanReturnValues = [
81-
[2, ['1', '2']],
82-
[4, ['3', '4']],
83-
[0, []],
81+
['2', ['1', '2']],
82+
['4', ['3', '4']],
83+
['0', []],
8484
];
8585
const client = createClient({ url: 'foobar', token: 'foobar' });
8686
const returnedKeys: string[] = [];

Diff for: ‎packages/kv/src/index.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ export class VercelKV extends Redis {
1010
* Same as `scan` but returns an AsyncIterator to allow iteration via `for await`.
1111
*/
1212
async *scanIterator(options?: ScanCommandOptions): AsyncIterable<string> {
13-
let cursor = 0;
13+
let cursor = '0';
1414
let keys: string[];
1515
do {
1616
// eslint-disable-next-line no-await-in-loop -- [@vercel/style-guide@5 migration]
1717
[cursor, keys] = await this.scan(cursor, options);
1818
for (const key of keys) {
1919
yield key;
2020
}
21-
} while (cursor !== 0);
21+
} while (cursor !== '0');
2222
}
2323

2424
/**
@@ -28,15 +28,15 @@ export class VercelKV extends Redis {
2828
key: string,
2929
options?: ScanCommandOptions,
3030
): AsyncIterable<string | number> {
31-
let cursor = 0;
31+
let cursor = '0';
3232
let items: (number | string)[];
3333
do {
3434
// eslint-disable-next-line no-await-in-loop -- [@vercel/style-guide@5 migration]
3535
[cursor, items] = await this.hscan(key, cursor, options);
3636
for (const item of items) {
3737
yield item;
3838
}
39-
} while (cursor !== 0);
39+
} while (cursor !== '0');
4040
}
4141

4242
/**
@@ -46,15 +46,15 @@ export class VercelKV extends Redis {
4646
key: string,
4747
options?: ScanCommandOptions,
4848
): AsyncIterable<string | number> {
49-
let cursor = 0;
49+
let cursor = '0';
5050
let items: (number | string)[];
5151
do {
5252
// eslint-disable-next-line no-await-in-loop -- [@vercel/style-guide@5 migration]
5353
[cursor, items] = await this.sscan(key, cursor, options);
5454
for (const item of items) {
5555
yield item;
5656
}
57-
} while (cursor !== 0);
57+
} while (cursor !== '0');
5858
}
5959

6060
/**
@@ -64,15 +64,15 @@ export class VercelKV extends Redis {
6464
key: string,
6565
options?: ScanCommandOptions,
6666
): AsyncIterable<string | number> {
67-
let cursor = 0;
67+
let cursor = '0';
6868
let items: (number | string)[];
6969
do {
7070
// eslint-disable-next-line no-await-in-loop -- [@vercel/style-guide@5 migration]
7171
[cursor, items] = await this.zscan(key, cursor, options);
7272
for (const item of items) {
7373
yield item;
7474
}
75-
} while (cursor !== 0);
75+
} while (cursor !== '0');
7676
}
7777
}
7878

Diff for: ‎pnpm-lock.yaml

+9-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.