@vite-hub/kv 0.3.1 → 0.4.1

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.
Files changed (41) hide show
  1. package/README.md +14 -12
  2. package/dist/cli.js +4 -3
  3. package/dist/{cloudflare-kv-BIEUFzRT.js → cloudflare-kv-C3NO4C21.js} +18 -4
  4. package/dist/{cloudflare-kv-local-BBw3ZT1K.js → cloudflare-kv-local-C2sbIrFy.js} +2 -2
  5. package/dist/{config-BXEVoZE3.js → config-LfpUj9hs.js} +25 -23
  6. package/dist/{create-storage-BGsrQKw3.js → create-storage-BORQm2a8.js} +5 -5
  7. package/dist/{cursor-history-BqIQePNP.js → cursor-history-DRHh5bO5.js} +1 -1
  8. package/dist/{database-72Jk3VVk.js → database-oJdy0ZVX.js} +1 -1
  9. package/dist/{deno-kv-BM9mYdUp.js → deno-kv-D_VtffFv.js} +2 -2
  10. package/dist/{driver-BwxgaQ-f.d.ts → driver-R4Z5Z5fl.d.ts} +2 -2
  11. package/dist/{error-diagnostics-BxqvtEIb.js → error-diagnostics-C54QQEhN.js} +10 -2
  12. package/dist/{errors-DbwufFZp.js → errors-DzD6YNEH.js} +31 -3
  13. package/dist/errors.d.ts +6 -1
  14. package/dist/errors.js +2 -2
  15. package/dist/fs-lite-BAgpmNAF.js +2 -0
  16. package/dist/{fs-lite-BLZId9_P.js → fs-lite-BaklCLuV.js} +1 -1
  17. package/dist/index.d.ts +2 -2
  18. package/dist/index.js +42 -27
  19. package/dist/{operation-definition-8gOe-ubD.d.ts → operation-definition-nmRu_O3V.d.ts} +5 -0
  20. package/dist/{operations-Ch-gKaey.js → operations-CtrWLmPK.js} +3 -9
  21. package/dist/{operations-B-WZ7P1h.js → operations-D2iI9oN4.js} +238 -226
  22. package/dist/operations.d.ts +2 -2
  23. package/dist/operations.js +3 -2
  24. package/dist/{redis-shared-E5mahECF.js → redis-shared-5ogRd3-Y.js} +1 -1
  25. package/dist/runtime/cloudflare-kv.d.ts +1 -1
  26. package/dist/runtime/cloudflare-kv.js +1 -1
  27. package/dist/runtime/nitro-plugin.js +7 -4
  28. package/dist/runtime/redis-driver.d.ts +2 -2
  29. package/dist/runtime/redis-driver.js +2 -2
  30. package/dist/runtime/unstorage-driver.js +6 -2
  31. package/dist/runtime/upstash-driver.d.ts +2 -2
  32. package/dist/runtime/upstash-driver.js +2 -2
  33. package/dist/{types-DEiKew_3.d.ts → types-Dv-OSXZC.d.ts} +33 -20
  34. package/dist/{upstash-DDlqTttY.js → upstash-B-vaUYqO.js} +2 -2
  35. package/dist/virtual-module.d.ts +1 -0
  36. package/dist/vite.d.ts +17 -5
  37. package/dist/vite.js +601 -334
  38. package/package.json +5 -5
  39. package/dist/fs-lite-RAoxu8L0.js +0 -2
  40. package/dist/main-F3Y22_uV.js +0 -2353
  41. package/dist/rolldown-runtime-CMFfr-1z.js +0 -26
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # @vite-hub/kv
2
2
 
3
3
  <p>
4
- <a href="https://vitehub.dev"><img alt="ViteHub" src="https://comark-ui.onmax.me/badge.svg?label=ViteHub&amp;value=vitehub.dev"></a>
5
- <img alt="TypeScript" src="https://comark-ui.onmax.me/badge.svg?label=TypeScript&amp;value=ready">
6
- <img alt="Vite" src="https://comark-ui.onmax.me/badge.svg?label=Vite&amp;value=config">
7
- <img alt="KV" src="https://comark-ui.onmax.me/badge.svg?label=KV&amp;value=stores">
4
+ <a href="https://vitehub.dev"><img alt="ViteHub" src="https://img.shields.io/static/v1?label=ViteHub&amp;message=vitehub.dev&amp;color=blue"></a>
5
+ <img alt="TypeScript" src="https://img.shields.io/static/v1?label=TypeScript&amp;message=ready&amp;color=blue">
6
+ <img alt="Vite" src="https://img.shields.io/static/v1?label=Vite&amp;message=config&amp;color=blue">
7
+ <img alt="KV" src="https://img.shields.io/static/v1?label=KV&amp;message=stores&amp;color=blue">
8
8
  </p>
9
9
 
10
10
  `@vite-hub/kv` gives server code one small-state API for settings, flags, cache entries, and JSON-like records.
