From afd23365408f23f4127ee8c6afb538f1e58845b6 Mon Sep 17 00:00:00 2001 From: clawd Date: Tue, 27 Jan 2026 17:49:03 -0800 Subject: [PATCH] Add SSE streaming endpoint + cleanup --- .gitignore | 4 + README.md | 3 +- generated/prisma/browser.ts | 39 - generated/prisma/client.ts | 61 - generated/prisma/commonInputTypes.ts | 460 ----- generated/prisma/enums.ts | 28 - generated/prisma/internal/class.ts | 222 --- generated/prisma/internal/prismaNamespace.ts | 1064 ----------- .../prisma/internal/prismaNamespaceBrowser.ts | 171 -- generated/prisma/models.ts | 15 - generated/prisma/models/Chat.ts | 1611 ---------------- generated/prisma/models/LlmCall.ts | 1644 ----------------- generated/prisma/models/Message.ts | 1405 -------------- generated/prisma/models/User.ts | 1302 ------------- prisma.config.ts.bak | 14 - src/llm/streaming.ts | 130 ++ src/routes.ts | 60 + 17 files changed, 196 insertions(+), 8037 deletions(-) delete mode 100644 generated/prisma/browser.ts delete mode 100644 generated/prisma/client.ts delete mode 100644 generated/prisma/commonInputTypes.ts delete mode 100644 generated/prisma/enums.ts delete mode 100644 generated/prisma/internal/class.ts delete mode 100644 generated/prisma/internal/prismaNamespace.ts delete mode 100644 generated/prisma/internal/prismaNamespaceBrowser.ts delete mode 100644 generated/prisma/models.ts delete mode 100644 generated/prisma/models/Chat.ts delete mode 100644 generated/prisma/models/LlmCall.ts delete mode 100644 generated/prisma/models/Message.ts delete mode 100644 generated/prisma/models/User.ts delete mode 100644 prisma.config.ts.bak create mode 100644 src/llm/streaming.ts diff --git a/.gitignore b/.gitignore index 3eaa684..d31cb94 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,7 @@ dev.db prisma/migrations .DS_Store dist + +# leftovers from early prisma v7 experiment +/generated +prisma.config.ts.bak diff --git a/README.md b/README.md index d295871..eebbba3 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ If `ADMIN_TOKEN` is not set, the server runs in open mode (dev). - `GET /v1/chats/:chatId` - `POST /v1/chats/:chatId/messages` - `POST /v1/chat-completions` +- `POST /v1/chat-completions/stream` (SSE) `POST /v1/chat-completions` body example: @@ -58,7 +59,7 @@ If `ADMIN_TOKEN` is not set, the server runs in open mode (dev). ``` ## Next steps (planned) -- SSE streaming (`/v1/chat-completions:stream`) +- Better streaming protocol compatibility (OpenAI-style chunks + cancellation) - Tool/function calling normalization - User accounts + per-device API keys - Postgres support + migrations for prod diff --git a/generated/prisma/browser.ts b/generated/prisma/browser.ts deleted file mode 100644 index bec34dc..0000000 --- a/generated/prisma/browser.ts +++ /dev/null @@ -1,39 +0,0 @@ - -/* !!! This is code generated by Prisma. Do not edit directly. !!! */ -/* eslint-disable */ -// biome-ignore-all lint: generated file -// @ts-nocheck -/* - * This file should be your main import to use Prisma-related types and utilities in a browser. - * Use it to get access to models, enums, and input types. - * - * This file does not contain a `PrismaClient` class, nor several other helpers that are intended as server-side only. - * See `client.ts` for the standard, server-side entry point. - * - * 🟢 You can import this file directly. - */ - -import * as Prisma from './internal/prismaNamespaceBrowser.js' -export { Prisma } -export * as $Enums from './enums.js' -export * from './enums.js'; -/** - * Model User - * - */ -export type User = Prisma.UserModel -/** - * Model Chat - * - */ -export type Chat = Prisma.ChatModel -/** - * Model Message - * - */ -export type Message = Prisma.MessageModel -/** - * Model LlmCall - * - */ -export type LlmCall = Prisma.LlmCallModel diff --git a/generated/prisma/client.ts b/generated/prisma/client.ts deleted file mode 100644 index 530a8b6..0000000 --- a/generated/prisma/client.ts +++ /dev/null @@ -1,61 +0,0 @@ - -/* !!! This is code generated by Prisma. Do not edit directly. !!! */ -/* eslint-disable */ -// biome-ignore-all lint: generated file -// @ts-nocheck -/* - * This file should be your main import to use Prisma. Through it you get access to all the models, enums, and input types. - * If you're looking for something you can import in the client-side of your application, please refer to the `browser.ts` file instead. - * - * 🟢 You can import this file directly. - */ - -import * as process from 'node:process' -import * as path from 'node:path' -import { fileURLToPath } from 'node:url' -globalThis['__dirname'] = path.dirname(fileURLToPath(import.meta.url)) - -import * as runtime from "@prisma/client/runtime/client" -import * as $Enums from "./enums.js" -import * as $Class from "./internal/class.js" -import * as Prisma from "./internal/prismaNamespace.js" - -export * as $Enums from './enums.js' -export * from "./enums.js" -/** - * ## 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 const PrismaClient = $Class.getPrismaClientClass() -export type PrismaClient = $Class.PrismaClient -export { Prisma } - -/** - * Model User - * - */ -export type User = Prisma.UserModel -/** - * Model Chat - * - */ -export type Chat = Prisma.ChatModel -/** - * Model Message - * - */ -export type Message = Prisma.MessageModel -/** - * Model LlmCall - * - */ -export type LlmCall = Prisma.LlmCallModel diff --git a/generated/prisma/commonInputTypes.ts b/generated/prisma/commonInputTypes.ts deleted file mode 100644 index 7c25de3..0000000 --- a/generated/prisma/commonInputTypes.ts +++ /dev/null @@ -1,460 +0,0 @@ - -/* !!! This is code generated by Prisma. Do not edit directly. !!! */ -/* eslint-disable */ -// biome-ignore-all lint: generated file -// @ts-nocheck -/* - * This file exports various common sort, input & filter types that are not directly linked to a particular model. - * - * 🟢 You can import this file directly. - */ - -import type * as runtime from "@prisma/client/runtime/client" -import * as $Enums from "./enums.js" -import type * as Prisma from "./internal/prismaNamespace.js" - - -export type StringFilter<$PrismaModel = never> = { - equals?: string | Prisma.StringFieldRefInput<$PrismaModel> - in?: string[] - notIn?: string[] - lt?: string | Prisma.StringFieldRefInput<$PrismaModel> - lte?: string | Prisma.StringFieldRefInput<$PrismaModel> - gt?: string | Prisma.StringFieldRefInput<$PrismaModel> - gte?: string | Prisma.StringFieldRefInput<$PrismaModel> - contains?: string | Prisma.StringFieldRefInput<$PrismaModel> - startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> - endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> - not?: Prisma.NestedStringFilter<$PrismaModel> | string -} - -export type DateTimeFilter<$PrismaModel = never> = { - equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> - in?: Date[] | string[] - notIn?: Date[] | string[] - lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> - lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> - gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> - gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> - not?: Prisma.NestedDateTimeFilter<$PrismaModel> | Date | string -} - -export type StringNullableFilter<$PrismaModel = never> = { - equals?: string | Prisma.StringFieldRefInput<$PrismaModel> | null - in?: string[] | null - notIn?: string[] | null - lt?: string | Prisma.StringFieldRefInput<$PrismaModel> - lte?: string | Prisma.StringFieldRefInput<$PrismaModel> - gt?: string | Prisma.StringFieldRefInput<$PrismaModel> - gte?: string | Prisma.StringFieldRefInput<$PrismaModel> - contains?: string | Prisma.StringFieldRefInput<$PrismaModel> - startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> - endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> - not?: Prisma.NestedStringNullableFilter<$PrismaModel> | string | null -} - -export type SortOrderInput = { - sort: Prisma.SortOrder - nulls?: Prisma.NullsOrder -} - -export type StringWithAggregatesFilter<$PrismaModel = never> = { - equals?: string | Prisma.StringFieldRefInput<$PrismaModel> - in?: string[] - notIn?: string[] - lt?: string | Prisma.StringFieldRefInput<$PrismaModel> - lte?: string | Prisma.StringFieldRefInput<$PrismaModel> - gt?: string | Prisma.StringFieldRefInput<$PrismaModel> - gte?: string | Prisma.StringFieldRefInput<$PrismaModel> - contains?: string | Prisma.StringFieldRefInput<$PrismaModel> - startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> - endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> - not?: Prisma.NestedStringWithAggregatesFilter<$PrismaModel> | string - _count?: Prisma.NestedIntFilter<$PrismaModel> - _min?: Prisma.NestedStringFilter<$PrismaModel> - _max?: Prisma.NestedStringFilter<$PrismaModel> -} - -export type DateTimeWithAggregatesFilter<$PrismaModel = never> = { - equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> - in?: Date[] | string[] - notIn?: Date[] | string[] - lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> - lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> - gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> - gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> - not?: Prisma.NestedDateTimeWithAggregatesFilter<$PrismaModel> | Date | string - _count?: Prisma.NestedIntFilter<$PrismaModel> - _min?: Prisma.NestedDateTimeFilter<$PrismaModel> - _max?: Prisma.NestedDateTimeFilter<$PrismaModel> -} - -export type StringNullableWithAggregatesFilter<$PrismaModel = never> = { - equals?: string | Prisma.StringFieldRefInput<$PrismaModel> | null - in?: string[] | null - notIn?: string[] | null - lt?: string | Prisma.StringFieldRefInput<$PrismaModel> - lte?: string | Prisma.StringFieldRefInput<$PrismaModel> - gt?: string | Prisma.StringFieldRefInput<$PrismaModel> - gte?: string | Prisma.StringFieldRefInput<$PrismaModel> - contains?: string | Prisma.StringFieldRefInput<$PrismaModel> - startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> - endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> - not?: Prisma.NestedStringNullableWithAggregatesFilter<$PrismaModel> | string | null - _count?: Prisma.NestedIntNullableFilter<$PrismaModel> - _min?: Prisma.NestedStringNullableFilter<$PrismaModel> - _max?: Prisma.NestedStringNullableFilter<$PrismaModel> -} - -export type EnumMessageRoleFilter<$PrismaModel = never> = { - equals?: $Enums.MessageRole | Prisma.EnumMessageRoleFieldRefInput<$PrismaModel> - in?: $Enums.MessageRole[] - notIn?: $Enums.MessageRole[] - not?: Prisma.NestedEnumMessageRoleFilter<$PrismaModel> | $Enums.MessageRole -} - -export type JsonNullableFilter<$PrismaModel = never> = -| Prisma.PatchUndefined< - Prisma.Either>, Exclude>, 'path'>>, - Required> - > -| Prisma.OptionalFlat>, 'path'>> - -export type JsonNullableFilterBase<$PrismaModel = never> = { - equals?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | Prisma.JsonNullValueFilter - path?: string - mode?: Prisma.QueryMode | Prisma.EnumQueryModeFieldRefInput<$PrismaModel> - string_contains?: string | Prisma.StringFieldRefInput<$PrismaModel> - string_starts_with?: string | Prisma.StringFieldRefInput<$PrismaModel> - string_ends_with?: string | Prisma.StringFieldRefInput<$PrismaModel> - array_starts_with?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | null - array_ends_with?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | null - not?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | Prisma.JsonNullValueFilter -} - -export type EnumMessageRoleWithAggregatesFilter<$PrismaModel = never> = { - equals?: $Enums.MessageRole | Prisma.EnumMessageRoleFieldRefInput<$PrismaModel> - in?: $Enums.MessageRole[] - notIn?: $Enums.MessageRole[] - not?: Prisma.NestedEnumMessageRoleWithAggregatesFilter<$PrismaModel> | $Enums.MessageRole - _count?: Prisma.NestedIntFilter<$PrismaModel> - _min?: Prisma.NestedEnumMessageRoleFilter<$PrismaModel> - _max?: Prisma.NestedEnumMessageRoleFilter<$PrismaModel> -} - -export type JsonNullableWithAggregatesFilter<$PrismaModel = never> = -| Prisma.PatchUndefined< - Prisma.Either>, Exclude>, 'path'>>, - Required> - > -| Prisma.OptionalFlat>, 'path'>> - -export type JsonNullableWithAggregatesFilterBase<$PrismaModel = never> = { - equals?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | Prisma.JsonNullValueFilter - path?: string - mode?: Prisma.QueryMode | Prisma.EnumQueryModeFieldRefInput<$PrismaModel> - string_contains?: string | Prisma.StringFieldRefInput<$PrismaModel> - string_starts_with?: string | Prisma.StringFieldRefInput<$PrismaModel> - string_ends_with?: string | Prisma.StringFieldRefInput<$PrismaModel> - array_starts_with?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | null - array_ends_with?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | null - not?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | Prisma.JsonNullValueFilter - _count?: Prisma.NestedIntNullableFilter<$PrismaModel> - _min?: Prisma.NestedJsonNullableFilter<$PrismaModel> - _max?: Prisma.NestedJsonNullableFilter<$PrismaModel> -} - -export type EnumProviderFilter<$PrismaModel = never> = { - equals?: $Enums.Provider | Prisma.EnumProviderFieldRefInput<$PrismaModel> - in?: $Enums.Provider[] - notIn?: $Enums.Provider[] - not?: Prisma.NestedEnumProviderFilter<$PrismaModel> | $Enums.Provider -} - -export type JsonFilter<$PrismaModel = never> = -| Prisma.PatchUndefined< - Prisma.Either>, Exclude>, 'path'>>, - Required> - > -| Prisma.OptionalFlat>, 'path'>> - -export type JsonFilterBase<$PrismaModel = never> = { - equals?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | Prisma.JsonNullValueFilter - path?: string - mode?: Prisma.QueryMode | Prisma.EnumQueryModeFieldRefInput<$PrismaModel> - string_contains?: string | Prisma.StringFieldRefInput<$PrismaModel> - string_starts_with?: string | Prisma.StringFieldRefInput<$PrismaModel> - string_ends_with?: string | Prisma.StringFieldRefInput<$PrismaModel> - array_starts_with?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | null - array_ends_with?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | null - not?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | Prisma.JsonNullValueFilter -} - -export type IntNullableFilter<$PrismaModel = never> = { - equals?: number | Prisma.IntFieldRefInput<$PrismaModel> | null - in?: number[] | null - notIn?: number[] | null - lt?: number | Prisma.IntFieldRefInput<$PrismaModel> - lte?: number | Prisma.IntFieldRefInput<$PrismaModel> - gt?: number | Prisma.IntFieldRefInput<$PrismaModel> - gte?: number | Prisma.IntFieldRefInput<$PrismaModel> - not?: Prisma.NestedIntNullableFilter<$PrismaModel> | number | null -} - -export type EnumProviderWithAggregatesFilter<$PrismaModel = never> = { - equals?: $Enums.Provider | Prisma.EnumProviderFieldRefInput<$PrismaModel> - in?: $Enums.Provider[] - notIn?: $Enums.Provider[] - not?: Prisma.NestedEnumProviderWithAggregatesFilter<$PrismaModel> | $Enums.Provider - _count?: Prisma.NestedIntFilter<$PrismaModel> - _min?: Prisma.NestedEnumProviderFilter<$PrismaModel> - _max?: Prisma.NestedEnumProviderFilter<$PrismaModel> -} - -export type JsonWithAggregatesFilter<$PrismaModel = never> = -| Prisma.PatchUndefined< - Prisma.Either>, Exclude>, 'path'>>, - Required> - > -| Prisma.OptionalFlat>, 'path'>> - -export type JsonWithAggregatesFilterBase<$PrismaModel = never> = { - equals?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | Prisma.JsonNullValueFilter - path?: string - mode?: Prisma.QueryMode | Prisma.EnumQueryModeFieldRefInput<$PrismaModel> - string_contains?: string | Prisma.StringFieldRefInput<$PrismaModel> - string_starts_with?: string | Prisma.StringFieldRefInput<$PrismaModel> - string_ends_with?: string | Prisma.StringFieldRefInput<$PrismaModel> - array_starts_with?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | null - array_ends_with?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | null - not?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | Prisma.JsonNullValueFilter - _count?: Prisma.NestedIntFilter<$PrismaModel> - _min?: Prisma.NestedJsonFilter<$PrismaModel> - _max?: Prisma.NestedJsonFilter<$PrismaModel> -} - -export type IntNullableWithAggregatesFilter<$PrismaModel = never> = { - equals?: number | Prisma.IntFieldRefInput<$PrismaModel> | null - in?: number[] | null - notIn?: number[] | null - lt?: number | Prisma.IntFieldRefInput<$PrismaModel> - lte?: number | Prisma.IntFieldRefInput<$PrismaModel> - gt?: number | Prisma.IntFieldRefInput<$PrismaModel> - gte?: number | Prisma.IntFieldRefInput<$PrismaModel> - not?: Prisma.NestedIntNullableWithAggregatesFilter<$PrismaModel> | number | null - _count?: Prisma.NestedIntNullableFilter<$PrismaModel> - _avg?: Prisma.NestedFloatNullableFilter<$PrismaModel> - _sum?: Prisma.NestedIntNullableFilter<$PrismaModel> - _min?: Prisma.NestedIntNullableFilter<$PrismaModel> - _max?: Prisma.NestedIntNullableFilter<$PrismaModel> -} - -export type NestedStringFilter<$PrismaModel = never> = { - equals?: string | Prisma.StringFieldRefInput<$PrismaModel> - in?: string[] - notIn?: string[] - lt?: string | Prisma.StringFieldRefInput<$PrismaModel> - lte?: string | Prisma.StringFieldRefInput<$PrismaModel> - gt?: string | Prisma.StringFieldRefInput<$PrismaModel> - gte?: string | Prisma.StringFieldRefInput<$PrismaModel> - contains?: string | Prisma.StringFieldRefInput<$PrismaModel> - startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> - endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> - not?: Prisma.NestedStringFilter<$PrismaModel> | string -} - -export type NestedDateTimeFilter<$PrismaModel = never> = { - equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> - in?: Date[] | string[] - notIn?: Date[] | string[] - lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> - lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> - gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> - gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> - not?: Prisma.NestedDateTimeFilter<$PrismaModel> | Date | string -} - -export type NestedStringNullableFilter<$PrismaModel = never> = { - equals?: string | Prisma.StringFieldRefInput<$PrismaModel> | null - in?: string[] | null - notIn?: string[] | null - lt?: string | Prisma.StringFieldRefInput<$PrismaModel> - lte?: string | Prisma.StringFieldRefInput<$PrismaModel> - gt?: string | Prisma.StringFieldRefInput<$PrismaModel> - gte?: string | Prisma.StringFieldRefInput<$PrismaModel> - contains?: string | Prisma.StringFieldRefInput<$PrismaModel> - startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> - endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> - not?: Prisma.NestedStringNullableFilter<$PrismaModel> | string | null -} - -export type NestedStringWithAggregatesFilter<$PrismaModel = never> = { - equals?: string | Prisma.StringFieldRefInput<$PrismaModel> - in?: string[] - notIn?: string[] - lt?: string | Prisma.StringFieldRefInput<$PrismaModel> - lte?: string | Prisma.StringFieldRefInput<$PrismaModel> - gt?: string | Prisma.StringFieldRefInput<$PrismaModel> - gte?: string | Prisma.StringFieldRefInput<$PrismaModel> - contains?: string | Prisma.StringFieldRefInput<$PrismaModel> - startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> - endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> - not?: Prisma.NestedStringWithAggregatesFilter<$PrismaModel> | string - _count?: Prisma.NestedIntFilter<$PrismaModel> - _min?: Prisma.NestedStringFilter<$PrismaModel> - _max?: Prisma.NestedStringFilter<$PrismaModel> -} - -export type NestedIntFilter<$PrismaModel = never> = { - equals?: number | Prisma.IntFieldRefInput<$PrismaModel> - in?: number[] - notIn?: number[] - lt?: number | Prisma.IntFieldRefInput<$PrismaModel> - lte?: number | Prisma.IntFieldRefInput<$PrismaModel> - gt?: number | Prisma.IntFieldRefInput<$PrismaModel> - gte?: number | Prisma.IntFieldRefInput<$PrismaModel> - not?: Prisma.NestedIntFilter<$PrismaModel> | number -} - -export type NestedDateTimeWithAggregatesFilter<$PrismaModel = never> = { - equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> - in?: Date[] | string[] - notIn?: Date[] | string[] - lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> - lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> - gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> - gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> - not?: Prisma.NestedDateTimeWithAggregatesFilter<$PrismaModel> | Date | string - _count?: Prisma.NestedIntFilter<$PrismaModel> - _min?: Prisma.NestedDateTimeFilter<$PrismaModel> - _max?: Prisma.NestedDateTimeFilter<$PrismaModel> -} - -export type NestedStringNullableWithAggregatesFilter<$PrismaModel = never> = { - equals?: string | Prisma.StringFieldRefInput<$PrismaModel> | null - in?: string[] | null - notIn?: string[] | null - lt?: string | Prisma.StringFieldRefInput<$PrismaModel> - lte?: string | Prisma.StringFieldRefInput<$PrismaModel> - gt?: string | Prisma.StringFieldRefInput<$PrismaModel> - gte?: string | Prisma.StringFieldRefInput<$PrismaModel> - contains?: string | Prisma.StringFieldRefInput<$PrismaModel> - startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> - endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> - not?: Prisma.NestedStringNullableWithAggregatesFilter<$PrismaModel> | string | null - _count?: Prisma.NestedIntNullableFilter<$PrismaModel> - _min?: Prisma.NestedStringNullableFilter<$PrismaModel> - _max?: Prisma.NestedStringNullableFilter<$PrismaModel> -} - -export type NestedIntNullableFilter<$PrismaModel = never> = { - equals?: number | Prisma.IntFieldRefInput<$PrismaModel> | null - in?: number[] | null - notIn?: number[] | null - lt?: number | Prisma.IntFieldRefInput<$PrismaModel> - lte?: number | Prisma.IntFieldRefInput<$PrismaModel> - gt?: number | Prisma.IntFieldRefInput<$PrismaModel> - gte?: number | Prisma.IntFieldRefInput<$PrismaModel> - not?: Prisma.NestedIntNullableFilter<$PrismaModel> | number | null -} - -export type NestedEnumMessageRoleFilter<$PrismaModel = never> = { - equals?: $Enums.MessageRole | Prisma.EnumMessageRoleFieldRefInput<$PrismaModel> - in?: $Enums.MessageRole[] - notIn?: $Enums.MessageRole[] - not?: Prisma.NestedEnumMessageRoleFilter<$PrismaModel> | $Enums.MessageRole -} - -export type NestedEnumMessageRoleWithAggregatesFilter<$PrismaModel = never> = { - equals?: $Enums.MessageRole | Prisma.EnumMessageRoleFieldRefInput<$PrismaModel> - in?: $Enums.MessageRole[] - notIn?: $Enums.MessageRole[] - not?: Prisma.NestedEnumMessageRoleWithAggregatesFilter<$PrismaModel> | $Enums.MessageRole - _count?: Prisma.NestedIntFilter<$PrismaModel> - _min?: Prisma.NestedEnumMessageRoleFilter<$PrismaModel> - _max?: Prisma.NestedEnumMessageRoleFilter<$PrismaModel> -} - -export type NestedJsonNullableFilter<$PrismaModel = never> = -| Prisma.PatchUndefined< - Prisma.Either>, Exclude>, 'path'>>, - Required> - > -| Prisma.OptionalFlat>, 'path'>> - -export type NestedJsonNullableFilterBase<$PrismaModel = never> = { - equals?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | Prisma.JsonNullValueFilter - path?: string - mode?: Prisma.QueryMode | Prisma.EnumQueryModeFieldRefInput<$PrismaModel> - string_contains?: string | Prisma.StringFieldRefInput<$PrismaModel> - string_starts_with?: string | Prisma.StringFieldRefInput<$PrismaModel> - string_ends_with?: string | Prisma.StringFieldRefInput<$PrismaModel> - array_starts_with?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | null - array_ends_with?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | null - not?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | Prisma.JsonNullValueFilter -} - -export type NestedEnumProviderFilter<$PrismaModel = never> = { - equals?: $Enums.Provider | Prisma.EnumProviderFieldRefInput<$PrismaModel> - in?: $Enums.Provider[] - notIn?: $Enums.Provider[] - not?: Prisma.NestedEnumProviderFilter<$PrismaModel> | $Enums.Provider -} - -export type NestedEnumProviderWithAggregatesFilter<$PrismaModel = never> = { - equals?: $Enums.Provider | Prisma.EnumProviderFieldRefInput<$PrismaModel> - in?: $Enums.Provider[] - notIn?: $Enums.Provider[] - not?: Prisma.NestedEnumProviderWithAggregatesFilter<$PrismaModel> | $Enums.Provider - _count?: Prisma.NestedIntFilter<$PrismaModel> - _min?: Prisma.NestedEnumProviderFilter<$PrismaModel> - _max?: Prisma.NestedEnumProviderFilter<$PrismaModel> -} - -export type NestedJsonFilter<$PrismaModel = never> = -| Prisma.PatchUndefined< - Prisma.Either>, Exclude>, 'path'>>, - Required> - > -| Prisma.OptionalFlat>, 'path'>> - -export type NestedJsonFilterBase<$PrismaModel = never> = { - equals?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | Prisma.JsonNullValueFilter - path?: string - mode?: Prisma.QueryMode | Prisma.EnumQueryModeFieldRefInput<$PrismaModel> - string_contains?: string | Prisma.StringFieldRefInput<$PrismaModel> - string_starts_with?: string | Prisma.StringFieldRefInput<$PrismaModel> - string_ends_with?: string | Prisma.StringFieldRefInput<$PrismaModel> - array_starts_with?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | null - array_ends_with?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | null - not?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | Prisma.JsonNullValueFilter -} - -export type NestedIntNullableWithAggregatesFilter<$PrismaModel = never> = { - equals?: number | Prisma.IntFieldRefInput<$PrismaModel> | null - in?: number[] | null - notIn?: number[] | null - lt?: number | Prisma.IntFieldRefInput<$PrismaModel> - lte?: number | Prisma.IntFieldRefInput<$PrismaModel> - gt?: number | Prisma.IntFieldRefInput<$PrismaModel> - gte?: number | Prisma.IntFieldRefInput<$PrismaModel> - not?: Prisma.NestedIntNullableWithAggregatesFilter<$PrismaModel> | number | null - _count?: Prisma.NestedIntNullableFilter<$PrismaModel> - _avg?: Prisma.NestedFloatNullableFilter<$PrismaModel> - _sum?: Prisma.NestedIntNullableFilter<$PrismaModel> - _min?: Prisma.NestedIntNullableFilter<$PrismaModel> - _max?: Prisma.NestedIntNullableFilter<$PrismaModel> -} - -export type NestedFloatNullableFilter<$PrismaModel = never> = { - equals?: number | Prisma.FloatFieldRefInput<$PrismaModel> | null - in?: number[] | null - notIn?: number[] | null - lt?: number | Prisma.FloatFieldRefInput<$PrismaModel> - lte?: number | Prisma.FloatFieldRefInput<$PrismaModel> - gt?: number | Prisma.FloatFieldRefInput<$PrismaModel> - gte?: number | Prisma.FloatFieldRefInput<$PrismaModel> - not?: Prisma.NestedFloatNullableFilter<$PrismaModel> | number | null -} - - diff --git a/generated/prisma/enums.ts b/generated/prisma/enums.ts deleted file mode 100644 index 67c8c7f..0000000 --- a/generated/prisma/enums.ts +++ /dev/null @@ -1,28 +0,0 @@ - -/* !!! This is code generated by Prisma. Do not edit directly. !!! */ -/* eslint-disable */ -// biome-ignore-all lint: generated file -// @ts-nocheck -/* -* This file exports all enum related types from the schema. -* -* 🟢 You can import this file directly. -*/ - -export const Provider = { - openai: 'openai', - anthropic: 'anthropic', - xai: 'xai' -} as const - -export type Provider = (typeof Provider)[keyof typeof Provider] - - -export const MessageRole = { - system: 'system', - user: 'user', - assistant: 'assistant', - tool: 'tool' -} as const - -export type MessageRole = (typeof MessageRole)[keyof typeof MessageRole] diff --git a/generated/prisma/internal/class.ts b/generated/prisma/internal/class.ts deleted file mode 100644 index be4242c..0000000 --- a/generated/prisma/internal/class.ts +++ /dev/null @@ -1,222 +0,0 @@ - -/* !!! 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 { - 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 = - 'log' extends keyof ClientOptions ? ClientOptions['log'] extends Array ? Prisma.GetEvents : 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 = LogOptions, - 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 ): PrismaClient -} - -/** - * ## 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['other'] } - - $on(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent) => void): PrismaClient; - - /** - * Connect with the database - */ - $connect(): runtime.Types.Utils.JsPromise; - - /** - * Disconnect from the database - */ - $disconnect(): runtime.Types.Utils.JsPromise; - -/** - * 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(query: TemplateStringsArray | Prisma.Sql, ...values: any[]): Prisma.PrismaPromise; - - /** - * 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(query: string, ...values: any[]): Prisma.PrismaPromise; - - /** - * 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(query: TemplateStringsArray | Prisma.Sql, ...values: any[]): Prisma.PrismaPromise; - - /** - * 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(query: string, ...values: any[]): Prisma.PrismaPromise; - - - /** - * 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

