@vite-hub/auth 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 (88) hide show
  1. package/README.md +1 -1
  2. package/dist/{abilities-9jC7iuN0.d.ts → abilities-3L1Y5Pnw.d.ts} +1 -3
  3. package/dist/abilities.d.ts +1 -1
  4. package/dist/abilities.js +1 -2
  5. package/dist/{ability-error-DmnUGicq.js → ability-error-BHhPkrZd.js} +3 -5
  6. package/dist/{ability-error-DUWJ6Q1W.d.ts → ability-error-C1c30O6E.d.ts} +0 -4
  7. package/dist/{access-pages-FNQTyGRD.js → access-pages-BwImVHN_.js} +3 -5
  8. package/dist/{admin-claim-code-CDipqeAU.js → admin-claim-code-C3X_U43x.js} +1 -2
  9. package/dist/agent.d.ts +1 -3
  10. package/dist/agent.js +5 -6
  11. package/dist/{application-path-DuTpfGFj.js → application-path-zKi7NrvK.js} +1 -2
  12. package/dist/{auth-instance-zYMjldPG.js → auth-instance-_J7R9Qs1.js} +34 -47
  13. package/dist/{cli-NCtitmny.d.ts → cli-C5pAfY4x.d.ts} +0 -6
  14. package/dist/cli.d.ts +2 -4
  15. package/dist/cli.js +3 -4
  16. package/dist/{console-runtime-Dqidb3zF.d.ts → console-runtime-BP1ZKJB0.d.ts} +1 -3
  17. package/dist/{console-runtime-CuXRDhGy.js → console-runtime-vc3JQEuq.js} +7 -9
  18. package/dist/console-runtime.d.ts +2 -2
  19. package/dist/console-runtime.js +1 -2
  20. package/dist/{console-types-CmmnKGMx.js → console-types-51lkf0lk.js} +1 -2
  21. package/dist/console.d.ts +1 -5
  22. package/dist/console.js +2 -3
  23. package/dist/{database-options-CcjUG-us.js → database-options-DQ-8qYMl.js} +2 -3
  24. package/dist/{database-schema-options-CTKCAfqW.js → database-schema-options-CkSeU9V3.js} +2 -3
  25. package/dist/database.d.ts +1 -3
  26. package/dist/database.js +4 -5
  27. package/dist/{definition-BFT9T6In.js → definition-MDGMNKrK.js} +11 -17
  28. package/dist/{error-diagnostics-uEbxSY2G.js → error-diagnostics-BssJr_2t.js} +1 -2
  29. package/dist/{events-DJmO9a9I.js → events-DZqMiae_.js} +4 -6
  30. package/dist/forward.d.ts +1 -3
  31. package/dist/forward.js +2 -3
  32. package/dist/index.d.ts +3 -7
  33. package/dist/index.js +3 -3
  34. package/dist/internal/server.d.ts +3 -3
  35. package/dist/internal/server.js +4 -4
  36. package/dist/{invariant-DolT9EEx.js → invariant-Dj2R1eMr.js} +1 -2
  37. package/dist/{mcp-config-DRRlCAWN.js → mcp-config-C7srUMIZ.js} +2 -3
  38. package/dist/{mcp-token-BhonlK9C.js → mcp-token--KuLYEub.js} +7 -18
  39. package/dist/mcp.d.ts +0 -4
  40. package/dist/mcp.js +4 -5
  41. package/dist/{members-Cl3hFRjk.js → members-D3_Q5XJb.js} +10 -14
  42. package/dist/{nitro-kit-32CVgbWS.js → nitro-kit-Bg4xUZAI.js} +2 -3
  43. package/dist/{nuxt-bridge-Cl988STZ.js → nuxt-bridge-pRyfYD5c.js} +1 -2
  44. package/dist/nuxt.d.ts +1 -7
  45. package/dist/nuxt.js +6 -9
  46. package/dist/{object-Da1zyPCR.js → object-CAK6UYR5.js} +1 -2
  47. package/dist/{own-access-CdgEICjO.d.ts → own-access-C22hSIuF.d.ts} +1 -3
  48. package/dist/{own-access-C8pwo_Kn.js → own-access-DQgqxTbI.js} +3 -4
  49. package/dist/{page-tools-shared-l4eyj53D.js → page-tools-shared-CtoKaNQZ.js} +1 -2
  50. package/dist/{presets-CHndEv5i.d.ts → presets-C6AtiRdI.d.ts} +0 -2
  51. package/dist/presets.d.ts +1 -1
  52. package/dist/presets.js +2 -3
  53. package/dist/{request-z6DHHmrb.js → request-Dpq7GO8B.js} +2 -4
  54. package/dist/runtime/console.d.ts +1 -1
  55. package/dist/runtime/console.js +2 -2
  56. package/dist/runtime/empty-abilities.d.ts +1 -3
  57. package/dist/runtime/empty-abilities.js +1 -2
  58. package/dist/runtime/empty-client.d.ts +0 -2
  59. package/dist/runtime/empty-client.js +1 -2
  60. package/dist/runtime/empty-definition.d.ts +1 -3
  61. package/dist/runtime/empty-definition.js +1 -2
  62. package/dist/runtime/nuxt.d.ts +1 -3
  63. package/dist/runtime/nuxt.js +1 -2
  64. package/dist/runtime/server.d.ts +2 -2
  65. package/dist/runtime/server.js +6 -7
  66. package/dist/runtime/vue-nuxt.d.ts +0 -2
  67. package/dist/runtime/vue-nuxt.js +5 -6
  68. package/dist/{runtime-state-ojQCzKOc.js → runtime-state-DtKUfxKq.js} +1 -2
  69. package/dist/schema.d.ts +1 -5
  70. package/dist/schema.js +2 -3
  71. package/dist/{server-Ci2i6p1S.d.ts → server-CFWlYQJb.d.ts} +5 -13
  72. package/dist/{server-CyqLFm3L.js → server-D4Hi4TBI.js} +16 -18
  73. package/dist/{server-B-zNtSvm.d.ts → server-DCsgxFPP.d.ts} +2 -6
  74. package/dist/server.d.ts +2 -2
  75. package/dist/server.js +2 -2
  76. package/dist/{session-cookies-CZmZS5QF.js → session-cookies-1FMcMnRh.js} +6 -8
  77. package/dist/{set-cookie-DWIyCCJO.js → set-cookie-DkqM1kvj.js} +3 -5
  78. package/dist/{table-specs-BhWz_U0M.d.ts → table-specs-BLm_Zlss.d.ts} +0 -2
  79. package/dist/{table-specs-D0VLp1U4.js → table-specs-jw0jjU6l.js} +1 -2
  80. package/dist/test.d.ts +2 -4
  81. package/dist/test.js +3 -4
  82. package/dist/{types-gl-myjZc.d.ts → types-BHSgxyvV.d.ts} +2 -10
  83. package/dist/{vite-QKjsPLwP.js → vite-D1xC9n1O.js} +25 -41
  84. package/dist/vite.d.ts +3 -14
  85. package/dist/vite.js +1 -2
  86. package/dist/vue.d.ts +3 -7
  87. package/dist/vue.js +4 -5
  88. package/package.json +32 -31
