@better-auth/core 1.4.0-beta.20 → 1.4.0-beta.22
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 +17 -17
- package/dist/api/index.d.mts +2 -2
- package/dist/api/index.mjs +2 -2
- package/dist/async_hooks/index.d.mts +1 -1
- package/dist/async_hooks/index.mjs +1 -1
- package/dist/context/index.d.mts +3 -3
- package/dist/context/index.mjs +2 -2
- package/dist/{context-Buud88Dd.mjs → context-DgQ9XGBl.mjs} +1 -1
- package/dist/db/adapter/index.d.mts +3 -3
- package/dist/db/index.d.mts +2 -2
- package/dist/db/index.mjs +1 -1
- package/dist/env/index.d.mts +1 -1
- package/dist/env/index.mjs +1 -1
- package/dist/error/index.mjs +2 -2
- package/dist/{error-D6EqgOXr.mjs → error-BhAKg8LX.mjs} +1 -1
- package/dist/{index-DSd3YwTg.d.mts → index-Duq4j0SF.d.mts} +87 -14
- package/dist/index.d.mts +2 -2
- package/dist/oauth2/index.d.mts +2 -2
- package/dist/oauth2/index.mjs +1 -1
- package/dist/social-providers/index.d.mts +2 -2
- package/dist/social-providers/index.mjs +15 -6
- package/dist/utils/index.mjs +1 -1
- package/package.json +1 -1
- package/src/api/index.ts +2 -6
- package/src/context/endpoint-context.ts +2 -1
- package/src/context/request-state.test.ts +1 -1
- package/src/context/request-state.ts +2 -1
- package/src/context/transaction.ts +2 -1
- package/src/db/adapter/index.ts +63 -1
- package/src/db/schema/account.ts +1 -1
- package/src/db/schema/rate-limit.ts +1 -1
- package/src/db/schema/session.ts +1 -1
- package/src/db/schema/shared.ts +1 -1
- package/src/db/schema/user.ts +1 -1
- package/src/db/schema/verification.ts +1 -1
- package/src/env/logger.test.ts +2 -1
- package/src/social-providers/index.ts +1 -1
- package/src/social-providers/vk.ts +1 -2
- package/src/social-providers/zoom.ts +17 -1
- package/src/types/context.ts +1 -1
- package/src/types/init-options.ts +15 -8
- package/vitest.config.ts +3 -0
- /package/dist/{async_hooks-BQqSywfV.mjs → async_hooks-BfRfbd1J.mjs} +0 -0
- /package/dist/{env-YhoEXwYv.mjs → env-DwlNAN_D.mjs} +0 -0
- /package/dist/{index-JSfspfWW.d.mts → index-CdubV7uy.d.mts} +0 -0
- /package/dist/{index-CRg-E-VF.d.mts → index-DgwIISs7.d.mts} +0 -0
- /package/dist/{oauth2-D4PPavcA.mjs → oauth2-D3aE32ZH.mjs} +0 -0
- /package/dist/{utils-BFQCAfNW.mjs → utils-C5EN75oV.mjs} +0 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
|
|
2
|
-
> @better-auth/core@1.4.0-beta.
|
|
2
|
+
> @better-auth/core@1.4.0-beta.22 build /home/runner/work/better-auth/better-auth/packages/core
|
|
3
3
|
> tsdown
|
|
4
4
|
|
|
5
|
-
[34mℹ[39m tsdown [2mv0.16.
|
|
5
|
+
[34mℹ[39m tsdown [2mv0.16.5[22m powered by rolldown [2mv1.0.0-beta.50[22m
|
|
6
6
|
[34mℹ[39m Using tsdown config: [4m/home/runner/work/better-auth/better-auth/packages/core/tsdown.config.ts[24m
|
|
7
|
-
[34mℹ[39m entry: [34msrc/index.ts, src/
|
|
7
|
+
[34mℹ[39m entry: [34msrc/index.ts, src/db/index.ts, src/db/adapter/index.ts, src/async_hooks/index.ts, src/context/index.ts, src/env/index.ts, src/oauth2/index.ts, src/api/index.ts, src/social-providers/index.ts, src/utils/index.ts, src/error/index.ts[39m
|
|
8
8
|
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
9
9
|
[34mℹ[39m Build start
|
|
10
|
-
[34mℹ[39m [2mdist/[22m[1msocial-providers/index.mjs[22m [2m 77.
|
|
11
|
-
[34mℹ[39m [2mdist/[22m[1mdb/index.mjs[22m [2m 1.
|
|
10
|
+
[34mℹ[39m [2mdist/[22m[1msocial-providers/index.mjs[22m [2m 77.94 kB[22m [2m│ gzip: 10.14 kB[22m
|
|
11
|
+
[34mℹ[39m [2mdist/[22m[1mdb/index.mjs[22m [2m 1.58 kB[22m [2m│ gzip: 0.49 kB[22m
|
|
12
12
|
[34mℹ[39m [2mdist/[22m[1mapi/index.mjs[22m [2m 0.83 kB[22m [2m│ gzip: 0.40 kB[22m
|
|
13
13
|
[34mℹ[39m [2mdist/[22m[1mcontext/index.mjs[22m [2m 0.74 kB[22m [2m│ gzip: 0.27 kB[22m
|
|
14
14
|
[34mℹ[39m [2mdist/[22m[1moauth2/index.mjs[22m [2m 0.61 kB[22m [2m│ gzip: 0.24 kB[22m
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
[34mℹ[39m [2mdist/[22m[1mutils/index.mjs[22m [2m 0.09 kB[22m [2m│ gzip: 0.09 kB[22m
|
|
19
19
|
[34mℹ[39m [2mdist/[22m[1mdb/adapter/index.mjs[22m [2m 0.01 kB[22m [2m│ gzip: 0.03 kB[22m
|
|
20
20
|
[34mℹ[39m [2mdist/[22m[1mindex.mjs[22m [2m 0.01 kB[22m [2m│ gzip: 0.03 kB[22m
|
|
21
|
-
[34mℹ[39m [2mdist/[22moauth2-
|
|
22
|
-
[34mℹ[39m [2mdist/[22menv-
|
|
23
|
-
[34mℹ[39m [2mdist/[22mcontext-
|
|
24
|
-
[34mℹ[39m [2mdist/[22merror-
|
|
25
|
-
[34mℹ[39m [2mdist/[22masync_hooks-
|
|
26
|
-
[34mℹ[39m [2mdist/[22mutils-
|
|
21
|
+
[34mℹ[39m [2mdist/[22moauth2-D3aE32ZH.mjs [2m 9.16 kB[22m [2m│ gzip: 2.12 kB[22m
|
|
22
|
+
[34mℹ[39m [2mdist/[22menv-DwlNAN_D.mjs [2m 7.67 kB[22m [2m│ gzip: 2.54 kB[22m
|
|
23
|
+
[34mℹ[39m [2mdist/[22mcontext-DgQ9XGBl.mjs [2m 3.89 kB[22m [2m│ gzip: 1.00 kB[22m
|
|
24
|
+
[34mℹ[39m [2mdist/[22merror-BhAKg8LX.mjs [2m 1.77 kB[22m [2m│ gzip: 0.79 kB[22m
|
|
25
|
+
[34mℹ[39m [2mdist/[22masync_hooks-BfRfbd1J.mjs [2m 0.87 kB[22m [2m│ gzip: 0.46 kB[22m
|
|
26
|
+
[34mℹ[39m [2mdist/[22mutils-C5EN75oV.mjs [2m 0.13 kB[22m [2m│ gzip: 0.12 kB[22m
|
|
27
27
|
[34mℹ[39m [2mdist/[22m[32m[1msocial-providers/index.d.mts[22m[39m [2m 3.78 kB[22m [2m│ gzip: 1.17 kB[22m
|
|
28
28
|
[34mℹ[39m [2mdist/[22m[32m[1mcontext/index.d.mts[22m[39m [2m 3.05 kB[22m [2m│ gzip: 0.96 kB[22m
|
|
29
29
|
[34mℹ[39m [2mdist/[22m[32m[1merror/index.d.mts[22m[39m [2m 1.84 kB[22m [2m│ gzip: 0.72 kB[22m
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.mts[22m[39m [2m 0.83 kB[22m [2m│ gzip: 0.32 kB[22m
|
|
33
33
|
[34mℹ[39m [2mdist/[22m[32m[1moauth2/index.d.mts[22m[39m [2m 0.79 kB[22m [2m│ gzip: 0.30 kB[22m
|
|
34
34
|
[34mℹ[39m [2mdist/[22m[32m[1menv/index.d.mts[22m[39m [2m 0.59 kB[22m [2m│ gzip: 0.30 kB[22m
|
|
35
|
-
[34mℹ[39m [2mdist/[22m[32m[1mdb/adapter/index.d.mts[22m[39m [2m 0.
|
|
35
|
+
[34mℹ[39m [2mdist/[22m[32m[1mdb/adapter/index.d.mts[22m[39m [2m 0.53 kB[22m [2m│ gzip: 0.25 kB[22m
|
|
36
36
|
[34mℹ[39m [2mdist/[22m[32m[1mapi/index.d.mts[22m[39m [2m 0.29 kB[22m [2m│ gzip: 0.16 kB[22m
|
|
37
37
|
[34mℹ[39m [2mdist/[22m[32m[1masync_hooks/index.d.mts[22m[39m [2m 0.14 kB[22m [2m│ gzip: 0.10 kB[22m
|
|
38
|
-
[34mℹ[39m [2mdist/[22m[32mindex-
|
|
39
|
-
[34mℹ[39m [2mdist/[22m[32mindex-
|
|
40
|
-
[34mℹ[39m [2mdist/[22m[32mindex-
|
|
41
|
-
[34mℹ[39m 31 files, total:
|
|
42
|
-
[32m✔[39m Build complete in [
|
|
38
|
+
[34mℹ[39m [2mdist/[22m[32mindex-Duq4j0SF.d.mts[39m [2m203.73 kB[22m [2m│ gzip: 32.09 kB[22m
|
|
39
|
+
[34mℹ[39m [2mdist/[22m[32mindex-CdubV7uy.d.mts[39m [2m 3.31 kB[22m [2m│ gzip: 1.11 kB[22m
|
|
40
|
+
[34mℹ[39m [2mdist/[22m[32mindex-DgwIISs7.d.mts[39m [2m 0.24 kB[22m [2m│ gzip: 0.16 kB[22m
|
|
41
|
+
[34mℹ[39m 31 files, total: 326.99 kB
|
|
42
|
+
[32m✔[39m Build complete in [32m4755ms[39m
|
package/dist/api/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as optionsMiddleware, i as createAuthMiddleware, n as AuthMiddleware, r as createAuthEndpoint, t as AuthEndpoint } from "../index-
|
|
2
|
-
import "../index-
|
|
1
|
+
import { a as optionsMiddleware, i as createAuthMiddleware, n as AuthMiddleware, r as createAuthEndpoint, t as AuthEndpoint } from "../index-Duq4j0SF.mjs";
|
|
2
|
+
import "../index-CdubV7uy.mjs";
|
|
3
3
|
export { AuthEndpoint, AuthMiddleware, createAuthEndpoint, createAuthMiddleware, optionsMiddleware };
|
package/dist/api/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../async_hooks-
|
|
2
|
-
import { f as runWithEndpointContext } from "../context-
|
|
1
|
+
import "../async_hooks-BfRfbd1J.mjs";
|
|
2
|
+
import { f as runWithEndpointContext } from "../context-DgQ9XGBl.mjs";
|
|
3
3
|
import { createEndpoint, createMiddleware } from "better-call";
|
|
4
4
|
|
|
5
5
|
//#region src/api/index.ts
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as getAsyncLocalStorage, t as AsyncLocalStorage } from "../index-
|
|
1
|
+
import { n as getAsyncLocalStorage, t as AsyncLocalStorage } from "../index-DgwIISs7.mjs";
|
|
2
2
|
export { AsyncLocalStorage, getAsyncLocalStorage };
|
package/dist/context/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Jn as DBTransactionAdapter, Un as DBAdapter, d as AuthContext } from "../index-
|
|
2
|
-
import "../index-
|
|
3
|
-
import { t as AsyncLocalStorage } from "../index-
|
|
1
|
+
import { Jn as DBTransactionAdapter, Un as DBAdapter, d as AuthContext } from "../index-Duq4j0SF.mjs";
|
|
2
|
+
import "../index-CdubV7uy.mjs";
|
|
3
|
+
import { t as AsyncLocalStorage } from "../index-DgwIISs7.mjs";
|
|
4
4
|
import { EndpointContext, InputContext } from "better-call";
|
|
5
5
|
|
|
6
6
|
//#region src/context/endpoint-context.d.ts
|
package/dist/context/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../async_hooks-
|
|
2
|
-
import { a as defineRequestState, c as hasRequestState, d as getCurrentAuthContextAsyncLocalStorage, f as runWithEndpointContext, i as runWithTransaction, l as runWithRequestState, n as getCurrentDBAdapterAsyncLocalStorage, o as getCurrentRequestState, r as runWithAdapter, s as getRequestStateAsyncLocalStorage, t as getCurrentAdapter, u as getCurrentAuthContext } from "../context-
|
|
1
|
+
import "../async_hooks-BfRfbd1J.mjs";
|
|
2
|
+
import { a as defineRequestState, c as hasRequestState, d as getCurrentAuthContextAsyncLocalStorage, f as runWithEndpointContext, i as runWithTransaction, l as runWithRequestState, n as getCurrentDBAdapterAsyncLocalStorage, o as getCurrentRequestState, r as runWithAdapter, s as getRequestStateAsyncLocalStorage, t as getCurrentAdapter, u as getCurrentAuthContext } from "../context-DgQ9XGBl.mjs";
|
|
3
3
|
|
|
4
4
|
export { defineRequestState, getCurrentAdapter, getCurrentAuthContext, getCurrentAuthContextAsyncLocalStorage, getCurrentDBAdapterAsyncLocalStorage, getCurrentRequestState, getRequestStateAsyncLocalStorage, hasRequestState, runWithAdapter, runWithEndpointContext, runWithRequestState, runWithTransaction };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Gn as DBAdapterFactoryConfig, Hn as CustomAdapter, Jn as DBTransactionAdapter, Kn as DBAdapterInstance, Un as DBAdapter, Vn as CleanedWhere, Wn as DBAdapterDebugLogOption, Yn as Where, qn as DBAdapterSchemaCreation } from "../../index-
|
|
2
|
-
import "../../index-
|
|
3
|
-
export { CleanedWhere, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, Where };
|
|
1
|
+
import { Gn as DBAdapterFactoryConfig, Hn as CustomAdapter, Jn as DBTransactionAdapter, Kn as DBAdapterInstance, Un as DBAdapter, Vn as CleanedWhere, Wn as DBAdapterDebugLogOption, Xn as JoinOption, Yn as JoinConfig, Zn as Where, qn as DBAdapterSchemaCreation } from "../../index-Duq4j0SF.mjs";
|
|
2
|
+
import "../../index-CdubV7uy.mjs";
|
|
3
|
+
export { CleanedWhere, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, JoinConfig, JoinOption, Where };
|
package/dist/db/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $n as
|
|
2
|
-
import "../index-
|
|
1
|
+
import { $n as BetterAuthDbSchema, Qn as AuthPluginSchema, Sr as SecondaryStorage, _r as DBFieldAttribute, ar as verificationSchema, br as DBPreservedModels, cr as coreSchema, dr as RateLimit, er as FieldAttribute, fr as rateLimitSchema, gr as BetterAuthDBSchema, hr as BetterAuthPluginDBSchema, ir as Verification, lr as Session, mr as accountSchema, nr as FieldType, or as User, pr as Account, rr as Primitive, sr as userSchema, tr as FieldAttributeConfig, ur as sessionSchema, vr as DBFieldAttributeConfig, xr as DBPrimitive, yr as DBFieldType } from "../index-Duq4j0SF.mjs";
|
|
2
|
+
import "../index-CdubV7uy.mjs";
|
|
3
3
|
export { Account, AuthPluginSchema, BetterAuthDBSchema, BetterAuthDbSchema, BetterAuthPluginDBSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPreservedModels, DBPrimitive, FieldAttribute, FieldAttributeConfig, FieldType, Primitive, RateLimit, SecondaryStorage, Session, User, Verification, accountSchema, coreSchema, rateLimitSchema, sessionSchema, userSchema, verificationSchema };
|
package/dist/db/index.mjs
CHANGED
package/dist/env/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as isTest, a as TTY_COLORS, c as logger, d as EnvObject, f as env, g as isProduction, h as isDevelopment, i as Logger, l as shouldPublishLog, m as getEnvVar, n as LogHandlerParams, o as createLogger, p as getBooleanEnvVar, r as LogLevel, s as levels, t as InternalLogger, u as ENV, v as nodeENV, y as getColorDepth } from "../index-
|
|
1
|
+
import { _ as isTest, a as TTY_COLORS, c as logger, d as EnvObject, f as env, g as isProduction, h as isDevelopment, i as Logger, l as shouldPublishLog, m as getEnvVar, n as LogHandlerParams, o as createLogger, p as getBooleanEnvVar, r as LogLevel, s as levels, t as InternalLogger, u as ENV, v as nodeENV, y as getColorDepth } from "../index-CdubV7uy.mjs";
|
|
2
2
|
export { ENV, EnvObject, InternalLogger, LogHandlerParams, LogLevel, Logger, TTY_COLORS, createLogger, env, getBooleanEnvVar, getColorDepth, getEnvVar, isDevelopment, isProduction, isTest, levels, logger, nodeENV, shouldPublishLog };
|
package/dist/env/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as shouldPublishLog, c as env, d as isDevelopment, f as isProduction, i as logger, l as getBooleanEnvVar, m as nodeENV, n as createLogger, o as getColorDepth, p as isTest, r as levels, s as ENV, t as TTY_COLORS, u as getEnvVar } from "../env-
|
|
1
|
+
import { a as shouldPublishLog, c as env, d as isDevelopment, f as isProduction, i as logger, l as getBooleanEnvVar, m as nodeENV, n as createLogger, o as getColorDepth, p as isTest, r as levels, s as ENV, t as TTY_COLORS, u as getEnvVar } from "../env-DwlNAN_D.mjs";
|
|
2
2
|
|
|
3
3
|
export { ENV, TTY_COLORS, createLogger, env, getBooleanEnvVar, getColorDepth, getEnvVar, isDevelopment, isProduction, isTest, levels, logger, nodeENV, shouldPublishLog };
|
package/dist/error/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../utils-
|
|
2
|
-
import { n as BASE_ERROR_CODES, t as BetterAuthError } from "../error-
|
|
1
|
+
import "../utils-C5EN75oV.mjs";
|
|
2
|
+
import { n as BASE_ERROR_CODES, t as BetterAuthError } from "../error-BhAKg8LX.mjs";
|
|
3
3
|
|
|
4
4
|
export { BASE_ERROR_CODES, BetterAuthError };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { i as Logger, o as createLogger } from "./index-
|
|
2
|
-
import * as
|
|
3
|
-
import { CookieOptions, Endpoint, EndpointContext, EndpointOptions, InputContext, Middleware } from "better-call";
|
|
4
|
-
import { z } from "zod";
|
|
1
|
+
import { i as Logger, o as createLogger } from "./index-CdubV7uy.mjs";
|
|
2
|
+
import * as z from "zod";
|
|
5
3
|
import { BetterFetch, BetterFetchOption, BetterFetchPlugin } from "@better-fetch/fetch";
|
|
6
4
|
import * as jose0 from "jose";
|
|
5
|
+
import * as better_call0 from "better-call";
|
|
6
|
+
import { CookieOptions, Endpoint, EndpointContext, EndpointOptions, InputContext, Middleware } from "better-call";
|
|
7
7
|
import { StandardSchemaV1, StandardSchemaV1 as StandardSchemaV1$1 } from "@standard-schema/spec";
|
|
8
8
|
import { Database } from "bun:sqlite";
|
|
9
9
|
import { DatabaseSync } from "node:sqlite";
|
|
@@ -454,7 +454,7 @@ interface DBAdapterFactoryConfig<Options extends BetterAuthOptions = BetterAuthO
|
|
|
454
454
|
/**
|
|
455
455
|
* The action which was called from the adapter.
|
|
456
456
|
*/
|
|
457
|
-
action: "create" | "update";
|
|
457
|
+
action: "create" | "update" | "findOne" | "findMany";
|
|
458
458
|
/**
|
|
459
459
|
* The model name.
|
|
460
460
|
*/
|
|
@@ -535,6 +535,12 @@ interface DBAdapterFactoryConfig<Options extends BetterAuthOptions = BetterAuthO
|
|
|
535
535
|
* @default false
|
|
536
536
|
*/
|
|
537
537
|
disableTransformInput?: boolean | undefined;
|
|
538
|
+
/**
|
|
539
|
+
* Whether to disable the transform join.
|
|
540
|
+
* Do not use this option unless you know what you are doing.
|
|
541
|
+
* @default false
|
|
542
|
+
*/
|
|
543
|
+
disableTransformJoin?: boolean | undefined;
|
|
538
544
|
}
|
|
539
545
|
type Where = {
|
|
540
546
|
/**
|
|
@@ -548,6 +554,56 @@ type Where = {
|
|
|
548
554
|
*/
|
|
549
555
|
connector?: ("AND" | "OR") | undefined;
|
|
550
556
|
};
|
|
557
|
+
/**
|
|
558
|
+
* JoinOption configuration for relational queries.
|
|
559
|
+
*
|
|
560
|
+
* Allows you to join related tables/models in a single query operation.
|
|
561
|
+
* Each key represents the name of the joined table/model, and the value
|
|
562
|
+
* configures how the join should be performed.
|
|
563
|
+
*/
|
|
564
|
+
type JoinOption = {
|
|
565
|
+
[model: string]: boolean | {
|
|
566
|
+
limit?: number;
|
|
567
|
+
};
|
|
568
|
+
};
|
|
569
|
+
/**
|
|
570
|
+
* Once `JoinOption` has gone through the adapter factory, it will be transformed into a `JoinConfig`.
|
|
571
|
+
*/
|
|
572
|
+
type JoinConfig = {
|
|
573
|
+
[model: string]: {
|
|
574
|
+
/**
|
|
575
|
+
* The joining column names.
|
|
576
|
+
*/
|
|
577
|
+
on: {
|
|
578
|
+
/**
|
|
579
|
+
* Column name from the main table
|
|
580
|
+
*/
|
|
581
|
+
from: string;
|
|
582
|
+
/**
|
|
583
|
+
* Column name from the joined table
|
|
584
|
+
*/
|
|
585
|
+
to: string;
|
|
586
|
+
};
|
|
587
|
+
/**
|
|
588
|
+
* Limit the number of rows to return.
|
|
589
|
+
*
|
|
590
|
+
* If the relation has `unique` constraint, then this option will be ignored and limit will be set to 1.
|
|
591
|
+
*
|
|
592
|
+
* @default 100
|
|
593
|
+
*/
|
|
594
|
+
limit?: number;
|
|
595
|
+
/**
|
|
596
|
+
* The relation type. Determines the ouput joined model data.
|
|
597
|
+
*
|
|
598
|
+
* `one-to-one` would have a single object in the output.
|
|
599
|
+
* `one-to-many` would have an array of objects in the output.
|
|
600
|
+
* `many-to-many` would have an array of objects in the output.
|
|
601
|
+
*
|
|
602
|
+
* @default "one-to-many"
|
|
603
|
+
*/
|
|
604
|
+
relation?: "one-to-one" | "one-to-many" | "many-to-many";
|
|
605
|
+
};
|
|
606
|
+
};
|
|
551
607
|
type DBTransactionAdapter<Options extends BetterAuthOptions = BetterAuthOptions> = Omit<DBAdapter<Options>, "transaction">;
|
|
552
608
|
type DBAdapter<Options extends BetterAuthOptions = BetterAuthOptions> = {
|
|
553
609
|
id: string;
|
|
@@ -566,6 +622,7 @@ type DBAdapter<Options extends BetterAuthOptions = BetterAuthOptions> = {
|
|
|
566
622
|
model: string;
|
|
567
623
|
where: Where[];
|
|
568
624
|
select?: string[] | undefined;
|
|
625
|
+
join?: JoinOption | undefined;
|
|
569
626
|
}) => Promise<T | null>;
|
|
570
627
|
findMany: <T>(data: {
|
|
571
628
|
model: string;
|
|
@@ -576,6 +633,7 @@ type DBAdapter<Options extends BetterAuthOptions = BetterAuthOptions> = {
|
|
|
576
633
|
direction: "asc" | "desc";
|
|
577
634
|
} | undefined;
|
|
578
635
|
offset?: number | undefined;
|
|
636
|
+
join?: JoinOption | undefined;
|
|
579
637
|
}) => Promise<T[]>;
|
|
580
638
|
count: (data: {
|
|
581
639
|
model: string;
|
|
@@ -642,18 +700,21 @@ interface CustomAdapter {
|
|
|
642
700
|
findOne: <T>({
|
|
643
701
|
model,
|
|
644
702
|
where,
|
|
645
|
-
select
|
|
703
|
+
select,
|
|
704
|
+
join
|
|
646
705
|
}: {
|
|
647
706
|
model: string;
|
|
648
707
|
where: CleanedWhere[];
|
|
649
708
|
select?: string[] | undefined;
|
|
709
|
+
join?: JoinConfig | undefined;
|
|
650
710
|
}) => Promise<T | null>;
|
|
651
711
|
findMany: <T>({
|
|
652
712
|
model,
|
|
653
713
|
where,
|
|
654
714
|
limit,
|
|
655
715
|
sortBy,
|
|
656
|
-
offset
|
|
716
|
+
offset,
|
|
717
|
+
join
|
|
657
718
|
}: {
|
|
658
719
|
model: string;
|
|
659
720
|
where?: CleanedWhere[] | undefined;
|
|
@@ -663,6 +724,7 @@ interface CustomAdapter {
|
|
|
663
724
|
direction: "asc" | "desc";
|
|
664
725
|
} | undefined;
|
|
665
726
|
offset?: number | undefined;
|
|
727
|
+
join?: JoinConfig | undefined;
|
|
666
728
|
}) => Promise<T[]>;
|
|
667
729
|
delete: ({
|
|
668
730
|
model,
|
|
@@ -3360,6 +3422,7 @@ declare const zoom: (userOptions: ZoomOptions) => {
|
|
|
3360
3422
|
codeVerifier?: string | undefined;
|
|
3361
3423
|
deviceId?: string | undefined;
|
|
3362
3424
|
}) => Promise<OAuth2Tokens>;
|
|
3425
|
+
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
|
|
3363
3426
|
getUserInfo(token: OAuth2Tokens & {
|
|
3364
3427
|
user?: {
|
|
3365
3428
|
name?: {
|
|
@@ -5252,6 +5315,7 @@ declare const socialProviders: {
|
|
|
5252
5315
|
codeVerifier?: string | undefined;
|
|
5253
5316
|
deviceId?: string | undefined;
|
|
5254
5317
|
}) => Promise<OAuth2Tokens>;
|
|
5318
|
+
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
|
|
5255
5319
|
getUserInfo(token: OAuth2Tokens & {
|
|
5256
5320
|
user?: {
|
|
5257
5321
|
name?: {
|
|
@@ -6651,12 +6715,7 @@ type BetterAuthOptions = {
|
|
|
6651
6715
|
/**
|
|
6652
6716
|
* Advanced options
|
|
6653
6717
|
*/
|
|
6654
|
-
advanced?:
|
|
6655
|
-
/**
|
|
6656
|
-
* @deprecated Please use `database.generateId` instead.
|
|
6657
|
-
*/
|
|
6658
|
-
generateId?: never;
|
|
6659
|
-
}) | undefined;
|
|
6718
|
+
advanced?: BetterAuthAdvancedOptions | undefined;
|
|
6660
6719
|
logger?: Logger | undefined;
|
|
6661
6720
|
/**
|
|
6662
6721
|
* allows you to define custom hooks that can be
|
|
@@ -6946,6 +7005,20 @@ type BetterAuthOptions = {
|
|
|
6946
7005
|
*/
|
|
6947
7006
|
debug?: boolean;
|
|
6948
7007
|
} | undefined;
|
|
7008
|
+
/**
|
|
7009
|
+
* Experimental features
|
|
7010
|
+
*/
|
|
7011
|
+
experimental?: {
|
|
7012
|
+
/**
|
|
7013
|
+
* Enable experimental joins for your database adapter.
|
|
7014
|
+
*
|
|
7015
|
+
* Please read the adapter documentation for more information regarding joins before enabling this.
|
|
7016
|
+
* Not all adapters support joins.
|
|
7017
|
+
*
|
|
7018
|
+
* @default false
|
|
7019
|
+
*/
|
|
7020
|
+
joins?: boolean;
|
|
7021
|
+
};
|
|
6949
7022
|
};
|
|
6950
7023
|
//#endregion
|
|
6951
7024
|
//#region src/types/context.d.ts
|
|
@@ -7221,4 +7294,4 @@ declare const createAuthEndpoint: <Path extends string, Opts extends EndpointOpt
|
|
|
7221
7294
|
type AuthEndpoint = ReturnType<typeof createAuthEndpoint>;
|
|
7222
7295
|
type AuthMiddleware = ReturnType<typeof createAuthMiddleware>;
|
|
7223
7296
|
//#endregion
|
|
7224
|
-
export { ZoomOptions as $,
|
|
7297
|
+
export { ZoomOptions as $, BetterAuthDbSchema as $n, microsoft as $t, PayPalProfile as A, generateCodeChallenge as An, DropboxOptions as At, NaverOptions as B, ProviderOptions as Bn, SpotifyProfile as Bt, SocialProviders as C, getApplePublicKey as Cn, LinearOptions as Ct, PolarProfile as D, createAuthorizationCodeRequest as Dn, KickOptions as Dt, PolarOptions as E, BetterAuthCookies as En, linear as Et, paybin as F, clientCredentialsToken as Fn, twitter as Ft, kakao as G, DBAdapterFactoryConfig as Gn, HuggingFaceOptions as Gt, naver as H, CustomAdapter as Hn, SlackOptions as Ht, LineIdTokenPayload as I, createClientCredentialsTokenRequest as In, TwitchOptions as It, notion as J, DBTransactionAdapter as Jn, GoogleOptions as Jt, NotionOptions as K, DBAdapterInstance as Kn, HuggingFaceProfile as Kt, LineOptions as L, OAuth2Tokens as Ln, TwitchProfile as Lt, paypal as M, createRefreshAccessTokenRequest as Mn, dropbox as Mt, PaybinOptions as N, refreshAccessToken as Nn, TwitterOption as Nt, polar as O, validateAuthorizationCode as On, KickProfile as Ot, PaybinProfile as P, createAuthorizationURL as Pn, TwitterProfile as Pt, PronounOption as Q, AuthPluginSchema as Qn, MicrosoftOptions as Qt, LineUserInfo as R, OAuth2UserInfo as Rn, twitch as Rt, SocialProviderListEnum as S, apple as Sn, SecondaryStorage as Sr, linkedin as St, socialProviders as T, LiteralUnion as Tn, LinearUser as Tt, KakaoOptions as U, DBAdapter as Un, SlackProfile as Ut, NaverProfile as V, CleanedWhere as Vn, spotify as Vt, KakaoProfile as W, DBAdapterDebugLogOption as Wn, slack as Wt, LoginType as X, JoinOption as Xn, google as Xt, AccountStatus as Y, JoinConfig as Yn, GoogleProfile as Yt, PhoneNumber as Z, Where as Zn, MicrosoftEntraIDProfile as Zt, GenerateIdFn as _, AtlassianProfile as _n, DBFieldAttribute as _r, GitlabOptions as _t, optionsMiddleware as a, figma as an, verificationSchema as ar, SalesforceOptions as at, SocialProvider as b, AppleOptions as bn, DBPreservedModels as br, LinkedInOptions as bt, BetterAuthClientPlugin as c, facebook as cn, coreSchema as cr, RobloxOptions as ct, AuthContext as d, discord as dn, RateLimit as dr, RedditOptions as dt, GithubOptions as en, FieldAttribute as er, ZoomProfile as et, GenericEndpointContext as f, CognitoOptions as fn, rateLimitSchema as fr, RedditProfile as ft, BetterAuthRateLimitOptions as g, AtlassianOptions as gn, BetterAuthDBSchema as gr, tiktok as gt, BetterAuthOptions as h, getCognitoPublicKey as hn, BetterAuthPluginDBSchema as hr, TiktokProfile as ht, createAuthMiddleware as i, FigmaProfile as in, Verification as ir, vk as it, PayPalTokenResponse as j, getOAuth2Tokens as jn, DropboxProfile as jt, PayPalOptions as k, validateToken as kn, kick as kt, ClientAtomListener as l, DiscordOptions as ln, Session as lr, RobloxProfile as lt, BetterAuthAdvancedOptions as m, cognito as mn, accountSchema as mr, TiktokOptions as mt, AuthMiddleware as n, github as nn, FieldType as nr, VkOption as nt, StandardSchemaV1$1 as o, FacebookOptions as on, User as or, SalesforceProfile as ot, InternalAdapter as p, CognitoProfile as pn, Account as pr, reddit as pt, NotionProfile as q, DBAdapterSchemaCreation as qn, huggingface as qt, createAuthEndpoint as r, FigmaOptions as rn, Primitive$1 as rr, VkProfile as rt, BetterAuthClientOptions as s, FacebookProfile as sn, userSchema as sr, salesforce as st, AuthEndpoint as t, GithubProfile as tn, FieldAttributeConfig as tr, zoom as tt, ClientStore as u, DiscordProfile as un, sessionSchema as ur, roblox as ut, BetterAuthPlugin as v, atlassian as vn, DBFieldAttributeConfig as vr, GitlabProfile as vt, socialProviderList as w, LiteralString as wn, LinearProfile as wt, SocialProviderList as x, AppleProfile as xn, DBPrimitive as xr, LinkedInProfile as xt, HookEndpointContext as y, AppleNonConformUser as yn, DBFieldType as yr, gitlab as yt, line as z, OAuthProvider as zn, SpotifyOptions as zt };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { En as BetterAuthCookies, Tn as LiteralUnion, _ as GenerateIdFn, c as BetterAuthClientPlugin, d as AuthContext, f as GenericEndpointContext, g as BetterAuthRateLimitOptions, h as BetterAuthOptions, l as ClientAtomListener, m as BetterAuthAdvancedOptions, o as StandardSchemaV1, p as InternalAdapter, s as BetterAuthClientOptions, u as ClientStore, v as BetterAuthPlugin, wn as LiteralString, y as HookEndpointContext } from "./index-
|
|
2
|
-
import "./index-
|
|
1
|
+
import { En as BetterAuthCookies, Tn as LiteralUnion, _ as GenerateIdFn, c as BetterAuthClientPlugin, d as AuthContext, f as GenericEndpointContext, g as BetterAuthRateLimitOptions, h as BetterAuthOptions, l as ClientAtomListener, m as BetterAuthAdvancedOptions, o as StandardSchemaV1, p as InternalAdapter, s as BetterAuthClientOptions, u as ClientStore, v as BetterAuthPlugin, wn as LiteralString, y as HookEndpointContext } from "./index-Duq4j0SF.mjs";
|
|
2
|
+
import "./index-CdubV7uy.mjs";
|
|
3
3
|
export { AuthContext, BetterAuthAdvancedOptions, BetterAuthClientOptions, BetterAuthClientPlugin, BetterAuthCookies, BetterAuthOptions, BetterAuthPlugin, BetterAuthRateLimitOptions, ClientAtomListener, ClientStore, GenerateIdFn, GenericEndpointContext, HookEndpointContext, InternalAdapter, LiteralString, LiteralUnion, StandardSchemaV1 };
|
package/dist/oauth2/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { An as generateCodeChallenge, Bn as ProviderOptions, Dn as createAuthorizationCodeRequest, Fn as clientCredentialsToken, In as createClientCredentialsTokenRequest, Ln as OAuth2Tokens, Mn as createRefreshAccessTokenRequest, Nn as refreshAccessToken, On as validateAuthorizationCode, Pn as createAuthorizationURL, Rn as OAuth2UserInfo, jn as getOAuth2Tokens, kn as validateToken, zn as OAuthProvider } from "../index-
|
|
2
|
-
import "../index-
|
|
1
|
+
import { An as generateCodeChallenge, Bn as ProviderOptions, Dn as createAuthorizationCodeRequest, Fn as clientCredentialsToken, In as createClientCredentialsTokenRequest, Ln as OAuth2Tokens, Mn as createRefreshAccessTokenRequest, Nn as refreshAccessToken, On as validateAuthorizationCode, Pn as createAuthorizationURL, Rn as OAuth2UserInfo, jn as getOAuth2Tokens, kn as validateToken, zn as OAuthProvider } from "../index-Duq4j0SF.mjs";
|
|
2
|
+
import "../index-CdubV7uy.mjs";
|
|
3
3
|
export { OAuth2Tokens, OAuth2UserInfo, OAuthProvider, ProviderOptions, clientCredentialsToken, createAuthorizationCodeRequest, createAuthorizationURL, createClientCredentialsTokenRequest, createRefreshAccessTokenRequest, generateCodeChallenge, getOAuth2Tokens, refreshAccessToken, validateAuthorizationCode, validateToken };
|
package/dist/oauth2/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as refreshAccessToken, c as getOAuth2Tokens, i as createRefreshAccessTokenRequest, l as clientCredentialsToken, n as validateAuthorizationCode, o as createAuthorizationURL, r as validateToken, s as generateCodeChallenge, t as createAuthorizationCodeRequest, u as createClientCredentialsTokenRequest } from "../oauth2-
|
|
1
|
+
import { a as refreshAccessToken, c as getOAuth2Tokens, i as createRefreshAccessTokenRequest, l as clientCredentialsToken, n as validateAuthorizationCode, o as createAuthorizationURL, r as validateToken, s as generateCodeChallenge, t as createAuthorizationCodeRequest, u as createClientCredentialsTokenRequest } from "../oauth2-D3aE32ZH.mjs";
|
|
2
2
|
|
|
3
3
|
export { clientCredentialsToken, createAuthorizationCodeRequest, createAuthorizationURL, createClientCredentialsTokenRequest, createRefreshAccessTokenRequest, generateCodeChallenge, getOAuth2Tokens, refreshAccessToken, validateAuthorizationCode, validateToken };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as ZoomOptions, $t as microsoft, A as PayPalProfile, At as DropboxOptions, B as NaverOptions, Bt as SpotifyProfile, C as SocialProviders, Cn as getApplePublicKey, Ct as LinearOptions, D as PolarProfile, Dt as KickOptions, E as PolarOptions, Et as linear, F as paybin, Ft as twitter, G as kakao, Gt as HuggingFaceOptions, H as naver, Ht as SlackOptions, I as LineIdTokenPayload, It as TwitchOptions, J as notion, Jt as GoogleOptions, K as NotionOptions, Kt as HuggingFaceProfile, L as LineOptions, Lt as TwitchProfile, M as paypal, Mt as dropbox, N as PaybinOptions, Nt as TwitterOption, O as polar, Ot as KickProfile, P as PaybinProfile, Pt as TwitterProfile, Q as PronounOption, Qt as MicrosoftOptions, R as LineUserInfo, Rt as twitch, S as SocialProviderListEnum, Sn as apple, St as linkedin, T as socialProviders, Tt as LinearUser, U as KakaoOptions, Ut as SlackProfile, V as NaverProfile, Vt as spotify, W as KakaoProfile, Wt as slack, X as LoginType, Xt as google, Y as AccountStatus, Yt as GoogleProfile, Z as PhoneNumber, Zt as MicrosoftEntraIDProfile, _n as AtlassianProfile, _t as GitlabOptions, an as figma, at as SalesforceOptions, b as SocialProvider, bn as AppleOptions, bt as LinkedInOptions, cn as facebook, ct as RobloxOptions, dn as discord, dt as RedditOptions, en as GithubOptions, et as ZoomProfile, fn as CognitoOptions, ft as RedditProfile, gn as AtlassianOptions, gt as tiktok, hn as getCognitoPublicKey, ht as TiktokProfile, in as FigmaProfile, it as vk, j as PayPalTokenResponse, jt as DropboxProfile, k as PayPalOptions, kt as kick, ln as DiscordOptions, lt as RobloxProfile, mn as cognito, mt as TiktokOptions, nn as github, nt as VkOption, on as FacebookOptions, ot as SalesforceProfile, pn as CognitoProfile, pt as reddit, q as NotionProfile, qt as huggingface, rn as FigmaOptions, rt as VkProfile, sn as FacebookProfile, st as salesforce, tn as GithubProfile, tt as zoom, un as DiscordProfile, ut as roblox, vn as atlassian, vt as GitlabProfile, w as socialProviderList, wt as LinearProfile, x as SocialProviderList, xn as AppleProfile, xt as LinkedInProfile, yn as AppleNonConformUser, yt as gitlab, z as line, zt as SpotifyOptions } from "../index-
|
|
2
|
-
import "../index-
|
|
1
|
+
import { $ as ZoomOptions, $t as microsoft, A as PayPalProfile, At as DropboxOptions, B as NaverOptions, Bt as SpotifyProfile, C as SocialProviders, Cn as getApplePublicKey, Ct as LinearOptions, D as PolarProfile, Dt as KickOptions, E as PolarOptions, Et as linear, F as paybin, Ft as twitter, G as kakao, Gt as HuggingFaceOptions, H as naver, Ht as SlackOptions, I as LineIdTokenPayload, It as TwitchOptions, J as notion, Jt as GoogleOptions, K as NotionOptions, Kt as HuggingFaceProfile, L as LineOptions, Lt as TwitchProfile, M as paypal, Mt as dropbox, N as PaybinOptions, Nt as TwitterOption, O as polar, Ot as KickProfile, P as PaybinProfile, Pt as TwitterProfile, Q as PronounOption, Qt as MicrosoftOptions, R as LineUserInfo, Rt as twitch, S as SocialProviderListEnum, Sn as apple, St as linkedin, T as socialProviders, Tt as LinearUser, U as KakaoOptions, Ut as SlackProfile, V as NaverProfile, Vt as spotify, W as KakaoProfile, Wt as slack, X as LoginType, Xt as google, Y as AccountStatus, Yt as GoogleProfile, Z as PhoneNumber, Zt as MicrosoftEntraIDProfile, _n as AtlassianProfile, _t as GitlabOptions, an as figma, at as SalesforceOptions, b as SocialProvider, bn as AppleOptions, bt as LinkedInOptions, cn as facebook, ct as RobloxOptions, dn as discord, dt as RedditOptions, en as GithubOptions, et as ZoomProfile, fn as CognitoOptions, ft as RedditProfile, gn as AtlassianOptions, gt as tiktok, hn as getCognitoPublicKey, ht as TiktokProfile, in as FigmaProfile, it as vk, j as PayPalTokenResponse, jt as DropboxProfile, k as PayPalOptions, kt as kick, ln as DiscordOptions, lt as RobloxProfile, mn as cognito, mt as TiktokOptions, nn as github, nt as VkOption, on as FacebookOptions, ot as SalesforceProfile, pn as CognitoProfile, pt as reddit, q as NotionProfile, qt as huggingface, rn as FigmaOptions, rt as VkProfile, sn as FacebookProfile, st as salesforce, tn as GithubProfile, tt as zoom, un as DiscordProfile, ut as roblox, vn as atlassian, vt as GitlabProfile, w as socialProviderList, wt as LinearProfile, x as SocialProviderList, xn as AppleProfile, xt as LinkedInProfile, yn as AppleNonConformUser, yt as gitlab, z as line, zt as SpotifyOptions } from "../index-Duq4j0SF.mjs";
|
|
2
|
+
import "../index-CdubV7uy.mjs";
|
|
3
3
|
export { AccountStatus, AppleNonConformUser, AppleOptions, AppleProfile, AtlassianOptions, AtlassianProfile, CognitoOptions, CognitoProfile, DiscordOptions, DiscordProfile, DropboxOptions, DropboxProfile, FacebookOptions, FacebookProfile, FigmaOptions, FigmaProfile, GithubOptions, GithubProfile, GitlabOptions, GitlabProfile, GoogleOptions, GoogleProfile, HuggingFaceOptions, HuggingFaceProfile, KakaoOptions, KakaoProfile, KickOptions, KickProfile, LineIdTokenPayload, LineOptions, LineUserInfo, LinearOptions, LinearProfile, LinearUser, LinkedInOptions, LinkedInProfile, LoginType, MicrosoftEntraIDProfile, MicrosoftOptions, NaverOptions, NaverProfile, NotionOptions, NotionProfile, PayPalOptions, PayPalProfile, PayPalTokenResponse, PaybinOptions, PaybinProfile, PhoneNumber, PolarOptions, PolarProfile, PronounOption, RedditOptions, RedditProfile, RobloxOptions, RobloxProfile, SalesforceOptions, SalesforceProfile, SlackOptions, SlackProfile, SocialProvider, SocialProviderList, SocialProviderListEnum, SocialProviders, SpotifyOptions, SpotifyProfile, TiktokOptions, TiktokProfile, TwitchOptions, TwitchProfile, TwitterOption, TwitterProfile, VkOption, VkProfile, ZoomOptions, ZoomProfile, apple, atlassian, cognito, discord, dropbox, facebook, figma, getApplePublicKey, getCognitoPublicKey, github, gitlab, google, huggingface, kakao, kick, line, linear, linkedin, microsoft, naver, notion, paybin, paypal, polar, reddit, roblox, salesforce, slack, socialProviderList, socialProviders, spotify, tiktok, twitch, twitter, vk, zoom };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { i as logger } from "../env-
|
|
2
|
-
import "../
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import { z } from "zod";
|
|
1
|
+
import { i as logger } from "../env-DwlNAN_D.mjs";
|
|
2
|
+
import { a as refreshAccessToken, c as getOAuth2Tokens, n as validateAuthorizationCode, o as createAuthorizationURL, s as generateCodeChallenge } from "../oauth2-D3aE32ZH.mjs";
|
|
3
|
+
import "../utils-C5EN75oV.mjs";
|
|
4
|
+
import { t as BetterAuthError } from "../error-BhAKg8LX.mjs";
|
|
5
|
+
import * as z from "zod";
|
|
7
6
|
import { base64 } from "@better-auth/utils/base64";
|
|
8
7
|
import { betterFetch } from "@better-fetch/fetch";
|
|
9
8
|
import { createRemoteJWKSet, decodeJwt, decodeProtectedHeader, importJWK, jwtVerify } from "jose";
|
|
9
|
+
import { APIError } from "better-call";
|
|
10
10
|
|
|
11
11
|
//#region src/social-providers/apple.ts
|
|
12
12
|
const apple = (options) => {
|
|
@@ -2450,6 +2450,15 @@ const zoom = (userOptions) => {
|
|
|
2450
2450
|
authentication: "post"
|
|
2451
2451
|
});
|
|
2452
2452
|
},
|
|
2453
|
+
refreshAccessToken: options.refreshAccessToken ? options.refreshAccessToken : async (refreshToken) => refreshAccessToken({
|
|
2454
|
+
refreshToken,
|
|
2455
|
+
options: {
|
|
2456
|
+
clientId: options.clientId,
|
|
2457
|
+
clientKey: options.clientKey,
|
|
2458
|
+
clientSecret: options.clientSecret
|
|
2459
|
+
},
|
|
2460
|
+
tokenEndpoint: "https://zoom.us/oauth/token"
|
|
2461
|
+
}),
|
|
2453
2462
|
async getUserInfo(token) {
|
|
2454
2463
|
if (options.getUserInfo) return options.getUserInfo(token);
|
|
2455
2464
|
const { data: profile, error } = await betterFetch("https://api.zoom.us/v2/users/me", { headers: { authorization: `Bearer ${token.accessToken}` } });
|
package/dist/utils/index.mjs
CHANGED
package/package.json
CHANGED
package/src/api/index.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
createMiddleware,
|
|
4
|
-
type EndpointContext,
|
|
5
|
-
type EndpointOptions,
|
|
6
|
-
} from "better-call";
|
|
1
|
+
import type { EndpointContext, EndpointOptions } from "better-call";
|
|
2
|
+
import { createEndpoint, createMiddleware } from "better-call";
|
|
7
3
|
import { runWithEndpointContext } from "../context";
|
|
8
4
|
import type { AuthContext } from "../types";
|
|
9
5
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { EndpointContext, InputContext } from "better-call";
|
|
2
|
-
import {
|
|
2
|
+
import type { AsyncLocalStorage } from "../async_hooks";
|
|
3
|
+
import { getAsyncLocalStorage } from "../async_hooks";
|
|
3
4
|
import type { AuthContext } from "../types";
|
|
4
5
|
|
|
5
6
|
export type AuthEndpointContext = Partial<
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
+
import type { RequestStateWeakMap } from "./request-state";
|
|
2
3
|
import {
|
|
3
4
|
defineRequestState,
|
|
4
5
|
getCurrentRequestState,
|
|
5
6
|
hasRequestState,
|
|
6
|
-
type RequestStateWeakMap,
|
|
7
7
|
runWithRequestState,
|
|
8
8
|
} from "./request-state";
|
|
9
9
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AsyncLocalStorage } from "../async_hooks";
|
|
2
|
+
import { getAsyncLocalStorage } from "../async_hooks";
|
|
2
3
|
import type { DBAdapter, DBTransactionAdapter } from "../db/adapter";
|
|
3
4
|
|
|
4
5
|
let currentAdapterAsyncStorage: AsyncLocalStorage<DBTransactionAdapter> | null =
|
package/src/db/adapter/index.ts
CHANGED
|
@@ -195,7 +195,7 @@ export interface DBAdapterFactoryConfig<
|
|
|
195
195
|
/**
|
|
196
196
|
* The action which was called from the adapter.
|
|
197
197
|
*/
|
|
198
|
-
action: "create" | "update";
|
|
198
|
+
action: "create" | "update" | "findOne" | "findMany";
|
|
199
199
|
/**
|
|
200
200
|
* The model name.
|
|
201
201
|
*/
|
|
@@ -277,6 +277,12 @@ export interface DBAdapterFactoryConfig<
|
|
|
277
277
|
* @default false
|
|
278
278
|
*/
|
|
279
279
|
disableTransformInput?: boolean | undefined;
|
|
280
|
+
/**
|
|
281
|
+
* Whether to disable the transform join.
|
|
282
|
+
* Do not use this option unless you know what you are doing.
|
|
283
|
+
* @default false
|
|
284
|
+
*/
|
|
285
|
+
disableTransformJoin?: boolean | undefined;
|
|
280
286
|
}
|
|
281
287
|
|
|
282
288
|
export type Where = {
|
|
@@ -306,6 +312,56 @@ export type Where = {
|
|
|
306
312
|
connector?: ("AND" | "OR") | undefined;
|
|
307
313
|
};
|
|
308
314
|
|
|
315
|
+
/**
|
|
316
|
+
* JoinOption configuration for relational queries.
|
|
317
|
+
*
|
|
318
|
+
* Allows you to join related tables/models in a single query operation.
|
|
319
|
+
* Each key represents the name of the joined table/model, and the value
|
|
320
|
+
* configures how the join should be performed.
|
|
321
|
+
*/
|
|
322
|
+
export type JoinOption = {
|
|
323
|
+
[model: string]: boolean | { limit?: number };
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Once `JoinOption` has gone through the adapter factory, it will be transformed into a `JoinConfig`.
|
|
328
|
+
*/
|
|
329
|
+
export type JoinConfig = {
|
|
330
|
+
[model: string]: {
|
|
331
|
+
/**
|
|
332
|
+
* The joining column names.
|
|
333
|
+
*/
|
|
334
|
+
on: {
|
|
335
|
+
/**
|
|
336
|
+
* Column name from the main table
|
|
337
|
+
*/
|
|
338
|
+
from: string;
|
|
339
|
+
/**
|
|
340
|
+
* Column name from the joined table
|
|
341
|
+
*/
|
|
342
|
+
to: string;
|
|
343
|
+
};
|
|
344
|
+
/**
|
|
345
|
+
* Limit the number of rows to return.
|
|
346
|
+
*
|
|
347
|
+
* If the relation has `unique` constraint, then this option will be ignored and limit will be set to 1.
|
|
348
|
+
*
|
|
349
|
+
* @default 100
|
|
350
|
+
*/
|
|
351
|
+
limit?: number;
|
|
352
|
+
/**
|
|
353
|
+
* The relation type. Determines the ouput joined model data.
|
|
354
|
+
*
|
|
355
|
+
* `one-to-one` would have a single object in the output.
|
|
356
|
+
* `one-to-many` would have an array of objects in the output.
|
|
357
|
+
* `many-to-many` would have an array of objects in the output.
|
|
358
|
+
*
|
|
359
|
+
* @default "one-to-many"
|
|
360
|
+
*/
|
|
361
|
+
relation?: "one-to-one" | "one-to-many" | "many-to-many";
|
|
362
|
+
};
|
|
363
|
+
};
|
|
364
|
+
|
|
309
365
|
export type DBTransactionAdapter<
|
|
310
366
|
Options extends BetterAuthOptions = BetterAuthOptions,
|
|
311
367
|
> = Omit<DBAdapter<Options>, "transaction">;
|
|
@@ -327,6 +383,7 @@ export type DBAdapter<Options extends BetterAuthOptions = BetterAuthOptions> = {
|
|
|
327
383
|
model: string;
|
|
328
384
|
where: Where[];
|
|
329
385
|
select?: string[] | undefined;
|
|
386
|
+
join?: JoinOption | undefined;
|
|
330
387
|
}) => Promise<T | null>;
|
|
331
388
|
findMany: <T>(data: {
|
|
332
389
|
model: string;
|
|
@@ -339,6 +396,7 @@ export type DBAdapter<Options extends BetterAuthOptions = BetterAuthOptions> = {
|
|
|
339
396
|
}
|
|
340
397
|
| undefined;
|
|
341
398
|
offset?: number | undefined;
|
|
399
|
+
join?: JoinOption | undefined;
|
|
342
400
|
}) => Promise<T[]>;
|
|
343
401
|
count: (data: {
|
|
344
402
|
model: string;
|
|
@@ -408,10 +466,12 @@ export interface CustomAdapter {
|
|
|
408
466
|
model,
|
|
409
467
|
where,
|
|
410
468
|
select,
|
|
469
|
+
join,
|
|
411
470
|
}: {
|
|
412
471
|
model: string;
|
|
413
472
|
where: CleanedWhere[];
|
|
414
473
|
select?: string[] | undefined;
|
|
474
|
+
join?: JoinConfig | undefined;
|
|
415
475
|
}) => Promise<T | null>;
|
|
416
476
|
findMany: <T>({
|
|
417
477
|
model,
|
|
@@ -419,12 +479,14 @@ export interface CustomAdapter {
|
|
|
419
479
|
limit,
|
|
420
480
|
sortBy,
|
|
421
481
|
offset,
|
|
482
|
+
join,
|
|
422
483
|
}: {
|
|
423
484
|
model: string;
|
|
424
485
|
where?: CleanedWhere[] | undefined;
|
|
425
486
|
limit: number;
|
|
426
487
|
sortBy?: { field: string; direction: "asc" | "desc" } | undefined;
|
|
427
488
|
offset?: number | undefined;
|
|
489
|
+
join?: JoinConfig | undefined;
|
|
428
490
|
}) => Promise<T[]>;
|
|
429
491
|
delete: ({
|
|
430
492
|
model,
|
package/src/db/schema/account.ts
CHANGED
package/src/db/schema/session.ts
CHANGED
package/src/db/schema/shared.ts
CHANGED
package/src/db/schema/user.ts
CHANGED
package/src/env/logger.test.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { betterFetch } from "@better-fetch/fetch";
|
|
2
|
+
import type { OAuthProvider, ProviderOptions } from "../oauth2";
|
|
2
3
|
import {
|
|
3
4
|
createAuthorizationURL,
|
|
4
|
-
type OAuthProvider,
|
|
5
|
-
type ProviderOptions,
|
|
6
5
|
refreshAccessToken,
|
|
7
6
|
validateAuthorizationCode,
|
|
8
7
|
} from "../oauth2";
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { betterFetch } from "@better-fetch/fetch";
|
|
2
2
|
import type { OAuthProvider, ProviderOptions } from "../oauth2";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
generateCodeChallenge,
|
|
5
|
+
refreshAccessToken,
|
|
6
|
+
validateAuthorizationCode,
|
|
7
|
+
} from "../oauth2";
|
|
4
8
|
|
|
5
9
|
export type LoginType =
|
|
6
10
|
| 0 /** Facebook OAuth */
|
|
@@ -180,6 +184,18 @@ export const zoom = (userOptions: ZoomOptions) => {
|
|
|
180
184
|
authentication: "post",
|
|
181
185
|
});
|
|
182
186
|
},
|
|
187
|
+
refreshAccessToken: options.refreshAccessToken
|
|
188
|
+
? options.refreshAccessToken
|
|
189
|
+
: async (refreshToken) =>
|
|
190
|
+
refreshAccessToken({
|
|
191
|
+
refreshToken,
|
|
192
|
+
options: {
|
|
193
|
+
clientId: options.clientId,
|
|
194
|
+
clientKey: options.clientKey,
|
|
195
|
+
clientSecret: options.clientSecret,
|
|
196
|
+
},
|
|
197
|
+
tokenEndpoint: "https://zoom.us/oauth/token",
|
|
198
|
+
}),
|
|
183
199
|
async getUserInfo(token) {
|
|
184
200
|
if (options.getUserInfo) {
|
|
185
201
|
return options.getUserInfo(token);
|
package/src/types/context.ts
CHANGED
|
@@ -9,7 +9,7 @@ import type {
|
|
|
9
9
|
Verification,
|
|
10
10
|
} from "../db";
|
|
11
11
|
import type { DBAdapter, Where } from "../db/adapter";
|
|
12
|
-
import { createLogger } from "../env";
|
|
12
|
+
import type { createLogger } from "../env";
|
|
13
13
|
import type { OAuthProvider } from "../oauth2";
|
|
14
14
|
import type { BetterAuthCookies } from "./cookie";
|
|
15
15
|
import type { LiteralUnion } from "./helper";
|
|
@@ -936,14 +936,7 @@ export type BetterAuthOptions = {
|
|
|
936
936
|
/**
|
|
937
937
|
* Advanced options
|
|
938
938
|
*/
|
|
939
|
-
advanced?:
|
|
940
|
-
| (BetterAuthAdvancedOptions & {
|
|
941
|
-
/**
|
|
942
|
-
* @deprecated Please use `database.generateId` instead.
|
|
943
|
-
*/
|
|
944
|
-
generateId?: never;
|
|
945
|
-
})
|
|
946
|
-
| undefined;
|
|
939
|
+
advanced?: BetterAuthAdvancedOptions | undefined;
|
|
947
940
|
logger?: Logger | undefined;
|
|
948
941
|
/**
|
|
949
942
|
* allows you to define custom hooks that can be
|
|
@@ -1345,4 +1338,18 @@ export type BetterAuthOptions = {
|
|
|
1345
1338
|
debug?: boolean;
|
|
1346
1339
|
}
|
|
1347
1340
|
| undefined;
|
|
1341
|
+
/**
|
|
1342
|
+
* Experimental features
|
|
1343
|
+
*/
|
|
1344
|
+
experimental?: {
|
|
1345
|
+
/**
|
|
1346
|
+
* Enable experimental joins for your database adapter.
|
|
1347
|
+
*
|
|
1348
|
+
* Please read the adapter documentation for more information regarding joins before enabling this.
|
|
1349
|
+
* Not all adapters support joins.
|
|
1350
|
+
*
|
|
1351
|
+
* @default false
|
|
1352
|
+
*/
|
|
1353
|
+
joins?: boolean;
|
|
1354
|
+
};
|
|
1348
1355
|
};
|
package/vitest.config.ts
ADDED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|