@credal/actions 0.2.197 → 0.2.199
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 +8 -1
- package/dist/actions/autogen/templates.d.ts +1 -0
- package/dist/actions/autogen/templates.js +79 -18
- package/dist/actions/autogen/types.d.ts +39 -0
- package/dist/actions/autogen/types.js +43 -8
- package/dist/actions/groups.js +4 -1
- 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/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/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/replyToGmail.d.ts +3 -0
- package/dist/actions/providers/googlemail/replyToGmail.js +89 -0
- 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/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/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/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/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.js +9 -2
- 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 +20 -33
- 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
- package/dist/actions/providers/credal/callCopilot.d.ts +0 -3
- package/dist/actions/providers/credal/callCopilot.js +0 -36
- package/dist/actions/providers/math/index.d.ts +0 -1
- package/dist/actions/providers/math/index.js +0 -37
- package/dist/actions/providers/salesforce/getSalesforceRecordByQuery.d.ts +0 -3
- package/dist/actions/providers/salesforce/getSalesforceRecordByQuery.js +0 -43
- 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
|
@@ -1,25 +1,16 @@
|
|
|
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 validateAddress =
|
|
2
|
+
const validateAddress = async ({ params, authParams, }) => {
|
|
12
3
|
const url = `https://addressvalidation.googleapis.com/v1:validateAddress?key=${authParams.apiKey}`;
|
|
13
4
|
const requestBody = {
|
|
14
5
|
address: {
|
|
15
6
|
addressLines: [...params.addressLines, params.locality, params.regionCode, params.postalCode],
|
|
16
7
|
},
|
|
17
8
|
};
|
|
18
|
-
const response =
|
|
9
|
+
const response = await axiosClient.post(url, requestBody, {
|
|
19
10
|
headers: {
|
|
20
11
|
"Content-Type": "application/json",
|
|
21
12
|
},
|
|
22
13
|
});
|
|
23
14
|
return response.data;
|
|
24
|
-
}
|
|
15
|
+
};
|
|
25
16
|
export default validateAddress;
|
|
@@ -1,15 +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 getCompanies =
|
|
12
|
-
var _b;
|
|
2
|
+
const getCompanies = async ({ params, authParams, }) => {
|
|
13
3
|
const { authToken } = authParams;
|
|
14
4
|
const { query, limit = 100 } = params;
|
|
15
5
|
if (!authToken) {
|
|
@@ -36,7 +26,7 @@ const getCompanies = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params
|
|
|
36
26
|
if (after) {
|
|
37
27
|
requestBody.after = after;
|
|
38
28
|
}
|
|
39
|
-
const response =
|
|
29
|
+
const response = await axiosClient.post(url, requestBody, {
|
|
40
30
|
headers: {
|
|
41
31
|
Authorization: `Bearer ${authToken}`,
|
|
42
32
|
"Content-Type": "application/json",
|
|
@@ -52,7 +42,7 @@ const getCompanies = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params
|
|
|
52
42
|
createdAt: createdate,
|
|
53
43
|
};
|
|
54
44
|
}));
|
|
55
|
-
if (
|
|
45
|
+
if (paging?.next?.after && allCompanies.length < maxLimit) {
|
|
56
46
|
after = paging.next.after;
|
|
57
47
|
}
|
|
58
48
|
else {
|
|
@@ -71,5 +61,5 @@ const getCompanies = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params
|
|
|
71
61
|
error: error instanceof Error ? error.message : "An unknown error occurred",
|
|
72
62
|
};
|
|
73
63
|
}
|
|
74
|
-
}
|
|
64
|
+
};
|
|
75
65
|
export default getCompanies;
|
|
@@ -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 getCompanyDetails =
|
|
2
|
+
const getCompanyDetails = async ({ params, authParams, }) => {
|
|
12
3
|
const { authToken } = authParams;
|
|
13
4
|
const { companyId } = params;
|
|
14
5
|
if (!authToken || !companyId) {
|
|
@@ -34,7 +25,7 @@ const getCompanyDetails = (_a) => __awaiter(void 0, [_a], void 0, function* ({ p
|
|
|
34
25
|
"archived",
|
|
35
26
|
];
|
|
36
27
|
const url = `https://api.hubapi.com/crm/v3/objects/companies/${companyId}?properties=${requestedProperties.join(",")}`;
|
|
37
|
-
const response =
|
|
28
|
+
const response = await axiosClient.get(url, {
|
|
38
29
|
headers: {
|
|
39
30
|
Authorization: `Bearer ${authToken}`,
|
|
40
31
|
"Content-Type": "application/json",
|
|
@@ -69,5 +60,5 @@ const getCompanyDetails = (_a) => __awaiter(void 0, [_a], void 0, function* ({ p
|
|
|
69
60
|
error: error instanceof Error ? error.message : "An unknown error occurred",
|
|
70
61
|
};
|
|
71
62
|
}
|
|
72
|
-
}
|
|
63
|
+
};
|
|
73
64
|
export default getCompanyDetails;
|
|
@@ -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 getContactDetails =
|
|
2
|
+
const getContactDetails = async ({ params, authParams, }) => {
|
|
12
3
|
const { authToken } = authParams;
|
|
13
4
|
const { contactId } = params;
|
|
14
5
|
if (!authToken || !contactId) {
|
|
@@ -33,7 +24,7 @@ const getContactDetails = (_a) => __awaiter(void 0, [_a], void 0, function* ({ p
|
|
|
33
24
|
"lifecyclestage",
|
|
34
25
|
];
|
|
35
26
|
const url = `https://api.hubapi.com/crm/v3/objects/contacts/${contactId}?properties=${requestedProperties.join(",")}`;
|
|
36
|
-
const response =
|
|
27
|
+
const response = await axiosClient.get(url, {
|
|
37
28
|
headers: {
|
|
38
29
|
Authorization: `Bearer ${authToken}`,
|
|
39
30
|
"Content-Type": "application/json",
|
|
@@ -70,5 +61,5 @@ const getContactDetails = (_a) => __awaiter(void 0, [_a], void 0, function* ({ p
|
|
|
70
61
|
error: error instanceof Error ? error.message : "An unknown error occurred",
|
|
71
62
|
};
|
|
72
63
|
}
|
|
73
|
-
}
|
|
64
|
+
};
|
|
74
65
|
export default getContactDetails;
|
|
@@ -1,15 +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 getContacts =
|
|
12
|
-
var _b;
|
|
2
|
+
const getContacts = async ({ params, authParams, }) => {
|
|
13
3
|
const { authToken } = authParams;
|
|
14
4
|
const { query, limit = 100 } = params;
|
|
15
5
|
if (!authToken) {
|
|
@@ -36,7 +26,7 @@ const getContacts = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
|
|
|
36
26
|
if (after) {
|
|
37
27
|
requestBody.after = after;
|
|
38
28
|
}
|
|
39
|
-
const response =
|
|
29
|
+
const response = await axiosClient.post(url, requestBody, {
|
|
40
30
|
headers: {
|
|
41
31
|
Authorization: `Bearer ${authToken}`,
|
|
42
32
|
"Content-Type": "application/json",
|
|
@@ -53,7 +43,7 @@ const getContacts = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
|
|
|
53
43
|
createdate,
|
|
54
44
|
};
|
|
55
45
|
}));
|
|
56
|
-
if (
|
|
46
|
+
if (paging?.next?.after && allContacts.length < maxLimit) {
|
|
57
47
|
after = paging.next.after;
|
|
58
48
|
}
|
|
59
49
|
else {
|
|
@@ -72,5 +62,5 @@ const getContacts = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
|
|
|
72
62
|
error: error instanceof Error ? error.message : "An unknown error occurred",
|
|
73
63
|
};
|
|
74
64
|
}
|
|
75
|
-
}
|
|
65
|
+
};
|
|
76
66
|
export default getContacts;
|
|
@@ -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 getDealDetails =
|
|
2
|
+
const getDealDetails = async ({ params, authParams, }) => {
|
|
12
3
|
const { authToken } = authParams;
|
|
13
4
|
const { dealId } = params;
|
|
14
5
|
if (!authToken || !dealId) {
|
|
@@ -31,7 +22,7 @@ const getDealDetails = (_a) => __awaiter(void 0, [_a], void 0, function* ({ para
|
|
|
31
22
|
"hs_lastmodifieddate",
|
|
32
23
|
];
|
|
33
24
|
const url = `https://api.hubapi.com/crm/v3/objects/deals/${dealId}?properties=${requestedProperties.join(",")}`;
|
|
34
|
-
const response =
|
|
25
|
+
const response = await axiosClient.get(url, {
|
|
35
26
|
headers: {
|
|
36
27
|
Authorization: `Bearer ${authToken}`,
|
|
37
28
|
"Content-Type": "application/json",
|
|
@@ -64,5 +55,5 @@ const getDealDetails = (_a) => __awaiter(void 0, [_a], void 0, function* ({ para
|
|
|
64
55
|
error: error instanceof Error ? error.message : "An unknown error occurred",
|
|
65
56
|
};
|
|
66
57
|
}
|
|
67
|
-
}
|
|
58
|
+
};
|
|
68
59
|
export default getDealDetails;
|
|
@@ -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 getDeals =
|
|
2
|
+
const getDeals = async ({ params, authParams, }) => {
|
|
12
3
|
const { authToken } = authParams;
|
|
13
4
|
const { query, limit = 100 } = params;
|
|
14
5
|
if (!authToken) {
|
|
@@ -27,7 +18,7 @@ const getDeals = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, au
|
|
|
27
18
|
if (query) {
|
|
28
19
|
requestBody.query = query;
|
|
29
20
|
}
|
|
30
|
-
const response =
|
|
21
|
+
const response = await axiosClient.post(url, requestBody, {
|
|
31
22
|
headers: {
|
|
32
23
|
Authorization: `Bearer ${authToken}`,
|
|
33
24
|
"Content-Type": "application/json",
|
|
@@ -56,5 +47,5 @@ const getDeals = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, au
|
|
|
56
47
|
error: error instanceof Error ? error.message : "An unknown error occurred",
|
|
57
48
|
};
|
|
58
49
|
}
|
|
59
|
-
}
|
|
50
|
+
};
|
|
60
51
|
export default getDeals;
|
|
@@ -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 getTicketDetails =
|
|
2
|
+
const getTicketDetails = async ({ params, authParams, }) => {
|
|
12
3
|
const { authToken } = authParams;
|
|
13
4
|
const { ticketId } = params;
|
|
14
5
|
if (!authToken || !ticketId) {
|
|
@@ -29,7 +20,7 @@ const getTicketDetails = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
|
29
20
|
"hs_lastmodifieddate",
|
|
30
21
|
];
|
|
31
22
|
const url = `https://api.hubapi.com/crm/v3/objects/tickets/${ticketId}?properties=${requestedProperties.join(",")}`;
|
|
32
|
-
const response =
|
|
23
|
+
const response = await axiosClient.get(url, {
|
|
33
24
|
headers: {
|
|
34
25
|
Authorization: `Bearer ${authToken}`,
|
|
35
26
|
"Content-Type": "application/json",
|
|
@@ -60,5 +51,5 @@ const getTicketDetails = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
|
60
51
|
error: error instanceof Error ? error.message : "An unknown error occurred",
|
|
61
52
|
};
|
|
62
53
|
}
|
|
63
|
-
}
|
|
54
|
+
};
|
|
64
55
|
export default getTicketDetails;
|
|
@@ -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 getTickets =
|
|
2
|
+
const getTickets = async ({ params, authParams, }) => {
|
|
12
3
|
const { authToken } = authParams;
|
|
13
4
|
const { query, limit = 100 } = params;
|
|
14
5
|
if (!authToken) {
|
|
@@ -27,7 +18,7 @@ const getTickets = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
|
|
|
27
18
|
if (query) {
|
|
28
19
|
requestBody.query = query;
|
|
29
20
|
}
|
|
30
|
-
const response =
|
|
21
|
+
const response = await axiosClient.post(url, requestBody, {
|
|
31
22
|
headers: {
|
|
32
23
|
Authorization: `Bearer ${authToken}`,
|
|
33
24
|
"Content-Type": "application/json",
|
|
@@ -55,5 +46,5 @@ const getTickets = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
|
|
|
55
46
|
error: error instanceof Error ? error.message : "An unknown error occurred",
|
|
56
47
|
};
|
|
57
48
|
}
|
|
58
|
-
}
|
|
49
|
+
};
|
|
59
50
|
export default getTickets;
|
|
@@ -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;
|