@pontalabs/baileys 1.0.10 → 1.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 (119) hide show
  1. package/README.md +96 -85
  2. package/lib/Defaults/connection.js +39 -0
  3. package/lib/Defaults/constants.js +50 -0
  4. package/lib/Defaults/history.js +13 -0
  5. package/lib/Defaults/index.js +36 -151
  6. package/lib/Defaults/media.js +43 -0
  7. package/lib/Defaults/phonenumber-mcc.json +221 -221
  8. package/lib/Defaults/prefix.js +12 -0
  9. package/lib/Defaults/vialeys-version.json +7 -0
  10. package/lib/Signal/Group/ciphertext-message.js +10 -15
  11. package/lib/Signal/Group/group-session-builder.js +34 -60
  12. package/lib/Signal/Group/group_cipher.js +69 -76
  13. package/lib/Signal/Group/index.js +41 -60
  14. package/lib/Signal/Group/keyhelper.js +12 -57
  15. package/lib/Signal/Group/sender-chain-key.js +20 -33
  16. package/lib/Signal/Group/sender-key-distribution-message.js +43 -48
  17. package/lib/Signal/Group/sender-key-message.js +58 -53
  18. package/lib/Signal/Group/sender-key-name.js +21 -31
  19. package/lib/Signal/Group/sender-key-record.js +21 -34
  20. package/lib/Signal/Group/sender-key-state.js +59 -106
  21. package/lib/Signal/Group/sender-message-key.js +16 -21
  22. package/lib/Signal/libsignal.js +282 -203
  23. package/lib/Signal/lid-mapping.js +164 -184
  24. package/lib/Socket/Client/index.js +31 -22
  25. package/lib/Socket/Client/types.js +9 -15
  26. package/lib/Socket/Client/websocket.js +42 -37
  27. package/lib/Socket/business.js +212 -336
  28. package/lib/Socket/chats.js +696 -940
  29. package/lib/Socket/community.js +454 -369
  30. package/lib/Socket/groups.js +278 -280
  31. package/lib/Socket/index.js +9 -21
  32. package/lib/Socket/messages-recv.js +1027 -1570
  33. package/lib/Socket/messages-send.js +1180 -1136
  34. package/lib/Socket/mex.js +59 -0
  35. package/lib/Socket/newsletter.js +193 -251
  36. package/lib/Socket/socket.js +758 -898
  37. package/lib/Store/index.js +35 -24
  38. package/lib/Store/make-cache-manager-store.js +53 -66
  39. package/lib/Store/make-in-memory-store.js +319 -325
  40. package/lib/Store/make-ordered-dictionary.js +49 -57
  41. package/lib/Store/object-repository.js +10 -15
  42. package/lib/Types/Auth.js +2 -3
  43. package/lib/Types/Bussines.js +2 -3
  44. package/lib/Types/Call.js +2 -3
  45. package/lib/Types/Chat.js +10 -9
  46. package/lib/Types/Contact.js +2 -3
  47. package/lib/Types/Events.js +2 -3
  48. package/lib/Types/GroupMetadata.js +2 -3
  49. package/lib/Types/Label.js +6 -12
  50. package/lib/Types/LabelAssociation.js +4 -13
  51. package/lib/Types/Message.js +10 -18
  52. package/lib/Types/MexUpdates.js +15 -18
  53. package/lib/Types/Newsletter.js +26 -34
  54. package/lib/Types/Product.js +2 -3
  55. package/lib/Types/Signal.js +2 -3
  56. package/lib/Types/Socket.js +2 -3
  57. package/lib/Types/State.js +8 -13
  58. package/lib/Types/USync.js +2 -3
  59. package/lib/Types/index.js +49 -40
  60. package/lib/Utils/auth-utils.js +190 -495
  61. package/lib/Utils/browser-utils.js +29 -0
  62. package/lib/Utils/business.js +177 -199
  63. package/lib/Utils/chat-utils.js +711 -624
  64. package/lib/Utils/crypto.js +116 -161
  65. package/lib/Utils/decode-wa-message.js +225 -321
  66. package/lib/Utils/event-buffer.js +363 -405
  67. package/lib/Utils/generics.js +318 -472
  68. package/lib/Utils/history.js +72 -76
  69. package/lib/Utils/index.js +49 -41
  70. package/lib/Utils/link-preview.js +59 -103
  71. package/lib/Utils/logger.js +4 -7
  72. package/lib/Utils/lt-hash.js +29 -42
  73. package/lib/Utils/make-mutex.js +26 -42
  74. package/lib/Utils/message-retry-manager.js +134 -160
  75. package/lib/Utils/messages-media.js +665 -731
  76. package/lib/Utils/messages.js +518 -1
  77. package/lib/Utils/noise-handler.js +127 -125
  78. package/lib/Utils/pre-key-manager.js +86 -0
  79. package/lib/Utils/process-message.js +739 -351
  80. package/lib/Utils/signal.js +146 -129
  81. package/lib/Utils/use-multi-file-auth-state.js +68 -135
  82. package/lib/Utils/validate-connection.js +183 -142
  83. package/lib/Utils/vialeys-event-stream.js +41 -0
  84. package/lib/WABinary/constants.js +1281 -1289
  85. package/lib/WABinary/decode.js +145 -200
  86. package/lib/WABinary/encode.js +149 -202
  87. package/lib/WABinary/generic-utils.js +79 -97
  88. package/lib/WABinary/index.js +36 -25
  89. package/lib/WABinary/jid-utils.js +91 -123
  90. package/lib/WABinary/types.js +2 -3
  91. package/lib/WAM/BinaryInfo.js +8 -13
  92. package/lib/WAM/constants.js +16584 -11464
  93. package/lib/WAM/encode.js +117 -133
  94. package/lib/WAM/index.js +34 -23
  95. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +62 -69
  96. package/lib/WAUSync/Protocols/USyncContactProtocol.js +11 -25
  97. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +32 -44
  98. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +13 -23
  99. package/lib/WAUSync/Protocols/USyncLIDProtocol.js +24 -38
  100. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +17 -31
  101. package/lib/WAUSync/Protocols/index.js +37 -26
  102. package/lib/WAUSync/USyncQuery.js +66 -66
  103. package/lib/WAUSync/USyncUser.js +13 -18
  104. package/lib/WAUSync/index.js +34 -23
  105. package/lib/index.js +95 -28
  106. package/package.json +4 -3
  107. package/lib/Defaults/baileys-version.json +0 -3
  108. package/lib/Signal/Group/queue-job.d.ts +0 -1
  109. package/lib/Signal/Group/queue-job.js +0 -57
  110. package/lib/Socket/usync.d.ts +0 -37
  111. package/lib/Socket/usync.js +0 -83
  112. package/lib/Utils/baileys-event-stream.d.ts +0 -18
  113. package/lib/Utils/baileys-event-stream.js +0 -70
  114. package/lib/Utils/signal-housekeeping.d.ts +0 -19
  115. package/lib/Utils/signal-housekeeping.js +0 -73
  116. package/lib/Utils/use-mongo-file-auth-state.d.ts +0 -6
  117. package/lib/Utils/use-mongo-file-auth-state.js +0 -84
  118. package/lib/Utils/use-single-file-auth-state.d.ts +0 -13
  119. package/lib/Utils/use-single-file-auth-state.js +0 -80
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const { platform: platform, release: release } = require("os");
4
+ const { proto: proto } = require("../../WAProto");
5
+ const PLATFORM_MAP = {
6
+ aix: "AIX",
7
+ darwin: "Mac OS",
8
+ win32: "Windows",
9
+ android: "Android",
10
+ freebsd: "FreeBSD",
11
+ openbsd: "OpenBSD",
12
+ sunos: "Solaris",
13
+ linux: undefined,
14
+ haiku: undefined,
15
+ cygwin: undefined,
16
+ netbsd: undefined,
17
+ };
18
+ const Browsers = {
19
+ ubuntu: (browser) => ["Ubuntu", browser, "22.04.4"],
20
+ macOS: (browser) => ["Mac OS", browser, "14.4.1"],
21
+ baileys: (browser) => ["Baileys", browser, "6.5.0"],
22
+ windows: (browser) => ["Windows", browser, "10.0.22631"],
23
+ appropriate: (browser) => [PLATFORM_MAP[platform()] || "Ubuntu", browser, release()],
24
+ };
25
+ const getPlatformId = (browser) => {
26
+ const platformType = proto.DeviceProps.PlatformType[browser.toUpperCase()];
27
+ return platformType ? platformType.toString() : "1";
28
+ };
29
+ module.exports = { Browsers: Browsers, getPlatformId: getPlatformId };
@@ -1,255 +1,233 @@
1
- "use strict"
2
-
3
- Object.defineProperty(exports, "__esModule", { value: true })
4
-
5
- const boom_1 = require("@hapi/boom")
6
- const crypto_1 = require("crypto")
7
- const path_1 = require("path")
8
- const os_1 = require("os")
9
- const fs_1 = require("fs")
10
- const WABinary_1 = require("../WABinary")
11
- const generics_1 = require("./generics")
12
- const messages_media_1 = require("./messages-media")
13
-
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const { Boom: Boom } = require("@hapi/boom");
4
+ const { createHash: createHash } = require("crypto");
5
+ const { join: join } = require("path");
6
+ const { tmpdir: tmpdir } = require("os");
7
+ const { promises: promises, createWriteStream: createWriteStream } = require("fs");
8
+ const {
9
+ getBinaryNodeChild: getBinaryNodeChild,
10
+ getBinaryNodeChildren: getBinaryNodeChildren,
11
+ getBinaryNodeChildString: getBinaryNodeChildString,
12
+ } = require("../WABinary");
13
+ const {
14
+ getStream: getStream,
15
+ getUrlFromDirectPath: getUrlFromDirectPath,
16
+ } = require("./messages-media");
17
+ const { generateMessageID: generateMessageID } = require("./generics");
14
18
  const parseCatalogNode = (node) => {
15
- const catalogNode = WABinary_1.getBinaryNodeChild(node, 'product_catalog')
16
- const products = WABinary_1.getBinaryNodeChildren(catalogNode, 'product').map(parseProductNode)
17
- const paging = WABinary_1.getBinaryNodeChild(catalogNode, 'paging')
19
+ const catalogNode = getBinaryNodeChild(node, "product_catalog");
20
+ const products = getBinaryNodeChildren(catalogNode, "product").map(parseProductNode);
21
+ const paging = getBinaryNodeChild(catalogNode, "paging");
18
22
  return {
19
- products,
20
- nextPageCursor: paging
21
- ? WABinary_1.getBinaryNodeChildString(paging, 'after')
22
- : undefined
23
- }
24
- }
25
-
23
+ products: products,
24
+ nextPageCursor: paging ? getBinaryNodeChildString(paging, "after") : undefined,
25
+ };
26
+ };
26
27
  const parseCollectionsNode = (node) => {
27
- const collectionsNode = WABinary_1.getBinaryNodeChild(node, 'collections')
28
- const collections = WABinary_1.getBinaryNodeChildren(collectionsNode, 'collection').map(collectionNode => {
29
- const id = WABinary_1.getBinaryNodeChildString(collectionNode, 'id')
30
- const name = WABinary_1.getBinaryNodeChildString(collectionNode, 'name')
31
- const products = WABinary_1.getBinaryNodeChildren(collectionNode, 'product').map(parseProductNode)
32
- return {
33
- id,
34
- name,
35
- products,
36
- status: parseStatusInfo(collectionNode)
28
+ const collectionsNode = getBinaryNodeChild(node, "collections");
29
+ const collections = getBinaryNodeChildren(collectionsNode, "collection").map(
30
+ (collectionNode) => {
31
+ const id = getBinaryNodeChildString(collectionNode, "id");
32
+ const name = getBinaryNodeChildString(collectionNode, "name");
33
+ const products = getBinaryNodeChildren(collectionNode, "product").map(parseProductNode);
34
+ return {
35
+ id: id,
36
+ name: name,
37
+ products: products,
38
+ status: parseStatusInfo(collectionNode),
39
+ };
37
40
  }
38
- })
39
- return {
40
- collections
41
- }
42
- }
43
-
41
+ );
42
+ return { collections: collections };
43
+ };
44
44
  const parseOrderDetailsNode = (node) => {
45
- const orderNode = WABinary_1.getBinaryNodeChild(node, 'order')
46
- const products = WABinary_1.getBinaryNodeChildren(orderNode, 'product').map(productNode => {
47
- const imageNode = WABinary_1.getBinaryNodeChild(productNode, 'image')
45
+ const orderNode = getBinaryNodeChild(node, "order");
46
+ const products = getBinaryNodeChildren(orderNode, "product").map((productNode) => {
47
+ const imageNode = getBinaryNodeChild(productNode, "image");
48
48
  return {
49
- id: WABinary_1.getBinaryNodeChildString(productNode, 'id'),
50
- name: WABinary_1.getBinaryNodeChildString(productNode, 'name'),
51
- imageUrl: WABinary_1.getBinaryNodeChildString(imageNode, 'url'),
52
- price: +WABinary_1.getBinaryNodeChildString(productNode, 'price'),
53
- currency: WABinary_1.getBinaryNodeChildString(productNode, 'currency'),
54
- quantity: +WABinary_1.getBinaryNodeChildString(productNode, 'quantity')
55
- }
56
- })
57
- const priceNode = WABinary_1.getBinaryNodeChild(orderNode, 'price')
49
+ id: getBinaryNodeChildString(productNode, "id"),
50
+ name: getBinaryNodeChildString(productNode, "name"),
51
+ imageUrl: getBinaryNodeChildString(imageNode, "url"),
52
+ price: +getBinaryNodeChildString(productNode, "price"),
53
+ currency: getBinaryNodeChildString(productNode, "currency"),
54
+ quantity: +getBinaryNodeChildString(productNode, "quantity"),
55
+ };
56
+ });
57
+ const priceNode = getBinaryNodeChild(orderNode, "price");
58
58
  const orderDetails = {
59
59
  price: {
60
- total: +WABinary_1.getBinaryNodeChildString(priceNode, 'total'),
61
- currency: WABinary_1.getBinaryNodeChildString(priceNode, 'currency'),
60
+ total: +getBinaryNodeChildString(priceNode, "total"),
61
+ currency: getBinaryNodeChildString(priceNode, "currency"),
62
62
  },
63
- products
64
- }
65
- return orderDetails
66
- }
67
-
63
+ products: products,
64
+ };
65
+ return orderDetails;
66
+ };
68
67
  const toProductNode = (productId, product) => {
69
- const attrs = {}
70
- const content = []
71
- if (typeof productId !== 'undefined') {
72
- content.push({
73
- tag: 'id',
74
- attrs: {},
75
- content: Buffer.from(productId)
76
- })
68
+ const attrs = {};
69
+ const content = [];
70
+ if (typeof productId !== "undefined") {
71
+ content.push({ tag: "id", attrs: {}, content: Buffer.from(productId) });
77
72
  }
78
- if (typeof product.name !== 'undefined') {
73
+ if (typeof product.name !== "undefined") {
79
74
  content.push({
80
- tag: 'name',
75
+ tag: "name",
81
76
  attrs: {},
82
- content: Buffer.from(product.name)
83
- })
77
+ content: Buffer.from(product.name),
78
+ });
84
79
  }
85
- if (typeof product.description !== 'undefined') {
80
+ if (typeof product.description !== "undefined") {
86
81
  content.push({
87
- tag: 'description',
82
+ tag: "description",
88
83
  attrs: {},
89
- content: Buffer.from(product.description)
90
- })
84
+ content: Buffer.from(product.description),
85
+ });
91
86
  }
