@vite-hub/kv 0.5.0 → 0.5.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.
- package/README.md +1 -1
- 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-Bm6huR35.js} +2 -3
- package/dist/{cloudflare-env-lookup-Bs0VDpU5.js → cloudflare-env-lookup-Dgq5n1Aq.js} +1 -2
- package/dist/{cloudflare-kv-DQJhmGof.js → cloudflare-kv-K2MzfP6D.js} +8 -10
- package/dist/{cloudflare-kv-local-COjgHweC.js → cloudflare-kv-local-lov9LLhU.js} +5 -6
- package/dist/{config-pfyPiPrI.js → config-B8FRGmX_.js} +7 -11
- package/dist/{create-storage-DQ1BbFqH.js → create-storage-BMvkkYdM.js} +9 -15
- package/dist/{cursor-history-CAT4mpP1.js → cursor-history-C6oG12QO.js} +3 -4
- package/dist/{deno-kv-Cf0ZveeN.js → deno-kv-MnqlNH1e.js} +4 -5
- package/dist/{dev-peer-CHafxbtj.js → dev-peer-D0vOxmrD.js} +1 -2
- package/dist/{driver-Du6Eh9p2.d.ts → driver-bLMl-wMO.d.ts} +2 -6
- package/dist/durability.d.ts +1 -3
- package/dist/durability.js +1 -2
- package/dist/{error-diagnostics-C4VTHInS.js → error-diagnostics-DUIp6FhO.js} +1 -2
- package/dist/{errors-BpiM-Vmh.js → errors-IaVOqzAs.js} +4 -7
- package/dist/errors.d.ts +2 -6
- package/dist/errors.js +1 -2
- package/dist/fs-lite-DhXLUL-H.js +1 -0
- package/dist/{fs-lite-BTcBUP6B.js → fs-lite-fvNdBEr9.js} +3 -5
- package/dist/index.d.ts +1 -3
- package/dist/index.js +16 -20
- 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-CGAX5ASA.js} +15 -20
- package/dist/{operations-CqKs7Ykc.js → operations-FgS_sJ3M.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-DO7Ib1Sz.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/database.d.ts +1 -1
- package/dist/runtime/database.js +5 -6
- 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-C397WKyf.d.ts} +1 -3
- package/dist/{upstash-5sTbIR35.js → upstash-DQVo1zbz.js} +3 -4
- package/dist/{utils2-FozcTsmb.js → utils2-By8eee1x.js} +1 -2
- package/dist/vite.d.ts +3 -17
- package/dist/vite.js +1429 -913
- package/package.json +10 -10
- package/dist/fs-lite-C8yXCVDM.js +0 -2
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
pnpm add @vite-hub/kv
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
Add `@upstash/redis` when you use the Upstash driver. The `redis` driver uses `ioredis`, which KV installs.
|
|
18
|
+
Add `@upstash/redis` when you use the Upstash driver. The `redis` driver uses `ioredis`, which KV installs, and needs Redis 6 or later.
|
|
19
19
|
|
|
20
20
|
## Minimal API
|
|
21
21
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import "nostics";
|
|
2
|
-
//#region ../internal/src/host-credentials.d.ts
|
|
3
2
|
interface HostCliRunResult {
|
|
4
3
|
exitCode: number | null;
|
|
5
4
|
stdout: string;
|
|
@@ -11,8 +10,6 @@ type HostCliRun = (command: string, args: readonly string[], options: {
|
|
|
11
10
|
env: NodeJS.ProcessEnv;
|
|
12
11
|
signal?: AbortSignal;
|
|
13
12
|
}) => Promise<HostCliRunResult>;
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region ../internal/src/provision.d.ts
|
|
16
13
|
type ProvisionProvider = "cloudflare" | "vercel";
|
|
17
14
|
interface ProvisionLogger {
|
|
18
15
|
log: (message: string) => void;
|
|
@@ -64,8 +61,6 @@ interface ProvisionStep {
|
|
|
64
61
|
/** Describes the Provision State this step records. Runs without network access, also without credentials. */
|
|
65
62
|
recordedState?: (context: Pick<ProvisionContext, "env">) => ProvisionStateCategory[];
|
|
66
63
|
}
|
|
67
|
-
//#endregion
|
|
68
|
-
//#region ../internal/src/cli.d.ts
|
|
69
64
|
interface ViteHubCliStreams {
|
|
70
65
|
stderr: {
|
|
71
66
|
write: (chunk: string | Uint8Array, encoding?: BufferEncoding | StdoutWriteCallback, callback?: StdoutWriteCallback) => unknown;
|
|
@@ -160,5 +155,4 @@ interface ViteHubCliPluginMetadata {
|
|
|
160
155
|
cli?: ViteHubCliContributor | ViteHubCliContributorFactory;
|
|
161
156
|
}
|
|
162
157
|
type StdoutWriteCallback = (error?: Error | null) => void;
|
|
163
|
-
//#endregion
|
|
164
158
|
export { ViteHubCliStreams as i, ViteHubCliContributor as n, ViteHubCliPluginMetadata as r, ViteHubCliContext as t };
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { i as ViteHubCliStreams, n as ViteHubCliContributor, t as ViteHubCliContext } from "./cli-
|
|
2
|
-
//#region src/cli.d.ts
|
|
1
|
+
import { i as ViteHubCliStreams, n as ViteHubCliContributor, t as ViteHubCliContext } from "./cli-BvVInMht.js";
|
|
3
2
|
export type KVCliContext = Pick<ViteHubCliContext, "cwd" | "env" | "fetch" | "rootDir"> & ViteHubCliStreams;
|
|
4
3
|
export interface KVCliOptions {
|
|
5
4
|
/** Asks whether `delete` may delete a key. Defaults to a prompt on a terminal, and refuses without one. */
|
|
@@ -13,5 +12,4 @@ export interface KVCliOptions {
|
|
|
13
12
|
* `args[0]` is the command name, for example `list` or `set`.
|
|
14
13
|
*/
|
|
15
14
|
export declare function runKVCli(args: string[], context: KVCliContext, options?: KVCliOptions): Promise<number>;
|
|
16
|
-
export declare function createKVCliContributor(options?: KVCliOptions): ViteHubCliContributor;
|
|
17
|
-
//#endregion
|
|
15
|
+
export declare function createKVCliContributor(options?: KVCliOptions): ViteHubCliContributor;
|
package/dist/cli.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { A as readViteHubDevTargetOption, D as parseCliPositiveInteger, E as listSeedFiles, M as writeCliFailure, O as readCliOptionValue, T as askOnTerminal, n as callOperationFromCli } from "./operations-
|
|
2
|
-
import { t as isRecord } from "./object-
|
|
3
|
-
import { n as kvErrorDiagnostics } from "./error-diagnostics-
|
|
4
|
-
import { t as kvDevMaximumListLimit } from "./results-
|
|
1
|
+
import { A as readViteHubDevTargetOption, D as parseCliPositiveInteger, E as listSeedFiles, M as writeCliFailure, O as readCliOptionValue, T as askOnTerminal, n as callOperationFromCli } from "./operations-CGAX5ASA.js";
|
|
2
|
+
import { t as isRecord } from "./object-CAK6UYR5.js";
|
|
3
|
+
import { n as kvErrorDiagnostics } from "./error-diagnostics-DUIp6FhO.js";
|
|
4
|
+
import { t as kvDevMaximumListLimit } from "./results-emgN7uDS.js";
|
|
5
5
|
import { readFile } from "node:fs/promises";
|
|
6
6
|
import { extname, join, relative, resolve } from "node:path";
|
|
7
7
|
import * as v from "valibot";
|
|
8
|
-
|
|
8
|
+
// src/cli.ts
|
|
9
9
|
const usageError = (problem) => kvErrorDiagnostics.KV_CLI_USAGE({ problem });
|
|
10
10
|
const kvDevTargetErrors = {
|
|
11
11
|
invalidInlineTimeout: usageError,
|
|
@@ -477,5 +477,4 @@ function createKVCliContributor(options = {}) {
|
|
|
477
477
|
}]
|
|
478
478
|
};
|
|
479
479
|
}
|
|
480
|
-
//#endregion
|
|
481
480
|
export { createKVCliContributor, runKVCli };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as setInstalledCloudflareEnv, n as getActiveCloudflareEnv, r as getCloudflareEnv, t as activeEnvStorageKey } from "./cloudflare-env-lookup-
|
|
1
|
+
import { i as setInstalledCloudflareEnv, n as getActiveCloudflareEnv, r as getCloudflareEnv, t as activeEnvStorageKey } from "./cloudflare-env-lookup-Dgq5n1Aq.js";
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
|
-
|
|
3
|
+
// ../internal/src/runtime/cloudflare-env.ts
|
|
4
4
|
const d1PrimaryClient = Symbol.for("vitehub.database.d1-primary-client");
|
|
5
5
|
const runtimeGlobal = globalThis;
|
|
6
6
|
const activeEnvStorage = runtimeGlobal[activeEnvStorageKey] ||= new AsyncLocalStorage();
|
|
@@ -43,5 +43,4 @@ function installCloudflareRequestEnv(event, fallback) {
|
|
|
43
43
|
const env = getCloudflareEnv(event, { fallback: false }) ?? fallback;
|
|
44
44
|
if (env) setActiveCloudflareEnv(env);
|
|
45
45
|
}
|
|
46
|
-
//#endregion
|
|
47
46
|
export { getActiveCloudflareBinding as n, installCloudflareRequestEnv as r, d1PrimaryClient as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../internal/src/runtime/cloudflare-env-lookup.ts
|
|
2
2
|
/** The key of the AsyncLocalStorage store on `globalThis`. Every bundled copy of this module shares the store. */
|
|
3
3
|
const activeEnvStorageKey = Symbol.for("vitehub.cloudflare.env-storage");
|
|
4
4
|
let activeEnv;
|
|
@@ -38,5 +38,4 @@ function getCloudflareEnv(event, options = {}) {
|
|
|
38
38
|
for (const candidate of [ownValue(target, "env"), ...cloudflareOwners(target).map((owner) => ownValue(owner, "env"))]) if (candidate) return candidate;
|
|
39
39
|
return options.fallback === false ? void 0 : getActiveCloudflareEnv();
|
|
40
40
|
}
|
|
41
|
-
//#endregion
|
|
42
41
|
export { setInstalledCloudflareEnv as i, getActiveCloudflareEnv as n, getCloudflareEnv as r, activeEnvStorageKey as t };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { t as invariant } from "./invariant-
|
|
2
|
-
import { n as
|
|
3
|
-
import { n as
|
|
4
|
-
import { n as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { t as invariant } from "./invariant-Dj2R1eMr.js";
|
|
2
|
+
import { n as getActiveCloudflareBinding } from "./cloudflare-env-Bm6huR35.js";
|
|
3
|
+
import { n as normalizeKVListPrefix, t as createKVStorage } from "./create-storage-BMvkkYdM.js";
|
|
4
|
+
import { n as kvErrorDiagnostics } from "./error-diagnostics-DUIp6FhO.js";
|
|
5
|
+
import { n as recordCursor, t as createCursorHistory } from "./cursor-history-C6oG12QO.js";
|
|
6
|
+
import { i as setItemsOneByOne, t as chunks } from "./batch-D-ib5_0P.js";
|
|
7
7
|
import createDriver from "unstorage/drivers/cloudflare-kv-binding";
|
|
8
|
-
|
|
8
|
+
// src/runtime/cloudflare-kv-limits.ts
|
|
9
9
|
const cloudflareKVLimits = {
|
|
10
10
|
keyBytes: 512,
|
|
11
11
|
minExpirationTtl: 60,
|
|
@@ -62,8 +62,7 @@ function validateCloudflareKVBatch(items, removals) {
|
|
|
62
62
|
for (const key of removals) assertCloudflareKVKey(key);
|
|
63
63
|
for (const item of items) assertCloudflareKVWrite(item.key, item.value);
|
|
64
64
|
}
|
|
65
|
-
|
|
66
|
-
//#region src/runtime/cloudflare-kv.ts
|
|
65
|
+
// src/runtime/cloudflare-kv.ts
|
|
67
66
|
function isCloudflareKVString(value) {
|
|
68
67
|
return typeof value === "string";
|
|
69
68
|
}
|
|
@@ -195,5 +194,4 @@ function createCloudflareKVStorage(options) {
|
|
|
195
194
|
});
|
|
196
195
|
return storage;
|
|
197
196
|
}
|
|
198
|
-
//#endregion
|
|
199
197
|
export { validateCloudflareKVBatch as a, installCloudflareKVLimits as i, createCloudflareKVStorage as n, assertCloudflareKVWrite as r, createCloudflareDriver as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as getActiveCloudflareBinding } from "./cloudflare-env-
|
|
2
|
-
import { i as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { n as getActiveCloudflareBinding } from "./cloudflare-env-Bm6huR35.js";
|
|
2
|
+
import { a as validateCloudflareKVBatch, i as installCloudflareKVLimits, r as assertCloudflareKVWrite, t as createCloudflareDriver } from "./cloudflare-kv-K2MzfP6D.js";
|
|
3
|
+
import { t as createFsLiteKVDriver } from "./fs-lite-fvNdBEr9.js";
|
|
4
|
+
import { i as setItemsOneByOne, n as getItemsOneByOne } from "./batch-D-ib5_0P.js";
|
|
5
|
+
// src/runtime/cloudflare-kv-local.ts
|
|
6
6
|
function cloudflareExpirationSeconds(options) {
|
|
7
7
|
if (!options || typeof options !== "object") return;
|
|
8
8
|
const ttl = Reflect.get(options, "ttl");
|
|
@@ -63,5 +63,4 @@ function createCloudflareKVLocalDriver(store) {
|
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
|
-
//#endregion
|
|
67
66
|
export { createCloudflareKVLocalDriver as default };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { o as normalizeKey } from "./utils2-By8eee1x.js";
|
|
2
|
+
import { t as isRecord } from "./object-CAK6UYR5.js";
|
|
3
|
+
import { n as kvErrorDiagnostics } from "./error-diagnostics-DUIp6FhO.js";
|
|
4
4
|
import { defu } from "defu";
|
|
5
|
-
|
|
5
|
+
// ../internal/src/env.ts
|
|
6
6
|
function trimmed(value) {
|
|
7
7
|
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
8
8
|
}
|
|
@@ -12,8 +12,7 @@ function readEnv(env, ...names) {
|
|
|
12
12
|
if (value) return value;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
//#region ../internal/src/hosting.ts
|
|
15
|
+
// ../internal/src/hosting.ts
|
|
17
16
|
/**
|
|
18
17
|
* Returns the Nitro preset name that this build targets, as the developer wrote it.
|
|
19
18
|
* The order is `nitro.preset`, `hosting`, `NITRO_PRESET`, `SERVER_PRESET`, then `VITEHUB_HOST`.
|
|
@@ -35,8 +34,7 @@ function normalizeHosting(hosting) {
|
|
|
35
34
|
if (normalized === "cloudflare") return "cloudflare-module";
|
|
36
35
|
return normalized;
|
|
37
36
|
}
|
|
38
|
-
|
|
39
|
-
//#region src/integrations/upstash.ts
|
|
37
|
+
// src/integrations/upstash.ts
|
|
40
38
|
const maskedUpstashRuntimeValue = "********";
|
|
41
39
|
/** Vercel names first, then the names that the Upstash console and NuxtHub use. */
|
|
42
40
|
const upstashUrlEnvNames = ["KV_REST_API_URL", "UPSTASH_REDIS_REST_URL"];
|
|
@@ -55,8 +53,7 @@ function resolveUpstashStore(config, base) {
|
|
|
55
53
|
url: trimmed(config.url) ?? maskedUpstashRuntimeValue
|
|
56
54
|
};
|
|
57
55
|
}
|
|
58
|
-
|
|
59
|
-
//#region src/config.ts
|
|
56
|
+
// src/config.ts
|
|
60
57
|
/** The variable that a `redis` store reads at runtime when it sets no `url`. */
|
|
61
58
|
const redisUrlEnvName = "REDIS_URL";
|
|
62
59
|
/** Where a Cloudflare KV store keeps its keys in `vite dev` when the runtime has no binding. */
|
|
@@ -283,5 +280,4 @@ function kvRedisEnvHint(options, input = {}) {
|
|
|
283
280
|
store: selected
|
|
284
281
|
});
|
|
285
282
|
}
|
|
286
|
-
//#endregion
|
|
287
283
|
export { upstashUrlEnvNames as a, upstashTokenEnvNames as i, kvRedisEnvHint as n, resolveHostPreset as o, normalizeKVOptions as r, readEnv as s, kvInferredStoreNotice as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import {
|
|
3
|
-
import { r as mapWithLimit } from "./batch
|
|
4
|
-
|
|
1
|
+
import { a as normalizeBaseKey, i as joinKeys, n as filterKeyByDepth, o as normalizeKey, r as hasDotSegment, t as filterKeyByBase } from "./utils2-By8eee1x.js";
|
|
2
|
+
import { n as kvErrorDiagnostics } from "./error-diagnostics-DUIp6FhO.js";
|
|
3
|
+
import { r as mapWithLimit } from "./batch-D-ib5_0P.js";
|
|
4
|
+
// ../../node_modules/.pnpm/unstorage@2.0.0-beta.0/node_modules/unstorage/dist/_chunks/libs/destr.mjs
|
|
5
5
|
const suspectProtoRx = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/;
|
|
6
6
|
const suspectConstructorRx = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
|
|
7
7
|
const JsonSigRx = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;
|
|
@@ -43,8 +43,7 @@ function destr(value, options = {}) {
|
|
|
43
43
|
return value;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
//#region ../../node_modules/.pnpm/unstorage@2.0.0-beta.0/node_modules/unstorage/dist/drivers/memory.mjs
|
|
46
|
+
// ../../node_modules/.pnpm/unstorage@2.0.0-beta.0/node_modules/unstorage/dist/drivers/memory.mjs
|
|
48
47
|
const DRIVER_NAME = "memory";
|
|
49
48
|
const driver = () => {
|
|
50
49
|
const data = /* @__PURE__ */ new Map();
|
|
@@ -117,8 +116,7 @@ function _scheduleExpiry(data, timers, key, ttl) {
|
|
|
117
116
|
};
|
|
118
117
|
schedule();
|
|
119
118
|
}
|
|
120
|
-
|
|
121
|
-
//#region ../../node_modules/.pnpm/unstorage@2.0.0-beta.0/node_modules/unstorage/dist/_chunks/_utils.mjs
|
|
119
|
+
// ../../node_modules/.pnpm/unstorage@2.0.0-beta.0/node_modules/unstorage/dist/_chunks/_utils.mjs
|
|
122
120
|
function wrapToPromise(value) {
|
|
123
121
|
if (!value || typeof value.then !== "function") return Promise.resolve(value);
|
|
124
122
|
return value;
|
|
@@ -220,8 +218,7 @@ function concatBytes(chunks) {
|
|
|
220
218
|
function typeName(value) {
|
|
221
219
|
return value?.constructor?.name || typeof value;
|
|
222
220
|
}
|
|
223
|
-
|
|
224
|
-
//#region ../../node_modules/.pnpm/unstorage@2.0.0-beta.0/node_modules/unstorage/dist/index.mjs
|
|
221
|
+
// ../../node_modules/.pnpm/unstorage@2.0.0-beta.0/node_modules/unstorage/dist/index.mjs
|
|
225
222
|
function isRawType$1(type) {
|
|
226
223
|
return type === "bytes" || type === "blob" || type === "stream";
|
|
227
224
|
}
|
|
@@ -534,15 +531,13 @@ function watch(driver, onChange, base) {
|
|
|
534
531
|
async function dispose(driver) {
|
|
535
532
|
if (typeof driver.dispose === "function") await asyncCall(driver.dispose);
|
|
536
533
|
}
|
|
537
|
-
|
|
538
|
-
//#region src/runtime/list-prefix.ts
|
|
534
|
+
// src/runtime/list-prefix.ts
|
|
539
535
|
function normalizeKVListPrefix(prefix = "") {
|
|
540
536
|
const normalized = normalizeKey(prefix);
|
|
541
537
|
const path = prefix.split("?")[0] ?? "";
|
|
542
538
|
return normalized && /[:/\\]$/.test(path) ? `${normalized}:` : normalized;
|
|
543
539
|
}
|
|
544
|
-
|
|
545
|
-
//#region src/runtime/create-storage.ts
|
|
540
|
+
// src/runtime/create-storage.ts
|
|
546
541
|
function isRawType(type) {
|
|
547
542
|
return type === "bytes" || type === "blob" || type === "stream";
|
|
548
543
|
}
|
|
@@ -594,5 +589,4 @@ function createKVStorage(driver) {
|
|
|
594
589
|
}
|
|
595
590
|
});
|
|
596
591
|
}
|
|
597
|
-
//#endregion
|
|
598
592
|
export { normalizeKVListPrefix as n, createKVStorage as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as invariant } from "./invariant-
|
|
2
|
-
import { n as kvErrorDiagnostics } from "./error-diagnostics-
|
|
3
|
-
|
|
1
|
+
import { t as invariant } from "./invariant-Dj2R1eMr.js";
|
|
2
|
+
import { n as kvErrorDiagnostics } from "./error-diagnostics-DUIp6FhO.js";
|
|
3
|
+
// src/runtime/cursor-history.ts
|
|
4
4
|
const MAX_CURSOR_HISTORIES = 1024;
|
|
5
5
|
const MAX_CURSORS_PER_HISTORY = 1024;
|
|
6
6
|
const MAX_CURSOR_LENGTH = 8192;
|
|
@@ -165,5 +165,4 @@ function recordCursor(history, cursor) {
|
|
|
165
165
|
history.add(cursor);
|
|
166
166
|
return true;
|
|
167
167
|
}
|
|
168
|
-
//#endregion
|
|
169
168
|
export { recordCursor as n, createCursorHistory as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as invariant } from "./invariant-
|
|
2
|
-
import { n as kvErrorDiagnostics } from "./error-diagnostics-
|
|
3
|
-
import { n as recordCursor, t as createCursorHistory } from "./cursor-history-
|
|
4
|
-
|
|
1
|
+
import { t as invariant } from "./invariant-Dj2R1eMr.js";
|
|
2
|
+
import { n as kvErrorDiagnostics } from "./error-diagnostics-DUIp6FhO.js";
|
|
3
|
+
import { n as recordCursor, t as createCursorHistory } from "./cursor-history-C6oG12QO.js";
|
|
4
|
+
// src/runtime/deno-kv.ts
|
|
5
5
|
const MAX_DENO_KEY_BYTES = 2048;
|
|
6
6
|
function getDenoRuntime() {
|
|
7
7
|
return globalThis.Deno;
|
|
@@ -160,5 +160,4 @@ function createDenoKVDriver(options = { driver: "deno-kv" }) {
|
|
|
160
160
|
}
|
|
161
161
|
};
|
|
162
162
|
}
|
|
163
|
-
//#endregion
|
|
164
163
|
export { createDenoKVDriver as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../internal/src/dev-peer.ts
|
|
2
2
|
/**
|
|
3
3
|
* Proof that a development request came from this machine, for dev servers that run the app behind a proxy.
|
|
4
4
|
*
|
|
@@ -234,5 +234,4 @@ function addViteHubDevPeerDevHandler(devHandlers) {
|
|
|
234
234
|
devHandlers.unshift({ handler: devHandler });
|
|
235
235
|
}
|
|
236
236
|
readViteHubDevPeerKey();
|
|
237
|
-
//#endregion
|
|
238
237
|
export { isViteHubLoopbackPeer as n, addViteHubDevPeerDevHandler as t };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { i as TransactionOptions, t as Driver } from "./types-
|
|
2
|
-
import { P as ResolvedDatabaseKVStoreConfig, T as KVPageOptions, _ as KVListPage } from "./types-
|
|
3
|
-
//#region src/runtime/database.d.ts
|
|
1
|
+
import { i as TransactionOptions, t as Driver } from "./types-BUb0FcjM.js";
|
|
2
|
+
import { P as ResolvedDatabaseKVStoreConfig, T as KVPageOptions, _ as KVListPage } from "./types-C397WKyf.js";
|
|
4
3
|
/** The table that keeps the keys of every `database` store. Each store has its rows under its own `namespace`. */
|
|
5
4
|
declare const kvTable = "vitehub_kv";
|
|
6
5
|
type KVSqlParam = string | number | null;
|
|
@@ -31,8 +30,6 @@ type DatabaseKVDriver = KVRuntimeDriver & Required<Pick<KVRuntimeDriver, "getIte
|
|
|
31
30
|
* out of reach of every KV store.
|
|
32
31
|
*/
|
|
33
32
|
declare function createDatabaseKVDriver(options: ResolvedDatabaseKVStoreConfig, connect: () => Promise<KVSqlClient>, table?: string): DatabaseKVDriver;
|
|
34
|
-
//#endregion
|
|
35
|
-
//#region src/runtime/driver.d.ts
|
|
36
33
|
type KVRuntimeDriver = Driver & Record<string, unknown> & {
|
|
37
34
|
validateBatch?: (items: Parameters<NonNullable<Driver["setItems"]>>[0], removals: string[], options?: TransactionOptions) => void | Promise<void>;
|
|
38
35
|
/** Deletes the key when it holds the serialized `expected` value. Resolves `true` when this call deleted it. */
|
|
@@ -43,5 +40,4 @@ type KVRuntimeDriver = Driver & Record<string, unknown> & {
|
|
|
43
40
|
/** Writes the serialized value only when the key is missing. Resolves `true` when this call wrote it. */
|
|
44
41
|
setIfAbsentItem?: (key: string, value: string, ttl?: number) => Promise<boolean>;
|
|
45
42
|
};
|
|
46
|
-
//#endregion
|
|
47
43
|
export { createDatabaseKVDriver as a, KVSqlParam as i, KVDatabases as n, kvSqlClientFromDatabase as o, KVSqlClient as r, kvTable as s, KVRuntimeDriver as t };
|
package/dist/durability.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Durability, DurabilityContext } from "@vite-hub/runtime/durability";
|
|
2
|
-
//#region src/durability.d.ts
|
|
3
2
|
/** One KV store as the build resolves it, without credentials. */
|
|
4
3
|
export interface KVDurabilityStore {
|
|
5
4
|
/** The folder of a file store. */
|
|
@@ -13,5 +12,4 @@ export interface KVDurabilityInput {
|
|
|
13
12
|
stores: Record<string, KVDurabilityStore>;
|
|
14
13
|
}
|
|
15
14
|
/** The durability of each KV store, from its driver. A `database` store follows the Database that holds its rows. */
|
|
16
|
-
export declare function kvDurability(input: KVDurabilityInput, context: DurabilityContext): Durability[];
|
|
17
|
-
//#endregion
|
|
15
|
+
export declare function kvDurability(input: KVDurabilityInput, context: DurabilityContext): Durability[];
|
package/dist/durability.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/durability.ts
|
|
2
2
|
const sharedStores = {
|
|
3
3
|
"cloudflare": "A Cloudflare KV namespace that every Worker reads.",
|
|
4
4
|
"deno-kv": "Deno KV, which Deno Deploy shares between isolates.",
|
|
@@ -49,5 +49,4 @@ function kvDurability(input, context) {
|
|
|
49
49
|
...classify(store, context)
|
|
50
50
|
}));
|
|
51
51
|
}
|
|
52
|
-
//#endregion
|
|
53
52
|
export { kvDurability };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineErrors } from "@vite-hub/runtime";
|
|
2
|
-
|
|
2
|
+
// src/error-diagnostics.ts
|
|
3
3
|
const cursorProblems = {
|
|
4
4
|
"expired": "The list cursor has expired.",
|
|
5
5
|
"foreign": "The list cursor belongs to a different storage backend.",
|
|
@@ -155,5 +155,4 @@ const kvConfigErrorCodes = /* @__PURE__ */ new Set([
|
|
|
155
155
|
"KV_MISSING_ENV",
|
|
156
156
|
"KV_STORE_NOT_FOUND"
|
|
157
157
|
]);
|
|
158
|
-
//#endregion
|
|
159
158
|
export { kvErrorDiagnostics as n, kvConfigErrorCodes as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as kvErrorDiagnostics, t as kvConfigErrorCodes } from "./error-diagnostics-
|
|
1
|
+
import { n as kvErrorDiagnostics, t as kvConfigErrorCodes } from "./error-diagnostics-DUIp6FhO.js";
|
|
2
2
|
import { isRuntimeDiagnostic, parseDuration, toResultError } from "@vite-hub/runtime";
|
|
3
|
-
|
|
3
|
+
// src/runtime/ttl.ts
|
|
4
4
|
/**
|
|
5
5
|
* The seconds of a KV `ttl`: a number of seconds, or a duration such as `"1h"`. `undefined` when it is not a positive
|
|
6
6
|
* time, so the caller returns `KV_INVALID_TTL`.
|
|
@@ -16,8 +16,7 @@ function ttlSeconds(ttl) {
|
|
|
16
16
|
}
|
|
17
17
|
return Number.isFinite(seconds) && seconds > 0 && Number.isSafeInteger(Math.ceil(seconds * 1e3)) ? seconds : void 0;
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
//#region src/store-mode.ts
|
|
19
|
+
// src/store-mode.ts
|
|
21
20
|
/**
|
|
22
21
|
* Returns the handle that `kv.store(name, options)` gives. An unknown mode throws, so a typo never gives a writable handle.
|
|
23
22
|
* The read-only handle has only the read methods; write methods are absent, not stubbed.
|
|
@@ -33,8 +32,7 @@ function kvStoreWithMode(storage, options) {
|
|
|
33
32
|
list: storage.list
|
|
34
33
|
};
|
|
35
34
|
}
|
|
36
|
-
|
|
37
|
-
//#region src/errors.ts
|
|
35
|
+
// src/errors.ts
|
|
38
36
|
function kvClearOptionsError(options) {
|
|
39
37
|
if (options === void 0) return;
|
|
40
38
|
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();
|
|
@@ -121,5 +119,4 @@ function kvSetTTL(operation, options) {
|
|
|
121
119
|
if (ttl === void 0) throw kvErrorDiagnostics.KV_INVALID_TTL();
|
|
122
120
|
return ttl;
|
|
123
121
|
}
|
|
124
|
-
//#endregion
|
|
125
122
|
export { kvResult as a, kvStoreNotFoundError as c, listKVKeys as d, kvStoreWithMode as f, kvListLimitInvalid as i, kvUnsupportedOperationError as l, kvInvalidLimitError as n, kvSetCodes as o, ttlSeconds as p, kvKeyLimitCodes as r, kvSetTTL as s, kvClearOptionsError as t, kvWriteLimitCodes as u };
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { A as KVStoreOptions, C as KVOperation, D as KVStorage, E as KVSetOptions, T as KVPageOptions, _ as KVListPage, f as KVErrorCode, g as KVListOptions, j as ReadonlyKVStorage } from "./types-
|
|
1
|
+
import { A as KVStoreOptions, C as KVOperation, D as KVStorage, E as KVSetOptions, T as KVPageOptions, _ as KVListPage, f as KVErrorCode, g as KVListOptions, j as ReadonlyKVStorage } from "./types-C397WKyf.js";
|
|
2
2
|
import { Result, ResultError } from "@vite-hub/runtime";
|
|
3
|
-
//#region src/store-mode.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Returns the handle that `kv.store(name, options)` gives. An unknown mode throws, so a typo never gives a writable handle.
|
|
6
5
|
* The read-only handle has only the read methods; write methods are absent, not stubbed.
|
|
7
6
|
*/
|
|
8
7
|
export declare function kvStoreWithMode(storage: KVStorage, options: KVStoreOptions | undefined): KVStorage | ReadonlyKVStorage;
|
|
9
|
-
//#endregion
|
|
10
|
-
//#region src/errors.d.ts
|
|
11
8
|
export declare function kvClearOptionsError(options: unknown): ResultError<"KV_INVALID_CLEAR_OPTIONS"> | undefined;
|
|
12
9
|
/**
|
|
13
10
|
* Runs one KV operation and returns `[error, data]`.
|
|
@@ -32,5 +29,4 @@ export declare const kvSetCodes: readonly ["KV_KEY_TOO_LONG", "KV_VALUE_TOO_LARG
|
|
|
32
29
|
* The `ttl` of a write in seconds, or `undefined` when the caller sets none.
|
|
33
30
|
* Throws `KV_INVALID_OPTION` for any option other than `ttl`, and `KV_INVALID_TTL` for a `ttl` that is not a positive time.
|
|
34
31
|
*/
|
|
35
|
-
export declare function kvSetTTL(operation: "set" | "setIfAbsent" | "setMany", options: KVSetOptions | undefined): number | undefined;
|
|
36
|
-
//#endregion
|
|
32
|
+
export declare function kvSetTTL(operation: "set" | "setIfAbsent" | "setMany", options: KVSetOptions | undefined): number | undefined;
|
package/dist/errors.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { kvClearOptionsError, kvInvalidLimitError, kvKeyLimitCodes, kvListLimitInvalid, kvResult, kvSetCodes, kvSetTTL, kvStoreNotFoundError, kvStoreWithMode, kvUnsupportedOperationError, kvWriteLimitCodes, listKVKeys };
|
|
1
|
+
export { t as kvClearOptionsError, n as kvInvalidLimitError, r as kvKeyLimitCodes, i as kvListLimitInvalid, a as kvResult, o as kvSetCodes, s as kvSetTTL, c as kvStoreNotFoundError, f as kvStoreWithMode, l as kvUnsupportedOperationError, u as kvWriteLimitCodes, d as listKVKeys } from "./errors-IaVOqzAs.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as default } from "./fs-lite-fvNdBEr9.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { n as kvErrorDiagnostics } from "./error-diagnostics-
|
|
1
|
+
import { n as kvErrorDiagnostics } from "./error-diagnostics-DUIp6FhO.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";
|
|
5
5
|
import { createHash, randomUUID } from "node:crypto";
|
|
6
6
|
import { lock } from "proper-lockfile";
|
|
7
|
-
|
|
7
|
+
// src/runtime/continuations.ts
|
|
8
8
|
/** Owns process-local cursor retention. Taking a cursor transfers its resource to the caller. */
|
|
9
9
|
function createKVContinuations(options) {
|
|
10
10
|
const entries = /* @__PURE__ */ new Map();
|
|
@@ -65,8 +65,7 @@ function createKVContinuations(options) {
|
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
-
|
|
69
|
-
//#region src/runtime/fs-lite.ts
|
|
68
|
+
// src/runtime/fs-lite.ts
|
|
70
69
|
const temporaryFile = /^\.unstorage-tmp-[\da-z-]+$/;
|
|
71
70
|
const layoutRecord = /^\.unstorage-tmp-vitehub-layout-v1(?:-\d+)?$/;
|
|
72
71
|
const layoutRecordName = ".unstorage-tmp-vitehub-layout-v1";
|
|
@@ -382,5 +381,4 @@ async function createFsLiteKVDriver(options) {
|
|
|
382
381
|
}
|
|
383
382
|
return driver;
|
|
384
383
|
}
|
|
385
|
-
//#endregion
|
|
386
384
|
export { createFsLiteKVDriver as t };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
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-
|
|
2
|
-
//#region src/runtime/storage.d.ts
|
|
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-C397WKyf.js";
|
|
3
2
|
/** Releases every cached store. Call from the application's shutdown hook after stopping new work. */
|
|
4
3
|
export declare function disposeKVStores(): Promise<void>;
|
|
5
4
|
/**
|
|
@@ -8,5 +7,4 @@ export declare function disposeKVStores(): Promise<void>;
|
|
|
8
7
|
*/
|
|
9
8
|
export declare function getKVStoreDriver(name?: KVStoreName): Promise<KVDriver>;
|
|
10
9
|
export declare const kv: KVStorage;
|
|
11
|
-
//#endregion
|
|
12
10
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { r as
|
|
4
|
-
import {
|
|
5
|
-
import { n as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { t as logFailure } from "./request-log-
|
|
1
|
+
import { r as normalizeKVOptions, s as readEnv } from "./config-B8FRGmX_.js";
|
|
2
|
+
import { n as getActiveCloudflareEnv } from "./cloudflare-env-lookup-Dgq5n1Aq.js";
|
|
3
|
+
import { a as kvResult, d as listKVKeys, f as kvStoreWithMode, i as kvListLimitInvalid, o as kvSetCodes, p as ttlSeconds, r as kvKeyLimitCodes, s as kvSetTTL, t as kvClearOptionsError } from "./errors-IaVOqzAs.js";
|
|
4
|
+
import { o as normalizeKey } from "./utils2-By8eee1x.js";
|
|
5
|
+
import { n as kvErrorDiagnostics } from "./error-diagnostics-DUIp6FhO.js";
|
|
6
|
+
import { t as resolveRuntimeKVOptions } from "./upstash-DQVo1zbz.js";
|
|
7
|
+
import { i as setItemsOneByOne, n as getItemsOneByOne } from "./batch-D-ib5_0P.js";
|
|
8
|
+
import { n as normalizeKVListPrefix, t as createKVStorage$1 } from "./create-storage-BMvkkYdM.js";
|
|
9
|
+
import { t as logFailure } from "./request-log-DllKQXj7.js";
|
|
10
10
|
import { getViteHubTestMode } from "@vite-hub/runtime/internal/test-mode";
|
|
11
11
|
import { destr } from "destr";
|
|
12
|
-
|
|
12
|
+
// src/runtime/driver.ts
|
|
13
13
|
const lazyDriverMethods = /* @__PURE__ */ new Set([
|
|
14
14
|
"clear",
|
|
15
15
|
"getItem",
|
|
@@ -74,7 +74,7 @@ async function createRuntimeDriver(store, loadDatabases) {
|
|
|
74
74
|
case "cloudflare": {
|
|
75
75
|
const { localBase } = store;
|
|
76
76
|
if (localBase) {
|
|
77
|
-
const { default: factory } = await import("./cloudflare-kv-local-
|
|
77
|
+
const { default: factory } = await import("./cloudflare-kv-local-lov9LLhU.js");
|
|
78
78
|
return factory({
|
|
79
79
|
...store,
|
|
80
80
|
localBase
|
|
@@ -85,11 +85,11 @@ async function createRuntimeDriver(store, loadDatabases) {
|
|
|
85
85
|
}
|
|
86
86
|
case "database": return createDatabaseDriver(store, loadDatabases);
|
|
87
87
|
case "deno-kv": {
|
|
88
|
-
const { default: factory } = await import("./deno-kv-
|
|
88
|
+
const { default: factory } = await import("./deno-kv-MnqlNH1e.js");
|
|
89
89
|
return factory(store);
|
|
90
90
|
}
|
|
91
91
|
case "fs-lite": {
|
|
92
|
-
const { default: factory } = await import("./fs-lite-
|
|
92
|
+
const { default: factory } = await import("./fs-lite-DhXLUL-H.js");
|
|
93
93
|
return factory(store);
|
|
94
94
|
}
|
|
95
95
|
case "redis": {
|
|
@@ -144,8 +144,7 @@ function createLazyKVRuntimeDriver(config, loadDatabases) {
|
|
|
144
144
|
};
|
|
145
145
|
} });
|
|
146
146
|
}
|
|
147
|
-
|
|
148
|
-
//#region src/runtime/hosted-storage.ts
|
|
147
|
+
// src/runtime/hosted-storage.ts
|
|
149
148
|
function assertHostedConfig(config) {
|
|
150
149
|
if (!config) throw kvErrorDiagnostics.KV_DISABLED();
|
|
151
150
|
return config;
|
|
@@ -232,8 +231,7 @@ function createHostedKVStorage(config, name = "default", loadDatabases) {
|
|
|
232
231
|
if (deleteIfEqualsItem) storage.deleteIfEqualsItem = async (key, expected) => deleteIfEqualsItem(normalizeKey(key), serializeValue(expected, "deleteIfEquals"));
|
|
233
232
|
return storage;
|
|
234
233
|
}
|
|
235
|
-
|
|
236
|
-
//#region src/runtime/lock.ts
|
|
234
|
+
// src/runtime/lock.ts
|
|
237
235
|
const firstRetryMs = 25;
|
|
238
236
|
const maxRetryMs = 500;
|
|
239
237
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -308,8 +306,7 @@ function createKVLock(store, resolveStorage, key, options) {
|
|
|
308
306
|
}
|
|
309
307
|
};
|
|
310
308
|
}
|
|
311
|
-
|
|
312
|
-
//#region src/runtime/storage.ts
|
|
309
|
+
// src/runtime/storage.ts
|
|
313
310
|
const storagePromises = /* @__PURE__ */ new Map();
|
|
314
311
|
let disposal;
|
|
315
312
|
/** Releases every cached store. Call from the application's shutdown hook after stopping new work. */
|
|
@@ -476,5 +473,4 @@ function selectKVStore(name, options) {
|
|
|
476
473
|
return kvStoreWithMode(createKVStorage(name), options);
|
|
477
474
|
}
|
|
478
475
|
const kv = createKVStorage();
|
|
479
|
-
//#endregion
|
|
480
476
|
export { disposeKVStores, getKVStoreDriver, kv };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
|
|
2
2
|
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
3
3
|
function normalizeWindowsPath(input = "") {
|
|
4
4
|
if (!input) return input;
|
|
@@ -95,8 +95,7 @@ const dirname = function(p) {
|
|
|
95
95
|
if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) segments[0] += "/";
|
|
96
96
|
return segments.join("/") || (isAbsolute(p) ? "/" : ".");
|
|
97
97
|
};
|
|
98
|
-
|
|
99
|
-
//#region ../internal/src/inspect.ts
|
|
98
|
+
// ../internal/src/inspect.ts
|
|
100
99
|
function relativeDefinitionFile(projectRoot, file) {
|
|
101
100
|
return relative(projectRoot, file).replaceAll("\\", "/");
|
|
102
101
|
}
|
|
@@ -114,5 +113,4 @@ const embeddedSecretAssignmentPattern = new RegExp(String.raw`\b([\w-]*(?:${secr
|
|
|
114
113
|
function redactInspectionText(value) {
|
|
115
114
|
return value.replace(embeddedUrlCredentialPattern, `$1${redactedInspectionValue}@`).replace(embeddedAuthorizationPattern, `$1${redactedInspectionValue}`).replace(embeddedCookiePattern, `$1${redactedInspectionValue}`).replace(embeddedBearerPattern, `Bearer ${redactedInspectionValue}`).replace(embeddedSecretAssignmentPattern, `$1${redactedInspectionValue}`);
|
|
116
115
|
}
|
|
117
|
-
//#endregion
|
|
118
116
|
export { resolve as a, relative as i, relativeDefinitionFile as n, dirname as r, redactInspectionText as t };
|