alipclutch-baileys 6.7.0 → 7.1.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 (121) hide show
  1. package/LICENSE +1 -1
  2. package/WAProto/index.js +77698 -117050
  3. package/engine-requirements.js +3 -3
  4. package/lib/Defaults/baileys-version.json +3 -0
  5. package/lib/Defaults/index.d.ts +6 -4
  6. package/lib/Defaults/index.js +118 -78
  7. package/lib/Defaults/phonenumber-mcc.json +223 -0
  8. package/lib/Socket/Client/abstract-socket-client.d.ts +17 -0
  9. package/lib/Socket/Client/abstract-socket-client.js +13 -0
  10. package/lib/Socket/Client/index.d.ts +3 -2
  11. package/lib/Socket/Client/index.js +3 -2
  12. package/lib/Socket/Client/mobile-socket-client.d.ts +13 -0
  13. package/lib/Socket/Client/mobile-socket-client.js +65 -0
  14. package/lib/Socket/Client/types.d.ts +1 -0
  15. package/lib/Socket/Client/types.js +1 -0
  16. package/lib/Socket/Client/web-socket-client.d.ts +12 -0
  17. package/lib/Socket/Client/web-socket-client.js +62 -0
  18. package/lib/Socket/Client/websocket.d.ts +1 -0
  19. package/lib/Socket/Client/websocket.js +1 -0
  20. package/lib/Socket/business.d.ts +58 -59
  21. package/lib/Socket/chats.d.ts +230 -45
  22. package/lib/Socket/chats.js +238 -139
  23. package/lib/Socket/dugong.d.ts +254 -0
  24. package/lib/Socket/dugong.js +483 -0
  25. package/lib/Socket/groups.d.ts +32 -41
  26. package/lib/Socket/groups.js +23 -38
  27. package/lib/Socket/index.d.ts +64 -63
  28. package/lib/Socket/index.js +3 -2
  29. package/lib/Socket/messages-recv.js +65 -9
  30. package/lib/Socket/messages-send.d.ts +47 -49
  31. package/lib/Socket/messages-send.js +420 -382
  32. package/lib/Socket/newsletter.d.ts +37 -39
  33. package/lib/Socket/newsletter.js +124 -71
  34. package/lib/Socket/registration.d.ts +267 -0
  35. package/lib/Socket/registration.js +166 -0
  36. package/lib/Socket/socket.d.ts +10 -10
  37. package/lib/Socket/socket.js +38 -62
  38. package/lib/Socket/usync.d.ts +4 -3
  39. package/lib/Socket/usync.js +1 -0
  40. package/lib/Store/index.d.ts +2 -1
  41. package/lib/Store/index.js +3 -1
  42. package/lib/Store/make-cache-manager-store.d.ts +13 -0
  43. package/lib/Store/make-cache-manager-store.js +83 -0
  44. package/lib/Store/make-in-memory-store.d.ts +24 -24
  45. package/lib/Store/make-in-memory-store.js +14 -26
  46. package/lib/Store/make-ordered-dictionary.d.ts +1 -1
  47. package/lib/Store/make-ordered-dictionary.js +2 -2
  48. package/lib/Types/Auth.d.ts +7 -0
  49. package/lib/Types/Call.d.ts +1 -1
  50. package/lib/Types/Chat.d.ts +7 -14
  51. package/lib/Types/Contact.d.ts +1 -5
  52. package/lib/Types/Events.d.ts +2 -44
  53. package/lib/Types/GroupMetadata.d.ts +2 -11
  54. package/lib/Types/Label.js +1 -1
  55. package/lib/Types/LabelAssociation.js +1 -1
  56. package/lib/Types/Message.d.ts +21 -148
  57. package/lib/Types/Message.js +2 -0
  58. package/lib/Types/Newsletter.d.ts +97 -73
  59. package/lib/Types/Newsletter.js +38 -18
  60. package/lib/Types/Socket.d.ts +9 -17
  61. package/lib/Types/index.d.ts +1 -8
  62. package/lib/Types/index.js +2 -2
  63. package/lib/Utils/auth-utils.d.ts +3 -3
  64. package/lib/Utils/auth-utils.js +13 -6
  65. package/lib/Utils/business.js +2 -2
  66. package/lib/Utils/chat-utils.d.ts +16 -15
  67. package/lib/Utils/chat-utils.js +35 -36
  68. package/lib/Utils/crypto.d.ts +16 -15
  69. package/lib/Utils/crypto.js +29 -71
  70. package/lib/Utils/decode-wa-message.d.ts +6 -22
  71. package/lib/Utils/decode-wa-message.js +56 -65
  72. package/lib/Utils/event-buffer.d.ts +2 -2
  73. package/lib/Utils/event-buffer.js +7 -11
  74. package/lib/Utils/generics.d.ts +20 -17
  75. package/lib/Utils/generics.js +76 -96
  76. package/lib/Utils/history.d.ts +0 -4
  77. package/lib/Utils/history.js +6 -4
  78. package/lib/Utils/link-preview.d.ts +2 -2
  79. package/lib/Utils/link-preview.js +1 -34
  80. package/lib/Utils/logger.d.ts +3 -10
  81. package/lib/Utils/lt-hash.d.ts +2 -2
  82. package/lib/Utils/lt-hash.js +6 -6
  83. package/lib/Utils/make-mutex.d.ts +2 -2
  84. package/lib/Utils/messages-media.d.ts +24 -28
  85. package/lib/Utils/messages-media.js +236 -296
  86. package/lib/Utils/messages.d.ts +10 -13
  87. package/lib/Utils/messages.js +92 -325
  88. package/lib/Utils/noise-handler.d.ts +12 -10
  89. package/lib/Utils/noise-handler.js +23 -18
  90. package/lib/Utils/process-message.d.ts +4 -5
  91. package/lib/Utils/process-message.js +25 -108
  92. package/lib/Utils/signal.d.ts +1 -2
  93. package/lib/Utils/signal.js +26 -26
  94. package/lib/Utils/use-multi-file-auth-state.d.ts +1 -0
  95. package/lib/Utils/use-multi-file-auth-state.js +6 -51
  96. package/lib/Utils/validate-connection.d.ts +4 -3
  97. package/lib/Utils/validate-connection.js +52 -20
  98. package/lib/WABinary/constants.d.ts +27 -24
  99. package/lib/WABinary/constants.js +13 -1276
  100. package/lib/WABinary/decode.d.ts +4 -3
  101. package/lib/WABinary/decode.js +13 -26
  102. package/lib/WABinary/encode.d.ts +2 -1
  103. package/lib/WABinary/encode.js +152 -137
  104. package/lib/WABinary/generic-utils.d.ts +4 -1
  105. package/lib/WABinary/generic-utils.js +125 -37
  106. package/lib/WABinary/jid-utils.d.ts +5 -11
  107. package/lib/WABinary/jid-utils.js +5 -28
  108. package/lib/WAM/BinaryInfo.d.ts +11 -2
  109. package/lib/WAM/encode.d.ts +2 -1
  110. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +1 -1
  111. package/lib/index.d.ts +1 -0
  112. package/lib/index.js +36 -43
  113. package/package.json +1 -1
  114. package/WAProto/GenerateStatics.sh +0 -4
  115. package/WAProto/WAProto.proto +0 -4775
  116. package/WAProto/index.d.ts +0 -55057
  117. package/WAProto/index.ts.ts +0 -53473
  118. package/WAProto/p.html +0 -1
  119. package/lib/Defaults/wileys-version.json +0 -3
  120. package/lib/WABinary/jid-utils.js.bak +0 -83
  121. /package/{README.MD → README.md} +0 -0
