Class representing a Collection Entity Adapter.

Type Parameters

Implements

Constructors

Properties

Accessors

Constructors

Properties

id: string | number

An identifier representing the unique identity of an entity.

refresh: () => Promise<void>

Refreshes the entity asynchronously.

Type declaration

    • (): Promise<void>
    • Returns Promise<void>

      A Promise that resolves once the entity is refreshed.

If an error occurs while refreshing the entity.

setData: (data: Partial<T> | (prevData: T) => Partial<T>) => Promise<void>

Sets the data for the entity.

Type declaration

    • (data: Partial<T> | (prevData: T) => Partial<T>): Promise<void>
    • Parameters

      • data: Partial<T> | (prevData: T) => Partial<T>

        The data to set. It can be either a partial object of type T or a function that takes the previous data of type T and returns a partial object of type T.

      Returns Promise<void>

      • A promise that resolves when the data is set.
  • If the entity (with the given ID) is not found in the collection.
toEntity: () => Entity<T>

Retrieves the entity with the specified ID from the current collection.

Type declaration

If the entity is not found in the collection.

toObject: () => T

Converts the current object to a plain JavaScript object.

Type declaration

    • (): T
    • Returns T

      A plain JavaScript object representing the current entity.

[variable name]

If the entity is not found in the collection.

Accessors