@@ -64,17 +64,17 @@ Several Node processes share keys only through a shared store. Without a `driver
64
64
 
65
65
  `{ driver: "redis", url?, base? }` reads `url` at runtime when it is `env:<NAME>`, and `env:REDIS_URL` is the default. A literal URL goes into the build output. `base` prefixes every key and defaults to `vitehub:kv:<store>`, so keys that are not ViteHub's stay apart. The generated store segment escapes `%`, `:`, `/`, `\`, and `?`; an empty store name uses `%`. This keeps store names separate after key normalization. Two ViteHub apps on one Redis database share the default, so give each app its own database or `base`. A Redis listing cursor holds its whole state, so another server process can read the next page.
66
66
 
67
- `{ driver: "upstash", url?, token?, base? }` uses the same `base` rule as `redis`: every key gets the prefix `vitehub:kv:<store>` unless `base` sets another one, so `kv.clear()` and `kv.keys()` stay inside the store. Upstash takes whole seconds, so `set()` rounds a TTL up. Its listing cursor also holds its whole state, so the next page works in another serverless invocation.
67
+ `{ driver: "upstash", url?, token?, base? }` uses the same `base` rule as `redis`: every key gets the prefix `vitehub:kv:<store>` unless `base` sets another one, so `kv.clear()` and `kv.list()` stay inside the store. Upstash takes whole seconds, so `set()` rounds a TTL up. Its listing cursor also holds its whole state, so the next page works in another serverless invocation.
68
68
 
69
69
  `{ driver: "database", database? }` keeps keys in the table `vitehub_kv` of the Database `database` (default `"default"`), with one `namespace` per store. The store creates the table when it is missing; on Postgres, an advisory lock lets several servers start at once. Every atomic operation is one SQL statement, and expiry uses the clock of the Database. Writes start background cleanup of at most 1000 expired rows in their namespace. A full batch lets the next write start another batch; once a batch is not full, cleanup waits a minute. Postgres sweeps skip rows locked by another process. It works on Postgres and libSQL, not on D1.
70
70
 
71
- The driver is selected at build time. Redis requires `kv: { driver: "redis" }`; every process must supply its URL, and a missing URL fails. An unrelated `REDIS_URL` never changes the selected driver. A build without a `driver` that has `REDIS_URL`, or a `KV_URL` that starts with `rediss://`, prints a warning with the fix `kv: { driver: "redis" }`. On Vercel without Upstash variables, the same warning says that the inferred Upstash store fails at runtime. The `kv.list` operation (`vitehub kv list`, the Console) reports that driver.
71
+ The driver is selected at build time. Redis requires `kv: { driver: "redis" }`; every process must supply its URL, and a missing URL fails. An unrelated `REDIS_URL` never changes the selected driver. A build without a `driver` that has `REDIS_URL`, or a `KV_URL` that starts with `rediss://`, reports the hint `KV_REDIS_URL_UNUSED` in the build output and in `.vitehub/hints.json`, with the fix `kv: { driver: "redis" }`. On Vercel without Upstash variables, the same hint says that the inferred Upstash store fails at runtime. The `kv.list` operation (`vitehub kv list`, the Console) reports that driver.
72
72
 
73
73
  This changes the default of a Node build with a Postgres Database from `fs-lite` to `database`. Keys in `.vitehub/data/kv` are not copied. Set `kv: { driver: "fs-lite" }` to keep the old store.
74
74
 
