@mikro-orm/knex 6.1.12-dev.0 → 6.1.12-dev.10
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/index.mjs +1 -0
- package/package.json +2 -2
- package/query/ObjectCriteriaNode.js +13 -7
- package/schema/SchemaHelper.js +6 -2
package/index.mjs
CHANGED
|
@@ -102,6 +102,7 @@ export const IntegerType = mod.IntegerType;
|
|
|
102
102
|
export const IntervalType = mod.IntervalType;
|
|
103
103
|
export const InvalidFieldNameException = mod.InvalidFieldNameException;
|
|
104
104
|
export const IsolationLevel = mod.IsolationLevel;
|
|
105
|
+
export const JSON_KEY_OPERATORS = mod.JSON_KEY_OPERATORS;
|
|
105
106
|
export const JoinType = mod.JoinType;
|
|
106
107
|
export const JsonProperty = mod.JsonProperty;
|
|
107
108
|
export const JsonType = mod.JsonType;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/knex",
|
|
3
|
-
"version": "6.1.12-dev.
|
|
3
|
+
"version": "6.1.12-dev.10",
|
|
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.1.11"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@mikro-orm/core": "6.1.12-dev.
|
|
69
|
+
"@mikro-orm/core": "6.1.12-dev.10"
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -52,6 +52,9 @@ class ObjectCriteriaNode extends CriteriaNode_1.CriteriaNode {
|
|
|
52
52
|
[core_1.Utils.getPrimaryKeyHash(primaryKeys)]: { [op]: sub.getKnexQuery() },
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
+
if ($and.length === 1) {
|
|
56
|
+
return $and[0];
|
|
57
|
+
}
|
|
55
58
|
return { $and };
|
|
56
59
|
}
|
|
57
60
|
alias = this.autoJoin(qb, ownerAlias);
|
|
@@ -155,15 +158,18 @@ class ObjectCriteriaNode extends CriteriaNode_1.CriteriaNode {
|
|
|
155
158
|
}
|
|
156
159
|
}
|
|
157
160
|
inlineCondition(key, o, value) {
|
|
158
|
-
if (key in o) {
|
|
159
|
-
const $and = o.$and ?? [];
|
|
160
|
-
$and.push({ [key]: o[key] }, { [key]: value });
|
|
161
|
-
delete o[key];
|
|
162
|
-
o.$and = $and;
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
161
|
+
if (!(key in o)) {
|
|
165
162
|
o[key] = value;
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
if (key === '$and') {
|
|
166
|
+
o.$and.push({ [key]: value });
|
|
167
|
+
return;
|
|
166
168
|
}
|
|
169
|
+
const $and = o.$and ?? [];
|
|
170
|
+
$and.push({ [key]: o[key] }, { [key]: value });
|
|
171
|
+
delete o[key];
|
|
172
|
+
o.$and = $and;
|
|
167
173
|
}
|
|
168
174
|
shouldAutoJoin(qb, nestedAlias) {
|
|
169
175
|
if (!this.prop || !this.parent) {
|
package/schema/SchemaHelper.js
CHANGED
|
@@ -187,8 +187,12 @@ class SchemaHelper {
|
|
|
187
187
|
mapForeignKeys(fks, tableName, schemaName) {
|
|
188
188
|
return fks.reduce((ret, fk) => {
|
|
189
189
|
if (ret[fk.constraint_name]) {
|
|
190
|
-
ret[fk.constraint_name].columnNames.
|
|
191
|
-
|
|
190
|
+
if (!ret[fk.constraint_name].columnNames.includes(fk.column_name)) {
|
|
191
|
+
ret[fk.constraint_name].columnNames.push(fk.column_name);
|
|
192
|
+
}
|
|
193
|
+
if (!ret[fk.constraint_name].referencedColumnNames.includes(fk.referenced_column_name)) {
|
|
194
|
+
ret[fk.constraint_name].referencedColumnNames.push(fk.referenced_column_name);
|
|
195
|
+
}
|
|
192
196
|
}
|
|
193
197
|
else {
|
|
194
198
|
ret[fk.constraint_name] = {
|