zaileys 4.3.0 → 4.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { WAMessage, WAMessageKey, AnyMessageContent, MiscMessageGenerationOptions, Chat, Contact, PresenceData, WAPrivacyValue, WAPrivacyOnlineValue, WAReadReceiptsValue, WAPrivacyGroupAddValue, GroupMetadata, ParticipantAction, NewsletterMetadata, WAMediaUpload, AuthenticationCreds, SignalDataTypeMap, SignalDataSet, WASocket, UserFacingSocketConfig, SignalKeyStore, MessageUpsertType } from 'baileys';
2
- export { GroupMetadata, GroupParticipant, NewsletterMetadata, ParticipantAction, WAMediaUpload, WAPrivacyGroupAddValue, WAPrivacyOnlineValue, WAPrivacyValue, WAReadReceiptsValue } from 'baileys';
1
+ import { WAMessage, WAMessageKey, AnyMessageContent, MiscMessageGenerationOptions, Chat, Contact, PresenceData, WAPrivacyValue, WAPrivacyOnlineValue, WAReadReceiptsValue, WAPrivacyGroupAddValue, GroupMetadata, ParticipantAction, WAMediaUpload, ChatModification, NewsletterMetadata, AuthenticationCreds, SignalDataTypeMap, SignalDataSet, WASocket, UserFacingSocketConfig, SignalKeyStore, MessageUpsertType } from 'baileys';
2
+ export { GroupMetadata, GroupParticipant, NewsletterMetadata, ParticipantAction, WAMediaUpload, WAPrivacyGroupAddValue, WAPrivacyOnlineValue, WAPrivacyValue, WAReadReceiptsValue, areJidsSameUser, getDevice, isJidBroadcast, isJidGroup, isJidNewsletter, isLidUser, isPnUser, jidDecode, jidEncode, jidNormalizedUser } from 'baileys';
3
3
  import { Readable } from 'node:stream';
4
4
  import { Pool } from 'pg';
5
5
  import { RedisClientType } from 'redis';
@@ -15,6 +15,11 @@ type VideoOptions = {
15
15
  caption?: string;
16
16
  gifPlayback?: boolean;
17
17
  viewOnce?: boolean;
18
+ /** Send as a round video note (PTV). */
19
+ ptv?: boolean;
20
+ };
21
+ type VideoNoteOptions = {
22
+ viewOnce?: boolean;
18
23
  };
