@pipedream/twitter 1.1.1 → 1.1.3

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 (60) hide show
  1. package/README.md +16 -1
  2. package/dist/actions/add-user-to-list/add-user-to-list.d.ts +3 -3
  3. package/dist/actions/add-user-to-list/add-user-to-list.mjs +21 -14
  4. package/dist/actions/create-tweet/create-tweet.d.ts +1 -1
  5. package/dist/actions/create-tweet/create-tweet.mjs +35 -28
  6. package/dist/actions/delete-tweet/delete-tweet.d.ts +2 -2
  7. package/dist/actions/delete-tweet/delete-tweet.mjs +16 -9
  8. package/dist/actions/follow-user/follow-user.d.ts +2 -2
  9. package/dist/actions/follow-user/follow-user.mjs +20 -13
  10. package/dist/actions/get-tweet/get-tweet.d.ts +2 -2
  11. package/dist/actions/get-tweet/get-tweet.mjs +17 -10
  12. package/dist/actions/get-user/get-user.d.ts +2 -2
  13. package/dist/actions/get-user/get-user.mjs +20 -13
  14. package/dist/actions/like-tweet/like-tweet.d.ts +2 -2
  15. package/dist/actions/like-tweet/like-tweet.mjs +18 -11
  16. package/dist/actions/list-favorites/list-favorites.d.ts +4 -4
  17. package/dist/actions/list-favorites/list-favorites.mjs +20 -13
  18. package/dist/actions/list-followers/list-followers.d.ts +4 -4
  19. package/dist/actions/list-followers/list-followers.mjs +20 -13
  20. package/dist/actions/list-lists/list-lists.d.ts +4 -4
  21. package/dist/actions/list-lists/list-lists.mjs +20 -13
  22. package/dist/actions/list-mentions/list-mentions.d.ts +4 -4
  23. package/dist/actions/list-mentions/list-mentions.mjs +20 -13
  24. package/dist/actions/list-user-tweets/list-user-tweets.d.ts +4 -4
  25. package/dist/actions/list-user-tweets/list-user-tweets.mjs +20 -13
  26. package/dist/actions/retweet/retweet.d.ts +2 -2
  27. package/dist/actions/retweet/retweet.mjs +20 -13
  28. package/dist/actions/simple-search/simple-search.d.ts +4 -4
  29. package/dist/actions/simple-search/simple-search.mjs +21 -14
  30. package/dist/actions/simple-search-in-list/simple-search-in-list.d.ts +4 -4
  31. package/dist/actions/simple-search-in-list/simple-search-in-list.mjs +24 -17
  32. package/dist/actions/unfollow-user/unfollow-user.d.ts +2 -2
  33. package/dist/actions/unfollow-user/unfollow-user.mjs +16 -9
  34. package/dist/actions/unlike-tweet/unlike-tweet.d.ts +2 -2
  35. package/dist/actions/unlike-tweet/unlike-tweet.mjs +16 -9
  36. package/dist/app/twitter.app.d.ts +1 -1
  37. package/dist/app/twitter.app.mjs +45 -34
  38. package/dist/common/dataFields.mjs +6 -6
  39. package/dist/common/errorMessage.d.ts +2 -0
  40. package/dist/common/errorMessage.mjs +2 -0
  41. package/dist/sources/common/base.d.ts +1 -1
  42. package/dist/sources/common/base.mjs +10 -2
  43. package/dist/sources/new-follower-of-user/new-follower-of-user.d.ts +2 -2
  44. package/dist/sources/new-follower-of-user/new-follower-of-user.mjs +1 -1
  45. package/dist/sources/new-list-followed/new-list-followed.d.ts +2 -2
  46. package/dist/sources/new-list-followed/new-list-followed.mjs +1 -1
  47. package/dist/sources/new-tweet-in-list/new-tweet-in-list.d.ts +2 -2
  48. package/dist/sources/new-tweet-in-list/new-tweet-in-list.mjs +1 -1
  49. package/dist/sources/new-tweet-liked-by-user/new-tweet-liked-by-user.d.ts +2 -2
  50. package/dist/sources/new-tweet-liked-by-user/new-tweet-liked-by-user.mjs +1 -1
  51. package/dist/sources/new-tweet-posted-by-user/new-tweet-posted-by-user.d.ts +2 -2
  52. package/dist/sources/new-tweet-posted-by-user/new-tweet-posted-by-user.mjs +1 -1
  53. package/dist/sources/new-tweet-posted-matching-query/new-tweet-posted-matching-query.d.ts +2 -2
  54. package/dist/sources/new-tweet-posted-matching-query/new-tweet-posted-matching-query.mjs +1 -1
  55. package/dist/sources/new-unfollower-of-user/new-unfollower-of-user.d.ts +2 -2
  56. package/dist/sources/new-unfollower-of-user/new-unfollower-of-user.mjs +1 -1
  57. package/dist/sources/new-user-followed/new-user-followed.d.ts +2 -2
  58. package/dist/sources/new-user-followed/new-user-followed.mjs +1 -1
  59. package/dist/tsconfig.tsbuildinfo +1 -1
  60. package/package.json +2 -2