75
75
  `fs-lite` writes each key as one file in `base`. The file name starts with `key-`, followed by the key with `%` and `:` escaped as in a URL, so `signups` and `signups:reset-at` are the files `key-signups` and `key-signups%3Areset-at`. This prefix keeps application keys separate from migration metadata and temporary files. Most file systems limit a file name to 255 bytes, so an escaped key longer than 251 bytes fails with `KV_OPERATION_FAILED`. Earlier versions wrote `a:b` as the file `a/b`. The store moves those files to their new names when it opens the folder and preserves literal `%` characters in old key names. It keeps a hidden layout record and metadata folder in `base`. The migration lock stays in that folder, so only `base` needs write access. Stop all processes that use the store before moving it. Copies and backups must preserve hidden files and hard links. Use GNU `cp -a` and verify the copied layout record before opening the copy; see [Move an fs-lite store](https://vitehub.dev/docs/kv/configure#move-an-fs-lite-store). Ordinary `cp -R` breaks the layout identity and can make existing keys inaccessible.
76
76
 
77
- `kv.set(key, value, { ttl: seconds })` expires a value on every driver. Omitting `ttl` keeps the value until it is deleted or replaced. `ttl` is the only option; other options return `KV_INVALID_OPTION`. Cloudflare KV keeps a value at least 60 seconds. `fs-lite` keeps the expiry time of each key in its metadata folder and treats an expired key as missing. Initialization failures do not disable a store for the life of the process. The next operation can retry initialization.
77
+ `kv.set(key, value, { ttl })` expires a value on every driver. `ttl` is a duration such as `"1h"`, or a number of seconds. Omitting `ttl` keeps the value until it is deleted or replaced. `ttl` is the only option; other options return `KV_INVALID_OPTION`. Cloudflare KV keeps a value at least 60 seconds. `fs-lite` keeps the expiry time of each key in its metadata folder and treats an expired key as missing. Initialization failures do not disable a store for the life of the process. The next operation can retry initialization.
78
78
 
79
79
  ## Development stays local
80
80
 
@@ -88,6 +88,8 @@ An explicit `driver` is honored as before; an `upstash` store prints the same no
88
88
 
89
89
  ## Nitro storage
90
90
 
91
+ During Nuxt prerender, the Node worker uses the configured KV stores and ignores the development `remote` option. Cloudflare stores use their local folders, and an app with a Deno KV store keeps the runtime fallback.
92
+
91
93
  When KV is enabled in a Nitro app, the default store is the Nitro storage mount `kv`, and a named store is the mount `kv-<name>`. `useStorage("kv").getItem("a")` reads the same value as `kv.get("a")`, and `clear()` on a mount clears only that store. Store names escape `%`, `:`, `/`, `\\`, and `?` as percent-encoded characters; an empty name uses `%` (for example, `a/b` mounts at `kv-a%2Fb`). A mount with the same name in `nitro.kv` (or the deprecated `nitro.storage`) wins. Nuxt modules that take a mount name, such as nuxt-og-image's `runtimeCacheStorage: "kv"`, store their data in KV this way.
92
94
 
93
95
  `kvStorageDriver` from `@vite-hub/kv/vite` is the file path of the unstorage driver behind these mounts. Its options are `store` (default: the default store) and `base`, a key prefix. Pass it to a module that takes a driver name, or mount it yourself. The driver opens the store on each call, so on Cloudflare it uses the binding of the current request. Nitro's `ttl` goes to `kv.set()`.
@@ -96,9 +98,9 @@ With `vitehub()`, `cache: { driver: "kv" }` mounts the same driver at Nitro's `c
96
98
 
97
99
  ## Listing keys
98
100
 
99
- `kv.keys(prefix)` is exhaustive. Use `kv.list({ prefix, limit, cursor })` when the caller needs bounded work. `limit` must be a positive integer. A page returns `{ keys, cursor? }`; an omitted cursor means the listing is complete.
101
+ `kv.list({ prefix })` returns every key that starts with `prefix`. Add `limit` when the caller needs bounded work: `kv.list({ prefix, limit, cursor })` reads one page. `limit` must be a positive integer. A page returns `{ keys, cursor? }`; an omitted cursor means the listing is complete. `kv.clear({ prefix })` deletes the keys that `kv.list({ prefix })` lists.
100
102
 
101
- List prefixes use the same key normalization as reads and writes. For example, `users/al` matches the stored key `users:alice`. A trailing separator, such as `users/` or `users:`, limits the prefix to children and does not match `users-other`.
103
+ Prefixes match text, and use the same key normalization as reads and writes. For example, `users/al` matches the stored key `users:alice`, and `user` matches `users:alice` and `user-old:1`. A trailing separator, such as `users/` or `users:`, limits the prefix to children and does not match `users-other`.
102
104
 
103
105
  Cursors are opaque and provider-specific. Pass a returned cursor back to the same store with the same prefix. Cloudflare KV, Upstash, Deno KV, and `fs-lite` stop enumeration when the requested page is full. Cloudflare KV and Deno KV cursors carry the provider cursor, so a request in another isolate can continue the listing. An `fs-lite` cursor retains a directory iterator in the current process for up to 15 minutes. Upstash uses the same retention window when the provider returns more keys than requested. These process-local cursors can expire sooner when more than 32 listings are left unfinished. Calling `disposeKVStores()` from the application shutdown hook releases these process-local cursors, closes retained directory iterators, and clears their expiry timers. A pending listing cannot retain a new cursor after disposal. Callers must restart listing without a cursor when continuation fails.
104
106
 
@@ -115,18 +117,18 @@ KV operations return `[error, value]`. `error.code` is one of the codes of the m
115
117
  `kv.lock(key, { ttl, wait })` gives a lock that one runner holds at a time across the processes that share a store. `run(fn)` takes the lock, calls `fn`, and releases the lock, also when `fn` throws:
116
118
 
117
119
  ```ts fragment
118
- const [error, result] = await kv.lock("cron:daily", { ttl: 60 }).run(() => sendDailyReport())
120
+ const [error, result] = await kv.lock("cron:daily", { ttl: "1m" }).run(() => sendDailyReport())
119
121
  if (error) throw error
120
122
  if (!result.acquired) return // Another runner holds the lock.
121
123
  ```
122
124
 
123
- `ttl` (seconds) is required, so a crashed runner never keeps the lock. `wait` (seconds) polls with backoff until the lock is free. Each lock writes a random owner token with `setIfAbsent()` and frees it with `deleteIfEquals()`, so a runner whose lock expired cannot delete the next runner's lock. `acquire()` returns a `release()` function for code that does not fit in one callback. KV does not renew a lock: when the work runs longer than `ttl`, another runner can take it.
125
+ `ttl` (a duration or seconds) is required, so a crashed runner never keeps the lock. `wait` (seconds) polls with backoff until the lock is free. Each lock writes a random owner token with `setIfAbsent()` and frees it with `deleteIfEquals()`, so a runner whose lock expired cannot delete the next runner's lock. `acquire()` returns a `release()` function for code that does not fit in one callback. KV does not renew a lock: when the work runs longer than `ttl`, another runner can take it.
124
126
 
125
127
  Only the drivers in `KVDriversWith<"deleteIfEquals">` (`redis`, `database`, `upstash`) support locks. Deno KV, Cloudflare KV, and `fs-lite` return `KV_UNSUPPORTED_OPERATION` without calling `fn`. App tests use `fs-lite`, so they return this code too.
126
128
 
127
129
  ## Read-only handles
128
130
 
129
- `kv.store(name, { mode: "read" })` returns a `ReadonlyKVStorage` handle with `get()`, `getMany()`, `has()`, `keys()`, and `list()`. Write methods are a type error and absent at runtime. `mode` defaults to `"write"`, and another value throws `KV_INVALID_STORE_MODE`.
131
+ `kv.store(name, { mode: "read" })` returns a `ReadonlyKVStorage` handle with `get()`, `getMany()`, `has()`, and `list()`. Write methods are a type error and absent at runtime. `mode` defaults to `"write"`, and another value throws `KV_INVALID_STORE_MODE`.
130
132
 
131
133
  ```ts
132
134
  import { kv } from "@vite-hub/kv"
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
+ import { A as writeCliFailure, C as askOnTerminal, E as readCliOptionValue, O as readViteHubDevTargetOption, T as parseCliPositiveInteger, n as callOperationFromCli, w as listSeedFiles } from "./operations-D2iI9oN4.js";
1
2
  import { t as isRecord } from "./object-Da1zyPCR.js";
2
- import { C as listSeedFiles, D as readViteHubDevTargetOption, S as askOnTerminal, T as readCliOptionValue, k as writeCliFailure, n as callOperationFromCli, w as parseCliPositiveInteger } from "./operations-B-WZ7P1h.js";
3
- import { n as kvErrorDiagnostics } from "./error-diagnostics-BxqvtEIb.js";
3
+ import { n as kvErrorDiagnostics } from "./error-diagnostics-C54QQEhN.js";
4
4
  import { t as kvDevMaximumListLimit } from "./results-p7nPCnaJ.js";
5
5
  import { readFile } from "node:fs/promises";
6
6
  import { extname, join, relative, resolve } from "node:path";
@@ -10,7 +10,8 @@ const usageError = (problem) => kvErrorDiagnostics.KV_CLI_USAGE({ problem });
10
10
  const kvDevTargetErrors = {
11
11
  invalidInlineTimeout: usageError,
12
12
  invalidTimeout: usageError,
13
- missingValue: usageError
13
+ missingValue: usageError,
14
+ unknownOption: usageError
14
15
  };
15
16
  const kvCommands = [
16
17
  {
@@ -1,9 +1,9 @@
1
1
  import { t as invariant } from "./invariant-DolT9EEx.js";
2
- import { n as kvErrorDiagnostics } from "./error-diagnostics-BxqvtEIb.js";
2
+ import { n as kvErrorDiagnostics } from "./error-diagnostics-C54QQEhN.js";
3
3
  import { t as getActiveCloudflareBinding } from "./cloudflare-env-lOtHHsgP.js";
4
- import { n as normalizeKVListPrefix, t as createKVStorage } from "./create-storage-BGsrQKw3.js";
4
+ import { n as normalizeKVListPrefix, t as createKVStorage } from "./create-storage-BORQm2a8.js";
5
5
  import { i as setItemsOneByOne, t as chunks } from "./batch--v0ri69O.js";
6
- import { n as recordCursor, t as createCursorHistory } from "./cursor-history-BqIQePNP.js";
6
+ import { n as recordCursor, t as createCursorHistory } from "./cursor-history-DRHh5bO5.js";
7
7
  import createDriver from "unstorage/drivers/cloudflare-kv-binding";
8
8
  //#region src/runtime/cloudflare-kv-limits.ts
9
9
  const cloudflareKVLimits = {
@@ -156,7 +156,7 @@ function createCloudflareDriver(options) {
156
156
  try {
157
157
  if (continuation.providerCursor) listOptions.cursor = continuation.providerCursor;
158
158
  const cursors = continuation.history;
159
- const page = await driver.getInstance().list(listOptions);
159
+ const page = await (await driver.getInstance()).list(listOptions);
160
160
  if (!isCloudflareKVListPage(page)) throw kvErrorDiagnostics.KV_PROVIDER_INVALID_RESPONSE({ problem: "Cloudflare KV list returned an invalid page." });
161
161
  const result = { keys: page.keys.map((key) => key.name) };
162
162
  if (!page.list_complete) {
@@ -172,6 +172,20 @@ function createCloudflareDriver(options) {
172
172
  throw error;
173
173
  }
174
174
  };
175
+ driver.clear = async (prefix = "") => {
176
+ const keys = [];
177
+ let cursor;
178
+ do {
179
+ const page = await driver.listKeys({
180
+ cursor,
181
+ limit: 1e3,
182
+ prefix
183
+ });
184
+ keys.push(...page.keys);
185
+ cursor = page.cursor;
186
+ } while (cursor);
187
+ for (const key of keys) await driver.removeItem(key, {});
188
+ };
175
189
  return driver;
176
190
  }
177
191
  function createCloudflareKVStorage(options) {
@@ -1,7 +1,7 @@
1
1
  import { t as getActiveCloudflareBinding } from "./cloudflare-env-lOtHHsgP.js";
2
2
  import { i as setItemsOneByOne, n as getItemsOneByOne } from "./batch--v0ri69O.js";
3
- import { a as validateCloudflareKVBatch, i as installCloudflareKVLimits, r as assertCloudflareKVWrite, t as createCloudflareDriver } from "./cloudflare-kv-BIEUFzRT.js";
4
- import { t as createFsLiteKVDriver } from "./fs-lite-BLZId9_P.js";
3
+ import { a as validateCloudflareKVBatch, i as installCloudflareKVLimits, r as assertCloudflareKVWrite, t as createCloudflareDriver } from "./cloudflare-kv-C3NO4C21.js";
4
+ import { t as createFsLiteKVDriver } from "./fs-lite-BaklCLuV.js";
5
5
  //#region src/runtime/cloudflare-kv-local.ts
6
6
  /**
7
7
  * Seconds until the key expires, as the binding computes them from unstorage's options: `ttl` becomes an
@@ -1,5 +1,5 @@
1
1
  import { t as isRecord } from "./object-Da1zyPCR.js";
2
- import { n as kvErrorDiagnostics } from "./error-diagnostics-BxqvtEIb.js";
2
+ import { n as kvErrorDiagnostics } from "./error-diagnostics-C54QQEhN.js";
3
3
  import { o as normalizeKey } from "./utils2-FozcTsmb.js";
4
4
  import { defu } from "defu";
5
5
  //#region ../internal/src/env.ts
@@ -68,14 +68,13 @@ function readRemote(config, store) {
68
68
  if (remote === void 0 || typeof remote === "boolean") return remote;
69
69
  throw kvErrorDiagnostics.KV_INVALID_REMOTE({ store });
70
70
  }
71
- /** Applies `vite dev` mode: hosted stores are marked remote, and a Cloudflare store gets its local fallback. */
72
- function resolveDevStore(store, remote) {
73
- if (store.driver === "upstash") return {
71
+ function resolveStoreMode(store, remote, input) {
72
+ if (input.dev && store.driver === "upstash") return {
74
73
  ...store,
75
74
  remote: true
76
75
  };
77
- if (store.driver !== "cloudflare") return store;
78
- return remote ? {
76
+ if (store.driver !== "cloudflare" || !(input.dev || input.prerender)) return store;
77
+ return input.dev && remote ? {
79
78
  ...store,
80
79
  remote: true
81
80
  } : {
@@ -102,7 +101,7 @@ function resolveFsLiteStore(config = {}, name = "default") {
102
101
  function redisStorePrefix(name) {
103
102
  return `vitehub:kv:${name.replace(/[%:/\\?]/g, (character) => encodeURIComponent(character)) || "%"}`;
104
103
  }
105
- /** An empty prefix would let `kv.clear()` and `kv.keys()` reach every key of the Redis or Upstash database. */
104
+ /** An empty prefix would let `kv.clear()` and `kv.list()` reach every key of the Redis or Upstash database. */
106
105
  function resolveStoreBase(base, name) {
107
106
  return normalizeKey(trimmed(base)) || redisStorePrefix(name);
108
107
  }
@@ -137,16 +136,15 @@ function resolveDenoStore(config = {}) {
137
136
  path
138
137
  } : { driver: "deno-kv" };
139
138
  }
140
- function resolveExplicitStore(store, env, name, dev) {
139
+ function resolveExplicitStore(store, env, name, input) {
141
140
  const remote = readRemote(store, name);
142
141
  const { driver } = store;
143
- if (dev && (remote === true && (driver === "fs-lite" || driver === "deno-kv") || remote === false && driver === "upstash")) throw kvErrorDiagnostics.KV_REMOTE_CONFLICT({
142
+ if (input.dev && (remote === true && (driver === "fs-lite" || driver === "deno-kv") || remote === false && driver === "upstash")) throw kvErrorDiagnostics.KV_REMOTE_CONFLICT({
144
143
  driver,
145
144
  remote,
146
145
  store: name
147
146
  });
148
- const resolved = resolveStoreDriver(store, env, name);
149
- return dev ? resolveDevStore(resolved, remote) : resolved;
147
+ return resolveStoreMode(resolveStoreDriver(store, env, name), remote, input);
150
148
  }
151
149
  function resolveStoreDriver(store, env, name) {
152
150
  switch (store.driver) {
@@ -189,15 +187,15 @@ function normalizeKVOptions(options, input = {}) {
189
187
  const stores = hasOwnStores ? Reflect.get(options, "stores", options) : void 0;
190
188
  if (hasOwnStores && !isRecord(stores)) throw kvErrorDiagnostics.KV_INVALID_CONFIG({ path: "kv.stores" });
191
189
  if (hasStoresConfig(options, stores)) {
192
- const resolvedStores = Object.fromEntries(Object.entries(stores).map(([name, store]) => [name, resolveExplicitStore(store, env, name, input.dev)]));
190
+ const resolvedStores = Object.fromEntries(Object.entries(stores).map(([name, store]) => [name, resolveExplicitStore(store, env, name, input)]));
193
191
  const defaultStore = resolvedStores.default;
194
192
  if (!defaultStore) throw kvErrorDiagnostics.KV_MISSING_DEFAULT_STORE();
195
193
  return createResolvedConfig(defaultStore, resolvedStores);
196
194
  }
197
- if (explicit?.driver) return createResolvedConfig(resolveExplicitStore(explicit, env, "default", input.dev));
195
+ if (explicit?.driver) return createResolvedConfig(resolveExplicitStore(explicit, env, "default", input));
198
196
  const remote = explicit ? readRemote(explicit, "default") : void 0;
199
- const inferred = (store) => createResolvedConfig(input.dev ? resolveDevStore(store, remote) : store);
200
- const hosted = !input.dev || remote === true;
197
+ const inferred = (store) => createResolvedConfig(resolveStoreMode(store, remote, input));
198
+ const hosted = !input.prerender && (!input.dev || remote === true);
201
199
  if (hosting.includes("deno")) {
202
200
  if (input.dev && remote === true) throw kvErrorDiagnostics.KV_REMOTE_CONFLICT({
203
201
  driver: "deno-kv",
@@ -214,7 +212,7 @@ function normalizeKVOptions(options, input = {}) {
214
212
  remote,
215
213
  store: "default"
216
214
  });
217
- if (input.dev) return inferred(resolveFsLiteStore());
215
+ if (input.dev || input.prerender) return inferred(resolveFsLiteStore());
218
216
  if (input.postgresDatabase) return inferred({
219
217
  ...resolveDatabaseStore({}, "default"),
220
218
  inferred: true
@@ -231,20 +229,24 @@ function kvInferredStoreNotice(name, store) {
231
229
  if (store.driver === "fs-lite") return `[vitehub] KV store "${name}" uses fs-lite in ${store.base}, selected at build time. Other server processes cannot read its keys.`;
232
230
  }
233
231
  /**
234
- * The build warning for a Redis URL that KV does not use. Redis is never inferred, because a `REDIS_URL` often belongs to
232
+ * The build hint for a Redis URL that KV does not use. Redis is never inferred, because a `REDIS_URL` often belongs to
235
233
  * another service, such as BullMQ or sessions. A NuxtHub app that kept its keys in Redis must select it.
236
234
  */
237
- function kvRedisEnvWarning(options, input = {}) {
235
+ function kvRedisEnvHint(options, input = {}) {
238
236
  if (options === false || input.dev || options && ("stores" in options || options.driver)) return;
239
237
  const env = input.env || process.env;
240
238
  const name = readEnv(env, "REDIS_URL") ? redisUrlEnvName : readEnv(env, "KV_URL")?.startsWith("rediss://") ? "KV_URL" : void 0;
241
239
  if (!name) return;
242
- const fix = `To keep KV in that Redis, set \`kv: { driver: "redis"${name === "REDIS_URL" ? "" : `, url: "env:${name}"`} }\`. To keep this store, set its \`driver\`.`;
243
240
  const store = normalizeKVOptions(options, input)?.store;
244
- if (store?.driver === "upstash" && !hasUpstashEnv(env)) return `[vitehub] KV on Vercel uses Upstash, and the build has no \`KV_REST_API_URL\` and \`KV_REST_API_TOKEN\`, so KV fails at runtime. The build has \`${name}\`, and KV does not select Redis on its own. ${fix}`;
241
+ if (store?.driver === "upstash" && !hasUpstashEnv(env)) return kvErrorDiagnostics.KV_REDIS_URL_UNUSED({
242
+ name,
243
+ store: "upstash"
244
+ });
245
245
  const selected = store?.driver === "database" ? `the table vitehub_kv of the Database "${store.database}"` : store?.driver === "fs-lite" ? `fs-lite in ${store.base}` : void 0;
246
- if (!selected) return;
247
- return `[vitehub] The build has \`${name}\`, but KV does not select Redis on its own. The KV store "default" uses ${selected}. ${fix}`;
246
+ if (selected) return kvErrorDiagnostics.KV_REDIS_URL_UNUSED({
247
+ name,
248
+ store: selected
249
+ });
248
250
  }
