@credal/actions 0.1.98 → 0.1.100
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 +73 -9
- package/dist/actions/autogen/templates.d.ts +12 -2
- package/dist/actions/autogen/templates.js +587 -6
- package/dist/actions/autogen/types.d.ts +543 -14
- package/dist/actions/autogen/types.js +171 -7
- package/dist/actions/groups.js +19 -2
- package/dist/actions/providers/confluence/updatePage.js +13 -9
- package/dist/actions/providers/google-oauth/addGroupMember.d.ts +3 -0
- package/dist/actions/providers/google-oauth/addGroupMember.js +37 -0
- package/dist/actions/providers/google-oauth/deleteCalendarEvent.d.ts +3 -0
- package/dist/actions/providers/google-oauth/deleteCalendarEvent.js +35 -0
- package/dist/actions/providers/google-oauth/deleteGroupMember.d.ts +3 -0
- package/dist/actions/providers/google-oauth/deleteGroupMember.js +33 -0
- package/dist/actions/providers/google-oauth/getGroup.d.ts +3 -0
- package/dist/actions/providers/google-oauth/getGroup.js +43 -0
- package/dist/actions/providers/google-oauth/hasGroupMember.d.ts +3 -0
- package/dist/actions/providers/google-oauth/hasGroupMember.js +37 -0
- package/dist/actions/providers/google-oauth/listCalendarEvents.d.ts +3 -0
- package/dist/actions/providers/google-oauth/listCalendarEvents.js +86 -0
- package/dist/actions/providers/google-oauth/listCalendars.d.ts +3 -0
- package/dist/actions/providers/google-oauth/listCalendars.js +63 -0
- package/dist/actions/providers/google-oauth/listGroupMembers.d.ts +3 -0
- package/dist/actions/providers/google-oauth/listGroupMembers.js +54 -0
- package/dist/actions/providers/google-oauth/listGroups.d.ts +3 -0
- package/dist/actions/providers/google-oauth/listGroups.js +56 -0
- package/dist/actions/providers/google-oauth/updateCalendarEvent.d.ts +3 -0
- package/dist/actions/providers/google-oauth/updateCalendarEvent.js +59 -0
- package/dist/actions/providers/googlemail/listGmailThreads.d.ts +3 -0
- package/dist/actions/providers/{google-oauth → googlemail}/listGmailThreads.js +1 -1
- package/dist/actions/providers/googlemail/searchGmailMessages.d.ts +3 -0
- package/dist/actions/providers/{google-oauth → googlemail}/searchGmailMessages.js +1 -1
- package/dist/actions/providers/slack/listConversations.d.ts +1 -1
- package/package.json +1 -1
- package/dist/actions/autogen/definitions.d.ts +0 -5
- package/dist/actions/autogen/definitions.js +0 -132
- package/dist/actions/definitions.js +0 -35
- package/dist/actions/invokeMapper.d.ts +0 -9
- package/dist/actions/invokeMapper.js +0 -33
- package/dist/actions/providers/google-oauth/listGmailThreads.d.ts +0 -3
- package/dist/actions/providers/google-oauth/searchGmailMessages.d.ts +0 -3
- package/dist/actions/providers/googlemaps/nearbysearch.d.ts +0 -3
- package/dist/actions/providers/googlemaps/nearbysearch.js +0 -96
- package/dist/actions/providers/jira/createTicket.d.ts +0 -3
- package/dist/actions/providers/jira/createTicket.js +0 -34
- package/dist/actions/providers/salesforce/getSalesforceRecordByQuery.d.ts +0 -3
- package/dist/actions/providers/salesforce/getSalesforceRecordByQuery.js +0 -43
- package/dist/actions/providers/slack/list_conversations.d.ts +0 -3
- package/dist/actions/providers/slack/list_conversations.js +0 -60
- package/dist/actions/providers/slack/summarizeChannel.d.ts +0 -3
- package/dist/actions/providers/slack/summarizeChannel.js +0 -51
- package/dist/actions/schema.js +0 -6
- package/dist/actions/types.js +0 -2
- package/dist/main.js +0 -11
@@ -1,34 +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
|
-
const createTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
17
|
-
const { authToken, baseUrl } = authParams;
|
18
|
-
const url = `${baseUrl}/rest/api/3/issue`;
|
19
|
-
const payload = {
|
20
|
-
fields: Object.assign({ project: {
|
21
|
-
key: params.projectKey,
|
22
|
-
}, summary: params.summary, description: params.description, issuetype: {
|
23
|
-
name: params.issueType,
|
24
|
-
} }, (params.reporter ? { reporter: { id: params.reporter } } : {})),
|
25
|
-
};
|
26
|
-
const response = yield axios_1.default.post(url, payload, {
|
27
|
-
headers: {
|
28
|
-
Authorization: `Basic ${Buffer.from(`${params.username}:${authToken}`).toString("base64")}`,
|
29
|
-
"Content-Type": "application/json",
|
30
|
-
},
|
31
|
-
});
|
32
|
-
return response.data;
|
33
|
-
});
|
34
|
-
exports.default = createTicket;
|
@@ -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;
|
@@ -1,60 +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 slackListConversations = (_a) => __awaiter(void 0, [_a], void 0, function* ({ authParams, }) {
|
14
|
-
var _b;
|
15
|
-
const client = new web_api_1.WebClient(authParams.authToken);
|
16
|
-
const allChannels = [];
|
17
|
-
let cursor;
|
18
|
-
const limit = 100;
|
19
|
-
try {
|
20
|
-
do {
|
21
|
-
const response = yield client.conversations.list({
|
22
|
-
exclude_archived: true,
|
23
|
-
limit: limit,
|
24
|
-
cursor: cursor,
|
25
|
-
});
|
26
|
-
if (!response.ok) {
|
27
|
-
throw new Error(`Slack API error: ${response.error}`);
|
28
|
-
}
|
29
|
-
// Add channels from this page to our results
|
30
|
-
if (response.channels && Array.isArray(response.channels)) {
|
31
|
-
allChannels.push(...response.channels);
|
32
|
-
}
|
33
|
-
// Get cursor for next page
|
34
|
-
cursor = (_b = response.response_metadata) === null || _b === void 0 ? void 0 : _b.next_cursor;
|
35
|
-
// If user specified a limit and we've hit it, stop paginating
|
36
|
-
if (limit && allChannels.length >= limit) {
|
37
|
-
allChannels.splice(limit); // Trim to exact limit
|
38
|
-
break;
|
39
|
-
}
|
40
|
-
} while (cursor && cursor.length > 0);
|
41
|
-
return {
|
42
|
-
channels: allChannels.map(channel => ({
|
43
|
-
id: channel.id,
|
44
|
-
name: channel.name,
|
45
|
-
topic: channel.topic.value,
|
46
|
-
purpose: channel.purpose.value,
|
47
|
-
})),
|
48
|
-
};
|
49
|
-
}
|
50
|
-
catch (error) {
|
51
|
-
if (error instanceof Error) {
|
52
|
-
// Enhance error with more context
|
53
|
-
throw new Error(`Failed to list Slack conversations: ${error.message}`);
|
54
|
-
}
|
55
|
-
else {
|
56
|
-
throw error;
|
57
|
-
}
|
58
|
-
}
|
59
|
-
});
|
60
|
-
exports.default = slackListConversations;
|
@@ -1,51 +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 web_api_1 = require("@slack/web-api");
|
16
|
-
const helpers_1 = require("./helpers");
|
17
|
-
const openai_1 = __importDefault(require("openai"));
|
18
|
-
const summarizeChannel = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
19
|
-
var _b;
|
20
|
-
const client = new web_api_1.WebClient(authParams.authToken);
|
21
|
-
const { channelName } = params;
|
22
|
-
const allChannels = yield (0, helpers_1.getSlackChannels)(client);
|
23
|
-
const channel = allChannels.find(channel => channel.name === channelName && channel.is_private === false);
|
24
|
-
if (!channel || !channel.id) {
|
25
|
-
throw Error(`Channel with name ${channelName} not found`);
|
26
|
-
}
|
27
|
-
// summarize last 50 messages
|
28
|
-
const messages = yield client.conversations.history({
|
29
|
-
channel: channel.id,
|
30
|
-
limit: 50,
|
31
|
-
});
|
32
|
-
if (!messages.ok) {
|
33
|
-
throw Error(`Failed to fetch messages from channel ${channel.name}`);
|
34
|
-
}
|
35
|
-
const history = ((_b = messages.messages) === null || _b === void 0 ? void 0 : _b.reverse().map(message => message.user + ":" + message.text).join("\n")) || "";
|
36
|
-
const oai = new openai_1.default();
|
37
|
-
const completion = yield oai.chat.completions.create({
|
38
|
-
model: "gpt-4o-mini",
|
39
|
-
messages: [
|
40
|
-
{
|
41
|
-
role: "user",
|
42
|
-
content: "Summarize the following messages in the Slack channel:\n" + history,
|
43
|
-
},
|
44
|
-
],
|
45
|
-
});
|
46
|
-
const summary = completion.choices[0].message.content || "";
|
47
|
-
return {
|
48
|
-
summary: summary,
|
49
|
-
};
|
50
|
-
});
|
51
|
-
exports.default = summarizeChannel;
|
package/dist/actions/schema.js
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.createParametersObject = createParametersObject;
|
4
|
-
function createParametersObject(parameters) {
|
5
|
-
return Object.fromEntries(Object.entries(parameters).map(([key, param]) => [key, param.type]));
|
6
|
-
}
|
package/dist/actions/types.js
DELETED
package/dist/main.js
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
const list_conversations_1 = __importDefault(require("./actions/providers/slack/list_conversations"));
|
7
|
-
const result = (0, list_conversations_1.default)({
|
8
|
-
accessToken: "xoxp-4172665288294-8092684180551-8154529379075-89f1f70cc06e5648e8f912ba96f56626"
|
9
|
-
}).then((result) => {
|
10
|
-
console.log(result);
|
11
|
-
});
|