@axium/server 0.7.6 → 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.
Files changed (57) hide show
  1. package/dist/apps.d.ts +15 -0
  2. package/dist/apps.js +20 -0
  3. package/dist/auth.d.ts +53 -30
  4. package/dist/auth.js +103 -130
  5. package/dist/cli.js +176 -42
  6. package/dist/config.d.ts +57 -312
  7. package/dist/config.js +65 -31
  8. package/dist/database.d.ts +31 -40
  9. package/dist/database.js +165 -62
  10. package/dist/io.js +6 -2
  11. package/dist/plugins.d.ts +8 -24
  12. package/dist/plugins.js +10 -14
  13. package/dist/routes.d.ts +55 -0
  14. package/dist/routes.js +54 -0
  15. package/package.json +11 -16
  16. package/web/api/index.ts +7 -0
  17. package/web/api/metadata.ts +35 -0
  18. package/web/api/passkeys.ts +56 -0
  19. package/web/api/readme.md +1 -0
  20. package/web/api/register.ts +83 -0
  21. package/web/api/schemas.ts +22 -0
  22. package/web/api/session.ts +33 -0
  23. package/web/api/users.ts +351 -0
  24. package/web/api/utils.ts +66 -0
  25. package/web/auth.ts +1 -5
  26. package/web/hooks.server.ts +12 -1
  27. package/web/index.server.ts +0 -1
  28. package/web/lib/ClipboardCopy.svelte +42 -0
  29. package/web/lib/Dialog.svelte +3 -6
  30. package/web/lib/FormDialog.svelte +61 -14
  31. package/web/lib/Toast.svelte +8 -1
  32. package/web/lib/UserCard.svelte +1 -1
  33. package/web/lib/auth.ts +12 -0
  34. package/web/lib/icons/Icon.svelte +7 -13
  35. package/web/lib/index.ts +0 -2
  36. package/web/lib/styles.css +18 -1
  37. package/web/routes/+layout.svelte +1 -1
  38. package/web/routes/[...path]/+page.server.ts +13 -0
  39. package/web/routes/[appId]/[...page]/+page.server.ts +14 -0
  40. package/web/routes/_axium/default/+page.svelte +11 -0
  41. package/web/routes/account/+page.svelte +291 -0
  42. package/web/routes/api/[...path]/+server.ts +49 -0
  43. package/web/routes/login/+page.svelte +25 -0
  44. package/web/routes/logout/+page.svelte +13 -0
  45. package/web/routes/register/+page.svelte +21 -0
  46. package/web/tsconfig.json +2 -1
  47. package/web/utils.ts +9 -15
  48. package/web/actions.ts +0 -58
  49. package/web/lib/Account.svelte +0 -76
  50. package/web/lib/SignUp.svelte +0 -20
  51. package/web/lib/account.css +0 -36
  52. package/web/routes/+page.server.ts +0 -16
  53. package/web/routes/+page.svelte +0 -10
  54. package/web/routes/name/+page.server.ts +0 -5
  55. package/web/routes/name/+page.svelte +0 -20
  56. package/web/routes/signup/+page.server.ts +0 -10
  57. package/web/routes/signup/+page.svelte +0 -15
package/dist/config.d.ts CHANGED
@@ -1,169 +1,43 @@
1
+ import { levelText } from 'logzen';
1
2
  import { type PartialRecursive } from 'utilium';
