@vite-hub/auth 0.5.1 → 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.
Files changed (69) hide show
  1. package/README.md +2 -2
  2. package/dist/{abilities-3L1Y5Pnw.d.ts → abilities-D3XlrYDw.d.ts} +1 -1
  3. package/dist/abilities.d.ts +1 -1
  4. package/dist/{ability-error-BHhPkrZd.js → ability-error-D3-u8k1A.js} +1 -1
  5. package/dist/{access-pages-BwImVHN_.js → access-pages-9aKr6z-k.js} +1 -1
  6. package/dist/agent.js +3 -3
  7. package/dist/{auth-instance-_J7R9Qs1.js → auth-instance-BpI9Ps8A.js} +64 -54
  8. package/dist/cli.js +1 -1
  9. package/dist/{console-runtime-vc3JQEuq.js → console-runtime-CaIXVtB_.js} +7 -206
  10. package/dist/console-runtime-DAjLTLrN.d.ts +32 -0
  11. package/dist/console-runtime.d.ts +3 -3
  12. package/dist/console-runtime.js +1 -1
  13. package/dist/{console-types-51lkf0lk.js → console-types-NrX5TWl3.js} +2 -1
  14. package/dist/console.d.ts +3 -3
  15. package/dist/console.js +1 -1
  16. package/dist/{database-options-DQ-8qYMl.js → database-options-B87hDU4j.js} +1 -1
  17. package/dist/{database-schema-options-CkSeU9V3.js → database-schema-options-peXHNLkJ.js} +1 -1
  18. package/dist/database.d.ts +2 -2
  19. package/dist/database.js +5 -5
  20. package/dist/{definition-MDGMNKrK.js → definition-BypPLIbI.js} +3 -3
  21. package/dist/{error-diagnostics-BssJr_2t.js → error-diagnostics-CUPwukgE.js} +1 -1
  22. package/dist/{events-DZqMiae_.js → events-BXU1_9mc.js} +2 -1
  23. package/dist/forward-sign-ins-BWXPPTRz.js +4 -0
  24. package/dist/forward.d.ts +24 -0
  25. package/dist/forward.js +42 -4
  26. package/dist/index.d.ts +2 -2
  27. package/dist/index.js +3 -3
  28. package/dist/internal/server.d.ts +2 -2
  29. package/dist/internal/server.js +4 -4
  30. package/dist/mcp-token-CmQbXbTu.d.ts +125 -0
  31. package/dist/{mcp-token--KuLYEub.js → mcp-token-DzGivm7f.js} +42 -17
  32. package/dist/mcp.d.ts +2 -111
  33. package/dist/mcp.js +2 -2
  34. package/dist/{members-D3_Q5XJb.js → members-CwPIx10t.js} +3 -3
  35. package/dist/{nitro-kit-Bg4xUZAI.js → nitro-kit-BumWIKa5.js} +1 -1
  36. package/dist/nuxt.d.ts +1 -1
  37. package/dist/nuxt.js +3 -3
  38. package/dist/{own-access-DQgqxTbI.js → own-access-CYsakJiH.js} +1 -1
  39. package/dist/{own-access-C22hSIuF.d.ts → own-access-Dt-I5-PT.d.ts} +1 -1
  40. package/dist/presets.js +1 -1
  41. package/dist/runtime/console.d.ts +1 -1
  42. package/dist/runtime/console.js +2 -2
  43. package/dist/runtime/empty-abilities.d.ts +1 -1
  44. package/dist/runtime/empty-definition.d.ts +1 -1
  45. package/dist/runtime/server.d.ts +2 -2
  46. package/dist/runtime/server.js +3 -3
  47. package/dist/runtime-state-C0Rd1W4m.js +15 -0
  48. package/dist/schema.d.ts +1 -1
  49. package/dist/schema.js +1 -1
  50. package/dist/{server-CFWlYQJb.d.ts → server-Cun232hb.d.ts} +13 -8
  51. package/dist/{server-DCsgxFPP.d.ts → server-DL9MSuyj.d.ts} +2 -2
  52. package/dist/{server-D4Hi4TBI.js → server-_eUOlAJ8.js} +11 -11
  53. package/dist/server.d.ts +3 -2
  54. package/dist/server.js +2 -2
  55. package/dist/{session-cookies-1FMcMnRh.js → session-cookies-fR6Pv4kD.js} +2 -2
  56. package/dist/{set-cookie-DkqM1kvj.js → set-cookie-DVfi-nJX.js} +1 -1
  57. package/dist/{table-specs-jw0jjU6l.js → table-specs-CCSY4tiS.js} +17 -14
  58. package/dist/{table-specs-BLm_Zlss.d.ts → table-specs-P4LvbOlX.d.ts} +28 -21
  59. package/dist/test.d.ts +1 -1
  60. package/dist/test.js +2 -2
  61. package/dist/{types-BHSgxyvV.d.ts → types-BP9_XUr9.d.ts} +3 -21
  62. package/dist/{vite-D1xC9n1O.js → vite-Dem1i1rL.js} +92 -27
  63. package/dist/vite.d.ts +1 -1
  64. package/dist/vite.js +1 -1
  65. package/dist/vue.d.ts +2 -2
  66. package/dist/vue.js +1 -1
  67. package/package.json +8 -8
  68. package/dist/console-runtime-BP1ZKJB0.d.ts +0 -71
  69. package/dist/runtime-state-DtKUfxKq.js +0 -24
