@auth/drizzle-adapter 0.0.0-manual.ffc00566 → 0.1.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/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +4 -4
- package/lib/mysql.d.ts +441 -0
- package/lib/mysql.d.ts.map +1 -1
- package/lib/mysql.js +14 -20
- package/lib/pg.d.ts +441 -0
- package/lib/pg.d.ts.map +1 -1
- package/lib/pg.js +15 -21
- package/lib/sqlite.d.ts +441 -0
- package/lib/sqlite.d.ts.map +1 -1
- package/lib/sqlite.js +15 -21
- package/lib/utils.d.ts +9 -6
- package/lib/utils.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +4 -4
- package/src/lib/mysql.ts +16 -21
- package/src/lib/pg.ts +18 -23
- package/src/lib/sqlite.ts +17 -22
- package/src/lib/utils.ts +10 -6
package/lib/pg.d.ts
CHANGED
|
@@ -1,2 +1,443 @@
|
|
|
1
|
+
import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
|
|
2
|
+
import type { Adapter } from "@auth/core/adapters";
|
|
3
|
+
export declare const users: import("drizzle-orm/db.d-b9835153").az<{
|
|
4
|
+
name: "users";
|
|
5
|
+
schema: undefined;
|
|
6
|
+
columns: {
|
|
7
|
+
id: import("drizzle-orm/pg-core").PgText<{
|
|
8
|
+
tableName: "users";
|
|
9
|
+
enumValues: [string, ...string[]];
|
|
10
|
+
name: "id";
|
|
11
|
+
data: string;
|
|
12
|
+
driverParam: string;
|
|
13
|
+
hasDefault: false;
|
|
14
|
+
notNull: true;
|
|
15
|
+
}>;
|
|
16
|
+
name: import("drizzle-orm/pg-core").PgText<{
|
|
17
|
+
tableName: "users";
|
|
18
|
+
name: "name";
|
|
19
|
+
data: string;
|
|
20
|
+
enumValues: [string, ...string[]];
|
|
21
|
+
driverParam: string;
|
|
22
|
+
notNull: false;
|
|
23
|
+
hasDefault: false;
|
|
24
|
+
}>;
|
|
25
|
+
email: import("drizzle-orm/pg-core").PgText<{
|
|
26
|
+
tableName: "users";
|
|
27
|
+
enumValues: [string, ...string[]];
|
|
28
|
+
name: "email";
|
|
29
|
+
data: string;
|
|
30
|
+
driverParam: string;
|
|
31
|
+
hasDefault: false;
|
|
32
|
+
notNull: true;
|
|
33
|
+
}>;
|
|
34
|
+
emailVerified: import("drizzle-orm/pg-core").PgTimestamp<{
|
|
35
|
+
tableName: "users";
|
|
36
|
+
name: "emailVerified";
|
|
37
|
+
data: Date;
|
|
38
|
+
driverParam: string;
|
|
39
|
+
notNull: false;
|
|
40
|
+
hasDefault: false;
|
|
41
|
+
}>;
|
|
42
|
+
image: import("drizzle-orm/pg-core").PgText<{
|
|
43
|
+
tableName: "users";
|
|
44
|
+
name: "image";
|
|
45
|
+
data: string;
|
|
46
|
+
enumValues: [string, ...string[]];
|
|
47
|
+
driverParam: string;
|
|
48
|
+
notNull: false;
|
|
49
|
+
hasDefault: false;
|
|
50
|
+
}>;
|
|
51
|
+
};
|
|
52
|
+
}>;
|
|
53
|
+
export declare const accounts: import("drizzle-orm/db.d-b9835153").az<{
|
|
54
|
+
name: "accounts";
|
|
55
|
+
schema: undefined;
|
|
56
|
+
columns: {
|
|
57
|
+
userId: import("drizzle-orm/pg-core").PgText<{
|
|
58
|
+
tableName: "accounts";
|
|
59
|
+
enumValues: [string, ...string[]];
|
|
60
|
+
name: "userId";
|
|
61
|
+
data: string;
|
|
62
|
+
driverParam: string;
|
|
63
|
+
hasDefault: false;
|
|
64
|
+
notNull: true;
|
|
65
|
+
}>;
|
|
66
|
+
type: import("drizzle-orm/pg-core").PgText<{
|
|
67
|
+
tableName: "accounts";
|
|
68
|
+
enumValues: [string, ...string[]];
|
|
69
|
+
name: "type";
|
|
70
|
+
data: "email" | "oidc" | "oauth";
|
|
71
|
+
driverParam: string;
|
|
72
|
+
hasDefault: false;
|
|
73
|
+
notNull: true;
|
|
74
|
+
}>;
|
|
75
|
+
provider: import("drizzle-orm/pg-core").PgText<{
|
|
76
|
+
tableName: "accounts";
|
|
77
|
+
enumValues: [string, ...string[]];
|
|
78
|
+
name: "provider";
|
|
79
|
+
data: string;
|
|
80
|
+
driverParam: string;
|
|
81
|
+
hasDefault: false;
|
|
82
|
+
notNull: true;
|
|
83
|
+
}>;
|
|
84
|
+
providerAccountId: import("drizzle-orm/pg-core").PgText<{
|
|
85
|
+
tableName: "accounts";
|
|
86
|
+
enumValues: [string, ...string[]];
|
|
87
|
+
name: "providerAccountId";
|
|
88
|
+
data: string;
|
|
89
|
+
driverParam: string;
|
|
90
|
+
hasDefault: false;
|
|
91
|
+
notNull: true;
|
|
92
|
+
}>;
|
|
93
|
+
refresh_token: import("drizzle-orm/pg-core").PgText<{
|
|
94
|
+
tableName: "accounts";
|
|
95
|
+
name: "refresh_token";
|
|
96
|
+
data: string;
|
|
97
|
+
enumValues: [string, ...string[]];
|
|
98
|
+
driverParam: string;
|
|
99
|
+
notNull: false;
|
|
100
|
+
hasDefault: false;
|
|
101
|
+
}>;
|
|
102
|
+
access_token: import("drizzle-orm/pg-core").PgText<{
|
|
103
|
+
tableName: "accounts";
|
|
104
|
+
name: "access_token";
|
|
105
|
+
data: string;
|
|
106
|
+
enumValues: [string, ...string[]];
|
|
107
|
+
driverParam: string;
|
|
108
|
+
notNull: false;
|
|
109
|
+
hasDefault: false;
|
|
110
|
+
}>;
|
|
111
|
+
expires_at: import("drizzle-orm/pg-core").PgInteger<{
|
|
112
|
+
tableName: "accounts";
|
|
113
|
+
name: "expires_at";
|
|
114
|
+
data: number;
|
|
115
|
+
driverParam: string | number;
|
|
116
|
+
hasDefault: false;
|
|
117
|
+
notNull: false;
|
|
118
|
+
}>;
|
|
119
|
+
token_type: import("drizzle-orm/pg-core").PgText<{
|
|
120
|
+
tableName: "accounts";
|
|
121
|
+
name: "token_type";
|
|
122
|
+
data: string;
|
|
123
|
+
enumValues: [string, ...string[]];
|
|
124
|
+
driverParam: string;
|
|
125
|
+
notNull: false;
|
|
126
|
+
hasDefault: false;
|
|
127
|
+
}>;
|
|
128
|
+
scope: import("drizzle-orm/pg-core").PgText<{
|
|
129
|
+
tableName: "accounts";
|
|
130
|
+
name: "scope";
|
|
131
|
+
data: string;
|
|
132
|
+
enumValues: [string, ...string[]];
|
|
133
|
+
driverParam: string;
|
|
134
|
+
notNull: false;
|
|
135
|
+
hasDefault: false;
|
|
136
|
+
}>;
|
|
137
|
+
id_token: import("drizzle-orm/pg-core").PgText<{
|
|
138
|
+
tableName: "accounts";
|
|
139
|
+
name: "id_token";
|
|
140
|
+
data: string;
|
|
141
|
+
enumValues: [string, ...string[]];
|
|
142
|
+
driverParam: string;
|
|
143
|
+
notNull: false;
|
|
144
|
+
hasDefault: false;
|
|
145
|
+
}>;
|
|
146
|
+
session_state: import("drizzle-orm/pg-core").PgText<{
|
|
147
|
+
tableName: "accounts";
|
|
148
|
+
name: "session_state";
|
|
149
|
+
data: string;
|
|
150
|
+
enumValues: [string, ...string[]];
|
|
151
|
+
driverParam: string;
|
|
152
|
+
notNull: false;
|
|
153
|
+
hasDefault: false;
|
|
154
|
+
}>;
|
|
155
|
+
};
|
|
156
|
+
}>;
|
|
157
|
+
export declare const sessions: import("drizzle-orm/db.d-b9835153").az<{
|
|
158
|
+
name: "sessions";
|
|
159
|
+
schema: undefined;
|
|
160
|
+
columns: {
|
|
161
|
+
sessionToken: import("drizzle-orm/pg-core").PgText<{
|
|
162
|
+
tableName: "sessions";
|
|
163
|
+
enumValues: [string, ...string[]];
|
|
164
|
+
name: "sessionToken";
|
|
165
|
+
data: string;
|
|
166
|
+
driverParam: string;
|
|
167
|
+
hasDefault: false;
|
|
168
|
+
notNull: true;
|
|
169
|
+
}>;
|
|
170
|
+
userId: import("drizzle-orm/pg-core").PgText<{
|
|
171
|
+
tableName: "sessions";
|
|
172
|
+
enumValues: [string, ...string[]];
|
|
173
|
+
name: "userId";
|
|
174
|
+
data: string;
|
|
175
|
+
driverParam: string;
|
|
176
|
+
hasDefault: false;
|
|
177
|
+
notNull: true;
|
|
178
|
+
}>;
|
|
179
|
+
expires: import("drizzle-orm/pg-core").PgTimestamp<{
|
|
180
|
+
tableName: "sessions";
|
|
181
|
+
name: "expires";
|
|
182
|
+
data: Date;
|
|
183
|
+
driverParam: string;
|
|
184
|
+
hasDefault: false;
|
|
185
|
+
notNull: true;
|
|
186
|
+
}>;
|
|
187
|
+
};
|
|
188
|
+
}>;
|
|
189
|
+
export declare const verificationTokens: import("drizzle-orm/db.d-b9835153").az<{
|
|
190
|
+
name: "verificationToken";
|
|
191
|
+
schema: undefined;
|
|
192
|
+
columns: {
|
|
193
|
+
identifier: import("drizzle-orm/pg-core").PgText<{
|
|
194
|
+
tableName: "verificationToken";
|
|
195
|
+
enumValues: [string, ...string[]];
|
|
196
|
+
name: "identifier";
|
|
197
|
+
data: string;
|
|
198
|
+
driverParam: string;
|
|
199
|
+
hasDefault: false;
|
|
200
|
+
notNull: true;
|
|
201
|
+
}>;
|
|
202
|
+
token: import("drizzle-orm/pg-core").PgText<{
|
|
203
|
+
tableName: "verificationToken";
|
|
204
|
+
enumValues: [string, ...string[]];
|
|
205
|
+
name: "token";
|
|
206
|
+
data: string;
|
|
207
|
+
driverParam: string;
|
|
208
|
+
hasDefault: false;
|
|
209
|
+
notNull: true;
|
|
210
|
+
}>;
|
|
211
|
+
expires: import("drizzle-orm/pg-core").PgTimestamp<{
|
|
212
|
+
tableName: "verificationToken";
|
|
213
|
+
name: "expires";
|
|
214
|
+
data: Date;
|
|
215
|
+
driverParam: string;
|
|
216
|
+
hasDefault: false;
|
|
217
|
+
notNull: true;
|
|
218
|
+
}>;
|
|
219
|
+
};
|
|
220
|
+
}>;
|
|
221
|
+
export declare const schema: {
|
|
222
|
+
users: import("drizzle-orm/db.d-b9835153").az<{
|
|
223
|
+
name: "users";
|
|
224
|
+
schema: undefined;
|
|
225
|
+
columns: {
|
|
226
|
+
id: import("drizzle-orm/pg-core").PgText<{
|
|
227
|
+
tableName: "users";
|
|
228
|
+
enumValues: [string, ...string[]];
|
|
229
|
+
name: "id";
|
|
230
|
+
data: string;
|
|
231
|
+
driverParam: string;
|
|
232
|
+
hasDefault: false;
|
|
233
|
+
notNull: true;
|
|
234
|
+
}>;
|
|
235
|
+
name: import("drizzle-orm/pg-core").PgText<{
|
|
236
|
+
tableName: "users";
|
|
237
|
+
name: "name";
|
|
238
|
+
data: string;
|
|
239
|
+
enumValues: [string, ...string[]];
|
|
240
|
+
driverParam: string;
|
|
241
|
+
notNull: false;
|
|
242
|
+
hasDefault: false;
|
|
243
|
+
}>;
|
|
244
|
+
email: import("drizzle-orm/pg-core").PgText<{
|
|
245
|
+
tableName: "users";
|
|
246
|
+
enumValues: [string, ...string[]];
|
|
247
|
+
name: "email";
|
|
248
|
+
data: string;
|
|
249
|
+
driverParam: string;
|
|
250
|
+
hasDefault: false;
|
|
251
|
+
notNull: true;
|
|
252
|
+
}>;
|
|
253
|
+
emailVerified: import("drizzle-orm/pg-core").PgTimestamp<{
|
|
254
|
+
tableName: "users";
|
|
255
|
+
name: "emailVerified";
|
|
256
|
+
data: Date;
|
|
257
|
+
driverParam: string;
|
|
258
|
+
notNull: false;
|
|
259
|
+
hasDefault: false;
|
|
260
|
+
}>;
|
|
261
|
+
image: import("drizzle-orm/pg-core").PgText<{
|
|
262
|
+
tableName: "users";
|
|
263
|
+
name: "image";
|
|
264
|
+
data: string;
|
|
265
|
+
enumValues: [string, ...string[]];
|
|
266
|
+
driverParam: string;
|
|
267
|
+
notNull: false;
|
|
268
|
+
hasDefault: false;
|
|
269
|
+
}>;
|
|
270
|
+
};
|
|
271
|
+
}>;
|
|
272
|
+
accounts: import("drizzle-orm/db.d-b9835153").az<{
|
|
273
|
+
name: "accounts";
|
|
274
|
+
schema: undefined;
|
|
275
|
+
columns: {
|
|
276
|
+
userId: import("drizzle-orm/pg-core").PgText<{
|
|
277
|
+
tableName: "accounts";
|
|
278
|
+
enumValues: [string, ...string[]];
|
|
279
|
+
name: "userId";
|
|
280
|
+
data: string;
|
|
281
|
+
driverParam: string;
|
|
282
|
+
hasDefault: false;
|
|
283
|
+
notNull: true;
|
|
284
|
+
}>;
|
|
285
|
+
type: import("drizzle-orm/pg-core").PgText<{
|
|
286
|
+
tableName: "accounts";
|
|
287
|
+
enumValues: [string, ...string[]];
|
|
288
|
+
name: "type";
|
|
289
|
+
data: "email" | "oidc" | "oauth";
|
|
290
|
+
driverParam: string;
|
|
291
|
+
hasDefault: false;
|
|
292
|
+
notNull: true;
|
|
293
|
+
}>;
|
|
294
|
+
provider: import("drizzle-orm/pg-core").PgText<{
|
|
295
|
+
tableName: "accounts";
|
|
296
|
+
enumValues: [string, ...string[]];
|
|
297
|
+
name: "provider";
|
|
298
|
+
data: string;
|
|
299
|
+
driverParam: string;
|
|
300
|
+
hasDefault: false;
|
|
301
|
+
notNull: true;
|
|
302
|
+
}>;
|
|
303
|
+
providerAccountId: import("drizzle-orm/pg-core").PgText<{
|
|
304
|
+
tableName: "accounts";
|
|
305
|
+
enumValues: [string, ...string[]];
|
|
306
|
+
name: "providerAccountId";
|
|
307
|
+
data: string;
|
|
308
|
+
driverParam: string;
|
|
309
|
+
hasDefault: false;
|
|
310
|
+
notNull: true;
|
|
311
|
+
}>;
|
|
312
|
+
refresh_token: import("drizzle-orm/pg-core").PgText<{
|
|
313
|
+
tableName: "accounts";
|
|
314
|
+
name: "refresh_token";
|
|
315
|
+
data: string;
|
|
316
|
+
enumValues: [string, ...string[]];
|
|
317
|
+
driverParam: string;
|
|
318
|
+
notNull: false;
|
|
319
|
+
hasDefault: false;
|
|
320
|
+
}>;
|
|
321
|
+
access_token: import("drizzle-orm/pg-core").PgText<{
|
|
322
|
+
tableName: "accounts";
|
|
323
|
+
name: "access_token";
|
|
324
|
+
data: string;
|
|
325
|
+
enumValues: [string, ...string[]];
|
|
326
|
+
driverParam: string;
|
|
327
|
+
notNull: false;
|
|
328
|
+
hasDefault: false;
|
|
329
|
+
}>;
|
|
330
|
+
expires_at: import("drizzle-orm/pg-core").PgInteger<{
|
|
331
|
+
tableName: "accounts";
|
|
332
|
+
name: "expires_at";
|
|
333
|
+
data: number;
|
|
334
|
+
driverParam: string | number;
|
|
335
|
+
hasDefault: false;
|
|
336
|
+
notNull: false;
|
|
337
|
+
}>;
|
|
338
|
+
token_type: import("drizzle-orm/pg-core").PgText<{
|
|
339
|
+
tableName: "accounts";
|
|
340
|
+
name: "token_type";
|
|
341
|
+
data: string;
|
|
342
|
+
enumValues: [string, ...string[]];
|
|
343
|
+
driverParam: string;
|
|
344
|
+
notNull: false;
|
|
345
|
+
hasDefault: false;
|
|
346
|
+
}>;
|
|
347
|
+
scope: import("drizzle-orm/pg-core").PgText<{
|
|
348
|
+
tableName: "accounts";
|
|
349
|
+
name: "scope";
|
|
350
|
+
data: string;
|
|
351
|
+
enumValues: [string, ...string[]];
|
|
352
|
+
driverParam: string;
|
|
353
|
+
notNull: false;
|
|
354
|
+
hasDefault: false;
|
|
355
|
+
}>;
|
|
356
|
+
id_token: import("drizzle-orm/pg-core").PgText<{
|
|
357
|
+
tableName: "accounts";
|
|
358
|
+
name: "id_token";
|
|
359
|
+
data: string;
|
|
360
|
+
enumValues: [string, ...string[]];
|
|
361
|
+
driverParam: string;
|
|
362
|
+
notNull: false;
|
|
363
|
+
hasDefault: false;
|
|
364
|
+
}>;
|
|
365
|
+
session_state: import("drizzle-orm/pg-core").PgText<{
|
|
366
|
+
tableName: "accounts";
|
|
367
|
+
name: "session_state";
|
|
368
|
+
data: string;
|
|
369
|
+
enumValues: [string, ...string[]];
|
|
370
|
+
driverParam: string;
|
|
371
|
+
notNull: false;
|
|
372
|
+
hasDefault: false;
|
|
373
|
+
}>;
|
|
374
|
+
};
|
|
375
|
+
}>;
|
|
376
|
+
sessions: import("drizzle-orm/db.d-b9835153").az<{
|
|
377
|
+
name: "sessions";
|
|
378
|
+
schema: undefined;
|
|
379
|
+
columns: {
|
|
380
|
+
sessionToken: import("drizzle-orm/pg-core").PgText<{
|
|
381
|
+
tableName: "sessions";
|
|
382
|
+
enumValues: [string, ...string[]];
|
|
383
|
+
name: "sessionToken";
|
|
384
|
+
data: string;
|
|
385
|
+
driverParam: string;
|
|
386
|
+
hasDefault: false;
|
|
387
|
+
notNull: true;
|
|
388
|
+
}>;
|
|
389
|
+
userId: import("drizzle-orm/pg-core").PgText<{
|
|
390
|
+
tableName: "sessions";
|
|
391
|
+
enumValues: [string, ...string[]];
|
|
392
|
+
name: "userId";
|
|
393
|
+
data: string;
|
|
394
|
+
driverParam: string;
|
|
395
|
+
hasDefault: false;
|
|
396
|
+
notNull: true;
|
|
397
|
+
}>;
|
|
398
|
+
expires: import("drizzle-orm/pg-core").PgTimestamp<{
|
|
399
|
+
tableName: "sessions";
|
|
400
|
+
name: "expires";
|
|
401
|
+
data: Date;
|
|
402
|
+
driverParam: string;
|
|
403
|
+
hasDefault: false;
|
|
404
|
+
notNull: true;
|
|
405
|
+
}>;
|
|
406
|
+
};
|
|
407
|
+
}>;
|
|
408
|
+
verificationTokens: import("drizzle-orm/db.d-b9835153").az<{
|
|
409
|
+
name: "verificationToken";
|
|
410
|
+
schema: undefined;
|
|
411
|
+
columns: {
|
|
412
|
+
identifier: import("drizzle-orm/pg-core").PgText<{
|
|
413
|
+
tableName: "verificationToken";
|
|
414
|
+
enumValues: [string, ...string[]];
|
|
415
|
+
name: "identifier";
|
|
416
|
+
data: string;
|
|
417
|
+
driverParam: string;
|
|
418
|
+
hasDefault: false;
|
|
419
|
+
notNull: true;
|
|
420
|
+
}>;
|
|
421
|
+
token: import("drizzle-orm/pg-core").PgText<{
|
|
422
|
+
tableName: "verificationToken";
|
|
423
|
+
enumValues: [string, ...string[]];
|
|
424
|
+
name: "token";
|
|
425
|
+
data: string;
|
|
426
|
+
driverParam: string;
|
|
427
|
+
hasDefault: false;
|
|
428
|
+
notNull: true;
|
|
429
|
+
}>;
|
|
430
|
+
expires: import("drizzle-orm/pg-core").PgTimestamp<{
|
|
431
|
+
tableName: "verificationToken";
|
|
432
|
+
name: "expires";
|
|
433
|
+
data: Date;
|
|
434
|
+
driverParam: string;
|
|
435
|
+
hasDefault: false;
|
|
436
|
+
notNull: true;
|
|
437
|
+
}>;
|
|
438
|
+
};
|
|
439
|
+
}>;
|
|
440
|
+
};
|
|
1
441
|
export type DefaultSchema = typeof schema;
|
|
442
|
+
export declare function pgDrizzleAdapter(client: PostgresJsDatabase<Record<string, never>>): Adapter;
|
|
2
443
|
//# sourceMappingURL=pg.d.ts.map
|
package/lib/pg.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pg.d.ts","sourceRoot":"","sources":["../src/lib/pg.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pg.d.ts","sourceRoot":"","sources":["../src/lib/pg.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,KAAK,EAAE,OAAO,EAAkB,MAAM,qBAAqB,CAAA;AAElE,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMhB,CAAA;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBpB,CAAA;AAED,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMnB,CAAA;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU9B,CAAA;AAED,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAoD,CAAA;AACvE,MAAM,MAAM,aAAa,GAAG,OAAO,MAAM,CAAA;AAEzC,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,kBAAkB,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,GAChD,OAAO,CA6JT"}
|
package/lib/pg.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { timestamp, pgTable, text, primaryKey, integer, } from "drizzle-orm/pg-core";
|
|
2
1
|
import { and, eq } from "drizzle-orm";
|
|
3
|
-
|
|
2
|
+
import { timestamp, pgTable, text, primaryKey, integer, } from "drizzle-orm/pg-core";
|
|
4
3
|
export const users = pgTable("users", {
|
|
5
4
|
id: text("id").notNull().primaryKey(),
|
|
6
5
|
name: text("name"),
|
|
@@ -8,7 +7,6 @@ export const users = pgTable("users", {
|
|
|
8
7
|
emailVerified: timestamp("emailVerified", { mode: "date" }),
|
|
9
8
|
image: text("image"),
|
|
10
9
|
});
|
|
11
|
-
/** @internal */
|
|
12
10
|
export const accounts = pgTable("accounts", {
|
|
13
11
|
userId: text("userId")
|
|
14
12
|
.notNull()
|
|
@@ -26,7 +24,6 @@ export const accounts = pgTable("accounts", {
|
|
|
26
24
|
}, (account) => ({
|
|
27
25
|
compoundKey: primaryKey(account.provider, account.providerAccountId),
|
|
28
26
|
}));
|
|
29
|
-
/** @internal */
|
|
30
27
|
export const sessions = pgTable("sessions", {
|
|
31
28
|
sessionToken: text("sessionToken").notNull().primaryKey(),
|
|
32
29
|
userId: text("userId")
|
|
@@ -34,7 +31,6 @@ export const sessions = pgTable("sessions", {
|
|
|
34
31
|
.references(() => users.id, { onDelete: "cascade" }),
|
|
35
32
|
expires: timestamp("expires", { mode: "date" }).notNull(),
|
|
36
33
|
});
|
|
37
|
-
/** @internal */
|
|
38
34
|
export const verificationTokens = pgTable("verificationToken", {
|
|
39
35
|
identifier: text("identifier").notNull(),
|
|
40
36
|
token: text("token").notNull(),
|
|
@@ -42,40 +38,38 @@ export const verificationTokens = pgTable("verificationToken", {
|
|
|
42
38
|
}, (vt) => ({
|
|
43
39
|
compoundKey: primaryKey(vt.identifier, vt.token),
|
|
44
40
|
}));
|
|
45
|
-
/** @internal */
|
|
46
41
|
export const schema = { users, accounts, sessions, verificationTokens };
|
|
47
|
-
/** @internal */
|
|
48
42
|
export function pgDrizzleAdapter(client) {
|
|
49
43
|
return {
|
|
50
|
-
|
|
44
|
+
async createUser(data) {
|
|
51
45
|
return await client
|
|
52
46
|
.insert(users)
|
|
53
47
|
.values({ ...data, id: crypto.randomUUID() })
|
|
54
48
|
.returning()
|
|
55
49
|
.then((res) => res[0] ?? null);
|
|
56
50
|
},
|
|
57
|
-
|
|
51
|
+
async getUser(data) {
|
|
58
52
|
return await client
|
|
59
53
|
.select()
|
|
60
54
|
.from(users)
|
|
61
55
|
.where(eq(users.id, data))
|
|
62
56
|
.then((res) => res[0] ?? null);
|
|
63
57
|
},
|
|
64
|
-
|
|
58
|
+
async getUserByEmail(data) {
|
|
65
59
|
return await client
|
|
66
60
|
.select()
|
|
67
61
|
.from(users)
|
|
68
62
|
.where(eq(users.email, data))
|
|
69
63
|
.then((res) => res[0] ?? null);
|
|
70
64
|
},
|
|
71
|
-
|
|
65
|
+
async createSession(data) {
|
|
72
66
|
return await client
|
|
73
67
|
.insert(sessions)
|
|
74
68
|
.values(data)
|
|
75
69
|
.returning()
|
|
76
70
|
.then((res) => res[0]);
|
|
77
71
|
},
|
|
78
|
-
|
|
72
|
+
async getSessionAndUser(data) {
|
|
79
73
|
return await client
|
|
80
74
|
.select({
|
|
81
75
|
session: sessions,
|
|
@@ -86,7 +80,7 @@ export function pgDrizzleAdapter(client) {
|
|
|
86
80
|
.innerJoin(users, eq(users.id, sessions.userId))
|
|
87
81
|
.then((res) => res[0] ?? null);
|
|
88
82
|
},
|
|
89
|
-
|
|
83
|
+
async updateUser(data) {
|
|
90
84
|
if (!data.id) {
|
|
91
85
|
throw new Error("No user id.");
|
|
92
86
|
}
|
|
@@ -97,7 +91,7 @@ export function pgDrizzleAdapter(client) {
|
|
|
97
91
|
.returning()
|
|
98
92
|
.then((res) => res[0]);
|
|
99
93
|
},
|
|
100
|
-
|
|
94
|
+
async updateSession(data) {
|
|
101
95
|
return await client
|
|
102
96
|
.update(sessions)
|
|
103
97
|
.set(data)
|
|
@@ -105,7 +99,7 @@ export function pgDrizzleAdapter(client) {
|
|
|
105
99
|
.returning()
|
|
106
100
|
.then((res) => res[0]);
|
|
107
101
|
},
|
|
108
|
-
|
|
102
|
+
async linkAccount(rawAccount) {
|
|
109
103
|
const updatedAccount = await client
|
|
110
104
|
.insert(accounts)
|
|
111
105
|
.values(rawAccount)
|
|
@@ -125,7 +119,7 @@ export function pgDrizzleAdapter(client) {
|
|
|
125
119
|
};
|
|
126
120
|
return account;
|
|
127
121
|
},
|
|
128
|
-
|
|
122
|
+
async getUserByAccount(account) {
|
|
129
123
|
const dbAccount = (await client
|
|
130
124
|
.select()
|
|
131
125
|
.from(accounts)
|
|
@@ -137,7 +131,7 @@ export function pgDrizzleAdapter(client) {
|
|
|
137
131
|
}
|
|
138
132
|
return dbAccount.users;
|
|
139
133
|
},
|
|
140
|
-
|
|
134
|
+
async deleteSession(sessionToken) {
|
|
141
135
|
const session = await client
|
|
142
136
|
.delete(sessions)
|
|
143
137
|
.where(eq(sessions.sessionToken, sessionToken))
|
|
@@ -145,14 +139,14 @@ export function pgDrizzleAdapter(client) {
|
|
|
145
139
|
.then((res) => res[0] ?? null);
|
|
146
140
|
return session;
|
|
147
141
|
},
|
|
148
|
-
|
|
142
|
+
async createVerificationToken(token) {
|
|
149
143
|
return await client
|
|
150
144
|
.insert(verificationTokens)
|
|
151
145
|
.values(token)
|
|
152
146
|
.returning()
|
|
153
147
|
.then((res) => res[0]);
|
|
154
148
|
},
|
|
155
|
-
|
|
149
|
+
async useVerificationToken(token) {
|
|
156
150
|
try {
|
|
157
151
|
return await client
|
|
158
152
|
.delete(verificationTokens)
|
|
@@ -164,14 +158,14 @@ export function pgDrizzleAdapter(client) {
|
|
|
164
158
|
throw new Error("No verification token found.");
|
|
165
159
|
}
|
|
166
160
|
},
|
|
167
|
-
|
|
161
|
+
async deleteUser(id) {
|
|
168
162
|
await client
|
|
169
163
|
.delete(users)
|
|
170
164
|
.where(eq(users.id, id))
|
|
171
165
|
.returning()
|
|
172
166
|
.then((res) => res[0] ?? null);
|
|
173
167
|
},
|
|
174
|
-
|
|
168
|
+
async unlinkAccount(account) {
|
|
175
169
|
const { type, provider, providerAccountId, userId } = await client
|
|
176
170
|
.delete(accounts)
|
|
177
171
|
.where(and(eq(accounts.providerAccountId, account.providerAccountId), eq(accounts.provider, account.provider)))
|