@mikro-orm/core 7.0.0-dev.6 → 7.0.0-dev.60
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 +85 -32
- package/EntityManager.js +281 -178
- package/MikroORM.d.ts +8 -8
- package/MikroORM.js +31 -74
- package/README.md +3 -2
- package/cache/FileCacheAdapter.d.ts +2 -1
- package/cache/FileCacheAdapter.js +5 -4
- package/connections/Connection.d.ts +11 -7
- package/connections/Connection.js +16 -13
- package/decorators/Embedded.d.ts +5 -11
- package/decorators/Entity.d.ts +18 -3
- package/decorators/Indexed.d.ts +2 -2
- package/decorators/ManyToMany.d.ts +2 -0
- package/decorators/ManyToOne.d.ts +4 -0
- package/decorators/OneToOne.d.ts +4 -0
- package/decorators/Property.d.ts +53 -9
- package/decorators/Transactional.d.ts +3 -1
- package/decorators/Transactional.js +6 -3
- package/decorators/index.d.ts +1 -1
- package/drivers/DatabaseDriver.d.ts +11 -5
- package/drivers/DatabaseDriver.js +13 -4
- package/drivers/IDatabaseDriver.d.ts +29 -5
- package/entity/ArrayCollection.d.ts +6 -4
- package/entity/ArrayCollection.js +26 -9
- package/entity/BaseEntity.d.ts +0 -1
- package/entity/BaseEntity.js +0 -3
- package/entity/Collection.d.ts +3 -4
- package/entity/Collection.js +34 -17
- package/entity/EntityAssigner.d.ts +1 -1
- package/entity/EntityAssigner.js +9 -1
- package/entity/EntityFactory.d.ts +7 -0
- package/entity/EntityFactory.js +40 -22
- package/entity/EntityHelper.js +25 -8
- package/entity/EntityLoader.d.ts +5 -4
- package/entity/EntityLoader.js +69 -36
- package/entity/EntityRepository.d.ts +1 -1
- package/entity/EntityValidator.js +2 -2
- package/entity/Reference.d.ts +9 -7
- package/entity/Reference.js +32 -5
- package/entity/WrappedEntity.d.ts +0 -2
- package/entity/WrappedEntity.js +1 -5
- package/entity/defineEntity.d.ts +555 -0
- package/entity/defineEntity.js +529 -0
- package/entity/index.d.ts +2 -0
- package/entity/index.js +2 -0
- package/entity/utils.d.ts +7 -0
- package/entity/utils.js +15 -3
- package/enums.d.ts +18 -5
- package/enums.js +13 -0
- package/errors.d.ts +6 -1
- package/errors.js +14 -4
- package/events/EventSubscriber.d.ts +3 -1
- package/hydration/ObjectHydrator.d.ts +4 -4
- package/hydration/ObjectHydrator.js +35 -24
- package/index.d.ts +2 -1
- package/index.js +1 -1
- package/logging/DefaultLogger.d.ts +1 -1
- package/logging/SimpleLogger.d.ts +1 -1
- package/metadata/EntitySchema.d.ts +8 -4
- package/metadata/EntitySchema.js +40 -20
- package/metadata/MetadataDiscovery.d.ts +5 -7
- package/metadata/MetadataDiscovery.js +150 -155
- package/metadata/MetadataStorage.js +1 -1
- package/metadata/MetadataValidator.js +4 -3
- package/metadata/discover-entities.d.ts +5 -0
- package/metadata/discover-entities.js +39 -0
- package/naming-strategy/AbstractNamingStrategy.d.ts +5 -1
- package/naming-strategy/AbstractNamingStrategy.js +7 -1
- package/naming-strategy/NamingStrategy.d.ts +11 -1
- package/package.json +14 -7
- package/platforms/Platform.d.ts +5 -8
- package/platforms/Platform.js +4 -17
- package/serialization/EntitySerializer.d.ts +2 -0
- package/serialization/EntitySerializer.js +29 -11
- package/serialization/EntityTransformer.js +22 -12
- package/serialization/SerializationContext.js +14 -11
- package/types/BigIntType.d.ts +9 -6
- package/types/BigIntType.js +3 -0
- package/types/BlobType.d.ts +0 -1
- package/types/BlobType.js +0 -3
- package/types/BooleanType.d.ts +2 -1
- package/types/BooleanType.js +3 -0
- package/types/DecimalType.d.ts +6 -4
- package/types/DecimalType.js +1 -1
- package/types/DoubleType.js +1 -1
- package/types/JsonType.d.ts +1 -1
- package/types/JsonType.js +7 -2
- package/types/Type.d.ts +2 -1
- package/types/Type.js +1 -1
- package/types/Uint8ArrayType.d.ts +0 -1
- package/types/Uint8ArrayType.js +0 -3
- package/types/index.d.ts +1 -1
- package/typings.d.ts +94 -50
- package/typings.js +31 -31
- package/unit-of-work/ChangeSetComputer.js +8 -3
- package/unit-of-work/ChangeSetPersister.d.ts +4 -2
- package/unit-of-work/ChangeSetPersister.js +37 -16
- package/unit-of-work/UnitOfWork.d.ts +8 -1
- package/unit-of-work/UnitOfWork.js +110 -53
- package/utils/AbstractSchemaGenerator.js +3 -1
- package/utils/Configuration.d.ts +201 -184
- package/utils/Configuration.js +143 -151
- package/utils/ConfigurationLoader.d.ts +9 -22
- package/utils/ConfigurationLoader.js +53 -76
- package/utils/Cursor.d.ts +3 -3
- package/utils/Cursor.js +3 -0
- package/utils/DataloaderUtils.d.ts +15 -5
- package/utils/DataloaderUtils.js +53 -7
- package/utils/EntityComparator.d.ts +8 -4
- package/utils/EntityComparator.js +105 -58
- package/utils/QueryHelper.d.ts +9 -1
- package/utils/QueryHelper.js +66 -5
- package/utils/RawQueryFragment.d.ts +36 -4
- package/utils/RawQueryFragment.js +34 -13
- package/utils/TransactionManager.d.ts +65 -0
- package/utils/TransactionManager.js +223 -0
- package/utils/Utils.d.ts +13 -12
- package/utils/Utils.js +106 -66
- package/utils/index.d.ts +1 -0
- package/utils/index.js +1 -0
- package/utils/upsert-utils.d.ts +7 -2
- package/utils/upsert-utils.js +52 -1
package/utils/Configuration.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { NamingStrategy } from '../naming-strategy/NamingStrategy.js';
|
|
2
2
|
import { FileCacheAdapter } from '../cache/FileCacheAdapter.js';
|
|
3
|
-
import { type
|
|
3
|
+
import { type CacheAdapter, type SyncCacheAdapter } from '../cache/CacheAdapter.js';
|
|
4
4
|
import type { EntityRepository } from '../entity/EntityRepository.js';
|
|
5
|
-
import type { AnyEntity, Constructor, Dictionary, EntityClass,
|
|
5
|
+
import type { AnyEntity, Constructor, Dictionary, EnsureDatabaseOptions, EntityClass, EntityMetadata, FilterDef, GenerateOptions, Highlighter, HydratorConstructor, IHydrator, IMigrationGenerator, IPrimaryKey, MaybePromise, Migration, MigrationObject } from '../typings.js';
|
|
6
6
|
import { ObjectHydrator } from '../hydration/ObjectHydrator.js';
|
|
7
7
|
import { NullHighlighter } from '../utils/NullHighlighter.js';
|
|
8
8
|
import { type Logger, type LoggerNamespace, type LoggerOptions } from '../logging/Logger.js';
|
|
@@ -22,128 +22,134 @@ import { MemoryCacheAdapter } from '../cache/MemoryCacheAdapter.js';
|
|
|
22
22
|
import { EntityComparator } from './EntityComparator.js';
|
|
23
23
|
import type { Type } from '../types/Type.js';
|
|
24
24
|
import type { MikroORM } from '../MikroORM.js';
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
options: {};
|
|
134
|
-
};
|
|
135
|
-
metadataProvider: typeof ReflectMetadataProvider;
|
|
136
|
-
highlighter: NullHighlighter;
|
|
137
|
-
seeder: {
|
|
138
|
-
path: string;
|
|
139
|
-
defaultSeeder: string;
|
|
140
|
-
glob: string;
|
|
141
|
-
emit: "ts";
|
|
142
|
-
fileName: (className: string) => string;
|
|
25
|
+
declare const DEFAULTS: {
|
|
26
|
+
readonly pool: {};
|
|
27
|
+
readonly entities: readonly [];
|
|
28
|
+
readonly entitiesTs: readonly [];
|
|
29
|
+
readonly extensions: readonly [];
|
|
30
|
+
readonly subscribers: readonly [];
|
|
31
|
+
readonly filters: {};
|
|
32
|
+
readonly discovery: {
|
|
33
|
+
readonly warnWhenNoEntities: true;
|
|
34
|
+
readonly requireEntitiesArray: false;
|
|
35
|
+
readonly checkDuplicateTableNames: true;
|
|
36
|
+
readonly checkDuplicateFieldNames: true;
|
|
37
|
+
readonly checkDuplicateEntities: true;
|
|
38
|
+
readonly checkNonPersistentCompositeProps: true;
|
|
39
|
+
readonly alwaysAnalyseProperties: true;
|
|
40
|
+
readonly disableDynamicFileAccess: false;
|
|
41
|
+
readonly inferDefaultValues: true;
|
|
42
|
+
};
|
|
43
|
+
readonly strict: false;
|
|
44
|
+
readonly validate: false;
|
|
45
|
+
readonly validateRequired: true;
|
|
46
|
+
readonly context: (name: string) => EntityManager<IDatabaseDriver<import("../index.js").Connection>> | undefined;
|
|
47
|
+
readonly contextName: "default";
|
|
48
|
+
readonly allowGlobalContext: false;
|
|
49
|
+
readonly logger: (message?: any, ...optionalParams: any[]) => void;
|
|
50
|
+
readonly colors: true;
|
|
51
|
+
readonly findOneOrFailHandler: (entityName: string, where: Dictionary | IPrimaryKey) => NotFoundError<Partial<any>>;
|
|
52
|
+
readonly findExactlyOneOrFailHandler: (entityName: string, where: Dictionary | IPrimaryKey) => NotFoundError<Partial<any>>;
|
|
53
|
+
readonly baseDir: string;
|
|
54
|
+
readonly hydrator: typeof ObjectHydrator;
|
|
55
|
+
readonly flushMode: FlushMode.AUTO;
|
|
56
|
+
readonly loadStrategy: LoadStrategy.BALANCED;
|
|
57
|
+
readonly dataloader: DataloaderType.NONE;
|
|
58
|
+
readonly populateWhere: PopulateHint.ALL;
|
|
59
|
+
readonly ignoreUndefinedInQuery: false;
|
|
60
|
+
readonly onQuery: (sql: string) => string;
|
|
61
|
+
readonly autoJoinOneToOneOwner: true;
|
|
62
|
+
readonly autoJoinRefsForFilters: true;
|
|
63
|
+
readonly filtersOnRelations: true;
|
|
64
|
+
readonly propagationOnPrototype: true;
|
|
65
|
+
readonly populateAfterFlush: true;
|
|
66
|
+
readonly serialization: {
|
|
67
|
+
readonly includePrimaryKeys: true;
|
|
68
|
+
};
|
|
69
|
+
readonly assign: {
|
|
70
|
+
readonly updateNestedEntities: true;
|
|
71
|
+
readonly updateByPrimaryKey: true;
|
|
72
|
+
readonly mergeObjectProperties: false;
|
|
73
|
+
readonly mergeEmbeddedProperties: true;
|
|
74
|
+
readonly ignoreUndefined: false;
|
|
75
|
+
};
|
|
76
|
+
readonly persistOnCreate: true;
|
|
77
|
+
readonly upsertManaged: true;
|
|
78
|
+
readonly forceEntityConstructor: false;
|
|
79
|
+
readonly forceUndefined: false;
|
|
80
|
+
readonly processOnCreateHooksEarly: false;
|
|
81
|
+
readonly ensureDatabase: true;
|
|
82
|
+
readonly ensureIndexes: false;
|
|
83
|
+
readonly batchSize: 300;
|
|
84
|
+
readonly hashAlgorithm: "md5";
|
|
85
|
+
readonly debug: false;
|
|
86
|
+
readonly ignoreDeprecations: false;
|
|
87
|
+
readonly verbose: false;
|
|
88
|
+
readonly driverOptions: {};
|
|
89
|
+
readonly migrations: {
|
|
90
|
+
readonly tableName: "mikro_orm_migrations";
|
|
91
|
+
readonly path: "./migrations";
|
|
92
|
+
readonly glob: "!(*.d).{js,ts,cjs}";
|
|
93
|
+
readonly silent: false;
|
|
94
|
+
readonly transactional: true;
|
|
95
|
+
readonly disableForeignKeys: false;
|
|
96
|
+
readonly allOrNothing: true;
|
|
97
|
+
readonly dropTables: true;
|
|
98
|
+
readonly safe: false;
|
|
99
|
+
readonly snapshot: true;
|
|
100
|
+
readonly emit: "ts";
|
|
101
|
+
readonly fileName: (timestamp: string, name?: string) => string;
|
|
102
|
+
};
|
|
103
|
+
readonly schemaGenerator: {
|
|
104
|
+
readonly disableForeignKeys: false;
|
|
105
|
+
readonly createForeignKeyConstraints: true;
|
|
106
|
+
readonly ignoreSchema: readonly [];
|
|
107
|
+
readonly skipTables: readonly [];
|
|
108
|
+
readonly skipColumns: {};
|
|
109
|
+
};
|
|
110
|
+
readonly embeddables: {
|
|
111
|
+
readonly prefixMode: "relative";
|
|
112
|
+
};
|
|
113
|
+
readonly entityGenerator: {
|
|
114
|
+
readonly forceUndefined: true;
|
|
115
|
+
readonly undefinedDefaults: false;
|
|
116
|
+
readonly scalarTypeInDecorator: false;
|
|
117
|
+
readonly bidirectionalRelations: true;
|
|
118
|
+
readonly identifiedReferences: true;
|
|
119
|
+
readonly scalarPropertiesForRelations: "never";
|
|
120
|
+
readonly entityDefinition: "defineEntity";
|
|
121
|
+
readonly enumMode: "dictionary";
|
|
122
|
+
readonly fileName: (className: string) => string;
|
|
123
|
+
readonly onlyPurePivotTables: false;
|
|
124
|
+
readonly outputPurePivotTables: false;
|
|
125
|
+
readonly readOnlyPivotTables: false;
|
|
126
|
+
readonly useCoreBaseEntity: false;
|
|
127
|
+
};
|
|
128
|
+
readonly metadataCache: {
|
|
129
|
+
readonly pretty: false;
|
|
130
|
+
readonly adapter: typeof FileCacheAdapter;
|
|
131
|
+
readonly options: {
|
|
132
|
+
readonly cacheDir: string;
|
|
143
133
|
};
|
|
144
|
-
preferReadReplicas: true;
|
|
145
|
-
dynamicImportProvider: (id: string) => Promise<any>;
|
|
146
134
|
};
|
|
135
|
+
readonly resultCache: {
|
|
136
|
+
readonly adapter: typeof MemoryCacheAdapter;
|
|
137
|
+
readonly expiration: 1000;
|
|
138
|
+
readonly options: {};
|
|
139
|
+
};
|
|
140
|
+
readonly metadataProvider: typeof ReflectMetadataProvider;
|
|
141
|
+
readonly highlighter: NullHighlighter;
|
|
142
|
+
readonly seeder: {
|
|
143
|
+
readonly path: "./seeders";
|
|
144
|
+
readonly defaultSeeder: "DatabaseSeeder";
|
|
145
|
+
readonly glob: "!(*.d).{js,ts}";
|
|
146
|
+
readonly emit: "ts";
|
|
147
|
+
readonly fileName: (className: string) => string;
|
|
148
|
+
};
|
|
149
|
+
readonly preferReadReplicas: true;
|
|
150
|
+
readonly dynamicImportProvider: (id: string) => Promise<any>;
|
|
151
|
+
};
|
|
152
|
+
export declare class Configuration<D extends IDatabaseDriver = IDatabaseDriver, EM extends EntityManager<D> = D[typeof EntityManagerType] & EntityManager<D>> {
|
|
147
153
|
private readonly options;
|
|
148
154
|
private readonly logger;
|
|
149
155
|
private readonly driver;
|
|
@@ -155,25 +161,21 @@ export declare class Configuration<D extends IDatabaseDriver = IDatabaseDriver,
|
|
|
155
161
|
/**
|
|
156
162
|
* Gets specific configuration option. Falls back to specified `defaultValue` if provided.
|
|
157
163
|
*/
|
|
158
|
-
get<T extends keyof
|
|
159
|
-
getAll():
|
|
164
|
+
get<T extends keyof Options<D, EM>, U extends RequiredOptions<D, EM>[T]>(key: T, defaultValue?: U): U;
|
|
165
|
+
getAll(): RequiredOptions<D, EM>;
|
|
160
166
|
/**
|
|
161
167
|
* Overrides specified configuration value.
|
|
162
168
|
*/
|
|
163
|
-
set<T extends keyof
|
|
169
|
+
set<T extends keyof Options<D, EM>, U extends RequiredOptions<D, EM>[T]>(key: T, value: U): void;
|
|
164
170
|
/**
|
|
165
171
|
* Resets the configuration to its default value
|
|
166
172
|
*/
|
|
167
|
-
reset<T extends keyof
|
|
173
|
+
reset<T extends keyof RequiredOptions<D, EM>>(key: T): void;
|
|
168
174
|
/**
|
|
169
175
|
* Gets Logger instance.
|
|
170
176
|
*/
|
|
171
177
|
getLogger(): Logger;
|
|
172
178
|
getDataloaderType(): DataloaderType;
|
|
173
|
-
/**
|
|
174
|
-
* Gets current client URL (connection string).
|
|
175
|
-
*/
|
|
176
|
-
getClientUrl(hidePassword?: boolean): string;
|
|
177
179
|
getSchema(skipDefaultSchema?: boolean): string | undefined;
|
|
178
180
|
/**
|
|
179
181
|
* Gets current database driver instance.
|
|
@@ -208,7 +210,7 @@ export declare class Configuration<D extends IDatabaseDriver = IDatabaseDriver,
|
|
|
208
210
|
/**
|
|
209
211
|
* Gets EntityRepository class to be instantiated.
|
|
210
212
|
*/
|
|
211
|
-
getRepositoryClass(repository: () => EntityClass<EntityRepository<AnyEntity>>):
|
|
213
|
+
getRepositoryClass(repository: () => EntityClass<EntityRepository<AnyEntity>>): Options<D, EM>['entityRepository'];
|
|
212
214
|
/**
|
|
213
215
|
* Creates instance of given service and caches it.
|
|
214
216
|
*/
|
|
@@ -232,7 +234,7 @@ export declare class Configuration<D extends IDatabaseDriver = IDatabaseDriver,
|
|
|
232
234
|
/**
|
|
233
235
|
* Type helper to make it easier to use `mikro-orm.config.js`.
|
|
234
236
|
*/
|
|
235
|
-
export declare function defineConfig<D extends IDatabaseDriver>(options: Options<D>): Options<D,
|
|
237
|
+
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>;
|
|
236
238
|
export interface ConnectionOptions {
|
|
237
239
|
dbName?: string;
|
|
238
240
|
schema?: string;
|
|
@@ -294,93 +296,101 @@ export interface MetadataDiscoveryOptions {
|
|
|
294
296
|
onMetadata?: (meta: EntityMetadata, platform: Platform) => MaybePromise<void>;
|
|
295
297
|
afterDiscovered?: (storage: MetadataStorage, platform: Platform) => MaybePromise<void>;
|
|
296
298
|
tsConfigPath?: string;
|
|
299
|
+
skipSyncDiscovery?: boolean;
|
|
297
300
|
}
|
|
298
|
-
export interface
|
|
299
|
-
entities
|
|
300
|
-
entitiesTs
|
|
301
|
-
extensions
|
|
301
|
+
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 {
|
|
302
|
+
entities?: Entities;
|
|
303
|
+
entitiesTs?: Entities;
|
|
304
|
+
extensions?: {
|
|
302
305
|
register: (orm: MikroORM) => void;
|
|
303
306
|
}[];
|
|
304
|
-
subscribers
|
|
305
|
-
filters
|
|
307
|
+
subscribers?: (EventSubscriber | Constructor<EventSubscriber>)[];
|
|
308
|
+
filters?: Dictionary<{
|
|
306
309
|
name?: string;
|
|
307
310
|
} & Omit<FilterDef, 'name'>>;
|
|
308
|
-
discovery
|
|
311
|
+
discovery?: MetadataDiscoveryOptions;
|
|
309
312
|
driver?: {
|
|
310
|
-
new (config: Configuration):
|
|
313
|
+
new (config: Configuration): Driver;
|
|
311
314
|
};
|
|
312
315
|
namingStrategy?: {
|
|
313
316
|
new (): NamingStrategy;
|
|
314
317
|
};
|
|
315
318
|
implicitTransactions?: boolean;
|
|
316
319
|
disableTransactions?: boolean;
|
|
317
|
-
|
|
318
|
-
verbose: boolean;
|
|
320
|
+
verbose?: boolean;
|
|
319
321
|
ignoreUndefinedInQuery?: boolean;
|
|
320
|
-
onQuery
|
|
321
|
-
autoJoinOneToOneOwner
|
|
322
|
-
autoJoinRefsForFilters
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
322
|
+
onQuery?: (sql: string, params: readonly unknown[]) => string;
|
|
323
|
+
autoJoinOneToOneOwner?: boolean;
|
|
324
|
+
autoJoinRefsForFilters?: boolean;
|
|
325
|
+
filtersOnRelations?: boolean;
|
|
326
|
+
propagationOnPrototype?: boolean;
|
|
327
|
+
populateAfterFlush?: boolean;
|
|
328
|
+
serialization?: {
|
|
326
329
|
includePrimaryKeys?: boolean;
|
|
327
330
|
/** Enforce unpopulated references to be returned as objects, e.g. `{ author: { id: 1 } }` instead of `{ author: 1 }`. */
|
|
328
331
|
forceObject?: boolean;
|
|
329
332
|
};
|
|
330
|
-
assign
|
|
331
|
-
persistOnCreate
|
|
332
|
-
upsertManaged
|
|
333
|
-
forceEntityConstructor
|
|
334
|
-
forceUndefined
|
|
333
|
+
assign?: AssignOptions<boolean>;
|
|
334
|
+
persistOnCreate?: boolean;
|
|
335
|
+
upsertManaged?: boolean;
|
|
336
|
+
forceEntityConstructor?: boolean | (Constructor<AnyEntity> | string)[];
|
|
337
|
+
forceUndefined?: boolean;
|
|
338
|
+
/**
|
|
339
|
+
* Property `onCreate` hooks are normally executed during `flush` operation.
|
|
340
|
+
* With this option, they will be processed early inside `em.create()` method.
|
|
341
|
+
*/
|
|
342
|
+
processOnCreateHooksEarly?: boolean;
|
|
335
343
|
forceUtcTimezone?: boolean;
|
|
336
344
|
timezone?: string;
|
|
337
|
-
ensureDatabase
|
|
338
|
-
ensureIndexes
|
|
345
|
+
ensureDatabase?: boolean | EnsureDatabaseOptions;
|
|
346
|
+
ensureIndexes?: boolean;
|
|
339
347
|
useBatchInserts?: boolean;
|
|
340
348
|
useBatchUpdates?: boolean;
|
|
341
|
-
batchSize
|
|
342
|
-
hydrator
|
|
343
|
-
loadStrategy
|
|
344
|
-
dataloader
|
|
349
|
+
batchSize?: number;
|
|
350
|
+
hydrator?: HydratorConstructor;
|
|
351
|
+
loadStrategy?: LoadStrategy | `${LoadStrategy}`;
|
|
352
|
+
dataloader?: DataloaderType | boolean;
|
|
345
353
|
populateWhere?: PopulateHint | `${PopulateHint}`;
|
|
346
|
-
flushMode
|
|
354
|
+
flushMode?: FlushMode | `${FlushMode}`;
|
|
347
355
|
entityRepository?: EntityClass<EntityRepository<any>>;
|
|
348
356
|
entityManager?: Constructor<EM>;
|
|
349
357
|
replicas?: ConnectionOptions[];
|
|
350
|
-
strict
|
|
351
|
-
validate
|
|
352
|
-
validateRequired
|
|
353
|
-
context
|
|
354
|
-
contextName
|
|
355
|
-
allowGlobalContext
|
|
358
|
+
strict?: boolean;
|
|
359
|
+
validate?: boolean;
|
|
360
|
+
validateRequired?: boolean;
|
|
361
|
+
context?: (name: string) => EntityManager | undefined;
|
|
362
|
+
contextName?: string;
|
|
363
|
+
allowGlobalContext?: boolean;
|
|
356
364
|
disableIdentityMap?: boolean;
|
|
357
|
-
logger
|
|
365
|
+
logger?: (message: string) => void;
|
|
358
366
|
colors?: boolean;
|
|
359
367
|
loggerFactory?: (options: LoggerOptions) => Logger;
|
|
360
|
-
findOneOrFailHandler
|
|
361
|
-
findExactlyOneOrFailHandler
|
|
362
|
-
debug
|
|
363
|
-
ignoreDeprecations
|
|
364
|
-
highlighter
|
|
368
|
+
findOneOrFailHandler?: (entityName: string, where: Dictionary | IPrimaryKey) => Error;
|
|
369
|
+
findExactlyOneOrFailHandler?: (entityName: string, where: Dictionary | IPrimaryKey) => Error;
|
|
370
|
+
debug?: boolean | LoggerNamespace[];
|
|
371
|
+
ignoreDeprecations?: boolean | string[];
|
|
372
|
+
highlighter?: Highlighter;
|
|
365
373
|
/**
|
|
366
374
|
* Using this option, you can force the ORM to use the TS options regardless of whether the TypeScript support
|
|
367
375
|
* is detected or not. This effectively means using `entitiesTs` for discovery and `pathTs` for migrations and
|
|
368
376
|
* seeders. Should be used only for tests and stay disabled for production builds.
|
|
369
377
|
*/
|
|
370
378
|
preferTs?: boolean;
|
|
371
|
-
baseDir
|
|
372
|
-
migrations
|
|
373
|
-
schemaGenerator
|
|
379
|
+
baseDir?: string;
|
|
380
|
+
migrations?: MigrationsOptions;
|
|
381
|
+
schemaGenerator?: {
|
|
374
382
|
disableForeignKeys?: boolean;
|
|
375
383
|
createForeignKeyConstraints?: boolean;
|
|
376
384
|
ignoreSchema?: string[];
|
|
385
|
+
skipTables?: (string | RegExp)[];
|
|
386
|
+
skipColumns?: Dictionary<(string | RegExp)[]>;
|
|
377
387
|
managementDbName?: string;
|
|
378
388
|
};
|
|
379
|
-
embeddables
|
|
389
|
+
embeddables?: {
|
|
380
390
|
prefixMode: EmbeddedPrefixMode;
|
|
381
391
|
};
|
|
382
|
-
entityGenerator
|
|
383
|
-
metadataCache
|
|
392
|
+
entityGenerator?: GenerateOptions;
|
|
393
|
+
metadataCache?: {
|
|
384
394
|
enabled?: boolean;
|
|
385
395
|
combined?: boolean | string;
|
|
386
396
|
pretty?: boolean;
|
|
@@ -389,7 +399,7 @@ export interface MikroORMOptions<D extends IDatabaseDriver = IDatabaseDriver, EM
|
|
|
389
399
|
};
|
|
390
400
|
options?: Dictionary;
|
|
391
401
|
};
|
|
392
|
-
resultCache
|
|
402
|
+
resultCache?: {
|
|
393
403
|
expiration?: number;
|
|
394
404
|
adapter?: {
|
|
395
405
|
new (...params: any[]): CacheAdapter;
|
|
@@ -397,11 +407,18 @@ export interface MikroORMOptions<D extends IDatabaseDriver = IDatabaseDriver, EM
|
|
|
397
407
|
options?: Dictionary;
|
|
398
408
|
global?: boolean | number | [string, number];
|
|
399
409
|
};
|
|
400
|
-
metadataProvider
|
|
410
|
+
metadataProvider?: {
|
|
401
411
|
new (config: Configuration): MetadataProvider;
|
|
402
412
|
};
|
|
403
|
-
seeder
|
|
404
|
-
preferReadReplicas
|
|
405
|
-
dynamicImportProvider
|
|
413
|
+
seeder?: SeederOptions;
|
|
414
|
+
preferReadReplicas?: boolean;
|
|
415
|
+
dynamicImportProvider?: (id: string) => Promise<unknown>;
|
|
416
|
+
hashAlgorithm?: 'md5' | 'sha256';
|
|
406
417
|
}
|
|
407
|
-
|
|
418
|
+
type MarkRequired<T, D> = {
|
|
419
|
+
[K in keyof T as Extract<K, keyof D>]-?: T[K];
|
|
420
|
+
} & {
|
|
421
|
+
[K in keyof T as Exclude<K, keyof D>]?: T[K];
|
|
422
|
+
};
|
|
423
|
+
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>;
|
|
424
|
+
export {};
|