@mikro-orm/core 6.3.1-dev.7 → 6.3.1-dev.9

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.
@@ -458,7 +458,7 @@ class MetadataDiscovery {
458
458
  this.initColumnType(prop);
459
459
  this.initRelation(prop);
460
460
  }
461
- meta.simplePK = pks.length === 1 && pks[0].kind === enums_1.ReferenceKind.SCALAR && !pks[0].customType;
461
+ meta.simplePK = pks.length === 1 && pks[0].kind === enums_1.ReferenceKind.SCALAR && !pks[0].customType && pks[0].runtimeType !== 'Date';
462
462
  meta.serializedPrimaryKey = this.platform.getSerializedPrimaryKeyField(meta.primaryKeys[0]);
463
463
  const serializedPKProp = meta.properties[meta.serializedPrimaryKey];
464
464
  if (serializedPKProp && meta.serializedPrimaryKey !== meta.primaryKeys[0]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "6.3.1-dev.7",
3
+ "version": "6.3.1-dev.9",
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.1-dev.7",
67
+ "mikro-orm": "6.3.1-dev.9",
68
68
  "reflect-metadata": "0.2.2"
69
69
  }
70
70
  }
package/utils/Utils.d.ts CHANGED
@@ -133,7 +133,7 @@ export declare class Utils {
133
133
  static extractPK<T extends object>(data: any, meta?: EntityMetadata<T>, strict?: boolean): Primary<T> | string | null;
134
134
  static getCompositeKeyValue<T>(data: EntityData<T>, meta: EntityMetadata<T>, convertCustomTypes?: boolean | 'convertToDatabaseValue' | 'convertToJSValue', platform?: Platform): Primary<T>;
135
135
  static getCompositeKeyHash<T>(data: EntityData<T>, meta: EntityMetadata<T>, convertCustomTypes?: boolean, platform?: Platform, flat?: boolean): string;
136
- static getPrimaryKeyHash(pks: (string | Buffer)[]): string;
136
+ static getPrimaryKeyHash(pks: (string | Buffer | Date)[]): string;
137
137
  static splitPrimaryKeys<T extends object>(key: string): EntityKey<T>[];
138
138
  static getPrimaryKeyValues<T>(entity: T, primaryKeys: string[], allowScalar?: boolean, convertCustomTypes?: boolean): any;
139
139
  static getPrimaryKeyCond<T>(entity: T, primaryKeys: EntityKey<T>[]): Record<string, Primary<T>> | null;
package/utils/Utils.js CHANGED
@@ -476,7 +476,15 @@ class Utils {
476
476
  return Utils.getPrimaryKeyHash(pks);
477
477
  }
478
478
  static getPrimaryKeyHash(pks) {
479
- return pks.map(pk => Buffer.isBuffer(pk) ? pk.toString('hex') : pk).join(this.PK_SEPARATOR);
479
+ return pks.map(pk => {
480
+ if (Buffer.isBuffer(pk)) {
481
+ return pk.toString('hex');
482
+ }
483
+ if (pk instanceof Date) {
484
+ return pk.toISOString();
485
+ }
486
+ return pk;
487
+ }).join(this.PK_SEPARATOR);
480
488
  }
481
489
  static splitPrimaryKeys(key) {
482
490
  return key.split(this.PK_SEPARATOR);