@creator.co/creatorco-prisma-client 1.0.16 → 1.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -79,7 +79,7 @@ declare type BatchQueryOptionsCbArgs = {
79
79
  };
80
80
 
81
81
  declare type BatchTransactionOptions = {
82
- isolationLevel?: Transaction.IsolationLevel;
82
+ isolationLevel?: Transaction_2.IsolationLevel;
83
83
  };
84
84
 
85
85
  declare interface BinaryTargetsEnvValue {
@@ -165,6 +165,10 @@ declare type ComputedFieldsMap = {
165
165
  [fieldName: string]: ComputedField;
166
166
  };
167
167
 
168
+ declare type ConnectionInfo = {
169
+ schemaName?: string;
170
+ };
171
+
168
172
  declare interface Context {
169
173
  /**
170
174
  * Get a value from the context.
@@ -554,6 +558,27 @@ declare function defineExtension(ext: ExtensionArgs | ((client: Client) => Clien
554
558
 
555
559
  declare const denylist: readonly ["$connect", "$disconnect", "$on", "$transaction", "$use", "$extends"];
556
560
 
561
+ /**
562
+ * Detect the current JavaScript runtime following
563
+ * the WinterCG Runtime Keys proposal:
564
+ *
565
+ * - `edge-routine` Alibaba Cloud Edge Routine
566
+ * - `workerd` Cloudflare Workers
567
+ * - `deno` Deno and Deno Deploy
568
+ * - `lagon` Lagon
569
+ * - `react-native` React Native
570
+ * - `netlify` Netlify Edge Functions
571
+ * - `electron` Electron
572
+ * - `node` Node.js
573
+ * - `bun` Bun
574
+ * - `edge-light` Vercel Edge Functions
575
+ * - `fastly` Fastly Compute@Edge
576
+ *
577
+ * @see https://runtime-keys.proposal.wintercg.org/
578
+ * @returns {Runtime}
579
+ */
580
+ export declare function detectRuntime(): Runtime;
581
+
557
582
  export declare type DevTypeMapDef = {
558
583
  meta: {
559
584
  modelProps: string;
@@ -574,59 +599,59 @@ export declare type DevTypeMapFnDef = {
574
599
  payload: OperationPayload;
575
600
  };
576
601
 
577
- declare interface Dictionary<T> {
578
- [key: string]: T;
579
- }
580
-
581
- declare type Dictionary_2<T> = {
602
+ declare type Dictionary<T> = {
582
603
  [key: string]: T | undefined;
583
604
  };
584
605
 
606
+ declare interface Dictionary_2<T> {
607
+ [key: string]: T;
608
+ }
609
+
585
610
  export declare namespace DMMF {
586
- export interface Document {
611
+ export type Document = ReadonlyDeep_2<{
587
612
  datamodel: Datamodel;
588
613
  schema: Schema;
589
614
  mappings: Mappings;
590
- }
591
- export interface Mappings {
615
+ }>;
616
+ export type Mappings = ReadonlyDeep_2<{
592
617
  modelOperations: ModelMapping[];
593
618
  otherOperations: {
594
619
  read: string[];
595
620
  write: string[];
596
621
  };
597
- }
598
- export interface OtherOperationMappings {
622
+ }>;
623
+ export type OtherOperationMappings = ReadonlyDeep_2<{
599
624
  read: string[];
600
625
  write: string[];
601
- }
602
- export interface DatamodelEnum {
626
+ }>;
627
+ export type DatamodelEnum = ReadonlyDeep_2<{
603
628
  name: string;
604
629
  values: EnumValue[];
605
630
  dbName?: string | null;
606
631
  documentation?: string;
607
- }
608
- export interface SchemaEnum {
632
+ }>;
633
+ export type SchemaEnum = ReadonlyDeep_2<{
609
634
  name: string;
610
635
  values: string[];
611
- }
612
- export interface EnumValue {
636
+ }>;
637
+ export type EnumValue = ReadonlyDeep_2<{
613
638
  name: string;
614
639
  dbName: string | null;
615
- }
616
- export interface Datamodel {
640
+ }>;
641
+ export type Datamodel = ReadonlyDeep_2<{
617
642
  models: Model[];
618
643
  enums: DatamodelEnum[];
619
644
  types: Model[];
620
- }
621
- export interface uniqueIndex {
645
+ }>;
646
+ export type uniqueIndex = ReadonlyDeep_2<{
622
647
  name: string;
623
648
  fields: string[];
624
- }
625
- export interface PrimaryKey {
649
+ }>;
650
+ export type PrimaryKey = ReadonlyDeep_2<{
626
651
  name: string | null;
627
652
  fields: string[];
628
- }
629
- export interface Model {
653
+ }>;
654
+ export type Model = ReadonlyDeep_2<{
630
655
  name: string;
631
656
  dbName: string | null;
632
657
  fields: Field[];
@@ -635,11 +660,11 @@ export declare namespace DMMF {
635
660
  documentation?: string;
636
661
  primaryKey: PrimaryKey | null;
637
662
  isGenerated?: boolean;
638
- }
663
+ }>;
639
664
  export type FieldKind = 'scalar' | 'object' | 'enum' | 'unsupported';
640
665
  export type FieldNamespace = 'model' | 'prisma';
641
666
  export type FieldLocation = 'scalar' | 'inputObjectTypes' | 'outputObjectTypes' | 'enumTypes' | 'fieldRefTypes';
642
- export interface Field {
667
+ export type Field = ReadonlyDeep_2<{
643
668
  kind: FieldKind;
644
669
  name: string;
645
670
  isRequired: boolean;
@@ -662,13 +687,13 @@ export declare namespace DMMF {
662
687
  relationOnDelete?: string;
663
688
  relationName?: string;
664
689
  documentation?: string;
665
- }
666
- export interface FieldDefault {
690
+ }>;
691
+ export type FieldDefault = ReadonlyDeep_2<{
667
692
  name: string;
668
693
  args: any[];
669
- }
694
+ }>;
670
695
  export type FieldDefaultScalar = string | boolean | number;
671
- export interface Schema {
696
+ export type Schema = ReadonlyDeep_2<{
672
697
  rootQueryType?: string;
673
698
  rootMutationType?: string;
674
699
  inputObjectTypes: {
@@ -686,17 +711,17 @@ export declare namespace DMMF {
686
711
  fieldRefTypes: {
687
712
  prisma?: FieldRefType[];
688
713
  };
689
- }
690
- export interface Query {
714
+ }>;
715
+ export type Query = ReadonlyDeep_2<{
691
716
  name: string;
692
717
  args: SchemaArg[];
693
718
  output: QueryOutput;
694
- }
695
- export interface QueryOutput {
719
+ }>;
720
+ export type QueryOutput = ReadonlyDeep_2<{
696
721
  name: string;
697
722
  isRequired: boolean;
698
723
  isList: boolean;
699
- }
724
+ }>;
700
725
  export type TypeRef<AllowedLocations extends FieldLocation> = {
701
726
  isList: boolean;
702
727
  type: string;
@@ -704,33 +729,33 @@ export declare namespace DMMF {
704
729
  namespace?: FieldNamespace;
705
730
  };
706
731
  export type InputTypeRef = TypeRef<'scalar' | 'inputObjectTypes' | 'enumTypes' | 'fieldRefTypes'>;
707
- export interface SchemaArg {
732
+ export type SchemaArg = ReadonlyDeep_2<{
708
733
  name: string;
709
734
  comment?: string;
710
735
  isNullable: boolean;
711
736
  isRequired: boolean;
712
737
  inputTypes: InputTypeRef[];
713
738
  deprecation?: Deprecation;
714
- }
715
- export interface OutputType {
739
+ }>;
740
+ export type OutputType = ReadonlyDeep_2<{
716
741
  name: string;
717
742
  fields: SchemaField[];
718
- }
719
- export interface SchemaField {
743
+ }>;
744
+ export type SchemaField = ReadonlyDeep_2<{
720
745
  name: string;
721
746
  isNullable?: boolean;
722
747
  outputType: OutputTypeRef;
723
748
  args: SchemaArg[];
724
749
  deprecation?: Deprecation;
725
750
  documentation?: string;
726
- }
751
+ }>;
727
752
  export type OutputTypeRef = TypeRef<'scalar' | 'outputObjectTypes' | 'enumTypes'>;
728
- export interface Deprecation {
753
+ export type Deprecation = ReadonlyDeep_2<{
729
754
  sinceVersion: string;
730
755
  reason: string;
731
756
  plannedRemovalVersion?: string;
732
- }
733
- export interface InputType {
757
+ }>;
758
+ export type InputType = ReadonlyDeep_2<{
734
759
  name: string;
735
760
  constraints: {
736
761
  maxNumFields: number | null;
@@ -741,14 +766,14 @@ export declare namespace DMMF {
741
766
  source?: string;
742
767
  };
743
768
  fields: SchemaArg[];
744
- }
745
- export interface FieldRefType {
769
+ }>;
770
+ export type FieldRefType = ReadonlyDeep_2<{
746
771
  name: string;
747
772
  allowTypes: FieldRefAllowType[];
748
773
  fields: SchemaArg[];
749
- }
774
+ }>;
750
775
  export type FieldRefAllowType = TypeRef<'scalar' | 'enumTypes'>;
751
- export interface ModelMapping {
776
+ export type ModelMapping = ReadonlyDeep_2<{
752
777
  model: string;
753
778
  plural: string;
754
779
  findUnique?: string | null;
@@ -768,7 +793,7 @@ export declare namespace DMMF {
768
793
  count?: string | null;
769
794
  findRaw?: string | null;
770
795
  aggregateRaw?: string | null;
771
- }
796
+ }>;
772
797
  export enum ModelAction {
773
798
  findUnique = "findUnique",
774
799
  findUniqueOrThrow = "findUniqueOrThrow",
@@ -792,24 +817,24 @@ export declare namespace DMMF {
792
817
 
793
818
  export declare class DMMFClass implements DMMF.Document {
794
819
  document: DMMF.Document;
795
- private compositeNames;
796
- private inputTypesByName;
797
- readonly typeAndModelMap: Dictionary<DMMF.Model>;
798
- readonly mappingsMap: Dictionary<DMMF.ModelMapping>;
799
- readonly outputTypeMap: NamespacedTypeMap<DMMF.OutputType>;
800
- readonly rootFieldMap: Dictionary<DMMF.SchemaField>;
820
+ private _compositeNames?;
821
+ private _inputTypesByName?;
822
+ private _typeAndModelMap?;
823
+ private _mappingsMap?;
824
+ private _outputTypeMap?;
825
+ private _rootFieldMap?;
801
826
  constructor(document: DMMF.Document);
827
+ private get compositeNames();
828
+ private get inputTypesByName();
829
+ get typeAndModelMap(): Dictionary_2<DMMF.Model>;
830
+ get mappingsMap(): Dictionary_2<DMMF.ModelMapping>;
831
+ get outputTypeMap(): NamespacedTypeMap<DMMF.OutputType>;
832
+ get rootFieldMap(): Dictionary_2<DMMF.SchemaField>;
802
833
  get datamodel(): DMMF.Datamodel;
803
834
  get mappings(): DMMF.Mappings;
804
835
  get schema(): DMMF.Schema;
805
- get inputObjectTypes(): {
806
- model?: DMMF.InputType[] | undefined;
807
- prisma: DMMF.InputType[];
808
- };
809
- get outputObjectTypes(): {
810
- model: DMMF.OutputType[];
811
- prisma: DMMF.OutputType[];
812
- };
836
+ get inputObjectTypes(): DMMF.Schema['inputObjectTypes'];
837
+ get outputObjectTypes(): DMMF.Schema['outputObjectTypes'];
813
838
  isComposite(modelOrTypeName: string): boolean;
814
839
  getOtherOperationNames(): string[];
815
840
  hasEnumInNamespace(enumName: string, namespace: DMMF.FieldNamespace): boolean;
@@ -828,11 +853,11 @@ export declare interface DriverAdapter extends Queryable {
828
853
  /**
829
854
  * Starts new transation.
830
855
  */
831
- startTransaction(): Promise<Result_3<Transaction_2>>;
856
+ startTransaction(): Promise<Result_4<Transaction>>;
832
857
  /**
833
- * Closes the connection to the database, if any.
858
+ * Optional method that returns extra connection info
834
859
  */
835
- close: () => Promise<Result_3<void>>;
860
+ getConnectionInfo?(): Result_4<ConnectionInfo>;
836
861
  }
837
862
 
838
863
  /** Client */
@@ -981,15 +1006,15 @@ export declare const empty: Sql;
981
1006
  export declare type EmptyToUnknown<T> = T;
982
1007
 
983
1008
  declare abstract class Engine<InteractiveTransactionPayload = unknown> {
984
- abstract on(event: EngineEventType, listener: (args?: any) => any): void;
1009
+ abstract onBeforeExit(callback: () => Promise<void>): void;
985
1010
  abstract start(): Promise<void>;
986
1011
  abstract stop(): Promise<void>;
987
1012
  abstract version(forceRun?: boolean): Promise<string> | string;
988
- abstract request<T>(query: JsonQuery, options: RequestOptions<InteractiveTransactionPayload>): Promise<QueryEngineResult<T>>;
1013
+ abstract request<T>(query: JsonQuery, options: RequestOptions_2<InteractiveTransactionPayload>): Promise<QueryEngineResult<T>>;
989
1014
  abstract requestBatch<T>(queries: JsonQuery[], options: RequestBatchOptions<InteractiveTransactionPayload>): Promise<BatchQueryEngineResult<T>[]>;
990
- abstract transaction(action: 'start', headers: Transaction.TransactionHeaders, options?: Transaction.Options): Promise<Transaction.InteractiveTransactionInfo<unknown>>;
991
- abstract transaction(action: 'commit', headers: Transaction.TransactionHeaders, info: Transaction.InteractiveTransactionInfo<unknown>): Promise<void>;
992
- abstract transaction(action: 'rollback', headers: Transaction.TransactionHeaders, info: Transaction.InteractiveTransactionInfo<unknown>): Promise<void>;
1015
+ abstract transaction(action: 'start', headers: Transaction_2.TransactionHeaders, options?: Transaction_2.Options): Promise<Transaction_2.InteractiveTransactionInfo<unknown>>;
1016
+ abstract transaction(action: 'commit', headers: Transaction_2.TransactionHeaders, info: Transaction_2.InteractiveTransactionInfo<unknown>): Promise<void>;
1017
+ abstract transaction(action: 'rollback', headers: Transaction_2.TransactionHeaders, info: Transaction_2.InteractiveTransactionInfo<unknown>): Promise<void>;
993
1018
  abstract metrics(options: MetricsOptionsJson): Promise<Metrics>;
994
1019
  abstract metrics(options: MetricsOptionsPrometheus): Promise<string>;
995
1020
  }
@@ -1013,26 +1038,27 @@ declare interface EngineConfig {
1013
1038
  previewFeatures?: string[];
1014
1039
  engineEndpoint?: string;
1015
1040
  activeProvider?: string;
1016
- logEmitter: EventEmitter;
1041
+ logEmitter: LogEmitter;
1017
1042
  /**
1018
1043
  * Instance of a Driver Adapter, e.g., like one provided by `@prisma/adapter-planetscale`.
1019
1044
  * If set, this is only used in the library engine, and all queries would be performed through it,
1020
1045
  * rather than Prisma's Rust drivers.
1046
+ * @remarks only used by LibraryEngine.ts
1021
1047
  */
1022
1048
  adapter?: ErrorCapturingDriverAdapter;
1023
1049
  /**
1024
1050
  * The contents of the schema encoded into a string
1025
- * @remarks only used for the purpose of data proxy
1051
+ * @remarks only used by DataProxyEngine.ts
1026
1052
  */
1027
1053
  inlineSchema: string;
1028
1054
  /**
1029
1055
  * The contents of the datasource url saved in a string
1030
- * @remarks only used for the purpose of data proxy
1056
+ * @remarks only used by DataProxyEngine.ts
1031
1057
  */
1032
1058
  inlineDatasources: GetPrismaClientConfig['inlineDatasources'];
1033
1059
  /**
1034
1060
  * The string hash that was produced for a given schema
1035
- * @remarks only used for the purpose of data proxy
1061
+ * @remarks only used by DataProxyEngine.ts
1036
1062
  */
1037
1063
  inlineSchemaHash: string;
1038
1064
  /**
@@ -1051,11 +1077,14 @@ declare interface EngineConfig {
1051
1077
  * generated specifically for each type of client, eg. Node.js client and Edge
1052
1078
  * clients will have different implementations.
1053
1079
  * @remarks this is a callback on purpose, we only load the wasm if needed.
1080
+ * @remarks only used by LibraryEngine.ts
1054
1081
  */
1055
1082
  getQueryEngineWasmModule?: () => Promise<unknown>;
1056
1083
  }
1057
1084
 
1058
- declare type EngineEventType = 'query' | 'info' | 'warn' | 'error' | 'beforeExit';
1085
+ declare type EngineEvent<E extends EngineEventType> = E extends QueryEventType ? QueryEvent : LogEvent;
1086
+
1087
+ declare type EngineEventType = QueryEventType | LogEventType;
1059
1088
 
1060
1089
  declare type EngineSpan = {
1061
1090
  span: boolean;
@@ -1130,10 +1159,7 @@ declare interface ErrorWithBatchIndex {
1130
1159
  batchRequestIdx?: number;
1131
1160
  }
1132
1161
 
1133
- declare interface EventEmitter {
1134
- on(event: string, listener: (...args: any[]) => void): unknown;
1135
- emit(event: string, args?: any): boolean;
1136
- }
1162
+ declare type EventCallback<E extends ExtendedEventType> = [E] extends ['beforeExit'] ? () => Promise<void> : [E] extends [LogLevel] ? (event: EngineEvent<E>) => void : never;
1137
1163
 
1138
1164
  export declare type Exact<A, W> = (A extends unknown ? (W extends A ? {
1139
1165
  [K in keyof A]: Exact<A[K], W[K]>;
@@ -1167,6 +1193,8 @@ declare interface ExceptionWithName {
1167
1193
  stack?: string;
1168
1194
  }
1169
1195
 
1196
+ declare type ExtendedEventType = LogLevel | 'beforeExit';
1197
+
1170
1198
  declare type ExtendedSpanOptions = SpanOptions & {
1171
1199
  /** The name of the span */
1172
1200
  name: string;
@@ -1283,7 +1311,7 @@ declare interface GeneratorConfig {
1283
1311
  output: EnvValue | null;
1284
1312
  isCustomOutput?: boolean;
1285
1313
  provider: EnvValue;
1286
- config: Dictionary_2<string | string[]>;
1314
+ config: Dictionary<string | string[]>;
1287
1315
  binaryTargets: BinaryTargetsEnvValue[];
1288
1316
  previewFeatures: string[];
1289
1317
  }
@@ -1361,7 +1389,7 @@ export declare function getPrismaClient(config: GetPrismaClientConfig): {
1361
1389
  * @param middleware to hook
1362
1390
  */
1363
1391
  $use(middleware: QueryMiddleware): void;
1364
- $on(eventType: EngineEventType, callback: (event: any) => void): void;
1392
+ $on<E extends ExtendedEventType>(eventType: E, callback: EventCallback<E>): void;
1365
1393
  $connect(): Promise<void>;
1366
1394
  /**
1367
1395
  * Disconnect from the database
@@ -1435,7 +1463,7 @@ export declare function getPrismaClient(config: GetPrismaClientConfig): {
1435
1463
  */
1436
1464
  _transactionWithCallback({ callback, options, }: {
1437
1465
  callback: (client: Client) => Promise<unknown>;
1438
- options?: Options_2 | undefined;
1466
+ options?: Options | undefined;
1439
1467
  }): Promise<unknown>;
1440
1468
  _createItxClient(transaction: PrismaPromiseInteractiveTransaction): Client;
1441
1469
  /**
@@ -1580,6 +1608,7 @@ declare type HandleErrorParams = {
1580
1608
  clientMethod: string;
1581
1609
  callsite?: CallSite;
1582
1610
  transaction?: PrismaPromiseTransaction;
1611
+ modelName?: string;
1583
1612
  };
1584
1613
 
1585
1614
  /**
@@ -1609,7 +1638,7 @@ declare type InteractiveTransactionInfo<Payload = unknown> = {
1609
1638
  payload: Payload;
1610
1639
  };
1611
1640
 
1612
- declare type InteractiveTransactionOptions<Payload> = Transaction.InteractiveTransactionInfo<Payload>;
1641
+ declare type InteractiveTransactionOptions<Payload> = Transaction_2.InteractiveTransactionInfo<Payload>;
1613
1642
 
1614
1643
  export declare type InternalArgs<R = {
1615
1644
  [K in string]: {
@@ -1704,7 +1733,7 @@ export declare type JsInputValue = null | undefined | string | number | boolean
1704
1733
  [key: string]: JsInputValue;
1705
1734
  };
1706
1735
 
1707
- declare type JsonArgumentValue = number | string | boolean | null | JsonTaggedValue | JsonArgumentValue[] | {
1736
+ declare type JsonArgumentValue = number | string | boolean | null | RawTaggedValue | JsonArgumentValue[] | {
1708
1737
  [key: string]: JsonArgumentValue;
1709
1738
  };
1710
1739
 
@@ -1716,7 +1745,7 @@ export declare interface JsonConvertible {
1716
1745
  }
1717
1746
 
1718
1747
  declare type JsonFieldSelection = {
1719
- arguments?: Record<string, JsonArgumentValue>;
1748
+ arguments?: Record<string, JsonArgumentValue> | RawTaggedValue;
1720
1749
  selection: JsonSelectionSet;
1721
1750
  };
1722
1751
 
@@ -1742,11 +1771,6 @@ declare type JsonSelectionSet = {
1742
1771
  [fieldName: string]: boolean | JsonFieldSelection;
1743
1772
  };
1744
1773
 
1745
- declare type JsonTaggedValue = {
1746
- $type: 'Json';
1747
- value: string;
1748
- };
1749
-
1750
1774
  export declare type JsonValue = string | number | boolean | JsonObject | JsonArray | null;
1751
1775
 
1752
1776
  export declare type JsOutputValue = null | string | number | boolean | bigint | Uint8Array | Date | Decimal | JsOutputValue[] | {
@@ -1804,6 +1828,20 @@ declare type LogDefinition = {
1804
1828
  emit: 'stdout' | 'event';
1805
1829
  };
1806
1830
 
1831
+ declare type LogEmitter = {
1832
+ on<E extends EngineEventType>(event: E, listener: (event: EngineEvent<E>) => void): LogEmitter;
1833
+ emit(event: QueryEventType, payload: QueryEvent): void;
1834
+ emit(event: LogEventType, payload: LogEvent): void;
1835
+ };
1836
+
1837
+ declare type LogEvent = {
1838
+ timestamp: Date;
1839
+ message: string;
1840
+ target: string;
1841
+ };
1842
+
1843
+ declare type LogEventType = 'info' | 'warn' | 'error';
1844
+
1807
1845
  declare type LogLevel = 'info' | 'query' | 'warn' | 'error';
1808
1846
 
1809
1847
  /**
@@ -1969,7 +2007,7 @@ export declare type NeverToUnknown<T> = [T] extends [never] ? unknown : T;
1969
2007
  * @param options
1970
2008
  * @returns
1971
2009
  */
1972
- declare function nodeFetch(url: string, options?: RequestOptions_2): Promise<RequestResponse>;
2010
+ declare function nodeFetch(url: string, options?: RequestOptions): Promise<RequestResponse>;
1973
2011
 
1974
2012
  declare class NodeHeaders {
1975
2013
  readonly headers: Map<string, string>;
@@ -2057,20 +2095,20 @@ export declare type OptionalKeys<O> = {
2057
2095
  [K in keyof O]-?: {} extends Pick_2<O, K> ? K : never;
2058
2096
  }[keyof O];
2059
2097
 
2060
- declare type Options = {
2061
- clientVersion: string;
2062
- };
2063
-
2064
2098
  /**
2065
2099
  * maxWait ?= 2000
2066
2100
  * timeout ?= 5000
2067
2101
  */
2068
- declare type Options_2 = {
2102
+ declare type Options = {
2069
2103
  maxWait?: number;
2070
2104
  timeout?: number;
2071
2105
  isolationLevel?: IsolationLevel;
2072
2106
  };
2073
2107
 
2108
+ declare type Options_2 = {
2109
+ clientVersion: string;
2110
+ };
2111
+
2074
2112
  export declare type Or<A extends 1 | 0, B extends 1 | 0> = {
2075
2113
  0: {
2076
2114
  0: 0;
@@ -2128,7 +2166,7 @@ export declare type PrismaClientOptions = {
2128
2166
  /**
2129
2167
  * Instance of a Driver Adapter, e.g., like one provided by `@prisma/adapter-planetscale.
2130
2168
  */
2131
- adapter?: DriverAdapter;
2169
+ adapter?: DriverAdapter | null;
2132
2170
  /**
2133
2171
  * Overwrites the datasource url from your schema.prisma file
2134
2172
  */
@@ -2165,6 +2203,8 @@ export declare type PrismaClientOptions = {
2165
2203
  endpoint?: string;
2166
2204
  allowTriggerPanic?: boolean;
2167
2205
  };
2206
+ /** This can be used for testing purposes */
2207
+ configOverride?: Partial<GetPrismaClientConfig>;
2168
2208
  };
2169
2209
  };
2170
2210
 
@@ -2184,7 +2224,7 @@ export declare class PrismaClientUnknownRequestError extends Error implements Er
2184
2224
  export declare class PrismaClientValidationError extends Error {
2185
2225
  name: string;
2186
2226
  clientVersion: string;
2187
- constructor(message: string, { clientVersion }: Options);
2227
+ constructor(message: string, { clientVersion }: Options_2);
2188
2228
  get [Symbol.toStringTag](): string;
2189
2229
  }
2190
2230
 
@@ -2277,14 +2317,14 @@ declare type Query = {
2277
2317
  };
2278
2318
 
2279
2319
  declare interface Queryable {
2280
- readonly flavour: 'mysql' | 'postgres' | 'sqlite';
2320
+ readonly provider: 'mysql' | 'postgres' | 'sqlite';
2281
2321
  /**
2282
2322
  * Execute a query given as SQL, interpolating the given parameters,
2283
2323
  * and returning the type-aware result set of the query.
2284
2324
  *
2285
2325
  * This is the preferred way of executing `SELECT` queries.
2286
2326
  */
2287
- queryRaw(params: Query): Promise<Result_3<ResultSet>>;
2327
+ queryRaw(params: Query): Promise<Result_4<ResultSet>>;
2288
2328
  /**
2289
2329
  * Execute a query given as SQL, interpolating the given parameters,
2290
2330
  * and returning the number of affected rows.
@@ -2292,7 +2332,7 @@ declare interface Queryable {
2292
2332
  * This is the preferred way of executing `INSERT`, `UPDATE`, `DELETE` queries,
2293
2333
  * as well as transactional queries.
2294
2334
  */
2295
- executeRaw(params: Query): Promise<Result_3<number>>;
2335
+ executeRaw(params: Query): Promise<Result_4<number>>;
2296
2336
  }
2297
2337
 
2298
2338
  declare type QueryEngineResult<T> = {
@@ -2300,6 +2340,16 @@ declare type QueryEngineResult<T> = {
2300
2340
  elapsed: number;
2301
2341
  };
2302
2342
 
2343
+ declare type QueryEvent = {
2344
+ timestamp: Date;
2345
+ query: string;
2346
+ params: string;
2347
+ duration: number;
2348
+ target: string;
2349
+ };
2350
+
2351
+ declare type QueryEventType = 'query';
2352
+
2303
2353
  declare type QueryMiddleware = (params: QueryMiddlewareParams, next: (params: QueryMiddlewareParams) => Promise<unknown>) => Promise<unknown>;
2304
2354
 
2305
2355
  declare type QueryMiddlewareParams = {
@@ -2343,6 +2393,11 @@ export declare type RawParameters = {
2343
2393
 
2344
2394
  export declare type RawQueryArgs = Sql | [query: string, ...values: RawValue[]];
2345
2395
 
2396
+ declare type RawTaggedValue = {
2397
+ $type: 'Raw';
2398
+ value: unknown;
2399
+ };
2400
+
2346
2401
  /**
2347
2402
  * Supported value or SQL instance.
2348
2403
  */
@@ -2352,6 +2407,10 @@ export declare type ReadonlyDeep<T> = {
2352
2407
  readonly [K in keyof T]: ReadonlyDeep<T[K]>;
2353
2408
  };
2354
2409
 
2410
+ declare type ReadonlyDeep_2<O> = {
2411
+ +readonly [K in keyof O]: ReadonlyDeep_2<O[K]>;
2412
+ };
2413
+
2355
2414
  declare type Record_2<T extends string | number | symbol, U> = {
2356
2415
  [P in T]: U;
2357
2416
  };
@@ -2362,7 +2421,7 @@ export declare type RenameAndNestPayloadKeys<P> = {
2362
2421
  };
2363
2422
 
2364
2423
  declare type RequestBatchOptions<InteractiveTransactionPayload> = {
2365
- transaction?: TransactionOptions<InteractiveTransactionPayload>;
2424
+ transaction?: TransactionOptions_2<InteractiveTransactionPayload>;
2366
2425
  traceparent?: string;
2367
2426
  numTry?: number;
2368
2427
  containsWrite: boolean;
@@ -2373,7 +2432,7 @@ declare class RequestHandler {
2373
2432
  client: Client;
2374
2433
  dataloader: DataLoader<RequestParams>;
2375
2434
  private logEmitter?;
2376
- constructor(client: Client, logEmitter?: EventEmitter);
2435
+ constructor(client: Client, logEmitter?: LogEmitter);
2377
2436
  request(params: RequestParams): Promise<any>;
2378
2437
  mapQueryEngineResult({ dataPath, unpacker }: RequestParams, response: QueryEngineResult<any>): any;
2379
2438
  /**
@@ -2381,13 +2440,19 @@ declare class RequestHandler {
2381
2440
  * handlers to finish.
2382
2441
  */
2383
2442
  handleAndLogRequestError(params: HandleErrorParams): never;
2384
- handleRequestError({ error, clientMethod, callsite, transaction, args }: HandleErrorParams): never;
2443
+ handleRequestError({ error, clientMethod, callsite, transaction, args, modelName }: HandleErrorParams): never;
2385
2444
  sanitizeMessage(message: any): any;
2386
2445
  unpack(data: unknown, dataPath: string[], unpacker?: Unpacker): any;
2387
2446
  get [Symbol.toStringTag](): string;
2388
2447
  }
2389
2448
 
2390
- declare type RequestOptions<InteractiveTransactionPayload> = {
2449
+ declare type RequestOptions = {
2450
+ method?: string;
2451
+ headers?: Record<string, string>;
2452
+ body?: string;
2453
+ };
2454
+
2455
+ declare type RequestOptions_2<InteractiveTransactionPayload> = {
2391
2456
  traceparent?: string;
2392
2457
  numTry?: number;
2393
2458
  interactiveTransaction?: InteractiveTransactionOptions<InteractiveTransactionPayload>;
@@ -2395,12 +2460,6 @@ declare type RequestOptions<InteractiveTransactionPayload> = {
2395
2460
  customDataProxyFetch?: (fetch: Fetch) => Fetch;
2396
2461
  };
2397
2462
 
2398
- declare type RequestOptions_2 = {
2399
- method?: string;
2400
- headers?: Record<string, string>;
2401
- body?: string;
2402
- };
2403
-
2404
2463
  declare type RequestParams = {
2405
2464
  modelName?: string;
2406
2465
  action: Action;
@@ -2450,18 +2509,7 @@ export declare type Result<T, A, F extends Operation> = T extends {
2450
2509
 
2451
2510
  export declare type Result_2<T, A, F extends Operation> = Result<T, A, F>;
2452
2511
 
2453
- declare type Result_3<T> = {
2454
- map<U>(fn: (value: T) => U): Result_3<U>;
2455
- flatMap<U>(fn: (value: T) => Result_3<U>): Result_3<U>;
2456
- } & ({
2457
- readonly ok: true;
2458
- readonly value: T;
2459
- } | {
2460
- readonly ok: false;
2461
- readonly error: Error_2;
2462
- });
2463
-
2464
- declare namespace Result_4 {
2512
+ declare namespace Result_3 {
2465
2513
  export {
2466
2514
  Operation,
2467
2515
  FluentOperation,
@@ -2480,6 +2528,17 @@ declare namespace Result_4 {
2480
2528
  }
2481
2529
  }
2482
2530
 
2531
+ declare type Result_4<T> = {
2532
+ map<U>(fn: (value: T) => U): Result_4<U>;
2533
+ flatMap<U>(fn: (value: T) => Result_4<U>): Result_4<U>;
2534
+ } & ({
2535
+ readonly ok: true;
2536
+ readonly value: T;
2537
+ } | {
2538
+ readonly ok: false;
2539
+ readonly error: Error_2;
2540
+ });
2541
+
2483
2542
  export declare type ResultArg = {
2484
2543
  [FieldName in string]: ResultFieldDefinition;
2485
2544
  };
@@ -2516,13 +2575,15 @@ declare interface ResultSet {
2516
2575
  rows: Array<Array<unknown>>;
2517
2576
  /**
2518
2577
  * The last ID of an `INSERT` statement, if any.
2519
- * This is required for `AUTO_INCREMENT` columns in MySQL and SQLite-flavoured databases.
2578
+ * This is required for `AUTO_INCREMENT` columns in databases based on MySQL and SQLite.
2520
2579
  */
2521
2580
  lastInsertId?: string;
2522
2581
  }
2523
2582
 
2524
2583
  export declare type Return<T> = T extends (...args: any[]) => infer R ? R : T;
2525
2584
 
2585
+ declare type Runtime = "edge-routine" | "workerd" | "deno" | "lagon" | "react-native" | "netlify" | "electron" | "node" | "bun" | "edge-light" | "fastly" | "unknown";
2586
+
2526
2587
  declare type RuntimeDataModel = {
2527
2588
  readonly models: Record<string, RuntimeModel>;
2528
2589
  readonly enums: Record<string, RuntimeEnum>;
@@ -2795,6 +2856,7 @@ export declare class Sql {
2795
2856
  constructor(rawStrings: readonly string[], rawValues: readonly RawValue[]);
2796
2857
  get text(): string;
2797
2858
  get sql(): string;
2859
+ get statement(): string;
2798
2860
  inspect(): {
2799
2861
  text: string;
2800
2862
  sql: string;
@@ -2862,42 +2924,39 @@ declare interface TracingHelper {
2862
2924
  runInChildSpan<R>(nameOrOptions: string | ExtendedSpanOptions, callback: SpanCallback<R>): R;
2863
2925
  }
2864
2926
 
2865
- declare namespace Transaction {
2866
- export {
2867
- IsolationLevel,
2868
- Options_2 as Options,
2869
- InteractiveTransactionInfo,
2870
- TransactionHeaders
2871
- }
2872
- }
2873
-
2874
- declare interface Transaction_2 extends Queryable {
2927
+ declare interface Transaction extends Queryable {
2875
2928
  /**
2876
2929
  * Transaction options.
2877
2930
  */
2878
- readonly options: TransactionOptions_2;
2931
+ readonly options: TransactionOptions;
2879
2932
  /**
2880
2933
  * Commit the transaction.
2881
2934
  */
2882
- commit(): Promise<Result_3<void>>;
2935
+ commit(): Promise<Result_4<void>>;
2883
2936
  /**
2884
2937
  * Rolls back the transaction.
2885
2938
  */
2886
- rollback(): Promise<Result_3<void>>;
2887
- /**
2888
- * Discards and closes the transaction which may or may not have been committed or rolled back.
2889
- * This operation must be synchronous. If the implementation requires calling creating new
2890
- * asynchronous tasks on the event loop, the driver is responsible for handling the errors
2891
- * appropriately to ensure they don't crash the application.
2892
- */
2893
- dispose(): Result_3<void>;
2939
+ rollback(): Promise<Result_4<void>>;
2940
+ }
2941
+
2942
+ declare namespace Transaction_2 {
2943
+ export {
2944
+ IsolationLevel,
2945
+ Options,
2946
+ InteractiveTransactionInfo,
2947
+ TransactionHeaders
2948
+ }
2894
2949
  }
2895
2950
 
2896
2951
  declare type TransactionHeaders = {
2897
2952
  traceparent?: string;
2898
2953
  };
2899
2954
 
2900
- declare type TransactionOptions<InteractiveTransactionPayload> = {
2955
+ declare type TransactionOptions = {
2956
+ usePhantomQuery: boolean;
2957
+ };
2958
+
2959
+ declare type TransactionOptions_2<InteractiveTransactionPayload> = {
2901
2960
  kind: 'itx';
2902
2961
  options: InteractiveTransactionOptions<InteractiveTransactionPayload>;
2903
2962
  } | {
@@ -2905,10 +2964,6 @@ declare type TransactionOptions<InteractiveTransactionPayload> = {
2905
2964
  options: BatchTransactionOptions;
2906
2965
  };
2907
2966
 
2908
- declare type TransactionOptions_2 = {
2909
- usePhantomQuery: boolean;
2910
- };
2911
-
2912
2967
  export declare type TypeMapCbDef = Fn<{
2913
2968
  extArgs: InternalArgs;
2914
2969
  }, TypeMapDef>;
@@ -2918,7 +2973,7 @@ export declare type TypeMapDef = Record<any, any>;
2918
2973
 
2919
2974
  declare namespace Types {
2920
2975
  export {
2921
- Result_4 as Result,
2976
+ Result_3 as Result,
2922
2977
  Extensions_2 as Extensions,
2923
2978
  Utils,
2924
2979
  Public_2 as Public,