@beignet/cli 0.0.4 → 0.0.6

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 (73) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/choices.d.ts +5 -28
  3. package/dist/choices.d.ts.map +1 -1
  4. package/dist/choices.js +0 -35
  5. package/dist/choices.js.map +1 -1
  6. package/dist/create-prompts.d.ts +5 -6
  7. package/dist/create-prompts.d.ts.map +1 -1
  8. package/dist/create-prompts.js +19 -77
  9. package/dist/create-prompts.js.map +1 -1
  10. package/dist/create.d.ts +6 -4
  11. package/dist/create.d.ts.map +1 -1
  12. package/dist/create.js +15 -24
  13. package/dist/create.js.map +1 -1
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +32 -39
  16. package/dist/index.js.map +1 -1
  17. package/dist/lib.d.ts +1 -1
  18. package/dist/lib.d.ts.map +1 -1
  19. package/dist/make.d.ts.map +1 -1
  20. package/dist/make.js +153 -1
  21. package/dist/make.js.map +1 -1
  22. package/dist/templates/base.d.ts +13 -0
  23. package/dist/templates/base.d.ts.map +1 -0
  24. package/dist/templates/base.js +300 -0
  25. package/dist/templates/base.js.map +1 -0
  26. package/dist/templates/db.d.ts +15 -0
  27. package/dist/templates/db.d.ts.map +1 -0
  28. package/dist/templates/db.js +1001 -0
  29. package/dist/templates/db.js.map +1 -0
  30. package/dist/templates/index.d.ts +14 -0
  31. package/dist/templates/index.d.ts.map +1 -0
  32. package/dist/templates/index.js +124 -0
  33. package/dist/templates/index.js.map +1 -0
  34. package/dist/templates/server.d.ts +26 -0
  35. package/dist/templates/server.d.ts.map +1 -0
  36. package/dist/templates/server.js +525 -0
  37. package/dist/templates/server.js.map +1 -0
  38. package/dist/templates/shadcn.d.ts +5 -0
  39. package/dist/templates/shadcn.d.ts.map +1 -0
  40. package/dist/templates/shadcn.js +555 -0
  41. package/dist/templates/shadcn.js.map +1 -0
  42. package/dist/templates/shared.d.ts +49 -0
  43. package/dist/templates/shared.d.ts.map +1 -0
  44. package/dist/templates/shared.js +57 -0
  45. package/dist/templates/shared.js.map +1 -0
  46. package/dist/templates/shell.d.ts +5 -0
  47. package/dist/templates/shell.d.ts.map +1 -0
  48. package/dist/templates/shell.js +1198 -0
  49. package/dist/templates/shell.js.map +1 -0
  50. package/dist/templates/todos.d.ts +17 -0
  51. package/dist/templates/todos.d.ts.map +1 -0
  52. package/dist/templates/todos.js +607 -0
  53. package/dist/templates/todos.js.map +1 -0
  54. package/package.json +2 -2
  55. package/src/choices.ts +4 -58
  56. package/src/create-prompts.ts +20 -88
  57. package/src/create.ts +21 -38
  58. package/src/index.ts +39 -45
  59. package/src/lib.ts +1 -1
  60. package/src/make.ts +208 -1
  61. package/src/templates/base.ts +377 -0
  62. package/src/templates/db.ts +1002 -0
  63. package/src/templates/index.ts +149 -0
  64. package/src/templates/server.ts +533 -0
  65. package/src/templates/shadcn.ts +570 -0
  66. package/src/templates/shared.ts +90 -0
  67. package/src/templates/shell.ts +1227 -0
  68. package/src/templates/todos.ts +607 -0
  69. package/dist/templates.d.ts +0 -26
  70. package/dist/templates.d.ts.map +0 -1
  71. package/dist/templates.js +0 -3995
  72. package/dist/templates.js.map +0 -1
  73. package/src/templates.ts +0 -4280
