better-auth 1.0.2 → 1.0.3

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 (57) hide show
  1. package/dist/adapters/drizzle.d.cts +1 -1
  2. package/dist/adapters/drizzle.d.ts +1 -1
  3. package/dist/adapters/kysely.d.cts +1 -1
  4. package/dist/adapters/kysely.d.ts +1 -1
  5. package/dist/adapters/memory.d.cts +1 -1
  6. package/dist/adapters/memory.d.ts +1 -1
  7. package/dist/adapters/mongodb.d.cts +1 -1
  8. package/dist/adapters/mongodb.d.ts +1 -1
  9. package/dist/adapters/prisma.d.cts +1 -1
  10. package/dist/adapters/prisma.d.ts +1 -1
  11. package/dist/api.cjs +4 -4
  12. package/dist/api.d.cts +1 -1
  13. package/dist/api.d.ts +1 -1
  14. package/dist/api.js +4 -4
  15. package/dist/{auth-BVa3db5J.d.cts → auth-BubrmklB.d.cts} +5 -1
  16. package/dist/{auth-5eyWphKM.d.ts → auth-DF-f5DGM.d.ts} +5 -1
  17. package/dist/client/plugins.d.cts +3 -3
  18. package/dist/client/plugins.d.ts +3 -3
  19. package/dist/client.d.cts +1 -1
  20. package/dist/client.d.ts +1 -1
  21. package/dist/cookies.d.cts +1 -1
  22. package/dist/cookies.d.ts +1 -1
  23. package/dist/db.d.cts +2 -2
  24. package/dist/db.d.ts +2 -2
  25. package/dist/{index-x5P1hIyV.d.cts → index-CwnHFdnT.d.cts} +2345 -65
  26. package/dist/{index-CX-Hopog.d.ts → index-aMRluDla.d.ts} +2345 -65
  27. package/dist/index.cjs +4 -4
  28. package/dist/index.d.cts +2 -2
  29. package/dist/index.d.ts +2 -2
  30. package/dist/index.js +4 -4
  31. package/dist/next-js.d.cts +1 -1
  32. package/dist/next-js.d.ts +1 -1
  33. package/dist/node.d.cts +1 -1
  34. package/dist/node.d.ts +1 -1
  35. package/dist/oauth2.d.cts +2 -2
  36. package/dist/oauth2.d.ts +2 -2
  37. package/dist/plugins.cjs +7 -7
  38. package/dist/plugins.d.cts +233 -8
  39. package/dist/plugins.d.ts +233 -8
  40. package/dist/plugins.js +7 -7
  41. package/dist/react.d.cts +1 -1
  42. package/dist/react.d.ts +1 -1
  43. package/dist/solid-start.d.cts +1 -1
  44. package/dist/solid-start.d.ts +1 -1
  45. package/dist/solid.d.cts +1 -1
  46. package/dist/solid.d.ts +1 -1
  47. package/dist/{state-CYO8U5dl.d.cts → state-CQJXHclh.d.cts} +1 -1
  48. package/dist/{state-BpBNrIEi.d.ts → state-C_runTlH.d.ts} +1 -1
  49. package/dist/svelte-kit.d.cts +1 -1
  50. package/dist/svelte-kit.d.ts +1 -1
  51. package/dist/svelte.d.cts +1 -1
  52. package/dist/svelte.d.ts +1 -1
  53. package/dist/types.d.cts +2 -2
  54. package/dist/types.d.ts +2 -2
  55. package/dist/vue.d.cts +1 -1
  56. package/dist/vue.d.ts +1 -1
  57. package/package.json +1 -1
