Share via


TurnStateEntry class

Represents an entry in the turn state that can be tracked for changes and stored.

Constructors

TurnStateEntry(Record<string, unknown>, string)

Creates a new instance of TurnStateEntry.

Properties

hasChanged

Gets whether the entry value has changed since its creation or last update.

isDeleted

Gets whether the entry has been marked for deletion.

storageKey

Gets the storage key associated with this entry.

value

Gets the current value of the entry. If the entry was marked for deletion, it will be reset to an empty object and marked as not deleted.

Methods

delete()

Marks the entry for deletion.

replace(Record<string, unknown>)

Replaces the current value with a new value.

Constructor Details

TurnStateEntry(Record<string, unknown>, string)

Creates a new instance of TurnStateEntry.

new TurnStateEntry(value?: Record<string, unknown>, storageKey?: string)

Parameters

value

Record<string, unknown>

The initial value for the entry.

storageKey

string

Optional storage key used to persist the entry.

Property Details

hasChanged

Gets whether the entry value has changed since its creation or last update.

boolean hasChanged

Property Value

boolean

True if the value has changed, otherwise false.

isDeleted

Gets whether the entry has been marked for deletion.

boolean isDeleted

Property Value

boolean

True if the entry is marked for deletion, otherwise false.

storageKey

Gets the storage key associated with this entry.

undefined | string storageKey

Property Value

undefined | string

The storage key, or undefined if no storage key was specified.

value

Gets the current value of the entry. If the entry was marked for deletion, it will be reset to an empty object and marked as not deleted.

Record<string, unknown> value

Property Value

Record<string, unknown>

The current value of the entry.

Method Details

delete()

Marks the entry for deletion.

function delete()

replace(Record<string, unknown>)

Replaces the current value with a new value.

function replace(value?: Record<string, unknown>)

Parameters

value

Record<string, unknown>

The new value to set. If undefined, an empty object will be used.