package/dist/mcp.d.ts CHANGED
@@ -1,116 +1,7 @@
1
- import { Result } from "@vite-hub/runtime";
1
+ import { a as McpTokenInvalidData, c as VerifyMcpRequestError, d as deleteUnusedMcpClients, f as mcpTokenInvalidReasons, i as McpOAuthErrorCode, l as VerifyMcpRequestOptions, n as McpCaller, o as McpTokenInvalidError, p as verifyMcpRequest, r as McpOAuthAuth, s as McpTokenInvalidReason, t as DeleteUnusedMcpClientsOptions, u as VerifyMcpRequestResult } from "./mcp-token-CmQbXbTu.js";
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
- type McpOAuthErrorCode = "AUTH_MCP_CLEANUP_FAILED" | "AUTH_MCP_OAUTH_MISSING" | "AUTH_MCP_TOKEN_INVALID" | "AUTH_MCP_TOKEN_MISSING";
6
- /** What the MCP helpers read from a Better Auth instance. `useAuth()` returns one. */
7
- interface McpOAuthAuth {
8
- $context: Promise<{
9
- baseURL: string;
10
- options: {
11
- plugins?: ReadonlyArray<{
12
- id?: string;
13
- options?: unknown;
14
- }>;
15
- };
16
- internalAdapter: {
17
- findUserById: (id: string) => Promise<unknown>;
18
- };
19
- adapter: {
20
- findOne: (input: {
21
- model: string;
22
- where: Array<{
23
- field: string;
24
- value: string;
25
- }>;
26
- }) => Promise<unknown>;
27
- findMany: (input: {
28
- model: string;
29
- where: Array<{
30
- field: string;
31
- operator?: "lt";
32
- value: Date;
33
- }>;
34
- limit?: number;
35
- }) => Promise<unknown[]>;
36
- count: (input: {
37
- model: string;
38
- where: Array<{
39
- field: string;
40
- value: string;
41
- }>;
42
- }) => Promise<number>;
43
- deleteMany: (input: {
44
- model: string;
45
- where: Array<{
46
- field: string;
47
- value: string;
48
- }>;
49
- }) => Promise<number>;
50
- };
51
- }>;
52
- api: {
53
- getJwks: (...args: never[]) => Promise<unknown>;
54
- getOAuthServerConfig: (...args: never[]) => unknown;
55
- getOpenIdConfig: (...args: never[]) => unknown;
56
- };
57
- }
58
- /** The person and the client of a valid MCP access token. */
59
- interface McpCaller {
60
- /** The Auth user, read again by the `sub` claim, so a deleted or banned person has no access. */
61
- user: {
62
- id: string;
63
- email?: string | null;
64
- name?: string | null;
65
- image?: string | null;
66
- [key: string]: unknown;
67
- };
68
- /** The scopes that the person approved. */
69
- scopes: string[];
70
- /** The OAuth client id, from `azp` or `client_id`. */
71
- clientId: string;
72
- /** The name the client registered, such as "Claude Code". */
73
- clientName: string | undefined;
74
- }
75
- /** Options of {@link verifyMcpRequest}. */
76
- interface VerifyMcpRequestOptions {
77
- /** The Better Auth instance. Defaults to the app Auth for the request. */
78
- auth?: McpOAuthAuth;
79
- /**
80
- * The resource that the token must name as its audience, or a list of which it must name one. Defaults to the
81
- * `mcpOAuth()` resource at the path of the request.
82
- */
83
- resource?: string | readonly string[];
84
- }
85
- /**
86
- * Check the OAuth access token of an MCP request. The signing keys come from the Auth in-process, with no request to the
87
- * authorization server. The signature algorithm is pinned to the keys, and the issuer, the audience (the resource), and
88
- * the expiry are checked with 30 seconds of tolerance. The client must still be enabled and, when the token names a
89
- * session, that session must still exist and be unexpired, unless the person granted `offline_access`: that grant is for
90
- * use while they are signed out, and Better Auth's refresh grant copies the session of the first sign-in into every
91
- * access token it mints. Sender-constrained tokens, including DPoP-bound tokens, are rejected even when presented as
92
- * bearer tokens. It reads only the URL and the headers, so pass the Request of a Fetchable route, H3's `event.req`, or
93
- * any value with `url` and `headers`, and the body stays for the MCP handler. Returns `AUTH_MCP_TOKEN_MISSING` without a
94
- * bearer token and `AUTH_MCP_TOKEN_INVALID` for a token that fails a check. Throws `AUTH_MCP_OAUTH_MISSING` when the Auth has no `mcpOAuth()`.
95
- */
96
- export declare function verifyMcpRequest(request: Pick<Request, "headers" | "url">, options?: VerifyMcpRequestOptions): Promise<Result<McpCaller, "AUTH_MCP_TOKEN_INVALID" | "AUTH_MCP_TOKEN_MISSING">>;
97
- /** Options of {@link deleteUnusedMcpClients}. */
98
- interface DeleteUnusedMcpClientsOptions {
99
- /** The Better Auth instance. Defaults to the app Auth. */
100
- auth?: McpOAuthAuth;
101
- /** Age in milliseconds after which a client that never got a consent or a token is deleted. Defaults to 24 hours. */
102
- olderThan?: number;
103
- /** Clients checked in one call. Defaults to 500. */
104
- limit?: number;
105
- }
106
- /**
107
- * Delete OAuth clients that registered more than `olderThan` ago and never completed a sign-in: no consent, no access
108
- * token, and no refresh token. Open registration lets anyone add clients, so run it from a schedule. Returns the number
109
- * of deleted clients.
110
- */
111
- export declare function deleteUnusedMcpClients(options?: DeleteUnusedMcpClientsOptions): Promise<Result<{
112
- deleted: number;
113
- }, "AUTH_MCP_CLEANUP_FAILED">>;
114
5
  /**
115
6
  * OAuth 2.1 sign-in for an MCP server of the app, with Better Auth as the authorization server. `mcpOAuth()` adds the
116
7
  * plugins, `serveMcpOAuthDiscovery()` answers the well-known documents at the origin root, `verifyMcpRequest()` checks the
@@ -191,4 +82,4 @@ export interface McpOAuthDiscoveryOptions {
191
82
  * ```
192
83
  */
193
84
  export declare function serveMcpOAuthDiscovery(request: Request, options?: McpOAuthDiscoveryOptions): Promise<Response | undefined>;