[]>(arg: [...P], options?: { isolationLevel?: Prisma.TransactionIsolationLevel }): runtime.Types.Utils.JsPromise> - - $transaction(fn: (prisma: Omit) => runtime.Types.Utils.JsPromise, options?: { maxWait?: number, timeout?: number, isolationLevel?: Prisma.TransactionIsolationLevel }): runtime.Types.Utils.JsPromise - - $extends: runtime.Types.Extensions.ExtendsHook<"extends", Prisma.TypeMapCb, ExtArgs, runtime.Types.Utils.Call, { - 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; - - /** - * `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; - - /** - * `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; - - /** - * `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; -} - -export function getPrismaClientClass(): PrismaClientConstructor { - return runtime.getPrismaClient(config) as unknown as PrismaClientConstructor -} diff --git a/generated/prisma/internal/prismaNamespace.ts b/generated/prisma/internal/prismaNamespace.ts deleted file mode 100644 index da797e2..0000000 --- a/generated/prisma/internal/prismaNamespace.ts +++ /dev/null @@ -1,1064 +0,0 @@ - -/* !!! 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! 🛑 - * - * All exports from this file are wrapped under a `Prisma` namespace object in the client.ts file. - * While this enables partial backward compatibility, it is not part of the stable public API. - * - * If you are looking for your Models, Enums, and Input Types, please import them from the respective - * model files in the `model` directory! - */ - -import * as runtime from "@prisma/client/runtime/client" -import type * as Prisma from "../models.js" -import { type PrismaClient } from "./class.js" - -export type * from '../models.js' - -export type DMMF = typeof runtime.DMMF - -export type PrismaPromise = runtime.Types.Public.PrismaPromise - -/** - * Prisma Errors - */ - -export const PrismaClientKnownRequestError = runtime.PrismaClientKnownRequestError -export type PrismaClientKnownRequestError = runtime.PrismaClientKnownRequestError - -export const PrismaClientUnknownRequestError = runtime.PrismaClientUnknownRequestError -export type PrismaClientUnknownRequestError = runtime.PrismaClientUnknownRequestError - -export const PrismaClientRustPanicError = runtime.PrismaClientRustPanicError -export type PrismaClientRustPanicError = runtime.PrismaClientRustPanicError - -export const PrismaClientInitializationError = runtime.PrismaClientInitializationError -export type PrismaClientInitializationError = runtime.PrismaClientInitializationError - -export const PrismaClientValidationError = runtime.PrismaClientValidationError -export type PrismaClientValidationError = runtime.PrismaClientValidationError - -/** - * Re-export of sql-template-tag - */ -export const sql = runtime.sqltag -export const empty = runtime.empty -export const join = runtime.join -export const raw = runtime.raw -export const Sql = runtime.Sql -export type Sql = runtime.Sql - - - -/** - * Decimal.js - */ -export const Decimal = runtime.Decimal -export type Decimal = runtime.Decimal - -export type DecimalJsLike = runtime.DecimalJsLike - -/** -* Extensions -*/ -export type Extension = runtime.Types.Extensions.UserArgs -export const getExtensionContext = runtime.Extensions.getExtensionContext -export type Args = runtime.Types.Public.Args -export type Payload = runtime.Types.Public.Payload -export type Result = runtime.Types.Public.Result -export type Exact = runtime.Types.Public.Exact - -export type PrismaVersion = { - client: string - engine: string -} - -/** - * Prisma Client JS version: 7.3.0 - * Query Engine version: 9d6ad21cbbceab97458517b147a6a09ff43aa735 - */ -export const prismaVersion: PrismaVersion = { - client: "7.3.0", - engine: "9d6ad21cbbceab97458517b147a6a09ff43aa735" -} - -/** - * Utility Types - */ - -export type Bytes = runtime.Bytes -export type JsonObject = runtime.JsonObject -export type JsonArray = runtime.JsonArray -export type JsonValue = runtime.JsonValue -export type InputJsonObject = runtime.InputJsonObject -export type InputJsonArray = runtime.InputJsonArray -export type InputJsonValue = runtime.InputJsonValue - - -export const NullTypes = { - DbNull: runtime.NullTypes.DbNull as (new (secret: never) => typeof runtime.DbNull), - JsonNull: runtime.NullTypes.JsonNull as (new (secret: never) => typeof runtime.JsonNull), - AnyNull: runtime.NullTypes.AnyNull as (new (secret: never) => typeof runtime.AnyNull), -} -/** - * Helper for filtering JSON entries that have `null` on the database (empty on the db) - * - * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field - */ -export const DbNull = runtime.DbNull - -/** - * Helper for filtering JSON entries that have JSON `null` values (not empty on the db) - * - * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field - */ -export const JsonNull = runtime.JsonNull - -/** - * Helper for filtering JSON entries that are `Prisma.DbNull` or `Prisma.JsonNull` - * - * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field - */ -export const AnyNull = runtime.AnyNull - - -type SelectAndInclude = { - select: any - include: any -} - -type SelectAndOmit = { - select: any - omit: any -} - -/** - * From T, pick a set of properties whose keys are in the union K - */ -type Prisma__Pick = { - [P in K]: T[P]; -}; - -export type Enumerable = T | Array; - -/** - * Subset - * @desc From `T` pick properties that exist in `U`. Simple version of Intersection - */ -export type Subset = { - [key in keyof T]: key extends keyof U ? T[key] : never; -}; - -/** - * SelectSubset - * @desc From `T` pick properties that exist in `U`. Simple version of Intersection. - * Additionally, it validates, if both select and include are present. If the case, it errors. - */ -export type SelectSubset = { - [key in keyof T]: key extends keyof U ? T[key] : never -} & - (T extends SelectAndInclude - ? 'Please either choose `select` or `include`.' - : T extends SelectAndOmit - ? 'Please either choose `select` or `omit`.' - : {}) - -/** - * Subset + Intersection - * @desc From `T` pick properties that exist in `U` and intersect `K` - */ -export type SubsetIntersection = { - [key in keyof T]: key extends keyof U ? T[key] : never -} & - K - -type Without = { [P in Exclude]?: never }; - -/** - * XOR is needed to have a real mutually exclusive union type - * https://stackoverflow.com/questions/42123407/does-typescript-support-mutually-exclusive-types - */ -export type XOR = - T extends object ? - U extends object ? - (Without & U) | (Without & T) - : U : T - - -/** - * Is T a Record? - */ -type IsObject = T extends Array -? False -: T extends Date -? False -: T extends Uint8Array -? False -: T extends BigInt -? False -: T extends object -? True -: False - - -/** - * If it's T[], return T - */ -export type UnEnumerate = T extends Array ? U : T - -/** - * From ts-toolbelt - */ - -type __Either = Omit & - { - // Merge all but K - [P in K]: Prisma__Pick // With K possibilities - }[K] - -type EitherStrict = Strict<__Either> - -type EitherLoose = ComputeRaw<__Either> - -type _Either< - O extends object, - K extends Key, - strict extends Boolean -> = { - 1: EitherStrict - 0: EitherLoose -}[strict] - -export type Either< - O extends object, - K extends Key, - strict extends Boolean = 1 -> = O extends unknown ? _Either : never - -export type Union = any - -export type PatchUndefined = { - [K in keyof O]: O[K] extends undefined ? At : O[K] -} & {} - -/** Helper Types for "Merge" **/ -export type IntersectOf = ( - U extends unknown ? (k: U) => void : never -) extends (k: infer I) => void - ? I - : never - -export type Overwrite = { - [K in keyof O]: K extends keyof O1 ? O1[K] : O[K]; -} & {}; - -type _Merge = IntersectOf; -}>>; - -type Key = string | number | symbol; -type AtStrict = O[K & keyof O]; -type AtLoose = O extends unknown ? AtStrict : never; -export type At = { - 1: AtStrict; - 0: AtLoose; -}[strict]; - -export type ComputeRaw = A extends Function ? A : { - [K in keyof A]: A[K]; -} & {}; - -export type OptionalFlat = { - [K in keyof O]?: O[K]; -} & {}; - -type _Record = { - [P in K]: T; -}; - -// cause typescript not to expand types and preserve names -type NoExpand = T extends unknown ? T : never; - -// this type assumes the passed object is entirely optional -export type AtLeast = NoExpand< - O extends unknown - ? | (K extends keyof O ? { [P in K]: O[P] } & O : O) - | {[P in keyof O as P extends K ? P : never]-?: O[P]} & O - : never>; - -type _Strict = U extends unknown ? U & OptionalFlat<_Record, keyof U>, never>> : never; - -export type Strict = ComputeRaw<_Strict>; -/** End Helper Types for "Merge" **/ - -export type Merge = ComputeRaw<_Merge>>; - -export type Boolean = True | False - -export type True = 1 - -export type False = 0 - -export type Not = { - 0: 1 - 1: 0 -}[B] - -export type Extends = [A1] extends [never] - ? 0 // anything `never` is false - : A1 extends A2 - ? 1 - : 0 - -export type Has = Not< - Extends, U1> -> - -export type Or = { - 0: { - 0: 0 - 1: 1 - } - 1: { - 0: 1 - 1: 1 - } -}[B1][B2] - -export type Keys = U extends unknown ? keyof U : never - -export type GetScalarType = O extends object ? { - [P in keyof T]: P extends keyof O - ? O[P] - : never -} : never - -type FieldPaths< - T, - U = Omit -> = IsObject extends True ? U : T - -export type GetHavingFields = { - [K in keyof T]: Or< - Or, Extends<'AND', K>>, - Extends<'NOT', K> - > extends True - ? // infer is only needed to not hit TS limit - // based on the brilliant idea of Pierre-Antoine Mills - // https://github.com/microsoft/TypeScript/issues/30188#issuecomment-478938437 - T[K] extends infer TK - ? GetHavingFields extends object ? Merge> : never> - : never - : {} extends FieldPaths - ? never - : K -}[keyof T] - -/** - * Convert tuple to union - */ -type _TupleToUnion = T extends (infer E)[] ? E : never -type TupleToUnion = _TupleToUnion -export type MaybeTupleToUnion = T extends any[] ? TupleToUnion : T - -/** - * Like `Pick`, but additionally can also accept an array of keys - */ -export type PickEnumerable | keyof T> = Prisma__Pick> - -/** - * Exclude all keys with underscores - */ -export type ExcludeUnderscoreKeys = T extends `_${string}` ? never : T - - -export type FieldRef = runtime.FieldRef - -type FieldRefInputType = Model extends never ? never : FieldRef - - -export const ModelName = { - User: 'User', - Chat: 'Chat', - Message: 'Message', - LlmCall: 'LlmCall' -} as const - -export type ModelName = (typeof ModelName)[keyof typeof ModelName] - - - -export interface TypeMapCb extends runtime.Types.Utils.Fn<{extArgs: runtime.Types.Extensions.InternalArgs }, runtime.Types.Utils.Record> { - returns: TypeMap -} - -export type TypeMap = { - globalOmitOptions: { - omit: GlobalOmitOptions - } - meta: { - modelProps: "user" | "chat" | "message" | "llmCall" - txIsolationLevel: TransactionIsolationLevel - } - model: { - User: { - payload: Prisma.$UserPayload - fields: Prisma.UserFieldRefs - operations: { - findUnique: { - args: Prisma.UserFindUniqueArgs - result: runtime.Types.Utils.PayloadToResult | null - } - findUniqueOrThrow: { - args: Prisma.UserFindUniqueOrThrowArgs - result: runtime.Types.Utils.PayloadToResult - } - findFirst: { - args: Prisma.UserFindFirstArgs - result: runtime.Types.Utils.PayloadToResult | null - } - findFirstOrThrow: { - args: Prisma.UserFindFirstOrThrowArgs - result: runtime.Types.Utils.PayloadToResult - } - findMany: { - args: Prisma.UserFindManyArgs - result: runtime.Types.Utils.PayloadToResult[] - } - create: { - args: Prisma.UserCreateArgs - result: runtime.Types.Utils.PayloadToResult - } - createMany: { - args: Prisma.UserCreateManyArgs - result: BatchPayload - } - createManyAndReturn: { - args: Prisma.UserCreateManyAndReturnArgs - result: runtime.Types.Utils.PayloadToResult[] - } - delete: { - args: Prisma.UserDeleteArgs - result: runtime.Types.Utils.PayloadToResult - } - update: { - args: Prisma.UserUpdateArgs - result: runtime.Types.Utils.PayloadToResult - } - deleteMany: { - args: Prisma.UserDeleteManyArgs - result: BatchPayload - } - updateMany: { - args: Prisma.UserUpdateManyArgs - result: BatchPayload - } - updateManyAndReturn: { - args: Prisma.UserUpdateManyAndReturnArgs - result: runtime.Types.Utils.PayloadToResult[] - } - upsert: { - args: Prisma.UserUpsertArgs - result: runtime.Types.Utils.PayloadToResult - } - aggregate: { - args: Prisma.UserAggregateArgs - result: runtime.Types.Utils.Optional - } - groupBy: { - args: Prisma.UserGroupByArgs - result: runtime.Types.Utils.Optional[] - } - count: { - args: Prisma.UserCountArgs - result: runtime.Types.Utils.Optional | number - } - } - } - Chat: { - payload: Prisma.$ChatPayload - fields: Prisma.ChatFieldRefs - operations: { - findUnique: { - args: Prisma.ChatFindUniqueArgs - result: runtime.Types.Utils.PayloadToResult | null - } - findUniqueOrThrow: { - args: Prisma.ChatFindUniqueOrThrowArgs - result: runtime.Types.Utils.PayloadToResult - } - findFirst: { - args: Prisma.ChatFindFirstArgs - result: runtime.Types.Utils.PayloadToResult | null - } - findFirstOrThrow: { - args: Prisma.ChatFindFirstOrThrowArgs - result: runtime.Types.Utils.PayloadToResult - } - findMany: { - args: Prisma.ChatFindManyArgs - result: runtime.Types.Utils.PayloadToResult[] - } - create: { - args: Prisma.ChatCreateArgs - result: runtime.Types.Utils.PayloadToResult - } - createMany: { - args: Prisma.ChatCreateManyArgs - result: BatchPayload - } - createManyAndReturn: { - args: Prisma.ChatCreateManyAndReturnArgs - result: runtime.Types.Utils.PayloadToResult[] - } - delete: { - args: Prisma.ChatDeleteArgs - result: runtime.Types.Utils.PayloadToResult - } - update: { - args: Prisma.ChatUpdateArgs - result: runtime.Types.Utils.PayloadToResult - } - deleteMany: { - args: Prisma.ChatDeleteManyArgs - result: BatchPayload - } - updateMany: { - args: Prisma.ChatUpdateManyArgs - result: BatchPayload - } - updateManyAndReturn: { - args: Prisma.ChatUpdateManyAndReturnArgs - result: runtime.Types.Utils.PayloadToResult[] - } - upsert: { - args: Prisma.ChatUpsertArgs - result: runtime.Types.Utils.PayloadToResult - } - aggregate: { - args: Prisma.ChatAggregateArgs - result: runtime.Types.Utils.Optional - } - groupBy: { - args: Prisma.ChatGroupByArgs - result: runtime.Types.Utils.Optional[] - } - count: { - args: Prisma.ChatCountArgs - result: runtime.Types.Utils.Optional | number - } - } - } - Message: { - payload: Prisma.$MessagePayload - fields: Prisma.MessageFieldRefs - operations: { - findUnique: { - args: Prisma.MessageFindUniqueArgs - result: runtime.Types.Utils.PayloadToResult | null - } - findUniqueOrThrow: { - args: Prisma.MessageFindUniqueOrThrowArgs - result: runtime.Types.Utils.PayloadToResult - } - findFirst: { - args: Prisma.MessageFindFirstArgs - result: runtime.Types.Utils.PayloadToResult | null - } - findFirstOrThrow: { - args: Prisma.MessageFindFirstOrThrowArgs - result: runtime.Types.Utils.PayloadToResult - } - findMany: { - args: Prisma.MessageFindManyArgs - result: runtime.Types.Utils.PayloadToResult[] - } - create: { - args: Prisma.MessageCreateArgs - result: runtime.Types.Utils.PayloadToResult - } - createMany: { - args: Prisma.MessageCreateManyArgs - result: BatchPayload - } - createManyAndReturn: { - args: Prisma.MessageCreateManyAndReturnArgs - result: runtime.Types.Utils.PayloadToResult[] - } - delete: { - args: Prisma.MessageDeleteArgs - result: runtime.Types.Utils.PayloadToResult - } - update: { - args: Prisma.MessageUpdateArgs - result: runtime.Types.Utils.PayloadToResult - } - deleteMany: { - args: Prisma.MessageDeleteManyArgs - result: BatchPayload - } - updateMany: { - args: Prisma.MessageUpdateManyArgs - result: BatchPayload - } - updateManyAndReturn: { - args: Prisma.MessageUpdateManyAndReturnArgs - result: runtime.Types.Utils.PayloadToResult[] - } - upsert: { - args: Prisma.MessageUpsertArgs - result: runtime.Types.Utils.PayloadToResult - } - aggregate: { - args: Prisma.MessageAggregateArgs - result: runtime.Types.Utils.Optional - } - groupBy: { - args: Prisma.MessageGroupByArgs - result: runtime.Types.Utils.Optional[] - } - count: { - args: Prisma.MessageCountArgs - result: runtime.Types.Utils.Optional | number - } - } - } - LlmCall: { - payload: Prisma.$LlmCallPayload - fields: Prisma.LlmCallFieldRefs - operations: { - findUnique: { - args: Prisma.LlmCallFindUniqueArgs - result: runtime.Types.Utils.PayloadToResult | null - } - findUniqueOrThrow: { - args: Prisma.LlmCallFindUniqueOrThrowArgs - result: runtime.Types.Utils.PayloadToResult - } - findFirst: { - args: Prisma.LlmCallFindFirstArgs - result: runtime.Types.Utils.PayloadToResult | null - } - findFirstOrThrow: { - args: Prisma.LlmCallFindFirstOrThrowArgs - result: runtime.Types.Utils.PayloadToResult - } - findMany: { - args: Prisma.LlmCallFindManyArgs - result: runtime.Types.Utils.PayloadToResult[] - } - create: { - args: Prisma.LlmCallCreateArgs - result: runtime.Types.Utils.PayloadToResult - } - createMany: { - args: Prisma.LlmCallCreateManyArgs - result: BatchPayload - } - createManyAndReturn: { - args: Prisma.LlmCallCreateManyAndReturnArgs - result: runtime.Types.Utils.PayloadToResult[] - } - delete: { - args: Prisma.LlmCallDeleteArgs - result: runtime.Types.Utils.PayloadToResult - } - update: { - args: Prisma.LlmCallUpdateArgs - result: runtime.Types.Utils.PayloadToResult - } - deleteMany: { - args: Prisma.LlmCallDeleteManyArgs - result: BatchPayload - } - updateMany: { - args: Prisma.LlmCallUpdateManyArgs - result: BatchPayload - } - updateManyAndReturn: { - args: Prisma.LlmCallUpdateManyAndReturnArgs - result: runtime.Types.Utils.PayloadToResult[] - } - upsert: { - args: Prisma.LlmCallUpsertArgs - result: runtime.Types.Utils.PayloadToResult - } - aggregate: { - args: Prisma.LlmCallAggregateArgs - result: runtime.Types.Utils.Optional - } - groupBy: { - args: Prisma.LlmCallGroupByArgs - result: runtime.Types.Utils.Optional[] - } - count: { - args: Prisma.LlmCallCountArgs - result: runtime.Types.Utils.Optional | number - } - } - } - } -} & { - other: { - payload: any - operations: { - $executeRaw: { - args: [query: TemplateStringsArray | Sql, ...values: any[]], - result: any - } - $executeRawUnsafe: { - args: [query: string, ...values: any[]], - result: any - } - $queryRaw: { - args: [query: TemplateStringsArray | Sql, ...values: any[]], - result: any - } - $queryRawUnsafe: { - args: [query: string, ...values: any[]], - result: any - } - } - } -} - -/** - * Enums - */ - -export const TransactionIsolationLevel = runtime.makeStrictEnum({ - Serializable: 'Serializable' -} as const) - -export type TransactionIsolationLevel = (typeof TransactionIsolationLevel)[keyof typeof TransactionIsolationLevel] - - -export const UserScalarFieldEnum = { - id: 'id', - createdAt: 'createdAt', - updatedAt: 'updatedAt', - handle: 'handle' -} as const - -export type UserScalarFieldEnum = (typeof UserScalarFieldEnum)[keyof typeof UserScalarFieldEnum] - - -export const ChatScalarFieldEnum = { - id: 'id', - createdAt: 'createdAt', - updatedAt: 'updatedAt', - title: 'title', - userId: 'userId' -} as const - -export type ChatScalarFieldEnum = (typeof ChatScalarFieldEnum)[keyof typeof ChatScalarFieldEnum] - - -export const MessageScalarFieldEnum = { - id: 'id', - createdAt: 'createdAt', - chatId: 'chatId', - role: 'role', - content: 'content', - name: 'name', - metadata: 'metadata' -} as const - -export type MessageScalarFieldEnum = (typeof MessageScalarFieldEnum)[keyof typeof MessageScalarFieldEnum] - - -export const LlmCallScalarFieldEnum = { - id: 'id', - createdAt: 'createdAt', - chatId: 'chatId', - provider: 'provider', - model: 'model', - request: 'request', - response: 'response', - inputTokens: 'inputTokens', - outputTokens: 'outputTokens', - totalTokens: 'totalTokens', - latencyMs: 'latencyMs', - error: 'error' -} as const - -export type LlmCallScalarFieldEnum = (typeof LlmCallScalarFieldEnum)[keyof typeof LlmCallScalarFieldEnum] - - -export const SortOrder = { - asc: 'asc', - desc: 'desc' -} as const - -export type SortOrder = (typeof SortOrder)[keyof typeof SortOrder] - - -export const NullableJsonNullValueInput = { - DbNull: DbNull, - JsonNull: JsonNull -} as const - -export type NullableJsonNullValueInput = (typeof NullableJsonNullValueInput)[keyof typeof NullableJsonNullValueInput] - - -export const JsonNullValueInput = { - JsonNull: JsonNull -} as const - -export type JsonNullValueInput = (typeof JsonNullValueInput)[keyof typeof JsonNullValueInput] - - -export const NullsOrder = { - first: 'first', - last: 'last' -} as const - -export type NullsOrder = (typeof NullsOrder)[keyof typeof NullsOrder] - - -export const JsonNullValueFilter = { - DbNull: DbNull, - JsonNull: JsonNull, - AnyNull: AnyNull -} as const - -export type JsonNullValueFilter = (typeof JsonNullValueFilter)[keyof typeof JsonNullValueFilter] - - -export const QueryMode = { - default: 'default', - insensitive: 'insensitive' -} as const - -export type QueryMode = (typeof QueryMode)[keyof typeof QueryMode] - - - -/** - * Field references - */ - - -/** - * Reference to a field of type 'String' - */ -export type StringFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'String'> - - - -/** - * Reference to a field of type 'DateTime' - */ -export type DateTimeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'DateTime'> - - - -/** - * Reference to a field of type 'MessageRole' - */ -export type EnumMessageRoleFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'MessageRole'> - - - -/** - * Reference to a field of type 'Json' - */ -export type JsonFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'Json'> - - - -/** - * Reference to a field of type 'QueryMode' - */ -export type EnumQueryModeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'QueryMode'> - - - -/** - * Reference to a field of type 'Provider' - */ -export type EnumProviderFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'Provider'> - - - -/** - * Reference to a field of type 'Int' - */ -export type IntFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'Int'> - - - -/** - * Reference to a field of type 'Float' - */ -export type FloatFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'Float'> - - -/** - * Batch Payload for updateMany & deleteMany & createMany - */ -export type BatchPayload = { - count: number -} - -export const defineExtension = runtime.Extensions.defineExtension as unknown as runtime.Types.Extensions.ExtendsHook<"define", TypeMapCb, runtime.Types.Extensions.DefaultArgs> -export type DefaultPrismaClient = PrismaClient -export type ErrorFormat = 'pretty' | 'colorless' | 'minimal' -export type PrismaClientOptions = ({ - /** - * Instance of a Driver Adapter, e.g., like one provided by `@prisma/adapter-pg`. - */ - adapter: runtime.SqlDriverAdapterFactory - accelerateUrl?: never -} | { - /** - * Prisma Accelerate URL allowing the client to connect through Accelerate instead of a direct database. - */ - accelerateUrl: string - adapter?: never -}) & { - /** - * @default "colorless" - */ - errorFormat?: ErrorFormat - /** - * @example - * ``` - * // Shorthand for `emit: 'stdout'` - * log: ['query', 'info', 'warn', 'error'] - * - * // Emit as events only - * log: [ - * { emit: 'event', level: 'query' }, - * { emit: 'event', level: 'info' }, - * { emit: 'event', level: 'warn' } - * { emit: 'event', level: 'error' } - * ] - * - * / Emit as events and log to stdout - * og: [ - * { emit: 'stdout', level: 'query' }, - * { emit: 'stdout', level: 'info' }, - * { emit: 'stdout', level: 'warn' } - * { emit: 'stdout', level: 'error' } - * - * ``` - * Read more in our [docs](https://pris.ly/d/logging). - */ - log?: (LogLevel | LogDefinition)[] - /** - * The default values for transactionOptions - * maxWait ?= 2000 - * timeout ?= 5000 - */ - transactionOptions?: { - maxWait?: number - timeout?: number - isolationLevel?: TransactionIsolationLevel - } - /** - * Global configuration for omitting model fields by default. - * - * @example - * ``` - * const prisma = new PrismaClient({ - * omit: { - * user: { - * password: true - * } - * } - * }) - * ``` - */ - omit?: GlobalOmitConfig - /** - * SQL commenter plugins that add metadata to SQL queries as comments. - * Comments follow the sqlcommenter format: https://google.github.io/sqlcommenter/ - * - * @example - * ``` - * const prisma = new PrismaClient({ - * adapter, - * comments: [ - * traceContext(), - * queryInsights(), - * ], - * }) - * ``` - */ - comments?: runtime.SqlCommenterPlugin[] -} -export type GlobalOmitConfig = { - user?: Prisma.UserOmit - chat?: Prisma.ChatOmit - message?: Prisma.MessageOmit - llmCall?: Prisma.LlmCallOmit -} - -/* Types for Logging */ -export type LogLevel = 'info' | 'query' | 'warn' | 'error' -export type LogDefinition = { - level: LogLevel - emit: 'stdout' | 'event' -} - -export type CheckIsLogLevel = T extends LogLevel ? T : never; - -export type GetLogType = CheckIsLogLevel< - T extends LogDefinition ? T['level'] : T ->; - -export type GetEvents = T extends Array - ? GetLogType - : never; - -export type QueryEvent = { - timestamp: Date - query: string - params: string - duration: number - target: string -} - -export type LogEvent = { - timestamp: Date - message: string - target: string -} -/* End Types for Logging */ - - -export type PrismaAction = - | 'findUnique' - | 'findUniqueOrThrow' - | 'findMany' - | 'findFirst' - | 'findFirstOrThrow' - | 'create' - | 'createMany' - | 'createManyAndReturn' - | 'update' - | 'updateMany' - | 'updateManyAndReturn' - | 'upsert' - | 'delete' - | 'deleteMany' - | 'executeRaw' - | 'queryRaw' - | 'aggregate' - | 'count' - | 'runCommandRaw' - | 'findRaw' - | 'groupBy' - -/** - * `PrismaClient` proxy available in interactive transactions. - */ -export type TransactionClient = Omit - diff --git a/generated/prisma/internal/prismaNamespaceBrowser.ts b/generated/prisma/internal/prismaNamespaceBrowser.ts deleted file mode 100644 index e95969a..0000000 --- a/generated/prisma/internal/prismaNamespaceBrowser.ts +++ /dev/null @@ -1,171 +0,0 @@ - -/* !!! 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! 🛑 - * - * All exports from this file are wrapped under a `Prisma` namespace object in the browser.ts file. - * While this enables partial backward compatibility, it is not part of the stable public API. - * - * If you are looking for your Models, Enums, and Input Types, please import them from the respective - * model files in the `model` directory! - */ - -import * as runtime from "@prisma/client/runtime/index-browser" - -export type * from '../models.js' -export type * from './prismaNamespace.js' - -export const Decimal = runtime.Decimal - - -export const NullTypes = { - DbNull: runtime.NullTypes.DbNull as (new (secret: never) => typeof runtime.DbNull), - JsonNull: runtime.NullTypes.JsonNull as (new (secret: never) => typeof runtime.JsonNull), - AnyNull: runtime.NullTypes.AnyNull as (new (secret: never) => typeof runtime.AnyNull), -} -/** - * Helper for filtering JSON entries that have `null` on the database (empty on the db) - * - * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field - */ -export const DbNull = runtime.DbNull - -/** - * Helper for filtering JSON entries that have JSON `null` values (not empty on the db) - * - * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field - */ -export const JsonNull = runtime.JsonNull - -/** - * Helper for filtering JSON entries that are `Prisma.DbNull` or `Prisma.JsonNull` - * - * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field - */ -export const AnyNull = runtime.AnyNull - - -export const ModelName = { - User: 'User', - Chat: 'Chat', - Message: 'Message', - LlmCall: 'LlmCall' -} as const - -export type ModelName = (typeof ModelName)[keyof typeof ModelName] - -/* - * Enums - */ - -export const TransactionIsolationLevel = runtime.makeStrictEnum({ - Serializable: 'Serializable' -} as const) - -export type TransactionIsolationLevel = (typeof TransactionIsolationLevel)[keyof typeof TransactionIsolationLevel] - - -export const UserScalarFieldEnum = { - id: 'id', - createdAt: 'createdAt', - updatedAt: 'updatedAt', - handle: 'handle' -} as const - -export type UserScalarFieldEnum = (typeof UserScalarFieldEnum)[keyof typeof UserScalarFieldEnum] - - -export const ChatScalarFieldEnum = { - id: 'id', - createdAt: 'createdAt', - updatedAt: 'updatedAt', - title: 'title', - userId: 'userId' -} as const - -export type ChatScalarFieldEnum = (typeof ChatScalarFieldEnum)[keyof typeof ChatScalarFieldEnum] - - -export const MessageScalarFieldEnum = { - id: 'id', - createdAt: 'createdAt', - chatId: 'chatId', - role: 'role', - content: 'content', - name: 'name', - metadata: 'metadata' -} as const - -export type MessageScalarFieldEnum = (typeof MessageScalarFieldEnum)[keyof typeof MessageScalarFieldEnum] - - -export const LlmCallScalarFieldEnum = { - id: 'id', - createdAt: 'createdAt', - chatId: 'chatId', - provider: 'provider', - model: 'model', - request: 'request', - response: 'response', - inputTokens: 'inputTokens', - outputTokens: 'outputTokens', - totalTokens: 'totalTokens', - latencyMs: 'latencyMs', - error: 'error' -} as const - -export type LlmCallScalarFieldEnum = (typeof LlmCallScalarFieldEnum)[keyof typeof LlmCallScalarFieldEnum] - - -export const SortOrder = { - asc: 'asc', - desc: 'desc' -} as const - -export type SortOrder = (typeof SortOrder)[keyof typeof SortOrder] - - -export const NullableJsonNullValueInput = { - DbNull: DbNull, - JsonNull: JsonNull -} as const - -export type NullableJsonNullValueInput = (typeof NullableJsonNullValueInput)[keyof typeof NullableJsonNullValueInput] - - -export const JsonNullValueInput = { - JsonNull: JsonNull -} as const - -export type JsonNullValueInput = (typeof JsonNullValueInput)[keyof typeof JsonNullValueInput] - - -export const NullsOrder = { - first: 'first', - last: 'last' -} as const - -export type NullsOrder = (typeof NullsOrder)[keyof typeof NullsOrder] - - -export const JsonNullValueFilter = { - DbNull: DbNull, - JsonNull: JsonNull, - AnyNull: AnyNull -} as const - -export type JsonNullValueFilter = (typeof JsonNullValueFilter)[keyof typeof JsonNullValueFilter] - - -export const QueryMode = { - default: 'default', - insensitive: 'insensitive' -} as const - -export type QueryMode = (typeof QueryMode)[keyof typeof QueryMode] - diff --git a/generated/prisma/models.ts b/generated/prisma/models.ts deleted file mode 100644 index b6ad112..0000000 --- a/generated/prisma/models.ts +++ /dev/null @@ -1,15 +0,0 @@ - -/* !!! This is code generated by Prisma. Do not edit directly. !!! */ -/* eslint-disable */ -// biome-ignore-all lint: generated file -// @ts-nocheck -/* - * This is a barrel export file for all models and their related types. - * - * 🟢 You can import this file directly. - */ -export type * from './models/User.js' -export type * from './models/Chat.js' -export type * from './models/Message.js' -export type * from './models/LlmCall.js' -export type * from './commonInputTypes.js' \ No newline at end of file diff --git a/generated/prisma/models/Chat.ts b/generated/prisma/models/Chat.ts deleted file mode 100644 index f7bf7f3..0000000 --- a/generated/prisma/models/Chat.ts +++ /dev/null @@ -1,1611 +0,0 @@ - -/* !!! This is code generated by Prisma. Do not edit directly. !!! */ -/* eslint-disable */ -// biome-ignore-all lint: generated file -// @ts-nocheck -/* - * This file exports the `Chat` model and its related types. - * - * 🟢 You can import this file directly. - */ -import type * as runtime from "@prisma/client/runtime/client" -import type * as $Enums from "../enums.js" -import type * as Prisma from "../internal/prismaNamespace.js" - -/** - * Model Chat - * - */ -export type ChatModel = runtime.Types.Result.DefaultSelection - -export type AggregateChat = { - _count: ChatCountAggregateOutputType | null - _min: ChatMinAggregateOutputType | null - _max: ChatMaxAggregateOutputType | null -} - -export type ChatMinAggregateOutputType = { - id: string | null - createdAt: Date | null - updatedAt: Date | null - title: string | null - userId: string | null -} - -export type ChatMaxAggregateOutputType = { - id: string | null - createdAt: Date | null - updatedAt: Date | null - title: string | null - userId: string | null -} - -export type ChatCountAggregateOutputType = { - id: number - createdAt: number - updatedAt: number - title: number - userId: number - _all: number -} - - -export type ChatMinAggregateInputType = { - id?: true - createdAt?: true - updatedAt?: true - title?: true - userId?: true -} - -export type ChatMaxAggregateInputType = { - id?: true - createdAt?: true - updatedAt?: true - title?: true - userId?: true -} - -export type ChatCountAggregateInputType = { - id?: true - createdAt?: true - updatedAt?: true - title?: true - userId?: true - _all?: true -} - -export type ChatAggregateArgs = { - /** - * Filter which Chat to aggregate. - */ - where?: Prisma.ChatWhereInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} - * - * Determine the order of Chats to fetch. - */ - orderBy?: Prisma.ChatOrderByWithRelationInput | Prisma.ChatOrderByWithRelationInput[] - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} - * - * Sets the start position - */ - cursor?: Prisma.ChatWhereUniqueInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Take `±n` Chats from the position of the cursor. - */ - take?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Skip the first `n` Chats. - */ - skip?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} - * - * Count returned Chats - **/ - _count?: true | ChatCountAggregateInputType - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} - * - * Select which fields to find the minimum value - **/ - _min?: ChatMinAggregateInputType - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} - * - * Select which fields to find the maximum value - **/ - _max?: ChatMaxAggregateInputType -} - -export type GetChatAggregateType = { - [P in keyof T & keyof AggregateChat]: P extends '_count' | 'count' - ? T[P] extends true - ? number - : Prisma.GetScalarType - : Prisma.GetScalarType -} - - - - -export type ChatGroupByArgs = { - where?: Prisma.ChatWhereInput - orderBy?: Prisma.ChatOrderByWithAggregationInput | Prisma.ChatOrderByWithAggregationInput[] - by: Prisma.ChatScalarFieldEnum[] | Prisma.ChatScalarFieldEnum - having?: Prisma.ChatScalarWhereWithAggregatesInput - take?: number - skip?: number - _count?: ChatCountAggregateInputType | true - _min?: ChatMinAggregateInputType - _max?: ChatMaxAggregateInputType -} - -export type ChatGroupByOutputType = { - id: string - createdAt: Date - updatedAt: Date - title: string | null - userId: string | null - _count: ChatCountAggregateOutputType | null - _min: ChatMinAggregateOutputType | null - _max: ChatMaxAggregateOutputType | null -} - -type GetChatGroupByPayload = Prisma.PrismaPromise< - Array< - Prisma.PickEnumerable & - { - [P in ((keyof T) & (keyof ChatGroupByOutputType))]: P extends '_count' - ? T[P] extends boolean - ? number - : Prisma.GetScalarType - : Prisma.GetScalarType - } - > - > - - - -export type ChatWhereInput = { - AND?: Prisma.ChatWhereInput | Prisma.ChatWhereInput[] - OR?: Prisma.ChatWhereInput[] - NOT?: Prisma.ChatWhereInput | Prisma.ChatWhereInput[] - id?: Prisma.StringFilter<"Chat"> | string - createdAt?: Prisma.DateTimeFilter<"Chat"> | Date | string - updatedAt?: Prisma.DateTimeFilter<"Chat"> | Date | string - title?: Prisma.StringNullableFilter<"Chat"> | string | null - userId?: Prisma.StringNullableFilter<"Chat"> | string | null - user?: Prisma.XOR | null - messages?: Prisma.MessageListRelationFilter - calls?: Prisma.LlmCallListRelationFilter -} - -export type ChatOrderByWithRelationInput = { - id?: Prisma.SortOrder - createdAt?: Prisma.SortOrder - updatedAt?: Prisma.SortOrder - title?: Prisma.SortOrderInput | Prisma.SortOrder - userId?: Prisma.SortOrderInput | Prisma.SortOrder - user?: Prisma.UserOrderByWithRelationInput - messages?: Prisma.MessageOrderByRelationAggregateInput - calls?: Prisma.LlmCallOrderByRelationAggregateInput -} - -export type ChatWhereUniqueInput = Prisma.AtLeast<{ - id?: string - AND?: Prisma.ChatWhereInput | Prisma.ChatWhereInput[] - OR?: Prisma.ChatWhereInput[] - NOT?: Prisma.ChatWhereInput | Prisma.ChatWhereInput[] - createdAt?: Prisma.DateTimeFilter<"Chat"> | Date | string - updatedAt?: Prisma.DateTimeFilter<"Chat"> | Date | string - title?: Prisma.StringNullableFilter<"Chat"> | string | null - userId?: Prisma.StringNullableFilter<"Chat"> | string | null - user?: Prisma.XOR | null - messages?: Prisma.MessageListRelationFilter - calls?: Prisma.LlmCallListRelationFilter -}, "id"> - -export type ChatOrderByWithAggregationInput = { - id?: Prisma.SortOrder - createdAt?: Prisma.SortOrder - updatedAt?: Prisma.SortOrder - title?: Prisma.SortOrderInput | Prisma.SortOrder - userId?: Prisma.SortOrderInput | Prisma.SortOrder - _count?: Prisma.ChatCountOrderByAggregateInput - _max?: Prisma.ChatMaxOrderByAggregateInput - _min?: Prisma.ChatMinOrderByAggregateInput -} - -export type ChatScalarWhereWithAggregatesInput = { - AND?: Prisma.ChatScalarWhereWithAggregatesInput | Prisma.ChatScalarWhereWithAggregatesInput[] - OR?: Prisma.ChatScalarWhereWithAggregatesInput[] - NOT?: Prisma.ChatScalarWhereWithAggregatesInput | Prisma.ChatScalarWhereWithAggregatesInput[] - id?: Prisma.StringWithAggregatesFilter<"Chat"> | string - createdAt?: Prisma.DateTimeWithAggregatesFilter<"Chat"> | Date | string - updatedAt?: Prisma.DateTimeWithAggregatesFilter<"Chat"> | Date | string - title?: Prisma.StringNullableWithAggregatesFilter<"Chat"> | string | null - userId?: Prisma.StringNullableWithAggregatesFilter<"Chat"> | string | null -} - -export type ChatCreateInput = { - id?: string - createdAt?: Date | string - updatedAt?: Date | string - title?: string | null - user?: Prisma.UserCreateNestedOneWithoutChatsInput - messages?: Prisma.MessageCreateNestedManyWithoutChatInput - calls?: Prisma.LlmCallCreateNestedManyWithoutChatInput -} - -export type ChatUncheckedCreateInput = { - id?: string - createdAt?: Date | string - updatedAt?: Date | string - title?: string | null - userId?: string | null - messages?: Prisma.MessageUncheckedCreateNestedManyWithoutChatInput - calls?: Prisma.LlmCallUncheckedCreateNestedManyWithoutChatInput -} - -export type ChatUpdateInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - title?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - user?: Prisma.UserUpdateOneWithoutChatsNestedInput - messages?: Prisma.MessageUpdateManyWithoutChatNestedInput - calls?: Prisma.LlmCallUpdateManyWithoutChatNestedInput -} - -export type ChatUncheckedUpdateInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - title?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - messages?: Prisma.MessageUncheckedUpdateManyWithoutChatNestedInput - calls?: Prisma.LlmCallUncheckedUpdateManyWithoutChatNestedInput -} - -export type ChatCreateManyInput = { - id?: string - createdAt?: Date | string - updatedAt?: Date | string - title?: string | null - userId?: string | null -} - -export type ChatUpdateManyMutationInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - title?: Prisma.NullableStringFieldUpdateOperationsInput | string | null -} - -export type ChatUncheckedUpdateManyInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - title?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null -} - -export type ChatListRelationFilter = { - every?: Prisma.ChatWhereInput - some?: Prisma.ChatWhereInput - none?: Prisma.ChatWhereInput -} - -export type ChatOrderByRelationAggregateInput = { - _count?: Prisma.SortOrder -} - -export type ChatCountOrderByAggregateInput = { - id?: Prisma.SortOrder - createdAt?: Prisma.SortOrder - updatedAt?: Prisma.SortOrder - title?: Prisma.SortOrder - userId?: Prisma.SortOrder -} - -export type ChatMaxOrderByAggregateInput = { - id?: Prisma.SortOrder - createdAt?: Prisma.SortOrder - updatedAt?: Prisma.SortOrder - title?: Prisma.SortOrder - userId?: Prisma.SortOrder -} - -export type ChatMinOrderByAggregateInput = { - id?: Prisma.SortOrder - createdAt?: Prisma.SortOrder - updatedAt?: Prisma.SortOrder - title?: Prisma.SortOrder - userId?: Prisma.SortOrder -} - -export type ChatScalarRelationFilter = { - is?: Prisma.ChatWhereInput - isNot?: Prisma.ChatWhereInput -} - -export type ChatCreateNestedManyWithoutUserInput = { - create?: Prisma.XOR | Prisma.ChatCreateWithoutUserInput[] | Prisma.ChatUncheckedCreateWithoutUserInput[] - connectOrCreate?: Prisma.ChatCreateOrConnectWithoutUserInput | Prisma.ChatCreateOrConnectWithoutUserInput[] - createMany?: Prisma.ChatCreateManyUserInputEnvelope - connect?: Prisma.ChatWhereUniqueInput | Prisma.ChatWhereUniqueInput[] -} - -export type ChatUncheckedCreateNestedManyWithoutUserInput = { - create?: Prisma.XOR | Prisma.ChatCreateWithoutUserInput[] | Prisma.ChatUncheckedCreateWithoutUserInput[] - connectOrCreate?: Prisma.ChatCreateOrConnectWithoutUserInput | Prisma.ChatCreateOrConnectWithoutUserInput[] - createMany?: Prisma.ChatCreateManyUserInputEnvelope - connect?: Prisma.ChatWhereUniqueInput | Prisma.ChatWhereUniqueInput[] -} - -export type ChatUpdateManyWithoutUserNestedInput = { - create?: Prisma.XOR | Prisma.ChatCreateWithoutUserInput[] | Prisma.ChatUncheckedCreateWithoutUserInput[] - connectOrCreate?: Prisma.ChatCreateOrConnectWithoutUserInput | Prisma.ChatCreateOrConnectWithoutUserInput[] - upsert?: Prisma.ChatUpsertWithWhereUniqueWithoutUserInput | Prisma.ChatUpsertWithWhereUniqueWithoutUserInput[] - createMany?: Prisma.ChatCreateManyUserInputEnvelope - set?: Prisma.ChatWhereUniqueInput | Prisma.ChatWhereUniqueInput[] - disconnect?: Prisma.ChatWhereUniqueInput | Prisma.ChatWhereUniqueInput[] - delete?: Prisma.ChatWhereUniqueInput | Prisma.ChatWhereUniqueInput[] - connect?: Prisma.ChatWhereUniqueInput | Prisma.ChatWhereUniqueInput[] - update?: Prisma.ChatUpdateWithWhereUniqueWithoutUserInput | Prisma.ChatUpdateWithWhereUniqueWithoutUserInput[] - updateMany?: Prisma.ChatUpdateManyWithWhereWithoutUserInput | Prisma.ChatUpdateManyWithWhereWithoutUserInput[] - deleteMany?: Prisma.ChatScalarWhereInput | Prisma.ChatScalarWhereInput[] -} - -export type ChatUncheckedUpdateManyWithoutUserNestedInput = { - create?: Prisma.XOR | Prisma.ChatCreateWithoutUserInput[] | Prisma.ChatUncheckedCreateWithoutUserInput[] - connectOrCreate?: Prisma.ChatCreateOrConnectWithoutUserInput | Prisma.ChatCreateOrConnectWithoutUserInput[] - upsert?: Prisma.ChatUpsertWithWhereUniqueWithoutUserInput | Prisma.ChatUpsertWithWhereUniqueWithoutUserInput[] - createMany?: Prisma.ChatCreateManyUserInputEnvelope - set?: Prisma.ChatWhereUniqueInput | Prisma.ChatWhereUniqueInput[] - disconnect?: Prisma.ChatWhereUniqueInput | Prisma.ChatWhereUniqueInput[] - delete?: Prisma.ChatWhereUniqueInput | Prisma.ChatWhereUniqueInput[] - connect?: Prisma.ChatWhereUniqueInput | Prisma.ChatWhereUniqueInput[] - update?: Prisma.ChatUpdateWithWhereUniqueWithoutUserInput | Prisma.ChatUpdateWithWhereUniqueWithoutUserInput[] - updateMany?: Prisma.ChatUpdateManyWithWhereWithoutUserInput | Prisma.ChatUpdateManyWithWhereWithoutUserInput[] - deleteMany?: Prisma.ChatScalarWhereInput | Prisma.ChatScalarWhereInput[] -} - -export type ChatCreateNestedOneWithoutMessagesInput = { - create?: Prisma.XOR - connectOrCreate?: Prisma.ChatCreateOrConnectWithoutMessagesInput - connect?: Prisma.ChatWhereUniqueInput -} - -export type ChatUpdateOneRequiredWithoutMessagesNestedInput = { - create?: Prisma.XOR - connectOrCreate?: Prisma.ChatCreateOrConnectWithoutMessagesInput - upsert?: Prisma.ChatUpsertWithoutMessagesInput - connect?: Prisma.ChatWhereUniqueInput - update?: Prisma.XOR, Prisma.ChatUncheckedUpdateWithoutMessagesInput> -} - -export type ChatCreateNestedOneWithoutCallsInput = { - create?: Prisma.XOR - connectOrCreate?: Prisma.ChatCreateOrConnectWithoutCallsInput - connect?: Prisma.ChatWhereUniqueInput -} - -export type ChatUpdateOneRequiredWithoutCallsNestedInput = { - create?: Prisma.XOR - connectOrCreate?: Prisma.ChatCreateOrConnectWithoutCallsInput - upsert?: Prisma.ChatUpsertWithoutCallsInput - connect?: Prisma.ChatWhereUniqueInput - update?: Prisma.XOR, Prisma.ChatUncheckedUpdateWithoutCallsInput> -} - -export type ChatCreateWithoutUserInput = { - id?: string - createdAt?: Date | string - updatedAt?: Date | string - title?: string | null - messages?: Prisma.MessageCreateNestedManyWithoutChatInput - calls?: Prisma.LlmCallCreateNestedManyWithoutChatInput -} - -export type ChatUncheckedCreateWithoutUserInput = { - id?: string - createdAt?: Date | string - updatedAt?: Date | string - title?: string | null - messages?: Prisma.MessageUncheckedCreateNestedManyWithoutChatInput - calls?: Prisma.LlmCallUncheckedCreateNestedManyWithoutChatInput -} - -export type ChatCreateOrConnectWithoutUserInput = { - where: Prisma.ChatWhereUniqueInput - create: Prisma.XOR -} - -export type ChatCreateManyUserInputEnvelope = { - data: Prisma.ChatCreateManyUserInput | Prisma.ChatCreateManyUserInput[] -} - -export type ChatUpsertWithWhereUniqueWithoutUserInput = { - where: Prisma.ChatWhereUniqueInput - update: Prisma.XOR - create: Prisma.XOR -} - -export type ChatUpdateWithWhereUniqueWithoutUserInput = { - where: Prisma.ChatWhereUniqueInput - data: Prisma.XOR -} - -export type ChatUpdateManyWithWhereWithoutUserInput = { - where: Prisma.ChatScalarWhereInput - data: Prisma.XOR -} - -export type ChatScalarWhereInput = { - AND?: Prisma.ChatScalarWhereInput | Prisma.ChatScalarWhereInput[] - OR?: Prisma.ChatScalarWhereInput[] - NOT?: Prisma.ChatScalarWhereInput | Prisma.ChatScalarWhereInput[] - id?: Prisma.StringFilter<"Chat"> | string - createdAt?: Prisma.DateTimeFilter<"Chat"> | Date | string - updatedAt?: Prisma.DateTimeFilter<"Chat"> | Date | string - title?: Prisma.StringNullableFilter<"Chat"> | string | null - userId?: Prisma.StringNullableFilter<"Chat"> | string | null -} - -export type ChatCreateWithoutMessagesInput = { - id?: string - createdAt?: Date | string - updatedAt?: Date | string - title?: string | null - user?: Prisma.UserCreateNestedOneWithoutChatsInput - calls?: Prisma.LlmCallCreateNestedManyWithoutChatInput -} - -export type ChatUncheckedCreateWithoutMessagesInput = { - id?: string - createdAt?: Date | string - updatedAt?: Date | string - title?: string | null - userId?: string | null - calls?: Prisma.LlmCallUncheckedCreateNestedManyWithoutChatInput -} - -export type ChatCreateOrConnectWithoutMessagesInput = { - where: Prisma.ChatWhereUniqueInput - create: Prisma.XOR -} - -export type ChatUpsertWithoutMessagesInput = { - update: Prisma.XOR - create: Prisma.XOR - where?: Prisma.ChatWhereInput -} - -export type ChatUpdateToOneWithWhereWithoutMessagesInput = { - where?: Prisma.ChatWhereInput - data: Prisma.XOR -} - -export type ChatUpdateWithoutMessagesInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - title?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - user?: Prisma.UserUpdateOneWithoutChatsNestedInput - calls?: Prisma.LlmCallUpdateManyWithoutChatNestedInput -} - -export type ChatUncheckedUpdateWithoutMessagesInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - title?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - calls?: Prisma.LlmCallUncheckedUpdateManyWithoutChatNestedInput -} - -export type ChatCreateWithoutCallsInput = { - id?: string - createdAt?: Date | string - updatedAt?: Date | string - title?: string | null - user?: Prisma.UserCreateNestedOneWithoutChatsInput - messages?: Prisma.MessageCreateNestedManyWithoutChatInput -} - -export type ChatUncheckedCreateWithoutCallsInput = { - id?: string - createdAt?: Date | string - updatedAt?: Date | string - title?: string | null - userId?: string | null - messages?: Prisma.MessageUncheckedCreateNestedManyWithoutChatInput -} - -export type ChatCreateOrConnectWithoutCallsInput = { - where: Prisma.ChatWhereUniqueInput - create: Prisma.XOR -} - -export type ChatUpsertWithoutCallsInput = { - update: Prisma.XOR - create: Prisma.XOR - where?: Prisma.ChatWhereInput -} - -export type ChatUpdateToOneWithWhereWithoutCallsInput = { - where?: Prisma.ChatWhereInput - data: Prisma.XOR -} - -export type ChatUpdateWithoutCallsInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - title?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - user?: Prisma.UserUpdateOneWithoutChatsNestedInput - messages?: Prisma.MessageUpdateManyWithoutChatNestedInput -} - -export type ChatUncheckedUpdateWithoutCallsInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - title?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - messages?: Prisma.MessageUncheckedUpdateManyWithoutChatNestedInput -} - -export type ChatCreateManyUserInput = { - id?: string - createdAt?: Date | string - updatedAt?: Date | string - title?: string | null -} - -export type ChatUpdateWithoutUserInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - title?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - messages?: Prisma.MessageUpdateManyWithoutChatNestedInput - calls?: Prisma.LlmCallUpdateManyWithoutChatNestedInput -} - -export type ChatUncheckedUpdateWithoutUserInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - title?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - messages?: Prisma.MessageUncheckedUpdateManyWithoutChatNestedInput - calls?: Prisma.LlmCallUncheckedUpdateManyWithoutChatNestedInput -} - -export type ChatUncheckedUpdateManyWithoutUserInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - title?: Prisma.NullableStringFieldUpdateOperationsInput | string | null -} - - -/** - * Count Type ChatCountOutputType - */ - -export type ChatCountOutputType = { - messages: number - calls: number -} - -export type ChatCountOutputTypeSelect = { - messages?: boolean | ChatCountOutputTypeCountMessagesArgs - calls?: boolean | ChatCountOutputTypeCountCallsArgs -} - -/** - * ChatCountOutputType without action - */ -export type ChatCountOutputTypeDefaultArgs = { - /** - * Select specific fields to fetch from the ChatCountOutputType - */ - select?: Prisma.ChatCountOutputTypeSelect | null -} - -/** - * ChatCountOutputType without action - */ -export type ChatCountOutputTypeCountMessagesArgs = { - where?: Prisma.MessageWhereInput -} - -/** - * ChatCountOutputType without action - */ -export type ChatCountOutputTypeCountCallsArgs = { - where?: Prisma.LlmCallWhereInput -} - - -export type ChatSelect = runtime.Types.Extensions.GetSelect<{ - id?: boolean - createdAt?: boolean - updatedAt?: boolean - title?: boolean - userId?: boolean - user?: boolean | Prisma.Chat$userArgs - messages?: boolean | Prisma.Chat$messagesArgs - calls?: boolean | Prisma.Chat$callsArgs - _count?: boolean | Prisma.ChatCountOutputTypeDefaultArgs -}, ExtArgs["result"]["chat"]> - -export type ChatSelectCreateManyAndReturn = runtime.Types.Extensions.GetSelect<{ - id?: boolean - createdAt?: boolean - updatedAt?: boolean - title?: boolean - userId?: boolean - user?: boolean | Prisma.Chat$userArgs -}, ExtArgs["result"]["chat"]> - -export type ChatSelectUpdateManyAndReturn = runtime.Types.Extensions.GetSelect<{ - id?: boolean - createdAt?: boolean - updatedAt?: boolean - title?: boolean - userId?: boolean - user?: boolean | Prisma.Chat$userArgs -}, ExtArgs["result"]["chat"]> - -export type ChatSelectScalar = { - id?: boolean - createdAt?: boolean - updatedAt?: boolean - title?: boolean - userId?: boolean -} - -export type ChatOmit = runtime.Types.Extensions.GetOmit<"id" | "createdAt" | "updatedAt" | "title" | "userId", ExtArgs["result"]["chat"]> -export type ChatInclude = { - user?: boolean | Prisma.Chat$userArgs - messages?: boolean | Prisma.Chat$messagesArgs - calls?: boolean | Prisma.Chat$callsArgs - _count?: boolean | Prisma.ChatCountOutputTypeDefaultArgs -} -export type ChatIncludeCreateManyAndReturn = { - user?: boolean | Prisma.Chat$userArgs -} -export type ChatIncludeUpdateManyAndReturn = { - user?: boolean | Prisma.Chat$userArgs -} - -export type $ChatPayload = { - name: "Chat" - objects: { - user: Prisma.$UserPayload | null - messages: Prisma.$MessagePayload[] - calls: Prisma.$LlmCallPayload[] - } - scalars: runtime.Types.Extensions.GetPayloadResult<{ - id: string - createdAt: Date - updatedAt: Date - title: string | null - userId: string | null - }, ExtArgs["result"]["chat"]> - composites: {} -} - -export type ChatGetPayload = runtime.Types.Result.GetResult - -export type ChatCountArgs = - Omit & { - select?: ChatCountAggregateInputType | true - } - -export interface ChatDelegate { - [K: symbol]: { types: Prisma.TypeMap['model']['Chat'], meta: { name: 'Chat' } } - /** - * Find zero or one Chat that matches the filter. - * @param {ChatFindUniqueArgs} args - Arguments to find a Chat - * @example - * // Get one Chat - * const chat = await prisma.chat.findUnique({ - * where: { - * // ... provide filter here - * } - * }) - */ - findUnique(args: Prisma.SelectSubset>): Prisma.Prisma__ChatClient, T, "findUnique", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> - - /** - * Find one Chat that matches the filter or throw an error with `error.code='P2025'` - * if no matches were found. - * @param {ChatFindUniqueOrThrowArgs} args - Arguments to find a Chat - * @example - * // Get one Chat - * const chat = await prisma.chat.findUniqueOrThrow({ - * where: { - * // ... provide filter here - * } - * }) - */ - findUniqueOrThrow(args: Prisma.SelectSubset>): Prisma.Prisma__ChatClient, T, "findUniqueOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> - - /** - * Find the first Chat that matches the filter. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {ChatFindFirstArgs} args - Arguments to find a Chat - * @example - * // Get one Chat - * const chat = await prisma.chat.findFirst({ - * where: { - * // ... provide filter here - * } - * }) - */ - findFirst(args?: Prisma.SelectSubset>): Prisma.Prisma__ChatClient, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> - - /** - * Find the first Chat that matches the filter or - * throw `PrismaKnownClientError` with `P2025` code if no matches were found. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {ChatFindFirstOrThrowArgs} args - Arguments to find a Chat - * @example - * // Get one Chat - * const chat = await prisma.chat.findFirstOrThrow({ - * where: { - * // ... provide filter here - * } - * }) - */ - findFirstOrThrow(args?: Prisma.SelectSubset>): Prisma.Prisma__ChatClient, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> - - /** - * Find zero or more Chats that matches the filter. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {ChatFindManyArgs} args - Arguments to filter and select certain fields only. - * @example - * // Get all Chats - * const chats = await prisma.chat.findMany() - * - * // Get first 10 Chats - * const chats = await prisma.chat.findMany({ take: 10 }) - * - * // Only select the `id` - * const chatWithIdOnly = await prisma.chat.findMany({ select: { id: true } }) - * - */ - findMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions>> - - /** - * Create a Chat. - * @param {ChatCreateArgs} args - Arguments to create a Chat. - * @example - * // Create one Chat - * const Chat = await prisma.chat.create({ - * data: { - * // ... data to create a Chat - * } - * }) - * - */ - create(args: Prisma.SelectSubset>): Prisma.Prisma__ChatClient, T, "create", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> - - /** - * Create many Chats. - * @param {ChatCreateManyArgs} args - Arguments to create many Chats. - * @example - * // Create many Chats - * const chat = await prisma.chat.createMany({ - * data: [ - * // ... provide data here - * ] - * }) - * - */ - createMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise - - /** - * Create many Chats and returns the data saved in the database. - * @param {ChatCreateManyAndReturnArgs} args - Arguments to create many Chats. - * @example - * // Create many Chats - * const chat = await prisma.chat.createManyAndReturn({ - * data: [ - * // ... provide data here - * ] - * }) - * - * // Create many Chats and only return the `id` - * const chatWithIdOnly = await prisma.chat.createManyAndReturn({ - * select: { id: true }, - * data: [ - * // ... provide data here - * ] - * }) - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * - */ - createManyAndReturn(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "createManyAndReturn", GlobalOmitOptions>> - - /** - * Delete a Chat. - * @param {ChatDeleteArgs} args - Arguments to delete one Chat. - * @example - * // Delete one Chat - * const Chat = await prisma.chat.delete({ - * where: { - * // ... filter to delete one Chat - * } - * }) - * - */ - delete(args: Prisma.SelectSubset>): Prisma.Prisma__ChatClient, T, "delete", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> - - /** - * Update one Chat. - * @param {ChatUpdateArgs} args - Arguments to update one Chat. - * @example - * // Update one Chat - * const chat = await prisma.chat.update({ - * where: { - * // ... provide filter here - * }, - * data: { - * // ... provide data here - * } - * }) - * - */ - update(args: Prisma.SelectSubset>): Prisma.Prisma__ChatClient, T, "update", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> - - /** - * Delete zero or more Chats. - * @param {ChatDeleteManyArgs} args - Arguments to filter Chats to delete. - * @example - * // Delete a few Chats - * const { count } = await prisma.chat.deleteMany({ - * where: { - * // ... provide filter here - * } - * }) - * - */ - deleteMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise - - /** - * Update zero or more Chats. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {ChatUpdateManyArgs} args - Arguments to update one or more rows. - * @example - * // Update many Chats - * const chat = await prisma.chat.updateMany({ - * where: { - * // ... provide filter here - * }, - * data: { - * // ... provide data here - * } - * }) - * - */ - updateMany(args: Prisma.SelectSubset>): Prisma.PrismaPromise - - /** - * Update zero or more Chats and returns the data updated in the database. - * @param {ChatUpdateManyAndReturnArgs} args - Arguments to update many Chats. - * @example - * // Update many Chats - * const chat = await prisma.chat.updateManyAndReturn({ - * where: { - * // ... provide filter here - * }, - * data: [ - * // ... provide data here - * ] - * }) - * - * // Update zero or more Chats and only return the `id` - * const chatWithIdOnly = await prisma.chat.updateManyAndReturn({ - * select: { id: true }, - * where: { - * // ... provide filter here - * }, - * data: [ - * // ... provide data here - * ] - * }) - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * - */ - updateManyAndReturn(args: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "updateManyAndReturn", GlobalOmitOptions>> - - /** - * Create or update one Chat. - * @param {ChatUpsertArgs} args - Arguments to update or create a Chat. - * @example - * // Update or create a Chat - * const chat = await prisma.chat.upsert({ - * create: { - * // ... data to create a Chat - * }, - * update: { - * // ... in case it already exists, update - * }, - * where: { - * // ... the filter for the Chat we want to update - * } - * }) - */ - upsert(args: Prisma.SelectSubset>): Prisma.Prisma__ChatClient, T, "upsert", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> - - - /** - * Count the number of Chats. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {ChatCountArgs} args - Arguments to filter Chats to count. - * @example - * // Count the number of Chats - * const count = await prisma.chat.count({ - * where: { - * // ... the filter for the Chats we want to count - * } - * }) - **/ - count( - args?: Prisma.Subset, - ): Prisma.PrismaPromise< - T extends runtime.Types.Utils.Record<'select', any> - ? T['select'] extends true - ? number - : Prisma.GetScalarType - : number - > - - /** - * Allows you to perform aggregations operations on a Chat. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {ChatAggregateArgs} args - Select which aggregations you would like to apply and on what fields. - * @example - * // Ordered by age ascending - * // Where email contains prisma.io - * // Limited to the 10 users - * const aggregations = await prisma.user.aggregate({ - * _avg: { - * age: true, - * }, - * where: { - * email: { - * contains: "prisma.io", - * }, - * }, - * orderBy: { - * age: "asc", - * }, - * take: 10, - * }) - **/ - aggregate(args: Prisma.Subset): Prisma.PrismaPromise> - - /** - * Group by Chat. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {ChatGroupByArgs} args - Group by arguments. - * @example - * // Group by city, order by createdAt, get count - * const result = await prisma.user.groupBy({ - * by: ['city', 'createdAt'], - * orderBy: { - * createdAt: true - * }, - * _count: { - * _all: true - * }, - * }) - * - **/ - groupBy< - T extends ChatGroupByArgs, - HasSelectOrTake extends Prisma.Or< - Prisma.Extends<'skip', Prisma.Keys>, - Prisma.Extends<'take', Prisma.Keys> - >, - OrderByArg extends Prisma.True extends HasSelectOrTake - ? { orderBy: ChatGroupByArgs['orderBy'] } - : { orderBy?: ChatGroupByArgs['orderBy'] }, - OrderFields extends Prisma.ExcludeUnderscoreKeys>>, - ByFields extends Prisma.MaybeTupleToUnion, - ByValid extends Prisma.Has, - HavingFields extends Prisma.GetHavingFields, - HavingValid extends Prisma.Has, - ByEmpty extends T['by'] extends never[] ? Prisma.True : Prisma.False, - InputErrors extends ByEmpty extends Prisma.True - ? `Error: "by" must not be empty.` - : HavingValid extends Prisma.False - ? { - [P in HavingFields]: P extends ByFields - ? never - : P extends string - ? `Error: Field "${P}" used in "having" needs to be provided in "by".` - : [ - Error, - 'Field ', - P, - ` in "having" needs to be provided in "by"`, - ] - }[HavingFields] - : 'take' extends Prisma.Keys - ? 'orderBy' extends Prisma.Keys - ? ByValid extends Prisma.True - ? {} - : { - [P in OrderFields]: P extends ByFields - ? never - : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` - }[OrderFields] - : 'Error: If you provide "take", you also need to provide "orderBy"' - : 'skip' extends Prisma.Keys - ? 'orderBy' extends Prisma.Keys - ? ByValid extends Prisma.True - ? {} - : { - [P in OrderFields]: P extends ByFields - ? never - : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` - }[OrderFields] - : 'Error: If you provide "skip", you also need to provide "orderBy"' - : ByValid extends Prisma.True - ? {} - : { - [P in OrderFields]: P extends ByFields - ? never - : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` - }[OrderFields] - >(args: Prisma.SubsetIntersection & InputErrors): {} extends InputErrors ? GetChatGroupByPayload : Prisma.PrismaPromise -/** - * Fields of the Chat model - */ -readonly fields: ChatFieldRefs; -} - -/** - * The delegate class that acts as a "Promise-like" for Chat. - * Why is this prefixed with `Prisma__`? - * Because we want to prevent naming conflicts as mentioned in - * https://github.com/prisma/prisma-client-js/issues/707 - */ -export interface Prisma__ChatClient extends Prisma.PrismaPromise { - readonly [Symbol.toStringTag]: "PrismaPromise" - user = {}>(args?: Prisma.Subset>): Prisma.Prisma__UserClient, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> - messages = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> - calls = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise - /** - * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The - * resolved value cannot be modified from the callback. - * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected). - * @returns A Promise for the completion of the callback. - */ - finally(onfinally?: (() => void) | undefined | null): runtime.Types.Utils.JsPromise -} - - - - -/** - * Fields of the Chat model - */ -export interface ChatFieldRefs { - readonly id: Prisma.FieldRef<"Chat", 'String'> - readonly createdAt: Prisma.FieldRef<"Chat", 'DateTime'> - readonly updatedAt: Prisma.FieldRef<"Chat", 'DateTime'> - readonly title: Prisma.FieldRef<"Chat", 'String'> - readonly userId: Prisma.FieldRef<"Chat", 'String'> -} - - -// Custom InputTypes -/** - * Chat findUnique - */ -export type ChatFindUniqueArgs = { - /** - * Select specific fields to fetch from the Chat - */ - select?: Prisma.ChatSelect | null - /** - * Omit specific fields from the Chat - */ - omit?: Prisma.ChatOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.ChatInclude | null - /** - * Filter, which Chat to fetch. - */ - where: Prisma.ChatWhereUniqueInput -} - -/** - * Chat findUniqueOrThrow - */ -export type ChatFindUniqueOrThrowArgs = { - /** - * Select specific fields to fetch from the Chat - */ - select?: Prisma.ChatSelect | null - /** - * Omit specific fields from the Chat - */ - omit?: Prisma.ChatOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.ChatInclude | null - /** - * Filter, which Chat to fetch. - */ - where: Prisma.ChatWhereUniqueInput -} - -/** - * Chat findFirst - */ -export type ChatFindFirstArgs = { - /** - * Select specific fields to fetch from the Chat - */ - select?: Prisma.ChatSelect | null - /** - * Omit specific fields from the Chat - */ - omit?: Prisma.ChatOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.ChatInclude | null - /** - * Filter, which Chat to fetch. - */ - where?: Prisma.ChatWhereInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} - * - * Determine the order of Chats to fetch. - */ - orderBy?: Prisma.ChatOrderByWithRelationInput | Prisma.ChatOrderByWithRelationInput[] - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} - * - * Sets the position for searching for Chats. - */ - cursor?: Prisma.ChatWhereUniqueInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Take `±n` Chats from the position of the cursor. - */ - take?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Skip the first `n` Chats. - */ - skip?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} - * - * Filter by unique combinations of Chats. - */ - distinct?: Prisma.ChatScalarFieldEnum | Prisma.ChatScalarFieldEnum[] -} - -/** - * Chat findFirstOrThrow - */ -export type ChatFindFirstOrThrowArgs = { - /** - * Select specific fields to fetch from the Chat - */ - select?: Prisma.ChatSelect | null - /** - * Omit specific fields from the Chat - */ - omit?: Prisma.ChatOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.ChatInclude | null - /** - * Filter, which Chat to fetch. - */ - where?: Prisma.ChatWhereInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} - * - * Determine the order of Chats to fetch. - */ - orderBy?: Prisma.ChatOrderByWithRelationInput | Prisma.ChatOrderByWithRelationInput[] - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} - * - * Sets the position for searching for Chats. - */ - cursor?: Prisma.ChatWhereUniqueInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Take `±n` Chats from the position of the cursor. - */ - take?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Skip the first `n` Chats. - */ - skip?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} - * - * Filter by unique combinations of Chats. - */ - distinct?: Prisma.ChatScalarFieldEnum | Prisma.ChatScalarFieldEnum[] -} - -/** - * Chat findMany - */ -export type ChatFindManyArgs = { - /** - * Select specific fields to fetch from the Chat - */ - select?: Prisma.ChatSelect | null - /** - * Omit specific fields from the Chat - */ - omit?: Prisma.ChatOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.ChatInclude | null - /** - * Filter, which Chats to fetch. - */ - where?: Prisma.ChatWhereInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} - * - * Determine the order of Chats to fetch. - */ - orderBy?: Prisma.ChatOrderByWithRelationInput | Prisma.ChatOrderByWithRelationInput[] - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} - * - * Sets the position for listing Chats. - */ - cursor?: Prisma.ChatWhereUniqueInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Take `±n` Chats from the position of the cursor. - */ - take?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Skip the first `n` Chats. - */ - skip?: number - distinct?: Prisma.ChatScalarFieldEnum | Prisma.ChatScalarFieldEnum[] -} - -/** - * Chat create - */ -export type ChatCreateArgs = { - /** - * Select specific fields to fetch from the Chat - */ - select?: Prisma.ChatSelect | null - /** - * Omit specific fields from the Chat - */ - omit?: Prisma.ChatOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.ChatInclude | null - /** - * The data needed to create a Chat. - */ - data: Prisma.XOR -} - -/** - * Chat createMany - */ -export type ChatCreateManyArgs = { - /** - * The data used to create many Chats. - */ - data: Prisma.ChatCreateManyInput | Prisma.ChatCreateManyInput[] -} - -/** - * Chat createManyAndReturn - */ -export type ChatCreateManyAndReturnArgs = { - /** - * Select specific fields to fetch from the Chat - */ - select?: Prisma.ChatSelectCreateManyAndReturn | null - /** - * Omit specific fields from the Chat - */ - omit?: Prisma.ChatOmit | null - /** - * The data used to create many Chats. - */ - data: Prisma.ChatCreateManyInput | Prisma.ChatCreateManyInput[] - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.ChatIncludeCreateManyAndReturn | null -} - -/** - * Chat update - */ -export type ChatUpdateArgs = { - /** - * Select specific fields to fetch from the Chat - */ - select?: Prisma.ChatSelect | null - /** - * Omit specific fields from the Chat - */ - omit?: Prisma.ChatOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.ChatInclude | null - /** - * The data needed to update a Chat. - */ - data: Prisma.XOR - /** - * Choose, which Chat to update. - */ - where: Prisma.ChatWhereUniqueInput -} - -/** - * Chat updateMany - */ -export type ChatUpdateManyArgs = { - /** - * The data used to update Chats. - */ - data: Prisma.XOR - /** - * Filter which Chats to update - */ - where?: Prisma.ChatWhereInput - /** - * Limit how many Chats to update. - */ - limit?: number -} - -/** - * Chat updateManyAndReturn - */ -export type ChatUpdateManyAndReturnArgs = { - /** - * Select specific fields to fetch from the Chat - */ - select?: Prisma.ChatSelectUpdateManyAndReturn | null - /** - * Omit specific fields from the Chat - */ - omit?: Prisma.ChatOmit | null - /** - * The data used to update Chats. - */ - data: Prisma.XOR - /** - * Filter which Chats to update - */ - where?: Prisma.ChatWhereInput - /** - * Limit how many Chats to update. - */ - limit?: number - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.ChatIncludeUpdateManyAndReturn | null -} - -/** - * Chat upsert - */ -export type ChatUpsertArgs = { - /** - * Select specific fields to fetch from the Chat - */ - select?: Prisma.ChatSelect | null - /** - * Omit specific fields from the Chat - */ - omit?: Prisma.ChatOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.ChatInclude | null - /** - * The filter to search for the Chat to update in case it exists. - */ - where: Prisma.ChatWhereUniqueInput - /** - * In case the Chat found by the `where` argument doesn't exist, create a new Chat with this data. - */ - create: Prisma.XOR - /** - * In case the Chat was found with the provided `where` argument, update it with this data. - */ - update: Prisma.XOR -} - -/** - * Chat delete - */ -export type ChatDeleteArgs = { - /** - * Select specific fields to fetch from the Chat - */ - select?: Prisma.ChatSelect | null - /** - * Omit specific fields from the Chat - */ - omit?: Prisma.ChatOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.ChatInclude | null - /** - * Filter which Chat to delete. - */ - where: Prisma.ChatWhereUniqueInput -} - -/** - * Chat deleteMany - */ -export type ChatDeleteManyArgs = { - /** - * Filter which Chats to delete - */ - where?: Prisma.ChatWhereInput - /** - * Limit how many Chats to delete. - */ - limit?: number -} - -/** - * Chat.user - */ -export type Chat$userArgs = { - /** - * Select specific fields to fetch from the User - */ - select?: Prisma.UserSelect | null - /** - * Omit specific fields from the User - */ - omit?: Prisma.UserOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.UserInclude | null - where?: Prisma.UserWhereInput -} - -/** - * Chat.messages - */ -export type Chat$messagesArgs = { - /** - * Select specific fields to fetch from the Message - */ - select?: Prisma.MessageSelect | null - /** - * Omit specific fields from the Message - */ - omit?: Prisma.MessageOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.MessageInclude | null - where?: Prisma.MessageWhereInput - orderBy?: Prisma.MessageOrderByWithRelationInput | Prisma.MessageOrderByWithRelationInput[] - cursor?: Prisma.MessageWhereUniqueInput - take?: number - skip?: number - distinct?: Prisma.MessageScalarFieldEnum | Prisma.MessageScalarFieldEnum[] -} - -/** - * Chat.calls - */ -export type Chat$callsArgs = { - /** - * Select specific fields to fetch from the LlmCall - */ - select?: Prisma.LlmCallSelect | null - /** - * Omit specific fields from the LlmCall - */ - omit?: Prisma.LlmCallOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.LlmCallInclude | null - where?: Prisma.LlmCallWhereInput - orderBy?: Prisma.LlmCallOrderByWithRelationInput | Prisma.LlmCallOrderByWithRelationInput[] - cursor?: Prisma.LlmCallWhereUniqueInput - take?: number - skip?: number - distinct?: Prisma.LlmCallScalarFieldEnum | Prisma.LlmCallScalarFieldEnum[] -} - -/** - * Chat without action - */ -export type ChatDefaultArgs = { - /** - * Select specific fields to fetch from the Chat - */ - select?: Prisma.ChatSelect | null - /** - * Omit specific fields from the Chat - */ - omit?: Prisma.ChatOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.ChatInclude | null -} diff --git a/generated/prisma/models/LlmCall.ts b/generated/prisma/models/LlmCall.ts deleted file mode 100644 index 88754cd..0000000 --- a/generated/prisma/models/LlmCall.ts +++ /dev/null @@ -1,1644 +0,0 @@ - -/* !!! This is code generated by Prisma. Do not edit directly. !!! */ -/* eslint-disable */ -// biome-ignore-all lint: generated file -// @ts-nocheck -/* - * This file exports the `LlmCall` model and its related types. - * - * 🟢 You can import this file directly. - */ -import type * as runtime from "@prisma/client/runtime/client" -import type * as $Enums from "../enums.js" -import type * as Prisma from "../internal/prismaNamespace.js" - -/** - * Model LlmCall - * - */ -export type LlmCallModel = runtime.Types.Result.DefaultSelection - -export type AggregateLlmCall = { - _count: LlmCallCountAggregateOutputType | null - _avg: LlmCallAvgAggregateOutputType | null - _sum: LlmCallSumAggregateOutputType | null - _min: LlmCallMinAggregateOutputType | null - _max: LlmCallMaxAggregateOutputType | null -} - -export type LlmCallAvgAggregateOutputType = { - inputTokens: number | null - outputTokens: number | null - totalTokens: number | null - latencyMs: number | null -} - -export type LlmCallSumAggregateOutputType = { - inputTokens: number | null - outputTokens: number | null - totalTokens: number | null - latencyMs: number | null -} - -export type LlmCallMinAggregateOutputType = { - id: string | null - createdAt: Date | null - chatId: string | null - provider: $Enums.Provider | null - model: string | null - inputTokens: number | null - outputTokens: number | null - totalTokens: number | null - latencyMs: number | null - error: string | null -} - -export type LlmCallMaxAggregateOutputType = { - id: string | null - createdAt: Date | null - chatId: string | null - provider: $Enums.Provider | null - model: string | null - inputTokens: number | null - outputTokens: number | null - totalTokens: number | null - latencyMs: number | null - error: string | null -} - -export type LlmCallCountAggregateOutputType = { - id: number - createdAt: number - chatId: number - provider: number - model: number - request: number - response: number - inputTokens: number - outputTokens: number - totalTokens: number - latencyMs: number - error: number - _all: number -} - - -export type LlmCallAvgAggregateInputType = { - inputTokens?: true - outputTokens?: true - totalTokens?: true - latencyMs?: true -} - -export type LlmCallSumAggregateInputType = { - inputTokens?: true - outputTokens?: true - totalTokens?: true - latencyMs?: true -} - -export type LlmCallMinAggregateInputType = { - id?: true - createdAt?: true - chatId?: true - provider?: true - model?: true - inputTokens?: true - outputTokens?: true - totalTokens?: true - latencyMs?: true - error?: true -} - -export type LlmCallMaxAggregateInputType = { - id?: true - createdAt?: true - chatId?: true - provider?: true - model?: true - inputTokens?: true - outputTokens?: true - totalTokens?: true - latencyMs?: true - error?: true -} - -export type LlmCallCountAggregateInputType = { - id?: true - createdAt?: true - chatId?: true - provider?: true - model?: true - request?: true - response?: true - inputTokens?: true - outputTokens?: true - totalTokens?: true - latencyMs?: true - error?: true - _all?: true -} - -export type LlmCallAggregateArgs = { - /** - * Filter which LlmCall to aggregate. - */ - where?: Prisma.LlmCallWhereInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} - * - * Determine the order of LlmCalls to fetch. - */ - orderBy?: Prisma.LlmCallOrderByWithRelationInput | Prisma.LlmCallOrderByWithRelationInput[] - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} - * - * Sets the start position - */ - cursor?: Prisma.LlmCallWhereUniqueInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Take `±n` LlmCalls from the position of the cursor. - */ - take?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Skip the first `n` LlmCalls. - */ - skip?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} - * - * Count returned LlmCalls - **/ - _count?: true | LlmCallCountAggregateInputType - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} - * - * Select which fields to average - **/ - _avg?: LlmCallAvgAggregateInputType - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} - * - * Select which fields to sum - **/ - _sum?: LlmCallSumAggregateInputType - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} - * - * Select which fields to find the minimum value - **/ - _min?: LlmCallMinAggregateInputType - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} - * - * Select which fields to find the maximum value - **/ - _max?: LlmCallMaxAggregateInputType -} - -export type GetLlmCallAggregateType = { - [P in keyof T & keyof AggregateLlmCall]: P extends '_count' | 'count' - ? T[P] extends true - ? number - : Prisma.GetScalarType - : Prisma.GetScalarType -} - - - - -export type LlmCallGroupByArgs = { - where?: Prisma.LlmCallWhereInput - orderBy?: Prisma.LlmCallOrderByWithAggregationInput | Prisma.LlmCallOrderByWithAggregationInput[] - by: Prisma.LlmCallScalarFieldEnum[] | Prisma.LlmCallScalarFieldEnum - having?: Prisma.LlmCallScalarWhereWithAggregatesInput - take?: number - skip?: number - _count?: LlmCallCountAggregateInputType | true - _avg?: LlmCallAvgAggregateInputType - _sum?: LlmCallSumAggregateInputType - _min?: LlmCallMinAggregateInputType - _max?: LlmCallMaxAggregateInputType -} - -export type LlmCallGroupByOutputType = { - id: string - createdAt: Date - chatId: string - provider: $Enums.Provider - model: string - request: runtime.JsonValue - response: runtime.JsonValue | null - inputTokens: number | null - outputTokens: number | null - totalTokens: number | null - latencyMs: number | null - error: string | null - _count: LlmCallCountAggregateOutputType | null - _avg: LlmCallAvgAggregateOutputType | null - _sum: LlmCallSumAggregateOutputType | null - _min: LlmCallMinAggregateOutputType | null - _max: LlmCallMaxAggregateOutputType | null -} - -type GetLlmCallGroupByPayload = Prisma.PrismaPromise< - Array< - Prisma.PickEnumerable & - { - [P in ((keyof T) & (keyof LlmCallGroupByOutputType))]: P extends '_count' - ? T[P] extends boolean - ? number - : Prisma.GetScalarType - : Prisma.GetScalarType - } - > - > - - - -export type LlmCallWhereInput = { - AND?: Prisma.LlmCallWhereInput | Prisma.LlmCallWhereInput[] - OR?: Prisma.LlmCallWhereInput[] - NOT?: Prisma.LlmCallWhereInput | Prisma.LlmCallWhereInput[] - id?: Prisma.StringFilter<"LlmCall"> | string - createdAt?: Prisma.DateTimeFilter<"LlmCall"> | Date | string - chatId?: Prisma.StringFilter<"LlmCall"> | string - provider?: Prisma.EnumProviderFilter<"LlmCall"> | $Enums.Provider - model?: Prisma.StringFilter<"LlmCall"> | string - request?: Prisma.JsonFilter<"LlmCall"> - response?: Prisma.JsonNullableFilter<"LlmCall"> - inputTokens?: Prisma.IntNullableFilter<"LlmCall"> | number | null - outputTokens?: Prisma.IntNullableFilter<"LlmCall"> | number | null - totalTokens?: Prisma.IntNullableFilter<"LlmCall"> | number | null - latencyMs?: Prisma.IntNullableFilter<"LlmCall"> | number | null - error?: Prisma.StringNullableFilter<"LlmCall"> | string | null - chat?: Prisma.XOR -} - -export type LlmCallOrderByWithRelationInput = { - id?: Prisma.SortOrder - createdAt?: Prisma.SortOrder - chatId?: Prisma.SortOrder - provider?: Prisma.SortOrder - model?: Prisma.SortOrder - request?: Prisma.SortOrder - response?: Prisma.SortOrderInput | Prisma.SortOrder - inputTokens?: Prisma.SortOrderInput | Prisma.SortOrder - outputTokens?: Prisma.SortOrderInput | Prisma.SortOrder - totalTokens?: Prisma.SortOrderInput | Prisma.SortOrder - latencyMs?: Prisma.SortOrderInput | Prisma.SortOrder - error?: Prisma.SortOrderInput | Prisma.SortOrder - chat?: Prisma.ChatOrderByWithRelationInput -} - -export type LlmCallWhereUniqueInput = Prisma.AtLeast<{ - id?: string - AND?: Prisma.LlmCallWhereInput | Prisma.LlmCallWhereInput[] - OR?: Prisma.LlmCallWhereInput[] - NOT?: Prisma.LlmCallWhereInput | Prisma.LlmCallWhereInput[] - createdAt?: Prisma.DateTimeFilter<"LlmCall"> | Date | string - chatId?: Prisma.StringFilter<"LlmCall"> | string - provider?: Prisma.EnumProviderFilter<"LlmCall"> | $Enums.Provider - model?: Prisma.StringFilter<"LlmCall"> | string - request?: Prisma.JsonFilter<"LlmCall"> - response?: Prisma.JsonNullableFilter<"LlmCall"> - inputTokens?: Prisma.IntNullableFilter<"LlmCall"> | number | null - outputTokens?: Prisma.IntNullableFilter<"LlmCall"> | number | null - totalTokens?: Prisma.IntNullableFilter<"LlmCall"> | number | null - latencyMs?: Prisma.IntNullableFilter<"LlmCall"> | number | null - error?: Prisma.StringNullableFilter<"LlmCall"> | string | null - chat?: Prisma.XOR -}, "id"> - -export type LlmCallOrderByWithAggregationInput = { - id?: Prisma.SortOrder - createdAt?: Prisma.SortOrder - chatId?: Prisma.SortOrder - provider?: Prisma.SortOrder - model?: Prisma.SortOrder - request?: Prisma.SortOrder - response?: Prisma.SortOrderInput | Prisma.SortOrder - inputTokens?: Prisma.SortOrderInput | Prisma.SortOrder - outputTokens?: Prisma.SortOrderInput | Prisma.SortOrder - totalTokens?: Prisma.SortOrderInput | Prisma.SortOrder - latencyMs?: Prisma.SortOrderInput | Prisma.SortOrder - error?: Prisma.SortOrderInput | Prisma.SortOrder - _count?: Prisma.LlmCallCountOrderByAggregateInput - _avg?: Prisma.LlmCallAvgOrderByAggregateInput - _max?: Prisma.LlmCallMaxOrderByAggregateInput - _min?: Prisma.LlmCallMinOrderByAggregateInput - _sum?: Prisma.LlmCallSumOrderByAggregateInput -} - -export type LlmCallScalarWhereWithAggregatesInput = { - AND?: Prisma.LlmCallScalarWhereWithAggregatesInput | Prisma.LlmCallScalarWhereWithAggregatesInput[] - OR?: Prisma.LlmCallScalarWhereWithAggregatesInput[] - NOT?: Prisma.LlmCallScalarWhereWithAggregatesInput | Prisma.LlmCallScalarWhereWithAggregatesInput[] - id?: Prisma.StringWithAggregatesFilter<"LlmCall"> | string - createdAt?: Prisma.DateTimeWithAggregatesFilter<"LlmCall"> | Date | string - chatId?: Prisma.StringWithAggregatesFilter<"LlmCall"> | string - provider?: Prisma.EnumProviderWithAggregatesFilter<"LlmCall"> | $Enums.Provider - model?: Prisma.StringWithAggregatesFilter<"LlmCall"> | string - request?: Prisma.JsonWithAggregatesFilter<"LlmCall"> - response?: Prisma.JsonNullableWithAggregatesFilter<"LlmCall"> - inputTokens?: Prisma.IntNullableWithAggregatesFilter<"LlmCall"> | number | null - outputTokens?: Prisma.IntNullableWithAggregatesFilter<"LlmCall"> | number | null - totalTokens?: Prisma.IntNullableWithAggregatesFilter<"LlmCall"> | number | null - latencyMs?: Prisma.IntNullableWithAggregatesFilter<"LlmCall"> | number | null - error?: Prisma.StringNullableWithAggregatesFilter<"LlmCall"> | string | null -} - -export type LlmCallCreateInput = { - id?: string - createdAt?: Date | string - provider: $Enums.Provider - model: string - request: Prisma.JsonNullValueInput | runtime.InputJsonValue - response?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - inputTokens?: number | null - outputTokens?: number | null - totalTokens?: number | null - latencyMs?: number | null - error?: string | null - chat: Prisma.ChatCreateNestedOneWithoutCallsInput -} - -export type LlmCallUncheckedCreateInput = { - id?: string - createdAt?: Date | string - chatId: string - provider: $Enums.Provider - model: string - request: Prisma.JsonNullValueInput | runtime.InputJsonValue - response?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - inputTokens?: number | null - outputTokens?: number | null - totalTokens?: number | null - latencyMs?: number | null - error?: string | null -} - -export type LlmCallUpdateInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - provider?: Prisma.EnumProviderFieldUpdateOperationsInput | $Enums.Provider - model?: Prisma.StringFieldUpdateOperationsInput | string - request?: Prisma.JsonNullValueInput | runtime.InputJsonValue - response?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - inputTokens?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - outputTokens?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - totalTokens?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - latencyMs?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - error?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - chat?: Prisma.ChatUpdateOneRequiredWithoutCallsNestedInput -} - -export type LlmCallUncheckedUpdateInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - chatId?: Prisma.StringFieldUpdateOperationsInput | string - provider?: Prisma.EnumProviderFieldUpdateOperationsInput | $Enums.Provider - model?: Prisma.StringFieldUpdateOperationsInput | string - request?: Prisma.JsonNullValueInput | runtime.InputJsonValue - response?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - inputTokens?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - outputTokens?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - totalTokens?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - latencyMs?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - error?: Prisma.NullableStringFieldUpdateOperationsInput | string | null -} - -export type LlmCallCreateManyInput = { - id?: string - createdAt?: Date | string - chatId: string - provider: $Enums.Provider - model: string - request: Prisma.JsonNullValueInput | runtime.InputJsonValue - response?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - inputTokens?: number | null - outputTokens?: number | null - totalTokens?: number | null - latencyMs?: number | null - error?: string | null -} - -export type LlmCallUpdateManyMutationInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - provider?: Prisma.EnumProviderFieldUpdateOperationsInput | $Enums.Provider - model?: Prisma.StringFieldUpdateOperationsInput | string - request?: Prisma.JsonNullValueInput | runtime.InputJsonValue - response?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - inputTokens?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - outputTokens?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - totalTokens?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - latencyMs?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - error?: Prisma.NullableStringFieldUpdateOperationsInput | string | null -} - -export type LlmCallUncheckedUpdateManyInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - chatId?: Prisma.StringFieldUpdateOperationsInput | string - provider?: Prisma.EnumProviderFieldUpdateOperationsInput | $Enums.Provider - model?: Prisma.StringFieldUpdateOperationsInput | string - request?: Prisma.JsonNullValueInput | runtime.InputJsonValue - response?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - inputTokens?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - outputTokens?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - totalTokens?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - latencyMs?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - error?: Prisma.NullableStringFieldUpdateOperationsInput | string | null -} - -export type LlmCallListRelationFilter = { - every?: Prisma.LlmCallWhereInput - some?: Prisma.LlmCallWhereInput - none?: Prisma.LlmCallWhereInput -} - -export type LlmCallOrderByRelationAggregateInput = { - _count?: Prisma.SortOrder -} - -export type LlmCallCountOrderByAggregateInput = { - id?: Prisma.SortOrder - createdAt?: Prisma.SortOrder - chatId?: Prisma.SortOrder - provider?: Prisma.SortOrder - model?: Prisma.SortOrder - request?: Prisma.SortOrder - response?: Prisma.SortOrder - inputTokens?: Prisma.SortOrder - outputTokens?: Prisma.SortOrder - totalTokens?: Prisma.SortOrder - latencyMs?: Prisma.SortOrder - error?: Prisma.SortOrder -} - -export type LlmCallAvgOrderByAggregateInput = { - inputTokens?: Prisma.SortOrder - outputTokens?: Prisma.SortOrder - totalTokens?: Prisma.SortOrder - latencyMs?: Prisma.SortOrder -} - -export type LlmCallMaxOrderByAggregateInput = { - id?: Prisma.SortOrder - createdAt?: Prisma.SortOrder - chatId?: Prisma.SortOrder - provider?: Prisma.SortOrder - model?: Prisma.SortOrder - inputTokens?: Prisma.SortOrder - outputTokens?: Prisma.SortOrder - totalTokens?: Prisma.SortOrder - latencyMs?: Prisma.SortOrder - error?: Prisma.SortOrder -} - -export type LlmCallMinOrderByAggregateInput = { - id?: Prisma.SortOrder - createdAt?: Prisma.SortOrder - chatId?: Prisma.SortOrder - provider?: Prisma.SortOrder - model?: Prisma.SortOrder - inputTokens?: Prisma.SortOrder - outputTokens?: Prisma.SortOrder - totalTokens?: Prisma.SortOrder - latencyMs?: Prisma.SortOrder - error?: Prisma.SortOrder -} - -export type LlmCallSumOrderByAggregateInput = { - inputTokens?: Prisma.SortOrder - outputTokens?: Prisma.SortOrder - totalTokens?: Prisma.SortOrder - latencyMs?: Prisma.SortOrder -} - -export type LlmCallCreateNestedManyWithoutChatInput = { - create?: Prisma.XOR | Prisma.LlmCallCreateWithoutChatInput[] | Prisma.LlmCallUncheckedCreateWithoutChatInput[] - connectOrCreate?: Prisma.LlmCallCreateOrConnectWithoutChatInput | Prisma.LlmCallCreateOrConnectWithoutChatInput[] - createMany?: Prisma.LlmCallCreateManyChatInputEnvelope - connect?: Prisma.LlmCallWhereUniqueInput | Prisma.LlmCallWhereUniqueInput[] -} - -export type LlmCallUncheckedCreateNestedManyWithoutChatInput = { - create?: Prisma.XOR | Prisma.LlmCallCreateWithoutChatInput[] | Prisma.LlmCallUncheckedCreateWithoutChatInput[] - connectOrCreate?: Prisma.LlmCallCreateOrConnectWithoutChatInput | Prisma.LlmCallCreateOrConnectWithoutChatInput[] - createMany?: Prisma.LlmCallCreateManyChatInputEnvelope - connect?: Prisma.LlmCallWhereUniqueInput | Prisma.LlmCallWhereUniqueInput[] -} - -export type LlmCallUpdateManyWithoutChatNestedInput = { - create?: Prisma.XOR | Prisma.LlmCallCreateWithoutChatInput[] | Prisma.LlmCallUncheckedCreateWithoutChatInput[] - connectOrCreate?: Prisma.LlmCallCreateOrConnectWithoutChatInput | Prisma.LlmCallCreateOrConnectWithoutChatInput[] - upsert?: Prisma.LlmCallUpsertWithWhereUniqueWithoutChatInput | Prisma.LlmCallUpsertWithWhereUniqueWithoutChatInput[] - createMany?: Prisma.LlmCallCreateManyChatInputEnvelope - set?: Prisma.LlmCallWhereUniqueInput | Prisma.LlmCallWhereUniqueInput[] - disconnect?: Prisma.LlmCallWhereUniqueInput | Prisma.LlmCallWhereUniqueInput[] - delete?: Prisma.LlmCallWhereUniqueInput | Prisma.LlmCallWhereUniqueInput[] - connect?: Prisma.LlmCallWhereUniqueInput | Prisma.LlmCallWhereUniqueInput[] - update?: Prisma.LlmCallUpdateWithWhereUniqueWithoutChatInput | Prisma.LlmCallUpdateWithWhereUniqueWithoutChatInput[] - updateMany?: Prisma.LlmCallUpdateManyWithWhereWithoutChatInput | Prisma.LlmCallUpdateManyWithWhereWithoutChatInput[] - deleteMany?: Prisma.LlmCallScalarWhereInput | Prisma.LlmCallScalarWhereInput[] -} - -export type LlmCallUncheckedUpdateManyWithoutChatNestedInput = { - create?: Prisma.XOR | Prisma.LlmCallCreateWithoutChatInput[] | Prisma.LlmCallUncheckedCreateWithoutChatInput[] - connectOrCreate?: Prisma.LlmCallCreateOrConnectWithoutChatInput | Prisma.LlmCallCreateOrConnectWithoutChatInput[] - upsert?: Prisma.LlmCallUpsertWithWhereUniqueWithoutChatInput | Prisma.LlmCallUpsertWithWhereUniqueWithoutChatInput[] - createMany?: Prisma.LlmCallCreateManyChatInputEnvelope - set?: Prisma.LlmCallWhereUniqueInput | Prisma.LlmCallWhereUniqueInput[] - disconnect?: Prisma.LlmCallWhereUniqueInput | Prisma.LlmCallWhereUniqueInput[] - delete?: Prisma.LlmCallWhereUniqueInput | Prisma.LlmCallWhereUniqueInput[] - connect?: Prisma.LlmCallWhereUniqueInput | Prisma.LlmCallWhereUniqueInput[] - update?: Prisma.LlmCallUpdateWithWhereUniqueWithoutChatInput | Prisma.LlmCallUpdateWithWhereUniqueWithoutChatInput[] - updateMany?: Prisma.LlmCallUpdateManyWithWhereWithoutChatInput | Prisma.LlmCallUpdateManyWithWhereWithoutChatInput[] - deleteMany?: Prisma.LlmCallScalarWhereInput | Prisma.LlmCallScalarWhereInput[] -} - -export type EnumProviderFieldUpdateOperationsInput = { - set?: $Enums.Provider -} - -export type NullableIntFieldUpdateOperationsInput = { - set?: number | null - increment?: number - decrement?: number - multiply?: number - divide?: number -} - -export type LlmCallCreateWithoutChatInput = { - id?: string - createdAt?: Date | string - provider: $Enums.Provider - model: string - request: Prisma.JsonNullValueInput | runtime.InputJsonValue - response?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - inputTokens?: number | null - outputTokens?: number | null - totalTokens?: number | null - latencyMs?: number | null - error?: string | null -} - -export type LlmCallUncheckedCreateWithoutChatInput = { - id?: string - createdAt?: Date | string - provider: $Enums.Provider - model: string - request: Prisma.JsonNullValueInput | runtime.InputJsonValue - response?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - inputTokens?: number | null - outputTokens?: number | null - totalTokens?: number | null - latencyMs?: number | null - error?: string | null -} - -export type LlmCallCreateOrConnectWithoutChatInput = { - where: Prisma.LlmCallWhereUniqueInput - create: Prisma.XOR -} - -export type LlmCallCreateManyChatInputEnvelope = { - data: Prisma.LlmCallCreateManyChatInput | Prisma.LlmCallCreateManyChatInput[] -} - -export type LlmCallUpsertWithWhereUniqueWithoutChatInput = { - where: Prisma.LlmCallWhereUniqueInput - update: Prisma.XOR - create: Prisma.XOR -} - -export type LlmCallUpdateWithWhereUniqueWithoutChatInput = { - where: Prisma.LlmCallWhereUniqueInput - data: Prisma.XOR -} - -export type LlmCallUpdateManyWithWhereWithoutChatInput = { - where: Prisma.LlmCallScalarWhereInput - data: Prisma.XOR -} - -export type LlmCallScalarWhereInput = { - AND?: Prisma.LlmCallScalarWhereInput | Prisma.LlmCallScalarWhereInput[] - OR?: Prisma.LlmCallScalarWhereInput[] - NOT?: Prisma.LlmCallScalarWhereInput | Prisma.LlmCallScalarWhereInput[] - id?: Prisma.StringFilter<"LlmCall"> | string - createdAt?: Prisma.DateTimeFilter<"LlmCall"> | Date | string - chatId?: Prisma.StringFilter<"LlmCall"> | string - provider?: Prisma.EnumProviderFilter<"LlmCall"> | $Enums.Provider - model?: Prisma.StringFilter<"LlmCall"> | string - request?: Prisma.JsonFilter<"LlmCall"> - response?: Prisma.JsonNullableFilter<"LlmCall"> - inputTokens?: Prisma.IntNullableFilter<"LlmCall"> | number | null - outputTokens?: Prisma.IntNullableFilter<"LlmCall"> | number | null - totalTokens?: Prisma.IntNullableFilter<"LlmCall"> | number | null - latencyMs?: Prisma.IntNullableFilter<"LlmCall"> | number | null - error?: Prisma.StringNullableFilter<"LlmCall"> | string | null -} - -export type LlmCallCreateManyChatInput = { - id?: string - createdAt?: Date | string - provider: $Enums.Provider - model: string - request: Prisma.JsonNullValueInput | runtime.InputJsonValue - response?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - inputTokens?: number | null - outputTokens?: number | null - totalTokens?: number | null - latencyMs?: number | null - error?: string | null -} - -export type LlmCallUpdateWithoutChatInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - provider?: Prisma.EnumProviderFieldUpdateOperationsInput | $Enums.Provider - model?: Prisma.StringFieldUpdateOperationsInput | string - request?: Prisma.JsonNullValueInput | runtime.InputJsonValue - response?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - inputTokens?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - outputTokens?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - totalTokens?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - latencyMs?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - error?: Prisma.NullableStringFieldUpdateOperationsInput | string | null -} - -export type LlmCallUncheckedUpdateWithoutChatInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - provider?: Prisma.EnumProviderFieldUpdateOperationsInput | $Enums.Provider - model?: Prisma.StringFieldUpdateOperationsInput | string - request?: Prisma.JsonNullValueInput | runtime.InputJsonValue - response?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - inputTokens?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - outputTokens?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - totalTokens?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - latencyMs?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - error?: Prisma.NullableStringFieldUpdateOperationsInput | string | null -} - -export type LlmCallUncheckedUpdateManyWithoutChatInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - provider?: Prisma.EnumProviderFieldUpdateOperationsInput | $Enums.Provider - model?: Prisma.StringFieldUpdateOperationsInput | string - request?: Prisma.JsonNullValueInput | runtime.InputJsonValue - response?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - inputTokens?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - outputTokens?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - totalTokens?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - latencyMs?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - error?: Prisma.NullableStringFieldUpdateOperationsInput | string | null -} - - - -export type LlmCallSelect = runtime.Types.Extensions.GetSelect<{ - id?: boolean - createdAt?: boolean - chatId?: boolean - provider?: boolean - model?: boolean - request?: boolean - response?: boolean - inputTokens?: boolean - outputTokens?: boolean - totalTokens?: boolean - latencyMs?: boolean - error?: boolean - chat?: boolean | Prisma.ChatDefaultArgs -}, ExtArgs["result"]["llmCall"]> - -export type LlmCallSelectCreateManyAndReturn = runtime.Types.Extensions.GetSelect<{ - id?: boolean - createdAt?: boolean - chatId?: boolean - provider?: boolean - model?: boolean - request?: boolean - response?: boolean - inputTokens?: boolean - outputTokens?: boolean - totalTokens?: boolean - latencyMs?: boolean - error?: boolean - chat?: boolean | Prisma.ChatDefaultArgs -}, ExtArgs["result"]["llmCall"]> - -export type LlmCallSelectUpdateManyAndReturn = runtime.Types.Extensions.GetSelect<{ - id?: boolean - createdAt?: boolean - chatId?: boolean - provider?: boolean - model?: boolean - request?: boolean - response?: boolean - inputTokens?: boolean - outputTokens?: boolean - totalTokens?: boolean - latencyMs?: boolean - error?: boolean - chat?: boolean | Prisma.ChatDefaultArgs -}, ExtArgs["result"]["llmCall"]> - -export type LlmCallSelectScalar = { - id?: boolean - createdAt?: boolean - chatId?: boolean - provider?: boolean - model?: boolean - request?: boolean - response?: boolean - inputTokens?: boolean - outputTokens?: boolean - totalTokens?: boolean - latencyMs?: boolean - error?: boolean -} - -export type LlmCallOmit = runtime.Types.Extensions.GetOmit<"id" | "createdAt" | "chatId" | "provider" | "model" | "request" | "response" | "inputTokens" | "outputTokens" | "totalTokens" | "latencyMs" | "error", ExtArgs["result"]["llmCall"]> -export type LlmCallInclude = { - chat?: boolean | Prisma.ChatDefaultArgs -} -export type LlmCallIncludeCreateManyAndReturn = { - chat?: boolean | Prisma.ChatDefaultArgs -} -export type LlmCallIncludeUpdateManyAndReturn = { - chat?: boolean | Prisma.ChatDefaultArgs -} - -export type $LlmCallPayload = { - name: "LlmCall" - objects: { - chat: Prisma.$ChatPayload - } - scalars: runtime.Types.Extensions.GetPayloadResult<{ - id: string - createdAt: Date - chatId: string - provider: $Enums.Provider - model: string - request: runtime.JsonValue - response: runtime.JsonValue | null - inputTokens: number | null - outputTokens: number | null - totalTokens: number | null - latencyMs: number | null - error: string | null - }, ExtArgs["result"]["llmCall"]> - composites: {} -} - -export type LlmCallGetPayload = runtime.Types.Result.GetResult - -export type LlmCallCountArgs = - Omit & { - select?: LlmCallCountAggregateInputType | true - } - -export interface LlmCallDelegate { - [K: symbol]: { types: Prisma.TypeMap['model']['LlmCall'], meta: { name: 'LlmCall' } } - /** - * Find zero or one LlmCall that matches the filter. - * @param {LlmCallFindUniqueArgs} args - Arguments to find a LlmCall - * @example - * // Get one LlmCall - * const llmCall = await prisma.llmCall.findUnique({ - * where: { - * // ... provide filter here - * } - * }) - */ - findUnique(args: Prisma.SelectSubset>): Prisma.Prisma__LlmCallClient, T, "findUnique", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> - - /** - * Find one LlmCall that matches the filter or throw an error with `error.code='P2025'` - * if no matches were found. - * @param {LlmCallFindUniqueOrThrowArgs} args - Arguments to find a LlmCall - * @example - * // Get one LlmCall - * const llmCall = await prisma.llmCall.findUniqueOrThrow({ - * where: { - * // ... provide filter here - * } - * }) - */ - findUniqueOrThrow(args: Prisma.SelectSubset>): Prisma.Prisma__LlmCallClient, T, "findUniqueOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> - - /** - * Find the first LlmCall that matches the filter. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {LlmCallFindFirstArgs} args - Arguments to find a LlmCall - * @example - * // Get one LlmCall - * const llmCall = await prisma.llmCall.findFirst({ - * where: { - * // ... provide filter here - * } - * }) - */ - findFirst(args?: Prisma.SelectSubset>): Prisma.Prisma__LlmCallClient, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> - - /** - * Find the first LlmCall that matches the filter or - * throw `PrismaKnownClientError` with `P2025` code if no matches were found. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {LlmCallFindFirstOrThrowArgs} args - Arguments to find a LlmCall - * @example - * // Get one LlmCall - * const llmCall = await prisma.llmCall.findFirstOrThrow({ - * where: { - * // ... provide filter here - * } - * }) - */ - findFirstOrThrow(args?: Prisma.SelectSubset>): Prisma.Prisma__LlmCallClient, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> - - /** - * Find zero or more LlmCalls that matches the filter. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {LlmCallFindManyArgs} args - Arguments to filter and select certain fields only. - * @example - * // Get all LlmCalls - * const llmCalls = await prisma.llmCall.findMany() - * - * // Get first 10 LlmCalls - * const llmCalls = await prisma.llmCall.findMany({ take: 10 }) - * - * // Only select the `id` - * const llmCallWithIdOnly = await prisma.llmCall.findMany({ select: { id: true } }) - * - */ - findMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions>> - - /** - * Create a LlmCall. - * @param {LlmCallCreateArgs} args - Arguments to create a LlmCall. - * @example - * // Create one LlmCall - * const LlmCall = await prisma.llmCall.create({ - * data: { - * // ... data to create a LlmCall - * } - * }) - * - */ - create(args: Prisma.SelectSubset>): Prisma.Prisma__LlmCallClient, T, "create", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> - - /** - * Create many LlmCalls. - * @param {LlmCallCreateManyArgs} args - Arguments to create many LlmCalls. - * @example - * // Create many LlmCalls - * const llmCall = await prisma.llmCall.createMany({ - * data: [ - * // ... provide data here - * ] - * }) - * - */ - createMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise - - /** - * Create many LlmCalls and returns the data saved in the database. - * @param {LlmCallCreateManyAndReturnArgs} args - Arguments to create many LlmCalls. - * @example - * // Create many LlmCalls - * const llmCall = await prisma.llmCall.createManyAndReturn({ - * data: [ - * // ... provide data here - * ] - * }) - * - * // Create many LlmCalls and only return the `id` - * const llmCallWithIdOnly = await prisma.llmCall.createManyAndReturn({ - * select: { id: true }, - * data: [ - * // ... provide data here - * ] - * }) - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * - */ - createManyAndReturn(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "createManyAndReturn", GlobalOmitOptions>> - - /** - * Delete a LlmCall. - * @param {LlmCallDeleteArgs} args - Arguments to delete one LlmCall. - * @example - * // Delete one LlmCall - * const LlmCall = await prisma.llmCall.delete({ - * where: { - * // ... filter to delete one LlmCall - * } - * }) - * - */ - delete(args: Prisma.SelectSubset>): Prisma.Prisma__LlmCallClient, T, "delete", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> - - /** - * Update one LlmCall. - * @param {LlmCallUpdateArgs} args - Arguments to update one LlmCall. - * @example - * // Update one LlmCall - * const llmCall = await prisma.llmCall.update({ - * where: { - * // ... provide filter here - * }, - * data: { - * // ... provide data here - * } - * }) - * - */ - update(args: Prisma.SelectSubset>): Prisma.Prisma__LlmCallClient, T, "update", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> - - /** - * Delete zero or more LlmCalls. - * @param {LlmCallDeleteManyArgs} args - Arguments to filter LlmCalls to delete. - * @example - * // Delete a few LlmCalls - * const { count } = await prisma.llmCall.deleteMany({ - * where: { - * // ... provide filter here - * } - * }) - * - */ - deleteMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise - - /** - * Update zero or more LlmCalls. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {LlmCallUpdateManyArgs} args - Arguments to update one or more rows. - * @example - * // Update many LlmCalls - * const llmCall = await prisma.llmCall.updateMany({ - * where: { - * // ... provide filter here - * }, - * data: { - * // ... provide data here - * } - * }) - * - */ - updateMany(args: Prisma.SelectSubset>): Prisma.PrismaPromise - - /** - * Update zero or more LlmCalls and returns the data updated in the database. - * @param {LlmCallUpdateManyAndReturnArgs} args - Arguments to update many LlmCalls. - * @example - * // Update many LlmCalls - * const llmCall = await prisma.llmCall.updateManyAndReturn({ - * where: { - * // ... provide filter here - * }, - * data: [ - * // ... provide data here - * ] - * }) - * - * // Update zero or more LlmCalls and only return the `id` - * const llmCallWithIdOnly = await prisma.llmCall.updateManyAndReturn({ - * select: { id: true }, - * where: { - * // ... provide filter here - * }, - * data: [ - * // ... provide data here - * ] - * }) - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * - */ - updateManyAndReturn(args: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "updateManyAndReturn", GlobalOmitOptions>> - - /** - * Create or update one LlmCall. - * @param {LlmCallUpsertArgs} args - Arguments to update or create a LlmCall. - * @example - * // Update or create a LlmCall - * const llmCall = await prisma.llmCall.upsert({ - * create: { - * // ... data to create a LlmCall - * }, - * update: { - * // ... in case it already exists, update - * }, - * where: { - * // ... the filter for the LlmCall we want to update - * } - * }) - */ - upsert(args: Prisma.SelectSubset>): Prisma.Prisma__LlmCallClient, T, "upsert", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> - - - /** - * Count the number of LlmCalls. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {LlmCallCountArgs} args - Arguments to filter LlmCalls to count. - * @example - * // Count the number of LlmCalls - * const count = await prisma.llmCall.count({ - * where: { - * // ... the filter for the LlmCalls we want to count - * } - * }) - **/ - count( - args?: Prisma.Subset, - ): Prisma.PrismaPromise< - T extends runtime.Types.Utils.Record<'select', any> - ? T['select'] extends true - ? number - : Prisma.GetScalarType - : number - > - - /** - * Allows you to perform aggregations operations on a LlmCall. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {LlmCallAggregateArgs} args - Select which aggregations you would like to apply and on what fields. - * @example - * // Ordered by age ascending - * // Where email contains prisma.io - * // Limited to the 10 users - * const aggregations = await prisma.user.aggregate({ - * _avg: { - * age: true, - * }, - * where: { - * email: { - * contains: "prisma.io", - * }, - * }, - * orderBy: { - * age: "asc", - * }, - * take: 10, - * }) - **/ - aggregate(args: Prisma.Subset): Prisma.PrismaPromise> - - /** - * Group by LlmCall. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {LlmCallGroupByArgs} args - Group by arguments. - * @example - * // Group by city, order by createdAt, get count - * const result = await prisma.user.groupBy({ - * by: ['city', 'createdAt'], - * orderBy: { - * createdAt: true - * }, - * _count: { - * _all: true - * }, - * }) - * - **/ - groupBy< - T extends LlmCallGroupByArgs, - HasSelectOrTake extends Prisma.Or< - Prisma.Extends<'skip', Prisma.Keys>, - Prisma.Extends<'take', Prisma.Keys> - >, - OrderByArg extends Prisma.True extends HasSelectOrTake - ? { orderBy: LlmCallGroupByArgs['orderBy'] } - : { orderBy?: LlmCallGroupByArgs['orderBy'] }, - OrderFields extends Prisma.ExcludeUnderscoreKeys>>, - ByFields extends Prisma.MaybeTupleToUnion, - ByValid extends Prisma.Has, - HavingFields extends Prisma.GetHavingFields, - HavingValid extends Prisma.Has, - ByEmpty extends T['by'] extends never[] ? Prisma.True : Prisma.False, - InputErrors extends ByEmpty extends Prisma.True - ? `Error: "by" must not be empty.` - : HavingValid extends Prisma.False - ? { - [P in HavingFields]: P extends ByFields - ? never - : P extends string - ? `Error: Field "${P}" used in "having" needs to be provided in "by".` - : [ - Error, - 'Field ', - P, - ` in "having" needs to be provided in "by"`, - ] - }[HavingFields] - : 'take' extends Prisma.Keys - ? 'orderBy' extends Prisma.Keys - ? ByValid extends Prisma.True - ? {} - : { - [P in OrderFields]: P extends ByFields - ? never - : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` - }[OrderFields] - : 'Error: If you provide "take", you also need to provide "orderBy"' - : 'skip' extends Prisma.Keys - ? 'orderBy' extends Prisma.Keys - ? ByValid extends Prisma.True - ? {} - : { - [P in OrderFields]: P extends ByFields - ? never - : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` - }[OrderFields] - : 'Error: If you provide "skip", you also need to provide "orderBy"' - : ByValid extends Prisma.True - ? {} - : { - [P in OrderFields]: P extends ByFields - ? never - : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` - }[OrderFields] - >(args: Prisma.SubsetIntersection & InputErrors): {} extends InputErrors ? GetLlmCallGroupByPayload : Prisma.PrismaPromise -/** - * Fields of the LlmCall model - */ -readonly fields: LlmCallFieldRefs; -} - -/** - * The delegate class that acts as a "Promise-like" for LlmCall. - * Why is this prefixed with `Prisma__`? - * Because we want to prevent naming conflicts as mentioned in - * https://github.com/prisma/prisma-client-js/issues/707 - */ -export interface Prisma__LlmCallClient extends Prisma.PrismaPromise { - readonly [Symbol.toStringTag]: "PrismaPromise" - chat = {}>(args?: Prisma.Subset>): Prisma.Prisma__ChatClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise - /** - * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The - * resolved value cannot be modified from the callback. - * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected). - * @returns A Promise for the completion of the callback. - */ - finally(onfinally?: (() => void) | undefined | null): runtime.Types.Utils.JsPromise -} - - - - -/** - * Fields of the LlmCall model - */ -export interface LlmCallFieldRefs { - readonly id: Prisma.FieldRef<"LlmCall", 'String'> - readonly createdAt: Prisma.FieldRef<"LlmCall", 'DateTime'> - readonly chatId: Prisma.FieldRef<"LlmCall", 'String'> - readonly provider: Prisma.FieldRef<"LlmCall", 'Provider'> - readonly model: Prisma.FieldRef<"LlmCall", 'String'> - readonly request: Prisma.FieldRef<"LlmCall", 'Json'> - readonly response: Prisma.FieldRef<"LlmCall", 'Json'> - readonly inputTokens: Prisma.FieldRef<"LlmCall", 'Int'> - readonly outputTokens: Prisma.FieldRef<"LlmCall", 'Int'> - readonly totalTokens: Prisma.FieldRef<"LlmCall", 'Int'> - readonly latencyMs: Prisma.FieldRef<"LlmCall", 'Int'> - readonly error: Prisma.FieldRef<"LlmCall", 'String'> -} - - -// Custom InputTypes -/** - * LlmCall findUnique - */ -export type LlmCallFindUniqueArgs = { - /** - * Select specific fields to fetch from the LlmCall - */ - select?: Prisma.LlmCallSelect | null - /** - * Omit specific fields from the LlmCall - */ - omit?: Prisma.LlmCallOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.LlmCallInclude | null - /** - * Filter, which LlmCall to fetch. - */ - where: Prisma.LlmCallWhereUniqueInput -} - -/** - * LlmCall findUniqueOrThrow - */ -export type LlmCallFindUniqueOrThrowArgs = { - /** - * Select specific fields to fetch from the LlmCall - */ - select?: Prisma.LlmCallSelect | null - /** - * Omit specific fields from the LlmCall - */ - omit?: Prisma.LlmCallOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.LlmCallInclude | null - /** - * Filter, which LlmCall to fetch. - */ - where: Prisma.LlmCallWhereUniqueInput -} - -/** - * LlmCall findFirst - */ -export type LlmCallFindFirstArgs = { - /** - * Select specific fields to fetch from the LlmCall - */ - select?: Prisma.LlmCallSelect | null - /** - * Omit specific fields from the LlmCall - */ - omit?: Prisma.LlmCallOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.LlmCallInclude | null - /** - * Filter, which LlmCall to fetch. - */ - where?: Prisma.LlmCallWhereInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} - * - * Determine the order of LlmCalls to fetch. - */ - orderBy?: Prisma.LlmCallOrderByWithRelationInput | Prisma.LlmCallOrderByWithRelationInput[] - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} - * - * Sets the position for searching for LlmCalls. - */ - cursor?: Prisma.LlmCallWhereUniqueInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Take `±n` LlmCalls from the position of the cursor. - */ - take?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Skip the first `n` LlmCalls. - */ - skip?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} - * - * Filter by unique combinations of LlmCalls. - */ - distinct?: Prisma.LlmCallScalarFieldEnum | Prisma.LlmCallScalarFieldEnum[] -} - -/** - * LlmCall findFirstOrThrow - */ -export type LlmCallFindFirstOrThrowArgs = { - /** - * Select specific fields to fetch from the LlmCall - */ - select?: Prisma.LlmCallSelect | null - /** - * Omit specific fields from the LlmCall - */ - omit?: Prisma.LlmCallOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.LlmCallInclude | null - /** - * Filter, which LlmCall to fetch. - */ - where?: Prisma.LlmCallWhereInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} - * - * Determine the order of LlmCalls to fetch. - */ - orderBy?: Prisma.LlmCallOrderByWithRelationInput | Prisma.LlmCallOrderByWithRelationInput[] - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} - * - * Sets the position for searching for LlmCalls. - */ - cursor?: Prisma.LlmCallWhereUniqueInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Take `±n` LlmCalls from the position of the cursor. - */ - take?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Skip the first `n` LlmCalls. - */ - skip?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} - * - * Filter by unique combinations of LlmCalls. - */ - distinct?: Prisma.LlmCallScalarFieldEnum | Prisma.LlmCallScalarFieldEnum[] -} - -/** - * LlmCall findMany - */ -export type LlmCallFindManyArgs = { - /** - * Select specific fields to fetch from the LlmCall - */ - select?: Prisma.LlmCallSelect | null - /** - * Omit specific fields from the LlmCall - */ - omit?: Prisma.LlmCallOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.LlmCallInclude | null - /** - * Filter, which LlmCalls to fetch. - */ - where?: Prisma.LlmCallWhereInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} - * - * Determine the order of LlmCalls to fetch. - */ - orderBy?: Prisma.LlmCallOrderByWithRelationInput | Prisma.LlmCallOrderByWithRelationInput[] - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} - * - * Sets the position for listing LlmCalls. - */ - cursor?: Prisma.LlmCallWhereUniqueInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Take `±n` LlmCalls from the position of the cursor. - */ - take?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Skip the first `n` LlmCalls. - */ - skip?: number - distinct?: Prisma.LlmCallScalarFieldEnum | Prisma.LlmCallScalarFieldEnum[] -} - -/** - * LlmCall create - */ -export type LlmCallCreateArgs = { - /** - * Select specific fields to fetch from the LlmCall - */ - select?: Prisma.LlmCallSelect | null - /** - * Omit specific fields from the LlmCall - */ - omit?: Prisma.LlmCallOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.LlmCallInclude | null - /** - * The data needed to create a LlmCall. - */ - data: Prisma.XOR -} - -/** - * LlmCall createMany - */ -export type LlmCallCreateManyArgs = { - /** - * The data used to create many LlmCalls. - */ - data: Prisma.LlmCallCreateManyInput | Prisma.LlmCallCreateManyInput[] -} - -/** - * LlmCall createManyAndReturn - */ -export type LlmCallCreateManyAndReturnArgs = { - /** - * Select specific fields to fetch from the LlmCall - */ - select?: Prisma.LlmCallSelectCreateManyAndReturn | null - /** - * Omit specific fields from the LlmCall - */ - omit?: Prisma.LlmCallOmit | null - /** - * The data used to create many LlmCalls. - */ - data: Prisma.LlmCallCreateManyInput | Prisma.LlmCallCreateManyInput[] - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.LlmCallIncludeCreateManyAndReturn | null -} - -/** - * LlmCall update - */ -export type LlmCallUpdateArgs = { - /** - * Select specific fields to fetch from the LlmCall - */ - select?: Prisma.LlmCallSelect | null - /** - * Omit specific fields from the LlmCall - */ - omit?: Prisma.LlmCallOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.LlmCallInclude | null - /** - * The data needed to update a LlmCall. - */ - data: Prisma.XOR - /** - * Choose, which LlmCall to update. - */ - where: Prisma.LlmCallWhereUniqueInput -} - -/** - * LlmCall updateMany - */ -export type LlmCallUpdateManyArgs = { - /** - * The data used to update LlmCalls. - */ - data: Prisma.XOR - /** - * Filter which LlmCalls to update - */ - where?: Prisma.LlmCallWhereInput - /** - * Limit how many LlmCalls to update. - */ - limit?: number -} - -/** - * LlmCall updateManyAndReturn - */ -export type LlmCallUpdateManyAndReturnArgs = { - /** - * Select specific fields to fetch from the LlmCall - */ - select?: Prisma.LlmCallSelectUpdateManyAndReturn | null - /** - * Omit specific fields from the LlmCall - */ - omit?: Prisma.LlmCallOmit | null - /** - * The data used to update LlmCalls. - */ - data: Prisma.XOR - /** - * Filter which LlmCalls to update - */ - where?: Prisma.LlmCallWhereInput - /** - * Limit how many LlmCalls to update. - */ - limit?: number - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.LlmCallIncludeUpdateManyAndReturn | null -} - -/** - * LlmCall upsert - */ -export type LlmCallUpsertArgs = { - /** - * Select specific fields to fetch from the LlmCall - */ - select?: Prisma.LlmCallSelect | null - /** - * Omit specific fields from the LlmCall - */ - omit?: Prisma.LlmCallOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.LlmCallInclude | null - /** - * The filter to search for the LlmCall to update in case it exists. - */ - where: Prisma.LlmCallWhereUniqueInput - /** - * In case the LlmCall found by the `where` argument doesn't exist, create a new LlmCall with this data. - */ - create: Prisma.XOR - /** - * In case the LlmCall was found with the provided `where` argument, update it with this data. - */ - update: Prisma.XOR -} - -/** - * LlmCall delete - */ -export type LlmCallDeleteArgs = { - /** - * Select specific fields to fetch from the LlmCall - */ - select?: Prisma.LlmCallSelect | null - /** - * Omit specific fields from the LlmCall - */ - omit?: Prisma.LlmCallOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.LlmCallInclude | null - /** - * Filter which LlmCall to delete. - */ - where: Prisma.LlmCallWhereUniqueInput -} - -/** - * LlmCall deleteMany - */ -export type LlmCallDeleteManyArgs = { - /** - * Filter which LlmCalls to delete - */ - where?: Prisma.LlmCallWhereInput - /** - * Limit how many LlmCalls to delete. - */ - limit?: number -} - -/** - * LlmCall without action - */ -export type LlmCallDefaultArgs = { - /** - * Select specific fields to fetch from the LlmCall - */ - select?: Prisma.LlmCallSelect | null - /** - * Omit specific fields from the LlmCall - */ - omit?: Prisma.LlmCallOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.LlmCallInclude | null -} diff --git a/generated/prisma/models/Message.ts b/generated/prisma/models/Message.ts deleted file mode 100644 index 2d7050b..0000000 --- a/generated/prisma/models/Message.ts +++ /dev/null @@ -1,1405 +0,0 @@ - -/* !!! This is code generated by Prisma. Do not edit directly. !!! */ -/* eslint-disable */ -// biome-ignore-all lint: generated file -// @ts-nocheck -/* - * This file exports the `Message` model and its related types. - * - * 🟢 You can import this file directly. - */ -import type * as runtime from "@prisma/client/runtime/client" -import type * as $Enums from "../enums.js" -import type * as Prisma from "../internal/prismaNamespace.js" - -/** - * Model Message - * - */ -export type MessageModel = runtime.Types.Result.DefaultSelection - -export type AggregateMessage = { - _count: MessageCountAggregateOutputType | null - _min: MessageMinAggregateOutputType | null - _max: MessageMaxAggregateOutputType | null -} - -export type MessageMinAggregateOutputType = { - id: string | null - createdAt: Date | null - chatId: string | null - role: $Enums.MessageRole | null - content: string | null - name: string | null -} - -export type MessageMaxAggregateOutputType = { - id: string | null - createdAt: Date | null - chatId: string | null - role: $Enums.MessageRole | null - content: string | null - name: string | null -} - -export type MessageCountAggregateOutputType = { - id: number - createdAt: number - chatId: number - role: number - content: number - name: number - metadata: number - _all: number -} - - -export type MessageMinAggregateInputType = { - id?: true - createdAt?: true - chatId?: true - role?: true - content?: true - name?: true -} - -export type MessageMaxAggregateInputType = { - id?: true - createdAt?: true - chatId?: true - role?: true - content?: true - name?: true -} - -export type MessageCountAggregateInputType = { - id?: true - createdAt?: true - chatId?: true - role?: true - content?: true - name?: true - metadata?: true - _all?: true -} - -export type MessageAggregateArgs = { - /** - * Filter which Message to aggregate. - */ - where?: Prisma.MessageWhereInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} - * - * Determine the order of Messages to fetch. - */ - orderBy?: Prisma.MessageOrderByWithRelationInput | Prisma.MessageOrderByWithRelationInput[] - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} - * - * Sets the start position - */ - cursor?: Prisma.MessageWhereUniqueInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Take `±n` Messages from the position of the cursor. - */ - take?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Skip the first `n` Messages. - */ - skip?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} - * - * Count returned Messages - **/ - _count?: true | MessageCountAggregateInputType - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} - * - * Select which fields to find the minimum value - **/ - _min?: MessageMinAggregateInputType - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} - * - * Select which fields to find the maximum value - **/ - _max?: MessageMaxAggregateInputType -} - -export type GetMessageAggregateType = { - [P in keyof T & keyof AggregateMessage]: P extends '_count' | 'count' - ? T[P] extends true - ? number - : Prisma.GetScalarType - : Prisma.GetScalarType -} - - - - -export type MessageGroupByArgs = { - where?: Prisma.MessageWhereInput - orderBy?: Prisma.MessageOrderByWithAggregationInput | Prisma.MessageOrderByWithAggregationInput[] - by: Prisma.MessageScalarFieldEnum[] | Prisma.MessageScalarFieldEnum - having?: Prisma.MessageScalarWhereWithAggregatesInput - take?: number - skip?: number - _count?: MessageCountAggregateInputType | true - _min?: MessageMinAggregateInputType - _max?: MessageMaxAggregateInputType -} - -export type MessageGroupByOutputType = { - id: string - createdAt: Date - chatId: string - role: $Enums.MessageRole - content: string - name: string | null - metadata: runtime.JsonValue | null - _count: MessageCountAggregateOutputType | null - _min: MessageMinAggregateOutputType | null - _max: MessageMaxAggregateOutputType | null -} - -type GetMessageGroupByPayload = Prisma.PrismaPromise< - Array< - Prisma.PickEnumerable & - { - [P in ((keyof T) & (keyof MessageGroupByOutputType))]: P extends '_count' - ? T[P] extends boolean - ? number - : Prisma.GetScalarType - : Prisma.GetScalarType - } - > - > - - - -export type MessageWhereInput = { - AND?: Prisma.MessageWhereInput | Prisma.MessageWhereInput[] - OR?: Prisma.MessageWhereInput[] - NOT?: Prisma.MessageWhereInput | Prisma.MessageWhereInput[] - id?: Prisma.StringFilter<"Message"> | string - createdAt?: Prisma.DateTimeFilter<"Message"> | Date | string - chatId?: Prisma.StringFilter<"Message"> | string - role?: Prisma.EnumMessageRoleFilter<"Message"> | $Enums.MessageRole - content?: Prisma.StringFilter<"Message"> | string - name?: Prisma.StringNullableFilter<"Message"> | string | null - metadata?: Prisma.JsonNullableFilter<"Message"> - chat?: Prisma.XOR -} - -export type MessageOrderByWithRelationInput = { - id?: Prisma.SortOrder - createdAt?: Prisma.SortOrder - chatId?: Prisma.SortOrder - role?: Prisma.SortOrder - content?: Prisma.SortOrder - name?: Prisma.SortOrderInput | Prisma.SortOrder - metadata?: Prisma.SortOrderInput | Prisma.SortOrder - chat?: Prisma.ChatOrderByWithRelationInput -} - -export type MessageWhereUniqueInput = Prisma.AtLeast<{ - id?: string - AND?: Prisma.MessageWhereInput | Prisma.MessageWhereInput[] - OR?: Prisma.MessageWhereInput[] - NOT?: Prisma.MessageWhereInput | Prisma.MessageWhereInput[] - createdAt?: Prisma.DateTimeFilter<"Message"> | Date | string - chatId?: Prisma.StringFilter<"Message"> | string - role?: Prisma.EnumMessageRoleFilter<"Message"> | $Enums.MessageRole - content?: Prisma.StringFilter<"Message"> | string - name?: Prisma.StringNullableFilter<"Message"> | string | null - metadata?: Prisma.JsonNullableFilter<"Message"> - chat?: Prisma.XOR -}, "id"> - -export type MessageOrderByWithAggregationInput = { - id?: Prisma.SortOrder - createdAt?: Prisma.SortOrder - chatId?: Prisma.SortOrder - role?: Prisma.SortOrder - content?: Prisma.SortOrder - name?: Prisma.SortOrderInput | Prisma.SortOrder - metadata?: Prisma.SortOrderInput | Prisma.SortOrder - _count?: Prisma.MessageCountOrderByAggregateInput - _max?: Prisma.MessageMaxOrderByAggregateInput - _min?: Prisma.MessageMinOrderByAggregateInput -} - -export type MessageScalarWhereWithAggregatesInput = { - AND?: Prisma.MessageScalarWhereWithAggregatesInput | Prisma.MessageScalarWhereWithAggregatesInput[] - OR?: Prisma.MessageScalarWhereWithAggregatesInput[] - NOT?: Prisma.MessageScalarWhereWithAggregatesInput | Prisma.MessageScalarWhereWithAggregatesInput[] - id?: Prisma.StringWithAggregatesFilter<"Message"> | string - createdAt?: Prisma.DateTimeWithAggregatesFilter<"Message"> | Date | string - chatId?: Prisma.StringWithAggregatesFilter<"Message"> | string - role?: Prisma.EnumMessageRoleWithAggregatesFilter<"Message"> | $Enums.MessageRole - content?: Prisma.StringWithAggregatesFilter<"Message"> | string - name?: Prisma.StringNullableWithAggregatesFilter<"Message"> | string | null - metadata?: Prisma.JsonNullableWithAggregatesFilter<"Message"> -} - -export type MessageCreateInput = { - id?: string - createdAt?: Date | string - role: $Enums.MessageRole - content: string - name?: string | null - metadata?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - chat: Prisma.ChatCreateNestedOneWithoutMessagesInput -} - -export type MessageUncheckedCreateInput = { - id?: string - createdAt?: Date | string - chatId: string - role: $Enums.MessageRole - content: string - name?: string | null - metadata?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue -} - -export type MessageUpdateInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - role?: Prisma.EnumMessageRoleFieldUpdateOperationsInput | $Enums.MessageRole - content?: Prisma.StringFieldUpdateOperationsInput | string - name?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - metadata?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - chat?: Prisma.ChatUpdateOneRequiredWithoutMessagesNestedInput -} - -export type MessageUncheckedUpdateInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - chatId?: Prisma.StringFieldUpdateOperationsInput | string - role?: Prisma.EnumMessageRoleFieldUpdateOperationsInput | $Enums.MessageRole - content?: Prisma.StringFieldUpdateOperationsInput | string - name?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - metadata?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue -} - -export type MessageCreateManyInput = { - id?: string - createdAt?: Date | string - chatId: string - role: $Enums.MessageRole - content: string - name?: string | null - metadata?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue -} - -export type MessageUpdateManyMutationInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - role?: Prisma.EnumMessageRoleFieldUpdateOperationsInput | $Enums.MessageRole - content?: Prisma.StringFieldUpdateOperationsInput | string - name?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - metadata?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue -} - -export type MessageUncheckedUpdateManyInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - chatId?: Prisma.StringFieldUpdateOperationsInput | string - role?: Prisma.EnumMessageRoleFieldUpdateOperationsInput | $Enums.MessageRole - content?: Prisma.StringFieldUpdateOperationsInput | string - name?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - metadata?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue -} - -export type MessageListRelationFilter = { - every?: Prisma.MessageWhereInput - some?: Prisma.MessageWhereInput - none?: Prisma.MessageWhereInput -} - -export type MessageOrderByRelationAggregateInput = { - _count?: Prisma.SortOrder -} - -export type MessageCountOrderByAggregateInput = { - id?: Prisma.SortOrder - createdAt?: Prisma.SortOrder - chatId?: Prisma.SortOrder - role?: Prisma.SortOrder - content?: Prisma.SortOrder - name?: Prisma.SortOrder - metadata?: Prisma.SortOrder -} - -export type MessageMaxOrderByAggregateInput = { - id?: Prisma.SortOrder - createdAt?: Prisma.SortOrder - chatId?: Prisma.SortOrder - role?: Prisma.SortOrder - content?: Prisma.SortOrder - name?: Prisma.SortOrder -} - -export type MessageMinOrderByAggregateInput = { - id?: Prisma.SortOrder - createdAt?: Prisma.SortOrder - chatId?: Prisma.SortOrder - role?: Prisma.SortOrder - content?: Prisma.SortOrder - name?: Prisma.SortOrder -} - -export type MessageCreateNestedManyWithoutChatInput = { - create?: Prisma.XOR | Prisma.MessageCreateWithoutChatInput[] | Prisma.MessageUncheckedCreateWithoutChatInput[] - connectOrCreate?: Prisma.MessageCreateOrConnectWithoutChatInput | Prisma.MessageCreateOrConnectWithoutChatInput[] - createMany?: Prisma.MessageCreateManyChatInputEnvelope - connect?: Prisma.MessageWhereUniqueInput | Prisma.MessageWhereUniqueInput[] -} - -export type MessageUncheckedCreateNestedManyWithoutChatInput = { - create?: Prisma.XOR | Prisma.MessageCreateWithoutChatInput[] | Prisma.MessageUncheckedCreateWithoutChatInput[] - connectOrCreate?: Prisma.MessageCreateOrConnectWithoutChatInput | Prisma.MessageCreateOrConnectWithoutChatInput[] - createMany?: Prisma.MessageCreateManyChatInputEnvelope - connect?: Prisma.MessageWhereUniqueInput | Prisma.MessageWhereUniqueInput[] -} - -export type MessageUpdateManyWithoutChatNestedInput = { - create?: Prisma.XOR | Prisma.MessageCreateWithoutChatInput[] | Prisma.MessageUncheckedCreateWithoutChatInput[] - connectOrCreate?: Prisma.MessageCreateOrConnectWithoutChatInput | Prisma.MessageCreateOrConnectWithoutChatInput[] - upsert?: Prisma.MessageUpsertWithWhereUniqueWithoutChatInput | Prisma.MessageUpsertWithWhereUniqueWithoutChatInput[] - createMany?: Prisma.MessageCreateManyChatInputEnvelope - set?: Prisma.MessageWhereUniqueInput | Prisma.MessageWhereUniqueInput[] - disconnect?: Prisma.MessageWhereUniqueInput | Prisma.MessageWhereUniqueInput[] - delete?: Prisma.MessageWhereUniqueInput | Prisma.MessageWhereUniqueInput[] - connect?: Prisma.MessageWhereUniqueInput | Prisma.MessageWhereUniqueInput[] - update?: Prisma.MessageUpdateWithWhereUniqueWithoutChatInput | Prisma.MessageUpdateWithWhereUniqueWithoutChatInput[] - updateMany?: Prisma.MessageUpdateManyWithWhereWithoutChatInput | Prisma.MessageUpdateManyWithWhereWithoutChatInput[] - deleteMany?: Prisma.MessageScalarWhereInput | Prisma.MessageScalarWhereInput[] -} - -export type MessageUncheckedUpdateManyWithoutChatNestedInput = { - create?: Prisma.XOR | Prisma.MessageCreateWithoutChatInput[] | Prisma.MessageUncheckedCreateWithoutChatInput[] - connectOrCreate?: Prisma.MessageCreateOrConnectWithoutChatInput | Prisma.MessageCreateOrConnectWithoutChatInput[] - upsert?: Prisma.MessageUpsertWithWhereUniqueWithoutChatInput | Prisma.MessageUpsertWithWhereUniqueWithoutChatInput[] - createMany?: Prisma.MessageCreateManyChatInputEnvelope - set?: Prisma.MessageWhereUniqueInput | Prisma.MessageWhereUniqueInput[] - disconnect?: Prisma.MessageWhereUniqueInput | Prisma.MessageWhereUniqueInput[] - delete?: Prisma.MessageWhereUniqueInput | Prisma.MessageWhereUniqueInput[] - connect?: Prisma.MessageWhereUniqueInput | Prisma.MessageWhereUniqueInput[] - update?: Prisma.MessageUpdateWithWhereUniqueWithoutChatInput | Prisma.MessageUpdateWithWhereUniqueWithoutChatInput[] - updateMany?: Prisma.MessageUpdateManyWithWhereWithoutChatInput | Prisma.MessageUpdateManyWithWhereWithoutChatInput[] - deleteMany?: Prisma.MessageScalarWhereInput | Prisma.MessageScalarWhereInput[] -} - -export type EnumMessageRoleFieldUpdateOperationsInput = { - set?: $Enums.MessageRole -} - -export type MessageCreateWithoutChatInput = { - id?: string - createdAt?: Date | string - role: $Enums.MessageRole - content: string - name?: string | null - metadata?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue -} - -export type MessageUncheckedCreateWithoutChatInput = { - id?: string - createdAt?: Date | string - role: $Enums.MessageRole - content: string - name?: string | null - metadata?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue -} - -export type MessageCreateOrConnectWithoutChatInput = { - where: Prisma.MessageWhereUniqueInput - create: Prisma.XOR -} - -export type MessageCreateManyChatInputEnvelope = { - data: Prisma.MessageCreateManyChatInput | Prisma.MessageCreateManyChatInput[] -} - -export type MessageUpsertWithWhereUniqueWithoutChatInput = { - where: Prisma.MessageWhereUniqueInput - update: Prisma.XOR - create: Prisma.XOR -} - -export type MessageUpdateWithWhereUniqueWithoutChatInput = { - where: Prisma.MessageWhereUniqueInput - data: Prisma.XOR -} - -export type MessageUpdateManyWithWhereWithoutChatInput = { - where: Prisma.MessageScalarWhereInput - data: Prisma.XOR -} - -export type MessageScalarWhereInput = { - AND?: Prisma.MessageScalarWhereInput | Prisma.MessageScalarWhereInput[] - OR?: Prisma.MessageScalarWhereInput[] - NOT?: Prisma.MessageScalarWhereInput | Prisma.MessageScalarWhereInput[] - id?: Prisma.StringFilter<"Message"> | string - createdAt?: Prisma.DateTimeFilter<"Message"> | Date | string - chatId?: Prisma.StringFilter<"Message"> | string - role?: Prisma.EnumMessageRoleFilter<"Message"> | $Enums.MessageRole - content?: Prisma.StringFilter<"Message"> | string - name?: Prisma.StringNullableFilter<"Message"> | string | null - metadata?: Prisma.JsonNullableFilter<"Message"> -} - -export type MessageCreateManyChatInput = { - id?: string - createdAt?: Date | string - role: $Enums.MessageRole - content: string - name?: string | null - metadata?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue -} - -export type MessageUpdateWithoutChatInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - role?: Prisma.EnumMessageRoleFieldUpdateOperationsInput | $Enums.MessageRole - content?: Prisma.StringFieldUpdateOperationsInput | string - name?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - metadata?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue -} - -export type MessageUncheckedUpdateWithoutChatInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - role?: Prisma.EnumMessageRoleFieldUpdateOperationsInput | $Enums.MessageRole - content?: Prisma.StringFieldUpdateOperationsInput | string - name?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - metadata?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue -} - -export type MessageUncheckedUpdateManyWithoutChatInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - role?: Prisma.EnumMessageRoleFieldUpdateOperationsInput | $Enums.MessageRole - content?: Prisma.StringFieldUpdateOperationsInput | string - name?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - metadata?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue -} - - - -export type MessageSelect = runtime.Types.Extensions.GetSelect<{ - id?: boolean - createdAt?: boolean - chatId?: boolean - role?: boolean - content?: boolean - name?: boolean - metadata?: boolean - chat?: boolean | Prisma.ChatDefaultArgs -}, ExtArgs["result"]["message"]> - -export type MessageSelectCreateManyAndReturn = runtime.Types.Extensions.GetSelect<{ - id?: boolean - createdAt?: boolean - chatId?: boolean - role?: boolean - content?: boolean - name?: boolean - metadata?: boolean - chat?: boolean | Prisma.ChatDefaultArgs -}, ExtArgs["result"]["message"]> - -export type MessageSelectUpdateManyAndReturn = runtime.Types.Extensions.GetSelect<{ - id?: boolean - createdAt?: boolean - chatId?: boolean - role?: boolean - content?: boolean - name?: boolean - metadata?: boolean - chat?: boolean | Prisma.ChatDefaultArgs -}, ExtArgs["result"]["message"]> - -export type MessageSelectScalar = { - id?: boolean - createdAt?: boolean - chatId?: boolean - role?: boolean - content?: boolean - name?: boolean - metadata?: boolean -} - -export type MessageOmit = runtime.Types.Extensions.GetOmit<"id" | "createdAt" | "chatId" | "role" | "content" | "name" | "metadata", ExtArgs["result"]["message"]> -export type MessageInclude = { - chat?: boolean | Prisma.ChatDefaultArgs -} -export type MessageIncludeCreateManyAndReturn = { - chat?: boolean | Prisma.ChatDefaultArgs -} -export type MessageIncludeUpdateManyAndReturn = { - chat?: boolean | Prisma.ChatDefaultArgs -} - -export type $MessagePayload = { - name: "Message" - objects: { - chat: Prisma.$ChatPayload - } - scalars: runtime.Types.Extensions.GetPayloadResult<{ - id: string - createdAt: Date - chatId: string - role: $Enums.MessageRole - content: string - name: string | null - metadata: runtime.JsonValue | null - }, ExtArgs["result"]["message"]> - composites: {} -} - -export type MessageGetPayload = runtime.Types.Result.GetResult - -export type MessageCountArgs = - Omit & { - select?: MessageCountAggregateInputType | true - } - -export interface MessageDelegate { - [K: symbol]: { types: Prisma.TypeMap['model']['Message'], meta: { name: 'Message' } } - /** - * Find zero or one Message that matches the filter. - * @param {MessageFindUniqueArgs} args - Arguments to find a Message - * @example - * // Get one Message - * const message = await prisma.message.findUnique({ - * where: { - * // ... provide filter here - * } - * }) - */ - findUnique(args: Prisma.SelectSubset>): Prisma.Prisma__MessageClient, T, "findUnique", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> - - /** - * Find one Message that matches the filter or throw an error with `error.code='P2025'` - * if no matches were found. - * @param {MessageFindUniqueOrThrowArgs} args - Arguments to find a Message - * @example - * // Get one Message - * const message = await prisma.message.findUniqueOrThrow({ - * where: { - * // ... provide filter here - * } - * }) - */ - findUniqueOrThrow(args: Prisma.SelectSubset>): Prisma.Prisma__MessageClient, T, "findUniqueOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> - - /** - * Find the first Message that matches the filter. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {MessageFindFirstArgs} args - Arguments to find a Message - * @example - * // Get one Message - * const message = await prisma.message.findFirst({ - * where: { - * // ... provide filter here - * } - * }) - */ - findFirst(args?: Prisma.SelectSubset>): Prisma.Prisma__MessageClient, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> - - /** - * Find the first Message that matches the filter or - * throw `PrismaKnownClientError` with `P2025` code if no matches were found. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {MessageFindFirstOrThrowArgs} args - Arguments to find a Message - * @example - * // Get one Message - * const message = await prisma.message.findFirstOrThrow({ - * where: { - * // ... provide filter here - * } - * }) - */ - findFirstOrThrow(args?: Prisma.SelectSubset>): Prisma.Prisma__MessageClient, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> - - /** - * Find zero or more Messages that matches the filter. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {MessageFindManyArgs} args - Arguments to filter and select certain fields only. - * @example - * // Get all Messages - * const messages = await prisma.message.findMany() - * - * // Get first 10 Messages - * const messages = await prisma.message.findMany({ take: 10 }) - * - * // Only select the `id` - * const messageWithIdOnly = await prisma.message.findMany({ select: { id: true } }) - * - */ - findMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions>> - - /** - * Create a Message. - * @param {MessageCreateArgs} args - Arguments to create a Message. - * @example - * // Create one Message - * const Message = await prisma.message.create({ - * data: { - * // ... data to create a Message - * } - * }) - * - */ - create(args: Prisma.SelectSubset>): Prisma.Prisma__MessageClient, T, "create", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> - - /** - * Create many Messages. - * @param {MessageCreateManyArgs} args - Arguments to create many Messages. - * @example - * // Create many Messages - * const message = await prisma.message.createMany({ - * data: [ - * // ... provide data here - * ] - * }) - * - */ - createMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise - - /** - * Create many Messages and returns the data saved in the database. - * @param {MessageCreateManyAndReturnArgs} args - Arguments to create many Messages. - * @example - * // Create many Messages - * const message = await prisma.message.createManyAndReturn({ - * data: [ - * // ... provide data here - * ] - * }) - * - * // Create many Messages and only return the `id` - * const messageWithIdOnly = await prisma.message.createManyAndReturn({ - * select: { id: true }, - * data: [ - * // ... provide data here - * ] - * }) - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * - */ - createManyAndReturn(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "createManyAndReturn", GlobalOmitOptions>> - - /** - * Delete a Message. - * @param {MessageDeleteArgs} args - Arguments to delete one Message. - * @example - * // Delete one Message - * const Message = await prisma.message.delete({ - * where: { - * // ... filter to delete one Message - * } - * }) - * - */ - delete(args: Prisma.SelectSubset>): Prisma.Prisma__MessageClient, T, "delete", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> - - /** - * Update one Message. - * @param {MessageUpdateArgs} args - Arguments to update one Message. - * @example - * // Update one Message - * const message = await prisma.message.update({ - * where: { - * // ... provide filter here - * }, - * data: { - * // ... provide data here - * } - * }) - * - */ - update(args: Prisma.SelectSubset>): Prisma.Prisma__MessageClient, T, "update", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> - - /** - * Delete zero or more Messages. - * @param {MessageDeleteManyArgs} args - Arguments to filter Messages to delete. - * @example - * // Delete a few Messages - * const { count } = await prisma.message.deleteMany({ - * where: { - * // ... provide filter here - * } - * }) - * - */ - deleteMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise - - /** - * Update zero or more Messages. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {MessageUpdateManyArgs} args - Arguments to update one or more rows. - * @example - * // Update many Messages - * const message = await prisma.message.updateMany({ - * where: { - * // ... provide filter here - * }, - * data: { - * // ... provide data here - * } - * }) - * - */ - updateMany(args: Prisma.SelectSubset>): Prisma.PrismaPromise - - /** - * Update zero or more Messages and returns the data updated in the database. - * @param {MessageUpdateManyAndReturnArgs} args - Arguments to update many Messages. - * @example - * // Update many Messages - * const message = await prisma.message.updateManyAndReturn({ - * where: { - * // ... provide filter here - * }, - * data: [ - * // ... provide data here - * ] - * }) - * - * // Update zero or more Messages and only return the `id` - * const messageWithIdOnly = await prisma.message.updateManyAndReturn({ - * select: { id: true }, - * where: { - * // ... provide filter here - * }, - * data: [ - * // ... provide data here - * ] - * }) - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * - */ - updateManyAndReturn(args: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "updateManyAndReturn", GlobalOmitOptions>> - - /** - * Create or update one Message. - * @param {MessageUpsertArgs} args - Arguments to update or create a Message. - * @example - * // Update or create a Message - * const message = await prisma.message.upsert({ - * create: { - * // ... data to create a Message - * }, - * update: { - * // ... in case it already exists, update - * }, - * where: { - * // ... the filter for the Message we want to update - * } - * }) - */ - upsert(args: Prisma.SelectSubset>): Prisma.Prisma__MessageClient, T, "upsert", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> - - - /** - * Count the number of Messages. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {MessageCountArgs} args - Arguments to filter Messages to count. - * @example - * // Count the number of Messages - * const count = await prisma.message.count({ - * where: { - * // ... the filter for the Messages we want to count - * } - * }) - **/ - count( - args?: Prisma.Subset, - ): Prisma.PrismaPromise< - T extends runtime.Types.Utils.Record<'select', any> - ? T['select'] extends true - ? number - : Prisma.GetScalarType - : number - > - - /** - * Allows you to perform aggregations operations on a Message. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {MessageAggregateArgs} args - Select which aggregations you would like to apply and on what fields. - * @example - * // Ordered by age ascending - * // Where email contains prisma.io - * // Limited to the 10 users - * const aggregations = await prisma.user.aggregate({ - * _avg: { - * age: true, - * }, - * where: { - * email: { - * contains: "prisma.io", - * }, - * }, - * orderBy: { - * age: "asc", - * }, - * take: 10, - * }) - **/ - aggregate(args: Prisma.Subset): Prisma.PrismaPromise> - - /** - * Group by Message. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {MessageGroupByArgs} args - Group by arguments. - * @example - * // Group by city, order by createdAt, get count - * const result = await prisma.user.groupBy({ - * by: ['city', 'createdAt'], - * orderBy: { - * createdAt: true - * }, - * _count: { - * _all: true - * }, - * }) - * - **/ - groupBy< - T extends MessageGroupByArgs, - HasSelectOrTake extends Prisma.Or< - Prisma.Extends<'skip', Prisma.Keys>, - Prisma.Extends<'take', Prisma.Keys> - >, - OrderByArg extends Prisma.True extends HasSelectOrTake - ? { orderBy: MessageGroupByArgs['orderBy'] } - : { orderBy?: MessageGroupByArgs['orderBy'] }, - OrderFields extends Prisma.ExcludeUnderscoreKeys>>, - ByFields extends Prisma.MaybeTupleToUnion, - ByValid extends Prisma.Has, - HavingFields extends Prisma.GetHavingFields, - HavingValid extends Prisma.Has, - ByEmpty extends T['by'] extends never[] ? Prisma.True : Prisma.False, - InputErrors extends ByEmpty extends Prisma.True - ? `Error: "by" must not be empty.` - : HavingValid extends Prisma.False - ? { - [P in HavingFields]: P extends ByFields - ? never - : P extends string - ? `Error: Field "${P}" used in "having" needs to be provided in "by".` - : [ - Error, - 'Field ', - P, - ` in "having" needs to be provided in "by"`, - ] - }[HavingFields] - : 'take' extends Prisma.Keys - ? 'orderBy' extends Prisma.Keys - ? ByValid extends Prisma.True - ? {} - : { - [P in OrderFields]: P extends ByFields - ? never - : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` - }[OrderFields] - : 'Error: If you provide "take", you also need to provide "orderBy"' - : 'skip' extends Prisma.Keys - ? 'orderBy' extends Prisma.Keys - ? ByValid extends Prisma.True - ? {} - : { - [P in OrderFields]: P extends ByFields - ? never - : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` - }[OrderFields] - : 'Error: If you provide "skip", you also need to provide "orderBy"' - : ByValid extends Prisma.True - ? {} - : { - [P in OrderFields]: P extends ByFields - ? never - : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` - }[OrderFields] - >(args: Prisma.SubsetIntersection & InputErrors): {} extends InputErrors ? GetMessageGroupByPayload : Prisma.PrismaPromise -/** - * Fields of the Message model - */ -readonly fields: MessageFieldRefs; -} - -/** - * The delegate class that acts as a "Promise-like" for Message. - * Why is this prefixed with `Prisma__`? - * Because we want to prevent naming conflicts as mentioned in - * https://github.com/prisma/prisma-client-js/issues/707 - */ -export interface Prisma__MessageClient extends Prisma.PrismaPromise { - readonly [Symbol.toStringTag]: "PrismaPromise" - chat = {}>(args?: Prisma.Subset>): Prisma.Prisma__ChatClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise - /** - * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The - * resolved value cannot be modified from the callback. - * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected). - * @returns A Promise for the completion of the callback. - */ - finally(onfinally?: (() => void) | undefined | null): runtime.Types.Utils.JsPromise -} - - - - -/** - * Fields of the Message model - */ -export interface MessageFieldRefs { - readonly id: Prisma.FieldRef<"Message", 'String'> - readonly createdAt: Prisma.FieldRef<"Message", 'DateTime'> - readonly chatId: Prisma.FieldRef<"Message", 'String'> - readonly role: Prisma.FieldRef<"Message", 'MessageRole'> - readonly content: Prisma.FieldRef<"Message", 'String'> - readonly name: Prisma.FieldRef<"Message", 'String'> - readonly metadata: Prisma.FieldRef<"Message", 'Json'> -} - - -// Custom InputTypes -/** - * Message findUnique - */ -export type MessageFindUniqueArgs = { - /** - * Select specific fields to fetch from the Message - */ - select?: Prisma.MessageSelect | null - /** - * Omit specific fields from the Message - */ - omit?: Prisma.MessageOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.MessageInclude | null - /** - * Filter, which Message to fetch. - */ - where: Prisma.MessageWhereUniqueInput -} - -/** - * Message findUniqueOrThrow - */ -export type MessageFindUniqueOrThrowArgs = { - /** - * Select specific fields to fetch from the Message - */ - select?: Prisma.MessageSelect | null - /** - * Omit specific fields from the Message - */ - omit?: Prisma.MessageOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.MessageInclude | null - /** - * Filter, which Message to fetch. - */ - where: Prisma.MessageWhereUniqueInput -} - -/** - * Message findFirst - */ -export type MessageFindFirstArgs = { - /** - * Select specific fields to fetch from the Message - */ - select?: Prisma.MessageSelect | null - /** - * Omit specific fields from the Message - */ - omit?: Prisma.MessageOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.MessageInclude | null - /** - * Filter, which Message to fetch. - */ - where?: Prisma.MessageWhereInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} - * - * Determine the order of Messages to fetch. - */ - orderBy?: Prisma.MessageOrderByWithRelationInput | Prisma.MessageOrderByWithRelationInput[] - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} - * - * Sets the position for searching for Messages. - */ - cursor?: Prisma.MessageWhereUniqueInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Take `±n` Messages from the position of the cursor. - */ - take?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Skip the first `n` Messages. - */ - skip?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} - * - * Filter by unique combinations of Messages. - */ - distinct?: Prisma.MessageScalarFieldEnum | Prisma.MessageScalarFieldEnum[] -} - -/** - * Message findFirstOrThrow - */ -export type MessageFindFirstOrThrowArgs = { - /** - * Select specific fields to fetch from the Message - */ - select?: Prisma.MessageSelect | null - /** - * Omit specific fields from the Message - */ - omit?: Prisma.MessageOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.MessageInclude | null - /** - * Filter, which Message to fetch. - */ - where?: Prisma.MessageWhereInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} - * - * Determine the order of Messages to fetch. - */ - orderBy?: Prisma.MessageOrderByWithRelationInput | Prisma.MessageOrderByWithRelationInput[] - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} - * - * Sets the position for searching for Messages. - */ - cursor?: Prisma.MessageWhereUniqueInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Take `±n` Messages from the position of the cursor. - */ - take?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Skip the first `n` Messages. - */ - skip?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} - * - * Filter by unique combinations of Messages. - */ - distinct?: Prisma.MessageScalarFieldEnum | Prisma.MessageScalarFieldEnum[] -} - -/** - * Message findMany - */ -export type MessageFindManyArgs = { - /** - * Select specific fields to fetch from the Message - */ - select?: Prisma.MessageSelect | null - /** - * Omit specific fields from the Message - */ - omit?: Prisma.MessageOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.MessageInclude | null - /** - * Filter, which Messages to fetch. - */ - where?: Prisma.MessageWhereInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} - * - * Determine the order of Messages to fetch. - */ - orderBy?: Prisma.MessageOrderByWithRelationInput | Prisma.MessageOrderByWithRelationInput[] - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} - * - * Sets the position for listing Messages. - */ - cursor?: Prisma.MessageWhereUniqueInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Take `±n` Messages from the position of the cursor. - */ - take?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Skip the first `n` Messages. - */ - skip?: number - distinct?: Prisma.MessageScalarFieldEnum | Prisma.MessageScalarFieldEnum[] -} - -/** - * Message create - */ -export type MessageCreateArgs = { - /** - * Select specific fields to fetch from the Message - */ - select?: Prisma.MessageSelect | null - /** - * Omit specific fields from the Message - */ - omit?: Prisma.MessageOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.MessageInclude | null - /** - * The data needed to create a Message. - */ - data: Prisma.XOR -} - -/** - * Message createMany - */ -export type MessageCreateManyArgs = { - /** - * The data used to create many Messages. - */ - data: Prisma.MessageCreateManyInput | Prisma.MessageCreateManyInput[] -} - -/** - * Message createManyAndReturn - */ -export type MessageCreateManyAndReturnArgs = { - /** - * Select specific fields to fetch from the Message - */ - select?: Prisma.MessageSelectCreateManyAndReturn | null - /** - * Omit specific fields from the Message - */ - omit?: Prisma.MessageOmit | null - /** - * The data used to create many Messages. - */ - data: Prisma.MessageCreateManyInput | Prisma.MessageCreateManyInput[] - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.MessageIncludeCreateManyAndReturn | null -} - -/** - * Message update - */ -export type MessageUpdateArgs = { - /** - * Select specific fields to fetch from the Message - */ - select?: Prisma.MessageSelect | null - /** - * Omit specific fields from the Message - */ - omit?: Prisma.MessageOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.MessageInclude | null - /** - * The data needed to update a Message. - */ - data: Prisma.XOR - /** - * Choose, which Message to update. - */ - where: Prisma.MessageWhereUniqueInput -} - -/** - * Message updateMany - */ -export type MessageUpdateManyArgs = { - /** - * The data used to update Messages. - */ - data: Prisma.XOR - /** - * Filter which Messages to update - */ - where?: Prisma.MessageWhereInput - /** - * Limit how many Messages to update. - */ - limit?: number -} - -/** - * Message updateManyAndReturn - */ -export type MessageUpdateManyAndReturnArgs = { - /** - * Select specific fields to fetch from the Message - */ - select?: Prisma.MessageSelectUpdateManyAndReturn | null - /** - * Omit specific fields from the Message - */ - omit?: Prisma.MessageOmit | null - /** - * The data used to update Messages. - */ - data: Prisma.XOR - /** - * Filter which Messages to update - */ - where?: Prisma.MessageWhereInput - /** - * Limit how many Messages to update. - */ - limit?: number - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.MessageIncludeUpdateManyAndReturn | null -} - -/** - * Message upsert - */ -export type MessageUpsertArgs = { - /** - * Select specific fields to fetch from the Message - */ - select?: Prisma.MessageSelect | null - /** - * Omit specific fields from the Message - */ - omit?: Prisma.MessageOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.MessageInclude | null - /** - * The filter to search for the Message to update in case it exists. - */ - where: Prisma.MessageWhereUniqueInput - /** - * In case the Message found by the `where` argument doesn't exist, create a new Message with this data. - */ - create: Prisma.XOR - /** - * In case the Message was found with the provided `where` argument, update it with this data. - */ - update: Prisma.XOR -} - -/** - * Message delete - */ -export type MessageDeleteArgs = { - /** - * Select specific fields to fetch from the Message - */ - select?: Prisma.MessageSelect | null - /** - * Omit specific fields from the Message - */ - omit?: Prisma.MessageOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.MessageInclude | null - /** - * Filter which Message to delete. - */ - where: Prisma.MessageWhereUniqueInput -} - -/** - * Message deleteMany - */ -export type MessageDeleteManyArgs = { - /** - * Filter which Messages to delete - */ - where?: Prisma.MessageWhereInput - /** - * Limit how many Messages to delete. - */ - limit?: number -} - -/** - * Message without action - */ -export type MessageDefaultArgs = { - /** - * Select specific fields to fetch from the Message - */ - select?: Prisma.MessageSelect | null - /** - * Omit specific fields from the Message - */ - omit?: Prisma.MessageOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.MessageInclude | null -} diff --git a/generated/prisma/models/User.ts b/generated/prisma/models/User.ts deleted file mode 100644 index bbffe29..0000000 --- a/generated/prisma/models/User.ts +++ /dev/null @@ -1,1302 +0,0 @@ - -/* !!! This is code generated by Prisma. Do not edit directly. !!! */ -/* eslint-disable */ -// biome-ignore-all lint: generated file -// @ts-nocheck -/* - * This file exports the `User` model and its related types. - * - * 🟢 You can import this file directly. - */ -import type * as runtime from "@prisma/client/runtime/client" -import type * as $Enums from "../enums.js" -import type * as Prisma from "../internal/prismaNamespace.js" - -/** - * Model User - * - */ -export type UserModel = runtime.Types.Result.DefaultSelection - -export type AggregateUser = { - _count: UserCountAggregateOutputType | null - _min: UserMinAggregateOutputType | null - _max: UserMaxAggregateOutputType | null -} - -export type UserMinAggregateOutputType = { - id: string | null - createdAt: Date | null - updatedAt: Date | null - handle: string | null -} - -export type UserMaxAggregateOutputType = { - id: string | null - createdAt: Date | null - updatedAt: Date | null - handle: string | null -} - -export type UserCountAggregateOutputType = { - id: number - createdAt: number - updatedAt: number - handle: number - _all: number -} - - -export type UserMinAggregateInputType = { - id?: true - createdAt?: true - updatedAt?: true - handle?: true -} - -export type UserMaxAggregateInputType = { - id?: true - createdAt?: true - updatedAt?: true - handle?: true -} - -export type UserCountAggregateInputType = { - id?: true - createdAt?: true - updatedAt?: true - handle?: true - _all?: true -} - -export type UserAggregateArgs = { - /** - * Filter which User to aggregate. - */ - where?: Prisma.UserWhereInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} - * - * Determine the order of Users to fetch. - */ - orderBy?: Prisma.UserOrderByWithRelationInput | Prisma.UserOrderByWithRelationInput[] - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} - * - * Sets the start position - */ - cursor?: Prisma.UserWhereUniqueInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Take `±n` Users from the position of the cursor. - */ - take?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Skip the first `n` Users. - */ - skip?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} - * - * Count returned Users - **/ - _count?: true | UserCountAggregateInputType - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} - * - * Select which fields to find the minimum value - **/ - _min?: UserMinAggregateInputType - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} - * - * Select which fields to find the maximum value - **/ - _max?: UserMaxAggregateInputType -} - -export type GetUserAggregateType = { - [P in keyof T & keyof AggregateUser]: P extends '_count' | 'count' - ? T[P] extends true - ? number - : Prisma.GetScalarType - : Prisma.GetScalarType -} - - - - -export type UserGroupByArgs = { - where?: Prisma.UserWhereInput - orderBy?: Prisma.UserOrderByWithAggregationInput | Prisma.UserOrderByWithAggregationInput[] - by: Prisma.UserScalarFieldEnum[] | Prisma.UserScalarFieldEnum - having?: Prisma.UserScalarWhereWithAggregatesInput - take?: number - skip?: number - _count?: UserCountAggregateInputType | true - _min?: UserMinAggregateInputType - _max?: UserMaxAggregateInputType -} - -export type UserGroupByOutputType = { - id: string - createdAt: Date - updatedAt: Date - handle: string | null - _count: UserCountAggregateOutputType | null - _min: UserMinAggregateOutputType | null - _max: UserMaxAggregateOutputType | null -} - -type GetUserGroupByPayload = Prisma.PrismaPromise< - Array< - Prisma.PickEnumerable & - { - [P in ((keyof T) & (keyof UserGroupByOutputType))]: P extends '_count' - ? T[P] extends boolean - ? number - : Prisma.GetScalarType - : Prisma.GetScalarType - } - > - > - - - -export type UserWhereInput = { - AND?: Prisma.UserWhereInput | Prisma.UserWhereInput[] - OR?: Prisma.UserWhereInput[] - NOT?: Prisma.UserWhereInput | Prisma.UserWhereInput[] - id?: Prisma.StringFilter<"User"> | string - createdAt?: Prisma.DateTimeFilter<"User"> | Date | string - updatedAt?: Prisma.DateTimeFilter<"User"> | Date | string - handle?: Prisma.StringNullableFilter<"User"> | string | null - chats?: Prisma.ChatListRelationFilter -} - -export type UserOrderByWithRelationInput = { - id?: Prisma.SortOrder - createdAt?: Prisma.SortOrder - updatedAt?: Prisma.SortOrder - handle?: Prisma.SortOrderInput | Prisma.SortOrder - chats?: Prisma.ChatOrderByRelationAggregateInput -} - -export type UserWhereUniqueInput = Prisma.AtLeast<{ - id?: string - handle?: string - AND?: Prisma.UserWhereInput | Prisma.UserWhereInput[] - OR?: Prisma.UserWhereInput[] - NOT?: Prisma.UserWhereInput | Prisma.UserWhereInput[] - createdAt?: Prisma.DateTimeFilter<"User"> | Date | string - updatedAt?: Prisma.DateTimeFilter<"User"> | Date | string - chats?: Prisma.ChatListRelationFilter -}, "id" | "handle"> - -export type UserOrderByWithAggregationInput = { - id?: Prisma.SortOrder - createdAt?: Prisma.SortOrder - updatedAt?: Prisma.SortOrder - handle?: Prisma.SortOrderInput | Prisma.SortOrder - _count?: Prisma.UserCountOrderByAggregateInput - _max?: Prisma.UserMaxOrderByAggregateInput - _min?: Prisma.UserMinOrderByAggregateInput -} - -export type UserScalarWhereWithAggregatesInput = { - AND?: Prisma.UserScalarWhereWithAggregatesInput | Prisma.UserScalarWhereWithAggregatesInput[] - OR?: Prisma.UserScalarWhereWithAggregatesInput[] - NOT?: Prisma.UserScalarWhereWithAggregatesInput | Prisma.UserScalarWhereWithAggregatesInput[] - id?: Prisma.StringWithAggregatesFilter<"User"> | string - createdAt?: Prisma.DateTimeWithAggregatesFilter<"User"> | Date | string - updatedAt?: Prisma.DateTimeWithAggregatesFilter<"User"> | Date | string - handle?: Prisma.StringNullableWithAggregatesFilter<"User"> | string | null -} - -export type UserCreateInput = { - id?: string - createdAt?: Date | string - updatedAt?: Date | string - handle?: string | null - chats?: Prisma.ChatCreateNestedManyWithoutUserInput -} - -export type UserUncheckedCreateInput = { - id?: string - createdAt?: Date | string - updatedAt?: Date | string - handle?: string | null - chats?: Prisma.ChatUncheckedCreateNestedManyWithoutUserInput -} - -export type UserUpdateInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - handle?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - chats?: Prisma.ChatUpdateManyWithoutUserNestedInput -} - -export type UserUncheckedUpdateInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - handle?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - chats?: Prisma.ChatUncheckedUpdateManyWithoutUserNestedInput -} - -export type UserCreateManyInput = { - id?: string - createdAt?: Date | string - updatedAt?: Date | string - handle?: string | null -} - -export type UserUpdateManyMutationInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - handle?: Prisma.NullableStringFieldUpdateOperationsInput | string | null -} - -export type UserUncheckedUpdateManyInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - handle?: Prisma.NullableStringFieldUpdateOperationsInput | string | null -} - -export type UserCountOrderByAggregateInput = { - id?: Prisma.SortOrder - createdAt?: Prisma.SortOrder - updatedAt?: Prisma.SortOrder - handle?: Prisma.SortOrder -} - -export type UserMaxOrderByAggregateInput = { - id?: Prisma.SortOrder - createdAt?: Prisma.SortOrder - updatedAt?: Prisma.SortOrder - handle?: Prisma.SortOrder -} - -export type UserMinOrderByAggregateInput = { - id?: Prisma.SortOrder - createdAt?: Prisma.SortOrder - updatedAt?: Prisma.SortOrder - handle?: Prisma.SortOrder -} - -export type UserNullableScalarRelationFilter = { - is?: Prisma.UserWhereInput | null - isNot?: Prisma.UserWhereInput | null -} - -export type StringFieldUpdateOperationsInput = { - set?: string -} - -export type DateTimeFieldUpdateOperationsInput = { - set?: Date | string -} - -export type NullableStringFieldUpdateOperationsInput = { - set?: string | null -} - -export type UserCreateNestedOneWithoutChatsInput = { - create?: Prisma.XOR - connectOrCreate?: Prisma.UserCreateOrConnectWithoutChatsInput - connect?: Prisma.UserWhereUniqueInput -} - -export type UserUpdateOneWithoutChatsNestedInput = { - create?: Prisma.XOR - connectOrCreate?: Prisma.UserCreateOrConnectWithoutChatsInput - upsert?: Prisma.UserUpsertWithoutChatsInput - disconnect?: Prisma.UserWhereInput | boolean - delete?: Prisma.UserWhereInput | boolean - connect?: Prisma.UserWhereUniqueInput - update?: Prisma.XOR, Prisma.UserUncheckedUpdateWithoutChatsInput> -} - -export type UserCreateWithoutChatsInput = { - id?: string - createdAt?: Date | string - updatedAt?: Date | string - handle?: string | null -} - -export type UserUncheckedCreateWithoutChatsInput = { - id?: string - createdAt?: Date | string - updatedAt?: Date | string - handle?: string | null -} - -export type UserCreateOrConnectWithoutChatsInput = { - where: Prisma.UserWhereUniqueInput - create: Prisma.XOR -} - -export type UserUpsertWithoutChatsInput = { - update: Prisma.XOR - create: Prisma.XOR - where?: Prisma.UserWhereInput -} - -export type UserUpdateToOneWithWhereWithoutChatsInput = { - where?: Prisma.UserWhereInput - data: Prisma.XOR -} - -export type UserUpdateWithoutChatsInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - handle?: Prisma.NullableStringFieldUpdateOperationsInput | string | null -} - -export type UserUncheckedUpdateWithoutChatsInput = { - id?: Prisma.StringFieldUpdateOperationsInput | string - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - handle?: Prisma.NullableStringFieldUpdateOperationsInput | string | null -} - - -/** - * Count Type UserCountOutputType - */ - -export type UserCountOutputType = { - chats: number -} - -export type UserCountOutputTypeSelect = { - chats?: boolean | UserCountOutputTypeCountChatsArgs -} - -/** - * UserCountOutputType without action - */ -export type UserCountOutputTypeDefaultArgs = { - /** - * Select specific fields to fetch from the UserCountOutputType - */ - select?: Prisma.UserCountOutputTypeSelect | null -} - -/** - * UserCountOutputType without action - */ -export type UserCountOutputTypeCountChatsArgs = { - where?: Prisma.ChatWhereInput -} - - -export type UserSelect = runtime.Types.Extensions.GetSelect<{ - id?: boolean - createdAt?: boolean - updatedAt?: boolean - handle?: boolean - chats?: boolean | Prisma.User$chatsArgs - _count?: boolean | Prisma.UserCountOutputTypeDefaultArgs -}, ExtArgs["result"]["user"]> - -export type UserSelectCreateManyAndReturn = runtime.Types.Extensions.GetSelect<{ - id?: boolean - createdAt?: boolean - updatedAt?: boolean - handle?: boolean -}, ExtArgs["result"]["user"]> - -export type UserSelectUpdateManyAndReturn = runtime.Types.Extensions.GetSelect<{ - id?: boolean - createdAt?: boolean - updatedAt?: boolean - handle?: boolean -}, ExtArgs["result"]["user"]> - -export type UserSelectScalar = { - id?: boolean - createdAt?: boolean - updatedAt?: boolean - handle?: boolean -} - -export type UserOmit = runtime.Types.Extensions.GetOmit<"id" | "createdAt" | "updatedAt" | "handle", ExtArgs["result"]["user"]> -export type UserInclude = { - chats?: boolean | Prisma.User$chatsArgs - _count?: boolean | Prisma.UserCountOutputTypeDefaultArgs -} -export type UserIncludeCreateManyAndReturn = {} -export type UserIncludeUpdateManyAndReturn = {} - -export type $UserPayload = { - name: "User" - objects: { - chats: Prisma.$ChatPayload[] - } - scalars: runtime.Types.Extensions.GetPayloadResult<{ - id: string - createdAt: Date - updatedAt: Date - handle: string | null - }, ExtArgs["result"]["user"]> - composites: {} -} - -export type UserGetPayload = runtime.Types.Result.GetResult - -export type UserCountArgs = - Omit & { - select?: UserCountAggregateInputType | true - } - -export interface UserDelegate { - [K: symbol]: { types: Prisma.TypeMap['model']['User'], meta: { name: 'User' } } - /** - * Find zero or one User that matches the filter. - * @param {UserFindUniqueArgs} args - Arguments to find a User - * @example - * // Get one User - * const user = await prisma.user.findUnique({ - * where: { - * // ... provide filter here - * } - * }) - */ - findUnique(args: Prisma.SelectSubset>): Prisma.Prisma__UserClient, T, "findUnique", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> - - /** - * Find one User that matches the filter or throw an error with `error.code='P2025'` - * if no matches were found. - * @param {UserFindUniqueOrThrowArgs} args - Arguments to find a User - * @example - * // Get one User - * const user = await prisma.user.findUniqueOrThrow({ - * where: { - * // ... provide filter here - * } - * }) - */ - findUniqueOrThrow(args: Prisma.SelectSubset>): Prisma.Prisma__UserClient, T, "findUniqueOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> - - /** - * Find the first User that matches the filter. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {UserFindFirstArgs} args - Arguments to find a User - * @example - * // Get one User - * const user = await prisma.user.findFirst({ - * where: { - * // ... provide filter here - * } - * }) - */ - findFirst(args?: Prisma.SelectSubset>): Prisma.Prisma__UserClient, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> - - /** - * Find the first User that matches the filter or - * throw `PrismaKnownClientError` with `P2025` code if no matches were found. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {UserFindFirstOrThrowArgs} args - Arguments to find a User - * @example - * // Get one User - * const user = await prisma.user.findFirstOrThrow({ - * where: { - * // ... provide filter here - * } - * }) - */ - findFirstOrThrow(args?: Prisma.SelectSubset>): Prisma.Prisma__UserClient, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> - - /** - * Find zero or more Users that matches the filter. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {UserFindManyArgs} args - Arguments to filter and select certain fields only. - * @example - * // Get all Users - * const users = await prisma.user.findMany() - * - * // Get first 10 Users - * const users = await prisma.user.findMany({ take: 10 }) - * - * // Only select the `id` - * const userWithIdOnly = await prisma.user.findMany({ select: { id: true } }) - * - */ - findMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions>> - - /** - * Create a User. - * @param {UserCreateArgs} args - Arguments to create a User. - * @example - * // Create one User - * const User = await prisma.user.create({ - * data: { - * // ... data to create a User - * } - * }) - * - */ - create(args: Prisma.SelectSubset>): Prisma.Prisma__UserClient, T, "create", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> - - /** - * Create many Users. - * @param {UserCreateManyArgs} args - Arguments to create many Users. - * @example - * // Create many Users - * const user = await prisma.user.createMany({ - * data: [ - * // ... provide data here - * ] - * }) - * - */ - createMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise - - /** - * Create many Users and returns the data saved in the database. - * @param {UserCreateManyAndReturnArgs} args - Arguments to create many Users. - * @example - * // Create many Users - * const user = await prisma.user.createManyAndReturn({ - * data: [ - * // ... provide data here - * ] - * }) - * - * // Create many Users and only return the `id` - * const userWithIdOnly = await prisma.user.createManyAndReturn({ - * select: { id: true }, - * data: [ - * // ... provide data here - * ] - * }) - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * - */ - createManyAndReturn(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "createManyAndReturn", GlobalOmitOptions>> - - /** - * Delete a User. - * @param {UserDeleteArgs} args - Arguments to delete one User. - * @example - * // Delete one User - * const User = await prisma.user.delete({ - * where: { - * // ... filter to delete one User - * } - * }) - * - */ - delete(args: Prisma.SelectSubset>): Prisma.Prisma__UserClient, T, "delete", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> - - /** - * Update one User. - * @param {UserUpdateArgs} args - Arguments to update one User. - * @example - * // Update one User - * const user = await prisma.user.update({ - * where: { - * // ... provide filter here - * }, - * data: { - * // ... provide data here - * } - * }) - * - */ - update(args: Prisma.SelectSubset>): Prisma.Prisma__UserClient, T, "update", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> - - /** - * Delete zero or more Users. - * @param {UserDeleteManyArgs} args - Arguments to filter Users to delete. - * @example - * // Delete a few Users - * const { count } = await prisma.user.deleteMany({ - * where: { - * // ... provide filter here - * } - * }) - * - */ - deleteMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise - - /** - * Update zero or more Users. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {UserUpdateManyArgs} args - Arguments to update one or more rows. - * @example - * // Update many Users - * const user = await prisma.user.updateMany({ - * where: { - * // ... provide filter here - * }, - * data: { - * // ... provide data here - * } - * }) - * - */ - updateMany(args: Prisma.SelectSubset>): Prisma.PrismaPromise - - /** - * Update zero or more Users and returns the data updated in the database. - * @param {UserUpdateManyAndReturnArgs} args - Arguments to update many Users. - * @example - * // Update many Users - * const user = await prisma.user.updateManyAndReturn({ - * where: { - * // ... provide filter here - * }, - * data: [ - * // ... provide data here - * ] - * }) - * - * // Update zero or more Users and only return the `id` - * const userWithIdOnly = await prisma.user.updateManyAndReturn({ - * select: { id: true }, - * where: { - * // ... provide filter here - * }, - * data: [ - * // ... provide data here - * ] - * }) - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * - */ - updateManyAndReturn(args: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "updateManyAndReturn", GlobalOmitOptions>> - - /** - * Create or update one User. - * @param {UserUpsertArgs} args - Arguments to update or create a User. - * @example - * // Update or create a User - * const user = await prisma.user.upsert({ - * create: { - * // ... data to create a User - * }, - * update: { - * // ... in case it already exists, update - * }, - * where: { - * // ... the filter for the User we want to update - * } - * }) - */ - upsert(args: Prisma.SelectSubset>): Prisma.Prisma__UserClient, T, "upsert", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> - - - /** - * Count the number of Users. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {UserCountArgs} args - Arguments to filter Users to count. - * @example - * // Count the number of Users - * const count = await prisma.user.count({ - * where: { - * // ... the filter for the Users we want to count - * } - * }) - **/ - count( - args?: Prisma.Subset, - ): Prisma.PrismaPromise< - T extends runtime.Types.Utils.Record<'select', any> - ? T['select'] extends true - ? number - : Prisma.GetScalarType - : number - > - - /** - * Allows you to perform aggregations operations on a User. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {UserAggregateArgs} args - Select which aggregations you would like to apply and on what fields. - * @example - * // Ordered by age ascending - * // Where email contains prisma.io - * // Limited to the 10 users - * const aggregations = await prisma.user.aggregate({ - * _avg: { - * age: true, - * }, - * where: { - * email: { - * contains: "prisma.io", - * }, - * }, - * orderBy: { - * age: "asc", - * }, - * take: 10, - * }) - **/ - aggregate(args: Prisma.Subset): Prisma.PrismaPromise> - - /** - * Group by User. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {UserGroupByArgs} args - Group by arguments. - * @example - * // Group by city, order by createdAt, get count - * const result = await prisma.user.groupBy({ - * by: ['city', 'createdAt'], - * orderBy: { - * createdAt: true - * }, - * _count: { - * _all: true - * }, - * }) - * - **/ - groupBy< - T extends UserGroupByArgs, - HasSelectOrTake extends Prisma.Or< - Prisma.Extends<'skip', Prisma.Keys>, - Prisma.Extends<'take', Prisma.Keys> - >, - OrderByArg extends Prisma.True extends HasSelectOrTake - ? { orderBy: UserGroupByArgs['orderBy'] } - : { orderBy?: UserGroupByArgs['orderBy'] }, - OrderFields extends Prisma.ExcludeUnderscoreKeys>>, - ByFields extends Prisma.MaybeTupleToUnion, - ByValid extends Prisma.Has, - HavingFields extends Prisma.GetHavingFields, - HavingValid extends Prisma.Has, - ByEmpty extends T['by'] extends never[] ? Prisma.True : Prisma.False, - InputErrors extends ByEmpty extends Prisma.True - ? `Error: "by" must not be empty.` - : HavingValid extends Prisma.False - ? { - [P in HavingFields]: P extends ByFields - ? never - : P extends string - ? `Error: Field "${P}" used in "having" needs to be provided in "by".` - : [ - Error, - 'Field ', - P, - ` in "having" needs to be provided in "by"`, - ] - }[HavingFields] - : 'take' extends Prisma.Keys - ? 'orderBy' extends Prisma.Keys - ? ByValid extends Prisma.True - ? {} - : { - [P in OrderFields]: P extends ByFields - ? never - : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` - }[OrderFields] - : 'Error: If you provide "take", you also need to provide "orderBy"' - : 'skip' extends Prisma.Keys - ? 'orderBy' extends Prisma.Keys - ? ByValid extends Prisma.True - ? {} - : { - [P in OrderFields]: P extends ByFields - ? never - : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` - }[OrderFields] - : 'Error: If you provide "skip", you also need to provide "orderBy"' - : ByValid extends Prisma.True - ? {} - : { - [P in OrderFields]: P extends ByFields - ? never - : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` - }[OrderFields] - >(args: Prisma.SubsetIntersection & InputErrors): {} extends InputErrors ? GetUserGroupByPayload : Prisma.PrismaPromise -/** - * Fields of the User model - */ -readonly fields: UserFieldRefs; -} - -/** - * The delegate class that acts as a "Promise-like" for User. - * Why is this prefixed with `Prisma__`? - * Because we want to prevent naming conflicts as mentioned in - * https://github.com/prisma/prisma-client-js/issues/707 - */ -export interface Prisma__UserClient extends Prisma.PrismaPromise { - readonly [Symbol.toStringTag]: "PrismaPromise" - chats = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise - /** - * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The - * resolved value cannot be modified from the callback. - * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected). - * @returns A Promise for the completion of the callback. - */ - finally(onfinally?: (() => void) | undefined | null): runtime.Types.Utils.JsPromise -} - - - - -/** - * Fields of the User model - */ -export interface UserFieldRefs { - readonly id: Prisma.FieldRef<"User", 'String'> - readonly createdAt: Prisma.FieldRef<"User", 'DateTime'> - readonly updatedAt: Prisma.FieldRef<"User", 'DateTime'> - readonly handle: Prisma.FieldRef<"User", 'String'> -} - - -// Custom InputTypes -/** - * User findUnique - */ -export type UserFindUniqueArgs = { - /** - * Select specific fields to fetch from the User - */ - select?: Prisma.UserSelect | null - /** - * Omit specific fields from the User - */ - omit?: Prisma.UserOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.UserInclude | null - /** - * Filter, which User to fetch. - */ - where: Prisma.UserWhereUniqueInput -} - -/** - * User findUniqueOrThrow - */ -export type UserFindUniqueOrThrowArgs = { - /** - * Select specific fields to fetch from the User - */ - select?: Prisma.UserSelect | null - /** - * Omit specific fields from the User - */ - omit?: Prisma.UserOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.UserInclude | null - /** - * Filter, which User to fetch. - */ - where: Prisma.UserWhereUniqueInput -} - -/** - * User findFirst - */ -export type UserFindFirstArgs = { - /** - * Select specific fields to fetch from the User - */ - select?: Prisma.UserSelect | null - /** - * Omit specific fields from the User - */ - omit?: Prisma.UserOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.UserInclude | null - /** - * Filter, which User to fetch. - */ - where?: Prisma.UserWhereInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} - * - * Determine the order of Users to fetch. - */ - orderBy?: Prisma.UserOrderByWithRelationInput | Prisma.UserOrderByWithRelationInput[] - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} - * - * Sets the position for searching for Users. - */ - cursor?: Prisma.UserWhereUniqueInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Take `±n` Users from the position of the cursor. - */ - take?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Skip the first `n` Users. - */ - skip?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} - * - * Filter by unique combinations of Users. - */ - distinct?: Prisma.UserScalarFieldEnum | Prisma.UserScalarFieldEnum[] -} - -/** - * User findFirstOrThrow - */ -export type UserFindFirstOrThrowArgs = { - /** - * Select specific fields to fetch from the User - */ - select?: Prisma.UserSelect | null - /** - * Omit specific fields from the User - */ - omit?: Prisma.UserOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.UserInclude | null - /** - * Filter, which User to fetch. - */ - where?: Prisma.UserWhereInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} - * - * Determine the order of Users to fetch. - */ - orderBy?: Prisma.UserOrderByWithRelationInput | Prisma.UserOrderByWithRelationInput[] - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} - * - * Sets the position for searching for Users. - */ - cursor?: Prisma.UserWhereUniqueInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Take `±n` Users from the position of the cursor. - */ - take?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Skip the first `n` Users. - */ - skip?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} - * - * Filter by unique combinations of Users. - */ - distinct?: Prisma.UserScalarFieldEnum | Prisma.UserScalarFieldEnum[] -} - -/** - * User findMany - */ -export type UserFindManyArgs = { - /** - * Select specific fields to fetch from the User - */ - select?: Prisma.UserSelect | null - /** - * Omit specific fields from the User - */ - omit?: Prisma.UserOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.UserInclude | null - /** - * Filter, which Users to fetch. - */ - where?: Prisma.UserWhereInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} - * - * Determine the order of Users to fetch. - */ - orderBy?: Prisma.UserOrderByWithRelationInput | Prisma.UserOrderByWithRelationInput[] - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} - * - * Sets the position for listing Users. - */ - cursor?: Prisma.UserWhereUniqueInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Take `±n` Users from the position of the cursor. - */ - take?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Skip the first `n` Users. - */ - skip?: number - distinct?: Prisma.UserScalarFieldEnum | Prisma.UserScalarFieldEnum[] -} - -/** - * User create - */ -export type UserCreateArgs = { - /** - * Select specific fields to fetch from the User - */ - select?: Prisma.UserSelect | null - /** - * Omit specific fields from the User - */ - omit?: Prisma.UserOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.UserInclude | null - /** - * The data needed to create a User. - */ - data: Prisma.XOR -} - -/** - * User createMany - */ -export type UserCreateManyArgs = { - /** - * The data used to create many Users. - */ - data: Prisma.UserCreateManyInput | Prisma.UserCreateManyInput[] -} - -/** - * User createManyAndReturn - */ -export type UserCreateManyAndReturnArgs = { - /** - * Select specific fields to fetch from the User - */ - select?: Prisma.UserSelectCreateManyAndReturn | null - /** - * Omit specific fields from the User - */ - omit?: Prisma.UserOmit | null - /** - * The data used to create many Users. - */ - data: Prisma.UserCreateManyInput | Prisma.UserCreateManyInput[] -} - -/** - * User update - */ -export type UserUpdateArgs = { - /** - * Select specific fields to fetch from the User - */ - select?: Prisma.UserSelect | null - /** - * Omit specific fields from the User - */ - omit?: Prisma.UserOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.UserInclude | null - /** - * The data needed to update a User. - */ - data: Prisma.XOR - /** - * Choose, which User to update. - */ - where: Prisma.UserWhereUniqueInput -} - -/** - * User updateMany - */ -export type UserUpdateManyArgs = { - /** - * The data used to update Users. - */ - data: Prisma.XOR - /** - * Filter which Users to update - */ - where?: Prisma.UserWhereInput - /** - * Limit how many Users to update. - */ - limit?: number -} - -/** - * User updateManyAndReturn - */ -export type UserUpdateManyAndReturnArgs = { - /** - * Select specific fields to fetch from the User - */ - select?: Prisma.UserSelectUpdateManyAndReturn | null - /** - * Omit specific fields from the User - */ - omit?: Prisma.UserOmit | null - /** - * The data used to update Users. - */ - data: Prisma.XOR - /** - * Filter which Users to update - */ - where?: Prisma.UserWhereInput - /** - * Limit how many Users to update. - */ - limit?: number -} - -/** - * User upsert - */ -export type UserUpsertArgs = { - /** - * Select specific fields to fetch from the User - */ - select?: Prisma.UserSelect | null - /** - * Omit specific fields from the User - */ - omit?: Prisma.UserOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.UserInclude | null - /** - * The filter to search for the User to update in case it exists. - */ - where: Prisma.UserWhereUniqueInput - /** - * In case the User found by the `where` argument doesn't exist, create a new User with this data. - */ - create: Prisma.XOR - /** - * In case the User was found with the provided `where` argument, update it with this data. - */ - update: Prisma.XOR -} - -/** - * User delete - */ -export type UserDeleteArgs = { - /** - * Select specific fields to fetch from the User - */ - select?: Prisma.UserSelect | null - /** - * Omit specific fields from the User - */ - omit?: Prisma.UserOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.UserInclude | null - /** - * Filter which User to delete. - */ - where: Prisma.UserWhereUniqueInput -} - -/** - * User deleteMany - */ -export type UserDeleteManyArgs = { - /** - * Filter which Users to delete - */ - where?: Prisma.UserWhereInput - /** - * Limit how many Users to delete. - */ - limit?: number -} - -/** - * User.chats - */ -export type User$chatsArgs = { - /** - * Select specific fields to fetch from the Chat - */ - select?: Prisma.ChatSelect | null - /** - * Omit specific fields from the Chat - */ - omit?: Prisma.ChatOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.ChatInclude | null - where?: Prisma.ChatWhereInput - orderBy?: Prisma.ChatOrderByWithRelationInput | Prisma.ChatOrderByWithRelationInput[] - cursor?: Prisma.ChatWhereUniqueInput - take?: number - skip?: number - distinct?: Prisma.ChatScalarFieldEnum | Prisma.ChatScalarFieldEnum[] -} - -/** - * User without action - */ -export type UserDefaultArgs = { - /** - * Select specific fields to fetch from the User - */ - select?: Prisma.UserSelect | null - /** - * Omit specific fields from the User - */ - omit?: Prisma.UserOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.UserInclude | null -} diff --git a/prisma.config.ts.bak b/prisma.config.ts.bak deleted file mode 100644 index 831a20f..0000000 --- a/prisma.config.ts.bak +++ /dev/null @@ -1,14 +0,0 @@ -// This file was generated by Prisma, and assumes you have installed the following: -// npm install --save-dev prisma dotenv -import "dotenv/config"; -import { defineConfig } from "prisma/config"; - -export default defineConfig({ - schema: "prisma/schema.prisma", - migrations: { - path: "prisma/migrations", - }, - datasource: { - url: process.env["DATABASE_URL"], - }, -}); diff --git a/src/llm/streaming.ts b/src/llm/streaming.ts new file mode 100644 index 0000000..6b84868 --- /dev/null +++ b/src/llm/streaming.ts @@ -0,0 +1,130 @@ +import { performance } from "node:perf_hooks"; +import type OpenAI from "openai"; +import { prisma } from "../db.js"; +import { anthropicClient, openaiClient, xaiClient } from "./providers.js"; +import type { MultiplexRequest, Provider } from "./types.js"; + +export type StreamEvent = + | { type: "meta"; chatId: string; callId: string; provider: Provider; model: string } + | { type: "delta"; text: string } + | { type: "done"; text: string; usage?: { inputTokens?: number; outputTokens?: number; totalTokens?: number } } + | { type: "error"; message: string }; + +function getChatIdOrCreate(chatId?: string) { + if (chatId) return Promise.resolve(chatId); + return prisma.chat.create({ data: {}, select: { id: true } }).then((c) => c.id); +} + +export async function* runMultiplexStream(req: MultiplexRequest): AsyncGenerator { + const t0 = performance.now(); + const chatId = await getChatIdOrCreate(req.chatId); + + const call = await prisma.llmCall.create({ + data: { + chatId, + provider: req.provider as any, + model: req.model, + request: req as any, + }, + select: { id: true }, + }); + + yield { type: "meta", chatId, callId: call.id, provider: req.provider, model: req.model }; + + let text = ""; + let usage: StreamEvent extends any ? any : never; + let raw: unknown = { streamed: true }; + + try { + if (req.provider === "openai" || req.provider === "xai") { + const client = req.provider === "openai" ? openaiClient() : xaiClient(); + + const stream = await client.chat.completions.create({ + model: req.model, + messages: req.messages.map((m) => ({ role: m.role, content: m.content, name: m.name })) as any, + temperature: req.temperature, + max_tokens: req.maxTokens, + stream: true, + }); + + for await (const chunk of stream as any as AsyncIterable) { + const delta = chunk.choices?.[0]?.delta?.content ?? ""; + if (delta) { + text += delta; + yield { type: "delta", text: delta }; + } + } + + // no guaranteed usage in stream mode across providers; leave empty for now + } else if (req.provider === "anthropic") { + const client = anthropicClient(); + + const system = req.messages.find((m) => m.role === "system")?.content; + const msgs = req.messages + .filter((m) => m.role !== "system") + .map((m) => ({ role: m.role === "assistant" ? "assistant" : "user", content: m.content })); + + const stream = await client.messages.create({ + model: req.model, + system, + max_tokens: req.maxTokens ?? 1024, + temperature: req.temperature, + messages: msgs as any, + stream: true, + }); + + for await (const ev of stream as any as AsyncIterable) { + // Anthropic streaming events include content_block_delta with text_delta + if (ev?.type === "content_block_delta" && ev?.delta?.type === "text_delta") { + const delta = ev.delta.text ?? ""; + if (delta) { + text += delta; + yield { type: "delta", text: delta }; + } + } + // capture usage if present on message_delta + if (ev?.type === "message_delta" && ev?.usage) { + usage = { + inputTokens: ev.usage.input_tokens, + outputTokens: ev.usage.output_tokens, + totalTokens: + (ev.usage.input_tokens ?? 0) + (ev.usage.output_tokens ?? 0), + }; + } + // some streams end with message_stop + } + } else { + throw new Error(`unknown provider: ${req.provider}`); + } + + const latencyMs = Math.round(performance.now() - t0); + + await prisma.$transaction([ + prisma.message.create({ + data: { chatId, role: "assistant" as any, content: text }, + }), + prisma.llmCall.update({ + where: { id: call.id }, + data: { + response: raw as any, + latencyMs, + inputTokens: usage?.inputTokens, + outputTokens: usage?.outputTokens, + totalTokens: usage?.totalTokens, + }, + }), + ]); + + yield { type: "done", text, usage }; + } catch (e: any) { + const latencyMs = Math.round(performance.now() - t0); + await prisma.llmCall.update({ + where: { id: call.id }, + data: { + error: e?.message ?? String(e), + latencyMs, + }, + }); + yield { type: "error", message: e?.message ?? String(e) }; + } +} diff --git a/src/routes.ts b/src/routes.ts index 5288497..4ad7ed0 100644 --- a/src/routes.ts +++ b/src/routes.ts @@ -3,6 +3,7 @@ import type { FastifyInstance } from "fastify"; import { prisma } from "./db.js"; import { requireAdmin } from "./auth.js"; import { runMultiplex } from "./llm/multiplexer.js"; +import { runMultiplexStream } from "./llm/streaming.js"; export async function registerRoutes(app: FastifyInstance) { app.get("/health", async () => ({ ok: true })); @@ -108,4 +109,63 @@ export async function registerRoutes(app: FastifyInstance) { ...result, }; }); + + // Streaming SSE endpoint. + app.post("/v1/chat-completions/stream", async (req, reply) => { + requireAdmin(req); + + const Body = z.object({ + chatId: z.string().optional(), + provider: z.enum(["openai", "anthropic", "xai"]), + model: z.string().min(1), + messages: z.array( + z.object({ + role: z.enum(["system", "user", "assistant", "tool"]), + content: z.string(), + name: z.string().optional(), + }) + ), + temperature: z.number().min(0).max(2).optional(), + maxTokens: z.number().int().positive().optional(), + }); + + const body = Body.parse(req.body); + + // ensure chat exists if provided + if (body.chatId) { + const exists = await prisma.chat.findUnique({ where: { id: body.chatId }, select: { id: true } }); + if (!exists) return app.httpErrors.notFound("chat not found"); + } + + // store user messages (anything not assistant) for DB fidelity + if (body.chatId) { + const toInsert = body.messages.filter((m) => m.role !== "assistant"); + if (toInsert.length) { + await prisma.message.createMany({ + data: toInsert.map((m) => ({ chatId: body.chatId!, role: m.role as any, content: m.content, name: m.name })), + }); + } + } + + reply.raw.writeHead(200, { + "Content-Type": "text/event-stream; charset=utf-8", + "Cache-Control": "no-cache, no-transform", + Connection: "keep-alive", + }); + + const send = (event: string, data: any) => { + reply.raw.write(`event: ${event}\n`); + reply.raw.write(`data: ${JSON.stringify(data)}\n\n`); + }; + + for await (const ev of runMultiplexStream(body)) { + if (ev.type === "meta") send("meta", ev); + else if (ev.type === "delta") send("delta", ev); + else if (ev.type === "done") send("done", ev); + else if (ev.type === "error") send("error", ev); + } + + reply.raw.end(); + return reply; + }); }