@socketsecurity/cli-with-sentry 0.14.152 → 0.14.154
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/.config/tsconfig.dts.tsbuildinfo +1 -1
- package/dist/cli.js +151 -72
- package/dist/cli.js.map +1 -1
- package/dist/constants.js +3 -3
- package/dist/constants.js.map +1 -1
- package/dist/shadow-npm-inject.js +1 -2
- package/dist/shadow-npm-inject.js.map +1 -1
- package/dist/types/commands/fix/npm-fix.d.mts.map +1 -1
- package/dist/types/commands/fix/pnpm-fix.d.mts.map +1 -1
- package/dist/types/commands/organization/output-license-policy.d.mts.map +1 -1
- package/dist/types/commands/package/fetch-purls-shallow-score.d.mts.map +1 -1
- package/dist/types/commands/repos/cmd-repos-create.d.mts.map +1 -1
- package/dist/types/commands/repos/cmd-repos-del.d.mts.map +1 -1
- package/dist/types/commands/repos/cmd-repos-update.d.mts.map +1 -1
- package/dist/types/commands/repos/output-create-repo.d.mts +1 -0
- package/dist/types/commands/repos/output-create-repo.d.mts.map +1 -1
- package/dist/types/commands/repos/output-delete-repo.d.mts +1 -0
- package/dist/types/commands/repos/output-delete-repo.d.mts.map +1 -1
- package/dist/types/commands/repos/output-update-repo.d.mts +1 -0
- package/dist/types/commands/repos/output-update-repo.d.mts.map +1 -1
- package/dist/types/commands/scan/generate-report.d.mts +7 -1
- package/dist/types/commands/scan/generate-report.d.mts.map +1 -1
- package/dist/types/commands/scan/output-scan-report.d.mts.map +1 -1
- package/dist/types/utils/socket-package-alert.d.mts.map +1 -1
- package/dist/vendor.js +74 -19
- package/dist/vendor.js.map +1 -1
- package/external/@socketsecurity/registry/lib/packages.d.ts +6 -2
- package/external/@socketsecurity/registry/lib/packages.js +192 -139
- package/external/@socketsecurity/registry/package.json +1 -1
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -2045,8 +2045,8 @@ async function fetchSupportedScanFileNames() {
|
|
|
2045
2045
|
'fetching supported scan file types'
|
|
2046
2046
|
)
|
|
2047
2047
|
spinner.stop()
|
|
2048
|
-
logger.logger.
|
|
2049
|
-
'Received response while
|
|
2048
|
+
logger.logger.error(
|
|
2049
|
+
'Received response while fetching supported scan file types.'
|
|
2050
2050
|
)
|
|
2051
2051
|
if (!result.success) {
|
|
2052
2052
|
return handleFailedApiResponse('getReportSupportedFiles', result)
|
|
@@ -2089,7 +2089,7 @@ async function fetchReportData(orgSlug, scanId, includeLicensePolicy) {
|
|
|
2089
2089
|
function updateProgress() {
|
|
2090
2090
|
if (finishedFetching) {
|
|
2091
2091
|
spinner.stop()
|
|
2092
|
-
logger.logger.
|
|
2092
|
+
logger.logger.error(
|
|
2093
2093
|
`Scan result: ${scanStatus}. Security policy: ${policyStatus}.`
|
|
2094
2094
|
)
|
|
2095
2095
|
} else {
|
|
@@ -2110,7 +2110,7 @@ async function fetchReportData(orgSlug, scanId, includeLicensePolicy) {
|
|
|
2110
2110
|
return {
|
|
2111
2111
|
ok: false,
|
|
2112
2112
|
message: 'Socket API returned an error',
|
|
2113
|
-
cause: `${response.statusText}${err ? ` (cause: ${err}` : ''}`
|
|
2113
|
+
cause: `${response.statusText}${err ? ` (cause: ${err})` : ''}`
|
|
2114
2114
|
}
|
|
2115
2115
|
}
|
|
2116
2116
|
updateScan(`ok, downloading response..`)
|
|
@@ -2196,6 +2196,8 @@ async function fetchReportData(orgSlug, scanId, includeLicensePolicy) {
|
|
|
2196
2196
|
}
|
|
2197
2197
|
}
|
|
2198
2198
|
|
|
2199
|
+
// Note: The returned cresult will only be ok:false when the generation
|
|
2200
|
+
// failed. It won't reflect the healthy state.
|
|
2199
2201
|
function generateReport(
|
|
2200
2202
|
scan,
|
|
2201
2203
|
securityPolicy,
|
|
@@ -2334,21 +2336,36 @@ function generateReport(
|
|
|
2334
2336
|
})
|
|
2335
2337
|
}
|
|
2336
2338
|
spinner?.successAndStop(`Generated reported in ${Date.now() - now} ms`)
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
+
if (short) {
|
|
2340
|
+
return {
|
|
2341
|
+
ok: true,
|
|
2342
|
+
data: {
|
|
2339
2343
|
healthy
|
|
2340
2344
|
}
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2347
|
+
const report = {
|
|
2348
|
+
healthy,
|
|
2349
|
+
orgSlug,
|
|
2350
|
+
scanId,
|
|
2351
|
+
options: {
|
|
2352
|
+
fold,
|
|
2353
|
+
reportLevel
|
|
2354
|
+
},
|
|
2355
|
+
alerts: violations
|
|
2356
|
+
}
|
|
2357
|
+
if (!healthy) {
|
|
2358
|
+
return {
|
|
2359
|
+
ok: true,
|
|
2360
|
+
message:
|
|
2361
|
+
'The report contains at least one alert that violates the policies set by your organization',
|
|
2362
|
+
data: report
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
return {
|
|
2366
|
+
ok: true,
|
|
2367
|
+
data: report
|
|
2368
|
+
}
|
|
2352
2369
|
}
|
|
2353
2370
|
function createLeaf(art, alert, policyAction) {
|
|
2354
2371
|
const leaf = {
|
|
@@ -2512,16 +2529,32 @@ async function outputScanReport(
|
|
|
2512
2529
|
spinner: constants.spinner
|
|
2513
2530
|
}
|
|
2514
2531
|
)
|
|
2515
|
-
if (!scanReport.
|
|
2516
|
-
|
|
2532
|
+
if (!scanReport.ok) {
|
|
2533
|
+
// Note: this means generation failed, it does not reflect the healthy state
|
|
2534
|
+
process.exitCode = scanReport.code ?? 1
|
|
2535
|
+
|
|
2536
|
+
// If report generation somehow failed then .data should not be set.
|
|
2537
|
+
if (outputKind === 'json') {
|
|
2538
|
+
logger.logger.log(serializeResultJson(scanReport))
|
|
2539
|
+
return
|
|
2540
|
+
}
|
|
2541
|
+
logger.logger.fail(failMsgWithBadge(scanReport.message, scanReport.cause))
|
|
2542
|
+
return
|
|
2517
2543
|
}
|
|
2544
|
+
|
|
2545
|
+
// I don't think we emit the default error message with banner for an unhealhty report, do we?
|
|
2546
|
+
// if (!scanReport.data.healhty) {
|
|
2547
|
+
// logger.fail(failMsgWithBadge(scanReport.message, scanReport.cause))
|
|
2548
|
+
// return
|
|
2549
|
+
// }
|
|
2550
|
+
|
|
2518
2551
|
if (
|
|
2519
2552
|
outputKind === 'json' ||
|
|
2520
2553
|
(outputKind === 'text' && filePath && filePath.endsWith('.json'))
|
|
2521
2554
|
) {
|
|
2522
2555
|
const json = short
|
|
2523
|
-
?
|
|
2524
|
-
: toJsonReport(scanReport, includeLicensePolicy)
|
|
2556
|
+
? serializeResultJson(scanReport)
|
|
2557
|
+
: toJsonReport(scanReport.data, includeLicensePolicy)
|
|
2525
2558
|
if (filePath && filePath !== '-') {
|
|
2526
2559
|
logger.logger.log('Writing json report to', filePath)
|
|
2527
2560
|
return await fs.writeFile(filePath, json)
|
|
@@ -2531,8 +2564,12 @@ async function outputScanReport(
|
|
|
2531
2564
|
}
|
|
2532
2565
|
if (outputKind === 'markdown' || (filePath && filePath.endsWith('.md'))) {
|
|
2533
2566
|
const md = short
|
|
2534
|
-
? `healthy = ${scanReport.healthy}`
|
|
2535
|
-
: toMarkdownReport(
|
|
2567
|
+
? `healthy = ${scanReport.data.healthy}`
|
|
2568
|
+
: toMarkdownReport(
|
|
2569
|
+
scanReport.data,
|
|
2570
|
+
// not short so must be regular report
|
|
2571
|
+
includeLicensePolicy
|
|
2572
|
+
)
|
|
2536
2573
|
if (filePath && filePath !== '-') {
|
|
2537
2574
|
logger.logger.log('Writing markdown report to', filePath)
|
|
2538
2575
|
return await fs.writeFile(filePath, md)
|
|
@@ -2542,25 +2579,24 @@ async function outputScanReport(
|
|
|
2542
2579
|
return
|
|
2543
2580
|
}
|
|
2544
2581
|
if (short) {
|
|
2545
|
-
logger.logger.log(scanReport.healthy ? 'OK' : 'ERR')
|
|
2582
|
+
logger.logger.log(scanReport.data.healthy ? 'OK' : 'ERR')
|
|
2546
2583
|
} else {
|
|
2547
|
-
logger.logger.dir(scanReport, {
|
|
2584
|
+
logger.logger.dir(scanReport.data, {
|
|
2548
2585
|
depth: null
|
|
2549
2586
|
})
|
|
2550
2587
|
}
|
|
2551
2588
|
}
|
|
2552
2589
|
function toJsonReport(report, includeLicensePolicy) {
|
|
2553
2590
|
const obj = mapToObject(report.alerts)
|
|
2554
|
-
const
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
)
|
|
2563
|
-
return json
|
|
2591
|
+
const newReport = {
|
|
2592
|
+
includeLicensePolicy,
|
|
2593
|
+
...report,
|
|
2594
|
+
alerts: obj
|
|
2595
|
+
}
|
|
2596
|
+
return serializeResultJson({
|
|
2597
|
+
ok: true,
|
|
2598
|
+
data: newReport
|
|
2599
|
+
})
|
|
2564
2600
|
}
|
|
2565
2601
|
function toMarkdownReport(report, includeLicensePolicy) {
|
|
2566
2602
|
const flatData = Array.from(walkNestedMap(report.alerts)).map(
|
|
@@ -4501,6 +4537,7 @@ async function npmFix(
|
|
|
4501
4537
|
|
|
4502
4538
|
// Lazily access constants.ENV.CI.
|
|
4503
4539
|
const isCi = constants.ENV.CI
|
|
4540
|
+
const baseBranch = isCi ? getBaseGitBranch() : ''
|
|
4504
4541
|
const workspacePkgJsonPaths = await shadowNpmInject.globWorkspace(
|
|
4505
4542
|
pkgEnvDetails.agent,
|
|
4506
4543
|
rootPath
|
|
@@ -4602,13 +4639,19 @@ async function npmFix(
|
|
|
4602
4639
|
}
|
|
4603
4640
|
const revertData = {
|
|
4604
4641
|
...(editablePkgJson.content.dependencies && {
|
|
4605
|
-
dependencies:
|
|
4642
|
+
dependencies: {
|
|
4643
|
+
...editablePkgJson.content.dependencies
|
|
4644
|
+
}
|
|
4606
4645
|
}),
|
|
4607
4646
|
...(editablePkgJson.content.optionalDependencies && {
|
|
4608
|
-
optionalDependencies:
|
|
4647
|
+
optionalDependencies: {
|
|
4648
|
+
...editablePkgJson.content.optionalDependencies
|
|
4649
|
+
}
|
|
4609
4650
|
}),
|
|
4610
4651
|
...(editablePkgJson.content.peerDependencies && {
|
|
4611
|
-
peerDependencies:
|
|
4652
|
+
peerDependencies: {
|
|
4653
|
+
...editablePkgJson.content.peerDependencies
|
|
4654
|
+
}
|
|
4612
4655
|
})
|
|
4613
4656
|
}
|
|
4614
4657
|
shadowNpmInject.updateNode(node, newVersion, newVersionPackument)
|
|
@@ -4620,10 +4663,21 @@ async function npmFix(
|
|
|
4620
4663
|
rangeStyle
|
|
4621
4664
|
)
|
|
4622
4665
|
// eslint-disable-next-line no-await-in-loop
|
|
4623
|
-
if (
|
|
4666
|
+
if (
|
|
4667
|
+
!(await editablePkgJson.save({
|
|
4668
|
+
ignoreWhitespace: true
|
|
4669
|
+
}))
|
|
4670
|
+
) {
|
|
4624
4671
|
debug.debugLog(
|
|
4625
4672
|
`Nothing changed for ${workspaceName}, skipping install`
|
|
4626
4673
|
)
|
|
4674
|
+
// Reset things just in case.
|
|
4675
|
+
if (isCi) {
|
|
4676
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4677
|
+
await gitHardReset(baseBranch, cwd)
|
|
4678
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4679
|
+
await gitCleanFdx(cwd)
|
|
4680
|
+
}
|
|
4627
4681
|
continue
|
|
4628
4682
|
}
|
|
4629
4683
|
spinner?.info(`Installing ${newId} in ${workspaceName}`)
|
|
@@ -4649,7 +4703,6 @@ async function npmFix(
|
|
|
4649
4703
|
errored = true
|
|
4650
4704
|
error = e
|
|
4651
4705
|
}
|
|
4652
|
-
const baseBranch = isCi ? getBaseGitBranch() : ''
|
|
4653
4706
|
if (!errored && isCi) {
|
|
4654
4707
|
const branch = getSocketBranchName(
|
|
4655
4708
|
oldPurl,
|
|
@@ -4712,7 +4765,9 @@ async function npmFix(
|
|
|
4712
4765
|
// eslint-disable-next-line no-await-in-loop
|
|
4713
4766
|
await Promise.all([
|
|
4714
4767
|
shadowNpmInject.removeNodeModules(cwd),
|
|
4715
|
-
editablePkgJson.save(
|
|
4768
|
+
editablePkgJson.save({
|
|
4769
|
+
ignoreWhitespace: true
|
|
4770
|
+
})
|
|
4716
4771
|
])
|
|
4717
4772
|
// eslint-disable-next-line no-await-in-loop
|
|
4718
4773
|
await install$1(arb.idealTree, {
|
|
@@ -4938,7 +4993,6 @@ async function pnpmFix(
|
|
|
4938
4993
|
const infoByPkg = shadowNpmInject.getCveInfoByAlertsMap(alertsMap, {
|
|
4939
4994
|
limit
|
|
4940
4995
|
})
|
|
4941
|
-
console.log(infoByPkg)
|
|
4942
4996
|
if (!infoByPkg) {
|
|
4943
4997
|
spinner?.stop()
|
|
4944
4998
|
logger.logger.info('No fixable vulnerabilities found.')
|
|
@@ -4947,6 +5001,7 @@ async function pnpmFix(
|
|
|
4947
5001
|
|
|
4948
5002
|
// Lazily access constants.ENV.CI.
|
|
4949
5003
|
const isCi = constants.ENV.CI
|
|
5004
|
+
const baseBranch = isCi ? getBaseGitBranch() : ''
|
|
4950
5005
|
const workspacePkgJsonPaths = await shadowNpmInject.globWorkspace(
|
|
4951
5006
|
pkgEnvDetails.agent,
|
|
4952
5007
|
rootPath
|
|
@@ -5077,13 +5132,19 @@ async function pnpmFix(
|
|
|
5077
5132
|
}
|
|
5078
5133
|
: {}),
|
|
5079
5134
|
...(editablePkgJson.content.dependencies && {
|
|
5080
|
-
dependencies:
|
|
5135
|
+
dependencies: {
|
|
5136
|
+
...editablePkgJson.content.dependencies
|
|
5137
|
+
}
|
|
5081
5138
|
}),
|
|
5082
5139
|
...(editablePkgJson.content.optionalDependencies && {
|
|
5083
|
-
optionalDependencies:
|
|
5140
|
+
optionalDependencies: {
|
|
5141
|
+
...editablePkgJson.content.optionalDependencies
|
|
5142
|
+
}
|
|
5084
5143
|
}),
|
|
5085
5144
|
...(editablePkgJson.content.peerDependencies && {
|
|
5086
|
-
peerDependencies:
|
|
5145
|
+
peerDependencies: {
|
|
5146
|
+
...editablePkgJson.content.peerDependencies
|
|
5147
|
+
}
|
|
5087
5148
|
})
|
|
5088
5149
|
}
|
|
5089
5150
|
if (updateData) {
|
|
@@ -5097,10 +5158,21 @@ async function pnpmFix(
|
|
|
5097
5158
|
rangeStyle
|
|
5098
5159
|
)
|
|
5099
5160
|
// eslint-disable-next-line no-await-in-loop
|
|
5100
|
-
if (
|
|
5161
|
+
if (
|
|
5162
|
+
!(await editablePkgJson.save({
|
|
5163
|
+
ignoreWhitespace: true
|
|
5164
|
+
}))
|
|
5165
|
+
) {
|
|
5101
5166
|
debug.debugLog(
|
|
5102
5167
|
`Nothing changed for ${workspaceName}, skipping install`
|
|
5103
5168
|
)
|
|
5169
|
+
// Reset things just in case.
|
|
5170
|
+
if (isCi) {
|
|
5171
|
+
// eslint-disable-next-line no-await-in-loop
|
|
5172
|
+
await gitHardReset(baseBranch, cwd)
|
|
5173
|
+
// eslint-disable-next-line no-await-in-loop
|
|
5174
|
+
await gitCleanFdx(cwd)
|
|
5175
|
+
}
|
|
5104
5176
|
continue
|
|
5105
5177
|
}
|
|
5106
5178
|
spinner?.info(`Installing ${newId} in ${workspaceName}`)
|
|
@@ -5127,7 +5199,6 @@ async function pnpmFix(
|
|
|
5127
5199
|
error = e
|
|
5128
5200
|
errored = true
|
|
5129
5201
|
}
|
|
5130
|
-
const baseBranch = isCi ? getBaseGitBranch() : ''
|
|
5131
5202
|
if (!errored && isCi) {
|
|
5132
5203
|
const branch = getSocketBranchName(
|
|
5133
5204
|
oldPurl,
|
|
@@ -5191,7 +5262,9 @@ async function pnpmFix(
|
|
|
5191
5262
|
// eslint-disable-next-line no-await-in-loop
|
|
5192
5263
|
await Promise.all([
|
|
5193
5264
|
shadowNpmInject.removeNodeModules(cwd),
|
|
5194
|
-
editablePkgJson.save(
|
|
5265
|
+
editablePkgJson.save({
|
|
5266
|
+
ignoreWhitespace: true
|
|
5267
|
+
})
|
|
5195
5268
|
])
|
|
5196
5269
|
// eslint-disable-next-line no-await-in-loop
|
|
5197
5270
|
actualTree = await install(pkgEnvDetails, {
|
|
@@ -8569,11 +8642,11 @@ async function outputLicensePolicy(result, outputKind) {
|
|
|
8569
8642
|
logger.logger.log('')
|
|
8570
8643
|
logger.logger.log('This is the license policy for your organization:')
|
|
8571
8644
|
logger.logger.log('')
|
|
8572
|
-
const rules = result.data
|
|
8645
|
+
const rules = result.data['license_policy']
|
|
8573
8646
|
const entries = rules ? Object.entries(rules) : []
|
|
8574
8647
|
const mapped = entries.map(([key, value]) => [
|
|
8575
8648
|
key,
|
|
8576
|
-
value
|
|
8649
|
+
value?.['allowed'] ? ' yes' : ' no'
|
|
8577
8650
|
])
|
|
8578
8651
|
mapped.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
|
|
8579
8652
|
logger.logger.log(mdTableOfPairs(mapped, ['License Name', 'Allowed']))
|
|
@@ -9001,7 +9074,7 @@ const cmdOrganization = {
|
|
|
9001
9074
|
}
|
|
9002
9075
|
|
|
9003
9076
|
async function fetchPurlDeepScore(purl) {
|
|
9004
|
-
logger.logger.
|
|
9077
|
+
logger.logger.error(`Requesting deep score data for this purl: ${purl}`)
|
|
9005
9078
|
const apiToken = shadowNpmInject.getDefaultToken()
|
|
9006
9079
|
if (!apiToken) {
|
|
9007
9080
|
return {
|
|
@@ -9037,7 +9110,7 @@ async function fetchPurlDeepScore(purl) {
|
|
|
9037
9110
|
return {
|
|
9038
9111
|
ok: false,
|
|
9039
9112
|
message: 'Socket API returned an error',
|
|
9040
|
-
cause: `${result.statusText}${err ? ` (cause: ${err}` : ''}`
|
|
9113
|
+
cause: `${result.statusText}${err ? ` (cause: ${err})` : ''}`
|
|
9041
9114
|
}
|
|
9042
9115
|
}
|
|
9043
9116
|
const data = await handleApiCall(await result.text(), 'Reading text')
|
|
@@ -9408,7 +9481,7 @@ async function run$j(argv, importMeta, { parentName }) {
|
|
|
9408
9481
|
}
|
|
9409
9482
|
|
|
9410
9483
|
async function fetchPurlsShallowScore(purls) {
|
|
9411
|
-
logger.logger.
|
|
9484
|
+
logger.logger.error(
|
|
9412
9485
|
`Requesting shallow score data for ${purls.length} package urls (purl): ${purls.join(', ')}`
|
|
9413
9486
|
)
|
|
9414
9487
|
const sockSdk = await shadowNpmInject.setupSdk(
|
|
@@ -9435,9 +9508,11 @@ async function fetchPurlsShallowScore(purls) {
|
|
|
9435
9508
|
if (!result.success) {
|
|
9436
9509
|
return handleFailedApiResponse('batchPackageFetch', result)
|
|
9437
9510
|
}
|
|
9511
|
+
|
|
9512
|
+
// TODO: seems like there's a bug in the typing since we absolutely have to return the .data here
|
|
9438
9513
|
return {
|
|
9439
9514
|
ok: true,
|
|
9440
|
-
data: result
|
|
9515
|
+
data: result.data
|
|
9441
9516
|
}
|
|
9442
9517
|
}
|
|
9443
9518
|
|
|
@@ -9960,7 +10035,7 @@ async function fetchCreateRepo({
|
|
|
9960
10035
|
}
|
|
9961
10036
|
}
|
|
9962
10037
|
|
|
9963
|
-
async function outputCreateRepo(result, outputKind) {
|
|
10038
|
+
async function outputCreateRepo(result, requestedName, outputKind) {
|
|
9964
10039
|
if (!result.ok) {
|
|
9965
10040
|
process.exitCode = result.code ?? 1
|
|
9966
10041
|
}
|
|
@@ -9972,7 +10047,9 @@ async function outputCreateRepo(result, outputKind) {
|
|
|
9972
10047
|
logger.logger.fail(failMsgWithBadge(result.message, result.cause))
|
|
9973
10048
|
return
|
|
9974
10049
|
}
|
|
9975
|
-
logger.logger.success(
|
|
10050
|
+
logger.logger.success(
|
|
10051
|
+
`OK. Repository created successfully, slug: \`${result.data.slug}\`${result.data.slug !== requestedName ? ' (Warning: slug is not the same as name that was requested!)' : ''}`
|
|
10052
|
+
)
|
|
9976
10053
|
}
|
|
9977
10054
|
|
|
9978
10055
|
async function handleCreateRepo(
|
|
@@ -9987,7 +10064,7 @@ async function handleCreateRepo(
|
|
|
9987
10064
|
repoName,
|
|
9988
10065
|
visibility
|
|
9989
10066
|
})
|
|
9990
|
-
await outputCreateRepo(data, outputKind)
|
|
10067
|
+
await outputCreateRepo(data, repoName, outputKind)
|
|
9991
10068
|
}
|
|
9992
10069
|
|
|
9993
10070
|
const { DRY_RUN_BAILING_NOW: DRY_RUN_BAILING_NOW$d } = constants
|
|
@@ -9997,6 +10074,7 @@ const config$d = {
|
|
|
9997
10074
|
hidden: false,
|
|
9998
10075
|
flags: {
|
|
9999
10076
|
...commonFlags,
|
|
10077
|
+
...outputFlags,
|
|
10000
10078
|
defaultBranch: {
|
|
10001
10079
|
type: 'string',
|
|
10002
10080
|
shortFlag: 'b',
|
|
@@ -10160,7 +10238,7 @@ async function fetchDeleteRepo(orgSlug, repoName) {
|
|
|
10160
10238
|
}
|
|
10161
10239
|
}
|
|
10162
10240
|
|
|
10163
|
-
async function outputDeleteRepo(result, outputKind) {
|
|
10241
|
+
async function outputDeleteRepo(result, repoName, outputKind) {
|
|
10164
10242
|
if (!result.ok) {
|
|
10165
10243
|
process.exitCode = result.code ?? 1
|
|
10166
10244
|
}
|
|
@@ -10172,12 +10250,12 @@ async function outputDeleteRepo(result, outputKind) {
|
|
|
10172
10250
|
logger.logger.fail(failMsgWithBadge(result.message, result.cause))
|
|
10173
10251
|
return
|
|
10174
10252
|
}
|
|
10175
|
-
logger.logger.success(
|
|
10253
|
+
logger.logger.success(`OK. Repository \`${repoName}\` deleted successfully`)
|
|
10176
10254
|
}
|
|
10177
10255
|
|
|
10178
10256
|
async function handleDeleteRepo(orgSlug, repoName, outputKind) {
|
|
10179
10257
|
const data = await fetchDeleteRepo(orgSlug, repoName)
|
|
10180
|
-
await outputDeleteRepo(data, outputKind)
|
|
10258
|
+
await outputDeleteRepo(data, repoName, outputKind)
|
|
10181
10259
|
}
|
|
10182
10260
|
|
|
10183
10261
|
const { DRY_RUN_BAILING_NOW: DRY_RUN_BAILING_NOW$c } = constants
|
|
@@ -10187,6 +10265,7 @@ const config$c = {
|
|
|
10187
10265
|
hidden: false,
|
|
10188
10266
|
flags: {
|
|
10189
10267
|
...commonFlags,
|
|
10268
|
+
...outputFlags,
|
|
10190
10269
|
interactive: {
|
|
10191
10270
|
type: 'boolean',
|
|
10192
10271
|
default: true,
|
|
@@ -10227,8 +10306,7 @@ async function run$c(argv, importMeta, { parentName }) {
|
|
|
10227
10306
|
parentName
|
|
10228
10307
|
})
|
|
10229
10308
|
const { dryRun, interactive, json, markdown, org: orgFlag } = cli.flags
|
|
10230
|
-
const outputKind = getOutputKind(json, markdown)
|
|
10231
|
-
|
|
10309
|
+
const outputKind = getOutputKind(json, markdown)
|
|
10232
10310
|
const [orgSlug, defaultOrgSlug] = await determineOrgSlug(
|
|
10233
10311
|
String(orgFlag || ''),
|
|
10234
10312
|
cli.input[0] || '',
|
|
@@ -10368,6 +10446,7 @@ const config$b = {
|
|
|
10368
10446
|
hidden: false,
|
|
10369
10447
|
flags: {
|
|
10370
10448
|
...commonFlags,
|
|
10449
|
+
...outputFlags,
|
|
10371
10450
|
sort: {
|
|
10372
10451
|
type: 'string',
|
|
10373
10452
|
shortFlag: 's',
|
|
@@ -10401,8 +10480,7 @@ const config$b = {
|
|
|
10401
10480
|
shortFlag: 'p',
|
|
10402
10481
|
default: 1,
|
|
10403
10482
|
description: 'Page number'
|
|
10404
|
-
}
|
|
10405
|
-
...outputFlags
|
|
10483
|
+
}
|
|
10406
10484
|
},
|
|
10407
10485
|
help: (command, config) => `
|
|
10408
10486
|
Usage
|
|
@@ -10520,7 +10598,7 @@ async function fetchUpdateRepo({
|
|
|
10520
10598
|
}
|
|
10521
10599
|
}
|
|
10522
10600
|
|
|
10523
|
-
async function outputUpdateRepo(result, outputKind) {
|
|
10601
|
+
async function outputUpdateRepo(result, repoName, outputKind) {
|
|
10524
10602
|
if (!result.ok) {
|
|
10525
10603
|
process.exitCode = result.code ?? 1
|
|
10526
10604
|
}
|
|
@@ -10532,7 +10610,7 @@ async function outputUpdateRepo(result, outputKind) {
|
|
|
10532
10610
|
logger.logger.fail(failMsgWithBadge(result.message, result.cause))
|
|
10533
10611
|
return
|
|
10534
10612
|
}
|
|
10535
|
-
logger.logger.success(
|
|
10613
|
+
logger.logger.success(`Repository \`${repoName}\` updated successfully`)
|
|
10536
10614
|
}
|
|
10537
10615
|
|
|
10538
10616
|
async function handleUpdateRepo(
|
|
@@ -10547,7 +10625,7 @@ async function handleUpdateRepo(
|
|
|
10547
10625
|
repoName,
|
|
10548
10626
|
visibility
|
|
10549
10627
|
})
|
|
10550
|
-
await outputUpdateRepo(data, outputKind)
|
|
10628
|
+
await outputUpdateRepo(data, repoName, outputKind)
|
|
10551
10629
|
}
|
|
10552
10630
|
|
|
10553
10631
|
const { DRY_RUN_BAILING_NOW: DRY_RUN_BAILING_NOW$a } = constants
|
|
@@ -10557,6 +10635,7 @@ const config$a = {
|
|
|
10557
10635
|
hidden: false,
|
|
10558
10636
|
flags: {
|
|
10559
10637
|
...commonFlags,
|
|
10638
|
+
...outputFlags,
|
|
10560
10639
|
defaultBranch: {
|
|
10561
10640
|
type: 'string',
|
|
10562
10641
|
shortFlag: 'b',
|
|
@@ -11394,7 +11473,7 @@ async function fetchDiffScan({ id1, id2, orgSlug }) {
|
|
|
11394
11473
|
return {
|
|
11395
11474
|
ok: false,
|
|
11396
11475
|
message: 'Socket API returned an error',
|
|
11397
|
-
cause: `${response.statusText}${err ? ` (cause: ${err}` : ''}`
|
|
11476
|
+
cause: `${response.statusText}${err ? ` (cause: ${err})` : ''}`
|
|
11398
11477
|
}
|
|
11399
11478
|
}
|
|
11400
11479
|
const result = await handleApiCall(
|
|
@@ -12334,7 +12413,7 @@ async function run$3(argv, importMeta, { parentName }) {
|
|
|
12334
12413
|
},
|
|
12335
12414
|
{
|
|
12336
12415
|
test: !!scanId,
|
|
12337
|
-
message: 'Scan ID to
|
|
12416
|
+
message: 'Scan ID to report on',
|
|
12338
12417
|
pass: 'ok',
|
|
12339
12418
|
fail: 'missing'
|
|
12340
12419
|
},
|
|
@@ -12397,7 +12476,7 @@ async function fetchScan(orgSlug, scanId) {
|
|
|
12397
12476
|
return {
|
|
12398
12477
|
ok: false,
|
|
12399
12478
|
message: 'Socket API returned an error',
|
|
12400
|
-
cause: `${response.statusText}${err ? ` (cause: ${err}` : ''}`
|
|
12479
|
+
cause: `${response.statusText}${err ? ` (cause: ${err})` : ''}`
|
|
12401
12480
|
}
|
|
12402
12481
|
}
|
|
12403
12482
|
|
|
@@ -12626,7 +12705,7 @@ async function run$2(argv, importMeta, { parentName }) {
|
|
|
12626
12705
|
},
|
|
12627
12706
|
{
|
|
12628
12707
|
test: !!scanId,
|
|
12629
|
-
message: 'Scan ID to
|
|
12708
|
+
message: 'Scan ID to view',
|
|
12630
12709
|
pass: 'ok',
|
|
12631
12710
|
fail: 'missing'
|
|
12632
12711
|
},
|
|
@@ -13387,5 +13466,5 @@ void (async () => {
|
|
|
13387
13466
|
await shadowNpmInject.captureException(e)
|
|
13388
13467
|
}
|
|
13389
13468
|
})()
|
|
13390
|
-
//# debugId=
|
|
13469
|
+
//# debugId=406eb2c1-5d4f-41ac-a034-b9fcf6230684
|
|
13391
13470
|
//# sourceMappingURL=cli.js.map
|