@credal/actions 0.1.31 → 0.1.34

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 (112) hide show
  1. package/dist/actions/actionMapper.js +238 -0
  2. package/dist/actions/autogen/definitions.d.ts +5 -0
  3. package/dist/actions/autogen/definitions.js +132 -0
  4. package/dist/actions/autogen/templates.d.ts +38 -0
  5. package/dist/actions/autogen/templates.js +4570 -178
  6. package/dist/actions/autogen/types.d.ts +1414 -33
  7. package/dist/actions/autogen/types.js +1812 -1
  8. package/dist/actions/definitions.js +35 -0
  9. package/dist/actions/groups.js +44 -4
  10. package/dist/actions/invoke.js +3 -0
  11. package/dist/actions/invokeMapper.d.ts +9 -0
  12. package/dist/actions/invokeMapper.js +33 -0
  13. package/dist/actions/parse.js +3 -0
  14. package/dist/actions/providers/asana/commentAsanaTask.d.ts +3 -0
  15. package/dist/actions/providers/asana/commentAsanaTask.js +44 -0
  16. package/dist/actions/providers/asana/createAsanaTask.d.ts +3 -0
  17. package/dist/actions/providers/asana/createAsanaTask.js +93 -0
  18. package/dist/actions/providers/asana/updateAsanaTask.d.ts +3 -0
  19. package/dist/actions/providers/asana/updateAsanaTask.js +50 -0
  20. package/dist/actions/providers/asana/utils.d.ts +6 -0
  21. package/dist/actions/providers/asana/utils.js +73 -0
  22. package/dist/actions/providers/ashby/addCandidateToProject.d.ts +3 -0
  23. package/dist/actions/providers/ashby/addCandidateToProject.js +32 -0
  24. package/dist/actions/providers/ashby/createCandidate.d.ts +3 -0
  25. package/dist/actions/providers/ashby/createCandidate.js +42 -0
  26. package/dist/actions/providers/ashby/createNote.d.ts +3 -0
  27. package/dist/actions/providers/ashby/createNote.js +32 -0
  28. package/dist/actions/providers/ashby/getCandidateInfo.d.ts +3 -0
  29. package/dist/actions/providers/ashby/getCandidateInfo.js +34 -0
  30. package/dist/actions/providers/ashby/listCandidateNotes.d.ts +3 -0
  31. package/dist/actions/providers/ashby/listCandidateNotes.js +34 -0
  32. package/dist/actions/providers/ashby/listCandidates.d.ts +3 -0
  33. package/dist/actions/providers/ashby/listCandidates.js +31 -0
  34. package/dist/actions/providers/ashby/searchCandidates.d.ts +3 -0
  35. package/dist/actions/providers/ashby/searchCandidates.js +35 -0
  36. package/dist/actions/providers/ashby/updateCandidate.d.ts +3 -0
  37. package/dist/actions/providers/ashby/updateCandidate.js +60 -0
  38. package/dist/actions/providers/confluence/updatePage.js +2 -5
  39. package/dist/actions/providers/github/createBranch.d.ts +6 -0
  40. package/dist/actions/providers/github/createBranch.js +68 -0
  41. package/dist/actions/providers/github/createOrUpdateFile.d.ts +6 -0
  42. package/dist/actions/providers/github/createOrUpdateFile.js +75 -0
  43. package/dist/actions/providers/github/createPullRequest.d.ts +6 -0
  44. package/dist/actions/providers/github/createPullRequest.js +48 -0
  45. package/dist/actions/providers/google-oauth/createPresentation.d.ts +6 -0
  46. package/dist/actions/providers/google-oauth/createPresentation.js +52 -0
  47. package/dist/actions/providers/google-oauth/createSpreadsheet.d.ts +6 -0
  48. package/dist/actions/providers/google-oauth/createSpreadsheet.js +62 -0
  49. package/dist/actions/providers/google-oauth/scheduleCalendarMeeting.d.ts +6 -0
  50. package/dist/actions/providers/google-oauth/scheduleCalendarMeeting.js +74 -0
  51. package/dist/actions/providers/google-oauth/updateDoc.d.ts +7 -0
  52. package/dist/actions/providers/google-oauth/updateDoc.js +69 -0
  53. package/dist/actions/providers/google-oauth/updatePresentation.d.ts +7 -0
  54. package/dist/actions/providers/google-oauth/updatePresentation.js +64 -0
  55. package/dist/actions/providers/google-oauth/updateSpreadsheet.d.ts +7 -0
  56. package/dist/actions/providers/google-oauth/updateSpreadsheet.js +51 -0
  57. package/dist/actions/providers/googlemaps/nearbysearch.js +31 -31
  58. package/dist/actions/providers/jira/assignJiraTicket.d.ts +3 -0
  59. package/dist/actions/providers/jira/assignJiraTicket.js +52 -0
  60. package/dist/actions/providers/jira/commentJiraTicket.d.ts +3 -0
  61. package/dist/actions/providers/jira/commentJiraTicket.js +56 -0
  62. package/dist/actions/providers/jira/createJiraTicket.js +3 -24
  63. package/dist/actions/providers/jira/createTicket.d.ts +3 -0
  64. package/dist/actions/providers/jira/createTicket.js +34 -0
  65. package/dist/actions/providers/jira/getJiraTicketDetails.d.ts +3 -0
  66. package/dist/actions/providers/jira/getJiraTicketDetails.js +40 -0
  67. package/dist/actions/providers/jira/getJiraTicketHistory.d.ts +3 -0
  68. package/dist/actions/providers/jira/getJiraTicketHistory.js +41 -0
  69. package/dist/actions/providers/jira/updateJiraTicketDetails.d.ts +3 -0
  70. package/dist/actions/providers/jira/updateJiraTicketDetails.js +56 -0
  71. package/dist/actions/providers/jira/updateJiraTicketStatus.d.ts +3 -0
  72. package/dist/actions/providers/jira/updateJiraTicketStatus.js +57 -0
  73. package/dist/actions/providers/jira/utils.d.ts +1 -0
  74. package/dist/actions/providers/jira/utils.js +34 -0
  75. package/dist/actions/providers/microsoft/messageTeamsChannel.d.ts +3 -0
  76. package/dist/actions/providers/microsoft/messageTeamsChannel.js +45 -0
  77. package/dist/actions/providers/microsoft/messageTeamsChat.d.ts +3 -0
  78. package/dist/actions/providers/microsoft/messageTeamsChat.js +42 -0
  79. package/dist/actions/providers/microsoft/utils.d.ts +4 -0
  80. package/dist/actions/providers/microsoft/utils.js +55 -0
  81. package/dist/actions/providers/salesforce/createCase.d.ts +3 -0
  82. package/dist/actions/providers/salesforce/createCase.js +44 -0
  83. package/dist/actions/providers/salesforce/generateSalesReport.d.ts +3 -0
  84. package/dist/actions/providers/salesforce/generateSalesReport.js +52 -0
  85. package/dist/actions/providers/salesforce/getRecord.d.ts +3 -0
  86. package/dist/actions/providers/salesforce/getRecord.js +42 -0
  87. package/dist/actions/providers/salesforce/getSalesforceRecordByQuery.d.ts +3 -0
  88. package/dist/actions/providers/salesforce/getSalesforceRecordByQuery.js +43 -0
  89. package/dist/actions/providers/salesforce/updateRecord.d.ts +3 -0
  90. package/dist/actions/providers/salesforce/updateRecord.js +42 -0
  91. package/dist/actions/providers/slack/getChannelMessages.d.ts +3 -0
  92. package/dist/actions/providers/slack/getChannelMessages.js +33 -0
  93. package/dist/actions/providers/slack/list_conversations.d.ts +3 -0
  94. package/dist/actions/providers/slack/list_conversations.js +60 -0
  95. package/dist/actions/providers/slack/summarizeChannel.d.ts +3 -0
  96. package/dist/actions/providers/slack/summarizeChannel.js +51 -0
  97. package/dist/actions/providers/zendesk/addCommentToTicket.d.ts +3 -0
  98. package/dist/actions/providers/zendesk/addCommentToTicket.js +37 -0
  99. package/dist/actions/providers/zendesk/assignTicket.d.ts +3 -0
  100. package/dist/actions/providers/zendesk/assignTicket.js +37 -0
  101. package/dist/actions/providers/zendesk/getTicketDetails.d.ts +3 -0
  102. package/dist/actions/providers/zendesk/getTicketDetails.js +35 -0
  103. package/dist/actions/providers/zendesk/updateTicketStatus.d.ts +3 -0
  104. package/dist/actions/providers/zendesk/updateTicketStatus.js +37 -0
  105. package/dist/actions/schema.js +6 -0
  106. package/dist/actions/types.js +2 -0
  107. package/dist/main.js +11 -0
  108. package/package.json +7 -1
  109. package/dist/actions/providers/snowflake/runSnowflakeQueryWriteResultsToS3.d.ts +0 -3
  110. package/dist/actions/providers/snowflake/runSnowflakeQueryWriteResultsToS3.js +0 -154
  111. package/dist/actions/providers/x/scrapeTweetDataWithNitter.d.ts +0 -3
  112. package/dist/actions/providers/x/scrapeTweetDataWithNitter.js +0 -45