2
- import * as z from 'zod';
3
- export declare const Schema: z.ZodObject<{
4
- auth: z.ZodObject<{
5
- credentials: z.ZodBoolean;
6
- debug: z.ZodBoolean;
7
- secret: z.ZodString;
8
- secure_cookies: z.ZodBoolean;
9
- }, "strip", z.ZodTypeAny, {
10
- debug: boolean;
11
- credentials: boolean;
12
- secret: string;
13
- secure_cookies: boolean;
14
- }, {
15
- debug: boolean;
16
- credentials: boolean;
17
- secret: string;
18
- secure_cookies: boolean;
19
- }>;
20
- db: z.ZodObject<{
21
- host: z.ZodString;
22
- port: z.ZodNumber;
23
- password: z.ZodString;
24
- user: z.ZodString;
25
- database: z.ZodString;
26
- }, "strip", z.ZodTypeAny, {
27
- host: string;
28
- port: number;
29
- password: string;
30
- user: string;
31
- database: string;
32
- }, {
33
- host: string;
34
- port: number;
35
- password: string;
36
- user: string;
37
- database: string;
38
- }>;
39
- debug: z.ZodBoolean;
40
- log: z.ZodObject<{
41
- level: z.ZodEnum<["error", "warn", "notice", "info", "debug"]>;
42
- console: z.ZodBoolean;
43
- }, "strip", z.ZodTypeAny, {
44
- level: "debug" | "info" | "warn" | "error" | "notice";
45
- console: boolean;
46
- }, {
47
- level: "debug" | "info" | "warn" | "error" | "notice";
48
- console: boolean;
49
- }>;
50
- web: z.ZodObject<{
51
- prefix: z.ZodString;
52
- }, "strip", z.ZodTypeAny, {
53
- prefix: string;
54
- }, {
55
- prefix: string;
56
- }>;
57
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
58
- auth: z.ZodObject<{
59
- credentials: z.ZodBoolean;
60
- debug: z.ZodBoolean;
61
- secret: z.ZodString;
62
- secure_cookies: z.ZodBoolean;
63
- }, "strip", z.ZodTypeAny, {
64
- debug: boolean;
65
- credentials: boolean;
66
- secret: string;
67
- secure_cookies: boolean;
68
- }, {
69
- debug: boolean;
70
- credentials: boolean;
71
- secret: string;
72
- secure_cookies: boolean;
73
- }>;
74
- db: z.ZodObject<{
75
- host: z.ZodString;
76
- port: z.ZodNumber;
77
- password: z.ZodString;
78
- user: z.ZodString;
79
- database: z.ZodString;
80
- }, "strip", z.ZodTypeAny, {
81
- host: string;
82
- port: number;
83
- password: string;
84
- user: string;
85
- database: string;
86
- }, {
87
- host: string;
88
- port: number;
89
- password: string;
90
- user: string;
91
- database: string;
92
- }>;
93
- debug: z.ZodBoolean;
94
- log: z.ZodObject<{
95
- level: z.ZodEnum<["error", "warn", "notice", "info", "debug"]>;
96
- console: z.ZodBoolean;
97
- }, "strip", z.ZodTypeAny, {
98
- level: "debug" | "info" | "warn" | "error" | "notice";
99
- console: boolean;
100
- }, {
101
- level: "debug" | "info" | "warn" | "error" | "notice";
102
- console: boolean;
103
- }>;
104
- web: z.ZodObject<{
105
- prefix: z.ZodString;
106
- }, "strip", z.ZodTypeAny, {
107
- prefix: string;
108
- }, {
109
- prefix: string;
110
- }>;
111
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
112
- auth: z.ZodObject<{
113
- credentials: z.ZodBoolean;
114
- debug: z.ZodBoolean;
115
- secret: z.ZodString;
116
- secure_cookies: z.ZodBoolean;
117
- }, "strip", z.ZodTypeAny, {
118
- debug: boolean;
3
+ import * as z from 'zod/v4';
4
+ export interface Config extends Record<string, unknown> {
5
+ api: {
6
+ disable_metadata: boolean;
7
+ cookie_auth: boolean;
8
+ };
9
+ apps: {
10
+ disabled: string[];
11
+ };
12
+ auth: {
119
13
  credentials: boolean;
120
- secret: string;
121
- secure_cookies: boolean;
122
- }, {
123
14
  debug: boolean;
124
- credentials: boolean;
125
- secret: string;
15
+ origin: string;
16
+ /** In minutes */
17
+ passkey_probation: number;
18
+ rp_id: string;
19
+ rp_name: string;
126
20
  secure_cookies: boolean;
127
- }>;
128
- db: z.ZodObject<{
129
- host: z.ZodString;
130
- port: z.ZodNumber;
131
- password: z.ZodString;
132
- user: z.ZodString;
133
- database: z.ZodString;
134
- }, "strip", z.ZodTypeAny, {
135
- host: string;
136
- port: number;
137
- password: string;
138
- user: string;
139
- database: string;
140
- }, {
21
+ /** In minutes */
22
+ verification_timeout: number;
23
+ /** Whether users can verify emails */
24
+ email_verification: boolean;
25
+ };
26
+ db: {
141
27
  host: string;
142
28
  port: number;
143
29
  password: string;
144
30
  user: string;
145
31
  database: string;
146
- }>;
147
- debug: z.ZodBoolean;
148
- log: z.ZodObject<{
149
- level: z.ZodEnum<["error", "warn", "notice", "info", "debug"]>;
150
- console: z.ZodBoolean;
151
- }, "strip", z.ZodTypeAny, {
152
- level: "debug" | "info" | "warn" | "error" | "notice";
32
+ };
33
+ debug: boolean;
34
+ log: {
35
+ level: (typeof levelText)[number];
153
36
  console: boolean;
154
- }, {
155
- level: "debug" | "info" | "warn" | "error" | "notice";
156
- console: boolean;
157
- }>;
158
- web: z.ZodObject<{
159
- prefix: z.ZodString;
160
- }, "strip", z.ZodTypeAny, {
161
- prefix: string;
162
- }, {
37
+ };
38
+ web: {
163
39
  prefix: string;
164
- }>;
165
- }, z.ZodTypeAny, "passthrough">>;
166
- export interface Config extends Record<string, unknown>, z.infer<typeof Schema> {
40
+ };
167
41
  }
168
42
  export declare const configFiles: Map<string, PartialRecursive<Config>>;
169
43
  export declare function plainConfig(): Omit<Config, keyof typeof configShortcuts>;
@@ -179,178 +53,49 @@ declare const configShortcuts: {
179
53
  };
180
54
  export declare const config: Config & typeof configShortcuts;
181
55
  export default config;
182
- export declare const File: z.ZodObject<z.objectUtil.extendShape<{
183
- auth: z.ZodOptional<z.ZodObject<{
184
- credentials: z.ZodOptional<z.ZodBoolean>;
185
- debug: z.ZodOptional<z.ZodBoolean>;
186
- secret: z.ZodOptional<z.ZodString>;
187
- secure_cookies: z.ZodOptional<z.ZodBoolean>;
188
- }, "strip", z.ZodTypeAny, {
189
- debug?: boolean | undefined;
190
- credentials?: boolean | undefined;
191
- secret?: string | undefined;
192
- secure_cookies?: boolean | undefined;
193
- }, {
194
- debug?: boolean | undefined;
195
- credentials?: boolean | undefined;
196
- secret?: string | undefined;
197
- secure_cookies?: boolean | undefined;
198
- }>>;
199
- db: z.ZodOptional<z.ZodObject<{
200
- host: z.ZodOptional<z.ZodString>;
201
- port: z.ZodOptional<z.ZodNumber>;
202
- password: z.ZodOptional<z.ZodString>;
203
- user: z.ZodOptional<z.ZodString>;
204
- database: z.ZodOptional<z.ZodString>;
205
- }, "strip", z.ZodTypeAny, {
206
- host?: string | undefined;
207
- port?: number | undefined;
208
- password?: string | undefined;
209
- user?: string | undefined;
210
- database?: string | undefined;
211
- }, {
212
- host?: string | undefined;
213
- port?: number | undefined;
214
- password?: string | undefined;
215
- user?: string | undefined;
216
- database?: string | undefined;
217
- }>>;
218
- debug: z.ZodOptional<z.ZodBoolean>;
219
- log: z.ZodOptional<z.ZodObject<{
220
- level: z.ZodOptional<z.ZodEnum<["error", "warn", "notice", "info", "debug"]>>;
221
- console: z.ZodOptional<z.ZodBoolean>;
222
- }, "strip", z.ZodTypeAny, {
223
- level?: "debug" | "info" | "warn" | "error" | "notice" | undefined;
224
- console?: boolean | undefined;
225
- }, {
226
- level?: "debug" | "info" | "warn" | "error" | "notice" | undefined;
227
- console?: boolean | undefined;
228
- }>>;
229
- web: z.ZodOptional<z.ZodObject<{
230
- prefix: z.ZodOptional<z.ZodString>;
231
- }, "strip", z.ZodTypeAny, {
232
- prefix?: string | undefined;
233
- }, {
234
- prefix?: string | undefined;
235
- }>>;
236
- }, {
237
- include: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
238
- plugins: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
239
- }>, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<{
240
- auth: z.ZodOptional<z.ZodObject<{
241
- credentials: z.ZodOptional<z.ZodBoolean>;
242
- debug: z.ZodOptional<z.ZodBoolean>;
243
- secret: z.ZodOptional<z.ZodString>;
244
- secure_cookies: z.ZodOptional<z.ZodBoolean>;
245
- }, "strip", z.ZodTypeAny, {
246
- debug?: boolean | undefined;
247
- credentials?: boolean | undefined;
248
- secret?: string | undefined;
249
- secure_cookies?: boolean | undefined;
250
- }, {
251
- debug?: boolean | undefined;
252
- credentials?: boolean | undefined;
253
- secret?: string | undefined;
254
- secure_cookies?: boolean | undefined;
255
- }>>;
256
- db: z.ZodOptional<z.ZodObject<{
257
- host: z.ZodOptional<z.ZodString>;
258
- port: z.ZodOptional<z.ZodNumber>;
259
- password: z.ZodOptional<z.ZodString>;
260
- user: z.ZodOptional<z.ZodString>;
261
- database: z.ZodOptional<z.ZodString>;
262
- }, "strip", z.ZodTypeAny, {
263
- host?: string | undefined;
264
- port?: number | undefined;
265
- password?: string | undefined;
266
- user?: string | undefined;
267
- database?: string | undefined;
268
- }, {
269
- host?: string | undefined;
270
- port?: number | undefined;
271
- password?: string | undefined;
272
- user?: string | undefined;
273
- database?: string | undefined;
274
- }>>;
275
- debug: z.ZodOptional<z.ZodBoolean>;
276
- log: z.ZodOptional<z.ZodObject<{
277
- level: z.ZodOptional<z.ZodEnum<["error", "warn", "notice", "info", "debug"]>>;
278
- console: z.ZodOptional<z.ZodBoolean>;
279
- }, "strip", z.ZodTypeAny, {
280
- level?: "debug" | "info" | "warn" | "error" | "notice" | undefined;
281
- console?: boolean | undefined;
282
- }, {
283
- level?: "debug" | "info" | "warn" | "error" | "notice" | undefined;
284
- console?: boolean | undefined;
285
- }>>;
286
- web: z.ZodOptional<z.ZodObject<{
287
- prefix: z.ZodOptional<z.ZodString>;
288
- }, "strip", z.ZodTypeAny, {
289
- prefix?: string | undefined;
290
- }, {
291
- prefix?: string | undefined;
292
- }>>;
293
- }, {
294
- include: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
295
- plugins: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
296
- }>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<{
56
+ export declare const File: z.ZodObject<{
57
+ api: z.ZodOptional<z.ZodObject<{
58
+ disable_metadata: z.ZodOptional<z.ZodBoolean>;
59
+ cookie_auth: z.ZodOptional<z.ZodBoolean>;
60
+ }, z.core.$strip>>;
61
+ apps: z.ZodOptional<z.ZodObject<{
62
+ disabled: z.ZodOptional<z.ZodArray<z.ZodString>>;
63
+ }, z.core.$strip>>;
297
64
  auth: z.ZodOptional<z.ZodObject<{
298
65
  credentials: z.ZodOptional<z.ZodBoolean>;
299
66
  debug: z.ZodOptional<z.ZodBoolean>;
300
- secret: z.ZodOptional<z.ZodString>;
67
+ origin: z.ZodOptional<z.ZodString>;
68
+ passkey_probation: z.ZodOptional<z.ZodNumber>;
69
+ rp_id: z.ZodOptional<z.ZodString>;
70
+ rp_name: z.ZodOptional<z.ZodString>;
301
71
  secure_cookies: z.ZodOptional<z.ZodBoolean>;
302
- }, "strip", z.ZodTypeAny, {
303
- debug?: boolean | undefined;
304
- credentials?: boolean | undefined;
305
- secret?: string | undefined;
306
- secure_cookies?: boolean | undefined;
307
- }, {
308
- debug?: boolean | undefined;
309
- credentials?: boolean | undefined;
310
- secret?: string | undefined;
311
- secure_cookies?: boolean | undefined;
312
- }>>;
72
+ verification_timeout: z.ZodOptional<z.ZodNumber>;
73
+ email_verification: z.ZodOptional<z.ZodBoolean>;
74
+ }, z.core.$strip>>;
313
75
  db: z.ZodOptional<z.ZodObject<{
314
76
  host: z.ZodOptional<z.ZodString>;
315
77
  port: z.ZodOptional<z.ZodNumber>;
316
78
  password: z.ZodOptional<z.ZodString>;
317
79
  user: z.ZodOptional<z.ZodString>;
318
80
  database: z.ZodOptional<z.ZodString>;
319
- }, "strip", z.ZodTypeAny, {
320
- host?: string | undefined;
321
- port?: number | undefined;
322
- password?: string | undefined;
323
- user?: string | undefined;
324
- database?: string | undefined;
325
- }, {
326
- host?: string | undefined;
327
- port?: number | undefined;
328
- password?: string | undefined;
329
- user?: string | undefined;
330
- database?: string | undefined;
331
- }>>;
81
+ }, z.core.$strip>>;
332
82
  debug: z.ZodOptional<z.ZodBoolean>;
333
83
  log: z.ZodOptional<z.ZodObject<{
334
- level: z.ZodOptional<z.ZodEnum<["error", "warn", "notice", "info", "debug"]>>;
84
+ level: z.ZodOptional<z.ZodEnum<{
85
+ error: "error";
86
+ warn: "warn";
87
+ info: "info";
88
+ debug: "debug";
89
+ notice: "notice";
90
+ }>>;
335
91
  console: z.ZodOptional<z.ZodBoolean>;
336
- }, "strip", z.ZodTypeAny, {
337
- level?: "debug" | "info" | "warn" | "error" | "notice" | undefined;
338
- console?: boolean | undefined;
339
- }, {
340
- level?: "debug" | "info" | "warn" | "error" | "notice" | undefined;
341
- console?: boolean | undefined;
342
- }>>;
92
+ }, z.core.$strip>>;
343
93
  web: z.ZodOptional<z.ZodObject<{
344
94
  prefix: z.ZodOptional<z.ZodString>;
345
- }, "strip", z.ZodTypeAny, {
346
- prefix?: string | undefined;
347
- }, {
348
- prefix?: string | undefined;
349
- }>>;
350
- }, {
351
- include: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
352
- plugins: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
353
- }>, 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>;
354
99
  export interface File extends PartialRecursive<Config>, z.infer<typeof File> {
355
100
  }
