@credal/actions 0.2.0 → 0.2.3
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 +374 -380
- package/dist/actions/autogen/templates.js +94 -98
- package/dist/actions/autogen/types.d.ts +2 -33
- package/dist/actions/autogen/types.js +1621 -1659
- package/dist/actions/groups.js +88 -91
- package/dist/actions/invoke.js +5 -8
- package/dist/actions/parse.js +38 -43
- package/dist/actions/providers/asana/commentAsanaTask.js +5 -7
- package/dist/actions/providers/asana/createAsanaTask.js +9 -11
- package/dist/actions/providers/asana/getTasksDetails.js +9 -11
- package/dist/actions/providers/asana/listAsanaTasksByProject.js +46 -51
- package/dist/actions/providers/asana/searchAsanaTasks.js +6 -8
- package/dist/actions/providers/asana/updateAsanaTask.js +8 -10
- package/dist/actions/providers/asana/utils.js +7 -12
- package/dist/actions/providers/ashby/addCandidateToProject.js +5 -7
- package/dist/actions/providers/ashby/createCandidate.js +5 -7
- package/dist/actions/providers/ashby/createNote.js +5 -7
- package/dist/actions/providers/ashby/getCandidateInfo.js +5 -7
- package/dist/actions/providers/ashby/listCandidateNotes.js +5 -7
- package/dist/actions/providers/ashby/listCandidates.js +5 -7
- package/dist/actions/providers/ashby/searchCandidates.js +5 -7
- package/dist/actions/providers/ashby/updateCandidate.js +5 -7
- package/dist/actions/providers/bing/getTopNSearchResultUrls.js +5 -7
- package/dist/actions/providers/confluence/fetchPageContent.js +8 -10
- package/dist/actions/providers/confluence/helpers.js +1 -4
- package/dist/actions/providers/confluence/overwritePage.js +9 -11
- package/dist/actions/providers/finnhub/getBasicFinancials.js +6 -8
- package/dist/actions/providers/finnhub/symbolLookup.js +6 -8
- package/dist/actions/providers/firecrawl/deepResearch.js +5 -10
- package/dist/actions/providers/firecrawl/scrapeTweetDataWithNitter.js +5 -10
- package/dist/actions/providers/firecrawl/scrapeUrl.js +5 -10
- package/dist/actions/providers/generic/fillTemplate.js +1 -3
- package/dist/actions/providers/github/createBranch.js +4 -39
- package/dist/actions/providers/github/createOrUpdateFile.js +6 -41
- package/dist/actions/providers/github/createPullRequest.js +4 -39
- package/dist/actions/providers/github/listPullRequests.js +7 -12
- package/dist/actions/providers/gong/getGongTranscripts.js +49 -84
- package/dist/actions/providers/google-oauth/addGroupMember.js +5 -7
- package/dist/actions/providers/google-oauth/createNewGoogleDoc.js +6 -8
- package/dist/actions/providers/google-oauth/createPresentation.js +5 -7
- package/dist/actions/providers/google-oauth/createSpreadsheet.js +5 -10
- package/dist/actions/providers/google-oauth/deleteCalendarEvent.js +5 -7
- package/dist/actions/providers/google-oauth/deleteGroupMember.js +5 -7
- package/dist/actions/providers/google-oauth/getGroup.js +5 -7
- package/dist/actions/providers/google-oauth/hasGroupMember.js +5 -7
- package/dist/actions/providers/google-oauth/listCalendarEvents.js +5 -7
- package/dist/actions/providers/google-oauth/listCalendars.js +5 -7
- package/dist/actions/providers/google-oauth/listGroupMembers.js +5 -7
- package/dist/actions/providers/google-oauth/listGroups.js +5 -7
- package/dist/actions/providers/google-oauth/scheduleCalendarMeeting.js +7 -9
- package/dist/actions/providers/google-oauth/searchDriveByKeywords.js +5 -7
- package/dist/actions/providers/google-oauth/updateCalendarEvent.js +5 -7
- package/dist/actions/providers/google-oauth/updateDoc.js +5 -10
- package/dist/actions/providers/google-oauth/updatePresentation.js +5 -7
- package/dist/actions/providers/google-oauth/updateSpreadsheet.js +5 -7
- package/dist/actions/providers/google-oauth/utils/decodeMessage.js +2 -6
- package/dist/actions/providers/googlemail/listGmailThreads.js +8 -10
- package/dist/actions/providers/googlemail/searchGmailMessages.js +8 -10
- package/dist/actions/providers/googlemaps/nearbysearchRestaurants.js +5 -7
- package/dist/actions/providers/googlemaps/validateAddress.js +3 -5
- package/dist/actions/providers/jamf/getJamfComputerInventory.js +8 -26
- package/dist/actions/providers/jamf/getJamfFileVaultRecoveryKey.js +7 -26
- package/dist/actions/providers/jira/assignJiraTicket.js +5 -10
- package/dist/actions/providers/jira/commentJiraTicket.js +3 -5
- package/dist/actions/providers/jira/createJiraTicket.js +6 -8
- package/dist/actions/providers/jira/getJiraIssuesByQuery.js +4 -6
- package/dist/actions/providers/jira/getJiraTicketDetails.js +3 -5
- package/dist/actions/providers/jira/getJiraTicketHistory.js +3 -5
- package/dist/actions/providers/jira/updateJiraTicketDetails.js +3 -5
- package/dist/actions/providers/jira/updateJiraTicketStatus.js +4 -6
- package/dist/actions/providers/jira/utils.js +3 -6
- package/dist/actions/providers/kandji/getFVRecoveryKeyForDevice.js +4 -6
- package/dist/actions/providers/linkedin/createSharePostLinkedinUrl.js +1 -3
- package/dist/actions/providers/looker/enableUserByEmail.js +5 -7
- package/dist/actions/providers/math/add.js +1 -3
- package/dist/actions/providers/microsoft/createDocument.js +5 -7
- package/dist/actions/providers/microsoft/getDocument.js +3 -5
- package/dist/actions/providers/microsoft/messageTeamsChannel.js +4 -6
- package/dist/actions/providers/microsoft/messageTeamsChat.js +4 -6
- package/dist/actions/providers/microsoft/updateDocument.js +4 -6
- package/dist/actions/providers/microsoft/updateSpreadsheet.js +4 -6
- package/dist/actions/providers/microsoft/utils.js +6 -10
- package/dist/actions/providers/mongodb/insertMongoDoc.js +3 -5
- package/dist/actions/providers/notion/searchByTitle.js +5 -10
- package/dist/actions/providers/nws/getForecastForLocation.js +7 -9
- package/dist/actions/providers/openstreetmap/getLatitudeLongitudeFromLocation.js +3 -5
- package/dist/actions/providers/resend/sendEmail.js +6 -8
- package/dist/actions/providers/salesforce/createCase.js +3 -5
- package/dist/actions/providers/salesforce/createRecord.js +4 -6
- package/dist/actions/providers/salesforce/fetchSalesforceSchema.js +3 -5
- package/dist/actions/providers/salesforce/generateSalesReport.js +3 -5
- package/dist/actions/providers/salesforce/getRecord.js +3 -5
- package/dist/actions/providers/salesforce/getSalesforceRecordsByQuery.js +4 -6
- package/dist/actions/providers/salesforce/updateRecord.js +3 -5
- package/dist/actions/providers/slack/getChannelMessages.js +7 -9
- package/dist/actions/providers/slack/helpers.js +1 -4
- package/dist/actions/providers/slack/sendMessage.js +10 -12
- package/dist/actions/providers/snowflake/auth/getSnowflakeConnection.js +4 -41
- package/dist/actions/providers/snowflake/getRowByFieldValue.js +3 -5
- package/dist/actions/providers/snowflake/runSnowflakeQuery.js +8 -13
- package/dist/actions/providers/x/createXSharePostUrl.js +1 -3
- package/dist/actions/providers/zendesk/addCommentToTicket.js +5 -7
- package/dist/actions/providers/zendesk/assignTicket.js +5 -7
- package/dist/actions/providers/zendesk/createZendeskTicket.js +5 -7
- package/dist/actions/providers/zendesk/getTicketDetails.js +5 -7
- package/dist/actions/providers/zendesk/listTickets.js +5 -7
- package/dist/actions/providers/zendesk/updateTicketStatus.js +5 -7
- package/dist/actions/util/axiosClient.js +4 -11
- package/dist/actions/util/formatDataForCodeInterpreter.js +1 -4
- package/dist/actions/util/missingAuthConstants.js +2 -5
- package/dist/app.js +5 -42
- package/dist/index.js +4 -24
- package/dist/server.d.ts +2 -0
- package/dist/server.js +8 -0
- package/dist/utils/datetime.js +4 -8
- package/dist/utils/string.js +1 -4
- package/package.json +2 -1
- package/dist/actions/providers/confluence/updatePage.d.ts +0 -3
- package/dist/actions/providers/confluence/updatePage.js +0 -47
- package/dist/actions/providers/credal/callCopilot.d.ts +0 -3
- package/dist/actions/providers/credal/callCopilot.js +0 -36
- package/dist/actions/providers/math/index.d.ts +0 -1
- package/dist/actions/providers/math/index.js +0 -37
- package/dist/actions/providers/slack/index.d.ts +0 -1
- package/dist/actions/providers/slack/index.js +0 -37
- package/dist/actions/providers/slack/listConversations.d.ts +0 -3
- package/dist/actions/providers/slack/listConversations.js +0 -41
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,15 +7,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
|
13
|
-
const missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
10
|
+
import { axiosClient } from "../../util/axiosClient";
|
11
|
+
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
|
14
12
|
const listGroups = (_a) => __awaiter(void 0, [_a], void 0, function* ({ authParams, params, }) {
|
15
13
|
var _b;
|
16
14
|
const { authToken } = authParams;
|
17
15
|
const maxResults = (_b = params === null || params === void 0 ? void 0 : params.maxResults) !== null && _b !== void 0 ? _b : 200;
|
18
16
|
if (!authToken) {
|
19
|
-
return { success: false, groups: [], error:
|
17
|
+
return { success: false, groups: [], error: MISSING_AUTH_TOKEN };
|
20
18
|
}
|
21
19
|
try {
|
22
20
|
let groups = [];
|
@@ -28,7 +26,7 @@ const listGroups = (_a) => __awaiter(void 0, [_a], void 0, function* ({ authPara
|
|
28
26
|
url.searchParams.set("maxResults", String(limit - groups.length));
|
29
27
|
if (pageToken)
|
30
28
|
url.searchParams.set("pageToken", pageToken);
|
31
|
-
const response = yield
|
29
|
+
const response = yield axiosClient.get(url.toString(), {
|
32
30
|
headers: { Authorization: `Bearer ${authToken}` },
|
33
31
|
});
|
34
32
|
const data = response.data;
|
@@ -53,4 +51,4 @@ const listGroups = (_a) => __awaiter(void 0, [_a], void 0, function* ({ authPara
|
|
53
51
|
};
|
54
52
|
}
|
55
53
|
});
|
56
|
-
|
54
|
+
export default listGroups;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,16 +7,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
const missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
10
|
+
import { v4 } from "uuid";
|
11
|
+
import { axiosClient } from "../../util/axiosClient";
|
12
|
+
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
|
15
13
|
/**
|
16
14
|
* Creates a new Google calendar event using OAuth authentication
|
17
15
|
*/
|
18
16
|
const scheduleCalendarMeeting = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
19
17
|
if (!authParams.authToken) {
|
20
|
-
throw new Error(
|
18
|
+
throw new Error(MISSING_AUTH_TOKEN);
|
21
19
|
}
|
22
20
|
const { calendarId, name, start, end, description, attendees, useGoogleMeet } = params;
|
23
21
|
// https://developers.google.com/calendar/api/v3/reference/events/insert
|
@@ -41,12 +39,12 @@ const scheduleCalendarMeeting = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
41
39
|
createEventApiUrl += "?conferenceDataVersion=1";
|
42
40
|
data.conferenceData = {
|
43
41
|
createRequest: {
|
44
|
-
requestId:
|
42
|
+
requestId: v4(),
|
45
43
|
},
|
46
44
|
};
|
47
45
|
}
|
48
46
|
try {
|
49
|
-
const response = yield
|
47
|
+
const response = yield axiosClient.post(createEventApiUrl, data, {
|
50
48
|
headers: {
|
51
49
|
Authorization: `Bearer ${authParams.authToken}`,
|
52
50
|
"Content-Type": "application/json",
|
@@ -72,4 +70,4 @@ const scheduleCalendarMeeting = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
72
70
|
};
|
73
71
|
}
|
74
72
|
});
|
75
|
-
|
73
|
+
export default scheduleCalendarMeeting;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,20 +7,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
|
13
|
-
const missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
10
|
+
import { axiosClient } from "../../util/axiosClient";
|
11
|
+
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
|
14
12
|
const searchDriveByKeywords = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
15
13
|
var _b;
|
16
14
|
if (!authParams.authToken) {
|
17
|
-
return { success: false, error:
|
15
|
+
return { success: false, error: MISSING_AUTH_TOKEN, files: [] };
|
18
16
|
}
|
19
17
|
const { keywords } = params;
|
20
18
|
// Build the query: fullText contains 'keyword1' or fullText contains 'keyword2' ...
|
21
19
|
const query = keywords.map(kw => `fullText contains '${kw.replace(/'/g, "\\'")}'`).join(" or ");
|
22
20
|
const url = `https://www.googleapis.com/drive/v3/files?q=${encodeURIComponent(query)}&fields=files(id,name,mimeType,webViewLink)&supportsAllDrives=true&includeItemsFromAllDrives=true`;
|
23
21
|
try {
|
24
|
-
const res = yield
|
22
|
+
const res = yield axiosClient.get(url, {
|
25
23
|
headers: {
|
26
24
|
Authorization: `Bearer ${authParams.authToken}`,
|
27
25
|
},
|
@@ -43,4 +41,4 @@ const searchDriveByKeywords = (_a) => __awaiter(void 0, [_a], void 0, function*
|
|
43
41
|
};
|
44
42
|
}
|
45
43
|
});
|
46
|
-
|
44
|
+
export default searchDriveByKeywords;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,12 +7,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
|
13
|
-
const missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
10
|
+
import { axiosClient } from "../../util/axiosClient";
|
11
|
+
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
|
14
12
|
const updateCalendarEvent = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
15
13
|
if (!authParams.authToken) {
|
16
|
-
return { success: false, error:
|
14
|
+
return { success: false, error: MISSING_AUTH_TOKEN, eventId: "", eventUrl: "" };
|
17
15
|
}
|
18
16
|
const { calendarId, eventId, updates } = params;
|
19
17
|
const url = `https://www.googleapis.com/calendar/v3/calendars/${encodeURIComponent(calendarId)}/events/${encodeURIComponent(eventId)}`;
|
@@ -37,7 +35,7 @@ const updateCalendarEvent = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
37
35
|
body.organizer = updates.organizer;
|
38
36
|
}
|
39
37
|
try {
|
40
|
-
const res = yield
|
38
|
+
const res = yield axiosClient.patch(url, body, {
|
41
39
|
headers: {
|
42
40
|
Authorization: `Bearer ${authParams.authToken}`,
|
43
41
|
},
|
@@ -56,4 +54,4 @@ const updateCalendarEvent = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
56
54
|
};
|
57
55
|
}
|
58
56
|
});
|
59
|
-
|
57
|
+
export default updateCalendarEvent;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,12 +7,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
|
13
|
-
};
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
-
const axios_1 = __importDefault(require("axios"));
|
16
|
-
const missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
10
|
+
import axios from "axios";
|
11
|
+
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
|
17
12
|
/**
|
18
13
|
* Updates an existing Google Docs document using OAuth authentication with batch requests
|
19
14
|
* https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate
|
@@ -23,7 +18,7 @@ const updateDoc = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, a
|
|
23
18
|
return {
|
24
19
|
success: false,
|
25
20
|
documentId: params.documentId,
|
26
|
-
error:
|
21
|
+
error: MISSING_AUTH_TOKEN,
|
27
22
|
};
|
28
23
|
}
|
29
24
|
const { documentId, requests } = params;
|
@@ -31,7 +26,7 @@ const updateDoc = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, a
|
|
31
26
|
try {
|
32
27
|
// If requests are provided, send them as a batch update
|
33
28
|
if (requests && requests.length > 0) {
|
34
|
-
const response = yield
|
29
|
+
const response = yield axios.post(`${baseApiUrl}/${documentId}:batchUpdate`, {
|
35
30
|
requests,
|
36
31
|
}, {
|
37
32
|
headers: {
|
@@ -67,4 +62,4 @@ const updateDoc = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, a
|
|
67
62
|
};
|
68
63
|
}
|
69
64
|
});
|
70
|
-
|
65
|
+
export default updateDoc;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,9 +7,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
|
13
|
-
const missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
10
|
+
import { axiosClient } from "../../util/axiosClient";
|
11
|
+
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
|
14
12
|
/**
|
15
13
|
* Updates an existing Google Slides presentation using OAuth authentication with batch requests
|
16
14
|
* https://developers.google.com/slides/api/reference/rest/v1/presentations/batchUpdate
|
@@ -19,7 +17,7 @@ const updatePresentation = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
19
17
|
if (!authParams.authToken) {
|
20
18
|
return {
|
21
19
|
success: false,
|
22
|
-
error:
|
20
|
+
error: MISSING_AUTH_TOKEN,
|
23
21
|
};
|
24
22
|
}
|
25
23
|
const { presentationId, requests } = params;
|
@@ -27,7 +25,7 @@ const updatePresentation = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
27
25
|
try {
|
28
26
|
// If requests are provided, send them as a batch update
|
29
27
|
if (requests && requests.length > 0) {
|
30
|
-
const response = yield
|
28
|
+
const response = yield axiosClient.post(`${baseApiUrl}/${presentationId}:batchUpdate`, {
|
31
29
|
requests,
|
32
30
|
}, {
|
33
31
|
headers: {
|
@@ -62,4 +60,4 @@ const updatePresentation = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
62
60
|
};
|
63
61
|
}
|
64
62
|
});
|
65
|
-
|
63
|
+
export default updatePresentation;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,22 +7,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
|
13
|
-
const missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
10
|
+
import { axiosClient } from "../../util/axiosClient";
|
11
|
+
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
|
14
12
|
/**
|
15
13
|
* Update a Google Spreadsheet using OAuth authentication
|
16
14
|
* https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets/batchUpdate
|
17
15
|
*/
|
18
16
|
const updateSpreadsheet = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
19
17
|
if (!authParams.authToken) {
|
20
|
-
throw new Error(
|
18
|
+
throw new Error(MISSING_AUTH_TOKEN);
|
21
19
|
}
|
22
20
|
const { spreadsheetId, requests } = params;
|
23
21
|
const batchUpdateUrl = `https://sheets.googleapis.com/v4/spreadsheets/${spreadsheetId}:batchUpdate`;
|
24
22
|
try {
|
25
23
|
// Update the spreadsheet with the given requests
|
26
|
-
const response = yield
|
24
|
+
const response = yield axiosClient.post(batchUpdateUrl, { requests, includeSpreadsheetInResponse: true }, {
|
27
25
|
headers: {
|
28
26
|
Authorization: `Bearer ${authParams.authToken}`,
|
29
27
|
"Content-Type": "application/json",
|
@@ -49,4 +47,4 @@ const updateSpreadsheet = (_a) => __awaiter(void 0, [_a], void 0, function* ({ p
|
|
49
47
|
};
|
50
48
|
}
|
51
49
|
});
|
52
|
-
|
50
|
+
export default updateSpreadsheet;
|
@@ -1,8 +1,4 @@
|
|
1
|
-
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.decodeGmailBase64 = decodeGmailBase64;
|
4
|
-
exports.getEmailContent = getEmailContent;
|
5
|
-
function decodeGmailBase64(base64String) {
|
1
|
+
export function decodeGmailBase64(base64String) {
|
6
2
|
// Gmail API uses URL-safe base64 encoding
|
7
3
|
const standardBase64 = base64String.replace(/-/g, "+").replace(/_/g, "/");
|
8
4
|
// Add padding if needed
|
@@ -10,7 +6,7 @@ function decodeGmailBase64(base64String) {
|
|
10
6
|
// Only works for Node.js environment
|
11
7
|
return Buffer.from(padded, "base64").toString("utf-8");
|
12
8
|
}
|
13
|
-
function getEmailContent(message) {
|
9
|
+
export function getEmailContent(message) {
|
14
10
|
var _a;
|
15
11
|
let textContent = null;
|
16
12
|
// Function to recursively search for plain text content in parts
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,13 +7,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
const decodeMessage_1 = require("../google-oauth/utils/decodeMessage");
|
10
|
+
import { axiosClient } from "../../util/axiosClient";
|
11
|
+
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
|
12
|
+
import { getEmailContent } from "../google-oauth/utils/decodeMessage";
|
15
13
|
const listGmailThreads = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
16
14
|
if (!authParams.authToken) {
|
17
|
-
return { success: false, error:
|
15
|
+
return { success: false, error: MISSING_AUTH_TOKEN, threads: [] };
|
18
16
|
}
|
19
17
|
const { query, maxResults } = params;
|
20
18
|
const allThreads = [];
|
@@ -27,7 +25,7 @@ const listGmailThreads = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
27
25
|
const url = `https://gmail.googleapis.com/gmail/v1/users/me/threads?q=${encodeURIComponent(query)}` +
|
28
26
|
(pageToken ? `&pageToken=${encodeURIComponent(pageToken)}` : "") +
|
29
27
|
`&maxResults=${Math.min(100, max - fetched)}`;
|
30
|
-
const listRes = yield
|
28
|
+
const listRes = yield axiosClient.get(url, {
|
31
29
|
headers: {
|
32
30
|
Authorization: `Bearer ${authParams.authToken}`,
|
33
31
|
},
|
@@ -39,7 +37,7 @@ const listGmailThreads = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
39
37
|
const batch = threadList.slice(0, remaining);
|
40
38
|
const results = yield Promise.all(batch.map((thread) => __awaiter(void 0, void 0, void 0, function* () {
|
41
39
|
try {
|
42
|
-
const threadRes = yield
|
40
|
+
const threadRes = yield axiosClient.get(`https://gmail.googleapis.com/gmail/v1/users/me/threads/${thread.id}?format=full`, {
|
43
41
|
headers: {
|
44
42
|
Authorization: `Bearer ${authParams.authToken}`,
|
45
43
|
},
|
@@ -51,7 +49,7 @@ const listGmailThreads = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
51
49
|
messages: Array.isArray(messages)
|
52
50
|
? messages.map(msg => {
|
53
51
|
const { id, threadId, snippet, labelIds, internalDate } = msg;
|
54
|
-
const emailBody =
|
52
|
+
const emailBody = getEmailContent(msg) || "";
|
55
53
|
return {
|
56
54
|
id,
|
57
55
|
threadId,
|
@@ -95,4 +93,4 @@ const listGmailThreads = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
95
93
|
};
|
96
94
|
}
|
97
95
|
});
|
98
|
-
|
96
|
+
export default listGmailThreads;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,13 +7,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
const decodeMessage_1 = require("../google-oauth/utils/decodeMessage");
|
10
|
+
import { axiosClient } from "../../util/axiosClient";
|
11
|
+
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
|
12
|
+
import { getEmailContent } from "../google-oauth/utils/decodeMessage";
|
15
13
|
const searchGmailMessages = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
16
14
|
if (!authParams.authToken) {
|
17
|
-
return { success: false, error:
|
15
|
+
return { success: false, error: MISSING_AUTH_TOKEN, messages: [] };
|
18
16
|
}
|
19
17
|
const { query, maxResults } = params;
|
20
18
|
const allMessages = [];
|
@@ -27,7 +25,7 @@ const searchGmailMessages = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
27
25
|
const url = `https://gmail.googleapis.com/gmail/v1/users/me/messages?q=${encodeURIComponent(query)}` +
|
28
26
|
(pageToken ? `&pageToken=${encodeURIComponent(pageToken)}` : "") +
|
29
27
|
`&maxResults=${Math.min(100, max - fetched)}`;
|
30
|
-
const listRes = yield
|
28
|
+
const listRes = yield axiosClient.get(url, {
|
31
29
|
headers: {
|
32
30
|
Authorization: `Bearer ${authParams.authToken}`,
|
33
31
|
},
|
@@ -39,13 +37,13 @@ const searchGmailMessages = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
39
37
|
const batch = messageList.slice(0, remaining);
|
40
38
|
const results = yield Promise.all(batch.map((msg) => __awaiter(void 0, void 0, void 0, function* () {
|
41
39
|
try {
|
42
|
-
const msgRes = yield
|
40
|
+
const msgRes = yield axiosClient.get(`https://gmail.googleapis.com/gmail/v1/users/me/messages/${msg.id}?format=full`, {
|
43
41
|
headers: {
|
44
42
|
Authorization: `Bearer ${authParams.authToken}`,
|
45
43
|
},
|
46
44
|
});
|
47
45
|
const { id, threadId, snippet, labelIds, internalDate } = msgRes.data;
|
48
|
-
const emailBody =
|
46
|
+
const emailBody = getEmailContent(msgRes.data) || "";
|
49
47
|
return {
|
50
48
|
id,
|
51
49
|
threadId,
|
@@ -88,4 +86,4 @@ const searchGmailMessages = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
88
86
|
};
|
89
87
|
}
|
90
88
|
});
|
91
|
-
|
89
|
+
export default searchGmailMessages;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,9 +7,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
|
13
|
-
const axiosClient_1 = require("../../util/axiosClient");
|
10
|
+
import { googlemapsNearbysearchRestaurantsOutputSchema } from "../../autogen/types";
|
11
|
+
import { axiosClient } from "../../util/axiosClient";
|
14
12
|
const INCLUDED_TYPES = ["restaurant"];
|
15
13
|
const nearbysearchRestaurants = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
16
14
|
const url = `https://places.googleapis.com/v1/places:searchNearby`;
|
@@ -24,7 +22,7 @@ const nearbysearchRestaurants = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
24
22
|
"places.regularOpeningHours",
|
25
23
|
"places.websiteUri",
|
26
24
|
].join(",");
|
27
|
-
const response = yield
|
25
|
+
const response = yield axiosClient.post(url, {
|
28
26
|
maxResultCount: 20,
|
29
27
|
includedTypes: INCLUDED_TYPES,
|
30
28
|
locationRestriction: {
|
@@ -43,7 +41,7 @@ const nearbysearchRestaurants = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
43
41
|
"Content-Type": "application/json",
|
44
42
|
},
|
45
43
|
});
|
46
|
-
return
|
44
|
+
return googlemapsNearbysearchRestaurantsOutputSchema.parse({
|
47
45
|
results: response.data.places.map((place) => {
|
48
46
|
var _a, _b;
|
49
47
|
return ({
|
@@ -59,4 +57,4 @@ const nearbysearchRestaurants = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
59
57
|
}),
|
60
58
|
});
|
61
59
|
});
|
62
|
-
|
60
|
+
export default nearbysearchRestaurants;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,8 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
const axiosClient_1 = require("../../util/axiosClient");
|
10
|
+
import { axiosClient } from "../../util/axiosClient";
|
13
11
|
const validateAddress = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
12
|
const url = `https://addressvalidation.googleapis.com/v1:validateAddress?key=${authParams.apiKey}`;
|
15
13
|
const requestBody = {
|
@@ -17,11 +15,11 @@ const validateAddress = (_a) => __awaiter(void 0, [_a], void 0, function* ({ par
|
|
17
15
|
addressLines: [...params.addressLines, params.locality, params.regionCode, params.postalCode],
|
18
16
|
},
|
19
17
|
};
|
20
|
-
const response = yield
|
18
|
+
const response = yield axiosClient.post(url, requestBody, {
|
21
19
|
headers: {
|
22
20
|
"Content-Type": "application/json",
|
23
21
|
},
|
24
22
|
});
|
25
23
|
return response.data;
|
26
24
|
});
|
27
|
-
|
25
|
+
export default validateAddress;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,48 +7,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
const axiosClient_1 = require("../../util/axiosClient");
|
13
|
-
const types_1 = require("./types");
|
10
|
+
import { axiosClient } from "../../util/axiosClient";
|
14
11
|
const getJamfComputerInventory = (_a) => __awaiter(void 0, [_a], void 0, function* ({ authParams, }) {
|
15
|
-
const {
|
16
|
-
if (!subdomain || !
|
17
|
-
throw new Error("
|
12
|
+
const { authToken, subdomain } = authParams;
|
13
|
+
if (!subdomain || !authToken) {
|
14
|
+
throw new Error("Instance and authToken are required to fetch Jamf computer inventory");
|
18
15
|
}
|
19
16
|
const url = `https://${subdomain}.jamfcloud.com`;
|
20
|
-
const auth = "Basic " + Buffer.from(`${username}:${password}`).toString("base64");
|
21
17
|
try {
|
22
|
-
const
|
18
|
+
const computers = yield axiosClient.get(`${url}/api/v1/computers-inventory`, {
|
23
19
|
headers: {
|
24
|
-
Authorization:
|
20
|
+
Authorization: `Bearer ${authToken}`,
|
25
21
|
Accept: "application/json",
|
26
22
|
},
|
27
23
|
});
|
28
|
-
const token = types_1.TokenResponseSchema.parse(response.data).token;
|
29
|
-
const computers = yield axiosClient_1.axiosClient.get(`${url}/api/v1/computers-inventory`, {
|
30
|
-
headers: {
|
31
|
-
Authorization: `Bearer ${token}`,
|
32
|
-
Accept: "application/json",
|
33
|
-
},
|
34
|
-
});
|
35
|
-
yield axiosClient_1.axiosClient.post(`${url}/api/v1/auth/invalidate-token`, {}, {
|
36
|
-
headers: {
|
37
|
-
Authorization: `Bearer ${token}`,
|
38
|
-
},
|
39
|
-
// Accept all status codes so we can handle them manually
|
40
|
-
validateStatus: () => true,
|
41
|
-
});
|
42
24
|
return {
|
43
25
|
success: true,
|
44
26
|
data: computers.data,
|
45
27
|
};
|
46
28
|
}
|
47
29
|
catch (error) {
|
48
|
-
console.error("Error retrieving
|
30
|
+
console.error("Error retrieving Jamf computer inventory: ", error);
|
49
31
|
return {
|
50
32
|
success: false,
|
51
33
|
error: error instanceof Error ? error.message : "Unknown error",
|
52
34
|
};
|
53
35
|
}
|
54
36
|
});
|
55
|
-
|
37
|
+
export default getJamfComputerInventory;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,40 +7,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
const axiosClient_1 = require("../../util/axiosClient");
|
13
|
-
const types_1 = require("./types");
|
10
|
+
import { axiosClient } from "../../util/axiosClient";
|
14
11
|
const getJamfFileVaultRecoveryKey = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
15
|
-
const {
|
12
|
+
const { authToken, subdomain } = authParams;
|
16
13
|
const { computerId } = params;
|
17
|
-
if (!subdomain || !
|
18
|
-
throw new Error("
|
14
|
+
if (!subdomain || !authToken) {
|
15
|
+
throw new Error("Instance and authToken are required to fetch FileVault2 recovery key");
|
19
16
|
}
|
20
17
|
// const apiUrl = `${baseUrl}/api/v1/computers-inventory/${computerId}/filevault`;
|
21
18
|
const url = `https://${subdomain}.jamfcloud.com`;
|
22
|
-
const auth = "Basic " + Buffer.from(`${username}:${password}`).toString("base64");
|
23
|
-
console.log("Fetching FileVault2 recovery key for computer ID:", computerId, auth, url);
|
24
19
|
try {
|
25
|
-
const
|
20
|
+
const fileVaultResponse = yield axiosClient.get(`${url}/api/v1/computers-inventory/${computerId}/filevault`, {
|
26
21
|
headers: {
|
27
|
-
Authorization:
|
22
|
+
Authorization: `Bearer ${authToken}`,
|
28
23
|
Accept: "application/json",
|
29
24
|
},
|
30
25
|
});
|
31
|
-
const token = types_1.TokenResponseSchema.parse(response.data).token;
|
32
|
-
const fileVaultResponse = yield axiosClient_1.axiosClient.get(`${url}/api/v1/computers-inventory/${computerId}/filevault`, {
|
33
|
-
headers: {
|
34
|
-
Authorization: `Bearer ${token}`,
|
35
|
-
Accept: "application/json",
|
36
|
-
},
|
37
|
-
});
|
38
|
-
yield axiosClient_1.axiosClient.post(`${url}/api/v1/auth/invalidate-token`, {}, {
|
39
|
-
headers: {
|
40
|
-
Authorization: `Bearer ${token}`,
|
41
|
-
},
|
42
|
-
// Accept all status codes so we can handle them manually
|
43
|
-
validateStatus: () => true,
|
44
|
-
});
|
45
26
|
return {
|
46
27
|
success: true,
|
47
28
|
data: fileVaultResponse.data,
|
@@ -55,4 +36,4 @@ const getJamfFileVaultRecoveryKey = (_a) => __awaiter(void 0, [_a], void 0, func
|
|
55
36
|
};
|
56
37
|
}
|
57
38
|
});
|
58
|
-
|
39
|
+
export default getJamfFileVaultRecoveryKey;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,12 +7,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
|
13
|
-
};
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
-
const axios_1 = __importDefault(require("axios"));
|
16
|
-
const utils_1 = require("./utils");
|
10
|
+
import axios from "axios";
|
11
|
+
import { getUserAccountIdFromEmail } from "./utils";
|
17
12
|
const assignJiraTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
18
13
|
const { authToken, cloudId, baseUrl } = authParams;
|
19
14
|
const apiUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/`;
|
@@ -23,12 +18,12 @@ const assignJiraTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
23
18
|
try {
|
24
19
|
let assigneeId = params.assignee;
|
25
20
|
if (assigneeId && assigneeId.includes("@")) {
|
26
|
-
assigneeId = yield
|
21
|
+
assigneeId = yield getUserAccountIdFromEmail(assigneeId, apiUrl, authToken);
|
27
22
|
}
|
28
23
|
if (!assigneeId) {
|
29
24
|
throw new Error("Unable to get valid assignee account ID.");
|
30
25
|
}
|
31
|
-
yield
|
26
|
+
yield axios.put(`${apiUrl}issue/${params.issueId}/assignee`, { accountId: assigneeId }, {
|
32
27
|
headers: {
|
33
28
|
Authorization: `Bearer ${authToken}`,
|
34
29
|
Accept: "application/json",
|
@@ -49,4 +44,4 @@ const assignJiraTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
49
44
|
};
|
50
45
|
}
|
51
46
|
});
|
52
|
-
|
47
|
+
export default assignJiraTicket;
|