corsair 0.1.37 → 0.1.39
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/index.js +427 -43
- package/dist/plugins/index.js +427 -43
- package/dist/plugins/twitterapiio/client.d.ts.map +1 -1
- package/dist/plugins/twitterapiio/endpoints/index.d.ts +220 -66
- package/dist/plugins/twitterapiio/endpoints/index.d.ts.map +1 -1
- package/dist/plugins/twitterapiio/endpoints/replies.d.ts +4 -0
- package/dist/plugins/twitterapiio/endpoints/replies.d.ts.map +1 -0
- package/dist/plugins/twitterapiio/endpoints/stream.d.ts +5 -0
- package/dist/plugins/twitterapiio/endpoints/stream.d.ts.map +1 -0
- package/dist/plugins/twitterapiio/endpoints/tweets.d.ts +0 -1
- package/dist/plugins/twitterapiio/endpoints/tweets.d.ts.map +1 -1
- package/dist/plugins/twitterapiio/endpoints/types.d.ts +1954 -1236
- package/dist/plugins/twitterapiio/endpoints/types.d.ts.map +1 -1
- package/dist/plugins/twitterapiio/endpoints/users.d.ts +1 -0
- package/dist/plugins/twitterapiio/endpoints/users.d.ts.map +1 -1
- package/dist/plugins/twitterapiio/endpoints/webhook-rules.d.ts +6 -0
- package/dist/plugins/twitterapiio/endpoints/webhook-rules.d.ts.map +1 -0
- package/dist/plugins/twitterapiio/index.d.ts +2171 -1429
- package/dist/plugins/twitterapiio/index.d.ts.map +1 -1
- package/dist/plugins/twitterapiio/schema/database.d.ts +534 -0
- package/dist/plugins/twitterapiio/schema/database.d.ts.map +1 -1
- package/dist/plugins/twitterapiio/schema/index.d.ts +213 -1
- package/dist/plugins/twitterapiio/schema/index.d.ts.map +1 -1
- package/dist/plugins/twitterapiio/utils.d.ts +15 -1
- package/dist/plugins/twitterapiio/utils.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -39500,7 +39500,7 @@ async function makeTwitterApiIORequest(endpoint, apiKey, options = {}) {
|
|
|
39500
39500
|
const requestOptions = {
|
|
39501
39501
|
method,
|
|
39502
39502
|
url: endpoint,
|
|
39503
|
-
body: method === "POST" || method === "PUT" || method === "PATCH" ? body : void 0,
|
|
39503
|
+
body: method === "POST" || method === "PUT" || method === "PATCH" || method === "DELETE" ? body : void 0,
|
|
39504
39504
|
mediaType: "application/json; charset=utf-8",
|
|
39505
39505
|
query: method === "GET" ? query : void 0
|
|
39506
39506
|
};
|
|
@@ -39530,6 +39530,20 @@ async function persistTweetWithAuthor(tweet, db) {
|
|
|
39530
39530
|
}
|
|
39531
39531
|
return void 0;
|
|
39532
39532
|
}
|
|
39533
|
+
async function persistReplyWithAuthor(reply2, db) {
|
|
39534
|
+
const { author, ...replyData } = reply2;
|
|
39535
|
+
if (author && db.users) {
|
|
39536
|
+
await db.users.upsertByEntityId(author.id, author);
|
|
39537
|
+
}
|
|
39538
|
+
if (db.replies) {
|
|
39539
|
+
const normalizedReply = {
|
|
39540
|
+
...replyData,
|
|
39541
|
+
...author ? { author: author.id } : {}
|
|
39542
|
+
};
|
|
39543
|
+
return db.replies.upsertByEntityId(reply2.id, normalizedReply);
|
|
39544
|
+
}
|
|
39545
|
+
return void 0;
|
|
39546
|
+
}
|
|
39533
39547
|
|
|
39534
39548
|
// plugins/twitterapiio/endpoints/communities.ts
|
|
39535
39549
|
var getById = async (ctx, input) => {
|
|
@@ -39769,8 +39783,96 @@ var getTweets2 = async (ctx, input) => {
|
|
|
39769
39783
|
return response;
|
|
39770
39784
|
};
|
|
39771
39785
|
|
|
39772
|
-
// plugins/twitterapiio/endpoints/
|
|
39786
|
+
// plugins/twitterapiio/endpoints/replies.ts
|
|
39773
39787
|
var get59 = async (ctx, input) => {
|
|
39788
|
+
const { tweetId, sinceTime, untilTime, cursor } = input;
|
|
39789
|
+
const response = await makeTwitterApiIORequest("/twitter/tweet/replies", ctx.key, {
|
|
39790
|
+
method: "GET",
|
|
39791
|
+
query: { tweetId, sinceTime, untilTime, cursor }
|
|
39792
|
+
});
|
|
39793
|
+
if (response.replies) {
|
|
39794
|
+
try {
|
|
39795
|
+
for (const reply2 of response.replies) {
|
|
39796
|
+
await persistReplyWithAuthor(reply2, ctx.db);
|
|
39797
|
+
}
|
|
39798
|
+
} catch (error) {
|
|
39799
|
+
console.warn("[twitterapiio] Failed to save replies to database:", error);
|
|
39800
|
+
}
|
|
39801
|
+
}
|
|
39802
|
+
await logEventFromContext(
|
|
39803
|
+
ctx,
|
|
39804
|
+
"twitterapiio.replies.get",
|
|
39805
|
+
{ ...input },
|
|
39806
|
+
"completed"
|
|
39807
|
+
);
|
|
39808
|
+
return response;
|
|
39809
|
+
};
|
|
39810
|
+
var getV2 = async (ctx, input) => {
|
|
39811
|
+
const { tweetId, queryType, cursor } = input;
|
|
39812
|
+
const response = await makeTwitterApiIORequest("/twitter/tweet/replies_v2", ctx.key, {
|
|
39813
|
+
method: "GET",
|
|
39814
|
+
query: { tweetId, queryType, cursor }
|
|
39815
|
+
});
|
|
39816
|
+
if (response.replies) {
|
|
39817
|
+
try {
|
|
39818
|
+
for (const reply2 of response.replies) {
|
|
39819
|
+
await persistReplyWithAuthor(reply2, ctx.db);
|
|
39820
|
+
}
|
|
39821
|
+
} catch (error) {
|
|
39822
|
+
console.warn("[twitterapiio] Failed to save replies to database:", error);
|
|
39823
|
+
}
|
|
39824
|
+
}
|
|
39825
|
+
await logEventFromContext(
|
|
39826
|
+
ctx,
|
|
39827
|
+
"twitterapiio.replies.getV2",
|
|
39828
|
+
{ ...input },
|
|
39829
|
+
"completed"
|
|
39830
|
+
);
|
|
39831
|
+
return response;
|
|
39832
|
+
};
|
|
39833
|
+
|
|
39834
|
+
// plugins/twitterapiio/endpoints/stream.ts
|
|
39835
|
+
var addUser = async (ctx, input) => {
|
|
39836
|
+
const response = await makeTwitterApiIORequest("/oapi/x_user_stream/add_user_to_monitor_tweet", ctx.key, {
|
|
39837
|
+
method: "POST",
|
|
39838
|
+
body: { x_user_name: input.userName }
|
|
39839
|
+
});
|
|
39840
|
+
await logEventFromContext(
|
|
39841
|
+
ctx,
|
|
39842
|
+
"twitterapiio.stream.addUser",
|
|
39843
|
+
{ userName: input.userName },
|
|
39844
|
+
"completed"
|
|
39845
|
+
);
|
|
39846
|
+
return response;
|
|
39847
|
+
};
|
|
39848
|
+
var removeUser = async (ctx, input) => {
|
|
39849
|
+
const response = await makeTwitterApiIORequest("/oapi/x_user_stream/remove_user_from_monitor_tweet", ctx.key, {
|
|
39850
|
+
method: "POST",
|
|
39851
|
+
body: { x_user_name: input.userName }
|
|
39852
|
+
});
|
|
39853
|
+
await logEventFromContext(
|
|
39854
|
+
ctx,
|
|
39855
|
+
"twitterapiio.stream.removeUser",
|
|
39856
|
+
{ userName: input.userName },
|
|
39857
|
+
"completed"
|
|
39858
|
+
);
|
|
39859
|
+
return response;
|
|
39860
|
+
};
|
|
39861
|
+
var listUsers = async (ctx, _input) => {
|
|
39862
|
+
const response = await makeTwitterApiIORequest("/oapi/x_user_stream/get_monitor_tweet_users", ctx.key, {
|
|
39863
|
+
method: "GET"
|
|
39864
|
+
});
|
|
39865
|
+
await logEventFromContext(
|
|
39866
|
+
ctx,
|
|
39867
|
+
"twitterapiio.stream.listUsers",
|
|
39868
|
+
{},
|
|
39869
|
+
"completed"
|
|
39870
|
+
);
|
|
39871
|
+
return response;
|
|
39872
|
+
};
|
|
39873
|
+
|
|
39874
|
+
// plugins/twitterapiio/endpoints/trends.ts
|
|
39875
|
+
var get60 = async (ctx, input) => {
|
|
39774
39876
|
const response = await makeTwitterApiIORequest("/twitter/trends", ctx.key, {
|
|
39775
39877
|
method: "GET",
|
|
39776
39878
|
query: { woeid: input.woeid ?? 1 }
|
|
@@ -39906,6 +40008,17 @@ var TwitterApiIOTrend = z70.object({
|
|
|
39906
40008
|
var RawApiTweet = TwitterApiIOTweet.extend({
|
|
39907
40009
|
author: TwitterApiIOUser.optional()
|
|
39908
40010
|
});
|
|
40011
|
+
var TwitterApiIOReply = TwitterApiIOTweet.extend({
|
|
40012
|
+
/** Direct link to the reply tweet on Twitter */
|
|
40013
|
+
url: z70.string().optional(),
|
|
40014
|
+
/** Username of the user being replied to */
|
|
40015
|
+
inReplyToUsername: z70.string().nullable().optional(),
|
|
40016
|
+
/** Whether the reply has been limited/hidden by Twitter */
|
|
40017
|
+
isLimitedReply: z70.boolean().optional()
|
|
40018
|
+
});
|
|
40019
|
+
var RawApiReply = TwitterApiIOReply.extend({
|
|
40020
|
+
author: TwitterApiIOUser.optional()
|
|
40021
|
+
});
|
|
39909
40022
|
|
|
39910
40023
|
// plugins/twitterapiio/endpoints/types.ts
|
|
39911
40024
|
var PaginatedTweetsResponseSchema = z71.object({
|
|
@@ -40136,12 +40249,17 @@ var TweetsGetUserMentionsInputSchema = z71.object({
|
|
|
40136
40249
|
userName: z71.string(),
|
|
40137
40250
|
cursor: z71.string().optional()
|
|
40138
40251
|
});
|
|
40139
|
-
var
|
|
40252
|
+
var RepliesGetInputSchema = z71.object({
|
|
40140
40253
|
tweetId: z71.string(),
|
|
40141
40254
|
sinceTime: z71.string().optional().describe("Unix timestamp in seconds"),
|
|
40142
40255
|
untilTime: z71.string().optional().describe("Unix timestamp in seconds"),
|
|
40143
40256
|
cursor: z71.string().optional()
|
|
40144
40257
|
});
|
|
40258
|
+
var RepliesGetV2InputSchema = z71.object({
|
|
40259
|
+
tweetId: z71.string(),
|
|
40260
|
+
queryType: z71.enum(["Relevance", "Latest", "Likes"]).optional().describe("Sort order for replies. Default is Relevance."),
|
|
40261
|
+
cursor: z71.string().optional()
|
|
40262
|
+
});
|
|
40145
40263
|
var TweetsGetQuotationsInputSchema = z71.object({
|
|
40146
40264
|
tweetId: z71.string(),
|
|
40147
40265
|
cursor: z71.string().optional()
|
|
@@ -40261,9 +40379,58 @@ var CommunitiesLeaveInputSchema = z71.object({
|
|
|
40261
40379
|
communityId: z71.string(),
|
|
40262
40380
|
loginCookie: z71.string().describe("Twitter login cookie from user_login_v2")
|
|
40263
40381
|
});
|
|
40382
|
+
var UsersLoginInputSchema = z71.object({
|
|
40383
|
+
userName: z71.string().describe("Twitter username"),
|
|
40384
|
+
email: z71.string().email().describe("Account email address"),
|
|
40385
|
+
password: z71.string().describe("Account password"),
|
|
40386
|
+
totpSecret: z71.string().optional().describe("TOTP secret for 2FA (from the account profile page)"),
|
|
40387
|
+
proxy: z71.string().describe(
|
|
40388
|
+
"High-quality residential proxy URL (e.g. http://user:pass@host:port)"
|
|
40389
|
+
)
|
|
40390
|
+
});
|
|
40391
|
+
var StreamAddUserInputSchema = z71.object({
|
|
40392
|
+
userName: z71.string().describe("Twitter/X handle to add to the real-time monitor stream")
|
|
40393
|
+
});
|
|
40394
|
+
var StreamRemoveUserInputSchema = z71.object({
|
|
40395
|
+
userName: z71.string().describe("Twitter/X handle to remove from the monitor stream")
|
|
40396
|
+
});
|
|
40397
|
+
var StreamListUsersInputSchema = z71.object({});
|
|
40398
|
+
var TweetFilterRuleSchema = z71.object({
|
|
40399
|
+
rule_id: z71.string(),
|
|
40400
|
+
tag: z71.string().max(255),
|
|
40401
|
+
value: z71.string().max(255),
|
|
40402
|
+
interval_seconds: z71.number().min(100).max(86400)
|
|
40403
|
+
});
|
|
40404
|
+
var WebhookRulesAddInputSchema = z71.object({
|
|
40405
|
+
tag: z71.string().max(255).describe("Custom label to identify this rule"),
|
|
40406
|
+
value: z71.string().max(255).describe(
|
|
40407
|
+
'Filter expression (e.g. "from:elonmusk OR from:kaitoeasyapi"). Rules are inactive until updated with isActive: true.'
|
|
40408
|
+
),
|
|
40409
|
+
intervalSeconds: z71.number().min(100).max(86400).describe(
|
|
40410
|
+
"How often to check for new tweets matching this rule (seconds, 100\u201386400)"
|
|
40411
|
+
)
|
|
40412
|
+
});
|
|
40413
|
+
var WebhookRulesGetInputSchema = z71.object({});
|
|
40414
|
+
var WebhookRulesUpdateInputSchema = z71.object({
|
|
40415
|
+
ruleId: z71.string().describe("ID of the rule to update"),
|
|
40416
|
+
tag: z71.string().max(255).describe("Custom label"),
|
|
40417
|
+
value: z71.string().max(255).describe("Filter expression"),
|
|
40418
|
+
intervalSeconds: z71.number().min(100).max(86400).describe("Check interval in seconds (100\u201386400)"),
|
|
40419
|
+
isActive: z71.boolean().describe("true to activate the rule, false to deactivate")
|
|
40420
|
+
});
|
|
40421
|
+
var WebhookRulesDeleteInputSchema = z71.object({
|
|
40422
|
+
ruleId: z71.string().describe("ID of the rule to delete")
|
|
40423
|
+
});
|
|
40264
40424
|
var TrendsGetInputSchema = z71.object({
|
|
40265
40425
|
woeid: z71.number().optional().describe("Where On Earth ID. 1 = worldwide")
|
|
40266
40426
|
});
|
|
40427
|
+
var PaginatedRepliesResponseSchema = z71.object({
|
|
40428
|
+
status: z71.string().optional(),
|
|
40429
|
+
replies: z71.array(RawApiReply).optional(),
|
|
40430
|
+
next_cursor: z71.string().nullable().optional(),
|
|
40431
|
+
has_next_page: z71.boolean().optional(),
|
|
40432
|
+
message: z71.string().optional()
|
|
40433
|
+
});
|
|
40267
40434
|
var TweetsGetByIdsResponseSchema = z71.object({
|
|
40268
40435
|
status: z71.boolean().optional(),
|
|
40269
40436
|
tweets: z71.array(RawApiTweet).optional()
|
|
@@ -40295,6 +40462,39 @@ var TrendsGetResponseSchema = z71.object({
|
|
|
40295
40462
|
status: z71.boolean().optional(),
|
|
40296
40463
|
trends: z71.array(TwitterApiIOTrend).optional()
|
|
40297
40464
|
});
|
|
40465
|
+
var UsersLoginResponseSchema = z71.object({
|
|
40466
|
+
login_cookie: z71.string().optional(),
|
|
40467
|
+
status: z71.string().optional(),
|
|
40468
|
+
msg: z71.string().optional()
|
|
40469
|
+
});
|
|
40470
|
+
var StreamStatusResponseSchema = z71.object({
|
|
40471
|
+
status: z71.enum(["success", "error"]).optional(),
|
|
40472
|
+
msg: z71.string().optional()
|
|
40473
|
+
});
|
|
40474
|
+
var StreamListUsersResponseSchema = z71.object({
|
|
40475
|
+
users: z71.array(z71.string()).optional().describe("Monitored Twitter usernames"),
|
|
40476
|
+
status: z71.string().optional(),
|
|
40477
|
+
msg: z71.string().optional()
|
|
40478
|
+
});
|
|
40479
|
+
var WebhookRulesAddResponseSchema = z71.object({
|
|
40480
|
+
rule_id: z71.string().optional(),
|
|
40481
|
+
status: z71.string().optional(),
|
|
40482
|
+
msg: z71.string().optional()
|
|
40483
|
+
});
|
|
40484
|
+
var WebhookRulesGetResponseSchema = z71.object({
|
|
40485
|
+
rules: z71.array(TweetFilterRuleSchema).optional(),
|
|
40486
|
+
status: z71.string().optional(),
|
|
40487
|
+
msg: z71.string().optional()
|
|
40488
|
+
});
|
|
40489
|
+
var WebhookRulesUpdateResponseSchema = z71.object({
|
|
40490
|
+
rule_id: z71.string().optional(),
|
|
40491
|
+
status: z71.string().optional(),
|
|
40492
|
+
msg: z71.string().optional()
|
|
40493
|
+
});
|
|
40494
|
+
var WebhookRulesDeleteResponseSchema = z71.object({
|
|
40495
|
+
status: z71.string().optional(),
|
|
40496
|
+
msg: z71.string().optional()
|
|
40497
|
+
});
|
|
40298
40498
|
var TwitterApiIOEndpointInputSchemas = {
|
|
40299
40499
|
tweetsGetByIds: TweetsGetByIdsInputSchema,
|
|
40300
40500
|
tweetsSearch: TweetsSearchInputSchema,
|
|
@@ -40302,7 +40502,6 @@ var TwitterApiIOEndpointInputSchemas = {
|
|
|
40302
40502
|
tweetsGetUserTimeline: TweetsGetUserTimelineInputSchema,
|
|
40303
40503
|
tweetsGetUserLastTweets: TweetsGetUserLastTweetsInputSchema,
|
|
40304
40504
|
tweetsGetUserMentions: TweetsGetUserMentionsInputSchema,
|
|
40305
|
-
tweetsGetReplies: TweetsGetRepliesInputSchema,
|
|
40306
40505
|
tweetsGetQuotations: TweetsGetQuotationsInputSchema,
|
|
40307
40506
|
tweetsGetRetweeters: TweetsGetRetweetersInputSchema,
|
|
40308
40507
|
tweetsGetThreadContext: TweetsGetThreadContextInputSchema,
|
|
@@ -40321,6 +40520,14 @@ var TwitterApiIOEndpointInputSchemas = {
|
|
|
40321
40520
|
usersFollow: UsersFollowInputSchema,
|
|
40322
40521
|
usersUnfollow: UsersUnfollowInputSchema,
|
|
40323
40522
|
usersGetMe: UsersGetMeInputSchema,
|
|
40523
|
+
usersLogin: UsersLoginInputSchema,
|
|
40524
|
+
streamAddUser: StreamAddUserInputSchema,
|
|
40525
|
+
streamRemoveUser: StreamRemoveUserInputSchema,
|
|
40526
|
+
streamListUsers: StreamListUsersInputSchema,
|
|
40527
|
+
apiWebhooksAddRule: WebhookRulesAddInputSchema,
|
|
40528
|
+
apiWebhooksGetRules: WebhookRulesGetInputSchema,
|
|
40529
|
+
apiWebhooksUpdateRule: WebhookRulesUpdateInputSchema,
|
|
40530
|
+
apiWebhooksDeleteRule: WebhookRulesDeleteInputSchema,
|
|
40324
40531
|
listsGetFollowers: ListsGetFollowersInputSchema,
|
|
40325
40532
|
listsGetMembers: ListsGetMembersInputSchema,
|
|
40326
40533
|
listsGetTweets: ListsGetTweetsInputSchema,
|
|
@@ -40333,7 +40540,9 @@ var TwitterApiIOEndpointInputSchemas = {
|
|
|
40333
40540
|
communitiesDelete: CommunitiesDeleteInputSchema,
|
|
40334
40541
|
communitiesJoin: CommunitiesJoinInputSchema,
|
|
40335
40542
|
communitiesLeave: CommunitiesLeaveInputSchema,
|
|
40336
|
-
trendsGet: TrendsGetInputSchema
|
|
40543
|
+
trendsGet: TrendsGetInputSchema,
|
|
40544
|
+
repliesGet: RepliesGetInputSchema,
|
|
40545
|
+
repliesGetV2: RepliesGetV2InputSchema
|
|
40337
40546
|
};
|
|
40338
40547
|
var TwitterApiIOEndpointOutputSchemas = {
|
|
40339
40548
|
tweetsGetByIds: TweetsGetByIdsResponseSchema,
|
|
@@ -40342,7 +40551,6 @@ var TwitterApiIOEndpointOutputSchemas = {
|
|
|
40342
40551
|
tweetsGetUserTimeline: PaginatedTweetsResponseSchema,
|
|
40343
40552
|
tweetsGetUserLastTweets: PaginatedTweetsResponseSchema,
|
|
40344
40553
|
tweetsGetUserMentions: PaginatedTweetsResponseSchema,
|
|
40345
|
-
tweetsGetReplies: PaginatedTweetsResponseSchema,
|
|
40346
40554
|
tweetsGetQuotations: PaginatedTweetsResponseSchema,
|
|
40347
40555
|
tweetsGetRetweeters: PaginatedUsersResponseSchema,
|
|
40348
40556
|
tweetsGetThreadContext: PaginatedTweetsResponseSchema,
|
|
@@ -40361,6 +40569,14 @@ var TwitterApiIOEndpointOutputSchemas = {
|
|
|
40361
40569
|
usersFollow: ActionResponseSchema,
|
|
40362
40570
|
usersUnfollow: ActionResponseSchema,
|
|
40363
40571
|
usersGetMe: UserGetResponseSchema2,
|
|
40572
|
+
usersLogin: UsersLoginResponseSchema,
|
|
40573
|
+
streamAddUser: StreamStatusResponseSchema,
|
|
40574
|
+
streamRemoveUser: StreamStatusResponseSchema,
|
|
40575
|
+
streamListUsers: StreamListUsersResponseSchema,
|
|
40576
|
+
apiWebhooksAddRule: WebhookRulesAddResponseSchema,
|
|
40577
|
+
apiWebhooksGetRules: WebhookRulesGetResponseSchema,
|
|
40578
|
+
apiWebhooksUpdateRule: WebhookRulesUpdateResponseSchema,
|
|
40579
|
+
apiWebhooksDeleteRule: WebhookRulesDeleteResponseSchema,
|
|
40364
40580
|
listsGetFollowers: PaginatedUsersResponseSchema,
|
|
40365
40581
|
listsGetMembers: PaginatedUsersResponseSchema,
|
|
40366
40582
|
listsGetTweets: PaginatedTweetsResponseSchema,
|
|
@@ -40373,7 +40589,9 @@ var TwitterApiIOEndpointOutputSchemas = {
|
|
|
40373
40589
|
communitiesDelete: ActionResponseSchema,
|
|
40374
40590
|
communitiesJoin: ActionResponseSchema,
|
|
40375
40591
|
communitiesLeave: ActionResponseSchema,
|
|
40376
|
-
trendsGet: TrendsGetResponseSchema
|
|
40592
|
+
trendsGet: TrendsGetResponseSchema,
|
|
40593
|
+
repliesGet: PaginatedRepliesResponseSchema,
|
|
40594
|
+
repliesGetV2: PaginatedRepliesResponseSchema
|
|
40377
40595
|
};
|
|
40378
40596
|
|
|
40379
40597
|
// plugins/twitterapiio/endpoints/tweets.ts
|
|
@@ -40524,29 +40742,6 @@ var getUserMentions = async (ctx, input) => {
|
|
|
40524
40742
|
);
|
|
40525
40743
|
return response;
|
|
40526
40744
|
};
|
|
40527
|
-
var getReplies2 = async (ctx, input) => {
|
|
40528
|
-
const { tweetId, sinceTime, untilTime, cursor } = input;
|
|
40529
|
-
const response = await makeTwitterApiIORequest("/twitter/tweet/replies", ctx.key, {
|
|
40530
|
-
method: "GET",
|
|
40531
|
-
query: { tweetId, sinceTime, untilTime, cursor }
|
|
40532
|
-
});
|
|
40533
|
-
if (response.tweets) {
|
|
40534
|
-
try {
|
|
40535
|
-
for (const tweet of response.tweets) {
|
|
40536
|
-
await persistTweetWithAuthor(tweet, ctx.db);
|
|
40537
|
-
}
|
|
40538
|
-
} catch (error) {
|
|
40539
|
-
console.warn("[twitterapiio] Failed to save tweets to database:", error);
|
|
40540
|
-
}
|
|
40541
|
-
}
|
|
40542
|
-
await logEventFromContext(
|
|
40543
|
-
ctx,
|
|
40544
|
-
"twitterapiio.tweets.getReplies",
|
|
40545
|
-
{ ...input },
|
|
40546
|
-
"completed"
|
|
40547
|
-
);
|
|
40548
|
-
return response;
|
|
40549
|
-
};
|
|
40550
40745
|
var getQuotations = async (ctx, input) => {
|
|
40551
40746
|
const response = await makeTwitterApiIORequest("/twitter/tweet/quotes", ctx.key, {
|
|
40552
40747
|
method: "GET",
|
|
@@ -40864,6 +41059,26 @@ var unfollow = async (ctx, input) => {
|
|
|
40864
41059
|
);
|
|
40865
41060
|
return response;
|
|
40866
41061
|
};
|
|
41062
|
+
var login = async (ctx, input) => {
|
|
41063
|
+
const { userName, email, password, totpSecret, proxy } = input;
|
|
41064
|
+
const response = await makeTwitterApiIORequest("/twitter/user_login_v2", ctx.key, {
|
|
41065
|
+
method: "POST",
|
|
41066
|
+
body: {
|
|
41067
|
+
user_name: userName,
|
|
41068
|
+
email,
|
|
41069
|
+
password,
|
|
41070
|
+
proxy,
|
|
41071
|
+
...totpSecret ? { totp_secret: totpSecret } : {}
|
|
41072
|
+
}
|
|
41073
|
+
});
|
|
41074
|
+
await logEventFromContext(
|
|
41075
|
+
ctx,
|
|
41076
|
+
"twitterapiio.users.login",
|
|
41077
|
+
{ userName },
|
|
41078
|
+
"completed"
|
|
41079
|
+
);
|
|
41080
|
+
return response;
|
|
41081
|
+
};
|
|
40867
41082
|
var getMe = async (ctx, input) => {
|
|
40868
41083
|
const response = await makeTwitterApiIORequest("/twitter/user/me", ctx.key, {
|
|
40869
41084
|
method: "GET",
|
|
@@ -40880,6 +41095,69 @@ var getMe = async (ctx, input) => {
|
|
|
40880
41095
|
return response;
|
|
40881
41096
|
};
|
|
40882
41097
|
|
|
41098
|
+
// plugins/twitterapiio/endpoints/webhook-rules.ts
|
|
41099
|
+
var addRule = async (ctx, input) => {
|
|
41100
|
+
const response = await makeTwitterApiIORequest("/oapi/tweet_filter/add_rule", ctx.key, {
|
|
41101
|
+
method: "POST",
|
|
41102
|
+
body: {
|
|
41103
|
+
tag: input.tag,
|
|
41104
|
+
value: input.value,
|
|
41105
|
+
interval_seconds: input.intervalSeconds
|
|
41106
|
+
}
|
|
41107
|
+
});
|
|
41108
|
+
await logEventFromContext(
|
|
41109
|
+
ctx,
|
|
41110
|
+
"twitterapiio.api.webhooks.addRule",
|
|
41111
|
+
{ tag: input.tag },
|
|
41112
|
+
"completed"
|
|
41113
|
+
);
|
|
41114
|
+
return response;
|
|
41115
|
+
};
|
|
41116
|
+
var getRules = async (ctx, _input) => {
|
|
41117
|
+
const response = await makeTwitterApiIORequest("/oapi/tweet_filter/get_rules", ctx.key, {
|
|
41118
|
+
method: "GET"
|
|
41119
|
+
});
|
|
41120
|
+
await logEventFromContext(
|
|
41121
|
+
ctx,
|
|
41122
|
+
"twitterapiio.api.webhooks.getRules",
|
|
41123
|
+
{},
|
|
41124
|
+
"completed"
|
|
41125
|
+
);
|
|
41126
|
+
return response;
|
|
41127
|
+
};
|
|
41128
|
+
var updateRule = async (ctx, input) => {
|
|
41129
|
+
const response = await makeTwitterApiIORequest("/oapi/tweet_filter/update_rule", ctx.key, {
|
|
41130
|
+
method: "POST",
|
|
41131
|
+
body: {
|
|
41132
|
+
rule_id: input.ruleId,
|
|
41133
|
+
tag: input.tag,
|
|
41134
|
+
value: input.value,
|
|
41135
|
+
interval_seconds: input.intervalSeconds,
|
|
41136
|
+
is_effect: input.isActive ? 1 : 0
|
|
41137
|
+
}
|
|
41138
|
+
});
|
|
41139
|
+
await logEventFromContext(
|
|
41140
|
+
ctx,
|
|
41141
|
+
"twitterapiio.api.webhooks.updateRule",
|
|
41142
|
+
{ ruleId: input.ruleId },
|
|
41143
|
+
"completed"
|
|
41144
|
+
);
|
|
41145
|
+
return response;
|
|
41146
|
+
};
|
|
41147
|
+
var deleteRule = async (ctx, input) => {
|
|
41148
|
+
const response = await makeTwitterApiIORequest("/oapi/tweet_filter/delete_rule", ctx.key, {
|
|
41149
|
+
method: "DELETE",
|
|
41150
|
+
body: { rule_id: input.ruleId }
|
|
41151
|
+
});
|
|
41152
|
+
await logEventFromContext(
|
|
41153
|
+
ctx,
|
|
41154
|
+
"twitterapiio.api.webhooks.deleteRule",
|
|
41155
|
+
{ ruleId: input.ruleId },
|
|
41156
|
+
"completed"
|
|
41157
|
+
);
|
|
41158
|
+
return response;
|
|
41159
|
+
};
|
|
41160
|
+
|
|
40883
41161
|
// plugins/twitterapiio/endpoints/index.ts
|
|
40884
41162
|
var TweetsEndpoints = {
|
|
40885
41163
|
getByIds,
|
|
@@ -40888,7 +41166,6 @@ var TweetsEndpoints = {
|
|
|
40888
41166
|
getUserTimeline,
|
|
40889
41167
|
getUserLastTweets,
|
|
40890
41168
|
getUserMentions,
|
|
40891
|
-
getReplies: getReplies2,
|
|
40892
41169
|
getQuotations,
|
|
40893
41170
|
getRetweeters,
|
|
40894
41171
|
getThreadContext,
|
|
@@ -40898,6 +41175,10 @@ var TweetsEndpoints = {
|
|
|
40898
41175
|
unlike,
|
|
40899
41176
|
retweet
|
|
40900
41177
|
};
|
|
41178
|
+
var RepliesEndpoints = {
|
|
41179
|
+
get: get59,
|
|
41180
|
+
getV2
|
|
41181
|
+
};
|
|
40901
41182
|
var UsersEndpoints = {
|
|
40902
41183
|
getByUsername,
|
|
40903
41184
|
batchGetByIds,
|
|
@@ -40908,7 +41189,19 @@ var UsersEndpoints = {
|
|
|
40908
41189
|
checkFollowRelationship,
|
|
40909
41190
|
follow,
|
|
40910
41191
|
unfollow,
|
|
40911
|
-
getMe
|
|
41192
|
+
getMe,
|
|
41193
|
+
login
|
|
41194
|
+
};
|
|
41195
|
+
var StreamEndpoints = {
|
|
41196
|
+
addUser,
|
|
41197
|
+
removeUser,
|
|
41198
|
+
listUsers
|
|
41199
|
+
};
|
|
41200
|
+
var WebhookRulesEndpoints = {
|
|
41201
|
+
addRule,
|
|
41202
|
+
getRules,
|
|
41203
|
+
updateRule,
|
|
41204
|
+
deleteRule
|
|
40912
41205
|
};
|
|
40913
41206
|
var ListsEndpoints = {
|
|
40914
41207
|
getFollowers,
|
|
@@ -40927,7 +41220,7 @@ var CommunitiesEndpoints = {
|
|
|
40927
41220
|
leave: leave2
|
|
40928
41221
|
};
|
|
40929
41222
|
var TrendsEndpoints = {
|
|
40930
|
-
get:
|
|
41223
|
+
get: get60
|
|
40931
41224
|
};
|
|
40932
41225
|
|
|
40933
41226
|
// plugins/twitterapiio/error-handlers.ts
|
|
@@ -41042,6 +41335,7 @@ var TwitterApiIOSchema = {
|
|
|
41042
41335
|
entities: {
|
|
41043
41336
|
users: TwitterApiIOUser,
|
|
41044
41337
|
tweets: TwitterApiIOTweet,
|
|
41338
|
+
replies: TwitterApiIOReply,
|
|
41045
41339
|
lists: TwitterApiIOList,
|
|
41046
41340
|
communities: TwitterApiIOCommunity,
|
|
41047
41341
|
trends: TwitterApiIOTrend
|
|
@@ -41238,7 +41532,6 @@ var twitterApiIOEndpointsNested = {
|
|
|
41238
41532
|
getUserTimeline: TweetsEndpoints.getUserTimeline,
|
|
41239
41533
|
getUserLastTweets: TweetsEndpoints.getUserLastTweets,
|
|
41240
41534
|
getUserMentions: TweetsEndpoints.getUserMentions,
|
|
41241
|
-
getReplies: TweetsEndpoints.getReplies,
|
|
41242
41535
|
getQuotations: TweetsEndpoints.getQuotations,
|
|
41243
41536
|
getRetweeters: TweetsEndpoints.getRetweeters,
|
|
41244
41537
|
getThreadContext: TweetsEndpoints.getThreadContext,
|
|
@@ -41248,6 +41541,10 @@ var twitterApiIOEndpointsNested = {
|
|
|
41248
41541
|
unlike: TweetsEndpoints.unlike,
|
|
41249
41542
|
retweet: TweetsEndpoints.retweet
|
|
41250
41543
|
},
|
|
41544
|
+
replies: {
|
|
41545
|
+
get: RepliesEndpoints.get,
|
|
41546
|
+
getV2: RepliesEndpoints.getV2
|
|
41547
|
+
},
|
|
41251
41548
|
users: {
|
|
41252
41549
|
getByUsername: UsersEndpoints.getByUsername,
|
|
41253
41550
|
batchGetByIds: UsersEndpoints.batchGetByIds,
|
|
@@ -41258,7 +41555,21 @@ var twitterApiIOEndpointsNested = {
|
|
|
41258
41555
|
checkFollowRelationship: UsersEndpoints.checkFollowRelationship,
|
|
41259
41556
|
follow: UsersEndpoints.follow,
|
|
41260
41557
|
unfollow: UsersEndpoints.unfollow,
|
|
41261
|
-
getMe: UsersEndpoints.getMe
|
|
41558
|
+
getMe: UsersEndpoints.getMe,
|
|
41559
|
+
login: UsersEndpoints.login
|
|
41560
|
+
},
|
|
41561
|
+
stream: {
|
|
41562
|
+
addUser: StreamEndpoints.addUser,
|
|
41563
|
+
removeUser: StreamEndpoints.removeUser,
|
|
41564
|
+
listUsers: StreamEndpoints.listUsers
|
|
41565
|
+
},
|
|
41566
|
+
api: {
|
|
41567
|
+
webhooks: {
|
|
41568
|
+
addRule: WebhookRulesEndpoints.addRule,
|
|
41569
|
+
getRules: WebhookRulesEndpoints.getRules,
|
|
41570
|
+
updateRule: WebhookRulesEndpoints.updateRule,
|
|
41571
|
+
deleteRule: WebhookRulesEndpoints.deleteRule
|
|
41572
|
+
}
|
|
41262
41573
|
},
|
|
41263
41574
|
lists: {
|
|
41264
41575
|
getFollowers: ListsEndpoints.getFollowers,
|
|
@@ -41311,10 +41622,6 @@ var twitterApiIOEndpointSchemas = {
|
|
|
41311
41622
|
input: TwitterApiIOEndpointInputSchemas.tweetsGetUserMentions,
|
|
41312
41623
|
output: TwitterApiIOEndpointOutputSchemas.tweetsGetUserMentions
|
|
41313
41624
|
},
|
|
41314
|
-
"tweets.getReplies": {
|
|
41315
|
-
input: TwitterApiIOEndpointInputSchemas.tweetsGetReplies,
|
|
41316
|
-
output: TwitterApiIOEndpointOutputSchemas.tweetsGetReplies
|
|
41317
|
-
},
|
|
41318
41625
|
"tweets.getQuotations": {
|
|
41319
41626
|
input: TwitterApiIOEndpointInputSchemas.tweetsGetQuotations,
|
|
41320
41627
|
output: TwitterApiIOEndpointOutputSchemas.tweetsGetQuotations
|
|
@@ -41387,6 +41694,38 @@ var twitterApiIOEndpointSchemas = {
|
|
|
41387
41694
|
input: TwitterApiIOEndpointInputSchemas.usersGetMe,
|
|
41388
41695
|
output: TwitterApiIOEndpointOutputSchemas.usersGetMe
|
|
41389
41696
|
},
|
|
41697
|
+
"users.login": {
|
|
41698
|
+
input: TwitterApiIOEndpointInputSchemas.usersLogin,
|
|
41699
|
+
output: TwitterApiIOEndpointOutputSchemas.usersLogin
|
|
41700
|
+
},
|
|
41701
|
+
"stream.addUser": {
|
|
41702
|
+
input: TwitterApiIOEndpointInputSchemas.streamAddUser,
|
|
41703
|
+
output: TwitterApiIOEndpointOutputSchemas.streamAddUser
|
|
41704
|
+
},
|
|
41705
|
+
"stream.removeUser": {
|
|
41706
|
+
input: TwitterApiIOEndpointInputSchemas.streamRemoveUser,
|
|
41707
|
+
output: TwitterApiIOEndpointOutputSchemas.streamRemoveUser
|
|
41708
|
+
},
|
|
41709
|
+
"stream.listUsers": {
|
|
41710
|
+
input: TwitterApiIOEndpointInputSchemas.streamListUsers,
|
|
41711
|
+
output: TwitterApiIOEndpointOutputSchemas.streamListUsers
|
|
41712
|
+
},
|
|
41713
|
+
"api.webhooks.addRule": {
|
|
41714
|
+
input: TwitterApiIOEndpointInputSchemas.apiWebhooksAddRule,
|
|
41715
|
+
output: TwitterApiIOEndpointOutputSchemas.apiWebhooksAddRule
|
|
41716
|
+
},
|
|
41717
|
+
"api.webhooks.getRules": {
|
|
41718
|
+
input: TwitterApiIOEndpointInputSchemas.apiWebhooksGetRules,
|
|
41719
|
+
output: TwitterApiIOEndpointOutputSchemas.apiWebhooksGetRules
|
|
41720
|
+
},
|
|
41721
|
+
"api.webhooks.updateRule": {
|
|
41722
|
+
input: TwitterApiIOEndpointInputSchemas.apiWebhooksUpdateRule,
|
|
41723
|
+
output: TwitterApiIOEndpointOutputSchemas.apiWebhooksUpdateRule
|
|
41724
|
+
},
|
|
41725
|
+
"api.webhooks.deleteRule": {
|
|
41726
|
+
input: TwitterApiIOEndpointInputSchemas.apiWebhooksDeleteRule,
|
|
41727
|
+
output: TwitterApiIOEndpointOutputSchemas.apiWebhooksDeleteRule
|
|
41728
|
+
},
|
|
41390
41729
|
"lists.getFollowers": {
|
|
41391
41730
|
input: TwitterApiIOEndpointInputSchemas.listsGetFollowers,
|
|
41392
41731
|
output: TwitterApiIOEndpointOutputSchemas.listsGetFollowers
|
|
@@ -41438,6 +41777,14 @@ var twitterApiIOEndpointSchemas = {
|
|
|
41438
41777
|
"trends.get": {
|
|
41439
41778
|
input: TwitterApiIOEndpointInputSchemas.trendsGet,
|
|
41440
41779
|
output: TwitterApiIOEndpointOutputSchemas.trendsGet
|
|
41780
|
+
},
|
|
41781
|
+
"replies.get": {
|
|
41782
|
+
input: TwitterApiIOEndpointInputSchemas.repliesGet,
|
|
41783
|
+
output: TwitterApiIOEndpointOutputSchemas.repliesGet
|
|
41784
|
+
},
|
|
41785
|
+
"replies.getV2": {
|
|
41786
|
+
input: TwitterApiIOEndpointInputSchemas.repliesGetV2,
|
|
41787
|
+
output: TwitterApiIOEndpointOutputSchemas.repliesGetV2
|
|
41441
41788
|
}
|
|
41442
41789
|
};
|
|
41443
41790
|
var twitterApiIOWebhookSchemas = {
|
|
@@ -41477,10 +41824,6 @@ var twitterApiIOEndpointMeta = {
|
|
|
41477
41824
|
riskLevel: "read",
|
|
41478
41825
|
description: "Get tweets that mention a user"
|
|
41479
41826
|
},
|
|
41480
|
-
"tweets.getReplies": {
|
|
41481
|
-
riskLevel: "read",
|
|
41482
|
-
description: "Get replies to a tweet"
|
|
41483
|
-
},
|
|
41484
41827
|
"tweets.getQuotations": {
|
|
41485
41828
|
riskLevel: "read",
|
|
41486
41829
|
description: "Get quote tweets for a tweet"
|
|
@@ -41539,6 +41882,39 @@ var twitterApiIOEndpointMeta = {
|
|
|
41539
41882
|
riskLevel: "read",
|
|
41540
41883
|
description: "Get the authenticated account info"
|
|
41541
41884
|
},
|
|
41885
|
+
"users.login": {
|
|
41886
|
+
riskLevel: "write",
|
|
41887
|
+
description: "Authenticate a Twitter account via credentials and obtain a login cookie for v2 endpoints"
|
|
41888
|
+
},
|
|
41889
|
+
"stream.addUser": {
|
|
41890
|
+
riskLevel: "write",
|
|
41891
|
+
description: "Add a Twitter user to the real-time tweet monitor stream"
|
|
41892
|
+
},
|
|
41893
|
+
"stream.removeUser": {
|
|
41894
|
+
riskLevel: "write",
|
|
41895
|
+
description: "Remove a Twitter user from the real-time tweet monitor stream"
|
|
41896
|
+
},
|
|
41897
|
+
"stream.listUsers": {
|
|
41898
|
+
riskLevel: "read",
|
|
41899
|
+
description: "List all Twitter users currently in the monitor stream"
|
|
41900
|
+
},
|
|
41901
|
+
"api.webhooks.addRule": {
|
|
41902
|
+
riskLevel: "write",
|
|
41903
|
+
description: "Create a new tweet filter rule for the webhook stream (inactive by default \u2014 call updateRule to activate)"
|
|
41904
|
+
},
|
|
41905
|
+
"api.webhooks.getRules": {
|
|
41906
|
+
riskLevel: "read",
|
|
41907
|
+
description: "List all existing tweet filter rules"
|
|
41908
|
+
},
|
|
41909
|
+
"api.webhooks.updateRule": {
|
|
41910
|
+
riskLevel: "write",
|
|
41911
|
+
description: "Update a tweet filter rule, including activating or deactivating it"
|
|
41912
|
+
},
|
|
41913
|
+
"api.webhooks.deleteRule": {
|
|
41914
|
+
riskLevel: "destructive",
|
|
41915
|
+
description: "Permanently delete a tweet filter rule",
|
|
41916
|
+
irreversible: true
|
|
41917
|
+
},
|
|
41542
41918
|
"lists.getFollowers": {
|
|
41543
41919
|
riskLevel: "read",
|
|
41544
41920
|
description: "Get followers of a Twitter list"
|
|
@@ -41591,6 +41967,14 @@ var twitterApiIOEndpointMeta = {
|
|
|
41591
41967
|
"trends.get": {
|
|
41592
41968
|
riskLevel: "read",
|
|
41593
41969
|
description: "Get trending topics by location (woeid)"
|
|
41970
|
+
},
|
|
41971
|
+
"replies.get": {
|
|
41972
|
+
riskLevel: "read",
|
|
41973
|
+
description: "Get replies to a tweet, paginated by time range \u2014 stored independently in the replies table so engagement changes are tracked per reply"
|
|
41974
|
+
},
|
|
41975
|
+
"replies.getV2": {
|
|
41976
|
+
riskLevel: "read",
|
|
41977
|
+
description: "Get replies to a tweet (v2) with sort order control (Relevance, Latest, Likes) \u2014 stored independently in the replies table so engagement changes are tracked per reply"
|
|
41594
41978
|
}
|
|
41595
41979
|
};
|
|
41596
41980
|
var defaultAuthType23 = "api_key";
|