Skip to content
Developer Preview

ItemStore

Items in first-opened order, each held at its latest revision, with per-field delta accumulators.

Property Type Stability Presence Description
ephemeralSessionDiscarded boolean required
size number required
Method Signature Stability Description
constructor new ItemStore()
accumulated accumulated(itemId: string, field?: string): string | undefined The accumulated delta text for a field path, or undefined if none.
accumulatedFields accumulatedFields(itemId: string): readonly string[] Every field path that has accumulated deltas for this item.
apply apply(item: T): ItemApplyOutcome Apply an item/started | item/updated | item/completed payload. Replace iff the incoming revision is strictly higher.
applyDelta applyDelta(itemId: string, delta: string, field?: string): DeltaApplyOutcome Apply an item/delta: a UTF-8-safe append to the open item’s field named by field (default "text"), contiguous and lossless in cursor order. The concatenation of all deltas for a field path equals that field’s value on the final item/completed object.
get get(itemId: string): T | undefined
has has(itemId: string): boolean
isTerminalUnknown isTerminalUnknown(itemId: string): boolean
lastOpenedItemId lastOpenedItemId(): string | undefined The id of the most recently opened item, or undefined when empty.
list list(): readonly T[] Items in first-opened order.
markEphemeralHostDeath markEphemeralHostDeath(isInProgress: (item: T) => boolean): readonly TerminalUnknownItemAnnotation[] Permanently discard an ephemeral session after abnormal host death.
seed seed(items: Iterable<T>): void Seed from a snapshot’s state.items: every item at its latest revision at the snapshot cursor, in first-opened order. Seeding REPLACES the store — a snapshot is authoritative, never merged into stale local state.
Source

clients/sdk-ts/src/fold/item-store.ts:51

{
"kind": "Class",
"canonicalPath": "ItemStore"
}