92
- if (typeof product.retailerId !== 'undefined') {
87
+ if (typeof product.retailerId !== "undefined") {
93
88
  content.push({
94
- tag: 'retailer_id',
89
+ tag: "retailer_id",
95
90
  attrs: {},
96
- content: Buffer.from(product.retailerId)
97
- })
91
+ content: Buffer.from(product.retailerId),
92
+ });
98
93
  }
99
94
  if (product.images.length) {
100
95
  content.push({
101
- tag: 'media',
96
+ tag: "media",
102
97
  attrs: {},
103
- content: product.images.map(img => {
104
- if (!('url' in img)) {
105
- throw new boom_1.Boom('Expected img for product to already be uploaded', { statusCode: 400 })
98
+ content: product.images.map((img) => {
99
+ if (!("url" in img)) {
100
+ throw new Boom("Expected img for product to already be uploaded", {
101
+ statusCode: 400,
102
+ });
106
103
  }
107
104
  return {
108
- tag: 'image',
105
+ tag: "image",
109
106
  attrs: {},
110
- content: [
111
- {
112
- tag: 'url',
113
- attrs: {},
114
- content: Buffer.from(img.url.toString())
115
- }
116
- ]
117
- }
118
- })
119
- })
107
+ content: [{ tag: "url", attrs: {}, content: Buffer.from(img.url.toString()) }],
108
+ };
109
+ }),
110
+ });
120
111
  }
