@axium/server 0.8.0 → 0.9.0
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/auth.d.ts +0 -10
- package/dist/auth.js +8 -16
- package/dist/cli.js +145 -38
- package/dist/config.d.ts +39 -474
- package/dist/config.js +53 -43
- package/dist/database.d.ts +3 -3
- package/dist/database.js +53 -24
- package/dist/plugins.d.ts +1 -0
- package/dist/plugins.js +1 -0
- package/package.json +10 -7
- package/web/api/metadata.ts +3 -3
- package/web/api/passkeys.ts +3 -3
- package/web/api/register.ts +4 -4
- package/web/api/session.ts +2 -2
- package/web/api/users.ts +29 -18
- package/web/api/utils.ts +2 -2
- package/web/hooks.server.ts +8 -2
- package/web/lib/ClipboardCopy.svelte +42 -0
- package/web/lib/FormDialog.svelte +9 -1
- package/web/lib/auth.ts +2 -2
- package/web/lib/icons/Icon.svelte +2 -6
- package/web/lib/styles.css +7 -1
- package/web/routes/[...path]/+page.server.ts +1 -1
- package/web/routes/[appId]/[...page]/+page.server.ts +1 -1
- package/web/routes/account/+page.svelte +115 -48
- package/web/routes/api/[...path]/+server.ts +2 -2
package/dist/config.d.ts
CHANGED
|
@@ -1,262 +1,43 @@
|
|
|
1
|
+
import { levelText } from 'logzen';
|
|
1
2
|
import { type PartialRecursive } from 'utilium';
|
|
2
|
-
import * as z from 'zod';
|
|
3
|
-
export
|
|
4
|
-
api:
|
|
5
|
-
disable_metadata: z.ZodBoolean;
|
|
6
|
-
cookie_auth: z.ZodBoolean;
|
|
7
|
-
}, "strip", z.ZodTypeAny, {
|
|
3
|
+
import * as z from 'zod/v4';
|
|
4
|
+
export interface Config extends Record<string, unknown> {
|
|
5
|
+
api: {
|
|
8
6
|
disable_metadata: boolean;
|
|
9
7
|
cookie_auth: boolean;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
cookie_auth: boolean;
|
|
13
|
-
}>;
|
|
14
|
-
apps: z.ZodObject<{
|
|
15
|
-
disabled: z.ZodArray<z.ZodString, "many">;
|
|
16
|
-
}, "strip", z.ZodTypeAny, {
|
|
17
|
-
disabled: string[];
|
|
18
|
-
}, {
|
|
8
|
+
};
|
|
9
|
+
apps: {
|
|
19
10
|
disabled: string[];
|
|
20
|
-
}
|
|
21
|
-
auth:
|
|
22
|
-
credentials: z.ZodBoolean;
|
|
23
|
-
debug: z.ZodBoolean;
|
|
24
|
-
origin: z.ZodString;
|
|
25
|
-
/** In minutes */
|
|
26
|
-
passkey_probation: z.ZodNumber;
|
|
27
|
-
rp_id: z.ZodString;
|
|
28
|
-
rp_name: z.ZodString;
|
|
29
|
-
secure_cookies: z.ZodBoolean;
|
|
30
|
-
/** In minutes */
|
|
31
|
-
verification_timeout: z.ZodNumber;
|
|
32
|
-
}, "strip", z.ZodTypeAny, {
|
|
33
|
-
origin: string;
|
|
34
|
-
debug: boolean;
|
|
11
|
+
};
|
|
12
|
+
auth: {
|
|
35
13
|
credentials: boolean;
|
|
36
|
-
passkey_probation: number;
|
|
37
|
-
rp_id: string;
|
|
38
|
-
rp_name: string;
|
|
39
|
-
secure_cookies: boolean;
|
|
40
|
-
verification_timeout: number;
|
|
41
|
-
}, {
|
|
42
|
-
origin: string;
|
|
43
14
|
debug: boolean;
|
|
44
|
-
credentials: boolean;
|
|
45
|
-
passkey_probation: number;
|
|
46
|
-
rp_id: string;
|
|
47
|
-
rp_name: string;
|
|
48
|
-
secure_cookies: boolean;
|
|
49
|
-
verification_timeout: number;
|
|
50
|
-
}>;
|
|
51
|
-
db: z.ZodObject<{
|
|
52
|
-
host: z.ZodString;
|
|
53
|
-
port: z.ZodNumber;
|
|
54
|
-
password: z.ZodString;
|
|
55
|
-
user: z.ZodString;
|
|
56
|
-
database: z.ZodString;
|
|
57
|
-
}, "strip", z.ZodTypeAny, {
|
|
58
|
-
port: number;
|
|
59
|
-
host: string;
|
|
60
|
-
user: string;
|
|
61
|
-
password: string;
|
|
62
|
-
database: string;
|
|
63
|
-
}, {
|
|
64
|
-
port: number;
|
|
65
|
-
host: string;
|
|
66
|
-
user: string;
|
|
67
|
-
password: string;
|
|
68
|
-
database: string;
|
|
69
|
-
}>;
|
|
70
|
-
debug: z.ZodBoolean;
|
|
71
|
-
log: z.ZodObject<{
|
|
72
|
-
level: z.ZodEnum<["error", "warn", "notice", "info", "debug"]>;
|
|
73
|
-
console: z.ZodBoolean;
|
|
74
|
-
}, "strip", z.ZodTypeAny, {
|
|
75
|
-
console: boolean;
|
|
76
|
-
level: "error" | "warn" | "info" | "debug" | "notice";
|
|
77
|
-
}, {
|
|
78
|
-
console: boolean;
|
|
79
|
-
level: "error" | "warn" | "info" | "debug" | "notice";
|
|
80
|
-
}>;
|
|
81
|
-
web: z.ZodObject<{
|
|
82
|
-
prefix: z.ZodString;
|
|
83
|
-
}, "strip", z.ZodTypeAny, {
|
|
84
|
-
prefix: string;
|
|
85
|
-
}, {
|
|
86
|
-
prefix: string;
|
|
87
|
-
}>;
|
|
88
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
89
|
-
api: z.ZodObject<{
|
|
90
|
-
disable_metadata: z.ZodBoolean;
|
|
91
|
-
cookie_auth: z.ZodBoolean;
|
|
92
|
-
}, "strip", z.ZodTypeAny, {
|
|
93
|
-
disable_metadata: boolean;
|
|
94
|
-
cookie_auth: boolean;
|
|
95
|
-
}, {
|
|
96
|
-
disable_metadata: boolean;
|
|
97
|
-
cookie_auth: boolean;
|
|
98
|
-
}>;
|
|
99
|
-
apps: z.ZodObject<{
|
|
100
|
-
disabled: z.ZodArray<z.ZodString, "many">;
|
|
101
|
-
}, "strip", z.ZodTypeAny, {
|
|
102
|
-
disabled: string[];
|
|
103
|
-
}, {
|
|
104
|
-
disabled: string[];
|
|
105
|
-
}>;
|
|
106
|
-
auth: z.ZodObject<{
|
|
107
|
-
credentials: z.ZodBoolean;
|
|
108
|
-
debug: z.ZodBoolean;
|
|
109
|
-
origin: z.ZodString;
|
|
110
|
-
/** In minutes */
|
|
111
|
-
passkey_probation: z.ZodNumber;
|
|
112
|
-
rp_id: z.ZodString;
|
|
113
|
-
rp_name: z.ZodString;
|
|
114
|
-
secure_cookies: z.ZodBoolean;
|
|
115
|
-
/** In minutes */
|
|
116
|
-
verification_timeout: z.ZodNumber;
|
|
117
|
-
}, "strip", z.ZodTypeAny, {
|
|
118
|
-
origin: string;
|
|
119
|
-
debug: boolean;
|
|
120
|
-
credentials: boolean;
|
|
121
|
-
passkey_probation: number;
|
|
122
|
-
rp_id: string;
|
|
123
|
-
rp_name: string;
|
|
124
|
-
secure_cookies: boolean;
|
|
125
|
-
verification_timeout: number;
|
|
126
|
-
}, {
|
|
127
15
|
origin: string;
|
|
128
|
-
debug: boolean;
|
|
129
|
-
credentials: boolean;
|
|
130
|
-
passkey_probation: number;
|
|
131
|
-
rp_id: string;
|
|
132
|
-
rp_name: string;
|
|
133
|
-
secure_cookies: boolean;
|
|
134
|
-
verification_timeout: number;
|
|
135
|
-
}>;
|
|
136
|
-
db: z.ZodObject<{
|
|
137
|
-
host: z.ZodString;
|
|
138
|
-
port: z.ZodNumber;
|
|
139
|
-
password: z.ZodString;
|
|
140
|
-
user: z.ZodString;
|
|
141
|
-
database: z.ZodString;
|
|
142
|
-
}, "strip", z.ZodTypeAny, {
|
|
143
|
-
port: number;
|
|
144
|
-
host: string;
|
|
145
|
-
user: string;
|
|
146
|
-
password: string;
|
|
147
|
-
database: string;
|
|
148
|
-
}, {
|
|
149
|
-
port: number;
|
|
150
|
-
host: string;
|
|
151
|
-
user: string;
|
|
152
|
-
password: string;
|
|
153
|
-
database: string;
|
|
154
|
-
}>;
|
|
155
|
-
debug: z.ZodBoolean;
|
|
156
|
-
log: z.ZodObject<{
|
|
157
|
-
level: z.ZodEnum<["error", "warn", "notice", "info", "debug"]>;
|
|
158
|
-
console: z.ZodBoolean;
|
|
159
|
-
}, "strip", z.ZodTypeAny, {
|
|
160
|
-
console: boolean;
|
|
161
|
-
level: "error" | "warn" | "info" | "debug" | "notice";
|
|
162
|
-
}, {
|
|
163
|
-
console: boolean;
|
|
164
|
-
level: "error" | "warn" | "info" | "debug" | "notice";
|
|
165
|
-
}>;
|
|
166
|
-
web: z.ZodObject<{
|
|
167
|
-
prefix: z.ZodString;
|
|
168
|
-
}, "strip", z.ZodTypeAny, {
|
|
169
|
-
prefix: string;
|
|
170
|
-
}, {
|
|
171
|
-
prefix: string;
|
|
172
|
-
}>;
|
|
173
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
174
|
-
api: z.ZodObject<{
|
|
175
|
-
disable_metadata: z.ZodBoolean;
|
|
176
|
-
cookie_auth: z.ZodBoolean;
|
|
177
|
-
}, "strip", z.ZodTypeAny, {
|
|
178
|
-
disable_metadata: boolean;
|
|
179
|
-
cookie_auth: boolean;
|
|
180
|
-
}, {
|
|
181
|
-
disable_metadata: boolean;
|
|
182
|
-
cookie_auth: boolean;
|
|
183
|
-
}>;
|
|
184
|
-
apps: z.ZodObject<{
|
|
185
|
-
disabled: z.ZodArray<z.ZodString, "many">;
|
|
186
|
-
}, "strip", z.ZodTypeAny, {
|
|
187
|
-
disabled: string[];
|
|
188
|
-
}, {
|
|
189
|
-
disabled: string[];
|
|
190
|
-
}>;
|
|
191
|
-
auth: z.ZodObject<{
|
|
192
|
-
credentials: z.ZodBoolean;
|
|
193
|
-
debug: z.ZodBoolean;
|
|
194
|
-
origin: z.ZodString;
|
|
195
16
|
/** In minutes */
|
|
196
|
-
passkey_probation: z.ZodNumber;
|
|
197
|
-
rp_id: z.ZodString;
|
|
198
|
-
rp_name: z.ZodString;
|
|
199
|
-
secure_cookies: z.ZodBoolean;
|
|
200
|
-
/** In minutes */
|
|
201
|
-
verification_timeout: z.ZodNumber;
|
|
202
|
-
}, "strip", z.ZodTypeAny, {
|
|
203
|
-
origin: string;
|
|
204
|
-
debug: boolean;
|
|
205
|
-
credentials: boolean;
|
|
206
|
-
passkey_probation: number;
|
|
207
|
-
rp_id: string;
|
|
208
|
-
rp_name: string;
|
|
209
|
-
secure_cookies: boolean;
|
|
210
|
-
verification_timeout: number;
|
|
211
|
-
}, {
|
|
212
|
-
origin: string;
|
|
213
|
-
debug: boolean;
|
|
214
|
-
credentials: boolean;
|
|
215
17
|
passkey_probation: number;
|
|
216
18
|
rp_id: string;
|
|
217
19
|
rp_name: string;
|
|
218
20
|
secure_cookies: boolean;
|
|
21
|
+
/** In minutes */
|
|
219
22
|
verification_timeout: number;
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
password: z.ZodString;
|
|
225
|
-
user: z.ZodString;
|
|
226
|
-
database: z.ZodString;
|
|
227
|
-
}, "strip", z.ZodTypeAny, {
|
|
228
|
-
port: number;
|
|
23
|
+
/** Whether users can verify emails */
|
|
24
|
+
email_verification: boolean;
|
|
25
|
+
};
|
|
26
|
+
db: {
|
|
229
27
|
host: string;
|
|
230
|
-
user: string;
|
|
231
|
-
password: string;
|
|
232
|
-
database: string;
|
|
233
|
-
}, {
|
|
234
28
|
port: number;
|
|
235
|
-
host: string;
|
|
236
|
-
user: string;
|
|
237
29
|
password: string;
|
|
30
|
+
user: string;
|
|
238
31
|
database: string;
|
|
239
|
-
}
|
|
240
|
-
debug:
|
|
241
|
-
log:
|
|
242
|
-
level:
|
|
243
|
-
console: z.ZodBoolean;
|
|
244
|
-
}, "strip", z.ZodTypeAny, {
|
|
245
|
-
console: boolean;
|
|
246
|
-
level: "error" | "warn" | "info" | "debug" | "notice";
|
|
247
|
-
}, {
|
|
32
|
+
};
|
|
33
|
+
debug: boolean;
|
|
34
|
+
log: {
|
|
35
|
+
level: (typeof levelText)[number];
|
|
248
36
|
console: boolean;
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
web: z.ZodObject<{
|
|
252
|
-
prefix: z.ZodString;
|
|
253
|
-
}, "strip", z.ZodTypeAny, {
|
|
37
|
+
};
|
|
38
|
+
web: {
|
|
254
39
|
prefix: string;
|
|
255
|
-
}
|
|
256
|
-
prefix: string;
|
|
257
|
-
}>;
|
|
258
|
-
}, z.ZodTypeAny, "passthrough">>;
|
|
259
|
-
export interface Config extends Record<string, unknown>, z.infer<typeof Schema> {
|
|
40
|
+
};
|
|
260
41
|
}
|
|
261
42
|
export declare const configFiles: Map<string, PartialRecursive<Config>>;
|
|
262
43
|
export declare function plainConfig(): Omit<Config, keyof typeof configShortcuts>;
|
|
@@ -276,192 +57,10 @@ export declare const File: z.ZodObject<{
|
|
|
276
57
|
api: z.ZodOptional<z.ZodObject<{
|
|
277
58
|
disable_metadata: z.ZodOptional<z.ZodBoolean>;
|
|
278
59
|
cookie_auth: z.ZodOptional<z.ZodBoolean>;
|
|
279
|
-
},
|
|
280
|
-
disable_metadata?: boolean | undefined;
|
|
281
|
-
cookie_auth?: boolean | undefined;
|
|
282
|
-
}, {
|
|
283
|
-
disable_metadata?: boolean | undefined;
|
|
284
|
-
cookie_auth?: boolean | undefined;
|
|
285
|
-
}>>;
|
|
286
|
-
apps: z.ZodOptional<z.ZodObject<{
|
|
287
|
-
disabled: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
288
|
-
}, "strip", z.ZodTypeAny, {
|
|
289
|
-
disabled?: string[] | undefined;
|
|
290
|
-
}, {
|
|
291
|
-
disabled?: string[] | undefined;
|
|
292
|
-
}>>;
|
|
293
|
-
auth: z.ZodOptional<z.ZodObject<{
|
|
294
|
-
credentials: z.ZodOptional<z.ZodBoolean>;
|
|
295
|
-
debug: z.ZodOptional<z.ZodBoolean>;
|
|
296
|
-
origin: z.ZodOptional<z.ZodString>;
|
|
297
|
-
passkey_probation: z.ZodOptional<z.ZodNumber>;
|
|
298
|
-
rp_id: z.ZodOptional<z.ZodString>;
|
|
299
|
-
rp_name: z.ZodOptional<z.ZodString>;
|
|
300
|
-
secure_cookies: z.ZodOptional<z.ZodBoolean>;
|
|
301
|
-
verification_timeout: z.ZodOptional<z.ZodNumber>;
|
|
302
|
-
}, "strip", z.ZodTypeAny, {
|
|
303
|
-
origin?: string | undefined;
|
|
304
|
-
debug?: boolean | undefined;
|
|
305
|
-
credentials?: boolean | undefined;
|
|
306
|
-
passkey_probation?: number | undefined;
|
|
307
|
-
rp_id?: string | undefined;
|
|
308
|
-
rp_name?: string | undefined;
|
|
309
|
-
secure_cookies?: boolean | undefined;
|
|
310
|
-
verification_timeout?: number | undefined;
|
|
311
|
-
}, {
|
|
312
|
-
origin?: string | undefined;
|
|
313
|
-
debug?: boolean | undefined;
|
|
314
|
-
credentials?: boolean | undefined;
|
|
315
|
-
passkey_probation?: number | undefined;
|
|
316
|
-
rp_id?: string | undefined;
|
|
317
|
-
rp_name?: string | undefined;
|
|
318
|
-
secure_cookies?: boolean | undefined;
|
|
319
|
-
verification_timeout?: number | undefined;
|
|
320
|
-
}>>;
|
|
321
|
-
db: z.ZodOptional<z.ZodObject<{
|
|
322
|
-
host: z.ZodOptional<z.ZodString>;
|
|
323
|
-
port: z.ZodOptional<z.ZodNumber>;
|
|
324
|
-
password: z.ZodOptional<z.ZodString>;
|
|
325
|
-
user: z.ZodOptional<z.ZodString>;
|
|
326
|
-
database: z.ZodOptional<z.ZodString>;
|
|
327
|
-
}, "strip", z.ZodTypeAny, {
|
|
328
|
-
port?: number | undefined;
|
|
329
|
-
host?: string | undefined;
|
|
330
|
-
user?: string | undefined;
|
|
331
|
-
password?: string | undefined;
|
|
332
|
-
database?: string | undefined;
|
|
333
|
-
}, {
|
|
334
|
-
port?: number | undefined;
|
|
335
|
-
host?: string | undefined;
|
|
336
|
-
user?: string | undefined;
|
|
337
|
-
password?: string | undefined;
|
|
338
|
-
database?: string | undefined;
|
|
339
|
-
}>>;
|
|
340
|
-
debug: z.ZodOptional<z.ZodBoolean>;
|
|
341
|
-
log: z.ZodOptional<z.ZodObject<{
|
|
342
|
-
level: z.ZodOptional<z.ZodEnum<["error", "warn", "notice", "info", "debug"]>>;
|
|
343
|
-
console: z.ZodOptional<z.ZodBoolean>;
|
|
344
|
-
}, "strip", z.ZodTypeAny, {
|
|
345
|
-
console?: boolean | undefined;
|
|
346
|
-
level?: "error" | "warn" | "info" | "debug" | "notice" | undefined;
|
|
347
|
-
}, {
|
|
348
|
-
console?: boolean | undefined;
|
|
349
|
-
level?: "error" | "warn" | "info" | "debug" | "notice" | undefined;
|
|
350
|
-
}>>;
|
|
351
|
-
web: z.ZodOptional<z.ZodObject<{
|
|
352
|
-
prefix: z.ZodOptional<z.ZodString>;
|
|
353
|
-
}, "strip", z.ZodTypeAny, {
|
|
354
|
-
prefix?: string | undefined;
|
|
355
|
-
}, {
|
|
356
|
-
prefix?: string | undefined;
|
|
357
|
-
}>>;
|
|
358
|
-
} & {
|
|
359
|
-
include: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
360
|
-
plugins: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
361
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
362
|
-
api: z.ZodOptional<z.ZodObject<{
|
|
363
|
-
disable_metadata: z.ZodOptional<z.ZodBoolean>;
|
|
364
|
-
cookie_auth: z.ZodOptional<z.ZodBoolean>;
|
|
365
|
-
}, "strip", z.ZodTypeAny, {
|
|
366
|
-
disable_metadata?: boolean | undefined;
|
|
367
|
-
cookie_auth?: boolean | undefined;
|
|
368
|
-
}, {
|
|
369
|
-
disable_metadata?: boolean | undefined;
|
|
370
|
-
cookie_auth?: boolean | undefined;
|
|
371
|
-
}>>;
|
|
372
|
-
apps: z.ZodOptional<z.ZodObject<{
|
|
373
|
-
disabled: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
374
|
-
}, "strip", z.ZodTypeAny, {
|
|
375
|
-
disabled?: string[] | undefined;
|
|
376
|
-
}, {
|
|
377
|
-
disabled?: string[] | undefined;
|
|
378
|
-
}>>;
|
|
379
|
-
auth: z.ZodOptional<z.ZodObject<{
|
|
380
|
-
credentials: z.ZodOptional<z.ZodBoolean>;
|
|
381
|
-
debug: z.ZodOptional<z.ZodBoolean>;
|
|
382
|
-
origin: z.ZodOptional<z.ZodString>;
|
|
383
|
-
passkey_probation: z.ZodOptional<z.ZodNumber>;
|
|
384
|
-
rp_id: z.ZodOptional<z.ZodString>;
|
|
385
|
-
rp_name: z.ZodOptional<z.ZodString>;
|
|
386
|
-
secure_cookies: z.ZodOptional<z.ZodBoolean>;
|
|
387
|
-
verification_timeout: z.ZodOptional<z.ZodNumber>;
|
|
388
|
-
}, "strip", z.ZodTypeAny, {
|
|
389
|
-
origin?: string | undefined;
|
|
390
|
-
debug?: boolean | undefined;
|
|
391
|
-
credentials?: boolean | undefined;
|
|
392
|
-
passkey_probation?: number | undefined;
|
|
393
|
-
rp_id?: string | undefined;
|
|
394
|
-
rp_name?: string | undefined;
|
|
395
|
-
secure_cookies?: boolean | undefined;
|
|
396
|
-
verification_timeout?: number | undefined;
|
|
397
|
-
}, {
|
|
398
|
-
origin?: string | undefined;
|
|
399
|
-
debug?: boolean | undefined;
|
|
400
|
-
credentials?: boolean | undefined;
|
|
401
|
-
passkey_probation?: number | undefined;
|
|
402
|
-
rp_id?: string | undefined;
|
|
403
|
-
rp_name?: string | undefined;
|
|
404
|
-
secure_cookies?: boolean | undefined;
|
|
405
|
-
verification_timeout?: number | undefined;
|
|
406
|
-
}>>;
|
|
407
|
-
db: z.ZodOptional<z.ZodObject<{
|
|
408
|
-
host: z.ZodOptional<z.ZodString>;
|
|
409
|
-
port: z.ZodOptional<z.ZodNumber>;
|
|
410
|
-
password: z.ZodOptional<z.ZodString>;
|
|
411
|
-
user: z.ZodOptional<z.ZodString>;
|
|
412
|
-
database: z.ZodOptional<z.ZodString>;
|
|
413
|
-
}, "strip", z.ZodTypeAny, {
|
|
414
|
-
port?: number | undefined;
|
|
415
|
-
host?: string | undefined;
|
|
416
|
-
user?: string | undefined;
|
|
417
|
-
password?: string | undefined;
|
|
418
|
-
database?: string | undefined;
|
|
419
|
-
}, {
|
|
420
|
-
port?: number | undefined;
|
|
421
|
-
host?: string | undefined;
|
|
422
|
-
user?: string | undefined;
|
|
423
|
-
password?: string | undefined;
|
|
424
|
-
database?: string | undefined;
|
|
425
|
-
}>>;
|
|
426
|
-
debug: z.ZodOptional<z.ZodBoolean>;
|
|
427
|
-
log: z.ZodOptional<z.ZodObject<{
|
|
428
|
-
level: z.ZodOptional<z.ZodEnum<["error", "warn", "notice", "info", "debug"]>>;
|
|
429
|
-
console: z.ZodOptional<z.ZodBoolean>;
|
|
430
|
-
}, "strip", z.ZodTypeAny, {
|
|
431
|
-
console?: boolean | undefined;
|
|
432
|
-
level?: "error" | "warn" | "info" | "debug" | "notice" | undefined;
|
|
433
|
-
}, {
|
|
434
|
-
console?: boolean | undefined;
|
|
435
|
-
level?: "error" | "warn" | "info" | "debug" | "notice" | undefined;
|
|
436
|
-
}>>;
|
|
437
|
-
web: z.ZodOptional<z.ZodObject<{
|
|
438
|
-
prefix: z.ZodOptional<z.ZodString>;
|
|
439
|
-
}, "strip", z.ZodTypeAny, {
|
|
440
|
-
prefix?: string | undefined;
|
|
441
|
-
}, {
|
|
442
|
-
prefix?: string | undefined;
|
|
443
|
-
}>>;
|
|
444
|
-
} & {
|
|
445
|
-
include: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
446
|
-
plugins: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
447
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
448
|
-
api: z.ZodOptional<z.ZodObject<{
|
|
449
|
-
disable_metadata: z.ZodOptional<z.ZodBoolean>;
|
|
450
|
-
cookie_auth: z.ZodOptional<z.ZodBoolean>;
|
|
451
|
-
}, "strip", z.ZodTypeAny, {
|
|
452
|
-
disable_metadata?: boolean | undefined;
|
|
453
|
-
cookie_auth?: boolean | undefined;
|
|
454
|
-
}, {
|
|
455
|
-
disable_metadata?: boolean | undefined;
|
|
456
|
-
cookie_auth?: boolean | undefined;
|
|
457
|
-
}>>;
|
|
60
|
+
}, z.core.$strip>>;
|
|
458
61
|
apps: z.ZodOptional<z.ZodObject<{
|
|
459
|
-
disabled: z.ZodOptional<z.ZodArray<z.ZodString
|
|
460
|
-
},
|
|
461
|
-
disabled?: string[] | undefined;
|
|
462
|
-
}, {
|
|
463
|
-
disabled?: string[] | undefined;
|
|
464
|
-
}>>;
|
|
62
|
+
disabled: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
63
|
+
}, z.core.$strip>>;
|
|
465
64
|
auth: z.ZodOptional<z.ZodObject<{
|
|
466
65
|
credentials: z.ZodOptional<z.ZodBoolean>;
|
|
467
66
|
debug: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -471,66 +70,32 @@ export declare const File: z.ZodObject<{
|
|
|
471
70
|
rp_name: z.ZodOptional<z.ZodString>;
|
|
472
71
|
secure_cookies: z.ZodOptional<z.ZodBoolean>;
|
|
473
72
|
verification_timeout: z.ZodOptional<z.ZodNumber>;
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
debug?: boolean | undefined;
|
|
477
|
-
credentials?: boolean | undefined;
|
|
478
|
-
passkey_probation?: number | undefined;
|
|
479
|
-
rp_id?: string | undefined;
|
|
480
|
-
rp_name?: string | undefined;
|
|
481
|
-
secure_cookies?: boolean | undefined;
|
|
482
|
-
verification_timeout?: number | undefined;
|
|
483
|
-
}, {
|
|
484
|
-
origin?: string | undefined;
|
|
485
|
-
debug?: boolean | undefined;
|
|
486
|
-
credentials?: boolean | undefined;
|
|
487
|
-
passkey_probation?: number | undefined;
|
|
488
|
-
rp_id?: string | undefined;
|
|
489
|
-
rp_name?: string | undefined;
|
|
490
|
-
secure_cookies?: boolean | undefined;
|
|
491
|
-
verification_timeout?: number | undefined;
|
|
492
|
-
}>>;
|
|
73
|
+
email_verification: z.ZodOptional<z.ZodBoolean>;
|
|
74
|
+
}, z.core.$strip>>;
|
|
493
75
|
db: z.ZodOptional<z.ZodObject<{
|
|
494
76
|
host: z.ZodOptional<z.ZodString>;
|
|
495
77
|
port: z.ZodOptional<z.ZodNumber>;
|
|
496
78
|
password: z.ZodOptional<z.ZodString>;
|
|
497
79
|
user: z.ZodOptional<z.ZodString>;
|
|
498
80
|
database: z.ZodOptional<z.ZodString>;
|
|
499
|
-
},
|
|
500
|
-
port?: number | undefined;
|
|
501
|
-
host?: string | undefined;
|
|
502
|
-
user?: string | undefined;
|
|
503
|
-
password?: string | undefined;
|
|
504
|
-
database?: string | undefined;
|
|
505
|
-
}, {
|
|
506
|
-
port?: number | undefined;
|
|
507
|
-
host?: string | undefined;
|
|
508
|
-
user?: string | undefined;
|
|
509
|
-
password?: string | undefined;
|
|
510
|
-
database?: string | undefined;
|
|
511
|
-
}>>;
|
|
81
|
+
}, z.core.$strip>>;
|
|
512
82
|
debug: z.ZodOptional<z.ZodBoolean>;
|
|
513
83
|
log: z.ZodOptional<z.ZodObject<{
|
|
514
|
-
level: z.ZodOptional<z.ZodEnum<
|
|
84
|
+
level: z.ZodOptional<z.ZodEnum<{
|
|
85
|
+
error: "error";
|
|
86
|
+
warn: "warn";
|
|
87
|
+
info: "info";
|
|
88
|
+
debug: "debug";
|
|
89
|
+
notice: "notice";
|
|
90
|
+
}>>;
|
|
515
91
|
console: z.ZodOptional<z.ZodBoolean>;
|
|
516
|
-
},
|
|
517
|
-
console?: boolean | undefined;
|
|
518
|
-
level?: "error" | "warn" | "info" | "debug" | "notice" | undefined;
|
|
519
|
-
}, {
|
|
520
|
-
console?: boolean | undefined;
|
|
521
|
-
level?: "error" | "warn" | "info" | "debug" | "notice" | undefined;
|
|
522
|
-
}>>;
|
|
92
|
+
}, z.core.$strip>>;
|
|
523
93
|
web: z.ZodOptional<z.ZodObject<{
|
|
524
94
|
prefix: z.ZodOptional<z.ZodString>;
|
|
525
|
-
},
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
}>>;
|
|
530
|
-
} & {
|
|
531
|
-
include: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
532
|
-
plugins: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
533
|
-
}, z.ZodTypeAny, "passthrough">>;
|
|
95
|
+
}, z.core.$strip>>;
|
|
96
|
+
include: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
97
|
+
plugins: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
98
|
+
}, z.core.$loose>;
|
|
534
99
|
export interface File extends PartialRecursive<Config>, z.infer<typeof File> {
|
|
535
100
|
}
|
|
536
101
|
/**
|
package/dist/config.js
CHANGED
|
@@ -1,49 +1,10 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
2
1
|
import { levelText } from 'logzen';
|
|
3
2
|
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
4
3
|
import { dirname, join, resolve } from 'node:path/posix';
|
|
5
4
|
import { deepAssign, omit } from 'utilium';
|
|
6
|
-
import * as z from 'zod';
|
|
5
|
+
import * as z from 'zod/v4';
|
|
7
6
|
import { findDir, logger, output } from './io.js';
|
|
8
7
|
import { loadPlugin } from './plugins.js';
|
|
9
|
-
export const Schema = z
|
|
10
|
-
.object({
|
|
11
|
-
api: z.object({
|
|
12
|
-
disable_metadata: z.boolean(),
|
|
13
|
-
cookie_auth: z.boolean(),
|
|
14
|
-
}),
|
|
15
|
-
apps: z.object({
|
|
16
|
-
disabled: z.array(z.string()),
|
|
17
|
-
}),
|
|
18
|
-
auth: z.object({
|
|
19
|
-
credentials: z.boolean(),
|
|
20
|
-
debug: z.boolean(),
|
|
21
|
-
origin: z.string(),
|
|
22
|
-
/** In minutes */
|
|
23
|
-
passkey_probation: z.number(),
|
|
24
|
-
rp_id: z.string(),
|
|
25
|
-
rp_name: z.string(),
|
|
26
|
-
secure_cookies: z.boolean(),
|
|
27
|
-
/** In minutes */
|
|
28
|
-
verification_timeout: z.number(),
|
|
29
|
-
}),
|
|
30
|
-
db: z.object({
|
|
31
|
-
host: z.string(),
|
|
32
|
-
port: z.number(),
|
|
33
|
-
password: z.string(),
|
|
34
|
-
user: z.string(),
|
|
35
|
-
database: z.string(),
|
|
36
|
-
}),
|
|
37
|
-
debug: z.boolean(),
|
|
38
|
-
log: z.object({
|
|
39
|
-
level: z.enum(levelText),
|
|
40
|
-
console: z.boolean(),
|
|
41
|
-
}),
|
|
42
|
-
web: z.object({
|
|
43
|
-
prefix: z.string(),
|
|
44
|
-
}),
|
|
45
|
-
})
|
|
46
|
-
.passthrough();
|
|
47
8
|
export const configFiles = new Map();
|
|
48
9
|
export function plainConfig() {
|
|
49
10
|
return omit(config, Object.keys(configShortcuts));
|
|
@@ -76,6 +37,7 @@ export const config = {
|
|
|
76
37
|
rp_name: 'Axium',
|
|
77
38
|
secure_cookies: true,
|
|
78
39
|
verification_timeout: 60,
|
|
40
|
+
email_verification: false,
|
|
79
41
|
},
|
|
80
42
|
db: {
|
|
81
43
|
database: process.env.PGDATABASE || 'axium',
|
|
@@ -95,12 +57,60 @@ export const config = {
|
|
|
95
57
|
};
|
|
96
58
|
export default config;
|
|
97
59
|
// config from file
|
|
98
|
-
export const File =
|
|
99
|
-
.
|
|
60
|
+
export const File = z
|
|
61
|
+
.looseObject({
|
|
62
|
+
api: z
|
|
63
|
+
.object({
|
|
64
|
+
disable_metadata: z.boolean(),
|
|
65
|
+
cookie_auth: z.boolean(),
|
|
66
|
+
})
|
|
67
|
+
.partial(),
|
|
68
|
+
apps: z
|
|
69
|
+
.object({
|
|
70
|
+
disabled: z.array(z.string()),
|
|
71
|
+
})
|
|
72
|
+
.partial(),
|
|
73
|
+
auth: z
|
|
74
|
+
.object({
|
|
75
|
+
credentials: z.boolean(),
|
|
76
|
+
debug: z.boolean(),
|
|
77
|
+
origin: z.string(),
|
|
78
|
+
/** In minutes */
|
|
79
|
+
passkey_probation: z.number(),
|
|
80
|
+
rp_id: z.string(),
|
|
81
|
+
rp_name: z.string(),
|
|
82
|
+
secure_cookies: z.boolean(),
|
|
83
|
+
/** In minutes */
|
|
84
|
+
verification_timeout: z.number(),
|
|
85
|
+
/** Whether users can verify emails */
|
|
86
|
+
email_verification: z.boolean(),
|
|
87
|
+
})
|
|
88
|
+
.partial(),
|
|
89
|
+
db: z
|
|
90
|
+
.object({
|
|
91
|
+
host: z.string(),
|
|
92
|
+
port: z.number(),
|
|
93
|
+
password: z.string(),
|
|
94
|
+
user: z.string(),
|
|
95
|
+
database: z.string(),
|
|
96
|
+
})
|
|
97
|
+
.partial(),
|
|
98
|
+
debug: z.boolean(),
|
|
99
|
+
log: z
|
|
100
|
+
.object({
|
|
101
|
+
level: z.enum(levelText),
|
|
102
|
+
console: z.boolean(),
|
|
103
|
+
})
|
|
104
|
+
.partial(),
|
|
105
|
+
web: z
|
|
106
|
+
.object({
|
|
107
|
+
prefix: z.string(),
|
|
108
|
+
})
|
|
109
|
+
.partial(),
|
|
100
110
|
include: z.array(z.string()).optional(),
|
|
101
111
|
plugins: z.array(z.string()).optional(),
|
|
102
112
|
})
|
|
103
|
-
.
|
|
113
|
+
.partial();
|
|
104
114
|
/**
|
|
105
115
|
* Update the current config
|
|
106
116
|
*/
|