@mikro-orm/core 7.1.14-dev.2 → 7.1.14-dev.4
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 +1 -1
- package/platforms/Platform.d.ts +3 -2
- package/platforms/Platform.js +3 -1
- package/utils/DataloaderUtils.js +2 -1
- package/utils/QueryHelper.js +5 -1
- package/utils/Utils.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
|
-
"version": "7.1.14-dev.
|
|
3
|
+
"version": "7.1.14-dev.4",
|
|
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
|
"keywords": [
|
|
6
6
|
"data-mapper",
|
package/platforms/Platform.d.ts
CHANGED
|
@@ -211,8 +211,9 @@ export declare abstract class Platform {
|
|
|
211
211
|
getBlobDeclarationSQL(): string;
|
|
212
212
|
getJsonDeclarationSQL(): string;
|
|
213
213
|
getSearchJsonPropertySQL(path: string, type: string, aliased: boolean): string | Raw;
|
|
214
|
-
|
|
215
|
-
|
|
214
|
+
/** When `aliased` is a string, it holds an explicit alias the key was prefixed with. */
|
|
215
|
+
getSearchJsonPropertyKey(path: string[], type: string, aliased: boolean | string, value?: unknown): string | Raw;
|
|
216
|
+
processJsonCondition<T extends object>(o: FilterQuery<T>, value: EntityValue<T>, path: EntityKey<T>[], alias: boolean | string): FilterQuery<T>;
|
|
216
217
|
protected getJsonValueType(value: unknown): string;
|
|
217
218
|
getJsonIndexDefinition(index: {
|
|
218
219
|
columnNames: string[];
|
package/platforms/Platform.js
CHANGED
|
@@ -413,6 +413,7 @@ export class Platform {
|
|
|
413
413
|
getSearchJsonPropertySQL(path, type, aliased) {
|
|
414
414
|
return path;
|
|
415
415
|
}
|
|
416
|
+
/** When `aliased` is a string, it holds an explicit alias the key was prefixed with. */
|
|
416
417
|
getSearchJsonPropertyKey(path, type, aliased, value) {
|
|
417
418
|
return path.join('.');
|
|
418
419
|
}
|
|
@@ -424,7 +425,8 @@ export class Platform {
|
|
|
424
425
|
return o;
|
|
425
426
|
}
|
|
426
427
|
if (path.length === 1) {
|
|
427
|
-
|
|
428
|
+
const key = typeof alias === 'string' ? `${alias}.${path[0]}` : path[0];
|
|
429
|
+
o[key] = value;
|
|
428
430
|
return o;
|
|
429
431
|
}
|
|
430
432
|
const type = this.getJsonValueType(value);
|
package/utils/DataloaderUtils.js
CHANGED
|
@@ -197,7 +197,8 @@ export class DataloaderUtils {
|
|
|
197
197
|
const prop = group[0][0].property;
|
|
198
198
|
const options = {};
|
|
199
199
|
const wrap = (cond) => ({ [prop.name]: cond });
|
|
200
|
-
|
|
200
|
+
// `findChildrenFromPivotTable` expects the `orderBy` relative to the target entity, so no wrapping here
|
|
201
|
+
const orderBy = Utils.asArray(group[0][1]?.orderBy);
|
|
201
202
|
const populate = wrap(group[0][1]?.populate);
|
|
202
203
|
const owners = group.map(c => c[0].owner);
|
|
203
204
|
const $or = [];
|
package/utils/QueryHelper.js
CHANGED
|
@@ -237,7 +237,11 @@ export class QueryHelper {
|
|
|
237
237
|
// oxfmt-ignore
|
|
238
238
|
const isJsonProperty = prop?.customType instanceof JsonType && !isRaw(value) && (Utils.isPlainObject(value) ? !['$eq', '$elemMatch'].includes(Object.keys(value)[0]) : !Array.isArray(value));
|
|
239
239
|
if (isJsonProperty && prop?.kind !== ReferenceKind.EMBEDDED) {
|
|
240
|
-
|
|
240
|
+
// an explicit alias prefix (e.g. `a.meta`) has to survive, otherwise the condition falls back to the root alias
|
|
241
|
+
const explicitAlias = key.includes('.')
|
|
242
|
+
? key.split('.').slice(0, -1).join('.')
|
|
243
|
+
: undefined;
|
|
244
|
+
return this.processJsonCondition(o, value, [prop.fieldNames[0]], platform, aliased && explicitAlias != null ? explicitAlias : aliased);
|
|
241
245
|
}
|
|
242
246
|
// oxfmt-ignore
|
|
243
247
|
if (Array.isArray(value) && !Utils.isOperator(key) && !QueryHelper.isSupportedOperator(key) && !(customExpression && Raw.getKnownFragment(key).params.length > 0) && options.type !== 'orderBy') {
|
package/utils/Utils.js
CHANGED
|
@@ -153,7 +153,7 @@ export function parseJsonSafe(value) {
|
|
|
153
153
|
/** Collection of general-purpose utility methods used throughout the ORM. */
|
|
154
154
|
export class Utils {
|
|
155
155
|
static PK_SEPARATOR = '~~~';
|
|
156
|
-
static #ORM_VERSION = '7.1.14-dev.
|
|
156
|
+
static #ORM_VERSION = '7.1.14-dev.4';
|
|
157
157
|
/**
|
|
158
158
|
* Checks if the argument is instance of `Object`. Returns false for arrays.
|
|
159
159
|
*/
|