@vite-hub/env 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.
Files changed (42) hide show
  1. package/README.md +1 -1
  2. package/dist/{access-C5sPO6C2.js → access-DIErLk3w.js} +2 -3
  3. package/dist/{bridge-Cs9YfQWk.d.ts → bridge-BWwIooe0.d.ts} +0 -12
  4. package/dist/{bridge-error-t9bc6xvE.js → bridge-error-DEqzARPJ.js} +1 -2
  5. package/dist/bridge.d.ts +1 -1
  6. package/dist/bridge.js +6 -9
  7. package/dist/{cli-DJtQF4Wi.d.ts → cli-B-LW6l_J.d.ts} +0 -6
  8. package/dist/{cli-BctSFldY.js → cli-CAlHK5nn.js} +12 -21
  9. package/dist/cli.d.ts +3 -6
  10. package/dist/cli.js +1 -2
  11. package/dist/database.d.ts +2 -4
  12. package/dist/database.js +2 -3
  13. package/dist/{declarations-BEL0yvEY.d.ts → declarations-DNjO52_s.d.ts} +1 -3
  14. package/dist/{schema-CnCp0Muw.js → declarations-meg4Rmgd.js} +6 -71
  15. package/dist/{object-DICxAEoH.js → error-diagnostics-5BceFRdD.js} +52 -13
  16. package/dist/{error-diagnostics-CwQGNVnK.js → error-diagnostics-BFzFaXcH.js} +1 -2
  17. package/dist/index.d.ts +3 -13
  18. package/dist/index.js +8 -12
  19. package/dist/internal/agent.d.ts +2 -4
  20. package/dist/internal/agent.js +3 -4
  21. package/dist/internal/connections.d.ts +2 -4
  22. package/dist/internal/connections.js +3 -4
  23. package/dist/internal/server.d.ts +2 -2
  24. package/dist/internal/server.js +1 -2
  25. package/dist/{operation-definition-CI2PJGqu.d.ts → operation-definition-CqZkx1Rm.d.ts} +0 -4
  26. package/dist/{operations-LVaCzpR0.js → operations-BftegDMd.js} +2 -3
  27. package/dist/operations.d.ts +2 -6
  28. package/dist/operations.js +6 -40
  29. package/dist/runtime/public-env.d.ts +2 -4
  30. package/dist/runtime/public-env.js +2 -3
  31. package/dist/runtime/server-env.d.ts +2 -3
  32. package/dist/runtime/server-env.js +2 -3
  33. package/dist/seal.d.ts +1 -3
  34. package/dist/seal.js +1 -2
  35. package/dist/{secret-DJd-fy5T.js → secret-VhbE53Vm.js} +1 -2
  36. package/dist/{server-OvARy_y9.d.ts → server-CPEywepM.d.ts} +1 -11
  37. package/dist/{server-Ct3uvhf9.js → server-pTqnkM7n.js} +209 -152
  38. package/dist/server.d.ts +2 -2
  39. package/dist/server.js +1 -2
  40. package/dist/vite.d.ts +4 -16
  41. package/dist/vite.js +20 -21
  42. package/package.json +11 -10
package/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
- import { t as envErrorDiagnostics } from "./error-diagnostics-CwQGNVnK.js";
2
- import { r as env, t as parseSchema } from "./schema-CnCp0Muw.js";
3
- import { D as verifyViteHubHmacSignature, O as verifyViteHubStripeSignature, T as isViteHubBearerSecretEqual, _ as runtimeEnv, a as isBlockingServerEnvEntry, d as unseal, k as viteHubHmacSha256, u as seal, v as standardSource, w as githubHmacSignatureFormat } from "./server-Ct3uvhf9.js";
4
- import { t as SecretEnv } from "./secret-DJd-fy5T.js";
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
- //#region src/presets.ts
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
- //#endregion
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
- //#endregion
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
- //#endregion
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 };
@@ -1,5 +1,3 @@
1
- import { $ as EnvAttribution, t as EnvAccessContext } from "../bridge-Cs9YfQWk.js";
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;
@@ -1,7 +1,7 @@
1
- import { t as envBridgeError } from "../bridge-error-t9bc6xvE.js";
2
- import { r as grantEnvAccess } from "../access-C5sPO6C2.js";
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
- //#region src/internal/agent.ts
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-Cs9YfQWk.js";
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 envBridgeError } from "../bridge-error-t9bc6xvE.js";
2
- import { r as grantEnvAccess, t as envAccessAuthority } from "../access-C5sPO6C2.js";
3
- //#region src/internal/connections.ts
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-Cs9YfQWk.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-OvARy_y9.js";
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 };
@@ -1,2 +1 @@
1
- import { a as isBlockingServerEnvEntry, c as runWithCloudflareEnv, d as unseal, i as inspectServerEnv, l as createSealing, n as deriveSecret, o as loadServerEnv, r as describeServerEnv, s as resolveServerEnv, t as bindServerEnvSchemas, u as seal } from "../server-Ct3uvhf9.js";
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-Ct3uvhf9.js";
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
- //#region src/runtime/operations.ts
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 };
@@ -1,7 +1,6 @@
1
- import { K as ServerEnvInspectionEntry, q as ServerEnvInspectionStatus } from "./bridge-Cs9YfQWk.js";
2
- import { t as AnyOperation } from "./operation-definition-CI2PJGqu.js";
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 };
@@ -1,36 +1,6 @@
1
- import { n as isRecordOrFunction, r as internalErrorDiagnostics } from "./object-DICxAEoH.js";
1
+ import { a as isRecordOrFunction, n as standardJsonSchema, t as internalErrorDiagnostics } from "./error-diagnostics-5BceFRdD.js";
2
2
  import * as v from "valibot";
