node-ainzfb-new 1.6.2902-test → 1.6.2909-test

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. package/package.json +7 -7
  2. package/src/addExternalModule.js +13 -6
  3. package/src/addUserToGroup.js +35 -12
  4. package/src/changeAdminStatus.js +32 -16
  5. package/src/changeArchivedStatus.js +15 -9
  6. package/src/changeAvt.js +75 -69
  7. package/src/changeBio.js +12 -8
  8. package/src/changeBlockedStatus.js +14 -8
  9. package/src/changeGroupImage.js +27 -13
  10. package/src/changeNickname.js +19 -10
  11. package/src/changeThreadColor.js +15 -10
  12. package/src/changeThreadEmoji.js +17 -9
  13. package/src/createNewGroup.js +18 -10
  14. package/src/createPoll.js +16 -11
  15. package/src/deleteMessage.js +16 -10
  16. package/src/deleteThread.js +16 -10
  17. package/src/forwardAttachment.js +14 -9
  18. package/src/getAccessToken.js +21 -21
  19. package/src/getCurrentUserID.js +1 -1
  20. package/src/getEmojiUrl.js +3 -2
  21. package/src/getFriendsList.js +18 -10
  22. package/src/getMessage.js +52 -48
  23. package/src/getThreadHistory.js +156 -59
  24. package/src/getThreadHistoryDeprecated.js +26 -15
  25. package/src/getThreadInfo.js +3423 -18
  26. package/src/getThreadInfoDeprecated.js +25 -13
  27. package/src/getThreadList.js +112 -53
  28. package/src/getThreadListDeprecated.js +30 -12
  29. package/src/getThreadPictures.js +25 -13
  30. package/src/getUserID.js +7 -7
  31. package/src/getUserInfo.js +12 -9
  32. package/src/getUserInfoV2.js +19 -22
  33. package/src/handleFriendRequest.js +10 -9
  34. package/src/handleMessageRequest.js +16 -10
  35. package/src/httpGet.js +18 -13
  36. package/src/httpPost.js +18 -13
  37. package/src/httpPostFormData.js +14 -9
  38. package/src/listenMqtt.js +1218 -571
  39. package/src/logout.js +18 -13
  40. package/src/markAsDelivered.js +16 -10
  41. package/src/markAsRead.js +36 -24
  42. package/src/markAsReadAll.js +14 -10
  43. package/src/markAsSeen.js +18 -11
  44. package/src/muteThread.js +12 -8
  45. package/src/removeUserFromGroup.js +33 -10
  46. package/src/resolvePhotoUrl.js +8 -6
  47. package/src/searchForThread.js +13 -8
  48. package/src/sendMessage.js +172 -78
  49. package/src/sendTypingIndicator.js +29 -14
  50. package/src/setMessageReaction.js +13 -8
  51. package/src/setPostReaction.js +97 -95
  52. package/src/setTitle.js +18 -12
  53. package/src/threadColors.js +17 -17
  54. package/src/unfriend.js +14 -9
  55. package/src/unsendMessage.js +7 -7
  56. package/utils.js +2273 -1066
@@ -3,19 +3,20 @@
3
3
  var utils = require("../utils");
4
4
  var log = require("npmlog");
5
5
 
