UNPKG

@prisma/client

Version:

Prisma Client is an auto-generated, type-safe and modern JavaScript/TypeScript ORM for Node.js that's tailored to your data. Supports PostgreSQL, CockroachDB, MySQL, MariaDB, SQL Server, SQLite & MongoDB databases.

1,372 lines (1,215 loc) • 111 kB
import { AnyNull } from '@prisma/client-runtime-utils'; import { AnyNullClass } from '@prisma/client-runtime-utils'; import { DbNull } from '@prisma/client-runtime-utils'; import { DbNullClass } from '@prisma/client-runtime-utils'; import { Decimal } from '@prisma/client-runtime-utils'; import { empty } from '@prisma/client-runtime-utils'; import { isAnyNull } from '@prisma/client-runtime-utils'; import { isDbNull } from '@prisma/client-runtime-utils'; import { isJsonNull } from '@prisma/client-runtime-utils'; import { isObjectEnumValue } from '@prisma/client-runtime-utils'; import { join } from '@prisma/client-runtime-utils'; import { JsonNull } from '@prisma/client-runtime-utils'; import { JsonNullClass } from '@prisma/client-runtime-utils'; import { NullTypes } from '@prisma/client-runtime-utils'; import { ObjectEnumValue } from '@prisma/client-runtime-utils'; import { PrismaClientInitializationError } from '@prisma/client-runtime-utils'; import { PrismaClientKnownRequestError } from '@prisma/client-runtime-utils'; import { PrismaClientRustPanicError } from '@prisma/client-runtime-utils'; import { PrismaClientUnknownRequestError } from '@prisma/client-runtime-utils'; import { PrismaClientValidationError } from '@prisma/client-runtime-utils'; import { raw } from '@prisma/client-runtime-utils'; import { RawValue } from '@prisma/client-runtime-utils'; import { Sql } from '@prisma/client-runtime-utils'; import { sql as sqltag } from '@prisma/client-runtime-utils'; import { Value } from '@prisma/client-runtime-utils'; /** * @param this */ declare function $extends(this: Client, extension: ExtensionArgs | ((client: Client) => Client)): Client; /** * Used by `@prisma/extension-accelerate` until we migrate it to a better API. */ declare interface AccelerateEngineConfig extends EngineConfig { /** * Allows Accelerate to use runtime utilities from the client. These are * necessary for `@prisma/extension-accelerate` to function correctly. * See <https://github.com/prisma/prisma-extension-accelerate/blob/b6ffa853f038780f5ab2fc01bff584ca251f645b/src/extension.ts#L518> */ accelerateUtils: { resolveDatasourceUrl: () => string; }; } /** * A stripped down interface of `fetch` that `@prisma/extension-accelerate` * relies on. It must be in sync with the corresponding definition in the * Accelerate extension. * * This is the actual interface exposed by the extension. We can't use the * custom fetch function provided by it as normal fetch because the API is * different. Notably, `headers` must be an object and not a `Headers` * instance, and `url` must be a `string` and not a `URL`. * * The return type is `Response` but we can't specify this in an exported type * because it would end up referencing external types from `@types/node` or DOM * which can fail typechecking depending on TypeScript configuration in a user's * project. */ declare type AccelerateExtensionFetch = (url: string, options: { body?: string; method?: string; headers: Record<string, string>; }) => Promise<unknown>; declare type AccelerateExtensionFetchDecorator = (fetch: AccelerateExtensionFetch) => AccelerateExtensionFetch; export declare type Action = keyof typeof DMMF_2.ModelAction | 'executeRaw' | 'queryRaw' | 'runCommandRaw'; declare type ActiveConnectorType = Exclude<ConnectorType, 'postgres' | 'prisma+postgres'>; /** * An interface that exposes some basic information about the * adapter like its name and provider type. */ declare interface AdapterInfo { readonly provider: Provider; readonly adapterName: (typeof officialPrismaAdapters)[number] | (string & {}); } export declare type Aggregate = '_count' | '_max' | '_min' | '_avg' | '_sum'; export declare type AllModelsToStringIndex<TypeMap extends TypeMapDef, Args extends Record<string, any>, K extends PropertyKey> = Args extends { [P in K]: { $allModels: infer AllModels; }; } ? { [P in K]: Record<TypeMap['meta']['modelProps'], AllModels>; } : {}; export { AnyNull } export { AnyNullClass } export declare type ApplyOmit<T, OmitConfig> = Compute<{ [K in keyof T as OmitValue<OmitConfig, K> extends true ? never : K]: T[K]; }>; export declare type Args<T, F extends Operation> = T extends { [K: symbol]: { types: { operations: { [K in F]: { args: any; }; }; }; }; } ? T[symbol]['types']['operations'][F]['args'] : any; export declare type Args_3<T, F extends Operation> = Args<T, F>; declare type ArgScalarType = 'string' | 'int' | 'bigint' | 'float' | 'decimal' | 'boolean' | 'enum' | 'uuid' | 'json' | 'datetime' | 'bytes' | 'unknown'; declare type ArgType = { scalarType: ArgScalarType; dbType?: string; arity: Arity; }; declare type Arity = 'scalar' | 'list'; /** * Attributes is a map from string to attribute values. * * Note: only the own enumerable keys are counted as valid attribute keys. */ declare interface Attributes { [attributeKey: string]: AttributeValue | undefined; } /** * Attribute values may be any non-nullish primitive value except an object. * * null or undefined attribute values are invalid and will result in undefined behavior. */ declare type AttributeValue = string | number | boolean | Array<null | undefined | string> | Array<null | undefined | number> | Array<null | undefined | boolean>; export declare type BaseDMMF = { readonly datamodel: Omit<DMMF_2.Datamodel, 'indexes'>; }; declare type BatchArgs = { queries: BatchQuery[]; transaction?: { isolationLevel?: IsolationLevel_2; }; }; declare type BatchInternalParams = { requests: RequestParams[]; customDataProxyFetch?: AccelerateExtensionFetchDecorator; }; declare type BatchQuery = { model: string | undefined; operation: string; args: JsArgs | RawQueryArgs; }; declare type BatchQueryEngineResult<T> = QueryEngineResultData<T> | Error; declare type BatchQueryOptionsCb = (args: BatchQueryOptionsCbArgs) => Promise<any>; declare type BatchQueryOptionsCbArgs = { args: BatchArgs; query: (args: BatchArgs, __internalParams?: BatchInternalParams) => Promise<unknown[]>; __internalParams: BatchInternalParams; }; declare type BatchResponse = MultiBatchResponse | CompactedBatchResponse; declare type BatchTransactionOptions = { isolationLevel?: Transaction_2.IsolationLevel; }; /** * Equivalent to `Uint8Array` before TypeScript 5.7, and `Uint8Array<ArrayBuffer>` in TypeScript 5.7 and beyond. */ export declare type Bytes = ReturnType<Uint8Array['slice']>; export declare type Call<F extends Fn, P> = (F & { params: P; })['returns']; declare interface CallSite { getLocation(): LocationInFile | null; } export declare type Cast<A, W> = A extends W ? A : W; declare type Client = ReturnType<typeof getPrismaClient> extends new (optionsArg: PrismaClientOptions) => infer T ? T : never; export declare type ClientArg = { [MethodName in string]: unknown; }; export declare type ClientArgs = { client: ClientArg; }; export declare type ClientBuiltInProp = keyof DynamicClientExtensionThisBuiltin<never, never, never>; export declare type ClientOptionDef = undefined | { [K in string]: any; }; export declare type ClientOtherOps = { $queryRaw<T = unknown>(query: TemplateStringsArray | Sql, ...values: any[]): PrismaPromise<T>; $queryRawTyped<T>(query: TypedSql<unknown[], T>): PrismaPromise<T[]>; $queryRawUnsafe<T = unknown>(query: string, ...values: any[]): PrismaPromise<T>; $executeRaw(query: TemplateStringsArray | Sql, ...values: any[]): PrismaPromise<number>; $executeRawUnsafe(query: string, ...values: any[]): PrismaPromise<number>; $runCommandRaw(command: InputJsonObject): PrismaPromise<JsonObject>; }; declare type ColumnType = (typeof ColumnTypeEnum)[keyof typeof ColumnTypeEnum]; declare const ColumnTypeEnum: { readonly Int32: 0; readonly Int64: 1; readonly Float: 2; readonly Double: 3; readonly Numeric: 4; readonly Boolean: 5; readonly Character: 6; readonly Text: 7; readonly Date: 8; readonly Time: 9; readonly DateTime: 10; readonly Json: 11; readonly Enum: 12; readonly Bytes: 13; readonly Set: 14; readonly Uuid: 15; readonly Int32Array: 64; readonly Int64Array: 65; readonly FloatArray: 66; readonly DoubleArray: 67; readonly NumericArray: 68; readonly BooleanArray: 69; readonly CharacterArray: 70; readonly TextArray: 71; readonly DateArray: 72; readonly TimeArray: 73; readonly DateTimeArray: 74; readonly JsonArray: 75; readonly EnumArray: 76; readonly BytesArray: 77; readonly UuidArray: 78; readonly UnknownNumber: 128; }; declare type CompactedBatchResponse = { type: 'compacted'; plan: QueryPlanNode; arguments: Record<string, {}>[]; nestedSelection: string[]; keys: string[]; expectNonEmpty: boolean; }; declare type CompilerWasmLoadingConfig = { /** * WASM-bindgen runtime for corresponding module */ getRuntime: () => Promise<{ __wbg_set_wasm(exports: unknown): void; QueryCompiler: QueryCompilerConstructor; }>; /** * Loads the raw wasm module for the wasm compiler engine. This configuration is * generated specifically for each type of client, eg. Node.js client and Edge * clients will have different implementations. * @remarks this is a callback on purpose, we only load the wasm if needed. * @remarks only used by ClientEngine */ getQueryCompilerWasmModule: () => Promise<unknown>; importName: string; }; export declare type Compute<T> = T extends Function ? T : { [K in keyof T]: T[K]; } & unknown; export declare type ComputeDeep<T> = T extends Function ? T : { [K in keyof T]: ComputeDeep<T[K]>; } & unknown; declare type ComputedField = { name: string; needs: string[]; compute: ResultArgsFieldCompute; }; declare type ComputedFieldsMap = { [fieldName: string]: ComputedField; }; declare type ConnectionInfo = { schemaName?: string; maxBindValues?: number; supportsRelationJoins: boolean; }; declare type ConnectorType = 'mysql' | 'mongodb' | 'sqlite' | 'postgresql' | 'postgres' | 'prisma+postgres' | 'sqlserver' | 'cockroachdb'; declare interface Context { /** * Get a value from the context. * * @param key key which identifies a context value */ getValue(key: symbol): unknown; /** * Create a new context which inherits from this context and has * the given key set to the given value. * * @param key context key for which to set the value * @param value value to set for the given key */ setValue(key: symbol, value: unknown): Context; /** * Return a new context which inherits from this context but does * not contain a value for the given key. * * @param key context key for which to clear a value */ deleteValue(key: symbol): Context; } declare type Context_2<T> = T extends { [K: symbol]: { ctx: infer C; }; } ? C & T & { /** * @deprecated Use `$name` instead. */ name?: string; $name?: string; $parent?: unknown; } : T & { /** * @deprecated Use `$name` instead. */ name?: string; $name?: string; $parent?: unknown; }; export declare type Count<O> = { [K in keyof O]: Count<number>; } & {}; export declare function createParam(name: string): Param<unknown, string>; declare class DataLoader<T = unknown> { private options; batches: { [key: string]: Job[]; }; private tickActive; constructor(options: DataLoaderOptions<T>); request(request: T): Promise<any>; private dispatchBatches; get [Symbol.toStringTag](): string; } declare type DataLoaderOptions<T> = { singleLoader: (request: T) => Promise<any>; batchLoader: (request: T[]) => Promise<any[]>; batchBy: (request: T) => string | undefined; batchOrder: (requestA: T, requestB: T) => number; }; declare type Datamodel = ReadonlyDeep_2<{ models: Model[]; enums: DatamodelEnum[]; types: Model[]; indexes: Index[]; }>; declare type DatamodelEnum = ReadonlyDeep_2<{ name: string; values: EnumValue[]; dbName?: string | null; documentation?: string; }>; declare function datamodelEnumToSchemaEnum(datamodelEnum: DatamodelEnum): SchemaEnum; declare type DataRule = { type: 'rowCountEq'; args: number; } | { type: 'rowCountNeq'; args: number; } | { type: 'affectedRowCountEq'; args: number; } | { type: 'never'; }; export { DbNull } export { DbNullClass } export declare const Debug: typeof debugCreate & { enable(namespace: any): void; disable(): any; enabled(namespace: string): boolean; log: (...args: string[]) => void; formatters: {}; }; /** * Create a new debug instance with the given namespace. * * @example * ```ts * import Debug from '@prisma/debug' * const debug = Debug('prisma:client') * debug('Hello World') * ``` */ declare function debugCreate(namespace: string): ((...args: any[]) => void) & { color: string; enabled: boolean; namespace: string; log: (...args: string[]) => void; extend: () => void; }; export { Decimal } /** * Interface for any Decimal.js-like library * Allows us to accept Decimal.js from different * versions and some compatible alternatives */ export declare interface DecimalJsLike { d: number[]; e: number; s: number; toFixed(): string; } export declare type DefaultArgs = InternalArgs<{}, {}, {}, {}>; export declare type DefaultSelection<Payload extends OperationPayload, Args = {}, GlobalOmitOptions = {}> = Args extends { omit: infer LocalOmit; } ? ApplyOmit<UnwrapPayload<{ default: Payload; }>['default'], PatchFlat<LocalOmit, ExtractGlobalOmit<GlobalOmitOptions, Uncapitalize<Payload['name']>>>> : ApplyOmit<UnwrapPayload<{ default: Payload; }>['default'], ExtractGlobalOmit<GlobalOmitOptions, Uncapitalize<Payload['name']>>>; export declare function defineDmmfProperty(target: object, runtimeDataModel: RuntimeDataModel): void; declare function defineExtension(ext: ExtensionArgs | ((client: Client) => Client)): (client: Client) => Client; declare const denylist: readonly ["$connect", "$disconnect", "$on", "$use", "$extends"]; declare type Deprecation = ReadonlyDeep_2<{ sinceVersion: string; reason: string; plannedRemovalVersion?: string; }>; declare type DeserializedResponse = Array<Record<string, unknown>>; export declare function deserializeJsonObject(result: unknown): unknown; export declare function deserializeRawResult(response: RawResponse): DeserializedResponse; export declare type DevTypeMapDef = { meta: { modelProps: string; }; model: { [Model in PropertyKey]: { [Operation in PropertyKey]: DevTypeMapFnDef; }; }; other: { [Operation in PropertyKey]: DevTypeMapFnDef; }; }; export declare type DevTypeMapFnDef = { args: any; result: any; payload: OperationPayload; }; export declare namespace DMMF { export { datamodelEnumToSchemaEnum, Datamodel, DatamodelEnum, Deprecation, Document_2 as Document, EnumValue, Field, FieldDefault, FieldDefaultScalar, FieldKind, FieldLocation, FieldNamespace, FieldRefAllowType, FieldRefType, Index, IndexField, IndexType, InputType, InputTypeRef, Mappings, Model, ModelAction, ModelMapping, OtherOperationMappings, OutputType, OutputTypeRef, PrimaryKey, Query, QueryOutput, ReadonlyDeep_2 as ReadonlyDeep, Schema, SchemaArg, SchemaEnum, SchemaField, SortOrder, TypeRef, uniqueIndex } } declare namespace DMMF_2 { export { datamodelEnumToSchemaEnum, Datamodel, DatamodelEnum, Deprecation, Document_2 as Document, EnumValue, Field, FieldDefault, FieldDefaultScalar, FieldKind, FieldLocation, FieldNamespace, FieldRefAllowType, FieldRefType, Index, IndexField, IndexType, InputType, InputTypeRef, Mappings, Model, ModelAction, ModelMapping, OtherOperationMappings, OutputType, OutputTypeRef, PrimaryKey, Query, QueryOutput, ReadonlyDeep_2 as ReadonlyDeep, Schema, SchemaArg, SchemaEnum, SchemaField, SortOrder, TypeRef, uniqueIndex } } export declare function dmmfToRuntimeDataModel(dmmfDataModel: DMMF_2.Datamodel): RuntimeDataModel; declare type Document_2 = ReadonlyDeep_2<{ datamodel: Datamodel; schema: Schema; mappings: Mappings; }>; /** * A generic driver adapter factory that allows the user to instantiate a * driver adapter. The query and result types are specific to the adapter. */ declare interface DriverAdapterFactory<Query, Result> extends AdapterInfo { /** * Instantiate a driver adapter. */ connect(): Promise<Queryable<Query, Result>>; } declare type DynamicArgType = ArgType | { arity: 'tuple'; elements: ArgType[]; }; /** Client */ export declare type DynamicClientExtensionArgs<C_, TypeMap extends TypeMapDef, TypeMapCb extends TypeMapCbDef, ExtArgs extends Record<string, any>> = { [P in keyof C_]: unknown; } & { [K: symbol]: { ctx: Optional<DynamicClientExtensionThis<TypeMap, TypeMapCb, ExtArgs>, ITXClientDenyList> & { $parent: Optional<DynamicClientExtensionThis<TypeMap, TypeMapCb, ExtArgs>, ITXClientDenyList>; }; }; }; export declare type DynamicClientExtensionThis<TypeMap extends TypeMapDef, TypeMapCb extends TypeMapCbDef, ExtArgs extends Record<string, any>> = { [P in keyof ExtArgs['client']]: Return<ExtArgs['client'][P]>; } & { [P in Exclude<TypeMap['meta']['modelProps'], keyof ExtArgs['client']>]: DynamicModelExtensionThis<TypeMap, ModelKey<TypeMap, P>, ExtArgs>; } & { [P in Exclude<keyof TypeMap['other']['operations'], keyof ExtArgs['client']>]: P extends keyof ClientOtherOps ? ClientOtherOps[P] : never; } & { [P in Exclude<ClientBuiltInProp, keyof ExtArgs['client']>]: DynamicClientExtensionThisBuiltin<TypeMap, TypeMapCb, ExtArgs>[P]; } & { [K: symbol]: { types: TypeMap['other']; }; }; export declare type DynamicClientExtensionThisBuiltin<TypeMap extends TypeMapDef, TypeMapCb extends TypeMapCbDef, ExtArgs extends Record<string, any>> = { $extends: ExtendsHook<'extends', TypeMapCb, ExtArgs, Call<TypeMapCb, { extArgs: ExtArgs; }>>; $transaction<P extends PrismaPromise<any>[]>(arg: [...P], options?: { isolationLevel?: TypeMap['meta']['txIsolationLevel']; }): Promise<UnwrapTuple<P>>; $transaction<R>(fn: (client: Omit<DynamicClientExtensionThis<TypeMap, TypeMapCb, ExtArgs>, ITXClientDenyList>) => Promise<R>, options?: { maxWait?: number; timeout?: number; isolationLevel?: TypeMap['meta']['txIsolationLevel']; }): Promise<R>; $disconnect(): Promise<void>; $connect(): Promise<void>; }; /** Model */ export declare type DynamicModelExtensionArgs<M_, TypeMap extends TypeMapDef, TypeMapCb extends TypeMapCbDef, ExtArgs extends Record<string, any>> = { [K in keyof M_]: K extends '$allModels' ? { [P in keyof M_[K]]?: unknown; } & { [K: symbol]: {}; } : K extends TypeMap['meta']['modelProps'] ? { [P in keyof M_[K]]?: unknown; } & { [K: symbol]: { ctx: DynamicModelExtensionThis<TypeMap, ModelKey<TypeMap, K>, ExtArgs> & { $parent: DynamicClientExtensionThis<TypeMap, TypeMapCb, ExtArgs>; } & { $name: ModelKey<TypeMap, K>; } & { /** * @deprecated Use `$name` instead. */ name: ModelKey<TypeMap, K>; }; }; } : never; }; export declare type DynamicModelExtensionFluentApi<TypeMap extends TypeMapDef, M extends PropertyKey, P extends PropertyKey, Null> = { [K in keyof TypeMap['model'][M]['payload']['objects']]: <A>(args?: Exact<A, Path<TypeMap['model'][M]['operations'][P]['args']['select'], [K]>>) => PrismaPromise<Path<DynamicModelExtensionFnResultBase<TypeMap, M, { select: { [P in K]: A; }; }, P>, [K]> | Null> & DynamicModelExtensionFluentApi<TypeMap, (TypeMap['model'][M]['payload']['objects'][K] & {})['name'], P, Null | Select<TypeMap['model'][M]['payload']['objects'][K], null>>; }; export declare type DynamicModelExtensionFnResult<TypeMap extends TypeMapDef, M extends PropertyKey, A, P extends PropertyKey, Null> = P extends FluentOperation ? DynamicModelExtensionFluentApi<TypeMap, M, P, Null> & PrismaPromise<DynamicModelExtensionFnResultBase<TypeMap, M, A, P> | Null> : PrismaPromise<DynamicModelExtensionFnResultBase<TypeMap, M, A, P>>; export declare type DynamicModelExtensionFnResultBase<TypeMap extends TypeMapDef, M extends PropertyKey, A, P extends PropertyKey> = GetResult<TypeMap['model'][M]['payload'], A, P & Operation, TypeMap['globalOmitOptions']>; export declare type DynamicModelExtensionFnResultNull<P extends PropertyKey> = P extends 'findUnique' | 'findFirst' ? null : never; export declare type DynamicModelExtensionOperationFn<TypeMap extends TypeMapDef, M extends PropertyKey, P extends PropertyKey> = {} extends TypeMap['model'][M]['operations'][P]['args'] ? <A extends TypeMap['model'][M]['operations'][P]['args']>(args?: Exact<A, TypeMap['model'][M]['operations'][P]['args']>) => DynamicModelExtensionFnResult<TypeMap, M, A, P, DynamicModelExtensionFnResultNull<P>> : <A extends TypeMap['model'][M]['operations'][P]['args']>(args: Exact<A, TypeMap['model'][M]['operations'][P]['args']>) => DynamicModelExtensionFnResult<TypeMap, M, A, P, DynamicModelExtensionFnResultNull<P>>; export declare type DynamicModelExtensionThis<TypeMap extends TypeMapDef, M extends PropertyKey, ExtArgs extends Record<string, any>> = { [P in keyof ExtArgs['model'][Uncapitalize<M & string>]]: Return<ExtArgs['model'][Uncapitalize<M & string>][P]>; } & { [P in Exclude<keyof TypeMap['model'][M]['operations'], keyof ExtArgs['model'][Uncapitalize<M & string>]>]: DynamicModelExtensionOperationFn<TypeMap, M, P>; } & { [P in Exclude<'fields', keyof ExtArgs['model'][Uncapitalize<M & string>]>]: TypeMap['model'][M]['fields']; } & { [K: symbol]: { types: TypeMap['model'][M]; }; }; /** Query */ export declare type DynamicQueryExtensionArgs<Q_, TypeMap extends TypeMapDef> = { [K in keyof Q_]: K extends '$allOperations' ? (args: { model?: string; operation: string; args: any; query: (args: any) => PrismaPromise<any>; }) => Promise<any> : K extends '$allModels' ? { [P in keyof Q_[K] | keyof TypeMap['model'][keyof TypeMap['model']]['operations'] | '$allOperations']?: P extends '$allOperations' ? DynamicQueryExtensionCb<TypeMap, 'model', keyof TypeMap['model'], keyof TypeMap['model'][keyof TypeMap['model']]['operations']> : P extends keyof TypeMap['model'][keyof TypeMap['model']]['operations'] ? DynamicQueryExtensionCb<TypeMap, 'model', keyof TypeMap['model'], P> : never; } : K extends TypeMap['meta']['modelProps'] ? { [P in keyof Q_[K] | keyof TypeMap['model'][ModelKey<TypeMap, K>]['operations'] | '$allOperations']?: P extends '$allOperations' ? DynamicQueryExtensionCb<TypeMap, 'model', ModelKey<TypeMap, K>, keyof TypeMap['model'][ModelKey<TypeMap, K>]['operations']> : P extends keyof TypeMap['model'][ModelKey<TypeMap, K>]['operations'] ? DynamicQueryExtensionCb<TypeMap, 'model', ModelKey<TypeMap, K>, P> : never; } : K extends keyof TypeMap['other']['operations'] ? DynamicQueryExtensionCb<[TypeMap], 0, 'other', K> : never; }; export declare type DynamicQueryExtensionCb<TypeMap extends TypeMapDef, _0 extends PropertyKey, _1 extends PropertyKey, _2 extends PropertyKey> = <A extends DynamicQueryExtensionCbArgs<TypeMap, _0, _1, _2>>(args: A) => Promise<TypeMap[_0][_1][_2]['result']>; export declare type DynamicQueryExtensionCbArgs<TypeMap extends TypeMapDef, _0 extends PropertyKey, _1 extends PropertyKey, _2 extends PropertyKey> = (_1 extends unknown ? _2 extends unknown ? { args: DynamicQueryExtensionCbArgsArgs<TypeMap, _0, _1, _2>; model: _0 extends 0 ? undefined : _1; operation: _2; query: <A extends DynamicQueryExtensionCbArgsArgs<TypeMap, _0, _1, _2>>(args: A) => PrismaPromise<TypeMap[_0][_1]['operations'][_2]['result']>; } : never : never) & { query: (args: DynamicQueryExtensionCbArgsArgs<TypeMap, _0, _1, _2>) => PrismaPromise<TypeMap[_0][_1]['operations'][_2]['result']>; }; export declare type DynamicQueryExtensionCbArgsArgs<TypeMap extends TypeMapDef, _0 extends PropertyKey, _1 extends PropertyKey, _2 extends PropertyKey> = _2 extends '$queryRaw' | '$executeRaw' ? Sql : TypeMap[_0][_1]['operations'][_2]['args']; /** Result */ export declare type DynamicResultExtensionArgs<R_, TypeMap extends TypeMapDef> = { [K in keyof R_]: { [P in keyof R_[K]]?: { needs?: DynamicResultExtensionNeeds<TypeMap, ModelKey<TypeMap, K>, R_[K][P]>; compute(data: DynamicResultExtensionData<TypeMap, ModelKey<TypeMap, K>, R_[K][P]>): any; }; }; }; export declare type DynamicResultExtensionData<TypeMap extends TypeMapDef, M extends PropertyKey, S> = GetFindResult<TypeMap['model'][M]['payload'], { select: S; }, {}>; export declare type DynamicResultExtensionNeeds<TypeMap extends TypeMapDef, M extends PropertyKey, S> = { [K in keyof S]: K extends keyof TypeMap['model'][M]['payload']['scalars'] ? S[K] : never; } & { [N in keyof TypeMap['model'][M]['payload']['scalars']]?: boolean; }; export { empty } export declare type EmptyToUnknown<T> = T; declare interface Engine<InteractiveTransactionPayload = unknown> { /** The name of the engine. This is meant to be consumed externally */ readonly name: string; onBeforeExit(callback: () => Promise<void>): void; start(): Promise<void>; stop(): Promise<void>; version(forceRun?: boolean): Promise<string> | string; request<T>(query: JsonQuery, options: RequestOptions<InteractiveTransactionPayload>): Promise<QueryEngineResultData<T>>; requestBatch<T>(queries: JsonQuery[], options: RequestBatchOptions<InteractiveTransactionPayload>): Promise<BatchQueryEngineResult<T>[]>; transaction(action: 'start', headers: Transaction_2.TransactionHeaders, options: Transaction_2.Options): Promise<Transaction_2.InteractiveTransactionInfo<unknown>>; transaction(action: 'commit', headers: Transaction_2.TransactionHeaders, info: Transaction_2.InteractiveTransactionInfo<unknown>): Promise<void>; transaction(action: 'rollback', headers: Transaction_2.TransactionHeaders, info: Transaction_2.InteractiveTransactionInfo<unknown>): Promise<void>; } declare interface EngineConfig { enableDebugLogs?: boolean; prismaPath?: string; logQueries?: boolean; logLevel?: 'info' | 'warn'; clientVersion: string; previewFeatures?: string[]; activeProvider?: string; logEmitter: LogEmitter; transactionOptions: Transaction_2.Options; /** * Instance of a Driver Adapter, e.g., like one provided by `@prisma/adapter-pg`. */ adapter?: SqlDriverAdapterFactory; /** * Prisma Accelerate URL allowing the client to connect through Accelerate instead of a direct database. */ accelerateUrl?: string; /** * The contents of the schema encoded into a string */ inlineSchema: string; /** * The helper for interaction with OTEL tracing * @remarks enabling is determined by the client and @prisma/instrumentation package */ tracingHelper: TracingHelper; /** * Web Assembly module loading configuration */ compilerWasm?: CompilerWasmLoadingConfig; /** * SQL commenter plugins that add metadata to SQL queries as comments. * Each plugin receives query context and returns key-value pairs. */ sqlCommenters?: SqlCommenterPlugin[]; /** * Parameterization schema (ParamGraph) for schema-aware query parameterization. * Enables precise parameterization based on DMMF metadata. */ parameterizationSchema: SerializedParamGraph; /** * Runtime data model for enum lookups during parameterization. */ runtimeDataModel: RuntimeDataModel; } declare type EngineEvent<E extends EngineEventType> = E extends QueryEventType ? QueryEvent : LogEvent; declare type EngineEventType = QueryEventType | LogEventType; declare type EngineSpan = { id: EngineSpanId; parentId: string | null; name: string; startTime: HrTime; endTime: HrTime; kind: EngineSpanKind; attributes?: Record<string, unknown>; links?: EngineSpanId[]; }; declare type EngineSpanId = string; declare type EngineSpanKind = 'client' | 'internal'; declare type EnumValue = ReadonlyDeep_2<{ name: string; dbName: string | null; }>; export declare type Equals<A, B> = (<T>() => T extends A ? 1 : 2) extends (<T>() => T extends B ? 1 : 2) ? 1 : 0; declare type ErrorFormat = 'pretty' | 'colorless' | 'minimal'; declare type EventCallback<E extends ExtendedEventType> = [E] extends ['beforeExit'] ? () => Promise<void> : [E] extends [LogLevel] ? (event: EngineEvent<E>) => void : never; export declare type Exact<A, W> = (A extends unknown ? (W extends A ? { [K in keyof A]: Exact<A[K], W[K]>; } : W) : never) | (A extends Narrowable ? A : never); /** * Defines Exception. * * string or an object with one of (message or name or code) and optional stack */ declare type Exception = ExceptionWithCode | ExceptionWithMessage | ExceptionWithName | string; declare interface ExceptionWithCode { code: string | number; name?: string; message?: string; stack?: string; } declare interface ExceptionWithMessage { code?: string | number; message: string; name?: string; stack?: string; } declare interface ExceptionWithName { code?: string | number; message?: string; name: string; stack?: string; } declare type ExtendedEventType = LogLevel | 'beforeExit'; declare interface ExtendedSpanOptions extends SpanOptions { /** The name of the span */ name: string; internal?: boolean; /** Whether it propagates context (?=true) */ active?: boolean; /** The context to append the span to */ context?: Context; } /** $extends, defineExtension */ export declare interface ExtendsHook<Variant extends 'extends' | 'define', TypeMapCb extends TypeMapCbDef, ExtArgs extends Record<string, any>, TypeMap extends TypeMapDef = Call<TypeMapCb, { extArgs: ExtArgs; }>> { extArgs: ExtArgs; <R_ extends { [K in TypeMap['meta']['modelProps'] | '$allModels']?: unknown; }, R, M_ extends { [K in TypeMap['meta']['modelProps'] | '$allModels']?: unknown; }, M, Q_ extends { [K in TypeMap['meta']['modelProps'] | '$allModels' | keyof TypeMap['other']['operations'] | '$allOperations']?: unknown; }, C_ extends { [K in string]?: unknown; }, C, Args extends InternalArgs = InternalArgs<R, M, {}, C>, MergedArgs extends InternalArgs = MergeExtArgs<TypeMap, ExtArgs, Args>>(extension: ((client: DynamicClientExtensionThis<TypeMap, TypeMapCb, ExtArgs>) => { $extends: { extArgs: Args; }; }) | { name?: string; query?: DynamicQueryExtensionArgs<Q_, TypeMap>; result?: DynamicResultExtensionArgs<R_, TypeMap> & R; model?: DynamicModelExtensionArgs<M_, TypeMap, TypeMapCb, ExtArgs> & M; client?: DynamicClientExtensionArgs<C_, TypeMap, TypeMapCb, ExtArgs> & C; }): { extends: DynamicClientExtensionThis<Call<TypeMapCb, { extArgs: MergedArgs; }>, TypeMapCb, MergedArgs>; define: (client: any) => { $extends: { extArgs: Args; }; }; }[Variant]; } export declare type ExtensionArgs = Optional<RequiredExtensionArgs>; declare namespace Extensions { export { defineExtension, getExtensionContext } } export { Extensions } declare namespace Extensions_2 { export { InternalArgs, DefaultArgs, GetPayloadResultExtensionKeys, GetPayloadResultExtensionObject, GetPayloadResult, GetSelect, GetOmit, DynamicQueryExtensionArgs, DynamicQueryExtensionCb, DynamicQueryExtensionCbArgs, DynamicQueryExtensionCbArgsArgs, DynamicResultExtensionArgs, DynamicResultExtensionNeeds, DynamicResultExtensionData, DynamicModelExtensionArgs, DynamicModelExtensionThis, DynamicModelExtensionOperationFn, DynamicModelExtensionFnResult, DynamicModelExtensionFnResultBase, DynamicModelExtensionFluentApi, DynamicModelExtensionFnResultNull, DynamicClientExtensionArgs, DynamicClientExtensionThis, ClientBuiltInProp, DynamicClientExtensionThisBuiltin, ExtendsHook, MergeExtArgs, AllModelsToStringIndex, TypeMapDef, DevTypeMapDef, DevTypeMapFnDef, ClientOptionDef, ClientOtherOps, TypeMapCbDef, ModelKey, RequiredExtensionArgs as UserArgs } } export declare type ExtractGlobalOmit<Options, ModelName extends string> = Options extends { omit: { [K in ModelName]: infer GlobalOmit; }; } ? GlobalOmit : {}; declare type Field = ReadonlyDeep_2<{ kind: FieldKind; name: string; isRequired: boolean; isList: boolean; isUnique: boolean; isId: boolean; isReadOnly: boolean; isGenerated?: boolean; isUpdatedAt?: boolean; /** * Describes the data type in the same the way it is defined in the Prisma schema: * BigInt, Boolean, Bytes, DateTime, Decimal, Float, Int, JSON, String, $ModelName */ type: string; /** * Native database type, if specified. * For example, `@db.VarChar(191)` is encoded as `['VarChar', ['191']]`, * `@db.Text` is encoded as `['Text', []]`. */ nativeType?: [string, string[]] | null; dbName?: string | null; hasDefaultValue: boolean; default?: FieldDefault | FieldDefaultScalar | FieldDefaultScalar[]; relationFromFields?: string[]; relationToFields?: string[]; relationOnDelete?: string; relationOnUpdate?: string; relationName?: string; documentation?: string; }>; declare type FieldDefault = ReadonlyDeep_2<{ name: string; args: Array<string | number>; }>; declare type FieldDefaultScalar = string | boolean | number; declare type FieldInitializer = { type: 'value'; value: PrismaValue; } | { type: 'lastInsertId'; }; declare type FieldKind = 'scalar' | 'object' | 'enum' | 'unsupported'; declare type FieldLocation = 'scalar' | 'inputObjectTypes' | 'outputObjectTypes' | 'enumTypes' | 'fieldRefTypes'; declare type FieldNamespace = 'model' | 'prisma'; declare type FieldOperation = { type: 'set'; value: PrismaValue; } | { type: 'add'; value: PrismaValue; } | { type: 'subtract'; value: PrismaValue; } | { type: 'multiply'; value: PrismaValue; } | { type: 'divide'; value: PrismaValue; }; /** * A reference to a specific field of a specific model */ export declare interface FieldRef<Model, FieldType> { readonly modelName: Model; readonly name: string; readonly typeName: FieldType; readonly isList: boolean; } declare type FieldRefAllowType = TypeRef<'scalar' | 'enumTypes'>; declare type FieldRefType = ReadonlyDeep_2<{ name: string; allowTypes: FieldRefAllowType[]; fields: SchemaArg[]; }>; declare type FieldScalarType = { type: 'string' | 'int' | 'bigint' | 'float' | 'boolean' | 'json' | 'object' | 'datetime' | 'decimal' | 'unsupported'; } | { type: 'enum'; name: string; } | { type: 'bytes'; encoding: 'array' | 'base64' | 'hex'; }; declare type FieldType = { arity: Arity; } & FieldScalarType; declare type FluentOperation = 'findUnique' | 'findUniqueOrThrow' | 'findFirst' | 'findFirstOrThrow' | 'create' | 'update' | 'upsert' | 'delete'; export declare interface Fn<Params = unknown, Returns = unknown> { params: Params; returns: Returns; } declare type Fragment = { type: 'stringChunk'; chunk: string; } | { type: 'parameter'; } | { type: 'parameterTuple'; itemPrefix: string; itemSeparator: string; itemSuffix: string; } | { type: 'parameterTupleList'; itemPrefix: string; itemSeparator: string; itemSuffix: string; groupSeparator: string; }; export declare type GetAggregateResult<P extends OperationPayload, A> = { [K in keyof A as K extends Aggregate ? K : never]: K extends '_count' ? A[K] extends true ? number : Count<A[K]> : { [J in keyof A[K] & string]: P['scalars'][J] | null; }; }; export declare type GetBatchResult = { count: number; }; export declare type GetCountResult<A> = A extends { select: infer S; } ? (S extends true ? number : Count<S>) : number; declare function getExtensionContext<T>(that: T): Context_2<T>; export declare type GetFindResult<P extends OperationPayload, A, GlobalOmitOptions> = Equals<A, any> extends 1 ? DefaultSelection<P, A, GlobalOmitOptions> : A extends { select: infer S extends object; } & Record<string, unknown> | { include: infer I extends object; } & Record<string, unknown> ? { [K in keyof S | keyof I as (S & I)[K] extends false | undefined | Skip | null ? never : K]: (S & I)[K] extends object ? P extends SelectablePayloadFields<K, (infer O)[]> ? O extends OperationPayload ? GetFindResult<O, (S & I)[K], GlobalOmitOptions>[] : never : P extends SelectablePayloadFields<K, infer O | null> ? O extends OperationPayload ? GetFindResult<O, (S & I)[K], GlobalOmitOptions> | SelectField<P, K> & null : never : K extends '_count' ? Count<GetFindResult<P, (S & I)[K], GlobalOmitOptions>> : never : P extends SelectablePayloadFields<K, (infer O)[]> ? O extends OperationPayload ? DefaultSelection<O, {}, GlobalOmitOptions>[] : never : P extends SelectablePayloadFields<K, infer O | null> ? O extends OperationPayload ? DefaultSelection<O, {}, GlobalOmitOptions> | SelectField<P, K> & null : never : P extends { scalars: { [k in K]: infer O; }; } ? O : K extends '_count' ? Count<P['objects']> : never; } & (A extends { include: any; } & Record<string, unknown> ? DefaultSelection<P, A & { omit: A['omit']; }, GlobalOmitOptions> : unknown) : DefaultSelection<P, A, GlobalOmitOptions>; export declare type GetGroupByResult<P extends OperationPayload, A> = A extends { by: string[]; } ? Array<GetAggregateResult<P, A> & { [K in A['by'][number]]: P['scalars'][K]; }> : A extends { by: string; } ? Array<GetAggregateResult<P, A> & { [K in A['by']]: P['scalars'][K]; }> : {}[]; export declare type GetOmit<BaseKeys extends string, R extends InternalArgs['result'][string], ExtraType = never> = { [K in (string extends keyof R ? never : keyof R) | BaseKeys]?: boolean | ExtraType; }; export declare type GetPayloadResult<Base extends Record<any, any>, R extends InternalArgs['result'][string]> = Omit<Base, GetPayloadResultExtensionKeys<R>> & GetPayloadResultExtensionObject<R>; export declare type GetPayloadResultExtensionKeys<R extends InternalArgs['result'][string], KR extends keyof R = string extends keyof R ? never : keyof R> = KR; export declare type GetPayloadResultExtensionObject<R extends InternalArgs['result'][string]> = { [K in GetPayloadResultExtensionKeys<R>]: R[K] extends () => { compute: (...args: any) => infer C; } ? C : never; }; export declare function getPrismaClient(config: GetPrismaClientConfig): { new (optionsArg: PrismaClientOptions): { _originalClient: any; _runtimeDataModel: RuntimeDataModel; _requestHandler: RequestHandler; _connectionPromise?: Promise<any> | undefined; _disconnectionPromise?: Promise<any> | undefined; _engineConfig: EngineConfig; _accelerateEngineConfig: AccelerateEngineConfig; _clientVersion: string; _errorFormat: ErrorFormat; _tracingHelper: TracingHelper; _previewFeatures: string[]; _activeProvider: string; _globalOmit?: GlobalOmitOptions | undefined; _extensions: MergedExtensionsList; /** * @remarks This is used internally by Policy, do not rename or remove */ _engine: Engine; /** * A fully constructed/applied Client that references the parent * PrismaClient. This is used for Client extensions only. */ _appliedParent: any; _createPrismaPromise: PrismaPromiseFactory; $on<E extends ExtendedEventType>(eventType: E, callback: EventCallback<E>): any; $connect(): Promise<void>; /** * Disconnect from the database */ $disconnect(): Promise<void>; /** * Executes a raw query and always returns a number */ $executeRawInternal(transaction: PrismaPromiseTransaction | undefined, clientMethod: string, args: RawQueryArgs, middlewareArgsMapper?: MiddlewareArgsMapper<unknown, unknown>): Promise<number>; /** * Executes a raw query provided through a safe tag function * @see https://github.com/prisma/prisma/issues/7142 * * @param query * @param values * @returns */ $executeRaw(query: TemplateStringsArray | Sql, ...values: any[]): PrismaPromise_2<unknown, any>; /** * Unsafe counterpart of `$executeRaw` that is susceptible to SQL injections * @see https://github.com/prisma/prisma/issues/7142 * * @param query * @param values * @returns */ $executeRawUnsafe(query: string, ...values: RawValue[]): PrismaPromise_2<unknown, any>; /** * Executes a raw command only for MongoDB * * @param command * @returns */ $runCommandRaw(command: Record<string, JsInputValue>): PrismaPromise_2<unknown, any>; /** * Executes a raw query and returns selected data */ $queryRawInternal(transaction: PrismaPromiseTransaction | undefined, clientMethod: string, args: RawQueryArgs, middlewareArgsMapper?: MiddlewareArgsMapper<unknown, unknown>): Promise<any>; /** * Executes a raw query provided through a safe tag function * @see https://github.com/prisma/prisma/issues/7142 * * @param query * @param values * @returns */ $queryRaw(query: TemplateStringsArray | Sql, ...values: any[]): PrismaPromise_2<unknown, any>; /** * Counterpart to $queryRaw, that returns strongly typed results * @param typedSql */ $queryRawTyped(typedSql: UnknownTypedSql): PrismaPromise_2<unknown, any>; /** * Unsafe counterpart of `$queryRaw` that is susceptible to SQL injections * @see https://github.com/prisma/prisma/issues/7142 * * @param query * @param values * @returns */ $queryRawUnsafe(query: string, ...values: RawValue[]): PrismaPromise_2<unknown, any>; /** * Execute a batch of requests in a transaction * @param requests * @param options */ _transactionWithArray({ promises, options, }: { promises: Array<PrismaPromise_2<any>>; options?: BatchTransactionOptions; }): Promise<any>; /** * Perform a long-running transaction * @param callback * @param options * @returns */ _transactionWithCallback({ callback, options, }: { callback: (client: Client) => Promise<unknown>; options?: Options; }): Promise<unknown>; _createItxClient(transaction: PrismaPromiseInteractiveTransaction, scopeId: string, scopeState: ItxScopeState): Client; /** * Execute queries within a transaction * @param input a callback or a query list * @param options to set timeouts (callback) * @returns */ $transaction(input: any, options?: any): Promise<any>; /** * Runs the middlewares over params before executing a request * @param internalParams * @returns */ _request(internalParams: InternalRequestParams): Promise<any>; _executeRequest({ args, clientMethod, dataPath, callsite, action, model, argsMapper, transaction, unpacker, otelParentCtx, customDataProxyFetch, }: InternalRequestParams): Promise<any>; /** * Shortcut for checking a preview flag * @param feature preview flag * @returns */ _hasPreviewFlag(feature: string): boolean; $extends: typeof $extends; readonly [Symbol.toStringTag]: string; }; }; /** * Config that is stored into the generated client. When the generated client is * loaded, this same config is passed to {@link getPrismaClient} which creates a * closure with that config around a non-instantiated [[PrismaClient]]. */ export declare type GetPrismaClientConfig = { runtimeDataModel: RuntimeDataModel; previewFeatures: string[]; clientVersion: string; engineVersion: string; activeProvider: ActiveConnectorType; /** * The contents of the schema encoded into a string */ inlineSchema: string; /** * Optional wasm loading configuration */ compilerWasm?: CompilerWasmLoadingConfig; /** * Parameterization schema for schema-aware query parameterization. * Enables precise parameterization based on DMMF metadata. */ parameterizationSchema: SerializedParamGraph; }; export declare type GetResult<Payload extends OperationPayload, Args, OperationName extends Operation = 'findUniqueOrThrow', GlobalOmitOptions = {}> = { findUnique: GetFindResult<Payload, Args, GlobalOmitOptions> | null; findUniqueOrThrow: GetFindResult<Payload, Args, GlobalOmitOptions>; findFirst: GetFindResult<Payload, Args, GlobalOmitOptions> | null; findFirstOrThrow: GetFindResult<Payload, Args, GlobalOmitOptions>; findMany: GetFindResult<Payload, Args, GlobalOmitOptions>[]; create: GetFindResult<Payload, Args, GlobalOmitOptions>; createMany: GetBatchResult; createManyAndReturn: GetFindResult<Payload, Args, GlobalOmitOptions>[]; update: GetFindResult<Payload, Args, GlobalOmitOptions>; updateMany: GetBatchResult; updateManyAndReturn: GetFindResult<Payload, Args, GlobalOmitOptions>[]; upsert: GetFindResult<Payload, Args, GlobalOmitOptions>; delete: GetFindResult<Payload, Args, GlobalOmitOptions>; deleteMany: GetBatchResult; aggregate: GetAggregateResult<Payload, Args>; count: GetCountResult<Args>; groupBy: GetGroupByResult<Payload, Args>; $queryRaw: unknown; $queryRawTyped: unknown; $executeRaw: number; $queryRawUnsafe: unknown; $executeRawUnsafe: number; $runCommandRaw: JsonObject; findRaw: JsonObject; aggregateRaw: JsonObject; }[OperationName]; export declare function getRuntime(): GetRuntimeOutput; declare type GetRuntimeOutput = { id: RuntimeName; prettyName: string; isEdge: boolean; }; export declare type GetSelect<Base extends Record<any, any>, R extends InternalArgs['result'][string], KR extends keyof R = string extends keyof R ? never : keyof R> = { [K in KR | keyof Base]?: K extends KR ? boolean : Base[K]; }; declare type GlobalOmitOptions = { [modelName: string]: { [fieldName: string]: boolean; }; }; declare type HandleErrorParams = { args: JsArgs; error: any; clientMethod: string; callsite?: CallSite; transaction?: PrismaPromiseTransaction; modelName?: string; globalOmit?: Glo