@mikro-orm/core 7.0.0-dev.3 → 7.0.0-dev.300
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 +114 -63
- package/EntityManager.js +385 -310
- package/MikroORM.d.ts +44 -35
- package/MikroORM.js +109 -143
- package/README.md +3 -2
- package/cache/FileCacheAdapter.d.ts +1 -1
- package/cache/FileCacheAdapter.js +17 -8
- 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 +119 -36
- package/drivers/IDatabaseDriver.d.ts +125 -23
- package/entity/BaseEntity.d.ts +63 -4
- package/entity/BaseEntity.js +0 -3
- package/entity/Collection.d.ts +102 -31
- package/entity/Collection.js +446 -108
- package/entity/EntityAssigner.d.ts +1 -1
- package/entity/EntityAssigner.js +26 -18
- package/entity/EntityFactory.d.ts +13 -1
- package/entity/EntityFactory.js +106 -60
- package/entity/EntityHelper.d.ts +2 -2
- package/entity/EntityHelper.js +65 -20
- package/entity/EntityLoader.d.ts +13 -11
- package/entity/EntityLoader.js +257 -107
- 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 +9 -12
- package/entity/Reference.js +34 -9
- package/entity/WrappedEntity.d.ts +3 -8
- package/entity/WrappedEntity.js +3 -8
- package/entity/defineEntity.d.ts +753 -0
- package/entity/defineEntity.js +537 -0
- package/entity/index.d.ts +4 -2
- package/entity/index.js +4 -2
- package/entity/utils.d.ts +13 -1
- package/entity/utils.js +49 -4
- package/entity/validators.d.ts +11 -0
- package/entity/validators.js +65 -0
- package/enums.d.ts +23 -8
- package/enums.js +15 -1
- package/errors.d.ts +25 -9
- package/errors.js +67 -21
- package/events/EventManager.d.ts +2 -1
- package/events/EventManager.js +19 -11
- package/events/EventSubscriber.d.ts +3 -1
- package/hydration/Hydrator.js +1 -2
- package/hydration/ObjectHydrator.d.ts +4 -4
- package/hydration/ObjectHydrator.js +89 -36
- 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 +53 -27
- package/metadata/EntitySchema.js +125 -52
- package/metadata/MetadataDiscovery.d.ts +64 -10
- package/metadata/MetadataDiscovery.js +823 -344
- package/metadata/MetadataProvider.d.ts +11 -2
- package/metadata/MetadataProvider.js +66 -2
- package/metadata/MetadataStorage.d.ts +13 -11
- package/metadata/MetadataStorage.js +71 -38
- package/metadata/MetadataValidator.d.ts +32 -9
- package/metadata/MetadataValidator.js +198 -42
- 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 +577 -0
- package/metadata/types.js +1 -0
- package/naming-strategy/AbstractNamingStrategy.d.ts +16 -4
- package/naming-strategy/AbstractNamingStrategy.js +20 -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 +28 -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 +22 -11
- package/platforms/ExceptionConverter.js +1 -1
- package/platforms/Platform.d.ts +14 -16
- package/platforms/Platform.js +24 -44
- package/serialization/EntitySerializer.d.ts +8 -3
- package/serialization/EntitySerializer.js +47 -27
- package/serialization/EntityTransformer.js +33 -21
- 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 +9 -6
- package/types/BigIntType.js +4 -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 +469 -175
- package/typings.js +120 -45
- package/unit-of-work/ChangeSet.d.ts +4 -6
- package/unit-of-work/ChangeSet.js +4 -5
- package/unit-of-work/ChangeSetComputer.d.ts +3 -8
- package/unit-of-work/ChangeSetComputer.js +44 -21
- package/unit-of-work/ChangeSetPersister.d.ts +15 -12
- package/unit-of-work/ChangeSetPersister.js +113 -45
- 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 +28 -3
- package/unit-of-work/UnitOfWork.js +315 -110
- package/utils/AbstractMigrator.d.ts +101 -0
- package/utils/AbstractMigrator.js +305 -0
- package/utils/AbstractSchemaGenerator.d.ts +5 -5
- package/utils/AbstractSchemaGenerator.js +32 -18
- package/utils/AsyncContext.d.ts +6 -0
- package/utils/AsyncContext.js +42 -0
- package/utils/Configuration.d.ts +801 -207
- package/utils/Configuration.js +150 -191
- package/utils/ConfigurationLoader.d.ts +1 -54
- package/utils/ConfigurationLoader.js +1 -352
- package/utils/Cursor.d.ts +3 -6
- package/utils/Cursor.js +27 -11
- package/utils/DataloaderUtils.d.ts +15 -5
- package/utils/DataloaderUtils.js +65 -17
- package/utils/EntityComparator.d.ts +21 -10
- package/utils/EntityComparator.js +243 -106
- package/utils/QueryHelper.d.ts +24 -6
- package/utils/QueryHelper.js +122 -26
- package/utils/RawQueryFragment.d.ts +60 -32
- package/utils/RawQueryFragment.js +69 -66
- 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 +15 -122
- package/utils/Utils.js +108 -376
- 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 +34 -0
- package/utils/fs-utils.js +196 -0
- package/utils/index.d.ts +2 -3
- package/utils/index.js +2 -3
- 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 -18
- package/decorators/Embedded.js +0 -18
- package/decorators/Entity.d.ts +0 -18
- package/decorators/Entity.js +0 -13
- 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 -5
- package/decorators/Formula.js +0 -15
- package/decorators/Indexed.d.ts +0 -17
- 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 -9
- 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 -395
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ConnectionType, EntityData, EntityMetadata, EntityProperty, FilterQuery, Primary, Dictionary,
|
|
1
|
+
import type { ConnectionType, Constructor, EntityData, EntityMetadata, EntityProperty, FilterQuery, Primary, Dictionary, IPrimaryKey, PopulateOptions, EntityDictionary, AutoPath, ObjectQuery, FilterObject, Populate, EntityName, PopulateHintOptions, Prefixes } from '../typings.js';
|
|
2
2
|
import type { Connection, QueryResult, Transaction } from '../connections/Connection.js';
|
|
3
3
|
import type { FlushMode, LockMode, QueryOrderMap, QueryFlag, LoadStrategy, PopulateHint, PopulatePath } from '../enums.js';
|
|
4
4
|
import type { Platform } from '../platforms/Platform.js';
|
|
@@ -7,34 +7,40 @@ import type { Collection } from '../entity/Collection.js';
|
|
|
7
7
|
import type { EntityManager } from '../EntityManager.js';
|
|
8
8
|
import type { DriverException } from '../exceptions.js';
|
|
9
9
|
import type { Configuration } from '../utils/Configuration.js';
|
|
10
|
+
import type { MikroORM } from '../MikroORM.js';
|
|
10
11
|
import type { LoggingOptions, LogContext } from '../logging/Logger.js';
|
|
11
|
-
import type {
|
|
12
|
+
import type { Raw } from '../utils/RawQueryFragment.js';
|
|
12
13
|
export declare const EntityManagerType: unique symbol;
|
|
13
14
|
export interface IDatabaseDriver<C extends Connection = Connection> {
|
|
14
15
|
[EntityManagerType]: EntityManager<this>;
|
|
15
16
|
readonly config: Configuration;
|
|
16
17
|
createEntityManager(useContext?: boolean): this[typeof EntityManagerType];
|
|
17
|
-
connect(
|
|
18
|
+
connect(options?: {
|
|
19
|
+
skipOnConnect?: boolean;
|
|
20
|
+
}): Promise<C>;
|
|
18
21
|
close(force?: boolean): Promise<void>;
|
|
19
|
-
reconnect(
|
|
22
|
+
reconnect(options?: {
|
|
23
|
+
skipOnConnect?: boolean;
|
|
24
|
+
}): Promise<C>;
|
|
20
25
|
getConnection(type?: ConnectionType): C;
|
|
21
26
|
/**
|
|
22
27
|
* Finds selection of entities
|
|
23
28
|
*/
|
|
24
|
-
find<T extends object, P extends string = never, F extends string = '*', E extends string = never>(entityName:
|
|
29
|
+
find<T extends object, P extends string = never, F extends string = '*', E extends string = never>(entityName: EntityName<T>, where: FilterQuery<T>, options?: FindOptions<T, P, F, E>): Promise<EntityData<T>[]>;
|
|
25
30
|
/**
|
|
26
31
|
* Finds single entity (table row, document)
|
|
27
32
|
*/
|
|
28
|
-
findOne<T extends object, P extends string = never, F extends string = '*', E extends string = never>(entityName:
|
|
29
|
-
findVirtual<T extends object>(entityName:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
findOne<T extends object, P extends string = never, F extends string = '*', E extends string = never>(entityName: EntityName<T>, where: FilterQuery<T>, options?: FindOneOptions<T, P, F, E>): Promise<EntityData<T> | null>;
|
|
34
|
+
findVirtual<T extends object>(entityName: EntityName<T>, where: FilterQuery<T>, options: FindOptions<T, any, any, any>): Promise<EntityData<T>[]>;
|
|
35
|
+
stream<T extends object>(entityName: EntityName<T>, where: FilterQuery<T>, options: StreamOptions<T>): AsyncIterableIterator<T>;
|
|
36
|
+
nativeInsert<T extends object>(entityName: EntityName<T>, data: EntityDictionary<T>, options?: NativeInsertUpdateOptions<T>): Promise<QueryResult<T>>;
|
|
37
|
+
nativeInsertMany<T extends object>(entityName: EntityName<T>, data: EntityDictionary<T>[], options?: NativeInsertUpdateManyOptions<T>, transform?: (sql: string) => string): Promise<QueryResult<T>>;
|
|
38
|
+
nativeUpdate<T extends object>(entityName: EntityName<T>, where: FilterQuery<T>, data: EntityDictionary<T>, options?: NativeInsertUpdateOptions<T>): Promise<QueryResult<T>>;
|
|
39
|
+
nativeUpdateMany<T extends object>(entityName: EntityName<T>, where: FilterQuery<T>[], data: EntityDictionary<T>[], options?: NativeInsertUpdateManyOptions<T>): Promise<QueryResult<T>>;
|
|
40
|
+
nativeDelete<T extends object>(entityName: EntityName<T>, where: FilterQuery<T>, options?: NativeDeleteOptions<T>): Promise<QueryResult<T>>;
|
|
35
41
|
syncCollections<T extends object, O extends object>(collections: Iterable<Collection<T, O>>, options?: DriverMethodOptions): Promise<void>;
|
|
36
|
-
count<T extends object, P extends string = never>(entityName:
|
|
37
|
-
aggregate(entityName:
|
|
42
|
+
count<T extends object, P extends string = never>(entityName: EntityName<T>, where: FilterQuery<T>, options?: CountOptions<T, P>): Promise<number>;
|
|
43
|
+
aggregate(entityName: EntityName, pipeline: any[]): Promise<any[]>;
|
|
38
44
|
mapResult<T extends object>(result: EntityDictionary<T>, meta: EntityMetadata<T>, populate?: PopulateOptions<T>[]): EntityData<T> | null;
|
|
39
45
|
/**
|
|
40
46
|
* When driver uses pivot tables for M:N, this method will load identifiers for given collections from them
|
|
@@ -60,6 +66,10 @@ export interface IDatabaseDriver<C extends Connection = Connection> {
|
|
|
60
66
|
schema?: string;
|
|
61
67
|
parentSchema?: string;
|
|
62
68
|
}): string | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
getORMClass(): Constructor<MikroORM>;
|
|
63
73
|
}
|
|
64
74
|
export type EntityField<T, P extends string = PopulatePath.ALL> = keyof T | PopulatePath.ALL | AutoPath<T, P, `${PopulatePath.ALL}`>;
|
|
65
75
|
export type OrderDefinition<T> = (QueryOrderMap<T> & {
|
|
@@ -68,6 +78,18 @@ export type OrderDefinition<T> = (QueryOrderMap<T> & {
|
|
|
68
78
|
export interface FindAllOptions<T, P extends string = never, F extends string = '*', E extends string = never> extends FindOptions<T, P, F, E> {
|
|
69
79
|
where?: FilterQuery<T>;
|
|
70
80
|
}
|
|
81
|
+
export interface StreamOptions<Entity, Populate extends string = never, Fields extends string = '*', Exclude extends string = never> extends Omit<FindAllOptions<Entity, Populate, Fields, Exclude>, 'cache' | 'before' | 'after' | 'first' | 'last' | 'overfetch' | 'strategy'> {
|
|
82
|
+
/**
|
|
83
|
+
* When populating to-many relations, the ORM streams fully merged entities instead of yielding every row.
|
|
84
|
+
* You can opt out of this behavior by specifying `mergeResults: false`. This will yield every row from
|
|
85
|
+
* the SQL result, but still mapped to entities, meaning that to-many collections will contain at most
|
|
86
|
+
* a single item, and you will get duplicate root entities when they have multiple items in the populated
|
|
87
|
+
* collection.
|
|
88
|
+
*
|
|
89
|
+
* @default true
|
|
90
|
+
*/
|
|
91
|
+
mergeResults?: boolean;
|
|
92
|
+
}
|
|
71
93
|
export type FilterOptions = Dictionary<boolean | Dictionary> | string[] | boolean;
|
|
72
94
|
export interface LoadHint<Entity, Hint extends string = never, Fields extends string = PopulatePath.ALL, Excludes extends string = never> {
|
|
73
95
|
populate?: Populate<Entity, Hint>;
|
|
@@ -88,8 +110,28 @@ export interface FindOptions<Entity, Hint extends string = never, Fields extends
|
|
|
88
110
|
* when nesting the condition. This is used for implementation of joined filters.
|
|
89
111
|
*/
|
|
90
112
|
populateFilter?: ObjectQuery<Entity>;
|
|
113
|
+
/**
|
|
114
|
+
* Index-friendly alternative to `$or` for conditions that span joined relations.
|
|
115
|
+
* Each array element becomes an independent branch combined via `UNION ALL` subquery:
|
|
116
|
+
* `WHERE pk IN (branch_1 UNION ALL branch_2 ... branch_N)`.
|
|
117
|
+
* The database plans each branch independently, enabling per-table index usage
|
|
118
|
+
* (e.g. GIN trigram indexes for fuzzy search across related entities).
|
|
119
|
+
* sql only
|
|
120
|
+
*/
|
|
121
|
+
unionWhere?: ObjectQuery<Entity>[];
|
|
122
|
+
/**
|
|
123
|
+
* Strategy for combining `unionWhere` branches.
|
|
124
|
+
* - `'union-all'` (default) — skips deduplication, faster for most use cases.
|
|
125
|
+
* - `'union'` — deduplicates rows between branches; useful when branch overlap is very high.
|
|
126
|
+
* sql only
|
|
127
|
+
*/
|
|
128
|
+
unionWhereStrategy?: 'union-all' | 'union';
|
|
91
129
|
/** Used for ordering of the populate queries. If not specified, the value of `options.orderBy` is used. */
|
|
92
130
|
populateOrderBy?: OrderDefinition<Entity>;
|
|
131
|
+
/** Per-relation overrides for populate loading behavior. Keys are populate paths (same as used in `populate`). */
|
|
132
|
+
populateHints?: [Hint] extends [never] ? never : {
|
|
133
|
+
[K in Prefixes<Hint>]?: PopulateHintOptions;
|
|
134
|
+
};
|
|
93
135
|
/** Ordering of the results.Can be an object or array of objects, keys are property names, values are ordering (asc/desc) */
|
|
94
136
|
orderBy?: OrderDefinition<Entity>;
|
|
95
137
|
/** Control result caching for this query. Result cache is by default disabled, not to be confused with the identity map. */
|
|
@@ -127,7 +169,7 @@ export interface FindOptions<Entity, Hint extends string = never, Fields extends
|
|
|
127
169
|
flags?: QueryFlag[];
|
|
128
170
|
/** sql only */
|
|
129
171
|
groupBy?: string | string[];
|
|
130
|
-
having?:
|
|
172
|
+
having?: FilterQuery<Entity>;
|
|
131
173
|
/** sql only */
|
|
132
174
|
strategy?: LoadStrategy | `${LoadStrategy}`;
|
|
133
175
|
flushMode?: FlushMode | `${FlushMode}`;
|
|
@@ -138,18 +180,27 @@ export interface FindOptions<Entity, Hint extends string = never, Fields extends
|
|
|
138
180
|
lockTableAliases?: string[];
|
|
139
181
|
ctx?: Transaction;
|
|
140
182
|
connectionType?: ConnectionType;
|
|
141
|
-
/**
|
|
142
|
-
indexHint?: string;
|
|
183
|
+
/** SQL: appended to FROM clause (e.g. `'force index(my_index)'`); MongoDB: index name or spec passed as `hint`. */
|
|
184
|
+
indexHint?: string | Dictionary;
|
|
143
185
|
/** sql only */
|
|
144
186
|
comments?: string | string[];
|
|
145
187
|
/** sql only */
|
|
146
188
|
hintComments?: string | string[];
|
|
189
|
+
/** SQL: collation name string applied as COLLATE to ORDER BY; MongoDB: CollationOptions object. */
|
|
190
|
+
collation?: CollationOptions | string;
|
|
191
|
+
/** mongodb only */
|
|
192
|
+
maxTimeMS?: number;
|
|
193
|
+
/** mongodb only */
|
|
194
|
+
allowDiskUse?: boolean;
|
|
147
195
|
loggerContext?: LogContext;
|
|
148
196
|
logging?: LoggingOptions;
|
|
197
|
+
/** @internal used to apply filters to the auto-joined relations */
|
|
198
|
+
em?: EntityManager;
|
|
149
199
|
}
|
|
150
|
-
export interface FindByCursorOptions<T extends object, P extends string = never, F extends string = '*', E extends string = never> extends Omit<
|
|
200
|
+
export interface FindByCursorOptions<T extends object, P extends string = never, F extends string = '*', E extends string = never, I extends boolean = true> extends Omit<FindAllOptions<T, P, F, E>, 'limit' | 'offset'> {
|
|
201
|
+
includeCount?: I;
|
|
151
202
|
}
|
|
152
|
-
export interface FindOneOptions<T
|
|
203
|
+
export interface FindOneOptions<T, P extends string = never, F extends string = '*', E extends string = never> extends Omit<FindOptions<T, P, F, E>, 'limit' | 'lockMode'> {
|
|
153
204
|
lockMode?: LockMode;
|
|
154
205
|
lockVersion?: number | Date;
|
|
155
206
|
}
|
|
@@ -163,15 +214,24 @@ export interface NativeInsertUpdateOptions<T> {
|
|
|
163
214
|
schema?: string;
|
|
164
215
|
/** `nativeUpdate()` only option */
|
|
165
216
|
upsert?: boolean;
|
|
217
|
+
loggerContext?: LogContext;
|
|
218
|
+
/** sql only */
|
|
219
|
+
unionWhere?: ObjectQuery<T>[];
|
|
220
|
+
/** sql only */
|
|
221
|
+
unionWhereStrategy?: 'union-all' | 'union';
|
|
222
|
+
filters?: FilterOptions;
|
|
223
|
+
/** @internal */
|
|
224
|
+
em?: EntityManager;
|
|
166
225
|
}
|
|
167
226
|
export interface NativeInsertUpdateManyOptions<T> extends NativeInsertUpdateOptions<T> {
|
|
168
227
|
processCollections?: boolean;
|
|
169
228
|
}
|
|
170
229
|
export interface UpsertOptions<Entity, Fields extends string = never> extends Omit<NativeInsertUpdateOptions<Entity>, 'upsert'> {
|
|
171
|
-
onConflictFields?: (keyof Entity)[] |
|
|
230
|
+
onConflictFields?: (keyof Entity)[] | Raw;
|
|
172
231
|
onConflictAction?: 'ignore' | 'merge';
|
|
173
232
|
onConflictMergeFields?: AutoPath<Entity, Fields, `${PopulatePath.ALL}`>[];
|
|
174
233
|
onConflictExcludeFields?: AutoPath<Entity, Fields, `${PopulatePath.ALL}`>[];
|
|
234
|
+
onConflictWhere?: FilterQuery<Entity>;
|
|
175
235
|
disableIdentityMap?: boolean;
|
|
176
236
|
}
|
|
177
237
|
export interface UpsertManyOptions<Entity, Fields extends string = never> extends UpsertOptions<Entity, Fields> {
|
|
@@ -181,33 +241,59 @@ export interface CountOptions<T extends object, P extends string = never> {
|
|
|
181
241
|
filters?: FilterOptions;
|
|
182
242
|
schema?: string;
|
|
183
243
|
groupBy?: string | readonly string[];
|
|
184
|
-
having?:
|
|
244
|
+
having?: FilterQuery<T>;
|
|
185
245
|
cache?: boolean | number | [string, number];
|
|
186
246
|
populate?: Populate<T, P>;
|
|
187
247
|
populateWhere?: ObjectQuery<T> | PopulateHint | `${PopulateHint}`;
|
|
188
248
|
populateFilter?: ObjectQuery<T>;
|
|
249
|
+
/** @see FindOptions.unionWhere */
|
|
250
|
+
unionWhere?: ObjectQuery<T>[];
|
|
251
|
+
/** @see FindOptions.unionWhereStrategy */
|
|
252
|
+
unionWhereStrategy?: 'union-all' | 'union';
|
|
189
253
|
ctx?: Transaction;
|
|
190
254
|
connectionType?: ConnectionType;
|
|
191
255
|
flushMode?: FlushMode | `${FlushMode}`;
|
|
192
|
-
/**
|
|
193
|
-
indexHint?: string;
|
|
256
|
+
/** SQL: appended to FROM clause (e.g. `'force index(my_index)'`); MongoDB: index name or spec passed as `hint`. */
|
|
257
|
+
indexHint?: string | Dictionary;
|
|
194
258
|
/** sql only */
|
|
195
259
|
comments?: string | string[];
|
|
196
260
|
/** sql only */
|
|
197
261
|
hintComments?: string | string[];
|
|
262
|
+
/** SQL: collation name string applied as COLLATE; MongoDB: CollationOptions object. */
|
|
263
|
+
collation?: CollationOptions | string;
|
|
264
|
+
/** mongodb only */
|
|
265
|
+
maxTimeMS?: number;
|
|
198
266
|
loggerContext?: LogContext;
|
|
199
267
|
logging?: LoggingOptions;
|
|
268
|
+
/** @internal used to apply filters to the auto-joined relations */
|
|
269
|
+
em?: EntityManager;
|
|
200
270
|
}
|
|
201
271
|
export interface UpdateOptions<T> {
|
|
202
272
|
filters?: FilterOptions;
|
|
203
273
|
schema?: string;
|
|
204
274
|
ctx?: Transaction;
|
|
275
|
+
/** sql only */
|
|
276
|
+
unionWhere?: ObjectQuery<T>[];
|
|
277
|
+
/** sql only */
|
|
278
|
+
unionWhereStrategy?: 'union-all' | 'union';
|
|
205
279
|
}
|
|
206
280
|
export interface DeleteOptions<T> extends DriverMethodOptions {
|
|
207
281
|
filters?: FilterOptions;
|
|
282
|
+
/** sql only */
|
|
283
|
+
unionWhere?: ObjectQuery<T>[];
|
|
284
|
+
/** sql only */
|
|
285
|
+
unionWhereStrategy?: 'union-all' | 'union';
|
|
286
|
+
/** @internal */
|
|
287
|
+
em?: EntityManager;
|
|
208
288
|
}
|
|
209
289
|
export interface NativeDeleteOptions<T> extends DriverMethodOptions {
|
|
210
290
|
filters?: FilterOptions;
|
|
291
|
+
/** sql only */
|
|
292
|
+
unionWhere?: ObjectQuery<T>[];
|
|
293
|
+
/** sql only */
|
|
294
|
+
unionWhereStrategy?: 'union-all' | 'union';
|
|
295
|
+
/** @internal */
|
|
296
|
+
em?: EntityManager;
|
|
211
297
|
}
|
|
212
298
|
export interface LockOptions extends DriverMethodOptions {
|
|
213
299
|
lockMode?: LockMode;
|
|
@@ -218,9 +304,25 @@ export interface LockOptions extends DriverMethodOptions {
|
|
|
218
304
|
export interface DriverMethodOptions {
|
|
219
305
|
ctx?: Transaction;
|
|
220
306
|
schema?: string;
|
|
307
|
+
loggerContext?: LogContext;
|
|
308
|
+
}
|
|
309
|
+
export interface CollationOptions {
|
|
310
|
+
locale: string;
|
|
311
|
+
caseLevel?: boolean;
|
|
312
|
+
caseFirst?: string;
|
|
313
|
+
strength?: number;
|
|
314
|
+
numericOrdering?: boolean;
|
|
315
|
+
alternate?: string;
|
|
316
|
+
maxVariable?: string;
|
|
317
|
+
backwards?: boolean;
|
|
221
318
|
}
|
|
222
319
|
export interface GetReferenceOptions {
|
|
223
320
|
wrapped?: boolean;
|
|
224
321
|
convertCustomTypes?: boolean;
|
|
225
322
|
schema?: string;
|
|
323
|
+
/**
|
|
324
|
+
* Property name to use for identity map lookup instead of the primary key.
|
|
325
|
+
* This is useful for creating references by unique non-PK properties.
|
|
326
|
+
*/
|
|
327
|
+
key?: string;
|
|
226
328
|
}
|
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,19 +1,25 @@
|
|
|
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
|
-
import type {
|
|
4
|
+
import type { CountOptions, FindOptions } from '../drivers/IDatabaseDriver.js';
|
|
6
5
|
import type { EntityLoaderOptions } from './EntityLoader.js';
|
|
7
6
|
export interface MatchingOptions<T extends object, P extends string = never> extends FindOptions<T, P> {
|
|
8
7
|
where?: FilterQuery<T>;
|
|
9
8
|
store?: boolean;
|
|
10
9
|
ctx?: Transaction;
|
|
11
10
|
}
|
|
12
|
-
export declare class Collection<T extends object, O extends object = object>
|
|
11
|
+
export declare class Collection<T extends object, O extends object = object> {
|
|
12
|
+
readonly owner: O;
|
|
13
|
+
[k: number]: T;
|
|
14
|
+
protected readonly items: Set<T>;
|
|
15
|
+
protected initialized: boolean;
|
|
16
|
+
protected dirty: boolean;
|
|
17
|
+
protected partial: boolean;
|
|
18
|
+
protected snapshot: T[] | undefined;
|
|
13
19
|
private readonly?;
|
|
20
|
+
protected _count?: number;
|
|
21
|
+
private _property?;
|
|
14
22
|
private _populated?;
|
|
15
|
-
private _em?;
|
|
16
|
-
private _snapshot?;
|
|
17
23
|
constructor(owner: O, items?: T[], initialized?: boolean);
|
|
18
24
|
/**
|
|
19
25
|
* Creates new Collection instance, assigns it to the owning entity and sets the items to it (propagating them to their inverse sides)
|
|
@@ -40,59 +46,124 @@ export declare class Collection<T extends object, O extends object = object> ext
|
|
|
40
46
|
*/
|
|
41
47
|
getItems(check?: boolean): T[];
|
|
42
48
|
toJSON<TT extends T>(): EntityDTO<TT>[];
|
|
43
|
-
add<TT extends T>(entity: TT | Reference<TT> | Iterable<TT | Reference<TT>>, ...entities: (TT | Reference<TT>)[]):
|
|
49
|
+
add<TT extends T>(entity: TT | Reference<TT> | Iterable<TT | Reference<TT>>, ...entities: (TT | Reference<TT>)[]): number;
|
|
44
50
|
/**
|
|
45
|
-
*
|
|
51
|
+
* Remove specified item(s) from the collection. Note that removing item from collection does not necessarily imply deleting the target entity,
|
|
52
|
+
* it means we are disconnecting the relation - removing items from collection, not removing entities from database - `Collection.remove()`
|
|
53
|
+
* 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`,
|
|
54
|
+
* which tells the ORM we don't want orphaned entities to exist, so we know those should be removed.
|
|
46
55
|
*/
|
|
47
|
-
remove<TT extends T>(entity: TT | Reference<TT> | Iterable<TT | Reference<TT>> | ((item: TT) => boolean), ...entities: (TT | Reference<TT>)[]):
|
|
56
|
+
remove<TT extends T>(entity: TT | Reference<TT> | Iterable<TT | Reference<TT>> | ((item: TT) => boolean), ...entities: (TT | Reference<TT>)[]): number;
|
|
48
57
|
contains<TT extends T>(item: TT | Reference<TT>, check?: boolean): boolean;
|
|
49
58
|
count(): number;
|
|
50
59
|
isEmpty(): boolean;
|
|
60
|
+
shouldPopulate(populated?: boolean): boolean;
|
|
61
|
+
populated(populated?: boolean | undefined): void;
|
|
62
|
+
init<TT extends T, P extends string = never>(options?: InitCollectionOptions<TT, P>): Promise<LoadedCollection<Loaded<TT, P>>>;
|
|
63
|
+
private getEntityManager;
|
|
64
|
+
private createCondition;
|
|
65
|
+
private createManyToManyCondition;
|
|
66
|
+
private createLoadCountCondition;
|
|
67
|
+
private checkInitialized;
|
|
51
68
|
/**
|
|
52
|
-
*
|
|
69
|
+
* re-orders items after searching with `$in` operator
|
|
70
|
+
*/
|
|
71
|
+
private reorderItems;
|
|
72
|
+
private cancelOrphanRemoval;
|
|
73
|
+
private validateModification;
|
|
74
|
+
toArray<TT extends T>(): EntityDTO<TT>[];
|
|
75
|
+
getIdentifiers<U extends IPrimaryKey = Primary<T> & IPrimaryKey>(field?: string | string[]): U[];
|
|
76
|
+
/**
|
|
77
|
+
* @internal
|
|
78
|
+
*/
|
|
79
|
+
addWithoutPropagation(entity: T): void;
|
|
80
|
+
set(items: Iterable<T | Reference<T>>): void;
|
|
81
|
+
private compare;
|
|
82
|
+
/**
|
|
83
|
+
* @internal
|
|
84
|
+
*/
|
|
85
|
+
hydrate(items: T[], forcePropagate?: boolean, partial?: boolean): void;
|
|
86
|
+
/**
|
|
87
|
+
* Remove all items from the collection. Note that removing items from collection does not necessarily imply deleting the target entity,
|
|
88
|
+
* it means we are disconnecting the relation - removing items from collection, not removing entities from database - `Collection.remove()`
|
|
89
|
+
* 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`,
|
|
90
|
+
* which tells the ORM we don't want orphaned entities to exist, so we know those should be removed.
|
|
91
|
+
*/
|
|
92
|
+
removeAll(): void;
|
|
93
|
+
/**
|
|
94
|
+
* @internal
|
|
95
|
+
*/
|
|
96
|
+
removeWithoutPropagation(entity: T): void;
|
|
97
|
+
/**
|
|
98
|
+
* Extracts a slice of the collection items starting at position start to end (exclusive) of the collection.
|
|
99
|
+
* If end is null it returns all elements from start to the end of the collection.
|
|
53
100
|
*/
|
|
54
101
|
slice(start?: number, end?: number): T[];
|
|
55
102
|
/**
|
|
56
|
-
*
|
|
103
|
+
* Tests for the existence of an element that satisfies the given predicate.
|
|
57
104
|
*/
|
|
58
105
|
exists(cb: (item: T) => boolean): boolean;
|
|
59
106
|
/**
|
|
60
|
-
*
|
|
107
|
+
* Returns the first element of this collection that satisfies the predicate.
|
|
108
|
+
*/
|
|
109
|
+
find<S extends T>(cb: (item: T, index: number) => item is S): S | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* Returns the first element of this collection that satisfies the predicate.
|
|
61
112
|
*/
|
|
62
113
|
find(cb: (item: T, index: number) => boolean): T | undefined;
|
|
63
114
|
/**
|
|
64
|
-
*
|
|
115
|
+
* Extracts a subset of the collection items.
|
|
116
|
+
*/
|
|
117
|
+
filter<S extends T>(cb: (item: T, index: number) => item is S): S[];
|
|
118
|
+
/**
|
|
119
|
+
* Extracts a subset of the collection items.
|
|
65
120
|
*/
|
|
66
121
|
filter(cb: (item: T, index: number) => boolean): T[];
|
|
67
122
|
/**
|
|
68
|
-
*
|
|
123
|
+
* Maps the collection items based on your provided mapper function.
|
|
69
124
|
*/
|
|
70
125
|
map<R>(mapper: (item: T, index: number) => R): R[];
|
|
71
126
|
/**
|
|
72
|
-
*
|
|
127
|
+
* Maps the collection items based on your provided mapper function to a single object.
|
|
128
|
+
*/
|
|
129
|
+
reduce<R>(cb: (obj: R, item: T, index: number) => R, initial?: R): R;
|
|
130
|
+
/**
|
|
131
|
+
* Maps the collection items to a dictionary, indexed by the key you specify.
|
|
132
|
+
* If there are more items with the same key, only the first one will be present.
|
|
73
133
|
*/
|
|
74
134
|
indexBy<K1 extends keyof T, K2 extends keyof T = never>(key: K1): Record<T[K1] & PropertyKey, T>;
|
|
75
135
|
/**
|
|
76
|
-
*
|
|
136
|
+
* Maps the collection items to a dictionary, indexed by the key you specify.
|
|
137
|
+
* If there are more items with the same key, only the first one will be present.
|
|
77
138
|
*/
|
|
78
139
|
indexBy<K1 extends keyof T, K2 extends keyof T = never>(key: K1, valueKey: K2): Record<T[K1] & PropertyKey, T[K2]>;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
private createManyToManyCondition;
|
|
86
|
-
private createLoadCountCondition;
|
|
87
|
-
private modify;
|
|
88
|
-
private checkInitialized;
|
|
140
|
+
isInitialized(fully?: boolean): boolean;
|
|
141
|
+
isDirty(): boolean;
|
|
142
|
+
isPartial(): boolean;
|
|
143
|
+
setDirty(dirty?: boolean): void;
|
|
144
|
+
get length(): number;
|
|
145
|
+
[Symbol.iterator](): IterableIterator<T>;
|
|
89
146
|
/**
|
|
90
|
-
*
|
|
147
|
+
* @internal
|
|
91
148
|
*/
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
149
|
+
takeSnapshot(forcePropagate?: boolean): void;
|
|
150
|
+
/**
|
|
151
|
+
* @internal
|
|
152
|
+
*/
|
|
153
|
+
getSnapshot(): T[] | undefined;
|
|
154
|
+
/**
|
|
155
|
+
* @internal
|
|
156
|
+
*/
|
|
157
|
+
get property(): EntityProperty;
|
|
158
|
+
/**
|
|
159
|
+
* @internal
|
|
160
|
+
*/
|
|
161
|
+
set property(prop: EntityProperty);
|
|
162
|
+
protected propagate(item: T, method: 'add' | 'remove' | 'takeSnapshot'): void;
|
|
163
|
+
protected propagateToInverseSide(item: T, method: 'add' | 'remove' | 'takeSnapshot'): void;
|
|
164
|
+
protected propagateToOwningSide(item: T, method: 'add' | 'remove' | 'takeSnapshot'): void;
|
|
165
|
+
protected shouldPropagateToCollection(collection: Collection<O, T>, method: 'add' | 'remove' | 'takeSnapshot'): boolean;
|
|
166
|
+
protected incrementCount(value: number): void;
|
|
96
167
|
}
|
|
97
168
|
export interface InitCollectionOptions<T, P extends string = never, F extends string = '*', E extends string = never> extends EntityLoaderOptions<T, F, E> {
|
|
98
169
|
dataloader?: boolean;
|