@zervonexx/baileys 5.0.0 → 5.0.2

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 (127) hide show
  1. package/LICENSE +22 -22
  2. package/README.md +4124 -4112
  3. package/WAProto/WAProto.json +1 -0
  4. package/WAProto/WAProto.proto +7160 -0
  5. package/WAProto/WAProtoCompile.js +264 -322
  6. package/WAProto/index.js +55 -95
  7. package/lib/Builders/AIRich.js +673 -673
  8. package/lib/Builders/auto.js +49 -49
  9. package/lib/Builders/base.js +144 -144
  10. package/lib/Builders/builders.js +588 -588
  11. package/lib/Builders/index.js +3 -3
  12. package/lib/Defaults/index.js +249 -248
  13. package/lib/Signal/index.js +2 -2
  14. package/lib/Signal/libsignal.js +526 -526
  15. package/lib/Signal/lid-mapping.js +282 -282
  16. package/lib/Socket/Client/index.js +1 -1
  17. package/lib/Socket/Client/types.js +9 -9
  18. package/lib/Socket/Client/websocket.js +83 -83
  19. package/lib/Socket/business.js +151 -151
  20. package/lib/Socket/chats.js +854 -854
  21. package/lib/Socket/communities.js +146 -146
  22. package/lib/Socket/groups.js +293 -293
  23. package/lib/Socket/index.js +17 -14
  24. package/lib/Socket/messages-recv.js +993 -993
  25. package/lib/Socket/messages-send.js +722 -722
  26. package/lib/Socket/mex.js +33 -33
  27. package/lib/Socket/newsletter.js +783 -783
  28. package/lib/Socket/registration.js +154 -154
  29. package/lib/Socket/socket.js +797 -797
  30. package/lib/Socket/spam-report.js +143 -143
  31. package/lib/Socket/username.js +81 -81
  32. package/lib/Socket/zervonex-handler.js +57 -57
  33. package/lib/Store/index.js +6 -6
  34. package/lib/Store/make-cache-manager-store.js +80 -80
  35. package/lib/Store/make-in-memory-store.js +426 -426
  36. package/lib/Store/make-ordered-dictionary.js +81 -81
  37. package/lib/Store/object-repository.js +30 -30
  38. package/lib/Store/reporting-info-store.js +37 -37
  39. package/lib/Types/Auth.js +1 -1
  40. package/lib/Types/Bussines.js +1 -1
  41. package/lib/Types/Call.js +1 -1
  42. package/lib/Types/Chat.js +7 -7
  43. package/lib/Types/Contact.js +1 -1
  44. package/lib/Types/Events.js +1 -1
  45. package/lib/Types/GroupMetadata.js +1 -1
  46. package/lib/Types/Label.js +24 -24
  47. package/lib/Types/LabelAssociation.js +6 -6
  48. package/lib/Types/Message.js +14 -14
  49. package/lib/Types/Newsletter.js +99 -99
  50. package/lib/Types/Product.js +1 -1
  51. package/lib/Types/Signal.js +1 -1
  52. package/lib/Types/Socket.js +14 -14
  53. package/lib/Types/State.js +26 -26
  54. package/lib/Types/USync.js +1 -1
  55. package/lib/Types/index.js +30 -30
  56. package/lib/Utils/auth-utils.js +159 -159
  57. package/lib/Utils/baileys-event-stream.js +32 -32
  58. package/lib/Utils/bot-capabilities.js +40 -40
  59. package/lib/Utils/bot-planning-replay.js +43 -43
  60. package/lib/Utils/browser-utils.js +29 -29
  61. package/lib/Utils/business.js +74 -74
  62. package/lib/Utils/chat-utils.js +316 -316
  63. package/lib/Utils/companion-reg-client-utils.js +19 -19
  64. package/lib/Utils/consumer-application.js +37 -37
  65. package/lib/Utils/crypto.js +52 -52
  66. package/lib/Utils/cstoken.js +14 -14
  67. package/lib/Utils/decode-wa-message.js +199 -199
  68. package/lib/Utils/event-buffer.js +272 -272
  69. package/lib/Utils/extras.js +186 -186
  70. package/lib/Utils/generics.js +195 -194
  71. package/lib/Utils/history.js +50 -50
  72. package/lib/Utils/identity-change-handler.js +18 -18
  73. package/lib/Utils/index.js +40 -40
  74. package/lib/Utils/link-preview.js +50 -50
  75. package/lib/Utils/logger.js +3 -2
  76. package/lib/Utils/lt-hash.js +3 -3
  77. package/lib/Utils/make-mutex.js +15 -15
  78. package/lib/Utils/message-composer.js +61 -61
  79. package/lib/Utils/message-retry-manager.js +47 -47
  80. package/lib/Utils/messages-media.js +501 -501
  81. package/lib/Utils/messages.js +944 -942
  82. package/lib/Utils/meta-ai-msmsg.js +121 -121
  83. package/lib/Utils/meta-compositing.js +74 -74
  84. package/lib/Utils/modern-messages.js +234 -234
  85. package/lib/Utils/native-flow.js +80 -80
  86. package/lib/Utils/noise-handler.js +160 -160
  87. package/lib/Utils/pre-key-manager.js +75 -75
  88. package/lib/Utils/process-message.js +400 -400
  89. package/lib/Utils/reporting-utils.js +170 -170
  90. package/lib/Utils/signal.js +166 -166
  91. package/lib/Utils/spam-report-utils.js +165 -165
  92. package/lib/Utils/sync-action-utils.js +33 -33
  93. package/lib/Utils/tc-token-utils.js +153 -153
  94. package/lib/Utils/use-keyv-auth-state.js +199 -199
  95. package/lib/Utils/use-multi-file-auth-state.js +83 -83
  96. package/lib/Utils/validate-connection.js +171 -171
  97. package/lib/WABinary/constants.js +1320 -1320
  98. package/lib/WABinary/decode.js +151 -151
  99. package/lib/WABinary/encode.js +139 -139
  100. package/lib/WABinary/generic-utils.js +202 -202
  101. package/lib/WABinary/index.js +6 -6
  102. package/lib/WABinary/jid-utils.js +235 -235
  103. package/lib/WABinary/types.js +4 -4
  104. package/lib/WAM/BinaryInfo.js +9 -9
  105. package/lib/WAM/constants.js +22852 -22852
  106. package/lib/WAM/encode.js +149 -149
  107. package/lib/WAM/index.js +3 -3
  108. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +30 -30
  109. package/lib/WAUSync/Protocols/USyncBusinessProtocol.js +48 -48
  110. package/lib/WAUSync/Protocols/USyncContactProtocol.js +23 -23
  111. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +28 -28
  112. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +15 -15
  113. package/lib/WAUSync/Protocols/USyncFeatureProtocol.js +24 -24
  114. package/lib/WAUSync/Protocols/USyncLIDProtocol.js +9 -9
  115. package/lib/WAUSync/Protocols/USyncPictureProtocol.js +21 -21
  116. package/lib/WAUSync/Protocols/USyncSidelistProtocol.js +19 -19
  117. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +19 -19
  118. package/lib/WAUSync/Protocols/USyncTextStatusProtocol.js +22 -22
  119. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +16 -16
  120. package/lib/WAUSync/Protocols/index.js +12 -12
  121. package/lib/WAUSync/USyncQuery.js +88 -88
  122. package/lib/WAUSync/USyncUser.js +20 -20
  123. package/lib/WAUSync/index.js +3 -3
  124. package/lib/index.js +66 -66
  125. package/package.json +187 -192
  126. package/WAProto/fetcher.js +0 -68
  127. package/WAProto/parser.js +0 -334
