@mikro-orm/knex 6.1.6-dev.4 → 6.1.6-dev.6

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.
@@ -1086,9 +1086,16 @@ class AbstractSqlDriver extends core_1.DatabaseDriver {
1086
1086
  }
1087
1087
  if (propOrderBy) {
1088
1088
  for (const item of core_1.Utils.asArray(propOrderBy)) {
1089
- core_1.Utils.keys(item).forEach(field => {
1089
+ for (const field of core_1.Utils.keys(item)) {
1090
+ const rawField = core_1.RawQueryFragment.getKnownFragment(field, false);
1091
+ if (rawField) {
1092
+ const sql = propAlias ? rawField.sql.replace(new RegExp(core_1.ALIAS_REPLACEMENT_RE, 'g'), propAlias) : rawField.sql;
1093
+ const raw2 = (0, core_1.raw)(sql, rawField.params);
1094
+ orderBy.push({ [raw2.toString()]: item[field] });
1095
+ continue;
1096
+ }
1090
1097
  orderBy.push({ [`${propAlias}.${field}`]: item[field] });
1091
- });
1098
+ }
1092
1099
  }
1093
1100
  }
1094
1101
  if (hint.children) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/knex",
3
- "version": "6.1.6-dev.4",
3
+ "version": "6.1.6-dev.6",
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.5"
67
67
  },
68
68
  "peerDependencies": {
69
- "@mikro-orm/core": "6.1.6-dev.4"
69
+ "@mikro-orm/core": "6.1.6-dev.6"
70
70
  }
71
71
  }