@socketsecurity/cli-with-sentry 0.14.64 → 0.14.66

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.
@@ -21,9 +21,6 @@ var arrays = require('@socketsecurity/registry/lib/arrays');
21
21
  var debug = require('@socketsecurity/registry/lib/debug');
22
22
  var objects = require('@socketsecurity/registry/lib/objects');
23
23
  var npa = _socketInterop(require('npm-package-arg'));
24
- var events = require('node:events');
25
- var https = require('node:https');
26
- var readline = require('node:readline');
27
24
  var hpagent = _socketInterop(require('hpagent'));
28
25
  var isInteractive = require('@socketregistry/is-interactive/index.cjs');
29
26
  var registryConstants = require('@socketsecurity/registry/lib/constants');
@@ -75,11 +72,11 @@ function isErrnoException(value) {
75
72
  }
76
73
 
77
74
  const {
78
- abortSignal: abortSignal$2
75
+ abortSignal
79
76
  } = constants;
80
77
  async function findUp(name, {
81
78
  cwd = process$1.cwd(),
82
- signal = abortSignal$2
79
+ signal = abortSignal
83
80
  }) {
84
81
  let dir = path.resolve(cwd);
85
82
  const {
@@ -106,14 +103,14 @@ async function findUp(name, {
106
103
  }
107
104
  async function readFileBinary(filepath, options) {
108
105
  return await fs.promises.readFile(filepath, {
109
- signal: abortSignal$2,
106
+ signal: abortSignal,
110
107
  ...options,
111
108
  encoding: 'binary'
112
109
  });
113
110
  }
114
111
  async function readFileUtf8(filepath, options) {
115
112
  return await fs.promises.readFile(filepath, {
116
- signal: abortSignal$2,
113
+ signal: abortSignal,
117
114
  ...options,
118
115
  encoding: 'utf8'
119
116
  });
@@ -122,7 +119,7 @@ async function safeReadFile(filepath, options) {
122
119
  try {
123
120
  return await fs.promises.readFile(filepath, {
124
121
  encoding: 'utf8',
125
- signal: abortSignal$2,
122
+ signal: abortSignal,
126
123
  ...(typeof options === 'string' ? {
127
124
  encoding: options
128
125
  } : options)
@@ -288,7 +285,7 @@ function getDefaultToken() {
288
285
  return _defaultToken;
289
286
  }
290
287
  function getPublicToken() {
291
- return getDefaultToken() ?? registryConstants.SOCKET_PUBLIC_API_TOKEN;
288
+ return (process$1.env['SOCKET_SECURITY_API_TOKEN'] || getDefaultToken()) ?? registryConstants.SOCKET_PUBLIC_API_TOKEN;
292
289
  }
293
290
  async function setupSdk(apiToken = getDefaultToken(), apiBaseUrl = getDefaultApiBaseUrl(), proxy = getDefaultHttpProxy()) {
294
291
  if (typeof apiToken !== 'string' && isInteractive()) {
@@ -309,7 +306,7 @@ async function setupSdk(apiToken = getDefaultToken(), apiBaseUrl = getDefaultApi
309
306
  // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_NAME']".
310
307
  name: "@socketsecurity/cli",
311
308
  // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
312
- version: "0.14.64",
309
+ version: "0.14.66",
313
310
  // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_HOMEPAGE']".
314
311
  homepage: "https://github.com/SocketDev/socket-cli"
315
312
  })
@@ -1025,132 +1022,21 @@ const {
1025
1022
  ALERT_TYPE_CRITICAL_CVE,
1026
1023
  ALERT_TYPE_CVE,
1027
1024
  ALERT_TYPE_MEDIUM_CVE,
1028
- ALERT_TYPE_MILD_CVE,
1029
- ALERT_TYPE_SOCKET_UPGRADE_AVAILABLE,
1030
- CVE_ALERT_PROPS_FIRST_PATCHED_VERSION_IDENTIFIER: CVE_ALERT_PROPS_FIRST_PATCHED_VERSION_IDENTIFIER$1,
1031
- CVE_ALERT_PROPS_VULNERABLE_VERSION_RANGE,
1032
- abortSignal: abortSignal$1
1025
+ ALERT_TYPE_MILD_CVE
1033
1026
  } = constants;
1034
- async function* createBatchGenerator(chunk) {
1035
- // Adds the first 'abort' listener to abortSignal.
1036
- const req = https
1037
- // Lazily access constants.BATCH_PURL_ENDPOINT.
1038
- .request(constants.BATCH_PURL_ENDPOINT, {
1039
- method: 'POST',
1040
- headers: {
1041
- Authorization: `Basic ${btoa(`${getPublicToken()}:`)}`
1042
- }
1043
- // TODO: Fix to not abort process on network abort.
1044
- // signal: abortSignal
1045
- }).end(JSON.stringify({
1046
- components: chunk.map(id => ({
1047
- purl: `pkg:npm/${id}`
1048
- }))
1049
- }));
1050
- // Adds the second 'abort' listener to abortSignal.
1051
- const {
1052
- 0: res
1053
- } = await events.once(req, 'response', {
1054
- signal: abortSignal$1
1055
- });
1056
- const ok = res.statusCode >= 200 && res.statusCode <= 299;
1057
- if (!ok) {
1058
- throw new Error(`Socket API Error: ${res.statusCode}`);
1059
- }
1060
- const rli = readline.createInterface({
1061
- input: res,
1062
- crlfDelay: Infinity,
1063
- signal: abortSignal$1
1064
- });
1065
- for await (const line of rli) {
1066
- yield JSON.parse(line);
1067
- }
1068
- }
1069
- async function* batchScan(pkgIds, concurrencyLimit = 50) {
1070
- // The createBatchGenerator method will add 2 'abort' event listeners to
1071
- // abortSignal so we multiply the concurrencyLimit by 2.
1072
- const neededMaxListeners = concurrencyLimit * 2;
1073
- // Increase abortSignal max listeners count to avoid Node's MaxListenersExceededWarning.
1074
- const oldAbortSignalMaxListeners = events.getMaxListeners(abortSignal$1);
1075
- let abortSignalMaxListeners = oldAbortSignalMaxListeners;
1076
- if (oldAbortSignalMaxListeners < neededMaxListeners) {
1077
- abortSignalMaxListeners = oldAbortSignalMaxListeners + neededMaxListeners;
1078
- events.setMaxListeners(abortSignalMaxListeners, abortSignal$1);
1079
- }
1080
- const {
1081
- length: pkgIdsCount
1082
- } = pkgIds;
1083
- const running = [];
1084
- let index = 0;
1085
- const enqueueGen = () => {
1086
- if (index >= pkgIdsCount) {
1087
- // No more work to do.
1088
- return;
1089
- }
1090
- const chunk = pkgIds.slice(index, index + 25);
1091
- index += 25;
1092
- const generator = createBatchGenerator(chunk);
1093
- continueGen(generator);
1094
- };
1095
- const continueGen = generator => {
1096
- let resolveFn;
1097
- running.push({
1098
- generator,
1099
- promise: new Promise(resolve => resolveFn = resolve)
1100
- });
1101
- void generator.next().then(res => resolveFn({
1102
- generator,
1103
- iteratorResult: res
1104
- }));
1105
- };
1106
- // Start initial batch of generators.
1107
- while (running.length < concurrencyLimit && index < pkgIdsCount) {
1108
- enqueueGen();
1109
- }
1110
- while (running.length > 0) {
1111
- // eslint-disable-next-line no-await-in-loop
1112
- const {
1113
- generator,
1114
- iteratorResult
1115
- } = await Promise.race(running.map(entry => entry.promise));
1116
- // Remove generator.
1117
- running.splice(running.findIndex(entry => entry.generator === generator), 1);
1118
- if (iteratorResult.done) {
1119
- // Start a new generator if available.
1120
- enqueueGen();
1121
- } else {
1122
- yield iteratorResult.value;
1123
- // Keep fetching values from this generator.
1124
- continueGen(generator);
1125
- }
1126
- }
1127
- // Reset abortSignal max listeners count.
1128
- if (abortSignalMaxListeners > oldAbortSignalMaxListeners) {
1129
- events.setMaxListeners(oldAbortSignalMaxListeners, abortSignal$1);
1130
- }
1131
- }
1132
1027
  function isArtifactAlertCve(alert) {
1133
1028
  const {
1134
1029
  type
1135
1030
  } = alert;
1136
1031
  return type === ALERT_TYPE_CVE || type === ALERT_TYPE_MEDIUM_CVE || type === ALERT_TYPE_MILD_CVE || type === ALERT_TYPE_CRITICAL_CVE;
1137
1032
  }
1138
- function isArtifactAlertCveFixable(alert) {
1139
- if (!isArtifactAlertCve(alert)) {
1140
- return false;
1141
- }
1142
- const {
1143
- props
1144
- } = alert;
1145
- return !!props?.[CVE_ALERT_PROPS_FIRST_PATCHED_VERSION_IDENTIFIER$1] && !!props?.[CVE_ALERT_PROPS_VULNERABLE_VERSION_RANGE];
1146
- }
1147
- function isArtifactAlertUpgrade(alert) {
1148
- return alert.type === ALERT_TYPE_SOCKET_UPGRADE_AVAILABLE;
1149
- }
1150
1033
 
1151
- const {
1152
- abortSignal
1153
- } = constants;
1034
+ let ALERT_FIX_TYPE = /*#__PURE__*/function (ALERT_FIX_TYPE) {
1035
+ ALERT_FIX_TYPE["cve"] = "cve";
1036
+ ALERT_FIX_TYPE["upgrade"] = "upgrade";
1037
+ return ALERT_FIX_TYPE;
1038
+ }({});
1039
+
1154
1040
  const ERROR_UX = {
1155
1041
  block: true,
1156
1042
  display: true
@@ -1283,83 +1169,80 @@ function createAlertUXLookup(settings) {
1283
1169
  }
1284
1170
  let _uxLookup;
1285
1171
  async function uxLookup(settings) {
1286
- while (_uxLookup === undefined) {
1287
- // eslint-disable-next-line no-await-in-loop
1288
- await promises.setTimeout(1, {
1289
- signal: abortSignal
1290
- });
1291
- }
1292
- return _uxLookup(settings);
1293
- }
1294
-
1295
- // Start initializing the AlertUxLookupResult immediately.
1296
- void (async () => {
1297
- const {
1298
- orgs,
1299
- settings
1300
- } = await (async () => {
1301
- try {
1302
- const sockSdk = await setupSdk(getPublicToken());
1303
- const orgResult = await sockSdk.getOrganizations();
1304
- if (!orgResult.success) {
1305
- throw new Error(`Failed to fetch Socket organization info: ${orgResult.error.message}`);
1306
- }
1307
- const orgs = [];
1308
- for (const org of Object.values(orgResult.data.organizations)) {
1309
- if (org) {
1310
- orgs.push(org);
1172
+ if (_uxLookup === undefined) {
1173
+ const {
1174
+ orgs,
1175
+ settings
1176
+ } = await (async () => {
1177
+ try {
1178
+ const sockSdk = await setupSdk(getPublicToken());
1179
+ const orgResult = await sockSdk.getOrganizations();
1180
+ if (!orgResult.success) {
1181
+ if (orgResult.status === 429) {
1182
+ throw new Error(`API token quota exceeded: ${orgResult.error}`);
1183
+ }
1184
+ throw new Error(`Failed to fetch Socket organization info: ${orgResult.error}`);
1311
1185
  }
1186
+ const {
1187
+ organizations
1188
+ } = orgResult.data;
1189
+ const orgs = [];
1190
+ for (const org of Object.values(organizations)) {
1191
+ if (org) {
1192
+ orgs.push(org);
1193
+ }
1194
+ }
1195
+ const settingsResult = await sockSdk.postSettings(orgs.map(org => ({
1196
+ organization: org.id
1197
+ })));
1198
+ if (!settingsResult.success) {
1199
+ throw new Error(`Failed to fetch API key settings: ${settingsResult.error}`);
1200
+ }
1201
+ return {
1202
+ orgs,
1203
+ settings: settingsResult.data
1204
+ };
1205
+ } catch (e) {
1206
+ const cause = objects.isObject(e) && 'cause' in e ? e['cause'] : undefined;
1207
+ if (isErrnoException(cause) && (cause.code === 'ENOTFOUND' || cause.code === 'ECONNREFUSED')) {
1208
+ throw new Error('Unable to connect to socket.dev, ensure internet connectivity before retrying', {
1209
+ cause: e
1210
+ });
1211
+ }
1212
+ throw e;
1312
1213
  }
1313
- const result = await sockSdk.postSettings(orgs.map(org => ({
1314
- organization: org.id
1315
- })));
1316
- if (!result.success) {
1317
- throw new Error(`Failed to fetch API key settings: ${result.error.message}`);
1318
- }
1319
- return {
1320
- orgs,
1321
- settings: result.data
1322
- };
1323
- } catch (e) {
1324
- const cause = objects.isObject(e) && 'cause' in e ? e['cause'] : undefined;
1325
- if (isErrnoException(cause) && (cause.code === 'ENOTFOUND' || cause.code === 'ECONNREFUSED')) {
1326
- throw new Error('Unable to connect to socket.dev, ensure internet connectivity before retrying', {
1327
- cause: e
1328
- });
1214
+ })();
1215
+ // Remove any organizations not being enforced.
1216
+ const enforcedOrgs = getSetting('enforcedOrgs') ?? [];
1217
+ for (const {
1218
+ 0: i,
1219
+ 1: org
1220
+ } of orgs.entries()) {
1221
+ if (!enforcedOrgs.includes(org.id)) {
1222
+ settings.entries.splice(i, 1);
1329
1223
  }
1330
- throw e;
1331
1224
  }
1332
- })();
1333
-
1334
- // Remove any organizations not being enforced.
1335
- const enforcedOrgs = getSetting('enforcedOrgs') ?? [];
1336
- for (const {
1337
- 0: i,
1338
- 1: org
1339
- } of orgs.entries()) {
1340
- if (!enforcedOrgs.includes(org.id)) {
1341
- settings.entries.splice(i, 1);
1342
- }
1343
- }
1344
- const socketYml = findSocketYmlSync();
1345
- if (socketYml) {
1346
- settings.entries.push({
1347
- start: socketYml.path,
1348
- settings: {
1349
- [socketYml.path]: {
1350
- deferTo: null,
1351
- // TODO: TypeScript complains about the type not matching. We should
1352
- // figure out why are providing
1353
- // issueRules: { [issueName: string]: boolean }
1354
- // but expecting
1355
- // issueRules: { [issueName: string]: { action: 'defer' | 'error' | 'ignore' | 'monitor' | 'warn' } }
1356
- issueRules: socketYml.parsed.issueRules
1225
+ const socketYml = findSocketYmlSync();
1226
+ if (socketYml) {
1227
+ settings.entries.push({
1228
+ start: socketYml.path,
1229
+ settings: {
1230
+ [socketYml.path]: {
1231
+ deferTo: null,
1232
+ // TODO: TypeScript complains about the type not matching. We should
1233
+ // figure out why are providing
1234
+ // issueRules: { [issueName: string]: boolean }
1235
+ // but expecting
1236
+ // issueRules: { [issueName: string]: { action: 'defer' | 'error' | 'ignore' | 'monitor' | 'warn' } }
1237
+ issueRules: socketYml.parsed.issueRules
1238
+ }
1357
1239
  }
1358
- }
1359
- });
1240
+ });
1241
+ }
1242
+ _uxLookup = createAlertUXLookup(settings);
1360
1243
  }
1361
- _uxLookup = createAlertUXLookup(settings);
1362
- })();
1244
+ return _uxLookup(settings);
1245
+ }
1363
1246
 
1364
1247
  function pick(input, keys) {
1365
1248
  const result = {};
@@ -1384,16 +1267,15 @@ function stringJoinWithSeparateFinalSeparator(list, separator = ' and ') {
1384
1267
  return `${values.join(', ')}${separator}${finalValue}`;
1385
1268
  }
1386
1269
 
1387
- let SEVERITY = /*#__PURE__*/function (SEVERITY) {
1388
- SEVERITY["critical"] = "critical";
1389
- SEVERITY["high"] = "high";
1390
- SEVERITY["middle"] = "middle";
1391
- SEVERITY["low"] = "low";
1392
- return SEVERITY;
1270
+ let ALERT_SEVERITY = /*#__PURE__*/function (ALERT_SEVERITY) {
1271
+ ALERT_SEVERITY["critical"] = "critical";
1272
+ ALERT_SEVERITY["high"] = "high";
1273
+ ALERT_SEVERITY["middle"] = "middle";
1274
+ ALERT_SEVERITY["low"] = "low";
1275
+ return ALERT_SEVERITY;
1393
1276
  }({});
1394
-
1395
1277
  // Ordered from most severe to least.
1396
- const SEVERITIES_BY_ORDER = ['critical', 'high', 'middle', 'low'];
1278
+ const SEVERITIES_BY_ORDER = Object.freeze(['critical', 'high', 'middle', 'low']);
1397
1279
  function getDesiredSeverities(lowestToInclude) {
1398
1280
  const result = [];
1399
1281
  for (const severity of SEVERITIES_BY_ORDER) {
@@ -1427,8 +1309,11 @@ function getSeverityCount(issues, lowestToInclude) {
1427
1309
  if (!value) {
1428
1310
  continue;
1429
1311
  }
1430
- if (severityCount[value.severity] !== undefined) {
1431
- severityCount[value.severity] += 1;
1312
+ const {
1313
+ severity
1314
+ } = value;
1315
+ if (severityCount[severity] !== undefined) {
1316
+ severityCount[severity] += 1;
1432
1317
  }
1433
1318
  }
1434
1319
  return severityCount;
@@ -1495,7 +1380,7 @@ const format = new ColorOrMarkdown(false);
1495
1380
  async function addArtifactToAlertsMap(artifact, alertsByPkgId, options) {
1496
1381
  // Make TypeScript happy.
1497
1382
  if (!artifact.name || !artifact.version || !artifact.alerts?.length) {
1498
- return;
1383
+ return alertsByPkgId;
1499
1384
  }
1500
1385
  const {
1501
1386
  consolidate = false,
@@ -1531,10 +1416,11 @@ async function addArtifactToAlertsMap(artifact, alertsByPkgId, options) {
1531
1416
  type: alert.type
1532
1417
  }
1533
1418
  });
1534
- const critical = alert.severity === SEVERITY.critical;
1419
+ const fixType = alert.fix?.type ?? '';
1420
+ const critical = alert.severity === ALERT_SEVERITY.critical;
1535
1421
  const cve = isArtifactAlertCve(alert);
1536
- const fixableCve = isArtifactAlertCveFixable(alert);
1537
- const fixableUpgrade = isArtifactAlertUpgrade(alert);
1422
+ const fixableCve = fixType === ALERT_FIX_TYPE.cve;
1423
+ const fixableUpgrade = fixType === ALERT_FIX_TYPE.upgrade;
1538
1424
  const fixable = fixableCve || fixableUpgrade;
1539
1425
  const upgrade = fixableUpgrade && !objects.hasOwn(overrides, name);
1540
1426
  if (include.cve && cve || include.unfixable && !fixable || include.critical && critical || include.upgrade && upgrade) {
@@ -1553,15 +1439,17 @@ async function addArtifactToAlertsMap(artifact, alertsByPkgId, options) {
1553
1439
  }
1554
1440
  }
1555
1441
  if (!sockPkgAlerts.length) {
1556
- return;
1442
+ return alertsByPkgId;
1557
1443
  }
1558
1444
  if (consolidate) {
1559
1445
  const highestForCve = new Map();
1560
1446
  const highestForUpgrade = new Map();
1561
1447
  const unfixableAlerts = [];
1562
1448
  for (const sockPkgAlert of sockPkgAlerts) {
1563
- if (isArtifactAlertCveFixable(sockPkgAlert.raw)) {
1564
- const patchedVersion = sockPkgAlert.raw.props[CVE_ALERT_PROPS_FIRST_PATCHED_VERSION_IDENTIFIER];
1449
+ const alert = sockPkgAlert.raw;
1450
+ const fixType = alert.fix?.type ?? '';
1451
+ if (fixType === ALERT_FIX_TYPE.cve) {
1452
+ const patchedVersion = alert.props[CVE_ALERT_PROPS_FIRST_PATCHED_VERSION_IDENTIFIER];
1565
1453
  const patchedMajor = semver.major(patchedVersion);
1566
1454
  const oldHighest = highestForCve.get(patchedMajor);
1567
1455
  const highest = oldHighest?.version ?? '0.0.0';
@@ -1571,7 +1459,7 @@ async function addArtifactToAlertsMap(artifact, alertsByPkgId, options) {
1571
1459
  version: patchedVersion
1572
1460
  });
1573
1461
  }
1574
- } else if (isArtifactAlertUpgrade(sockPkgAlert.raw)) {
1462
+ } else if (fixType === ALERT_FIX_TYPE.upgrade) {
1575
1463
  const oldHighest = highestForUpgrade.get(major);
1576
1464
  const highest = oldHighest?.version ?? '0.0.0';
1577
1465
  if (semver.gt(version, highest)) {
@@ -1586,11 +1474,11 @@ async function addArtifactToAlertsMap(artifact, alertsByPkgId, options) {
1586
1474
  }
1587
1475
  sockPkgAlerts = [...unfixableAlerts, ...[...highestForCve.values()].map(d => d.alert), ...[...highestForUpgrade.values()].map(d => d.alert)];
1588
1476
  }
1589
- if (!sockPkgAlerts.length) {
1590
- return;
1477
+ if (sockPkgAlerts.length) {
1478
+ sockPkgAlerts.sort((a, b) => sorts.naturalCompare(a.type, b.type));
1479
+ alertsByPkgId.set(pkgId, sockPkgAlerts);
1591
1480
  }
1592
- sockPkgAlerts.sort((a, b) => sorts.naturalCompare(a.type, b.type));
1593
- alertsByPkgId.set(pkgId, sockPkgAlerts);
1481
+ return alertsByPkgId;
1594
1482
  }
1595
1483
  function getCveInfoByAlertsMap(alertsMap, options) {
1596
1484
  const exclude = {
@@ -1601,11 +1489,12 @@ function getCveInfoByAlertsMap(alertsMap, options) {
1601
1489
  }.exclude
1602
1490
  };
1603
1491
  let infoByPkg = null;
1604
- for (const [pkgId, alerts] of alertsMap) {
1492
+ for (const [pkgId, sockPkgAlerts] of alertsMap) {
1605
1493
  const purlObj = packageurlJs.PackageURL.fromString(`pkg:npm/${pkgId}`);
1606
1494
  const name = packages.resolvePackageName(purlObj);
1607
- for (const alert of alerts) {
1608
- if (!isArtifactAlertCveFixable(alert.raw) || exclude.upgrade && registry.getManifestData(NPM$2, name)) {
1495
+ for (const sockPkgAlert of sockPkgAlerts) {
1496
+ const alert = sockPkgAlert.raw;
1497
+ if (alert.fix?.type !== ALERT_FIX_TYPE.cve || exclude.upgrade && registry.getManifestData(NPM$2, name)) {
1609
1498
  continue;
1610
1499
  }
1611
1500
  if (!infoByPkg) {
@@ -1619,7 +1508,7 @@ function getCveInfoByAlertsMap(alertsMap, options) {
1619
1508
  const {
1620
1509
  firstPatchedVersionIdentifier,
1621
1510
  vulnerableVersionRange
1622
- } = alert.raw.props;
1511
+ } = alert.props;
1623
1512
  infos.push({
1624
1513
  firstPatchedVersionIdentifier,
1625
1514
  vulnerableVersionRange: new semver.Range(vulnerableVersionRange).format()
@@ -1805,6 +1694,7 @@ async function getAlertsMapFromArborist(arb, options) {
1805
1694
  const include = {
1806
1695
  __proto__: null,
1807
1696
  existing: false,
1697
+ unfixable: true,
1808
1698
  ..._include
1809
1699
  };
1810
1700
  const needInfoOn = getDetailsFromDiff(arb.diff, {
@@ -1829,12 +1719,23 @@ async function getAlertsMapFromArborist(arb, options) {
1829
1719
  return [key, overrideSet.value];
1830
1720
  }));
1831
1721
  }
1722
+ const socketSdk = await setupSdk(getPublicToken());
1832
1723
  const toAlertsMapOptions = {
1833
1724
  overrides,
1834
1725
  ...options
1835
1726
  };
1836
- for await (const artifact of batchScan(pkgIds)) {
1837
- await addArtifactToAlertsMap(artifact, alertsByPkgId, toAlertsMapOptions);
1727
+ for await (const batchPackageFetchResult of socketSdk.batchPackageStream({
1728
+ alerts: 'true',
1729
+ compact: 'true',
1730
+ fixable: include.unfixable ? 'false' : 'true'
1731
+ }, {
1732
+ components: pkgIds.map(id => ({
1733
+ purl: `pkg:npm/${id}`
1734
+ }))
1735
+ })) {
1736
+ if (batchPackageFetchResult.success) {
1737
+ await addArtifactToAlertsMap(batchPackageFetchResult.data, alertsByPkgId, toAlertsMapOptions);
1738
+ }
1838
1739
  remaining -= 1;
1839
1740
  if (spinner && remaining > 0) {
1840
1741
  spinner.start();
@@ -2021,15 +1922,14 @@ function installSafeArborist() {
2021
1922
 
2022
1923
  installSafeArborist();
2023
1924
 
1925
+ exports.ALERT_SEVERITY = ALERT_SEVERITY;
2024
1926
  exports.Arborist = Arborist;
2025
1927
  exports.AuthError = AuthError;
2026
1928
  exports.ColorOrMarkdown = ColorOrMarkdown;
2027
1929
  exports.InputError = InputError;
2028
1930
  exports.SAFE_ARBORIST_REIFY_OPTIONS_OVERRIDES = SAFE_ARBORIST_REIFY_OPTIONS_OVERRIDES;
2029
- exports.SEVERITY = SEVERITY;
2030
1931
  exports.SafeArborist = SafeArborist;
2031
1932
  exports.addArtifactToAlertsMap = addArtifactToAlertsMap;
2032
- exports.batchScan = batchScan;
2033
1933
  exports.captureException = captureException;
2034
1934
  exports.findBestPatchVersion = findBestPatchVersion;
2035
1935
  exports.findPackageNodes = findPackageNodes;
@@ -2049,5 +1949,5 @@ exports.safeReadFile = safeReadFile;
2049
1949
  exports.setupSdk = setupSdk;
2050
1950
  exports.updateNode = updateNode;
2051
1951
  exports.updateSetting = updateSetting;
2052
- //# debugId=784d0ad3-abe9-4ea9-b089-280204b58b78
1952
+ //# debugId=86178861-a8cc-486b-ac92-f49e627e80af
2053
1953
  //# sourceMappingURL=shadow-npm-inject.js.map