@credal/actions 0.1.71 → 0.1.74

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 (58) hide show
  1. package/dist/actions/actionMapper.js +4 -4
  2. package/dist/actions/autogen/templates.js +1 -0
  3. package/dist/actions/autogen/types.d.ts +7 -7
  4. package/dist/actions/autogen/types.js +1 -1
  5. package/dist/actions/invoke.js +4 -0
  6. package/dist/actions/providers/asana/commentAsanaTask.js +3 -2
  7. package/dist/actions/providers/asana/createAsanaTask.js +3 -2
  8. package/dist/actions/providers/asana/updateAsanaTask.js +3 -2
  9. package/dist/actions/providers/ashby/addCandidateToProject.js +2 -1
  10. package/dist/actions/providers/ashby/createCandidate.js +2 -4
  11. package/dist/actions/providers/ashby/createNote.js +2 -1
  12. package/dist/actions/providers/ashby/getCandidateInfo.js +2 -1
  13. package/dist/actions/providers/ashby/listCandidateNotes.js +2 -1
  14. package/dist/actions/providers/ashby/listCandidates.js +2 -1
  15. package/dist/actions/providers/ashby/searchCandidates.js +2 -1
  16. package/dist/actions/providers/ashby/updateCandidate.js +2 -4
  17. package/dist/actions/providers/confluence/fetchPageContent.js +2 -1
  18. package/dist/actions/providers/confluence/overwritePage.js +2 -1
  19. package/dist/actions/providers/firecrawl/scrapeTweetDataWithNitter.js +2 -1
  20. package/dist/actions/providers/github/createBranch.js +2 -1
  21. package/dist/actions/providers/github/createOrUpdateFile.js +2 -1
  22. package/dist/actions/providers/github/createPullRequest.js +2 -1
  23. package/dist/actions/providers/github/listPullRequests.js +4 -0
  24. package/dist/actions/providers/gong/getGongTranscripts.js +109 -42
  25. package/dist/actions/providers/google-oauth/createNewGoogleDoc.js +2 -1
  26. package/dist/actions/providers/google-oauth/createPresentation.js +2 -1
  27. package/dist/actions/providers/google-oauth/createSpreadsheet.js +2 -1
  28. package/dist/actions/providers/google-oauth/scheduleCalendarMeeting.js +2 -1
  29. package/dist/actions/providers/google-oauth/updateDoc.js +2 -1
  30. package/dist/actions/providers/google-oauth/updatePresentation.js +2 -1
  31. package/dist/actions/providers/google-oauth/updateSpreadsheet.js +2 -1
  32. package/dist/actions/providers/jira/commentJiraTicket.js +2 -2
  33. package/dist/actions/providers/jira/createJiraTicket.js +2 -2
  34. package/dist/actions/providers/jira/getJiraIssuesByQuery.js +3 -0
  35. package/dist/actions/providers/jira/getJiraTicketDetails.js +2 -2
  36. package/dist/actions/providers/jira/getJiraTicketHistory.js +2 -2
  37. package/dist/actions/providers/jira/updateJiraTicketDetails.js +2 -2
  38. package/dist/actions/providers/jira/updateJiraTicketStatus.js +2 -2
  39. package/dist/actions/providers/microsoft/messageTeamsChannel.js +0 -15
  40. package/dist/actions/providers/microsoft/messageTeamsChat.js +0 -12
  41. package/dist/actions/providers/salesforce/createRecord.js +0 -6
  42. package/dist/actions/providers/salesforce/getSalesforceRecordByQuery.d.ts +3 -0
  43. package/dist/actions/providers/salesforce/getSalesforceRecordByQuery.js +43 -0
  44. package/dist/actions/providers/slack/getChannelMessages.js +4 -0
  45. package/dist/actions/providers/slack/sendMessage.js +4 -0
  46. package/dist/actions/providers/snowflake/getRowByFieldValue.js +2 -1
  47. package/dist/actions/providers/snowflake/runSnowflakeQuery.js +0 -3
  48. package/dist/actions/providers/zendesk/addCommentToTicket.js +2 -1
  49. package/dist/actions/providers/zendesk/assignTicket.js +2 -1
  50. package/dist/actions/providers/zendesk/createZendeskTicket.js +2 -1
  51. package/dist/actions/providers/zendesk/getTicketDetails.js +2 -1
  52. package/dist/actions/providers/zendesk/listTickets.js +2 -1
  53. package/dist/actions/providers/zendesk/updateTicketStatus.js +2 -1
  54. package/dist/actions/util/missingAuthConstants.d.ts +2 -0
  55. package/dist/actions/util/missingAuthConstants.js +5 -0
  56. package/package.json +1 -1
  57. package/dist/actions/providers/confluence/updatePage.d.ts +0 -3
  58. package/dist/actions/providers/confluence/updatePage.js +0 -47
@@ -408,8 +408,8 @@ exports.ActionMapper = {
408
408
  },
409
409
  addCandidateToProject: {
410
410
  fn: addCandidateToProject_1.default,
411
- paramsSchema: types_1.ashbyUpdateCandidateParamsSchema,
412
- outputSchema: types_1.ashbyUpdateCandidateOutputSchema,
411
+ paramsSchema: types_1.ashbyAddCandidateToProjectParamsSchema,
412
+ outputSchema: types_1.ashbyAddCandidateToProjectOutputSchema,
413
413
  },
414
414
  },
