@credal/actions 0.1.18 → 0.1.20
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/README.md +4 -1
- package/dist/actions/autogen/templates.js +81 -0
- package/dist/actions/autogen/types.d.ts +104 -0
- package/dist/actions/autogen/types.js +38 -0
- package/dist/actions/parse.js +1 -0
- package/dist/actions/providers/confluence/updatePage.js +9 -13
- package/dist/actions/providers/credal/callCopilot.js +2 -0
- package/dist/actions/providers/finnhub/getBasicFinancials.js +2 -5
- package/dist/actions/providers/finnhub/symbolLookup.js +2 -5
- package/dist/actions/providers/google-oauth/createNewGoogleDoc.js +32 -44
- package/dist/actions/providers/googlemaps/nearbysearch.js +31 -31
- package/dist/actions/providers/googlemaps/nearbysearchRestaurants.js +2 -5
- package/dist/actions/providers/googlemaps/validateAddress.js +2 -5
- package/dist/actions/providers/jira/createJiraTicket.js +35 -47
- package/dist/actions/providers/nws/getForecastForLocation.js +3 -6
- package/dist/actions/providers/openstreetmap/getLatitudeLongitudeFromLocation.js +2 -5
- package/dist/actions/providers/x/createXSharePostUrl.js +4 -1
- package/dist/actions/providers/x/scrapeTweetDataWithNitter.d.ts +3 -0
- package/dist/actions/providers/x/scrapeTweetDataWithNitter.js +45 -0
- package/dist/actions/providers/zendesk/createZendeskTicket.js +2 -5
- package/dist/actions/util/axiosClient.d.ts +7 -0
- package/dist/actions/util/axiosClient.js +46 -0
- 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/jira/createTicket.d.ts +0 -3
- package/dist/actions/providers/jira/createTicket.js +0 -34
- package/dist/actions/providers/slack/list_conversations.d.ts +0 -3
- package/dist/actions/providers/slack/list_conversations.js +0 -60
- package/dist/actions/schema.js +0 -6
- package/dist/actions/types.js +0 -2
- package/dist/main.js +0 -11
@@ -8,18 +8,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
9
|
});
|
10
10
|
};
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
-
};
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
-
const
|
16
|
-
function getUserAccountId(email,
|
12
|
+
const axiosClient_1 = require("../../util/axiosClient");
|
13
|
+
function getUserAccountId(email, apiUrl, authToken) {
|
17
14
|
return __awaiter(this, void 0, void 0, function* () {
|
18
15
|
try {
|
19
|
-
const response = yield
|
16
|
+
const response = yield axiosClient_1.axiosClient.get(`${apiUrl}/user/search?query=${encodeURIComponent(email)}`, {
|
20
17
|
headers: {
|
21
|
-
Authorization: `
|
22
|
-
|
18
|
+
Authorization: `Bearer ${authToken}`,
|
19
|
+
Accept: "application/json",
|
23
20
|
},
|
24
21
|
});
|
25
22
|
if (response.data && response.data.length > 0) {
|
@@ -28,6 +25,7 @@ function getUserAccountId(email, baseUrl, authToken, username) {
|
|
28
25
|
return null;
|
29
26
|
}
|
30
27
|
catch (error) {
|
28
|
+
// Try to complete request without assignee/reporter.
|
31
29
|
const axiosError = error;
|
32
30
|
console.error("Error finding user:", axiosError.message);
|
33
31
|
return null;
|
@@ -35,59 +33,49 @@ function getUserAccountId(email, baseUrl, authToken, username) {
|
|
35
33
|
});
|
36
34
|
}
|
37
35
|
const createJiraTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
38
|
-
const { authToken,
|
39
|
-
const
|
36
|
+
const { authToken, cloudId, baseUrl } = authParams;
|
37
|
+
const apiUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/`;
|
38
|
+
if (!cloudId) {
|
39
|
+
throw new Error("Cloud ID is required to create a Jira ticket");
|
40
|
+
}
|
40
41
|
// If assignee is an email, look up the account ID
|
41
42
|
let reporterId = null;
|
42
|
-
if (params.reporter &&
|
43
|
-
|
44
|
-
params.reporter.includes("@") &&
|
45
|
-
baseUrl &&
|
46
|
-
authToken &&
|
47
|
-
username) {
|
48
|
-
reporterId = yield getUserAccountId(params.reporter, baseUrl, authToken, username);
|
43
|
+
if (params.reporter && typeof params.reporter === "string" && params.reporter.includes("@") && authToken) {
|
44
|
+
reporterId = yield getUserAccountId(params.reporter, apiUrl, authToken);
|
49
45
|
}
|
50
46
|
// If assignee is an email, look up the account ID
|
51
47
|
let assigneeId = null;
|
52
|
-
if (params.assignee &&
|
53
|
-
|
54
|
-
params.assignee.includes("@") &&
|
55
|
-
baseUrl &&
|
56
|
-
authToken &&
|
57
|
-
username) {
|
58
|
-
assigneeId = yield getUserAccountId(params.assignee, baseUrl, authToken, username);
|
48
|
+
if (params.assignee && typeof params.assignee === "string" && params.assignee.includes("@") && authToken) {
|
49
|
+
assigneeId = yield getUserAccountId(params.assignee, apiUrl, authToken);
|
59
50
|
}
|
60
|
-
const description =
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
}
|
76
|
-
: params.description;
|
51
|
+
const description = {
|
52
|
+
type: "doc",
|
53
|
+
version: 1,
|
54
|
+
content: [
|
55
|
+
{
|
56
|
+
type: "paragraph",
|
57
|
+
content: [
|
58
|
+
{
|
59
|
+
type: "text",
|
60
|
+
text: params.description,
|
61
|
+
},
|
62
|
+
],
|
63
|
+
},
|
64
|
+
],
|
65
|
+
};
|
77
66
|
const payload = {
|
78
|
-
fields: Object.assign(Object.assign({ project: {
|
67
|
+
fields: Object.assign(Object.assign(Object.assign({ project: {
|
79
68
|
key: params.projectKey,
|
80
69
|
}, summary: params.summary, description: description, issuetype: {
|
81
70
|
name: params.issueType,
|
82
|
-
} }, (reporterId ? { reporter: { id: reporterId } } : {})), (assigneeId ? { assignee: { id: assigneeId } } : {})),
|
71
|
+
} }, (reporterId ? { reporter: { id: reporterId } } : {})), (assigneeId ? { assignee: { id: assigneeId } } : {})), (params.customFields ? params.customFields : {})),
|
83
72
|
};
|
84
|
-
const response = yield
|
73
|
+
const response = yield axiosClient_1.axiosClient.post(`${apiUrl}/issue`, payload, {
|
85
74
|
headers: {
|
86
|
-
Authorization: `
|
87
|
-
|
75
|
+
Authorization: `Bearer ${authToken}`,
|
76
|
+
Accept: "application/json",
|
88
77
|
},
|
89
78
|
});
|
90
|
-
// At the end of your function, wrap the response
|
91
79
|
return {
|
92
80
|
ticketUrl: `${baseUrl}/browse/${response.data.key}`,
|
93
81
|
};
|
@@ -8,12 +8,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
9
|
});
|
10
10
|
};
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
-
};
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
-
const axios_1 = __importDefault(require("axios"));
|
16
12
|
const datetime_1 = require("../../../utils/datetime");
|
13
|
+
const axiosClient_1 = require("../../util/axiosClient");
|
17
14
|
const getForecastForLocation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
18
15
|
const { latitude, longitude, isoDate } = params;
|
19
16
|
const { userAgent } = authParams;
|
@@ -21,9 +18,9 @@ const getForecastForLocation = (_a) => __awaiter(void 0, [_a], void 0, function*
|
|
21
18
|
throw new Error("Invalid ISO date format");
|
22
19
|
}
|
23
20
|
const url = `https://api.weather.gov/points/${latitude},${longitude}`;
|
24
|
-
const pointsResponse = yield
|
21
|
+
const pointsResponse = yield axiosClient_1.axiosClient.get(url, { headers: { "User-Agent": userAgent } });
|
25
22
|
const forecastUrl = pointsResponse.data.properties.forecast;
|
26
|
-
const forecastResponse = yield
|
23
|
+
const forecastResponse = yield axiosClient_1.axiosClient.get(forecastUrl, {
|
27
24
|
headers: { "User-Agent": userAgent },
|
28
25
|
});
|
29
26
|
const forecastData = forecastResponse.data;
|
@@ -8,16 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
9
|
});
|
10
10
|
};
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
-
};
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
-
const
|
12
|
+
const axiosClient_1 = require("../../util/axiosClient");
|
16
13
|
const getLatitudeLongitudeFromLocation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
17
14
|
const { location } = params;
|
18
15
|
const { userAgent } = authParams;
|
19
16
|
const url = `https://nominatim.openstreetmap.org/search?q=${encodeURIComponent(location)}&format=json`;
|
20
|
-
const response = yield
|
17
|
+
const response = yield axiosClient_1.axiosClient.get(url, { headers: { "User-Agent": userAgent } });
|
21
18
|
return response.data.map((result) => ({
|
22
19
|
latitude: parseFloat(result.lat),
|
23
20
|
longitude: parseFloat(result.lon),
|
@@ -13,7 +13,10 @@ const createXSharePostUrl = ({ params, }) => {
|
|
13
13
|
}
|
14
14
|
// Add hashtags parameter if it exists
|
15
15
|
if (params.hashtag && params.hashtag.length > 0) {
|
16
|
-
|
16
|
+
const cleanedHashtags = params.hashtag.map(tag => tag.replace(/^#+/, "").trim()).filter(tag => tag.length > 0);
|
17
|
+
if (cleanedHashtags.length > 0) {
|
18
|
+
queryParams.append("hashtags", cleanedHashtags.join(","));
|
19
|
+
}
|
17
20
|
}
|
18
21
|
// Add via parameter if it exists
|
19
22
|
if (params.via) {
|
@@ -0,0 +1,45 @@
|
|
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 firecrawl_js_1 = __importDefault(require("@mendable/firecrawl-js"));
|
16
|
+
const scrapeTweetDataWithNitter = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
17
|
+
const tweetUrlRegex = /^(?:https?:\/\/)?(?:www\.)?(?:twitter\.com|x\.com)\/([a-zA-Z0-9_]+)\/status\/(\d+)(?:\?.*)?$/;
|
18
|
+
if (!tweetUrlRegex.test(params.tweetUrl)) {
|
19
|
+
throw new Error("Invalid tweet URL. Expected format: https://twitter.com/username/status/id or https://x.com/username/status/id");
|
20
|
+
}
|
21
|
+
const nitterUrl = params.tweetUrl.replace(/^(?:https?:\/\/)?(?:www\.)?(?:twitter\.com|x\.com)/i, "https://nitter.net");
|
22
|
+
// Initialize Firecrawl
|
23
|
+
if (!authParams.apiKey) {
|
24
|
+
throw new Error("API key is required for X+Nitter+Firecrawl");
|
25
|
+
}
|
26
|
+
const firecrawl = new firecrawl_js_1.default({
|
27
|
+
apiKey: authParams.apiKey,
|
28
|
+
});
|
29
|
+
try {
|
30
|
+
// Scrape the Nitter URL
|
31
|
+
const result = yield firecrawl.scrapeUrl(nitterUrl);
|
32
|
+
if (!result.success) {
|
33
|
+
throw new Error(`Failed to scrape tweet: ${result.error || "Unknown error"}`);
|
34
|
+
}
|
35
|
+
// Extract the tweet text from the scraped content - simple approach - in practice, you might need more robust parsing based on nitter html structure
|
36
|
+
const tweetContent = result.markdown;
|
37
|
+
return {
|
38
|
+
text: tweetContent || "Error scraping with firecrawl",
|
39
|
+
};
|
40
|
+
}
|
41
|
+
catch (error) {
|
42
|
+
throw new Error(`Error scraping tweet: ${error instanceof Error ? error.message : error}`);
|
43
|
+
}
|
44
|
+
});
|
45
|
+
exports.default = scrapeTweetDataWithNitter;
|
@@ -8,11 +8,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
9
|
});
|
10
10
|
};
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
-
};
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
-
const
|
12
|
+
const axiosClient_1 = require("../../util/axiosClient");
|
16
13
|
const createZendeskTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
17
14
|
const { apiKey } = authParams;
|
18
15
|
const { subdomain, subject, body, requesterEmail } = params;
|
@@ -29,7 +26,7 @@ const createZendeskTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
29
26
|
throw new Error("API key is required");
|
30
27
|
}
|
31
28
|
try {
|
32
|
-
const response = yield
|
29
|
+
const response = yield axiosClient_1.axiosClient.post(url, payload, {
|
33
30
|
auth: {
|
34
31
|
username: `${requesterEmail}/token`,
|
35
32
|
password: apiKey,
|
@@ -0,0 +1,46 @@
|
|
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
|
+
exports.axiosClient = exports.ApiError = void 0;
|
7
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
8
|
+
const axios_1 = __importDefault(require("axios"));
|
9
|
+
class ApiError extends Error {
|
10
|
+
constructor(message, status, data) {
|
11
|
+
super(message);
|
12
|
+
this.name = "ApiError";
|
13
|
+
this.status = status;
|
14
|
+
this.data = data;
|
15
|
+
}
|
16
|
+
}
|
17
|
+
exports.ApiError = ApiError;
|
18
|
+
/** Create a configured axios instance with interceptors */
|
19
|
+
function createAxiosClient() {
|
20
|
+
const instance = axios_1.default.create();
|
21
|
+
instance.interceptors.request.use(config => {
|
22
|
+
return config;
|
23
|
+
}, error => {
|
24
|
+
console.error("Request setup error:", error.message);
|
25
|
+
return Promise.reject(error);
|
26
|
+
});
|
27
|
+
instance.interceptors.response.use((response) => {
|
28
|
+
return response;
|
29
|
+
}, (error) => {
|
30
|
+
var _a, _b;
|
31
|
+
if (error.response) {
|
32
|
+
console.error(`API error:`, error.response.status, error.response.data);
|
33
|
+
return Promise.reject(new ApiError(`Request failed with status ${error.response.status}`, error.response.status, error.response.data));
|
34
|
+
}
|
35
|
+
else if (error.request) {
|
36
|
+
console.error(`No response received:`, (_a = error.config) === null || _a === void 0 ? void 0 : _a.url);
|
37
|
+
return Promise.reject(new ApiError(`No response received from server for ${((_b = error.config) === null || _b === void 0 ? void 0 : _b.url) || "unknown endpoint"}`));
|
38
|
+
}
|
39
|
+
else {
|
40
|
+
console.error(`Request setup error:`, error.message);
|
41
|
+
return Promise.reject(new ApiError(`Error making request: ${error.message}`));
|
42
|
+
}
|
43
|
+
});
|
44
|
+
return instance;
|
45
|
+
}
|
46
|
+
exports.axiosClient = createAxiosClient();
|
package/package.json
CHANGED
@@ -1,5 +0,0 @@
|
|
1
|
-
import { ActionTemplate } from "@/actions/parse";
|
2
|
-
export declare const slackSendMessageDefinition: ActionTemplate;
|
3
|
-
export declare const slackListConversationsDefinition: ActionTemplate;
|
4
|
-
export declare const mathAddDefinition: ActionTemplate;
|
5
|
-
export declare const confluenceUpdatePageDefinition: ActionTemplate;
|
@@ -1,132 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.confluenceUpdatePageDefinition = exports.mathAddDefinition = exports.slackListConversationsDefinition = exports.slackSendMessageDefinition = void 0;
|
4
|
-
exports.slackSendMessageDefinition = {
|
5
|
-
provider: "slack",
|
6
|
-
name: "send_message",
|
7
|
-
description: "Sends a message to a Slack channel",
|
8
|
-
scopes: ["chat:write"],
|
9
|
-
parameters: {
|
10
|
-
channel: {
|
11
|
-
type: "string",
|
12
|
-
description: "The Slack channel to send the message to (e.g., \\#general, \\#alerts)",
|
13
|
-
required: true,
|
14
|
-
},
|
15
|
-
message: {
|
16
|
-
type: "string",
|
17
|
-
description: "The message content to send to Slack. Can include markdown formatting.",
|
18
|
-
required: true,
|
19
|
-
},
|
20
|
-
},
|
21
|
-
output: {},
|
22
|
-
};
|
23
|
-
exports.slackListConversationsDefinition = {
|
24
|
-
provider: "slack",
|
25
|
-
name: "list_conversations",
|
26
|
-
description: "Lists all conversations in a Slack workspace",
|
27
|
-
scopes: ["channels:read", "groups:read", "im:read", "mpim:read"],
|
28
|
-
authToken: {
|
29
|
-
type: "string",
|
30
|
-
description: "The Slack access token to use",
|
31
|
-
required: true,
|
32
|
-
},
|
33
|
-
parameters: {},
|
34
|
-
output: {
|
35
|
-
channels: {
|
36
|
-
type: "array",
|
37
|
-
description: "A list of channels in Slack",
|
38
|
-
required: true,
|
39
|
-
items: {
|
40
|
-
type: "object",
|
41
|
-
description: "A channel in Slack",
|
42
|
-
required: true,
|
43
|
-
properties: {
|
44
|
-
id: {
|
45
|
-
type: "string",
|
46
|
-
description: "The ID of the channel",
|
47
|
-
required: true,
|
48
|
-
},
|
49
|
-
name: {
|
50
|
-
type: "string",
|
51
|
-
description: "The name of the channel",
|
52
|
-
required: true,
|
53
|
-
},
|
54
|
-
topic: {
|
55
|
-
type: "string",
|
56
|
-
description: "The topic of the channel",
|
57
|
-
required: true,
|
58
|
-
},
|
59
|
-
purpose: {
|
60
|
-
type: "string",
|
61
|
-
description: "The purpose of the channel",
|
62
|
-
required: true,
|
63
|
-
},
|
64
|
-
},
|
65
|
-
},
|
66
|
-
},
|
67
|
-
},
|
68
|
-
};
|
69
|
-
exports.mathAddDefinition = {
|
70
|
-
provider: "math",
|
71
|
-
name: "add",
|
72
|
-
description: "Adds two numbers together",
|
73
|
-
scopes: [],
|
74
|
-
parameters: {
|
75
|
-
a: {
|
76
|
-
type: "number",
|
77
|
-
description: "The first number to add",
|
78
|
-
required: true,
|
79
|
-
},
|
80
|
-
b: {
|
81
|
-
type: "number",
|
82
|
-
description: "The second number to add",
|
83
|
-
required: true,
|
84
|
-
},
|
85
|
-
},
|
86
|
-
output: {
|
87
|
-
result: {
|
88
|
-
type: "number",
|
89
|
-
description: "The sum of the two numbers",
|
90
|
-
required: true,
|
91
|
-
},
|
92
|
-
},
|
93
|
-
};
|
94
|
-
exports.confluenceUpdatePageDefinition = {
|
95
|
-
provider: "confluence",
|
96
|
-
name: "updatePage",
|
97
|
-
description: "Updates a confluence page with the new content specified",
|
98
|
-
scopes: [],
|
99
|
-
authToken: {
|
100
|
-
type: "string",
|
101
|
-
description: "The access token to use for confluence",
|
102
|
-
required: true,
|
103
|
-
},
|
104
|
-
baseUrl: {
|
105
|
-
type: "string",
|
106
|
-
description: "The base url required to access the confluence instance",
|
107
|
-
required: true,
|
108
|
-
},
|
109
|
-
parameters: {
|
110
|
-
pageId: {
|
111
|
-
type: "string",
|
112
|
-
description: "The page id that should be updated",
|
113
|
-
required: true,
|
114
|
-
},
|
115
|
-
title: {
|
116
|
-
type: "string",
|
117
|
-
description: "The title of the page that should be updated",
|
118
|
-
required: true,
|
119
|
-
},
|
120
|
-
username: {
|
121
|
-
type: "string",
|
122
|
-
description: "The username of the person updating the page",
|
123
|
-
required: true,
|
124
|
-
},
|
125
|
-
content: {
|
126
|
-
type: "string",
|
127
|
-
description: "The new content for the page",
|
128
|
-
required: true,
|
129
|
-
},
|
130
|
-
},
|
131
|
-
output: {},
|
132
|
-
};
|
@@ -1,35 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.mathAddDefinition = exports.slackSendMessageDefinition = void 0;
|
4
|
-
exports.slackSendMessageDefinition = {
|
5
|
-
name: "send_message",
|
6
|
-
description: "Sends a message to a Slack channel",
|
7
|
-
parameters: {
|
8
|
-
"channel": {
|
9
|
-
"type": "string",
|
10
|
-
"description": "The Slack channel to send the message to (e.g., \\#general, \\#alerts)",
|
11
|
-
"required": true
|
12
|
-
},
|
13
|
-
"message": {
|
14
|
-
"type": "string",
|
15
|
-
"description": "The message content to send to Slack. Can include markdown formatting.",
|
16
|
-
"required": true
|
17
|
-
}
|
18
|
-
}
|
19
|
-
};
|
20
|
-
exports.mathAddDefinition = {
|
21
|
-
name: "add",
|
22
|
-
description: "Adds two numbers together",
|
23
|
-
parameters: {
|
24
|
-
"a": {
|
25
|
-
"type": "number",
|
26
|
-
"description": "The first number to add",
|
27
|
-
"required": true
|
28
|
-
},
|
29
|
-
"b": {
|
30
|
-
"type": "number",
|
31
|
-
"description": "The second number to add",
|
32
|
-
"required": true
|
33
|
-
}
|
34
|
-
}
|
35
|
-
};
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import { type ActionFunction } from "./autogen/types";
|
2
|
-
import { z } from "zod";
|
3
|
-
interface ActionFunctionComponents {
|
4
|
-
fn: ActionFunction<any, any, any>;
|
5
|
-
paramsSchema: z.ZodSchema;
|
6
|
-
outputSchema: z.ZodSchema;
|
7
|
-
}
|
8
|
-
export declare const FunctionMapper: Record<string, Record<string, ActionFunctionComponents>>;
|
9
|
-
export {};
|
@@ -1,33 +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
|
-
exports.FunctionMapper = void 0;
|
7
|
-
const add_1 = __importDefault(require("./providers/math/add"));
|
8
|
-
const list_conversations_1 = __importDefault(require("./providers/slack/list_conversations"));
|
9
|
-
const updatePage_1 = __importDefault(require("./providers/confluence/updatePage"));
|
10
|
-
const types_1 = require("./autogen/types");
|
11
|
-
exports.FunctionMapper = {
|
12
|
-
math: {
|
13
|
-
add: {
|
14
|
-
fn: add_1.default,
|
15
|
-
paramsSchema: types_1.mathAddParamsSchema,
|
16
|
-
outputSchema: types_1.mathAddOutputSchema,
|
17
|
-
},
|
18
|
-
},
|
19
|
-
slack: {
|
20
|
-
listConversations: {
|
21
|
-
fn: list_conversations_1.default,
|
22
|
-
paramsSchema: types_1.slackListConversationsParamsSchema,
|
23
|
-
outputSchema: types_1.slackListConversationsOutputSchema,
|
24
|
-
},
|
25
|
-
},
|
26
|
-
confluence: {
|
27
|
-
updatePage: {
|
28
|
-
fn: updatePage_1.default,
|
29
|
-
paramsSchema: types_1.confluenceUpdatePageParamsSchema,
|
30
|
-
outputSchema: types_1.confluenceUpdatePageOutputSchema,
|
31
|
-
},
|
32
|
-
},
|
33
|
-
};
|
@@ -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,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;
|
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