@mikro-orm/core 6.2.10-dev.73 → 6.2.10-dev.75
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/package.json +2 -2
- package/platforms/Platform.d.ts +1 -0
- package/platforms/Platform.js +4 -1
- package/serialization/SerializationContext.d.ts +2 -2
- package/types/DateTimeType.d.ts +1 -0
- package/types/DateTimeType.js +3 -0
- package/types/DateType.d.ts +1 -0
- package/types/DateType.js +3 -0
- package/types/IntervalType.d.ts +1 -0
- package/types/IntervalType.js +3 -0
- package/types/StringType.d.ts +1 -0
- package/types/StringType.js +3 -0
- package/types/TimeType.d.ts +1 -0
- package/types/TimeType.js +3 -0
- package/types/Type.d.ts +15 -0
- package/typings.d.ts +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
|
-
"version": "6.2.10-dev.
|
|
3
|
+
"version": "6.2.10-dev.75",
|
|
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.2.0",
|
|
66
66
|
"globby": "11.1.0",
|
|
67
|
-
"mikro-orm": "6.2.10-dev.
|
|
67
|
+
"mikro-orm": "6.2.10-dev.75",
|
|
68
68
|
"reflect-metadata": "0.2.2"
|
|
69
69
|
}
|
|
70
70
|
}
|
package/platforms/Platform.d.ts
CHANGED
|
@@ -58,6 +58,7 @@ export declare abstract class Platform {
|
|
|
58
58
|
length?: number;
|
|
59
59
|
}): string;
|
|
60
60
|
getDefaultDateTimeLength(): number;
|
|
61
|
+
getDefaultVarcharLength(): number;
|
|
61
62
|
getDateTypeDeclarationSQL(length?: number): string;
|
|
62
63
|
getTimeTypeDeclarationSQL(length?: number): string;
|
|
63
64
|
getRegExpOperator(val?: unknown, flags?: string): string;
|
package/platforms/Platform.js
CHANGED
|
@@ -96,6 +96,9 @@ class Platform {
|
|
|
96
96
|
getDefaultDateTimeLength() {
|
|
97
97
|
return 0;
|
|
98
98
|
}
|
|
99
|
+
getDefaultVarcharLength() {
|
|
100
|
+
return 255;
|
|
101
|
+
}
|
|
99
102
|
getDateTypeDeclarationSQL(length) {
|
|
100
103
|
return 'date' + (length ? `(${length})` : '');
|
|
101
104
|
}
|
|
@@ -151,7 +154,7 @@ class Platform {
|
|
|
151
154
|
return 'bigint';
|
|
152
155
|
}
|
|
153
156
|
getVarcharTypeDeclarationSQL(column) {
|
|
154
|
-
return `varchar(${column.length ??
|
|
157
|
+
return `varchar(${column.length ?? this.getDefaultVarcharLength()})`;
|
|
155
158
|
}
|
|
156
159
|
getIntervalTypeDeclarationSQL(column) {
|
|
157
160
|
return 'interval' + (column.length ? `(${column.length})` : '');
|
|
@@ -5,7 +5,7 @@ import type { Configuration } from '../utils/Configuration';
|
|
|
5
5
|
* Before we process a property, we call `visit` that checks if it is not a cycle path (but allows to pass cycles that
|
|
6
6
|
* are defined in populate hint). If not, we proceed and call `leave` afterwards.
|
|
7
7
|
*/
|
|
8
|
-
export declare class SerializationContext<T> {
|
|
8
|
+
export declare class SerializationContext<T extends object> {
|
|
9
9
|
private readonly config;
|
|
10
10
|
private readonly populate;
|
|
11
11
|
private readonly fields?;
|
|
@@ -23,7 +23,7 @@ export declare class SerializationContext<T> {
|
|
|
23
23
|
/**
|
|
24
24
|
* When initializing new context, we need to propagate it to the whole entity graph recursively.
|
|
25
25
|
*/
|
|
26
|
-
static propagate(root: SerializationContext<
|
|
26
|
+
static propagate(root: SerializationContext<any>, entity: AnyEntity, isVisible: (meta: EntityMetadata, prop: string) => boolean): void;
|
|
27
27
|
isMarkedAsPopulated(entityName: string, prop: string): boolean;
|
|
28
28
|
isPartiallyLoaded(entityName: string, prop: string): boolean;
|
|
29
29
|
private register;
|
package/types/DateTimeType.d.ts
CHANGED
package/types/DateTimeType.js
CHANGED
package/types/DateType.d.ts
CHANGED
|
@@ -6,4 +6,5 @@ export declare class DateType extends Type<string | null | undefined, string | n
|
|
|
6
6
|
ensureComparable(): boolean;
|
|
7
7
|
convertToJSValue(value: any, platform: Platform): string | null | undefined;
|
|
8
8
|
getColumnType(prop: EntityProperty, platform: Platform): string;
|
|
9
|
+
getDefaultLength(platform: Platform): number;
|
|
9
10
|
}
|
package/types/DateType.js
CHANGED
package/types/IntervalType.d.ts
CHANGED
|
@@ -5,4 +5,5 @@ export declare class IntervalType extends Type<string | null | undefined, string
|
|
|
5
5
|
getColumnType(prop: EntityProperty, platform: Platform): string;
|
|
6
6
|
convertToJSValue(value: string | null | undefined, platform: Platform): string | null | undefined;
|
|
7
7
|
convertToDatabaseValue(value: string | null | undefined, platform: Platform): string | null | undefined;
|
|
8
|
+
getDefaultLength(platform: Platform): number;
|
|
8
9
|
}
|
package/types/IntervalType.js
CHANGED
|
@@ -12,5 +12,8 @@ class IntervalType extends Type_1.Type {
|
|
|
12
12
|
convertToDatabaseValue(value, platform) {
|
|
13
13
|
return platform.convertIntervalToDatabaseValue(value);
|
|
14
14
|
}
|
|
15
|
+
getDefaultLength(platform) {
|
|
16
|
+
return platform.getDefaultDateTimeLength();
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
19
|
exports.IntervalType = IntervalType;
|
package/types/StringType.d.ts
CHANGED
package/types/StringType.js
CHANGED
package/types/TimeType.d.ts
CHANGED
package/types/TimeType.js
CHANGED
package/types/Type.d.ts
CHANGED
|
@@ -58,6 +58,21 @@ export declare abstract class Type<JSType = string, DBType = JSType> {
|
|
|
58
58
|
* Gets the SQL declaration snippet for a field of this type.
|
|
59
59
|
*/
|
|
60
60
|
getColumnType(prop: EntityProperty, platform: Platform): string;
|
|
61
|
+
/**
|
|
62
|
+
* Get the default length for values of this type
|
|
63
|
+
*
|
|
64
|
+
* When doing schema generation, if neither "length" nor "columnType" option is provided,
|
|
65
|
+
* the length will be defaulted to this value.
|
|
66
|
+
*
|
|
67
|
+
* When doing entity generation, if the type is recognized to this type, and the inferred length is this value,
|
|
68
|
+
* the length option will be omitted in the output. If this method is not defined, length is always outputted
|
|
69
|
+
* based on what is in the database metadata.
|
|
70
|
+
*
|
|
71
|
+
* @param platform The platform the default will be used for.
|
|
72
|
+
*
|
|
73
|
+
* @return The default value for the given platform.
|
|
74
|
+
*/
|
|
75
|
+
getDefaultLength?(platform: Platform): number;
|
|
61
76
|
static getType<JSType, DBType = JSType, TypeClass extends Constructor<Type<JSType, DBType>> = Constructor<Type<JSType, DBType>>>(cls: TypeClass): InstanceType<TypeClass>;
|
|
62
77
|
/**
|
|
63
78
|
* Checks whether the argument is instance of `Type`.
|
package/typings.d.ts
CHANGED
|
@@ -13,9 +13,9 @@ export type Constructor<T = unknown> = new (...args: any[]) => T;
|
|
|
13
13
|
export type Dictionary<T = any> = {
|
|
14
14
|
[k: string]: T;
|
|
15
15
|
};
|
|
16
|
-
export type EntityKey<T = unknown, B extends boolean = false> = string &
|
|
17
|
-
[K in keyof T
|
|
18
|
-
};
|
|
16
|
+
export type EntityKey<T = unknown, B extends boolean = false> = string & {
|
|
17
|
+
[K in keyof T]-?: CleanKeys<T, K, B> extends never ? never : K;
|
|
18
|
+
}[keyof T];
|
|
19
19
|
export type EntityValue<T> = T[EntityKey<T>];
|
|
20
20
|
export type FilterKey<T> = keyof FilterQuery<T>;
|
|
21
21
|
export type AsyncFunction<R = any, T = Dictionary> = (args: T) => Promise<T>;
|
|
@@ -126,7 +126,7 @@ export type ExpandQuery<T> = T extends object ? T extends Scalar ? never : Filte
|
|
|
126
126
|
export type EntityProps<T> = {
|
|
127
127
|
-readonly [K in EntityKey<T>]?: T[K];
|
|
128
128
|
};
|
|
129
|
-
export type ObjectQuery<T> = OperatorMap<T> &
|
|
129
|
+
export type ObjectQuery<T> = OperatorMap<T> & FilterObject<T>;
|
|
130
130
|
export type FilterQuery<T> = ObjectQuery<T> | NonNullable<ExpandScalar<Primary<T>>> | NonNullable<EntityProps<T> & OperatorMap<T>> | FilterQuery<T>[];
|
|
131
131
|
export type QBFilterQuery<T = any> = ObjectQuery<T> | Dictionary;
|
|
132
132
|
export interface IWrappedEntity<Entity extends object> {
|