@credal/actions 0.2.197 → 0.2.199

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 (175) hide show
  1. package/dist/actions/actionMapper.js +8 -1
  2. package/dist/actions/autogen/templates.d.ts +1 -0
  3. package/dist/actions/autogen/templates.js +79 -18
  4. package/dist/actions/autogen/types.d.ts +39 -0
  5. package/dist/actions/autogen/types.js +43 -8
  6. package/dist/actions/groups.js +4 -1
  7. package/dist/actions/invoke.js +11 -22
  8. package/dist/actions/parse.js +231 -244
  9. package/dist/actions/providers/asana/commentAsanaTask.js +8 -15
  10. package/dist/actions/providers/asana/createAsanaTask.js +20 -21
  11. package/dist/actions/providers/asana/getTasksDetails.js +18 -34
  12. package/dist/actions/providers/asana/listAsanaTasksByProject.js +62 -79
  13. package/dist/actions/providers/asana/searchAsanaTasks.js +6 -16
  14. package/dist/actions/providers/asana/updateAsanaTask.js +16 -15
  15. package/dist/actions/providers/asana/utils.js +47 -64
  16. package/dist/actions/providers/bing/getTopNSearchResultUrls.js +4 -14
  17. package/dist/actions/providers/confluence/fetchPageContent.js +5 -15
  18. package/dist/actions/providers/confluence/overwritePage.js +5 -14
  19. package/dist/actions/providers/finnhub/getBasicFinancials.js +7 -19
  20. package/dist/actions/providers/finnhub/symbolLookup.js +3 -12
  21. package/dist/actions/providers/firecrawl/deepResearch.js +11 -21
  22. package/dist/actions/providers/firecrawl/getTopNSearchResultUrls.js +8 -21
  23. package/dist/actions/providers/firecrawl/scrapeTweetDataWithNitter.js +4 -13
  24. package/dist/actions/providers/firecrawl/scrapeUrl.js +16 -21
  25. package/dist/actions/providers/firecrawl/searchAndScrape.js +6 -17
  26. package/dist/actions/providers/generic/fillTemplate.js +2 -11
  27. package/dist/actions/providers/github/createBranch.js +9 -18
  28. package/dist/actions/providers/github/createOrUpdateFile.js +6 -15
  29. package/dist/actions/providers/github/createPullRequest.js +5 -14
  30. package/dist/actions/providers/github/fetchFile.d.ts +3 -0
  31. package/dist/actions/providers/github/fetchFile.js +131 -0
  32. package/dist/actions/providers/github/getBranch.js +4 -13
  33. package/dist/actions/providers/github/getContents.d.ts +3 -0
  34. package/dist/actions/providers/github/getContents.js +41 -0
  35. package/dist/actions/providers/github/getFileContent.js +6 -16
  36. package/dist/actions/providers/github/getPullRequestDetails.js +39 -18
  37. package/dist/actions/providers/github/listCommits.js +17 -15
  38. package/dist/actions/providers/github/listDirectory.js +13 -25
  39. package/dist/actions/providers/github/listPullRequests.js +4 -13
  40. package/dist/actions/providers/github/searchOrganization.js +29 -49
  41. package/dist/actions/providers/github/utils.js +5 -16
  42. package/dist/actions/providers/gitlab/getFileContent.js +13 -24
  43. package/dist/actions/providers/gitlab/getMergeRequest.js +18 -30
  44. package/dist/actions/providers/gitlab/listDirectory.js +15 -27
  45. package/dist/actions/providers/gitlab/searchGroup.js +45 -52
  46. package/dist/actions/providers/gitlab/utils.js +19 -32
  47. package/dist/actions/providers/google-oauth/addGroupMember.js +3 -12
  48. package/dist/actions/providers/google-oauth/addTextToTopOfDoc.js +3 -12
  49. package/dist/actions/providers/google-oauth/appendRowsToSpreadsheet.js +4 -13
  50. package/dist/actions/providers/google-oauth/createNewGoogleDoc.js +7 -17
  51. package/dist/actions/providers/google-oauth/createPresentation.js +7 -13
  52. package/dist/actions/providers/google-oauth/createSpreadsheet.js +7 -13
  53. package/dist/actions/providers/google-oauth/deleteCalendarEvent.js +3 -12
  54. package/dist/actions/providers/google-oauth/deleteGroupMember.js +3 -12
  55. package/dist/actions/providers/google-oauth/deleteRowFromSpreadsheet.js +3 -12
  56. package/dist/actions/providers/google-oauth/editAGoogleCalendarEvent.js +4 -14
  57. package/dist/actions/providers/google-oauth/getDriveFileContentById.js +23 -33
  58. package/dist/actions/providers/google-oauth/getGroup.js +3 -12
  59. package/dist/actions/providers/google-oauth/getPresentation.js +23 -37
  60. package/dist/actions/providers/google-oauth/hasGroupMember.js +3 -12
  61. package/dist/actions/providers/google-oauth/listCalendarEvents.js +27 -21
  62. package/dist/actions/providers/google-oauth/listCalendars.js +4 -14
  63. package/dist/actions/providers/google-oauth/listGroupMembers.js +4 -13
  64. package/dist/actions/providers/google-oauth/listGroups.js +4 -14
  65. package/dist/actions/providers/google-oauth/queryGoogleBigQuery.js +10 -21
  66. package/dist/actions/providers/google-oauth/scheduleCalendarMeeting.js +11 -14
  67. package/dist/actions/providers/google-oauth/searchDriveByKeywords.js +3 -12
  68. package/dist/actions/providers/google-oauth/searchDriveByKeywordsAndGetFileContent.js +12 -23
  69. package/dist/actions/providers/google-oauth/searchDriveByQuery.js +30 -42
  70. package/dist/actions/providers/google-oauth/searchDriveByQueryAndGetFileContent.js +9 -20
  71. package/dist/actions/providers/google-oauth/updateCalendarEvent.js +3 -12
  72. package/dist/actions/providers/google-oauth/updateDoc.js +3 -12
  73. package/dist/actions/providers/google-oauth/updatePresentation.js +3 -12
  74. package/dist/actions/providers/google-oauth/updateRowsInSpreadsheet.js +4 -13
  75. package/dist/actions/providers/google-oauth/updateSpreadsheet.js +3 -12
  76. package/dist/actions/providers/google-oauth/utils/decodeMessage.js +7 -8
  77. package/dist/actions/providers/googleSearch/customSearch.js +18 -36
  78. package/dist/actions/providers/googlemail/listGmailThreads.js +7 -16
  79. package/dist/actions/providers/googlemail/replyToGmail.d.ts +3 -0
  80. package/dist/actions/providers/googlemail/replyToGmail.js +89 -0
  81. package/dist/actions/providers/googlemail/searchGmailMessages.js +10 -20
  82. package/dist/actions/providers/googlemail/sendGmail.js +7 -17
  83. package/dist/actions/providers/googlemaps/nearbysearchRestaurants.js +13 -25
  84. package/dist/actions/providers/googlemaps/validateAddress.js +3 -12
  85. package/dist/actions/providers/hubspot/getCompanies.js +4 -14
  86. package/dist/actions/providers/hubspot/getCompanyDetails.js +3 -12
  87. package/dist/actions/providers/hubspot/getContactDetails.js +3 -12
  88. package/dist/actions/providers/hubspot/getContacts.js +4 -14
  89. package/dist/actions/providers/hubspot/getDealDetails.js +3 -12
  90. package/dist/actions/providers/hubspot/getDeals.js +3 -12
  91. package/dist/actions/providers/hubspot/getTicketDetails.js +3 -12
  92. package/dist/actions/providers/hubspot/getTickets.js +3 -12
  93. package/dist/actions/providers/jira/assignJiraTicket.js +4 -13
  94. package/dist/actions/providers/jira/commentJiraTicket.js +3 -12
  95. package/dist/actions/providers/jira/createJiraTicket.js +22 -18
  96. package/dist/actions/providers/jira/createServiceDeskRequest.js +3 -12
  97. package/dist/actions/providers/jira/getJiraDCIssuesByQuery.js +5 -14
  98. package/dist/actions/providers/jira/getJiraIssuesByQuery.js +19 -29
  99. package/dist/actions/providers/jira/getJiraTicketDetails.js +3 -12
  100. package/dist/actions/providers/jira/getJiraTicketHistory.js +3 -12
  101. package/dist/actions/providers/jira/moveJiraTicketToProject.js +11 -21
  102. package/dist/actions/providers/jira/publicCommentOnServiceDeskRequest.js +3 -12
  103. package/dist/actions/providers/jira/updateJiraTicketDetails.js +15 -15
  104. package/dist/actions/providers/jira/updateJiraTicketStatus.js +4 -13
  105. package/dist/actions/providers/jira/utils.js +104 -126
  106. package/dist/actions/providers/linear/getIssueDetails.js +10 -20
  107. package/dist/actions/providers/linear/getIssues.js +11 -21
  108. package/dist/actions/providers/linear/getProjectDetails.js +10 -20
  109. package/dist/actions/providers/linear/getProjects.js +6 -16
  110. package/dist/actions/providers/linear/getTeamDetails.js +7 -17
  111. package/dist/actions/providers/linear/getTeams.js +5 -15
  112. package/dist/actions/providers/looker/enableUserByEmail.js +5 -14
  113. package/dist/actions/providers/math/add.js +2 -11
  114. package/dist/actions/providers/microsoft/createDocument.js +4 -13
  115. package/dist/actions/providers/microsoft/getDocument.js +4 -13
  116. package/dist/actions/providers/microsoft/messageTeamsChannel.js +4 -13
  117. package/dist/actions/providers/microsoft/messageTeamsChat.js +4 -13
  118. package/dist/actions/providers/microsoft/updateDocument.js +4 -13
  119. package/dist/actions/providers/microsoft/updateSpreadsheet.js +4 -13
  120. package/dist/actions/providers/microsoft/utils.js +9 -20
  121. package/dist/actions/providers/mongodb/insertMongoDoc.js +5 -14
  122. package/dist/actions/providers/notion/searchByTitle.js +3 -12
  123. package/dist/actions/providers/nws/getForecastForLocation.js +4 -13
  124. package/dist/actions/providers/oktaOrg/getOktaUserByName.js +3 -12
  125. package/dist/actions/providers/openstreetmap/getLatitudeLongitudeFromLocation.js +3 -12
  126. package/dist/actions/providers/perplexity/perplexityDeepResearch.js +11 -21
  127. package/dist/actions/providers/resend/sendEmail.js +3 -12
  128. package/dist/actions/providers/resend/sendEmailHtml.js +3 -12
  129. package/dist/actions/providers/salesforce/createCase.js +10 -13
  130. package/dist/actions/providers/salesforce/createRecord.js +3 -12
  131. package/dist/actions/providers/salesforce/executeReport.js +3 -12
  132. package/dist/actions/providers/salesforce/generateSalesReport.js +3 -12
  133. package/dist/actions/providers/salesforce/getRecord.js +3 -12
  134. package/dist/actions/providers/salesforce/getReportMetadata.js +11 -21
  135. package/dist/actions/providers/salesforce/getSalesforceRecordsByQuery.js +7 -17
  136. package/dist/actions/providers/salesforce/listReports.js +3 -12
  137. package/dist/actions/providers/salesforce/searchAllSalesforceRecords.js +3 -12
  138. package/dist/actions/providers/salesforce/searchSalesforceRecords.js +3 -12
  139. package/dist/actions/providers/salesforce/updateRecord.js +3 -12
  140. package/dist/actions/providers/slack/archiveChannel.js +9 -2
  141. package/dist/actions/providers/slack/createChannel.js +7 -17
  142. package/dist/actions/providers/slack/getChannelMembers.js +8 -18
  143. package/dist/actions/providers/slack/getChannelMessages.js +8 -18
  144. package/dist/actions/providers/slack/helpers.js +16 -47
  145. package/dist/actions/providers/slack/messageTransformers.js +10 -13
  146. package/dist/actions/providers/slack/sendDmFromBot.js +9 -19
  147. package/dist/actions/providers/slack/sendMessage.js +7 -17
  148. package/dist/actions/providers/slackUser/searchSlack.js +179 -212
  149. package/dist/actions/providers/slackUser/searchSlackRTS.js +20 -33
  150. package/dist/actions/providers/slackUser/utils.js +1 -1
  151. package/dist/actions/providers/snowflake/auth/getSnowflakeConnection.js +23 -34
  152. package/dist/actions/providers/snowflake/getRowByFieldValue.js +4 -13
  153. package/dist/actions/providers/snowflake/runSnowflakeQuery.js +9 -19
  154. package/dist/actions/providers/zendesk/addCommentToTicket.js +5 -14
  155. package/dist/actions/providers/zendesk/assignTicket.js +3 -12
  156. package/dist/actions/providers/zendesk/createZendeskTicket.js +3 -12
  157. package/dist/actions/providers/zendesk/getTicketDetails.js +3 -12
  158. package/dist/actions/providers/zendesk/listTickets.js +3 -12
  159. package/dist/actions/providers/zendesk/searchZendeskByQuery.js +3 -12
  160. package/dist/actions/providers/zendesk/updateTicketStatus.js +3 -12
  161. package/dist/actions/util/axiosClient.js +5 -5
  162. package/dist/app.js +14 -25
  163. package/dist/utils/google.js +122 -143
  164. package/dist/utils/pdf.js +10 -21
  165. package/package.json +10 -9
  166. package/dist/actions/providers/credal/callCopilot.d.ts +0 -3
  167. package/dist/actions/providers/credal/callCopilot.js +0 -36
  168. package/dist/actions/providers/math/index.d.ts +0 -1
  169. package/dist/actions/providers/math/index.js +0 -37
  170. package/dist/actions/providers/salesforce/getSalesforceRecordByQuery.d.ts +0 -3
  171. package/dist/actions/providers/salesforce/getSalesforceRecordByQuery.js +0 -43
  172. package/dist/actions/providers/slack/index.d.ts +0 -1
  173. package/dist/actions/providers/slack/index.js +0 -37
  174. package/dist/actions/providers/slack/listConversations.d.ts +0 -3
  175. package/dist/actions/providers/slack/listConversations.js +0 -41
