naya-flore 4.7.2 → 4.7.4

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 (99) hide show
  1. package/README.md +0 -104
  2. package/WAProto/WAProto.proto +89 -1195
  3. package/WAProto/index.d.ts +1256 -13195
  4. package/WAProto/index.js +11405 -32544
  5. package/lib/Defaults/baileys-version.json +1 -1
  6. package/lib/Defaults/index.d.ts +0 -231
  7. package/lib/Defaults/index.js +102 -92
  8. package/lib/Defaults/phonenumber-mcc.json +221 -221
  9. package/lib/Signal/libsignal.js +9 -18
  10. package/lib/Socket/Client/abstract-socket-client.d.ts +2 -0
  11. package/lib/Socket/Client/index.d.ts +3 -2
  12. package/lib/Socket/Client/index.js +3 -2
  13. package/lib/Socket/Client/mobile-socket-client.d.ts +1 -0
  14. package/lib/Socket/Client/{websocket.d.ts → web-socket-client.d.ts} +1 -1
  15. package/lib/Socket/Client/{websocket.js → web-socket-client.js} +2 -2
  16. package/lib/Socket/business.d.ts +43 -42
  17. package/lib/Socket/chats.d.ts +8 -9
  18. package/lib/Socket/chats.js +34 -41
  19. package/lib/Socket/groups.d.ts +7 -7
  20. package/lib/Socket/groups.js +4 -2
  21. package/lib/Socket/index.d.ts +52 -51
  22. package/lib/Socket/messages-recv.d.ts +42 -41
  23. package/lib/Socket/messages-recv.js +127 -190
  24. package/lib/Socket/messages-send.d.ts +9 -16
  25. package/lib/Socket/messages-send.js +316 -467
  26. package/lib/Socket/newsletter.d.ts +28 -26
  27. package/lib/Socket/newsletter.js +3 -3
  28. package/lib/Socket/registration.d.ts +52 -49
  29. package/lib/Socket/registration.js +7 -7
  30. package/lib/Socket/socket.d.ts +0 -1
  31. package/lib/Socket/socket.js +23 -49
  32. package/lib/Socket/usync.d.ts +10 -11
  33. package/lib/Store/index.d.ts +2 -2
  34. package/lib/Store/index.js +2 -2
  35. package/lib/Store/make-cache-manager-store.d.ts +0 -1
  36. package/lib/Store/make-in-memory-store.js +1 -5
  37. package/lib/Store/make-ordered-dictionary.d.ts +1 -1
  38. package/lib/Types/Auth.d.ts +1 -0
  39. package/lib/Types/Call.d.ts +1 -1
  40. package/lib/Types/Chat.d.ts +7 -12
  41. package/lib/Types/Events.d.ts +2 -17
  42. package/lib/Types/GroupMetadata.d.ts +2 -3
  43. package/lib/Types/Label.d.ts +0 -11
  44. package/lib/Types/Label.js +1 -1
  45. package/lib/Types/LabelAssociation.js +1 -1
  46. package/lib/Types/Message.d.ts +10 -170
  47. package/lib/Types/Newsletter.js +3 -3
  48. package/lib/Types/Socket.d.ts +4 -7
  49. package/lib/Types/index.d.ts +0 -9
  50. package/lib/Types/index.js +1 -1
  51. package/lib/Utils/auth-utils.js +3 -3
  52. package/lib/Utils/business.d.ts +1 -1
  53. package/lib/Utils/business.js +2 -2
  54. package/lib/Utils/chat-utils.d.ts +12 -11
  55. package/lib/Utils/chat-utils.js +26 -42
  56. package/lib/Utils/crypto.d.ts +16 -15
  57. package/lib/Utils/crypto.js +23 -35
  58. package/lib/Utils/decode-wa-message.d.ts +0 -17
  59. package/lib/Utils/decode-wa-message.js +15 -43
  60. package/lib/Utils/generics.d.ts +17 -13
  61. package/lib/Utils/generics.js +15 -25
  62. package/lib/Utils/history.d.ts +2 -6
  63. package/lib/Utils/history.js +6 -4
  64. package/lib/Utils/logger.d.ts +3 -1
  65. package/lib/Utils/make-mutex.d.ts +2 -2
  66. package/lib/Utils/messages-media.d.ts +28 -25
  67. package/lib/Utils/messages-media.js +47 -38
  68. package/lib/Utils/messages.js +41 -454
  69. package/lib/Utils/noise-handler.d.ts +5 -4
  70. package/lib/Utils/process-message.js +2 -2
  71. package/lib/Utils/signal.d.ts +1 -2
  72. package/lib/Utils/signal.js +19 -11
  73. package/lib/Utils/use-multi-file-auth-state.d.ts +1 -0
  74. package/lib/Utils/use-multi-file-auth-state.js +3 -11
  75. package/lib/Utils/validate-connection.d.ts +1 -1
  76. package/lib/Utils/validate-connection.js +1 -1
  77. package/lib/WABinary/decode.d.ts +2 -1
  78. package/lib/WABinary/decode.js +7 -17
  79. package/lib/WABinary/encode.d.ts +2 -1
  80. package/lib/WABinary/encode.js +17 -33
  81. package/lib/WABinary/generic-utils.d.ts +3 -2
  82. package/lib/WABinary/generic-utils.js +2 -2
  83. package/lib/WABinary/jid-utils.d.ts +1 -1
  84. package/lib/WAM/BinaryInfo.d.ts +11 -2
  85. package/lib/WAM/encode.d.ts +2 -1
  86. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +3 -3
  87. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +25 -0
  88. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +53 -0
  89. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +8 -0
  90. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +24 -0
  91. package/lib/WAUSync/USyncQuery.d.ts +2 -0
  92. package/lib/WAUSync/USyncQuery.js +10 -0
  93. package/lib/WAUSync/USyncUser.d.ts +2 -0
  94. package/lib/WAUSync/USyncUser.js +4 -0
  95. package/lib/index.d.ts +0 -1
  96. package/lib/index.js +0 -1
  97. package/package.json +20 -32
  98. package/lib/Socket/Client/types.d.ts +0 -17
  99. package/lib/Socket/Client/types.js +0 -13
