@credal/actions 0.2.140 → 0.2.142
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/providers/google-oauth/utils/decodeMessage.d.ts +10 -1
- package/dist/actions/providers/googlemail/searchGmailMessages.js +25 -2
- package/dist/actions/providers/jira/updateServiceDeskRequest.d.ts +3 -0
- package/dist/actions/providers/jira/updateServiceDeskRequest.js +72 -0
- package/dist/actions/providers/salesforce/getSalesforceRecordsByQuery.js +16 -5
- package/dist/actions/providers/salesforce/searchSalesforceRecords.js +10 -1
- package/package.json +1 -1
- package/dist/actions/groups.d.ts +0 -6
- package/dist/actions/groups.js +0 -261
- 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/jamf/types.d.ts +0 -8
- package/dist/actions/providers/jamf/types.js +0 -7
- package/dist/actions/providers/math/index.d.ts +0 -1
- package/dist/actions/providers/math/index.js +0 -37
- package/dist/actions/providers/slack/archiveChannel.d.ts +0 -3
- package/dist/actions/providers/slack/archiveChannel.js +0 -42
- 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
|
@@ -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(),
|
|
@@ -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
|
})));
|
|
@@ -0,0 +1,72 @@
|
|
|
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 updateServiceDeskRequest = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
12
|
+
const { issueId, requestTypeId, summary, description, priority, customFields } = params;
|
|
13
|
+
const { authToken, cloudId, baseUrl } = authParams;
|
|
14
|
+
if (!cloudId || !authToken) {
|
|
15
|
+
throw new Error("Valid Cloud ID and auth token are required to update service desk request");
|
|
16
|
+
}
|
|
17
|
+
// Use the regular Jira API for updating service desk requests as they are still Jira issues
|
|
18
|
+
const apiUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/issue/${issueId}`;
|
|
19
|
+
const formattedDescription = description
|
|
20
|
+
? {
|
|
21
|
+
type: "doc",
|
|
22
|
+
version: 1,
|
|
23
|
+
content: [
|
|
24
|
+
{
|
|
25
|
+
type: "paragraph",
|
|
26
|
+
content: [
|
|
27
|
+
{
|
|
28
|
+
type: "text",
|
|
29
|
+
text: description,
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
}
|
|
35
|
+
: undefined;
|
|
36
|
+
const payload = {
|
|
37
|
+
fields: Object.assign(Object.assign(Object.assign(Object.assign({}, (summary && { summary })), (formattedDescription && { description: formattedDescription })), (priority && { priority: { name: priority } })), (customFields && Object.assign({}, customFields))),
|
|
38
|
+
};
|
|
39
|
+
try {
|
|
40
|
+
yield axiosClient.put(apiUrl, payload, {
|
|
41
|
+
headers: {
|
|
42
|
+
Authorization: `Bearer ${authToken}`,
|
|
43
|
+
Accept: "application/json",
|
|
44
|
+
"Content-Type": "application/json",
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
// Get the updated issue details to return current status and web link
|
|
48
|
+
const getResponse = yield axiosClient.get(apiUrl, {
|
|
49
|
+
headers: {
|
|
50
|
+
Authorization: `Bearer ${authToken}`,
|
|
51
|
+
Accept: "application/json",
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
const issueKey = getResponse.data.key;
|
|
55
|
+
const currentStatus = getResponse.data.fields.status.name;
|
|
56
|
+
const webLink = `${baseUrl}/browse/${issueKey}`;
|
|
57
|
+
return {
|
|
58
|
+
success: true,
|
|
59
|
+
issueKey,
|
|
60
|
+
webLink,
|
|
61
|
+
currentStatus,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
console.error("Error updating service desk request:", error);
|
|
66
|
+
return {
|
|
67
|
+
success: false,
|
|
68
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
export default updateServiceDeskRequest;
|
|
@@ -47,11 +47,22 @@ const getSalesforceRecordsByQuery = (_a) => __awaiter(void 0, [_a], void 0, func
|
|
|
47
47
|
success: true,
|
|
48
48
|
results:
|
|
49
49
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
50
|
-
recordsWithUrl.map((record) =>
|
|
51
|
-
name
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
recordsWithUrl.map((record) => {
|
|
51
|
+
// Try common name fields in order of preference, using only what's available
|
|
52
|
+
const displayName = record.Name ||
|
|
53
|
+
record.Title ||
|
|
54
|
+
record.Subject ||
|
|
55
|
+
record.CaseNumber ||
|
|
56
|
+
record.AccountName ||
|
|
57
|
+
record.ContactName ||
|
|
58
|
+
record.Id ||
|
|
59
|
+
record.webUrl;
|
|
60
|
+
return {
|
|
61
|
+
name: displayName,
|
|
62
|
+
url: record.webUrl,
|
|
63
|
+
content: record,
|
|
64
|
+
};
|
|
65
|
+
}) || [],
|
|
55
66
|
};
|
|
56
67
|
}
|
|
57
68
|
catch (error) {
|
|
@@ -47,7 +47,16 @@ const searchSalesforceRecords = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
|
47
47
|
results: response.data.searchRecords.map((record) => {
|
|
48
48
|
const recordId = record.Id;
|
|
49
49
|
const webUrl = recordId ? `${baseUrl}/lightning/r/${recordId}/view` : undefined;
|
|
50
|
-
|
|
50
|
+
// Try common name fields in order of preference, using only what's available
|
|
51
|
+
const displayName = record.Name ||
|
|
52
|
+
record.Title ||
|
|
53
|
+
record.Subject ||
|
|
54
|
+
record.CaseNumber ||
|
|
55
|
+
record.AccountName ||
|
|
56
|
+
record.ContactName ||
|
|
57
|
+
record.Id ||
|
|
58
|
+
webUrl;
|
|
59
|
+
return { name: displayName, url: webUrl, contents: record };
|
|
51
60
|
}),
|
|
52
61
|
};
|
|
53
62
|
}
|
package/package.json
CHANGED
package/dist/actions/groups.d.ts
DELETED
package/dist/actions/groups.js
DELETED
|
@@ -1,261 +0,0 @@
|
|
|
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
|
-
export const ACTION_GROUPS = {
|
|
3
|
-
GENERIC: {
|
|
4
|
-
description: "Generic utility actions",
|
|
5
|
-
actions: [genericFillTemplateDefinition],
|
|
6
|
-
},
|
|
7
|
-
ASANA: {
|
|
8
|
-
description: "Actions for interacting with Asana",
|
|
9
|
-
actions: [
|
|
10
|
-
asanaCommentTaskDefinition,
|
|
11
|
-
asanaCreateTaskDefinition,
|
|
12
|
-
asanaUpdateTaskDefinition,
|
|
13
|
-
asanaSearchTasksDefinition,
|
|
14
|
-
asanaListAsanaTasksByProjectDefinition,
|
|
15
|
-
asanaGetTasksDetailsDefinition,
|
|
16
|
-
],
|
|
17
|
-
},
|
|
18
|
-
SLACK_LIST_CONVERSATIONS: {
|
|
19
|
-
description: "Actions for interacting with Slack",
|
|
20
|
-
actions: [
|
|
21
|
-
slackSendMessageDefinition,
|
|
22
|
-
slackGetChannelMessagesDefinition,
|
|
23
|
-
slackCreateChannelDefinition,
|
|
24
|
-
slackArchiveChannelDefinition,
|
|
25
|
-
],
|
|
26
|
-
},
|
|
27
|
-
CONFLUENCE: {
|
|
28
|
-
description: "Action for interacting with Confluence",
|
|
29
|
-
actions: [confluenceOverwritePageDefinition, confluenceFetchPageContentDefinition],
|
|
30
|
-
},
|
|
31
|
-
MATH_ADD: {
|
|
32
|
-
description: "Action for adding two numbers",
|
|
33
|
-
actions: [mathAddDefinition],
|
|
34
|
-
},
|
|
35
|
-
GOOGLE_MAPS: {
|
|
36
|
-
description: "Action for interacting with Google Maps",
|
|
37
|
-
actions: [googlemapsValidateAddressDefinition, googlemapsNearbysearchRestaurantsDefinition],
|
|
38
|
-
},
|
|
39
|
-
GOOGLE_DRIVE: {
|
|
40
|
-
description: "Action for interacting with Google Drive",
|
|
41
|
-
actions: [
|
|
42
|
-
googleOauthCreateNewGoogleDocDefinition,
|
|
43
|
-
googleOauthUpdateDocDefinition,
|
|
44
|
-
googleOauthCreateSpreadsheetDefinition,
|
|
45
|
-
googleOauthUpdateSpreadsheetDefinition,
|
|
46
|
-
googleOauthCreatePresentationDefinition,
|
|
47
|
-
googleOauthUpdatePresentationDefinition,
|
|
48
|
-
googleOauthSearchDriveByKeywordsDefinition,
|
|
49
|
-
googleOauthSearchDriveByQueryDefinition,
|
|
50
|
-
googleOauthSearchDriveByQueryAndGetFileContentDefinition,
|
|
51
|
-
googleOauthGetDriveFileContentByIdDefinition,
|
|
52
|
-
],
|
|
53
|
-
},
|
|
54
|
-
GOOGLE_CALENDAR: {
|
|
55
|
-
description: "Actions for interacting with Google Calendar",
|
|
56
|
-
actions: [
|
|
57
|
-
googleOauthScheduleCalendarMeetingDefinition,
|
|
58
|
-
googleOauthListCalendarsDefinition,
|
|
59
|
-
googleOauthListCalendarEventsDefinition,
|
|
60
|
-
googleOauthUpdateCalendarEventDefinition,
|
|
61
|
-
googleOauthDeleteCalendarEventDefinition,
|
|
62
|
-
],
|
|
63
|
-
},
|
|
64
|
-
GMAIL: {
|
|
65
|
-
description: "Actions for interacting with Gmail",
|
|
66
|
-
actions: [googlemailSearchGmailMessagesDefinition, googlemailListGmailThreadsDefinition],
|
|
67
|
-
},
|
|
68
|
-
LINKEDIN_SHARE_POST: {
|
|
69
|
-
description: "Action for creating a share post url on linkedin",
|
|
70
|
-
actions: [linkedinCreateShareLinkedinPostUrlDefinition],
|
|
71
|
-
},
|
|
72
|
-
ZENDESK_ACTIONS: {
|
|
73
|
-
description: "Actions for interacting with Zendesk",
|
|
74
|
-
actions: [
|
|
75
|
-
zendeskCreateZendeskTicketDefinition,
|
|
76
|
-
zendeskListZendeskTicketsDefinition,
|
|
77
|
-
zendeskGetTicketDetailsDefinition,
|
|
78
|
-
zendeskUpdateTicketStatusDefinition,
|
|
79
|
-
zendeskAddCommentToTicketDefinition,
|
|
80
|
-
zendeskAssignTicketDefinition,
|
|
81
|
-
],
|
|
82
|
-
},
|
|
83
|
-
BING_SEARCH: {
|
|
84
|
-
description: "Action for searching Bing",
|
|
85
|
-
actions: [bingGetTopNSearchResultUrlsDefinition],
|
|
86
|
-
},
|
|
87
|
-
MONGO_INSERT_DOC: {
|
|
88
|
-
description: "Action for inserting a document into a MongoDB collection",
|
|
89
|
-
actions: [mongoInsertMongoDocDefinition],
|
|
90
|
-
},
|
|
91
|
-
SNOWFLAKE_ACTIONS: {
|
|
92
|
-
description: "Action for getting content from a Snowflake table",
|
|
93
|
-
actions: [snowflakeGetRowByFieldValueDefinition, snowflakeRunSnowflakeQueryDefinition],
|
|
94
|
-
},
|
|
95
|
-
JIRA_ACTIONS: {
|
|
96
|
-
description: "Action for interacting with Jira tickets",
|
|
97
|
-
actions: [
|
|
98
|
-
jiraAssignJiraTicketDefinition,
|
|
99
|
-
jiraCreateJiraTicketDefinition,
|
|
100
|
-
jiraCommentJiraTicketDefinition,
|
|
101
|
-
jiraGetJiraTicketDetailsDefinition,
|
|
102
|
-
jiraGetJiraTicketHistoryDefinition,
|
|
103
|
-
jiraUpdateJiraTicketDetailsDefinition,
|
|
104
|
-
jiraUpdateJiraTicketStatusDefinition,
|
|
105
|
-
jiraGetJiraIssuesByQueryDefinition,
|
|
106
|
-
jiraGetServiceDesksDefinition,
|
|
107
|
-
jiraCreateServiceDeskRequestDefinition,
|
|
108
|
-
],
|
|
109
|
-
},
|
|
110
|
-
JIRA_ORG_ACTIONS: {
|
|
111
|
-
description: "Action for interacting with Jira tickets",
|
|
112
|
-
actions: [
|
|
113
|
-
jiraOrgAssignJiraTicketDefinition,
|
|
114
|
-
jiraOrgCreateJiraTicketDefinition,
|
|
115
|
-
jiraOrgCommentJiraTicketDefinition,
|
|
116
|
-
jiraOrgGetJiraTicketDetailsDefinition,
|
|
117
|
-
jiraOrgGetJiraTicketHistoryDefinition,
|
|
118
|
-
jiraOrgUpdateJiraTicketDetailsDefinition,
|
|
119
|
-
jiraOrgUpdateJiraTicketStatusDefinition,
|
|
120
|
-
jiraOrgGetJiraIssuesByQueryDefinition,
|
|
121
|
-
],
|
|
122
|
-
},
|
|
123
|
-
OPENSTREETMAP_GET_LATITUDE_LONGITUDE_FROM_LOCATION: {
|
|
124
|
-
description: "Action for getting the latitude and longitude of a location",
|
|
125
|
-
actions: [openstreetmapGetLatitudeLongitudeFromLocationDefinition],
|
|
126
|
-
},
|
|
127
|
-
NWS_GET_FORECAST_FOR_LOCATION: {
|
|
128
|
-
description: "Action for getting the weather forecast for a location",
|
|
129
|
-
actions: [nwsGetForecastForLocationDefinition],
|
|
130
|
-
},
|
|
131
|
-
FIRECRAWL: {
|
|
132
|
-
description: "Actions for interacting with Firecrawl",
|
|
133
|
-
actions: [
|
|
134
|
-
firecrawlScrapeUrlDefinition,
|
|
135
|
-
firecrawlScrapeTweetDataWithNitterDefinition,
|
|
136
|
-
firecrawlDeepResearchDefinition,
|
|
137
|
-
],
|
|
138
|
-
},
|
|
139
|
-
RESEND: {
|
|
140
|
-
description: "Action for sending an email",
|
|
141
|
-
actions: [resendSendEmailDefinition],
|
|
142
|
-
},
|
|
143
|
-
X: {
|
|
144
|
-
description: "Actions for interacting with X(formerly twitter)",
|
|
145
|
-
actions: [xCreateShareXPostUrlDefinition],
|
|
146
|
-
},
|
|
147
|
-
GONG: {
|
|
148
|
-
description: "Actions for interacting with Gong",
|
|
149
|
-
actions: [gongGetGongTranscriptsDefinition],
|
|
150
|
-
},
|
|
151
|
-
FINNHUB: {
|
|
152
|
-
description: "Action for interacting with Finnhub for stock market data",
|
|
153
|
-
actions: [finnhubSymbolLookupDefinition, finnhubGetBasicFinancialsDefinition],
|
|
154
|
-
},
|
|
155
|
-
JAMF: {
|
|
156
|
-
description: "Actions for interacting with Jamf",
|
|
157
|
-
actions: [
|
|
158
|
-
jamfGetJamfComputerInventoryDefinition,
|
|
159
|
-
jamfGetJamfFileVaultRecoveryKeyDefinition,
|
|
160
|
-
jamfGetJamfUserComputerIdDefinition,
|
|
161
|
-
jamfLockJamfComputerByIdDefinition,
|
|
162
|
-
],
|
|
163
|
-
},
|
|
164
|
-
LOOKER: {
|
|
165
|
-
description: "Actions for interacting with Looker",
|
|
166
|
-
actions: [lookerEnableUserByEmailDefinition],
|
|
167
|
-
},
|
|
168
|
-
SALESFORCE: {
|
|
169
|
-
description: "Actions for interacting with Salesforce",
|
|
170
|
-
actions: [
|
|
171
|
-
salesforceUpdateRecordDefinition,
|
|
172
|
-
salesforceCreateRecordDefinition,
|
|
173
|
-
salesforceCreateCaseDefinition,
|
|
174
|
-
salesforceGenerateSalesReportDefinition,
|
|
175
|
-
salesforceGetRecordDefinition,
|
|
176
|
-
salesforceGetSalesforceRecordsByQueryDefinition,
|
|
177
|
-
salesforceFetchSalesforceSchemaByObjectDefinition,
|
|
178
|
-
],
|
|
179
|
-
},
|
|
180
|
-
MICROSOFT: {
|
|
181
|
-
description: "Actions for interacting with Microsoft 365",
|
|
182
|
-
actions: [
|
|
183
|
-
microsoftMessageTeamsChatDefinition,
|
|
184
|
-
microsoftMessageTeamsChannelDefinition,
|
|
185
|
-
microsoftUpdateSpreadsheetDefinition,
|
|
186
|
-
microsoftUpdateDocumentDefinition,
|
|
187
|
-
microsoftCreateDocumentDefinition,
|
|
188
|
-
microsoftGetDocumentDefinition,
|
|
189
|
-
],
|
|
190
|
-
},
|
|
191
|
-
KANDJI: {
|
|
192
|
-
description: "Actions for interacting with Kandji",
|
|
193
|
-
actions: [kandjiGetFVRecoveryKeyForDeviceDefinition],
|
|
194
|
-
},
|
|
195
|
-
GITHUB: {
|
|
196
|
-
description: "Actions for interacting with GitHub",
|
|
197
|
-
actions: [
|
|
198
|
-
githubCreateOrUpdateFileDefinition,
|
|
199
|
-
githubCreateBranchDefinition,
|
|
200
|
-
githubCreatePullRequestDefinition,
|
|
201
|
-
githubListPullRequestsDefinition,
|
|
202
|
-
githubGetFileContentDefinition,
|
|
203
|
-
githubListDirectoryDefinition,
|
|
204
|
-
],
|
|
205
|
-
},
|
|
206
|
-
ASHBY: {
|
|
207
|
-
description: "Actions for interacting with Ashby",
|
|
208
|
-
actions: [
|
|
209
|
-
ashbyCreateNoteDefinition,
|
|
210
|
-
ashbyGetCandidateInfoDefinition,
|
|
211
|
-
ashbyListCandidatesDefinition,
|
|
212
|
-
ashbyListCandidateNotesDefinition,
|
|
213
|
-
ashbySearchCandidatesDefinition,
|
|
214
|
-
ashbyCreateCandidateDefinition,
|
|
215
|
-
ashbyUpdateCandidateDefinition,
|
|
216
|
-
ashbyAddCandidateToProjectDefinition,
|
|
217
|
-
],
|
|
218
|
-
},
|
|
219
|
-
NOTION: {
|
|
220
|
-
description: "Actions for interacting with Notion",
|
|
221
|
-
actions: [notionSearchByTitleDefinition],
|
|
222
|
-
},
|
|
223
|
-
GOOGLE_GROUPS: {
|
|
224
|
-
description: "Google Workspace Groups management actions",
|
|
225
|
-
actions: [
|
|
226
|
-
googleOauthListGroupsDefinition,
|
|
227
|
-
googleOauthGetGroupDefinition,
|
|
228
|
-
googleOauthListGroupMembersDefinition,
|
|
229
|
-
googleOauthHasGroupMemberDefinition,
|
|
230
|
-
googleOauthAddGroupMemberDefinition,
|
|
231
|
-
googleOauthDeleteGroupMemberDefinition,
|
|
232
|
-
],
|
|
233
|
-
},
|
|
234
|
-
OKTA: {
|
|
235
|
-
description: "Actions for interacting with Okta",
|
|
236
|
-
actions: [
|
|
237
|
-
oktaListOktaUsersDefinition,
|
|
238
|
-
oktaGetOktaUserDefinition,
|
|
239
|
-
oktaListOktaUserGroupsDefinition,
|
|
240
|
-
oktaListOktaGroupsDefinition,
|
|
241
|
-
oktaGetOktaGroupDefinition,
|
|
242
|
-
oktaListOktaGroupMembersDefinition,
|
|
243
|
-
oktaRemoveUserFromGroupDefinition,
|
|
244
|
-
oktaAddUserToGroupDefinition,
|
|
245
|
-
oktaResetPasswordDefinition,
|
|
246
|
-
oktaResetMFADefinition,
|
|
247
|
-
oktaListMFADefinition,
|
|
248
|
-
oktaTriggerOktaWorkflowDefinition,
|
|
249
|
-
],
|
|
250
|
-
},
|
|
251
|
-
LINEAR: {
|
|
252
|
-
description: "Actions for interacting with Linear",
|
|
253
|
-
actions: [
|
|
254
|
-
linearGetIssueDetailsDefinition,
|
|
255
|
-
linearGetProjectsDefinition,
|
|
256
|
-
linearGetProjectDetailsDefinition,
|
|
257
|
-
linearGetTeamDetailsDefinition,
|
|
258
|
-
linearGetTeamsDefinition,
|
|
259
|
-
],
|
|
260
|
-
},
|
|
261
|
-
};
|
|
@@ -1,47 +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
|
-
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;
|
|
@@ -1,36 +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 sdk_1 = require("@credal/sdk");
|
|
13
|
-
const callCopilot = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
14
|
-
var _b;
|
|
15
|
-
const requestBody = {
|
|
16
|
-
agentId: params.agentId,
|
|
17
|
-
query: params.query,
|
|
18
|
-
userEmail: params.userEmail,
|
|
19
|
-
};
|
|
20
|
-
const baseUrl = (_b = authParams.baseUrl) !== null && _b !== void 0 ? _b : "https://app.credal.ai/api";
|
|
21
|
-
const client = new sdk_1.CredalClient({ environment: baseUrl, apiKey: authParams.apiKey });
|
|
22
|
-
const response = yield client.copilots.sendMessage({
|
|
23
|
-
agentId: requestBody.agentId,
|
|
24
|
-
message: requestBody.query,
|
|
25
|
-
userEmail: requestBody.userEmail,
|
|
26
|
-
});
|
|
27
|
-
return {
|
|
28
|
-
response: response.sendChatResult.type === "ai_response_result"
|
|
29
|
-
? response.sendChatResult.response.message
|
|
30
|
-
: "Error getting response",
|
|
31
|
-
referencedSources: response.sendChatResult.type === "ai_response_result" ? response.sendChatResult.referencedSources : [],
|
|
32
|
-
sourcesInDataContext: response.sendChatResult.type === "ai_response_result" ? response.sendChatResult.sourcesInDataContext : [],
|
|
33
|
-
webSearchResults: response.sendChatResult.type === "ai_response_result" ? response.sendChatResult.webSearchResults : [],
|
|
34
|
-
};
|
|
35
|
-
});
|
|
36
|
-
exports.default = callCopilot;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * as add from "./add";
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.add = void 0;
|
|
37
|
-
exports.add = __importStar(require("./add"));
|
|
@@ -1,42 +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 { WebClient } from "@slack/web-api";
|
|
11
|
-
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
12
|
-
import { getSlackChannels } from "./helpers.js";
|
|
13
|
-
const archiveChannel = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
14
|
-
if (!authParams.authToken) {
|
|
15
|
-
throw new Error(MISSING_AUTH_TOKEN);
|
|
16
|
-
}
|
|
17
|
-
try {
|
|
18
|
-
const client = new WebClient(authParams.authToken);
|
|
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 });
|
|
27
|
-
if (!result.ok) {
|
|
28
|
-
return {
|
|
29
|
-
success: false,
|
|
30
|
-
error: result.error || "Unknown error archiving channel",
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
return { success: true };
|
|
34
|
-
}
|
|
35
|
-
catch (error) {
|
|
36
|
-
return {
|
|
37
|
-
success: false,
|
|
38
|
-
error: error instanceof Error ? error.message : "Unknown error archiving channel",
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
export default archiveChannel;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * as listConversations from "./listConversations";
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.listConversations = void 0;
|
|
37
|
-
exports.listConversations = __importStar(require("./listConversations"));
|
|
@@ -1,41 +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 web_api_1 = require("@slack/web-api");
|
|
13
|
-
const helpers_1 = require("./helpers");
|
|
14
|
-
const slackListConversations = (_a) => __awaiter(void 0, [_a], void 0, function* ({ authParams, }) {
|
|
15
|
-
const client = new web_api_1.WebClient(authParams.authToken);
|
|
16
|
-
try {
|
|
17
|
-
const allChannels = yield (0, helpers_1.getSlackChannels)(client);
|
|
18
|
-
const filteredChannels = [];
|
|
19
|
-
for (const channel of allChannels) {
|
|
20
|
-
if (channel.name && channel.topic && channel.topic.value && channel.purpose && channel.purpose.value) {
|
|
21
|
-
const purpose = channel.purpose.value;
|
|
22
|
-
const topic = channel.topic.value;
|
|
23
|
-
const name = channel.name;
|
|
24
|
-
filteredChannels.push(Object.assign(Object.assign({}, channel), { purpose, topic, name }));
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
channels: filteredChannels,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
catch (error) {
|
|
32
|
-
if (error instanceof Error) {
|
|
33
|
-
// Enhance error with more context
|
|
34
|
-
throw new Error(`Failed to list Slack conversations: ${error.message}`);
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
throw error;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
exports.default = slackListConversations;
|