routier-collection


routier-collection / core/src / PropertyInfo

Class: PropertyInfo<T>

Defined in: core/src/schema/PropertyInfo.ts:8

Represents metadata and utilities for a property in a schema, including its type, name, parent, children, and serialization details.

Type Parameters

T

T extends object

Constructors

Constructor

new PropertyInfo<T>(schema, name, parent?): PropertyInfo<T>

Defined in: core/src/schema/PropertyInfo.ts:72

Parameters

schema

SchemaBase<T, any>

name

string

parent?

PropertyInfo<T>

Returns

PropertyInfo<T>

Properties

name

readonly name: string

Defined in: core/src/schema/PropertyInfo.ts:19

The name of the property.


from

readonly from: string = null

Defined in: core/src/schema/PropertyInfo.ts:21

The name of the property we need to map from.


type

readonly type: SchemaTypes

Defined in: core/src/schema/PropertyInfo.ts:23

The schema type of the property.


isNullable

readonly isNullable: boolean

Defined in: core/src/schema/PropertyInfo.ts:26

Whether the property can be null.


isOptional

readonly isOptional: boolean

Defined in: core/src/schema/PropertyInfo.ts:28

Whether the property is optional.


isKey

readonly isKey: boolean

Defined in: core/src/schema/PropertyInfo.ts:30

Whether the property is a key.


isIdentity

readonly isIdentity: boolean

Defined in: core/src/schema/PropertyInfo.ts:32

Whether the property is an identity property.


isReadonly

readonly isReadonly: boolean

Defined in: core/src/schema/PropertyInfo.ts:34

Whether the property is readonly.


isUnmapped

readonly isUnmapped: boolean

Defined in: core/src/schema/PropertyInfo.ts:36

Whether the property is unmapped.


isDistinct

readonly isDistinct: boolean

Defined in: core/src/schema/PropertyInfo.ts:38

Whether the property is distinct.


indexes

readonly indexes: string[]

Defined in: core/src/schema/PropertyInfo.ts:40

Indexes associated with the property.


injected

readonly injected: any = null

Defined in: core/src/schema/PropertyInfo.ts:43

Any injected value for the property.


defaultValue

readonly defaultValue: any = null

Defined in: core/src/schema/PropertyInfo.ts:45

The default value for the property, if any.


valueSerializer

readonly valueSerializer: PropertySerializer<T> = null

Defined in: core/src/schema/PropertyInfo.ts:47

Serializer for the property value, if any.


valueDeserializer

readonly valueDeserializer: PropertyDeserializer<T> = null

Defined in: core/src/schema/PropertyInfo.ts:49

Deserializer for the property value, if any.


functionBody

readonly functionBody: FunctionBody<any, T>

Defined in: core/src/schema/PropertyInfo.ts:51

Function body for computed properties, if any.


children

readonly children: PropertyInfo<T>[] = []

Defined in: core/src/schema/PropertyInfo.ts:53

Child properties of this property.


schema

readonly schema: SchemaBase<T, any>

Defined in: core/src/schema/PropertyInfo.ts:55

The schema this property belongs to.


innerSchema?

readonly optional innerSchema: SchemaBase<unknown, any>

Defined in: core/src/schema/PropertyInfo.ts:57

The inner schema if this property is an array.


literals

readonly literals: T[]

Defined in: core/src/schema/PropertyInfo.ts:59

Literal values allowed for this property.


parent?

readonly optional parent: PropertyInfo<T>

Defined in: core/src/schema/PropertyInfo.ts:62

The parent property, if any.

Accessors

id

Get Signature

get id(): string

Defined in: core/src/schema/PropertyInfo.ts:10

Returns

string


level

Get Signature

get level(): number

Defined in: core/src/schema/PropertyInfo.ts:109

Returns the depth (level) of this property in the property tree.

The root property has a level of 0. Each child property increases the level by 1. Traverses up the parent chain, incrementing the level for each parent until the root is reached.

Returns

number

The number of parent properties above this property (0 for root).


hasNullableParents

Get Signature

get hasNullableParents(): boolean

Defined in: core/src/schema/PropertyInfo.ts:221

Returns true if any parent property is nullable or optional.

Returns

boolean

True if any parent is nullable or optional, false otherwise.


hasIdentityChildren

Get Signature

get hasIdentityChildren(): boolean

Defined in: core/src/schema/PropertyInfo.ts:244

Returns true if any child property (recursively) is an identity property.

Returns

boolean

True if any child is an identity property, false otherwise.

Methods

getPathArray()

getPathArray(): string[]

Defined in: core/src/schema/PropertyInfo.ts:178

Returns an array of property names representing the path from the root to this property.

Returns

string[]

The property path as an array of names.


getParentPathArray()

getParentPathArray(): string[]

Defined in: core/src/schema/PropertyInfo.ts:199

Returns an array of property names representing the path from the root to the parent of this property.

Returns

string[]

The property path as an array of names, excluding this property.


getValue()

getValue(instance): any

Defined in: core/src/schema/PropertyInfo.ts:264

Gets the value of this property from the given instance, following the property path.

Parameters

instance

unknown

The object instance to retrieve the value from.

Returns

any

The value of the property, or null if not found.


setValue()

setValue(instance, value): void

Defined in: core/src/schema/PropertyInfo.ts:285

Sets the value of this property on the given instance, creating intermediate objects as needed.

Parameters

instance

unknown

The object instance to set the value on.

value

unknown

The value to set.

Returns

void


getSelectrorPath()

getSelectrorPath(options): string

Defined in: core/src/schema/PropertyInfo.ts:320

Returns a selector path string for this property, starting from the given parent variable name.

Parameters

options
parent

string

The root variable name.

assignmentType?

AssignmentType

Optional assignment type for path resolution.

useFromPropertyName?

boolean

Returns

string

The selector path string (e.g., ‘parent.prop1.prop2’).


getAssignmentPath()

getAssignmentPath(options?): string

Defined in: core/src/schema/PropertyInfo.ts:335

Returns an assignment path string for this property, optionally starting from a parent variable name.

Parameters

options?
parent?

string

Optional root variable name.

useFromPropertyName?

boolean

Returns

string

The assignment path string (e.g., ‘prop1.prop2’).


deserialize()

deserialize(value): string | number | boolean | Date | T

Defined in: core/src/schema/PropertyInfo.ts:349

Parameters

value
string number

Returns

string | number | boolean | Date | T