zitejs 0.9.81 → 0.9.83

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;
@@ -8,9 +8,20 @@ const react_1 = require("better-auth/react");
8
8
  const plugins_1 = require("better-auth/client/plugins");
9
9
  const authClient = (0, react_1.createAuthClient)({
10
10
  baseURL: '',
11
- 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
+ ],
12
20
  });
13
- 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;
14
25
  function loginWithRedirect(opts) {
15
26
  if (window.location.pathname.startsWith('/auth/'))
16
27
  return;
@@ -61,4 +61,7 @@ const authExports = __importStar(require("./index.js"));
61
61
  (0, vitest_1.it)('exports signOut', () => {
62
62
  (0, vitest_1.expect)(authExports.signOut).toBeDefined();
63
63
  });
64
+ (0, vitest_1.it)('exports updateProfile as a function', () => {
65
+ (0, vitest_1.expect)(typeof authExports.updateProfile).toBe('function');
66
+ });
64
67
  });
@@ -36,7 +36,113 @@ export declare function ziteAuth(config?: ZiteAuthConfig): import("better-auth")
36
36
  emailAndPassword: {
37
37
  enabled: true;
38
38
  };
39
- plugins: {
39
+ plugins: ({
40
+ id: "magic-link";
41
+ version: string;
42
+ endpoints: {
43
+ signInMagicLink: import("better-auth").StrictEndpoint<"/sign-in/magic-link", {
44
+ method: "POST";
45
+ requireHeaders: true;
46
+ body: import("better-auth").ZodObject<{
47
+ email: import("better-auth").ZodEmail;
48
+ name: import("better-auth").ZodOptional<import("better-auth").ZodString>;
49
+ callbackURL: import("better-auth").ZodOptional<import("better-auth").ZodString>;
50
+ newUserCallbackURL: import("better-auth").ZodOptional<import("better-auth").ZodString>;
51
+ errorCallbackURL: import("better-auth").ZodOptional<import("better-auth").ZodString>;
52
+ metadata: import("better-auth").ZodOptional<import("better-auth").ZodRecord<import("better-auth").ZodString, import("better-auth").ZodAny>>;
53
+ }, import("zod/v4/core").$strip>;
54
+ metadata: {
55
+ openapi: {
56
+ operationId: string;
57
+ description: string;
58
+ responses: {
59
+ 200: {
60
+ description: string;
61
+ content: {
62
+ "application/json": {
63
+ schema: {
64
+ type: "object";
65
+ properties: {
66
+ status: {
67
+ type: string;
68
+ };
69
+ };
70
+ };
71
+ };
72
+ };
73
+ };
74
+ };
75
+ };
76
+ };
77
+ }, {
78
+ status: boolean;
79
+ }>;
80
+ magicLinkVerify: import("better-auth").StrictEndpoint<"/magic-link/verify", {
81
+ method: "GET";
82
+ query: import("better-auth").ZodObject<{
83
+ token: import("better-auth").ZodString;
84
+ callbackURL: import("better-auth").ZodOptional<import("better-auth").ZodString>;
85
+ errorCallbackURL: import("better-auth").ZodOptional<import("better-auth").ZodString>;
86
+ newUserCallbackURL: import("better-auth").ZodOptional<import("better-auth").ZodString>;
87
+ }, import("zod/v4/core").$strip>;
88
+ use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<void>)[];
89
+ requireHeaders: true;
90
+ metadata: {
91
+ openapi: {
92
+ operationId: string;
93
+ description: string;
94
+ responses: {
95
+ 200: {
96
+ description: string;
97
+ content: {
98
+ "application/json": {
99
+ schema: {
100
+ type: "object";
101
+ properties: {
102
+ session: {
103
+ $ref: string;
104
+ };
105
+ user: {
106
+ $ref: string;
107
+ };
108
+ };
109
+ };
110
+ };
111
+ };
112
+ };
113
+ };
114
+ };
115
+ };
116
+ }, {
117
+ token: string;
118
+ user: {
119
+ id: string;
120
+ createdAt: Date;
121
+ updatedAt: Date;
122
+ email: string;
123
+ emailVerified: boolean;
124
+ name: string;
125
+ image?: string | null | undefined;
126
+ };
127
+ session: {
128
+ id: string;
129
+ createdAt: Date;
130
+ updatedAt: Date;
131
+ userId: string;
132
+ expiresAt: Date;
133
+ token: string;
134
+ ipAddress?: string | null | undefined;
135
+ userAgent?: string | null | undefined;
136
+ };
137
+ }>;
138
+ };
139
+ rateLimit: {
140
+ pathMatcher(path: string): boolean;
141
+ window: number;
142
+ max: number;
143
+ }[];
144
+ options: import("better-auth/plugins").MagicLinkOptions;
145
+ } | {
40
146
  id: "generic-oauth";
41
147
  version: string;
42
148
  init: (ctx: import("better-auth").AuthContext) => {
@@ -197,7 +303,7 @@ export declare function ziteAuth(config?: ZiteAuthConfig): import("better-auth")
197
303
  ISSUER_MISMATCH: import("better-auth").RawError<"ISSUER_MISMATCH">;
198
304
  ISSUER_MISSING: import("better-auth").RawError<"ISSUER_MISSING">;
199
305
  };
200
- }[];
306
+ })[];
201
307
  user: {
202
308
  modelName: "zite_user";
203
309
  additionalFields: {
@@ -256,18 +362,7 @@ export declare function ziteAuth(config?: ZiteAuthConfig): import("better-auth")
256
362
  };
257
363
  };
