better-auth 0.8.3-beta.3 → 0.8.3-beta.5

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.
@@ -2,8 +2,8 @@ import * as nanostores from 'nanostores';
2
2
  import { A as AccessControl, S as StatementsPrimitive, R as Role } from '../statement-DFWdVU7s.cjs';
3
3
  import * as _better_fetch_fetch from '@better-fetch/fetch';
4
4
  import { BetterFetchOption } from '@better-fetch/fetch';
5
- import { o as organization, q as Organization, M as Member, I as Invitation, u as username, m as magicLink, d as phoneNumber, f as anonymous, i as admin, j as genericOAuth, k as jwt, l as multiSession, n as emailOTP } from '../index-DBQ0XVML.cjs';
6
- export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-DBQ0XVML.cjs';
5
+ import { o as organization, q as Organization, M as Member, I as Invitation, u as username, m as magicLink, d as phoneNumber, f as anonymous, i as admin, j as genericOAuth, k as jwt, l as multiSession, n as emailOTP } from '../index-xSdbpM4W.cjs';
6
+ export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-xSdbpM4W.cjs';
7
7
  import { P as Prettify } from '../helper-DPDj8Nix.cjs';
8
8
  import { F as FieldAttribute, B as BetterAuthOptions, j as BetterAuthPlugin } from '../auth-A5nkNoqm.cjs';
9
9
  import { Store } from '../types.cjs';
@@ -32,7 +32,7 @@ declare const organizationClient: <O extends OrganizationClientOptions>(options?
32
32
  id: string;
33
33
  name: string;
34
34
  email: string;
35
- image?: string;
35
+ image?: string | null;
36
36
  };
37
37
  }>[];
38
38
  invitations: Invitation[];
