rettiwt-api 1.1.1 → 1.1.5

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 (274) hide show
  1. package/README.md +32 -7
  2. package/dist/endpoints/Endpoints.d.ts +14 -0
  3. package/dist/endpoints/Endpoints.js +20 -0
  4. package/dist/endpoints/Endpoints.js.map +1 -0
  5. package/dist/endpoints/Url.d.ts +5 -0
  6. package/dist/endpoints/Url.js +12 -0
  7. package/dist/endpoints/Url.js.map +1 -0
  8. package/dist/enums/Endpoints.d.ts +25 -0
  9. package/dist/enums/Endpoints.js +31 -0
  10. package/dist/enums/Endpoints.js.map +1 -0
  11. package/dist/enums/Errors.d.ts +20 -0
  12. package/dist/enums/Errors.js +28 -0
  13. package/dist/enums/Errors.js.map +1 -0
  14. package/dist/enums/HTTP.d.ts +17 -0
  15. package/dist/enums/HTTP.js +23 -0
  16. package/dist/enums/HTTP.js.map +1 -0
  17. package/dist/graphql/enums/Errors.d.ts +20 -0
  18. package/dist/graphql/enums/Errors.js +28 -0
  19. package/dist/graphql/enums/Errors.js.map +1 -0
  20. package/dist/graphql/queries/RootQuery.js +10 -3
  21. package/dist/graphql/queries/RootQuery.js.map +1 -1
  22. package/dist/graphql/resolvers/AccountResolver.d.ts +3 -3
  23. package/dist/graphql/resolvers/AccountResolver.js.map +1 -1
  24. package/dist/graphql/resolvers/ResolverBase.d.ts +14 -3
  25. package/dist/graphql/resolvers/ResolverBase.js +13 -1
  26. package/dist/graphql/resolvers/ResolverBase.js.map +1 -1
  27. package/dist/graphql/resolvers/TweetResolver.d.ts +3 -3
  28. package/dist/graphql/resolvers/TweetResolver.js +30 -18
  29. package/dist/graphql/resolvers/TweetResolver.js.map +1 -1
  30. package/dist/graphql/resolvers/UserResolver.d.ts +4 -4
  31. package/dist/graphql/resolvers/UserResolver.js +23 -19
  32. package/dist/graphql/resolvers/UserResolver.js.map +1 -1
  33. package/dist/graphql/types/Errors.d.ts +20 -0
  34. package/dist/graphql/types/Errors.js +28 -0
  35. package/dist/graphql/types/Errors.js.map +1 -0
  36. package/dist/graphql/types/TweetTypes.js +2 -2
  37. package/dist/graphql/types/TweetTypes.js.map +1 -1
  38. package/dist/index.d.ts +31 -15
  39. package/dist/index.js +32 -17
  40. package/dist/index.js.map +1 -1
  41. package/dist/middlewares/Authentication.d.ts +0 -0
  42. package/dist/middlewares/Authentication.js +2 -0
  43. package/dist/middlewares/Authentication.js.map +1 -0
  44. package/dist/models/args/TweetFilter.d.ts +59 -0
  45. package/dist/models/args/TweetFilter.js +101 -0
  46. package/dist/models/args/TweetFilter.js.map +1 -0
  47. package/dist/models/args/TweetListArgs.d.ts +21 -0
  48. package/dist/models/args/TweetListArgs.js +54 -0
  49. package/dist/models/args/TweetListArgs.js.map +1 -0
  50. package/dist/models/args/UserListArgs.d.ts +21 -0
  51. package/dist/models/args/UserListArgs.js +54 -0
  52. package/dist/models/args/UserListArgs.js.map +1 -0
  53. package/dist/models/auth/AuthCookie.d.ts +21 -0
  54. package/dist/models/auth/AuthCookie.js +33 -0
  55. package/dist/models/auth/AuthCookie.js.map +1 -0
  56. package/dist/models/data/CursoredData.d.ts +34 -0
  57. package/dist/models/data/CursoredData.js +42 -0
  58. package/dist/models/data/CursoredData.js.map +1 -0
  59. package/dist/models/data/DataValidationError.d.ts +18 -0
  60. package/dist/models/data/DataValidationError.js +21 -0
  61. package/dist/models/data/DataValidationError.js.map +1 -0
  62. package/dist/models/data/Errors.d.ts +18 -0
  63. package/dist/models/data/Errors.js +21 -0
  64. package/dist/models/data/Errors.js.map +1 -0
  65. package/dist/models/data/Service.d.ts +33 -0
  66. package/dist/models/data/Service.js +41 -0
  67. package/dist/models/data/Service.js.map +1 -0
  68. package/dist/models/data/Tweet.d.ts +53 -0
  69. package/dist/models/data/Tweet.js +104 -0
  70. package/dist/models/data/Tweet.js.map +1 -0
  71. package/dist/models/data/User.d.ts +41 -0
  72. package/dist/models/data/User.js +32 -0
  73. package/dist/models/data/User.js.map +1 -0
  74. package/dist/models/errors/DataValidationError.d.ts +20 -0
  75. package/dist/models/errors/DataValidationError.js +23 -0
  76. package/dist/models/errors/DataValidationError.js.map +1 -0
  77. package/dist/models/query/Variables.d.ts +2 -0
  78. package/dist/models/query/Variables.js +10 -0
  79. package/dist/models/query/Variables.js.map +1 -0
  80. package/dist/requests/Url.d.ts +5 -0
  81. package/dist/requests/Url.js +12 -0
  82. package/dist/requests/Url.js.map +1 -0
  83. package/dist/server.d.ts +1 -1
  84. package/dist/server.js +9 -10
  85. package/dist/server.js.map +1 -1
  86. package/dist/services/accounts/AccountService.d.ts +6 -0
  87. package/dist/services/accounts/AccountService.js +20 -0
  88. package/dist/services/accounts/AccountService.js.map +1 -1
  89. package/dist/services/auth/AccountService.d.ts +88 -0
  90. package/dist/services/auth/AccountService.js +392 -0
  91. package/dist/services/auth/AccountService.js.map +1 -0
  92. package/dist/services/auth/AuthService.d.ts +31 -0
  93. package/dist/services/auth/AuthService.js +118 -0
  94. package/dist/services/auth/AuthService.js.map +1 -0
  95. package/dist/services/auth/LoginFlows.d.ts +77 -0
  96. package/dist/services/auth/LoginFlows.js +92 -0
  97. package/dist/services/auth/LoginFlows.js.map +1 -0
  98. package/dist/services/data/TweetService.d.ts +46 -16
  99. package/dist/services/data/TweetService.js +71 -54
  100. package/dist/services/data/TweetService.js.map +1 -1
  101. package/dist/services/data/UserService.d.ts +45 -21
  102. package/dist/services/data/UserService.js +78 -75
  103. package/dist/services/data/UserService.js.map +1 -1
  104. package/dist/services/helper/Headers.d.ts +4 -4
  105. package/dist/services/helper/Headers.js.map +1 -1
  106. package/dist/services/helper/Parser.d.ts +2 -2
  107. package/dist/services/helper/Parser.js.map +1 -1
  108. package/dist/services/helper/extractors/Tweets.d.ts +6 -6
  109. package/dist/services/helper/extractors/Tweets.js +1 -1
  110. package/dist/services/helper/extractors/Tweets.js.map +1 -1
  111. package/dist/services/helper/extractors/Users.d.ts +4 -4
  112. package/dist/services/helper/extractors/Users.js +1 -1
  113. package/dist/services/helper/extractors/Users.js.map +1 -1
  114. package/dist/services/helper/payloads/LoginFlows.d.ts +77 -0
  115. package/dist/services/helper/payloads/LoginFlows.js +92 -0
  116. package/dist/services/helper/payloads/LoginFlows.js.map +1 -0
  117. package/dist/services/util/CacheService.d.ts +33 -0
  118. package/dist/services/util/CacheService.js +96 -0
  119. package/dist/services/util/CacheService.js.map +1 -0
  120. package/dist/services/util/FetcherService.d.ts +65 -0
  121. package/dist/services/util/FetcherService.js +214 -0
  122. package/dist/services/util/FetcherService.js.map +1 -0
  123. package/dist/types/Args.d.ts +38 -0
  124. package/dist/types/Args.js +5 -0
  125. package/dist/types/Args.js.map +1 -0
  126. package/dist/types/Authentication.d.ts +17 -2
  127. package/dist/types/Authentication.js +1 -0
  128. package/dist/types/Authentication.js.map +1 -1
  129. package/dist/types/Resolvers.d.ts +5 -4
  130. package/dist/types/Rettiwt.d.ts +16 -0
  131. package/dist/types/Rettiwt.js +3 -0
  132. package/dist/types/Rettiwt.js.map +1 -0
  133. package/dist/types/Service.d.ts +15 -23
  134. package/dist/types/Service.js +2 -16
  135. package/dist/types/Service.js.map +1 -1
  136. package/dist/types/Tweet.d.ts +25 -19
  137. package/dist/types/Tweet.js +0 -2
  138. package/dist/types/Tweet.js.map +1 -1
  139. package/dist/types/User.d.ts +35 -0
  140. package/dist/types/User.js +3 -0
  141. package/dist/types/User.js.map +1 -0
  142. package/dist/types/args/TweetFilter.d.ts +54 -0
  143. package/dist/types/args/TweetFilter.js +96 -0
  144. package/dist/types/args/TweetFilter.js.map +1 -0
  145. package/dist/types/args/TweetListArg.d.ts +10 -0
  146. package/dist/types/args/TweetListArg.js +42 -0
  147. package/dist/types/args/TweetListArg.js.map +1 -0
  148. package/dist/types/args/TweetListArgs.d.ts +20 -0
  149. package/dist/types/args/TweetListArgs.js +52 -0
  150. package/dist/types/args/TweetListArgs.js.map +1 -0
  151. package/dist/types/args/UserListArgs.d.ts +16 -0
  152. package/dist/types/args/UserListArgs.js +48 -0
  153. package/dist/types/args/UserListArgs.js.map +1 -0
  154. package/dist/types/data/Errors.d.ts +4 -1
  155. package/dist/types/data/Errors.js +3 -0
  156. package/dist/types/data/Errors.js.map +1 -1
  157. package/dist/types/data/TweetFilter.d.ts +49 -0
  158. package/dist/types/data/TweetFilter.js +63 -0
  159. package/dist/types/data/TweetFilter.js.map +1 -0
  160. package/dist/types/interfaces/Args.d.ts +38 -0
  161. package/dist/types/interfaces/Args.js +5 -0
  162. package/dist/types/interfaces/Args.js.map +1 -0
  163. package/dist/types/interfaces/Authentication.d.ts +40 -0
  164. package/dist/types/interfaces/Authentication.js +5 -0
  165. package/dist/types/interfaces/Authentication.js.map +1 -0
  166. package/dist/types/interfaces/Resolvers.d.ts +14 -0
  167. package/dist/types/interfaces/Resolvers.js +3 -0
  168. package/dist/types/interfaces/Resolvers.js.map +1 -0
  169. package/dist/types/interfaces/Rettiwt.d.ts +16 -0
  170. package/dist/types/interfaces/Rettiwt.js +3 -0
  171. package/dist/types/interfaces/Rettiwt.js.map +1 -0
  172. package/dist/types/interfaces/Service.d.ts +13 -0
  173. package/dist/types/interfaces/Service.js +3 -0
  174. package/dist/types/interfaces/Service.js.map +1 -0
  175. package/dist/types/interfaces/Services.d.ts +13 -0
  176. package/dist/types/interfaces/Services.js +3 -0
  177. package/dist/types/interfaces/Services.js.map +1 -0
  178. package/dist/types/interfaces/Tweet.d.ts +46 -0
  179. package/dist/types/interfaces/Tweet.js +3 -0
  180. package/dist/types/interfaces/Tweet.js.map +1 -0
  181. package/dist/types/interfaces/TweetFilter.d.ts +0 -0
  182. package/dist/types/interfaces/TweetFilter.js +2 -0
  183. package/dist/types/interfaces/TweetFilter.js.map +1 -0
  184. package/{src/types/data/User.ts → dist/types/interfaces/User.d.ts} +35 -51
  185. package/dist/types/interfaces/User.js +3 -0
  186. package/dist/types/interfaces/User.js.map +1 -0
  187. package/dist/types/raw/query/tweet/TweetDetails.d.ts +34 -0
  188. package/dist/types/raw/query/tweet/TweetDetails.js +5 -0
  189. package/dist/types/raw/query/tweet/TweetDetails.js.map +1 -0
  190. package/dist/types/raw/user/User.js.map +1 -1
  191. package/dist/types/services/args/TweetFilter.d.ts +50 -0
  192. package/dist/types/services/args/TweetFilter.js +76 -0
  193. package/dist/types/services/args/TweetFilter.js.map +1 -0
  194. package/docs/.nojekyll +1 -0
  195. package/docs/assets/highlight.css +64 -0
  196. package/docs/assets/main.js +58 -0
  197. package/docs/assets/search.js +1 -0
  198. package/docs/assets/style.css +1280 -0
  199. package/docs/classes/AccountService.html +303 -0
  200. package/docs/classes/AuthCookie.html +146 -0
  201. package/docs/classes/AuthService.html +147 -0
  202. package/docs/classes/CacheService.html +157 -0
  203. package/docs/classes/Cursor.html +102 -0
  204. package/docs/classes/CursoredData.html +126 -0
  205. package/docs/classes/DataValidationError.html +119 -0
  206. package/docs/classes/FetcherService.html +225 -0
  207. package/docs/classes/Tweet.html +210 -0
  208. package/docs/classes/TweetEntities.html +128 -0
  209. package/docs/classes/TweetFilter.html +204 -0
  210. package/docs/classes/TweetListArgs.html +118 -0
  211. package/docs/classes/TweetService.html +313 -0
  212. package/docs/classes/User.html +230 -0
  213. package/docs/classes/UserListArgs.html +118 -0
  214. package/docs/classes/UserService.html +315 -0
  215. package/docs/enums/HttpMethods.html +74 -0
  216. package/docs/functions/Rettiwt.html +99 -0
  217. package/docs/index.html +161 -0
  218. package/docs/interfaces/IAuthCookie.html +104 -0
  219. package/docs/interfaces/ICursor.html +77 -0
  220. package/docs/interfaces/ICursoredData.html +93 -0
  221. package/docs/interfaces/IDataContext.html +91 -0
  222. package/docs/interfaces/IListArgs.html +87 -0
  223. package/docs/interfaces/ITweet.html +176 -0
  224. package/docs/interfaces/ITweetEntities.html +104 -0
  225. package/docs/interfaces/ITweetFilter.html +158 -0
  226. package/docs/interfaces/IUser.html +194 -0
  227. package/docs/modules.html +109 -0
  228. package/package.json +5 -2
  229. package/src/enums/Errors.ts +21 -0
  230. package/src/graphql/enums/Errors.ts +21 -0
  231. package/src/graphql/queries/RootQuery.ts +11 -4
  232. package/src/graphql/resolvers/AccountResolver.ts +3 -3
  233. package/src/graphql/resolvers/ResolverBase.ts +19 -5
  234. package/src/graphql/resolvers/TweetResolver.ts +26 -17
  235. package/src/graphql/resolvers/UserResolver.ts +18 -20
  236. package/src/graphql/types/TweetTypes.ts +2 -2
  237. package/src/graphql/types/UserTypes.ts +1 -1
  238. package/src/index.ts +39 -17
  239. package/src/models/args/TweetFilter.ts +119 -0
  240. package/src/models/args/TweetListArgs.ts +47 -0
  241. package/src/models/args/UserListArgs.ts +47 -0
  242. package/src/models/auth/AuthCookie.ts +43 -0
  243. package/src/models/data/CursoredData.ts +45 -0
  244. package/src/models/data/Tweet.ts +118 -0
  245. package/src/models/data/User.ts +72 -0
  246. package/src/models/errors/DataValidationError.ts +29 -0
  247. package/src/server.ts +9 -10
  248. package/src/services/{accounts → auth}/AccountService.ts +92 -17
  249. package/src/services/auth/AuthService.ts +81 -0
  250. package/src/services/data/TweetService.ts +77 -58
  251. package/src/services/data/UserService.ts +93 -89
  252. package/src/services/helper/Headers.ts +4 -4
  253. package/src/services/helper/Parser.ts +2 -2
  254. package/src/services/helper/extractors/Tweets.ts +7 -7
  255. package/src/services/helper/extractors/Users.ts +5 -5
  256. package/src/services/{CacheService.ts → util/CacheService.ts} +4 -1
  257. package/src/services/{FetcherService.ts → util/FetcherService.ts} +19 -11
  258. package/src/types/Args.ts +49 -0
  259. package/src/types/Authentication.ts +29 -7
  260. package/src/types/Resolvers.ts +5 -4
  261. package/src/types/Rettiwt.ts +20 -0
  262. package/src/types/Service.ts +24 -0
  263. package/src/types/Tweet.ts +61 -0
  264. package/src/types/User.ts +48 -0
  265. package/tsconfig.json +2 -2
  266. package/src/services/AuthService.ts +0 -68
  267. package/src/services/helper/deserializers/Tweets.ts +0 -70
  268. package/src/services/helper/deserializers/Users.ts +0 -26
  269. package/src/types/data/Errors.ts +0 -34
  270. package/src/types/data/Service.ts +0 -55
  271. package/src/types/data/Tweet.ts +0 -123
  272. package/src/types/raw/auth/Cookie.ts +0 -16
  273. /package/src/{types → enums}/HTTP.ts +0 -0
  274. /package/src/services/{accounts → helper/payloads}/LoginFlows.ts +0 -0
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ var LoginFlows = {
4
+ "InitiateLogin": {
5
+ url: 'https://api.twitter.com/1.1/onboarding/task.json?flow_name=login'
6
+ },
7
+ "JsInstrumentationSubtask": {
8
+ url: 'https://api.twitter.com/1.1/onboarding/task.json',
9
+ body: function (flowToken) { return ({
10
+ "flow_token": flowToken,
11
+ "subtask_inputs": [
12
+ {
13
+ "subtask_id": "LoginJsInstrumentationSubtask",
14
+ "js_instrumentation": {
15
+ "response": "{\"rf\":{\"a09453c7341fb1cbb7d51561f92d478fa0752bc77e7ca6b5703258680b2c51d7\":-4,\"bd26c6694e256b10766447d992deaf92bb220bc05e3b8205ba5c9a4f83302230\":0,\"abfa440376b8dc33ca518e1e2a998b3ac4200a8122ef09781eea2c1408717111\":-1,\"a4e87b66027f638a4634561275fab00f9f7446b81a180b5f03eda69fa32eb8f4\":-224},\"s\":\"yET9nlXrlGRAylCyyBKEsxOpUweMpjRz5RfKzTzQyVADnKE64gmpyILfKBK0-HIHWY8FbJPHGWr6QrCb5A-Z3q2SLRm4DReprZGXykJ111_ynet8kSjFkRjODKKDN2FzT1V6rx9FILnUuRCaMu9ewfPgPBi4wO1g7EUeEsSSHIiCwNc9URJr4c2xVTA3ibIfTbu8p2WhX7RZAk8LWRPpPPB21st8Z1j0LcLlR0bkZoF6LsN-7w75lGB0s4z1JKqus2MVuRcPMay0wWZbn8Qx9In_-tSTvEBLcxjUpDgwu29G0g0iCWoISFzLY4-LLvV7UBGklkByIcPtwYbDbREqRQAAAYYmXAsG\"}",
16
+ "link": "next_link"
17
+ }
18
+ }
19
+ ]
20
+ }); }
21
+ },
22
+ "EnterUserIdentifier": {
23
+ url: 'https://api.twitter.com/1.1/onboarding/task.json',
24
+ body: function (flowToken, email) { return ({
25
+ "flow_token": flowToken,
26
+ "subtask_inputs": [
27
+ {
28
+ "subtask_id": "LoginEnterUserIdentifierSSO",
29
+ "settings_list": {
30
+ "setting_responses": [
31
+ {
32
+ "key": "user_identifier",
33
+ "response_data": {
34
+ "text_data": {
35
+ "result": email
36
+ }
37
+ }
38
+ }
39
+ ],
40
+ "link": "next_link"
41
+ }
42
+ }
43
+ ]
44
+ }); }
45
+ },
46
+ "EnterAlternateUserIdentifier": {
47
+ url: 'https://api.twitter.com/1.1/onboarding/task.json',
48
+ body: function (flowToken, userName) { return ({
49
+ "flow_token": flowToken,
50
+ "subtask_inputs": [
51
+ {
52
+ "subtask_id": "LoginEnterAlternateIdentifierSubtask",
53
+ "enter_text": {
54
+ "text": userName,
55
+ "link": "next_link"
56
+ }
57
+ }
58
+ ]
59
+ }); }
60
+ },
61
+ "EnterPassword": {
62
+ url: 'https://api.twitter.com/1.1/onboarding/task.json',
63
+ body: function (flowToken, password) { return ({
64
+ "flow_token": flowToken,
65
+ "subtask_inputs": [
66
+ {
67
+ "subtask_id": "LoginEnterPassword",
68
+ "enter_password": {
69
+ "password": password,
70
+ "link": "next_link"
71
+ }
72
+ }
73
+ ]
74
+ }); }
75
+ },
76
+ "AccountDuplicationCheck": {
77
+ url: 'https://api.twitter.com/1.1/onboarding/task.json',
78
+ body: function (flowToken) { return ({
79
+ "flow_token": flowToken,
80
+ "subtask_inputs": [
81
+ {
82
+ "subtask_id": "AccountDuplicationCheck",
83
+ "check_logged_in_account": {
84
+ "link": "AccountDuplicationCheck_false"
85
+ }
86
+ }
87
+ ]
88
+ }); }
89
+ }
90
+ };
91
+ exports["default"] = LoginFlows;
92
+ //# sourceMappingURL=LoginFlows.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LoginFlows.js","sourceRoot":"","sources":["../../../../src/services/helper/payloads/LoginFlows.ts"],"names":[],"mappings":";;AAAA,IAAM,UAAU,GAAG;IACf,eAAe,EAAE;QACb,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AAY,EAAE,oBAAoB;oBAClC,gBAAgB,EAAE;wBACd,UAAU,EAAE,QAAQ;wBACpB,MAAM,EAAE,WAAW;qBACtB;iBACJ;aACJ;SACJ,CAAC,EAX6C,CAW7C;KACL;IACD,yBAAyB,EAAE;QACvB,GAAG,EAAE,kDAAkD;QACvD,IAAI,EAAE,UAAC,SAAiB,IAAK,OAAA,CAAC;YAC1B,YAAY,EAAE,SAAS;YACvB,gBAAgB,EAAE;gBACd;oBACI,YAAY,EAAE,yBAAyB;oBACvC,yBAAyB,EAAE;wBACvB,MAAM,EAAE,+BAA+B;qBAC1C;iBACJ;aACJ;SACJ,CAAC,EAV2B,CAU3B;KACL;CACJ,CAAA;AAED,qBAAe,UAAU,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Handles reading and writing of data from and to cache.
3
+ *
4
+ * This services uses a local node-cache instance to cache data, since the data to be cached has no real purpose outside of the server session.
5
+ * This serivce follows a singleton pattern, where at any point, only a single instance of this class exists.
6
+ * This is done so that all the data is cached in a single instance, which makes sharing of cached data between different endpoints possible.
7
+ * @internal
8
+ */
9
+ export declare class CacheService {
10
+ private static instance;
11
+ private client;
12
+ private constructor();
13
+ /**
14
+ * @returns The current working instance of CacheService
15
+ */
16
+ static getInstance(): CacheService;
17
+ /**
18
+ * Stores the input data in the cache.
19
+ *
20
+ * @param data The input data to store.
21
+ *
22
+ * @returns Whether writing to cache was successful or not.
23
+ *
24
+ * @remarks In order to cache data, the data to be cached must have a unique 'id' field.
25
+ */
26
+ write(data: any): void;
27
+ /**
28
+ * @param id The id id of the data to be fetched from cache.
29
+ *
30
+ * @returns The data with the given id.
31
+ */
32
+ read(id: string): any;
33
+ }
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
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
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ exports.__esModule = true;
29
+ exports.CacheService = void 0;
30
+ // PACKAGES
31
+ var node_cache_1 = __importDefault(require("node-cache"));
32
+ // PARSERS
33
+ var Parsers = __importStar(require("../helper/Parser"));
34
+ /**
35
+ * Handles reading and writing of data from and to cache.
36
+ *
37
+ * This services uses a local node-cache instance to cache data, since the data to be cached has no real purpose outside of the server session.
38
+ * This serivce follows a singleton pattern, where at any point, only a single instance of this class exists.
39
+ * This is done so that all the data is cached in a single instance, which makes sharing of cached data between different endpoints possible.
40
+ * @internal
41
+ */
42
+ var CacheService = /** @class */ (function () {
43
+ // MEMBER METHODS
44
+ function CacheService() {
45
+ // Initializing new cache
46
+ this.client = new node_cache_1["default"]();
47
+ }
48
+ /**
49
+ * @returns The current working instance of CacheService
50
+ */
51
+ CacheService.getInstance = function () {
52
+ // If an instance doesnt exists already
53
+ if (!this.instance) {
54
+ this.instance = new CacheService();
55
+ }
56
+ // Returning the current instance
57
+ return this.instance;
58
+ };
59
+ /**
60
+ * Stores the input data in the cache.
61
+ *
62
+ * @param data The input data to store.
63
+ *
64
+ * @returns Whether writing to cache was successful or not.
65
+ *
66
+ * @remarks In order to cache data, the data to be cached must have a unique 'id' field.
67
+ */
68
+ CacheService.prototype.write = function (data) {
69
+ // Converting the data to a list of data
70
+ data = Parsers.dataToList(data);
71
+ // Iterating over the list of data
72
+ for (var _i = 0, data_1 = data; _i < data_1.length; _i++) {
73
+ var item = data_1[_i];
74
+ // Storing whether data is already cached or not
75
+ var cached = this.client.has(Parsers.findJSONKey(item, 'id'));
76
+ // If data does not already exist in cache
77
+ if (!cached) {
78
+ // Adding data to cache
79
+ this.client.set(Parsers.findJSONKey(item, 'id'), item);
80
+ }
81
+ }
82
+ };
83
+ /**
84
+ * @param id The id id of the data to be fetched from cache.
85
+ *
86
+ * @returns The data with the given id.
87
+ */
88
+ CacheService.prototype.read = function (id) {
89
+ // Getting data from cache
90
+ var res = this.client.get(id);
91
+ return res;
92
+ };
93
+ return CacheService;
94
+ }());
95
+ exports.CacheService = CacheService;
96
+ //# sourceMappingURL=CacheService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CacheService.js","sourceRoot":"","sources":["../../../src/services/util/CacheService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,WAAW;AACX,0DAAmC;AAEnC,UAAU;AACV,wDAA4C;AAE5C;;;;;;;GAOG;AACH;IAKI,iBAAiB;IACjB;QACI,yBAAyB;QACzB,IAAI,CAAC,MAAM,GAAG,IAAI,uBAAS,EAAE,CAAC;IAClC,CAAC;IAED;;OAEG;IACI,wBAAW,GAAlB;QACI,uCAAuC;QACvC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAChB,IAAI,CAAC,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;SACtC;QAED,iCAAiC;QACjC,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED;;;;;;;;OAQG;IACI,4BAAK,GAAZ,UAAa,IAAS;QAClB,wCAAwC;QACxC,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAEhC,kCAAkC;QAClC,KAAiB,UAAI,EAAJ,aAAI,EAAJ,kBAAI,EAAJ,IAAI,EAAE;YAAlB,IAAI,IAAI,aAAA;YACT,gDAAgD;YAChD,IAAI,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;YAE9D,0CAA0C;YAC1C,IAAG,CAAC,MAAM,EAAE;gBACR,uBAAuB;gBACvB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;aAC1D;SACJ;IACL,CAAC;IAED;;;;OAIG;IACI,2BAAI,GAAX,UAAY,EAAU;QAClB,0BAA0B;QAC1B,IAAI,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAE9B,OAAO,GAAG,CAAC;IACf,CAAC;IACL,mBAAC;AAAD,CAAC,AA7DD,IA6DC;AA7DY,oCAAY"}
@@ -0,0 +1,65 @@
1
+ import { CurlyResult } from 'node-libcurl';
2
+ import { AuthService } from '../auth/AuthService';
3
+ /**
4
+ * The different types of http requests.
5
+ */
6
+ export declare enum HttpMethods {
7
+ POST = "POST",
8
+ GET = "GET"
9
+ }
10
+ /**
11
+ * Handles all HTTP requests.
12
+ * @internal
13
+ *
14
+ * This serves as the base service from which all other data services derive their behaviour.
15
+ */
16
+ export declare class FetcherService {
17
+ /** The authentication service instance. */
18
+ private auth;
19
+ /** The caching service instance. */
20
+ private cache;
21
+ /** Whether instance has been authenticated or not. */
22
+ protected isAuthenticated: boolean;
23
+ /**
24
+ * @param auth The AuthService instance to use for authentication.
25
+ */
26
+ constructor(auth: AuthService);
27
+ /**
28
+ * The middleware for handling any HTTP error.
29
+ *
30
+ * @param res The response object received.
31
+ *
32
+ * @returns The received response, if no HTTP errors are found.
33
+ *
34
+ * @throws {@link HttpStatus} error, if any HTTP error is found.
35
+ */
36
+ private handleHTTPError;
37
+ /**
38
+ * Creates an HTTP request according to the given parameters.
39
+ *
40
+ * This method internally uses node-libcurl library to make curl requests to the URL, instead of node-fetch.
41
+ * This has been done since that way it better mimics the HTTP requests made from browser.
42
+ *
43
+ * @param url The url to fetch data from.
44
+ * @param authenticate Whether to authenticate requests or not.
45
+ * @param method The HTTP method (from {@link HttpMethods}) to use.
46
+ * @param data The data to be sent along with the request (for POST request).
47
+ *
48
+ * @returns The {@link CurlyResult} received.
49
+ */
50
+ protected request<DataType>(url: string, authenticate?: boolean, method?: HttpMethods, data?: any): Promise<CurlyResult<DataType>>;
51
+ /**
52
+ * Caches the extracted data into the {@link CacheService} instance.
53
+ *
54
+ * @param data The extracted data to be cached.
55
+ */
56
+ protected cacheData(data: any): void;
57
+ /**
58
+ * Fetches the data with the given id from the cache.
59
+ *
60
+ * @param id The id of the data to be read from cache.
61
+ *
62
+ * @returns The data with the given id. If does not exists, returns undefined.
63
+ */
64
+ protected readData(id: string): any;
65
+ }
@@ -0,0 +1,214 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ var __generator = (this && this.__generator) || function (thisArg, body) {
46
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
47
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
48
+ function verb(n) { return function (v) { return step([n, v]); }; }
49
+ function step(op) {
50
+ if (f) throw new TypeError("Generator is already executing.");
51
+ while (_) try {
52
+ 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;
53
+ if (y = 0, t) op = [op[0] & 2, t.value];
54
+ switch (op[0]) {
55
+ case 0: case 1: t = op; break;
56
+ case 4: _.label++; return { value: op[1], done: false };
57
+ case 5: _.label++; y = op[1]; op = [0]; continue;
58
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
59
+ default:
60
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
61
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
62
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
63
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
64
+ if (t[2]) _.ops.pop();
65
+ _.trys.pop(); continue;
66
+ }
67
+ op = body.call(thisArg, _);
68
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
69
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
70
+ }
71
+ };
72
+ exports.__esModule = true;
73
+ exports.FetcherService = exports.HttpMethods = void 0;
74
+ // PACKAGES
75
+ var node_libcurl_1 = require("node-libcurl");
76
+ var CacheService_1 = require("./CacheService");
77
+ // MODELS
78
+ var Tweet_1 = require("../../models/data/Tweet");
79
+ var User_1 = require("../../models/data/User");
80
+ // ENUMS
81
+ var HTTP_1 = require("../../enums/HTTP");
82
+ // HELPERS
83
+ var Headers = __importStar(require("../helper/Headers"));
84
+ /**
85
+ * The different types of http requests.
86
+ */
87
+ var HttpMethods;
88
+ (function (HttpMethods) {
89
+ HttpMethods["POST"] = "POST";
90
+ HttpMethods["GET"] = "GET";
91
+ })(HttpMethods = exports.HttpMethods || (exports.HttpMethods = {}));
92
+ ;
93
+ /**
94
+ * Handles all HTTP requests.
95
+ * @internal
96
+ *
97
+ * This serves as the base service from which all other data services derive their behaviour.
98
+ */
99
+ var FetcherService = /** @class */ (function () {
100
+ // MEMBER METHODS
101
+ /**
102
+ * @param auth The AuthService instance to use for authentication.
103
+ */
104
+ function FetcherService(auth) {
105
+ this.auth = auth;
106
+ this.cache = CacheService_1.CacheService.getInstance();
107
+ this.isAuthenticated = this.auth.isAuthenticated;
108
+ }
109
+ /**
110
+ * The middleware for handling any HTTP error.
111
+ *
112
+ * @param res The response object received.
113
+ *
114
+ * @returns The received response, if no HTTP errors are found.
115
+ *
116
+ * @throws {@link HttpStatus} error, if any HTTP error is found.
117
+ */
118
+ FetcherService.prototype.handleHTTPError = function (res) {
119
+ /**
120
+ * If the status code is not 200 => the HTTP request was not successful. hence throwing error
121
+ */
122
+ if (res.statusCode != 200 && res.statusCode in HTTP_1.HttpStatus) {
123
+ throw new Error(HTTP_1.HttpStatus[res.statusCode]);
124
+ }
125
+ return res;
126
+ };
127
+ /**
128
+ * Creates an HTTP request according to the given parameters.
129
+ *
130
+ * This method internally uses node-libcurl library to make curl requests to the URL, instead of node-fetch.
131
+ * This has been done since that way it better mimics the HTTP requests made from browser.
132
+ *
133
+ * @param url The url to fetch data from.
134
+ * @param authenticate Whether to authenticate requests or not.
135
+ * @param method The HTTP method (from {@link HttpMethods}) to use.
136
+ * @param data The data to be sent along with the request (for POST request).
137
+ *
138
+ * @returns The {@link CurlyResult} received.
139
+ */
140
+ FetcherService.prototype.request = function (url, authenticate, method, data) {
141
+ if (authenticate === void 0) { authenticate = true; }
142
+ if (method === void 0) { method = HttpMethods.GET; }
143
+ return __awaiter(this, void 0, void 0, function () {
144
+ var config, _a, _b, _c, _d, _e;
145
+ var _f;
146
+ var _this = this;
147
+ return __generator(this, function (_g) {
148
+ switch (_g.label) {
149
+ case 0:
150
+ _f = {};
151
+ if (!authenticate) return [3 /*break*/, 2];
152
+ _c = (_b = Headers).authorizedHeader;
153
+ return [4 /*yield*/, this.auth.getAuthCredentials()];
154
+ case 1:
155
+ _a = _c.apply(_b, [_g.sent()]);
156
+ return [3 /*break*/, 4];
157
+ case 2:
158
+ _e = (_d = Headers).guestHeader;
159
+ return [4 /*yield*/, this.auth.getGuestCredentials()];
160
+ case 3:
161
+ _a = _e.apply(_d, [_g.sent()]);
162
+ _g.label = 4;
163
+ case 4:
164
+ config = (
165
+ /**
166
+ * If authorization is required, using the authenticated header, using the authentication credentiials.
167
+ * Else, using the guest header, using the guest credentials.
168
+ */
169
+ _f.httpHeader = _a,
170
+ /**
171
+ * Disabling SSL peer verification because verification causes Error 404 (only while fetching tweets), likely because peer verification fails.
172
+ */
173
+ _f.sslVerifyPeer = false,
174
+ _f);
175
+ if (!(method == HttpMethods.POST)) return [3 /*break*/, 6];
176
+ return [4 /*yield*/, node_libcurl_1.curly.post(url, __assign(__assign({}, config), { postFields: JSON.stringify(data) })).then(function (res) { return _this.handleHTTPError(res); })];
177
+ case 5: return [2 /*return*/, _g.sent()];
178
+ case 6: return [4 /*yield*/, node_libcurl_1.curly.get(url, config).then(function (res) { return _this.handleHTTPError(res); })];
179
+ case 7: return [2 /*return*/, _g.sent()];
180
+ }
181
+ });
182
+ });
183
+ };
184
+ /**
185
+ * Caches the extracted data into the {@link CacheService} instance.
186
+ *
187
+ * @param data The extracted data to be cached.
188
+ */
189
+ FetcherService.prototype.cacheData = function (data) {
190
+ /**
191
+ * The extracted data is in raw form.
192
+ * This raw data is deserialized into the respective known types.
193
+ */
194
+ var users = data.users.map(function (user) { return new User_1.User(user); });
195
+ var tweets = data.tweets.map(function (tweet) { return new Tweet_1.Tweet(tweet); });
196
+ // Caching the data
197
+ this.cache.write(users);
198
+ this.cache.write(tweets);
199
+ };
200
+ /**
201
+ * Fetches the data with the given id from the cache.
202
+ *
203
+ * @param id The id of the data to be read from cache.
204
+ *
205
+ * @returns The data with the given id. If does not exists, returns undefined.
206
+ */
207
+ FetcherService.prototype.readData = function (id) {
208
+ // Reading data from cache
209
+ return this.cache.read(id);
210
+ };
211
+ return FetcherService;
212
+ }());
213
+ exports.FetcherService = FetcherService;
214
+ //# sourceMappingURL=FetcherService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FetcherService.js","sourceRoot":"","sources":["../../../src/services/util/FetcherService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,WAAW;AACX,6CAAkD;AAIl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B,EAAU;QACzB,0BAA0B;QAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC/B,CAAC;IACL,qBAAC;AAAD,CAAC,AAjHD,IAiHC;AAjHY,wCAAc"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * The filter to be used for fetching tweets from Twitter.
3
+ *
4
+ * @public
5
+ */
6
+ export interface ITweetFilter {
7
+ /** The list of words to search. */
8
+ words?: string[];
9
+ /** The list of hashtags to search. */
10
+ hashtags?: string[];
11
+ /** The list of usernames whose tweets are to be searched. */
12
+ fromUsers?: string[];
13
+ /** The list of username to whom the tweets to be searched, are adressed. */
14
+ toUsers?: string[];
15
+ /** The list of username mentioned in the tweets to search. */
16
+ mentions?: string[];
17
+ /** The date starting from which tweets are to be searched. */
18
+ startDate?: string;
19
+ /** The date upto which tweets are to be searched. */
20
+ endDate?: string;
21
+ /** The id of the tweet, after which the tweets are to be searched. */
22
+ sinceId?: string;
23
+ /** The id of the tweet which is quoted in the tweets to search. */
24
+ quoted?: string;
25
+ /** Whether to fetch tweets that are links or not. */
26
+ links?: boolean;
27
+ }
28
+ /**
29
+ * The arguments for fetching cursored list.
30
+ *
31
+ * @public
32
+ */
33
+ export interface IListArgs {
34
+ /** The number of data items to fetch. */
35
+ count?: number;
36
+ /** The cursor to the batch of data to fetch. */
37
+ cursor?: string;
38
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ ;
4
+ ;
5
+ //# sourceMappingURL=Args.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Args.js","sourceRoot":"","sources":["../../src/types/Args.ts"],"names":[],"mappings":";;AAmCC,CAAC;AAaD,CAAC"}
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * @internal
5
5
  */
6
- export interface GuestCredentials {
6
+ export interface IGuestCredentials {
7
7
  /** The bearer token from twitter.com.
8
8
  *
9
9
  * @remarks This is a static bearer token from twitter.com.
@@ -20,7 +20,7 @@ export interface GuestCredentials {
20
20
  *
21
21
  * @internal
22
22
  */
23
- export interface AuthCredentials {
23
+ export interface IAuthCredentials {
24
24
  /** The bearer token from twitter.com.
25
25
  *
26
26
  * @remarks This is a static bearer token from twitter.com.
@@ -38,3 +38,18 @@ export interface AuthCredentials {
38
38
  */
39
39
  cookie: string;
40
40
  }
41
+ /**
42
+ * The cookie containing the tokens that are used to authenticate against Twitter.
43
+ *
44
+ * @public
45
+ */
46
+ export interface IAuthCookie {
47
+ /** Token used to authenticate a device. */
48
+ kdt: string;
49
+ /** Token used to authenticate a user using a Twitter ID. */
50
+ twid: string;
51
+ /** The CSRF token of the session. */
52
+ ct0: string;
53
+ /** The authentication token used while logging in to the account. */
54
+ auth_token: string;
55
+ }
@@ -2,4 +2,5 @@
2
2
  exports.__esModule = true;
3
3
  ;
4
4
  ;
5
+ ;
5
6
  //# sourceMappingURL=Authentication.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Authentication.js","sourceRoot":"","sources":["../../src/types/Authentication.ts"],"names":[],"mappings":";;AAgBC,CAAC;AAwBD,CAAC"}
1
+ {"version":3,"file":"Authentication.js","sourceRoot":"","sources":["../../src/types/Authentication.ts"],"names":[],"mappings":";;AAiBC,CAAC;AA0BD,CAAC;AAmBD,CAAC"}
@@ -1,14 +1,15 @@
1
1
  /**
2
2
  * The data returned from extractor methods.
3
+ *
3
4
  * @internal
4
5
  */
5
- export interface DataExtract {
6
+ export interface IDataExtract {
6
7
  /** The required data. */
7
- required: any;
8
+ required: any[];
8
9
  /** The cursor string to the next batch of data. */
9
10
  cursor: string;
10
11
  /** Additional extracted user details. */
11
- users: any;
12
+ users: any[];
12
13
  /** Additional extracted tweet details */
13
- tweets: any;
14
+ tweets: any[];
14
15
  }
@@ -0,0 +1,16 @@
1
+ import { AccountService } from "../services/auth/AccountService";
2
+ import { TweetService } from "../services/data/TweetService";
3
+ import { UserService } from "../services/data/UserService";
4
+ /**
5
+ * The data context from where data is to be fetched.
6
+ *
7
+ * @public
8
+ */
9
+ export interface IDataContext {
10
+ /** Handles data related to users. */
11
+ users: UserService;
12
+ /** Handles data related to tweets. */
13
+ tweets: TweetService;
14
+ /** Handles account related operations. */
15
+ account: AccountService;
16
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ //# sourceMappingURL=Rettiwt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Rettiwt.js","sourceRoot":"","sources":["../../src/types/Rettiwt.ts"],"names":[],"mappings":""}