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