@@ -1,11 +1,11 @@
1
- export { A as AnonymousOptions, J as JwtOptions, O as OrganizationOptions, b as Passkey, P as PasskeyOptions, e as UserWithAnonymous, U as UserWithPhoneNumber, h as UserWithRole, i as admin, f as anonymous, n as emailOTP, j as genericOAuth, g as getPasskeyActions, k as jwt, m as magicLink, l as multiSession, o as organization, p as passkey, c as passkeyClient, d as phoneNumber, t as twoFactor, a as twoFactorClient, u as username } from './index-x5P1hIyV.cjs';
2
- import { H as HookEndpointContext, B as BetterAuthOptions, I as InferUser, f as InferSession } from './auth-BVa3db5J.cjs';
3
- export { a5 as AuthEndpoint, a6 as AuthMiddleware, j as BetterAuthPlugin, k as InferOptionSchema, P as PluginSchema, a4 as createAuthEndpoint, a3 as createAuthMiddleware, a2 as optionsMiddleware } from './auth-BVa3db5J.cjs';
1
+ export { A as AnonymousOptions, J as JwtOptions, O as OrganizationOptions, b as Passkey, P as PasskeyOptions, e as UserWithAnonymous, U as UserWithPhoneNumber, h as UserWithRole, i as admin, f as anonymous, n as emailOTP, j as genericOAuth, g as getPasskeyActions, k as jwt, m as magicLink, l as multiSession, o as organization, p as passkey, c as passkeyClient, d as phoneNumber, t as twoFactor, a as twoFactorClient, u as username } from './index-CwnHFdnT.cjs';
2
+ import { H as HookEndpointContext, B as BetterAuthOptions, I as InferUser, f as InferSession } from './auth-BubrmklB.cjs';
3
+ export { a5 as AuthEndpoint, a6 as AuthMiddleware, j as BetterAuthPlugin, k as InferOptionSchema, P as PluginSchema, a4 as createAuthEndpoint, a3 as createAuthMiddleware, a2 as optionsMiddleware } from './auth-BubrmklB.cjs';
4
4
  export { H as HIDE_METADATA } from './hide-metadata-DEHJp1rk.cjs';
5
5
  import * as better_call from 'better-call';
6
- import { APIError } from 'better-call';
6
+ import { APIError, OpenAPIParameter, OpenAPISchemaType } from 'better-call';
7
7
  import { z } from 'zod';
8
- import './helper-DxMBi7M2.cjs';
8
+ import { L as LiteralString } from './helper-DxMBi7M2.cjs';
9
9
  import './plugins/access.cjs';
10
10
  import '@better-fetch/fetch';
11
11
  import 'nanostores';
@@ -51,6 +51,35 @@ declare const oneTap: (options?: OneTapOptions) => {
51
51
  }, {
52
52
  idToken: string;
53
53
  }>;
54
+ metadata: {
55
+ openapi: {
56
+ summary: string;
57
+ description: string;
58
+ responses: {
59
+ 200: {
60
+ description: string;
61
+ content: {
62
+ "application/json": {
63
+ schema: {
64
+ type: "object";
65
+ properties: {
66
+ session: {
67
+ $ref: string;
68
+ };
69
+ user: {
70
+ $ref: string;
71
+ };
72
+ };
73
+ };
74
+ };
75
+ };
76
+ };
77
+ 400: {
78
+ description: string;
79
+ };
80
+ };
81
+ };
82
+ };
54
83
  }>]>(...ctx: C): Promise<C extends [{
55
84
  asResponse: true;
56
85
  }] ? Response : {
@@ -118,6 +147,35 @@ declare const oneTap: (options?: OneTapOptions) => {
118
147
  }, {
119
148
  idToken: string;
120
149
  }>;
150
+ metadata: {
151
+ openapi: {
152
+ summary: string;
153
+ description: string;
154
+ responses: {
155
+ 200: {
156
+ description: string;
157
+ content: {
158
+ "application/json": {
159
+ schema: {
160
+ type: "object";
161
+ properties: {
162
+ session: {
163
+ $ref: string;
164
+ };
165
+ user: {
166
+ $ref: string;
167
+ };
168
+ };
169
+ };
170
+ };
171
+ };
172
+ };
173
+ 400: {
174
+ description: string;
175
+ };
176
+ };
177
+ };
178
+ };
121
179
  };
122
180
  method: better_call.Method | better_call.Method[];
123
181
  headers: Headers;
@@ -157,6 +215,30 @@ declare const oAuthProxy: (opts?: OAuthProxyOptions) => {
157
215
  callbackURL: string;
158
216
  cookies: string;
159
217
  }>;
