@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/sqlite.d.ts
CHANGED
|
@@ -1,2 +1,443 @@
|
|
|
1
|
+
import { BaseSQLiteDatabase } from "drizzle-orm/sqlite-core";
|
|
2
|
+
import type { Adapter } from "@auth/core/adapters";
|
|
3
|
+
export declare const users: import("drizzle-orm/db.d-b5fdf746").ag<{
|
|
4
|
+
name: "users";
|
|
5
|
+
schema: undefined;
|
|
6
|
+
columns: {
|
|
7
|
+
id: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
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/sqlite-core").SQLiteText<{
|
|
17
|
+
tableName: "users";
|
|
18
|
+
name: "name";
|
|
19
|
+
data: string;
|
|
20
|
+
driverParam: string;
|
|
21
|
+
enumValues: [string, ...string[]];
|
|
22
|
+
notNull: false;
|
|
23
|
+
hasDefault: false;
|
|
24
|
+
}>;
|
|
25
|
+
email: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
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/sqlite-core").SQLiteTimestamp<{
|
|
35
|
+
tableName: "users";
|
|
36
|
+
name: "emailVerified";
|
|
37
|
+
data: Date;
|
|
38
|
+
driverParam: number;
|
|
39
|
+
notNull: false;
|
|
40
|
+
hasDefault: false;
|
|
41
|
+
}>;
|
|
42
|
+
image: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
43
|
+
tableName: "users";
|
|
44
|
+
name: "image";
|
|
45
|
+
data: string;
|
|
46
|
+
driverParam: string;
|
|
47
|
+
enumValues: [string, ...string[]];
|
|
48
|
+
notNull: false;
|
|
49
|
+
hasDefault: false;
|
|
50
|
+
}>;
|
|
51
|
+
};
|
|
52
|
+
}>;
|
|
53
|
+
export declare const accounts: import("drizzle-orm/db.d-b5fdf746").ag<{
|
|
54
|
+
name: "accounts";
|
|
55
|
+
schema: undefined;
|
|
56
|
+
columns: {
|
|
57
|
+
userId: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
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/sqlite-core").SQLiteText<{
|
|
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/sqlite-core").SQLiteText<{
|
|
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/sqlite-core").SQLiteText<{
|
|
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/sqlite-core").SQLiteText<{
|
|
94
|
+
tableName: "accounts";
|
|
95
|
+
name: "refresh_token";
|
|
96
|
+
data: string;
|
|
97
|
+
driverParam: string;
|
|
98
|
+
enumValues: [string, ...string[]];
|
|
99
|
+
notNull: false;
|
|
100
|
+
hasDefault: false;
|
|
101
|
+
}>;
|
|
102
|
+
access_token: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
103
|
+
tableName: "accounts";
|
|
104
|
+
name: "access_token";
|
|
105
|
+
data: string;
|
|
106
|
+
driverParam: string;
|
|
107
|
+
enumValues: [string, ...string[]];
|
|
108
|
+
notNull: false;
|
|
109
|
+
hasDefault: false;
|
|
110
|
+
}>;
|
|
111
|
+
expires_at: import("drizzle-orm/sqlite-core").SQLiteInteger<{
|
|
112
|
+
tableName: "accounts";
|
|
113
|
+
name: "expires_at";
|
|
114
|
+
data: number;
|
|
115
|
+
driverParam: number;
|
|
116
|
+
notNull: false;
|
|
117
|
+
hasDefault: false;
|
|
118
|
+
}>;
|
|
119
|
+
token_type: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
120
|
+
tableName: "accounts";
|
|
121
|
+
name: "token_type";
|
|
122
|
+
data: string;
|
|
123
|
+
driverParam: string;
|
|
124
|
+
enumValues: [string, ...string[]];
|
|
125
|
+
notNull: false;
|
|
126
|
+
hasDefault: false;
|
|
127
|
+
}>;
|
|
128
|
+
scope: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
129
|
+
tableName: "accounts";
|
|
130
|
+
name: "scope";
|
|
131
|
+
data: string;
|
|
132
|
+
driverParam: string;
|
|
133
|
+
enumValues: [string, ...string[]];
|
|
134
|
+
notNull: false;
|
|
135
|
+
hasDefault: false;
|
|
136
|
+
}>;
|
|
137
|
+
id_token: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
138
|
+
tableName: "accounts";
|
|
139
|
+
name: "id_token";
|
|
140
|
+
data: string;
|
|
141
|
+
driverParam: string;
|
|
142
|
+
enumValues: [string, ...string[]];
|
|
143
|
+
notNull: false;
|
|
144
|
+
hasDefault: false;
|
|
145
|
+
}>;
|
|
146
|
+
session_state: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
147
|
+
tableName: "accounts";
|
|
148
|
+
name: "session_state";
|
|
149
|
+
data: string;
|
|
150
|
+
driverParam: string;
|
|
151
|
+
enumValues: [string, ...string[]];
|
|
152
|
+
notNull: false;
|
|
153
|
+
hasDefault: false;
|
|
154
|
+
}>;
|
|
155
|
+
};
|
|
156
|
+
}>;
|
|
157
|
+
export declare const sessions: import("drizzle-orm/db.d-b5fdf746").ag<{
|
|
158
|
+
name: "sessions";
|
|
159
|
+
schema: undefined;
|
|
160
|
+
columns: {
|
|
161
|
+
sessionToken: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
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/sqlite-core").SQLiteText<{
|
|
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/sqlite-core").SQLiteTimestamp<{
|
|
180
|
+
tableName: "sessions";
|
|
181
|
+
name: "expires";
|
|
182
|
+
data: Date;
|
|
183
|
+
driverParam: number;
|
|
184
|
+
hasDefault: false;
|
|
185
|
+
notNull: true;
|
|
186
|
+
}>;
|
|
187
|
+
};
|
|
188
|
+
}>;
|
|
189
|
+
export declare const verificationTokens: import("drizzle-orm/db.d-b5fdf746").ag<{
|
|
190
|
+
name: "verificationToken";
|
|
191
|
+
schema: undefined;
|
|
192
|
+
columns: {
|
|
193
|
+
identifier: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
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/sqlite-core").SQLiteText<{
|
|
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/sqlite-core").SQLiteTimestamp<{
|
|
212
|
+
tableName: "verificationToken";
|
|
213
|
+
name: "expires";
|
|
214
|
+
data: Date;
|
|
215
|
+
driverParam: number;
|
|
216
|
+
hasDefault: false;
|
|
217
|
+
notNull: true;
|
|
218
|
+
}>;
|
|
219
|
+
};
|
|
220
|
+
}>;
|
|
221
|
+
export declare const schema: {
|
|
222
|
+
users: import("drizzle-orm/db.d-b5fdf746").ag<{
|
|
223
|
+
name: "users";
|
|
224
|
+
schema: undefined;
|
|
225
|
+
columns: {
|
|
226
|
+
id: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
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/sqlite-core").SQLiteText<{
|
|
236
|
+
tableName: "users";
|
|
237
|
+
name: "name";
|
|
238
|
+
data: string;
|
|
239
|
+
driverParam: string;
|
|
240
|
+
enumValues: [string, ...string[]];
|
|
241
|
+
notNull: false;
|
|
242
|
+
hasDefault: false;
|
|
243
|
+
}>;
|
|
244
|
+
email: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
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/sqlite-core").SQLiteTimestamp<{
|
|
254
|
+
tableName: "users";
|
|
255
|
+
name: "emailVerified";
|
|
256
|
+
data: Date;
|
|
257
|
+
driverParam: number;
|
|
258
|
+
notNull: false;
|
|
259
|
+
hasDefault: false;
|
|
260
|
+
}>;
|
|
261
|
+
image: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
262
|
+
tableName: "users";
|
|
263
|
+
name: "image";
|
|
264
|
+
data: string;
|
|
265
|
+
driverParam: string;
|
|
266
|
+
enumValues: [string, ...string[]];
|
|
267
|
+
notNull: false;
|
|
268
|
+
hasDefault: false;
|
|
269
|
+
}>;
|
|
270
|
+
};
|
|
271
|
+
}>;
|
|
272
|
+
accounts: import("drizzle-orm/db.d-b5fdf746").ag<{
|
|
273
|
+
name: "accounts";
|
|
274
|
+
schema: undefined;
|
|
275
|
+
columns: {
|
|
276
|
+
userId: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
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/sqlite-core").SQLiteText<{
|
|
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/sqlite-core").SQLiteText<{
|
|
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/sqlite-core").SQLiteText<{
|
|
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/sqlite-core").SQLiteText<{
|
|
313
|
+
tableName: "accounts";
|
|
314
|
+
name: "refresh_token";
|
|
315
|
+
data: string;
|
|
316
|
+
driverParam: string;
|
|
317
|
+
enumValues: [string, ...string[]];
|
|
318
|
+
notNull: false;
|
|
319
|
+
hasDefault: false;
|
|
320
|
+
}>;
|
|
321
|
+
access_token: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
322
|
+
tableName: "accounts";
|
|
323
|
+
name: "access_token";
|
|
324
|
+
data: string;
|
|
325
|
+
driverParam: string;
|
|
326
|
+
enumValues: [string, ...string[]];
|
|
327
|
+
notNull: false;
|
|
328
|
+
hasDefault: false;
|
|
329
|
+
}>;
|
|
330
|
+
expires_at: import("drizzle-orm/sqlite-core").SQLiteInteger<{
|
|
331
|
+
tableName: "accounts";
|
|
332
|
+
name: "expires_at";
|
|
333
|
+
data: number;
|
|
334
|
+
driverParam: number;
|
|
335
|
+
notNull: false;
|
|
336
|
+
hasDefault: false;
|
|
337
|
+
}>;
|
|
338
|
+
token_type: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
339
|
+
tableName: "accounts";
|
|
340
|
+
name: "token_type";
|
|
341
|
+
data: string;
|
|
342
|
+
driverParam: string;
|
|
343
|
+
enumValues: [string, ...string[]];
|
|
344
|
+
notNull: false;
|
|
345
|
+
hasDefault: false;
|
|
346
|
+
}>;
|
|
347
|
+
scope: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
348
|
+
tableName: "accounts";
|
|
349
|
+
name: "scope";
|
|
350
|
+
data: string;
|
|
351
|
+
driverParam: string;
|
|
352
|
+
enumValues: [string, ...string[]];
|
|
353
|
+
notNull: false;
|
|
354
|
+
hasDefault: false;
|
|
355
|
+
}>;
|
|
356
|
+
id_token: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
357
|
+
tableName: "accounts";
|
|
358
|
+
name: "id_token";
|
|
359
|
+
data: string;
|
|
360
|
+
driverParam: string;
|
|
361
|
+
enumValues: [string, ...string[]];
|
|
362
|
+
notNull: false;
|
|
363
|
+
hasDefault: false;
|
|
364
|
+
}>;
|
|
365
|
+
session_state: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
366
|
+
tableName: "accounts";
|
|
367
|
+
name: "session_state";
|
|
368
|
+
data: string;
|
|
369
|
+
driverParam: string;
|
|
370
|
+
enumValues: [string, ...string[]];
|
|
371
|
+
notNull: false;
|
|
372
|
+
hasDefault: false;
|
|
373
|
+
}>;
|
|
374
|
+
};
|
|
375
|
+
}>;
|
|
376
|
+
sessions: import("drizzle-orm/db.d-b5fdf746").ag<{
|
|
377
|
+
name: "sessions";
|
|
378
|
+
schema: undefined;
|
|
379
|
+
columns: {
|
|
380
|
+
sessionToken: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
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/sqlite-core").SQLiteText<{
|
|
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/sqlite-core").SQLiteTimestamp<{
|
|
399
|
+
tableName: "sessions";
|
|
400
|
+
name: "expires";
|
|
401
|
+
data: Date;
|
|
402
|
+
driverParam: number;
|
|
403
|
+
hasDefault: false;
|
|
404
|
+
notNull: true;
|
|
405
|
+
}>;
|
|
406
|
+
};
|
|
407
|
+
}>;
|
|
408
|
+
verificationTokens: import("drizzle-orm/db.d-b5fdf746").ag<{
|
|
409
|
+
name: "verificationToken";
|
|
410
|
+
schema: undefined;
|
|
411
|
+
columns: {
|
|
412
|
+
identifier: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
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/sqlite-core").SQLiteText<{
|
|
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/sqlite-core").SQLiteTimestamp<{
|
|
431
|
+
tableName: "verificationToken";
|
|
432
|
+
name: "expires";
|
|
433
|
+
data: Date;
|
|
434
|
+
driverParam: number;
|
|
435
|
+
hasDefault: false;
|
|
436
|
+
notNull: true;
|
|
437
|
+
}>;
|
|
438
|
+
};
|
|
439
|
+
}>;
|
|
440
|
+
};
|
|
1
441
|
export type DefaultSchema = typeof schema;
|
|
442
|
+
export declare function SQLiteDrizzleAdapter(client: BaseSQLiteDatabase<any, any>): Adapter;
|
|
2
443
|
//# sourceMappingURL=sqlite.d.ts.map
|
package/lib/sqlite.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../src/lib/sqlite.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../src/lib/sqlite.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,kBAAkB,EACnB,MAAM,yBAAyB,CAAA;AAEhC,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,oBAAoB,CAClC,MAAM,EAAE,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,GACnC,OAAO,CAwIT"}
|
package/lib/sqlite.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { integer, sqliteTable, text, primaryKey, } from "drizzle-orm/sqlite-core";
|
|
2
1
|
import { eq, and } from "drizzle-orm";
|
|
3
|
-
|
|
2
|
+
import { integer, sqliteTable, text, primaryKey, } from "drizzle-orm/sqlite-core";
|
|
4
3
|
export const users = sqliteTable("users", {
|
|
5
4
|
id: text("id").notNull().primaryKey(),
|
|
6
5
|
name: text("name"),
|
|
@@ -8,7 +7,6 @@ export const users = sqliteTable("users", {
|
|
|
8
7
|
emailVerified: integer("emailVerified", { mode: "timestamp_ms" }),
|
|
9
8
|
image: text("image"),
|
|
10
9
|
});
|
|
11
|
-
/** @internal */
|
|
12
10
|
export const accounts = sqliteTable("accounts", {
|
|
13
11
|
userId: text("userId")
|
|
14
12
|
.notNull()
|
|
@@ -26,7 +24,6 @@ export const accounts = sqliteTable("accounts", {
|
|
|
26
24
|
}, (account) => ({
|
|
27
25
|
compoundKey: primaryKey(account.provider, account.providerAccountId),
|
|
28
26
|
}));
|
|
29
|
-
/** @internal */
|
|
30
27
|
export const sessions = sqliteTable("sessions", {
|
|
31
28
|
sessionToken: text("sessionToken").notNull().primaryKey(),
|
|
32
29
|
userId: text("userId")
|
|
@@ -34,7 +31,6 @@ export const sessions = sqliteTable("sessions", {
|
|
|
34
31
|
.references(() => users.id, { onDelete: "cascade" }),
|
|
35
32
|
expires: integer("expires", { mode: "timestamp_ms" }).notNull(),
|
|
36
33
|
});
|
|
37
|
-
/** @internal */
|
|
38
34
|
export const verificationTokens = sqliteTable("verificationToken", {
|
|
39
35
|
identifier: text("identifier").notNull(),
|
|
40
36
|
token: text("token").notNull(),
|
|
@@ -42,28 +38,26 @@ export const verificationTokens = sqliteTable("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 SQLiteDrizzleAdapter(client) {
|
|
49
43
|
return {
|
|
50
|
-
createUser
|
|
44
|
+
createUser(data) {
|
|
51
45
|
return client
|
|
52
46
|
.insert(users)
|
|
53
47
|
.values({ ...data, id: crypto.randomUUID() })
|
|
54
48
|
.returning()
|
|
55
49
|
.get();
|
|
56
50
|
},
|
|
57
|
-
getUser
|
|
51
|
+
getUser(data) {
|
|
58
52
|
return client.select().from(users).where(eq(users.id, data)).get() ?? null;
|
|
59
53
|
},
|
|
60
|
-
getUserByEmail
|
|
54
|
+
getUserByEmail(data) {
|
|
61
55
|
return (client.select().from(users).where(eq(users.email, data)).get() ?? null);
|
|
62
56
|
},
|
|
63
|
-
createSession
|
|
57
|
+
createSession(data) {
|
|
64
58
|
return client.insert(sessions).values(data).returning().get();
|
|
65
59
|
},
|
|
66
|
-
getSessionAndUser
|
|
60
|
+
getSessionAndUser(data) {
|
|
67
61
|
return (client
|
|
68
62
|
.select({
|
|
69
63
|
session: sessions,
|
|
@@ -74,7 +68,7 @@ export function SQLiteDrizzleAdapter(client) {
|
|
|
74
68
|
.innerJoin(users, eq(users.id, sessions.userId))
|
|
75
69
|
.get() ?? null);
|
|
76
70
|
},
|
|
77
|
-
updateUser
|
|
71
|
+
updateUser(data) {
|
|
78
72
|
if (!data.id) {
|
|
79
73
|
throw new Error("No user id.");
|
|
80
74
|
}
|
|
@@ -85,7 +79,7 @@ export function SQLiteDrizzleAdapter(client) {
|
|
|
85
79
|
.returning()
|
|
86
80
|
.get();
|
|
87
81
|
},
|
|
88
|
-
updateSession
|
|
82
|
+
updateSession(data) {
|
|
89
83
|
return client
|
|
90
84
|
.update(sessions)
|
|
91
85
|
.set(data)
|
|
@@ -93,7 +87,7 @@ export function SQLiteDrizzleAdapter(client) {
|
|
|
93
87
|
.returning()
|
|
94
88
|
.get();
|
|
95
89
|
},
|
|
96
|
-
linkAccount
|
|
90
|
+
linkAccount(rawAccount) {
|
|
97
91
|
const updatedAccount = client
|
|
98
92
|
.insert(accounts)
|
|
99
93
|
.values(rawAccount)
|
|
@@ -112,7 +106,7 @@ export function SQLiteDrizzleAdapter(client) {
|
|
|
112
106
|
};
|
|
113
107
|
return account;
|
|
114
108
|
},
|
|
115
|
-
getUserByAccount
|
|
109
|
+
getUserByAccount(account) {
|
|
116
110
|
const results = client
|
|
117
111
|
.select()
|
|
118
112
|
.from(accounts)
|
|
@@ -121,17 +115,17 @@ export function SQLiteDrizzleAdapter(client) {
|
|
|
121
115
|
.get();
|
|
122
116
|
return results?.users ?? null;
|
|
123
117
|
},
|
|
124
|
-
deleteSession
|
|
118
|
+
deleteSession(sessionToken) {
|
|
125
119
|
return (client
|
|
126
120
|
.delete(sessions)
|
|
127
121
|
.where(eq(sessions.sessionToken, sessionToken))
|
|
128
122
|
.returning()
|
|
129
123
|
.get() ?? null);
|
|
130
124
|
},
|
|
131
|
-
createVerificationToken
|
|
125
|
+
createVerificationToken(token) {
|
|
132
126
|
return client.insert(verificationTokens).values(token).returning().get();
|
|
133
127
|
},
|
|
134
|
-
useVerificationToken
|
|
128
|
+
useVerificationToken(token) {
|
|
135
129
|
try {
|
|
136
130
|
return (client
|
|
137
131
|
.delete(verificationTokens)
|
|
@@ -143,10 +137,10 @@ export function SQLiteDrizzleAdapter(client) {
|
|
|
143
137
|
throw new Error("No verification token found.");
|
|
144
138
|
}
|
|
145
139
|
},
|
|
146
|
-
deleteUser
|
|
140
|
+
deleteUser(id) {
|
|
147
141
|
return client.delete(users).where(eq(users.id, id)).returning().get();
|
|
148
142
|
},
|
|
149
|
-
unlinkAccount
|
|
143
|
+
unlinkAccount(account) {
|
|
150
144
|
client
|
|
151
145
|
.delete(accounts)
|
|
152
146
|
.where(and(eq(accounts.providerAccountId, account.providerAccountId), eq(accounts.provider, account.provider)))
|
package/lib/utils.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { MySqlDatabase } from "drizzle-orm/mysql-core";
|
|
2
|
+
import { PgDatabase } from "drizzle-orm/pg-core";
|
|
3
|
+
import { BaseSQLiteDatabase } from "drizzle-orm/sqlite-core";
|
|
4
|
+
import type { AnyMySqlTable } from "drizzle-orm/mysql-core";
|
|
5
|
+
import type { AnyPgTable } from "drizzle-orm/pg-core";
|
|
6
|
+
import type { AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
|
7
|
+
import type { DefaultSchema as PgSchema } from "./pg.js";
|
|
8
|
+
import type { DefaultSchema as MySqlSchema } from "./mysql.js";
|
|
9
|
+
import type { DefaultSchema as SQLiteSchema } from "./sqlite.js";
|
|
7
10
|
export type AnyMySqlDatabase = MySqlDatabase<any, any>;
|
|
8
11
|
export type AnyPgDatabase = PgDatabase<any, any, any>;
|
|
9
12
|
export type AnySQLiteDatabase = BaseSQLiteDatabase<any, any, any, any>;
|
package/lib/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAE5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,KAAK,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,SAAS,CAAA;AACxD,OAAO,KAAK,EAAE,aAAa,IAAI,WAAW,EAAE,MAAM,YAAY,CAAA;AAC9D,OAAO,KAAK,EAAE,aAAa,IAAI,YAAY,EAAE,MAAM,aAAa,CAAA;AAEhE,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;AACtD,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;AACrD,MAAM,MAAM,iBAAiB,GAAG,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;AAEtE,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;IAClD,EAAE,EAAE,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IACzC,MAAM,EAAE,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;CACtD;AAED,MAAM,MAAM,gBAAgB,GACxB,gBAAgB,GAChB,aAAa,GACb,iBAAiB,CAAA;AAErB,MAAM,MAAM,aAAa,CAAC,MAAM,IAAI,MAAM,SAAS,gBAAgB,GAC/D,aAAa,CAAC,OAAO,CAAC,GACtB,MAAM,SAAS,aAAa,GAC5B,aAAa,CAAC,IAAI,CAAC,GACnB,MAAM,SAAS,iBAAiB,GAChC,aAAa,CAAC,QAAQ,CAAC,GACvB,KAAK,CAAA;AAET,wBAAgB,eAAe,CAC7B,EAAE,EAAE,GAAG,GACN,EAAE,IAAI,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAEzC;AAED,wBAAgB,YAAY,CAAC,EAAE,EAAE,GAAG,GAAG,EAAE,IAAI,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAErE;AAED,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,GAAG,GAAG,EAAE,IAAI,iBAAiB,CAEjE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@auth/drizzle-adapter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Drizzle adapter for Auth.js.",
|
|
5
5
|
"homepage": "https://authjs.dev",
|
|
6
6
|
"repository": "https://github.com/nextauthjs/next-auth",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@auth/core": "0.10.
|
|
39
|
+
"@auth/core": "0.10.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/better-sqlite3": "^7.6.4",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"jest": "^27.4.3",
|
|
48
48
|
"mysql2": "^3.2.0",
|
|
49
49
|
"postgres": "^3.3.4",
|
|
50
|
-
"@next-auth/
|
|
51
|
-
"@next-auth/
|
|
50
|
+
"@next-auth/adapter-test": "0.0.0",
|
|
51
|
+
"@next-auth/tsconfig": "0.0.0"
|
|
52
52
|
},
|
|
53
53
|
"jest": {
|
|
54
54
|
"preset": "@next-auth/adapter-test/jest"
|
package/src/index.ts
CHANGED
|
@@ -16,15 +16,15 @@
|
|
|
16
16
|
* @module @auth/drizzle-adapter
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import { mySqlDrizzleAdapter } from "./lib/mysql"
|
|
20
|
-
import { pgDrizzleAdapter } from "./lib/pg"
|
|
21
|
-
import { SQLiteDrizzleAdapter } from "./lib/sqlite"
|
|
19
|
+
import { mySqlDrizzleAdapter } from "./lib/mysql.js"
|
|
20
|
+
import { pgDrizzleAdapter } from "./lib/pg.js"
|
|
21
|
+
import { SQLiteDrizzleAdapter } from "./lib/sqlite.js"
|
|
22
22
|
import {
|
|
23
23
|
isMySqlDatabase,
|
|
24
24
|
isPgDatabase,
|
|
25
25
|
isSQLiteDatabase,
|
|
26
26
|
SqlFlavorOptions,
|
|
27
|
-
} from "./lib/utils"
|
|
27
|
+
} from "./lib/utils.js"
|
|
28
28
|
|
|
29
29
|
import type { Adapter } from "@auth/core/adapters"
|
|
30
30
|
|