@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.
- package/README.md +1 -1
- package/dist/{abilities-9jC7iuN0.d.ts → abilities-3L1Y5Pnw.d.ts} +1 -3
- package/dist/abilities.d.ts +1 -1
- package/dist/abilities.js +1 -2
- package/dist/{ability-error-DmnUGicq.js → ability-error-BHhPkrZd.js} +3 -5
- package/dist/{ability-error-DUWJ6Q1W.d.ts → ability-error-C1c30O6E.d.ts} +0 -4
- package/dist/{access-pages-FNQTyGRD.js → access-pages-BwImVHN_.js} +3 -5
- package/dist/{admin-claim-code-CDipqeAU.js → admin-claim-code-C3X_U43x.js} +1 -2
- package/dist/agent.d.ts +1 -3
- package/dist/agent.js +5 -6
- package/dist/{application-path-DuTpfGFj.js → application-path-zKi7NrvK.js} +1 -2
- package/dist/{auth-instance-zYMjldPG.js → auth-instance-_J7R9Qs1.js} +34 -47
- package/dist/{cli-NCtitmny.d.ts → cli-C5pAfY4x.d.ts} +0 -6
- package/dist/cli.d.ts +2 -4
- package/dist/cli.js +3 -4
- package/dist/{console-runtime-Dqidb3zF.d.ts → console-runtime-BP1ZKJB0.d.ts} +1 -3
- package/dist/{console-runtime-CuXRDhGy.js → console-runtime-vc3JQEuq.js} +7 -9
- package/dist/console-runtime.d.ts +2 -2
- package/dist/console-runtime.js +1 -2
- package/dist/{console-types-CmmnKGMx.js → console-types-51lkf0lk.js} +1 -2
- package/dist/console.d.ts +1 -5
- package/dist/console.js +2 -3
- package/dist/{database-options-CcjUG-us.js → database-options-DQ-8qYMl.js} +2 -3
- package/dist/{database-schema-options-CTKCAfqW.js → database-schema-options-CkSeU9V3.js} +2 -3
- package/dist/database.d.ts +1 -3
- package/dist/database.js +4 -5
- package/dist/{definition-BFT9T6In.js → definition-MDGMNKrK.js} +11 -17
- package/dist/{error-diagnostics-uEbxSY2G.js → error-diagnostics-BssJr_2t.js} +1 -2
- package/dist/{events-DJmO9a9I.js → events-DZqMiae_.js} +4 -6
- package/dist/forward.d.ts +1 -3
- package/dist/forward.js +2 -3
- package/dist/index.d.ts +3 -7
- package/dist/index.js +3 -3
- package/dist/internal/server.d.ts +3 -3
- package/dist/internal/server.js +4 -4
- package/dist/{invariant-DolT9EEx.js → invariant-Dj2R1eMr.js} +1 -2
- package/dist/{mcp-config-DRRlCAWN.js → mcp-config-C7srUMIZ.js} +2 -3
- package/dist/{mcp-token-BhonlK9C.js → mcp-token--KuLYEub.js} +7 -18
- package/dist/mcp.d.ts +0 -4
- package/dist/mcp.js +4 -5
- package/dist/{members-Cl3hFRjk.js → members-D3_Q5XJb.js} +10 -14
- package/dist/{nitro-kit-32CVgbWS.js → nitro-kit-Bg4xUZAI.js} +2 -3
- package/dist/{nuxt-bridge-Cl988STZ.js → nuxt-bridge-pRyfYD5c.js} +1 -2
- package/dist/nuxt.d.ts +1 -7
- package/dist/nuxt.js +6 -9
- package/dist/{object-Da1zyPCR.js → object-CAK6UYR5.js} +1 -2
- package/dist/{own-access-CdgEICjO.d.ts → own-access-C22hSIuF.d.ts} +1 -3
- package/dist/{own-access-C8pwo_Kn.js → own-access-DQgqxTbI.js} +3 -4
- package/dist/{page-tools-shared-l4eyj53D.js → page-tools-shared-CtoKaNQZ.js} +1 -2
- package/dist/{presets-CHndEv5i.d.ts → presets-C6AtiRdI.d.ts} +0 -2
- package/dist/presets.d.ts +1 -1
- package/dist/presets.js +2 -3
- package/dist/{request-z6DHHmrb.js → request-Dpq7GO8B.js} +2 -4
- package/dist/runtime/console.d.ts +1 -1
- package/dist/runtime/console.js +2 -2
- package/dist/runtime/empty-abilities.d.ts +1 -3
- package/dist/runtime/empty-abilities.js +1 -2
- package/dist/runtime/empty-client.d.ts +0 -2
- package/dist/runtime/empty-client.js +1 -2
- package/dist/runtime/empty-definition.d.ts +1 -3
- package/dist/runtime/empty-definition.js +1 -2
- package/dist/runtime/nuxt.d.ts +1 -3
- package/dist/runtime/nuxt.js +1 -2
- package/dist/runtime/server.d.ts +2 -2
- package/dist/runtime/server.js +6 -7
- package/dist/runtime/vue-nuxt.d.ts +0 -2
- package/dist/runtime/vue-nuxt.js +5 -6
- package/dist/{runtime-state-ojQCzKOc.js → runtime-state-DtKUfxKq.js} +1 -2
- package/dist/schema.d.ts +1 -5
- package/dist/schema.js +2 -3
- package/dist/{server-Ci2i6p1S.d.ts → server-CFWlYQJb.d.ts} +5 -13
- package/dist/{server-CyqLFm3L.js → server-D4Hi4TBI.js} +16 -18
- package/dist/{server-B-zNtSvm.d.ts → server-DCsgxFPP.d.ts} +2 -6
- package/dist/server.d.ts +2 -2
- package/dist/server.js +2 -2
- package/dist/{session-cookies-CZmZS5QF.js → session-cookies-1FMcMnRh.js} +6 -8
- package/dist/{set-cookie-DWIyCCJO.js → set-cookie-DkqM1kvj.js} +3 -5
- package/dist/{table-specs-BhWz_U0M.d.ts → table-specs-BLm_Zlss.d.ts} +0 -2
- package/dist/{table-specs-D0VLp1U4.js → table-specs-jw0jjU6l.js} +1 -2
- package/dist/test.d.ts +2 -4
- package/dist/test.js +3 -4
- package/dist/{types-gl-myjZc.d.ts → types-BHSgxyvV.d.ts} +2 -10
- package/dist/{vite-QKjsPLwP.js → vite-D1xC9n1O.js} +25 -41
- package/dist/vite.d.ts +3 -14
- package/dist/vite.js +1 -2
- package/dist/vue.d.ts +3 -7
- package/dist/vue.js +4 -5
- package/package.json +32 -31
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getStandardContext } from "@vite-hub/runtime/internal/h3";
|
|
2
|
-
|
|
2
|
+
// ../internal/src/runtime/cloudflare-env-lookup.ts
|
|
3
3
|
/** The key of the AsyncLocalStorage store on `globalThis`. Every bundled copy of this module shares the store. */
|
|
4
4
|
const activeEnvStorageKey = Symbol.for("vitehub.cloudflare.env-storage");
|
|
5
5
|
let activeEnv;
|
|
@@ -13,8 +13,7 @@ function getActiveCloudflareEnv() {
|
|
|
13
13
|
const host = globalThis;
|
|
14
14
|
return Object.hasOwn(host, "__env__") && host.__env__ !== void 0 ? host.__env__ : activeEnv;
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
//#region src/request.ts
|
|
16
|
+
// src/request.ts
|
|
18
17
|
function isObjectLike(value) {
|
|
19
18
|
return value !== null && (typeof value === "object" || typeof value === "function");
|
|
20
19
|
}
|
|
@@ -43,5 +42,4 @@ function authRequestEvent(input) {
|
|
|
43
42
|
function authCloudflareEnv(event) {
|
|
44
43
|
return (event ? getStandardContext(event).runtime?.cloudflare?.env : void 0) ?? getActiveCloudflareEnv();
|
|
45
44
|
}
|
|
46
|
-
//#endregion
|
|
47
45
|
export { authRequestEvent as n, unwrapAuthRequest as r, authCloudflareEnv as t };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as authForRequest, r as aggregateAuthEvents, v as listAuthEvents } from "../server-Ci2i6p1S.js";
|
|
2
1
|
import "../server.js";
|
|
2
|
+
import { A as authForRequest, r as aggregateAuthEvents, v as listAuthEvents } from "../server-CFWlYQJb.js";
|
|
3
3
|
export { aggregateAuthEvents, authForRequest, listAuthEvents };
|
package/dist/runtime/console.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
1
|
+
import { g as listAuthEvents, t as aggregateAuthEvents } from "../server-D4Hi4TBI.js";
|
|
2
|
+
import { t as authForRequest } from "../auth-instance-_J7R9Qs1.js";
|
|
3
3
|
import "../server.js";
|
|
4
4
|
export { aggregateAuthEvents, authForRequest, listAuthEvents };
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { BetterAuthClientOptions } from "better-auth";
|
|
2
|
-
//#region src/runtime/empty-client.d.ts
|
|
3
2
|
/** The options of the default Auth client when the app has no `auth.client.ts`. */
|
|
4
3
|
declare const options: BetterAuthClientOptions | undefined;
|
|
5
|
-
//#endregion
|
|
6
4
|
export { options as default };
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { _ as AuthDefinition } from "../types-
|
|
2
|
-
//#region src/runtime/empty-definition.d.ts
|
|
1
|
+
import { _ as AuthDefinition } from "../types-BHSgxyvV.js";
|
|
3
2
|
declare const definition: AuthDefinition | undefined;
|
|
4
3
|
export declare function getAuthApp(): object | undefined;
|
|
5
|
-
//#endregion
|
|
6
4
|
export { definition as default };
|
package/dist/runtime/nuxt.d.ts
CHANGED
package/dist/runtime/nuxt.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import definitionForApp from "#vitehub/auth/definition";
|
|
2
2
|
import { useServerEnv } from "#vitehub/env/server";
|
|
3
3
|
import { setAuthRuntimeEnvResolver } from "@vite-hub/auth/runtime/server";
|
|
4
|
-
|
|
4
|
+
// src/runtime/nuxt.ts
|
|
5
5
|
function viteHubAuthNuxtRuntime() {
|
|
6
6
|
setAuthRuntimeEnvResolver(useServerEnv, definitionForApp);
|
|
7
7
|
}
|
|
8
|
-
//#endregion
|
|
9
8
|
export { viteHubAuthNuxtRuntime as default };
|
package/dist/runtime/server.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as authAccessHandlerMeta } from "../own-access-
|
|
2
|
-
import { a as setAuthAccessIdentityResolver, i as createLazyAuthAccessHandler, n as checkBuiltAuthPages, o as setAuthRuntimeEnvResolver, r as createAuthAccessRouteMatcher, t as AuthAccessRouteMatch } from "../server-
|
|
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";
|
|
3
3
|
export { AuthAccessRouteMatch, authAccessHandlerMeta, checkBuiltAuthPages, createAuthAccessRouteMatcher, createLazyAuthAccessHandler, setAuthAccessIdentityResolver, setAuthRuntimeEnvResolver };
|
package/dist/runtime/server.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
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";
|
|
4
|
+
import { r as unwrapAuthRequest } from "../request-Dpq7GO8B.js";
|
|
5
|
+
import { n as getAuthRuntimeState } from "../runtime-state-DtKUfxKq.js";
|
|
6
|
+
// src/runtime/server.ts
|
|
7
7
|
function setAuthRuntimeEnvResolver(resolver, definition) {
|
|
8
8
|
const state = getAuthRuntimeState();
|
|
9
9
|
if (definition) state.envResolvers?.set(definition, resolver);
|
|
@@ -82,5 +82,4 @@ function createLazyAuthAccessHandler(routes, load, publicRoutes = []) {
|
|
|
82
82
|
return await (await handler)(input);
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
|
-
//#endregion
|
|
86
85
|
export { authAccessHandlerMeta, checkBuiltAuthPages, createAuthAccessRouteMatcher, createLazyAuthAccessHandler, setAuthAccessIdentityResolver, setAuthRuntimeEnvResolver };
|
package/dist/runtime/vue-nuxt.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { n as invariantError } from "../invariant-
|
|
2
|
-
import
|
|
3
|
-
import "../
|
|
4
|
-
import { a as setRequestFetchResolver, i as setNuxtErrorFactory, n as setDefaultAuthBasePath, o as setSessionSeedResolver, r as setNuxtAppResolver, s as setSignOutHandler } from "../nuxt-bridge-
|
|
1
|
+
import { n as invariantError } from "../invariant-Dj2R1eMr.js";
|
|
2
|
+
import "../page-tools-shared-CtoKaNQZ.js";
|
|
3
|
+
import { i as resolveAuthMountPath } from "../application-path-zKi7NrvK.js";
|
|
4
|
+
import { a as setRequestFetchResolver, i as setNuxtErrorFactory, n as setDefaultAuthBasePath, o as setSessionSeedResolver, r as setNuxtAppResolver, s as setSignOutHandler } from "../nuxt-bridge-pRyfYD5c.js";
|
|
5
5
|
import { addRouteMiddleware, createError, defineNuxtPlugin, navigateTo, showError, tryUseNuxtApp, useRequestEvent, useRouter, useRuntimeConfig, useState } from "#app";
|
|
6
|
-
|
|
6
|
+
// src/runtime/vue-nuxt.ts
|
|
7
7
|
/** Vue Router gives the same params in other forms: `"a"` or `["a"]`, `[]` or `""` or nothing for an empty one, and any key order. */
|
|
8
8
|
function sameParams(a, b) {
|
|
9
9
|
const values = (value) => JSON.stringify(value === void 0 || value === "" ? [] : [value].flat());
|
|
@@ -206,5 +206,4 @@ const viteHubAuthPlugin = defineNuxtPlugin({
|
|
|
206
206
|
});
|
|
207
207
|
}
|
|
208
208
|
});
|
|
209
|
-
//#endregion
|
|
210
209
|
export { viteHubAuthPlugin as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/runtime-state.ts
|
|
2
2
|
const authRuntimeStateKey = Symbol.for("vitehub.auth.runtime");
|
|
3
3
|
/**
|
|
4
4
|
* Marks the database that Auth adds to a Definition without one. It keeps rows in the memory of one process, so a value
|
|
@@ -21,5 +21,4 @@ function resetAuth() {
|
|
|
21
21
|
state.definition = void 0;
|
|
22
22
|
state.providers = void 0;
|
|
23
23
|
}
|
|
24
|
-
//#endregion
|
|
25
24
|
export { resetAuth as i, getAuthRuntimeState as n, isAuthProcessMemoryDatabase as r, authProcessMemoryDatabase as t };
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
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-
|
|
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";
|
|
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";
|
|
5
|
-
//#region src/existing-tables.d.ts
|
|
6
5
|
interface AuthExistingColumn {
|
|
7
6
|
notNull: boolean;
|
|
8
7
|
/** The SQL text of the column default, such as `'member'` or `(cast(unixepoch('subsecond') * 1000 as integer))`. */
|
|
@@ -35,8 +34,6 @@ interface AuthExistingTable {
|
|
|
35
34
|
}
|
|
36
35
|
/** The existing tables, by SQL table name. */
|
|
37
36
|
type AuthExistingTables = Readonly<Record<string, AuthExistingTable>>;
|
|
38
|
-
//#endregion
|
|
39
|
-
//#region src/schema.d.ts
|
|
40
37
|
/** A Better Auth table in a SQLite Database (SQLite, libSQL, or Cloudflare D1), with untyped columns. */
|
|
41
38
|
export type AuthSqliteTable = SQLiteTableWithColumns<{
|
|
42
39
|
name: string;
|
|
@@ -185,5 +182,4 @@ export declare const authPostgresSchema: AuthPostgresSchema;
|
|
|
185
182
|
export declare function createAuthSqliteSchema<const TOptions extends AuthSchemaOptions, const TExisting extends AuthExistingTables | undefined = AuthExistingTables | undefined>(options: TOptions, existing?: TExisting): AuthSqliteSchemaFor<TOptions, TExisting>;
|
|
186
183
|
/** The Better Auth tables for Postgres, with the plugins and additional fields of `options`, typed from its literal. */
|
|
187
184
|
export declare function createAuthPostgresSchema<const TOptions extends AuthSchemaOptions>(options: TOptions): AuthPostgresSchemaFor<TOptions>;
|
|
188
|
-
//#endregion
|
|
189
185
|
export { type AuthCoreModel, type AuthCoreTableSpecs, type AuthPluginSchemas, type AuthSchemaOptions, type AuthSchemaPlugin, type AuthTableField, type AuthTableName, type AuthTableSpec, authPluginSchemas, authTableSpecs, resolveAuthTableSpecs };
|
package/dist/schema.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { i as resolveAuthTableSpecs, n as authSqlName, r as authTableSpecs, t as authPluginSchemas } from "./table-specs-
|
|
1
|
+
import { i as resolveAuthTableSpecs, n as authSqlName, r as authTableSpecs, t as authPluginSchemas } from "./table-specs-jw0jjU6l.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";
|
|
5
|
-
|
|
5
|
+
// src/schema.ts
|
|
6
6
|
const sameColumns = (left, right) => left.length === right.length && left.every((column, index) => column === right[index]);
|
|
7
7
|
const foreignKeyAction = (action) => action.toLowerCase();
|
|
8
8
|
function buildTables(dialect, specs, existing) {
|
|
@@ -145,5 +145,4 @@ function createAuthSqliteSchema(options, existing) {
|
|
|
145
145
|
function createAuthPostgresSchema(options) {
|
|
146
146
|
return buildTables(postgresDialect, resolveAuthTableSpecs(options));
|
|
147
147
|
}
|
|
148
|
-
//#endregion
|
|
149
148
|
export { authPluginSchemas, authPostgresSchema, authSqliteSchema, authTableSpecs, createAuthPostgresSchema, createAuthSqliteSchema, resolveAuthTableSpecs };
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
4
|
-
import "./server-
|
|
5
|
-
import "./ability-error-
|
|
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";
|
|
5
|
+
import "./ability-error-C1c30O6E.js";
|
|
6
6
|
import { AccessAuthorizeOption, Result, ViteHubContext } from "@vite-hub/runtime";
|
|
7
7
|
import { APIError } from "better-auth/api";
|
|
8
8
|
import { AuthContext, BetterAuthOptions, BetterAuthPlugin, User } from "better-auth";
|
|
9
|
-
//#region src/members.d.ts
|
|
10
9
|
/** Why `checkAuthMember()` did not let a user in. */
|
|
11
10
|
type AuthMemberErrorCode = "AUTH_NOT_MEMBER" | "AUTH_GITHUB_UNAVAILABLE";
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region src/caller.d.ts
|
|
14
11
|
/** The Auth user of a caller, with the fields of the app's plugins, such as `role` of `admin()`. */
|
|
15
12
|
type AuthCallerUser = User & Record<string, unknown>;
|
|
16
13
|
/**
|
|
@@ -34,8 +31,6 @@ type AuthCaller<TRegistry = ViteHub.AuthRegistry> = {
|
|
|
34
31
|
scopes: string[];
|
|
35
32
|
};
|
|
36
33
|
type AuthCallerErrorCode = "AUTH_MCP_TOKEN_INVALID" | "AUTH_SIGNED_OUT";
|
|
37
|
-
//#endregion
|
|
38
|
-
//#region src/auth-instance.d.ts
|
|
39
34
|
declare function findVerifiedAuthUserId(email: string, request: Request): Promise<string | undefined>;
|
|
40
35
|
declare function createBetterAuthOptions(definition: AuthDefinition): AuthBetterAuthRuntimeOptions;
|
|
41
36
|
declare function getAuthForDefinition<TDefinition extends AuthDefinition>(definition: TDefinition): AuthFor<TDefinition>;
|
|
@@ -44,8 +39,6 @@ declare function getAuthForDefinition<TDefinition extends AuthDefinition>(defini
|
|
|
44
39
|
* `useAuth(event)`. The Console reads it through `@vite-hub/auth/runtime/console`.
|
|
45
40
|
*/
|
|
46
41
|
declare function authForRequest(request: Pick<Request, "headers" | "url">, event?: ViteHubContext, definition?: AuthDefinition): RegisteredAuth;
|
|
47
|
-
//#endregion
|
|
48
|
-
//#region src/internal/server.d.ts
|
|
49
42
|
/** Where Better Auth returns after one sign-in that a guard starts. */
|
|
50
43
|
type AuthSignInURLs = Pick<AuthProviderSignIn, "callbackURL" | "errorCallbackURL">;
|
|
51
44
|
/** A provider sign-in with the page that Better Auth returns to. */
|
|
@@ -201,5 +194,4 @@ declare function aggregateAuthEvents(window: AuthEventWindow, definition?: AuthD
|
|
|
201
194
|
* `host.impersonation` lets the Console start impersonation. It is off by default.
|
|
202
195
|
*/
|
|
203
196
|
declare function getAuthConsoleForRequest(request: Request, event?: ViteHubContext, host?: AuthConsoleHostOptions): AuthConsole;
|
|
204
|
-
//#endregion
|
|
205
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 };
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { t as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { i as
|
|
7
|
-
import { n as getAuthRuntimeState } from "./runtime-state-
|
|
8
|
-
import {
|
|
9
|
-
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-zYMjldPG.js";
|
|
10
|
-
import { i as resolveAuthMountPath, n as canonicalAccessPath } from "./application-path-DuTpfGFj.js";
|
|
11
|
-
import { a as normalizeAuthBasePath } from "./access-pages-FNQTyGRD.js";
|
|
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";
|
|
3
|
+
import { i as resolveAuthMountPath, n as canonicalAccessPath } from "./application-path-zKi7NrvK.js";
|
|
4
|
+
import { a as normalizeAuthBasePath } from "./access-pages-BwImVHN_.js";
|
|
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";
|
|
12
9
|
import { createAuthAccessRouteMatcher } from "./runtime/server.js";
|
|
13
|
-
import { n as checkAbility, t as AbilityError } from "./ability-error-
|
|
14
|
-
import {
|
|
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";
|
|
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";
|
|
17
17
|
import { parseUserOutput } from "better-auth/db";
|
|
18
18
|
import abilities from "#vitehub/auth/abilities";
|
|
19
19
|
import { isRuntimeResponse } from "@vite-hub/runtime/internal/runtime-type";
|
|
20
20
|
import { betterAuth } from "better-auth";
|
|
21
|
-
|
|
21
|
+
// src/caller.ts
|
|
22
22
|
const callerErrors = /*#__PURE__*/ defineErrors({
|
|
23
23
|
docs: "https://vitehub.dev/docs/auth/diagnostics",
|
|
24
24
|
codes: { AUTH_SIGNED_OUT: {
|
|
@@ -27,8 +27,7 @@ const callerErrors = /*#__PURE__*/ defineErrors({
|
|
|
27
27
|
} }
|
|
28
28
|
});
|
|
29
29
|
const signedOutError = () => callerErrors.AUTH_SIGNED_OUT();
|
|
30
|
-
|
|
31
|
-
//#region src/internal/server.ts
|
|
30
|
+
// src/internal/server.ts
|
|
32
31
|
function hasHappyDomRequestState(value) {
|
|
33
32
|
const ownSymbols = Object.getOwnPropertySymbols(value);
|
|
34
33
|
const prototypeSymbols = Object.getOwnPropertySymbols(Object.getPrototypeOf(value) ?? {});
|
|
@@ -848,7 +847,7 @@ async function readCaller(event, definition) {
|
|
|
848
847
|
const auth = authForRequest(request, authRequestEvent(event), definition);
|
|
849
848
|
const { options } = await auth.$context;
|
|
850
849
|
if (isJwsToken(token) && mcpOAuthResources(options.plugins).length) {
|
|
851
|
-
const { verifyAppAccessToken } = await import("./mcp-token
|
|
850
|
+
const { verifyAppAccessToken } = await import("./mcp-token--KuLYEub.js").then((n) => n.i);
|
|
852
851
|
const url = new URL(request.url);
|
|
853
852
|
const [error, caller] = await verifyAppAccessToken(token, trustsProxyHeaders(options) ? forwardedRequestOrigin(request) : url.origin, url.pathname, auth);
|
|
854
853
|
if (error) return [error, void 0];
|
|
@@ -996,5 +995,4 @@ function getAuthConsoleForRequest(request, event, host) {
|
|
|
996
995
|
});
|
|
997
996
|
return createAuthConsole(requestProvider(definition, resolved), resolved.options.console, resolved.options.events ? resolved.options.events.store : void 0, host);
|
|
998
997
|
}
|
|
999
|
-
//#endregion
|
|
1000
998
|
export { toAuthRequest as C, withAuthorization as D, withAuth as E, signOut as S, withAnonymousAuthorization as T, requireAbility as _, checkAuthMember as a, requireAuthorization as b, createAuthForRequest as c, getAuth as d, getAuthConsoleForRequest as f, listAuthEvents as g, handleAuthRequest as h, can as i, createAuthHandler as l, handleAuth as m, assertAuthOrigin as n, createAuth as o, getAuthEvents as p, authRoute as r, createAuthAccessHandler as s, aggregateAuthEvents as t, createAuthRequestRuntimeOptions as u, requireAuth as v, useAuth as w, requireCaller as x, requireAuthAccessRoutes as y };
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "./
|
|
1
|
+
import "./own-access-C22hSIuF.js";
|
|
2
|
+
import { E as AuthRequestInput, H as ResolvedAuthAccessRoute, _ as AuthDefinition } from "./types-BHSgxyvV.js";
|
|
3
3
|
import { AccessAuthorizationContext, ViteHubContext } from "@vite-hub/runtime";
|
|
4
|
-
//#region src/runtime-state.d.ts
|
|
5
4
|
type AuthRuntimeEnvResolver = (event?: ViteHubContext) => Record<string, unknown>;
|
|
6
5
|
type AuthAccessIdentityResolver = (request: Request, event: AuthRequestInput, hasSession: boolean) => Promise<AccessAuthorizationContext<unknown, false>["user"] | Response | undefined>;
|
|
7
6
|
declare function resetAuth(): void;
|
|
8
|
-
//#endregion
|
|
9
|
-
//#region src/runtime/server.d.ts
|
|
10
7
|
declare function setAuthRuntimeEnvResolver(resolver: AuthRuntimeEnvResolver | undefined, definition?: AuthDefinition): void;
|
|
11
8
|
/**
|
|
12
9
|
* Stops the server when `access.pages` of the Auth Definition differs from the map that the Nuxt build read, for
|
|
@@ -36,5 +33,4 @@ type AuthAccessHandler = (input: AuthRequestInput) => Promise<Response | undefin
|
|
|
36
33
|
declare function createLazyAuthAccessHandler(routes: readonly ResolvedAuthAccessRoute[], load: () => Promise<{
|
|
37
34
|
createAuthAccessHandler: (routes: readonly ResolvedAuthAccessRoute[], definition?: undefined, publicRoutes?: readonly string[]) => AuthAccessHandler;
|
|
38
35
|
}>, publicRoutes?: readonly string[]): AuthAccessHandler;
|
|
39
|
-
//#endregion
|
|
40
36
|
export { setAuthAccessIdentityResolver as a, createLazyAuthAccessHandler as i, checkBuiltAuthPages as n, setAuthRuntimeEnvResolver as o, createAuthAccessRouteMatcher as r, resetAuth as s, AuthAccessRouteMatch as t };
|
package/dist/server.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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-
|
|
3
|
-
import { n as AbilityErrorData, t as AbilityError } from "./ability-error-
|
|
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";
|
|
3
|
+
import { n as AbilityErrorData, t as AbilityError } from "./ability-error-C1c30O6E.js";
|
|
4
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 };
|
package/dist/server.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as AbilityError } from "./ability-error-
|
|
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-
|
|
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";
|
|
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,10 +1,10 @@
|
|
|
1
|
-
import { t as authErrorDiagnostics } from "./error-diagnostics-
|
|
2
|
-
import { r as throwAuthenticationProviderError, t as readSetCookies } from "./set-cookie-
|
|
3
|
-
import { t as isRecord } from "./object-
|
|
4
|
-
import { n as authRequestEvent } from "./request-
|
|
1
|
+
import { t as authErrorDiagnostics } from "./error-diagnostics-BssJr_2t.js";
|
|
2
|
+
import { r as throwAuthenticationProviderError, t as readSetCookies } from "./set-cookie-DkqM1kvj.js";
|
|
3
|
+
import { t as isRecord } from "./object-CAK6UYR5.js";
|
|
4
|
+
import { n as authRequestEvent } from "./request-Dpq7GO8B.js";
|
|
5
5
|
import { HTTPError } from "nitro/h3";
|
|
6
6
|
import { getStandardContext } from "@vite-hub/runtime/internal/h3";
|
|
7
|
-
|
|
7
|
+
// src/session.ts
|
|
8
8
|
const apiErrorHeaders = Symbol.for("better-call:api-error-headers");
|
|
9
9
|
async function getAuthenticationSession(auth, input) {
|
|
10
10
|
const [api, getSession] = await readProvider(() => {
|
|
@@ -151,8 +151,7 @@ function readClientApiError(error) {
|
|
|
151
151
|
function readProperty(value, property) {
|
|
152
152
|
return value[property];
|
|
153
153
|
}
|
|
154
|
-
|
|
155
|
-
//#region src/session-cookies.ts
|
|
154
|
+
// src/session-cookies.ts
|
|
156
155
|
const preparedSessionCookies = /* @__PURE__ */ new WeakMap();
|
|
157
156
|
/**
|
|
158
157
|
* Puts the cookies that Better Auth set while it read the session in the prepared response of the request: the renewed
|
|
@@ -287,5 +286,4 @@ function isResponseLike(value) {
|
|
|
287
286
|
return false;
|
|
288
287
|
}
|
|
289
288
|
}
|
|
290
|
-
//#endregion
|
|
291
289
|
export { getAuthenticationSession as a, authenticationRefusalResponse as i, sendSessionCookies as n, authenticationRefusalError as r, prepareSessionCookies as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as authErrorDiagnostics } from "./error-diagnostics-
|
|
1
|
+
import { t as authErrorDiagnostics } from "./error-diagnostics-BssJr_2t.js";
|
|
2
2
|
import { ViteHubError, isViteHubError } from "@vite-hub/runtime";
|
|
3
|
-
|
|
3
|
+
// src/errors.ts
|
|
4
4
|
function invalidAuthenticationErrorOptions() {
|
|
5
5
|
throw authErrorDiagnostics.AUTH_R0004({ message: "[vitehub] Invalid authentication error options." });
|
|
6
6
|
}
|
|
@@ -26,8 +26,7 @@ function isAuthenticationAbortError(error) {
|
|
|
26
26
|
return false;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
//#region src/set-cookie.ts
|
|
29
|
+
// src/set-cookie.ts
|
|
31
30
|
/** Read separate cookies even when a Fetch runtime exposes only a combined field. */
|
|
32
31
|
function readSetCookies(headers) {
|
|
33
32
|
return typeof headers.getSetCookie === "function" ? headers.getSetCookie() : splitCombinedSetCookie(headers.get("set-cookie"));
|
|
@@ -86,5 +85,4 @@ function isKnownCookieAttribute(cookie, hasBoundaryWhitespace) {
|
|
|
86
85
|
if (lastSemicolon >= 0 && cookie.slice(lastSemicolon + 1).includes(",") && !/^expires\s*=/i.test(lastAttribute)) return false;
|
|
87
86
|
return hasBoundaryWhitespace || !lastAttribute.includes("=");
|
|
88
87
|
}
|
|
89
|
-
//#endregion
|
|
90
88
|
export { invalidAuthenticationErrorOptions as n, throwAuthenticationProviderError as r, readSetCookies as t };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/table-specs.d.ts
|
|
2
1
|
/** The keys of the Better Auth tables. Better Auth's Drizzle adapter finds each model by this key. */
|
|
3
2
|
type AuthTableName = "user" | "session" | "account" | "verification" | "jwks" | "oauthClient" | "oauthResource" | "oauthClientResource" | "oauthRefreshToken" | "oauthAccessToken" | "oauthConsent" | "oauthClientAssertion" | "rateLimit" | "organization" | "member" | "invitation" | "passkey";
|
|
4
3
|
type AuthFieldType = "boolean" | "date" | "json" | "number" | "number[]" | "string" | "string[]";
|
|
@@ -1092,5 +1091,4 @@ interface AuthSchemaOptions {
|
|
|
1092
1091
|
* A field that a table has already must have the same type and `required`.
|
|
1093
1092
|
*/
|
|
1094
1093
|
declare function resolveAuthTableSpecs(options?: AuthSchemaOptions): Record<string, AuthTableSpec>;
|
|
1095
|
-
//#endregion
|
|
1096
1094
|
export { AuthSchemaPlugin as a, AuthTableSpec as c, resolveAuthTableSpecs as d, AuthSchemaOptions as i, authPluginSchemas as l, AuthCoreTableSpecs as n, AuthTableField as o, AuthPluginSchemas as r, AuthTableName as s, AuthCoreModel as t, authTableSpecs as u };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as authErrorDiagnostics } from "./error-diagnostics-
|
|
1
|
+
import { t as authErrorDiagnostics } from "./error-diagnostics-BssJr_2t.js";
|
|
2
2
|
/**
|
|
3
3
|
* The Better Auth core tables, with the fields of the plugins that ViteHub ships: `admin()` (`user.role`, bans, and
|
|
4
4
|
* `session.impersonatedBy`), the `jwt()` and `oauthProvider()` tables of `mcpOAuth()`, the tables of
|
|
@@ -767,5 +767,4 @@ function authSchemaError(detail) {
|
|
|
767
767
|
function authSqlName(name) {
|
|
768
768
|
return name.replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2").replace(/([a-z\d])([A-Z])/g, "$1_$2").toLowerCase();
|
|
769
769
|
}
|
|
770
|
-
//#endregion
|
|
771
770
|
export { resolveAuthTableSpecs as i, authSqlName as n, authTableSpecs as r, authPluginSchemas as t };
|
package/dist/test.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { _ as AuthDefinition } from "./types-
|
|
1
|
+
import { _ as AuthDefinition } from "./types-BHSgxyvV.js";
|
|
2
2
|
import { Session, User } from "better-auth";
|
|
3
|
-
//#region src/test.d.ts
|
|
4
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. */
|
|
5
4
|
export interface SignInTestUser {
|
|
6
5
|
email?: string;
|
|
@@ -22,5 +21,4 @@ export interface TestSignIn {
|
|
|
22
21
|
* request. It sends no email and calls no provider. A Definition with the `stateless()` preset has no database, so it
|
|
23
22
|
* fails with `AUTH_TEST_SIGN_IN_STATELESS`.
|
|
24
23
|
*/
|
|
25
|
-
export declare function signIn(user?: SignInTestUser, definition?: AuthDefinition): Promise<TestSignIn>;
|
|
26
|
-
//#endregion
|
|
24
|
+
export declare function signIn(user?: SignInTestUser, definition?: AuthDefinition): Promise<TestSignIn>;
|
package/dist/test.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
1
|
+
import { s as resolveDefaultDefinition, t as authForRequest } from "./auth-instance-_J7R9Qs1.js";
|
|
2
|
+
import { t as authErrorDiagnostics } from "./error-diagnostics-BssJr_2t.js";
|
|
3
3
|
import { testUtils } from "better-auth/plugins";
|
|
4
|
-
|
|
4
|
+
// src/test.ts
|
|
5
5
|
/**
|
|
6
6
|
* Signs in a user of the app's Auth Definition and returns the session cookie. It writes the user and the session to the
|
|
7
7
|
* Auth database, as a real sign-in does, so `requireAuth()`, `useAuth().api.getSession()`, and abilities accept the
|
|
@@ -21,5 +21,4 @@ async function signIn(user = {}, definition = resolveDefaultDefinition()) {
|
|
|
21
21
|
user: saved
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
//#endregion
|
|
25
24
|
export { signIn };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { t as AuthPreset } from "./presets-
|
|
2
|
-
import { i as AuthSchemaOptions } from "./table-specs-
|
|
1
|
+
import { t as AuthPreset } from "./presets-C6AtiRdI.js";
|
|
2
|
+
import { i as AuthSchemaOptions } from "./table-specs-BLm_Zlss.js";
|
|
3
3
|
import { AccessAuthorizationContext, AccessAuthorize, AccessAuthorizeResult, AnonymousAccessAuthorizationContext, AnonymousAccessAuthorize, Duration } from "@vite-hub/runtime";
|
|
4
4
|
import { ViteHubContext as ViteHubContext$1 } from "@vite-hub/runtime/internal/h3";
|
|
5
5
|
import { Auth, BetterAuthOptions, DBAdapter, Session, User } from "better-auth";
|
|
6
6
|
import { EnvDatabase } from "@vite-hub/env/database";
|
|
7
|
-
//#region src/events.d.ts
|
|
8
7
|
declare const authEventTypes: readonly ["user.signed_up", "user.signed_in", "user.signed_out", "sign_in.failed", "session.revoked", "user.banned", "user.unbanned", "user.role_changed", "user.updated", "user.removed", "impersonation.started", "impersonation.stopped", "oauth.consent_granted", "oauth.consent_revoked", "organization.member_added", "organization.member_removed", "organization.member_role_changed"];
|
|
9
8
|
type AuthEventType = typeof authEventTypes[number];
|
|
10
9
|
type AuthEventActor = "system" | `user:${string}`;
|
|
@@ -86,8 +85,6 @@ declare function createDatabaseAuthEventStore(options: {
|
|
|
86
85
|
db: EnvDatabase;
|
|
87
86
|
retention?: AuthEventRetention | false;
|
|
88
87
|
}): AuthEventStore;
|
|
89
|
-
//#endregion
|
|
90
|
-
//#region src/nuxt-types.d.ts
|
|
91
88
|
/** Who may open a page: signed-in users (`user`) or signed-out visitors (`guest`). */
|
|
92
89
|
type AuthPageMode = "guest" | "user";
|
|
93
90
|
/**
|
|
@@ -105,8 +102,6 @@ type AuthPageMeta = boolean | AuthPageMode | {
|
|
|
105
102
|
* removes the guard of a wider pattern from the matching pages.
|
|
106
103
|
*/
|
|
107
104
|
type AuthPages = Record<`/${string}`, AuthPageMode | false>;
|
|
108
|
-
//#endregion
|
|
109
|
-
//#region src/console-types.d.ts
|
|
110
105
|
type AuthConsoleValue = string | number | boolean | null | string[] | number[];
|
|
111
106
|
type AuthConsoleFieldType = "string" | "number" | "boolean" | "date" | "string[]" | "number[]" | "json";
|
|
112
107
|
type AuthConsoleAction = "ban" | "unban" | "remove" | "revokeSession" | "revokeSessions" | "setRole" | "editField" | "impersonate" | "revokeConsent";
|
|
@@ -383,8 +378,6 @@ type AuthConsoleMutation = {
|
|
|
383
378
|
id: string;
|
|
384
379
|
};
|
|
385
380
|
declare const authConsoleActionNames: readonly AuthConsoleAction[];
|
|
386
|
-
//#endregion
|
|
387
|
-
//#region src/types.d.ts
|
|
388
381
|
declare global {
|
|
389
382
|
namespace ViteHub {
|
|
390
383
|
interface AuthRuntimeEnv extends Record<string, unknown> {}
|
|
@@ -631,5 +624,4 @@ type RegisteredAuth<TRegistry = ViteHub.AuthRegistry> = TRegistry extends {
|
|
|
631
624
|
} ? AuthFor<TDefinition> : ViteHubAuth;
|
|
632
625
|
/** `false` turns Auth off. `server/auth.ts` turns it on, and `defineAuth()` holds every Auth option. */
|
|
633
626
|
type AuthOptions = false;
|
|
634
|
-
//#endregion
|
|
635
627
|
export { AuthConsoleEventGroup as $, AuthRuntimeEnv as A, AuthEventActor as At, DiscoveredAuthDefinition as B, AuthEventsConfiguration as Bt, AuthGuardedHandler as C, authConsoleActionNames as Ct, AuthReservedOption as D, AuthPages as Dt, AuthRequestInput as E, AuthPageMode as Et, AuthSessionRefresh as F, AuthEventPage as Ft, AuthConsoleAction as G, ResolvedAuthAccessRoute as H, defaultAuthEventRetention as Ht, AuthSessionRefreshContext as I, AuthEventRetention as It, AuthConsoleAgent as J, AuthConsoleActivity as K, AuthSessionRefreshFields as L, AuthEventStore as Lt, AuthRuntimeOption as M, AuthEventCounts as Mt, AuthRuntimeOptions as N, AuthEventListInput as Nt, AuthResolvedDefinitionOptions as O, AuthDevice as Ot, AuthSessionOptions as P, AuthEventMetadata as Pt, AuthConsoleEvent as Q, AuthSignInConfiguration as R, AuthEventType as Rt, AuthFor as S, AuthConsoleValue as St, AuthRequest as T, AuthPageMeta as Tt, ResolvedAuthViteConfig as U, RegisteredAuth as V, createDatabaseAuthEventStore as Vt, ViteHubAuth as W, AuthConsoleColumn as X, AuthConsoleCapability as Y, AuthConsoleDescription as Z, AuthDefinition as _, AuthConsoleRoles as _t, AuthAccessPolicy as a, AuthConsoleHostSession as at, AuthDefinitionResolver as b, AuthConsoleUser as bt, AuthAccessRouteConfiguration as c, AuthConsoleList as ct, AuthAnonymousGuardedHandler as d, AuthConsoleOrganization as dt, AuthConsoleEventUser as et, AuthAppDatabase as f, AuthConsoleOrganizationDetail as ft, AuthComponentsOptions as g, AuthConsoleQuery as gt, AuthBetterAuthRuntimeOptions as h, AuthConsolePolicy as ht, AuthAccessConfiguration as i, AuthConsoleHostOptions as it, AuthRuntimeOnlyOptions as j, AuthEventAggregates as jt, AuthRuntimeContext as k, AuthEvent as kt, AuthAnonymousAuthorization as l, AuthConsoleMutation as lt, AuthBetterAuthOptions as m, AuthConsolePage as mt, AuthAccessAuthorize as n, AuthConsoleFieldPolicy as nt, AuthAccessPolicyContext as o, AuthConsoleHostUserInput as ot, AuthAuthorization as p, AuthConsoleOverview as pt, AuthConsoleActivityQuery as q, AuthAccessAuthorizeResult as r, AuthConsoleFieldType as rt, AuthAccessRoute as s, AuthConsoleImpersonation as st, AuthAccessAuthorizationContext as t, AuthConsoleField as tt, AuthAnonymousAuthorize as u, AuthConsoleOptions as ut, AuthDefinitionInput as v, AuthConsoleSession as vt, AuthOptions as w, authConsoleEventGroups as wt, AuthDeleteAccountOptions as x, AuthConsoleUserDetail as xt, AuthDefinitionOptions as y, AuthConsoleSessionUser as yt, AuthViteHubOptions as z, AuthEventWindow as zt };
|