@mikro-orm/core 7.0.0-dev.0 → 7.0.0-dev.2
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 +18 -13
- package/EntityManager.js +202 -202
- package/MikroORM.d.ts +7 -6
- package/MikroORM.js +33 -45
- package/cache/CacheAdapter.js +1 -2
- package/cache/FileCacheAdapter.d.ts +1 -1
- package/cache/FileCacheAdapter.js +18 -26
- package/cache/GeneratedCacheAdapter.d.ts +2 -2
- package/cache/GeneratedCacheAdapter.js +1 -5
- package/cache/MemoryCacheAdapter.d.ts +1 -1
- package/cache/MemoryCacheAdapter.js +1 -5
- package/cache/NullCacheAdapter.d.ts +1 -1
- package/cache/NullCacheAdapter.js +1 -5
- package/cache/index.d.ts +5 -5
- package/cache/index.js +5 -21
- package/connections/Connection.d.ts +7 -7
- package/connections/Connection.js +8 -12
- package/connections/index.d.ts +1 -1
- package/connections/index.js +1 -17
- package/decorators/Check.d.ts +1 -1
- package/decorators/Check.js +5 -8
- package/decorators/CreateRequestContext.d.ts +1 -1
- package/decorators/CreateRequestContext.js +9 -13
- package/decorators/Embeddable.d.ts +1 -1
- package/decorators/Embeddable.js +3 -6
- package/decorators/Embedded.d.ts +1 -1
- package/decorators/Embedded.js +10 -12
- package/decorators/Entity.d.ts +2 -2
- package/decorators/Entity.js +5 -8
- package/decorators/Enum.d.ts +2 -2
- package/decorators/Enum.js +7 -10
- package/decorators/Filter.d.ts +1 -1
- package/decorators/Filter.js +3 -6
- package/decorators/Formula.d.ts +2 -2
- package/decorators/Formula.js +7 -10
- package/decorators/Indexed.d.ts +2 -2
- package/decorators/Indexed.js +6 -10
- package/decorators/ManyToMany.d.ts +3 -3
- package/decorators/ManyToMany.js +10 -12
- package/decorators/ManyToOne.d.ts +3 -3
- package/decorators/ManyToOne.js +10 -12
- package/decorators/OneToMany.d.ts +3 -3
- package/decorators/OneToMany.js +11 -14
- package/decorators/OneToOne.d.ts +4 -4
- package/decorators/OneToOne.js +4 -7
- package/decorators/PrimaryKey.d.ts +2 -2
- package/decorators/PrimaryKey.js +10 -13
- package/decorators/Property.d.ts +5 -5
- package/decorators/Property.js +10 -12
- package/decorators/Transactional.d.ts +2 -2
- package/decorators/Transactional.js +7 -10
- package/decorators/hooks.js +23 -35
- package/decorators/index.d.ts +17 -17
- package/decorators/index.js +17 -36
- package/drivers/DatabaseDriver.d.ts +13 -12
- package/drivers/DatabaseDriver.js +60 -64
- package/drivers/IDatabaseDriver.d.ts +12 -12
- package/drivers/IDatabaseDriver.js +1 -4
- package/drivers/index.d.ts +2 -2
- package/drivers/index.js +2 -18
- package/entity/ArrayCollection.d.ts +2 -2
- package/entity/ArrayCollection.js +29 -33
- package/entity/BaseEntity.d.ts +6 -6
- package/entity/BaseEntity.js +17 -21
- package/entity/Collection.d.ts +6 -6
- package/entity/Collection.js +40 -44
- package/entity/EntityAssigner.d.ts +2 -2
- package/entity/EntityAssigner.js +58 -63
- package/entity/EntityFactory.d.ts +3 -3
- package/entity/EntityFactory.js +58 -62
- package/entity/EntityHelper.d.ts +2 -2
- package/entity/EntityHelper.js +41 -45
- package/entity/EntityIdentifier.d.ts +1 -1
- package/entity/EntityIdentifier.js +1 -5
- package/entity/EntityLoader.d.ts +5 -5
- package/entity/EntityLoader.js +92 -96
- package/entity/EntityRepository.d.ts +7 -7
- package/entity/EntityRepository.js +7 -11
- package/entity/EntityValidator.d.ts +1 -1
- package/entity/EntityValidator.js +25 -29
- package/entity/Reference.d.ts +2 -2
- package/entity/Reference.js +35 -42
- package/entity/WrappedEntity.d.ts +12 -12
- package/entity/WrappedEntity.js +23 -27
- package/entity/index.d.ts +13 -13
- package/entity/index.js +13 -29
- package/entity/utils.d.ts +1 -1
- package/entity/utils.js +9 -12
- package/entity/wrap.d.ts +1 -1
- package/entity/wrap.js +2 -6
- package/enums.d.ts +3 -3
- package/enums.js +37 -41
- package/errors.d.ts +1 -1
- package/errors.js +15 -24
- package/events/EventManager.d.ts +3 -3
- package/events/EventManager.js +8 -12
- package/events/EventSubscriber.d.ts +5 -4
- package/events/EventSubscriber.js +1 -2
- package/events/TransactionEventBroadcaster.d.ts +3 -3
- package/events/TransactionEventBroadcaster.js +1 -5
- package/events/index.d.ts +3 -3
- package/events/index.js +3 -19
- package/exceptions.js +18 -39
- package/hydration/Hydrator.d.ts +5 -5
- package/hydration/Hydrator.js +3 -6
- package/hydration/ObjectHydrator.d.ts +3 -3
- package/hydration/ObjectHydrator.js +25 -28
- package/hydration/index.d.ts +2 -2
- package/hydration/index.js +2 -18
- package/index.d.ts +21 -21
- package/index.js +21 -46
- package/logging/DefaultLogger.d.ts +1 -1
- package/logging/DefaultLogger.js +9 -13
- package/logging/Logger.d.ts +1 -1
- package/logging/Logger.js +1 -2
- package/logging/SimpleLogger.d.ts +2 -2
- package/logging/SimpleLogger.js +2 -6
- package/logging/colors.js +1 -5
- package/logging/index.d.ts +4 -4
- package/logging/index.js +4 -20
- package/metadata/EntitySchema.d.ts +12 -4
- package/metadata/EntitySchema.js +41 -45
- package/metadata/MetadataDiscovery.d.ts +7 -7
- package/metadata/MetadataDiscovery.js +174 -177
- package/metadata/MetadataProvider.d.ts +2 -2
- package/metadata/MetadataProvider.js +4 -7
- package/metadata/MetadataStorage.d.ts +2 -2
- package/metadata/MetadataStorage.js +15 -19
- package/metadata/MetadataValidator.d.ts +4 -4
- package/metadata/MetadataValidator.js +49 -53
- package/metadata/ReflectMetadataProvider.d.ts +2 -2
- package/metadata/ReflectMetadataProvider.js +8 -12
- package/metadata/index.d.ts +6 -6
- package/metadata/index.js +6 -22
- package/naming-strategy/AbstractNamingStrategy.d.ts +2 -2
- package/naming-strategy/AbstractNamingStrategy.js +4 -8
- package/naming-strategy/EntityCaseNamingStrategy.d.ts +1 -1
- package/naming-strategy/EntityCaseNamingStrategy.js +2 -6
- package/naming-strategy/MongoNamingStrategy.d.ts +1 -1
- package/naming-strategy/MongoNamingStrategy.js +2 -6
- package/naming-strategy/NamingStrategy.d.ts +1 -1
- package/naming-strategy/NamingStrategy.js +1 -2
- package/naming-strategy/UnderscoreNamingStrategy.d.ts +1 -1
- package/naming-strategy/UnderscoreNamingStrategy.js +2 -6
- package/naming-strategy/index.d.ts +5 -5
- package/naming-strategy/index.js +5 -21
- package/package.json +5 -14
- package/platforms/ExceptionConverter.d.ts +2 -2
- package/platforms/ExceptionConverter.js +4 -8
- package/platforms/Platform.d.ts +10 -10
- package/platforms/Platform.js +57 -61
- package/platforms/index.d.ts +2 -2
- package/platforms/index.js +2 -18
- package/serialization/EntitySerializer.d.ts +2 -2
- package/serialization/EntitySerializer.js +36 -41
- package/serialization/EntityTransformer.d.ts +1 -1
- package/serialization/EntityTransformer.js +27 -31
- package/serialization/SerializationContext.d.ts +2 -2
- package/serialization/SerializationContext.js +10 -14
- package/serialization/index.d.ts +3 -3
- package/serialization/index.js +3 -19
- package/types/ArrayType.d.ts +3 -3
- package/types/ArrayType.js +7 -11
- package/types/BigIntType.d.ts +3 -3
- package/types/BigIntType.js +3 -6
- package/types/BlobType.d.ts +3 -3
- package/types/BlobType.js +2 -8
- package/types/BooleanType.d.ts +3 -3
- package/types/BooleanType.js +2 -6
- package/types/CharacterType.d.ts +3 -3
- package/types/CharacterType.js +2 -6
- package/types/DateTimeType.d.ts +3 -3
- package/types/DateTimeType.js +2 -6
- package/types/DateType.d.ts +3 -3
- package/types/DateType.js +2 -6
- package/types/DecimalType.d.ts +3 -3
- package/types/DecimalType.js +4 -7
- package/types/DoubleType.d.ts +3 -3
- package/types/DoubleType.js +3 -6
- package/types/EnumArrayType.d.ts +4 -4
- package/types/EnumArrayType.js +5 -10
- package/types/EnumType.d.ts +3 -3
- package/types/EnumType.js +2 -6
- package/types/FloatType.d.ts +3 -3
- package/types/FloatType.js +2 -6
- package/types/IntegerType.d.ts +3 -3
- package/types/IntegerType.js +2 -6
- package/types/IntervalType.d.ts +3 -3
- package/types/IntervalType.js +2 -6
- package/types/JsonType.d.ts +3 -3
- package/types/JsonType.js +2 -6
- package/types/MediumIntType.d.ts +3 -3
- package/types/MediumIntType.js +2 -6
- package/types/SmallIntType.d.ts +3 -3
- package/types/SmallIntType.js +2 -6
- package/types/StringType.d.ts +3 -3
- package/types/StringType.js +2 -6
- package/types/TextType.d.ts +3 -3
- package/types/TextType.js +2 -6
- package/types/TimeType.d.ts +3 -3
- package/types/TimeType.js +4 -8
- package/types/TinyIntType.d.ts +3 -3
- package/types/TinyIntType.js +3 -6
- package/types/Type.d.ts +2 -2
- package/types/Type.js +5 -9
- package/types/Uint8ArrayType.d.ts +3 -3
- package/types/Uint8ArrayType.js +3 -9
- package/types/UnknownType.d.ts +3 -3
- package/types/UnknownType.js +2 -6
- package/types/UuidType.d.ts +3 -3
- package/types/UuidType.js +2 -6
- package/types/index.d.ts +25 -25
- package/types/index.js +52 -79
- package/typings.d.ts +22 -20
- package/typings.js +34 -38
- package/unit-of-work/ChangeSet.d.ts +1 -1
- package/unit-of-work/ChangeSet.js +13 -17
- package/unit-of-work/ChangeSetComputer.d.ts +8 -7
- package/unit-of-work/ChangeSetComputer.js +26 -30
- package/unit-of-work/ChangeSetPersister.d.ts +7 -6
- package/unit-of-work/ChangeSetPersister.js +44 -47
- package/unit-of-work/CommitOrderCalculator.d.ts +1 -1
- package/unit-of-work/CommitOrderCalculator.js +6 -10
- package/unit-of-work/IdentityMap.d.ts +1 -1
- package/unit-of-work/IdentityMap.js +1 -5
- package/unit-of-work/UnitOfWork.d.ts +8 -7
- package/unit-of-work/UnitOfWork.js +171 -172
- package/unit-of-work/index.d.ts +6 -6
- package/unit-of-work/index.js +6 -22
- package/utils/AbstractSchemaGenerator.d.ts +6 -6
- package/utils/AbstractSchemaGenerator.js +7 -11
- package/utils/Configuration.d.ts +26 -27
- package/utils/Configuration.js +50 -55
- package/utils/ConfigurationLoader.d.ts +9 -8
- package/utils/ConfigurationLoader.js +71 -86
- package/utils/Cursor.d.ts +3 -3
- package/utils/Cursor.js +22 -25
- package/utils/DataloaderUtils.d.ts +4 -4
- package/utils/DataloaderUtils.js +12 -16
- package/utils/EntityComparator.d.ts +2 -2
- package/utils/EntityComparator.js +48 -52
- package/utils/NullHighlighter.d.ts +1 -1
- package/utils/NullHighlighter.js +1 -5
- package/utils/QueryHelper.d.ts +3 -3
- package/utils/QueryHelper.js +47 -51
- package/utils/RawQueryFragment.d.ts +1 -1
- package/utils/RawQueryFragment.js +16 -24
- package/utils/RequestContext.d.ts +2 -2
- package/utils/RequestContext.js +3 -7
- package/utils/TransactionContext.d.ts +1 -1
- package/utils/TransactionContext.js +4 -8
- package/utils/Utils.d.ts +16 -12
- package/utils/Utils.js +89 -93
- package/utils/clone.js +8 -11
- package/utils/index.d.ts +13 -13
- package/utils/index.js +13 -29
- package/utils/resolveContextProvider.d.ts +3 -3
- package/utils/resolveContextProvider.js +9 -12
- package/utils/upsert-utils.d.ts +3 -3
- package/utils/upsert-utils.js +5 -9
- package/index.mjs +0 -199
package/entity/BaseEntity.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type Ref } from './Reference';
|
|
2
|
-
import type { AutoPath, EntityData, EntityDTO, Loaded, LoadedReference, AddEager, EntityKey, FromEntityType, IsSubset, MergeSelected } from '../typings';
|
|
3
|
-
import { type AssignOptions } from './EntityAssigner';
|
|
4
|
-
import type { EntityLoaderOptions } from './EntityLoader';
|
|
5
|
-
import { type SerializeOptions } from '../serialization/EntitySerializer';
|
|
6
|
-
import type { FindOneOptions } from '../drivers/IDatabaseDriver';
|
|
1
|
+
import { type Ref } from './Reference.js';
|
|
2
|
+
import type { AutoPath, EntityData, EntityDTO, Loaded, LoadedReference, AddEager, EntityKey, FromEntityType, IsSubset, MergeSelected } from '../typings.js';
|
|
3
|
+
import { type AssignOptions } from './EntityAssigner.js';
|
|
4
|
+
import type { EntityLoaderOptions } from './EntityLoader.js';
|
|
5
|
+
import { type SerializeOptions } from '../serialization/EntitySerializer.js';
|
|
6
|
+
import type { FindOneOptions } from '../drivers/IDatabaseDriver.js';
|
|
7
7
|
export declare abstract class BaseEntity {
|
|
8
8
|
isInitialized(): boolean;
|
|
9
9
|
isTouched(): boolean;
|
package/entity/BaseEntity.js
CHANGED
|
@@ -1,47 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const EntitySerializer_1 = require("../serialization/EntitySerializer");
|
|
7
|
-
const wrap_1 = require("./wrap");
|
|
8
|
-
class BaseEntity {
|
|
1
|
+
import { Reference } from './Reference.js';
|
|
2
|
+
import { EntityAssigner } from './EntityAssigner.js';
|
|
3
|
+
import { EntitySerializer } from '../serialization/EntitySerializer.js';
|
|
4
|
+
import { helper } from './wrap.js';
|
|
5
|
+
export class BaseEntity {
|
|
9
6
|
isInitialized() {
|
|
10
|
-
return
|
|
7
|
+
return helper(this).__initialized;
|
|
11
8
|
}
|
|
12
9
|
isTouched() {
|
|
13
|
-
return
|
|
10
|
+
return helper(this).__touched;
|
|
14
11
|
}
|
|
15
12
|
populated(populated = true) {
|
|
16
|
-
|
|
13
|
+
helper(this).populated(populated);
|
|
17
14
|
}
|
|
18
15
|
async populate(populate, options = {}) {
|
|
19
|
-
return
|
|
16
|
+
return helper(this).populate(populate, options);
|
|
20
17
|
}
|
|
21
18
|
toReference() {
|
|
22
|
-
return
|
|
19
|
+
return Reference.create(this);
|
|
23
20
|
}
|
|
24
21
|
toObject(ignoreFields) {
|
|
25
|
-
return
|
|
22
|
+
return helper(this).toObject(ignoreFields);
|
|
26
23
|
}
|
|
27
24
|
toPOJO() {
|
|
28
|
-
return
|
|
25
|
+
return helper(this).toPOJO();
|
|
29
26
|
}
|
|
30
27
|
serialize(options) {
|
|
31
|
-
return
|
|
28
|
+
return EntitySerializer.serialize(this, options);
|
|
32
29
|
}
|
|
33
30
|
assign(data, options = {}) {
|
|
34
|
-
return
|
|
31
|
+
return EntityAssigner.assign(this, data, options);
|
|
35
32
|
}
|
|
36
33
|
init(options) {
|
|
37
|
-
return
|
|
34
|
+
return helper(this).init(options);
|
|
38
35
|
}
|
|
39
36
|
getSchema() {
|
|
40
|
-
return
|
|
37
|
+
return helper(this).getSchema();
|
|
41
38
|
}
|
|
42
39
|
setSchema(schema) {
|
|
43
|
-
|
|
40
|
+
helper(this).setSchema(schema);
|
|
44
41
|
}
|
|
45
42
|
}
|
|
46
|
-
exports.BaseEntity = BaseEntity;
|
|
47
43
|
Object.defineProperty(BaseEntity.prototype, '__baseEntity', { value: true, writable: false, enumerable: false });
|
package/entity/Collection.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { EntityDTO, EntityKey, FilterQuery, Loaded, LoadedCollection, Populate } from '../typings';
|
|
2
|
-
import { ArrayCollection } from './ArrayCollection';
|
|
3
|
-
import { Reference } from './Reference';
|
|
4
|
-
import type { Transaction } from '../connections/Connection';
|
|
5
|
-
import type { FindOptions, CountOptions } from '../drivers/IDatabaseDriver';
|
|
6
|
-
import type { EntityLoaderOptions } from './EntityLoader';
|
|
1
|
+
import type { EntityDTO, EntityKey, FilterQuery, Loaded, LoadedCollection, Populate } from '../typings.js';
|
|
2
|
+
import { ArrayCollection } from './ArrayCollection.js';
|
|
3
|
+
import { Reference } from './Reference.js';
|
|
4
|
+
import type { Transaction } from '../connections/Connection.js';
|
|
5
|
+
import type { FindOptions, CountOptions } from '../drivers/IDatabaseDriver.js';
|
|
6
|
+
import type { EntityLoaderOptions } from './EntityLoader.js';
|
|
7
7
|
export interface MatchingOptions<T extends object, P extends string = never> extends FindOptions<T, P> {
|
|
8
8
|
where?: FilterQuery<T>;
|
|
9
9
|
store?: boolean;
|
package/entity/Collection.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const Reference_1 = require("./Reference");
|
|
9
|
-
const wrap_1 = require("./wrap");
|
|
10
|
-
class Collection extends ArrayCollection_1.ArrayCollection {
|
|
1
|
+
import { ArrayCollection } from './ArrayCollection.js';
|
|
2
|
+
import { Utils } from '../utils/Utils.js';
|
|
3
|
+
import { ValidationError } from '../errors.js';
|
|
4
|
+
import { ReferenceKind, DataloaderType } from '../enums.js';
|
|
5
|
+
import { Reference } from './Reference.js';
|
|
6
|
+
import { helper } from './wrap.js';
|
|
7
|
+
export class Collection extends ArrayCollection {
|
|
11
8
|
readonly;
|
|
12
9
|
_populated;
|
|
13
10
|
_em;
|
|
@@ -22,7 +19,7 @@ class Collection extends ArrayCollection_1.ArrayCollection {
|
|
|
22
19
|
*/
|
|
23
20
|
static create(owner, prop, items, initialized) {
|
|
24
21
|
const coll = new Collection(owner, undefined, initialized);
|
|
25
|
-
coll.property =
|
|
22
|
+
coll.property = helper(owner).__meta.properties[prop];
|
|
26
23
|
owner[prop] = coll;
|
|
27
24
|
if (items) {
|
|
28
25
|
coll.set(items);
|
|
@@ -45,7 +42,7 @@ class Collection extends ArrayCollection_1.ArrayCollection {
|
|
|
45
42
|
return this;
|
|
46
43
|
}
|
|
47
44
|
setSerializationContext(options) {
|
|
48
|
-
|
|
45
|
+
helper(this.owner).setSerializationContext({
|
|
49
46
|
populate: Array.isArray(options.populate)
|
|
50
47
|
? options.populate.map(hint => `${this.property.name}.${hint}`)
|
|
51
48
|
: options.populate ?? [this.property.name],
|
|
@@ -65,11 +62,11 @@ class Collection extends ArrayCollection_1.ArrayCollection {
|
|
|
65
62
|
async loadCount(options = {}) {
|
|
66
63
|
options = typeof options === 'boolean' ? { refresh: options } : options;
|
|
67
64
|
const { refresh, where, ...countOptions } = options;
|
|
68
|
-
if (!refresh && !where &&
|
|
65
|
+
if (!refresh && !where && Utils.isDefined(this._count)) {
|
|
69
66
|
return this._count;
|
|
70
67
|
}
|
|
71
68
|
const em = this.getEntityManager();
|
|
72
|
-
if (!em.getPlatform().usesPivotTable() && this.property.kind ===
|
|
69
|
+
if (!em.getPlatform().usesPivotTable() && this.property.kind === ReferenceKind.MANY_TO_MANY && this.property.owner) {
|
|
73
70
|
return this._count = this.length;
|
|
74
71
|
}
|
|
75
72
|
const cond = this.createLoadCountCondition(where ?? {});
|
|
@@ -84,10 +81,10 @@ class Collection extends ArrayCollection_1.ArrayCollection {
|
|
|
84
81
|
const { where, ctx, ...opts } = options;
|
|
85
82
|
opts.orderBy = this.createOrderBy(opts.orderBy);
|
|
86
83
|
let items;
|
|
87
|
-
if (this.property.kind ===
|
|
84
|
+
if (this.property.kind === ReferenceKind.MANY_TO_MANY && em.getPlatform().usesPivotTable()) {
|
|
88
85
|
const cond = await em.applyFilters(this.property.type, where, options.filters ?? {}, 'read');
|
|
89
|
-
const map = await em.getDriver().loadFromPivotTable(this.property, [
|
|
90
|
-
items = map[
|
|
86
|
+
const map = await em.getDriver().loadFromPivotTable(this.property, [helper(this.owner).__primaryKeys], cond, opts.orderBy, ctx, options);
|
|
87
|
+
items = map[helper(this.owner).getSerializedPrimaryKey()].map((item) => em.merge(this.property.type, item, { convertCustomTypes: true }));
|
|
91
88
|
}
|
|
92
89
|
else {
|
|
93
90
|
items = await em.find(this.property.type, this.createCondition(where), opts);
|
|
@@ -116,8 +113,8 @@ class Collection extends ArrayCollection_1.ArrayCollection {
|
|
|
116
113
|
return super.toJSON();
|
|
117
114
|
}
|
|
118
115
|
add(entity, ...entities) {
|
|
119
|
-
entities =
|
|
120
|
-
const unwrapped = entities.map(i =>
|
|
116
|
+
entities = Utils.asArray(entity).concat(entities);
|
|
117
|
+
const unwrapped = entities.map(i => Reference.unwrapReference(i));
|
|
121
118
|
unwrapped.forEach(entity => this.validateItemType(entity));
|
|
122
119
|
this.modify('add', unwrapped);
|
|
123
120
|
this.cancelOrphanRemoval(unwrapped);
|
|
@@ -134,8 +131,8 @@ class Collection extends ArrayCollection_1.ArrayCollection {
|
|
|
134
131
|
}
|
|
135
132
|
return;
|
|
136
133
|
}
|
|
137
|
-
entities =
|
|
138
|
-
const unwrapped = entities.map(i =>
|
|
134
|
+
entities = Utils.asArray(entity).concat(entities);
|
|
135
|
+
const unwrapped = entities.map(i => Reference.unwrapReference(i));
|
|
139
136
|
this.modify('remove', unwrapped);
|
|
140
137
|
const em = this.getEntityManager(unwrapped, false);
|
|
141
138
|
if (this.property.orphanRemoval && em) {
|
|
@@ -221,7 +218,7 @@ class Collection extends ArrayCollection_1.ArrayCollection {
|
|
|
221
218
|
return this;
|
|
222
219
|
}
|
|
223
220
|
const em = this.getEntityManager();
|
|
224
|
-
if (options.dataloader ?? [
|
|
221
|
+
if (options.dataloader ?? [DataloaderType.ALL, DataloaderType.COLLECTION].includes(em.config.getDataloaderType())) {
|
|
225
222
|
const order = [...this.items]; // copy order of references
|
|
226
223
|
const customOrder = !!options.orderBy;
|
|
227
224
|
// eslint-disable-next-line dot-notation
|
|
@@ -243,7 +240,7 @@ class Collection extends ArrayCollection_1.ArrayCollection {
|
|
|
243
240
|
? options.populate.map(f => f === '*' ? f : `${this.property.name}.${f}`)
|
|
244
241
|
: [`${this.property.name}${options.ref ? ':ref' : ''}`];
|
|
245
242
|
const schema = this.property.targetMeta.schema === '*'
|
|
246
|
-
?
|
|
243
|
+
? helper(this.owner).__schema
|
|
247
244
|
: undefined;
|
|
248
245
|
await em.populate(this.owner, populate, {
|
|
249
246
|
refresh: true,
|
|
@@ -256,12 +253,12 @@ class Collection extends ArrayCollection_1.ArrayCollection {
|
|
|
256
253
|
return this;
|
|
257
254
|
}
|
|
258
255
|
getEntityManager(items = [], required = true) {
|
|
259
|
-
const wrapped =
|
|
256
|
+
const wrapped = helper(this.owner);
|
|
260
257
|
let em = (this._em ?? wrapped.__em);
|
|
261
258
|
if (!em) {
|
|
262
259
|
for (const i of items) {
|
|
263
|
-
if (i &&
|
|
264
|
-
em =
|
|
260
|
+
if (i && helper(i).__em) {
|
|
261
|
+
em = helper(i).__em;
|
|
265
262
|
break;
|
|
266
263
|
}
|
|
267
264
|
}
|
|
@@ -270,13 +267,13 @@ class Collection extends ArrayCollection_1.ArrayCollection {
|
|
|
270
267
|
Object.defineProperty(this, '_em', { value: em });
|
|
271
268
|
}
|
|
272
269
|
if (!em && required) {
|
|
273
|
-
throw
|
|
270
|
+
throw ValidationError.entityNotManaged(this.owner);
|
|
274
271
|
}
|
|
275
272
|
return em;
|
|
276
273
|
}
|
|
277
274
|
createCondition(cond = {}) {
|
|
278
|
-
if (this.property.kind ===
|
|
279
|
-
cond[this.property.mappedBy] =
|
|
275
|
+
if (this.property.kind === ReferenceKind.ONE_TO_MANY) {
|
|
276
|
+
cond[this.property.mappedBy] = helper(this.owner).getPrimaryKey();
|
|
280
277
|
}
|
|
281
278
|
else { // MANY_TO_MANY
|
|
282
279
|
this.createManyToManyCondition(cond);
|
|
@@ -284,10 +281,10 @@ class Collection extends ArrayCollection_1.ArrayCollection {
|
|
|
284
281
|
return cond;
|
|
285
282
|
}
|
|
286
283
|
createOrderBy(orderBy = []) {
|
|
287
|
-
if (
|
|
284
|
+
if (Utils.isEmpty(orderBy) && this.property.orderBy) {
|
|
288
285
|
orderBy = this.property.orderBy;
|
|
289
286
|
}
|
|
290
|
-
return
|
|
287
|
+
return Utils.asArray(orderBy);
|
|
291
288
|
}
|
|
292
289
|
createManyToManyCondition(cond) {
|
|
293
290
|
const dict = cond;
|
|
@@ -295,17 +292,17 @@ class Collection extends ArrayCollection_1.ArrayCollection {
|
|
|
295
292
|
// we know there is at least one item as it was checked in load method
|
|
296
293
|
const pk = this.property.targetMeta.primaryKeys[0];
|
|
297
294
|
dict[pk] = { $in: [] };
|
|
298
|
-
this.items.forEach(item => dict[pk].$in.push(
|
|
295
|
+
this.items.forEach(item => dict[pk].$in.push(helper(item).getPrimaryKey()));
|
|
299
296
|
}
|
|
300
297
|
else {
|
|
301
|
-
dict[this.property.mappedBy] =
|
|
298
|
+
dict[this.property.mappedBy] = helper(this.owner).getPrimaryKey();
|
|
302
299
|
}
|
|
303
300
|
}
|
|
304
301
|
createLoadCountCondition(cond) {
|
|
305
|
-
const wrapped =
|
|
302
|
+
const wrapped = helper(this.owner);
|
|
306
303
|
const val = wrapped.__meta.compositePK ? { $in: wrapped.__primaryKeys } : wrapped.getPrimaryKey();
|
|
307
304
|
const dict = cond;
|
|
308
|
-
if (this.property.kind ===
|
|
305
|
+
if (this.property.kind === ReferenceKind.ONE_TO_MANY) {
|
|
309
306
|
dict[this.property.mappedBy] = val;
|
|
310
307
|
}
|
|
311
308
|
else {
|
|
@@ -324,14 +321,14 @@ class Collection extends ArrayCollection_1.ArrayCollection {
|
|
|
324
321
|
}
|
|
325
322
|
checkInitialized() {
|
|
326
323
|
if (!this.isInitialized()) {
|
|
327
|
-
throw new Error(`Collection<${this.property.type}> of entity ${this.owner.constructor.name}[${
|
|
324
|
+
throw new Error(`Collection<${this.property.type}> of entity ${this.owner.constructor.name}[${helper(this.owner).getSerializedPrimaryKey()}] not initialized`);
|
|
328
325
|
}
|
|
329
326
|
}
|
|
330
327
|
/**
|
|
331
328
|
* re-orders items after searching with `$in` operator
|
|
332
329
|
*/
|
|
333
330
|
reorderItems(items, order) {
|
|
334
|
-
if (this.property.kind ===
|
|
331
|
+
if (this.property.kind === ReferenceKind.MANY_TO_MANY && this.property.owner) {
|
|
335
332
|
items.sort((a, b) => order.indexOf(a) - order.indexOf(b));
|
|
336
333
|
}
|
|
337
334
|
}
|
|
@@ -345,31 +342,30 @@ class Collection extends ArrayCollection_1.ArrayCollection {
|
|
|
345
342
|
}
|
|
346
343
|
}
|
|
347
344
|
validateItemType(item) {
|
|
348
|
-
if (!
|
|
349
|
-
throw
|
|
345
|
+
if (!Utils.isEntity(item)) {
|
|
346
|
+
throw ValidationError.notEntity(this.owner, this.property, item);
|
|
350
347
|
}
|
|
351
348
|
}
|
|
352
349
|
validateModification(items) {
|
|
353
350
|
if (this.readonly) {
|
|
354
|
-
throw
|
|
351
|
+
throw ValidationError.cannotModifyReadonlyCollection(this.owner, this.property);
|
|
355
352
|
}
|
|
356
353
|
// currently we allow persisting to inverse sides only in SQL drivers
|
|
357
354
|
if (this.property.pivotTable || !this.property.mappedBy) {
|
|
358
355
|
return;
|
|
359
356
|
}
|
|
360
357
|
const check = (item) => {
|
|
361
|
-
if (!item ||
|
|
358
|
+
if (!item || helper(item).__initialized) {
|
|
362
359
|
return false;
|
|
363
360
|
}
|
|
364
|
-
return !item[this.property.mappedBy] && this.property.kind ===
|
|
361
|
+
return !item[this.property.mappedBy] && this.property.kind === ReferenceKind.MANY_TO_MANY;
|
|
365
362
|
};
|
|
366
363
|
// throw if we are modifying inverse side of M:N collection when owning side is initialized (would be ignored when persisting)
|
|
367
364
|
if (items.find(item => check(item))) {
|
|
368
|
-
throw
|
|
365
|
+
throw ValidationError.cannotModifyInverseCollection(this.owner, this.property);
|
|
369
366
|
}
|
|
370
367
|
}
|
|
371
368
|
}
|
|
372
|
-
exports.Collection = Collection;
|
|
373
369
|
Object.defineProperties(Collection.prototype, {
|
|
374
370
|
$: { get() { return this; } },
|
|
375
371
|
get: { get() { return () => this; } },
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { EntityManager } from '../EntityManager';
|
|
2
|
-
import type { EntityData, EntityDTO, EntityProperty, FromEntityType, IsSubset, MergeSelected } from '../typings';
|
|
1
|
+
import type { EntityManager } from '../EntityManager.js';
|
|
2
|
+
import type { EntityData, EntityDTO, EntityProperty, FromEntityType, IsSubset, MergeSelected } from '../typings.js';
|
|
3
3
|
export declare class EntityAssigner {
|
|
4
4
|
static assign<Entity extends object, Naked extends FromEntityType<Entity> = FromEntityType<Entity>, Convert extends boolean = false, Data extends EntityData<Naked, Convert> | Partial<EntityDTO<Naked>> = EntityData<Naked, Convert> | Partial<EntityDTO<Naked>>>(entity: Entity, data: Data & IsSubset<EntityData<Naked, Convert>, Data>, options?: AssignOptions<Convert>): MergeSelected<Entity, Naked, keyof Data & string>;
|
|
5
5
|
private static assignProperty;
|
package/entity/EntityAssigner.js
CHANGED
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
const EntityHelper_1 = require("./EntityHelper");
|
|
12
|
-
const validator = new EntityValidator_1.EntityValidator(false);
|
|
13
|
-
class EntityAssigner {
|
|
1
|
+
import { inspect } from 'node:util';
|
|
2
|
+
import { Collection } from './Collection.js';
|
|
3
|
+
import { Utils } from '../utils/Utils.js';
|
|
4
|
+
import { Reference } from './Reference.js';
|
|
5
|
+
import { ReferenceKind, SCALAR_TYPES } from '../enums.js';
|
|
6
|
+
import { EntityValidator } from './EntityValidator.js';
|
|
7
|
+
import { helper, wrap } from './wrap.js';
|
|
8
|
+
import { EntityHelper } from './EntityHelper.js';
|
|
9
|
+
const validator = new EntityValidator(false);
|
|
10
|
+
export class EntityAssigner {
|
|
14
11
|
static assign(entity, data, options = {}) {
|
|
15
12
|
let opts = options;
|
|
16
13
|
if (opts.visited?.has(entity)) {
|
|
17
14
|
return entity;
|
|
18
15
|
}
|
|
19
|
-
|
|
16
|
+
EntityHelper.ensurePropagation(entity);
|
|
20
17
|
opts.visited ??= new Set();
|
|
21
18
|
opts.visited.add(entity);
|
|
22
|
-
const wrapped =
|
|
19
|
+
const wrapped = helper(entity);
|
|
23
20
|
opts = {
|
|
24
21
|
...wrapped.__config.get('assign'),
|
|
25
22
|
schema: wrapped.__schema,
|
|
@@ -45,37 +42,37 @@ class EntityAssigner {
|
|
|
45
42
|
}
|
|
46
43
|
const prop = { ...props[propName], name: propName };
|
|
47
44
|
if (prop && options.onlyOwnProperties) {
|
|
48
|
-
if ([
|
|
45
|
+
if ([ReferenceKind.MANY_TO_MANY, ReferenceKind.ONE_TO_MANY].includes(prop.kind)) {
|
|
49
46
|
return;
|
|
50
47
|
}
|
|
51
|
-
if ([
|
|
52
|
-
value =
|
|
48
|
+
if ([ReferenceKind.MANY_TO_ONE, ReferenceKind.ONE_TO_ONE].includes(prop.kind)) {
|
|
49
|
+
value = Utils.extractPK(value, prop.targetMeta);
|
|
53
50
|
}
|
|
54
51
|
}
|
|
55
52
|
if (propName in props && !prop.nullable && value == null) {
|
|
56
53
|
throw new Error(`You must pass a non-${value} value to the property ${propName} of entity ${entity.constructor.name}.`);
|
|
57
54
|
}
|
|
58
55
|
// create collection instance if its missing so old items can be deleted with orphan removal
|
|
59
|
-
if ([
|
|
60
|
-
entity[prop.name] =
|
|
56
|
+
if ([ReferenceKind.MANY_TO_MANY, ReferenceKind.ONE_TO_MANY].includes(prop?.kind) && entity[prop.name] == null) {
|
|
57
|
+
entity[prop.name] = Collection.create(entity, prop.name, undefined, helper(entity).isInitialized());
|
|
61
58
|
}
|
|
62
|
-
if (prop &&
|
|
59
|
+
if (prop && Utils.isCollection(entity[prop.name])) {
|
|
63
60
|
return EntityAssigner.assignCollection(entity, entity[prop.name], value, prop, options.em, options);
|
|
64
61
|
}
|
|
65
62
|
const customType = prop?.customType;
|
|
66
|
-
if (options.convertCustomTypes && customType && prop.kind ===
|
|
63
|
+
if (options.convertCustomTypes && customType && prop.kind === ReferenceKind.SCALAR && !Utils.isEntity(data)) {
|
|
67
64
|
value = customType.convertToJSValue(value, options.platform);
|
|
68
65
|
}
|
|
69
|
-
if ([
|
|
70
|
-
if (options.updateNestedEntities && Object.hasOwn(entity, propName) &&
|
|
71
|
-
const unwrappedEntity =
|
|
72
|
-
const wrapped =
|
|
66
|
+
if ([ReferenceKind.MANY_TO_ONE, ReferenceKind.ONE_TO_ONE].includes(prop?.kind) && value != null) {
|
|
67
|
+
if (options.updateNestedEntities && Object.hasOwn(entity, propName) && Utils.isEntity(entity[propName], true) && Utils.isPlainObject(value)) {
|
|
68
|
+
const unwrappedEntity = Reference.unwrapReference(entity[propName]);
|
|
69
|
+
const wrapped = helper(unwrappedEntity);
|
|
73
70
|
if (options.updateByPrimaryKey) {
|
|
74
|
-
const pk =
|
|
71
|
+
const pk = Utils.extractPK(value, prop.targetMeta);
|
|
75
72
|
if (pk) {
|
|
76
73
|
const ref = options.em.getReference(prop.type, pk, options);
|
|
77
74
|
// if the PK differs, we want to change the target entity, not update it
|
|
78
|
-
const wrappedChild =
|
|
75
|
+
const wrappedChild = helper(ref);
|
|
79
76
|
const sameTarget = wrappedChild.getSerializedPrimaryKey() === wrapped.getSerializedPrimaryKey();
|
|
80
77
|
if (wrappedChild.__managed && wrappedChild.isInitialized() && sameTarget) {
|
|
81
78
|
return EntityAssigner.assign(ref, value, options);
|
|
@@ -83,21 +80,21 @@ class EntityAssigner {
|
|
|
83
80
|
}
|
|
84
81
|
return EntityAssigner.assignReference(entity, value, prop, options.em, options);
|
|
85
82
|
}
|
|
86
|
-
if (wrapped.__managed &&
|
|
83
|
+
if (wrapped.__managed && wrap(unwrappedEntity).isInitialized()) {
|
|
87
84
|
return EntityAssigner.assign(unwrappedEntity, value, options);
|
|
88
85
|
}
|
|
89
86
|
}
|
|
90
87
|
return EntityAssigner.assignReference(entity, value, prop, options.em, options);
|
|
91
88
|
}
|
|
92
|
-
if (prop.kind ===
|
|
89
|
+
if (prop.kind === ReferenceKind.SCALAR && SCALAR_TYPES.includes(prop.runtimeType) && (prop.setter || !prop.getter)) {
|
|
93
90
|
return entity[prop.name] = validator.validateProperty(prop, value, entity);
|
|
94
91
|
}
|
|
95
|
-
if (prop.kind ===
|
|
92
|
+
if (prop.kind === ReferenceKind.EMBEDDED && EntityAssigner.validateEM(options.em)) {
|
|
96
93
|
return EntityAssigner.assignEmbeddable(entity, value, prop, options.em, options);
|
|
97
94
|
}
|
|
98
|
-
if (options.mergeObjectProperties &&
|
|
95
|
+
if (options.mergeObjectProperties && Utils.isPlainObject(entity[propName]) && Utils.isPlainObject(value)) {
|
|
99
96
|
entity[propName] ??= {};
|
|
100
|
-
entity[propName] =
|
|
97
|
+
entity[propName] = Utils.merge({}, entity[propName], value);
|
|
101
98
|
}
|
|
102
99
|
else if (!prop || prop.setter || !prop.getter) {
|
|
103
100
|
entity[propName] = value;
|
|
@@ -110,18 +107,18 @@ class EntityAssigner {
|
|
|
110
107
|
*/
|
|
111
108
|
static autoWireOneToOne(prop, entity) {
|
|
112
109
|
const ref = entity[prop.name];
|
|
113
|
-
if (prop.kind !==
|
|
110
|
+
if (prop.kind !== ReferenceKind.ONE_TO_ONE || !Utils.isEntity(ref)) {
|
|
114
111
|
return;
|
|
115
112
|
}
|
|
116
|
-
const meta2 =
|
|
113
|
+
const meta2 = helper(ref).__meta;
|
|
117
114
|
const prop2 = meta2.properties[prop.inversedBy || prop.mappedBy];
|
|
118
|
-
/*
|
|
115
|
+
/* v8 ignore next 7 */
|
|
119
116
|
if (prop2 && !ref[prop2.name]) {
|
|
120
|
-
if (
|
|
121
|
-
ref.unwrap()[prop2.name] =
|
|
117
|
+
if (Reference.isReference(ref)) {
|
|
118
|
+
ref.unwrap()[prop2.name] = Reference.wrapReference(entity, prop2);
|
|
122
119
|
}
|
|
123
120
|
else {
|
|
124
|
-
ref[prop2.name] =
|
|
121
|
+
ref[prop2.name] = Reference.wrapReference(entity, prop2);
|
|
125
122
|
}
|
|
126
123
|
}
|
|
127
124
|
}
|
|
@@ -132,17 +129,17 @@ class EntityAssigner {
|
|
|
132
129
|
return true;
|
|
133
130
|
}
|
|
134
131
|
static assignReference(entity, value, prop, em, options) {
|
|
135
|
-
if (
|
|
136
|
-
entity[prop.name] =
|
|
132
|
+
if (Utils.isEntity(value, true)) {
|
|
133
|
+
entity[prop.name] = Reference.wrapReference(value, prop);
|
|
137
134
|
}
|
|
138
|
-
else if (
|
|
139
|
-
entity[prop.name] = prop.mapToPk ? value :
|
|
135
|
+
else if (Utils.isPrimaryKey(value, true) && EntityAssigner.validateEM(em)) {
|
|
136
|
+
entity[prop.name] = prop.mapToPk ? value : Reference.wrapReference(em.getReference(prop.type, value, options), prop);
|
|
140
137
|
}
|
|
141
|
-
else if (
|
|
142
|
-
entity[prop.name] =
|
|
138
|
+
else if (Utils.isPlainObject(value) && options.merge && EntityAssigner.validateEM(em)) {
|
|
139
|
+
entity[prop.name] = Reference.wrapReference(em.merge(prop.type, value, options), prop);
|
|
143
140
|
}
|
|
144
|
-
else if (
|
|
145
|
-
entity[prop.name] =
|
|
141
|
+
else if (Utils.isPlainObject(value) && EntityAssigner.validateEM(em)) {
|
|
142
|
+
entity[prop.name] = Reference.wrapReference(em.create(prop.type, value, options), prop);
|
|
146
143
|
}
|
|
147
144
|
else {
|
|
148
145
|
const name = entity.constructor.name;
|
|
@@ -152,32 +149,31 @@ class EntityAssigner {
|
|
|
152
149
|
}
|
|
153
150
|
static assignCollection(entity, collection, value, prop, em, options) {
|
|
154
151
|
const invalid = [];
|
|
155
|
-
const items =
|
|
152
|
+
const items = Utils.asArray(value).map((item, idx) => {
|
|
156
153
|
// try to propagate missing owning side reference to the payload first
|
|
157
154
|
const prop2 = prop.targetMeta?.properties[prop.mappedBy];
|
|
158
|
-
if (
|
|
159
|
-
item = { ...item, [prop2.name]:
|
|
155
|
+
if (Utils.isPlainObject(item) && prop2 && item[prop2.name] == null) {
|
|
156
|
+
item = { ...item, [prop2.name]: Reference.wrapReference(entity, prop2) };
|
|
160
157
|
}
|
|
161
|
-
if (options.updateNestedEntities && options.updateByPrimaryKey &&
|
|
162
|
-
const pk =
|
|
158
|
+
if (options.updateNestedEntities && options.updateByPrimaryKey && Utils.isPlainObject(item)) {
|
|
159
|
+
const pk = Utils.extractPK(item, prop.targetMeta);
|
|
163
160
|
if (pk && EntityAssigner.validateEM(em)) {
|
|
164
161
|
const ref = em.getUnitOfWork().getById(prop.type, pk, options.schema);
|
|
165
|
-
/* istanbul ignore else */
|
|
166
162
|
if (ref) {
|
|
167
163
|
return EntityAssigner.assign(ref, item, options);
|
|
168
164
|
}
|
|
169
165
|
}
|
|
170
166
|
return this.createCollectionItem(item, em, prop, invalid, options);
|
|
171
167
|
}
|
|
172
|
-
/*
|
|
173
|
-
if (options.updateNestedEntities && !options.updateByPrimaryKey && collection[idx] &&
|
|
168
|
+
/* v8 ignore next 3 */
|
|
169
|
+
if (options.updateNestedEntities && !options.updateByPrimaryKey && collection[idx] && helper(collection[idx])?.isInitialized()) {
|
|
174
170
|
return EntityAssigner.assign(collection[idx], item, options);
|
|
175
171
|
}
|
|
176
172
|
return this.createCollectionItem(item, em, prop, invalid, options);
|
|
177
173
|
});
|
|
178
174
|
if (invalid.length > 0) {
|
|
179
175
|
const name = entity.constructor.name;
|
|
180
|
-
throw new Error(`Invalid collection values provided for '${name}.${prop.name}' in ${name}.assign(): ${
|
|
176
|
+
throw new Error(`Invalid collection values provided for '${name}.${prop.name}' in ${name}.assign(): ${inspect(invalid)}`);
|
|
181
177
|
}
|
|
182
178
|
if (Array.isArray(value)) {
|
|
183
179
|
collection.set(items);
|
|
@@ -197,7 +193,7 @@ class EntityAssigner {
|
|
|
197
193
|
entity[propName] = [];
|
|
198
194
|
}
|
|
199
195
|
if (prop.array) {
|
|
200
|
-
return
|
|
196
|
+
return Utils.asArray(value).forEach(item => {
|
|
201
197
|
const tmp = {};
|
|
202
198
|
this.assignEmbeddable(tmp, item, { ...prop, array: false }, em, options);
|
|
203
199
|
entity[propName].push(...Object.values(tmp));
|
|
@@ -213,21 +209,20 @@ class EntityAssigner {
|
|
|
213
209
|
});
|
|
214
210
|
}
|
|
215
211
|
static createCollectionItem(item, em, prop, invalid, options) {
|
|
216
|
-
if (
|
|
212
|
+
if (Utils.isEntity(item)) {
|
|
217
213
|
return item;
|
|
218
214
|
}
|
|
219
|
-
if (
|
|
215
|
+
if (Utils.isPrimaryKey(item) && EntityAssigner.validateEM(em)) {
|
|
220
216
|
return em.getReference(prop.type, item, options);
|
|
221
217
|
}
|
|
222
|
-
if (
|
|
218
|
+
if (Utils.isPlainObject(item) && options.merge && EntityAssigner.validateEM(em)) {
|
|
223
219
|
return em.merge(prop.type, item, options);
|
|
224
220
|
}
|
|
225
|
-
if (
|
|
221
|
+
if (Utils.isPlainObject(item) && EntityAssigner.validateEM(em)) {
|
|
226
222
|
return em.create(prop.type, item, options);
|
|
227
223
|
}
|
|
228
224
|
invalid.push(item);
|
|
229
225
|
return item;
|
|
230
226
|
}
|
|
231
227
|
}
|
|
232
|
-
|
|
233
|
-
exports.assign = EntityAssigner.assign;
|
|
228
|
+
export const assign = EntityAssigner.assign;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { EntityData, EntityMetadata, EntityName, New, Primary } from '../typings';
|
|
2
|
-
import type { EntityManager } from '../EntityManager';
|
|
3
|
-
import type { EntityComparator } from '../utils/EntityComparator';
|
|
1
|
+
import type { EntityData, EntityMetadata, EntityName, New, Primary } from '../typings.js';
|
|
2
|
+
import type { EntityManager } from '../EntityManager.js';
|
|
3
|
+
import type { EntityComparator } from '../utils/EntityComparator.js';
|
|
4
4
|
export interface FactoryOptions {
|
|
5
5
|
initialized?: boolean;
|
|
6
6
|
newEntity?: boolean;
|