@credal/actions 0.1.72 → 0.1.75
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 +12 -4
- package/dist/actions/autogen/templates.d.ts +1 -0
- package/dist/actions/autogen/templates.js +37 -2
- package/dist/actions/autogen/types.d.ts +30 -7
- package/dist/actions/autogen/types.js +13 -4
- package/dist/actions/groups.js +4 -0
- package/dist/actions/invoke.js +4 -0
- package/dist/actions/providers/asana/commentAsanaTask.js +3 -2
- package/dist/actions/providers/asana/createAsanaTask.js +3 -2
- package/dist/actions/providers/asana/updateAsanaTask.js +3 -2
- package/dist/actions/providers/ashby/addCandidateToProject.js +2 -1
- package/dist/actions/providers/ashby/createCandidate.js +2 -4
- package/dist/actions/providers/ashby/createNote.js +2 -1
- package/dist/actions/providers/ashby/getCandidateInfo.js +2 -1
- package/dist/actions/providers/ashby/listCandidateNotes.js +2 -1
- package/dist/actions/providers/ashby/listCandidates.js +2 -1
- package/dist/actions/providers/ashby/searchCandidates.js +2 -1
- package/dist/actions/providers/ashby/updateCandidate.js +2 -4
- package/dist/actions/providers/confluence/fetchPageContent.js +2 -1
- package/dist/actions/providers/confluence/overwritePage.js +2 -1
- package/dist/actions/providers/firecrawl/scrapeTweetDataWithNitter.js +2 -1
- package/dist/actions/providers/github/createBranch.js +2 -1
- package/dist/actions/providers/github/createOrUpdateFile.js +2 -1
- package/dist/actions/providers/github/createPullRequest.js +2 -1
- package/dist/actions/providers/github/listPullRequests.js +4 -0
- package/dist/actions/providers/gong/getGongTranscripts.js +42 -10
- package/dist/actions/providers/google-oauth/createNewGoogleDoc.js +2 -1
- package/dist/actions/providers/google-oauth/createPresentation.js +2 -1
- package/dist/actions/providers/google-oauth/createSpreadsheet.js +2 -1
- package/dist/actions/providers/google-oauth/scheduleCalendarMeeting.js +2 -1
- package/dist/actions/providers/google-oauth/updateDoc.js +2 -1
- package/dist/actions/providers/google-oauth/updatePresentation.js +2 -1
- package/dist/actions/providers/google-oauth/updateSpreadsheet.js +2 -1
- package/dist/actions/providers/jamf/getComputerInventory.d.ts +3 -0
- package/dist/actions/providers/{salesforce/getSalesforceRecordByQuery.js → jamf/getComputerInventory.js} +16 -14
- package/dist/actions/providers/jamf/getFileVaultRecoveryKey.d.ts +3 -0
- package/dist/actions/providers/jamf/getFileVaultRecoveryKey.js +40 -0
- package/dist/actions/providers/jira/commentJiraTicket.js +2 -2
- package/dist/actions/providers/jira/createJiraTicket.js +2 -2
- package/dist/actions/providers/jira/getJiraIssuesByQuery.js +3 -0
- package/dist/actions/providers/jira/getJiraTicketDetails.js +2 -2
- package/dist/actions/providers/jira/getJiraTicketHistory.js +2 -2
- package/dist/actions/providers/jira/updateJiraTicketDetails.js +2 -2
- package/dist/actions/providers/jira/updateJiraTicketStatus.js +2 -2
- package/dist/actions/providers/kandji/getFVRecoveryKeyForDevice.d.ts +3 -0
- package/dist/actions/providers/kandji/getFVRecoveryKeyForDevice.js +88 -0
- package/dist/actions/providers/microsoft/messageTeamsChannel.js +0 -15
- package/dist/actions/providers/microsoft/messageTeamsChat.js +0 -12
- package/dist/actions/providers/salesforce/createRecord.js +0 -6
- package/dist/actions/providers/slack/getChannelMessages.js +4 -0
- package/dist/actions/providers/slack/sendMessage.js +4 -0
- package/dist/actions/providers/snowflake/getRowByFieldValue.js +2 -1
- package/dist/actions/providers/snowflake/runSnowflakeQuery.js +0 -3
- package/dist/actions/providers/zendesk/addCommentToTicket.js +2 -1
- package/dist/actions/providers/zendesk/assignTicket.js +2 -1
- package/dist/actions/providers/zendesk/createZendeskTicket.js +2 -1
- package/dist/actions/providers/zendesk/getTicketDetails.js +2 -1
- package/dist/actions/providers/zendesk/listTickets.js +2 -1
- package/dist/actions/providers/zendesk/updateTicketStatus.js +2 -1
- package/dist/actions/util/missingAuthConstants.d.ts +2 -0
- package/dist/actions/util/missingAuthConstants.js +5 -0
- package/package.json +1 -1
- package/dist/actions/providers/salesforce/getSalesforceRecordByQuery.d.ts +0 -3
@@ -55,6 +55,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
55
55
|
Object.defineProperty(exports, "__esModule", { value: true });
|
56
56
|
const axios_1 = __importStar(require("axios"));
|
57
57
|
const zod_1 = require("zod");
|
58
|
+
const missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
58
59
|
const UserSchema = zod_1.z
|
59
60
|
.object({
|
60
61
|
id: zod_1.z.string(),
|
@@ -78,22 +79,37 @@ const CallSchema = zod_1.z
|
|
78
79
|
primaryUserId: zod_1.z.string(),
|
79
80
|
started: zod_1.z.string(),
|
80
81
|
}),
|
82
|
+
parties: zod_1.z.array(zod_1.z
|
83
|
+
.object({
|
84
|
+
id: zod_1.z.string(),
|
85
|
+
name: zod_1.z.string(),
|
86
|
+
userId: zod_1.z.string(),
|
87
|
+
speakerId: zod_1.z.string().nullable(),
|
88
|
+
})
|
89
|
+
.partial()
|
90
|
+
.passthrough()),
|
81
91
|
})
|
82
92
|
.partial()
|
83
93
|
.passthrough();
|
84
|
-
const SentenceSchema = zod_1.z
|
94
|
+
const SentenceSchema = zod_1.z
|
95
|
+
.object({
|
85
96
|
start: zod_1.z.number(),
|
86
97
|
end: zod_1.z.number(),
|
87
98
|
text: zod_1.z.string(),
|
88
|
-
})
|
99
|
+
})
|
100
|
+
.partial()
|
101
|
+
.passthrough();
|
89
102
|
const TranscriptSchema = zod_1.z
|
90
103
|
.object({
|
91
104
|
callId: zod_1.z.string(),
|
92
|
-
transcript: zod_1.z.array(zod_1.z
|
93
|
-
|
94
|
-
|
105
|
+
transcript: zod_1.z.array(zod_1.z
|
106
|
+
.object({
|
107
|
+
speakerId: zod_1.z.string(),
|
108
|
+
topic: zod_1.z.string().nullable(),
|
95
109
|
sentences: zod_1.z.array(SentenceSchema),
|
96
|
-
})
|
110
|
+
})
|
111
|
+
.partial()
|
112
|
+
.passthrough()),
|
97
113
|
})
|
98
114
|
.partial()
|
99
115
|
.passthrough();
|
@@ -165,6 +181,11 @@ function getCalls(authToken_1) {
|
|
165
181
|
do {
|
166
182
|
const response = yield axios_1.default.post(`https://api.gong.io/v2/calls/extensive` + (cursor ? `?cursor=${cursor}` : ""), {
|
167
183
|
filter: Object.assign({}, params),
|
184
|
+
contentSelector: {
|
185
|
+
exposedFields: {
|
186
|
+
parties: true,
|
187
|
+
},
|
188
|
+
},
|
168
189
|
}, {
|
169
190
|
headers: {
|
170
191
|
Authorization: `Bearer ${authToken}`,
|
@@ -220,7 +241,7 @@ const getGongTranscripts = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
220
241
|
if (!authParams.authToken) {
|
221
242
|
return {
|
222
243
|
success: false,
|
223
|
-
error:
|
244
|
+
error: missingAuthConstants_1.MISSING_AUTH_TOKEN,
|
224
245
|
};
|
225
246
|
}
|
226
247
|
try {
|
@@ -245,15 +266,26 @@ const getGongTranscripts = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
245
266
|
callIds: calls.map(call => { var _a; return (_a = call.metaData) === null || _a === void 0 ? void 0 : _a.id; }).filter((id) => id !== undefined),
|
246
267
|
});
|
247
268
|
// Map speaker IDs to names in the transcripts
|
248
|
-
const userIdToNameMap =
|
269
|
+
const userIdToNameMap = {};
|
270
|
+
calls.forEach(call => {
|
271
|
+
// Check if call has parties array
|
272
|
+
if (call.parties && Array.isArray(call.parties)) {
|
273
|
+
// Iterate through each party in the call
|
274
|
+
call.parties.forEach(party => {
|
275
|
+
// Add the mapping of speakerId to name
|
276
|
+
if (party.speakerId && party.name) {
|
277
|
+
userIdToNameMap[party.speakerId] = party.name;
|
278
|
+
}
|
279
|
+
});
|
280
|
+
}
|
281
|
+
});
|
249
282
|
const callTranscriptsWithNames = callTranscripts.map(callTranscript => {
|
250
283
|
var _a;
|
251
284
|
const currTranscript = Object.assign({}, callTranscript);
|
252
285
|
currTranscript.transcript = (_a = callTranscript.transcript) === null || _a === void 0 ? void 0 : _a.map(transcript => {
|
253
286
|
var _a;
|
254
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
255
287
|
const { speakerId } = transcript, rest = __rest(transcript, ["speakerId"]);
|
256
|
-
return Object.assign(Object.assign({}, rest), { speakerName:
|
288
|
+
return Object.assign(Object.assign({}, rest), { speakerName: (_a = userIdToNameMap[speakerId !== null && speakerId !== void 0 ? speakerId : ""]) !== null && _a !== void 0 ? _a : "Unknown" });
|
257
289
|
});
|
258
290
|
return currTranscript;
|
259
291
|
});
|
@@ -10,12 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
const axiosClient_1 = require("../../util/axiosClient");
|
13
|
+
const missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
13
14
|
/**
|
14
15
|
* Creates a new Google Doc document using OAuth authentication
|
15
16
|
*/
|
16
17
|
const createNewGoogleDoc = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
17
18
|
if (!authParams.authToken) {
|
18
|
-
throw new Error(
|
19
|
+
throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
|
19
20
|
}
|
20
21
|
const { title, content } = params;
|
21
22
|
const baseApiUrl = "https://docs.googleapis.com/v1/documents";
|
@@ -10,12 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
const axiosClient_1 = require("../../util/axiosClient");
|
13
|
+
const missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
13
14
|
/**
|
14
15
|
* Creates a new Google Slides presentation using OAuth authentication
|
15
16
|
*/
|
16
17
|
const createPresentation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
17
18
|
if (!authParams.authToken) {
|
18
|
-
throw new Error(
|
19
|
+
throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
|
19
20
|
}
|
20
21
|
const { title, pageSize } = params;
|
21
22
|
const baseApiUrl = "https://slides.googleapis.com/v1/presentations";
|
@@ -13,12 +13,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
13
|
};
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
15
|
const axios_1 = __importDefault(require("axios"));
|
16
|
+
const missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
16
17
|
/**
|
17
18
|
* Creates a new Google Spreadsheet using OAuth authentication
|
18
19
|
*/
|
19
20
|
const createSpreadsheet = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
20
21
|
if (!authParams.authToken) {
|
21
|
-
throw new Error(
|
22
|
+
throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
|
22
23
|
}
|
23
24
|
const { title, sheets = [], properties = {} } = params;
|
24
25
|
const baseApiUrl = "https://sheets.googleapis.com/v4/spreadsheets";
|
@@ -11,12 +11,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
const uuid_1 = require("uuid");
|
13
13
|
const axiosClient_1 = require("../../util/axiosClient");
|
14
|
+
const missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
14
15
|
/**
|
15
16
|
* Creates a new Google calendar event using OAuth authentication
|
16
17
|
*/
|
17
18
|
const scheduleCalendarMeeting = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
18
19
|
if (!authParams.authToken) {
|
19
|
-
throw new Error(
|
20
|
+
throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
|
20
21
|
}
|
21
22
|
const { calendarId, name, start, end, description, attendees, useGoogleMeet } = params;
|
22
23
|
// https://developers.google.com/calendar/api/v3/reference/events/insert
|
@@ -13,6 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
13
|
};
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
15
|
const axios_1 = __importDefault(require("axios"));
|
16
|
+
const missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
16
17
|
/**
|
17
18
|
* Updates an existing Google Docs document using OAuth authentication with batch requests
|
18
19
|
* https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate
|
@@ -22,7 +23,7 @@ const updateDoc = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, a
|
|
22
23
|
return {
|
23
24
|
success: false,
|
24
25
|
documentId: params.documentId,
|
25
|
-
error:
|
26
|
+
error: missingAuthConstants_1.MISSING_AUTH_TOKEN,
|
26
27
|
};
|
27
28
|
}
|
28
29
|
const { documentId, requests } = params;
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
const axiosClient_1 = require("../../util/axiosClient");
|
13
|
+
const missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
13
14
|
/**
|
14
15
|
* Updates an existing Google Slides presentation using OAuth authentication with batch requests
|
15
16
|
* https://developers.google.com/slides/api/reference/rest/v1/presentations/batchUpdate
|
@@ -18,7 +19,7 @@ const updatePresentation = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
18
19
|
if (!authParams.authToken) {
|
19
20
|
return {
|
20
21
|
success: false,
|
21
|
-
error:
|
22
|
+
error: missingAuthConstants_1.MISSING_AUTH_TOKEN,
|
22
23
|
};
|
23
24
|
}
|
24
25
|
const { presentationId, requests } = params;
|
@@ -10,13 +10,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
const axiosClient_1 = require("../../util/axiosClient");
|
13
|
+
const missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
13
14
|
/**
|
14
15
|
* Update a Google Spreadsheet using OAuth authentication
|
15
16
|
* https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets/batchUpdate
|
16
17
|
*/
|
17
18
|
const updateSpreadsheet = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
18
19
|
if (!authParams.authToken) {
|
19
|
-
throw new Error(
|
20
|
+
throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
|
20
21
|
}
|
21
22
|
const { spreadsheetId, requests } = params;
|
22
23
|
const batchUpdateUrl = `https://sheets.googleapis.com/v4/spreadsheets/${spreadsheetId}:batchUpdate`;
|
@@ -10,34 +10,36 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
const axiosClient_1 = require("../../util/axiosClient");
|
13
|
-
const
|
13
|
+
const getComputerInventory = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
14
|
const { authToken, baseUrl } = authParams;
|
15
|
-
const {
|
16
|
-
if (!
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
const { section } = params;
|
16
|
+
if (!baseUrl) {
|
17
|
+
throw new Error("Base URL is required to fetch computer inventory");
|
18
|
+
}
|
19
|
+
const apiUrl = `${baseUrl}/v1/computer-inventory`;
|
20
|
+
const queryParams = {};
|
21
|
+
if (section) {
|
22
|
+
queryParams.section = section;
|
21
23
|
}
|
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
24
|
try {
|
25
|
-
const response = yield axiosClient_1.axiosClient.get(
|
25
|
+
const response = yield axiosClient_1.axiosClient.get(apiUrl, {
|
26
26
|
headers: {
|
27
27
|
Authorization: `Bearer ${authToken}`,
|
28
|
+
Accept: "application/json",
|
28
29
|
},
|
30
|
+
params: queryParams,
|
29
31
|
});
|
30
32
|
return {
|
31
33
|
success: true,
|
32
|
-
|
34
|
+
data: response.data,
|
33
35
|
};
|
34
36
|
}
|
35
37
|
catch (error) {
|
36
|
-
console.error("Error retrieving
|
38
|
+
console.error("Error retrieving computer inventory: ", error);
|
37
39
|
return {
|
38
40
|
success: false,
|
39
|
-
error: error instanceof Error ? error.message : "
|
41
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
40
42
|
};
|
41
43
|
}
|
42
44
|
});
|
43
|
-
exports.default =
|
45
|
+
exports.default = getComputerInventory;
|
@@ -0,0 +1,40 @@
|
|
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 getFileVaultRecoveryKey = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
|
+
const { authToken, baseUrl } = authParams;
|
15
|
+
const { computerId } = params;
|
16
|
+
if (!baseUrl || !computerId) {
|
17
|
+
throw new Error("Base URL and Computer ID are required to fetch FileVault2 recovery key");
|
18
|
+
}
|
19
|
+
const apiUrl = `${baseUrl}/JSSResource/computers/${computerId}/FileVault2RecoveryKey`;
|
20
|
+
try {
|
21
|
+
const response = yield axiosClient_1.axiosClient.get(apiUrl, {
|
22
|
+
headers: {
|
23
|
+
Authorization: `Bearer ${authToken}`,
|
24
|
+
Accept: "application/json",
|
25
|
+
},
|
26
|
+
});
|
27
|
+
return {
|
28
|
+
success: true,
|
29
|
+
data: response.data,
|
30
|
+
};
|
31
|
+
}
|
32
|
+
catch (error) {
|
33
|
+
console.error("Error retrieving FileVault2 recovery key: ", error);
|
34
|
+
return {
|
35
|
+
success: false,
|
36
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
37
|
+
};
|
38
|
+
}
|
39
|
+
});
|
40
|
+
exports.default = getFileVaultRecoveryKey;
|
@@ -12,8 +12,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const axiosClient_1 = require("../../util/axiosClient");
|
13
13
|
const commentJiraTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
14
|
const { authToken, cloudId, baseUrl } = authParams;
|
15
|
-
if (!cloudId || !
|
16
|
-
throw new Error("Cloud ID and
|
15
|
+
if (!cloudId || !authToken) {
|
16
|
+
throw new Error("Valid Cloud ID and auth token are required to comment on Jira ticket");
|
17
17
|
}
|
18
18
|
const apiUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/issue/${params.issueId}/comment`;
|
19
19
|
try {
|
@@ -14,8 +14,8 @@ const utils_1 = require("./utils");
|
|
14
14
|
const createJiraTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
15
15
|
const { authToken, cloudId, baseUrl } = authParams;
|
16
16
|
const apiUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/`;
|
17
|
-
if (!cloudId) {
|
18
|
-
throw new Error("Cloud ID
|
17
|
+
if (!cloudId || !authToken) {
|
18
|
+
throw new Error("Valid Cloud ID and auth token are required to comment on Jira ticket");
|
19
19
|
}
|
20
20
|
// If assignee is an email, look up the account ID
|
21
21
|
let reporterId = null;
|
@@ -14,6 +14,9 @@ const DEFAULT_LIMIT = 1000;
|
|
14
14
|
const getJiraIssuesByQuery = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
15
15
|
const { authToken, cloudId } = authParams;
|
16
16
|
const { query, limit } = params;
|
17
|
+
if (!cloudId || !authToken) {
|
18
|
+
throw new Error("Valid Cloud ID and auth token are required to comment on Jira ticket");
|
19
|
+
}
|
17
20
|
const queryParams = new URLSearchParams();
|
18
21
|
queryParams.set("jql", query);
|
19
22
|
queryParams.set("maxResults", String(limit != undefined && limit <= DEFAULT_LIMIT ? limit : DEFAULT_LIMIT));
|
@@ -13,8 +13,8 @@ const axiosClient_1 = require("../../util/axiosClient");
|
|
13
13
|
const getJiraTicketDetails = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
14
|
const { authToken, cloudId } = authParams;
|
15
15
|
const { issueId } = params;
|
16
|
-
if (!cloudId || !
|
17
|
-
throw new Error("Cloud ID and
|
16
|
+
if (!cloudId || !authToken) {
|
17
|
+
throw new Error("Valid Cloud ID and auth token are required to comment on Jira ticket");
|
18
18
|
}
|
19
19
|
const apiUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/issue/${issueId}`;
|
20
20
|
try {
|
@@ -14,8 +14,8 @@ const getJiraTicketHistory = (_a) => __awaiter(void 0, [_a], void 0, function* (
|
|
14
14
|
var _b;
|
15
15
|
const { authToken, cloudId } = authParams;
|
16
16
|
const { issueId } = params;
|
17
|
-
if (!cloudId || !
|
18
|
-
throw new Error("Cloud ID and
|
17
|
+
if (!cloudId || !authToken) {
|
18
|
+
throw new Error("Valid Cloud ID and auth token are required to comment on Jira ticket");
|
19
19
|
}
|
20
20
|
const apiUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/issue/${issueId}/changelog`;
|
21
21
|
try {
|
@@ -13,8 +13,8 @@ const axiosClient_1 = require("../../util/axiosClient");
|
|
13
13
|
const updateJiraTicketDetails = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
14
|
const { authToken, cloudId, baseUrl } = authParams;
|
15
15
|
const { issueId, summary, description, customFields } = params;
|
16
|
-
if (!cloudId || !
|
17
|
-
throw new Error("Cloud ID and
|
16
|
+
if (!cloudId || !authToken) {
|
17
|
+
throw new Error("Valid Cloud ID and auth token are required to comment on Jira ticket");
|
18
18
|
}
|
19
19
|
const apiUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/issue/${issueId}`;
|
20
20
|
const formattedDescription = description
|
@@ -12,8 +12,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const axiosClient_1 = require("../../util/axiosClient");
|
13
13
|
const updateJiraTicketStatus = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
14
|
const { authToken, cloudId, baseUrl } = authParams;
|
15
|
-
if (!cloudId || !
|
16
|
-
throw new Error("Cloud ID
|
15
|
+
if (!cloudId || !authToken) {
|
16
|
+
throw new Error("Valid Cloud ID and auth token are required to comment on Jira ticket");
|
17
17
|
}
|
18
18
|
const { issueId, status } = params;
|
19
19
|
const transitionsUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/issue/${issueId}/transitions`;
|
@@ -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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
const axiosClient_1 = require("../../util/axiosClient");
|
13
|
+
const getFVRecoveryKeyForDevice = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
|
+
const { serialNumber } = params;
|
15
|
+
const { subdomain, apiKey } = authParams;
|
16
|
+
if (!apiKey || !subdomain) {
|
17
|
+
throw new Error("Missing API key or subdomain in auth parameters");
|
18
|
+
}
|
19
|
+
try {
|
20
|
+
// First list all devices to get the device for the specific device
|
21
|
+
const device = yield getDeviceBySerialNumber({
|
22
|
+
apiKey,
|
23
|
+
serialNumber,
|
24
|
+
subdomain,
|
25
|
+
});
|
26
|
+
if (!device) {
|
27
|
+
return {
|
28
|
+
success: false,
|
29
|
+
error: "Device not found for the given serial number",
|
30
|
+
};
|
31
|
+
}
|
32
|
+
// Then get the FV recovery key for that device
|
33
|
+
const fvRecoveryKey = yield axiosClient_1.axiosClient.get(`https://${subdomain}.api.kandji.io/api/v1/devices/${device.device_id}/secrets/filevaultkey`, {
|
34
|
+
headers: {
|
35
|
+
"Content-Type": "application/json",
|
36
|
+
Authorization: `Bearer ${apiKey}`,
|
37
|
+
},
|
38
|
+
});
|
39
|
+
if (!fvRecoveryKey || !fvRecoveryKey.data || !fvRecoveryKey.data.key) {
|
40
|
+
return {
|
41
|
+
success: false,
|
42
|
+
error: "FireVault recovery key not found",
|
43
|
+
};
|
44
|
+
}
|
45
|
+
return {
|
46
|
+
success: true,
|
47
|
+
recoveryKey: fvRecoveryKey.data.key,
|
48
|
+
};
|
49
|
+
}
|
50
|
+
catch (error) {
|
51
|
+
return {
|
52
|
+
success: false,
|
53
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
54
|
+
};
|
55
|
+
}
|
56
|
+
});
|
57
|
+
function getDeviceBySerialNumber(input) {
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
59
|
+
const limit = 300;
|
60
|
+
let offset = 0;
|
61
|
+
const { apiKey, serialNumber, subdomain } = input;
|
62
|
+
while (true) {
|
63
|
+
// Update params
|
64
|
+
const params = { limit, offset };
|
65
|
+
const endpoint = `https://${subdomain}.api.kandji.io/api/v1/devices`;
|
66
|
+
// Check to see if a platform was specified
|
67
|
+
const response = yield axiosClient_1.axiosClient.get(endpoint, {
|
68
|
+
params: Object.assign({}, params),
|
69
|
+
headers: {
|
70
|
+
"Content-Type": "application/json",
|
71
|
+
Authorization: `Bearer ${apiKey}`,
|
72
|
+
},
|
73
|
+
});
|
74
|
+
for (const device of response.data) {
|
75
|
+
if (device.serial_number === serialNumber) {
|
76
|
+
// If the device serial number matches, return the device
|
77
|
+
return device;
|
78
|
+
}
|
79
|
+
}
|
80
|
+
offset += limit;
|
81
|
+
if (response.data.length === 0) {
|
82
|
+
break;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
return null;
|
86
|
+
});
|
87
|
+
}
|
88
|
+
exports.default = getFVRecoveryKeyForDevice;
|
@@ -13,21 +13,6 @@ const templates_1 = require("../../autogen/templates");
|
|
13
13
|
const utils_1 = require("./utils");
|
14
14
|
const sendMessageToTeamsChannel = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
15
15
|
const { channelId, teamId, message } = params;
|
16
|
-
if (!teamId) {
|
17
|
-
return {
|
18
|
-
success: false,
|
19
|
-
error: "Team ID is required to send a message",
|
20
|
-
};
|
21
|
-
}
|
22
|
-
if (!channelId) {
|
23
|
-
return { success: false, error: "Channel ID is required to send a message" };
|
24
|
-
}
|
25
|
-
if (!message) {
|
26
|
-
return {
|
27
|
-
success: false,
|
28
|
-
error: "Message content is required to send a message",
|
29
|
-
};
|
30
|
-
}
|
31
16
|
let client = undefined;
|
32
17
|
try {
|
33
18
|
client = yield (0, utils_1.getGraphClient)(authParams, templates_1.microsoftMessageTeamsChannelDefinition.scopes.join(" "));
|
@@ -13,18 +13,6 @@ const templates_1 = require("../../autogen/templates");
|
|
13
13
|
const utils_1 = require("./utils");
|
14
14
|
const sendMessageToTeamsChat = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
15
15
|
const { chatId, message } = params;
|
16
|
-
if (!chatId) {
|
17
|
-
return {
|
18
|
-
success: false,
|
19
|
-
error: "Chat ID is required to send a message",
|
20
|
-
};
|
21
|
-
}
|
22
|
-
if (!message) {
|
23
|
-
return {
|
24
|
-
success: false,
|
25
|
-
error: "Message content is required to send a message",
|
26
|
-
};
|
27
|
-
}
|
28
16
|
let client = undefined;
|
29
17
|
try {
|
30
18
|
client = yield (0, utils_1.getGraphClient)(authParams, templates_1.microsoftMessageTeamsChatDefinition.scopes.join(" "));
|
@@ -19,12 +19,6 @@ const createRecord = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params
|
|
19
19
|
error: "authToken and baseUrl are required for Salesforce API",
|
20
20
|
};
|
21
21
|
}
|
22
|
-
if (!fieldsToCreate) {
|
23
|
-
return {
|
24
|
-
success: false,
|
25
|
-
error: "fieldsToCreate is required to create a Salesforce object",
|
26
|
-
};
|
27
|
-
}
|
28
22
|
const url = `${baseUrl}/services/data/v56.0/sobjects/${objectType}/`;
|
29
23
|
try {
|
30
24
|
const response = yield axiosClient_1.axiosClient.post(url, fieldsToCreate, {
|
@@ -11,7 +11,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
const web_api_1 = require("@slack/web-api");
|
13
13
|
const helpers_1 = require("./helpers");
|
14
|
+
const missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
14
15
|
const getChannelMessages = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
16
|
+
if (!authParams.authToken) {
|
17
|
+
throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
|
18
|
+
}
|
15
19
|
const client = new web_api_1.WebClient(authParams.authToken);
|
16
20
|
const { channelName, oldest } = params;
|
17
21
|
const allChannels = yield (0, helpers_1.getSlackChannels)(client);
|
@@ -12,7 +12,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const web_api_1 = require("@slack/web-api");
|
13
13
|
const types_1 = require("../../autogen/types");
|
14
14
|
const helpers_1 = require("./helpers");
|
15
|
+
const missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
15
16
|
const sendMessage = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
17
|
+
if (!authParams.authToken) {
|
18
|
+
throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
|
19
|
+
}
|
16
20
|
const client = new web_api_1.WebClient(authParams.authToken);
|
17
21
|
const { channelName, message } = params;
|
18
22
|
const allChannels = yield (0, helpers_1.getSlackChannels)(client);
|
@@ -12,7 +12,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const getSnowflakeConnection_1 = require("./auth/getSnowflakeConnection");
|
13
13
|
const getRowByFieldValue = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
14
|
const { databaseName, tableName, fieldName, warehouse, fieldValue, accountName } = params;
|
15
|
-
if (!accountName || !databaseName || !warehouse
|
15
|
+
if (!accountName || !databaseName || !warehouse) {
|
16
|
+
// TODO: Move these to required params
|
16
17
|
throw new Error("Account name and user are required");
|
17
18
|
}
|
18
19
|
// Set up a connection using snowflake-sdk
|
@@ -18,9 +18,6 @@ const formatDataForCodeInterpreter_1 = require("../../util/formatDataForCodeInte
|
|
18
18
|
snowflake_sdk_1.default.configure({ logLevel: "ERROR" });
|
19
19
|
const runSnowflakeQuery = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
20
20
|
const { databaseName, warehouse, query, accountName, outputFormat = "json", limit } = params;
|
21
|
-
if (!accountName || !databaseName || !warehouse || !query) {
|
22
|
-
throw new Error("Missing required parameters for Snowflake query");
|
23
|
-
}
|
24
21
|
const executeQueryAndFormatData = () => __awaiter(void 0, void 0, void 0, function* () {
|
25
22
|
const formattedQuery = query.trim().replace(/\s+/g, " "); // Normalize all whitespace to single spaces
|
26
23
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
@@ -10,12 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
const axiosClient_1 = require("../../util/axiosClient");
|
13
|
+
const missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
13
14
|
const addCommentToTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
15
|
const { authToken } = authParams;
|
15
16
|
const { subdomain, ticketId, comment } = params;
|
16
17
|
const url = `https://${subdomain}.zendesk.com/api/v2/tickets/${ticketId}.json`;
|
17
18
|
if (!authToken) {
|
18
|
-
throw new Error(
|
19
|
+
throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
|
19
20
|
}
|
20
21
|
yield axiosClient_1.axiosClient.request({
|
21
22
|
url: url,
|
@@ -10,12 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
const axiosClient_1 = require("../../util/axiosClient");
|
13
|
+
const missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
13
14
|
const updateTicketStatus = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
15
|
const { authToken } = authParams;
|
15
16
|
const { subdomain, ticketId, assigneeEmail } = params;
|
16
17
|
const url = `https://${subdomain}.zendesk.com/api/v2/tickets/${ticketId}.json`;
|
17
18
|
if (!authToken) {
|
18
|
-
throw new Error(
|
19
|
+
throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
|
19
20
|
}
|
20
21
|
yield axiosClient_1.axiosClient.request({
|
21
22
|
url: url,
|