@mikro-orm/core 7.0.0-dev.294 → 7.0.0-dev.296

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.
@@ -256,7 +256,7 @@ export class DatabaseDriver {
256
256
  else {
257
257
  data[prop.fieldNames[0]] = this.mapDataToFieldNames(copy, stringifyJsonArrays, prop.embeddedProps, convertCustomTypes, true);
258
258
  }
259
- if (stringifyJsonArrays && prop.array) {
259
+ if (stringifyJsonArrays && prop.array && !object) {
260
260
  data[prop.fieldNames[0]] = this.platform.convertJsonToDatabaseValue(data[prop.fieldNames[0]]);
261
261
  }
262
262
  return;
@@ -32,14 +32,19 @@ export class EntityHelper {
32
32
  }
33
33
  const prototype = meta.prototype;
34
34
  if (!prototype.toJSON) { // toJSON can be overridden
35
- prototype.toJSON = function (...args) {
36
- // Guard against being called on the prototype itself (e.g. by serializers
37
- // walking the object graph and calling toJSON on prototype objects)
38
- if (this === prototype) {
39
- return {};
40
- }
41
- return EntityTransformer.toObject(this, ...args);
42
- };
35
+ Object.defineProperty(prototype, 'toJSON', {
36
+ value: function (...args) {
37
+ // Guard against being called on the prototype itself (e.g. by serializers
38
+ // walking the object graph and calling toJSON on prototype objects)
39
+ if (this === prototype) {
40
+ return {};
41
+ }
42
+ return EntityTransformer.toObject(this, ...args);
43
+ },
44
+ writable: true,
45
+ configurable: true,
46
+ enumerable: false,
47
+ });
43
48
  }
44
49
  }
45
50
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
3
  "type": "module",
4
- "version": "7.0.0-dev.294",
4
+ "version": "7.0.0-dev.296",
5
5
  "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.",
6
6
  "exports": {
7
7
  "./package.json": "./package.json",
package/utils/Utils.js CHANGED
@@ -123,7 +123,7 @@ export function parseJsonSafe(value) {
123
123
  }
124
124
  export class Utils {
125
125
  static PK_SEPARATOR = '~~~';
126
- static #ORM_VERSION = '7.0.0-dev.294';
126
+ static #ORM_VERSION = '7.0.0-dev.296';
127
127
  /**
128
128
  * Checks if the argument is instance of `Object`. Returns false for arrays.
129
129
  */