@socketsecurity/cli-with-sentry 0.14.63 → 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/instrument-with-sentry.js +2 -2
- package/dist/instrument-with-sentry.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 +9 -12
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:076379f8: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();
|
|
@@ -2306,10 +2432,17 @@ async function run$x(argv, importMeta, {
|
|
|
2306
2432
|
await runFix();
|
|
2307
2433
|
}
|
|
2308
2434
|
|
|
2309
|
-
async function fetchPackageInfo
|
|
2435
|
+
async function fetchPackageInfo(pkgName, pkgVersion, includeAllIssues) {
|
|
2310
2436
|
const socketSdk = await shadowNpmInject.setupSdk(shadowNpmInject.getPublicToken());
|
|
2437
|
+
|
|
2438
|
+
// Lazily access constants.spinner.
|
|
2439
|
+
const {
|
|
2440
|
+
spinner
|
|
2441
|
+
} = constants;
|
|
2442
|
+
spinner.start(pkgVersion === 'latest' ? `Looking up data for the latest version of ${pkgName}` : `Looking up data for version ${pkgVersion} of ${pkgName}`);
|
|
2311
2443
|
const result = await handleApiCall(socketSdk.getIssuesByNPMPackage(pkgName, pkgVersion), 'looking up package');
|
|
2312
2444
|
const scoreResult = await handleApiCall(socketSdk.getScoreByNPMPackage(pkgName, pkgVersion), 'looking up package score');
|
|
2445
|
+
spinner.successAndStop('Data fetched');
|
|
2313
2446
|
if (result.success === false) {
|
|
2314
2447
|
return handleUnsuccessfulApiResponse('getIssuesByNPMPackage', result);
|
|
2315
2448
|
}
|
|
@@ -2335,7 +2468,7 @@ function formatScore$1(score) {
|
|
|
2335
2468
|
}
|
|
2336
2469
|
return colors.red(`${score}`);
|
|
2337
2470
|
}
|
|
2338
|
-
function
|
|
2471
|
+
function outputPackageIssuesDetails(packageData, outputMarkdown) {
|
|
2339
2472
|
const issueDetails = packageData.filter(d => d.value?.severity === shadowNpmInject.SEVERITY.critical || d.value?.severity === shadowNpmInject.SEVERITY.high);
|
|
2340
2473
|
const uniqueIssueDetails = issueDetails.reduce((acc, issue) => {
|
|
2341
2474
|
const {
|
|
@@ -2366,7 +2499,7 @@ function logPackageIssuesDetails(packageData, outputMarkdown) {
|
|
|
2366
2499
|
}
|
|
2367
2500
|
}
|
|
2368
2501
|
}
|
|
2369
|
-
function
|
|
2502
|
+
function outputPackageInfo({
|
|
2370
2503
|
data,
|
|
2371
2504
|
score,
|
|
2372
2505
|
severityCount
|
|
@@ -2404,7 +2537,7 @@ function logPackageInfo$1({
|
|
|
2404
2537
|
logger.logger.log('# Issues\n');
|
|
2405
2538
|
}
|
|
2406
2539
|
logger.logger.log(`Package has these issues: ${shadowNpmInject.formatSeverityCount(severityCount)}\n`);
|
|
2407
|
-
|
|
2540
|
+
outputPackageIssuesDetails(data, outputKind === 'markdown');
|
|
2408
2541
|
} else {
|
|
2409
2542
|
logger.logger.log('Package has no issues');
|
|
2410
2543
|
}
|
|
@@ -2427,7 +2560,7 @@ function logPackageInfo$1({
|
|
|
2427
2560
|
}
|
|
2428
2561
|
}
|
|
2429
2562
|
|
|
2430
|
-
async function
|
|
2563
|
+
async function handlePackageInfo({
|
|
2431
2564
|
commandName,
|
|
2432
2565
|
includeAllIssues,
|
|
2433
2566
|
outputKind,
|
|
@@ -2435,15 +2568,9 @@ async function getPackageInfo({
|
|
|
2435
2568
|
pkgVersion,
|
|
2436
2569
|
strict
|
|
2437
2570
|
}) {
|
|
2438
|
-
|
|
2439
|
-
const {
|
|
2440
|
-
spinner
|
|
2441
|
-
} = constants;
|
|
2442
|
-
spinner.start(pkgVersion === 'latest' ? `Looking up data for the latest version of ${pkgName}` : `Looking up data for version ${pkgVersion} of ${pkgName}`);
|
|
2443
|
-
const packageData = await fetchPackageInfo$1(pkgName, pkgVersion, includeAllIssues);
|
|
2444
|
-
spinner.successAndStop('Data fetched');
|
|
2571
|
+
const packageData = await fetchPackageInfo(pkgName, pkgVersion, includeAllIssues);
|
|
2445
2572
|
if (packageData) {
|
|
2446
|
-
|
|
2573
|
+
outputPackageInfo(packageData, {
|
|
2447
2574
|
name: commandName,
|
|
2448
2575
|
outputKind,
|
|
2449
2576
|
pkgName,
|
|
@@ -2518,7 +2645,7 @@ async function run$w(argv, importMeta, {
|
|
|
2518
2645
|
logger.logger.log(DRY_RUN_BAIL_TEXT$v);
|
|
2519
2646
|
return;
|
|
2520
2647
|
}
|
|
2521
|
-
await
|
|
2648
|
+
await handlePackageInfo({
|
|
2522
2649
|
commandName: `${parentName} ${config$w.commandName}`,
|
|
2523
2650
|
includeAllIssues: Boolean(all),
|
|
2524
2651
|
outputKind: json ? 'json' : markdown ? 'markdown' : 'print',
|
|
@@ -4408,29 +4535,35 @@ async function run$l(argv, importMeta, {
|
|
|
4408
4535
|
await applyOptimization(cwd, Boolean(cli.flags['pin']), Boolean(cli.flags['prod']));
|
|
4409
4536
|
}
|
|
4410
4537
|
|
|
4411
|
-
async function
|
|
4538
|
+
async function fetchOrganization() {
|
|
4412
4539
|
const apiToken = shadowNpmInject.getDefaultToken();
|
|
4413
4540
|
if (!apiToken) {
|
|
4414
4541
|
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.');
|
|
4415
4542
|
}
|
|
4416
|
-
await
|
|
4543
|
+
return await fetchOrganizationWithToken(apiToken);
|
|
4417
4544
|
}
|
|
4418
|
-
async function
|
|
4545
|
+
async function fetchOrganizationWithToken(apiToken) {
|
|
4546
|
+
const socketSdk = await shadowNpmInject.setupSdk(apiToken);
|
|
4547
|
+
|
|
4419
4548
|
// Lazily access constants.spinner.
|
|
4420
4549
|
const {
|
|
4421
4550
|
spinner
|
|
4422
4551
|
} = constants;
|
|
4423
|
-
spinner.start('Fetching
|
|
4424
|
-
const socketSdk = await shadowNpmInject.setupSdk(apiToken);
|
|
4552
|
+
spinner.start('Fetching organization list...');
|
|
4425
4553
|
const result = await handleApiCall(socketSdk.getOrganizations(), 'looking up organizations');
|
|
4554
|
+
spinner.successAndStop('Received organization list response.');
|
|
4426
4555
|
if (!result.success) {
|
|
4427
4556
|
handleUnsuccessfulApiResponse('getOrganizations', result);
|
|
4428
4557
|
return;
|
|
4429
4558
|
}
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4559
|
+
return result.data;
|
|
4560
|
+
}
|
|
4561
|
+
|
|
4562
|
+
async function outputOrganizationList(data, outputKind = 'text') {
|
|
4563
|
+
const organizations = Object.values(data.organizations);
|
|
4564
|
+
const apiToken = shadowNpmInject.getDefaultToken();
|
|
4565
|
+
const lastFiveOfApiToken = getLastFiveOfApiToken(apiToken ?? '?????');
|
|
4566
|
+
switch (outputKind) {
|
|
4434
4567
|
case 'json':
|
|
4435
4568
|
{
|
|
4436
4569
|
logger.logger.log(JSON.stringify(organizations.map(o => ({
|
|
@@ -4475,6 +4608,12 @@ async function printOrganizationsFromToken(apiToken, format = 'text') {
|
|
|
4475
4608
|
}
|
|
4476
4609
|
}
|
|
4477
4610
|
|
|
4611
|
+
async function handleOrganizationList(outputKind = 'text') {
|
|
4612
|
+
const data = await fetchOrganization();
|
|
4613
|
+
if (!data) return;
|
|
4614
|
+
await outputOrganizationList(data, outputKind);
|
|
4615
|
+
}
|
|
4616
|
+
|
|
4478
4617
|
const {
|
|
4479
4618
|
DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$k
|
|
4480
4619
|
} = constants;
|
|
@@ -4526,48 +4665,63 @@ ${colors.bgRed(colors.white('Input error'))}: Please provide the required fields
|
|
|
4526
4665
|
logger.logger.log(DRY_RUN_BAIL_TEXT$k);
|
|
4527
4666
|
return;
|
|
4528
4667
|
}
|
|
4529
|
-
await
|
|
4668
|
+
await handleOrganizationList(json ? 'json' : markdown ? 'markdown' : 'text');
|
|
4530
4669
|
}
|
|
4531
4670
|
|
|
4532
|
-
async function
|
|
4671
|
+
async function fetchSecurityPolicy(orgSlug) {
|
|
4533
4672
|
const apiToken = shadowNpmInject.getDefaultToken();
|
|
4534
4673
|
if (!apiToken) {
|
|
4535
4674
|
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.');
|
|
4536
4675
|
}
|
|
4537
|
-
await
|
|
4676
|
+
return await fetchSecurityPolicyWithToken(apiToken, orgSlug);
|
|
4538
4677
|
}
|
|
4539
|
-
async function
|
|
4678
|
+
async function fetchSecurityPolicyWithToken(apiToken, orgSlug) {
|
|
4540
4679
|
// Lazily access constants.spinner.
|
|
4541
4680
|
const {
|
|
4542
4681
|
spinner
|
|
4543
4682
|
} = constants;
|
|
4544
|
-
spinner.start('Fetching organization quota...');
|
|
4545
4683
|
const socketSdk = await shadowNpmInject.setupSdk(apiToken);
|
|
4684
|
+
spinner.start('Fetching organization quota...');
|
|
4546
4685
|
const result = await handleApiCall(socketSdk.getOrgSecurityPolicy(orgSlug), 'looking up organization quota');
|
|
4686
|
+
spinner?.successAndStop('Received organization quota response.');
|
|
4547
4687
|
if (!result.success) {
|
|
4548
4688
|
handleUnsuccessfulApiResponse('getOrgSecurityPolicy', result);
|
|
4549
4689
|
return;
|
|
4550
4690
|
}
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
const mapped = entries.map(([key, value]) => [key, value.action]);
|
|
4567
|
-
mapped.sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
4568
|
-
logger.logger.log(mdTableOfPairs(mapped, ['name', 'action']));
|
|
4569
|
-
}
|
|
4691
|
+
return result.data;
|
|
4692
|
+
}
|
|
4693
|
+
|
|
4694
|
+
async function getSecurityPolicy(data, outputKind) {
|
|
4695
|
+
if (outputKind === 'json') {
|
|
4696
|
+
let json;
|
|
4697
|
+
try {
|
|
4698
|
+
json = JSON.stringify(data, null, 2);
|
|
4699
|
+
} catch {
|
|
4700
|
+
console.error('Failed to convert the server response to json, try running the same command without --json');
|
|
4701
|
+
return;
|
|
4702
|
+
}
|
|
4703
|
+
logger.logger.log(json);
|
|
4704
|
+
logger.logger.log('');
|
|
4705
|
+
return;
|
|
4570
4706
|
}
|
|
4707
|
+
logger.logger.log('# Security policy');
|
|
4708
|
+
logger.logger.log('');
|
|
4709
|
+
logger.logger.log(`The default security policy setting is: "${data.securityPolicyDefault}"`);
|
|
4710
|
+
logger.logger.log('');
|
|
4711
|
+
logger.logger.log('These are the security policies per setting for your organization:');
|
|
4712
|
+
logger.logger.log('');
|
|
4713
|
+
const rules = data.securityPolicyRules;
|
|
4714
|
+
const entries = Object.entries(rules);
|
|
4715
|
+
const mapped = entries.map(([key, value]) => [key, value.action]);
|
|
4716
|
+
mapped.sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
4717
|
+
logger.logger.log(mdTableOfPairs(mapped, ['name', 'action']));
|
|
4718
|
+
logger.logger.log('');
|
|
4719
|
+
}
|
|
4720
|
+
|
|
4721
|
+
async function handleSecurityPolicy(orgSlug, outputKind) {
|
|
4722
|
+
const data = await fetchSecurityPolicy(orgSlug);
|
|
4723
|
+
if (!data) return;
|
|
4724
|
+
await getSecurityPolicy(data, outputKind);
|
|
4571
4725
|
}
|
|
4572
4726
|
|
|
4573
4727
|
const {
|
|
@@ -4632,7 +4786,7 @@ ${colors.bgRed(colors.white('Input error'))}: Please provide the required fields
|
|
|
4632
4786
|
logger.logger.log(DRY_RUN_BAIL_TEXT$j);
|
|
4633
4787
|
return;
|
|
4634
4788
|
}
|
|
4635
|
-
await
|
|
4789
|
+
await handleSecurityPolicy(orgSlug, json ? 'json' : markdown ? 'markdown' : 'text');
|
|
4636
4790
|
}
|
|
4637
4791
|
|
|
4638
4792
|
const description$5 = 'Organization policy details';
|
|
@@ -4659,45 +4813,57 @@ const cmdOrganizationPolicy = {
|
|
|
4659
4813
|
}
|
|
4660
4814
|
};
|
|
4661
4815
|
|
|
4662
|
-
async function
|
|
4816
|
+
async function fetchQuota() {
|
|
4663
4817
|
const apiToken = shadowNpmInject.getDefaultToken();
|
|
4664
4818
|
if (!apiToken) {
|
|
4665
4819
|
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.');
|
|
4666
4820
|
}
|
|
4667
|
-
await
|
|
4821
|
+
return await fetchQuotaWithToken(apiToken);
|
|
4668
4822
|
}
|
|
4669
|
-
async function
|
|
4823
|
+
async function fetchQuotaWithToken(apiToken) {
|
|
4670
4824
|
// Lazily access constants.spinner.
|
|
4671
4825
|
const {
|
|
4672
4826
|
spinner
|
|
4673
4827
|
} = constants;
|
|
4674
|
-
spinner.start('Fetching organization quota...');
|
|
4675
4828
|
const socketSdk = await shadowNpmInject.setupSdk(apiToken);
|
|
4829
|
+
spinner.start('Fetching organization quota...');
|
|
4676
4830
|
const result = await handleApiCall(socketSdk.getQuota(), 'looking up organization quota');
|
|
4831
|
+
spinner?.successAndStop('Recieved organization quota response.');
|
|
4677
4832
|
if (!result.success) {
|
|
4678
4833
|
handleUnsuccessfulApiResponse('getQuota', result);
|
|
4679
4834
|
return;
|
|
4680
4835
|
}
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
default:
|
|
4697
|
-
{
|
|
4698
|
-
logger.logger.log(`Quota left on the current API token: ${result.data.quota}\n`);
|
|
4699
|
-
}
|
|
4836
|
+
return result.data;
|
|
4837
|
+
}
|
|
4838
|
+
|
|
4839
|
+
async function outputQuota(data, outputKind = 'text') {
|
|
4840
|
+
if (outputKind === 'json') {
|
|
4841
|
+
let json;
|
|
4842
|
+
try {
|
|
4843
|
+
json = JSON.stringify(data, null, 2);
|
|
4844
|
+
} catch {
|
|
4845
|
+
console.error('Failed to convert the server response to json, try running the same command without --json');
|
|
4846
|
+
return;
|
|
4847
|
+
}
|
|
4848
|
+
logger.logger.log(json);
|
|
4849
|
+
logger.logger.log('');
|
|
4850
|
+
return;
|
|
4700
4851
|
}
|
|
4852
|
+
if (outputKind === 'markdown') {
|
|
4853
|
+
logger.logger.log('# Quota');
|
|
4854
|
+
logger.logger.log('');
|
|
4855
|
+
logger.logger.log(`Quota left on the current API token: ${data.quota}`);
|
|
4856
|
+
logger.logger.log('');
|
|
4857
|
+
return;
|
|
4858
|
+
}
|
|
4859
|
+
logger.logger.log(`Quota left on the current API token: ${data.quota}`);
|
|
4860
|
+
logger.logger.log('');
|
|
4861
|
+
}
|
|
4862
|
+
|
|
4863
|
+
async function handleQuota(outputKind = 'text') {
|
|
4864
|
+
const data = await fetchQuota();
|
|
4865
|
+
if (!data) return;
|
|
4866
|
+
await outputQuota(data, outputKind);
|
|
4701
4867
|
}
|
|
4702
4868
|
|
|
4703
4869
|
const {
|
|
@@ -4751,7 +4917,7 @@ ${colors.bgRed(colors.white('Input error'))}: Please provide the required fields
|
|
|
4751
4917
|
logger.logger.log(DRY_RUN_BAIL_TEXT$i);
|
|
4752
4918
|
return;
|
|
4753
4919
|
}
|
|
4754
|
-
await
|
|
4920
|
+
await handleQuota(json ? 'json' : markdown ? 'markdown' : 'text');
|
|
4755
4921
|
}
|
|
4756
4922
|
|
|
4757
4923
|
const description$4 = 'Account details';
|
|
@@ -4780,68 +4946,15 @@ const cmdOrganization = {
|
|
|
4780
4946
|
}
|
|
4781
4947
|
};
|
|
4782
4948
|
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
// Not hardcoding the namespace since we don't know what the server accepts.
|
|
4786
|
-
// The ecosystem is considered as the first package if it is not an a-z string.
|
|
4787
|
-
function parsePackageSpecifiers(ecosystem, pkgs) {
|
|
4788
|
-
let valid = true;
|
|
4789
|
-
const purls = [];
|
|
4790
|
-
if (!ecosystem) {
|
|
4791
|
-
valid = false;
|
|
4792
|
-
} else if (/^[a-zA-Z]+$/.test(ecosystem)) {
|
|
4793
|
-
for (let i = 0; i < pkgs.length; ++i) {
|
|
4794
|
-
const pkg = pkgs[i] ?? '';
|
|
4795
|
-
if (!pkg) {
|
|
4796
|
-
valid = false;
|
|
4797
|
-
break;
|
|
4798
|
-
} else if (pkg.startsWith('pkg:')) {
|
|
4799
|
-
// keep
|
|
4800
|
-
purls.push(pkg);
|
|
4801
|
-
} else if (pkg.includes('/')) {
|
|
4802
|
-
// Looks like this arg was already namespaced
|
|
4803
|
-
purls.push('pkg:' + pkg);
|
|
4804
|
-
} else {
|
|
4805
|
-
purls.push('pkg:' + ecosystem + '/' + pkg);
|
|
4806
|
-
}
|
|
4807
|
-
}
|
|
4808
|
-
if (!purls.length) {
|
|
4809
|
-
valid = false;
|
|
4810
|
-
}
|
|
4811
|
-
} else {
|
|
4812
|
-
// Assume ecosystem is a purl, too
|
|
4813
|
-
pkgs.unshift(ecosystem);
|
|
4814
|
-
for (let i = 0; i < pkgs.length; ++i) {
|
|
4815
|
-
const pkg = pkgs[i] ?? '';
|
|
4816
|
-
if (!/^(?:pkg:)?[a-zA-Z]+\/./.test(pkg)) {
|
|
4817
|
-
// At least one purl did not start with `pkg:eco/x` or `eco/x`
|
|
4818
|
-
valid = false;
|
|
4819
|
-
break;
|
|
4820
|
-
} else if (pkg.startsWith('pkg:')) {
|
|
4821
|
-
purls.push(pkg);
|
|
4822
|
-
} else {
|
|
4823
|
-
purls.push('pkg:' + pkg);
|
|
4824
|
-
}
|
|
4825
|
-
}
|
|
4826
|
-
if (!purls.length) {
|
|
4827
|
-
valid = false;
|
|
4828
|
-
}
|
|
4829
|
-
}
|
|
4830
|
-
return {
|
|
4831
|
-
purls,
|
|
4832
|
-
valid
|
|
4833
|
-
};
|
|
4834
|
-
}
|
|
4835
|
-
|
|
4836
|
-
async function fetchPackageInfo(purls) {
|
|
4837
|
-
const socketSdk = await shadowNpmInject.setupSdk(shadowNpmInject.getPublicToken());
|
|
4949
|
+
async function fetchPurlsShallowScore(purls) {
|
|
4950
|
+
logger.logger.error(`Requesting shallow score data for ${purls.length} package urls (purl): ${purls.join(', ')}`);
|
|
4838
4951
|
|
|
4839
4952
|
// Lazily access constants.spinner.
|
|
4840
4953
|
const {
|
|
4841
4954
|
spinner
|
|
4842
4955
|
} = constants;
|
|
4843
|
-
logger.logger.error(`Requesting shallow score data for ${purls.length} package urls (purl): ${purls.join(', ')}`);
|
|
4844
4956
|
spinner.start(`Requesting data ...`);
|
|
4957
|
+
const socketSdk = await shadowNpmInject.setupSdk(shadowNpmInject.getPublicToken());
|
|
4845
4958
|
const result = await handleApiCall(socketSdk.batchPackageFetch({
|
|
4846
4959
|
alerts: 'true'
|
|
4847
4960
|
// compact: false,
|
|
@@ -4856,12 +4969,11 @@ async function fetchPackageInfo(purls) {
|
|
|
4856
4969
|
spinner.successAndStop('Request completed');
|
|
4857
4970
|
if (result.success) {
|
|
4858
4971
|
return result;
|
|
4859
|
-
} else {
|
|
4860
|
-
handleUnsuccessfulApiResponse('batchPackageFetch', result);
|
|
4861
4972
|
}
|
|
4973
|
+
handleUnsuccessfulApiResponse('batchPackageFetch', result);
|
|
4862
4974
|
}
|
|
4863
4975
|
|
|
4864
|
-
function
|
|
4976
|
+
function outputPurlsShallowScore(purls, packageData, outputKind) {
|
|
4865
4977
|
if (outputKind === 'json') {
|
|
4866
4978
|
// In JSON simply return what the server responds with. Don't bother trying
|
|
4867
4979
|
// to match the response with the requested packages/purls.
|
|
@@ -4941,14 +5053,67 @@ function getAlertString(alerts, noColor = false) {
|
|
|
4941
5053
|
}
|
|
4942
5054
|
}
|
|
4943
5055
|
|
|
4944
|
-
async function
|
|
5056
|
+
async function handlePurlsShallowScore({
|
|
4945
5057
|
outputKind,
|
|
4946
5058
|
purls
|
|
4947
5059
|
}) {
|
|
4948
|
-
const packageData = await
|
|
5060
|
+
const packageData = await fetchPurlsShallowScore(purls);
|
|
4949
5061
|
if (packageData) {
|
|
4950
|
-
|
|
5062
|
+
outputPurlsShallowScore(purls, packageData.data, outputKind);
|
|
5063
|
+
}
|
|
5064
|
+
}
|
|
5065
|
+
|
|
5066
|
+
// Either an ecosystem was given or all args must be (namespaced) purls
|
|
5067
|
+
// The `pkg:` part is optional here. We'll scan for `eco/name@version`.
|
|
5068
|
+
// Not hardcoding the namespace since we don't know what the server accepts.
|
|
5069
|
+
// The ecosystem is considered as the first package if it is not an a-z string.
|
|
5070
|
+
function parsePackageSpecifiers(ecosystem, pkgs) {
|
|
5071
|
+
let valid = true;
|
|
5072
|
+
const purls = [];
|
|
5073
|
+
if (!ecosystem) {
|
|
5074
|
+
valid = false;
|
|
5075
|
+
} else if (/^[a-zA-Z]+$/.test(ecosystem)) {
|
|
5076
|
+
for (let i = 0; i < pkgs.length; ++i) {
|
|
5077
|
+
const pkg = pkgs[i] ?? '';
|
|
5078
|
+
if (!pkg) {
|
|
5079
|
+
valid = false;
|
|
5080
|
+
break;
|
|
5081
|
+
} else if (pkg.startsWith('pkg:')) {
|
|
5082
|
+
// keep
|
|
5083
|
+
purls.push(pkg);
|
|
5084
|
+
} else if (pkg.includes('/')) {
|
|
5085
|
+
// Looks like this arg was already namespaced
|
|
5086
|
+
purls.push('pkg:' + pkg);
|
|
5087
|
+
} else {
|
|
5088
|
+
purls.push('pkg:' + ecosystem + '/' + pkg);
|
|
5089
|
+
}
|
|
5090
|
+
}
|
|
5091
|
+
if (!purls.length) {
|
|
5092
|
+
valid = false;
|
|
5093
|
+
}
|
|
5094
|
+
} else {
|
|
5095
|
+
// Assume ecosystem is a purl, too
|
|
5096
|
+
pkgs.unshift(ecosystem);
|
|
5097
|
+
for (let i = 0; i < pkgs.length; ++i) {
|
|
5098
|
+
const pkg = pkgs[i] ?? '';
|
|
5099
|
+
if (!/^(?:pkg:)?[a-zA-Z]+\/./.test(pkg)) {
|
|
5100
|
+
// At least one purl did not start with `pkg:eco/x` or `eco/x`
|
|
5101
|
+
valid = false;
|
|
5102
|
+
break;
|
|
5103
|
+
} else if (pkg.startsWith('pkg:')) {
|
|
5104
|
+
purls.push(pkg);
|
|
5105
|
+
} else {
|
|
5106
|
+
purls.push('pkg:' + pkg);
|
|
5107
|
+
}
|
|
5108
|
+
}
|
|
5109
|
+
if (!purls.length) {
|
|
5110
|
+
valid = false;
|
|
5111
|
+
}
|
|
4951
5112
|
}
|
|
5113
|
+
return {
|
|
5114
|
+
purls,
|
|
5115
|
+
valid
|
|
5116
|
+
};
|
|
4952
5117
|
}
|
|
4953
5118
|
|
|
4954
5119
|
const {
|
|
@@ -5040,7 +5205,7 @@ async function run$h(argv, importMeta, {
|
|
|
5040
5205
|
logger.logger.log(DRY_RUN_BAIL_TEXT$h);
|
|
5041
5206
|
return;
|
|
5042
5207
|
}
|
|
5043
|
-
await
|
|
5208
|
+
await handlePurlsShallowScore({
|
|
5044
5209
|
outputKind: json ? 'json' : markdown ? 'markdown' : 'text',
|
|
5045
5210
|
purls
|
|
5046
5211
|
});
|
|
@@ -5516,7 +5681,7 @@ const cmdReport = {
|
|
|
5516
5681
|
}
|
|
5517
5682
|
};
|
|
5518
5683
|
|
|
5519
|
-
async function
|
|
5684
|
+
async function fetchCreateRepo({
|
|
5520
5685
|
default_branch,
|
|
5521
5686
|
description,
|
|
5522
5687
|
homepage,
|
|
@@ -5528,8 +5693,7 @@ async function createRepo({
|
|
|
5528
5693
|
if (!apiToken) {
|
|
5529
5694
|
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.');
|
|
5530
5695
|
}
|
|
5531
|
-
await
|
|
5532
|
-
apiToken,
|
|
5696
|
+
return await fetchCreateRepoWithToken(apiToken, {
|
|
5533
5697
|
default_branch,
|
|
5534
5698
|
description,
|
|
5535
5699
|
homepage,
|
|
@@ -5538,8 +5702,7 @@ async function createRepo({
|
|
|
5538
5702
|
visibility
|
|
5539
5703
|
});
|
|
5540
5704
|
}
|
|
5541
|
-
async function
|
|
5542
|
-
apiToken,
|
|
5705
|
+
async function fetchCreateRepoWithToken(apiToken, {
|
|
5543
5706
|
default_branch,
|
|
5544
5707
|
description,
|
|
5545
5708
|
homepage,
|
|
@@ -5551,8 +5714,8 @@ async function createRepoWithToken({
|
|
|
5551
5714
|
const {
|
|
5552
5715
|
spinner
|
|
5553
5716
|
} = constants;
|
|
5554
|
-
spinner.start('Creating repository...');
|
|
5555
5717
|
const socketSdk = await shadowNpmInject.setupSdk(apiToken);
|
|
5718
|
+
spinner.start('Sending request ot create a repository...');
|
|
5556
5719
|
const result = await handleApiCall(socketSdk.createOrgRepo(orgSlug, {
|
|
5557
5720
|
name: repoName,
|
|
5558
5721
|
description,
|
|
@@ -5560,11 +5723,36 @@ async function createRepoWithToken({
|
|
|
5560
5723
|
default_branch,
|
|
5561
5724
|
visibility
|
|
5562
5725
|
}), 'creating repository');
|
|
5726
|
+
spinner.successAndStop('Received response requesting to create a repository.');
|
|
5563
5727
|
if (!result.success) {
|
|
5564
5728
|
handleUnsuccessfulApiResponse('createOrgRepo', result);
|
|
5565
5729
|
return;
|
|
5566
5730
|
}
|
|
5567
|
-
|
|
5731
|
+
return result.data;
|
|
5732
|
+
}
|
|
5733
|
+
|
|
5734
|
+
async function outputCreateRepo(_data) {
|
|
5735
|
+
logger.logger.success('Repository created successfully');
|
|
5736
|
+
}
|
|
5737
|
+
|
|
5738
|
+
async function handleCreateRepo({
|
|
5739
|
+
default_branch,
|
|
5740
|
+
description,
|
|
5741
|
+
homepage,
|
|
5742
|
+
orgSlug,
|
|
5743
|
+
repoName,
|
|
5744
|
+
visibility
|
|
5745
|
+
}) {
|
|
5746
|
+
const data = await fetchCreateRepo({
|
|
5747
|
+
default_branch,
|
|
5748
|
+
description,
|
|
5749
|
+
homepage,
|
|
5750
|
+
orgSlug,
|
|
5751
|
+
repoName,
|
|
5752
|
+
visibility
|
|
5753
|
+
});
|
|
5754
|
+
if (!data) return;
|
|
5755
|
+
await outputCreateRepo();
|
|
5568
5756
|
}
|
|
5569
5757
|
|
|
5570
5758
|
const {
|
|
@@ -5650,7 +5838,7 @@ async function run$c(argv, importMeta, {
|
|
|
5650
5838
|
logger.logger.log(DRY_RUN_BAIL_TEXT$c);
|
|
5651
5839
|
return;
|
|
5652
5840
|
}
|
|
5653
|
-
await
|
|
5841
|
+
await handleCreateRepo({
|
|
5654
5842
|
orgSlug,
|
|
5655
5843
|
repoName,
|
|
5656
5844
|
description: String(cli.flags['repoDescription'] || ''),
|
|
@@ -5660,7 +5848,7 @@ async function run$c(argv, importMeta, {
|
|
|
5660
5848
|
});
|
|
5661
5849
|
}
|
|
5662
5850
|
|
|
5663
|
-
async function
|
|
5851
|
+
async function handleDeleteRepo(orgSlug, repoName) {
|
|
5664
5852
|
const apiToken = shadowNpmInject.getDefaultToken();
|
|
5665
5853
|
if (!apiToken) {
|
|
5666
5854
|
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.');
|
|
@@ -5736,14 +5924,12 @@ async function run$b(argv, importMeta, {
|
|
|
5736
5924
|
logger.logger.log(DRY_RUN_BAIL_TEXT$b);
|
|
5737
5925
|
return;
|
|
5738
5926
|
}
|
|
5739
|
-
await
|
|
5927
|
+
await handleDeleteRepo(orgSlug, repoName);
|
|
5740
5928
|
}
|
|
5741
5929
|
|
|
5742
|
-
|
|
5743
|
-
async function listRepos({
|
|
5930
|
+
async function fetchListRepos({
|
|
5744
5931
|
direction,
|
|
5745
5932
|
orgSlug,
|
|
5746
|
-
outputKind,
|
|
5747
5933
|
page,
|
|
5748
5934
|
per_page,
|
|
5749
5935
|
sort
|
|
@@ -5752,21 +5938,17 @@ async function listRepos({
|
|
|
5752
5938
|
if (!apiToken) {
|
|
5753
5939
|
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.');
|
|
5754
5940
|
}
|
|
5755
|
-
await
|
|
5756
|
-
apiToken,
|
|
5941
|
+
return await fetchListReposWithToken(apiToken, {
|
|
5757
5942
|
direction,
|
|
5758
5943
|
orgSlug,
|
|
5759
|
-
outputKind,
|
|
5760
5944
|
page,
|
|
5761
5945
|
per_page,
|
|
5762
5946
|
sort
|
|
5763
5947
|
});
|
|
5764
5948
|
}
|
|
5765
|
-
async function
|
|
5766
|
-
apiToken,
|
|
5949
|
+
async function fetchListReposWithToken(apiToken, {
|
|
5767
5950
|
direction,
|
|
5768
5951
|
orgSlug,
|
|
5769
|
-
outputKind,
|
|
5770
5952
|
page,
|
|
5771
5953
|
per_page,
|
|
5772
5954
|
sort
|
|
@@ -5775,28 +5957,33 @@ async function listReposWithToken({
|
|
|
5775
5957
|
const {
|
|
5776
5958
|
spinner
|
|
5777
5959
|
} = constants;
|
|
5778
|
-
spinner.start('Fetching list of repositories...');
|
|
5779
5960
|
const socketSdk = await shadowNpmInject.setupSdk(apiToken);
|
|
5961
|
+
spinner.start('Fetching list of repositories...');
|
|
5780
5962
|
const result = await handleApiCall(socketSdk.getOrgRepoList(orgSlug, {
|
|
5781
5963
|
sort,
|
|
5782
5964
|
direction,
|
|
5783
5965
|
per_page: String(per_page),
|
|
5784
5966
|
page: String(page)
|
|
5785
5967
|
}), 'listing repositories');
|
|
5968
|
+
spinner.successAndStop('Received response for repository list.');
|
|
5786
5969
|
if (!result.success) {
|
|
5787
5970
|
handleUnsuccessfulApiResponse('getOrgRepoList', result);
|
|
5788
5971
|
return;
|
|
5789
5972
|
}
|
|
5790
|
-
|
|
5973
|
+
return result.data;
|
|
5974
|
+
}
|
|
5975
|
+
|
|
5976
|
+
// @ts-ignore
|
|
5977
|
+
async function outputListRepos(data, outputKind) {
|
|
5791
5978
|
if (outputKind === 'json') {
|
|
5792
|
-
const
|
|
5979
|
+
const json = data.results.map(o => ({
|
|
5793
5980
|
id: o.id,
|
|
5794
5981
|
name: o.name,
|
|
5795
5982
|
visibility: o.visibility,
|
|
5796
5983
|
defaultBranch: o.default_branch,
|
|
5797
5984
|
archived: o.archived
|
|
5798
5985
|
}));
|
|
5799
|
-
logger.logger.log(JSON.stringify(
|
|
5986
|
+
logger.logger.log(JSON.stringify(json, null, 2));
|
|
5800
5987
|
return;
|
|
5801
5988
|
}
|
|
5802
5989
|
const options = {
|
|
@@ -5817,7 +6004,26 @@ async function listReposWithToken({
|
|
|
5817
6004
|
name: colors.magenta('Archived')
|
|
5818
6005
|
}]
|
|
5819
6006
|
};
|
|
5820
|
-
logger.logger.log(chalkTable(options,
|
|
6007
|
+
logger.logger.log(chalkTable(options, data.results));
|
|
6008
|
+
}
|
|
6009
|
+
|
|
6010
|
+
async function handleListRepos({
|
|
6011
|
+
direction,
|
|
6012
|
+
orgSlug,
|
|
6013
|
+
outputKind,
|
|
6014
|
+
page,
|
|
6015
|
+
per_page,
|
|
6016
|
+
sort
|
|
6017
|
+
}) {
|
|
6018
|
+
const data = await fetchListRepos({
|
|
6019
|
+
direction,
|
|
6020
|
+
orgSlug,
|
|
6021
|
+
page,
|
|
6022
|
+
per_page,
|
|
6023
|
+
sort
|
|
6024
|
+
});
|
|
6025
|
+
if (!data) return;
|
|
6026
|
+
await outputListRepos(data, outputKind);
|
|
5821
6027
|
}
|
|
5822
6028
|
|
|
5823
6029
|
const {
|
|
@@ -5896,7 +6102,7 @@ async function run$a(argv, importMeta, {
|
|
|
5896
6102
|
logger.logger.log(DRY_RUN_BAIL_TEXT$a);
|
|
5897
6103
|
return;
|
|
5898
6104
|
}
|
|
5899
|
-
await
|
|
6105
|
+
await handleListRepos({
|
|
5900
6106
|
direction: cli.flags['direction'] === 'asc' ? 'asc' : 'desc',
|
|
5901
6107
|
orgSlug,
|
|
5902
6108
|
outputKind: cli.flags['json'] ? 'json' : cli.flags['markdown'] ? 'markdown' : 'print',
|
|
@@ -5906,7 +6112,7 @@ async function run$a(argv, importMeta, {
|
|
|
5906
6112
|
});
|
|
5907
6113
|
}
|
|
5908
6114
|
|
|
5909
|
-
async function
|
|
6115
|
+
async function fetchUpdateRepo({
|
|
5910
6116
|
default_branch,
|
|
5911
6117
|
description,
|
|
5912
6118
|
homepage,
|
|
@@ -5918,8 +6124,7 @@ async function updateRepo({
|
|
|
5918
6124
|
if (!apiToken) {
|
|
5919
6125
|
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.');
|
|
5920
6126
|
}
|
|
5921
|
-
await
|
|
5922
|
-
apiToken,
|
|
6127
|
+
return await fetchUpdateRepoWithToken(apiToken, {
|
|
5923
6128
|
default_branch,
|
|
5924
6129
|
description,
|
|
5925
6130
|
homepage,
|
|
@@ -5928,8 +6133,7 @@ async function updateRepo({
|
|
|
5928
6133
|
visibility
|
|
5929
6134
|
});
|
|
5930
6135
|
}
|
|
5931
|
-
async function
|
|
5932
|
-
apiToken,
|
|
6136
|
+
async function fetchUpdateRepoWithToken(apiToken, {
|
|
5933
6137
|
default_branch,
|
|
5934
6138
|
description,
|
|
5935
6139
|
homepage,
|
|
@@ -5941,7 +6145,7 @@ async function updateRepoWithToken({
|
|
|
5941
6145
|
const {
|
|
5942
6146
|
spinner
|
|
5943
6147
|
} = constants;
|
|
5944
|
-
spinner.start('
|
|
6148
|
+
spinner.start('Sending request to update a repository...');
|
|
5945
6149
|
const socketSdk = await shadowNpmInject.setupSdk(apiToken);
|
|
5946
6150
|
const result = await handleApiCall(socketSdk.updateOrgRepo(orgSlug, repoName, {
|
|
5947
6151
|
orgSlug,
|
|
@@ -5951,11 +6155,36 @@ async function updateRepoWithToken({
|
|
|
5951
6155
|
default_branch,
|
|
5952
6156
|
visibility
|
|
5953
6157
|
}), 'updating repository');
|
|
6158
|
+
spinner.successAndStop('Received response trying to update a repository');
|
|
5954
6159
|
if (!result.success) {
|
|
5955
6160
|
handleUnsuccessfulApiResponse('updateOrgRepo', result);
|
|
5956
6161
|
return;
|
|
5957
6162
|
}
|
|
5958
|
-
|
|
6163
|
+
return result.data;
|
|
6164
|
+
}
|
|
6165
|
+
|
|
6166
|
+
async function outputUpdateRepo(_data) {
|
|
6167
|
+
logger.logger.success('Repository updated successfully');
|
|
6168
|
+
}
|
|
6169
|
+
|
|
6170
|
+
async function handleUpdateRepo({
|
|
6171
|
+
default_branch,
|
|
6172
|
+
description,
|
|
6173
|
+
homepage,
|
|
6174
|
+
orgSlug,
|
|
6175
|
+
repoName,
|
|
6176
|
+
visibility
|
|
6177
|
+
}) {
|
|
6178
|
+
const data = await fetchUpdateRepo({
|
|
6179
|
+
default_branch,
|
|
6180
|
+
description,
|
|
6181
|
+
homepage,
|
|
6182
|
+
orgSlug,
|
|
6183
|
+
repoName,
|
|
6184
|
+
visibility
|
|
6185
|
+
});
|
|
6186
|
+
if (!data) return;
|
|
6187
|
+
await outputUpdateRepo();
|
|
5959
6188
|
}
|
|
5960
6189
|
|
|
5961
6190
|
const {
|
|
@@ -6043,7 +6272,7 @@ async function run$9(argv, importMeta, {
|
|
|
6043
6272
|
logger.logger.log(DRY_RUN_BAIL_TEXT$9);
|
|
6044
6273
|
return;
|
|
6045
6274
|
}
|
|
6046
|
-
await
|
|
6275
|
+
await handleUpdateRepo({
|
|
6047
6276
|
orgSlug,
|
|
6048
6277
|
repoName,
|
|
6049
6278
|
description: String(cli.flags['repoDescription'] || ''),
|
|
@@ -6053,27 +6282,31 @@ async function run$9(argv, importMeta, {
|
|
|
6053
6282
|
});
|
|
6054
6283
|
}
|
|
6055
6284
|
|
|
6056
|
-
|
|
6057
|
-
async function viewRepo(orgSlug, repoName, outputKind) {
|
|
6285
|
+
async function fetchViewRepo(orgSlug, repoName) {
|
|
6058
6286
|
const apiToken = shadowNpmInject.getDefaultToken();
|
|
6059
6287
|
if (!apiToken) {
|
|
6060
6288
|
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.');
|
|
6061
6289
|
}
|
|
6062
|
-
await
|
|
6290
|
+
return await fetchViewRepoWithToken(orgSlug, repoName, apiToken);
|
|
6063
6291
|
}
|
|
6064
|
-
async function
|
|
6292
|
+
async function fetchViewRepoWithToken(orgSlug, repoName, apiToken) {
|
|
6065
6293
|
// Lazily access constants.spinner.
|
|
6066
6294
|
const {
|
|
6067
6295
|
spinner
|
|
6068
6296
|
} = constants;
|
|
6069
|
-
spinner.start('Fetching repository data...');
|
|
6070
6297
|
const socketSdk = await shadowNpmInject.setupSdk(apiToken);
|
|
6298
|
+
spinner.start('Fetching repository data...');
|
|
6071
6299
|
const result = await handleApiCall(socketSdk.getOrgRepo(orgSlug, repoName), 'fetching repository');
|
|
6300
|
+
spinner.successAndStop('Received response while fetched repository data.');
|
|
6072
6301
|
if (!result.success) {
|
|
6073
6302
|
handleUnsuccessfulApiResponse('getOrgRepo', result);
|
|
6074
6303
|
return;
|
|
6075
6304
|
}
|
|
6076
|
-
|
|
6305
|
+
return result.data;
|
|
6306
|
+
}
|
|
6307
|
+
|
|
6308
|
+
// @ts-ignore
|
|
6309
|
+
async function outputViewRepo(data, outputKind) {
|
|
6077
6310
|
if (outputKind === 'json') {
|
|
6078
6311
|
const {
|
|
6079
6312
|
archived,
|
|
@@ -6083,7 +6316,7 @@ async function viewRepoWithToken(orgSlug, repoName, apiToken, outputKind) {
|
|
|
6083
6316
|
id,
|
|
6084
6317
|
name,
|
|
6085
6318
|
visibility
|
|
6086
|
-
} =
|
|
6319
|
+
} = data;
|
|
6087
6320
|
logger.logger.log(JSON.stringify({
|
|
6088
6321
|
id,
|
|
6089
6322
|
name,
|
|
@@ -6119,7 +6352,13 @@ async function viewRepoWithToken(orgSlug, repoName, apiToken, outputKind) {
|
|
|
6119
6352
|
name: colors.magenta('Created at')
|
|
6120
6353
|
}]
|
|
6121
6354
|
};
|
|
6122
|
-
logger.logger.log(chalkTable(options, [
|
|
6355
|
+
logger.logger.log(chalkTable(options, [data]));
|
|
6356
|
+
}
|
|
6357
|
+
|
|
6358
|
+
async function handleViewRepo(orgSlug, repoName, outputKind) {
|
|
6359
|
+
const data = await fetchViewRepo(orgSlug, repoName);
|
|
6360
|
+
if (!data) return;
|
|
6361
|
+
await outputViewRepo(data, outputKind);
|
|
6123
6362
|
}
|
|
6124
6363
|
|
|
6125
6364
|
const {
|
|
@@ -6163,7 +6402,11 @@ async function run$8(argv, importMeta, {
|
|
|
6163
6402
|
importMeta,
|
|
6164
6403
|
parentName
|
|
6165
6404
|
});
|
|
6166
|
-
const
|
|
6405
|
+
const {
|
|
6406
|
+
json,
|
|
6407
|
+
markdown,
|
|
6408
|
+
repoName
|
|
6409
|
+
} = cli.flags;
|
|
6167
6410
|
const [orgSlug = ''] = cli.input;
|
|
6168
6411
|
if (!repoName || typeof repoName !== 'string' || !orgSlug) {
|
|
6169
6412
|
// Use exit status of 2 to indicate incorrect usage, generally invalid
|
|
@@ -6183,7 +6426,7 @@ async function run$8(argv, importMeta, {
|
|
|
6183
6426
|
logger.logger.log(DRY_RUN_BAIL_TEXT$8);
|
|
6184
6427
|
return;
|
|
6185
6428
|
}
|
|
6186
|
-
await
|
|
6429
|
+
await handleViewRepo(orgSlug, repoName, json ? 'json' : markdown ? 'markdown' : 'text');
|
|
6187
6430
|
}
|
|
6188
6431
|
|
|
6189
6432
|
const description$1 = 'Repositories related commands';
|
|
@@ -8214,7 +8457,7 @@ void (async () => {
|
|
|
8214
8457
|
await vendor.updater({
|
|
8215
8458
|
name: SOCKET_CLI_BIN_NAME,
|
|
8216
8459
|
// The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
|
|
8217
|
-
version: "0.14.
|
|
8460
|
+
version: "0.14.65",
|
|
8218
8461
|
ttl: 86_400_000 /* 24 hours in milliseconds */
|
|
8219
8462
|
});
|
|
8220
8463
|
try {
|
|
@@ -8281,5 +8524,5 @@ void (async () => {
|
|
|
8281
8524
|
await shadowNpmInject.captureException(e);
|
|
8282
8525
|
}
|
|
8283
8526
|
})();
|
|
8284
|
-
//# debugId=
|
|
8527
|
+
//# debugId=4f35ba71-7571-4877-b38b-469cb0fdda66
|
|
8285
8528
|
//# sourceMappingURL=cli.js.map
|