@better-auth/core 1.5.6 → 1.6.0-beta.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 +42 -13
- package/dist/api/index.mjs +0 -4
- 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 -3
- package/dist/context/global.d.mts +1 -2
- package/dist/context/global.mjs +1 -3
- package/dist/context/index.mjs +1 -2
- package/dist/context/request-state.d.mts +1 -2
- package/dist/context/request-state.mjs +0 -3
- package/dist/context/transaction.d.mts +1 -2
- package/dist/context/transaction.mjs +0 -3
- package/dist/db/adapter/factory.d.mts +1 -2
- package/dist/db/adapter/factory.mjs +3 -7
- package/dist/db/adapter/get-default-field-name.d.mts +1 -2
- package/dist/db/adapter/get-default-field-name.mjs +0 -3
- package/dist/db/adapter/get-default-model-name.d.mts +1 -2
- package/dist/db/adapter/get-default-model-name.mjs +0 -3
- package/dist/db/adapter/get-field-attributes.d.mts +1 -2
- package/dist/db/adapter/get-field-attributes.mjs +0 -3
- package/dist/db/adapter/get-field-name.d.mts +1 -2
- package/dist/db/adapter/get-field-name.mjs +0 -3
- package/dist/db/adapter/get-id-field.d.mts +1 -2
- package/dist/db/adapter/get-id-field.mjs +0 -4
- package/dist/db/adapter/get-model-name.d.mts +1 -2
- package/dist/db/adapter/get-model-name.mjs +0 -3
- package/dist/db/adapter/index.d.mts +9 -2
- package/dist/db/adapter/index.mjs +0 -3
- 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/index.mjs +1 -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 -3
- package/dist/db/schema/rate-limit.d.mts +1 -2
- package/dist/db/schema/rate-limit.mjs +0 -3
- package/dist/db/schema/session.d.mts +1 -2
- package/dist/db/schema/session.mjs +0 -3
- package/dist/db/schema/shared.d.mts +1 -2
- package/dist/db/schema/shared.mjs +0 -3
- package/dist/db/schema/user.d.mts +1 -2
- package/dist/db/schema/user.mjs +0 -3
- package/dist/db/schema/verification.d.mts +1 -2
- package/dist/db/schema/verification.mjs +0 -3
- package/dist/db/type.d.mts +1 -2
- package/dist/env/color-depth.d.mts +1 -2
- package/dist/env/color-depth.mjs +0 -3
- package/dist/env/env-impl.d.mts +1 -2
- package/dist/env/env-impl.mjs +0 -2
- package/dist/env/index.mjs +1 -2
- package/dist/env/logger.d.mts +1 -2
- package/dist/env/logger.mjs +0 -3
- package/dist/error/codes.d.mts +1 -2
- package/dist/error/codes.mjs +0 -3
- package/dist/error/index.d.mts +1 -2
- package/dist/error/index.mjs +0 -3
- package/dist/index.mjs +1 -1
- package/dist/instrumentation/attributes.d.mts +1 -2
- package/dist/instrumentation/attributes.mjs +0 -3
- package/dist/instrumentation/index.mjs +1 -2
- package/dist/instrumentation/tracer.d.mts +1 -2
- package/dist/instrumentation/tracer.mjs +29 -16
- package/dist/oauth2/client-credentials-token.d.mts +1 -2
- package/dist/oauth2/client-credentials-token.mjs +0 -3
- package/dist/oauth2/create-authorization-url.d.mts +1 -2
- package/dist/oauth2/create-authorization-url.mjs +0 -3
- package/dist/oauth2/index.mjs +1 -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 -3
- package/dist/oauth2/utils.d.mts +1 -2
- package/dist/oauth2/utils.mjs +0 -3
- package/dist/oauth2/validate-authorization-code.d.mts +1 -2
- package/dist/oauth2/validate-authorization-code.mjs +0 -4
- package/dist/oauth2/verify.d.mts +1 -2
- package/dist/oauth2/verify.mjs +0 -4
- package/dist/social-providers/apple.d.mts +1 -2
- package/dist/social-providers/apple.mjs +0 -4
- package/dist/social-providers/atlassian.d.mts +1 -2
- package/dist/social-providers/atlassian.mjs +0 -5
- package/dist/social-providers/cognito.d.mts +1 -2
- package/dist/social-providers/cognito.mjs +0 -5
- package/dist/social-providers/discord.d.mts +1 -2
- package/dist/social-providers/discord.mjs +0 -4
- package/dist/social-providers/dropbox.d.mts +1 -2
- package/dist/social-providers/dropbox.mjs +0 -4
- package/dist/social-providers/facebook.d.mts +1 -2
- package/dist/social-providers/facebook.mjs +0 -4
- package/dist/social-providers/figma.d.mts +1 -2
- package/dist/social-providers/figma.mjs +0 -5
- package/dist/social-providers/github.d.mts +1 -2
- package/dist/social-providers/github.mjs +0 -5
- package/dist/social-providers/gitlab.d.mts +1 -2
- package/dist/social-providers/gitlab.mjs +0 -4
- package/dist/social-providers/google.d.mts +1 -2
- package/dist/social-providers/google.mjs +0 -5
- package/dist/social-providers/huggingface.d.mts +1 -2
- package/dist/social-providers/huggingface.mjs +0 -4
- package/dist/social-providers/index.d.mts +1 -2
- package/dist/social-providers/index.mjs +0 -3
- package/dist/social-providers/kakao.d.mts +1 -2
- package/dist/social-providers/kakao.mjs +0 -4
- package/dist/social-providers/kick.d.mts +1 -2
- package/dist/social-providers/kick.mjs +0 -4
- package/dist/social-providers/line.d.mts +1 -2
- package/dist/social-providers/line.mjs +0 -4
- package/dist/social-providers/linear.d.mts +1 -2
- package/dist/social-providers/linear.mjs +0 -4
- package/dist/social-providers/linkedin.d.mts +1 -2
- package/dist/social-providers/linkedin.mjs +0 -4
- package/dist/social-providers/microsoft-entra-id.d.mts +1 -2
- package/dist/social-providers/microsoft-entra-id.mjs +0 -5
- package/dist/social-providers/naver.d.mts +1 -2
- package/dist/social-providers/naver.mjs +0 -4
- package/dist/social-providers/notion.d.mts +1 -2
- package/dist/social-providers/notion.mjs +0 -4
- package/dist/social-providers/paybin.d.mts +1 -2
- package/dist/social-providers/paybin.mjs +0 -5
- package/dist/social-providers/paypal.d.mts +1 -2
- package/dist/social-providers/paypal.mjs +0 -5
- package/dist/social-providers/polar.d.mts +1 -2
- package/dist/social-providers/polar.mjs +0 -4
- package/dist/social-providers/railway.d.mts +1 -2
- package/dist/social-providers/railway.mjs +0 -4
- package/dist/social-providers/reddit.d.mts +1 -2
- package/dist/social-providers/reddit.mjs +0 -4
- package/dist/social-providers/roblox.d.mts +1 -2
- package/dist/social-providers/roblox.mjs +0 -4
- package/dist/social-providers/salesforce.d.mts +1 -2
- package/dist/social-providers/salesforce.mjs +0 -5
- package/dist/social-providers/slack.d.mts +1 -2
- package/dist/social-providers/slack.mjs +0 -4
- package/dist/social-providers/spotify.d.mts +1 -2
- package/dist/social-providers/spotify.mjs +0 -4
- package/dist/social-providers/tiktok.d.mts +1 -2
- package/dist/social-providers/tiktok.mjs +0 -4
- package/dist/social-providers/twitch.d.mts +1 -2
- package/dist/social-providers/twitch.mjs +0 -5
- package/dist/social-providers/twitter.d.mts +1 -2
- package/dist/social-providers/twitter.mjs +0 -4
- package/dist/social-providers/vercel.d.mts +1 -2
- package/dist/social-providers/vercel.mjs +0 -4
- package/dist/social-providers/vk.d.mts +1 -2
- package/dist/social-providers/vk.mjs +0 -4
- package/dist/social-providers/wechat.d.mts +1 -2
- package/dist/social-providers/wechat.mjs +0 -3
- package/dist/social-providers/zoom.d.mts +1 -2
- package/dist/social-providers/zoom.mjs +0 -4
- package/dist/types/context.d.mts +3 -5
- 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 +6 -3
- 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 -3
- package/dist/utils/ip.d.mts +1 -2
- package/dist/utils/ip.mjs +0 -3
- package/dist/utils/json.d.mts +1 -2
- package/dist/utils/json.mjs +0 -4
- 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 +11 -9
- package/src/api/index.ts +151 -41
- package/src/context/endpoint-context.ts +2 -1
- 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 +2 -3
- package/src/types/init-options.ts +13 -4
- package/src/types/plugin-client.ts +1 -0
- package/src/types/plugin.ts +15 -1
- 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,13 +4,15 @@ 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 { EndpointContext,
|
|
7
|
+
import { Endpoint, EndpointContext, EndpointMetadata, HTTPMethod, Middleware, ResolveBodyInput, ResolveErrorInput, ResolveMetaInput, ResolveQueryInput, StandardSchemaV1 } 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: Middleware<(inputContext: Record<string, any>) => Promise<AuthContext>>;
|
|
12
12
|
declare const createAuthMiddleware: {
|
|
13
|
-
<
|
|
13
|
+
<R>(options: {
|
|
14
|
+
use?: Middleware[];
|
|
15
|
+
}, handler: (ctx: better_call0.MiddlewareContext<{
|
|
14
16
|
returned?: unknown | undefined;
|
|
15
17
|
responseHeaders?: Headers | undefined;
|
|
16
18
|
} & _better_auth_core0.PluginContext<_better_auth_core0.BetterAuthOptions> & _better_auth_core0.InfoContext & {
|
|
@@ -138,8 +140,8 @@ declare const createAuthMiddleware: {
|
|
|
138
140
|
skipCSRFCheck: boolean;
|
|
139
141
|
runInBackground: (promise: Promise<unknown>) => void;
|
|
140
142
|
runInBackgroundOrAwait: (promise: Promise<unknown> | void) => _better_auth_core0.Awaitable<unknown>;
|
|
141
|
-
}>) => Promise<R>): (inputContext:
|
|
142
|
-
<
|
|
143
|
+
}>) => Promise<R>): Middleware<(inputContext: Record<string, any>) => Promise<R>>;
|
|
144
|
+
<R>(handler: (ctx: better_call0.MiddlewareContext<{
|
|
143
145
|
returned?: unknown | undefined;
|
|
144
146
|
responseHeaders?: Headers | undefined;
|
|
145
147
|
} & _better_auth_core0.PluginContext<_better_auth_core0.BetterAuthOptions> & _better_auth_core0.InfoContext & {
|
|
@@ -267,13 +269,40 @@ declare const createAuthMiddleware: {
|
|
|
267
269
|
skipCSRFCheck: boolean;
|
|
268
270
|
runInBackground: (promise: Promise<unknown>) => void;
|
|
269
271
|
runInBackgroundOrAwait: (promise: Promise<unknown> | void) => _better_auth_core0.Awaitable<unknown>;
|
|
270
|
-
}>) => Promise<
|
|
272
|
+
}>) => Promise<R>): Middleware<(inputContext: Record<string, any>) => Promise<R>>;
|
|
271
273
|
};
|
|
272
|
-
type
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
274
|
+
type BodyOption<M, B extends object | undefined = undefined> = M extends "GET" | "HEAD" | ("GET" | "HEAD")[] ? {
|
|
275
|
+
body?: never;
|
|
276
|
+
} : {
|
|
277
|
+
body?: B;
|
|
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>;
|
|
277
307
|
//#endregion
|
|
278
|
-
export { AuthEndpoint, AuthMiddleware, createAuthEndpoint, createAuthMiddleware, optionsMiddleware };
|
|
279
|
-
//# sourceMappingURL=index.d.mts.map
|
|
308
|
+
export { AuthEndpoint, AuthMiddleware, createAuthEndpoint, createAuthMiddleware, optionsMiddleware };
|
package/dist/api/index.mjs
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { runWithEndpointContext } from "../context/endpoint-context.mjs";
|
|
2
|
-
import "../context/index.mjs";
|
|
3
2
|
import { createEndpoint, createMiddleware } from "better-call";
|
|
4
|
-
|
|
5
3
|
//#region src/api/index.ts
|
|
6
4
|
const optionsMiddleware = createMiddleware(async () => {
|
|
7
5
|
/**
|
|
@@ -28,7 +26,5 @@ function createAuthEndpoint(pathOrOptions, handlerOrOptions, handlerOrNever) {
|
|
|
28
26
|
use: [...options?.use || [], ...use]
|
|
29
27
|
}, async (ctx) => runWithEndpointContext(ctx, () => handler(ctx)));
|
|
30
28
|
}
|
|
31
|
-
|
|
32
29
|
//#endregion
|
|
33
30
|
export { createAuthEndpoint, createAuthMiddleware, optionsMiddleware };
|
|
34
|
-
//# 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> & EndpointContext<string, any>> & {
|
|
6
|
+
type AuthEndpointContext = Partial<InputContext<string, any, any, any, any, any> & EndpointContext<string, any, any, any, any, any, any, AuthContext>> & {
|
|
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 };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { __getBetterAuthGlobal } from "./global.mjs";
|
|
2
2
|
import { getAsyncLocalStorage } from "@better-auth/core/async_hooks";
|
|
3
|
-
|
|
4
3
|
//#region src/context/endpoint-context.ts
|
|
5
4
|
const ensureAsyncStorage = async () => {
|
|
6
5
|
const betterAuthGlobal = __getBetterAuthGlobal();
|
|
@@ -26,7 +25,5 @@ async function getCurrentAuthContext() {
|
|
|
26
25
|
async function runWithEndpointContext(context, fn) {
|
|
27
26
|
return (await ensureAsyncStorage()).run(context, fn);
|
|
28
27
|
}
|
|
29
|
-
|
|
30
28
|
//#endregion
|
|
31
29
|
export { getCurrentAuthContext, getCurrentAuthContextAsyncLocalStorage, runWithEndpointContext };
|
|
32
|
-
//# sourceMappingURL=endpoint-context.mjs.map
|
|
@@ -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-beta.0";
|
|
6
6
|
/**
|
|
7
7
|
* We store context instance in the globalThis.
|
|
8
8
|
*
|
|
@@ -32,7 +32,5 @@ function __getBetterAuthGlobal() {
|
|
|
32
32
|
function getBetterAuthVersion() {
|
|
33
33
|
return __getBetterAuthGlobal().version;
|
|
34
34
|
}
|
|
35
|
-
|
|
36
35
|
//#endregion
|
|
37
36
|
export { __getBetterAuthGlobal, getBetterAuthVersion };
|
|
38
|
-
//# sourceMappingURL=global.mjs.map
|
package/dist/context/index.mjs
CHANGED
|
@@ -2,5 +2,4 @@ import { getBetterAuthVersion } from "./global.mjs";
|
|
|
2
2
|
import { getCurrentAuthContext, getCurrentAuthContextAsyncLocalStorage, runWithEndpointContext } from "./endpoint-context.mjs";
|
|
3
3
|
import { defineRequestState, getCurrentRequestState, getRequestStateAsyncLocalStorage, hasRequestState, runWithRequestState } from "./request-state.mjs";
|
|
4
4
|
import { getCurrentAdapter, getCurrentDBAdapterAsyncLocalStorage, queueAfterTransactionHook, runWithAdapter, runWithTransaction } from "./transaction.mjs";
|
|
5
|
-
|
|
6
|
-
export { defineRequestState, getBetterAuthVersion, getCurrentAdapter, getCurrentAuthContext, getCurrentAuthContextAsyncLocalStorage, getCurrentDBAdapterAsyncLocalStorage, getCurrentRequestState, getRequestStateAsyncLocalStorage, hasRequestState, queueAfterTransactionHook, runWithAdapter, runWithEndpointContext, runWithRequestState, runWithTransaction };
|
|
5
|
+
export { defineRequestState, getBetterAuthVersion, getCurrentAdapter, getCurrentAuthContext, getCurrentAuthContextAsyncLocalStorage, getCurrentDBAdapterAsyncLocalStorage, getCurrentRequestState, getRequestStateAsyncLocalStorage, hasRequestState, queueAfterTransactionHook, runWithAdapter, runWithEndpointContext, runWithRequestState, runWithTransaction };
|
|
@@ -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 };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { __getBetterAuthGlobal } from "./global.mjs";
|
|
2
2
|
import { getAsyncLocalStorage } from "@better-auth/core/async_hooks";
|
|
3
|
-
|
|
4
3
|
//#region src/context/request-state.ts
|
|
5
4
|
const ensureAsyncStorage = async () => {
|
|
6
5
|
const betterAuthGlobal = __getBetterAuthGlobal();
|
|
@@ -44,7 +43,5 @@ function defineRequestState(initFn) {
|
|
|
44
43
|
}
|
|
45
44
|
};
|
|
46
45
|
}
|
|
47
|
-
|
|
48
46
|
//#endregion
|
|
49
47
|
export { defineRequestState, getCurrentRequestState, getRequestStateAsyncLocalStorage, hasRequestState, runWithRequestState };
|
|
50
|
-
//# sourceMappingURL=request-state.mjs.map
|
|
@@ -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 };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { __getBetterAuthGlobal } from "./global.mjs";
|
|
2
2
|
import { getAsyncLocalStorage } from "@better-auth/core/async_hooks";
|
|
3
|
-
|
|
4
3
|
//#region src/context/transaction.ts
|
|
5
4
|
const ensureAsyncStorage = async () => {
|
|
6
5
|
const betterAuthGlobal = __getBetterAuthGlobal();
|
|
@@ -90,7 +89,5 @@ const queueAfterTransactionHook = async (hook) => {
|
|
|
90
89
|
return hook();
|
|
91
90
|
});
|
|
92
91
|
};
|
|
93
|
-
|
|
94
92
|
//#endregion
|
|
95
93
|
export { getCurrentAdapter, getCurrentDBAdapterAsyncLocalStorage, queueAfterTransactionHook, runWithAdapter, runWithTransaction };
|
|
96
|
-
//# sourceMappingURL=transaction.mjs.map
|
|
@@ -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";
|
|
@@ -14,7 +12,6 @@ import { initGetFieldAttributes } from "./get-field-attributes.mjs";
|
|
|
14
12
|
import { initGetFieldName } from "./get-field-name.mjs";
|
|
15
13
|
import { initGetModelName } from "./get-model-name.mjs";
|
|
16
14
|
import { withApplyDefault } from "./utils.mjs";
|
|
17
|
-
|
|
18
15
|
//#region src/db/adapter/factory.ts
|
|
19
16
|
let debugLogs = [];
|
|
20
17
|
let transactionId = -1;
|
|
@@ -216,7 +213,7 @@ const createAdapterFactory = ({ adapter: customAdapter, config: cfg }) => (optio
|
|
|
216
213
|
if (!where) return void 0;
|
|
217
214
|
const newMappedKeys = config.mapKeysTransformInput ?? {};
|
|
218
215
|
return where.map((w) => {
|
|
219
|
-
const { field: unsafe_field, value, operator = "eq", connector = "AND" } = w;
|
|
216
|
+
const { field: unsafe_field, value, operator = "eq", connector = "AND", mode = "sensitive" } = w;
|
|
220
217
|
if (operator === "in") {
|
|
221
218
|
if (!Array.isArray(value)) throw new BetterAuthError("Value must be an array");
|
|
222
219
|
}
|
|
@@ -269,7 +266,8 @@ const createAdapterFactory = ({ adapter: customAdapter, config: cfg }) => (optio
|
|
|
269
266
|
operator,
|
|
270
267
|
connector,
|
|
271
268
|
field: fieldName,
|
|
272
|
-
value: newValue
|
|
269
|
+
value: newValue,
|
|
270
|
+
mode
|
|
273
271
|
};
|
|
274
272
|
});
|
|
275
273
|
};
|
|
@@ -752,7 +750,5 @@ function formatMethod(method) {
|
|
|
752
750
|
function formatAction(action) {
|
|
753
751
|
return `${TTY_COLORS.dim}(${action})${TTY_COLORS.reset}`;
|
|
754
752
|
}
|
|
755
|
-
|
|
756
753
|
//#endregion
|
|
757
754
|
export { createAdapterFactory };
|
|
758
|
-
//# sourceMappingURL=factory.mjs.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BetterAuthError } from "../../error/index.mjs";
|
|
2
2
|
import { initGetDefaultModelName } from "./get-default-model-name.mjs";
|
|
3
|
-
|
|
4
3
|
//#region src/db/adapter/get-default-field-name.ts
|
|
5
4
|
const initGetDefaultFieldName = ({ schema, usePlural }) => {
|
|
6
5
|
const getDefaultModelName = initGetDefaultModelName({
|
|
@@ -33,7 +32,5 @@ const initGetDefaultFieldName = ({ schema, usePlural }) => {
|
|
|
33
32
|
};
|
|
34
33
|
return getDefaultFieldName;
|
|
35
34
|
};
|
|
36
|
-
|
|
37
35
|
//#endregion
|
|
38
36
|
export { initGetDefaultFieldName };
|
|
39
|
-
//# sourceMappingURL=get-default-field-name.mjs.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { BetterAuthError } from "../../error/index.mjs";
|
|
2
|
-
|
|
3
2
|
//#region src/db/adapter/get-default-model-name.ts
|
|
4
3
|
const initGetDefaultModelName = ({ usePlural, schema }) => {
|
|
5
4
|
/**
|
|
@@ -27,7 +26,5 @@ const initGetDefaultModelName = ({ usePlural, schema }) => {
|
|
|
27
26
|
};
|
|
28
27
|
return getDefaultModelName;
|
|
29
28
|
};
|
|
30
|
-
|
|
31
29
|
//#endregion
|
|
32
30
|
export { initGetDefaultModelName };
|
|
33
|
-
//# sourceMappingURL=get-default-model-name.mjs.map
|
|
@@ -2,7 +2,6 @@ import { BetterAuthError } from "../../error/index.mjs";
|
|
|
2
2
|
import { initGetDefaultModelName } from "./get-default-model-name.mjs";
|
|
3
3
|
import { initGetDefaultFieldName } from "./get-default-field-name.mjs";
|
|
4
4
|
import { initGetIdField } from "./get-id-field.mjs";
|
|
5
|
-
|
|
6
5
|
//#region src/db/adapter/get-field-attributes.ts
|
|
7
6
|
const initGetFieldAttributes = ({ usePlural, schema, options, customIdGenerator, disableIdGeneration }) => {
|
|
8
7
|
const getDefaultModelName = initGetDefaultModelName({
|
|
@@ -34,7 +33,5 @@ const initGetFieldAttributes = ({ usePlural, schema, options, customIdGenerator,
|
|
|
34
33
|
};
|
|
35
34
|
return getFieldAttributes;
|
|
36
35
|
};
|
|
37
|
-
|
|
38
36
|
//#endregion
|
|
39
37
|
export { initGetFieldAttributes };
|
|
40
|
-
//# sourceMappingURL=get-field-attributes.mjs.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { initGetDefaultModelName } from "./get-default-model-name.mjs";
|
|
2
2
|
import { initGetDefaultFieldName } from "./get-default-field-name.mjs";
|
|
3
|
-
|
|
4
3
|
//#region src/db/adapter/get-field-name.ts
|
|
5
4
|
const initGetFieldName = ({ schema, usePlural }) => {
|
|
6
5
|
const getDefaultModelName = initGetDefaultModelName({
|
|
@@ -28,7 +27,5 @@ const initGetFieldName = ({ schema, usePlural }) => {
|
|
|
28
27
|
}
|
|
29
28
|
return getFieldName;
|
|
30
29
|
};
|
|
31
|
-
|
|
32
30
|
//#endregion
|
|
33
31
|
export { initGetFieldName };
|
|
34
|
-
//# sourceMappingURL=get-field-name.mjs.map
|
|
@@ -1,8 +1,6 @@
|
|
|
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
|
-
|
|
6
4
|
//#region src/db/adapter/get-id-field.ts
|
|
7
5
|
const initGetIdField = ({ usePlural, schema, disableIdGeneration, options, customIdGenerator, supportsUUIDs }) => {
|
|
8
6
|
const getDefaultModelName = initGetDefaultModelName({
|
|
@@ -62,7 +60,5 @@ const initGetIdField = ({ usePlural, schema, disableIdGeneration, options, custo
|
|
|
62
60
|
};
|
|
63
61
|
return idField;
|
|
64
62
|
};
|
|
65
|
-
|
|
66
63
|
//#endregion
|
|
67
64
|
export { initGetIdField };
|
|
68
|
-
//# sourceMappingURL=get-id-field.mjs.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { initGetDefaultModelName } from "./get-default-model-name.mjs";
|
|
2
|
-
|
|
3
2
|
//#region src/db/adapter/get-model-name.ts
|
|
4
3
|
const initGetModelName = ({ usePlural, schema }) => {
|
|
5
4
|
const getDefaultModelName = initGetDefaultModelName({
|
|
@@ -18,7 +17,5 @@ const initGetModelName = ({ usePlural, schema }) => {
|
|
|
18
17
|
};
|
|
19
18
|
return getModelName;
|
|
20
19
|
};
|
|
21
|
-
|
|
22
20
|
//#endregion
|
|
23
21
|
export { initGetModelName };
|
|
24
|
-
//# sourceMappingURL=get-model-name.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 };
|
|
@@ -6,7 +6,6 @@ import { initGetFieldName } from "./get-field-name.mjs";
|
|
|
6
6
|
import { initGetModelName } from "./get-model-name.mjs";
|
|
7
7
|
import { deepmerge, withApplyDefault } from "./utils.mjs";
|
|
8
8
|
import { createAdapterFactory } from "./factory.mjs";
|
|
9
|
-
|
|
10
9
|
//#region src/db/adapter/index.ts
|
|
11
10
|
const whereOperators = [
|
|
12
11
|
"eq",
|
|
@@ -21,7 +20,5 @@ const whereOperators = [
|
|
|
21
20
|
"starts_with",
|
|
22
21
|
"ends_with"
|
|
23
22
|
];
|
|
24
|
-
|
|
25
23
|
//#endregion
|
|
26
24
|
export { createAdapterFactory, deepmerge, initGetDefaultFieldName, initGetDefaultModelName, initGetFieldAttributes, initGetFieldName, initGetIdField, initGetModelName, whereOperators, withApplyDefault };
|
|
27
|
-
//# 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/index.mjs
CHANGED
|
@@ -5,5 +5,4 @@ import { rateLimitSchema } from "./schema/rate-limit.mjs";
|
|
|
5
5
|
import { sessionSchema } from "./schema/session.mjs";
|
|
6
6
|
import { userSchema } from "./schema/user.mjs";
|
|
7
7
|
import { verificationSchema } from "./schema/verification.mjs";
|
|
8
|
-
|
|
9
|
-
export { accountSchema, coreSchema, getAuthTables, rateLimitSchema, sessionSchema, userSchema, verificationSchema };
|
|
8
|
+
export { accountSchema, coreSchema, getAuthTables, rateLimitSchema, sessionSchema, userSchema, verificationSchema };
|
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 };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { coreSchema } from "./shared.mjs";
|
|
2
2
|
import * as z from "zod";
|
|
3
|
-
|
|
4
3
|
//#region src/db/schema/account.ts
|
|
5
4
|
const accountSchema = coreSchema.extend({
|
|
6
5
|
providerId: z.string(),
|
|
@@ -14,7 +13,5 @@ const accountSchema = coreSchema.extend({
|
|
|
14
13
|
scope: z.string().nullish(),
|
|
15
14
|
password: z.string().nullish()
|
|
16
15
|
});
|
|
17
|
-
|
|
18
16
|
//#endregion
|
|
19
17
|
export { accountSchema };
|
|
20
|
-
//# sourceMappingURL=account.mjs.map
|
|
@@ -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 };
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
|
-
|
|
3
2
|
//#region src/db/schema/rate-limit.ts
|
|
4
3
|
const rateLimitSchema = z.object({
|
|
5
4
|
key: z.string(),
|
|
6
5
|
count: z.number(),
|
|
7
6
|
lastRequest: z.number()
|
|
8
7
|
});
|
|
9
|
-
|
|
10
8
|
//#endregion
|
|
11
9
|
export { rateLimitSchema };
|
|
12
|
-
//# sourceMappingURL=rate-limit.mjs.map
|
|
@@ -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 };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { coreSchema } from "./shared.mjs";
|
|
2
2
|
import * as z from "zod";
|
|
3
|
-
|
|
4
3
|
//#region src/db/schema/session.ts
|
|
5
4
|
const sessionSchema = coreSchema.extend({
|
|
6
5
|
userId: z.coerce.string(),
|
|
@@ -9,7 +8,5 @@ const sessionSchema = coreSchema.extend({
|
|
|
9
8
|
ipAddress: z.string().nullish(),
|
|
10
9
|
userAgent: z.string().nullish()
|
|
11
10
|
});
|
|
12
|
-
|
|
13
11
|
//#endregion
|
|
14
12
|
export { sessionSchema };
|
|
15
|
-
//# sourceMappingURL=session.mjs.map
|