@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
@@ -0,0 +1,63 @@
|
|
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 missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
14
|
+
const listCalendars = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
15
|
+
var _b;
|
16
|
+
if (!authParams.authToken) {
|
17
|
+
return { success: false, error: missingAuthConstants_1.MISSING_AUTH_TOKEN, calendars: [] };
|
18
|
+
}
|
19
|
+
const url = "https://www.googleapis.com/calendar/v3/users/me/calendarList";
|
20
|
+
const allCalendars = [];
|
21
|
+
let pageToken = undefined;
|
22
|
+
let fetchedCount = 0;
|
23
|
+
const max = (_b = params.maxResults) !== null && _b !== void 0 ? _b : 250; // Default to 250 if not specified, Google API max is 250
|
24
|
+
try {
|
25
|
+
while (fetchedCount < max) {
|
26
|
+
const res = yield axiosClient_1.axiosClient.get(url, {
|
27
|
+
headers: {
|
28
|
+
Authorization: `Bearer ${authParams.authToken}`,
|
29
|
+
},
|
30
|
+
params: {
|
31
|
+
showDeleted: false,
|
32
|
+
showHidden: false,
|
33
|
+
pageToken,
|
34
|
+
maxResults: Math.min(250, max - fetchedCount), // Google API max is 250
|
35
|
+
},
|
36
|
+
});
|
37
|
+
const { items = [], nextPageToken = undefined } = res.data;
|
38
|
+
if (!Array.isArray(items) || items.length <= 0)
|
39
|
+
break;
|
40
|
+
const batch = items.slice(0, max - fetchedCount);
|
41
|
+
allCalendars.push(...batch.map(c => ({
|
42
|
+
id: c.id,
|
43
|
+
summary: c.summary,
|
44
|
+
})));
|
45
|
+
fetchedCount = allCalendars.length;
|
46
|
+
if (!nextPageToken || fetchedCount >= max)
|
47
|
+
break;
|
48
|
+
pageToken = nextPageToken;
|
49
|
+
}
|
50
|
+
return {
|
51
|
+
success: true,
|
52
|
+
calendars: allCalendars,
|
53
|
+
};
|
54
|
+
}
|
55
|
+
catch (error) {
|
56
|
+
return {
|
57
|
+
success: false,
|
58
|
+
calendars: [],
|
59
|
+
error: error instanceof Error ? error.message : "Unknown error listing calendars",
|
60
|
+
};
|
61
|
+
}
|
62
|
+
});
|
63
|
+
exports.default = listCalendars;
|
@@ -0,0 +1,54 @@
|
|
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 missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
14
|
+
const listGroupMembers = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
15
|
+
const { authToken } = authParams;
|
16
|
+
const { groupKey, maxResults } = params;
|
17
|
+
if (!authToken) {
|
18
|
+
return { success: false, members: [], error: missingAuthConstants_1.MISSING_AUTH_TOKEN };
|
19
|
+
}
|
20
|
+
try {
|
21
|
+
let members = [];
|
22
|
+
let pageToken = undefined;
|
23
|
+
const limit = Math.min(maxResults !== null && maxResults !== void 0 ? maxResults : 200, 200);
|
24
|
+
while (members.length < limit) {
|
25
|
+
const url = new URL(`https://admin.googleapis.com/admin/directory/v1/groups/${encodeURIComponent(groupKey)}/members`);
|
26
|
+
url.searchParams.set("maxResults", String(limit - members.length));
|
27
|
+
if (pageToken)
|
28
|
+
url.searchParams.set("pageToken", pageToken);
|
29
|
+
const response = yield axiosClient_1.axiosClient.get(url.toString(), {
|
30
|
+
headers: { Authorization: `Bearer ${authToken}` },
|
31
|
+
});
|
32
|
+
const data = response.data;
|
33
|
+
const batch = (data.members || []).map(({ id, email, role, type }) => ({
|
34
|
+
id,
|
35
|
+
email,
|
36
|
+
role,
|
37
|
+
type,
|
38
|
+
}));
|
39
|
+
members = members.concat(batch);
|
40
|
+
pageToken = data.nextPageToken;
|
41
|
+
if (!pageToken)
|
42
|
+
break;
|
43
|
+
}
|
44
|
+
return { success: true, members: members.slice(0, limit) };
|
45
|
+
}
|
46
|
+
catch (error) {
|
47
|
+
return {
|
48
|
+
success: false,
|
49
|
+
members: [],
|
50
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
51
|
+
};
|
52
|
+
}
|
53
|
+
});
|
54
|
+
exports.default = listGroupMembers;
|
@@ -0,0 +1,56 @@
|
|
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 missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
14
|
+
const listGroups = (_a) => __awaiter(void 0, [_a], void 0, function* ({ authParams, params, }) {
|
15
|
+
var _b;
|
16
|
+
const { authToken } = authParams;
|
17
|
+
const maxResults = (_b = params === null || params === void 0 ? void 0 : params.maxResults) !== null && _b !== void 0 ? _b : 200;
|
18
|
+
if (!authToken) {
|
19
|
+
return { success: false, groups: [], error: missingAuthConstants_1.MISSING_AUTH_TOKEN };
|
20
|
+
}
|
21
|
+
try {
|
22
|
+
let groups = [];
|
23
|
+
let pageToken = undefined;
|
24
|
+
const limit = Math.min(maxResults, 200);
|
25
|
+
while (groups.length < limit) {
|
26
|
+
const url = new URL("https://admin.googleapis.com/admin/directory/v1/groups");
|
27
|
+
url.searchParams.set("customer", "my_customer");
|
28
|
+
url.searchParams.set("maxResults", String(limit - groups.length));
|
29
|
+
if (pageToken)
|
30
|
+
url.searchParams.set("pageToken", pageToken);
|
31
|
+
const response = yield axiosClient_1.axiosClient.get(url.toString(), {
|
32
|
+
headers: { Authorization: `Bearer ${authToken}` },
|
33
|
+
});
|
34
|
+
const data = response.data;
|
35
|
+
const batch = (data.groups || []).map(({ id, email, name, description }) => ({
|
36
|
+
id,
|
37
|
+
email,
|
38
|
+
name,
|
39
|
+
description,
|
40
|
+
}));
|
41
|
+
groups = groups.concat(batch);
|
42
|
+
pageToken = data.nextPageToken;
|
43
|
+
if (!pageToken)
|
44
|
+
break;
|
45
|
+
}
|
46
|
+
return { success: true, groups: groups.slice(0, limit) };
|
47
|
+
}
|
48
|
+
catch (error) {
|
49
|
+
return {
|
50
|
+
success: false,
|
51
|
+
groups: [],
|
52
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
53
|
+
};
|
54
|
+
}
|
55
|
+
});
|
56
|
+
exports.default = listGroups;
|
@@ -0,0 +1,59 @@
|
|
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 missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
14
|
+
const updateCalendarEvent = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
15
|
+
if (!authParams.authToken) {
|
16
|
+
return { success: false, error: missingAuthConstants_1.MISSING_AUTH_TOKEN, eventId: "", eventUrl: "" };
|
17
|
+
}
|
18
|
+
const { calendarId, eventId, updates } = params;
|
19
|
+
const url = `https://www.googleapis.com/calendar/v3/calendars/${encodeURIComponent(calendarId)}/events/${encodeURIComponent(eventId)}`;
|
20
|
+
const body = {};
|
21
|
+
if (updates) {
|
22
|
+
if (updates.title != undefined)
|
23
|
+
body.summary = updates.title;
|
24
|
+
if (updates.description != undefined)
|
25
|
+
body.description = updates.description;
|
26
|
+
if (updates.start != undefined)
|
27
|
+
body.start = { dateTime: updates.start };
|
28
|
+
if (updates.end != undefined)
|
29
|
+
body.end = { dateTime: updates.end };
|
30
|
+
if (updates.location != undefined)
|
31
|
+
body.location = updates.location;
|
32
|
+
if (updates.attendees != undefined)
|
33
|
+
body.attendees = updates.attendees.map(email => ({ email }));
|
34
|
+
if (updates.status != undefined)
|
35
|
+
body.status = updates.status;
|
36
|
+
if (updates.organizer != undefined)
|
37
|
+
body.organizer = updates.organizer;
|
38
|
+
}
|
39
|
+
try {
|
40
|
+
const res = yield axiosClient_1.axiosClient.patch(url, body, {
|
41
|
+
headers: {
|
42
|
+
Authorization: `Bearer ${authParams.authToken}`,
|
43
|
+
},
|
44
|
+
});
|
45
|
+
const { id, htmlLink } = res.data;
|
46
|
+
return {
|
47
|
+
success: true,
|
48
|
+
eventId: id,
|
49
|
+
eventUrl: htmlLink,
|
50
|
+
};
|
51
|
+
}
|
52
|
+
catch (error) {
|
53
|
+
return {
|
54
|
+
success: false,
|
55
|
+
error: error instanceof Error ? error.message : "Unknown error updating event",
|
56
|
+
};
|
57
|
+
}
|
58
|
+
});
|
59
|
+
exports.default = updateCalendarEvent;
|
@@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
const axiosClient_1 = require("../../util/axiosClient");
|
13
13
|
const missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
14
|
-
const decodeMessage_1 = require("
|
14
|
+
const decodeMessage_1 = require("../google-oauth/utils/decodeMessage");
|
15
15
|
const listGmailThreads = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
16
16
|
if (!authParams.authToken) {
|
17
17
|
return { success: false, error: missingAuthConstants_1.MISSING_AUTH_TOKEN, threads: [] };
|
@@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
const axiosClient_1 = require("../../util/axiosClient");
|
13
13
|
const missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
14
|
-
const decodeMessage_1 = require("
|
14
|
+
const decodeMessage_1 = require("../google-oauth/utils/decodeMessage");
|
15
15
|
const searchGmailMessages = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
16
16
|
if (!authParams.authToken) {
|
17
17
|
return { success: false, error: missingAuthConstants_1.MISSING_AUTH_TOKEN, messages: [] };
|
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,96 +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 types_1 = require("../../autogen/types");
|
17
|
-
const INCLUDED_TYPES = [
|
18
|
-
// "monument",
|
19
|
-
// "museum",
|
20
|
-
// "art_gallery",
|
21
|
-
// "sculpture",
|
22
|
-
// "cultural_landmark",
|
23
|
-
// "historical_place",
|
24
|
-
// "performing_arts_theater",
|
25
|
-
// "university",
|
26
|
-
// "aquarium",
|
27
|
-
// "botanical_garden",
|
28
|
-
// "comedy_club",
|
29
|
-
// "park",
|
30
|
-
// "movie_theater",
|
31
|
-
// "national_park",
|
32
|
-
// "garden",
|
33
|
-
// "night_club",
|
34
|
-
// "tourist_attraction",
|
35
|
-
// "water_park",
|
36
|
-
// "zoo",
|
37
|
-
// "bar",
|
38
|
-
"restaurant",
|
39
|
-
// "food_court",
|
40
|
-
// "bakery",
|
41
|
-
// "cafe",
|
42
|
-
// "coffee_shop",
|
43
|
-
// "pub",
|
44
|
-
// "wine_bar",
|
45
|
-
// "spa",
|
46
|
-
// "beach",
|
47
|
-
// "market",
|
48
|
-
// "shopping_mall",
|
49
|
-
// "stadium",
|
50
|
-
];
|
51
|
-
const nearbysearch = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
52
|
-
const url = `https://places.googleapis.com/v1/places:searchNearby`;
|
53
|
-
const fieldMask = [
|
54
|
-
"places.displayName",
|
55
|
-
"places.formattedAddress",
|
56
|
-
"places.priceLevel",
|
57
|
-
"places.rating",
|
58
|
-
"places.primaryTypeDisplayName",
|
59
|
-
"places.editorialSummary",
|
60
|
-
"places.regularOpeningHours",
|
61
|
-
].join(",");
|
62
|
-
const response = yield axios_1.default.post(url, {
|
63
|
-
maxResultCount: 20,
|
64
|
-
includedTypes: INCLUDED_TYPES,
|
65
|
-
locationRestriction: {
|
66
|
-
circle: {
|
67
|
-
center: {
|
68
|
-
latitude: params.latitude,
|
69
|
-
longitude: params.longitude,
|
70
|
-
},
|
71
|
-
radius: 10000,
|
72
|
-
},
|
73
|
-
},
|
74
|
-
}, {
|
75
|
-
headers: {
|
76
|
-
"X-Goog-Api-Key": authParams.apiKey,
|
77
|
-
"X-Goog-FieldMask": fieldMask,
|
78
|
-
"Content-Type": "application/json",
|
79
|
-
},
|
80
|
-
});
|
81
|
-
return types_1.googlemapsNearbysearchOutputSchema.parse({
|
82
|
-
results: response.data.places.map((place) => {
|
83
|
-
var _a, _b;
|
84
|
-
return ({
|
85
|
-
name: place.displayName.text,
|
86
|
-
address: place.formattedAddress,
|
87
|
-
priceLevel: place.priceLevel,
|
88
|
-
rating: place.rating,
|
89
|
-
primaryType: place.primaryTypeDisplayName.text,
|
90
|
-
editorialSummary: ((_a = place.editorialSummary) === null || _a === void 0 ? void 0 : _a.text) || "",
|
91
|
-
openingHours: ((_b = place.regularOpeningHours) === null || _b === void 0 ? void 0 : _b.weekdayDescriptions.join("\n")) || "",
|
92
|
-
});
|
93
|
-
}),
|
94
|
-
});
|
95
|
-
});
|
96
|
-
exports.default = nearbysearch;
|