@mikro-orm/knex 5.8.11-dev.8 → 5.8.11-dev.9

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": "5.8.11-dev.8",
3
+ "version": "5.8.11-dev.9",
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,9 +66,9 @@
66
66
  "@mikro-orm/core": "^5.8.10"
67
67
  },
68
68
  "peerDependencies": {
69
- "@mikro-orm/core": "5.8.11-dev.8",
70
- "@mikro-orm/entity-generator": "5.8.11-dev.8",
71
- "@mikro-orm/migrations": "5.8.11-dev.8",
69
+ "@mikro-orm/core": "5.8.11-dev.9",
70
+ "@mikro-orm/entity-generator": "5.8.11-dev.9",
71
+ "@mikro-orm/migrations": "5.8.11-dev.9",
72
72
  "better-sqlite3": "*",
73
73
  "mssql": "*",
74
74
  "mysql": "*",
@@ -690,6 +690,12 @@ class QueryBuilder {
690
690
  }
691
691
  prepareFields(fields, type = 'where') {
692
692
  const ret = [];
693
+ const getFieldName = (name) => {
694
+ if (type === 'groupBy') {
695
+ return this.helper.mapper(name, this.type, undefined, null);
696
+ }
697
+ return this.helper.mapper(name, this.type);
698
+ };
693
699
  fields.forEach(field => {
694
700
  if (!core_1.Utils.isString(field)) {
695
701
  return ret.push(field);
@@ -706,19 +712,18 @@ class QueryBuilder {
706
712
  }
707
713
  if (prop?.embedded) {
708
714
  const name = this._aliases[a] ? `${a}.${prop.fieldNames[0]}` : prop.fieldNames[0];
709
- const fieldName = this.helper.mapper(name, this.type);
710
- ret.push(fieldName);
715
+ ret.push(getFieldName(name));
711
716
  return;
712
717
  }
713
718
  if (prop?.reference === core_1.ReferenceType.EMBEDDED) {
714
719
  if (prop.object) {
715
- ret.push(this.helper.mapper(prop.fieldNames[0], this.type));
720
+ ret.push(getFieldName(prop.fieldNames[0]));
716
721
  }
717
722
  else {
718
723
  const nest = (prop) => {
719
724
  for (const childProp of Object.values(prop.embeddedProps)) {
720
725
  if (childProp.fieldNames) {
721
- ret.push(this.helper.mapper(childProp.fieldNames[0], this.type));
726
+ ret.push(getFieldName(childProp.fieldNames[0]));
722
727
  }
723
728
  else {
724
729
  nest(childProp);
@@ -730,10 +735,10 @@ class QueryBuilder {
730
735
  return;
731
736
  }
732
737
  if (prop && prop.fieldNames.length > 1) {
733
- ret.push(...prop.fieldNames.map(f => this.helper.mapper(f, this.type)));
738
+ ret.push(...prop.fieldNames.map(f => getFieldName(f)));
734
739
  return;
735
740
  }
736
- ret.push(this.helper.mapper(field, this.type));
741
+ ret.push(getFieldName(field));
737
742
  });
738
743
  const meta = this.mainAlias.metadata;
739
744
  /* istanbul ignore next */