zitejs 0.9.80 → 0.9.82

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.
@@ -8,6 +8,9 @@ export declare const useSession: () => {
8
8
  emailVerified: boolean;
9
9
  name: string;
10
10
  image?: string | null | undefined;
11
+ } & {} & {
12
+ firstName?: string | null | undefined;
13
+ lastName?: string | null | undefined;
11
14
  }>;
12
15
  session: import("better-auth/react").StripEmptyObjects<{
13
16
  id: string;
@@ -18,7 +21,7 @@ export declare const useSession: () => {
18
21
  token: string;
19
22
  ipAddress?: string | null | undefined;
20
23
  userAgent?: string | null | undefined;
21
- }>;
24
+ } & {} & {}>;
22
25
  } | null;
23
26
  isPending: boolean;
24
27
  isRefetching: boolean;
@@ -26,7 +29,8 @@ export declare const useSession: () => {
26
29
  refetch: (queryParams?: {
27
30
  query?: import("better-auth/types").SessionQueryParams;
28
31
  } | undefined) => Promise<void>;
29
- }, signIn: {
32
+ };
33
+ export declare const signIn: {
30
34
  magicLink: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<{
31
35
  email: string;
32
36
  name?: string | undefined;
@@ -125,6 +129,9 @@ export declare const useSession: () => {
125
129
  emailVerified: boolean;
126
130
  name: string;
127
131
  image?: string | null | undefined;
132
+ } & {} & {
133
+ firstName?: string | null | undefined;
134
+ lastName?: string | null | undefined;
128
135
  }>;
129
136
  }), {
130
137
  code?: string | undefined;
@@ -165,12 +172,16 @@ export declare const useSession: () => {
165
172
  emailVerified: boolean;
166
173
  name: string;
167
174
  image?: string | null | undefined;
175
+ } & {} & {
176
+ firstName?: string | null | undefined;
177
+ lastName?: string | null | undefined;
168
178
  }>;
169
179
  }, {
170
180
  code?: string | undefined;
171
181
  message?: string | undefined;
172
182
  }, FetchOptions["throw"] extends true ? true : false>>;
173
- }, signOut: <FetchOptions extends import("@better-auth/core").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth/react").Prettify<{
183
+ };
184
+ export declare const signOut: <FetchOptions extends import("@better-auth/core").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth/react").Prettify<{
174
185
  query?: Record<string, any> | undefined;
175
186
  fetchOptions?: FetchOptions | undefined;
176
187
  }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
@@ -178,67 +189,19 @@ export declare const useSession: () => {
178
189
  }, {
179
190
  code?: string | undefined;
180
191
  message?: string | undefined;
181
- }, FetchOptions["throw"] extends true ? true : false>>, signUp: {
182
- email: <FetchOptions extends import("@better-auth/core").ClientFetchOption<Partial<{
183
- name: string;
192
+ }, FetchOptions["throw"] extends true ? true : false>>;
193
+ export declare const signUp: {
194
+ email: (data: {
184
195
  email: string;
185
196
  password: string;
186
- image?: string | undefined;
187
- callbackURL?: string | undefined;
188
- rememberMe?: boolean | undefined;
189
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
190
- email: string;
191
197
  name: string;
192
- password: string;
193
- image?: string | undefined;
194
- callbackURL?: string | undefined;
195
- fetchOptions?: FetchOptions | undefined;
196
- }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<(Omit<{
197
- token: null;
198
- user: {
199
- id: string;
200
- createdAt: Date;
201
- updatedAt: Date;
202
- email: string;
203
- emailVerified: boolean;
204
- name: string;
205
- image?: string | null | undefined | undefined;
206
- };
207
- }, "user"> & {
208
- user: import("better-auth/react").StripEmptyObjects<{
209
- id: string;
210
- createdAt: Date;
211
- updatedAt: Date;
212
- email: string;
213
- emailVerified: boolean;
214
- name: string;
215
- image?: string | null | undefined;
216
- }>;
217
- }) | (Omit<{
218
- token: string;
219
- user: {
220
- id: string;
221
- createdAt: Date;
222
- updatedAt: Date;
223
- email: string;
224
- emailVerified: boolean;
225
- name: string;
226
- image?: string | null | undefined | undefined;
227
- };
228
- }, "user"> & {
229
- user: import("better-auth/react").StripEmptyObjects<{
230
- id: string;
231
- createdAt: Date;
232
- updatedAt: Date;
233
- email: string;
234
- emailVerified: boolean;
235
- name: string;
236
- image?: string | null | undefined;
237
- }>;
238
- }), {
239
- code?: string | undefined;
240
- message?: string | undefined;
241
- }, FetchOptions["throw"] extends true ? true : false>>;
198
+ [key: string]: unknown;
199
+ }) => Promise<{
200
+ error?: {
201
+ message?: string;
202
+ } | null;
203
+ data?: unknown;
204
+ }>;
242
205
  };