package/dist/database.js CHANGED
@@ -1,12 +1,12 @@
1
- import { t as authErrorDiagnostics } from "./error-diagnostics-uEbxSY2G.js";
2
- import { a as authDatabaseSchemaError, t as assertAuthDatabaseIdStrategy } from "./database-options-CcjUG-us.js";
3
- import { t as assertAuthDatabaseNames } from "./database-schema-options-CTKCAfqW.js";
1
+ import { t as authErrorDiagnostics } from "./error-diagnostics-BssJr_2t.js";
2
+ import { a as authDatabaseSchemaError, t as assertAuthDatabaseIdStrategy } from "./database-options-DQ-8qYMl.js";
3
+ import { t as assertAuthDatabaseNames } from "./database-schema-options-CkSeU9V3.js";
4
4
  import { getAuthTables } from "better-auth/db";
5
5
  import { getTableColumns, is, isTable } from "drizzle-orm";
6
6
  import { drizzleAdapter } from "better-auth/adapters/drizzle";
7
7
  import { databases } from "@vite-hub/database/runtime/registry";
8
8
  import { PgAsyncDatabase } from "drizzle-orm/pg-core";
9
- //#region src/database.ts
9
+ // src/database.ts
10
10
  /**
11
11
  * Compares the tables and fields that the options need, with the plugins and additional fields, against the Drizzle
12
12
  * tables of the Database, before the adapter opens it.
@@ -41,5 +41,4 @@ function authDatabase(name = "default") {
41
41
  };
42
42
  return Object.assign(adapter, { vitehubDatabase: name });
43
43
  }
44
- //#endregion
45
44
  export { authDatabase };
@@ -1,10 +1,10 @@
1
- import { t as authErrorDiagnostics } from "./error-diagnostics-uEbxSY2G.js";
2
- import { t as isRecord } from "./object-Da1zyPCR.js";
3
- import { t as accessRouteSyntaxError } from "./application-path-DuTpfGFj.js";
4
- import { a as normalizeAuthBasePath, n as assertAuthPages } from "./access-pages-FNQTyGRD.js";
5
- import { r as authDatabaseName } from "./database-options-CcjUG-us.js";
1
+ import { a as normalizeAuthBasePath, n as assertAuthPages } from "./access-pages-BwImVHN_.js";
2
+ import { t as accessRouteSyntaxError } from "./application-path-zKi7NrvK.js";
3
+ import { t as authErrorDiagnostics } from "./error-diagnostics-BssJr_2t.js";
4
+ import { t as isRecord } from "./object-CAK6UYR5.js";
5
+ import { r as authDatabaseName } from "./database-options-DQ-8qYMl.js";
6
6
  import { parseDuration } from "@vite-hub/runtime";
7
- //#region src/stateless-user-id.ts
7
+ // src/stateless-user-id.ts
8
8
  const pendingUserIds = /* @__PURE__ */ new WeakMap();
9
9
  /** The user ID of one provider account: the first 32 hex digits of SHA-256 over the provider ID and the account ID. */
10
10
  async function statelessUserId(providerId, accountId) {
@@ -73,8 +73,7 @@ function withStatelessUserId(options) {
73
73
  }
74
74
  };
75
75
  }
76
- //#endregion
77
- //#region src/preset-options.ts
76
+ // src/preset-options.ts
78
77
  const verificationPluginIds = /* @__PURE__ */ new Set([
79
78
  "email-otp",
80
79
  "magic-link",
@@ -165,8 +164,7 @@ function applyAuthPreset(options) {
165
164
  const { preset, ...rest } = options;
166
165
  return applyStatelessPreset(readStatelessPreset(preset), rest);
167
166
  }
168
- //#endregion
169
- //#region src/events-config.ts
167
+ // src/events-config.ts
170
168
  function validateAuthEvents(value) {
171
169
  if (value === void 0 || value === false) return;
172
170
  if (!value || typeof value !== "object" || !("store" in value) || !value.store || typeof value.store !== "object" || ![
@@ -175,16 +173,14 @@ function validateAuthEvents(value) {
175
173
  "aggregate"
176
174
  ].every((key) => typeof Reflect.get(value.store, key) === "function") || "authorize" in value && value.authorize !== void 0 && typeof value.authorize !== "function" || "onEvent" in value && value.onEvent !== void 0 && typeof value.onEvent !== "function") throw authErrorDiagnostics.AUTH_C0050({ message: "`defineAuth()` events needs a store with append, list, and aggregate methods. events.authorize and events.onEvent must be functions. Set events to false to disable the log." });
177
175
  }
178
- //#endregion
179
- //#region ../internal/src/runtime/user-data.ts
176
+ // ../internal/src/runtime/user-data.ts
180
177
  const stateKey = Symbol.for("vitehub.user-data");
181
178
  const scope = globalThis;
182
179
  /** The registered owners, by owner name. */
183
180
  function viteHubUserData(app) {
184
181
  return [...(app && scope[stateKey]?.get(app))?.values() ?? []].sort((left, right) => left.owner.localeCompare(right.owner));
185
182
  }
186
- //#endregion
187
- //#region src/delete-account.ts
183
+ // src/delete-account.ts
188
184
  /** Also checked when a Definition callback returns the options. */
189
185
  function validateDeleteAccount(options) {
190
186
  if (isRecord(options.user) && options.user.deleteUser !== void 0) throw authErrorDiagnostics.AUTH_DELETE_USER_UNSUPPORTED();
@@ -302,8 +298,7 @@ function createDeleteAccount(option, app) {
302
298
  }
303
299
  };
304
300
  }
305
- //#endregion
306
- //#region src/definition.ts
301
+ // src/definition.ts
307
302
  const authRuntimeOptionNames = /* @__PURE__ */ new Set([
308
303
  "baseURL",
309
304
  "secret",
@@ -422,5 +417,4 @@ function defineAuthOptions(options) {
422
417
  applyAuthPreset(options);
423
418
  return { options };
424
419
  }
425
- //#endregion
426
420
  export { createDeleteAccount as a, applyAuthPreset as c, validateAuthComponents as i, defineAuth as n, validateDeleteAccount as o, validateAuthAccessPolicy as r, validateAuthEvents as s, assertNoRuntimeOption as t };
@@ -1,5 +1,5 @@
1
1
  import { defineDiagnostics } from "nostics";
2
- //#region src/error-diagnostics.ts
2
+ // src/error-diagnostics.ts
3
3
  const dynamicError = { why: ({ message }) => message === void 0 ? "" : String(message) };
4
4
  /** A code whose call site passes the message as `why`, with the fix that the reader applies. */
5
5
  const withFix = (fix) => ({
@@ -176,5 +176,4 @@ const authErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
176
176
  }
177
177
  }
178
178
  });
179
- //#endregion
180
179
  export { authErrorDiagnostics as t };
@@ -1,9 +1,9 @@
1
- import { t as authErrorDiagnostics } from "./error-diagnostics-uEbxSY2G.js";
2
- import { t as isRecord } from "./object-Da1zyPCR.js";
1
+ import { t as authErrorDiagnostics } from "./error-diagnostics-BssJr_2t.js";
2
+ import { t as isRecord } from "./object-CAK6UYR5.js";
3
3
  import { defineErrors } from "@vite-hub/runtime";
4
4
  import { sql } from "drizzle-orm";
5
5
  import * as v from "valibot";
6
- //#region src/github.ts
6
+ // src/github.ts
7
7
  const githubErrors = /*#__PURE__*/ defineErrors({
8
8
  docs: "https://vitehub.dev/docs/auth/diagnostics",
9
9
  codes: {
@@ -108,8 +108,7 @@ async function checkGitHubOrgMember(accessToken, org, options = {}) {
108
108
  }
109
109
  return result;
110
110
  }
111
- //#endregion
112
- //#region src/events.ts
111
+ // src/events.ts
113
112
  const authEventTypes = [
114
113
  "user.signed_up",
115
114
  "user.signed_in",
@@ -302,5 +301,4 @@ function createDatabaseAuthEventStore(options) {
302
301
  }
303
302
  };
304
303
  }
305
- //#endregion
306
304
  export { checkGitHubOrgMember as a, parseAuthEventWindow as i, defaultAuthEventRetention as n, parseAuthEventList as r, createDatabaseAuthEventStore as t };
package/dist/forward.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { BetterAuthPlugin } from "better-auth";
2
- //#region src/forward.d.ts
3
2
  /**
4
3
  * Sign-in through a trusted reverse proxy, such as oauth2-proxy, Cloudflare Access, or Tailscale Serve. The proxy
5
4
  * sends the person's identity, or a credential for it, in a request header. Auth trusts the header only when `verify`
@@ -46,5 +45,4 @@ export declare const forwardAuthPluginId = "vitehub-forward-auth";
46
45
  * made for the identity before, or a new one, which also sets the session cookie on the response. When `verify` returns
47
46
  * `null`, the request keeps its own session cookie, if any.
48
47
  */
49
- export declare function forwardAuth(options: ForwardAuthOptions): BetterAuthPlugin;
50
- //#endregion
48
+ export declare function forwardAuth(options: ForwardAuthOptions): BetterAuthPlugin;
package/dist/forward.js CHANGED
@@ -1,8 +1,8 @@
1
- import { t as authErrorDiagnostics } from "./error-diagnostics-uEbxSY2G.js";
1
+ import { t as authErrorDiagnostics } from "./error-diagnostics-BssJr_2t.js";
2
2
  import { createAuthMiddleware } from "better-auth/api";
3
3
  import { applySetCookies, deleteSessionCookie, setSessionCookie } from "better-auth/cookies";
4
4
  import { handleOAuthUserInfo, setTokenUtil } from "better-auth/oauth2";
5
- //#region src/forward.ts
5
+ // src/forward.ts
6
6
  const forwardAuthPluginId = "vitehub-forward-auth";
7
7
  const nonEmpty = (value) => typeof value === "string" && value.trim().length > 0;
8
8
  function assertIdentity(value) {
@@ -116,5 +116,4 @@ function forwardAuth(options) {
116
116
  }] }
117
117
  };
118
118
  }
