@d0v3riz/baileys 6.3.1 → 6.4.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.
Files changed (51) hide show
  1. package/WAProto/WAProto.proto +58 -24
  2. package/WAProto/index.d.ts +649 -410
  3. package/WAProto/index.js +1632 -985
  4. package/lib/Defaults/baileys-version.json +1 -1
  5. package/lib/Defaults/index.js +1 -1
  6. package/lib/Socket/Client/abstract-socket-client.d.ts +1 -0
  7. package/lib/Socket/business.d.ts +4 -3
  8. package/lib/Socket/chats.d.ts +6 -5
  9. package/lib/Socket/groups.d.ts +3 -2
  10. package/lib/Socket/index.d.ts +9 -8
  11. package/lib/Socket/messages-recv.d.ts +5 -3
  12. package/lib/Socket/messages-recv.js +75 -2
  13. package/lib/Socket/messages-send.d.ts +3 -2
  14. package/lib/Socket/messages-send.js +13 -8
  15. package/lib/Socket/registration.d.ts +5 -4
  16. package/lib/Socket/socket.d.ts +4 -3
  17. package/lib/Socket/socket.js +69 -9
  18. package/lib/Store/make-in-memory-store.d.ts +2 -2
  19. package/lib/Types/Auth.d.ts +19 -17
  20. package/lib/Types/Call.d.ts +2 -2
  21. package/lib/Types/Chat.d.ts +13 -13
  22. package/lib/Types/Events.d.ts +3 -3
  23. package/lib/Types/GroupMetadata.d.ts +2 -2
  24. package/lib/Types/LabelAssociation.d.ts +2 -2
  25. package/lib/Types/Message.d.ts +57 -45
  26. package/lib/Types/Product.d.ts +14 -14
  27. package/lib/Types/Signal.d.ts +10 -10
  28. package/lib/Types/Socket.d.ts +5 -4
  29. package/lib/Types/State.d.ts +2 -2
  30. package/lib/Types/index.d.ts +5 -5
  31. package/lib/Utils/auth-utils.js +3 -1
  32. package/lib/Utils/chat-utils.d.ts +4 -4
  33. package/lib/Utils/crypto.d.ts +3 -0
  34. package/lib/Utils/crypto.js +15 -1
  35. package/lib/Utils/event-buffer.d.ts +2 -2
  36. package/lib/Utils/event-buffer.js +3 -3
  37. package/lib/Utils/generics.d.ts +7 -6
  38. package/lib/Utils/generics.js +25 -27
  39. package/lib/Utils/link-preview.d.ts +1 -1
  40. package/lib/Utils/link-preview.js +1 -24
  41. package/lib/Utils/make-mutex.d.ts +1 -1
  42. package/lib/Utils/messages-media.d.ts +9 -3
  43. package/lib/Utils/messages-media.js +54 -6
  44. package/lib/Utils/messages.d.ts +6 -5
  45. package/lib/Utils/messages.js +35 -1
  46. package/lib/Utils/process-message.d.ts +2 -2
  47. package/lib/Utils/validate-connection.js +1 -2
  48. package/lib/WABinary/jid-utils.d.ts +4 -4
  49. package/lib/WABinary/types.d.ts +4 -4
  50. package/lib/index.d.ts +1 -1
  51. package/package.json +6 -5
