diff --git a/src/utils.ts b/src/utils.ts index 92050d1f5..841a606bc 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -17,7 +17,6 @@ const storageKeyProperties: StorageKeys = [ "getMeta", "setMeta", "removeMeta", - "getKeys", "clear", "mount", "unmount", @@ -48,6 +47,8 @@ export function prefixStorage( // Remove Prefix .then((keys) => keys.map((key) => key.slice(base.length))); + nsStorage.keys = (key = "", ...argumens_) => nsStorage.getKeys(key, ...argumens_); + nsStorage.getItems = async ( items: (string | { key: string; options?: TransactionOptions })[], commonOptions?: TransactionOptions diff --git a/test/storage.test.ts b/test/storage.test.ts index d5a2542d7..696bba067 100644 --- a/test/storage.test.ts +++ b/test/storage.test.ts @@ -218,6 +218,8 @@ describe("Regression", () => { expect(await pStorage.has("x")).toBe(true); expect(await pStorage.get("y")).toBe("bar"); + expect(await pStorage.keys()).toStrictEqual(["x", "y"]); + await pStorage.del("x"); expect(await pStorage.has("x")).toBe(false);