@credal/actions 0.2.2 → 0.2.3
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 +374 -380
- package/dist/actions/autogen/templates.js +94 -98
- package/dist/actions/autogen/types.js +1621 -1627
- package/dist/actions/groups.js +88 -91
- package/dist/actions/invoke.js +5 -8
- package/dist/actions/parse.js +28 -33
- package/dist/actions/providers/asana/commentAsanaTask.js +5 -7
- package/dist/actions/providers/asana/createAsanaTask.js +9 -11
- package/dist/actions/providers/asana/getTasksDetails.js +9 -11
- package/dist/actions/providers/asana/listAsanaTasksByProject.js +46 -51
- package/dist/actions/providers/asana/searchAsanaTasks.js +6 -8
- package/dist/actions/providers/asana/updateAsanaTask.js +8 -10
- package/dist/actions/providers/asana/utils.js +7 -12
- package/dist/actions/providers/ashby/addCandidateToProject.js +5 -7
- package/dist/actions/providers/ashby/createCandidate.js +5 -7
- package/dist/actions/providers/ashby/createNote.js +5 -7
- package/dist/actions/providers/ashby/getCandidateInfo.js +5 -7
- package/dist/actions/providers/ashby/listCandidateNotes.js +5 -7
- package/dist/actions/providers/ashby/listCandidates.js +5 -7
- package/dist/actions/providers/ashby/searchCandidates.js +5 -7
- package/dist/actions/providers/ashby/updateCandidate.js +5 -7
- package/dist/actions/providers/bing/getTopNSearchResultUrls.js +5 -7
- package/dist/actions/providers/confluence/fetchPageContent.js +8 -10
- package/dist/actions/providers/confluence/helpers.js +1 -4
- package/dist/actions/providers/confluence/overwritePage.js +9 -11
- package/dist/actions/providers/finnhub/getBasicFinancials.js +6 -8
- package/dist/actions/providers/finnhub/symbolLookup.js +6 -8
- package/dist/actions/providers/firecrawl/deepResearch.js +5 -10
- package/dist/actions/providers/firecrawl/scrapeTweetDataWithNitter.js +5 -10
- package/dist/actions/providers/firecrawl/scrapeUrl.js +5 -10
- package/dist/actions/providers/generic/fillTemplate.js +1 -3
- package/dist/actions/providers/github/createBranch.js +4 -39
- package/dist/actions/providers/github/createOrUpdateFile.js +6 -41
- package/dist/actions/providers/github/createPullRequest.js +4 -39
- package/dist/actions/providers/github/listPullRequests.js +7 -12
- package/dist/actions/providers/gong/getGongTranscripts.js +49 -84
- package/dist/actions/providers/google-oauth/addGroupMember.js +5 -7
- package/dist/actions/providers/google-oauth/createNewGoogleDoc.js +6 -8
- package/dist/actions/providers/google-oauth/createPresentation.js +5 -7
- package/dist/actions/providers/google-oauth/createSpreadsheet.js +5 -10
- package/dist/actions/providers/google-oauth/deleteCalendarEvent.js +5 -7
- package/dist/actions/providers/google-oauth/deleteGroupMember.js +5 -7
- package/dist/actions/providers/google-oauth/getGroup.js +5 -7
- package/dist/actions/providers/google-oauth/hasGroupMember.js +5 -7
- package/dist/actions/providers/google-oauth/listCalendarEvents.js +5 -7
- package/dist/actions/providers/google-oauth/listCalendars.js +5 -7
- package/dist/actions/providers/google-oauth/listGroupMembers.js +5 -7
- package/dist/actions/providers/google-oauth/listGroups.js +5 -7
- package/dist/actions/providers/google-oauth/scheduleCalendarMeeting.js +7 -9
- package/dist/actions/providers/google-oauth/searchDriveByKeywords.js +5 -7
- package/dist/actions/providers/google-oauth/updateCalendarEvent.js +5 -7
- package/dist/actions/providers/google-oauth/updateDoc.js +5 -10
- package/dist/actions/providers/google-oauth/updatePresentation.js +5 -7
- package/dist/actions/providers/google-oauth/updateSpreadsheet.js +5 -7
- package/dist/actions/providers/google-oauth/utils/decodeMessage.js +2 -6
- package/dist/actions/providers/googlemail/listGmailThreads.js +8 -10
- package/dist/actions/providers/googlemail/searchGmailMessages.js +8 -10
- package/dist/actions/providers/googlemaps/nearbysearchRestaurants.js +5 -7
- package/dist/actions/providers/googlemaps/validateAddress.js +3 -5
- package/dist/actions/providers/jamf/getJamfComputerInventory.js +3 -5
- package/dist/actions/providers/jamf/getJamfFileVaultRecoveryKey.js +3 -5
- package/dist/actions/providers/jira/assignJiraTicket.js +5 -10
- package/dist/actions/providers/jira/commentJiraTicket.js +3 -5
- package/dist/actions/providers/jira/createJiraTicket.js +6 -8
- package/dist/actions/providers/jira/getJiraIssuesByQuery.js +4 -6
- package/dist/actions/providers/jira/getJiraTicketDetails.js +3 -5
- package/dist/actions/providers/jira/getJiraTicketHistory.js +3 -5
- package/dist/actions/providers/jira/updateJiraTicketDetails.js +3 -5
- package/dist/actions/providers/jira/updateJiraTicketStatus.js +4 -6
- package/dist/actions/providers/jira/utils.js +3 -6
- package/dist/actions/providers/kandji/getFVRecoveryKeyForDevice.js +4 -6
- package/dist/actions/providers/linkedin/createSharePostLinkedinUrl.js +1 -3
- package/dist/actions/providers/looker/enableUserByEmail.js +5 -7
- package/dist/actions/providers/math/add.js +1 -3
- package/dist/actions/providers/microsoft/createDocument.js +5 -7
- package/dist/actions/providers/microsoft/getDocument.js +3 -5
- package/dist/actions/providers/microsoft/messageTeamsChannel.js +4 -6
- package/dist/actions/providers/microsoft/messageTeamsChat.js +4 -6
- package/dist/actions/providers/microsoft/updateDocument.js +4 -6
- package/dist/actions/providers/microsoft/updateSpreadsheet.js +4 -6
- package/dist/actions/providers/microsoft/utils.js +6 -10
- package/dist/actions/providers/mongodb/insertMongoDoc.js +3 -5
- package/dist/actions/providers/notion/searchByTitle.js +5 -10
- package/dist/actions/providers/nws/getForecastForLocation.js +7 -9
- package/dist/actions/providers/openstreetmap/getLatitudeLongitudeFromLocation.js +3 -5
- package/dist/actions/providers/resend/sendEmail.js +6 -8
- package/dist/actions/providers/salesforce/createCase.js +3 -5
- package/dist/actions/providers/salesforce/createRecord.js +4 -6
- package/dist/actions/providers/salesforce/fetchSalesforceSchema.js +3 -5
- package/dist/actions/providers/salesforce/generateSalesReport.js +3 -5
- package/dist/actions/providers/salesforce/getRecord.js +3 -5
- package/dist/actions/providers/salesforce/getSalesforceRecordsByQuery.js +4 -6
- package/dist/actions/providers/salesforce/updateRecord.js +3 -5
- package/dist/actions/providers/slack/getChannelMessages.js +7 -9
- package/dist/actions/providers/slack/helpers.js +1 -4
- package/dist/actions/providers/slack/sendMessage.js +10 -12
- package/dist/actions/providers/snowflake/auth/getSnowflakeConnection.js +4 -41
- package/dist/actions/providers/snowflake/getRowByFieldValue.js +3 -5
- package/dist/actions/providers/snowflake/runSnowflakeQuery.js +8 -13
- package/dist/actions/providers/x/createXSharePostUrl.js +1 -3
- package/dist/actions/providers/zendesk/addCommentToTicket.js +5 -7
- package/dist/actions/providers/zendesk/assignTicket.js +5 -7
- package/dist/actions/providers/zendesk/createZendeskTicket.js +5 -7
- package/dist/actions/providers/zendesk/getTicketDetails.js +5 -7
- package/dist/actions/providers/zendesk/listTickets.js +5 -7
- package/dist/actions/providers/zendesk/updateTicketStatus.js +5 -7
- package/dist/actions/util/axiosClient.js +4 -11
- package/dist/actions/util/formatDataForCodeInterpreter.js +1 -4
- package/dist/actions/util/missingAuthConstants.js +2 -5
- package/dist/app.js +5 -42
- package/dist/index.js +4 -24
- package/dist/server.d.ts +2 -0
- package/dist/server.js +8 -0
- package/dist/utils/datetime.js +4 -8
- package/dist/utils/string.js +1 -4
- package/package.json +2 -1
- package/dist/actions/providers/credal/callCopilot.d.ts +0 -3
- package/dist/actions/providers/credal/callCopilot.js +0 -36
- package/dist/actions/providers/google-oauth/listGmailThreads.d.ts +0 -3
- package/dist/actions/providers/google-oauth/listGmailThreads.js +0 -98
- package/dist/actions/providers/google-oauth/searchGmailMessages.d.ts +0 -3
- package/dist/actions/providers/google-oauth/searchGmailMessages.js +0 -91
- package/dist/actions/providers/jamf/getComputerInventory.d.ts +0 -3
- package/dist/actions/providers/jamf/getComputerInventory.js +0 -45
- package/dist/actions/providers/jamf/getFileVaultRecoveryKey.d.ts +0 -3
- package/dist/actions/providers/jamf/getFileVaultRecoveryKey.js +0 -40
- package/dist/actions/providers/math/index.d.ts +0 -1
- package/dist/actions/providers/math/index.js +0 -37
- 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
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,9 +7,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
|
13
|
-
const utils_1 = require("./utils");
|
10
|
+
import { axiosClient } from "../../util/axiosClient";
|
11
|
+
import { getUserAccountIdFromEmail } from "./utils";
|
14
12
|
const createJiraTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
15
13
|
const { authToken, cloudId, baseUrl } = authParams;
|
16
14
|
const apiUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/`;
|
@@ -20,12 +18,12 @@ const createJiraTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
20
18
|
// If assignee is an email, look up the account ID
|
21
19
|
let reporterId = null;
|
22
20
|
if (params.reporter && typeof params.reporter === "string" && params.reporter.includes("@") && authToken) {
|
23
|
-
reporterId = yield
|
21
|
+
reporterId = yield getUserAccountIdFromEmail(params.reporter, apiUrl, authToken);
|
24
22
|
}
|
25
23
|
// If assignee is an email, look up the account ID
|
26
24
|
let assigneeId = null;
|
27
25
|
if (params.assignee && typeof params.assignee === "string" && params.assignee.includes("@") && authToken) {
|
28
|
-
assigneeId = yield
|
26
|
+
assigneeId = yield getUserAccountIdFromEmail(params.assignee, apiUrl, authToken);
|
29
27
|
}
|
30
28
|
const description = {
|
31
29
|
type: "doc",
|
@@ -49,7 +47,7 @@ const createJiraTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
49
47
|
name: params.issueType,
|
50
48
|
} }, (reporterId ? { reporter: { id: reporterId } } : {})), (assigneeId ? { assignee: { id: assigneeId } } : {})), (params.customFields ? params.customFields : {})),
|
51
49
|
};
|
52
|
-
const response = yield
|
50
|
+
const response = yield axiosClient.post(`${apiUrl}/issue`, payload, {
|
53
51
|
headers: {
|
54
52
|
Authorization: `Bearer ${authToken}`,
|
55
53
|
Accept: "application/json",
|
@@ -59,4 +57,4 @@ const createJiraTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
59
57
|
ticketUrl: `${baseUrl}/browse/${response.data.key}`,
|
60
58
|
};
|
61
59
|
});
|
62
|
-
|
60
|
+
export default createJiraTicket;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,8 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
const axiosClient_1 = require("../../util/axiosClient");
|
10
|
+
import { ApiError, axiosClient } from "../../util/axiosClient";
|
13
11
|
const DEFAULT_LIMIT = 1000;
|
14
12
|
const getJiraIssuesByQuery = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
15
13
|
const { authToken, cloudId } = authParams;
|
@@ -42,7 +40,7 @@ const getJiraIssuesByQuery = (_a) => __awaiter(void 0, [_a], void 0, function* (
|
|
42
40
|
queryParams.set("fields", fields.join(","));
|
43
41
|
const apiUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/search/jql?${queryParams.toString()}`;
|
44
42
|
try {
|
45
|
-
const response = yield
|
43
|
+
const response = yield axiosClient.get(apiUrl, {
|
46
44
|
headers: {
|
47
45
|
Authorization: `Bearer ${authToken}`,
|
48
46
|
Accept: "application/json",
|
@@ -57,7 +55,7 @@ const getJiraIssuesByQuery = (_a) => __awaiter(void 0, [_a], void 0, function* (
|
|
57
55
|
console.error("Error retrieving Jira issues:", error);
|
58
56
|
return {
|
59
57
|
success: false,
|
60
|
-
error: error instanceof
|
58
|
+
error: error instanceof ApiError
|
61
59
|
? error.data.length > 0
|
62
60
|
? error.data[0].message
|
63
61
|
: error.message
|
@@ -65,4 +63,4 @@ const getJiraIssuesByQuery = (_a) => __awaiter(void 0, [_a], void 0, function* (
|
|
65
63
|
};
|
66
64
|
}
|
67
65
|
});
|
68
|
-
|
66
|
+
export default getJiraIssuesByQuery;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,8 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
const axiosClient_1 = require("../../util/axiosClient");
|
10
|
+
import { axiosClient } from "../../util/axiosClient";
|
13
11
|
const getJiraTicketDetails = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
12
|
const { authToken, cloudId } = authParams;
|
15
13
|
const { issueId } = params;
|
@@ -18,7 +16,7 @@ const getJiraTicketDetails = (_a) => __awaiter(void 0, [_a], void 0, function* (
|
|
18
16
|
}
|
19
17
|
const apiUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/issue/${issueId}`;
|
20
18
|
try {
|
21
|
-
const response = yield
|
19
|
+
const response = yield axiosClient.get(apiUrl, {
|
22
20
|
headers: {
|
23
21
|
Authorization: `Bearer ${authToken}`,
|
24
22
|
Accept: "application/json",
|
@@ -37,4 +35,4 @@ const getJiraTicketDetails = (_a) => __awaiter(void 0, [_a], void 0, function* (
|
|
37
35
|
};
|
38
36
|
}
|
39
37
|
});
|
40
|
-
|
38
|
+
export default getJiraTicketDetails;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,8 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
const axiosClient_1 = require("../../util/axiosClient");
|
10
|
+
import { axiosClient } from "../../util/axiosClient";
|
13
11
|
const getJiraTicketHistory = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
12
|
var _b;
|
15
13
|
const { authToken, cloudId } = authParams;
|
@@ -19,7 +17,7 @@ const getJiraTicketHistory = (_a) => __awaiter(void 0, [_a], void 0, function* (
|
|
19
17
|
}
|
20
18
|
const apiUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/issue/${issueId}/changelog`;
|
21
19
|
try {
|
22
|
-
const response = yield
|
20
|
+
const response = yield axiosClient.get(apiUrl, {
|
23
21
|
headers: {
|
24
22
|
Authorization: `Bearer ${authToken}`,
|
25
23
|
Accept: "application/json",
|
@@ -38,4 +36,4 @@ const getJiraTicketHistory = (_a) => __awaiter(void 0, [_a], void 0, function* (
|
|
38
36
|
};
|
39
37
|
}
|
40
38
|
});
|
41
|
-
|
39
|
+
export default getJiraTicketHistory;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,8 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
const axiosClient_1 = require("../../util/axiosClient");
|
10
|
+
import { axiosClient } from "../../util/axiosClient";
|
13
11
|
const updateJiraTicketDetails = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
12
|
const { authToken, cloudId, baseUrl } = authParams;
|
15
13
|
const { issueId, summary, description, customFields } = params;
|
@@ -38,7 +36,7 @@ const updateJiraTicketDetails = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
38
36
|
fields: Object.assign(Object.assign(Object.assign({}, (summary && { summary })), (formattedDescription && { description: formattedDescription })), (customFields && Object.assign({}, customFields))),
|
39
37
|
};
|
40
38
|
try {
|
41
|
-
yield
|
39
|
+
yield axiosClient.put(apiUrl, payload, {
|
42
40
|
headers: {
|
43
41
|
Authorization: `Bearer ${authToken}`,
|
44
42
|
Accept: "application/json",
|
@@ -53,4 +51,4 @@ const updateJiraTicketDetails = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
53
51
|
throw new Error(error instanceof Error ? error.message : "Unknown error");
|
54
52
|
}
|
55
53
|
});
|
56
|
-
|
54
|
+
export default updateJiraTicketDetails;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,8 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
const axiosClient_1 = require("../../util/axiosClient");
|
10
|
+
import { axiosClient } from "../../util/axiosClient";
|
13
11
|
const updateJiraTicketStatus = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
12
|
const { authToken, cloudId, baseUrl } = authParams;
|
15
13
|
if (!cloudId || !authToken) {
|
@@ -19,7 +17,7 @@ const updateJiraTicketStatus = (_a) => __awaiter(void 0, [_a], void 0, function*
|
|
19
17
|
const transitionsUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/issue/${issueId}/transitions`;
|
20
18
|
try {
|
21
19
|
// API takes transition ID, so fetch available transitions the find ID of transition that matches given status name
|
22
|
-
const transitionsResponse = yield
|
20
|
+
const transitionsResponse = yield axiosClient.get(transitionsUrl, {
|
23
21
|
headers: {
|
24
22
|
Authorization: `Bearer ${authToken}`,
|
25
23
|
Accept: "application/json",
|
@@ -34,7 +32,7 @@ const updateJiraTicketStatus = (_a) => __awaiter(void 0, [_a], void 0, function*
|
|
34
32
|
throw new Error(`Status '${status}' not found for this issue. Available statuses: ${transitions.map((t) => t.name).join(", ")}`);
|
35
33
|
}
|
36
34
|
// update status with transition ID
|
37
|
-
yield
|
35
|
+
yield axiosClient.post(transitionsUrl, { transition: { id: transition.id } }, {
|
38
36
|
headers: {
|
39
37
|
Authorization: `Bearer ${authToken}`,
|
40
38
|
Accept: "application/json",
|
@@ -54,4 +52,4 @@ const updateJiraTicketStatus = (_a) => __awaiter(void 0, [_a], void 0, function*
|
|
54
52
|
};
|
55
53
|
}
|
56
54
|
});
|
57
|
-
|
55
|
+
export default updateJiraTicketStatus;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,13 +7,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
|
13
|
-
const axiosClient_1 = require("../../util/axiosClient");
|
14
|
-
function getUserAccountIdFromEmail(email, apiUrl, authToken) {
|
10
|
+
import { axiosClient } from "../../util/axiosClient";
|
11
|
+
export function getUserAccountIdFromEmail(email, apiUrl, authToken) {
|
15
12
|
return __awaiter(this, void 0, void 0, function* () {
|
16
13
|
try {
|
17
|
-
const response = yield
|
14
|
+
const response = yield axiosClient.get(`${apiUrl}/user/search?query=${encodeURIComponent(email)}`, {
|
18
15
|
headers: {
|
19
16
|
Authorization: `Bearer ${authToken}`,
|
20
17
|
Accept: "application/json",
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,8 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
const axiosClient_1 = require("../../util/axiosClient");
|
10
|
+
import { axiosClient } from "../../util/axiosClient";
|
13
11
|
const getFVRecoveryKeyForDevice = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
12
|
const { userEmail, subdomain } = params;
|
15
13
|
const { apiKey } = authParams;
|
@@ -30,7 +28,7 @@ const getFVRecoveryKeyForDevice = (_a) => __awaiter(void 0, [_a], void 0, functi
|
|
30
28
|
};
|
31
29
|
}
|
32
30
|
// Then get the FV recovery key for that device
|
33
|
-
const fvRecoveryKey = yield
|
31
|
+
const fvRecoveryKey = yield axiosClient.get(`https://${subdomain}.api.kandji.io/api/v1/devices/${device.device_id}/secrets/filevaultkey`, {
|
34
32
|
headers: {
|
35
33
|
"Content-Type": "application/json",
|
36
34
|
Authorization: `Bearer ${apiKey}`,
|
@@ -63,7 +61,7 @@ function getDeviceByEmail(input) {
|
|
63
61
|
// Update params
|
64
62
|
const params = { limit, offset };
|
65
63
|
const endpoint = `https://${subdomain}.api.kandji.io/api/v1/devices`;
|
66
|
-
const response = yield
|
64
|
+
const response = yield axiosClient.get(endpoint, {
|
67
65
|
params: Object.assign({}, params),
|
68
66
|
headers: {
|
69
67
|
"Content-Type": "application/json",
|
@@ -84,4 +82,4 @@ function getDeviceByEmail(input) {
|
|
84
82
|
return null;
|
85
83
|
});
|
86
84
|
}
|
87
|
-
|
85
|
+
export default getFVRecoveryKeyForDevice;
|
@@ -1,5 +1,3 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
1
|
const createShareLinkedinPostUrl = ({ params, }) => {
|
4
2
|
const baseUrl = "https://www.linkedin.com/feed/?shareActive=true";
|
5
3
|
let shareUrl = baseUrl;
|
@@ -17,4 +15,4 @@ const createShareLinkedinPostUrl = ({ params, }) => {
|
|
17
15
|
linkedinUrl: shareUrl,
|
18
16
|
});
|
19
17
|
};
|
20
|
-
|
18
|
+
export default createShareLinkedinPostUrl;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,8 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
const axiosClient_1 = require("../../util/axiosClient");
|
10
|
+
import { axiosClient } from "../../util/axiosClient";
|
13
11
|
const enableUserByEmail = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
12
|
const { userEmail } = params;
|
15
13
|
const { baseUrl, clientId, clientSecret, authToken } = authParams;
|
@@ -27,7 +25,7 @@ const enableUserByEmail = (_a) => __awaiter(void 0, [_a], void 0, function* ({ p
|
|
27
25
|
try {
|
28
26
|
// Use client_id and client_secret as URL query parameters
|
29
27
|
const loginUrl = `${baseUrl}/api/4.0/login?client_id=${encodeURIComponent(clientId)}&client_secret=${encodeURIComponent(clientSecret)}`;
|
30
|
-
const loginResponse = yield
|
28
|
+
const loginResponse = yield axiosClient.post(loginUrl, {});
|
31
29
|
accessToken = loginResponse.data.access_token;
|
32
30
|
if (!accessToken) {
|
33
31
|
throw new Error("Failed to obtain authentication token from Looker API");
|
@@ -49,7 +47,7 @@ const enableUserByEmail = (_a) => __awaiter(void 0, [_a], void 0, function* ({ p
|
|
49
47
|
// Step 2: Search for the user by email
|
50
48
|
const searchUrl = `${baseUrl}/api/4.0/users/search?email=${encodeURIComponent(userEmail)}`;
|
51
49
|
console.log("Searching for user:", searchUrl);
|
52
|
-
const searchResponse = yield
|
50
|
+
const searchResponse = yield axiosClient.get(searchUrl, { headers });
|
53
51
|
console.log("Search response:", searchResponse.data);
|
54
52
|
const users = searchResponse.data;
|
55
53
|
if (!users || users.length === 0) {
|
@@ -77,7 +75,7 @@ const enableUserByEmail = (_a) => __awaiter(void 0, [_a], void 0, function* ({ p
|
|
77
75
|
// Step 4: Enable the user (no confirmation check, automatically enable)
|
78
76
|
const updateUrl = `${baseUrl}/api/4.0/users/${user.id}`;
|
79
77
|
console.log("Enabling user:", updateUrl);
|
80
|
-
const updateResponse = yield
|
78
|
+
const updateResponse = yield axiosClient.patch(updateUrl, {
|
81
79
|
is_disabled: false,
|
82
80
|
}, { headers });
|
83
81
|
console.log("Update response:", updateResponse.data);
|
@@ -103,4 +101,4 @@ const enableUserByEmail = (_a) => __awaiter(void 0, [_a], void 0, function* ({ p
|
|
103
101
|
};
|
104
102
|
}
|
105
103
|
});
|
106
|
-
|
104
|
+
export default enableUserByEmail;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,10 +7,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
12
10
|
const mathAdd = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params }) {
|
13
11
|
return {
|
14
12
|
result: params.a + params.b,
|
15
13
|
};
|
16
14
|
});
|
17
|
-
|
15
|
+
export default mathAdd;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,14 +7,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
|
13
|
-
const utils_1 = require("./utils");
|
10
|
+
import { microsoftCreateDocumentDefinition } from "../../autogen/templates";
|
11
|
+
import { getGraphClient, validateAndSanitizeFileName } from "./utils";
|
14
12
|
const createDocument = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
15
13
|
const { folderId, name, content, siteId } = params;
|
16
14
|
let client = undefined;
|
17
15
|
try {
|
18
|
-
client = yield
|
16
|
+
client = yield getGraphClient(authParams, microsoftCreateDocumentDefinition.scopes.join(" "));
|
19
17
|
}
|
20
18
|
catch (error) {
|
21
19
|
return {
|
@@ -24,7 +22,7 @@ const createDocument = (_a) => __awaiter(void 0, [_a], void 0, function* ({ para
|
|
24
22
|
};
|
25
23
|
}
|
26
24
|
const apiEndpointPrefix = siteId ? `/sites/${siteId}` : "/me";
|
27
|
-
const sanitizedFileName =
|
25
|
+
const sanitizedFileName = validateAndSanitizeFileName(name);
|
28
26
|
const endpoint = `${apiEndpointPrefix}/drive/items/${folderId || "root"}:/${sanitizedFileName}:/content`;
|
29
27
|
try {
|
30
28
|
// Create or update the document
|
@@ -44,4 +42,4 @@ const createDocument = (_a) => __awaiter(void 0, [_a], void 0, function* ({ para
|
|
44
42
|
};
|
45
43
|
}
|
46
44
|
});
|
47
|
-
|
45
|
+
export default createDocument;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,13 +7,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
const utils_1 = require("./utils");
|
10
|
+
import { getGraphClient } from "./utils";
|
13
11
|
const getDocument = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
12
|
const { siteId, documentId } = params;
|
15
13
|
let client;
|
16
14
|
try {
|
17
|
-
client = yield
|
15
|
+
client = yield getGraphClient(authParams, "Files.ReadWrite Sites.ReadWrite.All");
|
18
16
|
}
|
19
17
|
catch (error) {
|
20
18
|
return {
|
@@ -42,4 +40,4 @@ const getDocument = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
|
|
42
40
|
};
|
43
41
|
}
|
44
42
|
});
|
45
|
-
|
43
|
+
export default getDocument;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,14 +7,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
|
13
|
-
const utils_1 = require("./utils");
|
10
|
+
import { microsoftMessageTeamsChannelDefinition } from "../../autogen/templates";
|
11
|
+
import { getGraphClient } from "./utils";
|
14
12
|
const sendMessageToTeamsChannel = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
15
13
|
const { channelId, teamId, message } = params;
|
16
14
|
let client = undefined;
|
17
15
|
try {
|
18
|
-
client = yield
|
16
|
+
client = yield getGraphClient(authParams, microsoftMessageTeamsChannelDefinition.scopes.join(" "));
|
19
17
|
}
|
20
18
|
catch (error) {
|
21
19
|
return {
|
@@ -42,4 +40,4 @@ const sendMessageToTeamsChannel = (_a) => __awaiter(void 0, [_a], void 0, functi
|
|
42
40
|
};
|
43
41
|
}
|
44
42
|
});
|
45
|
-
|
43
|
+
export default sendMessageToTeamsChannel;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,14 +7,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
|
13
|
-
const utils_1 = require("./utils");
|
10
|
+
import { microsoftMessageTeamsChatDefinition } from "../../autogen/templates";
|
11
|
+
import { getGraphClient } from "./utils";
|
14
12
|
const sendMessageToTeamsChat = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
15
13
|
const { chatId, message } = params;
|
16
14
|
let client = undefined;
|
17
15
|
try {
|
18
|
-
client = yield
|
16
|
+
client = yield getGraphClient(authParams, microsoftMessageTeamsChatDefinition.scopes.join(" "));
|
19
17
|
}
|
20
18
|
catch (error) {
|
21
19
|
return {
|
@@ -42,4 +40,4 @@ const sendMessageToTeamsChat = (_a) => __awaiter(void 0, [_a], void 0, function*
|
|
42
40
|
};
|
43
41
|
}
|
44
42
|
});
|
45
|
-
|
43
|
+
export default sendMessageToTeamsChat;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,14 +7,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
|
13
|
-
const utils_1 = require("./utils");
|
10
|
+
import { microsoftUpdateDocumentDefinition } from "../../autogen/templates";
|
11
|
+
import { getGraphClient } from "./utils";
|
14
12
|
const updateDocument = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
15
13
|
const { documentId, content, siteId } = params;
|
16
14
|
let client = undefined;
|
17
15
|
try {
|
18
|
-
client = yield
|
16
|
+
client = yield getGraphClient(authParams, microsoftUpdateDocumentDefinition.scopes.join(" "));
|
19
17
|
}
|
20
18
|
catch (error) {
|
21
19
|
return {
|
@@ -42,4 +40,4 @@ const updateDocument = (_a) => __awaiter(void 0, [_a], void 0, function* ({ para
|
|
42
40
|
};
|
43
41
|
}
|
44
42
|
});
|
45
|
-
|
43
|
+
export default updateDocument;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,14 +7,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
|
13
|
-
const utils_1 = require("./utils");
|
10
|
+
import { microsoftUpdateSpreadsheetDefinition } from "../../autogen/templates";
|
11
|
+
import { getGraphClient } from "./utils";
|
14
12
|
const updateSpreadsheet = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
15
13
|
const { spreadsheetId, range, values, siteId } = params; // Added siteId to destructured params
|
16
14
|
let client = undefined;
|
17
15
|
try {
|
18
|
-
client = yield
|
16
|
+
client = yield getGraphClient(authParams, microsoftUpdateSpreadsheetDefinition.scopes.join(" "));
|
19
17
|
}
|
20
18
|
catch (error) {
|
21
19
|
return {
|
@@ -53,4 +51,4 @@ const updateSpreadsheet = (_a) => __awaiter(void 0, [_a], void 0, function* ({ p
|
|
53
51
|
};
|
54
52
|
}
|
55
53
|
});
|
56
|
-
|
54
|
+
export default updateSpreadsheet;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,12 +7,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
|
15
|
-
const axiosClient_1 = require("../../util/axiosClient");
|
16
|
-
function getGraphClient(authParams, scope) {
|
10
|
+
import { Client } from "@microsoft/microsoft-graph-client";
|
11
|
+
import { axiosClient } from "../../util/axiosClient";
|
12
|
+
export function getGraphClient(authParams, scope) {
|
17
13
|
return __awaiter(this, void 0, void 0, function* () {
|
18
14
|
if (!authParams.clientId ||
|
19
15
|
!authParams.clientSecret ||
|
@@ -31,11 +27,11 @@ function getGraphClient(authParams, scope) {
|
|
31
27
|
refresh_token: authParams.refreshToken,
|
32
28
|
redirect_uri: authParams.redirectUri,
|
33
29
|
});
|
34
|
-
const response = yield
|
30
|
+
const response = yield axiosClient.post(url, params, {
|
35
31
|
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
36
32
|
});
|
37
33
|
const accessToken = response.data.access_token;
|
38
|
-
return
|
34
|
+
return Client.init({
|
39
35
|
authProvider: done => {
|
40
36
|
done(null, accessToken);
|
41
37
|
},
|
@@ -47,7 +43,7 @@ function getGraphClient(authParams, scope) {
|
|
47
43
|
* @param fileName The original filename to validate and sanitize.
|
48
44
|
* @returns A sanitized filename that is safe to use.
|
49
45
|
*/
|
50
|
-
function validateAndSanitizeFileName(fileName) {
|
46
|
+
export function validateAndSanitizeFileName(fileName) {
|
51
47
|
// Define invalid characters for SharePoint and OneDrive
|
52
48
|
const invalidCharacters = /[~"#%&*:<>?/{|}\\]/g;
|
53
49
|
// Replace invalid characters with an underscore
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
@@ -8,14 +7,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
8
|
});
|
10
9
|
};
|
11
|
-
|
12
|
-
const mongodb_1 = require("mongodb");
|
10
|
+
import { MongoClient } from "mongodb";
|
13
11
|
const insertMongoDoc = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
12
|
const { baseUrl } = authParams;
|
15
13
|
const { collectionName, databaseName, document } = params;
|
16
14
|
if (!baseUrl)
|
17
15
|
throw new Error("baseUrl is required to connect to the mongodb cluster");
|
18
|
-
const client = new
|
16
|
+
const client = new MongoClient(baseUrl);
|
19
17
|
try {
|
20
18
|
yield client.connect();
|
21
19
|
console.log("Connected successfully to MongoDB");
|
@@ -33,4 +31,4 @@ const insertMongoDoc = (_a) => __awaiter(void 0, [_a], void 0, function* ({ para
|
|
33
31
|
yield client.close();
|
34
32
|
}
|
35
33
|
});
|
36
|
-
|
34
|
+
export default insertMongoDoc;
|