@vite-hub/runtime 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/dist/{core-DpLK9dQt.js → core-Crv8CV_r.js} +5 -7
- package/dist/{core-BfUEli_0.d.ts → core-auTkK4iZ.d.ts} +0 -6
- package/dist/durability.d.ts +1 -3
- package/dist/durability.js +1 -2
- package/dist/{error-diagnostics-BM9W4pBg.js → error-diagnostics-Dj98U7ch.js} +1 -2
- package/dist/{error-diagnostics-0sYgKTT8.d.ts → error-diagnostics-DuusexaK.d.ts} +0 -2
- package/dist/{errors-BQ0ofIL4.js → errors-D2ixvqv3.js} +2 -3
- package/dist/{execution-budget-BPXbISEt.d.ts → execution-budget-Bv7h0-5V.d.ts} +0 -2
- package/dist/{hosted-console-ZfMo5MW4.d.ts → hosted-console-DTh9zwNz.d.ts} +0 -2
- package/dist/{index-DsisbCNa.d.ts → index-hFKl7B_y.d.ts} +2 -21
- package/dist/index.d.ts +6 -6
- package/dist/index.js +5 -5
- package/dist/internal/console.d.ts +2 -4
- package/dist/internal/console.js +1 -2
- package/dist/internal/context.d.ts +1 -1
- package/dist/internal/context.js +1 -2
- package/dist/internal/drain.d.ts +1 -3
- package/dist/internal/drain.js +3 -5
- package/dist/internal/error-diagnostics.d.ts +1 -1
- package/dist/internal/error-diagnostics.js +1 -2
- package/dist/internal/execution-budget.d.ts +1 -3
- package/dist/internal/execution-budget.js +3 -5
- package/dist/internal/grant.d.ts +1 -2
- package/dist/internal/grant.js +3 -4
- package/dist/internal/h3.d.ts +2 -4
- package/dist/internal/h3.js +4 -6
- package/dist/internal/node.d.ts +2 -3
- package/dist/internal/node.js +2 -3
- package/dist/internal/public-url.d.ts +1 -1
- package/dist/internal/public-url.js +1 -2
- package/dist/internal/response.d.ts +1 -1
- package/dist/internal/response.js +1 -2
- package/dist/internal/run-failed.d.ts +1 -3
- package/dist/internal/run-failed.js +1 -2
- package/dist/internal/run-scope.d.ts +1 -3
- package/dist/internal/run-scope.js +1 -2
- package/dist/internal/runtime-type.d.ts +1 -3
- package/dist/internal/runtime-type.js +2 -2
- package/dist/internal/shutdown.d.ts +1 -3
- package/dist/internal/shutdown.js +1 -2
- package/dist/internal/test-mode-setup.d.ts +1 -3
- package/dist/internal/test-mode-setup.js +1 -2
- package/dist/internal/test-mode.d.ts +1 -3
- package/dist/internal/test-mode.js +1 -2
- package/dist/internal/trace.d.ts +2 -4
- package/dist/internal/trace.js +1 -2
- package/dist/operations.d.ts +0 -3
- package/dist/operations.js +9 -10
- package/dist/{public-url-BCFhTiTM.d.ts → public-url-B4p8EOqr.d.ts} +0 -2
- package/dist/{public-url-DizC8CFs.js → public-url-DDh_BHz3.js} +4 -7
- package/dist/{request-context-Dmsliqan.js → request-context-Ci5FjuUY.js} +10 -17
- package/dist/{response-iONbTI0E.d.ts → response-ClQ9ZSS_.d.ts} +0 -2
- package/dist/{response-Be5M4WIn.js → response-DEyMvEBF.js} +5 -7
- package/dist/{runtime-type-CHYQYwDx.js → runtime-type-EgaBGoVU.js} +2 -4
- package/package.json +4 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
4
|
-
|
|
1
|
+
import { r as isRuntimeObject } from "./runtime-type-EgaBGoVU.js";
|
|
2
|
+
import { t as ViteHubError } from "./errors-D2ixvqv3.js";
|
|
3
|
+
import { t as runtimeErrorDiagnostics } from "./error-diagnostics-Dj98U7ch.js";
|
|
4
|
+
// src/internal/trace-attributes.ts
|
|
5
5
|
const contentAttributeKeys = /* @__PURE__ */ new Set([
|
|
6
6
|
"args",
|
|
7
7
|
"body",
|
|
@@ -107,8 +107,7 @@ function normalizeTraceAttributes(attributes, content) {
|
|
|
107
107
|
}
|
|
108
108
|
return Object.keys(source).length ? source : void 0;
|
|
109
109
|
}
|
|
110
|
-
|
|
111
|
-
//#region src/core.ts
|
|
110
|
+
// src/core.ts
|
|
112
111
|
function captureWebAssemblyModule() {
|
|
113
112
|
const namespace = Object.getOwnPropertyDescriptor(globalThis, "WebAssembly")?.value;
|
|
114
113
|
const constructor = typeof namespace === "object" ? Object.getOwnPropertyDescriptor(namespace, "Module")?.value : void 0;
|
|
@@ -1101,5 +1100,4 @@ async function resolveCapabilityPolicy(policy, context) {
|
|
|
1101
1100
|
if (!policy) return "allow";
|
|
1102
1101
|
return typeof policy === "function" ? await policy(context) : policy;
|
|
1103
1102
|
}
|
|
1104
|
-
//#endregion
|
|
1105
1103
|
export { traceEventsToOpenTelemetrySpans as _, defineCapability as a, getCapability as c, isResolvable as d, noExecutionAuthority as f, traceEventsToOpenTelemetryLogRecords as g, resolveRuntimeValue as h, createTraceEventLog as i, hasCapability as l, resolveCapabilityPolicy as m, createRuntimeContext as n, deriveTraceRuns as o, normalizeExecutionAuthority as p, createRuntimeWaitUntilController as r, emitTraceEvent as s, createExecutionContext as t, isExecutionAuthority as u, unknownExecutionAuthority as v, isTraceContentAttributeKey as y };
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { StandardContext } from "standard-context";
|
|
2
|
-
//#region ../internal/dist/runtime/cloudflare-env.d.ts
|
|
3
2
|
interface CloudflareWorkerExecutionContext {
|
|
4
3
|
waitUntil?: (promise: Promise<unknown>) => void;
|
|
5
4
|
}
|
|
6
|
-
//#endregion
|
|
7
|
-
//#region src/standard-context.d.ts
|
|
8
5
|
/** The host data that ViteHub puts in `runtime` of a Standard Context. */
|
|
9
6
|
interface ViteHubRuntime {
|
|
10
7
|
/** The Cloudflare bindings and execution context of the request. A host can pass either one without the other. */
|
|
@@ -22,8 +19,6 @@ interface ViteHubRuntime {
|
|
|
22
19
|
type ViteHubStandardProps = StandardContext.Props<ViteHubRuntime, void>;
|
|
23
20
|
/** A request event in a ViteHub app: any server context with Standard Context properties. */
|
|
24
21
|
type ViteHubContext<C = {}> = StandardContext<C, ViteHubRuntime, void>;
|
|
25
|
-
//#endregion
|
|
26
|
-
//#region src/core.d.ts
|
|
27
22
|
type MaybePromise<T> = T | Promise<T>;
|
|
28
23
|
declare global {
|
|
29
24
|
namespace ViteHub {
|
|
@@ -300,5 +295,4 @@ declare function getCapability(context: RuntimeHostContext<any>, name: string):
|
|
|
300
295
|
declare function isResolvable<T, TContext extends RuntimeHostContext<any>>(value: MaybeResolvable<T, TContext>): value is Resolvable<T, TContext>;
|
|
301
296
|
declare function resolveRuntimeValue<T, TContext extends RuntimeHostContext<any>>(value: MaybeResolvable<T, TContext>, context: TContext): Promise<T>;
|
|
302
297
|
declare function resolveCapabilityPolicy(policy: CapabilityPolicy | undefined, context: PolicyContext): Promise<PolicyDecision>;
|
|
303
|
-
//#endregion
|
|
304
298
|
export { emitTraceEvent as $, RuntimeWaitUntil as A, TraceEventLogOptions as B, PolicyDecision as C, RuntimeCapabilityHandle as D, RuntimeCapabilities as E, TraceContext as F, TraceStepStatus as G, TracePayloadVisibility as H, TraceEvent as I, createRuntimeContext as J, TraceStepView as K, TraceEventContentPolicy as L, TraceActivityContext as M, TraceActivityOwner as N, RuntimeContextInput as O, TraceActivityPhase as P, deriveTraceRuns as Q, TraceEventLog as R, PolicyContext as S, RunLifecycleHooks as T, TraceRunStatus as U, TraceEventPayload as V, TraceRunView as W, createTraceEventLog as X, createRuntimeWaitUntilController as Y, defineCapability as Z, MaybeResolvable as _, AnonymousAccessAuthorizationContext as a, normalizeExecutionAuthority as at, OpenTelemetrySpanView as b, ApprovalRequest as c, traceEventsToOpenTelemetryLogRecords as ct, CapabilityHandle as d, ViteHubContext as dt, getCapability as et, CapabilityPolicy as f, ViteHubRuntime as ft, MaybePromise as g, ExecutionContext as h, AccessAuthorizeResult as i, noExecutionAuthority as it, RuntimeWaitUntilController as j, RuntimeHostContext as k, ApprovalState as l, traceEventsToOpenTelemetrySpans as lt, ExecutionAuthority as m, AccessAuthorize as n, isExecutionAuthority as nt, AnonymousAccessAuthorize as o, resolveCapabilityPolicy as ot, CreatedRuntimeContext as p, ViteHubStandardProps as pt, createExecutionContext as q, AccessAuthorizeOption as r, isResolvable as rt, ApprovalDecision as s, resolveRuntimeValue as st, AccessAuthorizationContext as t, hasCapability as tt, CapabilityDefinition as u, unknownExecutionAuthority as ut, OpenTelemetryLogRecordView as v, Resolvable as w, OpenTelemetrySpanViewOptions as x, OpenTelemetrySpanEventView as y, TraceEventLogEntry as z };
|
package/dist/durability.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/durability.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Where the state of a primitive lives.
|
|
4
3
|
*
|
|
@@ -103,5 +102,4 @@ export declare function getDurabilityReport(): DurabilityReport | undefined;
|
|
|
103
102
|
* Records the durability of each primitive, prints one line per primitive, and fails when several instances would
|
|
104
103
|
* split state. A Node server runs it once at boot, from a Nitro plugin that ViteHub generates.
|
|
105
104
|
*/
|
|
106
|
-
export declare function checkDurability(primitives: readonly Durability[], options?: DurabilityCheckOptions): DurabilityReport;
|
|
107
|
-
//#endregion
|
|
105
|
+
export declare function checkDurability(primitives: readonly Durability[], options?: DurabilityCheckOptions): DurabilityReport;
|
package/dist/durability.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineDiagnostics } from "nostics";
|
|
2
|
-
|
|
2
|
+
// src/durability.ts
|
|
3
3
|
/**
|
|
4
4
|
* Runs every reporter once, in order. A reporter that calls `context.find()` runs the reporter of that primitive first,
|
|
5
5
|
* so the order of the entries does not matter.
|
|
@@ -167,5 +167,4 @@ function checkDurability(primitives, options = {}) {
|
|
|
167
167
|
if (options.enforce !== false && report.problems.length) throw durabilityError(report);
|
|
168
168
|
return report;
|
|
169
169
|
}
|
|
170
|
-
//#endregion
|
|
171
170
|
export { checkDurability, classifySqliteUrl, collectDurability, durabilityError, durabilityProblems, formatDurabilityTable, getDurabilityReport, instancesEnvName, readInstanceCount, resolveDurabilityValue, sqliteUrlInput };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineDiagnostics } from "nostics";
|
|
2
|
-
|
|
2
|
+
// src/error-diagnostics.ts
|
|
3
3
|
const dynamicError = { why: ({ message }) => message === void 0 ? "" : String(message) };
|
|
4
4
|
const codes = {
|
|
5
5
|
RUNTIME_R0001: {
|
|
@@ -89,5 +89,4 @@ const runtimeErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
89
89
|
docsBase: "https://vitehub.dev/docs/runtime/diagnostics",
|
|
90
90
|
codes
|
|
91
91
|
});
|
|
92
|
-
//#endregion
|
|
93
92
|
export { runtimeErrorDiagnostics as t };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Diagnostics } from "nostics";
|
|
2
|
-
//#region src/error-diagnostics.d.ts
|
|
3
2
|
interface RuntimeCodeParams {
|
|
4
3
|
counter?: string;
|
|
5
4
|
message?: unknown;
|
|
@@ -15,5 +14,4 @@ interface RuntimeCodeDefinition {
|
|
|
15
14
|
type RuntimeErrorCode = "RUNTIME_R0001" | "RUNTIME_R0002" | "RUNTIME_R0003" | "RUNTIME_R0004" | "RUNTIME_R0005" | "RUNTIME_R0006" | "RUNTIME_R0007" | "RUNTIME_R0009" | "RUNTIME_R0010" | "RUNTIME_R0011" | "RUNTIME_R0015" | "RUNTIME_R0016" | "RUNTIME_R0017" | "RUNTIME_R0018" | "RUNTIME_CONSOLE_PATH_INVALID" | "RUNTIME_CONSOLE_PROJECT_URL_INVALID" | "RUNTIME_DURATION_INVALID" | "RUNTIME_EXECUTION_BUDGET_AMOUNT_INVALID" | "RUNTIME_EXECUTION_BUDGET_EXCEEDED" | "RUNTIME_EXECUTION_BUDGET_LIMIT_INVALID" | "RUNTIME_HIDDEN_ERROR" | "RUNTIME_SERIALIZED_RESPONSE_INVALID";
|
|
16
15
|
declare const codes: Record<RuntimeErrorCode, RuntimeCodeDefinition>;
|
|
17
16
|
declare const runtimeErrorDiagnostics: Diagnostics<typeof codes, []>;
|
|
18
|
-
//#endregion
|
|
19
17
|
export { runtimeErrorDiagnostics as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as runtimeErrorDiagnostics } from "./error-diagnostics-
|
|
2
|
-
|
|
1
|
+
import { t as runtimeErrorDiagnostics } from "./error-diagnostics-Dj98U7ch.js";
|
|
2
|
+
// src/errors.ts
|
|
3
3
|
const MAX_DETAIL_DEPTH = 8;
|
|
4
4
|
const MAX_DETAIL_ENTRIES = 128;
|
|
5
5
|
const MAX_DETAIL_KEY_LENGTH = 128;
|
|
@@ -186,5 +186,4 @@ function getViteHubErrorShape(value) {
|
|
|
186
186
|
function isViteHubError(value) {
|
|
187
187
|
return getViteHubErrorShape(value) !== void 0;
|
|
188
188
|
}
|
|
189
|
-
//#endregion
|
|
190
189
|
export { getViteHubErrorShape as n, isViteHubError as r, ViteHubError as t };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Diagnostic } from "nostics";
|
|
2
|
-
//#region src/execution-budget.d.ts
|
|
3
2
|
/** Counters that an Invocation can spend while it runs. */
|
|
4
3
|
type ExecutionBudgetCounter = "inputBytes" | "outputBytes" | "retries" | "toolCalls";
|
|
5
4
|
interface ExecutionBudgetLimits {
|
|
@@ -52,5 +51,4 @@ interface ExecutionBudget {
|
|
|
52
51
|
snapshot(): ExecutionBudgetSnapshot;
|
|
53
52
|
}
|
|
54
53
|
declare function createExecutionBudget(options?: ExecutionBudgetOptions): ExecutionBudget;
|
|
55
|
-
//#endregion
|
|
56
54
|
export { ExecutionBudgetOptions as a, createExecutionBudget as c, ExecutionBudgetLimits as i, isExecutionBudgetExceededError as l, ExecutionBudgetCounter as n, ExecutionBudgetSnapshot as o, ExecutionBudgetExceededError as r, ExecutionBudgetUsage as s, ExecutionBudget as t };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/hosted-console.d.ts
|
|
2
1
|
/** The origin of the hosted Console. */
|
|
3
2
|
declare const hostedConsoleOrigin = "https://console.vitehub.dev";
|
|
4
3
|
/**
|
|
@@ -26,5 +25,4 @@ declare function normalizeConsoleProjectUrl(projectUrl: string): string | undefi
|
|
|
26
25
|
* `RUNTIME_CONSOLE_PATH_INVALID` when `path` is not a Console path.
|
|
27
26
|
*/
|
|
28
27
|
declare function hostedConsoleUrl(projectUrl: string, path: string, consoleOrigin?: string): string;
|
|
29
|
-
//#endregion
|
|
30
28
|
export { normalizeConsoleProjectUrl as i, hostedConsoleUrl as n, normalizeConsolePath as r, hostedConsoleOrigin as t };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { O as RuntimeContextInput, dt as ViteHubContext, g as MaybePromise, k as RuntimeHostContext, p as CreatedRuntimeContext, pt as ViteHubStandardProps } from "./core-
|
|
2
|
-
import "./execution-budget-
|
|
1
|
+
import { O as RuntimeContextInput, dt as ViteHubContext, g as MaybePromise, k as RuntimeHostContext, p as CreatedRuntimeContext, pt as ViteHubStandardProps } from "./core-auTkK4iZ.js";
|
|
2
|
+
import "./execution-budget-Bv7h0-5V.js";
|
|
3
3
|
import { Diagnostic, DiagnosticDefinition, DiagnosticJSON, Diagnostics } from "nostics";
|
|
4
|
-
//#region src/result.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Error of a ViteHub operation. It is a Nostics diagnostic with a typed `code`.
|
|
7
6
|
*
|
|
@@ -84,8 +83,6 @@ declare function toResultError<TCode extends string, TData>(error: (Diagnostic<T
|
|
|
84
83
|
* Return runtime errors as `[error, undefined]`. Throw definition and config errors.
|
|
85
84
|
*/
|
|
86
85
|
declare function defineErrors<const TCodes extends ErrorCodes>(options: DefineErrorsOptions<TCodes>): ErrorCatalog<TCodes>;
|
|
87
|
-
//#endregion
|
|
88
|
-
//#region src/lease.d.ts
|
|
89
86
|
type LeaseOperation = "acquire" | "get" | "release" | "renew";
|
|
90
87
|
/** The codes that lease operations return. */
|
|
91
88
|
type LeaseErrorCode = "RUNTIME_LEASE_FAILED" | "RUNTIME_LEASE_INVALID_TTL";
|
|
@@ -156,8 +153,6 @@ type LeaseSqlParam = string | number | null;
|
|
|
156
153
|
* clocks of the hosts. Works on Postgres and on SQLite 3.35 or later, such as libSQL.
|
|
157
154
|
*/
|
|
158
155
|
declare function createSqlLeaseStore(client: LeaseSqlClient): LeaseStore;
|
|
159
|
-
//#endregion
|
|
160
|
-
//#region src/instance.d.ts
|
|
161
156
|
/** The environment variable that names this server instance. */
|
|
162
157
|
declare const instanceIdEnv = "VITEHUB_INSTANCE_ID";
|
|
163
158
|
/**
|
|
@@ -166,8 +161,6 @@ declare const instanceIdEnv = "VITEHUB_INSTANCE_ID";
|
|
|
166
161
|
* which instance holds a key or runs an Invocation. Give each instance its own value, such as the pod or machine name.
|
|
167
162
|
*/
|
|
168
163
|
declare function getInstanceId(): string;
|
|
169
|
-
//#endregion
|
|
170
|
-
//#region src/duration.d.ts
|
|
171
164
|
/** The units of a {@link Duration}, short and long. Case does not matter at runtime. */
|
|
172
165
|
type DurationUnit = "ms" | "millisecond" | "milliseconds" | "s" | "sec" | "secs" | "second" | "seconds" | "m" | "min" | "mins" | "minute" | "minutes" | "h" | "hr" | "hrs" | "hour" | "hours" | "d" | "day" | "days" | "w" | "week" | "weeks";
|
|
173
166
|
/** A length of time as a number and a unit, such as `"30s"`, `"5m"`, `"2 hours"`, or `"1 day"`. */
|
|
@@ -185,8 +178,6 @@ type Duration = `${number}${DurationUnit}` | `${number} ${DurationUnit}`;
|
|
|
185
178
|
* ```
|
|
186
179
|
*/
|
|
187
180
|
declare function parseDuration(value: Duration, option?: string, round?: "ceil", legacyUnit?: "ms" | "s"): number;
|
|
188
|
-
//#endregion
|
|
189
|
-
//#region src/diagnostics.d.ts
|
|
190
181
|
type RuntimeDiagnosticLevel = "debug" | "error" | "info" | "warn";
|
|
191
182
|
type RuntimeResourceScope = "container" | "host" | "process" | "service" | "workload";
|
|
192
183
|
type RuntimeResourceUnit = "bytes" | "count" | "microseconds" | "ratio";
|
|
@@ -251,8 +242,6 @@ declare function isRuntimeDiagnostic(error: unknown): error is Diagnostic<unknow
|
|
|
251
242
|
/** Formats bounded developer diagnostics without exposing causes or stacks. */
|
|
252
243
|
declare function formatRuntimeDiagnosticError(error: unknown): string;
|
|
253
244
|
declare function normalizeRuntimeDiagnosticError(error: unknown, options?: RuntimeDiagnosticErrorOptions): RuntimeDiagnosticError;
|
|
254
|
-
//#endregion
|
|
255
|
-
//#region src/errors.d.ts
|
|
256
245
|
type ViteHubErrorDetail = boolean | null | number | string | readonly ViteHubErrorDetail[] | {
|
|
257
246
|
readonly [key: string]: ViteHubErrorDetail | undefined;
|
|
258
247
|
};
|
|
@@ -277,8 +266,6 @@ declare class ViteHubError<TCode extends string = string, TDetails extends ViteH
|
|
|
277
266
|
}
|
|
278
267
|
declare function getViteHubErrorShape(value: unknown): ViteHubErrorShape | undefined;
|
|
279
268
|
declare function isViteHubError(value: unknown): value is ViteHubErrorShape;
|
|
280
|
-
//#endregion
|
|
281
|
-
//#region src/request-context.d.ts
|
|
282
269
|
type RuntimeName = "cloudflare-agents" | "deno" | "unknown" | "vercel" | "vite";
|
|
283
270
|
type RuntimeContextOptions = Omit<RuntimeContextInput, "event" | "runtime"> & {
|
|
284
271
|
runtime?: RuntimeName;
|
|
@@ -312,13 +299,8 @@ declare function sendPreparedResponse(request: Request, response: Response): Res
|
|
|
312
299
|
*/
|
|
313
300
|
declare function getRuntimeContext(value: Request | ViteHubContext): RequestRuntimeContext;
|
|
314
301
|
declare function getRuntimeContext<const TOptions extends RuntimeContextOptions>(value: Request | ViteHubContext, options: TOptions): RequestRuntimeContext<TOptions>;
|
|
315
|
-
//#endregion
|
|
316
|
-
//#region ../internal/dist/deployment.d.ts
|
|
317
|
-
//#region src/deployment.d.ts
|
|
318
302
|
/** The host that ViteHub builds for: the `host` option of `vitehub()` and the value of `VITEHUB_HOST`. */
|
|
319
303
|
type ViteHubHost = "cloudflare" | "deno" | "netlify" | "node" | "vercel";
|
|
320
|
-
//#endregion
|
|
321
|
-
//#region src/host.d.ts
|
|
322
304
|
declare global {
|
|
323
305
|
namespace Cloudflare {
|
|
324
306
|
interface Env {}
|
|
@@ -360,5 +342,4 @@ declare function detectHost(env?: Record<string, string | undefined>): ViteHubHo
|
|
|
360
342
|
*/
|
|
361
343
|
declare function getHostBinding<TName extends keyof Cloudflare.Env & string>(name: TName, event?: object): Result<Cloudflare.Env[TName], HostBindingErrorCode>;
|
|
362
344
|
declare function getHostBinding<T = unknown>(name: string, event?: object): Result<T, HostBindingErrorCode>;
|
|
363
|
-
//#endregion
|
|
364
345
|
export { ResultError as $, formatRuntimeDiagnosticError as A, LeaseErrorCode as B, RuntimeDiagnosticReporter as C, RuntimeResourceSnapshot as D, RuntimeResourceScope as E, parseDuration as F, LeaseStore as G, LeaseRecord as H, getInstanceId as I, DefineErrorsOptions as J, createMemoryLeaseStore as K, instanceIdEnv as L, normalizeRuntimeDiagnosticError as M, Duration as N, RuntimeResourceSupport as O, DurationUnit as P, Result as Q, Lease as R, RuntimeDiagnosticLevel as S, RuntimeResourceObservation as T, LeaseSqlClient as U, LeaseOperation as V, LeaseSqlParam as W, ErrorCodes as X, ErrorCatalog as Y, ErrorHandle as Z, getViteHubErrorShape as _, RequestRuntimeContext as a, RuntimeDiagnosticErrorOptions as b, getRuntimeContext as c, sendPreparedResponse as d, defineErrors as et, ViteHubError as f, ViteHubErrorShape as g, ViteHubErrorOptions as h, ViteHubHost as i, isRuntimeDiagnostic as j, RuntimeResourceUnit as k, getStandardContext as l, ViteHubErrorDetails as m, detectHost as n, RuntimeContextOptions as o, ViteHubErrorDetail as p, createSqlLeaseStore as q, getHostBinding as r, RuntimeName as s, HostBindingErrorCode as t, toResultError as tt, installRequestStandardContext as u, isViteHubError as v, RuntimeResourceInspector as w, RuntimeDiagnosticEvent as x, RuntimeDiagnosticError as y, LeaseAcquireOptions as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { A as RuntimeWaitUntil, B as TraceEventLogOptions, C as PolicyDecision, D as RuntimeCapabilityHandle, E as RuntimeCapabilities, F as TraceContext, G as TraceStepStatus, H as TracePayloadVisibility, I as TraceEvent, J as createRuntimeContext, K as TraceStepView, L as TraceEventContentPolicy, M as TraceActivityContext, N as TraceActivityOwner, O as RuntimeContextInput, P as TraceActivityPhase, Q as deriveTraceRuns, R as TraceEventLog, S as PolicyContext, T as RunLifecycleHooks, U as TraceRunStatus, V as TraceEventPayload, W as TraceRunView, X as createTraceEventLog, Z as defineCapability, _ as MaybeResolvable, a as AnonymousAccessAuthorizationContext, at as normalizeExecutionAuthority, b as OpenTelemetrySpanView, c as ApprovalRequest, d as CapabilityHandle, dt as ViteHubContext, et as getCapability, f as CapabilityPolicy, ft as ViteHubRuntime, g as MaybePromise, h as ExecutionContext, i as AccessAuthorizeResult, it as noExecutionAuthority, j as RuntimeWaitUntilController, k as RuntimeHostContext, l as ApprovalState, m as ExecutionAuthority, n as AccessAuthorize, nt as isExecutionAuthority, o as AnonymousAccessAuthorize, ot as resolveCapabilityPolicy, p as CreatedRuntimeContext, pt as ViteHubStandardProps, q as createExecutionContext, r as AccessAuthorizeOption, s as ApprovalDecision, t as AccessAuthorizationContext, tt as hasCapability, u as CapabilityDefinition, ut as unknownExecutionAuthority, v as OpenTelemetryLogRecordView, w as Resolvable, x as OpenTelemetrySpanViewOptions, y as OpenTelemetrySpanEventView, z as TraceEventLogEntry } from "./core-
|
|
2
|
-
import { $ as ResultError, A as formatRuntimeDiagnosticError, B as LeaseErrorCode, C as RuntimeDiagnosticReporter, D as RuntimeResourceSnapshot, E as RuntimeResourceScope, F as parseDuration, G as LeaseStore, H as LeaseRecord, I as getInstanceId, J as DefineErrorsOptions, K as createMemoryLeaseStore, L as instanceIdEnv, M as normalizeRuntimeDiagnosticError, N as Duration, O as RuntimeResourceSupport, P as DurationUnit, Q as Result, R as Lease, S as RuntimeDiagnosticLevel, T as RuntimeResourceObservation, U as LeaseSqlClient, V as LeaseOperation, W as LeaseSqlParam, X as ErrorCodes, Y as ErrorCatalog, Z as ErrorHandle, _ as getViteHubErrorShape, a as RequestRuntimeContext, b as RuntimeDiagnosticErrorOptions, c as getRuntimeContext, et as defineErrors, f as ViteHubError, g as ViteHubErrorShape, h as ViteHubErrorOptions, i as ViteHubHost, j as isRuntimeDiagnostic, k as RuntimeResourceUnit, l as getStandardContext, m as ViteHubErrorDetails, n as detectHost, o as RuntimeContextOptions, p as ViteHubErrorDetail, q as createSqlLeaseStore, r as getHostBinding, s as RuntimeName, t as HostBindingErrorCode, tt as toResultError, v as isViteHubError, w as RuntimeResourceInspector, x as RuntimeDiagnosticEvent, y as RuntimeDiagnosticError, z as LeaseAcquireOptions } from "./index-
|
|
3
|
-
import { n as hostedConsoleUrl } from "./hosted-console-
|
|
4
|
-
import { o as resolvePublicUrl, t as PublicUrlConfig } from "./public-url-
|
|
5
|
-
import { a as ExecutionBudgetOptions, i as ExecutionBudgetLimits, n as ExecutionBudgetCounter, o as ExecutionBudgetSnapshot, r as ExecutionBudgetExceededError, s as ExecutionBudgetUsage, t as ExecutionBudget } from "./execution-budget-
|
|
6
|
-
import { o as toResponse, t as SerializedResponse } from "./response-
|
|
1
|
+
import { A as RuntimeWaitUntil, B as TraceEventLogOptions, C as PolicyDecision, D as RuntimeCapabilityHandle, E as RuntimeCapabilities, F as TraceContext, G as TraceStepStatus, H as TracePayloadVisibility, I as TraceEvent, J as createRuntimeContext, K as TraceStepView, L as TraceEventContentPolicy, M as TraceActivityContext, N as TraceActivityOwner, O as RuntimeContextInput, P as TraceActivityPhase, Q as deriveTraceRuns, R as TraceEventLog, S as PolicyContext, T as RunLifecycleHooks, U as TraceRunStatus, V as TraceEventPayload, W as TraceRunView, X as createTraceEventLog, Z as defineCapability, _ as MaybeResolvable, a as AnonymousAccessAuthorizationContext, at as normalizeExecutionAuthority, b as OpenTelemetrySpanView, c as ApprovalRequest, d as CapabilityHandle, dt as ViteHubContext, et as getCapability, f as CapabilityPolicy, ft as ViteHubRuntime, g as MaybePromise, h as ExecutionContext, i as AccessAuthorizeResult, it as noExecutionAuthority, j as RuntimeWaitUntilController, k as RuntimeHostContext, l as ApprovalState, m as ExecutionAuthority, n as AccessAuthorize, nt as isExecutionAuthority, o as AnonymousAccessAuthorize, ot as resolveCapabilityPolicy, p as CreatedRuntimeContext, pt as ViteHubStandardProps, q as createExecutionContext, r as AccessAuthorizeOption, s as ApprovalDecision, t as AccessAuthorizationContext, tt as hasCapability, u as CapabilityDefinition, ut as unknownExecutionAuthority, v as OpenTelemetryLogRecordView, w as Resolvable, x as OpenTelemetrySpanViewOptions, y as OpenTelemetrySpanEventView, z as TraceEventLogEntry } from "./core-auTkK4iZ.js";
|
|
2
|
+
import { $ as ResultError, A as formatRuntimeDiagnosticError, B as LeaseErrorCode, C as RuntimeDiagnosticReporter, D as RuntimeResourceSnapshot, E as RuntimeResourceScope, F as parseDuration, G as LeaseStore, H as LeaseRecord, I as getInstanceId, J as DefineErrorsOptions, K as createMemoryLeaseStore, L as instanceIdEnv, M as normalizeRuntimeDiagnosticError, N as Duration, O as RuntimeResourceSupport, P as DurationUnit, Q as Result, R as Lease, S as RuntimeDiagnosticLevel, T as RuntimeResourceObservation, U as LeaseSqlClient, V as LeaseOperation, W as LeaseSqlParam, X as ErrorCodes, Y as ErrorCatalog, Z as ErrorHandle, _ as getViteHubErrorShape, a as RequestRuntimeContext, b as RuntimeDiagnosticErrorOptions, c as getRuntimeContext, et as defineErrors, f as ViteHubError, g as ViteHubErrorShape, h as ViteHubErrorOptions, i as ViteHubHost, j as isRuntimeDiagnostic, k as RuntimeResourceUnit, l as getStandardContext, m as ViteHubErrorDetails, n as detectHost, o as RuntimeContextOptions, p as ViteHubErrorDetail, q as createSqlLeaseStore, r as getHostBinding, s as RuntimeName, t as HostBindingErrorCode, tt as toResultError, v as isViteHubError, w as RuntimeResourceInspector, x as RuntimeDiagnosticEvent, y as RuntimeDiagnosticError, z as LeaseAcquireOptions } from "./index-hFKl7B_y.js";
|
|
3
|
+
import { n as hostedConsoleUrl } from "./hosted-console-DTh9zwNz.js";
|
|
4
|
+
import { o as resolvePublicUrl, t as PublicUrlConfig } from "./public-url-B4p8EOqr.js";
|
|
5
|
+
import { a as ExecutionBudgetOptions, i as ExecutionBudgetLimits, n as ExecutionBudgetCounter, o as ExecutionBudgetSnapshot, r as ExecutionBudgetExceededError, s as ExecutionBudgetUsage, t as ExecutionBudget } from "./execution-budget-Bv7h0-5V.js";
|
|
6
|
+
import { o as toResponse, t as SerializedResponse } from "./response-ClQ9ZSS_.js";
|
|
7
7
|
export { type AccessAuthorizationContext, type AccessAuthorize, type AccessAuthorizeOption, type AccessAuthorizeResult, type AnonymousAccessAuthorizationContext, type AnonymousAccessAuthorize, type ApprovalDecision, type ApprovalRequest, type ApprovalState, type CapabilityDefinition, type CapabilityHandle, type CapabilityPolicy, type CreatedRuntimeContext, type DefineErrorsOptions, type Duration, type DurationUnit, type ErrorCatalog, type ErrorCodes, type ErrorHandle, type ExecutionAuthority, type ExecutionBudget, type ExecutionBudgetCounter, type ExecutionBudgetExceededError, type ExecutionBudgetLimits, type ExecutionBudgetOptions, type ExecutionBudgetSnapshot, type ExecutionBudgetUsage, type ExecutionContext, type HostBindingErrorCode, type Lease, type LeaseAcquireOptions, type LeaseErrorCode, type LeaseOperation, type LeaseRecord, type LeaseSqlClient, type LeaseSqlParam, type LeaseStore, type MaybePromise, type MaybeResolvable, type OpenTelemetryLogRecordView, type OpenTelemetrySpanEventView, type OpenTelemetrySpanView, type OpenTelemetrySpanViewOptions, type PolicyContext, type PolicyDecision, type PublicUrlConfig, type RequestRuntimeContext, type Resolvable, type Result, type ResultError, type RunLifecycleHooks, type RuntimeCapabilities, type RuntimeCapabilityHandle, type RuntimeContextInput, type RuntimeContextOptions, type RuntimeDiagnosticError, type RuntimeDiagnosticErrorOptions, type RuntimeDiagnosticEvent, type RuntimeDiagnosticLevel, type RuntimeDiagnosticReporter, type RuntimeHostContext, type RuntimeName, type RuntimeResourceInspector, type RuntimeResourceObservation, type RuntimeResourceScope, type RuntimeResourceSnapshot, type RuntimeResourceSupport, type RuntimeResourceUnit, type RuntimeWaitUntil, type RuntimeWaitUntilController, type SerializedResponse, type TraceActivityContext, type TraceActivityOwner, type TraceActivityPhase, type TraceContext, type TraceEvent, type TraceEventContentPolicy, type TraceEventLog, type TraceEventLogEntry, type TraceEventLogOptions, type TraceEventPayload, type TracePayloadVisibility, type TraceRunStatus, type TraceRunView, type TraceStepStatus, type TraceStepView, type ViteHubContext, ViteHubError, type ViteHubErrorDetail, type ViteHubErrorDetails, type ViteHubErrorOptions, type ViteHubErrorShape, type ViteHubHost, type ViteHubRuntime, type ViteHubStandardProps, createExecutionContext, createMemoryLeaseStore, createRuntimeContext, createSqlLeaseStore, createTraceEventLog, defineCapability, defineErrors, deriveTraceRuns, detectHost, formatRuntimeDiagnosticError, getCapability, getHostBinding, getInstanceId, getRuntimeContext, getStandardContext, getViteHubErrorShape, hasCapability, hostedConsoleUrl, instanceIdEnv, isExecutionAuthority, isRuntimeDiagnostic, isViteHubError, noExecutionAuthority, normalizeExecutionAuthority, normalizeRuntimeDiagnosticError, parseDuration, resolveCapabilityPolicy, resolvePublicUrl, toResponse, toResultError, unknownExecutionAuthority };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { _ as instanceIdEnv, d as parseDuration, f as createMemoryLeaseStore, g as getInstanceId, h as toResultError, i as getStandardContext, l as detectHost, m as defineErrors, p as createSqlLeaseStore, r as getRuntimeContext, u as getHostBinding } from "./request-context-
|
|
2
|
-
import { n as getViteHubErrorShape, r as isViteHubError, t as ViteHubError } from "./errors-
|
|
3
|
-
import { a as defineCapability, c as getCapability, f as noExecutionAuthority, i as createTraceEventLog, l as hasCapability, m as resolveCapabilityPolicy, n as createRuntimeContext, o as deriveTraceRuns, p as normalizeExecutionAuthority, t as createExecutionContext, u as isExecutionAuthority, v as unknownExecutionAuthority } from "./core-
|
|
4
|
-
import { a as toResponse, c as normalizeRuntimeDiagnosticError, o as formatRuntimeDiagnosticError, s as isRuntimeDiagnostic } from "./response-
|
|
5
|
-
import { a as resolvePublicUrl, l as hostedConsoleUrl } from "./public-url-
|
|
1
|
+
import { _ as instanceIdEnv, d as parseDuration, f as createMemoryLeaseStore, g as getInstanceId, h as toResultError, i as getStandardContext, l as detectHost, m as defineErrors, p as createSqlLeaseStore, r as getRuntimeContext, u as getHostBinding } from "./request-context-Ci5FjuUY.js";
|
|
2
|
+
import { n as getViteHubErrorShape, r as isViteHubError, t as ViteHubError } from "./errors-D2ixvqv3.js";
|
|
3
|
+
import { a as defineCapability, c as getCapability, f as noExecutionAuthority, i as createTraceEventLog, l as hasCapability, m as resolveCapabilityPolicy, n as createRuntimeContext, o as deriveTraceRuns, p as normalizeExecutionAuthority, t as createExecutionContext, u as isExecutionAuthority, v as unknownExecutionAuthority } from "./core-Crv8CV_r.js";
|
|
4
|
+
import { a as toResponse, c as normalizeRuntimeDiagnosticError, o as formatRuntimeDiagnosticError, s as isRuntimeDiagnostic } from "./response-DEyMvEBF.js";
|
|
5
|
+
import { a as resolvePublicUrl, l as hostedConsoleUrl } from "./public-url-DDh_BHz3.js";
|
|
6
6
|
export { ViteHubError, createExecutionContext, createMemoryLeaseStore, createRuntimeContext, createSqlLeaseStore, createTraceEventLog, defineCapability, defineErrors, deriveTraceRuns, detectHost, formatRuntimeDiagnosticError, getCapability, getHostBinding, getInstanceId, getRuntimeContext, getStandardContext, getViteHubErrorShape, hasCapability, hostedConsoleUrl, instanceIdEnv, isExecutionAuthority, isRuntimeDiagnostic, isViteHubError, noExecutionAuthority, normalizeExecutionAuthority, normalizeRuntimeDiagnosticError, parseDuration, resolveCapabilityPolicy, resolvePublicUrl, toResponse, toResultError, unknownExecutionAuthority };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { i as normalizeConsoleProjectUrl, r as normalizeConsolePath, t as hostedConsoleOrigin } from "../hosted-console-
|
|
2
|
-
import { r as consoleInvocationUrl } from "../public-url-
|
|
3
|
-
//#region src/route-segment.d.ts
|
|
1
|
+
import { i as normalizeConsoleProjectUrl, r as normalizeConsolePath, t as hostedConsoleOrigin } from "../hosted-console-DTh9zwNz.js";
|
|
2
|
+
import { r as consoleInvocationUrl } from "../public-url-B4p8EOqr.js";
|
|
4
3
|
export declare function encodeRouteSegment(value: string): string;
|
|
5
4
|
export declare function decodeRouteSegment(segment: string): string | undefined;
|
|
6
|
-
//#endregion
|
|
7
5
|
export { consoleInvocationUrl, hostedConsoleOrigin, normalizeConsolePath, normalizeConsoleProjectUrl };
|
package/dist/internal/console.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { consoleInvocationUrl, decodeRouteSegment, encodeRouteSegment, hostedConsoleOrigin, normalizeConsolePath, normalizeConsoleProjectUrl };
|
|
1
|
+
export { n as consoleInvocationUrl, o as decodeRouteSegment, s as encodeRouteSegment, c as hostedConsoleOrigin, u as normalizeConsolePath, d as normalizeConsoleProjectUrl } from "../public-url-DDh_BHz3.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Y as createRuntimeWaitUntilController, rt as isResolvable, st as resolveRuntimeValue } from "../core-
|
|
1
|
+
import { Y as createRuntimeWaitUntilController, rt as isResolvable, st as resolveRuntimeValue } from "../core-auTkK4iZ.js";
|
|
2
2
|
export { createRuntimeWaitUntilController, isResolvable, resolveRuntimeValue };
|
package/dist/internal/context.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { createRuntimeWaitUntilController, isResolvable, resolveRuntimeValue };
|
|
1
|
+
export { r as createRuntimeWaitUntilController, d as isResolvable, h as resolveRuntimeValue } from "../core-Crv8CV_r.js";
|
package/dist/internal/drain.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/internal/drain.d.ts
|
|
2
1
|
/** The streams that `vitehub drain` writes to. */
|
|
3
2
|
export interface DrainOutput {
|
|
4
3
|
stderr: {
|
|
@@ -13,5 +12,4 @@ export declare const drainUsage = "vitehub drain MAINPID [STATUS_URL]";
|
|
|
13
12
|
* `vitehub drain MAINPID [STATUS_URL]`: sends the drain signal to a running server and waits until its status endpoint
|
|
14
13
|
* reports `drained`. Returns 0 when it drained, 1 when it failed, and 2 for a usage error.
|
|
15
14
|
*/
|
|
16
|
-
export declare function runDrain(args: readonly string[], output: DrainOutput): Promise<number>;
|
|
17
|
-
//#endregion
|
|
15
|
+
export declare function runDrain(args: readonly string[], output: DrainOutput): Promise<number>;
|
package/dist/internal/drain.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as runtimeErrorDiagnostics } from "../error-diagnostics-
|
|
2
|
-
|
|
1
|
+
import { t as runtimeErrorDiagnostics } from "../error-diagnostics-Dj98U7ch.js";
|
|
2
|
+
// src/internal/drain-process.ts
|
|
3
3
|
/** Check whether a process still exists without confusing access denial for exit. */
|
|
4
4
|
function isProcessRunning(pid) {
|
|
5
5
|
try {
|
|
@@ -23,8 +23,7 @@ function signalProcess(pid) {
|
|
|
23
23
|
throw error;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
//#region src/internal/drain.ts
|
|
26
|
+
// src/internal/drain.ts
|
|
28
27
|
const drainUsage = "vitehub drain MAINPID [STATUS_URL]";
|
|
29
28
|
async function readStatus(statusUrl) {
|
|
30
29
|
try {
|
|
@@ -71,5 +70,4 @@ async function runDrain(args, output) {
|
|
|
71
70
|
return 1;
|
|
72
71
|
}
|
|
73
72
|
}
|
|
74
|
-
//#endregion
|
|
75
73
|
export { drainUsage, runDrain };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as runtimeErrorDiagnostics } from "../error-diagnostics-
|
|
1
|
+
import { t as runtimeErrorDiagnostics } from "../error-diagnostics-DuusexaK.js";
|
|
2
2
|
export { runtimeErrorDiagnostics };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { runtimeErrorDiagnostics };
|
|
1
|
+
export { t as runtimeErrorDiagnostics } from "../error-diagnostics-Dj98U7ch.js";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { c as createExecutionBudget, l as isExecutionBudgetExceededError, t as ExecutionBudget } from "../execution-budget-
|
|
2
|
-
//#region src/internal/execution-budget.d.ts
|
|
1
|
+
import { c as createExecutionBudget, l as isExecutionBudgetExceededError, t as ExecutionBudget } from "../execution-budget-Bv7h0-5V.js";
|
|
3
2
|
/** Internal context key used when a budget-owned tool is reused by another Invocation. */
|
|
4
3
|
export declare const executionBudgetOverride: unique symbol;
|
|
5
4
|
/** Internal context key used when a policy wrapper already charged a call. */
|
|
@@ -7,5 +6,4 @@ export declare const executionBudgetCharged: unique symbol;
|
|
|
7
6
|
export declare function markExecutionBudgetHandled(tool: object, budget: ExecutionBudget): void;
|
|
8
7
|
export declare function isExecutionBudgetHandled(tool: object, budget: ExecutionBudget): boolean;
|
|
9
8
|
export declare function executionBudgetHandledBy(tool: object): ExecutionBudget | undefined;
|
|
10
|
-
//#endregion
|
|
11
9
|
export { createExecutionBudget, isExecutionBudgetExceededError };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as runtimeErrorDiagnostics } from "../error-diagnostics-
|
|
2
|
-
|
|
1
|
+
import { t as runtimeErrorDiagnostics } from "../error-diagnostics-Dj98U7ch.js";
|
|
2
|
+
// src/execution-budget.ts
|
|
3
3
|
function executionBudgetExceededError(counter, limit) {
|
|
4
4
|
return Object.assign(runtimeErrorDiagnostics.RUNTIME_EXECUTION_BUDGET_EXCEEDED({ counter }), {
|
|
5
5
|
counter,
|
|
@@ -222,8 +222,7 @@ function normalizeLimits(options) {
|
|
|
222
222
|
maxToolCalls: normalize(options.maxToolCalls)
|
|
223
223
|
};
|
|
224
224
|
}
|
|
225
|
-
|
|
226
|
-
//#region src/internal/execution-budget.ts
|
|
225
|
+
// src/internal/execution-budget.ts
|
|
227
226
|
const budgetHandledTools = /* @__PURE__ */ new WeakMap();
|
|
228
227
|
/** Internal context key used when a budget-owned tool is reused by another Invocation. */
|
|
229
228
|
const executionBudgetOverride = Symbol("vitehub.execution-budget-override");
|
|
@@ -238,5 +237,4 @@ function isExecutionBudgetHandled(tool, budget) {
|
|
|
238
237
|
function executionBudgetHandledBy(tool) {
|
|
239
238
|
return budgetHandledTools.get(tool);
|
|
240
239
|
}
|
|
241
|
-
//#endregion
|
|
242
240
|
export { createExecutionBudget, executionBudgetCharged, executionBudgetHandledBy, executionBudgetOverride, isExecutionBudgetExceededError, isExecutionBudgetHandled, markExecutionBudgetHandled };
|
package/dist/internal/grant.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/internal/grant.d.ts
|
|
2
1
|
declare const grantKind: unique symbol;
|
|
3
2
|
/**
|
|
4
3
|
* Proof that one check passed. Only the definition that issued it can verify it.
|
|
@@ -33,4 +32,4 @@ export interface GrantDefinition<Kind extends string, Input, Value> {
|
|
|
33
32
|
* another bundled copy, or a forged object fails closed. Grants are request-scoped. Never persist one.
|
|
34
33
|
*/
|
|
35
34
|
export declare function defineGrant<const Kind extends string, Input, Value>(kind: Kind, bind: (input: Input) => Value): GrantDefinition<Kind, Input, Value>;
|
|
36
|
-
|
|
35
|
+
export {};
|
package/dist/internal/grant.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { t as ViteHubError } from "../errors-D2ixvqv3.js";
|
|
2
|
+
import { r as isRuntimeObject } from "../runtime-type-EgaBGoVU.js";
|
|
3
|
+
// src/internal/grant.ts
|
|
4
4
|
/**
|
|
5
5
|
* Define one kind of grant. Keep the definition module-private: the module that owns the check issues grants,
|
|
6
6
|
* and the sensitive action verifies them. Each definition has its own registry, so a grant from another definition,
|
|
@@ -40,5 +40,4 @@ function defineGrant(kind, bind) {
|
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
//#endregion
|
|
44
43
|
export { defineGrant };
|
package/dist/internal/h3.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { a as RequestRuntimeContext, d as sendPreparedResponse, o as RuntimeContextOptions, u as installRequestStandardContext } from "../index-hFKl7B_y.js";
|
|
2
|
+
import { dt as ViteHubContext, ft as ViteHubRuntime, pt as ViteHubStandardProps } from "../core-auTkK4iZ.js";
|
|
3
3
|
import { EventHandlerRequest } from "h3";
|
|
4
|
-
//#region src/internal/h3.d.ts
|
|
5
4
|
declare module "h3" {
|
|
6
5
|
interface H3Event<_RequestT extends EventHandlerRequest = EventHandlerRequest> {
|
|
7
6
|
readonly "~standard": ViteHubStandardProps;
|
|
@@ -38,5 +37,4 @@ export declare function getStandardContext(value: Request | ViteHubContext): Vit
|
|
|
38
37
|
/** Adapt one request. Pass an H3 event or a web Request. Await flushWaitUntil when the host has no lifetime API. */
|
|
39
38
|
export declare function getRuntimeContext(value: Request | ViteHubContext): H3RuntimeContext;
|
|
40
39
|
export declare function getRuntimeContext<const TOptions extends H3RuntimeContextOptions>(value: Request | ViteHubContext, options: TOptions): H3RuntimeContext<TOptions>;
|
|
41
|
-
//#endregion
|
|
42
40
|
export { type ViteHubContext, type ViteHubRuntime, type ViteHubStandardProps, installRequestStandardContext, sendPreparedResponse };
|
package/dist/internal/h3.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { S as ownValue, a as installRequestStandardContext, b as getCloudflareEnv, c as sendPreparedResponse, i as getStandardContext$1, n as firstAddress, o as isHostRequest, s as requestAddressPaths, t as createStandardRuntimeContext, v as activeEnvStorageKey, x as ownObject, y as cloudflareOwners } from "../request-context-
|
|
2
|
-
import { t as runtimeErrorDiagnostics } from "../error-diagnostics-
|
|
1
|
+
import { S as ownValue, a as installRequestStandardContext, b as getCloudflareEnv, c as sendPreparedResponse, i as getStandardContext$1, n as firstAddress, o as isHostRequest, s as requestAddressPaths, t as createStandardRuntimeContext, v as activeEnvStorageKey, x as ownObject, y as cloudflareOwners } from "../request-context-Ci5FjuUY.js";
|
|
2
|
+
import { t as runtimeErrorDiagnostics } from "../error-diagnostics-Dj98U7ch.js";
|
|
3
3
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
|
-
|
|
4
|
+
// ../internal/dist/runtime/cloudflare-env.js
|
|
5
5
|
const runtimeGlobal = globalThis;
|
|
6
6
|
runtimeGlobal[activeEnvStorageKey] ||= new AsyncLocalStorage();
|
|
7
7
|
/** Return the Cloudflare Worker execution context of a request event, if the host provides one. */
|
|
@@ -38,8 +38,7 @@ function resolveWaitUntil(event, options = {}) {
|
|
|
38
38
|
if (typeof waitUntil === "function") return waitUntil.bind(owner);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
//#region src/internal/h3.ts
|
|
41
|
+
// src/internal/h3.ts
|
|
43
42
|
function responseHeaders(target) {
|
|
44
43
|
const { headers, errHeaders } = target;
|
|
45
44
|
if (!errHeaders) return headers;
|
|
@@ -171,5 +170,4 @@ function getRuntimeContext(value, options = {}) {
|
|
|
171
170
|
}
|
|
172
171
|
return createStandardRuntimeContext(value, value["~standard"], options);
|
|
173
172
|
}
|
|
174
|
-
//#endregion
|
|
175
173
|
export { getRuntimeContext, getStandardContext, installRequestStandardContext, installStandardContext, sendPreparedResponse };
|
package/dist/internal/node.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { w as RuntimeResourceInspector } from "../index-
|
|
2
|
-
//#region src/internal/node.d.ts
|
|
1
|
+
import { w as RuntimeResourceInspector } from "../index-hFKl7B_y.js";
|
|
3
2
|
type ReadText = (path: string, options?: {
|
|
4
3
|
signal?: AbortSignal;
|
|
5
4
|
}) => Promise<string>;
|
|
@@ -30,4 +29,4 @@ export interface ProcessReconciler extends ProcessReconcilerRunContext {
|
|
|
30
29
|
wake: (reason: string) => void;
|
|
31
30
|
}
|
|
32
31
|
export declare function createProcessReconciler(options: ProcessReconcilerOptions): ProcessReconciler;
|
|
33
|
-
|
|
32
|
+
export {};
|
package/dist/internal/node.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as runtimeErrorDiagnostics } from "../error-diagnostics-
|
|
1
|
+
import { t as runtimeErrorDiagnostics } from "../error-diagnostics-Dj98U7ch.js";
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
3
|
import { readFile } from "node:fs/promises";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { availableMemory, memoryUsage, resourceUsage } from "node:process";
|
|
6
|
-
|
|
6
|
+
// src/internal/node.ts
|
|
7
7
|
function observation(name, value, scope, source, unit) {
|
|
8
8
|
return value === void 0 || !Number.isFinite(value) ? [] : [{
|
|
9
9
|
name,
|
|
@@ -395,5 +395,4 @@ function createProcessReconciler(options) {
|
|
|
395
395
|
wake
|
|
396
396
|
};
|
|
397
397
|
}
|
|
398
|
-
//#endregion
|
|
399
398
|
export { createProcessReconciler, nodeRuntimeResources, resolveLinuxCgroupV2Path };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as resetPublicUrlAgentNames, i as registerPublicUrlAgentName, n as configuredPublicOrigins } from "../public-url-
|
|
1
|
+
import { a as resetPublicUrlAgentNames, i as registerPublicUrlAgentName, n as configuredPublicOrigins } from "../public-url-B4p8EOqr.js";
|
|
2
2
|
export { configuredPublicOrigins, registerPublicUrlAgentName, resetPublicUrlAgentNames };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { configuredPublicOrigins, registerPublicUrlAgentName, resetPublicUrlAgentNames };
|
|
1
|
+
export { t as configuredPublicOrigins, r as registerPublicUrlAgentName, i as resetPublicUrlAgentNames } from "../public-url-DDh_BHz3.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as serializeResponse, i as isSerializedResponse, n as deserializeResponse, o as toResponse, r as isResponse } from "../response-
|
|
1
|
+
import { a as serializeResponse, i as isSerializedResponse, n as deserializeResponse, o as toResponse, r as isResponse } from "../response-ClQ9ZSS_.js";
|
|
2
2
|
export { deserializeResponse, isResponse, isSerializedResponse, serializeResponse, toResponse };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { deserializeResponse, isResponse, isSerializedResponse, serializeResponse, toResponse };
|
|
1
|
+
export { t as deserializeResponse, n as isResponse, r as isSerializedResponse, i as serializeResponse, a as toResponse } from "../response-DEyMvEBF.js";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/internal/run-failed.d.ts
|
|
2
1
|
/** The error of a failed run: its message and, for a ViteHub error, its code. */
|
|
3
2
|
export interface RunFailedError {
|
|
4
3
|
message: string;
|
|
@@ -36,5 +35,4 @@ export declare function toRunFailedError(error: unknown): RunFailedError;
|
|
|
36
35
|
* serverless host keeps the work alive, and it never throws: an alert that fails must not change the run.
|
|
37
36
|
*/
|
|
38
37
|
export declare function emitRunFailed(event: RunFailedEvent): Promise<void>;
|
|
39
|
-
export declare function hasRunFailedListeners(): boolean;
|
|
40
|
-
//#endregion
|
|
38
|
+
export declare function hasRunFailedListeners(): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/internal/run-failed.ts
|
|
2
2
|
const runFailedEventNames = [
|
|
3
3
|
"invocation.failed",
|
|
4
4
|
"schedule.failed",
|
|
@@ -51,5 +51,4 @@ async function emitRunFailed(event) {
|
|
|
51
51
|
function hasRunFailedListeners() {
|
|
52
52
|
return listeners().size > 0;
|
|
53
53
|
}
|
|
54
|
-
//#endregion
|
|
55
54
|
export { emitRunFailed, hasRunFailedListeners, onRunFailed, runFailedEventNames, toRunFailedError };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/internal/run-scope.d.ts
|
|
2
1
|
/** Wraps one unit of work, such as a Schedule run or a Queue job. It calls `run` once and passes on its error. */
|
|
3
2
|
export type RunScope = (run: () => Promise<void>) => Promise<unknown>;
|
|
4
3
|
/**
|
|
@@ -7,5 +6,4 @@ export type RunScope = (run: () => Promise<void>) => Promise<unknown>;
|
|
|
7
6
|
*/
|
|
8
7
|
export declare function registerRunScope(scope: RunScope): void;
|
|
9
8
|
/** Runs one Schedule run or Queue job inside every registered scope. A Nitro request gets its scopes from middleware. */
|
|
10
|
-
export declare function runInRunScopes<T>(run: () => T | Promise<T>): Promise<T>;
|
|
11
|
-
//#endregion
|
|
9
|
+
export declare function runInRunScopes<T>(run: () => T | Promise<T>): Promise<T>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/internal/run-scope.ts
|
|
2
2
|
const scopesKey = Symbol.for("vitehub.runtime.runScopes");
|
|
3
3
|
function scopes() {
|
|
4
4
|
const runtimeGlobal = globalThis;
|
|
@@ -26,5 +26,4 @@ async function runInRunScopes(run) {
|
|
|
26
26
|
await next();
|
|
27
27
|
return result;
|
|
28
28
|
}
|
|
29
|
-
//#endregion
|
|
30
29
|
export { registerRunScope, runInRunScopes };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { t as runtimeErrorDiagnostics } from "../error-diagnostics-
|
|
2
|
-
//#region src/internal/runtime-type.d.ts
|
|
1
|
+
import { t as runtimeErrorDiagnostics } from "../error-diagnostics-DuusexaK.js";
|
|
3
2
|
type RuntimeTypeMap = {
|
|
4
3
|
bigint: bigint;
|
|
5
4
|
boolean: boolean;
|
|
@@ -22,5 +21,4 @@ export declare function isRuntimeObject(value: unknown): value is object;
|
|
|
22
21
|
* and a Response from another Fetch implementation all fail. A proxy fails too. The check reads no property of `value`.
|
|
23
22
|
*/
|
|
24
23
|
export declare function isRuntimeResponse(value: unknown): value is Response;
|
|
25
|
-
//#endregion
|
|
26
24
|
export { runtimeErrorDiagnostics };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as runtimeErrorDiagnostics } from "../error-diagnostics-
|
|
2
|
-
import { i as isRuntimeResponse, n as hasRuntimeType, r as isRuntimeObject, t as asUnknownBoundary } from "../runtime-type-
|
|
1
|
+
import { t as runtimeErrorDiagnostics } from "../error-diagnostics-Dj98U7ch.js";
|
|
2
|
+
import { i as isRuntimeResponse, n as hasRuntimeType, r as isRuntimeObject, t as asUnknownBoundary } from "../runtime-type-EgaBGoVU.js";
|
|
3
3
|
export { asUnknownBoundary, hasRuntimeType, isRuntimeObject, isRuntimeResponse, runtimeErrorDiagnostics };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/internal/shutdown.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Graceful shutdown that ViteHub owns.
|
|
4
3
|
*
|
|
@@ -80,5 +79,4 @@ export declare function runShutdownDrains(app?: ShutdownApp, runtime?: ShutdownR
|
|
|
80
79
|
* The drain runs when a server that owns stop signals gets SIGTERM or SIGINT, or when the
|
|
81
80
|
* Nitro app closes. All drains share the budget in `VITEHUB_SHUTDOWN_DRAIN_MS`.
|
|
82
81
|
*/
|
|
83
|
-
export declare function onShutdown(app: ShutdownApp, name: string, drain: ShutdownDrain, runtime?: ShutdownRuntime | undefined): void;
|
|
84
|
-
//#endregion
|
|
82
|
+
export declare function onShutdown(app: ShutdownApp, name: string, drain: ShutdownDrain, runtime?: ShutdownRuntime | undefined): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/internal/shutdown.ts
|
|
2
2
|
/** Name of the variable that sets the shared drain budget in milliseconds. The default is 0. */
|
|
3
3
|
const shutdownDrainEnv = "VITEHUB_SHUTDOWN_DRAIN_MS";
|
|
4
4
|
const settleMs = 15e3;
|
|
@@ -196,5 +196,4 @@ function onShutdown(app, name, drain, runtime = currentProcess()) {
|
|
|
196
196
|
else state.trap = "skipped";
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
|
-
//#endregion
|
|
200
199
|
export { onShutdown, runShutdownDrains, shutdownDrainEnv, shutdownState };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { ViteHubTestMode } from "./test-mode.js";
|
|
2
|
-
//#region src/internal/test-mode-setup.d.ts
|
|
3
2
|
/** Turns test mode on for this process, or returns the active one. */
|
|
4
3
|
export declare function enableViteHubTestMode(options?: {
|
|
5
4
|
root?: string;
|
|
6
|
-
}): ViteHubTestMode;
|
|
7
|
-
//#endregion
|
|
5
|
+
}): ViteHubTestMode;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { viteHubTestModeKey } from "./test-mode.js";
|
|
2
|
-
|
|
2
|
+
// src/internal/test-mode-setup.ts
|
|
3
3
|
const processRoots = /* @__PURE__ */ new Map();
|
|
4
4
|
function isRunning(pid) {
|
|
5
5
|
try {
|
|
@@ -106,5 +106,4 @@ function enableViteHubTestMode(options = {}) {
|
|
|
106
106
|
target[viteHubTestModeKey] = mode;
|
|
107
107
|
return mode;
|
|
108
108
|
}
|
|
109
|
-
//#endregion
|
|
110
109
|
export { enableViteHubTestMode };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/internal/test-mode.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Test mode for app tests. `vite-hub/test` turns it on, and each Server Primitive then uses a local backend that lives
|
|
4
3
|
* until the next reset, instead of its configured driver. The state is on `globalThis`, so every package copy in the
|
|
@@ -28,5 +27,4 @@ export type ViteHubTestModeGlobal = typeof globalThis & {
|
|
|
28
27
|
[viteHubTestModeKey]?: ViteHubTestMode;
|
|
29
28
|
};
|
|
30
29
|
/** The active test mode, or `undefined` outside tests. */
|
|
31
|
-
export declare function getViteHubTestMode(): ViteHubTestMode | undefined;
|
|
32
|
-
//#endregion
|
|
30
|
+
export declare function getViteHubTestMode(): ViteHubTestMode | undefined;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
// src/internal/test-mode.ts
|
|
2
2
|
/** The `globalThis` key of the active test mode. */
|
|
3
3
|
const viteHubTestModeKey = Symbol.for("vitehub.test");
|
|
4
4
|
/** The active test mode, or `undefined` outside tests. */
|
|
5
5
|
function getViteHubTestMode() {
|
|
6
6
|
return globalThis[viteHubTestModeKey];
|
|
7
7
|
}
|
|
8
|
-
//#endregion
|
|
9
8
|
export { getViteHubTestMode, viteHubTestModeKey };
|
package/dist/internal/trace.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { $ as emitTraceEvent, ct as traceEventsToOpenTelemetryLogRecords, lt as traceEventsToOpenTelemetrySpans } from "../core-
|
|
2
|
-
import "../index-
|
|
3
|
-
//#region src/internal/trace-attributes.d.ts
|
|
1
|
+
import { $ as emitTraceEvent, ct as traceEventsToOpenTelemetryLogRecords, lt as traceEventsToOpenTelemetrySpans } from "../core-auTkK4iZ.js";
|
|
2
|
+
import "../index-hFKl7B_y.js";
|
|
4
3
|
export declare function isTraceContentAttributeKey(key: string): boolean;
|
|
5
|
-
//#endregion
|
|
6
4
|
export { emitTraceEvent, traceEventsToOpenTelemetryLogRecords, traceEventsToOpenTelemetrySpans };
|
package/dist/internal/trace.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { emitTraceEvent, isTraceContentAttributeKey, traceEventsToOpenTelemetryLogRecords, traceEventsToOpenTelemetrySpans };
|
|
1
|
+
export { s as emitTraceEvent, y as isTraceContentAttributeKey, g as traceEventsToOpenTelemetryLogRecords, _ as traceEventsToOpenTelemetrySpans } from "../core-Crv8CV_r.js";
|
package/dist/operations.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
2
|
-
//#region ../internal/dist/operation-definition-C0NDEa7Q.d.ts
|
|
3
|
-
//#region src/operation-definition.d.ts
|
|
4
2
|
/** `read` never changes state. `write` changes state. `destructive` deletes or publishes. */
|
|
5
3
|
type OperationKind = "read" | "write" | "destructive";
|
|
6
4
|
/** The signed-in user of a call. */
|
|
@@ -174,5 +172,4 @@ interface OperationContributingPlugin {
|
|
|
174
172
|
operations?: OperationContributions;
|
|
175
173
|
};
|
|
176
174
|
}
|
|
177
|
-
//#endregion
|
|
178
175
|
export { type OperationAccess, type OperationActor, type OperationContext, type OperationContributingPlugin, type OperationContributionEntry, type OperationContributions, type OperationDefinition, type OperationFailure, type OperationKind, type OperationResult, type OperationUser, defineOperation };
|
package/dist/operations.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineDiagnostics } from "nostics";
|
|
2
2
|
import { toJsonSchema } from "@valibot/to-json-schema";
|
|
3
|
-
|
|
3
|
+
// ../internal/dist/error-diagnostics-B5oT1e3D.js
|
|
4
4
|
const dynamicError = { why: ({ message }) => message === void 0 ? "" : String(message) };
|
|
5
5
|
const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
6
6
|
docsBase: "https://vitehub.dev/docs/development/diagnostics",
|
|
@@ -257,6 +257,10 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
257
257
|
why: ({ minimum }) => `[vitehub] VITEHUB_SECRET must be at least ${minimum} characters. Generate one with \`openssl rand -base64 32\`.`,
|
|
258
258
|
fix: "Set `VITEHUB_SECRET` to the output of `openssl rand -base64 32`, which has 44 characters."
|
|
259
259
|
},
|
|
260
|
+
INTERNAL_SITE_TOKEN_TOO_LONG: {
|
|
261
|
+
why: ({ length, maximum }) => `The Site access token is ${length} characters, and an app accepts ${maximum}.`,
|
|
262
|
+
fix: "Open the app with a shorter path, or give the person and the project shorter names, so that the Site access token fits."
|
|
263
|
+
},
|
|
260
264
|
INTERNAL_SQLITE_ARGUMENT_INVALID: {
|
|
261
265
|
why: ({ value }) => value === "undefined" ? "undefined cannot be passed as argument to the database" : "Only finite numbers (not Infinity or NaN) can be passed as arguments",
|
|
262
266
|
fix: "Pass query arguments as finite numbers, strings, booleans, bigints, dates, byte arrays, or null. Replace undefined with null, and check numbers with `Number.isFinite()` before the query."
|
|
@@ -271,14 +275,12 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
271
275
|
}
|
|
272
276
|
}
|
|
273
277
|
});
|
|
274
|
-
|
|
275
|
-
//#region ../internal/dist/object.js
|
|
278
|
+
// ../internal/dist/object.js
|
|
276
279
|
/** A non-null object or a function that is not an array. */
|
|
277
280
|
function isRecordOrFunction(value) {
|
|
278
281
|
return Object(value) === value && !Array.isArray(value);
|
|
279
282
|
}
|
|
280
|
-
|
|
281
|
-
//#region ../internal/dist/standard-schema.js
|
|
283
|
+
// ../internal/dist/standard-schema.js
|
|
282
284
|
function readOwn(value, key) {
|
|
283
285
|
if (value === null || Object(value) !== value) return;
|
|
284
286
|
try {
|
|
@@ -307,8 +309,7 @@ function standardJsonSchema(schema, direction, target = "draft-2020-12", library
|
|
|
307
309
|
return;
|
|
308
310
|
}
|
|
309
311
|
}
|
|
310
|
-
|
|
311
|
-
//#region ../internal/dist/valibot.js
|
|
312
|
+
// ../internal/dist/valibot.js
|
|
312
313
|
const valibotTargets = /* @__PURE__ */ new Set([
|
|
313
314
|
"draft-07",
|
|
314
315
|
"draft-2020-12",
|
|
@@ -349,8 +350,7 @@ function withValibotJsonSchema(schema, options = {}) {
|
|
|
349
350
|
}
|
|
350
351
|
};
|
|
351
352
|
}
|
|
352
|
-
|
|
353
|
-
//#region ../internal/dist/operation-definition.js
|
|
353
|
+
// ../internal/dist/operation-definition.js
|
|
354
354
|
const nameFormat = /^[a-z][a-z0-9-]*\.[a-z][a-z0-9-]*$/;
|
|
355
355
|
const kinds = /* @__PURE__ */ new Set([
|
|
356
356
|
"read",
|
|
@@ -410,5 +410,4 @@ function isSectionId(section) {
|
|
|
410
410
|
function operationInputJsonSchema(operation) {
|
|
411
411
|
return standardJsonSchema(operation.input, "input") ?? { type: "object" };
|
|
412
412
|
}
|
|
413
|
-
//#endregion
|
|
414
413
|
export { defineOperation };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/public-url.d.ts
|
|
2
1
|
/** Public origins resolved from `vitehub({ publicUrl })` at build time. */
|
|
3
2
|
interface PublicUrlConfig {
|
|
4
3
|
/** One origin for the whole deployment. */
|
|
@@ -35,5 +34,4 @@ declare function resolvePublicUrl(options?: {
|
|
|
35
34
|
* `origin` must not include the application base path. The hosted Console checks the project URL when it opens the link.
|
|
36
35
|
*/
|
|
37
36
|
declare function consoleInvocationUrl(origin: string, agentName: string, invocationId: string): string;
|
|
38
|
-
//#endregion
|
|
39
37
|
export { resetPublicUrlAgentNames as a, registerPublicUrlAgentName as i, configuredPublicOrigins as n, resolvePublicUrl as o, consoleInvocationUrl as r, PublicUrlConfig as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as runtimeErrorDiagnostics } from "./error-diagnostics-
|
|
2
|
-
|
|
1
|
+
import { t as runtimeErrorDiagnostics } from "./error-diagnostics-Dj98U7ch.js";
|
|
2
|
+
// src/hosted-console.ts
|
|
3
3
|
/** The origin of the hosted Console. */
|
|
4
4
|
const hostedConsoleOrigin = "https://console.vitehub.dev";
|
|
5
5
|
const loopbackHosts = /* @__PURE__ */ new Set([
|
|
@@ -68,8 +68,7 @@ function hostedConsoleUrl(projectUrl, path, consoleOrigin = hostedConsoleOrigin)
|
|
|
68
68
|
}).toString();
|
|
69
69
|
return url.href;
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
//#region src/route-segment.ts
|
|
71
|
+
// src/route-segment.ts
|
|
73
72
|
const plainSegment = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
74
73
|
function encodeRouteSegment(value) {
|
|
75
74
|
if (plainSegment.test(value)) return value;
|
|
@@ -84,8 +83,7 @@ function decodeRouteSegment(segment) {
|
|
|
84
83
|
for (let index = 1; index < segment.length; index += 4) value += String.fromCharCode(Number.parseInt(segment.slice(index, index + 4), 16));
|
|
85
84
|
return encodeRouteSegment(value) === segment ? value : void 0;
|
|
86
85
|
}
|
|
87
|
-
|
|
88
|
-
//#region src/public-url.ts
|
|
86
|
+
// src/public-url.ts
|
|
89
87
|
const publicUrlAgentNames = /* @__PURE__ */ new Map();
|
|
90
88
|
/** Replace aliases when a generated Agent registry is installed. */
|
|
91
89
|
function resetPublicUrlAgentNames() {
|
|
@@ -144,5 +142,4 @@ function consoleInvocationUrl(origin, agentName, invocationId) {
|
|
|
144
142
|
const path = `/agents/${encodeRouteSegment(agentName)}/invocations/${encodeURIComponent(invocationId)}`;
|
|
145
143
|
return `${hostedConsoleOrigin}/open?project=${encodeURIComponent(project)}&path=${encodeURIComponent(path)}`;
|
|
146
144
|
}
|
|
147
|
-
//#endregion
|
|
148
145
|
export { resolvePublicUrl as a, hostedConsoleOrigin as c, normalizeConsoleProjectUrl as d, resetPublicUrlAgentNames as i, hostedConsoleUrl as l, consoleInvocationUrl as n, decodeRouteSegment as o, registerPublicUrlAgentName as r, encodeRouteSegment as s, configuredPublicOrigins as t, normalizeConsolePath as u };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as runtimeErrorDiagnostics } from "./error-diagnostics-
|
|
2
|
-
import { n as createRuntimeContext } from "./core-
|
|
3
|
-
import { s as isRuntimeDiagnostic } from "./response-
|
|
1
|
+
import { t as runtimeErrorDiagnostics } from "./error-diagnostics-Dj98U7ch.js";
|
|
2
|
+
import { n as createRuntimeContext } from "./core-Crv8CV_r.js";
|
|
3
|
+
import { s as isRuntimeDiagnostic } from "./response-DEyMvEBF.js";
|
|
4
4
|
import { Diagnostic, defineDiagnostics } from "nostics";
|
|
5
|
-
|
|
5
|
+
// ../internal/dist/runtime/cloudflare-env-lookup.js
|
|
6
6
|
/** The key of the AsyncLocalStorage store on `globalThis`. Every bundled copy of this module shares the store. */
|
|
7
7
|
const activeEnvStorageKey = Symbol.for("vitehub.cloudflare.env-storage");
|
|
8
8
|
let activeEnv;
|
|
@@ -39,8 +39,7 @@ function getCloudflareEnv(event, options = {}) {
|
|
|
39
39
|
for (const candidate of [ownValue(target, "env"), ...cloudflareOwners(target).map((owner) => ownValue(owner, "env"))]) if (candidate) return candidate;
|
|
40
40
|
return options.fallback === false ? void 0 : getActiveCloudflareEnv();
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
//#region src/instance.ts
|
|
42
|
+
// src/instance.ts
|
|
44
43
|
/** The environment variable that names this server instance. */
|
|
45
44
|
const instanceIdEnv = "VITEHUB_INSTANCE_ID";
|
|
46
45
|
const generatedKey = Symbol.for("vitehub.runtime.instance-id");
|
|
@@ -68,8 +67,7 @@ function getInstanceId() {
|
|
|
68
67
|
const state = globalThis;
|
|
69
68
|
return state[generatedKey] ??= generatedInstanceId();
|
|
70
69
|
}
|
|
71
|
-
|
|
72
|
-
//#region src/result.ts
|
|
70
|
+
// src/result.ts
|
|
73
71
|
const resultErrorBrand = Symbol.for("vitehub.runtime.resultError");
|
|
74
72
|
/**
|
|
75
73
|
* Prepares a recognized diagnostic for a result, keeping its metadata in memory.
|
|
@@ -139,8 +137,7 @@ function defineErrors(options) {
|
|
|
139
137
|
}
|
|
140
138
|
return catalog;
|
|
141
139
|
}
|
|
142
|
-
|
|
143
|
-
//#region src/lease.ts
|
|
140
|
+
// src/lease.ts
|
|
144
141
|
const leaseErrorDiagnostics = /*#__PURE__*/ defineErrors({
|
|
145
142
|
docs: "https://vitehub.dev/docs/runtime/diagnostics",
|
|
146
143
|
codes: {
|
|
@@ -366,8 +363,7 @@ function createSqlLeaseStore(client) {
|
|
|
366
363
|
}
|
|
367
364
|
});
|
|
368
365
|
}
|
|
369
|
-
|
|
370
|
-
//#region src/duration.ts
|
|
366
|
+
// src/duration.ts
|
|
371
367
|
const second = 1e3;
|
|
372
368
|
const minute = 60 * second;
|
|
373
369
|
const hour = 60 * minute;
|
|
@@ -490,8 +486,7 @@ function detectHost$1(env = process.env) {
|
|
|
490
486
|
}
|
|
491
487
|
return providerHosts.find(([name]) => env[name]?.trim())?.[1];
|
|
492
488
|
}
|
|
493
|
-
|
|
494
|
-
//#region src/host.ts
|
|
489
|
+
// src/host.ts
|
|
495
490
|
const hostBindingErrors = /*#__PURE__*/ defineErrors({
|
|
496
491
|
docs: "https://vitehub.dev/docs/runtime/diagnostics",
|
|
497
492
|
codes: {
|
|
@@ -534,8 +529,7 @@ function getHostBinding(name, event) {
|
|
|
534
529
|
function hostBindingsOf(event) {
|
|
535
530
|
return event["~standard"]?.runtime?.cloudflare?.env ?? getCloudflareEnv(event, { fallback: false });
|
|
536
531
|
}
|
|
537
|
-
|
|
538
|
-
//#region src/request-context.ts
|
|
532
|
+
// src/request-context.ts
|
|
539
533
|
function isObjectLike(value) {
|
|
540
534
|
return value !== null && (typeof value === "object" || typeof value === "function");
|
|
541
535
|
}
|
|
@@ -683,5 +677,4 @@ function createStandardRuntimeContext(event, standard, options) {
|
|
|
683
677
|
function getRuntimeContext(value, options = {}) {
|
|
684
678
|
return createStandardRuntimeContext(value, getStandardContext(value), options);
|
|
685
679
|
}
|
|
686
|
-
//#endregion
|
|
687
680
|
export { ownValue as S, instanceIdEnv as _, installRequestStandardContext as a, getCloudflareEnv as b, sendPreparedResponse as c, parseDuration as d, createMemoryLeaseStore as f, getInstanceId as g, toResultError as h, getStandardContext as i, detectHost as l, defineErrors as m, firstAddress as n, isHostRequest as o, createSqlLeaseStore as p, getRuntimeContext as r, requestAddressPaths as s, createStandardRuntimeContext as t, getHostBinding as u, activeEnvStorageKey as v, ownObject as x, cloudflareOwners as y };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/response.d.ts
|
|
2
1
|
/** A JSON-safe representation of a web Response for durable boundaries. */
|
|
3
2
|
interface SerializedResponse {
|
|
4
3
|
readonly body: {
|
|
@@ -29,5 +28,4 @@ declare function serializeResponse(response: Response): Promise<SerializedRespon
|
|
|
29
28
|
/** Reconstruct a native Response from a durable response record. */
|
|
30
29
|
declare function deserializeResponse(value: SerializedResponse): Response;
|
|
31
30
|
declare function isSerializedResponse(value: unknown): value is SerializedResponse;
|
|
32
|
-
//#endregion
|
|
33
31
|
export { serializeResponse as a, isSerializedResponse as i, deserializeResponse as n, toResponse as o, isResponse as r, SerializedResponse as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { r as isRuntimeObject } from "./runtime-type-EgaBGoVU.js";
|
|
2
|
+
import { n as getViteHubErrorShape } from "./errors-D2ixvqv3.js";
|
|
3
|
+
import { t as runtimeErrorDiagnostics } from "./error-diagnostics-Dj98U7ch.js";
|
|
4
4
|
import { Diagnostic, formatDiagnostic } from "nostics";
|
|
5
|
-
|
|
5
|
+
// src/diagnostics.ts
|
|
6
6
|
/** Recognizes an `Error` from any realm, without reading its properties. */
|
|
7
7
|
function isNativeError(value) {
|
|
8
8
|
if (!isRuntimeObject(value)) return false;
|
|
@@ -186,8 +186,7 @@ function normalizeRuntimeDiagnosticError(error, options = {}) {
|
|
|
186
186
|
remainingStringLength: maxStringLength * (maxErrors + 1)
|
|
187
187
|
}, 0);
|
|
188
188
|
}
|
|
189
|
-
|
|
190
|
-
//#region src/response.ts
|
|
189
|
+
// src/response.ts
|
|
191
190
|
function prototypeGetter(constructor, key) {
|
|
192
191
|
return Object.getOwnPropertyDescriptor(constructor.prototype, key)?.get;
|
|
193
192
|
}
|
|
@@ -428,5 +427,4 @@ function createStatusZeroResponse(type, url = "") {
|
|
|
428
427
|
});
|
|
429
428
|
return response;
|
|
430
429
|
}
|
|
431
|
-
//#endregion
|
|
432
430
|
export { toResponse as a, normalizeRuntimeDiagnosticError as c, serializeResponse as i, isResponse as n, formatRuntimeDiagnosticError as o, isSerializedResponse as r, isRuntimeDiagnostic as s, deserializeResponse as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineDiagnostics } from "nostics";
|
|
2
|
-
|
|
2
|
+
// ../internal/dist/invariant.js
|
|
3
3
|
const invariantDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
4
4
|
docsBase: "https://vitehub.dev/docs/development/diagnostics",
|
|
5
5
|
codes: { INTERNAL_INVARIANT_FAILED: {
|
|
@@ -14,8 +14,7 @@ const invariantDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
14
14
|
function invariantError(what) {
|
|
15
15
|
return invariantDiagnostics.INTERNAL_INVARIANT_FAILED({ what });
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
//#region src/internal/runtime-type.ts
|
|
17
|
+
// src/internal/runtime-type.ts
|
|
19
18
|
/** Narrows opaque inputs without reading their properties. Kept for `@vite-hub/presets`; other packages use `typeof`. */
|
|
20
19
|
function hasRuntimeType(value, expected) {
|
|
21
20
|
switch (expected) {
|
|
@@ -77,5 +76,4 @@ function isRuntimeResponse(value) {
|
|
|
77
76
|
}
|
|
78
77
|
return false;
|
|
79
78
|
}
|
|
80
|
-
//#endregion
|
|
81
79
|
export { isRuntimeResponse as i, hasRuntimeType as n, isRuntimeObject as r, asUnknownBoundary as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vite-hub/runtime",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Shared runtime context, capability, policy, approval, and tracing primitives for ViteHub.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"approvals",
|
|
@@ -139,13 +139,13 @@
|
|
|
139
139
|
},
|
|
140
140
|
"devDependencies": {
|
|
141
141
|
"@libsql/client": "^0.18.0",
|
|
142
|
-
"@types/node": "^24.19.
|
|
142
|
+
"@types/node": "^24.19.2",
|
|
143
143
|
"@vite-hub/internal": "0.0.1",
|
|
144
144
|
"postgres": "^3.4.9",
|
|
145
145
|
"publint": "^0.3.25",
|
|
146
146
|
"typescript": "^6.0.3",
|
|
147
|
-
"vite-plus": "^
|
|
148
|
-
"vitest": "
|
|
147
|
+
"vite-plus": "^1.7.0",
|
|
148
|
+
"vitest": "5.1.0"
|
|
149
149
|
},
|
|
150
150
|
"engines": {
|
|
151
151
|
"node": ">=24.15.0"
|