@mikro-orm/core 6.4.4-dev.13 → 6.4.4-dev.14
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
|
@@ -607,6 +607,13 @@ class EntityManager {
|
|
|
607
607
|
* If the entity is already present in current context, there won't be any queries - instead, the entity data will be assigned and an explicit `flush` will be required for those changes to be persisted.
|
|
608
608
|
*/
|
|
609
609
|
async upsert(entityNameOrEntity, data, options = {}) {
|
|
610
|
+
if (options.disableIdentityMap ?? this.config.get('disableIdentityMap')) {
|
|
611
|
+
const em = this.getContext(false);
|
|
612
|
+
const fork = em.fork({ keepTransactionContext: true });
|
|
613
|
+
const ret = await fork.upsert(entityNameOrEntity, data, { ...options, disableIdentityMap: false });
|
|
614
|
+
fork.clear();
|
|
615
|
+
return ret;
|
|
616
|
+
}
|
|
610
617
|
const em = this.getContext(false);
|
|
611
618
|
em.prepareOptions(options);
|
|
612
619
|
let entityName;
|
|
@@ -731,6 +738,13 @@ class EntityManager {
|
|
|
731
738
|
* If the entity is already present in current context, there won't be any queries - instead, the entity data will be assigned and an explicit `flush` will be required for those changes to be persisted.
|
|
732
739
|
*/
|
|
733
740
|
async upsertMany(entityNameOrEntity, data, options = {}) {
|
|
741
|
+
if (options.disableIdentityMap ?? this.config.get('disableIdentityMap')) {
|
|
742
|
+
const em = this.getContext(false);
|
|
743
|
+
const fork = em.fork({ keepTransactionContext: true });
|
|
744
|
+
const ret = await fork.upsertMany(entityNameOrEntity, data, { ...options, disableIdentityMap: false });
|
|
745
|
+
fork.clear();
|
|
746
|
+
return ret;
|
|
747
|
+
}
|
|
734
748
|
const em = this.getContext(false);
|
|
735
749
|
em.prepareOptions(options);
|
|
736
750
|
let entityName;
|
|
@@ -171,6 +171,7 @@ export interface UpsertOptions<Entity, Fields extends string = never> extends Om
|
|
|
171
171
|
onConflictAction?: 'ignore' | 'merge';
|
|
172
172
|
onConflictMergeFields?: AutoPath<Entity, Fields, `${PopulatePath.ALL}`>[];
|
|
173
173
|
onConflictExcludeFields?: AutoPath<Entity, Fields, `${PopulatePath.ALL}`>[];
|
|
174
|
+
disableIdentityMap?: boolean;
|
|
174
175
|
}
|
|
175
176
|
export interface UpsertManyOptions<Entity, Fields extends string = never> extends UpsertOptions<Entity, Fields> {
|
|
176
177
|
batchSize?: number;
|
|
@@ -5,6 +5,7 @@ const enums_1 = require("../enums");
|
|
|
5
5
|
const Utils_1 = require("../utils/Utils");
|
|
6
6
|
const errors_1 = require("../errors");
|
|
7
7
|
const wrap_1 = require("./wrap");
|
|
8
|
+
const RawQueryFragment_1 = require("../utils/RawQueryFragment");
|
|
8
9
|
class EntityValidator {
|
|
9
10
|
strict;
|
|
10
11
|
KNOWN_TYPES = new Set(['string', 'number', 'boolean', 'bigint', 'Uint8Array', 'Date', 'Buffer', 'RegExp']);
|
|
@@ -54,7 +55,7 @@ class EntityValidator {
|
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
validateProperty(prop, givenValue, entity) {
|
|
57
|
-
if (givenValue
|
|
58
|
+
if (givenValue == null || givenValue instanceof RawQueryFragment_1.RawQueryFragment) {
|
|
58
59
|
return givenValue;
|
|
59
60
|
}
|
|
60
61
|
const expectedType = prop.runtimeType;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
|
-
"version": "6.4.4-dev.
|
|
3
|
+
"version": "6.4.4-dev.14",
|
|
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.3.0",
|
|
66
66
|
"globby": "11.1.0",
|
|
67
|
-
"mikro-orm": "6.4.4-dev.
|
|
67
|
+
"mikro-orm": "6.4.4-dev.14",
|
|
68
68
|
"reflect-metadata": "0.2.2"
|
|
69
69
|
}
|
|
70
70
|
}
|