@prisma/client-engine-runtime 6.10.0 → 6.10.1-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/index.js +30 -31
- package/dist/index.mjs +30 -31
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1093,13 +1093,7 @@ var QueryInterpreter = class _QueryInterpreter {
|
|
|
1093
1093
|
childRecords: (await this.interpretNode(joinExpr.child, queryable, scope, generators)).value
|
|
1094
1094
|
}))
|
|
1095
1095
|
);
|
|
1096
|
-
|
|
1097
|
-
for (const record of parent) {
|
|
1098
|
-
attachChildrenToParent(asRecord(record), children);
|
|
1099
|
-
}
|
|
1100
|
-
return { value: parent, lastInsertId };
|
|
1101
|
-
}
|
|
1102
|
-
return { value: attachChildrenToParent(asRecord(parent), children), lastInsertId };
|
|
1096
|
+
return { value: attachChildrenToParents(parent, children), lastInsertId };
|
|
1103
1097
|
}
|
|
1104
1098
|
case "transaction": {
|
|
1105
1099
|
if (!this.#transactionManager.enabled) {
|
|
@@ -1241,34 +1235,39 @@ function mapField(value, field) {
|
|
|
1241
1235
|
}
|
|
1242
1236
|
return value;
|
|
1243
1237
|
}
|
|
1244
|
-
function
|
|
1238
|
+
function attachChildrenToParents(parentRecords, children) {
|
|
1245
1239
|
for (const { joinExpr, childRecords } of children) {
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1240
|
+
const parentKeys = joinExpr.on.map(([k]) => k);
|
|
1241
|
+
const childKeys = joinExpr.on.map(([, k]) => k);
|
|
1242
|
+
const parentMap = {};
|
|
1243
|
+
for (const parent of Array.isArray(parentRecords) ? parentRecords : [parentRecords]) {
|
|
1244
|
+
const parentRecord = asRecord(parent);
|
|
1245
|
+
const key = getRecordKey(parentRecord, parentKeys);
|
|
1246
|
+
if (!parentMap[key]) {
|
|
1247
|
+
parentMap[key] = [];
|
|
1248
|
+
}
|
|
1249
|
+
parentMap[key].push(parentRecord);
|
|
1250
|
+
if (joinExpr.isRelationUnique) {
|
|
1251
|
+
parentRecord[joinExpr.parentField] = null;
|
|
1252
|
+
} else {
|
|
1253
|
+
parentRecord[joinExpr.parentField] = [];
|
|
1254
|
+
}
|
|
1257
1255
|
}
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1256
|
+
for (const childRecord of Array.isArray(childRecords) ? childRecords : [childRecords]) {
|
|
1257
|
+
if (childRecord === null) {
|
|
1258
|
+
continue;
|
|
1259
|
+
}
|
|
1260
|
+
const key = getRecordKey(asRecord(childRecord), childKeys);
|
|
1261
|
+
for (const parentRecord of parentMap[key] ?? []) {
|
|
1262
|
+
if (joinExpr.isRelationUnique) {
|
|
1263
|
+
parentRecord[joinExpr.parentField] = childRecord;
|
|
1264
|
+
} else {
|
|
1265
|
+
parentRecord[joinExpr.parentField].push(childRecord);
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1269
1268
|
}
|
|
1270
1269
|
}
|
|
1271
|
-
return
|
|
1270
|
+
return parentRecords;
|
|
1272
1271
|
}
|
|
1273
1272
|
function paginate(list, { cursor, skip, take }) {
|
|
1274
1273
|
const cursorIndex = cursor !== null ? list.findIndex((item) => doKeysMatch(item, cursor)) : 0;
|
package/dist/index.mjs
CHANGED
|
@@ -1045,13 +1045,7 @@ var QueryInterpreter = class _QueryInterpreter {
|
|
|
1045
1045
|
childRecords: (await this.interpretNode(joinExpr.child, queryable, scope, generators)).value
|
|
1046
1046
|
}))
|
|
1047
1047
|
);
|
|
1048
|
-
|
|
1049
|
-
for (const record of parent) {
|
|
1050
|
-
attachChildrenToParent(asRecord(record), children);
|
|
1051
|
-
}
|
|
1052
|
-
return { value: parent, lastInsertId };
|
|
1053
|
-
}
|
|
1054
|
-
return { value: attachChildrenToParent(asRecord(parent), children), lastInsertId };
|
|
1048
|
+
return { value: attachChildrenToParents(parent, children), lastInsertId };
|
|
1055
1049
|
}
|
|
1056
1050
|
case "transaction": {
|
|
1057
1051
|
if (!this.#transactionManager.enabled) {
|
|
@@ -1193,34 +1187,39 @@ function mapField(value, field) {
|
|
|
1193
1187
|
}
|
|
1194
1188
|
return value;
|
|
1195
1189
|
}
|
|
1196
|
-
function
|
|
1190
|
+
function attachChildrenToParents(parentRecords, children) {
|
|
1197
1191
|
for (const { joinExpr, childRecords } of children) {
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1192
|
+
const parentKeys = joinExpr.on.map(([k]) => k);
|
|
1193
|
+
const childKeys = joinExpr.on.map(([, k]) => k);
|
|
1194
|
+
const parentMap = {};
|
|
1195
|
+
for (const parent of Array.isArray(parentRecords) ? parentRecords : [parentRecords]) {
|
|
1196
|
+
const parentRecord = asRecord(parent);
|
|
1197
|
+
const key = getRecordKey(parentRecord, parentKeys);
|
|
1198
|
+
if (!parentMap[key]) {
|
|
1199
|
+
parentMap[key] = [];
|
|
1200
|
+
}
|
|
1201
|
+
parentMap[key].push(parentRecord);
|
|
1202
|
+
if (joinExpr.isRelationUnique) {
|
|
1203
|
+
parentRecord[joinExpr.parentField] = null;
|
|
1204
|
+
} else {
|
|
1205
|
+
parentRecord[joinExpr.parentField] = [];
|
|
1206
|
+
}
|
|
1209
1207
|
}
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1208
|
+
for (const childRecord of Array.isArray(childRecords) ? childRecords : [childRecords]) {
|
|
1209
|
+
if (childRecord === null) {
|
|
1210
|
+
continue;
|
|
1211
|
+
}
|
|
1212
|
+
const key = getRecordKey(asRecord(childRecord), childKeys);
|
|
1213
|
+
for (const parentRecord of parentMap[key] ?? []) {
|
|
1214
|
+
if (joinExpr.isRelationUnique) {
|
|
1215
|
+
parentRecord[joinExpr.parentField] = childRecord;
|
|
1216
|
+
} else {
|
|
1217
|
+
parentRecord[joinExpr.parentField].push(childRecord);
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1221
1220
|
}
|
|
1222
1221
|
}
|
|
1223
|
-
return
|
|
1222
|
+
return parentRecords;
|
|
1224
1223
|
}
|
|
1225
1224
|
function paginate(list, { cursor, skip, take }) {
|
|
1226
1225
|
const cursorIndex = cursor !== null ? list.findIndex((item) => doKeysMatch(item, cursor)) : 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/client-engine-runtime",
|
|
3
|
-
"version": "6.10.
|
|
3
|
+
"version": "6.10.1-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/
|
|
35
|
-
"@prisma/
|
|
34
|
+
"@prisma/driver-adapter-utils": "6.10.1-dev.2",
|
|
35
|
+
"@prisma/debug": "6.10.1-dev.2"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/jest": "29.5.14",
|