@mikro-orm/knex 6.5.3-dev.0 → 6.5.3-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/knex",
3
- "version": "6.5.3-dev.0",
3
+ "version": "6.5.3-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,7 +66,7 @@
66
66
  "@mikro-orm/core": "^6.5.2"
67
67
  },
68
68
  "peerDependencies": {
69
- "@mikro-orm/core": "6.5.3-dev.0",
69
+ "@mikro-orm/core": "6.5.3-dev.10",
70
70
  "better-sqlite3": "*",
71
71
  "libsql": "*",
72
72
  "mariadb": "*"
@@ -70,8 +70,9 @@ class ObjectCriteriaNode extends CriteriaNode_1.CriteriaNode {
70
70
  const virtual = childNode.prop?.persist === false && !childNode.prop?.formula;
71
71
  // if key is missing, we are inside group operator and we need to prefix with alias
72
72
  const primaryKey = this.key && this.metadata.find(this.entityName).primaryKeys.includes(field);
73
+ const isToOne = childNode.prop && [core_1.ReferenceKind.MANY_TO_ONE, core_1.ReferenceKind.ONE_TO_ONE].includes(childNode.prop.kind);
73
74
  if (childNode.shouldInline(payload)) {
74
- const childAlias = qb.getAliasForJoinPath(childNode.getPath(), options);
75
+ const childAlias = qb.getAliasForJoinPath(childNode.getPath(), { preferNoBranch: isToOne, ...options });
75
76
  const a = qb.helper.isTableNameAliasRequired(qb.type) ? alias : undefined;
76
77
  this.inlineChildPayload(o, payload, field, a, childAlias);
77
78
  }
@@ -297,7 +297,7 @@ class QueryBuilderHelper {
297
297
  const replacement = this.getOperatorReplacement(operator, { [operator]: value });
298
298
  if (['$in', '$nin'].includes(operator) && Array.isArray(value)) {
299
299
  params.push(...value);
300
- return `${this.knex.ref(column)} ${replacement} (${value.map(() => '?').join(', ')})`;
300
+ return `${this.knex.ref(column)} ${replacement} (${value.map(v => Array.isArray(v) ? '(?)' : '?').join(', ')})`;
301
301
  }
302
302
  if (operator === '$exists') {
303
303
  value = null;