diff --git a/src/Store/make-in-memory-store.ts b/src/Store/make-in-memory-store.ts index 99d50af..2d11637 100644 --- a/src/Store/make-in-memory-store.ts +++ b/src/Store/make-in-memory-store.ts @@ -29,7 +29,7 @@ export const waLabelAssociationKey: Comparable = { export type BaileysInMemoryStoreConfig = { chatKey?: Comparable labelAssociationKey?: Comparable - logger: Logger + logger?: Logger socket?: WASocket } @@ -73,13 +73,12 @@ const predefinedLabels = Object.freeze>({ } }) -export default ( - { logger, chatKey, labelAssociationKey, socket }: BaileysInMemoryStoreConfig -) => { +export default (config: BaileysInMemoryStoreConfig) => { // const logger = _logger || DEFAULT_CONNECTION_CONFIG.logger.child({ stream: 'in-mem-store' }) - chatKey = chatKey || waChatKey(true) - labelAssociationKey = labelAssociationKey || waLabelAssociationKey - logger = logger || DEFAULT_CONNECTION_CONFIG.logger.child({ stream: 'in-mem-store' }) + const socket = config.socket + const chatKey = config.chatKey || waChatKey(true) + const labelAssociationKey = config.labelAssociationKey || waLabelAssociationKey + const logger: Logger = config.logger || DEFAULT_CONNECTION_CONFIG.logger.child({ stream: 'in-mem-store' }) const KeyedDB = require('@adiwajshing/keyed-db').default const chats = new KeyedDB(chatKey, c => c.id) as KeyedDB