@credal/actions 0.2.0 → 0.2.3

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 (127) hide show
  1. package/dist/actions/actionMapper.js +374 -380
  2. package/dist/actions/autogen/templates.js +94 -98
  3. package/dist/actions/autogen/types.d.ts +2 -33
  4. package/dist/actions/autogen/types.js +1621 -1659
  5. package/dist/actions/groups.js +88 -91
  6. package/dist/actions/invoke.js +5 -8
  7. package/dist/actions/parse.js +38 -43
  8. package/dist/actions/providers/asana/commentAsanaTask.js +5 -7
  9. package/dist/actions/providers/asana/createAsanaTask.js +9 -11
  10. package/dist/actions/providers/asana/getTasksDetails.js +9 -11
  11. package/dist/actions/providers/asana/listAsanaTasksByProject.js +46 -51
  12. package/dist/actions/providers/asana/searchAsanaTasks.js +6 -8
  13. package/dist/actions/providers/asana/updateAsanaTask.js +8 -10
  14. package/dist/actions/providers/asana/utils.js +7 -12
  15. package/dist/actions/providers/ashby/addCandidateToProject.js +5 -7
  16. package/dist/actions/providers/ashby/createCandidate.js +5 -7
  17. package/dist/actions/providers/ashby/createNote.js +5 -7
  18. package/dist/actions/providers/ashby/getCandidateInfo.js +5 -7
  19. package/dist/actions/providers/ashby/listCandidateNotes.js +5 -7
  20. package/dist/actions/providers/ashby/listCandidates.js +5 -7
  21. package/dist/actions/providers/ashby/searchCandidates.js +5 -7
  22. package/dist/actions/providers/ashby/updateCandidate.js +5 -7
  23. package/dist/actions/providers/bing/getTopNSearchResultUrls.js +5 -7
  24. package/dist/actions/providers/confluence/fetchPageContent.js +8 -10
  25. package/dist/actions/providers/confluence/helpers.js +1 -4
  26. package/dist/actions/providers/confluence/overwritePage.js +9 -11
  27. package/dist/actions/providers/finnhub/getBasicFinancials.js +6 -8
  28. package/dist/actions/providers/finnhub/symbolLookup.js +6 -8
  29. package/dist/actions/providers/firecrawl/deepResearch.js +5 -10
  30. package/dist/actions/providers/firecrawl/scrapeTweetDataWithNitter.js +5 -10
  31. package/dist/actions/providers/firecrawl/scrapeUrl.js +5 -10
  32. package/dist/actions/providers/generic/fillTemplate.js +1 -3
  33. package/dist/actions/providers/github/createBranch.js +4 -39
  34. package/dist/actions/providers/github/createOrUpdateFile.js +6 -41
  35. package/dist/actions/providers/github/createPullRequest.js +4 -39
  36. package/dist/actions/providers/github/listPullRequests.js +7 -12
  37. package/dist/actions/providers/gong/getGongTranscripts.js +49 -84
  38. package/dist/actions/providers/google-oauth/addGroupMember.js +5 -7
  39. package/dist/actions/providers/google-oauth/createNewGoogleDoc.js +6 -8
  40. package/dist/actions/providers/google-oauth/createPresentation.js +5 -7
  41. package/dist/actions/providers/google-oauth/createSpreadsheet.js +5 -10
  42. package/dist/actions/providers/google-oauth/deleteCalendarEvent.js +5 -7
  43. package/dist/actions/providers/google-oauth/deleteGroupMember.js +5 -7
  44. package/dist/actions/providers/google-oauth/getGroup.js +5 -7
  45. package/dist/actions/providers/google-oauth/hasGroupMember.js +5 -7
  46. package/dist/actions/providers/google-oauth/listCalendarEvents.js +5 -7
  47. package/dist/actions/providers/google-oauth/listCalendars.js +5 -7
  48. package/dist/actions/providers/google-oauth/listGroupMembers.js +5 -7
  49. package/dist/actions/providers/google-oauth/listGroups.js +5 -7
  50. package/dist/actions/providers/google-oauth/scheduleCalendarMeeting.js +7 -9
  51. package/dist/actions/providers/google-oauth/searchDriveByKeywords.js +5 -7
  52. package/dist/actions/providers/google-oauth/updateCalendarEvent.js +5 -7
  53. package/dist/actions/providers/google-oauth/updateDoc.js +5 -10
  54. package/dist/actions/providers/google-oauth/updatePresentation.js +5 -7
  55. package/dist/actions/providers/google-oauth/updateSpreadsheet.js +5 -7
  56. package/dist/actions/providers/google-oauth/utils/decodeMessage.js +2 -6
  57. package/dist/actions/providers/googlemail/listGmailThreads.js +8 -10
  58. package/dist/actions/providers/googlemail/searchGmailMessages.js +8 -10
  59. package/dist/actions/providers/googlemaps/nearbysearchRestaurants.js +5 -7
  60. package/dist/actions/providers/googlemaps/validateAddress.js +3 -5
  61. package/dist/actions/providers/jamf/getJamfComputerInventory.js +8 -26
  62. package/dist/actions/providers/jamf/getJamfFileVaultRecoveryKey.js +7 -26
  63. package/dist/actions/providers/jira/assignJiraTicket.js +5 -10
  64. package/dist/actions/providers/jira/commentJiraTicket.js +3 -5
  65. package/dist/actions/providers/jira/createJiraTicket.js +6 -8
  66. package/dist/actions/providers/jira/getJiraIssuesByQuery.js +4 -6
  67. package/dist/actions/providers/jira/getJiraTicketDetails.js +3 -5
  68. package/dist/actions/providers/jira/getJiraTicketHistory.js +3 -5
  69. package/dist/actions/providers/jira/updateJiraTicketDetails.js +3 -5
  70. package/dist/actions/providers/jira/updateJiraTicketStatus.js +4 -6
  71. package/dist/actions/providers/jira/utils.js +3 -6
  72. package/dist/actions/providers/kandji/getFVRecoveryKeyForDevice.js +4 -6
  73. package/dist/actions/providers/linkedin/createSharePostLinkedinUrl.js +1 -3
  74. package/dist/actions/providers/looker/enableUserByEmail.js +5 -7
  75. package/dist/actions/providers/math/add.js +1 -3
  76. package/dist/actions/providers/microsoft/createDocument.js +5 -7
  77. package/dist/actions/providers/microsoft/getDocument.js +3 -5
  78. package/dist/actions/providers/microsoft/messageTeamsChannel.js +4 -6
  79. package/dist/actions/providers/microsoft/messageTeamsChat.js +4 -6
  80. package/dist/actions/providers/microsoft/updateDocument.js +4 -6
  81. package/dist/actions/providers/microsoft/updateSpreadsheet.js +4 -6
  82. package/dist/actions/providers/microsoft/utils.js +6 -10
  83. package/dist/actions/providers/mongodb/insertMongoDoc.js +3 -5
  84. package/dist/actions/providers/notion/searchByTitle.js +5 -10
  85. package/dist/actions/providers/nws/getForecastForLocation.js +7 -9
  86. package/dist/actions/providers/openstreetmap/getLatitudeLongitudeFromLocation.js +3 -5
  87. package/dist/actions/providers/resend/sendEmail.js +6 -8
  88. package/dist/actions/providers/salesforce/createCase.js +3 -5
  89. package/dist/actions/providers/salesforce/createRecord.js +4 -6
  90. package/dist/actions/providers/salesforce/fetchSalesforceSchema.js +3 -5
  91. package/dist/actions/providers/salesforce/generateSalesReport.js +3 -5
  92. package/dist/actions/providers/salesforce/getRecord.js +3 -5
  93. package/dist/actions/providers/salesforce/getSalesforceRecordsByQuery.js +4 -6
  94. package/dist/actions/providers/salesforce/updateRecord.js +3 -5
  95. package/dist/actions/providers/slack/getChannelMessages.js +7 -9
  96. package/dist/actions/providers/slack/helpers.js +1 -4
  97. package/dist/actions/providers/slack/sendMessage.js +10 -12
  98. package/dist/actions/providers/snowflake/auth/getSnowflakeConnection.js +4 -41
  99. package/dist/actions/providers/snowflake/getRowByFieldValue.js +3 -5
  100. package/dist/actions/providers/snowflake/runSnowflakeQuery.js +8 -13
  101. package/dist/actions/providers/x/createXSharePostUrl.js +1 -3
  102. package/dist/actions/providers/zendesk/addCommentToTicket.js +5 -7
  103. package/dist/actions/providers/zendesk/assignTicket.js +5 -7
  104. package/dist/actions/providers/zendesk/createZendeskTicket.js +5 -7
  105. package/dist/actions/providers/zendesk/getTicketDetails.js +5 -7
  106. package/dist/actions/providers/zendesk/listTickets.js +5 -7
  107. package/dist/actions/providers/zendesk/updateTicketStatus.js +5 -7
  108. package/dist/actions/util/axiosClient.js +4 -11
  109. package/dist/actions/util/formatDataForCodeInterpreter.js +1 -4
  110. package/dist/actions/util/missingAuthConstants.js +2 -5
  111. package/dist/app.js +5 -42
  112. package/dist/index.js +4 -24
  113. package/dist/server.d.ts +2 -0
  114. package/dist/server.js +8 -0
  115. package/dist/utils/datetime.js +4 -8
  116. package/dist/utils/string.js +1 -4
  117. package/package.json +2 -1
  118. package/dist/actions/providers/confluence/updatePage.d.ts +0 -3
  119. package/dist/actions/providers/confluence/updatePage.js +0 -47
  120. package/dist/actions/providers/credal/callCopilot.d.ts +0 -3
  121. package/dist/actions/providers/credal/callCopilot.js +0 -36
  122. package/dist/actions/providers/math/index.d.ts +0 -1
  123. package/dist/actions/providers/math/index.js +0 -37
  124. package/dist/actions/providers/slack/index.d.ts +0 -1
  125. package/dist/actions/providers/slack/index.js +0 -37
  126. package/dist/actions/providers/slack/listConversations.d.ts +0 -3
  127. package/dist/actions/providers/slack/listConversations.js +0 -41
