@mikro-orm/core 7.0.0-dev.28 → 7.0.0-dev.280

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.
Files changed (209) hide show
  1. package/EntityManager.d.ts +67 -60
  2. package/EntityManager.js +275 -257
  3. package/MikroORM.d.ts +44 -35
  4. package/MikroORM.js +109 -143
  5. package/README.md +2 -0
  6. package/cache/FileCacheAdapter.d.ts +1 -2
  7. package/cache/FileCacheAdapter.js +18 -11
  8. package/cache/GeneratedCacheAdapter.d.ts +0 -1
  9. package/cache/GeneratedCacheAdapter.js +0 -2
  10. package/cache/index.d.ts +0 -1
  11. package/cache/index.js +0 -1
  12. package/connections/Connection.d.ts +12 -5
  13. package/connections/Connection.js +21 -12
  14. package/drivers/DatabaseDriver.d.ts +25 -16
  15. package/drivers/DatabaseDriver.js +118 -35
  16. package/drivers/IDatabaseDriver.d.ts +75 -23
  17. package/entity/BaseEntity.d.ts +63 -4
  18. package/entity/BaseEntity.js +0 -3
  19. package/entity/Collection.d.ts +101 -29
  20. package/entity/Collection.js +436 -104
  21. package/entity/EntityAssigner.js +17 -17
  22. package/entity/EntityFactory.d.ts +7 -1
  23. package/entity/EntityFactory.js +87 -55
  24. package/entity/EntityHelper.d.ts +2 -2
  25. package/entity/EntityHelper.js +50 -17
  26. package/entity/EntityLoader.d.ts +11 -10
  27. package/entity/EntityLoader.js +213 -82
  28. package/entity/EntityRepository.d.ts +28 -8
  29. package/entity/EntityRepository.js +8 -2
  30. package/entity/PolymorphicRef.d.ts +12 -0
  31. package/entity/PolymorphicRef.js +18 -0
  32. package/entity/Reference.d.ts +1 -5
  33. package/entity/Reference.js +15 -11
  34. package/entity/WrappedEntity.d.ts +3 -8
  35. package/entity/WrappedEntity.js +2 -7
  36. package/entity/defineEntity.d.ts +512 -310
  37. package/entity/defineEntity.js +134 -290
  38. package/entity/index.d.ts +2 -2
  39. package/entity/index.js +2 -2
  40. package/entity/utils.d.ts +6 -1
  41. package/entity/utils.js +34 -1
  42. package/entity/validators.d.ts +11 -0
  43. package/entity/validators.js +65 -0
  44. package/enums.d.ts +8 -6
  45. package/enums.js +2 -1
  46. package/errors.d.ts +20 -10
  47. package/errors.js +55 -23
  48. package/events/EventManager.d.ts +2 -1
  49. package/events/EventManager.js +19 -11
  50. package/hydration/Hydrator.js +1 -2
  51. package/hydration/ObjectHydrator.d.ts +4 -4
  52. package/hydration/ObjectHydrator.js +79 -34
  53. package/index.d.ts +2 -2
  54. package/index.js +1 -2
  55. package/logging/DefaultLogger.d.ts +1 -1
  56. package/logging/DefaultLogger.js +1 -0
  57. package/logging/SimpleLogger.d.ts +1 -1
  58. package/logging/colors.d.ts +1 -1
  59. package/logging/colors.js +7 -6
  60. package/logging/index.d.ts +1 -0
  61. package/logging/index.js +1 -0
  62. package/logging/inspect.d.ts +2 -0
  63. package/logging/inspect.js +11 -0
  64. package/metadata/EntitySchema.d.ts +47 -23
  65. package/metadata/EntitySchema.js +92 -33
  66. package/metadata/MetadataDiscovery.d.ts +64 -9
  67. package/metadata/MetadataDiscovery.js +782 -325
  68. package/metadata/MetadataProvider.d.ts +11 -2
  69. package/metadata/MetadataProvider.js +46 -2
  70. package/metadata/MetadataStorage.d.ts +13 -11
  71. package/metadata/MetadataStorage.js +71 -38
  72. package/metadata/MetadataValidator.d.ts +32 -9
  73. package/metadata/MetadataValidator.js +196 -41
  74. package/metadata/discover-entities.d.ts +5 -0
  75. package/metadata/discover-entities.js +40 -0
  76. package/metadata/index.d.ts +1 -1
  77. package/metadata/index.js +1 -1
  78. package/metadata/types.d.ts +577 -0
  79. package/metadata/types.js +1 -0
  80. package/naming-strategy/AbstractNamingStrategy.d.ts +16 -4
  81. package/naming-strategy/AbstractNamingStrategy.js +20 -2
  82. package/naming-strategy/EntityCaseNamingStrategy.d.ts +3 -3
  83. package/naming-strategy/EntityCaseNamingStrategy.js +6 -5
  84. package/naming-strategy/MongoNamingStrategy.d.ts +3 -3
  85. package/naming-strategy/MongoNamingStrategy.js +6 -6
  86. package/naming-strategy/NamingStrategy.d.ts +28 -4
  87. package/naming-strategy/UnderscoreNamingStrategy.d.ts +3 -3
  88. package/naming-strategy/UnderscoreNamingStrategy.js +6 -6
  89. package/not-supported.d.ts +2 -0
  90. package/not-supported.js +4 -0
  91. package/package.json +22 -11
  92. package/platforms/ExceptionConverter.js +1 -1
  93. package/platforms/Platform.d.ts +10 -15
  94. package/platforms/Platform.js +21 -44
  95. package/serialization/EntitySerializer.d.ts +6 -3
  96. package/serialization/EntitySerializer.js +46 -26
  97. package/serialization/EntityTransformer.js +33 -21
  98. package/serialization/SerializationContext.d.ts +6 -6
  99. package/serialization/SerializationContext.js +3 -3
  100. package/types/ArrayType.d.ts +1 -1
  101. package/types/ArrayType.js +2 -3
  102. package/types/BigIntType.js +1 -1
  103. package/types/BlobType.d.ts +0 -1
  104. package/types/BlobType.js +0 -3
  105. package/types/BooleanType.d.ts +1 -0
  106. package/types/BooleanType.js +3 -0
  107. package/types/DecimalType.js +2 -2
  108. package/types/DoubleType.js +1 -1
  109. package/types/EnumArrayType.js +1 -2
  110. package/types/JsonType.d.ts +1 -1
  111. package/types/JsonType.js +7 -2
  112. package/types/TinyIntType.js +1 -1
  113. package/types/Type.d.ts +2 -4
  114. package/types/Type.js +3 -3
  115. package/types/Uint8ArrayType.d.ts +0 -1
  116. package/types/Uint8ArrayType.js +1 -4
  117. package/types/index.d.ts +1 -1
  118. package/typings.d.ts +412 -155
  119. package/typings.js +99 -44
  120. package/unit-of-work/ChangeSet.d.ts +4 -6
  121. package/unit-of-work/ChangeSet.js +4 -5
  122. package/unit-of-work/ChangeSetComputer.d.ts +3 -8
  123. package/unit-of-work/ChangeSetComputer.js +41 -20
  124. package/unit-of-work/ChangeSetPersister.d.ts +13 -12
  125. package/unit-of-work/ChangeSetPersister.js +94 -36
  126. package/unit-of-work/CommitOrderCalculator.d.ts +12 -10
  127. package/unit-of-work/CommitOrderCalculator.js +13 -13
  128. package/unit-of-work/IdentityMap.d.ts +12 -0
  129. package/unit-of-work/IdentityMap.js +39 -1
  130. package/unit-of-work/UnitOfWork.d.ts +27 -3
  131. package/unit-of-work/UnitOfWork.js +248 -90
  132. package/utils/AbstractMigrator.d.ts +101 -0
  133. package/utils/AbstractMigrator.js +305 -0
  134. package/utils/AbstractSchemaGenerator.d.ts +5 -5
  135. package/utils/AbstractSchemaGenerator.js +28 -17
  136. package/utils/AsyncContext.d.ts +6 -0
  137. package/utils/AsyncContext.js +42 -0
  138. package/utils/Configuration.d.ts +795 -213
  139. package/utils/Configuration.js +151 -196
  140. package/utils/ConfigurationLoader.d.ts +1 -54
  141. package/utils/ConfigurationLoader.js +1 -352
  142. package/utils/Cursor.d.ts +0 -3
  143. package/utils/Cursor.js +24 -11
  144. package/utils/DataloaderUtils.d.ts +10 -5
  145. package/utils/DataloaderUtils.js +29 -12
  146. package/utils/EntityComparator.d.ts +16 -9
  147. package/utils/EntityComparator.js +154 -56
  148. package/utils/QueryHelper.d.ts +18 -6
  149. package/utils/QueryHelper.js +76 -23
  150. package/utils/RawQueryFragment.d.ts +28 -34
  151. package/utils/RawQueryFragment.js +35 -71
  152. package/utils/RequestContext.js +2 -2
  153. package/utils/TransactionContext.js +2 -2
  154. package/utils/TransactionManager.js +9 -6
  155. package/utils/Utils.d.ts +15 -128
  156. package/utils/Utils.js +80 -397
  157. package/utils/clone.js +8 -23
  158. package/utils/env-vars.d.ts +7 -0
  159. package/utils/env-vars.js +97 -0
  160. package/utils/fs-utils.d.ts +34 -0
  161. package/utils/fs-utils.js +196 -0
  162. package/utils/index.d.ts +1 -3
  163. package/utils/index.js +1 -3
  164. package/utils/upsert-utils.d.ts +9 -4
  165. package/utils/upsert-utils.js +46 -3
  166. package/decorators/Check.d.ts +0 -3
  167. package/decorators/Check.js +0 -13
  168. package/decorators/CreateRequestContext.d.ts +0 -3
  169. package/decorators/CreateRequestContext.js +0 -32
  170. package/decorators/Embeddable.d.ts +0 -8
  171. package/decorators/Embeddable.js +0 -11
  172. package/decorators/Embedded.d.ts +0 -12
  173. package/decorators/Embedded.js +0 -18
  174. package/decorators/Entity.d.ts +0 -33
  175. package/decorators/Entity.js +0 -12
  176. package/decorators/Enum.d.ts +0 -9
  177. package/decorators/Enum.js +0 -16
  178. package/decorators/Filter.d.ts +0 -2
  179. package/decorators/Filter.js +0 -8
  180. package/decorators/Formula.d.ts +0 -4
  181. package/decorators/Formula.js +0 -15
  182. package/decorators/Indexed.d.ts +0 -19
  183. package/decorators/Indexed.js +0 -20
  184. package/decorators/ManyToMany.d.ts +0 -42
  185. package/decorators/ManyToMany.js +0 -14
  186. package/decorators/ManyToOne.d.ts +0 -34
  187. package/decorators/ManyToOne.js +0 -14
  188. package/decorators/OneToMany.d.ts +0 -28
  189. package/decorators/OneToMany.js +0 -17
  190. package/decorators/OneToOne.d.ts +0 -28
  191. package/decorators/OneToOne.js +0 -7
  192. package/decorators/PrimaryKey.d.ts +0 -8
  193. package/decorators/PrimaryKey.js +0 -20
  194. package/decorators/Property.d.ts +0 -250
  195. package/decorators/Property.js +0 -32
  196. package/decorators/Transactional.d.ts +0 -14
  197. package/decorators/Transactional.js +0 -28
  198. package/decorators/hooks.d.ts +0 -16
  199. package/decorators/hooks.js +0 -47
  200. package/decorators/index.d.ts +0 -17
  201. package/decorators/index.js +0 -17
  202. package/entity/ArrayCollection.d.ts +0 -118
  203. package/entity/ArrayCollection.js +0 -407
  204. package/entity/EntityValidator.d.ts +0 -19
  205. package/entity/EntityValidator.js +0 -150
  206. package/metadata/ReflectMetadataProvider.d.ts +0 -8
  207. package/metadata/ReflectMetadataProvider.js +0 -44
  208. package/utils/resolveContextProvider.d.ts +0 -10
  209. package/utils/resolveContextProvider.js +0 -28