243
206
  export declare function loginWithRedirect(opts?: {
244
207
  redirectUrl?: string;
@@ -247,6 +210,25 @@ export declare function loginWithRedirect(opts?: {
247
210
  export declare function logout(opts?: {
248
211
  returnTo?: string;
249
212
  }): void;
213
+ export declare function updateProfile(data: {
214
+ name?: string;
215
+ firstName?: string;
216
+ lastName?: string;
217
+ image?: string;
218
+ }): Promise<{
219
+ data: {
220
+ status: boolean;
221
+ };
222
+ error: null;
223
+ } | {
224
+ data: null;
225
+ error: {
226
+ code?: string | undefined | undefined;
227
+ message?: string | undefined | undefined;
228
+ status: number;
229
+ statusText: string;
230
+ };
231
+ }>;
250
232
  export type User = {
251
233
  id: string;
252
234
  name: string;
@@ -3,13 +3,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.signUp = exports.signOut = exports.signIn = exports.useSession = void 0;
4
4
  exports.loginWithRedirect = loginWithRedirect;
5
5
  exports.logout = logout;
6
+ exports.updateProfile = updateProfile;
6
7
  const react_1 = require("better-auth/react");
7
8
  const plugins_1 = require("better-auth/client/plugins");
8
9
  const authClient = (0, react_1.createAuthClient)({
9
10
  baseURL: '',
10
- plugins: [(0, plugins_1.magicLinkClient)()],
11
+ plugins: [
12
+ (0, plugins_1.magicLinkClient)(),
13
+ (0, plugins_1.inferAdditionalFields)({
14
+ user: {
15
+ firstName: { type: 'string', required: false },
16
+ lastName: { type: 'string', required: false },
17
+ },
18
+ }),
19
+ ],
11
20
  });
12
- exports.useSession = authClient.useSession, exports.signIn = authClient.signIn, exports.signOut = authClient.signOut, exports.signUp = authClient.signUp;
21
+ exports.useSession = authClient.useSession;
22
+ exports.signIn = authClient.signIn;
23
+ exports.signOut = authClient.signOut;
24
+ exports.signUp = authClient.signUp;
13
25
  function loginWithRedirect(opts) {
14
26
  if (window.location.pathname.startsWith('/auth/'))
15
27
  return;
@@ -26,3 +38,6 @@ function logout(opts) {
26
38
  window.location.href = opts?.returnTo || '/';
27
39
  });
28
40
  }
41
+ function updateProfile(data) {
42
+ return authClient.updateUser(data);
43
+ }
@@ -503,6 +503,7 @@ function generateAuthWrapperTs() {
503
503
  " signUp,",
504
504
  " loginWithRedirect,",
505
505
  " logout,",
506
+ " updateProfile,",
506
507
  "} from 'zitejs/auth/base';",
507
508
  "",
508
509
  "export type {",
@@ -8,6 +8,9 @@ export declare const useSession: () => {
8
8
  emailVerified: boolean;
9
9
  name: string;
10
10
  image?: string | null | undefined;
11
+ } & {} & {
12
+ firstName?: string | null | undefined;
13
+ lastName?: string | null | undefined;
11
14
  }>;
12
15
  session: import("better-auth/react").StripEmptyObjects<{
13
16
  id: string;
@@ -18,7 +21,7 @@ export declare const useSession: () => {
18
21
  token: string;
19
22
  ipAddress?: string | null | undefined;
20
23
  userAgent?: string | null | undefined;
21
- }>;
24
+ } & {} & {}>;
22
25
  } | null;
23
26
  isPending: boolean;
24
27
  isRefetching: boolean;
@@ -26,7 +29,8 @@ export declare const useSession: () => {
26
29
  refetch: (queryParams?: {
27
30
  query?: import("better-auth").SessionQueryParams;
28
31
  } | undefined) => Promise<void>;
29
- }, signIn: {
32
+ };
33
+ export declare const signIn: {
30
34
  magicLink: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
31
35
  email: string;
32
36
  name?: string | undefined;
@@ -125,6 +129,9 @@ export declare const useSession: () => {
125
129
  emailVerified: boolean;
126
130
  name: string;
127
131
  image?: string | null | undefined;
132
+ } & {} & {
133
+ firstName?: string | null | undefined;
134
+ lastName?: string | null | undefined;
128
135
  }>;
129
136
  }), {
130
137
  code?: string | undefined;
@@ -165,12 +172,16 @@ export declare const useSession: () => {
165
172
  emailVerified: boolean;
166
173
  name: string;
167
174
  image?: string | null | undefined;
175
+ } & {} & {
176
+ firstName?: string | null | undefined;
177
+ lastName?: string | null | undefined;
168
178
  }>;
169
179
  }, {
170
180
  code?: string | undefined;
171
181
  message?: string | undefined;
172
182
  }, FetchOptions["throw"] extends true ? true : false>>;
173
- }, signOut: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth/react").Prettify<{
183
+ };
184
+ export declare const signOut: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth/react").Prettify<{
174
185
  query?: Record<string, any> | undefined;
175
186
  fetchOptions?: FetchOptions | undefined;
176
187
  }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