@@ -1,6 +1,8 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import { Logger } from 'pino';
1
4
  import { type Transform } from 'stream';
2
5
  import { proto } from '../../WAProto';
3
- import { ILogger } from './logger';
4
6
  import { AnyMediaMessageContent, AnyMessageContent, MediaGenerationOptions, MessageContentGenerationOptions, MessageGenerationOptions, MessageGenerationOptionsFromContent, MessageUserReceipt, WAMessage, WAMessageContent, WAProto } from '../Types';
5
7
  import { MediaDownloadOptions } from './messages-media';
6
8
  /**
@@ -9,7 +11,7 @@ import { MediaDownloadOptions } from './messages-media';
9
11
  * @returns the URL, eg. https://google.com
10
12
  */
11
13
  export declare const extractUrlFromText: (text: string) => string | undefined;
12
- export declare const generateLinkPreviewIfRequired: (text: string, getUrlInfo: MessageGenerationOptions["getUrlInfo"], logger: MessageGenerationOptions["logger"]) => Promise<import("../Types").WAUrlInfo | undefined>;
14
+ export declare const generateLinkPreviewIfRequired: (text: string, getUrlInfo: MessageGenerationOptions['getUrlInfo'], logger: MessageGenerationOptions['logger']) => Promise<import("../Types").WAUrlInfo | undefined>;
13
15
  export declare const prepareWAMessageMedia: (message: AnyMediaMessageContent, options: MediaGenerationOptions) => Promise<proto.Message>;
