@credal/actions 0.2.157 → 0.2.159
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/actionMapper.js +2 -1
- package/dist/actions/autogen/templates.js +144 -18
- package/dist/actions/autogen/types.d.ts +387 -63
- package/dist/actions/autogen/types.js +81 -9
- package/dist/actions/groups.js +3 -44
- package/dist/actions/providers/github/searchOrganization.js +7 -7
- package/dist/actions/providers/github/searchRepository.js +7 -7
- package/dist/actions/providers/jira/getJiraDCIssuesByQuery.d.ts +8 -0
- package/dist/actions/providers/jira/getJiraDCIssuesByQuery.js +139 -0
- package/dist/actions/providers/jira/getJiraIssuesByQuery.js +78 -78
- package/dist/actions/providers/jira/utils.d.ts +19 -0
- package/dist/actions/providers/jira/utils.js +51 -0
- package/dist/actions/providers/slack/archiveChannel.js +2 -9
- package/package.json +2 -1
- package/dist/actions/providers/confluence/updatePage.d.ts +0 -3
- package/dist/actions/providers/confluence/updatePage.js +0 -47
- package/dist/actions/providers/credal/callCopilot.d.ts +0 -3
- package/dist/actions/providers/credal/callCopilot.js +0 -36
- package/dist/actions/providers/jamf/types.d.ts +0 -8
- package/dist/actions/providers/jamf/types.js +0 -7
- package/dist/actions/providers/math/index.d.ts +0 -1
- package/dist/actions/providers/math/index.js +0 -37
- package/dist/actions/providers/slack/index.d.ts +0 -1
- package/dist/actions/providers/slack/index.js +0 -37
- package/dist/actions/providers/slack/listConversations.d.ts +0 -3
- package/dist/actions/providers/slack/listConversations.js +0 -41
|
@@ -574,9 +574,33 @@ export const jiraGetJiraIssuesByQueryOutputSchema = z.object({
|
|
|
574
574
|
name: z.string().optional(),
|
|
575
575
|
category: z.string().optional(),
|
|
576
576
|
}),
|
|
577
|
-
assignee: z
|
|
578
|
-
|
|
579
|
-
|
|
577
|
+
assignee: z
|
|
578
|
+
.object({
|
|
579
|
+
id: z.string().describe("The assignee ID").optional(),
|
|
580
|
+
name: z.string().describe("The assignee name").optional(),
|
|
581
|
+
email: z.string().describe("The assignee email").optional(),
|
|
582
|
+
})
|
|
583
|
+
.nullable()
|
|
584
|
+
.describe("The issue assignee")
|
|
585
|
+
.optional(),
|
|
586
|
+
reporter: z
|
|
587
|
+
.object({
|
|
588
|
+
id: z.string().describe("The reporter ID").optional(),
|
|
589
|
+
name: z.string().describe("The reporter name").optional(),
|
|
590
|
+
email: z.string().describe("The reporter email").optional(),
|
|
591
|
+
})
|
|
592
|
+
.nullable()
|
|
593
|
+
.describe("The issue reporter")
|
|
594
|
+
.optional(),
|
|
595
|
+
creator: z
|
|
596
|
+
.object({
|
|
597
|
+
id: z.string().describe("The creator ID").optional(),
|
|
598
|
+
name: z.string().describe("The creator name").optional(),
|
|
599
|
+
email: z.string().describe("The creator email").optional(),
|
|
600
|
+
})
|
|
601
|
+
.nullable()
|
|
602
|
+
.describe("The issue creator")
|
|
603
|
+
.optional(),
|
|
580
604
|
created: z.string().datetime({ offset: true }),
|
|
581
605
|
updated: z.string().datetime({ offset: true }),
|
|
582
606
|
resolution: z.string().nullable().optional(),
|
|
@@ -766,9 +790,33 @@ export const jiraOrgGetJiraIssuesByQueryOutputSchema = z.object({
|
|
|
766
790
|
name: z.string().optional(),
|
|
767
791
|
category: z.string().optional(),
|
|
768
792
|
}),
|
|
769
|
-
assignee: z
|
|
770
|
-
|
|
771
|
-
|
|
793
|
+
assignee: z
|
|
794
|
+
.object({
|
|
795
|
+
id: z.string().describe("The assignee ID").optional(),
|
|
796
|
+
name: z.string().describe("The assignee name").optional(),
|
|
797
|
+
email: z.string().describe("The assignee email").optional(),
|
|
798
|
+
})
|
|
799
|
+
.nullable()
|
|
800
|
+
.describe("The issue assignee")
|
|
801
|
+
.optional(),
|
|
802
|
+
reporter: z
|
|
803
|
+
.object({
|
|
804
|
+
id: z.string().describe("The reporter ID").optional(),
|
|
805
|
+
name: z.string().describe("The reporter name").optional(),
|
|
806
|
+
email: z.string().describe("The reporter email").optional(),
|
|
807
|
+
})
|
|
808
|
+
.nullable()
|
|
809
|
+
.describe("The issue reporter")
|
|
810
|
+
.optional(),
|
|
811
|
+
creator: z
|
|
812
|
+
.object({
|
|
813
|
+
id: z.string().describe("The creator ID").optional(),
|
|
814
|
+
name: z.string().describe("The creator name").optional(),
|
|
815
|
+
email: z.string().describe("The creator email").optional(),
|
|
816
|
+
})
|
|
817
|
+
.nullable()
|
|
818
|
+
.describe("The issue creator")
|
|
819
|
+
.optional(),
|
|
772
820
|
created: z.string().datetime({ offset: true }),
|
|
773
821
|
updated: z.string().datetime({ offset: true }),
|
|
774
822
|
resolution: z.string().nullable().optional(),
|
|
@@ -958,9 +1006,33 @@ export const jiraDataCenterGetJiraIssuesByQueryOutputSchema = z.object({
|
|
|
958
1006
|
name: z.string().optional(),
|
|
959
1007
|
category: z.string().optional(),
|
|
960
1008
|
}),
|
|
961
|
-
assignee: z
|
|
962
|
-
|
|
963
|
-
|
|
1009
|
+
assignee: z
|
|
1010
|
+
.object({
|
|
1011
|
+
id: z.string().describe("The assignee ID").optional(),
|
|
1012
|
+
name: z.string().describe("The assignee name").optional(),
|
|
1013
|
+
email: z.string().describe("The assignee email").optional(),
|
|
1014
|
+
})
|
|
1015
|
+
.nullable()
|
|
1016
|
+
.describe("The issue assignee")
|
|
1017
|
+
.optional(),
|
|
1018
|
+
reporter: z
|
|
1019
|
+
.object({
|
|
1020
|
+
id: z.string().describe("The reporter ID").optional(),
|
|
1021
|
+
name: z.string().describe("The reporter name").optional(),
|
|
1022
|
+
email: z.string().describe("The reporter email").optional(),
|
|
1023
|
+
})
|
|
1024
|
+
.nullable()
|
|
1025
|
+
.describe("The issue reporter")
|
|
1026
|
+
.optional(),
|
|
1027
|
+
creator: z
|
|
1028
|
+
.object({
|
|
1029
|
+
id: z.string().describe("The creator ID").optional(),
|
|
1030
|
+
name: z.string().describe("The creator name").optional(),
|
|
1031
|
+
email: z.string().describe("The creator email").optional(),
|
|
1032
|
+
})
|
|
1033
|
+
.nullable()
|
|
1034
|
+
.describe("The issue creator")
|
|
1035
|
+
.optional(),
|
|
964
1036
|
created: z.string().datetime({ offset: true }),
|
|
965
1037
|
updated: z.string().datetime({ offset: true }),
|
|
966
1038
|
resolution: z.string().nullable().optional(),
|
package/dist/actions/groups.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { genericFillTemplateDefinition, confluenceOverwritePageDefinition, googlemapsValidateAddressDefinition, mathAddDefinition, mongoInsertMongoDocDefinition, slackSendMessageDefinition, slackGetChannelMessagesDefinition,
|
|
1
|
+
import { genericFillTemplateDefinition, confluenceOverwritePageDefinition, googlemapsValidateAddressDefinition, mathAddDefinition, mongoInsertMongoDocDefinition, slackSendMessageDefinition, slackGetChannelMessagesDefinition, snowflakeGetRowByFieldValueDefinition, zendeskCreateZendeskTicketDefinition, zendeskListZendeskTicketsDefinition, zendeskGetTicketDetailsDefinition, zendeskUpdateTicketStatusDefinition, zendeskAddCommentToTicketDefinition, zendeskAssignTicketDefinition, openstreetmapGetLatitudeLongitudeFromLocationDefinition, nwsGetForecastForLocationDefinition, jiraAssignJiraTicketDefinition, jiraCommentJiraTicketDefinition, jiraCreateJiraTicketDefinition, jiraGetJiraTicketDetailsDefinition, jiraGetJiraTicketHistoryDefinition, jiraUpdateJiraTicketDetailsDefinition, jiraUpdateJiraTicketStatusDefinition, 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, } from "./autogen/templates.js";
|
|
2
2
|
export const ACTION_GROUPS = {
|
|
3
3
|
GENERIC: {
|
|
4
4
|
description: "Generic utility actions",
|
|
@@ -17,12 +17,7 @@ export const ACTION_GROUPS = {
|
|
|
17
17
|
},
|
|
18
18
|
SLACK_LIST_CONVERSATIONS: {
|
|
19
19
|
description: "Actions for interacting with Slack",
|
|
20
|
-
actions: [
|
|
21
|
-
slackSendMessageDefinition,
|
|
22
|
-
slackGetChannelMessagesDefinition,
|
|
23
|
-
slackCreateChannelDefinition,
|
|
24
|
-
slackArchiveChannelDefinition,
|
|
25
|
-
],
|
|
20
|
+
actions: [slackSendMessageDefinition, slackGetChannelMessagesDefinition],
|
|
26
21
|
},
|
|
27
22
|
CONFLUENCE: {
|
|
28
23
|
description: "Action for interacting with Confluence",
|
|
@@ -46,9 +41,6 @@ export const ACTION_GROUPS = {
|
|
|
46
41
|
googleOauthCreatePresentationDefinition,
|
|
47
42
|
googleOauthUpdatePresentationDefinition,
|
|
48
43
|
googleOauthSearchDriveByKeywordsDefinition,
|
|
49
|
-
googleOauthSearchDriveByQueryDefinition,
|
|
50
|
-
googleOauthSearchDriveByQueryAndGetFileContentDefinition,
|
|
51
|
-
googleOauthGetDriveFileContentByIdDefinition,
|
|
52
44
|
],
|
|
53
45
|
},
|
|
54
46
|
GOOGLE_CALENDAR: {
|
|
@@ -103,21 +95,6 @@ export const ACTION_GROUPS = {
|
|
|
103
95
|
jiraUpdateJiraTicketDetailsDefinition,
|
|
104
96
|
jiraUpdateJiraTicketStatusDefinition,
|
|
105
97
|
jiraGetJiraIssuesByQueryDefinition,
|
|
106
|
-
jiraGetServiceDesksDefinition,
|
|
107
|
-
jiraCreateServiceDeskRequestDefinition,
|
|
108
|
-
],
|
|
109
|
-
},
|
|
110
|
-
JIRA_ORG_ACTIONS: {
|
|
111
|
-
description: "Action for interacting with Jira tickets",
|
|
112
|
-
actions: [
|
|
113
|
-
jiraOrgAssignJiraTicketDefinition,
|
|
114
|
-
jiraOrgCreateJiraTicketDefinition,
|
|
115
|
-
jiraOrgCommentJiraTicketDefinition,
|
|
116
|
-
jiraOrgGetJiraTicketDetailsDefinition,
|
|
117
|
-
jiraOrgGetJiraTicketHistoryDefinition,
|
|
118
|
-
jiraOrgUpdateJiraTicketDetailsDefinition,
|
|
119
|
-
jiraOrgUpdateJiraTicketStatusDefinition,
|
|
120
|
-
jiraOrgGetJiraIssuesByQueryDefinition,
|
|
121
98
|
],
|
|
122
99
|
},
|
|
123
100
|
OPENSTREETMAP_GET_LATITUDE_LONGITUDE_FROM_LOCATION: {
|
|
@@ -154,12 +131,7 @@ export const ACTION_GROUPS = {
|
|
|
154
131
|
},
|
|
155
132
|
JAMF: {
|
|
156
133
|
description: "Actions for interacting with Jamf",
|
|
157
|
-
actions: [
|
|
158
|
-
jamfGetJamfComputerInventoryDefinition,
|
|
159
|
-
jamfGetJamfFileVaultRecoveryKeyDefinition,
|
|
160
|
-
jamfGetJamfUserComputerIdDefinition,
|
|
161
|
-
jamfLockJamfComputerByIdDefinition,
|
|
162
|
-
],
|
|
134
|
+
actions: [jamfGetJamfComputerInventoryDefinition, jamfGetJamfFileVaultRecoveryKeyDefinition],
|
|
163
135
|
},
|
|
164
136
|
LOOKER: {
|
|
165
137
|
description: "Actions for interacting with Looker",
|
|
@@ -199,8 +171,6 @@ export const ACTION_GROUPS = {
|
|
|
199
171
|
githubCreateBranchDefinition,
|
|
200
172
|
githubCreatePullRequestDefinition,
|
|
201
173
|
githubListPullRequestsDefinition,
|
|
202
|
-
githubGetFileContentDefinition,
|
|
203
|
-
githubListDirectoryDefinition,
|
|
204
174
|
],
|
|
205
175
|
},
|
|
206
176
|
ASHBY: {
|
|
@@ -245,17 +215,6 @@ export const ACTION_GROUPS = {
|
|
|
245
215
|
oktaResetPasswordDefinition,
|
|
246
216
|
oktaResetMFADefinition,
|
|
247
217
|
oktaListMFADefinition,
|
|
248
|
-
oktaTriggerOktaWorkflowDefinition,
|
|
249
|
-
],
|
|
250
|
-
},
|
|
251
|
-
LINEAR: {
|
|
252
|
-
description: "Actions for interacting with Linear",
|
|
253
|
-
actions: [
|
|
254
|
-
linearGetIssueDetailsDefinition,
|
|
255
|
-
linearGetProjectsDefinition,
|
|
256
|
-
linearGetProjectDetailsDefinition,
|
|
257
|
-
linearGetTeamDetailsDefinition,
|
|
258
|
-
linearGetTeamsDefinition,
|
|
259
218
|
],
|
|
260
219
|
},
|
|
261
220
|
};
|
|
@@ -51,7 +51,7 @@ const searchOrganization = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
51
51
|
name: item.name,
|
|
52
52
|
path: item.path,
|
|
53
53
|
sha: item.sha.slice(0, 7),
|
|
54
|
-
url: item.
|
|
54
|
+
url: item.html_url,
|
|
55
55
|
score: item.score,
|
|
56
56
|
textMatches: item.text_matches
|
|
57
57
|
? item.text_matches.map(match => {
|
|
@@ -82,7 +82,7 @@ const searchOrganization = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
82
82
|
const full = commitDetails.find(c => c.data.sha === item.sha);
|
|
83
83
|
return {
|
|
84
84
|
sha: item.sha,
|
|
85
|
-
url: item.
|
|
85
|
+
url: item.html_url,
|
|
86
86
|
commit: {
|
|
87
87
|
message: item.commit.message,
|
|
88
88
|
author: item.commit.author,
|
|
@@ -90,11 +90,11 @@ const searchOrganization = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
90
90
|
score: item.score,
|
|
91
91
|
author: (_a = item.author) !== null && _a !== void 0 ? _a : undefined,
|
|
92
92
|
files: ((_b = full === null || full === void 0 ? void 0 : full.data.files) === null || _b === void 0 ? void 0 : _b.slice(0, MAX_FILES_PER_COMMIT).map(f => {
|
|
93
|
-
var _a;
|
|
93
|
+
var _a, _b, _c;
|
|
94
94
|
return ({
|
|
95
95
|
filename: f.filename,
|
|
96
96
|
status: f.status,
|
|
97
|
-
patch: (_a = f.patch) === null || _a === void 0 ? void 0 : _a.split("\n").slice(0, MAX_PATCH_LINES).join("\n"),
|
|
97
|
+
patch: (_c = (_b = (_a = f.patch) === null || _a === void 0 ? void 0 : _a.split("\n")) === null || _b === void 0 ? void 0 : _b.slice(0, MAX_PATCH_LINES)) === null || _c === void 0 ? void 0 : _c.join("\n"),
|
|
98
98
|
});
|
|
99
99
|
})) || [],
|
|
100
100
|
};
|
|
@@ -132,7 +132,7 @@ const searchOrganization = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
132
132
|
return {
|
|
133
133
|
number: item.number,
|
|
134
134
|
title: item.title,
|
|
135
|
-
|
|
135
|
+
url: item.html_url,
|
|
136
136
|
state: item.state,
|
|
137
137
|
isPullRequest: isPR,
|
|
138
138
|
body: item.body,
|
|
@@ -155,14 +155,14 @@ const searchOrganization = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
155
155
|
})),
|
|
156
156
|
...enrichedCommits.map(result => ({
|
|
157
157
|
type: "commit",
|
|
158
|
-
name: result.sha,
|
|
158
|
+
name: `${result.sha.slice(0, 7)} – ${result.commit.message.split("\n")[0]}`,
|
|
159
159
|
url: result.url,
|
|
160
160
|
contents: result,
|
|
161
161
|
})),
|
|
162
162
|
...issuesAndPRs.map(result => ({
|
|
163
163
|
type: "issueOrPullRequest",
|
|
164
164
|
name: result.title,
|
|
165
|
-
url: result.
|
|
165
|
+
url: result.url,
|
|
166
166
|
contents: result,
|
|
167
167
|
})),
|
|
168
168
|
],
|
|
@@ -47,7 +47,7 @@ const searchRepository = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
|
47
47
|
name: item.name,
|
|
48
48
|
path: item.path,
|
|
49
49
|
sha: item.sha.slice(0, 7),
|
|
50
|
-
url: item.
|
|
50
|
+
url: item.html_url,
|
|
51
51
|
score: item.score,
|
|
52
52
|
textMatches: item.text_matches
|
|
53
53
|
? item.text_matches.map(match => {
|
|
@@ -68,7 +68,7 @@ const searchRepository = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
|
68
68
|
const full = commitDetails.find(c => c.data.sha === item.sha);
|
|
69
69
|
return {
|
|
70
70
|
sha: item.sha,
|
|
71
|
-
url: item.
|
|
71
|
+
url: item.html_url,
|
|
72
72
|
commit: {
|
|
73
73
|
message: item.commit.message,
|
|
74
74
|
author: item.commit.author,
|
|
@@ -76,11 +76,11 @@ const searchRepository = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
|
76
76
|
score: item.score,
|
|
77
77
|
author: (_a = item.author) !== null && _a !== void 0 ? _a : undefined,
|
|
78
78
|
files: ((_b = full === null || full === void 0 ? void 0 : full.data.files) === null || _b === void 0 ? void 0 : _b.slice(0, MAX_FILES_PER_COMMIT).map(f => {
|
|
79
|
-
var _a;
|
|
79
|
+
var _a, _b, _c;
|
|
80
80
|
return ({
|
|
81
81
|
filename: f.filename,
|
|
82
82
|
status: f.status,
|
|
83
|
-
patch: (_a = f.patch) === null || _a === void 0 ? void 0 : _a.split("\n").slice(0, MAX_PATCH_LINES).join("\n"),
|
|
83
|
+
patch: (_c = (_b = (_a = f.patch) === null || _a === void 0 ? void 0 : _a.split("\n")) === null || _b === void 0 ? void 0 : _b.slice(0, MAX_PATCH_LINES)) === null || _c === void 0 ? void 0 : _c.join("\n"),
|
|
84
84
|
});
|
|
85
85
|
})) || [],
|
|
86
86
|
};
|
|
@@ -104,18 +104,18 @@ const searchRepository = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
|
104
104
|
const prIndex = prNumbers.indexOf(item.number);
|
|
105
105
|
const files = isPR && prIndex !== -1
|
|
106
106
|
? prFiles[prIndex].data.slice(0, MAX_FILES_PER_PR).map(f => {
|
|
107
|
-
var _a;
|
|
107
|
+
var _a, _b, _c;
|
|
108
108
|
return ({
|
|
109
109
|
filename: f.filename,
|
|
110
110
|
status: f.status,
|
|
111
|
-
patch: (_a = f.patch) === null || _a === void 0 ? void 0 : _a.split("\n").slice(0, MAX_PATCH_LINES).join("\n"),
|
|
111
|
+
patch: (_c = (_b = (_a = f.patch) === null || _a === void 0 ? void 0 : _a.split("\n")) === null || _b === void 0 ? void 0 : _b.slice(0, MAX_PATCH_LINES)) === null || _c === void 0 ? void 0 : _c.join("\n"),
|
|
112
112
|
});
|
|
113
113
|
})
|
|
114
114
|
: undefined;
|
|
115
115
|
return {
|
|
116
116
|
number: item.number,
|
|
117
117
|
title: item.title,
|
|
118
|
-
|
|
118
|
+
url: item.html_url,
|
|
119
119
|
state: item.state,
|
|
120
120
|
isPullRequest: isPR,
|
|
121
121
|
body: item.body,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { jiraGetJiraIssuesByQueryFunction } from "../../autogen/types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Get Jira issues from Jira Data Center
|
|
4
|
+
* Uses startAt parameter to paginate through the results while
|
|
5
|
+
* getJiraIssuesByQuery uses nextPageToken parameter to paginate through the results.
|
|
6
|
+
*/
|
|
7
|
+
declare const getJiraDCIssuesByQuery: jiraGetJiraIssuesByQueryFunction;
|
|
8
|
+
export default getJiraDCIssuesByQuery;
|
|
@@ -0,0 +1,139 @@
|
|
|
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 { axiosClient } from "../../util/axiosClient.js";
|
|
11
|
+
import { getJiraApiConfig, getErrorMessage, extractPlainText } from "./utils.js";
|
|
12
|
+
const DEFAULT_LIMIT = 100;
|
|
13
|
+
/**
|
|
14
|
+
* Get Jira issues from Jira Data Center
|
|
15
|
+
* Uses startAt parameter to paginate through the results while
|
|
16
|
+
* getJiraIssuesByQuery uses nextPageToken parameter to paginate through the results.
|
|
17
|
+
*/
|
|
18
|
+
const getJiraDCIssuesByQuery = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
19
|
+
const { authToken } = authParams;
|
|
20
|
+
const { query, limit } = params;
|
|
21
|
+
const { apiUrl, browseUrl, strategy } = getJiraApiConfig(authParams);
|
|
22
|
+
if (!authToken) {
|
|
23
|
+
throw new Error("Auth token is required");
|
|
24
|
+
}
|
|
25
|
+
const fields = [
|
|
26
|
+
"key",
|
|
27
|
+
"id",
|
|
28
|
+
"project",
|
|
29
|
+
"issuetype",
|
|
30
|
+
"summary",
|
|
31
|
+
"description",
|
|
32
|
+
"status",
|
|
33
|
+
"assignee",
|
|
34
|
+
"reporter",
|
|
35
|
+
"creator",
|
|
36
|
+
"created",
|
|
37
|
+
"updated",
|
|
38
|
+
"resolution",
|
|
39
|
+
"duedate",
|
|
40
|
+
"timeoriginalestimate",
|
|
41
|
+
"timespent",
|
|
42
|
+
"aggregatetimeoriginalestimate",
|
|
43
|
+
];
|
|
44
|
+
const searchEndpoint = strategy.getSearchEndpoint();
|
|
45
|
+
const requestedLimit = limit !== null && limit !== void 0 ? limit : DEFAULT_LIMIT;
|
|
46
|
+
const allIssues = [];
|
|
47
|
+
let startAt = 0;
|
|
48
|
+
try {
|
|
49
|
+
// Keep fetching pages until we have all requested issues
|
|
50
|
+
while (allIssues.length < requestedLimit) {
|
|
51
|
+
// Calculate how many results to fetch in this request
|
|
52
|
+
const remainingIssues = requestedLimit - allIssues.length;
|
|
53
|
+
const maxResults = Math.min(remainingIssues, DEFAULT_LIMIT);
|
|
54
|
+
const queryParams = new URLSearchParams();
|
|
55
|
+
queryParams.set("jql", query);
|
|
56
|
+
queryParams.set("maxResults", String(maxResults));
|
|
57
|
+
queryParams.set("startAt", String(startAt));
|
|
58
|
+
queryParams.set("fields", fields.join(","));
|
|
59
|
+
const fullApiUrl = `${apiUrl}${searchEndpoint}?${queryParams.toString()}`;
|
|
60
|
+
const response = yield axiosClient.get(fullApiUrl, {
|
|
61
|
+
headers: {
|
|
62
|
+
Authorization: `Bearer ${authToken}`,
|
|
63
|
+
Accept: "application/json",
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
const { issues, total } = response.data;
|
|
67
|
+
allIssues.push(...issues);
|
|
68
|
+
if (allIssues.length >= total || issues.length === 0) {
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
startAt += issues.length;
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
results: allIssues.map(issue => {
|
|
75
|
+
const { id, key, fields } = issue;
|
|
76
|
+
const { summary, description, project, issuetype, status, assignee, reporter, creator, created, updated, resolution, duedate, } = fields;
|
|
77
|
+
const ticketUrl = `${browseUrl}/browse/${key}`;
|
|
78
|
+
return {
|
|
79
|
+
name: key,
|
|
80
|
+
url: ticketUrl,
|
|
81
|
+
contents: {
|
|
82
|
+
id,
|
|
83
|
+
key,
|
|
84
|
+
summary,
|
|
85
|
+
description: extractPlainText(description),
|
|
86
|
+
project: {
|
|
87
|
+
id: project.id,
|
|
88
|
+
key: project.key,
|
|
89
|
+
name: project.name,
|
|
90
|
+
},
|
|
91
|
+
issueType: {
|
|
92
|
+
id: issuetype.id,
|
|
93
|
+
name: issuetype.name,
|
|
94
|
+
},
|
|
95
|
+
status: {
|
|
96
|
+
id: status.id,
|
|
97
|
+
name: status.name,
|
|
98
|
+
category: status.statusCategory.name,
|
|
99
|
+
},
|
|
100
|
+
assignee: assignee
|
|
101
|
+
? {
|
|
102
|
+
id: assignee.accountId,
|
|
103
|
+
name: assignee.displayName,
|
|
104
|
+
email: assignee.emailAddress,
|
|
105
|
+
}
|
|
106
|
+
: null,
|
|
107
|
+
reporter: reporter
|
|
108
|
+
? {
|
|
109
|
+
id: reporter.accountId,
|
|
110
|
+
name: reporter.displayName,
|
|
111
|
+
email: reporter.emailAddress,
|
|
112
|
+
}
|
|
113
|
+
: null,
|
|
114
|
+
creator: creator
|
|
115
|
+
? {
|
|
116
|
+
id: creator.accountId,
|
|
117
|
+
name: creator.displayName,
|
|
118
|
+
email: creator.emailAddress,
|
|
119
|
+
}
|
|
120
|
+
: null,
|
|
121
|
+
created,
|
|
122
|
+
updated,
|
|
123
|
+
resolution: (resolution === null || resolution === void 0 ? void 0 : resolution.name) || null,
|
|
124
|
+
dueDate: duedate || null,
|
|
125
|
+
url: ticketUrl,
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
}),
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
console.error("Error retrieving Jira issues:", error);
|
|
133
|
+
return {
|
|
134
|
+
results: [],
|
|
135
|
+
error: getErrorMessage(error),
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
export default getJiraDCIssuesByQuery;
|