@credal/actions 0.2.77 → 0.2.81

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 (53) hide show
  1. package/dist/actions/actionMapper.js +69 -1
  2. package/dist/actions/autogen/templates.d.ts +11 -0
  3. package/dist/actions/autogen/templates.js +832 -16
  4. package/dist/actions/autogen/types.d.ts +765 -20
  5. package/dist/actions/autogen/types.js +249 -8
  6. package/dist/actions/providers/confluence/updatePage.js +14 -15
  7. package/dist/actions/providers/generic/fillTemplateAction.d.ts +7 -0
  8. package/dist/actions/providers/generic/fillTemplateAction.js +18 -0
  9. package/dist/actions/providers/generic/genericApiCall.d.ts +3 -0
  10. package/dist/actions/providers/generic/genericApiCall.js +38 -0
  11. package/dist/actions/providers/google-oauth/editAGoogleCalendarEvent.d.ts +3 -0
  12. package/dist/actions/providers/google-oauth/editAGoogleCalendarEvent.js +57 -0
  13. package/dist/actions/providers/google-oauth/getDriveContentById.d.ts +3 -0
  14. package/dist/actions/providers/google-oauth/getDriveContentById.js +161 -0
  15. package/dist/actions/providers/google-oauth/queryGoogleBigQuery.d.ts +3 -0
  16. package/dist/actions/providers/google-oauth/queryGoogleBigQuery.js +135 -0
  17. package/dist/actions/providers/google-oauth/searchAndGetDriveContentByKeywords.d.ts +3 -0
  18. package/dist/actions/providers/google-oauth/searchAndGetDriveContentByKeywords.js +47 -0
  19. package/dist/actions/providers/google-oauth/searchDriveAndGetContentByKeywords.d.ts +3 -0
  20. package/dist/actions/providers/google-oauth/searchDriveAndGetContentByKeywords.js +110 -0
  21. package/dist/actions/providers/google-oauth/searchDriveAndGetContentByQuery.d.ts +3 -0
  22. package/dist/actions/providers/google-oauth/searchDriveAndGetContentByQuery.js +78 -0
  23. package/dist/actions/providers/google-oauth/utils/extractContentFromDriveFileId.d.ts +15 -0
  24. package/dist/actions/providers/google-oauth/utils/extractContentFromDriveFileId.js +129 -0
  25. package/dist/actions/providers/googlemail/sendGmail.js +69 -5
  26. package/dist/actions/providers/googlemaps/nearbysearch.d.ts +3 -0
  27. package/dist/actions/providers/googlemaps/nearbysearch.js +96 -0
  28. package/dist/actions/providers/hubspot/getCompanies.d.ts +3 -0
  29. package/dist/actions/providers/hubspot/getCompanies.js +75 -0
  30. package/dist/actions/providers/hubspot/getCompanyDetails.d.ts +3 -0
  31. package/dist/actions/providers/hubspot/getCompanyDetails.js +73 -0
  32. package/dist/actions/providers/hubspot/getContactDetails.d.ts +3 -0
  33. package/dist/actions/providers/hubspot/getContactDetails.js +74 -0
  34. package/dist/actions/providers/hubspot/getContacts.d.ts +3 -0
  35. package/dist/actions/providers/hubspot/getContacts.js +76 -0
  36. package/dist/actions/providers/hubspot/getDealDetails.d.ts +3 -0
  37. package/dist/actions/providers/hubspot/getDealDetails.js +68 -0
  38. package/dist/actions/providers/hubspot/getDeals.d.ts +3 -0
  39. package/dist/actions/providers/hubspot/getDeals.js +60 -0
  40. package/dist/actions/providers/hubspot/getTicketDetails.d.ts +3 -0
  41. package/dist/actions/providers/hubspot/getTicketDetails.js +64 -0
  42. package/dist/actions/providers/hubspot/getTickets.d.ts +3 -0
  43. package/dist/actions/providers/hubspot/getTickets.js +59 -0
  44. package/dist/actions/providers/resend/sendEmailHtml.d.ts +3 -0
  45. package/dist/actions/providers/resend/sendEmailHtml.js +37 -0
  46. package/dist/actions/providers/snowflake/runSnowflakeQueryWriteResultsToS3.d.ts +3 -0
  47. package/dist/actions/providers/snowflake/runSnowflakeQueryWriteResultsToS3.js +154 -0
  48. package/dist/actions/providers/x/scrapeTweetDataWithNitter.d.ts +3 -0
  49. package/dist/actions/providers/x/scrapeTweetDataWithNitter.js +45 -0
  50. package/dist/actions/providers/zendesk/addCommentToTicket.js +27 -13
  51. package/package.json +1 -1
  52. package/dist/actions/providers/jamf/types.d.ts +0 -8
  53. package/dist/actions/providers/jamf/types.js +0 -7
