SerializationContext <T>
Index
Constructors
Properties
Methods
Constructors
constructor
Parameters
populate: PopulateOptions<T>[] = []
optionalfields: Set<string>
optionalexclude: readonly string[]
Returns SerializationContext<T>
Properties
readonlypath
readonlyvisited
Methods
close
Cleans up the serialization context by removing root references from all tracked entities.
Returns void
isExcluded
Checks whether a property is excluded from serialization via the exclude list.
Parameters
entityName: EntityName
prop: string
Returns boolean
isMarkedAsPopulated
Checks whether a property is explicitly listed in the populate hints for the current path.
Parameters
entityName: EntityName
prop: string
Returns boolean
isPartiallyLoaded
Checks whether a property is included in the partial fields selection for the current path.
Parameters
entityName: EntityName
prop: string
Returns boolean
leave
Removes the last entry from the visit path after processing a property.
Parameters
entityName: EntityName
prop: string
Returns void
visit
Returns true when there is a cycle detected.
Parameters
entityName: EntityName
prop: string
Returns boolean
staticpropagate
Propagates the context to the entity and its direct relations, so nested serialization calls pick it up. Runs for every serialized entity, so the context spreads along the serialized path instead of the whole graph.
Parameters
root: SerializationContext<any>
entity: Partial<any>
isVisible: (meta, prop) => boolean
Returns void
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
visitthat checks if it is not a cycle path (but allows to pass cycles that are defined in populate hint). If not, we proceed and callleaveafterwards.