metal-orm 1.0.96 → 1.0.97
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.cjs +7 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/orm/hydration.ts +9 -1
package/package.json
CHANGED
package/src/orm/hydration.ts
CHANGED
|
@@ -45,9 +45,17 @@ export const hydrateRows = (rows: Record<string, unknown>[], plan?: HydrationPla
|
|
|
45
45
|
return seen;
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
+
const hasRelations = plan.relations.length > 0;
|
|
49
|
+
|
|
48
50
|
for (const row of rows) {
|
|
49
51
|
const rootId = row[plan.rootPrimaryKey];
|
|
50
|
-
|
|
52
|
+
|
|
53
|
+
if (rootId === undefined || rootId === null) {
|
|
54
|
+
if (!hasRelations) {
|
|
55
|
+
rootMap.set(Symbol(), createBaseRow(row, plan));
|
|
56
|
+
}
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
51
59
|
|
|
52
60
|
const parent = getOrCreateParent(row);
|
|
53
61
|
if (!parent) continue;
|