Skip to main content
Defined in: store/NamespacedStore.ts:39 Isolates every opaque store key by tenant/bot/provider connection while preserving the public, unprefixed ids seen by callers.

Implements

Constructors

Constructor

Defined in: store/NamespacedStore.ts:58

Parameters

Returns

NamespacedStore

Properties

getUserData?

Defined in: store/NamespacedStore.ts:47 Read one entry. MUST return undefined when the entry is missing OR its expiresAt is <= Date.now() (lazy expiry — expired rows may still exist physically until purged).

Parameters

Returns

Promise<UserDataEntry | undefined>

Implementation of

IStore.getUserData

setUserData?

Defined in: store/NamespacedStore.ts:48 Upsert one entry as a SINGLE atomic write that replaces both value and expiresAt (no read-modify-write inside the store). An entry whose expiresAt is already in the past may be dropped instead of written.

Parameters

Returns

Promise<void>

Implementation of

IStore.setUserData

deleteUserData?

Defined in: store/NamespacedStore.ts:49 Delete one key (namespace + key), one whole namespace (key omitted) or every namespace of the user (namespace omitted; key is then ignored). Deleting missing data is a no-op.

Parameters

Returns

Promise<void>

Implementation of

IStore.deleteUserData

listUserData?

Defined in: store/NamespacedStore.ts:50 Live (non-expired) entries of a user — all namespaces, or just namespace. Order unspecified.

Parameters

Returns

Promise<UserDataEntry[]>

Implementation of

IStore.listUserData

purgeExpiredUserData?

Defined in: store/NamespacedStore.ts:51 Physically remove entries whose expiresAt <= now (default Date.now()) across the whole store; resolves with how many were removed. Stores with native expiry (Redis) resolve 0.

Parameters

Returns

Promise<number>

Implementation of

IStore.purgeExpiredUserData

setCheckpointIf?

Defined in: store/NamespacedStore.ts:55 Compare-and-set checkpoint write (multi-replica coordination). Succeeds (resolves true) only when the stored row’s FlowCheckpoint.revision equals expectedRevision, where 0 means “no row, or a row without revision”; otherwise the row is left untouched and it resolves false. ONE atomic statement per store (never a read-modify-write), so two replicas racing on one key see exactly one winner. expectedRevision is a non-negative integer (RangeError otherwise). Optional: a store without it keeps the local-fence behaviour; all six built-in stores implement it and pass the shared conformance block (test-utils/store-conformance.ts).

Parameters

Returns

Promise<boolean>

Implementation of

IStore.setCheckpointIf

clearCheckpointIf?

Defined in: store/NamespacedStore.ts:56 Conditional delete: true when the row is absent, or its revision (0 without one) matched expectedRevision and it was deleted; false when a different revision is stored (the row is left untouched). Same atomicity rule as setCheckpointIf.

Parameters

Returns

Promise<boolean>

Implementation of

IStore.clearCheckpointIf

innerStore

Defined in: store/NamespacedStore.ts:59

namespace

Defined in: store/NamespacedStore.ts:60

Methods

saveMessage()

Defined in: store/NamespacedStore.ts:148

Parameters

Returns

Promise<void>

Implementation of

IStore.saveMessage

getMessage()

Defined in: store/NamespacedStore.ts:151

Parameters

Returns

Promise<StoredMessage | undefined>

Implementation of

IStore.getMessage

getMessagesByChat()

Defined in: store/NamespacedStore.ts:154

Parameters

Returns

Promise<StoredMessage[]>

Implementation of

IStore.getMessagesByChat

deleteMessage()

Defined in: store/NamespacedStore.ts:158

Parameters

Returns

Promise<void>

Implementation of

IStore.deleteMessage

upsertChat()

Defined in: store/NamespacedStore.ts:162 Shallow-merge chat onto the stored record. An own field set to undefined UNSETS that field, so a partial upsert must omit what it does not know (the Bot does).

Parameters

Returns

Promise<void>

Implementation of

IStore.upsertChat

getChat()

Defined in: store/NamespacedStore.ts:165

Parameters

Returns

Promise<StoredChat | undefined>

Implementation of

IStore.getChat

listChats()

Defined in: store/NamespacedStore.ts:169

Returns

Promise<StoredChat[]>

Implementation of

IStore.listChats

deleteChat()

Defined in: store/NamespacedStore.ts:174

Parameters

Returns

Promise<void>

Implementation of

IStore.deleteChat

upsertContact()

Defined in: store/NamespacedStore.ts:178 Shallow-merge contact onto the stored record; same undefined = unset rule as upsertChat.

Parameters

Returns

Promise<void>

Implementation of

IStore.upsertContact

getContact()

Defined in: store/NamespacedStore.ts:181

Parameters

Returns

Promise<StoredContact | undefined>

Implementation of

IStore.getContact

listContacts()

Defined in: store/NamespacedStore.ts:185

Returns

Promise<StoredContact[]>

Implementation of

IStore.listContacts

deleteContact()

Defined in: store/NamespacedStore.ts:190

Parameters

Returns

Promise<void>

Implementation of

IStore.deleteContact

getCursor()

Defined in: store/NamespacedStore.ts:194 Delivery cursor for long-poll/webhook transports (Telegram update_id).

Parameters

Returns

Promise<string | undefined>

Implementation of

IStore.getCursor

setCursor()

Defined in: store/NamespacedStore.ts:197

Parameters

Returns

Promise<void>

Implementation of

IStore.setCursor

getConversation()

Defined in: store/NamespacedStore.ts:201

Parameters

Returns

Promise<AIMessage[] | undefined>

Implementation of

IStore.getConversation

setConversation()

Defined in: store/NamespacedStore.ts:204

Parameters

Returns

Promise<void>

Implementation of

IStore.setConversation

clearConversation()

Defined in: store/NamespacedStore.ts:207

Parameters

Returns

Promise<void>

Implementation of

IStore.clearConversation

getCheckpoint()

Defined in: store/NamespacedStore.ts:211

Parameters

Returns

Promise<FlowCheckpoint | undefined>

Implementation of

IStore.getCheckpoint

setCheckpoint()

Defined in: store/NamespacedStore.ts:214

Parameters

Returns

Promise<void>

Implementation of

IStore.setCheckpoint

clearCheckpoint()

Defined in: store/NamespacedStore.ts:217

Parameters

Returns

Promise<void>

Implementation of

IStore.clearCheckpoint

listCheckpoints()

Defined in: store/NamespacedStore.ts:220

Returns

Promise<[string, FlowCheckpoint][]>

Implementation of

IStore.listCheckpoints

start()

Defined in: store/NamespacedStore.ts:227

Returns

Promise<void>

Implementation of

IStore.start

stop()

Defined in: store/NamespacedStore.ts:228

Returns

Promise<void>

Implementation of

IStore.stop