@@ -0,0 +1,34 @@
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 listCandidateNotes = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
+ const { candidateId } = params;
15
+ const { authToken } = authParams;
16
+ if (!authToken) {
17
+ throw new Error("Auth token is required");
18
+ }
19
+ const response = yield axiosClient_1.axiosClient.post(`https://api.ashbyhq.com/candidate.listNotes`, {
20
+ candidateId,
21
+ }, {
22
+ auth: {
23
+ username: authToken,
24
+ password: "",
25
+ },
26
+ });
27
+ if (!response.data.success) {
28
+ throw new Error(response.data.errors.join("; "));
29
+ }
30
+ return {
31
+ notes: response.data.results,
32
+ };
33
+ });
34
+ exports.default = listCandidateNotes;
@@ -0,0 +1,3 @@
1
+ import { ashbyListCandidatesFunction } from "../../autogen/types";
2
+ declare const listCandidates: ashbyListCandidatesFunction;
3
+ export default listCandidates;
@@ -0,0 +1,31 @@
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 listCandidates = (_a) => __awaiter(void 0, [_a], void 0, function* ({ authParams, }) {
14
+ const { authToken } = authParams;
15
+ if (!authToken) {
16
+ throw new Error("Auth token is required");
17
+ }
18
+ const response = yield axiosClient_1.axiosClient.post(`https://api.ashbyhq.com/candidate.list`, null, {
19
+ auth: {
20
+ username: authToken,
21
+ password: "",
22
+ },
23
+ });
24
+ if (!response.data.success) {
25
+ throw new Error(response.data.errors.join("; "));
26
+ }
27
+ return {
28
+ candidates: response.data.results,
29
+ };
30
+ });
31
+ exports.default = listCandidates;
@@ -0,0 +1,3 @@
1
+ import { ashbySearchCandidatesFunction } from "../../autogen/types";
2
+ declare const searchCandidates: ashbySearchCandidatesFunction;
3
+ export default searchCandidates;
@@ -0,0 +1,35 @@
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 searchCandidates = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
+ const { email, name } = params;
15
+ const { authToken } = authParams;
16
+ if (!authToken) {
17
+ throw new Error("Auth token is required");
18
+ }
19
+ const response = yield axiosClient_1.axiosClient.post(`https://api.ashbyhq.com/candidate.search`, {
20
+ email,
21
+ name,
22
+ }, {
23
+ auth: {
24
+ username: authToken,
25
+ password: "",
26
+ },
27
+ });
28
+ if (!response.data.success) {
29
+ throw new Error(response.data.errors.join("; "));
30
+ }
31
+ return {
32
+ candidates: response.data.results,
33
+ };
34
+ });
35
+ exports.default = searchCandidates;
@@ -0,0 +1,3 @@
1
+ import { ashbyUpdateCandidateFunction } from "../../autogen/types";
2
+ declare const updateCandidate: ashbyUpdateCandidateFunction;
3
+ export default updateCandidate;
@@ -0,0 +1,60 @@
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 updateCandidate = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
+ const { authToken } = authParams;
15
+ if (!authToken) {
16
+ throw new Error("Auth token is required");
17
+ }
18
+ if (!params.candidateId) {
19
+ throw new Error("Candidate ID is required");
20
+ }
21
+ const body = {
22
+ candidateId: params.candidateId,
23
+ };
24
+ if (params.name !== undefined)
25
+ body.name = params.name;
26
+ if (params.email !== undefined)
27
+ body.email = params.email;
28
+ if (params.phoneNumber !== undefined)
29
+ body.phoneNumber = params.phoneNumber;
30
+ if (params.linkedInUrl !== undefined)
31
+ body.linkedInUrl = params.linkedInUrl;
32
+ if (params.githubUrl !== undefined)
33
+ body.githubUrl = params.githubUrl;
34
+ if (params.websiteUrl !== undefined)
35
+ body.websiteUrl = params.websiteUrl;
36
+ if (params.alternateEmail !== undefined)
37
+ body.alternateEmail = params.alternateEmail;
38
+ if (params.socialLinks !== undefined)
39
+ body.socialLinks = params.socialLinks;
40
+ if (params.sourceId !== undefined)
41
+ body.sourceId = params.sourceId;
42
+ if (params.creditedToUserId !== undefined)
43
+ body.creditedToUserId = params.creditedToUserId;
44
+ if (params.location !== undefined)
45
+ body.location = params.location;
46
+ if (params.createdAt !== undefined)
47
+ body.createdAt = params.createdAt;
48
+ if (params.sendNotifications !== undefined)
49
+ body.sendNotifications = params.sendNotifications;
50
+ const response = yield axiosClient_1.axiosClient.post(`https://api.ashbyhq.com/candidate.update`, body, {
51
+ auth: {
52
+ username: authToken,
53
+ password: "",
54
+ },
55
+ });
56
+ if (!response.data.success) {
57
+ throw new Error(response.data.errors.join("; "));
58
+ }
59
+ });
60
+ exports.default = updateCandidate;
@@ -20,11 +20,8 @@ function getConfluenceRequestConfig(baseUrl, username, apiToken) {
20
20
  };
