rettiwt-api 1.0.5 → 1.0.7

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 (184) hide show
  1. package/README.md +2 -2
  2. package/dist/{queries → graphql/queries}/RootQuery.d.ts +0 -0
  3. package/dist/{queries → graphql/queries}/RootQuery.js +15 -3
  4. package/dist/graphql/queries/RootQuery.js.map +1 -0
  5. package/dist/graphql/resolvers/AccountResolver.d.ts +12 -0
  6. package/dist/graphql/resolvers/AccountResolver.js +84 -0
  7. package/dist/graphql/resolvers/AccountResolver.js.map +1 -0
  8. package/dist/{resolvers → graphql/resolvers}/ResolverBase.d.ts +1 -1
  9. package/dist/{resolvers → graphql/resolvers}/ResolverBase.js +0 -0
  10. package/dist/graphql/resolvers/ResolverBase.js.map +1 -0
  11. package/dist/{resolvers → graphql/resolvers}/TweetResolver.d.ts +10 -9
  12. package/dist/{resolvers → graphql/resolvers}/TweetResolver.js +51 -35
  13. package/dist/graphql/resolvers/TweetResolver.js.map +1 -0
  14. package/dist/{resolvers → graphql/resolvers}/UserResolver.d.ts +5 -4
  15. package/dist/{resolvers → graphql/resolvers}/UserResolver.js +51 -35
  16. package/dist/graphql/resolvers/UserResolver.js.map +1 -0
  17. package/dist/{models/graphql → graphql/types}/Global.d.ts +0 -0
  18. package/dist/{models/graphql → graphql/types}/Global.js +0 -0
  19. package/dist/graphql/types/Global.js.map +1 -0
  20. package/dist/graphql/types/TweetTypes.d.ts +4 -0
  21. package/dist/{models/graphql → graphql/types}/TweetTypes.js +5 -7
  22. package/dist/graphql/types/TweetTypes.js.map +1 -0
  23. package/dist/graphql/types/UserTypes.d.ts +3 -0
  24. package/dist/{models/graphql → graphql/types}/UserTypes.js +9 -11
  25. package/dist/graphql/types/UserTypes.js.map +1 -0
  26. package/dist/index.d.ts +4 -2
  27. package/dist/index.js +5 -3
  28. package/dist/index.js.map +1 -1
  29. package/dist/server.js +6 -4
  30. package/dist/server.js.map +1 -1
  31. package/dist/services/AuthService.js +2 -2
  32. package/dist/services/AuthService.js.map +1 -1
  33. package/dist/services/CacheService.d.ts +3 -3
  34. package/dist/services/CacheService.js +22 -75
  35. package/dist/services/CacheService.js.map +1 -1
  36. package/dist/services/FetcherService.d.ts +14 -4
  37. package/dist/services/FetcherService.js +58 -52
  38. package/dist/services/FetcherService.js.map +1 -1
  39. package/dist/services/accounts/AccountService.d.ts +42 -0
  40. package/dist/services/accounts/AccountService.js +291 -0
  41. package/dist/services/accounts/AccountService.js.map +1 -0
  42. package/dist/services/accounts/LoginFlows.d.ts +77 -0
  43. package/dist/services/accounts/LoginFlows.js +92 -0
  44. package/dist/services/accounts/LoginFlows.js.map +1 -0
  45. package/dist/services/data/TweetService.d.ts +6 -6
  46. package/dist/services/data/TweetService.js +44 -27
  47. package/dist/services/data/TweetService.js.map +1 -1
  48. package/dist/services/data/UserAccountService.d.ts +3 -3
  49. package/dist/services/data/UserAccountService.js +22 -8
  50. package/dist/services/data/UserAccountService.js.map +1 -1
  51. package/dist/services/data/UserService.d.ts +42 -0
  52. package/dist/services/data/UserService.js +255 -0
  53. package/dist/services/data/UserService.js.map +1 -0
  54. package/dist/services/helper/Extractors.js +1 -1
  55. package/dist/services/helper/Extractors.js.map +1 -1
  56. package/dist/services/helper/Headers.d.ts +11 -1
  57. package/dist/services/helper/Headers.js +28 -2
  58. package/dist/services/helper/Headers.js.map +1 -1
  59. package/dist/services/helper/Parser.d.ts +1 -1
  60. package/dist/services/helper/Parser.js +4 -3
  61. package/dist/services/helper/Parser.js.map +1 -1
  62. package/dist/services/helper/Urls.d.ts +2 -2
  63. package/dist/services/helper/Urls.js +19 -3
  64. package/dist/services/helper/Urls.js.map +1 -1
  65. package/dist/services/helper/deserializers/Tweets.d.ts +12 -0
  66. package/dist/services/helper/deserializers/Tweets.js +92 -0
  67. package/dist/services/helper/deserializers/Tweets.js.map +1 -0
  68. package/dist/services/helper/deserializers/User.d.ts +0 -0
  69. package/dist/services/helper/deserializers/User.js +2 -0
  70. package/dist/services/helper/deserializers/User.js.map +1 -0
  71. package/dist/services/helper/deserializers/Users.d.ts +7 -0
  72. package/dist/services/helper/deserializers/Users.js +27 -0
  73. package/dist/services/helper/deserializers/Users.js.map +1 -0
  74. package/dist/services/helper/extractors/TweetExtractors.d.ts +0 -0
  75. package/dist/services/helper/extractors/TweetExtractors.js +2 -0
  76. package/dist/services/helper/extractors/TweetExtractors.js.map +1 -0
  77. package/dist/services/helper/extractors/Tweets.d.ts +32 -0
  78. package/dist/services/helper/extractors/Tweets.js +264 -0
  79. package/dist/services/helper/extractors/Tweets.js.map +1 -0
  80. package/dist/services/helper/extractors/UserExtractors.d.ts +45 -0
  81. package/dist/services/helper/extractors/UserExtractors.js +176 -0
  82. package/dist/services/helper/extractors/UserExtractors.js.map +1 -0
  83. package/dist/services/helper/extractors/Users.d.ts +20 -0
  84. package/dist/services/helper/extractors/Users.js +151 -0
  85. package/dist/services/helper/extractors/Users.js.map +1 -0
  86. package/dist/services/helper/urls/Authentication.d.ts +4 -0
  87. package/dist/services/helper/urls/Authentication.js +11 -0
  88. package/dist/services/helper/urls/Authentication.js.map +1 -0
  89. package/dist/services/helper/urls/Tweets.d.ts +32 -0
  90. package/dist/services/helper/urls/Tweets.js +51 -0
  91. package/dist/services/helper/urls/Tweets.js.map +1 -0
  92. package/dist/services/helper/urls/Urls.d.ts +4 -0
  93. package/dist/services/helper/urls/Urls.js +11 -0
  94. package/dist/services/helper/urls/Urls.js.map +1 -0
  95. package/dist/services/helper/urls/Users.d.ts +31 -0
  96. package/dist/services/helper/urls/Users.js +66 -0
  97. package/dist/services/helper/urls/Users.js.map +1 -0
  98. package/dist/types/{graphql/Errors.d.ts → Errors.d.ts} +0 -0
  99. package/dist/types/{graphql/Errors.js → Errors.js} +0 -0
  100. package/dist/types/Errors.js.map +1 -0
  101. package/dist/types/HTTP.d.ts +0 -7
  102. package/dist/types/HTTP.js +1 -10
  103. package/dist/types/HTTP.js.map +1 -1
  104. package/dist/types/Resolvers.d.ts +9 -0
  105. package/dist/types/Resolvers.js +3 -0
  106. package/dist/types/Resolvers.js.map +1 -0
  107. package/dist/types/Service.d.ts +2 -0
  108. package/dist/types/Service.js.map +1 -1
  109. package/dist/types/Tweet.d.ts +1 -0
  110. package/dist/types/Tweet.js.map +1 -1
  111. package/dist/types/User.d.ts +19 -0
  112. package/dist/types/User.js +4 -0
  113. package/dist/types/User.js.map +1 -0
  114. package/dist/types/data/Errors.d.ts +26 -0
  115. package/dist/types/data/Errors.js +36 -0
  116. package/dist/types/data/Errors.js.map +1 -0
  117. package/dist/types/data/Service.d.ts +29 -0
  118. package/dist/types/data/Service.js +19 -0
  119. package/dist/types/data/Service.js.map +1 -0
  120. package/dist/types/data/Tweet.d.ts +41 -0
  121. package/dist/types/data/Tweet.js +5 -0
  122. package/dist/types/data/Tweet.js.map +1 -0
  123. package/dist/types/data/User.d.ts +19 -0
  124. package/dist/types/data/User.js +4 -0
  125. package/dist/types/data/User.js.map +1 -0
  126. package/dist/types/raw/http/Error.d.ts +34 -0
  127. package/dist/types/raw/{user/Users.js → http/Error.js} +1 -1
  128. package/dist/types/raw/http/Error.js.map +1 -0
  129. package/dist/types/raw/http/Response.d.ts +34 -0
  130. package/dist/types/raw/http/Response.js +3 -0
  131. package/dist/types/raw/http/Response.js.map +1 -0
  132. package/package.json +4 -2
  133. package/src/{queries → graphql/queries}/RootQuery.ts +16 -4
  134. package/src/graphql/resolvers/AccountResolver.ts +22 -0
  135. package/src/{resolvers → graphql/resolvers}/ResolverBase.ts +1 -1
  136. package/src/{resolvers → graphql/resolvers}/TweetResolver.ts +43 -30
  137. package/src/{resolvers → graphql/resolvers}/UserResolver.ts +41 -27
  138. package/src/{models/graphql → graphql/types}/Global.ts +0 -0
  139. package/src/{models/graphql → graphql/types}/TweetTypes.ts +9 -11
  140. package/src/{models/graphql → graphql/types}/UserTypes.ts +13 -15
  141. package/src/index.ts +5 -3
  142. package/src/server.ts +6 -4
  143. package/src/services/AuthService.ts +1 -1
  144. package/src/services/CacheService.ts +6 -8
  145. package/src/services/FetcherService.ts +37 -22
  146. package/src/services/accounts/AccountService.ts +156 -0
  147. package/src/services/accounts/LoginFlows.ts +90 -0
  148. package/src/services/data/TweetService.ts +53 -37
  149. package/src/services/data/UserService.ts +187 -0
  150. package/src/services/helper/Headers.ts +27 -1
  151. package/src/services/helper/Parser.ts +6 -4
  152. package/src/services/helper/{Deserializers.ts → deserializers/Tweets.ts} +3 -28
  153. package/src/services/helper/deserializers/Users.ts +26 -0
  154. package/src/services/helper/extractors/Tweets.ts +252 -0
  155. package/src/services/helper/extractors/Users.ts +137 -0
  156. package/src/services/helper/urls/Authentication.ts +6 -0
  157. package/src/services/helper/urls/Tweets.ts +46 -0
  158. package/src/services/helper/urls/Users.ts +62 -0
  159. package/src/types/HTTP.ts +0 -8
  160. package/src/types/Resolvers.ts +9 -0
  161. package/src/types/data/Errors.ts +28 -0
  162. package/src/types/{Service.ts → data/Service.ts} +6 -5
  163. package/src/types/{Tweet.ts → data/Tweet.ts} +1 -0
  164. package/src/types/{UserAccount.ts → data/User.ts} +0 -0
  165. package/tsconfig.json +2 -2
  166. package/dist/models/graphql/Global.js.map +0 -1
  167. package/dist/models/graphql/TweetTypes.d.ts +0 -6
  168. package/dist/models/graphql/TweetTypes.js.map +0 -1
  169. package/dist/models/graphql/UserTypes.d.ts +0 -3
  170. package/dist/models/graphql/UserTypes.js.map +0 -1
  171. package/dist/queries/RootQuery.js.map +0 -1
  172. package/dist/resolvers/ResolverBase.js.map +0 -1
  173. package/dist/resolvers/TweetResolver.js.map +0 -1
  174. package/dist/resolvers/UserResolver.js.map +0 -1
  175. package/dist/test/Test.js +0 -2
  176. package/dist/test/Test.js.map +0 -1
  177. package/dist/types/graphql/Errors.js.map +0 -1
  178. package/dist/types/raw/user/Users.d.ts +0 -120
  179. package/dist/types/raw/user/Users.js.map +0 -1
  180. package/src/services/data/UserAccountService.ts +0 -176
  181. package/src/services/helper/Extractors.ts +0 -455
  182. package/src/services/helper/Urls.ts +0 -109
  183. package/src/types/graphql/Errors.ts +0 -16
  184. package/src/types/raw/user/Tweets.ts +0 -2847
