@prisma/client-engine-runtime 6.7.0-dev.4 → 6.7.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.
- package/dist/QueryPlan.d.ts +40 -0
- package/dist/index.d.mts +76 -2
- package/dist/index.d.ts +76 -2
- package/dist/index.js +265 -58
- package/dist/index.mjs +263 -57
- package/dist/interpreter/DataMapper.d.ts +3 -0
- package/dist/interpreter/QueryInterpreter.d.ts +12 -2
- package/dist/interpreter/serializeSql.d.ts +2 -0
- package/dist/tracing.d.ts +11 -0
- package/dist/transactionManager/TransactionManager.d.ts +5 -1
- package/package.json +4 -3
- package/dist/interpreter/serialize.d.ts +0 -2
- /package/dist/interpreter/{serialize.test.d.ts → serializeSql.test.d.ts} +0 -0
package/dist/QueryPlan.d.ts
CHANGED
|
@@ -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
|
};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
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';
|
|
7
|
+
import { SqlResultSet } from '@prisma/driver-adapter-utils';
|
|
4
8
|
import { Transaction } from '@prisma/driver-adapter-utils';
|
|
5
9
|
|
|
10
|
+
declare type ExtendedSpanOptions = SpanOptions & {
|
|
11
|
+
name: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
6
14
|
export declare type Fragment = {
|
|
7
15
|
type: 'stringChunk';
|
|
8
16
|
value: string;
|
|
@@ -10,6 +18,8 @@ export declare type Fragment = {
|
|
|
10
18
|
type: 'parameter';
|
|
11
19
|
} | {
|
|
12
20
|
type: 'parameterTuple';
|
|
21
|
+
} | {
|
|
22
|
+
type: 'parameterTupleList';
|
|
13
23
|
};
|
|
14
24
|
|
|
15
25
|
export declare function isPrismaValueGenerator(value: unknown): value is PrismaValueGenerator;
|
|
@@ -22,6 +32,8 @@ export declare type JoinExpression = {
|
|
|
22
32
|
parentField: string;
|
|
23
33
|
};
|
|
24
34
|
|
|
35
|
+
export declare const noopTracingHelper: TracingHelper;
|
|
36
|
+
|
|
25
37
|
export declare interface PlaceholderFormat {
|
|
26
38
|
prefix: string;
|
|
27
39
|
hasNumbering: boolean;
|
|
@@ -45,6 +57,31 @@ export declare type PrismaValuePlaceholder = {
|
|
|
45
57
|
};
|
|
46
58
|
};
|
|
47
59
|
|
|
60
|
+
export declare type PrismaValueType = {
|
|
61
|
+
type: 'Any';
|
|
62
|
+
} | {
|
|
63
|
+
type: 'String';
|
|
64
|
+
} | {
|
|
65
|
+
type: 'Int';
|
|
66
|
+
} | {
|
|
67
|
+
type: 'BigInt';
|
|
68
|
+
} | {
|
|
69
|
+
type: 'Float';
|
|
70
|
+
} | {
|
|
71
|
+
type: 'Boolean';
|
|
72
|
+
} | {
|
|
73
|
+
type: 'Decimal';
|
|
74
|
+
} | {
|
|
75
|
+
type: 'Date';
|
|
76
|
+
} | {
|
|
77
|
+
type: 'Array';
|
|
78
|
+
inner: PrismaValueType;
|
|
79
|
+
} | {
|
|
80
|
+
type: 'Object';
|
|
81
|
+
} | {
|
|
82
|
+
type: 'Bytes';
|
|
83
|
+
};
|
|
84
|
+
|
|
48
85
|
export declare type QueryEvent = {
|
|
49
86
|
timestamp: Date;
|
|
50
87
|
query: string;
|
|
@@ -54,7 +91,13 @@ export declare type QueryEvent = {
|
|
|
54
91
|
|
|
55
92
|
export declare class QueryInterpreter {
|
|
56
93
|
#private;
|
|
57
|
-
constructor({ transactionManager, placeholderValues, onQuery }: QueryInterpreterOptions);
|
|
94
|
+
constructor({ transactionManager, placeholderValues, onQuery, tracingHelper, serializer }: QueryInterpreterOptions);
|
|
95
|
+
static forSql(options: {
|
|
96
|
+
transactionManager: QueryInterpreterTransactionManager;
|
|
97
|
+
placeholderValues: Record<string, unknown>;
|
|
98
|
+
onQuery?: (event: QueryEvent) => void;
|
|
99
|
+
tracingHelper: TracingHelper;
|
|
100
|
+
}): QueryInterpreter;
|
|
58
101
|
run(queryPlan: QueryPlanNode, queryable: SqlQueryable): Promise<unknown>;
|
|
59
102
|
private interpretNode;
|
|
60
103
|
}
|
|
@@ -63,6 +106,8 @@ export declare type QueryInterpreterOptions = {
|
|
|
63
106
|
transactionManager: QueryInterpreterTransactionManager;
|
|
64
107
|
placeholderValues: Record<string, unknown>;
|
|
65
108
|
onQuery?: (event: QueryEvent) => void;
|
|
109
|
+
tracingHelper: TracingHelper;
|
|
110
|
+
serializer: (results: SqlResultSet) => Value;
|
|
66
111
|
};
|
|
67
112
|
|
|
68
113
|
export declare type QueryInterpreterTransactionManager = {
|
|
@@ -143,20 +188,44 @@ export declare type QueryPlanNode = {
|
|
|
143
188
|
} | {
|
|
144
189
|
type: 'transaction';
|
|
145
190
|
args: QueryPlanNode;
|
|
191
|
+
} | {
|
|
192
|
+
type: 'dataMap';
|
|
193
|
+
args: {
|
|
194
|
+
expr: QueryPlanNode;
|
|
195
|
+
structure: ResultNode;
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export declare type ResultNode = {
|
|
200
|
+
type: 'Object';
|
|
201
|
+
fields: Record<string, ResultNode>;
|
|
202
|
+
} | {
|
|
203
|
+
type: 'Value';
|
|
204
|
+
dbName: string;
|
|
205
|
+
resultType: PrismaValueType;
|
|
146
206
|
};
|
|
147
207
|
|
|
208
|
+
declare type SpanCallback<R> = (span?: Span, context?: Context) => R;
|
|
209
|
+
|
|
210
|
+
export declare interface TracingHelper {
|
|
211
|
+
runInChildSpan<R>(nameOrOptions: string | ExtendedSpanOptions, callback: SpanCallback<R>): R;
|
|
212
|
+
}
|
|
213
|
+
|
|
148
214
|
export declare type TransactionInfo = {
|
|
149
215
|
id: string;
|
|
150
216
|
};
|
|
151
217
|
|
|
152
218
|
export declare class TransactionManager {
|
|
219
|
+
#private;
|
|
153
220
|
private transactions;
|
|
154
221
|
private closedTransactions;
|
|
155
222
|
private readonly driverAdapter;
|
|
156
223
|
private readonly transactionOptions;
|
|
157
|
-
|
|
224
|
+
private readonly tracingHelper;
|
|
225
|
+
constructor({ driverAdapter, transactionOptions, tracingHelper, }: {
|
|
158
226
|
driverAdapter: SqlDriverAdapter;
|
|
159
227
|
transactionOptions: TransactionOptions;
|
|
228
|
+
tracingHelper: TracingHelper;
|
|
160
229
|
});
|
|
161
230
|
startTransaction(options?: TransactionOptions): Promise<TransactionInfo>;
|
|
162
231
|
commitTransaction(transactionId: string): Promise<void>;
|
|
@@ -197,4 +266,9 @@ export declare class UserFacingError extends Error {
|
|
|
197
266
|
};
|
|
198
267
|
}
|
|
199
268
|
|
|
269
|
+
/**
|
|
270
|
+
* The general type of values each node can evaluate to.
|
|
271
|
+
*/
|
|
272
|
+
declare type Value = unknown;
|
|
273
|
+
|
|
200
274
|
export { }
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
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';
|
|
7
|
+
import { SqlResultSet } from '@prisma/driver-adapter-utils';
|
|
4
8
|
import { Transaction } from '@prisma/driver-adapter-utils';
|
|
5
9
|
|
|
10
|
+
declare type ExtendedSpanOptions = SpanOptions & {
|
|
11
|
+
name: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
6
14
|
export declare type Fragment = {
|
|
7
15
|
type: 'stringChunk';
|
|
8
16
|
value: string;
|
|
@@ -10,6 +18,8 @@ export declare type Fragment = {
|
|
|
10
18
|
type: 'parameter';
|
|
11
19
|
} | {
|
|
12
20
|
type: 'parameterTuple';
|
|
21
|
+
} | {
|
|
22
|
+
type: 'parameterTupleList';
|
|
13
23
|
};
|
|
14
24
|
|
|
15
25
|
export declare function isPrismaValueGenerator(value: unknown): value is PrismaValueGenerator;
|
|
@@ -22,6 +32,8 @@ export declare type JoinExpression = {
|
|
|
22
32
|
parentField: string;
|
|
23
33
|
};
|
|
24
34
|
|
|
35
|
+
export declare const noopTracingHelper: TracingHelper;
|
|
36
|
+
|
|
25
37
|
export declare interface PlaceholderFormat {
|
|
26
38
|
prefix: string;
|
|
27
39
|
hasNumbering: boolean;
|
|
@@ -45,6 +57,31 @@ export declare type PrismaValuePlaceholder = {
|
|
|
45
57
|
};
|
|
46
58
|
};
|
|
47
59
|
|
|
60
|
+
export declare type PrismaValueType = {
|
|
61
|
+
type: 'Any';
|
|
62
|
+
} | {
|
|
63
|
+
type: 'String';
|
|
64
|
+
} | {
|
|
65
|
+
type: 'Int';
|
|
66
|
+
} | {
|
|
67
|
+
type: 'BigInt';
|
|
68
|
+
} | {
|
|
69
|
+
type: 'Float';
|
|
70
|
+
} | {
|
|
71
|
+
type: 'Boolean';
|
|
72
|
+
} | {
|
|
73
|
+
type: 'Decimal';
|
|
74
|
+
} | {
|
|
75
|
+
type: 'Date';
|
|
76
|
+
} | {
|
|
77
|
+
type: 'Array';
|
|
78
|
+
inner: PrismaValueType;
|
|
79
|
+
} | {
|
|
80
|
+
type: 'Object';
|
|
81
|
+
} | {
|
|
82
|
+
type: 'Bytes';
|
|
83
|
+
};
|
|
84
|
+
|
|
48
85
|
export declare type QueryEvent = {
|
|
49
86
|
timestamp: Date;
|
|
50
87
|
query: string;
|
|
@@ -54,7 +91,13 @@ export declare type QueryEvent = {
|
|
|
54
91
|
|
|
55
92
|
export declare class QueryInterpreter {
|
|
56
93
|
#private;
|
|
57
|
-
constructor({ transactionManager, placeholderValues, onQuery }: QueryInterpreterOptions);
|
|
94
|
+
constructor({ transactionManager, placeholderValues, onQuery, tracingHelper, serializer }: QueryInterpreterOptions);
|
|
95
|
+
static forSql(options: {
|
|
96
|
+
transactionManager: QueryInterpreterTransactionManager;
|
|
97
|
+
placeholderValues: Record<string, unknown>;
|
|
98
|
+
onQuery?: (event: QueryEvent) => void;
|
|
99
|
+
tracingHelper: TracingHelper;
|
|
100
|
+
}): QueryInterpreter;
|
|
58
101
|
run(queryPlan: QueryPlanNode, queryable: SqlQueryable): Promise<unknown>;
|
|
59
102
|
private interpretNode;
|
|
60
103
|
}
|
|
@@ -63,6 +106,8 @@ export declare type QueryInterpreterOptions = {
|
|
|
63
106
|
transactionManager: QueryInterpreterTransactionManager;
|
|
64
107
|
placeholderValues: Record<string, unknown>;
|
|
65
108
|
onQuery?: (event: QueryEvent) => void;
|
|
109
|
+
tracingHelper: TracingHelper;
|
|
110
|
+
serializer: (results: SqlResultSet) => Value;
|
|
66
111
|
};
|
|
67
112
|
|
|
68
113
|
export declare type QueryInterpreterTransactionManager = {
|
|
@@ -143,20 +188,44 @@ export declare type QueryPlanNode = {
|
|
|
143
188
|
} | {
|
|
144
189
|
type: 'transaction';
|
|
145
190
|
args: QueryPlanNode;
|
|
191
|
+
} | {
|
|
192
|
+
type: 'dataMap';
|
|
193
|
+
args: {
|
|
194
|
+
expr: QueryPlanNode;
|
|
195
|
+
structure: ResultNode;
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export declare type ResultNode = {
|
|
200
|
+
type: 'Object';
|
|
201
|
+
fields: Record<string, ResultNode>;
|
|
202
|
+
} | {
|
|
203
|
+
type: 'Value';
|
|
204
|
+
dbName: string;
|
|
205
|
+
resultType: PrismaValueType;
|
|
146
206
|
};
|
|
147
207
|
|
|
208
|
+
declare type SpanCallback<R> = (span?: Span, context?: Context) => R;
|
|
209
|
+
|
|
210
|
+
export declare interface TracingHelper {
|
|
211
|
+
runInChildSpan<R>(nameOrOptions: string | ExtendedSpanOptions, callback: SpanCallback<R>): R;
|
|
212
|
+
}
|
|
213
|
+
|
|
148
214
|
export declare type TransactionInfo = {
|
|
149
215
|
id: string;
|
|
150
216
|
};
|
|
151
217
|
|
|
152
218
|
export declare class TransactionManager {
|
|
219
|
+
#private;
|
|
153
220
|
private transactions;
|
|
154
221
|
private closedTransactions;
|
|
155
222
|
private readonly driverAdapter;
|
|
156
223
|
private readonly transactionOptions;
|
|
157
|
-
|
|
224
|
+
private readonly tracingHelper;
|
|
225
|
+
constructor({ driverAdapter, transactionOptions, tracingHelper, }: {
|
|
158
226
|
driverAdapter: SqlDriverAdapter;
|
|
159
227
|
transactionOptions: TransactionOptions;
|
|
228
|
+
tracingHelper: TracingHelper;
|
|
160
229
|
});
|
|
161
230
|
startTransaction(options?: TransactionOptions): Promise<TransactionInfo>;
|
|
162
231
|
commitTransaction(transactionId: string): Promise<void>;
|
|
@@ -197,4 +266,9 @@ export declare class UserFacingError extends Error {
|
|
|
197
266
|
};
|
|
198
267
|
}
|
|
199
268
|
|
|
269
|
+
/**
|
|
270
|
+
* The general type of values each node can evaluate to.
|
|
271
|
+
*/
|
|
272
|
+
declare type Value = unknown;
|
|
273
|
+
|
|
200
274
|
export { }
|