@credal/actions 0.2.126 → 0.2.127
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/autogen/templates.js +16 -0
- package/dist/actions/autogen/types.d.ts +16 -4
- package/dist/actions/autogen/types.js +4 -0
- package/dist/actions/providers/jira/createJiraTicket.js +11 -3
- package/dist/actions/providers/jira/updateJiraTicketDetails.js +11 -2
- package/dist/actions/providers/jira/updateServiceDeskRequest.d.ts +3 -0
- package/dist/actions/providers/jira/updateServiceDeskRequest.js +72 -0
- package/dist/actions/providers/jira/utils.d.ts +1 -0
- package/dist/actions/providers/jira/utils.js +40 -0
- package/package.json +1 -1
- package/dist/actions/groups.d.ts +0 -6
- package/dist/actions/groups.js +0 -248
- package/dist/actions/providers/credal/callCopilot.d.ts +0 -3
- package/dist/actions/providers/credal/callCopilot.js +0 -36
- package/dist/actions/providers/math/index.d.ts +0 -1
- package/dist/actions/providers/math/index.js +0 -37
- package/dist/actions/providers/salesforce/getSalesforceRecordByQuery.d.ts +0 -3
- package/dist/actions/providers/salesforce/getSalesforceRecordByQuery.js +0 -43
- package/dist/actions/providers/slack/archiveChannel.d.ts +0 -3
- package/dist/actions/providers/slack/archiveChannel.js +0 -35
- 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
|
@@ -1110,6 +1110,10 @@ export const jiraCreateJiraTicketDefinition = {
|
|
|
1110
1110
|
type: "string",
|
|
1111
1111
|
description: "The assignee for the new ticket creation",
|
|
1112
1112
|
},
|
|
1113
|
+
requestTypeId: {
|
|
1114
|
+
type: "string",
|
|
1115
|
+
description: "The request type ID for Jira Service Management tickets",
|
|
1116
|
+
},
|
|
1113
1117
|
customFields: {
|
|
1114
1118
|
type: "object",
|
|
1115
1119
|
description: "Custom fields to be set on the create ticket request",
|
|
@@ -1384,6 +1388,10 @@ export const jiraUpdateJiraTicketDetailsDefinition = {
|
|
|
1384
1388
|
type: "string",
|
|
1385
1389
|
description: "The updated issue type",
|
|
1386
1390
|
},
|
|
1391
|
+
requestTypeId: {
|
|
1392
|
+
type: "string",
|
|
1393
|
+
description: "The request type ID for Jira Service Management tickets",
|
|
1394
|
+
},
|
|
1387
1395
|
customFields: {
|
|
1388
1396
|
type: "object",
|
|
1389
1397
|
description: "Custom fields to be set on the update ticket request",
|
|
@@ -1751,6 +1759,10 @@ export const jiraOrgCreateJiraTicketDefinition = {
|
|
|
1751
1759
|
type: "string",
|
|
1752
1760
|
description: "The assignee for the new ticket creation",
|
|
1753
1761
|
},
|
|
1762
|
+
requestTypeId: {
|
|
1763
|
+
type: "string",
|
|
1764
|
+
description: "The request type ID for Jira Service Management tickets",
|
|
1765
|
+
},
|
|
1754
1766
|
customFields: {
|
|
1755
1767
|
type: "object",
|
|
1756
1768
|
description: "Custom fields to be set on the create ticket request",
|
|
@@ -2025,6 +2037,10 @@ export const jiraOrgUpdateJiraTicketDetailsDefinition = {
|
|
|
2025
2037
|
type: "string",
|
|
2026
2038
|
description: "The updated issue type",
|
|
2027
2039
|
},
|
|
2040
|
+
requestTypeId: {
|
|
2041
|
+
type: "string",
|
|
2042
|
+
description: "The request type ID for Jira Service Management tickets",
|
|
2043
|
+
},
|
|
2028
2044
|
customFields: {
|
|
2029
2045
|
type: "object",
|
|
2030
2046
|
description: "Custom fields to be set on the update ticket request",
|
|
@@ -1150,6 +1150,7 @@ export declare const jiraCreateJiraTicketParamsSchema: z.ZodObject<{
|
|
|
1150
1150
|
issueType: z.ZodString;
|
|
1151
1151
|
reporter: z.ZodOptional<z.ZodString>;
|
|
1152
1152
|
assignee: z.ZodOptional<z.ZodString>;
|
|
1153
|
+
requestTypeId: z.ZodOptional<z.ZodString>;
|
|
1153
1154
|
customFields: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodAny, z.objectOutputType<{}, z.ZodAny, "strip">, z.objectInputType<{}, z.ZodAny, "strip">>>;
|
|
1154
1155
|
}, "strip", z.ZodTypeAny, {
|
|
1155
1156
|
description: string;
|
|
@@ -1159,6 +1160,7 @@ export declare const jiraCreateJiraTicketParamsSchema: z.ZodObject<{
|
|
|
1159
1160
|
assignee?: string | undefined;
|
|
1160
1161
|
customFields?: z.objectOutputType<{}, z.ZodAny, "strip"> | undefined;
|
|
1161
1162
|
reporter?: string | undefined;
|
|
1163
|
+
requestTypeId?: string | undefined;
|
|
1162
1164
|
}, {
|
|
1163
1165
|
description: string;
|
|
1164
1166
|
projectKey: string;
|
|
@@ -1167,6 +1169,7 @@ export declare const jiraCreateJiraTicketParamsSchema: z.ZodObject<{
|
|
|
1167
1169
|
assignee?: string | undefined;
|
|
1168
1170
|
customFields?: z.objectInputType<{}, z.ZodAny, "strip"> | undefined;
|
|
1169
1171
|
reporter?: string | undefined;
|
|
1172
|
+
requestTypeId?: string | undefined;
|
|
1170
1173
|
}>;
|
|
1171
1174
|
export type jiraCreateJiraTicketParamsType = z.infer<typeof jiraCreateJiraTicketParamsSchema>;
|
|
1172
1175
|
export declare const jiraCreateJiraTicketOutputSchema: z.ZodObject<{
|
|
@@ -1297,14 +1300,14 @@ export declare const jiraCreateServiceDeskRequestParamsSchema: z.ZodObject<{
|
|
|
1297
1300
|
}, "strip", z.ZodTypeAny, {
|
|
1298
1301
|
description: string;
|
|
1299
1302
|
summary: string;
|
|
1300
|
-
serviceDeskId: string;
|
|
1301
1303
|
requestTypeId: string;
|
|
1304
|
+
serviceDeskId: string;
|
|
1302
1305
|
reporter?: string | undefined;
|
|
1303
1306
|
}, {
|
|
1304
1307
|
description: string;
|
|
1305
1308
|
summary: string;
|
|
1306
|
-
serviceDeskId: string;
|
|
1307
1309
|
requestTypeId: string;
|
|
1310
|
+
serviceDeskId: string;
|
|
1308
1311
|
reporter?: string | undefined;
|
|
1309
1312
|
}>;
|
|
1310
1313
|
export type jiraCreateServiceDeskRequestParamsType = z.infer<typeof jiraCreateServiceDeskRequestParamsSchema>;
|
|
@@ -1387,6 +1390,7 @@ export declare const jiraUpdateJiraTicketDetailsParamsSchema: z.ZodObject<{
|
|
|
1387
1390
|
summary: z.ZodOptional<z.ZodString>;
|
|
1388
1391
|
description: z.ZodOptional<z.ZodString>;
|
|
1389
1392
|
issueType: z.ZodOptional<z.ZodString>;
|
|
1393
|
+
requestTypeId: z.ZodOptional<z.ZodString>;
|
|
1390
1394
|
customFields: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodAny, z.objectOutputType<{}, z.ZodAny, "strip">, z.objectInputType<{}, z.ZodAny, "strip">>>;
|
|
1391
1395
|
}, "strip", z.ZodTypeAny, {
|
|
1392
1396
|
projectKey: string;
|
|
@@ -1395,6 +1399,7 @@ export declare const jiraUpdateJiraTicketDetailsParamsSchema: z.ZodObject<{
|
|
|
1395
1399
|
customFields?: z.objectOutputType<{}, z.ZodAny, "strip"> | undefined;
|
|
1396
1400
|
summary?: string | undefined;
|
|
1397
1401
|
issueType?: string | undefined;
|
|
1402
|
+
requestTypeId?: string | undefined;
|
|
1398
1403
|
}, {
|
|
1399
1404
|
projectKey: string;
|
|
1400
1405
|
issueId: string;
|
|
@@ -1402,6 +1407,7 @@ export declare const jiraUpdateJiraTicketDetailsParamsSchema: z.ZodObject<{
|
|
|
1402
1407
|
customFields?: z.objectInputType<{}, z.ZodAny, "strip"> | undefined;
|
|
1403
1408
|
summary?: string | undefined;
|
|
1404
1409
|
issueType?: string | undefined;
|
|
1410
|
+
requestTypeId?: string | undefined;
|
|
1405
1411
|
}>;
|
|
1406
1412
|
export type jiraUpdateJiraTicketDetailsParamsType = z.infer<typeof jiraUpdateJiraTicketDetailsParamsSchema>;
|
|
1407
1413
|
export declare const jiraUpdateJiraTicketDetailsOutputSchema: z.ZodObject<{
|
|
@@ -1780,6 +1786,7 @@ export declare const jiraOrgCreateJiraTicketParamsSchema: z.ZodObject<{
|
|
|
1780
1786
|
issueType: z.ZodString;
|
|
1781
1787
|
reporter: z.ZodOptional<z.ZodString>;
|
|
1782
1788
|
assignee: z.ZodOptional<z.ZodString>;
|
|
1789
|
+
requestTypeId: z.ZodOptional<z.ZodString>;
|
|
1783
1790
|
customFields: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodAny, z.objectOutputType<{}, z.ZodAny, "strip">, z.objectInputType<{}, z.ZodAny, "strip">>>;
|
|
1784
1791
|
}, "strip", z.ZodTypeAny, {
|
|
1785
1792
|
description: string;
|
|
@@ -1789,6 +1796,7 @@ export declare const jiraOrgCreateJiraTicketParamsSchema: z.ZodObject<{
|
|
|
1789
1796
|
assignee?: string | undefined;
|
|
1790
1797
|
customFields?: z.objectOutputType<{}, z.ZodAny, "strip"> | undefined;
|
|
1791
1798
|
reporter?: string | undefined;
|
|
1799
|
+
requestTypeId?: string | undefined;
|
|
1792
1800
|
}, {
|
|
1793
1801
|
description: string;
|
|
1794
1802
|
projectKey: string;
|
|
@@ -1797,6 +1805,7 @@ export declare const jiraOrgCreateJiraTicketParamsSchema: z.ZodObject<{
|
|
|
1797
1805
|
assignee?: string | undefined;
|
|
1798
1806
|
customFields?: z.objectInputType<{}, z.ZodAny, "strip"> | undefined;
|
|
1799
1807
|
reporter?: string | undefined;
|
|
1808
|
+
requestTypeId?: string | undefined;
|
|
1800
1809
|
}>;
|
|
1801
1810
|
export type jiraOrgCreateJiraTicketParamsType = z.infer<typeof jiraOrgCreateJiraTicketParamsSchema>;
|
|
1802
1811
|
export declare const jiraOrgCreateJiraTicketOutputSchema: z.ZodObject<{
|
|
@@ -1927,14 +1936,14 @@ export declare const jiraOrgCreateServiceDeskRequestParamsSchema: z.ZodObject<{
|
|
|
1927
1936
|
}, "strip", z.ZodTypeAny, {
|
|
1928
1937
|
description: string;
|
|
1929
1938
|
summary: string;
|
|
1930
|
-
serviceDeskId: string;
|
|
1931
1939
|
requestTypeId: string;
|
|
1940
|
+
serviceDeskId: string;
|
|
1932
1941
|
reporter?: string | undefined;
|
|
1933
1942
|
}, {
|
|
1934
1943
|
description: string;
|
|
1935
1944
|
summary: string;
|
|
1936
|
-
serviceDeskId: string;
|
|
1937
1945
|
requestTypeId: string;
|
|
1946
|
+
serviceDeskId: string;
|
|
1938
1947
|
reporter?: string | undefined;
|
|
1939
1948
|
}>;
|
|
1940
1949
|
export type jiraOrgCreateServiceDeskRequestParamsType = z.infer<typeof jiraOrgCreateServiceDeskRequestParamsSchema>;
|
|
@@ -2017,6 +2026,7 @@ export declare const jiraOrgUpdateJiraTicketDetailsParamsSchema: z.ZodObject<{
|
|
|
2017
2026
|
summary: z.ZodOptional<z.ZodString>;
|
|
2018
2027
|
description: z.ZodOptional<z.ZodString>;
|
|
2019
2028
|
issueType: z.ZodOptional<z.ZodString>;
|
|
2029
|
+
requestTypeId: z.ZodOptional<z.ZodString>;
|
|
2020
2030
|
customFields: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodAny, z.objectOutputType<{}, z.ZodAny, "strip">, z.objectInputType<{}, z.ZodAny, "strip">>>;
|
|
2021
2031
|
}, "strip", z.ZodTypeAny, {
|
|
2022
2032
|
projectKey: string;
|
|
@@ -2025,6 +2035,7 @@ export declare const jiraOrgUpdateJiraTicketDetailsParamsSchema: z.ZodObject<{
|
|
|
2025
2035
|
customFields?: z.objectOutputType<{}, z.ZodAny, "strip"> | undefined;
|
|
2026
2036
|
summary?: string | undefined;
|
|
2027
2037
|
issueType?: string | undefined;
|
|
2038
|
+
requestTypeId?: string | undefined;
|
|
2028
2039
|
}, {
|
|
2029
2040
|
projectKey: string;
|
|
2030
2041
|
issueId: string;
|
|
@@ -2032,6 +2043,7 @@ export declare const jiraOrgUpdateJiraTicketDetailsParamsSchema: z.ZodObject<{
|
|
|
2032
2043
|
customFields?: z.objectInputType<{}, z.ZodAny, "strip"> | undefined;
|
|
2033
2044
|
summary?: string | undefined;
|
|
2034
2045
|
issueType?: string | undefined;
|
|
2046
|
+
requestTypeId?: string | undefined;
|
|
2035
2047
|
}>;
|
|
2036
2048
|
export type jiraOrgUpdateJiraTicketDetailsParamsType = z.infer<typeof jiraOrgUpdateJiraTicketDetailsParamsSchema>;
|
|
2037
2049
|
export declare const jiraOrgUpdateJiraTicketDetailsOutputSchema: z.ZodObject<{
|
|
@@ -387,6 +387,7 @@ export const jiraCreateJiraTicketParamsSchema = z.object({
|
|
|
387
387
|
issueType: z.string().describe("The issue type of the new ticket. Should be Epic, Story, Task, Bug, Sub-task, etc."),
|
|
388
388
|
reporter: z.string().describe("The reporter for the new ticket creation").optional(),
|
|
389
389
|
assignee: z.string().describe("The assignee for the new ticket creation").optional(),
|
|
390
|
+
requestTypeId: z.string().describe("The request type ID for Jira Service Management tickets").optional(),
|
|
390
391
|
customFields: z
|
|
391
392
|
.object({})
|
|
392
393
|
.catchall(z.any())
|
|
@@ -468,6 +469,7 @@ export const jiraUpdateJiraTicketDetailsParamsSchema = z.object({
|
|
|
468
469
|
summary: z.string().describe("The updated summary").optional(),
|
|
469
470
|
description: z.string().describe("The updated description").optional(),
|
|
470
471
|
issueType: z.string().describe("The updated issue type").optional(),
|
|
472
|
+
requestTypeId: z.string().describe("The request type ID for Jira Service Management tickets").optional(),
|
|
471
473
|
customFields: z
|
|
472
474
|
.object({})
|
|
473
475
|
.catchall(z.any())
|
|
@@ -563,6 +565,7 @@ export const jiraOrgCreateJiraTicketParamsSchema = z.object({
|
|
|
563
565
|
issueType: z.string().describe("The issue type of the new ticket. Should be Epic, Story, Task, Bug, Sub-task, etc."),
|
|
564
566
|
reporter: z.string().describe("The reporter for the new ticket creation").optional(),
|
|
565
567
|
assignee: z.string().describe("The assignee for the new ticket creation").optional(),
|
|
568
|
+
requestTypeId: z.string().describe("The request type ID for Jira Service Management tickets").optional(),
|
|
566
569
|
customFields: z
|
|
567
570
|
.object({})
|
|
568
571
|
.catchall(z.any())
|
|
@@ -644,6 +647,7 @@ export const jiraOrgUpdateJiraTicketDetailsParamsSchema = z.object({
|
|
|
644
647
|
summary: z.string().describe("The updated summary").optional(),
|
|
645
648
|
description: z.string().describe("The updated description").optional(),
|
|
646
649
|
issueType: z.string().describe("The updated issue type").optional(),
|
|
650
|
+
requestTypeId: z.string().describe("The request type ID for Jira Service Management tickets").optional(),
|
|
647
651
|
customFields: z
|
|
648
652
|
.object({})
|
|
649
653
|
.catchall(z.any())
|
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { axiosClient } from "../../util/axiosClient.js";
|
|
11
|
-
import { getUserAccountIdFromEmail } from "./utils.js";
|
|
11
|
+
import { getUserAccountIdFromEmail, getRequestTypeCustomFieldId } from "./utils.js";
|
|
12
12
|
const createJiraTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
13
13
|
const { authToken, cloudId, baseUrl } = authParams;
|
|
14
14
|
const apiUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/`;
|
|
@@ -25,6 +25,14 @@ const createJiraTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
|
25
25
|
if (params.assignee && typeof params.assignee === "string" && params.assignee.includes("@") && authToken) {
|
|
26
26
|
assigneeId = yield getUserAccountIdFromEmail(params.assignee, apiUrl, authToken);
|
|
27
27
|
}
|
|
28
|
+
// If request type is provided, find the custom field ID and prepare the value
|
|
29
|
+
const requestTypeField = {};
|
|
30
|
+
if (params.requestTypeId && authToken) {
|
|
31
|
+
const requestTypeFieldId = yield getRequestTypeCustomFieldId(params.projectKey, apiUrl, authToken);
|
|
32
|
+
if (requestTypeFieldId) {
|
|
33
|
+
requestTypeField[requestTypeFieldId] = params.requestTypeId;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
28
36
|
const description = {
|
|
29
37
|
type: "doc",
|
|
30
38
|
version: 1,
|
|
@@ -41,11 +49,11 @@ const createJiraTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
|
41
49
|
],
|
|
42
50
|
};
|
|
43
51
|
const payload = {
|
|
44
|
-
fields: Object.assign(Object.assign(Object.assign({ project: {
|
|
52
|
+
fields: Object.assign(Object.assign(Object.assign(Object.assign({ project: {
|
|
45
53
|
key: params.projectKey,
|
|
46
54
|
}, summary: params.summary, description: description, issuetype: {
|
|
47
55
|
name: params.issueType,
|
|
48
|
-
} }, (reporterId ? { reporter: { id: reporterId } } : {})), (assigneeId ? { assignee: { id: assigneeId } } : {})), (params.customFields ? params.customFields : {})),
|
|
56
|
+
} }, (reporterId ? { reporter: { id: reporterId } } : {})), (assigneeId ? { assignee: { id: assigneeId } } : {})), requestTypeField), (params.customFields ? params.customFields : {})),
|
|
49
57
|
};
|
|
50
58
|
const response = yield axiosClient.post(`${apiUrl}/issue`, payload, {
|
|
51
59
|
headers: {
|
|
@@ -8,9 +8,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { axiosClient } from "../../util/axiosClient.js";
|
|
11
|
+
import { getRequestTypeCustomFieldId } from "./utils.js";
|
|
11
12
|
const updateJiraTicketDetails = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
12
13
|
const { authToken, cloudId, baseUrl } = authParams;
|
|
13
|
-
const { issueId, summary, description, customFields } = params;
|
|
14
|
+
const { issueId, summary, description, customFields, requestTypeId } = params;
|
|
14
15
|
if (!cloudId || !authToken) {
|
|
15
16
|
throw new Error("Valid Cloud ID and auth token are required to comment on Jira ticket");
|
|
16
17
|
}
|
|
@@ -32,8 +33,16 @@ const updateJiraTicketDetails = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
|
32
33
|
],
|
|
33
34
|
}
|
|
34
35
|
: undefined;
|
|
36
|
+
// If request type is provided, find the custom field ID and prepare the value
|
|
37
|
+
const requestTypeField = {};
|
|
38
|
+
if (requestTypeId && authToken) {
|
|
39
|
+
const requestTypeFieldId = yield getRequestTypeCustomFieldId(params.projectKey, `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3`, authToken);
|
|
40
|
+
if (requestTypeFieldId) {
|
|
41
|
+
requestTypeField[requestTypeFieldId] = requestTypeId;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
35
44
|
const payload = {
|
|
36
|
-
fields: Object.assign(Object.assign(Object.assign({}, (summary && { summary })), (formattedDescription && { description: formattedDescription })), (customFields && Object.assign({}, customFields))),
|
|
45
|
+
fields: Object.assign(Object.assign(Object.assign(Object.assign({}, (summary && { summary })), (formattedDescription && { description: formattedDescription })), requestTypeField), (customFields && Object.assign({}, customFields))),
|
|
37
46
|
};
|
|
38
47
|
try {
|
|
39
48
|
yield axiosClient.put(apiUrl, payload, {
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { axiosClient } from "../../util/axiosClient.js";
|
|
11
|
+
const updateServiceDeskRequest = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
12
|
+
const { issueId, requestTypeId, summary, description, priority, customFields } = params;
|
|
13
|
+
const { authToken, cloudId, baseUrl } = authParams;
|
|
14
|
+
if (!cloudId || !authToken) {
|
|
15
|
+
throw new Error("Valid Cloud ID and auth token are required to update service desk request");
|
|
16
|
+
}
|
|
17
|
+
// Use the regular Jira API for updating service desk requests as they are still Jira issues
|
|
18
|
+
const apiUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/issue/${issueId}`;
|
|
19
|
+
const formattedDescription = description
|
|
20
|
+
? {
|
|
21
|
+
type: "doc",
|
|
22
|
+
version: 1,
|
|
23
|
+
content: [
|
|
24
|
+
{
|
|
25
|
+
type: "paragraph",
|
|
26
|
+
content: [
|
|
27
|
+
{
|
|
28
|
+
type: "text",
|
|
29
|
+
text: description,
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
}
|
|
35
|
+
: undefined;
|
|
36
|
+
const payload = {
|
|
37
|
+
fields: Object.assign(Object.assign(Object.assign(Object.assign({}, (summary && { summary })), (formattedDescription && { description: formattedDescription })), (priority && { priority: { name: priority } })), (customFields && Object.assign({}, customFields))),
|
|
38
|
+
};
|
|
39
|
+
try {
|
|
40
|
+
yield axiosClient.put(apiUrl, payload, {
|
|
41
|
+
headers: {
|
|
42
|
+
Authorization: `Bearer ${authToken}`,
|
|
43
|
+
Accept: "application/json",
|
|
44
|
+
"Content-Type": "application/json",
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
// Get the updated issue details to return current status and web link
|
|
48
|
+
const getResponse = yield axiosClient.get(apiUrl, {
|
|
49
|
+
headers: {
|
|
50
|
+
Authorization: `Bearer ${authToken}`,
|
|
51
|
+
Accept: "application/json",
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
const issueKey = getResponse.data.key;
|
|
55
|
+
const currentStatus = getResponse.data.fields.status.name;
|
|
56
|
+
const webLink = `${baseUrl}/browse/${issueKey}`;
|
|
57
|
+
return {
|
|
58
|
+
success: true,
|
|
59
|
+
issueKey,
|
|
60
|
+
webLink,
|
|
61
|
+
currentStatus,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
console.error("Error updating service desk request:", error);
|
|
66
|
+
return {
|
|
67
|
+
success: false,
|
|
68
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
export default updateServiceDeskRequest;
|
|
@@ -29,3 +29,43 @@ export function getUserAccountIdFromEmail(email, apiUrl, authToken) {
|
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
+
export function getRequestTypeCustomFieldId(projectKey, apiUrl, authToken) {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
try {
|
|
35
|
+
const response = yield axiosClient.get(`${apiUrl}/issue/createmeta?projectKeys=${projectKey}&expand=projects.issuetypes.fields`, {
|
|
36
|
+
headers: {
|
|
37
|
+
Authorization: `Bearer ${authToken}`,
|
|
38
|
+
Accept: "application/json",
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
const projects = response.data.projects;
|
|
42
|
+
if (!projects || projects.length === 0) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
const project = projects[0];
|
|
46
|
+
const issueTypes = project.issuetypes;
|
|
47
|
+
if (!issueTypes || issueTypes.length === 0) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
for (const issueType of issueTypes) {
|
|
51
|
+
const fields = issueType.fields;
|
|
52
|
+
if (fields) {
|
|
53
|
+
for (const [fieldId, fieldData] of Object.entries(fields)) {
|
|
54
|
+
if (fieldData && typeof fieldData === "object" && "name" in fieldData) {
|
|
55
|
+
const fieldInfo = fieldData;
|
|
56
|
+
if (fieldInfo.name === "Request Type") {
|
|
57
|
+
return fieldId;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
const axiosError = error;
|
|
67
|
+
console.error("Error finding Request Type custom field:", axiosError.message);
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
package/package.json
CHANGED
package/dist/actions/groups.d.ts
DELETED
package/dist/actions/groups.js
DELETED
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
import { genericFillTemplateDefinition, confluenceOverwritePageDefinition, googlemapsValidateAddressDefinition, mathAddDefinition, mongoInsertMongoDocDefinition, slackSendMessageDefinition, slackGetChannelMessagesDefinition, slackCreateChannelDefinition, slackArchiveChannelDefinition, snowflakeGetRowByFieldValueDefinition, zendeskCreateZendeskTicketDefinition, zendeskListZendeskTicketsDefinition, zendeskGetTicketDetailsDefinition, zendeskUpdateTicketStatusDefinition, zendeskAddCommentToTicketDefinition, zendeskAssignTicketDefinition, openstreetmapGetLatitudeLongitudeFromLocationDefinition, nwsGetForecastForLocationDefinition, jiraAssignJiraTicketDefinition, jiraCommentJiraTicketDefinition, jiraCreateJiraTicketDefinition, jiraGetJiraTicketDetailsDefinition, jiraGetJiraTicketHistoryDefinition, jiraUpdateJiraTicketDetailsDefinition, jiraUpdateJiraTicketStatusDefinition, jiraGetServiceDesksDefinition, jiraCreateServiceDeskRequestDefinition, googlemapsNearbysearchRestaurantsDefinition, firecrawlScrapeUrlDefinition, resendSendEmailDefinition, linkedinCreateShareLinkedinPostUrlDefinition, googleOauthCreateNewGoogleDocDefinition, xCreateShareXPostUrlDefinition, firecrawlScrapeTweetDataWithNitterDefinition, finnhubSymbolLookupDefinition, finnhubGetBasicFinancialsDefinition, confluenceFetchPageContentDefinition, snowflakeRunSnowflakeQueryDefinition, lookerEnableUserByEmailDefinition, googleOauthUpdateDocDefinition, googleOauthScheduleCalendarMeetingDefinition, googleOauthListCalendarsDefinition, googleOauthListCalendarEventsDefinition, googleOauthUpdateCalendarEventDefinition, googleOauthDeleteCalendarEventDefinition, googleOauthCreateSpreadsheetDefinition, googleOauthUpdateSpreadsheetDefinition, googleOauthCreatePresentationDefinition, googleOauthUpdatePresentationDefinition, googleOauthSearchDriveByKeywordsDefinition, googlemailSearchGmailMessagesDefinition, googlemailListGmailThreadsDefinition, googleOauthListGroupsDefinition, googleOauthGetGroupDefinition, googleOauthListGroupMembersDefinition, googleOauthHasGroupMemberDefinition, googleOauthAddGroupMemberDefinition, googleOauthDeleteGroupMemberDefinition, salesforceUpdateRecordDefinition, salesforceCreateCaseDefinition, salesforceGenerateSalesReportDefinition, salesforceGetRecordDefinition, salesforceGetSalesforceRecordsByQueryDefinition, microsoftMessageTeamsChatDefinition, microsoftMessageTeamsChannelDefinition, asanaCommentTaskDefinition, asanaCreateTaskDefinition, asanaUpdateTaskDefinition, asanaSearchTasksDefinition, githubCreateOrUpdateFileDefinition, githubCreateBranchDefinition, githubCreatePullRequestDefinition, microsoftUpdateSpreadsheetDefinition, microsoftUpdateDocumentDefinition, microsoftCreateDocumentDefinition, microsoftGetDocumentDefinition, salesforceFetchSalesforceSchemaByObjectDefinition, firecrawlDeepResearchDefinition, jiraGetJiraIssuesByQueryDefinition, githubListPullRequestsDefinition, salesforceCreateRecordDefinition, ashbyCreateNoteDefinition, ashbyGetCandidateInfoDefinition, ashbyListCandidatesDefinition, ashbyListCandidateNotesDefinition, ashbySearchCandidatesDefinition, ashbyCreateCandidateDefinition, ashbyUpdateCandidateDefinition, ashbyAddCandidateToProjectDefinition, bingGetTopNSearchResultUrlsDefinition, gongGetGongTranscriptsDefinition, kandjiGetFVRecoveryKeyForDeviceDefinition, asanaListAsanaTasksByProjectDefinition, notionSearchByTitleDefinition, asanaGetTasksDetailsDefinition, jamfGetJamfComputerInventoryDefinition, jamfGetJamfFileVaultRecoveryKeyDefinition, oktaListOktaUsersDefinition, oktaGetOktaUserDefinition, oktaListOktaUserGroupsDefinition, oktaListOktaGroupsDefinition, oktaGetOktaGroupDefinition, oktaListOktaGroupMembersDefinition, oktaRemoveUserFromGroupDefinition, oktaAddUserToGroupDefinition, oktaResetPasswordDefinition, oktaResetMFADefinition, oktaListMFADefinition, jamfGetJamfUserComputerIdDefinition, jamfLockJamfComputerByIdDefinition, oktaTriggerOktaWorkflowDefinition, jiraOrgAssignJiraTicketDefinition, jiraOrgCreateJiraTicketDefinition, jiraOrgCommentJiraTicketDefinition, jiraOrgGetJiraTicketDetailsDefinition, jiraOrgGetJiraTicketHistoryDefinition, jiraOrgUpdateJiraTicketDetailsDefinition, jiraOrgUpdateJiraTicketStatusDefinition, jiraOrgGetJiraIssuesByQueryDefinition, googleOauthGetDriveFileContentByIdDefinition, googleOauthSearchDriveByQueryDefinition, } from "./autogen/templates.js";
|
|
2
|
-
export const ACTION_GROUPS = {
|
|
3
|
-
GENERIC: {
|
|
4
|
-
description: "Generic utility actions",
|
|
5
|
-
actions: [genericFillTemplateDefinition],
|
|
6
|
-
},
|
|
7
|
-
ASANA: {
|
|
8
|
-
description: "Actions for interacting with Asana",
|
|
9
|
-
actions: [
|
|
10
|
-
asanaCommentTaskDefinition,
|
|
11
|
-
asanaCreateTaskDefinition,
|
|
12
|
-
asanaUpdateTaskDefinition,
|
|
13
|
-
asanaSearchTasksDefinition,
|
|
14
|
-
asanaListAsanaTasksByProjectDefinition,
|
|
15
|
-
asanaGetTasksDetailsDefinition,
|
|
16
|
-
],
|
|
17
|
-
},
|
|
18
|
-
SLACK_LIST_CONVERSATIONS: {
|
|
19
|
-
description: "Actions for interacting with Slack",
|
|
20
|
-
actions: [
|
|
21
|
-
slackSendMessageDefinition,
|
|
22
|
-
slackGetChannelMessagesDefinition,
|
|
23
|
-
slackCreateChannelDefinition,
|
|
24
|
-
slackArchiveChannelDefinition,
|
|
25
|
-
],
|
|
26
|
-
},
|
|
27
|
-
CONFLUENCE: {
|
|
28
|
-
description: "Action for interacting with Confluence",
|
|
29
|
-
actions: [confluenceOverwritePageDefinition, confluenceFetchPageContentDefinition],
|
|
30
|
-
},
|
|
31
|
-
MATH_ADD: {
|
|
32
|
-
description: "Action for adding two numbers",
|
|
33
|
-
actions: [mathAddDefinition],
|
|
34
|
-
},
|
|
35
|
-
GOOGLE_MAPS: {
|
|
36
|
-
description: "Action for interacting with Google Maps",
|
|
37
|
-
actions: [googlemapsValidateAddressDefinition, googlemapsNearbysearchRestaurantsDefinition],
|
|
38
|
-
},
|
|
39
|
-
GOOGLE_DRIVE: {
|
|
40
|
-
description: "Action for interacting with Google Drive",
|
|
41
|
-
actions: [
|
|
42
|
-
googleOauthCreateNewGoogleDocDefinition,
|
|
43
|
-
googleOauthUpdateDocDefinition,
|
|
44
|
-
googleOauthCreateSpreadsheetDefinition,
|
|
45
|
-
googleOauthUpdateSpreadsheetDefinition,
|
|
46
|
-
googleOauthCreatePresentationDefinition,
|
|
47
|
-
googleOauthUpdatePresentationDefinition,
|
|
48
|
-
googleOauthSearchDriveByKeywordsDefinition,
|
|
49
|
-
googleOauthSearchDriveByQueryDefinition,
|
|
50
|
-
googleOauthGetDriveFileContentByIdDefinition,
|
|
51
|
-
],
|
|
52
|
-
},
|
|
53
|
-
GOOGLE_CALENDAR: {
|
|
54
|
-
description: "Actions for interacting with Google Calendar",
|
|
55
|
-
actions: [
|
|
56
|
-
googleOauthScheduleCalendarMeetingDefinition,
|
|
57
|
-
googleOauthListCalendarsDefinition,
|
|
58
|
-
googleOauthListCalendarEventsDefinition,
|
|
59
|
-
googleOauthUpdateCalendarEventDefinition,
|
|
60
|
-
googleOauthDeleteCalendarEventDefinition,
|
|
61
|
-
],
|
|
62
|
-
},
|
|
63
|
-
GMAIL: {
|
|
64
|
-
description: "Actions for interacting with Gmail",
|
|
65
|
-
actions: [googlemailSearchGmailMessagesDefinition, googlemailListGmailThreadsDefinition],
|
|
66
|
-
},
|
|
67
|
-
LINKEDIN_SHARE_POST: {
|
|
68
|
-
description: "Action for creating a share post url on linkedin",
|
|
69
|
-
actions: [linkedinCreateShareLinkedinPostUrlDefinition],
|
|
70
|
-
},
|
|
71
|
-
ZENDESK_ACTIONS: {
|
|
72
|
-
description: "Actions for interacting with Zendesk",
|
|
73
|
-
actions: [
|
|
74
|
-
zendeskCreateZendeskTicketDefinition,
|
|
75
|
-
zendeskListZendeskTicketsDefinition,
|
|
76
|
-
zendeskGetTicketDetailsDefinition,
|
|
77
|
-
zendeskUpdateTicketStatusDefinition,
|
|
78
|
-
zendeskAddCommentToTicketDefinition,
|
|
79
|
-
zendeskAssignTicketDefinition,
|
|
80
|
-
],
|
|
81
|
-
},
|
|
82
|
-
BING_SEARCH: {
|
|
83
|
-
description: "Action for searching Bing",
|
|
84
|
-
actions: [bingGetTopNSearchResultUrlsDefinition],
|
|
85
|
-
},
|
|
86
|
-
MONGO_INSERT_DOC: {
|
|
87
|
-
description: "Action for inserting a document into a MongoDB collection",
|
|
88
|
-
actions: [mongoInsertMongoDocDefinition],
|
|
89
|
-
},
|
|
90
|
-
SNOWFLAKE_ACTIONS: {
|
|
91
|
-
description: "Action for getting content from a Snowflake table",
|
|
92
|
-
actions: [snowflakeGetRowByFieldValueDefinition, snowflakeRunSnowflakeQueryDefinition],
|
|
93
|
-
},
|
|
94
|
-
JIRA_ACTIONS: {
|
|
95
|
-
description: "Action for interacting with Jira tickets",
|
|
96
|
-
actions: [
|
|
97
|
-
jiraAssignJiraTicketDefinition,
|
|
98
|
-
jiraCreateJiraTicketDefinition,
|
|
99
|
-
jiraCommentJiraTicketDefinition,
|
|
100
|
-
jiraGetJiraTicketDetailsDefinition,
|
|
101
|
-
jiraGetJiraTicketHistoryDefinition,
|
|
102
|
-
jiraUpdateJiraTicketDetailsDefinition,
|
|
103
|
-
jiraUpdateJiraTicketStatusDefinition,
|
|
104
|
-
jiraGetJiraIssuesByQueryDefinition,
|
|
105
|
-
jiraGetServiceDesksDefinition,
|
|
106
|
-
jiraCreateServiceDeskRequestDefinition,
|
|
107
|
-
],
|
|
108
|
-
},
|
|
109
|
-
JIRA_ORG_ACTIONS: {
|
|
110
|
-
description: "Action for interacting with Jira tickets",
|
|
111
|
-
actions: [
|
|
112
|
-
jiraOrgAssignJiraTicketDefinition,
|
|
113
|
-
jiraOrgCreateJiraTicketDefinition,
|
|
114
|
-
jiraOrgCommentJiraTicketDefinition,
|
|
115
|
-
jiraOrgGetJiraTicketDetailsDefinition,
|
|
116
|
-
jiraOrgGetJiraTicketHistoryDefinition,
|
|
117
|
-
jiraOrgUpdateJiraTicketDetailsDefinition,
|
|
118
|
-
jiraOrgUpdateJiraTicketStatusDefinition,
|
|
119
|
-
jiraOrgGetJiraIssuesByQueryDefinition,
|
|
120
|
-
],
|
|
121
|
-
},
|
|
122
|
-
OPENSTREETMAP_GET_LATITUDE_LONGITUDE_FROM_LOCATION: {
|
|
123
|
-
description: "Action for getting the latitude and longitude of a location",
|
|
124
|
-
actions: [openstreetmapGetLatitudeLongitudeFromLocationDefinition],
|
|
125
|
-
},
|
|
126
|
-
NWS_GET_FORECAST_FOR_LOCATION: {
|
|
127
|
-
description: "Action for getting the weather forecast for a location",
|
|
128
|
-
actions: [nwsGetForecastForLocationDefinition],
|
|
129
|
-
},
|
|
130
|
-
FIRECRAWL: {
|
|
131
|
-
description: "Actions for interacting with Firecrawl",
|
|
132
|
-
actions: [
|
|
133
|
-
firecrawlScrapeUrlDefinition,
|
|
134
|
-
firecrawlScrapeTweetDataWithNitterDefinition,
|
|
135
|
-
firecrawlDeepResearchDefinition,
|
|
136
|
-
],
|
|
137
|
-
},
|
|
138
|
-
RESEND: {
|
|
139
|
-
description: "Action for sending an email",
|
|
140
|
-
actions: [resendSendEmailDefinition],
|
|
141
|
-
},
|
|
142
|
-
X: {
|
|
143
|
-
description: "Actions for interacting with X(formerly twitter)",
|
|
144
|
-
actions: [xCreateShareXPostUrlDefinition],
|
|
145
|
-
},
|
|
146
|
-
GONG: {
|
|
147
|
-
description: "Actions for interacting with Gong",
|
|
148
|
-
actions: [gongGetGongTranscriptsDefinition],
|
|
149
|
-
},
|
|
150
|
-
FINNHUB: {
|
|
151
|
-
description: "Action for interacting with Finnhub for stock market data",
|
|
152
|
-
actions: [finnhubSymbolLookupDefinition, finnhubGetBasicFinancialsDefinition],
|
|
153
|
-
},
|
|
154
|
-
JAMF: {
|
|
155
|
-
description: "Actions for interacting with Jamf",
|
|
156
|
-
actions: [
|
|
157
|
-
jamfGetJamfComputerInventoryDefinition,
|
|
158
|
-
jamfGetJamfFileVaultRecoveryKeyDefinition,
|
|
159
|
-
jamfGetJamfUserComputerIdDefinition,
|
|
160
|
-
jamfLockJamfComputerByIdDefinition,
|
|
161
|
-
],
|
|
162
|
-
},
|
|
163
|
-
LOOKER: {
|
|
164
|
-
description: "Actions for interacting with Looker",
|
|
165
|
-
actions: [lookerEnableUserByEmailDefinition],
|
|
166
|
-
},
|
|
167
|
-
SALESFORCE: {
|
|
168
|
-
description: "Actions for interacting with Salesforce",
|
|
169
|
-
actions: [
|
|
170
|
-
salesforceUpdateRecordDefinition,
|
|
171
|
-
salesforceCreateRecordDefinition,
|
|
172
|
-
salesforceCreateCaseDefinition,
|
|
173
|
-
salesforceGenerateSalesReportDefinition,
|
|
174
|
-
salesforceGetRecordDefinition,
|
|
175
|
-
salesforceGetSalesforceRecordsByQueryDefinition,
|
|
176
|
-
salesforceFetchSalesforceSchemaByObjectDefinition,
|
|
177
|
-
],
|
|
178
|
-
},
|
|
179
|
-
MICROSOFT: {
|
|
180
|
-
description: "Actions for interacting with Microsoft 365",
|
|
181
|
-
actions: [
|
|
182
|
-
microsoftMessageTeamsChatDefinition,
|
|
183
|
-
microsoftMessageTeamsChannelDefinition,
|
|
184
|
-
microsoftUpdateSpreadsheetDefinition,
|
|
185
|
-
microsoftUpdateDocumentDefinition,
|
|
186
|
-
microsoftCreateDocumentDefinition,
|
|
187
|
-
microsoftGetDocumentDefinition,
|
|
188
|
-
],
|
|
189
|
-
},
|
|
190
|
-
KANDJI: {
|
|
191
|
-
description: "Actions for interacting with Kandji",
|
|
192
|
-
actions: [kandjiGetFVRecoveryKeyForDeviceDefinition],
|
|
193
|
-
},
|
|
194
|
-
GITHUB: {
|
|
195
|
-
description: "Actions for interacting with GitHub",
|
|
196
|
-
actions: [
|
|
197
|
-
githubCreateOrUpdateFileDefinition,
|
|
198
|
-
githubCreateBranchDefinition,
|
|
199
|
-
githubCreatePullRequestDefinition,
|
|
200
|
-
githubListPullRequestsDefinition,
|
|
201
|
-
],
|
|
202
|
-
},
|
|
203
|
-
ASHBY: {
|
|
204
|
-
description: "Actions for interacting with Ashby",
|
|
205
|
-
actions: [
|
|
206
|
-
ashbyCreateNoteDefinition,
|
|
207
|
-
ashbyGetCandidateInfoDefinition,
|
|
208
|
-
ashbyListCandidatesDefinition,
|
|
209
|
-
ashbyListCandidateNotesDefinition,
|
|
210
|
-
ashbySearchCandidatesDefinition,
|
|
211
|
-
ashbyCreateCandidateDefinition,
|
|
212
|
-
ashbyUpdateCandidateDefinition,
|
|
213
|
-
ashbyAddCandidateToProjectDefinition,
|
|
214
|
-
],
|
|
215
|
-
},
|
|
216
|
-
NOTION: {
|
|
217
|
-
description: "Actions for interacting with Notion",
|
|
218
|
-
actions: [notionSearchByTitleDefinition],
|
|
219
|
-
},
|
|
220
|
-
GOOGLE_GROUPS: {
|
|
221
|
-
description: "Google Workspace Groups management actions",
|
|
222
|
-
actions: [
|
|
223
|
-
googleOauthListGroupsDefinition,
|
|
224
|
-
googleOauthGetGroupDefinition,
|
|
225
|
-
googleOauthListGroupMembersDefinition,
|
|
226
|
-
googleOauthHasGroupMemberDefinition,
|
|
227
|
-
googleOauthAddGroupMemberDefinition,
|
|
228
|
-
googleOauthDeleteGroupMemberDefinition,
|
|
229
|
-
],
|
|
230
|
-
},
|
|
231
|
-
OKTA: {
|
|
232
|
-
description: "Actions for interacting with Okta",
|
|
233
|
-
actions: [
|
|
234
|
-
oktaListOktaUsersDefinition,
|
|
235
|
-
oktaGetOktaUserDefinition,
|
|
236
|
-
oktaListOktaUserGroupsDefinition,
|
|
237
|
-
oktaListOktaGroupsDefinition,
|
|
238
|
-
oktaGetOktaGroupDefinition,
|
|
239
|
-
oktaListOktaGroupMembersDefinition,
|
|
240
|
-
oktaRemoveUserFromGroupDefinition,
|
|
241
|
-
oktaAddUserToGroupDefinition,
|
|
242
|
-
oktaResetPasswordDefinition,
|
|
243
|
-
oktaResetMFADefinition,
|
|
244
|
-
oktaListMFADefinition,
|
|
245
|
-
oktaTriggerOktaWorkflowDefinition,
|
|
246
|
-
],
|
|
247
|
-
},
|
|
248
|
-
};
|
|
@@ -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,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,35 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { WebClient } from "@slack/web-api";
|
|
11
|
-
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
12
|
-
const archiveChannel = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
13
|
-
if (!authParams.authToken) {
|
|
14
|
-
throw new Error(MISSING_AUTH_TOKEN);
|
|
15
|
-
}
|
|
16
|
-
try {
|
|
17
|
-
const client = new WebClient(authParams.authToken);
|
|
18
|
-
const { channelId } = params;
|
|
19
|
-
const result = yield client.conversations.archive({ channel: channelId });
|
|
20
|
-
if (!result.ok) {
|
|
21
|
-
return {
|
|
22
|
-
success: false,
|
|
23
|
-
error: result.error || "Unknown error archiving channel",
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
return { success: true };
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
return {
|
|
30
|
-
success: false,
|
|
31
|
-
error: error instanceof Error ? error.message : "Unknown error archiving channel",
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
export default archiveChannel;
|
|
@@ -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;
|