@credal/actions 0.2.157 → 0.2.159
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/actionMapper.js +2 -1
- package/dist/actions/autogen/templates.js +144 -18
- package/dist/actions/autogen/types.d.ts +387 -63
- package/dist/actions/autogen/types.js +81 -9
- package/dist/actions/groups.js +3 -44
- package/dist/actions/providers/github/searchOrganization.js +7 -7
- package/dist/actions/providers/github/searchRepository.js +7 -7
- package/dist/actions/providers/jira/getJiraDCIssuesByQuery.d.ts +8 -0
- package/dist/actions/providers/jira/getJiraDCIssuesByQuery.js +139 -0
- package/dist/actions/providers/jira/getJiraIssuesByQuery.js +78 -78
- package/dist/actions/providers/jira/utils.d.ts +19 -0
- package/dist/actions/providers/jira/utils.js +51 -0
- package/dist/actions/providers/slack/archiveChannel.js +2 -9
- package/package.json +2 -1
- package/dist/actions/providers/confluence/updatePage.d.ts +0 -3
- package/dist/actions/providers/confluence/updatePage.js +0 -47
- package/dist/actions/providers/credal/callCopilot.d.ts +0 -3
- package/dist/actions/providers/credal/callCopilot.js +0 -36
- package/dist/actions/providers/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
|
@@ -7,36 +7,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
11
|
-
import { getJiraApiConfig, getErrorMessage } from "./utils.js";
|
|
10
|
+
import { Version3Client } from "jira.js";
|
|
11
|
+
import { getJiraApiConfig, getErrorMessage, extractPlainText, getUserInfoFromAccountId } from "./utils.js";
|
|
12
12
|
const DEFAULT_LIMIT = 100;
|
|
13
|
-
function extractPlainText(adf) {
|
|
14
|
-
if (!adf || adf.type !== "doc" || !Array.isArray(adf.content))
|
|
15
|
-
return "";
|
|
16
|
-
return adf.content
|
|
17
|
-
.map(block => {
|
|
18
|
-
if (block.type === "paragraph" && Array.isArray(block.content)) {
|
|
19
|
-
return block.content.map(inline => { var _a; return (_a = inline.text) !== null && _a !== void 0 ? _a : ""; }).join("");
|
|
20
|
-
}
|
|
21
|
-
return "";
|
|
22
|
-
})
|
|
23
|
-
.join("\n")
|
|
24
|
-
.trim();
|
|
25
|
-
}
|
|
26
13
|
const getJiraIssuesByQuery = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
27
|
-
const { authToken } = authParams;
|
|
14
|
+
const { authToken, cloudId } = authParams;
|
|
28
15
|
const { query, limit } = params;
|
|
29
|
-
const {
|
|
30
|
-
if (!authToken)
|
|
16
|
+
const { browseUrl } = getJiraApiConfig(authParams);
|
|
17
|
+
if (!authToken)
|
|
31
18
|
throw new Error("Auth token is required");
|
|
32
|
-
|
|
19
|
+
if (!browseUrl)
|
|
20
|
+
throw new Error("Browse URL is required");
|
|
21
|
+
if (!cloudId)
|
|
22
|
+
throw new Error("Cloud ID is required for Jira Cloud");
|
|
33
23
|
const fields = [
|
|
34
|
-
"key",
|
|
35
|
-
"id",
|
|
36
|
-
"project",
|
|
37
|
-
"issuetype",
|
|
38
24
|
"summary",
|
|
39
25
|
"description",
|
|
26
|
+
"project",
|
|
27
|
+
"issuetype",
|
|
40
28
|
"status",
|
|
41
29
|
"assignee",
|
|
42
30
|
"reporter",
|
|
@@ -49,74 +37,86 @@ const getJiraIssuesByQuery = (_a) => __awaiter(void 0, [_a], void 0, function* (
|
|
|
49
37
|
"timespent",
|
|
50
38
|
"aggregatetimeoriginalestimate",
|
|
51
39
|
];
|
|
52
|
-
const searchEndpoint = strategy.getSearchEndpoint();
|
|
53
40
|
const requestedLimit = limit !== null && limit !== void 0 ? limit : DEFAULT_LIMIT;
|
|
54
41
|
const allIssues = [];
|
|
55
|
-
let
|
|
42
|
+
let nextPageToken = undefined;
|
|
56
43
|
try {
|
|
44
|
+
// Initialize jira.js client with OAuth 2.0 authentication
|
|
45
|
+
const client = new Version3Client({
|
|
46
|
+
host: `https://api.atlassian.com/ex/jira/${cloudId}`,
|
|
47
|
+
authentication: {
|
|
48
|
+
oauth2: {
|
|
49
|
+
accessToken: authToken,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
});
|
|
57
53
|
// Keep fetching pages until we have all requested issues
|
|
58
54
|
while (allIssues.length < requestedLimit) {
|
|
59
55
|
// Calculate how many results to fetch in this request
|
|
60
56
|
const remainingIssues = requestedLimit - allIssues.length;
|
|
61
57
|
const maxResults = Math.min(remainingIssues, DEFAULT_LIMIT);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const response = yield axiosClient.get(fullApiUrl, {
|
|
69
|
-
headers: {
|
|
70
|
-
Authorization: `Bearer ${authToken}`,
|
|
71
|
-
Accept: "application/json",
|
|
72
|
-
},
|
|
58
|
+
// Use the enhanced search endpoint (recommended)
|
|
59
|
+
const searchResults = yield client.issueSearch.searchForIssuesUsingJqlEnhancedSearch({
|
|
60
|
+
jql: query,
|
|
61
|
+
nextPageToken,
|
|
62
|
+
maxResults,
|
|
63
|
+
fields,
|
|
73
64
|
});
|
|
74
|
-
|
|
75
|
-
allIssues.push(...issues);
|
|
76
|
-
if (allIssues.length >= total || issues.length === 0) {
|
|
65
|
+
if (!searchResults.issues || searchResults.issues.length === 0) {
|
|
77
66
|
break;
|
|
78
67
|
}
|
|
79
|
-
|
|
68
|
+
allIssues.push(...searchResults.issues);
|
|
69
|
+
// Check if we've reached the end or have enough results
|
|
70
|
+
if (allIssues.length >= requestedLimit || !searchResults.nextPageToken || searchResults.issues.length === 0) {
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
nextPageToken = searchResults.nextPageToken;
|
|
80
74
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
id: status.id,
|
|
105
|
-
name: status.name,
|
|
106
|
-
category: status.statusCategory.name,
|
|
107
|
-
},
|
|
108
|
-
assignee: (assignee === null || assignee === void 0 ? void 0 : assignee.emailAddress) || null,
|
|
109
|
-
reporter: (reporter === null || reporter === void 0 ? void 0 : reporter.emailAddress) || null,
|
|
110
|
-
creator: (creator === null || creator === void 0 ? void 0 : creator.emailAddress) || null,
|
|
111
|
-
created,
|
|
112
|
-
updated,
|
|
113
|
-
resolution: (resolution === null || resolution === void 0 ? void 0 : resolution.name) || null,
|
|
114
|
-
dueDate: duedate || null,
|
|
115
|
-
url: ticketUrl,
|
|
75
|
+
// Map issues with email addresses
|
|
76
|
+
const results = yield Promise.all(allIssues.map((_a) => __awaiter(void 0, [_a], void 0, function* ({ id, key, fields }) {
|
|
77
|
+
var _b;
|
|
78
|
+
const ticketUrl = `${browseUrl}/browse/${key}`;
|
|
79
|
+
const { summary, description, project, issuetype, status, assignee, reporter, creator, created, updated, resolution, duedate, } = fields;
|
|
80
|
+
// Fetch user info in parallel
|
|
81
|
+
const [assigneeInfo, reporterInfo, creatorInfo] = yield Promise.all([
|
|
82
|
+
getUserInfoFromAccountId(assignee === null || assignee === void 0 ? void 0 : assignee.accountId, client),
|
|
83
|
+
getUserInfoFromAccountId(reporter === null || reporter === void 0 ? void 0 : reporter.accountId, client),
|
|
84
|
+
getUserInfoFromAccountId(creator === null || creator === void 0 ? void 0 : creator.accountId, client),
|
|
85
|
+
]);
|
|
86
|
+
return {
|
|
87
|
+
name: key,
|
|
88
|
+
url: ticketUrl,
|
|
89
|
+
contents: {
|
|
90
|
+
id,
|
|
91
|
+
key,
|
|
92
|
+
summary,
|
|
93
|
+
description: extractPlainText(description),
|
|
94
|
+
project: {
|
|
95
|
+
id: project === null || project === void 0 ? void 0 : project.id,
|
|
96
|
+
key: project === null || project === void 0 ? void 0 : project.key,
|
|
97
|
+
name: project === null || project === void 0 ? void 0 : project.name,
|
|
116
98
|
},
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
99
|
+
issueType: {
|
|
100
|
+
id: issuetype === null || issuetype === void 0 ? void 0 : issuetype.id,
|
|
101
|
+
name: issuetype === null || issuetype === void 0 ? void 0 : issuetype.name,
|
|
102
|
+
},
|
|
103
|
+
status: {
|
|
104
|
+
id: status === null || status === void 0 ? void 0 : status.id,
|
|
105
|
+
name: status === null || status === void 0 ? void 0 : status.name,
|
|
106
|
+
category: (_b = status === null || status === void 0 ? void 0 : status.statusCategory) === null || _b === void 0 ? void 0 : _b.name,
|
|
107
|
+
},
|
|
108
|
+
assignee: assigneeInfo,
|
|
109
|
+
reporter: reporterInfo,
|
|
110
|
+
creator: creatorInfo,
|
|
111
|
+
created: created,
|
|
112
|
+
updated: updated,
|
|
113
|
+
resolution: resolution === null || resolution === void 0 ? void 0 : resolution.name,
|
|
114
|
+
dueDate: duedate,
|
|
115
|
+
url: ticketUrl,
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
})));
|
|
119
|
+
return { results };
|
|
120
120
|
}
|
|
121
121
|
catch (error) {
|
|
122
122
|
console.error("Error retrieving Jira issues:", error);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Version3Client } from "jira.js";
|
|
1
2
|
export interface JiraApiConfig {
|
|
2
3
|
apiUrl: string;
|
|
3
4
|
browseUrl: string;
|
|
@@ -9,6 +10,17 @@ export interface JiraServiceDeskApiConfig {
|
|
|
9
10
|
browseUrl: string;
|
|
10
11
|
isDataCenter: boolean;
|
|
11
12
|
}
|
|
13
|
+
export type JiraADFDoc = {
|
|
14
|
+
type: "doc";
|
|
15
|
+
version: number;
|
|
16
|
+
content: Array<{
|
|
17
|
+
type: string;
|
|
18
|
+
content?: Array<{
|
|
19
|
+
type: string;
|
|
20
|
+
text?: string;
|
|
21
|
+
}>;
|
|
22
|
+
}>;
|
|
23
|
+
};
|
|
12
24
|
interface JiraHistoryResponse {
|
|
13
25
|
data?: {
|
|
14
26
|
values?: unknown[];
|
|
@@ -52,4 +64,11 @@ export declare function getRequestTypeCustomFieldId(projectKey: string, apiUrl:
|
|
|
52
64
|
fieldId: string | null;
|
|
53
65
|
message?: string;
|
|
54
66
|
}>;
|
|
67
|
+
export declare function getUserEmailFromAccountId(accountId: string | undefined, client: Version3Client): Promise<string | undefined>;
|
|
68
|
+
export declare function getUserInfoFromAccountId(accountId: string | undefined, client: Version3Client): Promise<{
|
|
69
|
+
id: string;
|
|
70
|
+
name: string | undefined;
|
|
71
|
+
email: string | undefined;
|
|
72
|
+
} | null>;
|
|
73
|
+
export declare function extractPlainText(adf: unknown): string;
|
|
55
74
|
export {};
|
|
@@ -189,3 +189,54 @@ export function getRequestTypeCustomFieldId(projectKey, apiUrl, authToken) {
|
|
|
189
189
|
}
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
|
+
export function getUserEmailFromAccountId(accountId, client) {
|
|
193
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
194
|
+
if (!accountId)
|
|
195
|
+
return undefined;
|
|
196
|
+
try {
|
|
197
|
+
const userEmail = yield client.users.getUser({ accountId });
|
|
198
|
+
console.log("USER EMAIL: ", userEmail);
|
|
199
|
+
return userEmail.emailAddress;
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
const axiosError = error;
|
|
203
|
+
console.error("Error fetching user email:", axiosError.message);
|
|
204
|
+
return undefined;
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
export function getUserInfoFromAccountId(accountId, client) {
|
|
209
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
210
|
+
if (!accountId)
|
|
211
|
+
return null;
|
|
212
|
+
try {
|
|
213
|
+
const user = yield client.users.getUser({ accountId });
|
|
214
|
+
return {
|
|
215
|
+
id: user.accountId,
|
|
216
|
+
name: user === null || user === void 0 ? void 0 : user.displayName,
|
|
217
|
+
email: user === null || user === void 0 ? void 0 : user.emailAddress,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
catch (error) {
|
|
221
|
+
const axiosError = error;
|
|
222
|
+
console.error("Error fetching user info:", axiosError.message);
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
export function extractPlainText(adf) {
|
|
228
|
+
if (!adf || typeof adf !== "object")
|
|
229
|
+
return "";
|
|
230
|
+
const doc = adf;
|
|
231
|
+
if (doc.type !== "doc" || !Array.isArray(doc.content))
|
|
232
|
+
return "";
|
|
233
|
+
return doc.content
|
|
234
|
+
.map((block) => {
|
|
235
|
+
if (block.type === "paragraph" && Array.isArray(block.content)) {
|
|
236
|
+
return block.content.map((inline) => { var _a; return (_a = inline.text) !== null && _a !== void 0 ? _a : ""; }).join("");
|
|
237
|
+
}
|
|
238
|
+
return "";
|
|
239
|
+
})
|
|
240
|
+
.join("\n")
|
|
241
|
+
.trim();
|
|
242
|
+
}
|
|
@@ -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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@credal/actions",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.159",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "AI Actions by Credal AI",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
"docx": "^9.3.0",
|
|
62
62
|
"dotenv": "^16.4.7",
|
|
63
63
|
"html-to-text": "^9.0.5",
|
|
64
|
+
"jira.js": "^5.2.2",
|
|
64
65
|
"json-schema-to-zod": "^2.5.0",
|
|
65
66
|
"jsonwebtoken": "^9.0.2",
|
|
66
67
|
"limiter": "^3.0.0",
|
|
@@ -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;
|