@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.
- package/dist/actions/add-user-to-list/add-user-to-list.mjs +545 -45
- package/dist/actions/create-tweet/create-tweet.mjs +542 -76
- package/dist/actions/delete-tweet/delete-tweet.mjs +513 -29
- package/dist/actions/follow-user/follow-user.mjs +538 -38
- package/dist/actions/get-tweet/get-tweet.mjs +622 -35
- package/dist/actions/get-user/get-user.mjs +596 -39
- package/dist/actions/like-tweet/like-tweet.mjs +515 -31
- package/dist/actions/list-favorites/list-favorites.mjs +657 -51
- package/dist/actions/list-followers/list-followers.mjs +614 -51
- package/dist/actions/list-lists/list-lists.mjs +597 -51
- package/dist/actions/list-mentions/list-mentions.mjs +657 -51
- package/dist/actions/list-user-tweets/list-user-tweets.mjs +657 -51
- package/dist/actions/retweet/retweet.mjs +519 -34
- package/dist/actions/send-dm/send-dm.mjs +546 -44
- package/dist/actions/simple-search/simple-search.mjs +646 -51
- package/dist/actions/simple-search-in-list/simple-search-in-list.mjs +656 -58
- package/dist/actions/unfollow-user/unfollow-user.mjs +533 -34
- package/dist/actions/unlike-tweet/unlike-tweet.mjs +513 -29
- package/dist/actions/upload-media/upload-media.mjs +549 -52
- package/dist/app/twitter.app.mjs +443 -342
- package/dist/common/addObjIncludes.mjs +89 -63
- package/dist/common/additionalProps.mjs +0 -138
- package/dist/common/appValidation.mjs +475 -24
- package/dist/common/constants.mjs +11 -7
- package/dist/common/dataFields.mjs +100 -89
- package/dist/common/errorMessage.mjs +32 -26
- package/dist/common/expansions.mjs +26 -19
- package/dist/common/methods.mjs +170 -81
- package/dist/common/types/fields.mjs +0 -1
- package/dist/common/types/includeMapping.mjs +0 -1
- package/dist/common/types/requestParams.mjs +0 -1
- package/dist/common/types/responseSchemas.mjs +0 -1
- package/dist/sources/common/base.mjs +546 -69
- package/dist/sources/common/cacheUserId.mjs +32 -15
- package/dist/sources/common/getItemSummary.mjs +13 -9
- package/dist/sources/new-follower-of-user/new-follower-of-user.mjs +799 -40
- package/dist/sources/new-list-followed/new-list-followed.mjs +722 -41
- package/dist/sources/new-mention-received-by-user/new-mention-received-by-user.mjs +860 -40
- package/dist/sources/new-message/new-message.mjs +738 -32
- package/dist/sources/new-tweet-in-list/new-tweet-in-list.mjs +839 -37
- package/dist/sources/new-tweet-liked-by-user/new-tweet-liked-by-user.mjs +860 -40
- package/dist/sources/new-tweet-metrics/new-tweet-metrics.mjs +629 -59
- package/dist/sources/new-tweet-posted-by-user/new-tweet-posted-by-user.mjs +860 -40
- package/dist/sources/new-tweet-posted-matching-query/new-tweet-posted-matching-query.mjs +830 -39
- package/dist/sources/new-unfollower-of-user/new-unfollower-of-user.mjs +829 -70
- package/dist/sources/new-user-followed/new-user-followed.mjs +737 -41
- package/package.json +3 -3
- package/dist/actions/add-user-to-list/add-user-to-list.d.ts +0 -6
- package/dist/actions/create-tweet/create-tweet.d.ts +0 -105
- package/dist/actions/delete-tweet/delete-tweet.d.ts +0 -4
- package/dist/actions/follow-user/follow-user.d.ts +0 -6
- package/dist/actions/get-tweet/get-tweet.d.ts +0 -6
- package/dist/actions/get-user/get-user.d.ts +0 -7
- package/dist/actions/like-tweet/like-tweet.d.ts +0 -4
- package/dist/actions/list-favorites/list-favorites.d.ts +0 -10
- package/dist/actions/list-followers/list-followers.d.ts +0 -10
- package/dist/actions/list-lists/list-lists.d.ts +0 -8
- package/dist/actions/list-mentions/list-mentions.d.ts +0 -10
- package/dist/actions/list-user-tweets/list-user-tweets.d.ts +0 -10
- package/dist/actions/retweet/retweet.d.ts +0 -4
- package/dist/actions/send-dm/send-dm.d.ts +0 -6
- package/dist/actions/simple-search/simple-search.d.ts +0 -9
- package/dist/actions/simple-search-in-list/simple-search-in-list.d.ts +0 -9
- package/dist/actions/unfollow-user/unfollow-user.d.ts +0 -6
- package/dist/actions/unlike-tweet/unlike-tweet.d.ts +0 -4
- package/dist/actions/upload-media/upload-media.d.ts +0 -4
- package/dist/app/twitter.app.d.ts +0 -69
- package/dist/common/addObjIncludes.d.ts +0 -9
- package/dist/common/additionalProps.d.ts +0 -0
- package/dist/common/appValidation.d.ts +0 -144
- package/dist/common/constants.d.ts +0 -7
- package/dist/common/dataFields.d.ts +0 -8
- package/dist/common/errorMessage.d.ts +0 -25
- package/dist/common/expansions.d.ts +0 -4
- package/dist/common/methods.d.ts +0 -27
- package/dist/common/types/fields.d.ts +0 -25
- package/dist/common/types/includeMapping.d.ts +0 -11
- package/dist/common/types/requestParams.d.ts +0 -126
- package/dist/common/types/responseSchemas.d.ts +0 -82
- package/dist/sources/common/base.d.ts +0 -163
- package/dist/sources/common/cacheUserId.d.ts +0 -7
- package/dist/sources/common/getItemSummary.d.ts +0 -4
- package/dist/sources/new-follower-of-user/new-follower-of-user.d.ts +0 -17
- package/dist/sources/new-list-followed/new-list-followed.d.ts +0 -17
- package/dist/sources/new-mention-received-by-user/new-mention-received-by-user.d.ts +0 -17
- package/dist/sources/new-message/new-message.d.ts +0 -15
- package/dist/sources/new-tweet-in-list/new-tweet-in-list.d.ts +0 -15
- package/dist/sources/new-tweet-liked-by-user/new-tweet-liked-by-user.d.ts +0 -17
- package/dist/sources/new-tweet-metrics/new-tweet-metrics.d.ts +0 -13
- package/dist/sources/new-tweet-posted-by-user/new-tweet-posted-by-user.d.ts +0 -17
- package/dist/sources/new-tweet-posted-matching-query/new-tweet-posted-matching-query.d.ts +0 -15
- package/dist/sources/new-unfollower-of-user/new-unfollower-of-user.d.ts +0 -17
- package/dist/sources/new-user-followed/new-user-followed.d.ts +0 -17
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,70 +1,96 @@
|
|
|
1
|
-
//
|
|
1
|
+
// components/twitter/common/addObjIncludes.ts
|
|
2
2
|
function flatClearIncludeIds(obj) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
return Object.fromEntries(
|
|
4
|
+
Object.entries(obj).map(([
|
|
5
|
+
key,
|
|
6
|
+
value
|
|
7
|
+
]) => [
|
|
8
|
+
key,
|
|
9
|
+
value.filter((e) => e !== void 0).flat()
|
|
10
|
+
])
|
|
11
|
+
);
|
|
7
12
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
function getDirectMessageIncludeIds(obj) {
|
|
14
|
+
return flatClearIncludeIds({
|
|
15
|
+
userIds: [
|
|
16
|
+
obj.sender_id,
|
|
17
|
+
obj.participant_ids
|
|
18
|
+
],
|
|
19
|
+
mediaKeys: [
|
|
20
|
+
obj.attachments?.media_keys
|
|
21
|
+
],
|
|
22
|
+
tweetIds: [
|
|
23
|
+
obj.referenced_tweets?.map(({ id }) => id)
|
|
24
|
+
]
|
|
25
|
+
});
|
|
21
26
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
function getListIncludeIds(obj) {
|
|
28
|
+
return flatClearIncludeIds({
|
|
29
|
+
userIds: [
|
|
30
|
+
obj.owner_id
|
|
31
|
+
]
|
|
32
|
+
});
|
|
28
33
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
function getUserIncludeIds(obj) {
|
|
35
|
+
return flatClearIncludeIds({
|
|
36
|
+
tweetIds: [
|
|
37
|
+
obj.pinned_tweet_id
|
|
38
|
+
]
|
|
39
|
+
});
|
|
35
40
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
41
|
+
function getTweetIncludeIds(obj) {
|
|
42
|
+
return flatClearIncludeIds({
|
|
43
|
+
userIds: [
|
|
44
|
+
obj.author_id,
|
|
45
|
+
obj.in_reply_to_user_id
|
|
46
|
+
],
|
|
47
|
+
userNames: [
|
|
48
|
+
obj.entities?.mentions?.map(({ username }) => username)
|
|
49
|
+
],
|
|
50
|
+
tweetIds: [
|
|
51
|
+
obj.edit_history_tweet_ids,
|
|
52
|
+
obj.referenced_tweets?.map(({ id }) => id)
|
|
53
|
+
],
|
|
54
|
+
pollIds: [
|
|
55
|
+
obj.attachments?.poll_ids
|
|
56
|
+
],
|
|
57
|
+
placeIds: [
|
|
58
|
+
obj.geo?.place_id
|
|
59
|
+
],
|
|
60
|
+
mediaKeys: [
|
|
61
|
+
obj.attachments?.media_keys
|
|
62
|
+
]
|
|
63
|
+
});
|
|
59
64
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
function getObjIncludes(obj, includes = {}, getIncludeIds) {
|
|
66
|
+
const {
|
|
67
|
+
userIds,
|
|
68
|
+
userNames,
|
|
69
|
+
tweetIds,
|
|
70
|
+
pollIds,
|
|
71
|
+
placeIds,
|
|
72
|
+
mediaKeys
|
|
73
|
+
} = getIncludeIds(obj);
|
|
74
|
+
const result = {
|
|
75
|
+
media: includes.media?.filter((item) => mediaKeys?.includes(item.media_key)),
|
|
76
|
+
users: includes.users?.filter(
|
|
77
|
+
(item) => userIds?.includes(item.id) || userNames?.includes(item.username)
|
|
78
|
+
),
|
|
79
|
+
places: includes.places?.filter((item) => placeIds?.includes(item.id)),
|
|
80
|
+
polls: includes.polls?.filter((item) => pollIds?.includes(item.id)),
|
|
81
|
+
tweets: includes.tweets?.filter((item) => tweetIds?.includes(item.id))
|
|
82
|
+
};
|
|
83
|
+
return Object.fromEntries(
|
|
84
|
+
Object.entries(result).filter(([
|
|
85
|
+
,
|
|
86
|
+
value
|
|
87
|
+
]) => value?.length > 0)
|
|
88
|
+
);
|
|
70
89
|
}
|
|
90
|
+
export {
|
|
91
|
+
getDirectMessageIncludeIds,
|
|
92
|
+
getListIncludeIds,
|
|
93
|
+
getObjIncludes,
|
|
94
|
+
getTweetIncludeIds,
|
|
95
|
+
getUserIncludeIds
|
|
96
|
+
};
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
// This is no longer being used. Requests send all the available fields by default.
|
|
2
|
-
// If it ever makes sense to allow customizing which fields are sent, this can be re-enabled
|
|
3
|
-
/*
|
|
4
|
-
import {
|
|
5
|
-
LIST_FIELD_OPTIONS,
|
|
6
|
-
MEDIA_FIELD_OPTIONS,
|
|
7
|
-
PLACE_FIELD_OPTIONS,
|
|
8
|
-
POLL_FIELD_OPTIONS,
|
|
9
|
-
TWEET_FIELD_OPTIONS,
|
|
10
|
-
USER_FIELD_OPTIONS,
|
|
11
|
-
} from "./dataFields";
|
|
12
|
-
import {
|
|
13
|
-
LIST_EXPANSION_OPTIONS,
|
|
14
|
-
TWEET_EXPANSION_OPTIONS,
|
|
15
|
-
USER_EXPANSION_OPTIONS,
|
|
16
|
-
} from "./expansions";
|
|
17
|
-
|
|
18
|
-
// These cannot be propDefinitions in the app file, because additionalProps() needs them to be primitives
|
|
19
|
-
const listExpansions = {
|
|
20
|
-
type: "string[]",
|
|
21
|
-
label: "Expansions",
|
|
22
|
-
optional: true,
|
|
23
|
-
description:
|
|
24
|
-
"Additional data objects related to the List(s) to be included in the response.",
|
|
25
|
-
options: LIST_EXPANSION_OPTIONS,
|
|
26
|
-
};
|
|
27
|
-
const tweetExpansions = {
|
|
28
|
-
type: "string[]",
|
|
29
|
-
label: "Expansions",
|
|
30
|
-
optional: true,
|
|
31
|
-
description:
|
|
32
|
-
"Additional data objects related to the Tweet(s) to be included in the response.",
|
|
33
|
-
options: TWEET_EXPANSION_OPTIONS,
|
|
34
|
-
};
|
|
35
|
-
const userExpansions = {
|
|
36
|
-
type: "string[]",
|
|
37
|
-
label: "Expansions",
|
|
38
|
-
optional: true,
|
|
39
|
-
description:
|
|
40
|
-
"Additional data objects related to the User(s) to be included in the response.",
|
|
41
|
-
options: USER_EXPANSION_OPTIONS,
|
|
42
|
-
};
|
|
43
|
-
const listFields = {
|
|
44
|
-
type: "string[]",
|
|
45
|
-
label: "List Fields",
|
|
46
|
-
description:
|
|
47
|
-
"Specific [list fields](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/lists) to be included in the returned list object.",
|
|
48
|
-
optional: true,
|
|
49
|
-
options: LIST_FIELD_OPTIONS,
|
|
50
|
-
};
|
|
51
|
-
const mediaFields = {
|
|
52
|
-
type: "string[]",
|
|
53
|
-
label: "Media Fields",
|
|
54
|
-
description:
|
|
55
|
-
"Specific [media fields](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/media) to be included in the returned Tweet(s). Only applicable if the Tweet contains media and you've requested the `attachments.media_keys` expansion.",
|
|
56
|
-
optional: true,
|
|
57
|
-
options: MEDIA_FIELD_OPTIONS,
|
|
58
|
-
};
|
|
59
|
-
const placeFields = {
|
|
60
|
-
type: "string[]",
|
|
61
|
-
label: "Place Fields",
|
|
62
|
-
description:
|
|
63
|
-
"Specific [place fields](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/place) to be included in the returned Tweet(s). Only applicable if the Tweet contains a place and you've requested the `geo.place_id` expansion.",
|
|
64
|
-
optional: true,
|
|
65
|
-
options: PLACE_FIELD_OPTIONS,
|
|
66
|
-
};
|
|
67
|
-
const pollFields = {
|
|
68
|
-
type: "string[]",
|
|
69
|
-
label: "Poll Fields",
|
|
70
|
-
description:
|
|
71
|
-
"Specific [poll fields](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/poll) to be included in the returned Tweet(s). Only applicable if the Tweet contains a poll and you've requested the `attachments.poll_ids` expansion.",
|
|
72
|
-
optional: true,
|
|
73
|
-
options: POLL_FIELD_OPTIONS,
|
|
74
|
-
};
|
|
75
|
-
const tweetFields = {
|
|
76
|
-
type: "string[]",
|
|
77
|
-
label: "Tweet Fields",
|
|
78
|
-
description:
|
|
79
|
-
"Specific [tweet fields](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet) to be included in the returned Tweet(s). If you've requested the `referenced_tweets.id` expansion, these fields will also be returned for any included referenced Tweets.",
|
|
80
|
-
optional: true,
|
|
81
|
-
options: TWEET_FIELD_OPTIONS,
|
|
82
|
-
};
|
|
83
|
-
const userFields = {
|
|
84
|
-
type: "string[]",
|
|
85
|
-
label: "User Fields",
|
|
86
|
-
description:
|
|
87
|
-
"Specific [user fields](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/user) to be included in the returned Tweet(s). Only applicable if you've requested one of the user expansions: `author_id`, `entities.mentions.username`, `in_reply_to_user_id`, `referenced_tweets.id.author_id`.",
|
|
88
|
-
optional: true,
|
|
89
|
-
options: USER_FIELD_OPTIONS,
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
// The 'any' here is needed because of the additionalProps behavior
|
|
93
|
-
|
|
94
|
-
export async function listAdditionalProps(): Promise<Record<string, any>> {
|
|
95
|
-
return this.includeAllFields === false
|
|
96
|
-
? {
|
|
97
|
-
expansions: listExpansions,
|
|
98
|
-
listFields,
|
|
99
|
-
userFields: {
|
|
100
|
-
...userFields,
|
|
101
|
-
description:
|
|
102
|
-
"Specific [user fields](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/user) to be included in the returned user object. Only applicable if you've requested the `owner_id` expansion.",
|
|
103
|
-
},
|
|
104
|
-
}
|
|
105
|
-
: {};
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export async function tweetAdditionalProps(): Promise<Record<string, any>> {
|
|
109
|
-
return this.includeAllFields === false
|
|
110
|
-
? {
|
|
111
|
-
expansions: tweetExpansions,
|
|
112
|
-
mediaFields,
|
|
113
|
-
placeFields,
|
|
114
|
-
pollFields,
|
|
115
|
-
tweetFields,
|
|
116
|
-
userFields,
|
|
117
|
-
}
|
|
118
|
-
: {};
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export async function userAdditionalProps(): Promise<Record<string, any>> {
|
|
122
|
-
return this.includeAllFields === false
|
|
123
|
-
? {
|
|
124
|
-
expansions: userExpansions,
|
|
125
|
-
tweetFields: {
|
|
126
|
-
...tweetFields,
|
|
127
|
-
description:
|
|
128
|
-
"Specific [tweet fields](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet) to be included in the returned pinned Tweet. Only applicable if the user has a pinned Tweet and you've requested the `referenced_tweets.id` expansion.",
|
|
129
|
-
},
|
|
130
|
-
userFields: {
|
|
131
|
-
...userFields,
|
|
132
|
-
description:
|
|
133
|
-
"Specific [user fields](https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/user) to be included in the returned user object.",
|
|
134
|
-
},
|
|
135
|
-
}
|
|
136
|
-
: {};
|
|
137
|
-
}
|
|
138
|
-
*/
|