@vite-hub/kv 0.5.0 → 0.6.0
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 +2 -2
- package/dist/{batch--v0ri69O.js → batch-D-ib5_0P.js} +0 -1
- package/dist/{cli-CLomw9ml.d.ts → cli-BvVInMht.d.ts} +0 -6
- package/dist/cli.d.ts +2 -4
- package/dist/cli.js +5 -6
- package/dist/{cloudflare-env-Dl349h_9.js → cloudflare-env-Cpy3Bqdn.js} +3 -5
- package/dist/{cloudflare-env-lookup-Bs0VDpU5.js → cloudflare-env-lookup-Dgq5n1Aq.js} +1 -2
- package/dist/{cloudflare-kv-DQJhmGof.js → cloudflare-kv-Cp8HPUlJ.js} +8 -10
- package/dist/{cloudflare-kv-local-COjgHweC.js → cloudflare-kv-local-COoOI34K.js} +5 -6
- package/dist/{config-pfyPiPrI.js → config-_1oBDv2R.js} +7 -11
- package/dist/{create-storage-DQ1BbFqH.js → create-storage-DbWVAY9l.js} +9 -15
- package/dist/{cursor-history-CAT4mpP1.js → cursor-history-CMcEEnTO.js} +3 -4
- package/dist/{runtime/database.js → database-4iAg2GoV.js} +25 -52
- package/dist/{deno-kv-Cf0ZveeN.js → deno-kv-CatE7zSS.js} +4 -5
- package/dist/{dev-peer-CHafxbtj.js → dev-peer-D0vOxmrD.js} +1 -2
- package/dist/driver-BruahGvT.d.ts +13 -0
- package/dist/durability.d.ts +1 -3
- package/dist/durability.js +1 -2
- package/dist/{error-diagnostics-C4VTHInS.js → error-diagnostics-CuVl1nvE.js} +3 -4
- package/dist/{errors-BpiM-Vmh.js → errors-CJoAP4Bu.js} +4 -7
- package/dist/errors.d.ts +2 -6
- package/dist/errors.js +1 -2
- package/dist/fs-lite-DwbPkc-C.js +1 -0
- package/dist/{fs-lite-BTcBUP6B.js → fs-lite-DzTTR6R3.js} +3 -5
- package/dist/index.d.ts +1 -3
- package/dist/index.js +17 -21
- package/dist/{inspect-BIKQsqX4.js → inspect-BWMcVWD8.js} +2 -4
- package/dist/{invariant-DolT9EEx.js → invariant-Dj2R1eMr.js} +1 -2
- package/dist/{object-Da1zyPCR.js → object-CAK6UYR5.js} +1 -2
- package/dist/{operation-definition-CI2PJGqu.d.ts → operation-definition-CqZkx1Rm.d.ts} +0 -4
- package/dist/{operations-nAaONxzh.js → operations-BkVt17cd.js} +24 -25
- package/dist/{operations-CqKs7Ykc.js → operations-DSOTGwST.js} +7 -10
- package/dist/operations.d.ts +2 -8
- package/dist/operations.js +8 -12
- package/dist/{out-BbXG-yVX.js → out-By90R-Bo.js} +3345 -2394
- package/dist/{redis-shared-1M0IaguQ.js → redis-shared-CR3ANc_N.js} +2 -3
- package/dist/{request-log-Dj9Vw7qG.js → request-log-DllKQXj7.js} +1 -2
- package/dist/{results-D6jfPtCk.js → results-emgN7uDS.js} +1 -2
- package/dist/{rolldown-runtime-CMFfr-1z.js → rolldown-runtime-DegdyBIC.js} +2 -3
- package/dist/runtime/cloudflare-kv.d.ts +1 -3
- package/dist/runtime/cloudflare-kv.js +1 -2
- package/dist/runtime/cloudflare-request-env.d.ts +1 -3
- package/dist/runtime/cloudflare-request-env.js +2 -3
- package/dist/runtime/nitro-plugin.d.ts +1 -2
- package/dist/runtime/nitro-plugin.js +3 -4
- package/dist/runtime/redis-driver.d.ts +3 -5
- package/dist/runtime/redis-driver.js +6 -7
- package/dist/runtime/unstorage-driver.d.ts +2 -4
- package/dist/runtime/unstorage-driver.js +2 -3
- package/dist/runtime/upstash-driver.d.ts +3 -5
- package/dist/runtime/upstash-driver.js +6 -7
- package/dist/{types-Bj3EQoRg.d.ts → types-BUb0FcjM.d.ts} +0 -2
- package/dist/{types-Cp6IBhSN.d.ts → types-CPDL9enF.d.ts} +2 -4
- package/dist/{upstash-5sTbIR35.js → upstash-DeM3_U5H.js} +3 -4
- package/dist/{utils2-FozcTsmb.js → utils2-By8eee1x.js} +1 -2
- package/dist/vite.d.ts +3 -17
- package/dist/vite.js +1444 -923
- package/package.json +10 -15
- package/dist/driver-Du6Eh9p2.d.ts +0 -47
- package/dist/fs-lite-C8yXCVDM.js +0 -2
- package/dist/runtime/database.d.ts +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vite-hub/kv",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Vite-first key-value storage primitives and integration for ViteHub.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -46,11 +46,6 @@
|
|
|
46
46
|
"import": "./dist/durability.js",
|
|
47
47
|
"default": "./dist/durability.js"
|
|
48
48
|
},
|
|
49
|
-
"./runtime/database": {
|
|
50
|
-
"types": "./dist/runtime/database.d.ts",
|
|
51
|
-
"import": "./dist/runtime/database.js",
|
|
52
|
-
"default": "./dist/runtime/database.js"
|
|
53
|
-
},
|
|
54
49
|
"./runtime/redis-driver": {
|
|
55
50
|
"types": "./dist/runtime/redis-driver.d.ts",
|
|
56
51
|
"import": "./dist/runtime/redis-driver.js",
|
|
@@ -75,33 +70,33 @@
|
|
|
75
70
|
},
|
|
76
71
|
"dependencies": {
|
|
77
72
|
"@valibot/to-json-schema": "^1.8.0",
|
|
78
|
-
"@vite-hub/runtime": "0.
|
|
73
|
+
"@vite-hub/runtime": "0.6.0",
|
|
79
74
|
"birpc": "^4.2.0",
|
|
80
75
|
"defu": "^6.1.7",
|
|
81
76
|
"destr": "^2.0.5",
|
|
82
|
-
"ioredis": "^
|
|
77
|
+
"ioredis": "^6.1.0",
|
|
83
78
|
"nostics": "1.4.0",
|
|
84
79
|
"proper-lockfile": "4.1.2",
|
|
85
80
|
"unstorage": "2.0.0-beta.0",
|
|
86
81
|
"valibot": "^1.5.0"
|
|
87
82
|
},
|
|
88
83
|
"devDependencies": {
|
|
89
|
-
"@types/node": "^24.19.
|
|
84
|
+
"@types/node": "^24.19.2",
|
|
90
85
|
"@libsql/client": "^0.18.0",
|
|
91
|
-
"@vite-hub/database": "0.
|
|
86
|
+
"@vite-hub/database": "0.6.0",
|
|
92
87
|
"@types/proper-lockfile": "4.1.4",
|
|
93
88
|
"@vite-hub/internal": "0.0.1",
|
|
94
89
|
"ofetch": "^1.5.1",
|
|
95
90
|
"postgres": "^3.4.9",
|
|
96
91
|
"publint": "^0.3.25",
|
|
97
92
|
"typescript": "^6.0.3",
|
|
98
|
-
"vite": "^8.
|
|
99
|
-
"vite-plus": "^
|
|
100
|
-
"vitest": "
|
|
93
|
+
"vite": "^8.3.8",
|
|
94
|
+
"vite-plus": "^1.7.0",
|
|
95
|
+
"vitest": "5.1.0"
|
|
101
96
|
},
|
|
102
97
|
"peerDependencies": {
|
|
103
|
-
"@upstash/redis": "^1.
|
|
104
|
-
"@vite-hub/database": "0.
|
|
98
|
+
"@upstash/redis": "^1.41.0",
|
|
99
|
+
"@vite-hub/database": "0.6.0",
|
|
105
100
|
"vite": ">=8.0.0"
|
|
106
101
|
},
|
|
107
102
|
"peerDependenciesMeta": {
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { i as TransactionOptions, t as Driver } from "./types-Bj3EQoRg.js";
|
|
2
|
-
import { P as ResolvedDatabaseKVStoreConfig, T as KVPageOptions, _ as KVListPage } from "./types-Cp6IBhSN.js";
|
|
3
|
-
//#region src/runtime/database.d.ts
|
|
4
|
-
/** The table that keeps the keys of every `database` store. Each store has its rows under its own `namespace`. */
|
|
5
|
-
declare const kvTable = "vitehub_kv";
|
|
6
|
-
type KVSqlParam = string | number | null;
|
|
7
|
-
/**
|
|
8
|
-
* Runs one statement and resolves its rows as objects keyed by column name. `postgresql` SQL uses `$1`, `$2`, ... and
|
|
9
|
-
* `sqlite` SQL uses `?`.
|
|
10
|
-
*/
|
|
11
|
-
interface KVSqlClient {
|
|
12
|
-
dialect: "postgresql" | "sqlite";
|
|
13
|
-
/** The most values that one statement may bind, such as 100 on Cloudflare D1. */
|
|
14
|
-
maxParameters?: number;
|
|
15
|
-
query(sql: string, params: KVSqlParam[]): Promise<readonly Record<string, unknown>[]>;
|
|
16
|
-
}
|
|
17
|
-
/** The databases of the app, as `@vite-hub/database/runtime/registry` exports them. */
|
|
18
|
-
type KVDatabases = Record<string, {
|
|
19
|
-
db: object;
|
|
20
|
-
} | undefined>;
|
|
21
|
-
/**
|
|
22
|
-
* A SQL client over the Drizzle database of the app: postgres.js, libSQL, primary Cloudflare D1, or D1 over HTTP. It resolves
|
|
23
|
-
* the client on each query because the Database connection can belong to the request.
|
|
24
|
-
*/
|
|
25
|
-
declare function kvSqlClientFromDatabase(db: object, database: string): KVSqlClient;
|
|
26
|
-
type DatabaseKVDriver = KVRuntimeDriver & Required<Pick<KVRuntimeDriver, "getItems">>;
|
|
27
|
-
/**
|
|
28
|
-
* KV in a table of the app's Database. Each atomic operation is one statement, so two servers that write one key at
|
|
29
|
-
* the same time get one winner. Expiry uses the clock of the Database. Works on Postgres and on SQLite 3.35 or later,
|
|
30
|
-
* such as libSQL and Cloudflare D1. `table` defaults to `vitehub_kv`. A caller that passes another table keeps its rows
|
|
31
|
-
* out of reach of every KV store.
|
|
32
|
-
*/
|
|
33
|
-
declare function createDatabaseKVDriver(options: ResolvedDatabaseKVStoreConfig, connect: () => Promise<KVSqlClient>, table?: string): DatabaseKVDriver;
|
|
34
|
-
//#endregion
|
|
35
|
-
//#region src/runtime/driver.d.ts
|
|
36
|
-
type KVRuntimeDriver = Driver & Record<string, unknown> & {
|
|
37
|
-
validateBatch?: (items: Parameters<NonNullable<Driver["setItems"]>>[0], removals: string[], options?: TransactionOptions) => void | Promise<void>;
|
|
38
|
-
/** Deletes the key when it holds the serialized `expected` value. Resolves `true` when this call deleted it. */
|
|
39
|
-
deleteIfEqualsItem?: (key: string, expected: string) => Promise<boolean>;
|
|
40
|
-
getAndDeleteItem?: <T = unknown>(key: string) => Promise<T | null>;
|
|
41
|
-
incrementItem?: (key: string, ttl: number) => Promise<number>;
|
|
42
|
-
listKeys: (options: KVPageOptions) => Promise<KVListPage>;
|
|
43
|
-
/** Writes the serialized value only when the key is missing. Resolves `true` when this call wrote it. */
|
|
44
|
-
setIfAbsentItem?: (key: string, value: string, ttl?: number) => Promise<boolean>;
|
|
45
|
-
};
|
|
46
|
-
//#endregion
|
|
47
|
-
export { createDatabaseKVDriver as a, KVSqlParam as i, KVDatabases as n, kvSqlClientFromDatabase as o, KVSqlClient as r, kvTable as s, KVRuntimeDriver as t };
|
package/dist/fs-lite-C8yXCVDM.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { a as createDatabaseKVDriver, i as KVSqlParam, n as KVDatabases, o as kvSqlClientFromDatabase, r as KVSqlClient, s as kvTable } from "../driver-Du6Eh9p2.js";
|
|
2
|
-
export { KVDatabases, KVSqlClient, KVSqlParam, createDatabaseKVDriver as default, kvSqlClientFromDatabase, kvTable };
|