@witchcraft/nuxt-auth 0.5.1 → 0.6.0-beta.1
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/README.md +189 -337
- package/dist/module.d.mts +64 -41
- package/dist/module.json +1 -1
- package/dist/module.mjs +25 -35
- package/dist/runtime/components/ExternalCallback.vue +11 -11
- package/dist/runtime/components/LoginProviderButtons.client.d.vue.ts +10 -15
- package/dist/runtime/components/LoginProviderButtons.client.vue +12 -11
- package/dist/runtime/components/LoginProviderButtons.client.vue.d.ts +10 -15
- package/dist/runtime/components/MockBypassRegistrationFields.d.vue.ts +13 -0
- package/dist/runtime/components/MockBypassRegistrationFields.vue +18 -0
- package/dist/runtime/components/MockBypassRegistrationFields.vue.d.ts +13 -0
- package/dist/runtime/components/Mocker.d.vue.ts +5 -1
- package/dist/runtime/components/Mocker.vue +7 -10
- package/dist/runtime/components/Mocker.vue.d.ts +5 -1
- package/dist/runtime/components/SessionStatus.d.vue.ts +86 -42
- package/dist/runtime/components/SessionStatus.vue +29 -8
- package/dist/runtime/components/SessionStatus.vue.d.ts +86 -42
- package/dist/runtime/components/UserRegistration.d.vue.ts +5 -0
- package/dist/runtime/components/UserRegistration.vue +2 -0
- package/dist/runtime/components/UserRegistration.vue.d.ts +5 -0
- package/dist/runtime/composables/useAuth.d.ts +382 -19
- package/dist/runtime/composables/useAuth.js +191 -28
- package/dist/runtime/composables/useAuthExternalCallback.d.ts +13 -6
- package/dist/runtime/composables/useAuthExternalCallback.js +27 -16
- package/dist/runtime/composables/useAuthExternalCode.d.ts +2 -2
- package/dist/runtime/composables/useAuthExternalCode.js +19 -18
- package/dist/runtime/composables/useAuthMocker.d.ts +11 -1
- package/dist/runtime/composables/useAuthMocker.js +21 -11
- package/dist/runtime/composables/useAuthUserRegistration.d.ts +5 -10
- package/dist/runtime/composables/useAuthUserRegistration.js +12 -25
- package/dist/runtime/core/providerStyles.js +12 -4
- package/dist/runtime/electron/index.d.ts +1 -0
- package/dist/runtime/electron/index.js +1 -0
- package/dist/runtime/electron/main/ElectronAuth.d.ts +123 -0
- package/dist/runtime/electron/main/ElectronAuth.js +200 -0
- package/dist/runtime/electron/main/index.d.ts +2 -0
- package/dist/runtime/electron/main/index.js +2 -0
- package/dist/runtime/electron/main/setupElectronAuthMain.d.ts +665 -0
- package/dist/runtime/electron/main/setupElectronAuthMain.js +137 -0
- package/dist/runtime/electron/preload/createElectronAuthApi.d.ts +7 -0
- package/dist/runtime/electron/preload/createElectronAuthApi.js +15 -0
- package/dist/runtime/electron/preload/index.d.ts +2 -0
- package/dist/runtime/electron/preload/index.js +2 -0
- package/dist/runtime/electron/types.d.ts +54 -0
- package/dist/runtime/electron/types.js +2 -0
- package/dist/runtime/middleware/authGlobal.js +30 -14
- package/dist/runtime/middleware/authProtected.js +2 -2
- package/dist/runtime/plugins/client/electronNuxtAuthPlugin.d.ts +48 -0
- package/dist/runtime/plugins/client/electronNuxtAuthPlugin.js +86 -0
- package/dist/runtime/plugins/client/localOnlyUsers.d.ts +25 -0
- package/dist/runtime/plugins/client/localOnlyUsers.js +110 -0
- package/dist/runtime/plugins/server/devMock.d.ts +51 -0
- package/dist/runtime/plugins/server/devMock.js +162 -0
- package/dist/runtime/server/utils/assertEventWithAuthorizedUser.d.ts +11 -0
- package/dist/runtime/server/utils/assertEventWithAuthorizedUser.js +10 -0
- package/dist/runtime/server/utils/createAuthMiddleware.d.ts +4 -4
- package/dist/runtime/server/utils/createAuthMiddleware.js +16 -23
- package/dist/runtime/server/utils/createAuthSchema.d.ts +391 -94
- package/dist/runtime/server/utils/createAuthSchema.js +43 -13
- package/dist/runtime/server/utils/createBetterAuth.d.ts +34 -0
- package/dist/runtime/server/utils/createBetterAuth.js +160 -0
- package/dist/runtime/server/utils/getBetterAuthInstance.d.ts +3 -0
- package/dist/runtime/server/utils/getBetterAuthInstance.js +10 -0
- package/dist/runtime/types.d.ts +358 -248
- package/dist/runtime/types.js +48 -25
- package/dist/runtime/utils/deserializeAuthLocalUser.d.ts +2 -0
- package/dist/runtime/utils/deserializeAuthLocalUser.js +9 -0
- package/package.json +44 -19
- package/dist/runtime/core/providers/github.d.ts +0 -84
- package/dist/runtime/core/providers/github.js +0 -55
- package/dist/runtime/core/providers/google.d.ts +0 -65
- package/dist/runtime/core/providers/google.js +0 -49
- package/dist/runtime/server/helpers/getSafeSecretsInfo.d.ts +0 -4
- package/dist/runtime/server/helpers/getSafeSecretsInfo.js +0 -10
- package/dist/runtime/server/helpers/logSafeRoute.d.ts +0 -1
- package/dist/runtime/server/helpers/logSafeRoute.js +0 -3
- package/dist/runtime/server/helpers/signJwt.d.ts +0 -3
- package/dist/runtime/server/helpers/signJwt.js +0 -16
- package/dist/runtime/server/helpers/verifyJwt.d.ts +0 -5
- package/dist/runtime/server/helpers/verifyJwt.js +0 -19
- package/dist/runtime/server/utils/Auth.d.ts +0 -85
- package/dist/runtime/server/utils/Auth.js +0 -671
- package/dist/runtime/server/utils/SessionManager.d.ts +0 -26
- package/dist/runtime/server/utils/SessionManager.js +0 -94
- package/dist/runtime/server/utils/createAuthHandler.d.ts +0 -9
- package/dist/runtime/server/utils/createAuthHandler.js +0 -29
- package/dist/runtime/utils/createExternalAuthLoginHandler.d.ts +0 -37
- package/dist/runtime/utils/createExternalAuthLoginHandler.js +0 -23
- package/dist/runtime/utils/getAuthApiRoute.d.ts +0 -6
- package/dist/runtime/utils/getAuthApiRoute.js +0 -14
|
@@ -1,19 +1,54 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type PgColumnBuilderBase, type PgTableWithColumns } from "drizzle-orm/pg-core";
|
|
2
|
+
/**
|
|
3
|
+
* Coopy of the better-auth user shape + username and isRegistered.
|
|
4
|
+
*
|
|
5
|
+
* Core fields match https://www.better-auth.com/docs/concepts/database#user
|
|
6
|
+
*
|
|
7
|
+
* `username` matches the username plugin schema https://www.better-auth.com/docs/plugins/username#schema
|
|
8
|
+
*
|
|
9
|
+
* `isRegistered` is this module's own field, set through better-auth's `user.additionalFields`.
|
|
10
|
+
*/
|
|
2
11
|
export declare const authUserFields: {
|
|
12
|
+
id: import("drizzle-orm").IsPrimaryKey<import("drizzle-orm").NotNull<import("drizzle-orm/pg-core").PgUUIDBuilderInitial<"id">>>;
|
|
3
13
|
email: import("drizzle-orm").NotNull<import("drizzle-orm/pg-core").PgTextBuilderInitial<"email", [string, ...string[]]>>;
|
|
14
|
+
emailVerified: import("drizzle-orm").NotNull<import("drizzle-orm").HasDefault<import("drizzle-orm/pg-core").PgBooleanBuilderInitial<"emailVerified">>>;
|
|
15
|
+
name: import("drizzle-orm").NotNull<import("drizzle-orm/pg-core").PgTextBuilderInitial<"name", [string, ...string[]]>>;
|
|
16
|
+
image: import("drizzle-orm/pg-core").PgTextBuilderInitial<"image", [string, ...string[]]>;
|
|
17
|
+
username: import("drizzle-orm/pg-core").PgTextBuilderInitial<"username", [string, ...string[]]>;
|
|
4
18
|
isRegistered: import("drizzle-orm").NotNull<import("drizzle-orm").HasDefault<import("drizzle-orm/pg-core").PgBooleanBuilderInitial<"isRegistered">>>;
|
|
19
|
+
createdAt: import("drizzle-orm").HasDefault<import("drizzle-orm").NotNull<import("drizzle-orm/pg-core").PgTimestampBuilderInitial<"createdAt">>>;
|
|
20
|
+
updatedAt: import("drizzle-orm").HasDefault<import("drizzle-orm").NotNull<import("drizzle-orm/pg-core").PgTimestampBuilderInitial<"updatedAt">>>;
|
|
5
21
|
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Builds the app's `users` table from the module's fields, with any column overridable.
|
|
24
|
+
* e.g. `createAuthUserSchema({ id: uuid("id").primaryKey().default(sql`gen_random_uuid()`) })`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function createAuthUserSchema<T extends Partial<Record<"id" | keyof typeof authUserFields, PgColumnBuilderBase>> = Record<never, never>>(overrides?: T): PgTableWithColumns<{
|
|
27
|
+
name: "users";
|
|
28
|
+
schema: undefined;
|
|
29
|
+
columns: {
|
|
30
|
+
id: import("drizzle-orm").IsPrimaryKey<import("drizzle-orm").NotNull<import("drizzle-orm/pg-core").PgUUIDBuilderInitial<"id">>>;
|
|
31
|
+
email: import("drizzle-orm").NotNull<import("drizzle-orm/pg-core").PgTextBuilderInitial<"email", [string, ...string[]]>>;
|
|
32
|
+
emailVerified: import("drizzle-orm").NotNull<import("drizzle-orm").HasDefault<import("drizzle-orm/pg-core").PgBooleanBuilderInitial<"emailVerified">>>;
|
|
33
|
+
name: import("drizzle-orm").NotNull<import("drizzle-orm/pg-core").PgTextBuilderInitial<"name", [string, ...string[]]>>;
|
|
34
|
+
image: import("drizzle-orm/pg-core").PgTextBuilderInitial<"image", [string, ...string[]]>;
|
|
35
|
+
username: import("drizzle-orm/pg-core").PgTextBuilderInitial<"username", [string, ...string[]]>;
|
|
36
|
+
isRegistered: import("drizzle-orm").NotNull<import("drizzle-orm").HasDefault<import("drizzle-orm/pg-core").PgBooleanBuilderInitial<"isRegistered">>>;
|
|
37
|
+
createdAt: import("drizzle-orm").HasDefault<import("drizzle-orm").NotNull<import("drizzle-orm/pg-core").PgTimestampBuilderInitial<"createdAt">>>;
|
|
38
|
+
updatedAt: import("drizzle-orm").HasDefault<import("drizzle-orm").NotNull<import("drizzle-orm/pg-core").PgTimestampBuilderInitial<"updatedAt">>>;
|
|
39
|
+
} & T extends infer T_1 extends Record<string, import("drizzle-orm").ColumnBuilderBase<import("drizzle-orm").ColumnBuilderBaseConfig<import("drizzle-orm").ColumnDataType, string>, object>> ? { [Key in keyof T_1]: import("drizzle-orm").BuildColumn<TTableName, {
|
|
40
|
+
_: Omit<T_1[Key]["_"], "name"> & {
|
|
41
|
+
name: T_1[Key]["_"]["name"] extends "" ? import("drizzle-orm").Assume<Key, string> : T_1[Key]["_"]["name"];
|
|
42
|
+
};
|
|
43
|
+
}, TDialect>; } : never;
|
|
44
|
+
dialect: "pg";
|
|
45
|
+
}>;
|
|
11
46
|
export declare function createAuthSchema(users: AuthUsersTable): {
|
|
12
47
|
authSessions: PgTableWithColumns<{
|
|
13
48
|
name: "authSessions";
|
|
14
49
|
schema: undefined;
|
|
15
50
|
columns: {
|
|
16
|
-
id: PgColumn<{
|
|
51
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
17
52
|
name: "id";
|
|
18
53
|
tableName: "authSessions";
|
|
19
54
|
dataType: "string";
|
|
@@ -30,7 +65,7 @@ export declare function createAuthSchema(users: AuthUsersTable): {
|
|
|
30
65
|
identity: undefined;
|
|
31
66
|
generated: undefined;
|
|
32
67
|
}, {}, {}>;
|
|
33
|
-
userId: PgColumn<{
|
|
68
|
+
userId: import("drizzle-orm/pg-core").PgColumn<{
|
|
34
69
|
name: "userId";
|
|
35
70
|
tableName: "authSessions";
|
|
36
71
|
dataType: "string";
|
|
@@ -47,7 +82,7 @@ export declare function createAuthSchema(users: AuthUsersTable): {
|
|
|
47
82
|
identity: undefined;
|
|
48
83
|
generated: undefined;
|
|
49
84
|
}, {}, {}>;
|
|
50
|
-
expiresAt: PgColumn<{
|
|
85
|
+
expiresAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
51
86
|
name: "expiresAt";
|
|
52
87
|
tableName: "authSessions";
|
|
53
88
|
dataType: "date";
|
|
@@ -64,6 +99,91 @@ export declare function createAuthSchema(users: AuthUsersTable): {
|
|
|
64
99
|
identity: undefined;
|
|
65
100
|
generated: undefined;
|
|
66
101
|
}, {}, {}>;
|
|
102
|
+
token: import("drizzle-orm/pg-core").PgColumn<{
|
|
103
|
+
name: "token";
|
|
104
|
+
tableName: "authSessions";
|
|
105
|
+
dataType: "string";
|
|
106
|
+
columnType: "PgText";
|
|
107
|
+
data: string;
|
|
108
|
+
driverParam: string;
|
|
109
|
+
notNull: true;
|
|
110
|
+
hasDefault: false;
|
|
111
|
+
isPrimaryKey: false;
|
|
112
|
+
isAutoincrement: false;
|
|
113
|
+
hasRuntimeDefault: false;
|
|
114
|
+
enumValues: [string, ...string[]];
|
|
115
|
+
baseColumn: never;
|
|
116
|
+
identity: undefined;
|
|
117
|
+
generated: undefined;
|
|
118
|
+
}, {}, {}>;
|
|
119
|
+
ipAddress: import("drizzle-orm/pg-core").PgColumn<{
|
|
120
|
+
name: "ipAddress";
|
|
121
|
+
tableName: "authSessions";
|
|
122
|
+
dataType: "string";
|
|
123
|
+
columnType: "PgText";
|
|
124
|
+
data: string;
|
|
125
|
+
driverParam: string;
|
|
126
|
+
notNull: false;
|
|
127
|
+
hasDefault: false;
|
|
128
|
+
isPrimaryKey: false;
|
|
129
|
+
isAutoincrement: false;
|
|
130
|
+
hasRuntimeDefault: false;
|
|
131
|
+
enumValues: [string, ...string[]];
|
|
132
|
+
baseColumn: never;
|
|
133
|
+
identity: undefined;
|
|
134
|
+
generated: undefined;
|
|
135
|
+
}, {}, {}>;
|
|
136
|
+
userAgent: import("drizzle-orm/pg-core").PgColumn<{
|
|
137
|
+
name: "userAgent";
|
|
138
|
+
tableName: "authSessions";
|
|
139
|
+
dataType: "string";
|
|
140
|
+
columnType: "PgText";
|
|
141
|
+
data: string;
|
|
142
|
+
driverParam: string;
|
|
143
|
+
notNull: false;
|
|
144
|
+
hasDefault: false;
|
|
145
|
+
isPrimaryKey: false;
|
|
146
|
+
isAutoincrement: false;
|
|
147
|
+
hasRuntimeDefault: false;
|
|
148
|
+
enumValues: [string, ...string[]];
|
|
149
|
+
baseColumn: never;
|
|
150
|
+
identity: undefined;
|
|
151
|
+
generated: undefined;
|
|
152
|
+
}, {}, {}>;
|
|
153
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
154
|
+
name: "createdAt";
|
|
155
|
+
tableName: "authSessions";
|
|
156
|
+
dataType: "date";
|
|
157
|
+
columnType: "PgTimestamp";
|
|
158
|
+
data: Date;
|
|
159
|
+
driverParam: string;
|
|
160
|
+
notNull: true;
|
|
161
|
+
hasDefault: true;
|
|
162
|
+
isPrimaryKey: false;
|
|
163
|
+
isAutoincrement: false;
|
|
164
|
+
hasRuntimeDefault: false;
|
|
165
|
+
enumValues: undefined;
|
|
166
|
+
baseColumn: never;
|
|
167
|
+
identity: undefined;
|
|
168
|
+
generated: undefined;
|
|
169
|
+
}, {}, {}>;
|
|
170
|
+
updatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
171
|
+
name: "updatedAt";
|
|
172
|
+
tableName: "authSessions";
|
|
173
|
+
dataType: "date";
|
|
174
|
+
columnType: "PgTimestamp";
|
|
175
|
+
data: Date;
|
|
176
|
+
driverParam: string;
|
|
177
|
+
notNull: true;
|
|
178
|
+
hasDefault: true;
|
|
179
|
+
isPrimaryKey: false;
|
|
180
|
+
isAutoincrement: false;
|
|
181
|
+
hasRuntimeDefault: false;
|
|
182
|
+
enumValues: undefined;
|
|
183
|
+
baseColumn: never;
|
|
184
|
+
identity: undefined;
|
|
185
|
+
generated: undefined;
|
|
186
|
+
}, {}, {}>;
|
|
67
187
|
};
|
|
68
188
|
dialect: "pg";
|
|
69
189
|
}>;
|
|
@@ -74,7 +194,41 @@ export declare function createAuthSchema(users: AuthUsersTable): {
|
|
|
74
194
|
name: "authAccounts";
|
|
75
195
|
schema: undefined;
|
|
76
196
|
columns: {
|
|
77
|
-
|
|
197
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
198
|
+
name: "id";
|
|
199
|
+
tableName: "authAccounts";
|
|
200
|
+
dataType: "string";
|
|
201
|
+
columnType: "PgText";
|
|
202
|
+
data: string;
|
|
203
|
+
driverParam: string;
|
|
204
|
+
notNull: true;
|
|
205
|
+
hasDefault: false;
|
|
206
|
+
isPrimaryKey: true;
|
|
207
|
+
isAutoincrement: false;
|
|
208
|
+
hasRuntimeDefault: false;
|
|
209
|
+
enumValues: [string, ...string[]];
|
|
210
|
+
baseColumn: never;
|
|
211
|
+
identity: undefined;
|
|
212
|
+
generated: undefined;
|
|
213
|
+
}, {}, {}>;
|
|
214
|
+
accountId: import("drizzle-orm/pg-core").PgColumn<{
|
|
215
|
+
name: "accountId";
|
|
216
|
+
tableName: "authAccounts";
|
|
217
|
+
dataType: "string";
|
|
218
|
+
columnType: "PgText";
|
|
219
|
+
data: string;
|
|
220
|
+
driverParam: string;
|
|
221
|
+
notNull: true;
|
|
222
|
+
hasDefault: false;
|
|
223
|
+
isPrimaryKey: false;
|
|
224
|
+
isAutoincrement: false;
|
|
225
|
+
hasRuntimeDefault: false;
|
|
226
|
+
enumValues: [string, ...string[]];
|
|
227
|
+
baseColumn: never;
|
|
228
|
+
identity: undefined;
|
|
229
|
+
generated: undefined;
|
|
230
|
+
}, {}, {}>;
|
|
231
|
+
providerId: import("drizzle-orm/pg-core").PgColumn<{
|
|
78
232
|
name: "providerId";
|
|
79
233
|
tableName: "authAccounts";
|
|
80
234
|
dataType: "string";
|
|
@@ -91,7 +245,7 @@ export declare function createAuthSchema(users: AuthUsersTable): {
|
|
|
91
245
|
identity: undefined;
|
|
92
246
|
generated: undefined;
|
|
93
247
|
}, {}, {}>;
|
|
94
|
-
userId: PgColumn<{
|
|
248
|
+
userId: import("drizzle-orm/pg-core").PgColumn<{
|
|
95
249
|
name: "userId";
|
|
96
250
|
tableName: "authAccounts";
|
|
97
251
|
dataType: "string";
|
|
@@ -108,14 +262,14 @@ export declare function createAuthSchema(users: AuthUsersTable): {
|
|
|
108
262
|
identity: undefined;
|
|
109
263
|
generated: undefined;
|
|
110
264
|
}, {}, {}>;
|
|
111
|
-
|
|
112
|
-
name: "
|
|
265
|
+
accessToken: import("drizzle-orm/pg-core").PgColumn<{
|
|
266
|
+
name: "accessToken";
|
|
113
267
|
tableName: "authAccounts";
|
|
114
268
|
dataType: "string";
|
|
115
269
|
columnType: "PgText";
|
|
116
270
|
data: string;
|
|
117
271
|
driverParam: string;
|
|
118
|
-
notNull:
|
|
272
|
+
notNull: false;
|
|
119
273
|
hasDefault: false;
|
|
120
274
|
isPrimaryKey: false;
|
|
121
275
|
isAutoincrement: false;
|
|
@@ -125,14 +279,82 @@ export declare function createAuthSchema(users: AuthUsersTable): {
|
|
|
125
279
|
identity: undefined;
|
|
126
280
|
generated: undefined;
|
|
127
281
|
}, {}, {}>;
|
|
128
|
-
|
|
129
|
-
name: "
|
|
282
|
+
refreshToken: import("drizzle-orm/pg-core").PgColumn<{
|
|
283
|
+
name: "refreshToken";
|
|
130
284
|
tableName: "authAccounts";
|
|
131
285
|
dataType: "string";
|
|
132
286
|
columnType: "PgText";
|
|
133
287
|
data: string;
|
|
134
288
|
driverParam: string;
|
|
135
|
-
notNull:
|
|
289
|
+
notNull: false;
|
|
290
|
+
hasDefault: false;
|
|
291
|
+
isPrimaryKey: false;
|
|
292
|
+
isAutoincrement: false;
|
|
293
|
+
hasRuntimeDefault: false;
|
|
294
|
+
enumValues: [string, ...string[]];
|
|
295
|
+
baseColumn: never;
|
|
296
|
+
identity: undefined;
|
|
297
|
+
generated: undefined;
|
|
298
|
+
}, {}, {}>;
|
|
299
|
+
idToken: import("drizzle-orm/pg-core").PgColumn<{
|
|
300
|
+
name: "idToken";
|
|
301
|
+
tableName: "authAccounts";
|
|
302
|
+
dataType: "string";
|
|
303
|
+
columnType: "PgText";
|
|
304
|
+
data: string;
|
|
305
|
+
driverParam: string;
|
|
306
|
+
notNull: false;
|
|
307
|
+
hasDefault: false;
|
|
308
|
+
isPrimaryKey: false;
|
|
309
|
+
isAutoincrement: false;
|
|
310
|
+
hasRuntimeDefault: false;
|
|
311
|
+
enumValues: [string, ...string[]];
|
|
312
|
+
baseColumn: never;
|
|
313
|
+
identity: undefined;
|
|
314
|
+
generated: undefined;
|
|
315
|
+
}, {}, {}>;
|
|
316
|
+
accessTokenExpiresAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
317
|
+
name: "accessTokenExpiresAt";
|
|
318
|
+
tableName: "authAccounts";
|
|
319
|
+
dataType: "date";
|
|
320
|
+
columnType: "PgTimestamp";
|
|
321
|
+
data: Date;
|
|
322
|
+
driverParam: string;
|
|
323
|
+
notNull: false;
|
|
324
|
+
hasDefault: false;
|
|
325
|
+
isPrimaryKey: false;
|
|
326
|
+
isAutoincrement: false;
|
|
327
|
+
hasRuntimeDefault: false;
|
|
328
|
+
enumValues: undefined;
|
|
329
|
+
baseColumn: never;
|
|
330
|
+
identity: undefined;
|
|
331
|
+
generated: undefined;
|
|
332
|
+
}, {}, {}>;
|
|
333
|
+
refreshTokenExpiresAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
334
|
+
name: "refreshTokenExpiresAt";
|
|
335
|
+
tableName: "authAccounts";
|
|
336
|
+
dataType: "date";
|
|
337
|
+
columnType: "PgTimestamp";
|
|
338
|
+
data: Date;
|
|
339
|
+
driverParam: string;
|
|
340
|
+
notNull: false;
|
|
341
|
+
hasDefault: false;
|
|
342
|
+
isPrimaryKey: false;
|
|
343
|
+
isAutoincrement: false;
|
|
344
|
+
hasRuntimeDefault: false;
|
|
345
|
+
enumValues: undefined;
|
|
346
|
+
baseColumn: never;
|
|
347
|
+
identity: undefined;
|
|
348
|
+
generated: undefined;
|
|
349
|
+
}, {}, {}>;
|
|
350
|
+
scope: import("drizzle-orm/pg-core").PgColumn<{
|
|
351
|
+
name: "scope";
|
|
352
|
+
tableName: "authAccounts";
|
|
353
|
+
dataType: "string";
|
|
354
|
+
columnType: "PgText";
|
|
355
|
+
data: string;
|
|
356
|
+
driverParam: string;
|
|
357
|
+
notNull: false;
|
|
136
358
|
hasDefault: false;
|
|
137
359
|
isPrimaryKey: false;
|
|
138
360
|
isAutoincrement: false;
|
|
@@ -142,14 +364,31 @@ export declare function createAuthSchema(users: AuthUsersTable): {
|
|
|
142
364
|
identity: undefined;
|
|
143
365
|
generated: undefined;
|
|
144
366
|
}, {}, {}>;
|
|
145
|
-
|
|
146
|
-
name: "
|
|
367
|
+
password: import("drizzle-orm/pg-core").PgColumn<{
|
|
368
|
+
name: "password";
|
|
147
369
|
tableName: "authAccounts";
|
|
148
|
-
dataType: "
|
|
149
|
-
columnType: "
|
|
150
|
-
data:
|
|
151
|
-
driverParam:
|
|
370
|
+
dataType: "string";
|
|
371
|
+
columnType: "PgText";
|
|
372
|
+
data: string;
|
|
373
|
+
driverParam: string;
|
|
152
374
|
notNull: false;
|
|
375
|
+
hasDefault: false;
|
|
376
|
+
isPrimaryKey: false;
|
|
377
|
+
isAutoincrement: false;
|
|
378
|
+
hasRuntimeDefault: false;
|
|
379
|
+
enumValues: [string, ...string[]];
|
|
380
|
+
baseColumn: never;
|
|
381
|
+
identity: undefined;
|
|
382
|
+
generated: undefined;
|
|
383
|
+
}, {}, {}>;
|
|
384
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
385
|
+
name: "createdAt";
|
|
386
|
+
tableName: "authAccounts";
|
|
387
|
+
dataType: "date";
|
|
388
|
+
columnType: "PgTimestamp";
|
|
389
|
+
data: Date;
|
|
390
|
+
driverParam: string;
|
|
391
|
+
notNull: true;
|
|
153
392
|
hasDefault: true;
|
|
154
393
|
isPrimaryKey: false;
|
|
155
394
|
isAutoincrement: false;
|
|
@@ -158,87 +397,145 @@ export declare function createAuthSchema(users: AuthUsersTable): {
|
|
|
158
397
|
baseColumn: never;
|
|
159
398
|
identity: undefined;
|
|
160
399
|
generated: undefined;
|
|
161
|
-
}, {}, {
|
|
162
|
-
|
|
163
|
-
|
|
400
|
+
}, {}, {}>;
|
|
401
|
+
updatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
402
|
+
name: "updatedAt";
|
|
403
|
+
tableName: "authAccounts";
|
|
404
|
+
dataType: "date";
|
|
405
|
+
columnType: "PgTimestamp";
|
|
406
|
+
data: Date;
|
|
407
|
+
driverParam: string;
|
|
408
|
+
notNull: true;
|
|
409
|
+
hasDefault: true;
|
|
410
|
+
isPrimaryKey: false;
|
|
411
|
+
isAutoincrement: false;
|
|
412
|
+
hasRuntimeDefault: false;
|
|
413
|
+
enumValues: undefined;
|
|
414
|
+
baseColumn: never;
|
|
415
|
+
identity: undefined;
|
|
416
|
+
generated: undefined;
|
|
417
|
+
}, {}, {}>;
|
|
164
418
|
};
|
|
165
419
|
dialect: "pg";
|
|
166
420
|
}>;
|
|
167
421
|
authProvidersRelations: import("drizzle-orm").Relations<"authAccounts", {
|
|
168
422
|
user: import("drizzle-orm").One<any, true>;
|
|
169
423
|
}>;
|
|
424
|
+
authVerifications: PgTableWithColumns<{
|
|
425
|
+
name: "authVerifications";
|
|
426
|
+
schema: undefined;
|
|
427
|
+
columns: {
|
|
428
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
429
|
+
name: "id";
|
|
430
|
+
tableName: "authVerifications";
|
|
431
|
+
dataType: "string";
|
|
432
|
+
columnType: "PgText";
|
|
433
|
+
data: string;
|
|
434
|
+
driverParam: string;
|
|
435
|
+
notNull: true;
|
|
436
|
+
hasDefault: false;
|
|
437
|
+
isPrimaryKey: true;
|
|
438
|
+
isAutoincrement: false;
|
|
439
|
+
hasRuntimeDefault: false;
|
|
440
|
+
enumValues: [string, ...string[]];
|
|
441
|
+
baseColumn: never;
|
|
442
|
+
identity: undefined;
|
|
443
|
+
generated: undefined;
|
|
444
|
+
}, {}, {}>;
|
|
445
|
+
identifier: import("drizzle-orm/pg-core").PgColumn<{
|
|
446
|
+
name: "identifier";
|
|
447
|
+
tableName: "authVerifications";
|
|
448
|
+
dataType: "string";
|
|
449
|
+
columnType: "PgText";
|
|
450
|
+
data: string;
|
|
451
|
+
driverParam: string;
|
|
452
|
+
notNull: true;
|
|
453
|
+
hasDefault: false;
|
|
454
|
+
isPrimaryKey: false;
|
|
455
|
+
isAutoincrement: false;
|
|
456
|
+
hasRuntimeDefault: false;
|
|
457
|
+
enumValues: [string, ...string[]];
|
|
458
|
+
baseColumn: never;
|
|
459
|
+
identity: undefined;
|
|
460
|
+
generated: undefined;
|
|
461
|
+
}, {}, {}>;
|
|
462
|
+
value: import("drizzle-orm/pg-core").PgColumn<{
|
|
463
|
+
name: "value";
|
|
464
|
+
tableName: "authVerifications";
|
|
465
|
+
dataType: "string";
|
|
466
|
+
columnType: "PgText";
|
|
467
|
+
data: string;
|
|
468
|
+
driverParam: string;
|
|
469
|
+
notNull: true;
|
|
470
|
+
hasDefault: false;
|
|
471
|
+
isPrimaryKey: false;
|
|
472
|
+
isAutoincrement: false;
|
|
473
|
+
hasRuntimeDefault: false;
|
|
474
|
+
enumValues: [string, ...string[]];
|
|
475
|
+
baseColumn: never;
|
|
476
|
+
identity: undefined;
|
|
477
|
+
generated: undefined;
|
|
478
|
+
}, {}, {}>;
|
|
479
|
+
expiresAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
480
|
+
name: "expiresAt";
|
|
481
|
+
tableName: "authVerifications";
|
|
482
|
+
dataType: "date";
|
|
483
|
+
columnType: "PgTimestamp";
|
|
484
|
+
data: Date;
|
|
485
|
+
driverParam: string;
|
|
486
|
+
notNull: true;
|
|
487
|
+
hasDefault: false;
|
|
488
|
+
isPrimaryKey: false;
|
|
489
|
+
isAutoincrement: false;
|
|
490
|
+
hasRuntimeDefault: false;
|
|
491
|
+
enumValues: undefined;
|
|
492
|
+
baseColumn: never;
|
|
493
|
+
identity: undefined;
|
|
494
|
+
generated: undefined;
|
|
495
|
+
}, {}, {}>;
|
|
496
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
497
|
+
name: "createdAt";
|
|
498
|
+
tableName: "authVerifications";
|
|
499
|
+
dataType: "date";
|
|
500
|
+
columnType: "PgTimestamp";
|
|
501
|
+
data: Date;
|
|
502
|
+
driverParam: string;
|
|
503
|
+
notNull: true;
|
|
504
|
+
hasDefault: true;
|
|
505
|
+
isPrimaryKey: false;
|
|
506
|
+
isAutoincrement: false;
|
|
507
|
+
hasRuntimeDefault: false;
|
|
508
|
+
enumValues: undefined;
|
|
509
|
+
baseColumn: never;
|
|
510
|
+
identity: undefined;
|
|
511
|
+
generated: undefined;
|
|
512
|
+
}, {}, {}>;
|
|
513
|
+
updatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
514
|
+
name: "updatedAt";
|
|
515
|
+
tableName: "authVerifications";
|
|
516
|
+
dataType: "date";
|
|
517
|
+
columnType: "PgTimestamp";
|
|
518
|
+
data: Date;
|
|
519
|
+
driverParam: string;
|
|
520
|
+
notNull: true;
|
|
521
|
+
hasDefault: true;
|
|
522
|
+
isPrimaryKey: false;
|
|
523
|
+
isAutoincrement: false;
|
|
524
|
+
hasRuntimeDefault: false;
|
|
525
|
+
enumValues: undefined;
|
|
526
|
+
baseColumn: never;
|
|
527
|
+
identity: undefined;
|
|
528
|
+
generated: undefined;
|
|
529
|
+
}, {}, {}>;
|
|
530
|
+
};
|
|
531
|
+
dialect: "pg";
|
|
532
|
+
}>;
|
|
170
533
|
};
|
|
171
534
|
export type AuthAccountsTable = ReturnType<typeof createAuthSchema>["authAccounts"];
|
|
172
535
|
export type AuthSessionsTable = ReturnType<typeof createAuthSchema>["authSessions"];
|
|
173
536
|
export type AuthSessionRelations = ReturnType<typeof createAuthSchema>["authSessionRelations"];
|
|
174
537
|
export type AuthProvidersRelations = ReturnType<typeof createAuthSchema>["authProvidersRelations"];
|
|
538
|
+
export type AuthVerificationsTable = ReturnType<typeof createAuthSchema>["authVerifications"];
|
|
175
539
|
export type AuthAccount = ReturnType<typeof createAuthSchema>["authAccounts"]["$inferSelect"];
|
|
176
540
|
export type AuthSession = ReturnType<typeof createAuthSchema>["authSessions"]["$inferSelect"];
|
|
177
|
-
type
|
|
178
|
-
name: any;
|
|
179
|
-
tableName: any;
|
|
180
|
-
dataType: any;
|
|
181
|
-
columnType: any;
|
|
182
|
-
driverParam: any;
|
|
183
|
-
hasDefault: boolean;
|
|
184
|
-
enumValues: any;
|
|
185
|
-
baseColumn: any;
|
|
186
|
-
isPrimaryKey: any;
|
|
187
|
-
isAutoincrement: any;
|
|
188
|
-
hasRuntimeDefault: any;
|
|
189
|
-
generated: any;
|
|
190
|
-
};
|
|
191
|
-
export type UserTable = PgTableWithColumns<{
|
|
192
|
-
dialect: "pg";
|
|
193
|
-
schema: any;
|
|
194
|
-
name: any;
|
|
195
|
-
columns: {
|
|
196
|
-
id: PgColumn<{
|
|
197
|
-
notNull: true;
|
|
198
|
-
hasDefault: boolean;
|
|
199
|
-
dataType: "string";
|
|
200
|
-
data: string;
|
|
201
|
-
} & Omit<BaseColumn, "hasDefault">>;
|
|
202
|
-
username: PgColumn<{
|
|
203
|
-
notNull: false;
|
|
204
|
-
hasDefault: false;
|
|
205
|
-
dataType: "string";
|
|
206
|
-
data: string;
|
|
207
|
-
} & Omit<BaseColumn, "username">>;
|
|
208
|
-
email: PgColumn<{
|
|
209
|
-
notNull: true;
|
|
210
|
-
dataType: "string";
|
|
211
|
-
data: string;
|
|
212
|
-
} & BaseColumn>;
|
|
213
|
-
isRegistered: PgColumn<{
|
|
214
|
-
notNull: true;
|
|
215
|
-
dataType: "boolean";
|
|
216
|
-
data: boolean;
|
|
217
|
-
hasDefault: true;
|
|
218
|
-
} & Omit<BaseColumn, "hasDefault">>;
|
|
219
|
-
};
|
|
220
|
-
}>;
|
|
221
|
-
export type AuthUsersTable = PgTableWithColumns<{
|
|
222
|
-
dialect: "pg";
|
|
223
|
-
columns: {
|
|
224
|
-
id: PgColumn<{
|
|
225
|
-
name: any;
|
|
226
|
-
tableName: any;
|
|
227
|
-
dataType: any;
|
|
228
|
-
columnType: any;
|
|
229
|
-
data: string;
|
|
230
|
-
driverParam: any;
|
|
231
|
-
notNull: true;
|
|
232
|
-
hasDefault: boolean;
|
|
233
|
-
enumValues: any;
|
|
234
|
-
baseColumn: any;
|
|
235
|
-
isPrimaryKey: any;
|
|
236
|
-
isAutoincrement: any;
|
|
237
|
-
hasRuntimeDefault: any;
|
|
238
|
-
generated: any;
|
|
239
|
-
}, object>;
|
|
240
|
-
};
|
|
241
|
-
schema: any;
|
|
242
|
-
name: any;
|
|
243
|
-
}>;
|
|
244
|
-
export {};
|
|
541
|
+
export type AuthUsersTable = PgTableWithColumns<any>;
|
|
@@ -1,16 +1,32 @@
|
|
|
1
|
-
import { boolean,
|
|
1
|
+
import { boolean, pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
|
|
2
2
|
import { relations } from "drizzle-orm/relations";
|
|
3
3
|
export const authUserFields = {
|
|
4
|
+
id: uuid("id").primaryKey(),
|
|
4
5
|
email: text("email").notNull().unique(),
|
|
5
|
-
|
|
6
|
+
emailVerified: boolean("emailVerified").default(false).notNull(),
|
|
7
|
+
name: text("name").notNull(),
|
|
8
|
+
image: text("image"),
|
|
9
|
+
username: text("username").unique(),
|
|
10
|
+
isRegistered: boolean("isRegistered").default(false).notNull(),
|
|
11
|
+
createdAt: timestamp("createdAt", { mode: "date" }).notNull().defaultNow(),
|
|
12
|
+
updatedAt: timestamp("updatedAt", { mode: "date" }).notNull().defaultNow()
|
|
6
13
|
};
|
|
14
|
+
export function createAuthUserSchema(overrides = {}) {
|
|
15
|
+
return pgTable("users", {
|
|
16
|
+
...authUserFields,
|
|
17
|
+
...overrides
|
|
18
|
+
});
|
|
19
|
+
}
|
|
7
20
|
export function createAuthSchema(users) {
|
|
8
21
|
const authSessions = pgTable("authSessions", {
|
|
9
22
|
id: text("id").primaryKey(),
|
|
10
23
|
userId: uuid("userId").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
11
|
-
expiresAt: timestamp("expiresAt", {
|
|
12
|
-
|
|
13
|
-
|
|
24
|
+
expiresAt: timestamp("expiresAt", { mode: "date" }).notNull(),
|
|
25
|
+
token: text("token").notNull().unique(),
|
|
26
|
+
ipAddress: text("ipAddress"),
|
|
27
|
+
userAgent: text("userAgent"),
|
|
28
|
+
createdAt: timestamp("createdAt", { mode: "date" }).notNull().defaultNow(),
|
|
29
|
+
updatedAt: timestamp("updatedAt", { mode: "date" }).notNull().defaultNow()
|
|
14
30
|
});
|
|
15
31
|
const authSessionRelations = relations(authSessions, ({ one }) => ({
|
|
16
32
|
user: one(users, {
|
|
@@ -19,25 +35,39 @@ export function createAuthSchema(users) {
|
|
|
19
35
|
})
|
|
20
36
|
}));
|
|
21
37
|
const authAccounts = pgTable("authAccounts", {
|
|
22
|
-
|
|
38
|
+
id: text("id").primaryKey(),
|
|
39
|
+
accountId: text("accountId").notNull(),
|
|
23
40
|
providerId: text("providerId").notNull(),
|
|
24
41
|
userId: uuid("userId").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
42
|
+
accessToken: text("accessToken"),
|
|
43
|
+
refreshToken: text("refreshToken"),
|
|
44
|
+
idToken: text("idToken"),
|
|
45
|
+
accessTokenExpiresAt: timestamp("accessTokenExpiresAt", { mode: "date" }),
|
|
46
|
+
refreshTokenExpiresAt: timestamp("refreshTokenExpiresAt", { mode: "date" }),
|
|
47
|
+
scope: text("scope"),
|
|
48
|
+
password: text("password"),
|
|
49
|
+
createdAt: timestamp("createdAt", { mode: "date" }).notNull().defaultNow(),
|
|
50
|
+
updatedAt: timestamp("updatedAt", { mode: "date" }).notNull().defaultNow()
|
|
51
|
+
});
|
|
31
52
|
const authProvidersRelations = relations(authAccounts, ({ one }) => ({
|
|
32
53
|
user: one(users, {
|
|
33
54
|
fields: [authAccounts.userId],
|
|
34
55
|
references: [users.id]
|
|
35
56
|
})
|
|
36
57
|
}));
|
|
58
|
+
const authVerifications = pgTable("authVerifications", {
|
|
59
|
+
id: text("id").primaryKey(),
|
|
60
|
+
identifier: text("identifier").notNull(),
|
|
61
|
+
value: text("value").notNull(),
|
|
62
|
+
expiresAt: timestamp("expiresAt", { mode: "date" }).notNull(),
|
|
63
|
+
createdAt: timestamp("createdAt", { mode: "date" }).notNull().defaultNow(),
|
|
64
|
+
updatedAt: timestamp("updatedAt", { mode: "date" }).notNull().defaultNow()
|
|
65
|
+
});
|
|
37
66
|
return {
|
|
38
67
|
authSessions,
|
|
39
68
|
authSessionRelations,
|
|
40
69
|
authAccounts,
|
|
41
|
-
authProvidersRelations
|
|
70
|
+
authProvidersRelations,
|
|
71
|
+
authVerifications
|
|
42
72
|
};
|
|
43
73
|
}
|