@@ -0,0 +1,1002 @@
1
+ // The starter ships its initial Drizzle migration inside the template so the
2
+ // first run is `db migrate` with no generate step. `dbSchema` and the
3
+ // `starterMigration*` files below pair together — regenerate together.
4
+ //
5
+ // To regenerate: scaffold a scratch app with `dbSchema` as
6
+ // infra/db/schema/index.ts plus `drizzleConfig` as drizzle.config.ts, run
7
+ // `drizzle-kit generate --name starter` with the drizzle-kit version pinned in
8
+ // externalVersions, then paste drizzle/0000_starter.sql,
9
+ // drizzle/meta/_journal.json, and drizzle/meta/0000_snapshot.json back here
10
+ // verbatim.
11
+
12
+ const files = {
13
+ drizzleConfig: `export default {
14
+ schema: "./infra/db/schema/index.ts",
15
+ out: "./drizzle",
16
+ dialect: "sqlite",
17
+ dbCredentials: {
18
+ url: process.env.TURSO_DB_URL ?? "file:local.db",
19
+ authToken: process.env.TURSO_DB_AUTH_TOKEN,
20
+ },
21
+ };
22
+ `,
23
+ dbSchema: `import { index, integer, sqliteTable, text } from "drizzle-orm/sqlite-core";
24
+
25
+ export const user = sqliteTable("user", {
26
+ id: text("id").primaryKey(),
27
+ name: text("name").notNull(),
28
+ email: text("email").notNull().unique(),
29
+ emailVerified: integer("email_verified", { mode: "boolean" })
30
+ .notNull()
31
+ .default(false),
32
+ image: text("image"),
33
+ createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
34
+ updatedAt: integer("updated_at", { mode: "timestamp" }).notNull(),
35
+ });
36
+
37
+ export const session = sqliteTable("session", {
38
+ id: text("id").primaryKey(),
39
+ expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
40
+ token: text("token").notNull().unique(),
41
+ createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
42
+ updatedAt: integer("updated_at", { mode: "timestamp" }).notNull(),
43
+ ipAddress: text("ip_address"),
44
+ userAgent: text("user_agent"),
45
+ userId: text("user_id")
46
+ .notNull()
47
+ .references(() => user.id, { onDelete: "cascade" }),
48
+ });
49
+
50
+ export const account = sqliteTable("account", {
51
+ id: text("id").primaryKey(),
52
+ accountId: text("account_id").notNull(),
53
+ providerId: text("provider_id").notNull(),
54
+ userId: text("user_id")
55
+ .notNull()
56
+ .references(() => user.id, { onDelete: "cascade" }),
57
+ accessToken: text("access_token"),
58
+ refreshToken: text("refresh_token"),
59
+ idToken: text("id_token"),
60
+ accessTokenExpiresAt: integer("access_token_expires_at", {
61
+ mode: "timestamp",
62
+ }),
63
+ refreshTokenExpiresAt: integer("refresh_token_expires_at", {
64
+ mode: "timestamp",
65
+ }),
66
+ scope: text("scope"),
67
+ password: text("password"),
68
+ createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
69
+ updatedAt: integer("updated_at", { mode: "timestamp" }).notNull(),
70
+ });
71
+
72
+ export const verification = sqliteTable("verification", {
73
+ id: text("id").primaryKey(),
74
+ identifier: text("identifier").notNull(),
75
+ value: text("value").notNull(),
76
+ expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
77
+ createdAt: integer("created_at", { mode: "timestamp" }),
78
+ updatedAt: integer("updated_at", { mode: "timestamp" }),
79
+ });
80
+
81
+ export const todos = sqliteTable(
82
+ "todos",
83
+ {
84
+ id: text("id").primaryKey(),
85
+ userId: text("user_id")
86
+ .notNull()
87
+ .references(() => user.id, { onDelete: "cascade" }),
88
+ title: text("title").notNull(),
89
+ completed: integer("completed", { mode: "boolean" })
90
+ .notNull()
91
+ .default(false),
92
+ createdAt: text("created_at").notNull(),
93
+ },
94
+ (table) => ({
95
+ userIdx: index("todos_user_idx").on(table.userId, table.createdAt),
96
+ }),
97
+ );
98
+
99
+ export const idempotencyRecords = sqliteTable(
100
+ "idempotency_records",
101
+ {
102
+ storageKey: text("storage_key").primaryKey(),
103
+ namespace: text("namespace").notNull(),
104
+ idempotencyKey: text("idempotency_key").notNull(),
105
+ scopeKey: text("scope_key").notNull(),
106
+ fingerprint: text("fingerprint").notNull(),
107
+ status: text("status", { enum: ["in-progress", "completed"] }).notNull(),
108
+ resultJson: text("result_json"),
109
+ reservedAt: text("reserved_at").notNull(),
110
+ completedAt: text("completed_at"),
111
+ expiresAt: text("expires_at"),
112
+ updatedAt: text("updated_at").notNull(),
113
+ },
114
+ (table) => ({
115
+ lookupIdx: index("idempotency_records_lookup_idx").on(
116
+ table.namespace,
117
+ table.scopeKey,
118
+ table.idempotencyKey,
119
+ ),
120
+ expiresIdx: index("idempotency_records_expires_idx").on(table.expiresAt),
121
+ }),
122
+ );
123
+ `,
124
+ drizzleTodoRepository: `import type { beignetServerOnly } from "@beignet/core/server-only";
125
+ import { offsetPageResult } from "@beignet/core/pagination";
126
+ import type { DrizzleTursoDatabase } from "@beignet/provider-drizzle-turso";
127
+ import { count, desc, eq } from "drizzle-orm";
128
+ import type {
129
+ NewTodo,
130
+ TodoRepository,
131
+ UpdateTodoData,
132
+ } from "@/features/todos/ports";
133
+ import type { Todo } from "@/features/todos/schemas";
134
+ import * as schema from "@/infra/db/schema";
135
+
136
+ type TodoRow = typeof schema.todos.$inferSelect;
137
+
138
+ function toTodo(row: TodoRow): Todo {
139
+ return {
140
+ id: row.id,
141
+ userId: row.userId,
142
+ title: row.title,
143
+ completed: row.completed,
144
+ createdAt: row.createdAt,
145
+ };
146
+ }
147
+
148
+ export function createDrizzleTodoRepository(
149
+ db: DrizzleTursoDatabase<typeof schema>,
150
+ ): TodoRepository {
151
+ return {
152
+ async list(userId, page) {
153
+ const rows = await db
154
+ .select()
155
+ .from(schema.todos)
156
+ .where(eq(schema.todos.userId, userId))
157
+ .orderBy(desc(schema.todos.createdAt))
158
+ .limit(page.limit)
159
+ .offset(page.offset);
160
+ const [{ total }] = await db
161
+ .select({ total: count() })
162
+ .from(schema.todos)
163
+ .where(eq(schema.todos.userId, userId));
164
+
165
+ return offsetPageResult(rows.map(toTodo), page, total);
166
+ },
167
+ async findById(id: string) {
168
+ const [row] = await db
169
+ .select()
170
+ .from(schema.todos)
171
+ .where(eq(schema.todos.id, id))
172
+ .limit(1);
173
+
174
+ return row ? toTodo(row) : null;
175
+ },
176
+ async create(input: NewTodo) {
177
+ const todo = {
178
+ id: crypto.randomUUID(),
179
+ userId: input.userId,
180
+ title: input.title,
181
+ completed: false,
182
+ createdAt: new Date().toISOString(),
183
+ };
184
+ const [row] = await db.insert(schema.todos).values(todo).returning();
185
+
186
+ if (!row) {
187
+ throw new Error("Failed to create todo");
188
+ }
189
+
190
+ return toTodo(row);
191
+ },
192
+ async update(id: string, input: UpdateTodoData) {
193
+ const [row] = await db
194
+ .update(schema.todos)
195
+ .set({ completed: input.completed })
196
+ .where(eq(schema.todos.id, id))
197
+ .returning();
198
+
199
+ if (!row) {
200
+ throw new Error(\`Failed to update todo \${id}\`);
201
+ }
202
+
203
+ return toTodo(row);
204
+ },
205
+ async delete(id: string) {
206
+ await db.delete(schema.todos).where(eq(schema.todos.id, id));
207
+ },
208
+ };
209
+ }
210
+ `,
211
+ dbRepositories: `import type { DrizzleTursoDatabase } from "@beignet/provider-drizzle-turso";
212
+ import { createDrizzleTodoRepository } from "@/infra/todos/drizzle-todo-repository";
213
+ import type { AppTransactionPorts } from "@/ports";
214
+ import * as schema from "./schema";
215
+
216
+ export function createRepositories(
217
+ db: DrizzleTursoDatabase<typeof schema>,
218
+ ): Omit<AppTransactionPorts, "idempotency"> {
219
+ return {
220
+ todos: createDrizzleTodoRepository(db),
221
+ };
222
+ }
223
+ `,
224
+ databaseReady: `import type { Client } from "@libsql/client";
225
+ import { drizzle } from "drizzle-orm/libsql";
226
+ import { migrate } from "drizzle-orm/libsql/migrator";
227
+
228
+ let ready: Promise<void> | undefined;
229
+
230
+ /**
231
+ * Make sure the database is usable before the first query runs.
232
+ *
233
+ * In development, pending migrations from \`drizzle/\` are applied
234
+ * automatically so a fresh clone works without remembering
235
+ * \`beignet db migrate\`. In production the schema is never mutated;
236
+ * an unmigrated database fails loudly with the command to run.
237
+ *
238
+ * Memoized per process. Next.js collects page data in parallel workers
239
+ * that can all reach this at once, so the busy timeout makes concurrent
240
+ * SQLite access wait instead of failing with SQLITE_BUSY.
241
+ */
242
+ export function ensureDatabaseReady(client: Client): Promise<void> {
243
+ ready ??= prepare(client);
244
+ return ready;
245
+ }
246
+
247
+ async function prepare(client: Client): Promise<void> {
248
+ await client.execute("PRAGMA busy_timeout = 5000");
249
+
250
+ if (process.env.NODE_ENV === "production") {
251
+ const tables = await client.execute(
252
+ "SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'user' LIMIT 1",
253
+ );
254
+ if (tables.rows.length === 0) {
255
+ throw new Error(
256
+ "Database has no tables yet. Run \`beignet db migrate\` against this database before starting the app.",
257
+ );
258
+ }
259
+ return;
260
+ }
261
+
262
+ await migrate(drizzle(client), { migrationsFolder: "drizzle" });
263
+ }
264
+ `,
265
+ dbProvider: `import type { beignetServerOnly } from "@beignet/core/server-only";
266
+ import { createProvider } from "@beignet/core/providers";
267
+ import {
268
+ createDrizzleTursoIdempotencyPort,
269
+ createDrizzleTursoUnitOfWork,
270
+ type DbPort,
271
+ } from "@beignet/provider-drizzle-turso";
272
+ import type { AppPorts } from "@/ports";
273
+ import { ensureDatabaseReady } from "./database-ready";
274
+ import { createRepositories } from "./repositories";
275
+ import type * as schema from "./schema";
276
+
277
+ export const starterDatabaseProvider = createProvider<{
278
+ db: DbPort<typeof schema>;
279
+ }>()({
280
+ name: "starter-database",
281
+
282
+ async setup({ ports }) {
283
+ const dbPort = ports.db;
284
+ if (!dbPort) {
285
+ throw new Error(
286
+ "starterDatabaseProvider requires a db port. Register createDrizzleTursoProvider({ schema }) before it.",
287
+ );
288
+ }
289
+
290
+ const repositories = createRepositories(dbPort.db);
291
+ const idempotency = createDrizzleTursoIdempotencyPort(dbPort.db);
292
+
293
+ const providedPorts: Pick<AppPorts, "idempotency" | "todos" | "uow"> = {
294
+ ...repositories,
295
+ idempotency,
296
+ uow: createDrizzleTursoUnitOfWork({
297
+ db: dbPort.db,
298
+ createTransactionPorts: (tx) => ({
299
+ ...createRepositories(tx),
300
+ idempotency: createDrizzleTursoIdempotencyPort(tx),
301
+ }),
302
+ }),
303
+ };
304
+
305
+ return {
306
+ ports: providedPorts,
307
+ async start() {
308
+ await ensureDatabaseReady(dbPort.client);
309
+ },
310
+ };
311
+ },
312
+ });
313
+ `,
314
+ dbReset: `import { createClient } from "@libsql/client";
315
+ import { drizzle } from "drizzle-orm/libsql";
316
+ import { migrate } from "drizzle-orm/libsql/migrator";
317
+ import { env } from "@/lib/env";
318
+
319
+ if (
320
+ !env.TURSO_DB_URL.startsWith("file:") &&
321
+ process.env.BEIGNET_ALLOW_DATABASE_RESET !== "true"
322
+ ) {
323
+ throw new Error(
324
+ "Refusing to reset a non-local database. Set BEIGNET_ALLOW_DATABASE_RESET=true if this is intentional.",
325
+ );
326
+ }
327
+
328
+ const tables = [
329
+ "verification",
330
+ "account",
331
+ "session",
332
+ "todos",
333
+ "user",
334
+ "idempotency_records",
335
+ "__drizzle_migrations",
336
+ ] as const;
337
+
338
+ const client = createClient({
339
+ url: env.TURSO_DB_URL,
340
+ authToken: env.TURSO_DB_AUTH_TOKEN,
341
+ });
342
+
343
+ try {
344
+ await client.execute("PRAGMA foreign_keys = OFF");
345
+ try {
346
+ for (const table of tables) {
347
+ await client.execute(\`DROP TABLE IF EXISTS \${table}\`);
348
+ }
349
+ } finally {
350
+ await client.execute("PRAGMA foreign_keys = ON");
351
+ }
352
+
353
+ await migrate(drizzle(client), { migrationsFolder: "drizzle" });
354
+ console.log("Database reset.");
355
+ } finally {
356
+ client.close();
357
+ }
358
+ `,
359
+ dbTestDatabase: `import { existsSync, unlinkSync } from "node:fs";
360
+ import { tmpdir } from "node:os";
361
+ import { join } from "node:path";
362
+ import { type Client, createClient } from "@libsql/client";
363
+ import { drizzle, type LibSQLDatabase } from "drizzle-orm/libsql";
364
+ import { migrate } from "drizzle-orm/libsql/migrator";
365
+ import { createRepositories } from "./repositories";
366
+ import * as schema from "./schema";
367
+
368
+ export type TestDatabase = {
369
+ client: Client;
370
+ db: LibSQLDatabase<typeof schema>;
371
+ repositories: ReturnType<typeof createRepositories>;
372
+ path: string;
373
+ close(): Promise<void>;
374
+ };
375
+
376
+ export async function createTestDatabase(): Promise<TestDatabase> {
377
+ const path = join(tmpdir(), "beignet-test-" + crypto.randomUUID() + ".db");
378
+ const client = createClient({ url: "file:" + path });
379
+ const db = drizzle(client, { schema });
380
+ await migrate(db, { migrationsFolder: "drizzle" });
381
+
382
+ return {
383
+ client,
384
+ db,
385
+ repositories: createRepositories(db),
386
+ path,
387
+ close: async () => {
388
+ client.close();
389
+ if (existsSync(path)) {
390
+ unlinkSync(path);
391
+ }
392
+ },
393
+ };
394
+ }
395
+ `,
396
+ // Generated by drizzle-kit generate --name starter against dbSchema above.
397
+ starterMigrationSql: `CREATE TABLE \`account\` (
398
+ \`id\` text PRIMARY KEY NOT NULL,
399
+ \`account_id\` text NOT NULL,
400
+ \`provider_id\` text NOT NULL,
401
+ \`user_id\` text NOT NULL,
402
+ \`access_token\` text,
403
+ \`refresh_token\` text,
404
+ \`id_token\` text,
405
+ \`access_token_expires_at\` integer,
406
+ \`refresh_token_expires_at\` integer,
407
+ \`scope\` text,
408
+ \`password\` text,
409
+ \`created_at\` integer NOT NULL,
410
+ \`updated_at\` integer NOT NULL,
411
+ FOREIGN KEY (\`user_id\`) REFERENCES \`user\`(\`id\`) ON UPDATE no action ON DELETE cascade
412
+ );
413
+ --> statement-breakpoint
414
+ CREATE TABLE \`idempotency_records\` (
415
+ \`storage_key\` text PRIMARY KEY NOT NULL,
416
+ \`namespace\` text NOT NULL,
417
+ \`idempotency_key\` text NOT NULL,
418
+ \`scope_key\` text NOT NULL,
419
+ \`fingerprint\` text NOT NULL,
420
+ \`status\` text NOT NULL,
421
+ \`result_json\` text,
422
+ \`reserved_at\` text NOT NULL,
423
+ \`completed_at\` text,
424
+ \`expires_at\` text,
425
+ \`updated_at\` text NOT NULL
426
+ );
427
+ --> statement-breakpoint
428
+ CREATE INDEX \`idempotency_records_lookup_idx\` ON \`idempotency_records\` (\`namespace\`,\`scope_key\`,\`idempotency_key\`);--> statement-breakpoint
429
+ CREATE INDEX \`idempotency_records_expires_idx\` ON \`idempotency_records\` (\`expires_at\`);--> statement-breakpoint
430
+ CREATE TABLE \`session\` (
431
+ \`id\` text PRIMARY KEY NOT NULL,
432
+ \`expires_at\` integer NOT NULL,
433
+ \`token\` text NOT NULL,
434
+ \`created_at\` integer NOT NULL,
435
+ \`updated_at\` integer NOT NULL,
436
+ \`ip_address\` text,
437
+ \`user_agent\` text,
438
+ \`user_id\` text NOT NULL,
439
+ FOREIGN KEY (\`user_id\`) REFERENCES \`user\`(\`id\`) ON UPDATE no action ON DELETE cascade
440
+ );
441
+ --> statement-breakpoint
442
+ CREATE UNIQUE INDEX \`session_token_unique\` ON \`session\` (\`token\`);--> statement-breakpoint
443
+ CREATE TABLE \`todos\` (
444
+ \`id\` text PRIMARY KEY NOT NULL,
445
+ \`user_id\` text NOT NULL,
446
+ \`title\` text NOT NULL,
447
+ \`completed\` integer DEFAULT false NOT NULL,
448
+ \`created_at\` text NOT NULL,
449
+ FOREIGN KEY (\`user_id\`) REFERENCES \`user\`(\`id\`) ON UPDATE no action ON DELETE cascade
450
+ );
451
+ --> statement-breakpoint
452
+ CREATE INDEX \`todos_user_idx\` ON \`todos\` (\`user_id\`,\`created_at\`);--> statement-breakpoint
453
+ CREATE TABLE \`user\` (
454
+ \`id\` text PRIMARY KEY NOT NULL,
455
+ \`name\` text NOT NULL,
456
+ \`email\` text NOT NULL,
457
+ \`email_verified\` integer DEFAULT false NOT NULL,
458
+ \`image\` text,
459
+ \`created_at\` integer NOT NULL,
460
+ \`updated_at\` integer NOT NULL
461
+ );
462
+ --> statement-breakpoint
463
+ CREATE UNIQUE INDEX \`user_email_unique\` ON \`user\` (\`email\`);--> statement-breakpoint
464
+ CREATE TABLE \`verification\` (
465
+ \`id\` text PRIMARY KEY NOT NULL,
466
+ \`identifier\` text NOT NULL,
467
+ \`value\` text NOT NULL,
468
+ \`expires_at\` integer NOT NULL,
469
+ \`created_at\` integer,
470
+ \`updated_at\` integer
471
+ );
472
+ `,
473
+ starterMigrationJournal: `{
474
+ "version": "7",
475
+ "dialect": "sqlite",
476
+ "entries": [
477
+ {
478
+ "idx": 0,
479
+ "version": "6",
480
+ "when": 1781185557868,
481
+ "tag": "0000_starter",
482
+ "breakpoints": true
483
+ }
484
+ ]
485
+ }`,
486
+ starterMigrationSnapshot: `{
487
+ "version": "6",
488
+ "dialect": "sqlite",
489
+ "id": "5131bbf1-cff0-42de-a5f4-298187fdafd1",
490
+ "prevId": "00000000-0000-0000-0000-000000000000",
491
+ "tables": {
492
+ "account": {
493
+ "name": "account",
494
+ "columns": {
495
+ "id": {
496
+ "name": "id",
497
+ "type": "text",
498
+ "primaryKey": true,
499
+ "notNull": true,
500
+ "autoincrement": false
501
+ },
502
+ "account_id": {
503
+ "name": "account_id",
504
+ "type": "text",
505
+ "primaryKey": false,
506
+ "notNull": true,
507
+ "autoincrement": false
508
+ },
509
+ "provider_id": {
510
+ "name": "provider_id",
511
+ "type": "text",
512
+ "primaryKey": false,
513
+ "notNull": true,
514
+ "autoincrement": false
515
+ },
516
+ "user_id": {
517
+ "name": "user_id",
518
+ "type": "text",
519
+ "primaryKey": false,
520
+ "notNull": true,
521
+ "autoincrement": false
522
+ },
523
+ "access_token": {
524
+ "name": "access_token",
525
+ "type": "text",
526
+ "primaryKey": false,
527
+ "notNull": false,
528
+ "autoincrement": false
529
+ },
530
+ "refresh_token": {
531
+ "name": "refresh_token",
532
+ "type": "text",
533
+ "primaryKey": false,
534
+ "notNull": false,
535
+ "autoincrement": false
536
+ },
537
+ "id_token": {
538
+ "name": "id_token",
539
+ "type": "text",
540
+ "primaryKey": false,
541
+ "notNull": false,
542
+ "autoincrement": false
543
+ },
544
+ "access_token_expires_at": {
545
+ "name": "access_token_expires_at",
546
+ "type": "integer",
547
+ "primaryKey": false,
548
+ "notNull": false,
549
+ "autoincrement": false
550
+ },
551
+ "refresh_token_expires_at": {
552
+ "name": "refresh_token_expires_at",
553
+ "type": "integer",
554
+ "primaryKey": false,
555
+ "notNull": false,
556
+ "autoincrement": false
557
+ },
558
+ "scope": {
559
+ "name": "scope",
560
+ "type": "text",
561
+ "primaryKey": false,
562
+ "notNull": false,
563
+ "autoincrement": false
564
+ },
565
+ "password": {
566
+ "name": "password",
567
+ "type": "text",
568
+ "primaryKey": false,
569
+ "notNull": false,
570
+ "autoincrement": false
571
+ },
572
+ "created_at": {
573
+ "name": "created_at",
574
+ "type": "integer",
575
+ "primaryKey": false,
576
+ "notNull": true,
577
+ "autoincrement": false
578
+ },
579
+ "updated_at": {
580
+ "name": "updated_at",
581
+ "type": "integer",
582
+ "primaryKey": false,
583
+ "notNull": true,
584
+ "autoincrement": false
585
+ }
586
+ },
587
+ "indexes": {},
588
+ "foreignKeys": {
589
+ "account_user_id_user_id_fk": {
590
+ "name": "account_user_id_user_id_fk",
591
+ "tableFrom": "account",
592
+ "tableTo": "user",
593
+ "columnsFrom": [
594
+ "user_id"
595
+ ],
596
+ "columnsTo": [
597
+ "id"
598
+ ],
599
+ "onDelete": "cascade",
600
+ "onUpdate": "no action"
601
+ }
602
+ },
603
+ "compositePrimaryKeys": {},
604
+ "uniqueConstraints": {},
605
+ "checkConstraints": {}
606
+ },
607
+ "idempotency_records": {
608
+ "name": "idempotency_records",
609
+ "columns": {
610
+ "storage_key": {
611
+ "name": "storage_key",
612
+ "type": "text",
613
+ "primaryKey": true,
614
+ "notNull": true,
615
+ "autoincrement": false
616
+ },
617
+ "namespace": {
618
+ "name": "namespace",
619
+ "type": "text",
620
+ "primaryKey": false,
621
+ "notNull": true,
622
+ "autoincrement": false
623
+ },
624
+ "idempotency_key": {
625
+ "name": "idempotency_key",
626
+ "type": "text",
627
+ "primaryKey": false,
628
+ "notNull": true,
629
+ "autoincrement": false
630
+ },
631
+ "scope_key": {
632
+ "name": "scope_key",
633
+ "type": "text",
634
+ "primaryKey": false,
635
+ "notNull": true,
636
+ "autoincrement": false
637
+ },
638
+ "fingerprint": {
639
+ "name": "fingerprint",
640
+ "type": "text",
641
+ "primaryKey": false,
642
+ "notNull": true,
643
+ "autoincrement": false
644
+ },
645
+ "status": {
646
+ "name": "status",
647
+ "type": "text",
648
+ "primaryKey": false,
649
+ "notNull": true,
650
+ "autoincrement": false
651
+ },
652
+ "result_json": {
653
+ "name": "result_json",
654
+ "type": "text",
655
+ "primaryKey": false,
656
+ "notNull": false,
657
+ "autoincrement": false
658
+ },
659
+ "reserved_at": {
660
+ "name": "reserved_at",
661
+ "type": "text",
662
+ "primaryKey": false,
663
+ "notNull": true,
664
+ "autoincrement": false
665
+ },
666
+ "completed_at": {
667
+ "name": "completed_at",
668
+ "type": "text",
669
+ "primaryKey": false,
670
+ "notNull": false,
671
+ "autoincrement": false
672
+ },
673
+ "expires_at": {
674
+ "name": "expires_at",
675
+ "type": "text",
676
+ "primaryKey": false,
677
+ "notNull": false,
678
+ "autoincrement": false
679
+ },
680
+ "updated_at": {
681
+ "name": "updated_at",
682
+ "type": "text",
683
+ "primaryKey": false,
684
+ "notNull": true,
685
+ "autoincrement": false
686
+ }
687
+ },
688
+ "indexes": {
689
+ "idempotency_records_lookup_idx": {
690
+ "name": "idempotency_records_lookup_idx",
691
+ "columns": [
692
+ "namespace",
693
+ "scope_key",
694
+ "idempotency_key"
695
+ ],
696
+ "isUnique": false
697
+ },
698
+ "idempotency_records_expires_idx": {
699
+ "name": "idempotency_records_expires_idx",
700
+ "columns": [
701
+ "expires_at"
702
+ ],
703
+ "isUnique": false
704
+ }
705
+ },
706
+ "foreignKeys": {},
707
+ "compositePrimaryKeys": {},
708
+ "uniqueConstraints": {},
709
+ "checkConstraints": {}
710
+ },
711
+ "session": {
712
+ "name": "session",
713
+ "columns": {
714
+ "id": {
715
+ "name": "id",
716
+ "type": "text",
717
+ "primaryKey": true,
718
+ "notNull": true,
719
+ "autoincrement": false
720
+ },
721
+ "expires_at": {
722
+ "name": "expires_at",
723
+ "type": "integer",
724
+ "primaryKey": false,
725
+ "notNull": true,
726
+ "autoincrement": false
727
+ },
728
+ "token": {
729
+ "name": "token",
730
+ "type": "text",
731
+ "primaryKey": false,
732
+ "notNull": true,
733
+ "autoincrement": false
734
+ },
735
+ "created_at": {
736
+ "name": "created_at",
737
+ "type": "integer",
738
+ "primaryKey": false,
739
+ "notNull": true,
740
+ "autoincrement": false
741
+ },
742
+ "updated_at": {
743
+ "name": "updated_at",
744
+ "type": "integer",
745
+ "primaryKey": false,
746
+ "notNull": true,
747
+ "autoincrement": false
748
+ },
749
+ "ip_address": {
750
+ "name": "ip_address",
751
+ "type": "text",
752
+ "primaryKey": false,
753
+ "notNull": false,
754
+ "autoincrement": false
755
+ },
756
+ "user_agent": {
757
+ "name": "user_agent",
758
+ "type": "text",
759
+ "primaryKey": false,
760
+ "notNull": false,
761
+ "autoincrement": false
762
+ },
763
+ "user_id": {
764
+ "name": "user_id",
765
+ "type": "text",
766
+ "primaryKey": false,
767
+ "notNull": true,
768
+ "autoincrement": false
769
+ }
770
+ },
771
+ "indexes": {
772
+ "session_token_unique": {
773
+ "name": "session_token_unique",
774
+ "columns": [
775
+ "token"
776
+ ],
777
+ "isUnique": true
778
+ }
779
+ },
780
+ "foreignKeys": {
781
+ "session_user_id_user_id_fk": {
782
+ "name": "session_user_id_user_id_fk",
783
+ "tableFrom": "session",
784
+ "tableTo": "user",
785
+ "columnsFrom": [
786
+ "user_id"
787
+ ],
788
+ "columnsTo": [
789
+ "id"
790
+ ],
791
+ "onDelete": "cascade",
792
+ "onUpdate": "no action"
793
+ }
794
+ },
795
+ "compositePrimaryKeys": {},
796
+ "uniqueConstraints": {},
797
+ "checkConstraints": {}
798
+ },
799
+ "todos": {
800
+ "name": "todos",
801
+ "columns": {
802
+ "id": {
803
+ "name": "id",
804
+ "type": "text",
805
+ "primaryKey": true,
806
+ "notNull": true,
807
+ "autoincrement": false
808
+ },
809
+ "user_id": {
810
+ "name": "user_id",
811
+ "type": "text",
812
+ "primaryKey": false,
813
+ "notNull": true,
814
+ "autoincrement": false
815
+ },
816
+ "title": {
817
+ "name": "title",
818
+ "type": "text",
819
+ "primaryKey": false,
820
+ "notNull": true,
821
+ "autoincrement": false
822
+ },
823
+ "completed": {
824
+ "name": "completed",
825
+ "type": "integer",
826
+ "primaryKey": false,
827
+ "notNull": true,
828
+ "autoincrement": false,
829
+ "default": false
830
+ },
831
+ "created_at": {
832
+ "name": "created_at",
833
+ "type": "text",
834
+ "primaryKey": false,
835
+ "notNull": true,
836
+ "autoincrement": false
837
+ }
838
+ },
839
+ "indexes": {
840
+ "todos_user_idx": {
841
+ "name": "todos_user_idx",
842
+ "columns": [
843
+ "user_id",
844
+ "created_at"
845
+ ],
846
+ "isUnique": false
847
+ }
848
+ },
849
+ "foreignKeys": {
850
+ "todos_user_id_user_id_fk": {
851
+ "name": "todos_user_id_user_id_fk",
852
+ "tableFrom": "todos",
853
+ "tableTo": "user",
854
+ "columnsFrom": [
855
+ "user_id"
856
+ ],
857
+ "columnsTo": [
858
+ "id"
859
+ ],
860
+ "onDelete": "cascade",
861
+ "onUpdate": "no action"
862
+ }
863
+ },
864
+ "compositePrimaryKeys": {},
865
+ "uniqueConstraints": {},
866
+ "checkConstraints": {}
867
+ },
868
+ "user": {
869
+ "name": "user",
870
+ "columns": {
871
+ "id": {
872
+ "name": "id",
873
+ "type": "text",
874
+ "primaryKey": true,
875
+ "notNull": true,
876
+ "autoincrement": false
877
+ },
878
+ "name": {
879
+ "name": "name",
880
+ "type": "text",
881
+ "primaryKey": false,
882
+ "notNull": true,
883
+ "autoincrement": false
884
+ },
885
+ "email": {
886
+ "name": "email",
887
+ "type": "text",
888
+ "primaryKey": false,
889
+ "notNull": true,
890
+ "autoincrement": false
891
+ },
892
+ "email_verified": {
893
+ "name": "email_verified",
894
+ "type": "integer",
895
+ "primaryKey": false,
896
+ "notNull": true,
897
+ "autoincrement": false,
898
+ "default": false
899
+ },
900
+ "image": {
901
+ "name": "image",
902
+ "type": "text",
903
+ "primaryKey": false,
904
+ "notNull": false,
905
+ "autoincrement": false
906
+ },
907
+ "created_at": {
908
+ "name": "created_at",
909
+ "type": "integer",
910
+ "primaryKey": false,
911
+ "notNull": true,
912
+ "autoincrement": false
913
+ },
914
+ "updated_at": {
915
+ "name": "updated_at",
916
+ "type": "integer",
917
+ "primaryKey": false,
918
+ "notNull": true,
919
+ "autoincrement": false
920
+ }
921
+ },
922
+ "indexes": {
923
+ "user_email_unique": {
924
+ "name": "user_email_unique",
925
+ "columns": [
926
+ "email"
927
+ ],
928
+ "isUnique": true
929
+ }
930
+ },
931
+ "foreignKeys": {},
932
+ "compositePrimaryKeys": {},
933
+ "uniqueConstraints": {},
934
+ "checkConstraints": {}
935
+ },
936
+ "verification": {
937
+ "name": "verification",
938
+ "columns": {
939
+ "id": {
940
+ "name": "id",
941
+ "type": "text",
942
+ "primaryKey": true,
943
+ "notNull": true,
944
+ "autoincrement": false
945
+ },
946
+ "identifier": {
947
+ "name": "identifier",
948
+ "type": "text",
949
+ "primaryKey": false,
950
+ "notNull": true,
951
+ "autoincrement": false
952
+ },
953
+ "value": {
954
+ "name": "value",
955
+ "type": "text",
956
+ "primaryKey": false,
957
+ "notNull": true,
958
+ "autoincrement": false
959
+ },
960
+ "expires_at": {
961
+ "name": "expires_at",
962
+ "type": "integer",
963
+ "primaryKey": false,
964
+ "notNull": true,
965
+ "autoincrement": false
966
+ },
967
+ "created_at": {
968
+ "name": "created_at",
969
+ "type": "integer",
970
+ "primaryKey": false,
971
+ "notNull": false,
972
+ "autoincrement": false
973
+ },
974
+ "updated_at": {
975
+ "name": "updated_at",
976
+ "type": "integer",
977
+ "primaryKey": false,
978
+ "notNull": false,
979
+ "autoincrement": false
980
+ }
981
+ },
982
+ "indexes": {},
983
+ "foreignKeys": {},
984
+ "compositePrimaryKeys": {},
985
+ "uniqueConstraints": {},
986
+ "checkConstraints": {}
987
+ }
988
+ },
989
+ "views": {},
990
+ "enums": {},
991
+ "_meta": {
992
+ "schemas": {},
993
+ "tables": {},
994
+ "columns": {}
995
+ },
996
+ "internal": {
997
+ "indexes": {}
998
+ }
999
+ }`,
1000
+ };
1001
+
1002
+ export { files as dbFiles };