@better-auth/core 1.5.7-beta.1 → 1.6.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/dist/api/index.d.mts +12 -43
- package/dist/api/index.mjs +0 -3
- package/dist/async_hooks/index.d.mts +1 -2
- package/dist/async_hooks/index.mjs +0 -2
- package/dist/async_hooks/pure.index.d.mts +1 -2
- package/dist/async_hooks/pure.index.mjs +0 -2
- package/dist/context/endpoint-context.d.mts +2 -3
- package/dist/context/endpoint-context.mjs +0 -2
- package/dist/context/global.d.mts +1 -2
- package/dist/context/global.mjs +1 -3
- package/dist/context/request-state.d.mts +1 -2
- package/dist/context/request-state.mjs +0 -2
- package/dist/context/transaction.d.mts +1 -2
- package/dist/context/transaction.mjs +0 -2
- package/dist/db/adapter/factory.d.mts +1 -2
- package/dist/db/adapter/factory.mjs +3 -6
- package/dist/db/adapter/get-default-field-name.d.mts +1 -2
- package/dist/db/adapter/get-default-field-name.mjs +0 -2
- package/dist/db/adapter/get-default-model-name.d.mts +1 -2
- package/dist/db/adapter/get-default-model-name.mjs +0 -2
- package/dist/db/adapter/get-field-attributes.d.mts +1 -2
- package/dist/db/adapter/get-field-attributes.mjs +0 -2
- package/dist/db/adapter/get-field-name.d.mts +1 -2
- package/dist/db/adapter/get-field-name.mjs +0 -2
- package/dist/db/adapter/get-id-field.d.mts +1 -2
- package/dist/db/adapter/get-id-field.mjs +0 -3
- package/dist/db/adapter/get-model-name.d.mts +1 -2
- package/dist/db/adapter/get-model-name.mjs +0 -2
- package/dist/db/adapter/index.d.mts +9 -2
- package/dist/db/adapter/index.mjs +0 -2
- package/dist/db/adapter/types.d.mts +1 -2
- package/dist/db/adapter/utils.d.mts +1 -2
- package/dist/db/adapter/utils.mjs +0 -2
- package/dist/db/get-tables.d.mts +1 -2
- package/dist/db/get-tables.mjs +0 -2
- package/dist/db/plugin.d.mts +1 -2
- package/dist/db/schema/account.d.mts +1 -2
- package/dist/db/schema/account.mjs +0 -2
- package/dist/db/schema/rate-limit.d.mts +1 -2
- package/dist/db/schema/rate-limit.mjs +0 -2
- package/dist/db/schema/session.d.mts +1 -2
- package/dist/db/schema/session.mjs +0 -2
- package/dist/db/schema/shared.d.mts +1 -2
- package/dist/db/schema/shared.mjs +0 -2
- package/dist/db/schema/user.d.mts +1 -2
- package/dist/db/schema/user.mjs +0 -2
- package/dist/db/schema/verification.d.mts +1 -2
- package/dist/db/schema/verification.mjs +0 -2
- package/dist/db/type.d.mts +1 -2
- package/dist/env/color-depth.d.mts +1 -2
- package/dist/env/color-depth.mjs +0 -2
- package/dist/env/env-impl.d.mts +1 -2
- package/dist/env/env-impl.mjs +0 -2
- package/dist/env/logger.d.mts +1 -2
- package/dist/env/logger.mjs +0 -2
- package/dist/error/codes.d.mts +1 -2
- package/dist/error/codes.mjs +0 -2
- package/dist/error/index.d.mts +1 -2
- package/dist/error/index.mjs +0 -2
- package/dist/instrumentation/attributes.d.mts +1 -2
- package/dist/instrumentation/attributes.mjs +0 -2
- package/dist/instrumentation/tracer.d.mts +1 -2
- package/dist/instrumentation/tracer.mjs +29 -15
- package/dist/oauth2/client-credentials-token.d.mts +1 -2
- package/dist/oauth2/client-credentials-token.mjs +0 -2
- package/dist/oauth2/create-authorization-url.d.mts +1 -2
- package/dist/oauth2/create-authorization-url.mjs +0 -2
- package/dist/oauth2/oauth-provider.d.mts +1 -2
- package/dist/oauth2/refresh-access-token.d.mts +1 -2
- package/dist/oauth2/refresh-access-token.mjs +0 -2
- package/dist/oauth2/utils.d.mts +1 -2
- package/dist/oauth2/utils.mjs +0 -2
- package/dist/oauth2/validate-authorization-code.d.mts +1 -2
- package/dist/oauth2/validate-authorization-code.mjs +0 -3
- package/dist/oauth2/verify.d.mts +1 -2
- package/dist/oauth2/verify.mjs +0 -3
- package/dist/social-providers/apple.d.mts +1 -2
- package/dist/social-providers/apple.mjs +0 -3
- package/dist/social-providers/atlassian.d.mts +1 -2
- package/dist/social-providers/atlassian.mjs +0 -4
- package/dist/social-providers/cognito.d.mts +1 -2
- package/dist/social-providers/cognito.mjs +0 -4
- package/dist/social-providers/discord.d.mts +1 -2
- package/dist/social-providers/discord.mjs +0 -3
- package/dist/social-providers/dropbox.d.mts +1 -2
- package/dist/social-providers/dropbox.mjs +0 -3
- package/dist/social-providers/facebook.d.mts +1 -2
- package/dist/social-providers/facebook.mjs +0 -3
- package/dist/social-providers/figma.d.mts +1 -2
- package/dist/social-providers/figma.mjs +0 -4
- package/dist/social-providers/github.d.mts +1 -2
- package/dist/social-providers/github.mjs +0 -4
- package/dist/social-providers/gitlab.d.mts +1 -2
- package/dist/social-providers/gitlab.mjs +0 -3
- package/dist/social-providers/google.d.mts +1 -2
- package/dist/social-providers/google.mjs +0 -4
- package/dist/social-providers/huggingface.d.mts +1 -2
- package/dist/social-providers/huggingface.mjs +0 -3
- package/dist/social-providers/index.d.mts +1 -2
- package/dist/social-providers/index.mjs +0 -2
- package/dist/social-providers/kakao.d.mts +1 -2
- package/dist/social-providers/kakao.mjs +0 -3
- package/dist/social-providers/kick.d.mts +1 -2
- package/dist/social-providers/kick.mjs +0 -3
- package/dist/social-providers/line.d.mts +1 -2
- package/dist/social-providers/line.mjs +0 -3
- package/dist/social-providers/linear.d.mts +1 -2
- package/dist/social-providers/linear.mjs +0 -3
- package/dist/social-providers/linkedin.d.mts +1 -2
- package/dist/social-providers/linkedin.mjs +0 -3
- package/dist/social-providers/microsoft-entra-id.d.mts +1 -2
- package/dist/social-providers/microsoft-entra-id.mjs +0 -4
- package/dist/social-providers/naver.d.mts +1 -2
- package/dist/social-providers/naver.mjs +0 -3
- package/dist/social-providers/notion.d.mts +1 -2
- package/dist/social-providers/notion.mjs +0 -3
- package/dist/social-providers/paybin.d.mts +1 -2
- package/dist/social-providers/paybin.mjs +0 -4
- package/dist/social-providers/paypal.d.mts +1 -2
- package/dist/social-providers/paypal.mjs +0 -4
- package/dist/social-providers/polar.d.mts +1 -2
- package/dist/social-providers/polar.mjs +0 -3
- package/dist/social-providers/railway.d.mts +1 -2
- package/dist/social-providers/railway.mjs +0 -3
- package/dist/social-providers/reddit.d.mts +1 -2
- package/dist/social-providers/reddit.mjs +0 -3
- package/dist/social-providers/roblox.d.mts +1 -2
- package/dist/social-providers/roblox.mjs +0 -3
- package/dist/social-providers/salesforce.d.mts +1 -2
- package/dist/social-providers/salesforce.mjs +0 -4
- package/dist/social-providers/slack.d.mts +1 -2
- package/dist/social-providers/slack.mjs +0 -3
- package/dist/social-providers/spotify.d.mts +1 -2
- package/dist/social-providers/spotify.mjs +0 -3
- package/dist/social-providers/tiktok.d.mts +1 -2
- package/dist/social-providers/tiktok.mjs +0 -3
- package/dist/social-providers/twitch.d.mts +1 -2
- package/dist/social-providers/twitch.mjs +0 -4
- package/dist/social-providers/twitter.d.mts +1 -2
- package/dist/social-providers/twitter.mjs +0 -3
- package/dist/social-providers/vercel.d.mts +1 -2
- package/dist/social-providers/vercel.mjs +0 -3
- package/dist/social-providers/vk.d.mts +1 -2
- package/dist/social-providers/vk.mjs +0 -3
- package/dist/social-providers/wechat.d.mts +1 -2
- package/dist/social-providers/wechat.mjs +0 -2
- package/dist/social-providers/zoom.d.mts +1 -2
- package/dist/social-providers/zoom.mjs +0 -3
- package/dist/types/context.d.mts +5 -3
- package/dist/types/cookie.d.mts +1 -2
- package/dist/types/helper.d.mts +1 -2
- package/dist/types/init-options.d.mts +14 -6
- package/dist/types/plugin-client.d.mts +2 -2
- package/dist/types/plugin.d.mts +3 -6
- package/dist/types/secret.d.mts +1 -2
- package/dist/utils/db.d.mts +1 -2
- package/dist/utils/db.mjs +0 -2
- package/dist/utils/deprecate.d.mts +1 -2
- package/dist/utils/deprecate.mjs +0 -2
- package/dist/utils/error-codes.d.mts +1 -2
- package/dist/utils/error-codes.mjs +0 -2
- package/dist/utils/fetch-metadata.d.mts +1 -2
- package/dist/utils/fetch-metadata.mjs +0 -2
- package/dist/utils/id.d.mts +1 -2
- package/dist/utils/id.mjs +0 -2
- package/dist/utils/ip.d.mts +1 -2
- package/dist/utils/ip.mjs +0 -2
- package/dist/utils/json.d.mts +1 -2
- package/dist/utils/json.mjs +0 -3
- package/dist/utils/string.d.mts +1 -2
- package/dist/utils/string.mjs +0 -2
- package/dist/utils/url.d.mts +1 -2
- package/dist/utils/url.mjs +0 -2
- package/package.json +9 -7
- package/src/api/index.ts +41 -151
- package/src/context/endpoint-context.ts +1 -2
- package/src/db/adapter/factory.ts +2 -0
- package/src/db/adapter/index.ts +8 -0
- package/src/instrumentation/tracer.ts +40 -12
- package/src/social-providers/index.ts +0 -2
- package/src/types/context.ts +4 -1
- package/src/types/init-options.ts +13 -4
- package/src/types/plugin-client.ts +1 -0
- package/src/types/plugin.ts +2 -14
- package/dist/api/index.mjs.map +0 -1
- package/dist/async_hooks/index.mjs.map +0 -1
- package/dist/async_hooks/pure.index.mjs.map +0 -1
- package/dist/context/endpoint-context.mjs.map +0 -1
- package/dist/context/global.mjs.map +0 -1
- package/dist/context/request-state.mjs.map +0 -1
- package/dist/context/transaction.mjs.map +0 -1
- package/dist/db/adapter/factory.mjs.map +0 -1
- package/dist/db/adapter/get-default-field-name.mjs.map +0 -1
- package/dist/db/adapter/get-default-model-name.mjs.map +0 -1
- package/dist/db/adapter/get-field-attributes.mjs.map +0 -1
- package/dist/db/adapter/get-field-name.mjs.map +0 -1
- package/dist/db/adapter/get-id-field.mjs.map +0 -1
- package/dist/db/adapter/get-model-name.mjs.map +0 -1
- package/dist/db/adapter/index.mjs.map +0 -1
- package/dist/db/adapter/utils.mjs.map +0 -1
- package/dist/db/get-tables.mjs.map +0 -1
- package/dist/db/schema/account.mjs.map +0 -1
- package/dist/db/schema/rate-limit.mjs.map +0 -1
- package/dist/db/schema/session.mjs.map +0 -1
- package/dist/db/schema/shared.mjs.map +0 -1
- package/dist/db/schema/user.mjs.map +0 -1
- package/dist/db/schema/verification.mjs.map +0 -1
- package/dist/env/color-depth.mjs.map +0 -1
- package/dist/env/env-impl.mjs.map +0 -1
- package/dist/env/logger.mjs.map +0 -1
- package/dist/error/codes.mjs.map +0 -1
- package/dist/error/index.mjs.map +0 -1
- package/dist/instrumentation/attributes.mjs.map +0 -1
- package/dist/instrumentation/tracer.mjs.map +0 -1
- package/dist/oauth2/client-credentials-token.mjs.map +0 -1
- package/dist/oauth2/create-authorization-url.mjs.map +0 -1
- package/dist/oauth2/refresh-access-token.mjs.map +0 -1
- package/dist/oauth2/utils.mjs.map +0 -1
- package/dist/oauth2/validate-authorization-code.mjs.map +0 -1
- package/dist/oauth2/verify.mjs.map +0 -1
- package/dist/social-providers/apple.mjs.map +0 -1
- package/dist/social-providers/atlassian.mjs.map +0 -1
- package/dist/social-providers/cognito.mjs.map +0 -1
- package/dist/social-providers/discord.mjs.map +0 -1
- package/dist/social-providers/dropbox.mjs.map +0 -1
- package/dist/social-providers/facebook.mjs.map +0 -1
- package/dist/social-providers/figma.mjs.map +0 -1
- package/dist/social-providers/github.mjs.map +0 -1
- package/dist/social-providers/gitlab.mjs.map +0 -1
- package/dist/social-providers/google.mjs.map +0 -1
- package/dist/social-providers/huggingface.mjs.map +0 -1
- package/dist/social-providers/index.mjs.map +0 -1
- package/dist/social-providers/kakao.mjs.map +0 -1
- package/dist/social-providers/kick.mjs.map +0 -1
- package/dist/social-providers/line.mjs.map +0 -1
- package/dist/social-providers/linear.mjs.map +0 -1
- package/dist/social-providers/linkedin.mjs.map +0 -1
- package/dist/social-providers/microsoft-entra-id.mjs.map +0 -1
- package/dist/social-providers/naver.mjs.map +0 -1
- package/dist/social-providers/notion.mjs.map +0 -1
- package/dist/social-providers/paybin.mjs.map +0 -1
- package/dist/social-providers/paypal.mjs.map +0 -1
- package/dist/social-providers/polar.mjs.map +0 -1
- package/dist/social-providers/railway.mjs.map +0 -1
- package/dist/social-providers/reddit.mjs.map +0 -1
- package/dist/social-providers/roblox.mjs.map +0 -1
- package/dist/social-providers/salesforce.mjs.map +0 -1
- package/dist/social-providers/slack.mjs.map +0 -1
- package/dist/social-providers/spotify.mjs.map +0 -1
- package/dist/social-providers/tiktok.mjs.map +0 -1
- package/dist/social-providers/twitch.mjs.map +0 -1
- package/dist/social-providers/twitter.mjs.map +0 -1
- package/dist/social-providers/vercel.mjs.map +0 -1
- package/dist/social-providers/vk.mjs.map +0 -1
- package/dist/social-providers/wechat.mjs.map +0 -1
- package/dist/social-providers/zoom.mjs.map +0 -1
- package/dist/utils/db.mjs.map +0 -1
- package/dist/utils/deprecate.mjs.map +0 -1
- package/dist/utils/error-codes.mjs.map +0 -1
- package/dist/utils/fetch-metadata.mjs.map +0 -1
- package/dist/utils/id.mjs.map +0 -1
- package/dist/utils/ip.mjs.map +0 -1
- package/dist/utils/json.mjs.map +0 -1
- package/dist/utils/string.mjs.map +0 -1
- package/dist/utils/url.mjs.map +0 -1
- package/src/context/request-state.test.ts +0 -94
- package/src/db/adapter/get-id-field.test.ts +0 -222
- package/src/db/test/get-tables.test.ts +0 -116
- package/src/env/logger.test.ts +0 -34
- package/src/instrumentation/instrumentation.test.ts +0 -139
- package/src/oauth2/refresh-access-token.test.ts +0 -90
- package/src/oauth2/validate-token.test.ts +0 -229
- package/src/utils/deprecate.test.ts +0 -71
- package/src/utils/fetch-metadata.test.ts +0 -28
- package/src/utils/ip.test.ts +0 -255
package/dist/api/index.d.mts
CHANGED
|
@@ -4,15 +4,13 @@ import { createLogger } from "../env/logger.mjs";
|
|
|
4
4
|
import { AuthContext } from "../types/context.mjs";
|
|
5
5
|
import { OAuthProvider } from "../oauth2/oauth-provider.mjs";
|
|
6
6
|
import * as better_call0 from "better-call";
|
|
7
|
-
import {
|
|
7
|
+
import { EndpointContext, EndpointOptions, StrictEndpoint } from "better-call";
|
|
8
8
|
import * as _better_auth_core0 from "@better-auth/core";
|
|
9
9
|
|
|
10
10
|
//#region src/api/index.d.ts
|
|
11
|
-
declare const optionsMiddleware:
|
|
11
|
+
declare const optionsMiddleware: <InputCtx extends better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>>(inputContext: InputCtx) => Promise<AuthContext>;
|
|
12
12
|
declare const createAuthMiddleware: {
|
|
13
|
-
<R>(options: {
|
|
14
|
-
use?: Middleware[];
|
|
15
|
-
}, handler: (ctx: better_call0.MiddlewareContext<{
|
|
13
|
+
<Options extends better_call0.MiddlewareOptions, R>(options: Options, handler: (ctx: better_call0.MiddlewareContext<Options, {
|
|
16
14
|
returned?: unknown | undefined;
|
|
17
15
|
responseHeaders?: Headers | undefined;
|
|
18
16
|
} & _better_auth_core0.PluginContext<_better_auth_core0.BetterAuthOptions> & _better_auth_core0.InfoContext & {
|
|
@@ -140,8 +138,8 @@ declare const createAuthMiddleware: {
|
|
|
140
138
|
skipCSRFCheck: boolean;
|
|
141
139
|
runInBackground: (promise: Promise<unknown>) => void;
|
|
142
140
|
runInBackgroundOrAwait: (promise: Promise<unknown> | void) => _better_auth_core0.Awaitable<unknown>;
|
|
143
|
-
}>) => Promise<R>):
|
|
144
|
-
<
|
|
141
|
+
}>) => Promise<R>): (inputContext: better_call0.MiddlewareInputContext<Options>) => Promise<R>;
|
|
142
|
+
<Options extends better_call0.MiddlewareOptions, R_1>(handler: (ctx: better_call0.MiddlewareContext<Options, {
|
|
145
143
|
returned?: unknown | undefined;
|
|
146
144
|
responseHeaders?: Headers | undefined;
|
|
147
145
|
} & _better_auth_core0.PluginContext<_better_auth_core0.BetterAuthOptions> & _better_auth_core0.InfoContext & {
|
|
@@ -269,41 +267,12 @@ declare const createAuthMiddleware: {
|
|
|
269
267
|
skipCSRFCheck: boolean;
|
|
270
268
|
runInBackground: (promise: Promise<unknown>) => void;
|
|
271
269
|
runInBackgroundOrAwait: (promise: Promise<unknown> | void) => _better_auth_core0.Awaitable<unknown>;
|
|
272
|
-
}>) => Promise<
|
|
270
|
+
}>) => Promise<R_1>): (inputContext: better_call0.MiddlewareInputContext<Options>) => Promise<R_1>;
|
|
273
271
|
};
|
|
274
|
-
type
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
type AuthEndpointOptions<Method extends HTTPMethod | HTTPMethod[] | "*", BodySchema extends object | undefined, QuerySchema extends object | undefined, Use extends Middleware[], ReqHeaders extends boolean, ReqRequest extends boolean, Meta extends EndpointMetadata | undefined, ErrorSchema extends StandardSchemaV1 | undefined = undefined> = {
|
|
280
|
-
method: Method;
|
|
281
|
-
} & BodyOption<Method, BodySchema> & {
|
|
282
|
-
query?: QuerySchema;
|
|
283
|
-
use?: [...Use];
|
|
284
|
-
requireHeaders?: ReqHeaders;
|
|
285
|
-
requireRequest?: ReqRequest;
|
|
286
|
-
error?: ErrorSchema;
|
|
287
|
-
cloneRequest?: boolean;
|
|
288
|
-
disableBody?: boolean;
|
|
289
|
-
metadata?: Meta;
|
|
290
|
-
[key: string]: any;
|
|
291
|
-
};
|
|
292
|
-
/**
|
|
293
|
-
* Normalize readonly tuples produced by `const` type parameters
|
|
294
|
-
* into mutable arrays so downstream `M extends Array<any>` checks work.
|
|
295
|
-
*/
|
|
296
|
-
type NormalizeMethod<M> = M extends readonly (infer E)[] ? E[] : M;
|
|
297
|
-
declare function createAuthEndpoint<Path extends string, const Method extends HTTPMethod | HTTPMethod[] | "*", BodySchema extends object | undefined = undefined, QuerySchema extends object | undefined = undefined, Use extends Middleware[] = [], ReqHeaders extends boolean = false, ReqRequest extends boolean = false, R = unknown, Meta extends EndpointMetadata | undefined = undefined, ErrorSchema extends StandardSchemaV1 | undefined = undefined>(path: Path, options: AuthEndpointOptions<Method, BodySchema, QuerySchema, Use, ReqHeaders, ReqRequest, Meta, ErrorSchema>, handler: (ctx: EndpointContext<Path, Method, BodySchema, QuerySchema, Use, ReqHeaders, ReqRequest, AuthContext, Meta>) => Promise<R>): Endpoint<Path, NormalizeMethod<Method>, ResolveBodyInput<BodySchema, Meta>, ResolveQueryInput<QuerySchema, Meta>, Use, R, ResolveMetaInput<Meta>, ResolveErrorInput<ErrorSchema, Meta>>;
|
|
298
|
-
declare function createAuthEndpoint<const Method extends HTTPMethod | HTTPMethod[] | "*", BodySchema extends object | undefined = undefined, QuerySchema extends object | undefined = undefined, Use extends Middleware[] = [], ReqHeaders extends boolean = false, ReqRequest extends boolean = false, R = unknown, Meta extends EndpointMetadata | undefined = undefined, ErrorSchema extends StandardSchemaV1 | undefined = undefined>(options: AuthEndpointOptions<Method, BodySchema, QuerySchema, Use, ReqHeaders, ReqRequest, Meta, ErrorSchema>, handler: (ctx: EndpointContext<string, Method, BodySchema, QuerySchema, Use, ReqHeaders, ReqRequest, AuthContext, Meta>) => Promise<R>): Endpoint<string, NormalizeMethod<Method>, ResolveBodyInput<BodySchema, Meta>, ResolveQueryInput<QuerySchema, Meta>, Use, R, ResolveMetaInput<Meta>, ResolveErrorInput<ErrorSchema, Meta>>;
|
|
299
|
-
type AuthEndpoint = ReturnType<typeof createAuthEndpoint>;
|
|
300
|
-
/**
|
|
301
|
-
* The handler type for plugin hooks.
|
|
302
|
-
*
|
|
303
|
-
* Accepts both `Middleware` instances (from `createAuthMiddleware`)
|
|
304
|
-
* and plain async functions for better-call v1/v2 compatibility.
|
|
305
|
-
*/
|
|
306
|
-
type AuthMiddleware = (inputContext: Record<string, any>) => Promise<unknown>;
|
|
272
|
+
type EndpointHandler<Path extends string, Options extends EndpointOptions, R> = (context: EndpointContext<Path, Options, AuthContext>) => Promise<R>;
|
|
273
|
+
declare function createAuthEndpoint<Path extends string, Options extends EndpointOptions, R>(path: Path, options: Options, handler: EndpointHandler<Path, Options, R>): StrictEndpoint<Path, Options, R>;
|
|
274
|
+
declare function createAuthEndpoint<Path extends string, Options extends EndpointOptions, R>(options: Options, handler: EndpointHandler<Path, Options, R>): StrictEndpoint<Path, Options, R>;
|
|
275
|
+
type AuthEndpoint<Path extends string, Opts extends EndpointOptions, R> = ReturnType<typeof createAuthEndpoint<Path, Opts, R>>;
|
|
276
|
+
type AuthMiddleware = ReturnType<typeof createAuthMiddleware>;
|
|
307
277
|
//#endregion
|
|
308
|
-
export { AuthEndpoint, AuthMiddleware, createAuthEndpoint, createAuthMiddleware, optionsMiddleware };
|
|
309
|
-
//# sourceMappingURL=index.d.mts.map
|
|
278
|
+
export { AuthEndpoint, AuthMiddleware, createAuthEndpoint, createAuthMiddleware, optionsMiddleware };
|
package/dist/api/index.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { runWithEndpointContext } from "../context/endpoint-context.mjs";
|
|
2
|
-
import "../context/index.mjs";
|
|
3
2
|
import { createEndpoint, createMiddleware } from "better-call";
|
|
4
3
|
//#region src/api/index.ts
|
|
5
4
|
const optionsMiddleware = createMiddleware(async () => {
|
|
@@ -29,5 +28,3 @@ function createAuthEndpoint(pathOrOptions, handlerOrOptions, handlerOrNever) {
|
|
|
29
28
|
}
|
|
30
29
|
//#endregion
|
|
31
30
|
export { createAuthEndpoint, createAuthMiddleware, optionsMiddleware };
|
|
32
|
-
|
|
33
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -3,5 +3,4 @@ import { AsyncLocalStorage } from "node:async_hooks";
|
|
|
3
3
|
//#region src/async_hooks/index.d.ts
|
|
4
4
|
declare function getAsyncLocalStorage(): Promise<typeof AsyncLocalStorage>;
|
|
5
5
|
//#endregion
|
|
6
|
-
export { type AsyncLocalStorage, getAsyncLocalStorage };
|
|
7
|
-
//# sourceMappingURL=index.d.mts.map
|
|
6
|
+
export { type AsyncLocalStorage, getAsyncLocalStorage };
|
|
@@ -3,5 +3,4 @@ import { AsyncLocalStorage } from "node:async_hooks";
|
|
|
3
3
|
//#region src/async_hooks/pure.index.d.ts
|
|
4
4
|
declare function getAsyncLocalStorage(): Promise<typeof AsyncLocalStorage>;
|
|
5
5
|
//#endregion
|
|
6
|
-
export { getAsyncLocalStorage };
|
|
7
|
-
//# sourceMappingURL=pure.index.d.mts.map
|
|
6
|
+
export { getAsyncLocalStorage };
|
|
@@ -3,7 +3,7 @@ import { EndpointContext, InputContext } from "better-call";
|
|
|
3
3
|
import { AsyncLocalStorage } from "@better-auth/core/async_hooks";
|
|
4
4
|
|
|
5
5
|
//#region src/context/endpoint-context.d.ts
|
|
6
|
-
type AuthEndpointContext = Partial<InputContext<string, any
|
|
6
|
+
type AuthEndpointContext = Partial<InputContext<string, any> & EndpointContext<string, any>> & {
|
|
7
7
|
context: AuthContext;
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
@@ -15,5 +15,4 @@ declare function getCurrentAuthContextAsyncLocalStorage(): Promise<AsyncLocalSto
|
|
|
15
15
|
declare function getCurrentAuthContext(): Promise<AuthEndpointContext>;
|
|
16
16
|
declare function runWithEndpointContext<T>(context: AuthEndpointContext, fn: () => T): Promise<T>;
|
|
17
17
|
//#endregion
|
|
18
|
-
export { AuthEndpointContext, getCurrentAuthContext, getCurrentAuthContextAsyncLocalStorage, runWithEndpointContext };
|
|
19
|
-
//# sourceMappingURL=endpoint-context.d.mts.map
|
|
18
|
+
export { AuthEndpointContext, getCurrentAuthContext, getCurrentAuthContextAsyncLocalStorage, runWithEndpointContext };
|
|
@@ -3,5 +3,4 @@ import { AsyncLocalStorage } from "@better-auth/core/async_hooks";
|
|
|
3
3
|
//#region src/context/global.d.ts
|
|
4
4
|
declare function getBetterAuthVersion(): string;
|
|
5
5
|
//#endregion
|
|
6
|
-
export { getBetterAuthVersion };
|
|
7
|
-
//# sourceMappingURL=global.d.mts.map
|
|
6
|
+
export { getBetterAuthVersion };
|
package/dist/context/global.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const symbol = Symbol.for("better-auth:global");
|
|
3
3
|
let bind = null;
|
|
4
4
|
const __context = {};
|
|
5
|
-
const __betterAuthVersion = "1.
|
|
5
|
+
const __betterAuthVersion = "1.6.0";
|
|
6
6
|
/**
|
|
7
7
|
* We store context instance in the globalThis.
|
|
8
8
|
*
|
|
@@ -34,5 +34,3 @@ function getBetterAuthVersion() {
|
|
|
34
34
|
}
|
|
35
35
|
//#endregion
|
|
36
36
|
export { __getBetterAuthGlobal, getBetterAuthVersion };
|
|
37
|
-
|
|
38
|
-
//# sourceMappingURL=global.mjs.map
|
|
@@ -24,5 +24,4 @@ interface RequestState<T> {
|
|
|
24
24
|
*/
|
|
25
25
|
declare function defineRequestState<T>(initFn: () => T | Promise<T>): RequestState<T>;
|
|
26
26
|
//#endregion
|
|
27
|
-
export { RequestState, RequestStateWeakMap, defineRequestState, getCurrentRequestState, getRequestStateAsyncLocalStorage, hasRequestState, runWithRequestState };
|
|
28
|
-
//# sourceMappingURL=request-state.d.mts.map
|
|
27
|
+
export { RequestState, RequestStateWeakMap, defineRequestState, getCurrentRequestState, getRequestStateAsyncLocalStorage, hasRequestState, runWithRequestState };
|
|
@@ -21,5 +21,4 @@ declare const runWithTransaction: <R>(adapter: DBAdapter, fn: () => R) => Promis
|
|
|
21
21
|
*/
|
|
22
22
|
declare const queueAfterTransactionHook: (hook: () => Promise<void>) => Promise<void>;
|
|
23
23
|
//#endregion
|
|
24
|
-
export { getCurrentAdapter, getCurrentDBAdapterAsyncLocalStorage, queueAfterTransactionHook, runWithAdapter, runWithTransaction };
|
|
25
|
-
//# sourceMappingURL=transaction.d.mts.map
|
|
24
|
+
export { getCurrentAdapter, getCurrentDBAdapterAsyncLocalStorage, queueAfterTransactionHook, runWithAdapter, runWithTransaction };
|
|
@@ -14,5 +14,4 @@ declare const createAdapterFactory: <Options extends BetterAuthOptions>({
|
|
|
14
14
|
config: cfg
|
|
15
15
|
}: AdapterFactoryOptions) => AdapterFactory<Options>;
|
|
16
16
|
//#endregion
|
|
17
|
-
export { AdapterFactory, createAdapterFactory };
|
|
18
|
-
//# sourceMappingURL=factory.d.mts.map
|
|
17
|
+
export { AdapterFactory, createAdapterFactory };
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { getAuthTables } from "../get-tables.mjs";
|
|
2
2
|
import { getColorDepth } from "../../env/color-depth.mjs";
|
|
3
3
|
import { TTY_COLORS, createLogger } from "../../env/logger.mjs";
|
|
4
|
-
import "../../env/index.mjs";
|
|
5
4
|
import { BetterAuthError } from "../../error/index.mjs";
|
|
6
5
|
import { ATTR_DB_COLLECTION_NAME, ATTR_DB_OPERATION_NAME } from "../../instrumentation/attributes.mjs";
|
|
7
6
|
import { withSpan } from "../../instrumentation/tracer.mjs";
|
|
8
|
-
import "../../instrumentation/index.mjs";
|
|
9
7
|
import { safeJSONParse } from "../../utils/json.mjs";
|
|
10
8
|
import { initGetDefaultModelName } from "./get-default-model-name.mjs";
|
|
11
9
|
import { initGetDefaultFieldName } from "./get-default-field-name.mjs";
|
|
@@ -215,7 +213,7 @@ const createAdapterFactory = ({ adapter: customAdapter, config: cfg }) => (optio
|
|
|
215
213
|
if (!where) return void 0;
|
|
216
214
|
const newMappedKeys = config.mapKeysTransformInput ?? {};
|
|
217
215
|
return where.map((w) => {
|
|
218
|
-
const { field: unsafe_field, value, operator = "eq", connector = "AND" } = w;
|
|
216
|
+
const { field: unsafe_field, value, operator = "eq", connector = "AND", mode = "sensitive" } = w;
|
|
219
217
|
if (operator === "in") {
|
|
220
218
|
if (!Array.isArray(value)) throw new BetterAuthError("Value must be an array");
|
|
221
219
|
}
|
|
@@ -268,7 +266,8 @@ const createAdapterFactory = ({ adapter: customAdapter, config: cfg }) => (optio
|
|
|
268
266
|
operator,
|
|
269
267
|
connector,
|
|
270
268
|
field: fieldName,
|
|
271
|
-
value: newValue
|
|
269
|
+
value: newValue,
|
|
270
|
+
mode
|
|
272
271
|
};
|
|
273
272
|
});
|
|
274
273
|
};
|
|
@@ -753,5 +752,3 @@ function formatAction(action) {
|
|
|
753
752
|
}
|
|
754
753
|
//#endregion
|
|
755
754
|
export { createAdapterFactory };
|
|
756
|
-
|
|
757
|
-
//# sourceMappingURL=factory.mjs.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { logger } from "../../env/logger.mjs";
|
|
2
|
-
import "../../env/index.mjs";
|
|
3
2
|
import { generateId } from "../../utils/id.mjs";
|
|
4
3
|
import { initGetDefaultModelName } from "./get-default-model-name.mjs";
|
|
5
4
|
//#region src/db/adapter/get-id-field.ts
|
|
@@ -63,5 +62,3 @@ const initGetIdField = ({ usePlural, schema, disableIdGeneration, options, custo
|
|
|
63
62
|
};
|
|
64
63
|
//#endregion
|
|
65
64
|
export { initGetIdField };
|
|
66
|
-
|
|
67
|
-
//# sourceMappingURL=get-id-field.mjs.map
|
|
@@ -298,6 +298,14 @@ type Where = {
|
|
|
298
298
|
* @default AND
|
|
299
299
|
*/
|
|
300
300
|
connector?: ("AND" | "OR") | undefined;
|
|
301
|
+
/**
|
|
302
|
+
* Case sensitivity for string comparisons.
|
|
303
|
+
* When "insensitive", string equality and pattern matching (contains, starts_with, ends_with)
|
|
304
|
+
* will be case-insensitive. Only applies to string values.
|
|
305
|
+
*
|
|
306
|
+
* @default "sensitive"
|
|
307
|
+
*/
|
|
308
|
+
mode?: "sensitive" | "insensitive" | undefined;
|
|
301
309
|
};
|
|
302
310
|
/**
|
|
303
311
|
* JoinOption configuration for relational queries.
|
|
@@ -514,5 +522,4 @@ interface DBAdapterInstance<Options extends BetterAuthOptions = BetterAuthOption
|
|
|
514
522
|
(options: BetterAuthOptions): DBAdapter<Options>;
|
|
515
523
|
}
|
|
516
524
|
//#endregion
|
|
517
|
-
export { AdapterFactory, AdapterFactoryConfig, AdapterFactoryCustomizeAdapterCreator, AdapterFactoryOptions, AdapterTestDebugLogs, CleanedWhere, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, JoinConfig, JoinOption, Where, WhereOperator, createAdapterFactory, deepmerge, initGetDefaultFieldName, initGetDefaultModelName, initGetFieldAttributes, initGetFieldName, initGetIdField, initGetModelName, whereOperators, withApplyDefault };
|
|
518
|
-
//# sourceMappingURL=index.d.mts.map
|
|
525
|
+
export { AdapterFactory, AdapterFactoryConfig, AdapterFactoryCustomizeAdapterCreator, AdapterFactoryOptions, AdapterTestDebugLogs, CleanedWhere, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, JoinConfig, JoinOption, Where, WhereOperator, createAdapterFactory, deepmerge, initGetDefaultFieldName, initGetDefaultModelName, initGetFieldAttributes, initGetFieldName, initGetIdField, initGetModelName, whereOperators, withApplyDefault };
|
|
@@ -22,5 +22,3 @@ const whereOperators = [
|
|
|
22
22
|
];
|
|
23
23
|
//#endregion
|
|
24
24
|
export { createAdapterFactory, deepmerge, initGetDefaultFieldName, initGetDefaultModelName, initGetFieldAttributes, initGetFieldName, initGetIdField, initGetModelName, whereOperators, withApplyDefault };
|
|
25
|
-
|
|
26
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -102,5 +102,4 @@ type AdapterTestDebugLogs = {
|
|
|
102
102
|
printDebugLogs: () => void;
|
|
103
103
|
};
|
|
104
104
|
//#endregion
|
|
105
|
-
export { AdapterFactoryConfig, AdapterFactoryCustomizeAdapterCreator, AdapterFactoryOptions, AdapterTestDebugLogs };
|
|
106
|
-
//# sourceMappingURL=types.d.mts.map
|
|
105
|
+
export { AdapterFactoryConfig, AdapterFactoryCustomizeAdapterCreator, AdapterFactoryOptions, AdapterTestDebugLogs };
|
|
@@ -4,5 +4,4 @@ import { DBFieldAttribute } from "../type.mjs";
|
|
|
4
4
|
declare function withApplyDefault(value: any, field: DBFieldAttribute, action: "create" | "update" | "findOne" | "findMany"): any;
|
|
5
5
|
declare function deepmerge<T>(target: T, source: Partial<T>): T;
|
|
6
6
|
//#endregion
|
|
7
|
-
export { deepmerge, withApplyDefault };
|
|
8
|
-
//# sourceMappingURL=utils.d.mts.map
|
|
7
|
+
export { deepmerge, withApplyDefault };
|
package/dist/db/get-tables.d.mts
CHANGED
|
@@ -3,5 +3,4 @@ import { BetterAuthOptions } from "../types/init-options.mjs";
|
|
|
3
3
|
//#region src/db/get-tables.d.ts
|
|
4
4
|
declare const getAuthTables: (options: BetterAuthOptions) => BetterAuthDBSchema;
|
|
5
5
|
//#endregion
|
|
6
|
-
export { getAuthTables };
|
|
7
|
-
//# sourceMappingURL=get-tables.d.mts.map
|
|
6
|
+
export { getAuthTables };
|
package/dist/db/get-tables.mjs
CHANGED
package/dist/db/plugin.d.mts
CHANGED
|
@@ -25,5 +25,4 @@ type BaseAccount = z.infer<typeof accountSchema>;
|
|
|
25
25
|
*/
|
|
26
26
|
type Account<DBOptions extends BetterAuthOptions["account"] = BetterAuthOptions["account"], Plugins extends BetterAuthOptions["plugins"] = BetterAuthOptions["plugins"]> = Prettify<BaseAccount & InferDBFieldsFromOptions<DBOptions> & InferDBFieldsFromPlugins<"account", Plugins>>;
|
|
27
27
|
//#endregion
|
|
28
|
-
export { Account, BaseAccount, accountSchema };
|
|
29
|
-
//# sourceMappingURL=account.d.mts.map
|
|
28
|
+
export { Account, BaseAccount, accountSchema };
|
|
@@ -15,5 +15,4 @@ type BaseRateLimit = z.infer<typeof rateLimitSchema>;
|
|
|
15
15
|
*/
|
|
16
16
|
type RateLimit<DBOptions extends BetterAuthOptions["rateLimit"] = BetterAuthOptions["rateLimit"], Plugins extends BetterAuthOptions["plugins"] = BetterAuthOptions["plugins"]> = Prettify<BaseRateLimit & InferDBFieldsFromOptions<DBOptions> & InferDBFieldsFromPlugins<"rateLimit", Plugins>>;
|
|
17
17
|
//#endregion
|
|
18
|
-
export { BaseRateLimit, RateLimit, rateLimitSchema };
|
|
19
|
-
//# sourceMappingURL=rate-limit.d.mts.map
|
|
18
|
+
export { BaseRateLimit, RateLimit, rateLimitSchema };
|
|
@@ -20,5 +20,4 @@ type BaseSession = z.infer<typeof sessionSchema>;
|
|
|
20
20
|
*/
|
|
21
21
|
type Session<DBOptions extends BetterAuthOptions["session"] = BetterAuthOptions["session"], Plugins extends BetterAuthOptions["plugins"] = BetterAuthOptions["plugins"]> = Prettify<z.infer<typeof sessionSchema> & InferDBFieldsFromOptions<DBOptions> & InferDBFieldsFromPlugins<"session", Plugins>>;
|
|
22
22
|
//#endregion
|
|
23
|
-
export { BaseSession, Session, sessionSchema };
|
|
24
|
-
//# sourceMappingURL=session.d.mts.map
|
|
23
|
+
export { BaseSession, Session, sessionSchema };
|
|
@@ -19,5 +19,4 @@ type BaseUser = z.infer<typeof userSchema>;
|
|
|
19
19
|
*/
|
|
20
20
|
type User<DBOptions extends BetterAuthOptions["user"] = BetterAuthOptions["user"], Plugins extends BetterAuthOptions["plugins"] = BetterAuthOptions["plugins"]> = Prettify<BaseUser & InferDBFieldsFromOptions<DBOptions> & InferDBFieldsFromPlugins<"user", Plugins>>;
|
|
21
21
|
//#endregion
|
|
22
|
-
export { BaseUser, User, userSchema };
|
|
23
|
-
//# sourceMappingURL=user.d.mts.map
|
|
22
|
+
export { BaseUser, User, userSchema };
|
package/dist/db/schema/user.mjs
CHANGED
|
@@ -18,5 +18,4 @@ type BaseVerification = z.infer<typeof verificationSchema>;
|
|
|
18
18
|
*/
|
|
19
19
|
type Verification<DBOptions extends BetterAuthOptions["verification"] = BetterAuthOptions["verification"], Plugins extends BetterAuthOptions["plugins"] = BetterAuthOptions["plugins"]> = Prettify<BaseVerification & InferDBFieldsFromOptions<DBOptions> & InferDBFieldsFromPlugins<"verification", Plugins>>;
|
|
20
20
|
//#endregion
|
|
21
|
-
export { BaseVerification, Verification, verificationSchema };
|
|
22
|
-
//# sourceMappingURL=verification.d.mts.map
|
|
21
|
+
export { BaseVerification, Verification, verificationSchema };
|
package/dist/db/type.d.mts
CHANGED
|
@@ -164,5 +164,4 @@ interface SecondaryStorage {
|
|
|
164
164
|
delete: (key: string) => Awaitable<void | null | string>;
|
|
165
165
|
}
|
|
166
166
|
//#endregion
|
|
167
|
-
export { BaseModelNames, BetterAuthDBSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPrimitive, InferDBFieldInput, InferDBFieldOutput, InferDBFieldsFromOptions, InferDBFieldsFromOptionsInput, InferDBFieldsFromPlugins, InferDBFieldsFromPluginsInput, InferDBFieldsInput, InferDBFieldsOutput, InferDBValueType, ModelNames, SecondaryStorage };
|
|
168
|
-
//# sourceMappingURL=type.d.mts.map
|
|
167
|
+
export { BaseModelNames, BetterAuthDBSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPrimitive, InferDBFieldInput, InferDBFieldOutput, InferDBFieldsFromOptions, InferDBFieldsFromOptionsInput, InferDBFieldsFromPlugins, InferDBFieldsFromPluginsInput, InferDBFieldsInput, InferDBFieldsOutput, InferDBValueType, ModelNames, SecondaryStorage };
|
package/dist/env/color-depth.mjs
CHANGED
package/dist/env/env-impl.d.mts
CHANGED
|
@@ -29,5 +29,4 @@ declare const ENV: Readonly<{
|
|
|
29
29
|
readonly BETTER_AUTH_TELEMETRY_ENDPOINT: string | undefined;
|
|
30
30
|
}>;
|
|
31
31
|
//#endregion
|
|
32
|
-
export { ENV, EnvObject, env, getBooleanEnvVar, getEnvVar, isDevelopment, isProduction, isTest, nodeENV };
|
|
33
|
-
//# sourceMappingURL=env-impl.d.mts.map
|
|
32
|
+
export { ENV, EnvObject, env, getBooleanEnvVar, getEnvVar, isDevelopment, isProduction, isTest, nodeENV };
|
package/dist/env/env-impl.mjs
CHANGED
package/dist/env/logger.d.mts
CHANGED
|
@@ -45,5 +45,4 @@ type InternalLogger = { [K in LogLevel]: (...params: LogHandlerParams) => void }
|
|
|
45
45
|
declare const createLogger: (options?: Logger | undefined) => InternalLogger;
|
|
46
46
|
declare const logger: InternalLogger;
|
|
47
47
|
//#endregion
|
|
48
|
-
export { InternalLogger, LogHandlerParams, LogLevel, Logger, TTY_COLORS, createLogger, levels, logger, shouldPublishLog };
|
|
49
|
-
//# sourceMappingURL=logger.d.mts.map
|
|
48
|
+
export { InternalLogger, LogHandlerParams, LogLevel, Logger, TTY_COLORS, createLogger, levels, logger, shouldPublishLog };
|
package/dist/env/logger.mjs
CHANGED
package/dist/error/codes.d.mts
CHANGED
package/dist/error/codes.mjs
CHANGED
package/dist/error/index.d.mts
CHANGED
|
@@ -16,5 +16,4 @@ declare class APIError extends APIError$1 {
|
|
|
16
16
|
}): APIError;
|
|
17
17
|
}
|
|
18
18
|
//#endregion
|
|
19
|
-
export { APIError, type APIErrorCode, BASE_ERROR_CODES, BetterAuthError };
|
|
20
|
-
//# sourceMappingURL=index.d.mts.map
|
|
19
|
+
export { APIError, type APIErrorCode, BASE_ERROR_CODES, BetterAuthError };
|
package/dist/error/index.mjs
CHANGED
|
@@ -8,5 +8,4 @@ declare const ATTR_HOOK_TYPE: "better_auth.hook.type";
|
|
|
8
8
|
/** Execution context (e.g. user, plugin:id). */
|
|
9
9
|
declare const ATTR_CONTEXT: "better_auth.context";
|
|
10
10
|
//#endregion
|
|
11
|
-
export { ATTR_CONTEXT, ATTR_DB_COLLECTION_NAME, ATTR_DB_OPERATION_NAME, ATTR_HOOK_TYPE, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_HTTP_ROUTE, ATTR_OPERATION_ID };
|
|
12
|
-
//# sourceMappingURL=attributes.d.mts.map
|
|
11
|
+
export { ATTR_CONTEXT, ATTR_DB_COLLECTION_NAME, ATTR_DB_OPERATION_NAME, ATTR_HOOK_TYPE, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_HTTP_ROUTE, ATTR_OPERATION_ID };
|