@credal/actions 0.1.66 → 0.1.67
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/providers/confluence/updatePage.d.ts +3 -0
- package/dist/actions/providers/confluence/updatePage.js +47 -0
- package/dist/actions/providers/zendesk/addCommentToTicket.js +4 -7
- package/dist/actions/providers/zendesk/assignTicket.js +4 -7
- package/dist/actions/providers/zendesk/createZendeskTicket.js +4 -7
- package/dist/actions/providers/zendesk/getTicketDetails.js +4 -7
- package/dist/actions/providers/zendesk/listTickets.js +4 -7
- package/dist/actions/providers/zendesk/updateTicketStatus.js +4 -7
- package/package.json +1 -1
- package/dist/actions/providers/salesforce/getSalesforceRecordByQuery.d.ts +0 -3
- package/dist/actions/providers/salesforce/getSalesforceRecordByQuery.js +0 -43
@@ -0,0 +1,47 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
const axios_1 = __importDefault(require("axios"));
|
16
|
+
function getConfluenceApi(baseUrl, username, apiToken) {
|
17
|
+
const api = axios_1.default.create({
|
18
|
+
baseURL: baseUrl,
|
19
|
+
headers: {
|
20
|
+
Accept: "application/json",
|
21
|
+
// Tokens are associated with a specific user.
|
22
|
+
Authorization: `Basic ${Buffer.from(`${username}:${apiToken}`).toString("base64")}`,
|
23
|
+
},
|
24
|
+
});
|
25
|
+
return api;
|
26
|
+
}
|
27
|
+
const confluenceUpdatePage = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
28
|
+
const { pageId, username, content, title } = params;
|
29
|
+
const { baseUrl, authToken } = authParams;
|
30
|
+
const api = getConfluenceApi(baseUrl, username, authToken);
|
31
|
+
// Get current version number
|
32
|
+
const response = yield api.get(`/api/v2/pages/${pageId}`);
|
33
|
+
const currVersion = response.data.version.number;
|
34
|
+
yield api.put(`/api/v2/pages/${pageId}`, {
|
35
|
+
id: pageId,
|
36
|
+
status: "current",
|
37
|
+
title,
|
38
|
+
body: {
|
39
|
+
representation: "storage",
|
40
|
+
value: content,
|
41
|
+
},
|
42
|
+
version: {
|
43
|
+
number: currVersion + 1,
|
44
|
+
},
|
45
|
+
});
|
46
|
+
});
|
47
|
+
exports.default = confluenceUpdatePage;
|
@@ -11,21 +11,18 @@ 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 addCommentToTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
|
-
const {
|
14
|
+
const { authToken } = authParams;
|
15
15
|
const { subdomain, ticketId, comment } = params;
|
16
16
|
const url = `https://${subdomain}.zendesk.com/api/v2/tickets/${ticketId}.json`;
|
17
|
-
if (!
|
18
|
-
throw new Error("
|
17
|
+
if (!authToken) {
|
18
|
+
throw new Error("Auth token is required");
|
19
19
|
}
|
20
20
|
yield axiosClient_1.axiosClient.request({
|
21
21
|
url: url,
|
22
22
|
method: "PUT",
|
23
|
-
auth: {
|
24
|
-
username: `${username}/token`,
|
25
|
-
password: apiKey,
|
26
|
-
},
|
27
23
|
headers: {
|
28
24
|
"Content-Type": "application/json",
|
25
|
+
Authorization: `Bearer ${authToken}`,
|
29
26
|
},
|
30
27
|
data: {
|
31
28
|
ticket: {
|
@@ -11,21 +11,18 @@ 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 updateTicketStatus = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
|
-
const {
|
14
|
+
const { authToken } = authParams;
|
15
15
|
const { subdomain, ticketId, assigneeEmail } = params;
|
16
16
|
const url = `https://${subdomain}.zendesk.com/api/v2/tickets/${ticketId}.json`;
|
17
|
-
if (!
|
18
|
-
throw new Error("
|
17
|
+
if (!authToken) {
|
18
|
+
throw new Error("Auth token is required");
|
19
19
|
}
|
20
20
|
yield axiosClient_1.axiosClient.request({
|
21
21
|
url: url,
|
22
22
|
method: "PUT",
|
23
|
-
auth: {
|
24
|
-
username: `${username}/token`,
|
25
|
-
password: apiKey,
|
26
|
-
},
|
27
23
|
headers: {
|
28
24
|
"Content-Type": "application/json",
|
25
|
+
Authorization: `Bearer ${authToken}`,
|
29
26
|
},
|
30
27
|
data: {
|
31
28
|
ticket: {
|
@@ -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 createZendeskTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
|
-
const {
|
14
|
+
const { authToken } = authParams;
|
15
15
|
const { subdomain, subject, body } = params;
|
16
16
|
const url = `https://${subdomain}.zendesk.com/api/v2/tickets.json`;
|
17
17
|
const payload = {
|
@@ -22,16 +22,13 @@ const createZendeskTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
22
22
|
},
|
23
23
|
},
|
24
24
|
};
|
25
|
-
if (!
|
26
|
-
throw new Error("
|
25
|
+
if (!authToken) {
|
26
|
+
throw new Error("Auth token is required");
|
27
27
|
}
|
28
28
|
const response = yield axiosClient_1.axiosClient.post(url, payload, {
|
29
|
-
auth: {
|
30
|
-
username: `${username}/token`,
|
31
|
-
password: apiKey,
|
32
|
-
},
|
33
29
|
headers: {
|
34
30
|
"Content-Type": "application/json",
|
31
|
+
Authorization: `Bearer ${authToken}`,
|
35
32
|
},
|
36
33
|
});
|
37
34
|
return {
|
@@ -11,21 +11,18 @@ 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 getZendeskTicketDetails = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
|
-
const {
|
14
|
+
const { authToken } = authParams;
|
15
15
|
const { subdomain, ticketId } = params;
|
16
16
|
const url = `https://${subdomain}.zendesk.com/api/v2/tickets/${ticketId}.json`;
|
17
|
-
if (!
|
18
|
-
throw new Error("
|
17
|
+
if (!authToken) {
|
18
|
+
throw new Error("Auth token is required");
|
19
19
|
}
|
20
20
|
const response = yield axiosClient_1.axiosClient.request({
|
21
21
|
url: url,
|
22
22
|
method: "GET",
|
23
|
-
auth: {
|
24
|
-
username: `${username}/token`,
|
25
|
-
password: apiKey,
|
26
|
-
},
|
27
23
|
headers: {
|
28
24
|
"Content-Type": "application/json",
|
25
|
+
Authorization: `Bearer ${authToken}`,
|
29
26
|
},
|
30
27
|
});
|
31
28
|
return {
|
@@ -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 listZendeskTickets = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
|
-
const {
|
14
|
+
const { authToken } = authParams;
|
15
15
|
const { subdomain, status } = params;
|
16
16
|
// Calculate date 3 months ago from now
|
17
17
|
const threeMonthsAgo = new Date();
|
@@ -19,8 +19,8 @@ const listZendeskTickets = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
19
19
|
const formattedDate = threeMonthsAgo.toISOString().split("T")[0];
|
20
20
|
// Endpoint for getting tickets
|
21
21
|
const url = `https://${subdomain}.zendesk.com/api/v2/tickets.json`;
|
22
|
-
if (!
|
23
|
-
throw new Error("
|
22
|
+
if (!authToken) {
|
23
|
+
throw new Error("Auth token is required");
|
24
24
|
}
|
25
25
|
// Add query parameters for filtering
|
26
26
|
const queryParams = new URLSearchParams();
|
@@ -29,12 +29,9 @@ const listZendeskTickets = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
29
29
|
queryParams.append("status", status);
|
30
30
|
}
|
31
31
|
const response = yield axiosClient_1.axiosClient.get(`${url}?${queryParams.toString()}`, {
|
32
|
-
auth: {
|
33
|
-
username: `${username}/token`,
|
34
|
-
password: apiKey,
|
35
|
-
},
|
36
32
|
headers: {
|
37
33
|
"Content-Type": "application/json",
|
34
|
+
Authorization: `Bearer ${authToken}`,
|
38
35
|
},
|
39
36
|
});
|
40
37
|
return {
|
@@ -11,21 +11,18 @@ 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 updateTicketStatus = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
|
-
const {
|
14
|
+
const { authToken } = authParams;
|
15
15
|
const { subdomain, ticketId, status } = params;
|
16
16
|
const url = `https://${subdomain}.zendesk.com/api/v2/tickets/${ticketId}.json`;
|
17
|
-
if (!
|
18
|
-
throw new Error("
|
17
|
+
if (!authToken) {
|
18
|
+
throw new Error("Auth token is required");
|
19
19
|
}
|
20
20
|
yield axiosClient_1.axiosClient.request({
|
21
21
|
url: url,
|
22
22
|
method: "PUT",
|
23
|
-
auth: {
|
24
|
-
username: `${username}/token`,
|
25
|
-
password: apiKey,
|
26
|
-
},
|
27
23
|
headers: {
|
28
24
|
"Content-Type": "application/json",
|
25
|
+
Authorization: `Bearer ${authToken}`,
|
29
26
|
},
|
30
27
|
data: {
|
31
28
|
ticket: {
|
package/package.json
CHANGED
@@ -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;
|