package/lib/index.js CHANGED
@@ -1,67 +1,67 @@
1
- import gradient from 'gradient-string'
2
- import makeWASocket from './Socket/index.js'
3
-
4
- const banner = [
5
- '╭───────────────────────────────────────────────────────────────────────────────────────────╮',
6
- '│ │',
7
- '│ [][][][][] [][][][][] [][][][] [] [] [][][] [] [] [][][][][] [] [] │',
8
- '│ [] [] [] [] [] [] [] [] [][] [] [] [] [] │',
9
- '│ [] [] [] [] [] [] [] [] [] [] [] [] [] [] │',
10
- '│ [] [][][][] [][][][] [] [] [] [] [] [] [] [][][][] [] │',
11
- '│ [] [] [] [] [] [] [] [] [] [][] [] [] [] │',
12
- '│ [] [] [] [] [] [] [] [] [] [] [] [] │',
13
- '│ [][][][][] [][][][][] [] [] [] [][][] [] [] [][][][][] [] [] │',
14
- '│ │',
15
- '├───────────────────────────────────────────────────────────────────────────────────────────┤',
16
- '│ │',
17
- '│ [][][][] [][][] [][][][][] [] [][][][][] [] [] [][][][] │',
18
- '│ [] [] [] [] [] [] [] [] [] [] │',
19
- '│ [] [] [] [] [] [] [] [] [] [] │',
20
- '│ [][][][] [][][][][] [] [] [][][][] [] [][][] │',
21
- '│ [] [] [] [] [] [] [] [] [] │',
22
- '│ [] [] [] [] [] [] [] [] [] │',
23
- '│ [][][][] [] [] [][][][][] [][][][][] [][][][][] [] [][][][] │',
24
- '│ │',
25
- '╰───────────────────────────────────────────────────────────────────────────────────────────╯',
26
- ].join('\n')
27
-
28
- const info = [
29
- '╭──────────────────────────────────────────────────────────────╮',
30
- '│ │',
31
- '│ ◆ Package › @zervonexx/baileys │',
32
- '│ ◆ Version › 5.0.0 │',
33
- '│ ◆ Status › Production Ready │',
34
- '│ │',
35
- '├──────────────────────────── ◇◆◇ ─────────────────────────────┤',
36
- '│ │',
37
- '│ ✦ WhatsApp Web API Client │',
38
- '│ ✦ Interactive Buttons · Products · Events · Media │',
39
- '│ ✦ End-to-End Encryption · Multi-Device Support │',
40
- '│ ✦ Business API · Channels · Status Updates │',
41
- '│ │',
42
- '├──────────────────────────── ◇◆◇ ─────────────────────────────┤',
43
- '│ │',
44
- '│ ◈ Built by › zervonex Team │',
45
- '│ ◈ Formerly › @nexustechpro/baileys │',
46
- '│ ◈ Docs › github.com/nexustechpro2/baileys │',
47
- '│ ◈ Support › Join our community for updates │',
48
- '│ │',
49
- '╰──────────────────────────────────────────────────────────────╯',
50
- ].join('\n')
51
-
52
- console.log(gradient(['#00FFFF', '#00BFFF', '#7B2FBE', '#FF6EC7', '#00FFFF'])(banner))
53
- console.log(gradient(['#FFD700', '#FFA500', '#FF6EC7', '#FFD700'])(info))
54
- console.log(gradient(['#00FF88', '#FFFFFF'])('\n🎯 Initializing Baileys Socket Connection...\n'))
55
-
56
- export * from '../WAProto/index.js'
57
- export * from './Utils/index.js'
58
- export * from './Store/index.js'
59
- export * from './Types/index.js'
60
- export * from './Defaults/index.js'
61
- export * from './WABinary/index.js'
62
- export * from './WAM/index.js'
63
- export * from './WAUSync/index.js'
64
- export * from './Socket/index.js'
65
- export * from './Builders/index.js'
66
- export { makeWASocket }
1
+ import gradient from 'gradient-string'
2
+ import makeWASocket from './Socket/index.js'
3
+
4
+ const banner = [
5
+ '╭───────────────────────────────────────────────────────────────────────────────────────────╮',
6
+ '│ │',
7
+ '│ [][][][][] [][][][][] [][][][] [] [] [][][] [] [] [][][][][] [] [] │',
8
+ '│ [] [] [] [] [] [] [] [] [][] [] [] [] [] │',
9
+ '│ [] [] [] [] [] [] [] [] [] [] [] [] [] [] │',
10
+ '│ [] [][][][] [][][][] [] [] [] [] [] [] [] [][][][] [] │',
11
+ '│ [] [] [] [] [] [] [] [] [] [][] [] [] [] │',
12
+ '│ [] [] [] [] [] [] [] [] [] [] [] [] │',
13
+ '│ [][][][][] [][][][][] [] [] [] [][][] [] [] [][][][][] [] [] │',
14
+ '│ │',
15
+ '├───────────────────────────────────────────────────────────────────────────────────────────┤',
16
+ '│ │',
17
+ '│ [][][][] [][][] [][][][][] [] [][][][][] [] [] [][][][] │',
18
+ '│ [] [] [] [] [] [] [] [] [] [] │',
19
+ '│ [] [] [] [] [] [] [] [] [] [] │',
20
+ '│ [][][][] [][][][][] [] [] [][][][] [] [][][] │',
21
+ '│ [] [] [] [] [] [] [] [] [] │',
22
+ '│ [] [] [] [] [] [] [] [] [] │',
23
+ '│ [][][][] [] [] [][][][][] [][][][][] [][][][][] [] [][][][] │',
24
+ '│ │',
25
+ '╰───────────────────────────────────────────────────────────────────────────────────────────╯',
26
+ ].join('\n')
27
+
28
+ const info = [
29
+ '╭──────────────────────────────────────────────────────────────╮',
30
+ '│ │',
31
+ '│ ◆ Package › @zervonexx/baileys │',
32
+ '│ ◆ Version › 5.0.2 │',
33
+ '│ ◆ Status › Production Ready │',
34
+ '│ │',
35
+ '├──────────────────────────── ◇◆◇ ─────────────────────────────┤',
36
+ '│ │',
37
+ '│ ✦ WhatsApp Web API Client │',
38
+ '│ ✦ Interactive Buttons · Products · Events · Media │',
39
+ '│ ✦ End-to-End Encryption · Multi-Device Support │',
40
+ '│ ✦ Business API · Channels · Status Updates │',
41
+ '│ │',
42
+ '├──────────────────────────── ◇◆◇ ─────────────────────────────┤',
43
+ '│ │',
44
+ '│ ◈ Built by › zervonex Team │',
45
+ '│ ◈ Formerly › @zervonex/baileys │',
46
+ '│ ◈ Docs › github.com/zervonex/baileys │',
47
+ '│ ◈ Support › Join our community for updates │',
48
+ '│ │',
49
+ '╰──────────────────────────────────────────────────────────────╯',
50
+ ].join('\n')
51
+
52
+ console.log(gradient(['#00FFFF', '#00BFFF', '#7B2FBE', '#FF6EC7', '#00FFFF'])(banner))
53
+ console.log(gradient(['#FFD700', '#FFA500', '#FF6EC7', '#FFD700'])(info))
54
+ console.log(gradient(['#00FF88', '#FFFFFF'])('\n🎯 Initializing Baileys Socket Connection...\n'))
55
+
56
+ export * from '../WAProto/index.js'
57
+ export * from './Utils/index.js'
58
+ export * from './Store/index.js'
59
+ export * from './Types/index.js'
60
+ export * from './Defaults/index.js'
61
+ export * from './WABinary/index.js'
62
+ export * from './WAM/index.js'
63
+ export * from './WAUSync/index.js'
64
+ export * from './Socket/index.js'
65
+ export * from './Builders/index.js'
66
+ export { makeWASocket }
67
67
  export default makeWASocket