3
- //#region ../internal/src/standard-schema.ts
4
- function readOwn(value, key) {
5
- if (value === null || Object(value) !== value) return;
6
- try {
7
- return Reflect.get(Object(value), key);
8
- } catch {
9
- return;
10
- }
11
- }
12
- /**
13
- * Read a Standard JSON Schema projection without throwing.
14
- *
15
- * Returns `undefined` when the schema has no `~standard.jsonSchema`, when the library cannot represent the type
16
- * (Zod throws for `Date`), or when the projection is not an object. Callers decide how to fall back.
17
- */
18
- function standardJsonSchema(schema, direction, target = "draft-2020-12", libraryOptions) {
19
- const jsonSchema = readOwn(readOwn(schema, "~standard"), "jsonSchema");
20
- const project = readOwn(jsonSchema, direction);
21
- if (typeof project !== "function") return;
22
- try {
23
- const result = project.call(jsonSchema, libraryOptions ? {
24
- target,
25
- libraryOptions
26
- } : { target });
27
- return isRecordOrFunction(result) ? result : void 0;
28
- } catch {
29
- return;
30
- }
31
- }
32
- //#endregion
33
- //#region ../../node_modules/.pnpm/@valibot+to-json-schema@1.8.0_valibot@1.5.0_typescript@6.0.3_/node_modules/@valibot/to-json-schema/dist/index.mjs
3
+ // ../../node_modules/.pnpm/@valibot+to-json-schema@1.8.0_valibot@1.5.0_typescript@6.0.3_/node_modules/@valibot/to-json-schema/dist/index.mjs
34
4
  /**
35
5
  * Adds an error message to the errors array.
36
6
  *
@@ -712,8 +682,7 @@ function toJsonSchema(schema, config) {
712
682
  if (context.referenceMap.size) jsonSchema.$defs = context.definitions;
713
683
  return jsonSchema;
714
684
  }
715
- //#endregion
716
- //#region ../internal/src/valibot.ts
685
+ // ../internal/src/valibot.ts
717
686
  const valibotTargets = /* @__PURE__ */ new Set([
718
687
  "draft-07",
719
688
  "draft-2020-12",
@@ -754,8 +723,7 @@ function withValibotJsonSchema(schema, options = {}) {
754
723
  }
755
724
  };
756
725
  }
757
- //#endregion
758
- //#region ../internal/src/operation-definition.ts
726
+ // ../internal/src/operation-definition.ts
759
727
  const nameFormat = /^[a-z][a-z0-9-]*\.[a-z][a-z0-9-]*$/;