194
- export type { DeleteUnusedMcpClientsOptions, McpCaller, McpOAuthAuth, McpOAuthErrorCode, VerifyMcpRequestOptions };
85
+ export { type DeleteUnusedMcpClientsOptions, type McpCaller, type McpOAuthAuth, type McpOAuthErrorCode, type McpTokenInvalidData, type McpTokenInvalidError, type McpTokenInvalidReason, type VerifyMcpRequestError, type VerifyMcpRequestOptions, type VerifyMcpRequestResult, deleteUnusedMcpClients, mcpTokenInvalidReasons, verifyMcpRequest };
package/dist/mcp.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { t as isRecord } from "./object-CAK6UYR5.js";
2
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";
3
+ import { c as verifyMcpRequest, i as mcpTokenInvalidReasons, n as baseScopes, o as pathOf, r as deleteUnusedMcpClients, s as stateOf, t as appAuth } from "./mcp-token-DzGivm7f.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";
@@ -168,4 +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
- export { deleteUnusedMcpClients, mcpOAuth, serveMcpOAuthDiscovery, verifyMcpRequest };
171
+ export { deleteUnusedMcpClients, mcpOAuth, mcpTokenInvalidReasons, serveMcpOAuthDiscovery, verifyMcpRequest };
@@ -1,9 +1,9 @@
1
- import { t as authErrorDiagnostics } from "./error-diagnostics-BssJr_2t.js";
1
+ import { t as authErrorDiagnostics } from "./error-diagnostics-CUPwukgE.js";
2
2
  import { t as authCloudflareEnv } from "./request-Dpq7GO8B.js";
3
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";
4
+ import { t as getAuthRuntimeState } from "./runtime-state-C0Rd1W4m.js";
5
5
  import { t as invariant } from "./invariant-Dj2R1eMr.js";
6
- import { a as checkGitHubOrgMember } from "./events-DZqMiae_.js";
6
+ import { a as checkGitHubOrgMember } from "./events-BXU1_9mc.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";
@@ -2,7 +2,7 @@ import { n as isRecordOrFunction } from "./object-CAK6UYR5.js";
2
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
- * only its own signed requests and one-time links, so app access rules do not apply to it.
5
+ * only its own signed requests and signed Site access tokens, so app access rules do not apply to it.
6
6
  */
7
7
  const ownAccessHandlerMeta = Object.freeze({ vitehubAuthAccess: "handler" });
8
8
  /**
package/dist/nuxt.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /// <reference path="./host-declarations.d.ts" />
2
- import { Dt as AuthPages, Et as AuthPageMode, Tt as AuthPageMeta, w as AuthOptions } from "./types-BHSgxyvV.js";
2
+ import { Ct as AuthPageMeta, Tt as AuthPages, w as AuthOptions, wt as AuthPageMode } from "./types-BP9_XUr9.js";
3
3
  import "vite";
4
4
  interface NuxtLayerDirectoryConfig {
5
5
  rootDir?: string;
package/dist/nuxt.js CHANGED
@@ -1,6 +1,6 @@
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";
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-Dem1i1rL.js";
2
+ import { i as normalizePagePath, r as createAccessPageMatcher, t as accessPageBeats } from "./access-pages-9aKr6z-k.js";
3
+ import { t as authErrorDiagnostics } from "./error-diagnostics-CUPwukgE.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";
@@ -1,4 +1,4 @@
1
- import { n as ownAccessHandlerMeta, r as ownAccessRouteMeta } from "./nitro-kit-Bg4xUZAI.js";
1
+ import { n as ownAccessHandlerMeta, r as ownAccessRouteMeta } from "./nitro-kit-BumWIKa5.js";
2
2
  import { t as isRecord } from "./object-CAK6UYR5.js";
3
3
  // src/own-access.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { E as AuthRequestInput } from "./types-BHSgxyvV.js";
1
+ import { E as AuthRequestInput } from "./types-BP9_XUr9.js";
2
2
  /**
3
3
  * The Nitro route `meta` of a handler that checks its own access, such as the ViteHub Console route. The access routes
4
4
  * leave a request to the handler that Nitro routed it to when that handler has this meta, whatever its path and method.
package/dist/presets.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as authErrorDiagnostics } from "./error-diagnostics-BssJr_2t.js";
1
+ import { t as authErrorDiagnostics } from "./error-diagnostics-CUPwukgE.js";
2
2
  import { parseDuration } from "@vite-hub/runtime";
3
3
  // src/presets.ts
4
4
  const defaultStatelessMaxAge = 604800;
@@ -1,3 +1,3 @@
1
1
  import "../server.js";
2
- import { A as authForRequest, r as aggregateAuthEvents, v as listAuthEvents } from "../server-CFWlYQJb.js";
2
+ import { A as authForRequest, r as aggregateAuthEvents, v as listAuthEvents } from "../server-Cun232hb.js";
3
3
  export { aggregateAuthEvents, authForRequest, listAuthEvents };
@@ -1,4 +1,4 @@
1
- import { g as listAuthEvents, t as aggregateAuthEvents } from "../server-D4Hi4TBI.js";
2
- import { t as authForRequest } from "../auth-instance-_J7R9Qs1.js";
1
+ import { g as listAuthEvents, t as aggregateAuthEvents } from "../server-_eUOlAJ8.js";
2
+ import { t as authForRequest } from "../auth-instance-BpI9Ps8A.js";
3
3
  import "../server.js";
4
4
  export { aggregateAuthEvents, authForRequest, listAuthEvents };
@@ -1,3 +1,3 @@
1
- import { s as AbilityRules } from "../abilities-3L1Y5Pnw.js";
1
+ import { s as AbilityRules } from "../abilities-D3XlrYDw.js";
2
2
  declare const abilities: AbilityRules;
3
3
  export { abilities as default };
@@ -1,4 +1,4 @@
1
- import { _ as AuthDefinition } from "../types-BHSgxyvV.js";
1
+ import { _ as AuthDefinition } from "../types-BP9_XUr9.js";
2
2
  declare const definition: AuthDefinition | undefined;
3
3
  export declare function getAuthApp(): object | undefined;
4
4
  export { definition as default };
@@ -1,3 +1,3 @@
1
- import { t as authAccessHandlerMeta } from "../own-access-C22hSIuF.js";
2
- import { a as setAuthAccessIdentityResolver, i as createLazyAuthAccessHandler, n as checkBuiltAuthPages, o as setAuthRuntimeEnvResolver, r as createAuthAccessRouteMatcher, t as AuthAccessRouteMatch } from "../server-DCsgxFPP.js";
1
+ import { t as authAccessHandlerMeta } from "../own-access-Dt-I5-PT.js";
2
+ import { a as setAuthAccessIdentityResolver, i as createLazyAuthAccessHandler, n as checkBuiltAuthPages, o as setAuthRuntimeEnvResolver, r as createAuthAccessRouteMatcher, t as AuthAccessRouteMatch } from "../server-DL9MSuyj.js";
3
3
  export { AuthAccessRouteMatch, authAccessHandlerMeta, checkBuiltAuthPages, createAuthAccessRouteMatcher, createLazyAuthAccessHandler, setAuthAccessIdentityResolver, setAuthRuntimeEnvResolver };
@@ -1,8 +1,8 @@
1
1
  import { n as canonicalAccessPath, r as resolveAccessRoutePath } from "../application-path-zKi7NrvK.js";
2
- import { t as authErrorDiagnostics } from "../error-diagnostics-BssJr_2t.js";
3
- import { r as routedToAccessHandler, t as authAccessHandlerMeta } from "../own-access-DQgqxTbI.js";
2
+ import { t as authErrorDiagnostics } from "../error-diagnostics-CUPwukgE.js";
3
+ import { r as routedToAccessHandler, t as authAccessHandlerMeta } from "../own-access-CYsakJiH.js";
4
4
  import { r as unwrapAuthRequest } from "../request-Dpq7GO8B.js";
5
- import { n as getAuthRuntimeState } from "../runtime-state-DtKUfxKq.js";
5
+ import { t as getAuthRuntimeState } from "../runtime-state-C0Rd1W4m.js";
6
6
  // src/runtime/server.ts
7
7
  function setAuthRuntimeEnvResolver(resolver, definition) {
8
8
  const state = getAuthRuntimeState();
@@ -0,0 +1,15 @@
1
+ // src/runtime-state.ts
2
+ const authRuntimeStateKey = Symbol.for("vitehub.auth.runtime");
3
+ function getAuthRuntimeState() {
4
+ const globalScope = globalThis;
5
+ globalScope[authRuntimeStateKey] ??= {};
6
+ globalScope[authRuntimeStateKey].envResolvers ??= /* @__PURE__ */ new WeakMap();
7
+ return globalScope[authRuntimeStateKey];
8
+ }
9
+ function resetAuth() {
10
+ const state = getAuthRuntimeState();
11
+ state.auth = void 0;
12
+ state.definition = void 0;
13
+ state.providers = void 0;
14
+ }
15
+ export { resetAuth as n, getAuthRuntimeState as t };
package/dist/schema.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as AuthSchemaPlugin, c as AuthTableSpec, d as resolveAuthTableSpecs, i as AuthSchemaOptions, l as authPluginSchemas, n as AuthCoreTableSpecs, o as AuthTableField, r as AuthPluginSchemas, s as AuthTableName, t as AuthCoreModel, u as authTableSpecs } from "./table-specs-BLm_Zlss.js";
1
+ import { a as AuthSchemaPlugin, c as AuthTableSpec, d as resolveAuthTableSpecs, i as AuthSchemaOptions, l as authPluginSchemas, n as AuthCoreTableSpecs, o as AuthTableField, r as AuthPluginSchemas, s as AuthTableName, t as AuthCoreModel, u as authTableSpecs } from "./table-specs-P4LvbOlX.js";
2
2
  import { $Type, BuildColumns, HasDefault, IsPrimaryKey, NotNull } from "drizzle-orm";
