@pipedream/twitter 0.3.11 → 1.1.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.
Files changed (119) hide show
  1. package/README.md +18 -71
  2. package/dist/actions/add-user-to-list/add-user-to-list.d.ts +194 -0
  3. package/dist/actions/add-user-to-list/add-user-to-list.mjs +44 -0
  4. package/dist/actions/create-tweet/create-tweet.d.ts +101 -0
  5. package/dist/actions/create-tweet/create-tweet.mjs +78 -0
  6. package/dist/actions/delete-tweet/delete-tweet.d.ts +128 -0
  7. package/dist/actions/delete-tweet/delete-tweet.mjs +29 -0
  8. package/dist/actions/follow-user/follow-user.d.ts +131 -0
  9. package/dist/actions/follow-user/follow-user.mjs +37 -0
  10. package/dist/actions/get-tweet/get-tweet.d.ts +132 -0
  11. package/dist/actions/get-tweet/get-tweet.mjs +34 -0
  12. package/dist/actions/get-user/get-user.d.ts +133 -0
  13. package/dist/actions/get-user/get-user.mjs +40 -0
  14. package/dist/actions/like-tweet/like-tweet.d.ts +128 -0
  15. package/dist/actions/like-tweet/like-tweet.mjs +31 -0
  16. package/dist/actions/list-favorites/list-favorites.d.ts +202 -0
  17. package/dist/actions/list-favorites/list-favorites.mjs +50 -0
  18. package/dist/actions/list-followers/list-followers.d.ts +202 -0
  19. package/dist/actions/list-followers/list-followers.mjs +50 -0
  20. package/dist/actions/list-lists/list-lists.d.ts +200 -0
  21. package/dist/actions/list-lists/list-lists.mjs +50 -0
  22. package/dist/actions/list-mentions/list-mentions.d.ts +200 -0
  23. package/dist/actions/list-mentions/list-mentions.mjs +50 -0
  24. package/dist/actions/list-user-tweets/list-user-tweets.d.ts +202 -0
  25. package/dist/actions/list-user-tweets/list-user-tweets.mjs +50 -0
  26. package/dist/actions/retweet/retweet.d.ts +128 -0
  27. package/dist/actions/retweet/retweet.mjs +34 -0
  28. package/dist/actions/simple-search/simple-search.d.ts +201 -0
  29. package/dist/actions/simple-search/simple-search.mjs +50 -0
  30. package/dist/actions/simple-search-in-list/simple-search-in-list.d.ts +206 -0
  31. package/dist/actions/simple-search-in-list/simple-search-in-list.mjs +58 -0
  32. package/dist/actions/unfollow-user/unfollow-user.d.ts +131 -0
  33. package/dist/actions/unfollow-user/unfollow-user.mjs +33 -0
  34. package/dist/actions/unlike-tweet/unlike-tweet.d.ts +128 -0
  35. package/dist/actions/unlike-tweet/unlike-tweet.mjs +29 -0
  36. package/dist/app/twitter.app.d.ts +65 -0
  37. package/dist/app/twitter.app.mjs +291 -0
  38. package/dist/common/additionalProps.d.ts +0 -0
  39. package/dist/common/additionalProps.mjs +138 -0
  40. package/dist/common/dataFields.d.ts +6 -0
  41. package/dist/common/dataFields.mjs +80 -0
  42. package/dist/common/expansions.d.ts +3 -0
  43. package/dist/common/expansions.mjs +17 -0
  44. package/dist/common/methods.d.ts +20 -0
  45. package/dist/common/methods.mjs +69 -0
  46. package/dist/common/types/fields.d.ts +18 -0
  47. package/dist/common/types/fields.mjs +1 -0
  48. package/dist/common/types/requestParams.d.ts +105 -0
  49. package/dist/common/types/requestParams.mjs +1 -0
  50. package/dist/common/types/responseSchemas.d.ts +42 -0
  51. package/dist/common/types/responseSchemas.mjs +1 -0
  52. package/dist/sources/common/base.d.ts +87 -0
  53. package/dist/sources/common/base.mjs +60 -0
  54. package/dist/sources/common/cacheUserId.d.ts +7 -0
  55. package/dist/sources/common/cacheUserId.mjs +18 -0
  56. package/dist/sources/common/getItemSummary.d.ts +4 -0
  57. package/dist/sources/common/getItemSummary.mjs +12 -0
  58. package/dist/sources/new-follower-of-user/new-follower-of-user.d.ts +149 -0
  59. package/dist/sources/new-follower-of-user/new-follower-of-user.mjs +45 -0
  60. package/dist/sources/new-list-followed/new-list-followed.d.ts +149 -0
  61. package/dist/sources/new-list-followed/new-list-followed.mjs +46 -0
  62. package/dist/sources/new-tweet-in-list/new-tweet-in-list.d.ts +147 -0
  63. package/dist/sources/new-tweet-in-list/new-tweet-in-list.mjs +42 -0
  64. package/dist/sources/new-tweet-liked-by-user/new-tweet-liked-by-user.d.ts +149 -0
  65. package/dist/sources/new-tweet-liked-by-user/new-tweet-liked-by-user.mjs +45 -0
  66. package/dist/sources/new-tweet-posted-by-user/new-tweet-posted-by-user.d.ts +149 -0
  67. package/dist/sources/new-tweet-posted-by-user/new-tweet-posted-by-user.mjs +45 -0
  68. package/dist/sources/new-tweet-posted-matching-query/new-tweet-posted-matching-query.d.ts +147 -0
  69. package/dist/sources/new-tweet-posted-matching-query/new-tweet-posted-matching-query.mjs +44 -0
  70. package/dist/sources/new-unfollower-of-user/new-unfollower-of-user.d.ts +149 -0
  71. package/dist/sources/new-unfollower-of-user/new-unfollower-of-user.mjs +75 -0
  72. package/dist/sources/new-user-followed/new-user-followed.d.ts +148 -0
  73. package/dist/sources/new-user-followed/new-user-followed.mjs +46 -0
  74. package/dist/tsconfig.tsbuildinfo +1 -0
  75. package/package.json +10 -14
  76. package/actions/add-user-to-list/add-user-to-list.mjs +0 -62
  77. package/actions/advanced-search/advanced-search.mjs +0 -113
  78. package/actions/common.mjs +0 -29
  79. package/actions/create-tweet/create-tweet.mjs +0 -146
  80. package/actions/delete-tweet/delete-tweet.mjs +0 -42
  81. package/actions/follow-user/follow-user.mjs +0 -48
  82. package/actions/get-tweet/get-tweet.mjs +0 -42
  83. package/actions/get-user/get-user.mjs +0 -50
  84. package/actions/like-tweet/like-tweet.mjs +0 -42
  85. package/actions/list-favorites/list-favorites.mjs +0 -63
  86. package/actions/list-followers/list-followers.mjs +0 -67
  87. package/actions/list-lists/list-lists.mjs +0 -69
  88. package/actions/list-mentions/list-mentions.mjs +0 -55
  89. package/actions/list-pending-followers/list-pending-followers.mjs +0 -32
  90. package/actions/list-retweets/list-retweets.mjs +0 -54
  91. package/actions/list-user-tweets/list-user-tweets.mjs +0 -80
  92. package/actions/retweet/retweet.mjs +0 -27
  93. package/actions/simple-search/simple-search.mjs +0 -62
  94. package/actions/simple-search-in-list/simple-search-in-list.mjs +0 -48
  95. package/actions/unfollow-user/unfollow-user.mjs +0 -48
  96. package/actions/unlike-tweet/unlike-tweet.mjs +0 -40
  97. package/actions/upload-media/upload-media.mjs +0 -122
  98. package/old.md +0 -169
  99. package/sources/common/followed.mjs +0 -38
  100. package/sources/common/followers.mjs +0 -159
  101. package/sources/common/tweets.mjs +0 -155
  102. package/sources/language-codes.mjs +0 -742
  103. package/sources/my-liked-tweets/my-liked-tweets.mjs +0 -30
  104. package/sources/my-tweets/my-tweets.mjs +0 -48
  105. package/sources/new-follower-of-me/new-follower-of-me.mjs +0 -69
  106. package/sources/new-follower-of-user/new-follower-of-user.mjs +0 -25
  107. package/sources/new-list-followed/new-list-followed.mjs +0 -24
  108. package/sources/new-trends-by-geo/new-trends-by-geo.mjs +0 -40
  109. package/sources/new-tweet-in-list/new-tweet-in-list.mjs +0 -49
  110. package/sources/new-unfollower-of-me/new-unfollower-of-me.mjs +0 -16
  111. package/sources/new-unfollower-of-user/new-unfollower-of-user.mjs +0 -25
  112. package/sources/new-user-followed/new-user-followed.mjs +0 -25
  113. package/sources/search-mentions/search-mentions.mjs +0 -144
  114. package/sources/tweets-liked-by-user/tweets-liked-by-user.mjs +0 -38
  115. package/sources/user-tweets/user-tweets.mjs +0 -49
  116. package/sources/watch-retweets-of-me/watch-retweets-of-me.mjs +0 -36
  117. package/sources/watch-retweets-of-my-tweet/watch-retweets-of-my-tweet.mjs +0 -44
  118. package/sources/watch-retweets-of-user-tweet/watch-retweets-of-user-tweet.mjs +0 -34
  119. package/twitter.app.mjs +0 -1161
