@mikro-orm/core 7.0.6-dev.9 → 7.0.7-dev.0
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
CHANGED
|
@@ -536,7 +536,7 @@ export type PropertyBuilders = {
|
|
|
536
536
|
datetime: (length?: number) => UniversalPropertyOptionsBuilder<InferPropertyValueType<typeof types.datetime>, EmptyOptions, IncludeKeysForProperty>;
|
|
537
537
|
time: (length?: number) => UniversalPropertyOptionsBuilder<InferPropertyValueType<typeof types.time>, EmptyOptions, IncludeKeysForProperty>;
|
|
538
538
|
type: <T extends PropertyValueType>(type: T) => UniversalPropertyOptionsBuilder<InferPropertyValueType<T>, EmptyOptions, IncludeKeysForProperty>;
|
|
539
|
-
enum: <const T extends (number | string)[] | (() => Dictionary)>(items?: T) => UniversalPropertyOptionsBuilder<T extends () => Dictionary ? ValueOf<ReturnType<T>> : T extends (infer Value)[] ? Value : T, EmptyOptions, IncludeKeysForEnumOptions>;
|
|
539
|
+
enum: <const T extends readonly (number | string)[] | (() => Dictionary)>(items?: T) => UniversalPropertyOptionsBuilder<T extends () => Dictionary ? ValueOf<ReturnType<T>> : T extends readonly (infer Value)[] ? Value : T, EmptyOptions, IncludeKeysForEnumOptions>;
|
|
540
540
|
embedded: <Target extends EntityTarget | EntityTarget[]>(target: Target) => PropertyChain<InferEntity<Target extends (infer T)[] ? T : Target>, EmptyOptions & {
|
|
541
541
|
kind: 'embedded';
|
|
542
542
|
}>;
|
|
@@ -14,6 +14,11 @@ export declare class MetadataProvider {
|
|
|
14
14
|
constructor(config: IConfiguration);
|
|
15
15
|
/** Resolves entity references and type information for all properties in the given metadata. */
|
|
16
16
|
loadEntityMetadata(meta: EntityMetadata): void;
|
|
17
|
+
/**
|
|
18
|
+
* Resolves the entity name for a given class or schema, respecting explicit names
|
|
19
|
+
* set via `defineEntity({ name })` + `setClass()`.
|
|
20
|
+
*/
|
|
21
|
+
private resolveEntityName;
|
|
17
22
|
/** Merges cached metadata into the given entity metadata, preserving function expressions. */
|
|
18
23
|
loadFromCache(meta: EntityMetadata, cache: EntityMetadata): void;
|
|
19
24
|
/** Whether this provider class uses metadata caching by default. */
|
|
@@ -17,10 +17,10 @@ export class MetadataProvider {
|
|
|
17
17
|
const tmp = prop.entity();
|
|
18
18
|
prop.type = Array.isArray(tmp)
|
|
19
19
|
? tmp
|
|
20
|
-
.map(t =>
|
|
20
|
+
.map(t => this.resolveEntityName(t))
|
|
21
21
|
.sort()
|
|
22
22
|
.join(' | ')
|
|
23
|
-
:
|
|
23
|
+
: this.resolveEntityName(tmp);
|
|
24
24
|
prop.target = EntitySchema.is(tmp) ? tmp.meta.class : tmp;
|
|
25
25
|
}
|
|
26
26
|
else if (!prop.type && !((prop.enum || prop.array) && (prop.items?.length ?? 0) > 0)) {
|
|
@@ -28,6 +28,20 @@ export class MetadataProvider {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Resolves the entity name for a given class or schema, respecting explicit names
|
|
33
|
+
* set via `defineEntity({ name })` + `setClass()`.
|
|
34
|
+
*/
|
|
35
|
+
resolveEntityName(entity) {
|
|
36
|
+
if (EntitySchema.is(entity)) {
|
|
37
|
+
return entity.meta.className;
|
|
38
|
+
}
|
|
39
|
+
const schema = EntitySchema.REGISTRY.get(entity);
|
|
40
|
+
if (schema) {
|
|
41
|
+
return schema.name;
|
|
42
|
+
}
|
|
43
|
+
return Utils.className(entity);
|
|
44
|
+
}
|
|
31
45
|
/** Merges cached metadata into the given entity metadata, preserving function expressions. */
|
|
32
46
|
loadFromCache(meta, cache) {
|
|
33
47
|
Object.values(cache.properties).forEach(prop => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.7-dev.0",
|
|
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/utils/Utils.js
CHANGED
|
@@ -132,7 +132,7 @@ export function parseJsonSafe(value) {
|
|
|
132
132
|
/** Collection of general-purpose utility methods used throughout the ORM. */
|
|
133
133
|
export class Utils {
|
|
134
134
|
static PK_SEPARATOR = '~~~';
|
|
135
|
-
static #ORM_VERSION = '7.0.
|
|
135
|
+
static #ORM_VERSION = '7.0.7-dev.0';
|
|
136
136
|
/**
|
|
137
137
|
* Checks if the argument is instance of `Object`. Returns false for arrays.
|
|
138
138
|
*/
|