415
415
  salesforce: {
@@ -472,8 +472,8 @@ exports.ActionMapper = {
472
472
  },
473
473
  createDocument: {
474
474
  fn: createDocument_1.default,
475
- paramsSchema: types_1.microsoftUpdateDocumentParamsSchema,
476
- outputSchema: types_1.microsoftUpdateDocumentOutputSchema,
475
+ paramsSchema: types_1.microsoftCreateDocumentParamsSchema,
476
+ outputSchema: types_1.microsoftCreateDocumentOutputSchema,
477
477
  },
478
478
  getDocument: {
479
479
  fn: getDocument_1.default,
@@ -4906,6 +4906,7 @@ exports.gongGetGongTranscriptsDefinition = {
4906
4906
  },
4907
4907
  topic: {
4908
4908
  type: "string",
4909
+ nullable: true,
4909
4910
  description: "The topic of the transcript",
4910
4911
  },
4911
4912
  sentences: {
@@ -1958,7 +1958,7 @@ export declare const gongGetGongTranscriptsOutputSchema: z.ZodObject<{
1958
1958
  callId: z.ZodOptional<z.ZodString>;
1959
1959
  transcript: z.ZodOptional<z.ZodArray<z.ZodObject<{
1960
1960
  speakerName: z.ZodOptional<z.ZodString>;
1961
- topic: z.ZodOptional<z.ZodString>;
1961
+ topic: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1962
1962
  sentences: z.ZodOptional<z.ZodArray<z.ZodObject<{
1963
1963
  start: z.ZodOptional<z.ZodNumber>;
1964
1964
  end: z.ZodOptional<z.ZodNumber>;
@@ -1974,7 +1974,7 @@ export declare const gongGetGongTranscriptsOutputSchema: z.ZodObject<{
1974
1974
  }>, "many">>;
1975
1975
  }, "strip", z.ZodTypeAny, {
1976
1976
  speakerName?: string | undefined;
1977
- topic?: string | undefined;
1977
+ topic?: string | null | undefined;
1978
1978
  sentences?: {
1979
1979
  text?: string | undefined;
1980
1980
  start?: number | undefined;
@@ -1982,7 +1982,7 @@ export declare const gongGetGongTranscriptsOutputSchema: z.ZodObject<{
1982
1982
  }[] | undefined;
1983
1983
  }, {
1984
1984
  speakerName?: string | undefined;
1985
- topic?: string | undefined;
1985
+ topic?: string | null | undefined;
1986
1986
  sentences?: {
1987
1987
  text?: string | undefined;
1988
1988
  start?: number | undefined;
@@ -1993,7 +1993,7 @@ export declare const gongGetGongTranscriptsOutputSchema: z.ZodObject<{
1993
1993
  callId?: string | undefined;
1994
1994
  transcript?: {
1995
1995
  speakerName?: string | undefined;
1996
- topic?: string | undefined;
1996
+ topic?: string | null | undefined;
1997
1997
  sentences?: {
1998
1998
  text?: string | undefined;
1999
1999
  start?: number | undefined;
@@ -2004,7 +2004,7 @@ export declare const gongGetGongTranscriptsOutputSchema: z.ZodObject<{
2004
2004
  callId?: string | undefined;
2005
2005
  transcript?: {
2006
2006
  speakerName?: string | undefined;
2007
- topic?: string | undefined;
2007
+ topic?: string | null | undefined;
2008
2008
  sentences?: {
2009
2009
  text?: string | undefined;
2010
2010
  start?: number | undefined;
@@ -2020,7 +2020,7 @@ export declare const gongGetGongTranscriptsOutputSchema: z.ZodObject<{
2020
2020
  callId?: string | undefined;
2021
2021
  transcript?: {
2022
2022
  speakerName?: string | undefined;
2023
- topic?: string | undefined;
2023
+ topic?: string | null | undefined;
2024
2024
  sentences?: {
2025
2025
  text?: string | undefined;
2026
2026
  start?: number | undefined;
@@ -2035,7 +2035,7 @@ export declare const gongGetGongTranscriptsOutputSchema: z.ZodObject<{
2035
2035
  callId?: string | undefined;
2036
2036
  transcript?: {
2037
2037
  speakerName?: string | undefined;
2038
- topic?: string | undefined;
2038
+ topic?: string | null | undefined;
2039
2039
  sentences?: {
2040
2040
  text?: string | undefined;
2041
2041
  start?: number | undefined;
@@ -1987,7 +1987,7 @@ exports.gongGetGongTranscriptsOutputSchema = zod_1.z.object({
1987
1987
  .array(zod_1.z
1988
1988
  .object({
1989
1989
  speakerName: zod_1.z.string().describe("The name of the speaker").optional(),
1990
- topic: zod_1.z.string().describe("The topic of the transcript").optional(),
1990
+ topic: zod_1.z.string().nullable().describe("The topic of the transcript").optional(),
1991
1991
  sentences: zod_1.z
1992
1992
  .array(zod_1.z
1993
1993
  .object({
@@ -18,6 +18,10 @@ function invokeAction(input) {
18
18
  throw new Error(`Provider '${provider}' not found`);
19
19
  }
20
20
  const providerFunction = actionMapper_1.ActionMapper[provider][name].fn;
21
+ const safeParseParams = actionMapper_1.ActionMapper[provider][name].paramsSchema.safeParse(parameters);
22
+ if (!safeParseParams.success) {
23
+ throw new Error(`Invalid parameters for action '${name}': ${safeParseParams.error}`);
24
+ }
21
25
  return providerFunction({ params: parameters, authParams });
22
26
  });
23
27
  }
@@ -10,12 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const axiosClient_1 = require("../../util/axiosClient");
13
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
13
14
  const commentAsanaTask = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
15
  var _b, _c;
15
16
  const { authToken } = authParams;
16
17
  const { commentText, isPinned, taskId } = params;
17
- if (!commentText || !authToken) {
18
- return { success: false, error: "Comment text and valid authToken are required" };
18
+ if (!authToken) {
19
+ return { success: false, error: missingAuthConstants_1.MISSING_AUTH_TOKEN };
19
20
  }
20
21
  try {
21
22
  const response = yield axiosClient_1.axiosClient.post(`https://app.asana.com/api/1.0/tasks/${taskId}/stories`, {
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const axiosClient_1 = require("../../util/axiosClient");
13
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
13
14
  const utils_1 = require("./utils");
14
15
  const getTaskTemplates = (authToken, projectId) => __awaiter(void 0, void 0, void 0, function* () {
15
16
  const url = `https://app.asana.com/api/1.0/task_templates/?project=${projectId}`;
@@ -28,8 +29,8 @@ const createAsanaTask = (_a) => __awaiter(void 0, [_a], void 0, function* ({ par
28
29
  var _b, _c;
29
30
  const { authToken } = authParams;
30
31
  const { name, projectId, description, customFields, taskTemplate, assignee, approvalStatus, dueAt } = params;
31
- if (!name || !authToken || !projectId) {
32
- return { success: false, error: "Task name, valid authToken, and projectId are required" };
32
+ if (!authToken) {
33
+ return { success: false, error: missingAuthConstants_1.MISSING_AUTH_TOKEN };
33
34
  }
34
35
  const workspaceId = yield (0, utils_1.getWorkspaceIdFromProject)(projectId, authToken);
35
36
  if (!workspaceId) {
@@ -10,12 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const axiosClient_1 = require("../../util/axiosClient");
13
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
13
14
  const utils_1 = require("./utils");
14
15
  const updateAsanaTask = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
15
16
  const { authToken } = authParams;
16
17
  const { name, taskId, description, customFields, completed, assignee, approvalStatus, dueAt } = params;
17
- if (!authToken || !taskId) {
18
- return { success: false, error: "Valid authToken, and taskId are required" };
18
+ if (!authToken) {
19
+ return { success: false, error: missingAuthConstants_1.MISSING_AUTH_TOKEN };
19
20
  }
20
21
  const { workspaceId, permalinkUrl } = yield (0, utils_1.getWorkspaceIdAndPermalinkFromTask)(taskId, authToken);
21
22
  if (!workspaceId || !permalinkUrl) {
@@ -10,11 +10,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const axiosClient_1 = require("../../util/axiosClient");
13
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
13
14
  const addCandidateToProject = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
15
  const { candidateId, projectId } = params;
15
16
  const { authToken } = authParams;
16
17
  if (!authToken) {
17
- throw new Error("Auth token is required");
18
+ throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
18
19
  }
19
20
  const response = yield axiosClient_1.axiosClient.post(`https://api.ashbyhq.com/candidate.addProject`, {
20
21
  candidateId,
@@ -10,13 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const axiosClient_1 = require("../../util/axiosClient");
13
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
13
14
  const createCandidate = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
15
  const { authToken } = authParams;
15
16
  if (!authToken) {
16
- throw new Error("Auth token is required");
17
- }
18
- if (!params.name) {
19
- throw new Error("Name is required");
17
+ throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
20
18
  }
21
19
  const response = yield axiosClient_1.axiosClient.post(`https://api.ashbyhq.com/candidate.create`, {
22
20
  name: params.name,
@@ -10,11 +10,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const axiosClient_1 = require("../../util/axiosClient");
13
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
13
14
  const createNote = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
15
  const { candidateId, note } = params;
15
16
  const { authToken } = authParams;
16
17
  if (!authToken) {
17
- throw new Error("Auth token is required");
18
+ throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
18
19
  }
19
20
  const response = yield axiosClient_1.axiosClient.post(`https://api.ashbyhq.com/candidate.createNote`, {
20
21
  candidateId,
@@ -10,11 +10,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const axiosClient_1 = require("../../util/axiosClient");
13
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
13
14
  const getCandidateInfo = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
15
  const { candidateId } = params;
15
16
  const { authToken } = authParams;
16
17
  if (!authToken) {
17
- throw new Error("Auth token is required");
18
+ throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
18
19
  }
19
20
  const response = yield axiosClient_1.axiosClient.post(`https://api.ashbyhq.com/candidate.info`, {
20
21
  id: candidateId,
@@ -10,11 +10,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const axiosClient_1 = require("../../util/axiosClient");
13
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
13
14
  const listCandidateNotes = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
15
  const { candidateId } = params;
15
16
  const { authToken } = authParams;
16
17
  if (!authToken) {
17
- throw new Error("Auth token is required");
18
+ throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
18
19
  }
19
20
  const response = yield axiosClient_1.axiosClient.post(`https://api.ashbyhq.com/candidate.listNotes`, {
20
21
  candidateId,
@@ -10,10 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const axiosClient_1 = require("../../util/axiosClient");
13
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
13
14
  const listCandidates = (_a) => __awaiter(void 0, [_a], void 0, function* ({ authParams, }) {
14
15
  const { authToken } = authParams;
15
16
  if (!authToken) {
16
- throw new Error("Auth token is required");
17
+ throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
17
18
  }
18
19
  const response = yield axiosClient_1.axiosClient.post(`https://api.ashbyhq.com/candidate.list`, null, {
19
20
  auth: {
@@ -10,11 +10,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const axiosClient_1 = require("../../util/axiosClient");
13
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
13
14
  const searchCandidates = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
15
  const { email, name } = params;
15
16
  const { authToken } = authParams;
16
17
  if (!authToken) {
17
- throw new Error("Auth token is required");
18
+ throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
18
19
  }
19
20
  const response = yield axiosClient_1.axiosClient.post(`https://api.ashbyhq.com/candidate.search`, {
20
21
  email,
@@ -10,13 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const axiosClient_1 = require("../../util/axiosClient");
13
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
13
14
  const updateCandidate = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
15
  const { authToken } = authParams;
15
16
  if (!authToken) {
16
- throw new Error("Auth token is required");
17
- }
18
- if (!params.candidateId) {
19
- throw new Error("Candidate ID is required");
17
+ throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
20
18
  }
21
19
  const body = {
22
20
  candidateId: params.candidateId,
@@ -11,12 +11,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const helpers_1 = require("./helpers");
13
13
  const axiosClient_1 = require("../../util/axiosClient");
14
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
14
15
  const confluenceFetchPageContent = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
15
16
  var _b, _c;
16
17
  const { pageId } = params;
17
18
  const { authToken } = authParams;
18
19
  if (!authToken) {
19
- throw new Error("Missing required authentication parameters");
20
+ throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
20
21
  }
21
22
  const cloudDetails = yield axiosClient_1.axiosClient.get("https://api.atlassian.com/oauth/token/accessible-resources", {
22
23
  headers: {
@@ -10,12 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const axiosClient_1 = require("../../util/axiosClient");
13
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
13
14
  const helpers_1 = require("./helpers");
14
15
  const confluenceOverwritePage = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
15
16
  const { pageId, content, title } = params;
16
17
  const { authToken } = authParams;
17
18
  if (!authToken) {
18
- throw new Error("Missing required authentication parameters");
19
+ throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
19
20
  }
20
21
  const cloudDetails = yield axiosClient_1.axiosClient.get("https://api.atlassian.com/oauth/token/accessible-resources", {
21
22
  headers: {
@@ -13,6 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const firecrawl_js_1 = __importDefault(require("@mendable/firecrawl-js"));
16
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
16
17
  const scrapeTweetDataWithNitter = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
17
18
  const tweetUrlRegex = /^(?:https?:\/\/)?(?:www\.)?(?:twitter\.com|x\.com)\/([a-zA-Z0-9_]+)\/status\/(\d+)(?:\?.*)?$/;
18
19
  if (!tweetUrlRegex.test(params.tweetUrl)) {
@@ -21,7 +22,7 @@ const scrapeTweetDataWithNitter = (_a) => __awaiter(void 0, [_a], void 0, functi
21
22
  const nitterUrl = params.tweetUrl.replace(/^(?:https?:\/\/)?(?:www\.)?(?:twitter\.com|x\.com)/i, "https://nitter.net");
22
23
  // Initialize Firecrawl
23
24
  if (!authParams.apiKey) {
24
- throw new Error("API key is required for X+Nitter+Firecrawl");
25
+ throw new Error(missingAuthConstants_1.MISSING_API_KEY);
25
26
  }
26
27
  const firecrawl = new firecrawl_js_1.default({
27
28
  apiKey: authParams.apiKey,
@@ -42,12 +42,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
42
42
  });
43
43
  };
44
44
  Object.defineProperty(exports, "__esModule", { value: true });
45
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
45
46
  /**
46
47
  * Creates a new branch in a GitHub repository
47
48
  */
48
49
  const createBranch = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
49
50
  if (!authParams.authToken) {
50
- return { success: false, error: "authToken is required for GitHub API" };
51
+ return { success: false, error: missingAuthConstants_1.MISSING_AUTH_TOKEN };
51
52
  }
52
53
  const { Octokit, RequestError } = yield Promise.resolve().then(() => __importStar(require("octokit")));
53
54
  const { repositoryOwner, repositoryName, branchName, baseRefOrHash } = params;
@@ -43,12 +43,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
43
43
  };
44
44
  Object.defineProperty(exports, "__esModule", { value: true });
45
45
  const zod_1 = require("zod");
46
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
46
47
  /**
47
48
  * Creates or updates a file in a GitHub repository
48
49
  */
49
50
  const createOrUpdateFile = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
50
51
  if (!authParams.authToken) {
51
- return { success: false, error: "authToken is required for GitHub API" };
52
+ return { success: false, error: missingAuthConstants_1.MISSING_AUTH_TOKEN };
52
53
  }
53
54
  const { Octokit, RequestError } = yield Promise.resolve().then(() => __importStar(require("octokit")));
54
55
  const { repositoryOwner, repositoryName, filePath, branch, fileContent, commitMessage } = params;
@@ -42,12 +42,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
42
42
  });
43
43
  };
44
44
  Object.defineProperty(exports, "__esModule", { value: true });
45
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
45
46
  /**
46
47
  * Creates a pull request in a GitHub repository
47
48
  */
48
49
  const createPullRequest = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
49
50
  if (!authParams.authToken) {
50
- return { success: false, error: "authToken is required for GitHub API" };
51
+ return { success: false, error: missingAuthConstants_1.MISSING_AUTH_TOKEN };
51
52
  }
52
53
  const { Octokit, RequestError } = yield Promise.resolve().then(() => __importStar(require("octokit")));
53
54
  const { repositoryOwner, repositoryName, head, base, title, description } = params;
@@ -14,8 +14,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const axios_1 = __importDefault(require("axios"));
16
16
  const types_1 = require("../../autogen/types");
17
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
17
18
  const listPullRequests = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
18
19
  const { authToken } = authParams;
20
+ if (!authToken) {
21
+ throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
22
+ }
19
23
  const { repositoryName, repositoryOwner, state } = params;
20
24
  const url = `https://api.github.com/repos/${repositoryOwner}/${repositoryName}/pulls`;
21
25
  const allPulls = [];
@@ -41,52 +41,92 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
41
41
  step((generator = generator.apply(thisArg, _arguments || [])).next());
42
42
  });
43
43
  };
44
+ var __rest = (this && this.__rest) || function (s, e) {
45
+ var t = {};
46
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
47
+ t[p] = s[p];
48
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
49
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
50
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
51
+ t[p[i]] = s[p[i]];
52
+ }
53
+ return t;
54
+ };
44
55
  Object.defineProperty(exports, "__esModule", { value: true });
45
56
  const axios_1 = __importStar(require("axios"));
46
57
  const zod_1 = require("zod");
47
- const UserSchema = zod_1.z.object({
58
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
59
+ const UserSchema = zod_1.z
60
+ .object({
48
61
  id: zod_1.z.string(),
49
- name: zod_1.z.string(),
62
+ firstName: zod_1.z.string(),
63
+ lastName: zod_1.z.string(),
50
64
  title: zod_1.z.string(),
51
- });
52
- const TrackerSchema = zod_1.z.object({
53
- id: zod_1.z.string(),
54
- name: zod_1.z.string(),
55
- });
56
- const CallSchema = zod_1.z.object({
57
- id: zod_1.z.string(),
58
- primaryUserId: zod_1.z.string().optional(),
59
- started: zod_1.z.string().optional(),
60
- });
61
- const SentenceSchema = zod_1.z.object({
65
+ })
66
+ .partial()
67
+ .passthrough();
68
+ const TrackerSchema = zod_1.z
69
+ .object({
70
+ trackerId: zod_1.z.string(),
71
+ trackerName: zod_1.z.string(),
72
+ })
73
+ .partial()
74
+ .passthrough();
75
+ const CallSchema = zod_1.z
76
+ .object({
77
+ metaData: zod_1.z.object({
78
+ id: zod_1.z.string(),
79
+ primaryUserId: zod_1.z.string(),
80
+ started: zod_1.z.string(),
81
+ }),
82
+ parties: zod_1.z.array(zod_1.z
83
+ .object({
84
+ id: zod_1.z.string(),
85
+ name: zod_1.z.string(),
86
+ userId: zod_1.z.string(),
87
+ speakerId: zod_1.z.string().nullable(),
88
+ })
89
+ .partial()
90
+ .passthrough()),
91
+ })
92
+ .partial()
93
+ .passthrough();
94
+ const SentenceSchema = zod_1.z
95
+ .object({
62
96
  start: zod_1.z.number(),
63
97
  end: zod_1.z.number(),
64
98
  text: zod_1.z.string(),
65
- });
66
- const TranscriptSchema = zod_1.z.object({
99
+ })
100
+ .partial()
101
+ .passthrough();
102
+ const TranscriptSchema = zod_1.z
103
+ .object({
67
104
  callId: zod_1.z.string(),
68
- transcript: zod_1.z.array(zod_1.z.object({
105
+ transcript: zod_1.z.array(zod_1.z
106
+ .object({
69
107
  speakerId: zod_1.z.string(),
70
- topic: zod_1.z.string(),
108
+ topic: zod_1.z.string().nullable(),
71
109
  sentences: zod_1.z.array(SentenceSchema),
72
- })),
73
- });
110
+ })
111
+ .partial()
112
+ .passthrough()),
113
+ })
114
+ .partial()
115
+ .passthrough();
74
116
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
75
117
  const GongResponseSchema = zod_1.z.object({
76
118
  users: zod_1.z.array(UserSchema).optional(),
77
- trackers: zod_1.z.array(TrackerSchema).optional(),
119
+ keywordTrackers: zod_1.z.array(TrackerSchema).optional(),
78
120
  calls: zod_1.z.array(CallSchema).optional(),
79
121
  callTranscripts: zod_1.z.array(TranscriptSchema).optional(),
80
122
  cursor: zod_1.z.string().optional(),
81
123
  });
82
- function getUsers(authToken_1) {
83
- return __awaiter(this, arguments, void 0, function* (authToken, params = {}) {
124
+ function getUsers(authToken) {
125
+ return __awaiter(this, void 0, void 0, function* () {
84
126
  let results = [];
85
127
  let cursor = undefined;
86
128
  do {
87
- const response = yield axios_1.default.post(`https://api.gong.io/v2/users/extensive` + (cursor ? `?cursor=${cursor}` : ""), {
88
- filter: Object.assign({}, params),
89
- }, {
129
+ const response = yield axios_1.default.get(`https://api.gong.io/v2/users` + (cursor ? `?cursor=${cursor}` : ""), {
90
130
  headers: {
91
131
  Authorization: `Bearer ${authToken}`,
92
132
  "Content-Type": "application/json",
@@ -107,8 +147,8 @@ function getUsers(authToken_1) {
107
147
  return results;
108
148
  });
109
149
  }
110
- function getTrackers(authToken_1) {
111
- return __awaiter(this, arguments, void 0, function* (authToken, params = {}) {
150
+ function getTrackers(authToken) {
151
+ return __awaiter(this, void 0, void 0, function* () {
112
152
  let results = [];
113
153
  let cursor = undefined;
114
154
  do {
@@ -117,14 +157,12 @@ function getTrackers(authToken_1) {
117
157
  Authorization: `Bearer ${authToken}`,
118
158
  "Content-Type": "application/json",
119
159
  },
120
- params: {
121
- filter: Object.assign({}, params),
122
- },
160
+ params: {},
123
161
  });
124
162
  if (!response) {
125
163
  return results;
126
164
  }
127
- const parsedItems = zod_1.z.array(TrackerSchema).safeParse(response.data.trackers);
165
+ const parsedItems = zod_1.z.array(TrackerSchema).safeParse(response.data.keywordTrackers);
128
166
  if (parsedItems.success) {
129
167
  results = [...results, ...parsedItems.data];
130
168
  }
@@ -143,6 +181,11 @@ function getCalls(authToken_1) {
143
181
  do {
144
182
  const response = yield axios_1.default.post(`https://api.gong.io/v2/calls/extensive` + (cursor ? `?cursor=${cursor}` : ""), {
145
183
  filter: Object.assign({}, params),
184
+ contentSelector: {
185
+ exposedFields: {
186
+ parties: true,
187
+ },
188
+ },
146
189
  }, {
147
190
  headers: {
148
191
  Authorization: `Bearer ${authToken}`,
@@ -169,7 +212,7 @@ function getTranscripts(authToken_1) {
169
212
  let results = [];
170
213
  let cursor = undefined;
171
214
  do {
172
- const response = yield axios_1.default.post(`https://api.gong.io/v2/transcript/calls/transcripts` + (cursor ? `?cursor=${cursor}` : ""), {
215
+ const response = yield axios_1.default.post(`https://api.gong.io/v2/calls/transcript` + (cursor ? `?cursor=${cursor}` : ""), {
173
216
  filter: Object.assign({}, params),
174
217
  }, {
175
218
  headers: {
@@ -198,30 +241,54 @@ const getGongTranscripts = (_a) => __awaiter(void 0, [_a], void 0, function* ({
198
241
  if (!authParams.authToken) {
199
242
  return {
200
243
  success: false,
201
- error: "No auth token provided",
244
+ error: missingAuthConstants_1.MISSING_AUTH_TOKEN,
202
245
  };
203
246
  }
204
247
  try {
205
- const gongUsers = yield getUsers(authParams.authToken, { userRole: params.userRole });
248
+ const gongUsers = yield getUsers(authParams.authToken);
206
249
  const filteredGongUsers = gongUsers.filter(user => user.title === params.userRole);
207
- const trackers = yield getTrackers(authParams.authToken, {});
208
- const filteredTrackers = trackers.filter(tracker => { var _a; return ((_a = params.trackers) !== null && _a !== void 0 ? _a : []).includes(tracker.name); });
209
- // Get calls owned by the users and filtered by the trackers
250
+ const trackers = yield getTrackers(authParams.authToken);
251
+ const filteredTrackers = trackers.filter(tracker => { var _a, _b; return (_a = params.trackers) === null || _a === void 0 ? void 0 : _a.includes((_b = tracker.trackerName) !== null && _b !== void 0 ? _b : ""); });
210
252
  const calls = yield getCalls(authParams.authToken, {
211
253
  fromDateTime: (_b = params.startDate) !== null && _b !== void 0 ? _b : "",
212
254
  toDateTime: (_c = params.endDate) !== null && _c !== void 0 ? _c : "",
213
- primaryUserIds: filteredGongUsers.length > 0 ? filteredGongUsers.map(user => user.id) : undefined,
214
- trackerIds: filteredTrackers.length > 0 ? filteredTrackers.map(tracker => tracker.id) : undefined,
255
+ primaryUserIds: filteredGongUsers.length > 0
256
+ ? filteredGongUsers.map(user => user.id).filter((id) => id !== undefined)
257
+ : undefined,
258
+ trackerIds: filteredTrackers.length > 0
259
+ ? filteredTrackers.map(tracker => tracker.trackerId).filter((id) => id !== undefined)
260
+ : undefined,
215
261
  });
216
262
  // Get transcripts for the calls we found
217
263
  const callTranscripts = yield getTranscripts(authParams.authToken, {
218
264
  fromDateTime: (_d = params.startDate) !== null && _d !== void 0 ? _d : "",
219
265
  toDateTime: (_e = params.endDate) !== null && _e !== void 0 ? _e : "",
220
- callIds: calls.map(call => call.id),
266
+ callIds: calls.map(call => { var _a; return (_a = call.metaData) === null || _a === void 0 ? void 0 : _a.id; }).filter((id) => id !== undefined),
221
267
  });
222
268
  // Map speaker IDs to names in the transcripts
223
- const userIdToNameMap = Object.fromEntries(filteredGongUsers.map(user => [user.id, user.name]));
224
- const callTranscriptsWithNames = callTranscripts.map(callTranscript => (Object.assign(Object.assign({}, callTranscript), { transcript: callTranscript.transcript.map((transcript) => (Object.assign(Object.assign({}, transcript), { speakerName: userIdToNameMap[transcript.speakerId] || transcript.speakerId }))) })));
269
+ const userIdToNameMap = {};
270
+ calls.forEach(call => {
271
+ // Check if call has parties array
272
+ if (call.parties && Array.isArray(call.parties)) {
273
+ // Iterate through each party in the call
274
+ call.parties.forEach(party => {
275
+ // Add the mapping of speakerId to name
276
+ if (party.speakerId && party.name) {
277
+ userIdToNameMap[party.speakerId] = party.name;
278
+ }
279
+ });
280
+ }
281
+ });
282
+ const callTranscriptsWithNames = callTranscripts.map(callTranscript => {
283
+ var _a;
284
+ const currTranscript = Object.assign({}, callTranscript);
285
+ currTranscript.transcript = (_a = callTranscript.transcript) === null || _a === void 0 ? void 0 : _a.map(transcript => {
286
+ var _a;
287
+ const { speakerId } = transcript, rest = __rest(transcript, ["speakerId"]);
288
+ return Object.assign(Object.assign({}, rest), { speakerName: (_a = userIdToNameMap[speakerId !== null && speakerId !== void 0 ? speakerId : ""]) !== null && _a !== void 0 ? _a : "Unknown" });
289
+ });
290
+ return currTranscript;
291
+ });
225
292
  return {
226
293
  success: true,
227
294
  callTranscripts: callTranscriptsWithNames,
@@ -10,12 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const axiosClient_1 = require("../../util/axiosClient");
13
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
13
14
  /**
14
15
  * Creates a new Google Doc document using OAuth authentication
15
16
  */
16
17
  const createNewGoogleDoc = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
17
18
  if (!authParams.authToken) {
18
- throw new Error("authToken is required for Google Docs API");
19
+ throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
19
20
  }
20
21
  const { title, content } = params;
21
22
  const baseApiUrl = "https://docs.googleapis.com/v1/documents";
@@ -10,12 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const axiosClient_1 = require("../../util/axiosClient");
13
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
13
14
  /**
14
15
  * Creates a new Google Slides presentation using OAuth authentication
15
16
  */
16
17
  const createPresentation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
17
18
  if (!authParams.authToken) {
18
- throw new Error("authToken is required for Google Slides API");
19
+ throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
19
20
  }
20
21
  const { title, pageSize } = params;
21
22
  const baseApiUrl = "https://slides.googleapis.com/v1/presentations";
@@ -13,12 +13,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const axios_1 = __importDefault(require("axios"));
16
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
16
17
  /**
17
18
  * Creates a new Google Spreadsheet using OAuth authentication
18
19
  */
19
20
  const createSpreadsheet = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
20
21
  if (!authParams.authToken) {
21
- throw new Error("authToken is required for Google Sheets API");
22
+ throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
22
23
  }
23
24
  const { title, sheets = [], properties = {} } = params;
24
25
  const baseApiUrl = "https://sheets.googleapis.com/v4/spreadsheets";
@@ -11,12 +11,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const uuid_1 = require("uuid");
13
13
  const axiosClient_1 = require("../../util/axiosClient");
14
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
14
15
  /**
15
16
  * Creates a new Google calendar event using OAuth authentication
16
17
  */
17
18
  const scheduleCalendarMeeting = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
18
19
  if (!authParams.authToken) {
19
- throw new Error("authToken is required for Google Calendar API");
20
+ throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
20
21
  }
21
22
  const { calendarId, name, start, end, description, attendees, useGoogleMeet } = params;
22
23
  // https://developers.google.com/calendar/api/v3/reference/events/insert
@@ -13,6 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const axios_1 = __importDefault(require("axios"));
16
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
16
17
  /**
17
18
  * Updates an existing Google Docs document using OAuth authentication with batch requests
18
19
  * https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate
@@ -22,7 +23,7 @@ const updateDoc = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, a
22
23
  return {
23
24
  success: false,
24
25
  documentId: params.documentId,
25
- error: "No auth token provided",
26
+ error: missingAuthConstants_1.MISSING_AUTH_TOKEN,
26
27
  };
27
28
  }
28
29
  const { documentId, requests } = params;
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const axiosClient_1 = require("../../util/axiosClient");
13
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
13
14
  /**
14
15
  * Updates an existing Google Slides presentation using OAuth authentication with batch requests
15
16
  * https://developers.google.com/slides/api/reference/rest/v1/presentations/batchUpdate
@@ -18,7 +19,7 @@ const updatePresentation = (_a) => __awaiter(void 0, [_a], void 0, function* ({
18
19
  if (!authParams.authToken) {
19
20
  return {
20
21
  success: false,
21
- error: "authToken is required for Google Slides API",
22
+ error: missingAuthConstants_1.MISSING_AUTH_TOKEN,
22
23
  };
23
24
  }
24
25
  const { presentationId, requests } = params;
@@ -10,13 +10,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const axiosClient_1 = require("../../util/axiosClient");
13
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
13
14
  /**
14
15
  * Update a Google Spreadsheet using OAuth authentication
15
16
  * https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets/batchUpdate
16
17
  */
17
18
  const updateSpreadsheet = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
18
19
  if (!authParams.authToken) {
19
- throw new Error("authToken is required for Google Spreadsheets API");
20
+ throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
20
21
  }
21
22
  const { spreadsheetId, requests } = params;
22
23
  const batchUpdateUrl = `https://sheets.googleapis.com/v4/spreadsheets/${spreadsheetId}:batchUpdate`;
@@ -12,8 +12,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const axiosClient_1 = require("../../util/axiosClient");
13
13
  const commentJiraTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
14
  const { authToken, cloudId, baseUrl } = authParams;
15
- if (!cloudId || !(params === null || params === void 0 ? void 0 : params.issueId)) {
16
- throw new Error("Cloud ID and Issue ID are required to comment on a Jira ticket");
15
+ if (!cloudId || !authToken) {
16
+ throw new Error("Valid Cloud ID and auth token are required to comment on Jira ticket");
17
17
  }
18
18
  const apiUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/issue/${params.issueId}/comment`;
19
19
  try {
@@ -14,8 +14,8 @@ const utils_1 = require("./utils");
14
14
  const createJiraTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
15
15
  const { authToken, cloudId, baseUrl } = authParams;
16
16
  const apiUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/`;
17
- if (!cloudId) {
18
- throw new Error("Cloud ID is required to create a Jira ticket");
17
+ if (!cloudId || !authToken) {
18
+ throw new Error("Valid Cloud ID and auth token are required to comment on Jira ticket");
19
19
  }
20
20
  // If assignee is an email, look up the account ID
21
21
  let reporterId = null;
@@ -14,6 +14,9 @@ const DEFAULT_LIMIT = 1000;
14
14
  const getJiraIssuesByQuery = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
15
15
  const { authToken, cloudId } = authParams;
16
16
  const { query, limit } = params;
17
+ if (!cloudId || !authToken) {
18
+ throw new Error("Valid Cloud ID and auth token are required to comment on Jira ticket");
19
+ }
17
20
  const queryParams = new URLSearchParams();
18
21
  queryParams.set("jql", query);
19
22
  queryParams.set("maxResults", String(limit != undefined && limit <= DEFAULT_LIMIT ? limit : DEFAULT_LIMIT));
@@ -13,8 +13,8 @@ const axiosClient_1 = require("../../util/axiosClient");
13
13
  const getJiraTicketDetails = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
14
  const { authToken, cloudId } = authParams;
15
15
  const { issueId } = params;
16
- if (!cloudId || !issueId) {
17
- throw new Error("Cloud ID and Issue ID are required to fetch Jira ticket details");
16
+ if (!cloudId || !authToken) {
17
+ throw new Error("Valid Cloud ID and auth token are required to comment on Jira ticket");
18
18
  }
19
19
  const apiUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/issue/${issueId}`;
20
20
  try {
@@ -14,8 +14,8 @@ const getJiraTicketHistory = (_a) => __awaiter(void 0, [_a], void 0, function* (
14
14
  var _b;
15
15
  const { authToken, cloudId } = authParams;
16
16
  const { issueId } = params;
17
- if (!cloudId || !issueId) {
18
- throw new Error("Cloud ID and Issue ID are required to retrieve ticket history");
17
+ if (!cloudId || !authToken) {
18
+ throw new Error("Valid Cloud ID and auth token are required to comment on Jira ticket");
19
19
  }
20
20
  const apiUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/issue/${issueId}/changelog`;
21
21
  try {
@@ -13,8 +13,8 @@ const axiosClient_1 = require("../../util/axiosClient");
13
13
  const updateJiraTicketDetails = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
14
  const { authToken, cloudId, baseUrl } = authParams;
15
15
  const { issueId, summary, description, customFields } = params;
16
- if (!cloudId || !issueId) {
17
- throw new Error("Cloud ID and Issue ID are required to update a Jira ticket");
16
+ if (!cloudId || !authToken) {
17
+ throw new Error("Valid Cloud ID and auth token are required to comment on Jira ticket");
18
18
  }
19
19
  const apiUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/issue/${issueId}`;
20
20
  const formattedDescription = description
@@ -12,8 +12,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const axiosClient_1 = require("../../util/axiosClient");
13
13
  const updateJiraTicketStatus = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
14
  const { authToken, cloudId, baseUrl } = authParams;
15
- if (!cloudId || !(params === null || params === void 0 ? void 0 : params.issueId) || !(params === null || params === void 0 ? void 0 : params.status)) {
16
- throw new Error("Cloud ID, Issue ID, and Status Name are required to update a Jira ticket status");
15
+ if (!cloudId || !authToken) {
16
+ throw new Error("Valid Cloud ID and auth token are required to comment on Jira ticket");
17
17
  }
18
18
  const { issueId, status } = params;
19
19
  const transitionsUrl = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/issue/${issueId}/transitions`;
@@ -13,21 +13,6 @@ const templates_1 = require("../../autogen/templates");
13
13
  const utils_1 = require("./utils");
14
14
  const sendMessageToTeamsChannel = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
15
15
  const { channelId, teamId, message } = params;
16
- if (!teamId) {
17
- return {
18
- success: false,
19
- error: "Team ID is required to send a message",
20
- };
21
- }
22
- if (!channelId) {
23
- return { success: false, error: "Channel ID is required to send a message" };
24
- }
25
- if (!message) {
26
- return {
27
- success: false,
28
- error: "Message content is required to send a message",
29
- };
30
- }
31
16
  let client = undefined;
32
17
  try {
33
18
  client = yield (0, utils_1.getGraphClient)(authParams, templates_1.microsoftMessageTeamsChannelDefinition.scopes.join(" "));
@@ -13,18 +13,6 @@ const templates_1 = require("../../autogen/templates");
13
13
  const utils_1 = require("./utils");
14
14
  const sendMessageToTeamsChat = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
15
15
  const { chatId, message } = params;
16
- if (!chatId) {
17
- return {
18
- success: false,
19
- error: "Chat ID is required to send a message",
20
- };
21
- }
22
- if (!message) {
23
- return {
24
- success: false,
25
- error: "Message content is required to send a message",
26
- };
27
- }
28
16
  let client = undefined;
29
17
  try {
30
18
  client = yield (0, utils_1.getGraphClient)(authParams, templates_1.microsoftMessageTeamsChatDefinition.scopes.join(" "));
@@ -19,12 +19,6 @@ const createRecord = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params
19
19
  error: "authToken and baseUrl are required for Salesforce API",
20
20
  };
21
21
  }
22
- if (!fieldsToCreate) {
23
- return {
24
- success: false,
25
- error: "fieldsToCreate is required to create a Salesforce object",
26
- };
27
- }
28
22
  const url = `${baseUrl}/services/data/v56.0/sobjects/${objectType}/`;
29
23
  try {
30
24
  const response = yield axiosClient_1.axiosClient.post(url, fieldsToCreate, {
@@ -0,0 +1,3 @@
1
+ import { salesforceGetSalesforceRecordsByQueryFunction } from "../../autogen/types";
2
+ declare const getSalesforceRecordByQuery: salesforceGetSalesforceRecordsByQueryFunction;
3
+ export default getSalesforceRecordByQuery;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const axiosClient_1 = require("../../util/axiosClient");
13
+ const getSalesforceRecordByQuery = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
+ const { authToken, baseUrl } = authParams;
15
+ const { query, limit } = params;
16
+ if (!authToken || !baseUrl) {
17
+ return {
18
+ success: false,
19
+ error: "authToken and baseUrl are required for Salesforce API",
20
+ };
21
+ }
22
+ // The API limits the maximum number of records returned to 2000, the limit lets the user set a smaller custom limit
23
+ const url = `${baseUrl}/services/data/v56.0/query/?q=${encodeURIComponent(query + " LIMIT " + (limit != undefined && limit <= 2000 ? limit : 2000))}`;
24
+ try {
25
+ const response = yield axiosClient_1.axiosClient.get(url, {
26
+ headers: {
27
+ Authorization: `Bearer ${authToken}`,
28
+ },
29
+ });
30
+ return {
31
+ success: true,
32
+ records: response.data,
33
+ };
34
+ }
35
+ catch (error) {
36
+ console.error("Error retrieving Salesforce record:", error);
37
+ return {
38
+ success: false,
39
+ error: error instanceof Error ? error.message : "An unknown error occurred",
40
+ };
41
+ }
42
+ });
43
+ exports.default = getSalesforceRecordByQuery;
@@ -11,7 +11,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const web_api_1 = require("@slack/web-api");
13
13
  const helpers_1 = require("./helpers");
14
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
14
15
  const getChannelMessages = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
16
+ if (!authParams.authToken) {
17
+ throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
18
+ }
15
19
  const client = new web_api_1.WebClient(authParams.authToken);
16
20
  const { channelName, oldest } = params;
17
21
  const allChannels = yield (0, helpers_1.getSlackChannels)(client);
@@ -12,7 +12,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const web_api_1 = require("@slack/web-api");
13
13
  const types_1 = require("../../autogen/types");
14
14
  const helpers_1 = require("./helpers");
15
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
15
16
  const sendMessage = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
17
+ if (!authParams.authToken) {
18
+ throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
19
+ }
16
20
  const client = new web_api_1.WebClient(authParams.authToken);
17
21
  const { channelName, message } = params;
18
22
  const allChannels = yield (0, helpers_1.getSlackChannels)(client);
@@ -12,7 +12,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const getSnowflakeConnection_1 = require("./auth/getSnowflakeConnection");
13
13
  const getRowByFieldValue = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
14
  const { databaseName, tableName, fieldName, warehouse, fieldValue, accountName } = params;
15
- if (!accountName || !databaseName || !warehouse || !tableName || !fieldName || !fieldValue) {
15
+ if (!accountName || !databaseName || !warehouse) {
16
+ // TODO: Move these to required params
16
17
  throw new Error("Account name and user are required");
17
18
  }
18
19
  // Set up a connection using snowflake-sdk
@@ -18,9 +18,6 @@ const formatDataForCodeInterpreter_1 = require("../../util/formatDataForCodeInte
18
18
  snowflake_sdk_1.default.configure({ logLevel: "ERROR" });
19
19
  const runSnowflakeQuery = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
20
20
  const { databaseName, warehouse, query, accountName, outputFormat = "json", limit } = params;
21
- if (!accountName || !databaseName || !warehouse || !query) {
22
- throw new Error("Missing required parameters for Snowflake query");
23
- }
24
21
  const executeQueryAndFormatData = () => __awaiter(void 0, void 0, void 0, function* () {
25
22
  const formattedQuery = query.trim().replace(/\s+/g, " "); // Normalize all whitespace to single spaces
26
23
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -10,12 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const axiosClient_1 = require("../../util/axiosClient");
13
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
13
14
  const addCommentToTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
15
  const { authToken } = authParams;
15
16
  const { subdomain, ticketId, comment } = params;
16
17
  const url = `https://${subdomain}.zendesk.com/api/v2/tickets/${ticketId}.json`;
17
18
  if (!authToken) {
18
- throw new Error("Auth token is required");
19
+ throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
19
20
  }
20
21
  yield axiosClient_1.axiosClient.request({
21
22
  url: url,
@@ -10,12 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const axiosClient_1 = require("../../util/axiosClient");
13
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
13
14
  const updateTicketStatus = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
15
  const { authToken } = authParams;
15
16
  const { subdomain, ticketId, assigneeEmail } = params;
16
17
  const url = `https://${subdomain}.zendesk.com/api/v2/tickets/${ticketId}.json`;
17
18
  if (!authToken) {
18
- throw new Error("Auth token is required");
19
+ throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
19
20
  }
20
21
  yield axiosClient_1.axiosClient.request({
21
22
  url: url,
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const axiosClient_1 = require("../../util/axiosClient");
13
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
13
14
  const createZendeskTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
15
  const { authToken } = authParams;
15
16
  const { subdomain, subject, body } = params;
@@ -23,7 +24,7 @@ const createZendeskTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({
23
24
  },
24
25
  };
25
26
  if (!authToken) {
26
- throw new Error("Auth token is required");
27
+ throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
27
28
  }
28
29
  const response = yield axiosClient_1.axiosClient.post(url, payload, {
29
30
  headers: {
@@ -10,12 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const axiosClient_1 = require("../../util/axiosClient");
13
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
13
14
  const getZendeskTicketDetails = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
15
  const { authToken } = authParams;
15
16
  const { subdomain, ticketId } = params;
16
17
  const url = `https://${subdomain}.zendesk.com/api/v2/tickets/${ticketId}.json`;
17
18
  if (!authToken) {
18
- throw new Error("Auth token is required");
19
+ throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
19
20
  }
20
21
  const response = yield axiosClient_1.axiosClient.request({
21
22
  url: url,
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const axiosClient_1 = require("../../util/axiosClient");
13
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
13
14
  const listZendeskTickets = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
15
  const { authToken } = authParams;
15
16
  const { subdomain, status } = params;
@@ -20,7 +21,7 @@ const listZendeskTickets = (_a) => __awaiter(void 0, [_a], void 0, function* ({
20
21
  // Endpoint for getting tickets
21
22
  const url = `https://${subdomain}.zendesk.com/api/v2/tickets.json`;
22
23
  if (!authToken) {
23
- throw new Error("Auth token is required");
24
+ throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
24
25
  }
25
26
  // Add query parameters for filtering
26
27
  const queryParams = new URLSearchParams();
@@ -10,12 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const axiosClient_1 = require("../../util/axiosClient");
13
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
13
14
  const updateTicketStatus = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
15
  const { authToken } = authParams;
15
16
  const { subdomain, ticketId, status } = params;
16
17
  const url = `https://${subdomain}.zendesk.com/api/v2/tickets/${ticketId}.json`;
17
18
  if (!authToken) {
18
- throw new Error("Auth token is required");
19
+ throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
19
20
  }
20
21
  yield axiosClient_1.axiosClient.request({
21
22
  url: url,
@@ -0,0 +1,2 @@
1
+ export declare const MISSING_AUTH_TOKEN = "Auth Token is required";
2
+ export declare const MISSING_API_KEY = "API Key is required";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MISSING_API_KEY = exports.MISSING_AUTH_TOKEN = void 0;
4
+ exports.MISSING_AUTH_TOKEN = "Auth Token is required";
5
+ exports.MISSING_API_KEY = "API Key is required";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@credal/actions",
3
- "version": "0.1.71",
3
+ "version": "0.1.74",
4
4
  "description": "AI Actions by Credal AI",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,3 +0,0 @@
1
- import { confluenceUpdatePageFunction } from "../../../actions/autogen/types";
2
- declare const confluenceUpdatePage: confluenceUpdatePageFunction;
3
- export default confluenceUpdatePage;
@@ -1,47 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const axios_1 = __importDefault(require("axios"));
16
- function getConfluenceApi(baseUrl, username, apiToken) {
17
- const api = axios_1.default.create({
18
- baseURL: baseUrl,
19
- headers: {
20
- Accept: "application/json",
21
- // Tokens are associated with a specific user.
22
- Authorization: `Basic ${Buffer.from(`${username}:${apiToken}`).toString("base64")}`,
23
- },
24
- });
25
- return api;
26
- }
27
- const confluenceUpdatePage = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
28
- const { pageId, username, content, title } = params;
29
- const { baseUrl, authToken } = authParams;
30
- const api = getConfluenceApi(baseUrl, username, authToken);
31
- // Get current version number
32
- const response = yield api.get(`/api/v2/pages/${pageId}`);
33
- const currVersion = response.data.version.number;
34
- yield api.put(`/api/v2/pages/${pageId}`, {
35
- id: pageId,
36
- status: "current",
37
- title,
38
- body: {
39
- representation: "storage",
40
- value: content,
41
- },
42
- version: {
43
- number: currVersion + 1,
44
- },
45
- });
46
- });
47
- exports.default = confluenceUpdatePage;