@mikro-orm/core 7.2.9-dev.25 → 7.2.9-dev.27
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 +4 -0
- package/metadata/MetadataDiscovery.js +3 -1
- package/package.json +1 -1
- package/unit-of-work/UnitOfWork.js +1 -0
- package/utils/Utils.js +1 -1
- package/utils/clone.js +2 -1
package/EntityManager.js
CHANGED
|
@@ -1778,6 +1778,10 @@ export class EntityManager {
|
|
|
1778
1778
|
? data
|
|
1779
1779
|
: em.#entityFactory.create(entityName, data, { merge: true, ...options });
|
|
1780
1780
|
const visited = options.cascade ? (snapshotted ? new Set() : undefined) : new Set([entity]);
|
|
1781
|
+
// with `visited` set, the unit of work would skip the explicitly merged entity as if it was a cascaded one
|
|
1782
|
+
if (!options.cascade) {
|
|
1783
|
+
helper(entity).__managed = true;
|
|
1784
|
+
}
|
|
1781
1785
|
em.#unitOfWork.merge(entity, visited);
|
|
1782
1786
|
return entity;
|
|
1783
1787
|
}
|
|
@@ -1140,7 +1140,9 @@ export class MetadataDiscovery {
|
|
|
1140
1140
|
if (meta.inheritanceType !== 'tpt' || !meta.tptParent) {
|
|
1141
1141
|
meta.indexes = Utils.unique([...base.indexes, ...meta.indexes], Utils.equals);
|
|
1142
1142
|
meta.uniques = Utils.unique([...base.uniques, ...meta.uniques], Utils.equals);
|
|
1143
|
-
|
|
1143
|
+
// the STI root also collects checks bound to properties of other subtypes
|
|
1144
|
+
const baseChecks = base.checks.filter(check => !check.property || meta.properties[check.property]);
|
|
1145
|
+
meta.checks = Utils.unique([...baseChecks, ...meta.checks], Utils.equals);
|
|
1144
1146
|
meta.triggers = Utils.unique([...base.triggers, ...meta.triggers], Utils.equals);
|
|
1145
1147
|
}
|
|
1146
1148
|
// Policies pass down only from inlined abstract bases; STI children share the root table
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
|
-
"version": "7.2.9-dev.
|
|
3
|
+
"version": "7.2.9-dev.27",
|
|
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",
|
|
@@ -66,6 +66,7 @@ export class UnitOfWork {
|
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
68
|
this.#identityMap.store(entity);
|
|
69
|
+
wrapped.__managed = true;
|
|
69
70
|
// if visited is available, we are cascading, and need to be careful when resetting the entity data
|
|
70
71
|
// as there can be some entity with already changed state that is not yet flushed
|
|
71
72
|
if (wrapped.__initialized && (!visited || !wrapped.__originalEntityData)) {
|
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.9-dev.
|
|
156
|
+
static #ORM_VERSION = '7.2.9-dev.27';
|
|
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}`;
|
package/utils/clone.js
CHANGED
|
@@ -123,7 +123,8 @@ export function clone(parent, respectCustomCloneMethod = true) {
|
|
|
123
123
|
if (attrs && typeof attrs.get === 'function' && attrs.set == null) {
|
|
124
124
|
continue;
|
|
125
125
|
}
|
|
126
|
-
|
|
126
|
+
// `Reflect.get` avoids V8's for-in enum cache load, which can fall into an endless deopt/reoptimize loop here
|
|
127
|
+
child[i] = _clone(Reflect.get(parent, i));
|
|
127
128
|
}
|
|
128
129
|
const symbols = Object.getOwnPropertySymbols(parent);
|
|
129
130
|
for (let i = 0; i < symbols.length; i++) {
|