library.d.ts 110 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273
  1. /**
  2. * @param this
  3. */
  4. declare function $extends(this: Client, extension: ExtensionArgs | ((client: Client) => Client)): Client;
  5. declare type AccelerateEngineConfig = {
  6. inlineSchema: EngineConfig['inlineSchema'];
  7. inlineSchemaHash: EngineConfig['inlineSchemaHash'];
  8. env: EngineConfig['env'];
  9. generator?: {
  10. previewFeatures: string[];
  11. };
  12. inlineDatasources: EngineConfig['inlineDatasources'];
  13. overrideDatasources: EngineConfig['overrideDatasources'];
  14. clientVersion: EngineConfig['clientVersion'];
  15. engineVersion: EngineConfig['engineVersion'];
  16. logEmitter: EngineConfig['logEmitter'];
  17. logQueries?: EngineConfig['logQueries'];
  18. logLevel?: EngineConfig['logLevel'];
  19. tracingHelper: EngineConfig['tracingHelper'];
  20. accelerateUtils?: EngineConfig['accelerateUtils'];
  21. };
  22. export declare type Action = keyof typeof DMMF.ModelAction | 'executeRaw' | 'queryRaw' | 'runCommandRaw';
  23. declare type ActiveConnectorType = Exclude<ConnectorType, 'postgres'>;
  24. export declare type Aggregate = '_count' | '_max' | '_min' | '_avg' | '_sum';
  25. export declare type AllModelsToStringIndex<TypeMap extends TypeMapDef, Args extends Record<string, any>, K extends PropertyKey> = Args extends {
  26. [P in K]: {
  27. $allModels: infer AllModels;
  28. };
  29. } ? {
  30. [P in K]: Record<TypeMap['meta']['modelProps'], AllModels>;
  31. } : {};
  32. declare class AnyNull extends NullTypesEnumValue {
  33. }
  34. export declare type ApplyOmit<T, OmitConfig> = Compute<{
  35. [K in keyof T as OmitValue<OmitConfig, K> extends true ? never : K]: T[K];
  36. }>;
  37. export declare type Args<T, F extends Operation> = T extends {
  38. [K: symbol]: {
  39. types: {
  40. operations: {
  41. [K in F]: {
  42. args: any;
  43. };
  44. };
  45. };
  46. };
  47. } ? T[symbol]['types']['operations'][F]['args'] : any;
  48. export declare type Args_3<T, F extends Operation> = Args<T, F>;
  49. /**
  50. * Attributes is a map from string to attribute values.
  51. *
  52. * Note: only the own enumerable keys are counted as valid attribute keys.
  53. */
  54. declare interface Attributes {
  55. [attributeKey: string]: AttributeValue | undefined;
  56. }
  57. /**
  58. * Attribute values may be any non-nullish primitive value except an object.
  59. *
  60. * null or undefined attribute values are invalid and will result in undefined behavior.
  61. */
  62. declare type AttributeValue = string | number | boolean | Array<null | undefined | string> | Array<null | undefined | number> | Array<null | undefined | boolean>;
  63. export declare type BaseDMMF = {
  64. readonly datamodel: Omit<DMMF.Datamodel, 'indexes'>;
  65. };
  66. declare type BatchArgs = {
  67. queries: BatchQuery[];
  68. transaction?: {
  69. isolationLevel?: IsolationLevel;
  70. };
  71. };
  72. declare type BatchInternalParams = {
  73. requests: RequestParams[];
  74. customDataProxyFetch?: CustomDataProxyFetch;
  75. };
  76. declare type BatchQuery = {
  77. model: string | undefined;
  78. operation: string;
  79. args: JsArgs | RawQueryArgs;
  80. };
  81. declare type BatchQueryEngineResult<T> = QueryEngineResult<T> | Error;
  82. declare type BatchQueryOptionsCb = (args: BatchQueryOptionsCbArgs) => Promise<any>;
  83. declare type BatchQueryOptionsCbArgs = {
  84. args: BatchArgs;
  85. query: (args: BatchArgs, __internalParams?: BatchInternalParams) => Promise<unknown[]>;
  86. __internalParams: BatchInternalParams;
  87. };
  88. declare type BatchTransactionOptions = {
  89. isolationLevel?: Transaction_2.IsolationLevel;
  90. };
  91. declare interface BinaryTargetsEnvValue {
  92. fromEnvVar: string | null;
  93. value: string;
  94. native?: boolean;
  95. }
  96. export declare type Call<F extends Fn, P> = (F & {
  97. params: P;
  98. })['returns'];
  99. declare interface CallSite {
  100. getLocation(): LocationInFile | null;
  101. }
  102. export declare type Cast<A, W> = A extends W ? A : W;
  103. declare type Client = ReturnType<typeof getPrismaClient> extends new () => infer T ? T : never;
  104. export declare type ClientArg = {
  105. [MethodName in string]: unknown;
  106. };
  107. export declare type ClientArgs = {
  108. client: ClientArg;
  109. };
  110. export declare type ClientBuiltInProp = keyof DynamicClientExtensionThisBuiltin<never, never, never, never>;
  111. export declare type ClientOptionDef = undefined | {
  112. [K in string]: any;
  113. };
  114. declare type ColumnType = (typeof ColumnTypeEnum)[keyof typeof ColumnTypeEnum];
  115. declare const ColumnTypeEnum: {
  116. readonly Int32: 0;
  117. readonly Int64: 1;
  118. readonly Float: 2;
  119. readonly Double: 3;
  120. readonly Numeric: 4;
  121. readonly Boolean: 5;
  122. readonly Character: 6;
  123. readonly Text: 7;
  124. readonly Date: 8;
  125. readonly Time: 9;
  126. readonly DateTime: 10;
  127. readonly Json: 11;
  128. readonly Enum: 12;
  129. readonly Bytes: 13;
  130. readonly Set: 14;
  131. readonly Uuid: 15;
  132. readonly Int32Array: 64;
  133. readonly Int64Array: 65;
  134. readonly FloatArray: 66;
  135. readonly DoubleArray: 67;
  136. readonly NumericArray: 68;
  137. readonly BooleanArray: 69;
  138. readonly CharacterArray: 70;
  139. readonly TextArray: 71;
  140. readonly DateArray: 72;
  141. readonly TimeArray: 73;
  142. readonly DateTimeArray: 74;
  143. readonly JsonArray: 75;
  144. readonly EnumArray: 76;
  145. readonly BytesArray: 77;
  146. readonly UuidArray: 78;
  147. readonly UnknownNumber: 128;
  148. };
  149. export declare type Compute<T> = T extends Function ? T : {
  150. [K in keyof T]: T[K];
  151. } & unknown;
  152. export declare type ComputeDeep<T> = T extends Function ? T : {
  153. [K in keyof T]: ComputeDeep<T[K]>;
  154. } & unknown;
  155. declare type ComputedField = {
  156. name: string;
  157. needs: string[];
  158. compute: ResultArgsFieldCompute;
  159. };
  160. declare type ComputedFieldsMap = {
  161. [fieldName: string]: ComputedField;
  162. };
  163. declare type ConnectionInfo = {
  164. schemaName?: string;
  165. maxBindValues?: number;
  166. };
  167. declare type ConnectorType = 'mysql' | 'mongodb' | 'sqlite' | 'postgresql' | 'postgres' | 'sqlserver' | 'cockroachdb';
  168. declare interface Context {
  169. /**
  170. * Get a value from the context.
  171. *
  172. * @param key key which identifies a context value
  173. */
  174. getValue(key: symbol): unknown;
  175. /**
  176. * Create a new context which inherits from this context and has
  177. * the given key set to the given value.
  178. *
  179. * @param key context key for which to set the value
  180. * @param value value to set for the given key
  181. */
  182. setValue(key: symbol, value: unknown): Context;
  183. /**
  184. * Return a new context which inherits from this context but does
  185. * not contain a value for the given key.
  186. *
  187. * @param key context key for which to clear a value
  188. */
  189. deleteValue(key: symbol): Context;
  190. }
  191. declare type Context_2<T> = T extends {
  192. [K: symbol]: {
  193. ctx: infer C;
  194. };
  195. } ? C & T & {
  196. /**
  197. * @deprecated Use `$name` instead.
  198. */
  199. name?: string;
  200. $name?: string;
  201. $parent?: unknown;
  202. } : T & {
  203. /**
  204. * @deprecated Use `$name` instead.
  205. */
  206. name?: string;
  207. $name?: string;
  208. $parent?: unknown;
  209. };
  210. export declare type Count<O> = {
  211. [K in keyof O]: Count<number>;
  212. } & {};
  213. declare type CustomDataProxyFetch = (fetch: Fetch) => Fetch;
  214. declare class DataLoader<T = unknown> {
  215. private options;
  216. batches: {
  217. [key: string]: Job[];
  218. };
  219. private tickActive;
  220. constructor(options: DataLoaderOptions<T>);
  221. request(request: T): Promise<any>;
  222. private dispatchBatches;
  223. get [Symbol.toStringTag](): string;
  224. }
  225. declare type DataLoaderOptions<T> = {
  226. singleLoader: (request: T) => Promise<any>;
  227. batchLoader: (request: T[]) => Promise<any[]>;
  228. batchBy: (request: T) => string | undefined;
  229. batchOrder: (requestA: T, requestB: T) => number;
  230. };
  231. declare type Datasource = {
  232. url?: string;
  233. };
  234. declare type Datasources = {
  235. [name in string]: Datasource;
  236. };
  237. declare class DbNull extends NullTypesEnumValue {
  238. }
  239. export declare const Debug: typeof debugCreate & {
  240. enable(namespace: any): void;
  241. disable(): any;
  242. enabled(namespace: string): boolean;
  243. log: (...args: string[]) => void;
  244. formatters: {};
  245. };
  246. /**
  247. * Create a new debug instance with the given namespace.
  248. *
  249. * @example
  250. * ```ts
  251. * import Debug from '@prisma/debug'
  252. * const debug = Debug('prisma:client')
  253. * debug('Hello World')
  254. * ```
  255. */
  256. declare function debugCreate(namespace: string): ((...args: any[]) => void) & {
  257. color: string;
  258. enabled: boolean;
  259. namespace: string;
  260. log: (...args: string[]) => void;
  261. extend: () => void;
  262. };
  263. export declare namespace Decimal {
  264. export type Constructor = typeof Decimal;
  265. export type Instance = Decimal;
  266. export type Rounding = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
  267. export type Modulo = Rounding | 9;
  268. export type Value = string | number | Decimal;
  269. // http://mikemcl.github.io/decimal.js/#constructor-properties
  270. export interface Config {
  271. precision?: number;
  272. rounding?: Rounding;
  273. toExpNeg?: number;
  274. toExpPos?: number;
  275. minE?: number;
  276. maxE?: number;
  277. crypto?: boolean;
  278. modulo?: Modulo;
  279. defaults?: boolean;
  280. }
  281. }
  282. export declare class Decimal {
  283. readonly d: number[];
  284. readonly e: number;
  285. readonly s: number;
  286. constructor(n: Decimal.Value);
  287. absoluteValue(): Decimal;
  288. abs(): Decimal;
  289. ceil(): Decimal;
  290. clampedTo(min: Decimal.Value, max: Decimal.Value): Decimal;
  291. clamp(min: Decimal.Value, max: Decimal.Value): Decimal;
  292. comparedTo(n: Decimal.Value): number;
  293. cmp(n: Decimal.Value): number;
  294. cosine(): Decimal;
  295. cos(): Decimal;
  296. cubeRoot(): Decimal;
  297. cbrt(): Decimal;
  298. decimalPlaces(): number;
  299. dp(): number;
  300. dividedBy(n: Decimal.Value): Decimal;
  301. div(n: Decimal.Value): Decimal;
  302. dividedToIntegerBy(n: Decimal.Value): Decimal;
  303. divToInt(n: Decimal.Value): Decimal;
  304. equals(n: Decimal.Value): boolean;
  305. eq(n: Decimal.Value): boolean;
  306. floor(): Decimal;
  307. greaterThan(n: Decimal.Value): boolean;
  308. gt(n: Decimal.Value): boolean;
  309. greaterThanOrEqualTo(n: Decimal.Value): boolean;
  310. gte(n: Decimal.Value): boolean;
  311. hyperbolicCosine(): Decimal;
  312. cosh(): Decimal;
  313. hyperbolicSine(): Decimal;
  314. sinh(): Decimal;
  315. hyperbolicTangent(): Decimal;
  316. tanh(): Decimal;
  317. inverseCosine(): Decimal;
  318. acos(): Decimal;
  319. inverseHyperbolicCosine(): Decimal;
  320. acosh(): Decimal;
  321. inverseHyperbolicSine(): Decimal;
  322. asinh(): Decimal;
  323. inverseHyperbolicTangent(): Decimal;
  324. atanh(): Decimal;
  325. inverseSine(): Decimal;
  326. asin(): Decimal;
  327. inverseTangent(): Decimal;
  328. atan(): Decimal;
  329. isFinite(): boolean;
  330. isInteger(): boolean;
  331. isInt(): boolean;
  332. isNaN(): boolean;
  333. isNegative(): boolean;
  334. isNeg(): boolean;
  335. isPositive(): boolean;
  336. isPos(): boolean;
  337. isZero(): boolean;
  338. lessThan(n: Decimal.Value): boolean;
  339. lt(n: Decimal.Value): boolean;
  340. lessThanOrEqualTo(n: Decimal.Value): boolean;
  341. lte(n: Decimal.Value): boolean;
  342. logarithm(n?: Decimal.Value): Decimal;
  343. log(n?: Decimal.Value): Decimal;
  344. minus(n: Decimal.Value): Decimal;
  345. sub(n: Decimal.Value): Decimal;
  346. modulo(n: Decimal.Value): Decimal;
  347. mod(n: Decimal.Value): Decimal;
  348. naturalExponential(): Decimal;
  349. exp(): Decimal;
  350. naturalLogarithm(): Decimal;
  351. ln(): Decimal;
  352. negated(): Decimal;
  353. neg(): Decimal;
  354. plus(n: Decimal.Value): Decimal;
  355. add(n: Decimal.Value): Decimal;
  356. precision(includeZeros?: boolean): number;
  357. sd(includeZeros?: boolean): number;
  358. round(): Decimal;
  359. sine() : Decimal;
  360. sin() : Decimal;
  361. squareRoot(): Decimal;
  362. sqrt(): Decimal;
  363. tangent() : Decimal;
  364. tan() : Decimal;
  365. times(n: Decimal.Value): Decimal;
  366. mul(n: Decimal.Value) : Decimal;
  367. toBinary(significantDigits?: number): string;
  368. toBinary(significantDigits: number, rounding: Decimal.Rounding): string;
  369. toDecimalPlaces(decimalPlaces?: number): Decimal;
  370. toDecimalPlaces(decimalPlaces: number, rounding: Decimal.Rounding): Decimal;
  371. toDP(decimalPlaces?: number): Decimal;
  372. toDP(decimalPlaces: number, rounding: Decimal.Rounding): Decimal;
  373. toExponential(decimalPlaces?: number): string;
  374. toExponential(decimalPlaces: number, rounding: Decimal.Rounding): string;
  375. toFixed(decimalPlaces?: number): string;
  376. toFixed(decimalPlaces: number, rounding: Decimal.Rounding): string;
  377. toFraction(max_denominator?: Decimal.Value): Decimal[];
  378. toHexadecimal(significantDigits?: number): string;
  379. toHexadecimal(significantDigits: number, rounding: Decimal.Rounding): string;
  380. toHex(significantDigits?: number): string;
  381. toHex(significantDigits: number, rounding?: Decimal.Rounding): string;
  382. toJSON(): string;
  383. toNearest(n: Decimal.Value, rounding?: Decimal.Rounding): Decimal;
  384. toNumber(): number;
  385. toOctal(significantDigits?: number): string;
  386. toOctal(significantDigits: number, rounding: Decimal.Rounding): string;
  387. toPower(n: Decimal.Value): Decimal;
  388. pow(n: Decimal.Value): Decimal;
  389. toPrecision(significantDigits?: number): string;
  390. toPrecision(significantDigits: number, rounding: Decimal.Rounding): string;
  391. toSignificantDigits(significantDigits?: number): Decimal;
  392. toSignificantDigits(significantDigits: number, rounding: Decimal.Rounding): Decimal;
  393. toSD(significantDigits?: number): Decimal;
  394. toSD(significantDigits: number, rounding: Decimal.Rounding): Decimal;
  395. toString(): string;
  396. truncated(): Decimal;
  397. trunc(): Decimal;
  398. valueOf(): string;
  399. static abs(n: Decimal.Value): Decimal;
  400. static acos(n: Decimal.Value): Decimal;
  401. static acosh(n: Decimal.Value): Decimal;
  402. static add(x: Decimal.Value, y: Decimal.Value): Decimal;
  403. static asin(n: Decimal.Value): Decimal;
  404. static asinh(n: Decimal.Value): Decimal;
  405. static atan(n: Decimal.Value): Decimal;
  406. static atanh(n: Decimal.Value): Decimal;
  407. static atan2(y: Decimal.Value, x: Decimal.Value): Decimal;
  408. static cbrt(n: Decimal.Value): Decimal;
  409. static ceil(n: Decimal.Value): Decimal;
  410. static clamp(n: Decimal.Value, min: Decimal.Value, max: Decimal.Value): Decimal;
  411. static clone(object?: Decimal.Config): Decimal.Constructor;
  412. static config(object: Decimal.Config): Decimal.Constructor;
  413. static cos(n: Decimal.Value): Decimal;
  414. static cosh(n: Decimal.Value): Decimal;
  415. static div(x: Decimal.Value, y: Decimal.Value): Decimal;
  416. static exp(n: Decimal.Value): Decimal;
  417. static floor(n: Decimal.Value): Decimal;
  418. static hypot(...n: Decimal.Value[]): Decimal;
  419. static isDecimal(object: any): object is Decimal;
  420. static ln(n: Decimal.Value): Decimal;
  421. static log(n: Decimal.Value, base?: Decimal.Value): Decimal;
  422. static log2(n: Decimal.Value): Decimal;
  423. static log10(n: Decimal.Value): Decimal;
  424. static max(...n: Decimal.Value[]): Decimal;
  425. static min(...n: Decimal.Value[]): Decimal;
  426. static mod(x: Decimal.Value, y: Decimal.Value): Decimal;
  427. static mul(x: Decimal.Value, y: Decimal.Value): Decimal;
  428. static noConflict(): Decimal.Constructor; // Browser only
  429. static pow(base: Decimal.Value, exponent: Decimal.Value): Decimal;
  430. static random(significantDigits?: number): Decimal;
  431. static round(n: Decimal.Value): Decimal;
  432. static set(object: Decimal.Config): Decimal.Constructor;
  433. static sign(n: Decimal.Value): number;
  434. static sin(n: Decimal.Value): Decimal;
  435. static sinh(n: Decimal.Value): Decimal;
  436. static sqrt(n: Decimal.Value): Decimal;
  437. static sub(x: Decimal.Value, y: Decimal.Value): Decimal;
  438. static sum(...n: Decimal.Value[]): Decimal;
  439. static tan(n: Decimal.Value): Decimal;
  440. static tanh(n: Decimal.Value): Decimal;
  441. static trunc(n: Decimal.Value): Decimal;
  442. static readonly default?: Decimal.Constructor;
  443. static readonly Decimal?: Decimal.Constructor;
  444. static readonly precision: number;
  445. static readonly rounding: Decimal.Rounding;
  446. static readonly toExpNeg: number;
  447. static readonly toExpPos: number;
  448. static readonly minE: number;
  449. static readonly maxE: number;
  450. static readonly crypto: boolean;
  451. static readonly modulo: Decimal.Modulo;
  452. static readonly ROUND_UP: 0;
  453. static readonly ROUND_DOWN: 1;
  454. static readonly ROUND_CEIL: 2;
  455. static readonly ROUND_FLOOR: 3;
  456. static readonly ROUND_HALF_UP: 4;
  457. static readonly ROUND_HALF_DOWN: 5;
  458. static readonly ROUND_HALF_EVEN: 6;
  459. static readonly ROUND_HALF_CEIL: 7;
  460. static readonly ROUND_HALF_FLOOR: 8;
  461. static readonly EUCLID: 9;
  462. }
  463. /**
  464. * Interface for any Decimal.js-like library
  465. * Allows us to accept Decimal.js from different
  466. * versions and some compatible alternatives
  467. */
  468. export declare interface DecimalJsLike {
  469. d: number[];
  470. e: number;
  471. s: number;
  472. toFixed(): string;
  473. }
  474. export declare type DefaultArgs = InternalArgs<{}, {}, {}, {}>;
  475. export declare type DefaultSelection<Payload extends OperationPayload, Args = {}, ClientOptions = {}> = Args extends {
  476. omit: infer LocalOmit;
  477. } ? ApplyOmit<UnwrapPayload<{
  478. default: Payload;
  479. }>['default'], PatchFlat<LocalOmit, ExtractGlobalOmit<ClientOptions, Uncapitalize<Payload['name']>>>> : ApplyOmit<UnwrapPayload<{
  480. default: Payload;
  481. }>['default'], ExtractGlobalOmit<ClientOptions, Uncapitalize<Payload['name']>>>;
  482. export declare function defineDmmfProperty(target: object, runtimeDataModel: RuntimeDataModel): void;
  483. declare function defineExtension(ext: ExtensionArgs | ((client: Client) => Client)): (client: Client) => Client;
  484. declare const denylist: readonly ["$connect", "$disconnect", "$on", "$transaction", "$use", "$extends"];
  485. export declare type DevTypeMapDef = {
  486. meta: {
  487. modelProps: string;
  488. };
  489. model: {
  490. [Model in PropertyKey]: {
  491. [Operation in PropertyKey]: DevTypeMapFnDef;
  492. };
  493. };
  494. other: {
  495. [Operation in PropertyKey]: DevTypeMapFnDef;
  496. };
  497. };
  498. export declare type DevTypeMapFnDef = {
  499. args: any;
  500. result: any;
  501. payload: OperationPayload;
  502. };
  503. export declare namespace DMMF {
  504. export type Document = ReadonlyDeep_2<{
  505. datamodel: Datamodel;
  506. schema: Schema;
  507. mappings: Mappings;
  508. }>;
  509. export type Mappings = ReadonlyDeep_2<{
  510. modelOperations: ModelMapping[];
  511. otherOperations: {
  512. read: string[];
  513. write: string[];
  514. };
  515. }>;
  516. export type OtherOperationMappings = ReadonlyDeep_2<{
  517. read: string[];
  518. write: string[];
  519. }>;
  520. export type DatamodelEnum = ReadonlyDeep_2<{
  521. name: string;
  522. values: EnumValue[];
  523. dbName?: string | null;
  524. documentation?: string;
  525. }>;
  526. export type SchemaEnum = ReadonlyDeep_2<{
  527. name: string;
  528. values: string[];
  529. }>;
  530. export type EnumValue = ReadonlyDeep_2<{
  531. name: string;
  532. dbName: string | null;
  533. }>;
  534. export type Datamodel = ReadonlyDeep_2<{
  535. models: Model[];
  536. enums: DatamodelEnum[];
  537. types: Model[];
  538. indexes: Index[];
  539. }>;
  540. export type uniqueIndex = ReadonlyDeep_2<{
  541. name: string;
  542. fields: string[];
  543. }>;
  544. export type PrimaryKey = ReadonlyDeep_2<{
  545. name: string | null;
  546. fields: string[];
  547. }>;
  548. export type Model = ReadonlyDeep_2<{
  549. name: string;
  550. dbName: string | null;
  551. fields: Field[];
  552. uniqueFields: string[][];
  553. uniqueIndexes: uniqueIndex[];
  554. documentation?: string;
  555. primaryKey: PrimaryKey | null;
  556. isGenerated?: boolean;
  557. }>;
  558. export type FieldKind = 'scalar' | 'object' | 'enum' | 'unsupported';
  559. export type FieldNamespace = 'model' | 'prisma';
  560. export type FieldLocation = 'scalar' | 'inputObjectTypes' | 'outputObjectTypes' | 'enumTypes' | 'fieldRefTypes';
  561. export type Field = ReadonlyDeep_2<{
  562. kind: FieldKind;
  563. name: string;
  564. isRequired: boolean;
  565. isList: boolean;
  566. isUnique: boolean;
  567. isId: boolean;
  568. isReadOnly: boolean;
  569. isGenerated?: boolean;
  570. isUpdatedAt?: boolean;
  571. /**
  572. * Describes the data type in the same the way it is defined in the Prisma schema:
  573. * BigInt, Boolean, Bytes, DateTime, Decimal, Float, Int, JSON, String, $ModelName
  574. */
  575. type: string;
  576. dbName?: string | null;
  577. hasDefaultValue: boolean;
  578. default?: FieldDefault | FieldDefaultScalar | FieldDefaultScalar[];
  579. relationFromFields?: string[];
  580. relationToFields?: string[];
  581. relationOnDelete?: string;
  582. relationName?: string;
  583. documentation?: string;
  584. }>;
  585. export type FieldDefault = ReadonlyDeep_2<{
  586. name: string;
  587. args: any[];
  588. }>;
  589. export type FieldDefaultScalar = string | boolean | number;
  590. export type Index = ReadonlyDeep_2<{
  591. model: string;
  592. type: IndexType;
  593. isDefinedOnField: boolean;
  594. name?: string;
  595. dbName?: string;
  596. algorithm?: string;
  597. clustered?: boolean;
  598. fields: IndexField[];
  599. }>;
  600. export type IndexType = 'id' | 'normal' | 'unique' | 'fulltext';
  601. export type IndexField = ReadonlyDeep_2<{
  602. name: string;
  603. sortOrder?: SortOrder;
  604. length?: number;
  605. operatorClass?: string;
  606. }>;
  607. export type SortOrder = 'asc' | 'desc';
  608. export type Schema = ReadonlyDeep_2<{
  609. rootQueryType?: string;
  610. rootMutationType?: string;
  611. inputObjectTypes: {
  612. model?: InputType[];
  613. prisma: InputType[];
  614. };
  615. outputObjectTypes: {
  616. model: OutputType[];
  617. prisma: OutputType[];
  618. };
  619. enumTypes: {
  620. model?: SchemaEnum[];
  621. prisma: SchemaEnum[];
  622. };
  623. fieldRefTypes: {
  624. prisma?: FieldRefType[];
  625. };
  626. }>;
  627. export type Query = ReadonlyDeep_2<{
  628. name: string;
  629. args: SchemaArg[];
  630. output: QueryOutput;
  631. }>;
  632. export type QueryOutput = ReadonlyDeep_2<{
  633. name: string;
  634. isRequired: boolean;
  635. isList: boolean;
  636. }>;
  637. export type TypeRef<AllowedLocations extends FieldLocation> = {
  638. isList: boolean;
  639. type: string;
  640. location: AllowedLocations;
  641. namespace?: FieldNamespace;
  642. };
  643. export type InputTypeRef = TypeRef<'scalar' | 'inputObjectTypes' | 'enumTypes' | 'fieldRefTypes'>;
  644. export type SchemaArg = ReadonlyDeep_2<{
  645. name: string;
  646. comment?: string;
  647. isNullable: boolean;
  648. isRequired: boolean;
  649. inputTypes: InputTypeRef[];
  650. deprecation?: Deprecation;
  651. }>;
  652. export type OutputType = ReadonlyDeep_2<{
  653. name: string;
  654. fields: SchemaField[];
  655. }>;
  656. export type SchemaField = ReadonlyDeep_2<{
  657. name: string;
  658. isNullable?: boolean;
  659. outputType: OutputTypeRef;
  660. args: SchemaArg[];
  661. deprecation?: Deprecation;
  662. documentation?: string;
  663. }>;
  664. export type OutputTypeRef = TypeRef<'scalar' | 'outputObjectTypes' | 'enumTypes'>;
  665. export type Deprecation = ReadonlyDeep_2<{
  666. sinceVersion: string;
  667. reason: string;
  668. plannedRemovalVersion?: string;
  669. }>;
  670. export type InputType = ReadonlyDeep_2<{
  671. name: string;
  672. constraints: {
  673. maxNumFields: number | null;
  674. minNumFields: number | null;
  675. fields?: string[];
  676. };
  677. meta?: {
  678. source?: string;
  679. };
  680. fields: SchemaArg[];
  681. }>;
  682. export type FieldRefType = ReadonlyDeep_2<{
  683. name: string;
  684. allowTypes: FieldRefAllowType[];
  685. fields: SchemaArg[];
  686. }>;
  687. export type FieldRefAllowType = TypeRef<'scalar' | 'enumTypes'>;
  688. export type ModelMapping = ReadonlyDeep_2<{
  689. model: string;
  690. plural: string;
  691. findUnique?: string | null;
  692. findUniqueOrThrow?: string | null;
  693. findFirst?: string | null;
  694. findFirstOrThrow?: string | null;
  695. findMany?: string | null;
  696. create?: string | null;
  697. createMany?: string | null;
  698. createManyAndReturn?: string | null;
  699. update?: string | null;
  700. updateMany?: string | null;
  701. upsert?: string | null;
  702. delete?: string | null;
  703. deleteMany?: string | null;
  704. aggregate?: string | null;
  705. groupBy?: string | null;
  706. count?: string | null;
  707. findRaw?: string | null;
  708. aggregateRaw?: string | null;
  709. }>;
  710. export enum ModelAction {
  711. findUnique = "findUnique",
  712. findUniqueOrThrow = "findUniqueOrThrow",
  713. findFirst = "findFirst",
  714. findFirstOrThrow = "findFirstOrThrow",
  715. findMany = "findMany",
  716. create = "create",
  717. createMany = "createMany",
  718. createManyAndReturn = "createManyAndReturn",
  719. update = "update",
  720. updateMany = "updateMany",
  721. upsert = "upsert",
  722. delete = "delete",
  723. deleteMany = "deleteMany",
  724. groupBy = "groupBy",
  725. count = "count",// TODO: count does not actually exist, why?
  726. aggregate = "aggregate",
  727. findRaw = "findRaw",
  728. aggregateRaw = "aggregateRaw"
  729. }
  730. }
  731. export declare interface DriverAdapter extends Queryable {
  732. /**
  733. * Starts new transaction.
  734. */
  735. startTransaction(): Promise<Result_4<Transaction>>;
  736. /**
  737. * Optional method that returns extra connection info
  738. */
  739. getConnectionInfo?(): Result_4<ConnectionInfo>;
  740. }
  741. /** Client */
  742. export declare type DynamicClientExtensionArgs<C_, TypeMap extends TypeMapDef, TypeMapCb extends TypeMapCbDef, ExtArgs extends Record<string, any>, ClientOptions> = {
  743. [P in keyof C_]: unknown;
  744. } & {
  745. [K: symbol]: {
  746. ctx: Optional<DynamicClientExtensionThis<TypeMap, TypeMapCb, ExtArgs, ClientOptions>, ITXClientDenyList> & {
  747. $parent: Optional<DynamicClientExtensionThis<TypeMap, TypeMapCb, ExtArgs, ClientOptions>, ITXClientDenyList>;
  748. };
  749. };
  750. };
  751. export declare type DynamicClientExtensionThis<TypeMap extends TypeMapDef, TypeMapCb extends TypeMapCbDef, ExtArgs extends Record<string, any>, ClientOptions> = {
  752. [P in keyof ExtArgs['client']]: Return<ExtArgs['client'][P]>;
  753. } & {
  754. [P in Exclude<TypeMap['meta']['modelProps'], keyof ExtArgs['client']>]: DynamicModelExtensionThis<TypeMap, ModelKey<TypeMap, P>, ExtArgs, ClientOptions>;
  755. } & {
  756. [P in Exclude<keyof TypeMap['other']['operations'], keyof ExtArgs['client']>]: <R = GetResult<TypeMap['other']['payload'], any, P & Operation, ClientOptions>>(...args: ToTuple<TypeMap['other']['operations'][P]['args']>) => PrismaPromise<R>;
  757. } & {
  758. [P in Exclude<ClientBuiltInProp, keyof ExtArgs['client']>]: DynamicClientExtensionThisBuiltin<TypeMap, TypeMapCb, ExtArgs, ClientOptions>[P];
  759. } & {
  760. [K: symbol]: {
  761. types: TypeMap['other'];
  762. };
  763. };
  764. export declare type DynamicClientExtensionThisBuiltin<TypeMap extends TypeMapDef, TypeMapCb extends TypeMapCbDef, ExtArgs extends Record<string, any>, ClientOptions> = {
  765. $extends: ExtendsHook<'extends', TypeMapCb, ExtArgs, Call<TypeMapCb, {
  766. extArgs: ExtArgs;
  767. }>, ClientOptions>;
  768. $transaction<P extends PrismaPromise<any>[]>(arg: [...P], options?: {
  769. isolationLevel?: TypeMap['meta']['txIsolationLevel'];
  770. }): Promise<UnwrapTuple<P>>;
  771. $transaction<R>(fn: (client: Omit<DynamicClientExtensionThis<TypeMap, TypeMapCb, ExtArgs, ClientOptions>, ITXClientDenyList>) => Promise<R>, options?: {
  772. maxWait?: number;
  773. timeout?: number;
  774. isolationLevel?: TypeMap['meta']['txIsolationLevel'];
  775. }): Promise<R>;
  776. $disconnect(): Promise<void>;
  777. $connect(): Promise<void>;
  778. };
  779. /** Model */
  780. export declare type DynamicModelExtensionArgs<M_, TypeMap extends TypeMapDef, TypeMapCb extends TypeMapCbDef, ExtArgs extends Record<string, any>, ClientOptions> = {
  781. [K in keyof M_]: K extends '$allModels' ? {
  782. [P in keyof M_[K]]?: unknown;
  783. } & {
  784. [K: symbol]: {};
  785. } : K extends TypeMap['meta']['modelProps'] ? {
  786. [P in keyof M_[K]]?: unknown;
  787. } & {
  788. [K: symbol]: {
  789. ctx: DynamicModelExtensionThis<TypeMap, ModelKey<TypeMap, K>, ExtArgs, ClientOptions> & {
  790. $parent: DynamicClientExtensionThis<TypeMap, TypeMapCb, ExtArgs, ClientOptions>;
  791. } & {
  792. $name: ModelKey<TypeMap, K>;
  793. } & {
  794. /**
  795. * @deprecated Use `$name` instead.
  796. */
  797. name: ModelKey<TypeMap, K>;
  798. };
  799. };
  800. } : never;
  801. };
  802. export declare type DynamicModelExtensionFluentApi<TypeMap extends TypeMapDef, M extends PropertyKey, P extends PropertyKey, Null, ClientOptions> = {
  803. [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, {
  804. select: {
  805. [P in K]: A;
  806. };
  807. }, P, ClientOptions>, [K]> | Null> & DynamicModelExtensionFluentApi<TypeMap, (TypeMap['model'][M]['payload']['objects'][K] & {})['name'], P, Null | Select<TypeMap['model'][M]['payload']['objects'][K], null>, ClientOptions>;
  808. };
  809. export declare type DynamicModelExtensionFnResult<TypeMap extends TypeMapDef, M extends PropertyKey, A, P extends PropertyKey, Null, ClientOptions> = P extends FluentOperation ? DynamicModelExtensionFluentApi<TypeMap, M, P, Null, ClientOptions> & PrismaPromise<DynamicModelExtensionFnResultBase<TypeMap, M, A, P, ClientOptions> | Null> : PrismaPromise<DynamicModelExtensionFnResultBase<TypeMap, M, A, P, ClientOptions>>;
  810. export declare type DynamicModelExtensionFnResultBase<TypeMap extends TypeMapDef, M extends PropertyKey, A, P extends PropertyKey, ClientOptions> = GetResult<TypeMap['model'][M]['payload'], A, P & Operation, ClientOptions>;
  811. export declare type DynamicModelExtensionFnResultNull<P extends PropertyKey> = P extends 'findUnique' | 'findFirst' ? null : never;
  812. export declare type DynamicModelExtensionOperationFn<TypeMap extends TypeMapDef, M extends PropertyKey, P extends PropertyKey, ClientOptions> = {} 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>, ClientOptions> : <A extends TypeMap['model'][M]['operations'][P]['args']>(args: Exact<A, TypeMap['model'][M]['operations'][P]['args']>) => DynamicModelExtensionFnResult<TypeMap, M, A, P, DynamicModelExtensionFnResultNull<P>, ClientOptions>;
  813. export declare type DynamicModelExtensionThis<TypeMap extends TypeMapDef, M extends PropertyKey, ExtArgs extends Record<string, any>, ClientOptions> = {
  814. [P in keyof ExtArgs['model'][Uncapitalize<M & string>]]: Return<ExtArgs['model'][Uncapitalize<M & string>][P]>;
  815. } & {
  816. [P in Exclude<keyof TypeMap['model'][M]['operations'], keyof ExtArgs['model'][Uncapitalize<M & string>]>]: DynamicModelExtensionOperationFn<TypeMap, M, P, ClientOptions>;
  817. } & {
  818. [P in Exclude<'fields', keyof ExtArgs['model'][Uncapitalize<M & string>]>]: TypeMap['model'][M]['fields'];
  819. } & {
  820. [K: symbol]: {
  821. types: TypeMap['model'][M];
  822. };
  823. };
  824. /** Query */
  825. export declare type DynamicQueryExtensionArgs<Q_, TypeMap extends TypeMapDef> = {
  826. [K in keyof Q_]: K extends '$allOperations' ? (args: {
  827. model?: string;
  828. operation: string;
  829. args: any;
  830. query: (args: any) => PrismaPromise<any>;
  831. }) => Promise<any> : K extends '$allModels' ? {
  832. [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;
  833. } : K extends TypeMap['meta']['modelProps'] ? {
  834. [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;
  835. } : K extends keyof TypeMap['other']['operations'] ? DynamicQueryExtensionCb<[TypeMap], 0, 'other', K> : never;
  836. };
  837. 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']>;
  838. export declare type DynamicQueryExtensionCbArgs<TypeMap extends TypeMapDef, _0 extends PropertyKey, _1 extends PropertyKey, _2 extends PropertyKey> = (_1 extends unknown ? _2 extends unknown ? {
  839. args: DynamicQueryExtensionCbArgsArgs<TypeMap, _0, _1, _2>;
  840. model: _0 extends 0 ? undefined : _1;
  841. operation: _2;
  842. query: <A extends DynamicQueryExtensionCbArgsArgs<TypeMap, _0, _1, _2>>(args: A) => PrismaPromise<TypeMap[_0][_1]['operations'][_2]['result']>;
  843. } : never : never) & {
  844. query: (args: DynamicQueryExtensionCbArgsArgs<TypeMap, _0, _1, _2>) => PrismaPromise<TypeMap[_0][_1]['operations'][_2]['result']>;
  845. };
  846. 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'];
  847. /** Result */
  848. export declare type DynamicResultExtensionArgs<R_, TypeMap extends TypeMapDef> = {
  849. [K in keyof R_]: {
  850. [P in keyof R_[K]]?: {
  851. needs?: DynamicResultExtensionNeeds<TypeMap, ModelKey<TypeMap, K>, R_[K][P]>;
  852. compute(data: DynamicResultExtensionData<TypeMap, ModelKey<TypeMap, K>, R_[K][P]>): any;
  853. };
  854. };
  855. };
  856. export declare type DynamicResultExtensionData<TypeMap extends TypeMapDef, M extends PropertyKey, S> = GetFindResult<TypeMap['model'][M]['payload'], {
  857. select: S;
  858. }, {}>;
  859. export declare type DynamicResultExtensionNeeds<TypeMap extends TypeMapDef, M extends PropertyKey, S> = {
  860. [K in keyof S]: K extends keyof TypeMap['model'][M]['payload']['scalars'] ? S[K] : never;
  861. } & {
  862. [N in keyof TypeMap['model'][M]['payload']['scalars']]?: boolean;
  863. };
  864. /**
  865. * Placeholder value for "no text".
  866. */
  867. export declare const empty: Sql;
  868. export declare type EmptyToUnknown<T> = T;
  869. declare interface Engine<InteractiveTransactionPayload = unknown> {
  870. /** The name of the engine. This is meant to be consumed externally */
  871. readonly name: string;
  872. onBeforeExit(callback: () => Promise<void>): void;
  873. start(): Promise<void>;
  874. stop(): Promise<void>;
  875. version(forceRun?: boolean): Promise<string> | string;
  876. request<T>(query: JsonQuery, options: RequestOptions_2<InteractiveTransactionPayload>): Promise<QueryEngineResult<T>>;
  877. requestBatch<T>(queries: JsonQuery[], options: RequestBatchOptions<InteractiveTransactionPayload>): Promise<BatchQueryEngineResult<T>[]>;
  878. transaction(action: 'start', headers: Transaction_2.TransactionHeaders, options: Transaction_2.Options): Promise<Transaction_2.InteractiveTransactionInfo<unknown>>;
  879. transaction(action: 'commit', headers: Transaction_2.TransactionHeaders, info: Transaction_2.InteractiveTransactionInfo<unknown>): Promise<void>;
  880. transaction(action: 'rollback', headers: Transaction_2.TransactionHeaders, info: Transaction_2.InteractiveTransactionInfo<unknown>): Promise<void>;
  881. metrics(options: MetricsOptionsJson): Promise<Metrics>;
  882. metrics(options: MetricsOptionsPrometheus): Promise<string>;
  883. applyPendingMigrations(): Promise<void>;
  884. }
  885. declare interface EngineConfig {
  886. cwd: string;
  887. dirname: string;
  888. datamodelPath: string;
  889. enableDebugLogs?: boolean;
  890. allowTriggerPanic?: boolean;
  891. prismaPath?: string;
  892. generator?: GeneratorConfig;
  893. overrideDatasources: Datasources;
  894. showColors?: boolean;
  895. logQueries?: boolean;
  896. logLevel?: 'info' | 'warn';
  897. env: Record<string, string>;
  898. flags?: string[];
  899. clientVersion: string;
  900. engineVersion: string;
  901. previewFeatures?: string[];
  902. engineEndpoint?: string;
  903. activeProvider?: string;
  904. logEmitter: LogEmitter;
  905. transactionOptions: Transaction_2.Options;
  906. /**
  907. * Instance of a Driver Adapter, e.g., like one provided by `@prisma/adapter-planetscale`.
  908. * If set, this is only used in the library engine, and all queries would be performed through it,
  909. * rather than Prisma's Rust drivers.
  910. * @remarks only used by LibraryEngine.ts
  911. */
  912. adapter?: ErrorCapturingDriverAdapter;
  913. /**
  914. * The contents of the schema encoded into a string
  915. * @remarks only used by DataProxyEngine.ts
  916. */
  917. inlineSchema: string;
  918. /**
  919. * The contents of the datasource url saved in a string
  920. * @remarks only used by DataProxyEngine.ts
  921. */
  922. inlineDatasources: GetPrismaClientConfig['inlineDatasources'];
  923. /**
  924. * The string hash that was produced for a given schema
  925. * @remarks only used by DataProxyEngine.ts
  926. */
  927. inlineSchemaHash: string;
  928. /**
  929. * The helper for interaction with OTEL tracing
  930. * @remarks enabling is determined by the client and @prisma/instrumentation package
  931. */
  932. tracingHelper: TracingHelper;
  933. /**
  934. * Information about whether we have not found a schema.prisma file in the
  935. * default location, and that we fell back to finding the schema.prisma file
  936. * in the current working directory. This usually means it has been bundled.
  937. */
  938. isBundled?: boolean;
  939. /**
  940. * Web Assembly module loading configuration
  941. */
  942. engineWasm?: WasmLoadingConfig;
  943. /**
  944. * Allows Accelerate to use runtime utilities from the client. These are
  945. * necessary for the AccelerateEngine to function correctly.
  946. */
  947. accelerateUtils?: {
  948. resolveDatasourceUrl: typeof resolveDatasourceUrl;
  949. getBatchRequestPayload: typeof getBatchRequestPayload;
  950. prismaGraphQLToJSError: typeof prismaGraphQLToJSError;
  951. PrismaClientUnknownRequestError: typeof PrismaClientUnknownRequestError;
  952. PrismaClientInitializationError: typeof PrismaClientInitializationError;
  953. PrismaClientKnownRequestError: typeof PrismaClientKnownRequestError;
  954. debug: (...args: any[]) => void;
  955. engineVersion: string;
  956. clientVersion: string;
  957. };
  958. }
  959. declare type EngineEvent<E extends EngineEventType> = E extends QueryEventType ? QueryEvent : LogEvent;
  960. declare type EngineEventType = QueryEventType | LogEventType;
  961. declare type EngineProtocol = 'graphql' | 'json';
  962. declare type EngineSpan = {
  963. span: boolean;
  964. name: string;
  965. trace_id: string;
  966. span_id: string;
  967. parent_span_id: string;
  968. start_time: [number, number];
  969. end_time: [number, number];
  970. attributes?: Record<string, string>;
  971. links?: {
  972. trace_id: string;
  973. span_id: string;
  974. }[];
  975. };
  976. declare type EngineSpanEvent = {
  977. span: boolean;
  978. spans: EngineSpan[];
  979. };
  980. declare type EnvPaths = {
  981. rootEnvPath: string | null;
  982. schemaEnvPath: string | undefined;
  983. };
  984. declare interface EnvValue {
  985. fromEnvVar: null | string;
  986. value: null | string;
  987. }
  988. export declare type Equals<A, B> = (<T>() => T extends A ? 1 : 2) extends (<T>() => T extends B ? 1 : 2) ? 1 : 0;
  989. declare type Error_2 = {
  990. kind: 'GenericJs';
  991. id: number;
  992. } | {
  993. kind: 'UnsupportedNativeDataType';
  994. type: string;
  995. } | {
  996. kind: 'Postgres';
  997. code: string;
  998. severity: string;
  999. message: string;
  1000. detail: string | undefined;
  1001. column: string | undefined;
  1002. hint: string | undefined;
  1003. } | {
  1004. kind: 'Mysql';
  1005. code: number;
  1006. message: string;
  1007. state: string;
  1008. } | {
  1009. kind: 'Sqlite';
  1010. /**
  1011. * Sqlite extended error code: https://www.sqlite.org/rescode.html
  1012. */
  1013. extendedCode: number;
  1014. message: string;
  1015. };
  1016. declare interface ErrorCapturingDriverAdapter extends DriverAdapter {
  1017. readonly errorRegistry: ErrorRegistry;
  1018. }
  1019. declare type ErrorFormat = 'pretty' | 'colorless' | 'minimal';
  1020. declare type ErrorRecord = {
  1021. error: unknown;
  1022. };
  1023. declare interface ErrorRegistry {
  1024. consumeError(id: number): ErrorRecord | undefined;
  1025. }
  1026. declare interface ErrorWithBatchIndex {
  1027. batchRequestIdx?: number;
  1028. }
  1029. declare type EventCallback<E extends ExtendedEventType> = [E] extends ['beforeExit'] ? () => Promise<void> : [E] extends [LogLevel] ? (event: EngineEvent<E>) => void : never;
  1030. export declare type Exact<A, W> = (A extends unknown ? (W extends A ? {
  1031. [K in keyof A]: Exact<A[K], W[K]>;
  1032. } : W) : never) | (A extends Narrowable ? A : never);
  1033. /**
  1034. * Defines Exception.
  1035. *
  1036. * string or an object with one of (message or name or code) and optional stack
  1037. */
  1038. declare type Exception = ExceptionWithCode | ExceptionWithMessage | ExceptionWithName | string;
  1039. declare interface ExceptionWithCode {
  1040. code: string | number;
  1041. name?: string;
  1042. message?: string;
  1043. stack?: string;
  1044. }
  1045. declare interface ExceptionWithMessage {
  1046. code?: string | number;
  1047. message: string;
  1048. name?: string;
  1049. stack?: string;
  1050. }
  1051. declare interface ExceptionWithName {
  1052. code?: string | number;
  1053. message?: string;
  1054. name: string;
  1055. stack?: string;
  1056. }
  1057. declare type ExtendedEventType = LogLevel | 'beforeExit';
  1058. declare type ExtendedSpanOptions = SpanOptions & {
  1059. /** The name of the span */
  1060. name: string;
  1061. internal?: boolean;
  1062. middleware?: boolean;
  1063. /** Whether it propagates context (?=true) */
  1064. active?: boolean;
  1065. /** The context to append the span to */
  1066. context?: Context;
  1067. };
  1068. /** $extends, defineExtension */
  1069. export declare interface ExtendsHook<Variant extends 'extends' | 'define', TypeMapCb extends TypeMapCbDef, ExtArgs extends Record<string, any>, TypeMap extends TypeMapDef = Call<TypeMapCb, {
  1070. extArgs: ExtArgs;
  1071. }>, ClientOptions = {}> {
  1072. extArgs: ExtArgs;
  1073. <R_ extends {
  1074. [K in TypeMap['meta']['modelProps'] | '$allModels']?: unknown;
  1075. }, R, M_ extends {
  1076. [K in TypeMap['meta']['modelProps'] | '$allModels']?: unknown;
  1077. }, M, Q_ extends {
  1078. [K in TypeMap['meta']['modelProps'] | '$allModels' | keyof TypeMap['other']['operations'] | '$allOperations']?: unknown;
  1079. }, C_ extends {
  1080. [K in string]?: unknown;
  1081. }, C, Args extends InternalArgs = InternalArgs<R, M, {}, C>, MergedArgs extends InternalArgs = MergeExtArgs<TypeMap, ExtArgs, Args>>(extension: ((client: DynamicClientExtensionThis<TypeMap, TypeMapCb, ExtArgs, ClientOptions>) => {
  1082. $extends: {
  1083. extArgs: Args;
  1084. };
  1085. }) | {
  1086. name?: string;
  1087. query?: DynamicQueryExtensionArgs<Q_, TypeMap>;
  1088. result?: DynamicResultExtensionArgs<R_, TypeMap> & R;
  1089. model?: DynamicModelExtensionArgs<M_, TypeMap, TypeMapCb, ExtArgs, ClientOptions> & M;
  1090. client?: DynamicClientExtensionArgs<C_, TypeMap, TypeMapCb, ExtArgs, ClientOptions> & C;
  1091. }): {
  1092. extends: DynamicClientExtensionThis<Call<TypeMapCb, {
  1093. extArgs: MergedArgs;
  1094. }>, TypeMapCb, MergedArgs, ClientOptions>;
  1095. define: (client: any) => {
  1096. $extends: {
  1097. extArgs: Args;
  1098. };
  1099. };
  1100. }[Variant];
  1101. }
  1102. export declare type ExtensionArgs = Optional<RequiredExtensionArgs>;
  1103. declare namespace Extensions {
  1104. export {
  1105. defineExtension,
  1106. getExtensionContext
  1107. }
  1108. }
  1109. export { Extensions }
  1110. declare namespace Extensions_2 {
  1111. export {
  1112. InternalArgs,
  1113. DefaultArgs,
  1114. GetPayloadResult,
  1115. GetSelect,
  1116. GetOmit,
  1117. DynamicQueryExtensionArgs,
  1118. DynamicQueryExtensionCb,
  1119. DynamicQueryExtensionCbArgs,
  1120. DynamicQueryExtensionCbArgsArgs,
  1121. DynamicResultExtensionArgs,
  1122. DynamicResultExtensionNeeds,
  1123. DynamicResultExtensionData,
  1124. DynamicModelExtensionArgs,
  1125. DynamicModelExtensionThis,
  1126. DynamicModelExtensionOperationFn,
  1127. DynamicModelExtensionFnResult,
  1128. DynamicModelExtensionFnResultBase,
  1129. DynamicModelExtensionFluentApi,
  1130. DynamicModelExtensionFnResultNull,
  1131. DynamicClientExtensionArgs,
  1132. DynamicClientExtensionThis,
  1133. ClientBuiltInProp,
  1134. DynamicClientExtensionThisBuiltin,
  1135. ExtendsHook,
  1136. MergeExtArgs,
  1137. AllModelsToStringIndex,
  1138. TypeMapDef,
  1139. DevTypeMapDef,
  1140. DevTypeMapFnDef,
  1141. ClientOptionDef,
  1142. TypeMapCbDef,
  1143. ModelKey,
  1144. RequiredExtensionArgs as UserArgs
  1145. }
  1146. }
  1147. export declare type ExtractGlobalOmit<Options, ModelName extends string> = Options extends {
  1148. omit: {
  1149. [K in ModelName]: infer GlobalOmit;
  1150. };
  1151. } ? GlobalOmit : {};
  1152. declare type Fetch = typeof nodeFetch;
  1153. /**
  1154. * A reference to a specific field of a specific model
  1155. */
  1156. export declare interface FieldRef<Model, FieldType> {
  1157. readonly modelName: Model;
  1158. readonly name: string;
  1159. readonly typeName: FieldType;
  1160. readonly isList: boolean;
  1161. }
  1162. export declare type FluentOperation = 'findUnique' | 'findUniqueOrThrow' | 'findFirst' | 'findFirstOrThrow' | 'create' | 'update' | 'upsert' | 'delete';
  1163. export declare interface Fn<Params = unknown, Returns = unknown> {
  1164. params: Params;
  1165. returns: Returns;
  1166. }
  1167. declare interface GeneratorConfig {
  1168. name: string;
  1169. output: EnvValue | null;
  1170. isCustomOutput?: boolean;
  1171. provider: EnvValue;
  1172. config: {
  1173. /** `output` is a reserved name and will only be available directly at `generator.output` */
  1174. output?: never;
  1175. /** `provider` is a reserved name and will only be available directly at `generator.provider` */
  1176. provider?: never;
  1177. /** `binaryTargets` is a reserved name and will only be available directly at `generator.binaryTargets` */
  1178. binaryTargets?: never;
  1179. /** `previewFeatures` is a reserved name and will only be available directly at `generator.previewFeatures` */
  1180. previewFeatures?: never;
  1181. } & {
  1182. [key: string]: string | string[] | undefined;
  1183. };
  1184. binaryTargets: BinaryTargetsEnvValue[];
  1185. previewFeatures: string[];
  1186. envPaths?: EnvPaths;
  1187. sourceFilePath: string;
  1188. }
  1189. export declare type GetAggregateResult<P extends OperationPayload, A> = {
  1190. [K in keyof A as K extends Aggregate ? K : never]: K extends '_count' ? A[K] extends true ? number : Count<A[K]> : {
  1191. [J in keyof A[K] & string]: P['scalars'][J] | null;
  1192. };
  1193. };
  1194. declare function getBatchRequestPayload(batch: JsonQuery[], transaction?: TransactionOptions_2<unknown>): QueryEngineBatchRequest;
  1195. export declare type GetBatchResult = {
  1196. count: number;
  1197. };
  1198. export declare type GetCountResult<A> = A extends {
  1199. select: infer S;
  1200. } ? (S extends true ? number : Count<S>) : number;
  1201. declare function getExtensionContext<T>(that: T): Context_2<T>;
  1202. export declare type GetFindResult<P extends OperationPayload, A, ClientOptions> = Equals<A, any> extends 1 ? DefaultSelection<P, A, ClientOptions> : A extends {
  1203. select: infer S extends object;
  1204. } & Record<string, unknown> | {
  1205. include: infer I extends object;
  1206. } & Record<string, unknown> ? {
  1207. [K in keyof S | keyof I as (S & I)[K] extends false | undefined | null ? never : K]: (S & I)[K] extends object ? P extends SelectablePayloadFields<K, (infer O)[]> ? O extends OperationPayload ? GetFindResult<O, (S & I)[K], ClientOptions>[] : never : P extends SelectablePayloadFields<K, infer O | null> ? O extends OperationPayload ? GetFindResult<O, (S & I)[K], ClientOptions> | SelectField<P, K> & null : never : K extends '_count' ? Count<GetFindResult<P, (S & I)[K], ClientOptions>> : never : P extends SelectablePayloadFields<K, (infer O)[]> ? O extends OperationPayload ? DefaultSelection<O, {}, ClientOptions>[] : never : P extends SelectablePayloadFields<K, infer O | null> ? O extends OperationPayload ? DefaultSelection<O, {}, ClientOptions> | SelectField<P, K> & null : never : P extends {
  1208. scalars: {
  1209. [k in K]: infer O;
  1210. };
  1211. } ? O : K extends '_count' ? Count<P['objects']> : never;
  1212. } & (A extends {
  1213. include: any;
  1214. } & Record<string, unknown> ? DefaultSelection<P, A, ClientOptions> : unknown) : DefaultSelection<P, A, ClientOptions>;
  1215. export declare type GetGroupByResult<P extends OperationPayload, A> = A extends {
  1216. by: string[];
  1217. } ? Array<GetAggregateResult<P, A> & {
  1218. [K in A['by'][number]]: P['scalars'][K];
  1219. }> : A extends {
  1220. by: string;
  1221. } ? Array<GetAggregateResult<P, A> & {
  1222. [K in A['by']]: P['scalars'][K];
  1223. }> : {}[];
  1224. export declare type GetOmit<BaseKeys extends string, R extends InternalArgs['result'][string]> = {
  1225. [K in (string extends keyof R ? never : keyof R) | BaseKeys]?: boolean;
  1226. };
  1227. export declare type GetPayloadResult<Base extends Record<any, any>, R extends InternalArgs['result'][string], KR extends keyof R = string extends keyof R ? never : keyof R> = unknown extends R ? Base : {
  1228. [K in KR | keyof Base]: K extends KR ? R[K] extends () => {
  1229. compute: (...args: any) => infer C;
  1230. } ? C : never : Base[K];
  1231. };
  1232. export declare function getPrismaClient(config: GetPrismaClientConfig): {
  1233. new (optionsArg?: PrismaClientOptions): {
  1234. _originalClient: any;
  1235. _runtimeDataModel: RuntimeDataModel;
  1236. _requestHandler: RequestHandler;
  1237. _connectionPromise?: Promise<any> | undefined;
  1238. _disconnectionPromise?: Promise<any> | undefined;
  1239. _engineConfig: EngineConfig;
  1240. _accelerateEngineConfig: AccelerateEngineConfig;
  1241. _clientVersion: string;
  1242. _errorFormat: ErrorFormat;
  1243. _tracingHelper: TracingHelper;
  1244. _metrics: MetricsClient;
  1245. _middlewares: MiddlewareHandler<QueryMiddleware>;
  1246. _previewFeatures: string[];
  1247. _activeProvider: string;
  1248. _globalOmit?: GlobalOmitOptions | undefined;
  1249. _extensions: MergedExtensionsList;
  1250. _engine: Engine;
  1251. /**
  1252. * A fully constructed/applied Client that references the parent
  1253. * PrismaClient. This is used for Client extensions only.
  1254. */
  1255. _appliedParent: any;
  1256. _createPrismaPromise: PrismaPromiseFactory;
  1257. /**
  1258. * Hook a middleware into the client
  1259. * @param middleware to hook
  1260. */
  1261. $use(middleware: QueryMiddleware): void;
  1262. $on<E extends ExtendedEventType>(eventType: E, callback: EventCallback<E>): void;
  1263. $connect(): Promise<void>;
  1264. /**
  1265. * Disconnect from the database
  1266. */
  1267. $disconnect(): Promise<void>;
  1268. /**
  1269. * Executes a raw query and always returns a number
  1270. */
  1271. $executeRawInternal(transaction: PrismaPromiseTransaction | undefined, clientMethod: string, args: RawQueryArgs, middlewareArgsMapper?: MiddlewareArgsMapper<unknown, unknown>): Promise<number>;
  1272. /**
  1273. * Executes a raw query provided through a safe tag function
  1274. * @see https://github.com/prisma/prisma/issues/7142
  1275. *
  1276. * @param query
  1277. * @param values
  1278. * @returns
  1279. */
  1280. $executeRaw(query: TemplateStringsArray | Sql, ...values: any[]): PrismaPromise_2<unknown>;
  1281. /**
  1282. * Unsafe counterpart of `$executeRaw` that is susceptible to SQL injections
  1283. * @see https://github.com/prisma/prisma/issues/7142
  1284. *
  1285. * @param query
  1286. * @param values
  1287. * @returns
  1288. */
  1289. $executeRawUnsafe(query: string, ...values: RawValue[]): PrismaPromise_2<unknown>;
  1290. /**
  1291. * Executes a raw command only for MongoDB
  1292. *
  1293. * @param command
  1294. * @returns
  1295. */
  1296. $runCommandRaw(command: Record<string, JsInputValue>): PrismaPromise_2<unknown>;
  1297. /**
  1298. * Executes a raw query and returns selected data
  1299. */
  1300. $queryRawInternal(transaction: PrismaPromiseTransaction | undefined, clientMethod: string, args: RawQueryArgs, middlewareArgsMapper?: MiddlewareArgsMapper<unknown, unknown>): Promise<any>;
  1301. /**
  1302. * Executes a raw query provided through a safe tag function
  1303. * @see https://github.com/prisma/prisma/issues/7142
  1304. *
  1305. * @param query
  1306. * @param values
  1307. * @returns
  1308. */
  1309. $queryRaw(query: TemplateStringsArray | Sql, ...values: any[]): PrismaPromise_2<unknown>;
  1310. /**
  1311. * Unsafe counterpart of `$queryRaw` that is susceptible to SQL injections
  1312. * @see https://github.com/prisma/prisma/issues/7142
  1313. *
  1314. * @param query
  1315. * @param values
  1316. * @returns
  1317. */
  1318. $queryRawUnsafe(query: string, ...values: RawValue[]): PrismaPromise_2<unknown>;
  1319. /**
  1320. * Execute a batch of requests in a transaction
  1321. * @param requests
  1322. * @param options
  1323. */
  1324. _transactionWithArray({ promises, options, }: {
  1325. promises: Array<PrismaPromise_2<any>>;
  1326. options?: BatchTransactionOptions;
  1327. }): Promise<any>;
  1328. /**
  1329. * Perform a long-running transaction
  1330. * @param callback
  1331. * @param options
  1332. * @returns
  1333. */
  1334. _transactionWithCallback({ callback, options, }: {
  1335. callback: (client: Client) => Promise<unknown>;
  1336. options?: Options;
  1337. }): Promise<unknown>;
  1338. _createItxClient(transaction: PrismaPromiseInteractiveTransaction): Client;
  1339. /**
  1340. * Execute queries within a transaction
  1341. * @param input a callback or a query list
  1342. * @param options to set timeouts (callback)
  1343. * @returns
  1344. */
  1345. $transaction(input: any, options?: any): Promise<any>;
  1346. /**
  1347. * Runs the middlewares over params before executing a request
  1348. * @param internalParams
  1349. * @returns
  1350. */
  1351. _request(internalParams: InternalRequestParams): Promise<any>;
  1352. _executeRequest({ args, clientMethod, dataPath, callsite, action, model, argsMapper, transaction, unpacker, otelParentCtx, customDataProxyFetch, }: InternalRequestParams): Promise<any>;
  1353. readonly $metrics: MetricsClient;
  1354. /**
  1355. * Shortcut for checking a preview flag
  1356. * @param feature preview flag
  1357. * @returns
  1358. */
  1359. _hasPreviewFlag(feature: string): boolean;
  1360. $applyPendingMigrations(): Promise<void>;
  1361. $extends: typeof $extends;
  1362. readonly [Symbol.toStringTag]: string;
  1363. };
  1364. };
  1365. /**
  1366. * Config that is stored into the generated client. When the generated client is
  1367. * loaded, this same config is passed to {@link getPrismaClient} which creates a
  1368. * closure with that config around a non-instantiated [[PrismaClient]].
  1369. */
  1370. declare type GetPrismaClientConfig = {
  1371. runtimeDataModel: RuntimeDataModel;
  1372. generator?: GeneratorConfig;
  1373. relativeEnvPaths: {
  1374. rootEnvPath?: string | null;
  1375. schemaEnvPath?: string | null;
  1376. };
  1377. relativePath: string;
  1378. dirname: string;
  1379. filename?: string;
  1380. clientVersion: string;
  1381. engineVersion: string;
  1382. datasourceNames: string[];
  1383. activeProvider: ActiveConnectorType;
  1384. /**
  1385. * The contents of the schema encoded into a string
  1386. * @remarks only used for the purpose of data proxy
  1387. */
  1388. inlineSchema: string;
  1389. /**
  1390. * A special env object just for the data proxy edge runtime.
  1391. * Allows bundlers to inject their own env variables (Vercel).
  1392. * Allows platforms to declare global variables as env (Workers).
  1393. * @remarks only used for the purpose of data proxy
  1394. */
  1395. injectableEdgeEnv?: () => LoadedEnv;
  1396. /**
  1397. * The contents of the datasource url saved in a string.
  1398. * This can either be an env var name or connection string.
  1399. * It is needed by the client to connect to the Data Proxy.
  1400. * @remarks only used for the purpose of data proxy
  1401. */
  1402. inlineDatasources: {
  1403. [name in string]: {
  1404. url: EnvValue;
  1405. };
  1406. };
  1407. /**
  1408. * The string hash that was produced for a given schema
  1409. * @remarks only used for the purpose of data proxy
  1410. */
  1411. inlineSchemaHash: string;
  1412. /**
  1413. * A marker to indicate that the client was not generated via `prisma
  1414. * generate` but was generated via `generate --postinstall` script instead.
  1415. * @remarks used to error for Vercel/Netlify for schema caching issues
  1416. */
  1417. postinstall?: boolean;
  1418. /**
  1419. * Information about the CI where the Prisma Client has been generated. The
  1420. * name of the CI environment is stored at generation time because CI
  1421. * information is not always available at runtime. Moreover, the edge client
  1422. * has no notion of environment variables, so this works around that.
  1423. * @remarks used to error for Vercel/Netlify for schema caching issues
  1424. */
  1425. ciName?: string;
  1426. /**
  1427. * Information about whether we have not found a schema.prisma file in the
  1428. * default location, and that we fell back to finding the schema.prisma file
  1429. * in the current working directory. This usually means it has been bundled.
  1430. */
  1431. isBundled?: boolean;
  1432. /**
  1433. * A boolean that is `false` when the client was generated with --no-engine. At
  1434. * runtime, this means the client will be bound to be using the Data Proxy.
  1435. */
  1436. copyEngine?: boolean;
  1437. /**
  1438. * Optional wasm loading configuration
  1439. */
  1440. engineWasm?: WasmLoadingConfig;
  1441. };
  1442. export declare type GetResult<Payload extends OperationPayload, Args, OperationName extends Operation = 'findUniqueOrThrow', ClientOptions = {}> = {
  1443. findUnique: GetFindResult<Payload, Args, ClientOptions> | null;
  1444. findUniqueOrThrow: GetFindResult<Payload, Args, ClientOptions>;
  1445. findFirst: GetFindResult<Payload, Args, ClientOptions> | null;
  1446. findFirstOrThrow: GetFindResult<Payload, Args, ClientOptions>;
  1447. findMany: GetFindResult<Payload, Args, ClientOptions>[];
  1448. create: GetFindResult<Payload, Args, ClientOptions>;
  1449. createMany: GetBatchResult;
  1450. createManyAndReturn: GetFindResult<Payload, Args, ClientOptions>[];
  1451. update: GetFindResult<Payload, Args, ClientOptions>;
  1452. updateMany: GetBatchResult;
  1453. upsert: GetFindResult<Payload, Args, ClientOptions>;
  1454. delete: GetFindResult<Payload, Args, ClientOptions>;
  1455. deleteMany: GetBatchResult;
  1456. aggregate: GetAggregateResult<Payload, Args>;
  1457. count: GetCountResult<Args>;
  1458. groupBy: GetGroupByResult<Payload, Args>;
  1459. $queryRaw: unknown;
  1460. $executeRaw: number;
  1461. $queryRawUnsafe: unknown;
  1462. $executeRawUnsafe: number;
  1463. $runCommandRaw: JsonObject;
  1464. findRaw: JsonObject;
  1465. aggregateRaw: JsonObject;
  1466. }[OperationName];
  1467. export declare function getRuntime(): GetRuntimeOutput;
  1468. declare type GetRuntimeOutput = {
  1469. id: Runtime;
  1470. prettyName: string;
  1471. isEdge: boolean;
  1472. };
  1473. 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> = {
  1474. [K in KR | keyof Base]?: K extends KR ? boolean : Base[K];
  1475. };
  1476. declare type GlobalOmitOptions = {
  1477. [modelName: string]: {
  1478. [fieldName: string]: boolean;
  1479. };
  1480. };
  1481. declare type HandleErrorParams = {
  1482. args: JsArgs;
  1483. error: any;
  1484. clientMethod: string;
  1485. callsite?: CallSite;
  1486. transaction?: PrismaPromiseTransaction;
  1487. modelName?: string;
  1488. globalOmit?: GlobalOmitOptions;
  1489. };
  1490. /**
  1491. * Defines High-Resolution Time.
  1492. *
  1493. * The first number, HrTime[0], is UNIX Epoch time in seconds since 00:00:00 UTC on 1 January 1970.
  1494. * The second number, HrTime[1], represents the partial second elapsed since Unix Epoch time represented by first number in nanoseconds.
  1495. * For example, 2021-01-01T12:30:10.150Z in UNIX Epoch time in milliseconds is represented as 1609504210150.
  1496. * The first number is calculated by converting and truncating the Epoch time in milliseconds to seconds:
  1497. * HrTime[0] = Math.trunc(1609504210150 / 1000) = 1609504210.
  1498. * The second number is calculated by converting the digits after the decimal point of the subtraction, (1609504210150 / 1000) - HrTime[0], to nanoseconds:
  1499. * HrTime[1] = Number((1609504210.150 - HrTime[0]).toFixed(9)) * 1e9 = 150000000.
  1500. * This is represented in HrTime format as [1609504210, 150000000].
  1501. */
  1502. declare type HrTime = [number, number];
  1503. declare type InteractiveTransactionInfo<Payload = unknown> = {
  1504. /**
  1505. * Transaction ID returned by the query engine.
  1506. */
  1507. id: string;
  1508. /**
  1509. * Arbitrary payload the meaning of which depends on the `Engine` implementation.
  1510. * For example, `DataProxyEngine` needs to associate different API endpoints with transactions.
  1511. * In `LibraryEngine` and `BinaryEngine` it is currently not used.
  1512. */
  1513. payload: Payload;
  1514. };
  1515. declare type InteractiveTransactionOptions<Payload> = Transaction_2.InteractiveTransactionInfo<Payload>;
  1516. export declare type InternalArgs<R = {
  1517. [K in string]: {
  1518. [K in string]: unknown;
  1519. };
  1520. }, M = {
  1521. [K in string]: {
  1522. [K in string]: unknown;
  1523. };
  1524. }, Q = {
  1525. [K in string]: {
  1526. [K in string]: unknown;
  1527. };
  1528. }, C = {
  1529. [K in string]: unknown;
  1530. }> = {
  1531. result: {
  1532. [K in keyof R]: {
  1533. [P in keyof R[K]]: () => R[K][P];
  1534. };
  1535. };
  1536. model: {
  1537. [K in keyof M]: {
  1538. [P in keyof M[K]]: () => M[K][P];
  1539. };
  1540. };
  1541. query: {
  1542. [K in keyof Q]: {
  1543. [P in keyof Q[K]]: () => Q[K][P];
  1544. };
  1545. };
  1546. client: {
  1547. [K in keyof C]: () => C[K];
  1548. };
  1549. };
  1550. declare type InternalRequestParams = {
  1551. /**
  1552. * The original client method being called.
  1553. * Even though the rootField / operation can be changed,
  1554. * this method stays as it is, as it's what the user's
  1555. * code looks like
  1556. */
  1557. clientMethod: string;
  1558. /**
  1559. * Name of js model that triggered the request. Might be used
  1560. * for warnings or error messages
  1561. */
  1562. jsModelName?: string;
  1563. callsite?: CallSite;
  1564. transaction?: PrismaPromiseTransaction;
  1565. unpacker?: Unpacker;
  1566. otelParentCtx?: Context;
  1567. /** Used to "desugar" a user input into an "expanded" one */
  1568. argsMapper?: (args?: UserArgs_2) => UserArgs_2;
  1569. /** Used to convert args for middleware and back */
  1570. middlewareArgsMapper?: MiddlewareArgsMapper<unknown, unknown>;
  1571. /** Used for Accelerate client extension via Data Proxy */
  1572. customDataProxyFetch?: (fetch: Fetch) => Fetch;
  1573. } & Omit<QueryMiddlewareParams, 'runInTransaction'>;
  1574. declare enum IsolationLevel {
  1575. ReadUncommitted = "ReadUncommitted",
  1576. ReadCommitted = "ReadCommitted",
  1577. RepeatableRead = "RepeatableRead",
  1578. Snapshot = "Snapshot",
  1579. Serializable = "Serializable"
  1580. }
  1581. export declare type ITXClientDenyList = (typeof denylist)[number];
  1582. export declare const itxClientDenyList: readonly (string | symbol)[];
  1583. declare interface Job {
  1584. resolve: (data: any) => void;
  1585. reject: (data: any) => void;
  1586. request: any;
  1587. }
  1588. /**
  1589. * Create a SQL query for a list of values.
  1590. */
  1591. export declare function join(values: readonly RawValue[], separator?: string, prefix?: string, suffix?: string): Sql;
  1592. export declare type JsArgs = {
  1593. select?: Selection_2;
  1594. include?: Selection_2;
  1595. omit?: Omission;
  1596. [argName: string]: JsInputValue;
  1597. };
  1598. export declare type JsInputValue = null | undefined | string | number | boolean | bigint | Uint8Array | Date | DecimalJsLike | ObjectEnumValue | RawParameters | JsonConvertible | FieldRef<string, unknown> | JsInputValue[] | {
  1599. [key: string]: JsInputValue;
  1600. };
  1601. declare type JsonArgumentValue = number | string | boolean | null | RawTaggedValue | JsonArgumentValue[] | {
  1602. [key: string]: JsonArgumentValue;
  1603. };
  1604. export declare interface JsonArray extends Array<JsonValue> {
  1605. }
  1606. declare type JsonBatchQuery = {
  1607. batch: JsonQuery[];
  1608. transaction?: {
  1609. isolationLevel?: Transaction_2.IsolationLevel;
  1610. };
  1611. };
  1612. export declare interface JsonConvertible {
  1613. toJSON(): unknown;
  1614. }
  1615. declare type JsonFieldSelection = {
  1616. arguments?: Record<string, JsonArgumentValue> | RawTaggedValue;
  1617. selection: JsonSelectionSet;
  1618. };
  1619. declare class JsonNull extends NullTypesEnumValue {
  1620. }
  1621. export declare type JsonObject = {
  1622. [Key in string]?: JsonValue;
  1623. };
  1624. declare type JsonQuery = {
  1625. modelName?: string;
  1626. action: JsonQueryAction;
  1627. query: JsonFieldSelection;
  1628. };
  1629. declare type JsonQueryAction = 'findUnique' | 'findUniqueOrThrow' | 'findFirst' | 'findFirstOrThrow' | 'findMany' | 'createOne' | 'createMany' | 'createManyAndReturn' | 'updateOne' | 'updateMany' | 'deleteOne' | 'deleteMany' | 'upsertOne' | 'aggregate' | 'groupBy' | 'executeRaw' | 'queryRaw' | 'runCommandRaw' | 'findRaw' | 'aggregateRaw';
  1630. declare type JsonSelectionSet = {
  1631. $scalars?: boolean;
  1632. $composites?: boolean;
  1633. } & {
  1634. [fieldName: string]: boolean | JsonFieldSelection;
  1635. };
  1636. export declare type JsonValue = string | number | boolean | JsonObject | JsonArray | null;
  1637. export declare type JsOutputValue = null | string | number | boolean | bigint | Uint8Array | Date | Decimal | JsOutputValue[] | {
  1638. [key: string]: JsOutputValue;
  1639. };
  1640. export declare type JsPromise<T> = Promise<T> & {};
  1641. declare type KnownErrorParams = {
  1642. code: string;
  1643. clientVersion: string;
  1644. meta?: Record<string, unknown>;
  1645. batchRequestIdx?: number;
  1646. };
  1647. /**
  1648. * A pointer from the current {@link Span} to another span in the same trace or
  1649. * in a different trace.
  1650. * Few examples of Link usage.
  1651. * 1. Batch Processing: A batch of elements may contain elements associated
  1652. * with one or more traces/spans. Since there can only be one parent
  1653. * SpanContext, Link is used to keep reference to SpanContext of all
  1654. * elements in the batch.
  1655. * 2. Public Endpoint: A SpanContext in incoming client request on a public
  1656. * endpoint is untrusted from service provider perspective. In such case it
  1657. * is advisable to start a new trace with appropriate sampling decision.
  1658. * However, it is desirable to associate incoming SpanContext to new trace
  1659. * initiated on service provider side so two traces (from Client and from
  1660. * Service Provider) can be correlated.
  1661. */
  1662. declare interface Link {
  1663. /** The {@link SpanContext} of a linked span. */
  1664. context: SpanContext;
  1665. /** A set of {@link SpanAttributes} on the link. */
  1666. attributes?: SpanAttributes;
  1667. /** Count of attributes of the link that were dropped due to collection limits */
  1668. droppedAttributesCount?: number;
  1669. }
  1670. declare type LoadedEnv = {
  1671. message?: string;
  1672. parsed: {
  1673. [x: string]: string;
  1674. };
  1675. } | undefined;
  1676. declare type LocationInFile = {
  1677. fileName: string;
  1678. lineNumber: number | null;
  1679. columnNumber: number | null;
  1680. };
  1681. declare type LogDefinition = {
  1682. level: LogLevel;
  1683. emit: 'stdout' | 'event';
  1684. };
  1685. /**
  1686. * Typings for the events we emit.
  1687. *
  1688. * @remarks
  1689. * If this is updated, our edge runtime shim needs to be updated as well.
  1690. */
  1691. declare type LogEmitter = {
  1692. on<E extends EngineEventType>(event: E, listener: (event: EngineEvent<E>) => void): LogEmitter;
  1693. emit(event: QueryEventType, payload: QueryEvent): boolean;
  1694. emit(event: LogEventType, payload: LogEvent): boolean;
  1695. };
  1696. declare type LogEvent = {
  1697. timestamp: Date;
  1698. message: string;
  1699. target: string;
  1700. };
  1701. declare type LogEventType = 'info' | 'warn' | 'error';
  1702. declare type LogLevel = 'info' | 'query' | 'warn' | 'error';
  1703. /**
  1704. * Generates more strict variant of an enum which, unlike regular enum,
  1705. * throws on non-existing property access. This can be useful in following situations:
  1706. * - we have an API, that accepts both `undefined` and `SomeEnumType` as an input
  1707. * - enum values are generated dynamically from DMMF.
  1708. *
  1709. * In that case, if using normal enums and no compile-time typechecking, using non-existing property
  1710. * will result in `undefined` value being used, which will be accepted. Using strict enum
  1711. * in this case will help to have a runtime exception, telling you that you are probably doing something wrong.
  1712. *
  1713. * Note: if you need to check for existence of a value in the enum you can still use either
  1714. * `in` operator or `hasOwnProperty` function.
  1715. *
  1716. * @param definition
  1717. * @returns
  1718. */
  1719. export declare function makeStrictEnum<T extends Record<PropertyKey, string | number>>(definition: T): T;
  1720. /**
  1721. * Class that holds the list of all extensions, applied to particular instance,
  1722. * as well as resolved versions of the components that need to apply on
  1723. * different levels. Main idea of this class: avoid re-resolving as much of the
  1724. * stuff as possible when new extensions are added while also delaying the
  1725. * resolve until the point it is actually needed. For example, computed fields
  1726. * of the model won't be resolved unless the model is actually queried. Neither
  1727. * adding extensions with `client` component only cause other components to
  1728. * recompute.
  1729. */
  1730. declare class MergedExtensionsList {
  1731. private head?;
  1732. private constructor();
  1733. static empty(): MergedExtensionsList;
  1734. static single(extension: ExtensionArgs): MergedExtensionsList;
  1735. isEmpty(): boolean;
  1736. append(extension: ExtensionArgs): MergedExtensionsList;
  1737. getAllComputedFields(dmmfModelName: string): ComputedFieldsMap | undefined;
  1738. getAllClientExtensions(): ClientArg | undefined;
  1739. getAllModelExtensions(dmmfModelName: string): ModelArg | undefined;
  1740. getAllQueryCallbacks(jsModelName: string, operation: string): any;
  1741. getAllBatchQueryCallbacks(): BatchQueryOptionsCb[];
  1742. }
  1743. export declare type MergeExtArgs<TypeMap extends TypeMapDef, ExtArgs extends Record<any, any>, Args extends Record<any, any>> = ComputeDeep<ExtArgs & Args & AllModelsToStringIndex<TypeMap, Args, 'result'> & AllModelsToStringIndex<TypeMap, Args, 'model'>>;
  1744. export declare type Metric<T> = {
  1745. key: string;
  1746. value: T;
  1747. labels: Record<string, string>;
  1748. description: string;
  1749. };
  1750. export declare type MetricHistogram = {
  1751. buckets: MetricHistogramBucket[];
  1752. sum: number;
  1753. count: number;
  1754. };
  1755. export declare type MetricHistogramBucket = [maxValue: number, count: number];
  1756. export declare type Metrics = {
  1757. counters: Metric<number>[];
  1758. gauges: Metric<number>[];
  1759. histograms: Metric<MetricHistogram>[];
  1760. };
  1761. export declare class MetricsClient {
  1762. private _engine;
  1763. constructor(engine: Engine);
  1764. /**
  1765. * Returns all metrics gathered up to this point in prometheus format.
  1766. * Result of this call can be exposed directly to prometheus scraping endpoint
  1767. *
  1768. * @param options
  1769. * @returns
  1770. */
  1771. prometheus(options?: MetricsOptions): Promise<string>;
  1772. /**
  1773. * Returns all metrics gathered up to this point in prometheus format.
  1774. *
  1775. * @param options
  1776. * @returns
  1777. */
  1778. json(options?: MetricsOptions): Promise<Metrics>;
  1779. }
  1780. declare type MetricsOptions = {
  1781. /**
  1782. * Labels to add to every metrics in key-value format
  1783. */
  1784. globalLabels?: Record<string, string>;
  1785. };
  1786. declare type MetricsOptionsCommon = {
  1787. globalLabels?: Record<string, string>;
  1788. };
  1789. declare type MetricsOptionsJson = {
  1790. format: 'json';
  1791. } & MetricsOptionsCommon;
  1792. declare type MetricsOptionsPrometheus = {
  1793. format: 'prometheus';
  1794. } & MetricsOptionsCommon;
  1795. declare type MiddlewareArgsMapper<RequestArgs, MiddlewareArgs> = {
  1796. requestArgsToMiddlewareArgs(requestArgs: RequestArgs): MiddlewareArgs;
  1797. middlewareArgsToRequestArgs(middlewareArgs: MiddlewareArgs): RequestArgs;
  1798. };
  1799. declare class MiddlewareHandler<M extends Function> {
  1800. private _middlewares;
  1801. use(middleware: M): void;
  1802. get(id: number): M | undefined;
  1803. has(id: number): boolean;
  1804. length(): number;
  1805. }
  1806. export declare type ModelArg = {
  1807. [MethodName in string]: unknown;
  1808. };
  1809. export declare type ModelArgs = {
  1810. model: {
  1811. [ModelName in string]: ModelArg;
  1812. };
  1813. };
  1814. export declare type ModelKey<TypeMap extends TypeMapDef, M extends PropertyKey> = M extends keyof TypeMap['model'] ? M : Capitalize<M & string>;
  1815. export declare type ModelQueryOptionsCb = (args: ModelQueryOptionsCbArgs) => Promise<any>;
  1816. export declare type ModelQueryOptionsCbArgs = {
  1817. model: string;
  1818. operation: string;
  1819. args: JsArgs;
  1820. query: (args: JsArgs) => Promise<unknown>;
  1821. };
  1822. export declare type NameArgs = {
  1823. name?: string;
  1824. };
  1825. export declare type Narrow<A> = {
  1826. [K in keyof A]: A[K] extends Function ? A[K] : Narrow<A[K]>;
  1827. } | (A extends Narrowable ? A : never);
  1828. export declare type Narrowable = string | number | bigint | boolean | [];
  1829. export declare type NeverToUnknown<T> = [T] extends [never] ? unknown : T;
  1830. /**
  1831. * Imitates `fetch` via `https` to only suit our needs, it does nothing more.
  1832. * This is because we cannot bundle `node-fetch` as it uses many other Node.js
  1833. * utilities, while also bloating our bundles. This approach is much leaner.
  1834. * @param url
  1835. * @param options
  1836. * @returns
  1837. */
  1838. declare function nodeFetch(url: string, options?: RequestOptions): Promise<RequestResponse>;
  1839. declare class NodeHeaders {
  1840. readonly headers: Map<string, string>;
  1841. constructor(init?: Record<any, any>);
  1842. append(name: string, value: string): void;
  1843. delete(name: string): void;
  1844. get(name: string): string | null;
  1845. has(name: string): boolean;
  1846. set(name: string, value: string): void;
  1847. forEach(callbackfn: (value: string, key: string, parent: this) => void, thisArg?: any): void;
  1848. }
  1849. /**
  1850. * @deprecated Please don´t rely on type checks to this error anymore.
  1851. * This will become a regular `PrismaClientKnownRequestError` with code `P2025`
  1852. * in the future major version of the client.
  1853. * Instead of `error instanceof Prisma.NotFoundError` use `error.code === "P2025"`.
  1854. */
  1855. export declare class NotFoundError extends PrismaClientKnownRequestError {
  1856. constructor(message: string, clientVersion: string);
  1857. }
  1858. declare class NullTypesEnumValue extends ObjectEnumValue {
  1859. _getNamespace(): string;
  1860. }
  1861. /**
  1862. * List of Prisma enums that must use unique objects instead of strings as their values.
  1863. */
  1864. export declare const objectEnumNames: string[];
  1865. /**
  1866. * Base class for unique values of object-valued enums.
  1867. */
  1868. export declare abstract class ObjectEnumValue {
  1869. constructor(arg?: symbol);
  1870. abstract _getNamespace(): string;
  1871. _getName(): string;
  1872. toString(): string;
  1873. }
  1874. export declare const objectEnumValues: {
  1875. classes: {
  1876. DbNull: typeof DbNull;
  1877. JsonNull: typeof JsonNull;
  1878. AnyNull: typeof AnyNull;
  1879. };
  1880. instances: {
  1881. DbNull: DbNull;
  1882. JsonNull: JsonNull;
  1883. AnyNull: AnyNull;
  1884. };
  1885. };
  1886. declare const officialPrismaAdapters: readonly ["@prisma/adapter-planetscale", "@prisma/adapter-neon", "@prisma/adapter-libsql", "@prisma/adapter-d1", "@prisma/adapter-pg", "@prisma/adapter-pg-worker"];
  1887. export declare type Omission = Record<string, boolean>;
  1888. declare type Omit_2<T, K extends string | number | symbol> = {
  1889. [P in keyof T as P extends K ? never : P]: T[P];
  1890. };
  1891. export { Omit_2 as Omit }
  1892. export declare type OmitValue<Omit, Key> = Key extends keyof Omit ? Omit[Key] : false;
  1893. export declare type Operation = 'findFirst' | 'findFirstOrThrow' | 'findUnique' | 'findUniqueOrThrow' | 'findMany' | 'create' | 'createMany' | 'createManyAndReturn' | 'update' | 'updateMany' | 'upsert' | 'delete' | 'deleteMany' | 'aggregate' | 'count' | 'groupBy' | '$queryRaw' | '$executeRaw' | '$queryRawUnsafe' | '$executeRawUnsafe' | 'findRaw' | 'aggregateRaw' | '$runCommandRaw';
  1894. export declare type OperationPayload = {
  1895. name: string;
  1896. scalars: {
  1897. [ScalarName in string]: unknown;
  1898. };
  1899. objects: {
  1900. [ObjectName in string]: unknown;
  1901. };
  1902. composites: {
  1903. [CompositeName in string]: unknown;
  1904. };
  1905. };
  1906. export declare type Optional<O, K extends keyof any = keyof O> = {
  1907. [P in K & keyof O]?: O[P];
  1908. } & {
  1909. [P in Exclude<keyof O, K>]: O[P];
  1910. };
  1911. export declare type OptionalFlat<T> = {
  1912. [K in keyof T]?: T[K];
  1913. };
  1914. export declare type OptionalKeys<O> = {
  1915. [K in keyof O]-?: {} extends Pick_2<O, K> ? K : never;
  1916. }[keyof O];
  1917. declare type Options = {
  1918. maxWait?: number;
  1919. timeout?: number;
  1920. isolationLevel?: IsolationLevel;
  1921. };
  1922. declare type Options_2 = {
  1923. clientVersion: string;
  1924. };
  1925. export declare type Or<A extends 1 | 0, B extends 1 | 0> = {
  1926. 0: {
  1927. 0: 0;
  1928. 1: 1;
  1929. };
  1930. 1: {
  1931. 0: 1;
  1932. 1: 1;
  1933. };
  1934. }[A][B];
  1935. export declare type PatchFlat<O1, O2> = O1 & Omit_2<O2, keyof O1>;
  1936. export declare type Path<O, P, Default = never> = O extends unknown ? P extends [infer K, ...infer R] ? K extends keyof O ? Path<O[K], R> : Default : O : never;
  1937. export declare type Payload<T, F extends Operation = never> = T extends {
  1938. [K: symbol]: {
  1939. types: {
  1940. payload: any;
  1941. };
  1942. };
  1943. } ? T[symbol]['types']['payload'] : any;
  1944. export declare type PayloadToResult<P, O extends Record_2<any, any> = RenameAndNestPayloadKeys<P>> = {
  1945. [K in keyof O]?: O[K][K] extends any[] ? PayloadToResult<O[K][K][number]>[] : O[K][K] extends object ? PayloadToResult<O[K][K]> : O[K][K];
  1946. };
  1947. declare type Pick_2<T, K extends string | number | symbol> = {
  1948. [P in keyof T as P extends K ? P : never]: T[P];
  1949. };
  1950. export { Pick_2 as Pick }
  1951. export declare class PrismaClientInitializationError extends Error {
  1952. clientVersion: string;
  1953. errorCode?: string;
  1954. retryable?: boolean;
  1955. constructor(message: string, clientVersion: string, errorCode?: string);
  1956. get [Symbol.toStringTag](): string;
  1957. }
  1958. export declare class PrismaClientKnownRequestError extends Error implements ErrorWithBatchIndex {
  1959. code: string;
  1960. meta?: Record<string, unknown>;
  1961. clientVersion: string;
  1962. batchRequestIdx?: number;
  1963. constructor(message: string, { code, clientVersion, meta, batchRequestIdx }: KnownErrorParams);
  1964. get [Symbol.toStringTag](): string;
  1965. }
  1966. export declare type PrismaClientOptions = {
  1967. /**
  1968. * Overwrites the primary datasource url from your schema.prisma file
  1969. */
  1970. datasourceUrl?: string;
  1971. /**
  1972. * Instance of a Driver Adapter, e.g., like one provided by `@prisma/adapter-planetscale.
  1973. */
  1974. adapter?: DriverAdapter | null;
  1975. /**
  1976. * Overwrites the datasource url from your schema.prisma file
  1977. */
  1978. datasources?: Datasources;
  1979. /**
  1980. * @default "colorless"
  1981. */
  1982. errorFormat?: ErrorFormat;
  1983. /**
  1984. * The default values for Transaction options
  1985. * maxWait ?= 2000
  1986. * timeout ?= 5000
  1987. */
  1988. transactionOptions?: Transaction_2.Options;
  1989. /**
  1990. * @example
  1991. * \`\`\`
  1992. * // Defaults to stdout
  1993. * log: ['query', 'info', 'warn']
  1994. *
  1995. * // Emit as events
  1996. * log: [
  1997. * { emit: 'stdout', level: 'query' },
  1998. * { emit: 'stdout', level: 'info' },
  1999. * { emit: 'stdout', level: 'warn' }
  2000. * ]
  2001. * \`\`\`
  2002. * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/logging#the-log-option).
  2003. */
  2004. log?: Array<LogLevel | LogDefinition>;
  2005. omit?: GlobalOmitOptions;
  2006. /**
  2007. * @internal
  2008. * You probably don't want to use this. \`__internal\` is used by internal tooling.
  2009. */
  2010. __internal?: {
  2011. debug?: boolean;
  2012. engine?: {
  2013. cwd?: string;
  2014. binaryPath?: string;
  2015. endpoint?: string;
  2016. allowTriggerPanic?: boolean;
  2017. };
  2018. /** This can be used for testing purposes */
  2019. configOverride?: (config: GetPrismaClientConfig) => GetPrismaClientConfig;
  2020. };
  2021. };
  2022. export declare class PrismaClientRustPanicError extends Error {
  2023. clientVersion: string;
  2024. constructor(message: string, clientVersion: string);
  2025. get [Symbol.toStringTag](): string;
  2026. }
  2027. export declare class PrismaClientUnknownRequestError extends Error implements ErrorWithBatchIndex {
  2028. clientVersion: string;
  2029. batchRequestIdx?: number;
  2030. constructor(message: string, { clientVersion, batchRequestIdx }: UnknownErrorParams);
  2031. get [Symbol.toStringTag](): string;
  2032. }
  2033. export declare class PrismaClientValidationError extends Error {
  2034. name: string;
  2035. clientVersion: string;
  2036. constructor(message: string, { clientVersion }: Options_2);
  2037. get [Symbol.toStringTag](): string;
  2038. }
  2039. declare function prismaGraphQLToJSError({ error, user_facing_error }: RequestError, clientVersion: string, activeProvider: string): PrismaClientKnownRequestError | PrismaClientUnknownRequestError;
  2040. export declare interface PrismaPromise<T> extends Promise<T> {
  2041. [Symbol.toStringTag]: 'PrismaPromise';
  2042. }
  2043. /**
  2044. * Prisma's `Promise` that is backwards-compatible. All additions on top of the
  2045. * original `Promise` are optional so that it can be backwards-compatible.
  2046. * @see [[createPrismaPromise]]
  2047. */
  2048. declare interface PrismaPromise_2<A> extends Promise<A> {
  2049. /**
  2050. * Extension of the original `.then` function
  2051. * @param onfulfilled same as regular promises
  2052. * @param onrejected same as regular promises
  2053. * @param transaction transaction options
  2054. */
  2055. then<R1 = A, R2 = never>(onfulfilled?: (value: A) => R1 | PromiseLike<R1>, onrejected?: (error: unknown) => R2 | PromiseLike<R2>, transaction?: PrismaPromiseTransaction): Promise<R1 | R2>;
  2056. /**
  2057. * Extension of the original `.catch` function
  2058. * @param onrejected same as regular promises
  2059. * @param transaction transaction options
  2060. */
  2061. catch<R = never>(onrejected?: ((reason: any) => R | PromiseLike<R>) | undefined | null, transaction?: PrismaPromiseTransaction): Promise<A | R>;
  2062. /**
  2063. * Extension of the original `.finally` function
  2064. * @param onfinally same as regular promises
  2065. * @param transaction transaction options
  2066. */
  2067. finally(onfinally?: (() => void) | undefined | null, transaction?: PrismaPromiseTransaction): Promise<A>;
  2068. /**
  2069. * Called when executing a batch of regular tx
  2070. * @param transaction transaction options for batch tx
  2071. */
  2072. requestTransaction?(transaction: PrismaPromiseBatchTransaction): PromiseLike<unknown>;
  2073. }
  2074. declare type PrismaPromiseBatchTransaction = {
  2075. kind: 'batch';
  2076. id: number;
  2077. isolationLevel?: IsolationLevel;
  2078. index: number;
  2079. lock: PromiseLike<void>;
  2080. };
  2081. declare type PrismaPromiseCallback = (transaction?: PrismaPromiseTransaction) => PrismaPromise_2<unknown>;
  2082. /**
  2083. * Creates a [[PrismaPromise]]. It is Prisma's implementation of `Promise` which
  2084. * is essentially a proxy for `Promise`. All the transaction-compatible client
  2085. * methods return one, this allows for pre-preparing queries without executing
  2086. * them until `.then` is called. It's the foundation of Prisma's query batching.
  2087. * @param callback that will be wrapped within our promise implementation
  2088. * @see [[PrismaPromise]]
  2089. * @returns
  2090. */
  2091. declare type PrismaPromiseFactory = (callback: PrismaPromiseCallback) => PrismaPromise_2<unknown>;
  2092. declare type PrismaPromiseInteractiveTransaction<PayloadType = unknown> = {
  2093. kind: 'itx';
  2094. id: string;
  2095. payload: PayloadType;
  2096. };
  2097. declare type PrismaPromiseTransaction<PayloadType = unknown> = PrismaPromiseBatchTransaction | PrismaPromiseInteractiveTransaction<PayloadType>;
  2098. declare namespace Public {
  2099. export {
  2100. validator
  2101. }
  2102. }
  2103. export { Public }
  2104. declare namespace Public_2 {
  2105. export {
  2106. Args,
  2107. Result,
  2108. Payload,
  2109. PrismaPromise,
  2110. Operation,
  2111. Exact
  2112. }
  2113. }
  2114. declare type Query = {
  2115. sql: string;
  2116. args: Array<unknown>;
  2117. };
  2118. declare interface Queryable {
  2119. readonly provider: 'mysql' | 'postgres' | 'sqlite';
  2120. readonly adapterName: (typeof officialPrismaAdapters)[number] | (string & {});
  2121. /**
  2122. * Execute a query given as SQL, interpolating the given parameters,
  2123. * and returning the type-aware result set of the query.
  2124. *
  2125. * This is the preferred way of executing `SELECT` queries.
  2126. */
  2127. queryRaw(params: Query): Promise<Result_4<ResultSet>>;
  2128. /**
  2129. * Execute a query given as SQL, interpolating the given parameters,
  2130. * and returning the number of affected rows.
  2131. *
  2132. * This is the preferred way of executing `INSERT`, `UPDATE`, `DELETE` queries,
  2133. * as well as transactional queries.
  2134. */
  2135. executeRaw(params: Query): Promise<Result_4<number>>;
  2136. }
  2137. declare type QueryEngineBatchGraphQLRequest = {
  2138. batch: QueryEngineRequest[];
  2139. transaction?: boolean;
  2140. isolationLevel?: Transaction_2.IsolationLevel;
  2141. };
  2142. declare type QueryEngineBatchRequest = QueryEngineBatchGraphQLRequest | JsonBatchQuery;
  2143. declare type QueryEngineConfig = {
  2144. datamodel: string;
  2145. configDir: string;
  2146. logQueries: boolean;
  2147. ignoreEnvVarErrors: boolean;
  2148. datasourceOverrides: Record<string, string>;
  2149. env: Record<string, string | undefined>;
  2150. logLevel: QueryEngineLogLevel;
  2151. telemetry?: QueryEngineTelemetry;
  2152. engineProtocol: EngineProtocol;
  2153. };
  2154. declare interface QueryEngineConstructor {
  2155. new (config: QueryEngineConfig, logger: (log: string) => void, adapter?: ErrorCapturingDriverAdapter): QueryEngineInstance;
  2156. }
  2157. declare type QueryEngineInstance = {
  2158. connect(headers: string): Promise<void>;
  2159. disconnect(headers: string): Promise<void>;
  2160. /**
  2161. * @param requestStr JSON.stringified `QueryEngineRequest | QueryEngineBatchRequest`
  2162. * @param headersStr JSON.stringified `QueryEngineRequestHeaders`
  2163. */
  2164. query(requestStr: string, headersStr: string, transactionId?: string): Promise<string>;
  2165. sdlSchema(): Promise<string>;
  2166. dmmf(traceparent: string): Promise<string>;
  2167. startTransaction(options: string, traceHeaders: string): Promise<string>;
  2168. commitTransaction(id: string, traceHeaders: string): Promise<string>;
  2169. rollbackTransaction(id: string, traceHeaders: string): Promise<string>;
  2170. metrics(options: string): Promise<string>;
  2171. applyPendingMigrations(): Promise<void>;
  2172. };
  2173. declare type QueryEngineLogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'off';
  2174. declare type QueryEngineRequest = {
  2175. query: string;
  2176. variables: Object;
  2177. };
  2178. declare type QueryEngineResult<T> = {
  2179. data: T;
  2180. elapsed: number;
  2181. };
  2182. declare type QueryEngineTelemetry = {
  2183. enabled: Boolean;
  2184. endpoint: string;
  2185. };
  2186. declare type QueryEvent = {
  2187. timestamp: Date;
  2188. query: string;
  2189. params: string;
  2190. duration: number;
  2191. target: string;
  2192. };
  2193. declare type QueryEventType = 'query';
  2194. declare type QueryMiddleware = (params: QueryMiddlewareParams, next: (params: QueryMiddlewareParams) => Promise<unknown>) => Promise<unknown>;
  2195. declare type QueryMiddlewareParams = {
  2196. /** The model this is executed on */
  2197. model?: string;
  2198. /** The action that is being handled */
  2199. action: Action;
  2200. /** TODO what is this */
  2201. dataPath: string[];
  2202. /** TODO what is this */
  2203. runInTransaction: boolean;
  2204. args?: UserArgs_2;
  2205. };
  2206. export declare type QueryOptions = {
  2207. query: {
  2208. [ModelName in string]: {
  2209. [ModelAction in string]: ModelQueryOptionsCb;
  2210. } | QueryOptionsCb;
  2211. };
  2212. };
  2213. export declare type QueryOptionsCb = (args: QueryOptionsCbArgs) => Promise<any>;
  2214. export declare type QueryOptionsCbArgs = {
  2215. model?: string;
  2216. operation: string;
  2217. args: JsArgs | RawQueryArgs;
  2218. query: (args: JsArgs | RawQueryArgs) => Promise<unknown>;
  2219. };
  2220. /**
  2221. * Create raw SQL statement.
  2222. */
  2223. export declare function raw(value: string): Sql;
  2224. export declare type RawParameters = {
  2225. __prismaRawParameters__: true;
  2226. values: string;
  2227. };
  2228. export declare type RawQueryArgs = Sql | [query: string, ...values: RawValue[]];
  2229. declare type RawTaggedValue = {
  2230. $type: 'Raw';
  2231. value: unknown;
  2232. };
  2233. /**
  2234. * Supported value or SQL instance.
  2235. */
  2236. export declare type RawValue = Value | Sql;
  2237. export declare type ReadonlyDeep<T> = {
  2238. readonly [K in keyof T]: ReadonlyDeep<T[K]>;
  2239. };
  2240. declare type ReadonlyDeep_2<O> = {
  2241. +readonly [K in keyof O]: ReadonlyDeep_2<O[K]>;
  2242. };
  2243. declare type Record_2<T extends string | number | symbol, U> = {
  2244. [P in T]: U;
  2245. };
  2246. export { Record_2 as Record }
  2247. export declare type RenameAndNestPayloadKeys<P> = {
  2248. [K in keyof P as K extends 'scalars' | 'objects' | 'composites' ? keyof P[K] : never]: P[K];
  2249. };
  2250. declare type RequestBatchOptions<InteractiveTransactionPayload> = {
  2251. transaction?: TransactionOptions_2<InteractiveTransactionPayload>;
  2252. traceparent?: string;
  2253. numTry?: number;
  2254. containsWrite: boolean;
  2255. customDataProxyFetch?: (fetch: Fetch) => Fetch;
  2256. };
  2257. declare interface RequestError {
  2258. error: string;
  2259. user_facing_error: {
  2260. is_panic: boolean;
  2261. message: string;
  2262. meta?: Record<string, unknown>;
  2263. error_code?: string;
  2264. batch_request_idx?: number;
  2265. };
  2266. }
  2267. declare class RequestHandler {
  2268. client: Client;
  2269. dataloader: DataLoader<RequestParams>;
  2270. private logEmitter?;
  2271. constructor(client: Client, logEmitter?: LogEmitter);
  2272. request(params: RequestParams): Promise<any>;
  2273. mapQueryEngineResult({ dataPath, unpacker }: RequestParams, response: QueryEngineResult<any>): any;
  2274. /**
  2275. * Handles the error and logs it, logging the error is done synchronously waiting for the event
  2276. * handlers to finish.
  2277. */
  2278. handleAndLogRequestError(params: HandleErrorParams): never;
  2279. handleRequestError({ error, clientMethod, callsite, transaction, args, modelName, globalOmit, }: HandleErrorParams): never;
  2280. sanitizeMessage(message: any): any;
  2281. unpack(data: unknown, dataPath: string[], unpacker?: Unpacker): any;
  2282. get [Symbol.toStringTag](): string;
  2283. }
  2284. declare type RequestOptions = {
  2285. method?: string;
  2286. headers?: Record<string, string>;
  2287. body?: string;
  2288. };
  2289. declare type RequestOptions_2<InteractiveTransactionPayload> = {
  2290. traceparent?: string;
  2291. numTry?: number;
  2292. interactiveTransaction?: InteractiveTransactionOptions<InteractiveTransactionPayload>;
  2293. isWrite: boolean;
  2294. customDataProxyFetch?: (fetch: Fetch) => Fetch;
  2295. };
  2296. declare type RequestParams = {
  2297. modelName?: string;
  2298. action: Action;
  2299. protocolQuery: JsonQuery;
  2300. dataPath: string[];
  2301. clientMethod: string;
  2302. callsite?: CallSite;
  2303. transaction?: PrismaPromiseTransaction;
  2304. extensions: MergedExtensionsList;
  2305. args?: any;
  2306. headers?: Record<string, string>;
  2307. unpacker?: Unpacker;
  2308. otelParentCtx?: Context;
  2309. otelChildCtx?: Context;
  2310. globalOmit?: GlobalOmitOptions;
  2311. customDataProxyFetch?: (fetch: Fetch) => Fetch;
  2312. };
  2313. declare type RequestResponse = {
  2314. ok: boolean;
  2315. url: string;
  2316. statusText?: string;
  2317. status: number;
  2318. headers: NodeHeaders;
  2319. text: () => Promise<string>;
  2320. json: () => Promise<any>;
  2321. };
  2322. declare type RequiredExtensionArgs = NameArgs & ResultArgs & ModelArgs & ClientArgs & QueryOptions;
  2323. export { RequiredExtensionArgs }
  2324. export { RequiredExtensionArgs as UserArgs }
  2325. export declare type RequiredKeys<O> = {
  2326. [K in keyof O]-?: {} extends Pick_2<O, K> ? never : K;
  2327. }[keyof O];
  2328. declare function resolveDatasourceUrl({ inlineDatasources, overrideDatasources, env, clientVersion, }: {
  2329. inlineDatasources: GetPrismaClientConfig['inlineDatasources'];
  2330. overrideDatasources: Datasources;
  2331. env: Record<string, string | undefined>;
  2332. clientVersion: string;
  2333. }): string;
  2334. export declare type Result<T, A, F extends Operation> = T extends {
  2335. [K: symbol]: {
  2336. types: {
  2337. payload: any;
  2338. };
  2339. };
  2340. } ? GetResult<T[symbol]['types']['payload'], A, F> : GetResult<{
  2341. composites: {};
  2342. objects: {};
  2343. scalars: {};
  2344. name: '';
  2345. }, {}, F>;
  2346. export declare type Result_2<T, A, F extends Operation> = Result<T, A, F>;
  2347. declare namespace Result_3 {
  2348. export {
  2349. Operation,
  2350. FluentOperation,
  2351. Count,
  2352. GetFindResult,
  2353. SelectablePayloadFields,
  2354. SelectField,
  2355. DefaultSelection,
  2356. UnwrapPayload,
  2357. ApplyOmit,
  2358. OmitValue,
  2359. GetCountResult,
  2360. Aggregate,
  2361. GetAggregateResult,
  2362. GetBatchResult,
  2363. GetGroupByResult,
  2364. GetResult,
  2365. ExtractGlobalOmit
  2366. }
  2367. }
  2368. declare type Result_4<T> = {
  2369. map<U>(fn: (value: T) => U): Result_4<U>;
  2370. flatMap<U>(fn: (value: T) => Result_4<U>): Result_4<U>;
  2371. } & ({
  2372. readonly ok: true;
  2373. readonly value: T;
  2374. } | {
  2375. readonly ok: false;
  2376. readonly error: Error_2;
  2377. });
  2378. export declare type ResultArg = {
  2379. [FieldName in string]: ResultFieldDefinition;
  2380. };
  2381. export declare type ResultArgs = {
  2382. result: {
  2383. [ModelName in string]: ResultArg;
  2384. };
  2385. };
  2386. export declare type ResultArgsFieldCompute = (model: any) => unknown;
  2387. export declare type ResultFieldDefinition = {
  2388. needs?: {
  2389. [FieldName in string]: boolean;
  2390. };
  2391. compute: ResultArgsFieldCompute;
  2392. };
  2393. declare interface ResultSet {
  2394. /**
  2395. * List of column types appearing in a database query, in the same order as `columnNames`.
  2396. * They are used within the Query Engine to convert values from JS to Quaint values.
  2397. */
  2398. columnTypes: Array<ColumnType>;
  2399. /**
  2400. * List of column names appearing in a database query, in the same order as `columnTypes`.
  2401. */
  2402. columnNames: Array<string>;
  2403. /**
  2404. * List of rows retrieved from a database query.
  2405. * Each row is a list of values, whose length matches `columnNames` and `columnTypes`.
  2406. */
  2407. rows: Array<Array<unknown>>;
  2408. /**
  2409. * The last ID of an `INSERT` statement, if any.
  2410. * This is required for `AUTO_INCREMENT` columns in databases based on MySQL and SQLite.
  2411. */
  2412. lastInsertId?: string;
  2413. }
  2414. export declare type Return<T> = T extends (...args: any[]) => infer R ? R : T;
  2415. declare type Runtime = "edge-routine" | "workerd" | "deno" | "lagon" | "react-native" | "netlify" | "electron" | "node" | "bun" | "edge-light" | "fastly" | "unknown";
  2416. declare type RuntimeDataModel = {
  2417. readonly models: Record<string, RuntimeModel>;
  2418. readonly enums: Record<string, RuntimeEnum>;
  2419. readonly types: Record<string, RuntimeModel>;
  2420. };
  2421. declare type RuntimeEnum = Omit<DMMF.DatamodelEnum, 'name'>;
  2422. declare type RuntimeModel = Omit<DMMF.Model, 'name'>;
  2423. export declare type Select<T, U> = T extends U ? T : never;
  2424. export declare type SelectablePayloadFields<K extends PropertyKey, O> = {
  2425. objects: {
  2426. [k in K]: O;
  2427. };
  2428. } | {
  2429. composites: {
  2430. [k in K]: O;
  2431. };
  2432. };
  2433. export declare type SelectField<P extends SelectablePayloadFields<any, any>, K extends PropertyKey> = P extends {
  2434. objects: Record<K, any>;
  2435. } ? P['objects'][K] : P extends {
  2436. composites: Record<K, any>;
  2437. } ? P['composites'][K] : never;
  2438. declare type Selection_2 = Record<string, boolean | JsArgs>;
  2439. export { Selection_2 as Selection }
  2440. /**
  2441. * An interface that represents a span. A span represents a single operation
  2442. * within a trace. Examples of span might include remote procedure calls or a
  2443. * in-process function calls to sub-components. A Trace has a single, top-level
  2444. * "root" Span that in turn may have zero or more child Spans, which in turn
  2445. * may have children.
  2446. *
  2447. * Spans are created by the {@link Tracer.startSpan} method.
  2448. */
  2449. declare interface Span {
  2450. /**
  2451. * Returns the {@link SpanContext} object associated with this Span.
  2452. *
  2453. * Get an immutable, serializable identifier for this span that can be used
  2454. * to create new child spans. Returned SpanContext is usable even after the
  2455. * span ends.
  2456. *
  2457. * @returns the SpanContext object associated with this Span.
  2458. */
  2459. spanContext(): SpanContext;
  2460. /**
  2461. * Sets an attribute to the span.
  2462. *
  2463. * Sets a single Attribute with the key and value passed as arguments.
  2464. *
  2465. * @param key the key for this attribute.
  2466. * @param value the value for this attribute. Setting a value null or
  2467. * undefined is invalid and will result in undefined behavior.
  2468. */
  2469. setAttribute(key: string, value: SpanAttributeValue): this;
  2470. /**
  2471. * Sets attributes to the span.
  2472. *
  2473. * @param attributes the attributes that will be added.
  2474. * null or undefined attribute values
  2475. * are invalid and will result in undefined behavior.
  2476. */
  2477. setAttributes(attributes: SpanAttributes): this;
  2478. /**
  2479. * Adds an event to the Span.
  2480. *
  2481. * @param name the name of the event.
  2482. * @param [attributesOrStartTime] the attributes that will be added; these are
  2483. * associated with this event. Can be also a start time
  2484. * if type is {@type TimeInput} and 3rd param is undefined
  2485. * @param [startTime] start time of the event.
  2486. */
  2487. addEvent(name: string, attributesOrStartTime?: SpanAttributes | TimeInput, startTime?: TimeInput): this;
  2488. /**
  2489. * Adds a single link to the span.
  2490. *
  2491. * Links added after the creation will not affect the sampling decision.
  2492. * It is preferred span links be added at span creation.
  2493. *
  2494. * @param link the link to add.
  2495. */
  2496. addLink(link: Link): this;
  2497. /**
  2498. * Adds multiple links to the span.
  2499. *
  2500. * Links added after the creation will not affect the sampling decision.
  2501. * It is preferred span links be added at span creation.
  2502. *
  2503. * @param links the links to add.
  2504. */
  2505. addLinks(links: Link[]): this;
  2506. /**
  2507. * Sets a status to the span. If used, this will override the default Span
  2508. * status. Default is {@link SpanStatusCode.UNSET}. SetStatus overrides the value
  2509. * of previous calls to SetStatus on the Span.
  2510. *
  2511. * @param status the SpanStatus to set.
  2512. */
  2513. setStatus(status: SpanStatus): this;
  2514. /**
  2515. * Updates the Span name.
  2516. *
  2517. * This will override the name provided via {@link Tracer.startSpan}.
  2518. *
  2519. * Upon this update, any sampling behavior based on Span name will depend on
  2520. * the implementation.
  2521. *
  2522. * @param name the Span name.
  2523. */
  2524. updateName(name: string): this;
  2525. /**
  2526. * Marks the end of Span execution.
  2527. *
  2528. * Call to End of a Span MUST not have any effects on child spans. Those may
  2529. * still be running and can be ended later.
  2530. *
  2531. * Do not return `this`. The Span generally should not be used after it
  2532. * is ended so chaining is not desired in this context.
  2533. *
  2534. * @param [endTime] the time to set as Span's end time. If not provided,
  2535. * use the current time as the span's end time.
  2536. */
  2537. end(endTime?: TimeInput): void;
  2538. /**
  2539. * Returns the flag whether this span will be recorded.
  2540. *
  2541. * @returns true if this Span is active and recording information like events
  2542. * with the `AddEvent` operation and attributes using `setAttributes`.
  2543. */
  2544. isRecording(): boolean;
  2545. /**
  2546. * Sets exception as a span event
  2547. * @param exception the exception the only accepted values are string or Error
  2548. * @param [time] the time to set as Span's event time. If not provided,
  2549. * use the current time.
  2550. */
  2551. recordException(exception: Exception, time?: TimeInput): void;
  2552. }
  2553. /**
  2554. * @deprecated please use {@link Attributes}
  2555. */
  2556. declare type SpanAttributes = Attributes;
  2557. /**
  2558. * @deprecated please use {@link AttributeValue}
  2559. */
  2560. declare type SpanAttributeValue = AttributeValue;
  2561. declare type SpanCallback<R> = (span?: Span, context?: Context) => R;
  2562. /**
  2563. * A SpanContext represents the portion of a {@link Span} which must be
  2564. * serialized and propagated along side of a {@link Baggage}.
  2565. */
  2566. declare interface SpanContext {
  2567. /**
  2568. * The ID of the trace that this span belongs to. It is worldwide unique
  2569. * with practically sufficient probability by being made as 16 randomly
  2570. * generated bytes, encoded as a 32 lowercase hex characters corresponding to
  2571. * 128 bits.
  2572. */
  2573. traceId: string;
  2574. /**
  2575. * The ID of the Span. It is globally unique with practically sufficient
  2576. * probability by being made as 8 randomly generated bytes, encoded as a 16
  2577. * lowercase hex characters corresponding to 64 bits.
  2578. */
  2579. spanId: string;
  2580. /**
  2581. * Only true if the SpanContext was propagated from a remote parent.
  2582. */
  2583. isRemote?: boolean;
  2584. /**
  2585. * Trace flags to propagate.
  2586. *
  2587. * It is represented as 1 byte (bitmap). Bit to represent whether trace is
  2588. * sampled or not. When set, the least significant bit documents that the
  2589. * caller may have recorded trace data. A caller who does not record trace
  2590. * data out-of-band leaves this flag unset.
  2591. *
  2592. * see {@link TraceFlags} for valid flag values.
  2593. */
  2594. traceFlags: number;
  2595. /**
  2596. * Tracing-system-specific info to propagate.
  2597. *
  2598. * The tracestate field value is a `list` as defined below. The `list` is a
  2599. * series of `list-members` separated by commas `,`, and a list-member is a
  2600. * key/value pair separated by an equals sign `=`. Spaces and horizontal tabs
  2601. * surrounding `list-members` are ignored. There can be a maximum of 32
  2602. * `list-members` in a `list`.
  2603. * More Info: https://www.w3.org/TR/trace-context/#tracestate-field
  2604. *
  2605. * Examples:
  2606. * Single tracing system (generic format):
  2607. * tracestate: rojo=00f067aa0ba902b7
  2608. * Multiple tracing systems (with different formatting):
  2609. * tracestate: rojo=00f067aa0ba902b7,congo=t61rcWkgMzE
  2610. */
  2611. traceState?: TraceState;
  2612. }
  2613. declare enum SpanKind {
  2614. /** Default value. Indicates that the span is used internally. */
  2615. INTERNAL = 0,
  2616. /**
  2617. * Indicates that the span covers server-side handling of an RPC or other
  2618. * remote request.
  2619. */
  2620. SERVER = 1,
  2621. /**
  2622. * Indicates that the span covers the client-side wrapper around an RPC or
  2623. * other remote request.
  2624. */
  2625. CLIENT = 2,
  2626. /**
  2627. * Indicates that the span describes producer sending a message to a
  2628. * broker. Unlike client and server, there is no direct critical path latency
  2629. * relationship between producer and consumer spans.
  2630. */
  2631. PRODUCER = 3,
  2632. /**
  2633. * Indicates that the span describes consumer receiving a message from a
  2634. * broker. Unlike client and server, there is no direct critical path latency
  2635. * relationship between producer and consumer spans.
  2636. */
  2637. CONSUMER = 4
  2638. }
  2639. /**
  2640. * Options needed for span creation
  2641. */
  2642. declare interface SpanOptions {
  2643. /**
  2644. * The SpanKind of a span
  2645. * @default {@link SpanKind.INTERNAL}
  2646. */
  2647. kind?: SpanKind;
  2648. /** A span's attributes */
  2649. attributes?: SpanAttributes;
  2650. /** {@link Link}s span to other spans */
  2651. links?: Link[];
  2652. /** A manually specified start time for the created `Span` object. */
  2653. startTime?: TimeInput;
  2654. /** The new span should be a root span. (Ignore parent from context). */
  2655. root?: boolean;
  2656. }
  2657. declare interface SpanStatus {
  2658. /** The status code of this message. */
  2659. code: SpanStatusCode;
  2660. /** A developer-facing error message. */
  2661. message?: string;
  2662. }
  2663. /**
  2664. * An enumeration of status codes.
  2665. */
  2666. declare enum SpanStatusCode {
  2667. /**
  2668. * The default status.
  2669. */
  2670. UNSET = 0,
  2671. /**
  2672. * The operation has been validated by an Application developer or
  2673. * Operator to have completed successfully.
  2674. */
  2675. OK = 1,
  2676. /**
  2677. * The operation contains an error.
  2678. */
  2679. ERROR = 2
  2680. }
  2681. /**
  2682. * A SQL instance can be nested within each other to build SQL strings.
  2683. */
  2684. export declare class Sql {
  2685. readonly values: Value[];
  2686. readonly strings: string[];
  2687. constructor(rawStrings: readonly string[], rawValues: readonly RawValue[]);
  2688. get sql(): string;
  2689. get statement(): string;
  2690. get text(): string;
  2691. inspect(): {
  2692. sql: string;
  2693. statement: string;
  2694. text: string;
  2695. values: unknown[];
  2696. };
  2697. }
  2698. /**
  2699. * Create a SQL object from a template string.
  2700. */
  2701. export declare function sqltag(strings: readonly string[], ...values: readonly RawValue[]): Sql;
  2702. /**
  2703. * Defines TimeInput.
  2704. *
  2705. * hrtime, epoch milliseconds, performance.now() or Date
  2706. */
  2707. declare type TimeInput = HrTime | number | Date;
  2708. export declare type ToTuple<T> = T extends any[] ? T : [T];
  2709. declare interface TraceState {
  2710. /**
  2711. * Create a new TraceState which inherits from this TraceState and has the
  2712. * given key set.
  2713. * The new entry will always be added in the front of the list of states.
  2714. *
  2715. * @param key key of the TraceState entry.
  2716. * @param value value of the TraceState entry.
  2717. */
  2718. set(key: string, value: string): TraceState;
  2719. /**
  2720. * Return a new TraceState which inherits from this TraceState but does not
  2721. * contain the given key.
  2722. *
  2723. * @param key the key for the TraceState entry to be removed.
  2724. */
  2725. unset(key: string): TraceState;
  2726. /**
  2727. * Returns the value to which the specified key is mapped, or `undefined` if
  2728. * this map contains no mapping for the key.
  2729. *
  2730. * @param key with which the specified value is to be associated.
  2731. * @returns the value to which the specified key is mapped, or `undefined` if
  2732. * this map contains no mapping for the key.
  2733. */
  2734. get(key: string): string | undefined;
  2735. /**
  2736. * Serializes the TraceState to a `list` as defined below. The `list` is a
  2737. * series of `list-members` separated by commas `,`, and a list-member is a
  2738. * key/value pair separated by an equals sign `=`. Spaces and horizontal tabs
  2739. * surrounding `list-members` are ignored. There can be a maximum of 32
  2740. * `list-members` in a `list`.
  2741. *
  2742. * @returns the serialized string.
  2743. */
  2744. serialize(): string;
  2745. }
  2746. declare interface TracingHelper {
  2747. isEnabled(): boolean;
  2748. getTraceParent(context?: Context): string;
  2749. createEngineSpan(engineSpanEvent: EngineSpanEvent): void;
  2750. getActiveContext(): Context | undefined;
  2751. runInChildSpan<R>(nameOrOptions: string | ExtendedSpanOptions, callback: SpanCallback<R>): R;
  2752. }
  2753. declare interface Transaction extends Queryable {
  2754. /**
  2755. * Transaction options.
  2756. */
  2757. readonly options: TransactionOptions;
  2758. /**
  2759. * Commit the transaction.
  2760. */
  2761. commit(): Promise<Result_4<void>>;
  2762. /**
  2763. * Rolls back the transaction.
  2764. */
  2765. rollback(): Promise<Result_4<void>>;
  2766. }
  2767. declare namespace Transaction_2 {
  2768. export {
  2769. IsolationLevel,
  2770. Options,
  2771. InteractiveTransactionInfo,
  2772. TransactionHeaders
  2773. }
  2774. }
  2775. declare type TransactionHeaders = {
  2776. traceparent?: string;
  2777. };
  2778. declare type TransactionOptions = {
  2779. usePhantomQuery: boolean;
  2780. };
  2781. declare type TransactionOptions_2<InteractiveTransactionPayload> = {
  2782. kind: 'itx';
  2783. options: InteractiveTransactionOptions<InteractiveTransactionPayload>;
  2784. } | {
  2785. kind: 'batch';
  2786. options: BatchTransactionOptions;
  2787. };
  2788. export declare type TypeMapCbDef = Fn<{
  2789. extArgs: InternalArgs;
  2790. clientOptions: ClientOptionDef;
  2791. }, TypeMapDef>;
  2792. /** Shared */
  2793. export declare type TypeMapDef = Record<any, any>;
  2794. declare namespace Types {
  2795. export {
  2796. Result_3 as Result,
  2797. Extensions_2 as Extensions,
  2798. Utils,
  2799. Public_2 as Public,
  2800. OperationPayload as Payload
  2801. }
  2802. }
  2803. export { Types }
  2804. declare type UnknownErrorParams = {
  2805. clientVersion: string;
  2806. batchRequestIdx?: number;
  2807. };
  2808. declare type Unpacker = (data: any) => any;
  2809. export declare type UnwrapPayload<P> = {} extends P ? unknown : {
  2810. [K in keyof P]: P[K] extends {
  2811. scalars: infer S;
  2812. composites: infer C;
  2813. }[] ? Array<S & UnwrapPayload<C>> : P[K] extends {
  2814. scalars: infer S;
  2815. composites: infer C;
  2816. } | null ? S & UnwrapPayload<C> | Select<P[K], null> : never;
  2817. };
  2818. export declare type UnwrapPromise<P> = P extends Promise<infer R> ? R : P;
  2819. export declare type UnwrapTuple<Tuple extends readonly unknown[]> = {
  2820. [K in keyof Tuple]: K extends `${number}` ? Tuple[K] extends PrismaPromise<infer X> ? X : UnwrapPromise<Tuple[K]> : UnwrapPromise<Tuple[K]>;
  2821. };
  2822. /**
  2823. * Input that flows from the user into the Client.
  2824. */
  2825. declare type UserArgs_2 = any;
  2826. declare namespace Utils {
  2827. export {
  2828. EmptyToUnknown,
  2829. NeverToUnknown,
  2830. PatchFlat,
  2831. Omit_2 as Omit,
  2832. Pick_2 as Pick,
  2833. ComputeDeep,
  2834. Compute,
  2835. OptionalFlat,
  2836. ReadonlyDeep,
  2837. Narrowable,
  2838. Narrow,
  2839. Exact,
  2840. Cast,
  2841. JsonObject,
  2842. JsonArray,
  2843. JsonValue,
  2844. Record_2 as Record,
  2845. UnwrapPromise,
  2846. UnwrapTuple,
  2847. Path,
  2848. Fn,
  2849. Call,
  2850. RequiredKeys,
  2851. OptionalKeys,
  2852. Optional,
  2853. Return,
  2854. ToTuple,
  2855. RenameAndNestPayloadKeys,
  2856. PayloadToResult,
  2857. Select,
  2858. Equals,
  2859. Or,
  2860. JsPromise
  2861. }
  2862. }
  2863. declare function validator<V>(): <S>(select: Exact<S, V>) => S;
  2864. declare function validator<C, M extends Exclude<keyof C, `$${string}`>, O extends keyof C[M] & Operation>(client: C, model: M, operation: O): <S>(select: Exact<S, Args<C[M], O>>) => S;
  2865. declare function validator<C, M extends Exclude<keyof C, `$${string}`>, O extends keyof C[M] & Operation, P extends keyof Args<C[M], O>>(client: C, model: M, operation: O, prop: P): <S>(select: Exact<S, Args<C[M], O>[P]>) => S;
  2866. /**
  2867. * Values supported by SQL engine.
  2868. */
  2869. export declare type Value = unknown;
  2870. export declare function warnEnvConflicts(envPaths: any): void;
  2871. export declare const warnOnce: (key: string, message: string, ...args: unknown[]) => void;
  2872. declare type WasmLoadingConfig = {
  2873. /**
  2874. * WASM-bindgen runtime for corresponding module
  2875. */
  2876. getRuntime: () => {
  2877. __wbg_set_wasm(exports: unknown): any;
  2878. QueryEngine: QueryEngineConstructor;
  2879. };
  2880. /**
  2881. * Loads the raw wasm module for the wasm query engine. This configuration is
  2882. * generated specifically for each type of client, eg. Node.js client and Edge
  2883. * clients will have different implementations.
  2884. * @remarks this is a callback on purpose, we only load the wasm if needed.
  2885. * @remarks only used by LibraryEngine.ts
  2886. */
  2887. getQueryEngineWasmModule: () => Promise<unknown>;
  2888. };
  2889. export { }