760
728
  const kinds = /* @__PURE__ */ new Set([
761
729
  "read",
@@ -815,9 +783,8 @@ function isSectionId(section) {
815
783
  function operationInputJsonSchema(operation) {
816
784
  return standardJsonSchema(operation.input, "input") ?? { type: "object" };
817
785
  }
818
- //#endregion
819
- //#region src/operations.ts
820
- const runtime = () => import("./operations-LVaCzpR0.js");
786
+ // src/operations.ts
787
+ const runtime = () => import("./operations-BftegDMd.js");
821
788
  /** The `env.*` operations. The Console, the CLI, and agents run them on the signed `POST /_vitehub/rpc` endpoint. */
822
789
  const envOperations = [defineOperation({
823
790
  cli: { command: "list" },
@@ -829,5 +796,4 @@ const envOperations = [defineOperation({
829
796
  section: "env",
830
797
  user: false
831
798
  })];
832
- //#endregion
833
799
  export { envOperations };
@@ -1,5 +1,3 @@
1
- import { B as PublicEnv } from "../bridge-Cs9YfQWk.js";
2
- //#region src/runtime/public-env.d.ts
1
+ import { B as PublicEnv } from "../bridge-BWwIooe0.js";
3
2
  /** Reads the declared Public Env. Its values are fixed when the app builds. */
4
- export declare function usePublicEnv(): PublicEnv;
5
- //#endregion
3
+ export declare function usePublicEnv(): PublicEnv;
@@ -1,8 +1,7 @@
1
- import { t as envErrorDiagnostics } from "../error-diagnostics-CwQGNVnK.js";
2
- //#region src/runtime/public-env.ts
1
+ import { t as envErrorDiagnostics } from "../error-diagnostics-BFzFaXcH.js";
2
+ // src/runtime/public-env.ts
3
3
  /** Reads the declared Public Env. Its values are fixed when the app builds. */
4
4
  function usePublicEnv() {
5
5
  throw envErrorDiagnostics.ENV_NOT_GENERATED({ accessor: "usePublicEnv" });
6
6
  }
7
- //#endregion
8
7
  export { usePublicEnv };
@@ -1,6 +1,5 @@
1
- import { G as ServerEnvInspection, H as ServerEnv, U as ServerEnvDescription, V as ReadonlyServerEnv, t as EnvAccessContext } from "../bridge-Cs9YfQWk.js";
1
+ import { G as ServerEnvInspection, H as ServerEnv, U as ServerEnvDescription, V as ReadonlyServerEnv, t as EnvAccessContext } from "../bridge-BWwIooe0.js";
2
2
  import { ViteHubContext } from "@vite-hub/runtime";
3
- //#region src/runtime/server-env.d.ts
4
3
  interface ServerEnvLoadOptions {
5
4
  access?: EnvAccessContext;
6
5
  signal?: AbortSignal;
@@ -19,4 +18,4 @@ export declare function describeServerEnv(): ServerEnvDescription;
19
18
  export declare function deriveSecret(_purpose: string, _event?: ViteHubContext): Promise<string>;
20
19
  /** Answers the Env bridge requests of the Console. */
21
20
  export declare function manageServerEnv(_request: Request): Promise<Response>;
22
- //#endregion
21
+ export {};
@@ -1,5 +1,5 @@
1
- import { t as envErrorDiagnostics } from "../error-diagnostics-CwQGNVnK.js";
2
- //#region src/runtime/server-env.ts
1
+ import { t as envErrorDiagnostics } from "../error-diagnostics-BFzFaXcH.js";
2
+ // src/runtime/server-env.ts
3
3
  function notGenerated(accessor) {
4
4
  throw envErrorDiagnostics.ENV_NOT_GENERATED({ accessor });
5
5
  }
@@ -31,5 +31,4 @@ async function deriveSecret(_purpose, _event) {
31
31
  async function manageServerEnv(_request) {
32
32
  return notGenerated("manageServerEnv");
33
33
  }
34
- //#endregion
35
34
  export { deriveSecret, describeServerEnv, inspectServerEnv, loadServerEnv, manageServerEnv, runWithServerEnv, useServerEnv };
package/dist/seal.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/seal.d.ts
2
1
  /** Stored sealed value format: `hex(iv):hex(ciphertext)`. */
3
2
  export declare const sealedPayloadPattern: RegExp;
4
3
  /** An imported AES-GCM key. */
@@ -13,5 +12,4 @@ export declare function sealKeyId(key: Uint8Array): Promise<string>;
13
12
  */
14
13
  export declare function sealWithKey(key: SealKey, additionalData: Uint8Array<ArrayBuffer>, plaintext: string): Promise<string>;
15
14
  /** Decrypts a value from `sealWithKey`. Fails when the key or `additionalData` differs. */
16
- export declare function unsealWithKey(key: SealKey, additionalData: Uint8Array<ArrayBuffer>, payload: string): Promise<string>;
17
- //#endregion
15
+ export declare function unsealWithKey(key: SealKey, additionalData: Uint8Array<ArrayBuffer>, payload: string): Promise<string>;
package/dist/seal.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ViteHubError } from "@vite-hub/runtime";
2
- //#region src/seal.ts
2
+ // src/seal.ts
3
3
  /** Stored sealed value format: `hex(iv):hex(ciphertext)`. */
4
4
  const sealedPayloadPattern = /^[a-f0-9]{24}:(?:[a-f0-9]{2}){16,}$/;
5
5
  function sealError() {
@@ -48,5 +48,4 @@ async function unsealWithKey(key, additionalData, payload) {
48
48
  });
49
49
  return new TextDecoder("utf-8", { ignoreBOM: true }).decode(value);
50
50
  }
51
- //#endregion
52
51
  export { importSealKey, sealKeyId, sealWithKey, sealedPayloadPattern, unsealWithKey };
@@ -1,4 +1,4 @@
1
- //#region src/secret.ts
1
+ // src/secret.ts
2
2
  const redactedSecret = "<redacted>";
3
3
  var SecretEnv = class {
4
4
  #value;
@@ -22,5 +22,4 @@ var SecretEnv = class {
22
22
  Object.defineProperty(SecretEnv.prototype, Symbol.for("nodejs.util.inspect.custom"), { value() {
23
23
  return redactedSecret;
24
24
  } });
25
- //#endregion
26
25
  export { SecretEnv as t };
@@ -1,6 +1,5 @@
1
- import { A as EnvRuntimeRegistry, G as ServerEnvInspection, K as ServerEnvInspectionEntry, Q as SecretEnv, U as ServerEnvDescription, y as DeepReadonly, z as LoadServerEnvOptions } from "./bridge-Cs9YfQWk.js";
1
+ import { A as EnvRuntimeRegistry, G as ServerEnvInspection, K as ServerEnvInspectionEntry, Q as SecretEnv, U as ServerEnvDescription, y as DeepReadonly, z as LoadServerEnvOptions } from "./bridge-BWwIooe0.js";
2
2
  import { Duration, Result, ViteHubContext, ViteHubContext as ViteHubContext$1 } from "@vite-hub/runtime";
3
- //#region src/schema.d.ts
4
3
  interface StandardSchemaResultSuccess<T = unknown> {
5
4
  issues?: undefined;
6
5
  value: T;
@@ -14,8 +13,6 @@ interface StandardSchemaV1<T = unknown> {
14
13
  };
15
14
  }
16
15
  declare function parseSchema(schema: unknown, value: unknown, label: string): unknown;
17
- //#endregion
18
- //#region src/internal/runtime-env.d.ts
19
16
  type RuntimeEnv = Record<string, unknown>;
20
17
  /**
21
18
  * A request event: an H3 event, another event with Standard Context, or a web `Request`. An H3 event matches `{ req }`
@@ -24,8 +21,6 @@ type RuntimeEnv = Record<string, unknown>;
24
21
  type RequestEvent = Request | ViteHubContext | {
25
22
  readonly req: Request;
26
23
  };
27
- //#endregion
28
- //#region src/seal-uses.d.ts
29
24
  /**
30
25
  * A SQLite, libSQL, or D1 Drizzle database, such as `db` from `vite-hub/database`. The uses of a sealed value live
31
26
  * there, because every instance of the app must see the same count. KV cannot take a use atomically.
@@ -33,8 +28,6 @@ type RequestEvent = Request | ViteHubContext | {
33
28
  interface SealUsesDatabase {
34
29
  all: (query: string) => unknown[] | PromiseLike<unknown[]>;
35
30
  }
36
- //#endregion
37
- //#region src/seal-value.d.ts
38
31
  /** The codes that `unseal()` returns. */
39
32
  type UnsealErrorCode = "ENV_SEAL_EXPIRED" | "ENV_SEAL_INVALID" | "ENV_SEAL_SCHEMA_MISMATCH" | "ENV_SEAL_USED_UP" | "ENV_SEAL_WRONG_PURPOSE";
40
33
  interface UnsealOptions {
@@ -100,8 +93,6 @@ declare function seal(purpose: string, value: unknown, options?: SealOptions): P
100
93
  */
101
94
  declare function unseal<T>(purpose: string, sealed: string, options: UnsealSchemaOptions<T>): Promise<Result<T, UnsealErrorCode>>;
102
95
  declare function unseal(purpose: string, sealed: string, options?: UnsealOptions): Promise<Result<unknown, UnsealErrorCode>>;
103
- //#endregion
104
- //#region src/server.d.ts
105
96
  /**
106
97
  * Run `callback` with `env` as the active Cloudflare bindings. Server Env reads them when a call gets no request
107
98
  * event, such as for the module bindings of `cloudflare:workers` outside a request.
@@ -143,5 +134,4 @@ declare function describeServerEnv(registry: EnvRuntimeRegistry): ServerEnvDescr
143
134
  /** Returns whether an inspection entry makes `loadServerEnv()` fail: invalid, provider error, or required and missing. */
144
135
  declare function isBlockingServerEnvEntry(entry: ServerEnvInspectionEntry): boolean;
145
136
  declare function inspectServerEnv(registry: EnvRuntimeRegistry, event?: ViteHubContext, options?: LoadServerEnvOptions): Promise<ServerEnvInspection>;
146
- //#endregion
147
137
  export { parseSchema as C, StandardSchemaV1 as S, unseal as _, describeServerEnv as a, StandardSchemaResultFailure as b, loadServerEnv as c, SealOptions as d, UnsealErrorCode as f, seal as g, createSealing as h, deriveSecret as i, resolveServerEnv as l, UnsealSchemaOptions as m, ViteHubContext$1 as n, inspectServerEnv as o, UnsealOptions as p, bindServerEnvSchemas as r, isBlockingServerEnvEntry as s, DeriveSecretOptions as t, runWithCloudflareEnv as u, SealUsesDatabase as v, StandardSchemaResultSuccess as x, RequestEvent as y };