zitejs 0.9.82 → 0.9.84
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.
- package/dist/cjs/auth/index.d.ts +3 -3
- package/dist/cjs/auth/index.test.js +3 -0
- package/dist/cjs/auth-server/index.d.ts +109 -14
- package/dist/cjs/auth-server/index.js +3 -11
- package/dist/cjs/caller/index.js +6 -5
- package/dist/esm/auth/index.d.ts +3 -3
- package/dist/esm/auth/index.test.js +3 -0
- package/dist/esm/auth-server/index.d.ts +109 -14
- package/dist/esm/auth-server/index.js +3 -11
- package/dist/esm/caller/index.js +6 -5
- package/package.json +1 -1
package/dist/cjs/auth/index.d.ts
CHANGED
|
@@ -232,11 +232,11 @@ export declare function updateProfile(data: {
|
|
|
232
232
|
export type User = {
|
|
233
233
|
id: string;
|
|
234
234
|
name: string;
|
|
235
|
-
firstName
|
|
236
|
-
lastName
|
|
235
|
+
firstName: string | null;
|
|
236
|
+
lastName: string | null;
|
|
237
237
|
email: string;
|
|
238
238
|
emailVerified: boolean;
|
|
239
|
-
image
|
|
239
|
+
image: string | null;
|
|
240
240
|
createdAt: Date;
|
|
241
241
|
updatedAt: Date;
|
|
242
242
|
};
|
|
@@ -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
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
},
|
package/dist/cjs/caller/index.js
CHANGED
|
@@ -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
|
-
//
|
|
30
|
-
// forwards to
|
|
31
|
-
//
|
|
32
|
-
|
|
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
|
-
//
|
|
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
|
}
|
package/dist/esm/auth/index.d.ts
CHANGED
|
@@ -232,11 +232,11 @@ export declare function updateProfile(data: {
|
|
|
232
232
|
export type User = {
|
|
233
233
|
id: string;
|
|
234
234
|
name: string;
|
|
235
|
-
firstName
|
|
236
|
-
lastName
|
|
235
|
+
firstName: string | null;
|
|
236
|
+
lastName: string | null;
|
|
237
237
|
email: string;
|
|
238
238
|
emailVerified: boolean;
|
|
239
|
-
image
|
|
239
|
+
image: string | null;
|
|
240
240
|
createdAt: Date;
|
|
241
241
|
updatedAt: Date;
|
|
242
242
|
};
|
|
@@ -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
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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
|
},
|
package/dist/esm/caller/index.js
CHANGED
|
@@ -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
|
-
//
|
|
26
|
-
// forwards to
|
|
27
|
-
//
|
|
28
|
-
|
|
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
|
-
//
|
|
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
|
}
|