@prisma/client-engine-runtime 6.9.0-dev.4 → 6.9.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.
@@ -19,7 +19,12 @@ export type PrismaValueBytes = {
19
19
  prisma__value: string;
20
20
  };
21
21
  export declare function isPrismaValueBytes(value: unknown): value is PrismaValueBytes;
22
- export type PrismaValue = string | boolean | number | PrismaValue[] | null | Record<string, unknown> | PrismaValuePlaceholder | PrismaValueGenerator | PrismaValueBytes;
22
+ export type PrismaValueBigInt = {
23
+ prisma__type: 'bigint';
24
+ prisma__value: string;
25
+ };
26
+ export declare function isPrismaValueBigInt(value: unknown): value is PrismaValueBigInt;
27
+ export type PrismaValue = string | boolean | number | PrismaValue[] | null | Record<string, unknown> | PrismaValuePlaceholder | PrismaValueGenerator | PrismaValueBytes | PrismaValueBigInt;
23
28
  export type PrismaValueType = {
24
29
  type: 'Any';
25
30
  } | {
@@ -36,6 +41,8 @@ export type PrismaValueType = {
36
41
  type: 'Decimal';
37
42
  } | {
38
43
  type: 'Date';
44
+ } | {
45
+ type: 'Time';
39
46
  } | {
40
47
  type: 'Array';
41
48
  inner: PrismaValueType;
@@ -45,6 +52,8 @@ export type PrismaValueType = {
45
52
  type: 'Bytes';
46
53
  };
47
54
  export type ResultNode = {
55
+ type: 'AffectedRows';
56
+ } | {
48
57
  type: 'Object';
49
58
  fields: Record<string, ResultNode>;
50
59
  flattened: boolean;
@@ -85,6 +94,7 @@ export type JoinExpression = {
85
94
  child: QueryPlanNode;
86
95
  on: [left: string, right: string][];
87
96
  parentField: string;
97
+ isRelationUnique: boolean;
88
98
  };
89
99
  export type QueryPlanNode = {
90
100
  type: 'seq';
@@ -169,6 +179,35 @@ export type QueryPlanNode = {
169
179
  from: QueryPlanNode;
170
180
  to: QueryPlanNode;
171
181
  };
182
+ } | {
183
+ type: 'distinctBy';
184
+ args: {
185
+ expr: QueryPlanNode;
186
+ fields: string[];
187
+ };
188
+ } | {
189
+ type: 'paginate';
190
+ args: {
191
+ expr: QueryPlanNode;
192
+ pagination: Pagination;
193
+ };
194
+ } | {
195
+ type: 'extendRecord';
196
+ args: {
197
+ expr: QueryPlanNode;
198
+ values: Record<string, {
199
+ type: 'value';
200
+ value: PrismaValue;
201
+ } | {
202
+ type: 'lastInsertId';
203
+ }>;
204
+ };
205
+ };
206
+ export type Pagination = {
207
+ cursor: Record<string, PrismaValue> | null;
208
+ take: number | null;
209
+ skip: number | null;
210
+ linkingFields: string[] | null;
172
211
  };
173
212
  export type DataRule = {
174
213
  type: 'rowCountEq';
@@ -176,6 +215,9 @@ export type DataRule = {
176
215
  } | {
177
216
  type: 'rowCountNeq';
178
217
  args: number;
218
+ } | {
219
+ type: 'affectedRowCountEq';
220
+ args: number;
179
221
  } | {
180
222
  type: 'never';
181
223
  };
@@ -205,6 +247,13 @@ export type ValidationError = {
205
247
  context: {
206
248
  expectedRows: number;
207
249
  };
250
+ } | {
251
+ error_identifier: 'INCOMPLETE_CONNECT_OUTPUT';
252
+ context: {
253
+ expectedRows: number;
254
+ relation: string;
255
+ relationType: string;
256
+ };
208
257
  } | {
209
258
  error_identifier: 'RECORDS_NOT_CONNECTED';
210
259
  context: {
@@ -1,14 +1,14 @@
1
1
  export declare class UserFacingError extends Error {
2
2
  name: string;
3
3
  code: string;
4
- meta: unknown;
5
- constructor(message: string, code: string, meta?: unknown);
4
+ meta: Record<string, unknown>;
5
+ constructor(message: string, code: string, meta?: Record<string, unknown>);
6
6
  toQueryResponseErrorObject(): {
7
7
  error: string;
8
8
  user_facing_error: {
9
9
  is_panic: boolean;
10
10
  message: string;
11
- meta: unknown;
11
+ meta: Record<string, unknown>;
12
12
  error_code: string;
13
13
  };
14
14
  };
package/dist/index.d.mts CHANGED
@@ -1,22 +1,36 @@
1
- import type { Context } from '@opentelemetry/api';
1
+ import { Context } from '@opentelemetry/api';
2
2
  import type { IsolationLevel } from '@prisma/driver-adapter-utils';
3
- import type { Span } from '@opentelemetry/api';
4
- import type { SpanOptions } from '@opentelemetry/api';
3
+ import { Span } from '@opentelemetry/api';
4
+ import { SpanOptions } from '@opentelemetry/api';
5
5
  import { SqlDriverAdapter } from '@prisma/driver-adapter-utils';
6
6
  import { SqlQueryable } from '@prisma/driver-adapter-utils';
7
7
  import { SqlResultSet } from '@prisma/driver-adapter-utils';
8
8
  import { Transaction } from '@prisma/driver-adapter-utils';
9
9
 
10
+ export declare class DataMapperError extends Error {
11
+ name: string;
12
+ }
13
+
10
14
  export declare type DataRule = {
11
15
  type: 'rowCountEq';
12
16
  args: number;
13
17
  } | {
14
18
  type: 'rowCountNeq';
15
19
  args: number;
20
+ } | {
21
+ type: 'affectedRowCountEq';
22
+ args: number;
16
23
  } | {
17
24
  type: 'never';
18
25
  };
19
26
 
27
+ /**
28
+ * Checks if two objects representing the names and values of key columns match. A match is
29
+ * defined by one of the sets of keys being a subset of the other. This function also
30
+ * converts arguments to the types used by driver adapters if necessary.
31
+ */
32
+ export declare function doKeysMatch(lhs: {}, rhs: {}): boolean;
33
+
20
34
  declare type ExtendedSpanOptions = SpanOptions & {
21
35
  name: string;
22
36
  };
@@ -32,6 +46,13 @@ export declare type Fragment = {
32
46
  type: 'parameterTupleList';
33
47
  };
34
48
 
49
+ /**
50
+ * Checks if two objects are deeply equal, recursively checking all properties for strict equality.
51
+ */
52
+ export declare function isDeepStrictEqual(a: unknown, b: unknown): boolean;
53
+
54
+ export declare function isPrismaValueBigInt(value: unknown): value is PrismaValueBigInt;
55
+
35
56
  export declare function isPrismaValueBytes(value: unknown): value is PrismaValueBytes;
36
57
 
37
58
  export declare function isPrismaValueGenerator(value: unknown): value is PrismaValueGenerator;
@@ -42,16 +63,29 @@ export declare type JoinExpression = {
42
63
  child: QueryPlanNode;
43
64
  on: [left: string, right: string][];
44
65
  parentField: string;
66
+ isRelationUnique: boolean;
45
67
  };
46
68
 
47
69
  export declare const noopTracingHelper: TracingHelper;
48
70
 
71
+ export declare type Pagination = {
72
+ cursor: Record<string, PrismaValue> | null;
73
+ take: number | null;
74
+ skip: number | null;
75
+ linkingFields: string[] | null;
76
+ };
77
+
49
78
  export declare interface PlaceholderFormat {
50
79
  prefix: string;
51
80
  hasNumbering: boolean;
52
81
  }
53
82
 
54
- export declare type PrismaValue = string | boolean | number | PrismaValue[] | null | Record<string, unknown> | PrismaValuePlaceholder | PrismaValueGenerator | PrismaValueBytes;
83
+ export declare type PrismaValue = string | boolean | number | PrismaValue[] | null | Record<string, unknown> | PrismaValuePlaceholder | PrismaValueGenerator | PrismaValueBytes | PrismaValueBigInt;
84
+
85
+ export declare type PrismaValueBigInt = {
86
+ prisma__type: 'bigint';
87
+ prisma__value: string;
88
+ };
55
89
 
56
90
  export declare type PrismaValueBytes = {
57
91
  prisma__type: 'bytes';
@@ -90,6 +124,8 @@ export declare type PrismaValueType = {
90
124
  type: 'Decimal';
91
125
  } | {
92
126
  type: 'Date';
127
+ } | {
128
+ type: 'Time';
93
129
  } | {
94
130
  type: 'Array';
95
131
  inner: PrismaValueType;
@@ -108,7 +144,7 @@ export declare type QueryEvent = {
108
144
 
109
145
  export declare class QueryInterpreter {
110
146
  #private;
111
- constructor({ transactionManager, placeholderValues, onQuery, tracingHelper, serializer }: QueryInterpreterOptions);
147
+ constructor({ transactionManager, placeholderValues, onQuery, tracingHelper, serializer, rawSerializer, }: QueryInterpreterOptions);
112
148
  static forSql(options: {
113
149
  transactionManager: QueryInterpreterTransactionManager;
114
150
  placeholderValues: Record<string, unknown>;
@@ -125,6 +161,7 @@ export declare type QueryInterpreterOptions = {
125
161
  onQuery?: (event: QueryEvent) => void;
126
162
  tracingHelper: TracingHelper;
127
163
  serializer: (results: SqlResultSet) => Value;
164
+ rawSerializer?: (results: SqlResultSet) => Value;
128
165
  };
129
166
 
130
167
  export declare type QueryInterpreterTransactionManager = {
@@ -233,9 +270,34 @@ export declare type QueryPlanNode = {
233
270
  from: QueryPlanNode;
234
271
  to: QueryPlanNode;
235
272
  };
273
+ } | {
274
+ type: 'distinctBy';
275
+ args: {
276
+ expr: QueryPlanNode;
277
+ fields: string[];
278
+ };
279
+ } | {
280
+ type: 'paginate';
281
+ args: {
282
+ expr: QueryPlanNode;
283
+ pagination: Pagination;
284
+ };
285
+ } | {
286
+ type: 'extendRecord';
287
+ args: {
288
+ expr: QueryPlanNode;
289
+ values: Record<string, {
290
+ type: 'value';
291
+ value: PrismaValue;
292
+ } | {
293
+ type: 'lastInsertId';
294
+ }>;
295
+ };
236
296
  };
237
297
 
238
298
  export declare type ResultNode = {
299
+ type: 'AffectedRows';
300
+ } | {
239
301
  type: 'Object';
240
302
  fields: Record<string, ResultNode>;
241
303
  flattened: boolean;
@@ -245,6 +307,12 @@ export declare type ResultNode = {
245
307
  resultType: PrismaValueType;
246
308
  };
247
309
 
310
+ /**
311
+ * `JSON.stringify` wrapper with custom replacer function that handles nested
312
+ * BigInt and Uint8Array values.
313
+ */
314
+ export declare function safeJsonStringify(obj: unknown): string;
315
+
248
316
  declare type SpanCallback<R> = (span?: Span, context?: Context) => R;
249
317
 
250
318
  export declare interface TracingHelper {
@@ -262,10 +330,11 @@ export declare class TransactionManager {
262
330
  private readonly driverAdapter;
263
331
  private readonly transactionOptions;
264
332
  private readonly tracingHelper;
265
- constructor({ driverAdapter, transactionOptions, tracingHelper, }: {
333
+ constructor({ driverAdapter, transactionOptions, tracingHelper, onQuery, }: {
266
334
  driverAdapter: SqlDriverAdapter;
267
335
  transactionOptions: TransactionOptions;
268
336
  tracingHelper: TracingHelper;
337
+ onQuery?: (event: QueryEvent) => void;
269
338
  });
270
339
  startTransaction(options?: TransactionOptions): Promise<TransactionInfo>;
271
340
  commitTransaction(transactionId: string): Promise<void>;
@@ -278,10 +347,9 @@ export declare class TransactionManager {
278
347
  private validateOptions;
279
348
  }
280
349
 
281
- export declare class TransactionManagerError extends Error {
282
- meta?: Record<string, unknown> | undefined;
283
- code: string;
284
- constructor(message: string, meta?: Record<string, unknown> | undefined);
350
+ export declare class TransactionManagerError extends UserFacingError {
351
+ name: string;
352
+ constructor(message: string, meta?: Record<string, unknown>);
285
353
  }
286
354
 
287
355
  export declare type TransactionOptions = {
@@ -293,14 +361,14 @@ export declare type TransactionOptions = {
293
361
  export declare class UserFacingError extends Error {
294
362
  name: string;
295
363
  code: string;
296
- meta: unknown;
297
- constructor(message: string, code: string, meta?: unknown);
364
+ meta: Record<string, unknown>;
365
+ constructor(message: string, code: string, meta?: Record<string, unknown>);
298
366
  toQueryResponseErrorObject(): {
299
367
  error: string;
300
368
  user_facing_error: {
301
369
  is_panic: boolean;
302
370
  message: string;
303
- meta: unknown;
371
+ meta: Record<string, unknown>;
304
372
  error_code: string;
305
373
  };
306
374
  };
@@ -332,6 +400,13 @@ export declare type ValidationError = {
332
400
  context: {
333
401
  expectedRows: number;
334
402
  };
403
+ } | {
404
+ error_identifier: 'INCOMPLETE_CONNECT_OUTPUT';
405
+ context: {
406
+ expectedRows: number;
407
+ relation: string;
408
+ relationType: string;
409
+ };
335
410
  } | {
336
411
  error_identifier: 'RECORDS_NOT_CONNECTED';
337
412
  context: {
package/dist/index.d.ts CHANGED
@@ -1,22 +1,36 @@
1
- import type { Context } from '@opentelemetry/api';
1
+ import { Context } from '@opentelemetry/api';
2
2
  import type { IsolationLevel } from '@prisma/driver-adapter-utils';
3
- import type { Span } from '@opentelemetry/api';
4
- import type { SpanOptions } from '@opentelemetry/api';
3
+ import { Span } from '@opentelemetry/api';
4
+ import { SpanOptions } from '@opentelemetry/api';
5
5
  import { SqlDriverAdapter } from '@prisma/driver-adapter-utils';
6
6
  import { SqlQueryable } from '@prisma/driver-adapter-utils';
7
7
  import { SqlResultSet } from '@prisma/driver-adapter-utils';
8
8
  import { Transaction } from '@prisma/driver-adapter-utils';
9
9
 
10
+ export declare class DataMapperError extends Error {
11
+ name: string;
12
+ }
13
+
10
14
  export declare type DataRule = {
11
15
  type: 'rowCountEq';
12
16
  args: number;
13
17
  } | {
14
18
  type: 'rowCountNeq';
15
19
  args: number;
20
+ } | {
21
+ type: 'affectedRowCountEq';
22
+ args: number;
16
23
  } | {
17
24
  type: 'never';
18
25
  };
19
26
 
27
+ /**
28
+ * Checks if two objects representing the names and values of key columns match. A match is
29
+ * defined by one of the sets of keys being a subset of the other. This function also
30
+ * converts arguments to the types used by driver adapters if necessary.
31
+ */
32
+ export declare function doKeysMatch(lhs: {}, rhs: {}): boolean;
33
+
20
34
  declare type ExtendedSpanOptions = SpanOptions & {
21
35
  name: string;
22
36
  };
@@ -32,6 +46,13 @@ export declare type Fragment = {
32
46
  type: 'parameterTupleList';
33
47
  };
34
48
 
49
+ /**
50
+ * Checks if two objects are deeply equal, recursively checking all properties for strict equality.
51
+ */
52
+ export declare function isDeepStrictEqual(a: unknown, b: unknown): boolean;
53
+
54
+ export declare function isPrismaValueBigInt(value: unknown): value is PrismaValueBigInt;
55
+
35
56
  export declare function isPrismaValueBytes(value: unknown): value is PrismaValueBytes;
36
57
 
37
58
  export declare function isPrismaValueGenerator(value: unknown): value is PrismaValueGenerator;
@@ -42,16 +63,29 @@ export declare type JoinExpression = {
42
63
  child: QueryPlanNode;
43
64
  on: [left: string, right: string][];
44
65
  parentField: string;
66
+ isRelationUnique: boolean;
45
67
  };
46
68
 
47
69
  export declare const noopTracingHelper: TracingHelper;
48
70
 
71
+ export declare type Pagination = {
72
+ cursor: Record<string, PrismaValue> | null;
73
+ take: number | null;
74
+ skip: number | null;
75
+ linkingFields: string[] | null;
76
+ };
77
+
49
78
  export declare interface PlaceholderFormat {
50
79
  prefix: string;
51
80
  hasNumbering: boolean;
52
81
  }
53
82
 
54
- export declare type PrismaValue = string | boolean | number | PrismaValue[] | null | Record<string, unknown> | PrismaValuePlaceholder | PrismaValueGenerator | PrismaValueBytes;
83
+ export declare type PrismaValue = string | boolean | number | PrismaValue[] | null | Record<string, unknown> | PrismaValuePlaceholder | PrismaValueGenerator | PrismaValueBytes | PrismaValueBigInt;
84
+
85
+ export declare type PrismaValueBigInt = {
86
+ prisma__type: 'bigint';
87
+ prisma__value: string;
88
+ };
55
89
 
56
90
  export declare type PrismaValueBytes = {
57
91
  prisma__type: 'bytes';
@@ -90,6 +124,8 @@ export declare type PrismaValueType = {
90
124
  type: 'Decimal';
91
125
  } | {
92
126
  type: 'Date';
127
+ } | {
128
+ type: 'Time';
93
129
  } | {
94
130
  type: 'Array';
95
131
  inner: PrismaValueType;
@@ -108,7 +144,7 @@ export declare type QueryEvent = {
108
144
 
109
145
  export declare class QueryInterpreter {
110
146
  #private;
111
- constructor({ transactionManager, placeholderValues, onQuery, tracingHelper, serializer }: QueryInterpreterOptions);
147
+ constructor({ transactionManager, placeholderValues, onQuery, tracingHelper, serializer, rawSerializer, }: QueryInterpreterOptions);
112
148
  static forSql(options: {
113
149
  transactionManager: QueryInterpreterTransactionManager;
114
150
  placeholderValues: Record<string, unknown>;
@@ -125,6 +161,7 @@ export declare type QueryInterpreterOptions = {
125
161
  onQuery?: (event: QueryEvent) => void;
126
162
  tracingHelper: TracingHelper;
127
163
  serializer: (results: SqlResultSet) => Value;
164
+ rawSerializer?: (results: SqlResultSet) => Value;
128
165
  };
129
166
 
130
167
  export declare type QueryInterpreterTransactionManager = {
@@ -233,9 +270,34 @@ export declare type QueryPlanNode = {
233
270
  from: QueryPlanNode;
234
271
  to: QueryPlanNode;
235
272
  };
273
+ } | {
274
+ type: 'distinctBy';
275
+ args: {
276
+ expr: QueryPlanNode;
277
+ fields: string[];
278
+ };
279
+ } | {
280
+ type: 'paginate';
281
+ args: {
282
+ expr: QueryPlanNode;
283
+ pagination: Pagination;
284
+ };
285
+ } | {
286
+ type: 'extendRecord';
287
+ args: {
288
+ expr: QueryPlanNode;
289
+ values: Record<string, {
290
+ type: 'value';
291
+ value: PrismaValue;
292
+ } | {
293
+ type: 'lastInsertId';
294
+ }>;
295
+ };
236
296
  };
237
297
 
238
298
  export declare type ResultNode = {
299
+ type: 'AffectedRows';
300
+ } | {
239
301
  type: 'Object';
240
302
  fields: Record<string, ResultNode>;
241
303
  flattened: boolean;
@@ -245,6 +307,12 @@ export declare type ResultNode = {
245
307
  resultType: PrismaValueType;
246
308
  };
247
309
 
310
+ /**
311
+ * `JSON.stringify` wrapper with custom replacer function that handles nested
312
+ * BigInt and Uint8Array values.
313
+ */
314
+ export declare function safeJsonStringify(obj: unknown): string;
315
+
248
316
  declare type SpanCallback<R> = (span?: Span, context?: Context) => R;
249
317
 
250
318
  export declare interface TracingHelper {
@@ -262,10 +330,11 @@ export declare class TransactionManager {
262
330
  private readonly driverAdapter;
263
331
  private readonly transactionOptions;
264
332
  private readonly tracingHelper;
265
- constructor({ driverAdapter, transactionOptions, tracingHelper, }: {
333
+ constructor({ driverAdapter, transactionOptions, tracingHelper, onQuery, }: {
266
334
  driverAdapter: SqlDriverAdapter;
267
335
  transactionOptions: TransactionOptions;
268
336
  tracingHelper: TracingHelper;
337
+ onQuery?: (event: QueryEvent) => void;
269
338
  });
270
339
  startTransaction(options?: TransactionOptions): Promise<TransactionInfo>;
271
340
  commitTransaction(transactionId: string): Promise<void>;
@@ -278,10 +347,9 @@ export declare class TransactionManager {
278
347
  private validateOptions;
279
348
  }
280
349
 
281
- export declare class TransactionManagerError extends Error {
282
- meta?: Record<string, unknown> | undefined;
283
- code: string;
284
- constructor(message: string, meta?: Record<string, unknown> | undefined);
350
+ export declare class TransactionManagerError extends UserFacingError {
351
+ name: string;
352
+ constructor(message: string, meta?: Record<string, unknown>);
285
353
  }
286
354
 
287
355
  export declare type TransactionOptions = {
@@ -293,14 +361,14 @@ export declare type TransactionOptions = {
293
361
  export declare class UserFacingError extends Error {
294
362
  name: string;
295
363
  code: string;
296
- meta: unknown;
297
- constructor(message: string, code: string, meta?: unknown);
364
+ meta: Record<string, unknown>;
365
+ constructor(message: string, code: string, meta?: Record<string, unknown>);
298
366
  toQueryResponseErrorObject(): {
299
367
  error: string;
300
368
  user_facing_error: {
301
369
  is_panic: boolean;
302
370
  message: string;
303
- meta: unknown;
371
+ meta: Record<string, unknown>;
304
372
  error_code: string;
305
373
  };
306
374
  };
@@ -332,6 +400,13 @@ export declare type ValidationError = {
332
400
  context: {
333
401
  expectedRows: number;
334
402
  };
403
+ } | {
404
+ error_identifier: 'INCOMPLETE_CONNECT_OUTPUT';
405
+ context: {
406
+ expectedRows: number;
407
+ relation: string;
408
+ relationType: string;
409
+ };
335
410
  } | {
336
411
  error_identifier: 'RECORDS_NOT_CONNECTED';
337
412
  context: {