@mikro-orm/core 7.0.11-dev.2 → 7.0.11-dev.4
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/entity/EntityFactory.js
CHANGED
|
@@ -139,12 +139,6 @@ export class EntityFactory {
|
|
|
139
139
|
const existsData = this.#comparator.prepareEntity(entity);
|
|
140
140
|
const originalEntityData = helper(entity).__originalEntityData ?? {};
|
|
141
141
|
const diff = this.#comparator.diffEntities(meta.class, originalEntityData, existsData);
|
|
142
|
-
// version properties are not part of entity snapshots
|
|
143
|
-
if (meta.versionProperty &&
|
|
144
|
-
data[meta.versionProperty] &&
|
|
145
|
-
data[meta.versionProperty] !== originalEntityData[meta.versionProperty]) {
|
|
146
|
-
diff[meta.versionProperty] = data[meta.versionProperty];
|
|
147
|
-
}
|
|
148
142
|
const diff2 = this.#comparator.diffEntities(meta.class, existsData, data, { includeInverseSides: true });
|
|
149
143
|
// do not override values changed by user; for uninitialized entities,
|
|
150
144
|
// the diff may include stale snapshot entries (value is undefined) — skip those
|
|
@@ -167,10 +161,11 @@ export class EntityFactory {
|
|
|
167
161
|
return diff2[key] === undefined;
|
|
168
162
|
})
|
|
169
163
|
.forEach(key => delete diff2[key]);
|
|
170
|
-
// but always add collection properties, formulas,
|
|
171
|
-
// as these are excluded from `comparableProps` and won't appear in the diff
|
|
164
|
+
// but always add collection properties, formulas, generated columns, and version properties if they
|
|
165
|
+
// are part of the `data`, as these are excluded from `comparableProps` and won't appear in the diff
|
|
172
166
|
Utils.keys(data)
|
|
173
167
|
.filter(key => meta.properties[key]?.formula ||
|
|
168
|
+
meta.properties[key]?.version ||
|
|
174
169
|
(meta.properties[key]?.generated && !meta.properties[key]?.primary) ||
|
|
175
170
|
[ReferenceKind.ONE_TO_MANY, ReferenceKind.MANY_TO_MANY].includes(meta.properties[key]?.kind))
|
|
176
171
|
.forEach(key => (diff2[key] = data[key]));
|
package/entity/EntityLoader.js
CHANGED
|
@@ -47,7 +47,12 @@ export class EntityLoader {
|
|
|
47
47
|
throw ValidationError.invalidPropertyName(entityName, invalid.field);
|
|
48
48
|
}
|
|
49
49
|
this.setSerializationContext(entities, populate, options);
|
|
50
|
+
const addedToVisited = [];
|
|
50
51
|
for (const entity of entities) {
|
|
52
|
+
if (visited.has(entity)) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
addedToVisited.push(entity);
|
|
51
56
|
visited.add(entity);
|
|
52
57
|
}
|
|
53
58
|
for (const pop of populate) {
|
|
@@ -79,7 +84,7 @@ export class EntityLoader {
|
|
|
79
84
|
});
|
|
80
85
|
}
|
|
81
86
|
}
|
|
82
|
-
for (const entity of
|
|
87
|
+
for (const entity of addedToVisited) {
|
|
83
88
|
visited.delete(entity);
|
|
84
89
|
}
|
|
85
90
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
|
-
"version": "7.0.11-dev.
|
|
3
|
+
"version": "7.0.11-dev.4",
|
|
4
4
|
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data-mapper",
|
|
@@ -327,6 +327,10 @@ export class ChangeSetPersister {
|
|
|
327
327
|
const primaryKeys = meta.primaryKeys.concat(...meta.concurrencyCheckKeys);
|
|
328
328
|
options = this.prepareOptions(meta, options, {
|
|
329
329
|
fields: primaryKeys,
|
|
330
|
+
orderBy: meta.primaryKeys.reduce((o, pk) => {
|
|
331
|
+
o[pk] = 'asc';
|
|
332
|
+
return o;
|
|
333
|
+
}, {}),
|
|
330
334
|
});
|
|
331
335
|
const res = await this.#driver.find(meta.root.class, { $or }, options);
|
|
332
336
|
if (res.length !== changeSets.length) {
|
package/utils/Utils.js
CHANGED
|
@@ -141,7 +141,7 @@ export function parseJsonSafe(value) {
|
|
|
141
141
|
/** Collection of general-purpose utility methods used throughout the ORM. */
|
|
142
142
|
export class Utils {
|
|
143
143
|
static PK_SEPARATOR = '~~~';
|
|
144
|
-
static #ORM_VERSION = '7.0.11-dev.
|
|
144
|
+
static #ORM_VERSION = '7.0.11-dev.4';
|
|
145
145
|
/**
|
|
146
146
|
* Checks if the argument is instance of `Object`. Returns false for arrays.
|
|
147
147
|
*/
|