119
- //#endregion
120
119
  export { forwardAuth, forwardAuthPluginId };
package/dist/index.d.ts CHANGED
@@ -1,13 +1,10 @@
1
1
  /// <reference path="./host-declarations.d.ts" />
2
- import { A as AuthRuntimeEnv, At as AuthEventActor, B as DiscoveredAuthDefinition, Bt as AuthEventsConfiguration, C as AuthGuardedHandler, D as AuthReservedOption, F as AuthSessionRefresh, Ft as AuthEventPage, Ht as defaultAuthEventRetention, I as AuthSessionRefreshContext, It as AuthEventRetention, L as AuthSessionRefreshFields, Lt as AuthEventStore, M as AuthRuntimeOption, Mt as AuthEventCounts, N as AuthRuntimeOptions, Nt as AuthEventListInput, O as AuthResolvedDefinitionOptions, Ot as AuthDevice, P as AuthSessionOptions, Pt as AuthEventMetadata, R as AuthSignInConfiguration, Rt as AuthEventType, S as AuthFor, T as AuthRequest, U as ResolvedAuthViteConfig, V as RegisteredAuth, Vt as createDatabaseAuthEventStore, W as ViteHubAuth, X as AuthConsoleColumn, _ as AuthDefinition, _t as AuthConsoleRoles, a as AuthAccessPolicy, b as AuthDefinitionResolver, c as AuthAccessRouteConfiguration, d as AuthAnonymousGuardedHandler, g as AuthComponentsOptions, h as AuthBetterAuthRuntimeOptions, ht as AuthConsolePolicy, i as AuthAccessConfiguration, j as AuthRuntimeOnlyOptions, jt as AuthEventAggregates, k as AuthRuntimeContext, kt as AuthEvent, l as AuthAnonymousAuthorization, m as AuthBetterAuthOptions, n as AuthAccessAuthorize, nt as AuthConsoleFieldPolicy, o as AuthAccessPolicyContext, p as AuthAuthorization, r as AuthAccessAuthorizeResult, s as AuthAccessRoute, t as AuthAccessAuthorizationContext, u as AuthAnonymousAuthorize, ut as AuthConsoleOptions, v as AuthDefinitionInput, w as AuthOptions, x as AuthDeleteAccountOptions, y as AuthDefinitionOptions, z as AuthViteHubOptions, zt as AuthEventWindow } from "./types-gl-myjZc.js";
3
- import { n as AuthStatelessPreset, r as AuthStatelessPresetOptions, t as AuthPreset } from "./presets-CHndEv5i.js";
4
- import { n as checksOwnAccess } from "./own-access-CdgEICjO.js";
2
+ import { A as AuthRuntimeEnv, At as AuthEventActor, B as DiscoveredAuthDefinition, Bt as AuthEventsConfiguration, C as AuthGuardedHandler, D as AuthReservedOption, F as AuthSessionRefresh, Ft as AuthEventPage, Ht as defaultAuthEventRetention, I as AuthSessionRefreshContext, It as AuthEventRetention, L as AuthSessionRefreshFields, Lt as AuthEventStore, M as AuthRuntimeOption, Mt as AuthEventCounts, N as AuthRuntimeOptions, Nt as AuthEventListInput, O as AuthResolvedDefinitionOptions, Ot as AuthDevice, P as AuthSessionOptions, Pt as AuthEventMetadata, R as AuthSignInConfiguration, Rt as AuthEventType, S as AuthFor, T as AuthRequest, U as ResolvedAuthViteConfig, V as RegisteredAuth, Vt as createDatabaseAuthEventStore, W as ViteHubAuth, X as AuthConsoleColumn, _ as AuthDefinition, _t as AuthConsoleRoles, a as AuthAccessPolicy, b as AuthDefinitionResolver, c as AuthAccessRouteConfiguration, d as AuthAnonymousGuardedHandler, g as AuthComponentsOptions, h as AuthBetterAuthRuntimeOptions, ht as AuthConsolePolicy, i as AuthAccessConfiguration, j as AuthRuntimeOnlyOptions, jt as AuthEventAggregates, k as AuthRuntimeContext, kt as AuthEvent, l as AuthAnonymousAuthorization, m as AuthBetterAuthOptions, n as AuthAccessAuthorize, nt as AuthConsoleFieldPolicy, o as AuthAccessPolicyContext, p as AuthAuthorization, r as AuthAccessAuthorizeResult, s as AuthAccessRoute, t as AuthAccessAuthorizationContext, u as AuthAnonymousAuthorize, ut as AuthConsoleOptions, v as AuthDefinitionInput, w as AuthOptions, x as AuthDeleteAccountOptions, y as AuthDefinitionOptions, z as AuthViteHubOptions, zt as AuthEventWindow } from "./types-BHSgxyvV.js";
3
+ import { n as checksOwnAccess } from "./own-access-C22hSIuF.js";
4
+ import { n as AuthStatelessPreset, r as AuthStatelessPresetOptions, t as AuthPreset } from "./presets-C6AtiRdI.js";
5
5
  import { Result } from "@vite-hub/runtime";