@@ -94,7 +94,7 @@ declare const organizationClient: <O extends OrganizationClientOptions>(options?
94
94
  name: string;
95
95
  slug: string;
96
96
  createdAt: Date;
97
- logo?: string | undefined;
97
+ logo?: string | null | undefined;
98
98
  metadata?: any;
99
99
  } & {
100
100
  members: (Member & {
@@ -117,7 +117,7 @@ declare const organizationClient: <O extends OrganizationClientOptions>(options?
117
117
  name: string;
118
118
  slug: string;
119
119
  createdAt: Date;
120
- logo?: string | undefined;
120
+ logo?: string | null | undefined;
121
121
  metadata?: any;
122
122
  }[] | null;
123
123
  error: null | _better_fetch_fetch.BetterFetchError;
@@ -2,8 +2,8 @@ import * as nanostores from 'nanostores';
2
2
  import { A as AccessControl, S as StatementsPrimitive, R as Role } from '../statement-CTl9eDv7.js';
3
3
  import * as _better_fetch_fetch from '@better-fetch/fetch';
4
4
  import { BetterFetchOption } from '@better-fetch/fetch';
5
- import { o as organization, q as Organization, M as Member, I as Invitation, u as username, m as magicLink, d as phoneNumber, f as anonymous, i as admin, j as genericOAuth, k as jwt, l as multiSession, n as emailOTP } from '../index-DuhVtl9a.js';
6
- export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-DuhVtl9a.js';
5
+ import { o as organization, q as Organization, M as Member, I as Invitation, u as username, m as magicLink, d as phoneNumber, f as anonymous, i as admin, j as genericOAuth, k as jwt, l as multiSession, n as emailOTP } from '../index-uHjME6mS.js';
6
+ export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-uHjME6mS.js';
7
7
  import { P as Prettify } from '../helper-DPDj8Nix.js';
8
8
  import { F as FieldAttribute, B as BetterAuthOptions, j as BetterAuthPlugin } from '../auth-B2oRhuJ8.js';
9
9
  import { Store } from '../types.js';
@@ -32,7 +32,7 @@ declare const organizationClient: <O extends OrganizationClientOptions>(options?
32
32
  id: string;
33
33
  name: string;
34
34
  email: string;
35
- image?: string;
35
+ image?: string | null;
36
36
  };
37
37
  }>[];
38
38
  invitations: Invitation[];
@@ -94,7 +94,7 @@ declare const organizationClient: <O extends OrganizationClientOptions>(options?
94
94
  name: string;
95
95
  slug: string;
96
96
  createdAt: Date;
97
- logo?: string | undefined;
97
+ logo?: string | null | undefined;
98
98
  metadata?: any;
99
99
  } & {
100
100
  members: (Member & {
@@ -117,7 +117,7 @@ declare const organizationClient: <O extends OrganizationClientOptions>(options?
117
117
  name: string;
118
118
  slug: string;
119
119
  createdAt: Date;
120
- logo?: string | undefined;
120
+ logo?: string | null | undefined;
121
121
  metadata?: any;
122
122
  }[] | null;
123
123
  error: null | _better_fetch_fetch.BetterFetchError;
@@ -15,8 +15,8 @@ declare const organizationSchema: z.ZodObject<{
15
15
  id: z.ZodString;
16
16
  name: z.ZodString;
17
17
  slug: z.ZodString;
18
- logo: z.ZodOptional<z.ZodString>;
19
- metadata: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodString>, z.ZodEffects<z.ZodString, any, string>]>>;
18
+ logo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
19
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodString>, z.ZodEffects<z.ZodString, any, string>]>>>;
20
20
  createdAt: z.ZodDate;
21
21
  }, "strip", z.ZodTypeAny, {
22
22
  id: string;
@@ -24,14 +24,14 @@ declare const organizationSchema: z.ZodObject<{
24
24
  createdAt: Date;
25
25
  slug: string;
26
26
  metadata?: any;
27
- logo?: string | undefined;
27
+ logo?: string | null | undefined;
28
28
  }, {
29
29
  id: string;
30
30
  name: string;
31
31
  createdAt: Date;
32
32
  slug: string;
33
- metadata?: string | Record<string, string> | undefined;
34
- logo?: string | undefined;
33
+ metadata?: string | Record<string, string> | null | undefined;
34
+ logo?: string | null | undefined;
35
35
  }>;
36
36
  declare const memberSchema: z.ZodObject<{
37
37
  id: z.ZodString;
@@ -524,7 +524,7 @@ declare const organization: <O extends OrganizationOptions>(options?: O) => {
524
524
  name: string;
525
525
  createdAt: Date;
526
526
  slug: string;
527
- logo?: string | undefined;
527
+ logo?: string | null | undefined;
528
528
  } | null>;
529
529
  path: "/organization/create";
530
530
  options: {
@@ -671,7 +671,7 @@ declare const organization: <O extends OrganizationOptions>(options?: O) => {
671
671
  createdAt: Date;
672
672
  slug: string;
673
673
  metadata?: any;
674
- logo?: string | undefined;
674
+ logo?: string | null | undefined;
675
675
  } | null>;
676
676
  path: "/organization/update";
677
677
  options: {
@@ -881,7 +881,7 @@ declare const organization: <O extends OrganizationOptions>(options?: O) => {
881
881
  createdAt: Date;
882
882
  slug: string;
883
883
  metadata?: any;
884
- logo?: string | undefined;
884
+ logo?: string | null | undefined;
885
885
  } | null>;
886
886
  path: "/organization/set-active";
887
887
  options: {
@@ -1068,7 +1068,7 @@ declare const organization: <O extends OrganizationOptions>(options?: O) => {
1068
1068
  createdAt: Date;
1069
1069
  slug: string;
1070
1070
  metadata?: any;
1071
- logo?: string | undefined;
1071
+ logo?: string | null | undefined;
1072
1072
  } | null>;
1073
1073
  path: "/organization/get-full-organization";
1074
1074
  options: {
@@ -1226,7 +1226,7 @@ declare const organization: <O extends OrganizationOptions>(options?: O) => {
1226
1226
  createdAt: Date;
1227
1227
  slug: string;
1228
1228
  metadata?: any;
1229
- logo?: string | undefined;
1229
+ logo?: string | null | undefined;
1230
1230
  }[]>;
1231
1231
  path: "/organization/list";
1232
1232
  options: {
@@ -2678,7 +2678,7 @@ declare const organization: <O extends OrganizationOptions>(options?: O) => {
2678
2678
  id: string;
2679
2679
  name: string;
2680
2680
  email: string;
2681
- image: string | undefined;
2681
+ image?: string | null;
2682
2682
  };
2683
2683
  }>[];
2684
2684
  invitations: Invitation[];
@@ -4989,6 +4989,13 @@ declare const phoneNumber: (options?: {
4989
4989
  * by default any string is accepted
4990
4990
  */
4991
4991
  phoneNumberValidator?: (phoneNumber: string) => boolean;
4992
+ /**
4993
+ * Callback when phone number is verified
4994
+ */
4995
+ callbackOnVerification?: (data: {
4996
+ phoneNumber: string;
4997
+ user: UserWithPhoneNumber | null;
4998
+ }, request?: Request) => void | Promise<void>;
4992
4999
  /**
4993
5000
  * Sign up user after phone number verification
4994
5001
  *
@@ -5086,15 +5093,7 @@ declare const phoneNumber: (options?: {
5086
5093
  }>]>(...ctx: C): Promise<C extends [{
5087
5094
  asResponse: true;
5088
5095
  }] ? Response : {
5089
- user: {
5090
- id: string;
5091
- email: string;
5092
- emailVerified: boolean;
5093
- name: string;
5094
- createdAt: Date;
5095
- updatedAt: Date;
5096
- image?: string | null | undefined;
5097
- };
5096
+ user: UserWithPhoneNumber;
5098
5097
  session: {
5099
5098
  id: string;
5100
5099
  userId: string;
@@ -5103,17 +5102,9 @@ declare const phoneNumber: (options?: {
5103
5102
  userAgent?: string | null | undefined;
5104
5103
  };
5105
5104
  } | {
5106
- user: {
5107
- id: string;
5108
- email: string;
5109
- emailVerified: boolean;
5110
- name: string;
5111
- createdAt: Date;
5112
- updatedAt: Date;
5113
- image?: string | null | undefined;
5114
- };
5105
+ user: UserWithPhoneNumber;
5115
5106
  session: null;
5116
- }>;
5107
+ } | null>;
5117
5108
  path: "/phone-number/verify";
5118
5109
  options: {
5119
5110
  method: "POST";
@@ -5299,24 +5290,6 @@ interface AdminOptions {
5299
5290
  * By default, the impersonation session lasts 1 hour
5300
5291
  */
5301
5292
  impersonationSessionDuration?: number;
5302
- /**
5303
- * Custom schema for the admin plugin
5304
- */
5305
- schema?: {
5306
- user?: {
5307
- fields?: {
5308
- role?: string;
5309
- banned?: boolean;
5310
- banReason?: string;
5311
- banExpires?: number;
5312
- };
5313
- };
5314
- session?: {
5315
- fields?: {
5316
- impersonatedBy?: string;
5317
- };
5318
- };
5319
- };
5320
5293
  }
5321
5294
  declare const admin: (options?: AdminOptions) => {
5322
5295
  id: "admin";
@@ -15,8 +15,8 @@ declare const organizationSchema: z.ZodObject<{
15
15
  id: z.ZodString;
16
16
  name: z.ZodString;
17
17
  slug: z.ZodString;
18
- logo: z.ZodOptional<z.ZodString>;
19
- metadata: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodString>, z.ZodEffects<z.ZodString, any, string>]>>;
18
+ logo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
19
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodString>, z.ZodEffects<z.ZodString, any, string>]>>>;
20
20
  createdAt: z.ZodDate;
21
21
  }, "strip", z.ZodTypeAny, {
22
22
  id: string;
@@ -24,14 +24,14 @@ declare const organizationSchema: z.ZodObject<{
24
24
  createdAt: Date;
25
25
  slug: string;
26
26
  metadata?: any;
27
- logo?: string | undefined;
27
+ logo?: string | null | undefined;
28
28
  }, {
29
29
  id: string;
30
30
  name: string;
31
31
  createdAt: Date;
32
32
  slug: string;
33
- metadata?: string | Record<string, string> | undefined;
34
- logo?: string | undefined;
33
+ metadata?: string | Record<string, string> | null | undefined;
34
+ logo?: string | null | undefined;
35
35
  }>;
36
36
  declare const memberSchema: z.ZodObject<{
37
37
  id: z.ZodString;
@@ -524,7 +524,7 @@ declare const organization: <O extends OrganizationOptions>(options?: O) => {
524
524
  name: string;
525
525
  createdAt: Date;
526
526
  slug: string;
527
- logo?: string | undefined;
527
+ logo?: string | null | undefined;
528
528
  } | null>;
529
529
  path: "/organization/create";
530
530
  options: {
@@ -671,7 +671,7 @@ declare const organization: <O extends OrganizationOptions>(options?: O) => {
671
671
  createdAt: Date;
672
672
  slug: string;
673
673
  metadata?: any;
674
- logo?: string | undefined;
674
+ logo?: string | null | undefined;
675
675
  } | null>;
676
676
  path: "/organization/update";
677
677
  options: {
@@ -881,7 +881,7 @@ declare const organization: <O extends OrganizationOptions>(options?: O) => {
881
881
  createdAt: Date;
882
882
  slug: string;
883
883
  metadata?: any;
884
- logo?: string | undefined;
884
+ logo?: string | null | undefined;
885
885
  } | null>;
886
886
  path: "/organization/set-active";
887
887
  options: {
@@ -1068,7 +1068,7 @@ declare const organization: <O extends OrganizationOptions>(options?: O) => {
1068
1068
  createdAt: Date;
1069
1069
  slug: string;
1070
1070
  metadata?: any;
1071
- logo?: string | undefined;
1071
+ logo?: string | null | undefined;
1072
1072
  } | null>;
1073
1073
  path: "/organization/get-full-organization";
1074
1074
  options: {
@@ -1226,7 +1226,7 @@ declare const organization: <O extends OrganizationOptions>(options?: O) => {
1226
1226
  createdAt: Date;
1227
1227
  slug: string;
1228
1228
  metadata?: any;
1229
- logo?: string | undefined;
1229
+ logo?: string | null | undefined;
1230
1230
  }[]>;
1231
1231
  path: "/organization/list";
1232
1232
  options: {
@@ -2678,7 +2678,7 @@ declare const organization: <O extends OrganizationOptions>(options?: O) => {
2678
2678
  id: string;
2679
2679
  name: string;
2680
2680
  email: string;
2681
- image: string | undefined;
2681
+ image?: string | null;
2682
2682
  };
2683
2683
  }>[];
2684
2684
  invitations: Invitation[];
@@ -4989,6 +4989,13 @@ declare const phoneNumber: (options?: {
4989
4989
  * by default any string is accepted
4990
4990
  */
4991
4991
  phoneNumberValidator?: (phoneNumber: string) => boolean;
4992
+ /**
4993
+ * Callback when phone number is verified
4994
+ */
4995
+ callbackOnVerification?: (data: {
4996
+ phoneNumber: string;
4997
+ user: UserWithPhoneNumber | null;
4998
+ }, request?: Request) => void | Promise<void>;
4992
4999
  /**
4993
5000
  * Sign up user after phone number verification
4994
5001
  *
@@ -5086,15 +5093,7 @@ declare const phoneNumber: (options?: {
5086
5093
  }>]>(...ctx: C): Promise<C extends [{
5087
5094
  asResponse: true;
5088
5095
  }] ? Response : {
5089
- user: {
5090
- id: string;
5091
- email: string;
5092
- emailVerified: boolean;
5093
- name: string;
5094
- createdAt: Date;
5095
- updatedAt: Date;
5096
- image?: string | null | undefined;
5097
- };
5096
+ user: UserWithPhoneNumber;
5098
5097
  session: {
5099
5098
  id: string;
5100
5099
  userId: string;
@@ -5103,17 +5102,9 @@ declare const phoneNumber: (options?: {
5103
5102
  userAgent?: string | null | undefined;
5104
5103
  };
5105
5104
  } | {
5106
- user: {
5107
- id: string;
5108
- email: string;
5109
- emailVerified: boolean;
5110
- name: string;
5111
- createdAt: Date;
5112
- updatedAt: Date;
5113
- image?: string | null | undefined;
5114
- };
5105
+ user: UserWithPhoneNumber;
5115
5106
  session: null;
5116
- }>;
5107
+ } | null>;
5117
5108
  path: "/phone-number/verify";
5118
5109
  options: {
5119
5110
  method: "POST";
@@ -5299,24 +5290,6 @@ interface AdminOptions {
5299
5290
  * By default, the impersonation session lasts 1 hour
5300
5291
  */
5301
5292
  impersonationSessionDuration?: number;
5302
- /**
5303
- * Custom schema for the admin plugin
5304
- */
5305
- schema?: {
5306
- user?: {
5307
- fields?: {
5308
- role?: string;
5309
- banned?: boolean;
5310
- banReason?: string;
5311
- banExpires?: number;
5312
- };
5313
- };
5314
- session?: {
5315
- fields?: {
5316
- impersonatedBy?: string;
5317
- };
5318
- };
5319
- };
5320
5293
  }
5321
5294
  declare const admin: (options?: AdminOptions) => {
5322
5295
  id: "admin";