Add CARD asset-search by Ivanti Host ID for faster lookups
Integrate CARD's new v2 asset-search endpoint that accepts Ivanti Asset ID integers directly, eliminating the slow suffix-guessing resolution flow. Changes: - Add searchByIvantiHostId() helper to cardApi.js - Add GET /api/card/asset-search/:hostId endpoint - Update CARD queue confirm/decline/redirect to try host_id fast path first - Update owner-lookup to accept optional hostId query param for fast resolution - Pass hostId through CardOwnerTooltip and ReportingPage for tooltip lookups - Join ivanti_findings in todo queue GET to expose host_id on queue items - Update CardActionModal to pass host_id for faster owner-lookup
This commit is contained in:
@@ -295,6 +295,23 @@ async function redirectAsset(assetId, fromTeam, toTeam, updateToken) {
|
||||
return { status: res.status, body: res.body, ok: res.status >= 200 && res.status < 300 };
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /api/v2/asset-search/{ivantiHostId}?search_param=deep_search
|
||||
* Search CARD by Ivanti Asset ID (8-digit integer). Returns the CARD asset
|
||||
* record directly — no suffix guessing required.
|
||||
*
|
||||
* @param {string|number} ivantiHostId - 8-character integer Ivanti Host ID
|
||||
* @param {object} [options] - { timeout }
|
||||
*/
|
||||
async function searchByIvantiHostId(ivantiHostId, options) {
|
||||
const hostId = String(ivantiHostId).trim();
|
||||
if (!hostId || !/^\d+$/.test(hostId)) {
|
||||
return { status: 400, body: '{"error":"Invalid Ivanti host ID — must be an integer."}', ok: false };
|
||||
}
|
||||
const res = await cardGet(`/api/v2/asset-search/${hostId}?search_param=deep_search`, options);
|
||||
return { status: res.status, body: res.body, ok: res.status >= 200 && res.status < 300 };
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve a bare IP address to a full CARD asset ID by trying known suffixes.
|
||||
* Returns the first asset ID that returns a valid owner record, or null if none found.
|
||||
@@ -366,4 +383,5 @@ module.exports = {
|
||||
redirectAsset,
|
||||
invalidateToken,
|
||||
resolveAssetId,
|
||||
searchByIvantiHostId,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user