Skip to content

Commit 5b57c68

Browse files
authored
keyv - feat: (breaking) memory adapter, bridge adapter, keyv overhaul (#1913)
* keyv - feat: adding KeyvMemoryAdapter for Map like stores * rename to KeyvMemoryAdapter * public and removing function namespace * namespace property cleanup * fixing clear * calculateExpires * test added * creatKeyv bug fix * double wrap cleanup * Update utils.test.ts * Update memory.test.ts * adding faker and breaking out tests * clean up * initial KeyvMemoryAdapter * adding KeyvMapAny * Update keyv.test.ts * moving to a single util sleep function * get and set tests * adding bridge adapter and tests * bridge * fixing bigmap tests * keyv cleanup * tests * rename to encode and decode * better handling of encode and decode * encode decode encryption * Update keyv.test.ts * fixing dynamo issue * doing fixes for test errors * adding back in checks on expiration * Update memory.ts * Update keyv.ts * removing symbol support * removing issue on table * Update memory.test.ts * coverage updates * Update index.ts
1 parent eaf7281 commit 5b57c68

38 files changed

+5577
-4244
lines changed

core/bigmap/test/index.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { faker } from "@faker-js/faker";
2+
import type { KeyvMemoryAdapter } from "keyv";
23
import { describe, expect, it } from "vitest";
34
import { BigMap, createKeyv, defaultHashFunction } from "../src/index.js";
45

@@ -396,14 +397,14 @@ describe("createKeyv", () => {
396397
it("should create a Keyv instance with BigMap adapter", () => {
397398
const keyv = createKeyv();
398399
expect(keyv).toBeDefined();
399-
expect(keyv.store).toBeInstanceOf(BigMap);
400+
expect((keyv.store as KeyvMemoryAdapter).store).toBeInstanceOf(BigMap);
400401
});
401402

402403
it("should create a Keyv instance with custom options", () => {
403404
const keyv = createKeyv({ storeSize: 8 });
404405
expect(keyv).toBeDefined();
405-
expect(keyv.store).toBeInstanceOf(BigMap);
406-
expect((keyv.store as BigMap<string, unknown>).storeSize).toBe(8);
406+
expect((keyv.store as KeyvMemoryAdapter).store).toBeInstanceOf(BigMap);
407+
expect(((keyv.store as KeyvMemoryAdapter).store as BigMap<string, unknown>).storeSize).toBe(8);
407408
});
408409

409410
it("should work with set and get operations", async () => {

core/keyv/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@
6666
"@faker-js/faker": "^10.2.0",
6767
"@vitest/coverage-v8": "^4.0.18",
6868
"happy-dom": "^20.8.7",
69+
"keyv-anyredis": "^3.3.0",
70+
"keyv-file": "^5.3.3",
6971
"lru.min": "^1.1.1",
7072
"quick-lru": "^7.0.0",
7173
"rimraf": "^6.1.2",

0 commit comments

Comments
 (0)