@mikro-orm/reflection 7.1.0-dev.3 → 7.1.0-dev.30
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.
|
@@ -72,6 +72,15 @@ export class TsMorphMetadataProvider extends MetadataProvider {
|
|
|
72
72
|
this.processWrapper(prop, 'EntityRef');
|
|
73
73
|
this.processWrapper(prop, 'ScalarRef');
|
|
74
74
|
this.processWrapper(prop, 'ScalarReference');
|
|
75
|
+
// `LazyRef<T>` is a type-only marker — unwrap the type for metadata but do NOT set `ref: true`
|
|
76
|
+
// (there is no `Reference` wrapper at runtime for `LazyRef`). If the user also set `ref: true`
|
|
77
|
+
// explicitly via options, that's a contradiction — the property type promises a plain entity
|
|
78
|
+
// with PK access, but `ref: true` would produce a `Reference` wrapper at runtime.
|
|
79
|
+
const hadLazyRef = /(?:^|[.( ])LazyRef</.test(prop.type.replace(/import\(.*\)\./g, ''));
|
|
80
|
+
this.processWrapper(prop, 'LazyRef');
|
|
81
|
+
if (hadLazyRef && prop.ref) {
|
|
82
|
+
throw new MetadataError(`Property '${meta.className}.${prop.name}' is typed as 'LazyRef<T>' but also has 'ref: true' set — these are incompatible. Remove 'ref: true' to keep 'LazyRef' semantics, or change the type to 'Ref<T>'.`);
|
|
83
|
+
}
|
|
75
84
|
this.processWrapper(prop, 'Collection');
|
|
76
85
|
prop.runtimeType ??= prop.type;
|
|
77
86
|
if (/^(Dictionary|Record)<.*>$/.exec(prop.type.replace(/import\(.*\)\./g, ''))) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/reflection",
|
|
3
|
-
"version": "7.1.0-dev.
|
|
3
|
+
"version": "7.1.0-dev.30",
|
|
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",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"ts-morph": "28.0.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@mikro-orm/core": "^7.0.
|
|
53
|
+
"@mikro-orm/core": "^7.0.15"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@mikro-orm/core": "7.1.0-dev.
|
|
56
|
+
"@mikro-orm/core": "7.1.0-dev.30"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">= 22.17.0"
|