@@ -1,37 +1,3 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -52,64 +18,63 @@ var __rest = (this && this.__rest) || function (s, e) {
52
18
  }
53
19
  return t;
54
20
  };
55
- Object.defineProperty(exports, "__esModule", { value: true });
56
- const axios_1 = __importStar(require("axios"));
57
- const zod_1 = require("zod");
58
- const missingAuthConstants_1 = require("../../util/missingAuthConstants");
59
- const UserSchema = zod_1.z
21
+ import axios, { AxiosError } from "axios";
22
+ import { z } from "zod";
23
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
24
+ const UserSchema = z
60
25
  .object({
61
- id: zod_1.z.string(),
62
- firstName: zod_1.z.string(),
63
- lastName: zod_1.z.string(),
64
- title: zod_1.z.string(),
65
- emailAddress: zod_1.z.string(),
26
+ id: z.string(),
27
+ firstName: z.string(),
28
+ lastName: z.string(),
29
+ title: z.string(),
30
+ emailAddress: z.string(),
66
31
  })
67
32
  .partial()
68
33
  .passthrough();
69
- const CallSchema = zod_1.z
34
+ const CallSchema = z
70
35
  .object({
71
- metaData: zod_1.z.object({
72
- id: zod_1.z.string(),
73
- primaryUserId: zod_1.z.string(),
74
- started: zod_1.z.string(),
75
- isPrivate: zod_1.z.boolean(),
76
- title: zod_1.z.string(),
36
+ metaData: z.object({
37
+ id: z.string(),
38
+ primaryUserId: z.string(),
39
+ started: z.string(),
40
+ isPrivate: z.boolean(),
41
+ title: z.string(),
77
42
  }),
78
- parties: zod_1.z.array(zod_1.z
43
+ parties: z.array(z
79
44
  .object({
80
- id: zod_1.z.string(),
81
- name: zod_1.z.string(),
82
- userId: zod_1.z.string(),
83
- emailAddress: zod_1.z.string(),
84
- speakerId: zod_1.z.string().nullable(),
45
+ id: z.string(),
46
+ name: z.string(),
47
+ userId: z.string(),
48
+ emailAddress: z.string(),
49
+ speakerId: z.string().nullable(),
85
50
  })
86
51
  .partial()
87
52
  .passthrough()),
88
- content: zod_1.z.object({
89
- trackers: zod_1.z.array(zod_1.z.object({
90
- id: zod_1.z.string(),
91
- name: zod_1.z.string(),
53
+ content: z.object({
54
+ trackers: z.array(z.object({
55
+ id: z.string(),
56
+ name: z.string(),
92
57
  })),
93
58
  }),
94
59
  })
95
60
  .partial()
96
61
  .passthrough();
97
- const SentenceSchema = zod_1.z
62
+ const SentenceSchema = z
98
63
  .object({
99
- start: zod_1.z.number(),
100
- end: zod_1.z.number(),
101
- text: zod_1.z.string(),
64
+ start: z.number(),
65
+ end: z.number(),
66
+ text: z.string(),
102
67
  })
103
68
  .partial()
104
69
  .passthrough();
105
- const TranscriptSchema = zod_1.z
70
+ const TranscriptSchema = z
106
71
  .object({
107
- callId: zod_1.z.string(),
108
- transcript: zod_1.z.array(zod_1.z
72
+ callId: z.string(),
73
+ transcript: z.array(z
109
74
  .object({
110
- speakerId: zod_1.z.string(),
111
- topic: zod_1.z.string().nullable(),
112
- sentences: zod_1.z.array(SentenceSchema),
75
+ speakerId: z.string(),
76
+ topic: z.string().nullable(),
77
+ sentences: z.array(SentenceSchema),
113
78
  })
114
79
  .partial()
115
80
  .passthrough()),
@@ -117,11 +82,11 @@ const TranscriptSchema = zod_1.z
117
82
  .partial()
118
83
  .passthrough();
119
84
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
120
- const GongResponseSchema = zod_1.z.object({
121
- users: zod_1.z.array(UserSchema).optional(),
122
- calls: zod_1.z.array(CallSchema).optional(),
123
- callTranscripts: zod_1.z.array(TranscriptSchema).optional(),
124
- cursor: zod_1.z.string().optional(),
85
+ const GongResponseSchema = z.object({
86
+ users: z.array(UserSchema).optional(),
87
+ calls: z.array(CallSchema).optional(),
88
+ callTranscripts: z.array(TranscriptSchema).optional(),
89
+ cursor: z.string().optional(),
125
90
  });
126
91
  function getUsers(authToken) {
127
92
  return __awaiter(this, void 0, void 0, function* () {
@@ -129,7 +94,7 @@ function getUsers(authToken) {
129
94
  const results = [];
130
95
  let cursor = undefined;
131
96
  do {
132
- const response = yield axios_1.default.get(`https://api.gong.io/v2/users` + (cursor ? `?cursor=${cursor}` : ""), {
97
+ const response = yield axios.get(`https://api.gong.io/v2/users` + (cursor ? `?cursor=${cursor}` : ""), {
133
98
  headers: {
134
99
  Authorization: `Bearer ${authToken}`,
135
100
  "Content-Type": "application/json",
@@ -154,7 +119,7 @@ function getCalls(authToken_1) {
154
119
  let results = [];
155
120
  let cursor = undefined;
156
121
  do {
157
- const response = yield axios_1.default.post(`https://api.gong.io/v2/calls/extensive` + (cursor ? `?cursor=${cursor}` : ""), {
122
+ const response = yield axios.post(`https://api.gong.io/v2/calls/extensive` + (cursor ? `?cursor=${cursor}` : ""), {
158
123
  filter: Object.assign({}, params),
159
124
  contentSelector: {
160
125
  exposedFields: {
@@ -173,7 +138,7 @@ function getCalls(authToken_1) {
173
138
  if (!response) {
174
139
  return results;
175
140
  }
176
- const parsedItems = zod_1.z.array(CallSchema).safeParse(response.data.calls);
141
+ const parsedItems = z.array(CallSchema).safeParse(response.data.calls);
177
142
  if (parsedItems.success) {
178
143
  results = [...results, ...parsedItems.data];
179
144
  }
@@ -190,7 +155,7 @@ function getTranscripts(authToken_1) {
190
155
  let results = [];
191
156
  let cursor = undefined;
192
157
  do {
193
- const response = yield axios_1.default.post(`https://api.gong.io/v2/calls/transcript` + (cursor ? `?cursor=${cursor}` : ""), {
158
+ const response = yield axios.post(`https://api.gong.io/v2/calls/transcript` + (cursor ? `?cursor=${cursor}` : ""), {
194
159
  filter: Object.assign({}, params),
195
160
  }, {
196
161
  headers: {
@@ -201,7 +166,7 @@ function getTranscripts(authToken_1) {
201
166
  if (!response) {
202
167
  return results;
203
168
  }
204
- const parsedItems = zod_1.z.array(TranscriptSchema).safeParse(response.data.callTranscripts);
169
+ const parsedItems = z.array(TranscriptSchema).safeParse(response.data.callTranscripts);
205
170
  if (parsedItems.success) {
206
171
  results = [...results, ...parsedItems.data];
207
172
  }
@@ -219,7 +184,7 @@ const getGongTranscripts = (_a) => __awaiter(void 0, [_a], void 0, function* ({
219
184
  if (!authParams.authToken) {
220
185
  return {
221
186
  success: false,
222
- error: missingAuthConstants_1.MISSING_AUTH_TOKEN,
187
+ error: MISSING_AUTH_TOKEN,
223
188
  };
224
189
  }
225
190
  if (!authParams.username) {
@@ -343,8 +308,8 @@ const getGongTranscripts = (_a) => __awaiter(void 0, [_a], void 0, function* ({
343
308
  catch (error) {
344
309
  return {
345
310
  success: false,
346
- error: error instanceof axios_1.AxiosError ? ((_h = (_g = (_f = error.response) === null || _f === void 0 ? void 0 : _f.data) === null || _g === void 0 ? void 0 : _g.errors) !== null && _h !== void 0 ? _h : error.message) : error,
311
+ error: error instanceof AxiosError ? ((_h = (_g = (_f = error.response) === null || _f === void 0 ? void 0 : _f.data) === null || _g === void 0 ? void 0 : _g.errors) !== null && _h !== void 0 ? _h : error.message) : error,
347
312
  };
348
313
  }
349
314
  });
350
- exports.default = getGongTranscripts;
315
+ export default getGongTranscripts;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,17 +7,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
8
  });
10
9
  };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const axiosClient_1 = require("../../util/axiosClient");
13
- const missingAuthConstants_1 = require("../../util/missingAuthConstants");
10
+ import { axiosClient } from "../../util/axiosClient";
11
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
14
12
  const addGroupMember = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
15
13
  const { authToken } = authParams;
16
14
  const { groupKey, email } = params;
17
15
  if (!authToken) {
18
- return { success: false, memberID: "", error: missingAuthConstants_1.MISSING_AUTH_TOKEN };
16
+ return { success: false, memberID: "", error: MISSING_AUTH_TOKEN };
19
17
  }
20
18
  try {
21
- const response = yield axiosClient_1.axiosClient.post(`https://admin.googleapis.com/admin/directory/v1/groups/${encodeURIComponent(groupKey)}/members`, { email }, {
19
+ const response = yield axiosClient.post(`https://admin.googleapis.com/admin/directory/v1/groups/${encodeURIComponent(groupKey)}/members`, { email }, {
22
20
  headers: { Authorization: `Bearer ${authToken}` },
23
21
  });
24
22
  return {
@@ -34,4 +32,4 @@ const addGroupMember = (_a) => __awaiter(void 0, [_a], void 0, function* ({ para
34
32
  };
35
33
  }
36
34
  });
37
- exports.default = addGroupMember;
35
+ export default addGroupMember;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,20 +7,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
8
  });
10
9
  };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const axiosClient_1 = require("../../util/axiosClient");
13
- const missingAuthConstants_1 = require("../../util/missingAuthConstants");
10
+ import { axiosClient } from "../../util/axiosClient";
11
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
14
12
  /**
15
13
  * Creates a new Google Doc document using OAuth authentication
16
14
  */
17
15
  const createNewGoogleDoc = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
18
16
  if (!authParams.authToken) {
19
- throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
17
+ throw new Error(MISSING_AUTH_TOKEN);
20
18
  }
21
19
  const { title, content } = params;
22
20
  const baseApiUrl = "https://docs.googleapis.com/v1/documents";
23
21
  // Create the document with the provided title
24
- const response = yield axiosClient_1.axiosClient.post(baseApiUrl, { title }, {
22
+ const response = yield axiosClient.post(baseApiUrl, { title }, {
25
23
  headers: {
26
24
  Authorization: `Bearer ${authParams.authToken}`,
27
25
  "Content-Type": "application/json",
@@ -31,7 +29,7 @@ const createNewGoogleDoc = (_a) => __awaiter(void 0, [_a], void 0, function* ({
31
29
  if (content) {
32
30
  const documentId = response.data.documentId;
33
31
  // Add the description to the document content
34
- yield axiosClient_1.axiosClient.post(`${baseApiUrl}/${documentId}:batchUpdate`, {
32
+ yield axiosClient.post(`${baseApiUrl}/${documentId}:batchUpdate`, {
35
33
  requests: [
36
34
  {
37
35
  insertText: {
@@ -56,4 +54,4 @@ const createNewGoogleDoc = (_a) => __awaiter(void 0, [_a], void 0, function* ({
56
54
  : undefined,
57
55
  };
58
56
  });
59
- exports.default = createNewGoogleDoc;
57
+ export default createNewGoogleDoc;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,21 +7,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
8
  });
10
9
  };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const axiosClient_1 = require("../../util/axiosClient");
13
- const missingAuthConstants_1 = require("../../util/missingAuthConstants");
10
+ import { axiosClient } from "../../util/axiosClient";
11
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
14
12
  /**
15
13
  * Creates a new Google Slides presentation using OAuth authentication
16
14
  */
17
15
  const createPresentation = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
18
16
  if (!authParams.authToken) {
19
- throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
17
+ throw new Error(MISSING_AUTH_TOKEN);
20
18
  }
21
19
  const { title, pageSize } = params;
22
20
  const baseApiUrl = "https://slides.googleapis.com/v1/presentations";
23
21
  const requestBody = Object.assign({ title }, (pageSize && { pageSize }));
24
22
  try {
25
- const response = yield axiosClient_1.axiosClient.post(baseApiUrl, requestBody, {
23
+ const response = yield axiosClient.post(baseApiUrl, requestBody, {
26
24
  headers: {
27
25
  Authorization: `Bearer ${authParams.authToken}`,
28
26
  "Content-Type": "application/json",
@@ -50,4 +48,4 @@ const createPresentation = (_a) => __awaiter(void 0, [_a], void 0, function* ({
50
48
  };
51
49
  }
52
50
  });
53
- exports.default = createPresentation;
51
+ export default createPresentation;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,18 +7,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
8
  });
10
9
  };
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 missingAuthConstants_1 = require("../../util/missingAuthConstants");
10
+ import axios from "axios";
11
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
17
12
  /**
18
13
  * Creates a new Google Spreadsheet using OAuth authentication
19
14
  */
20
15
  const createSpreadsheet = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
21
16
  if (!authParams.authToken) {
22
- throw new Error(missingAuthConstants_1.MISSING_AUTH_TOKEN);
17
+ throw new Error(MISSING_AUTH_TOKEN);
23
18
  }
24
19
  const { title, sheets = [], properties = {} } = params;
25
20
  const baseApiUrl = "https://sheets.googleapis.com/v4/spreadsheets";
@@ -28,7 +23,7 @@ const createSpreadsheet = (_a) => __awaiter(void 0, [_a], void 0, function* ({ p
28
23
  sheets: sheets.map(sheet => ({ properties: sheet })),
29
24
  };
30
25
  try {
31
- const response = yield axios_1.default.post(baseApiUrl, requestBody, {
26
+ const response = yield axios.post(baseApiUrl, requestBody, {
32
27
  headers: {
33
28
  Authorization: `Bearer ${authParams.authToken}`,
34
29
  },
@@ -60,4 +55,4 @@ const createSpreadsheet = (_a) => __awaiter(void 0, [_a], void 0, function* ({ p
60
55
  };
61
56
  }
62
57
  });
63
- exports.default = createSpreadsheet;
58
+ export default createSpreadsheet;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,17 +7,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
8
  });
10
9
  };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const axiosClient_1 = require("../../util/axiosClient");
13
- const missingAuthConstants_1 = require("../../util/missingAuthConstants");
10
+ import { axiosClient } from "../../util/axiosClient";
11
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
14
12
  const deleteCalendarEvent = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
15
13
  if (!authParams.authToken) {
16
- return { success: false, error: missingAuthConstants_1.MISSING_AUTH_TOKEN };
14
+ return { success: false, error: MISSING_AUTH_TOKEN };
17
15
  }
18
16
  const { calendarId, eventId } = params;
19
17
  const url = `https://www.googleapis.com/calendar/v3/calendars/${encodeURIComponent(calendarId)}/events/${encodeURIComponent(eventId)}`;
20
18
  try {
21
- yield axiosClient_1.axiosClient.delete(url, {
19
+ yield axiosClient.delete(url, {
22
20
  headers: {
23
21
  Authorization: `Bearer ${authParams.authToken}`,
24
22
  },
@@ -32,4 +30,4 @@ const deleteCalendarEvent = (_a) => __awaiter(void 0, [_a], void 0, function* ({
32
30
  };
33
31
  }
34
32
  });
35
- exports.default = deleteCalendarEvent;
33
+ export default deleteCalendarEvent;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,17 +7,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
8
  });
10
9
  };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const axiosClient_1 = require("../../util/axiosClient");
13
- const missingAuthConstants_1 = require("../../util/missingAuthConstants");
10
+ import { axiosClient } from "../../util/axiosClient";
11
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
14
12
  const deleteGroupMember = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
15
13
  const { authToken } = authParams;
16
14
  const { groupKey, memberKey } = params;
17
15
  if (!authToken) {
18
- return { success: false, error: missingAuthConstants_1.MISSING_AUTH_TOKEN };
16
+ return { success: false, error: MISSING_AUTH_TOKEN };
19
17
  }
20
18
  try {
21
- yield axiosClient_1.axiosClient.delete(`https://admin.googleapis.com/admin/directory/v1/groups/${encodeURIComponent(groupKey)}/members/${encodeURIComponent(memberKey)}`, {
19
+ yield axiosClient.delete(`https://admin.googleapis.com/admin/directory/v1/groups/${encodeURIComponent(groupKey)}/members/${encodeURIComponent(memberKey)}`, {
22
20
  headers: { Authorization: `Bearer ${authToken}` },
23
21
  });
24
22
  return { success: true };
@@ -30,4 +28,4 @@ const deleteGroupMember = (_a) => __awaiter(void 0, [_a], void 0, function* ({ p
30
28
  };
31
29
  }
32
30
  });
33
- exports.default = deleteGroupMember;
31
+ export default deleteGroupMember;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,17 +7,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
8
  });
10
9
  };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const axiosClient_1 = require("../../util/axiosClient");
13
- const missingAuthConstants_1 = require("../../util/missingAuthConstants");
10
+ import { axiosClient } from "../../util/axiosClient";
11
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
14
12
  const getGroup = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
15
13
  const { authToken } = authParams;
16
14
  const { groupKey } = params;
17
15
  if (!authToken) {
18
- return { success: false, group: { id: "", email: "", name: "" }, error: missingAuthConstants_1.MISSING_AUTH_TOKEN };
16
+ return { success: false, group: { id: "", email: "", name: "" }, error: MISSING_AUTH_TOKEN };
19
17
  }
20
18
  try {
21
- const response = yield axiosClient_1.axiosClient.get(`https://admin.googleapis.com/admin/directory/v1/groups/${encodeURIComponent(groupKey)}`, {
19
+ const response = yield axiosClient.get(`https://admin.googleapis.com/admin/directory/v1/groups/${encodeURIComponent(groupKey)}`, {
22
20
  headers: { Authorization: `Bearer ${authToken}` },
23
21
  });
24
22
  const { id, email, name, description } = response.data;
@@ -40,4 +38,4 @@ const getGroup = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, au
40
38
  };
41
39
  }
42
40
  });
43
- exports.default = getGroup;
41
+ export default getGroup;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,17 +7,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
8
  });
10
9
  };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const axiosClient_1 = require("../../util/axiosClient");
13
- const missingAuthConstants_1 = require("../../util/missingAuthConstants");
10
+ import { axiosClient } from "../../util/axiosClient";
11
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
14
12
  const hasGroupMember = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
15
13
  const { authToken } = authParams;
16
14
  const { groupKey, memberKey } = params;
17
15
  if (!authToken) {
18
- return { success: false, isMember: false, error: missingAuthConstants_1.MISSING_AUTH_TOKEN };
16
+ return { success: false, isMember: false, error: MISSING_AUTH_TOKEN };
19
17
  }
20
18
  try {
21
- const response = yield axiosClient_1.axiosClient.get(`https://admin.googleapis.com/admin/directory/v1/groups/${encodeURIComponent(groupKey)}/hasMember/${encodeURIComponent(memberKey)}`, {
19
+ const response = yield axiosClient.get(`https://admin.googleapis.com/admin/directory/v1/groups/${encodeURIComponent(groupKey)}/hasMember/${encodeURIComponent(memberKey)}`, {
22
20
  headers: { Authorization: `Bearer ${authToken}` },
23
21
  });
24
22
  return {
@@ -34,4 +32,4 @@ const hasGroupMember = (_a) => __awaiter(void 0, [_a], void 0, function* ({ para
34
32
  };
35
33
  }
36
34
  });
37
- exports.default = hasGroupMember;
35
+ export default hasGroupMember;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,12 +7,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
8
  });
10
9
  };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const axiosClient_1 = require("../../util/axiosClient");
13
- const missingAuthConstants_1 = require("../../util/missingAuthConstants");
10
+ import { axiosClient } from "../../util/axiosClient";
11
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
14
12
  const listCalendarEvents = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
15
13
  if (!authParams.authToken) {
16
- return { success: false, error: missingAuthConstants_1.MISSING_AUTH_TOKEN, events: [] };
14
+ return { success: false, error: MISSING_AUTH_TOKEN, events: [] };
17
15
  }
18
16
  const { calendarId, query, maxResults } = params;
19
17
  const url = `https://www.googleapis.com/calendar/v3/calendars/${encodeURIComponent(calendarId)}/events`;
@@ -23,7 +21,7 @@ const listCalendarEvents = (_a) => __awaiter(void 0, [_a], void 0, function* ({
23
21
  const max = maxResults !== null && maxResults !== void 0 ? maxResults : 250; // Default to 250 if not specified, Google API max is 250
24
22
  try {
25
23
  while (fetchedCount < max) {
26
- const res = yield axiosClient_1.axiosClient.get(url, {
24
+ const res = yield axiosClient.get(url, {
27
25
  headers: {
28
26
  Authorization: `Bearer ${authParams.authToken}`,
29
27
  },
@@ -83,4 +81,4 @@ const listCalendarEvents = (_a) => __awaiter(void 0, [_a], void 0, function* ({
83
81
  };
84
82
  }
85
83
  });
86
- exports.default = listCalendarEvents;
84
+ export default listCalendarEvents;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,13 +7,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
8
  });
10
9
  };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const axiosClient_1 = require("../../util/axiosClient");
13
- const missingAuthConstants_1 = require("../../util/missingAuthConstants");
10
+ import { axiosClient } from "../../util/axiosClient";
11
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
14
12
  const listCalendars = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
15
13
  var _b;
16
14
  if (!authParams.authToken) {
17
- return { success: false, error: missingAuthConstants_1.MISSING_AUTH_TOKEN, calendars: [] };
15
+ return { success: false, error: MISSING_AUTH_TOKEN, calendars: [] };
18
16
  }
19
17
  const url = "https://www.googleapis.com/calendar/v3/users/me/calendarList";
20
18
  const allCalendars = [];
@@ -23,7 +21,7 @@ const listCalendars = (_a) => __awaiter(void 0, [_a], void 0, function* ({ param
23
21
  const max = (_b = params.maxResults) !== null && _b !== void 0 ? _b : 250; // Default to 250 if not specified, Google API max is 250
24
22
  try {
25
23
  while (fetchedCount < max) {
26
- const res = yield axiosClient_1.axiosClient.get(url, {
24
+ const res = yield axiosClient.get(url, {
27
25
  headers: {
28
26
  Authorization: `Bearer ${authParams.authToken}`,
29
27
  },
@@ -60,4 +58,4 @@ const listCalendars = (_a) => __awaiter(void 0, [_a], void 0, function* ({ param
60
58
  };
61
59
  }
62
60
  });
63
- exports.default = listCalendars;
61
+ export default listCalendars;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,14 +7,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
8
  });
10
9
  };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const axiosClient_1 = require("../../util/axiosClient");
13
- const missingAuthConstants_1 = require("../../util/missingAuthConstants");
10
+ import { axiosClient } from "../../util/axiosClient";
11
+ import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
14
12
  const listGroupMembers = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
15
13
  const { authToken } = authParams;
16
14
  const { groupKey, maxResults } = params;
17
15
  if (!authToken) {
18
- return { success: false, members: [], error: missingAuthConstants_1.MISSING_AUTH_TOKEN };
16
+ return { success: false, members: [], error: MISSING_AUTH_TOKEN };
19
17
  }
20
18
  try {
21
19
  let members = [];
@@ -26,7 +24,7 @@ const listGroupMembers = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
26
24
  url.searchParams.set("maxResults", String(limit - members.length));
27
25
  if (pageToken)
28
26
  url.searchParams.set("pageToken", pageToken);
29
- const response = yield axiosClient_1.axiosClient.get(url.toString(), {
27
+ const response = yield axiosClient.get(url.toString(), {
30
28
  headers: { Authorization: `Bearer ${authToken}` },
31
29
  });
32
30
  const data = response.data;
@@ -51,4 +49,4 @@ const listGroupMembers = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
51
49
  };
52
50
  }
53
51
  });
54
- exports.default = listGroupMembers;
52
+ export default listGroupMembers;