@mikro-orm/core 6.5.8-dev.0 → 6.5.8-dev.10
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/entity/defineEntity.d.ts +246 -142
- package/entity/defineEntity.js +118 -129
- package/package.json +2 -2
- package/platforms/Platform.d.ts +1 -1
- package/platforms/Platform.js +2 -2
- package/typings.d.ts +1 -1
- package/unit-of-work/UnitOfWork.js +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
|
-
"version": "6.5.8-dev.
|
|
3
|
+
"version": "6.5.8-dev.10",
|
|
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.3.2",
|
|
66
66
|
"globby": "11.1.0",
|
|
67
|
-
"mikro-orm": "6.5.8-dev.
|
|
67
|
+
"mikro-orm": "6.5.8-dev.10",
|
|
68
68
|
"reflect-metadata": "0.2.2"
|
|
69
69
|
}
|
|
70
70
|
}
|
package/platforms/Platform.d.ts
CHANGED
|
@@ -193,7 +193,7 @@ export declare abstract class Platform {
|
|
|
193
193
|
getDefaultPrimaryName(tableName: string, columns: string[]): string;
|
|
194
194
|
supportsCustomPrimaryKeyNames(): boolean;
|
|
195
195
|
isPopulated<T>(key: string, populate: PopulateOptions<T>[] | boolean): boolean;
|
|
196
|
-
shouldHaveColumn<T>(prop: EntityProperty<T>, populate: PopulateOptions<T>[] | boolean, exclude?: string[], includeFormulas?: boolean): boolean;
|
|
196
|
+
shouldHaveColumn<T>(prop: EntityProperty<T>, populate: PopulateOptions<T>[] | boolean, exclude?: string[], includeFormulas?: boolean, ignoreInlineEmbeddables?: boolean): boolean;
|
|
197
197
|
/**
|
|
198
198
|
* Currently not supported due to how knex does complex sqlite diffing (always based on current schema)
|
|
199
199
|
*/
|
package/platforms/Platform.js
CHANGED
|
@@ -452,7 +452,7 @@ class Platform {
|
|
|
452
452
|
isPopulated(key, populate) {
|
|
453
453
|
return populate === true || (populate !== false && populate.some(p => p.field === key || p.all));
|
|
454
454
|
}
|
|
455
|
-
shouldHaveColumn(prop, populate, exclude, includeFormulas = true) {
|
|
455
|
+
shouldHaveColumn(prop, populate, exclude, includeFormulas = true, ignoreInlineEmbeddables = true) {
|
|
456
456
|
if (exclude?.includes(prop.name)) {
|
|
457
457
|
return false;
|
|
458
458
|
}
|
|
@@ -472,7 +472,7 @@ class Platform {
|
|
|
472
472
|
return true;
|
|
473
473
|
}
|
|
474
474
|
if (prop.kind === enums_1.ReferenceKind.EMBEDDED) {
|
|
475
|
-
return
|
|
475
|
+
return prop.object || ignoreInlineEmbeddables;
|
|
476
476
|
}
|
|
477
477
|
return prop.kind === enums_1.ReferenceKind.ONE_TO_ONE && prop.owner;
|
|
478
478
|
}
|
package/typings.d.ts
CHANGED
|
@@ -82,7 +82,7 @@ type PrimaryPropToType<T, Keys extends (keyof T)[]> = {
|
|
|
82
82
|
type ReadonlyPrimary<T> = T extends any[] ? Readonly<T> : T;
|
|
83
83
|
export type Primary<T> = IsAny<T> extends true ? any : T extends {
|
|
84
84
|
[PrimaryKeyProp]?: infer PK;
|
|
85
|
-
} ?
|
|
85
|
+
} ? PK extends undefined ? Omit<T, typeof PrimaryKeyProp> : PK extends keyof T ? ReadonlyPrimary<UnwrapPrimary<T[PK]>> : PK extends (keyof T)[] ? ReadonlyPrimary<PrimaryPropToType<T, PK>> : PK : T extends {
|
|
86
86
|
_id?: infer PK;
|
|
87
87
|
} ? ReadonlyPrimary<PK> | string : T extends {
|
|
88
88
|
id?: infer PK;
|
|
@@ -193,6 +193,9 @@ class UnitOfWork {
|
|
|
193
193
|
if (this.queuedActions.has(meta.className) || this.queuedActions.has(meta.root.className)) {
|
|
194
194
|
return true;
|
|
195
195
|
}
|
|
196
|
+
if (meta.discriminatorMap && Object.values(meta.discriminatorMap).some(v => this.queuedActions.has(v))) {
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
196
199
|
for (const entity of this.identityMap.getStore(meta).values()) {
|
|
197
200
|
if ((0, entity_1.helper)(entity).__initialized && (0, entity_1.helper)(entity).isTouched()) {
|
|
198
201
|
return true;
|