@credal/actions 0.2.91 → 0.2.92
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/groups.js +14 -1
- package/dist/actions/providers/confluence/updatePage.d.ts +3 -0
- package/dist/actions/providers/confluence/updatePage.js +47 -0
- package/dist/actions/providers/google-oauth/searchDriveByKeywords.js +16 -5
- package/dist/actions/providers/google-oauth/searchDriveByQuery.js +50 -18
- package/dist/actions/providers/salesforce/searchSalesforceRecords.js +1 -1
- package/dist/actions/providers/slack/archiveChannel.js +5 -9
- package/package.json +1 -1
- package/dist/actions/providers/google-oauth/listGmailThreads.d.ts +0 -3
- package/dist/actions/providers/google-oauth/listGmailThreads.js +0 -98
- package/dist/actions/providers/google-oauth/searchGmailMessages.d.ts +0 -3
- package/dist/actions/providers/google-oauth/searchGmailMessages.js +0 -91
- package/dist/actions/providers/jamf/getComputerInventory.d.ts +0 -3
- package/dist/actions/providers/jamf/getComputerInventory.js +0 -45
- package/dist/actions/providers/jamf/getFileVaultRecoveryKey.d.ts +0 -3
- package/dist/actions/providers/jamf/getFileVaultRecoveryKey.js +0 -40
- package/dist/actions/providers/jamf/restartJamfComputerById.d.ts +0 -3
- package/dist/actions/providers/jamf/restartJamfComputerById.js +0 -37
package/dist/actions/groups.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { genericFillTemplateDefinition, confluenceOverwritePageDefinition, googlemapsValidateAddressDefinition, mathAddDefinition, mongoInsertMongoDocDefinition, slackSendMessageDefinition, slackGetChannelMessagesDefinition, slackCreateChannelDefinition, slackArchiveChannelDefinition, snowflakeGetRowByFieldValueDefinition, zendeskCreateZendeskTicketDefinition, zendeskListZendeskTicketsDefinition, zendeskGetTicketDetailsDefinition, zendeskUpdateTicketStatusDefinition, zendeskAddCommentToTicketDefinition, zendeskAssignTicketDefinition, openstreetmapGetLatitudeLongitudeFromLocationDefinition, nwsGetForecastForLocationDefinition, jiraAssignJiraTicketDefinition, jiraCommentJiraTicketDefinition, jiraCreateJiraTicketDefinition, jiraGetJiraTicketDetailsDefinition, jiraGetJiraTicketHistoryDefinition, jiraUpdateJiraTicketDetailsDefinition, jiraUpdateJiraTicketStatusDefinition, jiraGetServiceDesksDefinition, jiraCreateServiceDeskRequestDefinition, googlemapsNearbysearchRestaurantsDefinition, firecrawlScrapeUrlDefinition, resendSendEmailDefinition, linkedinCreateShareLinkedinPostUrlDefinition, googleOauthCreateNewGoogleDocDefinition, xCreateShareXPostUrlDefinition, firecrawlScrapeTweetDataWithNitterDefinition, finnhubSymbolLookupDefinition, finnhubGetBasicFinancialsDefinition, confluenceFetchPageContentDefinition, snowflakeRunSnowflakeQueryDefinition, lookerEnableUserByEmailDefinition, googleOauthUpdateDocDefinition, googleOauthScheduleCalendarMeetingDefinition, googleOauthListCalendarsDefinition, googleOauthListCalendarEventsDefinition, googleOauthUpdateCalendarEventDefinition, googleOauthDeleteCalendarEventDefinition, googleOauthCreateSpreadsheetDefinition, googleOauthUpdateSpreadsheetDefinition, googleOauthCreatePresentationDefinition, googleOauthUpdatePresentationDefinition, googleOauthSearchDriveByKeywordsDefinition, googlemailSearchGmailMessagesDefinition, googlemailListGmailThreadsDefinition, googleOauthListGroupsDefinition, googleOauthGetGroupDefinition, googleOauthListGroupMembersDefinition, googleOauthHasGroupMemberDefinition, googleOauthAddGroupMemberDefinition, googleOauthDeleteGroupMemberDefinition, salesforceUpdateRecordDefinition, salesforceCreateCaseDefinition, salesforceGenerateSalesReportDefinition, salesforceGetRecordDefinition, salesforceGetSalesforceRecordsByQueryDefinition, microsoftMessageTeamsChatDefinition, microsoftMessageTeamsChannelDefinition, asanaCommentTaskDefinition, asanaCreateTaskDefinition, asanaUpdateTaskDefinition, asanaSearchTasksDefinition, githubCreateOrUpdateFileDefinition, githubCreateBranchDefinition, githubCreatePullRequestDefinition, microsoftUpdateSpreadsheetDefinition, microsoftUpdateDocumentDefinition, microsoftCreateDocumentDefinition, microsoftGetDocumentDefinition, salesforceFetchSalesforceSchemaByObjectDefinition, firecrawlDeepResearchDefinition, jiraGetJiraIssuesByQueryDefinition, githubListPullRequestsDefinition, salesforceCreateRecordDefinition, ashbyCreateNoteDefinition, ashbyGetCandidateInfoDefinition, ashbyListCandidatesDefinition, ashbyListCandidateNotesDefinition, ashbySearchCandidatesDefinition, ashbyCreateCandidateDefinition, ashbyUpdateCandidateDefinition, ashbyAddCandidateToProjectDefinition, bingGetTopNSearchResultUrlsDefinition, gongGetGongTranscriptsDefinition, kandjiGetFVRecoveryKeyForDeviceDefinition, asanaListAsanaTasksByProjectDefinition, notionSearchByTitleDefinition, asanaGetTasksDetailsDefinition, jamfGetJamfComputerInventoryDefinition, jamfGetJamfFileVaultRecoveryKeyDefinition, oktaListOktaUsersDefinition, oktaGetOktaUserDefinition, oktaListOktaUserGroupsDefinition, oktaListOktaGroupsDefinition, oktaGetOktaGroupDefinition, oktaListOktaGroupMembersDefinition, oktaRemoveUserFromGroupDefinition, oktaAddUserToGroupDefinition, oktaResetPasswordDefinition, oktaResetMFADefinition, oktaListMFADefinition, jamfGetJamfUserComputerIdDefinition, jamfLockJamfComputerByIdDefinition, oktaTriggerOktaWorkflowDefinition, jiraOrgAssignJiraTicketDefinition, jiraOrgCreateJiraTicketDefinition, jiraOrgCommentJiraTicketDefinition, jiraOrgGetJiraTicketDetailsDefinition, jiraOrgGetJiraTicketHistoryDefinition, jiraOrgUpdateJiraTicketDetailsDefinition, jiraOrgUpdateJiraTicketStatusDefinition, jiraOrgGetJiraIssuesByQueryDefinition, googleOauthGetDriveFileContentByIdDefinition, googleOauthSearchDriveByQueryDefinition, } from "./autogen/templates.js";
|
|
1
|
+
import { genericFillTemplateDefinition, confluenceOverwritePageDefinition, googlemapsValidateAddressDefinition, mathAddDefinition, mongoInsertMongoDocDefinition, slackSendMessageDefinition, slackGetChannelMessagesDefinition, slackCreateChannelDefinition, slackArchiveChannelDefinition, snowflakeGetRowByFieldValueDefinition, zendeskCreateZendeskTicketDefinition, zendeskListZendeskTicketsDefinition, zendeskGetTicketDetailsDefinition, zendeskUpdateTicketStatusDefinition, zendeskAddCommentToTicketDefinition, zendeskAssignTicketDefinition, openstreetmapGetLatitudeLongitudeFromLocationDefinition, nwsGetForecastForLocationDefinition, jiraAssignJiraTicketDefinition, jiraCommentJiraTicketDefinition, jiraCreateJiraTicketDefinition, jiraGetJiraTicketDetailsDefinition, jiraGetJiraTicketHistoryDefinition, jiraUpdateJiraTicketDetailsDefinition, jiraUpdateJiraTicketStatusDefinition, jiraGetServiceDesksDefinition, jiraCreateServiceDeskRequestDefinition, googlemapsNearbysearchRestaurantsDefinition, firecrawlScrapeUrlDefinition, resendSendEmailDefinition, linkedinCreateShareLinkedinPostUrlDefinition, googleOauthCreateNewGoogleDocDefinition, xCreateShareXPostUrlDefinition, firecrawlScrapeTweetDataWithNitterDefinition, finnhubSymbolLookupDefinition, finnhubGetBasicFinancialsDefinition, confluenceFetchPageContentDefinition, snowflakeRunSnowflakeQueryDefinition, lookerEnableUserByEmailDefinition, googleOauthUpdateDocDefinition, googleOauthScheduleCalendarMeetingDefinition, googleOauthListCalendarsDefinition, googleOauthListCalendarEventsDefinition, googleOauthUpdateCalendarEventDefinition, googleOauthDeleteCalendarEventDefinition, googleOauthCreateSpreadsheetDefinition, googleOauthUpdateSpreadsheetDefinition, googleOauthCreatePresentationDefinition, googleOauthUpdatePresentationDefinition, googleOauthSearchDriveByKeywordsDefinition, googlemailSearchGmailMessagesDefinition, googlemailListGmailThreadsDefinition, googleOauthListGroupsDefinition, googleOauthGetGroupDefinition, googleOauthListGroupMembersDefinition, googleOauthHasGroupMemberDefinition, googleOauthAddGroupMemberDefinition, googleOauthDeleteGroupMemberDefinition, salesforceUpdateRecordDefinition, salesforceCreateCaseDefinition, salesforceGenerateSalesReportDefinition, salesforceGetRecordDefinition, salesforceGetSalesforceRecordsByQueryDefinition, microsoftMessageTeamsChatDefinition, microsoftMessageTeamsChannelDefinition, asanaCommentTaskDefinition, asanaCreateTaskDefinition, asanaUpdateTaskDefinition, asanaSearchTasksDefinition, githubCreateOrUpdateFileDefinition, githubCreateBranchDefinition, githubCreatePullRequestDefinition, microsoftUpdateSpreadsheetDefinition, microsoftUpdateDocumentDefinition, microsoftCreateDocumentDefinition, microsoftGetDocumentDefinition, salesforceFetchSalesforceSchemaByObjectDefinition, firecrawlDeepResearchDefinition, jiraGetJiraIssuesByQueryDefinition, githubListPullRequestsDefinition, salesforceCreateRecordDefinition, ashbyCreateNoteDefinition, ashbyGetCandidateInfoDefinition, ashbyListCandidatesDefinition, ashbyListCandidateNotesDefinition, ashbySearchCandidatesDefinition, ashbyCreateCandidateDefinition, ashbyUpdateCandidateDefinition, ashbyAddCandidateToProjectDefinition, bingGetTopNSearchResultUrlsDefinition, gongGetGongTranscriptsDefinition, kandjiGetFVRecoveryKeyForDeviceDefinition, asanaListAsanaTasksByProjectDefinition, notionSearchByTitleDefinition, asanaGetTasksDetailsDefinition, linearGetIssueDetailsDefinition, linearGetProjectsDefinition, linearGetProjectDetailsDefinition, linearGetTeamDetailsDefinition, linearGetTeamsDefinition, jamfGetJamfComputerInventoryDefinition, jamfGetJamfFileVaultRecoveryKeyDefinition, oktaListOktaUsersDefinition, oktaGetOktaUserDefinition, oktaListOktaUserGroupsDefinition, oktaListOktaGroupsDefinition, oktaGetOktaGroupDefinition, oktaListOktaGroupMembersDefinition, oktaRemoveUserFromGroupDefinition, oktaAddUserToGroupDefinition, oktaResetPasswordDefinition, oktaResetMFADefinition, oktaListMFADefinition, jamfGetJamfUserComputerIdDefinition, jamfLockJamfComputerByIdDefinition, oktaTriggerOktaWorkflowDefinition, jiraOrgAssignJiraTicketDefinition, jiraOrgCreateJiraTicketDefinition, jiraOrgCommentJiraTicketDefinition, jiraOrgGetJiraTicketDetailsDefinition, jiraOrgGetJiraTicketHistoryDefinition, jiraOrgUpdateJiraTicketDetailsDefinition, jiraOrgUpdateJiraTicketStatusDefinition, jiraOrgGetJiraIssuesByQueryDefinition, googleOauthGetDriveFileContentByIdDefinition, googleOauthSearchDriveByQueryDefinition, googleOauthSearchDriveByQueryAndGetFileContentDefinition, githubGetFileContentDefinition, githubListDirectoryDefinition, } from "./autogen/templates.js";
|
|
2
2
|
export const ACTION_GROUPS = {
|
|
3
3
|
GENERIC: {
|
|
4
4
|
description: "Generic utility actions",
|
|
@@ -47,6 +47,7 @@ export const ACTION_GROUPS = {
|
|
|
47
47
|
googleOauthUpdatePresentationDefinition,
|
|
48
48
|
googleOauthSearchDriveByKeywordsDefinition,
|
|
49
49
|
googleOauthSearchDriveByQueryDefinition,
|
|
50
|
+
googleOauthSearchDriveByQueryAndGetFileContentDefinition,
|
|
50
51
|
googleOauthGetDriveFileContentByIdDefinition,
|
|
51
52
|
],
|
|
52
53
|
},
|
|
@@ -198,6 +199,8 @@ export const ACTION_GROUPS = {
|
|
|
198
199
|
githubCreateBranchDefinition,
|
|
199
200
|
githubCreatePullRequestDefinition,
|
|
200
201
|
githubListPullRequestsDefinition,
|
|
202
|
+
githubGetFileContentDefinition,
|
|
203
|
+
githubListDirectoryDefinition,
|
|
201
204
|
],
|
|
202
205
|
},
|
|
203
206
|
ASHBY: {
|
|
@@ -245,4 +248,14 @@ export const ACTION_GROUPS = {
|
|
|
245
248
|
oktaTriggerOktaWorkflowDefinition,
|
|
246
249
|
],
|
|
247
250
|
},
|
|
251
|
+
LINEAR: {
|
|
252
|
+
description: "Actions for interacting with Linear",
|
|
253
|
+
actions: [
|
|
254
|
+
linearGetIssueDetailsDefinition,
|
|
255
|
+
linearGetProjectsDefinition,
|
|
256
|
+
linearGetProjectDetailsDefinition,
|
|
257
|
+
linearGetTeamDetailsDefinition,
|
|
258
|
+
linearGetTeamsDefinition,
|
|
259
|
+
],
|
|
260
|
+
},
|
|
248
261
|
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const axios_1 = __importDefault(require("axios"));
|
|
16
|
+
function getConfluenceApi(baseUrl, username, apiToken) {
|
|
17
|
+
const api = axios_1.default.create({
|
|
18
|
+
baseURL: baseUrl,
|
|
19
|
+
headers: {
|
|
20
|
+
Accept: "application/json",
|
|
21
|
+
// Tokens are associated with a specific user.
|
|
22
|
+
Authorization: `Basic ${Buffer.from(`${username}:${apiToken}`).toString("base64")}`,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
return api;
|
|
26
|
+
}
|
|
27
|
+
const confluenceUpdatePage = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
28
|
+
const { pageId, username, content, title } = params;
|
|
29
|
+
const { baseUrl, authToken } = authParams;
|
|
30
|
+
const api = getConfluenceApi(baseUrl, username, authToken);
|
|
31
|
+
// Get current version number
|
|
32
|
+
const response = yield api.get(`/api/v2/pages/${pageId}`);
|
|
33
|
+
const currVersion = response.data.version.number;
|
|
34
|
+
yield api.put(`/api/v2/pages/${pageId}`, {
|
|
35
|
+
id: pageId,
|
|
36
|
+
status: "current",
|
|
37
|
+
title,
|
|
38
|
+
body: {
|
|
39
|
+
representation: "storage",
|
|
40
|
+
value: content,
|
|
41
|
+
},
|
|
42
|
+
version: {
|
|
43
|
+
number: currVersion + 1,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
exports.default = confluenceUpdatePage;
|
|
@@ -10,26 +10,37 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { axiosClient } from "../../util/axiosClient.js";
|
|
11
11
|
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
12
12
|
const searchDriveByKeywords = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
13
|
-
var _b;
|
|
14
13
|
if (!authParams.authToken) {
|
|
15
14
|
return { success: false, error: MISSING_AUTH_TOKEN, files: [] };
|
|
16
15
|
}
|
|
17
16
|
const { keywords, limit } = params;
|
|
18
17
|
// Build the query: fullText contains 'keyword1' or fullText contains 'keyword2' ...
|
|
19
18
|
const query = keywords.map(kw => `fullText contains '${kw.replace(/'/g, "\\'")}'`).join(" or ");
|
|
20
|
-
const url = `https://www.googleapis.com/drive/v3/files?q=${encodeURIComponent(query)}&fields=files(id,name,mimeType,webViewLink)&supportsAllDrives=true&includeItemsFromAllDrives=true&corpora=allDrives`;
|
|
21
19
|
try {
|
|
22
|
-
const
|
|
20
|
+
const allDrivesUrl = `https://www.googleapis.com/drive/v3/files?q=${encodeURIComponent(query)}&fields=files(id,name,mimeType,webViewLink)&supportsAllDrives=true&includeItemsFromAllDrives=true&corpora=allDrives&pageSize=1000`;
|
|
21
|
+
const allDrivesRes = axiosClient.get(allDrivesUrl, {
|
|
23
22
|
headers: {
|
|
24
23
|
Authorization: `Bearer ${authParams.authToken}`,
|
|
25
24
|
},
|
|
26
25
|
});
|
|
27
|
-
|
|
26
|
+
// need to search domain wide separately because the allDrives search doesn't include domain wide files
|
|
27
|
+
const orgWideUrl = `https://www.googleapis.com/drive/v3/files?q=${encodeURIComponent(query)}&fields=files(id,name,mimeType,webViewLink)&corpora=domain&pageSize=1000`;
|
|
28
|
+
const orgWideRes = axiosClient.get(orgWideUrl, {
|
|
29
|
+
headers: {
|
|
30
|
+
Authorization: `Bearer ${authParams.authToken}`,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
const results = yield Promise.all([allDrivesRes, orgWideRes]);
|
|
34
|
+
const relevantResults = results
|
|
35
|
+
.map(result => result.data.files)
|
|
36
|
+
.flat()
|
|
37
|
+
.filter(Boolean);
|
|
38
|
+
const files = relevantResults.map((file) => ({
|
|
28
39
|
id: file.id || "",
|
|
29
40
|
name: file.name || "",
|
|
30
41
|
mimeType: file.mimeType || "",
|
|
31
42
|
url: file.webViewLink || "",
|
|
32
|
-
}))
|
|
43
|
+
})) || [];
|
|
33
44
|
return { success: true, files: limit ? files.splice(0, limit) : files };
|
|
34
45
|
}
|
|
35
46
|
catch (error) {
|
|
@@ -62,19 +62,30 @@ const searchDriveByQuery = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
62
62
|
});
|
|
63
63
|
// Original search method - search all drives at once
|
|
64
64
|
const searchAllDrivesAtOnce = (query, authToken, limit, orderByQuery) => __awaiter(void 0, void 0, void 0, function* () {
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
const res = yield axiosClient.get(url, {
|
|
65
|
+
const allDrivesUrl = `https://www.googleapis.com/drive/v3/files?q=${encodeURIComponent(query)}&fields=files(id,name,mimeType,webViewLink)&supportsAllDrives=true&includeItemsFromAllDrives=true&corpora=allDrives&pageSize=1000${orderByQuery ? `&orderBy=${encodeURIComponent(orderByQuery)}` : ""}`;
|
|
66
|
+
const allDrivesRes = axiosClient.get(allDrivesUrl, {
|
|
68
67
|
headers: {
|
|
69
68
|
Authorization: `Bearer ${authToken}`,
|
|
70
69
|
},
|
|
71
70
|
});
|
|
72
|
-
|
|
71
|
+
// need to search domain wide separately because the allDrives search doesn't include domain wide files
|
|
72
|
+
const orgWideUrl = `https://www.googleapis.com/drive/v3/files?q=${encodeURIComponent(query)}&fields=files(id,name,mimeType,webViewLink)&corpora=domain&pageSize=1000${orderByQuery ? `&orderBy=${encodeURIComponent(orderByQuery)}` : ""}`;
|
|
73
|
+
const orgWideRes = axiosClient.get(orgWideUrl, {
|
|
74
|
+
headers: {
|
|
75
|
+
Authorization: `Bearer ${authToken}`,
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
const results = yield Promise.all([allDrivesRes, orgWideRes]);
|
|
79
|
+
const relevantResults = results
|
|
80
|
+
.map(result => result.data.files)
|
|
81
|
+
.flat()
|
|
82
|
+
.filter(Boolean);
|
|
83
|
+
const files = relevantResults.map((file) => ({
|
|
73
84
|
id: file.id || "",
|
|
74
85
|
name: file.name || "",
|
|
75
86
|
mimeType: file.mimeType || "",
|
|
76
87
|
url: file.webViewLink || "",
|
|
77
|
-
}))
|
|
88
|
+
})) || [];
|
|
78
89
|
// Filter out images and folders
|
|
79
90
|
const readableFiles = filterReadableFiles(files);
|
|
80
91
|
return {
|
|
@@ -86,25 +97,46 @@ const searchAllDrivesAtOnce = (query, authToken, limit, orderByQuery) => __await
|
|
|
86
97
|
const searchAllDrivesIndividually = (query, authToken, limit, orderByQuery) => __awaiter(void 0, void 0, void 0, function* () {
|
|
87
98
|
const drives = yield getAllDrives(authToken);
|
|
88
99
|
let allFiles = [];
|
|
100
|
+
const domainUrl = `https://www.googleapis.com/drive/v3/files?` +
|
|
101
|
+
`q=${encodeURIComponent(query)}&` +
|
|
102
|
+
`fields=files(id,name,mimeType,webViewLink),nextPageToken&` +
|
|
103
|
+
`corpora=domain&` +
|
|
104
|
+
`pageSize=1000${orderByQuery ? `&orderBy=${encodeURIComponent(orderByQuery)}` : ""}`;
|
|
105
|
+
const domainDriveFunction = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
106
|
+
var _a, _b;
|
|
107
|
+
const domainRes = yield axiosClient.get(domainUrl, {
|
|
108
|
+
headers: { Authorization: `Bearer ${authToken}` },
|
|
109
|
+
});
|
|
110
|
+
return ((_b = (_a = domainRes.data.files) === null || _a === void 0 ? void 0 : _a.map((file) => ({
|
|
111
|
+
id: file.id || "",
|
|
112
|
+
name: file.name || "",
|
|
113
|
+
mimeType: file.mimeType || "",
|
|
114
|
+
url: file.webViewLink || "",
|
|
115
|
+
}))) !== null && _b !== void 0 ? _b : []);
|
|
116
|
+
});
|
|
89
117
|
// Search each drive individually
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if (limit && allFiles.length >= limit) {
|
|
98
|
-
break;
|
|
118
|
+
const results = yield Promise.allSettled([
|
|
119
|
+
domainDriveFunction(),
|
|
120
|
+
...drives.map((drive) => __awaiter(void 0, void 0, void 0, function* () {
|
|
121
|
+
try {
|
|
122
|
+
const driveFiles = yield searchSingleDrive(query, drive.id, authToken, orderByQuery);
|
|
123
|
+
// Filter out images and folders before adding to results
|
|
124
|
+
return filterReadableFiles(driveFiles);
|
|
99
125
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
126
|
+
catch (error) {
|
|
127
|
+
console.error(`Error searching drive ${drive.name} (${drive.id}):`, error);
|
|
128
|
+
return [];
|
|
129
|
+
}
|
|
130
|
+
})),
|
|
131
|
+
]);
|
|
132
|
+
for (const result of results) {
|
|
133
|
+
if (result.status === "fulfilled") {
|
|
134
|
+
allFiles = allFiles.concat(result.value.slice(0, limit));
|
|
103
135
|
}
|
|
104
136
|
}
|
|
105
137
|
return {
|
|
106
138
|
success: true,
|
|
107
|
-
files:
|
|
139
|
+
files: allFiles,
|
|
108
140
|
};
|
|
109
141
|
});
|
|
110
142
|
// Get all drives (shared drives + user's drive)
|
|
@@ -11,7 +11,7 @@ import { ApiError, axiosClient } from "../../util/axiosClient.js";
|
|
|
11
11
|
const searchSalesforceRecords = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
12
12
|
const { authToken, baseUrl } = authParams;
|
|
13
13
|
const { keyword, recordType, fieldsToSearch } = params;
|
|
14
|
-
const searchFields = Array.from(new Set([...fieldsToSearch, "Id"
|
|
14
|
+
const searchFields = Array.from(new Set([...fieldsToSearch, "Id"]));
|
|
15
15
|
if (!authToken || !baseUrl) {
|
|
16
16
|
return {
|
|
17
17
|
success: false,
|
|
@@ -11,23 +11,19 @@ import { WebClient } from "@slack/web-api";
|
|
|
11
11
|
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
12
12
|
import { getSlackChannels } from "./helpers.js";
|
|
13
13
|
const archiveChannel = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
14
|
-
var _b;
|
|
15
14
|
if (!authParams.authToken) {
|
|
16
15
|
throw new Error(MISSING_AUTH_TOKEN);
|
|
17
16
|
}
|
|
18
17
|
try {
|
|
19
18
|
const client = new WebClient(authParams.authToken);
|
|
20
|
-
const {
|
|
21
|
-
if (!inputChannelId && !channelName) {
|
|
22
|
-
throw Error("Either channelId or channelName must be provided");
|
|
23
|
-
}
|
|
19
|
+
const { channelName } = params;
|
|
24
20
|
const allChannels = yield getSlackChannels(client);
|
|
25
|
-
const
|
|
26
|
-
if (!
|
|
21
|
+
const channel = allChannels.find(channel => channel.name == channelName);
|
|
22
|
+
if (!channel || !channel.id) {
|
|
27
23
|
throw Error(`Channel with name ${channelName} not found`);
|
|
28
24
|
}
|
|
29
|
-
yield client.conversations.join({ channel:
|
|
30
|
-
const result = yield client.conversations.archive({ channel:
|
|
25
|
+
yield client.conversations.join({ channel: channel.id });
|
|
26
|
+
const result = yield client.conversations.archive({ channel: channel.id });
|
|
31
27
|
if (!result.ok) {
|
|
32
28
|
return {
|
|
33
29
|
success: false,
|
package/package.json
CHANGED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const axiosClient_1 = require("../../util/axiosClient");
|
|
13
|
-
const missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
|
14
|
-
const decodeMessage_1 = require("./utils/decodeMessage");
|
|
15
|
-
const listGmailThreads = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
16
|
-
if (!authParams.authToken) {
|
|
17
|
-
return { success: false, error: missingAuthConstants_1.MISSING_AUTH_TOKEN, threads: [] };
|
|
18
|
-
}
|
|
19
|
-
const { query, maxResults } = params;
|
|
20
|
-
const allThreads = [];
|
|
21
|
-
const errorMessages = [];
|
|
22
|
-
const max = maxResults !== null && maxResults !== void 0 ? maxResults : 100;
|
|
23
|
-
let fetched = 0;
|
|
24
|
-
let pageToken = undefined;
|
|
25
|
-
try {
|
|
26
|
-
while (fetched < max) {
|
|
27
|
-
const url = `https://gmail.googleapis.com/gmail/v1/users/me/threads?q=${encodeURIComponent(query)}` +
|
|
28
|
-
(pageToken ? `&pageToken=${encodeURIComponent(pageToken)}` : "") +
|
|
29
|
-
`&maxResults=${Math.min(100, max - fetched)}`;
|
|
30
|
-
const listRes = yield axiosClient_1.axiosClient.get(url, {
|
|
31
|
-
headers: {
|
|
32
|
-
Authorization: `Bearer ${authParams.authToken}`,
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
const { threads: threadList = [], nextPageToken } = listRes.data;
|
|
36
|
-
if (!Array.isArray(threadList) || threadList.length === 0)
|
|
37
|
-
break;
|
|
38
|
-
const remaining = max - allThreads.length;
|
|
39
|
-
const batch = threadList.slice(0, remaining);
|
|
40
|
-
const results = yield Promise.all(batch.map((thread) => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
-
try {
|
|
42
|
-
const threadRes = yield axiosClient_1.axiosClient.get(`https://gmail.googleapis.com/gmail/v1/users/me/threads/${thread.id}?format=full`, {
|
|
43
|
-
headers: {
|
|
44
|
-
Authorization: `Bearer ${authParams.authToken}`,
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
const { id, historyId, messages } = threadRes.data;
|
|
48
|
-
return {
|
|
49
|
-
id,
|
|
50
|
-
historyId,
|
|
51
|
-
messages: Array.isArray(messages)
|
|
52
|
-
? messages.map(msg => {
|
|
53
|
-
const { id, threadId, snippet, labelIds, internalDate } = msg;
|
|
54
|
-
const emailBody = (0, decodeMessage_1.getEmailContent)(msg) || "";
|
|
55
|
-
return {
|
|
56
|
-
id,
|
|
57
|
-
threadId,
|
|
58
|
-
snippet,
|
|
59
|
-
labelIds,
|
|
60
|
-
internalDate,
|
|
61
|
-
emailBody,
|
|
62
|
-
};
|
|
63
|
-
})
|
|
64
|
-
: [],
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
catch (err) {
|
|
68
|
-
errorMessages.push(err instanceof Error ? err.message : "Failed to fetch thread details");
|
|
69
|
-
return {
|
|
70
|
-
id: thread.id,
|
|
71
|
-
snippet: "",
|
|
72
|
-
historyId: "",
|
|
73
|
-
messages: [],
|
|
74
|
-
error: err instanceof Error ? err.message : "Failed to fetch thread details",
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
})));
|
|
78
|
-
allThreads.push(...results);
|
|
79
|
-
fetched = allThreads.length;
|
|
80
|
-
if (!nextPageToken || allThreads.length >= max)
|
|
81
|
-
break;
|
|
82
|
-
pageToken = nextPageToken;
|
|
83
|
-
}
|
|
84
|
-
return {
|
|
85
|
-
success: errorMessages.length === 0,
|
|
86
|
-
threads: allThreads,
|
|
87
|
-
error: errorMessages.join("; "),
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
catch (error) {
|
|
91
|
-
return {
|
|
92
|
-
success: false,
|
|
93
|
-
error: error instanceof Error ? error.message : "Unknown error listing Gmail threads",
|
|
94
|
-
threads: [],
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
exports.default = listGmailThreads;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const axiosClient_1 = require("../../util/axiosClient");
|
|
13
|
-
const missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
|
14
|
-
const decodeMessage_1 = require("./utils/decodeMessage");
|
|
15
|
-
const searchGmailMessages = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
16
|
-
if (!authParams.authToken) {
|
|
17
|
-
return { success: false, error: missingAuthConstants_1.MISSING_AUTH_TOKEN, messages: [] };
|
|
18
|
-
}
|
|
19
|
-
const { query, maxResults } = params;
|
|
20
|
-
const allMessages = [];
|
|
21
|
-
const max = maxResults !== null && maxResults !== void 0 ? maxResults : 100;
|
|
22
|
-
const errorMessages = [];
|
|
23
|
-
let pageToken = undefined;
|
|
24
|
-
let fetched = 0;
|
|
25
|
-
try {
|
|
26
|
-
while (fetched < max) {
|
|
27
|
-
const url = `https://gmail.googleapis.com/gmail/v1/users/me/messages?q=${encodeURIComponent(query)}` +
|
|
28
|
-
(pageToken ? `&pageToken=${encodeURIComponent(pageToken)}` : "") +
|
|
29
|
-
`&maxResults=${Math.min(100, max - fetched)}`;
|
|
30
|
-
const listRes = yield axiosClient_1.axiosClient.get(url, {
|
|
31
|
-
headers: {
|
|
32
|
-
Authorization: `Bearer ${authParams.authToken}`,
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
const { messages: messageList = [], nextPageToken } = listRes.data;
|
|
36
|
-
if (!Array.isArray(messageList) || messageList.length === 0)
|
|
37
|
-
break;
|
|
38
|
-
const remaining = max - allMessages.length;
|
|
39
|
-
const batch = messageList.slice(0, remaining);
|
|
40
|
-
const results = yield Promise.all(batch.map((msg) => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
-
try {
|
|
42
|
-
const msgRes = yield axiosClient_1.axiosClient.get(`https://gmail.googleapis.com/gmail/v1/users/me/messages/${msg.id}?format=full`, {
|
|
43
|
-
headers: {
|
|
44
|
-
Authorization: `Bearer ${authParams.authToken}`,
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
const { id, threadId, snippet, labelIds, internalDate } = msgRes.data;
|
|
48
|
-
const emailBody = (0, decodeMessage_1.getEmailContent)(msgRes.data) || "";
|
|
49
|
-
return {
|
|
50
|
-
id,
|
|
51
|
-
threadId,
|
|
52
|
-
snippet,
|
|
53
|
-
labelIds,
|
|
54
|
-
internalDate,
|
|
55
|
-
emailBody,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
catch (err) {
|
|
59
|
-
errorMessages.push(err instanceof Error ? err.message : "Failed to fetch message details");
|
|
60
|
-
return {
|
|
61
|
-
id: msg.id,
|
|
62
|
-
threadId: "",
|
|
63
|
-
snippet: "",
|
|
64
|
-
labelIds: [],
|
|
65
|
-
internalDate: "",
|
|
66
|
-
payload: {},
|
|
67
|
-
error: err instanceof Error ? err.message : "Failed to fetch message details",
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
})));
|
|
71
|
-
allMessages.push(...results);
|
|
72
|
-
fetched = allMessages.length;
|
|
73
|
-
if (!nextPageToken || allMessages.length >= max)
|
|
74
|
-
break;
|
|
75
|
-
pageToken = nextPageToken;
|
|
76
|
-
}
|
|
77
|
-
return {
|
|
78
|
-
success: errorMessages.length === 0,
|
|
79
|
-
messages: allMessages,
|
|
80
|
-
error: errorMessages.join("; "),
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
catch (error) {
|
|
84
|
-
return {
|
|
85
|
-
success: false,
|
|
86
|
-
error: error instanceof Error ? error.message : "Unknown error searching Gmail",
|
|
87
|
-
messages: [],
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
exports.default = searchGmailMessages;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const axiosClient_1 = require("../../util/axiosClient");
|
|
13
|
-
const getComputerInventory = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
14
|
-
const { authToken, baseUrl } = authParams;
|
|
15
|
-
const { section } = params;
|
|
16
|
-
if (!baseUrl) {
|
|
17
|
-
throw new Error("Base URL is required to fetch computer inventory");
|
|
18
|
-
}
|
|
19
|
-
const apiUrl = `${baseUrl}/v1/computer-inventory`;
|
|
20
|
-
const queryParams = {};
|
|
21
|
-
if (section) {
|
|
22
|
-
queryParams.section = section;
|
|
23
|
-
}
|
|
24
|
-
try {
|
|
25
|
-
const response = yield axiosClient_1.axiosClient.get(apiUrl, {
|
|
26
|
-
headers: {
|
|
27
|
-
Authorization: `Bearer ${authToken}`,
|
|
28
|
-
Accept: "application/json",
|
|
29
|
-
},
|
|
30
|
-
params: queryParams,
|
|
31
|
-
});
|
|
32
|
-
return {
|
|
33
|
-
success: true,
|
|
34
|
-
data: response.data,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
console.error("Error retrieving computer inventory: ", error);
|
|
39
|
-
return {
|
|
40
|
-
success: false,
|
|
41
|
-
error: error instanceof Error ? error.message : "Unknown error",
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
exports.default = getComputerInventory;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const axiosClient_1 = require("../../util/axiosClient");
|
|
13
|
-
const getFileVaultRecoveryKey = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
14
|
-
const { authToken, baseUrl } = authParams;
|
|
15
|
-
const { computerId } = params;
|
|
16
|
-
if (!baseUrl || !computerId) {
|
|
17
|
-
throw new Error("Base URL and Computer ID are required to fetch FileVault2 recovery key");
|
|
18
|
-
}
|
|
19
|
-
const apiUrl = `${baseUrl}/JSSResource/computers/${computerId}/FileVault2RecoveryKey`;
|
|
20
|
-
try {
|
|
21
|
-
const response = yield axiosClient_1.axiosClient.get(apiUrl, {
|
|
22
|
-
headers: {
|
|
23
|
-
Authorization: `Bearer ${authToken}`,
|
|
24
|
-
Accept: "application/json",
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
return {
|
|
28
|
-
success: true,
|
|
29
|
-
data: response.data,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
console.error("Error retrieving FileVault2 recovery key: ", error);
|
|
34
|
-
return {
|
|
35
|
-
success: false,
|
|
36
|
-
error: error instanceof Error ? error.message : "Unknown error",
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
exports.default = getFileVaultRecoveryKey;
|
|
@@ -1,37 +0,0 @@
|
|
|
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 restartJamfComputerById = (_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 Jamf user computer ID");
|
|
16
|
-
}
|
|
17
|
-
const url = `https://${subdomain}.jamfcloud.com`;
|
|
18
|
-
try {
|
|
19
|
-
yield axiosClient.post(`${url}/api/command/v1/computers/${computerId}/restart`, {
|
|
20
|
-
headers: {
|
|
21
|
-
Authorization: `Bearer ${authToken}`,
|
|
22
|
-
Accept: "application/json",
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
return {
|
|
26
|
-
success: true,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
catch (error) {
|
|
30
|
-
console.error("Error restarting Jamf computer: ", error);
|
|
31
|
-
return {
|
|
32
|
-
success: false,
|
|
33
|
-
error: error instanceof Error ? error.message : "Unknown error",
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
export default restartJamfComputerById;
|