prisma 5.23.0-dev.3 → 5.23.0-dev.30

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.
@@ -101,7 +101,7 @@ declare type BatchQuery = {
101
101
  args: JsArgs | RawQueryArgs;
102
102
  };
103
103
 
104
- declare type BatchQueryEngineResult<T> = QueryEngineResult<T> | Error;
104
+ declare type BatchQueryEngineResult<T> = QueryEngineResultData<T> | Error;
105
105
 
106
106
  declare type BatchQueryOptionsCb = (args: BatchQueryOptionsCbArgs) => Promise<any>;
107
107
 
@@ -266,7 +266,36 @@ export declare type Count<O> = {
266
266
  [K in keyof O]: Count<number>;
267
267
  } & {};
268
268
 
269
- declare type CustomDataProxyFetch = (fetch: Fetch) => Fetch;
269
+ /**
270
+ * Custom fetch function for `DataProxyEngine`.
271
+ *
272
+ * We can't use the actual type of `globalThis.fetch` because this will result
273
+ * in API Extractor referencing Node.js type definitions in the `.d.ts` bundle
274
+ * for the client runtime. We can only use such types in internal types that
275
+ * don't end up exported anywhere.
276
+
277
+ * It's also not possible to write a definition of `fetch` that would accept the
278
+ * actual `fetch` function from different environments such as Node.js and
279
+ * Cloudflare Workers (with their extensions to `RequestInit` and `Response`).
280
+ * `fetch` is used in both covariant and contravariant positions in
281
+ * `CustomDataProxyFetch`, making it invariant, so we need the exact same type.
282
+ * Even if we removed the argument and left `fetch` in covariant position only,
283
+ * then for an extension-supplied function to be assignable to `customDataProxyFetch`,
284
+ * the platform-specific (or custom) `fetch` function needs to be assignable
285
+ * to our `fetch` definition. This, in turn, requires the third-party `Response`
286
+ * to be a subtype of our `Response` (which is not a problem, we could declare
287
+ * a minimal `Response` type that only includes what we use) *and* requires the
288
+ * third-party `RequestInit` to be a supertype of our `RequestInit` (i.e. we
289
+ * have to declare all properties any `RequestInit` implementation in existence
290
+ * could possibly have), which is not possible.
291
+ *
292
+ * Since `@prisma/extension-accelerate` redefines the type of
293
+ * `__internalParams.customDataProxyFetch` to its own type anyway (probably for
294
+ * exactly this reason), our definition is never actually used and is completely
295
+ * ignored, so it doesn't matter, and we can just use `unknown` as the type of
296
+ * `fetch` here.
297
+ */
298
+ declare type CustomDataProxyFetch = (fetch: unknown) => unknown;
270
299
 
