zitejs 0.9.74 → 0.9.75
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/api/index.js +5 -0
- package/dist/cjs/auth/index.d.ts +224 -12
- package/dist/cjs/auth/index.js +5 -280
- package/dist/cjs/auth-server/index.d.ts +345 -0
- package/dist/cjs/auth-server/index.js +72 -0
- package/dist/cjs/caller/index.js +17 -4
- package/dist/cjs/db/index.js +5 -0
- package/dist/cjs/sync/lib.d.ts +1 -1
- package/dist/cjs/sync/lib.js +3 -3
- package/dist/esm/api/index.d.ts +2 -0
- package/dist/esm/api/index.js +1 -0
- package/dist/esm/auth/index.d.ts +224 -12
- package/dist/esm/auth/index.js +4 -279
- package/dist/esm/auth-server/index.d.ts +345 -0
- package/dist/esm/auth-server/index.js +69 -0
- package/dist/esm/caller/index.js +17 -4
- package/dist/esm/cli.js +0 -0
- package/dist/esm/db/index.d.ts +2 -0
- package/dist/esm/db/index.js +1 -0
- package/dist/esm/sync/lib.d.ts +1 -1
- package/dist/esm/sync/lib.js +3 -3
- package/package.json +11 -1
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
export interface ZiteAuthUser {
|
|
2
|
+
id: string;
|
|
3
|
+
email: string;
|
|
4
|
+
name: string;
|
|
5
|
+
firstName?: string;
|
|
6
|
+
lastName?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ZiteAuthConfig {
|
|
9
|
+
flowPublicId?: string;
|
|
10
|
+
onSignup?: (user: ZiteAuthUser) => Promise<void>;
|
|
11
|
+
onLogin?: (user: ZiteAuthUser) => Promise<void>;
|
|
12
|
+
beforeSignup?: (email: string) => Promise<boolean>;
|
|
13
|
+
sendEmail?: (to: string, subject: string, body: string) => Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export declare function ziteAuth(config?: ZiteAuthConfig): import("better-auth").Auth<{
|
|
16
|
+
database: {
|
|
17
|
+
url: string;
|
|
18
|
+
};
|
|
19
|
+
secret: string;
|
|
20
|
+
baseURL: string;
|
|
21
|
+
advanced: {
|
|
22
|
+
disableCSRFCheck: true;
|
|
23
|
+
};
|
|
24
|
+
rateLimit: {
|
|
25
|
+
window: number;
|
|
26
|
+
max: number;
|
|
27
|
+
};
|
|
28
|
+
emailAndPassword: {
|
|
29
|
+
enabled: true;
|
|
30
|
+
};
|
|
31
|
+
plugins: [{
|
|
32
|
+
id: "generic-oauth";
|
|
33
|
+
version: string;
|
|
34
|
+
init: (ctx: import("better-auth").AuthContext) => {
|
|
35
|
+
context: {
|
|
36
|
+
socialProviders: import("better-auth").OAuthProvider<Record<string, any>, Partial<import("better-auth").ProviderOptions<any>>>[];
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
endpoints: {
|
|
40
|
+
signInWithOAuth2: import("better-auth").StrictEndpoint<"/sign-in/oauth2", {
|
|
41
|
+
method: "POST";
|
|
42
|
+
body: import("better-auth").ZodObject<{
|
|
43
|
+
providerId: import("better-auth").ZodString;
|
|
44
|
+
callbackURL: import("better-auth").ZodOptional<import("better-auth").ZodString>;
|
|
45
|
+
errorCallbackURL: import("better-auth").ZodOptional<import("better-auth").ZodString>;
|
|
46
|
+
newUserCallbackURL: import("better-auth").ZodOptional<import("better-auth").ZodString>;
|
|
47
|
+
disableRedirect: import("better-auth").ZodOptional<import("better-auth").ZodBoolean>;
|
|
48
|
+
scopes: import("better-auth").ZodOptional<import("better-auth").ZodArray<import("better-auth").ZodString>>;
|
|
49
|
+
requestSignUp: import("better-auth").ZodOptional<import("better-auth").ZodBoolean>;
|
|
50
|
+
additionalData: import("better-auth").ZodOptional<import("better-auth").ZodRecord<import("better-auth").ZodString, import("better-auth").ZodAny>>;
|
|
51
|
+
}, import("zod/v4/core").$strip>;
|
|
52
|
+
metadata: {
|
|
53
|
+
openapi: {
|
|
54
|
+
description: string;
|
|
55
|
+
responses: {
|
|
56
|
+
200: {
|
|
57
|
+
description: string;
|
|
58
|
+
content: {
|
|
59
|
+
"application/json": {
|
|
60
|
+
schema: {
|
|
61
|
+
type: "object";
|
|
62
|
+
properties: {
|
|
63
|
+
url: {
|
|
64
|
+
type: string;
|
|
65
|
+
};
|
|
66
|
+
redirect: {
|
|
67
|
+
type: string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
}, {
|
|
78
|
+
url: string;
|
|
79
|
+
redirect: boolean;
|
|
80
|
+
}>;
|
|
81
|
+
oAuth2Callback: import("better-auth").StrictEndpoint<"/oauth2/callback/:providerId", {
|
|
82
|
+
method: "GET";
|
|
83
|
+
query: import("better-auth").ZodObject<{
|
|
84
|
+
code: import("better-auth").ZodOptional<import("better-auth").ZodString>;
|
|
85
|
+
error: import("better-auth").ZodOptional<import("better-auth").ZodString>;
|
|
86
|
+
error_description: import("better-auth").ZodOptional<import("better-auth").ZodString>;
|
|
87
|
+
state: import("better-auth").ZodOptional<import("better-auth").ZodString>;
|
|
88
|
+
iss: import("better-auth").ZodOptional<import("better-auth").ZodString>;
|
|
89
|
+
}, import("zod/v4/core").$strip>;
|
|
90
|
+
metadata: {
|
|
91
|
+
allowedMediaTypes: string[];
|
|
92
|
+
openapi: {
|
|
93
|
+
description: string;
|
|
94
|
+
responses: {
|
|
95
|
+
200: {
|
|
96
|
+
description: string;
|
|
97
|
+
content: {
|
|
98
|
+
"application/json": {
|
|
99
|
+
schema: {
|
|
100
|
+
type: "object";
|
|
101
|
+
properties: {
|
|
102
|
+
url: {
|
|
103
|
+
type: string;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
scope: "server";
|
|
113
|
+
};
|
|
114
|
+
}, never>;
|
|
115
|
+
oAuth2LinkAccount: import("better-auth").StrictEndpoint<"/oauth2/link", {
|
|
116
|
+
method: "POST";
|
|
117
|
+
body: import("better-auth").ZodObject<{
|
|
118
|
+
providerId: import("better-auth").ZodString;
|
|
119
|
+
callbackURL: import("better-auth").ZodString;
|
|
120
|
+
scopes: import("better-auth").ZodOptional<import("better-auth").ZodArray<import("better-auth").ZodString>>;
|
|
121
|
+
errorCallbackURL: import("better-auth").ZodOptional<import("better-auth").ZodString>;
|
|
122
|
+
}, import("zod/v4/core").$strip>;
|
|
123
|
+
use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
|
|
124
|
+
session: {
|
|
125
|
+
session: Record<string, any> & {
|
|
126
|
+
id: string;
|
|
127
|
+
createdAt: Date;
|
|
128
|
+
updatedAt: Date;
|
|
129
|
+
userId: string;
|
|
130
|
+
expiresAt: Date;
|
|
131
|
+
token: string;
|
|
132
|
+
ipAddress?: string | null | undefined;
|
|
133
|
+
userAgent?: string | null | undefined;
|
|
134
|
+
};
|
|
135
|
+
user: Record<string, any> & {
|
|
136
|
+
id: string;
|
|
137
|
+
createdAt: Date;
|
|
138
|
+
updatedAt: Date;
|
|
139
|
+
email: string;
|
|
140
|
+
emailVerified: boolean;
|
|
141
|
+
name: string;
|
|
142
|
+
image?: string | null | undefined;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
}>)[];
|
|
146
|
+
metadata: {
|
|
147
|
+
openapi: {
|
|
148
|
+
description: string;
|
|
149
|
+
responses: {
|
|
150
|
+
"200": {
|
|
151
|
+
description: string;
|
|
152
|
+
content: {
|
|
153
|
+
"application/json": {
|
|
154
|
+
schema: {
|
|
155
|
+
type: "object";
|
|
156
|
+
properties: {
|
|
157
|
+
url: {
|
|
158
|
+
type: string;
|
|
159
|
+
format: string;
|
|
160
|
+
description: string;
|
|
161
|
+
};
|
|
162
|
+
redirect: {
|
|
163
|
+
type: string;
|
|
164
|
+
description: string;
|
|
165
|
+
enum: boolean[];
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
required: string[];
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
}, {
|
|
177
|
+
url: string;
|
|
178
|
+
redirect: boolean;
|
|
179
|
+
}>;
|
|
180
|
+
};
|
|
181
|
+
options: import("better-auth/plugins").GenericOAuthOptions;
|
|
182
|
+
$ERROR_CODES: {
|
|
183
|
+
INVALID_OAUTH_CONFIGURATION: import("better-auth").RawError<"INVALID_OAUTH_CONFIGURATION">;
|
|
184
|
+
TOKEN_URL_NOT_FOUND: import("better-auth").RawError<"TOKEN_URL_NOT_FOUND">;
|
|
185
|
+
PROVIDER_CONFIG_NOT_FOUND: import("better-auth").RawError<"PROVIDER_CONFIG_NOT_FOUND">;
|
|
186
|
+
PROVIDER_ID_REQUIRED: import("better-auth").RawError<"PROVIDER_ID_REQUIRED">;
|
|
187
|
+
INVALID_OAUTH_CONFIG: import("better-auth").RawError<"INVALID_OAUTH_CONFIG">;
|
|
188
|
+
SESSION_REQUIRED: import("better-auth").RawError<"SESSION_REQUIRED">;
|
|
189
|
+
ISSUER_MISMATCH: import("better-auth").RawError<"ISSUER_MISMATCH">;
|
|
190
|
+
ISSUER_MISSING: import("better-auth").RawError<"ISSUER_MISSING">;
|
|
191
|
+
};
|
|
192
|
+
}, {
|
|
193
|
+
id: "magic-link";
|
|
194
|
+
version: string;
|
|
195
|
+
endpoints: {
|
|
196
|
+
signInMagicLink: import("better-auth").StrictEndpoint<"/sign-in/magic-link", {
|
|
197
|
+
method: "POST";
|
|
198
|
+
requireHeaders: true;
|
|
199
|
+
body: import("better-auth").ZodObject<{
|
|
200
|
+
email: import("better-auth").ZodEmail;
|
|
201
|
+
name: import("better-auth").ZodOptional<import("better-auth").ZodString>;
|
|
202
|
+
callbackURL: import("better-auth").ZodOptional<import("better-auth").ZodString>;
|
|
203
|
+
newUserCallbackURL: import("better-auth").ZodOptional<import("better-auth").ZodString>;
|
|
204
|
+
errorCallbackURL: import("better-auth").ZodOptional<import("better-auth").ZodString>;
|
|
205
|
+
metadata: import("better-auth").ZodOptional<import("better-auth").ZodRecord<import("better-auth").ZodString, import("better-auth").ZodAny>>;
|
|
206
|
+
}, import("zod/v4/core").$strip>;
|
|
207
|
+
metadata: {
|
|
208
|
+
openapi: {
|
|
209
|
+
operationId: string;
|
|
210
|
+
description: string;
|
|
211
|
+
responses: {
|
|
212
|
+
200: {
|
|
213
|
+
description: string;
|
|
214
|
+
content: {
|
|
215
|
+
"application/json": {
|
|
216
|
+
schema: {
|
|
217
|
+
type: "object";
|
|
218
|
+
properties: {
|
|
219
|
+
status: {
|
|
220
|
+
type: string;
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
}, {
|
|
231
|
+
status: boolean;
|
|
232
|
+
}>;
|
|
233
|
+
magicLinkVerify: import("better-auth").StrictEndpoint<"/magic-link/verify", {
|
|
234
|
+
method: "GET";
|
|
235
|
+
query: import("better-auth").ZodObject<{
|
|
236
|
+
token: import("better-auth").ZodString;
|
|
237
|
+
callbackURL: import("better-auth").ZodOptional<import("better-auth").ZodString>;
|
|
238
|
+
errorCallbackURL: import("better-auth").ZodOptional<import("better-auth").ZodString>;
|
|
239
|
+
newUserCallbackURL: import("better-auth").ZodOptional<import("better-auth").ZodString>;
|
|
240
|
+
}, import("zod/v4/core").$strip>;
|
|
241
|
+
use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<void>)[];
|
|
242
|
+
requireHeaders: true;
|
|
243
|
+
metadata: {
|
|
244
|
+
openapi: {
|
|
245
|
+
operationId: string;
|
|
246
|
+
description: string;
|
|
247
|
+
responses: {
|
|
248
|
+
200: {
|
|
249
|
+
description: string;
|
|
250
|
+
content: {
|
|
251
|
+
"application/json": {
|
|
252
|
+
schema: {
|
|
253
|
+
type: "object";
|
|
254
|
+
properties: {
|
|
255
|
+
session: {
|
|
256
|
+
$ref: string;
|
|
257
|
+
};
|
|
258
|
+
user: {
|
|
259
|
+
$ref: string;
|
|
260
|
+
};
|
|
261
|
+
};
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
};
|
|
268
|
+
};
|
|
269
|
+
}, {
|
|
270
|
+
token: string;
|
|
271
|
+
user: {
|
|
272
|
+
id: string;
|
|
273
|
+
createdAt: Date;
|
|
274
|
+
updatedAt: Date;
|
|
275
|
+
email: string;
|
|
276
|
+
emailVerified: boolean;
|
|
277
|
+
name: string;
|
|
278
|
+
image?: string | null | undefined;
|
|
279
|
+
};
|
|
280
|
+
session: {
|
|
281
|
+
id: string;
|
|
282
|
+
createdAt: Date;
|
|
283
|
+
updatedAt: Date;
|
|
284
|
+
userId: string;
|
|
285
|
+
expiresAt: Date;
|
|
286
|
+
token: string;
|
|
287
|
+
ipAddress?: string | null | undefined;
|
|
288
|
+
userAgent?: string | null | undefined;
|
|
289
|
+
};
|
|
290
|
+
}>;
|
|
291
|
+
};
|
|
292
|
+
rateLimit: {
|
|
293
|
+
pathMatcher(path: string): boolean;
|
|
294
|
+
window: number;
|
|
295
|
+
max: number;
|
|
296
|
+
}[];
|
|
297
|
+
options: import("better-auth/plugins").MagicLinkOptions;
|
|
298
|
+
}];
|
|
299
|
+
user: {
|
|
300
|
+
modelName: "zite_user";
|
|
301
|
+
additionalFields: {
|
|
302
|
+
firstName: {
|
|
303
|
+
type: "string";
|
|
304
|
+
required: false;
|
|
305
|
+
};
|
|
306
|
+
lastName: {
|
|
307
|
+
type: "string";
|
|
308
|
+
required: false;
|
|
309
|
+
};
|
|
310
|
+
};
|
|
311
|
+
};
|
|
312
|
+
session: {
|
|
313
|
+
modelName: "zite_session";
|
|
314
|
+
};
|
|
315
|
+
account: {
|
|
316
|
+
modelName: "zite_account";
|
|
317
|
+
};
|
|
318
|
+
verification: {
|
|
319
|
+
modelName: "zite_verification";
|
|
320
|
+
};
|
|
321
|
+
databaseHooks: {
|
|
322
|
+
user: {
|
|
323
|
+
create: {
|
|
324
|
+
before: ((user: {
|
|
325
|
+
id: string;
|
|
326
|
+
createdAt: Date;
|
|
327
|
+
updatedAt: Date;
|
|
328
|
+
email: string;
|
|
329
|
+
emailVerified: boolean;
|
|
330
|
+
name: string;
|
|
331
|
+
image?: string | null | undefined;
|
|
332
|
+
} & Record<string, unknown>) => Promise<undefined>) | undefined;
|
|
333
|
+
after: ((user: {
|
|
334
|
+
id: string;
|
|
335
|
+
createdAt: Date;
|
|
336
|
+
updatedAt: Date;
|
|
337
|
+
email: string;
|
|
338
|
+
emailVerified: boolean;
|
|
339
|
+
name: string;
|
|
340
|
+
image?: string | null | undefined;
|
|
341
|
+
} & Record<string, unknown>) => Promise<void>) | undefined;
|
|
342
|
+
};
|
|
343
|
+
};
|
|
344
|
+
};
|
|
345
|
+
}>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { betterAuth } from 'better-auth';
|
|
2
|
+
import { genericOAuth, magicLink } from 'better-auth/plugins';
|
|
3
|
+
export function ziteAuth(config = {}) {
|
|
4
|
+
const sendMagicLinkEmail = config.sendEmail
|
|
5
|
+
? async ({ email, url }) => {
|
|
6
|
+
await config.sendEmail(email, 'Sign in to your app', `Click here to sign in: ${url}`);
|
|
7
|
+
}
|
|
8
|
+
: async ({ email, url }) => {
|
|
9
|
+
console.log(`[ziteAuth] Magic link for ${email}: ${url}`);
|
|
10
|
+
};
|
|
11
|
+
return betterAuth({
|
|
12
|
+
database: { url: process.env.DATABASE_URL },
|
|
13
|
+
secret: process.env.ZITE_AUTH_SECRET || 'zite-local-dev-secret',
|
|
14
|
+
baseURL: 'http://localhost',
|
|
15
|
+
advanced: { disableCSRFCheck: true },
|
|
16
|
+
rateLimit: { window: 60, max: 10 },
|
|
17
|
+
emailAndPassword: { enabled: true },
|
|
18
|
+
plugins: [
|
|
19
|
+
genericOAuth({
|
|
20
|
+
config: [
|
|
21
|
+
{
|
|
22
|
+
providerId: 'zite',
|
|
23
|
+
clientId: process.env.ZITE_OAUTH_CLIENT_ID,
|
|
24
|
+
clientSecret: process.env.ZITE_OAUTH_CLIENT_SECRET,
|
|
25
|
+
discoveryUrl: process.env.ZITE_AUTH_URL +
|
|
26
|
+
'/.well-known/openid-configuration',
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
}),
|
|
30
|
+
magicLink({ sendMagicLink: sendMagicLinkEmail }),
|
|
31
|
+
],
|
|
32
|
+
user: {
|
|
33
|
+
modelName: 'zite_user',
|
|
34
|
+
additionalFields: {
|
|
35
|
+
firstName: { type: 'string', required: false },
|
|
36
|
+
lastName: { type: 'string', required: false },
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
session: { modelName: 'zite_session' },
|
|
40
|
+
account: { modelName: 'zite_account' },
|
|
41
|
+
verification: { modelName: 'zite_verification' },
|
|
42
|
+
databaseHooks: {
|
|
43
|
+
user: {
|
|
44
|
+
create: {
|
|
45
|
+
before: config.beforeSignup
|
|
46
|
+
? async (user) => {
|
|
47
|
+
const allowed = await config.beforeSignup(user.email);
|
|
48
|
+
if (!allowed) {
|
|
49
|
+
throw new Error('Signup not allowed for this email');
|
|
50
|
+
}
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
: undefined,
|
|
54
|
+
after: config.onSignup
|
|
55
|
+
? async (user) => {
|
|
56
|
+
await config.onSignup({
|
|
57
|
+
id: user.id,
|
|
58
|
+
email: user.email,
|
|
59
|
+
name: user.name,
|
|
60
|
+
firstName: user.firstName,
|
|
61
|
+
lastName: user.lastName,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
: undefined,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
}
|
package/dist/esm/caller/index.js
CHANGED
|
@@ -19,10 +19,17 @@ const ENVIRONMENTS = {
|
|
|
19
19
|
local: "http://localhost:2506",
|
|
20
20
|
};
|
|
21
21
|
function getRunnerUrl() {
|
|
22
|
+
const explicit = getEnv("ZITE_RUNNER_URL", "VITE_ZITE_RUNNER_URL");
|
|
23
|
+
if (explicit)
|
|
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")
|
|
29
|
+
return "";
|
|
30
|
+
// Preview/editor mode: call the workflow-runner directly
|
|
22
31
|
const env = getEnv("ZITE_ENV", "VITE_ZITE_ENV") ?? "production";
|
|
23
|
-
return
|
|
24
|
-
ENVIRONMENTS[env] ??
|
|
25
|
-
ENVIRONMENTS.production);
|
|
32
|
+
return ENVIRONMENTS[env] ?? ENVIRONMENTS.production;
|
|
26
33
|
}
|
|
27
34
|
/**
|
|
28
35
|
* Get the user's usage token for endpoint auth.
|
|
@@ -45,12 +52,18 @@ function getUsageToken() {
|
|
|
45
52
|
}
|
|
46
53
|
function buildFetchOptions(name, input, extra) {
|
|
47
54
|
const appId = getEnv("ZITE_FLOW_ID", "VITE_ZITE_FLOW_ID") ?? "";
|
|
55
|
+
const runnerUrl = getRunnerUrl();
|
|
48
56
|
const token = getUsageToken();
|
|
49
57
|
const ziteAuthToken = typeof localStorage !== "undefined"
|
|
50
58
|
? localStorage.getItem("zite.auth.token")
|
|
51
59
|
: null;
|
|
60
|
+
// Same-origin mode (published apps): /api/{name}
|
|
61
|
+
// Direct mode (preview): {runnerUrl}/public/{appId}/api/{name}
|
|
62
|
+
const url = runnerUrl === ""
|
|
63
|
+
? "/api/" + name
|
|
64
|
+
: runnerUrl + "/public/" + appId + "/api/" + name;
|
|
52
65
|
return {
|
|
53
|
-
url
|
|
66
|
+
url,
|
|
54
67
|
init: {
|
|
55
68
|
method: "POST",
|
|
56
69
|
headers: {
|
package/dist/esm/cli.js
CHANGED
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createTableClient } from '../runtime/index.js';
|
package/dist/esm/sync/lib.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export declare function toCamelCase(name: string): string;
|
|
|
21
21
|
*
|
|
22
22
|
* If `existingSchema` is provided, locked SDK names are preserved for
|
|
23
23
|
* tables/fields that already exist (matched by ID). New tables/fields
|
|
24
|
-
* get fresh camelCase SDK names. This is how `zitejs
|
|
24
|
+
* get fresh camelCase SDK names. This is how `zitejs generate` preserves
|
|
25
25
|
* name stability across schema changes.
|
|
26
26
|
*/
|
|
27
27
|
export declare function generateSchema(database: Database, existingSchema?: ZiteSchema): ZiteSchema;
|
package/dist/esm/sync/lib.js
CHANGED
|
@@ -176,7 +176,7 @@ function fieldJsdoc(schemaField, table) {
|
|
|
176
176
|
*
|
|
177
177
|
* If `existingSchema` is provided, locked SDK names are preserved for
|
|
178
178
|
* tables/fields that already exist (matched by ID). New tables/fields
|
|
179
|
-
* get fresh camelCase SDK names. This is how `zitejs
|
|
179
|
+
* get fresh camelCase SDK names. This is how `zitejs generate` preserves
|
|
180
180
|
* name stability across schema changes.
|
|
181
181
|
*/
|
|
182
182
|
export function generateSchema(database, existingSchema) {
|
|
@@ -405,7 +405,7 @@ export function generateApiTs(endpointFiles) {
|
|
|
405
405
|
}
|
|
406
406
|
const hasStreaming = endpoints.some((e) => e.stream);
|
|
407
407
|
const lines = [
|
|
408
|
-
"// Auto-generated by zitejs
|
|
408
|
+
"// Auto-generated by zitejs generate. Do not edit manually.",
|
|
409
409
|
"",
|
|
410
410
|
hasStreaming
|
|
411
411
|
? "import { createCaller, createStreamingCaller } from 'zitejs/caller';"
|
|
@@ -448,7 +448,7 @@ function tsTypeForField(field) {
|
|
|
448
448
|
}
|
|
449
449
|
export function generateUserTs(usersTableFields) {
|
|
450
450
|
const lines = [
|
|
451
|
-
"// Auto-generated by zitejs
|
|
451
|
+
"// Auto-generated by zitejs generate. Do not edit manually.",
|
|
452
452
|
"",
|
|
453
453
|
];
|
|
454
454
|
if (usersTableFields && usersTableFields.length > 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zitejs",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.75",
|
|
4
4
|
"description": "The Zite framework — build apps on Zite Database",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -47,6 +47,12 @@
|
|
|
47
47
|
"import": "./dist/esm/auth/index.js",
|
|
48
48
|
"require": "./dist/cjs/auth/index.js"
|
|
49
49
|
},
|
|
50
|
+
"./auth-server": {
|
|
51
|
+
"types": "./dist/esm/auth-server/index.d.ts",
|
|
52
|
+
"import": "./dist/esm/auth-server/index.js",
|
|
53
|
+
"require": "./dist/cjs/auth-server/index.js",
|
|
54
|
+
"default": "./dist/esm/auth-server/index.js"
|
|
55
|
+
},
|
|
50
56
|
"./upload": {
|
|
51
57
|
"types": "./dist/esm/upload/index.d.ts",
|
|
52
58
|
"import": "./dist/esm/upload/index.js",
|
|
@@ -105,6 +111,9 @@
|
|
|
105
111
|
"caller": [
|
|
106
112
|
"dist/esm/caller/index.d.ts"
|
|
107
113
|
],
|
|
114
|
+
"auth-server": [
|
|
115
|
+
"dist/esm/auth-server/index.d.ts"
|
|
116
|
+
],
|
|
108
117
|
"backend": [
|
|
109
118
|
"dist/esm/backend/index.d.ts"
|
|
110
119
|
],
|
|
@@ -175,6 +184,7 @@
|
|
|
175
184
|
},
|
|
176
185
|
"dependencies": {
|
|
177
186
|
"@babel/parser": "^7.29.7",
|
|
187
|
+
"better-auth": "1.6.23",
|
|
178
188
|
"dotenv": "^17.4.2",
|
|
179
189
|
"esbuild": "^0.28.0",
|
|
180
190
|
"estree-walker": "^3.0.3",
|