Documentation
    Preparing search index...

    Class PersistedDataObject

    Data objects constitute the agnostic glue between objects and backends. They handle data and identifiers in a protected registry. This is what backends and objects manipulate, oblivious of the other. It manages the actual "dirty" state, paths, and values mapped from the database.

    Hierarchy (View Summary)

    Implements

    • Persisted
    Index

    Constructors

    Properties

    _modified: boolean = false

    Has data been modified since last backend operation?

    _objectUri: ObjectUri
    _parentProp: string | undefined
    _persisted: boolean = false
    _populated: boolean = false
    _properties: Properties = {}
    _proxied: any
    _uid: string | undefined = undefined

    Accessors

    • get backend(): string | undefined

      Retrieves the specific backend alias bound to this object's URI.

      Returns string | undefined

      The string alias of the backend adapter (e.g., 'default', 'firestore').

    • get class(): any

      Returns any

    • get data(): any

      Returns any

    • get parentProp(): string | undefined

      Returns string | undefined

    • set parentProp(str: string | undefined): void

      Parameters

      • str: string | undefined

      Returns void

    • get path(): string

      Returns string

    • get properties(): Properties

      Returns Properties

    • get uid(): string | undefined

      Returns string | undefined

    • set uid(uid: string | undefined): void

      Parameters

      • uid: string | undefined

      Returns void

    • get uri(): ObjectUri

      Returns ObjectUri

    • set uri(uri: ObjectUri): void

      Parameters

      Returns void

    Methods

    • Parameters

      • objectsAsReferences: boolean = false
      • ignoreUnchanged: boolean = false
      • ignoreNulls: boolean = false
      • converters: {} = {}

      Returns {}

    • Parameters

      • properties: any[]

      Returns void

    • Appends a new property definition instance to the registry dynamically.

      Parameters

      • property: PropertyClassType

        The instantiated Property element.

      Returns void

    • Returns a completely duplicated payload and registry.

      Parameters

      • data: any = {}

        Optional data overrides.

      Returns Promise<DataObject>

      The cloned DataObject.

    • Requests the backend adapter to delete the object from persistence. The 'hardDelete' behavior is usually controlled by the parent PersistedBaseObject.

      Returns Promise<DataObjectClass<any>>

      A promise resolving upon successful deletion.

    • Returns property matching key or throw

      Parameters

      • key: string

        string

      Returns PropertyClassType

      BaseProperty

    • Return a map of all propoerties or only those matching the provided type

      Parameters

      • Optionaltype: string

      Returns {}

    • Checks whether a specific property exists in the data object's definition.

      Parameters

      • key: string

        The property name to verify.

      Returns boolean

      True if the property is defined, false otherwise.

    • Checks or updates the persisted state of the DataObject.

      Parameters

      • set: boolean = false

        If true, flags the object as fully saved and resets property modification trackers.

      Returns boolean

      True if the object was explicitly persisted.

    • State check indicating if the object is fully populated.

      Returns boolean

      true if populated.

    • Populates the internal properties with given data or triggers a backend fetch if the object possesses a path but hasn't been loaded yet.

      Parameters

      • data: { name: string; [x: string]: unknown } | undefined = undefined

        Optional predefined data dictionary to hydrate immediately.

      Returns Promise<PersistedDataObject>

      A promise resolving to the hydrated data object.

    • Forces a read operation from the configured backend adapter using the current URI path, populating internal properties with the retrieved database values.

      Returns Promise<PersistedDataObject>

      A promise resolving to the populated data object.

    • Populate data object from instant data or backend query

      Parameters

      • data: { [x: string]: unknown }

      Returns this

    • Instructs the global backend adapter to read and return the raw data object state.

      Returns Promise<DataObjectClass<any>>

      A promise resolving to the fetched DataObjectClass.

      If the read operation fails at the adapter level.

    • Pushes the current object state to the backend adapter. Determines automatically whether an 'update' or 'create' operation is needed based on the UID.

      Returns Promise<DataObjectClass<any>>

      A promise resolving to the updated DataObjectClass.

    • Modifies a property value directly.

      Parameters

      • key: string

        The property name.

      • val: any

        The desired value.

      Returns PersistedDataObject

      The updated DataObject for chaining.

    • Forces a completely new set of properties into the registry.

      Parameters

      • properties: Properties

        The dictionary of PropertyClassType entities.

      Returns void

    • Serializes the data object using advanced configuration params.

      Parameters

      • params: boolean | toJSONParams = false

        Serialization settings (e.g. resolve references, remove nulls).

      Returns { [x: string]: any }

      The raw serialized dictionary.

    • Flattens the object to a standard ObjectUri wrapper reference format.

      Returns { label: any; ref: string; uri: string }

      Reference object format.

    • Get value of given property

      Parameters

      • key: string

        string

      • transform: string | undefined = undefined

      Returns any

      any