@socketsecurity/cli 0.14.64 → 0.14.65
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/constants.d.ts +3 -4
- package/dist/constants.js +30 -37
- package/dist/constants.js.map +1 -1
- package/dist/module-sync/artifact.d.ts +12 -60
- package/dist/module-sync/cli.js +507 -264
- package/dist/module-sync/cli.js.map +1 -1
- package/dist/module-sync/shadow-npm-inject.js +100 -212
- package/dist/module-sync/shadow-npm-inject.js.map +1 -1
- package/dist/module-sync/shadow-npm-paths.js +22 -12
- package/dist/module-sync/shadow-npm-paths.js.map +1 -1
- package/dist/require/cli.js +507 -264
- package/dist/require/cli.js.map +1 -1
- package/package.json +8 -11
- package/dist/module-sync/fs.d.ts +0 -22
package/dist/require/cli.js
CHANGED
|
@@ -20,6 +20,7 @@ var commonTags = _socketInterop(require('common-tags'));
|
|
|
20
20
|
var fs = require('node:fs/promises');
|
|
21
21
|
var ScreenWidget = _socketInterop(require('blessed/lib/widgets/screen'));
|
|
22
22
|
var contrib = _socketInterop(require('blessed-contrib'));
|
|
23
|
+
var strings = require('@socketsecurity/registry/lib/strings');
|
|
23
24
|
var shadowNpmInject = require('./shadow-npm-inject.js');
|
|
24
25
|
var constants = require('./constants.js');
|
|
25
26
|
var path$1 = require('node:path');
|
|
@@ -46,7 +47,6 @@ var semver = _socketInterop(require('semver'));
|
|
|
46
47
|
var which = _socketInterop(require('which'));
|
|
47
48
|
var index_cjs = require('@socketregistry/hyrious__bun.lockb/index.cjs');
|
|
48
49
|
var sorts = require('@socketsecurity/registry/lib/sorts');
|
|
49
|
-
var strings = require('@socketsecurity/registry/lib/strings');
|
|
50
50
|
var registryConstants = require('@socketsecurity/registry/lib/constants');
|
|
51
51
|
var isInteractive = require('@socketregistry/is-interactive/index.cjs');
|
|
52
52
|
var terminalLink = _socketInterop(require('terminal-link'));
|
|
@@ -62,9 +62,6 @@ var BoxWidget = _socketInterop(require('blessed/lib/widgets/box'));
|
|
|
62
62
|
var TableWidget = _socketInterop(require('blessed-contrib/lib/widget/table'));
|
|
63
63
|
var readline$1 = require('node:readline');
|
|
64
64
|
|
|
65
|
-
const {
|
|
66
|
-
API_V0_URL
|
|
67
|
-
} = constants;
|
|
68
65
|
function handleUnsuccessfulApiResponse(_name, result) {
|
|
69
66
|
// SocketSdkErrorType['error'] is not typed.
|
|
70
67
|
const resultErrorMessage = result.error?.message;
|
|
@@ -96,13 +93,20 @@ async function handleAPIError(code) {
|
|
|
96
93
|
return 'One of the options passed might be incorrect.';
|
|
97
94
|
} else if (code === 403) {
|
|
98
95
|
return 'You might be trying to access an organization that is not linked to the API key you are logged in with.';
|
|
99
|
-
}
|
|
96
|
+
} else ;
|
|
100
97
|
}
|
|
101
98
|
function getLastFiveOfApiToken(token) {
|
|
102
99
|
// Get the last 5 characters of the API token before the trailing "_api".
|
|
103
100
|
return token.slice(-9, -4);
|
|
104
101
|
}
|
|
102
|
+
|
|
103
|
+
// The API server that should be used for operations.
|
|
104
|
+
function getDefaultApiBaseUrl() {
|
|
105
|
+
const baseUrl = process$1.env['SOCKET_SECURITY_API_BASE_URL'] || shadowNpmInject.getSetting('apiBaseUrl');
|
|
106
|
+
return strings.isNonEmptyString(baseUrl) ? baseUrl : undefined;
|
|
107
|
+
}
|
|
105
108
|
async function queryAPI(path, apiToken) {
|
|
109
|
+
const API_V0_URL = getDefaultApiBaseUrl();
|
|
106
110
|
return await fetch(`${API_V0_URL}/${path}`, {
|
|
107
111
|
method: 'GET',
|
|
108
112
|
headers: {
|
|
@@ -648,7 +652,7 @@ function emitBanner(name) {
|
|
|
648
652
|
}
|
|
649
653
|
function getAsciiHeader(command) {
|
|
650
654
|
const cliVersion = // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION_HASH']".
|
|
651
|
-
"0.14.
|
|
655
|
+
"0.14.65:ace6cae:9b43c652:pub";
|
|
652
656
|
const nodeVersion = process.version;
|
|
653
657
|
const apiToken = shadowNpmInject.getSetting('apiToken');
|
|
654
658
|
const shownToken = apiToken ? getLastFiveOfApiToken(apiToken) : 'no';
|
|
@@ -773,7 +777,7 @@ async function run$C(argv, importMeta, {
|
|
|
773
777
|
});
|
|
774
778
|
}
|
|
775
779
|
|
|
776
|
-
async function
|
|
780
|
+
async function fetchAuditLog({
|
|
777
781
|
logType,
|
|
778
782
|
orgSlug,
|
|
779
783
|
outputKind,
|
|
@@ -784,16 +788,59 @@ async function getAuditLog({
|
|
|
784
788
|
if (!apiToken) {
|
|
785
789
|
throw new shadowNpmInject.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
|
|
786
790
|
}
|
|
787
|
-
|
|
788
|
-
|
|
791
|
+
return await fetchAuditLogWithToken(apiToken, {
|
|
792
|
+
logType,
|
|
789
793
|
orgSlug,
|
|
790
794
|
outputKind,
|
|
791
795
|
page,
|
|
792
|
-
perPage
|
|
793
|
-
logType
|
|
796
|
+
perPage
|
|
794
797
|
});
|
|
795
|
-
|
|
796
|
-
|
|
798
|
+
}
|
|
799
|
+
async function fetchAuditLogWithToken(apiToken, {
|
|
800
|
+
logType,
|
|
801
|
+
orgSlug,
|
|
802
|
+
outputKind,
|
|
803
|
+
page,
|
|
804
|
+
perPage
|
|
805
|
+
}) {
|
|
806
|
+
// Lazily access constants.spinner.
|
|
807
|
+
const {
|
|
808
|
+
spinner
|
|
809
|
+
} = constants;
|
|
810
|
+
spinner.start(`Looking up audit log for ${orgSlug}`);
|
|
811
|
+
const socketSdk = await shadowNpmInject.setupSdk(apiToken);
|
|
812
|
+
const result = await handleApiCall(socketSdk.getAuditLogEvents(orgSlug, {
|
|
813
|
+
// I'm not sure this is used at all.
|
|
814
|
+
outputJson: String(outputKind === 'json'),
|
|
815
|
+
// I'm not sure this is used at all.
|
|
816
|
+
outputMarkdown: String(outputKind === 'markdown'),
|
|
817
|
+
orgSlug,
|
|
818
|
+
type: logType,
|
|
819
|
+
page: String(page),
|
|
820
|
+
per_page: String(perPage)
|
|
821
|
+
}), `Looking up audit log for ${orgSlug}\n`);
|
|
822
|
+
if (!result.success) {
|
|
823
|
+
handleUnsuccessfulApiResponse('getAuditLogEvents', result);
|
|
824
|
+
return;
|
|
825
|
+
}
|
|
826
|
+
spinner.stop();
|
|
827
|
+
return result.data;
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
async function outputAuditLog(auditLogs, {
|
|
831
|
+
logType,
|
|
832
|
+
orgSlug,
|
|
833
|
+
outputKind,
|
|
834
|
+
page,
|
|
835
|
+
perPage
|
|
836
|
+
}) {
|
|
837
|
+
if (outputKind === 'json') {
|
|
838
|
+
await outputAsJson(auditLogs.results, orgSlug, logType, page, perPage);
|
|
839
|
+
} else if (outputKind === 'markdown') {
|
|
840
|
+
await outputAsMarkdown(auditLogs.results, orgSlug, logType, page, perPage);
|
|
841
|
+
} else {
|
|
842
|
+
await outputAsPrint(auditLogs.results, orgSlug, logType);
|
|
843
|
+
}
|
|
797
844
|
}
|
|
798
845
|
async function outputAsJson(auditLogs, orgSlug, logType, page, perPage) {
|
|
799
846
|
let json;
|
|
@@ -879,36 +926,29 @@ async function outputAsPrint(auditLogs, orgSlug, logType) {
|
|
|
879
926
|
pageSize: 30
|
|
880
927
|
})]);
|
|
881
928
|
}
|
|
882
|
-
|
|
883
|
-
|
|
929
|
+
|
|
930
|
+
async function handleAuditLog({
|
|
884
931
|
logType,
|
|
885
932
|
orgSlug,
|
|
886
933
|
outputKind,
|
|
887
934
|
page,
|
|
888
935
|
perPage
|
|
889
936
|
}) {
|
|
890
|
-
|
|
891
|
-
const {
|
|
892
|
-
spinner
|
|
893
|
-
} = constants;
|
|
894
|
-
spinner.start(`Looking up audit log for ${orgSlug}`);
|
|
895
|
-
const socketSdk = await shadowNpmInject.setupSdk(apiToken);
|
|
896
|
-
const result = await handleApiCall(socketSdk.getAuditLogEvents(orgSlug, {
|
|
897
|
-
// I'm not sure this is used at all.
|
|
898
|
-
outputJson: String(outputKind === 'json'),
|
|
899
|
-
// I'm not sure this is used at all.
|
|
900
|
-
outputMarkdown: String(outputKind === 'markdown'),
|
|
937
|
+
const auditLogs = await fetchAuditLog({
|
|
901
938
|
orgSlug,
|
|
902
|
-
|
|
903
|
-
page
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
939
|
+
outputKind,
|
|
940
|
+
page,
|
|
941
|
+
perPage,
|
|
942
|
+
logType
|
|
943
|
+
});
|
|
944
|
+
if (!auditLogs) return;
|
|
945
|
+
await outputAuditLog(auditLogs, {
|
|
946
|
+
logType,
|
|
947
|
+
orgSlug,
|
|
948
|
+
outputKind,
|
|
949
|
+
page,
|
|
950
|
+
perPage
|
|
951
|
+
});
|
|
912
952
|
}
|
|
913
953
|
|
|
914
954
|
const {
|
|
@@ -992,7 +1032,7 @@ async function run$B(argv, importMeta, {
|
|
|
992
1032
|
logger.logger.log(DRY_RUN_BAIL_TEXT$A);
|
|
993
1033
|
return;
|
|
994
1034
|
}
|
|
995
|
-
await
|
|
1035
|
+
await handleAuditLog({
|
|
996
1036
|
orgSlug,
|
|
997
1037
|
outputKind: json ? 'json' : markdown ? 'markdown' : 'print',
|
|
998
1038
|
page: Number(page || 0),
|
|
@@ -1251,36 +1291,60 @@ async function run$A(argv, importMeta, {
|
|
|
1251
1291
|
await runCycloneDX(yargv);
|
|
1252
1292
|
}
|
|
1253
1293
|
|
|
1254
|
-
|
|
1255
|
-
async function findDependencies({
|
|
1294
|
+
async function fetchDependencies({
|
|
1256
1295
|
limit,
|
|
1257
|
-
offset
|
|
1258
|
-
outputJson
|
|
1296
|
+
offset
|
|
1259
1297
|
}) {
|
|
1260
1298
|
const apiToken = shadowNpmInject.getDefaultToken();
|
|
1261
1299
|
if (!apiToken) {
|
|
1262
1300
|
throw new shadowNpmInject.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
|
|
1263
1301
|
}
|
|
1302
|
+
return await fetchDependenciesWithToken(apiToken, {
|
|
1303
|
+
limit,
|
|
1304
|
+
offset
|
|
1305
|
+
});
|
|
1306
|
+
}
|
|
1307
|
+
async function fetchDependenciesWithToken(apiToken, {
|
|
1308
|
+
limit,
|
|
1309
|
+
offset
|
|
1310
|
+
}) {
|
|
1264
1311
|
// Lazily access constants.spinner.
|
|
1265
1312
|
const {
|
|
1266
1313
|
spinner
|
|
1267
1314
|
} = constants;
|
|
1268
|
-
spinner.start('
|
|
1315
|
+
spinner.start('Fetching organization dependencies...');
|
|
1269
1316
|
const socketSdk = await shadowNpmInject.setupSdk(apiToken);
|
|
1270
1317
|
const result = await handleApiCall(socketSdk.searchDependencies({
|
|
1271
1318
|
limit,
|
|
1272
1319
|
offset
|
|
1273
1320
|
}), 'Searching dependencies');
|
|
1321
|
+
spinner?.successAndStop('Received organization dependencies response.');
|
|
1274
1322
|
if (!result.success) {
|
|
1275
1323
|
handleUnsuccessfulApiResponse('searchDependencies', result);
|
|
1276
1324
|
return;
|
|
1277
1325
|
}
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1326
|
+
return result.data;
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
// @ts-ignore
|
|
1330
|
+
async function outputDependencies(data, {
|
|
1331
|
+
limit,
|
|
1332
|
+
offset,
|
|
1333
|
+
outputKind
|
|
1334
|
+
}) {
|
|
1335
|
+
if (outputKind === 'json') {
|
|
1336
|
+
let json;
|
|
1337
|
+
try {
|
|
1338
|
+
json = JSON.stringify(data, null, 2);
|
|
1339
|
+
} catch (e) {
|
|
1340
|
+
process.exitCode = 1;
|
|
1341
|
+
logger.logger.fail('There was a problem converting the data to JSON, please try without the `--json` flag');
|
|
1342
|
+
return;
|
|
1343
|
+
}
|
|
1344
|
+
logger.logger.log(json);
|
|
1281
1345
|
return;
|
|
1282
1346
|
}
|
|
1283
|
-
logger.logger.log('Request details: Offset:', offset, ', limit:', limit, ', is there more data after this?',
|
|
1347
|
+
logger.logger.log('Request details: Offset:', offset, ', limit:', limit, ', is there more data after this?', data.end ? 'no' : 'yes');
|
|
1284
1348
|
const options = {
|
|
1285
1349
|
columns: [{
|
|
1286
1350
|
field: 'namespace',
|
|
@@ -1305,7 +1369,24 @@ async function findDependencies({
|
|
|
1305
1369
|
name: colors.cyan('Direct')
|
|
1306
1370
|
}]
|
|
1307
1371
|
};
|
|
1308
|
-
logger.logger.log(chalkTable(options,
|
|
1372
|
+
logger.logger.log(chalkTable(options, data.rows));
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
async function handleDependencies({
|
|
1376
|
+
limit,
|
|
1377
|
+
offset,
|
|
1378
|
+
outputKind
|
|
1379
|
+
}) {
|
|
1380
|
+
const data = await fetchDependencies({
|
|
1381
|
+
limit,
|
|
1382
|
+
offset
|
|
1383
|
+
});
|
|
1384
|
+
if (!data) return;
|
|
1385
|
+
await outputDependencies(data, {
|
|
1386
|
+
limit,
|
|
1387
|
+
offset,
|
|
1388
|
+
outputKind
|
|
1389
|
+
});
|
|
1309
1390
|
}
|
|
1310
1391
|
|
|
1311
1392
|
const {
|
|
@@ -1356,70 +1437,71 @@ async function run$z(argv, importMeta, {
|
|
|
1356
1437
|
importMeta,
|
|
1357
1438
|
parentName
|
|
1358
1439
|
});
|
|
1440
|
+
const {
|
|
1441
|
+
json,
|
|
1442
|
+
limit,
|
|
1443
|
+
markdown,
|
|
1444
|
+
offset
|
|
1445
|
+
} = cli.flags;
|
|
1359
1446
|
if (cli.flags['dryRun']) {
|
|
1360
1447
|
logger.logger.log(DRY_RUN_BAIL_TEXT$y);
|
|
1361
1448
|
return;
|
|
1362
1449
|
}
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
offset: Number(cli.flags['offset'] || 0) || 0,
|
|
1368
|
-
outputJson: Boolean(cli.flags['json'])
|
|
1450
|
+
await handleDependencies({
|
|
1451
|
+
limit: Number(limit || 0) || 0,
|
|
1452
|
+
offset: Number(offset || 0) || 0,
|
|
1453
|
+
outputKind: json ? 'json' : markdown ? 'markdown' : 'text'
|
|
1369
1454
|
});
|
|
1370
1455
|
}
|
|
1371
1456
|
|
|
1372
|
-
async function
|
|
1457
|
+
async function fetchDiffScan({
|
|
1373
1458
|
after,
|
|
1374
1459
|
before,
|
|
1375
|
-
|
|
1376
|
-
file,
|
|
1377
|
-
orgSlug,
|
|
1378
|
-
outputJson
|
|
1460
|
+
orgSlug
|
|
1379
1461
|
}) {
|
|
1380
1462
|
const apiToken = shadowNpmInject.getDefaultToken();
|
|
1381
1463
|
if (!apiToken) {
|
|
1382
1464
|
throw new shadowNpmInject.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
|
|
1383
1465
|
}
|
|
1384
|
-
await
|
|
1466
|
+
return await fetchDiffScanWithToken(apiToken, {
|
|
1385
1467
|
after,
|
|
1386
1468
|
before,
|
|
1387
|
-
|
|
1388
|
-
file,
|
|
1389
|
-
orgSlug,
|
|
1390
|
-
outputJson,
|
|
1391
|
-
apiToken
|
|
1469
|
+
orgSlug
|
|
1392
1470
|
});
|
|
1393
1471
|
}
|
|
1394
|
-
async function
|
|
1472
|
+
async function fetchDiffScanWithToken(apiToken, {
|
|
1395
1473
|
after,
|
|
1396
|
-
apiToken,
|
|
1397
1474
|
before,
|
|
1398
|
-
|
|
1399
|
-
file,
|
|
1400
|
-
orgSlug,
|
|
1401
|
-
outputJson
|
|
1475
|
+
orgSlug
|
|
1402
1476
|
}) {
|
|
1403
1477
|
// Lazily access constants.spinner.
|
|
1404
1478
|
const {
|
|
1405
1479
|
spinner
|
|
1406
1480
|
} = constants;
|
|
1407
|
-
spinner.start('
|
|
1481
|
+
spinner.start('Fetching diff-scan...');
|
|
1408
1482
|
const response = await queryAPI(`orgs/${orgSlug}/full-scans/diff?before=${encodeURIComponent(before)}&after=${encodeURIComponent(after)}`, apiToken);
|
|
1483
|
+
spinner?.successAndStop('Received diff-scan response');
|
|
1409
1484
|
if (!response.ok) {
|
|
1410
1485
|
const err = await handleAPIError(response.status);
|
|
1411
1486
|
spinner.errorAndStop(`${colors.bgRed(colors.white(response.statusText))}: ${err}`);
|
|
1412
1487
|
return;
|
|
1413
1488
|
}
|
|
1414
1489
|
const result = await handleApiCall(await response.json(), 'Deserializing json');
|
|
1415
|
-
|
|
1416
|
-
|
|
1490
|
+
return result;
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
async function outputDiffScan(result, {
|
|
1494
|
+
depth,
|
|
1495
|
+
file,
|
|
1496
|
+
outputKind
|
|
1497
|
+
}) {
|
|
1498
|
+
const dashboardUrl = result.diff_report_url;
|
|
1417
1499
|
const dashboardMessage = dashboardUrl ? `\n View this diff scan in the Socket dashboard: ${colors.cyan(dashboardUrl)}` : '';
|
|
1418
1500
|
|
|
1419
1501
|
// When forcing json, or dumping to file, serialize to string such that it
|
|
1420
1502
|
// won't get truncated. The only way to dump the full raw JSON to stdout is
|
|
1421
1503
|
// to use `--json --file -` (the dash is a standard notation for stdout)
|
|
1422
|
-
if (
|
|
1504
|
+
if (outputKind === 'json' || file) {
|
|
1423
1505
|
let json;
|
|
1424
1506
|
try {
|
|
1425
1507
|
json = JSON.stringify(result, null, 2);
|
|
@@ -1464,6 +1546,27 @@ async function getDiffScanWithToken({
|
|
|
1464
1546
|
logger.logger.log(dashboardMessage);
|
|
1465
1547
|
}
|
|
1466
1548
|
|
|
1549
|
+
async function handleDiffScan({
|
|
1550
|
+
after,
|
|
1551
|
+
before,
|
|
1552
|
+
depth,
|
|
1553
|
+
file,
|
|
1554
|
+
orgSlug,
|
|
1555
|
+
outputKind
|
|
1556
|
+
}) {
|
|
1557
|
+
const data = await fetchDiffScan({
|
|
1558
|
+
after,
|
|
1559
|
+
before,
|
|
1560
|
+
orgSlug
|
|
1561
|
+
});
|
|
1562
|
+
if (!data) return;
|
|
1563
|
+
await outputDiffScan(data, {
|
|
1564
|
+
depth,
|
|
1565
|
+
file,
|
|
1566
|
+
outputKind
|
|
1567
|
+
});
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1467
1570
|
const {
|
|
1468
1571
|
DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$x
|
|
1469
1572
|
} = constants;
|
|
@@ -1532,8 +1635,14 @@ async function run$y(argv, importMeta, {
|
|
|
1532
1635
|
importMeta,
|
|
1533
1636
|
parentName
|
|
1534
1637
|
});
|
|
1535
|
-
const
|
|
1536
|
-
|
|
1638
|
+
const {
|
|
1639
|
+
after,
|
|
1640
|
+
before,
|
|
1641
|
+
depth,
|
|
1642
|
+
file,
|
|
1643
|
+
json,
|
|
1644
|
+
markdown
|
|
1645
|
+
} = cli.flags;
|
|
1537
1646
|
const [orgSlug = ''] = cli.input;
|
|
1538
1647
|
if (!before || !after || cli.input.length < 1) {
|
|
1539
1648
|
// Use exit status of 2 to indicate incorrect usage, generally invalid
|
|
@@ -1551,13 +1660,13 @@ async function run$y(argv, importMeta, {
|
|
|
1551
1660
|
logger.logger.log(DRY_RUN_BAIL_TEXT$x);
|
|
1552
1661
|
return;
|
|
1553
1662
|
}
|
|
1554
|
-
await
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
depth: Number(cli.flags['depth']),
|
|
1663
|
+
await handleDiffScan({
|
|
1664
|
+
before: String(before || ''),
|
|
1665
|
+
after: String(after || ''),
|
|
1666
|
+
depth: Number(depth),
|
|
1559
1667
|
orgSlug,
|
|
1560
|
-
|
|
1668
|
+
outputKind: json ? 'json' : markdown ? 'markdown' : 'text',
|
|
1669
|
+
file: String(file || '')
|
|
1561
1670
|
});
|
|
1562
1671
|
}
|
|
1563
1672
|
|
|
@@ -1696,11 +1805,17 @@ async function npmFix(_pkgEnvDetails, cwd, options) {
|
|
|
1696
1805
|
|
|
1697
1806
|
async function getAlertsMapFromPnpmLockfile(lockfile, options) {
|
|
1698
1807
|
const {
|
|
1808
|
+
include: _include,
|
|
1699
1809
|
spinner
|
|
1700
1810
|
} = {
|
|
1701
1811
|
__proto__: null,
|
|
1702
1812
|
...options
|
|
1703
1813
|
};
|
|
1814
|
+
const include = {
|
|
1815
|
+
__proto__: null,
|
|
1816
|
+
unfixable: true,
|
|
1817
|
+
..._include
|
|
1818
|
+
};
|
|
1704
1819
|
const depTypes = lockfile_detectDepTypes.detectDepTypes(lockfile);
|
|
1705
1820
|
const pkgIds = Object.keys(depTypes);
|
|
1706
1821
|
let {
|
|
@@ -1712,12 +1827,23 @@ async function getAlertsMapFromPnpmLockfile(lockfile, options) {
|
|
|
1712
1827
|
}
|
|
1713
1828
|
const getText = () => `Looking up data for ${remaining} packages`;
|
|
1714
1829
|
spinner?.start(getText());
|
|
1830
|
+
const socketSdk = await shadowNpmInject.setupSdk(shadowNpmInject.getPublicToken());
|
|
1715
1831
|
const toAlertsMapOptions = {
|
|
1716
1832
|
overrides: lockfile.overrides,
|
|
1717
1833
|
...options
|
|
1718
1834
|
};
|
|
1719
|
-
for await (const
|
|
1720
|
-
|
|
1835
|
+
for await (const batchPackageFetchResult of socketSdk.batchPackageStream({
|
|
1836
|
+
alerts: 'true',
|
|
1837
|
+
compact: 'true',
|
|
1838
|
+
fixable: include.unfixable ? 'false' : 'true'
|
|
1839
|
+
}, {
|
|
1840
|
+
components: pkgIds.map(id => ({
|
|
1841
|
+
purl: `pkg:npm/${id}`
|
|
1842
|
+
}))
|
|
1843
|
+
})) {
|
|
1844
|
+
if (batchPackageFetchResult.success) {
|
|
1845
|
+
await shadowNpmInject.addArtifactToAlertsMap(batchPackageFetchResult.data, alertsByPkgId, toAlertsMapOptions);
|
|
1846
|
+
}
|
|
1721
1847
|
remaining -= 1;
|
|
1722
1848
|
if (spinner && remaining > 0) {
|
|
1723
1849
|
spinner.start();
|
|
@@ -2304,10 +2430,17 @@ async function run$x(argv, importMeta, {
|
|
|
2304
2430
|
await runFix();
|
|
2305
2431
|
}
|
|
2306
2432
|
|
|
2307
|
-
async function fetchPackageInfo
|
|
2433
|
+
async function fetchPackageInfo(pkgName, pkgVersion, includeAllIssues) {
|
|
2308
2434
|
const socketSdk = await shadowNpmInject.setupSdk(shadowNpmInject.getPublicToken());
|
|
2435
|
+
|
|
2436
|
+
// Lazily access constants.spinner.
|
|
2437
|
+
const {
|
|
2438
|
+
spinner
|
|
2439
|
+
} = constants;
|
|
2440
|
+
spinner.start(pkgVersion === 'latest' ? `Looking up data for the latest version of ${pkgName}` : `Looking up data for version ${pkgVersion} of ${pkgName}`);
|
|
2309
2441
|
const result = await handleApiCall(socketSdk.getIssuesByNPMPackage(pkgName, pkgVersion), 'looking up package');
|
|
2310
2442
|
const scoreResult = await handleApiCall(socketSdk.getScoreByNPMPackage(pkgName, pkgVersion), 'looking up package score');
|
|
2443
|
+
spinner.successAndStop('Data fetched');
|
|
2311
2444
|
if (result.success === false) {
|
|
2312
2445
|
return handleUnsuccessfulApiResponse('getIssuesByNPMPackage', result);
|
|
2313
2446
|
}
|
|
@@ -2333,7 +2466,7 @@ function formatScore$1(score) {
|
|
|
2333
2466
|
}
|
|
2334
2467
|
return colors.red(`${score}`);
|
|
2335
2468
|
}
|
|
2336
|
-
function
|
|
2469
|
+
function outputPackageIssuesDetails(packageData, outputMarkdown) {
|
|
2337
2470
|
const issueDetails = packageData.filter(d => d.value?.severity === shadowNpmInject.SEVERITY.critical || d.value?.severity === shadowNpmInject.SEVERITY.high);
|
|
2338
2471
|
const uniqueIssueDetails = issueDetails.reduce((acc, issue) => {
|
|
2339
2472
|
const {
|
|
@@ -2364,7 +2497,7 @@ function logPackageIssuesDetails(packageData, outputMarkdown) {
|
|
|
2364
2497
|
}
|
|
2365
2498
|
}
|
|
2366
2499
|
}
|
|
2367
|
-
function
|
|
2500
|
+
function outputPackageInfo({
|
|
2368
2501
|
data,
|
|
2369
2502
|
score,
|
|
2370
2503
|
severityCount
|
|
@@ -2402,7 +2535,7 @@ function logPackageInfo$1({
|
|
|
2402
2535
|
logger.logger.log('# Issues\n');
|
|
2403
2536
|
}
|
|
2404
2537
|
logger.logger.log(`Package has these issues: ${shadowNpmInject.formatSeverityCount(severityCount)}\n`);
|
|
2405
|
-
|
|
2538
|
+
outputPackageIssuesDetails(data, outputKind === 'markdown');
|
|
2406
2539
|
} else {
|
|
2407
2540
|
logger.logger.log('Package has no issues');
|
|
2408
2541
|
}
|
|
@@ -2425,7 +2558,7 @@ function logPackageInfo$1({
|
|
|
2425
2558
|
}
|
|
2426
2559
|
}
|
|
2427
2560
|
|
|
2428
|
-
async function
|
|
2561
|
+
async function handlePackageInfo({
|
|
2429
2562
|
commandName,
|
|
2430
2563
|
includeAllIssues,
|
|
2431
2564
|
outputKind,
|
|
@@ -2433,15 +2566,9 @@ async function getPackageInfo({
|
|
|
2433
2566
|
pkgVersion,
|
|
2434
2567
|
strict
|
|
2435
2568
|
}) {
|
|
2436
|
-
|
|
2437
|
-
const {
|
|
2438
|
-
spinner
|
|
2439
|
-
} = constants;
|
|
2440
|
-
spinner.start(pkgVersion === 'latest' ? `Looking up data for the latest version of ${pkgName}` : `Looking up data for version ${pkgVersion} of ${pkgName}`);
|
|
2441
|
-
const packageData = await fetchPackageInfo$1(pkgName, pkgVersion, includeAllIssues);
|
|
2442
|
-
spinner.successAndStop('Data fetched');
|
|
2569
|
+
const packageData = await fetchPackageInfo(pkgName, pkgVersion, includeAllIssues);
|
|
2443
2570
|
if (packageData) {
|
|
2444
|
-
|
|
2571
|
+
outputPackageInfo(packageData, {
|
|
2445
2572
|
name: commandName,
|
|
2446
2573
|
outputKind,
|
|
2447
2574
|
pkgName,
|
|
@@ -2516,7 +2643,7 @@ async function run$w(argv, importMeta, {
|
|
|
2516
2643
|
logger.logger.log(DRY_RUN_BAIL_TEXT$v);
|
|
2517
2644
|
return;
|
|
2518
2645
|
}
|
|
2519
|
-
await
|
|
2646
|
+
await handlePackageInfo({
|
|
2520
2647
|
commandName: `${parentName} ${config$w.commandName}`,
|
|
2521
2648
|
includeAllIssues: Boolean(all),
|
|
2522
2649
|
outputKind: json ? 'json' : markdown ? 'markdown' : 'print',
|
|
@@ -4406,29 +4533,35 @@ async function run$l(argv, importMeta, {
|
|
|
4406
4533
|
await applyOptimization(cwd, Boolean(cli.flags['pin']), Boolean(cli.flags['prod']));
|
|
4407
4534
|
}
|
|
4408
4535
|
|
|
4409
|
-
async function
|
|
4536
|
+
async function fetchOrganization() {
|
|
4410
4537
|
const apiToken = shadowNpmInject.getDefaultToken();
|
|
4411
4538
|
if (!apiToken) {
|
|
4412
4539
|
throw new shadowNpmInject.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
|
|
4413
4540
|
}
|
|
4414
|
-
await
|
|
4541
|
+
return await fetchOrganizationWithToken(apiToken);
|
|
4415
4542
|
}
|
|
4416
|
-
async function
|
|
4543
|
+
async function fetchOrganizationWithToken(apiToken) {
|
|
4544
|
+
const socketSdk = await shadowNpmInject.setupSdk(apiToken);
|
|
4545
|
+
|
|
4417
4546
|
// Lazily access constants.spinner.
|
|
4418
4547
|
const {
|
|
4419
4548
|
spinner
|
|
4420
4549
|
} = constants;
|
|
4421
|
-
spinner.start('Fetching
|
|
4422
|
-
const socketSdk = await shadowNpmInject.setupSdk(apiToken);
|
|
4550
|
+
spinner.start('Fetching organization list...');
|
|
4423
4551
|
const result = await handleApiCall(socketSdk.getOrganizations(), 'looking up organizations');
|
|
4552
|
+
spinner.successAndStop('Received organization list response.');
|
|
4424
4553
|
if (!result.success) {
|
|
4425
4554
|
handleUnsuccessfulApiResponse('getOrganizations', result);
|
|
4426
4555
|
return;
|
|
4427
4556
|
}
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4557
|
+
return result.data;
|
|
4558
|
+
}
|
|
4559
|
+
|
|
4560
|
+
async function outputOrganizationList(data, outputKind = 'text') {
|
|
4561
|
+
const organizations = Object.values(data.organizations);
|
|
4562
|
+
const apiToken = shadowNpmInject.getDefaultToken();
|
|
4563
|
+
const lastFiveOfApiToken = getLastFiveOfApiToken(apiToken ?? '?????');
|
|
4564
|
+
switch (outputKind) {
|
|
4432
4565
|
case 'json':
|
|
4433
4566
|
{
|
|
4434
4567
|
logger.logger.log(JSON.stringify(organizations.map(o => ({
|
|
@@ -4473,6 +4606,12 @@ async function printOrganizationsFromToken(apiToken, format = 'text') {
|
|
|
4473
4606
|
}
|
|
4474
4607
|
}
|
|
4475
4608
|
|
|
4609
|
+
async function handleOrganizationList(outputKind = 'text') {
|
|
4610
|
+
const data = await fetchOrganization();
|
|
4611
|
+
if (!data) return;
|
|
4612
|
+
await outputOrganizationList(data, outputKind);
|
|
4613
|
+
}
|
|
4614
|
+
|
|
4476
4615
|
const {
|
|
4477
4616
|
DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$k
|
|
4478
4617
|
} = constants;
|
|
@@ -4524,48 +4663,63 @@ ${colors.bgRed(colors.white('Input error'))}: Please provide the required fields
|
|
|
4524
4663
|
logger.logger.log(DRY_RUN_BAIL_TEXT$k);
|
|
4525
4664
|
return;
|
|
4526
4665
|
}
|
|
4527
|
-
await
|
|
4666
|
+
await handleOrganizationList(json ? 'json' : markdown ? 'markdown' : 'text');
|
|
4528
4667
|
}
|
|
4529
4668
|
|
|
4530
|
-
async function
|
|
4669
|
+
async function fetchSecurityPolicy(orgSlug) {
|
|
4531
4670
|
const apiToken = shadowNpmInject.getDefaultToken();
|
|
4532
4671
|
if (!apiToken) {
|
|
4533
4672
|
throw new shadowNpmInject.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
|
|
4534
4673
|
}
|
|
4535
|
-
await
|
|
4674
|
+
return await fetchSecurityPolicyWithToken(apiToken, orgSlug);
|
|
4536
4675
|
}
|
|
4537
|
-
async function
|
|
4676
|
+
async function fetchSecurityPolicyWithToken(apiToken, orgSlug) {
|
|
4538
4677
|
// Lazily access constants.spinner.
|
|
4539
4678
|
const {
|
|
4540
4679
|
spinner
|
|
4541
4680
|
} = constants;
|
|
4542
|
-
spinner.start('Fetching organization quota...');
|
|
4543
4681
|
const socketSdk = await shadowNpmInject.setupSdk(apiToken);
|
|
4682
|
+
spinner.start('Fetching organization quota...');
|
|
4544
4683
|
const result = await handleApiCall(socketSdk.getOrgSecurityPolicy(orgSlug), 'looking up organization quota');
|
|
4684
|
+
spinner?.successAndStop('Received organization quota response.');
|
|
4545
4685
|
if (!result.success) {
|
|
4546
4686
|
handleUnsuccessfulApiResponse('getOrgSecurityPolicy', result);
|
|
4547
4687
|
return;
|
|
4548
4688
|
}
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
const mapped = entries.map(([key, value]) => [key, value.action]);
|
|
4565
|
-
mapped.sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
4566
|
-
logger.logger.log(mdTableOfPairs(mapped, ['name', 'action']));
|
|
4567
|
-
}
|
|
4689
|
+
return result.data;
|
|
4690
|
+
}
|
|
4691
|
+
|
|
4692
|
+
async function getSecurityPolicy(data, outputKind) {
|
|
4693
|
+
if (outputKind === 'json') {
|
|
4694
|
+
let json;
|
|
4695
|
+
try {
|
|
4696
|
+
json = JSON.stringify(data, null, 2);
|
|
4697
|
+
} catch {
|
|
4698
|
+
console.error('Failed to convert the server response to json, try running the same command without --json');
|
|
4699
|
+
return;
|
|
4700
|
+
}
|
|
4701
|
+
logger.logger.log(json);
|
|
4702
|
+
logger.logger.log('');
|
|
4703
|
+
return;
|
|
4568
4704
|
}
|
|
4705
|
+
logger.logger.log('# Security policy');
|
|
4706
|
+
logger.logger.log('');
|
|
4707
|
+
logger.logger.log(`The default security policy setting is: "${data.securityPolicyDefault}"`);
|
|
4708
|
+
logger.logger.log('');
|
|
4709
|
+
logger.logger.log('These are the security policies per setting for your organization:');
|
|
4710
|
+
logger.logger.log('');
|
|
4711
|
+
const rules = data.securityPolicyRules;
|
|
4712
|
+
const entries = Object.entries(rules);
|
|
4713
|
+
const mapped = entries.map(([key, value]) => [key, value.action]);
|
|
4714
|
+
mapped.sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
4715
|
+
logger.logger.log(mdTableOfPairs(mapped, ['name', 'action']));
|
|
4716
|
+
logger.logger.log('');
|
|
4717
|
+
}
|
|
4718
|
+
|
|
4719
|
+
async function handleSecurityPolicy(orgSlug, outputKind) {
|
|
4720
|
+
const data = await fetchSecurityPolicy(orgSlug);
|
|
4721
|
+
if (!data) return;
|
|
4722
|
+
await getSecurityPolicy(data, outputKind);
|
|
4569
4723
|
}
|
|
4570
4724
|
|
|
4571
4725
|
const {
|
|
@@ -4630,7 +4784,7 @@ ${colors.bgRed(colors.white('Input error'))}: Please provide the required fields
|
|
|
4630
4784
|
logger.logger.log(DRY_RUN_BAIL_TEXT$j);
|
|
4631
4785
|
return;
|
|
4632
4786
|
}
|
|
4633
|
-
await
|
|
4787
|
+
await handleSecurityPolicy(orgSlug, json ? 'json' : markdown ? 'markdown' : 'text');
|
|
4634
4788
|
}
|
|
4635
4789
|
|
|
4636
4790
|
const description$5 = 'Organization policy details';
|
|
@@ -4657,45 +4811,57 @@ const cmdOrganizationPolicy = {
|
|
|
4657
4811
|
}
|
|
4658
4812
|
};
|
|
4659
4813
|
|
|
4660
|
-
async function
|
|
4814
|
+
async function fetchQuota() {
|
|
4661
4815
|
const apiToken = shadowNpmInject.getDefaultToken();
|
|
4662
4816
|
if (!apiToken) {
|
|
4663
4817
|
throw new shadowNpmInject.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
|
|
4664
4818
|
}
|
|
4665
|
-
await
|
|
4819
|
+
return await fetchQuotaWithToken(apiToken);
|
|
4666
4820
|
}
|
|
4667
|
-
async function
|
|
4821
|
+
async function fetchQuotaWithToken(apiToken) {
|
|
4668
4822
|
// Lazily access constants.spinner.
|
|
4669
4823
|
const {
|
|
4670
4824
|
spinner
|
|
4671
4825
|
} = constants;
|
|
4672
|
-
spinner.start('Fetching organization quota...');
|
|
4673
4826
|
const socketSdk = await shadowNpmInject.setupSdk(apiToken);
|
|
4827
|
+
spinner.start('Fetching organization quota...');
|
|
4674
4828
|
const result = await handleApiCall(socketSdk.getQuota(), 'looking up organization quota');
|
|
4829
|
+
spinner?.successAndStop('Recieved organization quota response.');
|
|
4675
4830
|
if (!result.success) {
|
|
4676
4831
|
handleUnsuccessfulApiResponse('getQuota', result);
|
|
4677
4832
|
return;
|
|
4678
4833
|
}
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
default:
|
|
4695
|
-
{
|
|
4696
|
-
logger.logger.log(`Quota left on the current API token: ${result.data.quota}\n`);
|
|
4697
|
-
}
|
|
4834
|
+
return result.data;
|
|
4835
|
+
}
|
|
4836
|
+
|
|
4837
|
+
async function outputQuota(data, outputKind = 'text') {
|
|
4838
|
+
if (outputKind === 'json') {
|
|
4839
|
+
let json;
|
|
4840
|
+
try {
|
|
4841
|
+
json = JSON.stringify(data, null, 2);
|
|
4842
|
+
} catch {
|
|
4843
|
+
console.error('Failed to convert the server response to json, try running the same command without --json');
|
|
4844
|
+
return;
|
|
4845
|
+
}
|
|
4846
|
+
logger.logger.log(json);
|
|
4847
|
+
logger.logger.log('');
|
|
4848
|
+
return;
|
|
4698
4849
|
}
|
|
4850
|
+
if (outputKind === 'markdown') {
|
|
4851
|
+
logger.logger.log('# Quota');
|
|
4852
|
+
logger.logger.log('');
|
|
4853
|
+
logger.logger.log(`Quota left on the current API token: ${data.quota}`);
|
|
4854
|
+
logger.logger.log('');
|
|
4855
|
+
return;
|
|
4856
|
+
}
|
|
4857
|
+
logger.logger.log(`Quota left on the current API token: ${data.quota}`);
|
|
4858
|
+
logger.logger.log('');
|
|
4859
|
+
}
|
|
4860
|
+
|
|
4861
|
+
async function handleQuota(outputKind = 'text') {
|
|
4862
|
+
const data = await fetchQuota();
|
|
4863
|
+
if (!data) return;
|
|
4864
|
+
await outputQuota(data, outputKind);
|
|
4699
4865
|
}
|
|
4700
4866
|
|
|
4701
4867
|
const {
|
|
@@ -4749,7 +4915,7 @@ ${colors.bgRed(colors.white('Input error'))}: Please provide the required fields
|
|
|
4749
4915
|
logger.logger.log(DRY_RUN_BAIL_TEXT$i);
|
|
4750
4916
|
return;
|
|
4751
4917
|
}
|
|
4752
|
-
await
|
|
4918
|
+
await handleQuota(json ? 'json' : markdown ? 'markdown' : 'text');
|
|
4753
4919
|
}
|
|
4754
4920
|
|
|
4755
4921
|
const description$4 = 'Account details';
|
|
@@ -4778,68 +4944,15 @@ const cmdOrganization = {
|
|
|
4778
4944
|
}
|
|
4779
4945
|
};
|
|
4780
4946
|
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
// Not hardcoding the namespace since we don't know what the server accepts.
|
|
4784
|
-
// The ecosystem is considered as the first package if it is not an a-z string.
|
|
4785
|
-
function parsePackageSpecifiers(ecosystem, pkgs) {
|
|
4786
|
-
let valid = true;
|
|
4787
|
-
const purls = [];
|
|
4788
|
-
if (!ecosystem) {
|
|
4789
|
-
valid = false;
|
|
4790
|
-
} else if (/^[a-zA-Z]+$/.test(ecosystem)) {
|
|
4791
|
-
for (let i = 0; i < pkgs.length; ++i) {
|
|
4792
|
-
const pkg = pkgs[i] ?? '';
|
|
4793
|
-
if (!pkg) {
|
|
4794
|
-
valid = false;
|
|
4795
|
-
break;
|
|
4796
|
-
} else if (pkg.startsWith('pkg:')) {
|
|
4797
|
-
// keep
|
|
4798
|
-
purls.push(pkg);
|
|
4799
|
-
} else if (pkg.includes('/')) {
|
|
4800
|
-
// Looks like this arg was already namespaced
|
|
4801
|
-
purls.push('pkg:' + pkg);
|
|
4802
|
-
} else {
|
|
4803
|
-
purls.push('pkg:' + ecosystem + '/' + pkg);
|
|
4804
|
-
}
|
|
4805
|
-
}
|
|
4806
|
-
if (!purls.length) {
|
|
4807
|
-
valid = false;
|
|
4808
|
-
}
|
|
4809
|
-
} else {
|
|
4810
|
-
// Assume ecosystem is a purl, too
|
|
4811
|
-
pkgs.unshift(ecosystem);
|
|
4812
|
-
for (let i = 0; i < pkgs.length; ++i) {
|
|
4813
|
-
const pkg = pkgs[i] ?? '';
|
|
4814
|
-
if (!/^(?:pkg:)?[a-zA-Z]+\/./.test(pkg)) {
|
|
4815
|
-
// At least one purl did not start with `pkg:eco/x` or `eco/x`
|
|
4816
|
-
valid = false;
|
|
4817
|
-
break;
|
|
4818
|
-
} else if (pkg.startsWith('pkg:')) {
|
|
4819
|
-
purls.push(pkg);
|
|
4820
|
-
} else {
|
|
4821
|
-
purls.push('pkg:' + pkg);
|
|
4822
|
-
}
|
|
4823
|
-
}
|
|
4824
|
-
if (!purls.length) {
|
|
4825
|
-
valid = false;
|
|
4826
|
-
}
|
|
4827
|
-
}
|
|
4828
|
-
return {
|
|
4829
|
-
purls,
|
|
4830
|
-
valid
|
|
4831
|
-
};
|
|
4832
|
-
}
|
|
4833
|
-
|
|
4834
|
-
async function fetchPackageInfo(purls) {
|
|
4835
|
-
const socketSdk = await shadowNpmInject.setupSdk(shadowNpmInject.getPublicToken());
|
|
4947
|
+
async function fetchPurlsShallowScore(purls) {
|
|
4948
|
+
logger.logger.error(`Requesting shallow score data for ${purls.length} package urls (purl): ${purls.join(', ')}`);
|
|
4836
4949
|
|
|
4837
4950
|
// Lazily access constants.spinner.
|
|
4838
4951
|
const {
|
|
4839
4952
|
spinner
|
|
4840
4953
|
} = constants;
|
|
4841
|
-
logger.logger.error(`Requesting shallow score data for ${purls.length} package urls (purl): ${purls.join(', ')}`);
|
|
4842
4954
|
spinner.start(`Requesting data ...`);
|
|
4955
|
+
const socketSdk = await shadowNpmInject.setupSdk(shadowNpmInject.getPublicToken());
|
|
4843
4956
|
const result = await handleApiCall(socketSdk.batchPackageFetch({
|
|
4844
4957
|
alerts: 'true'
|
|
4845
4958
|
// compact: false,
|
|
@@ -4854,12 +4967,11 @@ async function fetchPackageInfo(purls) {
|
|
|
4854
4967
|
spinner.successAndStop('Request completed');
|
|
4855
4968
|
if (result.success) {
|
|
4856
4969
|
return result;
|
|
4857
|
-
} else {
|
|
4858
|
-
handleUnsuccessfulApiResponse('batchPackageFetch', result);
|
|
4859
4970
|
}
|
|
4971
|
+
handleUnsuccessfulApiResponse('batchPackageFetch', result);
|
|
4860
4972
|
}
|
|
4861
4973
|
|
|
4862
|
-
function
|
|
4974
|
+
function outputPurlsShallowScore(purls, packageData, outputKind) {
|
|
4863
4975
|
if (outputKind === 'json') {
|
|
4864
4976
|
// In JSON simply return what the server responds with. Don't bother trying
|
|
4865
4977
|
// to match the response with the requested packages/purls.
|
|
@@ -4939,14 +5051,67 @@ function getAlertString(alerts, noColor = false) {
|
|
|
4939
5051
|
}
|
|
4940
5052
|
}
|
|
4941
5053
|
|
|
4942
|
-
async function
|
|
5054
|
+
async function handlePurlsShallowScore({
|
|
4943
5055
|
outputKind,
|
|
4944
5056
|
purls
|
|
4945
5057
|
}) {
|
|
4946
|
-
const packageData = await
|
|
5058
|
+
const packageData = await fetchPurlsShallowScore(purls);
|
|
4947
5059
|
if (packageData) {
|
|
4948
|
-
|
|
5060
|
+
outputPurlsShallowScore(purls, packageData.data, outputKind);
|
|
5061
|
+
}
|
|
5062
|
+
}
|
|
5063
|
+
|
|
5064
|
+
// Either an ecosystem was given or all args must be (namespaced) purls
|
|
5065
|
+
// The `pkg:` part is optional here. We'll scan for `eco/name@version`.
|
|
5066
|
+
// Not hardcoding the namespace since we don't know what the server accepts.
|
|
5067
|
+
// The ecosystem is considered as the first package if it is not an a-z string.
|
|
5068
|
+
function parsePackageSpecifiers(ecosystem, pkgs) {
|
|
5069
|
+
let valid = true;
|
|
5070
|
+
const purls = [];
|
|
5071
|
+
if (!ecosystem) {
|
|
5072
|
+
valid = false;
|
|
5073
|
+
} else if (/^[a-zA-Z]+$/.test(ecosystem)) {
|
|
5074
|
+
for (let i = 0; i < pkgs.length; ++i) {
|
|
5075
|
+
const pkg = pkgs[i] ?? '';
|
|
5076
|
+
if (!pkg) {
|
|
5077
|
+
valid = false;
|
|
5078
|
+
break;
|
|
5079
|
+
} else if (pkg.startsWith('pkg:')) {
|
|
5080
|
+
// keep
|
|
5081
|
+
purls.push(pkg);
|
|
5082
|
+
} else if (pkg.includes('/')) {
|
|
5083
|
+
// Looks like this arg was already namespaced
|
|
5084
|
+
purls.push('pkg:' + pkg);
|
|
5085
|
+
} else {
|
|
5086
|
+
purls.push('pkg:' + ecosystem + '/' + pkg);
|
|
5087
|
+
}
|
|
5088
|
+
}
|
|
5089
|
+
if (!purls.length) {
|
|
5090
|
+
valid = false;
|
|
5091
|
+
}
|
|
5092
|
+
} else {
|
|
5093
|
+
// Assume ecosystem is a purl, too
|
|
5094
|
+
pkgs.unshift(ecosystem);
|
|
5095
|
+
for (let i = 0; i < pkgs.length; ++i) {
|
|
5096
|
+
const pkg = pkgs[i] ?? '';
|
|
5097
|
+
if (!/^(?:pkg:)?[a-zA-Z]+\/./.test(pkg)) {
|
|
5098
|
+
// At least one purl did not start with `pkg:eco/x` or `eco/x`
|
|
5099
|
+
valid = false;
|
|
5100
|
+
break;
|
|
5101
|
+
} else if (pkg.startsWith('pkg:')) {
|
|
5102
|
+
purls.push(pkg);
|
|
5103
|
+
} else {
|
|
5104
|
+
purls.push('pkg:' + pkg);
|
|
5105
|
+
}
|
|
5106
|
+
}
|
|
5107
|
+
if (!purls.length) {
|
|
5108
|
+
valid = false;
|
|
5109
|
+
}
|
|
4949
5110
|
}
|
|
5111
|
+
return {
|
|
5112
|
+
purls,
|
|
5113
|
+
valid
|
|
5114
|
+
};
|
|
4950
5115
|
}
|
|
4951
5116
|
|
|
4952
5117
|
const {
|
|
@@ -5038,7 +5203,7 @@ async function run$h(argv, importMeta, {
|
|
|
5038
5203
|
logger.logger.log(DRY_RUN_BAIL_TEXT$h);
|
|
5039
5204
|
return;
|
|
5040
5205
|
}
|
|
5041
|
-
await
|
|
5206
|
+
await handlePurlsShallowScore({
|
|
5042
5207
|
outputKind: json ? 'json' : markdown ? 'markdown' : 'text',
|
|
5043
5208
|
purls
|
|
5044
5209
|
});
|
|
@@ -5514,7 +5679,7 @@ const cmdReport = {
|
|
|
5514
5679
|
}
|
|
5515
5680
|
};
|
|
5516
5681
|
|
|
5517
|
-
async function
|
|
5682
|
+
async function fetchCreateRepo({
|
|
5518
5683
|
default_branch,
|
|
5519
5684
|
description,
|
|
5520
5685
|
homepage,
|
|
@@ -5526,8 +5691,7 @@ async function createRepo({
|
|
|
5526
5691
|
if (!apiToken) {
|
|
5527
5692
|
throw new shadowNpmInject.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
|
|
5528
5693
|
}
|
|
5529
|
-
await
|
|
5530
|
-
apiToken,
|
|
5694
|
+
return await fetchCreateRepoWithToken(apiToken, {
|
|
5531
5695
|
default_branch,
|
|
5532
5696
|
description,
|
|
5533
5697
|
homepage,
|
|
@@ -5536,8 +5700,7 @@ async function createRepo({
|
|
|
5536
5700
|
visibility
|
|
5537
5701
|
});
|
|
5538
5702
|
}
|
|
5539
|
-
async function
|
|
5540
|
-
apiToken,
|
|
5703
|
+
async function fetchCreateRepoWithToken(apiToken, {
|
|
5541
5704
|
default_branch,
|
|
5542
5705
|
description,
|
|
5543
5706
|
homepage,
|
|
@@ -5549,8 +5712,8 @@ async function createRepoWithToken({
|
|
|
5549
5712
|
const {
|
|
5550
5713
|
spinner
|
|
5551
5714
|
} = constants;
|
|
5552
|
-
spinner.start('Creating repository...');
|
|
5553
5715
|
const socketSdk = await shadowNpmInject.setupSdk(apiToken);
|
|
5716
|
+
spinner.start('Sending request ot create a repository...');
|
|
5554
5717
|
const result = await handleApiCall(socketSdk.createOrgRepo(orgSlug, {
|
|
5555
5718
|
name: repoName,
|
|
5556
5719
|
description,
|
|
@@ -5558,11 +5721,36 @@ async function createRepoWithToken({
|
|
|
5558
5721
|
default_branch,
|
|
5559
5722
|
visibility
|
|
5560
5723
|
}), 'creating repository');
|
|
5724
|
+
spinner.successAndStop('Received response requesting to create a repository.');
|
|
5561
5725
|
if (!result.success) {
|
|
5562
5726
|
handleUnsuccessfulApiResponse('createOrgRepo', result);
|
|
5563
5727
|
return;
|
|
5564
5728
|
}
|
|
5565
|
-
|
|
5729
|
+
return result.data;
|
|
5730
|
+
}
|
|
5731
|
+
|
|
5732
|
+
async function outputCreateRepo(_data) {
|
|
5733
|
+
logger.logger.success('Repository created successfully');
|
|
5734
|
+
}
|
|
5735
|
+
|
|
5736
|
+
async function handleCreateRepo({
|
|
5737
|
+
default_branch,
|
|
5738
|
+
description,
|
|
5739
|
+
homepage,
|
|
5740
|
+
orgSlug,
|
|
5741
|
+
repoName,
|
|
5742
|
+
visibility
|
|
5743
|
+
}) {
|
|
5744
|
+
const data = await fetchCreateRepo({
|
|
5745
|
+
default_branch,
|
|
5746
|
+
description,
|
|
5747
|
+
homepage,
|
|
5748
|
+
orgSlug,
|
|
5749
|
+
repoName,
|
|
5750
|
+
visibility
|
|
5751
|
+
});
|
|
5752
|
+
if (!data) return;
|
|
5753
|
+
await outputCreateRepo();
|
|
5566
5754
|
}
|
|
5567
5755
|
|
|
5568
5756
|
const {
|
|
@@ -5648,7 +5836,7 @@ async function run$c(argv, importMeta, {
|
|
|
5648
5836
|
logger.logger.log(DRY_RUN_BAIL_TEXT$c);
|
|
5649
5837
|
return;
|
|
5650
5838
|
}
|
|
5651
|
-
await
|
|
5839
|
+
await handleCreateRepo({
|
|
5652
5840
|
orgSlug,
|
|
5653
5841
|
repoName,
|
|
5654
5842
|
description: String(cli.flags['repoDescription'] || ''),
|
|
@@ -5658,7 +5846,7 @@ async function run$c(argv, importMeta, {
|
|
|
5658
5846
|
});
|
|
5659
5847
|
}
|
|
5660
5848
|
|
|
5661
|
-
async function
|
|
5849
|
+
async function handleDeleteRepo(orgSlug, repoName) {
|
|
5662
5850
|
const apiToken = shadowNpmInject.getDefaultToken();
|
|
5663
5851
|
if (!apiToken) {
|
|
5664
5852
|
throw new shadowNpmInject.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
|
|
@@ -5734,14 +5922,12 @@ async function run$b(argv, importMeta, {
|
|
|
5734
5922
|
logger.logger.log(DRY_RUN_BAIL_TEXT$b);
|
|
5735
5923
|
return;
|
|
5736
5924
|
}
|
|
5737
|
-
await
|
|
5925
|
+
await handleDeleteRepo(orgSlug, repoName);
|
|
5738
5926
|
}
|
|
5739
5927
|
|
|
5740
|
-
|
|
5741
|
-
async function listRepos({
|
|
5928
|
+
async function fetchListRepos({
|
|
5742
5929
|
direction,
|
|
5743
5930
|
orgSlug,
|
|
5744
|
-
outputKind,
|
|
5745
5931
|
page,
|
|
5746
5932
|
per_page,
|
|
5747
5933
|
sort
|
|
@@ -5750,21 +5936,17 @@ async function listRepos({
|
|
|
5750
5936
|
if (!apiToken) {
|
|
5751
5937
|
throw new shadowNpmInject.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
|
|
5752
5938
|
}
|
|
5753
|
-
await
|
|
5754
|
-
apiToken,
|
|
5939
|
+
return await fetchListReposWithToken(apiToken, {
|
|
5755
5940
|
direction,
|
|
5756
5941
|
orgSlug,
|
|
5757
|
-
outputKind,
|
|
5758
5942
|
page,
|
|
5759
5943
|
per_page,
|
|
5760
5944
|
sort
|
|
5761
5945
|
});
|
|
5762
5946
|
}
|
|
5763
|
-
async function
|
|
5764
|
-
apiToken,
|
|
5947
|
+
async function fetchListReposWithToken(apiToken, {
|
|
5765
5948
|
direction,
|
|
5766
5949
|
orgSlug,
|
|
5767
|
-
outputKind,
|
|
5768
5950
|
page,
|
|
5769
5951
|
per_page,
|
|
5770
5952
|
sort
|
|
@@ -5773,28 +5955,33 @@ async function listReposWithToken({
|
|
|
5773
5955
|
const {
|
|
5774
5956
|
spinner
|
|
5775
5957
|
} = constants;
|
|
5776
|
-
spinner.start('Fetching list of repositories...');
|
|
5777
5958
|
const socketSdk = await shadowNpmInject.setupSdk(apiToken);
|
|
5959
|
+
spinner.start('Fetching list of repositories...');
|
|
5778
5960
|
const result = await handleApiCall(socketSdk.getOrgRepoList(orgSlug, {
|
|
5779
5961
|
sort,
|
|
5780
5962
|
direction,
|
|
5781
5963
|
per_page: String(per_page),
|
|
5782
5964
|
page: String(page)
|
|
5783
5965
|
}), 'listing repositories');
|
|
5966
|
+
spinner.successAndStop('Received response for repository list.');
|
|
5784
5967
|
if (!result.success) {
|
|
5785
5968
|
handleUnsuccessfulApiResponse('getOrgRepoList', result);
|
|
5786
5969
|
return;
|
|
5787
5970
|
}
|
|
5788
|
-
|
|
5971
|
+
return result.data;
|
|
5972
|
+
}
|
|
5973
|
+
|
|
5974
|
+
// @ts-ignore
|
|
5975
|
+
async function outputListRepos(data, outputKind) {
|
|
5789
5976
|
if (outputKind === 'json') {
|
|
5790
|
-
const
|
|
5977
|
+
const json = data.results.map(o => ({
|
|
5791
5978
|
id: o.id,
|
|
5792
5979
|
name: o.name,
|
|
5793
5980
|
visibility: o.visibility,
|
|
5794
5981
|
defaultBranch: o.default_branch,
|
|
5795
5982
|
archived: o.archived
|
|
5796
5983
|
}));
|
|
5797
|
-
logger.logger.log(JSON.stringify(
|
|
5984
|
+
logger.logger.log(JSON.stringify(json, null, 2));
|
|
5798
5985
|
return;
|
|
5799
5986
|
}
|
|
5800
5987
|
const options = {
|
|
@@ -5815,7 +6002,26 @@ async function listReposWithToken({
|
|
|
5815
6002
|
name: colors.magenta('Archived')
|
|
5816
6003
|
}]
|
|
5817
6004
|
};
|
|
5818
|
-
logger.logger.log(chalkTable(options,
|
|
6005
|
+
logger.logger.log(chalkTable(options, data.results));
|
|
6006
|
+
}
|
|
6007
|
+
|
|
6008
|
+
async function handleListRepos({
|
|
6009
|
+
direction,
|
|
6010
|
+
orgSlug,
|
|
6011
|
+
outputKind,
|
|
6012
|
+
page,
|
|
6013
|
+
per_page,
|
|
6014
|
+
sort
|
|
6015
|
+
}) {
|
|
6016
|
+
const data = await fetchListRepos({
|
|
6017
|
+
direction,
|
|
6018
|
+
orgSlug,
|
|
6019
|
+
page,
|
|
6020
|
+
per_page,
|
|
6021
|
+
sort
|
|
6022
|
+
});
|
|
6023
|
+
if (!data) return;
|
|
6024
|
+
await outputListRepos(data, outputKind);
|
|
5819
6025
|
}
|
|
5820
6026
|
|
|
5821
6027
|
const {
|
|
@@ -5894,7 +6100,7 @@ async function run$a(argv, importMeta, {
|
|
|
5894
6100
|
logger.logger.log(DRY_RUN_BAIL_TEXT$a);
|
|
5895
6101
|
return;
|
|
5896
6102
|
}
|
|
5897
|
-
await
|
|
6103
|
+
await handleListRepos({
|
|
5898
6104
|
direction: cli.flags['direction'] === 'asc' ? 'asc' : 'desc',
|
|
5899
6105
|
orgSlug,
|
|
5900
6106
|
outputKind: cli.flags['json'] ? 'json' : cli.flags['markdown'] ? 'markdown' : 'print',
|
|
@@ -5904,7 +6110,7 @@ async function run$a(argv, importMeta, {
|
|
|
5904
6110
|
});
|
|
5905
6111
|
}
|
|
5906
6112
|
|
|
5907
|
-
async function
|
|
6113
|
+
async function fetchUpdateRepo({
|
|
5908
6114
|
default_branch,
|
|
5909
6115
|
description,
|
|
5910
6116
|
homepage,
|
|
@@ -5916,8 +6122,7 @@ async function updateRepo({
|
|
|
5916
6122
|
if (!apiToken) {
|
|
5917
6123
|
throw new shadowNpmInject.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
|
|
5918
6124
|
}
|
|
5919
|
-
await
|
|
5920
|
-
apiToken,
|
|
6125
|
+
return await fetchUpdateRepoWithToken(apiToken, {
|
|
5921
6126
|
default_branch,
|
|
5922
6127
|
description,
|
|
5923
6128
|
homepage,
|
|
@@ -5926,8 +6131,7 @@ async function updateRepo({
|
|
|
5926
6131
|
visibility
|
|
5927
6132
|
});
|
|
5928
6133
|
}
|
|
5929
|
-
async function
|
|
5930
|
-
apiToken,
|
|
6134
|
+
async function fetchUpdateRepoWithToken(apiToken, {
|
|
5931
6135
|
default_branch,
|
|
5932
6136
|
description,
|
|
5933
6137
|
homepage,
|
|
@@ -5939,7 +6143,7 @@ async function updateRepoWithToken({
|
|
|
5939
6143
|
const {
|
|
5940
6144
|
spinner
|
|
5941
6145
|
} = constants;
|
|
5942
|
-
spinner.start('
|
|
6146
|
+
spinner.start('Sending request to update a repository...');
|
|
5943
6147
|
const socketSdk = await shadowNpmInject.setupSdk(apiToken);
|
|
5944
6148
|
const result = await handleApiCall(socketSdk.updateOrgRepo(orgSlug, repoName, {
|
|
5945
6149
|
orgSlug,
|
|
@@ -5949,11 +6153,36 @@ async function updateRepoWithToken({
|
|
|
5949
6153
|
default_branch,
|
|
5950
6154
|
visibility
|
|
5951
6155
|
}), 'updating repository');
|
|
6156
|
+
spinner.successAndStop('Received response trying to update a repository');
|
|
5952
6157
|
if (!result.success) {
|
|
5953
6158
|
handleUnsuccessfulApiResponse('updateOrgRepo', result);
|
|
5954
6159
|
return;
|
|
5955
6160
|
}
|
|
5956
|
-
|
|
6161
|
+
return result.data;
|
|
6162
|
+
}
|
|
6163
|
+
|
|
6164
|
+
async function outputUpdateRepo(_data) {
|
|
6165
|
+
logger.logger.success('Repository updated successfully');
|
|
6166
|
+
}
|
|
6167
|
+
|
|
6168
|
+
async function handleUpdateRepo({
|
|
6169
|
+
default_branch,
|
|
6170
|
+
description,
|
|
6171
|
+
homepage,
|
|
6172
|
+
orgSlug,
|
|
6173
|
+
repoName,
|
|
6174
|
+
visibility
|
|
6175
|
+
}) {
|
|
6176
|
+
const data = await fetchUpdateRepo({
|
|
6177
|
+
default_branch,
|
|
6178
|
+
description,
|
|
6179
|
+
homepage,
|
|
6180
|
+
orgSlug,
|
|
6181
|
+
repoName,
|
|
6182
|
+
visibility
|
|
6183
|
+
});
|
|
6184
|
+
if (!data) return;
|
|
6185
|
+
await outputUpdateRepo();
|
|
5957
6186
|
}
|
|
5958
6187
|
|
|
5959
6188
|
const {
|
|
@@ -6041,7 +6270,7 @@ async function run$9(argv, importMeta, {
|
|
|
6041
6270
|
logger.logger.log(DRY_RUN_BAIL_TEXT$9);
|
|
6042
6271
|
return;
|
|
6043
6272
|
}
|
|
6044
|
-
await
|
|
6273
|
+
await handleUpdateRepo({
|
|
6045
6274
|
orgSlug,
|
|
6046
6275
|
repoName,
|
|
6047
6276
|
description: String(cli.flags['repoDescription'] || ''),
|
|
@@ -6051,27 +6280,31 @@ async function run$9(argv, importMeta, {
|
|
|
6051
6280
|
});
|
|
6052
6281
|
}
|
|
6053
6282
|
|
|
6054
|
-
|
|
6055
|
-
async function viewRepo(orgSlug, repoName, outputKind) {
|
|
6283
|
+
async function fetchViewRepo(orgSlug, repoName) {
|
|
6056
6284
|
const apiToken = shadowNpmInject.getDefaultToken();
|
|
6057
6285
|
if (!apiToken) {
|
|
6058
6286
|
throw new shadowNpmInject.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
|
|
6059
6287
|
}
|
|
6060
|
-
await
|
|
6288
|
+
return await fetchViewRepoWithToken(orgSlug, repoName, apiToken);
|
|
6061
6289
|
}
|
|
6062
|
-
async function
|
|
6290
|
+
async function fetchViewRepoWithToken(orgSlug, repoName, apiToken) {
|
|
6063
6291
|
// Lazily access constants.spinner.
|
|
6064
6292
|
const {
|
|
6065
6293
|
spinner
|
|
6066
6294
|
} = constants;
|
|
6067
|
-
spinner.start('Fetching repository data...');
|
|
6068
6295
|
const socketSdk = await shadowNpmInject.setupSdk(apiToken);
|
|
6296
|
+
spinner.start('Fetching repository data...');
|
|
6069
6297
|
const result = await handleApiCall(socketSdk.getOrgRepo(orgSlug, repoName), 'fetching repository');
|
|
6298
|
+
spinner.successAndStop('Received response while fetched repository data.');
|
|
6070
6299
|
if (!result.success) {
|
|
6071
6300
|
handleUnsuccessfulApiResponse('getOrgRepo', result);
|
|
6072
6301
|
return;
|
|
6073
6302
|
}
|
|
6074
|
-
|
|
6303
|
+
return result.data;
|
|
6304
|
+
}
|
|
6305
|
+
|
|
6306
|
+
// @ts-ignore
|
|
6307
|
+
async function outputViewRepo(data, outputKind) {
|
|
6075
6308
|
if (outputKind === 'json') {
|
|
6076
6309
|
const {
|
|
6077
6310
|
archived,
|
|
@@ -6081,7 +6314,7 @@ async function viewRepoWithToken(orgSlug, repoName, apiToken, outputKind) {
|
|
|
6081
6314
|
id,
|
|
6082
6315
|
name,
|
|
6083
6316
|
visibility
|
|
6084
|
-
} =
|
|
6317
|
+
} = data;
|
|
6085
6318
|
logger.logger.log(JSON.stringify({
|
|
6086
6319
|
id,
|
|
6087
6320
|
name,
|
|
@@ -6117,7 +6350,13 @@ async function viewRepoWithToken(orgSlug, repoName, apiToken, outputKind) {
|
|
|
6117
6350
|
name: colors.magenta('Created at')
|
|
6118
6351
|
}]
|
|
6119
6352
|
};
|
|
6120
|
-
logger.logger.log(chalkTable(options, [
|
|
6353
|
+
logger.logger.log(chalkTable(options, [data]));
|
|
6354
|
+
}
|
|
6355
|
+
|
|
6356
|
+
async function handleViewRepo(orgSlug, repoName, outputKind) {
|
|
6357
|
+
const data = await fetchViewRepo(orgSlug, repoName);
|
|
6358
|
+
if (!data) return;
|
|
6359
|
+
await outputViewRepo(data, outputKind);
|
|
6121
6360
|
}
|
|
6122
6361
|
|
|
6123
6362
|
const {
|
|
@@ -6161,7 +6400,11 @@ async function run$8(argv, importMeta, {
|
|
|
6161
6400
|
importMeta,
|
|
6162
6401
|
parentName
|
|
6163
6402
|
});
|
|
6164
|
-
const
|
|
6403
|
+
const {
|
|
6404
|
+
json,
|
|
6405
|
+
markdown,
|
|
6406
|
+
repoName
|
|
6407
|
+
} = cli.flags;
|
|
6165
6408
|
const [orgSlug = ''] = cli.input;
|
|
6166
6409
|
if (!repoName || typeof repoName !== 'string' || !orgSlug) {
|
|
6167
6410
|
// Use exit status of 2 to indicate incorrect usage, generally invalid
|
|
@@ -6181,7 +6424,7 @@ async function run$8(argv, importMeta, {
|
|
|
6181
6424
|
logger.logger.log(DRY_RUN_BAIL_TEXT$8);
|
|
6182
6425
|
return;
|
|
6183
6426
|
}
|
|
6184
|
-
await
|
|
6427
|
+
await handleViewRepo(orgSlug, repoName, json ? 'json' : markdown ? 'markdown' : 'text');
|
|
6185
6428
|
}
|
|
6186
6429
|
|
|
6187
6430
|
const description$1 = 'Repositories related commands';
|
|
@@ -8212,7 +8455,7 @@ void (async () => {
|
|
|
8212
8455
|
await vendor.updater({
|
|
8213
8456
|
name: SOCKET_CLI_BIN_NAME,
|
|
8214
8457
|
// The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
|
|
8215
|
-
version: "0.14.
|
|
8458
|
+
version: "0.14.65",
|
|
8216
8459
|
ttl: 86_400_000 /* 24 hours in milliseconds */
|
|
8217
8460
|
});
|
|
8218
8461
|
try {
|
|
@@ -8279,5 +8522,5 @@ void (async () => {
|
|
|
8279
8522
|
await shadowNpmInject.captureException(e);
|
|
8280
8523
|
}
|
|
8281
8524
|
})();
|
|
8282
|
-
//# debugId=
|
|
8525
|
+
//# debugId=765ca9f4-3784-4e50-beb4-36197117fbea
|
|
8283
8526
|
//# sourceMappingURL=cli.js.map
|