218
+ metadata: {
219
+ openapi: {
220
+ description: string;
221
+ parameters: {
222
+ in: "query";
223
+ name: string;
224
+ required: true;
225
+ description: string;
226
+ }[];
227
+ responses: {
228
+ 302: {
229
+ description: string;
230
+ headers: {
231
+ Location: {
232
+ description: string;
233
+ schema: {
234
+ type: string;
235
+ };
236
+ };
237
+ };
238
+ };
239
+ };
240
+ };
241
+ };
160
242
  }>]>(...ctx: C): Promise<C extends [{
161
243
  asResponse: true;
162
244
  }] ? Response : never>;
@@ -173,6 +255,30 @@ declare const oAuthProxy: (opts?: OAuthProxyOptions) => {
173
255
  callbackURL: string;
174
256
  cookies: string;
175
257
  }>;
258
+ metadata: {
259
+ openapi: {
260
+ description: string;
261
+ parameters: {
262
+ in: "query";
263
+ name: string;
264
+ required: true;
265
+ description: string;
266
+ }[];
267
+ responses: {
268
+ 302: {
269
+ description: string;
270
+ headers: {
271
+ Location: {
272
+ description: string;
273
+ schema: {
274
+ type: string;
275
+ };
276
+ };
277
+ };
278
+ };
279
+ };
280
+ };
281
+ };
176
282
  };
177
283
  method: better_call.Method | better_call.Method[];
178
284
  headers: Headers;
@@ -223,18 +329,137 @@ declare const customSession: <Returns extends Record<string, any>, O extends Bet
223
329
  };
224
330
  };
225
331
 
