@prisma/client-engine-runtime 6.14.0-dev.4 → 6.14.0-dev.41

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.
@@ -0,0 +1,19 @@
1
+ import { QueryPlanNode } from './query-plan';
2
+ export type BatchResponse = MultiBatchResponse | CompactedBatchResponse;
3
+ export type MultiBatchResponse = {
4
+ type: 'multi';
5
+ plans: QueryPlanNode[];
6
+ };
7
+ export type CompactedBatchResponse = {
8
+ type: 'compacted';
9
+ plan: QueryPlanNode;
10
+ arguments: Record<string, {}>[];
11
+ nestedSelection: string[];
12
+ keys: string[];
13
+ expectNonEmpty: boolean;
14
+ };
15
+ /**
16
+ * Converts the result of a compacted query back to result objects analogous to what queries
17
+ * would return when executed individually.
18
+ */
19
+ export declare function convertCompactedRows(rows: {}[], compiledBatch: CompactedBatchResponse): unknown[];
package/dist/index.d.mts CHANGED
@@ -1,4 +1,6 @@
1
+ import { ConnectionInfo } from '@prisma/driver-adapter-utils';
1
2
  import { Context } from '@opentelemetry/api';
3
+ import { Decimal } from 'decimal.js';
2
4
  import type { IsolationLevel } from '@prisma/driver-adapter-utils';
3
5
  import { Span } from '@opentelemetry/api';
4
6
  import { SpanOptions } from '@opentelemetry/api';
@@ -7,6 +9,8 @@ import { SqlQueryable } from '@prisma/driver-adapter-utils';
7
9
  import { SqlResultSet } from '@prisma/driver-adapter-utils';
8
10
  import { Transaction } from '@prisma/driver-adapter-utils';
9
11
 