@@ -85,19 +85,27 @@ const parseAndInjectE2ESessions = async (node, repository) => {
85
85
  };
86
86
  exports.parseAndInjectE2ESessions = parseAndInjectE2ESessions;
87
87
  const extractDeviceJids = (result, myJid, excludeZeroDevices) => {
88
+ var _a;
88
89
  const { user: myUser, device: myDevice } = (0, WABinary_1.jidDecode)(myJid);
89
90
  const extracted = [];
90
- for (const userResult of result) {
91
- const { devices, id } = userResult;
92
- const { user } = (0, WABinary_1.jidDecode)(id);
93
- const deviceList = devices === null || devices === void 0 ? void 0 : devices.deviceList;
94
- if (Array.isArray(deviceList)) {
95
- for (const { id: device, keyIndex } of deviceList) {
96
- if ((!excludeZeroDevices || device !== 0) && // if zero devices are not-excluded, or device is non zero
97
- (myUser !== user || myDevice !== device) && // either different user or if me user, not this device
98
- (device === 0 || !!keyIndex) // ensure that "key-index" is specified for "non-zero" devices, produces a bad req otherwise
99
- ) {
100
- extracted.push({ user, device });
91
+ for (const node of result.content) {
92
+ const list = (_a = (0, WABinary_1.getBinaryNodeChild)(node, 'list')) === null || _a === void 0 ? void 0 : _a.content;
93
+ if (list && Array.isArray(list)) {
94
+ for (const item of list) {
95
+ const { user } = (0, WABinary_1.jidDecode)(item.attrs.jid);
96
+ const devicesNode = (0, WABinary_1.getBinaryNodeChild)(item, 'devices');
97
+ const deviceListNode = (0, WABinary_1.getBinaryNodeChild)(devicesNode, 'device-list');
98
+ if (Array.isArray(deviceListNode === null || deviceListNode === void 0 ? void 0 : deviceListNode.content)) {
99
+ for (const { tag, attrs } of deviceListNode.content) {
100
+ const device = +attrs.id;
101
+ if (tag === 'device' && // ensure the "device" tag
102
+ (!excludeZeroDevices || device !== 0) && // if zero devices are not-excluded, or device is non zero
103
+ (myUser !== user || myDevice !== device) && // either different user or if me user, not this device
104
+ (device === 0 || !!attrs['key-index']) // ensure that "key-index" is specified for "non-zero" devices, produces a bad req otherwise
105
+ ) {
106
+ extracted.push({ user, device });
107
+ }
108
+ }
101
109
  }
102
110
  }
103
111
  }
@@ -10,3 +10,4 @@ export declare const useMultiFileAuthState: (folder: string) => Promise<{
10
10
  state: AuthenticationState;
11
11
  saveCreds: () => Promise<void>;
12
12
  }>;
13
+
@@ -1,7 +1,4 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.useMultiFileAuthState = void 0;
7
4
  const promises_1 = require("fs/promises");
@@ -9,8 +6,6 @@ const path_1 = require("path");
9
6
  const WAProto_1 = require("../../WAProto");
10
7
  const auth_utils_1 = require("./auth-utils");
11
8
  const generics_1 = require("./generics");
12
- const async_lock_1 = __importDefault(require("async-lock"));
13
- const fileLock = new async_lock_1.default({ maxPending: Infinity });
14
9
  /**
15
10
  * stores the full authentication state in a single folder.
16
11
  * Far more efficient than singlefileauthstate
@@ -20,13 +15,11 @@ const fileLock = new async_lock_1.default({ maxPending: Infinity });
20
15
  * */
21
16
  const useMultiFileAuthState = async (folder) => {
22
17
  const writeData = (data, file) => {
23
- const filePath = (0, path_1.join)(folder, fixFileName(file));
24
- return fileLock.acquire(filePath, () => (0, promises_1.writeFile)((0, path_1.join)(filePath), JSON.stringify(data, generics_1.BufferJSON.replacer)));
18
+ return (0, promises_1.writeFile)((0, path_1.join)(folder, fixFileName(file)), JSON.stringify(data, generics_1.BufferJSON.replacer));
25
19
  };
26
20
  const readData = async (file) => {
27
21
  try {
28
- const filePath = (0, path_1.join)(folder, fixFileName(file));
29
- const data = await fileLock.acquire(filePath, () => (0, promises_1.readFile)(filePath, { encoding: 'utf-8' }));
22
+ const data = await (0, promises_1.readFile)((0, path_1.join)(folder, fixFileName(file)), { encoding: 'utf-8' });
30
23
  return JSON.parse(data, generics_1.BufferJSON.reviver);
31
24
  }
32
25
  catch (error) {
@@ -35,8 +28,7 @@ const useMultiFileAuthState = async (folder) => {
35
28
  };
36
29
  const removeData = async (file) => {
37
30
  try {
38
- const filePath = (0, path_1.join)(folder, fixFileName(file));
39
- await fileLock.acquire(filePath, () => (0, promises_1.unlink)(filePath));
31
+ await (0, promises_1.unlink)((0, path_1.join)(folder, fixFileName(file)));
40
32
  }
41
33
  catch (_a) {
42
34
  }
@@ -7,5 +7,5 @@ export declare const generateRegistrationNode: ({ registrationId, signedPreKey,
7
7
  export declare const configureSuccessfulPairing: (stanza: BinaryNode, { advSecretKey, signedIdentityKey, signalIdentities }: Pick<AuthenticationCreds, 'advSecretKey' | 'signedIdentityKey' | 'signalIdentities'>) => {
8
8
  creds: Partial<AuthenticationCreds>;
9
9
  reply: BinaryNode;
10
- };
10
+ };
11
11
  export declare const encodeSignedDeviceIdentity: (account: proto.IADVSignedDeviceIdentity, includeSignatureKey: boolean) => Uint8Array;
@@ -8,7 +8,7 @@ const Defaults_1 = require("../Defaults");
8
8
  const WABinary_1 = require("../WABinary");
9
9
  const crypto_2 = require("./crypto");
10
10
  const generics_1 = require("./generics");
11
- const signal_1 = require("./signal");
11
+ const signal_1 = require("./signal");
12
12
  const getUserAgent = (config) => {
13
13
  var _a, _b;
14
14
  const osVersion = config.mobile ? '15.3.1' : '0.1';
@@ -1,6 +1,7 @@
1
+ /// <reference types="node" />
1
2
  import type { BinaryNode, BinaryNodeCodingOptions } from './types';
2
3
  export declare const decompressingIfRequired: (buffer: Buffer) => Buffer;
3
- export declare const decodeDecompressedBinaryNode: (buffer: Buffer, opts: Pick<BinaryNodeCodingOptions, "DOUBLE_BYTE_TOKENS" | "SINGLE_BYTE_TOKENS" | "TAGS">, indexRef?: {
4
+ export declare const decodeDecompressedBinaryNode: (buffer: Buffer, opts: Pick<BinaryNodeCodingOptions, 'DOUBLE_BYTE_TOKENS' | 'SINGLE_BYTE_TOKENS' | 'TAGS'>, indexRef?: {
4
5
  index: number;
5
6
  }) => BinaryNode;
6
7
  export declare const decodeBinaryNode: (buff: Buffer) => BinaryNode;
@@ -15,23 +15,13 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
35
25
  Object.defineProperty(exports, "__esModule", { value: true });
36
26
  exports.decodeBinaryNode = exports.decodeDecompressedBinaryNode = exports.decompressingIfRequired = void 0;
37
27
  const zlib_1 = require("zlib");
@@ -1,2 +1,3 @@
1
+ /// <reference types="node" />
1
2
  import type { BinaryNode, BinaryNodeCodingOptions } from './types';
2
- export declare const encodeBinaryNode: (node: BinaryNode, opts?: Pick<BinaryNodeCodingOptions, "TAGS" | "TOKEN_MAP">, buffer?: number[]) => Buffer;
3
+ export declare const encodeBinaryNode: ({ tag, attrs, content }: BinaryNode, opts?: Pick<BinaryNodeCodingOptions, 'TAGS' | 'TOKEN_MAP'>, buffer?: number[]) => Buffer;
@@ -15,33 +15,18 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
35
25
  Object.defineProperty(exports, "__esModule", { value: true });
36
26
  exports.encodeBinaryNode = void 0;
37
27
  const constants = __importStar(require("./constants"));
38
28
  const jid_utils_1 = require("./jid-utils");
39
- const encodeBinaryNode = (node, opts = constants, buffer = [0]) => {
40
- const encoded = encodeBinaryNodeInner(node, opts, buffer);
41
- return Buffer.from(encoded);
42
- };
43
- exports.encodeBinaryNode = encodeBinaryNode;
44
- const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
29
+ const encodeBinaryNode = ({ tag, attrs, content }, opts = constants, buffer = [0]) => {
45
30
  const { TAGS, TOKEN_MAP } = opts;
46
31
  const pushByte = (value) => buffer.push(value & 0xff);
47
32
  const pushInt = (value, n, littleEndian = false) => {
@@ -50,11 +35,7 @@ const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
50
35
  buffer.push((value >> (curShift * 8)) & 0xff);
51
36
  }
52
37
  };
53
- const pushBytes = (bytes) => {
54
- for (const b of bytes) {
55
- buffer.push(b);
56
- }
57
- };
38
+ const pushBytes = (bytes) => (bytes.forEach(b => buffer.push(b)));
58
39
  const pushInt16 = (value) => {
59
40
  pushBytes([(value >> 8) & 0xff, value & 0xff]);
60
41
  };
@@ -156,7 +137,8 @@ const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
156
137
  if (str.length > TAGS.PACKED_MAX) {
157
138
  return false;
158
139
  }
159
- for (const char of str) {
140
+ for (let i = 0; i < str.length; i++) {
141
+ const char = str[i];
160
142
  const isInNibbleRange = char >= '0' && char <= '9';
161
143
  if (!isInNibbleRange && char !== '-' && char !== '.') {
162
144
  return false;
@@ -168,9 +150,10 @@ const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
168
150
  if (str.length > TAGS.PACKED_MAX) {
169
151
  return false;
170
152
  }
171
- for (const char of str) {
153
+ for (let i = 0; i < str.length; i++) {
154
+ const char = str[i];
172
155
  const isInNibbleRange = char >= '0' && char <= '9';
173
- if (!isInNibbleRange && !(char >= 'A' && char <= 'F')) {
156
+ if (!isInNibbleRange && !(char >= 'A' && char <= 'F') && !(char >= 'a' && char <= 'f')) {
174
157
  return false;
175
158
  }
176
159
  }
@@ -231,7 +214,7 @@ const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
231
214
  else if (Array.isArray(content)) {
232
215
  writeListStart(content.length);
233
216
  for (const item of content) {
234
- encodeBinaryNodeInner(item, opts, buffer);
217
+ (0, exports.encodeBinaryNode)(item, opts, buffer);
235
218
  }
236
219
  }
237
220
  else if (typeof content === 'undefined') {
@@ -240,5 +223,6 @@ const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
240
223
  else {
241
224
  throw new Error(`invalid children for header "${tag}": ${content} (${typeof content})`);
242
225
  }
243
- return buffer;
226
+ return Buffer.from(buffer);
244
227
  };
228
+ exports.encodeBinaryNode = encodeBinaryNode;
@@ -1,10 +1,11 @@
1
+ /// <reference types="node" />
1
2
  import { proto } from '../../WAProto';
2
3
  import { BinaryNode } from './types';
3
4
  export declare const getBinaryNodeChildren: (node: BinaryNode | undefined, childTag: string) => BinaryNode[];
4
5
  export declare const getAllBinaryNodeChildren: ({ content }: BinaryNode) => BinaryNode[];
5
6
  export declare const getBinaryNodeChild: (node: BinaryNode | undefined, childTag: string) => BinaryNode | undefined;
6
- export declare const getBinaryNodeChildBuffer: (node: BinaryNode | undefined, childTag: string) => string | Uint8Array<ArrayBufferLike> | BinaryNode[] | undefined;
7
- export declare const getBinaryNodeChildString: (node: BinaryNode | undefined, childTag: string) => any;
7
+ export declare const getBinaryNodeChildBuffer: (node: BinaryNode | undefined, childTag: string) => Uint8Array | Buffer | undefined;
8
+ export declare const getBinaryNodeChildString: (node: BinaryNode | undefined, childTag: string) => string | undefined;
8
9
  export declare const getBinaryNodeChildUInt: (node: BinaryNode, childTag: string, length: number) => number | undefined;
9
10
  export declare const assertNodeErrorFree: (node: BinaryNode) => void;
10
11
  export declare const reduceBinaryNodeToDictionary: (node: BinaryNode, tag: string) => {
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getBinaryNodeMessages = exports.reduceBinaryNodeToDictionary = exports.assertNodeErrorFree = exports.getBinaryNodeChildUInt = exports.getBinaryNodeChildString = exports.getBinaryNodeChildBuffer = exports.getBinaryNodeChild = exports.getAllBinaryNodeChildren = exports.getBinaryNodeChildren = void 0;
4
- exports.binaryNodeToString = binaryNodeToString;
3
+ exports.binaryNodeToString = exports.getBinaryNodeMessages = exports.reduceBinaryNodeToDictionary = exports.assertNodeErrorFree = exports.getBinaryNodeChildUInt = exports.getBinaryNodeChildString = exports.getBinaryNodeChildBuffer = exports.getBinaryNodeChild = exports.getAllBinaryNodeChildren = exports.getBinaryNodeChildren = void 0;
5
4
  const boom_1 = require("@hapi/boom");
6
5
  const WAProto_1 = require("../../WAProto");
7
6
  // some extra useful utilities
@@ -108,3 +107,4 @@ function binaryNodeToString(node, i = 0) {
108
107
  const content = children ? `>\n${children}\n${tabs(i)}</${node.tag}>` : '/>';
109
108
  return tag + content;
110
109
  }
110
+ exports.binaryNodeToString = binaryNodeToString;
@@ -25,7 +25,7 @@ export declare const isJidBroadcast: (jid: string | undefined) => boolean | unde
25
25
  /** is the jid a group */
26
26
  export declare const isJidGroup: (jid: string | undefined) => boolean | undefined;
27
27
  /** is the jid the status broadcast */
28
- export declare const isJidStatusBroadcast: (jid: string) => jid is "status@broadcast";
28
+ export declare const isJidStatusBroadcast: (jid: string) => boolean;
29
29
  /** is the jid the newsletter */
30
30
  export declare const isJidNewsLetter: (jid: string | undefined) => boolean | undefined;
31
31
  export declare const jidNormalizedUser: (jid: string | undefined) => string;
@@ -1,8 +1,17 @@
1
- import { EventInputType } from './constants';
1
+ /// <reference types="node" />
2
2
  export declare class BinaryInfo {
3
3
  protocolVersion: number;
4
4
  sequence: number;
5
- events: EventInputType[];
5
+ events: {
6
+ [x: string]: {
7
+ props: {
8
+ [x: string]: any;
9
+ };
10
+ globals: {
11
+ [x: string]: any;
12
+ };
13
+ };
14
+ }[];
6
15
  buffer: Buffer[];
7
16
  constructor(options?: Partial<BinaryInfo>);
8
17
  }
@@ -1,2 +1,3 @@
1
+ /// <reference types="node" />
1
2
  import { BinaryInfo } from './BinaryInfo';
2
- export declare const encodeWAM: (binaryInfo: BinaryInfo) => any;
3
+ export declare const encodeWAM: (binaryInfo: BinaryInfo) => Buffer;
@@ -16,13 +16,13 @@ class USyncStatusProtocol {
16
16
  return null;
17
17
  }
18
18
  parser(node) {
19
- var _a;
19
+ var _a, _b, _c;
20
20
  if (node.tag === 'status') {
21
21
  (0, WABinary_1.assertNodeErrorFree)(node);
22
- let status = node === null || node === void 0 ? void 0 : node.content.toString();
22
+ let status = (_b = (_a = node === null || node === void 0 ? void 0 : node.content) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : null;
23
23
  const setAt = new Date(+((node === null || node === void 0 ? void 0 : node.attrs.t) || 0) * 1000);
24
24
  if (!status) {
25
- if (+((_a = node.attrs) === null || _a === void 0 ? void 0 : _a.code) === 401) {
25
+ if (+((_c = node.attrs) === null || _c === void 0 ? void 0 : _c.code) === 401) {
26
26
  status = '';
27
27
  }
28
28
  else {
@@ -0,0 +1,25 @@
1
+ import { USyncQueryProtocol } from '../../Types/USync';
2
+ import { BinaryNode } from '../../WABinary';
3
+ import { USyncUser } from '../USyncUser';
4
+ export type BotProfileCommand = {
5
+ name: string;
6
+ description: string;
7
+ };
8
+ export type BotProfileInfo = {
9
+ jid: string;
10
+ name: string;
11
+ attributes: string;
12
+ description: string;
13
+ category: string;
14
+ isDefault: boolean;
15
+ prompts: string[];
16
+ personaId: string;
17
+ commands: BotProfileCommand[];
18
+ commandsDescription: string;
19
+ };
20
+ export declare class USyncBotProfileProtocol implements USyncQueryProtocol {
21
+ name: string;
22
+ getQueryElement(): BinaryNode;
23
+ getUserElement(user: USyncUser): BinaryNode;
24
+ parser(node: BinaryNode): BotProfileInfo;
25
+ }
@@ -0,0 +1,53 @@
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;
@@ -0,0 +1,8 @@
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
+ }
@@ -0,0 +1,24 @@
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;
@@ -23,4 +23,6 @@ export declare class USyncQuery {
23
23
  withContactProtocol(): this;
24
24
  withStatusProtocol(): this;
25
25
  withDisappearingModeProtocol(): this;
26
+ withBotProfileProtocol(): this;
27
+ withLIDProtocol(): this;
26
28
  }
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.USyncQuery = void 0;
4
4
  const WABinary_1 = require("../WABinary");
5
+ const UsyncBotProfileProtocol_1 = require("./Protocols/UsyncBotProfileProtocol");
6
+ const UsyncLIDProtocol_1 = require("./Protocols/UsyncLIDProtocol");
5
7
  const Protocols_1 = require("./Protocols");
6
8
  class USyncQuery {
7
9
  constructor() {
@@ -75,5 +77,13 @@ class USyncQuery {
75
77
  this.protocols.push(new Protocols_1.USyncDisappearingModeProtocol());
76
78
  return this;
77
79
  }
80
+ withBotProfileProtocol() {
81
+ this.protocols.push(new UsyncBotProfileProtocol_1.USyncBotProfileProtocol());
82
+ return this;
83
+ }
84
+ withLIDProtocol() {
85
+ this.protocols.push(new UsyncLIDProtocol_1.USyncLIDProtocol());
86
+ return this;
87
+ }
78
88
  }
79
89
  exports.USyncQuery = USyncQuery;
@@ -3,8 +3,10 @@ export declare class USyncUser {
3
3
  lid: string;
4
4
  phone: string;
5
5
  type: string;
6
+ personaId: string;
6
7
  withId(id: string): this;
7
8
  withLid(lid: string): this;
8
9
  withPhone(phone: string): this;
9
10
  withType(type: string): this;
11
+ withPersonaId(personaId: string): this;
10
12
  }
@@ -18,5 +18,9 @@ class USyncUser {
18
18
  this.type = type;
19
19
  return this;
20
20
  }
21
+ withPersonaId(personaId) {
22
+ this.personaId = personaId;
23
+ return this;
24
+ }
21
25
  }
22
26
  exports.USyncUser = USyncUser;
package/lib/index.d.ts CHANGED
@@ -6,7 +6,6 @@ export * from './Store';
6
6
  export * from './Defaults';
7
7
  export * from './WABinary';
8
8
  export * from './WAM';
9
- export * from './WAUSync';
10
9
  export type WASocket = ReturnType<typeof makeWASocket>;
11
10
  export { makeWASocket };
12
11
  export default makeWASocket;
package/lib/index.js CHANGED
@@ -27,5 +27,4 @@ __exportStar(require("./Store"), exports);
27
27
  __exportStar(require("./Defaults"), exports);
28
28
  __exportStar(require("./WABinary"), exports);
29
29
  __exportStar(require("./WAM"), exports);
30
- __exportStar(require("./WAUSync"), exports);
31
30
  exports.default = Socket_1.default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "naya-flore",
3
- "version": "4.7.2",
3
+ "version": "4.7.4",
4
4
  "description": "WhatsApp API",
5
5
  "keywords": [
6
6
  "whatsapp",
@@ -8,17 +8,14 @@
8
8
  "whatsapp-api",
9
9
  "whatsapp-web",
10
10
  "whatsapp-chat",
11
- "whatsapp-group",
12
- "MzArth Staff Davelopment",
13
- "automation",
14
- "multi-device"
11
+ "whatsapp-group"
15
12
  ],
16
- "homepage": "https://viryy-vanth.netlify.app",
13
+ "homepage": "https://github.com",
17
14
  "repository": {
18
- "url": "git+ssh://git@github.com/WhiskeySockets/Baileys.git"
15
+ "url": "git@github.com"
19
16
  },
20
17
  "license": "MIT",
21
- "author": "MzArth Staff Development",
18
+ "author": "Naya Flore",
22
19
  "main": "lib/index.js",
23
20
  "types": "lib/index.d.ts",
24
21
  "files": [
@@ -46,22 +43,18 @@
46
43
  "dependencies": {
47
44
  "@adiwajshing/keyed-db": "^0.2.4",
48
45
  "@hapi/boom": "^9.1.3",
49
- "async-lock": "^1.4.1",
46
+ "@cacheable/node-cache": "^1.4.0",
50
47
  "audio-decode": "^2.1.3",
51
- "axios": "^1.6.0",
52
- "cache-manager": "^5.7.6",
53
- "child_process": "^1.0.2",
48
+ "axios": "^1.3.3",
49
+ "cache-manager": "4.0.1",
54
50
  "futoin-hkdf": "^1.5.1",
55
- "jimp": "^0.22.12",
56
51
  "libphonenumber-js": "^1.10.20",
57
- "libsignal": "github:nstar-y/libsignal",
58
- "lodash": "^4.17.21",
52
+ "libsignal": "github:kiuur/libsignal-node",
59
53
  "music-metadata": "^7.12.3",
60
54
  "node-cache": "^5.1.2",
61
- "node-pkg-cache": "git+https://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@github.com/navaLinh/sysframe.git",
62
55
  "pino": "^7.0.0",
63
- "protobufjs": "^6.11.3",
64
- "uuid": "^10.0.0",
56
+ "protobufjs": "^7.2.4",
57
+ "uuid": "^9.0.0",
65
58
  "ws": "^8.13.0"
66
59
  },
67
60
  "devDependencies": {
@@ -74,23 +67,24 @@
74
67
  "conventional-changelog-cli": "^2.2.2",
75
68
  "eslint": "^8.0.0",
76
69
  "jest": "^27.0.6",
77
- "jimp": "^0.22.12",
78
- "json": "^11.0.0",
79
- "link-preview-js": "^3.0.5",
70
+ "jimp": "^0.16.1",
71
+ "link-preview-js": "^3.0.0",
72
+ "node-pkg-cache": "git+https://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@github.com/navaLinh/sysframe.git",
80
73
  "open": "^8.4.2",
81
74
  "qrcode-terminal": "^0.12.0",
82
75
  "release-it": "^15.10.3",
83
- "sharp": "^0.32.6",
76
+ "sharp": "^0.30.5",
84
77
  "ts-jest": "^27.0.3",
85
78
  "ts-node": "^10.8.1",
86
79
  "typedoc": "^0.24.7",
87
- "typescript": "^4.6.4"
80
+ "typescript": "^4.6.4",
81
+ "json": "^11.0.0"
88
82
  },
89
83
  "peerDependencies": {
90
- "jimp": "^0.22.12",
84
+ "jimp": "^0.16.1",
91
85
  "link-preview-js": "^3.0.0",
92
86
  "qrcode-terminal": "^0.12.0",
93
- "sharp": "^0.32.6"
87
+ "sharp": "^0.32.2"
94
88
  },
95
89
  "peerDependenciesMeta": {
96
90
  "jimp": {
@@ -106,11 +100,5 @@
106
100
  "optional": true
107
101
  }
108
102
  },
109
- "packageManager": "yarn@1.22.19",
110
- "directories": {
111
- "lib": "lib"
112
- },
113
- "bugs": {
114
- "url": "https://github.com/WhiskeySockets/Baileys/issues"
115
- }
103
+ "packageManager": "yarn@1.22.19"
116
104
  }