226
- declare const openAPI: () => {
332
+ interface Path {
333
+ get?: {
334
+ tags?: string[];
335
+ operationId?: string;
336
+ description?: string;
337
+ security?: [{
338
+ bearerAuth: string[];
339
+ }];
340
+ parameters?: OpenAPIParameter[];
341
+ responses?: {
342
+ [key in string]: {
343
+ description?: string;
344
+ content: {
345
+ "application/json": {
346
+ schema: {
347
+ type?: OpenAPISchemaType;
348
+ properties?: Record<string, any>;
349
+ required?: string[];
350
+ $ref?: string;
351
+ };
352
+ };
353
+ };
354
+ };
355
+ };
356
+ };
357
+ post?: {
358
+ tags?: string[];
359
+ operationId?: string;
360
+ description?: string;
361
+ security?: [{
362
+ bearerAuth: string[];
363
+ }];
364
+ parameters?: OpenAPIParameter[];
365
+ requestBody?: {
366
+ content: {
367
+ "application/json": {
368
+ schema: {
369
+ type?: OpenAPISchemaType;
370
+ properties?: Record<string, any>;
371
+ required?: string[];
372
+ $ref?: string;
373
+ };
374
+ };
375
+ };
376
+ };
377
+ responses?: {
378
+ [key in string]: {
379
+ description?: string;
380
+ content: {
381
+ "application/json": {
382
+ schema: {
383
+ type?: OpenAPISchemaType;
384
+ properties?: Record<string, any>;
385
+ required?: string[];
386
+ $ref?: string;
387
+ };
388
+ };
389
+ };
390
+ };
391
+ };
392
+ };
393
+ }
394
+
395
+ interface OpenAPIOptions {
396
+ /**
397
+ * The path to the OpenAPI reference page
398
+ *
399
+ * keep in mind that this path will be appended to the base URL `/api/auth` path
400
+ * by default, so if you set this to `/reference`, the full path will be `/api/auth/reference`
401
+ *
402
+ * @default "/reference"
403
+ */
404
+ path?: LiteralString;
405
+ /**
406
+ * Disable the default reference page that is generated by Scalar
407
+ *
408
+ * @default false
409
+ */
410
+ disableDefaultReference?: boolean;
411
+ }
412
+ declare const openAPI: <O extends OpenAPIOptions>(options?: O) => {
227
413
  id: "open-api";
228
414
  endpoints: {
229
- openAPI: {
415
+ openAPIGenerator: {
416
+ <C extends [(better_call.Context<"/open-api/schema", {
417
+ method: "GET";
418
+ }> | undefined)?]>(...ctx: C): Promise<C extends [{
419
+ asResponse: true;
420
+ }] ? Response : {
421
+ openapi: string;
422
+ info: {
423
+ title: string;
424
+ description: string;
425
+ };
426
+ components: {
427
+ schemas: {};
428
+ };
429
+ security: {
430
+ apiKeyCookie: never[];
431
+ }[];
432
+ servers: {
433
+ url: string;
434
+ }[];
435
+ tags: {
436
+ name: string;
437
+ description: string;
438
+ }[];
439
+ paths: Record<string, Path>;
440
+ }>;
441
+ path: "/open-api/schema";
442
+ options: {
443
+ method: "GET";
444
+ };
445
+ method: better_call.Method | better_call.Method[];
446
+ headers: Headers;
447
+ };
448
+ openAPIReference: {
230
449
  <C extends [(better_call.Context<"/reference", {
231
450
  method: "GET";
451
+ metadata: {
452
+ isAction: boolean;
453
+ };
232
454
  }> | undefined)?]>(...ctx: C): Promise<C extends [{
233
455
  asResponse: true;
234
456
  }] ? Response : Response>;
235
457
  path: "/reference";
236
458
  options: {
237
459
  method: "GET";
460
+ metadata: {
461
+ isAction: boolean;
462
+ };
238
463
  };
239
464
  method: better_call.Method | better_call.Method[];
240
465
  headers: Headers;
@@ -242,4 +467,4 @@ declare const openAPI: () => {
242
467
  };
243
468
  };
244
469
 
245
- export { bearer, customSession, oAuthProxy, oneTap, openAPI };
470
+ export { type OpenAPIOptions, bearer, customSession, oAuthProxy, oneTap, openAPI };
package/dist/plugins.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- export { A as AnonymousOptions, J as JwtOptions, O as OrganizationOptions, b as Passkey, P as PasskeyOptions, e as UserWithAnonymous, U as UserWithPhoneNumber, h as UserWithRole, i as admin, f as anonymous, n as emailOTP, j as genericOAuth, g as getPasskeyActions, k as jwt, m as magicLink, l as multiSession, o as organization, p as passkey, c as passkeyClient, d as phoneNumber, t as twoFactor, a as twoFactorClient, u as username } from './index-CX-Hopog.js';
2
- import { H as HookEndpointContext, B as BetterAuthOptions, I as InferUser, f as InferSession } from './auth-5eyWphKM.js';
3
- export { a5 as AuthEndpoint, a6 as AuthMiddleware, j as BetterAuthPlugin, k as InferOptionSchema, P as PluginSchema, a4 as createAuthEndpoint, a3 as createAuthMiddleware, a2 as optionsMiddleware } from './auth-5eyWphKM.js';
1
+ export { A as AnonymousOptions, J as JwtOptions, O as OrganizationOptions, b as Passkey, P as PasskeyOptions, e as UserWithAnonymous, U as UserWithPhoneNumber, h as UserWithRole, i as admin, f as anonymous, n as emailOTP, j as genericOAuth, g as getPasskeyActions, k as jwt, m as magicLink, l as multiSession, o as organization, p as passkey, c as passkeyClient, d as phoneNumber, t as twoFactor, a as twoFactorClient, u as username } from './index-aMRluDla.js';
2
+ import { H as HookEndpointContext, B as BetterAuthOptions, I as InferUser, f as InferSession } from './auth-DF-f5DGM.js';
3
+ export { a5 as AuthEndpoint, a6 as AuthMiddleware, j as BetterAuthPlugin, k as InferOptionSchema, P as PluginSchema, a4 as createAuthEndpoint, a3 as createAuthMiddleware, a2 as optionsMiddleware } from './auth-DF-f5DGM.js';
4
4
  export { H as HIDE_METADATA } from './hide-metadata-DEHJp1rk.js';
5
5
  import * as better_call from 'better-call';
6
- import { APIError } from 'better-call';
6
+ import { APIError, OpenAPIParameter, OpenAPISchemaType } from 'better-call';
7
7
  import { z } from 'zod';
8
- import './helper-DxMBi7M2.js';
8
+ import { L as LiteralString } from './helper-DxMBi7M2.js';
9
9
  import './plugins/access.js';
10
10
  import '@better-fetch/fetch';
11
11
  import 'nanostores';
@@ -51,6 +51,35 @@ declare const oneTap: (options?: OneTapOptions) => {
51
51
  }, {
52
52
  idToken: string;
53
53
  }>;
54
+ metadata: {
55
+ openapi: {
56
+ summary: string;
57
+ description: string;
58
+ responses: {
59
+ 200: {
60
+ description: string;
61
+ content: {
62
+ "application/json": {
63
+ schema: {
64
+ type: "object";
65
+ properties: {
66
+ session: {
67
+ $ref: string;
68
+ };
69
+ user: {
70
+ $ref: string;
71
+ };
72
+ };
73
+ };
74
+ };
75
+ };
76
+ };
77
+ 400: {
78
+ description: string;
79
+ };
80
+ };
81
+ };
82
+ };
54
83
  }>]>(...ctx: C): Promise<C extends [{
55
84
  asResponse: true;
56
85
  }] ? Response : {
@@ -118,6 +147,35 @@ declare const oneTap: (options?: OneTapOptions) => {
118
147
  }, {
119
148
  idToken: string;
120
149
  }>;
150
+ metadata: {
151
+ openapi: {
152
+ summary: string;
153
+ description: string;
154
+ responses: {
155
+ 200: {
156
+ description: string;
157
+ content: {
158
+ "application/json": {
159
+ schema: {
160
+ type: "object";
161
+ properties: {
162
+ session: {
163
+ $ref: string;
164
+ };
165
+ user: {
166
+ $ref: string;
167
+ };
168
+ };
169
+ };
170
+ };
171
+ };
172
+ };
173
+ 400: {
174
+ description: string;
175
+ };
176
+ };
177
+ };
178
+ };
121
179
  };
122
180
  method: better_call.Method | better_call.Method[];
123
181
  headers: Headers;
@@ -157,6 +215,30 @@ declare const oAuthProxy: (opts?: OAuthProxyOptions) => {
157
215
  callbackURL: string;
158
216
  cookies: string;
159
217
  }>;
218
+ metadata: {
219
+ openapi: {
220
+ description: string;
221
+ parameters: {
222
+ in: "query";
223
+ name: string;
224
+ required: true;
225
+ description: string;
226
+ }[];
227
+ responses: {
228
+ 302: {
229
+ description: string;
230
+ headers: {
231
+ Location: {
232
+ description: string;
233
+ schema: {
234
+ type: string;
235
+ };
236
+ };
237
+ };
238
+ };
239
+ };
240
+ };
241
+ };
160
242
  }>]>(...ctx: C): Promise<C extends [{
161
243
  asResponse: true;
162
244
  }] ? Response : never>;
