From 527ec0c55461a0fc2839b553a73aeee7b19b4254 Mon Sep 17 00:00:00 2001 From: Hamish Peebles Date: Thu, 28 Mar 2024 15:51:18 +0000 Subject: [PATCH 1/5] feat: make `IdbStorage` generic --- packages/auth-client/src/storage.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/auth-client/src/storage.ts b/packages/auth-client/src/storage.ts index aa9694d30..11ae1111a 100644 --- a/packages/auth-client/src/storage.ts +++ b/packages/auth-client/src/storage.ts @@ -102,13 +102,13 @@ export class IdbStorage implements AuthClientStorage { }); } - public async get(key: string): Promise { + public async get(key: string): Promise { const db = await this._db; - return await db.get(key); + return await db.get(key); // return (await db.get(key)) ?? null; } - public async set(key: string, value: string): Promise { + public async set(key: string, value: T): Promise { const db = await this._db; await db.set(key, value); } From b722dc366ca2e6e2d6419dc24b8806b6075e5160 Mon Sep 17 00:00:00 2001 From: Hamish Peebles Date: Thu, 28 Mar 2024 16:13:52 +0000 Subject: [PATCH 2/5] Remove generic type constraint --- packages/auth-client/src/storage.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/auth-client/src/storage.ts b/packages/auth-client/src/storage.ts index 11ae1111a..b47ad75b3 100644 --- a/packages/auth-client/src/storage.ts +++ b/packages/auth-client/src/storage.ts @@ -102,13 +102,13 @@ export class IdbStorage implements AuthClientStorage { }); } - public async get(key: string): Promise { + public async get(key: string): Promise { const db = await this._db; return await db.get(key); // return (await db.get(key)) ?? null; } - public async set(key: string, value: T): Promise { + public async set(key: string, value: T): Promise { const db = await this._db; await db.set(key, value); } From 8fb5da7e0e4afbcd60bdcc0a42ae6294ae2c981c Mon Sep 17 00:00:00 2001 From: Hamish Peebles Date: Thu, 28 Mar 2024 16:44:52 +0000 Subject: [PATCH 3/5] Update CHANGELOG --- docs/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 8c4be7d85..d6f789d5a 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -2,6 +2,10 @@ ## [Unreleased] +### Changed + +- feat: make `IdbStorage` `get` and `set` methods generic + ## [1.2.0] - 2024-03-25 ### Added From 6c70ea520e8896dc7edb2c0032179d757a360ea4 Mon Sep 17 00:00:00 2001 From: Hamish Peebles Date: Thu, 28 Mar 2024 16:45:35 +0000 Subject: [PATCH 4/5] wording --- docs/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index d6f789d5a..a9778ac15 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -4,7 +4,7 @@ ### Changed -- feat: make `IdbStorage` `get` and `set` methods generic +- feat: make `IdbStorage` `get/set` methods generic ## [1.2.0] - 2024-03-25 From f53aa4c7b6f6209e0bf50e24f6d6afc68768a992 Mon Sep 17 00:00:00 2001 From: Hamish Peebles Date: Thu, 28 Mar 2024 16:47:48 +0000 Subject: [PATCH 5/5] Add default generic type --- packages/auth-client/src/storage.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/auth-client/src/storage.ts b/packages/auth-client/src/storage.ts index b47ad75b3..86acaf2ed 100644 --- a/packages/auth-client/src/storage.ts +++ b/packages/auth-client/src/storage.ts @@ -102,13 +102,13 @@ export class IdbStorage implements AuthClientStorage { }); } - public async get(key: string): Promise { + public async get(key: string): Promise { const db = await this._db; return await db.get(key); // return (await db.get(key)) ?? null; } - public async set(key: string, value: T): Promise { + public async set(key: string, value: T): Promise { const db = await this._db; await db.set(key, value); }