@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.
Files changed (132) 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.js +1621 -1627
  4. package/dist/actions/groups.js +88 -91
  5. package/dist/actions/invoke.js +5 -8
  6. package/dist/actions/parse.js +28 -33
  7. package/dist/actions/providers/asana/commentAsanaTask.js +5 -7
  8. package/dist/actions/providers/asana/createAsanaTask.js +9 -11
  9. package/dist/actions/providers/asana/getTasksDetails.js +9 -11
  10. package/dist/actions/providers/asana/listAsanaTasksByProject.js +46 -51
  11. package/dist/actions/providers/asana/searchAsanaTasks.js +6 -8
  12. package/dist/actions/providers/asana/updateAsanaTask.js +8 -10
  13. package/dist/actions/providers/asana/utils.js +7 -12
  14. package/dist/actions/providers/ashby/addCandidateToProject.js +5 -7
  15. package/dist/actions/providers/ashby/createCandidate.js +5 -7
  16. package/dist/actions/providers/ashby/createNote.js +5 -7
  17. package/dist/actions/providers/ashby/getCandidateInfo.js +5 -7
  18. package/dist/actions/providers/ashby/listCandidateNotes.js +5 -7
  19. package/dist/actions/providers/ashby/listCandidates.js +5 -7
  20. package/dist/actions/providers/ashby/searchCandidates.js +5 -7
  21. package/dist/actions/providers/ashby/updateCandidate.js +5 -7
  22. package/dist/actions/providers/bing/getTopNSearchResultUrls.js +5 -7
  23. package/dist/actions/providers/confluence/fetchPageContent.js +8 -10
  24. package/dist/actions/providers/confluence/helpers.js +1 -4
  25. package/dist/actions/providers/confluence/overwritePage.js +9 -11
  26. package/dist/actions/providers/finnhub/getBasicFinancials.js +6 -8
  27. package/dist/actions/providers/finnhub/symbolLookup.js +6 -8
  28. package/dist/actions/providers/firecrawl/deepResearch.js +5 -10
  29. package/dist/actions/providers/firecrawl/scrapeTweetDataWithNitter.js +5 -10
  30. package/dist/actions/providers/firecrawl/scrapeUrl.js +5 -10
  31. package/dist/actions/providers/generic/fillTemplate.js +1 -3
  32. package/dist/actions/providers/github/createBranch.js +4 -39
  33. package/dist/actions/providers/github/createOrUpdateFile.js +6 -41
  34. package/dist/actions/providers/github/createPullRequest.js +4 -39
  35. package/dist/actions/providers/github/listPullRequests.js +7 -12
  36. package/dist/actions/providers/gong/getGongTranscripts.js +49 -84
  37. package/dist/actions/providers/google-oauth/addGroupMember.js +5 -7
  38. package/dist/actions/providers/google-oauth/createNewGoogleDoc.js +6 -8
  39. package/dist/actions/providers/google-oauth/createPresentation.js +5 -7
  40. package/dist/actions/providers/google-oauth/createSpreadsheet.js +5 -10
  41. package/dist/actions/providers/google-oauth/deleteCalendarEvent.js +5 -7
  42. package/dist/actions/providers/google-oauth/deleteGroupMember.js +5 -7
  43. package/dist/actions/providers/google-oauth/getGroup.js +5 -7
  44. package/dist/actions/providers/google-oauth/hasGroupMember.js +5 -7
  45. package/dist/actions/providers/google-oauth/listCalendarEvents.js +5 -7
  46. package/dist/actions/providers/google-oauth/listCalendars.js +5 -7
  47. package/dist/actions/providers/google-oauth/listGroupMembers.js +5 -7
  48. package/dist/actions/providers/google-oauth/listGroups.js +5 -7
  49. package/dist/actions/providers/google-oauth/scheduleCalendarMeeting.js +7 -9
  50. package/dist/actions/providers/google-oauth/searchDriveByKeywords.js +5 -7
  51. package/dist/actions/providers/google-oauth/updateCalendarEvent.js +5 -7
  52. package/dist/actions/providers/google-oauth/updateDoc.js +5 -10
  53. package/dist/actions/providers/google-oauth/updatePresentation.js +5 -7
  54. package/dist/actions/providers/google-oauth/updateSpreadsheet.js +5 -7
  55. package/dist/actions/providers/google-oauth/utils/decodeMessage.js +2 -6
  56. package/dist/actions/providers/googlemail/listGmailThreads.js +8 -10
  57. package/dist/actions/providers/googlemail/searchGmailMessages.js +8 -10
  58. package/dist/actions/providers/googlemaps/nearbysearchRestaurants.js +5 -7
  59. package/dist/actions/providers/googlemaps/validateAddress.js +3 -5
  60. package/dist/actions/providers/jamf/getJamfComputerInventory.js +3 -5
  61. package/dist/actions/providers/jamf/getJamfFileVaultRecoveryKey.js +3 -5
  62. package/dist/actions/providers/jira/assignJiraTicket.js +5 -10
  63. package/dist/actions/providers/jira/commentJiraTicket.js +3 -5
  64. package/dist/actions/providers/jira/createJiraTicket.js +6 -8
  65. package/dist/actions/providers/jira/getJiraIssuesByQuery.js +4 -6
  66. package/dist/actions/providers/jira/getJiraTicketDetails.js +3 -5
  67. package/dist/actions/providers/jira/getJiraTicketHistory.js +3 -5
  68. package/dist/actions/providers/jira/updateJiraTicketDetails.js +3 -5
  69. package/dist/actions/providers/jira/updateJiraTicketStatus.js +4 -6
  70. package/dist/actions/providers/jira/utils.js +3 -6
  71. package/dist/actions/providers/kandji/getFVRecoveryKeyForDevice.js +4 -6
  72. package/dist/actions/providers/linkedin/createSharePostLinkedinUrl.js +1 -3
  73. package/dist/actions/providers/looker/enableUserByEmail.js +5 -7
  74. package/dist/actions/providers/math/add.js +1 -3
  75. package/dist/actions/providers/microsoft/createDocument.js +5 -7
  76. package/dist/actions/providers/microsoft/getDocument.js +3 -5
  77. package/dist/actions/providers/microsoft/messageTeamsChannel.js +4 -6
  78. package/dist/actions/providers/microsoft/messageTeamsChat.js +4 -6
  79. package/dist/actions/providers/microsoft/updateDocument.js +4 -6
  80. package/dist/actions/providers/microsoft/updateSpreadsheet.js +4 -6
  81. package/dist/actions/providers/microsoft/utils.js +6 -10
  82. package/dist/actions/providers/mongodb/insertMongoDoc.js +3 -5
  83. package/dist/actions/providers/notion/searchByTitle.js +5 -10
  84. package/dist/actions/providers/nws/getForecastForLocation.js +7 -9
  85. package/dist/actions/providers/openstreetmap/getLatitudeLongitudeFromLocation.js +3 -5
  86. package/dist/actions/providers/resend/sendEmail.js +6 -8
  87. package/dist/actions/providers/salesforce/createCase.js +3 -5
  88. package/dist/actions/providers/salesforce/createRecord.js +4 -6
  89. package/dist/actions/providers/salesforce/fetchSalesforceSchema.js +3 -5
  90. package/dist/actions/providers/salesforce/generateSalesReport.js +3 -5
  91. package/dist/actions/providers/salesforce/getRecord.js +3 -5
  92. package/dist/actions/providers/salesforce/getSalesforceRecordsByQuery.js +4 -6
  93. package/dist/actions/providers/salesforce/updateRecord.js +3 -5
  94. package/dist/actions/providers/slack/getChannelMessages.js +7 -9
  95. package/dist/actions/providers/slack/helpers.js +1 -4
  96. package/dist/actions/providers/slack/sendMessage.js +10 -12
  97. package/dist/actions/providers/snowflake/auth/getSnowflakeConnection.js +4 -41
  98. package/dist/actions/providers/snowflake/getRowByFieldValue.js +3 -5
  99. package/dist/actions/providers/snowflake/runSnowflakeQuery.js +8 -13
  100. package/dist/actions/providers/x/createXSharePostUrl.js +1 -3
  101. package/dist/actions/providers/zendesk/addCommentToTicket.js +5 -7
  102. package/dist/actions/providers/zendesk/assignTicket.js +5 -7
  103. package/dist/actions/providers/zendesk/createZendeskTicket.js +5 -7
  104. package/dist/actions/providers/zendesk/getTicketDetails.js +5 -7
  105. package/dist/actions/providers/zendesk/listTickets.js +5 -7
  106. package/dist/actions/providers/zendesk/updateTicketStatus.js +5 -7
  107. package/dist/actions/util/axiosClient.js +4 -11
  108. package/dist/actions/util/formatDataForCodeInterpreter.js +1 -4
  109. package/dist/actions/util/missingAuthConstants.js +2 -5
  110. package/dist/app.js +5 -42
  111. package/dist/index.js +4 -24
  112. package/dist/server.d.ts +2 -0
  113. package/dist/server.js +8 -0
  114. package/dist/utils/datetime.js +4 -8
  115. package/dist/utils/string.js +1 -4
  116. package/package.json +2 -1
  117. package/dist/actions/providers/credal/callCopilot.d.ts +0 -3
  118. package/dist/actions/providers/credal/callCopilot.js +0 -36
  119. package/dist/actions/providers/google-oauth/listGmailThreads.d.ts +0 -3
  120. package/dist/actions/providers/google-oauth/listGmailThreads.js +0 -98
  121. package/dist/actions/providers/google-oauth/searchGmailMessages.d.ts +0 -3
  122. package/dist/actions/providers/google-oauth/searchGmailMessages.js +0 -91
  123. package/dist/actions/providers/jamf/getComputerInventory.d.ts +0 -3
  124. package/dist/actions/providers/jamf/getComputerInventory.js +0 -45
  125. package/dist/actions/providers/jamf/getFileVaultRecoveryKey.d.ts +0 -3
  126. package/dist/actions/providers/jamf/getFileVaultRecoveryKey.js +0 -40
  127. package/dist/actions/providers/math/index.d.ts +0 -1
  128. package/dist/actions/providers/math/index.js +0 -37
  129. package/dist/actions/providers/slack/index.d.ts +0 -1
  130. package/dist/actions/providers/slack/index.js +0 -37
  131. package/dist/actions/providers/slack/listConversations.d.ts +0 -3
  132. 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,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 missingAuthConstants_1 = require("../../util/missingAuthConstants");