258
364
  session: {
259
- create: {
260
- after: ((session: {
261
- id: string;
262
- createdAt: Date;
263
- updatedAt: Date;
264
- userId: string;
265
- expiresAt: Date;
266
- token: string;
267
- ipAddress?: string | null | undefined;
268
- userAgent?: string | null | undefined;
269
- } & Record<string, unknown>) => Promise<void>) | undefined;
270
- };
365
+ create: {};
271
366
  };
272
367
  };
273
368
  }>;
@@ -109,17 +109,9 @@ function ziteAuth(config = {}) {
109
109
  },
110
110
  session: {
111
111
  create: {
112
- after: config.onLogin
113
- ? async (session) => {
114
- await config.onLogin({
115
- id: session.userId,
116
- email: '',
117
- name: '',
118
- firstName: '',
119
- lastName: '',
120
- });
121
- }
122
- : undefined,
112
+ // TODO: Wire onLogin properly — session.create.after only has
113
+ // userId, not the full user. Need to query the user from the DB
114
+ // or use a sign-in endpoint afterHook instead.
123
115
  },
124
116
  },
125
117
  },
@@ -26,12 +26,13 @@ function getRunnerUrl() {
26
26
  const explicit = (0, env_js_1.getEnv)("ZITE_RUNNER_URL", "VITE_ZITE_RUNNER_URL");
27
27
  if (explicit)
28
28
  return explicit;
29
- // Published apps use same-origin proxy (/api/*) — the CF worker
30
- // forwards to the workflow-runner. This ensures cookies work and
31
- // the browser sees a single origin.
32
- if (getMode() === "live")
29
+ // Both published and preview apps use same-origin proxy (/api/*).
30
+ // Published: CF worker forwards to workflow-runner.
31
+ // Preview: app-runner forwards to workflow-runner.
32
+ // This ensures cookies (better-auth sessions) are included in requests.
33
+ if (typeof window !== "undefined")
33
34
  return "";
34
- // Preview/editor mode: call the workflow-runner directly
35
+ // Server-side (endpoints calling other endpoints): call directly
35
36
  const env = (0, env_js_1.getEnv)("ZITE_ENV", "VITE_ZITE_ENV") ?? "production";
36
37
  return ENVIRONMENTS[env] ?? ENVIRONMENTS.production;
37
38
  }
@@ -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;
@@ -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;
@@ -26,4 +26,7 @@ describe('zitejs/auth exports', () => {
26
26
  it('exports signOut', () => {
27
27
  expect(authExports.signOut).toBeDefined();
28
28
  });
29
+ it('exports updateProfile as a function', () => {
30
+ expect(typeof authExports.updateProfile).toBe('function');
31
+ });
29
32
  });
@@ -36,7 +36,113 @@ export declare function ziteAuth(config?: ZiteAuthConfig): import("better-auth")
36
36
  emailAndPassword: {
37
37
  enabled: true;
38
38
  };