121
- if (typeof product.price !== 'undefined') {
112
+ if (typeof product.price !== "undefined") {
122
113
  content.push({
123
- tag: 'price',
114
+ tag: "price",
124
115
  attrs: {},
125
- content: Buffer.from(product.price.toString())
126
- })
116
+ content: Buffer.from(product.price.toString()),
117
+ });
127
118
  }
128
- if (typeof product.currency !== 'undefined') {
119
+ if (typeof product.currency !== "undefined") {
129
120
  content.push({
130
- tag: 'currency',
121
+ tag: "currency",
131
122
  attrs: {},
132
- content: Buffer.from(product.currency)
133
- })
123
+ content: Buffer.from(product.currency),
124
+ });
134
125
  }
135
- if ('originCountryCode' in product) {
136
- if (typeof product.originCountryCode === 'undefined') {
137
- attrs['compliance_category'] = 'COUNTRY_ORIGIN_EXEMPT'
138
- }
139
- else {
126
+ if ("originCountryCode" in product) {
127
+ if (typeof product.originCountryCode === "undefined") {
128
+ attrs["compliance_category"] = "COUNTRY_ORIGIN_EXEMPT";
129
+ } else {
140
130
  content.push({
141
- tag: 'compliance_info',
131
+ tag: "compliance_info",
142
132
  attrs: {},
143
133
  content: [
144
134
  {
145
- tag: 'country_code_origin',
135
+ tag: "country_code_origin",
146
136
  attrs: {},
147
- content: Buffer.from(product.originCountryCode)
148
- }
149
- ]
150
- })
137
+ content: Buffer.from(product.originCountryCode),
138
+ },
139
+ ],
140
+ });
151
141
  }
