@vercel/kv2 0.0.3 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -63,7 +63,7 @@ await users.delete("alice");
63
63
  8. [Caching](https://github.com/vercel-labs/KV2/blob/main/docs/caching.md) — cache hierarchy, TTL, custom cache
64
64
  9. [Streaming](https://github.com/vercel-labs/KV2/blob/main/docs/streaming.md) — binary format, large values, streaming reads/writes
65
65
  10. [Copy-on-Write Branches](https://github.com/vercel-labs/KV2/blob/main/docs/copy-on-write-branches.md) — branch isolation, upstream config
66
- 11. [Testing and Tracing](https://github.com/vercel-labs/KV2/blob/main/docs/testing-and-tracing.md) — FakeBlobStore, tracers, stats
66
+ 11. [Testing and Tracing](https://github.com/vercel-labs/KV2/blob/main/docs/testing-and-tracing.md) — unit testing, tracers, stats
67
67
  12. [CLI](https://github.com/vercel-labs/KV2/blob/main/docs/cli.md) — interactive KV store explorer
68
68
  13. [API Reference](https://github.com/vercel-labs/KV2/blob/main/docs/api-reference.md) — full interface and options documentation
69
69
 
package/SKILL.md CHANGED
@@ -24,7 +24,7 @@ Detailed documentation is available in the package's `docs/` directory. Read fil
24
24
  | `caching.md` | Cache hierarchy, TTL, custom cache |
25
25
  | `streaming.md` | Binary format, large values, streaming reads/writes |
26
26
  | `copy-on-write-branches.md` | Branch isolation, upstream config |
27
- | `testing-and-tracing.md` | FakeBlobStore, tracers, stats |
27
+ | `testing-and-tracing.md` | Unit testing, tracers, stats |
28
28
  | `cli.md` | CLI explorer reference |
29
29
  | `api-reference.md` | Full interface and options documentation |
30
30
 
@@ -4,9 +4,13 @@
4
4
 
5
5
  ## Testing
6
6
 
7
- ### FakeBlobStore
7
+ ### Local development
8
8
 
9
- An in-memory blob store for unit tests. No network calls, no tokens needed:
9
+ For local development, use a real Vercel Blob store. This ensures your app behaves the same locally as it does in production. See [Getting Started](getting-started.md) for setup instructions — `vercel env pull .env.local` gives you a `BLOB_READ_WRITE_TOKEN` that works locally.
10
+
11
+ ### Unit tests
12
+
13
+ For unit tests, use `FakeBlobStore` — an in-memory blob store that requires no network calls or tokens:
10
14
 
11
15
  ```typescript
12
16
  import { FakeBlobStore } from "@vercel/kv2/testing";
@@ -19,22 +23,18 @@ await kv.set("key", { hello: "world" });
19
23
  const result = await kv.get("key");
20
24
  ```
21
25
 
22
- ### FakeCache
23
-
24
- An in-memory cache with call tracking and programmable error injection:
26
+ `FakeCache` provides an in-memory cache with call tracking:
25
27
 
26
28
  ```typescript
27
- import { FakeCache } from "@vercel/kv2/testing";
29
+ import { FakeBlobStore, FakeCache } from "@vercel/kv2/testing";
28
30
  import { KV2 } from "@vercel/kv2";
29
31
 
30
- const cache = new FakeCache();
31
32
  const blobStore = new FakeBlobStore();
33
+ const cache = new FakeCache();
32
34
  const kv = new KV2({ prefix: "test/", blobStore, cache });
33
35
  ```
34
36
 
35
- ### createTestKV
36
-
37
- A convenience factory that creates a KV2 backed by `FakeBlobStore` (or real Vercel Blob when `INTEGRATION_TEST=1`):
37
+ Or use `createTestKV` for a one-liner:
38
38
 
39
39
  ```typescript
40
40
  import { createTestKV } from "@vercel/kv2/testing";
@@ -47,17 +47,15 @@ await kv.set("key", { hello: "world" });
47
47
  await cleanup();
48
48
  ```
49
49
 
50
- ### Integration Tests
50
+ ### Integration tests
51
51
 
52
- Set environment variables and run:
52
+ To run tests against a real Vercel Blob store, set the environment variables and run:
53
53
 
54
54
  ```bash
55
- INTEGRATION_TEST=1 pnpm test
55
+ INTEGRATION_TEST=1 BLOB_READ_WRITE_TOKEN=vercel_blob_... pnpm test
56
56
  ```
57
57
 
58
- Required env vars for integration tests:
59
- - `BLOB_READ_WRITE_TOKEN` — Vercel Blob access token
60
- - `PROTECTION_BYPASS` — Protection bypass token
58
+ `createTestKV` automatically switches to a real blob store when `INTEGRATION_TEST=1` is set.
61
59
 
62
60
  ## Tracing
63
61
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/kv2",
3
- "version": "0.0.3",
3
+ "version": "0.0.6",
4
4
  "description": "KV2 - A type-safe KV store backed by Vercel private blobs with regional caching",
5
5
  "type": "module",
6
6
  "files": [
@@ -37,6 +37,9 @@
37
37
  ],
38
38
  "author": "",
39
39
  "license": "ISC",
40
+ "publishConfig": {
41
+ "access": "public"
42
+ },
40
43
  "dependencies": {
41
44
  "@vercel/blob": "2.2.0-f6bb7b4-20260204165325",
42
45
  "@vercel/functions": "^3.3.6"