better-auth 1.2.5-beta.9 → 1.2.6-beta.1

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.
Files changed (197) hide show
  1. package/dist/adapters/drizzle-adapter/index.d.cts +3 -3
  2. package/dist/adapters/drizzle-adapter/index.d.mts +3 -3
  3. package/dist/adapters/drizzle-adapter/index.d.ts +3 -3
  4. package/dist/adapters/kysely-adapter/index.d.cts +3 -3
  5. package/dist/adapters/kysely-adapter/index.d.mts +3 -3
  6. package/dist/adapters/kysely-adapter/index.d.ts +3 -3
  7. package/dist/adapters/memory-adapter/index.d.cts +3 -3
  8. package/dist/adapters/memory-adapter/index.d.mts +3 -3
  9. package/dist/adapters/memory-adapter/index.d.ts +3 -3
  10. package/dist/adapters/mongodb-adapter/index.d.cts +3 -3
  11. package/dist/adapters/mongodb-adapter/index.d.mts +3 -3
  12. package/dist/adapters/mongodb-adapter/index.d.ts +3 -3
  13. package/dist/adapters/prisma-adapter/index.d.cts +3 -3
  14. package/dist/adapters/prisma-adapter/index.d.mts +3 -3
  15. package/dist/adapters/prisma-adapter/index.d.ts +3 -3
  16. package/dist/adapters/test.d.cts +3 -3
  17. package/dist/adapters/test.d.mts +3 -3
  18. package/dist/adapters/test.d.ts +3 -3
  19. package/dist/api/index.cjs +77 -75
  20. package/dist/api/index.d.cts +4 -4
  21. package/dist/api/index.d.mts +4 -4
  22. package/dist/api/index.d.ts +4 -4
  23. package/dist/api/index.mjs +6 -5
  24. package/dist/client/index.d.cts +4 -4
  25. package/dist/client/index.d.mts +4 -4
  26. package/dist/client/index.d.ts +4 -4
  27. package/dist/client/plugins/index.d.cts +4 -4
  28. package/dist/client/plugins/index.d.mts +4 -4
  29. package/dist/client/plugins/index.d.ts +4 -4
  30. package/dist/client/react/index.d.cts +4 -4
  31. package/dist/client/react/index.d.mts +4 -4
  32. package/dist/client/react/index.d.ts +4 -4
  33. package/dist/client/solid/index.d.cts +4 -4
  34. package/dist/client/solid/index.d.mts +4 -4
  35. package/dist/client/solid/index.d.ts +4 -4
  36. package/dist/client/svelte/index.d.cts +4 -4
  37. package/dist/client/svelte/index.d.mts +4 -4
  38. package/dist/client/svelte/index.d.ts +4 -4
  39. package/dist/client/vue/index.d.cts +4 -4
  40. package/dist/client/vue/index.d.mts +4 -4
  41. package/dist/client/vue/index.d.ts +4 -4
  42. package/dist/cookies/index.d.cts +3 -3
  43. package/dist/cookies/index.d.mts +3 -3
  44. package/dist/cookies/index.d.ts +3 -3
  45. package/dist/db/index.cjs +1 -1
  46. package/dist/db/index.d.cts +4 -4
  47. package/dist/db/index.d.mts +4 -4
  48. package/dist/db/index.d.ts +4 -4
  49. package/dist/db/index.mjs +1 -1
  50. package/dist/index.cjs +5 -5
  51. package/dist/index.d.cts +4 -4
  52. package/dist/index.d.mts +4 -4
  53. package/dist/index.d.ts +4 -4
  54. package/dist/index.mjs +4 -4
  55. package/dist/integrations/next-js.cjs +5 -5
  56. package/dist/integrations/next-js.d.cts +3 -3
  57. package/dist/integrations/next-js.d.mts +3 -3
  58. package/dist/integrations/next-js.d.ts +3 -3
  59. package/dist/integrations/next-js.mjs +4 -4
  60. package/dist/integrations/node.d.cts +3 -3
  61. package/dist/integrations/node.d.mts +3 -3
  62. package/dist/integrations/node.d.ts +3 -3
  63. package/dist/integrations/svelte-kit.d.cts +3 -3
  64. package/dist/integrations/svelte-kit.d.mts +3 -3
  65. package/dist/integrations/svelte-kit.d.ts +3 -3
  66. package/dist/oauth2/index.cjs +7 -6
  67. package/dist/oauth2/index.d.cts +14 -5
  68. package/dist/oauth2/index.d.mts +14 -5
  69. package/dist/oauth2/index.d.ts +14 -5
  70. package/dist/oauth2/index.mjs +1 -1
  71. package/dist/plugins/admin/index.cjs +3 -3
  72. package/dist/plugins/admin/index.d.cts +3 -3
  73. package/dist/plugins/admin/index.d.mts +3 -3
  74. package/dist/plugins/admin/index.d.ts +3 -3
  75. package/dist/plugins/admin/index.mjs +3 -3
  76. package/dist/plugins/anonymous/index.cjs +5 -5
  77. package/dist/plugins/anonymous/index.d.cts +3 -3
  78. package/dist/plugins/anonymous/index.d.mts +3 -3
  79. package/dist/plugins/anonymous/index.d.ts +3 -3
  80. package/dist/plugins/anonymous/index.mjs +2 -2
  81. package/dist/plugins/bearer/index.cjs +4 -4
  82. package/dist/plugins/bearer/index.d.cts +3 -3
  83. package/dist/plugins/bearer/index.d.mts +3 -3
  84. package/dist/plugins/bearer/index.d.ts +3 -3
  85. package/dist/plugins/bearer/index.mjs +2 -2
  86. package/dist/plugins/custom-session/index.cjs +4 -4
  87. package/dist/plugins/custom-session/index.d.cts +3 -3
  88. package/dist/plugins/custom-session/index.d.mts +3 -3
  89. package/dist/plugins/custom-session/index.d.ts +3 -3
  90. package/dist/plugins/custom-session/index.mjs +2 -2
  91. package/dist/plugins/email-otp/index.cjs +10 -10
  92. package/dist/plugins/email-otp/index.d.cts +3 -3
  93. package/dist/plugins/email-otp/index.d.mts +3 -3
  94. package/dist/plugins/email-otp/index.d.ts +3 -3
  95. package/dist/plugins/email-otp/index.mjs +2 -2
  96. package/dist/plugins/generic-oauth/index.cjs +43 -19
  97. package/dist/plugins/generic-oauth/index.d.cts +4 -4
  98. package/dist/plugins/generic-oauth/index.d.mts +4 -4
  99. package/dist/plugins/generic-oauth/index.d.ts +4 -4
  100. package/dist/plugins/generic-oauth/index.mjs +29 -5
  101. package/dist/plugins/index.cjs +22 -22
  102. package/dist/plugins/index.d.cts +4 -4
  103. package/dist/plugins/index.d.mts +4 -4
  104. package/dist/plugins/index.d.ts +4 -4
  105. package/dist/plugins/index.mjs +6 -6
  106. package/dist/plugins/jwt/index.cjs +6 -6
  107. package/dist/plugins/jwt/index.d.cts +3 -3
  108. package/dist/plugins/jwt/index.d.mts +3 -3
  109. package/dist/plugins/jwt/index.d.ts +3 -3
  110. package/dist/plugins/jwt/index.mjs +2 -2
  111. package/dist/plugins/magic-link/index.cjs +6 -6
  112. package/dist/plugins/magic-link/index.mjs +2 -2
  113. package/dist/plugins/multi-session/index.cjs +9 -9
  114. package/dist/plugins/multi-session/index.d.cts +3 -3
  115. package/dist/plugins/multi-session/index.d.mts +3 -3
  116. package/dist/plugins/multi-session/index.d.ts +3 -3
  117. package/dist/plugins/multi-session/index.mjs +2 -2
  118. package/dist/plugins/oauth-proxy/index.cjs +6 -6
  119. package/dist/plugins/oauth-proxy/index.d.cts +3 -3
  120. package/dist/plugins/oauth-proxy/index.d.mts +3 -3
  121. package/dist/plugins/oauth-proxy/index.d.ts +3 -3
  122. package/dist/plugins/oauth-proxy/index.mjs +2 -2
  123. package/dist/plugins/oidc-provider/index.cjs +14 -14
  124. package/dist/plugins/oidc-provider/index.d.cts +3 -3
  125. package/dist/plugins/oidc-provider/index.d.mts +3 -3
  126. package/dist/plugins/oidc-provider/index.d.ts +3 -3
  127. package/dist/plugins/oidc-provider/index.mjs +2 -2
  128. package/dist/plugins/one-tap/index.cjs +3 -3
  129. package/dist/plugins/one-tap/index.mjs +2 -2
  130. package/dist/plugins/open-api/index.cjs +4 -4
  131. package/dist/plugins/open-api/index.d.cts +3 -3
  132. package/dist/plugins/open-api/index.d.mts +3 -3
  133. package/dist/plugins/open-api/index.d.ts +3 -3
  134. package/dist/plugins/open-api/index.mjs +2 -2
  135. package/dist/plugins/organization/index.cjs +3 -3
  136. package/dist/plugins/organization/index.d.cts +3 -3
  137. package/dist/plugins/organization/index.d.mts +3 -3
  138. package/dist/plugins/organization/index.d.ts +3 -3
  139. package/dist/plugins/organization/index.mjs +3 -3
  140. package/dist/plugins/passkey/index.cjs +15 -15
  141. package/dist/plugins/passkey/index.d.cts +3 -3
  142. package/dist/plugins/passkey/index.d.mts +3 -3
  143. package/dist/plugins/passkey/index.d.ts +3 -3
  144. package/dist/plugins/passkey/index.mjs +2 -2
  145. package/dist/plugins/phone-number/index.cjs +13 -13
  146. package/dist/plugins/phone-number/index.d.cts +3 -3
  147. package/dist/plugins/phone-number/index.d.mts +3 -3
  148. package/dist/plugins/phone-number/index.d.ts +3 -3
  149. package/dist/plugins/phone-number/index.mjs +2 -2
  150. package/dist/plugins/sso/index.cjs +11 -11
  151. package/dist/plugins/sso/index.d.cts +2 -2
  152. package/dist/plugins/sso/index.d.mts +2 -2
  153. package/dist/plugins/sso/index.d.ts +2 -2
  154. package/dist/plugins/sso/index.mjs +3 -3
  155. package/dist/plugins/two-factor/index.cjs +20 -20
  156. package/dist/plugins/two-factor/index.d.cts +3 -3
  157. package/dist/plugins/two-factor/index.d.mts +3 -3
  158. package/dist/plugins/two-factor/index.d.ts +3 -3
  159. package/dist/plugins/two-factor/index.mjs +3 -3
  160. package/dist/plugins/username/index.cjs +9 -9
  161. package/dist/plugins/username/index.d.cts +3 -3
  162. package/dist/plugins/username/index.d.mts +3 -3
  163. package/dist/plugins/username/index.d.ts +3 -3
  164. package/dist/plugins/username/index.mjs +2 -2
  165. package/dist/shared/{better-auth.oyDBIJLs.mjs → better-auth.2rfXmCNS.mjs} +1 -1
  166. package/dist/shared/{better-auth.KTt7CS7L.mjs → better-auth.9knM1kR4.mjs} +1 -1
  167. package/dist/shared/{better-auth.DiMBK1Ep.mjs → better-auth.B2THyVQH.mjs} +54 -1
  168. package/dist/shared/{better-auth.C8tekzhG.cjs → better-auth.B7irTavj.cjs} +35 -35
  169. package/dist/shared/{better-auth.Dd96RDNl.d.ts → better-auth.BAfIsot3.d.ts} +41 -2
  170. package/dist/shared/{better-auth.Dunt9jpN.d.cts → better-auth.BBG0jAhH.d.mts} +2 -2
  171. package/dist/shared/{better-auth.CxMUffeh.d.cts → better-auth.BDAwKjlL.d.cts} +567 -46
  172. package/dist/shared/{better-auth.CbBX7Xla.mjs → better-auth.BK4Kh5QZ.mjs} +19 -17
  173. package/dist/shared/{better-auth.DgXCgiHI.cjs → better-auth.BLV8UOn8.cjs} +54 -0
  174. package/dist/shared/{better-auth.BjoUuJNr.d.mts → better-auth.BTnAiI8e.d.mts} +41 -2
  175. package/dist/shared/{better-auth.CzK7QJBv.d.cts → better-auth.CH6fRG6d.d.cts} +41 -2
  176. package/dist/shared/{better-auth.dzwyqpra.d.mts → better-auth.CTQDLJN7.d.mts} +567 -46
  177. package/dist/shared/{better-auth.CEuqoYDM.d.mts → better-auth.CtSY9Kmu.d.cts} +2 -2
  178. package/dist/shared/{better-auth.Cz2saE_0.d.cts → better-auth.DAnkIG1r.d.cts} +1 -1
  179. package/dist/shared/{better-auth.4ZqMps6Z.d.ts → better-auth.DCxEy-As.d.ts} +1 -1
  180. package/dist/shared/{better-auth.D7hUw1_Y.d.ts → better-auth.DIOWNBS2.d.ts} +1 -1
  181. package/dist/shared/{better-auth.ybwxmbrM.mjs → better-auth.DQ-pFMwp.mjs} +118 -5
  182. package/dist/shared/{better-auth.BxC2ipUB.d.mts → better-auth.DZPJQ81N.d.mts} +1 -1
  183. package/dist/shared/{better-auth.CL_N_Cfq.cjs → better-auth.DqGx7Ip8.cjs} +20 -20
  184. package/dist/shared/{better-auth.wspQErD2.cjs → better-auth.TNTVT6jt.cjs} +3 -3
  185. package/dist/shared/{better-auth.4J4_zAGP.cjs → better-auth.b0MLzqQX.cjs} +118 -4
  186. package/dist/shared/{better-auth.CdPDif0r.mjs → better-auth.cN4sTcuQ.mjs} +1 -1
  187. package/dist/shared/{better-auth.X0ynzeu1.cjs → better-auth.q7ChvjiM.cjs} +19 -17
  188. package/dist/shared/{better-auth.CixnJ90x.d.ts → better-auth.tpz8D0AA.d.ts} +567 -46
  189. package/dist/social-providers/index.cjs +197 -32
  190. package/dist/social-providers/index.d.cts +1 -1
  191. package/dist/social-providers/index.d.mts +1 -1
  192. package/dist/social-providers/index.d.ts +1 -1
  193. package/dist/social-providers/index.mjs +166 -1
  194. package/dist/types/index.d.cts +4 -4
  195. package/dist/types/index.d.mts +4 -4
  196. package/dist/types/index.d.ts +4 -4
  197. package/package.json +3 -3
