From 4613f649103526594a89964d12ad1a3a65a8a2c2 Mon Sep 17 00:00:00 2001 From: Charles Bochet Date: Wed, 14 Feb 2024 17:53:50 +0100 Subject: [PATCH] Add proper ORM and postgres support (#3978) * Add postgresql support * Fixes * Fix perfs --- package.json | 3 + packages/twenty-website/.env.example | 3 + packages/twenty-website/package.json | 7 +- .../src/app/components/AvatarGrid.tsx | 13 +- .../[slug]/components/ActivityLog.tsx | 3 + .../[slug]/components/ProfileCard.tsx | 10 +- .../developers/contributors/[slug]/page.tsx | 210 ++--- .../contributors/api/[slug]/route.tsx | 23 - .../contributors/api/generate/route.tsx | 251 +++--- .../src/app/developers/contributors/page.tsx | 55 +- .../twenty-website/src/database/database.ts | 70 ++ packages/twenty-website/src/database/model.ts | 47 ++ .../postgres/drizzle-posgres.config.ts | 14 + .../migrations/0000_absent_giant_man.sql | 84 ++ .../migrations/meta/0000_snapshot.json | 343 ++++++++ .../postgres/migrations/meta/_journal.json | 13 + .../src/database/postgres/schema-postgres.ts | 52 ++ .../database/sqlite/drizzle-sqlite.config.ts | 14 + .../sqlite/migrations/0000_small_karma.sql | 54 ++ .../sqlite/migrations/meta/0000_snapshot.json | 367 ++++++++ .../sqlite/migrations/meta/_journal.json | 13 + .../src/database/sqlite/schema-sqlite.ts | 52 ++ packages/twenty-website/tsconfig.json | 2 +- yarn.lock | 784 +++++++++++++++++- 24 files changed, 2143 insertions(+), 344 deletions(-) delete mode 100644 packages/twenty-website/src/app/developers/contributors/api/[slug]/route.tsx create mode 100644 packages/twenty-website/src/database/database.ts create mode 100644 packages/twenty-website/src/database/model.ts create mode 100644 packages/twenty-website/src/database/postgres/drizzle-posgres.config.ts create mode 100644 packages/twenty-website/src/database/postgres/migrations/0000_absent_giant_man.sql create mode 100644 packages/twenty-website/src/database/postgres/migrations/meta/0000_snapshot.json create mode 100644 packages/twenty-website/src/database/postgres/migrations/meta/_journal.json create mode 100644 packages/twenty-website/src/database/postgres/schema-postgres.ts create mode 100644 packages/twenty-website/src/database/sqlite/drizzle-sqlite.config.ts create mode 100644 packages/twenty-website/src/database/sqlite/migrations/0000_small_karma.sql create mode 100644 packages/twenty-website/src/database/sqlite/migrations/meta/0000_snapshot.json create mode 100644 packages/twenty-website/src/database/sqlite/migrations/meta/_journal.json create mode 100644 packages/twenty-website/src/database/sqlite/schema-sqlite.ts diff --git a/package.json b/package.json index 69663b19af..1af4cefc58 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "@hello-pangea/dnd": "^16.2.0", "@hookform/resolvers": "^3.1.1", "@jsdevtools/rehype-toc": "^3.0.2", + "@libsql/client": "^0.4.3", "@mdx-js/react": "^3.0.0", "@nestjs/apollo": "^11.0.5", "@nestjs/axios": "^3.0.1", @@ -76,6 +77,7 @@ "deep-equal": "^2.2.2", "docusaurus-node-polyfills": "^1.0.0", "dotenv-cli": "^7.2.1", + "drizzle-orm": "^0.29.3", "esbuild-plugin-svgr": "^2.1.0", "file-type": "16.5.4", "framer-motion": "^10.12.17", @@ -238,6 +240,7 @@ "cross-var": "^1.1.0", "danger": "^11.3.0", "dotenv-cli": "^7.2.1", + "drizzle-kit": "^0.20.14", "eslint": "^8.53.0", "eslint-config-next": "14.0.4", "eslint-config-prettier": "^9.1.0", diff --git a/packages/twenty-website/.env.example b/packages/twenty-website/.env.example index 9195d1d5ba..2e353430a4 100644 --- a/packages/twenty-website/.env.example +++ b/packages/twenty-website/.env.example @@ -1,2 +1,5 @@ BASE_URL=http://localhost:3000 GITHUB_TOKEN=your_github_token +DATABASE_DRIVER=sqlite # or pg +DATABASE_PG_URL=postgres://website:website@localhost:5432/website # only if using postgres + diff --git a/packages/twenty-website/package.json b/packages/twenty-website/package.json index f5a2bb88bf..7363f50327 100644 --- a/packages/twenty-website/package.json +++ b/packages/twenty-website/package.json @@ -7,6 +7,11 @@ "dev": "next dev", "build": "next build", "start": "next start", - "lint": "next lint" + "lint": "next lint", + "database:generate:pg": "drizzle-kit generate:pg --config=src/database/postgres/drizzle-posgres.config.ts", + "database:generate:sqlite": "drizzle-kit generate:sqlite --config=src/database/sqlite/drizzle-sqlite.config.ts" + }, + "dependencies": { + "postgres": "^3.4.3" } } diff --git a/packages/twenty-website/src/app/components/AvatarGrid.tsx b/packages/twenty-website/src/app/components/AvatarGrid.tsx index 833525d5b5..28c8b06a75 100644 --- a/packages/twenty-website/src/app/components/AvatarGrid.tsx +++ b/packages/twenty-website/src/app/components/AvatarGrid.tsx @@ -4,7 +4,7 @@ import styled from '@emotion/styled'; import Link from 'next/link'; export interface User { - login: string; + id: string; avatarUrl: string; } @@ -66,13 +66,10 @@ const AvatarGrid = ({ users }: { users: User[] }) => { return ( {users.map((user) => ( - - - {user.login} - {user.login} + + + {user.id} + {user.id} ))} diff --git a/packages/twenty-website/src/app/developers/contributors/[slug]/components/ActivityLog.tsx b/packages/twenty-website/src/app/developers/contributors/[slug]/components/ActivityLog.tsx index fbe842f935..692b7521b0 100644 --- a/packages/twenty-website/src/app/developers/contributors/[slug]/components/ActivityLog.tsx +++ b/packages/twenty-website/src/app/developers/contributors/[slug]/components/ActivityLog.tsx @@ -10,6 +10,9 @@ export const ActivityLog = ({ }: { data: { value: number; day: string }[]; }) => { + if (!data.length) { + return null; + } return ( Activity diff --git a/packages/twenty-website/src/app/developers/contributors/[slug]/components/ProfileCard.tsx b/packages/twenty-website/src/app/developers/contributors/[slug]/components/ProfileCard.tsx index f88a8d8b20..6a836fd099 100644 --- a/packages/twenty-website/src/app/developers/contributors/[slug]/components/ProfileCard.tsx +++ b/packages/twenty-website/src/app/developers/contributors/[slug]/components/ProfileCard.tsx @@ -90,10 +90,12 @@ export const ProfileCard = ({ -

- Contributing since{' '} - {format(new Date(firstContributionAt), 'MMMM yyyy')} -

+ {firstContributionAt && ( +

+ Contributing since{' '} + {format(new Date(firstContributionAt), 'MMMM yyyy')} +

+ )} ); diff --git a/packages/twenty-website/src/app/developers/contributors/[slug]/page.tsx b/packages/twenty-website/src/app/developers/contributors/[slug]/page.tsx index 309c817aed..47f17d9df1 100644 --- a/packages/twenty-website/src/app/developers/contributors/[slug]/page.tsx +++ b/packages/twenty-website/src/app/developers/contributors/[slug]/page.tsx @@ -1,4 +1,3 @@ -import Database from 'better-sqlite3'; import { Metadata } from 'next'; import { Background } from '@/app/components/oss-friends/Background'; @@ -9,12 +8,8 @@ import { ProfileCard } from '@/app/developers/contributors/[slug]/components/Pro import { ProfileInfo } from '@/app/developers/contributors/[slug]/components/ProfileInfo'; import { PullRequests } from '@/app/developers/contributors/[slug]/components/PullRequests'; import { ThankYou } from '@/app/developers/contributors/[slug]/components/ThankYou'; - -interface Contributor { - login: string; - avatarUrl: string; - pullRequestCount: number; -} +import { findAll } from '@/database/database'; +import { pullRequestModel, userModel } from '@/database/model'; export function generateMetadata({ params, @@ -27,134 +22,109 @@ export function generateMetadata({ } export default async function ({ params }: { params: { slug: string } }) { - const db = new Database('db.sqlite', { readonly: true }); + const contributors = await findAll(userModel); - const contributor = db - .prepare( - ` - SELECT - u.login, - u.avatarUrl, - (SELECT COUNT(*) FROM pullRequests WHERE authorId = u.id) AS pullRequestCount, - (SELECT COUNT(*) FROM issues WHERE authorId = u.id) AS issuesCount - FROM - users u - WHERE - u.login = :user_id -`, - ) - .get({ user_id: params.slug }) as Contributor; + const contributor = contributors.find( + (contributor) => contributor.id === params.slug, + ); - const pullRequestActivity = db - .prepare( - ` - SELECT - COUNT(*) as value, - DATE(createdAt) as day - FROM - pullRequests - WHERE - authorId = (SELECT id FROM users WHERE login = :user_id) - GROUP BY - DATE(createdAt) - ORDER BY - DATE(createdAt) -`, - ) - .all({ user_id: params.slug }) as { value: number; day: string }[]; + if (!contributor) { + return; + } - // Latest PRs. - const pullRequestList = db - .prepare( - ` - SELECT - id, - title, - body, - url, - createdAt, - updatedAt, - closedAt, - mergedAt, - authorId - FROM - pullRequests - WHERE - authorId = (SELECT id FROM users WHERE login = :user_id) - ORDER BY - DATE(createdAt) DESC - LIMIT - 10 -`, - ) - .all({ user_id: params.slug }) as { - title: string; - createdAt: string; - url: string; - id: string; - mergedAt: string | null; - authorId: string; - }[]; + const pullRequests = await findAll(pullRequestModel); + const mergedPullRequests = pullRequests + .filter((pr) => pr.mergedAt !== null) + .filter( + (pr) => + ![ + 'dependabot', + 'cyborch', + 'emilienchvt', + 'Samox', + 'charlesBochet', + 'gitstart-app', + 'thaisguigon', + 'lucasbordeau', + 'magrinj', + 'Weiko', + 'gitstart-twenty', + 'bosiraphael', + 'martmull', + 'FelixMalfait', + 'thomtrp', + 'Bonapara', + 'nimraahmed', + ].includes(pr.authorId), + ); - const mergedPullRequests = db - .prepare( - ` - SELECT * FROM ( - SELECT - merged_pr_counts.*, - (RANK() OVER(ORDER BY merged_count) - 1) / CAST( total_authors as float) * 100 as rank_percentage - FROM - ( - SELECT - authorId, - COUNT(*) FILTER (WHERE mergedAt IS NOT NULL) as merged_count - FROM - pullRequests pr - JOIN - users u ON pr.authorId = u.id - WHERE - u.isEmployee = FALSE - GROUP BY - authorId - ) AS merged_pr_counts - CROSS JOIN - ( - SELECT COUNT(DISTINCT authorId) as total_authors - FROM pullRequests pr - JOIN - users u ON pr.authorId = u.id - WHERE - u.isEmployee = FALSE - ) AS author_counts - ) WHERE authorId = (SELECT id FROM users WHERE login = :user_id) - `, - ) - .all({ user_id: params.slug }) as { - merged_count: number; - rank_percentage: number; - }[]; + const contributorPullRequests = pullRequests.filter( + (pr) => pr.authorId === contributor.id, + ); + const mergedContributorPullRequests = contributorPullRequests.filter( + (pr) => pr.mergedAt !== null, + ); - db.close(); + const mergedContributorPullRequestsByContributor = mergedPullRequests.reduce( + (acc, pr) => { + acc[pr.authorId] = (acc[pr.authorId] || 0) + 1; + return acc; + }, + {}, + ); + + const mergedContributorPullRequestsByContributorArray = Object.entries( + mergedContributorPullRequestsByContributor, + ) + .map(([authorId, value]) => ({ authorId, value })) + .sort((a, b) => b.value - a.value); + + const contributorRank = + ((mergedContributorPullRequestsByContributorArray.findIndex( + (contributor) => contributor.authorId === params.slug, + ) + + 1) / + contributors.length) * + 100; + + const pullRequestActivity = contributorPullRequests.reduce((acc, pr) => { + const date = new Date(pr.createdAt).toISOString().split('T')[0]; + acc[date] = (acc[date] || 0) + 1; + return acc; + }, []); + + const pullRequestActivityArray = Object.entries(pullRequestActivity) + .map(([day, value]) => ({ day, value })) + .sort((a, b) => new Date(a.day).getTime() - new Date(b.day).getTime()); return ( <> - + + + - - diff --git a/packages/twenty-website/src/app/developers/contributors/api/[slug]/route.tsx b/packages/twenty-website/src/app/developers/contributors/api/[slug]/route.tsx deleted file mode 100644 index 1f9394847a..0000000000 --- a/packages/twenty-website/src/app/developers/contributors/api/[slug]/route.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import Database from 'better-sqlite3'; - -export async function GET( - request: Request, - { params }: { params: { slug: string } }, -) { - const db = new Database('db.sqlite', { readonly: true }); - - if ( - params.slug !== 'users' && - params.slug !== 'labels' && - params.slug !== 'pullRequests' && - params.slug !== 'issues' - ) { - return Response.json({ error: 'Invalid table name' }, { status: 400 }); - } - - const rows = db.prepare('SELECT * FROM ' + params.slug).all(); - - db.close(); - - return Response.json(rows); -} diff --git a/packages/twenty-website/src/app/developers/contributors/api/generate/route.tsx b/packages/twenty-website/src/app/developers/contributors/api/generate/route.tsx index 64040569b1..0e717c4282 100644 --- a/packages/twenty-website/src/app/developers/contributors/api/generate/route.tsx +++ b/packages/twenty-website/src/app/developers/contributors/api/generate/route.tsx @@ -1,7 +1,14 @@ import { graphql } from '@octokit/graphql'; -import Database from 'better-sqlite3'; -const db = new Database('db.sqlite', { verbose: console.log }); +import { insertMany, migrate } from '@/database/database'; +import { + issueLabelModel, + issueModel, + labelModel, + pullRequestLabelModel, + pullRequestModel, + userModel, +} from '@/database/model'; interface LabelNode { id: string; @@ -188,176 +195,132 @@ async function fetchAssignableUsers(): Promise> { return new Set(repository.assignableUsers.nodes.map((user) => user.login)); } -const initDb = () => { - db.prepare( - ` - CREATE TABLE IF NOT EXISTS pullRequests ( - id TEXT PRIMARY KEY, - title TEXT, - body TEXT, - url TEXT, - createdAt TEXT, - updatedAt TEXT, - closedAt TEXT, - mergedAt TEXT, - authorId TEXT, - FOREIGN KEY (authorId) REFERENCES users(id) - ); - `, - ).run(); - - db.prepare( - ` - CREATE TABLE IF NOT EXISTS issues ( - id TEXT PRIMARY KEY, - title TEXT, - body TEXT, - url TEXT, - createdAt TEXT, - updatedAt TEXT, - closedAt TEXT, - authorId TEXT, - FOREIGN KEY (authorId) REFERENCES users(id) - ); - `, - ).run(); - - db.prepare( - ` - CREATE TABLE IF NOT EXISTS users ( - id TEXT PRIMARY KEY, - login TEXT, - avatarUrl TEXT, - url TEXT, - isEmployee BOOLEAN - ); - `, - ).run(); - - db.prepare( - ` - CREATE TABLE IF NOT EXISTS labels ( - id TEXT PRIMARY KEY, - name TEXT, - color TEXT, - description TEXT - ); - `, - ).run(); - - db.prepare( - ` - CREATE TABLE IF NOT EXISTS pullRequestLabels ( - pullRequestId TEXT, - labelId TEXT, - FOREIGN KEY (pullRequestId) REFERENCES pullRequests(id), - FOREIGN KEY (labelId) REFERENCES labels(id) - ); - `, - ).run(); - - db.prepare( - ` - CREATE TABLE IF NOT EXISTS issueLabels ( - issueId TEXT, - labelId TEXT, - FOREIGN KEY (issueId) REFERENCES issues(id), - FOREIGN KEY (labelId) REFERENCES labels(id) - ); - `, - ).run(); -}; - export async function GET() { - initDb(); + await migrate(); // TODO if we ever hit API Rate Limiting const lastPRCursor = null; const lastIssueCursor = null; const assignableUsers = await fetchAssignableUsers(); - const prs = (await fetchData(lastPRCursor)) as Array; - const issues = (await fetchData(lastIssueCursor, true)) as Array; + const fetchedPRs = (await fetchData(lastPRCursor)) as Array; + const fetchedIssues = (await fetchData( + lastIssueCursor, + true, + )) as Array; - const insertPR = db.prepare( - 'INSERT INTO pullRequests (id, title, body, url, createdAt, updatedAt, closedAt, mergedAt, authorId) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) ON CONFLICT(id) DO NOTHING', - ); - const insertIssue = db.prepare( - 'INSERT INTO issues (id, title, body, url, createdAt, updatedAt, closedAt, authorId) VALUES (?, ?, ?, ?, ?, ?, ?, ?) ON CONFLICT(id) DO NOTHING', - ); - const insertUser = db.prepare( - 'INSERT INTO users (id, login, avatarUrl, url, isEmployee) VALUES (?, ?, ?, ?, ?) ON CONFLICT(id) DO NOTHING', - ); - const insertLabel = db.prepare( - 'INSERT INTO labels (id, name, color, description) VALUES (?, ?, ?, ?) ON CONFLICT(id) DO NOTHING', - ); - const insertPullRequestLabel = db.prepare( - 'INSERT INTO pullRequestLabels (pullRequestId, labelId) VALUES (?, ?)', - ); - const insertIssueLabel = db.prepare( - 'INSERT INTO issueLabels (issueId, labelId) VALUES (?, ?)', - ); - - for (const pr of prs) { - console.log(pr); + for (const pr of fetchedPRs) { if (pr.author == null) { continue; } - insertUser.run( - pr.author.resourcePath, - pr.author.login, - pr.author.avatarUrl, - pr.author.url, - assignableUsers.has(pr.author.login) ? 1 : 0, + await insertMany( + userModel, + [ + { + id: pr.author.login, + avatarUrl: pr.author.avatarUrl, + url: pr.author.url, + isEmployee: assignableUsers.has(pr.author.login) ? '1' : '0', + }, + ], + { onConflictKey: 'id' }, ); - insertPR.run( - pr.id, - pr.title, - pr.body, - pr.url, - pr.createdAt, - pr.updatedAt, - pr.closedAt, - pr.mergedAt, - pr.author.resourcePath, + + await insertMany( + pullRequestModel, + [ + { + id: pr.id, + title: pr.title, + body: pr.body, + url: pr.url, + createdAt: pr.createdAt, + updatedAt: pr.updatedAt, + closedAt: pr.closedAt, + mergedAt: pr.mergedAt, + authorId: pr.author.login, + }, + ], + { onConflictKey: 'id' }, ); for (const label of pr.labels.nodes) { - insertLabel.run(label.id, label.name, label.color, label.description); - insertPullRequestLabel.run(pr.id, label.id); + await insertMany( + labelModel, + [ + { + id: label.id, + name: label.name, + color: label.color, + description: label.description, + }, + ], + { onConflictKey: 'id' }, + ); + await insertMany(pullRequestLabelModel, [ + { + pullRequestId: pr.id, + labelId: label.id, + }, + ]); } } - for (const issue of issues) { + for (const issue of fetchedIssues) { if (issue.author == null) { continue; } - insertUser.run( - issue.author.resourcePath, - issue.author.login, - issue.author.avatarUrl, - issue.author.url, - assignableUsers.has(issue.author.login) ? 1 : 0, + await insertMany( + userModel, + [ + { + id: issue.author.login, + avatarUrl: issue.author.avatarUrl, + url: issue.author.url, + isEmployee: assignableUsers.has(issue.author.login) ? '1' : '0', + }, + ], + { onConflictKey: 'id' }, ); - insertIssue.run( - issue.id, - issue.title, - issue.body, - issue.url, - issue.createdAt, - issue.updatedAt, - issue.closedAt, - issue.author.resourcePath, + await insertMany( + issueModel, + [ + { + id: issue.id, + title: issue.title, + body: issue.body, + url: issue.url, + createdAt: issue.createdAt, + updatedAt: issue.updatedAt, + closedAt: issue.closedAt, + authorId: issue.author.login, + }, + ], + { onConflictKey: 'id' }, ); for (const label of issue.labels.nodes) { - insertLabel.run(label.id, label.name, label.color, label.description); - insertIssueLabel.run(issue.id, label.id); + await insertMany( + labelModel, + [ + { + id: label.id, + name: label.name, + color: label.color, + description: label.description, + }, + ], + { onConflictKey: 'id' }, + ); + await insertMany(issueLabelModel, [ + { + pullRequestId: issue.id, + labelId: label.id, + }, + ]); } } - db.close(); - return new Response('Data synced', { status: 200 }); } diff --git a/packages/twenty-website/src/app/developers/contributors/page.tsx b/packages/twenty-website/src/app/developers/contributors/page.tsx index 051a2f9fa0..4acae17e0a 100644 --- a/packages/twenty-website/src/app/developers/contributors/page.tsx +++ b/packages/twenty-website/src/app/developers/contributors/page.tsx @@ -1,41 +1,44 @@ -import Database from 'better-sqlite3'; - import AvatarGrid from '@/app/components/AvatarGrid'; import { Header } from '@/app/components/developers/contributors/Header'; import { Background } from '@/app/components/oss-friends/Background'; import { ContentContainer } from '@/app/components/oss-friends/ContentContainer'; +import { findAll } from '@/database/database'; +import { pullRequestModel, userModel } from '@/database/model'; interface Contributor { - login: string; + id: string; avatarUrl: string; - pullRequestCount: number; } const Contributors = async () => { - const db = new Database('db.sqlite', { readonly: true }); + const contributors = await findAll(userModel); + const pullRequests = await findAll(pullRequestModel); - const contributors = db - .prepare( - `SELECT - u.login, - u.avatarUrl, - COUNT(pr.id) AS pullRequestCount - FROM - users u - JOIN - pullRequests pr ON u.id = pr.authorId - WHERE - u.isEmployee = FALSE - AND u.login NOT IN ('dependabot', 'cyborch', 'emilienchvt', 'Samox') - GROUP BY - u.id - ORDER BY - pullRequestCount DESC; - `, + const pullRequestByAuthor = pullRequests.reduce((acc, pr) => { + acc[pr.authorId] = acc[pr.authorId] ? acc[pr.authorId] + 1 : 1; + return acc; + }, {}); + + const fitlerContributors = contributors + .filter((contributor) => contributor.isEmployee === '0') + .filter( + (contributor) => + ![ + 'dependabot', + 'cyborch', + 'emilienchvt', + 'Samox', + 'nimraahmed', + 'gitstart-app', + ].includes(contributor.id), ) - .all() as Contributor[]; + .map((contributor) => { + contributor.pullRequestCount = pullRequestByAuthor[contributor.id] || 0; - db.close(); + return contributor; + }) + .sort((a, b) => b.pullRequestCount - a.pullRequestCount) + .filter((contributor) => contributor.pullRequestCount > 0); return ( <> @@ -43,7 +46,7 @@ const Contributors = async () => {
- +
diff --git a/packages/twenty-website/src/database/database.ts b/packages/twenty-website/src/database/database.ts new file mode 100644 index 0000000000..842c73c4cb --- /dev/null +++ b/packages/twenty-website/src/database/database.ts @@ -0,0 +1,70 @@ +import { createClient } from '@libsql/client'; +import { drizzle as sqliteDrizzle } from 'drizzle-orm/libsql'; +import { migrate as sqliteMigrate } from 'drizzle-orm/libsql/migrator'; +import { drizzle as pgDrizzle } from 'drizzle-orm/postgres-js'; +import { migrate as postgresMigrate } from 'drizzle-orm/postgres-js/migrator'; +import { SQLiteTableWithColumns } from 'drizzle-orm/sqlite-core'; +import postgres from 'postgres'; + +import 'dotenv/config'; + +// Todo: Deprecate SQLite once prototyping is complete, this is making things impossible to type properly +const databaseDriver = process.env.DATABASE_DRIVER; + +const sqliteClient = createClient({ + url: 'file:twenty-website.sqlite', +}); +const pgClient = postgres(`${process.env.DATABASE_PG_URL}`); +const sqliteDb = sqliteDrizzle(sqliteClient, { logger: true }); +const pgDb = pgDrizzle(pgClient, { logger: true }); + +const isSqliteDriver = databaseDriver === 'sqlite'; + +const migrate = async () => { + if (isSqliteDriver) { + await sqliteMigrate(sqliteDb, { + migrationsFolder: './src/database/sqlite/migrations', + }); + } else { + await postgresMigrate(pgDb, { + migrationsFolder: './src/database/postgres/migrations', + }); + } +}; + +const findAll = (model: SQLiteTableWithColumns) => { + return isSqliteDriver + ? sqliteDb.select().from(model).all() + : pgDb.select().from(model).execute(); +}; + +// Todo: rework typing +const insertMany = async ( + model: SQLiteTableWithColumns, + data: any, + options?: { onConflictKey?: string }, +) => { + if (isSqliteDriver) { + const query = sqliteDb.insert(model).values(data); + if (options?.onConflictKey) { + return query + .onConflictDoNothing({ + target: [model[options.onConflictKey]], + }) + .execute(); + } + return query.execute(); + } + const query = pgDb.insert(model).values(data); + if (options?.onConflictKey) { + return query + .onConflictDoNothing({ + target: [model[options.onConflictKey]], + }) + .execute(); + } + + return query.execute(); +}; + +export { findAll, insertMany, migrate }; diff --git a/packages/twenty-website/src/database/model.ts b/packages/twenty-website/src/database/model.ts new file mode 100644 index 0000000000..5a2aa67703 --- /dev/null +++ b/packages/twenty-website/src/database/model.ts @@ -0,0 +1,47 @@ +import { + pgIssueLabels, + pgIssues, + pgLabels, + pgPullRequestLabels, + pgPullRequests, + pgUsers, +} from '@/database/postgres/schema-postgres'; +import { + sqlLiteIssueLabels, + sqlLiteIssues, + sqlLiteLabels, + sqlLitePullRequestLabels, + sqlLitePullRequests, + sqlLiteUsers, +} from '@/database/sqlite/schema-sqlite'; + +const databaseDriver = process.env.DATABASE_DRIVER; +const isSqliteDriver = databaseDriver === 'sqlite'; + +export const userModel = isSqliteDriver ? sqlLiteUsers : pgUsers; +export const pullRequestModel = isSqliteDriver + ? sqlLitePullRequests + : pgPullRequests; +export const issueModel = isSqliteDriver ? sqlLiteIssues : pgIssues; +export const labelModel = isSqliteDriver ? sqlLiteLabels : pgLabels; +export const pullRequestLabelModel = isSqliteDriver + ? sqlLitePullRequestLabels + : pgPullRequestLabels; +export const issueLabelModel = isSqliteDriver + ? sqlLiteIssueLabels + : pgIssueLabels; + +export type User = typeof sqlLiteUsers.$inferSelect; +export type PullRequest = typeof sqlLitePullRequests.$inferSelect; +export type Issue = typeof sqlLiteIssues.$inferSelect; +export type Label = typeof sqlLiteLabels.$inferSelect; +export type PullRequestLabel = typeof sqlLitePullRequestLabels.$inferSelect; +export type IssueLabel = typeof sqlLiteIssueLabels.$inferSelect; + +export type UserInsert = typeof sqlLiteUsers.$inferInsert; +export type PullRequestInsert = typeof sqlLitePullRequests.$inferInsert; +export type IssueInsert = typeof sqlLiteIssues.$inferInsert; +export type LabelInsert = typeof sqlLiteLabels.$inferInsert; +export type PullRequestLabelInsert = + typeof sqlLitePullRequestLabels.$inferInsert; +export type IssueLabelInsert = typeof sqlLiteIssueLabels.$inferInsert; diff --git a/packages/twenty-website/src/database/postgres/drizzle-posgres.config.ts b/packages/twenty-website/src/database/postgres/drizzle-posgres.config.ts new file mode 100644 index 0000000000..d01912e558 --- /dev/null +++ b/packages/twenty-website/src/database/postgres/drizzle-posgres.config.ts @@ -0,0 +1,14 @@ +import { Config } from 'drizzle-kit'; + +import 'dotenv/config'; + +const pgConfig = { + schema: './src/database/postgres/schema-postgres.ts', + out: './src/database/postgres/migrations', + driver: 'pg', + dbCredentials: { + connectionString: process.env.DATABASE_PG_URL ?? '', + }, +} satisfies Config; + +export default pgConfig; diff --git a/packages/twenty-website/src/database/postgres/migrations/0000_absent_giant_man.sql b/packages/twenty-website/src/database/postgres/migrations/0000_absent_giant_man.sql new file mode 100644 index 0000000000..140920b557 --- /dev/null +++ b/packages/twenty-website/src/database/postgres/migrations/0000_absent_giant_man.sql @@ -0,0 +1,84 @@ +CREATE TABLE IF NOT EXISTS "issueLabels" ( + "issueId" text, + "labelId" text +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "issues" ( + "id" text PRIMARY KEY NOT NULL, + "externalId" text, + "title" text, + "body" text, + "url" text, + "createdAt" text, + "updatedAt" text, + "closedAt" text, + "authorId" text +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "labels" ( + "id" text PRIMARY KEY NOT NULL, + "externalId" text, + "name" text, + "color" text, + "description" text +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "pullRequestLabels" ( + "pullRequestExternalId" text, + "labelId" text +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "pullRequests" ( + "id" text PRIMARY KEY NOT NULL, + "title" text, + "body" text, + "url" text, + "createdAt" text, + "updatedAt" text, + "closedAt" text, + "mergedAt" text, + "authorId" text +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "users" ( + "id" text PRIMARY KEY NOT NULL, + "avatarUrl" text, + "url" text, + "isEmployee" text +); +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "issueLabels" ADD CONSTRAINT "issueLabels_issueId_issues_id_fk" FOREIGN KEY ("issueId") REFERENCES "issues"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "issueLabels" ADD CONSTRAINT "issueLabels_labelId_labels_id_fk" FOREIGN KEY ("labelId") REFERENCES "labels"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "issues" ADD CONSTRAINT "issues_authorId_users_id_fk" FOREIGN KEY ("authorId") REFERENCES "users"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "pullRequestLabels" ADD CONSTRAINT "pullRequestLabels_pullRequestExternalId_pullRequests_id_fk" FOREIGN KEY ("pullRequestExternalId") REFERENCES "pullRequests"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "pullRequestLabels" ADD CONSTRAINT "pullRequestLabels_labelId_labels_id_fk" FOREIGN KEY ("labelId") REFERENCES "labels"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "pullRequests" ADD CONSTRAINT "pullRequests_authorId_users_id_fk" FOREIGN KEY ("authorId") REFERENCES "users"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; diff --git a/packages/twenty-website/src/database/postgres/migrations/meta/0000_snapshot.json b/packages/twenty-website/src/database/postgres/migrations/meta/0000_snapshot.json new file mode 100644 index 0000000000..bd9ec2ceec --- /dev/null +++ b/packages/twenty-website/src/database/postgres/migrations/meta/0000_snapshot.json @@ -0,0 +1,343 @@ +{ + "id": "a7895a79-44a3-4fad-b750-f89d8c04d85c", + "prevId": "00000000-0000-0000-0000-000000000000", + "version": "5", + "dialect": "pg", + "tables": { + "issueLabels": { + "name": "issueLabels", + "schema": "", + "columns": { + "issueId": { + "name": "issueId", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "labelId": { + "name": "labelId", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "issueLabels_issueId_issues_id_fk": { + "name": "issueLabels_issueId_issues_id_fk", + "tableFrom": "issueLabels", + "tableTo": "issues", + "columnsFrom": [ + "issueId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "issueLabels_labelId_labels_id_fk": { + "name": "issueLabels_labelId_labels_id_fk", + "tableFrom": "issueLabels", + "tableTo": "labels", + "columnsFrom": [ + "labelId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "issues": { + "name": "issues", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "externalId": { + "name": "externalId", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "body": { + "name": "body", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "createdAt": { + "name": "createdAt", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "closedAt": { + "name": "closedAt", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "authorId": { + "name": "authorId", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "issues_authorId_users_id_fk": { + "name": "issues_authorId_users_id_fk", + "tableFrom": "issues", + "tableTo": "users", + "columnsFrom": [ + "authorId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "labels": { + "name": "labels", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "externalId": { + "name": "externalId", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "color": { + "name": "color", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "pullRequestLabels": { + "name": "pullRequestLabels", + "schema": "", + "columns": { + "pullRequestExternalId": { + "name": "pullRequestExternalId", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "labelId": { + "name": "labelId", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "pullRequestLabels_pullRequestExternalId_pullRequests_id_fk": { + "name": "pullRequestLabels_pullRequestExternalId_pullRequests_id_fk", + "tableFrom": "pullRequestLabels", + "tableTo": "pullRequests", + "columnsFrom": [ + "pullRequestExternalId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "pullRequestLabels_labelId_labels_id_fk": { + "name": "pullRequestLabels_labelId_labels_id_fk", + "tableFrom": "pullRequestLabels", + "tableTo": "labels", + "columnsFrom": [ + "labelId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "pullRequests": { + "name": "pullRequests", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "body": { + "name": "body", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "createdAt": { + "name": "createdAt", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "closedAt": { + "name": "closedAt", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "mergedAt": { + "name": "mergedAt", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "authorId": { + "name": "authorId", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "pullRequests_authorId_users_id_fk": { + "name": "pullRequests_authorId_users_id_fk", + "tableFrom": "pullRequests", + "tableTo": "users", + "columnsFrom": [ + "authorId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "avatarUrl": { + "name": "avatarUrl", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "isEmployee": { + "name": "isEmployee", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": {}, + "schemas": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/packages/twenty-website/src/database/postgres/migrations/meta/_journal.json b/packages/twenty-website/src/database/postgres/migrations/meta/_journal.json new file mode 100644 index 0000000000..c4b3f6d0a7 --- /dev/null +++ b/packages/twenty-website/src/database/postgres/migrations/meta/_journal.json @@ -0,0 +1,13 @@ +{ + "version": "5", + "dialect": "pg", + "entries": [ + { + "idx": 0, + "version": "5", + "when": 1707921820164, + "tag": "0000_absent_giant_man", + "breakpoints": true + } + ] +} \ No newline at end of file diff --git a/packages/twenty-website/src/database/postgres/schema-postgres.ts b/packages/twenty-website/src/database/postgres/schema-postgres.ts new file mode 100644 index 0000000000..44ef1b48a5 --- /dev/null +++ b/packages/twenty-website/src/database/postgres/schema-postgres.ts @@ -0,0 +1,52 @@ +import { pgTable, text } from 'drizzle-orm/pg-core'; + +export const pgUsers = pgTable('users', { + id: text('id').primaryKey(), + avatarUrl: text('avatarUrl'), + url: text('url'), + isEmployee: text('isEmployee'), +}); + +export const pgPullRequests = pgTable('pullRequests', { + id: text('id').primaryKey(), + name: text('title'), + body: text('body'), + url: text('url'), + createdAt: text('createdAt'), + updatedAt: text('updatedAt'), + closedAt: text('closedAt'), + mergedAt: text('mergedAt'), + authorId: text('authorId').references(() => pgUsers.id), +}); + +export const pgIssues = pgTable('issues', { + id: text('id').primaryKey(), + externalId: text('externalId'), + title: text('title'), + body: text('body'), + url: text('url'), + createdAt: text('createdAt'), + updatedAt: text('updatedAt'), + closedAt: text('closedAt'), + authorId: text('authorId').references(() => pgUsers.id), +}); + +export const pgLabels = pgTable('labels', { + id: text('id').primaryKey(), + externalId: text('externalId'), + name: text('name'), + color: text('color'), + description: text('description'), +}); + +export const pgPullRequestLabels = pgTable('pullRequestLabels', { + pullRequestId: text('pullRequestExternalId').references( + () => pgPullRequests.id, + ), + labelId: text('labelId').references(() => pgLabels.id), +}); + +export const pgIssueLabels = pgTable('issueLabels', { + issueId: text('issueId').references(() => pgIssues.id), + labelId: text('labelId').references(() => pgLabels.id), +}); diff --git a/packages/twenty-website/src/database/sqlite/drizzle-sqlite.config.ts b/packages/twenty-website/src/database/sqlite/drizzle-sqlite.config.ts new file mode 100644 index 0000000000..9c29a673e6 --- /dev/null +++ b/packages/twenty-website/src/database/sqlite/drizzle-sqlite.config.ts @@ -0,0 +1,14 @@ +import { Config } from 'drizzle-kit'; + +import 'dotenv/config'; + +const sqliteConfig = { + schema: './src/database/sqlite/schema-sqlite.ts', + out: './src/database/sqlite/migrations', + driver: 'libsql', + dbCredentials: { + url: 'twenty-website.sqlite', + }, +} satisfies Config; + +export default sqliteConfig; diff --git a/packages/twenty-website/src/database/sqlite/migrations/0000_small_karma.sql b/packages/twenty-website/src/database/sqlite/migrations/0000_small_karma.sql new file mode 100644 index 0000000000..ba530dce8b --- /dev/null +++ b/packages/twenty-website/src/database/sqlite/migrations/0000_small_karma.sql @@ -0,0 +1,54 @@ +CREATE TABLE `issueLabels` ( + `issueId` text, + `labelId` text, + FOREIGN KEY (`issueId`) REFERENCES `issues`(`id`) ON UPDATE no action ON DELETE no action, + FOREIGN KEY (`labelId`) REFERENCES `labels`(`id`) ON UPDATE no action ON DELETE no action +); +--> statement-breakpoint +CREATE TABLE `issues` ( + `id` text PRIMARY KEY NOT NULL, + `externalId` text, + `title` text, + `body` text, + `url` text, + `createdAt` text, + `updatedAt` text, + `closedAt` text, + `authorId` text, + FOREIGN KEY (`authorId`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action +); +--> statement-breakpoint +CREATE TABLE `labels` ( + `id` text PRIMARY KEY NOT NULL, + `externalId` text, + `name` text, + `color` text, + `description` text +); +--> statement-breakpoint +CREATE TABLE `pullRequestLabels` ( + `pullRequestExternalId` text, + `labelId` text, + FOREIGN KEY (`pullRequestExternalId`) REFERENCES `pullRequests`(`id`) ON UPDATE no action ON DELETE no action, + FOREIGN KEY (`labelId`) REFERENCES `labels`(`id`) ON UPDATE no action ON DELETE no action +); +--> statement-breakpoint +CREATE TABLE `pullRequests` ( + `id` text PRIMARY KEY NOT NULL, + `title` text, + `body` text, + `url` text, + `createdAt` text, + `updatedAt` text, + `closedAt` text, + `mergedAt` text, + `authorId` text, + FOREIGN KEY (`authorId`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action +); +--> statement-breakpoint +CREATE TABLE `users` ( + `id` text PRIMARY KEY NOT NULL, + `avatarUrl` text, + `url` text, + `isEmployee` text +); diff --git a/packages/twenty-website/src/database/sqlite/migrations/meta/0000_snapshot.json b/packages/twenty-website/src/database/sqlite/migrations/meta/0000_snapshot.json new file mode 100644 index 0000000000..cc5511a958 --- /dev/null +++ b/packages/twenty-website/src/database/sqlite/migrations/meta/0000_snapshot.json @@ -0,0 +1,367 @@ +{ + "version": "5", + "dialect": "sqlite", + "id": "033cd768-53b9-4c60-99ee-be070ea7abd6", + "prevId": "00000000-0000-0000-0000-000000000000", + "tables": { + "issueLabels": { + "name": "issueLabels", + "columns": { + "issueId": { + "name": "issueId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "labelId": { + "name": "labelId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": { + "issueLabels_issueId_issues_id_fk": { + "name": "issueLabels_issueId_issues_id_fk", + "tableFrom": "issueLabels", + "tableTo": "issues", + "columnsFrom": [ + "issueId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "issueLabels_labelId_labels_id_fk": { + "name": "issueLabels_labelId_labels_id_fk", + "tableFrom": "issueLabels", + "tableTo": "labels", + "columnsFrom": [ + "labelId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "issues": { + "name": "issues", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "externalId": { + "name": "externalId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "body": { + "name": "body", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "closedAt": { + "name": "closedAt", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "authorId": { + "name": "authorId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": { + "issues_authorId_users_id_fk": { + "name": "issues_authorId_users_id_fk", + "tableFrom": "issues", + "tableTo": "users", + "columnsFrom": [ + "authorId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "labels": { + "name": "labels", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "externalId": { + "name": "externalId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "color": { + "name": "color", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "pullRequestLabels": { + "name": "pullRequestLabels", + "columns": { + "pullRequestExternalId": { + "name": "pullRequestExternalId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "labelId": { + "name": "labelId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": { + "pullRequestLabels_pullRequestExternalId_pullRequests_id_fk": { + "name": "pullRequestLabels_pullRequestExternalId_pullRequests_id_fk", + "tableFrom": "pullRequestLabels", + "tableTo": "pullRequests", + "columnsFrom": [ + "pullRequestExternalId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "pullRequestLabels_labelId_labels_id_fk": { + "name": "pullRequestLabels_labelId_labels_id_fk", + "tableFrom": "pullRequestLabels", + "tableTo": "labels", + "columnsFrom": [ + "labelId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "pullRequests": { + "name": "pullRequests", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "body": { + "name": "body", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "closedAt": { + "name": "closedAt", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "mergedAt": { + "name": "mergedAt", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "authorId": { + "name": "authorId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": { + "pullRequests_authorId_users_id_fk": { + "name": "pullRequests_authorId_users_id_fk", + "tableFrom": "pullRequests", + "tableTo": "users", + "columnsFrom": [ + "authorId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "users": { + "name": "users", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "avatarUrl": { + "name": "avatarUrl", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "isEmployee": { + "name": "isEmployee", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + } +} \ No newline at end of file diff --git a/packages/twenty-website/src/database/sqlite/migrations/meta/_journal.json b/packages/twenty-website/src/database/sqlite/migrations/meta/_journal.json new file mode 100644 index 0000000000..4eba798dd0 --- /dev/null +++ b/packages/twenty-website/src/database/sqlite/migrations/meta/_journal.json @@ -0,0 +1,13 @@ +{ + "version": "5", + "dialect": "sqlite", + "entries": [ + { + "idx": 0, + "version": "5", + "when": 1707920913359, + "tag": "0000_small_karma", + "breakpoints": true + } + ] +} \ No newline at end of file diff --git a/packages/twenty-website/src/database/sqlite/schema-sqlite.ts b/packages/twenty-website/src/database/sqlite/schema-sqlite.ts new file mode 100644 index 0000000000..21c424831f --- /dev/null +++ b/packages/twenty-website/src/database/sqlite/schema-sqlite.ts @@ -0,0 +1,52 @@ +import { sqliteTable, text } from 'drizzle-orm/sqlite-core'; + +export const sqlLiteUsers = sqliteTable('users', { + id: text('id').primaryKey(), + avatarUrl: text('avatarUrl'), + url: text('url'), + isEmployee: text('isEmployee'), +}); + +export const sqlLitePullRequests = sqliteTable('pullRequests', { + id: text('id').primaryKey(), + name: text('title'), + body: text('body'), + url: text('url'), + createdAt: text('createdAt'), + updatedAt: text('updatedAt'), + closedAt: text('closedAt'), + mergedAt: text('mergedAt'), + authorId: text('authorId').references(() => sqlLiteUsers.id), +}); + +export const sqlLiteIssues = sqliteTable('issues', { + id: text('id').primaryKey(), + externalId: text('externalId'), + title: text('title'), + body: text('body'), + url: text('url'), + createdAt: text('createdAt'), + updatedAt: text('updatedAt'), + closedAt: text('closedAt'), + authorId: text('authorId').references(() => sqlLiteUsers.id), +}); + +export const sqlLiteLabels = sqliteTable('labels', { + id: text('id').primaryKey(), + externalId: text('externalId'), + name: text('name'), + color: text('color'), + description: text('description'), +}); + +export const sqlLitePullRequestLabels = sqliteTable('pullRequestLabels', { + pullRequestId: text('pullRequestExternalId').references( + () => sqlLitePullRequests.id, + ), + labelId: text('labelId').references(() => sqlLiteLabels.id), +}); + +export const sqlLiteIssueLabels = sqliteTable('issueLabels', { + issueId: text('issueId').references(() => sqlLiteIssues.id), + labelId: text('labelId').references(() => sqlLiteLabels.id), +}); diff --git a/packages/twenty-website/tsconfig.json b/packages/twenty-website/tsconfig.json index 4b93823744..a477416c55 100644 --- a/packages/twenty-website/tsconfig.json +++ b/packages/twenty-website/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "es5", + "target": "es2020", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, diff --git a/yarn.lock b/yarn.lock index 7ccdd32b03..3cd47a7fb8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4634,6 +4634,15 @@ __metadata: languageName: node linkType: hard +"@drizzle-team/studio@npm:^0.0.39": + version: 0.0.39 + resolution: "@drizzle-team/studio@npm:0.0.39" + dependencies: + superjson: "npm:^2.2.1" + checksum: 9e37a31261fa8f6224238dc4f8249199bec8a3f7638da1044beae487cbceb5432bfcc350a13a325c45d75eb05b36713b984d2da14fdf1d608eb9f16576fd9294 + languageName: node + linkType: hard + "@emotion/babel-plugin@npm:^11.11.0": version: 11.11.0 resolution: "@emotion/babel-plugin@npm:11.11.0" @@ -4825,6 +4834,26 @@ __metadata: languageName: node linkType: hard +"@esbuild-kit/core-utils@npm:^3.3.2": + version: 3.3.2 + resolution: "@esbuild-kit/core-utils@npm:3.3.2" + dependencies: + esbuild: "npm:~0.18.20" + source-map-support: "npm:^0.5.21" + checksum: d856f5bd720814593f911d781ed7558a3f8ec1a39802f3831d0eea0d1306e0e2dc11b7b2443af621c413ec6557f1f3034a9a4f1472a4cb40e52cd6e3b356aa05 + languageName: node + linkType: hard + +"@esbuild-kit/esm-loader@npm:^2.5.5": + version: 2.6.5 + resolution: "@esbuild-kit/esm-loader@npm:2.6.5" + dependencies: + "@esbuild-kit/core-utils": "npm:^3.3.2" + get-tsconfig: "npm:^4.7.0" + checksum: 6894b29176eda62bdce0d458d57f32daed5cb8fcff14cb3ddfbc995cfe3e2fa8599f3b0b1af66db446903b30167f57069f27e9cf79a69cf9b41f557115811cde + languageName: node + linkType: hard + "@esbuild/aix-ppc64@npm:0.19.11": version: 0.19.11 resolution: "@esbuild/aix-ppc64@npm:0.19.11" @@ -4832,6 +4861,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/aix-ppc64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/aix-ppc64@npm:0.19.12" + conditions: os=aix & cpu=ppc64 + languageName: node + linkType: hard + "@esbuild/android-arm64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/android-arm64@npm:0.18.20" @@ -4846,6 +4882,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/android-arm64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/android-arm64@npm:0.19.12" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/android-arm@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/android-arm@npm:0.18.20" @@ -4860,6 +4903,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/android-arm@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/android-arm@npm:0.19.12" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + "@esbuild/android-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/android-x64@npm:0.18.20" @@ -4874,6 +4924,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/android-x64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/android-x64@npm:0.19.12" + conditions: os=android & cpu=x64 + languageName: node + linkType: hard + "@esbuild/darwin-arm64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/darwin-arm64@npm:0.18.20" @@ -4888,6 +4945,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/darwin-arm64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/darwin-arm64@npm:0.19.12" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/darwin-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/darwin-x64@npm:0.18.20" @@ -4902,6 +4966,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/darwin-x64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/darwin-x64@npm:0.19.12" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + "@esbuild/freebsd-arm64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/freebsd-arm64@npm:0.18.20" @@ -4916,6 +4987,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/freebsd-arm64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/freebsd-arm64@npm:0.19.12" + conditions: os=freebsd & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/freebsd-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/freebsd-x64@npm:0.18.20" @@ -4930,6 +5008,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/freebsd-x64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/freebsd-x64@npm:0.19.12" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + "@esbuild/linux-arm64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-arm64@npm:0.18.20" @@ -4944,6 +5029,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-arm64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/linux-arm64@npm:0.19.12" + conditions: os=linux & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/linux-arm@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-arm@npm:0.18.20" @@ -4958,6 +5050,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-arm@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/linux-arm@npm:0.19.12" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + "@esbuild/linux-ia32@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-ia32@npm:0.18.20" @@ -4972,6 +5071,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-ia32@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/linux-ia32@npm:0.19.12" + conditions: os=linux & cpu=ia32 + languageName: node + linkType: hard + "@esbuild/linux-loong64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-loong64@npm:0.18.20" @@ -4986,6 +5092,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-loong64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/linux-loong64@npm:0.19.12" + conditions: os=linux & cpu=loong64 + languageName: node + linkType: hard + "@esbuild/linux-mips64el@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-mips64el@npm:0.18.20" @@ -5000,6 +5113,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-mips64el@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/linux-mips64el@npm:0.19.12" + conditions: os=linux & cpu=mips64el + languageName: node + linkType: hard + "@esbuild/linux-ppc64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-ppc64@npm:0.18.20" @@ -5014,6 +5134,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-ppc64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/linux-ppc64@npm:0.19.12" + conditions: os=linux & cpu=ppc64 + languageName: node + linkType: hard + "@esbuild/linux-riscv64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-riscv64@npm:0.18.20" @@ -5028,6 +5155,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-riscv64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/linux-riscv64@npm:0.19.12" + conditions: os=linux & cpu=riscv64 + languageName: node + linkType: hard + "@esbuild/linux-s390x@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-s390x@npm:0.18.20" @@ -5042,6 +5176,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-s390x@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/linux-s390x@npm:0.19.12" + conditions: os=linux & cpu=s390x + languageName: node + linkType: hard + "@esbuild/linux-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-x64@npm:0.18.20" @@ -5056,6 +5197,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-x64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/linux-x64@npm:0.19.12" + conditions: os=linux & cpu=x64 + languageName: node + linkType: hard + "@esbuild/netbsd-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/netbsd-x64@npm:0.18.20" @@ -5070,6 +5218,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/netbsd-x64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/netbsd-x64@npm:0.19.12" + conditions: os=netbsd & cpu=x64 + languageName: node + linkType: hard + "@esbuild/openbsd-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/openbsd-x64@npm:0.18.20" @@ -5084,6 +5239,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/openbsd-x64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/openbsd-x64@npm:0.19.12" + conditions: os=openbsd & cpu=x64 + languageName: node + linkType: hard + "@esbuild/sunos-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/sunos-x64@npm:0.18.20" @@ -5098,6 +5260,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/sunos-x64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/sunos-x64@npm:0.19.12" + conditions: os=sunos & cpu=x64 + languageName: node + linkType: hard + "@esbuild/win32-arm64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/win32-arm64@npm:0.18.20" @@ -5112,6 +5281,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/win32-arm64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/win32-arm64@npm:0.19.12" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/win32-ia32@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/win32-ia32@npm:0.18.20" @@ -5126,6 +5302,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/win32-ia32@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/win32-ia32@npm:0.19.12" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + "@esbuild/win32-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/win32-x64@npm:0.18.20" @@ -5140,6 +5323,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/win32-x64@npm:0.19.12": + version: 0.19.12 + resolution: "@esbuild/win32-x64@npm:0.19.12" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + "@eslint-community/eslint-utils@npm:^4.2.0, @eslint-community/eslint-utils@npm:^4.4.0": version: 4.4.0 resolution: "@eslint-community/eslint-utils@npm:4.4.0" @@ -7035,6 +7225,111 @@ __metadata: languageName: node linkType: hard +"@libsql/client@npm:^0.4.3": + version: 0.4.3 + resolution: "@libsql/client@npm:0.4.3" + dependencies: + "@libsql/core": "npm:^0.4.3" + "@libsql/hrana-client": "npm:^0.5.6" + js-base64: "npm:^3.7.5" + libsql: "npm:^0.2.0" + dependenciesMeta: + libsql: + optional: true + checksum: 513c3c98b922a2f8e7c2c51e984559e23bf805bcf7f35c1f45fb70fba6c3bbe0e656b8c8b304c5d7f322bc07ef0f2398210c73b28dd3329aa6ca3d666e4d03b4 + languageName: node + linkType: hard + +"@libsql/core@npm:^0.4.3": + version: 0.4.3 + resolution: "@libsql/core@npm:0.4.3" + dependencies: + js-base64: "npm:^3.7.5" + checksum: 39acd3afd1177264a0c556d4351c490aa6b6202f38544cef9863839de6fc26743284a4395ecb4fd187f033db74c9a31fa3d8b6331f9857d82f51616345cef7cb + languageName: node + linkType: hard + +"@libsql/darwin-arm64@npm:0.2.0": + version: 0.2.0 + resolution: "@libsql/darwin-arm64@npm:0.2.0" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@libsql/darwin-x64@npm:0.2.0": + version: 0.2.0 + resolution: "@libsql/darwin-x64@npm:0.2.0" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@libsql/hrana-client@npm:^0.5.6": + version: 0.5.6 + resolution: "@libsql/hrana-client@npm:0.5.6" + dependencies: + "@libsql/isomorphic-fetch": "npm:^0.1.12" + "@libsql/isomorphic-ws": "npm:^0.1.5" + js-base64: "npm:^3.7.5" + node-fetch: "npm:^3.3.2" + checksum: f09bcb100eaba5f96ba013aefc28e5799197c576a03dc11045acb10494cd302f8e15369b3dfc51f9a9f3bc01f796d8aad4c8013428e82e1d0d8603a1a4e3d4f5 + languageName: node + linkType: hard + +"@libsql/isomorphic-fetch@npm:^0.1.12": + version: 0.1.12 + resolution: "@libsql/isomorphic-fetch@npm:0.1.12" + dependencies: + "@types/node-fetch": "npm:^2.6.11" + node-fetch: "npm:^2.7.0" + checksum: bcdf600cbdd0701c8f08cc74ac0598d11a8f895c03f82f3daf6f432cb8acaaa7beea9a4ecd8eedc45010e8cecf4a0e415ad4615cc9ec38689e8fda556faea9be + languageName: node + linkType: hard + +"@libsql/isomorphic-ws@npm:^0.1.5": + version: 0.1.5 + resolution: "@libsql/isomorphic-ws@npm:0.1.5" + dependencies: + "@types/ws": "npm:^8.5.4" + ws: "npm:^8.13.0" + checksum: 7028bbc50dd094cdcbe56714dbf52fb646812d1b042c1973e61293f4a1cb5b81d5af670530a2463a2ba485f84f7728daf3eb75d40a7f55316ee4f7015dcc99ae + languageName: node + linkType: hard + +"@libsql/linux-arm64-gnu@npm:0.2.0": + version: 0.2.0 + resolution: "@libsql/linux-arm64-gnu@npm:0.2.0" + conditions: os=linux & cpu=arm64 + languageName: node + linkType: hard + +"@libsql/linux-arm64-musl@npm:0.2.0": + version: 0.2.0 + resolution: "@libsql/linux-arm64-musl@npm:0.2.0" + conditions: os=linux & cpu=arm64 + languageName: node + linkType: hard + +"@libsql/linux-x64-gnu@npm:0.2.0": + version: 0.2.0 + resolution: "@libsql/linux-x64-gnu@npm:0.2.0" + conditions: os=linux & cpu=x64 + languageName: node + linkType: hard + +"@libsql/linux-x64-musl@npm:0.2.0": + version: 0.2.0 + resolution: "@libsql/linux-x64-musl@npm:0.2.0" + conditions: os=linux & cpu=x64 + languageName: node + linkType: hard + +"@libsql/win32-x64-msvc@npm:0.2.0": + version: 0.2.0 + resolution: "@libsql/win32-x64-msvc@npm:0.2.0" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + "@ljharb/through@npm:^2.3.9": version: 2.3.12 resolution: "@ljharb/through@npm:2.3.12" @@ -7384,6 +7679,13 @@ __metadata: languageName: node linkType: hard +"@neon-rs/load@npm:^0.0.4": + version: 0.0.4 + resolution: "@neon-rs/load@npm:0.0.4" + checksum: 546fa4e48aa9cdb402f0a3524b591b1cac863bcfdd0217432323dba42ad37ece24b736019e6196e34326201db6b6deb410d7a983ac3c54f322619c9b6bd568bb + languageName: node + linkType: hard + "@nestjs/apollo@npm:^11.0.5": version: 11.0.6 resolution: "@nestjs/apollo@npm:11.0.6" @@ -15469,6 +15771,16 @@ __metadata: languageName: node linkType: hard +"@types/node-fetch@npm:^2.6.11": + version: 2.6.11 + resolution: "@types/node-fetch@npm:2.6.11" + dependencies: + "@types/node": "npm:*" + form-data: "npm:^4.0.0" + checksum: 5283d4e0bcc37a5b6d8e629aee880a4ffcfb33e089f4b903b2981b19c623972d1e64af7c3f9540ab990f0f5c89b9b5dda19c5bcb37a8e177079e93683bfd2f49 + languageName: node + linkType: hard + "@types/node-forge@npm:^1.3.0": version: 1.3.11 resolution: "@types/node-forge@npm:1.3.11" @@ -15978,7 +16290,7 @@ __metadata: languageName: node linkType: hard -"@types/ws@npm:^8.0.0, @types/ws@npm:^8.5.5": +"@types/ws@npm:^8.0.0, @types/ws@npm:^8.5.4, @types/ws@npm:^8.5.5": version: 8.5.10 resolution: "@types/ws@npm:8.5.10" dependencies: @@ -20494,6 +20806,19 @@ __metadata: languageName: node linkType: hard +"cli-color@npm:^2.0.0": + version: 2.0.3 + resolution: "cli-color@npm:2.0.3" + dependencies: + d: "npm:^1.0.1" + es5-ext: "npm:^0.10.61" + es6-iterator: "npm:^2.0.3" + memoizee: "npm:^0.4.15" + timers-ext: "npm:^0.1.7" + checksum: 9a14c2dbb352cee99e93f27ab6f105b55a57fa48b0704d39091df5ec155766e5a66a53c5384434d3dcaaab9f9258cb12d20eabbc9c39ec5f61034a681c449fc6 + languageName: node + linkType: hard + "cli-cursor@npm:3.1.0, cli-cursor@npm:^3.1.0": version: 3.1.0 resolution: "cli-cursor@npm:3.1.0" @@ -21406,6 +21731,15 @@ __metadata: languageName: node linkType: hard +"copy-anything@npm:^3.0.2": + version: 3.0.5 + resolution: "copy-anything@npm:3.0.5" + dependencies: + is-what: "npm:^4.1.8" + checksum: 01eadd500c7e1db71d32d95a3bfaaedcb839ef891c741f6305ab0461398056133de08f2d1bf4c392b364e7bdb7ce498513896e137a7a183ac2516b065c28a4fe + languageName: node + linkType: hard + "copy-text-to-clipboard@npm:^3.2.0": version: 3.2.0 resolution: "copy-text-to-clipboard@npm:3.2.0" @@ -22318,6 +22652,13 @@ __metadata: languageName: node linkType: hard +"data-uri-to-buffer@npm:^4.0.0": + version: 4.0.1 + resolution: "data-uri-to-buffer@npm:4.0.1" + checksum: 20a6b93107597530d71d4cb285acee17f66bcdfc03fd81040921a81252f19db27588d87fc8fc69e1950c55cfb0bf8ae40d0e5e21d907230813eb5d5a7f9eb45b + languageName: node + linkType: hard + "data-urls@npm:^3.0.2": version: 3.0.2 resolution: "data-urls@npm:3.0.2" @@ -22764,6 +23105,13 @@ __metadata: languageName: node linkType: hard +"detect-libc@npm:2.0.2, detect-libc@npm:^2.0.0, detect-libc@npm:^2.0.2": + version: 2.0.2 + resolution: "detect-libc@npm:2.0.2" + checksum: a9f4ffcd2701525c589617d98afe5a5d0676c8ea82bcc4ed6f3747241b79f781d36437c59a5e855254c864d36a3e9f8276568b6b531c28d6e53b093a15703f11 + languageName: node + linkType: hard + "detect-libc@npm:^1.0.3": version: 1.0.3 resolution: "detect-libc@npm:1.0.3" @@ -22773,13 +23121,6 @@ __metadata: languageName: node linkType: hard -"detect-libc@npm:^2.0.0, detect-libc@npm:^2.0.2": - version: 2.0.2 - resolution: "detect-libc@npm:2.0.2" - checksum: a9f4ffcd2701525c589617d98afe5a5d0676c8ea82bcc4ed6f3747241b79f781d36437c59a5e855254c864d36a3e9f8276568b6b531c28d6e53b093a15703f11 - languageName: node - linkType: hard - "detect-newline@npm:^3.0.0": version: 3.1.0 resolution: "detect-newline@npm:3.1.0" @@ -22918,6 +23259,15 @@ __metadata: languageName: node linkType: hard +"difflib@npm:~0.2.1": + version: 0.2.4 + resolution: "difflib@npm:0.2.4" + dependencies: + heap: "npm:>= 0.2.0" + checksum: 4b151f1f6d378b0837ef28f4706d89d05b78f1093253b06c975c621f7ef8b048978588baf9e8f284c64b133d0abb08303b0789519cc91e5180d420cb3bb99c05 + languageName: node + linkType: hard + "dir-glob@npm:^3.0.1": version: 3.0.1 resolution: "dir-glob@npm:3.0.1" @@ -23197,6 +23547,114 @@ __metadata: languageName: node linkType: hard +"dreamopt@npm:~0.8.0": + version: 0.8.0 + resolution: "dreamopt@npm:0.8.0" + dependencies: + wordwrap: "npm:>=0.0.2" + checksum: 8e5953c19519c9ec9427eff91b618c3ded7d2b50fcb89c051ca9c4f49e712460103c12dea09eb3feec5a63f21950488a19481798425aaba815b1c5016b3d58b9 + languageName: node + linkType: hard + +"drizzle-kit@npm:^0.20.14": + version: 0.20.14 + resolution: "drizzle-kit@npm:0.20.14" + dependencies: + "@drizzle-team/studio": "npm:^0.0.39" + "@esbuild-kit/esm-loader": "npm:^2.5.5" + camelcase: "npm:^7.0.1" + chalk: "npm:^5.2.0" + commander: "npm:^9.4.1" + env-paths: "npm:^3.0.0" + esbuild: "npm:^0.19.7" + esbuild-register: "npm:^3.5.0" + glob: "npm:^8.1.0" + hanji: "npm:^0.0.5" + json-diff: "npm:0.9.0" + minimatch: "npm:^7.4.3" + semver: "npm:^7.5.4" + zod: "npm:^3.20.2" + bin: + drizzle-kit: bin.cjs + checksum: fee5b2ff61eaf648a6fb3edacd2b3091bd40fd75dcad6b3e43a88104ed48f1264c1860ceb2ef13ab5e55207f6a22c772b992bcd6d9680d0bf86d456399c8dd75 + languageName: node + linkType: hard + +"drizzle-orm@npm:^0.29.3": + version: 0.29.3 + resolution: "drizzle-orm@npm:0.29.3" + peerDependencies: + "@aws-sdk/client-rds-data": ">=3" + "@cloudflare/workers-types": ">=3" + "@libsql/client": "*" + "@neondatabase/serverless": ">=0.1" + "@opentelemetry/api": ^1.4.1 + "@planetscale/database": ">=1" + "@types/better-sqlite3": "*" + "@types/pg": "*" + "@types/react": ">=18" + "@types/sql.js": "*" + "@vercel/postgres": "*" + better-sqlite3: ">=7" + bun-types: "*" + expo-sqlite: ">=13.2.0" + knex: "*" + kysely: "*" + mysql2: ">=2" + pg: ">=8" + postgres: ">=3" + react: ">=18" + sql.js: ">=1" + sqlite3: ">=5" + peerDependenciesMeta: + "@aws-sdk/client-rds-data": + optional: true + "@cloudflare/workers-types": + optional: true + "@libsql/client": + optional: true + "@neondatabase/serverless": + optional: true + "@opentelemetry/api": + optional: true + "@planetscale/database": + optional: true + "@types/better-sqlite3": + optional: true + "@types/pg": + optional: true + "@types/react": + optional: true + "@types/sql.js": + optional: true + "@vercel/postgres": + optional: true + better-sqlite3: + optional: true + bun-types: + optional: true + expo-sqlite: + optional: true + knex: + optional: true + kysely: + optional: true + mysql2: + optional: true + pg: + optional: true + postgres: + optional: true + react: + optional: true + sql.js: + optional: true + sqlite3: + optional: true + checksum: a5a53e4599981f256e10bd0e6e4724f14ffe7c9f6bef963c5cc9d00c8379c2367324ae0c67abc52a319704fedba796a5583dac3d36fac0de19585f87844d3611 + languageName: node + linkType: hard + "dset@npm:^3.1.1, dset@npm:^3.1.2": version: 3.1.3 resolution: "dset@npm:3.1.3" @@ -23447,6 +23905,13 @@ __metadata: languageName: node linkType: hard +"env-paths@npm:^3.0.0": + version: 3.0.0 + resolution: "env-paths@npm:3.0.0" + checksum: 76dec878cee47f841103bacd7fae03283af16f0702dad65102ef0a556f310b98a377885e0f32943831eb08b5ab37842a323d02529f3dfd5d0a40ca71b01b435f + languageName: node + linkType: hard + "envinfo@npm:^7.7.3": version: 7.11.0 resolution: "envinfo@npm:7.11.0" @@ -23626,7 +24091,7 @@ __metadata: languageName: node linkType: hard -"es5-ext@npm:^0.10.35, es5-ext@npm:^0.10.50": +"es5-ext@npm:^0.10.35, es5-ext@npm:^0.10.46, es5-ext@npm:^0.10.50, es5-ext@npm:^0.10.53, es5-ext@npm:^0.10.61, es5-ext@npm:~0.10.14, es5-ext@npm:~0.10.2, es5-ext@npm:~0.10.46": version: 0.10.62 resolution: "es5-ext@npm:0.10.62" dependencies: @@ -23665,6 +24130,18 @@ __metadata: languageName: node linkType: hard +"es6-weak-map@npm:^2.0.3": + version: 2.0.3 + resolution: "es6-weak-map@npm:2.0.3" + dependencies: + d: "npm:1" + es5-ext: "npm:^0.10.46" + es6-iterator: "npm:^2.0.3" + es6-symbol: "npm:^3.1.1" + checksum: 460932be9542473dbbddd183e21c15a66cfec1b2c17dae2b514e190d6fb2896b7eb683783d4b36da036609d2e1c93d2815f21b374dfccaf02a8978694c2f7b67 + languageName: node + linkType: hard + "esbuild-plugin-alias@npm:^0.2.1": version: 0.2.1 resolution: "esbuild-plugin-alias@npm:0.2.1" @@ -23695,7 +24172,7 @@ __metadata: languageName: node linkType: hard -"esbuild@npm:^0.18.0": +"esbuild@npm:^0.18.0, esbuild@npm:~0.18.20": version: 0.18.20 resolution: "esbuild@npm:0.18.20" dependencies: @@ -23852,6 +24329,86 @@ __metadata: languageName: node linkType: hard +"esbuild@npm:^0.19.7": + version: 0.19.12 + resolution: "esbuild@npm:0.19.12" + dependencies: + "@esbuild/aix-ppc64": "npm:0.19.12" + "@esbuild/android-arm": "npm:0.19.12" + "@esbuild/android-arm64": "npm:0.19.12" + "@esbuild/android-x64": "npm:0.19.12" + "@esbuild/darwin-arm64": "npm:0.19.12" + "@esbuild/darwin-x64": "npm:0.19.12" + "@esbuild/freebsd-arm64": "npm:0.19.12" + "@esbuild/freebsd-x64": "npm:0.19.12" + "@esbuild/linux-arm": "npm:0.19.12" + "@esbuild/linux-arm64": "npm:0.19.12" + "@esbuild/linux-ia32": "npm:0.19.12" + "@esbuild/linux-loong64": "npm:0.19.12" + "@esbuild/linux-mips64el": "npm:0.19.12" + "@esbuild/linux-ppc64": "npm:0.19.12" + "@esbuild/linux-riscv64": "npm:0.19.12" + "@esbuild/linux-s390x": "npm:0.19.12" + "@esbuild/linux-x64": "npm:0.19.12" + "@esbuild/netbsd-x64": "npm:0.19.12" + "@esbuild/openbsd-x64": "npm:0.19.12" + "@esbuild/sunos-x64": "npm:0.19.12" + "@esbuild/win32-arm64": "npm:0.19.12" + "@esbuild/win32-ia32": "npm:0.19.12" + "@esbuild/win32-x64": "npm:0.19.12" + dependenciesMeta: + "@esbuild/aix-ppc64": + optional: true + "@esbuild/android-arm": + optional: true + "@esbuild/android-arm64": + optional: true + "@esbuild/android-x64": + optional: true + "@esbuild/darwin-arm64": + optional: true + "@esbuild/darwin-x64": + optional: true + "@esbuild/freebsd-arm64": + optional: true + "@esbuild/freebsd-x64": + optional: true + "@esbuild/linux-arm": + optional: true + "@esbuild/linux-arm64": + optional: true + "@esbuild/linux-ia32": + optional: true + "@esbuild/linux-loong64": + optional: true + "@esbuild/linux-mips64el": + optional: true + "@esbuild/linux-ppc64": + optional: true + "@esbuild/linux-riscv64": + optional: true + "@esbuild/linux-s390x": + optional: true + "@esbuild/linux-x64": + optional: true + "@esbuild/netbsd-x64": + optional: true + "@esbuild/openbsd-x64": + optional: true + "@esbuild/sunos-x64": + optional: true + "@esbuild/win32-arm64": + optional: true + "@esbuild/win32-ia32": + optional: true + "@esbuild/win32-x64": + optional: true + bin: + esbuild: bin/esbuild + checksum: 0f2d21ffe24ebead64843f87c3aebe2e703a5ed9feb086a0728b24907fac2eb9923e4a79857d3df9059c915739bd7a870dd667972eae325c67f478b592b8582d + languageName: node + linkType: hard + "escalade@npm:^3.1.1": version: 3.1.1 resolution: "escalade@npm:3.1.1" @@ -24470,6 +25027,16 @@ __metadata: languageName: node linkType: hard +"event-emitter@npm:^0.3.5": + version: 0.3.5 + resolution: "event-emitter@npm:0.3.5" + dependencies: + d: "npm:1" + es5-ext: "npm:~0.10.14" + checksum: 75082fa8ffb3929766d0f0a063bfd6046bd2a80bea2666ebaa0cfd6f4a9116be6647c15667bea77222afc12f5b4071b68d393cf39fdaa0e8e81eda006160aff0 + languageName: node + linkType: hard + "eventemitter2@npm:6.4.9": version: 6.4.9 resolution: "eventemitter2@npm:6.4.9" @@ -24997,6 +25564,16 @@ __metadata: languageName: node linkType: hard +"fetch-blob@npm:^3.1.2, fetch-blob@npm:^3.1.4": + version: 3.2.0 + resolution: "fetch-blob@npm:3.2.0" + dependencies: + node-domexception: "npm:^1.0.0" + web-streams-polyfill: "npm:^3.0.3" + checksum: 60054bf47bfa10fb0ba6cb7742acec2f37c1f56344f79a70bb8b1c48d77675927c720ff3191fa546410a0442c998d27ab05e9144c32d530d8a52fbe68f843b69 + languageName: node + linkType: hard + "fetch-retry@npm:^5.0.2": version: 5.0.6 resolution: "fetch-retry@npm:5.0.6" @@ -25527,6 +26104,15 @@ __metadata: languageName: node linkType: hard +"formdata-polyfill@npm:^4.0.10": + version: 4.0.10 + resolution: "formdata-polyfill@npm:4.0.10" + dependencies: + fetch-blob: "npm:^3.1.2" + checksum: 5392ec484f9ce0d5e0d52fb5a78e7486637d516179b0eb84d81389d7eccf9ca2f663079da56f761355c0a65792810e3b345dc24db9a8bbbcf24ef3c8c88570c6 + languageName: node + linkType: hard + "formidable@npm:^2.1.2": version: 2.1.2 resolution: "formidable@npm:2.1.2" @@ -26013,7 +26599,7 @@ __metadata: languageName: node linkType: hard -"get-tsconfig@npm:^4.5.0": +"get-tsconfig@npm:^4.5.0, get-tsconfig@npm:^4.7.0": version: 4.7.2 resolution: "get-tsconfig@npm:4.7.2" dependencies: @@ -26183,7 +26769,7 @@ __metadata: languageName: node linkType: hard -"glob@npm:^8.0.1, glob@npm:^8.0.3": +"glob@npm:^8.0.1, glob@npm:^8.0.3, glob@npm:^8.1.0": version: 8.1.0 resolution: "glob@npm:8.1.0" dependencies: @@ -26796,6 +27382,16 @@ __metadata: languageName: node linkType: hard +"hanji@npm:^0.0.5": + version: 0.0.5 + resolution: "hanji@npm:0.0.5" + dependencies: + lodash.throttle: "npm:^4.1.1" + sisteransi: "npm:^1.0.5" + checksum: ffa0c2180518377551fad9bbe9e45fa622388833fdd8cb573277dc234748c23fe488cc853bf51dd243bcf8f97ff8561c486f5db5f05d5bbecb09bb960ea8d2ec + languageName: node + linkType: hard + "har-schema@npm:^2.0.0": version: 2.0.0 resolution: "har-schema@npm:2.0.0" @@ -27445,6 +28041,13 @@ __metadata: languageName: node linkType: hard +"heap@npm:>= 0.2.0": + version: 0.2.7 + resolution: "heap@npm:0.2.7" + checksum: 341c5d51ae13dc8346c371a8a69c57c972fcb9a3233090d3dd5ba29d483d6b5b4e75492443cbfeacd46608bb30e6680f646ffb7a6205900221735587d07a79b6 + languageName: node + linkType: hard + "hex-rgb@npm:^5.0.0": version: 5.0.0 resolution: "hex-rgb@npm:5.0.0" @@ -29017,6 +29620,13 @@ __metadata: languageName: node linkType: hard +"is-promise@npm:^2.2.2": + version: 2.2.2 + resolution: "is-promise@npm:2.2.2" + checksum: 2dba959812380e45b3df0fb12e7cb4d4528c989c7abb03ececb1d1fd6ab1cbfee956ca9daa587b9db1d8ac3c1e5738cf217bdb3dfd99df8c691be4c00ae09069 + languageName: node + linkType: hard + "is-reference@npm:^3.0.0": version: 3.0.2 resolution: "is-reference@npm:3.0.2" @@ -29197,6 +29807,13 @@ __metadata: languageName: node linkType: hard +"is-what@npm:^4.1.8": + version: 4.1.16 + resolution: "is-what@npm:4.1.16" + checksum: 611f1947776826dcf85b57cfb7bd3b3ea6f4b94a9c2f551d4a53f653cf0cb9d1e6518846648256d46ee6c91d114b6d09d2ac8a07306f7430c5900f87466aae5b + languageName: node + linkType: hard + "is-whitespace@npm:^0.3.0": version: 0.3.0 resolution: "is-whitespace@npm:0.3.0" @@ -30194,6 +30811,13 @@ __metadata: languageName: node linkType: hard +"js-base64@npm:^3.7.5": + version: 3.7.6 + resolution: "js-base64@npm:3.7.6" + checksum: d9ae30a04e28e5814c6c606d08ecf9aac16daea0fcbc549e3b971042a4d4ecc7cf60ea96e1c9e8a463ca75fcbfd13613b87bddb3a8fe92801271e7eedcd3e8d3 + languageName: node + linkType: hard + "js-beautify@npm:^1.6.12": version: 1.14.11 resolution: "js-beautify@npm:1.14.11" @@ -30485,6 +31109,19 @@ __metadata: languageName: node linkType: hard +"json-diff@npm:0.9.0": + version: 0.9.0 + resolution: "json-diff@npm:0.9.0" + dependencies: + cli-color: "npm:^2.0.0" + difflib: "npm:~0.2.1" + dreamopt: "npm:~0.8.0" + bin: + json-diff: bin/json-diff.js + checksum: 971983f0e93c4f55c2d2bee8429e84e61ca054144ddcaf5cecf8aff33e68756fd93dcdd2ff8f19a12ef9aa5063b0e81087bbb266f4c0db5de6fe3e8440da8b99 + languageName: node + linkType: hard + "json-parse-even-better-errors@npm:^2.3.0, json-parse-even-better-errors@npm:^2.3.1": version: 2.3.1 resolution: "json-parse-even-better-errors@npm:2.3.1" @@ -31029,6 +31666,38 @@ __metadata: languageName: node linkType: hard +"libsql@npm:^0.2.0": + version: 0.2.0 + resolution: "libsql@npm:0.2.0" + dependencies: + "@libsql/darwin-arm64": "npm:0.2.0" + "@libsql/darwin-x64": "npm:0.2.0" + "@libsql/linux-arm64-gnu": "npm:0.2.0" + "@libsql/linux-arm64-musl": "npm:0.2.0" + "@libsql/linux-x64-gnu": "npm:0.2.0" + "@libsql/linux-x64-musl": "npm:0.2.0" + "@libsql/win32-x64-msvc": "npm:0.2.0" + "@neon-rs/load": "npm:^0.0.4" + detect-libc: "npm:2.0.2" + dependenciesMeta: + "@libsql/darwin-arm64": + optional: true + "@libsql/darwin-x64": + optional: true + "@libsql/linux-arm64-gnu": + optional: true + "@libsql/linux-arm64-musl": + optional: true + "@libsql/linux-x64-gnu": + optional: true + "@libsql/linux-x64-musl": + optional: true + "@libsql/win32-x64-msvc": + optional: true + conditions: (os=darwin | os=linux | os=win32) & (cpu=x64 | cpu=arm64) + languageName: node + linkType: hard + "lilconfig@npm:^2.0.3": version: 2.1.0 resolution: "lilconfig@npm:2.1.0" @@ -31476,6 +32145,13 @@ __metadata: languageName: node linkType: hard +"lodash.throttle@npm:^4.1.1": + version: 4.1.1 + resolution: "lodash.throttle@npm:4.1.1" + checksum: 14628013e9e7f65ac904fc82fd8ecb0e55a9c4c2416434b1dd9cf64ae70a8937f0b15376a39a68248530adc64887ed0fe2b75204b2c9ec3eea1cb2d66ddd125d + languageName: node + linkType: hard + "lodash.union@npm:^4.6.0": version: 4.6.0 resolution: "lodash.union@npm:4.6.0" @@ -31662,6 +32338,15 @@ __metadata: languageName: node linkType: hard +"lru-queue@npm:^0.1.0": + version: 0.1.0 + resolution: "lru-queue@npm:0.1.0" + dependencies: + es5-ext: "npm:~0.10.2" + checksum: 83517032b46843601c4528be65e8aaf85f5a7860a9cfa3e4f2b5591da436e7cd748d95b450c91434c4ffb75d3ae4c069ddbdd9f71ada56a99a00c03088c51b4d + languageName: node + linkType: hard + "luxon@npm:^3.2.1, luxon@npm:^3.3.0": version: 3.4.4 resolution: "luxon@npm:3.4.4" @@ -32754,6 +33439,22 @@ __metadata: languageName: node linkType: hard +"memoizee@npm:^0.4.15": + version: 0.4.15 + resolution: "memoizee@npm:0.4.15" + dependencies: + d: "npm:^1.0.1" + es5-ext: "npm:^0.10.53" + es6-weak-map: "npm:^2.0.3" + event-emitter: "npm:^0.3.5" + is-promise: "npm:^2.2.2" + lru-queue: "npm:^0.1.0" + next-tick: "npm:^1.1.0" + timers-ext: "npm:^0.1.7" + checksum: 297e65cd8256bdf24c48f5e158da80d4c9688db0d6e65c5dcc13fa768e782ddeb71aec36925359931b5efef0efc6666b5bb2af6deb3de63d4258a3821ed16fce + languageName: node + linkType: hard + "memoizerific@npm:^1.11.3": version: 1.11.3 resolution: "memoizerific@npm:1.11.3" @@ -34573,7 +35274,7 @@ __metadata: languageName: node linkType: hard -"next-tick@npm:^1.1.0": +"next-tick@npm:1, next-tick@npm:^1.1.0": version: 1.1.0 resolution: "next-tick@npm:1.1.0" checksum: 3ba80dd805fcb336b4f52e010992f3e6175869c8d88bf4ff0a81d5d66e6049f89993463b28211613e58a6b7fe93ff5ccbba0da18d4fa574b96289e8f0b577f28 @@ -34705,7 +35406,7 @@ __metadata: languageName: node linkType: hard -"node-domexception@npm:1.0.0": +"node-domexception@npm:1.0.0, node-domexception@npm:^1.0.0": version: 1.0.0 resolution: "node-domexception@npm:1.0.0" checksum: 5e5d63cda29856402df9472335af4bb13875e1927ad3be861dc5ebde38917aecbf9ae337923777af52a48c426b70148815e890a5d72760f1b4d758cc671b1a2b @@ -34754,7 +35455,7 @@ __metadata: languageName: node linkType: hard -"node-fetch@npm:^2, node-fetch@npm:^2.0.0, node-fetch@npm:^2.6.1, node-fetch@npm:^2.6.12, node-fetch@npm:^2.6.7, node-fetch@npm:^2.6.9": +"node-fetch@npm:^2, node-fetch@npm:^2.0.0, node-fetch@npm:^2.6.1, node-fetch@npm:^2.6.12, node-fetch@npm:^2.6.7, node-fetch@npm:^2.6.9, node-fetch@npm:^2.7.0": version: 2.7.0 resolution: "node-fetch@npm:2.7.0" dependencies: @@ -34768,6 +35469,17 @@ __metadata: languageName: node linkType: hard +"node-fetch@npm:^3.3.2": + version: 3.3.2 + resolution: "node-fetch@npm:3.3.2" + dependencies: + data-uri-to-buffer: "npm:^4.0.0" + fetch-blob: "npm:^3.1.4" + formdata-polyfill: "npm:^4.0.10" + checksum: f3d5e56190562221398c9f5750198b34cf6113aa304e34ee97c94fd300ec578b25b2c2906edba922050fce983338fde0d5d34fcb0fc3336ade5bd0e429ad7538 + languageName: node + linkType: hard + "node-forge@npm:^1, node-forge@npm:^1.3.1": version: 1.3.1 resolution: "node-forge@npm:1.3.1" @@ -37408,6 +38120,13 @@ __metadata: languageName: node linkType: hard +"postgres@npm:^3.4.3": + version: 3.4.3 + resolution: "postgres@npm:3.4.3" + checksum: 859b02a1659a0c4139e20880bd15b238f755ae1dbdeb7e2e027e31667cfa32fa502bfa5a2bb955353f36c236ebf8b62e90830d005f81438d165910cc3b8fade0 + languageName: node + linkType: hard + "postman-collection@npm:^4.1.2": version: 4.3.0 resolution: "postman-collection@npm:4.3.0" @@ -42251,6 +42970,15 @@ __metadata: languageName: node linkType: hard +"superjson@npm:^2.2.1": + version: 2.2.1 + resolution: "superjson@npm:2.2.1" + dependencies: + copy-anything: "npm:^3.0.2" + checksum: 5d8202c955170bd98ef2647f712754ac54d2d007923cfdb53a4b035304d8964b8c41d5eff41ee277896e2ac32e06abb009b571f1589416b729fe40216320cc7a + languageName: node + linkType: hard + "supertest@npm:^6.1.3": version: 6.3.3 resolution: "supertest@npm:6.3.3" @@ -42676,6 +43404,16 @@ __metadata: languageName: node linkType: hard +"timers-ext@npm:^0.1.7": + version: 0.1.7 + resolution: "timers-ext@npm:0.1.7" + dependencies: + es5-ext: "npm:~0.10.46" + next-tick: "npm:1" + checksum: fc43c6a01f52875e57d301ae9ec47b3021c6d9b96de5bc6e4e5fc4a3d2b25ebaab69faf6fe85520efbef0ad784537748f88f7efd7b6b2bf0a177c8bc7a66ca7c + languageName: node + linkType: hard + "tiny-invariant@npm:^1.0.2, tiny-invariant@npm:^1.0.6, tiny-invariant@npm:^1.1.0, tiny-invariant@npm:^1.3.1": version: 1.3.1 resolution: "tiny-invariant@npm:1.3.1" @@ -43399,6 +44137,8 @@ __metadata: "twenty-website@workspace:packages/twenty-website": version: 0.0.0-use.local resolution: "twenty-website@workspace:packages/twenty-website" + dependencies: + postgres: "npm:^3.4.3" languageName: unknown linkType: soft @@ -43448,6 +44188,7 @@ __metadata: "@hello-pangea/dnd": "npm:^16.2.0" "@hookform/resolvers": "npm:^3.1.1" "@jsdevtools/rehype-toc": "npm:^3.0.2" + "@libsql/client": "npm:^0.4.3" "@mdx-js/react": "npm:^3.0.0" "@nestjs/apollo": "npm:^11.0.5" "@nestjs/axios": "npm:^3.0.1" @@ -43562,6 +44303,8 @@ __metadata: deep-equal: "npm:^2.2.2" docusaurus-node-polyfills: "npm:^1.0.0" dotenv-cli: "npm:^7.2.1" + drizzle-kit: "npm:^0.20.14" + drizzle-orm: "npm:^0.29.3" esbuild-plugin-svgr: "npm:^2.1.0" eslint: "npm:^8.53.0" eslint-config-next: "npm:14.0.4" @@ -45527,6 +46270,13 @@ __metadata: languageName: node linkType: hard +"web-streams-polyfill@npm:^3.0.3": + version: 3.3.2 + resolution: "web-streams-polyfill@npm:3.3.2" + checksum: 623c2fced2ef77d5afdbc43acef64b8af609a32125b691eae286d534a36004c8a71030f0e78068516774a97fd90dbfb3726b10fd569a2d158e60c83a539c489e + languageName: node + linkType: hard + "web-streams-polyfill@npm:^3.2.1": version: 3.2.1 resolution: "web-streams-polyfill@npm:3.2.1" @@ -46024,7 +46774,7 @@ __metadata: languageName: node linkType: hard -"wordwrap@npm:^1.0.0": +"wordwrap@npm:>=0.0.2, wordwrap@npm:^1.0.0": version: 1.0.0 resolution: "wordwrap@npm:1.0.0" checksum: 7ed2e44f3c33c5c3e3771134d2b0aee4314c9e49c749e37f464bf69f2bcdf0cbf9419ca638098e2717cff4875c47f56a007532f6111c3319f557a2ca91278e92 @@ -46688,7 +47438,7 @@ __metadata: languageName: node linkType: hard -"zod@npm:^3.22.2": +"zod@npm:^3.20.2, zod@npm:^3.22.2": version: 3.22.4 resolution: "zod@npm:3.22.4" checksum: 7578ab283dac0eee66a0ad0fc4a7f28c43e6745aadb3a529f59a4b851aa10872b3890398b3160f257f4b6817b4ce643debdda4fb21a2c040adda7862cab0a587