6
- //#region src/definition.d.ts
7
6
  export declare function defineAuth<const TOptions extends AuthResolvedDefinitionOptions>(options: AuthDefinitionResolver<TOptions>): AuthDefinition<AuthDefinitionResolver<TOptions>>;
8
7
  export declare function defineAuth<const TOptions extends AuthBetterAuthOptions & Pick<AuthViteHubOptions, "database" | "runtime">>(options: AuthDefinitionOptions<TOptions>): AuthDefinition<AuthDefinitionOptions<TOptions>>;
9
- //#endregion
10
- //#region src/github.d.ts
11
8
  interface GitHubOrgMemberOptions {
12
9
  /** Reuse a successful check no older than this many milliseconds per token and organization. Default: no cache. */
13
10
  cacheMs?: number;
@@ -21,5 +18,4 @@ type GitHubOrgMemberErrorCode = "AUTH_GITHUB_NOT_ORG_MEMBER" | "AUTH_GITHUB_ORG_
21
18
  * Returns `[undefined, undefined]` for an active membership, else the error that says why it could not confirm one.
22
19
  */
23
20
  export declare function checkGitHubOrgMember(accessToken: string | null | undefined, org: string, options?: GitHubOrgMemberOptions): Promise<Result<void, GitHubOrgMemberErrorCode>>;
24
- //#endregion
25
21
  export { type AuthAccessAuthorizationContext, type AuthAccessAuthorize, type AuthAccessAuthorizeResult, type AuthAccessConfiguration, type AuthAccessPolicy, type AuthAccessPolicyContext, type AuthAccessRoute, type AuthAccessRouteConfiguration, type AuthAnonymousAuthorization, type AuthAnonymousAuthorize, type AuthAnonymousGuardedHandler, type AuthAuthorization, type AuthBetterAuthOptions, type AuthBetterAuthRuntimeOptions, type AuthComponentsOptions, type AuthConsoleColumn, type AuthConsoleFieldPolicy, type AuthConsoleOptions, type AuthConsolePolicy, type AuthConsoleRoles, type AuthDefinition, type AuthDefinitionInput, type AuthDefinitionOptions, type AuthDefinitionResolver, type AuthDeleteAccountOptions, type AuthDevice, type AuthEvent, type AuthEventActor, type AuthEventAggregates, type AuthEventCounts, type AuthEventListInput, type AuthEventMetadata, type AuthEventPage, type AuthEventRetention, type AuthEventStore, type AuthEventType, type AuthEventWindow, type AuthEventsConfiguration, type AuthFor, type AuthGuardedHandler, type AuthOptions, type AuthPreset, type AuthRequest, type AuthReservedOption, type AuthResolvedDefinitionOptions, type AuthRuntimeContext, type AuthRuntimeEnv, type AuthRuntimeOnlyOptions, type AuthRuntimeOption, type AuthRuntimeOptions, type AuthSessionOptions, type AuthSessionRefresh, type AuthSessionRefreshContext, type AuthSessionRefreshFields, type AuthSignInConfiguration, type AuthStatelessPreset, type AuthStatelessPresetOptions, type AuthViteHubOptions, type DiscoveredAuthDefinition, type GitHubOrgMemberErrorCode, type GitHubOrgMemberOptions, type RegisteredAuth, type ResolvedAuthViteConfig, type ViteHubAuth, checksOwnAccess, createDatabaseAuthEventStore, defaultAuthEventRetention };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as checkGitHubOrgMember, n as defaultAuthEventRetention, t as createDatabaseAuthEventStore } from "./events-DJmO9a9I.js";
2
- import { n as defineAuth } from "./definition-BFT9T6In.js";
3
- import { n as checksOwnAccess } from "./own-access-C8pwo_Kn.js";
1
+ import { n as defineAuth } from "./definition-MDGMNKrK.js";
2
+ import { a as checkGitHubOrgMember, n as defaultAuthEventRetention, t as createDatabaseAuthEventStore } from "./events-DZqMiae_.js";
3
+ import { n as checksOwnAccess } from "./own-access-DQgqxTbI.js";
4
4
  export { checkGitHubOrgMember, checksOwnAccess, createDatabaseAuthEventStore, defaultAuthEventRetention, defineAuth };
@@ -1,5 +1,5 @@
1
1
  /// <reference path="../host-declarations.d.ts" />
2
- import { C as requireCaller, D as withAnonymousAuthorization, E as useAuth, M as findVerifiedAuthUserId, N as getAuthForDefinition, O as withAuth, S as requireAuthorization, T as toAuthRequest, _ as handleAuthRequest, a as authRoute, b as requireAuth, c as createAuth, d as createAuthHandler, f as createAuthRequestRuntimeOptions, g as handleAuth, h as getAuthEvents, i as assertAuthOrigin, j as createBetterAuthOptions, k as withAuthorization, l as createAuthAccessHandler, m as getAuthConsoleForRequest, n as AuthSignOutOptions, o as can, p as getAuth, r as aggregateAuthEvents, s as checkAuthMember, t as AuthEventReadErrorCode, u as createAuthForRequest, v as listAuthEvents, w as signOut, x as requireAuthAccessRoutes, y as requireAbility } from "../server-Ci2i6p1S.js";
3
- import { a as setAuthAccessIdentityResolver, o as setAuthRuntimeEnvResolver, s as resetAuth } from "../server-B-zNtSvm.js";
4
- import { n as AbilityErrorData, t as AbilityError } from "../ability-error-DUWJ6Q1W.js";
2
+ import { C as requireCaller, D as withAnonymousAuthorization, E as useAuth, M as findVerifiedAuthUserId, N as getAuthForDefinition, O as withAuth, S as requireAuthorization, T as toAuthRequest, _ as handleAuthRequest, a as authRoute, b as requireAuth, c as createAuth, d as createAuthHandler, f as createAuthRequestRuntimeOptions, g as handleAuth, h as getAuthEvents, i as assertAuthOrigin, j as createBetterAuthOptions, k as withAuthorization, l as createAuthAccessHandler, m as getAuthConsoleForRequest, n as AuthSignOutOptions, o as can, p as getAuth, r as aggregateAuthEvents, s as checkAuthMember, t as AuthEventReadErrorCode, u as createAuthForRequest, v as listAuthEvents, w as signOut, x as requireAuthAccessRoutes, y as requireAbility } from "../server-CFWlYQJb.js";
3
+ import { a as setAuthAccessIdentityResolver, o as setAuthRuntimeEnvResolver, s as resetAuth } from "../server-DCsgxFPP.js";
4
+ import { n as AbilityErrorData, t as AbilityError } from "../ability-error-C1c30O6E.js";
5
5
  export { AbilityError, type AbilityErrorData, AuthEventReadErrorCode, AuthSignOutOptions, aggregateAuthEvents, assertAuthOrigin, can, checkAuthMember, createAuth, createAuthAccessHandler, createAuthForRequest, createAuthHandler, createAuthRequestRuntimeOptions, createBetterAuthOptions, authRoute as default, findVerifiedAuthUserId, getAuth, getAuthConsoleForRequest, getAuthEvents, getAuthForDefinition, handleAuth, handleAuthRequest, listAuthEvents, requireAbility, requireAuth, requireAuthAccessRoutes, requireAuthorization, requireCaller, resetAuth, setAuthAccessIdentityResolver, setAuthRuntimeEnvResolver, signOut, toAuthRequest, useAuth, withAnonymousAuthorization, withAuth, withAuthorization };