271
300
  declare class DataLoader<T = unknown> {
272
301
  private options;
@@ -689,6 +718,7 @@ export declare namespace DMMF {
689
718
  export type Model = ReadonlyDeep_2<{
690
719
  name: string;
691
720
  dbName: string | null;
721
+ schema: string | null;
692
722
  fields: Field[];
693
723
  uniqueFields: string[][];
694
724
  uniqueIndexes: uniqueIndex[];
@@ -714,6 +744,12 @@ export declare namespace DMMF {
714
744
  * BigInt, Boolean, Bytes, DateTime, Decimal, Float, Int, JSON, String, $ModelName
715
745
  */
716
746
  type: string;
747
+ /**
748
+ * Native database type, if specified.
749
+ * For example, `@db.VarChar(191)` is encoded as `['VarChar', ['191']]`,
750
+ * `@db.Text` is encoded as `['Text', []]`.
751
+ */
752
+ nativeType?: [string, string[]] | null;
717
753
  dbName?: string | null;
718
754
  hasDefaultValue: boolean;
719
755
  default?: FieldDefault | FieldDefaultScalar | FieldDefaultScalar[];
@@ -725,7 +761,7 @@ export declare namespace DMMF {
725
761
  }>;
726
762
  export type FieldDefault = ReadonlyDeep_2<{
727
763
  name: string;
728
- args: any[];
764
+ args: Array<string | number>;
729
765
  }>;
730
766
  export type FieldDefaultScalar = string | boolean | number;
731
767
  export type Index = ReadonlyDeep_2<{
@@ -1037,7 +1073,7 @@ declare interface Engine<InteractiveTransactionPayload = unknown> {
1037
1073
  start(): Promise<void>;
1038
1074
  stop(): Promise<void>;
1039
1075
  version(forceRun?: boolean): Promise<string> | string;
1040
- request<T>(query: JsonQuery, options: RequestOptions_2<InteractiveTransactionPayload>): Promise<QueryEngineResult<T>>;
1076
+ request<T>(query: JsonQuery, options: RequestOptions<InteractiveTransactionPayload>): Promise<QueryEngineResultData<T>>;
1041
1077
  requestBatch<T>(queries: JsonQuery[], options: RequestBatchOptions<InteractiveTransactionPayload>): Promise<BatchQueryEngineResult<T>[]>;
1042
1078
  transaction(action: 'start', headers: Transaction_2.TransactionHeaders, options: Transaction_2.Options): Promise<Transaction_2.InteractiveTransactionInfo<unknown>>;
1043
1079
  transaction(action: 'commit', headers: Transaction_2.TransactionHeaders, info: Transaction_2.InteractiveTransactionInfo<unknown>): Promise<void>;
@@ -1348,8 +1384,6 @@ export declare type ExtractGlobalOmit<Options, ModelName extends string> = Optio
1348
1384
  };
1349
1385
  } ? GlobalOmit : {};
1350
1386
 
1351
- declare type Fetch = typeof nodeFetch;
1352
-
1353
1387
  /**
1354
1388
  * A reference to a specific field of a specific model
1355
1389
  */
@@ -1836,7 +1870,7 @@ declare type InternalRequestParams = {
1836
1870
  /** Used to convert args for middleware and back */
1837
1871
  middlewareArgsMapper?: MiddlewareArgsMapper<unknown, unknown>;
1838
1872
  /** Used for Accelerate client extension via Data Proxy */
1839
- customDataProxyFetch?: (fetch: Fetch) => Fetch;
1873
+ customDataProxyFetch?: CustomDataProxyFetch;
1840
1874
  } & Omit<QueryMiddlewareParams, 'runInTransaction'>;
1841
1875
 
1842
1876
  declare enum IsolationLevel {
@@ -2166,37 +2200,6 @@ export declare type Narrowable = string | number | bigint | boolean | [];
2166
2200
 
2167
2201
  export declare type NeverToUnknown<T> = [T] extends [never] ? unknown : T;
2168
2202
 
2169
- /**
2170
- * Imitates `fetch` via `https` to only suit our needs, it does nothing more.
2171
- * This is because we cannot bundle `node-fetch` as it uses many other Node.js
2172
- * utilities, while also bloating our bundles. This approach is much leaner.
2173
- * @param url
2174
- * @param options
2175
- * @returns
2176
- */
2177
- declare function nodeFetch(url: string, options?: RequestOptions): Promise<RequestResponse>;
2178
-
2179
- declare class NodeHeaders {
2180
- readonly headers: Map<string, string>;
2181
- constructor(init?: Record<any, any>);
2182
- append(name: string, value: string): void;
2183
- delete(name: string): void;
2184
- get(name: string): string | null;
2185
- has(name: string): boolean;
2186
- set(name: string, value: string): void;
2187
- forEach(callbackfn: (value: string, key: string, parent: this) => void, thisArg?: any): void;
2188
- }
2189
-
2190
- /**
2191
- * @deprecated Please don´t rely on type checks to this error anymore.
2192
- * This will become a regular `PrismaClientKnownRequestError` with code `P2025`
2193
- * in the future major version of the client.
2194
- * Instead of `error instanceof Prisma.NotFoundError` use `error.code === "P2025"`.
2195
- */
2196
- export declare class NotFoundError extends PrismaClientKnownRequestError {
2197
- constructor(message: string, clientVersion: string);
2198
- }
2199
-
2200
2203
  declare class NullTypesEnumValue extends ObjectEnumValue {
2201
2204
  _getNamespace(): string;
2202
2205
  }
@@ -2566,9 +2569,8 @@ declare type QueryEngineRequest = {
2566
2569
  variables: Object;
2567
2570
  };
2568
2571
 
2569
- declare type QueryEngineResult<T> = {
2572
+ declare type QueryEngineResultData<T> = {
2570
2573
  data: T;
2571
- elapsed: number;
2572
2574
  };
2573
2575
 
2574
2576
  declare type QueryEngineTelemetry = {
@@ -2661,7 +2663,7 @@ declare type RequestBatchOptions<InteractiveTransactionPayload> = {
2661
2663
  traceparent?: string;
2662
2664
  numTry?: number;
2663
2665
  containsWrite: boolean;
2664
- customDataProxyFetch?: (fetch: Fetch) => Fetch;
2666
+ customDataProxyFetch?: CustomDataProxyFetch;
2665
2667
  };
2666
2668
 
2667
2669
  declare interface RequestError {
@@ -2681,7 +2683,7 @@ declare class RequestHandler {
2681
2683
  private logEmitter?;
2682
2684
  constructor(client: Client, logEmitter?: LogEmitter);
2683
2685
  request(params: RequestParams): Promise<any>;
2684
- mapQueryEngineResult({ dataPath, unpacker }: RequestParams, response: QueryEngineResult<any>): any;
2686
+ mapQueryEngineResult({ dataPath, unpacker }: RequestParams, response: QueryEngineResultData<any>): any;
2685
2687
  /**
2686
2688
  * Handles the error and logs it, logging the error is done synchronously waiting for the event
2687
2689
  * handlers to finish.
@@ -2693,18 +2695,12 @@ declare class RequestHandler {
2693
2695
  get [Symbol.toStringTag](): string;
2694
2696
  }
2695
2697
 
2696
- declare type RequestOptions = {
2697
- method?: string;
2698
- headers?: Record<string, string>;
2699
- body?: string;
2700
- };
2701
-
2702
- declare type RequestOptions_2<InteractiveTransactionPayload> = {
2698
+ declare type RequestOptions<InteractiveTransactionPayload> = {
2703
2699
  traceparent?: string;
2704
2700
  numTry?: number;
2705
2701
  interactiveTransaction?: InteractiveTransactionOptions<InteractiveTransactionPayload>;
2706
2702
  isWrite: boolean;
2707
- customDataProxyFetch?: (fetch: Fetch) => Fetch;
2703
+ customDataProxyFetch?: CustomDataProxyFetch;
2708
2704
  };
2709
2705
 
2710
2706
  declare type RequestParams = {
@@ -2722,17 +2718,7 @@ declare type RequestParams = {
2722
2718
  otelParentCtx?: Context;
2723
2719
  otelChildCtx?: Context;
2724
2720
  globalOmit?: GlobalOmitOptions;
2725
- customDataProxyFetch?: (fetch: Fetch) => Fetch;
2726
- };
2727
-
2728
- declare type RequestResponse = {
2729
- ok: boolean;
2730
- url: string;
2731
- statusText?: string;
2732
- status: number;
2733
- headers: NodeHeaders;
2734
- text: () => Promise<string>;
2735
- json: () => Promise<any>;
2721
+ customDataProxyFetch?: CustomDataProxyFetch;
2736
2722
  };
2737
2723
 
2738
2724
  declare type RequiredExtensionArgs = NameArgs & ResultArgs & ModelArgs & ClientArgs & QueryOptions;