@mikro-orm/core 7.0.0-dev.38 → 7.0.0-dev.39
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/EntityManager.d.ts +2 -0
- package/MikroORM.d.ts +7 -5
- package/entity/defineEntity.d.ts +35 -29
- package/index.d.ts +1 -1
- package/metadata/EntitySchema.d.ts +2 -0
- package/metadata/EntitySchema.js +6 -0
- package/package.json +2 -2
- package/typings.d.ts +7 -0
- package/utils/Configuration.d.ts +4 -2
package/EntityManager.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export declare class EntityManager<Driver extends IDatabaseDriver = IDatabaseDri
|
|
|
27
27
|
protected readonly metadata: MetadataStorage;
|
|
28
28
|
protected readonly useContext: boolean;
|
|
29
29
|
protected readonly eventManager: EventManager;
|
|
30
|
+
/** @internal */
|
|
31
|
+
readonly '~entities'?: unknown;
|
|
30
32
|
private static counter;
|
|
31
33
|
readonly _id: number;
|
|
32
34
|
readonly global = false;
|
package/MikroORM.d.ts
CHANGED
|
@@ -3,13 +3,15 @@ import { type EntitySchema } from './metadata/EntitySchema.js';
|
|
|
3
3
|
import { MetadataStorage } from './metadata/MetadataStorage.js';
|
|
4
4
|
import { Configuration, type Options } from './utils/Configuration.js';
|
|
5
5
|
import type { EntityManager } from './EntityManager.js';
|
|
6
|
-
import type { Constructor, EntityMetadata, EntityName, IEntityGenerator, IMigrator, ISeedManager } from './typings.js';
|
|
6
|
+
import type { AnyEntity, Constructor, EntityClass, EntityClassGroup, EntityMetadata, EntityName, IEntityGenerator, IMigrator, ISeedManager } from './typings.js';
|
|
7
7
|
/**
|
|
8
8
|
* Helper class for bootstrapping the MikroORM.
|
|
9
9
|
*/
|
|
10
|
-
export declare class MikroORM<Driver extends IDatabaseDriver = IDatabaseDriver, EM extends EntityManager = Driver[typeof EntityManagerType] & EntityManager> {
|
|
10
|
+
export declare class MikroORM<Driver extends IDatabaseDriver = IDatabaseDriver, EM extends EntityManager = Driver[typeof EntityManagerType] & EntityManager, Entities extends (string | EntityClass<AnyEntity> | EntityClassGroup<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntityClassGroup<AnyEntity> | EntitySchema)[]> {
|
|
11
11
|
/** The global EntityManager instance. If you are using `RequestContext` helper, it will automatically pick the request specific context under the hood */
|
|
12
|
-
em: EM
|
|
12
|
+
em: EM & {
|
|
13
|
+
'~entities'?: Entities;
|
|
14
|
+
};
|
|
13
15
|
readonly driver: Driver;
|
|
14
16
|
readonly config: Configuration<Driver>;
|
|
15
17
|
private metadata;
|
|
@@ -19,7 +21,7 @@ export declare class MikroORM<Driver extends IDatabaseDriver = IDatabaseDriver,
|
|
|
19
21
|
* Initialize the ORM, load entity metadata, create EntityManager and connect to the database.
|
|
20
22
|
* If you omit the `options` parameter, your CLI config will be used.
|
|
21
23
|
*/
|
|
22
|
-
static init<D extends IDatabaseDriver = IDatabaseDriver, EM extends EntityManager = D[typeof EntityManagerType] & EntityManager>(options?: Options<D, EM>): Promise<MikroORM<D, EM>>;
|
|
24
|
+
static init<D extends IDatabaseDriver = IDatabaseDriver, EM extends EntityManager = D[typeof EntityManagerType] & EntityManager, Entities extends (string | EntityClass<AnyEntity> | EntityClassGroup<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntityClassGroup<AnyEntity> | EntitySchema)[]>(options?: Options<D, EM, Entities>): Promise<MikroORM<D, EM, Entities>>;
|
|
23
25
|
/**
|
|
24
26
|
* Synchronous variant of the `init` method with some limitations:
|
|
25
27
|
* - database connection will be established when you first interact with the database (or you can use `orm.connect()` explicitly)
|
|
@@ -27,7 +29,7 @@ export declare class MikroORM<Driver extends IDatabaseDriver = IDatabaseDriver,
|
|
|
27
29
|
* - no support for folder based discovery
|
|
28
30
|
* - no check for mismatched package versions
|
|
29
31
|
*/
|
|
30
|
-
static initSync<D extends IDatabaseDriver = IDatabaseDriver, EM extends EntityManager = D[typeof EntityManagerType] & EntityManager>(options: Options<D, EM>): MikroORM<D, EM>;
|
|
32
|
+
static initSync<D extends IDatabaseDriver = IDatabaseDriver, EM extends EntityManager = D[typeof EntityManagerType] & EntityManager, Entities extends (string | EntityClass<AnyEntity> | EntityClassGroup<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntityClassGroup<AnyEntity> | EntitySchema)[]>(options: Options<D, EM, Entities>): MikroORM<D, EM, Entities>;
|
|
31
33
|
constructor(options: Options<Driver, EM>);
|
|
32
34
|
/**
|
|
33
35
|
* Connects to the database.
|
package/entity/defineEntity.d.ts
CHANGED
|
@@ -6,13 +6,12 @@ import type { ManyToOneOptions } from '../decorators/ManyToOne.js';
|
|
|
6
6
|
import type { OneToManyOptions } from '../decorators/OneToMany.js';
|
|
7
7
|
import type { OneToOneOptions } from '../decorators/OneToOne.js';
|
|
8
8
|
import type { ManyToManyOptions } from '../decorators/ManyToMany.js';
|
|
9
|
-
import type { AnyString, GeneratedColumnCallback, Constructor, CheckCallback, FilterQuery, EntityName, Dictionary, EntityMetadata, PrimaryKeyProp, Hidden, Opt, Primary, EntityClass } from '../typings.js';
|
|
9
|
+
import type { AnyString, GeneratedColumnCallback, Constructor, CheckCallback, FilterQuery, EntityName, Dictionary, EntityMetadata, PrimaryKeyProp, Hidden, Opt, Primary, EntityClass, EntitySchemaWithMeta, InferEntity, MaybeReturnType } from '../typings.js';
|
|
10
10
|
import type { Reference, ScalarReference } from './Reference.js';
|
|
11
11
|
import type { SerializeOptions } from '../serialization/EntitySerializer.js';
|
|
12
12
|
import type { Cascade, DeferMode, EventType, LoadStrategy, QueryOrderMap } from '../enums.js';
|
|
13
13
|
import type { IType, Type } from '../types/Type.js';
|
|
14
14
|
import { types } from '../types/index.js';
|
|
15
|
-
import { EntitySchema } from '../metadata/EntitySchema.js';
|
|
16
15
|
import type { Collection } from './Collection.js';
|
|
17
16
|
import type { EventSubscriber } from '../events/EventSubscriber.js';
|
|
18
17
|
export type UniversalPropertyKeys = keyof PropertyOptions<any> | keyof EnumOptions<any> | keyof EmbeddedOptions<any, any> | keyof ReferenceOptions<any, any> | keyof ManyToOneOptions<any, any> | keyof OneToManyOptions<any, any> | keyof OneToOneOptions<any, any> | keyof ManyToManyOptions<any, any>;
|
|
@@ -52,13 +51,17 @@ export declare class UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys
|
|
|
52
51
|
/**
|
|
53
52
|
* Alias for `fieldName`.
|
|
54
53
|
*/
|
|
55
|
-
name(name:
|
|
54
|
+
name<T extends string>(name: T): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'fieldName'> & {
|
|
55
|
+
fieldName: T;
|
|
56
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
56
57
|
/**
|
|
57
58
|
* Specify database column name for this property.
|
|
58
59
|
*
|
|
59
60
|
* @see https://mikro-orm.io/docs/naming-strategy
|
|
60
61
|
*/
|
|
61
|
-
fieldName(fieldName:
|
|
62
|
+
fieldName<T extends string>(fieldName: T): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'fieldName'> & {
|
|
63
|
+
fieldName: T;
|
|
64
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
62
65
|
/**
|
|
63
66
|
* Specify database column names for this property.
|
|
64
67
|
* Same as `fieldName` but for composite FKs.
|
|
@@ -314,7 +317,9 @@ export declare class UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys
|
|
|
314
317
|
/** Override the default loading strategy for this property. This option has precedence over the global `loadStrategy`, but can be overridden by `FindOptions.strategy`. */
|
|
315
318
|
strategy(strategy: LoadStrategy | `${LoadStrategy}`): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
316
319
|
/** Set this side as owning. Owning side is where the foreign key is defined. This option is not required if you use `inversedBy` or `mappedBy` to distinguish owning and inverse side. */
|
|
317
|
-
owner(owner?:
|
|
320
|
+
owner<T extends boolean = true>(owner?: T): Pick<UniversalPropertyOptionsBuilder<Value, Omit<Options, 'owner'> & {
|
|
321
|
+
owner: T;
|
|
322
|
+
}, IncludeKeys>, IncludeKeys>;
|
|
318
323
|
/** Point to the inverse side property name. */
|
|
319
324
|
inversedBy(inversedBy: keyof Value | ((e: Value) => any)): Pick<UniversalPropertyOptionsBuilder<Value, Options, IncludeKeys>, IncludeKeys>;
|
|
320
325
|
/** Point to the owning side property name. */
|
|
@@ -383,15 +388,15 @@ declare const propertyBuilders: {
|
|
|
383
388
|
time: (length?: number) => UniversalPropertyOptionsBuilder<any, EmptyOptions, IncludeKeysForProperty>;
|
|
384
389
|
type: <T extends PropertyValueType>(type: T) => UniversalPropertyOptionsBuilder<InferPropertyValueType<T>, EmptyOptions, IncludeKeysForProperty>;
|
|
385
390
|
enum: <const T extends (number | string)[] | (() => Dictionary)>(items?: T) => UniversalPropertyOptionsBuilder<T extends () => Dictionary ? ValueOf<ReturnType<T>> : T extends (infer Value)[] ? Value : T, EmptyOptions, IncludeKeysForEnumOptions>;
|
|
386
|
-
embedded: <Target extends
|
|
387
|
-
manyToMany: <Target extends
|
|
391
|
+
embedded: <Target extends EntitySchemaWithMeta<any, any, any, any, any> | EntityClass<any> | EntitySchemaWithMeta<any, any, any, any, any>[] | EntityClass<any>[]>(target: Target) => UniversalPropertyOptionsBuilder<InferEntity<Target extends (infer T)[] ? T : Target>, EmptyOptions, IncludeKeysForEmbeddedOptions>;
|
|
392
|
+
manyToMany: <Target extends EntitySchemaWithMeta<any, any, any, any, any> | EntityClass<any>>(target: Target) => UniversalPropertyOptionsBuilder<InferEntity<Target>, EmptyOptions & {
|
|
388
393
|
kind: "m:n";
|
|
389
394
|
}, IncludeKeysForManyToManyOptions>;
|
|
390
|
-
manyToOne: <Target extends
|
|
395
|
+
manyToOne: <Target extends EntitySchemaWithMeta<any, any, any, any, any> | EntityClass<any>>(target: Target) => UniversalPropertyOptionsBuilder<InferEntity<Target>, EmptyOptions & {
|
|
391
396
|
kind: "m:1";
|
|
392
397
|
}, IncludeKeysForManyToOneOptions>;
|
|
393
|
-
oneToMany: <Target extends
|
|
394
|
-
oneToOne: <Target extends
|
|
398
|
+
oneToMany: <Target extends EntitySchemaWithMeta<any, any, any, any, any> | EntityClass<any>>(target: Target) => OneToManyOptionsBuilderOnlyMappedBy<InferEntity<Target>>;
|
|
399
|
+
oneToOne: <Target extends EntitySchemaWithMeta<any, any, any, any, any> | EntityClass<any>>(target: Target) => UniversalPropertyOptionsBuilder<InferEntity<Target>, EmptyOptions & {
|
|
395
400
|
kind: "1:1";
|
|
396
401
|
}, IncludeKeysForOneToOneOptions>;
|
|
397
402
|
date: () => UniversalPropertyOptionsBuilder<string, EmptyOptions, IncludeKeysForProperty>;
|
|
@@ -412,18 +417,21 @@ declare const propertyBuilders: {
|
|
|
412
417
|
interval: () => UniversalPropertyOptionsBuilder<string, EmptyOptions, IncludeKeysForProperty>;
|
|
413
418
|
unknown: () => UniversalPropertyOptionsBuilder<{}, EmptyOptions, IncludeKeysForProperty>;
|
|
414
419
|
};
|
|
415
|
-
export declare function defineEntity<
|
|
416
|
-
name:
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
420
|
+
export declare function defineEntity<const TName extends string, const TTableName extends string, const TProperties extends Record<string, any>, const TPK extends (keyof TProperties)[] | undefined = undefined, const TBase = never>(meta: Omit<Partial<EntityMetadata<InferEntityFromProperties<TProperties, TPK>>>, 'properties' | 'extends' | 'primaryKeys' | 'hooks'> & {
|
|
421
|
+
name: TName;
|
|
422
|
+
tableName?: TTableName;
|
|
423
|
+
extends?: string | EntityName<TBase>;
|
|
424
|
+
properties: TProperties | ((properties: typeof propertyBuilders) => TProperties);
|
|
425
|
+
primaryKeys?: TPK & InferPrimaryKey<TProperties>[];
|
|
426
|
+
hooks?: DefineEntityHooks<InferEntityFromProperties<TProperties, TPK>>;
|
|
427
|
+
}): EntitySchemaWithMeta<TName, TTableName, InferEntityFromProperties<TProperties, TPK>, TBase, TProperties>;
|
|
428
|
+
export declare function defineEntity<const TEntity = any, const TProperties extends Record<string, any> = Record<string, any>, const TClassName extends string = string, const TTableName extends string = string, const TBase = never>(meta: Omit<Partial<EntityMetadata<TEntity>>, 'properties' | 'className' | 'tableName'> & {
|
|
429
|
+
class: EntityClass<TEntity>;
|
|
430
|
+
className?: TClassName;
|
|
431
|
+
tableName?: TTableName;
|
|
432
|
+
extends?: string | EntityName<TBase>;
|
|
433
|
+
properties: TProperties | ((properties: typeof propertyBuilders) => TProperties);
|
|
434
|
+
}): EntitySchemaWithMeta<TClassName, TTableName, TEntity, TBase, TProperties>;
|
|
427
435
|
export declare namespace defineEntity {
|
|
428
436
|
var properties: {
|
|
429
437
|
bigint: <Mode extends "bigint" | "number" | "string" = "bigint">(mode?: Mode) => UniversalPropertyOptionsBuilder<(Mode extends "bigint" ? bigint : Mode extends "number" ? number : string) & {}, EmptyOptions, IncludeKeysForProperty>;
|
|
@@ -435,15 +443,15 @@ export declare namespace defineEntity {
|
|
|
435
443
|
time: (length?: number) => UniversalPropertyOptionsBuilder<any, EmptyOptions, IncludeKeysForProperty>;
|
|
436
444
|
type: <T extends PropertyValueType>(type: T) => UniversalPropertyOptionsBuilder<InferPropertyValueType<T>, EmptyOptions, IncludeKeysForProperty>;
|
|
437
445
|
enum: <const T extends (number | string)[] | (() => Dictionary)>(items?: T) => UniversalPropertyOptionsBuilder<T extends () => Dictionary ? ValueOf<ReturnType<T>> : T extends (infer Value)[] ? Value : T, EmptyOptions, IncludeKeysForEnumOptions>;
|
|
438
|
-
embedded: <Target extends
|
|
439
|
-
manyToMany: <Target extends
|
|
446
|
+
embedded: <Target extends EntitySchemaWithMeta<any, any, any, any, any> | EntityClass<any> | EntitySchemaWithMeta<any, any, any, any, any>[] | EntityClass<any>[]>(target: Target) => UniversalPropertyOptionsBuilder<InferEntity<Target extends (infer T)[] ? T : Target>, EmptyOptions, IncludeKeysForEmbeddedOptions>;
|
|
447
|
+
manyToMany: <Target extends EntitySchemaWithMeta<any, any, any, any, any> | EntityClass<any>>(target: Target) => UniversalPropertyOptionsBuilder<InferEntity<Target>, EmptyOptions & {
|
|
440
448
|
kind: "m:n";
|
|
441
449
|
}, IncludeKeysForManyToManyOptions>;
|
|
442
|
-
manyToOne: <Target extends
|
|
450
|
+
manyToOne: <Target extends EntitySchemaWithMeta<any, any, any, any, any> | EntityClass<any>>(target: Target) => UniversalPropertyOptionsBuilder<InferEntity<Target>, EmptyOptions & {
|
|
443
451
|
kind: "m:1";
|
|
444
452
|
}, IncludeKeysForManyToOneOptions>;
|
|
445
|
-
oneToMany: <Target extends
|
|
446
|
-
oneToOne: <Target extends
|
|
453
|
+
oneToMany: <Target extends EntitySchemaWithMeta<any, any, any, any, any> | EntityClass<any>>(target: Target) => OneToManyOptionsBuilderOnlyMappedBy<InferEntity<Target>>;
|
|
454
|
+
oneToOne: <Target extends EntitySchemaWithMeta<any, any, any, any, any> | EntityClass<any>>(target: Target) => UniversalPropertyOptionsBuilder<InferEntity<Target>, EmptyOptions & {
|
|
447
455
|
kind: "1:1";
|
|
448
456
|
}, IncludeKeysForOneToOneOptions>;
|
|
449
457
|
date: () => UniversalPropertyOptionsBuilder<string, EmptyOptions, IncludeKeysForProperty>;
|
|
@@ -488,7 +496,6 @@ export type InferPrimaryKey<Properties extends Record<string, any>> = {
|
|
|
488
496
|
};
|
|
489
497
|
} ? K : never;
|
|
490
498
|
}[keyof Properties];
|
|
491
|
-
type MaybeReturnType<T> = T extends (...args: any[]) => infer R ? R : T;
|
|
492
499
|
type InferBuilderValue<Builder> = Builder extends {
|
|
493
500
|
'~type'?: {
|
|
494
501
|
value: infer Value;
|
|
@@ -548,4 +555,3 @@ type MaybeHidden<Value, Options> = Options extends {
|
|
|
548
555
|
} ? Hidden<Value> : Value;
|
|
549
556
|
type ValueOf<T extends Dictionary> = T[keyof T];
|
|
550
557
|
type IsUnion<T, U = T> = T extends U ? ([U] extends [T] ? false : true) : false;
|
|
551
|
-
export type InferEntity<Schema> = Schema extends EntitySchema<infer Entity, any> ? Entity : Schema extends EntityClass<infer Entity> ? Entity : Schema;
|
package/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @module core
|
|
4
4
|
*/
|
|
5
5
|
export { EntityMetadata, PrimaryKeyProp, EntityRepositoryType, OptionalProps, EagerProps, HiddenProps, Config } from './typings.js';
|
|
6
|
-
export type { Constructor, ConnectionType, Dictionary, Primary, IPrimaryKey, ObjectQuery, FilterQuery, IWrappedEntity, EntityName, EntityData, Highlighter, MaybePromise, AnyEntity, EntityClass, EntityProperty, QBFilterQuery, PopulateOptions, Populate, Loaded, New, LoadedReference, LoadedCollection, IMigrator, IMigrationGenerator, MigratorEvent, GetRepository, MigrationObject, DeepPartial, PrimaryProperty, Cast, IsUnknown, EntityDictionary, EntityDTO, MigrationDiff, GenerateOptions, FilterObject, IEntityGenerator, ISeedManager, EntityClassGroup, RequiredEntityData, CheckCallback, IndexCallback, SimpleColumnMeta, Rel, Ref, ScalarRef, EntityRef, ISchemaGenerator, UmzugMigration, MigrateOptions, MigrationResult, MigrationRow, EntityKey, EntityValue, EntityDataValue, FilterKey, EntityType, FromEntityType, Selected, IsSubset, NoInfer, EntityProps, ExpandProperty, ExpandScalar, FilterItemValue, ExpandQuery, Scalar, ExpandHint, FilterValue, MergeLoaded, MergeSelected, TypeConfig, ClearDatabaseOptions, CreateSchemaOptions, EnsureDatabaseOptions, UpdateSchemaOptions, DropSchemaOptions, RefreshDatabaseOptions, AutoPath, UnboxArray, MetadataProcessor, ImportsResolver, RequiredNullable, DefineConfig, Opt, Hidden, } from './typings.js';
|
|
6
|
+
export type { Constructor, ConnectionType, Dictionary, Primary, IPrimaryKey, ObjectQuery, FilterQuery, IWrappedEntity, EntityName, EntityData, Highlighter, MaybePromise, AnyEntity, EntityClass, EntityProperty, QBFilterQuery, PopulateOptions, Populate, Loaded, New, LoadedReference, LoadedCollection, IMigrator, IMigrationGenerator, MigratorEvent, GetRepository, MigrationObject, DeepPartial, PrimaryProperty, Cast, IsUnknown, EntityDictionary, EntityDTO, MigrationDiff, GenerateOptions, FilterObject, IEntityGenerator, ISeedManager, EntityClassGroup, RequiredEntityData, CheckCallback, IndexCallback, SimpleColumnMeta, Rel, Ref, ScalarRef, EntityRef, ISchemaGenerator, UmzugMigration, MigrateOptions, MigrationResult, MigrationRow, EntityKey, EntityValue, EntityDataValue, FilterKey, EntityType, FromEntityType, Selected, IsSubset, NoInfer, EntityProps, ExpandProperty, ExpandScalar, FilterItemValue, ExpandQuery, Scalar, ExpandHint, FilterValue, MergeLoaded, MergeSelected, TypeConfig, ClearDatabaseOptions, CreateSchemaOptions, EnsureDatabaseOptions, UpdateSchemaOptions, DropSchemaOptions, RefreshDatabaseOptions, AutoPath, UnboxArray, MetadataProcessor, ImportsResolver, RequiredNullable, DefineConfig, Opt, Hidden, EntitySchemaWithMeta, InferEntity, } from './typings.js';
|
|
7
7
|
export * from './enums.js';
|
|
8
8
|
export * from './errors.js';
|
|
9
9
|
export * from './exceptions.js';
|
|
@@ -75,6 +75,8 @@ export declare class EntitySchema<Entity = any, Base = never> {
|
|
|
75
75
|
setClass(proto: EntityClass<Entity>): void;
|
|
76
76
|
get meta(): EntityMetadata<Entity>;
|
|
77
77
|
get name(): EntityName<Entity>;
|
|
78
|
+
get tableName(): string;
|
|
79
|
+
get properties(): Record<string, any>;
|
|
78
80
|
/**
|
|
79
81
|
* @internal
|
|
80
82
|
*/
|
package/metadata/EntitySchema.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.0.0-dev.
|
|
4
|
+
"version": "7.0.0-dev.39",
|
|
5
5
|
"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.",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./package.json": "./package.json",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"dataloader": "2.2.3",
|
|
55
55
|
"dotenv": "17.2.3",
|
|
56
56
|
"esprima": "4.0.1",
|
|
57
|
-
"mikro-orm": "7.0.0-dev.
|
|
57
|
+
"mikro-orm": "7.0.0-dev.39",
|
|
58
58
|
"reflect-metadata": "0.2.2",
|
|
59
59
|
"tinyglobby": "0.2.13"
|
|
60
60
|
}
|
package/typings.d.ts
CHANGED
|
@@ -851,4 +851,11 @@ export type MetadataProcessor = (metadata: EntityMetadata[], platform: Platform)
|
|
|
851
851
|
export type ContextProvider<T> = MaybePromise<MikroORM> | ((type: T) => MaybePromise<MikroORM | EntityManager | EntityRepository<any> | {
|
|
852
852
|
getEntityManager(): EntityManager;
|
|
853
853
|
}>);
|
|
854
|
+
export type MaybeReturnType<T> = T extends (...args: any[]) => infer R ? R : T;
|
|
855
|
+
export interface EntitySchemaWithMeta<TName extends string = string, TTableName extends string = string, TEntity = any, TBase = never, TProperties extends Record<string, any> = Record<string, any>> extends EntitySchema<TEntity, TBase> {
|
|
856
|
+
readonly name: TName;
|
|
857
|
+
readonly properties: TProperties;
|
|
858
|
+
readonly tableName: TTableName;
|
|
859
|
+
}
|
|
860
|
+
export type InferEntity<Schema> = Schema extends EntitySchemaWithMeta<any, any, infer Entity, any, any> ? Entity : Schema extends EntitySchema<infer Entity> ? Entity : Schema extends EntityClass<infer Entity> ? Entity : Schema;
|
|
854
861
|
export {};
|
package/utils/Configuration.d.ts
CHANGED
|
@@ -236,7 +236,7 @@ export declare class Configuration<D extends IDatabaseDriver = IDatabaseDriver,
|
|
|
236
236
|
/**
|
|
237
237
|
* Type helper to make it easier to use `mikro-orm.config.js`.
|
|
238
238
|
*/
|
|
239
|
-
export declare function defineConfig<D extends IDatabaseDriver>(options: Options<D>): Options<D, D[typeof EntityManagerType] & EntityManager<IDatabaseDriver<import("../index.js").Connection
|
|
239
|
+
export declare function defineConfig<D extends IDatabaseDriver>(options: Options<D>): Options<D, D[typeof EntityManagerType] & EntityManager<IDatabaseDriver<import("../index.js").Connection>>, (string | EntityClass<Partial<any>> | EntityClassGroup<Partial<any>> | EntitySchema<any, never>)[]>;
|
|
240
240
|
export interface ConnectionOptions {
|
|
241
241
|
dbName?: string;
|
|
242
242
|
schema?: string;
|
|
@@ -416,4 +416,6 @@ export interface MikroORMOptions<D extends IDatabaseDriver = IDatabaseDriver, EM
|
|
|
416
416
|
dynamicImportProvider: (id: string) => Promise<unknown>;
|
|
417
417
|
hashAlgorithm: 'md5' | 'sha256';
|
|
418
418
|
}
|
|
419
|
-
export
|
|
419
|
+
export interface Options<D extends IDatabaseDriver = IDatabaseDriver, EM extends D[typeof EntityManagerType] & EntityManager = D[typeof EntityManagerType] & EntityManager, Entities extends (string | EntityClass<AnyEntity> | EntityClassGroup<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntityClassGroup<AnyEntity> | EntitySchema)[]> extends Pick<MikroORMOptions<D, EM>, Exclude<keyof MikroORMOptions, keyof typeof Configuration.DEFAULTS>>, Partial<MikroORMOptions<D, EM>> {
|
|
420
|
+
entities?: Entities;
|
|
421
|
+
}
|