12
+ export declare type BatchResponse = MultiBatchResponse | CompactedBatchResponse;
13
+
10
14
  export declare type BigIntTaggedValue = {
11
15
  $type: 'BigInt';
12
16
  value: string;
@@ -17,6 +21,21 @@ export declare type BytesTaggedValue = {
17
21
  value: string;
18
22
  };
19
23
 
24
+ export declare type CompactedBatchResponse = {
25
+ type: 'compacted';
26
+ plan: QueryPlanNode;
27
+ arguments: Record<string, {}>[];
28
+ nestedSelection: string[];
29
+ keys: string[];
30
+ expectNonEmpty: boolean;
31
+ };
32
+
33
+ /**
34
+ * Converts the result of a compacted query back to result objects analogous to what queries
35
+ * would return when executed individually.
36
+ */
37
+ export declare function convertCompactedRows(rows: {}[], compiledBatch: CompactedBatchResponse): unknown[];
38
+
20
39
  export declare class DataMapperError extends Error {
21
40
  name: string;
22
41
  }
@@ -44,6 +63,8 @@ export declare type DecimalTaggedValue = {
44
63
  value: string;
45
64
  };
46
65
 
66
+ export declare function deserializeJsonResponse(result: unknown): unknown;
67
+
47
68
  /**
48
69
  * Checks if two objects representing the names and values of key columns match. A match is
49
70
  * defined by one of the sets of keys being a subset of the other. This function also
@@ -106,6 +127,14 @@ export declare type Fragment = {
106
127
  groupSeparator: string;
107
128
  };
108
129
 
130
+ export declare type InMemoryOps = {
131
+ pagination: Pagination | null;
132
+ distinct: string[] | null;
133
+ reverse: boolean;
134
+ linkingFields: string[] | null;
135
+ nested: Record<string, InMemoryOps>;
136
+ };
137
+
109
138
  /**
110
139
  * Checks if two objects are deeply equal, recursively checking all properties for strict equality.
111
140
  */
@@ -135,15 +164,25 @@ export declare type JsonTaggedValue = {
135
164
  value: string;
136
165
  };
137
166
 
167
+ export declare type JsOutputValue = null | string | number | boolean | bigint | Uint8Array | Date | Decimal | JsOutputValue[] | {
168
+ [key: string]: JsOutputValue;
169
+ };
170
+
171
+ export declare type MultiBatchResponse = {
172
+ type: 'multi';
173
+ plans: QueryPlanNode[];
174
+ };
175
+
138
176
  export declare const noopTracingHelper: TracingHelper;
139
177
 
140
178
  export declare function normalizeJsonProtocolValues(result: unknown): unknown;
141
179
 
180
+ export declare function normalizeRawJsonProtocolResponse(response: RawResponse): RawResponse;
181
+
142
182
  export declare type Pagination = {
143
183
  cursor: Record<string, PrismaValue> | null;
144
184
  take: number | null;
145
185
  skip: number | null;
146
- linkingFields: string[] | null;
147
186
  };
148
187
 
149
188
  export declare interface PlaceholderFormat {
@@ -200,6 +239,8 @@ export declare type PrismaValueType = {
200
239
  } | {
201
240
  type: 'Array';
202
241
  inner: PrismaValueType;
242
+ } | {
243
+ type: 'Json';
203
244
  } | {
204
245
  type: 'Object';
205
246
  } | {
@@ -218,13 +259,14 @@ export declare type QueryEvent = {
218
259
 
219
260
  export declare class QueryInterpreter {
220
261
  #private;
221
- constructor({ transactionManager, placeholderValues, onQuery, tracingHelper, serializer, rawSerializer, provider, }: QueryInterpreterOptions);
262
+ constructor({ transactionManager, placeholderValues, onQuery, tracingHelper, serializer, rawSerializer, provider, connectionInfo, }: QueryInterpreterOptions);
222
263
  static forSql(options: {
223
264
  transactionManager: QueryInterpreterTransactionManager;
224
265
  placeholderValues: Record<string, unknown>;
225
266
  onQuery?: (event: QueryEvent) => void;
226
267
  tracingHelper: TracingHelper;
227
268
  provider?: SchemaProvider;
269
+ connectionInfo?: ConnectionInfo;
228
270
  }): QueryInterpreter;
229
271
  run(queryPlan: QueryPlanNode, queryable: SqlQueryable): Promise<unknown>;
230
272
  private interpretNode;
@@ -238,6 +280,7 @@ export declare type QueryInterpreterOptions = {
238
280
  serializer: (results: SqlResultSet) => Value;
239
281
  rawSerializer?: (results: SqlResultSet) => Value;
240
282
  provider?: SchemaProvider;
283
+ connectionInfo?: ConnectionInfo;
241
284
  };
242
285
 
243
286
  export declare type QueryInterpreterTransactionManager = {
@@ -261,6 +304,7 @@ export declare type QueryPlanDbQuery = {
261
304
  fragments: Fragment[];
262
305
  placeholderFormat: PlaceholderFormat;
263
306
  params: PrismaValue[];
307
+ chunkable: boolean;
264
308
  };
265
309
 
266
310
  export declare type QueryPlanNode = {
@@ -350,18 +394,6 @@ export declare type QueryPlanNode = {
350
394
  from: QueryPlanNode;
351
395
  to: QueryPlanNode;
352
396
  };
353
- } | {
354
- type: 'distinctBy';
355
- args: {
356
- expr: QueryPlanNode;
357
- fields: string[];
358
- };
359
- } | {
360
- type: 'paginate';
361
- args: {
362
- expr: QueryPlanNode;
363
- pagination: Pagination;
364
- };
365
397
  } | {
366
398
  type: 'initializeRecord';
367
399
  args: {
@@ -374,6 +406,18 @@ export declare type QueryPlanNode = {
374
406
  expr: QueryPlanNode;
375
407
  fields: Record<string, FieldOperation>;
376
408
  };
409
+ } | {
410
+ type: 'process';
411
+ args: {
412
+ expr: QueryPlanNode;
413
+ operations: InMemoryOps;
414
+ };
415
+ };
416
+
417
+ export declare type RawResponse = {
418
+ columns: string[];
419
+ types: string[];
420
+ rows: unknown[][];
377
421
  };
378
422
 
379
423
  export declare type ResultNode = {
@@ -382,6 +426,7 @@ export declare type ResultNode = {
382
426
  type: 'Object';
383
427
  fields: Record<string, ResultNode>;
384
428
  serializedName: string | null;
429
+ skipNulls: boolean;
385
430
  } | {
386
431
  type: 'Value';
387
432
  dbName: string;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
+ import { ConnectionInfo } from '@prisma/driver-adapter-utils';
1
2
  import { Context } from '@opentelemetry/api';
3
+ import { Decimal } from 'decimal.js';
2
4
  import type { IsolationLevel } from '@prisma/driver-adapter-utils';
3
5
  import { Span } from '@opentelemetry/api';
4
6
  import { SpanOptions } from '@opentelemetry/api';
@@ -7,6 +9,8 @@ import { SqlQueryable } from '@prisma/driver-adapter-utils';
7
9
  import { SqlResultSet } from '@prisma/driver-adapter-utils';
8
10
  import { Transaction } from '@prisma/driver-adapter-utils';
9
11
 
12
+ export declare type BatchResponse = MultiBatchResponse | CompactedBatchResponse;
13
+
10
14
  export declare type BigIntTaggedValue = {
11
15
  $type: 'BigInt';
12
16
  value: string;
@@ -17,6 +21,21 @@ export declare type BytesTaggedValue = {
17
21
  value: string;
18
22
  };
19
23
 
24
+ export declare type CompactedBatchResponse = {
25
+ type: 'compacted';
26
+ plan: QueryPlanNode;
27
+ arguments: Record<string, {}>[];
28
+ nestedSelection: string[];
29
+ keys: string[];
30
+ expectNonEmpty: boolean;
31
+ };
32
+
33
+ /**
34
+ * Converts the result of a compacted query back to result objects analogous to what queries
35
+ * would return when executed individually.
36
+ */
37
+ export declare function convertCompactedRows(rows: {}[], compiledBatch: CompactedBatchResponse): unknown[];
38
+
20
39
  export declare class DataMapperError extends Error {
21
40
  name: string;
22
41
  }
@@ -44,6 +63,8 @@ export declare type DecimalTaggedValue = {
44
63
  value: string;
45
64
  };
46
65
 
66
+ export declare function deserializeJsonResponse(result: unknown): unknown;
67
+
47
68
  /**
48
69
  * Checks if two objects representing the names and values of key columns match. A match is
49
70
  * defined by one of the sets of keys being a subset of the other. This function also
@@ -106,6 +127,14 @@ export declare type Fragment = {
106
127
  groupSeparator: string;
107
128
  };
108
129
 
130
+ export declare type InMemoryOps = {
131
+ pagination: Pagination | null;
132
+ distinct: string[] | null;
133
+ reverse: boolean;
134
+ linkingFields: string[] | null;
135
+ nested: Record<string, InMemoryOps>;
136
+ };
137
+
109
138
  /**
110
139
  * Checks if two objects are deeply equal, recursively checking all properties for strict equality.
111
140
  */
@@ -135,15 +164,25 @@ export declare type JsonTaggedValue = {
135
164
  value: string;
136
165
  };
137
166
 
167
+ export declare type JsOutputValue = null | string | number | boolean | bigint | Uint8Array | Date | Decimal | JsOutputValue[] | {
168
+ [key: string]: JsOutputValue;
169
+ };
170
+
171
+ export declare type MultiBatchResponse = {
172
+ type: 'multi';
173
+ plans: QueryPlanNode[];
174
+ };
175
+
138
176
  export declare const noopTracingHelper: TracingHelper;
139
177
 
140
178
  export declare function normalizeJsonProtocolValues(result: unknown): unknown;
141
179
 
180
+ export declare function normalizeRawJsonProtocolResponse(response: RawResponse): RawResponse;
181
+
142
182
  export declare type Pagination = {
143
183
  cursor: Record<string, PrismaValue> | null;
144
184
  take: number | null;
145
185
  skip: number | null;
146
- linkingFields: string[] | null;
147
186
  };
148
187
 
149
188
  export declare interface PlaceholderFormat {
@@ -200,6 +239,8 @@ export declare type PrismaValueType = {
200
239
  } | {
201
240
  type: 'Array';
202
241
  inner: PrismaValueType;
242
+ } | {
243
+ type: 'Json';
203
244
  } | {
204
245
  type: 'Object';
205
246
  } | {
@@ -218,13 +259,14 @@ export declare type QueryEvent = {
218
259
 
219
260
  export declare class QueryInterpreter {
220
261
  #private;
221
- constructor({ transactionManager, placeholderValues, onQuery, tracingHelper, serializer, rawSerializer, provider, }: QueryInterpreterOptions);
262
+ constructor({ transactionManager, placeholderValues, onQuery, tracingHelper, serializer, rawSerializer, provider, connectionInfo, }: QueryInterpreterOptions);
222
263
  static forSql(options: {
223
264
  transactionManager: QueryInterpreterTransactionManager;
224
265
  placeholderValues: Record<string, unknown>;
225
266
  onQuery?: (event: QueryEvent) => void;
226
267
  tracingHelper: TracingHelper;
227
268
  provider?: SchemaProvider;
269
+ connectionInfo?: ConnectionInfo;
228
270
  }): QueryInterpreter;
229
271
  run(queryPlan: QueryPlanNode, queryable: SqlQueryable): Promise<unknown>;
230
272
  private interpretNode;
@@ -238,6 +280,7 @@ export declare type QueryInterpreterOptions = {
238
280
  serializer: (results: SqlResultSet) => Value;
239
281
  rawSerializer?: (results: SqlResultSet) => Value;
240
282
  provider?: SchemaProvider;
283
+ connectionInfo?: ConnectionInfo;
241
284
  };
242
285
 
243
286
  export declare type QueryInterpreterTransactionManager = {
@@ -261,6 +304,7 @@ export declare type QueryPlanDbQuery = {
261
304
  fragments: Fragment[];
262
305
  placeholderFormat: PlaceholderFormat;
263
306
  params: PrismaValue[];
307
+ chunkable: boolean;
264
308
  };
265
309
 
266
310
  export declare type QueryPlanNode = {
@@ -350,18 +394,6 @@ export declare type QueryPlanNode = {
350
394
  from: QueryPlanNode;
351
395
  to: QueryPlanNode;
352
396
  };
353
- } | {
354
- type: 'distinctBy';
355
- args: {
356
- expr: QueryPlanNode;
357
- fields: string[];
358
- };
359
- } | {
360
- type: 'paginate';
361
- args: {
362
- expr: QueryPlanNode;
363
- pagination: Pagination;
364
- };
365
397
  } | {
366
398
  type: 'initializeRecord';
367
399
  args: {
@@ -374,6 +406,18 @@ export declare type QueryPlanNode = {
374
406
  expr: QueryPlanNode;
375
407
  fields: Record<string, FieldOperation>;
376
408
  };
409
+ } | {
410
+ type: 'process';
411
+ args: {
412
+ expr: QueryPlanNode;
413
+ operations: InMemoryOps;
414
+ };
415
+ };
416
+
417
+ export declare type RawResponse = {
418
+ columns: string[];
419
+ types: string[];
420
+ rows: unknown[][];
377
421
  };
378
422
 
379
423
  export declare type ResultNode = {
@@ -382,6 +426,7 @@ export declare type ResultNode = {
382
426
  type: 'Object';
383
427
  fields: Record<string, ResultNode>;
384
428
  serializedName: string | null;
429
+ skipNulls: boolean;
385
430
  } | {
386
431
  type: 'Value';
387
432
  dbName: string;