@vite-hub/env 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{access-C5sPO6C2.js → access-DIErLk3w.js} +2 -3
- package/dist/{bridge-Cs9YfQWk.d.ts → bridge-BWwIooe0.d.ts} +0 -12
- package/dist/{bridge-error-t9bc6xvE.js → bridge-error-DEqzARPJ.js} +1 -2
- package/dist/bridge.d.ts +1 -1
- package/dist/bridge.js +6 -9
- package/dist/{cli-DJtQF4Wi.d.ts → cli-B-LW6l_J.d.ts} +0 -6
- package/dist/{cli-BctSFldY.js → cli-BXzUIcnA.js} +19 -25
- 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 -3
- package/dist/{declarations-BEL0yvEY.d.ts → declarations-DNjO52_s.d.ts} +1 -3
- package/dist/{schema-CnCp0Muw.js → declarations-meg4Rmgd.js} +6 -71
- package/dist/{object-DICxAEoH.js → error-diagnostics-5BceFRdD.js} +52 -13
- package/dist/{error-diagnostics-CwQGNVnK.js → error-diagnostics-BFzFaXcH.js} +1 -2
- 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-CI2PJGqu.d.ts → operation-definition-CqZkx1Rm.d.ts} +0 -4
- package/dist/{operations-LVaCzpR0.js → operations-BftegDMd.js} +2 -3
- package/dist/operations.d.ts +2 -6
- package/dist/operations.js +6 -721
- 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-OvARy_y9.d.ts → server-CPEywepM.d.ts} +1 -11
- package/dist/{server-Ct3uvhf9.js → server-pTqnkM7n.js} +209 -152
- package/dist/server.d.ts +2 -2
- package/dist/server.js +1 -2
- package/dist/vite.d.ts +4 -16
- package/dist/vite.js +20 -21
- package/package.json +12 -10
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";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/@standard-schema+spec@1.1.0/node_modules/@standard-schema/spec/dist/index.d.ts
|
|
2
1
|
/** The Standard Typed interface. This is a base type extended by other specs. */
|
|
3
2
|
interface StandardTypedV1<Input = unknown, Output = Input> {
|
|
4
3
|
/** The Standard properties. */
|
|
@@ -74,8 +73,6 @@ declare namespace StandardSchemaV1 {
|
|
|
74
73
|
/** Infers the output type of a Standard. */
|
|
75
74
|
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
76
75
|
}
|
|
77
|
-
//#endregion
|
|
78
|
-
//#region ../internal/src/operation-definition.d.ts
|
|
79
76
|
/** `read` never changes state. `write` changes state. `destructive` deletes or publishes. */
|
|
80
77
|
type OperationKind = "read" | "write" | "destructive";
|
|
81
78
|
/** The signed-in user of a call. */
|
|
@@ -241,5 +238,4 @@ interface OperationContributionEntry {
|
|
|
241
238
|
/** `false`: the app already has these operations at runtime. Only tools such as the CLI and `vitehub inspect` read the entry. */
|
|
242
239
|
runtime?: false;
|
|
243
240
|
}
|
|
244
|
-
//#endregion
|
|
245
241
|
export { OperationContributionEntry as n, AnyOperation as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as isBlockingServerEnvEntry, c as runWithCloudflareEnv } from "./server-
|
|
1
|
+
import { a as isBlockingServerEnvEntry, c as runWithCloudflareEnv } from "./server-pTqnkM7n.js";
|
|
2
2
|
import { detectHost } from "@vite-hub/runtime";
|
|
3
3
|
import { inspectServerEnv } from "#vitehub/env/server";
|
|
4
|
-
|
|
4
|
+
// src/runtime/operations.ts
|
|
5
5
|
function entryOf(entry) {
|
|
6
6
|
return {
|
|
7
7
|
...entry.path === void 0 ? {} : { path: entry.path },
|
|
@@ -26,5 +26,4 @@ async function inspectEnvOperation(context) {
|
|
|
26
26
|
...host ? { host } : {}
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
//#endregion
|
|
30
29
|
export { inspectEnvOperation };
|
package/dist/operations.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { t as AnyOperation } from "./operation-definition-CqZkx1Rm.js";
|
|
2
|
+
import { K as ServerEnvInspectionEntry, q as ServerEnvInspectionStatus } from "./bridge-BWwIooe0.js";
|
|
3
3
|
import { ViteHubHost } from "@vite-hub/runtime";
|
|
4
|
-
//#region src/runtime/operations.d.ts
|
|
5
4
|
/** One Server Env declaration as the running app sees it. It never holds a value, a preview, or a length. */
|
|
6
5
|
interface EnvInspectEntry {
|
|
7
6
|
/** The declaration path, such as `env.server.stripe.key`. */
|
|
@@ -29,9 +28,6 @@ interface EnvInspectResult {
|
|
|
29
28
|
/** The host that the app runs on, such as `cloudflare`, so a fix can name `vitehub env push --host <host>`. */
|
|
30
29
|
host?: ViteHubHost;
|
|
31
30
|
}
|
|
32
|
-
//#endregion
|
|
33
|
-
//#region src/operations.d.ts
|
|
34
31
|
/** The `env.*` operations. The Console, the CLI, and agents run them on the signed `POST /_vitehub/rpc` endpoint. */
|
|
35
32
|
export declare const envOperations: readonly AnyOperation[];
|
|
36
|
-
//#endregion
|
|
37
33
|
export type { EnvInspectEntry, EnvInspectResult };
|