@pipedream/twitter 2.3.2 → 2.3.4

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 (94) hide show
  1. package/dist/actions/add-user-to-list/add-user-to-list.mjs +545 -45
  2. package/dist/actions/create-tweet/create-tweet.mjs +542 -76
  3. package/dist/actions/delete-tweet/delete-tweet.mjs +513 -29
  4. package/dist/actions/follow-user/follow-user.mjs +538 -38
  5. package/dist/actions/get-tweet/get-tweet.mjs +622 -35
  6. package/dist/actions/get-user/get-user.mjs +596 -39
  7. package/dist/actions/like-tweet/like-tweet.mjs +515 -31
  8. package/dist/actions/list-favorites/list-favorites.mjs +657 -51
  9. package/dist/actions/list-followers/list-followers.mjs +614 -51
  10. package/dist/actions/list-lists/list-lists.mjs +597 -51
  11. package/dist/actions/list-mentions/list-mentions.mjs +657 -51
  12. package/dist/actions/list-user-tweets/list-user-tweets.mjs +657 -51
  13. package/dist/actions/retweet/retweet.mjs +519 -34
  14. package/dist/actions/send-dm/send-dm.mjs +546 -44
  15. package/dist/actions/simple-search/simple-search.mjs +646 -51
  16. package/dist/actions/simple-search-in-list/simple-search-in-list.mjs +656 -58
  17. package/dist/actions/unfollow-user/unfollow-user.mjs +533 -34
  18. package/dist/actions/unlike-tweet/unlike-tweet.mjs +513 -29
  19. package/dist/actions/upload-media/upload-media.mjs +549 -52
  20. package/dist/app/twitter.app.mjs +443 -342
  21. package/dist/common/addObjIncludes.mjs +89 -63
  22. package/dist/common/additionalProps.mjs +0 -138
  23. package/dist/common/appValidation.mjs +475 -24
  24. package/dist/common/constants.mjs +11 -7
  25. package/dist/common/dataFields.mjs +100 -89
  26. package/dist/common/errorMessage.mjs +32 -26
  27. package/dist/common/expansions.mjs +26 -19
  28. package/dist/common/methods.mjs +170 -81
  29. package/dist/common/types/fields.mjs +0 -1
  30. package/dist/common/types/includeMapping.mjs +0 -1
  31. package/dist/common/types/requestParams.mjs +0 -1
  32. package/dist/common/types/responseSchemas.mjs +0 -1
  33. package/dist/sources/common/base.mjs +546 -69
  34. package/dist/sources/common/cacheUserId.mjs +32 -15
  35. package/dist/sources/common/getItemSummary.mjs +13 -9
  36. package/dist/sources/new-follower-of-user/new-follower-of-user.mjs +799 -40
  37. package/dist/sources/new-list-followed/new-list-followed.mjs +722 -41
  38. package/dist/sources/new-mention-received-by-user/new-mention-received-by-user.mjs +860 -40
  39. package/dist/sources/new-message/new-message.mjs +738 -32
  40. package/dist/sources/new-tweet-in-list/new-tweet-in-list.mjs +839 -37
  41. package/dist/sources/new-tweet-liked-by-user/new-tweet-liked-by-user.mjs +860 -40
  42. package/dist/sources/new-tweet-metrics/new-tweet-metrics.mjs +629 -59
  43. package/dist/sources/new-tweet-posted-by-user/new-tweet-posted-by-user.mjs +860 -40
  44. package/dist/sources/new-tweet-posted-matching-query/new-tweet-posted-matching-query.mjs +830 -39
  45. package/dist/sources/new-unfollower-of-user/new-unfollower-of-user.mjs +829 -70
  46. package/dist/sources/new-user-followed/new-user-followed.mjs +737 -41
  47. package/package.json +3 -3
  48. package/dist/actions/add-user-to-list/add-user-to-list.d.ts +0 -6
  49. package/dist/actions/create-tweet/create-tweet.d.ts +0 -105
  50. package/dist/actions/delete-tweet/delete-tweet.d.ts +0 -4
  51. package/dist/actions/follow-user/follow-user.d.ts +0 -6
  52. package/dist/actions/get-tweet/get-tweet.d.ts +0 -6
  53. package/dist/actions/get-user/get-user.d.ts +0 -7
  54. package/dist/actions/like-tweet/like-tweet.d.ts +0 -4
  55. package/dist/actions/list-favorites/list-favorites.d.ts +0 -10
  56. package/dist/actions/list-followers/list-followers.d.ts +0 -10
  57. package/dist/actions/list-lists/list-lists.d.ts +0 -8
  58. package/dist/actions/list-mentions/list-mentions.d.ts +0 -10
  59. package/dist/actions/list-user-tweets/list-user-tweets.d.ts +0 -10
  60. package/dist/actions/retweet/retweet.d.ts +0 -4
  61. package/dist/actions/send-dm/send-dm.d.ts +0 -6
  62. package/dist/actions/simple-search/simple-search.d.ts +0 -9
  63. package/dist/actions/simple-search-in-list/simple-search-in-list.d.ts +0 -9
  64. package/dist/actions/unfollow-user/unfollow-user.d.ts +0 -6
  65. package/dist/actions/unlike-tweet/unlike-tweet.d.ts +0 -4
  66. package/dist/actions/upload-media/upload-media.d.ts +0 -4
  67. package/dist/app/twitter.app.d.ts +0 -69
  68. package/dist/common/addObjIncludes.d.ts +0 -9
  69. package/dist/common/additionalProps.d.ts +0 -0
  70. package/dist/common/appValidation.d.ts +0 -144
  71. package/dist/common/constants.d.ts +0 -7
  72. package/dist/common/dataFields.d.ts +0 -8
  73. package/dist/common/errorMessage.d.ts +0 -25
  74. package/dist/common/expansions.d.ts +0 -4
  75. package/dist/common/methods.d.ts +0 -27
  76. package/dist/common/types/fields.d.ts +0 -25
  77. package/dist/common/types/includeMapping.d.ts +0 -11
  78. package/dist/common/types/requestParams.d.ts +0 -126
  79. package/dist/common/types/responseSchemas.d.ts +0 -82
  80. package/dist/sources/common/base.d.ts +0 -163
  81. package/dist/sources/common/cacheUserId.d.ts +0 -7
  82. package/dist/sources/common/getItemSummary.d.ts +0 -4
  83. package/dist/sources/new-follower-of-user/new-follower-of-user.d.ts +0 -17
  84. package/dist/sources/new-list-followed/new-list-followed.d.ts +0 -17
  85. package/dist/sources/new-mention-received-by-user/new-mention-received-by-user.d.ts +0 -17
  86. package/dist/sources/new-message/new-message.d.ts +0 -15
  87. package/dist/sources/new-tweet-in-list/new-tweet-in-list.d.ts +0 -15
  88. package/dist/sources/new-tweet-liked-by-user/new-tweet-liked-by-user.d.ts +0 -17
  89. package/dist/sources/new-tweet-metrics/new-tweet-metrics.d.ts +0 -13
  90. package/dist/sources/new-tweet-posted-by-user/new-tweet-posted-by-user.d.ts +0 -17
  91. package/dist/sources/new-tweet-posted-matching-query/new-tweet-posted-matching-query.d.ts +0 -15
  92. package/dist/sources/new-unfollower-of-user/new-unfollower-of-user.d.ts +0 -17
  93. package/dist/sources/new-user-followed/new-user-followed.d.ts +0 -17
  94. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -1,97 +1,108 @@
