socket 0.14.40-alpha.2 → 0.14.40-alpha.4
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.js +1 -1
- package/dist/module-sync/cli.js +98 -93
- package/dist/module-sync/constants.d.ts.map +1 -1
- package/dist/module-sync/npm-injection.js +22 -20
- package/dist/module-sync/sdk.js +4 -4
- package/dist/module-sync/shadow-bin.js +1 -1
- package/dist/require/cli.js +97 -92
- package/dist/require/constants.d.ts.map +1 -1
- package/dist/require/npm-injection.js +22 -20
- package/dist/require/sdk.js +4 -4
- package/dist/require/shadow-bin.js +1 -1
- package/package.json +15 -15
package/dist/constants.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var fs = require('node:fs');
|
|
4
4
|
var path = require('node:path');
|
|
5
|
-
var env = require('@socketsecurity/registry/lib/env');
|
|
6
5
|
var registryConstants = require('@socketsecurity/registry/lib/constants');
|
|
6
|
+
var env = require('@socketsecurity/registry/lib/env');
|
|
7
7
|
|
|
8
8
|
const {
|
|
9
9
|
PACKAGE_JSON,
|
package/dist/module-sync/cli.js
CHANGED
|
@@ -21,12 +21,12 @@ var npm$1 = require('@socketsecurity/registry/lib/npm');
|
|
|
21
21
|
var words = require('@socketsecurity/registry/lib/words');
|
|
22
22
|
var constants = require('./constants.js');
|
|
23
23
|
var spawn = _socketInterop(require('@npmcli/promise-spawn'));
|
|
24
|
-
var
|
|
24
|
+
var spinner = require('@socketsecurity/registry/lib/spinner');
|
|
25
25
|
var meow = _socketInterop(require('meow'));
|
|
26
26
|
var sdk = require('./sdk.js');
|
|
27
|
-
var prompts = require('@socketsecurity/registry/lib/prompts');
|
|
28
27
|
var isInteractive = _socketInterop(require('is-interactive'));
|
|
29
28
|
var terminalLink = _socketInterop(require('terminal-link'));
|
|
29
|
+
var prompts = require('@socketsecurity/registry/lib/prompts');
|
|
30
30
|
var fs$1 = require('node:fs/promises');
|
|
31
31
|
var npa = _socketInterop(require('npm-package-arg'));
|
|
32
32
|
var semver = _socketInterop(require('semver'));
|
|
@@ -51,8 +51,8 @@ var readline$1 = require('node:readline/promises');
|
|
|
51
51
|
var open = _socketInterop(require('open'));
|
|
52
52
|
var chalkTable = _socketInterop(require('chalk-table'));
|
|
53
53
|
var ScreenWidget = _socketInterop(require('blessed/lib/widgets/screen'));
|
|
54
|
-
var BarChart = _socketInterop(require('blessed-contrib/lib/widget/charts/bar'));
|
|
55
54
|
var GridLayout = _socketInterop(require('blessed-contrib/lib/layout/grid'));
|
|
55
|
+
var BarChart = _socketInterop(require('blessed-contrib/lib/widget/charts/bar'));
|
|
56
56
|
var LineChart = _socketInterop(require('blessed-contrib/lib/widget/charts/line'));
|
|
57
57
|
var util = require('node:util');
|
|
58
58
|
var TableWidget = _socketInterop(require('blessed-contrib/lib/widget/table'));
|
|
@@ -228,19 +228,20 @@ const fix = {
|
|
|
228
228
|
description: 'Fix "fixable" Socket alerts',
|
|
229
229
|
async run() {
|
|
230
230
|
const wrapperPath = path.join(rootBinPath$1, 'npm-cli.js');
|
|
231
|
-
const
|
|
232
|
-
signal: abortSignal$3,
|
|
233
|
-
stdio: 'ignore',
|
|
234
|
-
env: {
|
|
235
|
-
...process.env,
|
|
236
|
-
[SOCKET_CLI_FIX_PACKAGE_LOCK_FILE]: '1'
|
|
237
|
-
}
|
|
238
|
-
};
|
|
239
|
-
const spinner = yoctoSpinner().start();
|
|
231
|
+
const spinner$1 = new spinner.Spinner().start();
|
|
240
232
|
try {
|
|
241
|
-
await spawn(execPath$1, [wrapperPath, 'install', '--silent'],
|
|
233
|
+
await spawn(execPath$1, [wrapperPath, 'install', '--silent'], {
|
|
234
|
+
signal: abortSignal$3,
|
|
235
|
+
stdio: 'ignore',
|
|
236
|
+
env: {
|
|
237
|
+
...process.env,
|
|
238
|
+
[SOCKET_CLI_FIX_PACKAGE_LOCK_FILE]: '1'
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
} catch (e) {
|
|
242
|
+
console.error(e);
|
|
242
243
|
} finally {
|
|
243
|
-
spinner.stop();
|
|
244
|
+
spinner$1.stop();
|
|
244
245
|
}
|
|
245
246
|
}
|
|
246
247
|
};
|
|
@@ -425,15 +426,15 @@ const info = {
|
|
|
425
426
|
const commandContext = setupCommand$m(name, info.description, argv, importMeta);
|
|
426
427
|
if (commandContext) {
|
|
427
428
|
const spinnerText = commandContext.pkgVersion === 'latest' ? `Looking up data for the latest version of ${commandContext.pkgName}` : `Looking up data for version ${commandContext.pkgVersion} of ${commandContext.pkgName}`;
|
|
428
|
-
const spinner =
|
|
429
|
+
const spinner$1 = new spinner.Spinner({
|
|
429
430
|
text: spinnerText
|
|
430
431
|
}).start();
|
|
431
|
-
const packageData = await fetchPackageData(commandContext.pkgName, commandContext.pkgVersion, commandContext, spinner);
|
|
432
|
+
const packageData = await fetchPackageData(commandContext.pkgName, commandContext.pkgVersion, commandContext, spinner$1);
|
|
432
433
|
if (packageData) {
|
|
433
434
|
formatPackageDataOutput(packageData, {
|
|
434
435
|
name,
|
|
435
436
|
...commandContext
|
|
436
|
-
}, spinner);
|
|
437
|
+
}, spinner$1);
|
|
437
438
|
}
|
|
438
439
|
}
|
|
439
440
|
}
|
|
@@ -659,7 +660,7 @@ const login = {
|
|
|
659
660
|
apiBaseUrl ??= sdk.getSetting('apiBaseUrl') ?? undefined;
|
|
660
661
|
let apiProxy = cli.flags['apiProxy'];
|
|
661
662
|
apiProxy ??= sdk.getSetting('apiProxy') ?? undefined;
|
|
662
|
-
const spinner =
|
|
663
|
+
const spinner$1 = new spinner.Spinner({
|
|
663
664
|
text: 'Verifying API key...'
|
|
664
665
|
}).start();
|
|
665
666
|
let orgs;
|
|
@@ -670,9 +671,9 @@ const login = {
|
|
|
670
671
|
throw new sdk.AuthError();
|
|
671
672
|
}
|
|
672
673
|
orgs = result.data;
|
|
673
|
-
spinner.success('API key verified');
|
|
674
|
+
spinner$1.success('API key verified');
|
|
674
675
|
} catch {
|
|
675
|
-
spinner.error('Invalid API key');
|
|
676
|
+
spinner$1.error('Invalid API key');
|
|
676
677
|
return;
|
|
677
678
|
}
|
|
678
679
|
const enforcedChoices = Object.values(orgs.organizations).filter(nonNullish).filter(org => org.plan === 'enterprise').map(org => ({
|
|
@@ -709,7 +710,7 @@ const login = {
|
|
|
709
710
|
sdk.updateSetting('apiKey', apiKey);
|
|
710
711
|
sdk.updateSetting('apiBaseUrl', apiBaseUrl);
|
|
711
712
|
sdk.updateSetting('apiProxy', apiProxy);
|
|
712
|
-
spinner.success(`API credentials ${oldKey ? 'updated' : 'set'}`);
|
|
713
|
+
spinner$1.success(`API credentials ${oldKey ? 'updated' : 'set'}`);
|
|
713
714
|
}
|
|
714
715
|
};
|
|
715
716
|
|
|
@@ -745,7 +746,7 @@ const logout = {
|
|
|
745
746
|
sdk.updateSetting('apiBaseUrl', null);
|
|
746
747
|
sdk.updateSetting('apiProxy', null);
|
|
747
748
|
sdk.updateSetting('enforcedOrgs', null);
|
|
748
|
-
|
|
749
|
+
new spinner.Spinner().success('Successfully logged out');
|
|
749
750
|
}
|
|
750
751
|
};
|
|
751
752
|
|
|
@@ -1016,7 +1017,9 @@ const {
|
|
|
1016
1017
|
BUN,
|
|
1017
1018
|
LOCK_EXT,
|
|
1018
1019
|
NPM: NPM$1,
|
|
1020
|
+
OVERRIDES,
|
|
1019
1021
|
PNPM,
|
|
1022
|
+
RESOLUTIONS,
|
|
1020
1023
|
SOCKET_CLI_UPDATE_OVERRIDES_IN_PACKAGE_LOCK_FILE,
|
|
1021
1024
|
VLT,
|
|
1022
1025
|
YARN_BERRY,
|
|
@@ -1026,15 +1029,13 @@ const {
|
|
|
1026
1029
|
rootBinPath
|
|
1027
1030
|
} = constants;
|
|
1028
1031
|
const COMMAND_TITLE = 'Socket Optimize';
|
|
1029
|
-
const OVERRIDES_FIELD_NAME = 'overrides';
|
|
1030
1032
|
const NPM_OVERRIDE_PR_URL = 'https://github.com/npm/cli/pull/7025';
|
|
1031
1033
|
const PNPM_FIELD_NAME = PNPM;
|
|
1032
1034
|
const PNPM_WORKSPACE = `${PNPM}-workspace`;
|
|
1033
|
-
const RESOLUTIONS_FIELD_NAME = 'resolutions';
|
|
1034
1035
|
const manifestNpmOverrides = registry.getManifestData(NPM$1);
|
|
1035
1036
|
const getOverridesDataByAgent = {
|
|
1036
1037
|
[BUN](pkgJson) {
|
|
1037
|
-
const overrides = pkgJson?.
|
|
1038
|
+
const overrides = pkgJson?.[RESOLUTIONS] ?? {};
|
|
1038
1039
|
return {
|
|
1039
1040
|
type: YARN_BERRY,
|
|
1040
1041
|
overrides
|
|
@@ -1043,7 +1044,7 @@ const getOverridesDataByAgent = {
|
|
|
1043
1044
|
// npm overrides documentation:
|
|
1044
1045
|
// https://docs.npmjs.com/cli/v10/configuring-npm/package-json#overrides
|
|
1045
1046
|
[NPM$1](pkgJson) {
|
|
1046
|
-
const overrides = pkgJson?.
|
|
1047
|
+
const overrides = pkgJson?.[OVERRIDES] ?? {};
|
|
1047
1048
|
return {
|
|
1048
1049
|
type: NPM$1,
|
|
1049
1050
|
overrides
|
|
@@ -1052,14 +1053,14 @@ const getOverridesDataByAgent = {
|
|
|
1052
1053
|
// pnpm overrides documentation:
|
|
1053
1054
|
// https://pnpm.io/package_json#pnpmoverrides
|
|
1054
1055
|
[PNPM](pkgJson) {
|
|
1055
|
-
const overrides = pkgJson?.pnpm?.
|
|
1056
|
+
const overrides = pkgJson?.pnpm?.[OVERRIDES] ?? {};
|
|
1056
1057
|
return {
|
|
1057
1058
|
type: PNPM,
|
|
1058
1059
|
overrides
|
|
1059
1060
|
};
|
|
1060
1061
|
},
|
|
1061
1062
|
[VLT](pkgJson) {
|
|
1062
|
-
const overrides = pkgJson?.
|
|
1063
|
+
const overrides = pkgJson?.[OVERRIDES] ?? {};
|
|
1063
1064
|
return {
|
|
1064
1065
|
type: VLT,
|
|
1065
1066
|
overrides
|
|
@@ -1068,7 +1069,7 @@ const getOverridesDataByAgent = {
|
|
|
1068
1069
|
// Yarn resolutions documentation:
|
|
1069
1070
|
// https://yarnpkg.com/configuration/manifest#resolutions
|
|
1070
1071
|
[YARN_BERRY](pkgJson) {
|
|
1071
|
-
const overrides = pkgJson?.
|
|
1072
|
+
const overrides = pkgJson?.[RESOLUTIONS] ?? {};
|
|
1072
1073
|
return {
|
|
1073
1074
|
type: YARN_BERRY,
|
|
1074
1075
|
overrides
|
|
@@ -1077,7 +1078,7 @@ const getOverridesDataByAgent = {
|
|
|
1077
1078
|
// Yarn resolutions documentation:
|
|
1078
1079
|
// https://classic.yarnpkg.com/en/docs/selective-version-resolutions
|
|
1079
1080
|
[YARN_CLASSIC](pkgJson) {
|
|
1080
|
-
const overrides = pkgJson?.
|
|
1081
|
+
const overrides = pkgJson?.[RESOLUTIONS] ?? {};
|
|
1081
1082
|
return {
|
|
1082
1083
|
type: YARN_CLASSIC,
|
|
1083
1084
|
overrides
|
|
@@ -1164,7 +1165,7 @@ const updateManifestByAgent = (() => {
|
|
|
1164
1165
|
[field]: undefined
|
|
1165
1166
|
});
|
|
1166
1167
|
}
|
|
1167
|
-
} else if (field ===
|
|
1168
|
+
} else if (field === OVERRIDES || field === RESOLUTIONS) {
|
|
1168
1169
|
// Properties with undefined values are omitted when saved as JSON.
|
|
1169
1170
|
editablePkgJson.update({
|
|
1170
1171
|
[field]: objects.hasKeys(value) ? value : undefined
|
|
@@ -1176,7 +1177,7 @@ const updateManifestByAgent = (() => {
|
|
|
1176
1177
|
}
|
|
1177
1178
|
return;
|
|
1178
1179
|
}
|
|
1179
|
-
if ((field ===
|
|
1180
|
+
if ((field === OVERRIDES || field === PNPM_FIELD_NAME || field === RESOLUTIONS) && !objects.hasKeys(value)) {
|
|
1180
1181
|
return;
|
|
1181
1182
|
}
|
|
1182
1183
|
// Since the field doesn't exist we want to insert it into the package.json
|
|
@@ -1185,17 +1186,17 @@ const updateManifestByAgent = (() => {
|
|
|
1185
1186
|
const entries = Object.entries(pkgJson);
|
|
1186
1187
|
let insertIndex = -1;
|
|
1187
1188
|
let isPlacingHigher = false;
|
|
1188
|
-
if (field ===
|
|
1189
|
-
insertIndex = getLowestEntryIndex(entries, [
|
|
1189
|
+
if (field === OVERRIDES) {
|
|
1190
|
+
insertIndex = getLowestEntryIndex(entries, [RESOLUTIONS]);
|
|
1190
1191
|
if (insertIndex === -1) {
|
|
1191
1192
|
isPlacingHigher = true;
|
|
1192
1193
|
insertIndex = getHighestEntryIndex(entries, [...depFields, PNPM]);
|
|
1193
1194
|
}
|
|
1194
|
-
} else if (field ===
|
|
1195
|
+
} else if (field === RESOLUTIONS) {
|
|
1195
1196
|
isPlacingHigher = true;
|
|
1196
|
-
insertIndex = getHighestEntryIndex(entries, [...depFields,
|
|
1197
|
+
insertIndex = getHighestEntryIndex(entries, [...depFields, OVERRIDES, PNPM]);
|
|
1197
1198
|
} else if (field === PNPM_FIELD_NAME) {
|
|
1198
|
-
insertIndex = getLowestEntryIndex(entries, [
|
|
1199
|
+
insertIndex = getLowestEntryIndex(entries, [OVERRIDES, RESOLUTIONS]);
|
|
1199
1200
|
if (insertIndex === -1) {
|
|
1200
1201
|
isPlacingHigher = true;
|
|
1201
1202
|
insertIndex = getHighestEntryIndex(entries, depFields);
|
|
@@ -1217,10 +1218,10 @@ const updateManifestByAgent = (() => {
|
|
|
1217
1218
|
editablePkgJson.fromJSON(`${JSON.stringify(Object.fromEntries(entries), null, 2)}\n`);
|
|
1218
1219
|
}
|
|
1219
1220
|
function updateOverrides(editablePkgJson, overrides) {
|
|
1220
|
-
updatePkgJson(editablePkgJson,
|
|
1221
|
+
updatePkgJson(editablePkgJson, OVERRIDES, overrides);
|
|
1221
1222
|
}
|
|
1222
1223
|
function updateResolutions(editablePkgJson, overrides) {
|
|
1223
|
-
updatePkgJson(editablePkgJson,
|
|
1224
|
+
updatePkgJson(editablePkgJson, RESOLUTIONS, overrides);
|
|
1224
1225
|
}
|
|
1225
1226
|
return {
|
|
1226
1227
|
[BUN]: updateResolutions,
|
|
@@ -1675,13 +1676,13 @@ const optimize = {
|
|
|
1675
1676
|
if (lockPath && path.relative(cwd, lockPath).startsWith('.')) {
|
|
1676
1677
|
console.warn(`⚠️ ${COMMAND_TITLE}: Package ${lockName} found at ${lockPath}`);
|
|
1677
1678
|
}
|
|
1678
|
-
const spinner =
|
|
1679
|
+
const spinner$1 = new spinner.Spinner({
|
|
1679
1680
|
text: 'Socket optimizing...'
|
|
1680
1681
|
});
|
|
1681
1682
|
const state = createAddOverridesState({
|
|
1682
|
-
spinner
|
|
1683
|
+
spinner: spinner$1
|
|
1683
1684
|
});
|
|
1684
|
-
spinner.start();
|
|
1685
|
+
spinner$1.start();
|
|
1685
1686
|
const nodeRange = `>=${minimumNodeVersion}`;
|
|
1686
1687
|
const manifestEntries = manifestNpmOverrides.filter(({
|
|
1687
1688
|
1: data
|
|
@@ -1699,7 +1700,7 @@ const optimize = {
|
|
|
1699
1700
|
prod,
|
|
1700
1701
|
rootPath: pkgPath
|
|
1701
1702
|
}, state);
|
|
1702
|
-
spinner.stop();
|
|
1703
|
+
spinner$1.stop();
|
|
1703
1704
|
const addedCount = state.added.size;
|
|
1704
1705
|
const updatedCount = state.updated.size;
|
|
1705
1706
|
const pkgJsonChanged = addedCount > 0 || updatedCount > 0;
|
|
@@ -1717,7 +1718,7 @@ const optimize = {
|
|
|
1717
1718
|
if (isNpm || pkgJsonChanged) {
|
|
1718
1719
|
// Always update package-lock.json until the npm overrides PR lands:
|
|
1719
1720
|
// https://github.com/npm/cli/pull/7025
|
|
1720
|
-
spinner.start(`Updating ${lockName}...`);
|
|
1721
|
+
spinner$1.start(`Updating ${lockName}...`);
|
|
1721
1722
|
try {
|
|
1722
1723
|
if (isNpm) {
|
|
1723
1724
|
const wrapperPath = path.join(rootBinPath, 'npm-cli.js');
|
|
@@ -1741,12 +1742,12 @@ const optimize = {
|
|
|
1741
1742
|
stdio: 'ignore'
|
|
1742
1743
|
});
|
|
1743
1744
|
}
|
|
1744
|
-
spinner.stop();
|
|
1745
|
+
spinner$1.stop();
|
|
1745
1746
|
if (isNpm) {
|
|
1746
1747
|
console.log(`💡 Re-run ${COMMAND_TITLE} whenever ${lockName} changes.\n This can be skipped once npm ships ${NPM_OVERRIDE_PR_URL}.`);
|
|
1747
1748
|
}
|
|
1748
1749
|
} catch (e) {
|
|
1749
|
-
spinner.error(`${COMMAND_TITLE}: ${agent} install failed to update ${lockName}`);
|
|
1750
|
+
spinner$1.error(`${COMMAND_TITLE}: ${agent} install failed to update ${lockName}`);
|
|
1750
1751
|
console.error(e);
|
|
1751
1752
|
}
|
|
1752
1753
|
}
|
|
@@ -1826,16 +1827,16 @@ async function fetchOrganizations() {
|
|
|
1826
1827
|
if (!apiKey) {
|
|
1827
1828
|
throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
|
|
1828
1829
|
}
|
|
1829
|
-
const spinner =
|
|
1830
|
+
const spinner$1 = new spinner.Spinner({
|
|
1830
1831
|
text: 'Fetching organizations...'
|
|
1831
1832
|
}).start();
|
|
1832
1833
|
const socketSdk = await sdk.setupSdk(apiKey);
|
|
1833
1834
|
const result = await handleApiCall(socketSdk.getOrganizations(), 'looking up organizations');
|
|
1834
1835
|
if (result.success === false) {
|
|
1835
|
-
handleUnsuccessfulApiResponse('getOrganizations', result, spinner);
|
|
1836
|
+
handleUnsuccessfulApiResponse('getOrganizations', result, spinner$1);
|
|
1836
1837
|
return;
|
|
1837
1838
|
}
|
|
1838
|
-
spinner.stop(`List of organizations associated with your API key: ${colors.italic(apiKey)}`);
|
|
1839
|
+
spinner$1.stop(`List of organizations associated with your API key: ${colors.italic(apiKey)}`);
|
|
1839
1840
|
const organizations = Object.values(result.data.organizations);
|
|
1840
1841
|
for (const o of organizations) {
|
|
1841
1842
|
console.log(`
|
|
@@ -2051,7 +2052,7 @@ async function fetchReportData(reportId, {
|
|
|
2051
2052
|
}) {
|
|
2052
2053
|
// Do the API call
|
|
2053
2054
|
const socketSdk = await sdk.setupSdk();
|
|
2054
|
-
const spinner =
|
|
2055
|
+
const spinner$1 = new spinner.Spinner({
|
|
2055
2056
|
text: `Fetching report with ID ${reportId} (this could take a while)`
|
|
2056
2057
|
}).start();
|
|
2057
2058
|
let result;
|
|
@@ -2066,23 +2067,23 @@ async function fetchReportData(reportId, {
|
|
|
2066
2067
|
}
|
|
2067
2068
|
}
|
|
2068
2069
|
if (result.success === false) {
|
|
2069
|
-
return handleUnsuccessfulApiResponse('getReport', result, spinner);
|
|
2070
|
+
return handleUnsuccessfulApiResponse('getReport', result, spinner$1);
|
|
2070
2071
|
}
|
|
2071
2072
|
|
|
2072
2073
|
// Conclude the status of the API call
|
|
2073
2074
|
|
|
2074
2075
|
if (strict) {
|
|
2075
2076
|
if (result.data.healthy) {
|
|
2076
|
-
spinner.success('Report result is healthy and great!');
|
|
2077
|
+
spinner$1.success('Report result is healthy and great!');
|
|
2077
2078
|
} else {
|
|
2078
|
-
spinner.error('Report result deemed unhealthy for project');
|
|
2079
|
+
spinner$1.error('Report result deemed unhealthy for project');
|
|
2079
2080
|
}
|
|
2080
2081
|
} else if (result.data.healthy === false) {
|
|
2081
2082
|
const severityCount = getSeverityCount(result.data.issues, includeAllIssues ? undefined : 'high');
|
|
2082
2083
|
const issueSummary = formatSeverityCount(severityCount);
|
|
2083
|
-
spinner.success(`Report has these issues: ${issueSummary}`);
|
|
2084
|
+
spinner$1.success(`Report has these issues: ${issueSummary}`);
|
|
2084
2085
|
} else {
|
|
2085
|
-
spinner.success('Report has no issues');
|
|
2086
|
+
spinner$1.success('Report has no issues');
|
|
2086
2087
|
}
|
|
2087
2088
|
return result.data;
|
|
2088
2089
|
}
|
|
@@ -2256,7 +2257,7 @@ async function setupCommand$g(name, description, argv, importMeta) {
|
|
|
2256
2257
|
});
|
|
2257
2258
|
const socketSdk = await sdk.setupSdk();
|
|
2258
2259
|
const supportedFiles = await socketSdk.getReportSupportedFiles().then(res => {
|
|
2259
|
-
if (!res.success) handleUnsuccessfulApiResponse('getReportSupportedFiles', res,
|
|
2260
|
+
if (!res.success) handleUnsuccessfulApiResponse('getReportSupportedFiles', res, new spinner.Spinner());
|
|
2260
2261
|
return res.data;
|
|
2261
2262
|
}).catch(cause => {
|
|
2262
2263
|
throw new ponyCause.ErrorWithCause('Failed getting supported files for report', {
|
|
@@ -2288,16 +2289,16 @@ async function createReport(packagePaths, {
|
|
|
2288
2289
|
return;
|
|
2289
2290
|
}
|
|
2290
2291
|
const socketSdk = await sdk.setupSdk();
|
|
2291
|
-
const spinner =
|
|
2292
|
+
const spinner$1 = new spinner.Spinner({
|
|
2292
2293
|
text: `Creating report with ${packagePaths.length} package files`
|
|
2293
2294
|
}).start();
|
|
2294
2295
|
const apiCall = socketSdk.createReportFromFilePaths(packagePaths, cwd, config?.issueRules);
|
|
2295
2296
|
const result = await handleApiCall(apiCall, 'creating report');
|
|
2296
2297
|
if (result.success) {
|
|
2297
|
-
spinner.success();
|
|
2298
|
+
spinner$1.success();
|
|
2298
2299
|
return result;
|
|
2299
2300
|
}
|
|
2300
|
-
handleUnsuccessfulApiResponse('createReport', result, spinner);
|
|
2301
|
+
handleUnsuccessfulApiResponse('createReport', result, spinner$1);
|
|
2301
2302
|
return undefined;
|
|
2302
2303
|
}
|
|
2303
2304
|
function formatReportCreationOutput(data, {
|
|
@@ -2546,10 +2547,10 @@ const create$1 = {
|
|
|
2546
2547
|
throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
|
|
2547
2548
|
}
|
|
2548
2549
|
const spinnerText = 'Creating a scan... \n';
|
|
2549
|
-
const spinner =
|
|
2550
|
+
const spinner$1 = new spinner.Spinner({
|
|
2550
2551
|
text: spinnerText
|
|
2551
2552
|
}).start();
|
|
2552
|
-
await createFullScan(input, spinner, apiKey);
|
|
2553
|
+
await createFullScan(input, spinner$1, apiKey);
|
|
2553
2554
|
}
|
|
2554
2555
|
}
|
|
2555
2556
|
};
|
|
@@ -2644,7 +2645,7 @@ async function setupCommand$e(name, description, argv, importMeta) {
|
|
|
2644
2645
|
const cwd = process.cwd();
|
|
2645
2646
|
const socketSdk = await sdk.setupSdk();
|
|
2646
2647
|
const supportedFiles = await socketSdk.getReportSupportedFiles().then(res => {
|
|
2647
|
-
if (!res.success) handleUnsuccessfulApiResponse('getReportSupportedFiles', res,
|
|
2648
|
+
if (!res.success) handleUnsuccessfulApiResponse('getReportSupportedFiles', res, new spinner.Spinner());
|
|
2648
2649
|
return res.data;
|
|
2649
2650
|
}).catch(/** @type {(cause: Error) => never} */
|
|
2650
2651
|
cause => {
|
|
@@ -2734,10 +2735,10 @@ const del$1 = {
|
|
|
2734
2735
|
throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
|
|
2735
2736
|
}
|
|
2736
2737
|
const spinnerText = 'Deleting scan...';
|
|
2737
|
-
const spinner =
|
|
2738
|
+
const spinner$1 = new spinner.Spinner({
|
|
2738
2739
|
text: spinnerText
|
|
2739
2740
|
}).start();
|
|
2740
|
-
await deleteOrgFullScan(input.orgSlug, input.fullScanId, spinner, apiKey);
|
|
2741
|
+
await deleteOrgFullScan(input.orgSlug, input.fullScanId, spinner$1, apiKey);
|
|
2741
2742
|
}
|
|
2742
2743
|
}
|
|
2743
2744
|
};
|
|
@@ -2794,6 +2795,7 @@ async function deleteOrgFullScan(orgSlug, fullScanId, spinner, apiKey) {
|
|
|
2794
2795
|
}
|
|
2795
2796
|
}
|
|
2796
2797
|
|
|
2798
|
+
// @ts-ignore
|
|
2797
2799
|
const list$1 = {
|
|
2798
2800
|
description: 'List scans for an organization',
|
|
2799
2801
|
async run(argv, importMeta, {
|
|
@@ -2807,10 +2809,10 @@ const list$1 = {
|
|
|
2807
2809
|
throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
|
|
2808
2810
|
}
|
|
2809
2811
|
const spinnerText = 'Listing scans... \n';
|
|
2810
|
-
const spinner =
|
|
2812
|
+
const spinner$1 = new spinner.Spinner({
|
|
2811
2813
|
text: spinnerText
|
|
2812
2814
|
}).start();
|
|
2813
|
-
await listOrgFullScan(input.orgSlug, input, spinner, apiKey);
|
|
2815
|
+
await listOrgFullScan(input.orgSlug, input, spinner$1, apiKey);
|
|
2814
2816
|
}
|
|
2815
2817
|
}
|
|
2816
2818
|
};
|
|
@@ -2951,10 +2953,10 @@ const metadata = {
|
|
|
2951
2953
|
throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
|
|
2952
2954
|
}
|
|
2953
2955
|
const spinnerText = "Getting scan's metadata... \n";
|
|
2954
|
-
const spinner =
|
|
2956
|
+
const spinner$1 = new spinner.Spinner({
|
|
2955
2957
|
text: spinnerText
|
|
2956
2958
|
}).start();
|
|
2957
|
-
await getOrgScanMetadata(input.orgSlug, input.scanID, spinner, apiKey);
|
|
2959
|
+
await getOrgScanMetadata(input.orgSlug, input.scanID, spinner$1, apiKey);
|
|
2958
2960
|
}
|
|
2959
2961
|
}
|
|
2960
2962
|
};
|
|
@@ -3024,14 +3026,14 @@ const stream = {
|
|
|
3024
3026
|
if (!apiKey) {
|
|
3025
3027
|
throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
|
|
3026
3028
|
}
|
|
3027
|
-
const spinner =
|
|
3029
|
+
const spinner$1 = new spinner.Spinner({
|
|
3028
3030
|
text: 'Streaming scan...'
|
|
3029
3031
|
}).start();
|
|
3030
3032
|
const result = await getOrgFullScan(input.orgSlug, input.fullScanId, input.file, apiKey);
|
|
3031
3033
|
if (result?.success) {
|
|
3032
|
-
spinner.stop(input.file ? `Full scan details written to ${input.file}` : '');
|
|
3034
|
+
spinner$1.stop(input.file ? `Full scan details written to ${input.file}` : '');
|
|
3033
3035
|
} else {
|
|
3034
|
-
handleUnsuccessfulApiResponse('getOrgFullScan', result, spinner);
|
|
3036
|
+
handleUnsuccessfulApiResponse('getOrgFullScan', result, spinner$1);
|
|
3035
3037
|
}
|
|
3036
3038
|
}
|
|
3037
3039
|
}
|
|
@@ -3119,10 +3121,10 @@ const auditLog = {
|
|
|
3119
3121
|
if (!apiKey) {
|
|
3120
3122
|
throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
|
|
3121
3123
|
}
|
|
3122
|
-
const spinner =
|
|
3124
|
+
const spinner$1 = new spinner.Spinner({
|
|
3123
3125
|
text: `Looking up audit log for ${input.orgSlug}\n`
|
|
3124
3126
|
}).start();
|
|
3125
|
-
await fetchOrgAuditLog(input.orgSlug, input, spinner, apiKey);
|
|
3127
|
+
await fetchOrgAuditLog(input.orgSlug, input, spinner$1, apiKey);
|
|
3126
3128
|
}
|
|
3127
3129
|
}
|
|
3128
3130
|
};
|
|
@@ -3244,10 +3246,10 @@ const create = {
|
|
|
3244
3246
|
throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
|
|
3245
3247
|
}
|
|
3246
3248
|
const spinnerText = 'Creating repository... \n';
|
|
3247
|
-
const spinner =
|
|
3249
|
+
const spinner$1 = new spinner.Spinner({
|
|
3248
3250
|
text: spinnerText
|
|
3249
3251
|
}).start();
|
|
3250
|
-
await createRepo(input.orgSlug, input, spinner, apiKey);
|
|
3252
|
+
await createRepo(input.orgSlug, input, spinner$1, apiKey);
|
|
3251
3253
|
}
|
|
3252
3254
|
}
|
|
3253
3255
|
};
|
|
@@ -3357,10 +3359,10 @@ const del = {
|
|
|
3357
3359
|
throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
|
|
3358
3360
|
}
|
|
3359
3361
|
const spinnerText = 'Deleting repository... \n';
|
|
3360
|
-
const spinner =
|
|
3362
|
+
const spinner$1 = new spinner.Spinner({
|
|
3361
3363
|
text: spinnerText
|
|
3362
3364
|
}).start();
|
|
3363
|
-
await deleteRepository(input.orgSlug, input.repoName, spinner, apiKey);
|
|
3365
|
+
await deleteRepository(input.orgSlug, input.repoName, spinner$1, apiKey);
|
|
3364
3366
|
}
|
|
3365
3367
|
}
|
|
3366
3368
|
};
|
|
@@ -3407,6 +3409,7 @@ async function deleteRepository(orgSlug, repoName, spinner, apiKey) {
|
|
|
3407
3409
|
}
|
|
3408
3410
|
}
|
|
3409
3411
|
|
|
3412
|
+
// @ts-ignore
|
|
3410
3413
|
const list = {
|
|
3411
3414
|
description: 'List repositories in an organization',
|
|
3412
3415
|
async run(argv, importMeta, {
|
|
@@ -3420,10 +3423,10 @@ const list = {
|
|
|
3420
3423
|
throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
|
|
3421
3424
|
}
|
|
3422
3425
|
const spinnerText = 'Listing repositories... \n';
|
|
3423
|
-
const spinner =
|
|
3426
|
+
const spinner$1 = new spinner.Spinner({
|
|
3424
3427
|
text: spinnerText
|
|
3425
3428
|
}).start();
|
|
3426
|
-
await listOrgRepos(input.orgSlug, input, spinner, apiKey);
|
|
3429
|
+
await listOrgRepos(input.orgSlug, input, spinner$1, apiKey);
|
|
3427
3430
|
}
|
|
3428
3431
|
}
|
|
3429
3432
|
};
|
|
@@ -3539,10 +3542,10 @@ const update = {
|
|
|
3539
3542
|
throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
|
|
3540
3543
|
}
|
|
3541
3544
|
const spinnerText = 'Updating repository... \n';
|
|
3542
|
-
const spinner =
|
|
3545
|
+
const spinner$1 = new spinner.Spinner({
|
|
3543
3546
|
text: spinnerText
|
|
3544
3547
|
}).start();
|
|
3545
|
-
await updateRepository(input.orgSlug, input, spinner, apiKey);
|
|
3548
|
+
await updateRepository(input.orgSlug, input, spinner$1, apiKey);
|
|
3546
3549
|
}
|
|
3547
3550
|
}
|
|
3548
3551
|
};
|
|
@@ -3639,6 +3642,7 @@ async function updateRepository(orgSlug, input, spinner, apiKey) {
|
|
|
3639
3642
|
}
|
|
3640
3643
|
}
|
|
3641
3644
|
|
|
3645
|
+
// @ts-ignore
|
|
3642
3646
|
const view = {
|
|
3643
3647
|
description: 'View repositories in an organization',
|
|
3644
3648
|
async run(argv, importMeta, {
|
|
@@ -3652,10 +3656,10 @@ const view = {
|
|
|
3652
3656
|
throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
|
|
3653
3657
|
}
|
|
3654
3658
|
const spinnerText = 'Fetching repository... \n';
|
|
3655
|
-
const spinner =
|
|
3659
|
+
const spinner$1 = new spinner.Spinner({
|
|
3656
3660
|
text: spinnerText
|
|
3657
3661
|
}).start();
|
|
3658
|
-
await viewRepository(input.orgSlug, input.repositoryName, spinner, apiKey);
|
|
3662
|
+
await viewRepository(input.orgSlug, input.repositoryName, spinner$1, apiKey);
|
|
3659
3663
|
}
|
|
3660
3664
|
}
|
|
3661
3665
|
};
|
|
@@ -3757,6 +3761,7 @@ const repo = {
|
|
|
3757
3761
|
}
|
|
3758
3762
|
};
|
|
3759
3763
|
|
|
3764
|
+
// @ts-ignore
|
|
3760
3765
|
const dependencies = {
|
|
3761
3766
|
description: 'Search for any dependency that is being used in your organization',
|
|
3762
3767
|
async run(argv, importMeta, {
|
|
@@ -3829,7 +3834,7 @@ async function searchDeps({
|
|
|
3829
3834
|
if (!apiKey) {
|
|
3830
3835
|
throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
|
|
3831
3836
|
}
|
|
3832
|
-
const spinner =
|
|
3837
|
+
const spinner$1 = new spinner.Spinner({
|
|
3833
3838
|
text: 'Searching dependencies...'
|
|
3834
3839
|
}).start();
|
|
3835
3840
|
const socketSdk = await sdk.setupSdk(apiKey);
|
|
@@ -3838,10 +3843,10 @@ async function searchDeps({
|
|
|
3838
3843
|
offset
|
|
3839
3844
|
}), 'Searching dependencies');
|
|
3840
3845
|
if (!result.success) {
|
|
3841
|
-
handleUnsuccessfulApiResponse('searchDependencies', result, spinner);
|
|
3846
|
+
handleUnsuccessfulApiResponse('searchDependencies', result, spinner$1);
|
|
3842
3847
|
return;
|
|
3843
3848
|
}
|
|
3844
|
-
spinner.stop('Organization dependencies:');
|
|
3849
|
+
spinner$1.stop('Organization dependencies:');
|
|
3845
3850
|
if (outputJson) {
|
|
3846
3851
|
console.log(result.data);
|
|
3847
3852
|
return;
|
|
@@ -3886,14 +3891,14 @@ const analytics = {
|
|
|
3886
3891
|
if (!apiKey) {
|
|
3887
3892
|
throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
|
|
3888
3893
|
}
|
|
3889
|
-
const spinner =
|
|
3894
|
+
const spinner$1 = new spinner.Spinner({
|
|
3890
3895
|
text: 'Fetching analytics data'
|
|
3891
3896
|
}).start();
|
|
3892
3897
|
if (input.scope === 'org') {
|
|
3893
|
-
await fetchOrgAnalyticsData(input.time, spinner, apiKey, input.outputJson, input.file);
|
|
3898
|
+
await fetchOrgAnalyticsData(input.time, spinner$1, apiKey, input.outputJson, input.file);
|
|
3894
3899
|
} else {
|
|
3895
3900
|
if (input.repo) {
|
|
3896
|
-
await fetchRepoAnalyticsData(input.repo, input.time, spinner, apiKey, input.outputJson, input.file);
|
|
3901
|
+
await fetchRepoAnalyticsData(input.repo, input.time, spinner$1, apiKey, input.outputJson, input.file);
|
|
3897
3902
|
}
|
|
3898
3903
|
}
|
|
3899
3904
|
}
|
|
@@ -4187,10 +4192,10 @@ const get = {
|
|
|
4187
4192
|
throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
|
|
4188
4193
|
}
|
|
4189
4194
|
const spinnerText = 'Getting diff scan... \n';
|
|
4190
|
-
const spinner =
|
|
4195
|
+
const spinner$1 = new spinner.Spinner({
|
|
4191
4196
|
text: spinnerText
|
|
4192
4197
|
}).start();
|
|
4193
|
-
await getDiffScan(input, spinner, apiKey);
|
|
4198
|
+
await getDiffScan(input, spinner$1, apiKey);
|
|
4194
4199
|
}
|
|
4195
4200
|
}
|
|
4196
4201
|
};
|
|
@@ -4338,10 +4343,10 @@ const threatFeed = {
|
|
|
4338
4343
|
if (!apiKey) {
|
|
4339
4344
|
throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
|
|
4340
4345
|
}
|
|
4341
|
-
const spinner =
|
|
4346
|
+
const spinner$1 = new spinner.Spinner({
|
|
4342
4347
|
text: 'Looking up the threat feed'
|
|
4343
4348
|
}).start();
|
|
4344
|
-
await fetchThreatFeed(input, spinner, apiKey);
|
|
4349
|
+
await fetchThreatFeed(input, spinner$1, apiKey);
|
|
4345
4350
|
}
|
|
4346
4351
|
}
|
|
4347
4352
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAGA,OAAO,iBAAiB,MAAM,wCAAwC,CAAA;AAGtE,KAAK,WAAW,GAAG,OAAO,iBAAiB,CAAC,GAAG,CAAA;AAE/C,KAAK,SAAS,GAAG;IACf,QAAQ,CAAC,UAAU,EAAE,2BAA2B,CAAA;IAChD,QAAQ,CAAC,aAAa,EAAE,gBAAgB,CAAA;IACxC,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAA;IAClC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAA;IACnB,QAAQ,CAAC,GAAG,EAAE,WAAW,GAAG;QAC1B,gCAAgC,EAAE,OAAO,CAAA;QACzC,gDAAgD,EAAE,OAAO,CAAA;KAC1D,CAAA;IACD,QAAQ,CAAC,SAAS,EAAE,aAAa,GAAG,SAAS,CAAA;IAC7C,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,gBAAgB,EAAE,4BAA4B,CAAA;IACvD,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAA;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,gCAAgC,EAAE,kCAAkC,CAAA;IAC7E,QAAQ,CAAC,qBAAqB,EAAE,gDAAgD,CAAA;IAChF,QAAQ,CAAC,gDAAgD,EAAE,kDAAkD,CAAA;IAC7G,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAA;IACnB,QAAQ,CAAC,UAAU,EAAE,YAAY,CAAA;IACjC,QAAQ,CAAC,YAAY,EAAE,cAAc,CAAA;IACrC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;IAChC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAC7B,GAAG,OAAO,iBAAiB,CAAA;AA+E5B,QAAA,MAAM,SAAS,WA6Cd,CAAA"}
|