rettiwt-api 1.1.8 → 1.3.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.
- package/.github/workflows/build-docs.yml +22 -21
- package/.github/workflows/publish-to-npm.yml +29 -0
- package/README.md +52 -40
- package/dist/config/env.d.ts +5 -5
- package/dist/config/env.js +8 -8
- package/dist/enums/Errors.d.ts +21 -20
- package/dist/enums/Errors.js +28 -27
- package/dist/enums/Errors.js.map +1 -1
- package/dist/enums/HTTP.d.ts +17 -17
- package/dist/enums/HTTP.js +22 -22
- package/dist/graphql/enums/Errors.d.ts +21 -21
- package/dist/graphql/enums/Errors.js +28 -28
- package/dist/graphql/queries/RootQuery.d.ts +4 -4
- package/dist/graphql/queries/RootQuery.js +77 -77
- package/dist/graphql/queries/RootQuery.js.map +1 -1
- package/dist/graphql/resolvers/AccountResolver.d.ts +12 -12
- package/dist/graphql/resolvers/AccountResolver.js +83 -83
- package/dist/graphql/resolvers/ResolverBase.d.ts +16 -16
- package/dist/graphql/resolvers/ResolverBase.js +22 -22
- package/dist/graphql/resolvers/TweetResolver.d.ts +46 -46
- package/dist/graphql/resolvers/TweetResolver.js +311 -311
- package/dist/graphql/resolvers/TweetResolver.js.map +1 -1
- package/dist/graphql/resolvers/UserResolver.d.ts +48 -48
- package/dist/graphql/resolvers/UserResolver.js +333 -333
- package/dist/graphql/resolvers/UserResolver.js.map +1 -1
- package/dist/graphql/types/Global.d.ts +4 -4
- package/dist/graphql/types/Global.js +12 -12
- package/dist/graphql/types/TweetTypes.d.ts +4 -4
- package/dist/graphql/types/TweetTypes.js +159 -159
- package/dist/graphql/types/UserTypes.d.ts +3 -3
- package/dist/graphql/types/UserTypes.js +136 -136
- package/dist/graphql/types/UserTypes.js.map +1 -1
- package/dist/index.d.ts +45 -43
- package/dist/index.js +72 -70
- package/dist/index.js.map +1 -1
- package/dist/models/args/TweetListArgs.d.ts +21 -21
- package/dist/models/args/TweetListArgs.js +53 -53
- package/dist/models/args/TweetListArgs.js.map +1 -1
- package/dist/models/args/UserListArgs.d.ts +21 -21
- package/dist/models/args/UserListArgs.js +53 -53
- package/dist/models/args/UserListArgs.js.map +1 -1
- package/dist/models/auth/AuthCookie.d.ts +21 -21
- package/dist/models/auth/AuthCookie.js +32 -32
- package/dist/models/data/CursoredData.d.ts +34 -34
- package/dist/models/data/CursoredData.js +41 -41
- package/dist/models/data/Tweet.d.ts +53 -53
- package/dist/models/data/Tweet.js +103 -103
- package/dist/models/data/Tweet.js.map +1 -1
- package/dist/models/data/User.d.ts +41 -41
- package/dist/models/data/User.js +31 -31
- package/dist/models/data/User.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +75 -75
- package/dist/services/auth/AccountService.d.ts +83 -83
- package/dist/services/auth/AccountService.js +411 -411
- package/dist/services/auth/AuthService.d.ts +31 -31
- package/dist/services/auth/AuthService.js +117 -117
- package/dist/services/data/TweetService.d.ts +60 -74
- package/dist/services/data/TweetService.js +250 -254
- package/dist/services/data/TweetService.js.map +1 -1
- package/dist/services/data/UserService.d.ts +71 -87
- package/dist/services/data/UserService.js +277 -296
- package/dist/services/data/UserService.js.map +1 -1
- package/dist/services/helper/Headers.d.ts +19 -19
- package/dist/services/helper/Headers.js +61 -61
- package/dist/services/helper/Headers.js.map +1 -1
- package/dist/services/helper/Parser.d.ts +22 -28
- package/dist/services/helper/Parser.js +83 -104
- package/dist/services/helper/Parser.js.map +1 -1
- package/dist/services/helper/extractors/Tweets.d.ts +23 -32
- package/dist/services/helper/extractors/Tweets.js +199 -263
- package/dist/services/helper/extractors/Tweets.js.map +1 -1
- package/dist/services/helper/extractors/Users.d.ts +17 -26
- package/dist/services/helper/extractors/Users.js +150 -202
- package/dist/services/helper/extractors/Users.js.map +1 -1
- package/dist/services/helper/payloads/LoginFlows.d.ts +77 -77
- package/dist/services/helper/payloads/LoginFlows.js +91 -91
- package/dist/services/helper/urls/Authentication.d.ts +4 -4
- package/dist/services/helper/urls/Authentication.js +10 -10
- package/dist/services/util/CacheService.d.ts +33 -33
- package/dist/services/util/CacheService.js +95 -95
- package/dist/services/util/FetcherService.d.ts +65 -65
- package/dist/services/util/FetcherService.js +201 -213
- package/dist/services/util/FetcherService.js.map +1 -1
- package/dist/types/Args.d.ts +11 -38
- package/dist/types/Args.js +3 -4
- package/dist/types/Args.js.map +1 -1
- package/dist/types/Authentication.d.ts +55 -55
- package/dist/types/Authentication.js +5 -5
- package/dist/types/Resolvers.d.ts +15 -15
- package/dist/types/Resolvers.js +2 -2
- package/dist/types/Rettiwt.d.ts +16 -16
- package/dist/types/Rettiwt.js +2 -2
- package/dist/types/Service.d.ts +22 -22
- package/dist/types/Service.js +4 -4
- package/dist/types/Tweet.d.ts +46 -46
- package/dist/types/Tweet.js +2 -2
- package/dist/types/User.d.ts +35 -35
- package/dist/types/User.js +2 -2
- package/docs/.nojekyll +1 -0
- package/docs/assets/highlight.css +64 -0
- package/docs/assets/main.js +58 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1280 -0
- package/docs/classes/AccountService.html +286 -0
- package/docs/classes/AuthCookie.html +146 -0
- package/docs/classes/AuthService.html +147 -0
- package/docs/classes/CacheService.html +157 -0
- package/docs/classes/Cursor.html +102 -0
- package/docs/classes/CursoredData.html +126 -0
- package/docs/classes/DataValidationError.html +120 -0
- package/docs/classes/FetcherService.html +225 -0
- package/docs/classes/Tweet.html +210 -0
- package/docs/classes/TweetEntities.html +128 -0
- package/docs/classes/TweetFilter.html +223 -0
- package/docs/classes/TweetListArgs.html +118 -0
- package/docs/classes/TweetService.html +319 -0
- package/docs/classes/User.html +230 -0
- package/docs/classes/UserListArgs.html +118 -0
- package/docs/classes/UserService.html +355 -0
- package/docs/enums/HttpMethods.html +74 -0
- package/docs/functions/Rettiwt.html +100 -0
- package/docs/index.html +159 -0
- package/docs/interfaces/IAuthCookie.html +104 -0
- package/docs/interfaces/ICursor.html +77 -0
- package/docs/interfaces/ICursoredData.html +93 -0
- package/docs/interfaces/IDataContext.html +91 -0
- package/docs/interfaces/IDataValidationError.html +109 -0
- package/docs/interfaces/IListArgs.html +87 -0
- package/docs/interfaces/ITweet.html +176 -0
- package/docs/interfaces/ITweetEntities.html +104 -0
- package/docs/interfaces/ITweetFilter.html +158 -0
- package/docs/interfaces/IUser.html +194 -0
- package/docs/modules.html +111 -0
- package/package.json +4 -3
- package/src/enums/Errors.ts +2 -1
- package/src/graphql/queries/RootQuery.ts +1 -1
- package/src/graphql/resolvers/TweetResolver.ts +12 -59
- package/src/graphql/resolvers/UserResolver.ts +4 -4
- package/src/graphql/types/UserTypes.ts +2 -2
- package/src/index.ts +5 -3
- package/src/models/args/TweetListArgs.ts +2 -2
- package/src/models/args/UserListArgs.ts +1 -1
- package/src/models/data/Tweet.ts +3 -3
- package/src/models/data/User.ts +2 -2
- package/src/services/data/TweetService.ts +45 -72
- package/src/services/data/UserService.ts +61 -71
- package/src/services/helper/Headers.ts +34 -34
- package/src/services/helper/Parser.ts +5 -26
- package/src/services/helper/extractors/Tweets.ts +35 -97
- package/src/services/helper/extractors/Users.ts +11 -62
- package/src/services/util/FetcherService.ts +15 -22
- package/src/types/Args.ts +0 -37
- package/Dockerfile +0 -9
- package/dist/Test.d.ts +0 -0
- package/dist/Test.js +0 -2
- package/dist/Test.js.map +0 -1
- package/dist/endpoints/Endpoints.d.ts +0 -14
- package/dist/endpoints/Endpoints.js +0 -20
- package/dist/endpoints/Endpoints.js.map +0 -1
- package/dist/endpoints/Url.d.ts +0 -5
- package/dist/endpoints/Url.js +0 -12
- package/dist/endpoints/Url.js.map +0 -1
- package/dist/enums/Endpoints.d.ts +0 -25
- package/dist/enums/Endpoints.js +0 -31
- package/dist/enums/Endpoints.js.map +0 -1
- package/dist/graphql/types/Errors.d.ts +0 -20
- package/dist/graphql/types/Errors.js +0 -28
- package/dist/graphql/types/Errors.js.map +0 -1
- package/dist/middlewares/Authentication.d.ts +0 -0
- package/dist/middlewares/Authentication.js +0 -2
- package/dist/middlewares/Authentication.js.map +0 -1
- package/dist/models/args/TweetFilter.d.ts +0 -59
- package/dist/models/args/TweetFilter.js +0 -101
- package/dist/models/args/TweetFilter.js.map +0 -1
- package/dist/models/data/DataValidationError.d.ts +0 -18
- package/dist/models/data/DataValidationError.js +0 -21
- package/dist/models/data/DataValidationError.js.map +0 -1
- package/dist/models/data/Errors.d.ts +0 -18
- package/dist/models/data/Errors.js +0 -21
- package/dist/models/data/Errors.js.map +0 -1
- package/dist/models/data/Service.d.ts +0 -33
- package/dist/models/data/Service.js +0 -41
- package/dist/models/data/Service.js.map +0 -1
- package/dist/models/errors/DataValidationError.d.ts +0 -20
- package/dist/models/errors/DataValidationError.js +0 -23
- package/dist/models/errors/DataValidationError.js.map +0 -1
- package/dist/models/graphql/Global.d.ts +0 -4
- package/dist/models/graphql/Global.js +0 -13
- package/dist/models/graphql/Global.js.map +0 -1
- package/dist/models/graphql/TweetTypes.d.ts +0 -6
- package/dist/models/graphql/TweetTypes.js +0 -156
- package/dist/models/graphql/TweetTypes.js.map +0 -1
- package/dist/models/graphql/UserTypes.d.ts +0 -3
- package/dist/models/graphql/UserTypes.js +0 -139
- package/dist/models/graphql/UserTypes.js.map +0 -1
- package/dist/models/query/Variables.d.ts +0 -2
- package/dist/models/query/Variables.js +0 -10
- package/dist/models/query/Variables.js.map +0 -1
- package/dist/queries/RootQuery.d.ts +0 -4
- package/dist/queries/RootQuery.js +0 -70
- package/dist/queries/RootQuery.js.map +0 -1
- package/dist/requests/Url.d.ts +0 -5
- package/dist/requests/Url.js +0 -12
- package/dist/requests/Url.js.map +0 -1
- package/dist/requests/payloads/Variables.d.ts +0 -23
- package/dist/requests/payloads/Variables.js +0 -24
- package/dist/requests/payloads/Variables.js.map +0 -1
- package/dist/resolvers/AccountResolver.d.ts +0 -12
- package/dist/resolvers/AccountResolver.js +0 -84
- package/dist/resolvers/AccountResolver.js.map +0 -1
- package/dist/resolvers/ResolverBase.d.ts +0 -5
- package/dist/resolvers/ResolverBase.js +0 -11
- package/dist/resolvers/ResolverBase.js.map +0 -1
- package/dist/resolvers/TweetResolver.d.ts +0 -54
- package/dist/resolvers/TweetResolver.js +0 -332
- package/dist/resolvers/TweetResolver.js.map +0 -1
- package/dist/resolvers/UserResolver.d.ts +0 -38
- package/dist/resolvers/UserResolver.js +0 -253
- package/dist/resolvers/UserResolver.js.map +0 -1
- package/dist/services/AuthService.d.ts +0 -22
- package/dist/services/AuthService.js +0 -106
- package/dist/services/AuthService.js.map +0 -1
- package/dist/services/CacheService.d.ts +0 -30
- package/dist/services/CacheService.js +0 -93
- package/dist/services/CacheService.js.map +0 -1
- package/dist/services/FetcherService.d.ts +0 -61
- package/dist/services/FetcherService.js +0 -209
- package/dist/services/FetcherService.js.map +0 -1
- package/dist/services/accounts/AccountService.d.ts +0 -65
- package/dist/services/accounts/AccountService.js +0 -336
- package/dist/services/accounts/AccountService.js.map +0 -1
- package/dist/services/accounts/LoginFlows.d.ts +0 -77
- package/dist/services/accounts/LoginFlows.js +0 -92
- package/dist/services/accounts/LoginFlows.js.map +0 -1
- package/dist/services/auth/LoginFlows.d.ts +0 -77
- package/dist/services/auth/LoginFlows.js +0 -92
- package/dist/services/auth/LoginFlows.js.map +0 -1
- package/dist/services/data/TrendService.d.ts +0 -17
- package/dist/services/data/TrendService.js +0 -116
- package/dist/services/data/TrendService.js.map +0 -1
- package/dist/services/data/UserAccountService.d.ts +0 -42
- package/dist/services/data/UserAccountService.js +0 -239
- package/dist/services/data/UserAccountService.js.map +0 -1
- package/dist/services/helper/Deserializers.d.ts +0 -19
- package/dist/services/helper/Deserializers.js +0 -115
- package/dist/services/helper/Deserializers.js.map +0 -1
- package/dist/services/helper/Extractors.d.ts +0 -104
- package/dist/services/helper/Extractors.js +0 -432
- package/dist/services/helper/Extractors.js.map +0 -1
- package/dist/services/helper/Urls.d.ts +0 -85
- package/dist/services/helper/Urls.js +0 -130
- package/dist/services/helper/Urls.js.map +0 -1
- package/dist/services/helper/deserializers/Tweets.d.ts +0 -12
- package/dist/services/helper/deserializers/Tweets.js +0 -92
- package/dist/services/helper/deserializers/Tweets.js.map +0 -1
- package/dist/services/helper/deserializers/Users.d.ts +0 -7
- package/dist/services/helper/deserializers/Users.js +0 -27
- package/dist/services/helper/deserializers/Users.js.map +0 -1
- package/dist/services/helper/extractors/Trends.d.ts +0 -3
- package/dist/services/helper/extractors/Trends.js +0 -51
- package/dist/services/helper/extractors/Trends.js.map +0 -1
- package/dist/services/helper/urls/Trends.d.ts +0 -7
- package/dist/services/helper/urls/Trends.js +0 -13
- package/dist/services/helper/urls/Trends.js.map +0 -1
- package/dist/services/helper/urls/Tweets.d.ts +0 -32
- package/dist/services/helper/urls/Tweets.js +0 -51
- package/dist/services/helper/urls/Tweets.js.map +0 -1
- package/dist/services/helper/urls/Users.d.ts +0 -38
- package/dist/services/helper/urls/Users.js +0 -76
- package/dist/services/helper/urls/Users.js.map +0 -1
- package/dist/types/HTTP.d.ts +0 -17
- package/dist/types/HTTP.js +0 -23
- package/dist/types/HTTP.js.map +0 -1
- package/dist/types/Query.d.ts +0 -80
- package/dist/types/Query.js +0 -3
- package/dist/types/Query.js.map +0 -1
- package/dist/types/Trends.d.ts +0 -50
- package/dist/types/Trends.js +0 -3
- package/dist/types/Trends.js.map +0 -1
- package/dist/types/UserAccount.d.ts +0 -19
- package/dist/types/UserAccount.js +0 -4
- package/dist/types/UserAccount.js.map +0 -1
- package/dist/types/args/TweetFilter.d.ts +0 -54
- package/dist/types/args/TweetFilter.js +0 -96
- package/dist/types/args/TweetFilter.js.map +0 -1
- package/dist/types/args/TweetListArg.d.ts +0 -10
- package/dist/types/args/TweetListArg.js +0 -42
- package/dist/types/args/TweetListArg.js.map +0 -1
- package/dist/types/args/TweetListArgs.d.ts +0 -20
- package/dist/types/args/TweetListArgs.js +0 -52
- package/dist/types/args/TweetListArgs.js.map +0 -1
- package/dist/types/args/UserListArgs.d.ts +0 -16
- package/dist/types/args/UserListArgs.js +0 -48
- package/dist/types/args/UserListArgs.js.map +0 -1
- package/dist/types/data/Errors.d.ts +0 -35
- package/dist/types/data/Errors.js +0 -45
- package/dist/types/data/Errors.js.map +0 -1
- package/dist/types/data/Service.d.ts +0 -43
- package/dist/types/data/Service.js +0 -22
- package/dist/types/data/Service.js.map +0 -1
- package/dist/types/data/Tweet.d.ts +0 -98
- package/dist/types/data/Tweet.js +0 -4
- package/dist/types/data/Tweet.js.map +0 -1
- package/dist/types/data/TweetFilter.d.ts +0 -49
- package/dist/types/data/TweetFilter.js +0 -63
- package/dist/types/data/TweetFilter.js.map +0 -1
- package/dist/types/data/User.d.ts +0 -38
- package/dist/types/data/User.js +0 -3
- package/dist/types/data/User.js.map +0 -1
- package/dist/types/graphql/Errors.d.ts +0 -15
- package/dist/types/graphql/Errors.js +0 -23
- package/dist/types/graphql/Errors.js.map +0 -1
- package/dist/types/interfaces/Args.d.ts +0 -38
- package/dist/types/interfaces/Args.js +0 -5
- package/dist/types/interfaces/Args.js.map +0 -1
- package/dist/types/interfaces/Authentication.d.ts +0 -40
- package/dist/types/interfaces/Authentication.js +0 -5
- package/dist/types/interfaces/Authentication.js.map +0 -1
- package/dist/types/interfaces/Resolvers.d.ts +0 -14
- package/dist/types/interfaces/Resolvers.js +0 -3
- package/dist/types/interfaces/Resolvers.js.map +0 -1
- package/dist/types/interfaces/Rettiwt.d.ts +0 -16
- package/dist/types/interfaces/Rettiwt.js +0 -3
- package/dist/types/interfaces/Rettiwt.js.map +0 -1
- package/dist/types/interfaces/Service.d.ts +0 -13
- package/dist/types/interfaces/Service.js +0 -3
- package/dist/types/interfaces/Service.js.map +0 -1
- package/dist/types/interfaces/Services.d.ts +0 -13
- package/dist/types/interfaces/Services.js +0 -3
- package/dist/types/interfaces/Services.js.map +0 -1
- package/dist/types/interfaces/Tweet.d.ts +0 -46
- package/dist/types/interfaces/Tweet.js +0 -3
- package/dist/types/interfaces/Tweet.js.map +0 -1
- package/dist/types/interfaces/TweetFilter.d.ts +0 -0
- package/dist/types/interfaces/TweetFilter.js +0 -2
- package/dist/types/interfaces/TweetFilter.js.map +0 -1
- package/dist/types/interfaces/User.d.ts +0 -35
- package/dist/types/interfaces/User.js +0 -3
- package/dist/types/interfaces/User.js.map +0 -1
- package/dist/types/raw/auth/Cookie.d.ts +0 -16
- package/dist/types/raw/auth/Cookie.js +0 -3
- package/dist/types/raw/auth/Cookie.js.map +0 -1
- package/dist/types/raw/data/tweet/Favouriters.d.ts +0 -164
- package/dist/types/raw/data/tweet/Favouriters.js +0 -3
- package/dist/types/raw/data/tweet/Favouriters.js.map +0 -1
- package/dist/types/raw/data/tweet/Retweeters.d.ts +0 -171
- package/dist/types/raw/data/tweet/Retweeters.js +0 -3
- package/dist/types/raw/data/tweet/Retweeters.js.map +0 -1
- package/dist/types/raw/data/tweet/Tweet.d.ts +0 -746
- package/dist/types/raw/data/tweet/Tweet.js +0 -3
- package/dist/types/raw/data/tweet/Tweet.js.map +0 -1
- package/dist/types/raw/data/tweet/Tweets.d.ts +0 -386
- package/dist/types/raw/data/tweet/Tweets.js +0 -3
- package/dist/types/raw/data/tweet/Tweets.js.map +0 -1
- package/dist/types/raw/data/user/Followers.d.ts +0 -176
- package/dist/types/raw/data/user/Followers.js +0 -3
- package/dist/types/raw/data/user/Followers.js.map +0 -1
- package/dist/types/raw/data/user/Following.d.ts +0 -176
- package/dist/types/raw/data/user/Following.js +0 -3
- package/dist/types/raw/data/user/Following.js.map +0 -1
- package/dist/types/raw/data/user/Likes.d.ts +0 -1059
- package/dist/types/raw/data/user/Likes.js +0 -3
- package/dist/types/raw/data/user/Likes.js.map +0 -1
- package/dist/types/raw/data/user/User.d.ts +0 -117
- package/dist/types/raw/data/user/User.js +0 -3
- package/dist/types/raw/data/user/User.js.map +0 -1
- package/dist/types/raw/general/Trends.d.ts +0 -324
- package/dist/types/raw/general/Trends.js +0 -3
- package/dist/types/raw/general/Trends.js.map +0 -1
- package/dist/types/raw/query/tweet/Details.d.ts +0 -80
- package/dist/types/raw/query/tweet/Details.js +0 -5
- package/dist/types/raw/query/tweet/Details.js.map +0 -1
- package/dist/types/raw/query/tweet/Engagements.d.ts +0 -29
- package/dist/types/raw/query/tweet/Engagements.js +0 -3
- package/dist/types/raw/query/tweet/Engagements.js.map +0 -1
- package/dist/types/raw/query/tweet/Likes.d.ts +0 -29
- package/dist/types/raw/query/tweet/Likes.js +0 -3
- package/dist/types/raw/query/tweet/Likes.js.map +0 -1
- package/dist/types/raw/query/tweet/Retweets.d.ts +0 -29
- package/dist/types/raw/query/tweet/Retweets.js +0 -3
- package/dist/types/raw/query/tweet/Retweets.js.map +0 -1
- package/dist/types/raw/query/tweet/Search.d.ts +0 -40
- package/dist/types/raw/query/tweet/Search.js +0 -3
- package/dist/types/raw/query/tweet/Search.js.map +0 -1
- package/dist/types/raw/query/tweet/TweetDetails.d.ts +0 -34
- package/dist/types/raw/query/tweet/TweetDetails.js +0 -5
- package/dist/types/raw/query/tweet/TweetDetails.js.map +0 -1
- package/dist/types/raw/query/tweet/TweetLike.d.ts +0 -29
- package/dist/types/raw/query/tweet/TweetLike.js +0 -3
- package/dist/types/raw/query/tweet/TweetLike.js.map +0 -1
- package/dist/types/raw/query/tweet/TweetLikes.d.ts +0 -29
- package/dist/types/raw/query/tweet/TweetLikes.js +0 -3
- package/dist/types/raw/query/tweet/TweetLikes.js.map +0 -1
- package/dist/types/raw/query/tweet/TweetRetweets.d.ts +0 -0
- package/dist/types/raw/query/tweet/TweetRetweets.js +0 -2
- package/dist/types/raw/query/tweet/TweetRetweets.js.map +0 -1
- package/dist/types/raw/query/user/Details.d.ts +0 -34
- package/dist/types/raw/query/user/Details.js +0 -3
- package/dist/types/raw/query/user/Details.js.map +0 -1
- package/dist/types/raw/tweet/Favouriters.d.ts +0 -164
- package/dist/types/raw/tweet/Favouriters.js +0 -3
- package/dist/types/raw/tweet/Favouriters.js.map +0 -1
- package/dist/types/raw/tweet/Retweeters.d.ts +0 -171
- package/dist/types/raw/tweet/Retweeters.js +0 -3
- package/dist/types/raw/tweet/Retweeters.js.map +0 -1
- package/dist/types/raw/tweet/Tweet.d.ts +0 -746
- package/dist/types/raw/tweet/Tweet.js +0 -3
- package/dist/types/raw/tweet/Tweet.js.map +0 -1
- package/dist/types/raw/tweet/Tweets.d.ts +0 -386
- package/dist/types/raw/tweet/Tweets.js +0 -3
- package/dist/types/raw/tweet/Tweets.js.map +0 -1
- package/dist/types/raw/user/Followers.d.ts +0 -176
- package/dist/types/raw/user/Followers.js +0 -3
- package/dist/types/raw/user/Followers.js.map +0 -1
- package/dist/types/raw/user/Following.d.ts +0 -176
- package/dist/types/raw/user/Following.js +0 -3
- package/dist/types/raw/user/Following.js.map +0 -1
- package/dist/types/raw/user/Likes.d.ts +0 -1059
- package/dist/types/raw/user/Likes.js +0 -3
- package/dist/types/raw/user/Likes.js.map +0 -1
- package/dist/types/raw/user/Tweets.d.ts +0 -1512
- package/dist/types/raw/user/Tweets.js +0 -3
- package/dist/types/raw/user/Tweets.js.map +0 -1
- package/dist/types/raw/user/User.d.ts +0 -117
- package/dist/types/raw/user/User.js +0 -3
- package/dist/types/raw/user/User.js.map +0 -1
- package/dist/types/services/args/TweetFilter.d.ts +0 -50
- package/dist/types/services/args/TweetFilter.js +0 -76
- package/dist/types/services/args/TweetFilter.js.map +0 -1
- package/src/models/args/TweetFilter.ts +0 -119
- package/src/models/errors/DataValidationError.ts +0 -29
- package/src/services/helper/urls/Tweets.ts +0 -46
- package/src/services/helper/urls/Users.ts +0 -78
- package/src/types/raw/tweet/Favouriters.ts +0 -193
- package/src/types/raw/tweet/Retweeters.ts +0 -201
- package/src/types/raw/tweet/Tweet.ts +0 -882
- package/src/types/raw/tweet/Tweets.ts +0 -444
- package/src/types/raw/user/Followers.ts +0 -208
- package/src/types/raw/user/Following.ts +0 -208
- package/src/types/raw/user/Likes.ts +0 -1247
- package/src/types/raw/user/Tweets.ts +0 -1747
- package/src/types/raw/user/User.ts +0 -135
|
@@ -1,334 +1,334 @@
|
|
|
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 CursoredData_1 = require("../../models/data/CursoredData");
|
|
60
|
-
var Errors_1 = require("../enums/Errors");
|
|
61
|
-
var UserResolver = /** @class */ (function (_super) {
|
|
62
|
-
__extends(UserResolver, _super);
|
|
63
|
-
// MEMBER METHODS
|
|
64
|
-
function UserResolver(context) {
|
|
65
|
-
var _this = _super.call(this, context) || this;
|
|
66
|
-
_this.batchSize = 40;
|
|
67
|
-
return _this;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* @returns The details of the target twitter user
|
|
71
|
-
* @param userName The user name of the target twitter user
|
|
72
|
-
* @param id The id/username of the target twitter user
|
|
73
|
-
*/
|
|
74
|
-
UserResolver.prototype.resolveUserDetails = function (id) {
|
|
75
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
76
|
-
var _this = this;
|
|
77
|
-
return __generator(this, function (_a) {
|
|
78
|
-
switch (_a.label) {
|
|
79
|
-
case 0: return [4 /*yield*/, this.context.users.getUserDetails(id)["catch"](function (error) {
|
|
80
|
-
throw _this.getGraphQLError(error);
|
|
81
|
-
})];
|
|
82
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
/**
|
|
88
|
-
* @returns The list of tweets made by the given user
|
|
89
|
-
* @param
|
|
90
|
-
* @param count The number of tweets to fetch, must be >=
|
|
91
|
-
* @param all Whether to fetch list of all tweets made by user
|
|
92
|
-
* @param cursor The cursor to the batch of tweets to fetch
|
|
93
|
-
* @param statusesCount The total number of tweets made by target user
|
|
94
|
-
*/
|
|
95
|
-
UserResolver.prototype.resolveUserTweets = function (
|
|
96
|
-
var _a;
|
|
97
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
98
|
-
var likes, next, total, res;
|
|
99
|
-
var _this = this;
|
|
100
|
-
return __generator(this, function (_b) {
|
|
101
|
-
switch (_b.label) {
|
|
102
|
-
case 0:
|
|
103
|
-
likes = [];
|
|
104
|
-
next = new CursoredData_1.Cursor(cursor);
|
|
105
|
-
total = 0;
|
|
106
|
-
// If all tweets are to be fetched
|
|
107
|
-
count = all ? statusesCount : count;
|
|
108
|
-
// If required count less than batch size, setting batch size to required count
|
|
109
|
-
this.batchSize = (count < this.batchSize) ? count : this.batchSize;
|
|
110
|
-
_b.label = 1;
|
|
111
|
-
case 1:
|
|
112
|
-
// If this is the last batch, change batch size to number of remaining tweets
|
|
113
|
-
this.batchSize = ((count - total) < this.batchSize) ? (count - total) : this.batchSize;
|
|
114
|
-
return [4 /*yield*/, this.context.
|
|
115
|
-
throw _this.getGraphQLError(error);
|
|
116
|
-
})];
|
|
117
|
-
case 2:
|
|
118
|
-
res = _b.sent();
|
|
119
|
-
// If data is available
|
|
120
|
-
if ((_a = res.list) === null || _a === void 0 ? void 0 : _a.length) {
|
|
121
|
-
// Adding fetched tweets to list of tweets
|
|
122
|
-
likes = likes.concat(res.list);
|
|
123
|
-
// Updating total tweets fetched
|
|
124
|
-
total = likes.length;
|
|
125
|
-
// Getting cursor to next batch
|
|
126
|
-
next = res.next;
|
|
127
|
-
}
|
|
128
|
-
// If no more data is available
|
|
129
|
-
else {
|
|
130
|
-
return [3 /*break*/, 4];
|
|
131
|
-
}
|
|
132
|
-
_b.label = 3;
|
|
133
|
-
case 3:
|
|
134
|
-
if (total < count) return [3 /*break*/, 1];
|
|
135
|
-
_b.label = 4;
|
|
136
|
-
case 4:
|
|
137
|
-
// If no likes found
|
|
138
|
-
if (!likes.length) {
|
|
139
|
-
return [2 /*return*/, new Error(Errors_1.DataErrors.NoUserTweetsFound)];
|
|
140
|
-
}
|
|
141
|
-
// Adding the cursor to the end of list of data
|
|
142
|
-
likes.push(next);
|
|
143
|
-
return [2 /*return*/, likes];
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
};
|
|
148
|
-
/**
|
|
149
|
-
* @returns The list of tweets liked by the given user
|
|
150
|
-
* @param id The id of the user whose likes are to be fetched
|
|
151
|
-
* @param count The number of likes to fetch, must be >= 40
|
|
152
|
-
* @param all Whether to fetch list of all tweets liked by user
|
|
153
|
-
* @param cursor The cursor to the batch of likes to fetch
|
|
154
|
-
* @param favouritesCount The total number of tweets liked by target user
|
|
155
|
-
*/
|
|
156
|
-
UserResolver.prototype.resolveUserLikes = function (id, count, all, cursor, favouritesCount) {
|
|
157
|
-
var _a;
|
|
158
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
159
|
-
var likes, next, total, res;
|
|
160
|
-
var _this = this;
|
|
161
|
-
return __generator(this, function (_b) {
|
|
162
|
-
switch (_b.label) {
|
|
163
|
-
case 0:
|
|
164
|
-
likes = [];
|
|
165
|
-
next = new CursoredData_1.Cursor(cursor);
|
|
166
|
-
total = 0;
|
|
167
|
-
// If all liked tweets are to be fetched
|
|
168
|
-
count = all ? favouritesCount : count;
|
|
169
|
-
// If required count less than batch size, setting batch size to required count
|
|
170
|
-
this.batchSize = (count < this.batchSize) ? count : this.batchSize;
|
|
171
|
-
_b.label = 1;
|
|
172
|
-
case 1:
|
|
173
|
-
// If this is the last batch, change batch size to number of remaining tweets
|
|
174
|
-
this.batchSize = ((count - total) < this.batchSize) ? (count - total) : this.batchSize;
|
|
175
|
-
return [4 /*yield*/, this.context.users.getUserLikes(id, this.batchSize, next.value)["catch"](function (error) {
|
|
176
|
-
throw _this.getGraphQLError(error);
|
|
177
|
-
})];
|
|
178
|
-
case 2:
|
|
179
|
-
res = _b.sent();
|
|
180
|
-
// If data is available
|
|
181
|
-
if ((_a = res.list) === null || _a === void 0 ? void 0 : _a.length) {
|
|
182
|
-
// Adding fetched tweets to list of tweets
|
|
183
|
-
likes = likes.concat(res.list);
|
|
184
|
-
// Updating total tweets fetched
|
|
185
|
-
total = likes.length;
|
|
186
|
-
// Getting cursor to next batch
|
|
187
|
-
next = res.next;
|
|
188
|
-
}
|
|
189
|
-
// If no more data is available
|
|
190
|
-
else {
|
|
191
|
-
return [3 /*break*/, 4];
|
|
192
|
-
}
|
|
193
|
-
_b.label = 3;
|
|
194
|
-
case 3:
|
|
195
|
-
if (total < count) return [3 /*break*/, 1];
|
|
196
|
-
_b.label = 4;
|
|
197
|
-
case 4:
|
|
198
|
-
// If no likes found
|
|
199
|
-
if (!likes.length) {
|
|
200
|
-
return [2 /*return*/, new Error(Errors_1.DataErrors.NoLikedTweetsFound)];
|
|
201
|
-
}
|
|
202
|
-
// Adding the cursor to the end of list of data
|
|
203
|
-
likes.push(next);
|
|
204
|
-
return [2 /*return*/, likes];
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
});
|
|
208
|
-
};
|
|
209
|
-
/**
|
|
210
|
-
* @returns The list of followers of the given twiiter user
|
|
211
|
-
* @param id The id of the user whose followers are to be fetched
|
|
212
|
-
* @param count The number of followers to fetch, must be >= 40 when no cursor is provided
|
|
213
|
-
* @param all Whether to fetch all followers list
|
|
214
|
-
* @param cursor The cursor to the batch of followers to fetch
|
|
215
|
-
* @param followerCount The total number of followers of the target user
|
|
216
|
-
*/
|
|
217
|
-
UserResolver.prototype.resolveUserFollowers = function (id, count, all, cursor, followersCount) {
|
|
218
|
-
var _a;
|
|
219
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
220
|
-
var followers, next, total, res;
|
|
221
|
-
var _this = this;
|
|
222
|
-
return __generator(this, function (_b) {
|
|
223
|
-
switch (_b.label) {
|
|
224
|
-
case 0:
|
|
225
|
-
followers = [];
|
|
226
|
-
next = new CursoredData_1.Cursor(cursor);
|
|
227
|
-
total = 0;
|
|
228
|
-
// If all followers are to be fetched
|
|
229
|
-
count = all ? followersCount : count;
|
|
230
|
-
// If required count less than batch size, setting batch size to required count
|
|
231
|
-
this.batchSize = (count < this.batchSize) ? count : this.batchSize;
|
|
232
|
-
_b.label = 1;
|
|
233
|
-
case 1:
|
|
234
|
-
// If this is the last batch, change batch size to number of remaining followers
|
|
235
|
-
this.batchSize = ((count - total) < this.batchSize) ? (count - total) : this.batchSize;
|
|
236
|
-
return [4 /*yield*/, this.context.users.getUserFollowers(id, this.batchSize, next.value)["catch"](function (error) {
|
|
237
|
-
throw _this.getGraphQLError(error);
|
|
238
|
-
})];
|
|
239
|
-
case 2:
|
|
240
|
-
res = _b.sent();
|
|
241
|
-
// If data is available
|
|
242
|
-
if ((_a = res.list) === null || _a === void 0 ? void 0 : _a.length) {
|
|
243
|
-
// Adding fetched followers to list of followers
|
|
244
|
-
followers = followers.concat(res.list);
|
|
245
|
-
// Updating total followers fetched
|
|
246
|
-
total = followers.length;
|
|
247
|
-
// Getting cursor to next batch
|
|
248
|
-
next = res.next;
|
|
249
|
-
}
|
|
250
|
-
// If no more data is available
|
|
251
|
-
else {
|
|
252
|
-
return [3 /*break*/, 4];
|
|
253
|
-
}
|
|
254
|
-
_b.label = 3;
|
|
255
|
-
case 3:
|
|
256
|
-
if (total < count) return [3 /*break*/, 1];
|
|
257
|
-
_b.label = 4;
|
|
258
|
-
case 4:
|
|
259
|
-
// If no followers found
|
|
260
|
-
if (!followers.length) {
|
|
261
|
-
return [2 /*return*/, new Error(Errors_1.DataErrors.NoFollowsFound)];
|
|
262
|
-
}
|
|
263
|
-
// Adding the cursor to the end of list of data
|
|
264
|
-
followers.push(next);
|
|
265
|
-
return [2 /*return*/, followers];
|
|
266
|
-
}
|
|
267
|
-
});
|
|
268
|
-
});
|
|
269
|
-
};
|
|
270
|
-
/**
|
|
271
|
-
* @returns The list of following of the given twiiter user
|
|
272
|
-
* @param id The id of the user whose followings are to be fetched
|
|
273
|
-
* @param count The number of following to fetch, should be >= 40 when no cursor is provided
|
|
274
|
-
* @param all Whether to fetch list of all followings
|
|
275
|
-
* @param cursor The cursor to the batch of followings to fetch
|
|
276
|
-
* @param followingsCount The total number of followings of the target user
|
|
277
|
-
*/
|
|
278
|
-
UserResolver.prototype.resolveUserFollowing = function (id, count, all, cursor, followingsCount) {
|
|
279
|
-
var _a;
|
|
280
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
281
|
-
var following, next, total, res;
|
|
282
|
-
var _this = this;
|
|
283
|
-
return __generator(this, function (_b) {
|
|
284
|
-
switch (_b.label) {
|
|
285
|
-
case 0:
|
|
286
|
-
following = [];
|
|
287
|
-
next = new CursoredData_1.Cursor(cursor);
|
|
288
|
-
total = 0;
|
|
289
|
-
// If all followings are to be fetched
|
|
290
|
-
count = all ? followingsCount : count;
|
|
291
|
-
// If required count less than batch size, setting batch size to required count
|
|
292
|
-
this.batchSize = (count < this.batchSize) ? count : this.batchSize;
|
|
293
|
-
_b.label = 1;
|
|
294
|
-
case 1:
|
|
295
|
-
// If this is the last batch, change batch size to number of remaining following
|
|
296
|
-
this.batchSize = ((count - total) < this.batchSize) ? (count - total) : this.batchSize;
|
|
297
|
-
return [4 /*yield*/, this.context.users.getUserFollowing(id, this.batchSize, next.value)["catch"](function (error) {
|
|
298
|
-
throw _this.getGraphQLError(error);
|
|
299
|
-
})];
|
|
300
|
-
case 2:
|
|
301
|
-
res = _b.sent();
|
|
302
|
-
// If data is available
|
|
303
|
-
if ((_a = res.list) === null || _a === void 0 ? void 0 : _a.length) {
|
|
304
|
-
// Adding fetched following to list of following
|
|
305
|
-
following = following.concat(res.list);
|
|
306
|
-
// Updating total following fetched
|
|
307
|
-
total = following.length;
|
|
308
|
-
// Getting cursor to next batch
|
|
309
|
-
next = res.next;
|
|
310
|
-
}
|
|
311
|
-
// If no more data is available
|
|
312
|
-
else {
|
|
313
|
-
return [3 /*break*/, 4];
|
|
314
|
-
}
|
|
315
|
-
_b.label = 3;
|
|
316
|
-
case 3:
|
|
317
|
-
if (total < count) return [3 /*break*/, 1];
|
|
318
|
-
_b.label = 4;
|
|
319
|
-
case 4:
|
|
320
|
-
// If no following found
|
|
321
|
-
if (!following.length) {
|
|
322
|
-
return [2 /*return*/, new Error(Errors_1.DataErrors.NoFollowsFound)];
|
|
323
|
-
}
|
|
324
|
-
// Adding the cursor to the end of list of data
|
|
325
|
-
following.push(next);
|
|
326
|
-
return [2 /*return*/, following];
|
|
327
|
-
}
|
|
328
|
-
});
|
|
329
|
-
});
|
|
330
|
-
};
|
|
331
|
-
return UserResolver;
|
|
332
|
-
}(ResolverBase_1["default"]));
|
|
333
|
-
exports["default"] = UserResolver;
|
|
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 CursoredData_1 = require("../../models/data/CursoredData");
|
|
60
|
+
var Errors_1 = require("../enums/Errors");
|
|
61
|
+
var UserResolver = /** @class */ (function (_super) {
|
|
62
|
+
__extends(UserResolver, _super);
|
|
63
|
+
// MEMBER METHODS
|
|
64
|
+
function UserResolver(context) {
|
|
65
|
+
var _this = _super.call(this, context) || this;
|
|
66
|
+
_this.batchSize = 40;
|
|
67
|
+
return _this;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* @returns The details of the target twitter user
|
|
71
|
+
* @param userName The user name of the target twitter user
|
|
72
|
+
* @param id The id/username of the target twitter user
|
|
73
|
+
*/
|
|
74
|
+
UserResolver.prototype.resolveUserDetails = function (id) {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
76
|
+
var _this = this;
|
|
77
|
+
return __generator(this, function (_a) {
|
|
78
|
+
switch (_a.label) {
|
|
79
|
+
case 0: return [4 /*yield*/, this.context.users.getUserDetails(id)["catch"](function (error) {
|
|
80
|
+
throw _this.getGraphQLError(error);
|
|
81
|
+
})];
|
|
82
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* @returns The list of tweets made by the given user
|
|
89
|
+
* @param userName The username of the user whose tweets are to be fetched
|
|
90
|
+
* @param count The number of tweets to fetch, must be >= 10
|
|
91
|
+
* @param all Whether to fetch list of all tweets made by user
|
|
92
|
+
* @param cursor The cursor to the batch of tweets to fetch
|
|
93
|
+
* @param statusesCount The total number of tweets made by target user
|
|
94
|
+
*/
|
|
95
|
+
UserResolver.prototype.resolveUserTweets = function (userName, count, all, cursor, statusesCount) {
|
|
96
|
+
var _a;
|
|
97
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
98
|
+
var likes, next, total, res;
|
|
99
|
+
var _this = this;
|
|
100
|
+
return __generator(this, function (_b) {
|
|
101
|
+
switch (_b.label) {
|
|
102
|
+
case 0:
|
|
103
|
+
likes = [];
|
|
104
|
+
next = new CursoredData_1.Cursor(cursor);
|
|
105
|
+
total = 0;
|
|
106
|
+
// If all tweets are to be fetched
|
|
107
|
+
count = all ? statusesCount : count;
|
|
108
|
+
// If required count less than batch size, setting batch size to required count
|
|
109
|
+
this.batchSize = (count < this.batchSize) ? count : this.batchSize;
|
|
110
|
+
_b.label = 1;
|
|
111
|
+
case 1:
|
|
112
|
+
// If this is the last batch, change batch size to number of remaining tweets
|
|
113
|
+
this.batchSize = ((count - total) < this.batchSize) ? (count - total) : this.batchSize;
|
|
114
|
+
return [4 /*yield*/, this.context.tweets.getTweets({ fromUsers: [userName] }, this.batchSize, next.value)["catch"](function (error) {
|
|
115
|
+
throw _this.getGraphQLError(error);
|
|
116
|
+
})];
|
|
117
|
+
case 2:
|
|
118
|
+
res = _b.sent();
|
|
119
|
+
// If data is available
|
|
120
|
+
if ((_a = res.list) === null || _a === void 0 ? void 0 : _a.length) {
|
|
121
|
+
// Adding fetched tweets to list of tweets
|
|
122
|
+
likes = likes.concat(res.list);
|
|
123
|
+
// Updating total tweets fetched
|
|
124
|
+
total = likes.length;
|
|
125
|
+
// Getting cursor to next batch
|
|
126
|
+
next = res.next;
|
|
127
|
+
}
|
|
128
|
+
// If no more data is available
|
|
129
|
+
else {
|
|
130
|
+
return [3 /*break*/, 4];
|
|
131
|
+
}
|
|
132
|
+
_b.label = 3;
|
|
133
|
+
case 3:
|
|
134
|
+
if (total < count) return [3 /*break*/, 1];
|
|
135
|
+
_b.label = 4;
|
|
136
|
+
case 4:
|
|
137
|
+
// If no likes found
|
|
138
|
+
if (!likes.length) {
|
|
139
|
+
return [2 /*return*/, new Error(Errors_1.DataErrors.NoUserTweetsFound)];
|
|
140
|
+
}
|
|
141
|
+
// Adding the cursor to the end of list of data
|
|
142
|
+
likes.push(next);
|
|
143
|
+
return [2 /*return*/, likes];
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* @returns The list of tweets liked by the given user
|
|
150
|
+
* @param id The id of the user whose likes are to be fetched
|
|
151
|
+
* @param count The number of likes to fetch, must be >= 40
|
|
152
|
+
* @param all Whether to fetch list of all tweets liked by user
|
|
153
|
+
* @param cursor The cursor to the batch of likes to fetch
|
|
154
|
+
* @param favouritesCount The total number of tweets liked by target user
|
|
155
|
+
*/
|
|
156
|
+
UserResolver.prototype.resolveUserLikes = function (id, count, all, cursor, favouritesCount) {
|
|
157
|
+
var _a;
|
|
158
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
159
|
+
var likes, next, total, res;
|
|
160
|
+
var _this = this;
|
|
161
|
+
return __generator(this, function (_b) {
|
|
162
|
+
switch (_b.label) {
|
|
163
|
+
case 0:
|
|
164
|
+
likes = [];
|
|
165
|
+
next = new CursoredData_1.Cursor(cursor);
|
|
166
|
+
total = 0;
|
|
167
|
+
// If all liked tweets are to be fetched
|
|
168
|
+
count = all ? favouritesCount : count;
|
|
169
|
+
// If required count less than batch size, setting batch size to required count
|
|
170
|
+
this.batchSize = (count < this.batchSize) ? count : this.batchSize;
|
|
171
|
+
_b.label = 1;
|
|
172
|
+
case 1:
|
|
173
|
+
// If this is the last batch, change batch size to number of remaining tweets
|
|
174
|
+
this.batchSize = ((count - total) < this.batchSize) ? (count - total) : this.batchSize;
|
|
175
|
+
return [4 /*yield*/, this.context.users.getUserLikes(id, this.batchSize, next.value)["catch"](function (error) {
|
|
176
|
+
throw _this.getGraphQLError(error);
|
|
177
|
+
})];
|
|
178
|
+
case 2:
|
|
179
|
+
res = _b.sent();
|
|
180
|
+
// If data is available
|
|
181
|
+
if ((_a = res.list) === null || _a === void 0 ? void 0 : _a.length) {
|
|
182
|
+
// Adding fetched tweets to list of tweets
|
|
183
|
+
likes = likes.concat(res.list);
|
|
184
|
+
// Updating total tweets fetched
|
|
185
|
+
total = likes.length;
|
|
186
|
+
// Getting cursor to next batch
|
|
187
|
+
next = res.next;
|
|
188
|
+
}
|
|
189
|
+
// If no more data is available
|
|
190
|
+
else {
|
|
191
|
+
return [3 /*break*/, 4];
|
|
192
|
+
}
|
|
193
|
+
_b.label = 3;
|
|
194
|
+
case 3:
|
|
195
|
+
if (total < count) return [3 /*break*/, 1];
|
|
196
|
+
_b.label = 4;
|
|
197
|
+
case 4:
|
|
198
|
+
// If no likes found
|
|
199
|
+
if (!likes.length) {
|
|
200
|
+
return [2 /*return*/, new Error(Errors_1.DataErrors.NoLikedTweetsFound)];
|
|
201
|
+
}
|
|
202
|
+
// Adding the cursor to the end of list of data
|
|
203
|
+
likes.push(next);
|
|
204
|
+
return [2 /*return*/, likes];
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* @returns The list of followers of the given twiiter user
|
|
211
|
+
* @param id The id of the user whose followers are to be fetched
|
|
212
|
+
* @param count The number of followers to fetch, must be >= 40 when no cursor is provided
|
|
213
|
+
* @param all Whether to fetch all followers list
|
|
214
|
+
* @param cursor The cursor to the batch of followers to fetch
|
|
215
|
+
* @param followerCount The total number of followers of the target user
|
|
216
|
+
*/
|
|
217
|
+
UserResolver.prototype.resolveUserFollowers = function (id, count, all, cursor, followersCount) {
|
|
218
|
+
var _a;
|
|
219
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
220
|
+
var followers, next, total, res;
|
|
221
|
+
var _this = this;
|
|
222
|
+
return __generator(this, function (_b) {
|
|
223
|
+
switch (_b.label) {
|
|
224
|
+
case 0:
|
|
225
|
+
followers = [];
|
|
226
|
+
next = new CursoredData_1.Cursor(cursor);
|
|
227
|
+
total = 0;
|
|
228
|
+
// If all followers are to be fetched
|
|
229
|
+
count = all ? followersCount : count;
|
|
230
|
+
// If required count less than batch size, setting batch size to required count
|
|
231
|
+
this.batchSize = (count < this.batchSize) ? count : this.batchSize;
|
|
232
|
+
_b.label = 1;
|
|
233
|
+
case 1:
|
|
234
|
+
// If this is the last batch, change batch size to number of remaining followers
|
|
235
|
+
this.batchSize = ((count - total) < this.batchSize) ? (count - total) : this.batchSize;
|
|
236
|
+
return [4 /*yield*/, this.context.users.getUserFollowers(id, this.batchSize, next.value)["catch"](function (error) {
|
|
237
|
+
throw _this.getGraphQLError(error);
|
|
238
|
+
})];
|
|
239
|
+
case 2:
|
|
240
|
+
res = _b.sent();
|
|
241
|
+
// If data is available
|
|
242
|
+
if ((_a = res.list) === null || _a === void 0 ? void 0 : _a.length) {
|
|
243
|
+
// Adding fetched followers to list of followers
|
|
244
|
+
followers = followers.concat(res.list);
|
|
245
|
+
// Updating total followers fetched
|
|
246
|
+
total = followers.length;
|
|
247
|
+
// Getting cursor to next batch
|
|
248
|
+
next = res.next;
|
|
249
|
+
}
|
|
250
|
+
// If no more data is available
|
|
251
|
+
else {
|
|
252
|
+
return [3 /*break*/, 4];
|
|
253
|
+
}
|
|
254
|
+
_b.label = 3;
|
|
255
|
+
case 3:
|
|
256
|
+
if (total < count) return [3 /*break*/, 1];
|
|
257
|
+
_b.label = 4;
|
|
258
|
+
case 4:
|
|
259
|
+
// If no followers found
|
|
260
|
+
if (!followers.length) {
|
|
261
|
+
return [2 /*return*/, new Error(Errors_1.DataErrors.NoFollowsFound)];
|
|
262
|
+
}
|
|
263
|
+
// Adding the cursor to the end of list of data
|
|
264
|
+
followers.push(next);
|
|
265
|
+
return [2 /*return*/, followers];
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
};
|
|
270
|
+
/**
|
|
271
|
+
* @returns The list of following of the given twiiter user
|
|
272
|
+
* @param id The id of the user whose followings are to be fetched
|
|
273
|
+
* @param count The number of following to fetch, should be >= 40 when no cursor is provided
|
|
274
|
+
* @param all Whether to fetch list of all followings
|
|
275
|
+
* @param cursor The cursor to the batch of followings to fetch
|
|
276
|
+
* @param followingsCount The total number of followings of the target user
|
|
277
|
+
*/
|
|
278
|
+
UserResolver.prototype.resolveUserFollowing = function (id, count, all, cursor, followingsCount) {
|
|
279
|
+
var _a;
|
|
280
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
281
|
+
var following, next, total, res;
|
|
282
|
+
var _this = this;
|
|
283
|
+
return __generator(this, function (_b) {
|
|
284
|
+
switch (_b.label) {
|
|
285
|
+
case 0:
|
|
286
|
+
following = [];
|
|
287
|
+
next = new CursoredData_1.Cursor(cursor);
|
|
288
|
+
total = 0;
|
|
289
|
+
// If all followings are to be fetched
|
|
290
|
+
count = all ? followingsCount : count;
|
|
291
|
+
// If required count less than batch size, setting batch size to required count
|
|
292
|
+
this.batchSize = (count < this.batchSize) ? count : this.batchSize;
|
|
293
|
+
_b.label = 1;
|
|
294
|
+
case 1:
|
|
295
|
+
// If this is the last batch, change batch size to number of remaining following
|
|
296
|
+
this.batchSize = ((count - total) < this.batchSize) ? (count - total) : this.batchSize;
|
|
297
|
+
return [4 /*yield*/, this.context.users.getUserFollowing(id, this.batchSize, next.value)["catch"](function (error) {
|
|
298
|
+
throw _this.getGraphQLError(error);
|
|
299
|
+
})];
|
|
300
|
+
case 2:
|
|
301
|
+
res = _b.sent();
|
|
302
|
+
// If data is available
|
|
303
|
+
if ((_a = res.list) === null || _a === void 0 ? void 0 : _a.length) {
|
|
304
|
+
// Adding fetched following to list of following
|
|
305
|
+
following = following.concat(res.list);
|
|
306
|
+
// Updating total following fetched
|
|
307
|
+
total = following.length;
|
|
308
|
+
// Getting cursor to next batch
|
|
309
|
+
next = res.next;
|
|
310
|
+
}
|
|
311
|
+
// If no more data is available
|
|
312
|
+
else {
|
|
313
|
+
return [3 /*break*/, 4];
|
|
314
|
+
}
|
|
315
|
+
_b.label = 3;
|
|
316
|
+
case 3:
|
|
317
|
+
if (total < count) return [3 /*break*/, 1];
|
|
318
|
+
_b.label = 4;
|
|
319
|
+
case 4:
|
|
320
|
+
// If no following found
|
|
321
|
+
if (!following.length) {
|
|
322
|
+
return [2 /*return*/, new Error(Errors_1.DataErrors.NoFollowsFound)];
|
|
323
|
+
}
|
|
324
|
+
// Adding the cursor to the end of list of data
|
|
325
|
+
following.push(next);
|
|
326
|
+
return [2 /*return*/, following];
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
});
|
|
330
|
+
};
|
|
331
|
+
return UserResolver;
|
|
332
|
+
}(ResolverBase_1["default"]));
|
|
333
|
+
exports["default"] = UserResolver;
|
|
334
334
|
//# sourceMappingURL=UserResolver.js.map
|