@prisma/client-engine-runtime 6.9.0-dev.3 → 6.9.0-dev.31

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;
@@ -85,6 +92,7 @@ export type JoinExpression = {
85
92
  child: QueryPlanNode;
86
93
  on: [left: string, right: string][];
87
94
  parentField: string;
95
+ isRelationUnique: boolean;
88
96
  };
89
97
  export type QueryPlanNode = {
90
98
  type: 'seq';
@@ -169,6 +177,24 @@ export type QueryPlanNode = {
169
177
  from: QueryPlanNode;
170
178
  to: QueryPlanNode;
171
179
  };
180
+ } | {
181
+ type: 'distinctBy';
182
+ args: {
183
+ expr: QueryPlanNode;
184
+ fields: string[];
185
+ };
186
+ } | {
187
+ type: 'paginate';
188
+ args: {
189
+ expr: QueryPlanNode;
190
+ pagination: Pagination;
191
+ };
192
+ };
193
+ export type Pagination = {
194
+ cursor: Record<string, PrismaValue> | null;
195
+ take: number | null;
196
+ skip: number | null;
197
+ linkingFields: string[] | null;
172
198
  };
173
199
  export type DataRule = {
174
200
  type: 'rowCountEq';
@@ -176,6 +202,9 @@ export type DataRule = {
176
202
  } | {
177
203
  type: 'rowCountNeq';
178
204
  args: number;
205
+ } | {
206
+ type: 'affectedRowCountEq';
207
+ args: number;
179
208
  } | {
180
209
  type: 'never';
181
210
  };
@@ -205,6 +234,13 @@ export type ValidationError = {
205
234
  context: {
206
235
  expectedRows: number;
207
236
  };
237
+ } | {
238
+ error_identifier: 'INCOMPLETE_CONNECT_OUTPUT';
239
+ context: {
240
+ expectedRows: number;
241
+ relation: string;
242
+ relationType: string;
243
+ };
208
244
  } | {
209
245
  error_identifier: 'RECORDS_NOT_CONNECTED';
210
246
  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,6 +270,18 @@ 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
+ };
236
285
  };
237
286
 
