Skip to main content
Version: Next

SerializationContext <T>

Helper that allows to keep track of where we are currently at when serializing complex entity graph with cycles. Before we process a property, we call visit that checks if it is not a cycle path (but allows to pass cycles that are defined in populate hint). If not, we proceed and call leave afterwards.

Index

Constructors

constructor

Properties

readonlypath

path: [string, string][] = []

readonlyvisited

visited: Set<Partial<any>> = ...

Methods

close

  • close(): void
  • Returns void

isMarkedAsPopulated

  • isMarkedAsPopulated(entityName: string, prop: string): boolean
  • Parameters

    • entityName: string
    • prop: string

    Returns boolean

isPartiallyLoaded

  • isPartiallyLoaded(entityName: string, prop: string): boolean
  • Parameters

    • entityName: string
    • prop: string

    Returns boolean

leave

  • leave(entityName: string, prop: string): void
  • Parameters

    • entityName: string
    • prop: string

    Returns void

visit

  • visit(entityName: string, prop: string): boolean
  • Returns true when there is a cycle detected.


    Parameters

    • entityName: string
    • prop: string

    Returns boolean

staticpropagate

  • When initializing new context, we need to propagate it to the whole entity graph recursively.


    Parameters

    Returns void