39
- plugins: {
39
+ plugins: ({
40
+ id: "magic-link";
41
+ version: string;
42
+ endpoints: {
43
+ signInMagicLink: import("better-auth").StrictEndpoint<"/sign-in/magic-link", {
44
+ method: "POST";
45
+ requireHeaders: true;
46
+ body: import("better-auth").ZodObject<{
47
+ email: import("better-auth").ZodEmail;
48
+ name: import("better-auth").ZodOptional<import("better-auth").ZodString>;
49
+ callbackURL: import("better-auth").ZodOptional<import("better-auth").ZodString>;
50
+ newUserCallbackURL: import("better-auth").ZodOptional<import("better-auth").ZodString>;
51
+ errorCallbackURL: import("better-auth").ZodOptional<import("better-auth").ZodString>;
52
+ metadata: import("better-auth").ZodOptional<import("better-auth").ZodRecord<import("better-auth").ZodString, import("better-auth").ZodAny>>;
53
+ }, import("zod/v4/core").$strip>;
54
+ metadata: {
55
+ openapi: {
56
+ operationId: string;
57
+ description: string;
58
+ responses: {
59
+ 200: {
60
+ description: string;
61
+ content: {
62
+ "application/json": {
63
+ schema: {
64
+ type: "object";
65
+ properties: {
66
+ status: {
67
+ type: string;
68
+ };
69
+ };
70
+ };
71
+ };
72
+ };
73
+ };
74
+ };
75
+ };
76
+ };
77
+ }, {
78
+ status: boolean;
79
+ }>;
80
+ magicLinkVerify: import("better-auth").StrictEndpoint<"/magic-link/verify", {
81
+ method: "GET";
82
+ query: import("better-auth").ZodObject<{
83
+ token: import("better-auth").ZodString;
84
+ callbackURL: import("better-auth").ZodOptional<import("better-auth").ZodString>;
85
+ errorCallbackURL: import("better-auth").ZodOptional<import("better-auth").ZodString>;
86
+ newUserCallbackURL: import("better-auth").ZodOptional<import("better-auth").ZodString>;
87
+ }, import("zod/v4/core").$strip>;
88
+ use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<void>)[];
89
+ requireHeaders: true;
90
+ metadata: {
91
+ openapi: {
92
+ operationId: string;
93
+ description: string;
94
+ responses: {
95
+ 200: {
96
+ description: string;
97
+ content: {
98
+ "application/json": {
99
+ schema: {
100
+ type: "object";
101
+ properties: {
102
+ session: {
103
+ $ref: string;
104
+ };
105
+ user: {
106
+ $ref: string;
107
+ };
108
+ };
109
+ };
110
+ };
111
+ };
112
+ };
113
+ };
114
+ };
115
+ };
116
+ }, {
117
+ token: string;
118
+ user: {
119
+ id: string;
120
+ createdAt: Date;
121
+ updatedAt: Date;
122
+ email: string;
123
+ emailVerified: boolean;
124
+ name: string;
125
+ image?: string | null | undefined;
126
+ };
127
+ session: {
128
+ id: string;
129
+ createdAt: Date;
130
+ updatedAt: Date;
131
+ userId: string;
132
+ expiresAt: Date;
133
+ token: string;
134
+ ipAddress?: string | null | undefined;
135
+ userAgent?: string | null | undefined;
136
+ };
137
+ }>;
138
+ };
139
+ rateLimit: {
140
+ pathMatcher(path: string): boolean;
141
+ window: number;
142
+ max: number;
143
+ }[];
144
+ options: import("better-auth/plugins").MagicLinkOptions;
145
+ } | {
40
146
  id: "generic-oauth";
41
147
  version: string;
42
148
  init: (ctx: import("better-auth").AuthContext) => {
@@ -197,7 +303,7 @@ export declare function ziteAuth(config?: ZiteAuthConfig): import("better-auth")
197
303
  ISSUER_MISMATCH: import("better-auth").RawError<"ISSUER_MISMATCH">;
198
304
  ISSUER_MISSING: import("better-auth").RawError<"ISSUER_MISSING">;
199
305
  };
200
- }[];
306
+ })[];
201
307
  user: {
202
308
  modelName: "zite_user";
203
309
  additionalFields: {
@@ -256,18 +362,7 @@ export declare function ziteAuth(config?: ZiteAuthConfig): import("better-auth")
256
362
  };
257
363
  };
258
364
  session: {
259
- create: {
260
- after: ((session: {
261
- id: string;
262
- createdAt: Date;
263
- updatedAt: Date;
264
- userId: string;
265
- expiresAt: Date;
266
- token: string;
267
- ipAddress?: string | null | undefined;
268
- userAgent?: string | null | undefined;
269
- } & Record<string, unknown>) => Promise<void>) | undefined;
270
- };
365
+ create: {};
271
366
  };
272
367
  };
273
368
  }>;
@@ -106,17 +106,9 @@ export function ziteAuth(config = {}) {
106
106
  },
107
107
  session: {
108
108
  create: {
109
- after: config.onLogin
110
- ? async (session) => {
111
- await config.onLogin({
112
- id: session.userId,
113
- email: '',
114
- name: '',
115
- firstName: '',
116
- lastName: '',
117
- });
118
- }
119
- : undefined,
109
+ // TODO: Wire onLogin properly — session.create.after only has
110
+ // userId, not the full user. Need to query the user from the DB
111
+ // or use a sign-in endpoint afterHook instead.
120
112
  },
121
113
  },
122
114
  },
@@ -22,12 +22,13 @@ function getRunnerUrl() {
22
22
  const explicit = getEnv("ZITE_RUNNER_URL", "VITE_ZITE_RUNNER_URL");
23
23
  if (explicit)
24
24
  return explicit;
25
- // Published apps use same-origin proxy (/api/*) — the CF worker
26
- // forwards to the workflow-runner. This ensures cookies work and
27
- // the browser sees a single origin.
28
- if (getMode() === "live")
25
+ // Both published and preview apps use same-origin proxy (/api/*).
26
+ // Published: CF worker forwards to workflow-runner.
27
+ // Preview: app-runner forwards to workflow-runner.
28
+ // This ensures cookies (better-auth sessions) are included in requests.
29
+ if (typeof window !== "undefined")
29
30
  return "";
30
- // Preview/editor mode: call the workflow-runner directly
31
+ // Server-side (endpoints calling other endpoints): call directly
31
32
  const env = getEnv("ZITE_ENV", "VITE_ZITE_ENV") ?? "production";
32
33
  return ENVIRONMENTS[env] ?? ENVIRONMENTS.production;
33
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zitejs",
3
- "version": "0.9.81",
3
+ "version": "0.9.83",
4
4
  "description": "The Zite framework — build apps on Zite Database",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",