@better-auth/core 1.3.26 → 1.3.28
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 +60 -9
- package/build.config.ts +7 -0
- package/dist/db/adapter/index.cjs +2 -0
- package/dist/db/adapter/index.d.cts +14 -0
- package/dist/db/adapter/index.d.mts +14 -0
- package/dist/db/adapter/index.d.ts +14 -0
- package/dist/db/adapter/index.mjs +1 -0
- package/dist/db/index.cjs +89 -0
- package/dist/db/index.d.cts +16 -107
- package/dist/db/index.d.mts +16 -107
- package/dist/db/index.d.ts +16 -107
- package/dist/db/index.mjs +69 -0
- package/dist/env/index.cjs +312 -0
- package/dist/env/index.d.cts +36 -0
- package/dist/env/index.d.mts +36 -0
- package/dist/env/index.d.ts +36 -0
- package/dist/env/index.mjs +297 -0
- package/dist/error/index.cjs +44 -0
- package/dist/error/index.d.cts +33 -0
- package/dist/error/index.d.mts +33 -0
- package/dist/error/index.d.ts +33 -0
- package/dist/error/index.mjs +41 -0
- package/dist/index.d.cts +179 -1
- package/dist/index.d.mts +179 -1
- package/dist/index.d.ts +179 -1
- package/dist/middleware/index.cjs +25 -0
- package/dist/middleware/index.d.cts +14 -0
- package/dist/middleware/index.d.mts +14 -0
- package/dist/middleware/index.d.ts +14 -0
- package/dist/middleware/index.mjs +21 -0
- package/dist/oauth2/index.cjs +368 -0
- package/dist/oauth2/index.d.cts +100 -0
- package/dist/oauth2/index.d.mts +100 -0
- package/dist/oauth2/index.d.ts +100 -0
- package/dist/oauth2/index.mjs +357 -0
- package/dist/shared/core.BJPBStdk.d.ts +1693 -0
- package/dist/shared/core.Bl6TpxyD.d.mts +181 -0
- package/dist/shared/core.Bqe5IGAi.d.ts +13 -0
- package/dist/shared/core.BwoNUcJQ.d.cts +53 -0
- package/dist/shared/core.BwoNUcJQ.d.mts +53 -0
- package/dist/shared/core.BwoNUcJQ.d.ts +53 -0
- package/dist/shared/core.CajxAutx.d.cts +143 -0
- package/dist/shared/core.CajxAutx.d.mts +143 -0
- package/dist/shared/core.CajxAutx.d.ts +143 -0
- package/dist/shared/core.CkkLHQWc.d.mts +1693 -0
- package/dist/shared/core.DkdZ1o38.d.ts +181 -0
- package/dist/shared/core.Dl-70uns.d.cts +84 -0
- package/dist/shared/core.Dl-70uns.d.mts +84 -0
- package/dist/shared/core.Dl-70uns.d.ts +84 -0
- package/dist/shared/core.DyEdx0m7.d.cts +181 -0
- package/dist/shared/core.E9DfzGLz.d.mts +13 -0
- package/dist/shared/core.HqYn20Fi.d.cts +13 -0
- package/dist/shared/core.gYIBmdi1.d.cts +1693 -0
- package/dist/social-providers/index.cjs +2793 -0
- package/dist/social-providers/index.d.cts +3903 -0
- package/dist/social-providers/index.d.mts +3903 -0
- package/dist/social-providers/index.d.ts +3903 -0
- package/dist/social-providers/index.mjs +2743 -0
- package/dist/utils/index.cjs +7 -0
- package/dist/utils/index.d.cts +10 -0
- package/dist/utils/index.d.mts +10 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/index.mjs +5 -0
- package/package.json +109 -2
- package/src/db/adapter/index.ts +448 -0
- package/src/db/index.ts +13 -0
- package/src/db/plugin.ts +11 -0
- package/src/db/schema/account.ts +34 -0
- package/src/db/schema/rate-limit.ts +21 -0
- package/src/db/schema/session.ts +17 -0
- package/src/db/schema/shared.ts +7 -0
- package/src/db/schema/user.ts +16 -0
- package/src/db/schema/verification.ts +15 -0
- package/src/db/type.ts +50 -0
- package/src/env/color-depth.ts +172 -0
- package/src/env/env-impl.ts +123 -0
- package/src/env/index.ts +23 -0
- package/src/env/logger.test.ts +33 -0
- package/src/env/logger.ts +145 -0
- package/src/error/codes.ts +31 -0
- package/src/error/index.ts +11 -0
- package/src/index.ts +1 -1
- package/src/middleware/index.ts +33 -0
- package/src/oauth2/client-credentials-token.ts +102 -0
- package/src/oauth2/create-authorization-url.ts +85 -0
- package/src/oauth2/index.ts +22 -0
- package/src/oauth2/oauth-provider.ts +194 -0
- package/src/oauth2/refresh-access-token.ts +124 -0
- package/src/oauth2/utils.ts +36 -0
- package/src/oauth2/validate-authorization-code.ts +156 -0
- package/src/social-providers/apple.ts +213 -0
- package/src/social-providers/atlassian.ts +130 -0
- package/src/social-providers/cognito.ts +269 -0
- package/src/social-providers/discord.ts +172 -0
- package/src/social-providers/dropbox.ts +112 -0
- package/src/social-providers/facebook.ts +204 -0
- package/src/social-providers/figma.ts +115 -0
- package/src/social-providers/github.ts +154 -0
- package/src/social-providers/gitlab.ts +152 -0
- package/src/social-providers/google.ts +171 -0
- package/src/social-providers/huggingface.ts +116 -0
- package/src/social-providers/index.ts +118 -0
- package/src/social-providers/kakao.ts +178 -0
- package/src/social-providers/kick.ts +95 -0
- package/src/social-providers/line.ts +169 -0
- package/src/social-providers/linear.ts +120 -0
- package/src/social-providers/linkedin.ts +110 -0
- package/src/social-providers/microsoft-entra-id.ts +243 -0
- package/src/social-providers/naver.ts +112 -0
- package/src/social-providers/notion.ts +106 -0
- package/src/social-providers/paypal.ts +261 -0
- package/src/social-providers/reddit.ts +122 -0
- package/src/social-providers/roblox.ts +110 -0
- package/src/social-providers/salesforce.ts +157 -0
- package/src/social-providers/slack.ts +114 -0
- package/src/social-providers/spotify.ts +93 -0
- package/src/social-providers/tiktok.ts +211 -0
- package/src/social-providers/twitch.ts +111 -0
- package/src/social-providers/twitter.ts +194 -0
- package/src/social-providers/vk.ts +128 -0
- package/src/social-providers/zoom.ts +218 -0
- package/src/types/context.ts +313 -0
- package/src/types/cookie.ts +7 -0
- package/src/types/helper.ts +5 -0
- package/src/types/index.ts +20 -1
- package/src/types/init-options.ts +1161 -0
- package/src/types/plugin-client.ts +69 -0
- package/src/types/plugin.ts +134 -0
- package/src/utils/error-codes.ts +51 -0
- package/src/utils/index.ts +1 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,180 @@
|
|
|
1
|
+
import { L as LiteralString } from './shared/core.CajxAutx.mjs';
|
|
2
|
+
export { a as LiteralUnion } from './shared/core.CajxAutx.mjs';
|
|
3
|
+
import { A as AuthContext, B as BetterAuthOptions, a as AuthMiddleware } from './shared/core.CkkLHQWc.mjs';
|
|
4
|
+
export { b as BetterAuthAdvancedOptions, d as BetterAuthCookies, c as BetterAuthRateLimitOptions, G as GenerateIdFn, e as GenericEndpointContext, I as InternalAdapter } from './shared/core.CkkLHQWc.mjs';
|
|
5
|
+
import { Migration } from 'kysely';
|
|
6
|
+
import { Endpoint, Middleware, EndpointContext, InputContext } from 'better-call';
|
|
7
|
+
import { B as BetterAuthPluginDBSchema } from './shared/core.E9DfzGLz.mjs';
|
|
8
|
+
import { BetterFetch, BetterFetchOption, BetterFetchPlugin } from '@better-fetch/fetch';
|
|
9
|
+
import { WritableAtom, Atom } from 'nanostores';
|
|
10
|
+
import 'zod';
|
|
11
|
+
import 'better-sqlite3';
|
|
12
|
+
import './shared/core.Dl-70uns.mjs';
|
|
13
|
+
import 'bun:sqlite';
|
|
14
|
+
import 'node:sqlite';
|
|
15
|
+
import './social-providers/index.mjs';
|
|
16
|
+
import '@better-auth/core/oauth2';
|
|
17
|
+
import './shared/core.Bl6TpxyD.mjs';
|
|
18
|
+
import './shared/core.BwoNUcJQ.mjs';
|
|
19
|
+
import '@better-auth/core';
|
|
1
20
|
|
|
2
|
-
|
|
21
|
+
type Awaitable<T> = T | Promise<T>;
|
|
22
|
+
type DeepPartial<T> = T extends Function ? T : T extends object ? {
|
|
23
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
24
|
+
} : T;
|
|
25
|
+
type HookEndpointContext = EndpointContext<string, any> & Omit<InputContext<string, any>, "method"> & {
|
|
26
|
+
context: AuthContext & {
|
|
27
|
+
returned?: unknown;
|
|
28
|
+
responseHeaders?: Headers;
|
|
29
|
+
};
|
|
30
|
+
headers?: Headers;
|
|
31
|
+
};
|
|
32
|
+
type BetterAuthPlugin = {
|
|
33
|
+
id: LiteralString;
|
|
34
|
+
/**
|
|
35
|
+
* The init function is called when the plugin is initialized.
|
|
36
|
+
* You can return a new context or modify the existing context.
|
|
37
|
+
*/
|
|
38
|
+
init?: (ctx: AuthContext) => Awaitable<{
|
|
39
|
+
context?: DeepPartial<Omit<AuthContext, "options">>;
|
|
40
|
+
options?: Partial<BetterAuthOptions>;
|
|
41
|
+
}> | void | Promise<void>;
|
|
42
|
+
endpoints?: {
|
|
43
|
+
[key: string]: Endpoint;
|
|
44
|
+
};
|
|
45
|
+
middlewares?: {
|
|
46
|
+
path: string;
|
|
47
|
+
middleware: Middleware;
|
|
48
|
+
}[];
|
|
49
|
+
onRequest?: (request: Request, ctx: AuthContext) => Promise<{
|
|
50
|
+
response: Response;
|
|
51
|
+
} | {
|
|
52
|
+
request: Request;
|
|
53
|
+
} | void>;
|
|
54
|
+
onResponse?: (response: Response, ctx: AuthContext) => Promise<{
|
|
55
|
+
response: Response;
|
|
56
|
+
} | void>;
|
|
57
|
+
hooks?: {
|
|
58
|
+
before?: {
|
|
59
|
+
matcher: (context: HookEndpointContext) => boolean;
|
|
60
|
+
handler: AuthMiddleware;
|
|
61
|
+
}[];
|
|
62
|
+
after?: {
|
|
63
|
+
matcher: (context: HookEndpointContext) => boolean;
|
|
64
|
+
handler: AuthMiddleware;
|
|
65
|
+
}[];
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Schema the plugin needs
|
|
69
|
+
*
|
|
70
|
+
* This will also be used to migrate the database. If the fields are dynamic from the plugins
|
|
71
|
+
* configuration each time the configuration is changed a new migration will be created.
|
|
72
|
+
*
|
|
73
|
+
* NOTE: If you want to create migrations manually using
|
|
74
|
+
* migrations option or any other way you
|
|
75
|
+
* can disable migration per table basis.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* schema: {
|
|
80
|
+
* user: {
|
|
81
|
+
* fields: {
|
|
82
|
+
* email: {
|
|
83
|
+
* type: "string",
|
|
84
|
+
* },
|
|
85
|
+
* emailVerified: {
|
|
86
|
+
* type: "boolean",
|
|
87
|
+
* defaultValue: false,
|
|
88
|
+
* },
|
|
89
|
+
* },
|
|
90
|
+
* }
|
|
91
|
+
* } as AuthPluginSchema
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
schema?: BetterAuthPluginDBSchema;
|
|
95
|
+
/**
|
|
96
|
+
* The migrations of the plugin. If you define schema that will automatically create
|
|
97
|
+
* migrations for you.
|
|
98
|
+
*
|
|
99
|
+
* ⚠️ Only uses this if you dont't want to use the schema option and you disabled migrations for
|
|
100
|
+
* the tables.
|
|
101
|
+
*/
|
|
102
|
+
migrations?: Record<string, Migration>;
|
|
103
|
+
/**
|
|
104
|
+
* The options of the plugin
|
|
105
|
+
*/
|
|
106
|
+
options?: Record<string, any> | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* types to be inferred
|
|
109
|
+
*/
|
|
110
|
+
$Infer?: Record<string, any>;
|
|
111
|
+
/**
|
|
112
|
+
* The rate limit rules to apply to specific paths.
|
|
113
|
+
*/
|
|
114
|
+
rateLimit?: {
|
|
115
|
+
window: number;
|
|
116
|
+
max: number;
|
|
117
|
+
pathMatcher: (path: string) => boolean;
|
|
118
|
+
}[];
|
|
119
|
+
/**
|
|
120
|
+
* The error codes returned by the plugin
|
|
121
|
+
*/
|
|
122
|
+
$ERROR_CODES?: Record<string, string>;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
interface ClientStore {
|
|
126
|
+
notify: (signal: string) => void;
|
|
127
|
+
listen: (signal: string, listener: () => void) => void;
|
|
128
|
+
atoms: Record<string, WritableAtom<any>>;
|
|
129
|
+
}
|
|
130
|
+
type ClientAtomListener = {
|
|
131
|
+
matcher: (path: string) => boolean;
|
|
132
|
+
signal: "$sessionSignal" | Omit<string, "$sessionSignal">;
|
|
133
|
+
};
|
|
134
|
+
interface BetterAuthClientOptions {
|
|
135
|
+
fetchOptions?: BetterFetchOption;
|
|
136
|
+
plugins?: BetterAuthClientPlugin[];
|
|
137
|
+
baseURL?: string;
|
|
138
|
+
basePath?: string;
|
|
139
|
+
disableDefaultFetchPlugins?: boolean;
|
|
140
|
+
$InferAuth?: BetterAuthOptions;
|
|
141
|
+
}
|
|
142
|
+
interface BetterAuthClientPlugin {
|
|
143
|
+
id: LiteralString;
|
|
144
|
+
/**
|
|
145
|
+
* only used for type inference. don't pass the
|
|
146
|
+
* actual plugin
|
|
147
|
+
*/
|
|
148
|
+
$InferServerPlugin?: BetterAuthPlugin;
|
|
149
|
+
/**
|
|
150
|
+
* Custom actions
|
|
151
|
+
*/
|
|
152
|
+
getActions?: ($fetch: BetterFetch, $store: ClientStore,
|
|
153
|
+
/**
|
|
154
|
+
* better-auth client options
|
|
155
|
+
*/
|
|
156
|
+
options: BetterAuthClientOptions | undefined) => Record<string, any>;
|
|
157
|
+
/**
|
|
158
|
+
* State atoms that'll be resolved by each framework
|
|
159
|
+
* auth store.
|
|
160
|
+
*/
|
|
161
|
+
getAtoms?: ($fetch: BetterFetch) => Record<string, Atom<any>>;
|
|
162
|
+
/**
|
|
163
|
+
* specify path methods for server plugin inferred
|
|
164
|
+
* endpoints to force a specific method.
|
|
165
|
+
*/
|
|
166
|
+
pathMethods?: Record<string, "POST" | "GET">;
|
|
167
|
+
/**
|
|
168
|
+
* Better fetch plugins
|
|
169
|
+
*/
|
|
170
|
+
fetchPlugins?: BetterFetchPlugin[];
|
|
171
|
+
/**
|
|
172
|
+
* a list of recaller based on a matcher function.
|
|
173
|
+
* The signal name needs to match a signal in this
|
|
174
|
+
* plugin or any plugin the user might have added.
|
|
175
|
+
*/
|
|
176
|
+
atomListeners?: ClientAtomListener[];
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export { AuthContext, BetterAuthOptions, LiteralString };
|
|
180
|
+
export type { BetterAuthClientOptions, BetterAuthClientPlugin, BetterAuthPlugin, ClientAtomListener, ClientStore };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,180 @@
|
|
|
1
|
+
import { L as LiteralString } from './shared/core.CajxAutx.js';
|
|
2
|
+
export { a as LiteralUnion } from './shared/core.CajxAutx.js';
|
|
3
|
+
import { A as AuthContext, B as BetterAuthOptions, a as AuthMiddleware } from './shared/core.BJPBStdk.js';
|
|
4
|
+
export { b as BetterAuthAdvancedOptions, d as BetterAuthCookies, c as BetterAuthRateLimitOptions, G as GenerateIdFn, e as GenericEndpointContext, I as InternalAdapter } from './shared/core.BJPBStdk.js';
|
|
5
|
+
import { Migration } from 'kysely';
|
|
6
|
+
import { Endpoint, Middleware, EndpointContext, InputContext } from 'better-call';
|
|
7
|
+
import { B as BetterAuthPluginDBSchema } from './shared/core.Bqe5IGAi.js';
|
|
8
|
+
import { BetterFetch, BetterFetchOption, BetterFetchPlugin } from '@better-fetch/fetch';
|
|
9
|
+
import { WritableAtom, Atom } from 'nanostores';
|
|
10
|
+
import 'zod';
|
|
11
|
+
import 'better-sqlite3';
|
|
12
|
+
import './shared/core.Dl-70uns.js';
|
|
13
|
+
import 'bun:sqlite';
|
|
14
|
+
import 'node:sqlite';
|
|
15
|
+
import './social-providers/index.js';
|
|
16
|
+
import '@better-auth/core/oauth2';
|
|
17
|
+
import './shared/core.DkdZ1o38.js';
|
|
18
|
+
import './shared/core.BwoNUcJQ.js';
|
|
19
|
+
import '@better-auth/core';
|
|
1
20
|
|
|
2
|
-
|
|
21
|
+
type Awaitable<T> = T | Promise<T>;
|
|
22
|
+
type DeepPartial<T> = T extends Function ? T : T extends object ? {
|
|
23
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
24
|
+
} : T;
|
|
25
|
+
type HookEndpointContext = EndpointContext<string, any> & Omit<InputContext<string, any>, "method"> & {
|
|
26
|
+
context: AuthContext & {
|
|
27
|
+
returned?: unknown;
|
|
28
|
+
responseHeaders?: Headers;
|
|
29
|
+
};
|
|
30
|
+
headers?: Headers;
|
|
31
|
+
};
|
|
32
|
+
type BetterAuthPlugin = {
|
|
33
|
+
id: LiteralString;
|
|
34
|
+
/**
|
|
35
|
+
* The init function is called when the plugin is initialized.
|
|
36
|
+
* You can return a new context or modify the existing context.
|
|
37
|
+
*/
|
|
38
|
+
init?: (ctx: AuthContext) => Awaitable<{
|
|
39
|
+
context?: DeepPartial<Omit<AuthContext, "options">>;
|
|
40
|
+
options?: Partial<BetterAuthOptions>;
|
|
41
|
+
}> | void | Promise<void>;
|
|
42
|
+
endpoints?: {
|
|
43
|
+
[key: string]: Endpoint;
|
|
44
|
+
};
|
|
45
|
+
middlewares?: {
|
|
46
|
+
path: string;
|
|
47
|
+
middleware: Middleware;
|
|
48
|
+
}[];
|
|
49
|
+
onRequest?: (request: Request, ctx: AuthContext) => Promise<{
|
|
50
|
+
response: Response;
|
|
51
|
+
} | {
|
|
52
|
+
request: Request;
|
|
53
|
+
} | void>;
|
|
54
|
+
onResponse?: (response: Response, ctx: AuthContext) => Promise<{
|
|
55
|
+
response: Response;
|
|
56
|
+
} | void>;
|
|
57
|
+
hooks?: {
|
|
58
|
+
before?: {
|
|
59
|
+
matcher: (context: HookEndpointContext) => boolean;
|
|
60
|
+
handler: AuthMiddleware;
|
|
61
|
+
}[];
|
|
62
|
+
after?: {
|
|
63
|
+
matcher: (context: HookEndpointContext) => boolean;
|
|
64
|
+
handler: AuthMiddleware;
|
|
65
|
+
}[];
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Schema the plugin needs
|
|
69
|
+
*
|
|
70
|
+
* This will also be used to migrate the database. If the fields are dynamic from the plugins
|
|
71
|
+
* configuration each time the configuration is changed a new migration will be created.
|
|
72
|
+
*
|
|
73
|
+
* NOTE: If you want to create migrations manually using
|
|
74
|
+
* migrations option or any other way you
|
|
75
|
+
* can disable migration per table basis.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* schema: {
|
|
80
|
+
* user: {
|
|
81
|
+
* fields: {
|
|
82
|
+
* email: {
|
|
83
|
+
* type: "string",
|
|
84
|
+
* },
|
|
85
|
+
* emailVerified: {
|
|
86
|
+
* type: "boolean",
|
|
87
|
+
* defaultValue: false,
|
|
88
|
+
* },
|
|
89
|
+
* },
|
|
90
|
+
* }
|
|
91
|
+
* } as AuthPluginSchema
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
schema?: BetterAuthPluginDBSchema;
|
|
95
|
+
/**
|
|
96
|
+
* The migrations of the plugin. If you define schema that will automatically create
|
|
97
|
+
* migrations for you.
|
|
98
|
+
*
|
|
99
|
+
* ⚠️ Only uses this if you dont't want to use the schema option and you disabled migrations for
|
|
100
|
+
* the tables.
|
|
101
|
+
*/
|
|
102
|
+
migrations?: Record<string, Migration>;
|
|
103
|
+
/**
|
|
104
|
+
* The options of the plugin
|
|
105
|
+
*/
|
|
106
|
+
options?: Record<string, any> | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* types to be inferred
|
|
109
|
+
*/
|
|
110
|
+
$Infer?: Record<string, any>;
|
|
111
|
+
/**
|
|
112
|
+
* The rate limit rules to apply to specific paths.
|
|
113
|
+
*/
|
|
114
|
+
rateLimit?: {
|
|
115
|
+
window: number;
|
|
116
|
+
max: number;
|
|
117
|
+
pathMatcher: (path: string) => boolean;
|
|
118
|
+
}[];
|
|
119
|
+
/**
|
|
120
|
+
* The error codes returned by the plugin
|
|
121
|
+
*/
|
|
122
|
+
$ERROR_CODES?: Record<string, string>;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
interface ClientStore {
|
|
126
|
+
notify: (signal: string) => void;
|
|
127
|
+
listen: (signal: string, listener: () => void) => void;
|
|
128
|
+
atoms: Record<string, WritableAtom<any>>;
|
|
129
|
+
}
|
|
130
|
+
type ClientAtomListener = {
|
|
131
|
+
matcher: (path: string) => boolean;
|
|
132
|
+
signal: "$sessionSignal" | Omit<string, "$sessionSignal">;
|
|
133
|
+
};
|
|
134
|
+
interface BetterAuthClientOptions {
|
|
135
|
+
fetchOptions?: BetterFetchOption;
|
|
136
|
+
plugins?: BetterAuthClientPlugin[];
|
|
137
|
+
baseURL?: string;
|
|
138
|
+
basePath?: string;
|
|
139
|
+
disableDefaultFetchPlugins?: boolean;
|
|
140
|
+
$InferAuth?: BetterAuthOptions;
|
|
141
|
+
}
|
|
142
|
+
interface BetterAuthClientPlugin {
|
|
143
|
+
id: LiteralString;
|
|
144
|
+
/**
|
|
145
|
+
* only used for type inference. don't pass the
|
|
146
|
+
* actual plugin
|
|
147
|
+
*/
|
|
148
|
+
$InferServerPlugin?: BetterAuthPlugin;
|
|
149
|
+
/**
|
|
150
|
+
* Custom actions
|
|
151
|
+
*/
|
|
152
|
+
getActions?: ($fetch: BetterFetch, $store: ClientStore,
|
|
153
|
+
/**
|
|
154
|
+
* better-auth client options
|
|
155
|
+
*/
|
|
156
|
+
options: BetterAuthClientOptions | undefined) => Record<string, any>;
|
|
157
|
+
/**
|
|
158
|
+
* State atoms that'll be resolved by each framework
|
|
159
|
+
* auth store.
|
|
160
|
+
*/
|
|
161
|
+
getAtoms?: ($fetch: BetterFetch) => Record<string, Atom<any>>;
|
|
162
|
+
/**
|
|
163
|
+
* specify path methods for server plugin inferred
|
|
164
|
+
* endpoints to force a specific method.
|
|
165
|
+
*/
|
|
166
|
+
pathMethods?: Record<string, "POST" | "GET">;
|
|
167
|
+
/**
|
|
168
|
+
* Better fetch plugins
|
|
169
|
+
*/
|
|
170
|
+
fetchPlugins?: BetterFetchPlugin[];
|
|
171
|
+
/**
|
|
172
|
+
* a list of recaller based on a matcher function.
|
|
173
|
+
* The signal name needs to match a signal in this
|
|
174
|
+
* plugin or any plugin the user might have added.
|
|
175
|
+
*/
|
|
176
|
+
atomListeners?: ClientAtomListener[];
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export { AuthContext, BetterAuthOptions, LiteralString };
|
|
180
|
+
export type { BetterAuthClientOptions, BetterAuthClientPlugin, BetterAuthPlugin, ClientAtomListener, ClientStore };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const betterCall = require('better-call');
|
|
4
|
+
|
|
5
|
+
const optionsMiddleware = betterCall.createMiddleware(async () => {
|
|
6
|
+
return {};
|
|
7
|
+
});
|
|
8
|
+
const createAuthMiddleware = betterCall.createMiddleware.create({
|
|
9
|
+
use: [
|
|
10
|
+
optionsMiddleware,
|
|
11
|
+
/**
|
|
12
|
+
* Only use for post hooks
|
|
13
|
+
*/
|
|
14
|
+
betterCall.createMiddleware(async () => {
|
|
15
|
+
return {};
|
|
16
|
+
})
|
|
17
|
+
]
|
|
18
|
+
});
|
|
19
|
+
const createAuthEndpoint = betterCall.createEndpoint.create({
|
|
20
|
+
use: [optionsMiddleware]
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
exports.createAuthEndpoint = createAuthEndpoint;
|
|
24
|
+
exports.createAuthMiddleware = createAuthMiddleware;
|
|
25
|
+
exports.optionsMiddleware = optionsMiddleware;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import 'better-call';
|
|
2
|
+
import '../shared/core.CajxAutx.cjs';
|
|
3
|
+
export { n as AuthEndpoint, a as AuthMiddleware, m as createAuthEndpoint, l as createAuthMiddleware, o as optionsMiddleware } from '../shared/core.gYIBmdi1.cjs';
|
|
4
|
+
import 'zod';
|
|
5
|
+
import 'kysely';
|
|
6
|
+
import 'better-sqlite3';
|
|
7
|
+
import '../shared/core.Dl-70uns.cjs';
|
|
8
|
+
import 'bun:sqlite';
|
|
9
|
+
import 'node:sqlite';
|
|
10
|
+
import '../social-providers/index.cjs';
|
|
11
|
+
import '@better-auth/core/oauth2';
|
|
12
|
+
import '../shared/core.DyEdx0m7.cjs';
|
|
13
|
+
import '../shared/core.BwoNUcJQ.cjs';
|
|
14
|
+
import '@better-auth/core';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import 'better-call';
|
|
2
|
+
import '../shared/core.CajxAutx.mjs';
|
|
3
|
+
export { n as AuthEndpoint, a as AuthMiddleware, m as createAuthEndpoint, l as createAuthMiddleware, o as optionsMiddleware } from '../shared/core.CkkLHQWc.mjs';
|
|
4
|
+
import 'zod';
|
|
5
|
+
import 'kysely';
|
|
6
|
+
import 'better-sqlite3';
|
|
7
|
+
import '../shared/core.Dl-70uns.mjs';
|
|
8
|
+
import 'bun:sqlite';
|
|
9
|
+
import 'node:sqlite';
|
|
10
|
+
import '../social-providers/index.mjs';
|
|
11
|
+
import '@better-auth/core/oauth2';
|
|
12
|
+
import '../shared/core.Bl6TpxyD.mjs';
|
|
13
|
+
import '../shared/core.BwoNUcJQ.mjs';
|
|
14
|
+
import '@better-auth/core';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import 'better-call';
|
|
2
|
+
import '../shared/core.CajxAutx.js';
|
|
3
|
+
export { n as AuthEndpoint, a as AuthMiddleware, m as createAuthEndpoint, l as createAuthMiddleware, o as optionsMiddleware } from '../shared/core.BJPBStdk.js';
|
|
4
|
+
import 'zod';
|
|
5
|
+
import 'kysely';
|
|
6
|
+
import 'better-sqlite3';
|
|
7
|
+
import '../shared/core.Dl-70uns.js';
|
|
8
|
+
import 'bun:sqlite';
|
|
9
|
+
import 'node:sqlite';
|
|
10
|
+
import '../social-providers/index.js';
|
|
11
|
+
import '@better-auth/core/oauth2';
|
|
12
|
+
import '../shared/core.DkdZ1o38.js';
|
|
13
|
+
import '../shared/core.BwoNUcJQ.js';
|
|
14
|
+
import '@better-auth/core';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createMiddleware, createEndpoint } from 'better-call';
|
|
2
|
+
|
|
3
|
+
const optionsMiddleware = createMiddleware(async () => {
|
|
4
|
+
return {};
|
|
5
|
+
});
|
|
6
|
+
const createAuthMiddleware = createMiddleware.create({
|
|
7
|
+
use: [
|
|
8
|
+
optionsMiddleware,
|
|
9
|
+
/**
|
|
10
|
+
* Only use for post hooks
|
|
11
|
+
*/
|
|
12
|
+
createMiddleware(async () => {
|
|
13
|
+
return {};
|
|
14
|
+
})
|
|
15
|
+
]
|
|
16
|
+
});
|
|
17
|
+
const createAuthEndpoint = createEndpoint.create({
|
|
18
|
+
use: [optionsMiddleware]
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export { createAuthEndpoint, createAuthMiddleware, optionsMiddleware };
|