@mikro-orm/reflection 6.4.17-dev.40 → 6.4.17-dev.42

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.
@@ -1,5 +1,5 @@
1
1
  import { type SourceFile } from 'ts-morph';
2
- import { MetadataProvider, type EntityMetadata } from '@mikro-orm/core';
2
+ import { type EntityMetadata, MetadataProvider } from '@mikro-orm/core';
3
3
  export declare class TsMorphMetadataProvider extends MetadataProvider {
4
4
  private project;
5
5
  private sources;
@@ -60,17 +60,17 @@ class TsMorphMetadataProvider extends core_1.MetadataProvider {
60
60
  }
61
61
  initPropertyType(meta, prop) {
62
62
  const { type: typeRaw, optional } = this.readTypeFromSource(meta, prop);
63
- const type = this.cleanUpTypeTags(typeRaw);
64
- prop.type = type;
65
- prop.runtimeType = type;
63
+ prop.type = this.cleanUpTypeTags(typeRaw);
66
64
  if (optional) {
67
65
  prop.optional = true;
68
66
  }
69
67
  this.processWrapper(prop, 'Ref');
70
68
  this.processWrapper(prop, 'Reference');
69
+ this.processWrapper(prop, 'EntityRef');
70
+ this.processWrapper(prop, 'ScalarRef');
71
71
  this.processWrapper(prop, 'ScalarReference');
72
- this.processWrapper(prop, 'Ref');
73
72
  this.processWrapper(prop, 'Collection');
73
+ prop.runtimeType ??= prop.type;
74
74
  if (prop.type.replace(/import\(.*\)\./g, '').match(/^(Dictionary|Record)<.*>$/)) {
75
75
  prop.type = 'json';
76
76
  }
@@ -149,7 +149,7 @@ class TsMorphMetadataProvider extends core_1.MetadataProvider {
149
149
  return;
150
150
  }
151
151
  prop.type = m[1];
152
- if (['Ref', 'Reference', 'Ref'].includes(wrapper)) {
152
+ if (['Ref', 'Reference', 'EntityRef', 'ScalarRef', 'ScalarReference'].includes(wrapper)) {
153
153
  prop.ref = true;
154
154
  }
155
155
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/reflection",
3
- "version": "6.4.17-dev.40",
3
+ "version": "6.4.17-dev.42",
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",
@@ -65,6 +65,6 @@
65
65
  "@mikro-orm/core": "^6.4.16"
66
66
  },
67
67
  "peerDependencies": {
68
- "@mikro-orm/core": "6.4.17-dev.40"
68
+ "@mikro-orm/core": "6.4.17-dev.42"
69
69
  }
70
70
  }