@credal/actions 0.2.0 → 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.
Files changed (127) hide show
  1. package/dist/actions/actionMapper.js +374 -380
  2. package/dist/actions/autogen/templates.js +94 -98
  3. package/dist/actions/autogen/types.d.ts +2 -33
  4. package/dist/actions/autogen/types.js +1621 -1659
  5. package/dist/actions/groups.js +88 -91
  6. package/dist/actions/invoke.js +5 -8
  7. package/dist/actions/parse.js +38 -43
  8. package/dist/actions/providers/asana/commentAsanaTask.js +5 -7
  9. package/dist/actions/providers/asana/createAsanaTask.js +9 -11
  10. package/dist/actions/providers/asana/getTasksDetails.js +9 -11
  11. package/dist/actions/providers/asana/listAsanaTasksByProject.js +46 -51
  12. package/dist/actions/providers/asana/searchAsanaTasks.js +6 -8
  13. package/dist/actions/providers/asana/updateAsanaTask.js +8 -10
  14. package/dist/actions/providers/asana/utils.js +7 -12
  15. package/dist/actions/providers/ashby/addCandidateToProject.js +5 -7
  16. package/dist/actions/providers/ashby/createCandidate.js +5 -7
  17. package/dist/actions/providers/ashby/createNote.js +5 -7
  18. package/dist/actions/providers/ashby/getCandidateInfo.js +5 -7
  19. package/dist/actions/providers/ashby/listCandidateNotes.js +5 -7
  20. package/dist/actions/providers/ashby/listCandidates.js +5 -7
  21. package/dist/actions/providers/ashby/searchCandidates.js +5 -7
  22. package/dist/actions/providers/ashby/updateCandidate.js +5 -7
  23. package/dist/actions/providers/bing/getTopNSearchResultUrls.js +5 -7
  24. package/dist/actions/providers/confluence/fetchPageContent.js +8 -10
  25. package/dist/actions/providers/confluence/helpers.js +1 -4
  26. package/dist/actions/providers/confluence/overwritePage.js +9 -11
  27. package/dist/actions/providers/finnhub/getBasicFinancials.js +6 -8
  28. package/dist/actions/providers/finnhub/symbolLookup.js +6 -8
  29. package/dist/actions/providers/firecrawl/deepResearch.js +5 -10
  30. package/dist/actions/providers/firecrawl/scrapeTweetDataWithNitter.js +5 -10
  31. package/dist/actions/providers/firecrawl/scrapeUrl.js +5 -10
  32. package/dist/actions/providers/generic/fillTemplate.js +1 -3
  33. package/dist/actions/providers/github/createBranch.js +4 -39
  34. package/dist/actions/providers/github/createOrUpdateFile.js +6 -41
  35. package/dist/actions/providers/github/createPullRequest.js +4 -39
  36. package/dist/actions/providers/github/listPullRequests.js +7 -12
  37. package/dist/actions/providers/gong/getGongTranscripts.js +49 -84
  38. package/dist/actions/providers/google-oauth/addGroupMember.js +5 -7
  39. package/dist/actions/providers/google-oauth/createNewGoogleDoc.js +6 -8
  40. package/dist/actions/providers/google-oauth/createPresentation.js +5 -7
  41. package/dist/actions/providers/google-oauth/createSpreadsheet.js +5 -10
  42. package/dist/actions/providers/google-oauth/deleteCalendarEvent.js +5 -7
  43. package/dist/actions/providers/google-oauth/deleteGroupMember.js +5 -7
  44. package/dist/actions/providers/google-oauth/getGroup.js +5 -7
  45. package/dist/actions/providers/google-oauth/hasGroupMember.js +5 -7
  46. package/dist/actions/providers/google-oauth/listCalendarEvents.js +5 -7
  47. package/dist/actions/providers/google-oauth/listCalendars.js +5 -7
  48. package/dist/actions/providers/google-oauth/listGroupMembers.js +5 -7
  49. package/dist/actions/providers/google-oauth/listGroups.js +5 -7
  50. package/dist/actions/providers/google-oauth/scheduleCalendarMeeting.js +7 -9
  51. package/dist/actions/providers/google-oauth/searchDriveByKeywords.js +5 -7
  52. package/dist/actions/providers/google-oauth/updateCalendarEvent.js +5 -7
  53. package/dist/actions/providers/google-oauth/updateDoc.js +5 -10
  54. package/dist/actions/providers/google-oauth/updatePresentation.js +5 -7
  55. package/dist/actions/providers/google-oauth/updateSpreadsheet.js +5 -7
  56. package/dist/actions/providers/google-oauth/utils/decodeMessage.js +2 -6
  57. package/dist/actions/providers/googlemail/listGmailThreads.js +8 -10
  58. package/dist/actions/providers/googlemail/searchGmailMessages.js +8 -10
  59. package/dist/actions/providers/googlemaps/nearbysearchRestaurants.js +5 -7
  60. package/dist/actions/providers/googlemaps/validateAddress.js +3 -5
  61. package/dist/actions/providers/jamf/getJamfComputerInventory.js +8 -26
  62. package/dist/actions/providers/jamf/getJamfFileVaultRecoveryKey.js +7 -26
  63. package/dist/actions/providers/jira/assignJiraTicket.js +5 -10
  64. package/dist/actions/providers/jira/commentJiraTicket.js +3 -5
  65. package/dist/actions/providers/jira/createJiraTicket.js +6 -8
  66. package/dist/actions/providers/jira/getJiraIssuesByQuery.js +4 -6
  67. package/dist/actions/providers/jira/getJiraTicketDetails.js +3 -5
  68. package/dist/actions/providers/jira/getJiraTicketHistory.js +3 -5
  69. package/dist/actions/providers/jira/updateJiraTicketDetails.js +3 -5
  70. package/dist/actions/providers/jira/updateJiraTicketStatus.js +4 -6
  71. package/dist/actions/providers/jira/utils.js +3 -6
  72. package/dist/actions/providers/kandji/getFVRecoveryKeyForDevice.js +4 -6
  73. package/dist/actions/providers/linkedin/createSharePostLinkedinUrl.js +1 -3
  74. package/dist/actions/providers/looker/enableUserByEmail.js +5 -7
  75. package/dist/actions/providers/math/add.js +1 -3
  76. package/dist/actions/providers/microsoft/createDocument.js +5 -7
  77. package/dist/actions/providers/microsoft/getDocument.js +3 -5
  78. package/dist/actions/providers/microsoft/messageTeamsChannel.js +4 -6
  79. package/dist/actions/providers/microsoft/messageTeamsChat.js +4 -6
  80. package/dist/actions/providers/microsoft/updateDocument.js +4 -6
  81. package/dist/actions/providers/microsoft/updateSpreadsheet.js +4 -6
  82. package/dist/actions/providers/microsoft/utils.js +6 -10
  83. package/dist/actions/providers/mongodb/insertMongoDoc.js +3 -5
  84. package/dist/actions/providers/notion/searchByTitle.js +5 -10
  85. package/dist/actions/providers/nws/getForecastForLocation.js +7 -9
  86. package/dist/actions/providers/openstreetmap/getLatitudeLongitudeFromLocation.js +3 -5
  87. package/dist/actions/providers/resend/sendEmail.js +6 -8
  88. package/dist/actions/providers/salesforce/createCase.js +3 -5
  89. package/dist/actions/providers/salesforce/createRecord.js +4 -6
  90. package/dist/actions/providers/salesforce/fetchSalesforceSchema.js +3 -5
  91. package/dist/actions/providers/salesforce/generateSalesReport.js +3 -5
  92. package/dist/actions/providers/salesforce/getRecord.js +3 -5
  93. package/dist/actions/providers/salesforce/getSalesforceRecordsByQuery.js +4 -6
  94. package/dist/actions/providers/salesforce/updateRecord.js +3 -5
  95. package/dist/actions/providers/slack/getChannelMessages.js +7 -9
  96. package/dist/actions/providers/slack/helpers.js +1 -4
  97. package/dist/actions/providers/slack/sendMessage.js +10 -12
  98. package/dist/actions/providers/snowflake/auth/getSnowflakeConnection.js +4 -41
  99. package/dist/actions/providers/snowflake/getRowByFieldValue.js +3 -5
  100. package/dist/actions/providers/snowflake/runSnowflakeQuery.js +8 -13
  101. package/dist/actions/providers/x/createXSharePostUrl.js +1 -3
  102. package/dist/actions/providers/zendesk/addCommentToTicket.js +5 -7
  103. package/dist/actions/providers/zendesk/assignTicket.js +5 -7
  104. package/dist/actions/providers/zendesk/createZendeskTicket.js +5 -7
  105. package/dist/actions/providers/zendesk/getTicketDetails.js +5 -7
  106. package/dist/actions/providers/zendesk/listTickets.js +5 -7
  107. package/dist/actions/providers/zendesk/updateTicketStatus.js +5 -7
  108. package/dist/actions/util/axiosClient.js +4 -11
  109. package/dist/actions/util/formatDataForCodeInterpreter.js +1 -4
  110. package/dist/actions/util/missingAuthConstants.js +2 -5
  111. package/dist/app.js +5 -42
  112. package/dist/index.js +4 -24
  113. package/dist/server.d.ts +2 -0
  114. package/dist/server.js +8 -0
  115. package/dist/utils/datetime.js +4 -8
  116. package/dist/utils/string.js +1 -4
  117. package/package.json +2 -1
  118. package/dist/actions/providers/confluence/updatePage.d.ts +0 -3
  119. package/dist/actions/providers/confluence/updatePage.js +0 -47
  120. package/dist/actions/providers/credal/callCopilot.d.ts +0 -3
  121. package/dist/actions/providers/credal/callCopilot.js +0 -36
  122. package/dist/actions/providers/math/index.d.ts +0 -1
  123. package/dist/actions/providers/math/index.js +0 -37
  124. package/dist/actions/providers/slack/index.d.ts +0 -1
  125. package/dist/actions/providers/slack/index.js +0 -37
  126. package/dist/actions/providers/slack/listConversations.d.ts +0 -3
  127. 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,15 +7,14 @@ 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