3
3
  import { PgBigInt53Builder, PgBooleanBuilder, PgBuildColumns, PgColumn, PgIntegerBuilder, PgJsonbBuilder, PgTableWithColumns, PgTextBuilder, PgTimestampBuilder } from "drizzle-orm/pg-core";
4
4
  import { SQLiteBooleanBuilder, SQLiteColumn, SQLiteIntegerBuilder, SQLiteTableWithColumns, SQLiteTextBuilder, SQLiteTextJsonBuilder, SQLiteTimestampBuilder } from "drizzle-orm/sqlite-core";
package/dist/schema.js CHANGED
@@ -1,4 +1,4 @@
1
- import { i as resolveAuthTableSpecs, n as authSqlName, r as authTableSpecs, t as authPluginSchemas } from "./table-specs-jw0jjU6l.js";
1
+ import { i as resolveAuthTableSpecs, n as authSqlName, r as authTableSpecs, t as authPluginSchemas } from "./table-specs-CCSY4tiS.js";
2
2
  import { sql } from "drizzle-orm";
3
3
  import { bigint, boolean, foreignKey, index, integer, jsonb, pgTable, text, timestamp, uniqueIndex } from "drizzle-orm/pg-core";
4
4
  import { foreignKey as foreignKey$1, index as index$1, integer as integer$1, sqliteTable, text as text$1, uniqueIndex as uniqueIndex$1 } from "drizzle-orm/sqlite-core";
@@ -1,9 +1,10 @@
1
- import { t as AuthConsole } from "./console-runtime-BP1ZKJB0.js";
2
- import { C as AuthGuardedHandler, E as AuthRequestInput, Ft as AuthEventPage, H as ResolvedAuthAccessRoute, Lt as AuthEventStore, N as AuthRuntimeOptions, Nt as AuthEventListInput, R as AuthSignInConfiguration, S as AuthFor, T as AuthRequest, V as RegisteredAuth, W as ViteHubAuth, _ as AuthDefinition, d as AuthAnonymousGuardedHandler, h as AuthBetterAuthRuntimeOptions, it as AuthConsoleHostOptions, jt as AuthEventAggregates, p as AuthAuthorization, u as AuthAnonymousAuthorize, zt as AuthEventWindow } from "./types-BHSgxyvV.js";
3
- import { i as AbilityName, n as AbilityAuthorization, t as AbilityArgs } from "./abilities-3L1Y5Pnw.js";
4
- import "./server-DCsgxFPP.js";
1
+ import { t as AuthConsole } from "./console-runtime-DAjLTLrN.js";
2
+ import { C as AuthGuardedHandler, E as AuthRequestInput, Ft as AuthEventStore, H as ResolvedAuthAccessRoute, Lt as AuthEventWindow, N as AuthRuntimeOptions, Nt as AuthEventPage, R as AuthSignInConfiguration, S as AuthFor, T as AuthRequest, V as RegisteredAuth, W as ViteHubAuth, _ as AuthDefinition, d as AuthAnonymousGuardedHandler, h as AuthBetterAuthRuntimeOptions, it as AuthConsoleHostOptions, jt as AuthEventListInput, kt as AuthEventAggregates, p as AuthAuthorization, u as AuthAnonymousAuthorize } from "./types-BP9_XUr9.js";
3
+ import { i as AbilityName, n as AbilityAuthorization, t as AbilityArgs } from "./abilities-D3XlrYDw.js";
4
+ import { o as McpTokenInvalidError } from "./mcp-token-CmQbXbTu.js";
5
+ import "./server-DL9MSuyj.js";
5
6
  import "./ability-error-C1c30O6E.js";
