@prisma/client-engine-runtime 6.7.0-dev.2 → 6.7.0-dev.20

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.
@@ -36,6 +36,8 @@ export type Fragment = {
36
36
  type: 'parameter';
37
37
  } | {
38
38
  type: 'parameterTuple';
39
+ } | {
40
+ type: 'parameterTupleList';
39
41
  };
40
42
  export interface PlaceholderFormat {
41
43
  prefix: string;
@@ -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;
@@ -54,7 +65,7 @@ export declare type QueryEvent = {
54
65
 
55
66
  export declare class QueryInterpreter {
56
67
  #private;
57
- constructor({ transactionManager, placeholderValues, onQuery }: QueryInterpreterOptions);
68
+ constructor({ transactionManager, placeholderValues, onQuery, tracingHelper }: QueryInterpreterOptions);
58
69
  run(queryPlan: QueryPlanNode, queryable: SqlQueryable): Promise<unknown>;
59
70
  private interpretNode;
60
71
  }
@@ -63,6 +74,7 @@ export declare type QueryInterpreterOptions = {
63
74
  transactionManager: QueryInterpreterTransactionManager;
64
75
  placeholderValues: Record<string, unknown>;
65
76
  onQuery?: (event: QueryEvent) => void;
77
+ tracingHelper: TracingHelper;
66
78
  };
67
79
 
68
80
  export declare type QueryInterpreterTransactionManager = {
@@ -145,18 +157,27 @@ export declare type QueryPlanNode = {
145
157
  args: QueryPlanNode;
146
158
  };
147
159
 
160
+ declare type SpanCallback<R> = (span?: Span, context?: Context) => R;
161
+
162
+ export declare interface TracingHelper {
163
+ runInChildSpan<R>(nameOrOptions: string | ExtendedSpanOptions, callback: SpanCallback<R>): R;
164
+ }
165
+
148
166
  export declare type TransactionInfo = {
149
167
  id: string;
150
168
  };
151
169
 
152
170
  export declare class TransactionManager {
171
+ #private;
153
172
  private transactions;
154
173
  private closedTransactions;
155
174
  private readonly driverAdapter;
156
175
  private readonly transactionOptions;
157
- constructor({ driverAdapter, transactionOptions }: {
176
+ private readonly tracingHelper;
177
+ constructor({ driverAdapter, transactionOptions, tracingHelper, }: {
158
178
  driverAdapter: SqlDriverAdapter;
159
179
  transactionOptions: TransactionOptions;
180
+ tracingHelper: TracingHelper;
160
181
  });
161
182
  startTransaction(options?: TransactionOptions): Promise<TransactionInfo>;
162
183
  commitTransaction(transactionId: string): Promise<void>;
@@ -181,4 +202,20 @@ export declare type TransactionOptions = {
181
202
  isolationLevel?: IsolationLevel;
182
203
  };
183
204
 
205
+ export declare class UserFacingError extends Error {
206
+ name: string;
207
+ code: string;
208
+ meta: unknown;
209
+ constructor(message: string, code: string, meta?: unknown);
210
+ toQueryResponseErrorObject(): {
211
+ error: string;
212
+ user_facing_error: {
213
+ is_panic: boolean;
214
+ message: string;
215
+ meta: unknown;
216
+ error_code: string;
217
+ };
218
+ };
219
+ }
220
+
184
221
  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;
@@ -54,7 +65,7 @@ export declare type QueryEvent = {
54
65
 
55
66
  export declare class QueryInterpreter {
56
67
  #private;
57
- constructor({ transactionManager, placeholderValues, onQuery }: QueryInterpreterOptions);
68
+ constructor({ transactionManager, placeholderValues, onQuery, tracingHelper }: QueryInterpreterOptions);
58
69
  run(queryPlan: QueryPlanNode, queryable: SqlQueryable): Promise<unknown>;
59
70
  private interpretNode;
60
71
  }
@@ -63,6 +74,7 @@ export declare type QueryInterpreterOptions = {
63
74
  transactionManager: QueryInterpreterTransactionManager;
64
75
  placeholderValues: Record<string, unknown>;
65
76
  onQuery?: (event: QueryEvent) => void;
77
+ tracingHelper: TracingHelper;
66
78
  };
67
79
 
68
80
  export declare type QueryInterpreterTransactionManager = {
@@ -145,18 +157,27 @@ export declare type QueryPlanNode = {
145
157
  args: QueryPlanNode;
146
158
  };
147
159
 
160
+ declare type SpanCallback<R> = (span?: Span, context?: Context) => R;
161
+
162
+ export declare interface TracingHelper {
163
+ runInChildSpan<R>(nameOrOptions: string | ExtendedSpanOptions, callback: SpanCallback<R>): R;
164
+ }
165
+
148
166
  export declare type TransactionInfo = {
149
167
  id: string;
150
168
  };
151
169
 
152
170
  export declare class TransactionManager {
171
+ #private;
153
172
  private transactions;
154
173
  private closedTransactions;
155
174
  private readonly driverAdapter;
156
175
  private readonly transactionOptions;
157
- constructor({ driverAdapter, transactionOptions }: {
176
+ private readonly tracingHelper;
177
+ constructor({ driverAdapter, transactionOptions, tracingHelper, }: {
158
178
  driverAdapter: SqlDriverAdapter;
159
179
  transactionOptions: TransactionOptions;
180
+ tracingHelper: TracingHelper;
160
181
  });
161
182
  startTransaction(options?: TransactionOptions): Promise<TransactionInfo>;
162
183
  commitTransaction(transactionId: string): Promise<void>;
@@ -181,4 +202,20 @@ export declare type TransactionOptions = {
181
202
  isolationLevel?: IsolationLevel;
182
203
  };
183
204
 
205
+ export declare class UserFacingError extends Error {
206
+ name: string;
207
+ code: string;
208
+ meta: unknown;
209
+ constructor(message: string, code: string, meta?: unknown);
210
+ toQueryResponseErrorObject(): {
211
+ error: string;
212
+ user_facing_error: {
213
+ is_panic: boolean;
214
+ message: string;
215
+ meta: unknown;
216
+ error_code: string;
217
+ };
218
+ };
219
+ }
220
+
184
221
  export { }