@better-auth/core 1.4.12-beta.2 → 1.4.13
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/.turbo/turbo-build.log +172 -35
- package/dist/api/index.d.mts +178 -1
- package/dist/api/index.mjs +2 -1
- package/dist/context/endpoint-context.d.mts +19 -0
- package/dist/context/endpoint-context.mjs +31 -0
- package/dist/context/global.d.mts +7 -0
- package/dist/context/global.mjs +37 -0
- package/dist/context/index.d.mts +5 -53
- package/dist/context/index.mjs +5 -2
- package/dist/context/request-state.d.mts +27 -0
- package/dist/context/request-state.mjs +49 -0
- package/dist/context/transaction.d.mts +16 -0
- package/dist/context/transaction.mjs +52 -0
- package/dist/db/adapter/factory.d.mts +27 -0
- package/dist/db/adapter/factory.mjs +738 -0
- package/dist/db/adapter/get-default-field-name.d.mts +18 -0
- package/dist/db/adapter/get-default-field-name.mjs +38 -0
- package/dist/db/adapter/get-default-model-name.d.mts +12 -0
- package/dist/db/adapter/get-default-model-name.mjs +32 -0
- package/dist/db/adapter/get-field-attributes.d.mts +29 -0
- package/dist/db/adapter/get-field-attributes.mjs +39 -0
- package/dist/db/adapter/get-field-name.d.mts +18 -0
- package/dist/db/adapter/get-field-name.mjs +33 -0
- package/dist/db/adapter/get-id-field.d.mts +39 -0
- package/dist/db/adapter/get-id-field.mjs +68 -0
- package/dist/db/adapter/get-model-name.d.mts +12 -0
- package/dist/db/adapter/get-model-name.mjs +23 -0
- package/dist/db/adapter/index.d.mts +513 -1
- package/dist/db/adapter/index.mjs +8 -970
- package/dist/db/adapter/types.d.mts +139 -0
- package/dist/db/adapter/utils.d.mts +7 -0
- package/dist/db/adapter/utils.mjs +38 -0
- package/dist/db/get-tables.d.mts +8 -0
- package/dist/{get-tables-CMc_Emww.mjs → db/get-tables.mjs} +1 -1
- package/dist/db/index.d.mts +10 -2
- package/dist/db/index.mjs +7 -60
- package/dist/db/plugin.d.mts +12 -0
- package/dist/db/schema/account.d.mts +26 -0
- package/dist/db/schema/account.mjs +19 -0
- package/dist/db/schema/rate-limit.d.mts +14 -0
- package/dist/db/schema/rate-limit.mjs +11 -0
- package/dist/db/schema/session.d.mts +21 -0
- package/dist/db/schema/session.mjs +14 -0
- package/dist/db/schema/shared.d.mts +10 -0
- package/dist/db/schema/shared.mjs +11 -0
- package/dist/db/schema/user.d.mts +20 -0
- package/dist/db/schema/user.mjs +13 -0
- package/dist/db/schema/verification.d.mts +19 -0
- package/dist/db/schema/verification.mjs +12 -0
- package/dist/db/type.d.mts +143 -0
- package/dist/env/color-depth.d.mts +4 -0
- package/dist/env/color-depth.mjs +88 -0
- package/dist/env/env-impl.d.mts +32 -0
- package/dist/env/env-impl.mjs +82 -0
- package/dist/env/index.d.mts +4 -2
- package/dist/env/index.mjs +3 -1
- package/dist/{index-BRBu0-5h.d.mts → env/logger.d.mts} +1 -35
- package/dist/env/logger.mjs +81 -0
- package/dist/error/codes.d.mts +48 -0
- package/dist/{error-DP1xOn7P.mjs → error/codes.mjs} +3 -14
- package/dist/error/index.d.mts +5 -48
- package/dist/error/index.mjs +12 -3
- package/dist/index.d.mts +8 -2
- package/dist/oauth2/client-credentials-token.d.mts +36 -0
- package/dist/oauth2/client-credentials-token.mjs +54 -0
- package/dist/oauth2/create-authorization-url.d.mts +45 -0
- package/dist/oauth2/create-authorization-url.mjs +42 -0
- package/dist/oauth2/index.d.mts +8 -2
- package/dist/oauth2/index.mjs +6 -2
- package/dist/oauth2/oauth-provider.d.mts +194 -0
- package/dist/oauth2/refresh-access-token.d.mts +36 -0
- package/dist/oauth2/refresh-access-token.mjs +58 -0
- package/dist/oauth2/utils.d.mts +7 -0
- package/dist/oauth2/utils.mjs +27 -0
- package/dist/oauth2/validate-authorization-code.d.mts +55 -0
- package/dist/oauth2/validate-authorization-code.mjs +71 -0
- package/dist/oauth2/verify.d.mts +49 -0
- package/dist/oauth2/verify.mjs +95 -0
- package/dist/social-providers/apple.d.mts +119 -0
- package/dist/social-providers/apple.mjs +102 -0
- package/dist/social-providers/atlassian.d.mts +72 -0
- package/dist/social-providers/atlassian.mjs +83 -0
- package/dist/social-providers/cognito.d.mts +87 -0
- package/dist/social-providers/cognito.mjs +166 -0
- package/dist/social-providers/discord.d.mts +126 -0
- package/dist/social-providers/discord.mjs +64 -0
- package/dist/social-providers/dropbox.d.mts +71 -0
- package/dist/social-providers/dropbox.mjs +75 -0
- package/dist/social-providers/facebook.d.mts +81 -0
- package/dist/social-providers/facebook.mjs +120 -0
- package/dist/social-providers/figma.d.mts +63 -0
- package/dist/social-providers/figma.mjs +84 -0
- package/dist/social-providers/github.d.mts +104 -0
- package/dist/social-providers/github.mjs +80 -0
- package/dist/social-providers/gitlab.d.mts +125 -0
- package/dist/social-providers/gitlab.mjs +82 -0
- package/dist/social-providers/google.d.mts +99 -0
- package/dist/social-providers/google.mjs +109 -0
- package/dist/social-providers/huggingface.d.mts +85 -0
- package/dist/social-providers/huggingface.mjs +75 -0
- package/dist/social-providers/index.d.mts +1723 -1
- package/dist/social-providers/index.mjs +33 -2570
- package/dist/social-providers/kakao.d.mts +163 -0
- package/dist/social-providers/kakao.mjs +72 -0
- package/dist/social-providers/kick.d.mts +75 -0
- package/dist/social-providers/kick.mjs +71 -0
- package/dist/social-providers/line.d.mts +107 -0
- package/dist/social-providers/line.mjs +113 -0
- package/dist/social-providers/linear.d.mts +70 -0
- package/dist/social-providers/linear.mjs +88 -0
- package/dist/social-providers/linkedin.d.mts +69 -0
- package/dist/social-providers/linkedin.mjs +76 -0
- package/dist/social-providers/microsoft-entra-id.d.mts +174 -0
- package/dist/social-providers/microsoft-entra-id.mjs +106 -0
- package/dist/social-providers/naver.d.mts +104 -0
- package/dist/social-providers/naver.mjs +67 -0
- package/dist/social-providers/notion.d.mts +66 -0
- package/dist/social-providers/notion.mjs +75 -0
- package/dist/social-providers/paybin.d.mts +73 -0
- package/dist/social-providers/paybin.mjs +85 -0
- package/dist/social-providers/paypal.d.mts +131 -0
- package/dist/social-providers/paypal.mjs +144 -0
- package/dist/social-providers/polar.d.mts +76 -0
- package/dist/social-providers/polar.mjs +73 -0
- package/dist/social-providers/reddit.d.mts +64 -0
- package/dist/social-providers/reddit.mjs +83 -0
- package/dist/social-providers/roblox.d.mts +72 -0
- package/dist/social-providers/roblox.mjs +59 -0
- package/dist/social-providers/salesforce.d.mts +81 -0
- package/dist/social-providers/salesforce.mjs +91 -0
- package/dist/social-providers/slack.d.mts +85 -0
- package/dist/social-providers/slack.mjs +68 -0
- package/dist/social-providers/spotify.d.mts +65 -0
- package/dist/social-providers/spotify.mjs +71 -0
- package/dist/social-providers/tiktok.d.mts +171 -0
- package/dist/social-providers/tiktok.mjs +62 -0
- package/dist/social-providers/twitch.d.mts +81 -0
- package/dist/social-providers/twitch.mjs +78 -0
- package/dist/social-providers/twitter.d.mts +140 -0
- package/dist/social-providers/twitter.mjs +87 -0
- package/dist/social-providers/vercel.d.mts +64 -0
- package/dist/social-providers/vercel.mjs +61 -0
- package/dist/social-providers/vk.d.mts +72 -0
- package/dist/social-providers/vk.mjs +83 -0
- package/dist/social-providers/zoom.d.mts +173 -0
- package/dist/social-providers/zoom.mjs +72 -0
- package/dist/types/context.d.mts +215 -0
- package/dist/types/cookie.d.mts +15 -0
- package/dist/types/helper.d.mts +8 -0
- package/dist/types/index.d.mts +8 -0
- package/dist/types/init-options.d.mts +1266 -0
- package/dist/types/plugin-client.d.mts +103 -0
- package/dist/types/plugin.d.mts +121 -0
- package/dist/utils/deprecate.d.mts +10 -0
- package/dist/utils/deprecate.mjs +17 -0
- package/dist/utils/error-codes.d.mts +9 -0
- package/dist/utils/error-codes.mjs +7 -0
- package/dist/utils/id.d.mts +4 -0
- package/dist/utils/id.mjs +9 -0
- package/dist/utils/index.d.mts +5 -26
- package/dist/utils/index.mjs +5 -2
- package/dist/utils/json.d.mts +4 -0
- package/dist/utils/json.mjs +25 -0
- package/dist/utils/string.d.mts +4 -0
- package/dist/utils/string.mjs +7 -0
- package/package.json +1 -1
- package/src/context/endpoint-context.ts +7 -15
- package/src/context/global.ts +57 -0
- package/src/context/index.ts +1 -0
- package/src/context/request-state.ts +7 -12
- package/src/context/transaction.ts +7 -16
- package/src/db/adapter/factory.ts +13 -13
- package/src/db/adapter/get-default-model-name.ts +1 -1
- package/src/db/adapter/get-id-field.ts +2 -2
- package/src/error/index.ts +2 -3
- package/src/social-providers/gitlab.ts +1 -1
- package/src/types/context.ts +137 -131
- package/src/types/cookie.ts +6 -4
- package/src/types/index.ts +2 -1
- package/tsdown.config.ts +9 -0
- package/dist/context-BGZ8V6DD.mjs +0 -126
- package/dist/env-DbssmzoK.mjs +0 -245
- package/dist/index-zgYuzZ7O.d.mts +0 -8020
- package/dist/oauth2-COJkghlT.mjs +0 -326
- package/dist/utils-U2L7n92V.mjs +0 -59
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { BetterAuthDBSchema, ModelNames, SecondaryStorage } from "../db/type.mjs";
|
|
2
|
+
import { Account } from "../db/schema/account.mjs";
|
|
3
|
+
import { Session } from "../db/schema/session.mjs";
|
|
4
|
+
import { User } from "../db/schema/user.mjs";
|
|
5
|
+
import { Verification } from "../db/schema/verification.mjs";
|
|
6
|
+
import "../db/index.mjs";
|
|
7
|
+
import { DBAdapter, Where } from "../db/adapter/index.mjs";
|
|
8
|
+
import { createLogger } from "../env/logger.mjs";
|
|
9
|
+
import { OAuthProvider } from "../oauth2/oauth-provider.mjs";
|
|
10
|
+
import "../oauth2/index.mjs";
|
|
11
|
+
import { BetterAuthCookie, BetterAuthCookies } from "./cookie.mjs";
|
|
12
|
+
import { BetterAuthPlugin } from "./plugin.mjs";
|
|
13
|
+
import { BetterAuthOptions, BetterAuthRateLimitOptions } from "./init-options.mjs";
|
|
14
|
+
import { CookieOptions, EndpointContext } from "better-call";
|
|
15
|
+
|
|
16
|
+
//#region src/types/context.d.ts
|
|
17
|
+
type GenericEndpointContext<Options extends BetterAuthOptions = BetterAuthOptions> = EndpointContext<string, any> & {
|
|
18
|
+
context: AuthContext<Options>;
|
|
19
|
+
};
|
|
20
|
+
interface InternalAdapter<_Options extends BetterAuthOptions = BetterAuthOptions> {
|
|
21
|
+
createOAuthUser(user: Omit<User, "id" | "createdAt" | "updatedAt">, account: Omit<Account, "userId" | "id" | "createdAt" | "updatedAt"> & Partial<Account>): Promise<{
|
|
22
|
+
user: User;
|
|
23
|
+
account: Account;
|
|
24
|
+
}>;
|
|
25
|
+
createUser<T extends Record<string, any>>(user: Omit<User, "id" | "createdAt" | "updatedAt" | "emailVerified"> & Partial<User> & Record<string, any>): Promise<T & User>;
|
|
26
|
+
createAccount<T extends Record<string, any>>(account: Omit<Account, "id" | "createdAt" | "updatedAt"> & Partial<Account> & T): Promise<T & Account>;
|
|
27
|
+
listSessions(userId: string): Promise<Session[]>;
|
|
28
|
+
listUsers(limit?: number | undefined, offset?: number | undefined, sortBy?: {
|
|
29
|
+
field: string;
|
|
30
|
+
direction: "asc" | "desc";
|
|
31
|
+
} | undefined, where?: Where[] | undefined): Promise<User[]>;
|
|
32
|
+
countTotalUsers(where?: Where[] | undefined): Promise<number>;
|
|
33
|
+
deleteUser(userId: string): Promise<void>;
|
|
34
|
+
createSession(userId: string, dontRememberMe?: boolean | undefined, override?: (Partial<Session> & Record<string, any>) | undefined, overrideAll?: boolean | undefined): Promise<Session>;
|
|
35
|
+
findSession(token: string): Promise<{
|
|
36
|
+
session: Session & Record<string, any>;
|
|
37
|
+
user: User & Record<string, any>;
|
|
38
|
+
} | null>;
|
|
39
|
+
findSessions(sessionTokens: string[]): Promise<{
|
|
40
|
+
session: Session;
|
|
41
|
+
user: User;
|
|
42
|
+
}[]>;
|
|
43
|
+
updateSession(sessionToken: string, session: Partial<Session> & Record<string, any>): Promise<Session | null>;
|
|
44
|
+
deleteSession(token: string): Promise<void>;
|
|
45
|
+
deleteAccounts(userId: string): Promise<void>;
|
|
46
|
+
deleteAccount(accountId: string): Promise<void>;
|
|
47
|
+
deleteSessions(userIdOrSessionTokens: string | string[]): Promise<void>;
|
|
48
|
+
findOAuthUser(email: string, accountId: string, providerId: string): Promise<{
|
|
49
|
+
user: User;
|
|
50
|
+
accounts: Account[];
|
|
51
|
+
} | null>;
|
|
52
|
+
findUserByEmail(email: string, options?: {
|
|
53
|
+
includeAccounts: boolean;
|
|
54
|
+
} | undefined): Promise<{
|
|
55
|
+
user: User;
|
|
56
|
+
accounts: Account[];
|
|
57
|
+
} | null>;
|
|
58
|
+
findUserById(userId: string): Promise<User | null>;
|
|
59
|
+
linkAccount(account: Omit<Account, "id" | "createdAt" | "updatedAt"> & Partial<Account>): Promise<Account>;
|
|
60
|
+
updateUser<T extends Record<string, any>>(userId: string, data: Partial<User> & Record<string, any>): Promise<User & T>;
|
|
61
|
+
updateUserByEmail<T extends Record<string, any>>(email: string, data: Partial<User & Record<string, any>>): Promise<User & T>;
|
|
62
|
+
updatePassword(userId: string, password: string): Promise<void>;
|
|
63
|
+
findAccounts(userId: string): Promise<Account[]>;
|
|
64
|
+
findAccount(accountId: string): Promise<Account | null>;
|
|
65
|
+
findAccountByProviderId(accountId: string, providerId: string): Promise<Account | null>;
|
|
66
|
+
findAccountByUserId(userId: string): Promise<Account[]>;
|
|
67
|
+
updateAccount(id: string, data: Partial<Account>): Promise<Account>;
|
|
68
|
+
createVerificationValue(data: Omit<Verification, "createdAt" | "id" | "updatedAt"> & Partial<Verification>): Promise<Verification>;
|
|
69
|
+
findVerificationValue(identifier: string): Promise<Verification | null>;
|
|
70
|
+
deleteVerificationValue(id: string): Promise<void>;
|
|
71
|
+
deleteVerificationByIdentifier(identifier: string): Promise<void>;
|
|
72
|
+
updateVerificationValue(id: string, data: Partial<Verification>): Promise<Verification>;
|
|
73
|
+
}
|
|
74
|
+
type CreateCookieGetterFn = (cookieName: string, overrideAttributes?: Partial<CookieOptions> | undefined) => BetterAuthCookie;
|
|
75
|
+
type CheckPasswordFn<Options extends BetterAuthOptions = BetterAuthOptions> = (userId: string, ctx: GenericEndpointContext<Options>) => Promise<boolean>;
|
|
76
|
+
type PluginContext = {
|
|
77
|
+
getPlugin: <Plugin extends BetterAuthPlugin>(pluginId: Plugin["id"]) => Plugin | null;
|
|
78
|
+
};
|
|
79
|
+
type InfoContext = {
|
|
80
|
+
appName: string;
|
|
81
|
+
baseURL: string;
|
|
82
|
+
version: string;
|
|
83
|
+
};
|
|
84
|
+
type AuthContext<Options extends BetterAuthOptions = BetterAuthOptions> = PluginContext & InfoContext & {
|
|
85
|
+
options: Options;
|
|
86
|
+
trustedOrigins: string[];
|
|
87
|
+
/**
|
|
88
|
+
* Verifies whether url is a trusted origin according to the "trustedOrigins" configuration
|
|
89
|
+
* @param url The url to verify against the "trustedOrigins" configuration
|
|
90
|
+
* @param settings Specify supported pattern matching settings
|
|
91
|
+
* @returns {boolean} true if the URL matches the origin pattern, false otherwise.
|
|
92
|
+
*/
|
|
93
|
+
isTrustedOrigin: (url: string, settings?: {
|
|
94
|
+
allowRelativePaths: boolean;
|
|
95
|
+
}) => boolean;
|
|
96
|
+
oauthConfig: {
|
|
97
|
+
/**
|
|
98
|
+
* This is dangerous and should only be used in dev or staging environments.
|
|
99
|
+
*/
|
|
100
|
+
skipStateCookieCheck?: boolean | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* Strategy for storing OAuth state
|
|
103
|
+
*
|
|
104
|
+
* - "cookie": Store state in an encrypted cookie (stateless)
|
|
105
|
+
* - "database": Store state in the database
|
|
106
|
+
*
|
|
107
|
+
* @default "cookie"
|
|
108
|
+
*/
|
|
109
|
+
storeStateStrategy: "database" | "cookie";
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* New session that will be set after the request
|
|
113
|
+
* meaning: there is a `set-cookie` header that will set
|
|
114
|
+
* the session cookie. This is the fetched session. And it's set
|
|
115
|
+
* by `setNewSession` method.
|
|
116
|
+
*/
|
|
117
|
+
newSession: {
|
|
118
|
+
session: Session & Record<string, any>;
|
|
119
|
+
user: User & Record<string, any>;
|
|
120
|
+
} | null;
|
|
121
|
+
session: {
|
|
122
|
+
session: Session & Record<string, any>;
|
|
123
|
+
user: User & Record<string, any>;
|
|
124
|
+
} | null;
|
|
125
|
+
setNewSession: (session: {
|
|
126
|
+
session: Session & Record<string, any>;
|
|
127
|
+
user: User & Record<string, any>;
|
|
128
|
+
} | null) => void;
|
|
129
|
+
socialProviders: OAuthProvider[];
|
|
130
|
+
authCookies: BetterAuthCookies;
|
|
131
|
+
logger: ReturnType<typeof createLogger>;
|
|
132
|
+
rateLimit: {
|
|
133
|
+
enabled: boolean;
|
|
134
|
+
window: number;
|
|
135
|
+
max: number;
|
|
136
|
+
storage: "memory" | "database" | "secondary-storage";
|
|
137
|
+
} & Omit<BetterAuthRateLimitOptions, "enabled" | "window" | "max" | "storage">;
|
|
138
|
+
adapter: DBAdapter<Options>;
|
|
139
|
+
internalAdapter: InternalAdapter<Options>;
|
|
140
|
+
createAuthCookie: CreateCookieGetterFn;
|
|
141
|
+
secret: string;
|
|
142
|
+
sessionConfig: {
|
|
143
|
+
updateAge: number;
|
|
144
|
+
expiresIn: number;
|
|
145
|
+
freshAge: number;
|
|
146
|
+
cookieRefreshCache: false | {
|
|
147
|
+
enabled: true;
|
|
148
|
+
updateAge: number;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
generateId: (options: {
|
|
152
|
+
model: ModelNames;
|
|
153
|
+
size?: number | undefined;
|
|
154
|
+
}) => string | false;
|
|
155
|
+
secondaryStorage: SecondaryStorage | undefined;
|
|
156
|
+
password: {
|
|
157
|
+
hash: (password: string) => Promise<string>;
|
|
158
|
+
verify: (data: {
|
|
159
|
+
password: string;
|
|
160
|
+
hash: string;
|
|
161
|
+
}) => Promise<boolean>;
|
|
162
|
+
config: {
|
|
163
|
+
minPasswordLength: number;
|
|
164
|
+
maxPasswordLength: number;
|
|
165
|
+
};
|
|
166
|
+
checkPassword: CheckPasswordFn<Options>;
|
|
167
|
+
};
|
|
168
|
+
tables: BetterAuthDBSchema;
|
|
169
|
+
runMigrations: () => Promise<void>;
|
|
170
|
+
publishTelemetry: (event: {
|
|
171
|
+
type: string;
|
|
172
|
+
anonymousId?: string | undefined;
|
|
173
|
+
payload: Record<string, any>;
|
|
174
|
+
}) => Promise<void>;
|
|
175
|
+
/**
|
|
176
|
+
* Skip origin check for requests.
|
|
177
|
+
*
|
|
178
|
+
* - `true`: Skip for ALL requests (DANGEROUS - disables CSRF protection)
|
|
179
|
+
* - `string[]`: Skip only for specific paths (e.g., SAML callbacks)
|
|
180
|
+
* - `false`: Enable origin check (default)
|
|
181
|
+
*
|
|
182
|
+
* Paths support prefix matching (e.g., "/sso/saml2/callback" matches
|
|
183
|
+
* "/sso/saml2/callback/provider-name").
|
|
184
|
+
*
|
|
185
|
+
* @default false (true in test environments)
|
|
186
|
+
*/
|
|
187
|
+
skipOriginCheck: boolean | string[];
|
|
188
|
+
/**
|
|
189
|
+
* This skips the CSRF check for all requests.
|
|
190
|
+
*
|
|
191
|
+
* This is inferred from the `options.advanced?.
|
|
192
|
+
* disableCSRFCheck` option.
|
|
193
|
+
*
|
|
194
|
+
* @default false
|
|
195
|
+
*/
|
|
196
|
+
skipCSRFCheck: boolean;
|
|
197
|
+
/**
|
|
198
|
+
* Background task handler for deferred operations.
|
|
199
|
+
*
|
|
200
|
+
* This is inferred from the `options.advanced?.backgroundTasks?.handler` option.
|
|
201
|
+
* Defaults to a no-op that just runs the promise.
|
|
202
|
+
*/
|
|
203
|
+
runInBackground: (promise: Promise<void>) => void;
|
|
204
|
+
/**
|
|
205
|
+
* Runs a task in the background if `runInBackground` is configured,
|
|
206
|
+
* otherwise awaits the task directly.
|
|
207
|
+
*
|
|
208
|
+
* This is useful for operations like sending emails where we want
|
|
209
|
+
* to avoid blocking the response when possible (for timing attack
|
|
210
|
+
* mitigation), but still ensure the operation completes.
|
|
211
|
+
*/
|
|
212
|
+
runInBackgroundOrAwait: (promise: Promise<unknown> | Promise<void> | void | unknown) => Promise<unknown>;
|
|
213
|
+
};
|
|
214
|
+
//#endregion
|
|
215
|
+
export { AuthContext, GenericEndpointContext, InfoContext, InternalAdapter, PluginContext };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CookieOptions } from "better-call";
|
|
2
|
+
|
|
3
|
+
//#region src/types/cookie.d.ts
|
|
4
|
+
type BetterAuthCookie = {
|
|
5
|
+
name: string;
|
|
6
|
+
attributes: CookieOptions;
|
|
7
|
+
};
|
|
8
|
+
type BetterAuthCookies = {
|
|
9
|
+
sessionToken: BetterAuthCookie;
|
|
10
|
+
sessionData: BetterAuthCookie;
|
|
11
|
+
accountData: BetterAuthCookie;
|
|
12
|
+
dontRememberToken: BetterAuthCookie;
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
export { BetterAuthCookie, BetterAuthCookies };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/types/helper.d.ts
|
|
2
|
+
type Primitive = string | number | symbol | bigint | boolean | null | undefined;
|
|
3
|
+
type Awaitable<T> = T | Promise<T>;
|
|
4
|
+
type LiteralString = "" | (string & Record<never, never>);
|
|
5
|
+
type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
|
|
6
|
+
type Prettify<T> = { [K in keyof T]: T[K] } & {};
|
|
7
|
+
//#endregion
|
|
8
|
+
export { Awaitable, LiteralString, LiteralUnion, Prettify, Primitive };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Awaitable, LiteralString, LiteralUnion, Prettify, Primitive } from "./helper.mjs";
|
|
2
|
+
import { BetterAuthCookie, BetterAuthCookies } from "./cookie.mjs";
|
|
3
|
+
import { BetterAuthPlugin, HookEndpointContext } from "./plugin.mjs";
|
|
4
|
+
import { BetterAuthAdvancedOptions, BetterAuthOptions, BetterAuthRateLimitOptions, GenerateIdFn } from "./init-options.mjs";
|
|
5
|
+
import { AuthContext, GenericEndpointContext, InfoContext, InternalAdapter, PluginContext } from "./context.mjs";
|
|
6
|
+
import { BetterAuthClientOptions, BetterAuthClientPlugin, ClientAtomListener, ClientFetchOption, ClientStore } from "./plugin-client.mjs";
|
|
7
|
+
import { StandardSchemaV1 as StandardSchemaV1$1 } from "@standard-schema/spec";
|
|
8
|
+
export { type StandardSchemaV1$1 as StandardSchemaV1 };
|