@mikro-orm/knex 6.2.7-dev.1 → 6.2.7-dev.3
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/query/ObjectCriteriaNode.js +9 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/knex",
|
|
3
|
-
"version": "6.2.7-dev.
|
|
3
|
+
"version": "6.2.7-dev.3",
|
|
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",
|
|
@@ -66,6 +66,6 @@
|
|
|
66
66
|
"@mikro-orm/core": "^6.2.6"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@mikro-orm/core": "6.2.7-dev.
|
|
69
|
+
"@mikro-orm/core": "6.2.7-dev.3"
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -115,20 +115,17 @@ class ObjectCriteriaNode extends CriteriaNode_1.CriteriaNode {
|
|
|
115
115
|
const operator = core_1.Utils.isObject(payload) && Object.keys(payload).every(k => core_1.Utils.isOperator(k, false));
|
|
116
116
|
return !!this.prop && this.prop.kind !== core_1.ReferenceKind.SCALAR && !scalar && !operator;
|
|
117
117
|
}
|
|
118
|
-
getChildKey(k, prop, childAlias) {
|
|
118
|
+
getChildKey(k, prop, childAlias, alias) {
|
|
119
119
|
const idx = prop.referencedPKs.indexOf(k);
|
|
120
|
-
return idx !== -1 && !childAlias && ![core_1.ReferenceKind.ONE_TO_MANY, core_1.ReferenceKind.MANY_TO_MANY].includes(prop.kind)
|
|
120
|
+
return idx !== -1 && !childAlias && ![core_1.ReferenceKind.ONE_TO_MANY, core_1.ReferenceKind.MANY_TO_MANY].includes(prop.kind)
|
|
121
|
+
? this.aliased(prop.joinColumns[idx], alias)
|
|
122
|
+
: k;
|
|
121
123
|
}
|
|
122
|
-
inlineArrayChildPayload(obj, payload, k, prop, childAlias) {
|
|
124
|
+
inlineArrayChildPayload(obj, payload, k, prop, childAlias, alias) {
|
|
123
125
|
const key = this.getChildKey(k, prop, childAlias);
|
|
124
126
|
const value = payload.map((child) => Object.keys(child).reduce((inner, childKey) => {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
const key = (this.isPrefixed(childKey) || core_1.Utils.isOperator(childKey)) ? childKey : this.aliased(childKey, childAlias);
|
|
130
|
-
inner[key] = child[childKey];
|
|
131
|
-
}
|
|
127
|
+
const key = (this.isPrefixed(childKey) || core_1.Utils.isOperator(childKey)) ? childKey : this.aliased(childKey, childAlias);
|
|
128
|
+
inner[key] = child[childKey];
|
|
132
129
|
return inner;
|
|
133
130
|
}, {}));
|
|
134
131
|
this.inlineCondition(key, obj, value);
|
|
@@ -142,10 +139,10 @@ class ObjectCriteriaNode extends CriteriaNode_1.CriteriaNode {
|
|
|
142
139
|
o[this.aliased(field, alias)] = { [k]: tmp, ...o[this.aliased(field, alias)] };
|
|
143
140
|
}
|
|
144
141
|
else if (core_1.Utils.isGroupOperator(k) && Array.isArray(payload[k])) {
|
|
145
|
-
this.inlineArrayChildPayload(o, payload[k], k, prop, childAlias);
|
|
142
|
+
this.inlineArrayChildPayload(o, payload[k], k, prop, childAlias, alias);
|
|
146
143
|
}
|
|
147
144
|
else if (this.isPrefixed(k) || core_1.Utils.isOperator(k) || !childAlias) {
|
|
148
|
-
const key = this.getChildKey(k, prop, childAlias);
|
|
145
|
+
const key = this.getChildKey(k, prop, childAlias, alias);
|
|
149
146
|
this.inlineCondition(key, o, payload[k]);
|
|
150
147
|
}
|
|
151
148
|
else if (core_1.RawQueryFragment.isKnownFragment(k)) {
|