@vite-hub/auth 0.7.0 → 0.8.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.
- package/README.md +58 -5
- package/dist/{abilities-CfvuGrBv.d.ts → abilities-IOwpkcz4.d.ts} +1 -1
- package/dist/abilities.d.ts +1 -1
- package/dist/{ability-error-OKoyOwPM.js → ability-error-DgR91Jwc.js} +1 -1
- package/dist/{access-pages-Bej95blM.js → access-pages-C69nwa99.js} +1 -1
- package/dist/agent.js +11 -11
- package/dist/{auth-instance-5RSiFTDC.js → auth-instance-WeEK1zDd.js} +39 -17
- package/dist/cli.js +1 -1
- package/dist/client-extension-BgUlm6hy.d.ts +33 -0
- package/dist/client-request-B1DCz3a9.js +29 -0
- package/dist/{console-runtime-XcplYv4R.d.ts → console-runtime-C71weVrt.d.ts} +1 -1
- package/dist/{console-runtime-Bg_PAl7e.js → console-runtime-Dk3j4Jmz.js} +2 -2
- package/dist/console-runtime.d.ts +2 -2
- package/dist/console-runtime.js +1 -1
- package/dist/console.d.ts +1 -1
- package/dist/{database-options-DE9lMwu1.js → database-options-Cms7BI3c.js} +12 -4
- package/dist/{database-schema-options-CCQsNhjc.js → database-schema-options-IlHEeUBK.js} +1 -1
- package/dist/database.d.ts +1 -1
- package/dist/database.js +12 -7
- package/dist/{definition-DeEeqTLC.js → definition-EpeI5LUG.js} +3 -3
- package/dist/{error-diagnostics-DkzL9ltR.js → error-diagnostics-DZHuHXPP.js} +33 -1
- package/dist/{events-BUaoHFoC.js → events-Cm7Iwq47.js} +1 -1
- package/dist/extension-BWmjJhoN.d.ts +59 -0
- package/dist/extension-mCx4TrsO.js +133 -0
- package/dist/forward.js +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.js +4 -3
- package/dist/internal/server.d.ts +3 -3
- package/dist/internal/server.js +5 -5
- package/dist/{mcp-config-C7srUMIZ.js → mcp-config-Bbr8kQxm.js} +9 -1
- package/dist/{mcp-token-DgveSGEl.js → mcp-token-BleQZK6H.js} +28 -5
- package/dist/{mcp-token-DG1jmw4o.d.ts → mcp-token-CxpopXmK.d.ts} +4 -2
- package/dist/mcp.d.ts +2 -2
- package/dist/mcp.js +26 -5
- package/dist/{members-CRlYyxVk.js → members-7OMdqha_.js} +2 -2
- package/dist/nuxt.d.ts +4 -14
- package/dist/nuxt.js +29 -9
- package/dist/{own-access-BvVUjaeL.d.ts → own-access-CGiai2L3.d.ts} +1 -1
- package/dist/presets.js +1 -1
- package/dist/runtime/client-request-plugin.d.ts +2 -1
- package/dist/runtime/client-request-plugin.js +8 -5
- package/dist/runtime/console.d.ts +1 -1
- package/dist/runtime/console.js +2 -2
- package/dist/runtime/empty-abilities.d.ts +1 -1
- package/dist/runtime/empty-client.d.ts +3 -0
- package/dist/runtime/empty-client.js +3 -1
- package/dist/runtime/empty-definition.d.ts +1 -1
- package/dist/runtime/server.d.ts +4 -3
- package/dist/runtime/server.js +3 -2
- package/dist/runtime/vue-nuxt.js +1 -1
- package/dist/schema.d.ts +32 -14
- package/dist/schema.js +21 -14
- package/dist/{server-iQNOXyfS.js → server-5t-HA7I1.js} +41 -316
- package/dist/{server-1G_BbfBD.d.ts → server-DyP1v-sZ.d.ts} +25 -6
- package/dist/{server-B8kTFrHP.d.ts → server-mmp8EfcE.d.ts} +3 -2
- package/dist/server.d.ts +3 -3
- package/dist/server.js +4 -4
- package/dist/{session-cookies-DN0svCKj.js → session-cookies-BNtY3hMp.js} +4 -16
- package/dist/{set-cookie-CMB3t4NF.js → set-cookie-Bva-P-_C.js} +1 -1
- package/dist/{table-specs-C3-bLOSF.js → table-specs-Bm7QJCbu.js} +1 -1
- package/dist/{table-specs-P4LvbOlX.d.ts → table-specs-BxKeFD_y.d.ts} +5 -0
- package/dist/test.d.ts +1 -1
- package/dist/test.js +2 -2
- package/dist/{types-BmRGse4l.d.ts → types-CnO5bHEF.d.ts} +20 -2
- package/dist/{vite-GRzej8Cs.js → vite-7I1bJvqA.js} +641 -240
- package/dist/vite-CZ_Z6IR3.d.ts +28 -0
- package/dist/vite.d.ts +33 -13
- package/dist/vite.js +1 -1
- package/dist/vue.d.ts +4 -3
- package/dist/vue.js +39 -4
- package/package.json +8 -8
- package/dist/client-request-BzMKtfCY.js +0 -52
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { t as createAuthConsole } from "./console-runtime-
|
|
1
|
+
import { t as createAuthConsole } from "./console-runtime-Dk3j4Jmz.js";
|
|
2
2
|
import { t as isRecord } from "./object-CAK6UYR5.js";
|
|
3
3
|
import { i as resolveAuthMountPath, n as canonicalAccessPath } from "./application-path-zKi7NrvK.js";
|
|
4
|
-
import { o as normalizeAuthBasePath } from "./access-pages-
|
|
4
|
+
import { o as normalizeAuthBasePath } from "./access-pages-C69nwa99.js";
|
|
5
5
|
import { t as hasRole } from "./roles-BGi8CyBG.js";
|
|
6
6
|
import { n as authRequestEvent, r as unwrapAuthRequest } from "./request-Dpq7GO8B.js";
|
|
7
|
-
import {
|
|
8
|
-
import { _ as setAuthResponseOutcome, a as getAuthForDefinition, c as withSessionMarker, d as withEndpointRateLimits, f as eventClientAddress, g as setAuthOutcome, h as runWithAuthEvent, l as resolveAuthOptions, m as withClientAddress, n as createBetterAuthOptions, o as requestProvider, p as setRequestClientAddress, r as envResolverFor, s as resolveDefaultDefinition, t as authForRequest, u as trustsProxyHeaders } from "./auth-instance-
|
|
9
|
-
import { a as getAuthenticationSession, i as authenticationRefusalResponse, n as sendSessionCookies, r as authenticationRefusalError, t as prepareSessionCookies } from "./session-cookies-
|
|
7
|
+
import { a as clientRequestOrigin, r as mcpOAuthResources, t as isJwsToken } from "./mcp-config-Bbr8kQxm.js";
|
|
8
|
+
import { _ as setAuthResponseOutcome, a as getAuthForDefinition, c as withSessionMarker, d as withEndpointRateLimits, f as eventClientAddress, g as setAuthOutcome, h as runWithAuthEvent, l as resolveAuthOptions, m as withClientAddress, n as createBetterAuthOptions, o as requestProvider, p as setRequestClientAddress, r as envResolverFor, s as resolveDefaultDefinition, t as authForRequest, u as trustsProxyHeaders } from "./auth-instance-WeEK1zDd.js";
|
|
9
|
+
import { a as getAuthenticationSession, i as authenticationRefusalResponse, n as sendSessionCookies, r as authenticationRefusalError, t as prepareSessionCookies } from "./session-cookies-BNtY3hMp.js";
|
|
10
10
|
import { t as getAuthRuntimeState } from "./runtime-state-C0Rd1W4m.js";
|
|
11
|
-
import { t as readSetCookies } from "./set-cookie-
|
|
11
|
+
import { t as readSetCookies } from "./set-cookie-Bva-P-_C.js";
|
|
12
12
|
import { createAuthAccessRouteMatcher } from "./runtime/server.js";
|
|
13
|
-
import { n as checkAbility, t as AbilityError } from "./ability-error-
|
|
14
|
-
import { i as parseAuthEventWindow, r as parseAuthEventList } from "./events-
|
|
15
|
-
import { t as authErrorDiagnostics } from "./error-diagnostics-
|
|
16
|
-
import { g as findAccessPolicyPlugin, i as notMemberError } from "./members-
|
|
17
|
-
import { n as mcpOAuthResources, t as isJwsToken } from "./mcp-config-C7srUMIZ.js";
|
|
13
|
+
import { n as checkAbility, t as AbilityError } from "./ability-error-DgR91Jwc.js";
|
|
14
|
+
import { i as parseAuthEventWindow, r as parseAuthEventList } from "./events-Cm7Iwq47.js";
|
|
15
|
+
import { t as authErrorDiagnostics } from "./error-diagnostics-DZHuHXPP.js";
|
|
16
|
+
import { g as findAccessPolicyPlugin, i as notMemberError } from "./members-7OMdqha_.js";
|
|
18
17
|
import { defineErrors, toResultError } from "@vite-hub/runtime";
|
|
19
18
|
import { HTTPError } from "nitro/h3";
|
|
19
|
+
import { isRequest } from "@vite-hub/runtime/internal/response";
|
|
20
20
|
import { parseUserOutput } from "better-auth/db";
|
|
21
21
|
import abilities from "#vitehub/auth/abilities";
|
|
22
22
|
import { isRuntimeResponse } from "@vite-hub/runtime/internal/runtime-type";
|
|
@@ -31,169 +31,6 @@ const callerErrors = /*#__PURE__*/ defineErrors({
|
|
|
31
31
|
});
|
|
32
32
|
const signedOutError = () => callerErrors.AUTH_SIGNED_OUT();
|
|
33
33
|
// src/internal/server.ts
|
|
34
|
-
function hasHappyDomRequestState(value) {
|
|
35
|
-
const ownSymbols = Object.getOwnPropertySymbols(value);
|
|
36
|
-
const prototypeSymbols = Object.getOwnPropertySymbols(Object.getPrototypeOf(value) ?? {});
|
|
37
|
-
return [
|
|
38
|
-
"method",
|
|
39
|
-
"body",
|
|
40
|
-
"mode",
|
|
41
|
-
"headers",
|
|
42
|
-
"redirect",
|
|
43
|
-
"referrerPolicy",
|
|
44
|
-
"signal",
|
|
45
|
-
"bodyUsed",
|
|
46
|
-
"credentials",
|
|
47
|
-
"aborted",
|
|
48
|
-
"error",
|
|
49
|
-
"contentLength",
|
|
50
|
-
"contentType",
|
|
51
|
-
"referrer",
|
|
52
|
-
"url",
|
|
53
|
-
"bodyBuffer"
|
|
54
|
-
].every((name) => ownSymbols.some((symbol) => symbol.description === name)) && prototypeSymbols.some((symbol) => symbol.description === "window");
|
|
55
|
-
}
|
|
56
|
-
function isRequestLike$1(value) {
|
|
57
|
-
try {
|
|
58
|
-
const isBrandCheckError = (error) => {
|
|
59
|
-
if (typeof error !== "object" && typeof error !== "function" || error === null) return false;
|
|
60
|
-
try {
|
|
61
|
-
if (Object.prototype.toString.call(error) !== "[object Error]") return false;
|
|
62
|
-
} catch {
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
let name;
|
|
66
|
-
let message;
|
|
67
|
-
try {
|
|
68
|
-
name = Reflect.get(error, "name");
|
|
69
|
-
message = Reflect.get(error, "message");
|
|
70
|
-
} catch {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
return name === "TypeError" && typeof message === "string" && /illegal invocation|invalid (this|receiver)|brand|cannot read properties of (?:null|undefined)|must be (?:an? )?instance/i.test(message);
|
|
74
|
-
};
|
|
75
|
-
if (Object.prototype.toString.call(value) !== "[object Request]") return false;
|
|
76
|
-
const hasPrototypeTag = (target, tag) => {
|
|
77
|
-
let prototype = Object.getPrototypeOf(target);
|
|
78
|
-
while (prototype) {
|
|
79
|
-
const descriptor = Object.getOwnPropertyDescriptor(prototype, Symbol.toStringTag);
|
|
80
|
-
if (descriptor) {
|
|
81
|
-
if (typeof descriptor.get === "function") return descriptor.get.call(target) === tag;
|
|
82
|
-
return "value" in descriptor && descriptor.value === tag;
|
|
83
|
-
}
|
|
84
|
-
prototype = Object.getPrototypeOf(prototype);
|
|
85
|
-
}
|
|
86
|
-
return false;
|
|
87
|
-
};
|
|
88
|
-
const hasBrandedAccessor = (target, property) => {
|
|
89
|
-
let current = Object.getPrototypeOf(target);
|
|
90
|
-
while (current) {
|
|
91
|
-
const descriptor = Object.getOwnPropertyDescriptor(current, property);
|
|
92
|
-
if (descriptor) {
|
|
93
|
-
if (typeof descriptor.get !== "function") return false;
|
|
94
|
-
try {
|
|
95
|
-
descriptor.get.call(Object.create(null));
|
|
96
|
-
if (target !== value) return false;
|
|
97
|
-
return hasHappyDomRequestState(value);
|
|
98
|
-
} catch (error) {
|
|
99
|
-
if (!isBrandCheckError(error)) return false;
|
|
100
|
-
return true;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
current = Object.getPrototypeOf(current);
|
|
104
|
-
}
|
|
105
|
-
return false;
|
|
106
|
-
};
|
|
107
|
-
if (!hasPrototypeTag(value, "Request")) return false;
|
|
108
|
-
const hasMethods = (target, methods) => methods.every((method) => {
|
|
109
|
-
return typeof Reflect.get(target, method) === "function";
|
|
110
|
-
});
|
|
111
|
-
if (hasHappyDomRequestState(value)) {
|
|
112
|
-
if (!hasMethods(value, [
|
|
113
|
-
"clone",
|
|
114
|
-
"arrayBuffer",
|
|
115
|
-
"blob",
|
|
116
|
-
"formData",
|
|
117
|
-
"json",
|
|
118
|
-
"text"
|
|
119
|
-
])) return false;
|
|
120
|
-
if (!value.headers || !hasMethods(value.headers, [
|
|
121
|
-
"get",
|
|
122
|
-
"has",
|
|
123
|
-
"set",
|
|
124
|
-
"append",
|
|
125
|
-
"delete",
|
|
126
|
-
"entries",
|
|
127
|
-
"forEach"
|
|
128
|
-
])) return false;
|
|
129
|
-
if (!value.signal || typeof value.signal.aborted !== "boolean") return false;
|
|
130
|
-
return true;
|
|
131
|
-
}
|
|
132
|
-
if (![
|
|
133
|
-
"body",
|
|
134
|
-
"bodyUsed",
|
|
135
|
-
"headers",
|
|
136
|
-
"method",
|
|
137
|
-
"signal",
|
|
138
|
-
"url"
|
|
139
|
-
].every((property) => hasBrandedAccessor(value, property))) return false;
|
|
140
|
-
if (!hasMethods(value, [
|
|
141
|
-
"clone",
|
|
142
|
-
"arrayBuffer",
|
|
143
|
-
"blob",
|
|
144
|
-
"formData",
|
|
145
|
-
"json",
|
|
146
|
-
"text"
|
|
147
|
-
])) return false;
|
|
148
|
-
if (!value.headers || Object.prototype.toString.call(value.headers) !== "[object Headers]" || !hasPrototypeTag(value.headers, "Headers") || !hasMethods(value.headers, [
|
|
149
|
-
"get",
|
|
150
|
-
"has",
|
|
151
|
-
"set",
|
|
152
|
-
"append",
|
|
153
|
-
"delete",
|
|
154
|
-
"entries",
|
|
155
|
-
"forEach"
|
|
156
|
-
])) return false;
|
|
157
|
-
if ([
|
|
158
|
-
"get",
|
|
159
|
-
"has",
|
|
160
|
-
"set",
|
|
161
|
-
"append",
|
|
162
|
-
"delete",
|
|
163
|
-
"entries",
|
|
164
|
-
"forEach"
|
|
165
|
-
].some((method) => Object.prototype.hasOwnProperty.call(value.headers, method))) return false;
|
|
166
|
-
const headersGet = Reflect.get(value.headers, "get");
|
|
167
|
-
if (typeof headersGet !== "function") return false;
|
|
168
|
-
try {
|
|
169
|
-
headersGet.call(Object.create(null), "");
|
|
170
|
-
return false;
|
|
171
|
-
} catch (error) {
|
|
172
|
-
if (!isBrandCheckError(error)) return false;
|
|
173
|
-
}
|
|
174
|
-
if (!value.signal || Object.prototype.toString.call(value.signal) !== "[object AbortSignal]" || !hasPrototypeTag(value.signal, "AbortSignal") || typeof value.signal.aborted !== "boolean") return false;
|
|
175
|
-
if (Object.prototype.hasOwnProperty.call(value.signal, "aborted")) return false;
|
|
176
|
-
return true;
|
|
177
|
-
} catch {
|
|
178
|
-
return false;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
function isAbortSignalLike(value) {
|
|
182
|
-
if (!value || typeof value !== "object" && typeof value !== "function") return false;
|
|
183
|
-
try {
|
|
184
|
-
let prototype = Object.getPrototypeOf(value);
|
|
185
|
-
const seen = /* @__PURE__ */ new Set();
|
|
186
|
-
while (prototype && !seen.has(prototype)) {
|
|
187
|
-
seen.add(prototype);
|
|
188
|
-
const descriptor = Object.getOwnPropertyDescriptor(prototype, "aborted");
|
|
189
|
-
if (descriptor?.get) return typeof Reflect.apply(descriptor.get, value, []) === "boolean";
|
|
190
|
-
prototype = Object.getPrototypeOf(prototype);
|
|
191
|
-
}
|
|
192
|
-
} catch {
|
|
193
|
-
return false;
|
|
194
|
-
}
|
|
195
|
-
return false;
|
|
196
|
-
}
|
|
197
34
|
/** The provider sign-in of `access`, which returns to `afterSignIn`. A sign-in page has none: the page signs in. */
|
|
198
35
|
function providerSignIn(options) {
|
|
199
36
|
const access = options.access;
|
|
@@ -215,10 +52,10 @@ function headersInit(headers) {
|
|
|
215
52
|
return Array.from(Reflect.apply(entries, value, []));
|
|
216
53
|
}
|
|
217
54
|
function toRequest(request) {
|
|
218
|
-
if (
|
|
55
|
+
if (isRequest(request)) return request;
|
|
219
56
|
const init = { method: request.method };
|
|
220
57
|
init.headers = new Headers(headersInit(request.headers));
|
|
221
|
-
if (
|
|
58
|
+
if (request.signal instanceof AbortSignal) init.signal = request.signal;
|
|
222
59
|
if (request.body) {
|
|
223
60
|
init.body = request.body;
|
|
224
61
|
init.duplex = "half";
|
|
@@ -560,150 +397,13 @@ function sendableRuntimeResponse(value, request) {
|
|
|
560
397
|
return createForbiddenResponse(request);
|
|
561
398
|
}
|
|
562
399
|
}
|
|
563
|
-
const nativePromiseThen = Object.getOwnPropertyDescriptor(Promise.prototype, "then")?.value;
|
|
564
|
-
const nativePromiseResolve = Promise.resolve;
|
|
565
|
-
function hasNativePromiseBrand(value) {
|
|
566
|
-
if (!nativePromiseThen) return false;
|
|
567
|
-
try {
|
|
568
|
-
let prototype = Object.getPrototypeOf(value);
|
|
569
|
-
const seen = /* @__PURE__ */ new Set();
|
|
570
|
-
while (prototype && !seen.has(prototype)) {
|
|
571
|
-
seen.add(prototype);
|
|
572
|
-
if (Object.prototype.hasOwnProperty.call(prototype, "then") && Object.getOwnPropertyDescriptor(prototype, "then")?.value === nativePromiseThen) return true;
|
|
573
|
-
prototype = Object.getPrototypeOf(prototype);
|
|
574
|
-
}
|
|
575
|
-
const valueDescriptor = Object.getOwnPropertyDescriptor(value, "constructor");
|
|
576
|
-
let valueOverridden = false;
|
|
577
|
-
try {
|
|
578
|
-
if (!valueDescriptor || valueDescriptor.configurable) {
|
|
579
|
-
Object.defineProperty(value, "constructor", {
|
|
580
|
-
configurable: true,
|
|
581
|
-
writable: true,
|
|
582
|
-
value: Promise
|
|
583
|
-
});
|
|
584
|
-
valueOverridden = true;
|
|
585
|
-
} else if ("value" in valueDescriptor && valueDescriptor.writable) {
|
|
586
|
-
Object.defineProperty(value, "constructor", { value: Promise });
|
|
587
|
-
valueOverridden = true;
|
|
588
|
-
}
|
|
589
|
-
} catch {}
|
|
590
|
-
let probe;
|
|
591
|
-
try {
|
|
592
|
-
probe = Reflect.apply(nativePromiseThen, value, [() => void 0, () => void 0]);
|
|
593
|
-
} finally {
|
|
594
|
-
if (valueOverridden) {
|
|
595
|
-
if (valueDescriptor) Object.defineProperty(value, "constructor", valueDescriptor);
|
|
596
|
-
else Reflect.deleteProperty(value, "constructor");
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
if (probe && (typeof probe === "object" || typeof probe === "function")) {
|
|
600
|
-
const descriptor = Object.getOwnPropertyDescriptor(probe, "constructor");
|
|
601
|
-
let overridden = false;
|
|
602
|
-
try {
|
|
603
|
-
if (!descriptor || descriptor.configurable) {
|
|
604
|
-
Object.defineProperty(probe, "constructor", {
|
|
605
|
-
configurable: true,
|
|
606
|
-
writable: true,
|
|
607
|
-
value: Promise
|
|
608
|
-
});
|
|
609
|
-
overridden = true;
|
|
610
|
-
} else if ("value" in descriptor && descriptor.writable) {
|
|
611
|
-
Object.defineProperty(probe, "constructor", { value: Promise });
|
|
612
|
-
overridden = true;
|
|
613
|
-
}
|
|
614
|
-
const cleanup = Reflect.apply(nativePromiseThen, probe, [() => void 0, () => void 0]);
|
|
615
|
-
if (cleanup && (typeof cleanup === "object" || typeof cleanup === "function")) {
|
|
616
|
-
const cleanupDescriptor = Object.getOwnPropertyDescriptor(cleanup, "constructor");
|
|
617
|
-
let cleanupOverridden = false;
|
|
618
|
-
try {
|
|
619
|
-
if (!cleanupDescriptor || cleanupDescriptor.configurable) {
|
|
620
|
-
Object.defineProperty(cleanup, "constructor", {
|
|
621
|
-
configurable: true,
|
|
622
|
-
writable: true,
|
|
623
|
-
value: Promise
|
|
624
|
-
});
|
|
625
|
-
cleanupOverridden = true;
|
|
626
|
-
} else if ("value" in cleanupDescriptor && cleanupDescriptor.writable) {
|
|
627
|
-
Object.defineProperty(cleanup, "constructor", { value: Promise });
|
|
628
|
-
cleanupOverridden = true;
|
|
629
|
-
}
|
|
630
|
-
const cleanupResult = Reflect.apply(nativePromiseThen, cleanup, [() => void 0, () => void 0]);
|
|
631
|
-
if (cleanupResult && (typeof cleanupResult === "object" || typeof cleanupResult === "function")) Reflect.apply(nativePromiseThen, cleanupResult, [() => void 0, () => void 0]);
|
|
632
|
-
} finally {
|
|
633
|
-
if (cleanupOverridden) {
|
|
634
|
-
if (cleanupDescriptor) Object.defineProperty(cleanup, "constructor", cleanupDescriptor);
|
|
635
|
-
else Reflect.deleteProperty(cleanup, "constructor");
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
} finally {
|
|
640
|
-
if (overridden) {
|
|
641
|
-
if (descriptor) Object.defineProperty(probe, "constructor", descriptor);
|
|
642
|
-
else Reflect.deleteProperty(probe, "constructor");
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
return true;
|
|
647
|
-
} catch {
|
|
648
|
-
return false;
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
400
|
/**
|
|
652
401
|
* Only `true` grants access. A Response of this runtime is sent as the rejection. Every other value gets `deny()`, `403` by default.
|
|
653
402
|
*/
|
|
654
403
|
async function runAccessAuthorize(authorize, context, deny = () => createForbiddenResponse(context.request)) {
|
|
655
404
|
const result = authorize(context);
|
|
656
405
|
if (isRuntimeResponse(result)) return { response: sendableRuntimeResponse(result, context.request) };
|
|
657
|
-
|
|
658
|
-
if (result !== null && (typeof result === "object" || typeof result === "function") && hasNativePromiseBrand(result)) {
|
|
659
|
-
let nativePromise;
|
|
660
|
-
let constructorDescriptor;
|
|
661
|
-
let speciesDescriptor;
|
|
662
|
-
let speciesOverridden = false;
|
|
663
|
-
let constructorOverridden = false;
|
|
664
|
-
try {
|
|
665
|
-
constructorDescriptor = Object.getOwnPropertyDescriptor(result, "constructor");
|
|
666
|
-
if (!constructorDescriptor || constructorDescriptor.configurable) {
|
|
667
|
-
Object.defineProperty(result, "constructor", {
|
|
668
|
-
configurable: true,
|
|
669
|
-
writable: true,
|
|
670
|
-
value: Promise
|
|
671
|
-
});
|
|
672
|
-
constructorOverridden = true;
|
|
673
|
-
} else if (typeof constructorDescriptor.value === "function") {
|
|
674
|
-
speciesDescriptor = Object.getOwnPropertyDescriptor(constructorDescriptor.value, Symbol.species);
|
|
675
|
-
if (!speciesDescriptor || speciesDescriptor.configurable) {
|
|
676
|
-
Object.defineProperty(constructorDescriptor.value, Symbol.species, {
|
|
677
|
-
configurable: true,
|
|
678
|
-
value: Promise
|
|
679
|
-
});
|
|
680
|
-
speciesOverridden = true;
|
|
681
|
-
} else if ("value" in constructorDescriptor && constructorDescriptor.writable) {
|
|
682
|
-
Object.defineProperty(result, "constructor", { value: Promise });
|
|
683
|
-
constructorOverridden = true;
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
nativePromise = new Promise((resolve, reject) => {
|
|
687
|
-
Promise.prototype.then.call(result, resolve, reject);
|
|
688
|
-
});
|
|
689
|
-
} catch (error) {
|
|
690
|
-
try {
|
|
691
|
-
nativePromise = Reflect.apply(nativePromiseResolve, Promise, [result]);
|
|
692
|
-
} catch {
|
|
693
|
-
nativePromise = Promise.reject(error);
|
|
694
|
-
}
|
|
695
|
-
} finally {
|
|
696
|
-
if (constructorOverridden) {
|
|
697
|
-
if (constructorDescriptor) Object.defineProperty(result, "constructor", constructorDescriptor);
|
|
698
|
-
else Reflect.deleteProperty(result, "constructor");
|
|
699
|
-
}
|
|
700
|
-
if (speciesOverridden && constructorDescriptor && typeof constructorDescriptor.value === "function") {
|
|
701
|
-
if (speciesDescriptor) Object.defineProperty(constructorDescriptor.value, Symbol.species, speciesDescriptor);
|
|
702
|
-
else Reflect.deleteProperty(constructorDescriptor.value, Symbol.species);
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
resolved = nativePromise ? await nativePromise : void 0;
|
|
706
|
-
} else resolved = result !== null && (typeof result === "object" || typeof result === "function") ? await result : result;
|
|
406
|
+
const resolved = await result;
|
|
707
407
|
if (resolved === true) return {};
|
|
708
408
|
if (isRuntimeResponse(resolved)) return { response: sendableRuntimeResponse(resolved, context.request) };
|
|
709
409
|
return { response: deny() };
|
|
@@ -846,6 +546,31 @@ function requireAuthorization(event, authorize, definition) {
|
|
|
846
546
|
if (authorize !== true && typeof authorize !== "function") throw authErrorDiagnostics.AUTH_R0014({ message: "[vitehub] `authorize` must be true or a function." });
|
|
847
547
|
return requireCheck(event, checkAuthorizeRequest(event, authorize, definition ?? resolveDefaultDefinition()));
|
|
848
548
|
}
|
|
549
|
+
/**
|
|
550
|
+
* Route middleware that checks access before H3 applies `validate.query` and `validate.headers`.
|
|
551
|
+
* Put it in `middleware` of `defineHandler()` or `defineValidatedHandler()`.
|
|
552
|
+
* It returns nothing when the check passes, so the route answers with its handler.
|
|
553
|
+
* Without `authorize`, it rejects like `requireAuth()`. With `authorize`, it rejects like `requireAuthorization()`.
|
|
554
|
+
* For path parameters, call H3's `getValidatedRouterParams(event, schema)` in the handler after checking access.
|
|
555
|
+
*
|
|
556
|
+
* ```ts [server/api/inbox.get.ts]
|
|
557
|
+
* export default defineValidatedHandler({
|
|
558
|
+
* middleware: [authMiddleware()],
|
|
559
|
+
* validate: { query: v.object({ view: v.picklist(["open", "archived"]) }) },
|
|
560
|
+
* handler: async (event) => {
|
|
561
|
+
* const { user } = await requireAuth(event)
|
|
562
|
+
* return listInbox(user.id, event.url.searchParams.get("view"))
|
|
563
|
+
* },
|
|
564
|
+
* })
|
|
565
|
+
* ```
|
|
566
|
+
*/
|
|
567
|
+
function authMiddleware(authorize) {
|
|
568
|
+
if (authorize !== void 0 && authorize !== true && typeof authorize !== "function") throw authErrorDiagnostics.AUTH_R0014({ message: "[vitehub] `authorize` must be true or a function." });
|
|
569
|
+
return async (event) => {
|
|
570
|
+
if (authorize === void 0) await requireAuth(event);
|
|
571
|
+
else await requireAuthorization(event, authorize);
|
|
572
|
+
};
|
|
573
|
+
}
|
|
849
574
|
const callerReads = /* @__PURE__ */ new WeakMap();
|
|
850
575
|
function requireCaller(event, definition = resolveDefaultDefinition()) {
|
|
851
576
|
const request = unwrapAuthRequest(event);
|
|
@@ -866,7 +591,7 @@ async function readCaller(event, definition) {
|
|
|
866
591
|
const auth = authForRequest(request, authRequestEvent(event), definition);
|
|
867
592
|
const { options } = await auth.$context;
|
|
868
593
|
if (isJwsToken(token) && mcpOAuthResources(options.plugins).length) {
|
|
869
|
-
const { verifyAppAccessToken } = await import("./mcp-token-
|
|
594
|
+
const { verifyAppAccessToken } = await import("./mcp-token-BleQZK6H.js").then((n) => n.a);
|
|
870
595
|
const url = new URL(request.url);
|
|
871
596
|
const [error, caller] = await verifyAppAccessToken(token, clientRequestOrigin(request, trustsProxyHeaders(options)), url, auth);
|
|
872
597
|
if (error) return [error, void 0];
|
|
@@ -1023,4 +748,4 @@ function getAuthConsoleForRequest(request, event, host) {
|
|
|
1023
748
|
});
|
|
1024
749
|
return createAuthConsole(requestProvider(definition, resolved), resolved.options.console, resolved.options.events ? resolved.options.events.store : void 0, host);
|
|
1025
750
|
}
|
|
1026
|
-
export {
|
|
751
|
+
export { signOut as C, withAuth as D, withAnonymousAuthorization as E, withAuthorization as O, requireCaller as S, useAuth as T, listAuthEvents as _, can as a, requireAuthAccessRoutes as b, createAuthAccessHandler as c, createAuthRequestRuntimeOptions as d, getAuth as f, handleAuthRequest as g, handleAuth as h, authRoute as i, createAuthForRequest as l, getAuthEvents as m, assertAuthOrigin as n, checkAuthMember as o, getAuthConsoleForRequest as p, authMiddleware as r, createAuth as s, aggregateAuthEvents as t, createAuthHandler as u, requireAbility as v, toAuthRequest as w, requireAuthorization as x, requireAuth as y };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as AuthConsole } from "./console-runtime-
|
|
2
|
-
import { C as AuthGuardedHandler, E as AuthRequestInput,
|
|
3
|
-
import { i as AbilityName, n as AbilityAuthorization, t as AbilityArgs } from "./abilities-
|
|
4
|
-
import { o as McpTokenInvalidError } from "./mcp-token-
|
|
5
|
-
import "./server-
|
|
1
|
+
import { t as AuthConsole } from "./console-runtime-C71weVrt.js";
|
|
2
|
+
import { Bt as AuthEventWindow, C as AuthGuardedHandler, E as AuthRequestInput, G as ViteHubAuth, H as RegisteredAuth, It as AuthEventPage, Mt as AuthEventAggregates, N as AuthRuntimeOptions, Pt as AuthEventListInput, R as AuthSignInConfiguration, Rt as AuthEventStore, S as AuthFor, T as AuthRequest, U as ResolvedAuthAccessRoute, _ as AuthDefinition, at as AuthConsoleHostOptions, d as AuthAnonymousGuardedHandler, h as AuthBetterAuthRuntimeOptions, p as AuthAuthorization, u as AuthAnonymousAuthorize } from "./types-CnO5bHEF.js";
|
|
3
|
+
import { i as AbilityName, n as AbilityAuthorization, t as AbilityArgs } from "./abilities-IOwpkcz4.js";
|
|
4
|
+
import { o as McpTokenInvalidError } from "./mcp-token-CxpopXmK.js";
|
|
5
|
+
import "./server-mmp8EfcE.js";
|
|
6
6
|
import "./ability-error-C1c30O6E.js";
|
|
7
7
|
import { AccessAuthorizeOption, Result, ResultError, ViteHubContext } from "@vite-hub/runtime";
|
|
8
8
|
import { APIError } from "better-auth/api";
|
|
@@ -144,6 +144,25 @@ declare function requireAuth(event: AuthRequestInput, definition: AuthDefinition
|
|
|
144
144
|
*/
|
|
145
145
|
declare function requireAuthorization<TInput extends AuthRequestInput>(event: TInput, authorize: AccessAuthorizeOption<TInput & ViteHubContext>, definition?: undefined): Promise<AuthAuthorization>;
|
|
146
146
|
declare function requireAuthorization<TInput extends AuthRequestInput>(event: TInput, authorize: AccessAuthorizeOption<TInput & ViteHubContext, false>, definition: AuthDefinition | undefined): Promise<CoreAuthorization>;
|
|
147
|
+
/**
|
|
148
|
+
* Route middleware that checks access before H3 applies `validate.query` and `validate.headers`.
|
|
149
|
+
* Put it in `middleware` of `defineHandler()` or `defineValidatedHandler()`.
|
|
150
|
+
* It returns nothing when the check passes, so the route answers with its handler.
|
|
151
|
+
* Without `authorize`, it rejects like `requireAuth()`. With `authorize`, it rejects like `requireAuthorization()`.
|
|
152
|
+
* For path parameters, call H3's `getValidatedRouterParams(event, schema)` in the handler after checking access.
|
|
153
|
+
*
|
|
154
|
+
* ```ts [server/api/inbox.get.ts]
|
|
155
|
+
* export default defineValidatedHandler({
|
|
156
|
+
* middleware: [authMiddleware()],
|
|
157
|
+
* validate: { query: v.object({ view: v.picklist(["open", "archived"]) }) },
|
|
158
|
+
* handler: async (event) => {
|
|
159
|
+
* const { user } = await requireAuth(event)
|
|
160
|
+
* return listInbox(user.id, event.url.searchParams.get("view"))
|
|
161
|
+
* },
|
|
162
|
+
* })
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
declare function authMiddleware<TInput extends AuthRequestInput>(authorize?: AccessAuthorizeOption<TInput & ViteHubContext>): (event: TInput) => Promise<void>;
|
|
147
166
|
/**
|
|
148
167
|
* Return who calls: a person with an Auth Session (`kind: "browser"`), or an Agent with an MCP access token of
|
|
149
168
|
* `mcpOAuth()` (`kind: "agent"`), checked like `verifyMcpRequest()`. The longest matching resource path wins. At that
|
|
@@ -212,4 +231,4 @@ declare function aggregateAuthEvents(window: AuthEventWindow, definition?: AuthD
|
|
|
212
231
|
* `host.impersonation` lets the Console start impersonation. It is off by default.
|
|
213
232
|
*/
|
|
214
233
|
declare function getAuthConsoleForRequest(request: Request, event?: ViteHubContext, host?: AuthConsoleHostOptions): AuthConsole;
|
|
215
|
-
export {
|
|
234
|
+
export { withAuthorization as A, AuthCallerUser as B, requireAuthorization as C, useAuth as D, toAuthRequest as E, getAuthForDefinition as F, AuthCaller as I, AuthCallerError as L, authForRequest as M, createBetterAuthOptions as N, withAnonymousAuthorization as O, findVerifiedAuthUserId as P, AuthCallerErrorCode as R, requireAuthAccessRoutes as S, signOut as T, AuthMemberErrorCode as V, handleAuth as _, authMiddleware as a, requireAbility as b, checkAuthMember as c, createAuthForRequest as d, createAuthHandler as f, getAuthEvents as g, getAuthConsoleForRequest as h, assertAuthOrigin as i, sendSessionCookies as j, withAuth as k, createAuth as l, getAuth as m, AuthSignOutOptions as n, authRoute as o, createAuthRequestRuntimeOptions as p, aggregateAuthEvents as r, can as s, AuthEventReadErrorCode as t, createAuthAccessHandler as u, handleAuthRequest as v, requireCaller as w, requireAuth as x, listAuthEvents as y, AuthCallerResult as z };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import
|
|
1
|
+
import "./extension-BWmjJhoN.js";
|
|
2
|
+
import "./own-access-CGiai2L3.js";
|
|
3
|
+
import { E as AuthRequestInput, U as ResolvedAuthAccessRoute, _ as AuthDefinition } from "./types-CnO5bHEF.js";
|
|
3
4
|
import { AccessAuthorizationContext, ViteHubContext } from "@vite-hub/runtime";
|
|
4
5
|
type AuthRuntimeEnvResolver = (event?: ViteHubContext) => Record<string, unknown>;
|
|
5
6
|
type AuthAccessIdentityResolver = (request: Request, event: AuthRequestInput, hasSession: boolean) => Promise<AccessAuthorizationContext<unknown, false>["user"] | Response | undefined>;
|
package/dist/server.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference path="./host-declarations.d.ts" />
|
|
2
|
-
import {
|
|
3
|
-
import { a as McpTokenInvalidData, o as McpTokenInvalidError, s as McpTokenInvalidReason } from "./mcp-token-
|
|
2
|
+
import { A as withAuthorization, B as AuthCallerUser, C as requireAuthorization, D as useAuth, I as AuthCaller, L as AuthCallerError, O as withAnonymousAuthorization, R as AuthCallerErrorCode, T as signOut, V as AuthMemberErrorCode, _ as handleAuth, a as authMiddleware, b as requireAbility, c as checkAuthMember, f as createAuthHandler, g as getAuthEvents, h as getAuthConsoleForRequest, k as withAuth, o as authRoute, r as aggregateAuthEvents, s as can, t as AuthEventReadErrorCode, w as requireCaller, x as requireAuth, y as listAuthEvents, z as AuthCallerResult } from "./server-DyP1v-sZ.js";
|
|
3
|
+
import { a as McpTokenInvalidData, o as McpTokenInvalidError, s as McpTokenInvalidReason } from "./mcp-token-CxpopXmK.js";
|
|
4
4
|
import { n as AbilityErrorData, t as AbilityError } from "./ability-error-C1c30O6E.js";
|
|
5
5
|
import { AuthContext } from "better-auth";
|
|
6
6
|
/** Whether the resolved Auth context applies `VITEHUB_MEMBERS`. */
|
|
7
7
|
export declare function hasAuthMembers(context: Pick<AuthContext, "options">): boolean;
|
|
8
|
-
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 };
|
|
8
|
+
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, authMiddleware, 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,9 +1,9 @@
|
|
|
1
|
-
import { g as findAccessPolicyPlugin } from "./members-
|
|
2
|
-
import { t as AbilityError } from "./ability-error-
|
|
3
|
-
import {
|
|
1
|
+
import { g as findAccessPolicyPlugin } from "./members-7OMdqha_.js";
|
|
2
|
+
import { t as AbilityError } from "./ability-error-DgR91Jwc.js";
|
|
3
|
+
import { C as signOut, D as withAuth, E as withAnonymousAuthorization, O as withAuthorization, S as requireCaller, T as useAuth, _ as listAuthEvents, a as can, h as handleAuth, i as authRoute, m as getAuthEvents, o as checkAuthMember, p as getAuthConsoleForRequest, r as authMiddleware, t as aggregateAuthEvents, u as createAuthHandler, v as requireAbility, x as requireAuthorization, y as requireAuth } from "./server-5t-HA7I1.js";
|
|
4
4
|
// src/server.ts
|
|
5
5
|
/** Whether the resolved Auth context applies `VITEHUB_MEMBERS`. */
|
|
6
6
|
function hasAuthMembers(context) {
|
|
7
7
|
return Boolean(findAccessPolicyPlugin(context.options.plugins)?.members);
|
|
8
8
|
}
|
|
9
|
-
export { AbilityError, aggregateAuthEvents, can, checkAuthMember, createAuthHandler, authRoute as default, getAuthConsoleForRequest, getAuthEvents, handleAuth, hasAuthMembers, listAuthEvents, requireAbility, requireAuth, requireAuthorization, requireCaller, signOut, useAuth, withAnonymousAuthorization, withAuth, withAuthorization };
|
|
9
|
+
export { AbilityError, aggregateAuthEvents, authMiddleware, can, checkAuthMember, createAuthHandler, authRoute as default, getAuthConsoleForRequest, getAuthEvents, handleAuth, hasAuthMembers, listAuthEvents, requireAbility, requireAuth, requireAuthorization, requireCaller, signOut, useAuth, withAnonymousAuthorization, withAuth, withAuthorization };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { t as authErrorDiagnostics } from "./error-diagnostics-
|
|
2
|
-
import { r as throwAuthenticationProviderError, t as readSetCookies } from "./set-cookie-
|
|
1
|
+
import { t as authErrorDiagnostics } from "./error-diagnostics-DZHuHXPP.js";
|
|
2
|
+
import { r as throwAuthenticationProviderError, t as readSetCookies } from "./set-cookie-Bva-P-_C.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";
|
|
6
|
+
import { isResponse } from "@vite-hub/runtime/internal/response";
|
|
6
7
|
import { getStandardContext } from "@vite-hub/runtime/internal/h3";
|
|
7
8
|
// src/session.ts
|
|
8
9
|
const apiErrorHeaders = Symbol.for("better-call:api-error-headers");
|
|
@@ -192,7 +193,7 @@ function sendSessionCookies(input, outcome) {
|
|
|
192
193
|
const standard = getStandardContext(authRequestEvent(input));
|
|
193
194
|
const prepared = preparedSessionCookies.get(standard);
|
|
194
195
|
if (!prepared) return outcome;
|
|
195
|
-
const response =
|
|
196
|
+
const response = isResponse(outcome) ? outcome : void 0;
|
|
196
197
|
const headers = standard.res.headers;
|
|
197
198
|
if (standard.vendor === "fetch") {
|
|
198
199
|
if (!response) return outcome;
|
|
@@ -273,17 +274,4 @@ function removeSetCookies(headers, values) {
|
|
|
273
274
|
headers.delete("set-cookie");
|
|
274
275
|
for (const cookie of kept) headers.append("set-cookie", cookie);
|
|
275
276
|
}
|
|
276
|
-
/** A Response of this runtime, or of another Fetch implementation, such as `undici`. */
|
|
277
|
-
function isResponseLike(value) {
|
|
278
|
-
if (value instanceof Response) return true;
|
|
279
|
-
if (value === null || typeof value !== "object") return false;
|
|
280
|
-
try {
|
|
281
|
-
if (Object.prototype.toString.call(value) !== "[object Response]") return false;
|
|
282
|
-
const status = Reflect.get(value, "status");
|
|
283
|
-
const headers = Reflect.get(value, "headers");
|
|
284
|
-
return typeof status === "number" && typeof Reflect.get(value, "statusText") === "string" && typeof headers === "object" && headers !== null && typeof Reflect.get(headers, "get") === "function";
|
|
285
|
-
} catch {
|
|
286
|
-
return false;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
277
|
export { getAuthenticationSession as a, authenticationRefusalResponse as i, sendSessionCookies as n, authenticationRefusalError as r, prepareSessionCookies as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as authErrorDiagnostics } from "./error-diagnostics-
|
|
1
|
+
import { t as authErrorDiagnostics } from "./error-diagnostics-DZHuHXPP.js";
|
|
2
2
|
import { ViteHubError, isViteHubError } from "@vite-hub/runtime";
|
|
3
3
|
// src/errors.ts
|
|
4
4
|
function invalidAuthenticationErrorOptions() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as authErrorDiagnostics } from "./error-diagnostics-
|
|
1
|
+
import { t as authErrorDiagnostics } from "./error-diagnostics-DZHuHXPP.js";
|
|
2
2
|
/**
|
|
3
3
|
* The Better Auth core tables, with the tables of the plugins that ViteHub ships: `jwt()` and `oauthProvider()` of
|
|
4
4
|
* `mcpOAuth()`, `organization()`, `passkey()` from `@better-auth/passkey`, and the table of Better Auth's limiter. The
|
|
@@ -1092,6 +1092,11 @@ interface AuthSchemaOptions {
|
|
|
1092
1092
|
plugins?: readonly AuthSchemaPlugin[];
|
|
1093
1093
|
/** The `additionalFields` of each core model, by the key that Better Auth's adapter reads. */
|
|
1094
1094
|
additionalFields?: Partial<Record<AuthCoreModel, Readonly<Record<string, AuthTableField>>>>;
|
|
1095
|
+
/**
|
|
1096
|
+
* `advanced.database.generateId` of the Definition, when it is `"uuid"`. On Postgres, each `id` and each column that
|
|
1097
|
+
* references one is `uuid`, and the database makes the ID. SQLite has no uuid type, so its columns stay text.
|
|
1098
|
+
*/
|
|
1099
|
+
generateId?: "uuid";
|
|
1095
1100
|
}
|
|
1096
1101
|
/**
|
|
1097
1102
|
* The table specs for `options`: `authTableSpecs`, the tables and columns of each plugin, then the additional fields.
|
package/dist/test.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as AuthDefinition } from "./types-
|
|
1
|
+
import { _ as AuthDefinition } from "./types-CnO5bHEF.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-
|
|
2
|
-
import { t as authErrorDiagnostics } from "./error-diagnostics-
|
|
1
|
+
import { s as resolveDefaultDefinition, t as authForRequest } from "./auth-instance-WeEK1zDd.js";
|
|
2
|
+
import { t as authErrorDiagnostics } from "./error-diagnostics-DZHuHXPP.js";
|
|
3
3
|
import { testUtils } from "better-auth/plugins";
|
|
4
4
|
// src/test.ts
|
|
5
5
|
/**
|