6
- import { AccessAuthorizeOption, Result, ViteHubContext } from "@vite-hub/runtime";
7
+ import { AccessAuthorizeOption, Result, ResultError, ViteHubContext } from "@vite-hub/runtime";
7
8
  import { APIError } from "better-auth/api";
8
9
  import { AuthContext, BetterAuthOptions, BetterAuthPlugin, User } from "better-auth";
9
10
  /** Why `checkAuthMember()` did not let a user in. */
@@ -31,6 +32,10 @@ type AuthCaller<TRegistry = ViteHub.AuthRegistry> = {
31
32
  scopes: string[];
32
33
  };
33
34
  type AuthCallerErrorCode = "AUTH_MCP_TOKEN_INVALID" | "AUTH_SIGNED_OUT";
35
+ /** The error of `requireCaller()`. Check `code` to read the typed `data`, such as `data.reason` of `AUTH_MCP_TOKEN_INVALID`. */
36
+ type AuthCallerError = McpTokenInvalidError | ResultError<"AUTH_SIGNED_OUT", undefined>;
37
+ /** The `[error, caller]` tuple of `requireCaller()`. */
38
+ type AuthCallerResult<TRegistry = ViteHub.AuthRegistry> = [error: AuthCallerError, data: undefined] | [error: undefined, data: AuthCaller<TRegistry>];
34
39
  declare function findVerifiedAuthUserId(email: string, request: Request): Promise<string | undefined>;
35
40
  declare function createBetterAuthOptions(definition: AuthDefinition): AuthBetterAuthRuntimeOptions;
36
41
  declare function getAuthForDefinition<TDefinition extends AuthDefinition>(definition: TDefinition): AuthFor<TDefinition>;
@@ -147,8 +152,8 @@ declare function requireAuthorization<TInput extends AuthRequestInput>(event: TI
147
152
  * })