238
287
  export declare type ResultNode = {
@@ -245,6 +294,12 @@ export declare type ResultNode = {
245
294
  resultType: PrismaValueType;
246
295
  };
247
296
 
297
+ /**
298
+ * `JSON.stringify` wrapper with custom replacer function that handles nested
299
+ * BigInt and Uint8Array values.
300
+ */
301
+ export declare function safeJsonStringify(obj: unknown): string;
302
+
248
303
  declare type SpanCallback<R> = (span?: Span, context?: Context) => R;
249
304
 
250
305
  export declare interface TracingHelper {
@@ -262,10 +317,11 @@ export declare class TransactionManager {
262
317
  private readonly driverAdapter;
263
318
  private readonly transactionOptions;
264
319
  private readonly tracingHelper;
265
- constructor({ driverAdapter, transactionOptions, tracingHelper, }: {
320
+ constructor({ driverAdapter, transactionOptions, tracingHelper, onQuery, }: {
266
321
  driverAdapter: SqlDriverAdapter;
267
322
  transactionOptions: TransactionOptions;
268
323
  tracingHelper: TracingHelper;
324
+ onQuery?: (event: QueryEvent) => void;
269
325
  });
270
326
  startTransaction(options?: TransactionOptions): Promise<TransactionInfo>;
271
327
  commitTransaction(transactionId: string): Promise<void>;
@@ -278,10 +334,9 @@ export declare class TransactionManager {
278
334
  private validateOptions;
279
335
  }
280
336
 
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);
337
+ export declare class TransactionManagerError extends UserFacingError {
338
+ name: string;
339
+ constructor(message: string, meta?: Record<string, unknown>);
285
340
  }
286
341
 
287
342
  export declare type TransactionOptions = {
@@ -293,14 +348,14 @@ export declare type TransactionOptions = {
293
348
  export declare class UserFacingError extends Error {
294
349
  name: string;
295
350
  code: string;
296
- meta: unknown;
297
- constructor(message: string, code: string, meta?: unknown);
351
+ meta: Record<string, unknown>;
352
+ constructor(message: string, code: string, meta?: Record<string, unknown>);
298
353
  toQueryResponseErrorObject(): {
299
354
  error: string;
300
355
  user_facing_error: {
301
356
  is_panic: boolean;
302
357
  message: string;
303
- meta: unknown;
358
+ meta: Record<string, unknown>;
304
359
  error_code: string;
305
360
  };
306
361
  };
@@ -332,6 +387,13 @@ export declare type ValidationError = {
332
387
  context: {
333
388
  expectedRows: number;
334
389
  };
390
+ } | {
391
+ error_identifier: 'INCOMPLETE_CONNECT_OUTPUT';
392
+ context: {
393
+ expectedRows: number;
394
+ relation: string;
395
+ relationType: string;
396
+ };
335
397
  } | {
336
398
  error_identifier: 'RECORDS_NOT_CONNECTED';
337
399
  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,6 +270,18 @@ 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
+ };
236
285
  };
237
286
 
238
287
  export declare type ResultNode = {
@@ -245,6 +294,12 @@ export declare type ResultNode = {
245
294
  resultType: PrismaValueType;
246
295
  };
247
296
 
297
+ /**
298
+ * `JSON.stringify` wrapper with custom replacer function that handles nested
299
+ * BigInt and Uint8Array values.
300
+ */
301
+ export declare function safeJsonStringify(obj: unknown): string;
302
+
248
303
  declare type SpanCallback<R> = (span?: Span, context?: Context) => R;
249
304
 
250
305
  export declare interface TracingHelper {
@@ -262,10 +317,11 @@ export declare class TransactionManager {
262
317
  private readonly driverAdapter;
263
318
  private readonly transactionOptions;
264
319
  private readonly tracingHelper;
265
- constructor({ driverAdapter, transactionOptions, tracingHelper, }: {
320
+ constructor({ driverAdapter, transactionOptions, tracingHelper, onQuery, }: {
266
321
  driverAdapter: SqlDriverAdapter;
267
322
  transactionOptions: TransactionOptions;
268
323
  tracingHelper: TracingHelper;
324
+ onQuery?: (event: QueryEvent) => void;
269
325
  });
270
326
  startTransaction(options?: TransactionOptions): Promise<TransactionInfo>;
271
327
  commitTransaction(transactionId: string): Promise<void>;
@@ -278,10 +334,9 @@ export declare class TransactionManager {
278
334
  private validateOptions;
279
335
  }
280
336
 
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);
337
+ export declare class TransactionManagerError extends UserFacingError {
338
+ name: string;
339
+ constructor(message: string, meta?: Record<string, unknown>);
285
340
  }
286
341
 
287
342
  export declare type TransactionOptions = {
@@ -293,14 +348,14 @@ export declare type TransactionOptions = {
293
348
  export declare class UserFacingError extends Error {
294
349
  name: string;
295
350
  code: string;
296
- meta: unknown;
297
- constructor(message: string, code: string, meta?: unknown);
351
+ meta: Record<string, unknown>;
352
+ constructor(message: string, code: string, meta?: Record<string, unknown>);
298
353
  toQueryResponseErrorObject(): {
299
354
  error: string;
300
355
  user_facing_error: {
301
356
  is_panic: boolean;
302
357
  message: string;
303
- meta: unknown;
358
+ meta: Record<string, unknown>;
304
359
  error_code: string;
305
360
  };
306
361
  };
@@ -332,6 +387,13 @@ export declare type ValidationError = {
332
387
  context: {
333
388
  expectedRows: number;
334
389
  };
390
+ } | {
391
+ error_identifier: 'INCOMPLETE_CONNECT_OUTPUT';
392
+ context: {
393
+ expectedRows: number;
394
+ relation: string;
395
+ relationType: string;
396
+ };
335
397
  } | {
336
398
  error_identifier: 'RECORDS_NOT_CONNECTED';
337
399
  context: {