@credal/actions 0.2.226 → 0.2.229
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 +8 -1
- package/dist/actions/autogen/templates.d.ts +1 -0
- package/dist/actions/autogen/templates.js +59 -7
- package/dist/actions/autogen/types.d.ts +27 -0
- package/dist/actions/autogen/types.js +43 -7
- package/dist/actions/providers/github/searchRepository.js +7 -7
- package/dist/actions/providers/google-oauth/scheduleCalendarMeeting.js +2 -2
- package/dist/actions/providers/zendesk/addCommentToTicket.js +5 -3
- package/dist/actions/providers/zendesk/assignTicket.js +4 -2
- package/dist/actions/providers/zendesk/createZendeskTicket.js +8 -6
- package/dist/actions/providers/zendesk/getTicketDetails.js +4 -2
- package/dist/actions/providers/zendesk/listTickets.js +6 -6
- package/dist/actions/providers/zendesk/searchZendeskByQuery.js +6 -6
- package/dist/actions/providers/zendesk/searchZendeskTicketsByQuery.d.ts +3 -0
- package/dist/actions/providers/zendesk/searchZendeskTicketsByQuery.js +37 -0
- package/dist/actions/providers/zendesk/updateTicketStatus.js +4 -2
- package/dist/actions/providers/zendesk/utils/getZendeskBaseUrl.d.ts +3 -0
- package/dist/actions/providers/zendesk/utils/getZendeskBaseUrl.js +7 -0
- package/dist/actions/providers/zendesk/utils/validateSubdomain.d.ts +1 -0
- package/dist/actions/providers/zendesk/utils/validateSubdomain.js +6 -0
- package/package.json +2 -3
- package/dist/actions/providers/ashby/addCandidateToProject.d.ts +0 -3
- package/dist/actions/providers/ashby/addCandidateToProject.js +0 -31
- package/dist/actions/providers/ashby/createCandidate.d.ts +0 -3
- package/dist/actions/providers/ashby/createCandidate.js +0 -38
- package/dist/actions/providers/ashby/createNote.d.ts +0 -3
- package/dist/actions/providers/ashby/createNote.js +0 -31
- package/dist/actions/providers/ashby/getCandidateInfo.d.ts +0 -3
- package/dist/actions/providers/ashby/getCandidateInfo.js +0 -33
- package/dist/actions/providers/ashby/listCandidateNotes.d.ts +0 -3
- package/dist/actions/providers/ashby/listCandidateNotes.js +0 -33
- package/dist/actions/providers/ashby/listCandidates.d.ts +0 -3
- package/dist/actions/providers/ashby/listCandidates.js +0 -30
- package/dist/actions/providers/ashby/searchCandidates.d.ts +0 -3
- package/dist/actions/providers/ashby/searchCandidates.js +0 -34
- package/dist/actions/providers/ashby/updateCandidate.d.ts +0 -3
- package/dist/actions/providers/ashby/updateCandidate.js +0 -56
- package/dist/actions/providers/gong/getGongTranscripts.d.ts +0 -3
- package/dist/actions/providers/gong/getGongTranscripts.js +0 -315
- package/dist/actions/providers/google-oauth/listFilesWithAssignedComments.d.ts +0 -3
- package/dist/actions/providers/google-oauth/listFilesWithAssignedComments.js +0 -41
- package/dist/actions/providers/jamf/getJamfComputerInventory.d.ts +0 -3
- package/dist/actions/providers/jamf/getJamfComputerInventory.js +0 -37
- package/dist/actions/providers/jamf/getJamfFileVaultRecoveryKey.d.ts +0 -3
- package/dist/actions/providers/jamf/getJamfFileVaultRecoveryKey.js +0 -39
- package/dist/actions/providers/jamf/getJamfUserComputerId.d.ts +0 -3
- package/dist/actions/providers/jamf/getJamfUserComputerId.js +0 -45
- package/dist/actions/providers/jamf/lockJamfComputerById.d.ts +0 -3
- package/dist/actions/providers/jamf/lockJamfComputerById.js +0 -39
- package/dist/actions/providers/jira/updateServiceDeskRequest.d.ts +0 -3
- package/dist/actions/providers/jira/updateServiceDeskRequest.js +0 -72
- package/dist/actions/providers/kandji/getFVRecoveryKeyForDevice.d.ts +0 -3
- package/dist/actions/providers/kandji/getFVRecoveryKeyForDevice.js +0 -85
- package/dist/actions/providers/microsoft/sendOutlookEmail.d.ts +0 -3
- package/dist/actions/providers/microsoft/sendOutlookEmail.js +0 -48
- package/dist/actions/providers/okta/addUserToGroup.d.ts +0 -3
- package/dist/actions/providers/okta/addUserToGroup.js +0 -56
- package/dist/actions/providers/okta/getOktaGroup.d.ts +0 -3
- package/dist/actions/providers/okta/getOktaGroup.js +0 -73
- package/dist/actions/providers/okta/getOktaUser.d.ts +0 -3
- package/dist/actions/providers/okta/getOktaUser.js +0 -40
- package/dist/actions/providers/okta/listMFA.d.ts +0 -3
- package/dist/actions/providers/okta/listMFA.js +0 -52
- package/dist/actions/providers/okta/listOktaGroupMembers.d.ts +0 -3
- package/dist/actions/providers/okta/listOktaGroupMembers.js +0 -99
- package/dist/actions/providers/okta/listOktaGroups.d.ts +0 -3
- package/dist/actions/providers/okta/listOktaGroups.js +0 -92
- package/dist/actions/providers/okta/listOktaUserGroups.d.ts +0 -3
- package/dist/actions/providers/okta/listOktaUserGroups.js +0 -83
- package/dist/actions/providers/okta/listOktaUsers.d.ts +0 -3
- package/dist/actions/providers/okta/listOktaUsers.js +0 -100
- package/dist/actions/providers/okta/removeUserFromGroup.d.ts +0 -3
- package/dist/actions/providers/okta/removeUserFromGroup.js +0 -56
- package/dist/actions/providers/okta/resetMFA.d.ts +0 -3
- package/dist/actions/providers/okta/resetMFA.js +0 -62
- package/dist/actions/providers/okta/resetPassword.d.ts +0 -3
- package/dist/actions/providers/okta/resetPassword.js +0 -57
- package/dist/actions/providers/okta/triggerOktaWorkflow.d.ts +0 -3
- package/dist/actions/providers/okta/triggerOktaWorkflow.js +0 -44
- package/dist/actions/providers/salesforce/fetchSalesforceSchema.d.ts +0 -3
- package/dist/actions/providers/salesforce/fetchSalesforceSchema.js +0 -40
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createAxiosClientWithRetries } from "../../util/axiosClient.js";
|
|
2
|
+
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
3
|
+
import { getZendeskBaseUrl } from "./utils/getZendeskBaseUrl.js";
|
|
4
|
+
const searchZendeskTicketsByQuery = async ({ params, authParams, }) => {
|
|
5
|
+
const { authToken } = authParams;
|
|
6
|
+
const { subdomain, query, limit = 100 } = params;
|
|
7
|
+
if (!authToken) {
|
|
8
|
+
throw new Error(MISSING_AUTH_TOKEN);
|
|
9
|
+
}
|
|
10
|
+
const zendeskBaseUrl = getZendeskBaseUrl({ subdomain });
|
|
11
|
+
const apiEndpoint = new URL("/api/v2/search.json", zendeskBaseUrl);
|
|
12
|
+
const axiosClient = createAxiosClientWithRetries({ timeout: 10000, retryCount: 4 });
|
|
13
|
+
// Strip any type: filters from the incoming query so it can't target other resource types,
|
|
14
|
+
// then force the search to tickets only
|
|
15
|
+
const sanitizedQuery = query
|
|
16
|
+
.replace(/\btype:\S+/gi, "")
|
|
17
|
+
.replace(/\s+/g, " ")
|
|
18
|
+
.trim();
|
|
19
|
+
apiEndpoint.searchParams.set("query", `type:ticket ${sanitizedQuery}`.trim());
|
|
20
|
+
apiEndpoint.searchParams.set("per_page", limit.toString());
|
|
21
|
+
const response = await axiosClient.get(apiEndpoint.toString(), {
|
|
22
|
+
headers: {
|
|
23
|
+
"Content-Type": "application/json",
|
|
24
|
+
Authorization: `Bearer ${authToken}`,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
// Defense in depth: only return results Zendesk marks as tickets
|
|
28
|
+
const results = Array.isArray(response.data.results)
|
|
29
|
+
? response.data.results.filter((result) => result.result_type === "ticket")
|
|
30
|
+
: [];
|
|
31
|
+
const count = typeof response.data.count === "number" ? response.data.count : results.length;
|
|
32
|
+
return {
|
|
33
|
+
results,
|
|
34
|
+
count,
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export default searchZendeskTicketsByQuery;
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { createAxiosClientWithRetries } from "../../util/axiosClient.js";
|
|
2
2
|
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
3
|
+
import { getZendeskBaseUrl } from "./utils/getZendeskBaseUrl.js";
|
|
3
4
|
const updateTicketStatus = async ({ params, authParams, }) => {
|
|
4
5
|
const { authToken } = authParams;
|
|
5
6
|
const { subdomain, ticketId, status } = params;
|
|
6
|
-
const url = `https://${subdomain}.zendesk.com/api/v2/tickets/${ticketId}.json`;
|
|
7
7
|
if (!authToken) {
|
|
8
8
|
throw new Error(MISSING_AUTH_TOKEN);
|
|
9
9
|
}
|
|
10
|
+
const zendeskBaseUrl = getZendeskBaseUrl({ subdomain });
|
|
11
|
+
const apiEndpoint = new URL(`/api/v2/tickets/${ticketId}.json`, zendeskBaseUrl);
|
|
10
12
|
const axiosClient = createAxiosClientWithRetries({ timeout: 10000, retryCount: 4 });
|
|
11
13
|
await axiosClient.request({
|
|
12
|
-
url:
|
|
14
|
+
url: apiEndpoint.toString(),
|
|
13
15
|
method: "PUT",
|
|
14
16
|
headers: {
|
|
15
17
|
"Content-Type": "application/json",
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const ZENDESK_SUBDOMAIN_PATTERN = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;
|
|
2
|
+
export const getZendeskBaseUrl = ({ subdomain }) => {
|
|
3
|
+
if (!ZENDESK_SUBDOMAIN_PATTERN.test(subdomain)) {
|
|
4
|
+
throw new Error("Invalid Zendesk subdomain");
|
|
5
|
+
}
|
|
6
|
+
return new URL(`https://${subdomain}.zendesk.com/`);
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const validateZendeskSubdomain: (subdomain: string) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@credal/actions",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.229",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "AI Actions by Credal AI",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -78,10 +78,9 @@
|
|
|
78
78
|
"p-limit": "^7.1.1",
|
|
79
79
|
"papaparse": "^5.5.3",
|
|
80
80
|
"resend": "^4.7.0",
|
|
81
|
-
"snowflake-sdk": "^2.
|
|
81
|
+
"snowflake-sdk": "^2.4.3",
|
|
82
82
|
"ts-node": "^10.9.2",
|
|
83
83
|
"unpdf": "^1.2.2",
|
|
84
|
-
"uuid": "^11.1.1",
|
|
85
84
|
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",
|
|
86
85
|
"zod": "^3.25.0"
|
|
87
86
|
},
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { axiosClient } from "../../util/axiosClient.js";
|
|
11
|
-
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
12
|
-
const addCandidateToProject = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
13
|
-
const { candidateId, projectId } = params;
|
|
14
|
-
const { authToken } = authParams;
|
|
15
|
-
if (!authToken) {
|
|
16
|
-
throw new Error(MISSING_AUTH_TOKEN);
|
|
17
|
-
}
|
|
18
|
-
const response = yield axiosClient.post(`https://api.ashbyhq.com/candidate.addProject`, {
|
|
19
|
-
candidateId,
|
|
20
|
-
projectId,
|
|
21
|
-
}, {
|
|
22
|
-
auth: {
|
|
23
|
-
username: authToken,
|
|
24
|
-
password: "",
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
if (!response.data.success) {
|
|
28
|
-
throw new Error(response.data.errors.join("; "));
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
export default addCandidateToProject;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { axiosClient } from "../../util/axiosClient.js";
|
|
11
|
-
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
12
|
-
const createCandidate = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
13
|
-
const { authToken } = authParams;
|
|
14
|
-
if (!authToken) {
|
|
15
|
-
throw new Error(MISSING_AUTH_TOKEN);
|
|
16
|
-
}
|
|
17
|
-
const response = yield axiosClient.post(`https://api.ashbyhq.com/candidate.create`, {
|
|
18
|
-
name: params.name,
|
|
19
|
-
email: params.email,
|
|
20
|
-
phoneNumber: params.phoneNumber,
|
|
21
|
-
linkedInUrl: params.linkedInUrl,
|
|
22
|
-
githubUrl: params.githubUrl,
|
|
23
|
-
website: params.website,
|
|
24
|
-
alternateEmailAddresses: params.alternateEmailAddresses,
|
|
25
|
-
sourceId: params.sourceId,
|
|
26
|
-
creditedToUserId: params.creditedToUserId,
|
|
27
|
-
location: params.location,
|
|
28
|
-
}, {
|
|
29
|
-
auth: {
|
|
30
|
-
username: authToken,
|
|
31
|
-
password: "",
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
if (!response.data.success) {
|
|
35
|
-
throw new Error(response.data.errors.join("; "));
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
export default createCandidate;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { axiosClient } from "../../util/axiosClient.js";
|
|
11
|
-
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
12
|
-
const createNote = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
13
|
-
const { candidateId, note } = params;
|
|
14
|
-
const { authToken } = authParams;
|
|
15
|
-
if (!authToken) {
|
|
16
|
-
throw new Error(MISSING_AUTH_TOKEN);
|
|
17
|
-
}
|
|
18
|
-
const response = yield axiosClient.post(`https://api.ashbyhq.com/candidate.createNote`, {
|
|
19
|
-
candidateId,
|
|
20
|
-
note,
|
|
21
|
-
}, {
|
|
22
|
-
auth: {
|
|
23
|
-
username: authToken,
|
|
24
|
-
password: "",
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
if (!response.data.success) {
|
|
28
|
-
throw new Error(response.data.errors.join("; "));
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
export default createNote;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { axiosClient } from "../../util/axiosClient.js";
|
|
11
|
-
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
12
|
-
const getCandidateInfo = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
13
|
-
const { candidateId } = params;
|
|
14
|
-
const { authToken } = authParams;
|
|
15
|
-
if (!authToken) {
|
|
16
|
-
throw new Error(MISSING_AUTH_TOKEN);
|
|
17
|
-
}
|
|
18
|
-
const response = yield axiosClient.post(`https://api.ashbyhq.com/candidate.info`, {
|
|
19
|
-
id: candidateId,
|
|
20
|
-
}, {
|
|
21
|
-
auth: {
|
|
22
|
-
username: authToken,
|
|
23
|
-
password: "",
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
if (!response.data.success) {
|
|
27
|
-
throw new Error(response.data.errors.join("; "));
|
|
28
|
-
}
|
|
29
|
-
return {
|
|
30
|
-
candidate: response.data,
|
|
31
|
-
};
|
|
32
|
-
});
|
|
33
|
-
export default getCandidateInfo;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { axiosClient } from "../../util/axiosClient.js";
|
|
11
|
-
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
12
|
-
const listCandidateNotes = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
13
|
-
const { candidateId } = params;
|
|
14
|
-
const { authToken } = authParams;
|
|
15
|
-
if (!authToken) {
|
|
16
|
-
throw new Error(MISSING_AUTH_TOKEN);
|
|
17
|
-
}
|
|
18
|
-
const response = yield axiosClient.post(`https://api.ashbyhq.com/candidate.listNotes`, {
|
|
19
|
-
candidateId,
|
|
20
|
-
}, {
|
|
21
|
-
auth: {
|
|
22
|
-
username: authToken,
|
|
23
|
-
password: "",
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
if (!response.data.success) {
|
|
27
|
-
throw new Error(response.data.errors.join("; "));
|
|
28
|
-
}
|
|
29
|
-
return {
|
|
30
|
-
notes: response.data.results,
|
|
31
|
-
};
|
|
32
|
-
});
|
|
33
|
-
export default listCandidateNotes;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { axiosClient } from "../../util/axiosClient.js";
|
|
11
|
-
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
12
|
-
const listCandidates = (_a) => __awaiter(void 0, [_a], void 0, function* ({ authParams, }) {
|
|
13
|
-
const { authToken } = authParams;
|
|
14
|
-
if (!authToken) {
|
|
15
|
-
throw new Error(MISSING_AUTH_TOKEN);
|
|
16
|
-
}
|
|
17
|
-
const response = yield axiosClient.post(`https://api.ashbyhq.com/candidate.list`, null, {
|
|
18
|
-
auth: {
|
|
19
|
-
username: authToken,
|
|
20
|
-
password: "",
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
if (!response.data.success) {
|
|
24
|
-
throw new Error(response.data.errors.join("; "));
|
|
25
|
-
}
|
|
26
|
-
return {
|
|
27
|
-
candidates: response.data.results,
|
|
28
|
-
};
|
|
29
|
-
});
|
|
30
|
-
export default listCandidates;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { axiosClient } from "../../util/axiosClient.js";
|
|
11
|
-
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
12
|
-
const searchCandidates = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
13
|
-
const { email, name } = params;
|
|
14
|
-
const { authToken } = authParams;
|
|
15
|
-
if (!authToken) {
|
|
16
|
-
throw new Error(MISSING_AUTH_TOKEN);
|
|
17
|
-
}
|
|
18
|
-
const response = yield axiosClient.post(`https://api.ashbyhq.com/candidate.search`, {
|
|
19
|
-
email,
|
|
20
|
-
name,
|
|
21
|
-
}, {
|
|
22
|
-
auth: {
|
|
23
|
-
username: authToken,
|
|
24
|
-
password: "",
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
if (!response.data.success) {
|
|
28
|
-
throw new Error(response.data.errors.join("; "));
|
|
29
|
-
}
|
|
30
|
-
return {
|
|
31
|
-
candidates: response.data.results,
|
|
32
|
-
};
|
|
33
|
-
});
|
|
34
|
-
export default searchCandidates;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { axiosClient } from "../../util/axiosClient.js";
|
|
11
|
-
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
12
|
-
const updateCandidate = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
|
13
|
-
const { authToken } = authParams;
|
|
14
|
-
if (!authToken) {
|
|
15
|
-
throw new Error(MISSING_AUTH_TOKEN);
|
|
16
|
-
}
|
|
17
|
-
const body = {
|
|
18
|
-
candidateId: params.candidateId,
|
|
19
|
-
};
|
|
20
|
-
if (params.name !== undefined)
|
|
21
|
-
body.name = params.name;
|
|
22
|
-
if (params.email !== undefined)
|
|
23
|
-
body.email = params.email;
|
|
24
|
-
if (params.phoneNumber !== undefined)
|
|
25
|
-
body.phoneNumber = params.phoneNumber;
|
|
26
|
-
if (params.linkedInUrl !== undefined)
|
|
27
|
-
body.linkedInUrl = params.linkedInUrl;
|
|
28
|
-
if (params.githubUrl !== undefined)
|
|
29
|
-
body.githubUrl = params.githubUrl;
|
|
30
|
-
if (params.websiteUrl !== undefined)
|
|
31
|
-
body.websiteUrl = params.websiteUrl;
|
|
32
|
-
if (params.alternateEmail !== undefined)
|
|
33
|
-
body.alternateEmail = params.alternateEmail;
|
|
34
|
-
if (params.socialLinks !== undefined)
|
|
35
|
-
body.socialLinks = params.socialLinks;
|
|
36
|
-
if (params.sourceId !== undefined)
|
|
37
|
-
body.sourceId = params.sourceId;
|
|
38
|
-
if (params.creditedToUserId !== undefined)
|
|
39
|
-
body.creditedToUserId = params.creditedToUserId;
|
|
40
|
-
if (params.location !== undefined)
|
|
41
|
-
body.location = params.location;
|
|
42
|
-
if (params.createdAt !== undefined)
|
|
43
|
-
body.createdAt = params.createdAt;
|
|
44
|
-
if (params.sendNotifications !== undefined)
|
|
45
|
-
body.sendNotifications = params.sendNotifications;
|
|
46
|
-
const response = yield axiosClient.post(`https://api.ashbyhq.com/candidate.update`, body, {
|
|
47
|
-
auth: {
|
|
48
|
-
username: authToken,
|
|
49
|
-
password: "",
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
if (!response.data.success) {
|
|
53
|
-
throw new Error(response.data.errors.join("; "));
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
export default updateCandidate;
|