rettiwt-api 1.1.8 → 1.2.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 +20 -20
- package/dist/enums/Errors.js +27 -27
- 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/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/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 +43 -43
- package/dist/index.js +70 -70
- package/dist/models/args/TweetFilter.d.ts +65 -59
- package/dist/models/args/TweetFilter.js +120 -100
- package/dist/models/args/TweetFilter.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/UserListArgs.d.ts +21 -21
- package/dist/models/args/UserListArgs.js +53 -53
- 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/User.d.ts +41 -41
- package/dist/models/data/User.js +31 -31
- package/dist/models/errors/DataValidationError.d.ts +20 -20
- package/dist/models/errors/DataValidationError.js +22 -22
- 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 +251 -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 +287 -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/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 +32 -32
- package/dist/services/helper/extractors/Tweets.js +263 -263
- package/dist/services/helper/extractors/Users.d.ts +26 -26
- package/dist/services/helper/extractors/Users.js +202 -202
- 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 +213 -213
- package/dist/twitter/Url.d.ts +22 -0
- package/dist/twitter/Url.js +32 -0
- package/dist/twitter/Url.js.map +1 -0
- package/dist/twitter/enums/Resources.d.ts +15 -0
- package/dist/twitter/enums/Resources.js +21 -0
- package/dist/twitter/enums/Resources.js.map +1 -0
- package/dist/twitter/params/Query.d.ts +67 -0
- package/dist/twitter/params/Query.js +64 -0
- package/dist/twitter/params/Query.js.map +1 -0
- package/dist/twitter/payloads/Args.d.ts +16 -0
- package/dist/twitter/payloads/Args.js +16 -0
- package/dist/twitter/payloads/Args.js.map +1 -0
- package/dist/{types/raw/query/tweet/Engagements.d.ts → twitter/payloads/Features.d.ts} +28 -29
- package/dist/twitter/payloads/Features.js +37 -0
- package/dist/twitter/payloads/Features.js.map +1 -0
- package/dist/twitter/payloads/Variables.d.ts +41 -0
- package/dist/twitter/payloads/Variables.js +64 -0
- package/dist/twitter/payloads/Variables.js.map +1 -0
- package/dist/{types → twitter/types/request}/Query.d.ts +86 -80
- package/dist/{types/data/Tweet.js → twitter/types/request/Query.js} +4 -4
- package/dist/twitter/types/request/Query.js.map +1 -0
- package/dist/{types/raw/data → twitter/types}/tweet/Favouriters.d.ts +164 -164
- package/dist/twitter/types/tweet/Favouriters.js +3 -0
- package/dist/twitter/types/tweet/Favouriters.js.map +1 -0
- package/dist/{types/raw → twitter/types}/tweet/Retweeters.d.ts +171 -171
- package/dist/{types/Trends.js → twitter/types/tweet/Retweeters.js} +3 -3
- package/dist/twitter/types/tweet/Retweeters.js.map +1 -0
- package/dist/{types/raw/data → twitter/types}/tweet/Tweet.d.ts +746 -746
- package/dist/{types/data/User.js → twitter/types/tweet/Tweet.js} +3 -3
- package/dist/twitter/types/tweet/Tweet.js.map +1 -0
- package/dist/{types/raw → twitter/types}/tweet/Tweets.d.ts +386 -386
- package/dist/{types/raw/user/User.js → twitter/types/tweet/Tweets.js} +3 -3
- package/dist/twitter/types/tweet/Tweets.js.map +1 -0
- package/dist/{types/raw → twitter/types}/user/Followers.d.ts +176 -176
- package/dist/{types/interfaces/Rettiwt.js → twitter/types/user/Followers.js} +3 -3
- package/dist/twitter/types/user/Followers.js.map +1 -0
- package/dist/{types/raw → twitter/types}/user/Following.d.ts +176 -176
- package/dist/{types/Query.js → twitter/types/user/Following.js} +3 -3
- package/dist/twitter/types/user/Following.js.map +1 -0
- package/dist/{types/raw/data → twitter/types}/user/Likes.d.ts +1059 -1059
- package/dist/{types/interfaces/User.js → twitter/types/user/Likes.js} +3 -3
- package/dist/twitter/types/user/Likes.js.map +1 -0
- package/dist/{types/raw → twitter/types}/user/Tweets.d.ts +1512 -1512
- package/dist/twitter/types/user/Tweets.js +3 -0
- package/dist/twitter/types/user/Tweets.js.map +1 -0
- package/dist/{types/raw → twitter/types}/user/User.d.ts +117 -117
- package/dist/{types/raw/data → twitter/types}/user/User.js +2 -2
- package/dist/{types/data → twitter/types/user}/User.js.map +1 -1
- package/dist/types/Args.d.ts +38 -38
- package/dist/types/Args.js +4 -4
- 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 +119 -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 +221 -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 +99 -0
- package/docs/index.html +158 -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/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 +109 -0
- package/package.json +2 -2
- package/src/graphql/resolvers/UserResolver.ts +4 -4
- package/src/graphql/types/UserTypes.ts +1 -1
- package/src/models/args/TweetFilter.ts +25 -4
- package/src/models/data/Tweet.ts +1 -1
- package/src/models/data/User.ts +1 -1
- package/src/services/data/TweetService.ts +35 -65
- package/src/services/data/UserService.ts +42 -48
- package/src/services/helper/Parser.ts +3 -24
- package/src/services/helper/extractors/Tweets.ts +4 -4
- package/src/services/helper/extractors/Users.ts +5 -5
- package/src/services/util/FetcherService.ts +4 -4
- package/src/twitter/Url.ts +37 -0
- package/src/twitter/enums/Resources.ts +15 -0
- package/src/twitter/params/Query.ts +100 -0
- package/src/twitter/payloads/Args.ts +21 -0
- package/src/twitter/payloads/Features.ts +33 -0
- package/src/twitter/payloads/Variables.ts +73 -0
- package/src/twitter/types/request/Query.ts +91 -0
- package/src/{types/raw → twitter/types}/user/Tweets.ts +1747 -1747
- package/src/types/Args.ts +1 -1
- 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/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/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.js.map +0 -1
- package/dist/types/Trends.d.ts +0 -50
- 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.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/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.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.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.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.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.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.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.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.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.js +0 -3
- package/dist/types/raw/tweet/Tweets.js.map +0 -1
- 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.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.js +0 -3
- package/dist/types/raw/user/Tweets.js.map +0 -1
- 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/services/helper/urls/Tweets.ts +0 -46
- package/src/services/helper/urls/Users.ts +0 -78
- /package/src/{types/raw → twitter/types}/tweet/Favouriters.ts +0 -0
- /package/src/{types/raw → twitter/types}/tweet/Retweeters.ts +0 -0
- /package/src/{types/raw → twitter/types}/tweet/Tweet.ts +0 -0
- /package/src/{types/raw → twitter/types}/tweet/Tweets.ts +0 -0
- /package/src/{types/raw → twitter/types}/user/Followers.ts +0 -0
- /package/src/{types/raw → twitter/types}/user/Following.ts +0 -0
- /package/src/{types/raw → twitter/types}/user/Likes.ts +0 -0
- /package/src/{types/raw → twitter/types}/user/User.ts +0 -0
|
@@ -1,92 +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;
|
|
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
92
|
//# sourceMappingURL=LoginFlows.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @returns The url for fetching a guest token
|
|
3
|
-
*/
|
|
4
|
-
export declare function guestTokenUrl(): string;
|
|
1
|
+
/**
|
|
2
|
+
* @returns The url for fetching a guest token
|
|
3
|
+
*/
|
|
4
|
+
export declare function guestTokenUrl(): string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
exports.__esModule = true;
|
|
3
|
-
exports.guestTokenUrl = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @returns The url for fetching a guest token
|
|
6
|
-
*/
|
|
7
|
-
function guestTokenUrl() {
|
|
8
|
-
return "https://api.twitter.com/1.1/guest/activate.json";
|
|
9
|
-
}
|
|
10
|
-
exports.guestTokenUrl = guestTokenUrl;
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.guestTokenUrl = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @returns The url for fetching a guest token
|
|
6
|
+
*/
|
|
7
|
+
function guestTokenUrl() {
|
|
8
|
+
return "https://api.twitter.com/1.1/guest/activate.json";
|
|
9
|
+
}
|
|
10
|
+
exports.guestTokenUrl = guestTokenUrl;
|
|
11
11
|
//# sourceMappingURL=Authentication.js.map
|
|
@@ -1,33 +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
|
-
}
|
|
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
|
+
}
|
|
@@ -1,96 +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;
|
|
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
96
|
//# sourceMappingURL=CacheService.js.map
|
|
@@ -1,65 +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
|
-
|
|
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
|
-
}
|
|
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
|
+
protected auth: AuthService;
|
|
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
|
+
}
|