@credal/actions 0.1.72 → 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 (54) 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 +42 -10
  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/slack/getChannelMessages.js +4 -0
  43. package/dist/actions/providers/slack/sendMessage.js +4 -0
  44. package/dist/actions/providers/snowflake/getRowByFieldValue.js +2 -1
  45. package/dist/actions/providers/snowflake/runSnowflakeQuery.js +0 -3
  46. package/dist/actions/providers/zendesk/addCommentToTicket.js +2 -1
  47. package/dist/actions/providers/zendesk/assignTicket.js +2 -1
  48. package/dist/actions/providers/zendesk/createZendeskTicket.js +2 -1
  49. package/dist/actions/providers/zendesk/getTicketDetails.js +2 -1
  50. package/dist/actions/providers/zendesk/listTickets.js +2 -1
  51. package/dist/actions/providers/zendesk/updateTicketStatus.js +2 -1
  52. package/dist/actions/util/missingAuthConstants.d.ts +2 -0
  53. package/dist/actions/util/missingAuthConstants.js +5 -0
  54. package/package.json +1 -1
@@ -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 = [];
@@ -55,6 +55,7 @@ var __rest = (this && this.__rest) || function (s, e) {
55
55
  Object.defineProperty(exports, "__esModule", { value: true });
56
56
  const axios_1 = __importStar(require("axios"));
57
57
  const zod_1 = require("zod");
58
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
58
59
  const UserSchema = zod_1.z
59
60
  .object({
60
61
  id: zod_1.z.string(),
@@ -78,22 +79,37 @@ const CallSchema = zod_1.z
78
79
  primaryUserId: zod_1.z.string(),
79
80
  started: zod_1.z.string(),
80
81
  }),
82
+ parties: zod_1.z.array(zod_1.z
83
+ .object({
84
+ id: zod_1.z.string(),
85
+ name: zod_1.z.string(),
86
+ userId: zod_1.z.string(),
87
+ speakerId: zod_1.z.string().nullable(),
88
+ })
89
+ .partial()
90
+ .passthrough()),
81
91
  })
82
92
  .partial()
83
93
  .passthrough();
84
- const SentenceSchema = zod_1.z.object({
94
+ const SentenceSchema = zod_1.z
95
+ .object({
85
96
  start: zod_1.z.number(),
86
97
  end: zod_1.z.number(),
87
98
  text: zod_1.z.string(),
88
- });
99
+ })
100
+ .partial()
101
+ .passthrough();
89
102
  const TranscriptSchema = zod_1.z
90
103
  .object({
91
104
  callId: zod_1.z.string(),
92
- transcript: zod_1.z.array(zod_1.z.object({
93
- speakerId: zod_1.z.string().optional(),
94
- topic: zod_1.z.string(),
105
+ transcript: zod_1.z.array(zod_1.z
106
+ .object({
107
+ speakerId: zod_1.z.string(),
108
+ topic: zod_1.z.string().nullable(),
95
109
  sentences: zod_1.z.array(SentenceSchema),
96
- })),
110
+ })
111
+ .partial()
112
+ .passthrough()),
97
113
  })
98
114
  .partial()
99
115
  .passthrough();
@@ -165,6 +181,11 @@ function getCalls(authToken_1) {
165
181
  do {
166
182
  const response = yield axios_1.default.post(`https://api.gong.io/v2/calls/extensive` + (cursor ? `?cursor=${cursor}` : ""), {
167
183
  filter: Object.assign({}, params),
184
+ contentSelector: {
185
+ exposedFields: {
186
+ parties: true,
187
+ },
188
+ },
168
189
  }, {
169
190
  headers: {
170
191
  Authorization: `Bearer ${authToken}`,
@@ -220,7 +241,7 @@ const getGongTranscripts = (_a) => __awaiter(void 0, [_a], void 0, function* ({
220
241
  if (!authParams.authToken) {
221
242
  return {
222
243
  success: false,
223
- error: "No auth token provided",
244
+ error: missingAuthConstants_1.MISSING_AUTH_TOKEN,
224
245
  };
225
246
  }
226
247
  try {
@@ -245,15 +266,26 @@ const getGongTranscripts = (_a) => __awaiter(void 0, [_a], void 0, function* ({
245
266
  callIds: calls.map(call => { var _a; return (_a = call.metaData) === null || _a === void 0 ? void 0 : _a.id; }).filter((id) => id !== undefined),
246
267
  });
247
268
  // Map speaker IDs to names in the transcripts
248
- const userIdToNameMap = Object.fromEntries(gongUsers.map(user => [user.id, user.firstName + " " + user.lastName]));
269
+ const userIdToNameMap = {};
270
+ calls.forEach(call => {
271
+ // Check if call has parties array
272
+ if (call.parties && Array.isArray(call.parties)) {
273
+ // Iterate through each party in the call
274
+ call.parties.forEach(party => {
275
+ // Add the mapping of speakerId to name
276
+ if (party.speakerId && party.name) {
277
+ userIdToNameMap[party.speakerId] = party.name;
278
+ }
279
+ });
280
+ }
281
+ });
249
282
  const callTranscriptsWithNames = callTranscripts.map(callTranscript => {
250
283
  var _a;
251
284
  const currTranscript = Object.assign({}, callTranscript);
252
285
  currTranscript.transcript = (_a = callTranscript.transcript) === null || _a === void 0 ? void 0 : _a.map(transcript => {
253
286
  var _a;
254
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
255
287
  const { speakerId } = transcript, rest = __rest(transcript, ["speakerId"]);
256
- return Object.assign(Object.assign({}, rest), { speakerName: userIdToNameMap[(_a = transcript.speakerId) !== null && _a !== void 0 ? _a : ""] });
288
+ return Object.assign(Object.assign({}, rest), { speakerName: (_a = userIdToNameMap[speakerId !== null && speakerId !== void 0 ? speakerId : ""]) !== null && _a !== void 0 ? _a : "Unknown" });
257
289
  });
258
290
  return currTranscript;
259
291
  });
@@ -10,12 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const axiosClient_1 = require("../../util/axiosClient");
13
+ const missingAuthConstants_1 = require("../../util/missingAuthConstants");
13
14
  /**
14
15
  * Creates a new Google Doc document using OAuth authentication
15
16
  */
16
17
  const createNewGoogleDoc = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
17
18
  if (!authParams.authToken) {
18
- throw new Error("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, {
@@ -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.72",
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",