@credal/actions 0.2.139 → 0.2.141
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 +20 -0
- package/dist/actions/autogen/types.d.ts +25 -0
- package/dist/actions/autogen/types.js +5 -0
- 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/getDriveFileContentById.js +40 -0
- package/dist/actions/providers/google-oauth/utils/decodeMessage.d.ts +10 -1
- package/dist/actions/providers/googlemail/searchGmailMessages.js +25 -2
- package/dist/actions/providers/jamf/types.d.ts +8 -0
- package/dist/actions/providers/jamf/types.js +7 -0
- package/dist/actions/providers/slack/archiveChannel.js +9 -2
- package/package.json +3 -1
- package/dist/actions/providers/salesforce/getSalesforceRecordByQuery.d.ts +0 -3
- package/dist/actions/providers/salesforce/getSalesforceRecordByQuery.js +0 -43
|
@@ -7973,6 +7973,26 @@ export const googlemailSearchGmailMessagesDefinition = {
|
|
|
7973
7973
|
type: "string",
|
|
7974
7974
|
description: "The body of the message",
|
|
7975
7975
|
},
|
|
7976
|
+
from: {
|
|
7977
|
+
type: "string",
|
|
7978
|
+
description: "The from header of the message",
|
|
7979
|
+
},
|
|
7980
|
+
to: {
|
|
7981
|
+
type: "string",
|
|
7982
|
+
description: "The to header of the message",
|
|
7983
|
+
},
|
|
7984
|
+
subject: {
|
|
7985
|
+
type: "string",
|
|
7986
|
+
description: "The subject header of the message",
|
|
7987
|
+
},
|
|
7988
|
+
cc: {
|
|
7989
|
+
type: "string",
|
|
7990
|
+
description: "The cc header of the message",
|
|
7991
|
+
},
|
|
7992
|
+
bcc: {
|
|
7993
|
+
type: "string",
|
|
7994
|
+
description: "The bcc header of the message",
|
|
7995
|
+
},
|
|
7976
7996
|
},
|
|
7977
7997
|
},
|
|
7978
7998
|
},
|
|
@@ -5065,20 +5065,35 @@ export declare const googlemailSearchGmailMessagesOutputSchema: z.ZodObject<{
|
|
|
5065
5065
|
labelIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
5066
5066
|
internalDate: z.ZodOptional<z.ZodString>;
|
|
5067
5067
|
emailBody: z.ZodOptional<z.ZodString>;
|
|
5068
|
+
from: z.ZodOptional<z.ZodString>;
|
|
5069
|
+
to: z.ZodOptional<z.ZodString>;
|
|
5070
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
5071
|
+
cc: z.ZodOptional<z.ZodString>;
|
|
5072
|
+
bcc: z.ZodOptional<z.ZodString>;
|
|
5068
5073
|
}, "strip", z.ZodTypeAny, {
|
|
5069
5074
|
id: string;
|
|
5070
5075
|
threadId: string;
|
|
5076
|
+
subject?: string | undefined;
|
|
5077
|
+
to?: string | undefined;
|
|
5071
5078
|
snippet?: string | undefined;
|
|
5072
5079
|
labelIds?: string[] | undefined;
|
|
5073
5080
|
internalDate?: string | undefined;
|
|
5074
5081
|
emailBody?: string | undefined;
|
|
5082
|
+
cc?: string | undefined;
|
|
5083
|
+
bcc?: string | undefined;
|
|
5084
|
+
from?: string | undefined;
|
|
5075
5085
|
}, {
|
|
5076
5086
|
id: string;
|
|
5077
5087
|
threadId: string;
|
|
5088
|
+
subject?: string | undefined;
|
|
5089
|
+
to?: string | undefined;
|
|
5078
5090
|
snippet?: string | undefined;
|
|
5079
5091
|
labelIds?: string[] | undefined;
|
|
5080
5092
|
internalDate?: string | undefined;
|
|
5081
5093
|
emailBody?: string | undefined;
|
|
5094
|
+
cc?: string | undefined;
|
|
5095
|
+
bcc?: string | undefined;
|
|
5096
|
+
from?: string | undefined;
|
|
5082
5097
|
}>, "many">;
|
|
5083
5098
|
error: z.ZodOptional<z.ZodString>;
|
|
5084
5099
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -5086,10 +5101,15 @@ export declare const googlemailSearchGmailMessagesOutputSchema: z.ZodObject<{
|
|
|
5086
5101
|
messages: {
|
|
5087
5102
|
id: string;
|
|
5088
5103
|
threadId: string;
|
|
5104
|
+
subject?: string | undefined;
|
|
5105
|
+
to?: string | undefined;
|
|
5089
5106
|
snippet?: string | undefined;
|
|
5090
5107
|
labelIds?: string[] | undefined;
|
|
5091
5108
|
internalDate?: string | undefined;
|
|
5092
5109
|
emailBody?: string | undefined;
|
|
5110
|
+
cc?: string | undefined;
|
|
5111
|
+
bcc?: string | undefined;
|
|
5112
|
+
from?: string | undefined;
|
|
5093
5113
|
}[];
|
|
5094
5114
|
error?: string | undefined;
|
|
5095
5115
|
}, {
|
|
@@ -5097,10 +5117,15 @@ export declare const googlemailSearchGmailMessagesOutputSchema: z.ZodObject<{
|
|
|
5097
5117
|
messages: {
|
|
5098
5118
|
id: string;
|
|
5099
5119
|
threadId: string;
|
|
5120
|
+
subject?: string | undefined;
|
|
5121
|
+
to?: string | undefined;
|
|
5100
5122
|
snippet?: string | undefined;
|
|
5101
5123
|
labelIds?: string[] | undefined;
|
|
5102
5124
|
internalDate?: string | undefined;
|
|
5103
5125
|
emailBody?: string | undefined;
|
|
5126
|
+
cc?: string | undefined;
|
|
5127
|
+
bcc?: string | undefined;
|
|
5128
|
+
from?: string | undefined;
|
|
5104
5129
|
}[];
|
|
5105
5130
|
error?: string | undefined;
|
|
5106
5131
|
}>;
|
|
@@ -2946,6 +2946,11 @@ export const googlemailSearchGmailMessagesOutputSchema = z.object({
|
|
|
2946
2946
|
labelIds: z.array(z.string()).describe("Labels on the message").optional(),
|
|
2947
2947
|
internalDate: z.string().describe("Internal timestamp of the message").optional(),
|
|
2948
2948
|
emailBody: z.string().describe("The body of the message").optional(),
|
|
2949
|
+
from: z.string().describe("The from header of the message").optional(),
|
|
2950
|
+
to: z.string().describe("The to header of the message").optional(),
|
|
2951
|
+
subject: z.string().describe("The subject header of the message").optional(),
|
|
2952
|
+
cc: z.string().describe("The cc header of the message").optional(),
|
|
2953
|
+
bcc: z.string().describe("The bcc header of the message").optional(),
|
|
2949
2954
|
}))
|
|
2950
2955
|
.describe("List of matching Gmail messages"),
|
|
2951
2956
|
error: z.string().describe("Error message if search failed").optional(),
|
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;
|
|
@@ -12,6 +12,8 @@ import mammoth from "mammoth";
|
|
|
12
12
|
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
13
13
|
import { extractTextFromPdf } from "../../../utils/pdf.js";
|
|
14
14
|
import { getGoogleDocContent, getGoogleSheetContent, getGoogleSlidesContent } from "../../../utils/google.js";
|
|
15
|
+
import { read, utils } from "xlsx";
|
|
16
|
+
import officeParser from "officeparser";
|
|
15
17
|
const getDriveFileContentById = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
16
18
|
var _b, _c, _d, _e;
|
|
17
19
|
if (!authParams.authToken) {
|
|
@@ -116,6 +118,44 @@ const getDriveFileContentById = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
|
116
118
|
const rawContentBuffer = Buffer.from(bufferResults); // Convert rawContent ArrayBuffer to Buffer
|
|
117
119
|
content = rawContentBuffer.toString("utf-8");
|
|
118
120
|
}
|
|
121
|
+
else if (mimeType === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ||
|
|
122
|
+
mimeType === "application/vnd.ms-excel") {
|
|
123
|
+
const downloadUrl = `${BASE_URL}${encodeURIComponent(params.fileId)}?alt=media${sharedDriveParam}`;
|
|
124
|
+
const downloadRes = yield axiosClient.get(downloadUrl, {
|
|
125
|
+
headers,
|
|
126
|
+
responseType: "arraybuffer",
|
|
127
|
+
});
|
|
128
|
+
// 1. Read the buffer into a workbook
|
|
129
|
+
const workbook = read(downloadRes.data, { type: "buffer" });
|
|
130
|
+
// 2. Convert all sheets to plain text (CSV-style)
|
|
131
|
+
let textOutput = "";
|
|
132
|
+
workbook.SheetNames.forEach(sheetName => {
|
|
133
|
+
const sheet = workbook.Sheets[sheetName];
|
|
134
|
+
const csv = utils.sheet_to_csv(sheet); // or sheet_to_json if you want arrays
|
|
135
|
+
textOutput += `\n--- Sheet: ${sheetName} ---\n${csv}`;
|
|
136
|
+
});
|
|
137
|
+
// textOutput now contains all sheet data as text
|
|
138
|
+
content = textOutput.trim();
|
|
139
|
+
}
|
|
140
|
+
else if (mimeType === "application/vnd.openxmlformats-officedocument.presentationml.presentation") {
|
|
141
|
+
// Handle modern PowerPoint files (.pptx only)
|
|
142
|
+
const downloadUrl = `${BASE_URL}${encodeURIComponent(params.fileId)}?alt=media${sharedDriveParam}`;
|
|
143
|
+
const downloadRes = yield axiosClient.get(downloadUrl, {
|
|
144
|
+
headers,
|
|
145
|
+
responseType: "arraybuffer",
|
|
146
|
+
});
|
|
147
|
+
try {
|
|
148
|
+
// officeparser expects a Buffer, so convert the ArrayBuffer
|
|
149
|
+
const buffer = Buffer.from(downloadRes.data);
|
|
150
|
+
content = yield officeParser.parseOfficeAsync(buffer);
|
|
151
|
+
}
|
|
152
|
+
catch (powerpointError) {
|
|
153
|
+
return {
|
|
154
|
+
success: false,
|
|
155
|
+
error: `Failed to parse PowerPoint document: ${powerpointError instanceof Error ? powerpointError.message : "Unknown PowerPoint error"}`,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
}
|
|
119
159
|
else {
|
|
120
160
|
return { success: false, error: `Unsupported file type: ${mimeType}` };
|
|
121
161
|
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
interface GmailMessage {
|
|
1
|
+
export interface GmailMessage {
|
|
2
|
+
id: string;
|
|
3
|
+
threadId: string;
|
|
4
|
+
snippet: string;
|
|
5
|
+
labelIds: string[] | undefined;
|
|
6
|
+
internalDate: string;
|
|
2
7
|
payload: {
|
|
3
8
|
mimeType: string;
|
|
4
9
|
body?: {
|
|
@@ -13,6 +18,10 @@ interface GmailMessage {
|
|
|
13
18
|
};
|
|
14
19
|
parts?: GmailMessagePart[];
|
|
15
20
|
}>;
|
|
21
|
+
headers: {
|
|
22
|
+
name: string;
|
|
23
|
+
value: string;
|
|
24
|
+
}[];
|
|
16
25
|
};
|
|
17
26
|
}
|
|
18
27
|
interface GmailMessagePart {
|
|
@@ -66,10 +66,28 @@ const searchGmailMessages = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
66
66
|
headers: { Authorization: `Bearer ${authParams.authToken}` },
|
|
67
67
|
validateStatus: () => true,
|
|
68
68
|
});
|
|
69
|
-
const { id, threadId, snippet, labelIds, internalDate } = msgRes.data;
|
|
69
|
+
const { id, threadId, snippet, labelIds, internalDate, payload } = msgRes.data;
|
|
70
|
+
// Find the "From" header
|
|
71
|
+
const fromHeader = payload.headers.find(h => h.name.toLowerCase() === "from");
|
|
72
|
+
const toHeader = payload.headers.find(h => h.name.toLowerCase() === "to");
|
|
73
|
+
const subjectHeader = payload.headers.find(h => h.name.toLowerCase() === "subject");
|
|
74
|
+
const ccHeader = payload.headers.find(h => h.name.toLowerCase() === "cc");
|
|
75
|
+
const bccHeader = payload.headers.find(h => h.name.toLowerCase() === "bcc");
|
|
70
76
|
const rawBody = getEmailContent(msgRes.data) || "";
|
|
71
77
|
const emailBody = cleanAndTruncateEmail(rawBody);
|
|
72
|
-
return {
|
|
78
|
+
return {
|
|
79
|
+
id,
|
|
80
|
+
threadId,
|
|
81
|
+
snippet,
|
|
82
|
+
labelIds,
|
|
83
|
+
internalDate,
|
|
84
|
+
emailBody,
|
|
85
|
+
from: fromHeader === null || fromHeader === void 0 ? void 0 : fromHeader.value,
|
|
86
|
+
to: toHeader === null || toHeader === void 0 ? void 0 : toHeader.value,
|
|
87
|
+
subject: subjectHeader === null || subjectHeader === void 0 ? void 0 : subjectHeader.value,
|
|
88
|
+
cc: ccHeader === null || ccHeader === void 0 ? void 0 : ccHeader.value,
|
|
89
|
+
bcc: bccHeader === null || bccHeader === void 0 ? void 0 : bccHeader.value,
|
|
90
|
+
};
|
|
73
91
|
}
|
|
74
92
|
catch (err) {
|
|
75
93
|
const errorMessage = err instanceof Error ? err.message : "Failed to fetch message details";
|
|
@@ -82,6 +100,11 @@ const searchGmailMessages = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
82
100
|
internalDate: "",
|
|
83
101
|
emailBody: "",
|
|
84
102
|
error: errorMessage,
|
|
103
|
+
from: "",
|
|
104
|
+
to: "",
|
|
105
|
+
subject: "",
|
|
106
|
+
cc: "",
|
|
107
|
+
bcc: "",
|
|
85
108
|
};
|
|
86
109
|
}
|
|
87
110
|
})));
|
|
@@ -9,14 +9,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { WebClient } from "@slack/web-api";
|
|
11
11
|
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
12
|
+
import { getSlackChannels } from "./helpers.js";
|
|
12
13
|
const archiveChannel = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
13
14
|
if (!authParams.authToken) {
|
|
14
15
|
throw new Error(MISSING_AUTH_TOKEN);
|
|
15
16
|
}
|
|
16
17
|
try {
|
|
17
18
|
const client = new WebClient(authParams.authToken);
|
|
18
|
-
const {
|
|
19
|
-
const
|
|
19
|
+
const { channelName } = params;
|
|
20
|
+
const allChannels = yield getSlackChannels(client);
|
|
21
|
+
const channel = allChannels.find(channel => channel.name == channelName);
|
|
22
|
+
if (!channel || !channel.id) {
|
|
23
|
+
throw Error(`Channel with name ${channelName} not found`);
|
|
24
|
+
}
|
|
25
|
+
yield client.conversations.join({ channel: channel.id });
|
|
26
|
+
const result = yield client.conversations.archive({ channel: channel.id });
|
|
20
27
|
if (!result.ok) {
|
|
21
28
|
return {
|
|
22
29
|
success: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@credal/actions",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.141",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "AI Actions by Credal AI",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -67,12 +67,14 @@
|
|
|
67
67
|
"mammoth": "^1.4.27",
|
|
68
68
|
"mongodb": "^6.13.1",
|
|
69
69
|
"node-forge": "^1.3.1",
|
|
70
|
+
"officeparser": "^5.2.0",
|
|
70
71
|
"p-limit": "^7.1.1",
|
|
71
72
|
"resend": "^4.7.0",
|
|
72
73
|
"snowflake-sdk": "^2.0.2",
|
|
73
74
|
"ts-node": "^10.9.2",
|
|
74
75
|
"unpdf": "^1.2.2",
|
|
75
76
|
"uuid": "^11.1.0",
|
|
77
|
+
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",
|
|
76
78
|
"zod": "^3.25.0"
|
|
77
79
|
}
|
|
78
80
|
}
|
|
@@ -1,43 +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 getSalesforceRecordByQuery = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
14
|
-
const { authToken, baseUrl } = authParams;
|
|
15
|
-
const { query, limit } = params;
|
|
16
|
-
if (!authToken || !baseUrl) {
|
|
17
|
-
return {
|
|
18
|
-
success: false,
|
|
19
|
-
error: "authToken and baseUrl are required for Salesforce API",
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
// The API limits the maximum number of records returned to 2000, the limit lets the user set a smaller custom limit
|
|
23
|
-
const url = `${baseUrl}/services/data/v56.0/query/?q=${encodeURIComponent(query + " LIMIT " + (limit != undefined && limit <= 2000 ? limit : 2000))}`;
|
|
24
|
-
try {
|
|
25
|
-
const response = yield axiosClient_1.axiosClient.get(url, {
|
|
26
|
-
headers: {
|
|
27
|
-
Authorization: `Bearer ${authToken}`,
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
return {
|
|
31
|
-
success: true,
|
|
32
|
-
records: response.data,
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
catch (error) {
|
|
36
|
-
console.error("Error retrieving Salesforce record:", error);
|
|
37
|
-
return {
|
|
38
|
-
success: false,
|
|
39
|
-
error: error instanceof Error ? error.message : "An unknown error occurred",
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
exports.default = getSalesforceRecordByQuery;
|