- const axiosClient_1 = require("../../util/axiosClient");
13
- const missingAuthConstants_1 = require("../../util/missingAuthConstants");
10
+ import { axiosClient } from "../../util/axiosClient";
11
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
14
12
  const listGroups = (_a) => __awaiter(void 0, [_a], void 0, function* ({ authParams, params, }) {
15
13
  var _b;
16
14
  const { authToken } = authParams;
17
15
  const maxResults = (_b = params === null || params === void 0 ? void 0 : params.maxResults) !== null && _b !== void 0 ? _b : 200;
18
16
  if (!authToken) {
19
- return { success: false, groups: [], error: missingAuthConstants_1.MISSING_AUTH_TOKEN };
17
+ return { success: false, groups: [], error: MISSING_AUTH_TOKEN };
20
18
  }
21
19
  try {
22
20
  let groups = [];
@@ -28,7 +26,7 @@ const listGroups = (_a) => __awaiter(void 0, [_a], void 0, function* ({ authPara
28
26
  url.searchParams.set("maxResults", String(limit - groups.length));
29
27
  if (pageToken)
30
28
  url.searchParams.set("pageToken", pageToken);
31
- const response = yield axiosClient_1.axiosClient.get(url.toString(), {
29
+ const response = yield axiosClient.get(url.toString(), {
32
30
  headers: { Authorization: `Bearer ${authToken}` },
33
31
  });
34
32
  const data = response.data;
@@ -53,4 +51,4 @@ const listGroups = (_a) => __awaiter(void 0, [_a], void 0, function* ({ authPara
53
51
  };
54
52
  }
55
53
  });
56
- exports.default = listGroups;
54
+ export default listGroups;
@@ -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,16 +7,15 @@ 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
- const uuid_1 = require("uuid");
13
- const axiosClient_1 = require("../../util/axiosClient");
14
- const missingAuthConstants_1 = require("../../util/missingAuthConstants");
10
+ import { v4 } from "uuid";
11
+ import { axiosClient } from "../../util/axiosClient";
12
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
15
13
  /**
16
14
  * Creates a new Google calendar event using OAuth authentication
17
15
  */
18
16
  const scheduleCalendarMeeting = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
19
17
  if (!authParams.authToken) {
20
- throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
18
+ throw new Error(MISSING_AUTH_TOKEN);
21
19
  }
22
20
  const { calendarId, name, start, end, description, attendees, useGoogleMeet } = params;
23
21
  // https://developers.google.com/calendar/api/v3/reference/events/insert
@@ -41,12 +39,12 @@ const scheduleCalendarMeeting = (_a) => __awaiter(void 0, [_a], void 0, function
41
39
  createEventApiUrl += "?conferenceDataVersion=1";
42
40
  data.conferenceData = {
43
41
  createRequest: {
44
- requestId: (0, uuid_1.v4)(),
42
+ requestId: v4(),
45
43
  },
46
44
  };
47
45
  }
48
46
  try {
49
- const response = yield axiosClient_1.axiosClient.post(createEventApiUrl, data, {
47
+ const response = yield axiosClient.post(createEventApiUrl, data, {
50
48
  headers: {
51
49
  Authorization: `Bearer ${authParams.authToken}`,
52
50
  "Content-Type": "application/json",
@@ -72,4 +70,4 @@ const scheduleCalendarMeeting = (_a) => __awaiter(void 0, [_a], void 0, function
72
70
  };
73
71
  }
74
72
  });
75
- exports.default = scheduleCalendarMeeting;
73
+ export default scheduleCalendarMeeting;
@@ -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,20 +7,19 @@ 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
- const axiosClient_1 = require("../../util/axiosClient");
13
- const missingAuthConstants_1 = require("../../util/missingAuthConstants");
10
+ import { axiosClient } from "../../util/axiosClient";
11
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
14
12
  const searchDriveByKeywords = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
15
13
  var _b;
16
14
  if (!authParams.authToken) {
17
- return { success: false, error: missingAuthConstants_1.MISSING_AUTH_TOKEN, files: [] };
15
+ return { success: false, error: MISSING_AUTH_TOKEN, files: [] };
18
16
  }
19
17
  const { keywords } = params;
20
18
  // Build the query: fullText contains 'keyword1' or fullText contains 'keyword2' ...
21
19
  const query = keywords.map(kw => `fullText contains '${kw.replace(/'/g, "\\'")}'`).join(" or ");
22
20
  const url = `https://www.googleapis.com/drive/v3/files?q=${encodeURIComponent(query)}&fields=files(id,name,mimeType,webViewLink)&supportsAllDrives=true&includeItemsFromAllDrives=true`;
23
21
  try {
24
- const res = yield axiosClient_1.axiosClient.get(url, {
22
+ const res = yield axiosClient.get(url, {
25
23
  headers: {
26
24
  Authorization: `Bearer ${authParams.authToken}`,
27
25
  },
@@ -43,4 +41,4 @@ const searchDriveByKeywords = (_a) => __awaiter(void 0, [_a], void 0, function*
43
41
  };
44
42
  }
45
43
  });
46
- exports.default = searchDriveByKeywords;
44
+ export default searchDriveByKeywords;
@@ -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,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
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const axiosClient_1 = require("../../util/axiosClient");
13
- const missingAuthConstants_1 = require("../../util/missingAuthConstants");
10
+ import { axiosClient } from "../../util/axiosClient";
11
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
14
12
  const updateCalendarEvent = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
15
13
  if (!authParams.authToken) {
16
- return { success: false, error: missingAuthConstants_1.MISSING_AUTH_TOKEN, eventId: "", eventUrl: "" };
14
+ return { success: false, error: MISSING_AUTH_TOKEN, eventId: "", eventUrl: "" };
17
15
  }
18
16
  const { calendarId, eventId, updates } = params;
19
17
  const url = `https://www.googleapis.com/calendar/v3/calendars/${encodeURIComponent(calendarId)}/events/${encodeURIComponent(eventId)}`;
@@ -37,7 +35,7 @@ const updateCalendarEvent = (_a) => __awaiter(void 0, [_a], void 0, function* ({
37
35
  body.organizer = updates.organizer;
38
36
  }
39
37
  try {
40
- const res = yield axiosClient_1.axiosClient.patch(url, body, {
38
+ const res = yield axiosClient.patch(url, body, {
41
39
  headers: {
42
40
  Authorization: `Bearer ${authParams.authToken}`,
43
41
  },
@@ -56,4 +54,4 @@ const updateCalendarEvent = (_a) => __awaiter(void 0, [_a], void 0, function* ({
56
54
  };
57
55
  }
58
56
  });
59
- exports.default = updateCalendarEvent;
57
+ export default updateCalendarEvent;
@@ -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,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
- 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 missingAuthConstants_1 = require("../../util/missingAuthConstants");
10
+ import axios from "axios";
11
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
17
12
  /**
18
13
  * Updates an existing Google Docs document using OAuth authentication with batch requests
19
14
  * https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate
@@ -23,7 +18,7 @@ const updateDoc = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, a
23
18
  return {
24
19
  success: false,
25
20
  documentId: params.documentId,
26
- error: missingAuthConstants_1.MISSING_AUTH_TOKEN,
21
+ error: MISSING_AUTH_TOKEN,
27
22
  };
28
23
  }
29
24
  const { documentId, requests } = params;
@@ -31,7 +26,7 @@ const updateDoc = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, a
31
26
  try {
32
27
  // If requests are provided, send them as a batch update
33
28
  if (requests && requests.length > 0) {
34
- const response = yield axios_1.default.post(`${baseApiUrl}/${documentId}:batchUpdate`, {
29
+ const response = yield axios.post(`${baseApiUrl}/${documentId}:batchUpdate`, {
35
30
  requests,
36
31
  }, {
37
32
  headers: {
@@ -67,4 +62,4 @@ const updateDoc = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, a
67
62
  };
68
63
  }
69
64
  });
70
- exports.default = updateDoc;
65
+ export default updateDoc;
@@ -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
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const axiosClient_1 = require("../../util/axiosClient");
13
- const missingAuthConstants_1 = require("../../util/missingAuthConstants");
10
+ import { axiosClient } from "../../util/axiosClient";
11
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
14
12
  /**
15
13
  * Updates an existing Google Slides presentation using OAuth authentication with batch requests
16
14
  * https://developers.google.com/slides/api/reference/rest/v1/presentations/batchUpdate
@@ -19,7 +17,7 @@ const updatePresentation = (_a) => __awaiter(void 0, [_a], void 0, function* ({
19
17
  if (!authParams.authToken) {
20
18
  return {
21
19
  success: false,
22
- error: missingAuthConstants_1.MISSING_AUTH_TOKEN,
20
+ error: MISSING_AUTH_TOKEN,
23
21
  };
24
22
  }
25
23
  const { presentationId, requests } = params;
@@ -27,7 +25,7 @@ const updatePresentation = (_a) => __awaiter(void 0, [_a], void 0, function* ({
27
25
  try {
28
26
  // If requests are provided, send them as a batch update
29
27
  if (requests && requests.length > 0) {
30
- const response = yield axiosClient_1.axiosClient.post(`${baseApiUrl}/${presentationId}:batchUpdate`, {
28
+ const response = yield axiosClient.post(`${baseApiUrl}/${presentationId}:batchUpdate`, {
31
29
  requests,
32
30
  }, {
33
31
  headers: {
@@ -62,4 +60,4 @@ const updatePresentation = (_a) => __awaiter(void 0, [_a], void 0, function* ({
62
60
  };
63
61
  }
64
62
  });
65
- exports.default = updatePresentation;
63
+ export default updatePresentation;
@@ -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,22 +7,21 @@ 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
- const axiosClient_1 = require("../../util/axiosClient");
13
- const missingAuthConstants_1 = require("../../util/missingAuthConstants");
10
+ import { axiosClient } from "../../util/axiosClient";
11
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
14
12
  /**
15
13
  * Update a Google Spreadsheet using OAuth authentication
16
14
  * https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets/batchUpdate
17
15
  */
18
16
  const updateSpreadsheet = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
19
17
  if (!authParams.authToken) {
20
- throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
18
+ throw new Error(MISSING_AUTH_TOKEN);
21
19
  }
22
20
  const { spreadsheetId, requests } = params;
23
21
  const batchUpdateUrl = `https://sheets.googleapis.com/v4/spreadsheets/${spreadsheetId}:batchUpdate`;
24
22
  try {
25
23
  // Update the spreadsheet with the given requests
26
- const response = yield axiosClient_1.axiosClient.post(batchUpdateUrl, { requests, includeSpreadsheetInResponse: true }, {
24
+ const response = yield axiosClient.post(batchUpdateUrl, { requests, includeSpreadsheetInResponse: true }, {
27
25
  headers: {
28
26
  Authorization: `Bearer ${authParams.authToken}`,
29
27
  "Content-Type": "application/json",
@@ -49,4 +47,4 @@ const updateSpreadsheet = (_a) => __awaiter(void 0, [_a], void 0, function* ({ p
49
47
  };
50
48
  }
51
49
  });
52
- exports.default = updateSpreadsheet;
50
+ export default updateSpreadsheet;
@@ -1,8 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decodeGmailBase64 = decodeGmailBase64;
4
- exports.getEmailContent = getEmailContent;
5
- function decodeGmailBase64(base64String) {
1
+ export function decodeGmailBase64(base64String) {
6
2
  // Gmail API uses URL-safe base64 encoding
7
3
  const standardBase64 = base64String.replace(/-/g, "+").replace(/_/g, "/");
8
4
  // Add padding if needed
@@ -10,7 +6,7 @@ function decodeGmailBase64(base64String) {
10
6
  // Only works for Node.js environment
11
7
  return Buffer.from(padded, "base64").toString("utf-8");
12
8
  }
13
- function getEmailContent(message) {
9
+ export function getEmailContent(message) {
14
10
  var _a;
15
11
  let textContent = null;
16
12
  // Function to recursively search for plain text content in parts
@@ -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
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const axiosClient_1 = require("../../util/axiosClient");
13
- const missingAuthConstants_1 = require("../../util/missingAuthConstants");
14
- const decodeMessage_1 = require("../google-oauth/utils/decodeMessage");
10
+ import { axiosClient } from "../../util/axiosClient";
11
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
12
+ import { getEmailContent } from "../google-oauth/utils/decodeMessage";
15
13
  const listGmailThreads = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
16
14
  if (!authParams.authToken) {
17
- return { success: false, error: missingAuthConstants_1.MISSING_AUTH_TOKEN, threads: [] };
15
+ return { success: false, error: MISSING_AUTH_TOKEN, threads: [] };
18
16
  }
19
17
  const { query, maxResults } = params;
20
18
  const allThreads = [];
@@ -27,7 +25,7 @@ const listGmailThreads = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
27
25
  const url = `https://gmail.googleapis.com/gmail/v1/users/me/threads?q=${encodeURIComponent(query)}` +
28
26
  (pageToken ? `&pageToken=${encodeURIComponent(pageToken)}` : "") +
29
27
  `&maxResults=${Math.min(100, max - fetched)}`;
30
- const listRes = yield axiosClient_1.axiosClient.get(url, {
28
+ const listRes = yield axiosClient.get(url, {
31
29
  headers: {
32
30
  Authorization: `Bearer ${authParams.authToken}`,
33
31
  },
@@ -39,7 +37,7 @@ const listGmailThreads = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
39
37
  const batch = threadList.slice(0, remaining);
40
38
  const results = yield Promise.all(batch.map((thread) => __awaiter(void 0, void 0, void 0, function* () {
41
39
  try {
42
- const threadRes = yield axiosClient_1.axiosClient.get(`https://gmail.googleapis.com/gmail/v1/users/me/threads/${thread.id}?format=full`, {
40
+ const threadRes = yield axiosClient.get(`https://gmail.googleapis.com/gmail/v1/users/me/threads/${thread.id}?format=full`, {
43
41
  headers: {
44
42
  Authorization: `Bearer ${authParams.authToken}`,
45
43
  },
@@ -51,7 +49,7 @@ const listGmailThreads = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
51
49
  messages: Array.isArray(messages)
52
50
  ? messages.map(msg => {
53
51
  const { id, threadId, snippet, labelIds, internalDate } = msg;
54
- const emailBody = (0, decodeMessage_1.getEmailContent)(msg) || "";
52
+ const emailBody = getEmailContent(msg) || "";
55
53
  return {
56
54
  id,
57
55
  threadId,
@@ -95,4 +93,4 @@ const listGmailThreads = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
95
93
  };
96
94
  }
97
95
  });
98
- exports.default = listGmailThreads;
96
+ export default listGmailThreads;
@@ -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
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const axiosClient_1 = require("../../util/axiosClient");
13
- const missingAuthConstants_1 = require("../../util/missingAuthConstants");
14
- const decodeMessage_1 = require("../google-oauth/utils/decodeMessage");
10
+ import { axiosClient } from "../../util/axiosClient";
11
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
12
+ import { getEmailContent } from "../google-oauth/utils/decodeMessage";
15
13
  const searchGmailMessages = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
16
14
  if (!authParams.authToken) {
17
- return { success: false, error: missingAuthConstants_1.MISSING_AUTH_TOKEN, messages: [] };
15
+ return { success: false, error: MISSING_AUTH_TOKEN, messages: [] };
18
16
  }
19
17
  const { query, maxResults } = params;
20
18
  const allMessages = [];
@@ -27,7 +25,7 @@ const searchGmailMessages = (_a) => __awaiter(void 0, [_a], void 0, function* ({
27
25
  const url = `https://gmail.googleapis.com/gmail/v1/users/me/messages?q=${encodeURIComponent(query)}` +
28
26
  (pageToken ? `&pageToken=${encodeURIComponent(pageToken)}` : "") +
29
27
  `&maxResults=${Math.min(100, max - fetched)}`;
30
- const listRes = yield axiosClient_1.axiosClient.get(url, {
28
+ const listRes = yield axiosClient.get(url, {
31
29
  headers: {
32
30
  Authorization: `Bearer ${authParams.authToken}`,
33
31
  },
@@ -39,13 +37,13 @@ const searchGmailMessages = (_a) => __awaiter(void 0, [_a], void 0, function* ({
39
37
  const batch = messageList.slice(0, remaining);
40
38
  const results = yield Promise.all(batch.map((msg) => __awaiter(void 0, void 0, void 0, function* () {
41
39
  try {
42
- const msgRes = yield axiosClient_1.axiosClient.get(`https://gmail.googleapis.com/gmail/v1/users/me/messages/${msg.id}?format=full`, {
40
+ const msgRes = yield axiosClient.get(`https://gmail.googleapis.com/gmail/v1/users/me/messages/${msg.id}?format=full`, {
43
41
  headers: {
44
42
  Authorization: `Bearer ${authParams.authToken}`,
45
43
  },
46
44
  });
47
45
  const { id, threadId, snippet, labelIds, internalDate } = msgRes.data;
48
- const emailBody = (0, decodeMessage_1.getEmailContent)(msgRes.data) || "";
46
+ const emailBody = getEmailContent(msgRes.data) || "";
49
47
  return {
50
48
  id,
51
49
  threadId,
@@ -88,4 +86,4 @@ const searchGmailMessages = (_a) => __awaiter(void 0, [_a], void 0, function* ({
88
86
  };
89
87
  }
90
88
  });
91
- exports.default = searchGmailMessages;
89
+ export default searchGmailMessages;
@@ -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
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const types_1 = require("../../autogen/types");
13
- const axiosClient_1 = require("../../util/axiosClient");
10
+ import { googlemapsNearbysearchRestaurantsOutputSchema } from "../../autogen/types";
11
+ import { axiosClient } from "../../util/axiosClient";
14
12
  const INCLUDED_TYPES = ["restaurant"];
15
13
  const nearbysearchRestaurants = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
16
14
  const url = `https://places.googleapis.com/v1/places:searchNearby`;
@@ -24,7 +22,7 @@ const nearbysearchRestaurants = (_a) => __awaiter(void 0, [_a], void 0, function
24
22
  "places.regularOpeningHours",
25
23
  "places.websiteUri",
26
24
  ].join(",");
27
- const response = yield axiosClient_1.axiosClient.post(url, {
25
+ const response = yield axiosClient.post(url, {
28
26
  maxResultCount: 20,
29
27
  includedTypes: INCLUDED_TYPES,
30
28
  locationRestriction: {
@@ -43,7 +41,7 @@ const nearbysearchRestaurants = (_a) => __awaiter(void 0, [_a], void 0, function
43
41
  "Content-Type": "application/json",
44
42
  },
45
43
  });
46
- return types_1.googlemapsNearbysearchRestaurantsOutputSchema.parse({
44
+ return googlemapsNearbysearchRestaurantsOutputSchema.parse({
47
45
  results: response.data.places.map((place) => {
48
46
  var _a, _b;
49
47
  return ({
@@ -59,4 +57,4 @@ const nearbysearchRestaurants = (_a) => __awaiter(void 0, [_a], void 0, function
59
57
  }),
60
58
  });
61
59
  });
62
- exports.default = nearbysearchRestaurants;
60
+ export default nearbysearchRestaurants;
@@ -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
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const axiosClient_1 = require("../../util/axiosClient");
10
+ import { axiosClient } from "../../util/axiosClient";
13
11
  const validateAddress = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
12
  const url = `https://addressvalidation.googleapis.com/v1:validateAddress?key=${authParams.apiKey}`;
15
13
  const requestBody = {
@@ -17,11 +15,11 @@ const validateAddress = (_a) => __awaiter(void 0, [_a], void 0, function* ({ par
17
15
  addressLines: [...params.addressLines, params.locality, params.regionCode, params.postalCode],
18
16
  },
19
17
  };
20
- const response = yield axiosClient_1.axiosClient.post(url, requestBody, {
18
+ const response = yield axiosClient.post(url, requestBody, {
21
19
  headers: {
22
20
  "Content-Type": "application/json",
23
21
  },
24
22
  });
25
23
  return response.data;
26
24
  });
27
- exports.default = validateAddress;
25
+ export default validateAddress;
@@ -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,48 +7,31 @@ 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
- const axiosClient_1 = require("../../util/axiosClient");
13
- const types_1 = require("./types");
10
+ import { axiosClient } from "../../util/axiosClient";
14
11
  const getJamfComputerInventory = (_a) => __awaiter(void 0, [_a], void 0, function* ({ authParams, }) {
15
- const { username, password, subdomain } = authParams;
16
- if (!subdomain || !username || !password) {
17
- throw new Error("Base URL, username, and password are required to fetch FileVault2 recovery key");
12
+ const { authToken, subdomain } = authParams;
13
+ if (!subdomain || !authToken) {
14
+ throw new Error("Instance and authToken are required to fetch Jamf computer inventory");
18
15
  }
19
16
  const url = `https://${subdomain}.jamfcloud.com`;
20
- const auth = "Basic " + Buffer.from(`${username}:${password}`).toString("base64");
21
17
  try {
22
- const response = yield axiosClient_1.axiosClient.post(`${url}/api/v1/auth/token`, {}, {
18
+ const computers = yield axiosClient.get(`${url}/api/v1/computers-inventory`, {
23
19
  headers: {
24
- Authorization: auth,
20
+ Authorization: `Bearer ${authToken}`,
25
21
  Accept: "application/json",
26
22
  },
27
23
  });
28
- const token = types_1.TokenResponseSchema.parse(response.data).token;
29
- const computers = yield axiosClient_1.axiosClient.get(`${url}/api/v1/computers-inventory`, {
30
- headers: {
31
- Authorization: `Bearer ${token}`,
32
- Accept: "application/json",
33
- },
34
- });
35
- yield axiosClient_1.axiosClient.post(`${url}/api/v1/auth/invalidate-token`, {}, {
36
- headers: {
37
- Authorization: `Bearer ${token}`,
38
- },
39
- // Accept all status codes so we can handle them manually
40
- validateStatus: () => true,
41
- });
42
24
  return {
43
25
  success: true,
44
26
  data: computers.data,
45
27
  };
46
28
  }
47
29
  catch (error) {
48
- console.error("Error retrieving FileVault2 recovery key: ", error);
30
+ console.error("Error retrieving Jamf computer inventory: ", error);
49
31
  return {
50
32
  success: false,
51
33
  error: error instanceof Error ? error.message : "Unknown error",
52
34
  };
53
35
  }
54
36
  });
55
- exports.default = getJamfComputerInventory;
37
+ export default getJamfComputerInventory;
@@ -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,40 +7,22 @@ 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
- const axiosClient_1 = require("../../util/axiosClient");
13
- const types_1 = require("./types");
10
+ import { axiosClient } from "../../util/axiosClient";
14
11
  const getJamfFileVaultRecoveryKey = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
15
- const { username, password, subdomain } = authParams;
12
+ const { authToken, subdomain } = authParams;
16
13
  const { computerId } = params;
17
- if (!subdomain || !username || !password) {
18
- throw new Error("Base URL, username, and password are required to fetch FileVault2 recovery key");
14
+ if (!subdomain || !authToken) {
15
+ throw new Error("Instance and authToken are required to fetch FileVault2 recovery key");
19
16
  }
20
17
  // const apiUrl = `${baseUrl}/api/v1/computers-inventory/${computerId}/filevault`;
21
18
  const url = `https://${subdomain}.jamfcloud.com`;
22
- const auth = "Basic " + Buffer.from(`${username}:${password}`).toString("base64");
23
- console.log("Fetching FileVault2 recovery key for computer ID:", computerId, auth, url);
24
19
  try {
25
- const response = yield axiosClient_1.axiosClient.post(`${url}/api/v1/auth/token`, {}, {
20
+ const fileVaultResponse = yield axiosClient.get(`${url}/api/v1/computers-inventory/${computerId}/filevault`, {
26
21
  headers: {
27
- Authorization: auth,
22
+ Authorization: `Bearer ${authToken}`,
28
23
  Accept: "application/json",
29
24
  },
30
25
  });
31
- const token = types_1.TokenResponseSchema.parse(response.data).token;
32
- const fileVaultResponse = yield axiosClient_1.axiosClient.get(`${url}/api/v1/computers-inventory/${computerId}/filevault`, {
33
- headers: {
34
- Authorization: `Bearer ${token}`,
35
- Accept: "application/json",
36
- },
37
- });
38
- yield axiosClient_1.axiosClient.post(`${url}/api/v1/auth/invalidate-token`, {}, {
39
- headers: {
40
- Authorization: `Bearer ${token}`,
41
- },
42
- // Accept all status codes so we can handle them manually
43
- validateStatus: () => true,
44
- });
45
26
  return {
46
27
  success: true,
47
28
  data: fileVaultResponse.data,
@@ -55,4 +36,4 @@ const getJamfFileVaultRecoveryKey = (_a) => __awaiter(void 0, [_a], void 0, func
55
36
  };
56
37
  }
57
38
  });
58
- exports.default = getJamfFileVaultRecoveryKey;
39
+ export default getJamfFileVaultRecoveryKey;
@@ -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,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
- 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 utils_1 = require("./utils");
10
+ import axios from "axios";
11
+ import { getUserAccountIdFromEmail } from "./utils";
17
12
  const assignJiraTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
18
13
  const { authToken, cloudId, baseUrl } = authParams;
19
14
  const apiUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/`;
@@ -23,12 +18,12 @@ const assignJiraTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
23
18
  try {
24
19
  let assigneeId = params.assignee;
25
20
  if (assigneeId && assigneeId.includes("@")) {
26
- assigneeId = yield (0, utils_1.getUserAccountIdFromEmail)(assigneeId, apiUrl, authToken);
21
+ assigneeId = yield getUserAccountIdFromEmail(assigneeId, apiUrl, authToken);
27
22
  }
28
23
  if (!assigneeId) {
29
24
  throw new Error("Unable to get valid assignee account ID.");
30
25
  }
31
- yield axios_1.default.put(`${apiUrl}issue/${params.issueId}/assignee`, { accountId: assigneeId }, {
26
+ yield axios.put(`${apiUrl}issue/${params.issueId}/assignee`, { accountId: assigneeId }, {
32
27
  headers: {
33
28
  Authorization: `Bearer ${authToken}`,
34
29
  Accept: "application/json",
@@ -49,4 +44,4 @@ const assignJiraTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
49
44
  };
50
45
  }
51
46
  });
52
- exports.default = assignJiraTicket;
47
+ export default assignJiraTicket;