Documentation
    Preparing search index...

    Class BaseObject

    Base generic model class. All Quatrain models inherit from this object. Provides the lifecycle methods and structural properties logic.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _dataObject: DataObjectClass<any>
    COLLECTION: string | undefined

    The backend identifier (table or collection name) representing this class.

    LABEL_KEY: string = 'name'

    Which property's value to use in backend as label for object reference

    PARENT_PROP: string | undefined

    The name of the property handling hierarchical parent relationships.

    PROPS_DEFINITION: any = BaseObjectProperties

    Standard properties inherited by all children models.

    Accessors

    • get _(): any

      Returns any

    • get dataObject(): DataObjectClass<any>

      Returns DataObjectClass<any>

    • get path(): string

      Returns string

    • get uid(): any

      Returns any

    • get uri(): ObjectUri

      Returns ObjectUri

    Methods

    • Serializes the object down to an identifier reference map.

      Returns any

      The Object reference payload.

    • Return property object matching key

      Parameters

      • key: string

        string

      Returns any

    • Checks if a property exists on the data object.

      Parameters

      • key: string

        The property key.

      Returns boolean

      True if the property exists.

    • Proxies a set command to the underlying data object.

      Parameters

      • key: string

        The property key.

      • val: any

        The value to assign.

      Returns any

      The DataObject instance for chaining.

    • Serializes the current object path / identity.

      Returns any

      The JSON serialized ObjectUri.

    • Fetches the value of a property.

      Parameters

      • key: string

        The property key.

      Returns any

      The property value or null if undefined.

    • Validates the object's properties against the model definition. Throws a ValidationError if any mandatory properties are missing or empty.

      Returns void

    • Instantiates the DataObject for a specific model class.

      Parameters

      • src: string | ObjectUri | DataObjectType | undefined = undefined

        Potential source path or object.

      • child: any = ...

        The class constructor context.

      Returns Promise<DataObjectType>

      A promise resolving to the inner DataObject payload.

    • Main initialization factory. Evaluates path or object sources and returns a fully initialized model instance.

      Parameters

      • src: string | ObjectUri | BaseObjectType | undefined = undefined

        Source data payload or path reference.

      • child: any = ...

        Model subclass context.

      Returns Promise<any>

      The generated model instance.

    • Compiles the merged properties of a given child class down to its parents.

      Parameters

      • child: any = ...

        The target child class.

      Returns DataObject

      The resulting populated DataObject.

    • Fetches an object from its backend path

      Type Parameters

      • T

      Parameters

      • path: string

      Returns Promise<T>

    • Instantiates from an object

      Type Parameters

      Parameters

      • src: T
      • child: any = ...

      Returns any

    • Returns the definition of a specific property from the model schema.

      Parameters

      • key: string

        The property name.

      Returns any

      The property definition object.