@mikro-orm/knex 6.4.4-dev.8 → 6.4.4

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.4.4-dev.8",
3
+ "version": "6.4.4",
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",
@@ -63,10 +63,10 @@
63
63
  "sqlstring": "2.3.3"
64
64
  },
65
65
  "devDependencies": {
66
- "@mikro-orm/core": "^6.4.3"
66
+ "@mikro-orm/core": "^6.4.4"
67
67
  },
68
68
  "peerDependencies": {
69
- "@mikro-orm/core": "6.4.4-dev.8",
69
+ "@mikro-orm/core": "^6.0.0",
70
70
  "better-sqlite3": "*",
71
71
  "libsql": "*",
72
72
  "mariadb": "*"
@@ -187,6 +187,7 @@ class QueryBuilderHelper {
187
187
  return;
188
188
  }
189
189
  const { sql, params } = this.createJoinExpression(join, joins, schema);
190
+ // console.log(sql, params);
190
191
  qb.joinRaw(sql, params);
191
192
  });
192
193
  }
@@ -275,14 +276,14 @@ class QueryBuilderHelper {
275
276
  const parts = Object.keys(value).map(op => this.processJoinClause(key, value[op], alias, params, op));
276
277
  return this.wrapQueryGroup(parts);
277
278
  }
279
+ const [fromAlias, fromField] = this.splitField(key);
280
+ const prop = this.getProperty(fromField, fromAlias);
278
281
  operator = operator === '$not' ? '$eq' : operator;
279
282
  if (value === null) {
280
283
  return `${this.knex.ref(this.mapper(key))} is ${operator === '$ne' ? 'not ' : ''}null`;
281
284
  }
282
- if (operator === '$fulltext') {
283
- const [fromAlias, fromField] = this.splitField(key);
284
- const property = this.getProperty(fromField, fromAlias);
285
- const query = this.knex.raw(this.platform.getFullTextWhereClause(property), {
285
+ if (operator === '$fulltext' && prop) {
286
+ const query = this.knex.raw(this.platform.getFullTextWhereClause(prop), {
286
287
  column: this.mapper(key),
287
288
  query: this.knex.raw('?'),
288
289
  }).toSQL().toNative();
@@ -309,6 +310,9 @@ class QueryBuilderHelper {
309
310
  }
310
311
  const sql = this.mapper(key);
311
312
  if (value !== null) {
313
+ if (prop?.customType) {
314
+ value = prop.customType.convertToDatabaseValue(value, this.platform, { fromQuery: true, key, mode: 'query' });
315
+ }
312
316
  params.push(value);
313
317
  }
314
318
  return `${this.knex.ref(sql)} ${replacement} ${value === null ? 'null' : '?'}`;