@@ -2,7 +2,7 @@
2
2
 
3
3
  const betterCall = require('better-call');
4
4
  const zod = require('zod');
5
- const account = require('./better-auth.4J4_zAGP.cjs');
5
+ const refreshToken = require('./better-auth.b0MLzqQX.cjs');
6
6
  require('./better-auth.DiSjtgs9.cjs');
7
7
  require('@better-auth/utils/base64');
8
8
  require('@better-auth/utils/hmac');
@@ -592,12 +592,12 @@ const getOrgAdapter = (context, options) => {
592
592
  };
593
593
  };
594
594
 
595
- const orgMiddleware = account.createAuthMiddleware(async (ctx) => {
595
+ const orgMiddleware = refreshToken.createAuthMiddleware(async (ctx) => {
596
596
  return {};
597
597
  });
598
- const orgSessionMiddleware = account.createAuthMiddleware(
598
+ const orgSessionMiddleware = refreshToken.createAuthMiddleware(
599
599
  {
600
- use: [account.sessionMiddleware]
600
+ use: [refreshToken.sessionMiddleware]
601
601
  },
602
602
  async (ctx) => {
603
603
  const session = ctx.context.session;
@@ -654,7 +654,7 @@ const hasPermission = (input) => {
654
654
  return false;
655
655
  };
656
656
 
657
- const createInvitation = (option) => account.createAuthEndpoint(
657
+ const createInvitation = (option) => refreshToken.createAuthEndpoint(
658
658
  "/organization/invite-member",
659
659
  {
660
660
  method: "POST",
@@ -833,7 +833,7 @@ const createInvitation = (option) => account.createAuthEndpoint(
833
833
  return ctx.json(invitation);
834
834
  }
835
835
  );
836
- const acceptInvitation = account.createAuthEndpoint(
836
+ const acceptInvitation = refreshToken.createAuthEndpoint(
837
837
  "/organization/accept-invitation",
838
838
  {
839
839
  method: "POST",
@@ -928,7 +928,7 @@ const acceptInvitation = account.createAuthEndpoint(
928
928
  });
929
929
  }
930
930
  );
931
- const rejectInvitation = account.createAuthEndpoint(
931
+ const rejectInvitation = refreshToken.createAuthEndpoint(
932
932
  "/organization/reject-invitation",
933
933
  {
934
934
  method: "POST",
@@ -988,7 +988,7 @@ const rejectInvitation = account.createAuthEndpoint(
988
988
  });
989
989
  }
990
990
  );
991
- const cancelInvitation = account.createAuthEndpoint(
991
+ const cancelInvitation = refreshToken.createAuthEndpoint(
992
992
  "/organization/cancel-invitation",
993
993
  {
994
994
  method: "POST",
@@ -1056,7 +1056,7 @@ const cancelInvitation = account.createAuthEndpoint(
1056
1056
  return ctx.json(canceledI);
1057
1057
  }
1058
1058
  );
1059
- const getInvitation = account.createAuthEndpoint(
1059
+ const getInvitation = refreshToken.createAuthEndpoint(
1060
1060
  "/organization/get-invitation",
1061
1061
  {
1062
1062
  method: "GET",
@@ -1130,7 +1130,7 @@ const getInvitation = account.createAuthEndpoint(
1130
1130
  }
1131
1131
  },
1132
1132
  async (ctx) => {
1133
- const session = await account.getSessionFromCtx(ctx);
1133
+ const session = await refreshToken.getSessionFromCtx(ctx);
1134
1134
  if (!session) {
1135
1135
  throw new betterCall.APIError("UNAUTHORIZED", {
1136
1136
  message: "Not authenticated"
@@ -1174,7 +1174,7 @@ const getInvitation = account.createAuthEndpoint(
1174
1174
  }
1175
1175
  );
1176
1176
 
1177
- const addMember = () => account.createAuthEndpoint(
1177
+ const addMember = () => refreshToken.createAuthEndpoint(
1178
1178
  "/organization/add-member",
1179
1179
  {
1180
1180
  method: "POST",
@@ -1192,7 +1192,7 @@ const addMember = () => account.createAuthEndpoint(
1192
1192
  }
1193
1193
  },
1194
1194
  async (ctx) => {
1195
- const session = ctx.body.userId ? await account.getSessionFromCtx(ctx).catch((e) => null) : null;
1195
+ const session = ctx.body.userId ? await refreshToken.getSessionFromCtx(ctx).catch((e) => null) : null;
1196
1196
  const orgId = ctx.body.organizationId || session?.session.activeOrganizationId;
1197
1197
  if (!orgId) {
1198
1198
  return ctx.json(null, {
@@ -1215,7 +1215,7 @@ const addMember = () => account.createAuthEndpoint(
1215
1215
  );
1216
1216
  if (!user) {
1217
1217
  throw new betterCall.APIError("BAD_REQUEST", {
1218
- message: account.BASE_ERROR_CODES.USER_NOT_FOUND
1218
+ message: refreshToken.BASE_ERROR_CODES.USER_NOT_FOUND
1219
1219
  });
1220
1220
  }
1221
1221
  const alreadyMember = await adapter.findMemberByEmail({
@@ -1256,7 +1256,7 @@ const addMember = () => account.createAuthEndpoint(
1256
1256
  return ctx.json(createdMember);
1257
1257
  }
1258
1258
  );
1259
- const removeMember = account.createAuthEndpoint(
1259
+ const removeMember = refreshToken.createAuthEndpoint(
1260
1260
  "/organization/remove-member",
1261
1261
  {
1262
1262
  method: "POST",
@@ -1402,7 +1402,7 @@ const removeMember = account.createAuthEndpoint(
1402
1402
  });
1403
1403
  }
1404
1404
  );
1405
- const updateMemberRole = (option) => account.createAuthEndpoint(
1405
+ const updateMemberRole = (option) => refreshToken.createAuthEndpoint(
1406
1406
  "/organization/update-member-role",
1407
1407
  {
1408
1408
  method: "POST",
@@ -1514,7 +1514,7 @@ const updateMemberRole = (option) => account.createAuthEndpoint(
1514
1514
  return ctx.json(updatedMember);
1515
1515
  }
1516
1516
  );
1517
- const getActiveMember = account.createAuthEndpoint(
1517
+ const getActiveMember = refreshToken.createAuthEndpoint(
1518
1518
  "/organization/get-active-member",
1519
1519
  {
1520
1520
  method: "GET",
@@ -1579,14 +1579,14 @@ const getActiveMember = account.createAuthEndpoint(
1579
1579
  return ctx.json(member);
1580
1580
  }
1581
1581
  );
1582
- const leaveOrganization = account.createAuthEndpoint(
1582
+ const leaveOrganization = refreshToken.createAuthEndpoint(
1583
1583
  "/organization/leave",
1584
1584
  {
1585
1585
  method: "POST",
1586
1586
  body: zod.z.object({
1587
1587
  organizationId: zod.z.string()
1588
1588
  }),
1589
- use: [account.sessionMiddleware, orgMiddleware]
1589
+ use: [refreshToken.sessionMiddleware, orgMiddleware]
1590
1590
  },
1591
1591
  async (ctx) => {
1592
1592
  const session = ctx.context.session;
@@ -1628,7 +1628,7 @@ const leaveOrganization = account.createAuthEndpoint(
1628
1628
  }
1629
1629
  );
1630
1630
 
1631
- const createOrganization = account.createAuthEndpoint(
1631
+ const createOrganization = refreshToken.createAuthEndpoint(
1632
1632
  "/organization/create",
1633
1633
  {
1634
1634
  method: "POST",
@@ -1674,7 +1674,7 @@ const createOrganization = account.createAuthEndpoint(
1674
1674
  }
1675
1675
  },
1676
1676
  async (ctx) => {
1677
- const session = await account.getSessionFromCtx(ctx);
1677
+ const session = await refreshToken.getSessionFromCtx(ctx);
1678
1678
  if (!session && (ctx.request || ctx.headers)) {
1679
1679
  throw new betterCall.APIError("UNAUTHORIZED");
1680
1680
  }
@@ -1790,14 +1790,14 @@ const createOrganization = account.createAuthEndpoint(
1790
1790
  });
1791
1791
  }
1792
1792
  );
1793
- const checkOrganizationSlug = account.createAuthEndpoint(
1793
+ const checkOrganizationSlug = refreshToken.createAuthEndpoint(
1794
1794
  "/organization/check-slug",
1795
1795
  {
1796
1796
  method: "POST",
1797
1797
  body: zod.z.object({
1798
1798
  slug: zod.z.string()
1799
1799
  }),
1800
- use: [account.requestOnlySessionMiddleware, orgMiddleware]
1800
+ use: [refreshToken.requestOnlySessionMiddleware, orgMiddleware]
1801
1801
  },
1802
1802
  async (ctx) => {
1803
1803
  const orgAdapter = getOrgAdapter(ctx.context);
@@ -1812,7 +1812,7 @@ const checkOrganizationSlug = account.createAuthEndpoint(
1812
1812
  });
1813
1813
  }
1814
1814
  );
1815
- const updateOrganization = account.createAuthEndpoint(
1815
+ const updateOrganization = refreshToken.createAuthEndpoint(
1816
1816
  "/organization/update",
1817
1817
  {
1818
1818
  method: "POST",
@@ -1897,7 +1897,7 @@ const updateOrganization = account.createAuthEndpoint(
1897
1897
  return ctx.json(updatedOrg);
1898
1898
  }
1899
1899
  );
1900
- const deleteOrganization = account.createAuthEndpoint(
1900
+ const deleteOrganization = refreshToken.createAuthEndpoint(
1901
1901
  "/organization/delete",
1902
1902
  {
1903
1903
  method: "POST",
@@ -1995,7 +1995,7 @@ const deleteOrganization = account.createAuthEndpoint(
1995
1995
  return ctx.json(org);
1996
1996
  }
1997
1997
  );
1998
- const getFullOrganization = () => account.createAuthEndpoint(
1998
+ const getFullOrganization = () => refreshToken.createAuthEndpoint(
1999
1999
  "/organization/get-full-organization",
2000
2000
  {
2001
2001
  method: "GET",
@@ -2062,7 +2062,7 @@ const getFullOrganization = () => account.createAuthEndpoint(
2062
2062
  }
2063
2063
  );
2064
2064
  const setActiveOrganization = () => {
2065
- return account.createAuthEndpoint(
2065
+ return refreshToken.createAuthEndpoint(
2066
2066
  "/organization/set-active",
2067
2067
  {
2068
2068
  method: "POST",
@@ -2151,7 +2151,7 @@ const setActiveOrganization = () => {
2151
2151
  }
2152
2152
  );
2153
2153
  };
2154
- const listOrganizations = account.createAuthEndpoint(
2154
+ const listOrganizations = refreshToken.createAuthEndpoint(
2155
2155
  "/organization/list",
2156
2156
  {
2157
2157
  method: "GET",
@@ -2222,7 +2222,7 @@ const teamSchema = zod.z.object({
2222
2222
  updatedAt: zod.z.date().optional()
2223
2223
  });
2224
2224
 
2225
- const createTeam = (options) => account.createAuthEndpoint(
2225
+ const createTeam = (options) => refreshToken.createAuthEndpoint(
2226
2226
  "/organization/create-team",
2227
2227
  {
2228
2228
  method: "POST",
@@ -2233,7 +2233,7 @@ const createTeam = (options) => account.createAuthEndpoint(
2233
2233
  use: [orgMiddleware]
2234
2234
  },
2235
2235
  async (ctx) => {
2236
- const session = await account.getSessionFromCtx(ctx);
2236
+ const session = await refreshToken.getSessionFromCtx(ctx);
2237
2237
  const organizationId = ctx.body.organizationId || session?.session.activeOrganizationId;
2238
2238
  if (!session && (ctx.request || ctx.headers)) {
2239
2239
  throw new betterCall.APIError("UNAUTHORIZED");
@@ -2291,7 +2291,7 @@ const createTeam = (options) => account.createAuthEndpoint(
2291
2291
  return ctx.json(createdTeam);
2292
2292
  }
2293
2293
  );
2294
- const removeTeam = account.createAuthEndpoint(
2294
+ const removeTeam = refreshToken.createAuthEndpoint(
2295
2295
  "/organization/remove-team",
2296
2296
  {
2297
2297
  method: "POST",
@@ -2302,7 +2302,7 @@ const removeTeam = account.createAuthEndpoint(
2302
2302
  use: [orgMiddleware]
2303
2303
  },
2304
2304
  async (ctx) => {
2305
- const session = await account.getSessionFromCtx(ctx);
2305
+ const session = await refreshToken.getSessionFromCtx(ctx);
2306
2306
  const organizationId = ctx.body.organizationId || session?.session.activeOrganizationId;
2307
2307
  if (!organizationId) {
2308
2308
  return ctx.json(null, {
@@ -2360,7 +2360,7 @@ const removeTeam = account.createAuthEndpoint(
2360
2360
  return ctx.json({ message: "Team removed successfully." });
2361
2361
  }
2362
2362
  );
2363
- const updateTeam = account.createAuthEndpoint(
2363
+ const updateTeam = refreshToken.createAuthEndpoint(
2364
2364
  "/organization/update-team",
2365
2365
  {
2366
2366
  method: "POST",
@@ -2418,7 +2418,7 @@ const updateTeam = account.createAuthEndpoint(
2418
2418
  return ctx.json(updatedTeam);
2419
2419
  }
2420
2420
  );
2421
- const listOrganizationTeams = account.createAuthEndpoint(
2421
+ const listOrganizationTeams = refreshToken.createAuthEndpoint(
2422
2422
  "/organization/list-teams",
2423
2423
  {
2424
2424
  method: "GET",
@@ -2528,14 +2528,14 @@ const organization = (options) => {
2528
2528
  orgOptions: options || {},
2529
2529
  roles,
2530
2530
  getSession: async (context) => {
2531
- return await account.getSessionFromCtx(context);
2531
+ return await refreshToken.getSessionFromCtx(context);
2532
2532
  }
2533
2533
  });
2534
2534
  return {
2535
2535
  id: "organization",
2536
2536
  endpoints: {
2537
2537
  ...api,
2538
- hasPermission: account.createAuthEndpoint(
2538
+ hasPermission: refreshToken.createAuthEndpoint(
2539
2539
  "/organization/has-permission",
2540
2540
  {
2541
2541
  method: "POST",
@@ -38,6 +38,9 @@ interface OAuthProvider<T extends Record<string, any> = Record<string, any>> {
38
38
  };
39
39
  data: T;
40
40
  } | null>;
41
+ /**
42
+ * Custom function to refresh a token
43
+ */
41
44
  refreshAccessToken?: (refreshToken: string) => Promise<OAuth2Tokens>;
42
45
  revokeToken?: (token: string) => Promise<void>;
43
46
  /**
@@ -110,6 +113,10 @@ type ProviderOptions<Profile extends Record<string, any> = any> = {
110
113
  };
111
114
  data: any;
112
115
  }>;
116
+ /**
117
+ * Custom function to refresh a token
118
+ */
119
+ refreshAccessToken?: (refreshToken: string) => Promise<OAuth2Tokens>;
113
120
  /**
114
121
  * Custom function to map the provider profile to a
115
122
  * user.
@@ -192,6 +199,7 @@ declare const vk: (options: VkOption) => {
192
199
  codeVerifier?: string;
193
200
  deviceId?: string;
194
201
  }) => Promise<OAuth2Tokens>;
202
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
195
203
  getUserInfo(data: OAuth2Tokens): Promise<{
196
204
  user: {
197
205
  id: string;
@@ -242,6 +250,7 @@ declare const roblox: (options: RobloxOptions) => {
242
250
  codeVerifier?: string;
243
251
  deviceId?: string;
244
252
  }) => Promise<OAuth2Tokens>;
253
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
245
254
  getUserInfo(token: OAuth2Tokens): Promise<{
246
255
  user: {
247
256
  id: string;
@@ -284,6 +293,7 @@ declare const reddit: (options: RedditOptions) => {
284
293
  codeVerifier?: string;
285
294
  deviceId?: string;
286
295
  }) => Promise<OAuth2Tokens>;
296
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
287
297
  getUserInfo(token: OAuth2Tokens): Promise<{
288
298
  user: {
289
299
  id: string;
@@ -431,6 +441,7 @@ declare const tiktok: (options: TiktokOptions) => {
431
441
  codeVerifier?: string;
432
442
  deviceId?: string;
433
443
  }) => Promise<OAuth2Tokens>;
444
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
434
445
  getUserInfo(token: OAuth2Tokens): Promise<{
435
446
  user: {
436
447
  id: string;
@@ -509,6 +520,7 @@ declare const gitlab: (options: GitlabOptions) => {
509
520
  codeVerifier?: string;
510
521
  deviceId?: string;
511
522
  }) => Promise<OAuth2Tokens>;
523
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
512
524
  getUserInfo(token: OAuth2Tokens): Promise<{
513
525
  user: {
514
526
  id: string;
@@ -555,6 +567,7 @@ declare const linkedin: (options: LinkedInOptions) => {
555
567
  codeVerifier?: string;
556
568
  deviceId?: string;
557
569
  }) => Promise<OAuth2Tokens>;
570
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
558
571
  getUserInfo(token: OAuth2Tokens): Promise<{
559
572
  user: {
560
573
  id: string;
@@ -652,6 +665,7 @@ declare const dropbox: (options: DropboxOptions) => {
652
665
  codeVerifier?: string;
653
666
  deviceId?: string;
654
667
  }) => Promise<OAuth2Tokens>;
668
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
655
669
  getUserInfo(token: OAuth2Tokens): Promise<{
656
670
  user: {
657
671
  id: string;
@@ -773,12 +787,15 @@ declare const twitter: (options: TwitterOption) => {
773
787
  codeVerifier?: string;
774
788
  deviceId?: string;
775
789
  }) => Promise<OAuth2Tokens>;
790
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
776
791
  getUserInfo(token: OAuth2Tokens): Promise<{
777
792
  user: {
778
793
  id: string;
779
794
  name?: string;
780
- email?: string | null;
781
- image? /** The URL to the profile image for this user, as shown on the user's profile. */: string;
795
+ email
796
+ /** The URL to the profile image for this user, as shown on the user's profile. */
797
+ ? /** The URL to the profile image for this user, as shown on the user's profile. */: string | null;
798
+ image?: string;
782
799
  emailVerified: boolean;
783
800
  [key: string]: any;
784
801
  };
@@ -825,6 +842,7 @@ declare const twitch: (options: TwitchOptions) => {
825
842
  codeVerifier?: string;
826
843
  deviceId?: string;
827
844
  }) => Promise<OAuth2Tokens>;
845
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
828
846
  getUserInfo(token: OAuth2Tokens): Promise<{
829
847
  user: {
830
848
  id: string;
@@ -866,6 +884,7 @@ declare const spotify: (options: SpotifyOptions) => {
866
884
  codeVerifier?: string;
867
885
  deviceId?: string;
868
886
  }) => Promise<OAuth2Tokens>;
887
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
869
888
  getUserInfo(token: OAuth2Tokens): Promise<{
870
889
  user: {
871
890
  id: string;
@@ -937,6 +956,7 @@ declare const google: (options: GoogleOptions) => {
937
956
  codeVerifier?: string;
938
957
  deviceId?: string;
939
958
  }) => Promise<OAuth2Tokens>;
959
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
940
960
  verifyIdToken(token: string, nonce: string | undefined): Promise<boolean>;
941
961
  getUserInfo(token: OAuth2Tokens): Promise<{
942
962
  user: {
@@ -1070,6 +1090,7 @@ declare const github: (options: GithubOptions) => {
1070
1090
  codeVerifier?: string;
1071
1091
  deviceId?: string;
1072
1092
  }) => Promise<OAuth2Tokens>;
1093
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
1073
1094
  getUserInfo(token: OAuth2Tokens): Promise<{
1074
1095
  user: {
1075
1096
  id: string;
@@ -1124,6 +1145,7 @@ declare const facebook: (options: FacebookOptions) => {
1124
1145
  deviceId?: string;
1125
1146
  }) => Promise<OAuth2Tokens>;
1126
1147
  verifyIdToken(token: string, nonce: string | undefined): Promise<boolean>;
1148
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
1127
1149
  getUserInfo(token: OAuth2Tokens): Promise<{
1128
1150
  user: {
1129
1151
  id: string;
@@ -1227,6 +1249,7 @@ declare const discord: (options: DiscordOptions) => {
1227
1249
  codeVerifier?: string;
1228
1250
  deviceId?: string;
1229
1251
  }) => Promise<OAuth2Tokens>;
1252
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
1230
1253
  getUserInfo(token: OAuth2Tokens): Promise<{
1231
1254
  user: {
1232
1255
  id: string;
@@ -1321,6 +1344,7 @@ declare const apple: (options: AppleOptions) => {
1321
1344
  deviceId?: string;
1322
1345
  }) => Promise<OAuth2Tokens>;
1323
1346
  verifyIdToken(token: string, nonce: string | undefined): Promise<boolean>;
1347
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
1324
1348
  getUserInfo(token: OAuth2Tokens): Promise<{
1325
1349
  user: {
1326
1350
  id: string;
@@ -1355,6 +1379,7 @@ declare const socialProviders: {
1355
1379
  deviceId?: string;
1356
1380
  }) => Promise<OAuth2Tokens>;
1357
1381
  verifyIdToken(token: string, nonce: string | undefined): Promise<boolean>;
1382
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
1358
1383
  getUserInfo(token: OAuth2Tokens): Promise<{
1359
1384
  user: {
1360
1385
  id: string;
@@ -1385,6 +1410,7 @@ declare const socialProviders: {
1385
1410
  codeVerifier?: string;
1386
1411
  deviceId?: string;
1387
1412
  }) => Promise<OAuth2Tokens>;
1413
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
1388
1414
  getUserInfo(token: OAuth2Tokens): Promise<{
1389
1415
  user: {
1390
1416
  id: string;
@@ -1416,6 +1442,7 @@ declare const socialProviders: {
1416
1442
  deviceId?: string;
1417
1443
  }) => Promise<OAuth2Tokens>;
1418
1444
  verifyIdToken(token: string, nonce: string | undefined): Promise<boolean>;
1445
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
1419
1446
  getUserInfo(token: OAuth2Tokens): Promise<{
1420
1447
  user: {
1421
1448
  id: string;
@@ -1446,6 +1473,7 @@ declare const socialProviders: {
1446
1473
  codeVerifier?: string;
1447
1474
  deviceId?: string;
1448
1475
  }) => Promise<OAuth2Tokens>;
1476
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
1449
1477
  getUserInfo(token: OAuth2Tokens): Promise<{
1450
1478
  user: {
1451
1479
  id: string;
@@ -1506,6 +1534,7 @@ declare const socialProviders: {
1506
1534
  codeVerifier?: string;
1507
1535
  deviceId?: string;
1508
1536
  }) => Promise<OAuth2Tokens>;
1537
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
1509
1538
  verifyIdToken(token: string, nonce: string | undefined): Promise<boolean>;
1510
1539
  getUserInfo(token: OAuth2Tokens): Promise<{
1511
1540
  user: {
@@ -1537,6 +1566,7 @@ declare const socialProviders: {
1537
1566
  codeVerifier?: string;
1538
1567
  deviceId?: string;
1539
1568
  }) => Promise<OAuth2Tokens>;
1569
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
1540
1570
  getUserInfo(token: OAuth2Tokens): Promise<{
1541
1571
  user: {
1542
1572
  id: string;
@@ -1567,6 +1597,7 @@ declare const socialProviders: {
1567
1597
  codeVerifier?: string;
1568
1598
  deviceId?: string;
1569
1599
  }) => Promise<OAuth2Tokens>;
1600
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
1570
1601
  getUserInfo(token: OAuth2Tokens): Promise<{
1571
1602
  user: {
1572
1603
  id: string;
@@ -1597,6 +1628,7 @@ declare const socialProviders: {
1597
1628
  codeVerifier?: string;
1598
1629
  deviceId?: string;
1599
1630
  }) => Promise<OAuth2Tokens>;
1631
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
1600
1632
  getUserInfo(token: OAuth2Tokens): Promise<{
1601
1633
  user: {
1602
1634
  id: string;
@@ -1627,6 +1659,7 @@ declare const socialProviders: {
1627
1659
  codeVerifier?: string;
1628
1660
  deviceId?: string;
1629
1661
  }) => Promise<OAuth2Tokens>;
1662
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
1630
1663
  getUserInfo(token: OAuth2Tokens): Promise<{
1631
1664
  user: {
1632
1665
  id: string;
@@ -1687,6 +1720,7 @@ declare const socialProviders: {
1687
1720
  codeVerifier?: string;
1688
1721
  deviceId?: string;
1689
1722
  }) => Promise<OAuth2Tokens>;
1723
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
1690
1724
  getUserInfo(token: OAuth2Tokens): Promise<{
1691
1725
  user: {
1692
1726
  id: string;
@@ -1717,6 +1751,7 @@ declare const socialProviders: {
1717
1751
  codeVerifier?: string;
1718
1752
  deviceId?: string;
1719
1753
  }) => Promise<OAuth2Tokens>;
1754
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
1720
1755
  getUserInfo(token: OAuth2Tokens): Promise<{
1721
1756
  user: {
1722
1757
  id: string;
@@ -1747,6 +1782,7 @@ declare const socialProviders: {
1747
1782
  codeVerifier?: string;
1748
1783
  deviceId?: string;
1749
1784
  }) => Promise<OAuth2Tokens>;
1785
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
1750
1786
  getUserInfo(token: OAuth2Tokens): Promise<{
1751
1787
  user: {
1752
1788
  id: string;
@@ -1777,6 +1813,7 @@ declare const socialProviders: {
1777
1813
  codeVerifier?: string;
1778
1814
  deviceId?: string;
1779
1815
  }) => Promise<OAuth2Tokens>;
1816
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
1780
1817
  getUserInfo(token: OAuth2Tokens): Promise<{
1781
1818
  user: {
1782
1819
  id: string;
@@ -1807,6 +1844,7 @@ declare const socialProviders: {
1807
1844
  codeVerifier?: string;
1808
1845
  deviceId?: string;
1809
1846
  }) => Promise<OAuth2Tokens>;
1847
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
1810
1848
  getUserInfo(token: OAuth2Tokens): Promise<{
1811
1849
  user: {
1812
1850
  id: string;
@@ -1837,6 +1875,7 @@ declare const socialProviders: {
1837
1875
  codeVerifier?: string;
1838
1876
  deviceId?: string;
1839
1877
  }) => Promise<OAuth2Tokens>;
1878
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
1840
1879
  getUserInfo(data: OAuth2Tokens): Promise<{
1841
1880
  user: {
1842
1881
  id: string;
@@ -1,7 +1,7 @@
1
1
  import * as zod from 'zod';
2
2
  import * as better_call from 'better-call';
3
- import { G as GenericEndpointContext, I as InferOptionSchema, H as HookEndpointContext, l as AuthContext } from './better-auth.CxMUffeh.cjs';
4
- import { Statements } from '../plugins/access/index.cjs';
3
+ import { G as GenericEndpointContext, I as InferOptionSchema, H as HookEndpointContext, l as AuthContext } from './better-auth.CTQDLJN7.mjs';
4
+ import { Statements } from '../plugins/access/index.mjs';
5
5
 
6
6
  declare const apiKeySchema: ({ timeWindow, rateLimitMax, }: {
7
7
  timeWindow: number;