@genuxofficial/baileys 3.0.0 → 4.0.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 (88) hide show
  1. package/WAProto/WAProto.proto +24 -206
  2. package/WAProto/index.d.ts +219 -2233
  3. package/WAProto/index.js +525 -6773
  4. package/WAProto/shizo.x +1 -0
  5. package/lib/Defaults/baileys-version.json +1 -1
  6. package/lib/Defaults/index.d.ts +231 -0
  7. package/lib/Defaults/index.js +17 -1
  8. package/lib/Defaults/phonenumber-mcc.json +223 -0
  9. package/lib/Socket/Client/index.d.ts +3 -2
  10. package/lib/Socket/Client/index.js +3 -2
  11. package/lib/Socket/Client/mobile-socket-client.d.ts +13 -0
  12. package/lib/Socket/Client/mobile-socket-client.js +65 -0
  13. package/lib/Socket/Client/{websocket.d.ts → web-socket-client.d.ts} +1 -1
  14. package/lib/Socket/Client/{websocket.js → web-socket-client.js} +2 -2
  15. package/lib/Socket/business.d.ts +7 -9
  16. package/lib/Socket/chats.d.ts +5 -8
  17. package/lib/Socket/chats.js +8 -38
  18. package/lib/Socket/groups.d.ts +5 -7
  19. package/lib/Socket/groups.js +2 -14
  20. package/lib/Socket/index.d.ts +9 -9
  21. package/lib/Socket/index.js +2 -2
  22. package/lib/Socket/messages-recv.d.ts +8 -10
  23. package/lib/Socket/messages-recv.js +11 -18
  24. package/lib/Socket/messages-send.d.ts +7 -14
  25. package/lib/Socket/messages-send.js +13 -36
  26. package/lib/Socket/newsletter.d.ts +7 -9
  27. package/lib/Socket/newsletter.js +3 -11
  28. package/lib/Socket/registration.d.ts +271 -0
  29. package/lib/Socket/registration.js +166 -0
  30. package/lib/Socket/socket.d.ts +4 -5
  31. package/lib/Socket/socket.js +18 -15
  32. package/lib/Socket/usync.d.ts +4 -4
  33. package/lib/Store/index.d.ts +2 -1
  34. package/lib/Store/index.js +3 -1
  35. package/lib/Store/make-cache-manager-store.d.ts +14 -0
  36. package/lib/Store/make-cache-manager-store.js +83 -0
  37. package/lib/Store/make-in-memory-store.js +10 -8
  38. package/lib/Store/make-ordered-dictionary.js +2 -2
  39. package/lib/Types/Auth.d.ts +6 -0
  40. package/lib/Types/Chat.d.ts +0 -4
  41. package/lib/Types/Contact.d.ts +1 -1
  42. package/lib/Types/GroupMetadata.d.ts +0 -6
  43. package/lib/Types/Message.d.ts +5 -29
  44. package/lib/Types/Message.js +2 -0
  45. package/lib/Types/Socket.d.ts +4 -7
  46. package/lib/Utils/auth-utils.d.ts +1 -1
  47. package/lib/Utils/auth-utils.js +9 -2
  48. package/lib/Utils/business.js +3 -15
  49. package/lib/Utils/chat-utils.d.ts +4 -4
  50. package/lib/Utils/chat-utils.js +2 -1
  51. package/lib/Utils/decode-wa-message.d.ts +2 -4
  52. package/lib/Utils/decode-wa-message.js +24 -145
  53. package/lib/Utils/event-buffer.js +6 -4
  54. package/lib/Utils/generics.d.ts +4 -7
  55. package/lib/Utils/generics.js +17 -9
  56. package/lib/Utils/lt-hash.d.ts +3 -3
  57. package/lib/Utils/lt-hash.js +45 -11
  58. package/lib/Utils/messages-media.d.ts +4 -4
  59. package/lib/Utils/messages-media.js +57 -69
  60. package/lib/Utils/messages.js +39 -33
  61. package/lib/Utils/noise-handler.d.ts +2 -1
  62. package/lib/Utils/noise-handler.js +10 -5
  63. package/lib/Utils/use-multi-file-auth-state.js +11 -48
  64. package/lib/Utils/validate-connection.d.ts +1 -0
  65. package/lib/Utils/validate-connection.js +44 -10
  66. package/lib/WABinary/constants.js +5 -5
  67. package/lib/WABinary/encode.js +10 -23
  68. package/lib/WABinary/generic-utils.d.ts +5 -3
  69. package/lib/WABinary/generic-utils.js +19 -34
  70. package/lib/WABinary/jid-utils.d.ts +2 -11
  71. package/lib/WABinary/jid-utils.js +2 -27
  72. package/lib/WAM/BinaryInfo.d.ts +2 -2
  73. package/lib/WAM/constants.d.ts +2 -3
  74. package/lib/WAM/encode.js +2 -2
  75. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +12 -21
  76. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +3 -3
  77. package/lib/WAUSync/USyncQuery.d.ts +0 -2
  78. package/lib/WAUSync/USyncQuery.js +0 -10
  79. package/lib/WAUSync/USyncUser.d.ts +0 -2
  80. package/lib/WAUSync/USyncUser.js +0 -4
  81. package/package.json +5 -6
  82. package/LICENSE +0 -21
  83. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +0 -25
  84. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +0 -53
  85. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +0 -8
  86. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +0 -24
  87. /package/lib/Socket/Client/{types.d.ts → abstract-socket-client.d.ts} +0 -0
  88. /package/lib/Socket/Client/{types.js → abstract-socket-client.js} +0 -0
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.USyncBotProfileProtocol = void 0;
4
- const WABinary_1 = require("../../WABinary");
5
- class USyncBotProfileProtocol {
6
- constructor() {
7
- this.name = 'bot';
8
- }
9
- getQueryElement() {
10
- return {
11
- tag: 'bot',
12
- attrs: {},
13
- content: [{ tag: 'profile', attrs: { v: '1' } }]
14
- };
15
- }
16
- getUserElement(user) {
17
- return {
18
- tag: 'bot',
19
- attrs: {},
20
- content: [{ tag: 'profile', attrs: { 'persona_id': user.personaId } }]
21
- };
22
- }
23
- parser(node) {
24
- const botNode = (0, WABinary_1.getBinaryNodeChild)(node, 'bot');
25
- const profile = (0, WABinary_1.getBinaryNodeChild)(botNode, 'profile');
26
- const commandsNode = (0, WABinary_1.getBinaryNodeChild)(profile, 'commands');
27
- const promptsNode = (0, WABinary_1.getBinaryNodeChild)(profile, 'prompts');
28
- const commands = [];
29
- const prompts = [];
30
- for (const command of (0, WABinary_1.getBinaryNodeChildren)(commandsNode, 'command')) {
31
- commands.push({
32
- name: (0, WABinary_1.getBinaryNodeChildString)(command, 'name'),
33
- description: (0, WABinary_1.getBinaryNodeChildString)(command, 'description')
34
- });
35
- }
36
- for (const prompt of (0, WABinary_1.getBinaryNodeChildren)(promptsNode, 'prompt')) {
37
- prompts.push(`${(0, WABinary_1.getBinaryNodeChildString)(prompt, 'emoji')} ${(0, WABinary_1.getBinaryNodeChildString)(prompt, 'text')}`);
38
- }
39
- return {
40
- isDefault: !!(0, WABinary_1.getBinaryNodeChild)(profile, 'default'),
41
- jid: node.attrs.jid,
42
- name: (0, WABinary_1.getBinaryNodeChildString)(profile, 'name'),
43
- attributes: (0, WABinary_1.getBinaryNodeChildString)(profile, 'attributes'),
44
- description: (0, WABinary_1.getBinaryNodeChildString)(profile, 'description'),
45
- category: (0, WABinary_1.getBinaryNodeChildString)(profile, 'category'),
46
- personaId: profile.attrs['persona_id'],
47
- commandsDescription: (0, WABinary_1.getBinaryNodeChildString)(commandsNode, 'description'),
48
- commands,
49
- prompts
50
- };
51
- }
52
- }
53
- exports.USyncBotProfileProtocol = USyncBotProfileProtocol;
@@ -1,8 +0,0 @@
1
- import { USyncQueryProtocol } from '../../Types/USync';
2
- import { BinaryNode } from '../../WABinary';
3
- export declare class USyncLIDProtocol implements USyncQueryProtocol {
4
- name: string;
5
- getQueryElement(): BinaryNode;
6
- getUserElement(): null;
7
- parser(node: BinaryNode): string | null;
8
- }
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.USyncLIDProtocol = void 0;
4
- class USyncLIDProtocol {
5
- constructor() {
6
- this.name = 'lid';
7
- }
8
- getQueryElement() {
9
- return {
10
- tag: 'lid',
11
- attrs: {},
12
- };
13
- }
14
- getUserElement() {
15
- return null;
16
- }
17
- parser(node) {
18
- if (node.tag === 'lid') {
19
- return node.attrs.val;
20
- }
21
- return null;
22
- }
23
- }
24
- exports.USyncLIDProtocol = USyncLIDProtocol;