package/package.json CHANGED
@@ -1,192 +1,187 @@
1
- {
2
- "$schema": "https://json.schemastore.org/package.json",
3
- "name": "@zervonexx/baileys",
4
- "type": "module",
5
- "version": "5.0.0",
6
- "description": "Advanced WhatsApp Web API built on Baileys — interactive messages, buttons, carousels, products, events, payments, polls, albums, sticker packs and more.",
7
- "keywords": [
8
- "baileys",
9
- "baileys-mod",
10
- "baileys-fork",
11
- "nexus",
12
- "zervonex",
13
- "nexustech",
14
- "nexustechpro",
15
- "zervo",
16
- "zervonex baileys",
17
- "Zervonex",
18
- "zervonex",
19
- "zervonexx",
20
- "baileys-advanced",
21
- "whiskeysockets",
22
- "whatsapp",
23
- "whatsapp-api",
24
- "whatsapp-web",
25
- "whatsapp-bot",
26
- "whatsapp-automation",
27
- "whatsapp-web-api",
28
- "whatsapp-client",
29
- "whatsapp-multidevice",
30
- "whatsapp-business",
31
- "whatsapp-interactive",
32
- "whatsapp-buttons",
33
- "whatsapp-carousel",
34
- "whatsapp-sticker",
35
- "whatsapp-media",
36
- "whatsapp-group",
37
- "whatsapp-newsletter",
38
- "whatsapp-channel",
39
- "whatsapp-status",
40
- "whatsapp-pairing",
41
- "wa-api",
42
- "wa-bot",
43
- "wa-web",
44
- "automation",
45
- "bot",
46
- "chatbot",
47
- "messaging",
48
- "websocket",
49
- "multi-device",
50
- "multidevice",
51
- "interactive-messages",
52
- "buttons",
53
- "carousels",
54
- "products",
55
- "events",
56
- "payments",
57
- "polls",
58
- "albums",
59
- "sticker-pack",
60
- "nodejs",
61
- "typescript",
62
- "javascript",
63
- "esm"
64
- ],
65
- "homepage": "https://github.com/nexustechpro2/baileys/",
66
- "bugs": {
67
- "url": "https://github.com/nexustechpro2/baileys/issues"
68
- },
69
- "repository": {
70
- "type": "git",
71
- "url": "git+https://github.com/nexustechpro2/baileys.git"
72
- },
73
- "license": "MIT",
74
- "author": "zervonex",
75
- "main": "lib/index.js",
76
- "scripts": {
77
- "generate:license": "npx license",
78
- "gen:protobuf": "node ./WAProto/index.js",
79
- "prepack": "echo 'Zervonex WhatsApp Library'",
80
- "prepare": "echo 'Zervonex WhatsApp Library'",
81
- "test": "node ./lib/index.js"
82
- },
83
- "files": [
84
- "lib/**/*.js",
85
- "WAProto/**/*.js",
86
- "WAProto/**/*.json",
87
- "WAProto/**/*.proto",
88
- "engine-requirements.js"
89
- ],
90
- "dependencies": {
91
- "@adiwajshing/keyed-db": "^0.2.4",
92
- "@cacheable/node-cache": "^3.1.1",
93
- "@hapi/boom": "^10.0.1",
94
- "@keyv/etcd": "^6.1.0",
95
- "@keyv/memcache": "^6.1.0",
96
- "@keyv/mongo": "^6.1.0",
97
- "@keyv/mysql": "^6.1.0",
98
- "@keyv/postgres": "^6.1.0",
99
- "@keyv/redis": "^6.1.0",
100
- "@keyv/sqlite": "^6.1.0",
101
- "@zanixongroup/uploader": "^2.1.5",
102
- "acorn": "^8.18.0",
103
- "acorn-walk": "^8.3.5",
104
- "async-mutex": "^0.5.0",
105
- "axios": "^1.20.0",
106
- "cache-manager": "^7.2.9",
107
- "fflate": "^0.8.2",
108
- "ffmpeg-static": "^5.3.0",
109
- "file-type": "^22.2.0",
110
- "get-stream": "^9.0.1",
111
- "got": "^16.2.0",
112
- "gradient-string": "^3.0.0",
113
- "into-stream": "^9.1.0",
114
- "keyv": "^6.1.0",
115
- "libphonenumber-js": "^1.13.16",
116
- "lru-cache": "^11.1.0",
117
- "mcc-mnc-list": "^1.1.11",
118
- "music-metadata": "^12.3.0",
119
- "p-queue": "^10.0.0",
120
- "pino": "^10.4.0",
121
- "prismjs": "^1.30.0",
122
- "protobufjs": "^8.8.1",
123
- "qrcode-terminal": "^0.12.0",
124
- "rlottie": "^0.1.2",
125
- "tempy": "^3.2.0",
126
- "undici": "^8.12.3",
127
- "unfurl.js": "^6.4.0",
128
- "url-regex-safe": "^4.0.0",
129
- "uuid": "^14.0.3",
130
- "wa-sticker-formatter": "^4.4.4",
131
- "whatsapp-rust-bridge": "^0.5.5",
132
- "ws": "^8.22.0"
133
- },
134
- "overrides": {
135
- "wa-sticker-formatter": {
136
- "sharp": "^0.35.5",
137
- "axios": "^1.20.0",
138
- "file-type": "^22.2.0",
139
- "image-size": "^2.0.4"
140
- },
141
- "jest": "^29.0.0",
142
- "tar": "^7.5.22",
143
- "@tootallnate/once": "^3.0.1",
144
- "image-size": "^2.0.4",
145
- "sqlite3": "^6.0.1",
146
- "cacache": "^19.0.1",
147
- "axios": "^1.20.0",
148
- "file-type": "^22.2.0",
149
- "sharp": "^0.35.5",
150
- "release-it": {
151
- "undici": "^8.12.3",
152
- "basic-ftp": "^6.2.3"
153
- },
154
- "jimp": {
155
- "file-type": "^22.2.0"
156
- },
157
- "esbuild": "^0.28.2",
158
- "basic-ftp": "^6.2.3",
159
- "music-metadata": {
160
- "file-type": "^22.2.0"
161
- },
162
- "@jimp/core": {
163
- "file-type": "^22.2.0"
164
- }
165
- },
166
- "resolutions": {
167
- "wa-sticker-formatter/sharp": "^0.35.5",
168
- "wa-sticker-formatter/axios": "^1.20.0",
169
- "wa-sticker-formatter/file-type": "^22.2.0",
170
- "wa-sticker-formatter/image-size": "^2.0.4",
171
- "tar": "^7.5.22",
172
- "@tootallnate/once": "^3.0.1",
173
- "image-size": "^2.0.4",
174
- "sqlite3": "^6.0.1",
175
- "cacache": "^19.0.1",
176
- "axios": "^1.20.0",
177
- "file-type": "^22.2.0",
178
- "sharp": "^0.35.5"
179
- },
180
- "packageManager": "yarn@4.9.2",
181
- "engines": {
182
- "node": ">=20.0.0"
183
- },
184
- "exports": {
185
- ".": {
186
- "import": "./lib/index.js",
187
- "default": "./lib/index.js"
188
- },
189
- "./lib/*": "./lib/*",
190
- "./WAProto/*": "./WAProto/*"
191
- }
192
- }
1
+ {
2
+ "$schema": "https://json.schemastore.org/package.json",
3
+ "name": "@zervonexx/baileys",
4
+ "type": "module",
5
+ "version": "5.0.2",
6
+ "description": "Advanced WhatsApp Web API built on Baileys — interactive messages, buttons, carousels, products, events, payments, polls, albums, sticker packs and more.",
7
+ "keywords": [
8
+ "baileys",
9
+ "baileys-mod",
10
+ "baileys-fork",
11
+ "nexus",
12
+ "zervonex",
13
+ "nexustech",
14
+ "nexustechpro",
15
+ "zervo",
16
+ "zervonex baileys",
17
+ "Zervonex",
18
+ "zervonex",
19
+ "zervonexx",
20
+ "baileys-advanced",
21
+ "whiskeysockets",
22
+ "whatsapp",
23
+ "whatsapp-api",
24
+ "whatsapp-web",
25
+ "whatsapp-bot",
26
+ "whatsapp-automation",
27
+ "whatsapp-web-api",
28
+ "whatsapp-client",
29
+ "whatsapp-multidevice",
30
+ "whatsapp-business",
31
+ "whatsapp-interactive",
32
+ "whatsapp-buttons",
33
+ "whatsapp-carousel",
34
+ "whatsapp-sticker",
35
+ "whatsapp-media",
36
+ "whatsapp-group",
37
+ "whatsapp-newsletter",
38
+ "whatsapp-channel",
39
+ "whatsapp-status",
40
+ "whatsapp-pairing",
41
+ "wa-api",
42
+ "wa-bot",
43
+ "wa-web",
44
+ "automation",
45
+ "bot",
46
+ "chatbot",
47
+ "messaging",
48
+ "websocket",
49
+ "multi-device",
50
+ "multidevice",
51
+ "interactive-messages",
52
+ "buttons",
53
+ "carousels",
54
+ "products",
55
+ "events",
56
+ "payments",
57
+ "polls",
58
+ "albums",
59
+ "sticker-pack",
60
+ "nodejs",
61
+ "typescript",
62
+ "javascript",
63
+ "esm"
64
+ ],
65
+ "homepage": "https://github.com/zervonex/baileys/",
66
+ "bugs": {
67
+ "url": "https://github.com/zervonex/baileys/issues"
68
+ },
69
+ "repository": {
70
+ "type": "git",
71
+ "url": "git+https://github.com/zervonex/baileys.git"
72
+ },
73
+ "license": "MIT",
74
+ "author": "zervonex",
75
+ "main": "lib/index.js",
76
+ "scripts": {
77
+ "generate:license": "npx license",
78
+ "prepack": "echo 'Zervonex WhatsApp Library'",
79
+ "prepare": "echo 'Zervonex WhatsApp Library'",
80
+ "test": "node ./lib/index.js"
81
+ },
82
+ "files": [
83
+ "lib/**/*.js",
84
+ "WAProto/**/*.js",
85
+ "WAProto/**/*.json",
86
+ "WAProto/**/*.proto"
87
+ ],
88
+ "dependencies": {
89
+ "@adiwajshing/keyed-db": "^0.2.4",
90
+ "@cacheable/node-cache": "^3.1.1",
91
+ "@hapi/boom": "^10.0.1",
92
+ "@keyv/etcd": "^6.1.0",
93
+ "@keyv/memcache": "^6.1.0",
94
+ "@keyv/mongo": "^6.1.0",
95
+ "@keyv/mysql": "^6.1.0",
96
+ "@keyv/postgres": "^6.1.0",
97
+ "@keyv/redis": "^6.1.0",
98
+ "@keyv/sqlite": "^6.1.0",
99
+ "@zanixongroup/uploader": "^2.1.5",
100
+ "async-mutex": "^0.5.0",
101
+ "axios": "^1.20.0",
102
+ "cache-manager": "^7.2.9",
103
+ "fflate": "^0.8.2",
104
+ "ffmpeg-static": "^5.3.0",
105
+ "file-type": "^22.2.0",
106
+ "get-stream": "^9.0.1",
107
+ "got": "^16.2.0",
108
+ "gradient-string": "^3.0.0",
109
+ "into-stream": "^9.1.0",
110
+ "keyv": "^6.1.0",
111
+ "libphonenumber-js": "^1.13.16",
112
+ "lru-cache": "^11.1.0",
113
+ "mcc-mnc-list": "^1.1.11",
114
+ "music-metadata": "^12.3.0",
115
+ "p-queue": "^10.0.0",
116
+ "pino": "^10.4.0",
117
+ "prismjs": "^1.30.0",
118
+ "qrcode-terminal": "^0.12.0",
119
+ "rlottie": "^0.1.2",
120
+ "tempy": "^3.2.0",
121
+ "undici": "^8.12.3",
122
+ "unfurl.js": "^6.4.0",
123
+ "url-regex-safe": "^4.0.0",
124
+ "uuid": "^14.0.3",
125
+ "wa-sticker-formatter": "^4.4.4",
126
+ "whatsapp-rust-bridge": "^0.5.5",
127
+ "ws": "^8.22.0"
128
+ },
129
+ "overrides": {
130
+ "wa-sticker-formatter": {
131
+ "sharp": "^0.35.5",
132
+ "axios": "^1.20.0",
133
+ "file-type": "^22.2.0",
134
+ "image-size": "^2.0.4"
135
+ },
136
+ "jest": "^29.0.0",
137
+ "tar": "^7.5.22",
138
+ "@tootallnate/once": "^3.0.1",
139
+ "image-size": "^2.0.4",
140
+ "sqlite3": "^6.0.1",
141
+ "cacache": "^19.0.1",
142
+ "axios": "^1.20.0",
143
+ "file-type": "^22.2.0",
144
+ "sharp": "^0.35.5",
145
+ "release-it": {
146
+ "undici": "^8.12.3",
147
+ "basic-ftp": "^6.2.3"
148
+ },
149
+ "jimp": {
150
+ "file-type": "^22.2.0"
151
+ },
152
+ "esbuild": "^0.28.2",
153
+ "basic-ftp": "^6.2.3",
154
+ "music-metadata": {
155
+ "file-type": "^22.2.0"
156
+ },
157
+ "@jimp/core": {
158
+ "file-type": "^22.2.0"
159
+ }
160
+ },
161
+ "resolutions": {
162
+ "wa-sticker-formatter/sharp": "^0.35.5",
163
+ "wa-sticker-formatter/axios": "^1.20.0",
164
+ "wa-sticker-formatter/file-type": "^22.2.0",
165
+ "wa-sticker-formatter/image-size": "^2.0.4",
166
+ "tar": "^7.5.22",
167
+ "@tootallnate/once": "^3.0.1",
168
+ "image-size": "^2.0.4",
169
+ "sqlite3": "^6.0.1",
170
+ "cacache": "^19.0.1",
171
+ "axios": "^1.20.0",
172
+ "file-type": "^22.2.0",
173
+ "sharp": "^0.35.5"
174
+ },
175
+ "packageManager": "yarn@4.9.2",
176
+ "engines": {
177
+ "node": ">=20.0.0"
178
+ },
179
+ "exports": {
180
+ ".": {
181
+ "import": "./lib/index.js",
182
+ "default": "./lib/index.js"
183
+ },
184
+ "./lib/*": "./lib/*",
185
+ "./WAProto/*": "./WAProto/*"
186
+ }
187
+ }
@@ -1,68 +0,0 @@
1
- import { fetch, Agent } from 'undici'
2
- import { readFileSync, writeFileSync, existsSync, createWriteStream, unlinkSync } from 'fs'
3
- import { pipeline } from 'stream/promises'
4
- import { join, dirname } from 'path'
5
- import { fileURLToPath } from 'url'
6
-
7
- const __dirname = dirname(fileURLToPath(import.meta.url))
8
- const CACHE_FILE = join(__dirname, '.cache.json')
9
- const PROTO_FILE = join(__dirname, 'WAProto.proto')
10
- const BUNDLE_TMP = join(__dirname, 'WAProto.bundle.tmp')
11
- const GITHUB_RAW = 'https://raw.githubusercontent.com/zervonex/baileys/wa-cache'
12
-
13
- const agent = new Agent({ connect: { family: 4, timeout: 60000 } })
14
-
15
- // ── Cache helpers ─────────────────────────────────────────────────────────────
16
-
17
- const readCache = () => { try { return existsSync(CACHE_FILE) ? JSON.parse(readFileSync(CACHE_FILE, 'utf8')) : {} } catch { return {} } }
18
- const writeCache = (data) => writeFileSync(CACHE_FILE, JSON.stringify(data, null, 2), 'utf8')
19
- const isCacheValid = (cache) => !!(cache.version && cache.hash && existsSync(PROTO_FILE))
20
- const hasLocal = (cache) => !!(cache.version && existsSync(PROTO_FILE))
21
- const removeTmp = () => { try { if (existsSync(BUNDLE_TMP)) unlinkSync(BUNDLE_TMP) } catch { } }
22
-
23
- // ── GitHub fetch ──────────────────────────────────────────────────────────────
24
-
25
- async function fetchJSON(file) {
26
- const res = await fetch(`${GITHUB_RAW}/${file}`, { dispatcher: agent })
27
- if (!res.ok) throw new Error(`[WAProto] fetch failed for ${file}: ${res.status}`)
28
- return res.json()
29
- }
30
-
31
- async function fetchBundle() {
32
- const res = await fetch(`${GITHUB_RAW}/WAProto.bundle.js`, { dispatcher: agent })
33
- if (!res.ok) throw new Error(`[WAProto] fetch failed for WAProto.bundle.js: ${res.status}`)
34
- await pipeline(res.body, createWriteStream(BUNDLE_TMP))
35
- }
36
-
37
- // ── Public API ────────────────────────────────────────────────────────────────
38
-
39
- export async function fetchProtoBundle() {
40
- const cache = readCache()
41
- if (isCacheValid(cache)) return { changed: false, version: cache.version }
42
- try {
43
- const { version, hash } = await fetchJSON('wa-version.json')
44
- if (!version || !hash) throw new Error('[WAProto] wa-version.json missing version or hash field')
45
- if (cache.version === String(version) && cache.hash === hash && existsSync(PROTO_FILE)) {
46
- writeCache({ version: String(version), hash })
47
- return { changed: false, version: String(version) }
48
- }
49
- await fetchBundle()
50
- writeCache({ version: String(version), hash })
51
- return { changed: true, bundlePath: BUNDLE_TMP, version: String(version) }
52
- } catch (err) {
53
- removeTmp()
54
- if (hasLocal(cache)) return { changed: false, version: cache.version }
55
- throw new Error(`[WAProto] fetch failed and no local files available: ${err.message}`)
56
- }
57
- }
58
-
59
- export async function getWAVersion() {
60
- const cache = readCache()
61
- if (isCacheValid(cache)) return [2, 3000, parseInt(cache.version)]
62
- try {
63
- const { version } = await fetchJSON('wa-version.json')
64
- return [2, 3000, parseInt(String(version))]
65
- } catch {
66
- return [2, 3000, parseInt(cache.version || '0')]
67
- }
68
- }