@prisma/client-engine-runtime 6.7.0-dev.36 → 6.7.0-dev.37
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/index.d.mts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +16 -5
- package/dist/index.mjs +16 -5
- package/dist/interpreter/QueryInterpreter.d.ts +10 -2
- package/dist/interpreter/serializeSql.d.ts +2 -0
- package/package.json +3 -3
- package/dist/interpreter/serialize.d.ts +0 -2
- /package/dist/interpreter/{serialize.test.d.ts → serializeSql.test.d.ts} +0 -0
package/dist/index.d.mts
CHANGED
|
@@ -4,6 +4,7 @@ import type { Span } from '@opentelemetry/api';
|
|
|
4
4
|
import type { SpanOptions } from '@opentelemetry/api';
|
|
5
5
|
import { SqlDriverAdapter } from '@prisma/driver-adapter-utils';
|
|
6
6
|
import { SqlQueryable } from '@prisma/driver-adapter-utils';
|
|
7
|
+
import { SqlResultSet } from '@prisma/driver-adapter-utils';
|
|
7
8
|
import { Transaction } from '@prisma/driver-adapter-utils';
|
|
8
9
|
|
|
9
10
|
declare type ExtendedSpanOptions = SpanOptions & {
|
|
@@ -90,7 +91,13 @@ export declare type QueryEvent = {
|
|
|
90
91
|
|
|
91
92
|
export declare class QueryInterpreter {
|
|
92
93
|
#private;
|
|
93
|
-
constructor({ transactionManager, placeholderValues, onQuery, tracingHelper }: 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;
|
|
94
101
|
run(queryPlan: QueryPlanNode, queryable: SqlQueryable): Promise<unknown>;
|
|
95
102
|
private interpretNode;
|
|
96
103
|
}
|
|
@@ -100,6 +107,7 @@ export declare type QueryInterpreterOptions = {
|
|
|
100
107
|
placeholderValues: Record<string, unknown>;
|
|
101
108
|
onQuery?: (event: QueryEvent) => void;
|
|
102
109
|
tracingHelper: TracingHelper;
|
|
110
|
+
serializer: (results: SqlResultSet) => Value;
|
|
103
111
|
};
|
|
104
112
|
|
|
105
113
|
export declare type QueryInterpreterTransactionManager = {
|
|
@@ -258,4 +266,9 @@ export declare class UserFacingError extends Error {
|
|
|
258
266
|
};
|
|
259
267
|
}
|
|
260
268
|
|
|
269
|
+
/**
|
|
270
|
+
* The general type of values each node can evaluate to.
|
|
271
|
+
*/
|
|
272
|
+
declare type Value = unknown;
|
|
273
|
+
|
|
261
274
|
export { }
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { Span } from '@opentelemetry/api';
|
|
|
4
4
|
import type { SpanOptions } from '@opentelemetry/api';
|
|
5
5
|
import { SqlDriverAdapter } from '@prisma/driver-adapter-utils';
|
|
6
6
|
import { SqlQueryable } from '@prisma/driver-adapter-utils';
|
|
7
|
+
import { SqlResultSet } from '@prisma/driver-adapter-utils';
|
|
7
8
|
import { Transaction } from '@prisma/driver-adapter-utils';
|
|
8
9
|
|
|
9
10
|
declare type ExtendedSpanOptions = SpanOptions & {
|
|
@@ -90,7 +91,13 @@ export declare type QueryEvent = {
|
|
|
90
91
|
|
|
91
92
|
export declare class QueryInterpreter {
|
|
92
93
|
#private;
|
|
93
|
-
constructor({ transactionManager, placeholderValues, onQuery, tracingHelper }: 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;
|
|
94
101
|
run(queryPlan: QueryPlanNode, queryable: SqlQueryable): Promise<unknown>;
|
|
95
102
|
private interpretNode;
|
|
96
103
|
}
|
|
@@ -100,6 +107,7 @@ export declare type QueryInterpreterOptions = {
|
|
|
100
107
|
placeholderValues: Record<string, unknown>;
|
|
101
108
|
onQuery?: (event: QueryEvent) => void;
|
|
102
109
|
tracingHelper: TracingHelper;
|
|
110
|
+
serializer: (results: SqlResultSet) => Value;
|
|
103
111
|
};
|
|
104
112
|
|
|
105
113
|
export declare type QueryInterpreterTransactionManager = {
|
|
@@ -258,4 +266,9 @@ export declare class UserFacingError extends Error {
|
|
|
258
266
|
};
|
|
259
267
|
}
|
|
260
268
|
|
|
269
|
+
/**
|
|
270
|
+
* The general type of values each node can evaluate to.
|
|
271
|
+
*/
|
|
272
|
+
declare type Value = unknown;
|
|
273
|
+
|
|
261
274
|
export { }
|
package/dist/index.js
CHANGED
|
@@ -562,8 +562,8 @@ function doesRequireEvaluation(param) {
|
|
|
562
562
|
return isPrismaValuePlaceholder(param) || isPrismaValueGenerator(param);
|
|
563
563
|
}
|
|
564
564
|
|
|
565
|
-
// src/interpreter/
|
|
566
|
-
function
|
|
565
|
+
// src/interpreter/serializeSql.ts
|
|
566
|
+
function serializeSql(resultSet) {
|
|
567
567
|
return resultSet.rows.map(
|
|
568
568
|
(row) => row.reduce((acc, value, index) => {
|
|
569
569
|
const splitByDot = resultSet.columnNames[index].split(".");
|
|
@@ -585,17 +585,28 @@ function serialize(resultSet) {
|
|
|
585
585
|
}
|
|
586
586
|
|
|
587
587
|
// src/interpreter/QueryInterpreter.ts
|
|
588
|
-
var QueryInterpreter = class {
|
|
588
|
+
var QueryInterpreter = class _QueryInterpreter {
|
|
589
589
|
#transactionManager;
|
|
590
590
|
#placeholderValues;
|
|
591
591
|
#onQuery;
|
|
592
592
|
#generators = new GeneratorRegistry();
|
|
593
593
|
#tracingHelper;
|
|
594
|
-
|
|
594
|
+
#serializer;
|
|
595
|
+
constructor({ transactionManager, placeholderValues, onQuery, tracingHelper, serializer }) {
|
|
595
596
|
this.#transactionManager = transactionManager;
|
|
596
597
|
this.#placeholderValues = placeholderValues;
|
|
597
598
|
this.#onQuery = onQuery;
|
|
598
599
|
this.#tracingHelper = tracingHelper;
|
|
600
|
+
this.#serializer = serializer;
|
|
601
|
+
}
|
|
602
|
+
static forSql(options) {
|
|
603
|
+
return new _QueryInterpreter({
|
|
604
|
+
transactionManager: options.transactionManager,
|
|
605
|
+
placeholderValues: options.placeholderValues,
|
|
606
|
+
onQuery: options.onQuery,
|
|
607
|
+
tracingHelper: options.tracingHelper,
|
|
608
|
+
serializer: serializeSql
|
|
609
|
+
});
|
|
599
610
|
}
|
|
600
611
|
async run(queryPlan, queryable) {
|
|
601
612
|
return this.interpretNode(queryPlan, queryable, this.#placeholderValues, this.#generators.snapshot()).catch(
|
|
@@ -646,7 +657,7 @@ var QueryInterpreter = class {
|
|
|
646
657
|
case "query": {
|
|
647
658
|
const query = renderQuery(node.args, scope, generators);
|
|
648
659
|
return this.#withQueryEvent(query, queryable, async () => {
|
|
649
|
-
return
|
|
660
|
+
return this.#serializer(await queryable.queryRaw(query));
|
|
650
661
|
});
|
|
651
662
|
}
|
|
652
663
|
case "reverse": {
|
package/dist/index.mjs
CHANGED
|
@@ -520,8 +520,8 @@ function doesRequireEvaluation(param) {
|
|
|
520
520
|
return isPrismaValuePlaceholder(param) || isPrismaValueGenerator(param);
|
|
521
521
|
}
|
|
522
522
|
|
|
523
|
-
// src/interpreter/
|
|
524
|
-
function
|
|
523
|
+
// src/interpreter/serializeSql.ts
|
|
524
|
+
function serializeSql(resultSet) {
|
|
525
525
|
return resultSet.rows.map(
|
|
526
526
|
(row) => row.reduce((acc, value, index) => {
|
|
527
527
|
const splitByDot = resultSet.columnNames[index].split(".");
|
|
@@ -543,17 +543,28 @@ function serialize(resultSet) {
|
|
|
543
543
|
}
|
|
544
544
|
|
|
545
545
|
// src/interpreter/QueryInterpreter.ts
|
|
546
|
-
var QueryInterpreter = class {
|
|
546
|
+
var QueryInterpreter = class _QueryInterpreter {
|
|
547
547
|
#transactionManager;
|
|
548
548
|
#placeholderValues;
|
|
549
549
|
#onQuery;
|
|
550
550
|
#generators = new GeneratorRegistry();
|
|
551
551
|
#tracingHelper;
|
|
552
|
-
|
|
552
|
+
#serializer;
|
|
553
|
+
constructor({ transactionManager, placeholderValues, onQuery, tracingHelper, serializer }) {
|
|
553
554
|
this.#transactionManager = transactionManager;
|
|
554
555
|
this.#placeholderValues = placeholderValues;
|
|
555
556
|
this.#onQuery = onQuery;
|
|
556
557
|
this.#tracingHelper = tracingHelper;
|
|
558
|
+
this.#serializer = serializer;
|
|
559
|
+
}
|
|
560
|
+
static forSql(options) {
|
|
561
|
+
return new _QueryInterpreter({
|
|
562
|
+
transactionManager: options.transactionManager,
|
|
563
|
+
placeholderValues: options.placeholderValues,
|
|
564
|
+
onQuery: options.onQuery,
|
|
565
|
+
tracingHelper: options.tracingHelper,
|
|
566
|
+
serializer: serializeSql
|
|
567
|
+
});
|
|
557
568
|
}
|
|
558
569
|
async run(queryPlan, queryable) {
|
|
559
570
|
return this.interpretNode(queryPlan, queryable, this.#placeholderValues, this.#generators.snapshot()).catch(
|
|
@@ -604,7 +615,7 @@ var QueryInterpreter = class {
|
|
|
604
615
|
case "query": {
|
|
605
616
|
const query = renderQuery(node.args, scope, generators);
|
|
606
617
|
return this.#withQueryEvent(query, queryable, async () => {
|
|
607
|
-
return
|
|
618
|
+
return this.#serializer(await queryable.queryRaw(query));
|
|
608
619
|
});
|
|
609
620
|
}
|
|
610
621
|
case "reverse": {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { SqlQueryable } from '@prisma/driver-adapter-utils';
|
|
1
|
+
import { SqlQueryable, SqlResultSet } from '@prisma/driver-adapter-utils';
|
|
2
2
|
import { QueryEvent } from '../events';
|
|
3
3
|
import { QueryPlanNode } from '../QueryPlan';
|
|
4
4
|
import { type TracingHelper } from '../tracing';
|
|
5
5
|
import { type TransactionManager } from '../transactionManager/TransactionManager';
|
|
6
|
+
import { Value } from './scope';
|
|
6
7
|
export type QueryInterpreterTransactionManager = {
|
|
7
8
|
enabled: true;
|
|
8
9
|
manager: TransactionManager;
|
|
@@ -14,10 +15,17 @@ export type QueryInterpreterOptions = {
|
|
|
14
15
|
placeholderValues: Record<string, unknown>;
|
|
15
16
|
onQuery?: (event: QueryEvent) => void;
|
|
16
17
|
tracingHelper: TracingHelper;
|
|
18
|
+
serializer: (results: SqlResultSet) => Value;
|
|
17
19
|
};
|
|
18
20
|
export declare class QueryInterpreter {
|
|
19
21
|
#private;
|
|
20
|
-
constructor({ transactionManager, placeholderValues, onQuery, tracingHelper }: QueryInterpreterOptions);
|
|
22
|
+
constructor({ transactionManager, placeholderValues, onQuery, tracingHelper, serializer }: QueryInterpreterOptions);
|
|
23
|
+
static forSql(options: {
|
|
24
|
+
transactionManager: QueryInterpreterTransactionManager;
|
|
25
|
+
placeholderValues: Record<string, unknown>;
|
|
26
|
+
onQuery?: (event: QueryEvent) => void;
|
|
27
|
+
tracingHelper: TracingHelper;
|
|
28
|
+
}): QueryInterpreter;
|
|
21
29
|
run(queryPlan: QueryPlanNode, queryable: SqlQueryable): Promise<unknown>;
|
|
22
30
|
private interpretNode;
|
|
23
31
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/client-engine-runtime",
|
|
3
|
-
"version": "6.7.0-dev.
|
|
3
|
+
"version": "6.7.0-dev.37",
|
|
4
4
|
"description": "This package is intended for Prisma's internal use",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"nanoid": "5.1.5",
|
|
31
31
|
"ulid": "3.0.0",
|
|
32
32
|
"uuid": "11.1.0",
|
|
33
|
-
"@prisma/
|
|
34
|
-
"@prisma/
|
|
33
|
+
"@prisma/debug": "6.7.0-dev.37",
|
|
34
|
+
"@prisma/driver-adapter-utils": "6.7.0-dev.37"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/jest": "29.5.14",
|
|
File without changes
|