whatsapp-store-db 1.3.57 → 1.3.60

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whatsapp-store-db",
3
- "version": "1.3.57",
3
+ "version": "1.3.60",
4
4
  "description": "Minimal Baileys data storage for your favorite DBMS built with Prisma",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -14,7 +14,8 @@
14
14
  "build": "tsc",
15
15
  "typecheck": "tsc --noEmit",
16
16
  "lint": "eslint .",
17
- "format": "prettier . --write"
17
+ "format": "prettier . --write",
18
+ "postinstall": "patch-package"
18
19
  },
19
20
  "devDependencies": {
20
21
  "@prisma/client": "^5.10.2",
@@ -30,6 +31,7 @@
30
31
  },
31
32
  "dependencies": {
32
33
  "baileys": "7.0.0-rc.9",
34
+ "patch-package": "^8.0.0",
33
35
  "tiny-invariant": "^1.3.1"
34
36
  },
35
37
  "peerDependencies": {
@@ -37,6 +39,7 @@
37
39
  },
38
40
  "files": [
39
41
  "dist/",
42
+ "patches/",
40
43
  "prisma/schema.prisma",
41
44
  ".env.example"
42
45
  ]
@@ -0,0 +1,72 @@
1
+ diff --git a/node_modules/baileys/lib/Socket/messages-recv.js b/node_modules/baileys/lib/Socket/messages-recv.js
2
+ index f2e2e10..47e1dfd 100644
3
+ --- a/node_modules/baileys/lib/Socket/messages-recv.js
4
+ +++ b/node_modules/baileys/lib/Socket/messages-recv.js
5
+ @@ -988,8 +988,26 @@ export const makeMessagesRecvSocket = (config) => {
6
+ await decrypt();
7
+ // message failed to decrypt
8
+ if (msg.messageStubType === proto.WebMessageInfo.StubType.CIPHERTEXT && msg.category !== 'peer') {
9
+ - if (msg?.messageStubParameters?.[0] === MISSING_KEYS_ERROR_TEXT ||
10
+ - msg.messageStubParameters?.[0] === NO_MESSAGE_FOUND_ERROR_TEXT) {
11
+ + if (msg?.messageStubParameters?.[0] === MISSING_KEYS_ERROR_TEXT) {
12
+ + return sendMessageAck(node);
13
+ + }
14
+ + if (msg.messageStubParameters?.[0] === NO_MESSAGE_FOUND_ERROR_TEXT) {
15
+ + if (msg.key) {
16
+ + const sessionJid = authState.creds.me?.id || 'unknown';
17
+ + logger.error({ session: sessionJid, msgId: msg.key.id, remoteJid: msg.key.remoteJid, fromMe: msg.key.fromMe }, 'CTWA: Message absent from node detected, requesting placeholder resend from phone');
18
+ + requestPlaceholderResend(msg.key)
19
+ + .then((result) => {
20
+ + if (result === 'RESOLVED') {
21
+ + logger.error({ session: sessionJid, msgId: msg.key.id }, 'CTWA: Message received during resend delay');
22
+ + }
23
+ + else if (result) {
24
+ + logger.error({ session: sessionJid, msgId: msg.key.id, requestId: result }, 'CTWA: Placeholder resend PDO request sent');
25
+ + }
26
+ + })
27
+ + .catch((error) => {
28
+ + logger.error({ session: sessionJid, error, msgId: msg.key.id }, 'CTWA: Failed to request placeholder resend');
29
+ + });
30
+ + }
31
+ return sendMessageAck(node);
32
+ }
33
+ const errorMessage = msg?.messageStubParameters?.[0] || '';
34
+ diff --git a/node_modules/baileys/lib/Utils/process-message.js b/node_modules/baileys/lib/Utils/process-message.js
35
+ index 7927483..1f2d811 100644
36
+ --- a/node_modules/baileys/lib/Utils/process-message.js
37
+ +++ b/node_modules/baileys/lib/Utils/process-message.js
38
+ @@ -223,8 +223,19 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
39
+ //eslint-disable-next-line max-depth
40
+ if (retryResponse) {
41
+ const webMessageInfo = proto.WebMessageInfo.decode(retryResponse.webMessageInfoBytes);
42
+ - // wait till another upsert event is available, don't want it to be part of the PDO response message
43
+ - // TODO: parse through proper message handling utilities (to add relevant key fields)
44
+ + const recoveredContent = webMessageInfo.message?.conversation
45
+ + || webMessageInfo.message?.extendedTextMessage?.text
46
+ + || webMessageInfo.message?.imageMessage?.caption
47
+ + || webMessageInfo.message?.videoMessage?.caption
48
+ + || (webMessageInfo.message?.imageMessage ? '[image]' : '')
49
+ + || (webMessageInfo.message?.videoMessage ? '[video]' : '')
50
+ + || (webMessageInfo.message?.audioMessage ? '[audio]' : '')
51
+ + || (webMessageInfo.message?.documentMessage ? '[document]' : '')
52
+ + || (webMessageInfo.message?.stickerMessage ? '[sticker]' : '')
53
+ + || (webMessageInfo.message?.contactMessage ? '[contact]' : '')
54
+ + || (webMessageInfo.message?.locationMessage ? '[location]' : '')
55
+ + || '[unknown type]';
56
+ + logger.error({ session: meId, msgId: webMessageInfo.key?.id, remoteJid: webMessageInfo.key?.remoteJid, recoveredContent, requestId: response.stanzaId }, 'CTWA: Message recovered from phone via PDO');
57
+ setTimeout(() => {
58
+ ev.emit('messages.upsert', {
59
+ messages: [webMessageInfo],
60
+ diff --git a/node_modules/baileys/lib/Utils/validate-connection.js b/node_modules/baileys/lib/Utils/validate-connection.js
61
+ index 42fb902..38a2e0c 100644
62
+ --- a/node_modules/baileys/lib/Utils/validate-connection.js
63
+ +++ b/node_modules/baileys/lib/Utils/validate-connection.js
64
+ @@ -13,7 +13,7 @@ const getUserAgent = (config) => {
65
+ secondary: config.version[1],
66
+ tertiary: config.version[2]
67
+ },
68
+ - platform: proto.ClientPayload.UserAgent.Platform.WEB,
69
+ + platform: proto.ClientPayload.UserAgent.Platform.MACOS,
70
+ releaseChannel: proto.ClientPayload.UserAgent.ReleaseChannel.RELEASE,
71
+ osVersion: '0.1',
72
+ device: 'Desktop',