? DefaultSelection : unknown) : DefaultSelection
;
export declare type GetGroupByResult
= A extends {
by: string[];
} ? Array & {
[K in A['by'][number]]: P['scalars'][K];
}> : A extends {
by: string;
} ? Array & {
[K in A['by']]: P['scalars'][K];
}> : {}[];
export declare type GetOmit = {
[K in (string extends keyof R ? never : keyof R) | BaseKeys]?: boolean | ExtraType;
};
export declare type GetPayloadResult, R extends InternalArgs['result'][string]> = Omit> & GetPayloadResultExtensionObject;
export declare type GetPayloadResultExtensionKeys = KR;
export declare type GetPayloadResultExtensionObject = {
[K in GetPayloadResultExtensionKeys]: 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 | undefined;
_disconnectionPromise?: Promise | undefined;
_engineConfig: EngineConfig;
_accelerateEngineConfig: AccelerateEngineConfig;
_clientVersion: string;
_errorFormat: ErrorFormat;
_tracingHelper: TracingHelper;
_metrics: MetricsClient;
_middlewares: MiddlewareHandler;
_previewFeatures: string[];
_activeProvider: string;
_globalOmit?: GlobalOmitOptions | undefined;
_extensions: MergedExtensionsList;
_engine: Engine;
/**
* A fully constructed/applied Client that references the parent
* PrismaClient. This is used for Client extensions only.
*/
_appliedParent: any;
_createPrismaPromise: PrismaPromiseFactory;
/**
* Hook a middleware into the client
* @param middleware to hook
*/
$use(middleware: QueryMiddleware): void;
$on(eventType: E, callback: EventCallback): void;
$connect(): Promise;
/**
* Disconnect from the database
*/
$disconnect(): Promise;
/**
* Executes a raw query and always returns a number
*/
$executeRawInternal(transaction: PrismaPromiseTransaction | undefined, clientMethod: string, args: RawQueryArgs, middlewareArgsMapper?: MiddlewareArgsMapper): Promise;
/**
* 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;
/**
* 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;
/**
* Executes a raw command only for MongoDB
*
* @param command
* @returns
*/
$runCommandRaw(command: Record): PrismaPromise_2;
/**
* Executes a raw query and returns selected data
*/
$queryRawInternal(transaction: PrismaPromiseTransaction | undefined, clientMethod: string, args: RawQueryArgs, middlewareArgsMapper?: MiddlewareArgsMapper): Promise;
/**
* 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;
/**
* Counterpart to $queryRaw, that returns strongly typed results
* @param typedSql
*/
$queryRawTyped(typedSql: UnknownTypedSql): PrismaPromise_2;
/**
* 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;
/**
* Execute a batch of requests in a transaction
* @param requests
* @param options
*/
_transactionWithArray({ promises, options, }: {
promises: Array>;
options?: BatchTransactionOptions;
}): Promise;
/**
* Perform a long-running transaction
* @param callback
* @param options
* @returns
*/
_transactionWithCallback({ callback, options, }: {
callback: (client: Client) => Promise;
options?: Options;
}): Promise;
_createItxClient(transaction: PrismaPromiseInteractiveTransaction): 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;
/**
* Runs the middlewares over params before executing a request
* @param internalParams
* @returns
*/
_request(internalParams: InternalRequestParams): Promise;
_executeRequest({ args, clientMethod, dataPath, callsite, action, model, argsMapper, transaction, unpacker, otelParentCtx, customDataProxyFetch, }: InternalRequestParams): Promise;
readonly $metrics: MetricsClient;
/**
* Shortcut for checking a preview flag
* @param feature preview flag
* @returns
*/
_hasPreviewFlag(feature: string): boolean;
$applyPendingMigrations(): Promise;
$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]].
*/
declare type GetPrismaClientConfig = {
runtimeDataModel: RuntimeDataModel;
generator?: GeneratorConfig;
relativeEnvPaths: {
rootEnvPath?: string | null;
schemaEnvPath?: string | null;
};
relativePath: string;
dirname: string;
filename?: string;
clientVersion: string;
engineVersion: string;
datasourceNames: string[];
activeProvider: ActiveConnectorType;
/**
* The contents of the schema encoded into a string
* @remarks only used for the purpose of data proxy
*/
inlineSchema: string;
/**
* A special env object just for the data proxy edge runtime.
* Allows bundlers to inject their own env variables (Vercel).
* Allows platforms to declare global variables as env (Workers).
* @remarks only used for the purpose of data proxy
*/
injectableEdgeEnv?: () => LoadedEnv;
/**
* The contents of the datasource url saved in a string.
* This can either be an env var name or connection string.
* It is needed by the client to connect to the Data Proxy.
* @remarks only used for the purpose of data proxy
*/
inlineDatasources: {
[name in string]: {
url: EnvValue;
};
};
/**
* The string hash that was produced for a given schema
* @remarks only used for the purpose of data proxy
*/
inlineSchemaHash: string;
/**
* A marker to indicate that the client was not generated via `prisma
* generate` but was generated via `generate --postinstall` script instead.
* @remarks used to error for Vercel/Netlify for schema caching issues
*/
postinstall?: boolean;
/**
* Information about the CI where the Prisma Client has been generated. The
* name of the CI environment is stored at generation time because CI
* information is not always available at runtime. Moreover, the edge client
* has no notion of environment variables, so this works around that.
* @remarks used to error for Vercel/Netlify for schema caching issues
*/
ciName?: string;
/**
* Information about whether we have not found a schema.prisma file in the
* default location, and that we fell back to finding the schema.prisma file
* in the current working directory. This usually means it has been bundled.
*/
isBundled?: boolean;
/**
* A boolean that is `false` when the client was generated with --no-engine. At
* runtime, this means the client will be bound to be using the Data Proxy.
*/
copyEngine?: boolean;
/**
* Optional wasm loading configuration
*/
engineWasm?: WasmLoadingConfig;
};
export declare type GetResult = {
findUnique: GetFindResult | null;
findUniqueOrThrow: GetFindResult;
findFirst: GetFindResult | null;
findFirstOrThrow: GetFindResult;
findMany: GetFindResult[];
create: GetFindResult;
createMany: GetBatchResult;
createManyAndReturn: GetFindResult[];
update: GetFindResult;
updateMany: GetBatchResult;
upsert: GetFindResult;
delete: GetFindResult;
deleteMany: GetBatchResult;
aggregate: GetAggregateResult;
count: GetCountResult;
groupBy: GetGroupByResult;
$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: Runtime;
prettyName: string;
isEdge: boolean;
};
export declare type GetSelect, 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?: GlobalOmitOptions;
};
/**
* Defines High-Resolution Time.
*
* The first number, HrTime[0], is UNIX Epoch time in seconds since 00:00:00 UTC on 1 January 1970.
* The second number, HrTime[1], represents the partial second elapsed since Unix Epoch time represented by first number in nanoseconds.
* For example, 2021-01-01T12:30:10.150Z in UNIX Epoch time in milliseconds is represented as 1609504210150.
* The first number is calculated by converting and truncating the Epoch time in milliseconds to seconds:
* HrTime[0] = Math.trunc(1609504210150 / 1000) = 1609504210.
* The second number is calculated by converting the digits after the decimal point of the subtraction, (1609504210150 / 1000) - HrTime[0], to nanoseconds:
* HrTime[1] = Number((1609504210.150 - HrTime[0]).toFixed(9)) * 1e9 = 150000000.
* This is represented in HrTime format as [1609504210, 150000000].
*/
declare type HrTime = [number, number];
/**
* Matches a JSON array.
* Unlike \`JsonArray\`, readonly arrays are assignable to this type.
*/
export declare interface InputJsonArray extends ReadonlyArray {
}
/**
* Matches a JSON object.
* Unlike \`JsonObject\`, this type allows undefined and read-only properties.
*/
export declare type InputJsonObject = {
readonly [Key in string]?: InputJsonValue | null;
};
/**
* Matches any valid value that can be used as an input for operations like
* create and update as the value of a JSON field. Unlike \`JsonValue\`, this
* type allows read-only arrays and read-only object properties and disallows
* \`null\` at the top level.
*
* \`null\` cannot be used as the value of a JSON field because its meaning
* would be ambiguous. Use \`Prisma.JsonNull\` to store the JSON null value or
* \`Prisma.DbNull\` to clear the JSON value and set the field to the database
* NULL value instead.
*
* @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-by-null-values
*/
export declare type InputJsonValue = string | number | boolean | InputJsonObject | InputJsonArray | {
toJSON(): unknown;
};
declare type InteractiveTransactionInfo = {
/**
* Transaction ID returned by the query engine.
*/
id: string;
/**
* Arbitrary payload the meaning of which depends on the `Engine` implementation.
* For example, `DataProxyEngine` needs to associate different API endpoints with transactions.
* In `LibraryEngine` and `BinaryEngine` it is currently not used.
*/
payload: Payload;
};
declare type InteractiveTransactionOptions = Transaction_2.InteractiveTransactionInfo;
export declare type InternalArgs = {
result: {
[K in keyof R]: {
[P in keyof R[K]]: () => R[K][P];
};
};
model: {
[K in keyof M]: {
[P in keyof M[K]]: () => M[K][P];
};
};
query: {
[K in keyof Q]: {
[P in keyof Q[K]]: () => Q[K][P];
};
};
client: {
[K in keyof C]: () => C[K];
};
};
declare type InternalRequestParams = {
/**
* The original client method being called.
* Even though the rootField / operation can be changed,
* this method stays as it is, as it's what the user's
* code looks like
*/
clientMethod: string;
/**
* Name of js model that triggered the request. Might be used
* for warnings or error messages
*/
jsModelName?: string;
callsite?: CallSite;
transaction?: PrismaPromiseTransaction;
unpacker?: Unpacker;
otelParentCtx?: Context;
/** Used to "desugar" a user input into an "expanded" one */
argsMapper?: (args?: UserArgs_2) => UserArgs_2;
/** Used to convert args for middleware and back */
middlewareArgsMapper?: MiddlewareArgsMapper;
/** Used for Accelerate client extension via Data Proxy */
customDataProxyFetch?: (fetch: Fetch) => Fetch;
} & Omit;
declare enum IsolationLevel {
ReadUncommitted = "ReadUncommitted",
ReadCommitted = "ReadCommitted",
RepeatableRead = "RepeatableRead",
Snapshot = "Snapshot",
Serializable = "Serializable"
}
declare function isSkip(value: unknown): value is Skip;
export declare function isTypedSql(value: unknown): value is UnknownTypedSql;
export declare type ITXClientDenyList = (typeof denylist)[number];
export declare const itxClientDenyList: readonly (string | symbol)[];
declare interface Job {
resolve: (data: any) => void;
reject: (data: any) => void;
request: any;
}
/**
* Create a SQL query for a list of values.
*/
export declare function join(values: readonly RawValue[], separator?: string, prefix?: string, suffix?: string): Sql;
export declare type JsArgs = {
select?: Selection_2;
include?: Selection_2;
omit?: Omission;
[argName: string]: JsInputValue;
};
export declare type JsInputValue = null | undefined | string | number | boolean | bigint | Uint8Array | Date | DecimalJsLike | ObjectEnumValue | RawParameters | JsonConvertible | FieldRef | JsInputValue[] | Skip | {
[key: string]: JsInputValue;
};
declare type JsonArgumentValue = number | string | boolean | null | RawTaggedValue | JsonArgumentValue[] | {
[key: string]: JsonArgumentValue;
};
/**
* From https://github.com/sindresorhus/type-fest/
* Matches a JSON array.
*/
export declare interface JsonArray extends Array {
}
export declare type JsonBatchQuery = {
batch: JsonQuery[];
transaction?: {
isolationLevel?: Transaction_2.IsolationLevel;
};
};
export declare interface JsonConvertible {
toJSON(): unknown;
}
declare type JsonFieldSelection = {
arguments?: Record | RawTaggedValue;
selection: JsonSelectionSet;
};
declare class JsonNull extends NullTypesEnumValue {
}
/**
* From https://github.com/sindresorhus/type-fest/
* Matches a JSON object.
* This type can be useful to enforce some input to be JSON-compatible or as a super-type to be extended from.
*/
export declare type JsonObject = {
[Key in string]?: JsonValue;
};
export declare type JsonQuery = {
modelName?: string;
action: JsonQueryAction;
query: JsonFieldSelection;
};
declare type JsonQueryAction = 'findUnique' | 'findUniqueOrThrow' | 'findFirst' | 'findFirstOrThrow' | 'findMany' | 'createOne' | 'createMany' | 'createManyAndReturn' | 'updateOne' | 'updateMany' | 'deleteOne' | 'deleteMany' | 'upsertOne' | 'aggregate' | 'groupBy' | 'executeRaw' | 'queryRaw' | 'runCommandRaw' | 'findRaw' | 'aggregateRaw';
declare type JsonSelectionSet = {
$scalars?: boolean;
$composites?: boolean;
} & {
[fieldName: string]: boolean | JsonFieldSelection;
};
/**
* From https://github.com/sindresorhus/type-fest/
* Matches any valid JSON value.
*/
export declare type JsonValue = string | number | boolean | JsonObject | JsonArray | null;
export declare type JsOutputValue = null | string | number | boolean | bigint | Uint8Array | Date | Decimal | JsOutputValue[] | {
[key: string]: JsOutputValue;
};
export declare type JsPromise = Promise & {};
declare type KnownErrorParams = {
code: string;
clientVersion: string;
meta?: Record;
batchRequestIdx?: number;
};
/**
* A pointer from the current {@link Span} to another span in the same trace or
* in a different trace.
* Few examples of Link usage.
* 1. Batch Processing: A batch of elements may contain elements associated
* with one or more traces/spans. Since there can only be one parent
* SpanContext, Link is used to keep reference to SpanContext of all
* elements in the batch.
* 2. Public Endpoint: A SpanContext in incoming client request on a public
* endpoint is untrusted from service provider perspective. In such case it
* is advisable to start a new trace with appropriate sampling decision.
* However, it is desirable to associate incoming SpanContext to new trace
* initiated on service provider side so two traces (from Client and from
* Service Provider) can be correlated.
*/
declare interface Link {
/** The {@link SpanContext} of a linked span. */
context: SpanContext;
/** A set of {@link SpanAttributes} on the link. */
attributes?: SpanAttributes;
/** Count of attributes of the link that were dropped due to collection limits */
droppedAttributesCount?: number;
}
declare type LoadedEnv = {
message?: string;
parsed: {
[x: string]: string;
};
} | undefined;
declare type LocationInFile = {
fileName: string;
lineNumber: number | null;
columnNumber: number | null;
};
declare type LogDefinition = {
level: LogLevel;
emit: 'stdout' | 'event';
};
/**
* Typings for the events we emit.
*
* @remarks
* If this is updated, our edge runtime shim needs to be updated as well.
*/
declare type LogEmitter = {
on(event: E, listener: (event: EngineEvent) => void): LogEmitter;
emit(event: QueryEventType, payload: QueryEvent): boolean;
emit(event: LogEventType, payload: LogEvent): boolean;
};
declare type LogEvent = {
timestamp: Date;
message: string;
target: string;
};
declare type LogEventType = 'info' | 'warn' | 'error';
declare type LogLevel = 'info' | 'query' | 'warn' | 'error';
/**
* Generates more strict variant of an enum which, unlike regular enum,
* throws on non-existing property access. This can be useful in following situations:
* - we have an API, that accepts both `undefined` and `SomeEnumType` as an input
* - enum values are generated dynamically from DMMF.
*
* In that case, if using normal enums and no compile-time typechecking, using non-existing property
* will result in `undefined` value being used, which will be accepted. Using strict enum
* in this case will help to have a runtime exception, telling you that you are probably doing something wrong.
*
* Note: if you need to check for existence of a value in the enum you can still use either
* `in` operator or `hasOwnProperty` function.
*
* @param definition
* @returns
*/
export declare function makeStrictEnum