@credal/actions 0.2.2 → 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.
- 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.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,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,68 +7,64 @@ 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
|
-
|
15
|
-
const zod_1 = require("zod");
|
16
|
-
const axios_1 = __importDefault(require("axios"));
|
17
|
-
const missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
18
|
-
const TaskSchema = zod_1.z
|
10
|
+
import { z } from "zod";
|
11
|
+
import axios from "axios";
|
12
|
+
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
|
13
|
+
const TaskSchema = z
|
19
14
|
.object({
|
20
|
-
gid:
|
15
|
+
gid: z.string(),
|
21
16
|
})
|
22
17
|
.partial()
|
23
18
|
.passthrough();
|
24
|
-
const TaskDetailsSchema =
|
19
|
+
const TaskDetailsSchema = z
|
25
20
|
.object({
|
26
|
-
name:
|
27
|
-
resource_type:
|
28
|
-
completed:
|
29
|
-
modified_at:
|
30
|
-
notes:
|
31
|
-
custom_fields:
|
32
|
-
.array(
|
33
|
-
gid:
|
34
|
-
name:
|
35
|
-
display_value:
|
21
|
+
name: z.string(),
|
22
|
+
resource_type: z.string(),
|
23
|
+
completed: z.boolean(),
|
24
|
+
modified_at: z.string(),
|
25
|
+
notes: z.string(),
|
26
|
+
custom_fields: z
|
27
|
+
.array(z.object({
|
28
|
+
gid: z.string(),
|
29
|
+
name: z.string(),
|
30
|
+
display_value: z.string().nullable(),
|
36
31
|
}))
|
37
32
|
.nullable(),
|
38
|
-
num_subtasks:
|
33
|
+
num_subtasks: z.number(),
|
39
34
|
})
|
40
35
|
.partial()
|
41
36
|
.passthrough();
|
42
|
-
const TaskStorySchema =
|
37
|
+
const TaskStorySchema = z
|
43
38
|
.object({
|
44
|
-
gid:
|
45
|
-
created_at:
|
46
|
-
text:
|
47
|
-
resource_type:
|
48
|
-
created_by:
|
49
|
-
gid:
|
50
|
-
name:
|
51
|
-
resource_type:
|
39
|
+
gid: z.string(),
|
40
|
+
created_at: z.string(),
|
41
|
+
text: z.string(),
|
42
|
+
resource_type: z.string(),
|
43
|
+
created_by: z.object({
|
44
|
+
gid: z.string(),
|
45
|
+
name: z.string(),
|
46
|
+
resource_type: z.string(),
|
52
47
|
}),
|
53
48
|
})
|
54
49
|
.partial()
|
55
50
|
.passthrough();
|
56
|
-
const NextPageSchema =
|
51
|
+
const NextPageSchema = z
|
57
52
|
.object({
|
58
|
-
offset:
|
59
|
-
path:
|
60
|
-
uri:
|
53
|
+
offset: z.string(),
|
54
|
+
path: z.string(),
|
55
|
+
uri: z.string(),
|
61
56
|
})
|
62
57
|
.nullable();
|
63
|
-
const TaskOutputSchema =
|
58
|
+
const TaskOutputSchema = z.object({
|
64
59
|
task: TaskDetailsSchema,
|
65
|
-
subtasks:
|
66
|
-
taskStories:
|
60
|
+
subtasks: z.array(TaskDetailsSchema).nullable(),
|
61
|
+
taskStories: z.array(TaskStorySchema).nullable(),
|
67
62
|
});
|
68
63
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
69
|
-
const AsanaOutputSchema =
|
70
|
-
data:
|
71
|
-
tasks:
|
72
|
-
subtasks:
|
64
|
+
const AsanaOutputSchema = z.object({
|
65
|
+
data: z.object({
|
66
|
+
tasks: z.array(TaskOutputSchema),
|
67
|
+
subtasks: z.array(TaskDetailsSchema).nullable(),
|
73
68
|
}),
|
74
69
|
next_page: NextPageSchema,
|
75
70
|
});
|
@@ -78,7 +73,7 @@ function getTaskIdsFromProject(authToken, projectId) {
|
|
78
73
|
let nextPage = undefined;
|
79
74
|
const tasks = [];
|
80
75
|
do {
|
81
|
-
const response = yield
|
76
|
+
const response = yield axios.get(`https://app.asana.com/api/1.0/projects/${projectId}/tasks`, {
|
82
77
|
headers: { Authorization: `Bearer ${authToken}` },
|
83
78
|
params: {
|
84
79
|
limit: 100,
|
@@ -86,7 +81,7 @@ function getTaskIdsFromProject(authToken, projectId) {
|
|
86
81
|
offset: nextPage ? nextPage.offset : undefined,
|
87
82
|
},
|
88
83
|
});
|
89
|
-
const parsedTasks =
|
84
|
+
const parsedTasks = z.array(TaskSchema).safeParse(response.data.data);
|
90
85
|
if (!parsedTasks.success) {
|
91
86
|
return tasks;
|
92
87
|
}
|
@@ -102,14 +97,14 @@ function getSubtasksFromTask(authToken, taskId) {
|
|
102
97
|
let nextPage = undefined;
|
103
98
|
const subtasks = [];
|
104
99
|
do {
|
105
|
-
const response = yield
|
100
|
+
const response = yield axios.get(`https://app.asana.com/api/1.0/tasks/${taskId}/subtasks`, {
|
106
101
|
headers: { Authorization: `Bearer ${authToken}` },
|
107
102
|
params: {
|
108
103
|
limit: 100,
|
109
104
|
offset: nextPage ? nextPage.offset : undefined,
|
110
105
|
},
|
111
106
|
});
|
112
|
-
const parsedSubtasks =
|
107
|
+
const parsedSubtasks = z.array(TaskSchema).safeParse(response.data.data);
|
113
108
|
if (!parsedSubtasks.success) {
|
114
109
|
return subtasks;
|
115
110
|
}
|
@@ -121,7 +116,7 @@ function getSubtasksFromTask(authToken, taskId) {
|
|
121
116
|
}
|
122
117
|
function getTaskDetails(authToken, taskId) {
|
123
118
|
return __awaiter(this, void 0, void 0, function* () {
|
124
|
-
const response = yield
|
119
|
+
const response = yield axios.get(`https://app.asana.com/api/1.0/tasks/${taskId}`, {
|
125
120
|
headers: { Authorization: `Bearer ${authToken}` },
|
126
121
|
params: {
|
127
122
|
options: {
|
@@ -138,10 +133,10 @@ function getTaskDetails(authToken, taskId) {
|
|
138
133
|
}
|
139
134
|
function getTaskStories(authToken, taskId) {
|
140
135
|
return __awaiter(this, void 0, void 0, function* () {
|
141
|
-
const response = yield
|
136
|
+
const response = yield axios.get(`https://app.asana.com/api/1.0/tasks/${taskId}/stories`, {
|
142
137
|
headers: { Authorization: `Bearer ${authToken}` },
|
143
138
|
});
|
144
|
-
const parsedTask =
|
139
|
+
const parsedTask = z.array(TaskStorySchema).safeParse(response.data.data);
|
145
140
|
if (!parsedTask.success) {
|
146
141
|
return null;
|
147
142
|
}
|
@@ -152,7 +147,7 @@ const listAsanaTasksByProject = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
152
147
|
const { authToken } = authParams;
|
153
148
|
const { projectId } = params;
|
154
149
|
if (!authToken) {
|
155
|
-
return { success: false, error:
|
150
|
+
return { success: false, error: MISSING_AUTH_TOKEN };
|
156
151
|
}
|
157
152
|
try {
|
158
153
|
const taskIds = yield getTaskIdsFromProject(authToken, projectId);
|
@@ -183,4 +178,4 @@ const listAsanaTasksByProject = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
183
178
|
};
|
184
179
|
}
|
185
180
|
});
|
186
|
-
|
181
|
+
export default listAsanaTasksByProject;
|
@@ -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,19 +7,18 @@ 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 searchAsanaTasks = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
15
13
|
var _b, _c;
|
16
14
|
const { authToken } = authParams;
|
17
15
|
const { query } = params;
|
18
16
|
if (!authToken) {
|
19
|
-
return { success: false, error:
|
17
|
+
return { success: false, error: MISSING_AUTH_TOKEN };
|
20
18
|
}
|
21
19
|
try {
|
22
20
|
// search api only searches within a workspace, so fetch all workspaces first
|
23
|
-
const workspacesResponse = yield
|
21
|
+
const workspacesResponse = yield axiosClient.get("https://app.asana.com/api/1.0/workspaces", {
|
24
22
|
headers: { Authorization: `Bearer ${authToken}` },
|
25
23
|
});
|
26
24
|
const workspaces = (_b = workspacesResponse === null || workspacesResponse === void 0 ? void 0 : workspacesResponse.data) === null || _b === void 0 ? void 0 : _b.data;
|
@@ -31,7 +29,7 @@ const searchAsanaTasks = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
31
29
|
for (const workspace of workspaces) {
|
32
30
|
const workspaceId = workspace.gid;
|
33
31
|
try {
|
34
|
-
const searchResponse = yield
|
32
|
+
const searchResponse = yield axiosClient.get(`https://app.asana.com/api/1.0/workspaces/${workspaceId}/tasks/search`, {
|
35
33
|
headers: { Authorization: `Bearer ${authToken}` },
|
36
34
|
params: {
|
37
35
|
text: query,
|
@@ -64,4 +62,4 @@ const searchAsanaTasks = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
64
62
|
};
|
65
63
|
}
|
66
64
|
});
|
67
|
-
|
65
|
+
export default searchAsanaTasks;
|
@@ -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,29 +7,28 @@ 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
|
-
const utils_1 = require("./utils");
|
10
|
+
import { axiosClient } from "../../util/axiosClient";
|
11
|
+
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
|
12
|
+
import { getUserIdByEmail, getWorkspaceIdAndPermalinkFromTask } from "./utils";
|
15
13
|
const updateAsanaTask = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
16
14
|
const { authToken } = authParams;
|
17
15
|
const { name, taskId, description, customFields, completed, assignee, approvalStatus, dueAt } = params;
|
18
16
|
if (!authToken) {
|
19
|
-
return { success: false, error:
|
17
|
+
return { success: false, error: MISSING_AUTH_TOKEN };
|
20
18
|
}
|
21
|
-
const { workspaceId, permalinkUrl } = yield
|
19
|
+
const { workspaceId, permalinkUrl } = yield getWorkspaceIdAndPermalinkFromTask(taskId, authToken);
|
22
20
|
if (!workspaceId || !permalinkUrl) {
|
23
21
|
return { success: false, error: "Task ID invalid: unable to get workspaceID or permalink" };
|
24
22
|
}
|
25
23
|
let assigneeId;
|
26
24
|
if (assignee && assignee.includes("@")) {
|
27
|
-
assigneeId = yield
|
25
|
+
assigneeId = yield getUserIdByEmail(authToken, workspaceId, assignee);
|
28
26
|
}
|
29
27
|
else {
|
30
28
|
assigneeId = assignee;
|
31
29
|
}
|
32
30
|
try {
|
33
|
-
yield
|
31
|
+
yield axiosClient.put(`https://app.asana.com/api/1.0/tasks/${taskId}`, {
|
34
32
|
data: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ workspace: workspaceId }, (name && { name })), (approvalStatus && completed === undefined && { approval_status: approvalStatus })), (assigneeId && { assignee: assigneeId })), (completed !== undefined && { completed })), (customFields && { custom_fields: customFields })), (description && { notes: description })), (dueAt && { due_at: dueAt })),
|
35
33
|
}, {
|
36
34
|
headers: { Authorization: `Bearer ${authToken}` },
|
@@ -48,4 +46,4 @@ const updateAsanaTask = (_a) => __awaiter(void 0, [_a], void 0, function* ({ par
|
|
48
46
|
};
|
49
47
|
}
|
50
48
|
});
|
51
|
-
|
49
|
+
export default updateAsanaTask;
|
@@ -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,8 @@ 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
|
-
exports.getWorkspaceIdAndPermalinkFromTask = getWorkspaceIdAndPermalinkFromTask;
|
14
|
-
exports.getUserIdByEmail = getUserIdByEmail;
|
15
|
-
const axiosClient_1 = require("../../util/axiosClient");
|
16
|
-
function getWorkspaceIdFromProject(projectId, authToken) {
|
10
|
+
import { axiosClient } from "../../util/axiosClient";
|
11
|
+
export function getWorkspaceIdFromProject(projectId, authToken) {
|
17
12
|
return __awaiter(this, void 0, void 0, function* () {
|
18
13
|
var _a, _b, _c;
|
19
14
|
if (!projectId || !authToken) {
|
@@ -21,7 +16,7 @@ function getWorkspaceIdFromProject(projectId, authToken) {
|
|
21
16
|
return null;
|
22
17
|
}
|
23
18
|
try {
|
24
|
-
const response = yield
|
19
|
+
const response = yield axiosClient.get(`https://app.asana.com/api/1.0/projects/${projectId}`, {
|
25
20
|
headers: { Authorization: `Bearer ${authToken}` },
|
26
21
|
});
|
27
22
|
return ((_c = (_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.workspace) === null || _c === void 0 ? void 0 : _c.gid) || null;
|
@@ -32,7 +27,7 @@ function getWorkspaceIdFromProject(projectId, authToken) {
|
|
32
27
|
}
|
33
28
|
});
|
34
29
|
}
|
35
|
-
function getWorkspaceIdAndPermalinkFromTask(taskId, authToken) {
|
30
|
+
export function getWorkspaceIdAndPermalinkFromTask(taskId, authToken) {
|
36
31
|
return __awaiter(this, void 0, void 0, function* () {
|
37
32
|
var _a, _b, _c, _d, _e;
|
38
33
|
if (!taskId || !authToken) {
|
@@ -40,7 +35,7 @@ function getWorkspaceIdAndPermalinkFromTask(taskId, authToken) {
|
|
40
35
|
return { workspaceId: null, permalinkUrl: null };
|
41
36
|
}
|
42
37
|
try {
|
43
|
-
const response = yield
|
38
|
+
const response = yield axiosClient.get(`https://app.asana.com/api/1.0/tasks/${taskId}`, {
|
44
39
|
headers: { Authorization: `Bearer ${authToken}` },
|
45
40
|
});
|
46
41
|
const workspaceId = ((_c = (_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.workspace) === null || _c === void 0 ? void 0 : _c.gid) || null;
|
@@ -53,12 +48,12 @@ function getWorkspaceIdAndPermalinkFromTask(taskId, authToken) {
|
|
53
48
|
}
|
54
49
|
});
|
55
50
|
}
|
56
|
-
function getUserIdByEmail(authToken, workspaceId, email) {
|
51
|
+
export function getUserIdByEmail(authToken, workspaceId, email) {
|
57
52
|
return __awaiter(this, void 0, void 0, function* () {
|
58
53
|
// Get all users in the workspace
|
59
54
|
const url = `https://app.asana.com/api/1.0/workspaces/${workspaceId}/users?opt_fields=email,name,gid`;
|
60
55
|
try {
|
61
|
-
const response = yield
|
56
|
+
const response = yield axiosClient.get(url, {
|
62
57
|
headers: { Authorization: `Bearer ${authToken}` },
|
63
58
|
});
|
64
59
|
// Filter the users by email on the client side
|
@@ -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,16 +7,15 @@ 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 addCandidateToProject = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
15
13
|
const { candidateId, projectId } = params;
|
16
14
|
const { authToken } = authParams;
|
17
15
|
if (!authToken) {
|
18
|
-
throw new Error(
|
16
|
+
throw new Error(MISSING_AUTH_TOKEN);
|
19
17
|
}
|
20
|
-
const response = yield
|
18
|
+
const response = yield axiosClient.post(`https://api.ashbyhq.com/candidate.addProject`, {
|
21
19
|
candidateId,
|
22
20
|
projectId,
|
23
21
|
}, {
|
@@ -30,4 +28,4 @@ const addCandidateToProject = (_a) => __awaiter(void 0, [_a], void 0, function*
|
|
30
28
|
throw new Error(response.data.errors.join("; "));
|
31
29
|
}
|
32
30
|
});
|
33
|
-
|
31
|
+
export default addCandidateToProject;
|
@@ -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,15 +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
|
-
const missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
10
|
+
import { axiosClient } from "../../util/axiosClient";
|
11
|
+
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
|
14
12
|
const createCandidate = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
15
13
|
const { authToken } = authParams;
|
16
14
|
if (!authToken) {
|
17
|
-
throw new Error(
|
15
|
+
throw new Error(MISSING_AUTH_TOKEN);
|
18
16
|
}
|
19
|
-
const response = yield
|
17
|
+
const response = yield axiosClient.post(`https://api.ashbyhq.com/candidate.create`, {
|
20
18
|
name: params.name,
|
21
19
|
email: params.email,
|
22
20
|
phoneNumber: params.phoneNumber,
|
@@ -37,4 +35,4 @@ const createCandidate = (_a) => __awaiter(void 0, [_a], void 0, function* ({ par
|
|
37
35
|
throw new Error(response.data.errors.join("; "));
|
38
36
|
}
|
39
37
|
});
|
40
|
-
|
38
|
+
export default createCandidate;
|
@@ -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,16 +7,15 @@ 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 createNote = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
15
13
|
const { candidateId, note } = params;
|
16
14
|
const { authToken } = authParams;
|
17
15
|
if (!authToken) {
|
18
|
-
throw new Error(
|
16
|
+
throw new Error(MISSING_AUTH_TOKEN);
|
19
17
|
}
|
20
|
-
const response = yield
|
18
|
+
const response = yield axiosClient.post(`https://api.ashbyhq.com/candidate.createNote`, {
|
21
19
|
candidateId,
|
22
20
|
note,
|
23
21
|
}, {
|
@@ -30,4 +28,4 @@ const createNote = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
|
|
30
28
|
throw new Error(response.data.errors.join("; "));
|
31
29
|
}
|
32
30
|
});
|
33
|
-
|
31
|
+
export default createNote;
|
@@ -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,16 +7,15 @@ 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 getCandidateInfo = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
15
13
|
const { candidateId } = params;
|
16
14
|
const { authToken } = authParams;
|
17
15
|
if (!authToken) {
|
18
|
-
throw new Error(
|
16
|
+
throw new Error(MISSING_AUTH_TOKEN);
|
19
17
|
}
|
20
|
-
const response = yield
|
18
|
+
const response = yield axiosClient.post(`https://api.ashbyhq.com/candidate.info`, {
|
21
19
|
id: candidateId,
|
22
20
|
}, {
|
23
21
|
auth: {
|
@@ -32,4 +30,4 @@ const getCandidateInfo = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
32
30
|
candidate: response.data,
|
33
31
|
};
|
34
32
|
});
|
35
|
-
|
33
|
+
export default getCandidateInfo;
|
@@ -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,16 +7,15 @@ 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 listCandidateNotes = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
15
13
|
const { candidateId } = params;
|
16
14
|
const { authToken } = authParams;
|
17
15
|
if (!authToken) {
|
18
|
-
throw new Error(
|
16
|
+
throw new Error(MISSING_AUTH_TOKEN);
|
19
17
|
}
|
20
|
-
const response = yield
|
18
|
+
const response = yield axiosClient.post(`https://api.ashbyhq.com/candidate.listNotes`, {
|
21
19
|
candidateId,
|
22
20
|
}, {
|
23
21
|
auth: {
|
@@ -32,4 +30,4 @@ const listCandidateNotes = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
32
30
|
notes: response.data.results,
|
33
31
|
};
|
34
32
|
});
|
35
|
-
|
33
|
+
export default listCandidateNotes;
|
@@ -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,15 +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
|
-
const missingAuthConstants_1 = require("../../util/missingAuthConstants");
|
10
|
+
import { axiosClient } from "../../util/axiosClient";
|
11
|
+
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants";
|
14
12
|
const listCandidates = (_a) => __awaiter(void 0, [_a], void 0, function* ({ authParams, }) {
|
15
13
|
const { authToken } = authParams;
|
16
14
|
if (!authToken) {
|
17
|
-
throw new Error(
|
15
|
+
throw new Error(MISSING_AUTH_TOKEN);
|
18
16
|
}
|
19
|
-
const response = yield
|
17
|
+
const response = yield axiosClient.post(`https://api.ashbyhq.com/candidate.list`, null, {
|
20
18
|
auth: {
|
21
19
|
username: authToken,
|
22
20
|
password: "",
|
@@ -29,4 +27,4 @@ const listCandidates = (_a) => __awaiter(void 0, [_a], void 0, function* ({ auth
|
|
29
27
|
candidates: response.data.results,
|
30
28
|
};
|
31
29
|
});
|
32
|
-
|
30
|
+
export default listCandidates;
|
@@ -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,16 +7,15 @@ 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 searchCandidates = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
15
13
|
const { email, name } = params;
|
16
14
|
const { authToken } = authParams;
|
17
15
|
if (!authToken) {
|
18
|
-
throw new Error(
|
16
|
+
throw new Error(MISSING_AUTH_TOKEN);
|
19
17
|
}
|
20
|
-
const response = yield
|
18
|
+
const response = yield axiosClient.post(`https://api.ashbyhq.com/candidate.search`, {
|
21
19
|
email,
|
22
20
|
name,
|
23
21
|
}, {
|
@@ -33,4 +31,4 @@ const searchCandidates = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
33
31
|
candidates: response.data.results,
|
34
32
|
};
|
35
33
|
});
|
36
|
-
|
34
|
+
export default searchCandidates;
|
@@ -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 updateCandidate = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
15
13
|
const { authToken } = authParams;
|
16
14
|
if (!authToken) {
|
17
|
-
throw new Error(
|
15
|
+
throw new Error(MISSING_AUTH_TOKEN);
|
18
16
|
}
|
19
17
|
const body = {
|
20
18
|
candidateId: params.candidateId,
|
@@ -45,7 +43,7 @@ const updateCandidate = (_a) => __awaiter(void 0, [_a], void 0, function* ({ par
|
|
45
43
|
body.createdAt = params.createdAt;
|
46
44
|
if (params.sendNotifications !== undefined)
|
47
45
|
body.sendNotifications = params.sendNotifications;
|
48
|
-
const response = yield
|
46
|
+
const response = yield axiosClient.post(`https://api.ashbyhq.com/candidate.update`, body, {
|
49
47
|
auth: {
|
50
48
|
username: authToken,
|
51
49
|
password: "",
|
@@ -55,4 +53,4 @@ const updateCandidate = (_a) => __awaiter(void 0, [_a], void 0, function* ({ par
|
|
55
53
|
throw new Error(response.data.errors.join("; "));
|
56
54
|
}
|
57
55
|
});
|
58
|
-
|
56
|
+
export default updateCandidate;
|
@@ -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,9 +7,8 @@ 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 axiosClient_1 = require("../../util/axiosClient");
|
10
|
+
import { bingGetTopNSearchResultUrlsOutputSchema, } from "../../autogen/types";
|
11
|
+
import { axiosClient } from "../../util/axiosClient";
|
14
12
|
const getTopNSearchResultUrls = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
15
13
|
var _b;
|
16
14
|
const { query, count = 5, site } = params;
|
@@ -23,7 +21,7 @@ const getTopNSearchResultUrls = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
23
21
|
}
|
24
22
|
try {
|
25
23
|
// Call Bing Search API
|
26
|
-
const response = yield
|
24
|
+
const response = yield axiosClient.get("https://api.bing.microsoft.com/v7.0/search", {
|
27
25
|
params: {
|
28
26
|
q: searchQuery,
|
29
27
|
count: count,
|
@@ -36,7 +34,7 @@ const getTopNSearchResultUrls = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
36
34
|
});
|
37
35
|
// Extract URLs and names from search results
|
38
36
|
const searchResults = ((_b = response.data.webPages) === null || _b === void 0 ? void 0 : _b.value) || [];
|
39
|
-
return
|
37
|
+
return bingGetTopNSearchResultUrlsOutputSchema.parse({
|
40
38
|
results: searchResults,
|
41
39
|
});
|
42
40
|
}
|
@@ -45,4 +43,4 @@ const getTopNSearchResultUrls = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
45
43
|
throw error;
|
46
44
|
}
|
47
45
|
});
|
48
|
-
|
46
|
+
export default getTopNSearchResultUrls;
|