@credal/actions 0.2.2 → 0.2.4
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.
- package/dist/actions/actionMapper.js +374 -380
- package/dist/actions/autogen/templates.js +94 -98
- package/dist/actions/autogen/types.js +1621 -1627
- package/dist/actions/groups.js +88 -91
- package/dist/actions/invoke.js +5 -8
- package/dist/actions/parse.js +28 -33
- package/dist/actions/providers/asana/commentAsanaTask.js +5 -7
- package/dist/actions/providers/asana/createAsanaTask.js +9 -11
- package/dist/actions/providers/asana/getTasksDetails.js +9 -11
- package/dist/actions/providers/asana/listAsanaTasksByProject.js +46 -51
- package/dist/actions/providers/asana/searchAsanaTasks.js +6 -8
- package/dist/actions/providers/asana/updateAsanaTask.js +8 -10
- package/dist/actions/providers/asana/utils.js +7 -12
- package/dist/actions/providers/ashby/addCandidateToProject.js +5 -7
- package/dist/actions/providers/ashby/createCandidate.js +5 -7
- package/dist/actions/providers/ashby/createNote.js +5 -7
- package/dist/actions/providers/ashby/getCandidateInfo.js +5 -7
- package/dist/actions/providers/ashby/listCandidateNotes.js +5 -7
- package/dist/actions/providers/ashby/listCandidates.js +5 -7
- package/dist/actions/providers/ashby/searchCandidates.js +5 -7
- package/dist/actions/providers/ashby/updateCandidate.js +5 -7
- package/dist/actions/providers/bing/getTopNSearchResultUrls.js +5 -7
- package/dist/actions/providers/confluence/fetchPageContent.js +8 -10
- package/dist/actions/providers/confluence/helpers.js +1 -4
- package/dist/actions/providers/confluence/overwritePage.js +9 -11
- package/dist/actions/providers/finnhub/getBasicFinancials.js +6 -8
- package/dist/actions/providers/finnhub/symbolLookup.js +6 -8
- package/dist/actions/providers/firecrawl/deepResearch.js +5 -10
- package/dist/actions/providers/firecrawl/scrapeTweetDataWithNitter.js +5 -10
- package/dist/actions/providers/firecrawl/scrapeUrl.js +5 -10
- package/dist/actions/providers/generic/fillTemplate.js +1 -3
- package/dist/actions/providers/github/createBranch.js +4 -39
- package/dist/actions/providers/github/createOrUpdateFile.js +6 -41
- package/dist/actions/providers/github/createPullRequest.js +4 -39
- package/dist/actions/providers/github/listPullRequests.js +7 -12
- package/dist/actions/providers/gong/getGongTranscripts.js +49 -84
- package/dist/actions/providers/google-oauth/addGroupMember.js +5 -7
- package/dist/actions/providers/google-oauth/createNewGoogleDoc.js +6 -8
- package/dist/actions/providers/google-oauth/createPresentation.js +5 -7
- package/dist/actions/providers/google-oauth/createSpreadsheet.js +5 -10
- package/dist/actions/providers/google-oauth/deleteCalendarEvent.js +5 -7
- package/dist/actions/providers/google-oauth/deleteGroupMember.js +5 -7
- package/dist/actions/providers/google-oauth/getGroup.js +5 -7
- package/dist/actions/providers/google-oauth/hasGroupMember.js +5 -7
- package/dist/actions/providers/google-oauth/listCalendarEvents.js +5 -7
- package/dist/actions/providers/google-oauth/listCalendars.js +5 -7
- package/dist/actions/providers/google-oauth/listGroupMembers.js +5 -7
- package/dist/actions/providers/google-oauth/listGroups.js +5 -7
- package/dist/actions/providers/google-oauth/scheduleCalendarMeeting.js +7 -9
- package/dist/actions/providers/google-oauth/searchDriveByKeywords.js +5 -7
- package/dist/actions/providers/google-oauth/updateCalendarEvent.js +5 -7
- package/dist/actions/providers/google-oauth/updateDoc.js +5 -10
- package/dist/actions/providers/google-oauth/updatePresentation.js +5 -7
- package/dist/actions/providers/google-oauth/updateSpreadsheet.js +5 -7
- package/dist/actions/providers/google-oauth/utils/decodeMessage.js +2 -6
- package/dist/actions/providers/googlemail/listGmailThreads.js +8 -10
- package/dist/actions/providers/googlemail/searchGmailMessages.js +8 -10
- package/dist/actions/providers/googlemaps/nearbysearchRestaurants.js +5 -7
- package/dist/actions/providers/googlemaps/validateAddress.js +3 -5
- package/dist/actions/providers/jamf/getJamfComputerInventory.js +3 -5
- package/dist/actions/providers/jamf/getJamfFileVaultRecoveryKey.js +3 -5
- package/dist/actions/providers/jira/assignJiraTicket.js +5 -10
- package/dist/actions/providers/jira/commentJiraTicket.js +3 -5
- package/dist/actions/providers/jira/createJiraTicket.js +6 -8
- package/dist/actions/providers/jira/getJiraIssuesByQuery.js +4 -6
- package/dist/actions/providers/jira/getJiraTicketDetails.js +3 -5
- package/dist/actions/providers/jira/getJiraTicketHistory.js +3 -5
- package/dist/actions/providers/jira/updateJiraTicketDetails.js +3 -5
- package/dist/actions/providers/jira/updateJiraTicketStatus.js +4 -6
- package/dist/actions/providers/jira/utils.js +3 -6
- package/dist/actions/providers/kandji/getFVRecoveryKeyForDevice.js +4 -6
- package/dist/actions/providers/linkedin/createSharePostLinkedinUrl.js +1 -3
- package/dist/actions/providers/looker/enableUserByEmail.js +5 -7
- package/dist/actions/providers/math/add.js +1 -3
- package/dist/actions/providers/microsoft/createDocument.js +5 -7
- package/dist/actions/providers/microsoft/getDocument.js +3 -5
- package/dist/actions/providers/microsoft/messageTeamsChannel.js +4 -6
- package/dist/actions/providers/microsoft/messageTeamsChat.js +4 -6
- package/dist/actions/providers/microsoft/updateDocument.js +4 -6
- package/dist/actions/providers/microsoft/updateSpreadsheet.js +4 -6
- package/dist/actions/providers/microsoft/utils.js +6 -10
- package/dist/actions/providers/mongodb/insertMongoDoc.js +3 -5
- package/dist/actions/providers/notion/searchByTitle.js +5 -10
- package/dist/actions/providers/nws/getForecastForLocation.js +7 -9
- package/dist/actions/providers/openstreetmap/getLatitudeLongitudeFromLocation.js +3 -5
- package/dist/actions/providers/resend/sendEmail.js +6 -8
- package/dist/actions/providers/salesforce/createCase.js +3 -5
- package/dist/actions/providers/salesforce/createRecord.js +4 -6
- package/dist/actions/providers/salesforce/fetchSalesforceSchema.js +3 -5
- package/dist/actions/providers/salesforce/generateSalesReport.js +3 -5
- package/dist/actions/providers/salesforce/getRecord.js +3 -5
- package/dist/actions/providers/salesforce/getSalesforceRecordsByQuery.js +4 -6
- package/dist/actions/providers/salesforce/updateRecord.js +3 -5
- package/dist/actions/providers/slack/getChannelMessages.js +7 -9
- package/dist/actions/providers/slack/helpers.js +1 -4
- package/dist/actions/providers/slack/sendMessage.js +10 -12
- package/dist/actions/providers/snowflake/auth/getSnowflakeConnection.js +4 -41
- package/dist/actions/providers/snowflake/getRowByFieldValue.js +3 -5
- package/dist/actions/providers/snowflake/runSnowflakeQuery.js +8 -13
- package/dist/actions/providers/x/createXSharePostUrl.js +1 -3
- package/dist/actions/providers/zendesk/addCommentToTicket.js +5 -7
- package/dist/actions/providers/zendesk/assignTicket.js +5 -7
- package/dist/actions/providers/zendesk/createZendeskTicket.js +5 -7
- package/dist/actions/providers/zendesk/getTicketDetails.js +5 -7
- package/dist/actions/providers/zendesk/listTickets.js +5 -7
- package/dist/actions/providers/zendesk/updateTicketStatus.js +5 -7
- package/dist/actions/util/axiosClient.js +4 -11
- package/dist/actions/util/formatDataForCodeInterpreter.js +1 -4
- package/dist/actions/util/missingAuthConstants.js +2 -5
- package/dist/app.js +5 -42
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -24
- package/dist/server.d.ts +2 -0
- package/dist/server.js +8 -0
- package/dist/utils/datetime.js +4 -8
- package/dist/utils/string.js +1 -4
- package/package.json +2 -1
- package/dist/actions/providers/credal/callCopilot.d.ts +0 -3
- package/dist/actions/providers/credal/callCopilot.js +0 -36
- package/dist/actions/providers/google-oauth/listGmailThreads.d.ts +0 -3
- package/dist/actions/providers/google-oauth/listGmailThreads.js +0 -98
- package/dist/actions/providers/google-oauth/searchGmailMessages.d.ts +0 -3
- package/dist/actions/providers/google-oauth/searchGmailMessages.js +0 -91
- package/dist/actions/providers/jamf/getComputerInventory.d.ts +0 -3
- package/dist/actions/providers/jamf/getComputerInventory.js +0 -45
- package/dist/actions/providers/jamf/getFileVaultRecoveryKey.d.ts +0 -3
- package/dist/actions/providers/jamf/getFileVaultRecoveryKey.js +0 -40
- package/dist/actions/providers/math/index.d.ts +0 -1
- package/dist/actions/providers/math/index.js +0 -37
- package/dist/actions/providers/slack/index.d.ts +0 -1
- package/dist/actions/providers/slack/index.js +0 -37
- package/dist/actions/providers/slack/listConversations.d.ts +0 -3
- 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
|
-
|
56
|
-
|
57
|
-
|
58
|
-
const
|
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:
|
62
|
-
firstName:
|
63
|
-
lastName:
|
64
|
-
title:
|
65
|
-
emailAddress:
|
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 =
|
34
|
+
const CallSchema = z
|
70
35
|
.object({
|
71
|
-
metaData:
|
72
|
-
id:
|
73
|
-
primaryUserId:
|
74
|
-
started:
|
75
|
-
isPrivate:
|
76
|
-
title:
|
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:
|
43
|
+
parties: z.array(z
|
79
44
|
.object({
|
80
|
-
id:
|
81
|
-
name:
|
82
|
-
userId:
|
83
|
-
emailAddress:
|
84
|
-
speakerId:
|
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:
|
89
|
-
trackers:
|
90
|
-
id:
|
91
|
-
name:
|
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 =
|
62
|
+
const SentenceSchema = z
|
98
63
|
.object({
|
99
|
-
start:
|
100
|
-
end:
|
101
|
-
text:
|
64
|
+
start: z.number(),
|
65
|
+
end: z.number(),
|
66
|
+
text: z.string(),
|
102
67
|
})
|
103
68
|
.partial()
|
104
69
|
.passthrough();
|
105
|
-
const TranscriptSchema =
|
70
|
+
const TranscriptSchema = z
|
106
71
|
.object({
|
107
|
-
callId:
|
108
|
-
transcript:
|
72
|
+
callId: z.string(),
|
73
|
+
transcript: z.array(z
|
109
74
|
.object({
|
110
|
-
speakerId:
|
111
|
-
topic:
|
112
|
-
sentences:
|
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 =
|
121
|
-
users:
|
122
|
-
calls:
|
123
|
-
callTranscripts:
|
124
|
-
cursor:
|
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
|
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
|
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 =
|
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
|
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 =
|
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:
|
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
|
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
|
-
|
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
|
-
|
12
|
-
|
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:
|
16
|
+
return { success: false, memberID: "", error: MISSING_AUTH_TOKEN };
|
19
17
|
}
|
20
18
|
try {
|
21
|
-
const response = yield
|
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
|
-
|
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
|
-
|
12
|
-
|
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(
|
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
|
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
|
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
|
-
|
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
|
-
|
12
|
-
|
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(
|
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
|
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
|
-
|
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
|
-
|
12
|
-
|
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(
|
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
|
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
|
-
|
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
|
-
|
12
|
-
|
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:
|
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
|
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
|
-
|
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
|
-
|
12
|
-
|
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:
|
16
|
+
return { success: false, error: MISSING_AUTH_TOKEN };
|
19
17
|
}
|
20
18
|
try {
|
21
|
-
yield
|
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
|
-
|
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
|
-
|
12
|
-
|
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:
|
16
|
+
return { success: false, group: { id: "", email: "", name: "" }, error: MISSING_AUTH_TOKEN };
|
19
17
|
}
|
20
18
|
try {
|
21
|
-
const response = yield
|
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
|
-
|
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
|
-
|
12
|
-
|
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:
|
16
|
+
return { success: false, isMember: false, error: MISSING_AUTH_TOKEN };
|
19
17
|
}
|
20
18
|
try {
|
21
|
-
const response = yield
|
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
|
-
|
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
|
-
|
12
|
-
|
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:
|
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
|
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
|
-
|
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
|
-
|
12
|
-
|
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:
|
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
|
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
|
-
|
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
|
-
|
12
|
-
|
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:
|
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
|
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
|
-
|
52
|
+
export default listGroupMembers;
|