21
21
  }
22
22
  const confluenceUpdatePage = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
23
- const { pageId, content, title } = params;
24
- const { baseUrl, authToken, username } = authParams;
25
- if (!baseUrl || !authToken || !username) {
26
- throw new Error("Missing required authentication information");
27
- }
23
+ const { pageId, username, content, title } = params;
24
+ const { baseUrl, authToken } = authParams;
28
25
  const config = getConfluenceRequestConfig(baseUrl, username, authToken);
29
26
  // Get current version number
30
27
  const response = yield axiosClient_1.axiosClient.get(`/api/v2/pages/${pageId}`, config);
@@ -0,0 +1,6 @@
1
+ import { githubCreateBranchFunction } from "../../autogen/types";
2
+ /**
3
+ * Creates a new branch in a GitHub repository
4
+ */
5
+ declare const createBranch: githubCreateBranchFunction;
6
+ export default createBranch;
@@ -0,0 +1,68 @@
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 rest_1 = require("@octokit/rest");
13
+ const request_error_1 = require("@octokit/request-error");
14
+ /**
15
+ * Creates a new branch in a GitHub repository
16
+ */
17
+ const createBranch = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
18
+ if (!authParams.authToken) {
19
+ return { success: false, error: "authToken is required for GitHub API" };
20
+ }
21
+ const { repositoryOwner, repositoryName, branchName, baseRefOrHash } = params;
22
+ const octokit = new rest_1.Octokit({ auth: authParams.authToken });
23
+ try {
24
+ // Get the reference or commit SHA for the base branch or tag
25
+ const { data: baseRefData } = yield octokit.git
26
+ .getRef({
27
+ owner: repositoryOwner,
28
+ repo: repositoryName,
29
+ ref: baseRefOrHash,
30
+ })
31
+ .catch((error) => __awaiter(void 0, void 0, void 0, function* () {
32
+ if (error.status === 404 && /^[a-f0-9]{40}$/i.test(baseRefOrHash)) {
33
+ // If baseRef is a full commit SHA and not a ref, use it directly
34
+ return { data: { object: { sha: baseRefOrHash } } };
35
+ }
36
+ else if (error.status === 404 && /^[a-f0-9]{7,39}$/i.test(baseRefOrHash)) {
37
+ // If baseRef is a short commit SHA, try to resolve it to a full SHA
38
+ const { data: commits } = yield octokit.repos.listCommits({
39
+ owner: repositoryOwner,
40
+ repo: repositoryName,
41
+ sha: baseRefOrHash,
42
+ per_page: 1,
43
+ });
44
+ if (commits.length > 0) {
45
+ return { data: { object: { sha: commits[0].sha } } };
46
+ }
47
+ }
48
+ throw error;
49
+ }));
50
+ // Create a new branch from the base reference
51
+ yield octokit.git.createRef({
52
+ owner: repositoryOwner,
53
+ repo: repositoryName,
54
+ ref: `refs/heads/${branchName}`,
55
+ sha: baseRefData.object.sha,
56
+ });
57
+ return { success: true };
58
+ }
59
+ catch (error) {
60
+ if (error instanceof request_error_1.RequestError) {
61
+ console.error("GitHub API error:", error.message);
62
+ return { success: false, error: error.message };
63
+ }
64
+ console.error("Unexpected error:", error);
65
+ return { success: false, error: error instanceof Error ? error.message : "An unexpected error occurred" };
66
+ }
67
+ });
68
+ exports.default = createBranch;
@@ -0,0 +1,6 @@
1
+ import { githubCreateOrUpdateFileFunction } from "../../autogen/types";
2
+ /**
3
+ * Creates or updates a file in a GitHub repository
4
+ */
5
+ declare const createOrUpdateFile: githubCreateOrUpdateFileFunction;
6
+ export default createOrUpdateFile;
@@ -0,0 +1,75 @@
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 rest_1 = require("@octokit/rest");
13
+ const request_error_1 = require("@octokit/request-error");
14
+ const zod_1 = require("zod");
15
+ /**
16
+ * Creates or updates a file in a GitHub repository
17
+ */
18
+ const createOrUpdateFile = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
19
+ if (!authParams.authToken) {
20
+ return { success: false, error: "authToken is required for GitHub API" };
21
+ }
22
+ const { repositoryOwner, repositoryName, filePath, branch, fileContent, commitMessage } = params;
23
+ const octokit = new rest_1.Octokit({ auth: authParams.authToken });
24
+ let fileSha = undefined;
25
+ let operationPreformed = undefined;
26
+ try {
27
+ const { data: fileData } = yield octokit.repos.getContent({
28
+ owner: repositoryOwner,
29
+ repo: repositoryName,
30
+ path: filePath,
31
+ ref: branch,
32
+ });
33
+ if (params.noOverwrite) {
34
+ return { success: false, error: "Path already exists and noOverwrite is set to true." };
35
+ }
36
+ if (Array.isArray(fileData)) {
37
+ console.error(`Error: Path is a directory, not a file. Path: ${filePath}`);
38
+ return { success: false, error: `Path is a directory, not a file. Path: ${filePath}` };
39
+ }
40
+ fileSha = fileData.sha;
41
+ operationPreformed = "updated";
42
+ }
43
+ catch (error) {
44
+ if (error instanceof request_error_1.RequestError && error.status === 404) {
45
+ console.log(`File not found, creating new file.`);
46
+ operationPreformed = "created";
47
+ }
48
+ else {
49
+ return { success: false, error: error instanceof Error ? error.message : "An unknown error occurred" };
50
+ }
51
+ }
52
+ try {
53
+ const { data: commitData } = yield octokit.repos.createOrUpdateFileContents({
54
+ owner: repositoryOwner,
55
+ repo: repositoryName,
56
+ path: filePath,
57
+ message: commitMessage,
58
+ content: Buffer.from(fileContent).toString("base64"),
59
+ branch,
60
+ sha: fileSha,
61
+ });
62
+ const OperationEnum = zod_1.z.enum(["created", "updated"]);
63
+ return {
64
+ success: true,
65
+ newCommitSha: commitData.commit.sha,
66
+ operation: OperationEnum.parse(operationPreformed),
67
+ };
68
+ }
69
+ catch (error) {
70
+ console.error("Error creating or updating file:", error);
71
+ const errorMessage = error instanceof Error ? error.message : "An unknown error occurred";
72
+ return { success: false, error: errorMessage };
73
+ }
74
+ });
75
+ exports.default = createOrUpdateFile;
@@ -0,0 +1,6 @@
1
+ import { githubCreatePullRequestFunction } from "../../autogen/types";
2
+ /**
3
+ * Creates a pull request in a GitHub repository
4
+ */
5
+ declare const createPullRequest: githubCreatePullRequestFunction;
6
+ export default createPullRequest;
@@ -0,0 +1,48 @@
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 rest_1 = require("@octokit/rest");
13
+ const request_error_1 = require("@octokit/request-error");
14
+ /**
15
+ * Creates a pull request in a GitHub repository
16
+ */
17
+ const createPullRequest = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
18
+ if (!authParams.authToken) {
19
+ return { success: false, error: "authToken is required for GitHub API" };
20
+ }
21
+ const { repositoryOwner, repositoryName, head, base, title, description } = params;
22
+ const octokit = new rest_1.Octokit({ auth: authParams.authToken });
23
+ try {
24
+ // Create the pull request
25
+ const { data: pullRequestData } = yield octokit.pulls.create({
26
+ owner: repositoryOwner,
27
+ repo: repositoryName,
28
+ head,
29
+ base,
30
+ title,
31
+ body: description,
32
+ });
33
+ return {
34
+ success: true,
35
+ pullRequestUrl: pullRequestData.html_url,
36
+ pullRequestNumber: pullRequestData.number,
37
+ };
38
+ }
39
+ catch (error) {
40
+ if (error instanceof request_error_1.RequestError) {
41
+ console.error("GitHub API error:", error.message);
42
+ return { success: false, error: error.message };
43
+ }
44
+ console.error("Unexpected error:", error);
45
+ return { success: false, error: "An unexpected error occurred" };
46
+ }
47
+ });
48
+ exports.default = createPullRequest;
@@ -0,0 +1,6 @@
1
+ import { googleOauthCreatePresentationFunction } from "../../autogen/types";
2
+ /**
3
+ * Creates a new Google Slides presentation using OAuth authentication
4
+ */
5
+ declare const createPresentation: googleOauthCreatePresentationFunction;
6
+ export default createPresentation;
@@ -0,0 +1,52 @@
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
+ /**
14
+ * Creates a new Google Slides presentation using OAuth authentication
15
+ */
16
+ const createPresentation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
17
+ if (!authParams.authToken) {
18
+ throw new Error("authToken is required for Google Slides API");
19
+ }
20
+ const { title, pageSize } = params;
21
+ const baseApiUrl = "https://slides.googleapis.com/v1/presentations";
22
+ const requestBody = Object.assign({ title }, (pageSize && { pageSize }));
23
+ try {
24
+ const response = yield axiosClient_1.axiosClient.post(baseApiUrl, requestBody, {
25
+ headers: {
26
+ Authorization: `Bearer ${authParams.authToken}`,
27
+ "Content-Type": "application/json",
28
+ },
29
+ });
30
+ if (response.status < 200 || response.status >= 300) {
31
+ return {
32
+ success: false,
33
+ error: response.statusText,
34
+ };
35
+ }
36
+ const { presentationId } = response.data;
37
+ const presentationUrl = `https://docs.google.com/presentation/d/${presentationId}/edit`;
38
+ return {
39
+ success: true,
40
+ presentationId,
41
+ presentationUrl,
42
+ };
43
+ }
44
+ catch (error) {
45
+ console.error("Error creating presentation:", error);
46
+ return {
47
+ success: false,
48
+ error: error instanceof Error ? error.message : "Unknown error",
49
+ };
50
+ }
51
+ });
52
+ exports.default = createPresentation;
@@ -0,0 +1,6 @@
1
+ import { googleOauthCreateSpreadsheetFunction } from "../../autogen/types";
2
+ /**
3
+ * Creates a new Google Spreadsheet using OAuth authentication
4
+ */
5
+ declare const createSpreadsheet: googleOauthCreateSpreadsheetFunction;
6
+ export default createSpreadsheet;
@@ -0,0 +1,62 @@
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
+ /**
17
+ * Creates a new Google Spreadsheet using OAuth authentication
18
+ */
19
+ const createSpreadsheet = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
20
+ if (!authParams.authToken) {
21
+ throw new Error("authToken is required for Google Sheets API");
22
+ }
23
+ const { title, sheets = [], properties = {} } = params;
24
+ const baseApiUrl = "https://sheets.googleapis.com/v4/spreadsheets";
25
+ const requestBody = {
26
+ properties: Object.assign({ title }, properties),
27
+ sheets: sheets.map(sheet => ({ properties: sheet })),
28
+ };
29
+ try {
30
+ const response = yield axios_1.default.post(baseApiUrl, requestBody, {
31
+ headers: {
32
+ Authorization: `Bearer ${authParams.authToken}`,
33
+ },
34
+ });
35
+ if (response.status < 200 || response.status >= 300) {
36
+ return {
37
+ success: false,
38
+ error: response.statusText,
39
+ };
40
+ }
41
+ const { spreadsheetId, sheets: createdSheets } = response.data;
42
+ const spreadsheetUrl = `https://docs.google.com/spreadsheets/d/${spreadsheetId}`;
43
+ return {
44
+ success: true,
45
+ spreadsheetId,
46
+ spreadsheetUrl,
47
+ sheets: createdSheets.map((sheet) => ({
48
+ sheetId: sheet.properties.sheetId,
49
+ title: sheet.properties.title,
50
+ index: sheet.properties.index,
51
+ })),
52
+ };
53
+ }
54
+ catch (error) {
55
+ console.error("Error creating spreadsheet:", error);
56
+ return {
57
+ success: false,
58
+ error: error instanceof Error ? error.message : "Unknown error",
59
+ };
60
+ }
61
+ });
62
+ exports.default = createSpreadsheet;
@@ -0,0 +1,6 @@
1
+ import { googleOauthScheduleCalendarMeetingFunction } from "../../autogen/types";
2
+ /**
3
+ * Creates a new Google calendar event using OAuth authentication
4
+ */
5
+ declare const scheduleCalendarMeeting: googleOauthScheduleCalendarMeetingFunction;
6
+ export default scheduleCalendarMeeting;
@@ -0,0 +1,74 @@
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 uuid_1 = require("uuid");
13
+ const axiosClient_1 = require("../../util/axiosClient");
14
+ /**
15
+ * Creates a new Google calendar event using OAuth authentication
16
+ */
17
+ const scheduleCalendarMeeting = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
18
+ if (!authParams.authToken) {
19
+ throw new Error("authToken is required for Google Calendar API");
20
+ }
21
+ const { calendarId, name, start, end, description, attendees, useGoogleMeet } = params;
22
+ // https://developers.google.com/calendar/api/v3/reference/events/insert
23
+ let createEventApiUrl = `https://www.googleapis.com/calendar/v3/calendars/${calendarId}/events`;
24
+ const data = {
25
+ summary: name,
26
+ start: {
27
+ dateTime: start,
28
+ },
29
+ end: {
30
+ dateTime: end,
31
+ },
32
+ };
33
+ if (description) {
34
+ data.description = description;
35
+ }
36
+ if (attendees) {
37
+ data.attendees = attendees.map(attendee => ({ email: attendee }));
38
+ }
39
+ if (useGoogleMeet) {
40
+ createEventApiUrl += "?conferenceDataVersion=1";
41
+ data.conferenceData = {
42
+ createRequest: {
43
+ requestId: (0, uuid_1.v4)(),
44
+ },
45
+ };
46
+ }
47
+ try {
48
+ const response = yield axiosClient_1.axiosClient.post(createEventApiUrl, data, {
49
+ headers: {
50
+ Authorization: `Bearer ${authParams.authToken}`,
51
+ "Content-Type": "application/json",
52
+ },
53
+ });
54
+ if (response.status < 200 || response.status >= 300) {
55
+ return {
56
+ success: false,
57
+ error: response.data.error,
58
+ };
59
+ }
60
+ return {
61
+ success: true,
62
+ eventId: response.data.id,
63
+ eventUrl: response.data.htmlLink,
64
+ };
65
+ }
66
+ catch (error) {
67
+ console.error("Error scheduling calendar meeting", error);
68
+ return {
69
+ success: false,
70
+ error: error instanceof Error ? error.message : "Unknown error",
71
+ };
72
+ }
73
+ });
74
+ exports.default = scheduleCalendarMeeting;
@@ -0,0 +1,7 @@
1
+ import { googleOauthUpdateDocFunction } from "../../autogen/types";
2
+ /**
3
+ * Updates an existing Google Docs document using OAuth authentication with batch requests
4
+ * https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate
5
+ */
6
+ declare const updateDoc: googleOauthUpdateDocFunction;
7
+ export default updateDoc;