|
| 1 | +// Generated by Xata Codegen 0.30.1. Please do not edit. |
| 2 | +import { buildClient } from "@xata.io/client"; |
| 3 | +import type { |
| 4 | + BaseClientOptions, |
| 5 | + SchemaInference, |
| 6 | + XataRecord, |
| 7 | +} from "@xata.io/client"; |
| 8 | + |
| 9 | +const tables = [ |
| 10 | + { |
| 11 | + name: "reports", |
| 12 | + columns: [ |
| 13 | + { name: "repoId", type: "int", unique: true }, |
| 14 | + { name: "repoAuthor", type: "string" }, |
| 15 | + { |
| 16 | + name: "message", |
| 17 | + type: "text", |
| 18 | + notNull: true, |
| 19 | + defaultValue: "No Message", |
| 20 | + }, |
| 21 | + { name: "user", type: "link", link: { table: "nextauth_users" } }, |
| 22 | + { name: "valid", type: "bool", notNull: true, defaultValue: "true" }, |
| 23 | + { name: "repoUrl", type: "string", unique: true }, |
| 24 | + ], |
| 25 | + }, |
| 26 | + { |
| 27 | + name: "nextauth_users", |
| 28 | + columns: [ |
| 29 | + { name: "email", type: "email" }, |
| 30 | + { name: "emailVerified", type: "datetime" }, |
| 31 | + { name: "name", type: "string" }, |
| 32 | + { name: "image", type: "string" }, |
| 33 | + ], |
| 34 | + revLinks: [ |
| 35 | + { column: "user", table: "nextauth_accounts" }, |
| 36 | + { column: "user", table: "nextauth_users_accounts" }, |
| 37 | + { column: "user", table: "nextauth_users_sessions" }, |
| 38 | + { column: "user", table: "nextauth_sessions" }, |
| 39 | + { column: "user", table: "reports" }, |
| 40 | + { column: "user", table: "bookmarks" }, |
| 41 | + ], |
| 42 | + }, |
| 43 | + { |
| 44 | + name: "nextauth_accounts", |
| 45 | + columns: [ |
| 46 | + { name: "user", type: "link", link: { table: "nextauth_users" } }, |
| 47 | + { name: "type", type: "string" }, |
| 48 | + { name: "provider", type: "string" }, |
| 49 | + { name: "providerAccountId", type: "string" }, |
| 50 | + { name: "refresh_token", type: "string" }, |
| 51 | + { name: "access_token", type: "string" }, |
| 52 | + { name: "expires_at", type: "int" }, |
| 53 | + { name: "token_type", type: "string" }, |
| 54 | + { name: "scope", type: "string" }, |
| 55 | + { name: "id_token", type: "text" }, |
| 56 | + { name: "session_state", type: "string" }, |
| 57 | + ], |
| 58 | + revLinks: [{ column: "account", table: "nextauth_users_accounts" }], |
| 59 | + }, |
| 60 | + { |
| 61 | + name: "nextauth_verificationTokens", |
| 62 | + columns: [ |
| 63 | + { name: "identifier", type: "string" }, |
| 64 | + { name: "token", type: "string" }, |
| 65 | + { name: "expires", type: "datetime" }, |
| 66 | + ], |
| 67 | + }, |
| 68 | + { |
| 69 | + name: "nextauth_users_accounts", |
| 70 | + columns: [ |
| 71 | + { name: "user", type: "link", link: { table: "nextauth_users" } }, |
| 72 | + { name: "account", type: "link", link: { table: "nextauth_accounts" } }, |
| 73 | + ], |
| 74 | + }, |
| 75 | + { |
| 76 | + name: "nextauth_users_sessions", |
| 77 | + columns: [ |
| 78 | + { name: "user", type: "link", link: { table: "nextauth_users" } }, |
| 79 | + { name: "session", type: "link", link: { table: "nextauth_sessions" } }, |
| 80 | + ], |
| 81 | + }, |
| 82 | + { |
| 83 | + name: "nextauth_sessions", |
| 84 | + columns: [ |
| 85 | + { name: "sessionToken", type: "string" }, |
| 86 | + { name: "expires", type: "datetime" }, |
| 87 | + { name: "user", type: "link", link: { table: "nextauth_users" } }, |
| 88 | + ], |
| 89 | + revLinks: [{ column: "session", table: "nextauth_users_sessions" }], |
| 90 | + }, |
| 91 | + { |
| 92 | + name: "bookmarks", |
| 93 | + columns: [ |
| 94 | + { name: "user", type: "link", link: { table: "nextauth_users" } }, |
| 95 | + ], |
| 96 | + }, |
| 97 | +] as const; |
| 98 | + |
| 99 | +export type SchemaTables = typeof tables; |
| 100 | +export type InferredTypes = SchemaInference<SchemaTables>; |
| 101 | + |
| 102 | +export type Reports = InferredTypes["reports"]; |
| 103 | +export type ReportsRecord = Reports & XataRecord; |
| 104 | + |
| 105 | +export type NextauthUsers = InferredTypes["nextauth_users"]; |
| 106 | +export type NextauthUsersRecord = NextauthUsers & XataRecord; |
| 107 | + |
| 108 | +export type NextauthAccounts = InferredTypes["nextauth_accounts"]; |
| 109 | +export type NextauthAccountsRecord = NextauthAccounts & XataRecord; |
| 110 | + |
| 111 | +export type NextauthVerificationTokens = |
| 112 | + InferredTypes["nextauth_verificationTokens"]; |
| 113 | +export type NextauthVerificationTokensRecord = NextauthVerificationTokens & |
| 114 | + XataRecord; |
| 115 | + |
| 116 | +export type NextauthUsersAccounts = InferredTypes["nextauth_users_accounts"]; |
| 117 | +export type NextauthUsersAccountsRecord = NextauthUsersAccounts & XataRecord; |
| 118 | + |
| 119 | +export type NextauthUsersSessions = InferredTypes["nextauth_users_sessions"]; |
| 120 | +export type NextauthUsersSessionsRecord = NextauthUsersSessions & XataRecord; |
| 121 | + |
| 122 | +export type NextauthSessions = InferredTypes["nextauth_sessions"]; |
| 123 | +export type NextauthSessionsRecord = NextauthSessions & XataRecord; |
| 124 | + |
| 125 | +export type Bookmarks = InferredTypes["bookmarks"]; |
| 126 | +export type BookmarksRecord = Bookmarks & XataRecord; |
| 127 | + |
| 128 | +export type DatabaseSchema = { |
| 129 | + reports: ReportsRecord; |
| 130 | + nextauth_users: NextauthUsersRecord; |
| 131 | + nextauth_accounts: NextauthAccountsRecord; |
| 132 | + nextauth_verificationTokens: NextauthVerificationTokensRecord; |
| 133 | + nextauth_users_accounts: NextauthUsersAccountsRecord; |
| 134 | + nextauth_users_sessions: NextauthUsersSessionsRecord; |
| 135 | + nextauth_sessions: NextauthSessionsRecord; |
| 136 | + bookmarks: BookmarksRecord; |
| 137 | +}; |
| 138 | + |
| 139 | +const DatabaseClient = buildClient(); |
| 140 | + |
| 141 | +const defaultOptions = { |
| 142 | + databaseURL: |
| 143 | + "https://Usman-Sabuwala-s-workspace-u2kcvd.us-east-1.xata.sh/db/project-finder-hf:main", |
| 144 | +}; |
| 145 | + |
| 146 | +export class XataClient extends DatabaseClient<DatabaseSchema> { |
| 147 | + constructor(options?: BaseClientOptions) { |
| 148 | + super({ ...defaultOptions, ...options }, tables); |
| 149 | + } |
| 150 | +} |
| 151 | + |
| 152 | +let instance: XataClient | undefined = undefined; |
| 153 | + |
| 154 | +export const getXataClient = () => { |
| 155 | + if (instance) return instance; |
| 156 | + |
| 157 | + instance = new XataClient(); |
| 158 | + return instance; |
| 159 | +}; |
0 commit comments