152
142
  }
153
- if (typeof product.isHidden !== 'undefined') {
154
- attrs['is_hidden'] = product.isHidden.toString()
143
+ if (typeof product.isHidden !== "undefined") {
144
+ attrs["is_hidden"] = product.isHidden.toString();
155
145
  }
156
- const node = {
157
- tag: 'product',
158
- attrs,
159
- content
160
- }
161
- return node
162
- }
163
-
146
+ const node = { tag: "product", attrs: attrs, content: content };
147
+ return node;
148
+ };
164
149
  const parseProductNode = (productNode) => {
165
- const isHidden = productNode.attrs.is_hidden === 'true'
166
- const id = WABinary_1.getBinaryNodeChildString(productNode, 'id')
167
- const mediaNode = WABinary_1.getBinaryNodeChild(productNode, 'media')
168
- const statusInfoNode = WABinary_1.getBinaryNodeChild(productNode, 'status_info')
150
+ const isHidden = productNode.attrs.is_hidden === "true";
151
+ const id = getBinaryNodeChildString(productNode, "id");
152
+ const mediaNode = getBinaryNodeChild(productNode, "media");
153
+ const statusInfoNode = getBinaryNodeChild(productNode, "status_info");
169
154
  const product = {
170
- id,
155
+ id: id,
171
156
  imageUrls: parseImageUrls(mediaNode),
172
157
  reviewStatus: {
173
- whatsapp: WABinary_1.getBinaryNodeChildString(statusInfoNode, 'status'),
158
+ whatsapp: getBinaryNodeChildString(statusInfoNode, "status"),
174
159
  },
175
- availability: 'in stock',
176
- name: WABinary_1.getBinaryNodeChildString(productNode, 'name'),
177
- retailerId: WABinary_1.getBinaryNodeChildString(productNode, 'retailer_id'),
178
- url: WABinary_1.getBinaryNodeChildString(productNode, 'url'),
179
- description: WABinary_1.getBinaryNodeChildString(productNode, 'description'),
180
- price: +WABinary_1.getBinaryNodeChildString(productNode, 'price'),
181
- currency: WABinary_1.getBinaryNodeChildString(productNode, 'currency'),
182
- isHidden,
183
- }
184
- return product
185
- }
186
-
187
- /**
188
- * Uploads images not already uploaded to WA's servers
189
- */
190
- async function uploadingNecessaryImagesOfProduct(product, waUploadToServer, timeoutMs = 30000) {
160
+ availability: "in stock",
161
+ name: getBinaryNodeChildString(productNode, "name"),
162
+ retailerId: getBinaryNodeChildString(productNode, "retailer_id"),
163
+ url: getBinaryNodeChildString(productNode, "url"),
164
+ description: getBinaryNodeChildString(productNode, "description"),
165
+ price: +getBinaryNodeChildString(productNode, "price"),
166
+ currency: getBinaryNodeChildString(productNode, "currency"),
167
+ isHidden: isHidden,
168
+ };
169
+ return product;
170
+ };
171
+ async function uploadingNecessaryImagesOfProduct(product, waUploadToServer, timeoutMs = 3e4) {
191
172
  product = {
192
173
  ...product,
193
- images: product.images ? await uploadingNecessaryImages(product.images, waUploadToServer, timeoutMs) : product.images
194
- }
195
- return product
174
+ images: product.images
175
+ ? await uploadingNecessaryImages(product.images, waUploadToServer, timeoutMs)
176
+ : product.images,
177
+ };
178
+ return product;
196
179
  }
