@mikro-orm/core 6.3.9-dev.1 → 6.3.9-dev.2

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/core",
3
- "version": "6.3.9-dev.1",
3
+ "version": "6.3.9-dev.2",
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",
@@ -64,7 +64,7 @@
64
64
  "esprima": "4.0.1",
65
65
  "fs-extra": "11.2.0",
66
66
  "globby": "11.1.0",
67
- "mikro-orm": "6.3.9-dev.1",
67
+ "mikro-orm": "6.3.9-dev.2",
68
68
  "reflect-metadata": "0.2.2"
69
69
  }
70
70
  }
@@ -12,6 +12,7 @@ export declare class QueryHelper {
12
12
  static processCustomType<T extends object>(prop: EntityProperty<T>, cond: FilterQuery<T>, platform: Platform, key?: string, fromQuery?: boolean): FilterQuery<T>;
13
13
  private static isSupportedOperator;
14
14
  private static processJsonCondition;
15
+ private static getValueType;
15
16
  static findProperty<T>(fieldName: string, options: ProcessWhereOptions<T>): EntityProperty<T> | undefined;
16
17
  }
17
18
  interface ProcessWhereOptions<T> {
@@ -197,7 +197,7 @@ class QueryHelper {
197
197
  return prop.customType.convertToDatabaseValue(cond, platform, { fromQuery, key, mode: 'query' });
198
198
  }
199
199
  static isSupportedOperator(key) {
200
- return !!QueryHelper.SUPPORTED_OPERATORS.find(op => key.includes(op));
200
+ return !!QueryHelper.SUPPORTED_OPERATORS.find(op => key === op);
201
201
  }
202
202
  static processJsonCondition(o, value, path, platform, alias) {
203
203
  if (Utils_1.Utils.isPlainObject(value) && !Object.keys(value).some(k => Utils_1.Utils.isOperator(k))) {
@@ -210,12 +210,20 @@ class QueryHelper {
210
210
  o[path[0]] = value;
211
211
  return o;
212
212
  }
213
- const operatorObject = Utils_1.Utils.isPlainObject(value) && Object.keys(value).every(k => Utils_1.Utils.isOperator(k));
214
- const type = operatorObject ? typeof Object.values(value)[0] : typeof value;
213
+ const type = this.getValueType(value);
215
214
  const k = platform.getSearchJsonPropertyKey(path, type, alias, value);
216
215
  o[k] = value;
217
216
  return o;
218
217
  }
218
+ static getValueType(value) {
219
+ if (Array.isArray(value)) {
220
+ return typeof value[0];
221
+ }
222
+ if (Utils_1.Utils.isPlainObject(value) && Object.keys(value).every(k => Utils_1.Utils.isOperator(k))) {
223
+ return this.getValueType(Object.values(value)[0]);
224
+ }
225
+ return typeof value;
226
+ }
219
227
  static findProperty(fieldName, options) {
220
228
  const parts = fieldName.split('.');
221
229
  const propName = parts.pop();