@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/module-sync/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');
|
|
@@ -47,7 +48,6 @@ var semver = _socketInterop(require('semver'));
|
|
|
47
48
|
var which = _socketInterop(require('which'));
|
|
48
49
|
var index_cjs = require('@socketregistry/hyrious__bun.lockb/index.cjs');
|
|
49
50
|
var sorts = require('@socketsecurity/registry/lib/sorts');
|
|
50
|
-
var strings = require('@socketsecurity/registry/lib/strings');
|
|
51
51
|
var registryConstants = require('@socketsecurity/registry/lib/constants');
|
|
52
52
|
var isInteractive = require('@socketregistry/is-interactive/index.cjs');
|
|
53
53
|
var terminalLink = _socketInterop(require('terminal-link'));
|
|
@@ -64,9 +64,6 @@ var BoxWidget = _socketInterop(require('blessed/lib/widgets/box'));
|
|
|
64
64
|
var TableWidget = _socketInterop(require('blessed-contrib/lib/widget/table'));
|
|
65
65
|
var readline$1 = require('node:readline');
|
|
66
66
|
|
|
67
|
-
const {
|
|
68
|
-
API_V0_URL
|
|
69
|
-
} = constants;
|
|
70
67
|
function handleUnsuccessfulApiResponse(_name, result) {
|
|
71
68
|
// SocketSdkErrorType['error'] is not typed.
|
|
72
69
|
const resultErrorMessage = result.error?.message;
|
|
@@ -98,13 +95,20 @@ async function handleAPIError(code) {
|
|
|
98
95
|
return 'One of the options passed might be incorrect.';
|
|
99
96
|
} else if (code === 403) {
|
|
100
97
|
return 'You might be trying to access an organization that is not linked to the API key you are logged in with.';
|
|
101
|
-
}
|
|
98
|
+
} else ;
|
|
102
99
|
}
|
|
103
100
|
function getLastFiveOfApiToken(token) {
|
|
104
101
|
// Get the last 5 characters of the API token before the trailing "_api".
|
|
105
102
|
return token.slice(-9, -4);
|
|
106
103
|
}
|
|
104
|
+
|
|
105
|
+
// The API server that should be used for operations.
|
|
106
|
+
function getDefaultApiBaseUrl() {
|
|
107
|
+
const baseUrl = process$1.env['SOCKET_SECURITY_API_BASE_URL'] || shadowNpmInject.getSetting('apiBaseUrl');
|
|
108
|
+
return strings.isNonEmptyString(baseUrl) ? baseUrl : undefined;
|
|
109
|
+
}
|
|
107
110
|
async function queryAPI(path, apiToken) {
|
|
111
|
+
const API_V0_URL = getDefaultApiBaseUrl();
|
|
108
112
|
return await fetch(`${API_V0_URL}/${path}`, {
|
|
109
113
|
method: 'GET',
|
|
110
114
|
headers: {
|
|
@@ -650,7 +654,7 @@ function emitBanner(name) {
|
|
|
650
654
|
}
|
|
651
655
|
function getAsciiHeader(command) {
|
|
652
656
|
const cliVersion = // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION_HASH']".
|
|
653
|
-
"0.14.
|
|
657
|
+
"0.14.65:ace6cae:076379f8:pub";
|
|
654
658
|
const nodeVersion = process.version;
|
|
655
659
|
const apiToken = shadowNpmInject.getSetting('apiToken');
|
|
656
660
|
const shownToken = apiToken ? getLastFiveOfApiToken(apiToken) : 'no';
|
|
@@ -775,7 +779,7 @@ async function run$C(argv, importMeta, {
|
|
|
775
779
|
});
|
|
776
780
|
}
|
|
777
781
|
|
|
778
|
-
async function
|
|
782
|
+
async function fetchAuditLog({
|
|
779
783
|
logType,
|
|
780
784
|
orgSlug,
|
|
781
785
|
outputKind,
|
|
@@ -786,16 +790,59 @@ async function getAuditLog({
|
|
|
786
790
|
if (!apiToken) {
|
|
787
791
|
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.');
|
|
788
792
|
}
|
|
789
|
-
|
|
790
|
-
|
|
793
|
+
return await fetchAuditLogWithToken(apiToken, {
|
|
794
|
+
logType,
|
|
791
795
|
orgSlug,
|
|
792
796
|
outputKind,
|
|
793
797
|
page,
|
|
794
|
-
perPage
|
|
795
|
-
logType
|
|
798
|
+
perPage
|
|
796
799
|
});
|
|
797
|
-
|
|
798
|
-
|
|
800
|
+
}
|
|
801
|
+
async function fetchAuditLogWithToken(apiToken, {
|
|
802
|
+
logType,
|
|
803
|
+
orgSlug,
|
|
804
|
+
outputKind,
|
|
805
|
+
page,
|
|
806
|
+
perPage
|
|
807
|
+
}) {
|
|
808
|
+
// Lazily access constants.spinner.
|
|
809
|
+
const {
|
|
810
|
+
spinner
|
|
811
|
+
} = constants;
|
|
812
|
+
spinner.start(`Looking up audit log for ${orgSlug}`);
|
|
813
|
+
const socketSdk = await shadowNpmInject.setupSdk(apiToken);
|
|
814
|
+
const result = await handleApiCall(socketSdk.getAuditLogEvents(orgSlug, {
|
|
815
|
+
// I'm not sure this is used at all.
|
|
816
|
+
outputJson: String(outputKind === 'json'),
|
|
817
|
+
// I'm not sure this is used at all.
|
|
818
|
+
outputMarkdown: String(outputKind === 'markdown'),
|
|
819
|
+
orgSlug,
|
|
820
|
+
type: logType,
|
|
821
|
+
page: String(page),
|
|
822
|
+
per_page: String(perPage)
|
|
823
|
+
}), `Looking up audit log for ${orgSlug}\n`);
|
|
824
|
+
if (!result.success) {
|
|
825
|
+
handleUnsuccessfulApiResponse('getAuditLogEvents', result);
|
|
826
|
+
return;
|
|
827
|
+
}
|
|
828
|
+
spinner.stop();
|
|
829
|
+
return result.data;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
async function outputAuditLog(auditLogs, {
|
|
833
|
+
logType,
|
|
834
|
+
orgSlug,
|
|
835
|
+
outputKind,
|
|
836
|
+
page,
|
|
837
|
+
perPage
|
|
838
|
+
}) {
|
|
839
|
+
if (outputKind === 'json') {
|
|
840
|
+
await outputAsJson(auditLogs.results, orgSlug, logType, page, perPage);
|
|
841
|
+
} else if (outputKind === 'markdown') {
|
|
842
|
+
await outputAsMarkdown(auditLogs.results, orgSlug, logType, page, perPage);
|
|
843
|
+
} else {
|
|
844
|
+
await outputAsPrint(auditLogs.results, orgSlug, logType);
|
|
845
|
+
}
|
|
799
846
|
}
|
|
800
847
|
async function outputAsJson(auditLogs, orgSlug, logType, page, perPage) {
|
|
801
848
|
let json;
|
|
@@ -881,36 +928,29 @@ async function outputAsPrint(auditLogs, orgSlug, logType) {
|
|
|
881
928
|
pageSize: 30
|
|
882
929
|
})]);
|
|
883
930
|
}
|
|
884
|
-
|
|
885
|
-
|
|
931
|
+
|
|
932
|
+
async function handleAuditLog({
|
|
886
933
|
logType,
|
|
887
934
|
orgSlug,
|
|
888
935
|
outputKind,
|
|
889
936
|
page,
|
|
890
937
|
perPage
|
|
891
938
|
}) {
|
|
892
|
-
|
|
893
|
-
const {
|
|
894
|
-
spinner
|
|
895
|
-
} = constants;
|
|
896
|
-
spinner.start(`Looking up audit log for ${orgSlug}`);
|
|
897
|
-
const socketSdk = await shadowNpmInject.setupSdk(apiToken);
|
|
898
|
-
const result = await handleApiCall(socketSdk.getAuditLogEvents(orgSlug, {
|
|
899
|
-
// I'm not sure this is used at all.
|
|
900
|
-
outputJson: String(outputKind === 'json'),
|
|
901
|
-
// I'm not sure this is used at all.
|
|
902
|
-
outputMarkdown: String(outputKind === 'markdown'),
|
|
939
|
+
const auditLogs = await fetchAuditLog({
|
|
903
940
|
orgSlug,
|
|
904
|
-
|
|
905
|
-
page
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
941
|
+
outputKind,
|
|
942
|
+
page,
|
|
943
|
+
perPage,
|
|
944
|
+
logType
|
|
945
|
+
});
|
|
946
|
+
if (!auditLogs) return;
|
|
947
|
+
await outputAuditLog(auditLogs, {
|
|
948
|
+
logType,
|
|
949
|
+
orgSlug,
|
|
950
|
+
outputKind,
|
|
951
|
+
page,
|
|
952
|
+
perPage
|
|
953
|
+
});
|
|
914
954
|
}
|
|
915
955
|
|
|
916
956
|
const {
|
|
@@ -994,7 +1034,7 @@ async function run$B(argv, importMeta, {
|
|
|
994
1034
|
logger.logger.log(DRY_RUN_BAIL_TEXT$A);
|
|
995
1035
|
return;
|
|
996
1036
|
}
|
|
997
|
-
await
|
|
1037
|
+
await handleAuditLog({
|
|
998
1038
|
orgSlug,
|
|
999
1039
|
outputKind: json ? 'json' : markdown ? 'markdown' : 'print',
|
|
1000
1040
|
page: Number(page || 0),
|
|
@@ -1253,36 +1293,60 @@ async function run$A(argv, importMeta, {
|
|
|
1253
1293
|
await runCycloneDX(yargv);
|
|
1254
1294
|
}
|
|
1255
1295
|
|
|
1256
|
-
|
|
1257
|
-
async function findDependencies({
|
|
1296
|
+
async function fetchDependencies({
|
|
1258
1297
|
limit,
|
|
1259
|
-
offset
|
|
1260
|
-
outputJson
|
|
1298
|
+
offset
|
|
1261
1299
|
}) {
|
|
1262
1300
|
const apiToken = shadowNpmInject.getDefaultToken();
|
|
1263
1301
|
if (!apiToken) {
|
|
1264
1302
|
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.');
|
|
1265
1303
|
}
|
|
1304
|
+
return await fetchDependenciesWithToken(apiToken, {
|
|
1305
|
+
limit,
|
|
1306
|
+
offset
|
|
1307
|
+
});
|
|
1308
|
+
}
|
|
1309
|
+
async function fetchDependenciesWithToken(apiToken, {
|
|
1310
|
+
limit,
|
|
1311
|
+
offset
|
|
1312
|
+
}) {
|
|
1266
1313
|
// Lazily access constants.spinner.
|
|
1267
1314
|
const {
|
|
1268
1315
|
spinner
|
|
1269
1316
|
} = constants;
|
|
1270
|
-
spinner.start('
|
|
1317
|
+
spinner.start('Fetching organization dependencies...');
|
|
1271
1318
|
const socketSdk = await shadowNpmInject.setupSdk(apiToken);
|
|
1272
1319
|
const result = await handleApiCall(socketSdk.searchDependencies({
|
|
1273
1320
|
limit,
|
|
1274
1321
|
offset
|
|
1275
1322
|
}), 'Searching dependencies');
|
|
1323
|
+
spinner?.successAndStop('Received organization dependencies response.');
|
|
1276
1324
|
if (!result.success) {
|
|
1277
1325
|
handleUnsuccessfulApiResponse('searchDependencies', result);
|
|
1278
1326
|
return;
|
|
1279
1327
|
}
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1328
|
+
return result.data;
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
// @ts-ignore
|
|
1332
|
+
async function outputDependencies(data, {
|
|
1333
|
+
limit,
|
|
1334
|
+
offset,
|
|
1335
|
+
outputKind
|
|
1336
|
+
}) {
|
|
1337
|
+
if (outputKind === 'json') {
|
|
1338
|
+
let json;
|
|
1339
|
+
try {
|
|
1340
|
+
json = JSON.stringify(data, null, 2);
|
|
1341
|
+
} catch (e) {
|
|
1342
|
+
process.exitCode = 1;
|
|
1343
|
+
logger.logger.fail('There was a problem converting the data to JSON, please try without the `--json` flag');
|
|
1344
|
+
return;
|
|
1345
|
+
}
|
|
1346
|
+
logger.logger.log(json);
|
|
1283
1347
|
return;
|
|
1284
1348
|
}
|
|
1285
|
-
logger.logger.log('Request details: Offset:', offset, ', limit:', limit, ', is there more data after this?',
|
|
1349
|
+
logger.logger.log('Request details: Offset:', offset, ', limit:', limit, ', is there more data after this?', data.end ? 'no' : 'yes');
|
|
1286
1350
|
const options = {
|
|
1287
1351
|
columns: [{
|
|
1288
1352
|
field: 'namespace',
|
|
@@ -1307,7 +1371,24 @@ async function findDependencies({
|
|
|
1307
1371
|
name: colors.cyan('Direct')
|
|
1308
1372
|
}]
|
|
1309
1373
|
};
|
|
1310
|
-
logger.logger.log(chalkTable(options,
|
|
1374
|
+
logger.logger.log(chalkTable(options, data.rows));
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
async function handleDependencies({
|
|
1378
|
+
limit,
|
|
1379
|
+
offset,
|
|
1380
|
+
outputKind
|
|
1381
|
+
}) {
|
|
1382
|
+
const data = await fetchDependencies({
|
|
1383
|
+
limit,
|
|
1384
|
+
offset
|
|
1385
|
+
});
|
|
1386
|
+
if (!data) return;
|
|
1387
|
+
await outputDependencies(data, {
|
|
1388
|
+
limit,
|
|
1389
|
+
offset,
|
|
1390
|
+
outputKind
|
|
1391
|
+
});
|
|
1311
1392
|
}
|
|
1312
1393
|
|
|
1313
1394
|
const {
|
|
@@ -1358,70 +1439,71 @@ async function run$z(argv, importMeta, {
|
|
|
1358
1439
|
importMeta,
|
|
1359
1440
|
parentName
|
|
1360
1441
|
});
|
|
1442
|
+
const {
|
|
1443
|
+
json,
|
|
1444
|
+
limit,
|
|
1445
|
+
markdown,
|
|
1446
|
+
offset
|
|
1447
|
+
} = cli.flags;
|
|
1361
1448
|
if (cli.flags['dryRun']) {
|
|
1362
1449
|
logger.logger.log(DRY_RUN_BAIL_TEXT$y);
|
|
1363
1450
|
return;
|
|
1364
1451
|
}
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
offset: Number(cli.flags['offset'] || 0) || 0,
|
|
1370
|
-
outputJson: Boolean(cli.flags['json'])
|
|
1452
|
+
await handleDependencies({
|
|
1453
|
+
limit: Number(limit || 0) || 0,
|
|
1454
|
+
offset: Number(offset || 0) || 0,
|
|
1455
|
+
outputKind: json ? 'json' : markdown ? 'markdown' : 'text'
|
|
1371
1456
|
});
|
|
1372
1457
|
}
|
|
1373
1458
|
|
|
1374
|
-
async function
|
|
1459
|
+
async function fetchDiffScan({
|
|
1375
1460
|
after,
|
|
1376
1461
|
before,
|
|
1377
|
-
|
|
1378
|
-
file,
|
|
1379
|
-
orgSlug,
|
|
1380
|
-
outputJson
|
|
1462
|
+
orgSlug
|
|
1381
1463
|
}) {
|
|
1382
1464
|
const apiToken = shadowNpmInject.getDefaultToken();
|
|
1383
1465
|
if (!apiToken) {
|
|
1384
1466
|
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.');
|
|
1385
1467
|
}
|
|
1386
|
-
await
|
|
1468
|
+
return await fetchDiffScanWithToken(apiToken, {
|
|
1387
1469
|
after,
|
|
1388
1470
|
before,
|
|
1389
|
-
|
|
1390
|
-
file,
|
|
1391
|
-
orgSlug,
|
|
1392
|
-
outputJson,
|
|
1393
|
-
apiToken
|
|
1471
|
+
orgSlug
|
|
1394
1472
|
});
|
|
1395
1473
|
}
|
|
1396
|
-
async function
|
|
1474
|
+
async function fetchDiffScanWithToken(apiToken, {
|
|
1397
1475
|
after,
|
|
1398
|
-
apiToken,
|
|
1399
1476
|
before,
|
|
1400
|
-
|
|
1401
|
-
file,
|
|
1402
|
-
orgSlug,
|
|
1403
|
-
outputJson
|
|
1477
|
+
orgSlug
|
|
1404
1478
|
}) {
|
|
1405
1479
|
// Lazily access constants.spinner.
|
|
1406
1480
|
const {
|
|
1407
1481
|
spinner
|
|
1408
1482
|
} = constants;
|
|
1409
|
-
spinner.start('
|
|
1483
|
+
spinner.start('Fetching diff-scan...');
|
|
1410
1484
|
const response = await queryAPI(`orgs/${orgSlug}/full-scans/diff?before=${encodeURIComponent(before)}&after=${encodeURIComponent(after)}`, apiToken);
|
|
1485
|
+
spinner?.successAndStop('Received diff-scan response');
|
|
1411
1486
|
if (!response.ok) {
|
|
1412
1487
|
const err = await handleAPIError(response.status);
|
|
1413
1488
|
spinner.errorAndStop(`${colors.bgRed(colors.white(response.statusText))}: ${err}`);
|
|
1414
1489
|
return;
|
|
1415
1490
|
}
|
|
1416
1491
|
const result = await handleApiCall(await response.json(), 'Deserializing json');
|
|
1417
|
-
|
|
1418
|
-
|
|
1492
|
+
return result;
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
async function outputDiffScan(result, {
|
|
1496
|
+
depth,
|
|
1497
|
+
file,
|
|
1498
|
+
outputKind
|
|
1499
|
+
}) {
|
|
1500
|
+
const dashboardUrl = result.diff_report_url;
|
|
1419
1501
|
const dashboardMessage = dashboardUrl ? `\n View this diff scan in the Socket dashboard: ${colors.cyan(dashboardUrl)}` : '';
|
|
1420
1502
|
|
|
1421
1503
|
// When forcing json, or dumping to file, serialize to string such that it
|
|
1422
1504
|
// won't get truncated. The only way to dump the full raw JSON to stdout is
|
|
1423
1505
|
// to use `--json --file -` (the dash is a standard notation for stdout)
|
|
1424
|
-
if (
|
|
1506
|
+
if (outputKind === 'json' || file) {
|
|
1425
1507
|
let json;
|
|
1426
1508
|
try {
|
|
1427
1509
|
json = JSON.stringify(result, null, 2);
|
|
@@ -1466,6 +1548,27 @@ async function getDiffScanWithToken({
|
|
|
1466
1548
|
logger.logger.log(dashboardMessage);
|
|
1467
1549
|
}
|
|
1468
1550
|
|
|
1551
|
+
async function handleDiffScan({
|
|
1552
|
+
after,
|
|
1553
|
+
before,
|
|
1554
|
+
depth,
|
|
1555
|
+
file,
|
|
1556
|
+
orgSlug,
|
|
1557
|
+
outputKind
|
|
1558
|
+
}) {
|
|
1559
|
+
const data = await fetchDiffScan({
|
|
1560
|
+
after,
|
|
1561
|
+
before,
|
|
1562
|
+
orgSlug
|
|
1563
|
+
});
|
|
1564
|
+
if (!data) return;
|
|
1565
|
+
await outputDiffScan(data, {
|
|
1566
|
+
depth,
|
|
1567
|
+
file,
|
|
1568
|
+
outputKind
|
|
1569
|
+
});
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1469
1572
|
const {
|
|
1470
1573
|
DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$x
|
|
1471
1574
|
} = constants;
|
|
@@ -1534,8 +1637,14 @@ async function run$y(argv, importMeta, {
|
|
|
1534
1637
|
importMeta,
|
|
1535
1638
|
parentName
|
|
1536
1639
|
});
|
|
1537
|
-
const
|
|
1538
|
-
|
|
1640
|
+
const {
|
|
1641
|
+
after,
|
|
1642
|
+
before,
|
|
1643
|
+
depth,
|
|
1644
|
+
file,
|
|
1645
|
+
json,
|
|
1646
|
+
markdown
|
|
1647
|
+
} = cli.flags;
|
|
1539
1648
|
const [orgSlug = ''] = cli.input;
|
|
1540
1649
|
if (!before || !after || cli.input.length < 1) {
|
|
1541
1650
|
// Use exit status of 2 to indicate incorrect usage, generally invalid
|
|
@@ -1553,13 +1662,13 @@ async function run$y(argv, importMeta, {
|
|
|
1553
1662
|
logger.logger.log(DRY_RUN_BAIL_TEXT$x);
|
|
1554
1663
|
return;
|
|
1555
1664
|
}
|
|
1556
|
-
await
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
depth: Number(cli.flags['depth']),
|
|
1665
|
+
await handleDiffScan({
|
|
1666
|
+
before: String(before || ''),
|
|
1667
|
+
after: String(after || ''),
|
|
1668
|
+
depth: Number(depth),
|
|
1561
1669
|
orgSlug,
|
|
1562
|
-
|
|
1670
|
+
outputKind: json ? 'json' : markdown ? 'markdown' : 'text',
|
|
1671
|
+
file: String(file || '')
|
|
1563
1672
|
});
|
|
1564
1673
|
}
|
|
1565
1674
|
|
|
@@ -1698,11 +1807,17 @@ async function npmFix(_pkgEnvDetails, cwd, options) {
|
|
|
1698
1807
|
|
|
1699
1808
|
async function getAlertsMapFromPnpmLockfile(lockfile, options) {
|
|
1700
1809
|
const {
|
|
1810
|
+
include: _include,
|
|
1701
1811
|
spinner
|
|
1702
1812
|
} = {
|
|
1703
1813
|
__proto__: null,
|
|
1704
1814
|
...options
|
|
1705
1815
|
};
|
|
1816
|
+
const include = {
|
|
1817
|
+
__proto__: null,
|
|
1818
|
+
unfixable: true,
|
|
1819
|
+
..._include
|
|
1820
|
+
};
|
|
1706
1821
|
const depTypes = lockfile_detectDepTypes.detectDepTypes(lockfile);
|
|
1707
1822
|
const pkgIds = Object.keys(depTypes);
|
|
1708
1823
|
let {
|
|
@@ -1714,12 +1829,23 @@ async function getAlertsMapFromPnpmLockfile(lockfile, options) {
|
|
|
1714
1829
|
}
|
|
1715
1830
|
const getText = () => `Looking up data for ${remaining} packages`;
|
|
1716
1831
|
spinner?.start(getText());
|
|
1832
|
+
const socketSdk = await shadowNpmInject.setupSdk(shadowNpmInject.getPublicToken());
|
|
1717
1833
|
const toAlertsMapOptions = {
|
|
1718
1834
|
overrides: lockfile.overrides,
|
|
1719
1835
|
...options
|
|
1720
1836
|
};
|
|
1721
|
-
for await (const
|
|
1722
|
-
|
|
1837
|
+
for await (const batchPackageFetchResult of socketSdk.batchPackageStream({
|
|
1838
|
+
alerts: 'true',
|
|
1839
|
+
compact: 'true',
|
|
1840
|
+
fixable: include.unfixable ? 'false' : 'true'
|
|
1841
|
+
}, {
|
|
1842
|
+
components: pkgIds.map(id => ({
|
|
1843
|
+
purl: `pkg:npm/${id}`
|
|
1844
|
+
}))
|
|
1845
|
+
})) {
|
|
1846
|
+
if (batchPackageFetchResult.success) {
|
|
1847
|
+
await shadowNpmInject.addArtifactToAlertsMap(batchPackageFetchResult.data, alertsByPkgId, toAlertsMapOptions);
|
|
1848
|
+
}
|
|
1723
1849
|
remaining -= 1;
|
|
1724
1850
|
if (spinner && remaining > 0) {
|
|
1725
1851
|
spinner.start();
|
|
@@ -2308,10 +2434,17 @@ async function run$x(argv, importMeta, {
|
|
|
2308
2434
|
await runFix();
|
|
2309
2435
|
}
|
|
2310
2436
|
|
|
2311
|
-
async function fetchPackageInfo
|
|
2437
|
+
async function fetchPackageInfo(pkgName, pkgVersion, includeAllIssues) {
|
|
2312
2438
|
const socketSdk = await shadowNpmInject.setupSdk(shadowNpmInject.getPublicToken());
|
|
2439
|
+
|
|
2440
|
+
// Lazily access constants.spinner.
|
|
2441
|
+
const {
|
|
2442
|
+
spinner
|
|
2443
|
+
} = constants;
|
|
2444
|
+
spinner.start(pkgVersion === 'latest' ? `Looking up data for the latest version of ${pkgName}` : `Looking up data for version ${pkgVersion} of ${pkgName}`);
|
|
2313
2445
|
const result = await handleApiCall(socketSdk.getIssuesByNPMPackage(pkgName, pkgVersion), 'looking up package');
|
|
2314
2446
|
const scoreResult = await handleApiCall(socketSdk.getScoreByNPMPackage(pkgName, pkgVersion), 'looking up package score');
|
|
2447
|
+
spinner.successAndStop('Data fetched');
|
|
2315
2448
|
if (result.success === false) {
|
|
2316
2449
|
return handleUnsuccessfulApiResponse('getIssuesByNPMPackage', result);
|
|
2317
2450
|
}
|
|
@@ -2337,7 +2470,7 @@ function formatScore$1(score) {
|
|
|
2337
2470
|
}
|
|
2338
2471
|
return colors.red(`${score}`);
|
|
2339
2472
|
}
|
|
2340
|
-
function
|
|
2473
|
+
function outputPackageIssuesDetails(packageData, outputMarkdown) {
|
|
2341
2474
|
const issueDetails = packageData.filter(d => d.value?.severity === shadowNpmInject.SEVERITY.critical || d.value?.severity === shadowNpmInject.SEVERITY.high);
|
|
2342
2475
|
const uniqueIssueDetails = issueDetails.reduce((acc, issue) => {
|
|
2343
2476
|
const {
|
|
@@ -2368,7 +2501,7 @@ function logPackageIssuesDetails(packageData, outputMarkdown) {
|
|
|
2368
2501
|
}
|
|
2369
2502
|
}
|
|
2370
2503
|
}
|
|
2371
|
-
function
|
|
2504
|
+
function outputPackageInfo({
|
|
2372
2505
|
data,
|
|
2373
2506
|
score,
|
|
2374
2507
|
severityCount
|
|
@@ -2406,7 +2539,7 @@ function logPackageInfo$1({
|
|
|
2406
2539
|
logger.logger.log('# Issues\n');
|
|
2407
2540
|
}
|
|
2408
2541
|
logger.logger.log(`Package has these issues: ${shadowNpmInject.formatSeverityCount(severityCount)}\n`);
|
|
2409
|
-
|
|
2542
|
+
outputPackageIssuesDetails(data, outputKind === 'markdown');
|
|
2410
2543
|
} else {
|
|
2411
2544
|
logger.logger.log('Package has no issues');
|
|
2412
2545
|
}
|
|
@@ -2429,7 +2562,7 @@ function logPackageInfo$1({
|
|
|
2429
2562
|
}
|
|
2430
2563
|
}
|
|
2431
2564
|
|
|
2432
|
-
async function
|
|
2565
|
+
async function handlePackageInfo({
|
|
2433
2566
|
commandName,
|
|
2434
2567
|
includeAllIssues,
|
|
2435
2568
|
outputKind,
|
|
@@ -2437,15 +2570,9 @@ async function getPackageInfo({
|
|
|
2437
2570
|
pkgVersion,
|
|
2438
2571
|
strict
|
|
2439
2572
|
}) {
|
|
2440
|
-
|
|
2441
|
-
const {
|
|
2442
|
-
spinner
|
|
2443
|
-
} = constants;
|
|
2444
|
-
spinner.start(pkgVersion === 'latest' ? `Looking up data for the latest version of ${pkgName}` : `Looking up data for version ${pkgVersion} of ${pkgName}`);
|
|
2445
|
-
const packageData = await fetchPackageInfo$1(pkgName, pkgVersion, includeAllIssues);
|
|
2446
|
-
spinner.successAndStop('Data fetched');
|
|
2573
|
+
const packageData = await fetchPackageInfo(pkgName, pkgVersion, includeAllIssues);
|
|
2447
2574
|
if (packageData) {
|
|
2448
|
-
|
|
2575
|
+
outputPackageInfo(packageData, {
|
|
2449
2576
|
name: commandName,
|
|
2450
2577
|
outputKind,
|
|
2451
2578
|
pkgName,
|
|
@@ -2520,7 +2647,7 @@ async function run$w(argv, importMeta, {
|
|
|
2520
2647
|
logger.logger.log(DRY_RUN_BAIL_TEXT$v);
|
|
2521
2648
|
return;
|
|
2522
2649
|
}
|
|
2523
|
-
await
|
|
2650
|
+
await handlePackageInfo({
|
|
2524
2651
|
commandName: `${parentName} ${config$w.commandName}`,
|
|
2525
2652
|
includeAllIssues: Boolean(all),
|
|
2526
2653
|
outputKind: json ? 'json' : markdown ? 'markdown' : 'print',
|
|
@@ -4410,29 +4537,35 @@ async function run$l(argv, importMeta, {
|
|
|
4410
4537
|
await applyOptimization(cwd, Boolean(cli.flags['pin']), Boolean(cli.flags['prod']));
|
|
4411
4538
|
}
|
|
4412
4539
|
|
|
4413
|
-
async function
|
|
4540
|
+
async function fetchOrganization() {
|
|
4414
4541
|
const apiToken = shadowNpmInject.getDefaultToken();
|
|
4415
4542
|
if (!apiToken) {
|
|
4416
4543
|
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.');
|
|
4417
4544
|
}
|
|
4418
|
-
await
|
|
4545
|
+
return await fetchOrganizationWithToken(apiToken);
|
|
4419
4546
|
}
|
|
4420
|
-
async function
|
|
4547
|
+
async function fetchOrganizationWithToken(apiToken) {
|
|
4548
|
+
const socketSdk = await shadowNpmInject.setupSdk(apiToken);
|
|
4549
|
+
|
|
4421
4550
|
// Lazily access constants.spinner.
|
|
4422
4551
|
const {
|
|
4423
4552
|
spinner
|
|
4424
4553
|
} = constants;
|
|
4425
|
-
spinner.start('Fetching
|
|
4426
|
-
const socketSdk = await shadowNpmInject.setupSdk(apiToken);
|
|
4554
|
+
spinner.start('Fetching organization list...');
|
|
4427
4555
|
const result = await handleApiCall(socketSdk.getOrganizations(), 'looking up organizations');
|
|
4556
|
+
spinner.successAndStop('Received organization list response.');
|
|
4428
4557
|
if (!result.success) {
|
|
4429
4558
|
handleUnsuccessfulApiResponse('getOrganizations', result);
|
|
4430
4559
|
return;
|
|
4431
4560
|
}
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4561
|
+
return result.data;
|
|
4562
|
+
}
|
|
4563
|
+
|
|
4564
|
+
async function outputOrganizationList(data, outputKind = 'text') {
|
|
4565
|
+
const organizations = Object.values(data.organizations);
|
|
4566
|
+
const apiToken = shadowNpmInject.getDefaultToken();
|
|
4567
|
+
const lastFiveOfApiToken = getLastFiveOfApiToken(apiToken ?? '?????');
|
|
4568
|
+
switch (outputKind) {
|
|
4436
4569
|
case 'json':
|
|
4437
4570
|
{
|
|
4438
4571
|
logger.logger.log(JSON.stringify(organizations.map(o => ({
|
|
@@ -4477,6 +4610,12 @@ async function printOrganizationsFromToken(apiToken, format = 'text') {
|
|
|
4477
4610
|
}
|
|
4478
4611
|
}
|
|
4479
4612
|
|
|
4613
|
+
async function handleOrganizationList(outputKind = 'text') {
|
|
4614
|
+
const data = await fetchOrganization();
|
|
4615
|
+
if (!data) return;
|
|
4616
|
+
await outputOrganizationList(data, outputKind);
|
|
4617
|
+
}
|
|
4618
|
+
|
|
4480
4619
|
const {
|
|
4481
4620
|
DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$k
|
|
4482
4621
|
} = constants;
|
|
@@ -4528,48 +4667,63 @@ ${colors.bgRed(colors.white('Input error'))}: Please provide the required fields
|
|
|
4528
4667
|
logger.logger.log(DRY_RUN_BAIL_TEXT$k);
|
|
4529
4668
|
return;
|
|
4530
4669
|
}
|
|
4531
|
-
await
|
|
4670
|
+
await handleOrganizationList(json ? 'json' : markdown ? 'markdown' : 'text');
|
|
4532
4671
|
}
|
|
4533
4672
|
|
|
4534
|
-
async function
|
|
4673
|
+
async function fetchSecurityPolicy(orgSlug) {
|
|
4535
4674
|
const apiToken = shadowNpmInject.getDefaultToken();
|
|
4536
4675
|
if (!apiToken) {
|
|
4537
4676
|
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.');
|
|
4538
4677
|
}
|
|
4539
|
-
await
|
|
4678
|
+
return await fetchSecurityPolicyWithToken(apiToken, orgSlug);
|
|
4540
4679
|
}
|
|
4541
|
-
async function
|
|
4680
|
+
async function fetchSecurityPolicyWithToken(apiToken, orgSlug) {
|
|
4542
4681
|
// Lazily access constants.spinner.
|
|
4543
4682
|
const {
|
|
4544
4683
|
spinner
|
|
4545
4684
|
} = constants;
|
|
4546
|
-
spinner.start('Fetching organization quota...');
|
|
4547
4685
|
const socketSdk = await shadowNpmInject.setupSdk(apiToken);
|
|
4686
|
+
spinner.start('Fetching organization quota...');
|
|
4548
4687
|
const result = await handleApiCall(socketSdk.getOrgSecurityPolicy(orgSlug), 'looking up organization quota');
|
|
4688
|
+
spinner?.successAndStop('Received organization quota response.');
|
|
4549
4689
|
if (!result.success) {
|
|
4550
4690
|
handleUnsuccessfulApiResponse('getOrgSecurityPolicy', result);
|
|
4551
4691
|
return;
|
|
4552
4692
|
}
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
const mapped = entries.map(([key, value]) => [key, value.action]);
|
|
4569
|
-
mapped.sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
4570
|
-
logger.logger.log(mdTableOfPairs(mapped, ['name', 'action']));
|
|
4571
|
-
}
|
|
4693
|
+
return result.data;
|
|
4694
|
+
}
|
|
4695
|
+
|
|
4696
|
+
async function getSecurityPolicy(data, outputKind) {
|
|
4697
|
+
if (outputKind === 'json') {
|
|
4698
|
+
let json;
|
|
4699
|
+
try {
|
|
4700
|
+
json = JSON.stringify(data, null, 2);
|
|
4701
|
+
} catch {
|
|
4702
|
+
console.error('Failed to convert the server response to json, try running the same command without --json');
|
|
4703
|
+
return;
|
|
4704
|
+
}
|
|
4705
|
+
logger.logger.log(json);
|
|
4706
|
+
logger.logger.log('');
|
|
4707
|
+
return;
|
|
4572
4708
|
}
|
|
4709
|
+
logger.logger.log('# Security policy');
|
|
4710
|
+
logger.logger.log('');
|
|
4711
|
+
logger.logger.log(`The default security policy setting is: "${data.securityPolicyDefault}"`);
|
|
4712
|
+
logger.logger.log('');
|
|
4713
|
+
logger.logger.log('These are the security policies per setting for your organization:');
|
|
4714
|
+
logger.logger.log('');
|
|
4715
|
+
const rules = data.securityPolicyRules;
|
|
4716
|
+
const entries = Object.entries(rules);
|
|
4717
|
+
const mapped = entries.map(([key, value]) => [key, value.action]);
|
|
4718
|
+
mapped.sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
4719
|
+
logger.logger.log(mdTableOfPairs(mapped, ['name', 'action']));
|
|
4720
|
+
logger.logger.log('');
|
|
4721
|
+
}
|
|
4722
|
+
|
|
4723
|
+
async function handleSecurityPolicy(orgSlug, outputKind) {
|
|
4724
|
+
const data = await fetchSecurityPolicy(orgSlug);
|
|
4725
|
+
if (!data) return;
|
|
4726
|
+
await getSecurityPolicy(data, outputKind);
|
|
4573
4727
|
}
|
|
4574
4728
|
|
|
4575
4729
|
const {
|
|
@@ -4634,7 +4788,7 @@ ${colors.bgRed(colors.white('Input error'))}: Please provide the required fields
|
|
|
4634
4788
|
logger.logger.log(DRY_RUN_BAIL_TEXT$j);
|
|
4635
4789
|
return;
|
|
4636
4790
|
}
|
|
4637
|
-
await
|
|
4791
|
+
await handleSecurityPolicy(orgSlug, json ? 'json' : markdown ? 'markdown' : 'text');
|
|
4638
4792
|
}
|
|
4639
4793
|
|
|
4640
4794
|
const description$5 = 'Organization policy details';
|
|
@@ -4661,45 +4815,57 @@ const cmdOrganizationPolicy = {
|
|
|
4661
4815
|
}
|
|
4662
4816
|
};
|
|
4663
4817
|
|
|
4664
|
-
async function
|
|
4818
|
+
async function fetchQuota() {
|
|
4665
4819
|
const apiToken = shadowNpmInject.getDefaultToken();
|
|
4666
4820
|
if (!apiToken) {
|
|
4667
4821
|
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.');
|
|
4668
4822
|
}
|
|
4669
|
-
await
|
|
4823
|
+
return await fetchQuotaWithToken(apiToken);
|
|
4670
4824
|
}
|
|
4671
|
-
async function
|
|
4825
|
+
async function fetchQuotaWithToken(apiToken) {
|
|
4672
4826
|
// Lazily access constants.spinner.
|
|
4673
4827
|
const {
|
|
4674
4828
|
spinner
|
|
4675
4829
|
} = constants;
|
|
4676
|
-
spinner.start('Fetching organization quota...');
|
|
4677
4830
|
const socketSdk = await shadowNpmInject.setupSdk(apiToken);
|
|
4831
|
+
spinner.start('Fetching organization quota...');
|
|
4678
4832
|
const result = await handleApiCall(socketSdk.getQuota(), 'looking up organization quota');
|
|
4833
|
+
spinner?.successAndStop('Recieved organization quota response.');
|
|
4679
4834
|
if (!result.success) {
|
|
4680
4835
|
handleUnsuccessfulApiResponse('getQuota', result);
|
|
4681
4836
|
return;
|
|
4682
4837
|
}
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
default:
|
|
4699
|
-
{
|
|
4700
|
-
logger.logger.log(`Quota left on the current API token: ${result.data.quota}\n`);
|
|
4701
|
-
}
|
|
4838
|
+
return result.data;
|
|
4839
|
+
}
|
|
4840
|
+
|
|
4841
|
+
async function outputQuota(data, outputKind = 'text') {
|
|
4842
|
+
if (outputKind === 'json') {
|
|
4843
|
+
let json;
|
|
4844
|
+
try {
|
|
4845
|
+
json = JSON.stringify(data, null, 2);
|
|
4846
|
+
} catch {
|
|
4847
|
+
console.error('Failed to convert the server response to json, try running the same command without --json');
|
|
4848
|
+
return;
|
|
4849
|
+
}
|
|
4850
|
+
logger.logger.log(json);
|
|
4851
|
+
logger.logger.log('');
|
|
4852
|
+
return;
|
|
4702
4853
|
}
|
|
4854
|
+
if (outputKind === 'markdown') {
|
|
4855
|
+
logger.logger.log('# Quota');
|
|
4856
|
+
logger.logger.log('');
|
|
4857
|
+
logger.logger.log(`Quota left on the current API token: ${data.quota}`);
|
|
4858
|
+
logger.logger.log('');
|
|
4859
|
+
return;
|
|
4860
|
+
}
|
|
4861
|
+
logger.logger.log(`Quota left on the current API token: ${data.quota}`);
|
|
4862
|
+
logger.logger.log('');
|
|
4863
|
+
}
|
|
4864
|
+
|
|
4865
|
+
async function handleQuota(outputKind = 'text') {
|
|
4866
|
+
const data = await fetchQuota();
|
|
4867
|
+
if (!data) return;
|
|
4868
|
+
await outputQuota(data, outputKind);
|
|
4703
4869
|
}
|
|
4704
4870
|
|
|
4705
4871
|
const {
|
|
@@ -4753,7 +4919,7 @@ ${colors.bgRed(colors.white('Input error'))}: Please provide the required fields
|
|
|
4753
4919
|
logger.logger.log(DRY_RUN_BAIL_TEXT$i);
|
|
4754
4920
|
return;
|
|
4755
4921
|
}
|
|
4756
|
-
await
|
|
4922
|
+
await handleQuota(json ? 'json' : markdown ? 'markdown' : 'text');
|
|
4757
4923
|
}
|
|
4758
4924
|
|
|
4759
4925
|
const description$4 = 'Account details';
|
|
@@ -4782,68 +4948,15 @@ const cmdOrganization = {
|
|
|
4782
4948
|
}
|
|
4783
4949
|
};
|
|
4784
4950
|
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
// Not hardcoding the namespace since we don't know what the server accepts.
|
|
4788
|
-
// The ecosystem is considered as the first package if it is not an a-z string.
|
|
4789
|
-
function parsePackageSpecifiers(ecosystem, pkgs) {
|
|
4790
|
-
let valid = true;
|
|
4791
|
-
const purls = [];
|
|
4792
|
-
if (!ecosystem) {
|
|
4793
|
-
valid = false;
|
|
4794
|
-
} else if (/^[a-zA-Z]+$/.test(ecosystem)) {
|
|
4795
|
-
for (let i = 0; i < pkgs.length; ++i) {
|
|
4796
|
-
const pkg = pkgs[i] ?? '';
|
|
4797
|
-
if (!pkg) {
|
|
4798
|
-
valid = false;
|
|
4799
|
-
break;
|
|
4800
|
-
} else if (pkg.startsWith('pkg:')) {
|
|
4801
|
-
// keep
|
|
4802
|
-
purls.push(pkg);
|
|
4803
|
-
} else if (pkg.includes('/')) {
|
|
4804
|
-
// Looks like this arg was already namespaced
|
|
4805
|
-
purls.push('pkg:' + pkg);
|
|
4806
|
-
} else {
|
|
4807
|
-
purls.push('pkg:' + ecosystem + '/' + pkg);
|
|
4808
|
-
}
|
|
4809
|
-
}
|
|
4810
|
-
if (!purls.length) {
|
|
4811
|
-
valid = false;
|
|
4812
|
-
}
|
|
4813
|
-
} else {
|
|
4814
|
-
// Assume ecosystem is a purl, too
|
|
4815
|
-
pkgs.unshift(ecosystem);
|
|
4816
|
-
for (let i = 0; i < pkgs.length; ++i) {
|
|
4817
|
-
const pkg = pkgs[i] ?? '';
|
|
4818
|
-
if (!/^(?:pkg:)?[a-zA-Z]+\/./.test(pkg)) {
|
|
4819
|
-
// At least one purl did not start with `pkg:eco/x` or `eco/x`
|
|
4820
|
-
valid = false;
|
|
4821
|
-
break;
|
|
4822
|
-
} else if (pkg.startsWith('pkg:')) {
|
|
4823
|
-
purls.push(pkg);
|
|
4824
|
-
} else {
|
|
4825
|
-
purls.push('pkg:' + pkg);
|
|
4826
|
-
}
|
|
4827
|
-
}
|
|
4828
|
-
if (!purls.length) {
|
|
4829
|
-
valid = false;
|
|
4830
|
-
}
|
|
4831
|
-
}
|
|
4832
|
-
return {
|
|
4833
|
-
purls,
|
|
4834
|
-
valid
|
|
4835
|
-
};
|
|
4836
|
-
}
|
|
4837
|
-
|
|
4838
|
-
async function fetchPackageInfo(purls) {
|
|
4839
|
-
const socketSdk = await shadowNpmInject.setupSdk(shadowNpmInject.getPublicToken());
|
|
4951
|
+
async function fetchPurlsShallowScore(purls) {
|
|
4952
|
+
logger.logger.error(`Requesting shallow score data for ${purls.length} package urls (purl): ${purls.join(', ')}`);
|
|
4840
4953
|
|
|
4841
4954
|
// Lazily access constants.spinner.
|
|
4842
4955
|
const {
|
|
4843
4956
|
spinner
|
|
4844
4957
|
} = constants;
|
|
4845
|
-
logger.logger.error(`Requesting shallow score data for ${purls.length} package urls (purl): ${purls.join(', ')}`);
|
|
4846
4958
|
spinner.start(`Requesting data ...`);
|
|
4959
|
+
const socketSdk = await shadowNpmInject.setupSdk(shadowNpmInject.getPublicToken());
|
|
4847
4960
|
const result = await handleApiCall(socketSdk.batchPackageFetch({
|
|
4848
4961
|
alerts: 'true'
|
|
4849
4962
|
// compact: false,
|
|
@@ -4858,12 +4971,11 @@ async function fetchPackageInfo(purls) {
|
|
|
4858
4971
|
spinner.successAndStop('Request completed');
|
|
4859
4972
|
if (result.success) {
|
|
4860
4973
|
return result;
|
|
4861
|
-
} else {
|
|
4862
|
-
handleUnsuccessfulApiResponse('batchPackageFetch', result);
|
|
4863
4974
|
}
|
|
4975
|
+
handleUnsuccessfulApiResponse('batchPackageFetch', result);
|
|
4864
4976
|
}
|
|
4865
4977
|
|
|
4866
|
-
function
|
|
4978
|
+
function outputPurlsShallowScore(purls, packageData, outputKind) {
|
|
4867
4979
|
if (outputKind === 'json') {
|
|
4868
4980
|
// In JSON simply return what the server responds with. Don't bother trying
|
|
4869
4981
|
// to match the response with the requested packages/purls.
|
|
@@ -4943,14 +5055,67 @@ function getAlertString(alerts, noColor = false) {
|
|
|
4943
5055
|
}
|
|
4944
5056
|
}
|
|
4945
5057
|
|
|
4946
|
-
async function
|
|
5058
|
+
async function handlePurlsShallowScore({
|
|
4947
5059
|
outputKind,
|
|
4948
5060
|
purls
|
|
4949
5061
|
}) {
|
|
4950
|
-
const packageData = await
|
|
5062
|
+
const packageData = await fetchPurlsShallowScore(purls);
|
|
4951
5063
|
if (packageData) {
|
|
4952
|
-
|
|
5064
|
+
outputPurlsShallowScore(purls, packageData.data, outputKind);
|
|
5065
|
+
}
|
|
5066
|
+
}
|
|
5067
|
+
|
|
5068
|
+
// Either an ecosystem was given or all args must be (namespaced) purls
|
|
5069
|
+
// The `pkg:` part is optional here. We'll scan for `eco/name@version`.
|
|
5070
|
+
// Not hardcoding the namespace since we don't know what the server accepts.
|
|
5071
|
+
// The ecosystem is considered as the first package if it is not an a-z string.
|
|
5072
|
+
function parsePackageSpecifiers(ecosystem, pkgs) {
|
|
5073
|
+
let valid = true;
|
|
5074
|
+
const purls = [];
|
|
5075
|
+
if (!ecosystem) {
|
|
5076
|
+
valid = false;
|
|
5077
|
+
} else if (/^[a-zA-Z]+$/.test(ecosystem)) {
|
|
5078
|
+
for (let i = 0; i < pkgs.length; ++i) {
|
|
5079
|
+
const pkg = pkgs[i] ?? '';
|
|
5080
|
+
if (!pkg) {
|
|
5081
|
+
valid = false;
|
|
5082
|
+
break;
|
|
5083
|
+
} else if (pkg.startsWith('pkg:')) {
|
|
5084
|
+
// keep
|
|
5085
|
+
purls.push(pkg);
|
|
5086
|
+
} else if (pkg.includes('/')) {
|
|
5087
|
+
// Looks like this arg was already namespaced
|
|
5088
|
+
purls.push('pkg:' + pkg);
|
|
5089
|
+
} else {
|
|
5090
|
+
purls.push('pkg:' + ecosystem + '/' + pkg);
|
|
5091
|
+
}
|
|
5092
|
+
}
|
|
5093
|
+
if (!purls.length) {
|
|
5094
|
+
valid = false;
|
|
5095
|
+
}
|
|
5096
|
+
} else {
|
|
5097
|
+
// Assume ecosystem is a purl, too
|
|
5098
|
+
pkgs.unshift(ecosystem);
|
|
5099
|
+
for (let i = 0; i < pkgs.length; ++i) {
|
|
5100
|
+
const pkg = pkgs[i] ?? '';
|
|
5101
|
+
if (!/^(?:pkg:)?[a-zA-Z]+\/./.test(pkg)) {
|
|
5102
|
+
// At least one purl did not start with `pkg:eco/x` or `eco/x`
|
|
5103
|
+
valid = false;
|
|
5104
|
+
break;
|
|
5105
|
+
} else if (pkg.startsWith('pkg:')) {
|
|
5106
|
+
purls.push(pkg);
|
|
5107
|
+
} else {
|
|
5108
|
+
purls.push('pkg:' + pkg);
|
|
5109
|
+
}
|
|
5110
|
+
}
|
|
5111
|
+
if (!purls.length) {
|
|
5112
|
+
valid = false;
|
|
5113
|
+
}
|
|
4953
5114
|
}
|
|
5115
|
+
return {
|
|
5116
|
+
purls,
|
|
5117
|
+
valid
|
|
5118
|
+
};
|
|
4954
5119
|
}
|
|
4955
5120
|
|
|
4956
5121
|
const {
|
|
@@ -5042,7 +5207,7 @@ async function run$h(argv, importMeta, {
|
|
|
5042
5207
|
logger.logger.log(DRY_RUN_BAIL_TEXT$h);
|
|
5043
5208
|
return;
|
|
5044
5209
|
}
|
|
5045
|
-
await
|
|
5210
|
+
await handlePurlsShallowScore({
|
|
5046
5211
|
outputKind: json ? 'json' : markdown ? 'markdown' : 'text',
|
|
5047
5212
|
purls
|
|
5048
5213
|
});
|
|
@@ -5518,7 +5683,7 @@ const cmdReport = {
|
|
|
5518
5683
|
}
|
|
5519
5684
|
};
|
|
5520
5685
|
|
|
5521
|
-
async function
|
|
5686
|
+
async function fetchCreateRepo({
|
|
5522
5687
|
default_branch,
|
|
5523
5688
|
description,
|
|
5524
5689
|
homepage,
|
|
@@ -5530,8 +5695,7 @@ async function createRepo({
|
|
|
5530
5695
|
if (!apiToken) {
|
|
5531
5696
|
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.');
|
|
5532
5697
|
}
|
|
5533
|
-
await
|
|
5534
|
-
apiToken,
|
|
5698
|
+
return await fetchCreateRepoWithToken(apiToken, {
|
|
5535
5699
|
default_branch,
|
|
5536
5700
|
description,
|
|
5537
5701
|
homepage,
|
|
@@ -5540,8 +5704,7 @@ async function createRepo({
|
|
|
5540
5704
|
visibility
|
|
5541
5705
|
});
|
|
5542
5706
|
}
|
|
5543
|
-
async function
|
|
5544
|
-
apiToken,
|
|
5707
|
+
async function fetchCreateRepoWithToken(apiToken, {
|
|
5545
5708
|
default_branch,
|
|
5546
5709
|
description,
|
|
5547
5710
|
homepage,
|
|
@@ -5553,8 +5716,8 @@ async function createRepoWithToken({
|
|
|
5553
5716
|
const {
|
|
5554
5717
|
spinner
|
|
5555
5718
|
} = constants;
|
|
5556
|
-
spinner.start('Creating repository...');
|
|
5557
5719
|
const socketSdk = await shadowNpmInject.setupSdk(apiToken);
|
|
5720
|
+
spinner.start('Sending request ot create a repository...');
|
|
5558
5721
|
const result = await handleApiCall(socketSdk.createOrgRepo(orgSlug, {
|
|
5559
5722
|
name: repoName,
|
|
5560
5723
|
description,
|
|
@@ -5562,11 +5725,36 @@ async function createRepoWithToken({
|
|
|
5562
5725
|
default_branch,
|
|
5563
5726
|
visibility
|
|
5564
5727
|
}), 'creating repository');
|
|
5728
|
+
spinner.successAndStop('Received response requesting to create a repository.');
|
|
5565
5729
|
if (!result.success) {
|
|
5566
5730
|
handleUnsuccessfulApiResponse('createOrgRepo', result);
|
|
5567
5731
|
return;
|
|
5568
5732
|
}
|
|
5569
|
-
|
|
5733
|
+
return result.data;
|
|
5734
|
+
}
|
|
5735
|
+
|
|
5736
|
+
async function outputCreateRepo(_data) {
|
|
5737
|
+
logger.logger.success('Repository created successfully');
|
|
5738
|
+
}
|
|
5739
|
+
|
|
5740
|
+
async function handleCreateRepo({
|
|
5741
|
+
default_branch,
|
|
5742
|
+
description,
|
|
5743
|
+
homepage,
|
|
5744
|
+
orgSlug,
|
|
5745
|
+
repoName,
|
|
5746
|
+
visibility
|
|
5747
|
+
}) {
|
|
5748
|
+
const data = await fetchCreateRepo({
|
|
5749
|
+
default_branch,
|
|
5750
|
+
description,
|
|
5751
|
+
homepage,
|
|
5752
|
+
orgSlug,
|
|
5753
|
+
repoName,
|
|
5754
|
+
visibility
|
|
5755
|
+
});
|
|
5756
|
+
if (!data) return;
|
|
5757
|
+
await outputCreateRepo();
|
|
5570
5758
|
}
|
|
5571
5759
|
|
|
5572
5760
|
const {
|
|
@@ -5652,7 +5840,7 @@ async function run$c(argv, importMeta, {
|
|
|
5652
5840
|
logger.logger.log(DRY_RUN_BAIL_TEXT$c);
|
|
5653
5841
|
return;
|
|
5654
5842
|
}
|
|
5655
|
-
await
|
|
5843
|
+
await handleCreateRepo({
|
|
5656
5844
|
orgSlug,
|
|
5657
5845
|
repoName,
|
|
5658
5846
|
description: String(cli.flags['repoDescription'] || ''),
|
|
@@ -5662,7 +5850,7 @@ async function run$c(argv, importMeta, {
|
|
|
5662
5850
|
});
|
|
5663
5851
|
}
|
|
5664
5852
|
|
|
5665
|
-
async function
|
|
5853
|
+
async function handleDeleteRepo(orgSlug, repoName) {
|
|
5666
5854
|
const apiToken = shadowNpmInject.getDefaultToken();
|
|
5667
5855
|
if (!apiToken) {
|
|
5668
5856
|
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.');
|
|
@@ -5738,14 +5926,12 @@ async function run$b(argv, importMeta, {
|
|
|
5738
5926
|
logger.logger.log(DRY_RUN_BAIL_TEXT$b);
|
|
5739
5927
|
return;
|
|
5740
5928
|
}
|
|
5741
|
-
await
|
|
5929
|
+
await handleDeleteRepo(orgSlug, repoName);
|
|
5742
5930
|
}
|
|
5743
5931
|
|
|
5744
|
-
|
|
5745
|
-
async function listRepos({
|
|
5932
|
+
async function fetchListRepos({
|
|
5746
5933
|
direction,
|
|
5747
5934
|
orgSlug,
|
|
5748
|
-
outputKind,
|
|
5749
5935
|
page,
|
|
5750
5936
|
per_page,
|
|
5751
5937
|
sort
|
|
@@ -5754,21 +5940,17 @@ async function listRepos({
|
|
|
5754
5940
|
if (!apiToken) {
|
|
5755
5941
|
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.');
|
|
5756
5942
|
}
|
|
5757
|
-
await
|
|
5758
|
-
apiToken,
|
|
5943
|
+
return await fetchListReposWithToken(apiToken, {
|
|
5759
5944
|
direction,
|
|
5760
5945
|
orgSlug,
|
|
5761
|
-
outputKind,
|
|
5762
5946
|
page,
|
|
5763
5947
|
per_page,
|
|
5764
5948
|
sort
|
|
5765
5949
|
});
|
|
5766
5950
|
}
|
|
5767
|
-
async function
|
|
5768
|
-
apiToken,
|
|
5951
|
+
async function fetchListReposWithToken(apiToken, {
|
|
5769
5952
|
direction,
|
|
5770
5953
|
orgSlug,
|
|
5771
|
-
outputKind,
|
|
5772
5954
|
page,
|
|
5773
5955
|
per_page,
|
|
5774
5956
|
sort
|
|
@@ -5777,28 +5959,33 @@ async function listReposWithToken({
|
|
|
5777
5959
|
const {
|
|
5778
5960
|
spinner
|
|
5779
5961
|
} = constants;
|
|
5780
|
-
spinner.start('Fetching list of repositories...');
|
|
5781
5962
|
const socketSdk = await shadowNpmInject.setupSdk(apiToken);
|
|
5963
|
+
spinner.start('Fetching list of repositories...');
|
|
5782
5964
|
const result = await handleApiCall(socketSdk.getOrgRepoList(orgSlug, {
|
|
5783
5965
|
sort,
|
|
5784
5966
|
direction,
|
|
5785
5967
|
per_page: String(per_page),
|
|
5786
5968
|
page: String(page)
|
|
5787
5969
|
}), 'listing repositories');
|
|
5970
|
+
spinner.successAndStop('Received response for repository list.');
|
|
5788
5971
|
if (!result.success) {
|
|
5789
5972
|
handleUnsuccessfulApiResponse('getOrgRepoList', result);
|
|
5790
5973
|
return;
|
|
5791
5974
|
}
|
|
5792
|
-
|
|
5975
|
+
return result.data;
|
|
5976
|
+
}
|
|
5977
|
+
|
|
5978
|
+
// @ts-ignore
|
|
5979
|
+
async function outputListRepos(data, outputKind) {
|
|
5793
5980
|
if (outputKind === 'json') {
|
|
5794
|
-
const
|
|
5981
|
+
const json = data.results.map(o => ({
|
|
5795
5982
|
id: o.id,
|
|
5796
5983
|
name: o.name,
|
|
5797
5984
|
visibility: o.visibility,
|
|
5798
5985
|
defaultBranch: o.default_branch,
|
|
5799
5986
|
archived: o.archived
|
|
5800
5987
|
}));
|
|
5801
|
-
logger.logger.log(JSON.stringify(
|
|
5988
|
+
logger.logger.log(JSON.stringify(json, null, 2));
|
|
5802
5989
|
return;
|
|
5803
5990
|
}
|
|
5804
5991
|
const options = {
|
|
@@ -5819,7 +6006,26 @@ async function listReposWithToken({
|
|
|
5819
6006
|
name: colors.magenta('Archived')
|
|
5820
6007
|
}]
|
|
5821
6008
|
};
|
|
5822
|
-
logger.logger.log(chalkTable(options,
|
|
6009
|
+
logger.logger.log(chalkTable(options, data.results));
|
|
6010
|
+
}
|
|
6011
|
+
|
|
6012
|
+
async function handleListRepos({
|
|
6013
|
+
direction,
|
|
6014
|
+
orgSlug,
|
|
6015
|
+
outputKind,
|
|
6016
|
+
page,
|
|
6017
|
+
per_page,
|
|
6018
|
+
sort
|
|
6019
|
+
}) {
|
|
6020
|
+
const data = await fetchListRepos({
|
|
6021
|
+
direction,
|
|
6022
|
+
orgSlug,
|
|
6023
|
+
page,
|
|
6024
|
+
per_page,
|
|
6025
|
+
sort
|
|
6026
|
+
});
|
|
6027
|
+
if (!data) return;
|
|
6028
|
+
await outputListRepos(data, outputKind);
|
|
5823
6029
|
}
|
|
5824
6030
|
|
|
5825
6031
|
const {
|
|
@@ -5898,7 +6104,7 @@ async function run$a(argv, importMeta, {
|
|
|
5898
6104
|
logger.logger.log(DRY_RUN_BAIL_TEXT$a);
|
|
5899
6105
|
return;
|
|
5900
6106
|
}
|
|
5901
|
-
await
|
|
6107
|
+
await handleListRepos({
|
|
5902
6108
|
direction: cli.flags['direction'] === 'asc' ? 'asc' : 'desc',
|
|
5903
6109
|
orgSlug,
|
|
5904
6110
|
outputKind: cli.flags['json'] ? 'json' : cli.flags['markdown'] ? 'markdown' : 'print',
|
|
@@ -5908,7 +6114,7 @@ async function run$a(argv, importMeta, {
|
|
|
5908
6114
|
});
|
|
5909
6115
|
}
|
|
5910
6116
|
|
|
5911
|
-
async function
|
|
6117
|
+
async function fetchUpdateRepo({
|
|
5912
6118
|
default_branch,
|
|
5913
6119
|
description,
|
|
5914
6120
|
homepage,
|
|
@@ -5920,8 +6126,7 @@ async function updateRepo({
|
|
|
5920
6126
|
if (!apiToken) {
|
|
5921
6127
|
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.');
|
|
5922
6128
|
}
|
|
5923
|
-
await
|
|
5924
|
-
apiToken,
|
|
6129
|
+
return await fetchUpdateRepoWithToken(apiToken, {
|
|
5925
6130
|
default_branch,
|
|
5926
6131
|
description,
|
|
5927
6132
|
homepage,
|
|
@@ -5930,8 +6135,7 @@ async function updateRepo({
|
|
|
5930
6135
|
visibility
|
|
5931
6136
|
});
|
|
5932
6137
|
}
|
|
5933
|
-
async function
|
|
5934
|
-
apiToken,
|
|
6138
|
+
async function fetchUpdateRepoWithToken(apiToken, {
|
|
5935
6139
|
default_branch,
|
|
5936
6140
|
description,
|
|
5937
6141
|
homepage,
|
|
@@ -5943,7 +6147,7 @@ async function updateRepoWithToken({
|
|
|
5943
6147
|
const {
|
|
5944
6148
|
spinner
|
|
5945
6149
|
} = constants;
|
|
5946
|
-
spinner.start('
|
|
6150
|
+
spinner.start('Sending request to update a repository...');
|
|
5947
6151
|
const socketSdk = await shadowNpmInject.setupSdk(apiToken);
|
|
5948
6152
|
const result = await handleApiCall(socketSdk.updateOrgRepo(orgSlug, repoName, {
|
|
5949
6153
|
orgSlug,
|
|
@@ -5953,11 +6157,36 @@ async function updateRepoWithToken({
|
|
|
5953
6157
|
default_branch,
|
|
5954
6158
|
visibility
|
|
5955
6159
|
}), 'updating repository');
|
|
6160
|
+
spinner.successAndStop('Received response trying to update a repository');
|
|
5956
6161
|
if (!result.success) {
|
|
5957
6162
|
handleUnsuccessfulApiResponse('updateOrgRepo', result);
|
|
5958
6163
|
return;
|
|
5959
6164
|
}
|
|
5960
|
-
|
|
6165
|
+
return result.data;
|
|
6166
|
+
}
|
|
6167
|
+
|
|
6168
|
+
async function outputUpdateRepo(_data) {
|
|
6169
|
+
logger.logger.success('Repository updated successfully');
|
|
6170
|
+
}
|
|
6171
|
+
|
|
6172
|
+
async function handleUpdateRepo({
|
|
6173
|
+
default_branch,
|
|
6174
|
+
description,
|
|
6175
|
+
homepage,
|
|
6176
|
+
orgSlug,
|
|
6177
|
+
repoName,
|
|
6178
|
+
visibility
|
|
6179
|
+
}) {
|
|
6180
|
+
const data = await fetchUpdateRepo({
|
|
6181
|
+
default_branch,
|
|
6182
|
+
description,
|
|
6183
|
+
homepage,
|
|
6184
|
+
orgSlug,
|
|
6185
|
+
repoName,
|
|
6186
|
+
visibility
|
|
6187
|
+
});
|
|
6188
|
+
if (!data) return;
|
|
6189
|
+
await outputUpdateRepo();
|
|
5961
6190
|
}
|
|
5962
6191
|
|
|
5963
6192
|
const {
|
|
@@ -6045,7 +6274,7 @@ async function run$9(argv, importMeta, {
|
|
|
6045
6274
|
logger.logger.log(DRY_RUN_BAIL_TEXT$9);
|
|
6046
6275
|
return;
|
|
6047
6276
|
}
|
|
6048
|
-
await
|
|
6277
|
+
await handleUpdateRepo({
|
|
6049
6278
|
orgSlug,
|
|
6050
6279
|
repoName,
|
|
6051
6280
|
description: String(cli.flags['repoDescription'] || ''),
|
|
@@ -6055,27 +6284,31 @@ async function run$9(argv, importMeta, {
|
|
|
6055
6284
|
});
|
|
6056
6285
|
}
|
|
6057
6286
|
|
|
6058
|
-
|
|
6059
|
-
async function viewRepo(orgSlug, repoName, outputKind) {
|
|
6287
|
+
async function fetchViewRepo(orgSlug, repoName) {
|
|
6060
6288
|
const apiToken = shadowNpmInject.getDefaultToken();
|
|
6061
6289
|
if (!apiToken) {
|
|
6062
6290
|
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.');
|
|
6063
6291
|
}
|
|
6064
|
-
await
|
|
6292
|
+
return await fetchViewRepoWithToken(orgSlug, repoName, apiToken);
|
|
6065
6293
|
}
|
|
6066
|
-
async function
|
|
6294
|
+
async function fetchViewRepoWithToken(orgSlug, repoName, apiToken) {
|
|
6067
6295
|
// Lazily access constants.spinner.
|
|
6068
6296
|
const {
|
|
6069
6297
|
spinner
|
|
6070
6298
|
} = constants;
|
|
6071
|
-
spinner.start('Fetching repository data...');
|
|
6072
6299
|
const socketSdk = await shadowNpmInject.setupSdk(apiToken);
|
|
6300
|
+
spinner.start('Fetching repository data...');
|
|
6073
6301
|
const result = await handleApiCall(socketSdk.getOrgRepo(orgSlug, repoName), 'fetching repository');
|
|
6302
|
+
spinner.successAndStop('Received response while fetched repository data.');
|
|
6074
6303
|
if (!result.success) {
|
|
6075
6304
|
handleUnsuccessfulApiResponse('getOrgRepo', result);
|
|
6076
6305
|
return;
|
|
6077
6306
|
}
|
|
6078
|
-
|
|
6307
|
+
return result.data;
|
|
6308
|
+
}
|
|
6309
|
+
|
|
6310
|
+
// @ts-ignore
|
|
6311
|
+
async function outputViewRepo(data, outputKind) {
|
|
6079
6312
|
if (outputKind === 'json') {
|
|
6080
6313
|
const {
|
|
6081
6314
|
archived,
|
|
@@ -6085,7 +6318,7 @@ async function viewRepoWithToken(orgSlug, repoName, apiToken, outputKind) {
|
|
|
6085
6318
|
id,
|
|
6086
6319
|
name,
|
|
6087
6320
|
visibility
|
|
6088
|
-
} =
|
|
6321
|
+
} = data;
|
|
6089
6322
|
logger.logger.log(JSON.stringify({
|
|
6090
6323
|
id,
|
|
6091
6324
|
name,
|
|
@@ -6121,7 +6354,13 @@ async function viewRepoWithToken(orgSlug, repoName, apiToken, outputKind) {
|
|
|
6121
6354
|
name: colors.magenta('Created at')
|
|
6122
6355
|
}]
|
|
6123
6356
|
};
|
|
6124
|
-
logger.logger.log(chalkTable(options, [
|
|
6357
|
+
logger.logger.log(chalkTable(options, [data]));
|
|
6358
|
+
}
|
|
6359
|
+
|
|
6360
|
+
async function handleViewRepo(orgSlug, repoName, outputKind) {
|
|
6361
|
+
const data = await fetchViewRepo(orgSlug, repoName);
|
|
6362
|
+
if (!data) return;
|
|
6363
|
+
await outputViewRepo(data, outputKind);
|
|
6125
6364
|
}
|
|
6126
6365
|
|
|
6127
6366
|
const {
|
|
@@ -6165,7 +6404,11 @@ async function run$8(argv, importMeta, {
|
|
|
6165
6404
|
importMeta,
|
|
6166
6405
|
parentName
|
|
6167
6406
|
});
|
|
6168
|
-
const
|
|
6407
|
+
const {
|
|
6408
|
+
json,
|
|
6409
|
+
markdown,
|
|
6410
|
+
repoName
|
|
6411
|
+
} = cli.flags;
|
|
6169
6412
|
const [orgSlug = ''] = cli.input;
|
|
6170
6413
|
if (!repoName || typeof repoName !== 'string' || !orgSlug) {
|
|
6171
6414
|
// Use exit status of 2 to indicate incorrect usage, generally invalid
|
|
@@ -6185,7 +6428,7 @@ async function run$8(argv, importMeta, {
|
|
|
6185
6428
|
logger.logger.log(DRY_RUN_BAIL_TEXT$8);
|
|
6186
6429
|
return;
|
|
6187
6430
|
}
|
|
6188
|
-
await
|
|
6431
|
+
await handleViewRepo(orgSlug, repoName, json ? 'json' : markdown ? 'markdown' : 'text');
|
|
6189
6432
|
}
|
|
6190
6433
|
|
|
6191
6434
|
const description$1 = 'Repositories related commands';
|
|
@@ -8216,7 +8459,7 @@ void (async () => {
|
|
|
8216
8459
|
await updateNotifier({
|
|
8217
8460
|
name: SOCKET_CLI_BIN_NAME,
|
|
8218
8461
|
// The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
|
|
8219
|
-
version: "0.14.
|
|
8462
|
+
version: "0.14.65",
|
|
8220
8463
|
ttl: 86_400_000 /* 24 hours in milliseconds */
|
|
8221
8464
|
});
|
|
8222
8465
|
try {
|
|
@@ -8283,5 +8526,5 @@ void (async () => {
|
|
|
8283
8526
|
await shadowNpmInject.captureException(e);
|
|
8284
8527
|
}
|
|
8285
8528
|
})();
|
|
8286
|
-
//# debugId=
|
|
8529
|
+
//# debugId=2143dc19-6ce1-465e-b671-dab7a2d67822
|
|
8287
8530
|
//# sourceMappingURL=cli.js.map
|