@prisma/client-engine-runtime 6.9.0-dev.5 → 6.9.0-dev.51
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.
- package/dist/QueryPlan.d.ts +54 -1
- package/dist/UserFacingError.d.ts +3 -3
- package/dist/index.d.mts +92 -13
- package/dist/index.d.ts +92 -13
- package/dist/index.js +597 -187
- package/dist/index.mjs +591 -186
- package/dist/interpreter/DataMapper.d.ts +4 -1
- package/dist/interpreter/QueryInterpreter.d.ts +2 -1
- package/dist/interpreter/generators.d.ts +2 -1
- package/dist/interpreter/renderQuery.d.ts +2 -1
- package/dist/interpreter/serializeSql.d.ts +2 -1
- package/dist/tracing.d.ts +10 -2
- package/dist/transactionManager/TransactionManager.d.ts +3 -1
- package/dist/transactionManager/TransactionManagerErrors.d.ts +4 -4
- package/dist/utils.d.ts +15 -0
- package/package.json +3 -3
package/dist/QueryPlan.d.ts
CHANGED
|
@@ -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
|
|
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;
|
|
@@ -43,8 +50,13 @@ export type PrismaValueType = {
|
|
|
43
50
|
type: 'Object';
|
|
44
51
|
} | {
|
|
45
52
|
type: 'Bytes';
|
|
53
|
+
} | {
|
|
54
|
+
type: 'Enum';
|
|
55
|
+
inner: string;
|
|
46
56
|
};
|
|
47
57
|
export type ResultNode = {
|
|
58
|
+
type: 'AffectedRows';
|
|
59
|
+
} | {
|
|
48
60
|
type: 'Object';
|
|
49
61
|
fields: Record<string, ResultNode>;
|
|
50
62
|
flattened: boolean;
|
|
@@ -85,6 +97,7 @@ export type JoinExpression = {
|
|
|
85
97
|
child: QueryPlanNode;
|
|
86
98
|
on: [left: string, right: string][];
|
|
87
99
|
parentField: string;
|
|
100
|
+
isRelationUnique: boolean;
|
|
88
101
|
};
|
|
89
102
|
export type QueryPlanNode = {
|
|
90
103
|
type: 'seq';
|
|
@@ -146,6 +159,7 @@ export type QueryPlanNode = {
|
|
|
146
159
|
args: {
|
|
147
160
|
expr: QueryPlanNode;
|
|
148
161
|
structure: ResultNode;
|
|
162
|
+
enums: Record<string, Record<string, string>>;
|
|
149
163
|
};
|
|
150
164
|
} | {
|
|
151
165
|
type: 'validate';
|
|
@@ -169,6 +183,35 @@ export type QueryPlanNode = {
|
|
|
169
183
|
from: QueryPlanNode;
|
|
170
184
|
to: QueryPlanNode;
|
|
171
185
|
};
|
|
186
|
+
} | {
|
|
187
|
+
type: 'distinctBy';
|
|
188
|
+
args: {
|
|
189
|
+
expr: QueryPlanNode;
|
|
190
|
+
fields: string[];
|
|
191
|
+
};
|
|
192
|
+
} | {
|
|
193
|
+
type: 'paginate';
|
|
194
|
+
args: {
|
|
195
|
+
expr: QueryPlanNode;
|
|
196
|
+
pagination: Pagination;
|
|
197
|
+
};
|
|
198
|
+
} | {
|
|
199
|
+
type: 'extendRecord';
|
|
200
|
+
args: {
|
|
201
|
+
expr: QueryPlanNode;
|
|
202
|
+
values: Record<string, {
|
|
203
|
+
type: 'value';
|
|
204
|
+
value: PrismaValue;
|
|
205
|
+
} | {
|
|
206
|
+
type: 'lastInsertId';
|
|
207
|
+
}>;
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
export type Pagination = {
|
|
211
|
+
cursor: Record<string, PrismaValue> | null;
|
|
212
|
+
take: number | null;
|
|
213
|
+
skip: number | null;
|
|
214
|
+
linkingFields: string[] | null;
|
|
172
215
|
};
|
|
173
216
|
export type DataRule = {
|
|
174
217
|
type: 'rowCountEq';
|
|
@@ -176,6 +219,9 @@ export type DataRule = {
|
|
|
176
219
|
} | {
|
|
177
220
|
type: 'rowCountNeq';
|
|
178
221
|
args: number;
|
|
222
|
+
} | {
|
|
223
|
+
type: 'affectedRowCountEq';
|
|
224
|
+
args: number;
|
|
179
225
|
} | {
|
|
180
226
|
type: 'never';
|
|
181
227
|
};
|
|
@@ -205,6 +251,13 @@ export type ValidationError = {
|
|
|
205
251
|
context: {
|
|
206
252
|
expectedRows: number;
|
|
207
253
|
};
|
|
254
|
+
} | {
|
|
255
|
+
error_identifier: 'INCOMPLETE_CONNECT_OUTPUT';
|
|
256
|
+
context: {
|
|
257
|
+
expectedRows: number;
|
|
258
|
+
relation: string;
|
|
259
|
+
relationType: string;
|
|
260
|
+
};
|
|
208
261
|
} | {
|
|
209
262
|
error_identifier: 'RECORDS_NOT_CONNECTED';
|
|
210
263
|
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
|
|
1
|
+
import { Context } from '@opentelemetry/api';
|
|
2
2
|
import type { IsolationLevel } from '@prisma/driver-adapter-utils';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
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;
|
|
@@ -97,6 +133,9 @@ export declare type PrismaValueType = {
|
|
|
97
133
|
type: 'Object';
|
|
98
134
|
} | {
|
|
99
135
|
type: 'Bytes';
|
|
136
|
+
} | {
|
|
137
|
+
type: 'Enum';
|
|
138
|
+
inner: string;
|
|
100
139
|
};
|
|
101
140
|
|
|
102
141
|
export declare type QueryEvent = {
|
|
@@ -108,7 +147,7 @@ export declare type QueryEvent = {
|
|
|
108
147
|
|
|
109
148
|
export declare class QueryInterpreter {
|
|
110
149
|
#private;
|
|
111
|
-
constructor({ transactionManager, placeholderValues, onQuery, tracingHelper, serializer }: QueryInterpreterOptions);
|
|
150
|
+
constructor({ transactionManager, placeholderValues, onQuery, tracingHelper, serializer, rawSerializer, }: QueryInterpreterOptions);
|
|
112
151
|
static forSql(options: {
|
|
113
152
|
transactionManager: QueryInterpreterTransactionManager;
|
|
114
153
|
placeholderValues: Record<string, unknown>;
|
|
@@ -125,6 +164,7 @@ export declare type QueryInterpreterOptions = {
|
|
|
125
164
|
onQuery?: (event: QueryEvent) => void;
|
|
126
165
|
tracingHelper: TracingHelper;
|
|
127
166
|
serializer: (results: SqlResultSet) => Value;
|
|
167
|
+
rawSerializer?: (results: SqlResultSet) => Value;
|
|
128
168
|
};
|
|
129
169
|
|
|
130
170
|
export declare type QueryInterpreterTransactionManager = {
|
|
@@ -210,6 +250,7 @@ export declare type QueryPlanNode = {
|
|
|
210
250
|
args: {
|
|
211
251
|
expr: QueryPlanNode;
|
|
212
252
|
structure: ResultNode;
|
|
253
|
+
enums: Record<string, Record<string, string>>;
|
|
213
254
|
};
|
|
214
255
|
} | {
|
|
215
256
|
type: 'validate';
|
|
@@ -233,9 +274,34 @@ export declare type QueryPlanNode = {
|
|
|
233
274
|
from: QueryPlanNode;
|
|
234
275
|
to: QueryPlanNode;
|
|
235
276
|
};
|
|
277
|
+
} | {
|
|
278
|
+
type: 'distinctBy';
|
|
279
|
+
args: {
|
|
280
|
+
expr: QueryPlanNode;
|
|
281
|
+
fields: string[];
|
|
282
|
+
};
|
|
283
|
+
} | {
|
|
284
|
+
type: 'paginate';
|
|
285
|
+
args: {
|
|
286
|
+
expr: QueryPlanNode;
|
|
287
|
+
pagination: Pagination;
|
|
288
|
+
};
|
|
289
|
+
} | {
|
|
290
|
+
type: 'extendRecord';
|
|
291
|
+
args: {
|
|
292
|
+
expr: QueryPlanNode;
|
|
293
|
+
values: Record<string, {
|
|
294
|
+
type: 'value';
|
|
295
|
+
value: PrismaValue;
|
|
296
|
+
} | {
|
|
297
|
+
type: 'lastInsertId';
|
|
298
|
+
}>;
|
|
299
|
+
};
|
|
236
300
|
};
|
|
237
301
|
|
|
238
302
|
export declare type ResultNode = {
|
|
303
|
+
type: 'AffectedRows';
|
|
304
|
+
} | {
|
|
239
305
|
type: 'Object';
|
|
240
306
|
fields: Record<string, ResultNode>;
|
|
241
307
|
flattened: boolean;
|
|
@@ -245,6 +311,12 @@ export declare type ResultNode = {
|
|
|
245
311
|
resultType: PrismaValueType;
|
|
246
312
|
};
|
|
247
313
|
|
|
314
|
+
/**
|
|
315
|
+
* `JSON.stringify` wrapper with custom replacer function that handles nested
|
|
316
|
+
* BigInt and Uint8Array values.
|
|
317
|
+
*/
|
|
318
|
+
export declare function safeJsonStringify(obj: unknown): string;
|
|
319
|
+
|
|
248
320
|
declare type SpanCallback<R> = (span?: Span, context?: Context) => R;
|
|
249
321
|
|
|
250
322
|
export declare interface TracingHelper {
|
|
@@ -262,10 +334,11 @@ export declare class TransactionManager {
|
|
|
262
334
|
private readonly driverAdapter;
|
|
263
335
|
private readonly transactionOptions;
|
|
264
336
|
private readonly tracingHelper;
|
|
265
|
-
constructor({ driverAdapter, transactionOptions, tracingHelper, }: {
|
|
337
|
+
constructor({ driverAdapter, transactionOptions, tracingHelper, onQuery, }: {
|
|
266
338
|
driverAdapter: SqlDriverAdapter;
|
|
267
339
|
transactionOptions: TransactionOptions;
|
|
268
340
|
tracingHelper: TracingHelper;
|
|
341
|
+
onQuery?: (event: QueryEvent) => void;
|
|
269
342
|
});
|
|
270
343
|
startTransaction(options?: TransactionOptions): Promise<TransactionInfo>;
|
|
271
344
|
commitTransaction(transactionId: string): Promise<void>;
|
|
@@ -278,10 +351,9 @@ export declare class TransactionManager {
|
|
|
278
351
|
private validateOptions;
|
|
279
352
|
}
|
|
280
353
|
|
|
281
|
-
export declare class TransactionManagerError extends
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
constructor(message: string, meta?: Record<string, unknown> | undefined);
|
|
354
|
+
export declare class TransactionManagerError extends UserFacingError {
|
|
355
|
+
name: string;
|
|
356
|
+
constructor(message: string, meta?: Record<string, unknown>);
|
|
285
357
|
}
|
|
286
358
|
|
|
287
359
|
export declare type TransactionOptions = {
|
|
@@ -293,14 +365,14 @@ export declare type TransactionOptions = {
|
|
|
293
365
|
export declare class UserFacingError extends Error {
|
|
294
366
|
name: string;
|
|
295
367
|
code: string;
|
|
296
|
-
meta: unknown
|
|
297
|
-
constructor(message: string, code: string, meta?: unknown);
|
|
368
|
+
meta: Record<string, unknown>;
|
|
369
|
+
constructor(message: string, code: string, meta?: Record<string, unknown>);
|
|
298
370
|
toQueryResponseErrorObject(): {
|
|
299
371
|
error: string;
|
|
300
372
|
user_facing_error: {
|
|
301
373
|
is_panic: boolean;
|
|
302
374
|
message: string;
|
|
303
|
-
meta: unknown
|
|
375
|
+
meta: Record<string, unknown>;
|
|
304
376
|
error_code: string;
|
|
305
377
|
};
|
|
306
378
|
};
|
|
@@ -332,6 +404,13 @@ export declare type ValidationError = {
|
|
|
332
404
|
context: {
|
|
333
405
|
expectedRows: number;
|
|
334
406
|
};
|
|
407
|
+
} | {
|
|
408
|
+
error_identifier: 'INCOMPLETE_CONNECT_OUTPUT';
|
|
409
|
+
context: {
|
|
410
|
+
expectedRows: number;
|
|
411
|
+
relation: string;
|
|
412
|
+
relationType: string;
|
|
413
|
+
};
|
|
335
414
|
} | {
|
|
336
415
|
error_identifier: 'RECORDS_NOT_CONNECTED';
|
|
337
416
|
context: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,36 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Context } from '@opentelemetry/api';
|
|
2
2
|
import type { IsolationLevel } from '@prisma/driver-adapter-utils';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
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;
|
|
@@ -97,6 +133,9 @@ export declare type PrismaValueType = {
|
|
|
97
133
|
type: 'Object';
|
|
98
134
|
} | {
|
|
99
135
|
type: 'Bytes';
|
|
136
|
+
} | {
|
|
137
|
+
type: 'Enum';
|
|
138
|
+
inner: string;
|
|
100
139
|
};
|
|
101
140
|
|
|
102
141
|
export declare type QueryEvent = {
|
|
@@ -108,7 +147,7 @@ export declare type QueryEvent = {
|
|
|
108
147
|
|
|
109
148
|
export declare class QueryInterpreter {
|
|
110
149
|
#private;
|
|
111
|
-
constructor({ transactionManager, placeholderValues, onQuery, tracingHelper, serializer }: QueryInterpreterOptions);
|
|
150
|
+
constructor({ transactionManager, placeholderValues, onQuery, tracingHelper, serializer, rawSerializer, }: QueryInterpreterOptions);
|
|
112
151
|
static forSql(options: {
|
|
113
152
|
transactionManager: QueryInterpreterTransactionManager;
|
|
114
153
|
placeholderValues: Record<string, unknown>;
|
|
@@ -125,6 +164,7 @@ export declare type QueryInterpreterOptions = {
|
|
|
125
164
|
onQuery?: (event: QueryEvent) => void;
|
|
126
165
|
tracingHelper: TracingHelper;
|
|
127
166
|
serializer: (results: SqlResultSet) => Value;
|
|
167
|
+
rawSerializer?: (results: SqlResultSet) => Value;
|
|
128
168
|
};
|
|
129
169
|
|
|
130
170
|
export declare type QueryInterpreterTransactionManager = {
|
|
@@ -210,6 +250,7 @@ export declare type QueryPlanNode = {
|
|
|
210
250
|
args: {
|
|
211
251
|
expr: QueryPlanNode;
|
|
212
252
|
structure: ResultNode;
|
|
253
|
+
enums: Record<string, Record<string, string>>;
|
|
213
254
|
};
|
|
214
255
|
} | {
|
|
215
256
|
type: 'validate';
|
|
@@ -233,9 +274,34 @@ export declare type QueryPlanNode = {
|
|
|
233
274
|
from: QueryPlanNode;
|
|
234
275
|
to: QueryPlanNode;
|
|
235
276
|
};
|
|
277
|
+
} | {
|
|
278
|
+
type: 'distinctBy';
|
|
279
|
+
args: {
|
|
280
|
+
expr: QueryPlanNode;
|
|
281
|
+
fields: string[];
|
|
282
|
+
};
|
|
283
|
+
} | {
|
|
284
|
+
type: 'paginate';
|
|
285
|
+
args: {
|
|
286
|
+
expr: QueryPlanNode;
|
|
287
|
+
pagination: Pagination;
|
|
288
|
+
};
|
|
289
|
+
} | {
|
|
290
|
+
type: 'extendRecord';
|
|
291
|
+
args: {
|
|
292
|
+
expr: QueryPlanNode;
|
|
293
|
+
values: Record<string, {
|
|
294
|
+
type: 'value';
|
|
295
|
+
value: PrismaValue;
|
|
296
|
+
} | {
|
|
297
|
+
type: 'lastInsertId';
|
|
298
|
+
}>;
|
|
299
|
+
};
|
|
236
300
|
};
|
|
237
301
|
|
|
238
302
|
export declare type ResultNode = {
|
|
303
|
+
type: 'AffectedRows';
|
|
304
|
+
} | {
|
|
239
305
|
type: 'Object';
|
|
240
306
|
fields: Record<string, ResultNode>;
|
|
241
307
|
flattened: boolean;
|
|
@@ -245,6 +311,12 @@ export declare type ResultNode = {
|
|
|
245
311
|
resultType: PrismaValueType;
|
|
246
312
|
};
|
|
247
313
|
|
|
314
|
+
/**
|
|
315
|
+
* `JSON.stringify` wrapper with custom replacer function that handles nested
|
|
316
|
+
* BigInt and Uint8Array values.
|
|
317
|
+
*/
|
|
318
|
+
export declare function safeJsonStringify(obj: unknown): string;
|
|
319
|
+
|
|
248
320
|
declare type SpanCallback<R> = (span?: Span, context?: Context) => R;
|
|
249
321
|
|
|
250
322
|
export declare interface TracingHelper {
|
|
@@ -262,10 +334,11 @@ export declare class TransactionManager {
|
|
|
262
334
|
private readonly driverAdapter;
|
|
263
335
|
private readonly transactionOptions;
|
|
264
336
|
private readonly tracingHelper;
|
|
265
|
-
constructor({ driverAdapter, transactionOptions, tracingHelper, }: {
|
|
337
|
+
constructor({ driverAdapter, transactionOptions, tracingHelper, onQuery, }: {
|
|
266
338
|
driverAdapter: SqlDriverAdapter;
|
|
267
339
|
transactionOptions: TransactionOptions;
|
|
268
340
|
tracingHelper: TracingHelper;
|
|
341
|
+
onQuery?: (event: QueryEvent) => void;
|
|
269
342
|
});
|
|
270
343
|
startTransaction(options?: TransactionOptions): Promise<TransactionInfo>;
|
|
271
344
|
commitTransaction(transactionId: string): Promise<void>;
|
|
@@ -278,10 +351,9 @@ export declare class TransactionManager {
|
|
|
278
351
|
private validateOptions;
|
|
279
352
|
}
|
|
280
353
|
|
|
281
|
-
export declare class TransactionManagerError extends
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
constructor(message: string, meta?: Record<string, unknown> | undefined);
|
|
354
|
+
export declare class TransactionManagerError extends UserFacingError {
|
|
355
|
+
name: string;
|
|
356
|
+
constructor(message: string, meta?: Record<string, unknown>);
|
|
285
357
|
}
|
|
286
358
|
|
|
287
359
|
export declare type TransactionOptions = {
|
|
@@ -293,14 +365,14 @@ export declare type TransactionOptions = {
|
|
|
293
365
|
export declare class UserFacingError extends Error {
|
|
294
366
|
name: string;
|
|
295
367
|
code: string;
|
|
296
|
-
meta: unknown
|
|
297
|
-
constructor(message: string, code: string, meta?: unknown);
|
|
368
|
+
meta: Record<string, unknown>;
|
|
369
|
+
constructor(message: string, code: string, meta?: Record<string, unknown>);
|
|
298
370
|
toQueryResponseErrorObject(): {
|
|
299
371
|
error: string;
|
|
300
372
|
user_facing_error: {
|
|
301
373
|
is_panic: boolean;
|
|
302
374
|
message: string;
|
|
303
|
-
meta: unknown
|
|
375
|
+
meta: Record<string, unknown>;
|
|
304
376
|
error_code: string;
|
|
305
377
|
};
|
|
306
378
|
};
|
|
@@ -332,6 +404,13 @@ export declare type ValidationError = {
|
|
|
332
404
|
context: {
|
|
333
405
|
expectedRows: number;
|
|
334
406
|
};
|
|
407
|
+
} | {
|
|
408
|
+
error_identifier: 'INCOMPLETE_CONNECT_OUTPUT';
|
|
409
|
+
context: {
|
|
410
|
+
expectedRows: number;
|
|
411
|
+
relation: string;
|
|
412
|
+
relationType: string;
|
|
413
|
+
};
|
|
335
414
|
} | {
|
|
336
415
|
error_identifier: 'RECORDS_NOT_CONNECTED';
|
|
337
416
|
context: {
|