import type { GroupMetadata, ParticipantAction } from '@whiskeysockets/baileys'; import type { MongoStorage } from '../index.js'; import CRUD from './CRUD.js'; import type { Logger } from '../../../types/index.js'; import type { WASocket } from '@whiskeysockets/baileys'; import type { Db, ObjectId, WithId } from './CRUD.js'; type GroupsMetadataDoc = GroupMetadata & { _id: string | ObjectId; }; declare class GroupsMetadata extends CRUD { protected readonly storage: MongoStorage; protected readonly sock: WASocket | null; static collectionName: string; constructor(storage: MongoStorage, mongodb: Db, sock: WASocket | null, logger: Logger | null); /** * Getter to expose the raw MongoDB collection. */ getCollection(): import("mongodb").Collection; /** * Retrieve group metadata. * - If `id` (groupJid) is provided, returns the doc that contains that group JID or null if not found. * - If `id` is not provided, returns an array of all documents. */ get(id?: string): Promise | null>; get(): Promise[]>; /** * Update groups metadata based on partial updates. * Each update contains at least an `id` field (the group jid). * We'll do upserts or updates on documents where this groupJid field exists. */ update(updates: Partial[]): Promise; /** * Update group metadata on group participants update (join/leave/promote/demote). */ updateGroupParticipants({ id, participants, action, }: { id: string; participants: string[]; action: ParticipantAction; }): Promise; } export default GroupsMetadata;