356
101
  /**
package/dist/config.js CHANGED
@@ -1,36 +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
- auth: z.object({
12
- credentials: z.boolean(),
13
- debug: z.boolean(),
14
- secret: z.string(),
15
- secure_cookies: z.boolean(),
16
- }),
17
- db: z.object({
18
- host: z.string(),
19
- port: z.number(),
20
- password: z.string(),
21
- user: z.string(),
22
- database: z.string(),
23
- }),
24
- debug: z.boolean(),
25
- log: z.object({
26
- level: z.enum(levelText),
27
- console: z.boolean(),
28
- }),
29
- web: z.object({
30
- prefix: z.string(),
31
- }),
32
- })
33
- .passthrough();
34
8
  export const configFiles = new Map();
35
9
  export function plainConfig() {
36
10
  return omit(config, Object.keys(configShortcuts));
@@ -47,11 +21,23 @@ const configShortcuts = {
47
21
  };
48
22
  export const config = {
49
23
  ...configShortcuts,
24
+ api: {
25
+ disable_metadata: false,
26
+ cookie_auth: false,
27
+ },
28
+ apps: {
29
+ disabled: [],
30
+ },
50
31
  auth: {
51
32
  credentials: false,
52
33
  debug: false,
53
- secret: '',
34
+ origin: 'https://test.localhost',
35
+ passkey_probation: 60,
36
+ rp_id: 'test.localhost',
37
+ rp_name: 'Axium',
54
38
  secure_cookies: true,
39
+ verification_timeout: 60,
40
+ email_verification: false,
55
41
  },
56
42
  db: {
57
43
  database: process.env.PGDATABASE || 'axium',
@@ -71,12 +57,60 @@ export const config = {
71
57
  };
72
58
  export default config;
73
59
  // config from file
74
- export const File = Schema.deepPartial()
75
- .extend({
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(),
76
110
  include: z.array(z.string()).optional(),
77
111
  plugins: z.array(z.string()).optional(),
78
112
  })
79
- .passthrough();
113
+ .partial();
80
114
  /**
81
115
  * Update the current config
82
116
  */
