@vite-hub/env 0.4.1 → 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 +3 -3
- package/dist/{access-B8lSDip4.js → access-DIErLk3w.js} +2 -3
- package/dist/{bridge-Cs9YfQWk.d.ts → bridge-BWwIooe0.d.ts} +0 -12
- package/dist/{bridge-error-BhJ77age.js → bridge-error-DEqzARPJ.js} +1 -3
- package/dist/bridge.d.ts +1 -1
- package/dist/bridge.js +9 -10
- package/dist/{cli-BPp7rdcA.d.ts → cli-B-LW6l_J.d.ts} +1 -6
- package/dist/cli-CAlHK5nn.js +1354 -0
- package/dist/cli.d.ts +3 -6
- package/dist/cli.js +1 -2
- package/dist/database.d.ts +2 -4
- package/dist/database.js +2 -5
- package/dist/{declarations-C5XR3aKw.d.ts → declarations-DNjO52_s.d.ts} +1 -21
- package/dist/{schema-C_a0WZyd.js → declarations-meg4Rmgd.js} +43 -105
- package/dist/{object-C7Jt4ez2.js → error-diagnostics-5BceFRdD.js} +57 -14
- package/dist/{error-diagnostics-DsDPsST_.js → error-diagnostics-BFzFaXcH.js} +2 -4
- package/dist/index.d.ts +3 -13
- package/dist/index.js +8 -12
- package/dist/internal/agent.d.ts +2 -4
- package/dist/internal/agent.js +3 -4
- package/dist/internal/connections.d.ts +2 -4
- package/dist/internal/connections.js +3 -4
- package/dist/internal/server.d.ts +2 -2
- package/dist/internal/server.js +1 -2
- package/dist/{operation-definition-nmRu_O3V.d.ts → operation-definition-CqZkx1Rm.d.ts} +8 -6
- package/dist/{operations-B1PFpKzy.js → operations-BftegDMd.js} +2 -3
- package/dist/operations.d.ts +2 -6
- package/dist/operations.js +7 -41
- package/dist/runtime/public-env.d.ts +2 -4
- package/dist/runtime/public-env.js +2 -3
- package/dist/runtime/server-env.d.ts +2 -3
- package/dist/runtime/server-env.js +2 -3
- package/dist/seal.d.ts +1 -3
- package/dist/seal.js +1 -2
- package/dist/{secret-DJd-fy5T.js → secret-VhbE53Vm.js} +1 -2
- package/dist/{server-CgKAEAE6.d.ts → server-CPEywepM.d.ts} +1 -12
- package/dist/{server-B9-8r6MZ.js → server-pTqnkM7n.js} +213 -168
- package/dist/server.d.ts +2 -2
- package/dist/server.js +1 -2
- package/dist/vite.d.ts +5 -17
- package/dist/vite.js +20 -37
- package/package.json +11 -10
- package/dist/cli-C51D6V-M.js +0 -669
package/dist/cli.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
//#region src/secret-cli.d.ts
|
|
1
|
+
import { n as ViteHubCliContributor, t as ViteHubCliContext } from "./cli-B-LW6l_J.js";
|
|
2
|
+
import { G as ServerEnvInspection, K as ServerEnvInspectionEntry } from "./bridge-BWwIooe0.js";
|
|
4
3
|
interface SecretCliContext {
|
|
5
4
|
env: Readonly<Record<string, string | undefined>>;
|
|
6
5
|
stderr: {
|
|
@@ -18,8 +17,6 @@ interface SecretCliFeature {
|
|
|
18
17
|
}
|
|
19
18
|
/** `vitehub secret` features. They read only the process env and never load the project. */
|
|
20
19
|
export declare const secretCliFeatures: SecretCliFeature[];
|
|
21
|
-
//#endregion
|
|
22
|
-
//#region src/cli.d.ts
|
|
23
20
|
export interface EnvCliInspectInput {
|
|
24
21
|
applicationRoot?: string;
|
|
25
22
|
env: NodeJS.ProcessEnv;
|
|
@@ -38,4 +35,4 @@ export interface EnvCliReport {
|
|
|
38
35
|
stage: string;
|
|
39
36
|
}
|
|
40
37
|
export declare function createEnvCliContributor(options: EnvCliOptions): ViteHubCliContributor;
|
|
41
|
-
|
|
38
|
+
export {};
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { createEnvCliContributor, secretCliFeatures };
|
|
1
|
+
export { t as createEnvCliContributor, n as secretCliFeatures } from "./cli-CAlHK5nn.js";
|
package/dist/database.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { d as EnvSecretMetadata, f as EnvSecretStore, r as EnvAccessStore } from "./bridge-
|
|
1
|
+
import { d as EnvSecretMetadata, f as EnvSecretStore, r as EnvAccessStore } from "./bridge-BWwIooe0.js";
|
|
2
2
|
import { SQL } from "drizzle-orm";
|
|
3
|
-
//#region src/database.d.ts
|
|
4
3
|
export interface EnvDatabase {
|
|
5
4
|
run(query: SQL): unknown;
|
|
6
5
|
all(query: SQL): unknown[] | PromiseLike<unknown[]>;
|
|
@@ -43,5 +42,4 @@ export declare function createDatabaseEnvStore(options: {
|
|
|
43
42
|
encryptionKeys: readonly Uint8Array[];
|
|
44
43
|
namespace?: string;
|
|
45
44
|
previews?: boolean;
|
|
46
|
-
}): DatabaseEnvStore;
|
|
47
|
-
//#endregion
|
|
45
|
+
}): DatabaseEnvStore;
|
package/dist/database.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { t as envBridgeError } from "./bridge-error-
|
|
1
|
+
import { t as envBridgeError } from "./bridge-error-DEqzARPJ.js";
|
|
2
2
|
import { importSealKey, sealKeyId, sealWithKey, sealedPayloadPattern, unsealWithKey } from "./seal.js";
|
|
3
3
|
import { ViteHubError } from "@vite-hub/runtime";
|
|
4
4
|
import * as v from "valibot";
|
|
5
5
|
import { sql } from "drizzle-orm";
|
|
6
|
-
|
|
7
|
-
/** A stored value: `v2:<keyId>:<iv>:<ciphertext>`, or a legacy `<iv>:<ciphertext>` without a key id. */
|
|
6
|
+
// src/database.ts
|
|
8
7
|
const storedPayloadPattern = new RegExp(`^(?:v2:[a-f0-9]{16}:)?${sealedPayloadPattern.source.slice(1, -1)}$`);
|
|
9
8
|
const identifier = v.pipe(v.string(), v.minLength(1), v.maxLength(512), v.regex(/^[^\u0000-\u001f]+$/));
|
|
10
9
|
const actor = v.object({
|
|
@@ -83,7 +82,6 @@ const listRow = v.object({
|
|
|
83
82
|
preview: v.nullable(v.string())
|
|
84
83
|
});
|
|
85
84
|
const namespaceRow = v.object({ namespace: v.string() });
|
|
86
|
-
/** Create the Env tables when they are missing. Each store and `listDatabaseEnvNamespaces()` calls it first. */
|
|
87
85
|
async function createEnvTables(db) {
|
|
88
86
|
await db.run(sql`CREATE TABLE IF NOT EXISTS vitehub_env_secrets (namespace TEXT NOT NULL, key TEXT NOT NULL, payload TEXT NOT NULL, revision TEXT NOT NULL, updated_at TEXT NOT NULL, preview TEXT, PRIMARY KEY (namespace, key))`);
|
|
89
87
|
await db.run(sql`CREATE TABLE IF NOT EXISTS vitehub_env_activity (sequence INTEGER PRIMARY KEY AUTOINCREMENT, namespace TEXT NOT NULL, key TEXT NOT NULL, id TEXT NOT NULL UNIQUE, payload TEXT NOT NULL)`);
|
|
@@ -270,5 +268,4 @@ function createDatabaseEnvStore(options) {
|
|
|
270
268
|
}
|
|
271
269
|
};
|
|
272
270
|
}
|
|
273
|
-
//#endregion
|
|
274
271
|
export { createDatabaseEnvStore, listDatabaseEnvNamespaces };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { F as EnvTypedVariableOptions, L as EnvVariableDeclaration, M as EnvSource, P as EnvSourceResolver, R as EnvVariableOptions, j as EnvSchemaModuleReference } from "./bridge-
|
|
2
|
-
//#region src/core/declarations.d.ts
|
|
1
|
+
import { F as EnvTypedVariableOptions, L as EnvVariableDeclaration, M as EnvSource, P as EnvSourceResolver, R as EnvVariableOptions, j as EnvSchemaModuleReference } from "./bridge-BWwIooe0.js";
|
|
3
2
|
type EnvListItem = boolean | number | string;
|
|
4
3
|
interface StandardSchemaLike {
|
|
5
4
|
"~standard": {
|
|
@@ -8,51 +7,32 @@ interface StandardSchemaLike {
|
|
|
8
7
|
}
|
|
9
8
|
interface EnvNamespace {
|
|
10
9
|
(options?: EnvVariableOptions): EnvVariableDeclaration;
|
|
11
|
-
/** Parse `true`, `false`, `1`, or `0` into a boolean. */
|
|
12
10
|
boolean: (options?: EnvTypedVariableOptions<boolean>) => EnvVariableDeclaration;
|
|
13
11
|
buildTimestamp: () => EnvSource;
|
|
14
12
|
custom: (label: string, resolver: EnvSourceResolver) => EnvSource;
|
|
15
|
-
/** Accept only the listed strings. The values are public metadata, so an enum cannot be secret. */
|
|
16
13
|
enum: <const TValues extends readonly [string, ...string[]]>(values: TValues, options?: EnvTypedVariableOptions<TValues[number]> & {
|
|
17
14
|
secret?: never;
|
|
18
15
|
}) => EnvVariableDeclaration;
|
|
19
|
-
/** The current branch: `GIT_BRANCH`, then `GITHUB_HEAD_REF`, then `GITHUB_REF_NAME` on a GitHub branch ref, then local Git. */
|
|
20
16
|
gitBranch: () => EnvSource;
|
|
21
|
-
/** The current commit SHA: `GIT_SHA`, then `GITHUB_SHA`, then local Git. `short` keeps 7 characters of a CI value. */
|
|
22
17
|
gitCommit: (options?: {
|
|
23
18
|
short?: boolean;
|
|
24
19
|
}) => EnvSource;
|
|
25
|
-
/** The current tag, or `undefined`: `GIT_TAG`, then `GITHUB_REF_NAME` on a GitHub tag ref, then local Git. */
|
|
26
20
|
gitTag: () => EnvSource;
|
|
27
|
-
/**
|
|
28
|
-
* Parse a JSON value. In `env.server`, validate it with `env.json(env.schemaFrom(module, exportName))`.
|
|
29
|
-
* With `mode: "build"`, pass the Standard Schema itself. Without a schema, the value is `unknown`.
|
|
30
|
-
*/
|
|
31
21
|
json: {
|
|
32
22
|
(options?: EnvTypedVariableOptions<unknown>): EnvVariableDeclaration;
|
|
33
23
|
(schema: EnvSchemaModuleReference | StandardSchemaLike, options?: EnvTypedVariableOptions<unknown>): EnvVariableDeclaration;
|
|
34
24
|
};
|
|
35
|
-
/**
|
|
36
|
-
* Parse a list separated by commas or line breaks. Items are trimmed and empty items are dropped. Pass `env.number()`, `env.boolean()`,
|
|
37
|
-
* or `env.enum()` to parse each item, for example `env.list(env.number())`.
|
|
38
|
-
*/
|
|
39
25
|
list: {
|
|
40
26
|
(options?: EnvTypedVariableOptions<readonly EnvListItem[]>): EnvVariableDeclaration;
|
|
41
27
|
(item: EnvVariableDeclaration, options?: EnvTypedVariableOptions<readonly EnvListItem[]>): EnvVariableDeclaration;
|
|
42
28
|
};
|
|
43
|
-
/** Parse a finite number. */
|
|
44
29
|
number: (options?: EnvTypedVariableOptions<number>) => EnvVariableDeclaration;
|
|
45
30
|
packageJson: (path: string) => EnvSource;
|
|
46
31
|
provider: (provider: string, key: string) => EnvSource;
|
|
47
|
-
/**
|
|
48
|
-
* Validate a Server Env value with a Standard Schema exported by a module, for example `env.schemaFrom("./server/env.schema.ts", "apiUrl")`.
|
|
49
|
-
* The server build imports the module, so refinements and transforms run on every resolution.
|
|
50
|
-
*/
|
|
51
32
|
schemaFrom: (module: string, exportName?: string) => EnvSchemaModuleReference;
|
|
52
33
|
source: (name: string | string[], options?: {
|
|
53
34
|
canonical?: boolean;
|
|
54
35
|
}) => EnvSource;
|
|
55
36
|
}
|
|
56
37
|
declare const env: EnvNamespace;
|
|
57
|
-
//#endregion
|
|
58
38
|
export { env as t };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { t as envErrorDiagnostics } from "./error-diagnostics-
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { t as envErrorDiagnostics } from "./error-diagnostics-BFzFaXcH.js";
|
|
2
|
+
import { D as listItemKinds, E as envValueTypeName, O as parseEnvValue, P as readStandardValidate, j as stringValueSchema, k as readJsonInput } from "./server-pTqnkM7n.js";
|
|
3
|
+
// src/internal/runtime-type.ts
|
|
4
4
|
function isRuntimeRecord(value) {
|
|
5
5
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
//#region src/core/declarations.ts
|
|
7
|
+
// src/core/declarations.ts
|
|
9
8
|
const runtimeSchemaProperty = "__vitehubRuntimeSchema";
|
|
10
9
|
const runtimeSchemaToken = getRuntimeSchemaToken();
|
|
11
10
|
const runtimeSchemaParsers = /* @__PURE__ */ new WeakMap();
|
|
@@ -171,7 +170,6 @@ function jsonVariable(schemaOrOptions, options) {
|
|
|
171
170
|
if (isSchemaModule(schemaOrOptions) || options !== void 0 || isRuntimeRecord(schemaOrOptions) && ("kind" in schemaOrOptions || "~standard" in schemaOrOptions)) throw envErrorDiagnostics.ENV_JSON_SCHEMA_INVALID({ message: "env.json() takes env.schemaFrom(), a Standard Schema, or only options." });
|
|
172
171
|
return typedVariable(createRuntimeValueSchema(Object.freeze({ kind: "json" })), schemaOrOptions ?? {});
|
|
173
172
|
}
|
|
174
|
-
/** Wrap a build-time Standard Schema so that it gets the parsed JSON value. */
|
|
175
173
|
function jsonStandardSchema(schema) {
|
|
176
174
|
const validate = schema["~standard"].validate;
|
|
177
175
|
return { "~standard": { validate: (value) => {
|
|
@@ -183,13 +181,7 @@ function isSchemaModule(value) {
|
|
|
183
181
|
return schemaModuleReference(value) !== void 0;
|
|
184
182
|
}
|
|
185
183
|
function isStandardSchemaLike(value) {
|
|
186
|
-
|
|
187
|
-
if (typeof value !== "object" && typeof value !== "function" || value === null) return false;
|
|
188
|
-
const standard = Reflect.get(value, "~standard");
|
|
189
|
-
return isRuntimeRecord(standard) && typeof standard.validate === "function";
|
|
190
|
-
} catch {
|
|
191
|
-
return false;
|
|
192
|
-
}
|
|
184
|
+
return readStandardValidate(value, "env.json()") !== void 0;
|
|
193
185
|
}
|
|
194
186
|
function isDeclaration(value) {
|
|
195
187
|
try {
|
|
@@ -198,36 +190,44 @@ function isDeclaration(value) {
|
|
|
198
190
|
return false;
|
|
199
191
|
}
|
|
200
192
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
193
|
+
const declarationOptionKeys = /* @__PURE__ */ new Set([
|
|
194
|
+
"default",
|
|
195
|
+
"mode",
|
|
196
|
+
"optional",
|
|
197
|
+
"schema",
|
|
198
|
+
"secret",
|
|
199
|
+
"source",
|
|
200
|
+
"type"
|
|
201
|
+
]);
|
|
202
|
+
function copyOptions(options) {
|
|
203
|
+
if (!isRuntimeRecord(options)) return void 0;
|
|
204
|
+
return Object.fromEntries(Object.getOwnPropertyNames(options).map((key) => [key, options[key]]));
|
|
209
205
|
}
|
|
210
206
|
function readDeclarationOptions(options) {
|
|
211
|
-
if (!isInspectableRecord(options)) throw envErrorDiagnostics.ENV_R0005({ message: "env() only accepts a single options object." });
|
|
212
207
|
let snapshot;
|
|
213
|
-
let required;
|
|
214
208
|
try {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
secret: options.secret,
|
|
222
|
-
source: options.source,
|
|
223
|
-
type: options.type
|
|
224
|
-
};
|
|
225
|
-
} catch {
|
|
226
|
-
throw envErrorDiagnostics.ENV_R0005({ message: "env() only accepts a single options object." });
|
|
209
|
+
snapshot = copyOptions(options);
|
|
210
|
+
} catch (cause) {
|
|
211
|
+
throw envErrorDiagnostics.ENV_R0005({
|
|
212
|
+
message: "env() only accepts a single options object.",
|
|
213
|
+
cause
|
|
214
|
+
});
|
|
227
215
|
}
|
|
228
|
-
if (
|
|
229
|
-
|
|
230
|
-
|
|
216
|
+
if (!snapshot) throw envErrorDiagnostics.ENV_R0005({ message: "env() only accepts a single options object." });
|
|
217
|
+
for (const key of Object.keys(snapshot)) {
|
|
218
|
+
if (key === "required") throw envErrorDiagnostics.ENV_R0006({ message: "env() does not accept required. A value is required by default. Use optional: true for a value that can be missing." });
|
|
219
|
+
if (!declarationOptionKeys.has(key)) throw envErrorDiagnostics.ENV_R0005({ message: `env() does not accept ${key}. Use default, mode, optional, schema, secret, source, or type.` });
|
|
220
|
+
}
|
|
221
|
+
if (snapshot.optional === true && snapshot.default !== void 0) throw envErrorDiagnostics.ENV_R0006({ message: "env() cannot use both optional and default. A default makes the value always present." });
|
|
222
|
+
return {
|
|
223
|
+
default: snapshot.default,
|
|
224
|
+
mode: snapshot.mode,
|
|
225
|
+
optional: snapshot.optional === true,
|
|
226
|
+
schema: snapshot.schema,
|
|
227
|
+
secret: snapshot.secret,
|
|
228
|
+
source: snapshot.source,
|
|
229
|
+
type: snapshot.type
|
|
230
|
+
};
|
|
231
231
|
}
|
|
232
232
|
function createDeclaration(options, schema, type) {
|
|
233
233
|
const required = !options.optional;
|
|
@@ -271,14 +271,10 @@ const env = Object.assign(variable, {
|
|
|
271
271
|
function runtimeValueSchema(declaration) {
|
|
272
272
|
const schema = declaration.schema;
|
|
273
273
|
if (runtimeSchemas.get(declaration) === schema && isRuntimeValueSchema(schema)) return runtimeSchemaParsers.get(schema.safeParse);
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
return typeof safeParse === "function" ? runtimeSchemaParsers.get(safeParse) : void 0;
|
|
279
|
-
} catch {
|
|
280
|
-
return;
|
|
281
|
-
}
|
|
274
|
+
if (Object.getOwnPropertyDescriptor(declaration, runtimeSchemaProperty)?.value !== runtimeSchemaToken || !isRuntimeRecord(schema)) return void 0;
|
|
275
|
+
if (Object.getOwnPropertyDescriptor(schema, runtimeSchemaProperty)?.value !== runtimeSchemaToken || !hasOnlyRuntimeSchemaKeys(schema)) return void 0;
|
|
276
|
+
const safeParse = Object.getOwnPropertyDescriptor(schema, "safeParse")?.value;
|
|
277
|
+
return typeof safeParse === "function" ? runtimeSchemaParsers.get(safeParse) : void 0;
|
|
282
278
|
}
|
|
283
279
|
function isRuntimeValueSchema(schema) {
|
|
284
280
|
try {
|
|
@@ -299,62 +295,4 @@ function hasOnlyRuntimeSchemaKeys(schema) {
|
|
|
299
295
|
const safeParse = Object.getOwnPropertyDescriptor(schema, "safeParse");
|
|
300
296
|
return keys.length === 2 && keys.includes(runtimeSchemaProperty) && keys.includes("safeParse") && typeof safeParse?.value === "function";
|
|
301
297
|
}
|
|
302
|
-
|
|
303
|
-
//#region src/schema.ts
|
|
304
|
-
function parseSchema(schema, value, label) {
|
|
305
|
-
if (isSchemaModuleReference(schema)) throw envErrorDiagnostics.ENV_R0029({ message: `[vitehub] ${label} uses env.schemaFrom(), which only env.server supports. Pass the schema object itself.` });
|
|
306
|
-
if (isStandardSchema(schema)) {
|
|
307
|
-
const result = schema["~standard"].validate(value);
|
|
308
|
-
if (isPromiseLike(result)) throw envErrorDiagnostics.ENV_R0014({ message: `[vitehub] ${label} uses an async schema. Env validation currently requires sync schemas.` });
|
|
309
|
-
if ("issues" in result && result.issues && result.issues.length > 0) throw envErrorDiagnostics.ENV_R0015({ message: `[vitehub] Invalid ${label}: ${formatIssues(result.issues)}` });
|
|
310
|
-
if (!("value" in result)) throw envErrorDiagnostics.ENV_R0016({ message: `[vitehub] Invalid ${label}: ${formatIssues(result.issues)}` });
|
|
311
|
-
return result.value;
|
|
312
|
-
}
|
|
313
|
-
if (isZodLike(schema) && hasSchemaMethod(schema, "safeParse") && typeof schema.safeParse === "function") {
|
|
314
|
-
const result = schema.safeParse(value);
|
|
315
|
-
if (!result.success) throw envErrorDiagnostics.ENV_R0017({ message: `[vitehub] Invalid ${label}: ${formatIssues(result.error)}` });
|
|
316
|
-
return result.data;
|
|
317
|
-
}
|
|
318
|
-
if (isZodLike(schema) && hasSchemaMethod(schema, "parse") && typeof schema.parse === "function") try {
|
|
319
|
-
return schema.parse(value);
|
|
320
|
-
} catch (error) {
|
|
321
|
-
throw envErrorDiagnostics.ENV_R0018({ message: `[vitehub] Invalid ${label}: ${formatIssues(error)}` });
|
|
322
|
-
}
|
|
323
|
-
return value;
|
|
324
|
-
}
|
|
325
|
-
function isSchemaModuleReference(schema) {
|
|
326
|
-
return typeof schema === "object" && schema !== null && !Array.isArray(schema) && schema.kind === "schema-module";
|
|
327
|
-
}
|
|
328
|
-
function isPromiseLike(value) {
|
|
329
|
-
return typeof value === "object" && value !== null && "then" in value && typeof value.then === "function";
|
|
330
|
-
}
|
|
331
|
-
function isStandardSchema(schema) {
|
|
332
|
-
return isZodLike(schema) && hasSchemaMethod(schema, "~standard") && typeof schema["~standard"]?.validate === "function";
|
|
333
|
-
}
|
|
334
|
-
function isZodLike(schema) {
|
|
335
|
-
return typeof schema === "object" && schema !== null;
|
|
336
|
-
}
|
|
337
|
-
function hasSchemaMethod(schema, method) {
|
|
338
|
-
return Object.hasOwn(schema, method) || isZodSchemaMethod(schema, method);
|
|
339
|
-
}
|
|
340
|
-
function isZodSchemaMethod(schema, method) {
|
|
341
|
-
if (!Object.hasOwn(schema, "_zod")) return false;
|
|
342
|
-
const metadata = schema._zod;
|
|
343
|
-
if (!metadata) return false;
|
|
344
|
-
const constructor = metadata?.constr;
|
|
345
|
-
return hasSetValue(metadata?.traits, "ZodType") && Object.hasOwn(metadata, "constr") && typeof constructor === "function" && Object.getPrototypeOf(schema) === constructor.prototype && Object.hasOwn(constructor.prototype, method);
|
|
346
|
-
}
|
|
347
|
-
function hasSetValue(value, entry) {
|
|
348
|
-
try {
|
|
349
|
-
return Set.prototype.has.call(value, entry);
|
|
350
|
-
} catch {
|
|
351
|
-
return false;
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
function formatIssues(issues) {
|
|
355
|
-
if (Array.isArray(issues)) return issues.map((issue) => typeof issue === "string" ? issue : JSON.stringify(issue)).join("; ");
|
|
356
|
-
if (issues instanceof Error) return issues.message;
|
|
357
|
-
return typeof issues === "string" ? issues : JSON.stringify(issues);
|
|
358
|
-
}
|
|
359
|
-
//#endregion
|
|
360
|
-
export { schemaModuleReference as a, runtimeValueSchema as i, descriptorVariable as n, env as r, parseSchema as t };
|
|
298
|
+
export { schemaModuleReference as i, env as n, runtimeValueSchema as r, descriptorVariable as t };
|
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
import { defineDiagnostics } from "nostics";
|
|
2
|
-
|
|
2
|
+
// ../internal/src/object.ts
|
|
3
|
+
/** A non-null object that is not an array. Functions do not pass. */
|
|
4
|
+
function isRecord(value) {
|
|
5
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6
|
+
}
|
|
7
|
+
/** A non-null object or a function that is not an array. */
|
|
8
|
+
function isRecordOrFunction(value) {
|
|
9
|
+
return Object(value) === value && !Array.isArray(value);
|
|
10
|
+
}
|
|
11
|
+
// ../internal/src/standard-schema.ts
|
|
12
|
+
function readOwn(value, key) {
|
|
13
|
+
if (value === null || Object(value) !== value) return;
|
|
14
|
+
try {
|
|
15
|
+
return Reflect.get(Object(value), key);
|
|
16
|
+
} catch {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The issues of a Standard Schema result, or `undefined` when the result has none. The result can be an array that
|
|
22
|
+
* carries its own `issues`, such as ArkType's `ArkErrors`.
|
|
23
|
+
*/
|
|
24
|
+
function standardResultIssues(result) {
|
|
25
|
+
const issues = readOwn(result, "issues");
|
|
26
|
+
return Array.isArray(issues) && issues.length > 0 ? issues : void 0;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Read a Standard JSON Schema projection without throwing.
|
|
30
|
+
*
|
|
31
|
+
* Returns `undefined` when the schema has no `~standard.jsonSchema`, when the library cannot represent the type
|
|
32
|
+
* (Zod throws for `Date`), or when the projection is not an object. Callers decide how to fall back.
|
|
33
|
+
*/
|
|
34
|
+
function standardJsonSchema(schema, direction, target = "draft-2020-12", libraryOptions) {
|
|
35
|
+
const jsonSchema = readOwn(readOwn(schema, "~standard"), "jsonSchema");
|
|
36
|
+
const project = readOwn(jsonSchema, direction);
|
|
37
|
+
if (typeof project !== "function") return;
|
|
38
|
+
try {
|
|
39
|
+
const result = project.call(jsonSchema, libraryOptions ? {
|
|
40
|
+
target,
|
|
41
|
+
libraryOptions
|
|
42
|
+
} : { target });
|
|
43
|
+
return isRecordOrFunction(result) ? result : void 0;
|
|
44
|
+
} catch {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// ../internal/src/error-diagnostics.ts
|
|
3
49
|
const dynamicError = { why: ({ message }) => message === void 0 ? "" : String(message) };
|
|
4
50
|
const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
5
51
|
docsBase: "https://vitehub.dev/docs/development/diagnostics",
|
|
@@ -25,7 +71,7 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
25
71
|
why: ({ message }) => message === void 0 ? "" : String(message)
|
|
26
72
|
},
|
|
27
73
|
INTERNAL_R0022: {
|
|
28
|
-
fix: "Send input that matches the schema of the operation. `vitehub <namespace> <command> --help` shows the fields.",
|
|
74
|
+
fix: "Send input that matches the schema of the operation. `vitehub <namespace> <command> --help` shows the fields, and the list_operations tool of the ViteHub MCP gives the input schema of each operation.",
|
|
29
75
|
why: ({ message }) => message === void 0 ? "" : String(message)
|
|
30
76
|
},
|
|
31
77
|
INTERNAL_R0024: {
|
|
@@ -244,6 +290,10 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
244
290
|
why: ({ owner }) => `[vitehub] ${owner} extends tuple requires [preset, options] with an options object.`,
|
|
245
291
|
fix: "Set `extends` to a preset, or to a two-item tuple `[preset, { ...options }]` whose second item is a plain object."
|
|
246
292
|
},
|
|
293
|
+
INTERNAL_RUNTIME_PACKAGE_VERSION_CONFLICT: {
|
|
294
|
+
why: ({ first, name, second }) => `[vitehub] One server function needs ${name} from two installations: ${first} and ${second}.`,
|
|
295
|
+
fix: "Install one version of the package that the message names, for example with `pnpm dedupe` or an `overrides` entry in `package.json`, then build again."
|
|
296
|
+
},
|
|
247
297
|
INTERNAL_SECRET_PURPOSE_MISSING: {
|
|
248
298
|
why: "[vitehub] A derived secret requires a purpose.",
|
|
249
299
|
fix: "Pass a non-empty purpose to `deriveSecret()`, such as `deriveSecret(\"my-module:session\")`."
|
|
@@ -252,6 +302,10 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
252
302
|
why: ({ minimum }) => `[vitehub] VITEHUB_SECRET must be at least ${minimum} characters. Generate one with \`openssl rand -base64 32\`.`,
|
|
253
303
|
fix: "Set `VITEHUB_SECRET` to the output of `openssl rand -base64 32`, which has 44 characters."
|
|
254
304
|
},
|
|
305
|
+
INTERNAL_SITE_TOKEN_TOO_LONG: {
|
|
306
|
+
why: ({ length, maximum }) => `The Site access token is ${length} characters, and an app accepts ${maximum}.`,
|
|
307
|
+
fix: "Open the app with a shorter path, or give the person and the project shorter names, so that the Site access token fits."
|
|
308
|
+
},
|
|
255
309
|
INTERNAL_SQLITE_ARGUMENT_INVALID: {
|
|
256
310
|
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",
|
|
257
311
|
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."
|
|
@@ -266,15 +320,4 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
266
320
|
}
|
|
267
321
|
}
|
|
268
322
|
});
|
|
269
|
-
|
|
270
|
-
//#region ../internal/src/object.ts
|
|
271
|
-
/** A non-null object that is not an array. Functions do not pass. */
|
|
272
|
-
function isRecord(value) {
|
|
273
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
274
|
-
}
|
|
275
|
-
/** A non-null object or a function that is not an array. */
|
|
276
|
-
function isRecordOrFunction(value) {
|
|
277
|
-
return Object(value) === value && !Array.isArray(value);
|
|
278
|
-
}
|
|
279
|
-
//#endregion
|
|
280
|
-
export { isRecordOrFunction as n, internalErrorDiagnostics as r, isRecord as t };
|
|
323
|
+
export { isRecordOrFunction as a, isRecord as i, standardJsonSchema as n, standardResultIssues as r, internalErrorDiagnostics as t };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { defineDiagnostics } from "nostics";
|
|
2
|
-
|
|
2
|
+
// src/error-diagnostics.ts
|
|
3
3
|
const dynamicError = { why: ({ message }) => message === void 0 ? "" : String(message) };
|
|
4
|
-
/** A code whose call site passes the message as `why`. Pass the fix as a string literal: the docs catalog reads only literals. */
|
|
5
4
|
const withFix = (fix) => ({
|
|
6
5
|
...dynamicError,
|
|
7
6
|
fix
|
|
@@ -13,7 +12,7 @@ const envErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
13
12
|
ENV_R0002: withFix("Pass one or more variable names, for example `env.source('DATABASE_URL')`."),
|
|
14
13
|
ENV_R0003: withFix("Use a key of `vitehub({ env: { providers } })` or `hubEnv({ providers })` as the provider name, for example `env.provider('vault', 'db/password')`."),
|
|
15
14
|
ENV_R0004: withFix("Pass the key that the provider reads as the second argument, for example `env.provider('vault', 'db/password')`."),
|
|
16
|
-
ENV_R0005: withFix("Pass one plain options object
|
|
15
|
+
ENV_R0005: withFix("Pass one plain options object with only `default`, `mode`, `optional`, `schema`, `secret`, `source`, or `type`, for example `env({ secret: true })`."),
|
|
17
16
|
ENV_R0006: withFix("Remove `required`: a value is required by default. Set `optional: true` for a value that can be missing, or a `default` for a fallback value, not both."),
|
|
18
17
|
ENV_R0008: withFix("Change the Env declaration at the path in the error details, as the message says."),
|
|
19
18
|
ENV_R0009: withFix("Load Server Env with `await loadServerEnv()`, or run the code in `runWithServerEnv()`. A provider value cannot be read without `await`."),
|
|
@@ -52,5 +51,4 @@ const envErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
52
51
|
}
|
|
53
52
|
}
|
|
54
53
|
});
|
|
55
|
-
//#endregion
|
|
56
54
|
export { envErrorDiagnostics as t };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { C as parseSchema, S as StandardSchemaV1, _ as unseal, b as StandardSchemaResultFailure, d as SealOptions, f as UnsealErrorCode, g as seal, m as UnsealSchemaOptions, p as UnsealOptions, s as isBlockingServerEnvEntry, v as SealUsesDatabase, x as StandardSchemaResultSuccess, y as RequestEvent } from "./server-
|
|
1
|
+
import { t as env } from "./declarations-DNjO52_s.js";
|
|
2
|
+
import { A as EnvRuntimeRegistry, B as PublicEnv, C as EnvMode, D as EnvProviderValues, E as EnvProviderContext, F as EnvTypedVariableOptions, G as ServerEnvInspection, H as ServerEnv, I as EnvValueSchema, K as ServerEnvInspectionEntry, L as EnvVariableDeclaration, M as EnvSource, N as EnvSourceContext, O as EnvProviders, P as EnvSourceResolver, Q as SecretEnv, R as EnvVariableOptions, S as EnvDiagnostics, T as EnvProvider, U as ServerEnvDescription, V as ReadonlyServerEnv, W as ServerEnvDescriptionEntry, b as EnvDeclarations, j as EnvSchemaModuleReference, k as EnvRuntimeConfigOptions, q as ServerEnvInspectionStatus, w as EnvOptions, x as EnvDiagnosticEntry, y as DeepReadonly, z as LoadServerEnvOptions } from "./bridge-BWwIooe0.js";
|
|
3
|
+
import { C as parseSchema, S as StandardSchemaV1, _ as unseal, b as StandardSchemaResultFailure, d as SealOptions, f as UnsealErrorCode, g as seal, m as UnsealSchemaOptions, p as UnsealOptions, s as isBlockingServerEnvEntry, v as SealUsesDatabase, x as StandardSchemaResultSuccess, y as RequestEvent } from "./server-CPEywepM.js";
|
|
4
4
|
import { Result, ViteHubError } from "@vite-hub/runtime";
|
|
5
5
|
import { deriveSecret, describeServerEnv, inspectServerEnv, loadServerEnv, runWithServerEnv, useServerEnv } from "#vitehub/env/server";
|
|
6
6
|
import { usePublicEnv } from "#vitehub/env/public";
|
|
7
|
-
//#region src/presets.d.ts
|
|
8
7
|
interface OpenWorkflowEnvOptions {
|
|
9
8
|
namespaceId?: string;
|
|
10
9
|
schema?: string;
|
|
@@ -22,11 +21,7 @@ interface TypesafeEnvOptions {
|
|
|
22
21
|
* missing key when it runs, so an application without AI still starts.
|
|
23
22
|
*/
|
|
24
23
|
export declare function typesafeEnv(options?: TypesafeEnvOptions): EnvRuntimeConfigOptions;
|
|
25
|
-
//#endregion
|
|
26
|
-
//#region src/provider.d.ts
|
|
27
24
|
export declare function defineEnvProvider<TEnv extends Record<string, unknown> = Record<string, unknown>, const TProvider extends EnvProvider<TEnv> = EnvProvider<TEnv>>(provider: TProvider): TProvider;
|
|
28
|
-
//#endregion
|
|
29
|
-
//#region src/service-token.d.ts
|
|
30
25
|
/** The codes that `checkServiceToken()` returns. */
|
|
31
26
|
type ServiceTokenErrorCode = "ENV_SERVICE_TOKEN_INVALID" | "ENV_SERVICE_TOKEN_UNSET";
|
|
32
27
|
/**
|
|
@@ -67,8 +62,6 @@ export declare function checkServiceToken(event: ServiceTokenEvent, name: string
|
|
|
67
62
|
* ```
|
|
68
63
|
*/
|
|
69
64
|
export declare function requireServiceToken(event: ServiceTokenEvent, name: string): void;
|
|
70
|
-
//#endregion
|
|
71
|
-
//#region src/webhook.d.ts
|
|
72
65
|
/** The codes that `verifyWebhook()` returns. */
|
|
73
66
|
type WebhookErrorCode = "ENV_WEBHOOK_BODY_INVALID" | "ENV_WEBHOOK_SCHEMA_MISMATCH" | "ENV_WEBHOOK_SECRET_UNSET" | "ENV_WEBHOOK_SIGNATURE_INVALID";
|
|
74
67
|
/** How `verifyWebhook()` checks the signature. `secret` is the name of the server variable that holds the signing secret. */
|
|
@@ -149,8 +142,6 @@ interface SignWebhookOptions {
|
|
|
149
142
|
* ```
|
|
150
143
|
*/
|
|
151
144
|
export declare function signWebhook(body: string | Uint8Array<ArrayBuffer>, options: SignWebhookOptions): Promise<Record<string, string>>;
|
|
152
|
-
//#endregion
|
|
153
|
-
//#region src/core/errors.d.ts
|
|
154
145
|
declare const envErrorMessages: {
|
|
155
146
|
readonly ENV_DECLARATION_INVALID: "[vitehub] Env declaration is invalid.";
|
|
156
147
|
readonly ENV_ASYNC_REQUIRED: "[vitehub] Server Env requires asynchronous loading.";
|
|
@@ -182,5 +173,4 @@ interface EnvErrorDetailsByCode {
|
|
|
182
173
|
};
|
|
183
174
|
}
|
|
184
175
|
type EnvErrorDetails<TCode extends EnvErrorCode = EnvErrorCode> = EnvErrorDetailsByCode[TCode];
|
|
185
|
-
//#endregion
|
|
186
176
|
export { type DeepReadonly, type EnvDeclarations, type EnvDiagnosticEntry, type EnvDiagnostics, type EnvErrorCode, type EnvErrorDetails, type EnvMode, type EnvOptions, type EnvProvider, type EnvProviderContext, type EnvProviderValues, type EnvProviders, type EnvRuntimeConfigOptions, type EnvRuntimeRegistry, type EnvSchemaModuleReference, type EnvSource, type EnvSourceContext, type EnvSourceIdentifier, type EnvSourceResolver, type EnvTypedVariableOptions, type EnvValueSchema, type EnvVariableDeclaration, type EnvVariableOptions, type LoadServerEnvOptions, type OpenWorkflowEnvOptions, type PublicEnv, type ReadonlyServerEnv, type SealOptions, type SealUsesDatabase, SecretEnv, type ServerEnv, type ServerEnvDescription, type ServerEnvDescriptionEntry, type ServerEnvInspection, type ServerEnvInspectionEntry, type ServerEnvInspectionStatus, type ServiceTokenErrorCode, type ServiceTokenEvent, type SignWebhookOptions, type StandardSchemaResultFailure, type StandardSchemaResultSuccess, type StandardSchemaV1, type TypesafeEnvOptions, type UnsealErrorCode, type UnsealOptions, type UnsealSchemaOptions, type VerifyWebhookOptions, type VerifyWebhookSchemaOptions, type WebhookErrorCode, deriveSecret, describeServerEnv, env, inspectServerEnv, isBlockingServerEnvEntry, loadServerEnv, parseSchema, runWithServerEnv, seal, unseal, usePublicEnv, useServerEnv };
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
1
|
+
import { n as env } from "./declarations-meg4Rmgd.js";
|
|
2
|
+
import { C as verifyViteHubHmacSignature, N as parseSchema, T as viteHubHmacSha256, _ as runtimeEnv, a as isBlockingServerEnvEntry, b as githubHmacSignatureFormat, d as unseal, u as seal, v as standardSource, w as verifyViteHubStripeSignature, x as isViteHubBearerSecretEqual } from "./server-pTqnkM7n.js";
|
|
3
|
+
import { t as SecretEnv } from "./secret-VhbE53Vm.js";
|
|
4
|
+
import { t as envErrorDiagnostics } from "./error-diagnostics-BFzFaXcH.js";
|
|
5
5
|
import { defineErrors } from "@vite-hub/runtime";
|
|
6
6
|
import { getStandardContext } from "@vite-hub/runtime/internal/h3";
|
|
7
7
|
import { deriveSecret, describeServerEnv, inspectServerEnv, loadServerEnv, runWithServerEnv, useServerEnv } from "#vitehub/env/server";
|
|
8
8
|
import { usePublicEnv } from "#vitehub/env/public";
|
|
9
9
|
import { HTTPError } from "nitro/h3";
|
|
10
|
-
|
|
10
|
+
// src/presets.ts
|
|
11
11
|
function openWorkflowEnv(options = {}) {
|
|
12
12
|
return {
|
|
13
13
|
namespaceId: env({
|
|
@@ -48,14 +48,12 @@ function typesafeEnv(options = {}) {
|
|
|
48
48
|
})
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
|
|
52
|
-
//#region src/provider.ts
|
|
51
|
+
// src/provider.ts
|
|
53
52
|
function defineEnvProvider(provider) {
|
|
54
53
|
if (typeof provider !== "object" || provider === null || Array.isArray(provider) || typeof provider.read !== "function") throw envErrorDiagnostics.ENV_R0013({ message: "[vitehub] defineEnvProvider() requires a provider with a read({ env, keys, signal }) method." });
|
|
55
54
|
return provider;
|
|
56
55
|
}
|
|
57
|
-
|
|
58
|
-
//#region src/service-token.ts
|
|
56
|
+
// src/service-token.ts
|
|
59
57
|
const serviceTokenErrors = /*#__PURE__*/ defineErrors({
|
|
60
58
|
docs: "https://vitehub.dev/docs/env/diagnostics",
|
|
61
59
|
codes: {
|
|
@@ -126,8 +124,7 @@ function requireServiceToken(event, name) {
|
|
|
126
124
|
status: unset ? 503 : 401
|
|
127
125
|
});
|
|
128
126
|
}
|
|
129
|
-
|
|
130
|
-
//#region src/webhook.ts
|
|
127
|
+
// src/webhook.ts
|
|
131
128
|
const webhookErrors = /*#__PURE__*/ defineErrors({
|
|
132
129
|
docs: "https://vitehub.dev/docs/env/diagnostics",
|
|
133
130
|
codes: {
|
|
@@ -228,5 +225,4 @@ async function signWebhook(body, options) {
|
|
|
228
225
|
payload.set(bytes, prefix.length);
|
|
229
226
|
return { "stripe-signature": `t=${timestamp},v1=${toHex(await viteHubHmacSha256(options.secret, payload))}` };
|
|
230
227
|
}
|
|
231
|
-
//#endregion
|
|
232
228
|
export { SecretEnv, checkServiceToken, defineEnvProvider, deriveSecret, describeServerEnv, env, inspectServerEnv, isBlockingServerEnvEntry, loadServerEnv, openWorkflowEnv, parseSchema, requireServiceToken, runWithServerEnv, seal, signWebhook, typesafeEnv, unseal, usePublicEnv, useServerEnv, verifyWebhook };
|
package/dist/internal/agent.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { $ as EnvAttribution, t as EnvAccessContext } from "../bridge-
|
|
2
|
-
//#region src/internal/agent.d.ts
|
|
1
|
+
import { $ as EnvAttribution, t as EnvAccessContext } from "../bridge-BWwIooe0.js";
|
|
3
2
|
/** Mint only for an identity registered by Agent Definition resolution. Names and copies are untrusted. */
|
|
4
|
-
export declare function agentEnvAccess(agent: unknown, attribution?: EnvAttribution): EnvAccessContext;
|
|
5
|
-
//#endregion
|
|
3
|
+
export declare function agentEnvAccess(agent: unknown, attribution?: EnvAttribution): EnvAccessContext;
|
package/dist/internal/agent.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as envBridgeError } from "../bridge-error-
|
|
2
|
-
import { r as grantEnvAccess } from "../access-
|
|
1
|
+
import { t as envBridgeError } from "../bridge-error-DEqzARPJ.js";
|
|
2
|
+
import { r as grantEnvAccess } from "../access-DIErLk3w.js";
|
|
3
3
|
import { readAgentEnvIdentity, readAgentEnvParents } from "@vite-hub/agent/env-identity";
|
|
4
|
-
|
|
4
|
+
// src/internal/agent.ts
|
|
5
5
|
/** Mint only for an identity registered by Agent Definition resolution. Names and copies are untrusted. */
|
|
6
6
|
function agentEnvAccess(agent, attribution = {}) {
|
|
7
7
|
const name = readAgentEnvIdentity(agent);
|
|
@@ -18,5 +18,4 @@ function agentEnvAccess(agent, attribution = {}) {
|
|
|
18
18
|
parents: readAgentEnvParents(agent)
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
//#endregion
|
|
22
21
|
export { agentEnvAccess };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { a as EnvActor, o as EnvBridge, t as EnvAccessContext } from "../bridge-
|
|
2
|
-
//#region src/internal/connections.d.ts
|
|
1
|
+
import { a as EnvActor, o as EnvBridge, t as EnvAccessContext } from "../bridge-BWwIooe0.js";
|
|
3
2
|
/**
|
|
4
3
|
* Internal to `@vite-hub/connections`. Call it only after the Connection access policy allows the call.
|
|
5
4
|
* The context works on one bridge, for one Connection token key and one permission.
|
|
@@ -14,5 +13,4 @@ export declare function connectionEnvAccess(bridge: EnvBridge, input: {
|
|
|
14
13
|
/** Return the actor of a context that Env created. Other values fail with `ENV_BRIDGE_UNTRUSTED`. */
|
|
15
14
|
export declare function envAccessActor(context: EnvAccessContext): EnvActor;
|
|
16
15
|
/** The registered Agents that the Agent of a context extends, nearest first. Other contexts fail with `ENV_BRIDGE_UNTRUSTED`. */
|
|
17
|
-
export declare function envAccessAgentParents(context: EnvAccessContext): string[];
|
|
18
|
-
//#endregion
|
|
16
|
+
export declare function envAccessAgentParents(context: EnvAccessContext): string[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { r as grantEnvAccess, t as envAccessAuthority } from "../access-DIErLk3w.js";
|
|
2
|
+
import { t as envBridgeError } from "../bridge-error-DEqzARPJ.js";
|
|
3
|
+
// src/internal/connections.ts
|
|
4
4
|
/**
|
|
5
5
|
* Internal to `@vite-hub/connections`. Call it only after the Connection access policy allows the call.
|
|
6
6
|
* The context works on one bridge, for one Connection token key and one permission.
|
|
@@ -27,5 +27,4 @@ function envAccessAgentParents(context) {
|
|
|
27
27
|
if (authority.kind !== "agent") throw envBridgeError("untrusted");
|
|
28
28
|
return [...authority.parents ?? []];
|
|
29
29
|
}
|
|
30
|
-
//#endregion
|
|
31
30
|
export { connectionEnvAccess, envAccessActor, envAccessAgentParents };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { G as ServerEnvInspection, K as ServerEnvInspectionEntry, q as ServerEnvInspectionStatus, t as EnvAccessContext } from "../bridge-
|
|
2
|
-
import { _ as unseal, a as describeServerEnv, c as loadServerEnv, d as SealOptions, f as UnsealErrorCode, g as seal, h as createSealing, i as deriveSecret, l as resolveServerEnv, m as UnsealSchemaOptions, n as ViteHubContext, o as inspectServerEnv, p as UnsealOptions, r as bindServerEnvSchemas, s as isBlockingServerEnvEntry, t as DeriveSecretOptions, u as runWithCloudflareEnv } from "../server-
|
|
1
|
+
import { G as ServerEnvInspection, K as ServerEnvInspectionEntry, q as ServerEnvInspectionStatus, t as EnvAccessContext } from "../bridge-BWwIooe0.js";
|
|
2
|
+
import { _ as unseal, a as describeServerEnv, c as loadServerEnv, d as SealOptions, f as UnsealErrorCode, g as seal, h as createSealing, i as deriveSecret, l as resolveServerEnv, m as UnsealSchemaOptions, n as ViteHubContext, o as inspectServerEnv, p as UnsealOptions, r as bindServerEnvSchemas, s as isBlockingServerEnvEntry, t as DeriveSecretOptions, u as runWithCloudflareEnv } from "../server-CPEywepM.js";
|
|
3
3
|
export { DeriveSecretOptions, type EnvAccessContext, type SealOptions, type ServerEnvInspection, type ServerEnvInspectionEntry, type ServerEnvInspectionStatus, type UnsealErrorCode, type UnsealOptions, type UnsealSchemaOptions, type ViteHubContext, bindServerEnvSchemas, createSealing, deriveSecret, describeServerEnv, inspectServerEnv, isBlockingServerEnvEntry, loadServerEnv, resolveServerEnv, runWithCloudflareEnv, seal, unseal };
|
package/dist/internal/server.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { bindServerEnvSchemas, createSealing, deriveSecret, describeServerEnv, inspectServerEnv, isBlockingServerEnvEntry, loadServerEnv, resolveServerEnv, runWithCloudflareEnv, seal, unseal };
|
|
1
|
+
export { t as bindServerEnvSchemas, l as createSealing, n as deriveSecret, r as describeServerEnv, i as inspectServerEnv, a as isBlockingServerEnvEntry, o as loadServerEnv, s as resolveServerEnv, c as runWithCloudflareEnv, u as seal, d as unseal } from "../server-pTqnkM7n.js";
|