@credal/actions 0.2.106 → 0.2.108
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/README.md +2 -2
- package/dist/actions/actionMapper.js +19 -1
- package/dist/actions/autogen/templates.d.ts +3 -0
- package/dist/actions/autogen/templates.js +733 -0
- package/dist/actions/autogen/types.d.ts +1278 -0
- package/dist/actions/autogen/types.js +269 -0
- package/dist/actions/groups.js +14 -1
- package/dist/actions/parse.d.ts +3 -3
- package/dist/actions/providers/confluence/updatePage.d.ts +3 -0
- package/dist/actions/providers/confluence/updatePage.js +46 -0
- package/dist/actions/providers/generic/fillTemplateAction.d.ts +7 -0
- package/dist/actions/providers/generic/fillTemplateAction.js +18 -0
- package/dist/actions/providers/generic/genericApiCall.d.ts +3 -0
- package/dist/actions/providers/generic/genericApiCall.js +38 -0
- package/dist/actions/providers/github/getBranch.d.ts +7 -0
- package/dist/actions/providers/github/getBranch.js +67 -0
- package/dist/actions/providers/github/getPullRequestDetails.d.ts +3 -0
- package/dist/actions/providers/github/getPullRequestDetails.js +61 -0
- package/dist/actions/providers/github/listCommits.d.ts +3 -0
- package/dist/actions/providers/github/listCommits.js +73 -0
- package/dist/actions/providers/google-oauth/editAGoogleCalendarEvent.js +9 -1
- package/dist/actions/providers/google-oauth/getDriveContentById.d.ts +3 -0
- package/dist/actions/providers/google-oauth/getDriveContentById.js +161 -0
- package/dist/actions/providers/google-oauth/listCalendarEvents.js +3 -0
- package/dist/actions/providers/google-oauth/scheduleCalendarMeeting.js +2 -0
- package/dist/actions/providers/google-oauth/searchAndGetDriveContentByKeywords.d.ts +3 -0
- package/dist/actions/providers/google-oauth/searchAndGetDriveContentByKeywords.js +47 -0
- package/dist/actions/providers/google-oauth/searchDriveAndGetContentByKeywords.d.ts +3 -0
- package/dist/actions/providers/google-oauth/searchDriveAndGetContentByKeywords.js +110 -0
- package/dist/actions/providers/google-oauth/searchDriveAndGetContentByQuery.d.ts +3 -0
- package/dist/actions/providers/google-oauth/searchDriveAndGetContentByQuery.js +78 -0
- package/dist/actions/providers/google-oauth/utils/extractContentFromDriveFileId.d.ts +15 -0
- package/dist/actions/providers/google-oauth/utils/extractContentFromDriveFileId.js +129 -0
- package/dist/actions/providers/googlemaps/nearbysearch.d.ts +3 -0
- package/dist/actions/providers/googlemaps/nearbysearch.js +96 -0
- package/dist/actions/providers/slack/archiveChannel.js +5 -9
- package/dist/actions/providers/snowflake/runSnowflakeQueryWriteResultsToS3.d.ts +3 -0
- package/dist/actions/providers/snowflake/runSnowflakeQueryWriteResultsToS3.js +154 -0
- package/dist/actions/providers/x/scrapeTweetDataWithNitter.d.ts +3 -0
- package/dist/actions/providers/x/scrapeTweetDataWithNitter.js +45 -0
- package/dist/utils/datetime.d.ts +1 -0
- package/dist/utils/datetime.js +7 -0
- package/package.json +1 -1
- package/dist/actions/providers/google-oauth/listGmailThreads.d.ts +0 -3
- package/dist/actions/providers/google-oauth/listGmailThreads.js +0 -98
- package/dist/actions/providers/google-oauth/searchGmailMessages.d.ts +0 -3
- package/dist/actions/providers/google-oauth/searchGmailMessages.js +0 -91
- package/dist/actions/providers/jamf/getComputerInventory.d.ts +0 -3
- package/dist/actions/providers/jamf/getComputerInventory.js +0 -45
- package/dist/actions/providers/jamf/getFileVaultRecoveryKey.d.ts +0 -3
- package/dist/actions/providers/jamf/getFileVaultRecoveryKey.js +0 -40
- package/dist/actions/providers/jamf/restartJamfComputerById.d.ts +0 -3
- package/dist/actions/providers/jamf/restartJamfComputerById.js +0 -37
- package/dist/actions/providers/jamf/types.d.ts +0 -8
- package/dist/actions/providers/jamf/types.js +0 -7
|
@@ -1546,6 +1546,10 @@ export const googleOauthScheduleCalendarMeetingOutputSchema = z.object({
|
|
|
1546
1546
|
success: z.boolean().describe("Whether the meeting was scheduled successfully"),
|
|
1547
1547
|
eventId: z.string().describe("The ID of the event that was scheduled").optional(),
|
|
1548
1548
|
eventUrl: z.string().describe("The URL to access the scheduled event").optional(),
|
|
1549
|
+
eventDayOfWeek: z
|
|
1550
|
+
.string()
|
|
1551
|
+
.describe("The day of the week when the event is scheduled (e.g., Monday, Tuesday, etc.)")
|
|
1552
|
+
.optional(),
|
|
1549
1553
|
error: z.string().describe("The error that occurred if the meeting was not scheduled successfully").optional(),
|
|
1550
1554
|
});
|
|
1551
1555
|
export const googleOauthListCalendarsParamsSchema = z.object({
|
|
@@ -1583,7 +1587,15 @@ export const googleOauthListCalendarEventsOutputSchema = z.object({
|
|
|
1583
1587
|
description: z.string().describe("Description of the event").optional(),
|
|
1584
1588
|
location: z.string().describe("Geographic location of the event as free-form text").optional(),
|
|
1585
1589
|
start: z.string().describe("Start date/time (for timed events, RFC3339 timestamp)").optional(),
|
|
1590
|
+
startDayOfWeek: z
|
|
1591
|
+
.string()
|
|
1592
|
+
.describe("The day of the week when the event starts (e.g., Monday, Tuesday, etc.)")
|
|
1593
|
+
.optional(),
|
|
1586
1594
|
end: z.string().describe("End date/time (for timed events, RFC3339 timestamp)").optional(),
|
|
1595
|
+
endDayOfWeek: z
|
|
1596
|
+
.string()
|
|
1597
|
+
.describe("The day of the week when the event ends (e.g., Monday, Tuesday, etc.)")
|
|
1598
|
+
.optional(),
|
|
1587
1599
|
attendees: z
|
|
1588
1600
|
.array(z.object({
|
|
1589
1601
|
email: z.string().describe("The attendee's email address").optional(),
|
|
@@ -1679,6 +1691,10 @@ export const googleOauthEditAGoogleCalendarEventOutputSchema = z.object({
|
|
|
1679
1691
|
success: z.boolean().describe("Whether the event was edited successfully"),
|
|
1680
1692
|
eventId: z.string().describe("The ID of the edited event").optional(),
|
|
1681
1693
|
eventUrl: z.string().describe("The URL to access the edited event").optional(),
|
|
1694
|
+
eventDayOfWeek: z
|
|
1695
|
+
.string()
|
|
1696
|
+
.describe("The day of the week when the edited event occurs (e.g., Monday, Tuesday, etc.)")
|
|
1697
|
+
.optional(),
|
|
1682
1698
|
error: z.string().describe("The error that occurred if the event was not edited successfully").optional(),
|
|
1683
1699
|
});
|
|
1684
1700
|
export const googleOauthDeleteCalendarEventParamsSchema = z.object({
|
|
@@ -3569,6 +3585,100 @@ export const githubListPullRequestsOutputSchema = z.object({
|
|
|
3569
3585
|
}))
|
|
3570
3586
|
.describe("A list of pull requests in the repository"),
|
|
3571
3587
|
});
|
|
3588
|
+
export const githubGetPullRequestDetailsParamsSchema = z.object({
|
|
3589
|
+
repositoryOwner: z.string().describe("The owner of the repository"),
|
|
3590
|
+
repositoryName: z.string().describe("The name of the repository"),
|
|
3591
|
+
pullRequestNumber: z.number().describe("The number of the pull request to get details for"),
|
|
3592
|
+
});
|
|
3593
|
+
export const githubGetPullRequestDetailsOutputSchema = z.object({
|
|
3594
|
+
success: z.boolean().describe("Whether the operation was successful"),
|
|
3595
|
+
error: z.string().describe("The error that occurred if the operation was not successful").optional(),
|
|
3596
|
+
pullRequest: z
|
|
3597
|
+
.object({
|
|
3598
|
+
number: z.number().describe("The number of the pull request").optional(),
|
|
3599
|
+
title: z.string().describe("The title of the pull request").optional(),
|
|
3600
|
+
description: z.string().nullable().describe("The body/description of the pull request").optional(),
|
|
3601
|
+
state: z.enum(["open", "closed", "merged"]).describe("The state of the pull request").optional(),
|
|
3602
|
+
draft: z.boolean().describe("Whether the pull request is a draft").optional(),
|
|
3603
|
+
url: z.string().describe("The API URL of the pull request").optional(),
|
|
3604
|
+
htmlUrl: z.string().describe("The web URL of the pull request").optional(),
|
|
3605
|
+
createdAt: z.string().describe("The date and time when the pull request was created").optional(),
|
|
3606
|
+
updatedAt: z.string().describe("The date and time when the pull request was last updated").optional(),
|
|
3607
|
+
closedAt: z.string().nullable().describe("The date and time when the pull request was closed").optional(),
|
|
3608
|
+
mergedAt: z.string().nullable().describe("The date and time when the pull request was merged").optional(),
|
|
3609
|
+
author: z
|
|
3610
|
+
.object({ login: z.string().describe("The username of the pull request author").optional() })
|
|
3611
|
+
.describe("The user who created the pull request")
|
|
3612
|
+
.optional(),
|
|
3613
|
+
assignees: z
|
|
3614
|
+
.array(z.object({ login: z.string().describe("The username of the assignee").optional() }))
|
|
3615
|
+
.describe("Users assigned to the pull request")
|
|
3616
|
+
.optional(),
|
|
3617
|
+
reviewers: z
|
|
3618
|
+
.array(z.object({ login: z.string().describe("The username of the reviewer").optional() }))
|
|
3619
|
+
.describe("Users requested to review the pull request")
|
|
3620
|
+
.optional(),
|
|
3621
|
+
labels: z
|
|
3622
|
+
.array(z.object({
|
|
3623
|
+
name: z.string().describe("The name of the label").optional(),
|
|
3624
|
+
color: z.string().describe("The color of the label").optional(),
|
|
3625
|
+
description: z.string().nullable().describe("The description of the label").optional(),
|
|
3626
|
+
}))
|
|
3627
|
+
.describe("Labels applied to the pull request")
|
|
3628
|
+
.optional(),
|
|
3629
|
+
head: z
|
|
3630
|
+
.object({
|
|
3631
|
+
ref: z.string().describe("The name of the head branch").optional(),
|
|
3632
|
+
sha: z.string().describe("The SHA of the head commit").optional(),
|
|
3633
|
+
repo: z
|
|
3634
|
+
.object({
|
|
3635
|
+
name: z.string().describe("The name of the head repository").optional(),
|
|
3636
|
+
fullName: z.string().describe("The full name of the head repository").optional(),
|
|
3637
|
+
owner: z
|
|
3638
|
+
.object({ login: z.string().describe("The username of the head repository owner").optional() })
|
|
3639
|
+
.optional(),
|
|
3640
|
+
})
|
|
3641
|
+
.optional(),
|
|
3642
|
+
})
|
|
3643
|
+
.describe("The head branch of the pull request")
|
|
3644
|
+
.optional(),
|
|
3645
|
+
base: z
|
|
3646
|
+
.object({
|
|
3647
|
+
ref: z.string().describe("The name of the base branch").optional(),
|
|
3648
|
+
sha: z.string().describe("The SHA of the base commit").optional(),
|
|
3649
|
+
repo: z
|
|
3650
|
+
.object({
|
|
3651
|
+
name: z.string().describe("The name of the base repository").optional(),
|
|
3652
|
+
fullName: z.string().describe("The full name of the base repository").optional(),
|
|
3653
|
+
owner: z
|
|
3654
|
+
.object({ login: z.string().describe("The username of the base repository owner").optional() })
|
|
3655
|
+
.optional(),
|
|
3656
|
+
})
|
|
3657
|
+
.optional(),
|
|
3658
|
+
})
|
|
3659
|
+
.describe("The base branch of the pull request")
|
|
3660
|
+
.optional(),
|
|
3661
|
+
mergeable: z.boolean().nullable().describe("Whether the pull request can be merged").optional(),
|
|
3662
|
+
mergeableState: z.string().nullable().describe("The mergeable state of the pull request").optional(),
|
|
3663
|
+
merged: z.boolean().describe("Whether the pull request has been merged").optional(),
|
|
3664
|
+
commits: z.number().describe("The number of commits in the pull request").optional(),
|
|
3665
|
+
additions: z.number().describe("The number of additions in the pull request").optional(),
|
|
3666
|
+
deletions: z.number().describe("The number of deletions in the pull request").optional(),
|
|
3667
|
+
changedFiles: z.number().describe("The number of files changed in the pull request").optional(),
|
|
3668
|
+
milestone: z
|
|
3669
|
+
.object({
|
|
3670
|
+
title: z.string().describe("The title of the milestone").optional(),
|
|
3671
|
+
description: z.string().nullable().describe("The description of the milestone").optional(),
|
|
3672
|
+
state: z.string().describe("The state of the milestone").optional(),
|
|
3673
|
+
dueOn: z.string().nullable().describe("The due date of the milestone").optional(),
|
|
3674
|
+
})
|
|
3675
|
+
.nullable()
|
|
3676
|
+
.describe("The milestone associated with the pull request")
|
|
3677
|
+
.optional(),
|
|
3678
|
+
})
|
|
3679
|
+
.describe("Detailed information about the pull request")
|
|
3680
|
+
.optional(),
|
|
3681
|
+
});
|
|
3572
3682
|
export const githubGetFileContentParamsSchema = z.object({
|
|
3573
3683
|
organization: z.string().describe("The organization that owns the repository"),
|
|
3574
3684
|
repository: z.string().describe("The repository name"),
|
|
@@ -3729,6 +3839,165 @@ export const githubSearchOrganizationOutputSchema = z.object({
|
|
|
3729
3839
|
}))
|
|
3730
3840
|
.describe("A list of issues and pull requests that match the query"),
|
|
3731
3841
|
});
|
|
3842
|
+
export const githubGetBranchParamsSchema = z.object({
|
|
3843
|
+
repositoryOwner: z.string().describe("The owner of the repository"),
|
|
3844
|
+
repositoryName: z.string().describe("The name of the repository"),
|
|
3845
|
+
branchName: z.string().describe("The name of the branch to retrieve"),
|
|
3846
|
+
});
|
|
3847
|
+
export const githubGetBranchOutputSchema = z.object({
|
|
3848
|
+
success: z.boolean().describe("Whether the operation was successful"),
|
|
3849
|
+
error: z.string().describe("The error that occurred if the operation was not successful").optional(),
|
|
3850
|
+
branch: z
|
|
3851
|
+
.object({
|
|
3852
|
+
name: z.string().describe("The name of the branch").optional(),
|
|
3853
|
+
commit: z
|
|
3854
|
+
.object({
|
|
3855
|
+
sha: z.string().describe("The SHA of the commit").optional(),
|
|
3856
|
+
node_id: z.string().describe("The node ID of the commit").optional(),
|
|
3857
|
+
url: z.string().describe("The API URL of the commit").optional(),
|
|
3858
|
+
html_url: z.string().describe("The HTML URL of the commit").optional(),
|
|
3859
|
+
comments_url: z.string().describe("The URL for commit comments").optional(),
|
|
3860
|
+
commit: z
|
|
3861
|
+
.object({
|
|
3862
|
+
author: z
|
|
3863
|
+
.object({ name: z.string().optional(), email: z.string().optional(), date: z.string().optional() })
|
|
3864
|
+
.nullable()
|
|
3865
|
+
.describe("The commit author")
|
|
3866
|
+
.optional(),
|
|
3867
|
+
committer: z
|
|
3868
|
+
.object({ name: z.string().optional(), email: z.string().optional(), date: z.string().optional() })
|
|
3869
|
+
.nullable()
|
|
3870
|
+
.describe("The commit committer")
|
|
3871
|
+
.optional(),
|
|
3872
|
+
message: z.string().describe("The commit message").optional(),
|
|
3873
|
+
tree: z
|
|
3874
|
+
.object({ sha: z.string().optional(), url: z.string().optional() })
|
|
3875
|
+
.describe("The commit tree")
|
|
3876
|
+
.optional(),
|
|
3877
|
+
url: z.string().describe("The commit URL").optional(),
|
|
3878
|
+
comment_count: z.number().int().describe("Number of comments on the commit").optional(),
|
|
3879
|
+
})
|
|
3880
|
+
.describe("The git commit object")
|
|
3881
|
+
.optional(),
|
|
3882
|
+
author: z
|
|
3883
|
+
.object({
|
|
3884
|
+
login: z.string().optional(),
|
|
3885
|
+
id: z.number().int().optional(),
|
|
3886
|
+
node_id: z.string().optional(),
|
|
3887
|
+
avatar_url: z.string().optional(),
|
|
3888
|
+
html_url: z.string().optional(),
|
|
3889
|
+
type: z.string().optional(),
|
|
3890
|
+
})
|
|
3891
|
+
.nullable()
|
|
3892
|
+
.describe("The commit author user")
|
|
3893
|
+
.optional(),
|
|
3894
|
+
committer: z
|
|
3895
|
+
.object({
|
|
3896
|
+
login: z.string().optional(),
|
|
3897
|
+
id: z.number().int().optional(),
|
|
3898
|
+
node_id: z.string().optional(),
|
|
3899
|
+
avatar_url: z.string().optional(),
|
|
3900
|
+
html_url: z.string().optional(),
|
|
3901
|
+
type: z.string().optional(),
|
|
3902
|
+
})
|
|
3903
|
+
.nullable()
|
|
3904
|
+
.describe("The commit committer user")
|
|
3905
|
+
.optional(),
|
|
3906
|
+
parents: z
|
|
3907
|
+
.array(z.object({ sha: z.string().optional(), url: z.string().optional(), html_url: z.string().optional() }))
|
|
3908
|
+
.describe("The commit parents")
|
|
3909
|
+
.optional(),
|
|
3910
|
+
})
|
|
3911
|
+
.describe("The commit information")
|
|
3912
|
+
.optional(),
|
|
3913
|
+
_links: z
|
|
3914
|
+
.object({
|
|
3915
|
+
html: z.string().describe("The HTML URL of the branch").optional(),
|
|
3916
|
+
self: z.string().describe("The API URL of the branch").optional(),
|
|
3917
|
+
})
|
|
3918
|
+
.describe("Links related to the branch")
|
|
3919
|
+
.optional(),
|
|
3920
|
+
protected: z.boolean().describe("Whether the branch is protected").optional(),
|
|
3921
|
+
protection: z
|
|
3922
|
+
.object({
|
|
3923
|
+
enabled: z.boolean().describe("Whether protection is enabled").optional(),
|
|
3924
|
+
required_status_checks: z
|
|
3925
|
+
.object({
|
|
3926
|
+
enforcement_level: z.string().optional(),
|
|
3927
|
+
contexts: z.array(z.string()).optional(),
|
|
3928
|
+
strict: z.boolean().optional(),
|
|
3929
|
+
})
|
|
3930
|
+
.nullable()
|
|
3931
|
+
.describe("Required status checks")
|
|
3932
|
+
.optional(),
|
|
3933
|
+
})
|
|
3934
|
+
.nullable()
|
|
3935
|
+
.describe("Branch protection details")
|
|
3936
|
+
.optional(),
|
|
3937
|
+
protection_url: z.string().describe("The URL of the branch protection settings").optional(),
|
|
3938
|
+
})
|
|
3939
|
+
.describe("The branch information")
|
|
3940
|
+
.optional(),
|
|
3941
|
+
});
|
|
3942
|
+
export const githubListCommitsParamsSchema = z.object({
|
|
3943
|
+
repositoryOwner: z.string().describe("The owner of the repository"),
|
|
3944
|
+
repositoryName: z.string().describe("The name of the repository"),
|
|
3945
|
+
branch: z.string().describe("The branch to list commits from (defaults to default branch)").optional(),
|
|
3946
|
+
since: z
|
|
3947
|
+
.string()
|
|
3948
|
+
.describe("Only show commits after this date (ISO 8601 format, e.g., 2023-01-01T00:00:00Z)")
|
|
3949
|
+
.optional(),
|
|
3950
|
+
until: z
|
|
3951
|
+
.string()
|
|
3952
|
+
.describe("Only show commits before this date (ISO 8601 format, e.g., 2023-12-31T23:59:59Z)")
|
|
3953
|
+
.optional(),
|
|
3954
|
+
author: z.string().describe("Filter commits by author (GitHub username or email)").optional(),
|
|
3955
|
+
perPage: z.number().describe("Number of commits to return per page (default 30, max 100)").optional(),
|
|
3956
|
+
page: z.number().describe("Page number for pagination (default 1)").optional(),
|
|
3957
|
+
});
|
|
3958
|
+
export const githubListCommitsOutputSchema = z.object({
|
|
3959
|
+
success: z.boolean().describe("Whether the operation was successful"),
|
|
3960
|
+
error: z.string().describe("The error that occurred if the operation was not successful").optional(),
|
|
3961
|
+
commits: z
|
|
3962
|
+
.array(z.object({
|
|
3963
|
+
sha: z.string().describe("The SHA hash of the commit"),
|
|
3964
|
+
url: z.string().describe("The API URL of the commit"),
|
|
3965
|
+
htmlUrl: z.string().describe("The web URL of the commit"),
|
|
3966
|
+
commit: z.object({
|
|
3967
|
+
message: z.string().describe("The commit message"),
|
|
3968
|
+
author: z.object({
|
|
3969
|
+
name: z.string().describe("The name of the commit author"),
|
|
3970
|
+
email: z.string().describe("The email of the commit author"),
|
|
3971
|
+
date: z.string().describe("The date when the commit was authored (ISO 8601 format)"),
|
|
3972
|
+
}),
|
|
3973
|
+
committer: z.object({
|
|
3974
|
+
name: z.string().describe("The name of the commit committer"),
|
|
3975
|
+
email: z.string().describe("The email of the commit committer"),
|
|
3976
|
+
date: z.string().describe("The date when the commit was committed (ISO 8601 format)"),
|
|
3977
|
+
}),
|
|
3978
|
+
tree: z.object({
|
|
3979
|
+
sha: z.string().describe("The SHA of the tree object"),
|
|
3980
|
+
url: z.string().describe("The API URL of the tree object"),
|
|
3981
|
+
}),
|
|
3982
|
+
commentCount: z.number().describe("The number of comments on the commit").optional(),
|
|
3983
|
+
}),
|
|
3984
|
+
author: z
|
|
3985
|
+
.object({ login: z.string().describe("The GitHub username of the commit author").optional() })
|
|
3986
|
+
.nullable(),
|
|
3987
|
+
parents: z
|
|
3988
|
+
.array(z.object({
|
|
3989
|
+
sha: z.string().describe("The SHA of the parent commit"),
|
|
3990
|
+
url: z.string().describe("The API URL of the parent commit"),
|
|
3991
|
+
htmlUrl: z.string().describe("The web URL of the parent commit"),
|
|
3992
|
+
}))
|
|
3993
|
+
.describe("The parent commits")
|
|
3994
|
+
.optional(),
|
|
3995
|
+
}))
|
|
3996
|
+
.describe("List of commits in the repository")
|
|
3997
|
+
.optional(),
|
|
3998
|
+
totalCount: z.number().describe("Total number of commits (if available)").optional(),
|
|
3999
|
+
hasMore: z.boolean().describe("Whether there are more commits available on subsequent pages").optional(),
|
|
4000
|
+
});
|
|
3732
4001
|
export const notionSearchByTitleParamsSchema = z.object({
|
|
3733
4002
|
query: z.string().describe("The query to search for in Notion titles"),
|
|
3734
4003
|
});
|
package/dist/actions/groups.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { genericFillTemplateDefinition, confluenceOverwritePageDefinition, googlemapsValidateAddressDefinition, mathAddDefinition, mongoInsertMongoDocDefinition, slackSendMessageDefinition, slackGetChannelMessagesDefinition, slackCreateChannelDefinition, slackArchiveChannelDefinition, snowflakeGetRowByFieldValueDefinition, zendeskCreateZendeskTicketDefinition, zendeskListZendeskTicketsDefinition, zendeskGetTicketDetailsDefinition, zendeskUpdateTicketStatusDefinition, zendeskAddCommentToTicketDefinition, zendeskAssignTicketDefinition, openstreetmapGetLatitudeLongitudeFromLocationDefinition, nwsGetForecastForLocationDefinition, jiraAssignJiraTicketDefinition, jiraCommentJiraTicketDefinition, jiraCreateJiraTicketDefinition, jiraGetJiraTicketDetailsDefinition, jiraGetJiraTicketHistoryDefinition, jiraUpdateJiraTicketDetailsDefinition, jiraUpdateJiraTicketStatusDefinition, jiraGetServiceDesksDefinition, jiraCreateServiceDeskRequestDefinition, googlemapsNearbysearchRestaurantsDefinition, firecrawlScrapeUrlDefinition, resendSendEmailDefinition, linkedinCreateShareLinkedinPostUrlDefinition, googleOauthCreateNewGoogleDocDefinition, xCreateShareXPostUrlDefinition, firecrawlScrapeTweetDataWithNitterDefinition, finnhubSymbolLookupDefinition, finnhubGetBasicFinancialsDefinition, confluenceFetchPageContentDefinition, snowflakeRunSnowflakeQueryDefinition, lookerEnableUserByEmailDefinition, googleOauthUpdateDocDefinition, googleOauthScheduleCalendarMeetingDefinition, googleOauthListCalendarsDefinition, googleOauthListCalendarEventsDefinition, googleOauthUpdateCalendarEventDefinition, googleOauthDeleteCalendarEventDefinition, googleOauthCreateSpreadsheetDefinition, googleOauthUpdateSpreadsheetDefinition, googleOauthCreatePresentationDefinition, googleOauthUpdatePresentationDefinition, googleOauthSearchDriveByKeywordsDefinition, googlemailSearchGmailMessagesDefinition, googlemailListGmailThreadsDefinition, googleOauthListGroupsDefinition, googleOauthGetGroupDefinition, googleOauthListGroupMembersDefinition, googleOauthHasGroupMemberDefinition, googleOauthAddGroupMemberDefinition, googleOauthDeleteGroupMemberDefinition, salesforceUpdateRecordDefinition, salesforceCreateCaseDefinition, salesforceGenerateSalesReportDefinition, salesforceGetRecordDefinition, salesforceGetSalesforceRecordsByQueryDefinition, microsoftMessageTeamsChatDefinition, microsoftMessageTeamsChannelDefinition, asanaCommentTaskDefinition, asanaCreateTaskDefinition, asanaUpdateTaskDefinition, asanaSearchTasksDefinition, githubCreateOrUpdateFileDefinition, githubCreateBranchDefinition, githubCreatePullRequestDefinition, microsoftUpdateSpreadsheetDefinition, microsoftUpdateDocumentDefinition, microsoftCreateDocumentDefinition, microsoftGetDocumentDefinition, salesforceFetchSalesforceSchemaByObjectDefinition, firecrawlDeepResearchDefinition, jiraGetJiraIssuesByQueryDefinition, githubListPullRequestsDefinition, salesforceCreateRecordDefinition, ashbyCreateNoteDefinition, ashbyGetCandidateInfoDefinition, ashbyListCandidatesDefinition, ashbyListCandidateNotesDefinition, ashbySearchCandidatesDefinition, ashbyCreateCandidateDefinition, ashbyUpdateCandidateDefinition, ashbyAddCandidateToProjectDefinition, bingGetTopNSearchResultUrlsDefinition, gongGetGongTranscriptsDefinition, kandjiGetFVRecoveryKeyForDeviceDefinition, asanaListAsanaTasksByProjectDefinition, notionSearchByTitleDefinition, asanaGetTasksDetailsDefinition, jamfGetJamfComputerInventoryDefinition, jamfGetJamfFileVaultRecoveryKeyDefinition, oktaListOktaUsersDefinition, oktaGetOktaUserDefinition, oktaListOktaUserGroupsDefinition, oktaListOktaGroupsDefinition, oktaGetOktaGroupDefinition, oktaListOktaGroupMembersDefinition, oktaRemoveUserFromGroupDefinition, oktaAddUserToGroupDefinition, oktaResetPasswordDefinition, oktaResetMFADefinition, oktaListMFADefinition, jamfGetJamfUserComputerIdDefinition, jamfLockJamfComputerByIdDefinition, oktaTriggerOktaWorkflowDefinition, jiraOrgAssignJiraTicketDefinition, jiraOrgCreateJiraTicketDefinition, jiraOrgCommentJiraTicketDefinition, jiraOrgGetJiraTicketDetailsDefinition, jiraOrgGetJiraTicketHistoryDefinition, jiraOrgUpdateJiraTicketDetailsDefinition, jiraOrgUpdateJiraTicketStatusDefinition, jiraOrgGetJiraIssuesByQueryDefinition, googleOauthGetDriveFileContentByIdDefinition, googleOauthSearchDriveByQueryDefinition, } from "./autogen/templates.js";
|
|
1
|
+
import { genericFillTemplateDefinition, confluenceOverwritePageDefinition, googlemapsValidateAddressDefinition, mathAddDefinition, mongoInsertMongoDocDefinition, slackSendMessageDefinition, slackGetChannelMessagesDefinition, slackCreateChannelDefinition, slackArchiveChannelDefinition, snowflakeGetRowByFieldValueDefinition, zendeskCreateZendeskTicketDefinition, zendeskListZendeskTicketsDefinition, zendeskGetTicketDetailsDefinition, zendeskUpdateTicketStatusDefinition, zendeskAddCommentToTicketDefinition, zendeskAssignTicketDefinition, openstreetmapGetLatitudeLongitudeFromLocationDefinition, nwsGetForecastForLocationDefinition, jiraAssignJiraTicketDefinition, jiraCommentJiraTicketDefinition, jiraCreateJiraTicketDefinition, jiraGetJiraTicketDetailsDefinition, jiraGetJiraTicketHistoryDefinition, jiraUpdateJiraTicketDetailsDefinition, jiraUpdateJiraTicketStatusDefinition, jiraGetServiceDesksDefinition, jiraCreateServiceDeskRequestDefinition, googlemapsNearbysearchRestaurantsDefinition, firecrawlScrapeUrlDefinition, resendSendEmailDefinition, linkedinCreateShareLinkedinPostUrlDefinition, googleOauthCreateNewGoogleDocDefinition, xCreateShareXPostUrlDefinition, firecrawlScrapeTweetDataWithNitterDefinition, finnhubSymbolLookupDefinition, finnhubGetBasicFinancialsDefinition, confluenceFetchPageContentDefinition, snowflakeRunSnowflakeQueryDefinition, lookerEnableUserByEmailDefinition, googleOauthUpdateDocDefinition, googleOauthScheduleCalendarMeetingDefinition, googleOauthListCalendarsDefinition, googleOauthListCalendarEventsDefinition, googleOauthUpdateCalendarEventDefinition, googleOauthDeleteCalendarEventDefinition, googleOauthCreateSpreadsheetDefinition, googleOauthUpdateSpreadsheetDefinition, googleOauthCreatePresentationDefinition, googleOauthUpdatePresentationDefinition, googleOauthSearchDriveByKeywordsDefinition, googlemailSearchGmailMessagesDefinition, googlemailListGmailThreadsDefinition, googleOauthListGroupsDefinition, googleOauthGetGroupDefinition, googleOauthListGroupMembersDefinition, googleOauthHasGroupMemberDefinition, googleOauthAddGroupMemberDefinition, googleOauthDeleteGroupMemberDefinition, salesforceUpdateRecordDefinition, salesforceCreateCaseDefinition, salesforceGenerateSalesReportDefinition, salesforceGetRecordDefinition, salesforceGetSalesforceRecordsByQueryDefinition, microsoftMessageTeamsChatDefinition, microsoftMessageTeamsChannelDefinition, asanaCommentTaskDefinition, asanaCreateTaskDefinition, asanaUpdateTaskDefinition, asanaSearchTasksDefinition, githubCreateOrUpdateFileDefinition, githubCreateBranchDefinition, githubCreatePullRequestDefinition, microsoftUpdateSpreadsheetDefinition, microsoftUpdateDocumentDefinition, microsoftCreateDocumentDefinition, microsoftGetDocumentDefinition, salesforceFetchSalesforceSchemaByObjectDefinition, firecrawlDeepResearchDefinition, jiraGetJiraIssuesByQueryDefinition, githubListPullRequestsDefinition, salesforceCreateRecordDefinition, ashbyCreateNoteDefinition, ashbyGetCandidateInfoDefinition, ashbyListCandidatesDefinition, ashbyListCandidateNotesDefinition, ashbySearchCandidatesDefinition, ashbyCreateCandidateDefinition, ashbyUpdateCandidateDefinition, ashbyAddCandidateToProjectDefinition, bingGetTopNSearchResultUrlsDefinition, gongGetGongTranscriptsDefinition, kandjiGetFVRecoveryKeyForDeviceDefinition, asanaListAsanaTasksByProjectDefinition, notionSearchByTitleDefinition, asanaGetTasksDetailsDefinition, linearGetIssueDetailsDefinition, linearGetProjectsDefinition, linearGetProjectDetailsDefinition, linearGetTeamDetailsDefinition, linearGetTeamsDefinition, jamfGetJamfComputerInventoryDefinition, jamfGetJamfFileVaultRecoveryKeyDefinition, oktaListOktaUsersDefinition, oktaGetOktaUserDefinition, oktaListOktaUserGroupsDefinition, oktaListOktaGroupsDefinition, oktaGetOktaGroupDefinition, oktaListOktaGroupMembersDefinition, oktaRemoveUserFromGroupDefinition, oktaAddUserToGroupDefinition, oktaResetPasswordDefinition, oktaResetMFADefinition, oktaListMFADefinition, jamfGetJamfUserComputerIdDefinition, jamfLockJamfComputerByIdDefinition, oktaTriggerOktaWorkflowDefinition, jiraOrgAssignJiraTicketDefinition, jiraOrgCreateJiraTicketDefinition, jiraOrgCommentJiraTicketDefinition, jiraOrgGetJiraTicketDetailsDefinition, jiraOrgGetJiraTicketHistoryDefinition, jiraOrgUpdateJiraTicketDetailsDefinition, jiraOrgUpdateJiraTicketStatusDefinition, jiraOrgGetJiraIssuesByQueryDefinition, googleOauthGetDriveFileContentByIdDefinition, googleOauthSearchDriveByQueryDefinition, googleOauthSearchDriveByQueryAndGetFileContentDefinition, githubGetFileContentDefinition, githubListDirectoryDefinition, } from "./autogen/templates.js";
|
|
2
2
|
export const ACTION_GROUPS = {
|
|
3
3
|
GENERIC: {
|
|
4
4
|
description: "Generic utility actions",
|
|
@@ -47,6 +47,7 @@ export const ACTION_GROUPS = {
|
|
|
47
47
|
googleOauthUpdatePresentationDefinition,
|
|
48
48
|
googleOauthSearchDriveByKeywordsDefinition,
|
|
49
49
|
googleOauthSearchDriveByQueryDefinition,
|
|
50
|
+
googleOauthSearchDriveByQueryAndGetFileContentDefinition,
|
|
50
51
|
googleOauthGetDriveFileContentByIdDefinition,
|
|
51
52
|
],
|
|
52
53
|
},
|
|
@@ -198,6 +199,8 @@ export const ACTION_GROUPS = {
|
|
|
198
199
|
githubCreateBranchDefinition,
|
|
199
200
|
githubCreatePullRequestDefinition,
|
|
200
201
|
githubListPullRequestsDefinition,
|
|
202
|
+
githubGetFileContentDefinition,
|
|
203
|
+
githubListDirectoryDefinition,
|
|
201
204
|
],
|
|
202
205
|
},
|
|
203
206
|
ASHBY: {
|
|
@@ -245,4 +248,14 @@ export const ACTION_GROUPS = {
|
|
|
245
248
|
oktaTriggerOktaWorkflowDefinition,
|
|
246
249
|
],
|
|
247
250
|
},
|
|
251
|
+
LINEAR: {
|
|
252
|
+
description: "Actions for interacting with Linear",
|
|
253
|
+
actions: [
|
|
254
|
+
linearGetIssueDetailsDefinition,
|
|
255
|
+
linearGetProjectsDefinition,
|
|
256
|
+
linearGetProjectDetailsDefinition,
|
|
257
|
+
linearGetTeamDetailsDefinition,
|
|
258
|
+
linearGetTeamsDefinition,
|
|
259
|
+
],
|
|
260
|
+
},
|
|
248
261
|
};
|
package/dist/actions/parse.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
declare const actionTemplateSchema: z.ZodObject<{
|
|
2
|
+
declare const actionTemplateSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
3
3
|
description: z.ZodString;
|
|
4
4
|
scopes: z.ZodArray<z.ZodString, "many">;
|
|
5
5
|
parameters: z.ZodOptional<z.ZodObject<{
|
|
@@ -34,10 +34,10 @@ declare const actionTemplateSchema: z.ZodObject<{
|
|
|
34
34
|
properties?: Record<string, any> | undefined;
|
|
35
35
|
oneOf?: any[] | undefined;
|
|
36
36
|
}>>;
|
|
37
|
-
}
|
|
37
|
+
}, {
|
|
38
38
|
name: z.ZodString;
|
|
39
39
|
provider: z.ZodString;
|
|
40
|
-
}
|
|
40
|
+
}>, "strip", z.ZodTypeAny, {
|
|
41
41
|
description: string;
|
|
42
42
|
scopes: string[];
|
|
43
43
|
name: string;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const axiosClient_1 = require("../../util/axiosClient");
|
|
13
|
+
function getConfluenceRequestConfig(baseUrl, username, apiToken) {
|
|
14
|
+
return {
|
|
15
|
+
baseURL: baseUrl,
|
|
16
|
+
headers: {
|
|
17
|
+
Accept: "application/json",
|
|
18
|
+
Authorization: `Basic ${Buffer.from(`${username}:${apiToken}`).toString("base64")}`,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const confluenceUpdatePage = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
23
|
+
const { pageId, content, title } = params;
|
|
24
|
+
const { baseUrl, authToken, username } = authParams;
|
|
25
|
+
if (!baseUrl || !authToken || !username) {
|
|
26
|
+
throw new Error("Missing required authentication information");
|
|
27
|
+
}
|
|
28
|
+
const config = getConfluenceRequestConfig(baseUrl, username, authToken);
|
|
29
|
+
// Get current version number
|
|
30
|
+
const response = yield axiosClient_1.axiosClient.get(`/api/v2/pages/${pageId}`, config);
|
|
31
|
+
const currVersion = response.data.version.number;
|
|
32
|
+
const payload = {
|
|
33
|
+
id: pageId,
|
|
34
|
+
status: "current",
|
|
35
|
+
title,
|
|
36
|
+
body: {
|
|
37
|
+
representation: "storage",
|
|
38
|
+
value: content,
|
|
39
|
+
},
|
|
40
|
+
version: {
|
|
41
|
+
number: currVersion + 1,
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
yield axiosClient_1.axiosClient.put(`/api/v2/pages/${pageId}`, payload, config);
|
|
45
|
+
});
|
|
46
|
+
exports.default = confluenceUpdatePage;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const fillTemplateAction = (_a) => __awaiter(void 0, [_a], void 0, function* ({ template }) {
|
|
13
|
+
// Simply return the template without any modification
|
|
14
|
+
return {
|
|
15
|
+
result: template,
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
exports.default = fillTemplateAction;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const axios_1 = __importDefault(require("axios"));
|
|
16
|
+
const genericApiCall = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, }) {
|
|
17
|
+
try {
|
|
18
|
+
const { endpoint, method, headers, body } = params;
|
|
19
|
+
const response = yield (0, axios_1.default)({
|
|
20
|
+
url: endpoint,
|
|
21
|
+
method,
|
|
22
|
+
headers,
|
|
23
|
+
data: method !== "GET" ? body : undefined,
|
|
24
|
+
});
|
|
25
|
+
return {
|
|
26
|
+
statusCode: response.status,
|
|
27
|
+
headers: response.headers,
|
|
28
|
+
data: response.data,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
if (axios_1.default.isAxiosError(error)) {
|
|
33
|
+
throw Error("Axios Error: " + (error.message || "Failed to make API call"));
|
|
34
|
+
}
|
|
35
|
+
throw Error("Error: " + (error || "Failed to make API call"));
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
exports.default = genericApiCall;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { githubGetBranchFunction } from "../../autogen/types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Get a branch in a GitHub repository
|
|
4
|
+
* https://docs.github.com/en/rest/branches/branches?apiVersion=2022-11-28#get-a-branch
|
|
5
|
+
*/
|
|
6
|
+
declare const getBranch: githubGetBranchFunction;
|
|
7
|
+
export default getBranch;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
11
|
+
import { getOctokit } from "./utils.js";
|
|
12
|
+
/**
|
|
13
|
+
* Get a branch in a GitHub repository
|
|
14
|
+
* https://docs.github.com/en/rest/branches/branches?apiVersion=2022-11-28#get-a-branch
|
|
15
|
+
*/
|
|
16
|
+
const getBranch = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
17
|
+
if (!authParams.authToken) {
|
|
18
|
+
return {
|
|
19
|
+
success: false,
|
|
20
|
+
error: MISSING_AUTH_TOKEN,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
const octokit = yield getOctokit(authParams.authToken);
|
|
24
|
+
const { repositoryOwner, repositoryName, branchName } = params;
|
|
25
|
+
try {
|
|
26
|
+
const response = yield octokit.rest.repos.getBranch({
|
|
27
|
+
owner: repositoryOwner,
|
|
28
|
+
repo: repositoryName,
|
|
29
|
+
branch: branchName,
|
|
30
|
+
});
|
|
31
|
+
return {
|
|
32
|
+
success: true,
|
|
33
|
+
branch: {
|
|
34
|
+
name: response.data.name,
|
|
35
|
+
commit: {
|
|
36
|
+
sha: response.data.commit.sha,
|
|
37
|
+
node_id: response.data.commit.node_id,
|
|
38
|
+
url: response.data.commit.url,
|
|
39
|
+
html_url: response.data.commit.html_url,
|
|
40
|
+
comments_url: response.data.commit.comments_url,
|
|
41
|
+
commit: {
|
|
42
|
+
author: response.data.commit.commit.author,
|
|
43
|
+
committer: response.data.commit.commit.committer,
|
|
44
|
+
message: response.data.commit.commit.message,
|
|
45
|
+
tree: response.data.commit.commit.tree,
|
|
46
|
+
url: response.data.commit.commit.url,
|
|
47
|
+
comment_count: response.data.commit.commit.comment_count,
|
|
48
|
+
},
|
|
49
|
+
author: response.data.commit.author,
|
|
50
|
+
committer: response.data.commit.committer,
|
|
51
|
+
parents: response.data.commit.parents,
|
|
52
|
+
},
|
|
53
|
+
_links: response.data._links,
|
|
54
|
+
protected: response.data.protected,
|
|
55
|
+
protection: response.data.protection,
|
|
56
|
+
protection_url: response.data.protection_url,
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
return {
|
|
62
|
+
success: false,
|
|
63
|
+
error: `Failed to get branch: ${error instanceof Error ? error.message : String(error)}`,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
export default getBranch;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import axios from "axios";
|
|
11
|
+
import { githubGetPullRequestDetailsOutputSchema, } from "../../autogen/types.js";
|
|
12
|
+
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
13
|
+
const getPullRequestDetails = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
14
|
+
var _b, _c, _d;
|
|
15
|
+
const { authToken } = authParams;
|
|
16
|
+
if (!authToken) {
|
|
17
|
+
throw new Error(MISSING_AUTH_TOKEN);
|
|
18
|
+
}
|
|
19
|
+
const { repositoryOwner, repositoryName, pullRequestNumber } = params;
|
|
20
|
+
try {
|
|
21
|
+
const url = `https://api.github.com/repos/${repositoryOwner}/${repositoryName}/pulls/${pullRequestNumber}`;
|
|
22
|
+
const response = yield axios.get(url, {
|
|
23
|
+
headers: {
|
|
24
|
+
Authorization: `Bearer ${authToken}`,
|
|
25
|
+
Accept: "application/vnd.github+json",
|
|
26
|
+
"X-GitHub-Api-Version": "2022-11-28",
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
const pr = response.data;
|
|
30
|
+
// Transform only the field names that differ between GitHub API and our schema
|
|
31
|
+
const transformedPR = Object.assign(Object.assign({}, pr), { description: pr.body, state: pr.state === "closed" && pr.merged_at ? "merged" : pr.state, htmlUrl: pr.html_url, createdAt: pr.created_at, updatedAt: pr.updated_at, closedAt: pr.closed_at, mergedAt: pr.merged_at, author: pr.user, assignees: pr.assignees || [], reviewers: pr.requested_reviewers || [], labels: ((_b = pr.labels) === null || _b === void 0 ? void 0 : _b.map(label => (Object.assign(Object.assign({}, label), { description: label.description || null })))) || [], head: Object.assign(Object.assign({}, pr.head), { repo: pr.head.repo
|
|
32
|
+
? {
|
|
33
|
+
name: pr.head.repo.name,
|
|
34
|
+
fullName: pr.head.repo.full_name,
|
|
35
|
+
owner: pr.head.repo.owner,
|
|
36
|
+
}
|
|
37
|
+
: null }), base: Object.assign(Object.assign({}, pr.base), { repo: pr.base.repo
|
|
38
|
+
? {
|
|
39
|
+
name: pr.base.repo.name,
|
|
40
|
+
fullName: pr.base.repo.full_name,
|
|
41
|
+
owner: pr.base.repo.owner,
|
|
42
|
+
}
|
|
43
|
+
: null }), mergeableState: pr.mergeable_state, changedFiles: pr.changed_files, milestone: pr.milestone
|
|
44
|
+
? Object.assign(Object.assign({}, pr.milestone), { dueOn: pr.milestone.due_on }) : null });
|
|
45
|
+
return githubGetPullRequestDetailsOutputSchema.parse({
|
|
46
|
+
success: true,
|
|
47
|
+
pullRequest: transformedPR,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
52
|
+
const responseError = error && typeof error === "object" && "response" in error
|
|
53
|
+
? (_d = (_c = error.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.message
|
|
54
|
+
: undefined;
|
|
55
|
+
return githubGetPullRequestDetailsOutputSchema.parse({
|
|
56
|
+
success: false,
|
|
57
|
+
error: responseError || errorMessage || "Failed to get pull request details",
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
export default getPullRequestDetails;
|