diff --git a/packages/sds/src/message_channel/mem_local_history.ts b/packages/sds/src/message_channel/mem_local_history.ts index 8f715a89e0..4042ee69c4 100644 --- a/packages/sds/src/message_channel/mem_local_history.ts +++ b/packages/sds/src/message_channel/mem_local_history.ts @@ -48,6 +48,11 @@ export interface ILocalHistory { ): number; } +export interface MemLocalHistoryOptions { + storage?: ChannelId | PersistentStorage; + maxSize?: number; +} + export class MemLocalHistory implements ILocalHistory { private items: ContentMessage[] = []; private readonly storage?: PersistentStorage; @@ -60,9 +65,7 @@ export class MemLocalHistory implements ILocalHistory { * - storage: Optional persistent storage backend for message persistence or channelId to use with PersistentStorage. * - maxSize: The maximum number of messages to store. Optional, defaults to DEFAULT_MAX_LENGTH. */ - public constructor( - opts: { storage?: ChannelId | PersistentStorage; maxSize?: number } = {} - ) { + public constructor(opts: MemLocalHistoryOptions = {}) { const { storage, maxSize } = opts; this.maxSize = maxSize ?? DEFAULT_MAX_LENGTH; if (storage instanceof PersistentStorage) { diff --git a/packages/sds/src/message_channel/message_channel.spec.ts b/packages/sds/src/message_channel/message_channel.spec.ts index f66330c478..ed66f10abf 100644 --- a/packages/sds/src/message_channel/message_channel.spec.ts +++ b/packages/sds/src/message_channel/message_channel.spec.ts @@ -15,7 +15,8 @@ import { } from "./message.js"; import { DEFAULT_BLOOM_FILTER_OPTIONS, - MessageChannel + MessageChannel, + MessageChannelOptions } from "./message_channel.js"; const channelId = "test-channel"; @@ -30,12 +31,7 @@ const callback = (_message: Message): Promise<{ success: boolean }> => { const createTestChannel = ( channelId: string, senderId: string, - options: { - causalHistorySize?: number; - possibleAcksThreshold?: number; - timeoutForLostMessagesMs?: number; - enableRepair?: boolean; - } = {} + options: MessageChannelOptions = {} ): MessageChannel => { return new MessageChannel( channelId,