refactor: rename storageKey to storageKeyPrefix and update storage key generation.

This commit is contained in:
Danish Arora 2025-11-20 16:12:39 -05:00
parent ca24c09688
commit 032c3f5faf
No known key found for this signature in database
GPG Key ID: 1C6EF37CDAE1426E

View File

@ -12,7 +12,7 @@ export interface HistoryStorage {
export interface PersistentHistoryOptions {
channelId: ChannelId;
storage?: HistoryStorage;
storageKey?: string;
storageKeyPrefix?: string;
}
type StoredHistoryEntry = {
@ -46,8 +46,7 @@ export class PersistentHistory implements ILocalHistory {
public constructor(options: PersistentHistoryOptions) {
this.memory = new MemLocalHistory();
this.storage = options.storage ?? getDefaultHistoryStorage();
this.storageKey =
options.storageKey ?? `${HISTORY_STORAGE_PREFIX}${options.channelId}`;
this.storageKey = `${HISTORY_STORAGE_PREFIX}${options.storageKeyPrefix}:${options.channelId}`;
this.restore();
}