6
- module.exports = function (defaultFuncs, api, ctx) {
6
+ module.exports = function(defaultFuncs, api, ctx) {
7
7
  return function handleFriendRequest(userID, accept, callback) {
8
- if (utils.getType(accept) !== "Boolean") throw { error: "Please pass a boolean as a second argument." };
8
+ if (utils.getType(accept) !== "Boolean")
9
+ throw { error: "Please pass a boolean as a second argument." };
9
10
 
10
- var resolveFunc = function () { };
11
- var rejectFunc = function () { };
12
- var returnPromise = new Promise(function (resolve, reject) {
11
+ var resolveFunc = function() {};
12
+ var rejectFunc = function() {};
13
+ var returnPromise = new Promise(function(resolve, reject) {
13
14
  resolveFunc = resolve;
14
15
  rejectFunc = reject;
15
16
  });
16
17
 
17
18
  if (!callback) {
18
- callback = function (err, data) {
19
+ callback = function(err, data) {
19
20
  if (err) return rejectFunc(err);
20
21
  resolveFunc(data);
21
22
  };
@@ -26,17 +27,17 @@ module.exports = function (defaultFuncs, api, ctx) {
26
27
  "frefs[0]": "jwl",
27
28
  floc: "friend_center_requests",
28
29
  ref: "/reqs.php",
29
- action: (accept ? "confirm" : "reject")
30
+ action: accept ? "confirm" : "reject"
30
31
  };
31
32
 
32
33
  defaultFuncs
33
34
  .post("https://www.facebook.com/requests/friends/ajax/", ctx.jar, form)
34
35
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
35
- .then(function (resData) {
36
+ .then(function(resData) {
36
37
  if (resData.payload.err) throw { err: resData.payload.err };
37
38
  return callback();
38
39
  })
39
- .catch(function (err) {
40
+ .catch(function(err) {
40
41
  log.error("handleFriendRequest", err);
41
42
  return callback(err);
42
43
  });
@@ -3,19 +3,20 @@
3
3
  var utils = require("../utils");
4
4
  var log = require("npmlog");
5
5
 
6
- module.exports = function (defaultFuncs, api, ctx) {
6
+ module.exports = function(defaultFuncs, api, ctx) {
7
7
  return function handleMessageRequest(threadID, accept, callback) {
8
- if (utils.getType(accept) !== "Boolean") throw { error: "Please pass a boolean as a second argument." };
8
+ if (utils.getType(accept) !== "Boolean")
9
+ throw { error: "Please pass a boolean as a second argument." };
9
10
 
10
- var resolveFunc = function () { };
11
- var rejectFunc = function () { };
12
- var returnPromise = new Promise(function (resolve, reject) {
11
+ var resolveFunc = function() {};
12
+ var rejectFunc = function() {};
13
+ var returnPromise = new Promise(function(resolve, reject) {
13
14
  resolveFunc = resolve;
14
15
  rejectFunc = reject;
15
16
  });
16
17
 
17
18
  if (!callback) {
18
- callback = function (err, data) {
19
+ callback = function(err, data) {
19
20
  if (err) return rejectFunc(err);
20
21
  resolveFunc(data);
21
22
  };
@@ -29,17 +30,22 @@ module.exports = function (defaultFuncs, api, ctx) {
29
30
 
30
31
  var messageBox = accept ? "inbox" : "other";
31
32
 
32
- for (var i = 0; i < threadID.length; i++) form[messageBox + "[" + i + "]"] = threadID[i];
33
+ for (var i = 0; i < threadID.length; i++)
34
+ form[messageBox + "[" + i + "]"] = threadID[i];
33
35
 
34
36
  defaultFuncs
35
- .post("https://www.facebook.com/ajax/mercury/move_thread.php", ctx.jar, form)
37
+ .post(
38
+ "https://www.facebook.com/ajax/mercury/move_thread.php",
39
+ ctx.jar,
40
+ form
41
+ )
36
42
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
37
- .then(function (resData) {
43
+ .then(function(resData) {
38
44
  if (resData.error) throw resData;
39
45
 
40
46
  return callback();
41
47
  })
42
- .catch(function (err) {
48
+ .catch(function(err) {
43
49
  log.error("handleMessageRequest", err);
44
50
  return callback(err);
45
51
  });
package/src/httpGet.js CHANGED
@@ -3,42 +3,47 @@
3
3
  var utils = require("../utils");
4
4
  var log = require("npmlog");
5
5
 
6
- module.exports = function (defaultFuncs, api, ctx) {
6
+ module.exports = function(defaultFuncs, api, ctx) {
7
7
  return function httpGet(url, form, callback, notAPI) {
8
- var resolveFunc = function () { };
9
- var rejectFunc = function () { };
8
+ var resolveFunc = function() {};
9
+ var rejectFunc = function() {};
10
10
 
11
- var returnPromise = new Promise(function (resolve, reject) {
11
+ var returnPromise = new Promise(function(resolve, reject) {
12
12
  resolveFunc = resolve;
13
13
  rejectFunc = reject;
14
14
  });
15
15
 
16
- if (!callback && (utils.getType(form) == "Function" || utils.getType(form) == "AsyncFunction")) {
16
+ if (
17
+ !callback &&
18
+ (utils.getType(form) == "Function" ||
19
+ utils.getType(form) == "AsyncFunction")
20
+ ) {
17
21
  callback = form;
18
22
  form = {};
19
23
  }
20
24
 
21
25
  form = form || {};
22
26
 
23
- callback = callback || function (err, data) {
24
- if (err) return rejectFunc(err);
25
- resolveFunc(data);
26
- };
27
+ callback =
28
+ callback ||
29
+ function(err, data) {
30
+ if (err) return rejectFunc(err);
31
+ resolveFunc(data);
32
+ };
27
33
 
28
34
  if (notAPI) {
29
35
  utils
30
36
  .get(url, ctx.jar, form, ctx.globalOptions)
31
37
  .then(resData => callback(null, resData.body.toString()))
32
- .catch(function (err) {
38
+ .catch(function(err) {
33
39
  log.error("httpGet", err);
34
40
  return callback(err);
35
41
  });
36
- }
37
- else {
42
+ } else {
38
43
  defaultFuncs
39
44
  .get(url, ctx.jar, form)
40
45
  .then(resData => callback(null, resData.body.toString()))
41
- .catch(function (err) {
46
+ .catch(function(err) {
42
47
  log.error("httpGet", err);
43
48
  return callback(err);
44
49
  });
package/src/httpPost.js CHANGED
@@ -3,42 +3,47 @@
3
3
  var utils = require("../utils");
4
4
  var log = require("npmlog");
5
5
 
6
- module.exports = function (defaultFuncs, api, ctx) {
6
+ module.exports = function(defaultFuncs, api, ctx) {
7
7
  return function httpGet(url, form, callback, notAPI) {
8
- var resolveFunc = function () { };
9
- var rejectFunc = function () { };
8
+ var resolveFunc = function() {};
9
+ var rejectFunc = function() {};
10
10
 
11
- var returnPromise = new Promise(function (resolve, reject) {
11
+ var returnPromise = new Promise(function(resolve, reject) {
12
12
  resolveFunc = resolve;
13
13
  rejectFunc = reject;
14
14
  });
15
15
 
16
- if (!callback && (utils.getType(form) == "Function" || utils.getType(form) == "AsyncFunction")) {
16
+ if (
17
+ !callback &&
18
+ (utils.getType(form) == "Function" ||
19
+ utils.getType(form) == "AsyncFunction")
20
+ ) {
17
21
  callback = form;
18
22
  form = {};
19
23
  }
20
24
 
21
25
  form = form || {};
22
26
 
23
- callback = callback || function (err, data) {
24
- if (err) return rejectFunc(err);
25
- resolveFunc(data);
26
- };
27
+ callback =
28
+ callback ||
29
+ function(err, data) {
30
+ if (err) return rejectFunc(err);
31
+ resolveFunc(data);
32
+ };
27
33
 
28
34
  if (notAPI) {
29
35
  utils
30
36
  .post(url, ctx.jar, form, ctx.globalOptions)
31
37
  .then(resData => callback(null, resData.body.toString()))
32
- .catch(function (err) {
38
+ .catch(function(err) {
33
39
  log.error("httpPost", err);
34
40
  return callback(err);
35
41
  });
36
- }
37
- else {
42
+ } else {
38
43
  defaultFuncs
39
44
  .post(url, ctx.jar, form, {})
40
45
  .then(resData => callback(null, resData.body.toString()))
41
- .catch(function (err) {
46
+ .catch(function(err) {
42
47
  log.error("httpPost", err);
43
48
  return callback(err);
44
49
  });
@@ -5,26 +5,31 @@ var log = require("npmlog");
5
5
 
6
6
  module.exports = function(defaultFuncs, api, ctx) {
7
7
  return function httpPostFormData(url, form, callback) {
8
- var resolveFunc = function(){};
9
- var rejectFunc = function(){};
8
+ var resolveFunc = function() {};
9
+ var rejectFunc = function() {};
10
10
 
11
- var returnPromise = new Promise(function (resolve, reject) {
11
+ var returnPromise = new Promise(function(resolve, reject) {
12
12
  resolveFunc = resolve;
13
13
  rejectFunc = reject;
14
14
  });
15
15
 
16
- if (!callback && (utils.getType(form) == "Function" || utils.getType(form) == "AsyncFunction")) {
16
+ if (
17
+ !callback &&
18
+ (utils.getType(form) == "Function" ||
19
+ utils.getType(form) == "AsyncFunction")
20
+ ) {
17
21
  callback = form;
18
22
  form = {};
19
23
  }
20
24
 
21
25
  form = form || {};
22
-
23
-
24
- callback = callback || function(err, data) {
26
+
27
+ callback =
28
+ callback ||
29
+ function(err, data) {
25
30
  if (err) return rejectFunc(err);
26
31
  resolveFunc(data);
27
- };
32
+ };
28
33
 
29
34
  defaultFuncs
30
35
  .postFormData(url, ctx.jar, form)
@@ -38,4 +43,4 @@ module.exports = function(defaultFuncs, api, ctx) {
38
43
 
39
44
  return returnPromise;
40
45
  };
41
- };
46
+ };