better-auth 1.2.6-beta.5 → 1.2.6-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.
Files changed (193) hide show
  1. package/dist/adapters/drizzle-adapter/index.d.cts +1 -1
  2. package/dist/adapters/drizzle-adapter/index.d.mts +1 -1
  3. package/dist/adapters/drizzle-adapter/index.d.ts +1 -1
  4. package/dist/adapters/kysely-adapter/index.d.cts +1 -1
  5. package/dist/adapters/kysely-adapter/index.d.mts +1 -1
  6. package/dist/adapters/kysely-adapter/index.d.ts +1 -1
  7. package/dist/adapters/memory-adapter/index.d.cts +1 -1
  8. package/dist/adapters/memory-adapter/index.d.mts +1 -1
  9. package/dist/adapters/memory-adapter/index.d.ts +1 -1
  10. package/dist/adapters/mongodb-adapter/index.d.cts +1 -1
  11. package/dist/adapters/mongodb-adapter/index.d.mts +1 -1
  12. package/dist/adapters/mongodb-adapter/index.d.ts +1 -1
  13. package/dist/adapters/prisma-adapter/index.d.cts +1 -1
  14. package/dist/adapters/prisma-adapter/index.d.mts +1 -1
  15. package/dist/adapters/prisma-adapter/index.d.ts +1 -1
  16. package/dist/adapters/test.d.cts +1 -1
  17. package/dist/adapters/test.d.mts +1 -1
  18. package/dist/adapters/test.d.ts +1 -1
  19. package/dist/api/index.cjs +2 -2
  20. package/dist/api/index.d.cts +1 -1
  21. package/dist/api/index.d.mts +1 -1
  22. package/dist/api/index.d.ts +1 -1
  23. package/dist/api/index.mjs +3 -3
  24. package/dist/client/index.d.cts +1 -1
  25. package/dist/client/index.d.mts +1 -1
  26. package/dist/client/index.d.ts +1 -1
  27. package/dist/client/plugins/index.d.cts +2 -2
  28. package/dist/client/plugins/index.d.mts +2 -2
  29. package/dist/client/plugins/index.d.ts +2 -2
  30. package/dist/client/react/index.d.cts +1 -1
  31. package/dist/client/react/index.d.mts +1 -1
  32. package/dist/client/react/index.d.ts +1 -1
  33. package/dist/client/solid/index.d.cts +1 -1
  34. package/dist/client/solid/index.d.mts +1 -1
  35. package/dist/client/solid/index.d.ts +1 -1
  36. package/dist/client/svelte/index.d.cts +1 -1
  37. package/dist/client/svelte/index.d.mts +1 -1
  38. package/dist/client/svelte/index.d.ts +1 -1
  39. package/dist/client/vue/index.d.cts +1 -1
  40. package/dist/client/vue/index.d.mts +1 -1
  41. package/dist/client/vue/index.d.ts +1 -1
  42. package/dist/cookies/index.d.cts +1 -1
  43. package/dist/cookies/index.d.mts +1 -1
  44. package/dist/cookies/index.d.ts +1 -1
  45. package/dist/db/index.d.cts +2 -2
  46. package/dist/db/index.d.mts +2 -2
  47. package/dist/db/index.d.ts +2 -2
  48. package/dist/index.cjs +2 -2
  49. package/dist/index.d.cts +2 -2
  50. package/dist/index.d.mts +2 -2
  51. package/dist/index.d.ts +2 -2
  52. package/dist/index.mjs +3 -3
  53. package/dist/integrations/next-js.cjs +4 -4
  54. package/dist/integrations/next-js.d.cts +1 -1
  55. package/dist/integrations/next-js.d.mts +1 -1
  56. package/dist/integrations/next-js.d.ts +1 -1
  57. package/dist/integrations/next-js.mjs +4 -4
  58. package/dist/integrations/node.d.cts +1 -1
  59. package/dist/integrations/node.d.mts +1 -1
  60. package/dist/integrations/node.d.ts +1 -1
  61. package/dist/integrations/svelte-kit.d.cts +1 -1
  62. package/dist/integrations/svelte-kit.d.mts +1 -1
  63. package/dist/integrations/svelte-kit.d.ts +1 -1
  64. package/dist/oauth2/index.cjs +2 -2
  65. package/dist/oauth2/index.d.cts +2 -2
  66. package/dist/oauth2/index.d.mts +2 -2
  67. package/dist/oauth2/index.d.ts +2 -2
  68. package/dist/oauth2/index.mjs +2 -2
  69. package/dist/plugins/admin/index.cjs +3 -3
  70. package/dist/plugins/admin/index.d.cts +284 -642
  71. package/dist/plugins/admin/index.d.mts +284 -642
  72. package/dist/plugins/admin/index.d.ts +284 -642
  73. package/dist/plugins/admin/index.mjs +3 -3
  74. package/dist/plugins/anonymous/index.cjs +2 -2
  75. package/dist/plugins/anonymous/index.d.cts +21 -34
  76. package/dist/plugins/anonymous/index.d.mts +21 -34
  77. package/dist/plugins/anonymous/index.d.ts +21 -34
  78. package/dist/plugins/anonymous/index.mjs +2 -2
  79. package/dist/plugins/bearer/index.cjs +2 -2
  80. package/dist/plugins/bearer/index.d.cts +1 -1
  81. package/dist/plugins/bearer/index.d.mts +1 -1
  82. package/dist/plugins/bearer/index.d.ts +1 -1
  83. package/dist/plugins/bearer/index.mjs +2 -2
  84. package/dist/plugins/custom-session/index.cjs +3 -3
  85. package/dist/plugins/custom-session/index.d.cts +22 -25
  86. package/dist/plugins/custom-session/index.d.mts +22 -25
  87. package/dist/plugins/custom-session/index.d.ts +22 -25
  88. package/dist/plugins/custom-session/index.mjs +3 -3
  89. package/dist/plugins/email-otp/index.cjs +2 -2
  90. package/dist/plugins/email-otp/index.d.cts +141 -260
  91. package/dist/plugins/email-otp/index.d.mts +141 -260
  92. package/dist/plugins/email-otp/index.d.ts +141 -260
  93. package/dist/plugins/email-otp/index.mjs +2 -2
  94. package/dist/plugins/generic-oauth/index.cjs +5 -6
  95. package/dist/plugins/generic-oauth/index.d.cts +64 -131
  96. package/dist/plugins/generic-oauth/index.d.mts +64 -131
  97. package/dist/plugins/generic-oauth/index.d.ts +64 -131
  98. package/dist/plugins/generic-oauth/index.mjs +5 -6
  99. package/dist/plugins/index.cjs +43 -12
  100. package/dist/plugins/index.d.cts +2 -2
  101. package/dist/plugins/index.d.mts +2 -2
  102. package/dist/plugins/index.d.ts +2 -2
  103. package/dist/plugins/index.mjs +44 -13
  104. package/dist/plugins/jwt/index.cjs +2 -2
  105. package/dist/plugins/jwt/index.d.cts +41 -108
  106. package/dist/plugins/jwt/index.d.mts +41 -108
  107. package/dist/plugins/jwt/index.d.ts +41 -108
  108. package/dist/plugins/jwt/index.mjs +2 -2
  109. package/dist/plugins/magic-link/index.cjs +2 -2
  110. package/dist/plugins/magic-link/index.d.cts +40 -82
  111. package/dist/plugins/magic-link/index.d.mts +40 -82
  112. package/dist/plugins/magic-link/index.d.ts +40 -82
  113. package/dist/plugins/magic-link/index.mjs +2 -2
  114. package/dist/plugins/multi-session/index.cjs +2 -2
  115. package/dist/plugins/multi-session/index.d.cts +61 -128
  116. package/dist/plugins/multi-session/index.d.mts +61 -128
  117. package/dist/plugins/multi-session/index.d.ts +61 -128
  118. package/dist/plugins/multi-session/index.mjs +2 -2
  119. package/dist/plugins/oauth-proxy/index.cjs +2 -2
  120. package/dist/plugins/oauth-proxy/index.d.cts +21 -41
  121. package/dist/plugins/oauth-proxy/index.d.mts +21 -41
  122. package/dist/plugins/oauth-proxy/index.d.ts +21 -41
  123. package/dist/plugins/oauth-proxy/index.mjs +2 -2
  124. package/dist/plugins/oidc-provider/index.cjs +2 -2
  125. package/dist/plugins/oidc-provider/index.d.cts +145 -158
  126. package/dist/plugins/oidc-provider/index.d.mts +145 -158
  127. package/dist/plugins/oidc-provider/index.d.ts +145 -158
  128. package/dist/plugins/oidc-provider/index.mjs +2 -2
  129. package/dist/plugins/one-tap/index.cjs +2 -2
  130. package/dist/plugins/one-tap/index.d.cts +20 -42
  131. package/dist/plugins/one-tap/index.d.mts +20 -42
  132. package/dist/plugins/one-tap/index.d.ts +20 -42
  133. package/dist/plugins/one-tap/index.mjs +2 -2
  134. package/dist/plugins/open-api/index.cjs +4 -2
  135. package/dist/plugins/open-api/index.d.cts +41 -20
  136. package/dist/plugins/open-api/index.d.mts +41 -20
  137. package/dist/plugins/open-api/index.d.ts +41 -20
  138. package/dist/plugins/open-api/index.mjs +4 -2
  139. package/dist/plugins/organization/index.cjs +3 -3
  140. package/dist/plugins/organization/index.d.cts +1374 -2916
  141. package/dist/plugins/organization/index.d.mts +1374 -2916
  142. package/dist/plugins/organization/index.d.ts +1374 -2916
  143. package/dist/plugins/organization/index.mjs +3 -3
  144. package/dist/plugins/passkey/index.cjs +2 -2
  145. package/dist/plugins/passkey/index.d.cts +146 -464
  146. package/dist/plugins/passkey/index.d.mts +146 -464
  147. package/dist/plugins/passkey/index.d.ts +146 -464
  148. package/dist/plugins/passkey/index.mjs +2 -2
  149. package/dist/plugins/phone-number/index.cjs +2 -2
  150. package/dist/plugins/phone-number/index.d.cts +103 -178
  151. package/dist/plugins/phone-number/index.d.mts +103 -178
  152. package/dist/plugins/phone-number/index.d.ts +103 -178
  153. package/dist/plugins/phone-number/index.mjs +2 -2
  154. package/dist/plugins/sso/index.cjs +3 -3
  155. package/dist/plugins/sso/index.d.cts +63 -206
  156. package/dist/plugins/sso/index.d.mts +63 -206
  157. package/dist/plugins/sso/index.d.ts +63 -206
  158. package/dist/plugins/sso/index.mjs +3 -3
  159. package/dist/plugins/two-factor/index.cjs +4 -4
  160. package/dist/plugins/two-factor/index.d.cts +221 -725
  161. package/dist/plugins/two-factor/index.d.mts +221 -725
  162. package/dist/plugins/two-factor/index.d.ts +221 -725
  163. package/dist/plugins/two-factor/index.mjs +4 -4
  164. package/dist/plugins/username/index.cjs +4 -4
  165. package/dist/plugins/username/index.d.cts +21 -44
  166. package/dist/plugins/username/index.d.mts +21 -44
  167. package/dist/plugins/username/index.d.ts +21 -44
  168. package/dist/plugins/username/index.mjs +4 -4
  169. package/dist/shared/{better-auth.-X_5SIE9.d.ts → better-auth.2p1C52nv.d.ts} +3 -3
  170. package/dist/shared/{better-auth.BsbUy_em.d.cts → better-auth.BArzzn5a.d.cts} +5354 -7954
  171. package/dist/shared/{better-auth.CjhKonVM.d.mts → better-auth.BDKSU3Dg.d.mts} +146 -205
  172. package/dist/shared/{better-auth.Dy3T8VFf.cjs → better-auth.BDYXUcLv.cjs} +1 -1
  173. package/dist/shared/{better-auth.BLFZHn6S.d.cts → better-auth.C5A8Vzv0.d.cts} +146 -205
  174. package/dist/shared/{better-auth.CY_Hrfhe.mjs → better-auth.CFzfx-2c.mjs} +1 -1
  175. package/dist/shared/{better-auth.D5DEHFvt.cjs → better-auth.CN1HkXUY.cjs} +1 -1
  176. package/dist/shared/{better-auth.CXagCPAv.cjs → better-auth.CPKJJalM.cjs} +4 -4
  177. package/dist/shared/{better-auth.Bu8n0vlp.mjs → better-auth.ClTSOgiD.mjs} +1 -1
  178. package/dist/shared/{better-auth.BzKq70UC.cjs → better-auth.Cm29ZKNJ.cjs} +5 -9
  179. package/dist/shared/{better-auth.BSbTjuSH.mjs → better-auth.CmHTEIYA.mjs} +4 -4
  180. package/dist/shared/{better-auth.i71gRg2g.d.ts → better-auth.CouMuYtz.d.ts} +5354 -7954
  181. package/dist/shared/{better-auth.ulRwlmfz.d.ts → better-auth.CvCI1gIa.d.ts} +146 -205
  182. package/dist/shared/{better-auth.CX0ifPU-.mjs → better-auth.D4jH-sJA.mjs} +1 -1
  183. package/dist/shared/{better-auth.B5Z63CQV.d.mts → better-auth.DCCen_rd.d.mts} +5354 -7954
  184. package/dist/shared/{better-auth.DjMtlb7e.mjs → better-auth.DCVeP5-W.mjs} +5 -9
  185. package/dist/shared/{better-auth.DkJ_Tcxu.d.cts → better-auth.Dy54W_9o.d.cts} +3 -3
  186. package/dist/shared/{better-auth.BGAbPcLi.d.mts → better-auth.YLWLGLEW.d.mts} +3 -3
  187. package/dist/shared/{better-auth.USxghgYQ.cjs → better-auth.m575EIBC.cjs} +1 -1
  188. package/dist/social-providers/index.cjs +1 -1
  189. package/dist/social-providers/index.mjs +1 -1
  190. package/dist/types/index.d.cts +2 -2
  191. package/dist/types/index.d.mts +2 -2
  192. package/dist/types/index.d.ts +2 -2
  193. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import * as better_call from 'better-call';