249
251
  //#endregion
250
- export { upstashUrlEnvNames as a, upstashTokenEnvNames as i, kvRedisEnvWarning as n, resolveHostPreset as o, normalizeKVOptions as r, readEnv as s, kvInferredStoreNotice as t };
252
+ export { upstashUrlEnvNames as a, upstashTokenEnvNames as i, kvRedisEnvHint as n, resolveHostPreset as o, normalizeKVOptions as r, readEnv as s, kvInferredStoreNotice as t };
@@ -1,4 +1,4 @@
1
- import { n as kvErrorDiagnostics } from "./error-diagnostics-BxqvtEIb.js";
1
+ import { n as kvErrorDiagnostics } from "./error-diagnostics-C54QQEhN.js";
2
2
  import { a as normalizeBaseKey, i as joinKeys, n as filterKeyByDepth, o as normalizeKey, r as hasDotSegment, t as filterKeyByBase } from "./utils2-FozcTsmb.js";
3
3
  import { r as mapWithLimit } from "./batch--v0ri69O.js";
4
4
  //#region ../../node_modules/.pnpm/unstorage@2.0.0-beta.0/node_modules/unstorage/dist/_chunks/libs/destr.mjs
@@ -547,15 +547,15 @@ function isRawType(type) {
547
547
  return type === "bytes" || type === "blob" || type === "stream";
548
548
  }