@@ -34,6 +34,7 @@ export var ProviderName;
34
34
  ProviderName["JAMF"] = "jamf";
35
35
  ProviderName["GITLAB"] = "gitlab";
36
36
  ProviderName["LINEAR"] = "linear";
37
+ ProviderName["HUBSPOT"] = "hubspot";
37
38
  })(ProviderName || (ProviderName = {}));
38
39
  export const AuthParamsSchema = z.object({
39
40
  authToken: z.string().optional(),
@@ -229,6 +230,7 @@ export const slackSendMessageParamsSchema = z.object({
229
230
  export const slackSendMessageOutputSchema = z.object({
230
231
  success: z.boolean().describe("Whether the email was sent successfully"),
231
232
  error: z.string().describe("The error that occurred if the email was not sent successfully").optional(),
233
+ messageId: z.string().describe("The ID of the message that was sent").optional(),
232
234
  });
233
235
  export const slackGetChannelMessagesParamsSchema = z.object({
234
236
  channelId: z
@@ -772,14 +774,13 @@ export const zendeskUpdateTicketStatusOutputSchema = z.void();
772
774
  export const zendeskAddCommentToTicketParamsSchema = z.object({
773
775
  ticketId: z.string().describe("The ID of the ticket to update"),
774
776
  subdomain: z.string().describe("The subdomain of the Zendesk account"),
775
- comment: z
776
- .object({
777
- body: z.string().describe("The body of the comment"),
778
- public: z.boolean().describe("Whether the comment should be public").optional(),
779
- })
780
- .describe("The comment to add to the ticket"),
777
+ body: z.string().describe("The body of the comment"),
778
+ public: z.boolean().describe("Whether the comment should be public (defaults to true)").optional(),
779
+ });
780
+ export const zendeskAddCommentToTicketOutputSchema = z.object({
781
+ success: z.boolean().describe("Whether the comment was successfully added"),
782
+ ticketUrl: z.string().describe("The URL to view the ticket").optional(),
781
783
  });
782
- export const zendeskAddCommentToTicketOutputSchema = z.void();
783
784
  export const zendeskAssignTicketParamsSchema = z.object({
784
785
  ticketId: z.string().describe("The ID of the ticket to update"),
785
786
  subdomain: z.string().describe("The subdomain of the Zendesk account"),
@@ -925,6 +926,15 @@ export const resendSendEmailOutputSchema = z.object({
925
926
  success: z.boolean().describe("Whether the email was sent successfully"),
926
927
  error: z.string().describe("The error that occurred if the email was not sent successfully").optional(),
927
928
  });
929
+ export const resendSendEmailHtmlParamsSchema = z.object({
930
+ to: z.string().describe("The email address to send the email to"),
931
+ subject: z.string().describe("The subject of the email"),
932
+ html: z.string().describe("The HTML content of the email"),
933
+ });
934
+ export const resendSendEmailHtmlOutputSchema = z.object({
935
+ success: z.boolean().describe("Whether the email was sent successfully"),
936
+ error: z.string().describe("The error that occurred if the email was not sent successfully").optional(),
937
+ });
928
938
  export const googleOauthCreateNewGoogleDocParamsSchema = z.object({
929
939
  title: z.string().describe("The title of the new Google Doc"),
930
940
  content: z.string().describe("The content to add to the new Google Doc").optional(),
@@ -1573,6 +1583,33 @@ export const googleOauthUpdateCalendarEventOutputSchema = z.object({
1573
1583
  eventUrl: z.string().describe("The URL to access the updated event").optional(),
1574
1584
  error: z.string().describe("The error that occurred if the event was not updated successfully").optional(),
1575
1585
  });
1586
+ export const googleOauthEditAGoogleCalendarEventParamsSchema = z.object({
1587
+ calendarId: z.string().describe("The ID of the calendar containing the event"),
1588
+ eventId: z.string().describe("The ID of the event to edit"),
1589
+ title: z.string().describe("The new title/summary of the event").optional(),
1590
+ description: z.string().describe("The new description of the event").optional(),
1591
+ start: z.string().describe("The new start date/time (RFC3339 timestamp)").optional(),
1592
+ end: z.string().describe("The new end date/time (RFC3339 timestamp)").optional(),
1593
+ location: z.string().describe("The new location of the event").optional(),
1594
+ attendees: z
1595
+ .array(z.string().describe("The email address of the attendee"))
1596
+ .describe("The new list of attendees (replaces existing attendees)")
1597
+ .optional(),
1598
+ status: z.string().describe("The new status of the event (confirmed, tentative, cancelled)").optional(),
1599
+ organizer: z
1600
+ .object({
1601
+ email: z.string().describe("The organizer's email address").optional(),
1602
+ displayName: z.string().describe("The organizer's display name").optional(),
1603
+ })
1604
+ .describe("The new organizer of the event")
1605
+ .optional(),
1606
+ });
1607
+ export const googleOauthEditAGoogleCalendarEventOutputSchema = z.object({
1608
+ success: z.boolean().describe("Whether the event was edited successfully"),
1609
+ eventId: z.string().describe("The ID of the edited event").optional(),
1610
+ eventUrl: z.string().describe("The URL to access the edited event").optional(),
1611
+ error: z.string().describe("The error that occurred if the event was not edited successfully").optional(),
1612
+ });
1576
1613
  export const googleOauthDeleteCalendarEventParamsSchema = z.object({
1577
1614
  calendarId: z.string().describe("The ID of the calendar containing the event"),
1578
1615
  eventId: z.string().describe("The ID of the event to delete"),
@@ -2612,6 +2649,33 @@ export const googleOauthDeleteGroupMemberOutputSchema = z.object({
2612
2649
  success: z.boolean().describe("Whether the member was removed successfully"),
2613
2650
  error: z.string().describe("The error that occurred if the member could not be removed").optional(),
2614
2651
  });
2652
+ export const googleOauthQueryGoogleBigQueryParamsSchema = z.object({
2653
+ query: z.string().describe("The SQL query to execute in BigQuery"),
2654
+ projectId: z.string().describe("The Google Cloud Project ID. If not provided, will use the default project"),
2655
+ maxResults: z.number().describe("Maximum number of results to return. Defaults to 1000").optional(),
2656
+ timeoutMs: z.number().describe("Timeout for the query in milliseconds. Defaults to 30000").optional(),
2657
+ maximumBytesProcessed: z
2658
+ .string()
2659
+ .describe("Maximum bytes to process for the query. Defaults to 500000000 (500MB). Use -1 for no limit")
2660
+ .optional(),
2661
+ });
2662
+ export const googleOauthQueryGoogleBigQueryOutputSchema = z.object({
2663
+ success: z.boolean().describe("Whether the query was executed successfully"),
2664
+ data: z
2665
+ .array(z.object({}).catchall(z.any()).describe("A row of data from the query result"))
2666
+ .describe("The query results as an array of objects")
2667
+ .optional(),
2668
+ totalRows: z.string().describe("Total number of rows in the result set").optional(),
2669
+ schema: z
2670
+ .array(z.object({
2671
+ name: z.string().describe("Column name").optional(),
2672
+ type: z.string().describe("Column data type").optional(),
2673
+ mode: z.string().describe("Column mode (NULLABLE, REQUIRED, REPEATED)").optional(),
2674
+ }))
2675
+ .describe("Schema information for the result columns")
2676
+ .optional(),
2677
+ error: z.string().describe("Error message if query failed").optional(),
2678
+ });
2615
2679
  export const googlemailSearchGmailMessagesParamsSchema = z.object({
2616
2680
  query: z.string().describe('Gmail search query (e.g. "from:alice subject:urgent")'),
2617
2681
  maxResults: z.number().describe("Maximum number of messages to return (optional)").optional(),
@@ -2659,7 +2723,8 @@ export const googlemailSendGmailParamsSchema = z.object({
2659
2723
  cc: z.array(z.string()).describe("List of CC recipient email addresses (optional)").optional(),
2660
2724
  bcc: z.array(z.string()).describe("List of BCC recipient email addresses (optional)").optional(),
2661
2725
  subject: z.string().describe("Email subject line"),
2662
- content: z.string().describe("Email body content (plain text or HTML)"),
2726
+ content: z.string().describe("Email body content in HTML format"),
2727
+ threadId: z.string().describe("Optional thread ID to reply to an existing email thread").optional(),
2663
2728
  });
2664
2729
  export const googlemailSendGmailOutputSchema = z.object({
2665
2730
  success: z.boolean().describe("Whether the email was sent successfully"),
@@ -3941,3 +4006,179 @@ export const linearGetTeamsOutputSchema = z.object({
3941
4006
  .describe("List of all teams")
3942
4007
  .optional(),
3943
4008
  });
4009
+ export const hubspotGetContactsParamsSchema = z.object({
4010
+ query: z.string().describe("Optional search query to filter contacts by name, email, or other properties").optional(),
4011
+ limit: z.number().describe("Maximum number of contacts to return (default 100, max 100)").optional(),
4012
+ });
4013
+ export const hubspotGetContactsOutputSchema = z.object({
4014
+ success: z.boolean().describe("Whether the operation was successful"),
4015
+ error: z.string().describe("Error message if the operation failed").optional(),
4016
+ contacts: z
4017
+ .array(z.object({
4018
+ id: z.string().describe("The contact ID").optional(),
4019
+ email: z.string().describe("Contact email address").optional(),
4020
+ firstname: z.string().describe("Contact first name").optional(),
4021
+ lastname: z.string().describe("Contact last name").optional(),
4022
+ createdate: z.string().describe("When the contact was created").optional(),
4023
+ }))
4024
+ .describe("List of contacts matching the search criteria")
4025
+ .optional(),
4026
+ });
4027
+ export const hubspotGetContactDetailsParamsSchema = z.object({
4028
+ contactId: z.string().describe("The ID of the HubSpot contact to retrieve"),
4029
+ });
4030
+ export const hubspotGetContactDetailsOutputSchema = z.object({
4031
+ success: z.boolean().describe("Whether the operation was successful"),
4032
+ error: z.string().describe("Error message if the operation failed").optional(),
4033
+ contact: z
4034
+ .object({
4035
+ id: z.string().describe("The contact ID").optional(),
4036
+ email: z.string().describe("Contact email address").optional(),
4037
+ firstname: z.string().describe("Contact first name").optional(),
4038
+ lastname: z.string().describe("Contact last name").optional(),
4039
+ company: z.string().describe("Contact company").optional(),
4040
+ phone: z.string().describe("Contact phone number").optional(),
4041
+ address: z.string().describe("Contact address").optional(),
4042
+ city: z.string().describe("Contact city").optional(),
4043
+ state: z.string().describe("Contact state").optional(),
4044
+ zip: z.string().describe("Contact zip code").optional(),
4045
+ country: z.string().describe("Contact country").optional(),
4046
+ lifecyclestage: z.string().describe("Contact lifecycle stage").optional(),
4047
+ leadstatus: z.string().describe("Contact lead status").optional(),
4048
+ createdAt: z.string().describe("When the contact was created").optional(),
4049
+ updatedAt: z.string().describe("When the contact was last updated").optional(),
4050
+ archived: z.boolean().describe("Whether the contact is archived").optional(),
4051
+ })
4052
+ .describe("The contact details")
4053
+ .optional(),
4054
+ });
4055
+ export const hubspotGetCompaniesParamsSchema = z.object({
4056
+ query: z
4057
+ .string()
4058
+ .describe("Optional search query to filter companies by name, domain, or other properties")
4059
+ .optional(),
4060
+ limit: z.number().describe("Maximum number of companies to return (default 100, max 100)").optional(),
4061
+ });
4062
+ export const hubspotGetCompaniesOutputSchema = z.object({
4063
+ success: z.boolean().describe("Whether the operation was successful"),
4064
+ error: z.string().describe("Error message if the operation failed").optional(),
4065
+ companies: z
4066
+ .array(z.object({
4067
+ id: z.string().describe("The company ID").optional(),
4068
+ name: z.string().describe("Company name").optional(),
4069
+ domain: z.string().describe("Company domain").optional(),
4070
+ createdAt: z.string().describe("When the company was created").optional(),
4071
+ }))
4072
+ .describe("List of companies matching the search criteria")
4073
+ .optional(),
4074
+ });
4075
+ export const hubspotGetCompanyDetailsParamsSchema = z.object({
4076
+ companyId: z.string().describe("The ID of the HubSpot company to retrieve"),
4077
+ });
4078
+ export const hubspotGetCompanyDetailsOutputSchema = z.object({
4079
+ success: z.boolean().describe("Whether the operation was successful"),
4080
+ error: z.string().describe("Error message if the operation failed").optional(),
4081
+ company: z
4082
+ .object({
4083
+ id: z.string().describe("The company ID").optional(),
4084
+ name: z.string().describe("Company name").optional(),
4085
+ domain: z.string().describe("Company domain").optional(),
4086
+ industry: z.string().describe("Company industry").optional(),
4087
+ phone: z.string().describe("Company phone number").optional(),
4088
+ address: z.string().describe("Company address").optional(),
4089
+ city: z.string().describe("Company city").optional(),
4090
+ state: z.string().describe("Company state").optional(),
4091
+ zip: z.string().describe("Company zip code").optional(),
4092
+ country: z.string().describe("Company country").optional(),
4093
+ website: z.string().describe("Company website").optional(),
4094
+ createdAt: z.string().describe("When the company was created").optional(),
4095
+ updatedAt: z.string().describe("When the company was last updated").optional(),
4096
+ archived: z.boolean().describe("Whether the company is archived").optional(),
4097
+ })
4098
+ .describe("The company details")
4099
+ .optional(),
4100
+ });
4101
+ export const hubspotGetDealsParamsSchema = z.object({
4102
+ query: z.string().describe("Optional search query to filter deals by name, stage, or other properties").optional(),
4103
+ limit: z.number().describe("Maximum number of deals to return (default 100, max 100)").optional(),
4104
+ });
4105
+ export const hubspotGetDealsOutputSchema = z.object({
4106
+ success: z.boolean().describe("Whether the operation was successful"),
4107
+ error: z.string().describe("Error message if the operation failed").optional(),
4108
+ deals: z
4109
+ .array(z.object({
4110
+ id: z.string().describe("The deal ID").optional(),
4111
+ dealname: z.string().describe("Deal name").optional(),
4112
+ amount: z.string().describe("Deal amount").optional(),
4113
+ dealstage: z.string().describe("Deal stage").optional(),
4114
+ createdAt: z.string().describe("When the deal was created").optional(),
4115
+ }))
4116
+ .describe("List of deals matching the search criteria")
4117
+ .optional(),
4118
+ });
4119
+ export const hubspotGetDealDetailsParamsSchema = z.object({
4120
+ dealId: z.string().describe("The ID of the HubSpot deal to retrieve"),
4121
+ });
4122
+ export const hubspotGetDealDetailsOutputSchema = z.object({
4123
+ success: z.boolean().describe("Whether the operation was successful"),
4124
+ error: z.string().describe("Error message if the operation failed").optional(),
4125
+ deal: z
4126
+ .object({
4127
+ id: z.string().describe("The deal ID").optional(),
4128
+ dealname: z.string().describe("Deal name").optional(),
4129
+ description: z.string().describe("Description of deal").optional(),
4130
+ amount: z.string().describe("Deal amount").optional(),
4131
+ dealstage: z.string().describe("Deal stage").optional(),
4132
+ pipeline: z.string().describe("Pipeline").optional(),
4133
+ dealtype: z.string().describe("Deal type").optional(),
4134
+ closedate: z.string().describe("Close date").optional(),
4135
+ createdAt: z.string().describe("When the deal was created").optional(),
4136
+ updatedAt: z.string().describe("When the deal was last updated").optional(),
4137
+ ownerId: z.string().describe("Deal owner ID").optional(),
4138
+ archived: z.boolean().describe("Whether the deal is archived").optional(),
4139
+ })
4140
+ .describe("The deal details")
4141
+ .optional(),
4142
+ });
4143
+ export const hubspotGetTicketsParamsSchema = z.object({
4144
+ query: z
4145
+ .string()
4146
+ .describe("Optional search query to filter tickets by subject, status, or other properties")
4147
+ .optional(),
4148
+ limit: z.number().describe("Maximum number of tickets to return (default 100, max 100)").optional(),
4149
+ });
4150
+ export const hubspotGetTicketsOutputSchema = z.object({
4151
+ success: z.boolean().describe("Whether the operation was successful"),
4152
+ error: z.string().describe("Error message if the operation failed").optional(),
4153
+ tickets: z
4154
+ .array(z.object({
4155
+ id: z.string().describe("The ticket ID").optional(),
4156
+ subject: z.string().describe("Ticket subject").optional(),
4157
+ status: z.string().describe("Ticket status").optional(),
4158
+ createdAt: z.string().describe("When the ticket was created").optional(),
4159
+ }))
4160
+ .describe("List of tickets matching the search criteria")
4161
+ .optional(),
4162
+ });
4163
+ export const hubspotGetTicketDetailsParamsSchema = z.object({
4164
+ ticketId: z.string().describe("The ID of the HubSpot ticket to retrieve"),
4165
+ });
4166
+ export const hubspotGetTicketDetailsOutputSchema = z.object({
4167
+ success: z.boolean().describe("Whether the operation was successful"),
4168
+ error: z.string().describe("Error message if the operation failed").optional(),
4169
+ ticket: z
4170
+ .object({
4171
+ id: z.string().describe("The ticket ID").optional(),
4172
+ subject: z.string().describe("Ticket subject").optional(),
4173
+ content: z.string().describe("Ticket content/description").optional(),
4174
+ pipeline: z.string().describe("Pipeline").optional(),
4175
+ status: z.string().describe("Ticket status").optional(),
4176
+ priority: z.string().describe("Ticket priority").optional(),
4177
+ createdAt: z.string().describe("When the ticket was created").optional(),
4178
+ updatedAt: z.string().describe("When the ticket was last updated").optional(),
4179
+ ownerId: z.string().describe("Ticket owner id").optional(),
4180
+ archived: z.boolean().describe("Whether the ticket is archived").optional(),
4181
+ })
4182
+ .describe("The ticket details")
4183
+ .optional(),
4184
+ });
@@ -8,30 +8,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  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({
12
+ const axiosClient_1 = require("../../util/axiosClient");
13
+ function getConfluenceRequestConfig(baseUrl, username, apiToken) {
14
+ return {
18
15
  baseURL: baseUrl,
19
16
  headers: {
20
17
  Accept: "application/json",
21
- // Tokens are associated with a specific user.
22
18
  Authorization: `Basic ${Buffer.from(`${username}:${apiToken}`).toString("base64")}`,
23
19
  },
24
- });
25
- return api;
20
+ };
26
21
  }
27
22
  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);
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
+ }
28
+ const config = getConfluenceRequestConfig(baseUrl, username, authToken);
31
29
  // Get current version number
32
- const response = yield api.get(`/api/v2/pages/${pageId}`);
30
+ const response = yield axiosClient_1.axiosClient.get(`/api/v2/pages/${pageId}`, config);
33
31
  const currVersion = response.data.version.number;
34
- yield api.put(`/api/v2/pages/${pageId}`, {
32
+ const payload = {
35
33
  id: pageId,
36
34
  status: "current",
37
35
  title,
@@ -42,6 +40,7 @@ const confluenceUpdatePage = (_a) => __awaiter(void 0, [_a], void 0, function* (
42
40
  version: {
43
41
  number: currVersion + 1,
44
42
  },
45
- });
43
+ };
44
+ yield axiosClient_1.axiosClient.put(`/api/v2/pages/${pageId}`, payload, config);
46
45
  });
47
46
  exports.default = confluenceUpdatePage;
@@ -0,0 +1,7 @@
1
+ import type { ActionFunction } from "../../autogen/types";
2
+ declare const fillTemplateAction: ActionFunction<{
3
+ template: string;
4
+ }, {
5
+ result: string;
6
+ }, unknown>;
7
+ export default fillTemplateAction;
@@ -0,0 +1,18 @@
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 fillTemplateAction = (_a) => __awaiter(void 0, [_a], void 0, function* ({ template }) {
13
+ // Simply return the template without any modification
14
+ return {
15
+ result: template,
16
+ };
17
+ });
18
+ exports.default = fillTemplateAction;
@@ -0,0 +1,3 @@
1
+ import type { genericUniversalTestActionFunction } from "../../autogen/types";
2
+ declare const genericApiCall: genericUniversalTestActionFunction;
3
+ export default genericApiCall;
@@ -0,0 +1,38 @@
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
+ const genericApiCall = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, }) {
17
+ try {
18
+ const { endpoint, method, headers, body } = params;
19
+ const response = yield (0, axios_1.default)({
20
+ url: endpoint,
21
+ method,
22
+ headers,
23
+ data: method !== "GET" ? body : undefined,
24
+ });
25
+ return {
26
+ statusCode: response.status,
27
+ headers: response.headers,
28
+ data: response.data,
29
+ };
30
+ }
31
+ catch (error) {
32
+ if (axios_1.default.isAxiosError(error)) {
33
+ throw Error("Axios Error: " + (error.message || "Failed to make API call"));
34
+ }
35
+ throw Error("Error: " + (error || "Failed to make API call"));
36
+ }
37
+ });
38
+ exports.default = genericApiCall;
@@ -0,0 +1,3 @@
1
+ import type { googleOauthEditAGoogleCalendarEventFunction } from "../../autogen/types.js";
2
+ declare const editAGoogleCalendarEvent: googleOauthEditAGoogleCalendarEventFunction;
3
+ export default editAGoogleCalendarEvent;
@@ -0,0 +1,57 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { axiosClient } from "../../util/axiosClient.js";
11
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
12
+ const editAGoogleCalendarEvent = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
13
+ if (!authParams.authToken) {
14
+ return { success: false, error: MISSING_AUTH_TOKEN, eventId: "", eventUrl: "" };
15
+ }
16
+ const { calendarId, eventId, title, description, start, end, location, attendees, status, organizer } = params;
17
+ const url = `https://www.googleapis.com/calendar/v3/calendars/${encodeURIComponent(calendarId)}/events/${encodeURIComponent(eventId)}`;
18
+ const body = {};
19
+ if (title !== undefined)
20
+ body.summary = title;
21
+ if (description !== undefined)
22
+ body.description = description;
23
+ if (start !== undefined)
24
+ body.start = { dateTime: start };
25
+ if (end !== undefined)
26
+ body.end = { dateTime: end };
27
+ if (location !== undefined)
28
+ body.location = location;
29
+ if (attendees !== undefined)
30
+ body.attendees = attendees.map(email => ({ email }));
31
+ if (status !== undefined)
32
+ body.status = status;
33
+ if (organizer !== undefined)
34
+ body.organizer = organizer;
35
+ try {
36
+ const res = yield axiosClient.patch(url, body, {
37
+ headers: {
38
+ Authorization: `Bearer ${authParams.authToken}`,
39
+ },
40
+ });
41
+ const { id, htmlLink } = res.data;
42
+ return {
43
+ success: true,
44
+ eventId: id,
45
+ eventUrl: htmlLink,
46
+ };
47
+ }
48
+ catch (error) {
49
+ return {
50
+ success: false,
51
+ error: error instanceof Error ? error.message : "Unknown error editing event",
52
+ eventId: "",
53
+ eventUrl: "",
54
+ };
55
+ }
56
+ });
57
+ export default editAGoogleCalendarEvent;
@@ -0,0 +1,3 @@
1
+ import type { googleOauthGetDriveFileContentByIDFunction } from "../../autogen/types.js";
2
+ declare const getDriveFileContentByID: googleOauthGetDriveFileContentByIDFunction;
3
+ export default getDriveFileContentByID;
@@ -0,0 +1,161 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import pdf from "pdf-parse/lib/pdf-parse.js";
11
+ import { axiosClient } from "../../util/axiosClient.js";
12
+ import mammoth from "mammoth";
13
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
14
+ const getDriveFileContentByID = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
15
+ if (!authParams.authToken) {
16
+ return { success: false, error: MISSING_AUTH_TOKEN };
17
+ }
18
+ const { fileId, limit } = params;
19
+ try {
20
+ // First, get file metadata to determine the file type
21
+ const metadataUrl = `https://www.googleapis.com/drive/v3/files/${encodeURIComponent(fileId)}?fields=name,mimeType,size`;
22
+ const metadataRes = yield axiosClient.get(metadataUrl, {
23
+ headers: {
24
+ Authorization: `Bearer ${authParams.authToken}`,
25
+ },
26
+ });
27
+ const { name: fileName, mimeType, size } = metadataRes.data;
28
+ // Check if file is too large (50MB limit for safety)
29
+ if (size && parseInt(size) > 50 * 1024 * 1024) {
30
+ return {
31
+ success: false,
32
+ error: "File too large (>50MB)",
33
+ };
34
+ }
35
+ let content = "";
36
+ // Handle different file types - read content directly
37
+ if (mimeType === "application/vnd.google-apps.document") {
38
+ // Google Docs - download as plain text
39
+ const downloadUrl = `https://www.googleapis.com/drive/v3/files/${encodeURIComponent(fileId)}?alt=media&format=txt`;
40
+ const downloadRes = yield axiosClient.get(downloadUrl, {
41
+ headers: {
42
+ Authorization: `Bearer ${authParams.authToken}`,
43
+ },
44
+ responseType: 'text',
45
+ });
46
+ content = downloadRes.data;
47
+ }
48
+ else if (mimeType === "application/vnd.google-apps.spreadsheet") {
49
+ // Google Sheets - download as CSV
50
+ const downloadUrl = `https://www.googleapis.com/drive/v3/files/${encodeURIComponent(fileId)}?alt=media&format=csv`;
51
+ const downloadRes = yield axiosClient.get(downloadUrl, {
52
+ headers: {
53
+ Authorization: `Bearer ${authParams.authToken}`,
54
+ },
55
+ responseType: 'text',
56
+ });
57
+ content = downloadRes.data;
58
+ }
59
+ else if (mimeType === "application/vnd.google-apps.presentation") {
60
+ // Google Slides - download as plain text
61
+ const downloadUrl = `https://www.googleapis.com/drive/v3/files/${encodeURIComponent(fileId)}?alt=media&format=txt`;
62
+ const downloadRes = yield axiosClient.get(downloadUrl, {
63
+ headers: {
64
+ Authorization: `Bearer ${authParams.authToken}`,
65
+ },
66
+ responseType: 'text',
67
+ });
68
+ content = downloadRes.data;
69
+ }
70
+ else if (mimeType === "application/pdf") {
71
+ // PDF files - use pdf-parse
72
+ const downloadUrl = `https://www.googleapis.com/drive/v3/files/${encodeURIComponent(fileId)}?alt=media`;
73
+ const downloadRes = yield axiosClient.get(downloadUrl, {
74
+ headers: {
75
+ Authorization: `Bearer ${authParams.authToken}`,
76
+ },
77
+ responseType: 'arraybuffer',
78
+ });
79
+ try {
80
+ const pdfData = yield pdf(downloadRes.data);
81
+ content = pdfData.text;
82
+ }
83
+ catch (pdfError) {
84
+ return {
85
+ success: false,
86
+ error: `Failed to parse PDF: ${pdfError instanceof Error ? pdfError.message : 'Unknown PDF error'}`,
87
+ };
88
+ }
89
+ }
90
+ else if (mimeType === "application/vnd.openxmlformats-officedocument.wordprocessingml.document" ||
91
+ mimeType === "application/msword") {
92
+ // Word documents (.docx or .doc) - download and extract text using mammoth
93
+ const downloadUrl = `https://www.googleapis.com/drive/v3/files/${encodeURIComponent(fileId)}?alt=media`;
94
+ const downloadRes = yield axiosClient.get(downloadUrl, {
95
+ headers: {
96
+ Authorization: `Bearer ${authParams.authToken}`,
97
+ },
98
+ responseType: 'arraybuffer',
99
+ });
100
+ try {
101
+ // mammoth works with .docx files. It will ignore formatting and return raw text
102
+ const result = yield mammoth.extractRawText({ buffer: Buffer.from(downloadRes.data) });
103
+ content = result.value; // raw text
104
+ }
105
+ catch (wordError) {
106
+ return {
107
+ success: false,
108
+ error: `Failed to parse Word document: ${wordError instanceof Error ? wordError.message : 'Unknown Word error'}`,
109
+ };
110
+ }
111
+ }
112
+ else if (mimeType === "text/plain" ||
113
+ mimeType === "text/html" ||
114
+ mimeType === "application/rtf" ||
115
+ (mimeType === null || mimeType === void 0 ? void 0 : mimeType.startsWith("text/"))) {
116
+ // Text-based files
117
+ const downloadUrl = `https://www.googleapis.com/drive/v3/files/${encodeURIComponent(fileId)}?alt=media`;
118
+ const downloadRes = yield axiosClient.get(downloadUrl, {
119
+ headers: {
120
+ Authorization: `Bearer ${authParams.authToken}`,
121
+ },
122
+ responseType: 'text',
123
+ });
124
+ content = downloadRes.data;
125
+ }
126
+ else if (mimeType === null || mimeType === void 0 ? void 0 : mimeType.startsWith("image/")) {
127
+ // Skip images
128
+ return {
129
+ success: false,
130
+ error: "Image files are not supported for text extraction",
131
+ };
132
+ }
133
+ else {
134
+ // Unsupported file type
135
+ return {
136
+ success: false,
137
+ error: `Unsupported file type: ${mimeType}`,
138
+ };
139
+ }
140
+ content = content.trim();
141
+ const originalLength = content.length;
142
+ // Naive way to truncate content
143
+ if (limit && content.length > limit) {
144
+ content = content.substring(0, limit);
145
+ }
146
+ return {
147
+ success: true,
148
+ content,
149
+ fileName,
150
+ fileLength: originalLength,
151
+ };
152
+ }
153
+ catch (error) {
154
+ console.error("Error getting Google Drive file content", error);
155
+ return {
156
+ success: false,
157
+ error: error instanceof Error ? error.message : "Unknown error",
158
+ };
159
+ }
160
+ });
161
+ export default getDriveFileContentByID;