@@ -1,153 +1,139 @@
1
1
  import type { NamingStrategy } from '../naming-strategy/NamingStrategy.js';
2
- import { FileCacheAdapter } from '../cache/FileCacheAdapter.js';
3
- import { type SyncCacheAdapter, type CacheAdapter } from '../cache/CacheAdapter.js';
2
+ import { type CacheAdapter, type SyncCacheAdapter } from '../cache/CacheAdapter.js';
4
3
  import type { EntityRepository } from '../entity/EntityRepository.js';
5
- import type { AnyEntity, Constructor, Dictionary, EntityClass, EntityClassGroup, FilterDef, Highlighter, HydratorConstructor, IHydrator, IMigrationGenerator, IPrimaryKey, MaybePromise, MigrationObject, EntityMetadata, EnsureDatabaseOptions, GenerateOptions, Migration } from '../typings.js';
4
+ import type { AnyEntity, CompiledFunctions, Constructor, Dictionary, EnsureDatabaseOptions, EntityClass, EntityMetadata, FilterDef, GenerateOptions, Highlighter, HydratorConstructor, IHydrator, IMigrationGenerator, IPrimaryKey, MaybePromise, Migration, MigrationObject, Seeder, SeederObject } from '../typings.js';
6
5
  import { ObjectHydrator } from '../hydration/ObjectHydrator.js';
7
6
  import { NullHighlighter } from '../utils/NullHighlighter.js';
8
7
  import { type Logger, type LoggerNamespace, type LoggerOptions } from '../logging/Logger.js';
9
8
  import type { EntityManager } from '../EntityManager.js';
10
9
  import type { Platform } from '../platforms/Platform.js';
11
10
  import type { EntitySchema } from '../metadata/EntitySchema.js';
12
- import type { MetadataProvider } from '../metadata/MetadataProvider.js';
11
+ import { MetadataProvider } from '../metadata/MetadataProvider.js';
13
12
  import type { MetadataStorage } from '../metadata/MetadataStorage.js';
14
- import { ReflectMetadataProvider } from '../metadata/ReflectMetadataProvider.js';
15
- import type { EmbeddedPrefixMode } from '../decorators/Embedded.js';
16
13
  import type { EventSubscriber } from '../events/EventSubscriber.js';
17
14
  import type { AssignOptions } from '../entity/EntityAssigner.js';
18
15
  import type { EntityManagerType, IDatabaseDriver } from '../drivers/IDatabaseDriver.js';
19
16
  import { NotFoundError } from '../errors.js';
20
- import { DataloaderType, FlushMode, LoadStrategy, PopulateHint } from '../enums.js';
17
+ import { DataloaderType, FlushMode, LoadStrategy, PopulateHint, type EmbeddedPrefixMode } from '../enums.js';
21
18
  import { MemoryCacheAdapter } from '../cache/MemoryCacheAdapter.js';
22
19
  import { EntityComparator } from './EntityComparator.js';
23
20
  import type { Type } from '../types/Type.js';
24
21
  import type { MikroORM } from '../MikroORM.js';