@@ -1,64 +1,52 @@
1
- import type { AdapterAccountType as db } from '@auth/core/adapters';
1
+ import type { Preferences } from '@axium/core';
2
2
  import { Kysely, type GeneratedAlways } from 'kysely';
3
- import type { Preferences } from './auth.js';
4
- import { type MaybeOutput, type WithOutput } from './io.js';
3
+ import type { VerificationRole } from './auth.js';
4
+ import type { MaybeOutput, WithOutput } from './io.js';
5
+ import type { AuthenticatorTransportFuture, CredentialDeviceType } from '@simplewebauthn/server';
5
6
  export interface Schema {
6
- User: {
7
- id: GeneratedAlways<string>;
8
- name: string | null;
7
+ users: {
8
+ id: GeneratedAlways<string> & string;
9
9
  email: string;
10
- emailVerified: Date | null;
11
- image: string | null;
12
- password: string | null;
13
- salt: string | null;
14
- preferences: Preferences;
15
- };
16
- Account: {
17
- id: GeneratedAlways<string>;
18
- userId: string;
19
- type: db;
20
- provider: string;
21
- providerAccountId: string;
22
- refresh_token?: string;
23
- access_token?: string;
24
- expires_at?: number;
25
- token_type?: Lowercase<string>;
26
- scope?: string;
27
- id_token?: string;
28
- session_state: string | null;
10
+ name: string;
11
+ image?: string | null;
12
+ emailVerified?: Date | null;
13
+ preferences?: Preferences;
29
14
  };
30
- Session: {
15
+ sessions: {
31
16
  id: GeneratedAlways<string>;
17
+ created: GeneratedAlways<Date>;
32
18
  userId: string;
33
- sessionToken: string;
19
+ token: string;
34
20
  expires: Date;
21
+ elevated: boolean;
35
22
  };
36
- VerificationToken: {
37
- identifier: string;
23
+ verifications: {
24
+ userId: string;
38
25
  token: string;
39
26
  expires: Date;
27
+ role: VerificationRole;
40
28
  };
41
- Authenticator: {
42
- credentialID: string;
29
+ passkeys: {
30
+ id: string;
31
+ name: string | null;
32
+ createdAt: GeneratedAlways<Date>;
43
33
  userId: string;
44
- providerAccountId: string;
45
- credentialPublicKey: string;
34
+ publicKey: Uint8Array;
46
35
  counter: number;
47
- credentialDeviceType: string;
48
- credentialBackedUp: boolean;
49
- transports: string | null;
36
+ deviceType: CredentialDeviceType;
37
+ backedUp: boolean;
38
+ transports: AuthenticatorTransportFuture[];
50
39
  };
51
40
  }
52
- export interface Database extends Kysely<Schema>, AsyncDisposable {
53
- }
41
+ export type Database = Kysely<Schema> & AsyncDisposable;
54
42
  export declare let database: Database;
55
43
  export declare function connect(): Database;
56
44
  export interface Stats {
57
45
  users: number;
58
- accounts: number;
46
+ passkeys: number;
59
47
  sessions: number;
60
48
  }
61
- export declare function count(table: keyof Schema): Promise<number>;
49
+ export declare function count<const T extends keyof Schema>(table: T): Promise<number>;
62
50
  export declare function status(): Promise<Stats>;
63
51
  export declare function statusText(): Promise<string>;
64
52
  export interface OpOptions extends MaybeOutput {
@@ -69,11 +57,14 @@ export interface InitOptions extends OpOptions {
69
57
  skip: boolean;
70
58
  }
71
59
  export declare function shouldRecreate(opt: InitOptions & WithOutput): boolean;
60
+ export declare function getHBA(opt: OpOptions & WithOutput): Promise<[content: string, writeBack: (newContent: string) => void]>;
72
61
  export interface PluginShortcuts {
73
62
  done: () => void;
74
63
  warnExists: (error: string | Error) => void;
75
64
  }
76
65
  export declare function init(opt: InitOptions): Promise<void>;
66
+ export declare function check(opt: OpOptions): Promise<void>;
67
+ export declare function clean(opt: Partial<OpOptions>): Promise<void>;
77
68
  /**
78
69
  * Completely remove Axium from the database.
79
70
  */