@prisma/client-engine-runtime 6.9.0 → 6.10.0-dev.2
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 +33 -7
- package/dist/index.d.mts +35 -7
- package/dist/index.d.ts +35 -7
- package/dist/index.js +46 -7
- package/dist/index.mjs +46 -7
- package/package.json +3 -3
package/dist/QueryPlan.d.ts
CHANGED
|
@@ -100,6 +100,9 @@ export type JoinExpression = {
|
|
|
100
100
|
isRelationUnique: boolean;
|
|
101
101
|
};
|
|
102
102
|
export type QueryPlanNode = {
|
|
103
|
+
type: 'value';
|
|
104
|
+
args: PrismaValue;
|
|
105
|
+
} | {
|
|
103
106
|
type: 'seq';
|
|
104
107
|
args: QueryPlanNode[];
|
|
105
108
|
} | {
|
|
@@ -196,17 +199,40 @@ export type QueryPlanNode = {
|
|
|
196
199
|
pagination: Pagination;
|
|
197
200
|
};
|
|
198
201
|
} | {
|
|
199
|
-
type: '
|
|
202
|
+
type: 'initializeRecord';
|
|
203
|
+
args: {
|
|
204
|
+
expr: QueryPlanNode;
|
|
205
|
+
fields: Record<string, FieldInitializer>;
|
|
206
|
+
};
|
|
207
|
+
} | {
|
|
208
|
+
type: 'mapRecord';
|
|
200
209
|
args: {
|
|
201
210
|
expr: QueryPlanNode;
|
|
202
|
-
|
|
203
|
-
type: 'value';
|
|
204
|
-
value: PrismaValue;
|
|
205
|
-
} | {
|
|
206
|
-
type: 'lastInsertId';
|
|
207
|
-
}>;
|
|
211
|
+
fields: Record<string, FieldOperation>;
|
|
208
212
|
};
|
|
209
213
|
};
|
|
214
|
+
export type FieldInitializer = {
|
|
215
|
+
type: 'value';
|
|
216
|
+
value: PrismaValue;
|
|
217
|
+
} | {
|
|
218
|
+
type: 'lastInsertId';
|
|
219
|
+
};
|
|
220
|
+
export type FieldOperation = {
|
|
221
|
+
type: 'set';
|
|
222
|
+
value: PrismaValue;
|
|
223
|
+
} | {
|
|
224
|
+
type: 'add';
|
|
225
|
+
value: PrismaValue;
|
|
226
|
+
} | {
|
|
227
|
+
type: 'subtract';
|
|
228
|
+
value: PrismaValue;
|
|
229
|
+
} | {
|
|
230
|
+
type: 'multiply';
|
|
231
|
+
value: PrismaValue;
|
|
232
|
+
} | {
|
|
233
|
+
type: 'divide';
|
|
234
|
+
value: PrismaValue;
|
|
235
|
+
};
|
|
210
236
|
export type Pagination = {
|
|
211
237
|
cursor: Record<string, PrismaValue> | null;
|
|
212
238
|
take: number | null;
|
package/dist/index.d.mts
CHANGED
|
@@ -35,6 +35,30 @@ declare type ExtendedSpanOptions = SpanOptions & {
|
|
|
35
35
|
name: string;
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
+
export declare type FieldInitializer = {
|
|
39
|
+
type: 'value';
|
|
40
|
+
value: PrismaValue;
|
|
41
|
+
} | {
|
|
42
|
+
type: 'lastInsertId';
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export declare type FieldOperation = {
|
|
46
|
+
type: 'set';
|
|
47
|
+
value: PrismaValue;
|
|
48
|
+
} | {
|
|
49
|
+
type: 'add';
|
|
50
|
+
value: PrismaValue;
|
|
51
|
+
} | {
|
|
52
|
+
type: 'subtract';
|
|
53
|
+
value: PrismaValue;
|
|
54
|
+
} | {
|
|
55
|
+
type: 'multiply';
|
|
56
|
+
value: PrismaValue;
|
|
57
|
+
} | {
|
|
58
|
+
type: 'divide';
|
|
59
|
+
value: PrismaValue;
|
|
60
|
+
};
|
|
61
|
+
|
|
38
62
|
export declare type Fragment = {
|
|
39
63
|
type: 'stringChunk';
|
|
40
64
|
value: string;
|
|
@@ -191,6 +215,9 @@ export declare type QueryPlanDbQuery = {
|
|
|
191
215
|
};
|
|
192
216
|
|
|
193
217
|
export declare type QueryPlanNode = {
|
|
218
|
+
type: 'value';
|
|
219
|
+
args: PrismaValue;
|
|
220
|
+
} | {
|
|
194
221
|
type: 'seq';
|
|
195
222
|
args: QueryPlanNode[];
|
|
196
223
|
} | {
|
|
@@ -287,15 +314,16 @@ export declare type QueryPlanNode = {
|
|
|
287
314
|
pagination: Pagination;
|
|
288
315
|
};
|
|
289
316
|
} | {
|
|
290
|
-
type: '
|
|
317
|
+
type: 'initializeRecord';
|
|
318
|
+
args: {
|
|
319
|
+
expr: QueryPlanNode;
|
|
320
|
+
fields: Record<string, FieldInitializer>;
|
|
321
|
+
};
|
|
322
|
+
} | {
|
|
323
|
+
type: 'mapRecord';
|
|
291
324
|
args: {
|
|
292
325
|
expr: QueryPlanNode;
|
|
293
|
-
|
|
294
|
-
type: 'value';
|
|
295
|
-
value: PrismaValue;
|
|
296
|
-
} | {
|
|
297
|
-
type: 'lastInsertId';
|
|
298
|
-
}>;
|
|
326
|
+
fields: Record<string, FieldOperation>;
|
|
299
327
|
};
|
|
300
328
|
};
|
|
301
329
|
|
package/dist/index.d.ts
CHANGED
|
@@ -35,6 +35,30 @@ declare type ExtendedSpanOptions = SpanOptions & {
|
|
|
35
35
|
name: string;
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
+
export declare type FieldInitializer = {
|
|
39
|
+
type: 'value';
|
|
40
|
+
value: PrismaValue;
|
|
41
|
+
} | {
|
|
42
|
+
type: 'lastInsertId';
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export declare type FieldOperation = {
|
|
46
|
+
type: 'set';
|
|
47
|
+
value: PrismaValue;
|
|
48
|
+
} | {
|
|
49
|
+
type: 'add';
|
|
50
|
+
value: PrismaValue;
|
|
51
|
+
} | {
|
|
52
|
+
type: 'subtract';
|
|
53
|
+
value: PrismaValue;
|
|
54
|
+
} | {
|
|
55
|
+
type: 'multiply';
|
|
56
|
+
value: PrismaValue;
|
|
57
|
+
} | {
|
|
58
|
+
type: 'divide';
|
|
59
|
+
value: PrismaValue;
|
|
60
|
+
};
|
|
61
|
+
|
|
38
62
|
export declare type Fragment = {
|
|
39
63
|
type: 'stringChunk';
|
|
40
64
|
value: string;
|
|
@@ -191,6 +215,9 @@ export declare type QueryPlanDbQuery = {
|
|
|
191
215
|
};
|
|
192
216
|
|
|
193
217
|
export declare type QueryPlanNode = {
|
|
218
|
+
type: 'value';
|
|
219
|
+
args: PrismaValue;
|
|
220
|
+
} | {
|
|
194
221
|
type: 'seq';
|
|
195
222
|
args: QueryPlanNode[];
|
|
196
223
|
} | {
|
|
@@ -287,15 +314,16 @@ export declare type QueryPlanNode = {
|
|
|
287
314
|
pagination: Pagination;
|
|
288
315
|
};
|
|
289
316
|
} | {
|
|
290
|
-
type: '
|
|
317
|
+
type: 'initializeRecord';
|
|
318
|
+
args: {
|
|
319
|
+
expr: QueryPlanNode;
|
|
320
|
+
fields: Record<string, FieldInitializer>;
|
|
321
|
+
};
|
|
322
|
+
} | {
|
|
323
|
+
type: 'mapRecord';
|
|
291
324
|
args: {
|
|
292
325
|
expr: QueryPlanNode;
|
|
293
|
-
|
|
294
|
-
type: 'value';
|
|
295
|
-
value: PrismaValue;
|
|
296
|
-
} | {
|
|
297
|
-
type: 'lastInsertId';
|
|
298
|
-
}>;
|
|
326
|
+
fields: Record<string, FieldOperation>;
|
|
299
327
|
};
|
|
300
328
|
};
|
|
301
329
|
|
package/dist/index.js
CHANGED
|
@@ -975,6 +975,9 @@ var QueryInterpreter = class _QueryInterpreter {
|
|
|
975
975
|
}
|
|
976
976
|
async interpretNode(node, queryable, scope, generators) {
|
|
977
977
|
switch (node.type) {
|
|
978
|
+
case "value": {
|
|
979
|
+
return { value: evaluateParam(node.args, scope, generators) };
|
|
980
|
+
}
|
|
978
981
|
case "seq": {
|
|
979
982
|
let result;
|
|
980
983
|
for (const arg of node.args) {
|
|
@@ -1156,15 +1159,19 @@ var QueryInterpreter = class _QueryInterpreter {
|
|
|
1156
1159
|
}
|
|
1157
1160
|
return { value: paginate(list, node.args.pagination), lastInsertId };
|
|
1158
1161
|
}
|
|
1159
|
-
case "
|
|
1162
|
+
case "initializeRecord": {
|
|
1163
|
+
const { lastInsertId } = await this.interpretNode(node.args.expr, queryable, scope, generators);
|
|
1164
|
+
const record = {};
|
|
1165
|
+
for (const [key, initializer] of Object.entries(node.args.fields)) {
|
|
1166
|
+
record[key] = evalFieldInitializer(initializer, lastInsertId, scope, generators);
|
|
1167
|
+
}
|
|
1168
|
+
return { value: record, lastInsertId };
|
|
1169
|
+
}
|
|
1170
|
+
case "mapRecord": {
|
|
1160
1171
|
const { value, lastInsertId } = await this.interpretNode(node.args.expr, queryable, scope, generators);
|
|
1161
1172
|
const record = value === null ? {} : asRecord(value);
|
|
1162
|
-
for (const [key, entry] of Object.entries(node.args.
|
|
1163
|
-
|
|
1164
|
-
record[key] = lastInsertId;
|
|
1165
|
-
} else {
|
|
1166
|
-
record[key] = evaluateParam(entry.value, scope, generators);
|
|
1167
|
-
}
|
|
1173
|
+
for (const [key, entry] of Object.entries(node.args.fields)) {
|
|
1174
|
+
record[key] = evalFieldOperation(entry, record[key], scope, generators);
|
|
1168
1175
|
}
|
|
1169
1176
|
return { value: record, lastInsertId };
|
|
1170
1177
|
}
|
|
@@ -1256,6 +1263,38 @@ function paginate(list, { cursor, skip, take }) {
|
|
|
1256
1263
|
function getRecordKey(record, fields) {
|
|
1257
1264
|
return JSON.stringify(fields.map((field) => record[field]));
|
|
1258
1265
|
}
|
|
1266
|
+
function evalFieldInitializer(initializer, lastInsertId, scope, generators) {
|
|
1267
|
+
switch (initializer.type) {
|
|
1268
|
+
case "value":
|
|
1269
|
+
return evaluateParam(initializer.value, scope, generators);
|
|
1270
|
+
case "lastInsertId":
|
|
1271
|
+
return lastInsertId;
|
|
1272
|
+
default:
|
|
1273
|
+
assertNever(initializer, `Unexpected field initializer type: ${initializer["type"]}`);
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
function evalFieldOperation(op, value, scope, generators) {
|
|
1277
|
+
switch (op.type) {
|
|
1278
|
+
case "set":
|
|
1279
|
+
return evaluateParam(op.value, scope, generators);
|
|
1280
|
+
case "add":
|
|
1281
|
+
return asNumber(value) + asNumber(evaluateParam(op.value, scope, generators));
|
|
1282
|
+
case "subtract":
|
|
1283
|
+
return asNumber(value) - asNumber(evaluateParam(op.value, scope, generators));
|
|
1284
|
+
case "multiply":
|
|
1285
|
+
return asNumber(value) * asNumber(evaluateParam(op.value, scope, generators));
|
|
1286
|
+
case "divide": {
|
|
1287
|
+
const lhs = asNumber(value);
|
|
1288
|
+
const rhs = asNumber(evaluateParam(op.value, scope, generators));
|
|
1289
|
+
if (rhs === 0) {
|
|
1290
|
+
return null;
|
|
1291
|
+
}
|
|
1292
|
+
return lhs / rhs;
|
|
1293
|
+
}
|
|
1294
|
+
default:
|
|
1295
|
+
assertNever(op, `Unexpected field operation type: ${op["type"]}`);
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1259
1298
|
|
|
1260
1299
|
// src/transactionManager/TransactionManager.ts
|
|
1261
1300
|
var import_debug = require("@prisma/debug");
|
package/dist/index.mjs
CHANGED
|
@@ -927,6 +927,9 @@ var QueryInterpreter = class _QueryInterpreter {
|
|
|
927
927
|
}
|
|
928
928
|
async interpretNode(node, queryable, scope, generators) {
|
|
929
929
|
switch (node.type) {
|
|
930
|
+
case "value": {
|
|
931
|
+
return { value: evaluateParam(node.args, scope, generators) };
|
|
932
|
+
}
|
|
930
933
|
case "seq": {
|
|
931
934
|
let result;
|
|
932
935
|
for (const arg of node.args) {
|
|
@@ -1108,15 +1111,19 @@ var QueryInterpreter = class _QueryInterpreter {
|
|
|
1108
1111
|
}
|
|
1109
1112
|
return { value: paginate(list, node.args.pagination), lastInsertId };
|
|
1110
1113
|
}
|
|
1111
|
-
case "
|
|
1114
|
+
case "initializeRecord": {
|
|
1115
|
+
const { lastInsertId } = await this.interpretNode(node.args.expr, queryable, scope, generators);
|
|
1116
|
+
const record = {};
|
|
1117
|
+
for (const [key, initializer] of Object.entries(node.args.fields)) {
|
|
1118
|
+
record[key] = evalFieldInitializer(initializer, lastInsertId, scope, generators);
|
|
1119
|
+
}
|
|
1120
|
+
return { value: record, lastInsertId };
|
|
1121
|
+
}
|
|
1122
|
+
case "mapRecord": {
|
|
1112
1123
|
const { value, lastInsertId } = await this.interpretNode(node.args.expr, queryable, scope, generators);
|
|
1113
1124
|
const record = value === null ? {} : asRecord(value);
|
|
1114
|
-
for (const [key, entry] of Object.entries(node.args.
|
|
1115
|
-
|
|
1116
|
-
record[key] = lastInsertId;
|
|
1117
|
-
} else {
|
|
1118
|
-
record[key] = evaluateParam(entry.value, scope, generators);
|
|
1119
|
-
}
|
|
1125
|
+
for (const [key, entry] of Object.entries(node.args.fields)) {
|
|
1126
|
+
record[key] = evalFieldOperation(entry, record[key], scope, generators);
|
|
1120
1127
|
}
|
|
1121
1128
|
return { value: record, lastInsertId };
|
|
1122
1129
|
}
|
|
@@ -1208,6 +1215,38 @@ function paginate(list, { cursor, skip, take }) {
|
|
|
1208
1215
|
function getRecordKey(record, fields) {
|
|
1209
1216
|
return JSON.stringify(fields.map((field) => record[field]));
|
|
1210
1217
|
}
|
|
1218
|
+
function evalFieldInitializer(initializer, lastInsertId, scope, generators) {
|
|
1219
|
+
switch (initializer.type) {
|
|
1220
|
+
case "value":
|
|
1221
|
+
return evaluateParam(initializer.value, scope, generators);
|
|
1222
|
+
case "lastInsertId":
|
|
1223
|
+
return lastInsertId;
|
|
1224
|
+
default:
|
|
1225
|
+
assertNever(initializer, `Unexpected field initializer type: ${initializer["type"]}`);
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
function evalFieldOperation(op, value, scope, generators) {
|
|
1229
|
+
switch (op.type) {
|
|
1230
|
+
case "set":
|
|
1231
|
+
return evaluateParam(op.value, scope, generators);
|
|
1232
|
+
case "add":
|
|
1233
|
+
return asNumber(value) + asNumber(evaluateParam(op.value, scope, generators));
|
|
1234
|
+
case "subtract":
|
|
1235
|
+
return asNumber(value) - asNumber(evaluateParam(op.value, scope, generators));
|
|
1236
|
+
case "multiply":
|
|
1237
|
+
return asNumber(value) * asNumber(evaluateParam(op.value, scope, generators));
|
|
1238
|
+
case "divide": {
|
|
1239
|
+
const lhs = asNumber(value);
|
|
1240
|
+
const rhs = asNumber(evaluateParam(op.value, scope, generators));
|
|
1241
|
+
if (rhs === 0) {
|
|
1242
|
+
return null;
|
|
1243
|
+
}
|
|
1244
|
+
return lhs / rhs;
|
|
1245
|
+
}
|
|
1246
|
+
default:
|
|
1247
|
+
assertNever(op, `Unexpected field operation type: ${op["type"]}`);
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1211
1250
|
|
|
1212
1251
|
// src/transactionManager/TransactionManager.ts
|
|
1213
1252
|
import { Debug } from "@prisma/debug";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/client-engine-runtime",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.10.0-dev.2",
|
|
4
4
|
"description": "This package is intended for Prisma's internal use",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"nanoid": "5.1.5",
|
|
32
32
|
"ulid": "3.0.0",
|
|
33
33
|
"uuid": "11.1.0",
|
|
34
|
-
"@prisma/debug": "6.
|
|
35
|
-
"@prisma/driver-adapter-utils": "6.
|
|
34
|
+
"@prisma/debug": "6.10.0-dev.2",
|
|
35
|
+
"@prisma/driver-adapter-utils": "6.10.0-dev.2"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/jest": "29.5.14",
|