@credal/actions 0.2.94 → 0.2.96
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 +3 -44
- package/dist/actions/providers/salesforce/getSalesforceRecordsByQuery.js +17 -15
- package/dist/actions/providers/slack/archiveChannel.js +2 -9
- package/package.json +1 -1
- package/dist/actions/providers/confluence/updatePage.d.ts +0 -3
- package/dist/actions/providers/confluence/updatePage.js +0 -47
- package/dist/actions/providers/credal/callCopilot.d.ts +0 -3
- package/dist/actions/providers/credal/callCopilot.js +0 -36
- package/dist/actions/providers/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/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
package/dist/actions/groups.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { genericFillTemplateDefinition, confluenceOverwritePageDefinition, googlemapsValidateAddressDefinition, mathAddDefinition, mongoInsertMongoDocDefinition, slackSendMessageDefinition, slackGetChannelMessagesDefinition,
|
|
1
|
+
import { genericFillTemplateDefinition, confluenceOverwritePageDefinition, googlemapsValidateAddressDefinition, mathAddDefinition, mongoInsertMongoDocDefinition, slackSendMessageDefinition, slackGetChannelMessagesDefinition, snowflakeGetRowByFieldValueDefinition, zendeskCreateZendeskTicketDefinition, zendeskListZendeskTicketsDefinition, zendeskGetTicketDetailsDefinition, zendeskUpdateTicketStatusDefinition, zendeskAddCommentToTicketDefinition, zendeskAssignTicketDefinition, openstreetmapGetLatitudeLongitudeFromLocationDefinition, nwsGetForecastForLocationDefinition, jiraAssignJiraTicketDefinition, jiraCommentJiraTicketDefinition, jiraCreateJiraTicketDefinition, jiraGetJiraTicketDetailsDefinition, jiraGetJiraTicketHistoryDefinition, jiraUpdateJiraTicketDetailsDefinition, jiraUpdateJiraTicketStatusDefinition, 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, } from "./autogen/templates.js";
|
|
2
2
|
export const ACTION_GROUPS = {
|
|
3
3
|
GENERIC: {
|
|
4
4
|
description: "Generic utility actions",
|
|
@@ -17,12 +17,7 @@ export const ACTION_GROUPS = {
|
|
|
17
17
|
},
|
|
18
18
|
SLACK_LIST_CONVERSATIONS: {
|
|
19
19
|
description: "Actions for interacting with Slack",
|
|
20
|
-
actions: [
|
|
21
|
-
slackSendMessageDefinition,
|
|
22
|
-
slackGetChannelMessagesDefinition,
|
|
23
|
-
slackCreateChannelDefinition,
|
|
24
|
-
slackArchiveChannelDefinition,
|
|
25
|
-
],
|
|
20
|
+
actions: [slackSendMessageDefinition, slackGetChannelMessagesDefinition],
|
|
26
21
|
},
|
|
27
22
|
CONFLUENCE: {
|
|
28
23
|
description: "Action for interacting with Confluence",
|
|
@@ -46,9 +41,6 @@ export const ACTION_GROUPS = {
|
|
|
46
41
|
googleOauthCreatePresentationDefinition,
|
|
47
42
|
googleOauthUpdatePresentationDefinition,
|
|
48
43
|
googleOauthSearchDriveByKeywordsDefinition,
|
|
49
|
-
googleOauthSearchDriveByQueryDefinition,
|
|
50
|
-
googleOauthSearchDriveByQueryAndGetFileContentDefinition,
|
|
51
|
-
googleOauthGetDriveFileContentByIdDefinition,
|
|
52
44
|
],
|
|
53
45
|
},
|
|
54
46
|
GOOGLE_CALENDAR: {
|
|
@@ -103,21 +95,6 @@ export const ACTION_GROUPS = {
|
|
|
103
95
|
jiraUpdateJiraTicketDetailsDefinition,
|
|
104
96
|
jiraUpdateJiraTicketStatusDefinition,
|
|
105
97
|
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
98
|
],
|
|
122
99
|
},
|
|
123
100
|
OPENSTREETMAP_GET_LATITUDE_LONGITUDE_FROM_LOCATION: {
|
|
@@ -154,12 +131,7 @@ export const ACTION_GROUPS = {
|
|
|
154
131
|
},
|
|
155
132
|
JAMF: {
|
|
156
133
|
description: "Actions for interacting with Jamf",
|
|
157
|
-
actions: [
|
|
158
|
-
jamfGetJamfComputerInventoryDefinition,
|
|
159
|
-
jamfGetJamfFileVaultRecoveryKeyDefinition,
|
|
160
|
-
jamfGetJamfUserComputerIdDefinition,
|
|
161
|
-
jamfLockJamfComputerByIdDefinition,
|
|
162
|
-
],
|
|
134
|
+
actions: [jamfGetJamfComputerInventoryDefinition, jamfGetJamfFileVaultRecoveryKeyDefinition],
|
|
163
135
|
},
|
|
164
136
|
LOOKER: {
|
|
165
137
|
description: "Actions for interacting with Looker",
|
|
@@ -199,8 +171,6 @@ export const ACTION_GROUPS = {
|
|
|
199
171
|
githubCreateBranchDefinition,
|
|
200
172
|
githubCreatePullRequestDefinition,
|
|
201
173
|
githubListPullRequestsDefinition,
|
|
202
|
-
githubGetFileContentDefinition,
|
|
203
|
-
githubListDirectoryDefinition,
|
|
204
174
|
],
|
|
205
175
|
},
|
|
206
176
|
ASHBY: {
|
|
@@ -245,17 +215,6 @@ export const ACTION_GROUPS = {
|
|
|
245
215
|
oktaResetPasswordDefinition,
|
|
246
216
|
oktaResetMFADefinition,
|
|
247
217
|
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
218
|
],
|
|
260
219
|
},
|
|
261
220
|
};
|
|
@@ -10,32 +10,34 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { ApiError, axiosClient } from "../../util/axiosClient.js";
|
|
11
11
|
const MAX_RECORDS_LIMIT = 2000;
|
|
12
12
|
const getSalesforceRecordsByQuery = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
13
|
-
var _b;
|
|
13
|
+
var _b, _c;
|
|
14
14
|
const { authToken, baseUrl } = authParams;
|
|
15
15
|
const { query, limit } = params;
|
|
16
16
|
if (!authToken || !baseUrl) {
|
|
17
|
-
return {
|
|
18
|
-
success: false,
|
|
19
|
-
error: "authToken and baseUrl are required for Salesforce API",
|
|
20
|
-
};
|
|
17
|
+
return { success: false, error: "authToken and baseUrl are required for Salesforce API" };
|
|
21
18
|
}
|
|
22
19
|
// Included a prepended space and an opening bracket to make sure these terms don't get confused
|
|
23
20
|
// with parts of other words.
|
|
24
21
|
const aggregateFunction = [" COUNT(", " SUM(", " AVG(", " MIN(", " MAX("];
|
|
25
22
|
const containsAggregateFunction = aggregateFunction.some(func => query.toUpperCase().includes(func));
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
let finalQuery = query;
|
|
24
|
+
if (!containsAggregateFunction) {
|
|
25
|
+
// Strip out existing LIMIT clause if it exists
|
|
26
|
+
const limitRegex = /\bLIMIT\s+(\d+)\b/i;
|
|
27
|
+
const existingLimitMatch = query.match(limitRegex);
|
|
28
|
+
const queryLimit = existingLimitMatch ? parseInt(existingLimitMatch[1], 10) : null;
|
|
29
|
+
const queryWithoutLimit = query.replace(limitRegex, "").trim();
|
|
30
|
+
// Recompute final limit
|
|
31
|
+
const finalLimit = Math.min((_b = limit !== null && limit !== void 0 ? limit : queryLimit) !== null && _b !== void 0 ? _b : MAX_RECORDS_LIMIT, MAX_RECORDS_LIMIT);
|
|
32
|
+
// Add limit back to final query
|
|
33
|
+
finalQuery = queryWithoutLimit + " LIMIT " + finalLimit;
|
|
34
|
+
}
|
|
35
|
+
const url = `${baseUrl}/services/data/v56.0/queryAll?q=${encodeURIComponent(finalQuery)}`;
|
|
30
36
|
try {
|
|
31
|
-
const response = yield axiosClient.get(url, {
|
|
32
|
-
headers: {
|
|
33
|
-
Authorization: `Bearer ${authToken}`,
|
|
34
|
-
},
|
|
35
|
-
});
|
|
37
|
+
const response = yield axiosClient.get(url, { headers: { Authorization: `Bearer ${authToken}` } });
|
|
36
38
|
// Salesforce record types are confusing and non standard
|
|
37
39
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
38
|
-
const recordsWithUrl = (
|
|
40
|
+
const recordsWithUrl = (_c = response.data.records) === null || _c === void 0 ? void 0 : _c.map((record) => {
|
|
39
41
|
const recordId = record.Id;
|
|
40
42
|
const webUrl = recordId ? `${baseUrl}/lightning/r/${recordId}/view` : undefined;
|
|
41
43
|
return Object.assign(Object.assign({}, record), { webUrl });
|
|
@@ -9,21 +9,14 @@ 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";
|
|
13
12
|
const archiveChannel = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
14
13
|
if (!authParams.authToken) {
|
|
15
14
|
throw new Error(MISSING_AUTH_TOKEN);
|
|
16
15
|
}
|
|
17
16
|
try {
|
|
18
17
|
const client = new WebClient(authParams.authToken);
|
|
19
|
-
const {
|
|
20
|
-
const
|
|
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 });
|
|
18
|
+
const { channelId } = params;
|
|
19
|
+
const result = yield client.conversations.archive({ channel: channelId });
|
|
27
20
|
if (!result.ok) {
|
|
28
21
|
return {
|
|
29
22
|
success: false,
|
package/package.json
CHANGED
|
@@ -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 +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;
|