197
-
198
- /**
199
- * Uploads images not already uploaded to WA's servers
200
- */
201
- const uploadingNecessaryImages = async (images, waUploadToServer, timeoutMs = 30000) => {
202
- const results = await Promise.all(images.map(async (img) => {
203
- if ('url' in img) {
204
- const url = img.url.toString()
205
- if (url.includes('.whatsapp.net')) {
206
- return { url }
180
+ const uploadingNecessaryImages = async (images, waUploadToServer, timeoutMs = 3e4) => {
181
+ const results = await Promise.all(
182
+ images.map(async (img) => {
183
+ if ("url" in img) {
184
+ const url = img.url.toString();
185
+ if (url.includes(".whatsapp.net")) {
186
+ return { url: url };
187
+ }
207
188
  }
208
- }
209
- const { stream } = await messages_media_1.getStream(img)
210
- const hasher = crypto_1.createHash('sha256')
211
- const filePath = path_1.join(os_1.tmpdir(), 'img' + generics_1.generateMessageID())
212
- const encFileWriteStream = fs_1.createWriteStream(filePath)
213
- for await (const block of stream) {
214
- hasher.update(block)
215
- encFileWriteStream.write(block)
216
- }
217
- const sha = hasher.digest('base64')
218
- const { directPath } = await waUploadToServer(filePath, {
219
- mediaType: 'product-catalog-image',
220
- fileEncSha256B64: sha,
221
- timeoutMs
189
+ const { stream: stream } = await getStream(img);
190
+ const hasher = createHash("sha256");
191
+ const filePath = join(tmpdir(), "img" + generateMessageID());
192
+ const encFileWriteStream = createWriteStream(filePath);
193
+ for await (const block of stream) {
194
+ hasher.update(block);
195
+ encFileWriteStream.write(block);
196
+ }
197
+ const sha = hasher.digest("base64");
198
+ const { directPath: directPath } = await waUploadToServer(filePath, {
199
+ mediaType: "product-catalog-image",
200
+ fileEncSha256B64: sha,
201
+ timeoutMs: timeoutMs,
202
+ });
203
+ await promises
204
+ .unlink(filePath)
205
+ .catch((err) => console.log("Error deleting temp file ", err));
206
+ return { url: getUrlFromDirectPath(directPath) };
222
207
  })
223
- await fs_1.promises
224
- .unlink(filePath)
225
- .catch(err => console.log('Error deleting temp file ', err))
226
- return { url: messages_media_1.getUrlFromDirectPath(directPath) }
227
- }))
228
- return results
229
- }
230
-
208
+ );
209
+ return results;
210
+ };
231
211
  const parseImageUrls = (mediaNode) => {
232
- const imgNode = WABinary_1.getBinaryNodeChild(mediaNode, 'image')
212
+ const imgNode = getBinaryNodeChild(mediaNode, "image");
233
213
  return {
234
- requested: WABinary_1.getBinaryNodeChildString(imgNode, 'request_image_url'),
235
- original: WABinary_1.getBinaryNodeChildString(imgNode, 'original_image_url')
236
- }
237
- }
238
-
214
+ requested: getBinaryNodeChildString(imgNode, "request_image_url"),
215
+ original: getBinaryNodeChildString(imgNode, "original_image_url"),
216
+ };
217
+ };
239
218
  const parseStatusInfo = (mediaNode) => {
240
- const node = WABinary_1.getBinaryNodeChild(mediaNode, 'status_info')
219
+ const node = getBinaryNodeChild(mediaNode, "status_info");
241
220
  return {
242
- status: WABinary_1.getBinaryNodeChildString(node, 'status'),
243
- canAppeal: WABinary_1.getBinaryNodeChildString(node, 'can_appeal') === 'true',
244
- }
245
- }
246
-
221
+ status: getBinaryNodeChildString(node, "status"),
222
+ canAppeal: getBinaryNodeChildString(node, "can_appeal") === "true",
223
+ };
224
+ };
247
225
  module.exports = {
248
- parseCatalogNode,
249
- parseCollectionsNode,
250
- parseOrderDetailsNode,
251
- toProductNode,
252
- parseProductNode,
253
- uploadingNecessaryImagesOfProduct,
254
- uploadingNecessaryImages
255
- }
226
+ parseCatalogNode: parseCatalogNode,
227
+ parseCollectionsNode: parseCollectionsNode,
228
+ parseOrderDetailsNode: parseOrderDetailsNode,
229
+ toProductNode: toProductNode,
230
+ parseProductNode: parseProductNode,
231
+ uploadingNecessaryImagesOfProduct: uploadingNecessaryImagesOfProduct,
232
+ uploadingNecessaryImages: uploadingNecessaryImages,
233
+ };