@mikro-orm/core 7.0.0-dev.21 → 7.0.0-dev.210
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 +99 -57
- package/EntityManager.js +302 -276
- package/MikroORM.d.ts +44 -35
- package/MikroORM.js +103 -143
- package/README.md +3 -2
- package/cache/FileCacheAdapter.d.ts +1 -1
- package/cache/FileCacheAdapter.js +8 -7
- package/cache/GeneratedCacheAdapter.d.ts +0 -1
- package/cache/GeneratedCacheAdapter.js +0 -2
- package/cache/index.d.ts +0 -1
- package/cache/index.js +0 -1
- package/connections/Connection.d.ts +16 -7
- package/connections/Connection.js +23 -14
- package/drivers/DatabaseDriver.d.ts +25 -16
- package/drivers/DatabaseDriver.js +80 -35
- package/drivers/IDatabaseDriver.d.ts +44 -17
- package/entity/BaseEntity.d.ts +2 -2
- package/entity/BaseEntity.js +0 -3
- package/entity/Collection.d.ts +94 -29
- package/entity/Collection.js +434 -97
- package/entity/EntityAssigner.d.ts +1 -1
- package/entity/EntityAssigner.js +26 -18
- package/entity/EntityFactory.d.ts +13 -1
- package/entity/EntityFactory.js +84 -53
- package/entity/EntityHelper.d.ts +2 -2
- package/entity/EntityHelper.js +35 -15
- package/entity/EntityLoader.d.ts +6 -6
- package/entity/EntityLoader.js +119 -82
- package/entity/EntityRepository.d.ts +24 -4
- package/entity/EntityRepository.js +8 -2
- package/entity/Reference.d.ts +6 -5
- package/entity/Reference.js +34 -9
- package/entity/WrappedEntity.d.ts +2 -7
- package/entity/WrappedEntity.js +3 -8
- package/entity/defineEntity.d.ts +594 -0
- package/entity/defineEntity.js +533 -0
- package/entity/index.d.ts +3 -2
- package/entity/index.js +3 -2
- package/entity/utils.d.ts +7 -0
- package/entity/utils.js +16 -4
- package/entity/validators.d.ts +11 -0
- package/entity/validators.js +65 -0
- package/enums.d.ts +21 -5
- package/enums.js +15 -1
- package/errors.d.ts +23 -9
- package/errors.js +59 -21
- package/events/EventManager.d.ts +2 -1
- package/events/EventManager.js +19 -11
- package/hydration/Hydrator.js +1 -2
- package/hydration/ObjectHydrator.d.ts +4 -4
- package/hydration/ObjectHydrator.js +52 -33
- package/index.d.ts +2 -2
- package/index.js +1 -2
- package/logging/DefaultLogger.d.ts +1 -1
- package/logging/DefaultLogger.js +1 -0
- package/logging/SimpleLogger.d.ts +1 -1
- package/logging/colors.d.ts +1 -1
- package/logging/colors.js +7 -6
- package/logging/index.d.ts +1 -0
- package/logging/index.js +1 -0
- package/logging/inspect.d.ts +2 -0
- package/logging/inspect.js +11 -0
- package/metadata/EntitySchema.d.ts +40 -23
- package/metadata/EntitySchema.js +81 -34
- package/metadata/MetadataDiscovery.d.ts +7 -10
- package/metadata/MetadataDiscovery.js +391 -331
- package/metadata/MetadataProvider.d.ts +11 -2
- package/metadata/MetadataProvider.js +46 -2
- package/metadata/MetadataStorage.d.ts +13 -11
- package/metadata/MetadataStorage.js +70 -37
- package/metadata/MetadataValidator.d.ts +17 -9
- package/metadata/MetadataValidator.js +97 -40
- package/metadata/discover-entities.d.ts +5 -0
- package/metadata/discover-entities.js +40 -0
- package/metadata/index.d.ts +1 -1
- package/metadata/index.js +1 -1
- package/metadata/types.d.ts +502 -0
- package/metadata/types.js +1 -0
- package/naming-strategy/AbstractNamingStrategy.d.ts +12 -4
- package/naming-strategy/AbstractNamingStrategy.js +14 -2
- package/naming-strategy/EntityCaseNamingStrategy.d.ts +3 -3
- package/naming-strategy/EntityCaseNamingStrategy.js +6 -5
- package/naming-strategy/MongoNamingStrategy.d.ts +3 -3
- package/naming-strategy/MongoNamingStrategy.js +6 -6
- package/naming-strategy/NamingStrategy.d.ts +24 -4
- package/naming-strategy/UnderscoreNamingStrategy.d.ts +3 -3
- package/naming-strategy/UnderscoreNamingStrategy.js +6 -6
- package/not-supported.d.ts +2 -0
- package/not-supported.js +4 -0
- package/package.json +18 -11
- package/platforms/ExceptionConverter.js +1 -1
- package/platforms/Platform.d.ts +7 -13
- package/platforms/Platform.js +20 -43
- package/serialization/EntitySerializer.d.ts +5 -0
- package/serialization/EntitySerializer.js +47 -27
- package/serialization/EntityTransformer.js +28 -18
- package/serialization/SerializationContext.d.ts +6 -6
- package/serialization/SerializationContext.js +16 -13
- package/types/ArrayType.d.ts +1 -1
- package/types/ArrayType.js +2 -3
- package/types/BigIntType.d.ts +8 -6
- package/types/BigIntType.js +1 -1
- 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 +3 -3
- package/types/DoubleType.js +2 -2
- package/types/EnumArrayType.js +1 -2
- package/types/JsonType.d.ts +1 -1
- package/types/JsonType.js +7 -2
- package/types/TinyIntType.js +1 -1
- package/types/Type.d.ts +2 -4
- package/types/Type.js +3 -3
- package/types/Uint8ArrayType.d.ts +0 -1
- package/types/Uint8ArrayType.js +1 -4
- package/types/index.d.ts +1 -1
- package/typings.d.ts +290 -137
- package/typings.js +59 -44
- package/unit-of-work/ChangeSet.d.ts +2 -6
- package/unit-of-work/ChangeSet.js +4 -5
- package/unit-of-work/ChangeSetComputer.d.ts +1 -3
- package/unit-of-work/ChangeSetComputer.js +26 -13
- package/unit-of-work/ChangeSetPersister.d.ts +5 -4
- package/unit-of-work/ChangeSetPersister.js +70 -34
- package/unit-of-work/CommitOrderCalculator.d.ts +12 -10
- package/unit-of-work/CommitOrderCalculator.js +13 -13
- package/unit-of-work/IdentityMap.d.ts +12 -0
- package/unit-of-work/IdentityMap.js +39 -1
- package/unit-of-work/UnitOfWork.d.ts +23 -3
- package/unit-of-work/UnitOfWork.js +175 -98
- package/utils/AbstractSchemaGenerator.d.ts +5 -5
- package/utils/AbstractSchemaGenerator.js +18 -16
- package/utils/AsyncContext.d.ts +6 -0
- package/utils/AsyncContext.js +42 -0
- package/utils/Configuration.d.ts +785 -207
- package/utils/Configuration.js +147 -190
- package/utils/ConfigurationLoader.d.ts +1 -54
- package/utils/ConfigurationLoader.js +1 -352
- package/utils/Cursor.d.ts +0 -3
- package/utils/Cursor.js +27 -11
- package/utils/DataloaderUtils.d.ts +15 -5
- package/utils/DataloaderUtils.js +64 -30
- package/utils/EntityComparator.d.ts +13 -9
- package/utils/EntityComparator.js +101 -42
- package/utils/QueryHelper.d.ts +14 -6
- package/utils/QueryHelper.js +87 -25
- package/utils/RawQueryFragment.d.ts +48 -25
- package/utils/RawQueryFragment.js +66 -70
- package/utils/RequestContext.js +2 -2
- package/utils/TransactionContext.js +2 -2
- package/utils/TransactionManager.d.ts +65 -0
- package/utils/TransactionManager.js +223 -0
- package/utils/Utils.d.ts +13 -126
- package/utils/Utils.js +100 -391
- package/utils/clone.js +8 -23
- package/utils/env-vars.d.ts +7 -0
- package/utils/env-vars.js +97 -0
- package/utils/fs-utils.d.ts +32 -0
- package/utils/fs-utils.js +178 -0
- package/utils/index.d.ts +2 -1
- package/utils/index.js +2 -1
- package/utils/upsert-utils.d.ts +9 -4
- package/utils/upsert-utils.js +55 -4
- 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 -12
- 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 -32
- 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 -26
- 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/entity/EntityValidator.d.ts +0 -19
- package/entity/EntityValidator.js +0 -150
- package/exports.d.ts +0 -24
- package/exports.js +0 -23
- 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/metadata/EntitySchema.js
CHANGED
|
@@ -10,7 +10,7 @@ export class EntitySchema {
|
|
|
10
10
|
* so we can use the class in `entities` option just like the EntitySchema instance.
|
|
11
11
|
*/
|
|
12
12
|
static REGISTRY = new Map();
|
|
13
|
-
_meta
|
|
13
|
+
_meta;
|
|
14
14
|
internal = false;
|
|
15
15
|
initialized = false;
|
|
16
16
|
constructor(meta) {
|
|
@@ -18,15 +18,14 @@ export class EntitySchema {
|
|
|
18
18
|
if (meta.name) {
|
|
19
19
|
meta.abstract ??= false;
|
|
20
20
|
}
|
|
21
|
+
this._meta = new EntityMetadata({
|
|
22
|
+
className: meta.name,
|
|
23
|
+
...meta,
|
|
24
|
+
});
|
|
25
|
+
this._meta.root ??= this._meta;
|
|
21
26
|
if (meta.class && !meta.internal) {
|
|
22
27
|
EntitySchema.REGISTRY.set(meta.class, this);
|
|
23
28
|
}
|
|
24
|
-
if (meta.tableName || meta.collection) {
|
|
25
|
-
Utils.renameKey(meta, 'tableName', 'collection');
|
|
26
|
-
meta.tableName = meta.collection;
|
|
27
|
-
}
|
|
28
|
-
Object.assign(this._meta, { className: meta.name }, meta);
|
|
29
|
-
this._meta.root ??= this._meta;
|
|
30
29
|
}
|
|
31
30
|
static fromMetadata(meta) {
|
|
32
31
|
const schema = new EntitySchema({ ...meta, internal: true });
|
|
@@ -35,12 +34,12 @@ export class EntitySchema {
|
|
|
35
34
|
}
|
|
36
35
|
addProperty(name, type, options = {}) {
|
|
37
36
|
this.renameCompositeOptions(name, options);
|
|
38
|
-
const prop = { name, kind: ReferenceKind.SCALAR, ...options,
|
|
37
|
+
const prop = { name, kind: ReferenceKind.SCALAR, ...options, ...this.normalizeType(options, type) };
|
|
39
38
|
if (type && Type.isMappedType(type.prototype)) {
|
|
40
39
|
prop.type = type;
|
|
41
40
|
}
|
|
42
|
-
if (
|
|
43
|
-
const formula = prop.formula;
|
|
41
|
+
if (typeof prop.formula === 'string') {
|
|
42
|
+
const formula = prop.formula;
|
|
44
43
|
prop.formula = () => formula;
|
|
45
44
|
}
|
|
46
45
|
if (prop.formula) {
|
|
@@ -75,7 +74,7 @@ export class EntitySchema {
|
|
|
75
74
|
}
|
|
76
75
|
addSerializedPrimaryKey(name, type, options = {}) {
|
|
77
76
|
this._meta.serializedPrimaryKey = name;
|
|
78
|
-
this.addProperty(name, type, options);
|
|
77
|
+
this.addProperty(name, type, { serializedPrimaryKey: true, ...options });
|
|
79
78
|
}
|
|
80
79
|
addEmbedded(name, options) {
|
|
81
80
|
this.renameCompositeOptions(name, options);
|
|
@@ -85,8 +84,8 @@ export class EntitySchema {
|
|
|
85
84
|
}
|
|
86
85
|
this._meta.properties[name] = {
|
|
87
86
|
name,
|
|
88
|
-
type: this.normalizeType(options),
|
|
89
87
|
kind: ReferenceKind.EMBEDDED,
|
|
88
|
+
...this.normalizeType(options),
|
|
90
89
|
...options,
|
|
91
90
|
};
|
|
92
91
|
}
|
|
@@ -99,6 +98,8 @@ export class EntitySchema {
|
|
|
99
98
|
if (prop.fieldNames && !prop.joinColumns) {
|
|
100
99
|
prop.joinColumns = prop.fieldNames;
|
|
101
100
|
}
|
|
101
|
+
// By default, the foreign key constraint is created on the relation
|
|
102
|
+
Utils.defaultValue(prop, 'createForeignKeyConstraint', true);
|
|
102
103
|
this.addProperty(name, type, prop);
|
|
103
104
|
}
|
|
104
105
|
addManyToMany(name, type, options) {
|
|
@@ -108,6 +109,8 @@ export class EntitySchema {
|
|
|
108
109
|
}
|
|
109
110
|
if (options.owner) {
|
|
110
111
|
Utils.renameKey(options, 'mappedBy', 'inversedBy');
|
|
112
|
+
// By default, the foreign key constraint is created on the relation
|
|
113
|
+
Utils.defaultValue(options, 'createForeignKeyConstraint', true);
|
|
111
114
|
}
|
|
112
115
|
const prop = this.createProperty(ReferenceKind.MANY_TO_MANY, options);
|
|
113
116
|
this.addProperty(name, type, prop);
|
|
@@ -120,8 +123,12 @@ export class EntitySchema {
|
|
|
120
123
|
const prop = this.createProperty(ReferenceKind.ONE_TO_ONE, options);
|
|
121
124
|
Utils.defaultValue(prop, 'owner', !!prop.inversedBy || !prop.mappedBy);
|
|
122
125
|
Utils.defaultValue(prop, 'unique', prop.owner);
|
|
123
|
-
if (prop.owner
|
|
124
|
-
|
|
126
|
+
if (prop.owner) {
|
|
127
|
+
if (options.mappedBy) {
|
|
128
|
+
Utils.renameKey(prop, 'mappedBy', 'inversedBy');
|
|
129
|
+
}
|
|
130
|
+
// By default, the foreign key constraint is created on the relation
|
|
131
|
+
Utils.defaultValue(prop, 'createForeignKeyConstraint', true);
|
|
125
132
|
}
|
|
126
133
|
if (prop.joinColumns && !prop.fieldNames) {
|
|
127
134
|
prop.fieldNames = prop.joinColumns;
|
|
@@ -143,21 +150,29 @@ export class EntitySchema {
|
|
|
143
150
|
setExtends(base) {
|
|
144
151
|
this._meta.extends = base;
|
|
145
152
|
}
|
|
146
|
-
setClass(
|
|
147
|
-
const
|
|
148
|
-
this._meta.class
|
|
149
|
-
this._meta.
|
|
150
|
-
this._meta.
|
|
153
|
+
setClass(cls) {
|
|
154
|
+
const oldClass = this._meta.class;
|
|
155
|
+
const sameClass = this._meta.class === cls;
|
|
156
|
+
this._meta.class = cls;
|
|
157
|
+
this._meta.prototype = cls.prototype;
|
|
158
|
+
this._meta.className = this._meta.name ?? cls.name;
|
|
151
159
|
if (!sameClass || !this._meta.constructorParams) {
|
|
152
|
-
|
|
153
|
-
this._meta.constructorParams = Utils.getParamNames(tokens, 'constructor');
|
|
154
|
-
this._meta.toJsonParams = Utils.getParamNames(tokens, 'toJSON').filter(p => p !== '...args');
|
|
160
|
+
this._meta.constructorParams = Utils.getConstructorParams(cls);
|
|
155
161
|
}
|
|
156
162
|
if (!this.internal) {
|
|
157
|
-
|
|
163
|
+
// Remove old class from registry if it's being replaced with a different class
|
|
164
|
+
if (oldClass && oldClass !== cls && EntitySchema.REGISTRY.get(oldClass) === this) {
|
|
165
|
+
EntitySchema.REGISTRY.delete(oldClass);
|
|
166
|
+
}
|
|
167
|
+
EntitySchema.REGISTRY.set(cls, this);
|
|
158
168
|
}
|
|
159
|
-
|
|
160
|
-
|
|
169
|
+
const base = Object.getPrototypeOf(cls);
|
|
170
|
+
// Only set extends if the parent is NOT the auto-generated class for this same entity.
|
|
171
|
+
// When the user extends the auto-generated class (from defineEntity without a class option)
|
|
172
|
+
// and registers their custom class via setClass, we don't want to discover the
|
|
173
|
+
// auto-generated class as a separate parent entity.
|
|
174
|
+
if (base !== BaseEntity && base.name !== this._meta.className) {
|
|
175
|
+
this._meta.extends ??= base.name ? base : undefined;
|
|
161
176
|
}
|
|
162
177
|
}
|
|
163
178
|
get meta() {
|
|
@@ -166,6 +181,18 @@ export class EntitySchema {
|
|
|
166
181
|
get name() {
|
|
167
182
|
return this._meta.className;
|
|
168
183
|
}
|
|
184
|
+
get tableName() {
|
|
185
|
+
return this._meta.tableName;
|
|
186
|
+
}
|
|
187
|
+
get class() {
|
|
188
|
+
return this._meta.class;
|
|
189
|
+
}
|
|
190
|
+
get properties() {
|
|
191
|
+
return this._meta.properties;
|
|
192
|
+
}
|
|
193
|
+
new(...params) {
|
|
194
|
+
return new this._meta.class(...params);
|
|
195
|
+
}
|
|
169
196
|
/**
|
|
170
197
|
* @internal
|
|
171
198
|
*/
|
|
@@ -173,11 +200,6 @@ export class EntitySchema {
|
|
|
173
200
|
if (this.initialized) {
|
|
174
201
|
return this;
|
|
175
202
|
}
|
|
176
|
-
if (!this._meta.class) {
|
|
177
|
-
const name = this.name;
|
|
178
|
-
this._meta.class = ({ [name]: class {
|
|
179
|
-
} })[name];
|
|
180
|
-
}
|
|
181
203
|
this.setClass(this._meta.class);
|
|
182
204
|
if (this._meta.abstract && !this._meta.discriminatorColumn) {
|
|
183
205
|
delete this._meta.name;
|
|
@@ -185,7 +207,7 @@ export class EntitySchema {
|
|
|
185
207
|
const tableName = this._meta.collection ?? this._meta.tableName;
|
|
186
208
|
if (tableName?.includes('.') && !this._meta.schema) {
|
|
187
209
|
this._meta.schema = tableName.substring(0, tableName.indexOf('.'));
|
|
188
|
-
this._meta.
|
|
210
|
+
this._meta.tableName = tableName.substring(tableName.indexOf('.') + 1);
|
|
189
211
|
}
|
|
190
212
|
this.initProperties();
|
|
191
213
|
this.initPrimaryKeys();
|
|
@@ -251,12 +273,15 @@ export class EntitySchema {
|
|
|
251
273
|
}
|
|
252
274
|
normalizeType(options, type) {
|
|
253
275
|
if ('entity' in options) {
|
|
254
|
-
|
|
255
|
-
|
|
276
|
+
/* v8 ignore next */
|
|
277
|
+
if (typeof options.entity === 'string') {
|
|
278
|
+
throw new Error(`Relation target needs to be an entity class or EntitySchema instance, string '${options.entity}' given instead for ${this._meta.className}.${options.name}.`);
|
|
256
279
|
}
|
|
257
280
|
else if (options.entity) {
|
|
258
281
|
const tmp = options.entity();
|
|
259
282
|
type = options.type = Array.isArray(tmp) ? tmp.map(t => Utils.className(t)).sort().join(' | ') : Utils.className(tmp);
|
|
283
|
+
const target = tmp instanceof EntitySchema ? tmp.meta.class : tmp;
|
|
284
|
+
return { type, target };
|
|
260
285
|
}
|
|
261
286
|
}
|
|
262
287
|
if (type instanceof Function) {
|
|
@@ -265,7 +290,7 @@ export class EntitySchema {
|
|
|
265
290
|
if (['String', 'Number', 'Boolean', 'Array'].includes(type)) {
|
|
266
291
|
type = type.toLowerCase();
|
|
267
292
|
}
|
|
268
|
-
return type;
|
|
293
|
+
return { type };
|
|
269
294
|
}
|
|
270
295
|
createProperty(kind, options) {
|
|
271
296
|
return {
|
|
@@ -295,4 +320,26 @@ export class EntitySchema {
|
|
|
295
320
|
this.rename(options, 'referenceColumnName', 'referencedColumnNames');
|
|
296
321
|
this.rename(options, 'columnType', 'columnTypes');
|
|
297
322
|
}
|
|
323
|
+
/**
|
|
324
|
+
* Adds a lifecycle hook handler to the entity schema.
|
|
325
|
+
* This method allows registering hooks after the entity is defined,
|
|
326
|
+
* which can be useful for avoiding circular type references.
|
|
327
|
+
*
|
|
328
|
+
* @example
|
|
329
|
+
* ```ts
|
|
330
|
+
* export const Article = defineEntity({
|
|
331
|
+
* name: 'Article',
|
|
332
|
+
* properties: { ... },
|
|
333
|
+
* });
|
|
334
|
+
*
|
|
335
|
+
* Article.addHook('beforeCreate', async args => {
|
|
336
|
+
* args.entity.slug = args.entity.title.toLowerCase();
|
|
337
|
+
* });
|
|
338
|
+
* ```
|
|
339
|
+
*/
|
|
340
|
+
addHook(event, handler) {
|
|
341
|
+
this._meta.hooks[event] ??= [];
|
|
342
|
+
this._meta.hooks[event].push(handler);
|
|
343
|
+
return this;
|
|
344
|
+
}
|
|
298
345
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type EntityClass, EntityMetadata, type EntityName } from '../typings.js';
|
|
2
2
|
import type { Configuration } from '../utils/Configuration.js';
|
|
3
3
|
import { MetadataStorage } from './MetadataStorage.js';
|
|
4
4
|
import { EntitySchema } from './EntitySchema.js';
|
|
@@ -9,26 +9,24 @@ export declare class MetadataDiscovery {
|
|
|
9
9
|
private readonly config;
|
|
10
10
|
private readonly namingStrategy;
|
|
11
11
|
private readonly metadataProvider;
|
|
12
|
-
private readonly cache;
|
|
13
12
|
private readonly logger;
|
|
14
13
|
private readonly schemaHelper;
|
|
15
14
|
private readonly validator;
|
|
16
15
|
private readonly discovered;
|
|
17
16
|
constructor(metadata: MetadataStorage, platform: Platform, config: Configuration);
|
|
18
17
|
discover(preferTs?: boolean): Promise<MetadataStorage>;
|
|
19
|
-
discoverSync(
|
|
18
|
+
discoverSync(): MetadataStorage;
|
|
20
19
|
private mapDiscoveredEntities;
|
|
20
|
+
private initAccessors;
|
|
21
21
|
processDiscoveredEntities(discovered: EntityMetadata[]): EntityMetadata[];
|
|
22
22
|
private findEntities;
|
|
23
23
|
private discoverMissingTargets;
|
|
24
24
|
private tryDiscoverTargets;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
reset(className: string): void;
|
|
28
|
-
private prepare;
|
|
25
|
+
discoverReferences<T>(refs: Iterable<EntityClass<T> | EntitySchema<T>>, validate?: boolean): EntityMetadata<T>[];
|
|
26
|
+
reset<T>(entityName: EntityName<T>): void;
|
|
29
27
|
private getSchema;
|
|
28
|
+
private getRootEntity;
|
|
30
29
|
private discoverEntity;
|
|
31
|
-
private saveToCache;
|
|
32
30
|
private initNullability;
|
|
33
31
|
private applyNamingStrategy;
|
|
34
32
|
private initOwnColumns;
|
|
@@ -36,6 +34,7 @@ export declare class MetadataDiscovery {
|
|
|
36
34
|
private initManyToOneFieldName;
|
|
37
35
|
private initManyToManyFieldName;
|
|
38
36
|
private initManyToManyFields;
|
|
37
|
+
private isExplicitTableName;
|
|
39
38
|
private initManyToOneFields;
|
|
40
39
|
private initOneToManyFields;
|
|
41
40
|
private processEntity;
|
|
@@ -54,7 +53,6 @@ export declare class MetadataDiscovery {
|
|
|
54
53
|
private initAutoincrement;
|
|
55
54
|
private initCheckConstraints;
|
|
56
55
|
private initGeneratedColumn;
|
|
57
|
-
private createColumnMappingObject;
|
|
58
56
|
private getDefaultVersionValue;
|
|
59
57
|
private inferDefaultValue;
|
|
60
58
|
private initDefaultValue;
|
|
@@ -67,6 +65,5 @@ export declare class MetadataDiscovery {
|
|
|
67
65
|
private getPrefix;
|
|
68
66
|
private initUnsigned;
|
|
69
67
|
private initIndexes;
|
|
70
|
-
private getEntityClassOrSchema;
|
|
71
68
|
private shouldForceConstructorUsage;
|
|
72
69
|
}
|