@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 +4 -4
- package/query/QueryBuilder.js +11 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/knex",
|
|
3
|
-
"version": "5.8.11-dev.
|
|
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.
|
|
70
|
-
"@mikro-orm/entity-generator": "5.8.11-dev.
|
|
71
|
-
"@mikro-orm/migrations": "5.8.11-dev.
|
|
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": "*",
|
package/query/QueryBuilder.js
CHANGED
|
@@ -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
|
-
|
|
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(
|
|
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(
|
|
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 =>
|
|
738
|
+
ret.push(...prop.fieldNames.map(f => getFieldName(f)));
|
|
734
739
|
return;
|
|
735
740
|
}
|
|
736
|
-
ret.push(
|
|
741
|
+
ret.push(getFieldName(field));
|
|
737
742
|
});
|
|
738
743
|
const meta = this.mainAlias.metadata;
|
|
739
744
|
/* istanbul ignore next */
|