16
- const axios_1 = __importDefault(require("axios"));
10
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
11
+ import axios from "axios";
17
12
  // Notion response is not standard for title, title can be in different places
18
13
  // This function checks if the title is in the properties object
19
14
  function isTitleProperty(prop) {
@@ -28,10 +23,10 @@ const searchByTitle = (_a) => __awaiter(void 0, [_a], void 0, function* ({ param
28
23
  const { authToken } = authParams;
29
24
  const { query } = params;
30
25
  if (!authToken) {
31
- return { success: false, error: missingAuthConstants_1.MISSING_AUTH_TOKEN, results: [] };
26
+ return { success: false, error: MISSING_AUTH_TOKEN, results: [] };
32
27
  }
33
28
  try {
34
- const response = yield axios_1.default.post("https://api.notion.com/v1/search", { query }, {
29
+ const response = yield axios.post("https://api.notion.com/v1/search", { query }, {
35
30
  headers: {
36
31
  Authorization: `Bearer ${authToken}`,
37
32
  "Notion-Version": "2022-06-28",
@@ -68,4 +63,4 @@ const searchByTitle = (_a) => __awaiter(void 0, [_a], void 0, function* ({ param
68
63
  };
69
64
  }
70
65
  });
71
- exports.default = searchByTitle;
66
+ export default searchByTitle;
@@ -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,26 +7,25 @@ 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 datetime_1 = require("../../../utils/datetime");
13
- const axiosClient_1 = require("../../util/axiosClient");
10
+ import { isBetweenDatetime, isValidIsoDatestring } from "../../../utils/datetime";
11
+ import { axiosClient } from "../../util/axiosClient";
14
12
  const getForecastForLocation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
15
13
  const { latitude, longitude, isoDate } = params;
16
14
  const { userAgent } = authParams;
17
- if (!(0, datetime_1.isValidIsoDatestring)(isoDate)) {
15
+ if (!isValidIsoDatestring(isoDate)) {
18
16
  throw new Error("Invalid ISO date format");
19
17
  }
20
18
  const url = `https://api.weather.gov/points/${latitude},${longitude}`;
21
- const pointsResponse = yield axiosClient_1.axiosClient.get(url, { headers: { "User-Agent": userAgent } });
19
+ const pointsResponse = yield axiosClient.get(url, { headers: { "User-Agent": userAgent } });
22
20
  const forecastUrl = pointsResponse.data.properties.forecast;
23
- const forecastResponse = yield axiosClient_1.axiosClient.get(forecastUrl, {
21
+ const forecastResponse = yield axiosClient.get(forecastUrl, {
24
22
  headers: { "User-Agent": userAgent },
25
23
  });
26
24
  const forecastData = forecastResponse.data;
27
25
  // Step 4: Filter for the target date
28
26
  const targetDateString = isoDate.split("T")[0];
29
27
  const relevantForecasts = forecastData.properties.periods.filter((period) => {
30
- return (0, datetime_1.isBetweenDatetime)(targetDateString, period.startTime, period.endTime);
28
+ return isBetweenDatetime(targetDateString, period.startTime, period.endTime);
31
29
  });
32
30
  let result;
33
31
  if (relevantForecasts.length > 0) {
@@ -39,4 +37,4 @@ const getForecastForLocation = (_a) => __awaiter(void 0, [_a], void 0, function*
39
37
  }
40
38
  return { result };
41
39
  });
42
- exports.default = getForecastForLocation;
40
+ export default getForecastForLocation;
@@ -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,17 +7,16 @@ 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 getLatitudeLongitudeFromLocation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
12
  const { location } = params;
15
13
  const { userAgent } = authParams;
16
14
  const url = `https://nominatim.openstreetmap.org/search?q=${encodeURIComponent(location)}&format=json`;
17
- const response = yield axiosClient_1.axiosClient.get(url, { headers: { "User-Agent": userAgent } });
15
+ const response = yield axiosClient.get(url, { headers: { "User-Agent": userAgent } });
18
16
  return response.data.map((result) => ({
19
17
  latitude: parseFloat(result.lat),
20
18
  longitude: parseFloat(result.lon),
21
19
  displayName: result.display_name,
22
20
  }));
23
21
  });
24
- exports.default = getLatitudeLongitudeFromLocation;
22
+ export default getLatitudeLongitudeFromLocation;
@@ -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 resend_1 = require("resend");
13
- const types_1 = require("../../autogen/types");
10
+ import { Resend } from "resend";
11
+ import { resendSendEmailOutputSchema } from "../../autogen/types";
14
12
  const sendEmail = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
15
13
  try {
16
- const resend = new resend_1.Resend(authParams.apiKey);
14
+ const resend = new Resend(authParams.apiKey);
17
15
  const result = yield resend.emails.send({
18
16
  from: authParams.emailFrom,
19
17
  replyTo: authParams.emailReplyTo,
@@ -25,15 +23,15 @@ const sendEmail = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, a
25
23
  if (result.error) {
26
24
  throw new Error(result.error.message);
27
25
  }
28
- return types_1.resendSendEmailOutputSchema.parse({
26
+ return resendSendEmailOutputSchema.parse({
29
27
  success: true,
30
28
  });
31
29
  }
32
30
  catch (error) {
33
- return types_1.resendSendEmailOutputSchema.parse({
31
+ return resendSendEmailOutputSchema.parse({
34
32
  success: false,
35
33
  error: error instanceof Error ? error.message : "Unknown error",
36
34
  });
37
35
  }
38
36
  });
39
- exports.default = sendEmail;
37
+ export default sendEmail;
@@ -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 createCase = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
12
  const { authToken, baseUrl } = authParams;
15
13
  const { subject, description, priority, origin, customFields } = params;
@@ -22,7 +20,7 @@ const createCase = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
22
20
  const url = `${baseUrl}/services/data/v56.0/sobjects/Case`;
23
21
  const caseData = Object.assign({ Subject: subject, Description: description, Priority: priority, Origin: origin }, customFields);
24
22
  try {
25
- const response = yield axiosClient_1.axiosClient.post(url, caseData, {
23
+ const response = yield axiosClient.post(url, caseData, {
26
24
  headers: {
27
25
  Authorization: `Bearer ${authToken}`,
28
26
  "Content-Type": "application/json",
@@ -41,4 +39,4 @@ const createCase = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
41
39
  };
42
40
  }
43
41
  });
44
- exports.default = createCase;
42
+ export default createCase;
@@ -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 { ApiError, axiosClient } from "../../util/axiosClient";
13
11
  const createRecord = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
12
  const { authToken, baseUrl } = authParams;
15
13
  const { objectType, fieldsToCreate } = params;
@@ -21,7 +19,7 @@ const createRecord = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params
21
19
  }
22
20
  const url = `${baseUrl}/services/data/v56.0/sobjects/${objectType}/`;
23
21
  try {
24
- const response = yield axiosClient_1.axiosClient.post(url, fieldsToCreate, {
22
+ const response = yield axiosClient.post(url, fieldsToCreate, {
25
23
  headers: {
26
24
  Authorization: `Bearer ${authToken}`,
27
25
  "Content-Type": "application/json",
@@ -36,7 +34,7 @@ const createRecord = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params
36
34
  console.error("Error creating Salesforce object:", error);
37
35
  return {
38
36
  success: false,
39
- error: error instanceof axiosClient_1.ApiError
37
+ error: error instanceof ApiError
40
38
  ? error.data.length > 0
41
39
  ? error.data[0].message
42
40
  : error.message
@@ -44,4 +42,4 @@ const createRecord = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params
44
42
  };
45
43
  }
46
44
  });
47
- exports.default = createRecord;
45
+ export default createRecord;
@@ -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 fetchSalesforceSchemaByObject = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
12
  const { authToken, baseUrl } = authParams;
15
13
  const { objectType } = params;
@@ -21,7 +19,7 @@ const fetchSalesforceSchemaByObject = (_a) => __awaiter(void 0, [_a], void 0, fu
21
19
  }
22
20
  const url = `${baseUrl}/services/data/v56.0/sobjects/${objectType}/describe/`;
23
21
  try {
24
- const response = yield axiosClient_1.axiosClient.get(url, {
22
+ const response = yield axiosClient.get(url, {
25
23
  headers: {
26
24
  Authorization: `Bearer ${authToken}`,
27
25
  },
@@ -39,4 +37,4 @@ const fetchSalesforceSchemaByObject = (_a) => __awaiter(void 0, [_a], void 0, fu
39
37
  };
40
38
  }
41
39
  });
42
- exports.default = fetchSalesforceSchemaByObject;
40
+ export default fetchSalesforceSchemaByObject;
@@ -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 generateSalesReport = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
12
  const { authToken, baseUrl } = authParams;
15
13
  const { startDate, endDate, filters } = params;
@@ -31,7 +29,7 @@ const generateSalesReport = (_a) => __awaiter(void 0, [_a], void 0, function* ({
31
29
  `;
32
30
  const url = `${baseUrl}/services/data/v56.0/query?q=${encodeURIComponent(query)}`;
33
31
  try {
34
- const response = yield axiosClient_1.axiosClient.get(url, {
32
+ const response = yield axiosClient.get(url, {
35
33
  headers: {
36
34
  Authorization: `Bearer ${authToken}`,
37
35
  },
@@ -49,4 +47,4 @@ const generateSalesReport = (_a) => __awaiter(void 0, [_a], void 0, function* ({
49
47
  };
50
48
  }
51
49
  });
52
- exports.default = generateSalesReport;
50
+ export default generateSalesReport;
@@ -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 getRecord = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
12
  const { authToken, baseUrl } = authParams;
15
13
  const { objectType, recordId } = params;
@@ -21,7 +19,7 @@ const getRecord = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, a
21
19
  }
22
20
  const url = `${baseUrl}/services/data/v56.0/sobjects/${objectType}/${recordId}`;
23
21
  try {
24
- const response = yield axiosClient_1.axiosClient.get(url, {
22
+ const response = yield axiosClient.get(url, {
25
23
  headers: {
26
24
  Authorization: `Bearer ${authToken}`,
27
25
  },
@@ -39,4 +37,4 @@ const getRecord = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, a
39
37
  };
40
38
  }
41
39
  });
42
- exports.default = getRecord;
40
+ export default getRecord;
@@ -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 { ApiError, axiosClient } from "../../util/axiosClient";
13
11
  const getSalesforceRecordsByQuery = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
12
  const { authToken, baseUrl } = authParams;
15
13
  const { query, limit } = params;
@@ -22,7 +20,7 @@ const getSalesforceRecordsByQuery = (_a) => __awaiter(void 0, [_a], void 0, func
22
20
  // The API limits the maximum number of records returned to 2000, the limit lets the user set a smaller custom limit
23
21
  const url = `${baseUrl}/services/data/v56.0/queryAll?q=${encodeURIComponent(query + " LIMIT " + (limit != undefined && limit <= 2000 ? limit : 2000))}`;
24
22
  try {
25
- const response = yield axiosClient_1.axiosClient.get(url, {
23
+ const response = yield axiosClient.get(url, {
26
24
  headers: {
27
25
  Authorization: `Bearer ${authToken}`,
28
26
  },
@@ -36,7 +34,7 @@ const getSalesforceRecordsByQuery = (_a) => __awaiter(void 0, [_a], void 0, func
36
34
  console.error("Error retrieving Salesforce record:", error);
37
35
  return {
38
36
  success: false,
39
- error: error instanceof axiosClient_1.ApiError
37
+ error: error instanceof ApiError
40
38
  ? error.data.length > 0
41
39
  ? error.data[0].message
42
40
  : error.message
@@ -44,4 +42,4 @@ const getSalesforceRecordsByQuery = (_a) => __awaiter(void 0, [_a], void 0, func
44
42
  };
45
43
  }
46
44
  });
47
- exports.default = getSalesforceRecordsByQuery;
45
+ export default getSalesforceRecordsByQuery;
@@ -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 updateRecord = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
12
  const { authToken, baseUrl } = authParams;
15
13
  const { objectType, recordId, fieldsToUpdate } = params;
@@ -21,7 +19,7 @@ const updateRecord = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params
21
19
  }
22
20
  const url = `${baseUrl}/services/data/v56.0/sobjects/${objectType}/${recordId}`;
23
21
  try {
24
- yield axiosClient_1.axiosClient.patch(url, fieldsToUpdate, {
22
+ yield axiosClient.patch(url, fieldsToUpdate, {
25
23
  headers: {
26
24
  Authorization: `Bearer ${authToken}`,
27
25
  "Content-Type": "application/json",
@@ -39,4 +37,4 @@ const updateRecord = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params
39
37
  };
40
38
  }
41
39
  });
42
- exports.default = updateRecord;
40
+ export default updateRecord;
@@ -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,17 +7,16 @@ 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 web_api_1 = require("@slack/web-api");
13
- const helpers_1 = require("./helpers");
14
- const missingAuthConstants_1 = require("../../util/missingAuthConstants");
10
+ import { WebClient } from "@slack/web-api";
11
+ import { getSlackChannels } from "./helpers";
12
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
15
13
  const getChannelMessages = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
16
14
  if (!authParams.authToken) {
17
- throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
15
+ throw new Error(MISSING_AUTH_TOKEN);
18
16
  }
19
- const client = new web_api_1.WebClient(authParams.authToken);
17
+ const client = new WebClient(authParams.authToken);
20
18
  const { channelName, oldest } = params;
21
- const allChannels = yield (0, helpers_1.getSlackChannels)(client);
19
+ const allChannels = yield getSlackChannels(client);
22
20
  const channel = allChannels.find(channel => channel.name === channelName && channel.is_private === false);
23
21
  if (!channel || !channel.id) {
24
22
  throw Error(`Channel with name ${channelName} not found`);
@@ -34,4 +32,4 @@ const getChannelMessages = (_a) => __awaiter(void 0, [_a], void 0, function* ({
34
32
  messages: messages.messages,
35
33
  };
36
34
  });
37
- exports.default = getChannelMessages;
35
+ export default getChannelMessages;
@@ -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) {
@@ -15,9 +14,7 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
15
14
  function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
16
15
  function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
17
16
  };
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.getSlackChannels = getSlackChannels;
20
- function getSlackChannels(client) {
17
+ export function getSlackChannels(client) {
21
18
  return __awaiter(this, void 0, void 0, function* () {
22
19
  var _a, e_1, _b, _c;
23
20
  const limit = 100;
@@ -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,18 +7,17 @@ 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 web_api_1 = require("@slack/web-api");
13
- const types_1 = require("../../autogen/types");
14
- const helpers_1 = require("./helpers");
15
- const missingAuthConstants_1 = require("../../util/missingAuthConstants");
10
+ import { WebClient } from "@slack/web-api";
11
+ import { slackSendMessageOutputSchema, } from "../../autogen/types";
12
+ import { getSlackChannels } from "./helpers";
13
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
16
14
  const sendMessage = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
17
15
  if (!authParams.authToken) {
18
- throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
16
+ throw new Error(MISSING_AUTH_TOKEN);
19
17
  }
20
- const client = new web_api_1.WebClient(authParams.authToken);
18
+ const client = new WebClient(authParams.authToken);
21
19
  const { channelName, message } = params;
22
- const allChannels = yield (0, helpers_1.getSlackChannels)(client);
20
+ const allChannels = yield getSlackChannels(client);
23
21
  const channel = allChannels.find(channel => channel.name == channelName);
24
22
  if (!channel || !channel.id) {
25
23
  throw Error(`Channel with name ${channelName} not found`);
@@ -37,15 +35,15 @@ const sendMessage = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
37
35
  },
38
36
  ],
39
37
  });
40
- return types_1.slackSendMessageOutputSchema.parse({
38
+ return slackSendMessageOutputSchema.parse({
41
39
  success: true,
42
40
  });
43
41
  }
44
42
  catch (error) {
45
- return types_1.slackSendMessageOutputSchema.parse({
43
+ return slackSendMessageOutputSchema.parse({
46
44
  success: false,
47
45
  error: error instanceof Error ? error.message : "Unknown error",
48
46
  });
49
47
  }
50
48
  });
51
- exports.default = sendMessage;
49
+ export default sendMessage;
@@ -1,37 +1,3 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -41,11 +7,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
41
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
42
8
  });
43
9
  };
44
- Object.defineProperty(exports, "__esModule", { value: true });
45
- exports.getSnowflakeConnection = getSnowflakeConnection;
46
- exports.connectToSnowflakeAndWarehouse = connectToSnowflakeAndWarehouse;
47
- const snowflake = __importStar(require("snowflake-sdk"));
48
- const forge = __importStar(require("node-forge"));
10
+ import * as snowflake from "snowflake-sdk";
11
+ import * as forge from "node-forge";
49
12
  const getPrivateKeyCorrectFormat = (privateKey) => {
50
13
  try {
51
14
  // Parse the private key
@@ -58,7 +21,7 @@ const getPrivateKeyCorrectFormat = (privateKey) => {
58
21
  throw new Error("Invalid private key format. Please check the key format and try again.");
59
22
  }
60
23
  };
61
- function getSnowflakeConnection(snowflakeData, authParams) {
24
+ export function getSnowflakeConnection(snowflakeData, authParams) {
62
25
  const { authToken, apiKey } = authParams;
63
26
  const { account, username, warehouse, database } = snowflakeData;
64
27
  if (authToken) {
@@ -89,7 +52,7 @@ function getSnowflakeConnection(snowflakeData, authParams) {
89
52
  throw new Error("Snowflake authToken or apiKey is required");
90
53
  }
91
54
  }
92
- function connectToSnowflakeAndWarehouse(connection, warehouse) {
55
+ export function connectToSnowflakeAndWarehouse(connection, warehouse) {
93
56
  return __awaiter(this, void 0, void 0, function* () {
94
57
  yield new Promise((resolve, reject) => {
95
58
  connection.connect((err, conn) => {
@@ -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 getSnowflakeConnection_1 = require("./auth/getSnowflakeConnection");
10
+ import { getSnowflakeConnection } from "./auth/getSnowflakeConnection";
13
11
  const getRowByFieldValue = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
12
  const { databaseName, tableName, fieldName, warehouse, fieldValue, accountName } = params;
15
13
  if (!accountName || !databaseName || !warehouse) {
@@ -17,7 +15,7 @@ const getRowByFieldValue = (_a) => __awaiter(void 0, [_a], void 0, function* ({
17
15
  throw new Error("Account name and user are required");
18
16
  }
19
17
  // Set up a connection using snowflake-sdk
20
- const connection = (0, getSnowflakeConnection_1.getSnowflakeConnection)({
18
+ const connection = getSnowflakeConnection({
21
19
  account: accountName,
22
20
  username: authParams.username || "CREDAL_USER",
23
21
  warehouse: warehouse,
@@ -78,4 +76,4 @@ const getRowByFieldValue = (_a) => __awaiter(void 0, [_a], void 0, function* ({
78
76
  });
79
77
  }
80
78
  });
81
- exports.default = getRowByFieldValue;
79
+ export default getRowByFieldValue;
@@ -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,10 @@ 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 snowflake_sdk_1 = __importDefault(require("snowflake-sdk"));
16
- const getSnowflakeConnection_1 = require("./auth/getSnowflakeConnection");
17
- const formatDataForCodeInterpreter_1 = require("../../util/formatDataForCodeInterpreter");
18
- snowflake_sdk_1.default.configure({ logLevel: "ERROR" });
10
+ import snowflake from "snowflake-sdk";
11
+ import { connectToSnowflakeAndWarehouse, getSnowflakeConnection } from "./auth/getSnowflakeConnection";
12
+ import { formatDataForCodeInterpreter } from "../../util/formatDataForCodeInterpreter";
13
+ snowflake.configure({ logLevel: "ERROR" });
19
14
  const runSnowflakeQuery = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
20
15
  const { databaseName, warehouse, query, accountName, outputFormat = "json", limit } = params;
21
16
  const executeQueryAndFormatData = () => __awaiter(void 0, void 0, void 0, function* () {
@@ -37,11 +32,11 @@ const runSnowflakeQuery = (_a) => __awaiter(void 0, [_a], void 0, function* ({ p
37
32
  if (limit && queryResults.length > limit) {
38
33
  queryResults.splice(limit);
39
34
  }
40
- const formattedData = (0, formatDataForCodeInterpreter_1.formatDataForCodeInterpreter)(queryResults, outputFormat);
35
+ const formattedData = formatDataForCodeInterpreter(queryResults, outputFormat);
41
36
  return { formattedData: formattedData, resultsLength: fullResultLength };
42
37
  });
43
38
  // Set up a connection using snowflake-sdk
44
- const connection = (0, getSnowflakeConnection_1.getSnowflakeConnection)({
39
+ const connection = getSnowflakeConnection({
45
40
  account: accountName,
46
41
  username: authParams.username || "CREDAL_USER",
47
42
  warehouse: warehouse,
@@ -49,7 +44,7 @@ const runSnowflakeQuery = (_a) => __awaiter(void 0, [_a], void 0, function* ({ p
49
44
  }, { authToken: authParams.authToken, apiKey: authParams.apiKey });
50
45
  try {
51
46
  // Connect to Snowflake
52
- yield (0, getSnowflakeConnection_1.connectToSnowflakeAndWarehouse)(connection, warehouse);
47
+ yield connectToSnowflakeAndWarehouse(connection, warehouse);
53
48
  const { formattedData, resultsLength } = yield executeQueryAndFormatData();
54
49
  // Return fields to match schema definition
55
50
  connection.destroy(err => {
@@ -73,4 +68,4 @@ const runSnowflakeQuery = (_a) => __awaiter(void 0, [_a], void 0, function* ({ p
73
68
  throw Error(`An error occurred: ${error}`);
74
69
  }
75
70
  });
76
- exports.default = runSnowflakeQuery;
71
+ export default runSnowflakeQuery;
@@ -1,5 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
1
  const createXSharePostUrl = ({ params, }) => {
4
2
  const baseUrl = "https://twitter.com/intent/tweet";
5
3
  const queryParams = new URLSearchParams();
@@ -39,4 +37,4 @@ const createXSharePostUrl = ({ params, }) => {
39
37
  xUrl: shareUrl,
40
38
  });
41
39
  };
42
- exports.default = createXSharePostUrl;
40
+ export default createXSharePostUrl;