prisma 5.23.0-dev.7 → 5.23.0-dev.8

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;
@@ -1037,7 +1066,7 @@ declare interface Engine<InteractiveTransactionPayload = unknown> {
1037
1066
  start(): Promise<void>;
1038
1067
  stop(): Promise<void>;
1039
1068
  version(forceRun?: boolean): Promise<string> | string;
1040
- request<T>(query: JsonQuery, options: RequestOptions_2<InteractiveTransactionPayload>): Promise<QueryEngineResult<T>>;
1069
+ request<T>(query: JsonQuery, options: RequestOptions<InteractiveTransactionPayload>): Promise<QueryEngineResultData<T>>;
1041
1070
  requestBatch<T>(queries: JsonQuery[], options: RequestBatchOptions<InteractiveTransactionPayload>): Promise<BatchQueryEngineResult<T>[]>;
1042
1071
  transaction(action: 'start', headers: Transaction_2.TransactionHeaders, options: Transaction_2.Options): Promise<Transaction_2.InteractiveTransactionInfo<unknown>>;
1043
1072
  transaction(action: 'commit', headers: Transaction_2.TransactionHeaders, info: Transaction_2.InteractiveTransactionInfo<unknown>): Promise<void>;
@@ -1348,8 +1377,6 @@ export declare type ExtractGlobalOmit<Options, ModelName extends string> = Optio
1348
1377
  };
1349
1378
  } ? GlobalOmit : {};
1350
1379
 
1351
- declare type Fetch = typeof nodeFetch;
1352
-
1353
1380
  /**
1354
1381
  * A reference to a specific field of a specific model
1355
1382
  */
@@ -1836,7 +1863,7 @@ declare type InternalRequestParams = {
1836
1863
  /** Used to convert args for middleware and back */
1837
1864
  middlewareArgsMapper?: MiddlewareArgsMapper<unknown, unknown>;
1838
1865
  /** Used for Accelerate client extension via Data Proxy */
1839
- customDataProxyFetch?: (fetch: Fetch) => Fetch;
1866
+ customDataProxyFetch?: CustomDataProxyFetch;
1840
1867
  } & Omit<QueryMiddlewareParams, 'runInTransaction'>;
1841
1868
 
1842
1869
  declare enum IsolationLevel {
@@ -2166,27 +2193,6 @@ export declare type Narrowable = string | number | bigint | boolean | [];
2166
2193
 
2167
2194
  export declare type NeverToUnknown<T> = [T] extends [never] ? unknown : T;
2168
2195
 
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
2196
  declare class NullTypesEnumValue extends ObjectEnumValue {
2191
2197
  _getNamespace(): string;
2192
2198
  }
@@ -2556,9 +2562,8 @@ declare type QueryEngineRequest = {
2556
2562
  variables: Object;
2557
2563
  };
2558
2564
 
2559
- declare type QueryEngineResult<T> = {
2565
+ declare type QueryEngineResultData<T> = {
2560
2566
  data: T;
2561
- elapsed: number;
2562
2567
  };
2563
2568
 
2564
2569
  declare type QueryEngineTelemetry = {
@@ -2651,7 +2656,7 @@ declare type RequestBatchOptions<InteractiveTransactionPayload> = {
2651
2656
  traceparent?: string;
2652
2657
  numTry?: number;
2653
2658
  containsWrite: boolean;
2654
- customDataProxyFetch?: (fetch: Fetch) => Fetch;
2659
+ customDataProxyFetch?: CustomDataProxyFetch;
2655
2660
  };
2656
2661
 
2657
2662
  declare interface RequestError {
@@ -2671,7 +2676,7 @@ declare class RequestHandler {
2671
2676
  private logEmitter?;
2672
2677
  constructor(client: Client, logEmitter?: LogEmitter);
2673
2678
  request(params: RequestParams): Promise<any>;
2674
- mapQueryEngineResult({ dataPath, unpacker }: RequestParams, response: QueryEngineResult<any>): any;
2679
+ mapQueryEngineResult({ dataPath, unpacker }: RequestParams, response: QueryEngineResultData<any>): any;
2675
2680
  /**
2676
2681
  * Handles the error and logs it, logging the error is done synchronously waiting for the event
2677
2682
  * handlers to finish.
@@ -2683,18 +2688,12 @@ declare class RequestHandler {
2683
2688
  get [Symbol.toStringTag](): string;
2684
2689
  }
2685
2690
 
2686
- declare type RequestOptions = {
2687
- method?: string;
2688
- headers?: Record<string, string>;
2689
- body?: string;
2690
- };
2691
-
2692
- declare type RequestOptions_2<InteractiveTransactionPayload> = {
2691
+ declare type RequestOptions<InteractiveTransactionPayload> = {
2693
2692
  traceparent?: string;
2694
2693
  numTry?: number;
2695
2694
  interactiveTransaction?: InteractiveTransactionOptions<InteractiveTransactionPayload>;
2696
2695
  isWrite: boolean;
2697
- customDataProxyFetch?: (fetch: Fetch) => Fetch;
2696
+ customDataProxyFetch?: CustomDataProxyFetch;
2698
2697
  };
2699
2698
 
2700
2699
  declare type RequestParams = {
@@ -2712,17 +2711,7 @@ declare type RequestParams = {
2712
2711
  otelParentCtx?: Context;
2713
2712
  otelChildCtx?: Context;
2714
2713
  globalOmit?: GlobalOmitOptions;
2715
- customDataProxyFetch?: (fetch: Fetch) => Fetch;
2716
- };
2717
-
2718
- declare type RequestResponse = {
2719
- ok: boolean;
2720
- url: string;
2721
- statusText?: string;
2722
- status: number;
2723
- headers: NodeHeaders;
2724
- text: () => Promise<string>;
2725
- json: () => Promise<any>;
2714
+ customDataProxyFetch?: CustomDataProxyFetch;
2726
2715
  };
2727
2716
 
2728
2717
  declare type RequiredExtensionArgs = NameArgs & ResultArgs & ModelArgs & ClientArgs & QueryOptions;