@mikro-orm/core 7.0.0-dev.53 → 7.0.0-dev.54
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/drivers/DatabaseDriver.d.ts +1 -0
- package/drivers/DatabaseDriver.js +9 -0
- package/metadata/MetadataDiscovery.js +12 -2
- package/package.json +2 -2
- package/types/BlobType.d.ts +0 -1
- package/types/BlobType.js +0 -3
- package/types/BooleanType.d.ts +1 -0
- package/types/BooleanType.js +3 -0
- package/types/Uint8ArrayType.d.ts +0 -1
- package/types/Uint8ArrayType.js +0 -3
- package/utils/EntityComparator.d.ts +2 -2
- package/utils/EntityComparator.js +1 -0
|
@@ -48,6 +48,7 @@ export declare abstract class DatabaseDriver<C extends Connection> implements ID
|
|
|
48
48
|
setMetadata(metadata: MetadataStorage): void;
|
|
49
49
|
getMetadata(): MetadataStorage;
|
|
50
50
|
getDependencies(): string[];
|
|
51
|
+
protected isPopulated<T extends object>(meta: EntityMetadata<T>, prop: EntityProperty<T>, hint: PopulateOptions<T>, name?: string): boolean;
|
|
51
52
|
protected processCursorOptions<T extends object, P extends string>(meta: EntityMetadata<T>, options: FindOptions<T, P, any, any>, orderBy: OrderDefinition<T>): {
|
|
52
53
|
orderBy: OrderDefinition<T>[];
|
|
53
54
|
where: FilterQuery<T>;
|
|
@@ -105,6 +105,15 @@ export class DatabaseDriver {
|
|
|
105
105
|
getDependencies() {
|
|
106
106
|
return this.dependencies;
|
|
107
107
|
}
|
|
108
|
+
isPopulated(meta, prop, hint, name) {
|
|
109
|
+
if (hint.field === prop.name || hint.field === name || hint.all) {
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
if (prop.embedded && hint.children && meta.properties[prop.embedded[0]].name === hint.field) {
|
|
113
|
+
return hint.children.some(c => this.isPopulated(meta, prop, c, prop.embedded[1]));
|
|
114
|
+
}
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
108
117
|
processCursorOptions(meta, options, orderBy) {
|
|
109
118
|
const { first, last, before, after, overfetch } = options;
|
|
110
119
|
const limit = first ?? last;
|
|
@@ -1109,8 +1109,18 @@ export class MetadataDiscovery {
|
|
|
1109
1109
|
}
|
|
1110
1110
|
// `prop.type` might also be custom type class (not instance), so `typeof MyType` will give us `function`, not `object`
|
|
1111
1111
|
if (typeof prop.type === 'function' && Type.isMappedType(prop.type.prototype) && !prop.customType) {
|
|
1112
|
-
|
|
1113
|
-
|
|
1112
|
+
// if the type is an ORM defined mapped type without `ensureComparable: true`,
|
|
1113
|
+
// we use just the type name, to have more performant hydration code
|
|
1114
|
+
const type = Utils.keys(t).find(type => {
|
|
1115
|
+
return !Type.getType(t[type]).ensureComparable(meta, prop) && prop.type === t[type];
|
|
1116
|
+
});
|
|
1117
|
+
if (type) {
|
|
1118
|
+
prop.type = type === 'datetime' ? 'Date' : type;
|
|
1119
|
+
}
|
|
1120
|
+
else {
|
|
1121
|
+
prop.customType = new prop.type();
|
|
1122
|
+
prop.type = prop.customType.constructor.name;
|
|
1123
|
+
}
|
|
1114
1124
|
}
|
|
1115
1125
|
if (simple) {
|
|
1116
1126
|
return;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.0.0-dev.
|
|
4
|
+
"version": "7.0.0-dev.54",
|
|
5
5
|
"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.",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./package.json": "./package.json",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"dataloader": "2.2.3",
|
|
55
55
|
"dotenv": "17.2.3",
|
|
56
56
|
"esprima": "4.0.1",
|
|
57
|
-
"mikro-orm": "7.0.0-dev.
|
|
57
|
+
"mikro-orm": "7.0.0-dev.54",
|
|
58
58
|
"reflect-metadata": "0.2.2",
|
|
59
59
|
"tinyglobby": "0.2.13"
|
|
60
60
|
}
|
package/types/BlobType.d.ts
CHANGED
|
@@ -4,6 +4,5 @@ import type { EntityProperty } from '../typings.js';
|
|
|
4
4
|
export declare class BlobType extends Uint8ArrayType {
|
|
5
5
|
convertToJSValue(value: Buffer): Buffer | null;
|
|
6
6
|
compareAsType(): string;
|
|
7
|
-
ensureComparable(): boolean;
|
|
8
7
|
getColumnType(prop: EntityProperty, platform: Platform): string;
|
|
9
8
|
}
|
package/types/BlobType.js
CHANGED
package/types/BooleanType.d.ts
CHANGED
|
@@ -4,5 +4,6 @@ import type { EntityProperty } from '../typings.js';
|
|
|
4
4
|
export declare class BooleanType extends Type<boolean | null | undefined, boolean | null | undefined> {
|
|
5
5
|
getColumnType(prop: EntityProperty, platform: Platform): string;
|
|
6
6
|
compareAsType(): string;
|
|
7
|
+
convertToJSValue(value: boolean | null | undefined): boolean | null | undefined;
|
|
7
8
|
ensureComparable(): boolean;
|
|
8
9
|
}
|
package/types/BooleanType.js
CHANGED
|
@@ -5,6 +5,5 @@ export declare class Uint8ArrayType extends Type<Uint8Array | null> {
|
|
|
5
5
|
convertToDatabaseValue(value: Uint8Array): Buffer;
|
|
6
6
|
convertToJSValue(value: Buffer): Uint8Array | null;
|
|
7
7
|
compareAsType(): string;
|
|
8
|
-
ensureComparable(): boolean;
|
|
9
8
|
getColumnType(prop: EntityProperty, platform: Platform): string;
|
|
10
9
|
}
|
package/types/Uint8ArrayType.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EntityData, EntityDictionary, EntityMetadata, EntityProperty, IMetadataStorage } from '../typings.js';
|
|
1
|
+
import type { EntityData, EntityDictionary, EntityMetadata, EntityName, EntityProperty, IMetadataStorage } from '../typings.js';
|
|
2
2
|
import type { Platform } from '../platforms/Platform.js';
|
|
3
3
|
type Comparator<T> = (a: T, b: T, options?: {
|
|
4
4
|
includeInverseSides?: boolean;
|
|
@@ -48,7 +48,7 @@ export declare class EntityComparator {
|
|
|
48
48
|
/**
|
|
49
49
|
* @internal Highly performance-sensitive method.
|
|
50
50
|
*/
|
|
51
|
-
getSnapshotGenerator<T>(entityName:
|
|
51
|
+
getSnapshotGenerator<T>(entityName: EntityName<T>): SnapshotGenerator<T>;
|
|
52
52
|
/**
|
|
53
53
|
* @internal
|
|
54
54
|
*/
|
|
@@ -199,6 +199,7 @@ export class EntityComparator {
|
|
|
199
199
|
* @internal Highly performance-sensitive method.
|
|
200
200
|
*/
|
|
201
201
|
getSnapshotGenerator(entityName) {
|
|
202
|
+
entityName = Utils.className(entityName);
|
|
202
203
|
const exists = this.snapshotGenerators.get(entityName);
|
|
203
204
|
if (exists) {
|
|
204
205
|
return exists;
|