@@ -1,29 +1,23 @@
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
1
  import axios from "axios";
11
2
  import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
12
3
  /**
13
4
  * Creates a new Google Spreadsheet using OAuth authentication
14
5
  */
15
- const createSpreadsheet = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
6
+ const createSpreadsheet = async ({ params, authParams, }) => {
16
7
  if (!authParams.authToken) {
17
8
  throw new Error(MISSING_AUTH_TOKEN);
18
9
  }
19
10
  const { title, sheets = [], properties = {} } = params;
20
11
  const baseApiUrl = "https://sheets.googleapis.com/v4/spreadsheets";
21
12
  const requestBody = {
22
- properties: Object.assign({ title }, properties),
13
+ properties: {
14
+ title,
15
+ ...properties,
16
+ },
23
17
  sheets: sheets.map(sheet => ({ properties: sheet })),
24
18
  };
25
19
  try {
26
- const response = yield axios.post(baseApiUrl, requestBody, {
20
+ const response = await axios.post(baseApiUrl, requestBody, {
27
21
  headers: {
28
22
  Authorization: `Bearer ${authParams.authToken}`,
29
23
  },
@@ -54,5 +48,5 @@ const createSpreadsheet = (_a) => __awaiter(void 0, [_a], void 0, function* ({ p
54
48
  error: error instanceof Error ? error.message : "Unknown error",
55
49
  };
56
50
  }
57
- });
51
+ };
58
52
  export default createSpreadsheet;
@@ -1,22 +1,13 @@
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
1
  import { axiosClient } from "../../util/axiosClient.js";
11
2
  import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
12
- const deleteCalendarEvent = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
3
+ const deleteCalendarEvent = async ({ params, authParams, }) => {
13
4
  if (!authParams.authToken) {
14
5
  return { success: false, error: MISSING_AUTH_TOKEN };
15
6
  }
16
7
  const { calendarId, eventId } = params;
17
8
  const url = `https://www.googleapis.com/calendar/v3/calendars/${encodeURIComponent(calendarId)}/events/${encodeURIComponent(eventId)}`;
18
9
  try {
19
- yield axiosClient.delete(url, {
10
+ await axiosClient.delete(url, {
20
11
  headers: {
21
12
  Authorization: `Bearer ${authParams.authToken}`,
22
13
  },
@@ -29,5 +20,5 @@ const deleteCalendarEvent = (_a) => __awaiter(void 0, [_a], void 0, function* ({
29
20
  error: error instanceof Error ? error.message : "Unknown error deleting event",
30
21
  };
31
22
  }
32
- });
23
+ };
33
24
  export default deleteCalendarEvent;
@@ -1,22 +1,13 @@
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
1
  import { axiosClient } from "../../util/axiosClient.js";
11
2
  import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
12
- const deleteGroupMember = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
3
+ const deleteGroupMember = async ({ params, authParams, }) => {
13
4
  const { authToken } = authParams;
14
5
  const { groupKey, memberKey } = params;
15
6
  if (!authToken) {
16
7
  return { success: false, error: MISSING_AUTH_TOKEN };
17
8
  }
18
9
  try {
19
- yield axiosClient.delete(`https://admin.googleapis.com/admin/directory/v1/groups/${encodeURIComponent(groupKey)}/members/${encodeURIComponent(memberKey)}`, {
10
+ await axiosClient.delete(`https://admin.googleapis.com/admin/directory/v1/groups/${encodeURIComponent(groupKey)}/members/${encodeURIComponent(memberKey)}`, {
20
11
  headers: { Authorization: `Bearer ${authToken}` },
21
12
  });
22
13
  return { success: true };
@@ -27,5 +18,5 @@ const deleteGroupMember = (_a) => __awaiter(void 0, [_a], void 0, function* ({ p
27
18
  error: error instanceof Error ? error.message : "Unknown error",
28
19
  };
29
20
  }
30
- });
21
+ };
31
22
  export default deleteGroupMember;
@@ -1,26 +1,17 @@
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
1
  import { axiosClient } from "../../util/axiosClient.js";
11
2
  import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
12
3
  /**
13
4
  * Deletes a row from a Google Spreadsheet using OAuth authentication
14
5
  * https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/batchUpdate
15
6
  */
16
- const deleteRowFromSpreadsheet = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
7
+ const deleteRowFromSpreadsheet = async ({ params, authParams, }) => {
17
8
  if (!authParams.authToken) {
18
9
  throw new Error(MISSING_AUTH_TOKEN);
19
10
  }
20
11
  const { spreadsheetId, sheetId, rowIndex } = params;
21
12
  const batchUpdateUrl = `https://sheets.googleapis.com/v4/spreadsheets/${spreadsheetId}:batchUpdate`;
22
13
  try {
23
- yield axiosClient.post(batchUpdateUrl, {
14
+ await axiosClient.post(batchUpdateUrl, {
24
15
  requests: [
25
16
  {
26
17
  deleteDimension: {
@@ -52,5 +43,5 @@ const deleteRowFromSpreadsheet = (_a) => __awaiter(void 0, [_a], void 0, functio
52
43
  error: error instanceof Error ? error.message : "Unknown error",
53
44
  };
54
45
  }
55
- });
46
+ };
56
47
  export default deleteRowFromSpreadsheet;
@@ -1,17 +1,7 @@
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
1
  import { axiosClient } from "../../util/axiosClient.js";
11
2
  import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
12
3
  import { getDayOfWeek } from "../../../utils/datetime.js";
13
- const editAGoogleCalendarEvent = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
- var _b, _c;
4
+ const editAGoogleCalendarEvent = async ({ params, authParams, }) => {
15
5
  if (!authParams.authToken) {
16
6
  return { success: false, error: MISSING_AUTH_TOKEN, eventId: "", eventUrl: "", eventDayOfWeek: "" };
17
7
  }
@@ -43,7 +33,7 @@ const editAGoogleCalendarEvent = (_a) => __awaiter(void 0, [_a], void 0, functio
43
33
  if (organizer !== undefined)
44
34
  body.organizer = organizer;
45
35
  try {
46
- const res = yield axiosClient.patch(url, body, {
36
+ const res = await axiosClient.patch(url, body, {
47
37
  headers: {
48
38
  Authorization: `Bearer ${authParams.authToken}`,
49
39
  },
@@ -52,7 +42,7 @@ const editAGoogleCalendarEvent = (_a) => __awaiter(void 0, [_a], void 0, functio
52
42
  // Get the event day of week from the start time (use provided start or fetch from response)
53
43
  const eventDayOfWeek = start
54
44
  ? getDayOfWeek(start)
55
- : getDayOfWeek(((_b = res.data.start) === null || _b === void 0 ? void 0 : _b.dateTime) || ((_c = res.data.start) === null || _c === void 0 ? void 0 : _c.date) || "");
45
+ : getDayOfWeek(res.data.start?.dateTime || res.data.start?.date || "");
56
46
  return {
57
47
  success: true,
58
48
  eventId: id,
@@ -69,5 +59,5 @@ const editAGoogleCalendarEvent = (_a) => __awaiter(void 0, [_a], void 0, functio
69
59
  eventDayOfWeek: "",
70
60
  };
71
61
  }
72
- });
62
+ };
73
63
  export default editAGoogleCalendarEvent;
@@ -1,12 +1,3 @@
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
1
  import { createAxiosClientWithTimeout } from "../../util/axiosClient.js";
11
2
  import mammoth from "mammoth";
12
3
  import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
@@ -18,36 +9,35 @@ const BASE_WEB_URL = "https://drive.google.com/file/d/";
18
9
  const BASE_API_URL = "https://www.googleapis.com/drive/v3/files/";
19
10
  const NEWLINE_REGEX = /\r?\n+/g;
20
11
  const WHITESPACE_REGEX = / +/g;
21
- const getDriveFileContentById = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
22
- var _b, _c, _d, _e;
12
+ const getDriveFileContentById = async ({ params, authParams, }) => {
23
13
  if (!authParams.authToken) {
24
14
  return { success: false, error: MISSING_AUTH_TOKEN };
25
15
  }
26
16
  const headers = { Authorization: `Bearer ${authParams.authToken}` };
27
17
  const { limit: charLimit, fileId } = params;
28
- const timeoutLimit = params.timeoutLimit !== undefined && params.timeoutLimit > 0 ? params.timeoutLimit * 1000 : 15000;
18
+ const timeoutLimit = params.timeoutLimit !== undefined && params.timeoutLimit > 0 ? params.timeoutLimit * 1000 : 15_000;
29
19
  const axiosClient = createAxiosClientWithTimeout(timeoutLimit);
30
20
  // helper to fetch drive metadata with fields we need (incl. shortcut details)
31
- const fetchMeta = (fid) => __awaiter(void 0, void 0, void 0, function* () {
21
+ const fetchMeta = async (fid) => {
32
22
  const metaUrl = `${BASE_API_URL}${encodeURIComponent(fid)}` +
33
23
  `?fields=name,mimeType,size,driveId,parents,` +
34
24
  `shortcutDetails(targetId,targetMimeType)` +
35
25
  `&supportsAllDrives=true`;
36
- const res = yield axiosClient.get(metaUrl, {
26
+ const res = await axiosClient.get(metaUrl, {
37
27
  headers,
38
28
  timeout: timeoutLimit,
39
29
  });
40
30
  return res.data;
41
- });
31
+ };
42
32
  try {
43
33
  // 1) metadata (possibly a shortcut)
44
- let meta = yield fetchMeta(fileId);
34
+ let meta = await fetchMeta(fileId);
45
35
  // 2) resolve shortcut transparently (re-point to target id + mime)
46
- if (meta.mimeType === "application/vnd.google-apps.shortcut" && ((_b = meta.shortcutDetails) === null || _b === void 0 ? void 0 : _b.targetId)) {
47
- meta = yield fetchMeta(meta.shortcutDetails.targetId);
36
+ if (meta.mimeType === "application/vnd.google-apps.shortcut" && meta.shortcutDetails?.targetId) {
37
+ meta = await fetchMeta(meta.shortcutDetails.targetId);
48
38
  }
49
- const fileName = (_c = meta.name) !== null && _c !== void 0 ? _c : "";
50
- const mimeType = (_d = meta.mimeType) !== null && _d !== void 0 ? _d : "";
39
+ const fileName = meta.name ?? "";
40
+ const mimeType = meta.mimeType ?? "";
51
41
  const size = meta.size ? parseInt(meta.size, 10) : undefined;
52
42
  const driveId = meta.driveId;
53
43
  // Check if file is too large (50MB limit for safety)
@@ -60,22 +50,22 @@ const getDriveFileContentById = (_a) => __awaiter(void 0, [_a], void 0, function
60
50
  const sharedDriveParam = driveId ? "&supportsAllDrives=true" : "";
61
51
  // Google Docs - use Google Docs API instead of Drive export
62
52
  if (mimeType === "application/vnd.google-apps.document") {
63
- content = yield getGoogleDocContent(params.fileId, authParams.authToken, axiosClient, sharedDriveParam);
53
+ content = await getGoogleDocContent(params.fileId, authParams.authToken, axiosClient, sharedDriveParam);
64
54
  }
65
55
  else if (mimeType === "application/vnd.google-apps.spreadsheet") {
66
- content = yield getGoogleSheetContent(params.fileId, authParams.authToken, axiosClient, sharedDriveParam);
56
+ content = await getGoogleSheetContent(params.fileId, authParams.authToken, axiosClient, sharedDriveParam);
67
57
  }
68
58
  else if (mimeType === "application/vnd.google-apps.presentation") {
69
- content = yield getGoogleSlidesContent(params.fileId, authParams.authToken, axiosClient, sharedDriveParam);
59
+ content = await getGoogleSlidesContent(params.fileId, authParams.authToken, axiosClient, sharedDriveParam);
70
60
  }
71
61
  else if (mimeType === "application/pdf") {
72
62
  const downloadUrl = `${BASE_API_URL}${encodeURIComponent(params.fileId)}?alt=media${sharedDriveParam}`;
73
- const downloadRes = yield axiosClient.get(downloadUrl, {
63
+ const downloadRes = await axiosClient.get(downloadUrl, {
74
64
  headers,
75
65
  responseType: "arraybuffer",
76
66
  });
77
67
  try {
78
- content = yield extractTextFromPdf(downloadRes.data);
68
+ content = await extractTextFromPdf(downloadRes.data);
79
69
  }
80
70
  catch (e) {
81
71
  return {
@@ -87,13 +77,13 @@ const getDriveFileContentById = (_a) => __awaiter(void 0, [_a], void 0, function
87
77
  else if (mimeType === "application/vnd.openxmlformats-officedocument.wordprocessingml.document" ||
88
78
  mimeType === "application/msword") {
89
79
  const downloadUrl = `${BASE_API_URL}${encodeURIComponent(params.fileId)}?alt=media${sharedDriveParam}`;
90
- const downloadRes = yield axiosClient.get(downloadUrl, {
80
+ const downloadRes = await axiosClient.get(downloadUrl, {
91
81
  headers,
92
82
  responseType: "arraybuffer",
93
83
  });
94
84
  try {
95
- const result = yield mammoth.extractRawText({ buffer: Buffer.from(downloadRes.data) });
96
- content = (_e = result.value) !== null && _e !== void 0 ? _e : "";
85
+ const result = await mammoth.extractRawText({ buffer: Buffer.from(downloadRes.data) });
86
+ content = result.value ?? "";
97
87
  }
98
88
  catch (wordError) {
99
89
  return {
@@ -109,7 +99,7 @@ const getDriveFileContentById = (_a) => __awaiter(void 0, [_a], void 0, function
109
99
  mimeType === "application/rtf" ||
110
100
  mimeType === "application/json") {
111
101
  const downloadUrl = `${BASE_API_URL}${encodeURIComponent(params.fileId)}?alt=media${sharedDriveParam}`;
112
- const downloadRes = yield axiosClient.get(downloadUrl, {
102
+ const downloadRes = await axiosClient.get(downloadUrl, {
113
103
  headers,
114
104
  responseType: "text",
115
105
  });
@@ -118,7 +108,7 @@ const getDriveFileContentById = (_a) => __awaiter(void 0, [_a], void 0, function
118
108
  else if (mimeType === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ||
119
109
  mimeType === "application/vnd.ms-excel") {
120
110
  const downloadUrl = `${BASE_API_URL}${encodeURIComponent(params.fileId)}?alt=media${sharedDriveParam}`;
121
- const downloadRes = yield axiosClient.get(downloadUrl, {
111
+ const downloadRes = await axiosClient.get(downloadUrl, {
122
112
  headers,
123
113
  responseType: "arraybuffer",
124
114
  });
@@ -142,14 +132,14 @@ const getDriveFileContentById = (_a) => __awaiter(void 0, [_a], void 0, function
142
132
  else if (mimeType === "application/vnd.openxmlformats-officedocument.presentationml.presentation") {
143
133
  // Handle modern PowerPoint files (.pptx only)
144
134
  const downloadUrl = `${BASE_API_URL}${encodeURIComponent(params.fileId)}?alt=media${sharedDriveParam}`;
145
- const downloadRes = yield axiosClient.get(downloadUrl, {
135
+ const downloadRes = await axiosClient.get(downloadUrl, {
146
136
  headers,
147
137
  responseType: "arraybuffer",
148
138
  });
149
139
  try {
150
140
  // officeparser expects a Buffer, so convert the ArrayBuffer
151
141
  const buffer = Buffer.from(downloadRes.data);
152
- content = yield officeParser.parseOfficeAsync(buffer);
142
+ content = await officeParser.parseOfficeAsync(buffer);
153
143
  }
154
144
  catch (powerpointError) {
155
145
  return {
@@ -185,5 +175,5 @@ const getDriveFileContentById = (_a) => __awaiter(void 0, [_a], void 0, function
185
175
  error: error instanceof Error ? error.message : "Unknown error",
186
176
  };
187
177
  }
188
- });
178
+ };
189
179
  export default getDriveFileContentById;
@@ -1,22 +1,13 @@
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
1
  import { axiosClient } from "../../util/axiosClient.js";
11
2
  import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
12
- const getGroup = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
3
+ const getGroup = async ({ params, authParams, }) => {
13
4
  const { authToken } = authParams;
14
5
  const { groupKey } = params;
15
6
  if (!authToken) {
16
7
  return { success: false, group: { id: "", email: "", name: "" }, error: MISSING_AUTH_TOKEN };
17
8
  }
18
9
  try {
19
- const response = yield axiosClient.get(`https://admin.googleapis.com/admin/directory/v1/groups/${encodeURIComponent(groupKey)}`, {
10
+ const response = await axiosClient.get(`https://admin.googleapis.com/admin/directory/v1/groups/${encodeURIComponent(groupKey)}`, {
20
11
  headers: { Authorization: `Bearer ${authToken}` },
21
12
  });
22
13
  const { id, email, name, description } = response.data;
@@ -37,5 +28,5 @@ const getGroup = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, au
37
28
  error: error instanceof Error ? error.message : "Unknown error",
38
29
  };
39
30
  }
40
- });
31
+ };
41
32
  export default getGroup;
@@ -1,12 +1,3 @@
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
1
  import { axiosClient } from "../../util/axiosClient.js";
11
2
  import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
12
3
  import { z } from "zod";
@@ -81,14 +72,13 @@ const GoogleSlidesResponseSchema = z
81
72
  * Formats text styling information into a concatenated string
82
73
  */
83
74
  const formatStyling = (textStyle) => {
84
- var _a, _b, _c, _d;
85
75
  if (!textStyle)
86
76
  return "";
87
77
  const parts = [];
88
- if (((_a = textStyle.fontSize) === null || _a === void 0 ? void 0 : _a.magnitude) && ((_b = textStyle.fontSize) === null || _b === void 0 ? void 0 : _b.unit)) {
78
+ if (textStyle.fontSize?.magnitude && textStyle.fontSize?.unit) {
89
79
  parts.push(`size: ${textStyle.fontSize.magnitude}${textStyle.fontSize.unit}`);
90
80
  }
91
- if ((_d = (_c = textStyle.foregroundColor) === null || _c === void 0 ? void 0 : _c.opaqueColor) === null || _d === void 0 ? void 0 : _d.rgbColor) {
81
+ if (textStyle.foregroundColor?.opaqueColor?.rgbColor) {
92
82
  const { red = 0, green = 0, blue = 0 } = textStyle.foregroundColor.opaqueColor.rgbColor;
93
83
  const hexColor = "#" +
94
84
  [red, green, blue]
@@ -109,15 +99,14 @@ const formatStyling = (textStyle) => {
109
99
  /**
110
100
  * Gets a Google Slides presentation by ID using OAuth authentication
111
101
  */
112
- const getPresentation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
113
- var _b;
102
+ const getPresentation = async ({ params, authParams, }) => {
114
103
  if (!authParams.authToken) {
115
104
  throw new Error(MISSING_AUTH_TOKEN);
116
105
  }
117
106
  const { presentationId } = params;
118
107
  const baseApiUrl = `https://slides.googleapis.com/v1/presentations/${presentationId}`;
119
108
  try {
120
- const response = yield axiosClient.get(baseApiUrl, {
109
+ const response = await axiosClient.get(baseApiUrl, {
121
110
  headers: {
122
111
  Authorization: `Bearer ${authParams.authToken}`,
123
112
  "Content-Type": "application/json",
@@ -133,27 +122,24 @@ const getPresentation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ par
133
122
  const parsedData = GoogleSlidesResponseSchema.parse(response.data);
134
123
  const presentation = {
135
124
  title: parsedData.title,
136
- slides: ((_b = parsedData.slides) === null || _b === void 0 ? void 0 : _b.map(slide => {
137
- var _a;
138
- return ({
139
- objectId: slide.objectId,
140
- pageElements: ((_a = slide.pageElements) === null || _a === void 0 ? void 0 : _a.flatMap(element => {
141
- var _a, _b;
142
- const textElements = ((_b = (_a = element.shape) === null || _a === void 0 ? void 0 : _a.text) === null || _b === void 0 ? void 0 : _b.textElements) || [];
143
- return textElements
144
- .map(textElement => {
145
- var _a, _b;
146
- const content = ((_a = textElement.textRun) === null || _a === void 0 ? void 0 : _a.content) || "";
147
- const styling = formatStyling((_b = textElement.textRun) === null || _b === void 0 ? void 0 : _b.style);
148
- return {
149
- objectId: `${element.objectId}`,
150
- text: content,
151
- styling,
152
- };
153
- })
154
- .filter(textRun => textRun.text.trim());
155
- }).filter(Boolean)) || [],
156
- });
125
+ slides: parsedData.slides?.map(slide => ({
126
+ objectId: slide.objectId,
127
+ pageElements: slide.pageElements
128
+ ?.flatMap(element => {
129
+ const textElements = element.shape?.text?.textElements || [];
130
+ return textElements
131
+ .map(textElement => {
132
+ const content = textElement.textRun?.content || "";
133
+ const styling = formatStyling(textElement.textRun?.style);
134
+ return {
135
+ objectId: `${element.objectId}`,
136
+ text: content,
137
+ styling,
138
+ };
139
+ })
140
+ .filter(textRun => textRun.text.trim());
141
+ })
142
+ .filter(Boolean) || [],
157
143
  })) || [],
158
144
  };
159
145
  return {
@@ -168,5 +154,5 @@ const getPresentation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ par
168
154
  error: error instanceof Error ? error.message : "Unknown error",
169
155
  };
170
156
  }
171
- });
157
+ };
172
158
  export default getPresentation;
@@ -1,22 +1,13 @@
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
1
  import { axiosClient } from "../../util/axiosClient.js";
11
2
  import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
12
- const hasGroupMember = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
3
+ const hasGroupMember = async ({ params, authParams, }) => {
13
4
  const { authToken } = authParams;
14
5
  const { groupKey, memberKey } = params;
15
6
  if (!authToken) {
16
7
  return { success: false, isMember: false, error: MISSING_AUTH_TOKEN };
17
8
  }
18
9
  try {
19
- const response = yield axiosClient.get(`https://admin.googleapis.com/admin/directory/v1/groups/${encodeURIComponent(groupKey)}/hasMember/${encodeURIComponent(memberKey)}`, {
10
+ const response = await axiosClient.get(`https://admin.googleapis.com/admin/directory/v1/groups/${encodeURIComponent(groupKey)}/hasMember/${encodeURIComponent(memberKey)}`, {
20
11
  headers: { Authorization: `Bearer ${authToken}` },
21
12
  });
22
13
  return {
@@ -31,5 +22,5 @@ const hasGroupMember = (_a) => __awaiter(void 0, [_a], void 0, function* ({ para
31
22
  error: error instanceof Error ? error.message : "Unknown error",
32
23
  };
33
24
  }
34
- });
25
+ };
35
26
  export default hasGroupMember;
@@ -1,16 +1,7 @@
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
1
  import { axiosClient } from "../../util/axiosClient.js";
11
2
  import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
12
3
  import { getDayOfWeek } from "../../../utils/datetime.js";
13
- const listCalendarEvents = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
4
+ const listCalendarEvents = async ({ params, authParams, }) => {
14
5
  if (!authParams.authToken) {
15
6
  return { success: false, error: MISSING_AUTH_TOKEN, events: [] };
16
7
  }
@@ -18,7 +9,7 @@ const listCalendarEvents = (_a) => __awaiter(void 0, [_a], void 0, function* ({
18
9
  try {
19
10
  // First, fetch the calendar's timezone
20
11
  const calendarUrl = `https://www.googleapis.com/calendar/v3/calendars/${encodeURIComponent(calendarId)}`;
21
- const calendarRes = yield axiosClient.get(calendarUrl, {
12
+ const calendarRes = await axiosClient.get(calendarUrl, {
22
13
  headers: {
23
14
  Authorization: `Bearer ${authParams.authToken}`,
24
15
  },
@@ -29,9 +20,9 @@ const listCalendarEvents = (_a) => __awaiter(void 0, [_a], void 0, function* ({
29
20
  const allEvents = [];
30
21
  let pageToken = undefined;
31
22
  let fetchedCount = 0;
32
- const max = maxResults !== null && maxResults !== void 0 ? maxResults : 250; // Default to 250 if not specified, Google API max is 250
23
+ const max = maxResults ?? 250; // Default to 250 if not specified, Google API max is 250
33
24
  while (fetchedCount < max) {
34
- const res = yield axiosClient.get(eventsUrl, {
25
+ const res = await axiosClient.get(eventsUrl, {
35
26
  headers: {
36
27
  Authorization: `Bearer ${authParams.authToken}`,
37
28
  },
@@ -50,29 +41,44 @@ const listCalendarEvents = (_a) => __awaiter(void 0, [_a], void 0, function* ({
50
41
  if (!Array.isArray(items) || items.length <= 0)
51
42
  break;
52
43
  const batch = items.slice(0, max - fetchedCount);
53
- allEvents.push(...batch.map(({ id, status, htmlLink, summary, description, location, start, end, attendees, organizer, hangoutLink, created, updated, attachments, eventType, transparency, }) => (Object.assign(Object.assign({ id,
54
- status, url: htmlLink, title: summary, description,
55
- location, start: (start === null || start === void 0 ? void 0 : start.dateTime) || (start === null || start === void 0 ? void 0 : start.date) || "", startDayOfWeek: getDayOfWeek((start === null || start === void 0 ? void 0 : start.dateTime) || (start === null || start === void 0 ? void 0 : start.date) || ""), end: (end === null || end === void 0 ? void 0 : end.dateTime) || (end === null || end === void 0 ? void 0 : end.date) || "", endDayOfWeek: getDayOfWeek((end === null || end === void 0 ? void 0 : end.dateTime) || (end === null || end === void 0 ? void 0 : end.date) || ""), attendees: Array.isArray(attendees)
44
+ allEvents.push(...batch.map(({ id, status, htmlLink, summary, description, location, start, end, attendees, organizer, hangoutLink, created, updated, attachments, eventType, transparency, }) => ({
45
+ id,
46
+ status,
47
+ url: htmlLink,
48
+ title: summary,
49
+ description,
50
+ location,
51
+ start: start?.dateTime || start?.date || "",
52
+ startDayOfWeek: getDayOfWeek(start?.dateTime || start?.date || ""),
53
+ end: end?.dateTime || end?.date || "",
54
+ endDayOfWeek: getDayOfWeek(end?.dateTime || end?.date || ""),
55
+ attendees: Array.isArray(attendees)
56
56
  ? attendees.map(({ email, displayName, responseStatus }) => ({
57
57
  email,
58
58
  displayName,
59
59
  responseStatus,
60
60
  }))
61
- : [], organizer: organizer
61
+ : [],
62
+ organizer: organizer
62
63
  ? {
63
64
  email: organizer.email,
64
65
  displayName: organizer.displayName,
65
66
  }
66
- : undefined, hangoutLink,
67
+ : undefined,
68
+ hangoutLink,
67
69
  created,
68
- updated, attachments: Array.isArray(attachments)
70
+ updated,
71
+ attachments: Array.isArray(attachments)
69
72
  ? attachments.map(({ fileId, fileUrl, title, mimeType }) => ({
70
73
  fileId,
71
74
  fileUrl,
72
75
  title,
73
76
  mimeType,
74
77
  }))
75
- : [] }, (eventType === "workingLocation" && { eventType })), (transparency === "transparent" && { transparency: "free" })))));
78
+ : [],
79
+ ...(eventType === "workingLocation" && { eventType }),
80
+ ...(transparency === "transparent" && { transparency: "free" }),
81
+ })));
76
82
  fetchedCount = allEvents.length;
77
83
  if (!nextPageToken || fetchedCount >= max)
78
84
  break;
@@ -91,5 +97,5 @@ const listCalendarEvents = (_a) => __awaiter(void 0, [_a], void 0, function* ({
91
97
  error: error instanceof Error ? error.message : "Unknown error listing events",
92
98
  };
93
99
  }
94
- });
100
+ };
95
101
  export default listCalendarEvents;
@@ -1,16 +1,6 @@
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
1
  import { axiosClient } from "../../util/axiosClient.js";
11
2
  import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
12
- const listCalendars = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
13
- var _b;
3
+ const listCalendars = async ({ params, authParams, }) => {
14
4
  if (!authParams.authToken) {
15
5
  return { success: false, error: MISSING_AUTH_TOKEN, calendars: [] };
16
6
  }
@@ -18,10 +8,10 @@ const listCalendars = (_a) => __awaiter(void 0, [_a], void 0, function* ({ param
18
8
  const allCalendars = [];
19
9
  let pageToken = undefined;
20
10
  let fetchedCount = 0;
21
- const max = (_b = params.maxResults) !== null && _b !== void 0 ? _b : 250; // Default to 250 if not specified, Google API max is 250
11
+ const max = params.maxResults ?? 250; // Default to 250 if not specified, Google API max is 250
22
12
  try {
23
13
  while (fetchedCount < max) {
24
- const res = yield axiosClient.get(url, {
14
+ const res = await axiosClient.get(url, {
25
15
  headers: {
26
16
  Authorization: `Bearer ${authParams.authToken}`,
27
17
  },
@@ -57,5 +47,5 @@ const listCalendars = (_a) => __awaiter(void 0, [_a], void 0, function* ({ param
57
47
  error: error instanceof Error ? error.message : "Unknown error listing calendars",
58
48
  };
59
49
  }
60
- });
50
+ };
61
51
  export default listCalendars;