25
- export declare class Configuration<D extends IDatabaseDriver = IDatabaseDriver, EM extends EntityManager = D[typeof EntityManagerType] & EntityManager> {
26
- static readonly DEFAULTS: {
27
- pool: {};
28
- entities: never[];
29
- entitiesTs: never[];
30
- extensions: never[];
31
- subscribers: never[];
32
- filters: {};
33
- discovery: {
34
- warnWhenNoEntities: true;
35
- requireEntitiesArray: false;
36
- checkDuplicateTableNames: true;
37
- checkDuplicateFieldNames: true;
38
- checkDuplicateEntities: true;
39
- checkNonPersistentCompositeProps: true;
40
- alwaysAnalyseProperties: true;
41
- disableDynamicFileAccess: false;
42
- inferDefaultValues: true;
43
- };
44
- strict: false;
45
- validate: false;
46
- validateRequired: true;
47
- context: (name: string) => EntityManager<IDatabaseDriver<import("../index.js").Connection>> | undefined;
48
- contextName: string;
49
- allowGlobalContext: false;
50
- logger: (message?: any, ...optionalParams: any[]) => void;
51
- colors: true;
52
- findOneOrFailHandler: (entityName: string, where: Dictionary | IPrimaryKey) => NotFoundError<Partial<any>>;
53
- findExactlyOneOrFailHandler: (entityName: string, where: Dictionary | IPrimaryKey) => NotFoundError<Partial<any>>;
54
- baseDir: string;
55
- hydrator: typeof ObjectHydrator;
56
- flushMode: FlushMode.AUTO;
57
- loadStrategy: LoadStrategy.JOINED;
58
- dataloader: DataloaderType.NONE;
59
- populateWhere: PopulateHint.ALL;
60
- connect: true;
61
- ignoreUndefinedInQuery: false;
62
- onQuery: (sql: string) => string;
63
- autoJoinOneToOneOwner: true;
64
- autoJoinRefsForFilters: true;
65
- propagationOnPrototype: true;
66
- populateAfterFlush: true;
67
- serialization: {
68
- includePrimaryKeys: true;
69
- };
70
- assign: {
71
- updateNestedEntities: true;
72
- updateByPrimaryKey: true;
73
- mergeObjectProperties: false;
74
- mergeEmbeddedProperties: true;
75
- ignoreUndefined: false;
76
- };
77
- persistOnCreate: true;
78
- upsertManaged: true;
79
- forceEntityConstructor: false;
80
- forceUndefined: false;
81
- processOnCreateHooksEarly: false;
82
- ensureDatabase: true;
83
- ensureIndexes: false;
84
- batchSize: number;
85
- hashAlgorithm: "md5";
86
- debug: false;
87
- ignoreDeprecations: false;
88
- verbose: false;
89
- driverOptions: {};
90
- migrations: {
91
- tableName: string;
92
- path: string;
93
- glob: string;
94
- silent: false;
95
- transactional: true;
96
- disableForeignKeys: false;
97
- allOrNothing: true;
98
- dropTables: true;
99
- safe: false;
100
- snapshot: true;
101
- emit: "ts";
102
- fileName: (timestamp: string, name?: string) => string;
103
- };
104
- schemaGenerator: {
105
- disableForeignKeys: false;
106
- createForeignKeyConstraints: true;
107
- ignoreSchema: never[];
108
- skipTables: never[];
109
- skipColumns: {};
110
- };
111
- embeddables: {
112
- prefixMode: "relative";
113
- };
114
- entityGenerator: {
115
- forceUndefined: true;
116
- undefinedDefaults: false;
117
- bidirectionalRelations: false;
118
- identifiedReferences: false;
119
- scalarTypeInDecorator: false;
120
- scalarPropertiesForRelations: "never";
121
- fileName: (className: string) => string;
122
- onlyPurePivotTables: false;
123
- outputPurePivotTables: false;
124
- readOnlyPivotTables: false;
125
- useCoreBaseEntity: false;
126
- };
127
- metadataCache: {
128
- pretty: false;
129
- adapter: typeof FileCacheAdapter;
130
- options: {
131
- cacheDir: string;
132
- };
133
- };
134
- resultCache: {
135
- adapter: typeof MemoryCacheAdapter;
136
- expiration: number;
137
- options: {};
138
- };
139
- metadataProvider: typeof ReflectMetadataProvider;
140
- highlighter: NullHighlighter;
141
- seeder: {
142
- path: string;
143
- defaultSeeder: string;
144
- glob: string;
145
- emit: "ts";
146
- fileName: (className: string) => string;
147
- };
148
- preferReadReplicas: true;
149
- dynamicImportProvider: (id: string) => Promise<any>;
22
+ declare const DEFAULTS: {
23
+ readonly pool: {};
24
+ readonly entities: readonly [];
25
+ readonly entitiesTs: readonly [];
26
+ readonly extensions: readonly [];
27
+ readonly subscribers: readonly [];
28
+ readonly filters: {};
29
+ readonly discovery: {
30
+ readonly warnWhenNoEntities: true;
31
+ readonly checkDuplicateTableNames: true;
32
+ readonly checkDuplicateFieldNames: true;
33
+ readonly checkDuplicateEntities: true;
34
+ readonly checkNonPersistentCompositeProps: true;
35
+ readonly inferDefaultValues: true;
36
+ };
37
+ readonly validateRequired: true;
38
+ readonly context: (name: string) => EntityManager<IDatabaseDriver<import("../index.js").Connection>> | undefined;
39
+ readonly contextName: "default";
40
+ readonly allowGlobalContext: false;
41
+ readonly logger: (message?: any, ...optionalParams: any[]) => void;
42
+ readonly colors: true;
43
+ readonly findOneOrFailHandler: (entityName: string, where: Dictionary | IPrimaryKey) => NotFoundError<Partial<any>>;
44
+ readonly findExactlyOneOrFailHandler: (entityName: string, where: Dictionary | IPrimaryKey) => NotFoundError<Partial<any>>;
45
+ readonly baseDir: string;
46
+ readonly hydrator: typeof ObjectHydrator;
47
+ readonly flushMode: FlushMode.AUTO;
48
+ readonly loadStrategy: LoadStrategy.BALANCED;
49
+ readonly dataloader: DataloaderType.NONE;
50
+ readonly populateWhere: PopulateHint.ALL;
51
+ readonly ignoreUndefinedInQuery: false;
52
+ readonly onQuery: (sql: string) => string;
53
+ readonly autoJoinOneToOneOwner: true;
54
+ readonly autoJoinRefsForFilters: true;
55
+ readonly filtersOnRelations: true;
56
+ readonly propagationOnPrototype: true;
57
+ readonly populateAfterFlush: true;
58
+ readonly serialization: {
59
+ readonly includePrimaryKeys: true;
60
+ };
61
+ readonly assign: {
62
+ readonly updateNestedEntities: true;
63
+ readonly updateByPrimaryKey: true;
64
+ readonly mergeObjectProperties: false;
65
+ readonly mergeEmbeddedProperties: true;
66
+ readonly ignoreUndefined: false;
67
+ };
68
+ readonly persistOnCreate: true;
69
+ readonly upsertManaged: true;
70
+ readonly forceEntityConstructor: false;
71
+ readonly forceUndefined: false;
72
+ readonly forceUtcTimezone: true;
73
+ readonly processOnCreateHooksEarly: true;
74
+ readonly ensureDatabase: true;
75
+ readonly ensureIndexes: false;
76
+ readonly batchSize: 300;
77
+ readonly debug: false;
78
+ readonly ignoreDeprecations: false;
79
+ readonly verbose: false;
80
+ readonly driverOptions: {};
81
+ readonly migrations: {
82
+ readonly tableName: "mikro_orm_migrations";
83
+ readonly glob: "!(*.d).{js,ts,cjs}";
84
+ readonly silent: false;
85
+ readonly transactional: true;
86
+ readonly allOrNothing: true;
87
+ readonly dropTables: true;
88
+ readonly safe: false;
89
+ readonly snapshot: true;
90
+ readonly emit: "ts";
91
+ readonly fileName: (timestamp: string, name?: string) => string;
92
+ };
93
+ readonly schemaGenerator: {
94
+ readonly createForeignKeyConstraints: true;
95
+ readonly ignoreSchema: readonly [];
96
+ readonly skipTables: readonly [];
97
+ readonly skipViews: readonly [];
98
+ readonly skipColumns: {};
99
+ };
100
+ readonly embeddables: {
101
+ readonly prefixMode: "relative";
150
102
  };
103
+ readonly entityGenerator: {
104
+ readonly forceUndefined: true;
105
+ readonly undefinedDefaults: false;
106
+ readonly scalarTypeInDecorator: false;
107
+ readonly bidirectionalRelations: true;
108
+ readonly identifiedReferences: true;
109
+ readonly scalarPropertiesForRelations: "never";
110
+ readonly entityDefinition: "defineEntity";
111
+ readonly decorators: "legacy";
112
+ readonly enumMode: "dictionary";
113
+ readonly fileName: (className: string) => string;
114
+ readonly onlyPurePivotTables: false;
115
+ readonly outputPurePivotTables: false;
116
+ readonly readOnlyPivotTables: false;
117
+ readonly useCoreBaseEntity: false;
118
+ };
119
+ readonly metadataCache: {};
120
+ readonly resultCache: {
121
+ readonly adapter: typeof MemoryCacheAdapter;
122
+ readonly expiration: 1000;
123
+ readonly options: {};
124
+ };
125
+ readonly metadataProvider: typeof MetadataProvider;
126
+ readonly highlighter: NullHighlighter;
127
+ readonly seeder: {
128
+ readonly defaultSeeder: "DatabaseSeeder";
129
+ readonly glob: "!(*.d).{js,ts}";
130
+ readonly emit: "ts";
131
+ readonly fileName: (className: string) => string;
132
+ };
133
+ readonly preferReadReplicas: true;
134
+ readonly dynamicImportProvider: (id: string) => Promise<any>;
135
+ };
136
+ export declare class Configuration<D extends IDatabaseDriver = IDatabaseDriver, EM extends EntityManager<D> = D[typeof EntityManagerType] & EntityManager<D>> {
151
137
  private readonly options;
152
138
  private readonly logger;
153
139
  private readonly driver;
@@ -159,25 +145,21 @@ export declare class Configuration<D extends IDatabaseDriver = IDatabaseDriver,
159
145
  /**
160
146
  * Gets specific configuration option. Falls back to specified `defaultValue` if provided.
161
147
  */
162
- get<T extends keyof MikroORMOptions<D, EM>, U extends MikroORMOptions<D, EM>[T]>(key: T, defaultValue?: U): U;
163
- getAll(): MikroORMOptions<D, EM>;
148
+ get<T extends keyof Options<D, EM>, U extends RequiredOptions<D, EM>[T]>(key: T, defaultValue?: U): U;
149
+ getAll(): RequiredOptions<D, EM>;
164
150
  /**
165
151
  * Overrides specified configuration value.
166
152
  */
167
- set<T extends keyof MikroORMOptions<D, EM>, U extends MikroORMOptions<D, EM>[T]>(key: T, value: U): void;
153
+ set<T extends keyof Options<D, EM>, U extends RequiredOptions<D, EM>[T]>(key: T, value: U): void;
168
154
  /**
169
155
  * Resets the configuration to its default value
170
156
  */
171
- reset<T extends keyof MikroORMOptions<D, EM>>(key: T): void;
157
+ reset<T extends keyof RequiredOptions<D, EM>>(key: T): void;
172
158
  /**
173
159
  * Gets Logger instance.
174
160
  */
175
161
  getLogger(): Logger;
176
162
  getDataloaderType(): DataloaderType;
177
- /**
178
- * Gets current client URL (connection string).
179
- */
180
- getClientUrl(hidePassword?: boolean): string;
181
163
  getSchema(skipDefaultSchema?: boolean): string | undefined;
182
164
  /**
183
165
  * Gets current database driver instance.
@@ -212,7 +194,7 @@ export declare class Configuration<D extends IDatabaseDriver = IDatabaseDriver,
212
194
  /**
213
195
  * Gets EntityRepository class to be instantiated.
214
196
  */
215
- getRepositoryClass(repository: () => EntityClass<EntityRepository<AnyEntity>>): MikroORMOptions<D, EM>['entityRepository'];
197
+ getRepositoryClass(repository: () => EntityClass<EntityRepository<AnyEntity>>): Options<D, EM>['entityRepository'];
216
198
  /**
217
199
  * Creates instance of given service and caches it.
218
200
  */
@@ -222,198 +204,798 @@ export declare class Configuration<D extends IDatabaseDriver = IDatabaseDriver,
222
204
  resetServiceCache(): void;
223
205
  private init;
224
206
  private sync;
225
- /**
226
- * Checks if `src` folder exists, it so, tries to adjust the migrations and seeders paths automatically to use it.
227
- * If there is a `dist` or `build` folder, it will be used for the JS variant (`path` option), while the `src` folder will be
228
- * used for the TS variant (`pathTs` option).
229
- *
230
- * If the default folder exists (e.g. `/migrations`), the config will respect that, so this auto-detection should not
231
- * break existing projects, only help with the new ones.
232
- */
233
- private detectSourceFolder;
234
207
  private validateOptions;
235
208
  }
236
209
  /**
237
210
  * Type helper to make it easier to use `mikro-orm.config.js`.
238
211
  */
239
- export declare function defineConfig<D extends IDatabaseDriver>(options: Options<D>): Options<D, D[typeof EntityManagerType] & EntityManager<IDatabaseDriver<import("../index.js").Connection>>>;
212
+ export declare function defineConfig<D extends IDatabaseDriver = IDatabaseDriver, EM extends EntityManager<D> = EntityManager<D>, Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]>(options: Options<D, EM, Entities>): Options<D, EM, Entities>;
213
+ /**
214
+ * Connection configuration options for database connections.
215
+ * @see https://mikro-orm.io/docs/configuration#connection
216
+ */
240
217
  export interface ConnectionOptions {
218
+ /** Name of the database to connect to. */
241
219
  dbName?: string;
220
+ /** Default database schema to use. */
242
221
  schema?: string;
222
+ /** Name of the connection (used for logging when replicas are used). */
243
223
  name?: string;
224
+ /** Full client connection URL. Overrides individual connection options. */
244
225
  clientUrl?: string;
226
+ /** Database server hostname. */
245
227
  host?: string;
228
+ /** Database server port number. */
246
229
  port?: number;
230
+ /** Database user name. */
247
231
  user?: string;
232
+ /**
233
+ * Database password. Can be a string or a callback function that returns the password.
234
+ * The callback is useful for short-lived tokens from cloud providers.
235
+ * @example
236
+ * password: async () => someCallToGetTheToken()
237
+ */
248
238
  password?: string | (() => MaybePromise<string>);
239
+ /** Character set for the connection. */
249
240
  charset?: string;
241
+ /** Collation for the connection. */
250
242
  collate?: string;
243
+ /**
244
+ * Enable multiple statements in a single query.
245
+ * Required for importing database dump files.
246
+ * Should be disabled in production for security.
247
+ * @default false
248
+ */
251
249
  multipleStatements?: boolean;
250
+ /** Connection pool configuration. */
252
251
  pool?: PoolConfig;
252
+ /**
253
+ * Additional driver-specific options.
254
+ * The object will be deeply merged with internal driver options.
255
+ */
253
256
  driverOptions?: Dictionary;
257
+ /** Callback to execute when a new connection is created. */
254
258
  onCreateConnection?: (connection: unknown) => Promise<void>;
259
+ /**
260
+ * SQLite/libSQL: databases to attach on connection.
261
+ * Each attached database acts as a schema, accessible via `schema.table` syntax.
262
+ * Entities can reference attached databases via `@Entity({ schema: 'db_name' })`.
263
+ * Note: Not supported for remote libSQL connections.
264
+ * @example
265
+ * attachDatabases: [
266
+ * { name: 'users_db', path: './users.db' },
267
+ * { name: 'logs_db', path: '/var/data/logs.db' },
268
+ * ]
269
+ */
270
+ attachDatabases?: {
271
+ name: string;
272
+ path: string;
273
+ }[];
255
274
  }
275
+ /**
276
+ * Configuration options for database migrations.
277
+ * @see https://mikro-orm.io/docs/migrations
278
+ */
256
279
  export type MigrationsOptions = {
280
+ /**
281
+ * Name of the migrations table.
282
+ * @default 'mikro_orm_migrations'
283
+ */
257
284
  tableName?: string;
285
+ /**
286
+ * Path to the folder with migration files (for compiled JavaScript files).
287
+ * @default './migrations'
288
+ */
258
289
  path?: string;
290
+ /**
291
+ * Path to the folder with migration files (for TypeScript source files).
292
+ * Used when running in TypeScript mode.
293
+ */
259
294
  pathTs?: string;
295
+ /**
296
+ * Glob pattern to match migration files.
297
+ * @default '!(*.d).{js,ts,cjs}'
298
+ */
260
299
  glob?: string;
300
+ /**
301
+ * Disable logging for migration operations.
302
+ * @default false
303
+ */
261
304
  silent?: boolean;
305
+ /**
306
+ * Run each migration inside a transaction.
307
+ * @default true
308
+ */
262
309
  transactional?: boolean;
310
+ /**
311
+ * Try to disable foreign key checks during migrations.
312
+ * @default false
313
+ */
263
314
  disableForeignKeys?: boolean;
315
+ /**
316
+ * Run all migrations in the current batch in a master transaction.
317
+ * @default true
318
+ */
264
319
  allOrNothing?: boolean;
320
+ /**
321
+ * Allow dropping tables during schema diff.
322
+ * @default true
323
+ */
265
324
  dropTables?: boolean;
325
+ /**
326
+ * Safe mode - only allow adding new tables and columns, never dropping existing ones.
327
+ * @default false
328
+ */
266
329
  safe?: boolean;
330
+ /**
331
+ * Create a snapshot of the current schema after migration generation.
332
+ * @default true
333
+ */
267
334
  snapshot?: boolean;
335
+ /** Custom name for the snapshot file. */
268
336
  snapshotName?: string;
337
+ /**
338
+ * File extension for generated migration files.
339
+ * @default 'ts'
340
+ */
269
341
  emit?: 'js' | 'ts' | 'cjs';
342
+ /** Custom migration generator class. */
270
343
  generator?: Constructor<IMigrationGenerator>;
344
+ /**
345
+ * Custom function to generate migration file names.
346
+ * @default (timestamp, name) => `Migration${timestamp}${name ? '_' + name : ''}`
347
+ */
271
348
  fileName?: (timestamp: string, name?: string) => string;
349
+ /** List of migration classes or objects to use instead of file-based discovery. */
272
350
  migrationsList?: (MigrationObject | Constructor<Migration>)[];
273
351
  };
352
+ /**
353
+ * Configuration options for database seeders.
354
+ * @see https://mikro-orm.io/docs/seeding
355
+ */
274
356
  export interface SeederOptions {
357
+ /**
358
+ * Path to the folder with seeder files (for compiled JavaScript files).
359
+ * @default './seeders'
360
+ */
275
361
  path?: string;
362
+ /**
363
+ * Path to the folder with seeder files (for TypeScript source files).
364
+ * Used when running in TypeScript mode.
365
+ */
276
366
  pathTs?: string;
367
+ /**
368
+ * Glob pattern to match seeder files.
369
+ * @default '!(*.d).{js,ts}'
370
+ */
277
371
  glob?: string;
372
+ /**
373
+ * Name of the default seeder class to run.
374
+ * @default 'DatabaseSeeder'
375
+ */
278
376
  defaultSeeder?: string;
377
+ /**
378
+ * File extension for generated seeder files.
379
+ * @default 'ts'
380
+ */
279
381
  emit?: 'js' | 'ts';
382
+ /**
383
+ * Custom function to generate seeder file names.
384
+ * @default (className) => className
385
+ */
280
386
  fileName?: (className: string) => string;
387
+ /** List of seeder classes or objects to use instead of file-based discovery. */
388
+ seedersList?: (SeederObject | Constructor<Seeder>)[];
281
389
  }
390
+ /**
391
+ * Connection pool configuration.
392
+ * @see https://mikro-orm.io/docs/configuration#connection
393
+ */
282
394
  export interface PoolConfig {
395
+ /** Minimum number of connections to keep in the pool. */
283
396
  min?: number;
397
+ /** Maximum number of connections allowed in the pool. */
284
398
  max?: number;
399
+ /** Time in milliseconds before an idle connection is closed. */
285
400
  idleTimeoutMillis?: number;
286
401
  }
402
+ /**
403
+ * Configuration options for metadata discovery.
404
+ * @see https://mikro-orm.io/docs/configuration#entity-discovery
405
+ */
287
406
  export interface MetadataDiscoveryOptions {
407
+ /**
408
+ * Throw an error when no entities are discovered.
409
+ * @default true
410
+ */
288
411
  warnWhenNoEntities?: boolean;
289
- requireEntitiesArray?: boolean;
412
+ /**
413
+ * Check for duplicate table names and throw an error if found.
414
+ * @default true
415
+ */
290
416
  checkDuplicateTableNames?: boolean;
417
+ /**
418
+ * Check for duplicate field names and throw an error if found.
419
+ * @default true
420
+ */
291
421
  checkDuplicateFieldNames?: boolean;
292
- checkDuplicateEntities?: boolean;
422
+ /**
423
+ * Check for composite primary keys marked as `persist: false` and throw an error if found.
424
+ * @default true
425
+ */
293
426
  checkNonPersistentCompositeProps?: boolean;
294
- alwaysAnalyseProperties?: boolean;
295
- disableDynamicFileAccess?: boolean;
427
+ /**
428
+ * Infer default values from property initializers when possible
429
+ * (if the constructor can be invoked without parameters).
430
+ * @default true
431
+ */
296
432
  inferDefaultValues?: boolean;
433
+ /**
434
+ * Custom callback to override default type mapping.
435
+ * Allows customizing how property types are mapped to database column types.
436
+ * @example
437
+ * getMappedType(type, platform) {
438
+ * if (type === 'string') {
439
+ * return Type.getType(TextType);
440
+ * }
441
+ * return platform.getDefaultMappedType(type);
442
+ * }
443
+ */
297
444
  getMappedType?: (type: string, platform: Platform) => Type<unknown> | undefined;
445
+ /**
446
+ * Hook called for each entity metadata during discovery.
447
+ * Can be used to modify metadata dynamically before defaults are filled in.
448
+ * The hook can be async when using `MikroORM.init()`.
449
+ */
298
450
  onMetadata?: (meta: EntityMetadata, platform: Platform) => MaybePromise<void>;
451
+ /**
452
+ * Hook called after all entities are discovered.
453
+ * Can be used to access and modify all metadata at once.
454
+ */
299
455
  afterDiscovered?: (storage: MetadataStorage, platform: Platform) => MaybePromise<void>;
456
+ /** Path to the TypeScript configuration file for ts-morph metadata provider. */
300
457
  tsConfigPath?: string;
458
+ /** @internal */
459
+ skipSyncDiscovery?: boolean;
301
460
  }
302
- export interface MikroORMOptions<D extends IDatabaseDriver = IDatabaseDriver, EM extends EntityManager = EntityManager> extends ConnectionOptions {
303
- entities: (string | EntityClass<AnyEntity> | EntityClassGroup<AnyEntity> | EntitySchema)[];
304
- entitiesTs: (string | EntityClass<AnyEntity> | EntityClassGroup<AnyEntity> | EntitySchema)[];
305
- extensions: {
461
+ /**
462
+ * MikroORM configuration options.
463
+ * @see https://mikro-orm.io/docs/configuration
464
+ */
465
+ export interface Options<Driver extends IDatabaseDriver = IDatabaseDriver, EM extends EntityManager<Driver> & Driver[typeof EntityManagerType] = EntityManager<Driver> & Driver[typeof EntityManagerType], Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]> extends ConnectionOptions {
466
+ /**
467
+ * Array of entity classes or paths to entity modules.
468
+ * Paths support glob patterns for automatic discovery.
469
+ * @example
470
+ * entities: [Author, Book, Publisher] // class references
471
+ * entities: ['./dist/entities'] // folder paths
472
+ */
473
+ entities?: Entities;
474
+ /**
475
+ * Array of TypeScript entity source paths.
476
+ * Used when running in TypeScript mode (e.g., via `tsx` or `swc`).
477
+ * Should always be specified when using folder-based discovery.
478
+ * @example
479
+ * entitiesTs: ['./src/entities']
480
+ */
481
+ entitiesTs?: Entities;
482
+ /**
483
+ * ORM extensions to register (e.g., Migrator, EntityGenerator, SeedManager).
484
+ * Extensions registered here are available via shortcuts like `orm.migrator`.
485
+ * @example
486
+ * extensions: [Migrator, EntityGenerator, SeedManager]
487
+ */
488
+ extensions?: {
306
489
  register: (orm: MikroORM) => void;
307
490
  }[];
308
- subscribers: (EventSubscriber | Constructor<EventSubscriber>)[];
309
- filters: Dictionary<{
491
+ /**
492
+ * Event subscribers to register.
493
+ * Can be class references or instances.
494
+ */
495
+ subscribers?: Iterable<EventSubscriber | Constructor<EventSubscriber>>;
496
+ /**
497
+ * Global entity filters to apply.
498
+ * Filters are applied by default unless explicitly disabled.
499
+ * @see https://mikro-orm.io/docs/filters
500
+ */
501
+ filters?: Dictionary<{
310
502
  name?: string;
311
503
  } & Omit<FilterDef, 'name'>>;
312
- discovery: MetadataDiscoveryOptions;
504
+ /**
505
+ * Metadata discovery configuration options.
506
+ * Controls how entities are discovered and validated.
507
+ */
508
+ discovery?: MetadataDiscoveryOptions;
509
+ /**
510
+ * Database driver class to use.
511
+ * Should be imported from the specific driver package (e.g. `@mikro-orm/mysql`, `@mikro-orm/postgresql`).
512
+ * Alternatively, use the `defineConfig` helper or `MikroORM` class exported from the driver package.
513
+ * @example
514
+ * import { MySqlDriver } from '@mikro-orm/mysql';
515
+ *
516
+ * MikroORM.init({
517
+ * driver: MySqlDriver,
518
+ * dbName: 'my_db',
519
+ * });
520
+ */
313
521
  driver?: {
314
- new (config: Configuration): D;
522
+ new (config: Configuration): Driver;
315
523
  };
524
+ /**
525
+ * Custom naming strategy class for mapping entity/property names to database table/column names.
526
+ * Built-in options: `UnderscoreNamingStrategy`, `MongoNamingStrategy`, `EntityCaseNamingStrategy`.
527
+ * @see https://mikro-orm.io/docs/naming-strategy
528
+ */
316
529
  namingStrategy?: {
317
530
  new (): NamingStrategy;
318
531
  };
532
+ /**
533
+ * Enable implicit transactions for all write operations.
534
+ * When enabled, all queries will be wrapped in a transaction.
535
+ * Disabled for MongoDB driver by default.
536
+ */
319
537
  implicitTransactions?: boolean;
538
+ /**
539
+ * Disable all transactions.
540
+ * When enabled, no queries will be wrapped in transactions, even when explicitly requested.
541
+ * @default false
542
+ */
320
543
  disableTransactions?: boolean;
321
- connect: boolean;
322
- verbose: boolean;
544
+ /**
545
+ * Enable verbose logging of internal operations.
546
+ * @default false
547
+ */
548
+ verbose?: boolean;
549
+ /**
550
+ * Ignore `undefined` values in find queries instead of treating them as `null`.
551
+ * @default false
552
+ * @example
553
+ * // With ignoreUndefinedInQuery: true
554
+ * em.find(User, { email: undefined }) // resolves to em.find(User, {})
555
+ */
323
556
  ignoreUndefinedInQuery?: boolean;
324
- onQuery: (sql: string, params: readonly unknown[]) => string;
325
- autoJoinOneToOneOwner: boolean;
326
- autoJoinRefsForFilters: boolean;
327
- propagationOnPrototype: boolean;
328
- populateAfterFlush: boolean;
329
- serialization: {
557
+ /**
558
+ * Hook to modify SQL queries before execution.
559
+ * Useful for adding observability hints or query modifications.
560
+ * @param sql - The generated SQL query
561
+ * @param params - Query parameters
562
+ * @returns Modified SQL query
563
+ */
564
+ onQuery?: (sql: string, params: readonly unknown[]) => string;
565
+ /**
566
+ * Automatically join the owning side of 1:1 relations when querying the inverse side.
567
+ * @default true
568
+ */
569
+ autoJoinOneToOneOwner?: boolean;
570
+ /**
571
+ * Automatically join M:1 and 1:1 relations when filters are defined on them.
572
+ * Important for implementing soft deletes via filters.
573
+ * @default true
574
+ */
575
+ autoJoinRefsForFilters?: boolean;
576
+ /**
577
+ * Apply filters to relations in queries.
578
+ * @default true
579
+ */
580
+ filtersOnRelations?: boolean;
581
+ /**
582
+ * Enable propagation of changes on entity prototypes.
583
+ * @default true
584
+ */
585
+ propagationOnPrototype?: boolean;
586
+ /**
587
+ * Mark all relations as populated after flush for new entities.
588
+ * This aligns serialized output of loaded entities and just-inserted ones.
589
+ * @default true
590
+ */
591
+ populateAfterFlush?: boolean;
592
+ /**
593
+ * Serialization options for `toJSON()` and `serialize()` methods.
594
+ */
595
+ serialization?: {
596
+ /**
597
+ * Include primary keys in serialized output.
598
+ * @default true
599
+ */
330
600
  includePrimaryKeys?: boolean;
331
- /** Enforce unpopulated references to be returned as objects, e.g. `{ author: { id: 1 } }` instead of `{ author: 1 }`. */
601
+ /**
602
+ * Enforce unpopulated references to be returned as objects.
603
+ * When enabled, references are serialized as `{ author: { id: 1 } }` instead of `{ author: 1 }`.
604
+ * @default false
605
+ */
332
606
  forceObject?: boolean;
333
607
  };
334
- assign: AssignOptions<boolean>;
335
- persistOnCreate: boolean;
336
- upsertManaged: boolean;
337
- forceEntityConstructor: boolean | (Constructor<AnyEntity> | string)[];
338
- forceUndefined: boolean;
608
+ /**
609
+ * Default options for entity assignment via `em.assign()`.
610
+ * @see https://mikro-orm.io/docs/entity-helper
611
+ */
612
+ assign?: AssignOptions<boolean>;
613
+ /**
614
+ * Automatically call `em.persist()` on entities created via `em.create()`.
615
+ * @default true
616
+ */
617
+ persistOnCreate?: boolean;
618
+ /**
619
+ * When upsert creates a new entity, mark it as managed in the identity map.
620
+ * @default true
621
+ */
622
+ upsertManaged?: boolean;
623
+ /**
624
+ * Force use of entity constructors when creating entity instances.
625
+ * Required when using native private properties inside entities.
626
+ * Can be `true` for all entities or an array of specific entity classes/names.
627
+ * @default false
628
+ */
629
+ forceEntityConstructor?: boolean | (Constructor<AnyEntity> | string)[];
630
+ /**
631
+ * Convert `null` values from database to `undefined` when hydrating entities.
632
+ * @default false
633
+ */
634
+ forceUndefined?: boolean;
339
635
  /**
340
636
  * Property `onCreate` hooks are normally executed during `flush` operation.
341
637
  * With this option, they will be processed early inside `em.create()` method.
638
+ * @default true
639
+ */
640
+ processOnCreateHooksEarly?: boolean;
641
+ /**
642
+ * Force `Date` values to be stored in UTC for datetime columns without timezone.
643
+ * Works for MySQL (`datetime` type), PostgreSQL (`timestamp` type), and MSSQL (`datetime`/`datetime2` types).
644
+ * SQLite does this by default.
645
+ * @default true
342
646
  */
343
- processOnCreateHooksEarly: boolean;
344
647
  forceUtcTimezone?: boolean;
648
+ /**
649
+ * Timezone to use for date operations.
650
+ * @example '+02:00'
651
+ */
345
652
  timezone?: string;
346
- ensureDatabase: boolean | EnsureDatabaseOptions;
347
- ensureIndexes: boolean;
653
+ /**
654
+ * Ensure the database exists when initializing the ORM.
655
+ * When `true`, will create the database if it doesn't exist.
656
+ * @default true
657
+ */
658
+ ensureDatabase?: boolean | EnsureDatabaseOptions;
659
+ /**
660
+ * Ensure database indexes exist on startup. This option works only with the MongoDB driver.
661
+ * When enabled, indexes will be created based on entity metadata.
662
+ * @default false
663
+ */
664
+ ensureIndexes?: boolean;
665
+ /**
666
+ * Use batch insert queries for better performance.
667
+ * @default true
668
+ */
348
669
  useBatchInserts?: boolean;
670
+ /**
671
+ * Use batch update queries for better performance.
672
+ * @default true
673
+ */
349
674
  useBatchUpdates?: boolean;
350
- batchSize: number;
351
- hydrator: HydratorConstructor;
352
- loadStrategy: LoadStrategy | `${LoadStrategy}`;
353
- dataloader: DataloaderType | boolean;
675
+ /**
676
+ * Number of entities to process in each batch for batch inserts/updates.
677
+ * @default 300
678
+ */
679
+ batchSize?: number;
680
+ /**
681
+ * Custom hydrator class for assigning database values to entities.
682
+ * @default ObjectHydrator
683
+ */
684
+ hydrator?: HydratorConstructor;
685
+ /**
686
+ * Pre-generated compiled functions for hydration and comparison.
687
+ * Use the `compile` CLI command to create these functions.
688
+ * Enables deployment to runtimes that prohibit `new Function`/eval (e.g. Cloudflare Workers).
689
+ */
690
+ compiledFunctions?: CompiledFunctions;
691
+ /**
692
+ * Default loading strategy for relations.
693
+ * - `'joined'`: Use SQL JOINs (single query, may cause cartesian product)
694
+ * - `'select-in'`: Use separate SELECT IN queries (multiple queries)
695
+ * - `'balanced'`: Decides based on relation type and context.
696
+ * @default 'balanced'
697
+ */
698
+ loadStrategy?: LoadStrategy | `${LoadStrategy}`;
699
+ /**
700
+ * Enable dataloader for batching reference loading.
701
+ * - `true` or `DataloaderType.ALL`: Enable for all relation types
702
+ * - `false` or `DataloaderType.NONE`: Disable dataloader
703
+ * - `DataloaderType.REFERENCE`: Enable only for scalar references
704
+ * - `DataloaderType.COLLECTION`: Enable only for collections
705
+ * @default DataloaderType.NONE
706
+ */
707
+ dataloader?: DataloaderType | boolean;
708
+ /**
709
+ * Determines how where conditions are applied during population.
710
+ * - `'all'`: Populate all matching relations (default in v5+)
711
+ * - `'infer'`: Infer conditions from the original query (v4 behavior)
712
+ * @default 'all'
713
+ */
354
714
  populateWhere?: PopulateHint | `${PopulateHint}`;
355
- flushMode: FlushMode | 'commit' | 'auto' | 'always';
715
+ /**
716
+ * Default flush mode for the entity manager.
717
+ * - `'commit'`: Flush only on explicit commit
718
+ * - `'auto'`: Flush before queries when needed
719
+ * - `'always'`: Always flush before queries
720
+ * @default 'auto'
721
+ */
722
+ flushMode?: FlushMode | `${FlushMode}`;
723
+ /**
724
+ * Custom base repository class for all entities.
725
+ * Entity-specific repositories can still be defined and will take precedence.
726
+ * @see https://mikro-orm.io/docs/repositories
727
+ */
356
728
  entityRepository?: EntityClass<EntityRepository<any>>;
729
+ /**
730
+ * Custom entity manager class to use.
731
+ */
357
732
  entityManager?: Constructor<EM>;
733
+ /**
734
+ * Read replica connection configurations.
735
+ * Each replica can override parts of the main connection options.
736
+ * @see https://mikro-orm.io/docs/read-connections
737
+ */
358
738
  replicas?: ConnectionOptions[];
359
- strict: boolean;
360
- validate: boolean;
361
- validateRequired: boolean;
362
- context: (name: string) => EntityManager | undefined;
363
- contextName: string;
364
- allowGlobalContext: boolean;
739
+ /**
740
+ * Validate that required properties are set on new entities before insert.
741
+ * @default true
742
+ */
743
+ validateRequired?: boolean;
744
+ /**
745
+ * Callback to get the current request context's EntityManager.
746
+ * Used for automatic context propagation in web frameworks.
747
+ * @default RequestContext.getEntityManager
748
+ */
749
+ context?: (name: string) => EntityManager | undefined;
750
+ /**
751
+ * Name of the context for multi-ORM setups.
752
+ * @default 'default'
753
+ */
754
+ contextName?: string;
755
+ /**
756
+ * Allow using the global EntityManager without a request context.
757
+ * Not recommended for production - each request should have its own context.
758
+ * Can also be set via `MIKRO_ORM_ALLOW_GLOBAL_CONTEXT` environment variable.
759
+ * @default false
760
+ */
761
+ allowGlobalContext?: boolean;
762
+ /**
763
+ * When enabled, environment variables take precedence over explicitly provided config options.
764
+ * By default, explicit options win over env vars.
765
+ * @default false
766
+ */
767
+ preferEnvVars?: boolean;
768
+ /**
769
+ * Disable the identity map.
770
+ * When disabled, each query returns new entity instances.
771
+ * Not recommended for most use cases.
772
+ * @default false
773
+ */
365
774
  disableIdentityMap?: boolean;
366
- logger: (message: string) => void;
775
+ /**
776
+ * Custom logger function for ORM output.
777
+ * @default console.log
778
+ */
779
+ logger?: (message: string) => void;
780
+ /**
781
+ * Enable colored output in logs.
782
+ * @default true
783
+ */
367
784
  colors?: boolean;
785
+ /**
786
+ * Factory function to create a custom logger instance.
787
+ * @default DefaultLogger.create
788
+ */
368
789
  loggerFactory?: (options: LoggerOptions) => Logger;
369
- findOneOrFailHandler: (entityName: string, where: Dictionary | IPrimaryKey) => Error;
370
- findExactlyOneOrFailHandler: (entityName: string, where: Dictionary | IPrimaryKey) => Error;
371
- debug: boolean | LoggerNamespace[];
372
- ignoreDeprecations: boolean | string[];
373
- highlighter: Highlighter;
374
790
  /**
375
- * Using this option, you can force the ORM to use the TS options regardless of whether the TypeScript support
376
- * is detected or not. This effectively means using `entitiesTs` for discovery and `pathTs` for migrations and
377
- * seeders. Should be used only for tests and stay disabled for production builds.
791
+ * Custom error handler for `em.findOneOrFail()` when no entity is found.
792
+ * @param entityName - Name of the entity being queried
793
+ * @param where - Query conditions
794
+ * @returns Error instance to throw
795
+ */
796
+ findOneOrFailHandler?: (entityName: string, where: Dictionary | IPrimaryKey) => Error;
797
+ /**
798
+ * Custom error handler for `em.findExactlyOneOrFail()` when entity count is not exactly one.
799
+ * Used when strict mode is enabled.
800
+ * @param entityName - Name of the entity being queried
801
+ * @param where - Query conditions
802
+ * @returns Error instance to throw
803
+ */
804
+ findExactlyOneOrFailHandler?: (entityName: string, where: Dictionary | IPrimaryKey) => Error;
805
+ /**
806
+ * Enable debug logging.
807
+ * Can be `true` for all namespaces or an array of specific namespaces.
808
+ * Available namespaces: `'query'`, `'query-params'`, `'discovery'`, `'info'`.
809
+ * @default false
810
+ * @see https://mikro-orm.io/docs/logging
811
+ */
812
+ debug?: boolean | LoggerNamespace[];
813
+ /**
814
+ * Ignore deprecation warnings.
815
+ * Can be `true` to ignore all or an array of specific deprecation labels.
816
+ * @default false
817
+ * @see https://mikro-orm.io/docs/logging#deprecation-warnings
818
+ */
819
+ ignoreDeprecations?: boolean | string[];
820
+ /**
821
+ * Syntax highlighter for SQL queries in logs.
822
+ * @default NullHighlighter
823
+ */
824
+ highlighter?: Highlighter;
825
+ /**
826
+ * Force the ORM to use TypeScript options regardless of detection.
827
+ * Uses `entitiesTs` for discovery and `pathTs` for migrations/seeders.
828
+ * Should only be used for tests, not production builds.
829
+ * @default false
378
830
  */
379
831
  preferTs?: boolean;
380
- baseDir: string;
381
- migrations: MigrationsOptions;
382
- schemaGenerator: {
832
+ /**
833
+ * Base directory for resolving relative paths.
834
+ * @default process.cwd()
835
+ */
836
+ baseDir?: string;
837
+ /**
838
+ * Migration configuration options.
839
+ * @see https://mikro-orm.io/docs/migrations
840
+ */
841
+ migrations?: MigrationsOptions;
842
+ /**
843
+ * Schema generator configuration options.
844
+ */
845
+ schemaGenerator?: {
846
+ /**
847
+ * Try to disable foreign key checks during schema operations.
848
+ * @default false
849
+ */
383
850
  disableForeignKeys?: boolean;
851
+ /**
852
+ * Try to disable foreign key checks during `schema.clear()`. Enabled by default for MySQL/MariaDB.
853
+ */
854
+ disableForeignKeysForClear?: boolean;
855
+ /**
856
+ * Generate foreign key constraints.
857
+ * @default true
858
+ */
384
859
  createForeignKeyConstraints?: boolean;
860
+ /**
861
+ * Schema names to ignore when comparing schemas.
862
+ * @default []
863
+ */
385
864
  ignoreSchema?: string[];
865
+ /**
866
+ * Table names or patterns to skip during schema generation.
867
+ * @default []
868
+ */
386
869
  skipTables?: (string | RegExp)[];
870
+ /**
871
+ * View names or patterns to skip during schema generation (e.g. PostGIS system views).
872
+ * @default []
873
+ */
874
+ skipViews?: (string | RegExp)[];
875
+ /**
876
+ * Column names or patterns to skip during schema generation, keyed by table name.
877
+ * @default {}
878
+ */
387
879
  skipColumns?: Dictionary<(string | RegExp)[]>;
880
+ /**
881
+ * Database name to use for management operations (e.g., creating/dropping databases).
882
+ */
388
883
  managementDbName?: string;
884
+ /**
885
+ * Default ON UPDATE rule for foreign keys.
886
+ * When not set, no rule is emitted and the database uses its native default (NO ACTION/RESTRICT).
887
+ */
888
+ defaultUpdateRule?: 'cascade' | 'no action' | 'set null' | 'set default' | 'restrict';
889
+ /**
890
+ * Default ON DELETE rule for foreign keys.
891
+ * When not set, no rule is emitted and the database uses its native default (NO ACTION/RESTRICT).
892
+ */
893
+ defaultDeleteRule?: 'cascade' | 'no action' | 'set null' | 'set default' | 'restrict';
389
894
  };
390
- embeddables: {
895
+ /**
896
+ * Embeddable entity configuration options.
897
+ */
898
+ embeddables?: {
899
+ /**
900
+ * Mode for generating column prefixes for embedded properties.
901
+ * @default 'relative'
902
+ */
391
903
  prefixMode: EmbeddedPrefixMode;
392
904
  };
393
- entityGenerator: GenerateOptions;
394
- metadataCache: {
905
+ /**
906
+ * Entity generator (code generation) configuration options.
907
+ * @see https://mikro-orm.io/docs/entity-generator
908
+ */
909
+ entityGenerator?: GenerateOptions;
910
+ /**
911
+ * Metadata cache configuration for improved startup performance.
912
+ * @see https://mikro-orm.io/docs/metadata-cache
913
+ */
914
+ metadataCache?: {
915
+ /**
916
+ * Enable metadata caching.
917
+ * Defaults based on the metadata provider's `useCache()` method.
918
+ */
395
919
  enabled?: boolean;
920
+ /**
921
+ * Combine all metadata into a single cache file.
922
+ * Can be `true` for default path or a custom path string.
923
+ */
396
924
  combined?: boolean | string;
925
+ /**
926
+ * Pretty print JSON cache files.
927
+ * @default false
928
+ */
397
929
  pretty?: boolean;
930
+ /**
931
+ * Cache adapter class to use. When cache is enabled, and no adapter is provided explicitly, {@link FileCacheAdapter} is used automatically - but only if you use the async `MikroORM.init()` method.
932
+ */
398
933
  adapter?: {
399
934
  new (...params: any[]): SyncCacheAdapter;
400
935
  };
936
+ /**
937
+ * Options passed to the cache adapter constructor.
938
+ * @default { cacheDir: process.cwd() + '/temp' }
939
+ */
401
940
  options?: Dictionary;
402
941
  };
403
- resultCache: {
942
+ /**
943
+ * Result cache configuration for query result caching.
944
+ */
945
+ resultCache?: {
946
+ /**
947
+ * Default cache expiration time in milliseconds.
948
+ * @default 1000
949
+ */
404
950
  expiration?: number;
951
+ /**
952
+ * Cache adapter class to use.
953
+ * @default MemoryCacheAdapter
954
+ */
405
955
  adapter?: {
406
956
  new (...params: any[]): CacheAdapter;
407
957
  };
958
+ /**
959
+ * Options passed to the cache adapter constructor.
960
+ * @default {}
961
+ */
408
962
  options?: Dictionary;
963
+ /**
964
+ * Enable global result caching for all queries.
965
+ * Can be `true`, an expiration number, or a tuple of `[key, expiration]`.
966
+ */
409
967
  global?: boolean | number | [string, number];
410
968
  };
411
- metadataProvider: {
969
+ /**
970
+ * Metadata provider class for entity discovery.
971
+ * Built-in options: `ReflectMetadataProvider` (default), `TsMorphMetadataProvider`.
972
+ * @default ReflectMetadataProvider
973
+ * @see https://mikro-orm.io/docs/metadata-providers
974
+ */
975
+ metadataProvider?: {
412
976
  new (config: Configuration): MetadataProvider;
977
+ useCache?: MetadataProvider['useCache'];
413
978
  };
414
- seeder: SeederOptions;
415
- preferReadReplicas: boolean;
416
- hashAlgorithm: 'md5' | 'sha256';
417
- dynamicImportProvider: (id: string) => Promise<unknown>;
979
+ /**
980
+ * Seeder configuration options.
981
+ * @see https://mikro-orm.io/docs/seeding
982
+ */
983
+ seeder?: SeederOptions;
984
+ /**
985
+ * Prefer read replicas for read operations when available.
986
+ * @default true
987
+ */
988
+ preferReadReplicas?: boolean;
989
+ /**
990
+ * Custom dynamic import provider for loading modules.
991
+ * @default (id) => import(id)
992
+ */
993
+ dynamicImportProvider?: (id: string) => Promise<unknown>;
418
994
  }
419
- export type Options<D extends IDatabaseDriver = IDatabaseDriver, EM extends D[typeof EntityManagerType] & EntityManager = D[typeof EntityManagerType] & EntityManager> = Pick<MikroORMOptions<D, EM>, Exclude<keyof MikroORMOptions<D, EM>, keyof typeof Configuration.DEFAULTS>> & Partial<MikroORMOptions<D, EM>>;
995
+ type MarkRequired<T, D> = {
996
+ [K in keyof T as Extract<K, keyof D>]-?: T[K];
997
+ } & {
998
+ [K in keyof T as Exclude<K, keyof D>]?: T[K];
999
+ };
1000
+ export type RequiredOptions<D extends IDatabaseDriver = IDatabaseDriver, EM extends EntityManager<D> = EntityManager<D>, Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]> = MarkRequired<Options<D, EM, Entities>, typeof DEFAULTS>;
1001
+ export {};