better-auth 1.2.0-beta.5 → 1.2.0-beta.6
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/adapters/drizzle.cjs +3 -3
- package/dist/adapters/drizzle.d.cts +1 -1
- package/dist/adapters/drizzle.d.ts +1 -1
- package/dist/adapters/drizzle.js +1 -1
- package/dist/adapters/kysely.cjs +3 -3
- package/dist/adapters/kysely.d.cts +1 -1
- package/dist/adapters/kysely.d.ts +1 -1
- package/dist/adapters/kysely.js +1 -1
- package/dist/adapters/memory.cjs +2 -2
- package/dist/adapters/memory.d.cts +1 -1
- package/dist/adapters/memory.d.ts +1 -1
- package/dist/adapters/memory.js +1 -1
- package/dist/adapters/mongodb.cjs +3 -3
- package/dist/adapters/mongodb.d.cts +1 -1
- package/dist/adapters/mongodb.d.ts +1 -1
- package/dist/adapters/mongodb.js +1 -1
- package/dist/adapters/prisma.cjs +3 -3
- package/dist/adapters/prisma.d.cts +1 -1
- package/dist/adapters/prisma.d.ts +1 -1
- package/dist/adapters/prisma.js +1 -1
- package/dist/adapters/test.d.cts +1 -1
- package/dist/adapters/test.d.ts +1 -1
- package/dist/api.cjs +41 -41
- package/dist/api.d.cts +1 -1
- package/dist/api.d.ts +1 -1
- package/dist/api.js +1 -1
- package/dist/{auth-BIKkqX3w.d.ts → auth-BfbTouIV.d.ts} +5 -5
- package/dist/{auth-DYJ8ix3G.d.cts → auth-CC4kpwks.d.cts} +5 -5
- package/dist/{chunk-7P2P7Y35.js → chunk-2F3IX7O2.js} +1 -1
- package/dist/{chunk-VG5Y5QXC.js → chunk-4KMR5H5T.js} +1 -1
- package/dist/{chunk-XXGFGD3E.js → chunk-52TDJNDX.js} +11 -10
- package/dist/{chunk-YTMPZIP7.js → chunk-5AOJMBJI.js} +25 -3
- package/dist/{chunk-HQFWDJO3.cjs → chunk-5ECP2UE2.cjs} +5 -5
- package/dist/{chunk-VLA6IUW4.js → chunk-5G6XUCMS.js} +51 -2
- package/dist/{chunk-7H42DKFN.cjs → chunk-5KTUVZ3H.cjs} +5 -5
- package/dist/{chunk-QBBUTLKA.cjs → chunk-5RR5WN52.cjs} +5 -5
- package/dist/{chunk-XWK7ZOPU.cjs → chunk-75SPUXMY.cjs} +8 -8
- package/dist/{chunk-5LTLUS6A.js → chunk-BZOIXJ2Q.js} +1 -1
- package/dist/{chunk-SOFKSYNA.js → chunk-CG2CK6HR.js} +1 -1
- package/dist/{chunk-YZFX73MG.cjs → chunk-DURU7ZRA.cjs} +20 -20
- package/dist/{chunk-CLHJAEU2.js → chunk-EQYRCOOF.js} +5 -2
- package/dist/{chunk-IBIVHEIM.js → chunk-FX2ZHENM.js} +1 -1
- package/dist/{chunk-G6W6UQWJ.js → chunk-GWJDRQJ3.js} +2 -2
- package/dist/{chunk-C5LREWPU.cjs → chunk-HUDPJXOF.cjs} +24 -24
- package/dist/{chunk-DSB4P3WF.cjs → chunk-IUGQVFPG.cjs} +6 -6
- package/dist/{chunk-K46S33M5.cjs → chunk-K6WRBJAV.cjs} +3 -3
- package/dist/{chunk-C37NPGBI.cjs → chunk-KAEQXMEV.cjs} +46 -46
- package/dist/{chunk-CV5JTF37.cjs → chunk-KAR56MJZ.cjs} +5 -2
- package/dist/{chunk-6FRITF4C.cjs → chunk-LIGJVOZ4.cjs} +4 -4
- package/dist/{chunk-WKBV4PRW.cjs → chunk-MKNDCNWD.cjs} +3 -3
- package/dist/{chunk-WKXM7XUV.cjs → chunk-N7UWN6ND.cjs} +16 -4
- package/dist/{chunk-TV24P5IW.cjs → chunk-OALLKKNX.cjs} +52 -30
- package/dist/{chunk-3BXU3Z5H.js → chunk-QKCLO6S5.js} +1 -1
- package/dist/{chunk-E3CHTKRP.js → chunk-QLKU77BF.js} +1 -1
- package/dist/{chunk-CYI7H6T2.js → chunk-RMPI2YZ3.js} +1 -1
- package/dist/{chunk-R62AOMGV.js → chunk-SCXZXQTZ.js} +16 -4
- package/dist/{chunk-G365UCY7.js → chunk-ST2CQ4A2.js} +2 -2
- package/dist/{chunk-5RIBF22K.cjs → chunk-U44XLDNH.cjs} +22 -21
- package/dist/{chunk-OLGASOBP.cjs → chunk-UZNKBUDH.cjs} +11 -11
- package/dist/{chunk-7S7YLBK4.js → chunk-V56HFQQX.js} +1 -1
- package/dist/{chunk-HCHSHY7R.cjs → chunk-WD65CNWK.cjs} +77 -28
- package/dist/{chunk-H4A3GCFC.cjs → chunk-XKCN2VRG.cjs} +5 -5
- package/dist/{chunk-QG2HKEKG.js → chunk-XREMX2NV.js} +1 -1
- package/dist/{chunk-MHZNWING.js → chunk-ZDYKAJ67.js} +110 -2
- package/dist/{chunk-6QI5735F.js → chunk-ZKMUJOIP.js} +1 -1
- package/dist/{chunk-LHWLPZ6K.cjs → chunk-ZUUQ3FFY.cjs} +113 -5
- package/dist/client/plugins.d.cts +2 -2
- package/dist/client/plugins.d.ts +2 -2
- package/dist/client.d.cts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/cookies.d.cts +1 -1
- package/dist/cookies.d.ts +1 -1
- package/dist/db.cjs +12 -12
- package/dist/db.d.cts +2 -2
- package/dist/db.d.ts +2 -2
- package/dist/db.js +1 -1
- package/dist/{index-DOB91DVD.d.ts → index-CtbEb8Ls.d.ts} +107 -1
- package/dist/{index-BL6paKGE.d.cts → index-F5NLq5XF.d.cts} +107 -1
- package/dist/index.cjs +11 -11
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/dist/next-js.cjs +20 -20
- package/dist/next-js.d.cts +1 -1
- package/dist/next-js.d.ts +1 -1
- package/dist/next-js.js +19 -19
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/oauth2.d.cts +2 -2
- package/dist/oauth2.d.ts +2 -2
- package/dist/plugins/admin.cjs +3 -3
- package/dist/plugins/admin.d.cts +64 -8
- package/dist/plugins/admin.d.ts +64 -8
- package/dist/plugins/admin.js +2 -2
- package/dist/plugins/anonymous.cjs +3 -3
- package/dist/plugins/anonymous.d.cts +1 -1
- package/dist/plugins/anonymous.d.ts +1 -1
- package/dist/plugins/anonymous.js +2 -2
- package/dist/plugins/bearer.cjs +3 -3
- package/dist/plugins/bearer.d.cts +1 -1
- package/dist/plugins/bearer.d.ts +1 -1
- package/dist/plugins/bearer.js +2 -2
- package/dist/plugins/custom-session.cjs +3 -3
- package/dist/plugins/custom-session.d.cts +1 -1
- package/dist/plugins/custom-session.d.ts +1 -1
- package/dist/plugins/custom-session.js +2 -2
- package/dist/plugins/email-otp.cjs +3 -3
- package/dist/plugins/email-otp.d.cts +1 -1
- package/dist/plugins/email-otp.d.ts +1 -1
- package/dist/plugins/email-otp.js +2 -2
- package/dist/plugins/generic-oauth.cjs +3 -3
- package/dist/plugins/generic-oauth.d.cts +74 -1
- package/dist/plugins/generic-oauth.d.ts +74 -1
- package/dist/plugins/generic-oauth.js +2 -2
- package/dist/plugins/jwt.cjs +3 -3
- package/dist/plugins/jwt.d.cts +1 -1
- package/dist/plugins/jwt.d.ts +1 -1
- package/dist/plugins/jwt.js +2 -2
- package/dist/plugins/magic-link.cjs +3 -3
- package/dist/plugins/magic-link.d.cts +4 -0
- package/dist/plugins/magic-link.d.ts +4 -0
- package/dist/plugins/magic-link.js +2 -2
- package/dist/plugins/multi-session.cjs +3 -3
- package/dist/plugins/multi-session.d.cts +1 -1
- package/dist/plugins/multi-session.d.ts +1 -1
- package/dist/plugins/multi-session.js +2 -2
- package/dist/plugins/oidc-provider.cjs +3 -3
- package/dist/plugins/oidc-provider.js +2 -2
- package/dist/plugins/one-tap.cjs +3 -3
- package/dist/plugins/one-tap.js +2 -2
- package/dist/plugins/open-api.cjs +4 -4
- package/dist/plugins/open-api.d.cts +1 -1
- package/dist/plugins/open-api.d.ts +1 -1
- package/dist/plugins/open-api.js +3 -3
- package/dist/plugins/organization.cjs +3 -3
- package/dist/plugins/organization.d.cts +2 -2
- package/dist/plugins/organization.d.ts +2 -2
- package/dist/plugins/organization.js +2 -2
- package/dist/plugins/passkey.cjs +14 -14
- package/dist/plugins/passkey.d.cts +1 -1
- package/dist/plugins/passkey.d.ts +1 -1
- package/dist/plugins/passkey.js +1 -1
- package/dist/plugins/phone-number.cjs +3 -3
- package/dist/plugins/phone-number.d.cts +2 -2
- package/dist/plugins/phone-number.d.ts +2 -2
- package/dist/plugins/phone-number.js +2 -2
- package/dist/plugins/sso.cjs +9 -9
- package/dist/plugins/sso.d.cts +1 -1
- package/dist/plugins/sso.d.ts +1 -1
- package/dist/plugins/sso.js +1 -1
- package/dist/plugins/two-factor.cjs +3 -3
- package/dist/plugins/two-factor.d.cts +1 -1
- package/dist/plugins/two-factor.d.ts +1 -1
- package/dist/plugins/two-factor.js +2 -2
- package/dist/plugins/username.cjs +3 -3
- package/dist/plugins/username.d.cts +1 -1
- package/dist/plugins/username.d.ts +1 -1
- package/dist/plugins/username.js +2 -2
- package/dist/plugins.cjs +39 -39
- package/dist/plugins.d.cts +3 -3
- package/dist/plugins.d.ts +3 -3
- package/dist/plugins.js +19 -19
- package/dist/react.d.cts +2 -3
- package/dist/react.d.ts +2 -3
- package/dist/solid.d.cts +1 -1
- package/dist/solid.d.ts +1 -1
- package/dist/{state-DXzHe8jb.d.ts → state-BlyN0kTT.d.ts} +1 -1
- package/dist/{state-CEqdZ_y_.d.cts → state-ClV1x8my.d.cts} +1 -1
- package/dist/svelte-kit.d.cts +1 -1
- package/dist/svelte-kit.d.ts +1 -1
- package/dist/svelte.d.cts +1 -1
- package/dist/svelte.d.ts +1 -1
- package/dist/types.d.cts +3 -3
- package/dist/types.d.ts +3 -3
- package/dist/vue.d.cts +1 -1
- package/dist/vue.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkN7UWN6ND_cjs = require('./chunk-N7UWN6ND.cjs');
|
|
4
4
|
var chunkSVC7H7K4_cjs = require('./chunk-SVC7H7K4.cjs');
|
|
5
5
|
var chunkV6HE2MP7_cjs = require('./chunk-V6HE2MP7.cjs');
|
|
6
6
|
var chunk2Z6CVQHH_cjs = require('./chunk-2Z6CVQHH.cjs');
|
|
@@ -125,7 +125,7 @@ var genericOAuth = (options) => {
|
|
|
125
125
|
};
|
|
126
126
|
},
|
|
127
127
|
endpoints: {
|
|
128
|
-
signInWithOAuth2:
|
|
128
|
+
signInWithOAuth2: chunkN7UWN6ND_cjs.createAuthEndpoint(
|
|
129
129
|
"/sign-in/oauth2",
|
|
130
130
|
{
|
|
131
131
|
method: "POST",
|
|
@@ -257,7 +257,7 @@ var genericOAuth = (options) => {
|
|
|
257
257
|
});
|
|
258
258
|
}
|
|
259
259
|
),
|
|
260
|
-
oAuth2Callback:
|
|
260
|
+
oAuth2Callback: chunkN7UWN6ND_cjs.createAuthEndpoint(
|
|
261
261
|
"/oauth2/callback/:providerId",
|
|
262
262
|
{
|
|
263
263
|
method: "GET",
|
|
@@ -311,7 +311,7 @@ var genericOAuth = (options) => {
|
|
|
311
311
|
}
|
|
312
312
|
let tokens = void 0;
|
|
313
313
|
const parsedState = await chunk2Z6CVQHH_cjs.parseState(ctx);
|
|
314
|
-
const { callbackURL, codeVerifier, errorURL, newUserURL } = parsedState;
|
|
314
|
+
const { callbackURL, codeVerifier, errorURL, newUserURL, link } = parsedState;
|
|
315
315
|
const code = ctx.query.code;
|
|
316
316
|
let finalTokenUrl = provider.tokenUrl;
|
|
317
317
|
let finalUserInfoUrl = provider.userInfoUrl;
|
|
@@ -363,7 +363,28 @@ var genericOAuth = (options) => {
|
|
|
363
363
|
);
|
|
364
364
|
}
|
|
365
365
|
const mapUser = provider.mapProfileToUser ? await provider.mapProfileToUser(userInfo) : null;
|
|
366
|
-
|
|
366
|
+
if (link) {
|
|
367
|
+
if (link.email !== userInfo.email.toLowerCase()) {
|
|
368
|
+
return redirectOnError("email_doesn't_match");
|
|
369
|
+
}
|
|
370
|
+
const newAccount = await ctx.context.internalAdapter.createAccount({
|
|
371
|
+
userId: link.userId,
|
|
372
|
+
providerId: provider.providerId,
|
|
373
|
+
accountId: userInfo.id
|
|
374
|
+
});
|
|
375
|
+
if (!newAccount) {
|
|
376
|
+
return redirectOnError("unable_to_link_account");
|
|
377
|
+
}
|
|
378
|
+
let toRedirectTo2;
|
|
379
|
+
try {
|
|
380
|
+
const url = callbackURL;
|
|
381
|
+
toRedirectTo2 = url.toString();
|
|
382
|
+
} catch {
|
|
383
|
+
toRedirectTo2 = callbackURL;
|
|
384
|
+
}
|
|
385
|
+
throw ctx.redirect(toRedirectTo2);
|
|
386
|
+
}
|
|
387
|
+
const result = await chunkN7UWN6ND_cjs.handleOAuthUserInfo(ctx, {
|
|
367
388
|
userInfo: {
|
|
368
389
|
...userInfo,
|
|
369
390
|
...mapUser
|
|
@@ -397,6 +418,93 @@ var genericOAuth = (options) => {
|
|
|
397
418
|
}
|
|
398
419
|
throw ctx.redirect(toRedirectTo);
|
|
399
420
|
}
|
|
421
|
+
),
|
|
422
|
+
oAuth2LinkAccount: chunkN7UWN6ND_cjs.createAuthEndpoint(
|
|
423
|
+
"/oauth2/link",
|
|
424
|
+
{
|
|
425
|
+
method: "POST",
|
|
426
|
+
body: zod.z.object({
|
|
427
|
+
providerId: zod.z.string(),
|
|
428
|
+
callbackURL: zod.z.string()
|
|
429
|
+
}),
|
|
430
|
+
use: [chunkN7UWN6ND_cjs.sessionMiddleware]
|
|
431
|
+
},
|
|
432
|
+
async (c) => {
|
|
433
|
+
const session = c.context.session;
|
|
434
|
+
const account = await c.context.internalAdapter.findAccounts(
|
|
435
|
+
session.user.id
|
|
436
|
+
);
|
|
437
|
+
const existingAccount = account.find(
|
|
438
|
+
(a) => a.providerId === c.body.providerId
|
|
439
|
+
);
|
|
440
|
+
if (existingAccount) {
|
|
441
|
+
throw new betterCall.APIError("BAD_REQUEST", {
|
|
442
|
+
message: chunkN7UWN6ND_cjs.BASE_ERROR_CODES.SOCIAL_ACCOUNT_ALREADY_LINKED
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
const provider = options.config.find(
|
|
446
|
+
(p) => p.providerId === c.body.providerId
|
|
447
|
+
);
|
|
448
|
+
if (!provider) {
|
|
449
|
+
throw new betterCall.APIError("NOT_FOUND", {
|
|
450
|
+
message: chunkN7UWN6ND_cjs.BASE_ERROR_CODES.PROVIDER_NOT_FOUND
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
const {
|
|
454
|
+
providerId,
|
|
455
|
+
clientId,
|
|
456
|
+
clientSecret,
|
|
457
|
+
redirectURI,
|
|
458
|
+
authorizationUrl,
|
|
459
|
+
discoveryUrl,
|
|
460
|
+
pkce,
|
|
461
|
+
scopes
|
|
462
|
+
} = provider;
|
|
463
|
+
let finalAuthUrl = authorizationUrl;
|
|
464
|
+
if (!finalAuthUrl) {
|
|
465
|
+
if (!discoveryUrl) {
|
|
466
|
+
throw new betterCall.APIError("BAD_REQUEST", {
|
|
467
|
+
message: ERROR_CODES.INVALID_OAUTH_CONFIGURATION
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
const discovery = await fetch.betterFetch(discoveryUrl, {
|
|
471
|
+
onError(context) {
|
|
472
|
+
c.context.logger.error(context.error.message, context.error, {
|
|
473
|
+
discoveryUrl
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
});
|
|
477
|
+
if (discovery.data) {
|
|
478
|
+
finalAuthUrl = discovery.data.authorization_endpoint;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
if (!finalAuthUrl) {
|
|
482
|
+
throw new betterCall.APIError("BAD_REQUEST", {
|
|
483
|
+
message: ERROR_CODES.INVALID_OAUTH_CONFIGURATION
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
const state = await chunk2Z6CVQHH_cjs.generateState(c, {
|
|
487
|
+
userId: session.user.id,
|
|
488
|
+
email: session.user.email
|
|
489
|
+
});
|
|
490
|
+
const url = await chunkSVC7H7K4_cjs.createAuthorizationURL({
|
|
491
|
+
id: providerId,
|
|
492
|
+
options: {
|
|
493
|
+
clientId,
|
|
494
|
+
clientSecret,
|
|
495
|
+
redirectURI: redirectURI || `${c.context.baseURL}/oauth2/callback`
|
|
496
|
+
},
|
|
497
|
+
authorizationEndpoint: finalAuthUrl,
|
|
498
|
+
state: state.state,
|
|
499
|
+
codeVerifier: pkce ? state.codeVerifier : void 0,
|
|
500
|
+
scopes: scopes || [],
|
|
501
|
+
redirectURI: `${c.context.baseURL}/oauth2/callback/${providerId}`
|
|
502
|
+
});
|
|
503
|
+
return c.json({
|
|
504
|
+
url: url.toString(),
|
|
505
|
+
redirect: true
|
|
506
|
+
});
|
|
507
|
+
}
|
|
400
508
|
)
|
|
401
509
|
},
|
|
402
510
|
$ERROR_CODES: ERROR_CODES
|
|
@@ -2,7 +2,7 @@ import * as nanostores from 'nanostores';
|
|
|
2
2
|
import { AccessControl, StatementsPrimitive, Role } from '../plugins/access.cjs';
|
|
3
3
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
4
4
|
import { BetterFetchOption } from '@better-fetch/fetch';
|
|
5
|
-
import { o as organization, a as Organization, M as Member, I as Invitation } from '../index-
|
|
5
|
+
import { o as organization, a as Organization, M as Member, I as Invitation } from '../index-F5NLq5XF.cjs';
|
|
6
6
|
import { b as Prettify } from '../helper-Bi8FQwDD.cjs';
|
|
7
7
|
import { username } from '../plugins/username.cjs';
|
|
8
8
|
export { getPasskeyActions, passkeyClient } from '../plugins/passkey.cjs';
|
|
@@ -10,7 +10,7 @@ export { twoFactorClient } from '../plugins/two-factor.cjs';
|
|
|
10
10
|
import { magicLink } from '../plugins/magic-link.cjs';
|
|
11
11
|
import { phoneNumber } from '../plugins/phone-number.cjs';
|
|
12
12
|
import { anonymous } from '../plugins/anonymous.cjs';
|
|
13
|
-
import { a5 as FieldAttribute, B as BetterAuthOptions, d as BetterAuthPlugin } from '../auth-
|
|
13
|
+
import { a5 as FieldAttribute, B as BetterAuthOptions, d as BetterAuthPlugin } from '../auth-CC4kpwks.cjs';
|
|
14
14
|
import { admin } from '../plugins/admin.cjs';
|
|
15
15
|
import { genericOAuth } from '../plugins/generic-oauth.cjs';
|
|
16
16
|
import { jwt } from '../plugins/jwt.cjs';
|
package/dist/client/plugins.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as nanostores from 'nanostores';
|
|
|
2
2
|
import { AccessControl, StatementsPrimitive, Role } from '../plugins/access.js';
|
|
3
3
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
4
4
|
import { BetterFetchOption } from '@better-fetch/fetch';
|
|
5
|
-
import { o as organization, a as Organization, M as Member, I as Invitation } from '../index-
|
|
5
|
+
import { o as organization, a as Organization, M as Member, I as Invitation } from '../index-CtbEb8Ls.js';
|
|
6
6
|
import { b as Prettify } from '../helper-Bi8FQwDD.js';
|
|
7
7
|
import { username } from '../plugins/username.js';
|
|
8
8
|
export { getPasskeyActions, passkeyClient } from '../plugins/passkey.js';
|
|
@@ -10,7 +10,7 @@ export { twoFactorClient } from '../plugins/two-factor.js';
|
|
|
10
10
|
import { magicLink } from '../plugins/magic-link.js';
|
|
11
11
|
import { phoneNumber } from '../plugins/phone-number.js';
|
|
12
12
|
import { anonymous } from '../plugins/anonymous.js';
|
|
13
|
-
import { a5 as FieldAttribute, B as BetterAuthOptions, d as BetterAuthPlugin } from '../auth-
|
|
13
|
+
import { a5 as FieldAttribute, B as BetterAuthOptions, d as BetterAuthPlugin } from '../auth-BfbTouIV.js';
|
|
14
14
|
import { admin } from '../plugins/admin.js';
|
|
15
15
|
import { genericOAuth } from '../plugins/generic-oauth.js';
|
|
16
16
|
import { jwt } from '../plugins/jwt.js';
|
package/dist/client.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as BASE_ERROR_CODES, d as BetterAuthPlugin } from './auth-
|
|
1
|
+
import { a as BASE_ERROR_CODES, d as BetterAuthPlugin } from './auth-CC4kpwks.cjs';
|
|
2
2
|
export * from 'zod';
|
|
3
3
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
4
4
|
import { BetterFetchError, BetterFetch, BetterFetchOption } from '@better-fetch/fetch';
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as BASE_ERROR_CODES, d as BetterAuthPlugin } from './auth-
|
|
1
|
+
import { a as BASE_ERROR_CODES, d as BetterAuthPlugin } from './auth-BfbTouIV.js';
|
|
2
2
|
export * from 'zod';
|
|
3
3
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
4
4
|
import { BetterFetchError, BetterFetch, BetterFetchOption } from '@better-fetch/fetch';
|
package/dist/cookies.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'better-call';
|
|
2
|
-
export { L as BetterAuthCookies, T as EligibleCookies, E as createCookieGetter, P as deleteSessionCookie, Y as getCookieCache, J as getCookies, X as getSessionCookie, Q as parseCookies, Z as parseSetCookieHeader, N as setCookieCache, O as setSessionCookie } from './auth-
|
|
2
|
+
export { L as BetterAuthCookies, T as EligibleCookies, E as createCookieGetter, P as deleteSessionCookie, Y as getCookieCache, J as getCookies, X as getSessionCookie, Q as parseCookies, Z as parseSetCookieHeader, N as setCookieCache, O as setSessionCookie } from './auth-CC4kpwks.cjs';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import 'kysely';
|
|
5
5
|
import './helper-Bi8FQwDD.cjs';
|
package/dist/cookies.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'better-call';
|
|
2
|
-
export { L as BetterAuthCookies, T as EligibleCookies, E as createCookieGetter, P as deleteSessionCookie, Y as getCookieCache, J as getCookies, X as getSessionCookie, Q as parseCookies, Z as parseSetCookieHeader, N as setCookieCache, O as setSessionCookie } from './auth-
|
|
2
|
+
export { L as BetterAuthCookies, T as EligibleCookies, E as createCookieGetter, P as deleteSessionCookie, Y as getCookieCache, J as getCookies, X as getSessionCookie, Q as parseCookies, Z as parseSetCookieHeader, N as setCookieCache, O as setSessionCookie } from './auth-BfbTouIV.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import 'kysely';
|
|
5
5
|
import './helper-Bi8FQwDD.js';
|
package/dist/db.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkKAR56MJZ_cjs = require('./chunk-KAR56MJZ.cjs');
|
|
4
4
|
var chunkB5UCLTPZ_cjs = require('./chunk-B5UCLTPZ.cjs');
|
|
5
5
|
require('./chunk-H74YRRNV.cjs');
|
|
6
6
|
require('./chunk-2Z6CVQHH.cjs');
|
|
@@ -16,47 +16,47 @@ require('./chunk-PEZRSDZS.cjs');
|
|
|
16
16
|
|
|
17
17
|
Object.defineProperty(exports, "convertFromDB", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkKAR56MJZ_cjs.convertFromDB; }
|
|
20
20
|
});
|
|
21
21
|
Object.defineProperty(exports, "convertToDB", {
|
|
22
22
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkKAR56MJZ_cjs.convertToDB; }
|
|
24
24
|
});
|
|
25
25
|
Object.defineProperty(exports, "createFieldAttribute", {
|
|
26
26
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunkKAR56MJZ_cjs.createFieldAttribute; }
|
|
28
28
|
});
|
|
29
29
|
Object.defineProperty(exports, "createInternalAdapter", {
|
|
30
30
|
enumerable: true,
|
|
31
|
-
get: function () { return
|
|
31
|
+
get: function () { return chunkKAR56MJZ_cjs.createInternalAdapter; }
|
|
32
32
|
});
|
|
33
33
|
Object.defineProperty(exports, "getAdapter", {
|
|
34
34
|
enumerable: true,
|
|
35
|
-
get: function () { return
|
|
35
|
+
get: function () { return chunkKAR56MJZ_cjs.getAdapter; }
|
|
36
36
|
});
|
|
37
37
|
Object.defineProperty(exports, "getAuthTables", {
|
|
38
38
|
enumerable: true,
|
|
39
|
-
get: function () { return
|
|
39
|
+
get: function () { return chunkKAR56MJZ_cjs.getAuthTables; }
|
|
40
40
|
});
|
|
41
41
|
Object.defineProperty(exports, "getMigrations", {
|
|
42
42
|
enumerable: true,
|
|
43
|
-
get: function () { return
|
|
43
|
+
get: function () { return chunkKAR56MJZ_cjs.getMigrations; }
|
|
44
44
|
});
|
|
45
45
|
Object.defineProperty(exports, "getSchema", {
|
|
46
46
|
enumerable: true,
|
|
47
|
-
get: function () { return
|
|
47
|
+
get: function () { return chunkKAR56MJZ_cjs.getSchema; }
|
|
48
48
|
});
|
|
49
49
|
Object.defineProperty(exports, "getWithHooks", {
|
|
50
50
|
enumerable: true,
|
|
51
|
-
get: function () { return
|
|
51
|
+
get: function () { return chunkKAR56MJZ_cjs.getWithHooks; }
|
|
52
52
|
});
|
|
53
53
|
Object.defineProperty(exports, "matchType", {
|
|
54
54
|
enumerable: true,
|
|
55
|
-
get: function () { return
|
|
55
|
+
get: function () { return chunkKAR56MJZ_cjs.matchType; }
|
|
56
56
|
});
|
|
57
57
|
Object.defineProperty(exports, "toZodSchema", {
|
|
58
58
|
enumerable: true,
|
|
59
|
-
get: function () { return
|
|
59
|
+
get: function () { return chunkKAR56MJZ_cjs.toZodSchema; }
|
|
60
60
|
});
|
|
61
61
|
Object.defineProperty(exports, "accountSchema", {
|
|
62
62
|
enumerable: true,
|
package/dist/db.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as Adapter, B as BetterAuthOptions, W as Where, a5 as FieldAttribute, a6 as FieldType, K as KyselyDatabaseType } from './auth-
|
|
2
|
-
export { ai as BetterAuthDbSchema, a9 as FieldAttributeConfig, ah as InferFieldsFromOptions, ag as InferFieldsFromPlugins, ad as InferFieldsInput, ae as InferFieldsInputClient, ac as InferFieldsOutput, ab as InferValueType, a8 as InternalAdapter, af as PluginFieldAttribute, ak as accountSchema, aa as createFieldAttribute, a7 as createInternalAdapter, ap as getAllFields, aj as getAuthTables, ay as mergeSchema, aw as parseAccountInput, ar as parseAccountOutput, av as parseAdditionalUserInput, at as parseInputData, ao as parseOutputData, ax as parseSessionInput, as as parseSessionOutput, au as parseUserInput, aq as parseUserOutput, am as sessionSchema, al as userSchema, an as verificationSchema } from './auth-
|
|
1
|
+
import { A as Adapter, B as BetterAuthOptions, W as Where, a5 as FieldAttribute, a6 as FieldType, K as KyselyDatabaseType } from './auth-CC4kpwks.cjs';
|
|
2
|
+
export { ai as BetterAuthDbSchema, a9 as FieldAttributeConfig, ah as InferFieldsFromOptions, ag as InferFieldsFromPlugins, ad as InferFieldsInput, ae as InferFieldsInputClient, ac as InferFieldsOutput, ab as InferValueType, a8 as InternalAdapter, af as PluginFieldAttribute, ak as accountSchema, aa as createFieldAttribute, a7 as createInternalAdapter, ap as getAllFields, aj as getAuthTables, ay as mergeSchema, aw as parseAccountInput, ar as parseAccountOutput, av as parseAdditionalUserInput, at as parseInputData, ao as parseOutputData, ax as parseSessionInput, as as parseSessionOutput, au as parseUserInput, aq as parseUserOutput, am as sessionSchema, al as userSchema, an as verificationSchema } from './auth-CC4kpwks.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import 'kysely';
|
|
5
5
|
import 'better-call';
|
package/dist/db.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as Adapter, B as BetterAuthOptions, W as Where, a5 as FieldAttribute, a6 as FieldType, K as KyselyDatabaseType } from './auth-
|
|
2
|
-
export { ai as BetterAuthDbSchema, a9 as FieldAttributeConfig, ah as InferFieldsFromOptions, ag as InferFieldsFromPlugins, ad as InferFieldsInput, ae as InferFieldsInputClient, ac as InferFieldsOutput, ab as InferValueType, a8 as InternalAdapter, af as PluginFieldAttribute, ak as accountSchema, aa as createFieldAttribute, a7 as createInternalAdapter, ap as getAllFields, aj as getAuthTables, ay as mergeSchema, aw as parseAccountInput, ar as parseAccountOutput, av as parseAdditionalUserInput, at as parseInputData, ao as parseOutputData, ax as parseSessionInput, as as parseSessionOutput, au as parseUserInput, aq as parseUserOutput, am as sessionSchema, al as userSchema, an as verificationSchema } from './auth-
|
|
1
|
+
import { A as Adapter, B as BetterAuthOptions, W as Where, a5 as FieldAttribute, a6 as FieldType, K as KyselyDatabaseType } from './auth-BfbTouIV.js';
|
|
2
|
+
export { ai as BetterAuthDbSchema, a9 as FieldAttributeConfig, ah as InferFieldsFromOptions, ag as InferFieldsFromPlugins, ad as InferFieldsInput, ae as InferFieldsInputClient, ac as InferFieldsOutput, ab as InferValueType, a8 as InternalAdapter, af as PluginFieldAttribute, ak as accountSchema, aa as createFieldAttribute, a7 as createInternalAdapter, ap as getAllFields, aj as getAuthTables, ay as mergeSchema, aw as parseAccountInput, ar as parseAccountOutput, av as parseAdditionalUserInput, at as parseInputData, ao as parseOutputData, ax as parseSessionInput, as as parseSessionOutput, au as parseUserInput, aq as parseUserOutput, am as sessionSchema, al as userSchema, an as verificationSchema } from './auth-BfbTouIV.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import 'kysely';
|
|
5
5
|
import 'better-call';
|
package/dist/db.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { convertFromDB, convertToDB, createFieldAttribute, createInternalAdapter, getAdapter, getAuthTables, getMigrations, getSchema, getWithHooks, matchType, toZodSchema } from './chunk-
|
|
1
|
+
export { convertFromDB, convertToDB, createFieldAttribute, createInternalAdapter, getAdapter, getAuthTables, getMigrations, getSchema, getWithHooks, matchType, toZodSchema } from './chunk-EQYRCOOF.js';
|
|
2
2
|
export { accountSchema, getAllFields, mergeSchema, parseAccountInput, parseAccountOutput, parseAdditionalUserInput, parseInputData, parseOutputData, parseSessionInput, parseSessionOutput, parseUserInput, parseUserOutput, sessionSchema, userSchema, verificationSchema } from './chunk-HZBNUY7E.js';
|
|
3
3
|
import './chunk-KLDFBLYL.js';
|
|
4
4
|
import './chunk-ZFUBVSZD.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z, ZodLiteral, ZodObject, ZodOptional, ZodArray, ZodString } from 'zod';
|
|
2
2
|
import * as better_call from 'better-call';
|
|
3
3
|
import { AccessControl, Role, StatementsPrimitive, defaultRoles } from './plugins/access.js';
|
|
4
|
-
import { U as User, S as Session, G as GenericEndpointContext } from './auth-
|
|
4
|
+
import { U as User, S as Session, G as GenericEndpointContext } from './auth-BfbTouIV.js';
|
|
5
5
|
import { b as Prettify } from './helper-Bi8FQwDD.js';
|
|
6
6
|
|
|
7
7
|
declare const organizationSchema: z.ZodObject<{
|
|
@@ -3936,6 +3936,112 @@ declare const organization: <O extends OrganizationOptions>(options?: O) => {
|
|
|
3936
3936
|
};
|
|
3937
3937
|
path: "/organization/get-active-member";
|
|
3938
3938
|
};
|
|
3939
|
+
leaveOrganization: {
|
|
3940
|
+
<Context extends {
|
|
3941
|
+
body: {
|
|
3942
|
+
organizationId: string;
|
|
3943
|
+
};
|
|
3944
|
+
method?: "POST" | undefined;
|
|
3945
|
+
query?: Record<string, any> | undefined;
|
|
3946
|
+
params?: Record<string, any> | undefined;
|
|
3947
|
+
request?: Request | undefined;
|
|
3948
|
+
headers?: HeadersInit | undefined;
|
|
3949
|
+
asResponse?: boolean | undefined;
|
|
3950
|
+
returnHeaders?: boolean | undefined;
|
|
3951
|
+
use?: better_call.Middleware[] | undefined;
|
|
3952
|
+
path?: string | undefined;
|
|
3953
|
+
}>(...inputCtx: better_call.HasRequiredKeys<Context> extends true ? [Context] : [(Context | undefined)?]): Promise<Context["asResponse"] extends true ? Response : Context["returnHeaders"] extends true ? {
|
|
3954
|
+
headers: Headers;
|
|
3955
|
+
response: {
|
|
3956
|
+
user: {
|
|
3957
|
+
id: string;
|
|
3958
|
+
name: string;
|
|
3959
|
+
email: string;
|
|
3960
|
+
image: string | null | undefined;
|
|
3961
|
+
};
|
|
3962
|
+
id: string;
|
|
3963
|
+
createdAt: Date;
|
|
3964
|
+
userId: string;
|
|
3965
|
+
organizationId: string;
|
|
3966
|
+
role: string;
|
|
3967
|
+
};
|
|
3968
|
+
} : {
|
|
3969
|
+
user: {
|
|
3970
|
+
id: string;
|
|
3971
|
+
name: string;
|
|
3972
|
+
email: string;
|
|
3973
|
+
image: string | null | undefined;
|
|
3974
|
+
};
|
|
3975
|
+
id: string;
|
|
3976
|
+
createdAt: Date;
|
|
3977
|
+
userId: string;
|
|
3978
|
+
organizationId: string;
|
|
3979
|
+
role: string;
|
|
3980
|
+
}>;
|
|
3981
|
+
options: {
|
|
3982
|
+
method: "POST";
|
|
3983
|
+
body: ZodObject<{
|
|
3984
|
+
organizationId: ZodString;
|
|
3985
|
+
}, "strip", z.ZodTypeAny, {
|
|
3986
|
+
organizationId: string;
|
|
3987
|
+
}, {
|
|
3988
|
+
organizationId: string;
|
|
3989
|
+
}>;
|
|
3990
|
+
use: (((inputContext: {
|
|
3991
|
+
body?: any;
|
|
3992
|
+
query?: Record<string, any> | undefined;
|
|
3993
|
+
request?: Request | undefined;
|
|
3994
|
+
headers?: Headers | undefined;
|
|
3995
|
+
asResponse?: boolean | undefined;
|
|
3996
|
+
returnHeaders?: boolean | undefined;
|
|
3997
|
+
use?: better_call.Middleware[] | undefined;
|
|
3998
|
+
}) => Promise<{
|
|
3999
|
+
session: {
|
|
4000
|
+
session: Record<string, any> & {
|
|
4001
|
+
id: string;
|
|
4002
|
+
createdAt: Date;
|
|
4003
|
+
updatedAt: Date;
|
|
4004
|
+
userId: string;
|
|
4005
|
+
expiresAt: Date;
|
|
4006
|
+
token: string;
|
|
4007
|
+
ipAddress?: string | null | undefined;
|
|
4008
|
+
userAgent?: string | null | undefined;
|
|
4009
|
+
};
|
|
4010
|
+
user: Record<string, any> & {
|
|
4011
|
+
id: string;
|
|
4012
|
+
name: string;
|
|
4013
|
+
email: string;
|
|
4014
|
+
emailVerified: boolean;
|
|
4015
|
+
createdAt: Date;
|
|
4016
|
+
updatedAt: Date;
|
|
4017
|
+
image?: string | null | undefined;
|
|
4018
|
+
};
|
|
4019
|
+
};
|
|
4020
|
+
}>) | ((inputContext: {
|
|
4021
|
+
body?: any;
|
|
4022
|
+
query?: Record<string, any> | undefined;
|
|
4023
|
+
request?: Request | undefined;
|
|
4024
|
+
headers?: Headers | undefined;
|
|
4025
|
+
asResponse?: boolean | undefined;
|
|
4026
|
+
returnHeaders?: boolean | undefined;
|
|
4027
|
+
use?: better_call.Middleware[] | undefined;
|
|
4028
|
+
}) => Promise<{
|
|
4029
|
+
orgOptions: OrganizationOptions;
|
|
4030
|
+
roles: typeof defaultRoles & {
|
|
4031
|
+
[key: string]: Role<{}>;
|
|
4032
|
+
};
|
|
4033
|
+
getSession: (context: GenericEndpointContext) => Promise<{
|
|
4034
|
+
session: Session & {
|
|
4035
|
+
activeOrganizationId?: string;
|
|
4036
|
+
};
|
|
4037
|
+
user: User;
|
|
4038
|
+
}>;
|
|
4039
|
+
}>))[];
|
|
4040
|
+
} & {
|
|
4041
|
+
use: any[];
|
|
4042
|
+
};
|
|
4043
|
+
path: "/organization/leave";
|
|
4044
|
+
};
|
|
3939
4045
|
};
|
|
3940
4046
|
schema: {
|
|
3941
4047
|
session: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z, ZodLiteral, ZodObject, ZodOptional, ZodArray, ZodString } from 'zod';
|
|
2
2
|
import * as better_call from 'better-call';
|
|
3
3
|
import { AccessControl, Role, StatementsPrimitive, defaultRoles } from './plugins/access.cjs';
|
|
4
|
-
import { U as User, S as Session, G as GenericEndpointContext } from './auth-
|
|
4
|
+
import { U as User, S as Session, G as GenericEndpointContext } from './auth-CC4kpwks.cjs';
|
|
5
5
|
import { b as Prettify } from './helper-Bi8FQwDD.cjs';
|
|
6
6
|
|
|
7
7
|
declare const organizationSchema: z.ZodObject<{
|
|
@@ -3936,6 +3936,112 @@ declare const organization: <O extends OrganizationOptions>(options?: O) => {
|
|
|
3936
3936
|
};
|
|
3937
3937
|
path: "/organization/get-active-member";
|
|
3938
3938
|
};
|
|
3939
|
+
leaveOrganization: {
|
|
3940
|
+
<Context extends {
|
|
3941
|
+
body: {
|
|
3942
|
+
organizationId: string;
|
|
3943
|
+
};
|
|
3944
|
+
method?: "POST" | undefined;
|
|
3945
|
+
query?: Record<string, any> | undefined;
|
|
3946
|
+
params?: Record<string, any> | undefined;
|
|
3947
|
+
request?: Request | undefined;
|
|
3948
|
+
headers?: HeadersInit | undefined;
|
|
3949
|
+
asResponse?: boolean | undefined;
|
|
3950
|
+
returnHeaders?: boolean | undefined;
|
|
3951
|
+
use?: better_call.Middleware[] | undefined;
|
|
3952
|
+
path?: string | undefined;
|
|
3953
|
+
}>(...inputCtx: better_call.HasRequiredKeys<Context> extends true ? [Context] : [(Context | undefined)?]): Promise<Context["asResponse"] extends true ? Response : Context["returnHeaders"] extends true ? {
|
|
3954
|
+
headers: Headers;
|
|
3955
|
+
response: {
|
|
3956
|
+
user: {
|
|
3957
|
+
id: string;
|
|
3958
|
+
name: string;
|
|
3959
|
+
email: string;
|
|
3960
|
+
image: string | null | undefined;
|
|
3961
|
+
};
|
|
3962
|
+
id: string;
|
|
3963
|
+
createdAt: Date;
|
|
3964
|
+
userId: string;
|
|
3965
|
+
organizationId: string;
|
|
3966
|
+
role: string;
|
|
3967
|
+
};
|
|
3968
|
+
} : {
|
|
3969
|
+
user: {
|
|
3970
|
+
id: string;
|
|
3971
|
+
name: string;
|
|
3972
|
+
email: string;
|
|
3973
|
+
image: string | null | undefined;
|
|
3974
|
+
};
|
|
3975
|
+
id: string;
|
|
3976
|
+
createdAt: Date;
|
|
3977
|
+
userId: string;
|
|
3978
|
+
organizationId: string;
|
|
3979
|
+
role: string;
|
|
3980
|
+
}>;
|
|
3981
|
+
options: {
|
|
3982
|
+
method: "POST";
|
|
3983
|
+
body: ZodObject<{
|
|
3984
|
+
organizationId: ZodString;
|
|
3985
|
+
}, "strip", z.ZodTypeAny, {
|
|
3986
|
+
organizationId: string;
|
|
3987
|
+
}, {
|
|
3988
|
+
organizationId: string;
|
|
3989
|
+
}>;
|
|
3990
|
+
use: (((inputContext: {
|
|
3991
|
+
body?: any;
|
|
3992
|
+
query?: Record<string, any> | undefined;
|
|
3993
|
+
request?: Request | undefined;
|
|
3994
|
+
headers?: Headers | undefined;
|
|
3995
|
+
asResponse?: boolean | undefined;
|
|
3996
|
+
returnHeaders?: boolean | undefined;
|
|
3997
|
+
use?: better_call.Middleware[] | undefined;
|
|
3998
|
+
}) => Promise<{
|
|
3999
|
+
session: {
|
|
4000
|
+
session: Record<string, any> & {
|
|
4001
|
+
id: string;
|
|
4002
|
+
createdAt: Date;
|
|
4003
|
+
updatedAt: Date;
|
|
4004
|
+
userId: string;
|
|
4005
|
+
expiresAt: Date;
|
|
4006
|
+
token: string;
|
|
4007
|
+
ipAddress?: string | null | undefined;
|
|
4008
|
+
userAgent?: string | null | undefined;
|
|
4009
|
+
};
|
|
4010
|
+
user: Record<string, any> & {
|
|
4011
|
+
id: string;
|
|
4012
|
+
name: string;
|
|
4013
|
+
email: string;
|
|
4014
|
+
emailVerified: boolean;
|
|
4015
|
+
createdAt: Date;
|
|
4016
|
+
updatedAt: Date;
|
|
4017
|
+
image?: string | null | undefined;
|
|
4018
|
+
};
|
|
4019
|
+
};
|
|
4020
|
+
}>) | ((inputContext: {
|
|
4021
|
+
body?: any;
|
|
4022
|
+
query?: Record<string, any> | undefined;
|
|
4023
|
+
request?: Request | undefined;
|
|
4024
|
+
headers?: Headers | undefined;
|
|
4025
|
+
asResponse?: boolean | undefined;
|
|
4026
|
+
returnHeaders?: boolean | undefined;
|
|
4027
|
+
use?: better_call.Middleware[] | undefined;
|
|
4028
|
+
}) => Promise<{
|
|
4029
|
+
orgOptions: OrganizationOptions;
|
|
4030
|
+
roles: typeof defaultRoles & {
|
|
4031
|
+
[key: string]: Role<{}>;
|
|
4032
|
+
};
|
|
4033
|
+
getSession: (context: GenericEndpointContext) => Promise<{
|
|
4034
|
+
session: Session & {
|
|
4035
|
+
activeOrganizationId?: string;
|
|
4036
|
+
};
|
|
4037
|
+
user: User;
|
|
4038
|
+
}>;
|
|
4039
|
+
}>))[];
|
|
4040
|
+
} & {
|
|
4041
|
+
use: any[];
|
|
4042
|
+
};
|
|
4043
|
+
path: "/organization/leave";
|
|
4044
|
+
};
|
|
3939
4045
|
};
|
|
3940
4046
|
schema: {
|
|
3941
4047
|
session: {
|
package/dist/index.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkEHFDU6IF_cjs = require('./chunk-EHFDU6IF.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkN7UWN6ND_cjs = require('./chunk-N7UWN6ND.cjs');
|
|
5
5
|
var chunkJDAHD767_cjs = require('./chunk-JDAHD767.cjs');
|
|
6
6
|
require('./chunk-SVC7H7K4.cjs');
|
|
7
7
|
var chunkS5UORXJH_cjs = require('./chunk-S5UORXJH.cjs');
|
|
8
8
|
var chunkV6HE2MP7_cjs = require('./chunk-V6HE2MP7.cjs');
|
|
9
|
-
var
|
|
9
|
+
var chunkKAR56MJZ_cjs = require('./chunk-KAR56MJZ.cjs');
|
|
10
10
|
require('./chunk-B5UCLTPZ.cjs');
|
|
11
11
|
var chunkH74YRRNV_cjs = require('./chunk-H74YRRNV.cjs');
|
|
12
12
|
var chunk2Z6CVQHH_cjs = require('./chunk-2Z6CVQHH.cjs');
|
|
@@ -24,7 +24,7 @@ var DEFAULT_SECRET = "better-auth-secret-123456789";
|
|
|
24
24
|
|
|
25
25
|
// src/init.ts
|
|
26
26
|
var init = async (options) => {
|
|
27
|
-
const adapter = await
|
|
27
|
+
const adapter = await chunkKAR56MJZ_cjs.getAdapter(options);
|
|
28
28
|
const plugins = options.plugins || [];
|
|
29
29
|
const internalPlugins = getInternalPlugins(options);
|
|
30
30
|
const logger2 = chunkH74YRRNV_cjs.createLogger(options.logger);
|
|
@@ -45,7 +45,7 @@ var init = async (options) => {
|
|
|
45
45
|
plugins: plugins.concat(internalPlugins)
|
|
46
46
|
};
|
|
47
47
|
const cookies = chunkV6HE2MP7_cjs.getCookies(options);
|
|
48
|
-
const tables =
|
|
48
|
+
const tables = chunkKAR56MJZ_cjs.getAuthTables(options);
|
|
49
49
|
const providers = Object.keys(options.socialProviders || {}).map((key) => {
|
|
50
50
|
const value = options.socialProviders?.[key];
|
|
51
51
|
if (!value || value.enabled === false) {
|
|
@@ -108,7 +108,7 @@ var init = async (options) => {
|
|
|
108
108
|
},
|
|
109
109
|
newSession: null,
|
|
110
110
|
adapter,
|
|
111
|
-
internalAdapter:
|
|
111
|
+
internalAdapter: chunkKAR56MJZ_cjs.createInternalAdapter(adapter, {
|
|
112
112
|
options,
|
|
113
113
|
hooks: options.databaseHooks ? [options.databaseHooks] : [],
|
|
114
114
|
generateId: generateIdFunc
|
|
@@ -144,7 +144,7 @@ function runPluginInit(ctx) {
|
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
dbHooks.push(options.databaseHooks);
|
|
147
|
-
context.internalAdapter =
|
|
147
|
+
context.internalAdapter = chunkKAR56MJZ_cjs.createInternalAdapter(ctx.adapter, {
|
|
148
148
|
options,
|
|
149
149
|
hooks: dbHooks.filter((u) => u !== void 0),
|
|
150
150
|
generateId: ctx.generateId
|
|
@@ -163,7 +163,7 @@ function getTrustedOrigins(options) {
|
|
|
163
163
|
return [];
|
|
164
164
|
}
|
|
165
165
|
const trustedOrigins = [new URL(baseURL).origin];
|
|
166
|
-
if (options.trustedOrigins) {
|
|
166
|
+
if (options.trustedOrigins && Array.isArray(options.trustedOrigins)) {
|
|
167
167
|
trustedOrigins.push(...options.trustedOrigins);
|
|
168
168
|
}
|
|
169
169
|
const envTrustedOrigins = chunkVXYIYABQ_cjs.env.BETTER_AUTH_TRUSTED_ORIGINS;
|
|
@@ -176,7 +176,7 @@ function getTrustedOrigins(options) {
|
|
|
176
176
|
// src/auth.ts
|
|
177
177
|
var betterAuth = (options) => {
|
|
178
178
|
const authContext = init(options);
|
|
179
|
-
const { api } =
|
|
179
|
+
const { api } = chunkN7UWN6ND_cjs.getEndpoints(authContext, options);
|
|
180
180
|
const errorCodes = options.plugins?.reduce((acc, plugin) => {
|
|
181
181
|
if (plugin.$ERROR_CODES) {
|
|
182
182
|
return {
|
|
@@ -197,11 +197,11 @@ var betterAuth = (options) => {
|
|
|
197
197
|
ctx.baseURL = baseURL;
|
|
198
198
|
}
|
|
199
199
|
ctx.trustedOrigins = [
|
|
200
|
-
...options.trustedOrigins
|
|
200
|
+
...options.trustedOrigins ? Array.isArray(options.trustedOrigins) ? options.trustedOrigins : options.trustedOrigins(request) : [],
|
|
201
201
|
ctx.baseURL,
|
|
202
202
|
url.origin
|
|
203
203
|
];
|
|
204
|
-
const { handler } =
|
|
204
|
+
const { handler } = chunkN7UWN6ND_cjs.router(ctx, options);
|
|
205
205
|
return handler(request);
|
|
206
206
|
},
|
|
207
207
|
api,
|
|
@@ -210,7 +210,7 @@ var betterAuth = (options) => {
|
|
|
210
210
|
$Infer: {},
|
|
211
211
|
$ERROR_CODES: {
|
|
212
212
|
...errorCodes,
|
|
213
|
-
...
|
|
213
|
+
...chunkN7UWN6ND_cjs.BASE_ERROR_CODES
|
|
214
214
|
}
|
|
215
215
|
};
|
|
216
216
|
};
|