@@ -7,14 +7,14 @@ import type { BaileysEventEmitter, Chat, ConnectionState, Contact, GroupMetadata
7
7
  import { Label } from '../Types/Label';
8
8
  import { LabelAssociation } from '../Types/LabelAssociation';
9
9
  import { ObjectRepository } from './object-repository';
10
- declare type WASocket = ReturnType<typeof makeMDSocket>;
10
+ type WASocket = ReturnType<typeof makeMDSocket>;
11
11
  export declare const waChatKey: (pin: boolean) => {
12
12
  key: (c: Chat) => string;
13
13
  compare: (k1: string, k2: string) => number;
14
14
  };
15
15
  export declare const waMessageID: (m: WAMessage) => string;
16
16
  export declare const waLabelAssociationKey: Comparable<LabelAssociation, string>;
17
- export declare type BaileysInMemoryStoreConfig = {
17
+ export type BaileysInMemoryStoreConfig = {
18
18
  chatKey?: Comparable<Chat, string>;
19
19
  labelAssociationKey?: Comparable<LabelAssociation, string>;
20
20
  logger?: Logger;
@@ -3,25 +3,25 @@ import type { proto } from '../../WAProto';
3
3
  import { RegistrationOptions } from '../Socket/registration';
4
4
  import type { Contact } from './Contact';
5
5
  import type { MinimalMessage } from './Message';
6
- export declare type KeyPair = {
6
+ export type KeyPair = {
7
7
  public: Uint8Array;
8
8
  private: Uint8Array;
9
9
  };
10
- export declare type SignedKeyPair = {
10
+ export type SignedKeyPair = {
11
11
  keyPair: KeyPair;
12
12
  signature: Uint8Array;
13
13
  keyId: number;
14
14
  timestampS?: number;
15
15
  };
16
- export declare type ProtocolAddress = {
16
+ export type ProtocolAddress = {
17
17
  name: string;
18
18
  deviceId: number;
19
19
  };
20
- export declare type SignalIdentity = {
20
+ export type SignalIdentity = {
21
21
  identifier: ProtocolAddress;
22
22
  identifierKey: Uint8Array;
23
23
  };
24
- export declare type LTHashState = {
24
+ export type LTHashState = {
25
25
  version: number;
26
26
  hash: Buffer;
27
27
  indexValueMap: {
@@ -30,20 +30,21 @@ export declare type LTHashState = {
30
30
  };
31
31
  };
32
32
  };
33
- export declare type SignalCreds = {
33
+ export type SignalCreds = {
34
34
  readonly signedIdentityKey: KeyPair;
35
35
  readonly signedPreKey: SignedKeyPair;
36
36
  readonly registrationId: number;
37
37
  };
38
- export declare type AccountSettings = {
38
+ export type AccountSettings = {
39
39
  /** unarchive chats when a new message is received */
40
40
  unarchiveChats: boolean;
41
41
  /** the default mode to start new conversations with */
42
42
  defaultDisappearingMode?: Pick<proto.IConversation, 'ephemeralExpiration' | 'ephemeralSettingTimestamp'>;
43
43
  };
44
- export declare type AuthenticationCreds = SignalCreds & {
44
+ export type AuthenticationCreds = SignalCreds & {
45
45
  readonly noiseKey: KeyPair;
46
- readonly advSecretKey: string;
46
+ readonly pairingEphemeralKeyPair: KeyPair;
47
+ advSecretKey: string;
47
48
  me?: Contact;
48
49
  account?: proto.IADVSignedDeviceIdentity;
49
50
  signalIdentities?: SignalIdentity[];
@@ -62,8 +63,9 @@ export declare type AuthenticationCreds = SignalCreds & {
62
63
  registered: boolean;
63
64
  backupToken: Buffer;
64
65
  registration: RegistrationOptions;
66
+ pairingCode: string | undefined;
65
67
  };
66
- export declare type SignalDataTypeMap = {
68
+ export type SignalDataTypeMap = {
67
69
  'pre-key': KeyPair;
68
70
  'session': Uint8Array;
69
71
  'sender-key': Uint8Array;
@@ -73,13 +75,13 @@ export declare type SignalDataTypeMap = {
73
75
  'app-state-sync-key': proto.Message.IAppStateSyncKeyData;
74
76
  'app-state-sync-version': LTHashState;
75
77
  };
76
- export declare type SignalDataSet = {
78
+ export type SignalDataSet = {
77
79
  [T in keyof SignalDataTypeMap]?: {
78
80
  [id: string]: SignalDataTypeMap[T] | null;
79
81
  };
80
82
  };
81
- declare type Awaitable<T> = T | Promise<T>;
82
- export declare type SignalKeyStore = {
83
+ type Awaitable<T> = T | Promise<T>;
84
+ export type SignalKeyStore = {
83
85
  get<T extends keyof SignalDataTypeMap>(type: T, ids: string[]): Awaitable<{
84
86
  [id: string]: SignalDataTypeMap[T];
85
87
  }>;
@@ -87,19 +89,19 @@ export declare type SignalKeyStore = {
87
89
  /** clear all the data in the store */
88
90
  clear?(): Awaitable<void>;
89
91
  };
90
- export declare type SignalKeyStoreWithTransaction = SignalKeyStore & {
92
+ export type SignalKeyStoreWithTransaction = SignalKeyStore & {
91
93
  isInTransaction: () => boolean;
92
94
  transaction<T>(exec: () => Promise<T>): Promise<T>;
93
95
  };
94
- export declare type TransactionCapabilityOptions = {
96
+ export type TransactionCapabilityOptions = {
95
97
  maxCommitRetries: number;
96
98
  delayBetweenTriesMs: number;
97
99
  };
98
- export declare type SignalAuthState = {
100
+ export type SignalAuthState = {
99
101
  creds: SignalCreds;
100
102
  keys: SignalKeyStore | SignalKeyStoreWithTransaction;
101
103
  };
102
- export declare type AuthenticationState = {
104
+ export type AuthenticationState = {
103
105
  creds: AuthenticationCreds;
104
106
  keys: SignalKeyStore;
105
107
  };
@@ -1,5 +1,5 @@
1
- export declare type WACallUpdateType = 'offer' | 'ringing' | 'timeout' | 'reject' | 'accept';
2
- export declare type WACallEvent = {
1
+ export type WACallUpdateType = 'offer' | 'ringing' | 'timeout' | 'reject' | 'accept';
2
+ export type WACallEvent = {
3
3
  chatId: string;
4
4
  from: string;
5
5
  isGroup?: boolean;
@@ -5,33 +5,33 @@ import type { ChatLabelAssociationActionBody } from './LabelAssociation';
5
5
  import type { MessageLabelAssociationActionBody } from './LabelAssociation';
6
6
  import type { MinimalMessage } from './Message';
7
7
  /** privacy settings in WhatsApp Web */
8
- export declare type WAPrivacyValue = 'all' | 'contacts' | 'contact_blacklist' | 'none';
9
- export declare type WAPrivacyOnlineValue = 'all' | 'match_last_seen';
10
- export declare type WAReadReceiptsValue = 'all' | 'none';
8
+ export type WAPrivacyValue = 'all' | 'contacts' | 'contact_blacklist' | 'none';
9
+ export type WAPrivacyOnlineValue = 'all' | 'match_last_seen';
10
+ export type WAReadReceiptsValue = 'all' | 'none';
11
11
  /** set of statuses visible to other people; see updatePresence() in WhatsAppWeb.Send */
12
- export declare type WAPresence = 'unavailable' | 'available' | 'composing' | 'recording' | 'paused';
12
+ export type WAPresence = 'unavailable' | 'available' | 'composing' | 'recording' | 'paused';
13
13
  export declare const ALL_WA_PATCH_NAMES: readonly ["critical_block", "critical_unblock_low", "regular_high", "regular_low", "regular"];
14
- export declare type WAPatchName = typeof ALL_WA_PATCH_NAMES[number];
14
+ export type WAPatchName = typeof ALL_WA_PATCH_NAMES[number];
15
15
  export interface PresenceData {
16
16
  lastKnownPresence: WAPresence;
17
17
  lastSeen?: number;
18
18
  }
19
- export declare type ChatMutation = {
19
+ export type ChatMutation = {
20
20
  syncAction: proto.ISyncActionData;
21
21
  index: string[];
22
22
  };
23
- export declare type WAPatchCreate = {
23
+ export type WAPatchCreate = {
24
24
  syncAction: proto.ISyncActionValue;
25
25
  index: string[];
26
26
  type: WAPatchName;
27
27
  apiVersion: number;
28
28
  operation: proto.SyncdMutation.SyncdOperation;
29
29
  };
30
- export declare type Chat = proto.IConversation & {
30
+ export type Chat = proto.IConversation & {
31
31
  /** unix timestamp of when the last message was received in the chat */
32
32
  lastMessageRecvTimestamp?: number;
33
33
  };
34
- export declare type ChatUpdate = Partial<Chat & {
34
+ export type ChatUpdate = Partial<Chat & {
35
35
  /**
36
36
  * if specified in the update,
37
37
  * the EV buffer will check if the condition gets fulfilled before applying the update
@@ -47,8 +47,8 @@ export declare type ChatUpdate = Partial<Chat & {
47
47
  * the last messages in a chat, sorted reverse-chronologically. That is, the latest message should be first in the chat
48
48
  * for MD modifications, the last message in the array (i.e. the earlist message) must be the last message recv in the chat
49
49
  * */
50
- export declare type LastMessageList = MinimalMessage[] | proto.SyncActionValue.ISyncActionMessageRange;
51
- export declare type ChatModification = {
50
+ export type LastMessageList = MinimalMessage[] | proto.SyncActionValue.ISyncActionMessageRange;
51
+ export type ChatModification = {
52
52
  archive: boolean;
53
53
  lastMessages: LastMessageList;
54
54
  } | {
@@ -89,7 +89,7 @@ export declare type ChatModification = {
89
89
  } | {
90
90
  removeMessageLabel: MessageLabelAssociationActionBody;
91
91
  };
92
- export declare type InitialReceivedChatsState = {
92
+ export type InitialReceivedChatsState = {
93
93
  [jid: string]: {
94
94
  /** the last message received from the other party */
95
95
  lastMsgRecvTimestamp?: number;
@@ -97,6 +97,6 @@ export declare type InitialReceivedChatsState = {
97
97
  lastMsgTimestamp: number;
98
98
  };
99
99
  };
100
- export declare type InitialAppStateSyncOptions = {
100
+ export type InitialAppStateSyncOptions = {
101
101
  accountSettings: AccountSettings;
102
102
  };
@@ -9,7 +9,7 @@ import { Label } from './Label';
9
9
  import { LabelAssociation } from './LabelAssociation';
10
10
  import { MessageUpsertType, MessageUserReceiptUpdate, WAMessage, WAMessageKey, WAMessageUpdate } from './Message';
11
11
  import { ConnectionState } from './State';
12
- export declare type BaileysEventMap = {
12
+ export type BaileysEventMap = {
13
13
  /** connection state has been updated -- WS closed, opened, connecting etc. */
14
14
  'connection.update': Partial<ConnectionState>;
15
15
  /** credentials updated -- some metadata, keys or something */
@@ -88,7 +88,7 @@ export declare type BaileysEventMap = {
88
88
  type: 'add' | 'remove';
89
89
  };
90
90
  };
91
- export declare type BufferedEventData = {
91
+ export type BufferedEventData = {
92
92
  historySets: {
93
93
  chats: {
94
94
  [jid: string]: Chat;
@@ -143,7 +143,7 @@ export declare type BufferedEventData = {
143
143
  [jid: string]: Partial<GroupMetadata>;
144
144
  };
145
145
  };
146
- export declare type BaileysEvent = keyof BaileysEventMap;
146
+ export type BaileysEvent = keyof BaileysEventMap;
147
147
  export interface BaileysEventEmitter {
148
148
  on<T extends keyof BaileysEventMap>(event: T, listener: (arg: BaileysEventMap[T]) => void): void;
149
149
  off<T extends keyof BaileysEventMap>(event: T, listener: (arg: BaileysEventMap[T]) => void): void;
@@ -1,10 +1,10 @@
1
1
  import { Contact } from './Contact';
2
- export declare type GroupParticipant = (Contact & {
2
+ export type GroupParticipant = (Contact & {
3
3
  isAdmin?: boolean;
4
4
  isSuperAdmin?: boolean;
5
5
  admin?: 'admin' | 'superadmin' | null;
6
6
  });
7
- export declare type ParticipantAction = 'add' | 'remove' | 'promote' | 'demote';
7
+ export type ParticipantAction = 'add' | 'remove' | 'promote' | 'demote';
8
8
  export interface GroupMetadata {
9
9
  id: string;
10
10
  owner: string | undefined;
@@ -3,7 +3,7 @@ export declare enum LabelAssociationType {
3
3
  Chat = "label_jid",
4
4
  Message = "label_message"
5
5
  }
6
- export declare type LabelAssociationTypes = `${LabelAssociationType}`;
6
+ export type LabelAssociationTypes = `${LabelAssociationType}`;
7
7
  /** Association for chat */
8
8
  export interface ChatLabelAssociation {
9
9
  type: LabelAssociationType.Chat;
@@ -17,7 +17,7 @@ export interface MessageLabelAssociation {
17
17
  messageId: string;
18
18
  labelId: string;
19
19
  }
20
- export declare type LabelAssociation = ChatLabelAssociation | MessageLabelAssociation;
20
+ export type LabelAssociation = ChatLabelAssociation | MessageLabelAssociation;
21
21
  /** Body for add/remove chat label association action */
22
22
  export interface ChatLabelAssociationActionBody {
23
23
  labelId: string;
@@ -1,4 +1,6 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ /// <reference types="node" />
2
4
  import { AxiosRequestConfig } from 'axios';
3
5
  import type { Logger } from 'pino';
4
6
  import type { Readable } from 'stream';
@@ -8,31 +10,31 @@ import { MEDIA_HKDF_KEY_MAPPING } from '../Defaults';
8
10
  import type { GroupMetadata } from './GroupMetadata';
9
11
  import { CacheStore } from './Socket';
10
12
  export { proto as WAProto };
11
- export declare type WAMessage = proto.IWebMessageInfo;
12
- export declare type WAMessageContent = proto.IMessage;
13
- export declare type WAContactMessage = proto.Message.IContactMessage;
14
- export declare type WAContactsArrayMessage = proto.Message.IContactsArrayMessage;
15
- export declare type WAMessageKey = proto.IMessageKey;
16
- export declare type WATextMessage = proto.Message.IExtendedTextMessage;
17
- export declare type WAContextInfo = proto.IContextInfo;
18
- export declare type WALocationMessage = proto.Message.ILocationMessage;
19
- export declare type WAGenericMediaMessage = proto.Message.IVideoMessage | proto.Message.IImageMessage | proto.Message.IAudioMessage | proto.Message.IDocumentMessage | proto.Message.IStickerMessage;
13
+ export type WAMessage = proto.IWebMessageInfo;
14
+ export type WAMessageContent = proto.IMessage;
15
+ export type WAContactMessage = proto.Message.IContactMessage;
16
+ export type WAContactsArrayMessage = proto.Message.IContactsArrayMessage;
17
+ export type WAMessageKey = proto.IMessageKey;
18
+ export type WATextMessage = proto.Message.IExtendedTextMessage;
19
+ export type WAContextInfo = proto.IContextInfo;
20
+ export type WALocationMessage = proto.Message.ILocationMessage;
21
+ export type WAGenericMediaMessage = proto.Message.IVideoMessage | proto.Message.IImageMessage | proto.Message.IAudioMessage | proto.Message.IDocumentMessage | proto.Message.IStickerMessage;
20
22
  export import WAMessageStubType = proto.WebMessageInfo.StubType;
21
23
  export import WAMessageStatus = proto.WebMessageInfo.Status;
22
- export declare type WAMediaUpload = Buffer | {
24
+ export type WAMediaUpload = Buffer | {
23
25
  url: URL | string;
24
26
  } | {
25
27
  stream: Readable;
26
28
  };
27
29
  /** Set of message types that are supported by the library */
28
- export declare type MessageType = keyof proto.Message;
29
- export declare type DownloadableMessage = {
30
+ export type MessageType = keyof proto.Message;
31
+ export type DownloadableMessage = {
30
32
  mediaKey?: Uint8Array | null;
31
33
  directPath?: string | null;
32
34
  url?: string | null;
33
35
  };
34
- export declare type MessageReceiptType = 'read' | 'read-self' | 'hist_sync' | 'peer_msg' | 'sender' | 'inactive' | 'played' | undefined;
35
- export declare type MediaConnInfo = {
36
+ export type MessageReceiptType = 'read' | 'read-self' | 'hist_sync' | 'peer_msg' | 'sender' | 'inactive' | 'played' | undefined;
37
+ export type MediaConnInfo = {
36
38
  auth: string;
37
39
  ttl: number;
38
40
  hosts: {
@@ -50,30 +52,30 @@ export interface WAUrlInfo {
50
52
  highQualityThumbnail?: proto.Message.IImageMessage;
51
53
  originalThumbnailUrl?: string;
52
54
  }
53
- declare type Mentionable = {
55
+ type Mentionable = {
54
56
  /** list of jids that are mentioned in the accompanying text */
55
57
  mentions?: string[];
56
58
  };
57
- declare type Contextable = {
59
+ type Contextable = {
58
60
  /** add contextInfo to the message */
59
61
  contextInfo?: proto.IContextInfo;
60
62
  };
61
- declare type ViewOnce = {
63
+ type ViewOnce = {
62
64
  viewOnce?: boolean;
63
65
  };
64
- declare type Buttonable = {
66
+ type Buttonable = {
65
67
  /** add buttons to the message */
66
68
  buttons?: proto.Message.ButtonsMessage.IButton[];
67
69
  };
68
- declare type Templatable = {
70
+ type Templatable = {
69
71
  /** add buttons to the message (conflicts with normal buttons)*/
70
72
  templateButtons?: proto.IHydratedTemplateButton[];
71
73
  footer?: string;
72
74
  };
73
- declare type Editable = {
75
+ type Editable = {
74
76
  edit?: WAMessageKey;
75
77
  };
76
- declare type Listable = {
78
+ type Listable = {
77
79
  /** Sections of the List */
78
80
  sections?: proto.Message.ListMessage.ISection[];
79
81
  /** Title of a List Message only */
@@ -81,19 +83,19 @@ declare type Listable = {
81
83
  /** Text of the bnutton on the list (required) */
82
84
  buttonText?: string;
83
85
  };
84
- declare type WithDimensions = {
86
+ type WithDimensions = {
85
87
  width?: number;
86
88
  height?: number;
87
89
  };
88
- export declare type PollMessageOptions = {
90
+ export type PollMessageOptions = {
89
91
  name: string;
90
92
  selectableCount?: number;
91
93
  values: string[];
92
94
  /** 32 byte message secret to encrypt poll selections */
93
95
  messageSecret?: Uint8Array;
94
96
  };
95
- export declare type MediaType = keyof typeof MEDIA_HKDF_KEY_MAPPING;
96
- export declare type AnyMediaMessageContent = (({
97
+ export type MediaType = keyof typeof MEDIA_HKDF_KEY_MAPPING;
98
+ export type AnyMediaMessageContent = (({
97
99
  image: WAMediaUpload;
98
100
  caption?: string;
99
101
  jpegThumbnail?: string;
@@ -119,15 +121,15 @@ export declare type AnyMediaMessageContent = (({
119
121
  } & Contextable & Buttonable & Templatable)) & {
120
122
  mimetype?: string;
121
123
  } & Editable;
122
- export declare type ButtonReplyInfo = {
124
+ export type ButtonReplyInfo = {
123
125
  displayText: string;
124
126
  id: string;
125
127
  index: number;
126
128
  };
127
- export declare type WASendableProduct = Omit<proto.Message.ProductMessage.IProductSnapshot, 'productImage'> & {
129
+ export type WASendableProduct = Omit<proto.Message.ProductMessage.IProductSnapshot, 'productImage'> & {
128
130
  productImage: WAMediaUpload;
129
131
  };
130
- export declare type AnyRegularMessageContent = (({
132
+ export type AnyRegularMessageContent = (({
131
133
  text: string;
132
134
  linkPreview?: WAUrlInfo | null;
133
135
  } & Mentionable & Contextable & Buttonable & Templatable & Listable & Editable) | AnyMediaMessageContent | ({
@@ -152,7 +154,7 @@ export declare type AnyRegularMessageContent = (({
152
154
  body?: string;
153
155
  footer?: string;
154
156
  }) & ViewOnce;
155
- export declare type AnyMessageContent = AnyRegularMessageContent | {
157
+ export type AnyMessageContent = AnyRegularMessageContent | {
156
158
  forward: WAMessage;
157
159
  force?: boolean;
158
160
  } | {
@@ -161,14 +163,14 @@ export declare type AnyMessageContent = AnyRegularMessageContent | {
161
163
  } | {
162
164
  disappearingMessagesInChat: boolean | number;
163
165
  };
164
- export declare type GroupMetadataParticipants = Pick<GroupMetadata, 'participants'>;
165
- declare type MinimalRelayOptions = {
166
+ export type GroupMetadataParticipants = Pick<GroupMetadata, 'participants'>;
167
+ type MinimalRelayOptions = {
166
168
  /** override the message ID with a custom provided string */
167
169
  messageId?: string;
168
170
  /** cached group metadata, use to prevent redundant requests to WA & speed up msg sending */
169
171
  cachedGroupMetadata?: (jid: string) => Promise<GroupMetadataParticipants | undefined>;
170
172
  };
171
- export declare type MessageRelayOptions = MinimalRelayOptions & {
173
+ export type MessageRelayOptions = MinimalRelayOptions & {
172
174
  /** only send to a specific participant; used when a message decryption fails for a single user */
173
175
  participant?: {
174
176
  jid: string;
@@ -180,8 +182,10 @@ export declare type MessageRelayOptions = MinimalRelayOptions & {
180
182
  };
181
183
  /** should we use the devices cache, or fetch afresh from the server; default assumed to be "true" */
182
184
  useUserDevicesCache?: boolean;
185
+ /** jid list of participants for status@broadcast */
186
+ statusJidList?: string[];
183
187
  };
184
- export declare type MiscMessageGenerationOptions = MinimalRelayOptions & {
188
+ export type MiscMessageGenerationOptions = MinimalRelayOptions & {
185
189
  /** optional, if you want to manually set the timestamp of the message */
186
190
  timestamp?: Date;
187
191
  /** the message you want to quote */
@@ -192,11 +196,17 @@ export declare type MiscMessageGenerationOptions = MinimalRelayOptions & {
192
196
  ephemeralExpiration?: number | string;
193
197
  /** timeout for media upload to WA server */
194
198
  mediaUploadTimeoutMs?: number;
199
+ /** jid list of participants for status@broadcast */
200
+ statusJidList?: string[];
201
+ /** backgroundcolor for status */
202
+ backgroundColor?: string;
203
+ /** font type for status */
204
+ font?: number;
195
205
  };
196
- export declare type MessageGenerationOptionsFromContent = MiscMessageGenerationOptions & {
206
+ export type MessageGenerationOptionsFromContent = MiscMessageGenerationOptions & {
197
207
  userJid: string;
198
208
  };
199
- export declare type WAMediaUploadFunction = (readStream: Readable, opts: {
209
+ export type WAMediaUploadFunction = (readStream: Readable, opts: {
200
210
  fileEncSha256B64: string;
201
211
  mediaType: MediaType;
202
212
  timeoutMs?: number;
@@ -204,7 +214,7 @@ export declare type WAMediaUploadFunction = (readStream: Readable, opts: {
204
214
  mediaUrl: string;
205
215
  directPath: string;
206
216
  }>;
207
- export declare type MediaGenerationOptions = {
217
+ export type MediaGenerationOptions = {
208
218
  logger?: Logger;
209
219
  mediaTypeOverride?: MediaType;
210
220
  upload: WAMediaUploadFunction;
@@ -212,34 +222,36 @@ export declare type MediaGenerationOptions = {
212
222
  mediaCache?: CacheStore;
213
223
  mediaUploadTimeoutMs?: number;
214
224
  options?: AxiosRequestConfig;
225
+ backgroundColor?: string;
226
+ font?: number;
215
227
  };
216
- export declare type MessageContentGenerationOptions = MediaGenerationOptions & {
228
+ export type MessageContentGenerationOptions = MediaGenerationOptions & {
217
229
  getUrlInfo?: (text: string) => Promise<WAUrlInfo | undefined>;
218
230
  };
219
- export declare type MessageGenerationOptions = MessageContentGenerationOptions & MessageGenerationOptionsFromContent;
231
+ export type MessageGenerationOptions = MessageContentGenerationOptions & MessageGenerationOptionsFromContent;
220
232
  /**
221
233
  * Type of message upsert
222
234
  * 1. notify => notify the user, this message was just received
223
235
  * 2. append => append the message to the chat history, no notification required
224
236
  */
225
- export declare type MessageUpsertType = 'append' | 'notify';
226
- export declare type MessageUserReceipt = proto.IUserReceipt;
227
- export declare type WAMessageUpdate = {
237
+ export type MessageUpsertType = 'append' | 'notify';
238
+ export type MessageUserReceipt = proto.IUserReceipt;
239
+ export type WAMessageUpdate = {
228
240
  update: Partial<WAMessage>;
229
241
  key: proto.IMessageKey;
230
242
  };
231
- export declare type WAMessageCursor = {
243
+ export type WAMessageCursor = {
232
244
  before: WAMessageKey | undefined;
233
245
  } | {
234
246
  after: WAMessageKey | undefined;
235
247
  };
236
- export declare type MessageUserReceiptUpdate = {
248
+ export type MessageUserReceiptUpdate = {
237
249
  key: proto.IMessageKey;
238
250
  receipt: MessageUserReceipt;
239
251
  };
240
- export declare type MediaDecryptionKeyInfo = {
252
+ export type MediaDecryptionKeyInfo = {
241
253
  iv: Buffer;
242
254
  cipherKey: Buffer;
243
255
  macKey?: Buffer;
244
256
  };
245
- export declare type MinimalMessage = Pick<proto.IWebMessageInfo, 'key' | 'messageTimestamp'>;
257
+ export type MinimalMessage = Pick<proto.IWebMessageInfo, 'key' | 'messageTimestamp'>;
@@ -1,5 +1,5 @@
1
1
  import { WAMediaUpload } from './Message';
2
- export declare type CatalogResult = {
2
+ export type CatalogResult = {
3
3
  data: {
4
4
  paging: {
5
5
  cursors: {
@@ -10,23 +10,23 @@ export declare type CatalogResult = {
10
10
  data: any[];
11
11
  };
12
12
  };
13
- export declare type ProductCreateResult = {
13
+ export type ProductCreateResult = {
14
14
  data: {
15
15
  product: {};
16
16
  };
17
17
  };
18
- export declare type CatalogStatus = {
18
+ export type CatalogStatus = {
19
19
  status: string;
20
20
  canAppeal: boolean;
21
21
  };
22
- export declare type CatalogCollection = {
22
+ export type CatalogCollection = {
23
23
  id: string;
24
24
  name: string;
25
25
  products: Product[];
26
26
  status: CatalogStatus;
27
27
  };
28
- export declare type ProductAvailability = 'in stock';
29
- export declare type ProductBase = {
28
+ export type ProductAvailability = 'in stock';
29
+ export type ProductBase = {
30
30
  name: string;
31
31
  retailerId?: string;
32
32
  url?: string;
@@ -35,14 +35,14 @@ export declare type ProductBase = {
35
35
  currency: string;
36
36
  isHidden?: boolean;
37
37
  };
38
- export declare type ProductCreate = ProductBase & {
38
+ export type ProductCreate = ProductBase & {
39
39
  /** ISO country code for product origin. Set to undefined for no country */
40
40
  originCountryCode: string | undefined;
41
41
  /** images of the product */
42
42
  images: WAMediaUpload[];
43
43
  };
44
- export declare type ProductUpdate = Omit<ProductCreate, 'originCountryCode'>;
45
- export declare type Product = ProductBase & {
44
+ export type ProductUpdate = Omit<ProductCreate, 'originCountryCode'>;
45
+ export type Product = ProductBase & {
46
46
  id: string;
47
47
  imageUrls: {
48
48
  [_: string]: string;
@@ -52,11 +52,11 @@ export declare type Product = ProductBase & {
52
52
  };
53
53
  availability: ProductAvailability;
54
54
  };
55
- export declare type OrderPrice = {
55
+ export type OrderPrice = {
56
56
  currency: string;
57
57
  total: number;
58
58
  };
59
- export declare type OrderProduct = {
59
+ export type OrderProduct = {
60
60
  id: string;
61
61
  imageUrl: string;
62
62
  name: string;
@@ -64,12 +64,12 @@ export declare type OrderProduct = {
64
64
  currency: string;
65
65
  price: number;
66
66
  };
67
- export declare type OrderDetails = {
67
+ export type OrderDetails = {
68
68
  price: OrderPrice;
69
69
  products: OrderProduct[];
70
70
  };
71
- export declare type CatalogCursor = string;
72
- export declare type GetCatalogOptions = {
71
+ export type CatalogCursor = string;
72
+ export type GetCatalogOptions = {
73
73
  /** cursor to start from */
74
74
  cursor?: CatalogCursor;
75
75
  /** number of products to fetch */
@@ -1,45 +1,45 @@
1
1
  import { proto } from '../../WAProto';
2
- declare type DecryptGroupSignalOpts = {
2
+ type DecryptGroupSignalOpts = {
3
3
  group: string;
4
4
  authorJid: string;
5
5
  msg: Uint8Array;
6
6
  };
7
- declare type ProcessSenderKeyDistributionMessageOpts = {
7
+ type ProcessSenderKeyDistributionMessageOpts = {
8
8
  item: proto.Message.ISenderKeyDistributionMessage;
9
9
  authorJid: string;
10
10
  };
11
- declare type DecryptSignalProtoOpts = {
11
+ type DecryptSignalProtoOpts = {
12
12
  jid: string;
13
13
  type: 'pkmsg' | 'msg';
14
14
  ciphertext: Uint8Array;
15
15
  };
16
- declare type EncryptMessageOpts = {
16
+ type EncryptMessageOpts = {
17
17
  jid: string;
18
18
  data: Uint8Array;
19
19
  };
20
- declare type EncryptGroupMessageOpts = {
20
+ type EncryptGroupMessageOpts = {
21
21
  group: string;
22
22
  data: Uint8Array;
23
23
  meId: string;
24
24
  };
25
- declare type PreKey = {
25
+ type PreKey = {
26
26
  keyId: number;
27
27
  publicKey: Uint8Array;
28
28
  };
29
- declare type SignedPreKey = PreKey & {
29
+ type SignedPreKey = PreKey & {
30
30
  signature: Uint8Array;
31
31
  };
32
- declare type E2ESession = {
32
+ type E2ESession = {
33
33
  registrationId: number;
34
34
  identityKey: Uint8Array;
35
35
  signedPreKey: SignedPreKey;
36
36
  preKey: PreKey;
37
37
  };
38
- declare type E2ESessionOpts = {
38
+ type E2ESessionOpts = {
39
39
  jid: string;
40
40
  session: E2ESession;
41
41
  };
42
- export declare type SignalRepository = {
42
+ export type SignalRepository = {
43
43
  decryptGroupMessage(opts: DecryptGroupSignalOpts): Promise<Uint8Array>;
44
44
  processSenderKeyDistributionMessage(opts: ProcessSenderKeyDistributionMessageOpts): Promise<void>;
45
45
  decryptMessage(opts: DecryptSignalProtoOpts): Promise<Uint8Array>;