@mikro-orm/core 7.2.6-dev.39 → 7.2.6-dev.40
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/package.json +1 -1
- package/utils/EntityComparator.js +9 -0
- package/utils/Utils.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
|
-
"version": "7.2.6-dev.
|
|
3
|
+
"version": "7.2.6-dev.40",
|
|
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
|
"keywords": [
|
|
6
6
|
"data-mapper",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { clone } from './clone.js';
|
|
2
2
|
import { ReferenceKind } from '../enums.js';
|
|
3
3
|
import { compareArrays, compareBooleans, compareBuffers, compareObjects, equals, parseJsonSafe, Utils, } from './Utils.js';
|
|
4
|
+
import { DateType } from '../types/DateType.js';
|
|
4
5
|
import { JsonType } from '../types/JsonType.js';
|
|
5
6
|
import { Raw } from './RawQueryFragment.js';
|
|
6
7
|
import { EntityIdentifier } from '../entity/EntityIdentifier.js';
|
|
@@ -395,6 +396,14 @@ export class EntityComparator {
|
|
|
395
396
|
lines.push(`${padding} ${this.propName(prop.fieldNames[0], 'mapped')} = true;`);
|
|
396
397
|
lines.push(`${padding} }`);
|
|
397
398
|
}
|
|
399
|
+
else if (prop.customType instanceof DateType) {
|
|
400
|
+
// tedious returns DATE columns as `Date`, map them to the string the entity holds, so the snapshot matches it
|
|
401
|
+
context.set('convertDateToJSValue', (value) => this.#platform.convertDateToJSValue(value));
|
|
402
|
+
lines.push(`${padding} if (${defined}) {`);
|
|
403
|
+
lines.push(`${padding} ret${this.wrap(prop.name)} = ${this.propName(prop.fieldNames[0])} instanceof Date ? convertDateToJSValue(${this.propName(prop.fieldNames[0])}) : ${this.propName(prop.fieldNames[0])};`);
|
|
404
|
+
lines.push(`${padding} ${this.propName(prop.fieldNames[0], 'mapped')} = true;`);
|
|
405
|
+
lines.push(`${padding} }`);
|
|
406
|
+
}
|
|
398
407
|
else if (prop.kind === ReferenceKind.EMBEDDED && (prop.object || meta.embeddable)) {
|
|
399
408
|
const idx = this.#tmpIndex++;
|
|
400
409
|
context.set(`mapEmbeddedResult_${idx}`, (data) => {
|
package/utils/Utils.js
CHANGED
|
@@ -153,7 +153,7 @@ export function parseJsonSafe(value) {
|
|
|
153
153
|
/** Collection of general-purpose utility methods used throughout the ORM. */
|
|
154
154
|
export class Utils {
|
|
155
155
|
static PK_SEPARATOR = '~~~';
|
|
156
|
-
static #ORM_VERSION = '7.2.6-dev.
|
|
156
|
+
static #ORM_VERSION = '7.2.6-dev.40';
|
|
157
157
|
/** Default session variable name backing an RLS filter argument (`current_setting('mikro.<filter>.<arg>')`). */
|
|
158
158
|
static getRlsSettingName(filterName, argName) {
|
|
159
159
|
return `mikro.${filterName}.${argName}`;
|