From 17eeb866c1d357f2ae05de25f246b133c8b79045 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 24 Sep 2024 11:30:41 +0000 Subject: [PATCH 1/3] fix(deps): update dependency @upstash/redis to v1.34.0 --- pnpm-lock.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3f904f028..2220968ac 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -164,7 +164,7 @@ importers: dependencies: '@upstash/redis': specifier: ^1.31.3 - version: 1.31.3 + version: 1.34.0 devDependencies: '@changesets/cli': specifier: 2.27.8 @@ -2633,8 +2633,8 @@ packages: /@ungap/structured-clone@1.2.0: resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} - /@upstash/redis@1.31.3: - resolution: {integrity: sha512-KtVgWBUEx/LGbR8oRwYexwzHh3s5DNqYW0bjkD+gjFZVOnREJITvK+hC4PjSSD+8D4qJ+Xbkfmy8ANADZ9EUFg==} + /@upstash/redis@1.34.0: + resolution: {integrity: sha512-TrXNoJLkysIl8SBc4u9bNnyoFYoILpCcFJcLyWCccb/QSUmaVKdvY0m5diZqc3btExsapcMbaw/s/wh9Sf1pJw==} dependencies: crypto-js: 4.2.0 dev: false @@ -3118,8 +3118,8 @@ packages: engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001660 - electron-to-chromium: 1.5.22 + caniuse-lite: 1.0.30001663 + electron-to-chromium: 1.5.28 node-releases: 2.0.18 update-browserslist-db: 1.1.0(browserslist@4.23.3) dev: true @@ -3240,8 +3240,8 @@ packages: /caniuse-lite@1.0.30001587: resolution: {integrity: sha512-HMFNotUmLXn71BQxg8cijvqxnIAofforZOwGsxyXJ0qugTdspUF4sPSJ2vhgprHCB996tIDzEq1ubumPDV8ULA==} - /caniuse-lite@1.0.30001660: - resolution: {integrity: sha512-GacvNTTuATm26qC74pt+ad1fW15mlQ/zuTzzY1ZoIzECTP8HURDfF43kNxPgf7H1jmelCBQTTbBNxdSXOA7Bqg==} + /caniuse-lite@1.0.30001663: + resolution: {integrity: sha512-o9C3X27GLKbLeTYZ6HBOLU1tsAcBZsLis28wrVzddShCS16RujjHp9GDHKZqrB3meE0YjhawvMFsGb/igqiPzA==} dev: true /chalk@2.4.2: @@ -3680,8 +3680,8 @@ packages: /electron-to-chromium@1.4.672: resolution: {integrity: sha512-YYCy+goe3UqZqa3MOQCI5Mx/6HdBLzXL/mkbGCEWL3sP3Z1BP9zqAzeD3YEmLZlespYGFtyM8tRp5i2vfaUGCA==} - /electron-to-chromium@1.5.22: - resolution: {integrity: sha512-tKYm5YHPU1djz0O+CGJ+oJIvimtsCcwR2Z9w7Skh08lUdyzXY5djods3q+z2JkWdb7tCcmM//eVavSRAiaPRNg==} + /electron-to-chromium@1.5.28: + resolution: {integrity: sha512-VufdJl+rzaKZoYVUijN13QcXVF5dWPZANeFTLNy+OSpHdDL5ynXTF35+60RSBbaQYB1ae723lQXHCrf4pyLsMw==} dev: true /emittery@0.13.1: From bd1bb4ff9e71af3e57aaa0312e29509bee5d2938 Mon Sep 17 00:00:00 2001 From: Luka Hartwig Date: Wed, 25 Sep 2024 17:44:05 +0200 Subject: [PATCH 2/3] Fix tests --- packages/kv/src/index.test.ts | 10 +++++----- packages/kv/src/index.ts | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/kv/src/index.test.ts b/packages/kv/src/index.test.ts index f0584aa63..90ac77dc7 100644 --- a/packages/kv/src/index.test.ts +++ b/packages/kv/src/index.test.ts @@ -1,6 +1,6 @@ import defaultKv, { kv, VercelKV, createClient } from '.'; -let scanReturnValues: [number, string[]][] = [[0, []]]; +let scanReturnValues: [string, string[]][] = [['0', []]]; jest.mock('@upstash/redis', () => ({ Redis: jest.fn(() => ({ get: jest.fn().mockResolvedValue('bar'), @@ -14,7 +14,7 @@ jest.mock('@upstash/redis', () => ({ describe('@vercel/kv', () => { beforeEach(() => { - scanReturnValues = [[0, []]]; + scanReturnValues = [['0', []]]; jest.clearAllMocks(); }); @@ -78,9 +78,9 @@ describe('@vercel/kv', () => { it('supports iteration', async () => { scanReturnValues = [ - [2, ['1', '2']], - [4, ['3', '4']], - [0, []], + ['2', ['1', '2']], + ['4', ['3', '4']], + ['0', []], ]; const client = createClient({ url: 'foobar', token: 'foobar' }); const returnedKeys: string[] = []; diff --git a/packages/kv/src/index.ts b/packages/kv/src/index.ts index f6ae9fd83..edbd81e58 100644 --- a/packages/kv/src/index.ts +++ b/packages/kv/src/index.ts @@ -10,7 +10,7 @@ export class VercelKV extends Redis { * Same as `scan` but returns an AsyncIterator to allow iteration via `for await`. */ async *scanIterator(options?: ScanCommandOptions): AsyncIterable { - let cursor = 0; + let cursor = '0'; let keys: string[]; do { // eslint-disable-next-line no-await-in-loop -- [@vercel/style-guide@5 migration] @@ -18,7 +18,7 @@ export class VercelKV extends Redis { for (const key of keys) { yield key; } - } while (cursor !== 0); + } while (cursor !== '0'); } /** @@ -28,7 +28,7 @@ export class VercelKV extends Redis { key: string, options?: ScanCommandOptions, ): AsyncIterable { - let cursor = 0; + let cursor = '0'; let items: (number | string)[]; do { // eslint-disable-next-line no-await-in-loop -- [@vercel/style-guide@5 migration] @@ -36,7 +36,7 @@ export class VercelKV extends Redis { for (const item of items) { yield item; } - } while (cursor !== 0); + } while (cursor !== '0'); } /** @@ -46,7 +46,7 @@ export class VercelKV extends Redis { key: string, options?: ScanCommandOptions, ): AsyncIterable { - let cursor = 0; + let cursor = '0'; let items: (number | string)[]; do { // eslint-disable-next-line no-await-in-loop -- [@vercel/style-guide@5 migration] @@ -54,7 +54,7 @@ export class VercelKV extends Redis { for (const item of items) { yield item; } - } while (cursor !== 0); + } while (cursor !== '0'); } /** @@ -64,7 +64,7 @@ export class VercelKV extends Redis { key: string, options?: ScanCommandOptions, ): AsyncIterable { - let cursor = 0; + let cursor = '0'; let items: (number | string)[]; do { // eslint-disable-next-line no-await-in-loop -- [@vercel/style-guide@5 migration] @@ -72,7 +72,7 @@ export class VercelKV extends Redis { for (const item of items) { yield item; } - } while (cursor !== 0); + } while (cursor !== '0'); } } From 5a604b523aa9b912cd607f9a7cb5656299b135ac Mon Sep 17 00:00:00 2001 From: Luka Hartwig Date: Thu, 26 Sep 2024 19:14:27 +0200 Subject: [PATCH 3/3] Create six-teachers-teach.md --- .changeset/six-teachers-teach.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/six-teachers-teach.md diff --git a/.changeset/six-teachers-teach.md b/.changeset/six-teachers-teach.md new file mode 100644 index 000000000..d54ece182 --- /dev/null +++ b/.changeset/six-teachers-teach.md @@ -0,0 +1,5 @@ +--- +"@vercel/kv": major +--- + +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`.