@@ -1,6 +1,6 @@
1
- import { i as resetAuth } from "../runtime-state-ojQCzKOc.js";
2
- import { a as getAuthForDefinition, i as findVerifiedAuthUserId, n as createBetterAuthOptions } from "../auth-instance-zYMjldPG.js";
1
+ import { i as resetAuth } from "../runtime-state-DtKUfxKq.js";
2
+ import { a as getAuthForDefinition, i as findVerifiedAuthUserId, n as createBetterAuthOptions } from "../auth-instance-_J7R9Qs1.js";
3
3
  import { setAuthAccessIdentityResolver, setAuthRuntimeEnvResolver } from "../runtime/server.js";
4
- import { t as AbilityError } from "../ability-error-DmnUGicq.js";
5
- import { C as toAuthRequest, D as withAuthorization, E as withAuth, S as signOut, T as withAnonymousAuthorization, _ as requireAbility, a as checkAuthMember, b as requireAuthorization, c as createAuthForRequest, d as getAuth, f as getAuthConsoleForRequest, g as listAuthEvents, h as handleAuthRequest, i as can, l as createAuthHandler, m as handleAuth, n as assertAuthOrigin, o as createAuth, p as getAuthEvents, r as authRoute, s as createAuthAccessHandler, t as aggregateAuthEvents, u as createAuthRequestRuntimeOptions, v as requireAuth, w as useAuth, x as requireCaller, y as requireAuthAccessRoutes } from "../server-CyqLFm3L.js";
4
+ import { t as AbilityError } from "../ability-error-BHhPkrZd.js";
5
+ import { C as toAuthRequest, D as withAuthorization, E as withAuth, S as signOut, T as withAnonymousAuthorization, _ as requireAbility, a as checkAuthMember, b as requireAuthorization, c as createAuthForRequest, d as getAuth, f as getAuthConsoleForRequest, g as listAuthEvents, h as handleAuthRequest, i as can, l as createAuthHandler, m as handleAuth, n as assertAuthOrigin, o as createAuth, p as getAuthEvents, r as authRoute, s as createAuthAccessHandler, t as aggregateAuthEvents, u as createAuthRequestRuntimeOptions, v as requireAuth, w as useAuth, x as requireCaller, y as requireAuthAccessRoutes } from "../server-D4Hi4TBI.js";
6
6
  export { AbilityError, aggregateAuthEvents, assertAuthOrigin, can, checkAuthMember, createAuth, createAuthAccessHandler, createAuthForRequest, createAuthHandler, createAuthRequestRuntimeOptions, createBetterAuthOptions, authRoute as default, findVerifiedAuthUserId, getAuth, getAuthConsoleForRequest, getAuthEvents, getAuthForDefinition, handleAuth, handleAuthRequest, listAuthEvents, requireAbility, requireAuth, requireAuthAccessRoutes, requireAuthorization, requireCaller, resetAuth, setAuthAccessIdentityResolver, setAuthRuntimeEnvResolver, signOut, toAuthRequest, useAuth, withAnonymousAuthorization, withAuth, withAuthorization };
@@ -1,5 +1,5 @@
1
1
  import { defineDiagnostics } from "nostics";
