@gatwech/core 0.0.11 → 1.0.0-beta.18

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 (130) hide show
  1. package/dist/api/index.d.mts +2 -2
  2. package/dist/context/index.d.mts +2 -2
  3. package/dist/db/adapter/index.d.mts +2 -2
  4. package/dist/db/index.d.mts +2 -2
  5. package/dist/env/index.d.mts +1 -1
  6. package/dist/env/index.mjs +1 -1
  7. package/dist/{env-JMSMESs1.mjs → env-4_Lym7sj.mjs} +7 -7
  8. package/dist/index-65G5U5DB.d.mts +3002 -0
  9. package/dist/{index-DLP-K0uY.d.mts → index-CmdhhvA2.d.mts} +3 -3
  10. package/dist/index.d.mts +3 -3
  11. package/dist/oauth2/index.d.mts +2 -2
  12. package/dist/social-providers/index.d.mts +3 -3
  13. package/dist/social-providers/index.mjs +71 -2412
  14. package/dist/src/api/index.d.ts +119 -0
  15. package/dist/src/async_hooks/index.d.ts +6 -0
  16. package/dist/src/context/endpoint-context.d.ts +14 -0
  17. package/dist/src/context/index.d.ts +3 -0
  18. package/dist/src/context/request-state.d.ts +13 -0
  19. package/dist/src/context/transaction.d.ts +11 -0
  20. package/dist/src/db/adapter/index.d.ts +401 -0
  21. package/{src/db/index.ts → dist/src/db/index.d.ts} +2 -18
  22. package/dist/src/db/plugin.d.ts +10 -0
  23. package/dist/src/db/schema/account.d.ts +22 -0
  24. package/dist/src/db/schema/rate-limit.d.ts +10 -0
  25. package/dist/src/db/schema/session.d.ts +17 -0
  26. package/dist/src/db/schema/shared.d.ts +6 -0
  27. package/dist/src/db/schema/user.d.ts +16 -0
  28. package/{src/db/schema/verification.ts → dist/src/db/schema/verification.d.ts} +8 -8
  29. package/dist/src/db/type.d.ts +159 -0
  30. package/dist/src/env/color-depth.d.ts +1 -0
  31. package/dist/src/env/env-impl.d.ts +29 -0
  32. package/dist/src/env/index.d.ts +3 -0
  33. package/dist/src/env/logger.d.ts +50 -0
  34. package/dist/src/error/codes.d.ts +27 -0
  35. package/dist/src/error/index.d.ts +4 -0
  36. package/dist/src/oauth2/client-credentials-token.d.ts +21 -0
  37. package/dist/src/oauth2/create-authorization-url.d.ts +21 -0
  38. package/dist/src/oauth2/index.d.ts +6 -0
  39. package/dist/src/oauth2/oauth-provider.d.ts +178 -0
  40. package/dist/src/oauth2/refresh-access-token.d.ts +20 -0
  41. package/dist/src/oauth2/utils.d.ts +3 -0
  42. package/dist/src/oauth2/validate-authorization-code.d.ts +28 -0
  43. package/dist/src/social-providers/github.d.ts +89 -0
  44. package/dist/src/social-providers/google.d.ts +82 -0
  45. package/dist/src/social-providers/index.d.ts +93 -0
  46. package/dist/src/types/context.d.ts +177 -0
  47. package/dist/src/types/cookie.d.ts +15 -0
  48. package/dist/src/types/helper.d.ts +9 -0
  49. package/dist/src/types/index.d.ts +7 -0
  50. package/dist/src/types/init-options.d.ts +1140 -0
  51. package/dist/src/types/plugin-client.d.ts +88 -0
  52. package/dist/src/types/plugin.d.ts +120 -0
  53. package/dist/src/utils/error-codes.d.ts +9 -0
  54. package/package.json +11 -5
  55. package/.turbo/turbo-build.log +0 -42
  56. package/dist/index-DjrJweYn.d.mts +0 -7312
  57. package/src/api/index.ts +0 -57
  58. package/src/async_hooks/index.ts +0 -35
  59. package/src/context/endpoint-context.ts +0 -48
  60. package/src/context/index.ts +0 -21
  61. package/src/context/request-state.test.ts +0 -346
  62. package/src/context/request-state.ts +0 -75
  63. package/src/context/transaction.ts +0 -72
  64. package/src/db/adapter/index.ts +0 -466
  65. package/src/db/plugin.ts +0 -11
  66. package/src/db/schema/account.ts +0 -34
  67. package/src/db/schema/rate-limit.ts +0 -21
  68. package/src/db/schema/session.ts +0 -17
  69. package/src/db/schema/shared.ts +0 -7
  70. package/src/db/schema/user.ts +0 -16
  71. package/src/db/type.ts +0 -180
  72. package/src/env/color-depth.ts +0 -172
  73. package/src/env/env-impl.ts +0 -124
  74. package/src/env/index.ts +0 -23
  75. package/src/env/logger.test.ts +0 -33
  76. package/src/env/logger.ts +0 -145
  77. package/src/error/codes.ts +0 -31
  78. package/src/error/index.ts +0 -11
  79. package/src/oauth2/client-credentials-token.ts +0 -102
  80. package/src/oauth2/create-authorization-url.ts +0 -85
  81. package/src/oauth2/index.ts +0 -21
  82. package/src/oauth2/oauth-provider.ts +0 -211
  83. package/src/oauth2/refresh-access-token.ts +0 -124
  84. package/src/oauth2/utils.ts +0 -36
  85. package/src/oauth2/validate-authorization-code.ts +0 -154
  86. package/src/social-providers/apple.ts +0 -213
  87. package/src/social-providers/atlassian.ts +0 -132
  88. package/src/social-providers/cognito.ts +0 -269
  89. package/src/social-providers/discord.ts +0 -169
  90. package/src/social-providers/dropbox.ts +0 -112
  91. package/src/social-providers/facebook.ts +0 -204
  92. package/src/social-providers/figma.ts +0 -115
  93. package/src/social-providers/github.ts +0 -154
  94. package/src/social-providers/gitlab.ts +0 -152
  95. package/src/social-providers/google.ts +0 -171
  96. package/src/social-providers/huggingface.ts +0 -118
  97. package/src/social-providers/index.ts +0 -124
  98. package/src/social-providers/kakao.ts +0 -178
  99. package/src/social-providers/kick.ts +0 -92
  100. package/src/social-providers/line.ts +0 -169
  101. package/src/social-providers/linear.ts +0 -120
  102. package/src/social-providers/linkedin.ts +0 -110
  103. package/src/social-providers/microsoft-entra-id.ts +0 -245
  104. package/src/social-providers/naver.ts +0 -112
  105. package/src/social-providers/notion.ts +0 -108
  106. package/src/social-providers/paybin.ts +0 -122
  107. package/src/social-providers/paypal.ts +0 -263
  108. package/src/social-providers/polar.ts +0 -107
  109. package/src/social-providers/reddit.ts +0 -122
  110. package/src/social-providers/roblox.ts +0 -110
  111. package/src/social-providers/salesforce.ts +0 -159
  112. package/src/social-providers/slack.ts +0 -111
  113. package/src/social-providers/spotify.ts +0 -93
  114. package/src/social-providers/tiktok.ts +0 -210
  115. package/src/social-providers/twitch.ts +0 -111
  116. package/src/social-providers/twitter.ts +0 -198
  117. package/src/social-providers/vk.ts +0 -126
  118. package/src/social-providers/zoom.ts +0 -217
  119. package/src/types/context.ts +0 -269
  120. package/src/types/cookie.ts +0 -7
  121. package/src/types/helper.ts +0 -6
  122. package/src/types/index.ts +0 -21
  123. package/src/types/init-options.ts +0 -1346
  124. package/src/types/plugin-client.ts +0 -100
  125. package/src/types/plugin.ts +0 -158
  126. package/src/utils/error-codes.ts +0 -51
  127. package/tsconfig.json +0 -7
  128. package/tsdown.config.ts +0 -20
  129. /package/{src/index.ts → dist/src/index.d.ts} +0 -0
  130. /package/{src/utils/index.ts → dist/src/utils/index.d.ts} +0 -0