19
24
  type AudioOptions = {
20
25
  ptt?: boolean;
@@ -118,6 +123,44 @@ type TemplateOptions = {
118
123
  footer?: string;
119
124
  buttons: ButtonDef[];
120
125
  };
126
+ type EventOptions = {
127
+ name: string;
128
+ description?: string;
129
+ startAt: Date | number;
130
+ endAt?: Date | number;
131
+ location?: {
132
+ latitude: number;
133
+ longitude: number;
134
+ name?: string;
135
+ address?: string;
136
+ };
137
+ call?: 'audio' | 'video';
138
+ canceled?: boolean;
139
+ };
140
+ type ProductOptions = {
141
+ image: MediaSource;
142
+ title: string;
143
+ businessOwnerId: string;
144
+ description?: string;
145
+ /** Price in currency units (e.g. 50 = 50.00); mapped to priceAmount1000. */
146
+ price?: number;
147
+ currency?: string;
148
+ productId?: string;
149
+ retailerId?: string;
150
+ url?: string;
151
+ body?: string;
152
+ footer?: string;
153
+ };
154
+ type GroupInviteOptions = {
155
+ jid: string;
156
+ code: string;
157
+ subject?: string;
158
+ caption?: string;
159
+ /** Unix seconds when the invite expires. Defaults to ~3 days from now. WhatsApp reads this as seconds. */
160
+ expiresAt?: number;
161
+ /** Optional JPEG thumbnail (group avatar) — improves how the card renders. */
162
+ thumbnail?: Buffer;
163
+ };
121
164
  type BuilderContext = {
122
165
  recipient: string;
123
166
  quoted?: WAMessage | WAMessageKey;
@@ -199,6 +242,7 @@ declare class MessageBuilder<State extends BuilderState> {
199
242
  to(this: MessageBuilder<'init'>, recipient: string): MessageBuilder<'init'>;
200
243
  text(this: MessageBuilder<'init'>, content: string, opts?: TextOptions): MessageBuilder<'content-set'>;
201
244
  image(this: MessageBuilder<'init'>, src: MediaSource, opts?: ImageOptions): MessageBuilder<'content-set'>;
245
+ videoNote(this: MessageBuilder<'init'>, src: MediaSource, opts?: VideoNoteOptions): MessageBuilder<'content-set'>;
202
246
  video(this: MessageBuilder<'init'>, src: MediaSource, opts?: VideoOptions): MessageBuilder<'content-set'>;
203
247
  audio(this: MessageBuilder<'init'>, src: MediaSource, opts?: AudioOptions): MessageBuilder<'content-set'>;
204
248
  document(this: MessageBuilder<'init'>, src: MediaSource, opts: DocumentOptions): MessageBuilder<'content-set'>;
@@ -212,6 +256,12 @@ declare class MessageBuilder<State extends BuilderState> {
212
256
  location(this: MessageBuilder<'init'>, lat: number, lon: number, opts?: LocationOptions): MessageBuilder<'content-set'>;
213
257
  contact(this: MessageBuilder<'init'>, vcard: string): MessageBuilder<'content-set'>;
214
258
  template(this: MessageBuilder<'init'>, opts: TemplateOptions): MessageBuilder<'content-set'>;
259
+ event(this: MessageBuilder<'init'>, opts: EventOptions): MessageBuilder<'content-set'>;
260
+ groupInvite(this: MessageBuilder<'init'>, opts: GroupInviteOptions): MessageBuilder<'content-set'>;
261
+ product(this: MessageBuilder<'init'>, opts: ProductOptions): MessageBuilder<'content-set'>;
262
+ requestPhoneNumber(this: MessageBuilder<'init'>): MessageBuilder<'content-set'>;
263
+ sharePhoneNumber(this: MessageBuilder<'init'>): MessageBuilder<'content-set'>;
264
+ limitSharing(this: MessageBuilder<'init'>, enabled?: boolean): MessageBuilder<'content-set'>;
215
265
  album(this: MessageBuilder<'init'>, items: AlbumItem[]): MessageBuilder<'content-set'>;
216
266
  reply(quoted: WAMessage | WAMessageKey): MessageBuilder<State>;
217
267
  mentions(jids: string[]): MessageBuilder<State>;
@@ -239,6 +289,14 @@ type MessageStoreListOptions = {
239
289
  limit?: number;
240
290
  before?: number;
241
291
  };
292
+ type PruneOptions = {
293
+ /** Delete messages whose `messageTimestamp` is strictly older than this epoch value, in **seconds** (matching stored `messageTimestamp`). */
294
+ olderThan?: number;
295
+ /** Keep only the newest N messages per chat. */
296
+ maxPerChat?: number;
297
+ /** Restrict pruning to chats whose jid passes this predicate. */
298
+ chatFilter?: (jid: string) => boolean;
299
+ };
242
300
  type ScheduledJobRecord = {
243
301
  id: string;
244
302
  fireAt: number;
@@ -271,14 +329,21 @@ interface MessageStore {
271
329
  saveScheduledJob?(job: ScheduledJobRecord): Promise<void>;
272
330
  listScheduledJobs?(): Promise<ScheduledJobRecord[]>;
273
331
  deleteScheduledJob?(id: string): Promise<void>;
332
+ deleteMessage?(key: WAMessageKey): Promise<void>;
333
+ pruneMessages?(opts: PruneOptions): Promise<number>;
274
334
  }
275
335
 
276
336
  type DeleteOptions = {
277
337
  forEveryone?: boolean;
278
338
  };
339
+ type PinOptions = {
340
+ /** Pin duration in seconds (WhatsApp offers 86400 / 604800 / 2592000). Defaults to 24h. */
341
+ duration?: number;
342
+ };
279
343
  declare const deleteMessage: (socket: BuilderSocketLike, key: WAMessageKey, opts?: DeleteOptions) => Promise<void>;
280
344
  declare const reactToMessage: (socket: BuilderSocketLike, key: WAMessageKey, emoji: string) => Promise<WAMessageKey>;
281
345
  declare const forwardMessage: (socket: BuilderSocketLike, store: Pick<MessageStore, "getMessage">, key: WAMessageKey, to: string) => Promise<WAMessageKey>;
346
+ declare const pinMessage: (socket: BuilderSocketLike, key: WAMessageKey, pin: boolean, opts?: PinOptions) => Promise<WAMessageKey>;
282
347
 
283
348
  interface UsernameResolveSocketLike {
284
349
  onWhatsApp(...phoneNumber: string[]): Promise<Array<{
@@ -359,6 +424,43 @@ interface DomainSocketLike {
359
424
  groupToggleEphemeral(jid: string, ephemeralExpiration: number): Promise<void>;
360
425
  groupSettingUpdate(jid: string, setting: 'announcement' | 'not_announcement' | 'locked' | 'unlocked'): Promise<void>;
361
426
  updateMemberLabel(jid: string, memberLabel: string): Promise<unknown>;
427
+ groupFetchAllParticipating(): Promise<{
428
+ [jid: string]: GroupMetadata;
429
+ }>;
430
+ groupGetInviteInfo(code: string): Promise<GroupMetadata>;
431
+ groupRequestParticipantsList(jid: string): Promise<Array<{
432
+ [k: string]: string;
433
+ }>>;
434
+ groupRequestParticipantsUpdate(jid: string, participants: string[], action: 'approve' | 'reject'): Promise<{
435
+ status: string;
436
+ jid: string;
437
+ }[]>;
438
+ groupJoinApprovalMode(jid: string, mode: 'on' | 'off'): Promise<void>;
439
+ groupMemberAddMode(jid: string, mode: 'admin_add' | 'all_member_add'): Promise<void>;
440
+ onWhatsApp(...jids: string[]): Promise<Array<{
441
+ jid: string;
442
+ exists: boolean;
443
+ lid?: string;
444
+ }> | undefined>;
445
+ addOrEditContact(jid: string, contact: {
446
+ firstName?: string;
447
+ lastName?: string;
448
+ fullName?: string;
449
+ }): Promise<unknown>;
450
+ removeContact(jid: string): Promise<unknown>;
451
+ getBusinessProfile(jid: string): Promise<unknown>;
452
+ getCatalog(opts: {
453
+ jid?: string;
454
+ limit?: number;
455
+ cursor?: string;
456
+ }): Promise<unknown>;
457
+ getCollections(jid?: string, limit?: number): Promise<unknown>;
458
+ getOrderDetails(orderId: string, tokenBase64: string): Promise<unknown>;
459
+ productCreate(create: Record<string, unknown>): Promise<unknown>;
460
+ productUpdate(productId: string, update: Record<string, unknown>): Promise<unknown>;
461
+ productDelete(productIds: string[]): Promise<{
462
+ deleted: number;
463
+ }>;
362
464
  updateLastSeenPrivacy(value: WAPrivacyValue): Promise<void>;
363
465
  updateOnlinePrivacy(value: WAPrivacyOnlineValue): Promise<void>;
364
466
  updateProfilePicturePrivacy(value: WAPrivacyValue): Promise<void>;
@@ -371,6 +473,13 @@ interface DomainSocketLike {
371
473
  }>;
372
474
  updateBlockStatus(jid: string, action: 'block' | 'unblock'): Promise<void>;
373
475
  fetchBlocklist(): Promise<string[]>;
476
+ updateProfileName(name: string): Promise<void>;
477
+ updateProfileStatus(status: string): Promise<void>;
478
+ updateProfilePicture(jid: string, content: WAMediaUpload): Promise<void>;
479
+ removeProfilePicture(jid: string): Promise<void>;
480
+ profilePictureUrl(jid: string, type?: 'image' | 'preview', timeoutMs?: number): Promise<string | undefined>;
481
+ fetchStatus(jid: string): Promise<unknown>;
482
+ chatModify(mod: ChatModification, jid: string): Promise<void>;
374
483
  newsletterCreate(name: string, description?: string): Promise<NewsletterMetadata>;
375
484
  newsletterFollow(jid: string): Promise<unknown>;
376
485
  newsletterUnfollow(jid: string): Promise<unknown>;
@@ -381,6 +490,13 @@ interface DomainSocketLike {
381
490
  newsletterMute(jid: string): Promise<unknown>;
382
491
  newsletterUnmute(jid: string): Promise<unknown>;
383
492
  newsletterDelete(jid: string): Promise<void>;
493
+ newsletterSubscribers(jid: string): Promise<unknown>;
494
+ newsletterRemovePicture(jid: string): Promise<unknown>;
495
+ newsletterReactMessage(jid: string, serverId: string, reaction?: string): Promise<void>;
496
+ newsletterFetchMessages(jid: string, count: number, since?: number, after?: number): Promise<unknown>;
497
+ newsletterAdminCount(jid: string): Promise<number>;
498
+ newsletterChangeOwner(jid: string, newOwnerJid: string): Promise<void>;
499
+ newsletterDemote(jid: string, userJid: string): Promise<void>;
384
500
  communityCreate(subject: string, body: string): Promise<GroupMetadata>;
385
501
  communityCreateGroup(subject: string, participants: string[], parentCommunityJid: string): Promise<GroupMetadata>;
386
502
  communityLinkGroup(groupJid: string, parentCommunityJid: string): Promise<void>;
@@ -396,6 +512,15 @@ interface DomainSocketLike {
396
512
  communityInviteCode(jid: string): Promise<string | undefined>;
397
513
  communityRevokeInvite(jid: string): Promise<string | undefined>;
398
514
  communityAcceptInvite(code: string): Promise<string | undefined>;
515
+ communityMetadata(jid: string): Promise<GroupMetadata>;
516
+ communityFetchAllParticipating(): Promise<{
517
+ [jid: string]: GroupMetadata;
518
+ }>;
519
+ communityGetInviteInfo(code: string): Promise<GroupMetadata>;
520
+ communityToggleEphemeral(jid: string, ephemeralExpiration: number): Promise<void>;
521
+ communitySettingUpdate(jid: string, setting: 'announcement' | 'not_announcement'): Promise<void>;
522
+ communityMemberAddMode(jid: string, mode: 'admin_add' | 'all_member_add'): Promise<void>;
523
+ communityJoinApprovalMode(jid: string, mode: 'on' | 'off'): Promise<void>;
399
524
  }
400
525
 
401
526
  declare class GroupModule {
@@ -420,6 +545,15 @@ declare class GroupModule {
420
545
  acceptInvite(code: string): Promise<string>;
421
546
  toggleEphemeral(groupId: string, seconds: number): Promise<void>;
422
547
  setting(groupId: string, setting: 'announcement' | 'not_announcement' | 'locked' | 'unlocked'): Promise<void>;
548
+ list(): Promise<GroupMetadata[]>;
549
+ inviteInfo(code: string): Promise<GroupMetadata>;
550
+ joinRequests(groupId: string): Promise<Array<{
551
+ [k: string]: string;
552
+ }>>;
553
+ approveJoin(groupId: string, jids: string[]): Promise<ParticipantUpdateResult[]>;
554
+ rejectJoin(groupId: string, jids: string[]): Promise<ParticipantUpdateResult[]>;
555
+ joinApproval(groupId: string, enabled: boolean): Promise<void>;
556
+ memberAddMode(groupId: string, adminsOnly: boolean): Promise<void>;
423
557
  }
424
558
 
425
559
  declare class PrivacyModule {
@@ -455,6 +589,18 @@ declare class NewsletterModule {
455
589
  mute(jid: string): Promise<void>;
456
590
  unmute(jid: string): Promise<void>;
457
591
  delete(jid: string): Promise<void>;
592
+ removePicture(jid: string): Promise<void>;
593
+ react(jid: string, serverId: string, emoji: string): Promise<void>;
594
+ /** Remove a reaction from a newsletter message. */
595
+ unreact(jid: string, serverId: string): Promise<void>;
596
+ subscribers(jid: string): Promise<unknown>;
597
+ messages(jid: string, count?: number, opts?: {
598
+ since?: number;
599
+ after?: number;
600
+ }): Promise<unknown>;
601
+ adminCount(jid: string): Promise<number>;
602
+ changeOwner(jid: string, newOwnerJid: string): Promise<void>;
603
+ demote(jid: string, userJid: string): Promise<void>;
458
604
  }
459
605
 
460
606
  declare class CommunityModule {
@@ -474,6 +620,92 @@ declare class CommunityModule {
474
620
  inviteCode(communityId: string): Promise<string | undefined>;
475
621
  revokeInvite(communityId: string): Promise<string | undefined>;
476
622
  acceptInvite(code: string): Promise<string | undefined>;
623
+ metadata(communityId: string): Promise<GroupMetadata>;
624
+ list(): Promise<GroupMetadata[]>;
625
+ inviteInfo(code: string): Promise<GroupMetadata>;
626
+ toggleEphemeral(communityId: string, seconds: number): Promise<void>;
627
+ setting(communityId: string, setting: 'announcement' | 'not_announcement'): Promise<void>;
628
+ memberAddMode(communityId: string, adminsOnly: boolean): Promise<void>;
629
+ joinApproval(communityId: string, enabled: boolean): Promise<void>;
630
+ }
631
+
632
+ declare class ProfileModule {
633
+ private readonly getSocket;
634
+ constructor(getSocket: () => DomainSocketLike | undefined);
635
+ protected requireSocket(): DomainSocketLike;
636
+ setName(name: string): Promise<void>;
637
+ setStatus(status: string): Promise<void>;
638
+ /** Set the profile/group picture. `jid` defaults to self; pass a group jid to set a group avatar. */
639
+ setPicture(jid: string, image: WAMediaUpload): Promise<void>;
640
+ removePicture(jid: string): Promise<void>;
641
+ getPicture(jid: string, hd?: boolean): Promise<string | null>;
642
+ getStatus(jid: string): Promise<unknown>;
643
+ }
644
+
645
+ type LastMessage = {
646
+ key: WAMessageKey;
647
+ messageTimestamp: number;
648
+ };
649
+ type LastMessageResolver = (jid: string) => Promise<LastMessage[]>;
650
+ declare class ChatModule {
651
+ private readonly getSocket;
652
+ private readonly resolveLast?;
653
+ constructor(getSocket: () => DomainSocketLike | undefined, resolveLast?: LastMessageResolver | undefined);
654
+ protected requireSocket(): DomainSocketLike;
655
+ private last;
656
+ archive(jid: string): Promise<void>;
657
+ unarchive(jid: string): Promise<void>;
658
+ pin(jid: string): Promise<void>;
659
+ unpin(jid: string): Promise<void>;
660
+ /** Mute for `durationMs` (e.g. 8h = 28_800_000). Omit to mute indefinitely. */
661
+ mute(jid: string, durationMs?: number): Promise<void>;
662
+ unmute(jid: string): Promise<void>;
663
+ markRead(jid: string): Promise<void>;
664
+ markUnread(jid: string): Promise<void>;
665
+ star(key: WAMessageKey, starred?: boolean): Promise<void>;
666
+ unstar(key: WAMessageKey): Promise<void>;
667
+ delete(jid: string): Promise<void>;
668
+ clear(jid: string): Promise<void>;
669
+ }
670
+
671
+ type ContactCheckResult = {
672
+ jid: string;
673
+ exists: boolean;
674
+ lid?: string;
675
+ };
676
+ declare class ContactModule {
677
+ private readonly getSocket;
678
+ private readonly normalize;
679
+ constructor(getSocket: () => DomainSocketLike | undefined, normalize: (input: string) => string);
680
+ protected requireSocket(): DomainSocketLike;
681
+ /** Check whether phone numbers are on WhatsApp; returns the resolved jid + existence per input. */
682
+ check(...numbers: string[]): Promise<ContactCheckResult[]>;
683
+ exists(number: string): Promise<boolean>;
684
+ save(jid: string, name: {
685
+ firstName?: string;
686
+ lastName?: string;
687
+ fullName?: string;
688
+ }): Promise<void>;
689
+ remove(jid: string): Promise<void>;
690
+ }
691
+
692
+ declare class BusinessModule {
693
+ private readonly getSocket;
694
+ constructor(getSocket: () => DomainSocketLike | undefined);
695
+ protected requireSocket(): DomainSocketLike;
696
+ profile(jid: string): Promise<unknown>;
697
+ catalog(opts?: {
698
+ jid?: string;
699
+ limit?: number;
700
+ cursor?: string;
701
+ }): Promise<unknown>;
702
+ collections(jid?: string, limit?: number): Promise<unknown>;
703
+ orderDetails(orderId: string, tokenBase64: string): Promise<unknown>;
704
+ createProduct(create: Record<string, unknown>): Promise<unknown>;
705
+ updateProduct(productId: string, update: Record<string, unknown>): Promise<unknown>;
706
+ deleteProduct(...productIds: string[]): Promise<{
707
+ deleted: number;
708
+ }>;
477
709
  }
478
710
 
479
711
  interface SenderInfo {
@@ -662,7 +894,7 @@ type InboundEventMap = {
662
894
  };
663
895
  type InboundEventName = keyof InboundEventMap;
664
896
 
665
- type ChatType = 'text' | 'image' | 'video' | 'audio' | 'document' | 'sticker' | 'poll' | 'contact' | 'location' | 'live-location' | 'event' | 'buttons' | 'list' | 'interactive' | 'template' | 'unknown';
897
+ type ChatType = 'text' | 'image' | 'video' | 'audio' | 'document' | 'sticker' | 'poll' | 'contact' | 'location' | 'live-location' | 'event' | 'album' | 'group-invite' | 'product' | 'order' | 'payment' | 'buttons' | 'list' | 'interactive' | 'template' | 'unknown';
666
898
  type SenderDevice = 'unknown' | 'android' | 'ios' | 'web' | 'desktop' | string;
667
899
  interface CitationConfig {
668
900
  authors?: string[] | ((jid: string) => boolean | Promise<boolean>);
@@ -708,6 +940,54 @@ interface LocationMedia {
708
940
  speed: number | null;
709
941
  caption: string | null;
710
942
  }
943
+ interface AlbumMedia {
944
+ type: 'album';
945
+ expectedImageCount: number | null;
946
+ expectedVideoCount: number | null;
947
+ }
948
+ interface GroupInviteMedia {
949
+ type: 'group-invite';
950
+ groupId: string | null;
951
+ groupName: string | null;
952
+ inviteCode: string | null;
953
+ caption: string | null;
954
+ expiresAt: number | null;
955
+ }
956
+ interface ProductMedia {
957
+ type: 'product';
958
+ productId: string | null;
959
+ title: string | null;
960
+ description: string | null;
961
+ price: number | null;
962
+ currency: string | null;
963
+ retailerId: string | null;
964
+ url: string | null;
965
+ businessOwnerId: string | null;
966
+ }
967
+ interface OrderMedia {
968
+ type: 'order';
969
+ orderId: string | null;
970
+ title: string | null;
971
+ itemCount: number | null;
972
+ total: number | null;
973
+ currency: string | null;
974
+ status: string | null;
975
+ message: string | null;
976
+ }
977
+ interface PaymentMedia {
978
+ type: 'payment';
979
+ kind: 'request' | 'send' | 'invite';
980
+ amount: number | null;
981
+ currency: string | null;
982
+ note: string | null;
983
+ expiresAt: number | null;
984
+ }
985
+ interface LinkPreviewMedia {
986
+ type: 'link';
987
+ url: string | null;
988
+ title: string | null;
989
+ description: string | null;
990
+ }
711
991
  interface EventMedia {
712
992
  type: 'event';
713
993
  name: string | null;
@@ -758,7 +1038,7 @@ interface TemplateMedia {
758
1038
  text: string | null;
759
1039
  buttons: MessageButton[];
760
1040
  }
761
- type ContextMedia = MediaAttachment | PollMedia | ContactMedia | LocationMedia | EventMedia | ButtonsMedia | ListMedia | InteractiveMedia | TemplateMedia;
1041
+ type ContextMedia = MediaAttachment | PollMedia | ContactMedia | LocationMedia | EventMedia | AlbumMedia | GroupInviteMedia | ProductMedia | OrderMedia | PaymentMedia | LinkPreviewMedia | ButtonsMedia | ListMedia | InteractiveMedia | TemplateMedia;
762
1042
  interface MessageContext {
763
1043
  uniqueId: string;
764
1044
  staticId: string;
@@ -830,6 +1110,7 @@ interface BuildContextInput {
830
1110
  isNewsletter: boolean;
831
1111
  prefixes: string[];
832
1112
  citationConfig?: CitationConfig;
1113
+ lidMap?: Map<string, string>;
833
1114
  resolveRoomName: () => Promise<string | null>;
834
1115
  resolveReceiverName: () => Promise<string | null>;
835
1116
  resolveReplied: () => Promise<MessageContext | null>;
@@ -837,6 +1118,11 @@ interface BuildContextInput {
837
1118
  react: (emoji: string) => Promise<WAMessageKey>;
838
1119
  media?: ContextMedia;
839
1120
  }
1121
+ declare const extractLinks: (text: string) => string[];
1122
+ declare const computeUniqueId: (key: WAMessageKey) => string;
1123
+ declare const computeStaticId: (roomId: string | null, senderId: string) => string;
1124
+ declare const epochSecondsToMs: (value: unknown) => number;
1125
+ declare const senderDeviceOf: (jid: string) => SenderDevice;
840
1126
  declare const buildMessageContext: (input: BuildContextInput) => MessageContext;
841
1127
 
842
1128
  type CommandPrefix = string | string[];
@@ -887,6 +1173,7 @@ declare class CommandRegistry {
887
1173
  def: CommandDefinition;
888
1174
  args: string[];
889
1175
  } | undefined;
1176
+ unregister(spec: string): void;
890
1177
  list(): CommandDefinition[];
891
1178
  }
892
1179
 
@@ -913,6 +1200,35 @@ interface AuthStoreBundle {
913
1200
  readonly signal: AuthStore;
914
1201
  }
915
1202
 
1203
+ type AutoDeleteOptions = {
1204
+ maxAgeMs?: number;
1205
+ maxPerChat?: number;
1206
+ intervalMs?: number;
1207
+ chats?: 'all' | ((jid: string) => boolean);
1208
+ };
1209
+ declare function genericPrune(store: MessageStore, opts: PruneOptions): Promise<number>;
1210
+ declare class AutoDeleteSweeper {
1211
+ private readonly store;
1212
+ private readonly options;
1213
+ private readonly logger;
1214
+ private readonly now;
1215
+ private timer;
1216
+ private running;
1217
+ private warnedUnsupported;
1218
+ private disabled;
1219
+ constructor(deps: {
1220
+ store: MessageStore;
1221
+ options: AutoDeleteOptions;
1222
+ logger?: Logger;
1223
+ now?: () => number;
1224
+ });
1225
+ private get active();
1226
+ private buildPruneOptions;
1227
+ runOnce(): Promise<number>;
1228
+ start(): void;
1229
+ stop(): void;
1230
+ }
1231
+
916
1232
  type WAPresence = 'unavailable' | 'available' | 'composing' | 'recording' | 'paused';
917
1233
  interface AutomationSocketLike {
918
1234
  sendPresenceUpdate(type: WAPresence, toJid?: string): Promise<void>;
@@ -986,6 +1302,29 @@ declare function isRateLimited(reason: DisconnectReasonDomain): boolean;
986
1302
  declare function shouldClearAuth(reason: DisconnectReasonDomain): boolean;
987
1303
  declare function shouldReconnect(reason: DisconnectReasonDomain): boolean;
988
1304
 
1305
+ interface PluginContext {
1306
+ client: Client;
1307
+ logger: Logger | undefined;
1308
+ pluginDir: string;
1309
+ command(spec: string, handler: CommandHandler): void;
1310
+ use(middleware: Middleware): void;
1311
+ on<E extends keyof ClientEventMap>(event: E, handler: (payload: ClientEventMap[E]) => void): () => void;
1312
+ once<E extends keyof ClientEventMap>(event: E, handler: (payload: ClientEventMap[E]) => void): () => void;
1313
+ }
1314
+ interface Plugin {
1315
+ name: string;
1316
+ setup(ctx: PluginContext): void | (() => void) | Promise<void | (() => void)>;
1317
+ onUnload?(): void | Promise<void>;
1318
+ }
1319
+ type PluginsOptions = {
1320
+ dir?: string;
1321
+ watch?: boolean;
1322
+ pattern?: RegExp;
1323
+ ignore?: RegExp;
1324
+ onError?: (err: unknown, file: string) => void;
1325
+ };
1326
+ declare const definePlugin: (plugin: Plugin) => Plugin;
1327
+
989
1328
  type ConnectionState = 'idle' | 'connecting' | 'qr-pending' | 'pairing-pending' | 'connected' | 'reconnecting' | 'disconnecting' | 'disconnected';
990
1329
  type ConnectionAuthType = 'qr' | 'pairing';
991
1330
  interface Logger {
@@ -1028,6 +1367,10 @@ interface ClientOptions {
1028
1367
  presence?: PresenceThrottleOptions;
1029
1368
  /** Max scheduled messages dispatched per second, smoothing backlog bursts. Default `1`; `0` disables. */
1030
1369
  scheduleRateLimitPerSec?: number;
1370
+ /** Periodically prune old messages from the store. Enabled by default with a 1-month `maxAgeMs`; pass `false` to disable or override any field. */
1371
+ autoDelete?: AutoDeleteOptions | false;
1372
+ /** Load and manage plugins from a directory. */
1373
+ plugins?: PluginsOptions;
1031
1374
  }
1032
1375
  type ConnectionEventMap = {
1033
1376
  connect: {
@@ -1281,6 +1624,10 @@ declare class Client extends TypedEventEmitter<ClientEventMap> {
1281
1624
  private _privacy?;
1282
1625
  private _newsletter?;
1283
1626
  private _community?;
1627
+ private _profile?;
1628
+ private _chat?;
1629
+ private _contact?;
1630
+ private _business?;
1284
1631
  private commandRegistry?;
1285
1632
  private readonly commandMiddleware;
1286
1633
  private readonly commandPrefixes;
@@ -1289,6 +1636,11 @@ declare class Client extends TypedEventEmitter<ClientEventMap> {
1289
1636
  private commandDispatcher;
1290
1637
  private _presence?;
1291
1638
  private _scheduler?;
1639
+ private readonly autoDeleteOptions;
1640
+ private autoDeleteSweeper;
1641
+ private readonly pluginsOptions;
1642
+ private pluginRegistry;
1643
+ private pluginLoader;
1292
1644
  private waVersion?;
1293
1645
  private versionWarming?;
1294
1646
  constructor(options?: ClientOptions);
@@ -1302,6 +1654,10 @@ declare class Client extends TypedEventEmitter<ClientEventMap> {
1302
1654
  get privacy(): PrivacyModule;
1303
1655
  get newsletter(): NewsletterModule;
1304
1656
  get community(): CommunityModule;
1657
+ get profile(): ProfileModule;
1658
+ get chat(): ChatModule;
1659
+ get contact(): ContactModule;
1660
+ get business(): BusinessModule;
1305
1661
  get presence(): PresenceModule;
1306
1662
  broadcast(jids: string[], build: (b: MessageBuilder<'init'>) => MessageBuilder<'content-set'>, options?: BroadcastOptions): Promise<BroadcastResult>;
1307
1663
  scheduleAt(date: Date, build: (b: MessageBuilder<'init'>) => MessageBuilder<'content-set'>): Promise<ScheduleHandle>;
@@ -1311,7 +1667,9 @@ declare class Client extends TypedEventEmitter<ClientEventMap> {
1311
1667
  disconnect(): Promise<void>;
1312
1668
  logout(): Promise<void>;
1313
1669
  command(spec: string, handler: CommandHandler): this;
1670
+ unregisterCommand(spec: string): this;
1314
1671
  use(middleware: Middleware): this;
1672
+ unuse(middleware: Middleware): this;
1315
1673
  private attachCommandsIfReady;
1316
1674
  private buildCommandContext;
1317
1675
  private detachCommands;
@@ -1320,6 +1678,9 @@ declare class Client extends TypedEventEmitter<ClientEventMap> {
1320
1678
  delete(key: WAMessageKey, opts?: DeleteOptions): Promise<void>;
1321
1679
  react(key: WAMessageKey, emoji: string): Promise<WAMessageKey>;
1322
1680
  forward(key: WAMessageKey, to: string): Promise<WAMessageKey>;
1681
+ pin(key: WAMessageKey, opts?: PinOptions): Promise<WAMessageKey>;
1682
+ unpin(key: WAMessageKey): Promise<WAMessageKey>;
1683
+ setDisappearing(to: string, seconds: number): Promise<void>;
1323
1684
  private resolveRecipient;
1324
1685
  private requireSocket;
1325
1686
  private attachEmitterLogger;
@@ -1329,7 +1690,11 @@ declare class Client extends TypedEventEmitter<ClientEventMap> {
1329
1690
  private handleAuthExhausted;
1330
1691
  private handleOpen;
1331
1692
  private resolveMessageForResend;
1332
- private lidToPn;
1693
+ private lidMapping;
1694
+ /** Resolve a `@lid` JID to its phone-number JID (uses WhatsApp's LID mapping; may hit the network). */
1695
+ lidToPn(lid: string): Promise<string | null>;
1696
+ /** Resolve a phone-number JID to its `@lid` JID (uses WhatsApp's LID mapping; may hit the network). */
1697
+ pnToLid(pn: string): Promise<string | null>;
1333
1698
  private lookupQuoted;
1334
1699
  private handleClose;
1335
1700
  private rejectPendingConnect;
@@ -1476,6 +1841,8 @@ declare class MemoryMessageStore implements MessageStore {
1476
1841
  savePresence(jid: string, presence: PresenceData): Promise<void>;
1477
1842
  getPresence(jid: string): Promise<PresenceData | undefined>;
1478
1843
  bind(socket: BaileysSocketLike): void;
1844
+ deleteMessage(key: WAMessageKey): Promise<void>;
1845
+ pruneMessages(opts: PruneOptions): Promise<number>;
1479
1846
  clear(): Promise<void>;
1480
1847
  close(): Promise<void>;
1481
1848
  private assertOpen;
@@ -1507,6 +1874,8 @@ declare class SqliteMessageStore implements MessageStore {
1507
1874
  listContacts(): Promise<Contact[]>;
1508
1875
  savePresence(jid: string, presence: PresenceData): Promise<void>;
1509
1876
  getPresence(jid: string): Promise<PresenceData | undefined>;
1877
+ deleteMessage(key: WAMessageKey): Promise<void>;
1878
+ pruneMessages(opts: PruneOptions): Promise<number>;
1510
1879
  bind(socket: BaileysSocketLike): void;
1511
1880
  clear(): Promise<void>;
1512
1881
  close(): Promise<void>;
@@ -1545,6 +1914,8 @@ declare class PostgresMessageStore implements MessageStore {
1545
1914
  listContacts(): Promise<Contact[]>;
1546
1915
  savePresence(jid: string, presence: PresenceData): Promise<void>;
1547
1916
  getPresence(jid: string): Promise<PresenceData | undefined>;
1917
+ deleteMessage(key: WAMessageKey): Promise<void>;
1918
+ pruneMessages(opts: PruneOptions): Promise<number>;
1548
1919
  bind(socket: BaileysSocketLike): void;
1549
1920
  clear(): Promise<void>;
1550
1921
  close(): Promise<void>;
@@ -1581,6 +1952,9 @@ declare class RedisMessageStore implements MessageStore {
1581
1952
  bind(socket: BaileysSocketLike): void;
1582
1953
  clear(): Promise<void>;
1583
1954
  close(): Promise<void>;
1955
+ deleteMessage(key: WAMessageKey): Promise<void>;
1956
+ pruneMessages(opts: PruneOptions): Promise<number>;
1957
+ private jidFromIndexKey;
1584
1958
  private msgIndexKey;
1585
1959
  private msgDataKey;
1586
1960
  private chatsKey;
@@ -1617,6 +1991,8 @@ declare class ConvexMessageStore implements MessageStore {
1617
1991
  saveScheduledJob(job: ScheduledJobRecord): Promise<void>;
1618
1992
  listScheduledJobs(): Promise<ScheduledJobRecord[]>;
1619
1993
  deleteScheduledJob(id: string): Promise<void>;
1994
+ deleteMessage(key: WAMessageKey): Promise<void>;
1995
+ pruneMessages(opts: PruneOptions): Promise<number>;
1620
1996
  bind(socket: BaileysSocketLike): void;
1621
1997
  clear(): Promise<void>;
1622
1998
  close(): Promise<void>;
@@ -1687,6 +2063,26 @@ type ZaileysLogger = Logger$1;
1687
2063
  declare function createLogger(options?: CreateLoggerOptions): ZaileysLogger;
1688
2064
  declare function adoptLogger(maybe: Logger | Partial<Logger> | undefined, fallback?: Logger): Logger;
1689
2065
 
2066
+ declare const extractJid: (remoteJid: string | undefined | null) => string | null;
2067
+ declare const isLidJid: (jid: string) => boolean;
2068
+ declare const isPnJid: (jid: string) => boolean;
2069
+
2070
+ /** Digits-only phone number from a JID (e.g. `628xx@s.whatsapp.net` → `628xx`). Empty for groups/lids. */
2071
+ declare const jidToPhone: (jid: string) => string;
2072
+ /** Build a user JID from a phone number or digits (e.g. `+62 812` → `62812@s.whatsapp.net`). */
2073
+ declare const phoneToJid: (phone: string) => string;
2074
+
2075
+ type LoadedMedia = {
2076
+ buffer: Buffer;
2077
+ mime: string;
2078
+ size: number;
2079
+ };
2080
+ type LoadMediaOptions = {
2081
+ timeoutMs?: number;
2082
+ };
2083
+ declare const detectMimeFromBuffer: (buffer: Buffer) => Promise<string>;
2084
+ declare const loadMedia: (src: MediaSource, options?: LoadMediaOptions) => Promise<LoadedMedia>;
2085
+
1690
2086
  interface LIDMapping {
1691
2087
  readonly lid: string;
1692
2088
  readonly pn: string;
@@ -1860,4 +2256,4 @@ declare class Media {
1860
2256
  toBuffer(): Promise<Buffer>;
1861
2257
  }
1862
2258
 
1863
- export { type AddressButton, type AlbumItem, type AudioOptions, AudioProcessor, type AudioType, type AuthAttemptBlockReason, type AuthAttemptDecision, type AuthCredsStore, type AuthGuard, type AuthGuardOptions, type AuthStore, type AuthStoreBundle, type AuthStoreKey, type AuthStoreValue, type AutomationErrorCode, type AutomationSocketLike, type BaileysSocket, type BaileysSocketLike, type BottomSheetOptions, type BroadcastDeps, type BroadcastOptions, type BroadcastResult, BufferConverter, type BuildContextInput, type BuilderContext, type BuilderErrorCode, type BuilderSocketLike, type BuilderState, type ButtonClickPayload, type ButtonDef, type CacheableAuthStoreOptions, type CallBase, type CallButton, type CallPayload, type CancelReminderButton, type ChatType, type CitationConfig, type CitationPredicates, Client, type ClientEventMap, type ClientEventName, type ClientOptions, type CommandContext, type CommandDefinition, type CommandErrorCode, type CommandHandler, type CommandPrefix, CommandRegistry, CommunityModule, type ConnectionAuthType, type ConnectionEventHandler, type ConnectionEventMap, type ConnectionEventName, type ConnectionState, type ConnectionStateMachine, type ContextMedia, ConvexAuthStore, type ConvexAuthStoreOptions, ConvexMessageStore, type ConvexMessageStoreOptions, type CopyButton, type CreateLoggerOptions, type DeleteOptions, type DeletePayload, type DisconnectReasonDomain, type DispatcherDeps, type DispatcherHandle, type DocumentOptions, DocumentProcessor, type DomainErrorCode, type DomainSocketLike, EditBuilder, type EditPayload, FFMPEG_CONSTANTS, type FFmpegConfig, FFmpegProcessor, FileAuthStore, type FileAuthStoreOptions, type FileExtension, FileManager, type GroupJoinPayload, type GroupLeavePayload, GroupModule, type GroupParticipantInfo, type GroupUpdatePayload, type HistorySyncPayload, type ImageOptions, ImageProcessor, type InboundEventMap, type InboundEventName, type InteractiveButton, type LIDMapping, type LIDMappingUpdatePayload, type LimitedPayload, type LimitedTimeOfferOptions, type LinkedGroup, type ListOptions, type ListSection$1 as ListSection, type ListSelectPayload, type LocationOptions, type LocationRequestButton, type Logger, type LoggerLevel, Media, type MediaDescriptor, type MediaDownloadResult, type MediaInput, type MediaKind, type MediaSource, type MemberTagPayload, MemoryAuthStore, MemoryMessageStore, type MentionAllContext, type MentionContext, MessageBuilder, type MessageContext, type MessageStore, type MessageStoreListOptions, type Middleware, MimeValidator, NewsletterModule, type NewsletterPayload, type OperationCategory, type OperationGuard, type OperationGuardClock, type OperationGuardOptions, type PairingFlow, type PairingFlowOptions, type PairingFlowResult, type ParsedArgs, type ParticipantUpdateResult, type PollOptions, type PollVotePayload, PostgresAuthStore, type PostgresAuthStoreOptions, PostgresMessageStore, type PostgresMessageStoreOptions, type PresenceClock, PresenceModule, type PresencePayload, type PresenceThrottleOptions, type PrivacyConfig, PrivacyModule, type PrivacySettings, type QuotedRef, RateLimiter, type RateLimiterClock, type RateLimiterOptions, type ReactionPayload, type ReconnectDecision, type ReconnectOptions, type ReconnectStrategy, type ReconnectStrategyDeps, RedisAuthStore, type RedisAuthStoreOptions, RedisMessageStore, type RedisMessageStoreOptions, type ReminderButton, type ReplyButton, type ResolvedCommand, type RetryPolicy, SELF_ONLY_PROTOCOL_TYPES, type ScheduleHandle, type ScheduledContentSnapshot, type ScheduledJob, type ScheduledJobRecord, Scheduler, type SchedulerDeps, type SchedulerTimer, type SelfOnlyProtocolType, type SenderDevice, type SenderInfo, SqliteAuthStore, type SqliteAuthStoreOptions, SqliteMessageStore, type SqliteMessageStoreOptions, type StateTransitionListener, type StickerMetadataType, type StickerOptions, StickerProcessor, type StickerShapeType, type StoreErrorCode, TaskQueue, type TaskQueueClock, type TaskQueueOptions, type TemplateOptions, type TextOptions, TypedEventEmitter, type TypedEventEmitterOptions, type UpsertPayload, type UrlButton, type UsernameResolveSocketLike, type VideoOptions, VideoProcessor, type WAPresence, ZaileysAutomationError, ZaileysBuilderError, ZaileysCommandError, ZaileysDomainError, type ZaileysLogger, ZaileysStoreError, adoptLogger, attachCommandDispatcher, buildMessageContext, chunk, createAuthGuard, createConnectionStateMachine, createLogger, createOperationGuard, createPairingFlow, createReconnectStrategy, deleteMessage, detectFileType, dropSpoofedSelfOnly, ffmpegTransform, forwardMessage, generateId, initializeFFmpeg, isFatalDisconnect, isJid, isRateLimited, makeCacheableAuthStore, mapDisconnectReason, normalizePhoneNumber, parseCommand, printQrToTerminal, reactToMessage, renderQrInTerminal, resolveUsername, runBroadcast, runMiddleware, shouldClearAuth, shouldReconnect, signalKeyStoreFromAuthStore, validateE164 };
2259
+ export { type AddressButton, type AlbumItem, type AudioOptions, AudioProcessor, type AudioType, type AuthAttemptBlockReason, type AuthAttemptDecision, type AuthCredsStore, type AuthGuard, type AuthGuardOptions, type AuthStore, type AuthStoreBundle, type AuthStoreKey, type AuthStoreValue, type AutoDeleteOptions, AutoDeleteSweeper, type AutomationErrorCode, type AutomationSocketLike, type BaileysSocket, type BaileysSocketLike, type BottomSheetOptions, type BroadcastDeps, type BroadcastOptions, type BroadcastResult, BufferConverter, type BuildContextInput, type BuilderContext, type BuilderErrorCode, type BuilderSocketLike, type BuilderState, BusinessModule, type ButtonClickPayload, type ButtonDef, type CacheableAuthStoreOptions, type CallBase, type CallButton, type CallPayload, type CancelReminderButton, ChatModule, type ChatType, type CitationConfig, type CitationPredicates, Client, type ClientEventMap, type ClientEventName, type ClientOptions, type CommandContext, type CommandDefinition, type CommandErrorCode, type CommandHandler, type CommandPrefix, CommandRegistry, CommunityModule, type ConnectionAuthType, type ConnectionEventHandler, type ConnectionEventMap, type ConnectionEventName, type ConnectionState, type ConnectionStateMachine, ContactModule, type ContextMedia, ConvexAuthStore, type ConvexAuthStoreOptions, ConvexMessageStore, type ConvexMessageStoreOptions, type CopyButton, type CreateLoggerOptions, type DeleteOptions, type DeletePayload, type DisconnectReasonDomain, type DispatcherDeps, type DispatcherHandle, type DocumentOptions, DocumentProcessor, type DomainErrorCode, type DomainSocketLike, EditBuilder, type EditPayload, type EventOptions, FFMPEG_CONSTANTS, type FFmpegConfig, FFmpegProcessor, FileAuthStore, type FileAuthStoreOptions, type FileExtension, FileManager, type GroupInviteOptions, type GroupJoinPayload, type GroupLeavePayload, GroupModule, type GroupParticipantInfo, type GroupUpdatePayload, type HistorySyncPayload, type ImageOptions, ImageProcessor, type InboundEventMap, type InboundEventName, type InteractiveButton, type LIDMapping, type LIDMappingUpdatePayload, type LimitedPayload, type LimitedTimeOfferOptions, type LinkedGroup, type ListOptions, type ListSection$1 as ListSection, type ListSelectPayload, type LoadMediaOptions, type LoadedMedia, type LocationOptions, type LocationRequestButton, type Logger, type LoggerLevel, Media, type MediaDescriptor, type MediaDownloadResult, type MediaInput, type MediaKind, type MediaSource, type MemberTagPayload, MemoryAuthStore, MemoryMessageStore, type MentionAllContext, type MentionContext, MessageBuilder, type MessageContext, type MessageStore, type MessageStoreListOptions, type Middleware, MimeValidator, NewsletterModule, type NewsletterPayload, type OperationCategory, type OperationGuard, type OperationGuardClock, type OperationGuardOptions, type PairingFlow, type PairingFlowOptions, type PairingFlowResult, type ParsedArgs, type ParticipantUpdateResult, type PinOptions, type Plugin, type PluginContext, type PluginsOptions, type PollOptions, type PollVotePayload, PostgresAuthStore, type PostgresAuthStoreOptions, PostgresMessageStore, type PostgresMessageStoreOptions, type PresenceClock, PresenceModule, type PresencePayload, type PresenceThrottleOptions, type PrivacyConfig, PrivacyModule, type PrivacySettings, type ProductOptions, ProfileModule, type PruneOptions, type QuotedRef, RateLimiter, type RateLimiterClock, type RateLimiterOptions, type ReactionPayload, type ReconnectDecision, type ReconnectOptions, type ReconnectStrategy, type ReconnectStrategyDeps, RedisAuthStore, type RedisAuthStoreOptions, RedisMessageStore, type RedisMessageStoreOptions, type ReminderButton, type ReplyButton, type ResolvedCommand, type RetryPolicy, SELF_ONLY_PROTOCOL_TYPES, type ScheduleHandle, type ScheduledContentSnapshot, type ScheduledJob, type ScheduledJobRecord, Scheduler, type SchedulerDeps, type SchedulerTimer, type SelfOnlyProtocolType, type SenderDevice, type SenderInfo, SqliteAuthStore, type SqliteAuthStoreOptions, SqliteMessageStore, type SqliteMessageStoreOptions, type StateTransitionListener, type StickerMetadataType, type StickerOptions, StickerProcessor, type StickerShapeType, type StoreErrorCode, TaskQueue, type TaskQueueClock, type TaskQueueOptions, type TemplateOptions, type TextOptions, TypedEventEmitter, type TypedEventEmitterOptions, type UpsertPayload, type UrlButton, type UsernameResolveSocketLike, type VideoNoteOptions, type VideoOptions, VideoProcessor, type WAPresence, ZaileysAutomationError, ZaileysBuilderError, ZaileysCommandError, ZaileysDomainError, type ZaileysLogger, ZaileysStoreError, adoptLogger, attachCommandDispatcher, buildMessageContext, chunk, computeStaticId, computeUniqueId, createAuthGuard, createConnectionStateMachine, createLogger, createOperationGuard, createPairingFlow, createReconnectStrategy, definePlugin, deleteMessage, detectFileType, detectMimeFromBuffer, dropSpoofedSelfOnly, epochSecondsToMs, extractLinks, ffmpegTransform, forwardMessage, generateId, genericPrune, initializeFFmpeg, isFatalDisconnect, isJid, isLidJid, isPnJid, isRateLimited, jidToPhone, loadMedia, makeCacheableAuthStore, mapDisconnectReason, extractJid as normalizeJid, normalizePhoneNumber, parseCommand, phoneToJid, pinMessage, printQrToTerminal, reactToMessage, renderQrInTerminal, resolveUsername, runBroadcast, runMiddleware, senderDeviceOf, shouldClearAuth, shouldReconnect, signalKeyStoreFromAuthStore, validateE164 };