@mikro-orm/knex 6.3.7-dev.4 → 6.3.7-dev.5
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/QueryBuilderHelper.js +11 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/knex",
|
|
3
|
-
"version": "6.3.7-dev.
|
|
3
|
+
"version": "6.3.7-dev.5",
|
|
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,7 +66,7 @@
|
|
|
66
66
|
"@mikro-orm/core": "^6.3.6"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@mikro-orm/core": "6.3.7-dev.
|
|
69
|
+
"@mikro-orm/core": "6.3.7-dev.5",
|
|
70
70
|
"better-sqlite3": "*",
|
|
71
71
|
"libsql": "*",
|
|
72
72
|
"mariadb": "*"
|
|
@@ -223,22 +223,13 @@ class QueryBuilderHelper {
|
|
|
223
223
|
const alias = join.inverseAlias ?? join.alias;
|
|
224
224
|
join.cond[`${alias}.${typeProperty}`] = join.prop.targetMeta.discriminatorValue;
|
|
225
225
|
}
|
|
226
|
-
for (const key of Object.keys(join.cond)) {
|
|
227
|
-
const hasPrefix = key.includes('.') || core_1.Utils.isOperator(key) || core_1.RawQueryFragment.isKnownFragment(key);
|
|
228
|
-
const newKey = hasPrefix ? key : `${join.alias}.${key}`;
|
|
229
|
-
const clause = this.processJoinClause(newKey, join.cond[key], join.alias, params);
|
|
230
|
-
/* istanbul ignore else */
|
|
231
|
-
if (clause !== '()') {
|
|
232
|
-
conditions.push(clause);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
226
|
let sql = method + ' ';
|
|
236
227
|
if (join.nested) {
|
|
237
228
|
sql += `(${this.knex.ref(table)} as ${this.knex.ref(join.alias)}`;
|
|
238
229
|
for (const nested of join.nested) {
|
|
239
230
|
const { sql: nestedSql, params: nestedParams } = this.createJoinExpression(nested, joins, schema);
|
|
240
231
|
sql += ' ' + nestedSql;
|
|
241
|
-
params.
|
|
232
|
+
params.push(...nestedParams);
|
|
242
233
|
}
|
|
243
234
|
sql += `)`;
|
|
244
235
|
}
|
|
@@ -248,6 +239,15 @@ class QueryBuilderHelper {
|
|
|
248
239
|
else {
|
|
249
240
|
sql += `${this.knex.ref(table)} as ${this.knex.ref(join.alias)}`;
|
|
250
241
|
}
|
|
242
|
+
for (const key of Object.keys(join.cond)) {
|
|
243
|
+
const hasPrefix = key.includes('.') || core_1.Utils.isOperator(key) || core_1.RawQueryFragment.isKnownFragment(key);
|
|
244
|
+
const newKey = hasPrefix ? key : `${join.alias}.${key}`;
|
|
245
|
+
const clause = this.processJoinClause(newKey, join.cond[key], join.alias, params);
|
|
246
|
+
/* istanbul ignore else */
|
|
247
|
+
if (clause !== '()') {
|
|
248
|
+
conditions.push(clause);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
251
|
if (conditions.length > 0) {
|
|
252
252
|
sql += ` on ${conditions.join(' and ')}`;
|
|
253
253
|
}
|
|
@@ -321,7 +321,7 @@ class QueryBuilderHelper {
|
|
|
321
321
|
}
|
|
322
322
|
mapJoinColumns(type, join) {
|
|
323
323
|
if (join.prop && [core_1.ReferenceKind.MANY_TO_ONE, core_1.ReferenceKind.ONE_TO_ONE].includes(join.prop.kind)) {
|
|
324
|
-
return join.prop.fieldNames.map((
|
|
324
|
+
return join.prop.fieldNames.map((_fieldName, idx) => {
|
|
325
325
|
const columns = join.prop.owner ? join.joinColumns : join.inverseJoinColumns;
|
|
326
326
|
return this.mapper(`${join.alias}.${columns[idx]}`, type, undefined, `${join.alias}__${columns[idx]}`);
|
|
327
327
|
});
|