Skip to main content
Version: Next

WrappedEntity <Entity>

Index

Constructors

constructor

  • new WrappedEntity(entity: Entity, hydrator: IHydrator, pkGetter?: (e: Entity) => Entity extends { [PrimaryKeyProp]?: PK } ? PK extends keyof Entity<Entity> ? ReadonlyPrimary<UnwrapPrimary<Entity<Entity>[PK<PK>]>> : PK extends keyof Entity<Entity>[] ? ReadonlyPrimary<PrimaryPropToType<Entity<Entity>, PK<PK>>> : PK : Entity extends { _id?: PK } ? string | ReadonlyPrimary<PK> : Entity extends { uuid?: PK } ? ReadonlyPrimary<PK> : Entity extends { id?: PK } ? ReadonlyPrimary<PK> : Entity, pkSerializer?: (e: Entity) => string, pkGetterConverted?: (e: Entity) => Entity extends { [PrimaryKeyProp]?: PK } ? PK extends keyof Entity<Entity> ? ReadonlyPrimary<UnwrapPrimary<Entity<Entity>[PK<PK>]>> : PK extends keyof Entity<Entity>[] ? ReadonlyPrimary<PrimaryPropToType<Entity<Entity>, PK<PK>>> : PK : Entity extends { _id?: PK } ? string | ReadonlyPrimary<PK> : Entity extends { uuid?: PK } ? ReadonlyPrimary<PK> : Entity extends { id?: PK } ? ReadonlyPrimary<PK> : Entity): WrappedEntity<Entity>
  • Parameters

    • entity: Entity
    • hydrator: IHydrator
    • optionalpkGetter: (e: Entity) => Entity extends { [PrimaryKeyProp]?: PK } ? PK extends keyof Entity<Entity> ? ReadonlyPrimary<UnwrapPrimary<Entity<Entity>[PK<PK>]>> : PK extends keyof Entity<Entity>[] ? ReadonlyPrimary<PrimaryPropToType<Entity<Entity>, PK<PK>>> : PK : Entity extends { _id?: PK } ? string | ReadonlyPrimary<PK> : Entity extends { uuid?: PK } ? ReadonlyPrimary<PK> : Entity extends { id?: PK } ? ReadonlyPrimary<PK> : Entity
      • optionalpkSerializer: (e: Entity) => string
        • optionalpkGetterConverted: (e: Entity) => Entity extends { [PrimaryKeyProp]?: PK } ? PK extends keyof Entity<Entity> ? ReadonlyPrimary<UnwrapPrimary<Entity<Entity>[PK<PK>]>> : PK extends keyof Entity<Entity>[] ? ReadonlyPrimary<PrimaryPropToType<Entity<Entity>, PK<PK>>> : PK : Entity extends { _id?: PK } ? string | ReadonlyPrimary<PK> : Entity extends { uuid?: PK } ? ReadonlyPrimary<PK> : Entity extends { id?: PK } ? ReadonlyPrimary<PK> : Entity

          Returns WrappedEntity<Entity>

        Properties

        __data

        __data: Dictionary

        optional__em

        optional__identifier

        __identifier?: EntityIdentifier

        holds wrapped primary key, so we can compute change set without eager commit

        __initialized

        __initialized: boolean

        __loadedProperties

        __loadedProperties: Set<string>

        optional__managed

        __managed?: boolean

        optional__onLoadFired

        __onLoadFired?: boolean

        optional__originalEntityData

        __originalEntityData?: EntityData<Entity>

        holds last entity data snapshot, so we can compute changes when persisting managed entities

        optional__pk

        __pk?: Entity extends { [PrimaryKeyProp]?: PK } ? PK extends keyof Entity<Entity> ? ReadonlyPrimary<UnwrapPrimary<Entity<Entity>[PK<PK>]>> : PK extends keyof Entity<Entity>[] ? ReadonlyPrimary<PrimaryPropToType<Entity<Entity>, PK<PK>>> : PK : Entity extends { _id?: PK } ? string | ReadonlyPrimary<PK> : Entity extends { uuid?: PK } ? ReadonlyPrimary<PK> : Entity extends { id?: PK } ? ReadonlyPrimary<PK> : Entity

        stores last known primary key, as its current state might be broken due to propagation/orphan removal, but we need to know the PK to be able t remove the entity

        optional__populated

        __populated?: boolean

        __processing

        __processing: boolean

        optional__reference

        __reference?: Reference<Entity>

        holds the reference wrapper instance (if created), so we can maintain the identity on reference wrappers too

        optional__schema

        __schema?: string

        __serializationContext

        __serializationContext: { exclude?: readonly string[]; fields?: Set<string>; populate?: PopulateOptions<Entity>[]; root?: SerializationContext<Entity> }

        Type declaration

        __touched

        __touched: boolean

        Accessors

        __config

        __meta

        __platform

        __primaryKeys

        • get __primaryKeys(): (Entity extends { [PrimaryKeyProp]?: PK } ? PK extends keyof Entity<Entity> ? ReadonlyPrimary<UnwrapPrimary<Entity<Entity>[PK<PK>]>> : PK extends keyof Entity<Entity>[] ? ReadonlyPrimary<PrimaryPropToType<Entity<Entity>, PK<PK>>> : PK : Entity extends { _id?: PK } ? string | ReadonlyPrimary<PK> : Entity extends { uuid?: PK } ? ReadonlyPrimary<PK> : Entity extends { id?: PK } ? ReadonlyPrimary<PK> : Entity)[]
        • Returns (Entity extends { [PrimaryKeyProp]?: PK } ? PK extends keyof Entity<Entity> ? ReadonlyPrimary<UnwrapPrimary<Entity<Entity>[PK<PK>]>> : PK extends keyof Entity<Entity>[] ? ReadonlyPrimary<PrimaryPropToType<Entity<Entity>, PK<PK>>> : PK : Entity extends { _id?: PK } ? string | ReadonlyPrimary<PK> : Entity extends { uuid?: PK } ? ReadonlyPrimary<PK> : Entity extends { id?: PK } ? ReadonlyPrimary<PK> : Entity)[]

        Methods

        assign

        getPrimaryKey

        • getPrimaryKey(convertCustomTypes?: boolean): null | (Entity extends { [PrimaryKeyProp]?: PK } ? PK extends keyof Entity<Entity> ? ReadonlyPrimary<UnwrapPrimary<Entity<Entity>[PK<PK>]>> : PK extends keyof Entity<Entity>[] ? ReadonlyPrimary<PrimaryPropToType<Entity<Entity>, PK<PK>>> : PK : Entity extends { _id?: PK } ? string | ReadonlyPrimary<PK> : Entity extends { uuid?: PK } ? ReadonlyPrimary<PK> : Entity extends { id?: PK } ? ReadonlyPrimary<PK> : Entity)
        • Parameters

          • convertCustomTypes: boolean = false

          Returns null | (Entity extends { [PrimaryKeyProp]?: PK } ? PK extends keyof Entity<Entity> ? ReadonlyPrimary<UnwrapPrimary<Entity<Entity>[PK<PK>]>> : PK extends keyof Entity<Entity>[] ? ReadonlyPrimary<PrimaryPropToType<Entity<Entity>, PK<PK>>> : PK : Entity extends { _id?: PK } ? string | ReadonlyPrimary<PK> : Entity extends { uuid?: PK } ? ReadonlyPrimary<PK> : Entity extends { id?: PK } ? ReadonlyPrimary<PK> : Entity)

        getPrimaryKeys

        • getPrimaryKeys(convertCustomTypes?: boolean): null | (Entity extends { [PrimaryKeyProp]?: PK } ? PK extends keyof Entity<Entity> ? ReadonlyPrimary<UnwrapPrimary<Entity<Entity>[PK<PK>]>> : PK extends keyof Entity<Entity>[] ? ReadonlyPrimary<PrimaryPropToType<Entity<Entity>, PK<PK>>> : PK : Entity extends { _id?: PK } ? string | ReadonlyPrimary<PK> : Entity extends { uuid?: PK } ? ReadonlyPrimary<PK> : Entity extends { id?: PK } ? ReadonlyPrimary<PK> : Entity)[]
        • Parameters

          • convertCustomTypes: boolean = false

          Returns null | (Entity extends { [PrimaryKeyProp]?: PK } ? PK extends keyof Entity<Entity> ? ReadonlyPrimary<UnwrapPrimary<Entity<Entity>[PK<PK>]>> : PK extends keyof Entity<Entity>[] ? ReadonlyPrimary<PrimaryPropToType<Entity<Entity>, PK<PK>>> : PK : Entity extends { _id?: PK } ? string | ReadonlyPrimary<PK> : Entity extends { uuid?: PK } ? ReadonlyPrimary<PK> : Entity extends { id?: PK } ? ReadonlyPrimary<PK> : Entity)[]

        getSchema

        • getSchema(): undefined | string
        • Returns undefined | string

        getSerializedPrimaryKey

        • getSerializedPrimaryKey(): string
        • Returns string

        hasPrimaryKey

        • hasPrimaryKey(): boolean
        • Returns boolean

        init

        • init(options?: FindOneOptions<Entity, Hint, Fields, Excludes>): Promise<null | Loaded<Entity, Hint, Fields, Excludes>>
        • Parameters

          Returns Promise<null | Loaded<Entity, Hint, Fields, Excludes>>

        isInitialized

        • isInitialized(): boolean
        • Returns boolean

        isManaged

        • isManaged(): boolean
        • Returns boolean

        isTouched

        • isTouched(): boolean
        • Returns boolean

        populate

        populated

        • populated(populated?: undefined | boolean): void
        • Parameters

          • populated: undefined | boolean = true

          Returns void

        serialize

        setPrimaryKey

        • setPrimaryKey(id: null | (Entity extends { [PrimaryKeyProp]?: PK } ? PK extends keyof Entity<Entity> ? ReadonlyPrimary<UnwrapPrimary<Entity<Entity>[PK<PK>]>> : PK extends keyof Entity<Entity>[] ? ReadonlyPrimary<PrimaryPropToType<Entity<Entity>, PK<PK>>> : PK : Entity extends { _id?: PK } ? string | ReadonlyPrimary<PK> : Entity extends { uuid?: PK } ? ReadonlyPrimary<PK> : Entity extends { id?: PK } ? ReadonlyPrimary<PK> : Entity)): void
        • Parameters

          • id: null | (Entity extends { [PrimaryKeyProp]?: PK } ? PK extends keyof Entity<Entity> ? ReadonlyPrimary<UnwrapPrimary<Entity<Entity>[PK<PK>]>> : PK extends keyof Entity<Entity>[] ? ReadonlyPrimary<PrimaryPropToType<Entity<Entity>, PK<PK>>> : PK : Entity extends { _id?: PK } ? string | ReadonlyPrimary<PK> : Entity extends { uuid?: PK } ? ReadonlyPrimary<PK> : Entity extends { id?: PK } ? ReadonlyPrimary<PK> : Entity)

          Returns void

        setSchema

        • setSchema(schema?: string): void
        • Parameters

          • optionalschema: string

          Returns void

        setSerializationContext

        • setSerializationContext(options: LoadHint<Entity, Hint, Fields, Exclude>): void
        • Parameters

          • options: LoadHint<Entity, Hint, Fields, Exclude>

          Returns void

        toJSON

        toObject

        • toObject(ignoreFields?: Ignored[]): Omit<EntityDTO<Entity>, Ignored>
        • Parameters

          • optionalignoreFields: Ignored[]

          Returns Omit<EntityDTO<Entity>, Ignored>

        toPOJO

        toReference