@mikro-orm/core 7.0.0-dev.33 → 7.0.0-dev.331
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 +70 -75
- package/EntityManager.js +487 -402
- package/MikroORM.d.ts +45 -38
- package/MikroORM.js +123 -156
- package/README.md +7 -4
- package/cache/FileCacheAdapter.d.ts +2 -7
- package/cache/FileCacheAdapter.js +35 -30
- package/cache/GeneratedCacheAdapter.d.ts +1 -2
- package/cache/GeneratedCacheAdapter.js +6 -8
- package/cache/MemoryCacheAdapter.d.ts +1 -2
- package/cache/MemoryCacheAdapter.js +8 -8
- package/cache/index.d.ts +1 -2
- package/cache/index.js +0 -2
- package/connections/Connection.d.ts +12 -5
- package/connections/Connection.js +37 -15
- package/drivers/DatabaseDriver.d.ts +25 -18
- package/drivers/DatabaseDriver.js +144 -45
- package/drivers/IDatabaseDriver.d.ts +118 -23
- package/entity/BaseEntity.d.ts +63 -4
- package/entity/BaseEntity.js +0 -3
- package/entity/Collection.d.ts +95 -31
- package/entity/Collection.js +487 -139
- package/entity/EntityAssigner.js +37 -25
- package/entity/EntityFactory.d.ts +8 -9
- package/entity/EntityFactory.js +152 -100
- package/entity/EntityHelper.d.ts +2 -2
- package/entity/EntityHelper.js +69 -27
- package/entity/EntityLoader.d.ts +12 -13
- package/entity/EntityLoader.js +286 -125
- package/entity/EntityRepository.d.ts +28 -8
- package/entity/EntityRepository.js +8 -2
- package/entity/PolymorphicRef.d.ts +12 -0
- package/entity/PolymorphicRef.js +18 -0
- package/entity/Reference.d.ts +3 -8
- package/entity/Reference.js +62 -29
- package/entity/WrappedEntity.d.ts +7 -10
- package/entity/WrappedEntity.js +6 -7
- package/entity/defineEntity.d.ts +472 -313
- package/entity/defineEntity.js +134 -290
- package/entity/index.d.ts +2 -2
- package/entity/index.js +2 -2
- package/entity/utils.d.ts +6 -1
- package/entity/utils.js +46 -11
- package/entity/validators.d.ts +11 -0
- package/entity/validators.js +66 -0
- package/enums.d.ts +8 -6
- package/enums.js +13 -17
- package/errors.d.ts +26 -16
- package/errors.js +63 -31
- package/events/EventManager.d.ts +3 -5
- package/events/EventManager.js +37 -26
- package/events/index.d.ts +1 -1
- package/events/index.js +0 -1
- package/exceptions.js +9 -2
- package/hydration/Hydrator.js +1 -2
- package/hydration/ObjectHydrator.d.ts +5 -6
- package/hydration/ObjectHydrator.js +109 -50
- package/index.d.ts +2 -2
- package/index.js +1 -2
- package/logging/DefaultLogger.d.ts +1 -1
- package/logging/DefaultLogger.js +3 -4
- package/logging/SimpleLogger.d.ts +1 -1
- package/logging/colors.d.ts +1 -1
- package/logging/colors.js +4 -6
- package/logging/index.d.ts +2 -1
- package/logging/index.js +1 -1
- package/logging/inspect.d.ts +2 -0
- package/logging/inspect.js +11 -0
- package/metadata/EntitySchema.d.ts +47 -23
- package/metadata/EntitySchema.js +103 -34
- package/metadata/MetadataDiscovery.d.ts +65 -18
- package/metadata/MetadataDiscovery.js +940 -424
- package/metadata/MetadataProvider.d.ts +11 -2
- package/metadata/MetadataProvider.js +71 -2
- package/metadata/MetadataStorage.d.ts +11 -13
- package/metadata/MetadataStorage.js +79 -48
- package/metadata/MetadataValidator.d.ts +32 -9
- package/metadata/MetadataValidator.js +214 -44
- 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 +0 -1
- package/metadata/types.d.ts +577 -0
- package/metadata/types.js +1 -0
- package/naming-strategy/AbstractNamingStrategy.d.ts +16 -4
- package/naming-strategy/AbstractNamingStrategy.js +26 -5
- package/naming-strategy/EntityCaseNamingStrategy.d.ts +3 -3
- package/naming-strategy/EntityCaseNamingStrategy.js +7 -6
- package/naming-strategy/MongoNamingStrategy.d.ts +3 -3
- package/naming-strategy/MongoNamingStrategy.js +6 -6
- package/naming-strategy/NamingStrategy.d.ts +28 -4
- package/naming-strategy/UnderscoreNamingStrategy.d.ts +3 -3
- package/naming-strategy/UnderscoreNamingStrategy.js +6 -6
- package/naming-strategy/index.d.ts +1 -1
- package/naming-strategy/index.js +0 -1
- package/not-supported.d.ts +2 -0
- package/not-supported.js +8 -0
- package/package.json +47 -36
- package/platforms/ExceptionConverter.js +1 -1
- package/platforms/Platform.d.ts +33 -15
- package/platforms/Platform.js +125 -69
- package/serialization/EntitySerializer.d.ts +6 -3
- package/serialization/EntitySerializer.js +54 -30
- package/serialization/EntityTransformer.js +37 -22
- package/serialization/SerializationContext.d.ts +10 -14
- package/serialization/SerializationContext.js +24 -19
- package/types/ArrayType.d.ts +1 -1
- package/types/ArrayType.js +2 -3
- package/types/BigIntType.js +1 -1
- package/types/BlobType.d.ts +0 -1
- package/types/BlobType.js +0 -3
- package/types/BooleanType.d.ts +1 -0
- package/types/BooleanType.js +3 -0
- package/types/DecimalType.js +2 -2
- package/types/DoubleType.js +1 -1
- 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/UuidType.d.ts +2 -0
- package/types/UuidType.js +14 -2
- package/types/index.d.ts +3 -2
- package/typings.d.ts +427 -170
- package/typings.js +100 -45
- package/unit-of-work/ChangeSet.d.ts +4 -6
- package/unit-of-work/ChangeSet.js +8 -9
- package/unit-of-work/ChangeSetComputer.d.ts +2 -12
- package/unit-of-work/ChangeSetComputer.js +61 -38
- package/unit-of-work/ChangeSetPersister.d.ts +10 -17
- package/unit-of-work/ChangeSetPersister.js +136 -73
- package/unit-of-work/CommitOrderCalculator.d.ts +13 -14
- package/unit-of-work/CommitOrderCalculator.js +22 -20
- package/unit-of-work/IdentityMap.d.ts +12 -3
- package/unit-of-work/IdentityMap.js +51 -13
- package/unit-of-work/UnitOfWork.d.ts +39 -23
- package/unit-of-work/UnitOfWork.js +441 -246
- package/utils/AbstractMigrator.d.ts +101 -0
- package/utils/AbstractMigrator.js +303 -0
- package/utils/AbstractSchemaGenerator.d.ts +5 -5
- package/utils/AbstractSchemaGenerator.js +30 -18
- package/utils/AsyncContext.d.ts +6 -0
- package/utils/AsyncContext.js +42 -0
- package/utils/Configuration.d.ts +647 -185
- package/utils/Configuration.js +215 -252
- package/utils/ConfigurationLoader.d.ts +1 -52
- package/utils/ConfigurationLoader.js +1 -330
- package/utils/Cursor.d.ts +3 -6
- package/utils/Cursor.js +32 -17
- package/utils/DataloaderUtils.d.ts +10 -5
- package/utils/DataloaderUtils.js +42 -22
- package/utils/EntityComparator.d.ts +21 -21
- package/utils/EntityComparator.js +224 -118
- package/utils/QueryHelper.d.ts +34 -7
- package/utils/QueryHelper.js +183 -72
- package/utils/RawQueryFragment.d.ts +28 -34
- package/utils/RawQueryFragment.js +37 -72
- package/utils/RequestContext.js +2 -2
- package/utils/TransactionContext.js +2 -2
- package/utils/TransactionManager.js +11 -8
- package/utils/Utils.d.ts +16 -127
- package/utils/Utils.js +104 -402
- package/utils/clone.js +13 -23
- package/utils/env-vars.d.ts +7 -0
- package/utils/env-vars.js +98 -0
- package/utils/fs-utils.d.ts +20 -0
- package/utils/fs-utils.js +193 -0
- package/utils/index.d.ts +1 -3
- package/utils/index.js +1 -3
- package/utils/upsert-utils.d.ts +9 -4
- package/utils/upsert-utils.js +51 -5
- 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 -33
- 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 -42
- package/decorators/ManyToMany.js +0 -14
- package/decorators/ManyToOne.d.ts +0 -34
- 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 -28
- 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 -14
- 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 -118
- package/entity/ArrayCollection.js +0 -407
- package/entity/EntityValidator.d.ts +0 -19
- package/entity/EntityValidator.js +0 -150
- 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/entity/BaseEntity.d.ts
CHANGED
|
@@ -1,20 +1,79 @@
|
|
|
1
1
|
import { type Ref } from './Reference.js';
|
|
2
|
-
import type { AutoPath, EntityData, EntityDTO, Loaded, LoadedReference, AddEager, EntityKey, FromEntityType, IsSubset, MergeSelected } from '../typings.js';
|
|
2
|
+
import type { AutoPath, EntityData, EntityDTO, Loaded, LoadedReference, AddEager, EntityKey, FromEntityType, IsSubset, MergeSelected, SerializeDTO } from '../typings.js';
|
|
3
3
|
import { type AssignOptions } from './EntityAssigner.js';
|
|
4
4
|
import type { EntityLoaderOptions } from './EntityLoader.js';
|
|
5
5
|
import { type SerializeOptions } from '../serialization/EntitySerializer.js';
|
|
6
6
|
import type { FindOneOptions } from '../drivers/IDatabaseDriver.js';
|
|
7
|
+
import type { PopulatePath } from '../enums.js';
|
|
7
8
|
export declare abstract class BaseEntity {
|
|
8
9
|
isInitialized(): boolean;
|
|
9
|
-
isTouched(): boolean;
|
|
10
10
|
populated(populated?: boolean): void;
|
|
11
|
-
populate<Entity extends this = this, Hint extends string = never>(populate: AutoPath<Entity, Hint>[] | false, options?: EntityLoaderOptions<Entity>): Promise<Loaded<Entity, Hint>>;
|
|
11
|
+
populate<Entity extends this = this, Hint extends string = never, Fields extends string = never>(populate: AutoPath<Entity, Hint, PopulatePath.ALL>[] | false, options?: EntityLoaderOptions<Entity, Fields>): Promise<Loaded<Entity, Hint>>;
|
|
12
12
|
toReference<Entity extends this = this>(): Ref<Entity> & LoadedReference<Loaded<Entity, AddEager<Entity>>>;
|
|
13
|
+
/**
|
|
14
|
+
* Converts the entity to a plain object representation.
|
|
15
|
+
*
|
|
16
|
+
* **Note on typing with `Loaded` entities:** When called on a `Loaded<Entity, 'relation'>` type,
|
|
17
|
+
* the return type will be `EntityDTO<Entity>` (with relations as primary keys), not
|
|
18
|
+
* `EntityDTO<Loaded<Entity, 'relation'>>` (with loaded relations as nested objects).
|
|
19
|
+
* This is a TypeScript limitation - the `this` type resolves to the class, not the `Loaded` wrapper.
|
|
20
|
+
*
|
|
21
|
+
* For correct typing that reflects loaded relations, use `wrap()`:
|
|
22
|
+
* ```ts
|
|
23
|
+
* const result = await em.find(User, {}, { populate: ['profile'] });
|
|
24
|
+
* // Type: EntityDTO<User> (profile is number)
|
|
25
|
+
* const obj1 = result[0].toObject();
|
|
26
|
+
* // Type: EntityDTO<Loaded<User, 'profile'>> (profile is nested object)
|
|
27
|
+
* const obj2 = wrap(result[0]).toObject();
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* Runtime values are correct in both cases - only the static types differ.
|
|
31
|
+
*/
|
|
13
32
|
toObject<Entity extends this = this>(): EntityDTO<Entity>;
|
|
33
|
+
/**
|
|
34
|
+
* Converts the entity to a plain object representation.
|
|
35
|
+
*
|
|
36
|
+
* **Note on typing with `Loaded` entities:** When called on a `Loaded<Entity, 'relation'>` type,
|
|
37
|
+
* the return type will be `EntityDTO<Entity>` (with relations as primary keys), not
|
|
38
|
+
* `EntityDTO<Loaded<Entity, 'relation'>>` (with loaded relations as nested objects).
|
|
39
|
+
* This is a TypeScript limitation - the `this` type resolves to the class, not the `Loaded` wrapper.
|
|
40
|
+
*
|
|
41
|
+
* For correct typing that reflects loaded relations, use `wrap()`:
|
|
42
|
+
* ```ts
|
|
43
|
+
* const result = await em.find(User, {}, { populate: ['profile'] });
|
|
44
|
+
* // Type: EntityDTO<User> (profile is number)
|
|
45
|
+
* const obj1 = result[0].toObject();
|
|
46
|
+
* // Type: EntityDTO<Loaded<User, 'profile'>> (profile is nested object)
|
|
47
|
+
* const obj2 = wrap(result[0]).toObject();
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* Runtime values are correct in both cases - only the static types differ.
|
|
51
|
+
*/
|
|
14
52
|
toObject<Entity extends this = this>(ignoreFields: never[]): EntityDTO<Entity>;
|
|
53
|
+
/**
|
|
54
|
+
* Converts the entity to a plain object representation.
|
|
55
|
+
*
|
|
56
|
+
* **Note on typing with `Loaded` entities:** When called on a `Loaded<Entity, 'relation'>` type,
|
|
57
|
+
* the return type will be `EntityDTO<Entity>` (with relations as primary keys), not
|
|
58
|
+
* `EntityDTO<Loaded<Entity, 'relation'>>` (with loaded relations as nested objects).
|
|
59
|
+
* This is a TypeScript limitation - the `this` type resolves to the class, not the `Loaded` wrapper.
|
|
60
|
+
*
|
|
61
|
+
* For correct typing that reflects loaded relations, use `wrap()`:
|
|
62
|
+
* ```ts
|
|
63
|
+
* const result = await em.find(User, {}, { populate: ['profile'] });
|
|
64
|
+
* // Type: EntityDTO<User> (profile is number)
|
|
65
|
+
* const obj1 = result[0].toObject();
|
|
66
|
+
* // Type: EntityDTO<Loaded<User, 'profile'>> (profile is nested object)
|
|
67
|
+
* const obj2 = wrap(result[0]).toObject();
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* Runtime values are correct in both cases - only the static types differ.
|
|
71
|
+
*
|
|
72
|
+
* @param ignoreFields - Array of field names to omit from the result.
|
|
73
|
+
*/
|
|
15
74
|
toObject<Entity extends this = this, Ignored extends EntityKey<Entity> = never>(ignoreFields: Ignored[]): Omit<EntityDTO<Entity>, Ignored>;
|
|
16
75
|
toPOJO<Entity extends this = this>(): EntityDTO<Entity>;
|
|
17
|
-
serialize<Entity extends this = this, Naked extends FromEntityType<Entity> = FromEntityType<Entity>, Hint extends string = never, Exclude extends string = never>(options?: SerializeOptions<Naked, Hint, Exclude>):
|
|
76
|
+
serialize<Entity extends this = this, Naked extends FromEntityType<Entity> = FromEntityType<Entity>, Hint extends string = never, Exclude extends string = never>(options?: SerializeOptions<Naked, Hint, Exclude>): SerializeDTO<Naked, Hint, Exclude>;
|
|
18
77
|
assign<Entity extends this, Naked extends FromEntityType<Entity> = FromEntityType<Entity>, Convert extends boolean = false, Data extends EntityData<Naked, Convert> | Partial<EntityDTO<Naked>> = EntityData<Naked, Convert> | Partial<EntityDTO<Naked>>>(data: Data & IsSubset<EntityData<Naked>, Data>, options?: AssignOptions<Convert>): MergeSelected<Entity, Naked, keyof Data & string>;
|
|
19
78
|
init<Entity extends this = this, Hint extends string = never, Fields extends string = '*', Excludes extends string = never>(options?: FindOneOptions<Entity, Hint, Fields, Excludes>): Promise<Loaded<Entity, Hint, Fields, Excludes> | null>;
|
|
20
79
|
getSchema(): string | undefined;
|
package/entity/BaseEntity.js
CHANGED
package/entity/Collection.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { EntityDTO, EntityKey, FilterQuery, Loaded, LoadedCollection, Populate } from '../typings.js';
|
|
2
|
-
import { ArrayCollection } from './ArrayCollection.js';
|
|
1
|
+
import type { EntityDTO, EntityKey, EntityProperty, FilterQuery, IPrimaryKey, Loaded, LoadedCollection, Populate, Primary } from '../typings.js';
|
|
3
2
|
import { Reference } from './Reference.js';
|
|
4
3
|
import type { Transaction } from '../connections/Connection.js';
|
|
5
4
|
import type { CountOptions, FindOptions } from '../drivers/IDatabaseDriver.js';
|
|
@@ -9,10 +8,10 @@ export interface MatchingOptions<T extends object, P extends string = never> ext
|
|
|
9
8
|
store?: boolean;
|
|
10
9
|
ctx?: Transaction;
|
|
11
10
|
}
|
|
12
|
-
export declare class Collection<T extends object, O extends object = object>
|
|
13
|
-
private
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
export declare class Collection<T extends object, O extends object = object> {
|
|
12
|
+
#private;
|
|
13
|
+
readonly owner: O;
|
|
14
|
+
[k: number]: T;
|
|
16
15
|
constructor(owner: O, items?: T[], initialized?: boolean);
|
|
17
16
|
/**
|
|
18
17
|
* Creates new Collection instance, assigns it to the owning entity and sets the items to it (propagating them to their inverse sides)
|
|
@@ -39,59 +38,124 @@ export declare class Collection<T extends object, O extends object = object> ext
|
|
|
39
38
|
*/
|
|
40
39
|
getItems(check?: boolean): T[];
|
|
41
40
|
toJSON<TT extends T>(): EntityDTO<TT>[];
|
|
42
|
-
add<TT extends T>(entity: TT | Reference<TT> | Iterable<TT | Reference<TT>>, ...entities: (TT | Reference<TT>)[]):
|
|
41
|
+
add<TT extends T>(entity: TT | Reference<TT> | Iterable<TT | Reference<TT>>, ...entities: (TT | Reference<TT>)[]): number;
|
|
43
42
|
/**
|
|
44
|
-
*
|
|
43
|
+
* Remove specified item(s) from the collection. Note that removing item from collection does not necessarily imply deleting the target entity,
|
|
44
|
+
* it means we are disconnecting the relation - removing items from collection, not removing entities from database - `Collection.remove()`
|
|
45
|
+
* is not the same as `em.remove()`. If we want to delete the entity by removing it from collection, we need to enable `orphanRemoval: true`,
|
|
46
|
+
* which tells the ORM we don't want orphaned entities to exist, so we know those should be removed.
|
|
45
47
|
*/
|
|
46
|
-
remove<TT extends T>(entity: TT | Reference<TT> | Iterable<TT | Reference<TT>> | ((item: TT) => boolean), ...entities: (TT | Reference<TT>)[]):
|
|
48
|
+
remove<TT extends T>(entity: TT | Reference<TT> | Iterable<TT | Reference<TT>> | ((item: TT) => boolean), ...entities: (TT | Reference<TT>)[]): number;
|
|
47
49
|
contains<TT extends T>(item: TT | Reference<TT>, check?: boolean): boolean;
|
|
48
50
|
count(): number;
|
|
49
51
|
isEmpty(): boolean;
|
|
52
|
+
shouldPopulate(populated?: boolean): boolean;
|
|
53
|
+
populated(populated?: boolean | undefined): void;
|
|
54
|
+
init<TT extends T, P extends string = never>(options?: InitCollectionOptions<TT, P>): Promise<LoadedCollection<Loaded<TT, P>>>;
|
|
55
|
+
private getEntityManager;
|
|
56
|
+
private createCondition;
|
|
57
|
+
private createManyToManyCondition;
|
|
58
|
+
private createLoadCountCondition;
|
|
59
|
+
private checkInitialized;
|
|
50
60
|
/**
|
|
51
|
-
*
|
|
61
|
+
* re-orders items after searching with `$in` operator
|
|
62
|
+
*/
|
|
63
|
+
private reorderItems;
|
|
64
|
+
private cancelOrphanRemoval;
|
|
65
|
+
private validateModification;
|
|
66
|
+
toArray<TT extends T>(): EntityDTO<TT>[];
|
|
67
|
+
getIdentifiers<U extends IPrimaryKey = Primary<T> & IPrimaryKey>(field?: string | string[]): U[];
|
|
68
|
+
/**
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
addWithoutPropagation(entity: T): void;
|
|
72
|
+
set(items: Iterable<T | Reference<T>>): void;
|
|
73
|
+
private compare;
|
|
74
|
+
/**
|
|
75
|
+
* @internal
|
|
76
|
+
*/
|
|
77
|
+
hydrate(items: T[], forcePropagate?: boolean, partial?: boolean): void;
|
|
78
|
+
/**
|
|
79
|
+
* Remove all items from the collection. Note that removing items from collection does not necessarily imply deleting the target entity,
|
|
80
|
+
* it means we are disconnecting the relation - removing items from collection, not removing entities from database - `Collection.remove()`
|
|
81
|
+
* is not the same as `em.remove()`. If we want to delete the entity by removing it from collection, we need to enable `orphanRemoval: true`,
|
|
82
|
+
* which tells the ORM we don't want orphaned entities to exist, so we know those should be removed.
|
|
83
|
+
*/
|
|
84
|
+
removeAll(): void;
|
|
85
|
+
/**
|
|
86
|
+
* @internal
|
|
87
|
+
*/
|
|
88
|
+
removeWithoutPropagation(entity: T): void;
|
|
89
|
+
/**
|
|
90
|
+
* Extracts a slice of the collection items starting at position start to end (exclusive) of the collection.
|
|
91
|
+
* If end is null it returns all elements from start to the end of the collection.
|
|
52
92
|
*/
|
|
53
93
|
slice(start?: number, end?: number): T[];
|
|
54
94
|
/**
|
|
55
|
-
*
|
|
95
|
+
* Tests for the existence of an element that satisfies the given predicate.
|
|
56
96
|
*/
|
|
57
97
|
exists(cb: (item: T) => boolean): boolean;
|
|
58
98
|
/**
|
|
59
|
-
*
|
|
99
|
+
* Returns the first element of this collection that satisfies the predicate.
|
|
100
|
+
*/
|
|
101
|
+
find<S extends T>(cb: (item: T, index: number) => item is S): S | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* Returns the first element of this collection that satisfies the predicate.
|
|
60
104
|
*/
|
|
61
105
|
find(cb: (item: T, index: number) => boolean): T | undefined;
|
|
62
106
|
/**
|
|
63
|
-
*
|
|
107
|
+
* Extracts a subset of the collection items.
|
|
108
|
+
*/
|
|
109
|
+
filter<S extends T>(cb: (item: T, index: number) => item is S): S[];
|
|
110
|
+
/**
|
|
111
|
+
* Extracts a subset of the collection items.
|
|
64
112
|
*/
|
|
65
113
|
filter(cb: (item: T, index: number) => boolean): T[];
|
|
66
114
|
/**
|
|
67
|
-
*
|
|
115
|
+
* Maps the collection items based on your provided mapper function.
|
|
68
116
|
*/
|
|
69
117
|
map<R>(mapper: (item: T, index: number) => R): R[];
|
|
70
118
|
/**
|
|
71
|
-
*
|
|
119
|
+
* Maps the collection items based on your provided mapper function to a single object.
|
|
120
|
+
*/
|
|
121
|
+
reduce<R>(cb: (obj: R, item: T, index: number) => R, initial?: R): R;
|
|
122
|
+
/**
|
|
123
|
+
* Maps the collection items to a dictionary, indexed by the key you specify.
|
|
124
|
+
* If there are more items with the same key, only the first one will be present.
|
|
72
125
|
*/
|
|
73
126
|
indexBy<K1 extends keyof T, K2 extends keyof T = never>(key: K1): Record<T[K1] & PropertyKey, T>;
|
|
74
127
|
/**
|
|
75
|
-
*
|
|
128
|
+
* Maps the collection items to a dictionary, indexed by the key you specify.
|
|
129
|
+
* If there are more items with the same key, only the first one will be present.
|
|
76
130
|
*/
|
|
77
131
|
indexBy<K1 extends keyof T, K2 extends keyof T = never>(key: K1, valueKey: K2): Record<T[K1] & PropertyKey, T[K2]>;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
private createManyToManyCondition;
|
|
85
|
-
private createLoadCountCondition;
|
|
86
|
-
private modify;
|
|
87
|
-
private checkInitialized;
|
|
132
|
+
isInitialized(fully?: boolean): boolean;
|
|
133
|
+
isDirty(): boolean;
|
|
134
|
+
isPartial(): boolean;
|
|
135
|
+
setDirty(dirty?: boolean): void;
|
|
136
|
+
get length(): number;
|
|
137
|
+
[Symbol.iterator](): IterableIterator<T>;
|
|
88
138
|
/**
|
|
89
|
-
*
|
|
139
|
+
* @internal
|
|
90
140
|
*/
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
141
|
+
takeSnapshot(forcePropagate?: boolean): void;
|
|
142
|
+
/**
|
|
143
|
+
* @internal
|
|
144
|
+
*/
|
|
145
|
+
getSnapshot(): T[] | undefined;
|
|
146
|
+
/**
|
|
147
|
+
* @internal
|
|
148
|
+
*/
|
|
149
|
+
get property(): EntityProperty;
|
|
150
|
+
/**
|
|
151
|
+
* @internal
|
|
152
|
+
*/
|
|
153
|
+
set property(prop: EntityProperty);
|
|
154
|
+
protected propagate(item: T, method: 'add' | 'remove' | 'takeSnapshot'): void;
|
|
155
|
+
protected propagateToInverseSide(item: T, method: 'add' | 'remove' | 'takeSnapshot'): void;
|
|
156
|
+
protected propagateToOwningSide(item: T, method: 'add' | 'remove' | 'takeSnapshot'): void;
|
|
157
|
+
protected shouldPropagateToCollection(collection: Collection<O, T>, method: 'add' | 'remove' | 'takeSnapshot'): boolean;
|
|
158
|
+
protected incrementCount(value: number): void;
|
|
95
159
|
}
|
|
96
160
|
export interface InitCollectionOptions<T, P extends string = never, F extends string = '*', E extends string = never> extends EntityLoaderOptions<T, F, E> {
|
|
97
161
|
dataloader?: boolean;
|