UnitOfWork
Index
Constructors
Methods
- cancelOrphanRemoval
- clear
- clearActionsQueue
- commit
- computeChangeSet
- computeChangeSets
- getById
- getChangeSetPersister
- getChangeSets
- getCollectionUpdates
- getExtraUpdates
- getIdentityMap
- getOriginalEntityData
- getOrphanRemoveStack
- getPersistStack
- getRemoveStack
- lock
- merge
- persist
- recomputeSingleChangeSet
- remove
- scheduleExtraUpdate
- scheduleOrphanRemoval
- shouldAutoFlush
- tryGetById
- unsetIdentity
Constructors
constructor
Parameters
Returns UnitOfWork
Methods
cancelOrphanRemoval
Parameters
entity: Partial<any>
optionalvisited: Set<Partial<any>>
Returns void
clear
Returns void
clearActionsQueue
Returns void
commit
Returns Promise<void>
computeChangeSet
Parameters
entity: T
optionaltype: ChangeSetType
Returns void
computeChangeSets
Returns void
getById
Parameters
entityName: string
id: (T extends { [PrimaryKeyProp]?: PK } ? PK extends keyof T<T> ? ReadonlyPrimary<UnwrapPrimary<T<T>[PK<PK>]>> : PK extends keyof T<T>[] ? ReadonlyPrimary<PrimaryPropToType<T<T>, PK<PK>>> : PK : T extends { _id?: PK } ? string | ReadonlyPrimary<PK> : T extends { uuid?: PK } ? ReadonlyPrimary<PK> : T extends { id?: PK } ? ReadonlyPrimary<PK> : T) | (T extends { [PrimaryKeyProp]?: PK } ? PK extends keyof T<T> ? ReadonlyPrimary<UnwrapPrimary<T<T>[PK<PK>]>> : PK extends keyof T<T>[] ? ReadonlyPrimary<PrimaryPropToType<T<T>, PK<PK>>> : PK : T extends { _id?: PK } ? string | ReadonlyPrimary<PK> : T extends { uuid?: PK } ? ReadonlyPrimary<PK> : T extends { id?: PK } ? ReadonlyPrimary<PK> : T)[]
optionalschema: string
Returns undefined | T
getChangeSetPersister
Returns ChangeSetPersister
getChangeSets
Returns ChangeSet<Partial<any>>[]
getCollectionUpdates
Returns Collection<Partial<any>, object>[]
getExtraUpdates
Returns Set<[Partial<any>, string | string[], Reference<any> | Partial<any> | Collection<any, object> | Partial<any>[], undefined | ChangeSet<any>, ChangeSetType]>
getIdentityMap
Returns map of all managed entities.
Returns IdentityMap
getOriginalEntityData
Returns stored snapshot of entity state that is used for change set computation.
Parameters
entity: T
Returns undefined | EntityData<T>
getOrphanRemoveStack
Returns Set<Partial<any>>
getPersistStack
Returns Set<Partial<any>>
getRemoveStack
Returns Set<Partial<any>>
lock
Parameters
entity: T
options: LockOptions
Returns Promise<void>
merge
Parameters
entity: T
optionalvisited: Set<Partial<any>>
Returns void
persist
Parameters
entity: T
optionalvisited: Set<Partial<any>>
options: { cascade?: boolean; checkRemoveStack?: boolean } = {}
optionalcascade: boolean
optionalcheckRemoveStack: boolean
Returns void
recomputeSingleChangeSet
Parameters
entity: T
Returns void
remove
Parameters
entity: T
optionalvisited: Set<Partial<any>>
options: { cascade?: boolean } = {}
optionalcascade: boolean
Returns void
scheduleExtraUpdate
Parameters
changeSet: ChangeSet<T>
props: EntityProperty<T, any>[]
Returns void
scheduleOrphanRemoval
Parameters
optionalentity: Partial<any>
optionalvisited: Set<Partial<any>>
Returns void
shouldAutoFlush
Parameters
meta: EntityMetadata<T>
Returns boolean
tryGetById
Parameters
entityName: string
where: FilterQuery<T>
optionalschema: string
strict: boolean = true
Returns null | T
unsetIdentity
Parameters
entity: Partial<any>
Returns void
Returns entity from the identity map. For composite keys, you need to pass an array of PKs in the same order as they are defined in
meta.primaryKeys
.