@credal/actions 0.1.74 → 0.1.75
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 -0
- package/dist/actions/autogen/templates.d.ts +1 -0
- package/dist/actions/autogen/templates.js +36 -2
- package/dist/actions/autogen/types.d.ts +23 -0
- package/dist/actions/autogen/types.js +12 -3
- package/dist/actions/groups.js +4 -0
- package/dist/actions/providers/jamf/getComputerInventory.d.ts +3 -0
- package/dist/actions/providers/{salesforce/getSalesforceRecordByQuery.js → jamf/getComputerInventory.js} +16 -14
- package/dist/actions/providers/jamf/getFileVaultRecoveryKey.d.ts +3 -0
- package/dist/actions/providers/jamf/getFileVaultRecoveryKey.js +40 -0
- package/dist/actions/providers/kandji/getFVRecoveryKeyForDevice.d.ts +3 -0
- package/dist/actions/providers/kandji/getFVRecoveryKeyForDevice.js +88 -0
- package/package.json +1 -1
- package/dist/actions/providers/salesforce/getSalesforceRecordByQuery.d.ts +0 -3
@@ -80,6 +80,7 @@ const createRecord_1 = __importDefault(require("./providers/salesforce/createRec
|
|
80
80
|
const getTopNSearchResultUrls_1 = __importDefault(require("./providers/bing/getTopNSearchResultUrls"));
|
81
81
|
const getGongTranscripts_1 = __importDefault(require("./providers/gong/getGongTranscripts"));
|
82
82
|
const types_2 = require("./autogen/types");
|
83
|
+
const getFVRecoveryKeyForDevice_1 = __importDefault(require("./providers/kandji/getFVRecoveryKeyForDevice"));
|
83
84
|
exports.ActionMapper = {
|
84
85
|
generic: {
|
85
86
|
fillTemplate: {
|
@@ -155,6 +156,13 @@ exports.ActionMapper = {
|
|
155
156
|
outputSchema: types_1.credalCallCopilotOutputSchema,
|
156
157
|
},
|
157
158
|
},
|
159
|
+
kandji: {
|
160
|
+
getFVRecoveryKeyForDevice: {
|
161
|
+
fn: getFVRecoveryKeyForDevice_1.default,
|
162
|
+
paramsSchema: types_1.kandjiGetFVRecoveryKeyForDeviceParamsSchema,
|
163
|
+
outputSchema: types_1.kandjiGetFVRecoveryKeyForDeviceOutputSchema,
|
164
|
+
},
|
165
|
+
},
|
158
166
|
bing: {
|
159
167
|
getTopNSearchResultUrls: {
|
160
168
|
fn: getTopNSearchResultUrls_1.default,
|
@@ -16,6 +16,7 @@ export declare const jiraGetJiraTicketHistoryDefinition: ActionTemplate;
|
|
16
16
|
export declare const jiraUpdateJiraTicketDetailsDefinition: ActionTemplate;
|
17
17
|
export declare const jiraUpdateJiraTicketStatusDefinition: ActionTemplate;
|
18
18
|
export declare const jiraGetJiraIssuesByQueryDefinition: ActionTemplate;
|
19
|
+
export declare const kandjiGetFVRecoveryKeyForDeviceDefinition: ActionTemplate;
|
19
20
|
export declare const googlemapsValidateAddressDefinition: ActionTemplate;
|
20
21
|
export declare const googlemapsNearbysearchRestaurantsDefinition: ActionTemplate;
|
21
22
|
export declare const bingGetTopNSearchResultUrlsDefinition: ActionTemplate;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
4
|
-
exports.githubListPullRequestsDefinition = exports.githubCreatePullRequestDefinition = exports.githubCreateBranchDefinition = exports.githubCreateOrUpdateFileDefinition = exports.microsoftGetDocumentDefinition = exports.microsoftMessageTeamsChannelDefinition = exports.microsoftMessageTeamsChatDefinition = exports.microsoftUpdateSpreadsheetDefinition = exports.microsoftUpdateDocumentDefinition = exports.microsoftCreateDocumentDefinition = exports.salesforceFetchSalesforceSchemaByObjectDefinition = exports.salesforceGetRecordDefinition = exports.salesforceGetSalesforceRecordsByQueryDefinition = exports.salesforceGenerateSalesReportDefinition = exports.salesforceCreateCaseDefinition = exports.salesforceCreateRecordDefinition = exports.salesforceUpdateRecordDefinition = exports.ashbyUpdateCandidateDefinition = exports.ashbyCreateCandidateDefinition = exports.ashbyListCandidateNotesDefinition = exports.ashbySearchCandidatesDefinition = exports.ashbyListCandidatesDefinition = exports.ashbyAddCandidateToProjectDefinition = exports.ashbyGetCandidateInfoDefinition = void 0;
|
3
|
+
exports.lookerEnableUserByEmailDefinition = exports.finnhubGetBasicFinancialsDefinition = exports.finnhubSymbolLookupDefinition = exports.gongGetGongTranscriptsDefinition = exports.googleOauthUpdatePresentationDefinition = exports.googleOauthCreatePresentationDefinition = exports.googleOauthUpdateSpreadsheetDefinition = exports.googleOauthCreateSpreadsheetDefinition = exports.googleOauthScheduleCalendarMeetingDefinition = exports.googleOauthUpdateDocDefinition = exports.googleOauthCreateNewGoogleDocDefinition = exports.resendSendEmailDefinition = exports.firecrawlScrapeTweetDataWithNitterDefinition = exports.firecrawlScrapeUrlDefinition = exports.firecrawlDeepResearchDefinition = exports.nwsGetForecastForLocationDefinition = exports.openstreetmapGetLatitudeLongitudeFromLocationDefinition = exports.snowflakeRunSnowflakeQueryDefinition = exports.snowflakeGetRowByFieldValueDefinition = exports.mongoInsertMongoDocDefinition = exports.xCreateShareXPostUrlDefinition = exports.linkedinCreateShareLinkedinPostUrlDefinition = exports.zendeskAssignTicketDefinition = exports.zendeskAddCommentToTicketDefinition = exports.zendeskUpdateTicketStatusDefinition = exports.zendeskGetTicketDetailsDefinition = exports.zendeskListZendeskTicketsDefinition = exports.zendeskCreateZendeskTicketDefinition = exports.credalCallCopilotDefinition = exports.bingGetTopNSearchResultUrlsDefinition = exports.googlemapsNearbysearchRestaurantsDefinition = exports.googlemapsValidateAddressDefinition = exports.kandjiGetFVRecoveryKeyForDeviceDefinition = exports.jiraGetJiraIssuesByQueryDefinition = exports.jiraUpdateJiraTicketStatusDefinition = exports.jiraUpdateJiraTicketDetailsDefinition = exports.jiraGetJiraTicketHistoryDefinition = exports.jiraGetJiraTicketDetailsDefinition = exports.jiraCreateJiraTicketDefinition = exports.jiraCommentJiraTicketDefinition = exports.jiraAssignJiraTicketDefinition = exports.confluenceFetchPageContentDefinition = exports.confluenceOverwritePageDefinition = exports.mathAddDefinition = exports.slackGetChannelMessagesDefinition = exports.slackSendMessageDefinition = exports.asanaUpdateTaskDefinition = exports.asanaCreateTaskDefinition = exports.asanaCommentTaskDefinition = exports.genericFillTemplateDefinition = void 0;
|
4
|
+
exports.githubListPullRequestsDefinition = exports.githubCreatePullRequestDefinition = exports.githubCreateBranchDefinition = exports.githubCreateOrUpdateFileDefinition = exports.microsoftGetDocumentDefinition = exports.microsoftMessageTeamsChannelDefinition = exports.microsoftMessageTeamsChatDefinition = exports.microsoftUpdateSpreadsheetDefinition = exports.microsoftUpdateDocumentDefinition = exports.microsoftCreateDocumentDefinition = exports.salesforceFetchSalesforceSchemaByObjectDefinition = exports.salesforceGetRecordDefinition = exports.salesforceGetSalesforceRecordsByQueryDefinition = exports.salesforceGenerateSalesReportDefinition = exports.salesforceCreateCaseDefinition = exports.salesforceCreateRecordDefinition = exports.salesforceUpdateRecordDefinition = exports.ashbyUpdateCandidateDefinition = exports.ashbyCreateCandidateDefinition = exports.ashbyListCandidateNotesDefinition = exports.ashbySearchCandidatesDefinition = exports.ashbyListCandidatesDefinition = exports.ashbyAddCandidateToProjectDefinition = exports.ashbyGetCandidateInfoDefinition = exports.ashbyCreateNoteDefinition = void 0;
|
5
5
|
exports.genericFillTemplateDefinition = {
|
6
6
|
description: "Simple utility that takes a template and returns it filled in",
|
7
7
|
scopes: [],
|
@@ -712,6 +712,40 @@ exports.jiraGetJiraIssuesByQueryDefinition = {
|
|
712
712
|
name: "getJiraIssuesByQuery",
|
713
713
|
provider: "jira",
|
714
714
|
};
|
715
|
+
exports.kandjiGetFVRecoveryKeyForDeviceDefinition = {
|
716
|
+
description: "Get the FileVault recovery key for a device",
|
717
|
+
scopes: [],
|
718
|
+
parameters: {
|
719
|
+
type: "object",
|
720
|
+
required: ["serialNumber"],
|
721
|
+
properties: {
|
722
|
+
serialNumber: {
|
723
|
+
type: "string",
|
724
|
+
description: "The serial number of the device",
|
725
|
+
},
|
726
|
+
},
|
727
|
+
},
|
728
|
+
output: {
|
729
|
+
type: "object",
|
730
|
+
required: ["success"],
|
731
|
+
properties: {
|
732
|
+
success: {
|
733
|
+
type: "boolean",
|
734
|
+
description: "Whether the recovery key was retrieved successfully",
|
735
|
+
},
|
736
|
+
recoveryKey: {
|
737
|
+
type: "string",
|
738
|
+
description: "The FileVault recovery key for the device",
|
739
|
+
},
|
740
|
+
error: {
|
741
|
+
type: "string",
|
742
|
+
description: "The error that occurred if the recovery key was not retrieved successfully",
|
743
|
+
},
|
744
|
+
},
|
745
|
+
},
|
746
|
+
name: "getFVRecoveryKeyForDevice",
|
747
|
+
provider: "kandji",
|
748
|
+
};
|
715
749
|
exports.googlemapsValidateAddressDefinition = {
|
716
750
|
description: "Validate a Google Maps address",
|
717
751
|
scopes: [],
|
@@ -551,6 +551,29 @@ export declare const jiraGetJiraIssuesByQueryOutputSchema: z.ZodObject<{
|
|
551
551
|
}>;
|
552
552
|
export type jiraGetJiraIssuesByQueryOutputType = z.infer<typeof jiraGetJiraIssuesByQueryOutputSchema>;
|
553
553
|
export type jiraGetJiraIssuesByQueryFunction = ActionFunction<jiraGetJiraIssuesByQueryParamsType, AuthParamsType, jiraGetJiraIssuesByQueryOutputType>;
|
554
|
+
export declare const kandjiGetFVRecoveryKeyForDeviceParamsSchema: z.ZodObject<{
|
555
|
+
serialNumber: z.ZodString;
|
556
|
+
}, "strip", z.ZodTypeAny, {
|
557
|
+
serialNumber: string;
|
558
|
+
}, {
|
559
|
+
serialNumber: string;
|
560
|
+
}>;
|
561
|
+
export type kandjiGetFVRecoveryKeyForDeviceParamsType = z.infer<typeof kandjiGetFVRecoveryKeyForDeviceParamsSchema>;
|
562
|
+
export declare const kandjiGetFVRecoveryKeyForDeviceOutputSchema: z.ZodObject<{
|
563
|
+
success: z.ZodBoolean;
|
564
|
+
recoveryKey: z.ZodOptional<z.ZodString>;
|
565
|
+
error: z.ZodOptional<z.ZodString>;
|
566
|
+
}, "strip", z.ZodTypeAny, {
|
567
|
+
success: boolean;
|
568
|
+
error?: string | undefined;
|
569
|
+
recoveryKey?: string | undefined;
|
570
|
+
}, {
|
571
|
+
success: boolean;
|
572
|
+
error?: string | undefined;
|
573
|
+
recoveryKey?: string | undefined;
|
574
|
+
}>;
|
575
|
+
export type kandjiGetFVRecoveryKeyForDeviceOutputType = z.infer<typeof kandjiGetFVRecoveryKeyForDeviceOutputSchema>;
|
576
|
+
export type kandjiGetFVRecoveryKeyForDeviceFunction = ActionFunction<kandjiGetFVRecoveryKeyForDeviceParamsType, AuthParamsType, kandjiGetFVRecoveryKeyForDeviceOutputType>;
|
554
577
|
export declare const googlemapsValidateAddressParamsSchema: z.ZodObject<{
|
555
578
|
regionCode: z.ZodString;
|
556
579
|
locality: z.ZodString;
|
@@ -1,8 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
4
|
-
exports.
|
5
|
-
exports.
|
3
|
+
exports.zendeskGetTicketDetailsParamsSchema = exports.zendeskListZendeskTicketsOutputSchema = exports.zendeskListZendeskTicketsParamsSchema = exports.zendeskCreateZendeskTicketOutputSchema = exports.zendeskCreateZendeskTicketParamsSchema = exports.credalCallCopilotOutputSchema = exports.credalCallCopilotParamsSchema = exports.bingGetTopNSearchResultUrlsOutputSchema = exports.bingGetTopNSearchResultUrlsParamsSchema = exports.googlemapsNearbysearchRestaurantsOutputSchema = exports.googlemapsNearbysearchRestaurantsParamsSchema = exports.googlemapsValidateAddressOutputSchema = exports.googlemapsValidateAddressParamsSchema = exports.kandjiGetFVRecoveryKeyForDeviceOutputSchema = exports.kandjiGetFVRecoveryKeyForDeviceParamsSchema = exports.jiraGetJiraIssuesByQueryOutputSchema = exports.jiraGetJiraIssuesByQueryParamsSchema = exports.jiraUpdateJiraTicketStatusOutputSchema = exports.jiraUpdateJiraTicketStatusParamsSchema = exports.jiraUpdateJiraTicketDetailsOutputSchema = exports.jiraUpdateJiraTicketDetailsParamsSchema = exports.jiraGetJiraTicketHistoryOutputSchema = exports.jiraGetJiraTicketHistoryParamsSchema = exports.jiraGetJiraTicketDetailsOutputSchema = exports.jiraGetJiraTicketDetailsParamsSchema = exports.jiraCreateJiraTicketOutputSchema = exports.jiraCreateJiraTicketParamsSchema = exports.jiraCommentJiraTicketOutputSchema = exports.jiraCommentJiraTicketParamsSchema = exports.jiraAssignJiraTicketOutputSchema = exports.jiraAssignJiraTicketParamsSchema = exports.confluenceFetchPageContentOutputSchema = exports.confluenceFetchPageContentParamsSchema = exports.confluenceOverwritePageOutputSchema = exports.confluenceOverwritePageParamsSchema = exports.mathAddOutputSchema = exports.mathAddParamsSchema = exports.slackGetChannelMessagesOutputSchema = exports.slackGetChannelMessagesParamsSchema = exports.slackSendMessageOutputSchema = exports.slackSendMessageParamsSchema = exports.asanaUpdateTaskOutputSchema = exports.asanaUpdateTaskParamsSchema = exports.asanaCreateTaskOutputSchema = exports.asanaCreateTaskParamsSchema = exports.asanaCommentTaskOutputSchema = exports.asanaCommentTaskParamsSchema = exports.genericFillTemplateOutputSchema = exports.genericFillTemplateParamsSchema = exports.AuthParamsSchema = void 0;
|
4
|
+
exports.lookerEnableUserByEmailParamsSchema = exports.finnhubGetBasicFinancialsOutputSchema = exports.finnhubGetBasicFinancialsParamsSchema = exports.finnhubSymbolLookupOutputSchema = exports.finnhubSymbolLookupParamsSchema = exports.gongGetGongTranscriptsOutputSchema = exports.gongGetGongTranscriptsParamsSchema = exports.googleOauthUpdatePresentationOutputSchema = exports.googleOauthUpdatePresentationParamsSchema = exports.googleOauthCreatePresentationOutputSchema = exports.googleOauthCreatePresentationParamsSchema = exports.googleOauthUpdateSpreadsheetOutputSchema = exports.googleOauthUpdateSpreadsheetParamsSchema = exports.googleOauthCreateSpreadsheetOutputSchema = exports.googleOauthCreateSpreadsheetParamsSchema = exports.googleOauthScheduleCalendarMeetingOutputSchema = exports.googleOauthScheduleCalendarMeetingParamsSchema = exports.googleOauthUpdateDocOutputSchema = exports.googleOauthUpdateDocParamsSchema = exports.googleOauthCreateNewGoogleDocOutputSchema = exports.googleOauthCreateNewGoogleDocParamsSchema = exports.resendSendEmailOutputSchema = exports.resendSendEmailParamsSchema = exports.firecrawlScrapeTweetDataWithNitterOutputSchema = exports.firecrawlScrapeTweetDataWithNitterParamsSchema = exports.firecrawlScrapeUrlOutputSchema = exports.firecrawlScrapeUrlParamsSchema = exports.firecrawlDeepResearchOutputSchema = exports.firecrawlDeepResearchParamsSchema = exports.nwsGetForecastForLocationOutputSchema = exports.nwsGetForecastForLocationParamsSchema = exports.openstreetmapGetLatitudeLongitudeFromLocationOutputSchema = exports.openstreetmapGetLatitudeLongitudeFromLocationParamsSchema = exports.snowflakeRunSnowflakeQueryOutputSchema = exports.snowflakeRunSnowflakeQueryParamsSchema = exports.snowflakeGetRowByFieldValueOutputSchema = exports.snowflakeGetRowByFieldValueParamsSchema = exports.mongoInsertMongoDocOutputSchema = exports.mongoInsertMongoDocParamsSchema = exports.xCreateShareXPostUrlOutputSchema = exports.xCreateShareXPostUrlParamsSchema = exports.linkedinCreateShareLinkedinPostUrlOutputSchema = exports.linkedinCreateShareLinkedinPostUrlParamsSchema = exports.zendeskAssignTicketOutputSchema = exports.zendeskAssignTicketParamsSchema = exports.zendeskAddCommentToTicketOutputSchema = exports.zendeskAddCommentToTicketParamsSchema = exports.zendeskUpdateTicketStatusOutputSchema = exports.zendeskUpdateTicketStatusParamsSchema = exports.zendeskGetTicketDetailsOutputSchema = void 0;
|
5
|
+
exports.githubListPullRequestsParamsSchema = exports.githubCreatePullRequestOutputSchema = exports.githubCreatePullRequestParamsSchema = exports.githubCreateBranchOutputSchema = exports.githubCreateBranchParamsSchema = exports.githubCreateOrUpdateFileOutputSchema = exports.githubCreateOrUpdateFileParamsSchema = exports.microsoftGetDocumentOutputSchema = exports.microsoftGetDocumentParamsSchema = exports.microsoftMessageTeamsChannelOutputSchema = exports.microsoftMessageTeamsChannelParamsSchema = exports.microsoftMessageTeamsChatOutputSchema = exports.microsoftMessageTeamsChatParamsSchema = exports.microsoftUpdateSpreadsheetOutputSchema = exports.microsoftUpdateSpreadsheetParamsSchema = exports.microsoftUpdateDocumentOutputSchema = exports.microsoftUpdateDocumentParamsSchema = exports.microsoftCreateDocumentOutputSchema = exports.microsoftCreateDocumentParamsSchema = exports.salesforceFetchSalesforceSchemaByObjectOutputSchema = exports.salesforceFetchSalesforceSchemaByObjectParamsSchema = exports.salesforceGetRecordOutputSchema = exports.salesforceGetRecordParamsSchema = exports.salesforceGetSalesforceRecordsByQueryOutputSchema = exports.salesforceGetSalesforceRecordsByQueryParamsSchema = exports.salesforceGenerateSalesReportOutputSchema = exports.salesforceGenerateSalesReportParamsSchema = exports.salesforceCreateCaseOutputSchema = exports.salesforceCreateCaseParamsSchema = exports.salesforceCreateRecordOutputSchema = exports.salesforceCreateRecordParamsSchema = exports.salesforceUpdateRecordOutputSchema = exports.salesforceUpdateRecordParamsSchema = exports.ashbyUpdateCandidateOutputSchema = exports.ashbyUpdateCandidateParamsSchema = exports.ashbyCreateCandidateOutputSchema = exports.ashbyCreateCandidateParamsSchema = exports.ashbyListCandidateNotesOutputSchema = exports.ashbyListCandidateNotesParamsSchema = exports.ashbySearchCandidatesOutputSchema = exports.ashbySearchCandidatesParamsSchema = exports.ashbyListCandidatesOutputSchema = exports.ashbyListCandidatesParamsSchema = exports.ashbyAddCandidateToProjectOutputSchema = exports.ashbyAddCandidateToProjectParamsSchema = exports.ashbyGetCandidateInfoOutputSchema = exports.ashbyGetCandidateInfoParamsSchema = exports.ashbyCreateNoteOutputSchema = exports.ashbyCreateNoteParamsSchema = exports.lookerEnableUserByEmailOutputSchema = void 0;
|
6
|
+
exports.githubListPullRequestsOutputSchema = void 0;
|
6
7
|
const zod_1 = require("zod");
|
7
8
|
exports.AuthParamsSchema = zod_1.z.object({
|
8
9
|
authToken: zod_1.z.string().optional(),
|
@@ -207,6 +208,14 @@ exports.jiraGetJiraIssuesByQueryOutputSchema = zod_1.z.object({
|
|
207
208
|
records: zod_1.z.array(zod_1.z.record(zod_1.z.string()).describe("An issue from Jira")).describe("The retrieved records").optional(),
|
208
209
|
error: zod_1.z.string().describe("The error that occurred if the records were not successfully retrieved").optional(),
|
209
210
|
});
|
211
|
+
exports.kandjiGetFVRecoveryKeyForDeviceParamsSchema = zod_1.z.object({
|
212
|
+
serialNumber: zod_1.z.string().describe("The serial number of the device"),
|
213
|
+
});
|
214
|
+
exports.kandjiGetFVRecoveryKeyForDeviceOutputSchema = zod_1.z.object({
|
215
|
+
success: zod_1.z.boolean().describe("Whether the recovery key was retrieved successfully"),
|
216
|
+
recoveryKey: zod_1.z.string().describe("The FileVault recovery key for the device").optional(),
|
217
|
+
error: zod_1.z.string().describe("The error that occurred if the recovery key was not retrieved successfully").optional(),
|
218
|
+
});
|
210
219
|
exports.googlemapsValidateAddressParamsSchema = zod_1.z.object({
|
211
220
|
regionCode: zod_1.z.string().describe("The country of the address being verified."),
|
212
221
|
locality: zod_1.z.string().describe("The locality of the address being verified. This is likely a city."),
|
package/dist/actions/groups.js
CHANGED
@@ -145,6 +145,10 @@ exports.ACTION_GROUPS = {
|
|
145
145
|
templates_1.microsoftGetDocumentDefinition,
|
146
146
|
],
|
147
147
|
},
|
148
|
+
KANDJI: {
|
149
|
+
description: "Actions for interacting with Kandji",
|
150
|
+
actions: [templates_1.kandjiGetFVRecoveryKeyForDeviceDefinition],
|
151
|
+
},
|
148
152
|
GITHUB: {
|
149
153
|
description: "Actions for interacting with GitHub",
|
150
154
|
actions: [
|
@@ -10,34 +10,36 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
const axiosClient_1 = require("../../util/axiosClient");
|
13
|
-
const
|
13
|
+
const getComputerInventory = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
14
|
const { authToken, baseUrl } = authParams;
|
15
|
-
const {
|
16
|
-
if (!
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
const { section } = params;
|
16
|
+
if (!baseUrl) {
|
17
|
+
throw new Error("Base URL is required to fetch computer inventory");
|
18
|
+
}
|
19
|
+
const apiUrl = `${baseUrl}/v1/computer-inventory`;
|
20
|
+
const queryParams = {};
|
21
|
+
if (section) {
|
22
|
+
queryParams.section = section;
|
21
23
|
}
|
22
|
-
// The API limits the maximum number of records returned to 2000, the limit lets the user set a smaller custom limit
|
23
|
-
const url = `${baseUrl}/services/data/v56.0/query/?q=${encodeURIComponent(query + " LIMIT " + (limit != undefined && limit <= 2000 ? limit : 2000))}`;
|
24
24
|
try {
|
25
|
-
const response = yield axiosClient_1.axiosClient.get(
|
25
|
+
const response = yield axiosClient_1.axiosClient.get(apiUrl, {
|
26
26
|
headers: {
|
27
27
|
Authorization: `Bearer ${authToken}`,
|
28
|
+
Accept: "application/json",
|
28
29
|
},
|
30
|
+
params: queryParams,
|
29
31
|
});
|
30
32
|
return {
|
31
33
|
success: true,
|
32
|
-
|
34
|
+
data: response.data,
|
33
35
|
};
|
34
36
|
}
|
35
37
|
catch (error) {
|
36
|
-
console.error("Error retrieving
|
38
|
+
console.error("Error retrieving computer inventory: ", error);
|
37
39
|
return {
|
38
40
|
success: false,
|
39
|
-
error: error instanceof Error ? error.message : "
|
41
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
40
42
|
};
|
41
43
|
}
|
42
44
|
});
|
43
|
-
exports.default =
|
45
|
+
exports.default = getComputerInventory;
|
@@ -0,0 +1,40 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
const axiosClient_1 = require("../../util/axiosClient");
|
13
|
+
const getFileVaultRecoveryKey = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
|
+
const { authToken, baseUrl } = authParams;
|
15
|
+
const { computerId } = params;
|
16
|
+
if (!baseUrl || !computerId) {
|
17
|
+
throw new Error("Base URL and Computer ID are required to fetch FileVault2 recovery key");
|
18
|
+
}
|
19
|
+
const apiUrl = `${baseUrl}/JSSResource/computers/${computerId}/FileVault2RecoveryKey`;
|
20
|
+
try {
|
21
|
+
const response = yield axiosClient_1.axiosClient.get(apiUrl, {
|
22
|
+
headers: {
|
23
|
+
Authorization: `Bearer ${authToken}`,
|
24
|
+
Accept: "application/json",
|
25
|
+
},
|
26
|
+
});
|
27
|
+
return {
|
28
|
+
success: true,
|
29
|
+
data: response.data,
|
30
|
+
};
|
31
|
+
}
|
32
|
+
catch (error) {
|
33
|
+
console.error("Error retrieving FileVault2 recovery key: ", error);
|
34
|
+
return {
|
35
|
+
success: false,
|
36
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
37
|
+
};
|
38
|
+
}
|
39
|
+
});
|
40
|
+
exports.default = getFileVaultRecoveryKey;
|
@@ -0,0 +1,88 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
const axiosClient_1 = require("../../util/axiosClient");
|
13
|
+
const getFVRecoveryKeyForDevice = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
14
|
+
const { serialNumber } = params;
|
15
|
+
const { subdomain, apiKey } = authParams;
|
16
|
+
if (!apiKey || !subdomain) {
|
17
|
+
throw new Error("Missing API key or subdomain in auth parameters");
|
18
|
+
}
|
19
|
+
try {
|
20
|
+
// First list all devices to get the device for the specific device
|
21
|
+
const device = yield getDeviceBySerialNumber({
|
22
|
+
apiKey,
|
23
|
+
serialNumber,
|
24
|
+
subdomain,
|
25
|
+
});
|
26
|
+
if (!device) {
|
27
|
+
return {
|
28
|
+
success: false,
|
29
|
+
error: "Device not found for the given serial number",
|
30
|
+
};
|
31
|
+
}
|
32
|
+
// Then get the FV recovery key for that device
|
33
|
+
const fvRecoveryKey = yield axiosClient_1.axiosClient.get(`https://${subdomain}.api.kandji.io/api/v1/devices/${device.device_id}/secrets/filevaultkey`, {
|
34
|
+
headers: {
|
35
|
+
"Content-Type": "application/json",
|
36
|
+
Authorization: `Bearer ${apiKey}`,
|
37
|
+
},
|
38
|
+
});
|
39
|
+
if (!fvRecoveryKey || !fvRecoveryKey.data || !fvRecoveryKey.data.key) {
|
40
|
+
return {
|
41
|
+
success: false,
|
42
|
+
error: "FireVault recovery key not found",
|
43
|
+
};
|
44
|
+
}
|
45
|
+
return {
|
46
|
+
success: true,
|
47
|
+
recoveryKey: fvRecoveryKey.data.key,
|
48
|
+
};
|
49
|
+
}
|
50
|
+
catch (error) {
|
51
|
+
return {
|
52
|
+
success: false,
|
53
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
54
|
+
};
|
55
|
+
}
|
56
|
+
});
|
57
|
+
function getDeviceBySerialNumber(input) {
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
59
|
+
const limit = 300;
|
60
|
+
let offset = 0;
|
61
|
+
const { apiKey, serialNumber, subdomain } = input;
|
62
|
+
while (true) {
|
63
|
+
// Update params
|
64
|
+
const params = { limit, offset };
|
65
|
+
const endpoint = `https://${subdomain}.api.kandji.io/api/v1/devices`;
|
66
|
+
// Check to see if a platform was specified
|
67
|
+
const response = yield axiosClient_1.axiosClient.get(endpoint, {
|
68
|
+
params: Object.assign({}, params),
|
69
|
+
headers: {
|
70
|
+
"Content-Type": "application/json",
|
71
|
+
Authorization: `Bearer ${apiKey}`,
|
72
|
+
},
|
73
|
+
});
|
74
|
+
for (const device of response.data) {
|
75
|
+
if (device.serial_number === serialNumber) {
|
76
|
+
// If the device serial number matches, return the device
|
77
|
+
return device;
|
78
|
+
}
|
79
|
+
}
|
80
|
+
offset += limit;
|
81
|
+
if (response.data.length === 0) {
|
82
|
+
break;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
return null;
|
86
|
+
});
|
87
|
+
}
|
88
|
+
exports.default = getFVRecoveryKeyForDevice;
|
package/package.json
CHANGED