@mikro-orm/core 6.3.14-dev.40 → 6.3.14-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.
@@ -69,6 +69,9 @@ class EntityFactory {
69
69
  if (options.convertCustomTypes) {
70
70
  for (const prop of meta.props) {
71
71
  if (prop.customType?.ensureComparable(meta, prop) && data[prop.name]) {
72
+ if ([enums_1.ReferenceKind.ONE_TO_MANY, enums_1.ReferenceKind.MANY_TO_MANY].includes(prop.kind)) {
73
+ continue;
74
+ }
72
75
  if ([enums_1.ReferenceKind.MANY_TO_ONE, enums_1.ReferenceKind.ONE_TO_ONE].includes(prop.kind) && Utils_1.Utils.isPlainObject(data[prop.name])) {
73
76
  data[prop.name] = Utils_1.Utils.getPrimaryKeyValues(data[prop.name], prop.targetMeta.primaryKeys, true);
74
77
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "6.3.14-dev.40",
3
+ "version": "6.3.14-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",
@@ -64,7 +64,7 @@
64
64
  "esprima": "4.0.1",
65
65
  "fs-extra": "11.2.0",
66
66
  "globby": "11.1.0",
67
- "mikro-orm": "6.3.14-dev.40",
67
+ "mikro-orm": "6.3.14-dev.42",
68
68
  "reflect-metadata": "0.2.2"
69
69
  }
70
70
  }
@@ -9,6 +9,7 @@ export declare class DecimalType extends Type<string | number, string> {
9
9
  constructor(mode?: ("number" | "string") | undefined);
10
10
  convertToJSValue(value: string): number | string;
11
11
  compareValues(a: string, b: string): boolean;
12
+ private format;
12
13
  getColumnType(prop: EntityProperty, platform: Platform): string;
13
14
  compareAsType(): string;
14
15
  }
@@ -18,7 +18,15 @@ class DecimalType extends Type_1.Type {
18
18
  return value;
19
19
  }
20
20
  compareValues(a, b) {
21
- return String(a) === String(b);
21
+ return this.format(a) === this.format(b);
22
+ }
23
+ format(val) {
24
+ /* istanbul ignore next */
25
+ if (this.prop?.scale == null) {
26
+ return +val;
27
+ }
28
+ const base = Math.pow(10, this.prop.scale);
29
+ return Math.round((+val + Number.EPSILON) * base) / base;
22
30
  }
23
31
  getColumnType(prop, platform) {
24
32
  return platform.getDecimalTypeDeclarationSQL(prop);