package/README.md CHANGED
@@ -36,8 +36,8 @@ This creates an instance of Rettiwt which can be used to fetch data from Twitter
36
36
 
37
37
  If you wan't full functionality, you need to use the cookie of a logged in Twitter account, which can be retrieved from the browser.
38
38
 
39
- - For GraphQL Server mode, pass the cookie-string in the header while making a request to the graphql server
40
- - For npm library mode, pass the cookie-string to the constructor while creating instance of Rettiwt
39
+ - For GraphQL Server mode, you can get the cookie using the Login query and pass the received cookie-string in the header while making a request to the graphql server
40
+ - For npm library mode, you can get the cookie using the Rettiwt().account.login method and pass the received cookie-string to the constructor while creating instance of Rettiwt
41
41
 
42
42
  ### **If you don't want to risk your twitter account getting banned, using cookies is completely optional and you can omit passing cookie and use the API as guest**
43
43
  ### **No likes, followers, followings, retweets, replies, tweet likes, quotes can be fetched without using cookie!**
File without changes
@@ -7,11 +7,12 @@ exports.rootQuery = void 0;
7
7
  // PACKAGE
8
8
  var graphql_1 = require("graphql");
9
9
  // TYPES
10
- var UserTypes_1 = require("../models/graphql/UserTypes");
11
- var TweetTypes_1 = require("../models/graphql/TweetTypes");
10
+ var UserTypes_1 = require("../types/UserTypes");
11
+ var TweetTypes_1 = require("../types/TweetTypes");
12
12
  // RESOLVERS