@@ -8,7 +8,7 @@ declare const _default: import("@pipedream/types").Action<{
8
8
  getTweetFields: typeof getTweetFields;
9
9
  }, {
10
10
  app: import("@pipedream/types").App<{
11
- _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("oauth-1.0a").Header>;
11
+ _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
12
12
  _getBaseUrl(): "https://api.twitter.com/2";
13
13
  _httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
14
14
  _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
@@ -70,7 +70,7 @@ declare const _default: import("@pipedream/types").Action<{
70
70
  }>;
71
71
  listId: {
72
72
  propDefinition: (string | import("@pipedream/types").App<{
73
- _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("oauth-1.0a").Header>;
73
+ _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
74
74
  _getBaseUrl(): "https://api.twitter.com/2";
75
75
  _httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
76
76
  _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
@@ -138,7 +138,7 @@ declare const _default: import("@pipedream/types").Action<{
138
138
  };
139
139
  maxResults: {
140
140
  propDefinition: (string | import("@pipedream/types").App<{
141
- _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("oauth-1.0a").Header>;
141
+ _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
142
142
  _getBaseUrl(): "https://api.twitter.com/2";
143
143
  _httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
144
144
  _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
@@ -199,7 +199,7 @@ declare const _default: import("@pipedream/types").Action<{
199
199
  };
200
200
  }>)[];
201
201
  min: number;
202
- max: number;
202
+ description: string;
203
203
  default: number;
204
204
  };
205
205
  }>;
@@ -1,4 +1,5 @@
1
1
  import app from "../../app/twitter.app.mjs";
2
+ import { ACTION_ERROR_MESSAGE } from "../../common/errorMessage.mjs";
2
3
  import { defineAction } from "@pipedream/types";
3
4
  import { getMultiItemSummary, getTweetFields, } from "../../common/methods.mjs";
4
5
  export const DOCS_LINK = "https://developer.twitter.com/en/docs/twitter-api/lists/list-tweets/api-reference/get-lists-id-tweets";
@@ -9,7 +10,7 @@ export default defineAction({
9
10
  key: "twitter-simple-search-in-list",
10
11
  name: "Search Tweets in List",
11
12
  description: `Search Tweets by text in a list. [See docs here](${DOCS_LINK})`,
12
- version: "1.1.1",
13
+ version: "1.1.3",
13
14
  type: "action",
14
15
  props: {
15
16
  app,
@@ -30,7 +31,7 @@ export default defineAction({
30
31
  "maxResults",
31
32
  ],
32
33
  min: MIN_RESULTS,
33
- max: MAX_RESULTS_PER_PAGE * 5,
34
+ description: `Maximum amount of items to return. Each request can return up to ${MAX_RESULTS_PER_PAGE} items.`,
34
35
  default: DEFAULT_RESULTS,
35
36
  },
36
37
  },
@@ -39,20 +40,26 @@ export default defineAction({
39
40
  getTweetFields,
40
41
  },
41
42
  async run({ $ }) {
42
- const { listId, searchTerms, } = this;
43
- const params = {
44
- $,
45
- listId,
46
- maxPerPage: MAX_RESULTS_PER_PAGE,
47
- maxResults: this.maxResults,
48
- params: this.getTweetFields(),
49
- };
50
- const response = await this.app.getListTweets(params);
51
- const { data } = response;
52
- const filteredTweets = data.filter(({ text }) => searchTerms.every((term) => term.split("|").some((splitTerm) => text.includes(splitTerm))));
53
- $.export("$summary", this.getMultiItemSummary("tweet", filteredTweets.length));
54
- return {
55
- data: filteredTweets,
56
- };
43
+ try {
44
+ const { listId, searchTerms, } = this;
45
+ const params = {
46
+ $,
47
+ listId,
48
+ maxPerPage: MAX_RESULTS_PER_PAGE,
49
+ maxResults: this.maxResults,
50
+ params: this.getTweetFields(),
51
+ };
52
+ const response = await this.app.getListTweets(params);
53
+ const { data } = response;
54
+ const filteredTweets = data.filter(({ text }) => searchTerms.every((term) => term.split("|").some((splitTerm) => text.includes(splitTerm))));
55
+ $.export("$summary", this.getMultiItemSummary("tweet", filteredTweets.length));
56
+ return {
57
+ data: filteredTweets,
58
+ };
59
+ }
60
+ catch (err) {
61
+ $.export("error", err);
62
+ throw new Error(ACTION_ERROR_MESSAGE);
63
+ }
57
64
  },
58
65
  });
@@ -4,7 +4,7 @@ declare const _default: import("@pipedream/types").Action<{
4
4
  getUserId: typeof getUserId;
5
5
  }, {
6
6
  app: import("@pipedream/types").App<{
7
- _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("oauth-1.0a").Header>;
7
+ _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
8
8
  _getBaseUrl(): "https://api.twitter.com/2";
9
9
  _httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
10
10
  _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
@@ -66,7 +66,7 @@ declare const _default: import("@pipedream/types").Action<{
66
66
  }>;
67
67
  userNameOrId: {
68
68
  propDefinition: (string | import("@pipedream/types").App<{
69
- _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("oauth-1.0a").Header>;
69
+ _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
70
70
  _getBaseUrl(): "https://api.twitter.com/2";
71
71
  _httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
72
72
  _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
@@ -1,4 +1,5 @@
1
1
  import app from "../../app/twitter.app.mjs";
2
+ import { ACTION_ERROR_MESSAGE } from "../../common/errorMessage.mjs";
2
3
  import { defineAction } from "@pipedream/types";
3
4
  import { getUserId } from "../../common/methods.mjs";
4
5
  const DOCS_LINK = "https://developer.twitter.com/en/docs/twitter-api/users/follows/api-reference/delete-users-source_id-following";
@@ -6,7 +7,7 @@ export default defineAction({
6
7
  key: "twitter-unfollow-user",
7
8
  name: "Unfollow User",
8
9
  description: `Unfollow a user. [See docs here](${DOCS_LINK})`,
9
- version: "1.0.2",
10
+ version: "1.0.4",
10
11
  type: "action",
11
12
  props: {
12
13
  app,
@@ -21,13 +22,19 @@ export default defineAction({
21
22
  getUserId,
22
23
  },
23
24
  async run({ $ }) {
24
- const userId = await this.getUserId();
25
- const params = {
26
- $,
27
- userId,
28
- };
29
- const response = await this.app.unfollowUser(params);
30
- $.export("$summary", "Successfully unfollowed user");
31
- return response;
25
+ try {
26
+ const userId = await this.getUserId();
27
+ const params = {
28
+ $,
29
+ userId,
30
+ };
31
+ const response = await this.app.unfollowUser(params);
32
+ $.export("$summary", "Successfully unfollowed user");
33
+ return response;
34
+ }
35
+ catch (err) {
36
+ $.export("error", err);
37
+ throw new Error(ACTION_ERROR_MESSAGE);
38
+ }
32
39
  },
33
40
  });
@@ -1,7 +1,7 @@
1
1
  import { UnlikeTweetParams } from "../../common/types/requestParams.js";
2
2
  declare const _default: import("@pipedream/types").Action<unknown, {
3
3
  app: import("@pipedream/types").App<{
4
- _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("oauth-1.0a").Header>;
4
+ _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
5
5
  _getBaseUrl(): "https://api.twitter.com/2";
6
6
  _httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
7
7
  _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
@@ -63,7 +63,7 @@ declare const _default: import("@pipedream/types").Action<unknown, {
63
63
  }>;
64
64
  tweetId: {
65
65
  propDefinition: (string | import("@pipedream/types").App<{
66
- _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("oauth-1.0a").Header>;
66
+ _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
67
67
  _getBaseUrl(): "https://api.twitter.com/2";
68
68
  _httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
69
69
  _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
@@ -1,11 +1,12 @@
1
1
  import app from "../../app/twitter.app.mjs";
2
+ import { ACTION_ERROR_MESSAGE } from "../../common/errorMessage.mjs";
2
3
  import { defineAction } from "@pipedream/types";
3
4
  const DOCS_LINK = "https://developer.twitter.com/en/docs/twitter-api/tweets/likes/api-reference/delete-users-id-likes-tweet_id";
4
5
  export default defineAction({
5
6
  key: "twitter-unlike-tweet",
6
7
  name: "Unlike Tweet",
7
8
  description: `Unlike a tweet specified by its ID. [See docs here](${DOCS_LINK})`,
8
- version: "1.0.1",
9
+ version: "1.0.3",
9
10
  type: "action",
10
11
  props: {
11
12
  app,
@@ -17,13 +18,19 @@ export default defineAction({
17
18
  },
18
19
  },
19
20
  async run({ $ }) {
20
- const { tweetId } = this;
21
- const params = {
22
- $,
23
- tweetId,
24
- };
25
- const response = await this.app.unlikeTweet(params);
26
- $.export("$summary", `Successfully unliked tweet ${tweetId}`);
27
- return response;
21
+ try {
22
+ const { tweetId } = this;
23
+ const params = {
24
+ $,
25
+ tweetId,
26
+ };
27
+ const response = await this.app.unlikeTweet(params);
28
+ $.export("$summary", `Successfully unliked tweet ${tweetId}`);
29
+ return response;
30
+ }
31
+ catch (err) {
32
+ $.export("error", err);
33
+ throw new Error(ACTION_ERROR_MESSAGE);
34
+ }
28
35
  },
29
36
  });
@@ -2,7 +2,7 @@ import OAuth from "oauth-1.0a";
2
2
  import { AddUserToListParams, CreateTweetParams, DeleteTweetParams, FollowUserParams, GetUserLikedTweetParams, GetUserOwnedListsParams, GetTweetParams, GetUserFollowedListsParams, GetUserMentionsParams, GetUserParams, GetUserTweetsParams, HttpRequestParams, LikeTweetParams, GetUserFollowersParams, GetUserFollowingParams, PaginatedRequestParams, RetweetParams, SearchTweetsParams, UnfollowUserParams, UnlikeTweetParams, GetListTweetsParams, GetAuthenticatedUserParams } from "../common/types/requestParams.js";
3
3
  import { List, PaginatedResponseObject, ResponseObject, Tweet, TwitterEntity, User } from "../common/types/responseSchemas.js";
4
4
  declare const _default: import("@pipedream/types").App<{
5
- _getAuthHeader(config: HttpRequestParams): Promise<OAuth.Header>;
5
+ _getAuthHeader(config: HttpRequestParams): OAuth.Header;
6
6
  _getBaseUrl(): "https://api.twitter.com/2";
7
7
  _httpRequest({ $, ...args }: HttpRequestParams): Promise<ResponseObject<TwitterEntity>>;
8
8
  _paginatedRequest({ maxResults, maxPerPage, params, ...args }: PaginatedRequestParams): Promise<PaginatedResponseObject<TwitterEntity>>;
@@ -1,7 +1,8 @@
1
1
  import OAuth from "oauth-1.0a";
2
2
  import crypto from "crypto";
3
3
  import { defineApp } from "@pipedream/types";
4
- import { axios } from "@pipedream/platform";
4
+ import { axios, transformConfigForOauth, } from "@pipedream/platform";
5
+ import { ERROR_MESSAGE } from "../common/errorMessage.mjs";
5
6
  export default defineApp({
6
7
  type: "app",
7
8
  app: "twitter",
@@ -9,7 +10,7 @@ export default defineApp({
9
10
  maxResults: {
10
11
  type: "integer",
11
12
  label: "Max Results",
12
- description: "Maximum total amount of items to return. The maximum amount of requests that can be made is 5.",
13
+ description: "Maximum amount of items to return. The maximum amount per request for each endpoint is included in the API documentation.",
13
14
  optional: true,
14
15
  },
15
16
  listId: {
@@ -17,14 +18,19 @@ export default defineApp({
17
18
  label: "List ID",
18
19
  description: "Select a **List** owned by the authenticated user, or use a custom *List ID*.",
19
20
  async options() {
20
- const userId = await this.getAuthenticatedUserId();
21
- const lists = await this.getUserOwnedLists({
22
- userId,
23
- });
24
- return (lists.data?.map(({ id, name, }) => ({
25
- label: name,
26
- value: id,
27
- })) ?? []);
21
+ try {
22
+ const userId = await this.getAuthenticatedUserId();
23
+ const lists = await this.getUserOwnedLists({
24
+ userId,
25
+ });
26
+ return (lists.data?.map(({ id, name, }) => ({
27
+ label: name,
28
+ value: id,
29
+ })) ?? []);
30
+ }
31
+ catch (error) {
32
+ throw new Error(ERROR_MESSAGE);
33
+ }
28
34
  },
29
35
  },
30
36
  userNameOrId: {
@@ -57,11 +63,11 @@ export default defineApp({
57
63
  },
58
64
  },
59
65
  methods: {
60
- async _getAuthHeader(config) {
61
- const { oauth_access_token: key, oauth_refresh_token: secret, } = this.$auth;
66
+ _getAuthHeader(config) {
67
+ const { developer_consumer_key: devKey, developer_consumer_secret: devSecret, oauth_access_token: key, oauth_refresh_token: secret, } = this.$auth;
62
68
  const consumer = {
63
- key,
64
- secret,
69
+ key: devKey,
70
+ secret: devSecret,
65
71
  };
66
72
  const oauth = new OAuth({
67
73
  consumer,
@@ -73,9 +79,12 @@ export default defineApp({
73
79
  .digest("base64");
74
80
  },
75
81
  });
76
- if (!config.method)
77
- config.method = "GET";
78
- return oauth.toHeader(oauth.authorize(config, consumer));
82
+ const token = {
83
+ key,
84
+ secret,
85
+ };
86
+ const requestData = transformConfigForOauth(config);
87
+ return oauth.toHeader(oauth.authorize(requestData, token));
79
88
  },
80
89
  _getBaseUrl() {
81
90
  return "https://api.twitter.com/2";
@@ -85,16 +94,10 @@ export default defineApp({
85
94
  baseURL: this._getBaseUrl(),
86
95
  ...args,
87
96
  };
88
- // const headers = this._getAuthHeader(config);
97
+ const headers = this._getAuthHeader(config);
89
98
  const request = () => axios($, {
90
99
  ...config,
91
- // headers,
92
- }, {
93
- oauthSignerUri: this.$auth.oauth_signer_uri,
94
- token: {
95
- key: this.$auth.oauth_access_token,
96
- secret: this.$auth.oauth_refresh_token,
97
- },
100
+ headers,
98
101
  });
99
102
  let response, counter = 1;
100
103
  do {
@@ -110,12 +113,12 @@ export default defineApp({
110
113
  return response;
111
114
  },
112
115
  async _paginatedRequest({ maxResults = 100, maxPerPage = 100, params, ...args }) {
113
- const totalData = [], totalIncludes = {};
116
+ const totalData = [], totalErrors = [], totalIncludes = {};
114
117
  let paginationToken;
115
118
  let resultCount = 0;
116
119
  do {
117
120
  const perPage = Math.min(maxResults - resultCount, maxPerPage);
118
- const { data, meta: { next_token }, includes, } = await this._httpRequest({
121
+ const { data, errors, meta: { next_token }, includes, } = await this._httpRequest({
119
122
  params: {
120
123
  ...params,
121
124
  max_results: perPage,
@@ -123,13 +126,20 @@ export default defineApp({
123
126
  },
124
127
  ...args,
125
128
  });
126
- if (!data)
127
- break;
128
- totalData.push(...(Array.isArray(data)
129
- ? data
130
- : [
131
- data,
132
- ]));
129
+ if (data) {
130
+ totalData.push(...(Array.isArray(data)
131
+ ? data
132
+ : [
133
+ data,
134
+ ]));
135
+ }
136
+ if (errors) {
137
+ totalErrors.push(...(Array.isArray(errors)
138
+ ? errors
139
+ : [
140
+ errors,
141
+ ]));
142
+ }
133
143
  if (includes) {
134
144
  Object.entries(includes).forEach(([key, value]) => {
135
145
  if (!totalIncludes[key])
@@ -142,6 +152,7 @@ export default defineApp({
142
152
  } while (paginationToken && resultCount < maxResults);
143
153
  return {
144
154
  data: totalData,
155
+ errors: totalErrors,
145
156
  includes: totalIncludes,
146
157
  };
147
158
  },
@@ -15,9 +15,9 @@ export const MEDIA_FIELD_OPTIONS = [
15
15
  "url",
16
16
  "width",
17
17
  "public_metrics",
18
- "non_public_metrics",
19
- "organic_metrics",
20
- "promoted_metrics",
18
+ // "non_public_metrics",
19
+ // "organic_metrics",
20
+ // "promoted_metrics",
21
21
  "alt_text",
22
22
  "variants",
23
23
  ];
@@ -50,10 +50,10 @@ export const TWEET_FIELD_OPTIONS = [
50
50
  "id",
51
51
  "in_reply_to_user_id",
52
52
  "lang",
53
- "non_public_metrics",
53
+ // "non_public_metrics",
54
54
  "public_metrics",
55
- "organic_metrics",
56
- "promoted_metrics",
55
+ // "organic_metrics",
56
+ // "promoted_metrics",
57
57
  "possibly_sensitive",
58
58
  "referenced_tweets",
59
59
  "reply_settings",
@@ -0,0 +1,2 @@
1
+ export declare const ERROR_MESSAGE = "Check if your app is properly configured on the Twitter Developer Portal, and if your plan has access to the endpoint used by this component.";
2
+ export declare const ACTION_ERROR_MESSAGE: string;
@@ -0,0 +1,2 @@
1
+ export const ERROR_MESSAGE = "Check if your app is properly configured on the Twitter Developer Portal, and if your plan has access to the endpoint used by this component.";
2
+ export const ACTION_ERROR_MESSAGE = `${ERROR_MESSAGE} Additional debugging information has been exported from the step.`;
@@ -2,7 +2,7 @@ import { TwitterEntity } from "../../common/types/responseSchemas.js";
2
2
  declare const _default: {
3
3
  props: {
4
4
  app: import("@pipedream/types").App<{
5
- _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("oauth-1.0a").Header>;
5
+ _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
6
6
  _getBaseUrl(): "https://api.twitter.com/2";
7
7
  _httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<TwitterEntity>>;
8
8
  _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<TwitterEntity>>;
@@ -1,5 +1,6 @@
1
1
  import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";
2
2
  import app from "../../app/twitter.app.mjs";
3
+ import { ERROR_MESSAGE } from "../../common/errorMessage.mjs";
3
4
  export default {
4
5
  props: {
5
6
  app,
@@ -36,7 +37,9 @@ export default {
36
37
  const data = await this.getResources(maxResults);
37
38
  if (data) {
38
39
  const savedIds = this.getSavedIds() ?? [];
39
- data.filter(({ id }) => !savedIds.includes(id)).reverse()
40
+ data
41
+ .filter(({ id }) => !savedIds.includes(id))
42
+ .reverse()
40
43
  .forEach((obj) => {
41
44
  this.emitEvent(obj);
42
45
  savedIds.push(obj.id);
@@ -55,6 +58,11 @@ export default {
55
58
  },
56
59
  },
57
60
  async run() {
58
- await this.getAndProcessData(50);
61
+ try {
62
+ await this.getAndProcessData(50);
63
+ }
64
+ catch (err) {
65
+ throw new Error(`${ERROR_MESSAGE} Error response: ${JSON.stringify(err)}`);
66
+ }
59
67
  },
60
68
  };
@@ -16,7 +16,7 @@ declare const _default: import("@pipedream/types").Source<{
16
16
  }, {
17
17
  userNameOrId: {
18
18
  propDefinition: (string | import("@pipedream/types").App<{
19
- _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("oauth-1.0a").Header>;
19
+ _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
20
20
  _getBaseUrl(): "https://api.twitter.com/2";
21
21
  _httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
22
22
  _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
@@ -78,7 +78,7 @@ declare const _default: import("@pipedream/types").Source<{
78
78
  }>)[];
79
79
  };
80
80
  app: import("@pipedream/types").App<{
81
- _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("oauth-1.0a").Header>;
81
+ _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
82
82
  _getBaseUrl(): "https://api.twitter.com/2";
83
83
  _httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
84
84
  _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
@@ -10,7 +10,7 @@ export default defineSource({
10
10
  key: "twitter-new-follower-of-user",
11
11
  name: "New Follower Received by User",
12
12
  description: `Emit new event when the specified User receives a Follower [See docs here](${DOCS_LINK})`,
13
- version: "1.1.1",
13
+ version: "1.1.3",
14
14
  type: "source",
15
15
  props: {
16
16
  ...common.props,
@@ -16,7 +16,7 @@ declare const _default: import("@pipedream/types").Source<{
16
16
  }, {
17
17
  userNameOrId: {
18
18
  propDefinition: (string | import("@pipedream/types").App<{
19
- _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("oauth-1.0a").Header>;
19
+ _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
20
20
  _getBaseUrl(): "https://api.twitter.com/2";
21
21
  _httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
22
22
  _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
@@ -78,7 +78,7 @@ declare const _default: import("@pipedream/types").Source<{
78
78
  }>)[];
79
79
  };
80
80
  app: import("@pipedream/types").App<{
81
- _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("oauth-1.0a").Header>;
81
+ _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
82
82
  _getBaseUrl(): "https://api.twitter.com/2";
83
83
  _httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
84
84
  _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
@@ -11,7 +11,7 @@ export default defineSource({
11
11
  key: "twitter-new-list-followed",
12
12
  name: "New List Followed by User",
13
13
  description: `Emit new event when the specified User follows a List [See docs here](${DOCS_LINK})`,
14
- version: "1.1.1",
14
+ version: "1.1.3",
15
15
  type: "source",
16
16
  props: {
17
17
  ...common.props,
@@ -14,7 +14,7 @@ declare const _default: import("@pipedream/types").Source<{
14
14
  }, {
15
15
  listId: {
16
16
  propDefinition: (string | import("@pipedream/types").App<{
17
- _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("oauth-1.0a").Header>;
17
+ _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
18
18
  _getBaseUrl(): "https://api.twitter.com/2";
19
19
  _httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
20
20
  _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
@@ -76,7 +76,7 @@ declare const _default: import("@pipedream/types").Source<{
76
76
  }>)[];
77
77
  };
78
78
  app: import("@pipedream/types").App<{
79
- _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("oauth-1.0a").Header>;
79
+ _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
80
80
  _getBaseUrl(): "https://api.twitter.com/2";
81
81
  _httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
82
82
  _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
@@ -9,7 +9,7 @@ export default defineSource({
9
9
  key: "twitter-new-tweet-in-list",
10
10
  name: "New Tweet Posted in List",
11
11
  description: `Emit new event when a Tweet is posted in the specified list [See docs here](${DOCS_LINK})`,
12
- version: "1.1.1",
12
+ version: "1.1.3",
13
13
  type: "source",
14
14
  props: {
15
15
  ...common.props,
@@ -16,7 +16,7 @@ declare const _default: import("@pipedream/types").Source<{
16
16
  }, {
17
17
  userNameOrId: {
18
18
  propDefinition: (string | import("@pipedream/types").App<{
19
- _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("oauth-1.0a").Header>;
19
+ _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
20
20
  _getBaseUrl(): "https://api.twitter.com/2";
21
21
  _httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
22
22
  _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
@@ -78,7 +78,7 @@ declare const _default: import("@pipedream/types").Source<{
78
78
  }>)[];
79
79
  };
80
80
  app: import("@pipedream/types").App<{
81
- _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("oauth-1.0a").Header>;
81
+ _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
82
82
  _getBaseUrl(): "https://api.twitter.com/2";
83
83
  _httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
84
84
  _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
@@ -10,7 +10,7 @@ export default defineSource({
10
10
  key: "twitter-new-tweet-liked-by-user",
11
11
  name: "New Tweet Liked by User",
12
12
  description: `Emit new event when a Tweet is liked by the specified User [See docs here](${DOCS_LINK})`,
13
- version: "0.1.1",
13
+ version: "0.1.3",
14
14
  type: "source",
15
15
  props: {
16
16
  ...common.props,
@@ -16,7 +16,7 @@ declare const _default: import("@pipedream/types").Source<{
16
16
  }, {
17
17
  userNameOrId: {
18
18
  propDefinition: (string | import("@pipedream/types").App<{
19
- _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("oauth-1.0a").Header>;
19
+ _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
20
20
  _getBaseUrl(): "https://api.twitter.com/2";
21
21
  _httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
22
22
  _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
@@ -78,7 +78,7 @@ declare const _default: import("@pipedream/types").Source<{
78
78
  }>)[];
79
79
  };
80
80
  app: import("@pipedream/types").App<{
81
- _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("oauth-1.0a").Header>;
81
+ _getAuthHeader(config: import("../../common/types/requestParams.js").HttpRequestParams): import("oauth-1.0a").Header;
82
82
  _getBaseUrl(): "https://api.twitter.com/2";
83
83
  _httpRequest({ $, ...args }: import("../../common/types/requestParams.js").HttpRequestParams): Promise<import("../../common/types/responseSchemas").ResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
84
84
  _paginatedRequest({ maxResults, maxPerPage, params, ...args }: import("../../common/types/requestParams.js").PaginatedRequestParams): Promise<import("../../common/types/responseSchemas").PaginatedResponseObject<import("../../common/types/responseSchemas").TwitterEntity>>;
@@ -10,7 +10,7 @@ export default defineSource({
10
10
  key: "twitter-new-tweet-posted-by-user",
11
11
  name: "New Tweet Posted by User",
12
12
  description: `Emit new event when the specified User posts a Tweet [See docs here](${DOCS_LINK})`,
13
- version: "0.1.1",
13
+ version: "0.1.3",
14
14
  type: "source",
15
15
  props: {
16
16
  ...common.props,