@credal/actions 0.2.219 → 0.2.221
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 +38 -1
- package/dist/actions/autogen/templates.d.ts +5 -0
- package/dist/actions/autogen/templates.js +311 -0
- package/dist/actions/autogen/types.d.ts +282 -1
- package/dist/actions/autogen/types.js +110 -0
- package/dist/actions/providers/confluenceDataCenter/createPage.d.ts +3 -0
- package/dist/actions/providers/confluenceDataCenter/createPage.js +40 -0
- package/dist/actions/providers/github/searchRepository.js +7 -7
- package/dist/actions/providers/jira/getJiraDCIssuesByQuery.js +3 -1
- package/dist/actions/providers/jira/getJiraIssuesByQuery.js +3 -1
- package/dist/actions/providers/smartsheet/addRowToSheet.d.ts +3 -0
- package/dist/actions/providers/smartsheet/addRowToSheet.js +34 -0
- package/dist/actions/providers/smartsheet/getSheetRows.d.ts +3 -0
- package/dist/actions/providers/smartsheet/getSheetRows.js +48 -0
- package/dist/actions/providers/smartsheet/listSheets.d.ts +3 -0
- package/dist/actions/providers/smartsheet/listSheets.js +26 -0
- package/dist/actions/providers/smartsheet/updateRow.d.ts +3 -0
- package/dist/actions/providers/smartsheet/updateRow.js +34 -0
- package/dist/actions/providers/smartsheet/utils.d.ts +33 -0
- package/dist/actions/providers/smartsheet/utils.js +45 -0
- package/package.json +2 -2
- 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
|
@@ -47,7 +47,7 @@ const searchRepository = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
|
47
47
|
name: item.name,
|
|
48
48
|
path: item.path,
|
|
49
49
|
sha: item.sha.slice(0, 7),
|
|
50
|
-
url: item.
|
|
50
|
+
url: item.html_url,
|
|
51
51
|
score: item.score,
|
|
52
52
|
textMatches: item.text_matches
|
|
53
53
|
? item.text_matches.map(match => {
|
|
@@ -68,7 +68,7 @@ const searchRepository = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
|
68
68
|
const full = commitDetails.find(c => c.data.sha === item.sha);
|
|
69
69
|
return {
|
|
70
70
|
sha: item.sha,
|
|
71
|
-
url: item.
|
|
71
|
+
url: item.html_url,
|
|
72
72
|
commit: {
|
|
73
73
|
message: item.commit.message,
|
|
74
74
|
author: item.commit.author,
|
|
@@ -76,11 +76,11 @@ const searchRepository = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
|
76
76
|
score: item.score,
|
|
77
77
|
author: (_a = item.author) !== null && _a !== void 0 ? _a : undefined,
|
|
78
78
|
files: ((_b = full === null || full === void 0 ? void 0 : full.data.files) === null || _b === void 0 ? void 0 : _b.slice(0, MAX_FILES_PER_COMMIT).map(f => {
|
|
79
|
-
var _a;
|
|
79
|
+
var _a, _b, _c;
|
|
80
80
|
return ({
|
|
81
81
|
filename: f.filename,
|
|
82
82
|
status: f.status,
|
|
83
|
-
patch: (_a = f.patch) === null || _a === void 0 ? void 0 : _a.split("\n").slice(0, MAX_PATCH_LINES).join("\n"),
|
|
83
|
+
patch: (_c = (_b = (_a = f.patch) === null || _a === void 0 ? void 0 : _a.split("\n")) === null || _b === void 0 ? void 0 : _b.slice(0, MAX_PATCH_LINES)) === null || _c === void 0 ? void 0 : _c.join("\n"),
|
|
84
84
|
});
|
|
85
85
|
})) || [],
|
|
86
86
|
};
|
|
@@ -104,18 +104,18 @@ const searchRepository = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
|
104
104
|
const prIndex = prNumbers.indexOf(item.number);
|
|
105
105
|
const files = isPR && prIndex !== -1
|
|
106
106
|
? prFiles[prIndex].data.slice(0, MAX_FILES_PER_PR).map(f => {
|
|
107
|
-
var _a;
|
|
107
|
+
var _a, _b, _c;
|
|
108
108
|
return ({
|
|
109
109
|
filename: f.filename,
|
|
110
110
|
status: f.status,
|
|
111
|
-
patch: (_a = f.patch) === null || _a === void 0 ? void 0 : _a.split("\n").slice(0, MAX_PATCH_LINES).join("\n"),
|
|
111
|
+
patch: (_c = (_b = (_a = f.patch) === null || _a === void 0 ? void 0 : _a.split("\n")) === null || _b === void 0 ? void 0 : _b.slice(0, MAX_PATCH_LINES)) === null || _c === void 0 ? void 0 : _c.join("\n"),
|
|
112
112
|
});
|
|
113
113
|
})
|
|
114
114
|
: undefined;
|
|
115
115
|
return {
|
|
116
116
|
number: item.number,
|
|
117
117
|
title: item.title,
|
|
118
|
-
|
|
118
|
+
url: item.html_url,
|
|
119
119
|
state: item.state,
|
|
120
120
|
isPullRequest: isPR,
|
|
121
121
|
body: item.body,
|
|
@@ -23,6 +23,7 @@ const getJiraDCIssuesByQuery = async ({ params, authParams, }) => {
|
|
|
23
23
|
"updated",
|
|
24
24
|
"resolution",
|
|
25
25
|
"duedate",
|
|
26
|
+
"labels",
|
|
26
27
|
"timeoriginalestimate",
|
|
27
28
|
"timespent",
|
|
28
29
|
"aggregatetimeoriginalestimate",
|
|
@@ -57,7 +58,7 @@ const getJiraDCIssuesByQuery = async ({ params, authParams, }) => {
|
|
|
57
58
|
return {
|
|
58
59
|
results: allIssues.map(issue => {
|
|
59
60
|
const { id, key, fields } = issue;
|
|
60
|
-
const { summary, description, project, issuetype, status, assignee, reporter, creator, created, updated, resolution, duedate, } = fields;
|
|
61
|
+
const { summary, description, project, issuetype, status, assignee, reporter, creator, created, updated, resolution, duedate, labels, } = fields;
|
|
61
62
|
const ticketUrl = `${browseUrl}/browse/${key}`;
|
|
62
63
|
return {
|
|
63
64
|
name: key,
|
|
@@ -106,6 +107,7 @@ const getJiraDCIssuesByQuery = async ({ params, authParams, }) => {
|
|
|
106
107
|
updated,
|
|
107
108
|
resolution: resolution?.name || null,
|
|
108
109
|
dueDate: duedate || null,
|
|
110
|
+
labels: labels ?? [],
|
|
109
111
|
url: ticketUrl,
|
|
110
112
|
},
|
|
111
113
|
};
|
|
@@ -25,6 +25,7 @@ const getJiraIssuesByQuery = async ({ params, authParams, }) => {
|
|
|
25
25
|
"updated",
|
|
26
26
|
"resolution",
|
|
27
27
|
"duedate",
|
|
28
|
+
"labels",
|
|
28
29
|
"timeoriginalestimate",
|
|
29
30
|
"timespent",
|
|
30
31
|
"aggregatetimeoriginalestimate",
|
|
@@ -57,7 +58,7 @@ const getJiraIssuesByQuery = async ({ params, authParams, }) => {
|
|
|
57
58
|
}
|
|
58
59
|
const results = await Promise.all(allIssues.map(async ({ id, key, fields }) => {
|
|
59
60
|
const ticketUrl = `${browseUrl}/browse/${key}`;
|
|
60
|
-
const { summary, description, project, issuetype, status, assignee, reporter, creator, created, updated, resolution, duedate, } = fields;
|
|
61
|
+
const { summary, description, project, issuetype, status, assignee, reporter, creator, created, updated, resolution, duedate, labels, } = fields;
|
|
61
62
|
const [assigneeInfo, reporterInfo, creatorInfo] = await Promise.all([
|
|
62
63
|
getUserInfoFromAccountId(assignee?.accountId, client),
|
|
63
64
|
getUserInfoFromAccountId(reporter?.accountId, client),
|
|
@@ -81,6 +82,7 @@ const getJiraIssuesByQuery = async ({ params, authParams, }) => {
|
|
|
81
82
|
updated,
|
|
82
83
|
resolution: resolution?.name,
|
|
83
84
|
dueDate: duedate,
|
|
85
|
+
labels: labels ?? [],
|
|
84
86
|
url: ticketUrl,
|
|
85
87
|
},
|
|
86
88
|
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
2
|
+
import { getSmartsheetToken, resolveCellsByColumnTitle, smartsheetRequest } from "./utils.js";
|
|
3
|
+
const addRowToSheet = async ({ params, authParams, }) => {
|
|
4
|
+
const token = getSmartsheetToken(authParams);
|
|
5
|
+
if (!token)
|
|
6
|
+
throw new Error(MISSING_AUTH_TOKEN);
|
|
7
|
+
const { sheetId, cells, toTop } = params;
|
|
8
|
+
try {
|
|
9
|
+
const resolvedCells = await resolveCellsByColumnTitle(token, sheetId, cells);
|
|
10
|
+
if (resolvedCells.length === 0) {
|
|
11
|
+
return { success: false, error: "cells must contain at least one column title to value mapping" };
|
|
12
|
+
}
|
|
13
|
+
const response = await smartsheetRequest(`/sheets/${sheetId}/rows`, token, {
|
|
14
|
+
method: "POST",
|
|
15
|
+
body: {
|
|
16
|
+
...(toTop ? { toTop: true } : { toBottom: true }),
|
|
17
|
+
cells: resolvedCells,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
const createdRow = Array.isArray(response.result) ? response.result[0] : response.result;
|
|
21
|
+
return {
|
|
22
|
+
success: true,
|
|
23
|
+
rowId: createdRow ? String(createdRow.id) : undefined,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
console.error("Error adding row to Smartsheet sheet:", error);
|
|
28
|
+
return {
|
|
29
|
+
success: false,
|
|
30
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
export default addRowToSheet;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
2
|
+
import { getSmartsheetToken, smartsheetRequest } from "./utils.js";
|
|
3
|
+
const getSheetRows = async ({ params, authParams, }) => {
|
|
4
|
+
const token = getSmartsheetToken(authParams);
|
|
5
|
+
if (!token)
|
|
6
|
+
throw new Error(MISSING_AUTH_TOKEN);
|
|
7
|
+
try {
|
|
8
|
+
const sheet = await smartsheetRequest(`/sheets/${params.sheetId}`, token);
|
|
9
|
+
const columnTitleById = new Map(sheet.columns.map(column => [column.id, column.title]));
|
|
10
|
+
return {
|
|
11
|
+
success: true,
|
|
12
|
+
sheet: {
|
|
13
|
+
id: String(sheet.id),
|
|
14
|
+
name: sheet.name,
|
|
15
|
+
permalink: sheet.permalink,
|
|
16
|
+
columns: sheet.columns.map(column => ({
|
|
17
|
+
id: String(column.id),
|
|
18
|
+
title: column.title,
|
|
19
|
+
type: column.type,
|
|
20
|
+
...(column.options ? { options: column.options } : {}),
|
|
21
|
+
})),
|
|
22
|
+
rows: sheet.rows.map(row => {
|
|
23
|
+
const cells = {};
|
|
24
|
+
for (const cell of row.cells ?? []) {
|
|
25
|
+
const title = columnTitleById.get(cell.columnId);
|
|
26
|
+
const value = cell.displayValue ?? cell.value;
|
|
27
|
+
if (title && value !== undefined) {
|
|
28
|
+
cells[title] = value;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
id: String(row.id),
|
|
33
|
+
rowNumber: row.rowNumber,
|
|
34
|
+
cells,
|
|
35
|
+
};
|
|
36
|
+
}),
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
console.error("Error getting Smartsheet sheet rows:", error);
|
|
42
|
+
return {
|
|
43
|
+
success: false,
|
|
44
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
export default getSheetRows;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
2
|
+
import { getSmartsheetToken, smartsheetRequest } from "./utils.js";
|
|
3
|
+
const listSheets = async ({ authParams, }) => {
|
|
4
|
+
const token = getSmartsheetToken(authParams);
|
|
5
|
+
if (!token)
|
|
6
|
+
throw new Error(MISSING_AUTH_TOKEN);
|
|
7
|
+
try {
|
|
8
|
+
const response = await smartsheetRequest("/sheets?includeAll=true", token);
|
|
9
|
+
return {
|
|
10
|
+
success: true,
|
|
11
|
+
sheets: response.data.map(sheet => ({
|
|
12
|
+
id: String(sheet.id),
|
|
13
|
+
name: sheet.name,
|
|
14
|
+
permalink: sheet.permalink,
|
|
15
|
+
})),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
console.error("Error listing Smartsheet sheets:", error);
|
|
20
|
+
return {
|
|
21
|
+
success: false,
|
|
22
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
export default listSheets;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { MISSING_AUTH_TOKEN } from "../../util/missingAuthConstants.js";
|
|
2
|
+
import { getSmartsheetToken, resolveCellsByColumnTitle, smartsheetRequest } from "./utils.js";
|
|
3
|
+
const updateRow = async ({ params, authParams, }) => {
|
|
4
|
+
const token = getSmartsheetToken(authParams);
|
|
5
|
+
if (!token)
|
|
6
|
+
throw new Error(MISSING_AUTH_TOKEN);
|
|
7
|
+
const { sheetId, rowId, cells } = params;
|
|
8
|
+
try {
|
|
9
|
+
const resolvedCells = await resolveCellsByColumnTitle(token, sheetId, cells);
|
|
10
|
+
if (resolvedCells.length === 0) {
|
|
11
|
+
return { success: false, error: "cells must contain at least one column title to value mapping" };
|
|
12
|
+
}
|
|
13
|
+
const response = await smartsheetRequest(`/sheets/${sheetId}/rows`, token, {
|
|
14
|
+
method: "PUT",
|
|
15
|
+
body: {
|
|
16
|
+
id: Number(rowId),
|
|
17
|
+
cells: resolvedCells,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
const updatedRow = Array.isArray(response.result) ? response.result[0] : response.result;
|
|
21
|
+
return {
|
|
22
|
+
success: true,
|
|
23
|
+
rowId: updatedRow ? String(updatedRow.id) : String(rowId),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
console.error("Error updating row in Smartsheet sheet:", error);
|
|
28
|
+
return {
|
|
29
|
+
success: false,
|
|
30
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
export default updateRow;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type SmartsheetColumn = {
|
|
2
|
+
id: number;
|
|
3
|
+
title: string;
|
|
4
|
+
type: string;
|
|
5
|
+
options?: string[];
|
|
6
|
+
};
|
|
7
|
+
export type SmartsheetCell = {
|
|
8
|
+
columnId: number;
|
|
9
|
+
value?: string | number | boolean;
|
|
10
|
+
displayValue?: string;
|
|
11
|
+
};
|
|
12
|
+
export type SmartsheetRow = {
|
|
13
|
+
id: number;
|
|
14
|
+
rowNumber: number;
|
|
15
|
+
cells?: SmartsheetCell[];
|
|
16
|
+
};
|
|
17
|
+
export declare function getSmartsheetToken(authParams: {
|
|
18
|
+
apiKey?: string;
|
|
19
|
+
authToken?: string;
|
|
20
|
+
}): string | undefined;
|
|
21
|
+
export declare function smartsheetRequest<T>(path: string, token: string, init?: {
|
|
22
|
+
method?: string;
|
|
23
|
+
body?: unknown;
|
|
24
|
+
}): Promise<T>;
|
|
25
|
+
/**
|
|
26
|
+
* Resolves a { "Column Title": value } map to the cell objects the Smartsheet API expects,
|
|
27
|
+
* which address cells by numeric columnId.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveCellsByColumnTitle(token: string, sheetId: string, cellsByTitle: Record<string, unknown>): Promise<Array<{
|
|
30
|
+
columnId: number;
|
|
31
|
+
value: string | number | boolean;
|
|
32
|
+
strict: boolean;
|
|
33
|
+
}>>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const SMARTSHEET_API_BASE = "https://api.smartsheet.com/2.0";
|
|
2
|
+
export function getSmartsheetToken(authParams) {
|
|
3
|
+
return authParams.apiKey ?? authParams.authToken;
|
|
4
|
+
}
|
|
5
|
+
export async function smartsheetRequest(path, token, init) {
|
|
6
|
+
const response = await fetch(`${SMARTSHEET_API_BASE}${path}`, {
|
|
7
|
+
method: init?.method ?? "GET",
|
|
8
|
+
headers: {
|
|
9
|
+
Authorization: `Bearer ${token}`,
|
|
10
|
+
"Content-Type": "application/json",
|
|
11
|
+
},
|
|
12
|
+
body: init?.body !== undefined ? JSON.stringify(init.body) : undefined,
|
|
13
|
+
});
|
|
14
|
+
const data = await response.json().catch(() => undefined);
|
|
15
|
+
if (!response.ok) {
|
|
16
|
+
const message = data && typeof data === "object" && "message" in data
|
|
17
|
+
? data.message
|
|
18
|
+
: response.statusText;
|
|
19
|
+
throw new Error(`Smartsheet API error (status ${response.status}): ${message}`);
|
|
20
|
+
}
|
|
21
|
+
return data;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Resolves a { "Column Title": value } map to the cell objects the Smartsheet API expects,
|
|
25
|
+
* which address cells by numeric columnId.
|
|
26
|
+
*/
|
|
27
|
+
export async function resolveCellsByColumnTitle(token, sheetId, cellsByTitle) {
|
|
28
|
+
const columnsResponse = await smartsheetRequest(`/sheets/${sheetId}/columns?includeAll=true`, token);
|
|
29
|
+
const columns = columnsResponse.data;
|
|
30
|
+
if (!Array.isArray(columns)) {
|
|
31
|
+
throw new Error(`Could not read columns for sheet "${sheetId}": the Smartsheet API returned an unexpected response shape.`);
|
|
32
|
+
}
|
|
33
|
+
const columnIdByTitle = new Map(columns.map(column => [column.title, column.id]));
|
|
34
|
+
return Object.entries(cellsByTitle).map(([title, value]) => {
|
|
35
|
+
const columnId = columnIdByTitle.get(title);
|
|
36
|
+
if (columnId === undefined) {
|
|
37
|
+
throw new Error(`Column "${title}" does not exist in this sheet. Valid column titles are: ${columns.map(column => `"${column.title}"`).join(", ")}`);
|
|
38
|
+
}
|
|
39
|
+
if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
|
|
40
|
+
throw new Error(`Cell value for column "${title}" must be a string, number, or boolean`);
|
|
41
|
+
}
|
|
42
|
+
// strict: false lets Smartsheet coerce values (e.g. numbers into TEXT_NUMBER columns)
|
|
43
|
+
return { columnId, value, strict: false };
|
|
44
|
+
});
|
|
45
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@credal/actions",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.221",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "AI Actions by Credal AI",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
},
|
|
88
88
|
"overrides": {
|
|
89
89
|
"@xmldom/xmldom": "^0.8.13",
|
|
90
|
-
"axios": "^1.
|
|
90
|
+
"axios": "^1.17.0",
|
|
91
91
|
"fast-xml-parser": "^5.7.0",
|
|
92
92
|
"minimatch": "^10.2.1",
|
|
93
93
|
"file-type": "^22.0.0"
|
|
@@ -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;
|