2
- //#region ../internal/src/invariant.ts
2
+ // ../internal/src/invariant.ts
3
3
  const invariantDiagnostics = /*#__PURE__*/ defineDiagnostics({
4
4
  docsBase: "https://vitehub.dev/docs/development/diagnostics",
5
5
  codes: { INTERNAL_INVARIANT_FAILED: {
@@ -18,5 +18,4 @@ function invariantError(what) {
18
18
  function invariant(condition, what) {
19
19
  if (!condition) throw invariantError(what);
20
20
  }
21
- //#endregion
22
21
  export { invariantError as n, invariant as t };
@@ -1,5 +1,5 @@
1
- import { t as isRecord } from "./object-Da1zyPCR.js";
2
- //#region src/mcp-config.ts
1
+ import { t as isRecord } from "./object-CAK6UYR5.js";
2
+ // src/mcp-config.ts
3
3
  const mcpRegistrationPluginId = "vitehub-mcp-registration";
4
4
  /**
5
5
  * The resources of MCP OAuth: the Better Auth `oauthProvider()` with `resources` and JWT access tokens of `jwt()`, from
@@ -14,5 +14,4 @@ function mcpOAuthResources(plugins = []) {
14
14
  }
15
15
  /** True for a token in the JWS compact form (`header.payload.signature`), the form of an MCP OAuth access token. */
16
16
  const isJwsToken = (token) => /^[\w-]+\.[\w-]+\.[\w-]+$/.test(token);
17
- //#endregion
18
17
  export { mcpOAuthResources as n, mcpRegistrationPluginId as r, isJwsToken as t };
@@ -1,10 +1,10 @@
1
- import { t as isRecord } from "./object-Da1zyPCR.js";
2
- import { l as findAccessPolicyPlugin } from "./members-Cl3hFRjk.js";
3
- import { t as authForRequest } from "./auth-instance-zYMjldPG.js";
4
- import { n as mcpOAuthResources } from "./mcp-config-DRRlCAWN.js";
1
+ import { l as findAccessPolicyPlugin } from "./members-D3_Q5XJb.js";
2
+ import { t as authForRequest } from "./auth-instance-_J7R9Qs1.js";
3
+ import { n as mcpOAuthResources } from "./mcp-config-C7srUMIZ.js";
4
+ import { t as isRecord } from "./object-CAK6UYR5.js";
5
5
  import { defineErrors } from "@vite-hub/runtime";
6
6
  import { verifyJwsAccessToken } from "better-auth/oauth2";
7
- //#region \0rolldown/runtime.js
7
+ // \0rolldown/runtime.js
8
8
  var __defProp = Object.defineProperty;
9
9
  var __exportAll = (all, no_symbols) => {
10
10
  let target = {};
@@ -15,18 +15,8 @@ var __exportAll = (all, no_symbols) => {
15
15
  if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
16
16
  return target;
17
17
  };
18
- //#endregion
19
- //#region src/mcp-token.ts
20
- var mcp_token_exports = /* @__PURE__ */ __exportAll({
21
- appAuth: () => appAuth,
22
- baseScopes: () => baseScopes,
23
- deleteUnusedMcpClients: () => deleteUnusedMcpClients,
24
- mcpOAuthAuth: () => mcpOAuthAuth,
25
- pathOf: () => pathOf,
26
- stateOf: () => stateOf,
27
- verifyAppAccessToken: () => verifyAppAccessToken,
28
- verifyMcpRequest: () => verifyMcpRequest
29
- });
18
+ // src/mcp-token.ts
19
+ var mcp_token_exports = /* @__PURE__ */ __exportAll({ verifyAppAccessToken: () => verifyAppAccessToken });
30
20
  const mcpErrors = /*#__PURE__*/ defineErrors({
31
21
  docs: "https://vitehub.dev/docs/auth/diagnostics",
32
22
  codes: {
@@ -218,5 +208,4 @@ async function deleteUnusedMcpClients(options = {}) {
218
208
  return [mcpErrors.AUTH_MCP_CLEANUP_FAILED({ cause: error }), void 0];
219
209
  }
220
210
  }
221
- //#endregion
222
211
  export { pathOf as a, mcp_token_exports as i, baseScopes as n, stateOf as o, deleteUnusedMcpClients as r, verifyMcpRequest as s, appAuth as t };
package/dist/mcp.d.ts CHANGED
@@ -2,7 +2,6 @@ import { Result } from "@vite-hub/runtime";
2
2
  import { BetterAuthPlugin } from "better-auth";
3
3
  import { oauthProvider } from "@better-auth/oauth-provider";
4
4
  import { jwt } from "better-auth/plugins";
5
- //#region src/mcp-token.d.ts
6
5
  type McpOAuthErrorCode = "AUTH_MCP_CLEANUP_FAILED" | "AUTH_MCP_OAUTH_MISSING" | "AUTH_MCP_TOKEN_INVALID" | "AUTH_MCP_TOKEN_MISSING";
7
6
  /** What the MCP helpers read from a Better Auth instance. `useAuth()` returns one. */
8
7
  interface McpOAuthAuth {
@@ -112,8 +111,6 @@ interface DeleteUnusedMcpClientsOptions {
112
111
  export declare function deleteUnusedMcpClients(options?: DeleteUnusedMcpClientsOptions): Promise<Result<{
113
112
  deleted: number;
114
113
  }, "AUTH_MCP_CLEANUP_FAILED">>;
115
- //#endregion
116
- //#region src/mcp.d.ts
117
114
  /**
118
115
  * OAuth 2.1 sign-in for an MCP server of the app, with Better Auth as the authorization server. `mcpOAuth()` adds the
119
116
  * plugins, `serveMcpOAuthDiscovery()` answers the well-known documents at the origin root, `verifyMcpRequest()` checks the
@@ -194,5 +191,4 @@ export interface McpOAuthDiscoveryOptions {
194
191
  * ```
195
192
  */
196
193
  export declare function serveMcpOAuthDiscovery(request: Request, options?: McpOAuthDiscoveryOptions): Promise<Response | undefined>;
197
- //#endregion
198
194
  export type { DeleteUnusedMcpClientsOptions, McpCaller, McpOAuthAuth, McpOAuthErrorCode, VerifyMcpRequestOptions };
package/dist/mcp.js CHANGED
@@ -1,10 +1,10 @@
1
- import { a as pathOf, n as baseScopes, o as stateOf, r as deleteUnusedMcpClients, s as verifyMcpRequest, t as appAuth } from "./mcp-token-BhonlK9C.js";
2
- import { t as isRecord } from "./object-Da1zyPCR.js";
3
- import { r as mcpRegistrationPluginId } from "./mcp-config-DRRlCAWN.js";
1
+ import { t as isRecord } from "./object-CAK6UYR5.js";
2
+ import { r as mcpRegistrationPluginId } from "./mcp-config-C7srUMIZ.js";
3
+ import { a as pathOf, n as baseScopes, o as stateOf, r as deleteUnusedMcpClients, s as verifyMcpRequest, t as appAuth } from "./mcp-token--KuLYEub.js";
4
4
  import { APIError, createAuthMiddleware } from "better-auth/api";
5
5
  import { oauthProvider, oauthProviderAuthServerMetadata, oauthProviderOpenIdConfigMetadata } from "@better-auth/oauth-provider";
6
6
  import { jwt } from "better-auth/plugins";
7
- //#region src/mcp.ts
7
+ // src/mcp.ts
8
8
  const registerPath = "/oauth2/register";
9
9
  /** Bounds RFC 7591 client metadata without restricting the private-use redirect schemes of native MCP clients. */
10
10
  function registrationProblem(body, maxBytes) {
@@ -168,5 +168,4 @@ async function discoveryDocument(request, document, options) {
168
168
  if (suffix && suffix !== pathOf(state.issuer)) return void 0;
169
169
  return (document === "oauth-authorization-server" ? oauthProviderAuthServerMetadata(auth) : oauthProviderOpenIdConfigMetadata(auth))(request);
170
170
  }
171
- //#endregion
172
171
  export { deleteUnusedMcpClients, mcpOAuth, serveMcpOAuthDiscovery, verifyMcpRequest };
@@ -1,15 +1,15 @@
1
- import { t as authErrorDiagnostics } from "./error-diagnostics-uEbxSY2G.js";
2
- import { t as authCloudflareEnv } from "./request-z6DHHmrb.js";
3
- import { n as adminClaimVariable, t as adminClaimHash } from "./admin-claim-code-CDipqeAU.js";
4
- import { n as getAuthRuntimeState } from "./runtime-state-ojQCzKOc.js";
5
- import { t as invariant } from "./invariant-DolT9EEx.js";
6
- import { a as checkGitHubOrgMember } from "./events-DJmO9a9I.js";
1
+ import { t as authErrorDiagnostics } from "./error-diagnostics-BssJr_2t.js";
2
+ import { t as authCloudflareEnv } from "./request-Dpq7GO8B.js";
3
+ import { n as adminClaimVariable, t as adminClaimHash } from "./admin-claim-code-C3X_U43x.js";
4
+ import { n as getAuthRuntimeState } from "./runtime-state-DtKUfxKq.js";
5
+ import { t as invariant } from "./invariant-Dj2R1eMr.js";
6
+ import { a as checkGitHubOrgMember } from "./events-DZqMiae_.js";
7
7
  import { defineErrors, parseDuration } from "@vite-hub/runtime";
8
8
  import { APIError, createAuthEndpoint, createAuthMiddleware, getSessionFromCtx, sessionMiddleware } from "better-auth/api";
9
9
  import { createSessionStore, deleteSessionCookie, expireCookie, parseCookies } from "better-auth/cookies";
10
10
  import { createInternalAdapter } from "better-auth/db";
11
11
  import { decryptOAuthToken } from "better-auth/oauth2";
12
- //#region src/admins.ts
12
+ // src/admins.ts
13
13
  /** The variable that lists the provider accounts that get the admin role. */
14
14
  const adminsVariable = "VITEHUB_ADMINS";
15
15
  /** The id of the Better Auth plugin that gives the admin role. The Auth Console reads its `options.admins`. */
@@ -115,8 +115,7 @@ function createAdminsPlugin(admins, plugins) {
115
115
  }
116
116
  };
117
117
  }
118
- //#endregion
119
- //#region src/admin-claim.ts
118
+ // src/admin-claim.ts
120
119
  /** The id of the Better Auth plugin that turns a claim code into the admin role. */
121
120
  const adminClaimPluginId = "vitehub-admin-claim";
122
121
  /** The configured claim hash, or `undefined` when the app has no claim code. */
@@ -218,8 +217,7 @@ function createAdminClaimPlugin(hash, plugins) {
218
217
  }
219
218
  };
220
219
  }
221
- //#endregion
222
- //#region src/access-policy.ts
220
+ // src/access-policy.ts
223
221
  /** The id of the Better Auth plugin that applies `access.policy` and `VITEHUB_MEMBERS`. `verifyMcpRequest()` finds the policy by it. */
224
222
  const accessPolicyPluginId = "vitehub-access-policy";
225
223
  const defaultRecheck = "5m";
@@ -337,8 +335,7 @@ function findAccessPolicyPlugin(plugins) {
337
335
  const plugin = plugins?.find((entry) => entry.id === accessPolicyPluginId);
338
336
  return plugin && "allows" in plugin && typeof plugin.allows === "function" ? plugin : void 0;
339
337
  }
340
- //#endregion
341
- //#region src/members.ts
338
+ // src/members.ts
342
339
  const orgCacheMs = 3e5;
343
340
  /** The variable that lists who may sign up and sign in. */
344
341
  const membersVariable = "VITEHUB_MEMBERS";
@@ -529,5 +526,4 @@ function createMembersGate(members, admins, plugins) {
529
526
  })
530
527
  };
531
528
  }
532
- //#endregion
533
529
  export { readMembers as a, createAccessPolicyPlugin as c, createAdminClaimPlugin as d, readAdminClaim as f, readAdmins as g, createAdminsPlugin as h, notMemberError as i, findAccessPolicyPlugin as l, adminsVariable as m, createMembersGate as n, withMemberScopes as o, adminsPluginId as p, membersVariable as r, accessPolicyPluginId as s, assertMembersSessionStore as t, adminClaimPluginId as u };
@@ -1,5 +1,5 @@
1
- import { n as isRecordOrFunction } from "./object-Da1zyPCR.js";
2
- //#region ../internal/src/nitro-kit.ts
1
+ import { n as isRecordOrFunction } from "./object-CAK6UYR5.js";
2
+ // ../internal/src/nitro-kit.ts
3
3
  /**
4
4
  * The route meta of a ViteHub handler that Auth access routes leave alone, such as the Console RPC. The handler takes
5
5
  * only its own signed requests and one-time links, so app access rules do not apply to it.
@@ -40,5 +40,4 @@ function createNitroServerKit(value = {}) {
40
40
  }
41
41
  };
42
42
  }
43
- //#endregion
44
43
  export { ownAccessHandlerMeta as n, ownAccessRouteMeta as r, createNitroServerKit as t };
@@ -1,4 +1,4 @@
1
- //#region src/nuxt-bridge.ts
1
+ // src/nuxt-bridge.ts
2
2
  /** The hooks that the setters below install. The composables read them. */
3
3
  const authNuxtBridge = {};
4
4
  /** Internal bridge installed by the Nuxt module, without making `#app` a dependency of the Vue entry. */
@@ -40,5 +40,4 @@ function setSessionSeedResolver(resolver) {
40
40
  function setRequestFetchResolver(resolver) {
41
41
  authNuxtBridge.requestFetchResolver = resolver;
42
42
  }
43
- //#endregion
44
43
  export { setRequestFetchResolver as a, setNuxtErrorFactory as i, setDefaultAuthBasePath as n, setSessionSeedResolver as o, setNuxtAppResolver as r, setSignOutHandler as s, authNuxtBridge as t };
package/dist/nuxt.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  /// <reference path="./host-declarations.d.ts" />
2
- import { Dt as AuthPages, Et as AuthPageMode, Tt as AuthPageMeta, w as AuthOptions } from "./types-gl-myjZc.js";
2
+ import { Dt as AuthPages, Et as AuthPageMode, Tt as AuthPageMeta, w as AuthOptions } from "./types-BHSgxyvV.js";
3
3
  import "vite";
4
- //#region ../internal/src/build/paths.d.ts
5
4
  interface NuxtLayerDirectoryConfig {
6
5
  rootDir?: string;
7
6
  serverDir?: string;
@@ -14,8 +13,6 @@ interface NuxtServerDirOptions extends NuxtLayerDirectoryConfig {
14
13
  cwd?: string;
15
14
  }>;
16
15
  }
17
- //#endregion
18
- //#region ../internal/src/build/nuxt-vue-imports.d.ts
19
16
  type VueImport = {
20
17
  as?: string;
21
18
  disabled?: boolean;
@@ -32,8 +29,6 @@ type NuxtVueImportContext = {
32
29
  }>;
33
30
  };
34
31
  };
35
- //#endregion
36
- //#region src/nuxt.d.ts
37
32
  export interface AuthNuxtModuleOptions {
38
33
  auth?: AuthOptions;
39
34
  env?: false | {
@@ -89,5 +84,4 @@ type NuxtLike = {
89
84
  };
90
85
  };
91
86
  export default function hubAuthNuxt(options?: AuthNuxtModuleOptions, nuxt?: NuxtLike): void;
92
- //#endregion
93
87
  export type { AuthPageMeta, AuthPageMode, AuthPages };
package/dist/nuxt.js CHANGED
@@ -1,12 +1,12 @@
1
- import { t as authErrorDiagnostics } from "./error-diagnostics-uEbxSY2G.js";
2
- import { i as normalizePagePath, r as createAccessPageMatcher, t as accessPageBeats } from "./access-pages-FNQTyGRD.js";
3
- import { c as writeNuxtAuthDefinition, d as cachingRuleNames, f as createCachingRouteRuleFinder, h as resolveViteHubProjectRoot, l as resolveAuthViteConfig, m as resolveNuxtServerDirs, o as createAuthNitroConfig, p as methodOrder, s as hubAuth, u as authAbilitiesCandidates } from "./vite-QKjsPLwP.js";
1
+ import { c as writeNuxtAuthDefinition, d as cachingRuleNames, f as createCachingRouteRuleFinder, h as resolveViteHubProjectRoot, l as resolveAuthViteConfig, m as resolveNuxtServerDirs, o as createAuthNitroConfig, p as methodOrder, s as hubAuth, u as authAbilitiesCandidates } from "./vite-D1xC9n1O.js";
2
+ import { i as normalizePagePath, r as createAccessPageMatcher, t as accessPageBeats } from "./access-pages-BwImVHN_.js";
3
+ import { t as authErrorDiagnostics } from "./error-diagnostics-BssJr_2t.js";
4
4
  import { realpathSync } from "node:fs";
5
5
  import { dirname, isAbsolute, relative, resolve } from "node:path";
6
6
  import { fileURLToPath } from "node:url";
7
7
  import { kebabCase, pascalCase, splitByCase } from "scule";
8
8
  import { createEnvImportAliases, hubEnv } from "@vite-hub/env/vite";
9
- //#region ../internal/src/build/nuxt-vue-imports.ts
9
+ // ../internal/src/build/nuxt-vue-imports.ts
10
10
  const fallbacksByApp = /* @__PURE__ */ new WeakMap();
11
11
  function addNuxtVueImports(nuxt, from, names) {
12
12
  let fallbacks = fallbacksByApp.get(nuxt);
@@ -40,8 +40,7 @@ function addNuxtVueImports(nuxt, from, names) {
40
40
  }
41
41
  for (const name of names) if (!fallbacks.has(name)) fallbacks.set(name, from);
42
42
  }
43
- //#endregion
44
- //#region src/page-guard-cache.ts
43
+ // src/page-guard-cache.ts
45
44
  /**
46
45
  * Nuxt prerenders a page when it builds, without the cookie of a visitor. A guest page then renders for a signed-out
47
46
  * visitor, which is correct for every visitor until the browser reads the session: the page guard runs again in the
@@ -227,8 +226,7 @@ async function assertSignInPagesOpen(pages, signInPage, options = {}) {
227
226
  throw authErrorDiagnostics.AUTH_PAGE_ROUTES_INVALID({ message: `\`defineAuth()\` access.pages has ${JSON.stringify(key)}: "user", which guards the sign-in page ${JSON.stringify(page)} of ${source}. The page guard sends signed-out visitors there, and they cannot open it. Add ${JSON.stringify(page)}: "guest" or false to access.pages, or set \`definePageMeta({ auth: 'guest' })\` on the page.` });
228
227
  }
229
228
  }
230
- //#endregion
231
- //#region src/nuxt.ts
229
+ // src/nuxt.ts
232
230
  const composables = [
233
231
  "useAbility",
234
232
  "useAuthClient",
@@ -484,5 +482,4 @@ function componentNames(prefix, name) {
484
482
  pascalName: pascalCase(words)
485
483
  };
486
484
  }
487
- //#endregion
488
485
  export { hubAuthNuxt as default };
@@ -1,4 +1,4 @@
1
- //#region ../internal/src/object.ts
1
+ // ../internal/src/object.ts
2
2
  /** A non-null object that is not an array. Functions do not pass. */
3
3
  function isRecord(value) {
4
4
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -7,5 +7,4 @@ function isRecord(value) {
7
7
  function isRecordOrFunction(value) {
8
8
  return Object(value) === value && !Array.isArray(value);
9
9
  }
10
- //#endregion
11
10
  export { isRecordOrFunction as n, isRecord as t };
@@ -1,5 +1,4 @@
1
- import { E as AuthRequestInput } from "./types-gl-myjZc.js";
2
- //#region src/own-access.d.ts
1
+ import { E as AuthRequestInput } from "./types-BHSgxyvV.js";
3
2
  /**
4
3
  * The Nitro route `meta` of a handler that checks its own access, such as the ViteHub Console route. The access routes
5
4
  * leave a request to the handler that Nitro routed it to when that handler has this meta, whatever its path and method.
@@ -16,5 +15,4 @@ declare const authAccessHandlerMeta: Readonly<{
16
15
  * `false` too.
17
16
  */
18
17
  declare function checksOwnAccess(input: AuthRequestInput): boolean;
19
- //#endregion
20
18
  export { checksOwnAccess as n, authAccessHandlerMeta as t };
@@ -1,6 +1,6 @@
1
- import { t as isRecord } from "./object-Da1zyPCR.js";
2
- import { n as ownAccessHandlerMeta, r as ownAccessRouteMeta } from "./nitro-kit-32CVgbWS.js";
3
- //#region src/own-access.ts
1
+ import { n as ownAccessHandlerMeta, r as ownAccessRouteMeta } from "./nitro-kit-Bg4xUZAI.js";
2
+ import { t as isRecord } from "./object-CAK6UYR5.js";
3
+ // src/own-access.ts
4
4
  /**
5
5
  * The Nitro route `meta` of a handler that checks its own access, such as the ViteHub Console route. The access routes
6
6
  * leave a request to the handler that Nitro routed it to when that handler has this meta, whatever its path and method.
@@ -27,5 +27,4 @@ function checksOwnAccess(input) {
27
27
  if (routedToAccessHandler(input)) return true;
28
28
  return matchedRouteMeta(input)?.vitehubOwnAccess === ownAccessRouteMeta.vitehubOwnAccess;
29
29
  }
30
- //#endregion
31
30
  export { checksOwnAccess as n, routedToAccessHandler as r, authAccessHandlerMeta as t };
@@ -1,4 +1,4 @@
1
- //#region ../internal/src/runtime/page-tools-shared.ts
1
+ // ../internal/src/runtime/page-tools-shared.ts
2
2
  /**
3
3
  * The cookie that remembers the session route's answer for this browser: `1` when a tool allows the person, `0` when
4
4
  * none does or the person turned the tools off. It is a hint, never a credential, and it is not HttpOnly, because the
@@ -15,5 +15,4 @@ const viteHubSessionMarkerCookie = "vitehub_session";
15
15
  * next page asks the session route again for the new person.
16
16
  */
17
17
  const viteHubPageToolsResetCookie = `${viteHubPageToolsCookie}=; Path=/; Max-Age=0; SameSite=Lax`;
18
- //#endregion
19
18
  export { viteHubPageToolsResetCookie as n, viteHubSessionMarkerCookie as r, viteHubPageToolsCookie as t };
@@ -1,5 +1,4 @@
1
1
  import { Duration } from "@vite-hub/runtime";
2
- //#region src/presets.d.ts
3
2
  interface AuthStatelessPresetOptions {
4
3
  /**
5
4
  * How long a session lasts after sign-in, in seconds or as a duration such as `"7d"`.
@@ -20,5 +19,4 @@ type AuthPreset = AuthStatelessPreset;
20
19
  * replicas and Workers when every instance uses the same secret. Use it with social providers.
21
20
  */
22
21
  declare function stateless(options?: AuthStatelessPresetOptions): AuthStatelessPreset;
23
- //#endregion
24
22
  export { stateless as i, AuthStatelessPreset as n, AuthStatelessPresetOptions as r, AuthPreset as t };
package/dist/presets.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { i as stateless, n as AuthStatelessPreset, r as AuthStatelessPresetOptions, t as AuthPreset } from "./presets-CHndEv5i.js";
1
+ import { i as stateless, n as AuthStatelessPreset, r as AuthStatelessPresetOptions, t as AuthPreset } from "./presets-C6AtiRdI.js";
2
2
  export { AuthPreset, AuthStatelessPreset, AuthStatelessPresetOptions, stateless };
package/dist/presets.js CHANGED
@@ -1,6 +1,6 @@
1
- import { t as authErrorDiagnostics } from "./error-diagnostics-uEbxSY2G.js";
1
+ import { t as authErrorDiagnostics } from "./error-diagnostics-BssJr_2t.js";
2
2
  import { parseDuration } from "@vite-hub/runtime";
3
- //#region src/presets.ts
3
+ // src/presets.ts
4
4
  const defaultStatelessMaxAge = 604800;
5
5
  function durationSeconds(value) {
6
6
  const seconds = typeof value === "string" ? Math.round(parseDuration(value, "maxAge") / 1e3) : value;
@@ -18,5 +18,4 @@ function stateless(options = {}) {
18
18
  maxAge
19
19
  };
20
20
  }
21
- //#endregion
22
21
  export { stateless };