549
549
  const removeBatchSize = 100;
550
- /** Gives single-store KV prefixes the same meaning for clear() and getKeys(), and adds the batch methods. */
550
+ /** Gives `clear(prefix)` the text-prefix meaning of `list({ prefix })`, and adds the batch methods. */
551
551
  function createKVStorage(driver) {
552
552
  const storage = createStorage({ driver });
553
553
  const clear = storage.clear;
554
554
  storage.clear = async (base, options = {}) => {
555
- const prefix = normalizeBaseKey(base);
556
- if (!prefix) return clear(base, options);
555
+ const prefix = normalizeKVListPrefix(base);
556
+ if (!prefix) return clear("", options);
557
557
  if (driver.clear) return driver.clear(prefix, options);
558
- const keys = await storage.getKeys(base, options);
558
+ const keys = (await storage.getKeys("", options)).filter((key) => key.startsWith(prefix));
559
559
  for (let offset = 0; offset < keys.length; offset += removeBatchSize) await Promise.all(keys.slice(offset, offset + removeBatchSize).map((key) => storage.removeItem(key, options)));
560
560
  };
561
561
  return Object.assign(storage, {
@@ -1,5 +1,5 @@
1
1
  import { t as invariant } from "./invariant-DolT9EEx.js";
2
- import { n as kvErrorDiagnostics } from "./error-diagnostics-BxqvtEIb.js";
2
+ import { n as kvErrorDiagnostics } from "./error-diagnostics-C54QQEhN.js";
3
3
  //#region src/runtime/cursor-history.ts
4
4
  const MAX_CURSOR_HISTORIES = 1024;
5
5
  const MAX_CURSORS_PER_HISTORY = 1024;
@@ -1,4 +1,4 @@
1
- import { n as kvErrorDiagnostics } from "./error-diagnostics-BxqvtEIb.js";
1
+ import { n as kvErrorDiagnostics } from "./error-diagnostics-C54QQEhN.js";
2
2
  import { t as chunks } from "./batch--v0ri69O.js";
3
3
  //#region src/runtime/database.ts
4
4
  /** The table that keeps the keys of every `database` store. Each store has its rows under its own `namespace`. */
@@ -1,6 +1,6 @@
1
1
  import { t as invariant } from "./invariant-DolT9EEx.js";
2
- import { n as kvErrorDiagnostics } from "./error-diagnostics-BxqvtEIb.js";
3
- import { n as recordCursor, t as createCursorHistory } from "./cursor-history-BqIQePNP.js";
2
+ import { n as kvErrorDiagnostics } from "./error-diagnostics-C54QQEhN.js";
3
+ import { n as recordCursor, t as createCursorHistory } from "./cursor-history-DRHh5bO5.js";
4
4
  //#region src/runtime/deno-kv.ts
5
5
  function getDenoRuntime() {
6
6
  return globalThis.Deno;
@@ -1,5 +1,5 @@
1
1
  import { i as TransactionOptions, t as Driver } from "./types-Bj3EQoRg.js";
2
- import { g as KVListPage, h as KVListOptions } from "./types-DEiKew_3.js";
2
+ import { T as KVPageOptions, _ as KVListPage } from "./types-Dv-OSXZC.js";
3
3
  //#region src/runtime/driver.d.ts
4
4
  type KVRuntimeDriver = Driver & Record<string, unknown> & {
5
5
  validateBatch?: (items: Parameters<NonNullable<Driver["setItems"]>>[0], removals: string[], options?: TransactionOptions) => void | Promise<void>;
@@ -7,7 +7,7 @@ type KVRuntimeDriver = Driver & Record<string, unknown> & {
7
7
  deleteIfEqualsItem?: (key: string, expected: string) => Promise<boolean>;
8
8
  getAndDeleteItem?: <T = unknown>(key: string) => Promise<T | null>;
9
9
  incrementItem?: (key: string, ttl: number) => Promise<number>;
10
- listKeys: (options: KVListOptions) => Promise<KVListPage>;
10
+ listKeys: (options: KVPageOptions) => Promise<KVListPage>;
11
11
  /** Writes the serialized value only when the key is missing. Resolves `true` when this call wrote it. */
12
12
  setIfAbsentItem?: (key: string, value: string, ttl?: number) => Promise<boolean>;
13
13
  };
@@ -9,6 +9,10 @@ const cursorProblems = {
9
9
  const kvErrorDiagnostics = /*#__PURE__*/ defineErrors({
10
10
  docs: "https://vitehub.dev/docs/kv/diagnostics",
11
11
  codes: {
12
+ KV_INVALID_CLEAR_OPTIONS: {
13
+ why: "`kv.clear()` needs an options object with an optional string `prefix`, or no argument. It rejects a legacy string argument before deleting any keys.",
14
+ fix: "Use `kv.clear({ prefix: 'drafts:' })` to clear the keys below `drafts`, or `kv.clear()` to clear the whole store."
15
+ },
12
16
  KV_INVALID_CURSOR: {
13
17
  why: ({ problem }) => cursorProblems[problem],
14
18
  fix: "Pass the `cursor` of the previous page once, to the same store. If it fails, start again without `cursor`."
@@ -22,8 +26,8 @@ const kvErrorDiagnostics = /*#__PURE__*/ defineErrors({
22
26
  fix: "Pass `{ ttl: seconds }` to expire the value, or no options to keep it. KV has no Cloudflare `expirationTtl`, `expiration`, or `metadata` option."
23
27
  },
24
28
  KV_INVALID_TTL: {
25
- why: "`ttl` must be a positive number of seconds within the safe integer range.",
26
- fix: "Pass the TTL in seconds, for example `kv.set('session', value, { ttl: 60 })`."
29
+ why: "`ttl` must be a positive number of seconds within the safe integer range, or a duration such as `\"1h\"`.",
30
+ fix: "Pass the TTL in seconds or as a duration, for example `kv.set('session', value, { ttl: 60 })` or `kv.set('session', value, { ttl: \"1h\" })`."
27
31
  },
28
32
  KV_INVALID_VALUE: {
29
33
  why: ({ operation, problem }) => problem === "missing" ? `kv.${operation}() needs a value. Use kv.delete() to remove a key.` : "KV cannot serialize this value.",
@@ -131,6 +135,10 @@ const kvErrorDiagnostics = /*#__PURE__*/ defineErrors({
131
135
  KV_PROVISION_FAILED: {
132
136
  why: ({ problem }) => `Cloudflare KV provisioning failed. ${problem}`,
133
137
  fix: "Run `vitehub provision run --host cloudflare --dry-run` and check the Cloudflare token permissions."
138
+ },
139
+ KV_REDIS_URL_UNUSED: {
140
+ why: ({ name, store }) => store === "upstash" ? `KV on Vercel uses Upstash, and the build has no \`KV_REST_API_URL\` and \`KV_REST_API_TOKEN\`, so KV fails at runtime. The build has \`${name}\`, and KV does not select Redis on its own.` : `The build has \`${name}\`, but KV does not select Redis on its own. The KV store "default" uses ${store}.`,
141
+ fix: ({ name }) => `To keep KV in that Redis, set \`kv: { driver: "redis"${name === "REDIS_URL" ? "" : `, url: "env:${name}"`} }\`. To keep this store, set its \`driver\`.`
134
142
  }
135
143
  }
136
144
  });
@@ -1,4 +1,4 @@
1
- import { n as kvErrorDiagnostics, t as kvConfigErrorCodes } from "./error-diagnostics-BxqvtEIb.js";
1
+ import { n as kvErrorDiagnostics, t as kvConfigErrorCodes } from "./error-diagnostics-C54QQEhN.js";
2
2
  import { isRuntimeDiagnostic, toResultError } from "@vite-hub/runtime";
3
3
  //#region src/store-mode.ts
4
4
  /**
@@ -13,12 +13,15 @@ function kvStoreWithMode(storage, options) {
13
13
  get: storage.get,
14
14
  getMany: storage.getMany,
15
15
  has: storage.has,
16
- keys: storage.keys,
17
16
  list: storage.list
18
17
  };
19
18
  }
20
19
  //#endregion
21
20
  //#region src/errors.ts
21
+ function kvClearOptionsError(options) {
22
+ if (options === void 0) return;
23
+ if (typeof options !== "object" || options === null || Array.isArray(options) || Object.keys(options).some((key) => key !== "prefix") || "prefix" in options && options.prefix !== void 0 && typeof options.prefix !== "string") return kvErrorDiagnostics.KV_INVALID_CLEAR_OPTIONS();
24
+ }
22
25
  function hasCode(error, codes) {
23
26
  return codes.some((code) => code === error.code);
24
27
  }
@@ -52,9 +55,34 @@ function kvUnsupportedOperationError(operation, store) {
52
55
  function kvInvalidLimitError() {
53
56
  return kvErrorDiagnostics.KV_INVALID_LIMIT();
54
57
  }
58
+ /** True when `list()` got a `limit` that is not a positive integer. Without a `limit`, `list()` reads every key. */
59
+ function kvListLimitInvalid(options) {
60
+ return options.limit !== void 0 && (!Number.isInteger(options.limit) || options.limit <= 0);
61
+ }
62
+ /** The page size when `list()` reads every key. Every driver accepts it. */
63
+ const listAllPageSize = 1e3;
64
+ /** One page with `limit`. Without it, every key from `cursor` on, in one page without a cursor. */
65
+ async function listKVKeys(listKeys, options) {
66
+ if (options.limit !== void 0) return listKeys({
67
+ ...options,
68
+ limit: options.limit
69
+ });
70
+ const keys = [];
71
+ let cursor = options.cursor;
72
+ do {
73
+ const page = await listKeys({
74
+ cursor,
75
+ limit: listAllPageSize,
76
+ prefix: options.prefix
77
+ });
78
+ keys.push(...page.keys);
79
+ cursor = page.cursor;
80
+ } while (cursor);
81
+ return { keys };
82
+ }
55
83
  /** Codes that a Cloudflare KV store returns for a key above the host limit. */
56
84
  const kvKeyLimitCodes = ["KV_KEY_TOO_LONG"];
57
85
  /** Codes that a Cloudflare KV store returns for a write above the host limits. */
58
86
  const kvWriteLimitCodes = ["KV_KEY_TOO_LONG", "KV_VALUE_TOO_LARGE"];
59
87
  //#endregion
60
- export { kvUnsupportedOperationError as a, kvStoreNotFoundError as i, kvKeyLimitCodes as n, kvWriteLimitCodes as o, kvResult as r, kvStoreWithMode as s, kvInvalidLimitError as t };
88
+ export { kvResult as a, kvWriteLimitCodes as c, kvListLimitInvalid as i, listKVKeys as l, kvInvalidLimitError as n, kvStoreNotFoundError as o, kvKeyLimitCodes as r, kvUnsupportedOperationError as s, kvClearOptionsError as t, kvStoreWithMode as u };
package/dist/errors.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { O as KVStoreOptions, S as KVOperation, T as KVStorage, d as KVErrorCode, k as ReadonlyKVStorage } from "./types-DEiKew_3.js";
1
+ import { A as KVStoreOptions, C as KVOperation, D as KVStorage, T as KVPageOptions, _ as KVListPage, f as KVErrorCode, g as KVListOptions, j as ReadonlyKVStorage } from "./types-Dv-OSXZC.js";
2
2
  import { Result, ResultError } from "@vite-hub/runtime";
3
3
  //#region src/store-mode.d.ts
4
4
  /**
@@ -8,6 +8,7 @@ import { Result, ResultError } from "@vite-hub/runtime";
8
8
  export declare function kvStoreWithMode(storage: KVStorage, options: KVStoreOptions | undefined): KVStorage | ReadonlyKVStorage;
9
9
  //#endregion
10
10
  //#region src/errors.d.ts
11
+ export declare function kvClearOptionsError(options: unknown): ResultError<"KV_INVALID_CLEAR_OPTIONS"> | undefined;
11
12
  /**
12
13
  * Runs one KV operation and returns `[error, data]`.
13
14
  * A KV error with one of `codes` is returned with Runtime's public serializer. A config error is thrown.
@@ -17,6 +18,10 @@ export declare function kvResult<TData, TCode extends KVErrorCode = never>(opera
17
18
  export declare function kvStoreNotFoundError(store: string): ResultError<"KV_STORE_NOT_FOUND">;
18
19
  export declare function kvUnsupportedOperationError(operation: KVOperation, store: string): ResultError<"KV_UNSUPPORTED_OPERATION">;
19
20
  export declare function kvInvalidLimitError(): ResultError<"KV_INVALID_LIMIT">;
21
+ /** True when `list()` got a `limit` that is not a positive integer. Without a `limit`, `list()` reads every key. */
22
+ export declare function kvListLimitInvalid(options: KVListOptions): boolean;
23
+ /** One page with `limit`. Without it, every key from `cursor` on, in one page without a cursor. */
24
+ export declare function listKVKeys(listKeys: (options: KVPageOptions) => Promise<KVListPage>, options: KVListOptions): Promise<KVListPage>;
20
25
  /** Codes that a Cloudflare KV store returns for a key above the host limit. */
21
26
  export declare const kvKeyLimitCodes: readonly ["KV_KEY_TOO_LONG"];
22
27
  /** Codes that a Cloudflare KV store returns for a write above the host limits. */
package/dist/errors.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as kvUnsupportedOperationError, i as kvStoreNotFoundError, n as kvKeyLimitCodes, o as kvWriteLimitCodes, r as kvResult, s as kvStoreWithMode, t as kvInvalidLimitError } from "./errors-DbwufFZp.js";
2
- export { kvInvalidLimitError, kvKeyLimitCodes, kvResult, kvStoreNotFoundError, kvStoreWithMode, kvUnsupportedOperationError, kvWriteLimitCodes };
1
+ import { a as kvResult, c as kvWriteLimitCodes, i as kvListLimitInvalid, l as listKVKeys, n as kvInvalidLimitError, o as kvStoreNotFoundError, r as kvKeyLimitCodes, s as kvUnsupportedOperationError, t as kvClearOptionsError, u as kvStoreWithMode } from "./errors-DzD6YNEH.js";
2
+ export { kvClearOptionsError, kvInvalidLimitError, kvKeyLimitCodes, kvListLimitInvalid, kvResult, kvStoreNotFoundError, kvStoreWithMode, kvUnsupportedOperationError, kvWriteLimitCodes, listKVKeys };
@@ -0,0 +1,2 @@
1
+ import { t as createFsLiteKVDriver } from "./fs-lite-BaklCLuV.js";
2
+ export { createFsLiteKVDriver as default };
@@ -1,4 +1,4 @@
1
- import { n as kvErrorDiagnostics } from "./error-diagnostics-BxqvtEIb.js";
1
+ import { n as kvErrorDiagnostics } from "./error-diagnostics-C54QQEhN.js";
2
2
  import { link, lstat, mkdir, mkdtemp, opendir, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
3
3
  import { basename, join, relative, resolve, sep } from "node:path";
4
4
  import createDriver from "unstorage/drivers/fs-lite";
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as RedisKVStoreConfig, C as KVOptions, D as KVStoreName, E as KVStoreConfig, F as ResolvedKVModuleOptions, I as ResolvedKVStoreConfig, L as ResolvedRedisKVStoreConfig, M as ResolvedDatabaseKVStoreConfig, N as ResolvedDenoKVStoreConfig, O as KVStoreOptions, P as ResolvedFsLiteKVStoreConfig, R as ResolvedUpstashKVStoreConfig, S as KVOperation, T as KVStorage, _ as KVLock, a as InferredKVStoreConfig, b as KVLockOptions, c as KVDriverAtomicOperations, d as KVErrorCode, f as KVGetOptions, g as KVListPage, h as KVListOptions, i as FsLiteKVStoreConfig, j as ResolvedCloudflareKVStoreConfig, k as ReadonlyKVStorage, l as KVDriversWith, m as KVGetTypeMap, n as DatabaseKVStoreConfig, o as KVAtomicOperation, p as KVGetType, r as DenoKVStoreConfig, s as KVDriver, t as CloudflareKVStoreConfig, u as KVEntry, v as KVLockAcquisition, w as KVSetOptions, x as KVLockRunResult, y as KVLockErrorCode, z as UpstashKVStoreConfig } from "./types-DEiKew_3.js";
1
+ import { A as KVStoreOptions, B as ResolvedUpstashKVStoreConfig, C as KVOperation, D as KVStorage, E as KVSetOptions, F as ResolvedDenoKVStoreConfig, I as ResolvedFsLiteKVStoreConfig, L as ResolvedKVModuleOptions, M as RedisKVStoreConfig, N as ResolvedCloudflareKVStoreConfig, O as KVStoreConfig, P as ResolvedDatabaseKVStoreConfig, R as ResolvedKVStoreConfig, S as KVLockRunResult, V as UpstashKVStoreConfig, _ as KVListPage, a as InferredKVStoreConfig, b as KVLockErrorCode, c as KVDriver, d as KVEntry, f as KVErrorCode, g as KVListOptions, h as KVGetTypeMap, i as FsLiteKVStoreConfig, j as ReadonlyKVStorage, k as KVStoreName, l as KVDriverAtomicOperations, m as KVGetType, n as DatabaseKVStoreConfig, o as KVAtomicOperation, p as KVGetOptions, r as DenoKVStoreConfig, s as KVClearOptions, t as CloudflareKVStoreConfig, u as KVDriversWith, v as KVLock, w as KVOptions, x as KVLockOptions, y as KVLockAcquisition, z as ResolvedRedisKVStoreConfig } from "./types-Dv-OSXZC.js";
2
2
  //#region src/runtime/storage.d.ts
3
3
  /** Releases every cached store. Call from the application's shutdown hook after stopping new work. */
4
4
  export declare function disposeKVStores(): Promise<void>;
@@ -9,4 +9,4 @@ export declare function disposeKVStores(): Promise<void>;
9
9
  export declare function getKVStoreDriver(name?: KVStoreName): Promise<KVDriver>;
10
10
  export declare const kv: KVStorage;
11
11
  //#endregion
12
- export type { CloudflareKVStoreConfig, DatabaseKVStoreConfig, DenoKVStoreConfig, FsLiteKVStoreConfig, InferredKVStoreConfig, KVAtomicOperation, KVDriver, KVDriverAtomicOperations, KVDriversWith, KVEntry, KVErrorCode, KVGetOptions, KVGetType, KVGetTypeMap, KVListOptions, KVListPage, KVLock, KVLockAcquisition, KVLockErrorCode, KVLockOptions, KVLockRunResult, KVOperation, KVOptions, KVSetOptions, KVStorage, KVStoreConfig, KVStoreOptions, ReadonlyKVStorage, RedisKVStoreConfig, ResolvedCloudflareKVStoreConfig, ResolvedDatabaseKVStoreConfig, ResolvedDenoKVStoreConfig, ResolvedFsLiteKVStoreConfig, ResolvedKVModuleOptions, ResolvedKVStoreConfig, ResolvedRedisKVStoreConfig, ResolvedUpstashKVStoreConfig, UpstashKVStoreConfig };
12
+ export type { CloudflareKVStoreConfig, DatabaseKVStoreConfig, DenoKVStoreConfig, FsLiteKVStoreConfig, InferredKVStoreConfig, KVAtomicOperation, KVClearOptions, KVDriver, KVDriverAtomicOperations, KVDriversWith, KVEntry, KVErrorCode, KVGetOptions, KVGetType, KVGetTypeMap, KVListOptions, KVListPage, KVLock, KVLockAcquisition, KVLockErrorCode, KVLockOptions, KVLockRunResult, KVOperation, KVOptions, KVSetOptions, KVStorage, KVStoreConfig, KVStoreOptions, ReadonlyKVStorage, RedisKVStoreConfig, ResolvedCloudflareKVStoreConfig, ResolvedDatabaseKVStoreConfig, ResolvedDenoKVStoreConfig, ResolvedFsLiteKVStoreConfig, ResolvedKVModuleOptions, ResolvedKVStoreConfig, ResolvedRedisKVStoreConfig, ResolvedUpstashKVStoreConfig, UpstashKVStoreConfig };