@credal/actions 0.2.196 → 0.2.198
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/autogen/templates.js +8 -12
- package/dist/actions/autogen/types.js +26 -8
- package/dist/actions/groups.d.ts +6 -0
- package/dist/actions/groups.js +251 -0
- package/dist/actions/invoke.js +11 -22
- package/dist/actions/parse.js +231 -244
- package/dist/actions/providers/asana/commentAsanaTask.js +8 -15
- package/dist/actions/providers/asana/createAsanaTask.js +20 -21
- package/dist/actions/providers/asana/getTasksDetails.js +18 -34
- package/dist/actions/providers/asana/listAsanaTasksByProject.js +62 -79
- package/dist/actions/providers/asana/searchAsanaTasks.js +6 -16
- package/dist/actions/providers/asana/updateAsanaTask.js +16 -15
- package/dist/actions/providers/asana/utils.js +47 -64
- package/dist/actions/providers/ashby/addCandidateToProject.d.ts +3 -0
- package/dist/actions/providers/ashby/addCandidateToProject.js +31 -0
- package/dist/actions/providers/ashby/createCandidate.d.ts +3 -0
- package/dist/actions/providers/ashby/createCandidate.js +38 -0
- package/dist/actions/providers/ashby/createNote.d.ts +3 -0
- package/dist/actions/providers/ashby/createNote.js +31 -0
- package/dist/actions/providers/ashby/getCandidateInfo.d.ts +3 -0
- package/dist/actions/providers/ashby/getCandidateInfo.js +33 -0
- package/dist/actions/providers/ashby/listCandidateNotes.d.ts +3 -0
- package/dist/actions/providers/ashby/listCandidateNotes.js +33 -0
- package/dist/actions/providers/ashby/listCandidates.d.ts +3 -0
- package/dist/actions/providers/ashby/listCandidates.js +30 -0
- package/dist/actions/providers/ashby/searchCandidates.d.ts +3 -0
- package/dist/actions/providers/ashby/searchCandidates.js +34 -0
- package/dist/actions/providers/ashby/updateCandidate.d.ts +3 -0
- package/dist/actions/providers/ashby/updateCandidate.js +56 -0
- package/dist/actions/providers/bing/getTopNSearchResultUrls.js +4 -14
- package/dist/actions/providers/confluence/fetchPageContent.js +5 -15
- package/dist/actions/providers/confluence/overwritePage.js +5 -14
- package/dist/actions/providers/finnhub/getBasicFinancials.js +7 -19
- package/dist/actions/providers/finnhub/symbolLookup.js +3 -12
- package/dist/actions/providers/firecrawl/deepResearch.js +11 -21
- package/dist/actions/providers/firecrawl/getTopNSearchResultUrls.js +8 -21
- package/dist/actions/providers/firecrawl/scrapeTweetDataWithNitter.js +4 -13
- package/dist/actions/providers/firecrawl/scrapeUrl.js +16 -21
- package/dist/actions/providers/firecrawl/searchAndScrape.js +6 -17
- package/dist/actions/providers/generic/fillTemplate.js +2 -11
- package/dist/actions/providers/github/createBranch.js +9 -18
- package/dist/actions/providers/github/createOrUpdateFile.js +6 -15
- package/dist/actions/providers/github/createPullRequest.js +5 -14
- package/dist/actions/providers/github/fetchFile.d.ts +3 -0
- package/dist/actions/providers/github/fetchFile.js +131 -0
- package/dist/actions/providers/github/getBranch.js +4 -13
- package/dist/actions/providers/github/getContents.d.ts +3 -0
- package/dist/actions/providers/github/getContents.js +41 -0
- package/dist/actions/providers/github/getFileContent.js +6 -16
- package/dist/actions/providers/github/getPullRequestDetails.js +39 -18
- package/dist/actions/providers/github/listCommits.js +17 -15
- package/dist/actions/providers/github/listDirectory.js +13 -25
- package/dist/actions/providers/github/listPullRequests.js +4 -13
- package/dist/actions/providers/github/searchOrganization.js +29 -49
- package/dist/actions/providers/github/utils.js +5 -16
- package/dist/actions/providers/gitlab/getFileContent.js +13 -24
- package/dist/actions/providers/gitlab/getMergeRequest.js +18 -30
- package/dist/actions/providers/gitlab/listDirectory.js +15 -27
- package/dist/actions/providers/gitlab/searchGroup.js +45 -52
- package/dist/actions/providers/gitlab/utils.js +19 -32
- package/dist/actions/providers/gong/getGongTranscripts.d.ts +3 -0
- package/dist/actions/providers/gong/getGongTranscripts.js +315 -0
- package/dist/actions/providers/google-oauth/addGroupMember.js +3 -12
- package/dist/actions/providers/google-oauth/addTextToTopOfDoc.js +3 -12
- package/dist/actions/providers/google-oauth/appendRowsToSpreadsheet.js +4 -13
- package/dist/actions/providers/google-oauth/createNewGoogleDoc.js +7 -17
- package/dist/actions/providers/google-oauth/createPresentation.js +7 -13
- package/dist/actions/providers/google-oauth/createSpreadsheet.js +7 -13
- package/dist/actions/providers/google-oauth/deleteCalendarEvent.js +3 -12
- package/dist/actions/providers/google-oauth/deleteGroupMember.js +3 -12
- package/dist/actions/providers/google-oauth/deleteRowFromSpreadsheet.js +3 -12
- package/dist/actions/providers/google-oauth/editAGoogleCalendarEvent.js +4 -14
- package/dist/actions/providers/google-oauth/getDriveFileContentById.js +23 -33
- package/dist/actions/providers/google-oauth/getGroup.js +3 -12
- package/dist/actions/providers/google-oauth/getPresentation.js +23 -37
- package/dist/actions/providers/google-oauth/hasGroupMember.js +3 -12
- package/dist/actions/providers/google-oauth/listCalendarEvents.js +27 -21
- package/dist/actions/providers/google-oauth/listCalendars.js +4 -14
- package/dist/actions/providers/google-oauth/listGroupMembers.js +4 -13
- package/dist/actions/providers/google-oauth/listGroups.js +4 -14
- package/dist/actions/providers/google-oauth/queryGoogleBigQuery.js +10 -21
- package/dist/actions/providers/google-oauth/scheduleCalendarMeeting.js +11 -14
- package/dist/actions/providers/google-oauth/searchDriveByKeywords.js +3 -12
- package/dist/actions/providers/google-oauth/searchDriveByKeywordsAndGetFileContent.js +12 -23
- package/dist/actions/providers/google-oauth/searchDriveByQuery.js +30 -42
- package/dist/actions/providers/google-oauth/searchDriveByQueryAndGetFileContent.js +9 -20
- package/dist/actions/providers/google-oauth/updateCalendarEvent.js +3 -12
- package/dist/actions/providers/google-oauth/updateDoc.js +3 -12
- package/dist/actions/providers/google-oauth/updatePresentation.js +3 -12
- package/dist/actions/providers/google-oauth/updateRowsInSpreadsheet.js +4 -13
- package/dist/actions/providers/google-oauth/updateSpreadsheet.js +3 -12
- package/dist/actions/providers/google-oauth/utils/decodeMessage.js +7 -8
- package/dist/actions/providers/googleSearch/customSearch.js +18 -36
- package/dist/actions/providers/googlemail/listGmailThreads.js +7 -16
- package/dist/actions/providers/googlemail/searchGmailMessages.js +10 -20
- package/dist/actions/providers/googlemail/sendGmail.js +7 -17
- package/dist/actions/providers/googlemaps/nearbysearchRestaurants.js +13 -25
- package/dist/actions/providers/googlemaps/validateAddress.js +3 -12
- package/dist/actions/providers/hubspot/getCompanies.js +4 -14
- package/dist/actions/providers/hubspot/getCompanyDetails.js +3 -12
- package/dist/actions/providers/hubspot/getContactDetails.js +3 -12
- package/dist/actions/providers/hubspot/getContacts.js +4 -14
- package/dist/actions/providers/hubspot/getDealDetails.js +3 -12
- package/dist/actions/providers/hubspot/getDeals.js +3 -12
- package/dist/actions/providers/hubspot/getTicketDetails.js +3 -12
- package/dist/actions/providers/hubspot/getTickets.js +3 -12
- package/dist/actions/providers/jamf/getJamfComputerInventory.d.ts +3 -0
- package/dist/actions/providers/jamf/getJamfComputerInventory.js +37 -0
- package/dist/actions/providers/jamf/getJamfFileVaultRecoveryKey.d.ts +3 -0
- package/dist/actions/providers/jamf/getJamfFileVaultRecoveryKey.js +39 -0
- package/dist/actions/providers/jamf/getJamfUserComputerId.d.ts +3 -0
- package/dist/actions/providers/jamf/getJamfUserComputerId.js +45 -0
- package/dist/actions/providers/jamf/lockJamfComputerById.d.ts +3 -0
- package/dist/actions/providers/jamf/lockJamfComputerById.js +39 -0
- package/dist/actions/providers/jira/assignJiraTicket.js +4 -13
- package/dist/actions/providers/jira/commentJiraTicket.js +3 -12
- package/dist/actions/providers/jira/createJiraTicket.js +22 -18
- package/dist/actions/providers/jira/createServiceDeskRequest.js +3 -12
- package/dist/actions/providers/jira/getJiraDCIssuesByQuery.js +5 -14
- package/dist/actions/providers/jira/getJiraIssuesByQuery.js +19 -29
- package/dist/actions/providers/jira/getJiraTicketDetails.js +3 -12
- package/dist/actions/providers/jira/getJiraTicketHistory.js +3 -12
- package/dist/actions/providers/jira/moveJiraTicketToProject.js +11 -21
- package/dist/actions/providers/jira/publicCommentOnServiceDeskRequest.js +3 -12
- package/dist/actions/providers/jira/updateJiraTicketDetails.js +15 -15
- package/dist/actions/providers/jira/updateJiraTicketStatus.js +4 -13
- package/dist/actions/providers/jira/utils.js +104 -126
- package/dist/actions/providers/kandji/getFVRecoveryKeyForDevice.d.ts +3 -0
- package/dist/actions/providers/kandji/getFVRecoveryKeyForDevice.js +85 -0
- package/dist/actions/providers/linear/getIssueDetails.js +10 -20
- package/dist/actions/providers/linear/getIssues.js +11 -21
- package/dist/actions/providers/linear/getProjectDetails.js +10 -20
- package/dist/actions/providers/linear/getProjects.js +6 -16
- package/dist/actions/providers/linear/getTeamDetails.js +7 -17
- package/dist/actions/providers/linear/getTeams.js +5 -15
- package/dist/actions/providers/looker/enableUserByEmail.js +5 -14
- package/dist/actions/providers/math/add.js +2 -11
- package/dist/actions/providers/microsoft/createDocument.js +4 -13
- package/dist/actions/providers/microsoft/getDocument.js +4 -13
- package/dist/actions/providers/microsoft/messageTeamsChannel.js +4 -13
- package/dist/actions/providers/microsoft/messageTeamsChat.js +4 -13
- package/dist/actions/providers/microsoft/updateDocument.js +4 -13
- package/dist/actions/providers/microsoft/updateSpreadsheet.js +4 -13
- package/dist/actions/providers/microsoft/utils.js +9 -20
- package/dist/actions/providers/mongodb/insertMongoDoc.js +5 -14
- package/dist/actions/providers/notion/searchByTitle.js +3 -12
- package/dist/actions/providers/nws/getForecastForLocation.js +4 -13
- package/dist/actions/providers/okta/addUserToGroup.d.ts +3 -0
- package/dist/actions/providers/okta/addUserToGroup.js +56 -0
- package/dist/actions/providers/okta/getOktaGroup.d.ts +3 -0
- package/dist/actions/providers/okta/getOktaGroup.js +73 -0
- package/dist/actions/providers/okta/getOktaUser.d.ts +3 -0
- package/dist/actions/providers/okta/getOktaUser.js +40 -0
- package/dist/actions/providers/okta/listMFA.d.ts +3 -0
- package/dist/actions/providers/okta/listMFA.js +52 -0
- package/dist/actions/providers/okta/listOktaGroupMembers.d.ts +3 -0
- package/dist/actions/providers/okta/listOktaGroupMembers.js +99 -0
- package/dist/actions/providers/okta/listOktaGroups.d.ts +3 -0
- package/dist/actions/providers/okta/listOktaGroups.js +92 -0
- package/dist/actions/providers/okta/listOktaUserGroups.d.ts +3 -0
- package/dist/actions/providers/okta/listOktaUserGroups.js +83 -0
- package/dist/actions/providers/okta/listOktaUsers.d.ts +3 -0
- package/dist/actions/providers/okta/listOktaUsers.js +100 -0
- package/dist/actions/providers/okta/removeUserFromGroup.d.ts +3 -0
- package/dist/actions/providers/okta/removeUserFromGroup.js +56 -0
- package/dist/actions/providers/okta/resetMFA.d.ts +3 -0
- package/dist/actions/providers/okta/resetMFA.js +62 -0
- package/dist/actions/providers/okta/resetPassword.d.ts +3 -0
- package/dist/actions/providers/okta/resetPassword.js +57 -0
- package/dist/actions/providers/okta/triggerOktaWorkflow.d.ts +3 -0
- package/dist/actions/providers/okta/triggerOktaWorkflow.js +44 -0
- package/dist/actions/providers/oktaOrg/getOktaUserByName.js +3 -12
- package/dist/actions/providers/openstreetmap/getLatitudeLongitudeFromLocation.js +3 -12
- package/dist/actions/providers/perplexity/perplexityDeepResearch.js +11 -21
- package/dist/actions/providers/resend/sendEmail.js +3 -12
- package/dist/actions/providers/resend/sendEmailHtml.js +3 -12
- package/dist/actions/providers/salesforce/createCase.js +10 -13
- package/dist/actions/providers/salesforce/createRecord.js +3 -12
- package/dist/actions/providers/salesforce/executeReport.js +3 -12
- package/dist/actions/providers/salesforce/fetchSalesforceSchema.d.ts +3 -0
- package/dist/actions/providers/salesforce/fetchSalesforceSchema.js +40 -0
- package/dist/actions/providers/salesforce/generateSalesReport.js +3 -12
- package/dist/actions/providers/salesforce/getRecord.js +3 -12
- package/dist/actions/providers/salesforce/getReportMetadata.js +11 -21
- package/dist/actions/providers/salesforce/getSalesforceRecordsByQuery.js +7 -17
- package/dist/actions/providers/salesforce/listReports.js +3 -12
- package/dist/actions/providers/salesforce/searchAllSalesforceRecords.js +3 -12
- package/dist/actions/providers/salesforce/searchSalesforceRecords.js +3 -12
- package/dist/actions/providers/salesforce/updateRecord.js +3 -12
- package/dist/actions/providers/slack/archiveChannel.d.ts +3 -0
- package/dist/actions/providers/slack/archiveChannel.js +42 -0
- package/dist/actions/providers/slack/createChannel.js +7 -17
- package/dist/actions/providers/slack/getChannelMembers.js +8 -18
- package/dist/actions/providers/slack/getChannelMessages.js +8 -18
- package/dist/actions/providers/slack/helpers.js +16 -47
- package/dist/actions/providers/slack/messageTransformers.js +10 -13
- package/dist/actions/providers/slack/sendDmFromBot.js +9 -19
- package/dist/actions/providers/slack/sendMessage.js +7 -17
- package/dist/actions/providers/slackUser/searchSlack.js +179 -212
- package/dist/actions/providers/slackUser/searchSlackRTS.js +41 -38
- package/dist/actions/providers/slackUser/utils.js +1 -1
- package/dist/actions/providers/snowflake/auth/getSnowflakeConnection.js +23 -34
- package/dist/actions/providers/snowflake/getRowByFieldValue.js +4 -13
- package/dist/actions/providers/snowflake/runSnowflakeQuery.js +9 -19
- package/dist/actions/providers/zendesk/addCommentToTicket.js +5 -14
- package/dist/actions/providers/zendesk/assignTicket.js +3 -12
- package/dist/actions/providers/zendesk/createZendeskTicket.js +3 -12
- package/dist/actions/providers/zendesk/getTicketDetails.js +3 -12
- package/dist/actions/providers/zendesk/listTickets.js +3 -12
- package/dist/actions/providers/zendesk/searchZendeskByQuery.js +3 -12
- package/dist/actions/providers/zendesk/updateTicketStatus.js +3 -12
- package/dist/actions/util/axiosClient.js +5 -5
- package/dist/app.js +14 -25
- package/dist/utils/google.js +122 -143
- package/dist/utils/pdf.js +10 -21
- package/package.json +10 -9
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
const getJamfUserComputerId = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
12
|
+
const { authToken, subdomain } = authParams;
|
|
13
|
+
const { userEmail } = params;
|
|
14
|
+
if (!subdomain || !authToken) {
|
|
15
|
+
throw new Error("Instance and authToken are required to fetch Jamf user computer ID");
|
|
16
|
+
}
|
|
17
|
+
const url = `https://${subdomain}.jamfcloud.com`;
|
|
18
|
+
try {
|
|
19
|
+
const computers = yield axiosClient.get(`${url}/api/v1/computers-inventory`, {
|
|
20
|
+
headers: {
|
|
21
|
+
Authorization: `Bearer ${authToken}`,
|
|
22
|
+
Accept: "application/json",
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
const filteredComputers = computers.data.results.filter(computer => { var _a; return ((_a = computer.userAndLocation) === null || _a === void 0 ? void 0 : _a.email) === userEmail; });
|
|
26
|
+
if (filteredComputers.length === 0) {
|
|
27
|
+
return {
|
|
28
|
+
success: false,
|
|
29
|
+
error: `No computers found for user with email: ${userEmail}`,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
success: true,
|
|
34
|
+
computerId: filteredComputers[0].id,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
console.error("Error retrieving Jamf user computer ID: ", error);
|
|
39
|
+
return {
|
|
40
|
+
success: false,
|
|
41
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
export default getJamfUserComputerId;
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
const lockJamfComputerById = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
12
|
+
const { authToken, subdomain } = authParams;
|
|
13
|
+
const { computerId, passcode } = params;
|
|
14
|
+
if (!subdomain || !authToken) {
|
|
15
|
+
throw new Error("Instance and authToken are required to fetch Jamf user computer ID");
|
|
16
|
+
}
|
|
17
|
+
const url = `https://${subdomain}.jamfcloud.com`;
|
|
18
|
+
try {
|
|
19
|
+
yield axiosClient.post(`${url}/JSSResource/computercommands/command/DeviceLock/id/${computerId}`, {
|
|
20
|
+
passcode,
|
|
21
|
+
}, {
|
|
22
|
+
headers: {
|
|
23
|
+
Authorization: `Bearer ${authToken}`,
|
|
24
|
+
Accept: "application/json",
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
return {
|
|
28
|
+
success: true,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
console.error("Error locking Jamf computer: ", error);
|
|
33
|
+
return {
|
|
34
|
+
success: false,
|
|
35
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
export default lockJamfComputerById;
|
|
@@ -1,15 +1,6 @@
|
|
|
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
1
|
import axios from "axios";
|
|
11
2
|
import { getUserAccountIdFromEmail, getJiraApiConfig, getErrorMessage } from "./utils.js";
|
|
12
|
-
const assignJiraTicket =
|
|
3
|
+
const assignJiraTicket = async ({ params, authParams, }) => {
|
|
13
4
|
const { authToken } = authParams;
|
|
14
5
|
const { apiUrl, browseUrl, strategy } = getJiraApiConfig(authParams);
|
|
15
6
|
const { issueId, assignee } = params;
|
|
@@ -19,7 +10,7 @@ const assignJiraTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
|
19
10
|
try {
|
|
20
11
|
let assigneeId = assignee;
|
|
21
12
|
if (assigneeId && assigneeId.includes("@")) {
|
|
22
|
-
assigneeId =
|
|
13
|
+
assigneeId = await getUserAccountIdFromEmail(assigneeId, apiUrl, authToken, strategy);
|
|
23
14
|
}
|
|
24
15
|
if (!assigneeId) {
|
|
25
16
|
throw new Error("Unable to get valid assignee account ID.");
|
|
@@ -28,7 +19,7 @@ const assignJiraTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
|
28
19
|
if (!assigneePayload) {
|
|
29
20
|
throw new Error("Unable to create assignee payload.");
|
|
30
21
|
}
|
|
31
|
-
|
|
22
|
+
await axios.put(`${apiUrl}/issue/${issueId}/assignee`, assigneePayload, {
|
|
32
23
|
headers: {
|
|
33
24
|
Authorization: `Bearer ${authToken}`,
|
|
34
25
|
Accept: "application/json",
|
|
@@ -47,5 +38,5 @@ const assignJiraTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
|
47
38
|
error: getErrorMessage(error),
|
|
48
39
|
};
|
|
49
40
|
}
|
|
50
|
-
}
|
|
41
|
+
};
|
|
51
42
|
export default assignJiraTicket;
|
|
@@ -1,15 +1,6 @@
|
|
|
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
1
|
import { axiosClient } from "../../util/axiosClient.js";
|
|
11
2
|
import { getJiraApiConfig, getErrorMessage } from "./utils.js";
|
|
12
|
-
const commentJiraTicket =
|
|
3
|
+
const commentJiraTicket = async ({ params, authParams, }) => {
|
|
13
4
|
const { authToken } = authParams;
|
|
14
5
|
const { apiUrl, browseUrl, strategy } = getJiraApiConfig(authParams);
|
|
15
6
|
const { issueId, comment } = params;
|
|
@@ -17,7 +8,7 @@ const commentJiraTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ p
|
|
|
17
8
|
throw new Error("Auth token is required");
|
|
18
9
|
}
|
|
19
10
|
try {
|
|
20
|
-
const response =
|
|
11
|
+
const response = await axiosClient.post(`${apiUrl}/issue/${issueId}/comment`, {
|
|
21
12
|
body: strategy.formatText(comment),
|
|
22
13
|
}, {
|
|
23
14
|
headers: {
|
|
@@ -38,5 +29,5 @@ const commentJiraTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ p
|
|
|
38
29
|
error: getErrorMessage(error),
|
|
39
30
|
};
|
|
40
31
|
}
|
|
41
|
-
}
|
|
32
|
+
};
|
|
42
33
|
export default commentJiraTicket;
|
|
@@ -1,37 +1,37 @@
|
|
|
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
1
|
import { axiosClient } from "../../util/axiosClient.js";
|
|
11
2
|
import { resolveAccountIdIfEmail, resolveRequestTypeField, getJiraApiConfig, getErrorMessage } from "./utils.js";
|
|
12
|
-
const createJiraTicket =
|
|
3
|
+
const createJiraTicket = async ({ params, authParams, }) => {
|
|
13
4
|
const { authToken } = authParams;
|
|
14
5
|
const { apiUrl, browseUrl, strategy } = getJiraApiConfig(authParams);
|
|
15
6
|
// authToken is guaranteed to exist after getJiraApiConfig succeeds
|
|
16
7
|
if (!authToken) {
|
|
17
8
|
throw new Error("Auth token is required");
|
|
18
9
|
}
|
|
19
|
-
const [reporterId, assigneeId] =
|
|
10
|
+
const [reporterId, assigneeId] = await Promise.all([
|
|
20
11
|
resolveAccountIdIfEmail(params.reporter, apiUrl, authToken, strategy),
|
|
21
12
|
resolveAccountIdIfEmail(params.assignee, apiUrl, authToken, strategy),
|
|
22
13
|
]);
|
|
23
|
-
const { field: requestTypeField, message: partialUpdateMessage } =
|
|
14
|
+
const { field: requestTypeField, message: partialUpdateMessage } = await resolveRequestTypeField(params.requestTypeId, params.projectKey, apiUrl, authToken);
|
|
24
15
|
const reporterAssignment = strategy.formatUserAssignment(reporterId);
|
|
25
16
|
const assigneeAssignment = strategy.formatUserAssignment(assigneeId);
|
|
26
17
|
const payload = {
|
|
27
|
-
fields:
|
|
18
|
+
fields: {
|
|
19
|
+
project: {
|
|
28
20
|
key: params.projectKey,
|
|
29
|
-
},
|
|
21
|
+
},
|
|
22
|
+
summary: params.summary,
|
|
23
|
+
description: strategy.formatText(params.description),
|
|
24
|
+
issuetype: {
|
|
30
25
|
name: params.issueType,
|
|
31
|
-
}
|
|
26
|
+
},
|
|
27
|
+
...(reporterAssignment && { reporter: reporterAssignment }),
|
|
28
|
+
...(assigneeAssignment && { assignee: assigneeAssignment }),
|
|
29
|
+
...(Object.keys(requestTypeField).length > 0 && requestTypeField),
|
|
30
|
+
...(params.customFields && params.customFields),
|
|
31
|
+
},
|
|
32
32
|
};
|
|
33
33
|
try {
|
|
34
|
-
const response =
|
|
34
|
+
const response = await axiosClient.post(`${apiUrl}/issue`, payload, {
|
|
35
35
|
headers: {
|
|
36
36
|
Authorization: `Bearer ${authToken}`,
|
|
37
37
|
Accept: "application/json",
|
|
@@ -46,7 +46,11 @@ const createJiraTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
|
46
46
|
console.error("No ticket key in response:", JSON.stringify(response.data, null, 2));
|
|
47
47
|
throw new Error("Failed to get ticket key from Jira response");
|
|
48
48
|
}
|
|
49
|
-
return
|
|
49
|
+
return {
|
|
50
|
+
success: true,
|
|
51
|
+
ticketUrl: `${browseUrl}/browse/${ticketKey}`,
|
|
52
|
+
...(partialUpdateMessage && { error: partialUpdateMessage }),
|
|
53
|
+
};
|
|
50
54
|
}
|
|
51
55
|
catch (error) {
|
|
52
56
|
return {
|
|
@@ -54,5 +58,5 @@ const createJiraTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
|
54
58
|
error: getErrorMessage(error),
|
|
55
59
|
};
|
|
56
60
|
}
|
|
57
|
-
}
|
|
61
|
+
};
|
|
58
62
|
export default createJiraTicket;
|
|
@@ -1,14 +1,5 @@
|
|
|
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
1
|
import { axiosClient } from "../../util/axiosClient.js";
|
|
11
|
-
const createServiceDeskRequest =
|
|
2
|
+
const createServiceDeskRequest = async ({ params, authParams, }) => {
|
|
12
3
|
const { serviceDeskId, requestTypeId, summary, description, reporter } = params;
|
|
13
4
|
const { authToken, cloudId } = authParams;
|
|
14
5
|
if (!cloudId || !authToken) {
|
|
@@ -16,7 +7,7 @@ const createServiceDeskRequest = (_a) => __awaiter(void 0, [_a], void 0, functio
|
|
|
16
7
|
}
|
|
17
8
|
const baseUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/servicedeskapi/request`;
|
|
18
9
|
try {
|
|
19
|
-
const response =
|
|
10
|
+
const response = await axiosClient.post(baseUrl, {
|
|
20
11
|
requestTypeId,
|
|
21
12
|
serviceDeskId,
|
|
22
13
|
// summary,
|
|
@@ -50,5 +41,5 @@ const createServiceDeskRequest = (_a) => __awaiter(void 0, [_a], void 0, functio
|
|
|
50
41
|
error: error instanceof Error ? error.message : "Unknown error",
|
|
51
42
|
};
|
|
52
43
|
}
|
|
53
|
-
}
|
|
44
|
+
};
|
|
54
45
|
export default createServiceDeskRequest;
|
|
@@ -1,12 +1,3 @@
|
|
|
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
1
|
import { axiosClient } from "../../util/axiosClient.js";
|
|
11
2
|
import { getJiraApiConfig, getErrorMessage, extractPlainText } from "./utils.js";
|
|
12
3
|
const DEFAULT_LIMIT = 100;
|
|
@@ -15,7 +6,7 @@ const DEFAULT_LIMIT = 100;
|
|
|
15
6
|
* Uses startAt parameter to paginate through the results while
|
|
16
7
|
* getJiraIssuesByQuery uses nextPageToken parameter to paginate through the results.
|
|
17
8
|
*/
|
|
18
|
-
const getJiraDCIssuesByQuery =
|
|
9
|
+
const getJiraDCIssuesByQuery = async ({ params, authParams, }) => {
|
|
19
10
|
const { authToken } = authParams;
|
|
20
11
|
const { query, limit } = params;
|
|
21
12
|
const { apiUrl, browseUrl, strategy } = getJiraApiConfig(authParams);
|
|
@@ -42,7 +33,7 @@ const getJiraDCIssuesByQuery = (_a) => __awaiter(void 0, [_a], void 0, function*
|
|
|
42
33
|
"aggregatetimeoriginalestimate",
|
|
43
34
|
];
|
|
44
35
|
const searchEndpoint = strategy.getSearchEndpoint();
|
|
45
|
-
const requestedLimit = limit
|
|
36
|
+
const requestedLimit = limit ?? DEFAULT_LIMIT;
|
|
46
37
|
const allIssues = [];
|
|
47
38
|
let startAt = 0;
|
|
48
39
|
try {
|
|
@@ -57,7 +48,7 @@ const getJiraDCIssuesByQuery = (_a) => __awaiter(void 0, [_a], void 0, function*
|
|
|
57
48
|
queryParams.set("startAt", String(startAt));
|
|
58
49
|
queryParams.set("fields", fields.join(","));
|
|
59
50
|
const fullApiUrl = `${apiUrl}${searchEndpoint}?${queryParams.toString()}`;
|
|
60
|
-
const response =
|
|
51
|
+
const response = await axiosClient.get(fullApiUrl, {
|
|
61
52
|
headers: {
|
|
62
53
|
Authorization: `Bearer ${authToken}`,
|
|
63
54
|
Accept: "application/json",
|
|
@@ -120,7 +111,7 @@ const getJiraDCIssuesByQuery = (_a) => __awaiter(void 0, [_a], void 0, function*
|
|
|
120
111
|
: null,
|
|
121
112
|
created,
|
|
122
113
|
updated,
|
|
123
|
-
resolution:
|
|
114
|
+
resolution: resolution?.name || null,
|
|
124
115
|
dueDate: duedate || null,
|
|
125
116
|
url: ticketUrl,
|
|
126
117
|
},
|
|
@@ -135,5 +126,5 @@ const getJiraDCIssuesByQuery = (_a) => __awaiter(void 0, [_a], void 0, function*
|
|
|
135
126
|
error: getErrorMessage(error),
|
|
136
127
|
};
|
|
137
128
|
}
|
|
138
|
-
}
|
|
129
|
+
};
|
|
139
130
|
export default getJiraDCIssuesByQuery;
|
|
@@ -1,16 +1,7 @@
|
|
|
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
1
|
import { Version3Client } from "jira.js";
|
|
11
2
|
import { getJiraApiConfig, getErrorMessage, extractPlainText, getUserInfoFromAccountId } from "./utils.js";
|
|
12
3
|
const DEFAULT_LIMIT = 100;
|
|
13
|
-
const getJiraIssuesByQuery =
|
|
4
|
+
const getJiraIssuesByQuery = async ({ params, authParams, }) => {
|
|
14
5
|
const { authToken, cloudId } = authParams;
|
|
15
6
|
const { query, limit } = params;
|
|
16
7
|
const { browseUrl } = getJiraApiConfig(authParams);
|
|
@@ -37,7 +28,7 @@ const getJiraIssuesByQuery = (_a) => __awaiter(void 0, [_a], void 0, function* (
|
|
|
37
28
|
"timespent",
|
|
38
29
|
"aggregatetimeoriginalestimate",
|
|
39
30
|
];
|
|
40
|
-
const requestedLimit = limit
|
|
31
|
+
const requestedLimit = limit ?? DEFAULT_LIMIT;
|
|
41
32
|
const allIssues = [];
|
|
42
33
|
let nextPageToken = undefined;
|
|
43
34
|
try {
|
|
@@ -56,7 +47,7 @@ const getJiraIssuesByQuery = (_a) => __awaiter(void 0, [_a], void 0, function* (
|
|
|
56
47
|
const remainingIssues = requestedLimit - allIssues.length;
|
|
57
48
|
const maxResults = Math.min(remainingIssues, DEFAULT_LIMIT);
|
|
58
49
|
// Use the enhanced search endpoint (recommended)
|
|
59
|
-
const searchResults =
|
|
50
|
+
const searchResults = await client.issueSearch.searchForIssuesUsingJqlEnhancedSearch({
|
|
60
51
|
jql: query,
|
|
61
52
|
nextPageToken,
|
|
62
53
|
maxResults,
|
|
@@ -73,15 +64,14 @@ const getJiraIssuesByQuery = (_a) => __awaiter(void 0, [_a], void 0, function* (
|
|
|
73
64
|
nextPageToken = searchResults.nextPageToken;
|
|
74
65
|
}
|
|
75
66
|
// Map issues with email addresses
|
|
76
|
-
const results =
|
|
77
|
-
var _b;
|
|
67
|
+
const results = await Promise.all(allIssues.map(async ({ id, key, fields }) => {
|
|
78
68
|
const ticketUrl = `${browseUrl}/browse/${key}`;
|
|
79
69
|
const { summary, description, project, issuetype, status, assignee, reporter, creator, created, updated, resolution, duedate, } = fields;
|
|
80
70
|
// Fetch user info in parallel
|
|
81
|
-
const [assigneeInfo, reporterInfo, creatorInfo] =
|
|
82
|
-
getUserInfoFromAccountId(assignee
|
|
83
|
-
getUserInfoFromAccountId(reporter
|
|
84
|
-
getUserInfoFromAccountId(creator
|
|
71
|
+
const [assigneeInfo, reporterInfo, creatorInfo] = await Promise.all([
|
|
72
|
+
getUserInfoFromAccountId(assignee?.accountId, client),
|
|
73
|
+
getUserInfoFromAccountId(reporter?.accountId, client),
|
|
74
|
+
getUserInfoFromAccountId(creator?.accountId, client),
|
|
85
75
|
]);
|
|
86
76
|
return {
|
|
87
77
|
name: key,
|
|
@@ -92,30 +82,30 @@ const getJiraIssuesByQuery = (_a) => __awaiter(void 0, [_a], void 0, function* (
|
|
|
92
82
|
summary,
|
|
93
83
|
description: extractPlainText(description),
|
|
94
84
|
project: {
|
|
95
|
-
id: project
|
|
96
|
-
key: project
|
|
97
|
-
name: project
|
|
85
|
+
id: project?.id,
|
|
86
|
+
key: project?.key,
|
|
87
|
+
name: project?.name,
|
|
98
88
|
},
|
|
99
89
|
issueType: {
|
|
100
|
-
id: issuetype
|
|
101
|
-
name: issuetype
|
|
90
|
+
id: issuetype?.id,
|
|
91
|
+
name: issuetype?.name,
|
|
102
92
|
},
|
|
103
93
|
status: {
|
|
104
|
-
id: status
|
|
105
|
-
name: status
|
|
106
|
-
category:
|
|
94
|
+
id: status?.id,
|
|
95
|
+
name: status?.name,
|
|
96
|
+
category: status?.statusCategory?.name,
|
|
107
97
|
},
|
|
108
98
|
assignee: assigneeInfo,
|
|
109
99
|
reporter: reporterInfo,
|
|
110
100
|
creator: creatorInfo,
|
|
111
101
|
created: created,
|
|
112
102
|
updated: updated,
|
|
113
|
-
resolution: resolution
|
|
103
|
+
resolution: resolution?.name,
|
|
114
104
|
dueDate: duedate,
|
|
115
105
|
url: ticketUrl,
|
|
116
106
|
},
|
|
117
107
|
};
|
|
118
|
-
}))
|
|
108
|
+
}));
|
|
119
109
|
return { results };
|
|
120
110
|
}
|
|
121
111
|
catch (error) {
|
|
@@ -125,5 +115,5 @@ const getJiraIssuesByQuery = (_a) => __awaiter(void 0, [_a], void 0, function* (
|
|
|
125
115
|
error: getErrorMessage(error),
|
|
126
116
|
};
|
|
127
117
|
}
|
|
128
|
-
}
|
|
118
|
+
};
|
|
129
119
|
export default getJiraIssuesByQuery;
|
|
@@ -1,16 +1,7 @@
|
|
|
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
1
|
import { axiosClient } from "../../util/axiosClient.js";
|
|
11
2
|
import { getJiraApiConfig, getErrorMessage } from "./utils.js";
|
|
12
3
|
// https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issues/#api-rest-api-2-issue-issueidorkey-get
|
|
13
|
-
const getJiraTicketDetails =
|
|
4
|
+
const getJiraTicketDetails = async ({ params, authParams, }) => {
|
|
14
5
|
const { authToken, baseUrl } = authParams;
|
|
15
6
|
const { issueId } = params;
|
|
16
7
|
const { apiUrl } = getJiraApiConfig(authParams);
|
|
@@ -19,7 +10,7 @@ const getJiraTicketDetails = (_a) => __awaiter(void 0, [_a], void 0, function* (
|
|
|
19
10
|
}
|
|
20
11
|
const fullApiUrl = `${apiUrl}/issue/${issueId}`;
|
|
21
12
|
try {
|
|
22
|
-
const response =
|
|
13
|
+
const response = await axiosClient.get(fullApiUrl, {
|
|
23
14
|
headers: {
|
|
24
15
|
Authorization: `Bearer ${authToken}`,
|
|
25
16
|
Accept: "application/json",
|
|
@@ -43,5 +34,5 @@ const getJiraTicketDetails = (_a) => __awaiter(void 0, [_a], void 0, function* (
|
|
|
43
34
|
error: getErrorMessage(error),
|
|
44
35
|
};
|
|
45
36
|
}
|
|
46
|
-
}
|
|
37
|
+
};
|
|
47
38
|
export default getJiraTicketDetails;
|
|
@@ -1,15 +1,6 @@
|
|
|
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
1
|
import { axiosClient } from "../../util/axiosClient.js";
|
|
11
2
|
import { getJiraApiConfig, getErrorMessage } from "./utils.js";
|
|
12
|
-
const getJiraTicketHistory =
|
|
3
|
+
const getJiraTicketHistory = async ({ params, authParams, }) => {
|
|
13
4
|
const { authToken } = authParams;
|
|
14
5
|
const { issueId } = params;
|
|
15
6
|
const { apiUrl, strategy } = getJiraApiConfig(authParams);
|
|
@@ -18,7 +9,7 @@ const getJiraTicketHistory = (_a) => __awaiter(void 0, [_a], void 0, function* (
|
|
|
18
9
|
}
|
|
19
10
|
const fullApiUrl = `${apiUrl}${strategy.getHistoryEndpoint(issueId)}`;
|
|
20
11
|
try {
|
|
21
|
-
const response =
|
|
12
|
+
const response = await axiosClient.get(fullApiUrl, {
|
|
22
13
|
headers: {
|
|
23
14
|
Authorization: `Bearer ${authToken}`,
|
|
24
15
|
Accept: "application/json",
|
|
@@ -37,5 +28,5 @@ const getJiraTicketHistory = (_a) => __awaiter(void 0, [_a], void 0, function* (
|
|
|
37
28
|
error: getErrorMessage(error),
|
|
38
29
|
};
|
|
39
30
|
}
|
|
40
|
-
}
|
|
31
|
+
};
|
|
41
32
|
export default getJiraTicketHistory;
|
|
@@ -1,19 +1,9 @@
|
|
|
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
1
|
import { axiosClient } from "../../util/axiosClient.js";
|
|
11
2
|
import { getJiraApiConfig, getErrorMessage } from "./utils.js";
|
|
12
3
|
// Polling configuration
|
|
13
4
|
const POLL_INTERVAL_MS = 1000;
|
|
14
5
|
const MAX_POLL_ATTEMPTS = 30; // 30 seconds max wait
|
|
15
|
-
const moveJiraTicketToProject =
|
|
16
|
-
var _b;
|
|
6
|
+
const moveJiraTicketToProject = async ({ params, authParams, }) => {
|
|
17
7
|
const { authToken } = authParams;
|
|
18
8
|
const { issueId, targetProjectKey, targetIssueType } = params;
|
|
19
9
|
const { apiUrl, browseUrl } = getJiraApiConfig(authParams);
|
|
@@ -22,7 +12,7 @@ const moveJiraTicketToProject = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
|
22
12
|
}
|
|
23
13
|
try {
|
|
24
14
|
// First, get the current issue details
|
|
25
|
-
const issueResponse =
|
|
15
|
+
const issueResponse = await axiosClient.get(`${apiUrl}/issue/${issueId}`, {
|
|
26
16
|
headers: {
|
|
27
17
|
Authorization: `Bearer ${authToken}`,
|
|
28
18
|
Accept: "application/json",
|
|
@@ -41,7 +31,7 @@ const moveJiraTicketToProject = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
|
41
31
|
};
|
|
42
32
|
}
|
|
43
33
|
// Get the target project's available issue types
|
|
44
|
-
const issueTypesResponse =
|
|
34
|
+
const issueTypesResponse = await axiosClient.get(`${apiUrl}/issue/createmeta/${targetProjectKey}/issuetypes`, {
|
|
45
35
|
headers: {
|
|
46
36
|
Authorization: `Bearer ${authToken}`,
|
|
47
37
|
Accept: "application/json",
|
|
@@ -94,7 +84,7 @@ const moveJiraTicketToProject = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
|
94
84
|
};
|
|
95
85
|
let taskId;
|
|
96
86
|
try {
|
|
97
|
-
const response =
|
|
87
|
+
const response = await axiosClient.post(`${apiUrl}/bulk/issues/move`, movePayload, {
|
|
98
88
|
headers: {
|
|
99
89
|
Authorization: `Bearer ${authToken}`,
|
|
100
90
|
Accept: "application/json",
|
|
@@ -113,9 +103,9 @@ const moveJiraTicketToProject = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
|
113
103
|
// Poll the task until it completes
|
|
114
104
|
let taskStatus;
|
|
115
105
|
for (let attempt = 0; attempt < MAX_POLL_ATTEMPTS; attempt++) {
|
|
116
|
-
|
|
106
|
+
await new Promise(resolve => setTimeout(resolve, POLL_INTERVAL_MS));
|
|
117
107
|
try {
|
|
118
|
-
const taskResponse =
|
|
108
|
+
const taskResponse = await axiosClient.get(`${apiUrl}/task/${taskId}`, {
|
|
119
109
|
headers: {
|
|
120
110
|
Authorization: `Bearer ${authToken}`,
|
|
121
111
|
Accept: "application/json",
|
|
@@ -134,7 +124,7 @@ const moveJiraTicketToProject = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
|
134
124
|
};
|
|
135
125
|
}
|
|
136
126
|
}
|
|
137
|
-
catch
|
|
127
|
+
catch {
|
|
138
128
|
// Continue polling on transient errors
|
|
139
129
|
console.error("Error polling task status");
|
|
140
130
|
}
|
|
@@ -142,13 +132,13 @@ const moveJiraTicketToProject = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
|
142
132
|
if (!taskStatus || taskStatus.status !== "COMPLETE") {
|
|
143
133
|
return {
|
|
144
134
|
success: false,
|
|
145
|
-
error: `Move task did not complete within ${MAX_POLL_ATTEMPTS} seconds. Last status: ${
|
|
135
|
+
error: `Move task did not complete within ${MAX_POLL_ATTEMPTS} seconds. Last status: ${taskStatus?.status ?? "unknown"}`,
|
|
146
136
|
};
|
|
147
137
|
}
|
|
148
138
|
// Fetch the updated issue to get the new key (use immutable id since key changes on project move)
|
|
149
139
|
let newKey = currentIssueKey;
|
|
150
140
|
try {
|
|
151
|
-
const updatedIssueResponse =
|
|
141
|
+
const updatedIssueResponse = await axiosClient.get(`${apiUrl}/issue/${issueInternalId}`, {
|
|
152
142
|
headers: {
|
|
153
143
|
Authorization: `Bearer ${authToken}`,
|
|
154
144
|
Accept: "application/json",
|
|
@@ -156,7 +146,7 @@ const moveJiraTicketToProject = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
|
156
146
|
});
|
|
157
147
|
newKey = updatedIssueResponse.data.key;
|
|
158
148
|
}
|
|
159
|
-
catch
|
|
149
|
+
catch {
|
|
160
150
|
// Continue with original key
|
|
161
151
|
console.error("Error fetching updated issue");
|
|
162
152
|
}
|
|
@@ -172,5 +162,5 @@ const moveJiraTicketToProject = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
|
172
162
|
error: getErrorMessage(error),
|
|
173
163
|
};
|
|
174
164
|
}
|
|
175
|
-
}
|
|
165
|
+
};
|
|
176
166
|
export default moveJiraTicketToProject;
|
|
@@ -1,14 +1,5 @@
|
|
|
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
1
|
import { axiosClient } from "../../util/axiosClient.js";
|
|
11
|
-
const publicCommentOnServiceDeskRequest =
|
|
2
|
+
const publicCommentOnServiceDeskRequest = async ({ params, authParams, }) => {
|
|
12
3
|
const { issueId, comment } = params;
|
|
13
4
|
const { authToken, cloudId } = authParams;
|
|
14
5
|
if (!cloudId || !authToken) {
|
|
@@ -16,7 +7,7 @@ const publicCommentOnServiceDeskRequest = (_a) => __awaiter(void 0, [_a], void 0
|
|
|
16
7
|
}
|
|
17
8
|
const baseUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/servicedeskapi/request/${issueId}/comment`;
|
|
18
9
|
try {
|
|
19
|
-
const response =
|
|
10
|
+
const response = await axiosClient.post(baseUrl, {
|
|
20
11
|
body: comment,
|
|
21
12
|
public: true,
|
|
22
13
|
}, {
|
|
@@ -39,5 +30,5 @@ const publicCommentOnServiceDeskRequest = (_a) => __awaiter(void 0, [_a], void 0
|
|
|
39
30
|
error: error instanceof Error ? error.message : "Unknown error",
|
|
40
31
|
};
|
|
41
32
|
}
|
|
42
|
-
}
|
|
33
|
+
};
|
|
43
34
|
export default publicCommentOnServiceDeskRequest;
|