@@ -178,67 +189,19 @@ export declare const useSession: () => {
178
189
  }, {
179
190
  code?: string | undefined;
180
191
  message?: string | undefined;
181
- }, FetchOptions["throw"] extends true ? true : false>>, signUp: {
182
- email: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
183
- name: string;
192
+ }, FetchOptions["throw"] extends true ? true : false>>;
193
+ export declare const signUp: {
194
+ email: (data: {
184
195
  email: string;
185
196
  password: string;
186
- image?: string | undefined;
187
- callbackURL?: string | undefined;
188
- rememberMe?: boolean | undefined;
189
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
190
- email: string;
191
197
  name: string;
192
- password: string;
193
- image?: string | undefined;
194
- callbackURL?: string | undefined;
195
- fetchOptions?: FetchOptions | undefined;
196
- }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<(Omit<{
197
- token: null;
198
- user: {
199
- id: string;
200
- createdAt: Date;
201
- updatedAt: Date;
202
- email: string;
203
- emailVerified: boolean;
204
- name: string;
205
- image?: string | null | undefined | undefined;
206
- };
207
- }, "user"> & {
208
- user: import("better-auth/react").StripEmptyObjects<{
209
- id: string;
210
- createdAt: Date;
211
- updatedAt: Date;
212
- email: string;
213
- emailVerified: boolean;
214
- name: string;
215
- image?: string | null | undefined;
216
- }>;
217
- }) | (Omit<{
218
- token: string;
219
- user: {
220
- id: string;
221
- createdAt: Date;
222
- updatedAt: Date;
223
- email: string;
224
- emailVerified: boolean;
225
- name: string;
226
- image?: string | null | undefined | undefined;
227
- };
228
- }, "user"> & {
229
- user: import("better-auth/react").StripEmptyObjects<{
230
- id: string;
231
- createdAt: Date;
232
- updatedAt: Date;
233
- email: string;
234
- emailVerified: boolean;
235
- name: string;
236
- image?: string | null | undefined;
237
- }>;
238
- }), {
239
- code?: string | undefined;
240
- message?: string | undefined;
241
- }, FetchOptions["throw"] extends true ? true : false>>;
198
+ [key: string]: unknown;
199
+ }) => Promise<{
200
+ error?: {
201
+ message?: string;
202
+ } | null;
203
+ data?: unknown;
204
+ }>;
242
205
  };
243
206
  export declare function loginWithRedirect(opts?: {
244
207
  redirectUrl?: string;
@@ -247,6 +210,25 @@ export declare function loginWithRedirect(opts?: {
247
210
  export declare function logout(opts?: {
248
211
  returnTo?: string;
249
212
  }): void;
213
+ export declare function updateProfile(data: {
214
+ name?: string;
215
+ firstName?: string;
216
+ lastName?: string;
217
+ image?: string;
218
+ }): Promise<{
219
+ data: {
220
+ status: boolean;
221
+ };
222
+ error: null;
223
+ } | {
224
+ data: null;
225
+ error: {
226
+ code?: string | undefined | undefined;
227
+ message?: string | undefined | undefined;
228
+ status: number;
229
+ statusText: string;
230
+ };
231
+ }>;
250
232
  export type User = {
251
233
  id: string;
252
234
  name: string;
@@ -1,10 +1,21 @@
1
1
  import { createAuthClient } from 'better-auth/react';
2
- import { magicLinkClient } from 'better-auth/client/plugins';
2
+ import { magicLinkClient, inferAdditionalFields, } from 'better-auth/client/plugins';
3
3
  const authClient = createAuthClient({
4
4
  baseURL: '',
5
- plugins: [magicLinkClient()],
5
+ plugins: [
6
+ magicLinkClient(),
7
+ inferAdditionalFields({
8
+ user: {
9
+ firstName: { type: 'string', required: false },
10
+ lastName: { type: 'string', required: false },
11
+ },
12
+ }),
13
+ ],
6
14
  });
7
- export const { useSession, signIn, signOut, signUp } = authClient;
15
+ export const useSession = authClient.useSession;
16
+ export const signIn = authClient.signIn;
17
+ export const signOut = authClient.signOut;
18
+ export const signUp = authClient.signUp;
8
19
  export function loginWithRedirect(opts) {
9
20
  if (window.location.pathname.startsWith('/auth/'))
10
21
  return;
@@ -21,3 +32,6 @@ export function logout(opts) {
21
32
  window.location.href = opts?.returnTo || '/';
22
33
  });
23
34
  }
35
+ export function updateProfile(data) {
36
+ return authClient.updateUser(data);
37
+ }
@@ -491,6 +491,7 @@ export function generateAuthWrapperTs() {
491
491
  " signUp,",
492
492
  " loginWithRedirect,",
493
493
  " logout,",
494
+ " updateProfile,",
494
495
  "} from 'zitejs/auth/base';",
495
496
  "",
496
497
  "export type {",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zitejs",
3
- "version": "0.9.80",
3
+ "version": "0.9.82",
4
4
  "description": "The Zite framework — build apps on Zite Database",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",