223 lines
12 KiB
TypeScript
223 lines
12 KiB
TypeScript
|
|
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
|
|
/* eslint-disable */
|
|
// biome-ignore-all lint: generated file
|
|
// @ts-nocheck
|
|
/*
|
|
* WARNING: This is an internal file that is subject to change!
|
|
*
|
|
* 🛑 Under no circumstances should you import this file directly! 🛑
|
|
*
|
|
* Please import the `PrismaClient` class from the `client.ts` file instead.
|
|
*/
|
|
|
|
import * as runtime from "@prisma/client/runtime/client"
|
|
import type * as Prisma from "./prismaNamespace.js"
|
|
|
|
|
|
const config: runtime.GetPrismaClientConfig = {
|
|
"previewFeatures": [],
|
|
"clientVersion": "7.3.0",
|
|
"engineVersion": "9d6ad21cbbceab97458517b147a6a09ff43aa735",
|
|
"activeProvider": "sqlite",
|
|
"inlineSchema": "// Prisma schema for the personal chat DB + LLM call log\n\ngenerator client {\n provider = \"prisma-client\"\n output = \"../generated/prisma\"\n}\n\ndatasource db {\n provider = \"sqlite\"\n}\n\nenum Provider {\n openai\n anthropic\n xai\n}\n\nenum MessageRole {\n system\n user\n assistant\n tool\n}\n\nmodel User {\n id String @id @default(cuid())\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n // minimal for now (single-user is fine). Keep extensible.\n handle String? @unique\n\n chats Chat[]\n}\n\nmodel Chat {\n id String @id @default(cuid())\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n title String?\n\n user User? @relation(fields: [userId], references: [id])\n userId String?\n\n messages Message[]\n calls LlmCall[]\n\n @@index([userId])\n}\n\nmodel Message {\n id String @id @default(cuid())\n createdAt DateTime @default(now())\n\n chat Chat @relation(fields: [chatId], references: [id], onDelete: Cascade)\n chatId String\n\n role MessageRole\n content String\n\n // for tool messages or attachments later\n name String?\n metadata Json?\n\n @@index([chatId, createdAt])\n}\n\nmodel LlmCall {\n id String @id @default(cuid())\n createdAt DateTime @default(now())\n\n chat Chat @relation(fields: [chatId], references: [id], onDelete: Cascade)\n chatId String\n\n provider Provider\n model String\n\n // request/response snapshots for debugging + replay\n request Json\n response Json?\n\n // usage/cost basics\n inputTokens Int?\n outputTokens Int?\n totalTokens Int?\n\n latencyMs Int?\n\n error String?\n\n @@index([chatId, createdAt])\n @@index([provider, model, createdAt])\n}\n",
|
|
"runtimeDataModel": {
|
|
"models": {},
|
|
"enums": {},
|
|
"types": {}
|
|
}
|
|
}
|
|
|
|
config.runtimeDataModel = JSON.parse("{\"models\":{\"User\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"handle\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"chats\",\"kind\":\"object\",\"type\":\"Chat\",\"relationName\":\"ChatToUser\"}],\"dbName\":null},\"Chat\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"title\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"ChatToUser\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"messages\",\"kind\":\"object\",\"type\":\"Message\",\"relationName\":\"ChatToMessage\"},{\"name\":\"calls\",\"kind\":\"object\",\"type\":\"LlmCall\",\"relationName\":\"ChatToLlmCall\"}],\"dbName\":null},\"Message\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"chat\",\"kind\":\"object\",\"type\":\"Chat\",\"relationName\":\"ChatToMessage\"},{\"name\":\"chatId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"role\",\"kind\":\"enum\",\"type\":\"MessageRole\"},{\"name\":\"content\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"metadata\",\"kind\":\"scalar\",\"type\":\"Json\"}],\"dbName\":null},\"LlmCall\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"chat\",\"kind\":\"object\",\"type\":\"Chat\",\"relationName\":\"ChatToLlmCall\"},{\"name\":\"chatId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"provider\",\"kind\":\"enum\",\"type\":\"Provider\"},{\"name\":\"model\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"request\",\"kind\":\"scalar\",\"type\":\"Json\"},{\"name\":\"response\",\"kind\":\"scalar\",\"type\":\"Json\"},{\"name\":\"inputTokens\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"outputTokens\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"totalTokens\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"latencyMs\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"error\",\"kind\":\"scalar\",\"type\":\"String\"}],\"dbName\":null}},\"enums\":{},\"types\":{}}")
|
|
|
|
async function decodeBase64AsWasm(wasmBase64: string): Promise<WebAssembly.Module> {
|
|
const { Buffer } = await import('node:buffer')
|
|
const wasmArray = Buffer.from(wasmBase64, 'base64')
|
|
return new WebAssembly.Module(wasmArray)
|
|
}
|
|
|
|
config.compilerWasm = {
|
|
getRuntime: async () => await import("@prisma/client/runtime/query_compiler_fast_bg.sqlite.mjs"),
|
|
|
|
getQueryCompilerWasmModule: async () => {
|
|
const { wasm } = await import("@prisma/client/runtime/query_compiler_fast_bg.sqlite.wasm-base64.mjs")
|
|
return await decodeBase64AsWasm(wasm)
|
|
},
|
|
|
|
importName: "./query_compiler_fast_bg.js"
|
|
}
|
|
|
|
|
|
|
|
export type LogOptions<ClientOptions extends Prisma.PrismaClientOptions> =
|
|
'log' extends keyof ClientOptions ? ClientOptions['log'] extends Array<Prisma.LogLevel | Prisma.LogDefinition> ? Prisma.GetEvents<ClientOptions['log']> : never : never
|
|
|
|
export interface PrismaClientConstructor {
|
|
/**
|
|
* ## Prisma Client
|
|
*
|
|
* Type-safe database client for TypeScript
|
|
* @example
|
|
* ```
|
|
* const prisma = new PrismaClient()
|
|
* // Fetch zero or more Users
|
|
* const users = await prisma.user.findMany()
|
|
* ```
|
|
*
|
|
* Read more in our [docs](https://pris.ly/d/client).
|
|
*/
|
|
|
|
new <
|
|
Options extends Prisma.PrismaClientOptions = Prisma.PrismaClientOptions,
|
|
LogOpts extends LogOptions<Options> = LogOptions<Options>,
|
|
OmitOpts extends Prisma.PrismaClientOptions['omit'] = Options extends { omit: infer U } ? U : Prisma.PrismaClientOptions['omit'],
|
|
ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs
|
|
>(options: Prisma.Subset<Options, Prisma.PrismaClientOptions> ): PrismaClient<LogOpts, OmitOpts, ExtArgs>
|
|
}
|
|
|
|
/**
|
|
* ## Prisma Client
|
|
*
|
|
* Type-safe database client for TypeScript
|
|
* @example
|
|
* ```
|
|
* const prisma = new PrismaClient()
|
|
* // Fetch zero or more Users
|
|
* const users = await prisma.user.findMany()
|
|
* ```
|
|
*
|
|
* Read more in our [docs](https://pris.ly/d/client).
|
|
*/
|
|
|
|
export interface PrismaClient<
|
|
in LogOpts extends Prisma.LogLevel = never,
|
|
in out OmitOpts extends Prisma.PrismaClientOptions['omit'] = undefined,
|
|
in out ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs
|
|
> {
|
|
[K: symbol]: { types: Prisma.TypeMap<ExtArgs>['other'] }
|
|
|
|
$on<V extends LogOpts>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent) => void): PrismaClient;
|
|
|
|
/**
|
|
* Connect with the database
|
|
*/
|
|
$connect(): runtime.Types.Utils.JsPromise<void>;
|
|
|
|
/**
|
|
* Disconnect from the database
|
|
*/
|
|
$disconnect(): runtime.Types.Utils.JsPromise<void>;
|
|
|
|
/**
|
|
* Executes a prepared raw query and returns the number of affected rows.
|
|
* @example
|
|
* ```
|
|
* const result = await prisma.$executeRaw`UPDATE User SET cool = ${true} WHERE email = ${'user@email.com'};`
|
|
* ```
|
|
*
|
|
* Read more in our [docs](https://pris.ly/d/raw-queries).
|
|
*/
|
|
$executeRaw<T = unknown>(query: TemplateStringsArray | Prisma.Sql, ...values: any[]): Prisma.PrismaPromise<number>;
|
|
|
|
/**
|
|
* Executes a raw query and returns the number of affected rows.
|
|
* Susceptible to SQL injections, see documentation.
|
|
* @example
|
|
* ```
|
|
* const result = await prisma.$executeRawUnsafe('UPDATE User SET cool = $1 WHERE email = $2 ;', true, 'user@email.com')
|
|
* ```
|
|
*
|
|
* Read more in our [docs](https://pris.ly/d/raw-queries).
|
|
*/
|
|
$executeRawUnsafe<T = unknown>(query: string, ...values: any[]): Prisma.PrismaPromise<number>;
|
|
|
|
/**
|
|
* Performs a prepared raw query and returns the `SELECT` data.
|
|
* @example
|
|
* ```
|
|
* const result = await prisma.$queryRaw`SELECT * FROM User WHERE id = ${1} OR email = ${'user@email.com'};`
|
|
* ```
|
|
*
|
|
* Read more in our [docs](https://pris.ly/d/raw-queries).
|
|
*/
|
|
$queryRaw<T = unknown>(query: TemplateStringsArray | Prisma.Sql, ...values: any[]): Prisma.PrismaPromise<T>;
|
|
|
|
/**
|
|
* Performs a raw query and returns the `SELECT` data.
|
|
* Susceptible to SQL injections, see documentation.
|
|
* @example
|
|
* ```
|
|
* const result = await prisma.$queryRawUnsafe('SELECT * FROM User WHERE id = $1 OR email = $2;', 1, 'user@email.com')
|
|
* ```
|
|
*
|
|
* Read more in our [docs](https://pris.ly/d/raw-queries).
|
|
*/
|
|
$queryRawUnsafe<T = unknown>(query: string, ...values: any[]): Prisma.PrismaPromise<T>;
|
|
|
|
|
|
/**
|
|
* Allows the running of a sequence of read/write operations that are guaranteed to either succeed or fail as a whole.
|
|
* @example
|
|
* ```
|
|
* const [george, bob, alice] = await prisma.$transaction([
|
|
* prisma.user.create({ data: { name: 'George' } }),
|
|
* prisma.user.create({ data: { name: 'Bob' } }),
|
|
* prisma.user.create({ data: { name: 'Alice' } }),
|
|
* ])
|
|
* ```
|
|
*
|
|
* Read more in our [docs](https://www.prisma.io/docs/concepts/components/prisma-client/transactions).
|
|
*/
|
|
$transaction<P extends Prisma.PrismaPromise<any>[]>(arg: [...P], options?: { isolationLevel?: Prisma.TransactionIsolationLevel }): runtime.Types.Utils.JsPromise<runtime.Types.Utils.UnwrapTuple<P>>
|
|
|
|
$transaction<R>(fn: (prisma: Omit<PrismaClient, runtime.ITXClientDenyList>) => runtime.Types.Utils.JsPromise<R>, options?: { maxWait?: number, timeout?: number, isolationLevel?: Prisma.TransactionIsolationLevel }): runtime.Types.Utils.JsPromise<R>
|
|
|
|
$extends: runtime.Types.Extensions.ExtendsHook<"extends", Prisma.TypeMapCb<OmitOpts>, ExtArgs, runtime.Types.Utils.Call<Prisma.TypeMapCb<OmitOpts>, {
|
|
extArgs: ExtArgs
|
|
}>>
|
|
|
|
/**
|
|
* `prisma.user`: Exposes CRUD operations for the **User** model.
|
|
* Example usage:
|
|
* ```ts
|
|
* // Fetch zero or more Users
|
|
* const users = await prisma.user.findMany()
|
|
* ```
|
|
*/
|
|
get user(): Prisma.UserDelegate<ExtArgs, { omit: OmitOpts }>;
|
|
|
|
/**
|
|
* `prisma.chat`: Exposes CRUD operations for the **Chat** model.
|
|
* Example usage:
|
|
* ```ts
|
|
* // Fetch zero or more Chats
|
|
* const chats = await prisma.chat.findMany()
|
|
* ```
|
|
*/
|
|
get chat(): Prisma.ChatDelegate<ExtArgs, { omit: OmitOpts }>;
|
|
|
|
/**
|
|
* `prisma.message`: Exposes CRUD operations for the **Message** model.
|
|
* Example usage:
|
|
* ```ts
|
|
* // Fetch zero or more Messages
|
|
* const messages = await prisma.message.findMany()
|
|
* ```
|
|
*/
|
|
get message(): Prisma.MessageDelegate<ExtArgs, { omit: OmitOpts }>;
|
|
|
|
/**
|
|
* `prisma.llmCall`: Exposes CRUD operations for the **LlmCall** model.
|
|
* Example usage:
|
|
* ```ts
|
|
* // Fetch zero or more LlmCalls
|
|
* const llmCalls = await prisma.llmCall.findMany()
|
|
* ```
|
|
*/
|
|
get llmCall(): Prisma.LlmCallDelegate<ExtArgs, { omit: OmitOpts }>;
|
|
}
|
|
|
|
export function getPrismaClientClass(): PrismaClientConstructor {
|
|
return runtime.getPrismaClient(config) as unknown as PrismaClientConstructor
|
|
}
|