@prisma/client-engine-runtime 6.7.0-dev.3 → 6.7.0-dev.30

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.
@@ -15,6 +15,38 @@ export type PrismaValueGenerator = {
15
15
  };
16
16
  export declare function isPrismaValueGenerator(value: unknown): value is PrismaValueGenerator;
17
17
  export type PrismaValue = string | boolean | number | PrismaValue[] | null | Record<string, unknown> | PrismaValuePlaceholder | PrismaValueGenerator;
18
+ export type PrismaValueType = {
19
+ type: 'Any';
20
+ } | {
21
+ type: 'String';
22
+ } | {
23
+ type: 'Int';
24
+ } | {
25
+ type: 'BigInt';
26
+ } | {
27
+ type: 'Float';
28
+ } | {
29
+ type: 'Boolean';
30
+ } | {
31
+ type: 'Decimal';
32
+ } | {
33
+ type: 'Date';
34
+ } | {
35
+ type: 'Array';
36
+ inner: PrismaValueType;
37
+ } | {
38
+ type: 'Object';
39
+ } | {
40
+ type: 'Bytes';
41
+ };
42
+ export type ResultNode = {
43
+ type: 'Object';
44
+ fields: Record<string, ResultNode>;
45
+ } | {
46
+ type: 'Value';
47
+ dbName: string;
48
+ resultType: PrismaValueType;
49
+ };
18
50
  export type QueryPlanBinding = {
19
51
  name: string;
20
52
  expr: QueryPlanNode;
@@ -36,6 +68,8 @@ export type Fragment = {
36
68
  type: 'parameter';
37
69
  } | {
38
70
  type: 'parameterTuple';
71
+ } | {
72
+ type: 'parameterTupleList';
39
73
  };
40
74
  export interface PlaceholderFormat {
41
75
  prefix: string;
@@ -101,4 +135,10 @@ export type QueryPlanNode = {
101
135
  } | {
102
136
  type: 'transaction';
103
137
  args: QueryPlanNode;
138
+ } | {
139
+ type: 'dataMap';
140
+ args: {
141
+ expr: QueryPlanNode;
142
+ structure: ResultNode;
143
+ };
104
144
  };
@@ -0,0 +1,16 @@
1
+ export declare class UserFacingError extends Error {
2
+ name: string;
3
+ code: string;
4
+ meta: unknown;
5
+ constructor(message: string, code: string, meta?: unknown);
6
+ toQueryResponseErrorObject(): {
7
+ error: string;
8
+ user_facing_error: {
9
+ is_panic: boolean;
10
+ message: string;
11
+ meta: unknown;
12
+ error_code: string;
13
+ };
14
+ };
15
+ }
16
+ export declare function rethrowAsUserFacing(error: any): never;
package/dist/index.d.mts CHANGED
@@ -1,8 +1,15 @@
1
+ import type { Context } from '@opentelemetry/api';
1
2
  import type { IsolationLevel } from '@prisma/driver-adapter-utils';
3
+ import type { Span } from '@opentelemetry/api';
4
+ import type { SpanOptions } from '@opentelemetry/api';
2
5
  import { SqlDriverAdapter } from '@prisma/driver-adapter-utils';
3
6
  import { SqlQueryable } from '@prisma/driver-adapter-utils';
4
7
  import { Transaction } from '@prisma/driver-adapter-utils';
5
8
 
9
+ declare type ExtendedSpanOptions = SpanOptions & {
10
+ name: string;
11
+ };
12
+
6
13
  export declare type Fragment = {
7
14
  type: 'stringChunk';
8
15
  value: string;
@@ -10,6 +17,8 @@ export declare type Fragment = {
10
17
  type: 'parameter';
11
18
  } | {
12
19
  type: 'parameterTuple';
20
+ } | {
21
+ type: 'parameterTupleList';
13
22
  };
14
23
 
15
24
  export declare function isPrismaValueGenerator(value: unknown): value is PrismaValueGenerator;
@@ -22,6 +31,8 @@ export declare type JoinExpression = {
22
31
  parentField: string;
23
32
  };
24
33
 
34
+ export declare const noopTracingHelper: TracingHelper;
35
+
25
36
  export declare interface PlaceholderFormat {
26
37
  prefix: string;
27
38
  hasNumbering: boolean;
@@ -45,6 +56,31 @@ export declare type PrismaValuePlaceholder = {
45
56
  };
46
57
  };
47
58
 
59
+ export declare type PrismaValueType = {
60
+ type: 'Any';
61
+ } | {
62
+ type: 'String';
63
+ } | {
64
+ type: 'Int';
65
+ } | {
66
+ type: 'BigInt';
67
+ } | {
68
+ type: 'Float';
69
+ } | {
70
+ type: 'Boolean';
71
+ } | {
72
+ type: 'Decimal';
73
+ } | {
74
+ type: 'Date';
75
+ } | {
76
+ type: 'Array';
77
+ inner: PrismaValueType;
78
+ } | {
79
+ type: 'Object';
80
+ } | {
81
+ type: 'Bytes';
82
+ };
83
+
48
84
  export declare type QueryEvent = {
49
85
  timestamp: Date;
50
86
  query: string;
@@ -54,7 +90,7 @@ export declare type QueryEvent = {
54
90
 
55
91
  export declare class QueryInterpreter {
56
92
  #private;
57
- constructor({ transactionManager, placeholderValues, onQuery }: QueryInterpreterOptions);
93
+ constructor({ transactionManager, placeholderValues, onQuery, tracingHelper }: QueryInterpreterOptions);
58
94
  run(queryPlan: QueryPlanNode, queryable: SqlQueryable): Promise<unknown>;
59
95
  private interpretNode;
60
96
  }
@@ -63,6 +99,7 @@ export declare type QueryInterpreterOptions = {
63
99
  transactionManager: QueryInterpreterTransactionManager;
64
100
  placeholderValues: Record<string, unknown>;
65
101
  onQuery?: (event: QueryEvent) => void;
102
+ tracingHelper: TracingHelper;
66
103
  };
67
104
 
68
105
  export declare type QueryInterpreterTransactionManager = {
@@ -143,20 +180,44 @@ export declare type QueryPlanNode = {
143
180
  } | {
144
181
  type: 'transaction';
145
182
  args: QueryPlanNode;
183
+ } | {
184
+ type: 'dataMap';
185
+ args: {
186
+ expr: QueryPlanNode;
187
+ structure: ResultNode;
188
+ };
146
189
  };
147
190
 
191
+ export declare type ResultNode = {
192
+ type: 'Object';
193
+ fields: Record<string, ResultNode>;
194
+ } | {
195
+ type: 'Value';
196
+ dbName: string;
197
+ resultType: PrismaValueType;
198
+ };
199
+
200
+ declare type SpanCallback<R> = (span?: Span, context?: Context) => R;
201
+
202
+ export declare interface TracingHelper {
203
+ runInChildSpan<R>(nameOrOptions: string | ExtendedSpanOptions, callback: SpanCallback<R>): R;
204
+ }
205
+
148
206
  export declare type TransactionInfo = {
149
207
  id: string;
150
208
  };
151
209
 
152
210
  export declare class TransactionManager {
211
+ #private;
153
212
  private transactions;
154
213
  private closedTransactions;
155
214
  private readonly driverAdapter;
156
215
  private readonly transactionOptions;
157
- constructor({ driverAdapter, transactionOptions }: {
216
+ private readonly tracingHelper;
217
+ constructor({ driverAdapter, transactionOptions, tracingHelper, }: {
158
218
  driverAdapter: SqlDriverAdapter;
159
219
  transactionOptions: TransactionOptions;
220
+ tracingHelper: TracingHelper;
160
221
  });
161
222
  startTransaction(options?: TransactionOptions): Promise<TransactionInfo>;
162
223
  commitTransaction(transactionId: string): Promise<void>;
@@ -181,4 +242,20 @@ export declare type TransactionOptions = {
181
242
  isolationLevel?: IsolationLevel;
182
243
  };
183
244
 
245
+ export declare class UserFacingError extends Error {
246
+ name: string;
247
+ code: string;
248
+ meta: unknown;
249
+ constructor(message: string, code: string, meta?: unknown);
250
+ toQueryResponseErrorObject(): {
251
+ error: string;
252
+ user_facing_error: {
253
+ is_panic: boolean;
254
+ message: string;
255
+ meta: unknown;
256
+ error_code: string;
257
+ };
258
+ };
259
+ }
260
+
184
261
  export { }
package/dist/index.d.ts CHANGED
@@ -1,8 +1,15 @@
1
+ import type { Context } from '@opentelemetry/api';
1
2
  import type { IsolationLevel } from '@prisma/driver-adapter-utils';
3
+ import type { Span } from '@opentelemetry/api';
4
+ import type { SpanOptions } from '@opentelemetry/api';
2
5
  import { SqlDriverAdapter } from '@prisma/driver-adapter-utils';
3
6
  import { SqlQueryable } from '@prisma/driver-adapter-utils';
4
7
  import { Transaction } from '@prisma/driver-adapter-utils';
5
8
 
9
+ declare type ExtendedSpanOptions = SpanOptions & {
10
+ name: string;
11
+ };
12
+
6
13
  export declare type Fragment = {
7
14
  type: 'stringChunk';
8
15
  value: string;
@@ -10,6 +17,8 @@ export declare type Fragment = {
10
17
  type: 'parameter';
11
18
  } | {
12
19
  type: 'parameterTuple';
20
+ } | {
21
+ type: 'parameterTupleList';
13
22
  };
14
23
 
15
24
  export declare function isPrismaValueGenerator(value: unknown): value is PrismaValueGenerator;
@@ -22,6 +31,8 @@ export declare type JoinExpression = {
22
31
  parentField: string;
23
32
  };
24
33
 
34
+ export declare const noopTracingHelper: TracingHelper;
35
+
25
36
  export declare interface PlaceholderFormat {
26
37
  prefix: string;
27
38
  hasNumbering: boolean;
@@ -45,6 +56,31 @@ export declare type PrismaValuePlaceholder = {
45
56
  };
46
57
  };
47
58
 
59
+ export declare type PrismaValueType = {
60
+ type: 'Any';
61
+ } | {
62
+ type: 'String';
63
+ } | {
64
+ type: 'Int';
65
+ } | {
66
+ type: 'BigInt';
67
+ } | {
68
+ type: 'Float';
69
+ } | {
70
+ type: 'Boolean';
71
+ } | {
72
+ type: 'Decimal';
73
+ } | {
74
+ type: 'Date';
75
+ } | {
76
+ type: 'Array';
77
+ inner: PrismaValueType;
78
+ } | {
79
+ type: 'Object';
80
+ } | {
81
+ type: 'Bytes';
82
+ };
83
+
48
84
  export declare type QueryEvent = {
49
85
  timestamp: Date;
50
86
  query: string;
@@ -54,7 +90,7 @@ export declare type QueryEvent = {
54
90
 
55
91
  export declare class QueryInterpreter {
56
92
  #private;
57
- constructor({ transactionManager, placeholderValues, onQuery }: QueryInterpreterOptions);
93
+ constructor({ transactionManager, placeholderValues, onQuery, tracingHelper }: QueryInterpreterOptions);
58
94
  run(queryPlan: QueryPlanNode, queryable: SqlQueryable): Promise<unknown>;
59
95
  private interpretNode;
60
96
  }
@@ -63,6 +99,7 @@ export declare type QueryInterpreterOptions = {
63
99
  transactionManager: QueryInterpreterTransactionManager;
64
100
  placeholderValues: Record<string, unknown>;
65
101
  onQuery?: (event: QueryEvent) => void;
102
+ tracingHelper: TracingHelper;
66
103
  };
67
104
 
68
105
  export declare type QueryInterpreterTransactionManager = {
@@ -143,20 +180,44 @@ export declare type QueryPlanNode = {
143
180
  } | {
144
181
  type: 'transaction';
145
182
  args: QueryPlanNode;
183
+ } | {
184
+ type: 'dataMap';
185
+ args: {
186
+ expr: QueryPlanNode;
187
+ structure: ResultNode;
188
+ };
146
189
  };
147
190
 
191
+ export declare type ResultNode = {
192
+ type: 'Object';
193
+ fields: Record<string, ResultNode>;
194
+ } | {
195
+ type: 'Value';
196
+ dbName: string;
197
+ resultType: PrismaValueType;
198
+ };
199
+
200
+ declare type SpanCallback<R> = (span?: Span, context?: Context) => R;
201
+
202
+ export declare interface TracingHelper {
203
+ runInChildSpan<R>(nameOrOptions: string | ExtendedSpanOptions, callback: SpanCallback<R>): R;
204
+ }
205
+
148
206
  export declare type TransactionInfo = {
149
207
  id: string;
150
208
  };
151
209
 
152
210
  export declare class TransactionManager {
211
+ #private;
153
212
  private transactions;
154
213
  private closedTransactions;
155
214
  private readonly driverAdapter;
156
215
  private readonly transactionOptions;
157
- constructor({ driverAdapter, transactionOptions }: {
216
+ private readonly tracingHelper;
217
+ constructor({ driverAdapter, transactionOptions, tracingHelper, }: {
158
218
  driverAdapter: SqlDriverAdapter;
159
219
  transactionOptions: TransactionOptions;
220
+ tracingHelper: TracingHelper;
160
221
  });
161
222
  startTransaction(options?: TransactionOptions): Promise<TransactionInfo>;
162
223
  commitTransaction(transactionId: string): Promise<void>;
@@ -181,4 +242,20 @@ export declare type TransactionOptions = {
181
242
  isolationLevel?: IsolationLevel;
182
243
  };
183
244
 
245
+ export declare class UserFacingError extends Error {
246
+ name: string;
247
+ code: string;
248
+ meta: unknown;
249
+ constructor(message: string, code: string, meta?: unknown);
250
+ toQueryResponseErrorObject(): {
251
+ error: string;
252
+ user_facing_error: {
253
+ is_panic: boolean;
254
+ message: string;
255
+ meta: unknown;
256
+ error_code: string;
257
+ };
258
+ };
259
+ }
260
+
184
261
  export { }