3
- import { U as User, I as InferOptionSchema, d as AuthEndpoint, G as GenericEndpointContext, S as Session, H as HookEndpointContext } from '../../shared/better-auth.B5Z63CQV.mjs';
3
+ import { U as User, I as InferOptionSchema, d as AuthEndpoint, S as Session, G as GenericEndpointContext, H as HookEndpointContext } from '../../shared/better-auth.DCCen_rd.mjs';
4
4
  import { L as LiteralString } from '../../shared/better-auth.Bi8FQwDD.mjs';
5
5
  import * as _better_fetch_fetch from '@better-fetch/fetch';
6
6
  import '../../shared/better-auth.-kZ-JqcP.mjs';
@@ -209,76 +209,29 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
209
209
  id: "two-factor";
210
210
  endpoints: {
211
211
  enableTwoFactor: {
212
- <C extends [better_call.InputContext<"/two-factor/enable", {
213
- method: "POST";
214
- body: z.ZodObject<{
215
- password: z.ZodString;
216
- }, "strip", z.ZodTypeAny, {
212
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
213
+ body: {
217
214
  password: string;
218
- }, {
219
- password: string;
220
- }>;
221
- use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
222
- session: {
223
- session: Record<string, any> & {
224
- id: string;
225
- createdAt: Date;
226
- updatedAt: Date;
227
- userId: string;
228
- expiresAt: Date;
229
- token: string;
230
- ipAddress?: string | null | undefined;
231
- userAgent?: string | null | undefined;
232
- };
233
- user: Record<string, any> & {
234
- id: string;
235
- name: string;
236
- email: string;
237
- emailVerified: boolean;
238
- createdAt: Date;
239
- updatedAt: Date;
240
- image?: string | null | undefined;
241
- };
242
- };
243
- }>)[];
244
- metadata: {
245
- openapi: {
246
- summary: string;
247
- description: string;
248
- responses: {
249
- 200: {
250
- description: string;
251
- content: {
252
- "application/json": {
253
- schema: {
254
- type: "object";
255
- properties: {
256
- totpURI: {
257
- type: string;
258
- description: string;
259
- };
260
- backupCodes: {
261
- type: string;
262
- items: {
263
- type: string;
264
- };
265
- description: string;
266
- };
267
- };
268
- };
269
- };
270
- };
271
- };
272
- };
273
- };
274
215
  };
275
216
  } & {
276
- use: any[];
277
- }>]>(...inputCtx: C): Promise<C extends [{
278
- asResponse: true;
279
- }] ? Response : C extends [{
280
- returnHeaders: true;
281
- }] ? {
217
+ method?: "POST" | undefined;
218
+ } & {
219
+ query?: Record<string, any> | undefined;
220
+ } & {
221
+ params?: Record<string, any>;
222
+ } & {
223
+ request?: Request;
224
+ } & {
225
+ headers?: HeadersInit;
226
+ } & {
227
+ asResponse?: boolean;
228
+ returnHeaders?: boolean;
229
+ use?: better_call.Middleware[];
230
+ path?: string;
231
+ } & {
232
+ asResponse?: AsResponse | undefined;
233
+ returnHeaders?: ReturnHeaders | undefined;
234
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
282
235
  headers: Headers;
283
236
  response: {
284
237
  totpURI: string;
@@ -357,68 +310,29 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
357
310
  path: "/two-factor/enable";
358
311
  };
359
312
  disableTwoFactor: {
360
- <C extends [better_call.InputContext<"/two-factor/disable", {
361
- method: "POST";
362
- body: z.ZodObject<{
363
- password: z.ZodString;
364
- }, "strip", z.ZodTypeAny, {
365
- password: string;
366
- }, {
313
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
314
+ body: {
367
315
  password: string;
368
- }>;
369
- use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
370
- session: {
371
- session: Record<string, any> & {
372
- id: string;
373
- createdAt: Date;
374
- updatedAt: Date;
375
- userId: string;
376
- expiresAt: Date;
377
- token: string;
378
- ipAddress?: string | null | undefined;
379
- userAgent?: string | null | undefined;
380
- };
381
- user: Record<string, any> & {
382
- id: string;
383
- name: string;
384
- email: string;
385
- emailVerified: boolean;
386
- createdAt: Date;
387
- updatedAt: Date;
388
- image?: string | null | undefined;
389
- };
390
- };
391
- }>)[];
392
- metadata: {
393
- openapi: {
394
- summary: string;
395
- description: string;
396
- responses: {
397
- 200: {
398
- description: string;
399
- content: {
400
- "application/json": {
401
- schema: {
402
- type: "object";
403
- properties: {
404
- status: {
405
- type: string;
406
- };
407
- };
408
- };
409
- };
410
- };
411
- };
412
- };
413
- };
414
316
  };
415
317
  } & {
416
- use: any[];
417
- }>]>(...inputCtx: C): Promise<C extends [{
418
- asResponse: true;
419
- }] ? Response : C extends [{
420
- returnHeaders: true;
421
- }] ? {
318
+ method?: "POST" | undefined;
319
+ } & {
320
+ query?: Record<string, any> | undefined;
321
+ } & {
322
+ params?: Record<string, any>;
323
+ } & {
324
+ request?: Request;
325
+ } & {
326
+ headers?: HeadersInit;
327
+ } & {
328
+ asResponse?: boolean;
329
+ returnHeaders?: boolean;
330
+ use?: better_call.Middleware[];
331
+ path?: string;
332
+ } & {
333
+ asResponse?: AsResponse | undefined;
334
+ returnHeaders?: ReturnHeaders | undefined;
335
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
422
336
  headers: Headers;
423
337
  response: {
424
338
  status: boolean;
@@ -487,99 +401,31 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
487
401
  path: "/two-factor/disable";
488
402
  };
489
403
  verifyBackupCode: {
490
- <C extends [better_call.InputContext<"/two-factor/verify-backup-code", {
491
- method: "POST";
492
- body: z.ZodObject<{
493
- code: z.ZodString;
494
- disableSession: z.ZodOptional<z.ZodBoolean>;
495
- trustDevice: z.ZodOptional<z.ZodBoolean>;
496
- }, "strip", z.ZodTypeAny, {
497
- code: string;
498
- trustDevice?: boolean | undefined;
499
- disableSession?: boolean | undefined;
500
- }, {
404
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
405
+ body: {
501
406
  code: string;
502
407
  trustDevice?: boolean | undefined;
503
408
  disableSession?: boolean | undefined;
504
- }>;
505
- use: ((inputContext: better_call.MiddlewareInputContext<{
506
- body: z.ZodObject<{
507
- trustDevice: z.ZodOptional<z.ZodBoolean>;
508
- }, "strip", z.ZodTypeAny, {
509
- trustDevice?: boolean | undefined;
510
- }, {
511
- trustDevice?: boolean | undefined;
512
- }>;
513
- }>) => Promise<{
514
- valid: (ctx: GenericEndpointContext) => Promise<{
515
- token: string;
516
- user: {
517
- id: string;
518
- email: string;
519
- emailVerified: boolean;
520
- name: string;
521
- image: string | null | undefined;
522
- createdAt: Date;
523
- updatedAt: Date;
524
- };
525
- }>;
526
- invalid: () => Promise<never>;
527
- session: {
528
- session: {
529
- id: string;
530
- createdAt: Date;
531
- updatedAt: Date;
532
- userId: string;
533
- expiresAt: Date;
534
- token: string;
535
- ipAddress?: string | null | undefined;
536
- userAgent?: string | null | undefined;
537
- };
538
- user: UserWithTwoFactor;
539
- };
540
- } | {
541
- valid: (ctx: GenericEndpointContext) => Promise<{
542
- token: string;
543
- user: {
544
- id: string;
545
- email: string;
546
- emailVerified: boolean;
547
- name: string;
548
- image: string | null | undefined;
549
- createdAt: Date;
550
- updatedAt: Date;
551
- };
552
- }>;
553
- invalid: () => Promise<never>;
554
- session: {
555
- session: Record<string, any> & {
556
- id: string;
557
- createdAt: Date;
558
- updatedAt: Date;
559
- userId: string;
560
- expiresAt: Date;
561
- token: string;
562
- ipAddress?: string | null | undefined;
563
- userAgent?: string | null | undefined;
564
- };
565
- user: Record<string, any> & {
566
- id: string;
567
- name: string;
568
- email: string;
569
- emailVerified: boolean;
570
- createdAt: Date;
571
- updatedAt: Date;
572
- image?: string | null | undefined;
573
- };
574
- };
575
- }>)[];
409
+ };
576
410
  } & {
577
- use: any[];
578
- }>]>(...inputCtx: C): Promise<C extends [{
579
- asResponse: true;
580
- }] ? Response : C extends [{
581
- returnHeaders: true;
582
- }] ? {
411
+ method?: "POST" | undefined;
412
+ } & {
413
+ query?: Record<string, any> | undefined;
414
+ } & {
415
+ params?: Record<string, any>;
416
+ } & {
417
+ request?: Request;
418
+ } & {
419
+ headers?: HeadersInit;
420
+ } & {
421
+ asResponse?: boolean;
422
+ returnHeaders?: boolean;
423
+ use?: better_call.Middleware[];
424
+ path?: string;
425
+ } & {
426
+ asResponse?: AsResponse | undefined;
427
+ returnHeaders?: ReturnHeaders | undefined;
428
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
583
429
  headers: Headers;
584
430
  response: {
585
431
  user: UserWithTwoFactor;
@@ -751,45 +597,29 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
751
597
  path: "/two-factor/verify-backup-code";
752
598
  };
753
599
  generateBackupCodes: {
754
- <C extends [better_call.InputContext<"/two-factor/generate-backup-codes", {
755
- method: "POST";
756
- body: z.ZodObject<{
757
- password: z.ZodString;
758
- }, "strip", z.ZodTypeAny, {
759
- password: string;
760
- }, {
600
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
601
+ body: {
761
602
  password: string;
762
- }>;
763
- use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
764
- session: {
765
- session: Record<string, any> & {
766
- id: string;
767
- createdAt: Date;
768
- updatedAt: Date;
769
- userId: string;
770
- expiresAt: Date;
771
- token: string;
772
- ipAddress?: string | null | undefined;
773
- userAgent?: string | null | undefined;
774
- };
775
- user: Record<string, any> & {
776
- id: string;
777
- name: string;
778
- email: string;
779
- emailVerified: boolean;
780
- createdAt: Date;
781
- updatedAt: Date;
782
- image?: string | null | undefined;
783
- };
784
- };
785
- }>)[];
603
+ };
786
604
  } & {
787
- use: any[];
788
- }>]>(...inputCtx: C): Promise<C extends [{
789
- asResponse: true;
790
- }] ? Response : C extends [{
791
- returnHeaders: true;
792
- }] ? {
605
+ method?: "POST" | undefined;
606
+ } & {
607
+ query?: Record<string, any> | undefined;
608
+ } & {
609
+ params?: Record<string, any>;
610
+ } & {
611
+ request?: Request;
612
+ } & {
613
+ headers?: HeadersInit;
614
+ } & {
615
+ asResponse?: boolean;
616
+ returnHeaders?: boolean;
617
+ use?: better_call.Middleware[];
618
+ path?: string;
619
+ } & {
620
+ asResponse?: AsResponse | undefined;
621
+ returnHeaders?: ReturnHeaders | undefined;
622
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
793
623
  headers: Headers;
794
624
  response: {
795
625
  status: boolean;
@@ -837,25 +667,29 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
837
667
  path: "/two-factor/generate-backup-codes";
838
668
  };
839
669
  viewBackupCodes: {
840
- <C extends [better_call.InputContext<"/two-factor/view-backup-codes", {
841
- method: "GET";
842
- body: z.ZodObject<{
843
- userId: z.ZodString;
844
- }, "strip", z.ZodTypeAny, {
845
- userId: string;
846
- }, {
670
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
671
+ body: {
847
672
  userId: string;
848
- }>;
849
- metadata: {
850
- SERVER_ONLY: true;
851
673
  };
852
674
  } & {
853
- use: any[];
854
- }>]>(...inputCtx: C): Promise<C extends [{
855
- asResponse: true;
856
- }] ? Response : C extends [{
857
- returnHeaders: true;
858
- }] ? {
675
+ method?: "GET" | undefined;
676
+ } & {
677
+ query?: Record<string, any> | undefined;
678
+ } & {
679
+ params?: Record<string, any>;
680
+ } & {
681
+ request?: Request;
682
+ } & {
683
+ headers?: HeadersInit;
684
+ } & {
685
+ asResponse?: boolean;
686
+ returnHeaders?: boolean;
687
+ use?: better_call.Middleware[];
688
+ path?: string;
689
+ } & {
690
+ asResponse?: AsResponse | undefined;
691
+ returnHeaders?: ReturnHeaders | undefined;
692
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
859
693
  headers: Headers;
860
694
  response: {
861
695
  status: boolean;
@@ -883,244 +717,45 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
883
717
  path: "/two-factor/view-backup-codes";
884
718
  };
885
719
  sendTwoFactorOTP: {
886
- <C extends [(better_call.InputContext<"/two-factor/send-otp", {
887
- method: "POST";
888
- body: z.ZodOptional<z.ZodObject<{
889
- trustDevice: z.ZodOptional<z.ZodBoolean>;
890
- }, "strip", z.ZodTypeAny, {
720
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
721
+ body?: {
891
722
  trustDevice?: boolean | undefined;
892
- }, {
893
- trustDevice?: boolean | undefined;
894
- }>>;
895
- use: ((inputContext: better_call.MiddlewareInputContext<{
896
- body: z.ZodObject<{
897
- trustDevice: z.ZodOptional<z.ZodBoolean>;
898
- }, "strip", z.ZodTypeAny, {
899
- trustDevice?: boolean | undefined;
900
- }, {
901
- trustDevice?: boolean | undefined;
902
- }>;
903
- }>) => Promise<{
904
- valid: (ctx: GenericEndpointContext) => Promise<{
905
- token: string;
906
- user: {
907
- id: string;
908
- email: string;
909
- emailVerified: boolean;
910
- name: string;
911
- image: string | null | undefined;
912
- createdAt: Date;
913
- updatedAt: Date;
914
- };
915
- }>;
916
- invalid: () => Promise<never>;
917
- session: {
918
- session: {
919
- id: string;
920
- createdAt: Date;
921
- updatedAt: Date;
922
- userId: string;
923
- expiresAt: Date;
924
- token: string;
925
- ipAddress?: string | null | undefined;
926
- userAgent?: string | null | undefined;
927
- };
928
- user: UserWithTwoFactor;
929
- };
930
- } | {
931
- valid: (ctx: GenericEndpointContext) => Promise<{
932
- token: string;
933
- user: {
934
- id: string;
935
- email: string;
936
- emailVerified: boolean;
937
- name: string;
938
- image: string | null | undefined;
939
- createdAt: Date;
940
- updatedAt: Date;
941
- };
942
- }>;
943
- invalid: () => Promise<never>;
944
- session: {
945
- session: Record<string, any> & {
946
- id: string;
947
- createdAt: Date;
948
- updatedAt: Date;
949
- userId: string;
950
- expiresAt: Date;
951
- token: string;
952
- ipAddress?: string | null | undefined;
953
- userAgent?: string | null | undefined;
954
- };
955
- user: Record<string, any> & {
956
- id: string;
957
- name: string;
958
- email: string;
959
- emailVerified: boolean;
960
- createdAt: Date;
961
- updatedAt: Date;
962
- image?: string | null | undefined;
963
- };
964
- };
965
- }>)[];
966
- metadata: {
967
- openapi: {
968
- summary: string;
969
- description: string;
970
- responses: {
971
- 200: {
972
- description: string;
973
- content: {
974
- "application/json": {
975
- schema: {
976
- type: "object";
977
- properties: {
978
- status: {
979
- type: string;
980
- };
981
- };
982
- };
983
- };
984
- };
985
- };
986
- };
987
- };
988
- };
723
+ } | undefined;
989
724
  } & {
990
- use: any[];
991
- }> | undefined)?]>(...inputCtx: C): Promise<C extends [{
992
- asResponse: true;
993
- }] ? Response : C extends [{
994
- returnHeaders: true;
995
- }] ? {
996
- headers: Headers;
997
- response: {
998
- status: boolean;
999
- };
1000
- } : {
1001
- status: boolean;
1002
- }>;
1003
- options: {
1004
- method: "POST";
1005
- body: z.ZodOptional<z.ZodObject<{
1006
- trustDevice: z.ZodOptional<z.ZodBoolean>;
1007
- }, "strip", z.ZodTypeAny, {
1008
- trustDevice?: boolean | undefined;
1009
- }, {
1010
- trustDevice?: boolean | undefined;
1011
- }>>;
1012
- use: ((inputContext: better_call.MiddlewareInputContext<{
1013
- body: z.ZodObject<{
1014
- trustDevice: z.ZodOptional<z.ZodBoolean>;
1015
- }, "strip", z.ZodTypeAny, {
1016
- trustDevice?: boolean | undefined;
1017
- }, {
1018
- trustDevice?: boolean | undefined;
1019
- }>;
1020
- }>) => Promise<{
1021
- valid: (ctx: GenericEndpointContext) => Promise<{
1022
- token: string;
1023
- user: {
1024
- id: string;
1025
- email: string;
1026
- emailVerified: boolean;
1027
- name: string;
1028
- image: string | null | undefined;
1029
- createdAt: Date;
1030
- updatedAt: Date;
1031
- };
1032
- }>;
1033
- invalid: () => Promise<never>;
1034
- session: {
1035
- session: {
1036
- id: string;
1037
- createdAt: Date;
1038
- updatedAt: Date;
1039
- userId: string;
1040
- expiresAt: Date;
1041
- token: string;
1042
- ipAddress?: string | null | undefined;
1043
- userAgent?: string | null | undefined;
1044
- };
1045
- user: UserWithTwoFactor;
1046
- };
1047
- } | {
1048
- valid: (ctx: GenericEndpointContext) => Promise<{
1049
- token: string;
1050
- user: {
1051
- id: string;
1052
- email: string;
1053
- emailVerified: boolean;
1054
- name: string;
1055
- image: string | null | undefined;
1056
- createdAt: Date;
1057
- updatedAt: Date;
1058
- };
1059
- }>;
1060
- invalid: () => Promise<never>;
1061
- session: {
1062
- session: Record<string, any> & {
1063
- id: string;
1064
- createdAt: Date;
1065
- updatedAt: Date;
1066
- userId: string;
1067
- expiresAt: Date;
1068
- token: string;
1069
- ipAddress?: string | null | undefined;
1070
- userAgent?: string | null | undefined;
1071
- };
1072
- user: Record<string, any> & {
1073
- id: string;
1074
- name: string;
1075
- email: string;
1076
- emailVerified: boolean;
1077
- createdAt: Date;
1078
- updatedAt: Date;
1079
- image?: string | null | undefined;
1080
- };
1081
- };
1082
- }>)[];
1083
- metadata: {
1084
- openapi: {
1085
- summary: string;
1086
- description: string;
1087
- responses: {
1088
- 200: {
1089
- description: string;
1090
- content: {
1091
- "application/json": {
1092
- schema: {
1093
- type: "object";
1094
- properties: {
1095
- status: {
1096
- type: string;
1097
- };
1098
- };
1099
- };
1100
- };
1101
- };
1102
- };
1103
- };
1104
- };
1105
- };
725
+ method?: "POST" | undefined;
726
+ } & {
727
+ query?: Record<string, any> | undefined;
728
+ } & {
729
+ params?: Record<string, any>;
730
+ } & {
731
+ request?: Request;
732
+ } & {
733
+ headers?: HeadersInit;
734
+ } & {
735
+ asResponse?: boolean;
736
+ returnHeaders?: boolean;
737
+ use?: better_call.Middleware[];
738
+ path?: string;
1106
739
  } & {
1107
- use: any[];
1108
- };
1109
- path: "/two-factor/send-otp";
1110
- };
1111
- verifyTwoFactorOTP: {
1112
- <C extends [better_call.InputContext<"/two-factor/verify-otp", {
740
+ asResponse?: AsResponse | undefined;
741
+ returnHeaders?: ReturnHeaders | undefined;
742
+ }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
743
+ headers: Headers;
744
+ response: {
745
+ status: boolean;
746
+ };
747
+ } : {
748
+ status: boolean;
749
+ }>;
750
+ options: {
1113
751
  method: "POST";
1114
- body: z.ZodObject<{
1115
- code: z.ZodString;
752
+ body: z.ZodOptional<z.ZodObject<{
1116
753
  trustDevice: z.ZodOptional<z.ZodBoolean>;
1117
754
  }, "strip", z.ZodTypeAny, {
1118
- code: string;
1119
755
  trustDevice?: boolean | undefined;
1120
756
  }, {
1121
- code: string;
1122
757
  trustDevice?: boolean | undefined;
1123
- }>;
758
+ }>>;
1124
759
  use: ((inputContext: better_call.MiddlewareInputContext<{
1125
760
  body: z.ZodObject<{
1126
761
  trustDevice: z.ZodOptional<z.ZodBoolean>;
@@ -1217,11 +852,34 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
1217
852
  };
1218
853
  } & {
1219
854
  use: any[];
1220
- }>]>(...inputCtx: C): Promise<C extends [{
1221
- asResponse: true;
1222
- }] ? Response : C extends [{
1223
- returnHeaders: true;
1224
- }] ? {
855
+ };
856
+ path: "/two-factor/send-otp";
857
+ };
858
+ verifyTwoFactorOTP: {
859
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
860
+ body: {
861
+ code: string;
862
+ trustDevice?: boolean | undefined;
863
+ };
864
+ } & {
865
+ method?: "POST" | undefined;
866
+ } & {
867
+ query?: Record<string, any> | undefined;
868
+ } & {
869
+ params?: Record<string, any>;
870
+ } & {
871
+ request?: Request;
872
+ } & {
873
+ headers?: HeadersInit;
874
+ } & {
875
+ asResponse?: boolean;
876
+ returnHeaders?: boolean;
877
+ use?: better_call.Middleware[];
878
+ path?: string;
879
+ } & {
880
+ asResponse?: AsResponse | undefined;
881
+ returnHeaders?: ReturnHeaders | undefined;
882
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
1225
883
  headers: Headers;
1226
884
  response: {
1227
885
  token: string;
@@ -1359,61 +1017,27 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
1359
1017
  path: "/two-factor/verify-otp";
1360
1018
  };
1361
1019
  generateTOTP: {
1362
- <C extends [(better_call.InputContext<"/totp/generate", {
1363
- method: "POST";
1364
- use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
1365
- session: {
1366
- session: Record<string, any> & {
1367
- id: string;
1368
- createdAt: Date;
1369
- updatedAt: Date;
1370
- userId: string;
1371
- expiresAt: Date;
1372
- token: string;
1373
- ipAddress?: string | null | undefined;
1374
- userAgent?: string | null | undefined;
1375
- };
1376
- user: Record<string, any> & {
1377
- id: string;
1378
- name: string;
1379
- email: string;
1380
- emailVerified: boolean;
1381
- createdAt: Date;
1382
- updatedAt: Date;
1383
- image?: string | null | undefined;
1384
- };
1385
- };
1386
- }>)[];
1387
- metadata: {
1388
- openapi: {
1389
- summary: string;
1390
- description: string;
1391
- responses: {
1392
- 200: {
1393
- description: string;
1394
- content: {
1395
- "application/json": {
1396
- schema: {
1397
- type: "object";
1398
- properties: {
1399
- code: {
1400
- type: string;
1401
- };
1402
- };
1403
- };
1404
- };
1405
- };
1406
- };
1407
- };
1408
- };
1409
- };
1020
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
1021
+ body?: undefined;
1410
1022
  } & {
1411
- use: any[];
1412
- }> | undefined)?]>(...inputCtx: C): Promise<C extends [{
1413
- asResponse: true;
1414
- }] ? Response : C extends [{
1415
- returnHeaders: true;
1416
- }] ? {
1023
+ method?: "POST" | undefined;
1024
+ } & {
1025
+ query?: Record<string, any> | undefined;
1026
+ } & {
1027
+ params?: Record<string, any>;
1028
+ } & {
1029
+ request?: Request;
1030
+ } & {
1031
+ headers?: HeadersInit;
1032
+ } & {
1033
+ asResponse?: boolean;
1034
+ returnHeaders?: boolean;
1035
+ use?: better_call.Middleware[];
1036
+ path?: string;
1037
+ } & {
1038
+ asResponse?: AsResponse | undefined;
1039
+ returnHeaders?: ReturnHeaders | undefined;
1040
+ }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
1417
1041
  headers: Headers;
1418
1042
  response: {
1419
1043
  code: string;
@@ -1475,68 +1099,29 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
1475
1099
  path: "/totp/generate";
1476
1100
  };
1477
1101
  getTOTPURI: {
1478
- <C extends [better_call.InputContext<"/two-factor/get-totp-uri", {
1479
- method: "POST";
1480
- use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
1481
- session: {
1482
- session: Record<string, any> & {
1483
- id: string;
1484
- createdAt: Date;
1485
- updatedAt: Date;
1486
- userId: string;
1487
- expiresAt: Date;
1488
- token: string;
1489
- ipAddress?: string | null | undefined;
1490
- userAgent?: string | null | undefined;
1491
- };
1492
- user: Record<string, any> & {
1493
- id: string;
1494
- name: string;
1495
- email: string;
1496
- emailVerified: boolean;
1497
- createdAt: Date;
1498
- updatedAt: Date;
1499
- image?: string | null | undefined;
1500
- };
1501
- };
1502
- }>)[];
1503
- body: z.ZodObject<{
1504
- password: z.ZodString;
1505
- }, "strip", z.ZodTypeAny, {
1506
- password: string;
1507
- }, {
1102
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
1103
+ body: {
1508
1104
  password: string;
1509
- }>;
1510
- metadata: {
1511
- openapi: {
1512
- summary: string;
1513
- description: string;
1514
- responses: {
1515
- 200: {
1516
- description: string;
1517
- content: {
1518
- "application/json": {
1519
- schema: {
1520
- type: "object";
1521
- properties: {
1522
- totpURI: {
1523
- type: string;
1524
- };
1525
- };
1526
- };
1527
- };
1528
- };
1529
- };
1530
- };
1531
- };
1532
1105
  };
1533
1106
  } & {
1534
- use: any[];
1535
- }>]>(...inputCtx: C): Promise<C extends [{
1536
- asResponse: true;
1537
- }] ? Response : C extends [{
1538
- returnHeaders: true;
1539
- }] ? {
1107
+ method?: "POST" | undefined;
1108
+ } & {
1109
+ query?: Record<string, any> | undefined;
1110
+ } & {
1111
+ params?: Record<string, any>;
1112
+ } & {
1113
+ request?: Request;
1114
+ } & {
1115
+ headers?: HeadersInit;
1116
+ } & {
1117
+ asResponse?: boolean;
1118
+ returnHeaders?: boolean;
1119
+ use?: better_call.Middleware[];
1120
+ path?: string;
1121
+ } & {
1122
+ asResponse?: AsResponse | undefined;
1123
+ returnHeaders?: ReturnHeaders | undefined;
1124
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
1540
1125
  headers: Headers;
1541
1126
  response: {
1542
1127
  totpURI: string;
@@ -1605,119 +1190,30 @@ declare const twoFactor: (options?: TwoFactorOptions) => {
1605
1190
  path: "/two-factor/get-totp-uri";
1606
1191
  };
1607
1192
  verifyTOTP: {
1608
- <C extends [better_call.InputContext<"/two-factor/verify-totp", {
1609
- method: "POST";
1610
- body: z.ZodObject<{
1611
- code: z.ZodString;
1612
- trustDevice: z.ZodOptional<z.ZodBoolean>;
1613
- }, "strip", z.ZodTypeAny, {
1193
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
1194
+ body: {
1614
1195
  code: string;
1615
1196
  trustDevice?: boolean | undefined;
1616
- }, {
1617
- code: string;
1618
- trustDevice?: boolean | undefined;
1619
- }>;
1620
- use: ((inputContext: better_call.MiddlewareInputContext<{
1621
- body: z.ZodObject<{
1622
- trustDevice: z.ZodOptional<z.ZodBoolean>;
1623
- }, "strip", z.ZodTypeAny, {
1624
- trustDevice?: boolean | undefined;
1625
- }, {
1626
- trustDevice?: boolean | undefined;
1627
- }>;
1628
- }>) => Promise<{
1629
- valid: (ctx: GenericEndpointContext) => Promise<{
1630
- token: string;
1631
- user: {
1632
- id: string;
1633
- email: string;
1634
- emailVerified: boolean;
1635
- name: string;
1636
- image: string | null | undefined;
1637
- createdAt: Date;
1638
- updatedAt: Date;
1639
- };
1640
- }>;
1641
- invalid: () => Promise<never>;
1642
- session: {
1643
- session: {
1644
- id: string;
1645
- createdAt: Date;
1646
- updatedAt: Date;
1647
- userId: string;
1648
- expiresAt: Date;
1649
- token: string;
1650
- ipAddress?: string | null | undefined;
1651
- userAgent?: string | null | undefined;
1652
- };
1653
- user: UserWithTwoFactor;
1654
- };
1655
- } | {
1656
- valid: (ctx: GenericEndpointContext) => Promise<{
1657
- token: string;
1658
- user: {
1659
- id: string;
1660
- email: string;
1661
- emailVerified: boolean;
1662
- name: string;
1663
- image: string | null | undefined;
1664
- createdAt: Date;
1665
- updatedAt: Date;
1666
- };
1667
- }>;
1668
- invalid: () => Promise<never>;
1669
- session: {
1670
- session: Record<string, any> & {
1671
- id: string;
1672
- createdAt: Date;
1673
- updatedAt: Date;
1674
- userId: string;
1675
- expiresAt: Date;
1676
- token: string;
1677
- ipAddress?: string | null | undefined;
1678
- userAgent?: string | null | undefined;
1679
- };
1680
- user: Record<string, any> & {
1681
- id: string;
1682
- name: string;
1683
- email: string;
1684
- emailVerified: boolean;
1685
- createdAt: Date;
1686
- updatedAt: Date;
1687
- image?: string | null | undefined;
1688
- };
1689
- };
1690
- }>)[];
1691
- metadata: {
1692
- openapi: {
1693
- summary: string;
1694
- description: string;
1695
- responses: {
1696
- 200: {
1697
- description: string;
1698
- content: {
1699
- "application/json": {
1700
- schema: {
1701
- type: "object";
1702
- properties: {
1703
- status: {
1704
- type: string;
1705
- };
1706
- };
1707
- };
1708
- };
1709
- };
1710
- };
1711
- };
1712
- };
1713
1197
  };
1714
1198
  } & {
1715
- use: any[];
1716
- }>]>(...inputCtx: C): Promise<C extends [{
1717
- asResponse: true;
1718
- }] ? Response : C extends [{
1719
- returnHeaders: true;
1720
- }] ? {
1199
+ method?: "POST" | undefined;
1200
+ } & {
1201
+ query?: Record<string, any> | undefined;
1202
+ } & {
1203
+ params?: Record<string, any>;
1204
+ } & {
1205
+ request?: Request;
1206
+ } & {
1207
+ headers?: HeadersInit;
1208
+ } & {
1209
+ asResponse?: boolean;
1210
+ returnHeaders?: boolean;
1211
+ use?: better_call.Middleware[];
1212
+ path?: string;
1213
+ } & {
1214
+ asResponse?: AsResponse | undefined;
1215
+ returnHeaders?: ReturnHeaders | undefined;
1216
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
1721
1217
  headers: Headers;
1722
1218
  response: {
1723
1219
  token: string;