@@ -0,0 +1,149 @@
1
+ import { getTweetSummary as getItemSummary } from "../common/getItemSummary.js";
2
+ import { Tweet } from "../../common/types/responseSchemas.js";
3
+ import { getTweetFields } from "../../common/methods.js";
4
+ import { GetUserTweetsParams } from "../../common/types/requestParams.js";
5
+ declare const _default: import("@pipedream/types").Source<{
6
+ getTweetFields: typeof getTweetFields;
7
+ getItemSummary: typeof getItemSummary;
8
+ getEntityName(): "Tweet";
9
+ getResources(maxResults?: number): Promise<Tweet[]>;
10
+ getCachedUserId: () => Promise<string>;
11
+ getUserId: typeof import("../../common/methods.js").getUserId;
12
+ getSavedIds(): string[];
13
+ setSavedIds(data: string[]): void;
14
+ getAndProcessData(maxResults?: number): Promise<void>;
15
+ emitEvent(data: import("../../common/types/responseSchemas.js").TwitterEntity): void;
16
+ }, {
17
+ userNameOrId: {
18
+ propDefinition: (string | import("@pipedream/types").App<{
19
+ _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("oauth-1.0a").Header>;
20
+ _getBaseUrl(): "https://api.twitter.com/2";
21
+ _httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
22
+ _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
23
+ addUserToList({ listId, ...args }: import("../../common/types/requestParams.js").AddUserToListParams): Promise<object>;
24
+ createTweet(args: import("../../common/types/requestParams.js").CreateTweetParams): Promise<object>;
25
+ deleteTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").DeleteTweetParams): Promise<object>;
26
+ followUser(args: import("../../common/types/requestParams.js").FollowUserParams): Promise<object>;
27
+ getListTweets({ listId, ...args }: import("../../common/types/requestParams.js").GetListTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<Tweet>>;
28
+ getTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").GetTweetParams): Promise<import("../../common/types/responseSchemas").ResponseObject<Tweet>>;
29
+ getAuthenticatedUser(args: import("../../common/types/requestParams.js").GetAuthenticatedUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
30
+ getAuthenticatedUserId(): Promise<string>;
31
+ getUserLikedTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserLikedTweetParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<Tweet>>;
32
+ getUserOwnedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserOwnedListsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
33
+ getUserFollowedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowedListsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
34
+ getUserMentions({ userId, ...args }: import("../../common/types/requestParams.js").GetUserMentionsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<Tweet>>;
35
+ getUserTweets({ userId, ...args }: GetUserTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<Tweet>>;
36
+ getUserByUsername(username: string): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
37
+ getUser({ userId, ...args }: import("../../common/types/requestParams.js").GetUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
38
+ likeTweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
39
+ getUserFollowers({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").User>>;
40
+ getUserFollowing({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").User>>;
41
+ retweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
42
+ searchTweets(args: import("../../common/types/requestParams.js").SearchTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<Tweet>>;
43
+ unfollowUser({ userId, ...args }: import("../../common/types/requestParams.js").UnfollowUserParams): Promise<object>;
44
+ unlikeTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").UnlikeTweetParams): Promise<object>;
45
+ }, {
46
+ maxResults: {
47
+ type: string;
48
+ label: string;
49
+ description: string;
50
+ optional: boolean;
51
+ };
52
+ listId: {
53
+ type: string;
54
+ label: string;
55
+ description: string;
56
+ options(): Promise<{
57
+ label: string;
58
+ value: string;
59
+ }[]>;
60
+ };
61
+ userNameOrId: {
62
+ type: string;
63
+ label: string;
64
+ description: string;
65
+ optional: boolean;
66
+ default: string;
67
+ };
68
+ tweetId: {
69
+ type: string;
70
+ label: string;
71
+ description: string;
72
+ };
73
+ query: {
74
+ type: string;
75
+ label: string;
76
+ description: string;
77
+ };
78
+ }>)[];
79
+ };
80
+ app: import("@pipedream/types").App<{
81
+ _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("oauth-1.0a").Header>;
82
+ _getBaseUrl(): "https://api.twitter.com/2";
83
+ _httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
84
+ _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
85
+ addUserToList({ listId, ...args }: import("../../common/types/requestParams.js").AddUserToListParams): Promise<object>;
86
+ createTweet(args: import("../../common/types/requestParams.js").CreateTweetParams): Promise<object>;
87
+ deleteTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").DeleteTweetParams): Promise<object>;
88
+ followUser(args: import("../../common/types/requestParams.js").FollowUserParams): Promise<object>;
89
+ getListTweets({ listId, ...args }: import("../../common/types/requestParams.js").GetListTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<Tweet>>;
90
+ getTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").GetTweetParams): Promise<import("../../common/types/responseSchemas").ResponseObject<Tweet>>;
91
+ getAuthenticatedUser(args: import("../../common/types/requestParams.js").GetAuthenticatedUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
92
+ getAuthenticatedUserId(): Promise<string>;
93
+ getUserLikedTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserLikedTweetParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<Tweet>>;
94
+ getUserOwnedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserOwnedListsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
95
+ getUserFollowedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowedListsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
96
+ getUserMentions({ userId, ...args }: import("../../common/types/requestParams.js").GetUserMentionsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<Tweet>>;
97
+ getUserTweets({ userId, ...args }: GetUserTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<Tweet>>;
98
+ getUserByUsername(username: string): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
99
+ getUser({ userId, ...args }: import("../../common/types/requestParams.js").GetUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
100
+ likeTweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
101
+ getUserFollowers({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").User>>;
102
+ getUserFollowing({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").User>>;
103
+ retweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
104
+ searchTweets(args: import("../../common/types/requestParams.js").SearchTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<Tweet>>;
105
+ unfollowUser({ userId, ...args }: import("../../common/types/requestParams.js").UnfollowUserParams): Promise<object>;
106
+ unlikeTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").UnlikeTweetParams): Promise<object>;
107
+ }, {
108
+ maxResults: {
109
+ type: string;
110
+ label: string;
111
+ description: string;
112
+ optional: boolean;
113
+ };
114
+ listId: {
115
+ type: string;
116
+ label: string;
117
+ description: string;
118
+ options(): Promise<{
119
+ label: string;
120
+ value: string;
121
+ }[]>;
122
+ };
123
+ userNameOrId: {
124
+ type: string;
125
+ label: string;
126
+ description: string;
127
+ optional: boolean;
128
+ default: string;
129
+ };
130
+ tweetId: {
131
+ type: string;
132
+ label: string;
133
+ description: string;
134
+ };
135
+ query: {
136
+ type: string;
137
+ label: string;
138
+ description: string;
139
+ };
140
+ }>;
141
+ db: string;
142
+ timer: {
143
+ type: string;
144
+ default: {
145
+ intervalSeconds: number;
146
+ };
147
+ };
148
+ }>;
149
+ export default _default;
@@ -0,0 +1,45 @@
1
+ import app from "../../app/twitter.app.mjs";
2
+ import { defineSource } from "@pipedream/types";
3
+ import common from "../common/base.mjs";
4
+ import { getTweetSummary as getItemSummary } from "../common/getItemSummary.mjs";
5
+ import { getTweetFields } from "../../common/methods.mjs";
6
+ import { DOCS_LINK, MAX_RESULTS_PER_PAGE, } from "../../actions/list-user-tweets/list-user-tweets.mjs";
7
+ import cacheUserId from "../common/cacheUserId.mjs";
8
+ export default defineSource({
9
+ ...common,
10
+ key: "twitter-new-tweet-posted-by-user",
11
+ name: "New Tweet Posted by User",
12
+ description: `Emit new event when the specified User posts a Tweet [See docs here](${DOCS_LINK})`,
13
+ version: "0.1.0",
14
+ type: "source",
15
+ props: {
16
+ ...common.props,
17
+ userNameOrId: {
18
+ propDefinition: [
19
+ app,
20
+ "userNameOrId",
21
+ ],
22
+ },
23
+ },
24
+ methods: {
25
+ ...common.methods,
26
+ ...cacheUserId,
27
+ getTweetFields,
28
+ getItemSummary,
29
+ getEntityName() {
30
+ return "Tweet";
31
+ },
32
+ async getResources(maxResults) {
33
+ const userId = await this.getCachedUserId();
34
+ const params = {
35
+ $: this,
36
+ maxPerPage: MAX_RESULTS_PER_PAGE,
37
+ maxResults: maxResults ?? MAX_RESULTS_PER_PAGE,
38
+ params: this.getTweetFields(),
39
+ userId,
40
+ };
41
+ const { data } = await this.app.getUserTweets(params);
42
+ return data;
43
+ },
44
+ },
45
+ });
@@ -0,0 +1,147 @@
1
+ import { getTweetSummary as getItemSummary } from "../common/getItemSummary.js";
2
+ import { getTweetFields } from "../../common/methods.js";
3
+ import { SearchTweetsParams } from "../../common/types/requestParams.js";
4
+ import { Tweet } from "../../common/types/responseSchemas.js";
5
+ declare const _default: import("@pipedream/types").Source<{
6
+ getTweetFields: typeof getTweetFields;
7
+ getEntityName(): "Tweet";
8
+ getItemSummary: typeof getItemSummary;
9
+ getResources(maxResults?: number): Promise<Tweet[]>;
10
+ getSavedIds(): string[];
11
+ setSavedIds(data: string[]): void;
12
+ getAndProcessData(maxResults?: number): Promise<void>;
13
+ emitEvent(data: import("../../common/types/responseSchemas.js").TwitterEntity): void;
14
+ }, {
15
+ query: {
16
+ propDefinition: (string | import("@pipedream/types").App<{
17
+ _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("oauth-1.0a").Header>;
18
+ _getBaseUrl(): "https://api.twitter.com/2";
19
+ _httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
20
+ _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
21
+ addUserToList({ listId, ...args }: import("../../common/types/requestParams.js").AddUserToListParams): Promise<object>;
22
+ createTweet(args: import("../../common/types/requestParams.js").CreateTweetParams): Promise<object>;
23
+ deleteTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").DeleteTweetParams): Promise<object>;
24
+ followUser(args: import("../../common/types/requestParams.js").FollowUserParams): Promise<object>;
25
+ getListTweets({ listId, ...args }: import("../../common/types/requestParams.js").GetListTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<Tweet>>;
26
+ getTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").GetTweetParams): Promise<import("../../common/types/responseSchemas").ResponseObject<Tweet>>;
27
+ getAuthenticatedUser(args: import("../../common/types/requestParams.js").GetAuthenticatedUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
28
+ getAuthenticatedUserId(): Promise<string>;
29
+ getUserLikedTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserLikedTweetParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<Tweet>>;
30
+ getUserOwnedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserOwnedListsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
31
+ getUserFollowedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowedListsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
32
+ getUserMentions({ userId, ...args }: import("../../common/types/requestParams.js").GetUserMentionsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<Tweet>>;
33
+ getUserTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<Tweet>>;
34
+ getUserByUsername(username: string): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
35
+ getUser({ userId, ...args }: import("../../common/types/requestParams.js").GetUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
36
+ likeTweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
37
+ getUserFollowers({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").User>>;
38
+ getUserFollowing({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").User>>;
39
+ retweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
40
+ searchTweets(args: SearchTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<Tweet>>;
41
+ unfollowUser({ userId, ...args }: import("../../common/types/requestParams.js").UnfollowUserParams): Promise<object>;
42
+ unlikeTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").UnlikeTweetParams): Promise<object>;
43
+ }, {
44
+ maxResults: {
45
+ type: string;
46
+ label: string;
47
+ description: string;
48
+ optional: boolean;
49
+ };
50
+ listId: {
51
+ type: string;
52
+ label: string;
53
+ description: string;
54
+ options(): Promise<{
55
+ label: string;
56
+ value: string;
57
+ }[]>;
58
+ };
59
+ userNameOrId: {
60
+ type: string;
61
+ label: string;
62
+ description: string;
63
+ optional: boolean;
64
+ default: string;
65
+ };
66
+ tweetId: {
67
+ type: string;
68
+ label: string;
69
+ description: string;
70
+ };
71
+ query: {
72
+ type: string;
73
+ label: string;
74
+ description: string;
75
+ };
76
+ }>)[];
77
+ };
78
+ app: import("@pipedream/types").App<{
79
+ _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("oauth-1.0a").Header>;
80
+ _getBaseUrl(): "https://api.twitter.com/2";
81
+ _httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
82
+ _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
83
+ addUserToList({ listId, ...args }: import("../../common/types/requestParams.js").AddUserToListParams): Promise<object>;
84
+ createTweet(args: import("../../common/types/requestParams.js").CreateTweetParams): Promise<object>;
85
+ deleteTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").DeleteTweetParams): Promise<object>;
86
+ followUser(args: import("../../common/types/requestParams.js").FollowUserParams): Promise<object>;
87
+ getListTweets({ listId, ...args }: import("../../common/types/requestParams.js").GetListTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<Tweet>>;
88
+ getTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").GetTweetParams): Promise<import("../../common/types/responseSchemas").ResponseObject<Tweet>>;
89
+ getAuthenticatedUser(args: import("../../common/types/requestParams.js").GetAuthenticatedUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
90
+ getAuthenticatedUserId(): Promise<string>;
91
+ getUserLikedTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserLikedTweetParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<Tweet>>;
92
+ getUserOwnedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserOwnedListsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
93
+ getUserFollowedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowedListsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
94
+ getUserMentions({ userId, ...args }: import("../../common/types/requestParams.js").GetUserMentionsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<Tweet>>;
95
+ getUserTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<Tweet>>;
96
+ getUserByUsername(username: string): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
97
+ getUser({ userId, ...args }: import("../../common/types/requestParams.js").GetUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").User>>;
98
+ likeTweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
99
+ getUserFollowers({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").User>>;
100
+ getUserFollowing({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowersParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").User>>;
101
+ retweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
102
+ searchTweets(args: SearchTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<Tweet>>;
103
+ unfollowUser({ userId, ...args }: import("../../common/types/requestParams.js").UnfollowUserParams): Promise<object>;
104
+ unlikeTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").UnlikeTweetParams): Promise<object>;
105
+ }, {
106
+ maxResults: {
107
+ type: string;
108
+ label: string;
109
+ description: string;
110
+ optional: boolean;
111
+ };
112
+ listId: {
113
+ type: string;
114
+ label: string;
115
+ description: string;
116
+ options(): Promise<{
117
+ label: string;
118
+ value: string;
119
+ }[]>;
120
+ };
121
+ userNameOrId: {
122
+ type: string;
123
+ label: string;
124
+ description: string;
125
+ optional: boolean;
126
+ default: string;
127
+ };
128
+ tweetId: {
129
+ type: string;
130
+ label: string;
131
+ description: string;
132
+ };
133
+ query: {
134
+ type: string;
135
+ label: string;
136
+ description: string;
137
+ };
138
+ }>;
139
+ db: string;
140
+ timer: {
141
+ type: string;
142
+ default: {
143
+ intervalSeconds: number;
144
+ };
145
+ };
146
+ }>;
147
+ export default _default;
@@ -0,0 +1,44 @@
1
+ import app from "../../app/twitter.app.mjs";
2
+ import { defineSource } from "@pipedream/types";
3
+ import common from "../common/base.mjs";
4
+ import { getTweetSummary as getItemSummary } from "../common/getItemSummary.mjs";
5
+ import { getTweetFields } from "../../common/methods.mjs";
6
+ import { DOCS_LINK, MAX_RESULTS_PER_PAGE, } from "../../actions/simple-search/simple-search.mjs";
7
+ export default defineSource({
8
+ ...common,
9
+ key: "twitter-new-tweet-posted-matching-query",
10
+ name: "New Tweet Posted Matching Query",
11
+ description: `Emit new event when a new tweet matching the specified query is posted [See docs here](${DOCS_LINK})`,
12
+ version: "0.1.0",
13
+ type: "source",
14
+ props: {
15
+ ...common.props,
16
+ query: {
17
+ propDefinition: [
18
+ app,
19
+ "query",
20
+ ],
21
+ },
22
+ },
23
+ methods: {
24
+ ...common.methods,
25
+ getTweetFields,
26
+ getEntityName() {
27
+ return "Tweet";
28
+ },
29
+ getItemSummary,
30
+ async getResources(maxResults) {
31
+ const params = {
32
+ $: this,
33
+ maxPerPage: MAX_RESULTS_PER_PAGE,
34
+ maxResults: maxResults ?? MAX_RESULTS_PER_PAGE,
35
+ params: {
36
+ query: this.query,
37
+ ...this.getTweetFields(),
38
+ },
39
+ };
40
+ const { data } = await this.app.searchTweets(params);
41
+ return data;
42
+ },
43
+ },
44
+ });
@@ -0,0 +1,149 @@
1
+ import { getUserSummary as getItemSummary } from "../common/getItemSummary.js";
2
+ import { User } from "../../common/types/responseSchemas.js";
3
+ import { GetUserFollowersParams } from "../../common/types/requestParams.js";
4
+ declare const _default: import("@pipedream/types").Source<{
5
+ getItemSummary: typeof getItemSummary;
6
+ getEntityName(): "Unfollower";
7
+ getSavedUsers(): User[];
8
+ setSavedUsers(data: User[]): void;
9
+ getResources(): Promise<User[]>;
10
+ getAndProcessData(emit?: boolean): Promise<void>;
11
+ getCachedUserId: () => Promise<string>;
12
+ getUserId: typeof import("../../common/methods.js").getUserId;
13
+ getSavedIds(): string[];
14
+ setSavedIds(data: string[]): void;
15
+ emitEvent(data: import("../../common/types/responseSchemas.js").TwitterEntity): void;
16
+ }, {
17
+ userNameOrId: {
18
+ propDefinition: (string | import("@pipedream/types").App<{
19
+ _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("oauth-1.0a").Header>;
20
+ _getBaseUrl(): "https://api.twitter.com/2";
21
+ _httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
22
+ _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
23
+ addUserToList({ listId, ...args }: import("../../common/types/requestParams.js").AddUserToListParams): Promise<object>;
24
+ createTweet(args: import("../../common/types/requestParams.js").CreateTweetParams): Promise<object>;
25
+ deleteTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").DeleteTweetParams): Promise<object>;
26
+ followUser(args: import("../../common/types/requestParams.js").FollowUserParams): Promise<object>;
27
+ getListTweets({ listId, ...args }: import("../../common/types/requestParams.js").GetListTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
28
+ getTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").GetTweetParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").Tweet>>;
29
+ getAuthenticatedUser(args: import("../../common/types/requestParams.js").GetAuthenticatedUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<User>>;
30
+ getAuthenticatedUserId(): Promise<string>;
31
+ getUserLikedTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserLikedTweetParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
32
+ getUserOwnedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserOwnedListsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
33
+ getUserFollowedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowedListsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
34
+ getUserMentions({ userId, ...args }: import("../../common/types/requestParams.js").GetUserMentionsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
35
+ getUserTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
36
+ getUserByUsername(username: string): Promise<import("../../common/types/responseSchemas").ResponseObject<User>>;
37
+ getUser({ userId, ...args }: import("../../common/types/requestParams.js").GetUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<User>>;
38
+ likeTweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
39
+ getUserFollowers({ userId, ...args }: GetUserFollowersParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<User>>;
40
+ getUserFollowing({ userId, ...args }: GetUserFollowersParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<User>>;
41
+ retweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
42
+ searchTweets(args: import("../../common/types/requestParams.js").SearchTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
43
+ unfollowUser({ userId, ...args }: import("../../common/types/requestParams.js").UnfollowUserParams): Promise<object>;
44
+ unlikeTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").UnlikeTweetParams): Promise<object>;
45
+ }, {
46
+ maxResults: {
47
+ type: string;
48
+ label: string;
49
+ description: string;
50
+ optional: boolean;
51
+ };
52
+ listId: {
53
+ type: string;
54
+ label: string;
55
+ description: string;
56
+ options(): Promise<{
57
+ label: string;
58
+ value: string;
59
+ }[]>;
60
+ };
61
+ userNameOrId: {
62
+ type: string;
63
+ label: string;
64
+ description: string;
65
+ optional: boolean;
66
+ default: string;
67
+ };
68
+ tweetId: {
69
+ type: string;
70
+ label: string;
71
+ description: string;
72
+ };
73
+ query: {
74
+ type: string;
75
+ label: string;
76
+ description: string;
77
+ };
78
+ }>)[];
79
+ };
80
+ app: import("@pipedream/types").App<{
81
+ _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("oauth-1.0a").Header>;
82
+ _getBaseUrl(): "https://api.twitter.com/2";
83
+ _httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
84
+ _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
85
+ addUserToList({ listId, ...args }: import("../../common/types/requestParams.js").AddUserToListParams): Promise<object>;
86
+ createTweet(args: import("../../common/types/requestParams.js").CreateTweetParams): Promise<object>;
87
+ deleteTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").DeleteTweetParams): Promise<object>;
88
+ followUser(args: import("../../common/types/requestParams.js").FollowUserParams): Promise<object>;
89
+ getListTweets({ listId, ...args }: import("../../common/types/requestParams.js").GetListTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
90
+ getTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").GetTweetParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").Tweet>>;
91
+ getAuthenticatedUser(args: import("../../common/types/requestParams.js").GetAuthenticatedUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<User>>;
92
+ getAuthenticatedUserId(): Promise<string>;
93
+ getUserLikedTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserLikedTweetParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
94
+ getUserOwnedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserOwnedListsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
95
+ getUserFollowedLists({ userId, ...args }: import("../../common/types/requestParams.js").GetUserFollowedListsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").List>>;
96
+ getUserMentions({ userId, ...args }: import("../../common/types/requestParams.js").GetUserMentionsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
97
+ getUserTweets({ userId, ...args }: import("../../common/types/requestParams.js").GetUserTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
98
+ getUserByUsername(username: string): Promise<import("../../common/types/responseSchemas").ResponseObject<User>>;
99
+ getUser({ userId, ...args }: import("../../common/types/requestParams.js").GetUserParams): Promise<import("../../common/types/responseSchemas").ResponseObject<User>>;
100
+ likeTweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
101
+ getUserFollowers({ userId, ...args }: GetUserFollowersParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<User>>;
102
+ getUserFollowing({ userId, ...args }: GetUserFollowersParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<User>>;
103
+ retweet(args: import("../../common/types/requestParams.js").LikeTweetParams): Promise<object>;
104
+ searchTweets(args: import("../../common/types/requestParams.js").SearchTweetsParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").Tweet>>;
105
+ unfollowUser({ userId, ...args }: import("../../common/types/requestParams.js").UnfollowUserParams): Promise<object>;
106
+ unlikeTweet({ tweetId, ...args }: import("../../common/types/requestParams.js").UnlikeTweetParams): Promise<object>;
107
+ }, {
108
+ maxResults: {
109
+ type: string;
110
+ label: string;
111
+ description: string;
112
+ optional: boolean;
113
+ };
114
+ listId: {
115
+ type: string;
116
+ label: string;
117
+ description: string;
118
+ options(): Promise<{
119
+ label: string;
120
+ value: string;
121
+ }[]>;
122
+ };
123
+ userNameOrId: {
124
+ type: string;
125
+ label: string;
126
+ description: string;
127
+ optional: boolean;
128
+ default: string;
129
+ };
130
+ tweetId: {
131
+ type: string;
132
+ label: string;
133
+ description: string;
134
+ };
135
+ query: {
136
+ type: string;
137
+ label: string;
138
+ description: string;
139
+ };
140
+ }>;
141
+ db: string;
142
+ timer: {
143
+ type: string;
144
+ default: {
145
+ intervalSeconds: number;
146
+ };
147
+ };
148
+ }>;
149
+ export default _default;
@@ -0,0 +1,75 @@
1
+ import app from "../../app/twitter.app.mjs";
2
+ import { defineSource } from "@pipedream/types";
3
+ import common from "../common/base.mjs";
4
+ import { getUserSummary as getItemSummary } from "../common/getItemSummary.mjs";
5
+ import { DOCS_LINK, MAX_RESULTS_PER_PAGE, } from "../../actions/list-followers/list-followers.mjs";
6
+ import cacheUserId from "../common/cacheUserId.mjs";
7
+ export default defineSource({
8
+ ...common,
9
+ key: "twitter-new-unfollower-of-user",
10
+ name: "New Unfollower of User",
11
+ description: `Emit new event when the specified User loses a Follower [See docs here](${DOCS_LINK})`,
12
+ version: "1.0.1",
13
+ type: "source",
14
+ props: {
15
+ ...common.props,
16
+ userNameOrId: {
17
+ propDefinition: [
18
+ app,
19
+ "userNameOrId",
20
+ ],
21
+ },
22
+ },
23
+ methods: {
24
+ ...common.methods,
25
+ ...cacheUserId,
26
+ getItemSummary,
27
+ getEntityName() {
28
+ return "Unfollower";
29
+ },
30
+ getSavedUsers() {
31
+ return this.db.get("savedUsers");
32
+ },
33
+ setSavedUsers(data) {
34
+ this.db.set("savedUsers", data);
35
+ },
36
+ async getResources() {
37
+ const userId = await this.getCachedUserId();
38
+ const params = {
39
+ $: this,
40
+ maxPerPage: MAX_RESULTS_PER_PAGE,
41
+ maxResults: MAX_RESULTS_PER_PAGE,
42
+ userId,
43
+ };
44
+ const { data } = await this.app.getUserFollowers(params);
45
+ return data;
46
+ },
47
+ async getAndProcessData(emit = false) {
48
+ const data = await this.getResources(emit);
49
+ if (data) {
50
+ let savedUsers = this.getSavedUsers();
51
+ if (savedUsers && emit) {
52
+ const currentFollowerIds = data.map(({ id }) => id);
53
+ if (data.length === MAX_RESULTS_PER_PAGE) {
54
+ const lastKnownFollower = Array.from(data)
55
+ .reverse() // could be .findLast in Node 18+
56
+ .find(({ id }) => currentFollowerIds.includes(id));
57
+ const lastKnownIndex = savedUsers.indexOf(lastKnownFollower);
58
+ savedUsers = savedUsers.slice(0, lastKnownIndex + 1);
59
+ }
60
+ savedUsers
61
+ .filter(({ id }) => !currentFollowerIds.includes(id))
62
+ .reverse()
63
+ .forEach((obj) => {
64
+ if (emit)
65
+ this.emitEvent(obj);
66
+ });
67
+ }
68
+ this.setSavedUsers(data.map(({ id, username, }) => ({
69
+ id,
70
+ username,
71
+ })));
72
+ }
73
+ },
74
+ },
75
+ });