@mikro-orm/core 7.0.0-dev.334 → 7.0.0-dev.336
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/metadata/MetadataDiscovery.js +11 -2
- package/package.json +1 -1
- package/typings.d.ts +1 -0
- package/utils/Utils.js +1 -1
|
@@ -990,9 +990,13 @@ export class MetadataDiscovery {
|
|
|
990
990
|
if (properties[prop.name] && properties[prop.name].type !== prop.type) {
|
|
991
991
|
properties[prop.name].type = `${properties[prop.name].type} | ${prop.type}`;
|
|
992
992
|
properties[prop.name].runtimeType = 'any';
|
|
993
|
+
properties[prop.name].stiMerged = true;
|
|
993
994
|
return properties[prop.name];
|
|
994
995
|
}
|
|
995
|
-
|
|
996
|
+
// Deep copy to prevent mutating the original entity's property —
|
|
997
|
+
// both from the merge path above (GH #6522/#6523) and from
|
|
998
|
+
// downstream code that mutates nested arrays like fieldNames.
|
|
999
|
+
return (properties[prop.name] = Utils.copy(prop));
|
|
996
1000
|
});
|
|
997
1001
|
};
|
|
998
1002
|
const processExtensions = (meta) => {
|
|
@@ -1219,8 +1223,13 @@ export class MetadataDiscovery {
|
|
|
1219
1223
|
Object.values(meta.properties).forEach(prop => {
|
|
1220
1224
|
const newProp = { ...prop };
|
|
1221
1225
|
const rootProp = meta.root.properties[prop.name];
|
|
1226
|
+
// stiMerged is set during inlineProperties when a property was merged
|
|
1227
|
+
// from multiple polymorphic variants with different types. The flag is
|
|
1228
|
+
// cleared implicitly when the first child claims the root property via
|
|
1229
|
+
// addProperty below, so subsequent children correctly trigger renaming.
|
|
1230
|
+
const typesMatch = rootProp?.type === prop.type || rootProp?.stiMerged === true;
|
|
1222
1231
|
if (rootProp &&
|
|
1223
|
-
(
|
|
1232
|
+
(!typesMatch ||
|
|
1224
1233
|
(rootProp.fieldNames && prop.fieldNames && !compareArrays(rootProp.fieldNames, prop.fieldNames)))) {
|
|
1225
1234
|
const name = newProp.name;
|
|
1226
1235
|
this.initFieldName(newProp, newProp.object);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
|
-
"version": "7.0.0-dev.
|
|
3
|
+
"version": "7.0.0-dev.336",
|
|
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",
|
package/typings.d.ts
CHANGED
|
@@ -523,6 +523,7 @@ export interface EntityProperty<Owner = any, Target = any> {
|
|
|
523
523
|
nullable?: boolean;
|
|
524
524
|
inherited?: boolean;
|
|
525
525
|
renamedFrom?: string;
|
|
526
|
+
stiMerged?: boolean;
|
|
526
527
|
stiFieldNames?: string[];
|
|
527
528
|
stiFieldNameMap?: Dictionary<string>;
|
|
528
529
|
unsigned?: boolean;
|
package/utils/Utils.js
CHANGED
|
@@ -123,7 +123,7 @@ export function parseJsonSafe(value) {
|
|
|
123
123
|
}
|
|
124
124
|
export class Utils {
|
|
125
125
|
static PK_SEPARATOR = '~~~';
|
|
126
|
-
static #ORM_VERSION = '7.0.0-dev.
|
|
126
|
+
static #ORM_VERSION = '7.0.0-dev.336';
|
|
127
127
|
/**
|
|
128
128
|
* Checks if the argument is instance of `Object`. Returns false for arrays.
|
|
129
129
|
*/
|