148
153
  * ```
149
154
  */
150
- declare function requireCaller(event: AuthRequestInput, definition?: undefined): Promise<Result<AuthCaller, AuthCallerErrorCode>>;
151
- declare function requireCaller(event: AuthRequestInput, definition: AuthDefinition | undefined): Promise<Result<AuthCaller<unknown>, AuthCallerErrorCode>>;
155
+ declare function requireCaller(event: AuthRequestInput, definition?: undefined): Promise<AuthCallerResult>;
156
+ declare function requireCaller(event: AuthRequestInput, definition: AuthDefinition | undefined): Promise<AuthCallerResult<unknown>>;
152
157
  /**
153
158
  * Checks a rule from `shared/abilities.ts` for the caller of a request. Returns the checked request, session, and user.
154
159
  * Throws an `AbilityError` when the rule refuses: `401` for a signed-out caller, else `403` or the status of `deny()`.
@@ -194,4 +199,4 @@ declare function aggregateAuthEvents(window: AuthEventWindow, definition?: AuthD
194
199
  * `host.impersonation` lets the Console start impersonation. It is off by default.
195
200
  */
196
201
  declare function getAuthConsoleForRequest(request: Request, event?: ViteHubContext, host?: AuthConsoleHostOptions): AuthConsole;
197
- export { authForRequest as A, requireCaller as C, withAnonymousAuthorization as D, useAuth as E, AuthCallerErrorCode as F, AuthCallerUser as I, AuthMemberErrorCode as L, findVerifiedAuthUserId as M, getAuthForDefinition as N, withAuth as O, AuthCaller as P, requireAuthorization as S, toAuthRequest as T, handleAuthRequest as _, authRoute as a, requireAuth as b, createAuth as c, createAuthHandler as d, createAuthRequestRuntimeOptions as f, handleAuth as g, getAuthEvents as h, assertAuthOrigin as i, createBetterAuthOptions as j, withAuthorization as k, createAuthAccessHandler as l, getAuthConsoleForRequest as m, AuthSignOutOptions as n, can as o, getAuth as p, aggregateAuthEvents as r, checkAuthMember as s, AuthEventReadErrorCode as t, createAuthForRequest as u, listAuthEvents as v, signOut as w, requireAuthAccessRoutes as x, requireAbility as y };
202
+ export { authForRequest as A, requireCaller as C, withAnonymousAuthorization as D, useAuth as E, AuthCallerError as F, AuthCallerErrorCode as I, AuthCallerResult as L, findVerifiedAuthUserId as M, getAuthForDefinition as N, withAuth as O, AuthCaller as P, AuthCallerUser as R, requireAuthorization as S, toAuthRequest as T, handleAuthRequest as _, authRoute as a, requireAuth as b, createAuth as c, createAuthHandler as d, createAuthRequestRuntimeOptions as f, handleAuth as g, getAuthEvents as h, assertAuthOrigin as i, createBetterAuthOptions as j, withAuthorization as k, createAuthAccessHandler as l, getAuthConsoleForRequest as m, AuthSignOutOptions as n, can as o, getAuth as p, aggregateAuthEvents as r, checkAuthMember as s, AuthEventReadErrorCode as t, createAuthForRequest as u, listAuthEvents as v, signOut as w, requireAuthAccessRoutes as x, requireAbility as y, AuthMemberErrorCode as z };
@@ -1,5 +1,5 @@
1
- import "./own-access-C22hSIuF.js";
2
- import { E as AuthRequestInput, H as ResolvedAuthAccessRoute, _ as AuthDefinition } from "./types-BHSgxyvV.js";
1
+ import "./own-access-Dt-I5-PT.js";
2
+ import { E as AuthRequestInput, H as ResolvedAuthAccessRoute, _ as AuthDefinition } from "./types-BP9_XUr9.js";
3
3
  import { AccessAuthorizationContext, ViteHubContext } from "@vite-hub/runtime";
4
4
  type AuthRuntimeEnvResolver = (event?: ViteHubContext) => Record<string, unknown>;
5
5
  type AuthAccessIdentityResolver = (request: Request, event: AuthRequestInput, hasSession: boolean) => Promise<AccessAuthorizationContext<unknown, false>["user"] | Response | undefined>;
@@ -1,16 +1,16 @@
1
- import { t as createAuthConsole } from "./console-runtime-vc3JQEuq.js";
2
- import { _ as forwardedRequestOrigin, a as getAuthForDefinition, c as withSessionMarker, d as eventClientAddress, f as setRequestClientAddress, g as setAuthResponseOutcome, h as setAuthOutcome, l as resolveAuthOptions, m as runWithAuthEvent, n as createBetterAuthOptions, o as requestProvider, p as withClientAddress, r as envResolverFor, s as resolveDefaultDefinition, t as authForRequest, u as trustsProxyHeaders } from "./auth-instance-_J7R9Qs1.js";
1
+ import { t as createAuthConsole } from "./console-runtime-CaIXVtB_.js";
2
+ import { _ as forwardedRequestOrigin, a as getAuthForDefinition, c as withSessionMarker, d as eventClientAddress, f as setRequestClientAddress, g as setAuthResponseOutcome, h as setAuthOutcome, l as resolveAuthOptions, m as runWithAuthEvent, n as createBetterAuthOptions, o as requestProvider, p as withClientAddress, r as envResolverFor, s as resolveDefaultDefinition, t as authForRequest, u as trustsProxyHeaders } from "./auth-instance-BpI9Ps8A.js";
3
3
  import { i as resolveAuthMountPath, n as canonicalAccessPath } from "./application-path-zKi7NrvK.js";
4
- import { a as normalizeAuthBasePath } from "./access-pages-BwImVHN_.js";
4
+ import { a as normalizeAuthBasePath } from "./access-pages-9aKr6z-k.js";
5
5
  import { n as authRequestEvent, r as unwrapAuthRequest } from "./request-Dpq7GO8B.js";
6
- import { a as getAuthenticationSession, i as authenticationRefusalResponse, n as sendSessionCookies, r as authenticationRefusalError, t as prepareSessionCookies } from "./session-cookies-1FMcMnRh.js";
7
- import { n as getAuthRuntimeState } from "./runtime-state-DtKUfxKq.js";
8
- import { t as readSetCookies } from "./set-cookie-DkqM1kvj.js";
6
+ import { a as getAuthenticationSession, i as authenticationRefusalResponse, n as sendSessionCookies, r as authenticationRefusalError, t as prepareSessionCookies } from "./session-cookies-fR6Pv4kD.js";
7
+ import { t as getAuthRuntimeState } from "./runtime-state-C0Rd1W4m.js";
8
+ import { t as readSetCookies } from "./set-cookie-DVfi-nJX.js";
9
9
  import { createAuthAccessRouteMatcher } from "./runtime/server.js";
10
- import { n as checkAbility, t as AbilityError } from "./ability-error-BHhPkrZd.js";
11
- import { i as parseAuthEventWindow, r as parseAuthEventList } from "./events-DZqMiae_.js";
12
- import { t as authErrorDiagnostics } from "./error-diagnostics-BssJr_2t.js";
13
- import { i as notMemberError, l as findAccessPolicyPlugin } from "./members-D3_Q5XJb.js";
10
+ import { n as checkAbility, t as AbilityError } from "./ability-error-D3-u8k1A.js";
11
+ import { i as parseAuthEventWindow, r as parseAuthEventList } from "./events-BXU1_9mc.js";
12
+ import { t as authErrorDiagnostics } from "./error-diagnostics-CUPwukgE.js";
13
+ import { i as notMemberError, l as findAccessPolicyPlugin } from "./members-CwPIx10t.js";
14
14
  import { n as mcpOAuthResources, t as isJwsToken } from "./mcp-config-C7srUMIZ.js";
15
15
  import { defineErrors, toResultError } from "@vite-hub/runtime";
16
16
  import { HTTPError } from "nitro/h3";
@@ -847,7 +847,7 @@ async function readCaller(event, definition) {
847
847
  const auth = authForRequest(request, authRequestEvent(event), definition);
848
848
  const { options } = await auth.$context;
849
849
  if (isJwsToken(token) && mcpOAuthResources(options.plugins).length) {
850
- const { verifyAppAccessToken } = await import("./mcp-token--KuLYEub.js").then((n) => n.i);
850
+ const { verifyAppAccessToken } = await import("./mcp-token-DzGivm7f.js").then((n) => n.a);
851
851
  const url = new URL(request.url);
852
852
  const [error, caller] = await verifyAppAccessToken(token, trustsProxyHeaders(options) ? forwardedRequestOrigin(request) : url.origin, url.pathname, auth);
853
853
  if (error) return [error, void 0];
package/dist/server.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  /// <reference path="./host-declarations.d.ts" />
2
- import { C as requireCaller, D as withAnonymousAuthorization, E as useAuth, F as AuthCallerErrorCode, I as AuthCallerUser, L as AuthMemberErrorCode, O as withAuth, P as AuthCaller, S as requireAuthorization, a as authRoute, b as requireAuth, d as createAuthHandler, g as handleAuth, h as getAuthEvents, k as withAuthorization, m as getAuthConsoleForRequest, o as can, r as aggregateAuthEvents, s as checkAuthMember, t as AuthEventReadErrorCode, v as listAuthEvents, w as signOut, y as requireAbility } from "./server-CFWlYQJb.js";
2
+ import { C as requireCaller, D as withAnonymousAuthorization, E as useAuth, F as AuthCallerError, I as AuthCallerErrorCode, L as AuthCallerResult, O as withAuth, P as AuthCaller, R as AuthCallerUser, S as requireAuthorization, a as authRoute, b as requireAuth, d as createAuthHandler, g as handleAuth, h as getAuthEvents, k as withAuthorization, m as getAuthConsoleForRequest, o as can, r as aggregateAuthEvents, s as checkAuthMember, t as AuthEventReadErrorCode, v as listAuthEvents, w as signOut, y as requireAbility, z as AuthMemberErrorCode } from "./server-Cun232hb.js";
3
+ import { a as McpTokenInvalidData, o as McpTokenInvalidError, s as McpTokenInvalidReason } from "./mcp-token-CmQbXbTu.js";
3
4
  import { n as AbilityErrorData, t as AbilityError } from "./ability-error-C1c30O6E.js";
4
- export { AbilityError, type AbilityErrorData, type AuthCaller, type AuthCallerErrorCode, type AuthCallerUser, type AuthEventReadErrorCode, type AuthMemberErrorCode, aggregateAuthEvents, can, checkAuthMember, createAuthHandler, authRoute as default, getAuthConsoleForRequest, getAuthEvents, handleAuth, listAuthEvents, requireAbility, requireAuth, requireAuthorization, requireCaller, signOut, useAuth, withAnonymousAuthorization, withAuth, withAuthorization };
5
+ export { AbilityError, type AbilityErrorData, type AuthCaller, type AuthCallerError, type AuthCallerErrorCode, type AuthCallerResult, type AuthCallerUser, type AuthEventReadErrorCode, type AuthMemberErrorCode, type McpTokenInvalidData, type McpTokenInvalidError, type McpTokenInvalidReason, aggregateAuthEvents, can, checkAuthMember, createAuthHandler, authRoute as default, getAuthConsoleForRequest, getAuthEvents, handleAuth, listAuthEvents, requireAbility, requireAuth, requireAuthorization, requireCaller, signOut, useAuth, withAnonymousAuthorization, withAuth, withAuthorization };
package/dist/server.js CHANGED
@@ -1,3 +1,3 @@
1
- import { t as AbilityError } from "./ability-error-BHhPkrZd.js";
2
- import { D as withAuthorization, E as withAuth, S as signOut, T as withAnonymousAuthorization, _ as requireAbility, a as checkAuthMember, b as requireAuthorization, f as getAuthConsoleForRequest, g as listAuthEvents, i as can, l as createAuthHandler, m as handleAuth, p as getAuthEvents, r as authRoute, t as aggregateAuthEvents, v as requireAuth, w as useAuth, x as requireCaller } from "./server-D4Hi4TBI.js";
1
+ import { t as AbilityError } from "./ability-error-D3-u8k1A.js";
2
+ import { D as withAuthorization, E as withAuth, S as signOut, T as withAnonymousAuthorization, _ as requireAbility, a as checkAuthMember, b as requireAuthorization, f as getAuthConsoleForRequest, g as listAuthEvents, i as can, l as createAuthHandler, m as handleAuth, p as getAuthEvents, r as authRoute, t as aggregateAuthEvents, v as requireAuth, w as useAuth, x as requireCaller } from "./server-_eUOlAJ8.js";
3
3
  export { AbilityError, aggregateAuthEvents, can, checkAuthMember, createAuthHandler, authRoute as default, getAuthConsoleForRequest, getAuthEvents, handleAuth, listAuthEvents, requireAbility, requireAuth, requireAuthorization, requireCaller, signOut, useAuth, withAnonymousAuthorization, withAuth, withAuthorization };
@@ -1,5 +1,5 @@
1
- import { t as authErrorDiagnostics } from "./error-diagnostics-BssJr_2t.js";
2
- import { r as throwAuthenticationProviderError, t as readSetCookies } from "./set-cookie-DkqM1kvj.js";
1
+ import { t as authErrorDiagnostics } from "./error-diagnostics-CUPwukgE.js";
2
+ import { r as throwAuthenticationProviderError, t as readSetCookies } from "./set-cookie-DVfi-nJX.js";
3
3
  import { t as isRecord } from "./object-CAK6UYR5.js";
4
4
  import { n as authRequestEvent } from "./request-Dpq7GO8B.js";
5
5
  import { HTTPError } from "nitro/h3";
@@ -1,4 +1,4 @@
1
- import { t as authErrorDiagnostics } from "./error-diagnostics-BssJr_2t.js";
1
+ import { t as authErrorDiagnostics } from "./error-diagnostics-CUPwukgE.js";
2
2
  import { ViteHubError, isViteHubError } from "@vite-hub/runtime";
3
3
  // src/errors.ts
4
4
  function invalidAuthenticationErrorOptions() {
@@ -1,9 +1,8 @@
1
- import { t as authErrorDiagnostics } from "./error-diagnostics-BssJr_2t.js";
1
+ import { t as authErrorDiagnostics } from "./error-diagnostics-CUPwukgE.js";
2
2
  /**
3
- * The Better Auth core tables, with the fields of the plugins that ViteHub ships: `admin()` (`user.role`, bans, and
4
- * `session.impersonatedBy`), the `jwt()` and `oauthProvider()` tables of `mcpOAuth()`, the tables of
5
- * `organization()` and of `passkey()` from `@better-auth/passkey`, and the table of Better Auth's limiter. A test checks this
6
- * list against Better Auth's own `getAuthTables()`, so a Better Auth upgrade that changes a table fails it.
3
+ * The Better Auth core tables, with the tables of the plugins that ViteHub ships: `jwt()` and `oauthProvider()` of
4
+ * `mcpOAuth()`, `organization()`, `passkey()` from `@better-auth/passkey`, and the table of Better Auth's limiter. The
5
+ * fields of `admin()` are in `authPluginSchemas`. A test checks this list against Better Auth's own `getAuthTables()`, so a Better Auth upgrade that changes a table fails it.
7
6
  */
8
7
  const authTableSpecs = {
9
8
  user: { fields: {
@@ -32,14 +31,7 @@ const authTableSpecs = {
32
31
  required: true,
33
32
  defaultValue: "now",
34
33
  onUpdate: true
35
- },
36
- role: { type: "string" },
37
- banned: {
38
- type: "boolean",
39
- defaultValue: false
40
- },
41
- banReason: { type: "string" },
42
- banExpires: { type: "date" }
34
+ }
43
35
  } },
44
36
  session: { fields: {
45
37
  expiresAt: {
@@ -73,7 +65,6 @@ const authTableSpecs = {
73
65
  onDelete: "cascade"
74
66
  }
75
67
  },
76
- impersonatedBy: { type: "string" },
77
68
  activeOrganizationId: { type: "string" }
78
69
  } },
79
70
  account: { fields: {
@@ -575,6 +566,18 @@ const authTableSpecs = {
575
566
  * `getAuthTables()`. `apiKey()` and `stripe()` are copied from `@better-auth/api-key` and `@better-auth/stripe` 1.7.
576
567
  */
577
568
  const authPluginSchemas = {
569
+ admin: { fields: {
570
+ user: {
571
+ role: { type: "string" },
572
+ banned: {
573
+ type: "boolean",
574
+ defaultValue: false
575
+ },
576
+ banReason: { type: "string" },
577
+ banExpires: { type: "date" }
578
+ },
579
+ session: { impersonatedBy: { type: "string" } }
580
+ } },
578
581
  anonymous: { fields: { user: { isAnonymous: {
579
582
  type: "boolean",
580
583
  defaultValue: false
@@ -57,19 +57,6 @@ declare const coreTableSpecs: {
57
57
  readonly defaultValue: "now";
58
58
  readonly onUpdate: true;
59
59
  };
60
- readonly role: {
61
- readonly type: "string";
62
- };
63
- readonly banned: {
64
- readonly type: "boolean";
65
- readonly defaultValue: false;
66
- };
67
- readonly banReason: {
68
- readonly type: "string";
69
- };
70
- readonly banExpires: {
71
- readonly type: "date";
72
- };
73
60
  };
74
61
  };
75
62
  readonly session: {
@@ -109,9 +96,6 @@ declare const coreTableSpecs: {
109
96
  readonly onDelete: "cascade";
110
97
  };
111
98
  };
112
- readonly impersonatedBy: {
113
- readonly type: "string";
114
- };
115
99
  readonly activeOrganizationId: {
116
100
  readonly type: "string";
117
101
  };
@@ -803,14 +787,13 @@ declare const coreTableSpecs: {
803
787
  /** The literal type of `authTableSpecs`, which types the columns of the Auth tables. */
804
788
  type AuthCoreTableSpecs = typeof coreTableSpecs;
805
789
  /**
806
- * The Better Auth core tables, with the fields of the plugins that ViteHub ships: `admin()` (`user.role`, bans, and
807
- * `session.impersonatedBy`), the `jwt()` and `oauthProvider()` tables of `mcpOAuth()`, the tables of
808
- * `organization()` and of `passkey()` from `@better-auth/passkey`, and the table of Better Auth's limiter. A test checks this
809
- * list against Better Auth's own `getAuthTables()`, so a Better Auth upgrade that changes a table fails it.
790
+ * The Better Auth core tables, with the tables of the plugins that ViteHub ships: `jwt()` and `oauthProvider()` of
791
+ * `mcpOAuth()`, `organization()`, `passkey()` from `@better-auth/passkey`, and the table of Better Auth's limiter. The
792
+ * fields of `admin()` are in `authPluginSchemas`. A test checks this list against Better Auth's own `getAuthTables()`, so a Better Auth upgrade that changes a table fails it.
810
793
  */
811
794
  declare const authTableSpecs: Readonly<Record<AuthTableName, AuthTableSpec>>;
812
795
  /** The Better Auth plugins whose tables and columns `authDatabase()` adds when the Auth Definition imports them. */
813
- type AuthSchemaPlugin = "anonymous" | "apiKey" | "lastLoginMethod" | "phoneNumber" | "stripe" | "twoFactor" | "username";
796
+ type AuthSchemaPlugin = "admin" | "anonymous" | "apiKey" | "lastLoginMethod" | "phoneNumber" | "stripe" | "twoFactor" | "username";
814
797
  /** The core Better Auth models. Each one takes `additionalFields`. */
815
798
  type AuthCoreModel = "user" | "session" | "account" | "verification";
816
799
  interface AuthPluginSchema {
@@ -820,6 +803,30 @@ interface AuthPluginSchema {
820
803
  tables?: Readonly<Record<string, AuthTableSpec>>;
821
804
  }
822
805
  declare const pluginSchemas: {
806
+ readonly admin: {
807
+ readonly fields: {
808
+ readonly user: {
809
+ readonly role: {
810
+ readonly type: "string";
811
+ };
812
+ readonly banned: {
813
+ readonly type: "boolean";
814
+ readonly defaultValue: false;
815
+ };
816
+ readonly banReason: {
817
+ readonly type: "string";
818
+ };
819
+ readonly banExpires: {
820
+ readonly type: "date";
821
+ };
822
+ };
823
+ readonly session: {
824
+ readonly impersonatedBy: {
825
+ readonly type: "string";
826
+ };
827
+ };
828
+ };
829
+ };
823
830
  readonly anonymous: {
824
831
  readonly fields: {
825
832
  readonly user: {
package/dist/test.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as AuthDefinition } from "./types-BHSgxyvV.js";
1
+ import { _ as AuthDefinition } from "./types-BP9_XUr9.js";
2
2
  import { Session, User } from "better-auth";
3
3
  /** The user to sign in. Auth creates it when no user has this email. Other fields, such as `role`, go to the new user. */
4
4
  export interface SignInTestUser {
package/dist/test.js CHANGED
@@ -1,5 +1,5 @@
1
- import { s as resolveDefaultDefinition, t as authForRequest } from "./auth-instance-_J7R9Qs1.js";
2
- import { t as authErrorDiagnostics } from "./error-diagnostics-BssJr_2t.js";
1
+ import { s as resolveDefaultDefinition, t as authForRequest } from "./auth-instance-BpI9Ps8A.js";
2
+ import { t as authErrorDiagnostics } from "./error-diagnostics-CUPwukgE.js";
3
3
  import { testUtils } from "better-auth/plugins";
4
4
  // src/test.ts
5
5
  /**