@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
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Most applications install `vite-hub`, `@vite-hub/auth`, and `better-auth`, and e
|
|
|
14
14
|
## Install
|
|
15
15
|
|
|
16
16
|
```sh
|
|
17
|
-
pnpm add @vite-hub/auth better-auth drizzle-orm@1.0.0-rc.
|
|
17
|
+
pnpm add @vite-hub/auth better-auth drizzle-orm@1.0.0-rc.6 nitro
|
|
18
18
|
pnpm add -D vite
|
|
19
19
|
```
|
|
20
20
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { V as RegisteredAuth, l as AuthAnonymousAuthorization, p as AuthAuthorization } from "./types-
|
|
2
|
-
//#region src/abilities.d.ts
|
|
1
|
+
import { V as RegisteredAuth, l as AuthAnonymousAuthorization, p as AuthAuthorization } from "./types-BHSgxyvV.js";
|
|
3
2
|
/** A 4xx status that a rule can refuse with. `403` is the default. */
|
|
4
3
|
type AbilityStatus = 400 | 401 | 402 | 403 | 404 | 405 | 409 | 410 | 422 | 423 | 429 | 451;
|
|
5
4
|
declare const abilityDenial: unique symbol;
|
|
@@ -89,5 +88,4 @@ type AbilityRefusal<Name extends string = AbilityName> = (Name extends keyof Reg
|
|
|
89
88
|
type AbilityAuthorization<Name extends string> = Name extends keyof RegisteredAbilities ? RegisteredAbilities[Name] extends {
|
|
90
89
|
guest: true;
|
|
91
90
|
} ? AuthAuthorization | AuthAnonymousAuthorization : AuthAuthorization : AuthAuthorization;
|
|
92
|
-
//#endregion
|
|
93
91
|
export { AbilityRefusal as a, AbilityStatus as c, GuestAbilityRule as d, defineAbilities as f, AbilityName as i, AbilityUser as l, guest as m, AbilityAuthorization as n, AbilityRule as o, deny as p, AbilityDenial as r, AbilityRules as s, AbilityArgs as t, AbilityVerdict as u };
|
package/dist/abilities.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as AbilityRefusal, c as AbilityStatus, d as GuestAbilityRule, f as defineAbilities, i as AbilityName, l as AbilityUser, m as guest, n as AbilityAuthorization, o as AbilityRule, p as deny, r as AbilityDenial, s as AbilityRules, t as AbilityArgs, u as AbilityVerdict } from "./abilities-
|
|
1
|
+
import { a as AbilityRefusal, c as AbilityStatus, d as GuestAbilityRule, f as defineAbilities, i as AbilityName, l as AbilityUser, m as guest, n as AbilityAuthorization, o as AbilityRule, p as deny, r as AbilityDenial, s as AbilityRules, t as AbilityArgs, u as AbilityVerdict } from "./abilities-3L1Y5Pnw.js";
|
|
2
2
|
export { AbilityArgs, AbilityAuthorization, AbilityDenial, AbilityName, AbilityRefusal, AbilityRule, AbilityRules, AbilityStatus, AbilityUser, AbilityVerdict, GuestAbilityRule, defineAbilities, deny, guest };
|
package/dist/abilities.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/abilities.ts
|
|
2
2
|
/**
|
|
3
3
|
* Defines the app's rules in `shared/abilities.ts`. The server and the app run the same rules.
|
|
4
4
|
*
|
|
@@ -39,5 +39,4 @@ function guest(rule) {
|
|
|
39
39
|
Object.defineProperty(open, "guest", { value: true });
|
|
40
40
|
return open;
|
|
41
41
|
}
|
|
42
|
-
//#endregion
|
|
43
42
|
export { defineAbilities, deny, guest };
|
|
@@ -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 { HTTPError } from "nitro/h3";
|
|
3
|
-
|
|
3
|
+
// src/ability-check.ts
|
|
4
4
|
const signedOut = Object.freeze({
|
|
5
5
|
status: 401,
|
|
6
6
|
code: "signed-out"
|
|
@@ -39,8 +39,7 @@ function toRefusal(verdict, name) {
|
|
|
39
39
|
}
|
|
40
40
|
return { status: 403 };
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
//#region src/ability-error.ts
|
|
42
|
+
// src/ability-error.ts
|
|
44
43
|
const statusTexts = {
|
|
45
44
|
400: "Bad Request",
|
|
46
45
|
401: "Unauthorized",
|
|
@@ -87,5 +86,4 @@ var AbilityError = class extends HTTPError {
|
|
|
87
86
|
};
|
|
88
87
|
}
|
|
89
88
|
};
|
|
90
|
-
//#endregion
|
|
91
89
|
export { checkAbility as n, AbilityError as t };
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { HTTPError } from "nitro/h3";
|
|
2
|
-
//#region src/ability-check.d.ts
|
|
3
2
|
/** Why a rule refused: the HTTP status, and the code and details for the page. */
|
|
4
3
|
interface AbilityCheckRefusal {
|
|
5
4
|
status: number;
|
|
6
5
|
code?: string;
|
|
7
6
|
details?: unknown;
|
|
8
7
|
}
|
|
9
|
-
//#endregion
|
|
10
|
-
//#region src/ability-error.d.ts
|
|
11
8
|
/** The code and details of a refusal, as the error body's `data` and the `#denied` slot of `<AuthPermission>` carry them. */
|
|
12
9
|
interface AbilityErrorData {
|
|
13
10
|
code?: string;
|
|
@@ -30,5 +27,4 @@ declare class AbilityError extends HTTPError<AbilityErrorData> {
|
|
|
30
27
|
data: AbilityErrorData;
|
|
31
28
|
};
|
|
32
29
|
}
|
|
33
|
-
//#endregion
|
|
34
30
|
export { AbilityErrorData as n, AbilityError as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as authErrorDiagnostics } from "./error-diagnostics-
|
|
2
|
-
|
|
1
|
+
import { t as authErrorDiagnostics } from "./error-diagnostics-BssJr_2t.js";
|
|
2
|
+
// src/shared.ts
|
|
3
3
|
const defaultAuthBasePath = "/api/auth";
|
|
4
4
|
function normalizeAuthBasePath(value) {
|
|
5
5
|
const path = value?.trim() || defaultAuthBasePath;
|
|
@@ -8,8 +8,7 @@ function normalizeAuthBasePath(value) {
|
|
|
8
8
|
if (!normalized) throw authErrorDiagnostics.AUTH_R0013({ message: "`defineAuth()` basePath must resolve to a non-empty path." });
|
|
9
9
|
return normalized;
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
//#region src/access-pages.ts
|
|
11
|
+
// src/access-pages.ts
|
|
13
12
|
/**
|
|
14
13
|
* Normalizes a path as Nuxt does before it matches route rules: it decodes percent-encoding and, unless the router is
|
|
15
14
|
* case sensitive, folds each UTF-16 code unit to the lower case of its upper case. That is how a Vue Router path regular
|
|
@@ -92,5 +91,4 @@ function assertAuthPages(pages) {
|
|
|
92
91
|
shapes.set(shape, path);
|
|
93
92
|
}
|
|
94
93
|
}
|
|
95
|
-
//#endregion
|
|
96
94
|
export { normalizeAuthBasePath as a, normalizePagePath as i, assertAuthPages as n, createAccessPageMatcher as r, accessPageBeats as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/admin-claim-code.ts
|
|
2
2
|
/** The variable with the SHA-256 of a one-time claim code, written by `vitehub auth claim`. */
|
|
3
3
|
const adminClaimVariable = "VITEHUB_ADMIN_CLAIM";
|
|
4
4
|
/** Crockford Base32 without I, L, O, and U, so a person can read the code aloud without mistakes. */
|
|
@@ -18,5 +18,4 @@ async function adminClaimHash(code) {
|
|
|
18
18
|
const normalized = code.toUpperCase().replace(/[^0-9A-Z]/g, "");
|
|
19
19
|
return `sha256:${[...new Uint8Array(await crypto.subtle.digest("SHA-256", new TextEncoder().encode(normalized)))].map((byte) => byte.toString(16).padStart(2, "0")).join("")}`;
|
|
20
20
|
}
|
|
21
|
-
//#endregion
|
|
22
21
|
export { adminClaimVariable as n, createAdminClaimCode as r, adminClaimHash as t };
|
package/dist/agent.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference path="./host-declarations.d.ts" />
|
|
2
2
|
import { AgentInvoker, AgentInvokerOptions, AgentInvokerResolveContext, AgentRuntimeConfig, MaybePromise } from "@vite-hub/agent";
|
|
3
|
-
//#region src/agent.d.ts
|
|
4
3
|
export interface AuthenticatedUser {
|
|
5
4
|
email?: string | null;
|
|
6
5
|
id: string;
|
|
@@ -49,5 +48,4 @@ export interface AgentAuth {
|
|
|
49
48
|
user(invoker: AgentInvoker | null | undefined): Promise<AuthenticatedUser | null>;
|
|
50
49
|
}
|
|
51
50
|
export declare const agentAuth: AgentAuth;
|
|
52
|
-
export declare function authenticated<TRuntimeConfig extends AgentRuntimeConfig = AgentRuntimeConfig, CALL_OPTIONS = unknown, TUser extends AuthenticatedUser = AuthenticatedUser, TSession extends AuthenticatedSessionData = AuthenticatedSessionData>(options?: AuthenticatedOptions<TRuntimeConfig, CALL_OPTIONS, TUser, TSession>): AgentInvokerOptions<TRuntimeConfig, CALL_OPTIONS>;
|
|
53
|
-
//#endregion
|
|
51
|
+
export declare function authenticated<TRuntimeConfig extends AgentRuntimeConfig = AgentRuntimeConfig, CALL_OPTIONS = unknown, TUser extends AuthenticatedUser = AuthenticatedUser, TSession extends AuthenticatedSessionData = AuthenticatedSessionData>(options?: AuthenticatedOptions<TRuntimeConfig, CALL_OPTIONS, TUser, TSession>): AgentInvokerOptions<TRuntimeConfig, CALL_OPTIONS>;
|
package/dist/agent.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
4
|
-
import {
|
|
1
|
+
import { n as invalidAuthenticationErrorOptions, r as throwAuthenticationProviderError } from "./set-cookie-DkqM1kvj.js";
|
|
2
|
+
import { a as getAuthenticationSession, r as authenticationRefusalError, t as prepareSessionCookies } from "./session-cookies-1FMcMnRh.js";
|
|
3
|
+
import { t as authErrorDiagnostics } from "./error-diagnostics-BssJr_2t.js";
|
|
4
|
+
import { t as isRecord } from "./object-CAK6UYR5.js";
|
|
5
5
|
import { ViteHubError } from "@vite-hub/runtime";
|
|
6
|
-
|
|
6
|
+
// src/agent.ts
|
|
7
7
|
let server;
|
|
8
8
|
const loadServer = () => server ??= import("./internal/server.js").catch((error) => {
|
|
9
9
|
server = void 0;
|
|
@@ -108,5 +108,4 @@ function normalizeMeta(value) {
|
|
|
108
108
|
function readString(value) {
|
|
109
109
|
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
110
110
|
}
|
|
111
|
-
//#endregion
|
|
112
111
|
export { agentAuth, authenticated };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/application-path.ts
|
|
2
2
|
/**
|
|
3
3
|
* Prefix an application path with a base URL, such as Nitro `baseURL`. A path that already starts with the base path is
|
|
4
4
|
* returned unchanged, so a caller such as Console Auth that mounts its own paths below the base path is not prefixed
|
|
@@ -58,5 +58,4 @@ function resolveAccessRoutePath(route, baseURL = authApplicationBaseURL()) {
|
|
|
58
58
|
recursive
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
-
//#endregion
|
|
62
61
|
export { resolveAuthMountPath as i, canonicalAccessPath as n, resolveAccessRoutePath as r, accessRouteSyntaxError as t };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { i as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { n as viteHubPageToolsResetCookie, r as viteHubSessionMarkerCookie } from "./page-tools-shared-
|
|
1
|
+
import { t as isRecord } from "./object-CAK6UYR5.js";
|
|
2
|
+
import { i as resolveAuthMountPath } from "./application-path-zKi7NrvK.js";
|
|
3
|
+
import { a as readMembers, c as createAccessPolicyPlugin, d as createAdminClaimPlugin, f as readAdminClaim, g as readAdmins, h as createAdminsPlugin, n as createMembersGate, o as withMemberScopes, t as assertMembersSessionStore } from "./members-D3_Q5XJb.js";
|
|
4
|
+
import { o as authMemoryDatabaseError, r as authDatabaseName, t as assertAuthDatabaseIdStrategy } from "./database-options-DQ-8qYMl.js";
|
|
5
|
+
import { t as assertAuthDatabaseNames } from "./database-schema-options-CkSeU9V3.js";
|
|
6
|
+
import { t as authErrorDiagnostics } from "./error-diagnostics-BssJr_2t.js";
|
|
7
|
+
import { a as createDeleteAccount, c as applyAuthPreset, i as validateAuthComponents, o as validateDeleteAccount, r as validateAuthAccessPolicy, s as validateAuthEvents, t as assertNoRuntimeOption } from "./definition-MDGMNKrK.js";
|
|
8
|
+
import { n as authRequestEvent, t as authCloudflareEnv } from "./request-Dpq7GO8B.js";
|
|
9
|
+
import { i as parseAuthEventWindow, r as parseAuthEventList } from "./events-DZqMiae_.js";
|
|
10
|
+
import { i as resetAuth, n as getAuthRuntimeState, r as isAuthProcessMemoryDatabase, t as authProcessMemoryDatabase } from "./runtime-state-DtKUfxKq.js";
|
|
11
|
+
import { a as normalizeAuthBasePath } from "./access-pages-BwImVHN_.js";
|
|
12
|
+
import { r as throwAuthenticationProviderError, t as readSetCookies } from "./set-cookie-DkqM1kvj.js";
|
|
13
|
+
import { n as viteHubPageToolsResetCookie, r as viteHubSessionMarkerCookie } from "./page-tools-shared-CtoKaNQZ.js";
|
|
14
14
|
import { resolvePublicUrl } from "@vite-hub/runtime";
|
|
15
15
|
import { getStandardContext } from "@vite-hub/runtime/internal/h3";
|
|
16
16
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
@@ -23,7 +23,7 @@ import definitionForApp, { getAuthApp } from "#vitehub/auth/definition";
|
|
|
23
23
|
import { getViteHubTestMode } from "@vite-hub/runtime/internal/test-mode";
|
|
24
24
|
import { isWebContainer } from "@vite-hub/web-container/env";
|
|
25
25
|
import { hkdfSync } from "node:crypto";
|
|
26
|
-
|
|
26
|
+
// ../internal/src/runtime/request-origin.ts
|
|
27
27
|
function firstHeaderValue(headers, name) {
|
|
28
28
|
return headers.get(name)?.split(",", 1)[0]?.trim() || void 0;
|
|
29
29
|
}
|
|
@@ -44,8 +44,7 @@ function forwardedRequestOrigin(request) {
|
|
|
44
44
|
return url.origin;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
//#region src/password.ts
|
|
47
|
+
// src/password.ts
|
|
49
48
|
const scryptOptions = {
|
|
50
49
|
N: 16384,
|
|
51
50
|
r: 16,
|
|
@@ -106,8 +105,7 @@ function readViteHubSecret(env) {
|
|
|
106
105
|
return typeof value === "string" && value ? value : void 0;
|
|
107
106
|
}
|
|
108
107
|
Object.freeze({ prefix: "sha256=" });
|
|
109
|
-
|
|
110
|
-
//#region src/secret.ts
|
|
108
|
+
// src/secret.ts
|
|
111
109
|
/** The `deriveSecret()` purpose of the Better Auth secret. `vitehub secret derive vitehub:auth` prints it. */
|
|
112
110
|
const authSecretPurpose = "vitehub:auth";
|
|
113
111
|
const betterAuthSecretNames = [
|
|
@@ -139,8 +137,7 @@ function deriveAuthSecret(event) {
|
|
|
139
137
|
};
|
|
140
138
|
return derived.secret;
|
|
141
139
|
}
|
|
142
|
-
|
|
143
|
-
//#region ../internal/src/runtime/request-log.ts
|
|
140
|
+
// ../internal/src/runtime/request-log.ts
|
|
144
141
|
function isRequestLog(value) {
|
|
145
142
|
return value !== null && typeof value === "object" && typeof Reflect.get(value, "set") === "function" && typeof Reflect.get(value, "warn") === "function" && typeof Reflect.get(value, "error") === "function";
|
|
146
143
|
}
|
|
@@ -156,8 +153,7 @@ function requestLog(input) {
|
|
|
156
153
|
const log = contextLog(input !== null && typeof input === "object" ? Reflect.get(input, "req") : void 0) ?? contextLog(input);
|
|
157
154
|
return isRequestLog(log) ? log : void 0;
|
|
158
155
|
}
|
|
159
|
-
|
|
160
|
-
//#region src/request-log.ts
|
|
156
|
+
// src/request-log.ts
|
|
161
157
|
const authHandlerEvent = new AsyncLocalStorage();
|
|
162
158
|
const recorded = /* @__PURE__ */ new WeakSet();
|
|
163
159
|
/** Run a Better Auth handler with the request event that endpoints, hooks, and the logger get. */
|
|
@@ -184,15 +180,12 @@ function setAuthOutcome(request, outcome) {
|
|
|
184
180
|
}
|
|
185
181
|
/**
|
|
186
182
|
* Sets `auth` from a Better Auth response when no endpoint set it, such as a refusal of Better Auth's rate limit or
|
|
187
|
-
* origin check. The code comes from Better Auth's
|
|
183
|
+
* origin check. The code comes from the JSON error body: Better Auth's `code`, else an OAuth `error` such as `invalid_grant`.
|
|
188
184
|
*/
|
|
189
185
|
async function setAuthResponseOutcome(request, response) {
|
|
190
186
|
if (response.status < 400 || recorded.has(request) || !requestLog(request)) return;
|
|
191
187
|
let code;
|
|
192
|
-
if (response.headers.get("content-type")?.includes("json"))
|
|
193
|
-
const body = await response.clone().json().catch(() => void 0);
|
|
194
|
-
code = errorCode(body !== null && typeof body === "object" ? Reflect.get(body, "code") : void 0);
|
|
195
|
-
}
|
|
188
|
+
if (response.headers.get("content-type")?.includes("json")) code = bodyCode(await response.clone().json().catch(() => void 0));
|
|
196
189
|
setAuthOutcome(request, {
|
|
197
190
|
outcome: "failure",
|
|
198
191
|
status: response.status,
|
|
@@ -202,6 +195,10 @@ async function setAuthResponseOutcome(request, response) {
|
|
|
202
195
|
function errorCode(value) {
|
|
203
196
|
return typeof value === "string" && /^[\w.-]{1,100}$/.test(value) ? value : void 0;
|
|
204
197
|
}
|
|
198
|
+
function bodyCode(body) {
|
|
199
|
+
if (body === null || typeof body !== "object") return void 0;
|
|
200
|
+
return errorCode(Reflect.get(body, "code")) ?? errorCode(Reflect.get(body, "error"));
|
|
201
|
+
}
|
|
205
202
|
const signInPath = /^\/(?:sign-in|sign-up|callback|oauth2\/callback|magic-link\/verify|passkey\/verify-authentication|siwe\/verify|two-factor\/verify-|email-otp\/verify-email)/;
|
|
206
203
|
function provider(ctx) {
|
|
207
204
|
const path = ctx.path ?? "";
|
|
@@ -236,7 +233,7 @@ async function endpointOutcome(ctx, createdUserId) {
|
|
|
236
233
|
const returned = Reflect.get(ctx.context, "returned");
|
|
237
234
|
const redirect = isAPIError(returned) && returned.status === "FOUND";
|
|
238
235
|
if (isAPIError(returned) && !redirect) {
|
|
239
|
-
const code =
|
|
236
|
+
const code = bodyCode(returned.body);
|
|
240
237
|
return {
|
|
241
238
|
...fields,
|
|
242
239
|
outcome: "failure",
|
|
@@ -310,8 +307,7 @@ function withRequestLogger(logger) {
|
|
|
310
307
|
}
|
|
311
308
|
};
|
|
312
309
|
}
|
|
313
|
-
|
|
314
|
-
//#region src/event-plugin.ts
|
|
310
|
+
// src/event-plugin.ts
|
|
315
311
|
function record(value) {
|
|
316
312
|
return value !== null && typeof value === "object" ? value : {};
|
|
317
313
|
}
|
|
@@ -609,8 +605,7 @@ function createAuthEventsPlugin(options) {
|
|
|
609
605
|
}) } : {}
|
|
610
606
|
};
|
|
611
607
|
}
|
|
612
|
-
|
|
613
|
-
//#region src/impersonation-plugin.ts
|
|
608
|
+
// src/impersonation-plugin.ts
|
|
614
609
|
/**
|
|
615
610
|
* Better Auth endpoints that create a credential which outlives an impersonation session, change how the user signs
|
|
616
611
|
* in, or start another impersonation: OAuth, MCP, and device grants, API keys, passkeys, passwords, email and phone
|
|
@@ -711,8 +706,7 @@ function createImpersonationPlugin() {
|
|
|
711
706
|
}] }
|
|
712
707
|
};
|
|
713
708
|
}
|
|
714
|
-
|
|
715
|
-
//#region src/client-address.ts
|
|
709
|
+
// src/client-address.ts
|
|
716
710
|
/**
|
|
717
711
|
* Better Auth reads the client IP for its rate limiter and for `session.ipAddress` only from request headers. Auth puts
|
|
718
712
|
* the address that the host reports in this header and removes any value that a client sends, at every entry of the
|
|
@@ -800,8 +794,7 @@ function withClientAddress(auth) {
|
|
|
800
794
|
fetch: addressedHandler
|
|
801
795
|
});
|
|
802
796
|
}
|
|
803
|
-
|
|
804
|
-
//#region src/session-refresh.ts
|
|
797
|
+
// src/session-refresh.ts
|
|
805
798
|
/**
|
|
806
799
|
* Runs `session.onRefresh` from the Better Auth `session.update.before` database hook.
|
|
807
800
|
* Better Auth calls `updateSession(token, { expiresAt, updatedAt })` when a stored session
|
|
@@ -835,8 +828,7 @@ function createSessionRefreshPlugin(onRefresh) {
|
|
|
835
828
|
} } } } } })
|
|
836
829
|
};
|
|
837
830
|
}
|
|
838
|
-
|
|
839
|
-
//#region src/options-key.ts
|
|
831
|
+
// src/options-key.ts
|
|
840
832
|
const valueIds = /* @__PURE__ */ new WeakMap();
|
|
841
833
|
let nextValueId = 0;
|
|
842
834
|
function identityKey(value) {
|
|
@@ -884,8 +876,7 @@ function optionsKey(value) {
|
|
|
884
876
|
const parts = [];
|
|
885
877
|
return writeKey(value, parts, /* @__PURE__ */ new Set()) ? parts.join("") : void 0;
|
|
886
878
|
}
|
|
887
|
-
|
|
888
|
-
//#region src/site-roles.ts
|
|
879
|
+
// src/site-roles.ts
|
|
889
880
|
/**
|
|
890
881
|
* The `user.role` field of Better Auth's `admin()` plugin, without its endpoints. Site access keeps the roles it gives in
|
|
891
882
|
* this field, and Comments and the Console page tool read them from the session user. Users cannot set it.
|
|
@@ -901,8 +892,7 @@ const siteRolesPlugin = {
|
|
|
901
892
|
input: false
|
|
902
893
|
} } } }
|
|
903
894
|
};
|
|
904
|
-
|
|
905
|
-
//#region src/runtime-options.ts
|
|
895
|
+
// src/runtime-options.ts
|
|
906
896
|
/** `true` or `{ name, dedicated }`: the removed placement form, which is not a Better Auth adapter. */
|
|
907
897
|
function isAuthDatabasePlacement(value) {
|
|
908
898
|
return typeof value === "boolean" || isRecord(value) && Object.keys(value).length > 0 && Object.keys(value).every((key) => key === "dedicated" || key === "name");
|
|
@@ -1177,8 +1167,7 @@ function resolveAuthOptions(definition, input = {}) {
|
|
|
1177
1167
|
requestRuntimeOptions
|
|
1178
1168
|
};
|
|
1179
1169
|
}
|
|
1180
|
-
|
|
1181
|
-
//#region src/session-marker.ts
|
|
1170
|
+
// src/session-marker.ts
|
|
1182
1171
|
/**
|
|
1183
1172
|
* Name of the cookie that tells browser code a session exists. It holds `1`, never a secret, and it is not HttpOnly,
|
|
1184
1173
|
* so a page script can skip a session request for a visitor who never signed in. It does not prove a session:
|
|
@@ -1290,8 +1279,7 @@ function withSessionMarker(auth) {
|
|
|
1290
1279
|
fetch: markedHandler
|
|
1291
1280
|
});
|
|
1292
1281
|
}
|
|
1293
|
-
|
|
1294
|
-
//#region src/auth-instance.ts
|
|
1282
|
+
// src/auth-instance.ts
|
|
1295
1283
|
function hasRequestRuntimeOptions(definition) {
|
|
1296
1284
|
return typeof definition.options === "function" || trustsProxyHeaders(definition.options);
|
|
1297
1285
|
}
|
|
@@ -1373,5 +1361,4 @@ function authForRequest(request, event, definition = resolveDefaultDefinition())
|
|
|
1373
1361
|
env: envResolverFor(definition)
|
|
1374
1362
|
}));
|
|
1375
1363
|
}
|
|
1376
|
-
//#endregion
|
|
1377
1364
|
export { forwardedRequestOrigin as _, getAuthForDefinition as a, withSessionMarker as c, eventClientAddress as d, setRequestClientAddress as f, setAuthResponseOutcome as g, setAuthOutcome as h, findVerifiedAuthUserId as i, resolveAuthOptions as l, runWithAuthEvent as m, createBetterAuthOptions as n, requestProvider as o, withClientAddress as p, envResolverFor as r, resolveDefaultDefinition as s, authForRequest as t, trustsProxyHeaders as u };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import "nostics";
|
|
2
|
-
//#region ../internal/src/host-credentials.d.ts
|
|
3
2
|
interface HostCliRunResult {
|
|
4
3
|
exitCode: number | null;
|
|
5
4
|
stdout: string;
|
|
@@ -11,8 +10,6 @@ type HostCliRun = (command: string, args: readonly string[], options: {
|
|
|
11
10
|
env: NodeJS.ProcessEnv;
|
|
12
11
|
signal?: AbortSignal;
|
|
13
12
|
}) => Promise<HostCliRunResult>;
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region ../internal/src/provision.d.ts
|
|
16
13
|
type ProvisionProvider = "cloudflare" | "vercel";
|
|
17
14
|
interface ProvisionLogger {
|
|
18
15
|
log: (message: string) => void;
|
|
@@ -64,8 +61,6 @@ interface ProvisionStep {
|
|
|
64
61
|
/** Describes the Provision State this step records. Runs without network access, also without credentials. */
|
|
65
62
|
recordedState?: (context: Pick<ProvisionContext, "env">) => ProvisionStateCategory[];
|
|
66
63
|
}
|
|
67
|
-
//#endregion
|
|
68
|
-
//#region ../internal/src/cli.d.ts
|
|
69
64
|
interface ViteHubCliStreams {
|
|
70
65
|
stderr: {
|
|
71
66
|
write: (chunk: string | Uint8Array, encoding?: BufferEncoding | StdoutWriteCallback, callback?: StdoutWriteCallback) => unknown;
|
|
@@ -160,5 +155,4 @@ interface ViteHubCliPluginMetadata {
|
|
|
160
155
|
cli?: ViteHubCliContributor | ViteHubCliContributorFactory;
|
|
161
156
|
}
|
|
162
157
|
type StdoutWriteCallback = (error?: Error | null) => void;
|
|
163
|
-
//#endregion
|
|
164
158
|
export { ViteHubCliPluginMetadata as n, ViteHubCliContributor as t };
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { t as ViteHubCliContributor } from "./cli-
|
|
2
|
-
//#region src/cli.d.ts
|
|
1
|
+
import { t as ViteHubCliContributor } from "./cli-C5pAfY4x.js";
|
|
3
2
|
/** Read the app-owned, session-protected endpoint. No local or remote database credentials are needed. */
|
|
4
3
|
export declare function createAuthCliContributor(options?: {
|
|
5
4
|
fetch?: typeof fetch;
|
|
6
|
-
}): ViteHubCliContributor;
|
|
7
|
-
//#endregion
|
|
5
|
+
}): ViteHubCliContributor;
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { n as adminClaimVariable, r as createAdminClaimCode, t as adminClaimHash } from "./admin-claim-code-C3X_U43x.js";
|
|
2
|
+
import { t as authErrorDiagnostics } from "./error-diagnostics-BssJr_2t.js";
|
|
3
|
+
// src/cli.ts
|
|
4
4
|
const usage = "vitehub auth events --url <auth-base-url> [--type <type>] [--user <id>] [--actor <actor>] [--from <ISO>] [--to <ISO>] [--cursor <cursor>] [--limit <1-200>] [--aggregate]";
|
|
5
5
|
/** Read the app-owned, session-protected endpoint. No local or remote database credentials are needed. */
|
|
6
6
|
function createAuthCliContributor(options = {}) {
|
|
@@ -104,5 +104,4 @@ function createAuthCliContributor(options = {}) {
|
|
|
104
104
|
}]
|
|
105
105
|
}] };
|
|
106
106
|
}
|
|
107
|
-
//#endregion
|
|
108
107
|
export { createAuthCliContributor };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { J as AuthConsoleAgent, K as AuthConsoleActivity, Lt as AuthEventStore, Z as AuthConsoleDescription, at as AuthConsoleHostSession, bt as AuthConsoleUser, ct as AuthConsoleList, dt as AuthConsoleOrganization, ft as AuthConsoleOrganizationDetail, gt as AuthConsoleQuery, it as AuthConsoleHostOptions, lt as AuthConsoleMutation, ot as AuthConsoleHostUserInput, pt as AuthConsoleOverview, q as AuthConsoleActivityQuery, tt as AuthConsoleField, ut as AuthConsoleOptions, vt as AuthConsoleSession, xt as AuthConsoleUserDetail, yt as AuthConsoleSessionUser } from "./types-
|
|
1
|
+
import { J as AuthConsoleAgent, K as AuthConsoleActivity, Lt as AuthEventStore, Z as AuthConsoleDescription, at as AuthConsoleHostSession, bt as AuthConsoleUser, ct as AuthConsoleList, dt as AuthConsoleOrganization, ft as AuthConsoleOrganizationDetail, gt as AuthConsoleQuery, it as AuthConsoleHostOptions, lt as AuthConsoleMutation, ot as AuthConsoleHostUserInput, pt as AuthConsoleOverview, q as AuthConsoleActivityQuery, tt as AuthConsoleField, ut as AuthConsoleOptions, vt as AuthConsoleSession, xt as AuthConsoleUserDetail, yt as AuthConsoleSessionUser } from "./types-BHSgxyvV.js";
|
|
2
2
|
import { Result } from "@vite-hub/runtime";
|
|
3
3
|
import { AuthContext, BetterAuthOptions, DBAdapter } from "better-auth";
|
|
4
|
-
//#region src/console-runtime.d.ts
|
|
5
4
|
interface AuthConsole {
|
|
6
5
|
describe(request?: Request): Promise<Result<AuthConsoleDescription, AuthConsoleErrorCode>>;
|
|
7
6
|
overview(): Promise<Result<AuthConsoleOverview, AuthConsoleErrorCode>>;
|
|
@@ -69,5 +68,4 @@ declare function createAuthConsole(auth: {
|
|
|
69
68
|
options: BetterAuthOptions;
|
|
70
69
|
} & Partial<Pick<AuthContext, "authCookies" | "internalAdapter" | "secret" | "sessionConfig">>>;
|
|
71
70
|
}, policy?: AuthConsoleOptions, events?: AuthEventStore, host?: AuthConsoleHostOptions): AuthConsole;
|
|
72
|
-
//#endregion
|
|
73
71
|
export { describeAuthConsoleFields as i, AuthConsoleErrorCode as n, createAuthConsole as r, AuthConsole as t };
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { r as parseAuthEventList } from "./events-
|
|
5
|
-
import {
|
|
1
|
+
import { m as adminsVariable, p as adminsPluginId, r as membersVariable, s as accessPolicyPluginId, u as adminClaimPluginId } from "./members-D3_Q5XJb.js";
|
|
2
|
+
import { n as adminClaimVariable } from "./admin-claim-code-C3X_U43x.js";
|
|
3
|
+
import { n as authConsoleEventGroups, t as authConsoleActionNames } from "./console-types-51lkf0lk.js";
|
|
4
|
+
import { r as parseAuthEventList } from "./events-DZqMiae_.js";
|
|
5
|
+
import { r as isAuthProcessMemoryDatabase } from "./runtime-state-DtKUfxKq.js";
|
|
6
6
|
import { defineErrors } from "@vite-hub/runtime";
|
|
7
7
|
import { createAuthEndpoint } from "better-auth/api";
|
|
8
8
|
import { setSessionCookie } from "better-auth/cookies";
|
|
9
9
|
import { getAuthTables } from "better-auth/db";
|
|
10
10
|
import { defineGrant } from "@vite-hub/runtime/internal/grant";
|
|
11
|
-
|
|
11
|
+
// ../internal/src/runtime/user-agent.ts
|
|
12
12
|
/** A short device label of a browser, such as `Chrome · macOS`, for lists of sessions. It never shows the user agent itself. */
|
|
13
13
|
function userAgentDevice(userAgent) {
|
|
14
14
|
return `${/Edg\//.test(userAgent) ? "Edge" : /Firefox\//.test(userAgent) ? "Firefox" : /Chrome\//.test(userAgent) ? "Chrome" : /Safari\//.test(userAgent) ? "Safari" : "Unknown browser"} · ${/iPhone|iPad/.test(userAgent) ? "iOS" : /Android/.test(userAgent) ? "Android" : /Windows/.test(userAgent) ? "Windows" : /Macintosh/.test(userAgent) ? "macOS" : /Linux/.test(userAgent) ? "Linux" : "Unknown device"}`;
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
//#region src/console-runtime.ts
|
|
16
|
+
// src/console-runtime.ts
|
|
18
17
|
const hostGuestProvider = "vitehub-site-guest";
|
|
19
18
|
const string = (value) => typeof value === "string" ? value : "";
|
|
20
19
|
const date = (value) => {
|
|
@@ -1196,5 +1195,4 @@ async function signedSessionToken(secret, token) {
|
|
|
1196
1195
|
function roleList(value) {
|
|
1197
1196
|
return string(value).split(",").map((role) => role.trim()).filter(Boolean);
|
|
1198
1197
|
}
|
|
1199
|
-
//#endregion
|
|
1200
1198
|
export { describeAuthConsoleFields as n, createAuthConsole as t };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as AuthConsoleEventGroup, Ct as authConsoleActionNames, G as AuthConsoleAction, J as AuthConsoleAgent, K as AuthConsoleActivity, Q as AuthConsoleEvent, St as AuthConsoleValue, X as AuthConsoleColumn, Y as AuthConsoleCapability, Z as AuthConsoleDescription, _t as AuthConsoleRoles, at as AuthConsoleHostSession, bt as AuthConsoleUser, ct as AuthConsoleList, dt as AuthConsoleOrganization, et as AuthConsoleEventUser, ft as AuthConsoleOrganizationDetail, gt as AuthConsoleQuery, ht as AuthConsolePolicy, it as AuthConsoleHostOptions, lt as AuthConsoleMutation, mt as AuthConsolePage, nt as AuthConsoleFieldPolicy, ot as AuthConsoleHostUserInput, pt as AuthConsoleOverview, q as AuthConsoleActivityQuery, rt as AuthConsoleFieldType, st as AuthConsoleImpersonation, tt as AuthConsoleField, ut as AuthConsoleOptions, vt as AuthConsoleSession, wt as authConsoleEventGroups, xt as AuthConsoleUserDetail, yt as AuthConsoleSessionUser } from "./types-
|
|
2
|
-
import { i as describeAuthConsoleFields, n as AuthConsoleErrorCode, r as createAuthConsole, t as AuthConsole } from "./console-runtime-
|
|
1
|
+
import { $ as AuthConsoleEventGroup, Ct as authConsoleActionNames, G as AuthConsoleAction, J as AuthConsoleAgent, K as AuthConsoleActivity, Q as AuthConsoleEvent, St as AuthConsoleValue, X as AuthConsoleColumn, Y as AuthConsoleCapability, Z as AuthConsoleDescription, _t as AuthConsoleRoles, at as AuthConsoleHostSession, bt as AuthConsoleUser, ct as AuthConsoleList, dt as AuthConsoleOrganization, et as AuthConsoleEventUser, ft as AuthConsoleOrganizationDetail, gt as AuthConsoleQuery, ht as AuthConsolePolicy, it as AuthConsoleHostOptions, lt as AuthConsoleMutation, mt as AuthConsolePage, nt as AuthConsoleFieldPolicy, ot as AuthConsoleHostUserInput, pt as AuthConsoleOverview, q as AuthConsoleActivityQuery, rt as AuthConsoleFieldType, st as AuthConsoleImpersonation, tt as AuthConsoleField, ut as AuthConsoleOptions, vt as AuthConsoleSession, wt as authConsoleEventGroups, xt as AuthConsoleUserDetail, yt as AuthConsoleSessionUser } from "./types-BHSgxyvV.js";
|
|
2
|
+
import { i as describeAuthConsoleFields, n as AuthConsoleErrorCode, r as createAuthConsole, t as AuthConsole } from "./console-runtime-BP1ZKJB0.js";
|
|
3
3
|
export { AuthConsole, type AuthConsoleAction, type AuthConsoleActivity, type AuthConsoleActivityQuery, type AuthConsoleAgent, type AuthConsoleCapability, type AuthConsoleColumn, type AuthConsoleDescription, AuthConsoleErrorCode, type AuthConsoleEvent, type AuthConsoleEventGroup, type AuthConsoleEventUser, type AuthConsoleField, type AuthConsoleFieldPolicy, type AuthConsoleFieldType, type AuthConsoleHostOptions, type AuthConsoleHostSession, type AuthConsoleHostUserInput, type AuthConsoleImpersonation, type AuthConsoleList, type AuthConsoleMutation, type AuthConsoleOptions, type AuthConsoleOrganization, type AuthConsoleOrganizationDetail, type AuthConsoleOverview, type AuthConsolePage, type AuthConsolePolicy, type AuthConsoleQuery, type AuthConsoleRoles, type AuthConsoleSession, type AuthConsoleSessionUser, type AuthConsoleUser, type AuthConsoleUserDetail, type AuthConsoleValue, type authConsoleActionNames, type authConsoleEventGroups, createAuthConsole, describeAuthConsoleFields };
|
package/dist/console-runtime.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { createAuthConsole, describeAuthConsoleFields };
|
|
1
|
+
export { t as createAuthConsole, n as describeAuthConsoleFields } from "./console-runtime-vc3JQEuq.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/console-types.ts
|
|
2
2
|
const authConsoleEventGroups = {
|
|
3
3
|
"sign-in": [
|
|
4
4
|
"user.signed_up",
|
|
@@ -34,5 +34,4 @@ const authConsoleActionNames = [
|
|
|
34
34
|
"impersonate",
|
|
35
35
|
"revokeConsent"
|
|
36
36
|
];
|
|
37
|
-
//#endregion
|
|
38
37
|
export { authConsoleEventGroups as n, authConsoleActionNames as t };
|
package/dist/console.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { $ as AuthConsoleEventGroup, Ct as authConsoleActionNames, G as AuthConsoleAction, J as AuthConsoleAgent, K as AuthConsoleActivity, Q as AuthConsoleEvent, St as AuthConsoleValue, X as AuthConsoleColumn, Y as AuthConsoleCapability, Z as AuthConsoleDescription, _t as AuthConsoleRoles, at as AuthConsoleHostSession, bt as AuthConsoleUser, ct as AuthConsoleList, dt as AuthConsoleOrganization, et as AuthConsoleEventUser, ft as AuthConsoleOrganizationDetail, gt as AuthConsoleQuery, ht as AuthConsolePolicy, it as AuthConsoleHostOptions, lt as AuthConsoleMutation, mt as AuthConsolePage, nt as AuthConsoleFieldPolicy, ot as AuthConsoleHostUserInput, pt as AuthConsoleOverview, q as AuthConsoleActivityQuery, rt as AuthConsoleFieldType, st as AuthConsoleImpersonation, tt as AuthConsoleField, ut as AuthConsoleOptions, vt as AuthConsoleSession, wt as authConsoleEventGroups, xt as AuthConsoleUserDetail, yt as AuthConsoleSessionUser } from "./types-
|
|
2
|
-
//#region ../internal/src/console.d.ts
|
|
1
|
+
import { $ as AuthConsoleEventGroup, Ct as authConsoleActionNames, G as AuthConsoleAction, J as AuthConsoleAgent, K as AuthConsoleActivity, Q as AuthConsoleEvent, St as AuthConsoleValue, X as AuthConsoleColumn, Y as AuthConsoleCapability, Z as AuthConsoleDescription, _t as AuthConsoleRoles, at as AuthConsoleHostSession, bt as AuthConsoleUser, ct as AuthConsoleList, dt as AuthConsoleOrganization, et as AuthConsoleEventUser, ft as AuthConsoleOrganizationDetail, gt as AuthConsoleQuery, ht as AuthConsolePolicy, it as AuthConsoleHostOptions, lt as AuthConsoleMutation, mt as AuthConsolePage, nt as AuthConsoleFieldPolicy, ot as AuthConsoleHostUserInput, pt as AuthConsoleOverview, q as AuthConsoleActivityQuery, rt as AuthConsoleFieldType, st as AuthConsoleImpersonation, tt as AuthConsoleField, ut as AuthConsoleOptions, vt as AuthConsoleSession, wt as authConsoleEventGroups, xt as AuthConsoleUserDetail, yt as AuthConsoleSessionUser } from "./types-BHSgxyvV.js";
|
|
3
2
|
/** Lists discovered Definitions in a sidebar and shows the selected Definition's fields. */
|
|
4
3
|
interface ViteHubConsoleDefinitionCatalogView {
|
|
5
4
|
kind: "definition-catalog";
|
|
@@ -211,9 +210,6 @@ interface ViteHubConsoleSectionDescriptor<TView extends ViteHubConsoleSectionVie
|
|
|
211
210
|
/** Pages next to the main view, in sidebar order. Only document editor sections render pages today. */
|
|
212
211
|
pages?: readonly ViteHubConsoleSectionPage[];
|
|
213
212
|
}
|
|
214
|
-
//#endregion
|
|
215
|
-
//#region src/console.d.ts
|
|
216
213
|
/** The owner descriptor. The host supplies the navigation and renders the Auth views. */
|
|
217
214
|
export declare const authConsoleSection: ViteHubConsoleAuthSection;
|
|
218
|
-
//#endregion
|
|
219
215
|
export { type AuthConsoleAction, type AuthConsoleActivity, type AuthConsoleActivityQuery, type AuthConsoleAgent, type AuthConsoleCapability, type AuthConsoleColumn, type AuthConsoleDescription, type AuthConsoleEvent, type AuthConsoleEventGroup, type AuthConsoleEventUser, type AuthConsoleField, type AuthConsoleFieldPolicy, type AuthConsoleFieldType, type AuthConsoleHostOptions, type AuthConsoleHostSession, type AuthConsoleHostUserInput, type AuthConsoleImpersonation, type AuthConsoleList, type AuthConsoleMutation, type AuthConsoleOptions, type AuthConsoleOrganization, type AuthConsoleOrganizationDetail, type AuthConsoleOverview, type AuthConsolePage, type AuthConsolePolicy, type AuthConsoleQuery, type AuthConsoleRoles, type AuthConsoleSession, type AuthConsoleSessionUser, type AuthConsoleUser, type AuthConsoleUserDetail, type AuthConsoleValue, type authConsoleActionNames, authConsoleEventGroups };
|
package/dist/console.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as authConsoleEventGroups } from "./console-types-
|
|
2
|
-
|
|
1
|
+
import { n as authConsoleEventGroups } from "./console-types-51lkf0lk.js";
|
|
2
|
+
// src/console.ts
|
|
3
3
|
/** The owner descriptor. The host supplies the navigation and renders the Auth views. */
|
|
4
4
|
const authConsoleSection = {
|
|
5
5
|
id: "auth",
|
|
@@ -11,5 +11,4 @@ const authConsoleSection = {
|
|
|
11
11
|
notice: "Better Auth owns user data and runs each change through its APIs."
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
|
-
//#endregion
|
|
15
14
|
export { authConsoleEventGroups, authConsoleSection };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as authErrorDiagnostics } from "./error-diagnostics-
|
|
2
|
-
|
|
1
|
+
import { t as authErrorDiagnostics } from "./error-diagnostics-BssJr_2t.js";
|
|
2
|
+
// src/database-options.ts
|
|
3
3
|
/** Reads the adapter's target without loading Better Auth or the Database runtime. */
|
|
4
4
|
function authDatabaseName(database) {
|
|
5
5
|
if (typeof database !== "function") return;
|
|
@@ -25,5 +25,4 @@ function authDatabasePlacementError() {
|
|
|
25
25
|
function authMemoryDatabaseError() {
|
|
26
26
|
return authErrorDiagnostics.AUTH_C0063({ message: "`defineAuth()` has no `database` or `preset`. Auth keeps users and sessions in memory only on a development server, because a restart or a second instance loses them." });
|
|
27
27
|
}
|
|
28
|
-
//#endregion
|
|
29
28
|
export { authDatabaseSchemaError as a, authDatabasePlacementError as i, authDatabaseAdditionalFieldsError as n, authMemoryDatabaseError as o, authDatabaseName as r, assertAuthDatabaseIdStrategy as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as authDatabaseSchemaError } from "./database-options-
|
|
1
|
+
import { a as authDatabaseSchemaError } from "./database-options-DQ-8qYMl.js";
|
|
2
2
|
import { getAuthTables } from "better-auth/db";
|
|
3
|
-
|
|
3
|
+
// src/database-schema-options.ts
|
|
4
4
|
/** Better Auth reads each table by its key and each column by its field key, so the options must not rename them. */
|
|
5
5
|
function assertAuthDatabaseNames(options) {
|
|
6
6
|
for (const [model, table] of Object.entries(getAuthTables(options))) {
|
|
@@ -8,5 +8,4 @@ function assertAuthDatabaseNames(options) {
|
|
|
8
8
|
for (const [key, field] of Object.entries(table.fields)) if (field.fieldName && field.fieldName !== key) throw authDatabaseSchemaError(`${model}.${key} cannot map to ${JSON.stringify(field.fieldName)}, because the column keeps the key \`${key}\``);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
//#endregion
|
|
12
11
|
export { assertAuthDatabaseNames as t };
|
package/dist/database.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { f as AuthAppDatabase } from "./types-
|
|
2
|
-
//#region src/database.d.ts
|
|
1
|
+
import { f as AuthAppDatabase } from "./types-BHSgxyvV.js";
|
|
3
2
|
/**
|
|
4
3
|
* The Better Auth `database` adapter for the app Database `name` (default `"default"`). Pass it inline as the
|
|
5
4
|
* `database` of `defineAuth()`. Auth then adds the Better Auth tables, with the fields of `admin()`, the
|
|
@@ -8,5 +7,4 @@ import { f as AuthAppDatabase } from "./types-gl-myjZc.js";
|
|
|
8
7
|
* request: SQLite, libSQL, Cloudflare D1, or Postgres.
|
|
9
8
|
*/
|
|
10
9
|
export declare function authDatabase(name?: string): AuthAppDatabase;
|
|
11
|
-
//#endregion
|
|
12
10
|
export type { AuthAppDatabase };
|