1
- export const LIST_FIELD_OPTIONS = [
2
- "created_at",
3
- "follower_count",
4
- "member_count",
5
- "private",
6
- "description",
7
- "owner_id",
1
+ // components/twitter/common/dataFields.ts
2
+ var LIST_FIELD_OPTIONS = [
3
+ "created_at",
4
+ "follower_count",
5
+ "member_count",
6
+ "private",
7
+ "description",
8
+ "owner_id"
8
9
  ];
9
- export const MEDIA_FIELD_OPTIONS = [
10
- "duration_ms",
11
- "height",
12
- "media_key",
13
- "preview_image_url",
14
- "type",
15
- "url",
16
- "width",
17
- "public_metrics",
18
- // "non_public_metrics",
19
- // "organic_metrics",
20
- // "promoted_metrics",
21
- "alt_text",
22
- "variants",
10
+ var MEDIA_FIELD_OPTIONS = [
11
+ "duration_ms",
12
+ "height",
13
+ "media_key",
14
+ "preview_image_url",
15
+ "type",
16
+ "url",
17
+ "width",
18
+ "public_metrics",
19
+ // "non_public_metrics",
20
+ // "organic_metrics",
21
+ // "promoted_metrics",
22
+ "alt_text",
23
+ "variants"
23
24
  ];
24
- export const MESSAGE_FIELD_OPTIONS = [
25
- "id",
26
- "text",
27
- "event_type",
28
- "created_at",
29
- "dm_conversation_id",
30
- "sender_id",
31
- "participant_ids",
32
- "referenced_tweets",
33
- "attachments",
25
+ var MESSAGE_FIELD_OPTIONS = [
26
+ "id",
27
+ "text",
28
+ "event_type",
29
+ "created_at",
30
+ "dm_conversation_id",
31
+ "sender_id",
32
+ "participant_ids",
33
+ "referenced_tweets",
34
+ "attachments"
34
35
  ];
35
- export const METRICS_FIELDS = [
36
- "public_metrics",
37
- "non_public_metrics",
38
- "organic_metrics",
39
- "promoted_metrics",
36
+ var METRICS_FIELDS = [
37
+ "public_metrics",
38
+ "non_public_metrics",
39
+ "organic_metrics",
40
+ "promoted_metrics"
40
41
  ];
41
- export const PLACE_FIELD_OPTIONS = [
42
- "contained_within",
43
- "country",
44
- "country_code",
45
- "full_name",
46
- "geo",
47
- "id",
48
- "name",
49
- "place_type",
42
+ var PLACE_FIELD_OPTIONS = [
43
+ "contained_within",
44
+ "country",
45
+ "country_code",
46
+ "full_name",
47
+ "geo",
48
+ "id",
49
+ "name",
50
+ "place_type"
50
51
  ];
51
- export const POLL_FIELD_OPTIONS = [
52
- "duration_minutes",
53
- "end_datetime",
54
- "id",
55
- "options",
56
- "voting_status",
52
+ var POLL_FIELD_OPTIONS = [
53
+ "duration_minutes",
54
+ "end_datetime",
55
+ "id",
56
+ "options",
57
+ "voting_status"
57
58
  ];
58
- export const TWEET_FIELD_OPTIONS = [
59
- "attachments",
60
- "author_id",
61
- "context_annotations",
62
- "conversation_id",
63
- "created_at",
64
- "edit_controls",
65
- "entities",
66
- "geo",
67
- "id",
68
- "in_reply_to_user_id",
69
- "lang",
70
- // "non_public_metrics",
71
- "public_metrics",
72
- // "organic_metrics",
73
- // "promoted_metrics",
74
- "possibly_sensitive",
75
- "referenced_tweets",
76
- "reply_settings",
77
- "source",
78
- "text",
79
- "withheld",
59
+ var TWEET_FIELD_OPTIONS = [
60
+ "attachments",
61
+ "author_id",
62
+ "context_annotations",
63
+ "conversation_id",
64
+ "created_at",
65
+ "edit_controls",
66
+ "entities",
67
+ "geo",
68
+ "id",
69
+ "in_reply_to_user_id",
70
+ "lang",
71
+ // "non_public_metrics",
72
+ "public_metrics",
73
+ // "organic_metrics",
74
+ // "promoted_metrics",
75
+ "possibly_sensitive",
76
+ "referenced_tweets",
77
+ "reply_settings",
78
+ "source",
79
+ "text",
80
+ "withheld"
80
81
  ];
81
- export const USER_FIELD_OPTIONS = [
82
- "created_at",
83
- "description",
84
- "entities",
85
- "id",
86
- "location",
87
- "name",
88
- "pinned_tweet_id",
89
- "profile_image_url",
90
- "protected",
91
- "public_metrics",
92
- "url",
93
- "username",
94
- "verified",
95
- "verified_type",
96
- "withheld",
82
+ var USER_FIELD_OPTIONS = [
83
+ "created_at",
84
+ "description",
85
+ "entities",
86
+ "id",
87
+ "location",
88
+ "name",
89
+ "pinned_tweet_id",
90
+ "profile_image_url",
91
+ "protected",
92
+ "public_metrics",
93
+ "url",
94
+ "username",
95
+ "verified",
96
+ "verified_type",
97
+ "withheld"
97
98
  ];
99
+ export {
100
+ LIST_FIELD_OPTIONS,
101
+ MEDIA_FIELD_OPTIONS,
102
+ MESSAGE_FIELD_OPTIONS,
103
+ METRICS_FIELDS,
104
+ PLACE_FIELD_OPTIONS,
105
+ POLL_FIELD_OPTIONS,
106
+ TWEET_FIELD_OPTIONS,
107
+ USER_FIELD_OPTIONS
108
+ };
@@ -1,27 +1,33 @@
1
- export const ERROR_URL = "https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api#item0";
2
- export const ERROR_MESSAGE = `Check if your app is properly configured on the [Twitter Developer Portal](${ERROR_URL}), and if your plan has access to the endpoint used by this component.`;
3
- export const ACTION_ERROR_MESSAGE = `${ERROR_MESSAGE} Additional debugging information has been exported from the step.`;
4
- // Taken from https://developer.twitter.com/en/support/x-api/error-troubleshooting#error-information and https://api.twitter.com/2/openapi.json
5
- const PROBLEM_BASE_URL = "https://api.twitter.com/2/problems";
6
- export const ERROR_BY_TYPE = {
7
- [`${PROBLEM_BASE_URL}/client-forbidden`]: "This X (Twitter) account appears to be on the Free plan, which only has access to **Create Tweets**. [Refer to Twitter's developer docs](https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api#v2-access-leve) for the latest info on API access.",
8
- ["about:blank"]: "A generic problem with no additional information beyond that provided by the HTTP status code.",
9
- [`${PROBLEM_BASE_URL}/invalid-request`]: "A problem that indicates this request is invalid. If your request takes a POST body, ensure the contents is valid JSON and matches the [OpenAPI spec](https://api.twitter.com/2/openapi.json).",
10
- [`${PROBLEM_BASE_URL}/resource-not-found`]: "A problem that indicates that a given Post, User, etc. does not exist.",
11
- [`${PROBLEM_BASE_URL}/not-authorized-for-resource`]: "A problem that indicates you are not allowed to see a particular Post, User, etc.",
12
- [`${PROBLEM_BASE_URL}/disallowed-resource`]: "A problem that indicates that the resource requested violates the precepts of this API.",
13
- [`${PROBLEM_BASE_URL}/unsupported-authentication`]: "A problem that indicates that the authentication used is not supported.",
14
- [`${PROBLEM_BASE_URL}/usage-capped`]: "A problem that indicates that a usage cap has been exceeded.",
15
- [`${PROBLEM_BASE_URL}/streaming-connection`]: "A problem that indicates something is wrong with the connection.",
16
- [`${PROBLEM_BASE_URL}/client-disconnected`]: "Your client has gone away.",
17
- [`${PROBLEM_BASE_URL}/operational-disconnect`]: "You have been disconnected for operational reasons.",
18
- [`${PROBLEM_BASE_URL}/rule-cap`]: "You have exceeded the maximum number of rules.",
19
- [`${PROBLEM_BASE_URL}/rule-length`]: "You have exceeded the maximum number of characters allowed on your query or rule based on your access level. See [access levels](https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api.html#Access).",
20
- [`${PROBLEM_BASE_URL}/invalid-rules`]: "The rule you have submitted is invalid.",
21
- [`${PROBLEM_BASE_URL}/duplicate-rules`]: "The rule you have submitted is a duplicate.",
22
- [`${PROBLEM_BASE_URL}/conflict`]: "The rule you have submitted is in conflict with another rule.",
23
- [`${PROBLEM_BASE_URL}/noncompliant-rules`]: "The rule you have submitted is not compliant with Twitter's Automation Rules",
24
- [`${PROBLEM_BASE_URL}/not-authorized-for-field`]: "A problem that indicates you are not allowed to see a particular field.",
25
- [`${PROBLEM_BASE_URL}/oauth1-permissions`]: "A problem that indicates you are not allowed to see a particular field.",
26
- [`${PROBLEM_BASE_URL}/resource-unavailable`]: "A problem that indicates that a given Post, User, etc. is temporarily unavailable.",
1
+ // components/twitter/common/errorMessage.ts
2
+ var ERROR_URL = "https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api#item0";
3
+ var ERROR_MESSAGE = `Check if your app is properly configured on the [Twitter Developer Portal](${ERROR_URL}), and if your plan has access to the endpoint used by this component.`;
4
+ var ACTION_ERROR_MESSAGE = `${ERROR_MESSAGE} Additional debugging information has been exported from the step.`;
5
+ var PROBLEM_BASE_URL = "https://api.twitter.com/2/problems";
6
+ var ERROR_BY_TYPE = {
7
+ [`${PROBLEM_BASE_URL}/client-forbidden`]: "This X (Twitter) account appears to be on the Free plan, which only has access to **Create Tweets**. [Refer to Twitter's developer docs](https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api#v2-access-leve) for the latest info on API access.",
8
+ ["about:blank"]: "A generic problem with no additional information beyond that provided by the HTTP status code.",
9
+ [`${PROBLEM_BASE_URL}/invalid-request`]: "A problem that indicates this request is invalid. If your request takes a POST body, ensure the contents is valid JSON and matches the [OpenAPI spec](https://api.twitter.com/2/openapi.json).",
10
+ [`${PROBLEM_BASE_URL}/resource-not-found`]: "A problem that indicates that a given Post, User, etc. does not exist.",
11
+ [`${PROBLEM_BASE_URL}/not-authorized-for-resource`]: "A problem that indicates you are not allowed to see a particular Post, User, etc.",
12
+ [`${PROBLEM_BASE_URL}/disallowed-resource`]: "A problem that indicates that the resource requested violates the precepts of this API.",
13
+ [`${PROBLEM_BASE_URL}/unsupported-authentication`]: "A problem that indicates that the authentication used is not supported.",
14
+ [`${PROBLEM_BASE_URL}/usage-capped`]: "A problem that indicates that a usage cap has been exceeded.",
15
+ [`${PROBLEM_BASE_URL}/streaming-connection`]: "A problem that indicates something is wrong with the connection.",
16
+ [`${PROBLEM_BASE_URL}/client-disconnected`]: "Your client has gone away.",
17
+ [`${PROBLEM_BASE_URL}/operational-disconnect`]: "You have been disconnected for operational reasons.",
18
+ [`${PROBLEM_BASE_URL}/rule-cap`]: "You have exceeded the maximum number of rules.",
19
+ [`${PROBLEM_BASE_URL}/rule-length`]: "You have exceeded the maximum number of characters allowed on your query or rule based on your access level. See [access levels](https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api.html#Access).",
20
+ [`${PROBLEM_BASE_URL}/invalid-rules`]: "The rule you have submitted is invalid.",
21
+ [`${PROBLEM_BASE_URL}/duplicate-rules`]: "The rule you have submitted is a duplicate.",
22
+ [`${PROBLEM_BASE_URL}/conflict`]: "The rule you have submitted is in conflict with another rule.",
23
+ [`${PROBLEM_BASE_URL}/noncompliant-rules`]: "The rule you have submitted is not compliant with Twitter's Automation Rules",
24
+ [`${PROBLEM_BASE_URL}/not-authorized-for-field`]: "A problem that indicates you are not allowed to see a particular field.",
25
+ [`${PROBLEM_BASE_URL}/oauth1-permissions`]: "A problem that indicates you are not allowed to see a particular field.",
26
+ [`${PROBLEM_BASE_URL}/resource-unavailable`]: "A problem that indicates that a given Post, User, etc. is temporarily unavailable."
27
+ };
28
+ export {
29
+ ACTION_ERROR_MESSAGE,
30
+ ERROR_BY_TYPE,
31
+ ERROR_MESSAGE,
32
+ ERROR_URL
27
33
  };
@@ -1,23 +1,30 @@
1
- export const LIST_EXPANSION_OPTIONS = [
2
- "owner_id",
1
+ // components/twitter/common/expansions.ts
2
+ var LIST_EXPANSION_OPTIONS = [
3
+ "owner_id"
3
4
  ];
4
- export const MESSAGE_EXPANSION_OPTIONS = [
5
- "attachments.media_keys",
6
- "referenced_tweets.id",
7
- "sender_id",
8
- "participant_ids",
5
+ var MESSAGE_EXPANSION_OPTIONS = [
6
+ "attachments.media_keys",
7
+ "referenced_tweets.id",
8
+ "sender_id",
9
+ "participant_ids"
9
10
  ];
10
- export const TWEET_EXPANSION_OPTIONS = [
11
- "attachments.poll_ids",
12
- "attachments.media_keys",
13
- "author_id",
14
- "edit_history_tweet_ids",
15
- "entities.mentions.username",
16
- "geo.place_id",
17
- "in_reply_to_user_id",
18
- "referenced_tweets.id",
19
- "referenced_tweets.id.author_id",
11
+ var TWEET_EXPANSION_OPTIONS = [
12
+ "attachments.poll_ids",
13
+ "attachments.media_keys",
14
+ "author_id",
15
+ "edit_history_tweet_ids",
16
+ "entities.mentions.username",
17
+ "geo.place_id",
18
+ "in_reply_to_user_id",
19
+ "referenced_tweets.id",
20
+ "referenced_tweets.id.author_id"
20
21
  ];
21
- export const USER_EXPANSION_OPTIONS = [
22
- "pinned_tweet_id",
22
+ var USER_EXPANSION_OPTIONS = [
23
+ "pinned_tweet_id"
23
24
  ];
25
+ export {
26
+ LIST_EXPANSION_OPTIONS,
27
+ MESSAGE_EXPANSION_OPTIONS,
28
+ TWEET_EXPANSION_OPTIONS,
29
+ USER_EXPANSION_OPTIONS
30
+ };
@@ -1,88 +1,177 @@
1
+ // components/twitter/common/methods.ts
1
2
  import { ConfigurationError } from "@pipedream/platform";
2
- import { LIST_FIELD_OPTIONS, MEDIA_FIELD_OPTIONS, MESSAGE_FIELD_OPTIONS, PLACE_FIELD_OPTIONS, POLL_FIELD_OPTIONS, TWEET_FIELD_OPTIONS, USER_FIELD_OPTIONS, } from "./dataFields.mjs";
3
- import { LIST_EXPANSION_OPTIONS, MESSAGE_EXPANSION_OPTIONS, TWEET_EXPANSION_OPTIONS, USER_EXPANSION_OPTIONS, } from "./expansions.mjs";
4
- export async function getUserId() {
5
- let { userNameOrId: id } = this;
6
- if (id === "me" || id === undefined) {
7
- id = await this.app.getAuthenticatedUserId();
8
- }
9
- else if (id.startsWith("@")) {
10
- const userData = await this.app.getUserByUsername(id.slice(1));
11
- id = userData?.data?.id;
12
- if (!id)
13
- throw new ConfigurationError("**User not found!** Check the `User Name or ID` prop.");
14
- }
15
- return id;
3
+
4
+ // components/twitter/common/dataFields.ts
5
+ var LIST_FIELD_OPTIONS = [
6
+ "created_at",
7
+ "follower_count",
8
+ "member_count",
9
+ "private",
10
+ "description",
11
+ "owner_id"
12
+ ];
13
+ var MEDIA_FIELD_OPTIONS = [
14
+ "duration_ms",
15
+ "height",
16
+ "media_key",
17
+ "preview_image_url",
18
+ "type",
19
+ "url",
20
+ "width",
21
+ "public_metrics",
22
+ // "non_public_metrics",
23
+ // "organic_metrics",
24
+ // "promoted_metrics",
25
+ "alt_text",
26
+ "variants"
27
+ ];
28
+ var MESSAGE_FIELD_OPTIONS = [
29
+ "id",
30
+ "text",
31
+ "event_type",
32
+ "created_at",
33
+ "dm_conversation_id",
34
+ "sender_id",
35
+ "participant_ids",
36
+ "referenced_tweets",
37
+ "attachments"
38
+ ];
39
+ var PLACE_FIELD_OPTIONS = [
40
+ "contained_within",
41
+ "country",
42
+ "country_code",
43
+ "full_name",
44
+ "geo",
45
+ "id",
46
+ "name",
47
+ "place_type"
48
+ ];
49
+ var POLL_FIELD_OPTIONS = [
50
+ "duration_minutes",
51
+ "end_datetime",
52
+ "id",
53
+ "options",
54
+ "voting_status"
55
+ ];
56
+ var TWEET_FIELD_OPTIONS = [
57
+ "attachments",
58
+ "author_id",
59
+ "context_annotations",
60
+ "conversation_id",
61
+ "created_at",
62
+ "edit_controls",
63
+ "entities",
64
+ "geo",
65
+ "id",
66
+ "in_reply_to_user_id",
67
+ "lang",
68
+ // "non_public_metrics",
69
+ "public_metrics",
70
+ // "organic_metrics",
71
+ // "promoted_metrics",
72
+ "possibly_sensitive",
73
+ "referenced_tweets",
74
+ "reply_settings",
75
+ "source",
76
+ "text",
77
+ "withheld"
78
+ ];
79
+ var USER_FIELD_OPTIONS = [
80
+ "created_at",
81
+ "description",
82
+ "entities",
83
+ "id",
84
+ "location",
85
+ "name",
86
+ "pinned_tweet_id",
87
+ "profile_image_url",
88
+ "protected",
89
+ "public_metrics",
90
+ "url",
91
+ "username",
92
+ "verified",
93
+ "verified_type",
94
+ "withheld"
95
+ ];
96
+
97
+ // components/twitter/common/expansions.ts
98
+ var LIST_EXPANSION_OPTIONS = [
99
+ "owner_id"
100
+ ];
101
+ var MESSAGE_EXPANSION_OPTIONS = [
102
+ "attachments.media_keys",
103
+ "referenced_tweets.id",
104
+ "sender_id",
105
+ "participant_ids"
106
+ ];
107
+ var TWEET_EXPANSION_OPTIONS = [
108
+ "attachments.poll_ids",
109
+ "attachments.media_keys",
110
+ "author_id",
111
+ "edit_history_tweet_ids",
112
+ "entities.mentions.username",
113
+ "geo.place_id",
114
+ "in_reply_to_user_id",
115
+ "referenced_tweets.id",
116
+ "referenced_tweets.id.author_id"
117
+ ];
118
+ var USER_EXPANSION_OPTIONS = [
119
+ "pinned_tweet_id"
120
+ ];
121
+
122
+ // components/twitter/common/methods.ts
123
+ async function getUserId() {
124
+ let { userNameOrId: id } = this;
125
+ if (id === "me" || id === void 0) {
126
+ id = await this.app.getAuthenticatedUserId();
127
+ } else if (id.startsWith("@")) {
128
+ const userData = await this.app.getUserByUsername(id.slice(1));
129
+ id = userData?.data?.id;
130
+ if (!id) throw new ConfigurationError("**User not found!** Check the `User Name or ID` prop.");
131
+ }
132
+ return id;
16
133
  }
17
- export function getMultiItemSummary(name, length) {
18
- return length
19
- ? `Successfully obtained ${length} ${name}${length === 1
20
- ? ""
21
- : "s"}`
22
- : `No ${name}s were found`;
134
+ function getMultiItemSummary(name, length) {
135
+ return length ? `Successfully obtained ${length} ${name}${length === 1 ? "" : "s"}` : `No ${name}s were found`;
23
136
  }
24
- export function getListFields() {
25
- // See comment on "../common/additionalProps.ts"
26
- /*
27
- const {
28
- includeAllFields, expansions, listFields, userFields,
29
- }: Record<string, string[]> = this;
30
- */
31
- return {
32
- "expansions": LIST_EXPANSION_OPTIONS.join(),
33
- "list.fields": LIST_FIELD_OPTIONS.join(),
34
- "user.fields": USER_FIELD_OPTIONS.join(),
35
- };
137
+ function getListFields() {
138
+ return {
139
+ "expansions": LIST_EXPANSION_OPTIONS.join(),
140
+ "list.fields": LIST_FIELD_OPTIONS.join(),
141
+ "user.fields": USER_FIELD_OPTIONS.join()
142
+ };
36
143
  }
37
- export function getMessageFields() {
38
- /*
39
- const {
40
- includeAllFields,
41
- expansions,
42
- mediaFields,
43
- messageFields,
44
- tweetFields,
45
- userFields,
46
- }: Record<string, string[]> = this;
47
- */
48
- return {
49
- "dm_event.fields": MESSAGE_FIELD_OPTIONS.join(),
50
- "expansions": MESSAGE_EXPANSION_OPTIONS.join(),
51
- "media.fields": MEDIA_FIELD_OPTIONS.join(),
52
- "tweet.fields": TWEET_FIELD_OPTIONS.join(),
53
- "user.fields": USER_FIELD_OPTIONS.join(),
54
- };
144
+ function getMessageFields() {
145
+ return {
146
+ "dm_event.fields": MESSAGE_FIELD_OPTIONS.join(),
147
+ "expansions": MESSAGE_EXPANSION_OPTIONS.join(),
148
+ "media.fields": MEDIA_FIELD_OPTIONS.join(),
149
+ "tweet.fields": TWEET_FIELD_OPTIONS.join(),
150
+ "user.fields": USER_FIELD_OPTIONS.join()
151
+ };
55
152
  }
56
- export function getTweetFields() {
57
- /*
58
- const {
59
- includeAllFields,
60
- expansions,
61
- mediaFields,
62
- placeFields,
63
- pollFields,
64
- tweetFields,
65
- userFields,
66
- }: Record<string, string[]> = this;
67
- */
68
- return {
69
- "expansions": TWEET_EXPANSION_OPTIONS.join(),
70
- "media.fields": MEDIA_FIELD_OPTIONS.join(),
71
- "place.fields": PLACE_FIELD_OPTIONS.join(),
72
- "poll.fields": POLL_FIELD_OPTIONS.join(),
73
- "tweet.fields": TWEET_FIELD_OPTIONS.join(),
74
- "user.fields": USER_FIELD_OPTIONS.join(),
75
- };
153
+ function getTweetFields() {
154
+ return {
155
+ "expansions": TWEET_EXPANSION_OPTIONS.join(),
156
+ "media.fields": MEDIA_FIELD_OPTIONS.join(),
157
+ "place.fields": PLACE_FIELD_OPTIONS.join(),
158
+ "poll.fields": POLL_FIELD_OPTIONS.join(),
159
+ "tweet.fields": TWEET_FIELD_OPTIONS.join(),
160
+ "user.fields": USER_FIELD_OPTIONS.join()
161
+ };
76
162
  }
77
- export function getUserFields() {
78
- /*
79
- const {
80
- includeAllFields, expansions, tweetFields, userFields,
81
- }: Record<string, string[]> = this;
82
- */
83
- return {
84
- "expansions": USER_EXPANSION_OPTIONS.join(),
85
- "tweet.fields": TWEET_FIELD_OPTIONS.join(),
86
- "user.fields": USER_FIELD_OPTIONS.join(),
87
- };
163
+ function getUserFields() {
164
+ return {
165
+ "expansions": USER_EXPANSION_OPTIONS.join(),
166
+ "tweet.fields": TWEET_FIELD_OPTIONS.join(),
167
+ "user.fields": USER_FIELD_OPTIONS.join()
168
+ };
88
169
  }
170
+ export {
171
+ getListFields,
172
+ getMessageFields,
173
+ getMultiItemSummary,
174
+ getTweetFields,
175
+ getUserFields,
176
+ getUserId
177
+ };
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};