@mikro-orm/core 6.5.4-dev.4 → 6.5.4-dev.6
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/Reference.js +6 -1
- package/package.json +2 -2
package/entity/Reference.js
CHANGED
|
@@ -39,10 +39,15 @@ class Reference {
|
|
|
39
39
|
}
|
|
40
40
|
static createFromPK(entityType, pk, options) {
|
|
41
41
|
const ref = this.createNakedFromPK(entityType, pk, options);
|
|
42
|
-
return (0, wrap_1.helper)(ref)
|
|
42
|
+
return (0, wrap_1.helper)(ref)?.toReference() ?? ref;
|
|
43
43
|
}
|
|
44
44
|
static createNakedFromPK(entityType, pk, options) {
|
|
45
45
|
const factory = entityType.prototype.__factory;
|
|
46
|
+
if (!factory) {
|
|
47
|
+
// this can happen only if `ref()` is used as a property initializer, and the value is important only for the
|
|
48
|
+
// inference of defaults, so it's fine to return it directly without wrapping with `Reference` class
|
|
49
|
+
return pk;
|
|
50
|
+
}
|
|
46
51
|
const entity = factory.createReference(entityType, pk, {
|
|
47
52
|
merge: false,
|
|
48
53
|
convertCustomTypes: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
|
-
"version": "6.5.4-dev.
|
|
3
|
+
"version": "6.5.4-dev.6",
|
|
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
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"esprima": "4.0.1",
|
|
65
65
|
"fs-extra": "11.3.2",
|
|
66
66
|
"globby": "11.1.0",
|
|
67
|
-
"mikro-orm": "6.5.4-dev.
|
|
67
|
+
"mikro-orm": "6.5.4-dev.6",
|
|
68
68
|
"reflect-metadata": "0.2.2"
|
|
69
69
|
}
|
|
70
70
|
}
|