13
13
  var UserResolver_1 = __importDefault(require("../resolvers/UserResolver"));
14
14
  var TweetResolver_1 = __importDefault(require("../resolvers/TweetResolver"));
15
+ var AccountResolver_1 = __importDefault(require("../resolvers/AccountResolver"));
15
16
  exports.rootQuery = new graphql_1.GraphQLObjectType({
16
17
  name: 'Root',
17
18
  fields: {
@@ -47,12 +48,23 @@ exports.rootQuery = new graphql_1.GraphQLObjectType({
47
48
  words: { type: new graphql_1.GraphQLList(graphql_1.GraphQLString) },
48
49
  startDate: { type: graphql_1.GraphQLString },
49
50
  endDate: { type: graphql_1.GraphQLString },
51
+ sinceId: { type: graphql_1.GraphQLString },
50
52
  quoted: { type: graphql_1.GraphQLString },
51
53
  links: { type: graphql_1.GraphQLBoolean, defaultValue: false },
52
- count: { type: graphql_1.GraphQLInt, defaultValue: 20 },
54
+ count: { type: graphql_1.GraphQLInt, defaultValue: 10 },
53
55
  cursor: { type: graphql_1.GraphQLString, defaultValue: '' }
54
56
  },
55
57
  resolve: function (parent, args, context) { return new TweetResolver_1["default"](context).resolveTweets(args, args.count, args.cursor); }
58
+ },
59
+ Login: {
60
+ type: graphql_1.GraphQLString,
61
+ description: "Returns the cookies that can be used to fetch data from twitter",
62
+ args: {
63
+ email: { type: graphql_1.GraphQLString },
64
+ userName: { type: graphql_1.GraphQLString },
65
+ password: { type: graphql_1.GraphQLString }
66
+ },
67
+ resolve: function (parent, args, context) { return new AccountResolver_1["default"](context).resolveLogin(args.email, args.userName, args.password); }
56
68
  }
57
69
  }
58
70
  });
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RootQuery.js","sourceRoot":"","sources":["../../../src/graphql/queries/RootQuery.ts"],"names":[],"mappings":";;;;;;AAAA,UAAU;AACV,mCAAmG;AAEnG,QAAQ;AACR,gDAA0C;AAC1C,kDAAuD;AAGvD,YAAY;AACZ,2EAAqD;AACrD,6EAAuD;AACvD,iFAA2D;AAE9C,QAAA,SAAS,GAAG,IAAI,2BAAiB,CAAC;IAC3C,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE;QACJ,IAAI,EAAE;YACF,IAAI,EAAE,uBAAa;YACnB,OAAO,EAAE,cAAM,OAAA,gBAAgB,EAAhB,CAAgB;SAClC;QACD,IAAI,EAAE;YACF,IAAI,EAAE,gBAAI;YACV,WAAW,EAAE,8DAA8D;YAC3E,IAAI,EAAE;gBACF,QAAQ,EAAE,EAAE,IAAI,EAAE,uBAAa,EAAE;gBACjC,EAAE,EAAE,EAAE,IAAI,EAAE,uBAAa,EAAE;aAC9B;YACD,OAAO,EAAE,UAAC,MAAM,EAAE,IAAI,EAAE,OAAO,IAAK,OAAA,IAAI,yBAAY,CAAC,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AM,EAAE,EAAE,IAAI,EAAE,uBAAa,EAAE,YAAY,EAAE,EAAE,EAAE;aACpD;YACD,OAAO,EAAE,UAAC,MAAM,EAAE,IAAI,EAAE,OAAO,IAAK,OAAA,IAAI,0BAAa,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,IAAmB,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,EAAtF,CAAsF;SAC7H;QACD,KAAK,EAAE;YACH,IAAI,EAAE,uBAAa;YACnB,WAAW,EAAE,iEAAiE;YAC9E,IAAI,EAAE;gBACF,KAAK,EAAE,EAAE,IAAI,EAAE,uBAAa,EAAE;gBAC9B,QAAQ,EAAE,EAAE,IAAI,EAAE,uBAAa,EAAE;gBACjC,QAAQ,EAAE,EAAE,IAAI,EAAE,uBAAa,EAAE;aACpC;YACD,OAAO,EAAE,UAAC,MAAM,EAAE,IAAI,EAAE,OAAO,IAAK,OAAA,IAAI,4BAAe,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAnF,CAAmF;SAC1H;KACJ;CACJ,CAAC,CAAA"}
@@ -0,0 +1,12 @@
1
+ import ResolverBase from './ResolverBase';
2
+ import { DataContext } from '../../types/data/Service';
3
+ export default class AccountResolver extends ResolverBase {
4
+ constructor(context: DataContext);
5
+ /**
6
+ * @param email The email of the account to be logged into
7
+ * @param userName The username associated with the account
8
+ * @param password The password to the account
9
+ * @returns The cookie string that can be used to authenticate against twitter
10
+ */
11
+ resolveLogin(email: string, userName: string, password: string): Promise<string>;
12
+ }
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (_) try {
33
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
+ }
52
+ };
53
+ var __importDefault = (this && this.__importDefault) || function (mod) {
54
+ return (mod && mod.__esModule) ? mod : { "default": mod };
55
+ };
56
+ exports.__esModule = true;
57
+ // RESOLVERS
58
+ var ResolverBase_1 = __importDefault(require("./ResolverBase"));
59
+ var AccountResolver = /** @class */ (function (_super) {
60
+ __extends(AccountResolver, _super);
61
+ // MEMBER METHODS
62
+ function AccountResolver(context) {
63
+ return _super.call(this, context) || this;
64
+ }
65
+ /**
66
+ * @param email The email of the account to be logged into
67
+ * @param userName The username associated with the account
68
+ * @param password The password to the account
69
+ * @returns The cookie string that can be used to authenticate against twitter
70
+ */
71
+ AccountResolver.prototype.resolveLogin = function (email, userName, password) {
72
+ return __awaiter(this, void 0, void 0, function () {
73
+ return __generator(this, function (_a) {
74
+ switch (_a.label) {
75
+ case 0: return [4 /*yield*/, this.context.account.login(email, userName, password)];
76
+ case 1: return [2 /*return*/, _a.sent()];
77
+ }
78
+ });
79
+ });
80
+ };
81
+ return AccountResolver;
82
+ }(ResolverBase_1["default"]));
83
+ exports["default"] = AccountResolver;
84
+ //# sourceMappingURL=AccountResolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccountResolver.js","sourceRoot":"","sources":["../../../src/graphql/resolvers/AccountResolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAY;AACZ,gEAA0C;AAK1C;IAA6C,mCAAY;IACrD,iBAAiB;IACjB,yBAAY,OAAoB;eAC5B,kBAAM,OAAO,CAAC;IAClB,CAAC;IAED;;;;;OAKG;IACG,sCAAY,GAAlB,UAAmB,KAAa,EAAE,QAAgB,EAAE,QAAgB;;;;4BACzD,qBAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAA;4BAAlE,sBAAO,SAA2D,EAAC;;;;KACtE;IACL,sBAAC;AAAD,CAAC,AAfD,CAA6C,yBAAY,GAexD"}
@@ -1,4 +1,4 @@
1
- import { DataContext } from '../types/Service';
1
+ import { DataContext } from '../../types/data/Service';
2
2
  export default class ResolverBase {
3
3
  protected context: DataContext;
4
4
  constructor(context: DataContext);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResolverBase.js","sourceRoot":"","sources":["../../../src/graphql/resolvers/ResolverBase.ts"],"names":[],"mappings":";;AAGA;IAII,iBAAiB;IACjB,sBAAY,OAAoB;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IACL,mBAAC;AAAD,CAAC,AARD,IAQC"}
@@ -1,7 +1,8 @@
1
1
  import ResolverBase from './ResolverBase';
2
- import { TweetFilter } from '../types/Tweet';
3
- import { DataContext } from '../types/Service';
2
+ import { TweetFilter } from '../../types/data/Tweet';
3
+ import { DataContext } from '../../types/data/Service';
4
4
  export default class TweetResolver extends ResolverBase {
5
+ private batchSize;
5
6
  constructor(context: DataContext);
6
7
  /**
7
8
  * @returns The details of the tweet with the given id
@@ -11,14 +12,14 @@ export default class TweetResolver extends ResolverBase {
11
12
  /**
12
13
  * @returns The list of tweets matching the given filter
13
14
  * @param filter The filter to be used for fetching matching tweets
14
- * @param count The number of tweets to fetch
15
+ * @param count The number of tweets to fetch, must be >= 1
15
16
  * @param cursor The cursor to the batch of tweets to fetch
16
17
  */
17
- resolveTweets(filter: TweetFilter, count: number, cursor: string): Promise<any[]>;
18
+ resolveTweets(filter: TweetFilter, count: number, cursor: string): Promise<any>;
18
19
  /**
19
20
  * @returns The list of quotes of the given tweet
20
21
  * @param id The id of the tweet whose quotes are to be fetched
21
- * @param count The number of quotes to be fetched
22
+ * @param count The number of quotes to be fetched, must be >= 1 (when no cursor if provided)
22
23
  * @param all Whether to fetch all quotes or not
23
24
  * @param cursor The cursor to the batch of tweet quotes to fetch
24
25
  * @param quoteCount The total number of quotes of the given tweet
@@ -27,21 +28,21 @@ export default class TweetResolver extends ResolverBase {
27
28
  /**
28
29
  * @returns The list of likers of the given tweet
29
30
  * @param id The id of the tweet whose likers are to be fetched
30
- * @param count The total number of likers to fetch
31
+ * @param count The total number of likers to fetch, must be >= 10 (when no cursor if provided)
31
32
  * @param all Whether to fetch all the likers of the tweet
32
33
  * @param cursor The cursor to the batch of likers to fetch
33
34
  * @param likesCount The total number of like of the tweet
34
35
  */
35
- resolveTweetLikers(id: string, count: number, all: boolean, cursor: string, likesCount: number): Promise<any[]>;
36
+ resolveTweetLikers(id: string, count: number, all: boolean, cursor: string, likesCount: number): Promise<any>;
36
37
  /**
37
38
  * @returns The list of retweeters of the given tweet
38
39
  * @param id The id of the tweet whose retweeters are to be fetched
39
- * @param count The total number of retweeters to fetch
40
+ * @param count The total number of retweeters to fetch, must be >= 10 (when no cursor if provided)
40
41
  * @param all Whether to fetch all retweeters
41
42
  * @param cursor The cursor to the batch of retweeters to fetch
42
43
  * @param retweetsCount The total number of retweets of the
43
44
  */
44
- resolveTweetRetweeters(id: string, count: number, all: boolean, cursor: string, retweetsCount: number): Promise<any[]>;
45
+ resolveTweetRetweeters(id: string, count: number, all: boolean, cursor: string, retweetsCount: number): Promise<any>;
45
46
  /**
46
47
  * @returns The list of replies of the given tweet
47
48
  * @param id The id of the tweet whose replies are to be fetched
@@ -56,14 +56,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
56
56
  exports.__esModule = true;
57
57
  // RESOLVERS
58
58
  var ResolverBase_1 = __importDefault(require("./ResolverBase"));
59
- var Service_1 = require("../types/Service");
60
- // HELPERS
61
- var Errors_1 = require("../types/graphql/Errors");
59
+ var Service_1 = require("../../types/data/Service");
60
+ var Errors_1 = require("../../types/data/Errors");
62
61
  var TweetResolver = /** @class */ (function (_super) {
63
62
  __extends(TweetResolver, _super);
64
63
  // MEMBER METHODS
65
64
  function TweetResolver(context) {
66
- return _super.call(this, context) || this;
65
+ var _this = _super.call(this, context) || this;
66
+ _this.batchSize = 20;
67
+ return _this;
67
68
  }
68
69
  /**
69
70
  * @returns The details of the tweet with the given id
@@ -86,32 +87,30 @@ var TweetResolver = /** @class */ (function (_super) {
86
87
  /**
87
88
  * @returns The list of tweets matching the given filter
88
89
  * @param filter The filter to be used for fetching matching tweets
89
- * @param count The number of tweets to fetch
90
+ * @param count The number of tweets to fetch, must be >= 1
90
91
  * @param cursor The cursor to the batch of tweets to fetch
91
92
  */
92
93
  TweetResolver.prototype.resolveTweets = function (filter, count, cursor) {
93
94
  var _a;
94
95
  return __awaiter(this, void 0, void 0, function () {
95
- var tweets, next, total, batchSize, res;
96
+ var tweets, next, total, res;
96
97
  return __generator(this, function (_b) {
97
98
  switch (_b.label) {
98
99
  case 0:
99
100
  tweets = [];
100
101
  next = new Service_1.Cursor(cursor);
101
102
  total = 0;
102
- batchSize = 20;
103
103
  // Checking if the given tweet filter is valid or not
104
104
  if (!(filter.fromUsers || filter.toUsers || filter.words || filter.hashtags || filter.mentions || filter.quoted)) {
105
105
  throw new Error(Errors_1.ValidationErrors.InvalidTweetFilter);
106
106
  }
107
107
  // If required count less than batch size, setting batch size to required count
108
- batchSize = (count < batchSize) ? count : batchSize;
108
+ this.batchSize = (count < this.batchSize) ? count : this.batchSize;
109
109
  _b.label = 1;
110
110
  case 1:
111
- if (!(total < count)) return [3 /*break*/, 3];
112
111
  // If this is the last batch, change batch size to number of remaining tweets
113
- batchSize = ((count - total) < batchSize) ? (count - total) : batchSize;
114
- return [4 /*yield*/, this.context.tweets.getTweets(filter, count, next.value)];
112
+ this.batchSize = ((count - total) < this.batchSize) ? (count - total) : this.batchSize;
113
+ return [4 /*yield*/, this.context.tweets.getTweets(filter, this.batchSize, next.value)];
115
114
  case 2:
116
115
  res = _b.sent();
117
116
  // If data is available
@@ -125,10 +124,17 @@ var TweetResolver = /** @class */ (function (_super) {
125
124
  }
126
125
  // If no more data is available
127
126
  else {
128
- return [3 /*break*/, 3];
127
+ return [3 /*break*/, 4];
129
128
  }
130
- return [3 /*break*/, 1];
129
+ _b.label = 3;
131
130
  case 3:
131
+ if (total < count) return [3 /*break*/, 1];
132
+ _b.label = 4;
133
+ case 4:
134
+ // If no tweets found
135
+ if (!tweets.length) {
136
+ return [2 /*return*/, new Error(Errors_1.DataErrors.NoTweetsFound)];
137
+ }
132
138
  // Adding the cursor to the end of list of data
133
139
  tweets.push(next);
134
140
  return [2 /*return*/, tweets];
@@ -139,7 +145,7 @@ var TweetResolver = /** @class */ (function (_super) {
139
145
  /**
140
146
  * @returns The list of quotes of the given tweet
141
147
  * @param id The id of the tweet whose quotes are to be fetched
142
- * @param count The number of quotes to be fetched
148
+ * @param count The number of quotes to be fetched, must be >= 1 (when no cursor if provided)
143
149
  * @param all Whether to fetch all quotes or not
144
150
  * @param cursor The cursor to the batch of tweet quotes to fetch
145
151
  * @param quoteCount The total number of quotes of the given tweet
@@ -152,7 +158,7 @@ var TweetResolver = /** @class */ (function (_super) {
152
158
  case 0:
153
159
  quotes = [];
154
160
  // If all tweets are to be fetched
155
- count = (all || count > quoteCount) ? quoteCount : count;
161
+ count = all ? quoteCount : count;
156
162
  filter = {
157
163
  words: [],
158
164
  hashtags: [],
@@ -175,7 +181,7 @@ var TweetResolver = /** @class */ (function (_super) {
175
181
  /**
176
182
  * @returns The list of likers of the given tweet
177
183
  * @param id The id of the tweet whose likers are to be fetched
178
- * @param count The total number of likers to fetch
184
+ * @param count The total number of likers to fetch, must be >= 10 (when no cursor if provided)
179
185
  * @param all Whether to fetch all the likers of the tweet
180
186
  * @param cursor The cursor to the batch of likers to fetch
181
187
  * @param likesCount The total number of like of the tweet
@@ -183,24 +189,22 @@ var TweetResolver = /** @class */ (function (_super) {
183
189
  TweetResolver.prototype.resolveTweetLikers = function (id, count, all, cursor, likesCount) {
184
190
  var _a;
185
191
  return __awaiter(this, void 0, void 0, function () {
186
- var likers, next, total, batchSize, res;
192
+ var likers, next, total, res;
187
193
  return __generator(this, function (_b) {
188
194
  switch (_b.label) {
189
195
  case 0:
190
196
  likers = [];
191
197
  next = new Service_1.Cursor(cursor);
192
198
  total = 0;
193
- batchSize = 20;
194
199
  // If all likers are to be fetched
195
- count = (all || count > likesCount) ? likesCount : count;
200
+ count = all ? likesCount : count;
196
201
  // If required count less than batch size, setting batch size to required count
197
- batchSize = (count < batchSize) ? count : batchSize;
202
+ this.batchSize = (count < this.batchSize) ? count : this.batchSize;
198
203
  _b.label = 1;
199
204
  case 1:
200
- if (!(total < count)) return [3 /*break*/, 3];
201
205
  // If this is the last batch, change batch size to number of remaining likers
202
- batchSize = ((count - total) < batchSize) ? (count - total) : batchSize;
203
- return [4 /*yield*/, this.context.tweets.getTweetLikers(id, count, next.value)];
206
+ this.batchSize = ((count - total) < this.batchSize) ? (count - total) : this.batchSize;
207
+ return [4 /*yield*/, this.context.tweets.getTweetLikers(id, this.batchSize, next.value)];
204
208
  case 2:
205
209
  res = _b.sent();
206
210
  // If data is available
@@ -214,10 +218,17 @@ var TweetResolver = /** @class */ (function (_super) {
214
218
  }
215
219
  // If no more data is available
216
220
  else {
217
- return [3 /*break*/, 3];
221
+ return [3 /*break*/, 4];
218
222
  }
219
- return [3 /*break*/, 1];
223
+ _b.label = 3;
220
224
  case 3:
225
+ if (total < count) return [3 /*break*/, 1];
226
+ _b.label = 4;
227
+ case 4:
228
+ // If no likers found
229
+ if (!likers.length) {
230
+ return [2 /*return*/, new Error(Errors_1.DataErrors.NoLikersFound)];
231
+ }
221
232
  // Adding the cursor to the end of list of data
222
233
  likers.push(next);
223
234
  return [2 /*return*/, likers];
@@ -228,7 +239,7 @@ var TweetResolver = /** @class */ (function (_super) {
228
239
  /**
229
240
  * @returns The list of retweeters of the given tweet
230
241
  * @param id The id of the tweet whose retweeters are to be fetched
231
- * @param count The total number of retweeters to fetch
242
+ * @param count The total number of retweeters to fetch, must be >= 10 (when no cursor if provided)
232
243
  * @param all Whether to fetch all retweeters
233
244
  * @param cursor The cursor to the batch of retweeters to fetch
234
245
  * @param retweetsCount The total number of retweets of the
@@ -236,24 +247,22 @@ var TweetResolver = /** @class */ (function (_super) {
236
247
  TweetResolver.prototype.resolveTweetRetweeters = function (id, count, all, cursor, retweetsCount) {
237
248
  var _a;
238
249
  return __awaiter(this, void 0, void 0, function () {
239
- var retweeters, next, total, batchSize, res;
250
+ var retweeters, next, total, res;
240
251
  return __generator(this, function (_b) {
241
252
  switch (_b.label) {
242
253
  case 0:
243
254
  retweeters = [];
244
255
  next = new Service_1.Cursor(cursor);
245
256
  total = 0;
246
- batchSize = 20;
247
257
  // If all retweeters are to be fetched
248
- count = (all || count > retweetsCount) ? retweetsCount : count;
258
+ count = all ? retweetsCount : count;
249
259
  // If required count less than batch size, setting batch size to required count
250
- batchSize = (count < batchSize) ? count : batchSize;
260
+ this.batchSize = (count < this.batchSize) ? count : this.batchSize;
251
261
  _b.label = 1;
252
262
  case 1:
253
- if (!(total < count)) return [3 /*break*/, 3];
254
263
  // If this is the last batch, change batch size to number of remaining retweeters
255
- batchSize = ((count - total) < batchSize) ? (count - total) : batchSize;
256
- return [4 /*yield*/, this.context.tweets.getTweetRetweeters(id, count, next.value)];
264
+ this.batchSize = ((count - total) < this.batchSize) ? (count - total) : this.batchSize;
265
+ return [4 /*yield*/, this.context.tweets.getTweetRetweeters(id, this.batchSize, next.value)];
257
266
  case 2:
258
267
  res = _b.sent();
259
268
  // If data is available
@@ -267,10 +276,17 @@ var TweetResolver = /** @class */ (function (_super) {
267
276
  }
268
277
  // If no more data is available
269
278
  else {
270
- return [3 /*break*/, 3];
279
+ return [3 /*break*/, 4];
271
280
  }
272
- return [3 /*break*/, 1];
281
+ _b.label = 3;
273
282
  case 3:
283
+ if (total < count) return [3 /*break*/, 1];
284
+ _b.label = 4;
285
+ case 4:
286
+ // If no retweeters found
287
+ if (!retweeters.length) {
288
+ return [2 /*return*/, new Error(Errors_1.DataErrors.NoRetweetersFound)];
289
+ }
274
290
  // Adding the cursor to the end of list of data
275
291
  retweeters.push(next);
276
292
  return [2 /*return*/, retweeters];
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TweetResolver.js","sourceRoot":"","sources":["../../../src/graphql/resolvers/TweetResolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAY;AACZ,gEAA0C;AAI1C,oDAA+D;AAC/D,kDAAuE;AAEvE;IAA2C,iCAAY;IAGnD,iBAAiB;IACjB,uBAAY,OAAoB;QAAhC,YACI,kBAAM,OAAO,CAAC,SAEjB;QADG,KAAI,CAAC,SAAS,GAAG,EAAE,CAAC;;IACxB,CAAC;IAED;;;OAGG;IACG,oCAAY,GAAlB,UAAmB,EAAU;;;;;4BAEf,qBAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,EAAA;;wBAAhD,GAAG,GAAG,SAA0C;wBAEpD,sBAAsB;wBACtB,sBAAO,GAAG,EAAC;;;;KACd;IAED;;;;;OAKG;IACG,qCAAa,GAAnB,UAAoB,MAAmB,EAAE,KAAa,EAAE,MAAc;;;;;;;wBAC9D,MAAM,GAAU,EAAE,CAAC;wBACnB,IAAI,GAAW,IAAI,gBAAM,CAAC,MAAM,CAAC,CAAC;wBAClC,KAAK,GAAW,CAAC,CAAC;wBAEtB,qDAAqD;wBACrD,IAAI,CAAC,CAAC,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,QA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;wBACpB,IAAI,GAAW,IAAI,gBAAM,CAAC,MAAM,CAAC,CAAC;wBAClC,KAAK,GAAW,CAAC,CAAC;wBAEtB,mCAAmC;wBACnC,KAAK,GAAG,CAAC,GAAG,IAAI,KAAK,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC;;;6BAGtD,CAAA,KAAK,GAAG,KAAK,CAAA;wBAEJ,qBAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,EAAA;;wBAA/D,GAAG,GAAG,SAAyD;wBAErE,uBAAuB;wBACvB,IAAI,MAAA,GAAG,CAAC,IAAI,0CAAE,MAAM,EAAE;4BAClB,4CAA4C;4BAC5C,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;4BAEnC,iCAAiC;4BACjC,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC;4BAEvB,+BAA+B;4BAC/B,IAAI,GAAG,GAAG,CAAC,IAAc,CAAC;yBAC7B;wBACD,+BAA+B;6BAC1B;4BACD,wBAAM;yBACT;;;wBAGL,+CAA+C;wBAC/C,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;wBAEnB,sBAAO,OAAO,EAAC;;;;KAClB;IACL,oBAAC;AAAD,CAAC,AArQD,CAA2C,yBAAY,GAqQtD"}
@@ -1,6 +1,7 @@
1
1
  import ResolverBase from './ResolverBase';
2
- import { DataContext } from '../types/Service';
2
+ import { DataContext } from '../../types/data/Service';
3
3
  export default class UserResolver extends ResolverBase {
4
+ private batchSize;
4
5
  constructor(context: DataContext);
5
6
  /**
6
7
  * @returns The details of the target twitter user
@@ -11,7 +12,7 @@ export default class UserResolver extends ResolverBase {
11
12
  /**
12
13
  * @returns The list of tweets liked by the given user
13
14
  * @param id The id of the user whose likes are to be fetched
14
- * @param count The number of likes to fetch
15
+ * @param count The number of likes to fetch, must be >= 40
15
16
  * @param all Whether to fetch list of all tweets liked by user
16
17
  * @param cursor The cursor to the batch of likes to fetch
17
18
  * @param favouritesCount The total number of tweets liked by target user
@@ -20,7 +21,7 @@ export default class UserResolver extends ResolverBase {
20
21
  /**
21
22
  * @returns The list of followers of the given twiiter user
22
23
  * @param id The id of the user whose followers are to be fetched
23
- * @param count The number of followers to fetch
24
+ * @param count The number of followers to fetch, must be >= 40 when no cursor is provided
24
25
  * @param all Whether to fetch all followers list
25
26
  * @param cursor The cursor to the batch of followers to fetch
26
27
  * @param followerCount The total number of followers of the target user
@@ -29,7 +30,7 @@ export default class UserResolver extends ResolverBase {
29
30
  /**
30
31
  * @returns The list of following of the given twiiter user
31
32
  * @param id The id of the user whose followings are to be fetched
32
- * @param count The number of following to fetch
33
+ * @param count The number of following to fetch, should be >= 40 when no cursor is provided
33
34
  * @param all Whether to fetch list of all followings
34
35
  * @param cursor The cursor to the batch of followings to fetch
35
36
  * @param followingsCount The total number of followings of the target user