@mikro-orm/core 6.2.10-dev.84 → 6.2.10-dev.85
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 +2 -2
- package/platforms/Platform.d.ts +1 -1
- package/platforms/Platform.js +5 -1
- package/types/JsonType.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
|
-
"version": "6.2.10-dev.
|
|
3
|
+
"version": "6.2.10-dev.85",
|
|
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.2.10-dev.
|
|
67
|
+
"mikro-orm": "6.2.10-dev.85",
|
|
68
68
|
"reflect-metadata": "0.2.2"
|
|
69
69
|
}
|
|
70
70
|
}
|
package/platforms/Platform.d.ts
CHANGED
|
@@ -148,7 +148,7 @@ export declare abstract class Platform {
|
|
|
148
148
|
getFullTextIndexExpression(indexName: string, schemaName: string | undefined, tableName: string, columns: SimpleColumnMeta[]): string;
|
|
149
149
|
convertsJsonAutomatically(): boolean;
|
|
150
150
|
convertJsonToDatabaseValue(value: unknown, context?: TransformContext): unknown;
|
|
151
|
-
convertJsonToJSValue(value: unknown): unknown;
|
|
151
|
+
convertJsonToJSValue(value: unknown, prop: EntityProperty): unknown;
|
|
152
152
|
convertDateToJSValue(value: string | Date): string;
|
|
153
153
|
convertIntervalToJSValue(value: string): unknown;
|
|
154
154
|
convertIntervalToDatabaseValue(value: unknown): unknown;
|
package/platforms/Platform.js
CHANGED
|
@@ -282,7 +282,11 @@ class Platform {
|
|
|
282
282
|
convertJsonToDatabaseValue(value, context) {
|
|
283
283
|
return JSON.stringify(value);
|
|
284
284
|
}
|
|
285
|
-
convertJsonToJSValue(value) {
|
|
285
|
+
convertJsonToJSValue(value, prop) {
|
|
286
|
+
const isObjectEmbedded = prop.embedded && prop.object;
|
|
287
|
+
if ((this.convertsJsonAutomatically() || isObjectEmbedded) && ['json', 'jsonb', this.getJsonDeclarationSQL()].includes(prop.columnTypes[0])) {
|
|
288
|
+
return value;
|
|
289
|
+
}
|
|
286
290
|
return (0, Utils_1.parseJsonSafe)(value);
|
|
287
291
|
}
|
|
288
292
|
convertDateToJSValue(value) {
|
package/types/JsonType.js
CHANGED
|
@@ -16,7 +16,7 @@ class JsonType extends Type_1.Type {
|
|
|
16
16
|
return key + platform.castColumn(this.prop);
|
|
17
17
|
}
|
|
18
18
|
convertToJSValue(value, platform) {
|
|
19
|
-
return platform.convertJsonToJSValue(value);
|
|
19
|
+
return platform.convertJsonToJSValue(value, this.prop);
|
|
20
20
|
}
|
|
21
21
|
getColumnType(prop, platform) {
|
|
22
22
|
return platform.getJsonDeclarationSQL();
|