@mikro-orm/core 7.1.0-dev.19 → 7.1.0-dev.20
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 +1 -1
- package/metadata/EntitySchema.js +3 -0
- package/metadata/types.d.ts +1 -1
- package/package.json +1 -1
- package/utils/Utils.js +1 -1
package/entity/defineEntity.d.ts
CHANGED
|
@@ -589,7 +589,7 @@ export type PropertyBuilders = {
|
|
|
589
589
|
datetime: (length?: number) => UniversalPropertyOptionsBuilder<InferPropertyValueType<typeof types.datetime>, EmptyOptions, IncludeKeysForProperty>;
|
|
590
590
|
time: (length?: number) => UniversalPropertyOptionsBuilder<InferPropertyValueType<typeof types.time>, EmptyOptions, IncludeKeysForProperty>;
|
|
591
591
|
type: <T extends PropertyValueType>(type: T) => UniversalPropertyOptionsBuilder<InferPropertyValueType<T>, EmptyOptions, IncludeKeysForProperty>;
|
|
592
|
-
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>;
|
|
592
|
+
enum: <const T extends readonly (number | string)[] | Dictionary | (() => Dictionary)>(items?: T) => UniversalPropertyOptionsBuilder<T extends () => Dictionary ? ValueOf<ReturnType<T>> : T extends readonly (infer Value)[] ? Value : T extends Dictionary ? ValueOf<T> : T, EmptyOptions, IncludeKeysForEnumOptions>;
|
|
593
593
|
embedded: <Target extends EntityTarget | EntityTarget[]>(target: Target) => PropertyChain<InferEntity<Target extends (infer T)[] ? T : Target>, EmptyOptions & {
|
|
594
594
|
kind: 'embedded';
|
|
595
595
|
}>;
|
package/metadata/EntitySchema.js
CHANGED
|
@@ -85,6 +85,9 @@ export class EntitySchema {
|
|
|
85
85
|
if (options.items instanceof Function) {
|
|
86
86
|
options.items = Utils.extractEnumValues(options.items());
|
|
87
87
|
}
|
|
88
|
+
else if (options.items && !Array.isArray(options.items) && typeof options.items === 'object') {
|
|
89
|
+
options.items = Utils.extractEnumValues(options.items);
|
|
90
|
+
}
|
|
88
91
|
// enum arrays are simple numeric/string arrays, the constraint is enforced in the custom type only
|
|
89
92
|
if (options.array && !options.type) {
|
|
90
93
|
options.type = new EnumArrayType(`${this._meta.className}.${name}`, options.items);
|
package/metadata/types.d.ts
CHANGED
|
@@ -557,7 +557,7 @@ export interface EmbeddableOptions<Owner> {
|
|
|
557
557
|
abstract?: boolean;
|
|
558
558
|
}
|
|
559
559
|
export interface EnumOptions<T> extends PropertyOptions<T> {
|
|
560
|
-
items?: readonly (number | string)[] | (() => Dictionary);
|
|
560
|
+
items?: readonly (number | string)[] | Dictionary | (() => Dictionary);
|
|
561
561
|
array?: boolean;
|
|
562
562
|
/** for postgres, by default it uses text column with check constraint */
|
|
563
563
|
nativeEnumName?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
|
-
"version": "7.1.0-dev.
|
|
3
|
+
"version": "7.1.0-dev.20",
|
|
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
|
@@ -141,7 +141,7 @@ export function parseJsonSafe(value) {
|
|
|
141
141
|
/** Collection of general-purpose utility methods used throughout the ORM. */
|
|
142
142
|
export class Utils {
|
|
143
143
|
static PK_SEPARATOR = '~~~';
|
|
144
|
-
static #ORM_VERSION = '7.1.0-dev.
|
|
144
|
+
static #ORM_VERSION = '7.1.0-dev.20';
|
|
145
145
|
/**
|
|
146
146
|
* Checks if the argument is instance of `Object`. Returns false for arrays.
|
|
147
147
|
*/
|