@mikro-orm/core 6.5.10-dev.18 → 6.5.10-dev.19
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.
|
@@ -13,6 +13,10 @@ export declare abstract class AbstractNamingStrategy implements NamingStrategy {
|
|
|
13
13
|
* @inheritDoc
|
|
14
14
|
*/
|
|
15
15
|
getEnumClassName(columnName: string, tableName: string, schemaName?: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* @inheritDoc
|
|
18
|
+
*/
|
|
19
|
+
getEnumTypeName(columnName: string, tableName: string, schemaName?: string): string;
|
|
16
20
|
/**
|
|
17
21
|
* @inheritDoc
|
|
18
22
|
*/
|
|
@@ -53,6 +53,12 @@ class AbstractNamingStrategy {
|
|
|
53
53
|
getEnumClassName(columnName, tableName, schemaName) {
|
|
54
54
|
return this.getEntityName(`${tableName}_${columnName}`, schemaName);
|
|
55
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* @inheritDoc
|
|
58
|
+
*/
|
|
59
|
+
getEnumTypeName(columnName, tableName, schemaName) {
|
|
60
|
+
return 'T' + this.getEnumClassName(columnName, tableName, schemaName);
|
|
61
|
+
}
|
|
56
62
|
/**
|
|
57
63
|
* @inheritDoc
|
|
58
64
|
*/
|
|
@@ -26,6 +26,16 @@ export interface NamingStrategy {
|
|
|
26
26
|
* @return A new class name that will be used for the enum.
|
|
27
27
|
*/
|
|
28
28
|
getEnumClassName(columnName: string, tableName: string, schemaName?: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Get an enum type name. Used with `enumType: 'dictionary'` and `enumType: 'union-type'` entity generator option.
|
|
31
|
+
*
|
|
32
|
+
* @param columnName The column name which has the enum.
|
|
33
|
+
* @param tableName The table name of the column.
|
|
34
|
+
* @param schemaName The schema name of the column.
|
|
35
|
+
*
|
|
36
|
+
* @return A new type name that will be used for the enum.
|
|
37
|
+
*/
|
|
38
|
+
getEnumTypeName(columnName: string, tableName: string, schemaName?: string): string;
|
|
29
39
|
/**
|
|
30
40
|
* Get an enum option name for a given enum value.
|
|
31
41
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
|
-
"version": "6.5.10-dev.
|
|
3
|
+
"version": "6.5.10-dev.19",
|
|
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.10-dev.
|
|
67
|
+
"mikro-orm": "6.5.10-dev.19",
|
|
68
68
|
"reflect-metadata": "0.2.2"
|
|
69
69
|
}
|
|
70
70
|
}
|
package/typings.d.ts
CHANGED
|
@@ -577,9 +577,9 @@ export interface GenerateOptions {
|
|
|
577
577
|
undefinedDefaults?: boolean;
|
|
578
578
|
bidirectionalRelations?: boolean;
|
|
579
579
|
identifiedReferences?: boolean;
|
|
580
|
-
|
|
581
|
-
defineEntity?: boolean;
|
|
580
|
+
entityDefinition?: 'decorators' | 'defineEntity' | 'entitySchema';
|
|
582
581
|
inferEntityType?: boolean;
|
|
582
|
+
enumMode?: 'ts-enum' | 'union-type' | 'dictionary';
|
|
583
583
|
esmImport?: boolean;
|
|
584
584
|
scalarTypeInDecorator?: boolean;
|
|
585
585
|
scalarPropertiesForRelations?: 'always' | 'never' | 'smart';
|
|
@@ -594,6 +594,8 @@ export interface GenerateOptions {
|
|
|
594
594
|
coreImportsPrefix?: string;
|
|
595
595
|
onInitialMetadata?: MetadataProcessor;
|
|
596
596
|
onProcessedMetadata?: MetadataProcessor;
|
|
597
|
+
/** @deprecated use `entityDefinition: 'entitySchema'` instead */
|
|
598
|
+
entitySchema?: boolean;
|
|
597
599
|
}
|
|
598
600
|
export interface IEntityGenerator {
|
|
599
601
|
generate(options?: GenerateOptions): Promise<string[]>;
|
package/utils/Configuration.d.ts
CHANGED
|
@@ -118,6 +118,8 @@ export declare class Configuration<D extends IDatabaseDriver = IDatabaseDriver,
|
|
|
118
118
|
identifiedReferences: false;
|
|
119
119
|
scalarTypeInDecorator: false;
|
|
120
120
|
scalarPropertiesForRelations: "never";
|
|
121
|
+
entityDefinition: "decorators";
|
|
122
|
+
enumMode: "ts-enum";
|
|
121
123
|
fileName: (className: string) => string;
|
|
122
124
|
onlyPurePivotTables: false;
|
|
123
125
|
outputPurePivotTables: false;
|
package/utils/Configuration.js
CHANGED
|
@@ -112,6 +112,8 @@ class Configuration {
|
|
|
112
112
|
identifiedReferences: false,
|
|
113
113
|
scalarTypeInDecorator: false,
|
|
114
114
|
scalarPropertiesForRelations: 'never',
|
|
115
|
+
entityDefinition: 'decorators',
|
|
116
|
+
enumMode: 'ts-enum',
|
|
115
117
|
fileName: (className) => className,
|
|
116
118
|
onlyPurePivotTables: false,
|
|
117
119
|
outputPurePivotTables: false,
|
|
@@ -354,6 +356,9 @@ class Configuration {
|
|
|
354
356
|
sync() {
|
|
355
357
|
process.env.MIKRO_ORM_COLORS = '' + this.options.colors;
|
|
356
358
|
this.options.tsNode = this.options.preferTs;
|
|
359
|
+
if (this.options.entityGenerator.entitySchema) {
|
|
360
|
+
this.options.entityGenerator.entityDefinition = 'entitySchema';
|
|
361
|
+
}
|
|
357
362
|
this.logger.setDebugMode(this.options.debug);
|
|
358
363
|
}
|
|
359
364
|
/**
|