library.d.ts 123 KB

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