@@ -173,6 +255,30 @@ declare const oAuthProxy: (opts?: OAuthProxyOptions) => {
173
255
  callbackURL: string;
174
256
  cookies: string;
175
257
  }>;
258
+ metadata: {
259
+ openapi: {
260
+ description: string;
261
+ parameters: {
262
+ in: "query";
263
+ name: string;
264
+ required: true;
265
+ description: string;
266
+ }[];
267
+ responses: {
268
+ 302: {
269
+ description: string;
270
+ headers: {
271
+ Location: {
272
+ description: string;
273
+ schema: {
274
+ type: string;
275
+ };
276
+ };
277
+ };
278
+ };
279
+ };
280
+ };
281
+ };
176
282
  };
177
283
  method: better_call.Method | better_call.Method[];
178
284
  headers: Headers;
@@ -223,18 +329,137 @@ declare const customSession: <Returns extends Record<string, any>, O extends Bet
223
329
  };
224
330
  };
225
331
 
226
- declare const openAPI: () => {
332
+ interface Path {
333
+ get?: {
334
+ tags?: string[];
335
+ operationId?: string;
336
+ description?: string;
337
+ security?: [{
338
+ bearerAuth: string[];
339
+ }];
340
+ parameters?: OpenAPIParameter[];
341
+ responses?: {
342
+ [key in string]: {
343
+ description?: string;
344
+ content: {
345
+ "application/json": {
346
+ schema: {
347
+ type?: OpenAPISchemaType;
348
+ properties?: Record<string, any>;
349
+ required?: string[];
350
+ $ref?: string;
351
+ };
352
+ };
353
+ };
354
+ };
355
+ };
356
+ };
357
+ post?: {
358
+ tags?: string[];
359
+ operationId?: string;
360
+ description?: string;
361
+ security?: [{
362
+ bearerAuth: string[];
363
+ }];
364
+ parameters?: OpenAPIParameter[];
365
+ requestBody?: {
366
+ content: {
367
+ "application/json": {
368
+ schema: {
369
+ type?: OpenAPISchemaType;
370
+ properties?: Record<string, any>;
371
+ required?: string[];
372
+ $ref?: string;
373
+ };
374
+ };
375
+ };
376
+ };
377
+ responses?: {
378
+ [key in string]: {
379
+ description?: string;
380
+ content: {
381
+ "application/json": {
382
+ schema: {
383
+ type?: OpenAPISchemaType;
384
+ properties?: Record<string, any>;
385
+ required?: string[];
386
+ $ref?: string;
387
+ };
388
+ };
389
+ };
390
+ };
391
+ };
392
+ };
393
+ }
394
+
395
+ interface OpenAPIOptions {
396
+ /**
397
+ * The path to the OpenAPI reference page
398
+ *
399
+ * keep in mind that this path will be appended to the base URL `/api/auth` path
400
+ * by default, so if you set this to `/reference`, the full path will be `/api/auth/reference`
401
+ *
402
+ * @default "/reference"
403
+ */
404
+ path?: LiteralString;
405
+ /**
406
+ * Disable the default reference page that is generated by Scalar
407
+ *
408
+ * @default false
409
+ */
410
+ disableDefaultReference?: boolean;
411
+ }
412
+ declare const openAPI: <O extends OpenAPIOptions>(options?: O) => {
227
413
  id: "open-api";
228
414
  endpoints: {
229
- openAPI: {
415
+ openAPIGenerator: {
416
+ <C extends [(better_call.Context<"/open-api/schema", {
417
+ method: "GET";
418
+ }> | undefined)?]>(...ctx: C): Promise<C extends [{
419
+ asResponse: true;
420
+ }] ? Response : {
421
+ openapi: string;
422
+ info: {
423
+ title: string;
424
+ description: string;
425
+ };
426
+ components: {
427
+ schemas: {};
428
+ };
429
+ security: {
430
+ apiKeyCookie: never[];
431
+ }[];
432
+ servers: {
433
+ url: string;
434
+ }[];
435
+ tags: {
436
+ name: string;
437
+ description: string;
438
+ }[];
439
+ paths: Record<string, Path>;
440
+ }>;
441
+ path: "/open-api/schema";
442
+ options: {
443
+ method: "GET";
444
+ };
445
+ method: better_call.Method | better_call.Method[];
446
+ headers: Headers;
447
+ };
448
+ openAPIReference: {
230
449
  <C extends [(better_call.Context<"/reference", {
231
450
  method: "GET";
451
+ metadata: {
452
+ isAction: boolean;
453
+ };
232
454
  }> | undefined)?]>(...ctx: C): Promise<C extends [{
233
455
  asResponse: true;
234
456
  }] ? Response : Response>;
235
457
  path: "/reference";
236
458
  options: {
237
459
  method: "GET";
460
+ metadata: {
461
+ isAction: boolean;
462
+ };
238
463
  };
239
464
  method: better_call.Method | better_call.Method[];
240
465
  headers: Headers;
@@ -242,4 +467,4 @@ declare const openAPI: () => {
242
467
  };
243
468
  };
244
469
 
245
- export { bearer, customSession, oAuthProxy, oneTap, openAPI };
470
+ export { type OpenAPIOptions, bearer, customSession, oAuthProxy, oneTap, openAPI };