@prisma/client-engine-runtime 6.4.0-dev.36 → 6.4.0-dev.38
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 +16 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -191,7 +191,19 @@ function placeholderTypeToArgType(type) {
|
|
|
191
191
|
function serialize(resultSet) {
|
|
192
192
|
return resultSet.rows.map(
|
|
193
193
|
(row) => row.reduce((acc, value, index) => {
|
|
194
|
-
|
|
194
|
+
const splitByDot = resultSet.columnNames[index].split(".");
|
|
195
|
+
let nested = acc;
|
|
196
|
+
for (let i = 0; i < splitByDot.length; i++) {
|
|
197
|
+
const key = splitByDot[i];
|
|
198
|
+
if (i === splitByDot.length - 1) {
|
|
199
|
+
nested[key] = value;
|
|
200
|
+
} else {
|
|
201
|
+
if (nested[key] === void 0) {
|
|
202
|
+
nested[key] = {};
|
|
203
|
+
}
|
|
204
|
+
nested = nested[key];
|
|
205
|
+
}
|
|
206
|
+
}
|
|
195
207
|
return acc;
|
|
196
208
|
}, {})
|
|
197
209
|
);
|
|
@@ -278,10 +290,10 @@ var QueryInterpreter = class {
|
|
|
278
290
|
if (!Array.isArray(value)) {
|
|
279
291
|
return value;
|
|
280
292
|
}
|
|
281
|
-
if (value.length
|
|
282
|
-
throw new Error(`Expected
|
|
293
|
+
if (value.length > 1) {
|
|
294
|
+
throw new Error(`Expected zero or one element, got ${value.length}`);
|
|
283
295
|
}
|
|
284
|
-
return value[0];
|
|
296
|
+
return value[0] ?? null;
|
|
285
297
|
}
|
|
286
298
|
case "required": {
|
|
287
299
|
const value = await this.interpretNode(node.args, scope);
|