@mikro-orm/core 6.4.1-dev.1 → 6.4.1-dev.11

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/EntityManager.js CHANGED
@@ -674,7 +674,6 @@ class EntityManager {
674
674
  refresh: true,
675
675
  initialized: true,
676
676
  schema: options.schema,
677
- convertCustomTypes: true,
678
677
  });
679
678
  const uniqueFields = options.onConflictFields ?? (utils_1.Utils.isPlainObject(where) ? Object.keys(where) : meta.primaryKeys);
680
679
  const returning = (0, utils_1.getOnConflictReturningFields)(meta, data, uniqueFields, options);
@@ -838,7 +837,6 @@ class EntityManager {
838
837
  refresh: true,
839
838
  initialized: true,
840
839
  schema: options.schema,
841
- convertCustomTypes: true,
842
840
  });
843
841
  if (!(0, entity_1.helper)(entity).hasPrimaryKey()) {
844
842
  loadPK.set(entity, allWhere[i]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "6.4.1-dev.1",
3
+ "version": "6.4.1-dev.11",
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.4.1-dev.1",
67
+ "mikro-orm": "6.4.1-dev.11",
68
68
  "reflect-metadata": "0.2.2"
69
69
  }
70
70
  }
@@ -6,8 +6,8 @@ import type { EntityProperty } from '../typings';
6
6
  * or numbers (safe only for values up to `Number.MAX_SAFE_INTEGER`), or strings, depending on the `mode`.
7
7
  */
8
8
  export declare class BigIntType extends Type<string | bigint | number | null | undefined, string | null | undefined> {
9
- mode?: ("bigint" | "number" | "string") | undefined;
10
- constructor(mode?: ("bigint" | "number" | "string") | undefined);
9
+ mode?: "bigint" | "number" | "string" | undefined;
10
+ constructor(mode?: "bigint" | "number" | "string" | undefined);
11
11
  convertToDatabaseValue(value: string | bigint | null | undefined): string | null | undefined;
12
12
  convertToJSValue(value: string | bigint | null | undefined): bigint | number | string | null | undefined;
13
13
  toJSON(value: string | bigint | null | undefined): string | bigint | null | undefined;
@@ -5,8 +5,8 @@ import type { EntityProperty } from '../typings';
5
5
  * Type that maps an SQL DECIMAL to a JS string or number.
6
6
  */
7
7
  export declare class DecimalType extends Type<string | number, string> {
8
- mode?: ("number" | "string") | undefined;
9
- constructor(mode?: ("number" | "string") | undefined);
8
+ mode?: "number" | "string" | undefined;
9
+ constructor(mode?: "number" | "string" | undefined);
10
10
  convertToJSValue(value: string): number | string;
11
11
  compareValues(a: string, b: string): boolean;
12
12
  private format;
@@ -359,13 +359,21 @@ class ChangeSetPersister {
359
359
  * We do need to map to the change set payload too, as it will be used in the originalEntityData for new entities.
360
360
  */
361
361
  mapReturnedValues(entity, payload, row, meta, upsert = false) {
362
- if ((this.usesReturningStatement || upsert) && row && utils_1.Utils.hasObjectKeys(row)) {
363
- const mapped = this.comparator.mapResult(meta.className, row);
364
- if (entity) {
365
- this.hydrator.hydrate(entity, meta, mapped, this.factory, 'full', false, true);
362
+ if ((!this.usesReturningStatement && !upsert) || !row || !utils_1.Utils.hasObjectKeys(row)) {
363
+ return;
364
+ }
365
+ const mapped = this.comparator.mapResult(meta.className, row);
366
+ if (entity) {
367
+ this.hydrator.hydrate(entity, meta, mapped, this.factory, 'full', false, true);
368
+ }
369
+ if (upsert) {
370
+ for (const prop of meta.props) {
371
+ if (prop.customType && prop.name in mapped) {
372
+ mapped[prop.name] = prop.customType.convertToJSValue(mapped[prop.name], this.platform);
373
+ }
366
374
  }
367
- Object.assign(payload, mapped); // merge to the changeset payload, so it gets saved to the entity snapshot
368
375
  }
376
+ Object.assign(payload, mapped);
369
377
  }
370
378
  }
371
379
  exports.ChangeSetPersister = ChangeSetPersister;