14
16
  export declare const prepareDisappearingMessageSettingContent: (ephemeralExpiration?: number) => proto.Message;
15
17
  /**
@@ -38,13 +40,13 @@ export declare const extractMessageContent: (content: WAMessageContent | undefin
38
40
  /**
39
41
  * Returns the device predicted by message ID
40
42
  */
41
- export declare const getDevice: (id: string) => "web" | "unknown" | "android" | "ios" | "desktop";
43
+ export declare const getDevice: (id: string) => "android" | "unknown" | "web" | "ios" | "desktop";
42
44
  /** Upserts a receipt in the message */
43
- export declare const updateMessageWithReceipt: (msg: Pick<WAMessage, "userReceipt">, receipt: MessageUserReceipt) => void;
45
+ export declare const updateMessageWithReceipt: (msg: Pick<WAMessage, 'userReceipt'>, receipt: MessageUserReceipt) => void;
44
46
  /** Update the message with a new reaction */
45
- export declare const updateMessageWithReaction: (msg: Pick<WAMessage, "reactions">, reaction: proto.IReaction) => void;
47
+ export declare const updateMessageWithReaction: (msg: Pick<WAMessage, 'reactions'>, reaction: proto.IReaction) => void;
46
48
  /** Update the message with a new poll update */
47
- export declare const updateMessageWithPollUpdate: (msg: Pick<WAMessage, "pollUpdates">, update: proto.IPollUpdate) => void;
49
+ export declare const updateMessageWithPollUpdate: (msg: Pick<WAMessage, 'pollUpdates'>, update: proto.IPollUpdate) => void;
48
50
  type VoteAggregation = {
49
51
  name: string;
50
52
  voters: string[];
@@ -64,17 +66,12 @@ export declare const aggregateMessageKeysNotFromMe: (keys: proto.IMessageKey[])
64
66
  }[];
65
67
  type DownloadMediaMessageContext = {
66
68
  reuploadRequest: (msg: WAMessage) => Promise<WAMessage>;
67
- logger: ILogger;
69
+ logger: Logger;
68
70
  };
69
71
  /**
70
72
  * Downloads the given message. Throws an error if it's not a media message
71
73
  */
72
- export declare const downloadMediaMessage: <Type extends "buffer" | "stream">(message: WAMessage, type: Type, options: MediaDownloadOptions, ctx?: DownloadMediaMessageContext) => Promise<Type extends "buffer" ? Buffer<ArrayBufferLike> : Transform>;
74
+ export declare const downloadMediaMessage: <Type extends "stream" | "buffer">(message: WAMessage, type: Type, options: MediaDownloadOptions, ctx?: DownloadMediaMessageContext) => Promise<Type extends "buffer" ? Buffer : Transform>;
73
75
  /** Checks whether the given message is a media message; if it is returns the inner content */
74
76
  export declare const assertMediaContent: (content: proto.IMessage | null | undefined) => proto.Message.IVideoMessage | proto.Message.IImageMessage | proto.Message.IAudioMessage | proto.Message.IDocumentMessage | proto.Message.IStickerMessage;
75
- export declare const toJid: (id: string) => string;
76
- export declare const getSenderLid: (msg: WAMessage) => {
77
- jid: string;
78
- lid: string;
79
- };
80
77
  export {};