@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
|
@@ -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 { RateLimiter } from "limiter";
|
|
11
2
|
import { axiosClient } from "../../util/axiosClient.js";
|
|
12
3
|
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
@@ -38,12 +29,12 @@ function cleanAndTruncateEmail(text, maxLength = 2000) {
|
|
|
38
29
|
text = text.replace(NEWLINE_NORMALIZE_REGEX, "\n").replace(MULTIPLE_NEWLINES_REGEX, "\n\n").trim();
|
|
39
30
|
return text.slice(0, maxLength).trim();
|
|
40
31
|
}
|
|
41
|
-
const searchGmailMessages =
|
|
32
|
+
const searchGmailMessages = async ({ params, authParams, }) => {
|
|
42
33
|
if (!authParams.authToken) {
|
|
43
34
|
return { success: false, error: MISSING_AUTH_TOKEN, results: [] };
|
|
44
35
|
}
|
|
45
36
|
const { query, maxResults, timeout } = params;
|
|
46
|
-
const max = Math.min(maxResults
|
|
37
|
+
const max = Math.min(maxResults ?? DEFAULT_EMAIL_CONTENTS_FETCHED, MAX_EMAIL_CONTENTS_FETCHED);
|
|
47
38
|
const allMessages = [];
|
|
48
39
|
const errorMessages = [];
|
|
49
40
|
let pageToken;
|
|
@@ -55,18 +46,17 @@ const searchGmailMessages = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
55
46
|
max - fetched, // Only fetch what we still need
|
|
56
47
|
MAX_EMAILS_FETCHED_CONCURRENTLY);
|
|
57
48
|
const url = `https://gmail.googleapis.com/gmail/v1/users/me/messages?q=${encodeURIComponent(query)}&maxResults=${batchSize}${pageToken ? `&pageToken=${encodeURIComponent(pageToken)}` : ""}`;
|
|
58
|
-
const listRes =
|
|
49
|
+
const listRes = await axiosClient.get(url, {
|
|
59
50
|
headers: { Authorization: `Bearer ${authParams.authToken}` },
|
|
60
51
|
});
|
|
61
52
|
const { messages: messageList = [], nextPageToken } = listRes.data;
|
|
62
53
|
if (!Array.isArray(messageList) || messageList.length === 0)
|
|
63
54
|
break;
|
|
64
55
|
const batch = messageList.slice(0, max - allMessages.length);
|
|
65
|
-
const results =
|
|
66
|
-
var _a, _b, _c;
|
|
56
|
+
const results = await Promise.allSettled(batch.map(async (msg) => {
|
|
67
57
|
try {
|
|
68
|
-
|
|
69
|
-
const msgRes =
|
|
58
|
+
await limiter.removeTokens(1);
|
|
59
|
+
const msgRes = await axiosClient.get(`https://gmail.googleapis.com/gmail/v1/users/me/messages/${msg.id}?format=full`, {
|
|
70
60
|
headers: { Authorization: `Bearer ${authParams.authToken}` },
|
|
71
61
|
timeout: timeout ? timeout * 1000 : DEFAULT_EMAIL_FETCH_TIMEOUT,
|
|
72
62
|
validateStatus: () => true,
|
|
@@ -78,8 +68,8 @@ const searchGmailMessages = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
78
68
|
}
|
|
79
69
|
// Extract and clean the full text
|
|
80
70
|
const emailBody = cleanAndTruncateEmail(getEmailContent(msgRes.data) || "");
|
|
81
|
-
const subject =
|
|
82
|
-
const from =
|
|
71
|
+
const subject = headers.subject?.trim() || "(No subject)";
|
|
72
|
+
const from = headers.from?.split("<")[0]?.trim() || "Unknown sender";
|
|
83
73
|
const date = new Date(Number(internalDate)).toLocaleDateString("en-US");
|
|
84
74
|
const name = `${subject} — ${from} (${date})`;
|
|
85
75
|
return {
|
|
@@ -119,7 +109,7 @@ const searchGmailMessages = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
119
109
|
},
|
|
120
110
|
};
|
|
121
111
|
}
|
|
122
|
-
}))
|
|
112
|
+
}));
|
|
123
113
|
const successfulResults = results.filter(r => r.status === "fulfilled").map(r => r.value);
|
|
124
114
|
const failedResults = results.filter((r) => r.status === "rejected");
|
|
125
115
|
failedResults.forEach(r => {
|
|
@@ -146,5 +136,5 @@ const searchGmailMessages = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
146
136
|
results: [],
|
|
147
137
|
};
|
|
148
138
|
}
|
|
149
|
-
}
|
|
139
|
+
};
|
|
150
140
|
export default searchGmailMessages;
|
|
@@ -1,16 +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 { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
12
|
-
const sendGmail =
|
|
13
|
-
var _b, _c, _d;
|
|
3
|
+
const sendGmail = async ({ params, authParams, }) => {
|
|
14
4
|
if (!authParams.authToken) {
|
|
15
5
|
return { success: false, error: MISSING_AUTH_TOKEN };
|
|
16
6
|
}
|
|
@@ -23,7 +13,7 @@ const sendGmail = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, a
|
|
|
23
13
|
if (threadId) {
|
|
24
14
|
try {
|
|
25
15
|
// Get the thread to find the last message ID and subject
|
|
26
|
-
const threadResponse =
|
|
16
|
+
const threadResponse = await axiosClient.get(`https://gmail.googleapis.com/gmail/v1/users/me/threads/${threadId}`, {
|
|
27
17
|
headers: {
|
|
28
18
|
Authorization: `Bearer ${authParams.authToken}`,
|
|
29
19
|
},
|
|
@@ -32,12 +22,12 @@ const sendGmail = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, a
|
|
|
32
22
|
if (messages && messages.length > 0) {
|
|
33
23
|
const lastMessage = messages[messages.length - 1];
|
|
34
24
|
// Get the Message-ID header from the last message
|
|
35
|
-
const messageIdHeader =
|
|
25
|
+
const messageIdHeader = lastMessage.payload.headers?.find((h) => h.name.toLowerCase() === "message-id");
|
|
36
26
|
if (messageIdHeader) {
|
|
37
27
|
inReplyTo = messageIdHeader.value;
|
|
38
28
|
}
|
|
39
29
|
// Get existing References header or create new one
|
|
40
|
-
const referencesHeader =
|
|
30
|
+
const referencesHeader = lastMessage.payload.headers?.find((h) => h.name.toLowerCase() === "references");
|
|
41
31
|
if (referencesHeader) {
|
|
42
32
|
references = `${referencesHeader.value} ${inReplyTo}`.trim();
|
|
43
33
|
}
|
|
@@ -45,7 +35,7 @@ const sendGmail = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, a
|
|
|
45
35
|
references = inReplyTo;
|
|
46
36
|
}
|
|
47
37
|
// Get original subject and format as reply
|
|
48
|
-
const subjectHeader =
|
|
38
|
+
const subjectHeader = lastMessage.payload.headers?.find((h) => h.name.toLowerCase() === "subject");
|
|
49
39
|
// When threadId is provided, ALWAYS use the original thread's subject
|
|
50
40
|
// Ignore the subject parameter completely to ensure proper threading
|
|
51
41
|
if (subjectHeader) {
|
|
@@ -103,7 +93,7 @@ const sendGmail = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, a
|
|
|
103
93
|
if (threadId) {
|
|
104
94
|
requestBody.threadId = threadId;
|
|
105
95
|
}
|
|
106
|
-
const response =
|
|
96
|
+
const response = await axiosClient.post("https://gmail.googleapis.com/gmail/v1/users/me/messages/send", requestBody, {
|
|
107
97
|
headers: {
|
|
108
98
|
Authorization: `Bearer ${authParams.authToken}`,
|
|
109
99
|
"Content-Type": "application/json",
|
|
@@ -121,5 +111,5 @@ const sendGmail = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, a
|
|
|
121
111
|
error: error instanceof Error ? error.message : "Unknown error sending email",
|
|
122
112
|
};
|
|
123
113
|
}
|
|
124
|
-
}
|
|
114
|
+
};
|
|
125
115
|
export default sendGmail;
|
|
@@ -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 { googlemapsNearbysearchRestaurantsOutputSchema } from "../../autogen/types.js";
|
|
11
2
|
import { axiosClient } from "../../util/axiosClient.js";
|
|
12
3
|
const INCLUDED_TYPES = ["restaurant"];
|
|
13
|
-
const nearbysearchRestaurants =
|
|
4
|
+
const nearbysearchRestaurants = async ({ params, authParams, }) => {
|
|
14
5
|
const url = `https://places.googleapis.com/v1/places:searchNearby`;
|
|
15
6
|
const fieldMask = [
|
|
16
7
|
"places.displayName",
|
|
@@ -22,7 +13,7 @@ const nearbysearchRestaurants = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
|
22
13
|
"places.regularOpeningHours",
|
|
23
14
|
"places.websiteUri",
|
|
24
15
|
].join(",");
|
|
25
|
-
const response =
|
|
16
|
+
const response = await axiosClient.post(url, {
|
|
26
17
|
maxResultCount: 20,
|
|
27
18
|
includedTypes: INCLUDED_TYPES,
|
|
28
19
|
locationRestriction: {
|
|
@@ -42,19 +33,16 @@ const nearbysearchRestaurants = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
|
42
33
|
},
|
|
43
34
|
});
|
|
44
35
|
return googlemapsNearbysearchRestaurantsOutputSchema.parse({
|
|
45
|
-
results: response.data.places.map((place) => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
websiteUri: place.websiteUri,
|
|
56
|
-
});
|
|
57
|
-
}),
|
|
36
|
+
results: response.data.places.map((place) => ({
|
|
37
|
+
name: place.displayName.text,
|
|
38
|
+
address: place.formattedAddress,
|
|
39
|
+
priceLevel: place.priceLevel,
|
|
40
|
+
rating: place.rating,
|
|
41
|
+
primaryType: place.primaryTypeDisplayName.text,
|
|
42
|
+
editorialSummary: place.editorialSummary?.text || "",
|
|
43
|
+
openingHours: place.regularOpeningHours?.weekdayDescriptions.join("\n") || "",
|
|
44
|
+
websiteUri: place.websiteUri,
|
|
45
|
+
})),
|
|
58
46
|
});
|
|
59
|
-
}
|
|
47
|
+
};
|
|
60
48
|
export default nearbysearchRestaurants;
|
|
@@ -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;
|
|
@@ -0,0 +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
|
+
import { axiosClient } from "../../util/axiosClient.js";
|
|
11
|
+
const getJamfComputerInventory = (_a) => __awaiter(void 0, [_a], void 0, function* ({ authParams, }) {
|
|
12
|
+
const { authToken, subdomain } = authParams;
|
|
13
|
+
if (!subdomain || !authToken) {
|
|
14
|
+
throw new Error("Instance and authToken are required to fetch Jamf computer inventory");
|
|
15
|
+
}
|
|
16
|
+
const url = `https://${subdomain}.jamfcloud.com`;
|
|
17
|
+
try {
|
|
18
|
+
const computers = yield axiosClient.get(`${url}/api/v1/computers-inventory`, {
|
|
19
|
+
headers: {
|
|
20
|
+
Authorization: `Bearer ${authToken}`,
|
|
21
|
+
Accept: "application/json",
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
return {
|
|
25
|
+
success: true,
|
|
26
|
+
data: computers.data,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
console.error("Error retrieving Jamf computer inventory: ", error);
|
|
31
|
+
return {
|
|
32
|
+
success: false,
|
|
33
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
export default getJamfComputerInventory;
|
|
@@ -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 getJamfFileVaultRecoveryKey = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
12
|
+
const { authToken, subdomain } = authParams;
|
|
13
|
+
const { computerId } = params;
|
|
14
|
+
if (!subdomain || !authToken) {
|
|
15
|
+
throw new Error("Instance and authToken are required to fetch FileVault2 recovery key");
|
|
16
|
+
}
|
|
17
|
+
// const apiUrl = `${baseUrl}/api/v1/computers-inventory/${computerId}/filevault`;
|
|
18
|
+
const url = `https://${subdomain}.jamfcloud.com`;
|
|
19
|
+
try {
|
|
20
|
+
const fileVaultResponse = yield axiosClient.get(`${url}/api/v1/computers-inventory/${computerId}/filevault`, {
|
|
21
|
+
headers: {
|
|
22
|
+
Authorization: `Bearer ${authToken}`,
|
|
23
|
+
Accept: "application/json",
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
return {
|
|
27
|
+
success: true,
|
|
28
|
+
data: fileVaultResponse.data,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
console.error("Error retrieving FileVault2 recovery key: ", error);
|
|
33
|
+
return {
|
|
34
|
+
success: false,
|
|
35
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
export default getJamfFileVaultRecoveryKey;
|