@credal/actions 0.1.31 → 0.1.32
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 +138 -0
- package/dist/actions/autogen/templates.d.ts +22 -0
- package/dist/actions/autogen/templates.js +883 -1
- package/dist/actions/autogen/types.d.ts +660 -8
- package/dist/actions/autogen/types.js +245 -1
- package/dist/actions/groups.js +20 -3
- package/dist/actions/invoke.js +3 -0
- package/dist/actions/parse.js +3 -0
- package/dist/actions/providers/ashby/addCandidateToProject.d.ts +3 -0
- package/dist/actions/providers/ashby/addCandidateToProject.js +32 -0
- package/dist/actions/providers/ashby/createCandidate.d.ts +3 -0
- package/dist/actions/providers/ashby/createCandidate.js +42 -0
- package/dist/actions/providers/ashby/createNote.d.ts +3 -0
- package/dist/actions/providers/ashby/createNote.js +32 -0
- package/dist/actions/providers/ashby/getCandidateInfo.d.ts +3 -0
- package/dist/actions/providers/ashby/getCandidateInfo.js +34 -0
- package/dist/actions/providers/ashby/listCandidateNotes.d.ts +3 -0
- package/dist/actions/providers/ashby/listCandidateNotes.js +34 -0
- package/dist/actions/providers/ashby/listCandidates.d.ts +3 -0
- package/dist/actions/providers/ashby/listCandidates.js +31 -0
- package/dist/actions/providers/ashby/searchCandidates.d.ts +3 -0
- package/dist/actions/providers/ashby/searchCandidates.js +35 -0
- package/dist/actions/providers/ashby/updateCandidate.d.ts +3 -0
- package/dist/actions/providers/ashby/updateCandidate.js +60 -0
- package/dist/actions/providers/confluence/updatePage.js +15 -14
- package/dist/actions/providers/google-oauth/scheduleCalendarMeeting.d.ts +6 -0
- package/dist/actions/providers/google-oauth/scheduleCalendarMeeting.js +74 -0
- package/dist/actions/providers/jira/assignJiraTicket.d.ts +3 -0
- package/dist/actions/providers/jira/assignJiraTicket.js +52 -0
- package/dist/actions/providers/jira/commentJiraTicket.d.ts +3 -0
- package/dist/actions/providers/jira/commentJiraTicket.js +56 -0
- package/dist/actions/providers/jira/createJiraTicket.js +3 -24
- package/dist/actions/providers/jira/utils.d.ts +1 -0
- package/dist/actions/providers/jira/utils.js +34 -0
- package/dist/actions/providers/microsoft/messageTeamsChannel.d.ts +3 -0
- package/dist/actions/providers/microsoft/messageTeamsChannel.js +45 -0
- package/dist/actions/providers/microsoft/messageTeamsChat.d.ts +3 -0
- package/dist/actions/providers/microsoft/messageTeamsChat.js +42 -0
- package/dist/actions/providers/microsoft/utils.d.ts +4 -0
- package/dist/actions/providers/microsoft/utils.js +55 -0
- package/dist/actions/providers/salesforce/createCase.d.ts +3 -0
- package/dist/actions/providers/salesforce/createCase.js +44 -0
- package/dist/actions/providers/salesforce/generateSalesReport.d.ts +3 -0
- package/dist/actions/providers/salesforce/generateSalesReport.js +52 -0
- package/dist/actions/providers/salesforce/getRecord.d.ts +3 -0
- package/dist/actions/providers/salesforce/getRecord.js +42 -0
- package/dist/actions/providers/salesforce/updateRecord.d.ts +3 -0
- package/dist/actions/providers/salesforce/updateRecord.js +42 -0
- package/dist/actions/providers/slack/getChannelMessages.d.ts +3 -0
- package/dist/actions/providers/slack/getChannelMessages.js +33 -0
- package/dist/actions/providers/workday/requestTimeOff.d.ts +23 -0
- package/dist/actions/providers/workday/requestTimeOff.js +88 -0
- package/dist/actions/providers/zendesk/addCommentToTicket.d.ts +3 -0
- package/dist/actions/providers/zendesk/addCommentToTicket.js +37 -0
- package/dist/actions/providers/zendesk/assignTicket.d.ts +3 -0
- package/dist/actions/providers/zendesk/assignTicket.js +37 -0
- package/dist/actions/providers/zendesk/getTicketDetails.d.ts +3 -0
- package/dist/actions/providers/zendesk/getTicketDetails.js +35 -0
- package/dist/actions/providers/zendesk/updateTicketStatus.d.ts +3 -0
- package/dist/actions/providers/zendesk/updateTicketStatus.js +37 -0
- package/package.json +6 -1
- package/dist/actions/providers/googlemaps/nearbysearch.d.ts +0 -3
- package/dist/actions/providers/googlemaps/nearbysearch.js +0 -96
- package/dist/actions/providers/snowflake/runSnowflakeQueryWriteResultsToS3.d.ts +0 -3
- package/dist/actions/providers/snowflake/runSnowflakeQueryWriteResultsToS3.js +0 -154
- package/dist/actions/providers/x/scrapeTweetDataWithNitter.d.ts +0 -3
- package/dist/actions/providers/x/scrapeTweetDataWithNitter.js +0 -45
@@ -0,0 +1,52 @@
|
|
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 generateSalesReport = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
|
+
const { authToken, baseUrl } = authParams;
|
15
|
+
const { startDate, endDate, filters } = params;
|
16
|
+
if (!authToken || !baseUrl) {
|
17
|
+
return {
|
18
|
+
success: false,
|
19
|
+
error: "authToken and baseUrl are required for Salesforce API",
|
20
|
+
};
|
21
|
+
}
|
22
|
+
const query = `
|
23
|
+
SELECT Name, Amount, CloseDate, StageName
|
24
|
+
FROM Opportunity
|
25
|
+
WHERE CloseDate >= ${startDate} AND CloseDate <= ${endDate}
|
26
|
+
${filters
|
27
|
+
? Object.entries(filters)
|
28
|
+
.map(([key, value]) => `AND ${key} = '${value}'`)
|
29
|
+
.join(" ")
|
30
|
+
: ""}
|
31
|
+
`;
|
32
|
+
const url = `${baseUrl}/services/data/v56.0/query?q=${encodeURIComponent(query)}`;
|
33
|
+
try {
|
34
|
+
const response = yield axiosClient_1.axiosClient.get(url, {
|
35
|
+
headers: {
|
36
|
+
Authorization: `Bearer ${authToken}`,
|
37
|
+
},
|
38
|
+
});
|
39
|
+
return {
|
40
|
+
success: true,
|
41
|
+
reportData: response.data.records,
|
42
|
+
};
|
43
|
+
}
|
44
|
+
catch (error) {
|
45
|
+
console.error("Error generating Salesforce sales report:", error);
|
46
|
+
return {
|
47
|
+
success: false,
|
48
|
+
error: error instanceof Error ? error.message : "An unknown error occurred",
|
49
|
+
};
|
50
|
+
}
|
51
|
+
});
|
52
|
+
exports.default = generateSalesReport;
|
@@ -0,0 +1,42 @@
|
|
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 getRecord = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
|
+
const { authToken, baseUrl } = authParams;
|
15
|
+
const { objectType, recordId } = params;
|
16
|
+
if (!authToken || !baseUrl) {
|
17
|
+
return {
|
18
|
+
success: false,
|
19
|
+
error: "authToken and baseUrl are required for Salesforce API",
|
20
|
+
};
|
21
|
+
}
|
22
|
+
const url = `${baseUrl}/services/data/v56.0/sobjects/${objectType}/${recordId}`;
|
23
|
+
try {
|
24
|
+
const response = yield axiosClient_1.axiosClient.get(url, {
|
25
|
+
headers: {
|
26
|
+
Authorization: `Bearer ${authToken}`,
|
27
|
+
},
|
28
|
+
});
|
29
|
+
return {
|
30
|
+
success: true,
|
31
|
+
record: response.data,
|
32
|
+
};
|
33
|
+
}
|
34
|
+
catch (error) {
|
35
|
+
console.error("Error retrieving Salesforce record:", error);
|
36
|
+
return {
|
37
|
+
success: false,
|
38
|
+
error: error instanceof Error ? error.message : "An unknown error occurred",
|
39
|
+
};
|
40
|
+
}
|
41
|
+
});
|
42
|
+
exports.default = getRecord;
|
@@ -0,0 +1,42 @@
|
|
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 updateRecord = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
|
+
const { authToken, baseUrl } = authParams;
|
15
|
+
const { objectType, recordId, fieldsToUpdate } = params;
|
16
|
+
if (!authToken || !baseUrl) {
|
17
|
+
return {
|
18
|
+
success: false,
|
19
|
+
error: "authToken and baseUrl are required for Salesforce API",
|
20
|
+
};
|
21
|
+
}
|
22
|
+
const url = `${baseUrl}/services/data/v56.0/sobjects/${objectType}/${recordId}`;
|
23
|
+
try {
|
24
|
+
yield axiosClient_1.axiosClient.patch(url, fieldsToUpdate, {
|
25
|
+
headers: {
|
26
|
+
Authorization: `Bearer ${authToken}`,
|
27
|
+
"Content-Type": "application/json",
|
28
|
+
},
|
29
|
+
});
|
30
|
+
return {
|
31
|
+
success: true,
|
32
|
+
};
|
33
|
+
}
|
34
|
+
catch (error) {
|
35
|
+
console.error("Error updating Salesforce record:", error);
|
36
|
+
return {
|
37
|
+
success: false,
|
38
|
+
error: error instanceof Error ? error.message : "An unknown error occurred",
|
39
|
+
};
|
40
|
+
}
|
41
|
+
});
|
42
|
+
exports.default = updateRecord;
|
@@ -0,0 +1,33 @@
|
|
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 getChannelMessages = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
15
|
+
const client = new web_api_1.WebClient(authParams.authToken);
|
16
|
+
const { channelName, oldest } = params;
|
17
|
+
const allChannels = yield (0, helpers_1.getSlackChannels)(client);
|
18
|
+
const channel = allChannels.find(channel => channel.name === channelName && channel.is_private === false);
|
19
|
+
if (!channel || !channel.id) {
|
20
|
+
throw Error(`Channel with name ${channelName} not found`);
|
21
|
+
}
|
22
|
+
const messages = yield client.conversations.history({
|
23
|
+
channel: channel.id,
|
24
|
+
oldest: oldest,
|
25
|
+
});
|
26
|
+
if (!messages.ok) {
|
27
|
+
throw Error(`Failed to fetch messages from channel ${channel.name}`);
|
28
|
+
}
|
29
|
+
return {
|
30
|
+
messages: messages.messages,
|
31
|
+
};
|
32
|
+
});
|
33
|
+
exports.default = getChannelMessages;
|
@@ -0,0 +1,23 @@
|
|
1
|
+
declare const axios: any;
|
2
|
+
declare const WORKDAY_BASE_URL = "https://your-workday-url/ccx/service/YOUR_TENANT/Absence_Management/v43.2";
|
3
|
+
declare const TOKEN_URL = "https://your-workday-url/oauth2/YOUR_TENANT/token";
|
4
|
+
declare const CLIENT_ID = "your-client-id";
|
5
|
+
declare const CLIENT_SECRET = "your-client-secret";
|
6
|
+
/**
|
7
|
+
* Fetches an OAuth 2.0 access token from Workday.
|
8
|
+
*/
|
9
|
+
declare function getAccessToken(): Promise<any>;
|
10
|
+
/**
|
11
|
+
* Submits a time-off request to Workday.
|
12
|
+
* @param {Object} params - Time-off details.
|
13
|
+
* @param {string} params.workerId - Worker's ID in Workday.
|
14
|
+
* @param {string} params.startDate - Start date (YYYY-MM-DD).
|
15
|
+
* @param {string} params.endDate - End date (YYYY-MM-DD).
|
16
|
+
* @param {string} params.timeOffType - Time-off type (e.g., "SICK_LEAVE").
|
17
|
+
*/
|
18
|
+
declare function submitTimeOff({ workerId, startDate, endDate, timeOffType }: {
|
19
|
+
workerId: any;
|
20
|
+
startDate: any;
|
21
|
+
endDate: any;
|
22
|
+
timeOffType: any;
|
23
|
+
}): Promise<any>;
|
@@ -0,0 +1,88 @@
|
|
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
|
+
const axios = require("axios");
|
12
|
+
const WORKDAY_BASE_URL = "https://your-workday-url/ccx/service/YOUR_TENANT/Absence_Management/v43.2";
|
13
|
+
const TOKEN_URL = "https://your-workday-url/oauth2/YOUR_TENANT/token"; // OAuth token endpoint
|
14
|
+
const CLIENT_ID = "your-client-id";
|
15
|
+
const CLIENT_SECRET = "your-client-secret";
|
16
|
+
/**
|
17
|
+
* Fetches an OAuth 2.0 access token from Workday.
|
18
|
+
*/
|
19
|
+
function getAccessToken() {
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
21
|
+
var _a;
|
22
|
+
try {
|
23
|
+
const response = yield axios.post(TOKEN_URL, new URLSearchParams({ grant_type: "client_credentials" }), {
|
24
|
+
auth: {
|
25
|
+
username: CLIENT_ID,
|
26
|
+
password: CLIENT_SECRET
|
27
|
+
},
|
28
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" }
|
29
|
+
});
|
30
|
+
return response.data.access_token;
|
31
|
+
}
|
32
|
+
catch (error) {
|
33
|
+
console.error("Error fetching access token:", ((_a = error.response) === null || _a === void 0 ? void 0 : _a.data) || error.message);
|
34
|
+
throw error;
|
35
|
+
}
|
36
|
+
});
|
37
|
+
}
|
38
|
+
/**
|
39
|
+
* Submits a time-off request to Workday.
|
40
|
+
* @param {Object} params - Time-off details.
|
41
|
+
* @param {string} params.workerId - Worker's ID in Workday.
|
42
|
+
* @param {string} params.startDate - Start date (YYYY-MM-DD).
|
43
|
+
* @param {string} params.endDate - End date (YYYY-MM-DD).
|
44
|
+
* @param {string} params.timeOffType - Time-off type (e.g., "SICK_LEAVE").
|
45
|
+
*/
|
46
|
+
function submitTimeOff(_a) {
|
47
|
+
return __awaiter(this, arguments, void 0, function* ({ workerId, startDate, endDate, timeOffType }) {
|
48
|
+
var _b;
|
49
|
+
try {
|
50
|
+
const token = yield getAccessToken(); // Get OAuth token
|
51
|
+
const requestBody = {
|
52
|
+
"wd:Enter_Time_Off_Request": {
|
53
|
+
"wd:Worker_Reference": {
|
54
|
+
"wd:ID": [{ "_": workerId, "$": { "wd:type": "WID" } }]
|
55
|
+
},
|
56
|
+
"wd:Time_Off_Entries": [
|
57
|
+
{
|
58
|
+
"wd:Start_Date": startDate,
|
59
|
+
"wd:End_Date": endDate,
|
60
|
+
"wd:Time_Off_Type_Reference": {
|
61
|
+
"wd:ID": [{ "_": timeOffType, "$": { "wd:type": "Time_Off_Type_ID" } }]
|
62
|
+
}
|
63
|
+
}
|
64
|
+
]
|
65
|
+
}
|
66
|
+
};
|
67
|
+
const response = yield axios.post(`${WORKDAY_BASE_URL}/Enter_Time_Off`, requestBody, {
|
68
|
+
headers: {
|
69
|
+
"Authorization": `Bearer ${token}`,
|
70
|
+
"Content-Type": "application/json"
|
71
|
+
}
|
72
|
+
});
|
73
|
+
console.log("Time-off request submitted successfully:", response.data);
|
74
|
+
return response.data;
|
75
|
+
}
|
76
|
+
catch (error) {
|
77
|
+
console.error("Error submitting time-off request:", ((_b = error.response) === null || _b === void 0 ? void 0 : _b.data) || error.message);
|
78
|
+
throw error;
|
79
|
+
}
|
80
|
+
});
|
81
|
+
}
|
82
|
+
// Example Usage:
|
83
|
+
submitTimeOff({
|
84
|
+
workerId: "12345",
|
85
|
+
startDate: "2025-03-10",
|
86
|
+
endDate: "2025-03-12",
|
87
|
+
timeOffType: "SICK_LEAVE"
|
88
|
+
}).then(console.log).catch(console.error);
|
@@ -0,0 +1,37 @@
|
|
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 addCommentToTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
|
+
const { authToken, username } = authParams;
|
15
|
+
const { subdomain, ticketId, comment } = params;
|
16
|
+
const url = `https://${subdomain}.zendesk.com/api/v2/tickets/${ticketId}.json`;
|
17
|
+
if (!authToken) {
|
18
|
+
throw new Error("authToken is required");
|
19
|
+
}
|
20
|
+
yield axiosClient_1.axiosClient.request({
|
21
|
+
url: url,
|
22
|
+
method: "PUT",
|
23
|
+
auth: {
|
24
|
+
username: `${username}/token`,
|
25
|
+
password: authToken,
|
26
|
+
},
|
27
|
+
headers: {
|
28
|
+
"Content-Type": "application/json",
|
29
|
+
},
|
30
|
+
data: {
|
31
|
+
ticket: {
|
32
|
+
comment: comment,
|
33
|
+
},
|
34
|
+
},
|
35
|
+
});
|
36
|
+
});
|
37
|
+
exports.default = addCommentToTicket;
|
@@ -0,0 +1,37 @@
|
|
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 updateTicketStatus = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
|
+
const { authToken, username } = authParams;
|
15
|
+
const { subdomain, ticketId, assigneeEmail } = params;
|
16
|
+
const url = `https://${subdomain}.zendesk.com/api/v2/tickets/${ticketId}.json`;
|
17
|
+
if (!authToken) {
|
18
|
+
throw new Error("authToken is required");
|
19
|
+
}
|
20
|
+
yield axiosClient_1.axiosClient.request({
|
21
|
+
url: url,
|
22
|
+
method: "PUT",
|
23
|
+
auth: {
|
24
|
+
username: `${username}/token`,
|
25
|
+
password: authToken,
|
26
|
+
},
|
27
|
+
headers: {
|
28
|
+
"Content-Type": "application/json",
|
29
|
+
},
|
30
|
+
data: {
|
31
|
+
ticket: {
|
32
|
+
assignee_email: assigneeEmail,
|
33
|
+
},
|
34
|
+
},
|
35
|
+
});
|
36
|
+
});
|
37
|
+
exports.default = updateTicketStatus;
|
@@ -0,0 +1,35 @@
|
|
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 getZendeskTicketDetails = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
|
+
const { authToken, username } = authParams;
|
15
|
+
const { subdomain, ticketId } = params;
|
16
|
+
const url = `https://${subdomain}.zendesk.com/api/v2/tickets/${ticketId}.json`;
|
17
|
+
if (!authToken) {
|
18
|
+
throw new Error("Auth token is required");
|
19
|
+
}
|
20
|
+
const response = yield axiosClient_1.axiosClient.request({
|
21
|
+
url: url,
|
22
|
+
method: "GET",
|
23
|
+
auth: {
|
24
|
+
username: `${username}/token`,
|
25
|
+
password: authToken,
|
26
|
+
},
|
27
|
+
headers: {
|
28
|
+
"Content-Type": "application/json",
|
29
|
+
},
|
30
|
+
});
|
31
|
+
return {
|
32
|
+
ticket: response.data.ticket,
|
33
|
+
};
|
34
|
+
});
|
35
|
+
exports.default = getZendeskTicketDetails;
|
@@ -0,0 +1,37 @@
|
|
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 updateTicketStatus = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
|
+
const { authToken, username } = authParams;
|
15
|
+
const { subdomain, ticketId, status } = params;
|
16
|
+
const url = `https://${subdomain}.zendesk.com/api/v2/tickets/${ticketId}.json`;
|
17
|
+
if (!authToken) {
|
18
|
+
throw new Error("Auth token is required");
|
19
|
+
}
|
20
|
+
yield axiosClient_1.axiosClient.request({
|
21
|
+
url: url,
|
22
|
+
method: "PUT",
|
23
|
+
auth: {
|
24
|
+
username: `${username}/token`,
|
25
|
+
password: authToken,
|
26
|
+
},
|
27
|
+
headers: {
|
28
|
+
"Content-Type": "application/json",
|
29
|
+
},
|
30
|
+
data: {
|
31
|
+
ticket: {
|
32
|
+
status: status,
|
33
|
+
},
|
34
|
+
},
|
35
|
+
});
|
36
|
+
});
|
37
|
+
exports.default = updateTicketStatus;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@credal/actions",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.32",
|
4
4
|
"description": "AI Actions by Credal AI",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"types": "dist/index.d.ts",
|
@@ -24,6 +24,7 @@
|
|
24
24
|
"devDependencies": {
|
25
25
|
"@eslint/js": "^9.16.0",
|
26
26
|
"@types/js-yaml": "^4.0.9",
|
27
|
+
"@types/jsonwebtoken": "^9.0.9",
|
27
28
|
"@types/node": "^22.10.1",
|
28
29
|
"@typescript-eslint/eslint-plugin": "^8.18.0",
|
29
30
|
"@typescript-eslint/parser": "^8.18.0",
|
@@ -40,15 +41,19 @@
|
|
40
41
|
"dependencies": {
|
41
42
|
"@credal/sdk": "^0.0.21",
|
42
43
|
"@mendable/firecrawl-js": "^1.19.0",
|
44
|
+
"@microsoft/microsoft-graph-client": "^3.0.7",
|
43
45
|
"@slack/web-api": "^7.8.0",
|
44
46
|
"@types/snowflake-sdk": "^1.6.24",
|
45
47
|
"ajv": "^8.17.1",
|
46
48
|
"date-fns": "^4.1.0",
|
49
|
+
"dotenv": "^16.4.7",
|
47
50
|
"json-schema-to-zod": "^2.5.0",
|
51
|
+
"jsonwebtoken": "^9.0.2",
|
48
52
|
"mongodb": "^6.13.1",
|
49
53
|
"resend": "^4.1.2",
|
50
54
|
"snowflake-sdk": "^2.0.2",
|
51
55
|
"ts-node": "^10.9.2",
|
56
|
+
"uuid": "^11.1.0",
|
52
57
|
"zod": "^3.24.1"
|
53
58
|
}
|
54
59
|
}
|
@@ -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;
|