@@ -1,466 +0,0 @@
1
- import type { PayvoAuthOptions } from "../../types";
2
- import type { PayvoAuthDBSchema, DBFieldAttribute } from "../type";
3
-
4
- export type DBAdapterDebugLogOption =
5
- | boolean
6
- | {
7
- /**
8
- * Useful when you want to log only certain conditions.
9
- */
10
- logCondition?: (() => boolean) | undefined;
11
- create?: boolean | undefined;
12
- update?: boolean | undefined;
13
- updateMany?: boolean | undefined;
14
- findOne?: boolean | undefined;
15
- findMany?: boolean | undefined;
16
- delete?: boolean | undefined;
17
- deleteMany?: boolean | undefined;
18
- count?: boolean | undefined;
19
- }
20
- | {
21
- /**
22
- * Only used for adapter tests to show debug logs if a test fails.
23
- *
24
- * @deprecated Not actually deprecated. Doing this for IDEs to show this option at the very bottom and stop end-users from using this.
25
- */
26
- isRunningAdapterTests: boolean;
27
- };
28
-
29
- export type DBAdapterSchemaCreation = {
30
- /**
31
- * Code to be inserted into the file
32
- */
33
- code: string;
34
- /**
35
- * Path to the file, including the file name and extension.
36
- * Relative paths are supported, with the current working directory of the developer's project as the base.
37
- */
38
- path: string;
39
- /**
40
- * Append the file if it already exists.
41
- * Note: This will not apply if `overwrite` is set to true.
42
- */
43
- append?: boolean | undefined;
44
- /**
45
- * Overwrite the file if it already exists
46
- */
47
- overwrite?: boolean | undefined;
48
- };
49
-
50
- export interface DBAdapterFactoryConfig<
51
- Options extends PayvoAuthOptions = PayvoAuthOptions,
52
- > {
53
- /**
54
- * Use plural table names.
55
- *
56
- * All tables will be named with an `s` at the end.
57
- *
58
- * @default false
59
- */
60
- usePlural?: boolean | undefined;
61
- /**
62
- * Enable debug logs.
63
- *
64
- * @default false
65
- */
66
- debugLogs?: DBAdapterDebugLogOption | undefined;
67
- /**
68
- * Name of the adapter.
69
- *
70
- * This is used to identify the adapter in the debug logs.
71
- *
72
- * @default `adapterId`
73
- */
74
- adapterName?: string | undefined;
75
- /**
76
- * Adapter id
77
- */
78
- adapterId: string;
79
- /**
80
- * If the database supports numeric ids, set this to `true`.
81
- *
82
- * @default true
83
- */
84
- supportsNumericIds?: boolean | undefined;
85
- /**
86
- * If the database doesn't support JSON columns, set this to `false`.
87
- *
88
- * We will handle the translation between using `JSON` columns, and saving `string`s to the database.
89
- *
90
- * @default false
91
- */
92
- supportsJSON?: boolean | undefined;
93
- /**
94
- * If the database doesn't support dates, set this to `false`.
95
- *
96
- * We will handle the translation between using `Date` objects, and saving `string`s to the database.
97
- *
98
- * @default true
99
- */
100
- supportsDates?: boolean | undefined;
101
- /**
102
- * If the database doesn't support booleans, set this to `false`.
103
- *
104
- * We will handle the translation between using `boolean`s, and saving `0`s and `1`s to the database.
105
- *
106
- * @default true
107
- */
108
- supportsBooleans?: boolean | undefined;
109
- /**
110
- * Execute multiple operations in a transaction.
111
- *
112
- * If the database doesn't support transactions, set this to `false` and operations will be executed sequentially.
113
- *
114
- * @default false
115
- */
116
- transaction?:
117
- | (
118
- | false
119
- | (<R>(
120
- callback: (trx: DBTransactionAdapter<Options>) => Promise<R>
121
- ) => Promise<R>)
122
- )
123
- | undefined;
124
- /**
125
- * Disable id generation for the `create` method.
126
- *
127
- * This is useful for databases that don't support custom id values and would auto-generate them for you.
128
- *
129
- * @default false
130
- */
131
- disableIdGeneration?: boolean | undefined;
132
- /**
133
- * Map the keys of the input data.
134
- *
135
- * This is useful for databases that expect a different key name for a given situation.
136
- *
137
- * For example, MongoDB uses `_id` while in Better-Auth we use `id`.
138
- *
139
- *
140
- * @example
141
- * Each key represents the old key to replace.
142
- * The value represents the new key
143
- *
144
- * This can be a partial object that only transforms some keys.
145
- *
146
- * ```ts
147
- * mapKeysTransformInput: {
148
- * id: "_id" // We want to replace `id` to `_id` to save into MongoDB
149
- * }
150
- * ```
151
- */
152
- mapKeysTransformInput?: Record<string, string> | undefined;
153
- /**
154
- * Map the keys of the output data.
155
- *
156
- * This is useful for databases that expect a different key name for a given situation.
157
- *
158
- * For example, MongoDB uses `_id` while in Better-Auth we use `id`.
159
- *
160
- * @example
161
- * Each key represents the old key to replace.
162
- * The value represents the new key
163
- *
164
- * This can be a partial object that only transforms some keys.
165
- *
166
- * ```ts
167
- * mapKeysTransformOutput: {
168
- * _id: "id" // In MongoDB, we save `id` as `_id`. So we want to replace `_id` with `id` when we get the data back.
169
- * }
170
- * ```
171
- */
172
- mapKeysTransformOutput?: Record<string, string> | undefined;
173
- /**
174
- * Custom transform input function.
175
- *
176
- * This function is used to transform the input data before it is saved to the database.
177
- */
178
- customTransformInput?:
179
- | ((props: {
180
- data: any;
181
- /**
182
- * The fields of the model.
183
- */
184
- fieldAttributes: DBFieldAttribute;
185
- /**
186
- * The field to transform.
187
- */
188
- field: string;
189
- /**
190
- * The action which was called from the adapter.
191
- */
192
- action: "create" | "update";
193
- /**
194
- * The model name.
195
- */
196
- model: string;
197
- /**
198
- * The schema of the user's Better-Auth instance.
199
- */
200
- schema: PayvoAuthDBSchema;
201
- /**
202
- * The options of the user's Better-Auth instance.
203
- */
204
- options: Options;
205
- }) => any)
206
- | undefined;
207
- /**
208
- * Custom transform output function.
209
- *
210
- * This function is used to transform the output data before it is returned to the user.
211
- */
212
- customTransformOutput?:
213
- | ((props: {
214
- data: any;
215
- /**
216
- * The fields of the model.
217
- */
218
- fieldAttributes: DBFieldAttribute;
219
- /**
220
- * The field to transform.
221
- */
222
- field: string;
223
- /**
224
- * The fields to select.
225
- */
226
- select: string[];
227
- /**
228
- * The model name.
229
- */
230
- model: string;
231
- /**
232
- * The schema of the user's Better-Auth instance.
233
- */
234
- schema: PayvoAuthDBSchema;
235
- /**
236
- * The options of the user's Better-Auth instance.
237
- */
238
- options: Options;
239
- }) => any)
240
- | undefined;
241
- /**
242
- * Custom ID generator function.
243
- *
244
- * By default, we can handle ID generation for you, however if the database your adapter is for only supports a specific custom id generation,
245
- * then you can use this function to generate your own IDs.
246
- *
247
- *
248
- * Notes:
249
- * - If the user enabled `useNumberId`, then this option will be ignored. Unless this adapter config has `supportsNumericIds` set to `false`.
250
- * - If `generateId` is `false` in the user's Better-Auth config, then this option will be ignored.
251
- * - If `generateId` is a function, then it will override this option.
252
- *
253
- * @example
254
- *
255
- * ```ts
256
- * customIdGenerator: ({ model }) => {
257
- * return "my-super-unique-id";
258
- * }
259
- * ```
260
- */
261
- customIdGenerator?: ((props: { model: string }) => string) | undefined;
262
- /**
263
- * Whether to disable the transform output.
264
- * Do not use this option unless you know what you are doing.
265
- * @default false
266
- */
267
- disableTransformOutput?: boolean | undefined;
268
- /**
269
- * Whether to disable the transform input.
270
- * Do not use this option unless you know what you are doing.
271
- * @default false
272
- */
273
- disableTransformInput?: boolean | undefined;
274
- }
275
-
276
- export type Where = {
277
- /**
278
- * @default eq
279
- */
280
- operator?:
281
- | (
282
- | "eq"
283
- | "ne"
284
- | "lt"
285
- | "lte"
286
- | "gt"
287
- | "gte"
288
- | "in"
289
- | "not_in"
290
- | "contains"
291
- | "starts_with"
292
- | "ends_with"
293
- )
294
- | undefined;
295
- value: string | number | boolean | string[] | number[] | Date | null;
296
- field: string;
297
- /**
298
- * @default AND
299
- */
300
- connector?: ("AND" | "OR") | undefined;
301
- };
302
-
303
- export type DBTransactionAdapter<
304
- Options extends PayvoAuthOptions = PayvoAuthOptions,
305
- > = Omit<DBAdapter<Options>, "transaction">;
306
-
307
- export type DBAdapter<Options extends PayvoAuthOptions = PayvoAuthOptions> = {
308
- id: string;
309
- create: <T extends Record<string, any>, R = T>(data: {
310
- model: string;
311
- data: Omit<T, "id">;
312
- select?: string[] | undefined;
313
- /**
314
- * By default, any `id` provided in `data` will be ignored.
315
- *
316
- * If you want to force the `id` to be the same as the `data.id`, set this to `true`.
317
- */
318
- forceAllowId?: boolean | undefined;
319
- }) => Promise<R>;
320
- findOne: <T>(data: {
321
- model: string;
322
- where: Where[];
323
- select?: string[] | undefined;
324
- }) => Promise<T | null>;
325
- findMany: <T>(data: {
326
- model: string;
327
- where?: Where[] | undefined;
328
- limit?: number | undefined;
329
- sortBy?:
330
- | {
331
- field: string;
332
- direction: "asc" | "desc";
333
- }
334
- | undefined;
335
- offset?: number | undefined;
336
- }) => Promise<T[]>;
337
- count: (data: {
338
- model: string;
339
- where?: Where[] | undefined;
340
- }) => Promise<number>;
341
- /**
342
- * ⚠︎ Update may not return the updated data
343
- * if multiple where clauses are provided
344
- */
345
- update: <T>(data: {
346
- model: string;
347
- where: Where[];
348
- update: Record<string, any>;
349
- }) => Promise<T | null>;
350
- updateMany: (data: {
351
- model: string;
352
- where: Where[];
353
- update: Record<string, any>;
354
- }) => Promise<number>;
355
- delete: <T>(data: { model: string; where: Where[] }) => Promise<void>;
356
- deleteMany: (data: { model: string; where: Where[] }) => Promise<number>;
357
- /**
358
- * Execute multiple operations in a transaction.
359
- * If the adapter doesn't support transactions, operations will be executed sequentially.
360
- */
361
- transaction: <R>(
362
- callback: (trx: DBTransactionAdapter<Options>) => Promise<R>
363
- ) => Promise<R>;
364
- /**
365
- *
366
- * @param options
367
- * @param file - file path if provided by the user
368
- */
369
- createSchema?:
370
- | ((options: Options, file?: string) => Promise<DBAdapterSchemaCreation>)
371
- | undefined;
372
- options?:
373
- | ({
374
- adapterConfig: DBAdapterFactoryConfig<Options>;
375
- } & CustomAdapter["options"])
376
- | undefined;
377
- };
378
-
379
- export type CleanedWhere = Required<Where>;
380
-
381
- export interface CustomAdapter {
382
- create: <T extends Record<string, any>>({
383
- data,
384
- model,
385
- select,
386
- }: {
387
- model: string;
388
- data: T;
389
- select?: string[] | undefined;
390
- }) => Promise<T>;
391
- update: <T>(data: {
392
- model: string;
393
- where: CleanedWhere[];
394
- update: T;
395
- }) => Promise<T | null>;
396
- updateMany: (data: {
397
- model: string;
398
- where: CleanedWhere[];
399
- update: Record<string, any>;
400
- }) => Promise<number>;
401
- findOne: <T>({
402
- model,
403
- where,
404
- select,
405
- }: {
406
- model: string;
407
- where: CleanedWhere[];
408
- select?: string[] | undefined;
409
- }) => Promise<T | null>;
410
- findMany: <T>({
411
- model,
412
- where,
413
- limit,
414
- sortBy,
415
- offset,
416
- }: {
417
- model: string;
418
- where?: CleanedWhere[] | undefined;
419
- limit: number;
420
- sortBy?: { field: string; direction: "asc" | "desc" } | undefined;
421
- offset?: number | undefined;
422
- }) => Promise<T[]>;
423
- delete: ({
424
- model,
425
- where,
426
- }: {
427
- model: string;
428
- where: CleanedWhere[];
429
- }) => Promise<void>;
430
- deleteMany: ({
431
- model,
432
- where,
433
- }: {
434
- model: string;
435
- where: CleanedWhere[];
436
- }) => Promise<number>;
437
- count: ({
438
- model,
439
- where,
440
- }: {
441
- model: string;
442
- where?: CleanedWhere[] | undefined;
443
- }) => Promise<number>;
444
- createSchema?:
445
- | ((props: {
446
- /**
447
- * The file the user may have passed in to the `generate` command as the expected schema file output path.
448
- */
449
- file?: string;
450
- /**
451
- * The tables from the user's Better-Auth instance schema.
452
- */
453
- tables: PayvoAuthDBSchema;
454
- }) => Promise<DBAdapterSchemaCreation>)
455
- | undefined;
456
- /**
457
- * Your adapter's options.
458
- */
459
- options?: Record<string, any> | undefined;
460
- }
461
-
462
- export interface DBAdapterInstance<
463
- Options extends PayvoAuthOptions = PayvoAuthOptions,
464
- > {
465
- (options: PayvoAuthOptions): DBAdapter<Options>;
466
- }
package/src/db/plugin.ts DELETED
@@ -1,11 +0,0 @@
1
- import type { DBFieldAttribute } from "./type";
2
-
3
- export type PayvoAuthPluginDBSchema = {
4
- [table in string]: {
5
- fields: {
6
- [field: string]: DBFieldAttribute;
7
- };
8
- disableMigration?: boolean | undefined;
9
- modelName?: string | undefined;
10
- };
11
- };
@@ -1,34 +0,0 @@
1
- import * as z from "zod";
2
- import { coreSchema } from "./shared";
3
-
4
- export const accountSchema = coreSchema.extend({
5
- providerId: z.string(),
6
- accountId: z.string(),
7
- userId: z.coerce.string(),
8
- accessToken: z.string().nullish(),
9
- refreshToken: z.string().nullish(),
10
- idToken: z.string().nullish(),
11
- /**
12
- * Access token expires at
13
- */
14
- accessTokenExpiresAt: z.date().nullish(),
15
- /**
16
- * Refresh token expires at
17
- */
18
- refreshTokenExpiresAt: z.date().nullish(),
19
- /**
20
- * The scopes that the user has authorized
21
- */
22
- scope: z.string().nullish(),
23
- /**
24
- * Password is only stored in the credential provider
25
- */
26
- password: z.string().nullish(),
27
- });
28
-
29
- /**
30
- * Account schema type used by payvo-auth, note that it's possible that account could have additional fields
31
- *
32
- * todo: we should use generics to extend this type with additional fields from plugins and options in the future
33
- */
34
- export type Account = z.infer<typeof accountSchema>;
@@ -1,21 +0,0 @@
1
- import * as z from "zod";
2
-
3
- export const rateLimitSchema = z.object({
4
- /**
5
- * The key to use for rate limiting
6
- */
7
- key: z.string(),
8
- /**
9
- * The number of requests made
10
- */
11
- count: z.number(),
12
- /**
13
- * The last request time in milliseconds
14
- */
15
- lastRequest: z.number(),
16
- });
17
-
18
- /**
19
- * Rate limit schema type used by payvo-auth for rate limiting
20
- */
21
- export type RateLimit = z.infer<typeof rateLimitSchema>;
@@ -1,17 +0,0 @@
1
- import * as z from "zod";
2
- import { coreSchema } from "./shared";
3
-
4
- export const sessionSchema = coreSchema.extend({
5
- userId: z.coerce.string(),
6
- expiresAt: z.date(),
7
- token: z.string(),
8
- ipAddress: z.string().nullish(),
9
- userAgent: z.string().nullish(),
10
- });
11
-
12
- /**
13
- * Session schema type used by payvo-auth, note that it's possible that session could have additional fields
14
- *
15
- * todo: we should use generics to extend this type with additional fields from plugins and options in the future
16
- */
17
- export type Session = z.infer<typeof sessionSchema>;
@@ -1,7 +0,0 @@
1
- import * as z from "zod";
2
-
3
- export const coreSchema = z.object({
4
- id: z.string(),
5
- createdAt: z.date().default(() => new Date()),
6
- updatedAt: z.date().default(() => new Date()),
7
- });
@@ -1,16 +0,0 @@
1
- import * as z from "zod";
2
- import { coreSchema } from "./shared";
3
-
4
- export const userSchema = coreSchema.extend({
5
- email: z.string().transform((val) => val.toLowerCase()),
6
- emailVerified: z.boolean().default(false),
7
- name: z.string(),
8
- image: z.string().nullish(),
9
- });
10
-
11
- /**
12
- * User schema type used by payvo-auth, note that it's possible that user could have additional fields
13
- *
14
- * todo: we should use generics to extend this type with additional fields from plugins and options in the future
15
- */
16
- export type User = z.infer<typeof userSchema>;