@mikro-orm/knex 6.4.4-dev.9 → 6.4.5-dev.0

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.9",
3
+ "version": "6.4.5-dev.0",
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.9",
69
+ "@mikro-orm/core": "6.4.5-dev.0",
70
70
  "better-sqlite3": "*",
71
71
  "libsql": "*",
72
72
  "mariadb": "*"
@@ -275,14 +275,14 @@ class QueryBuilderHelper {
275
275
  const parts = Object.keys(value).map(op => this.processJoinClause(key, value[op], alias, params, op));
276
276
  return this.wrapQueryGroup(parts);
277
277
  }
278
+ const [fromAlias, fromField] = this.splitField(key);
279
+ const prop = this.getProperty(fromField, fromAlias);
278
280
  operator = operator === '$not' ? '$eq' : operator;
279
281
  if (value === null) {
280
282
  return `${this.knex.ref(this.mapper(key))} is ${operator === '$ne' ? 'not ' : ''}null`;
281
283
  }
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), {
284
+ if (operator === '$fulltext' && prop) {
285
+ const query = this.knex.raw(this.platform.getFullTextWhereClause(prop), {
286
286
  column: this.mapper(key),
287
287
  query: this.knex.raw('?'),
288
288
  }).toSQL().toNative();
@@ -309,6 +309,9 @@ class QueryBuilderHelper {
309
309
  }
310
310
  const sql = this.mapper(key);
311
311
  if (value !== null) {
312
+ if (prop?.customType) {
313
+ value = prop.customType.convertToDatabaseValue(value, this.platform, { fromQuery: true, key, mode: 'query' });
314
+ }
312
315
  params.push(value);
313
316
  }
314
317
  return `${this.knex.ref(sql)} ${replacement} ${value === null ? 'null' : '?'}`;