socket 1.0.64 → 1.0.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.
Files changed (35) hide show
  1. package/dist/cli.js +180 -174
  2. package/dist/cli.js.map +1 -1
  3. package/dist/constants.js +18 -11
  4. package/dist/constants.js.map +1 -1
  5. package/dist/shadow-npm-inject.js +8 -11
  6. package/dist/shadow-npm-inject.js.map +1 -1
  7. package/dist/types/commands/config/cmd-config-auto.d.mts.map +1 -1
  8. package/dist/types/commands/config/cmd-config-get.d.mts.map +1 -1
  9. package/dist/types/commands/config/cmd-config-set.d.mts.map +1 -1
  10. package/dist/types/commands/config/cmd-config-unset.d.mts.map +1 -1
  11. package/dist/types/commands/config/discover-config-value.d.mts.map +1 -1
  12. package/dist/types/commands/config/output-config-list.d.mts.map +1 -1
  13. package/dist/types/commands/manifest/convert-conda-to-requirements.d.mts +1 -1
  14. package/dist/types/commands/manifest/convert-conda-to-requirements.d.mts.map +1 -1
  15. package/dist/types/commands/manifest/output-requirements.d.mts +1 -1
  16. package/dist/types/commands/manifest/output-requirements.d.mts.map +1 -1
  17. package/dist/types/commands/organization/output-security-policy.d.mts.map +1 -1
  18. package/dist/types/constants.d.mts.map +1 -1
  19. package/dist/types/shadow/npm/arborist-helpers.d.mts +1 -1
  20. package/dist/types/shadow/npm/arborist-helpers.d.mts.map +1 -1
  21. package/dist/types/utils/alerts-map.d.mts +1 -1
  22. package/dist/types/utils/alerts-map.d.mts.map +1 -1
  23. package/dist/types/utils/config.d.mts +4 -2
  24. package/dist/types/utils/config.d.mts.map +1 -1
  25. package/dist/types/utils/fs.d.mts +3 -1
  26. package/dist/types/utils/fs.d.mts.map +1 -1
  27. package/dist/types/utils/glob.d.mts.map +1 -1
  28. package/dist/utils.js +59 -46
  29. package/dist/utils.js.map +1 -1
  30. package/dist/vendor.js +3 -4
  31. package/external/@socketsecurity/registry/extensions.json +2 -2
  32. package/external/@socketsecurity/registry/external/@socketregistry/yocto-spinner.js +20 -11
  33. package/external/@socketsecurity/registry/lib/spinner.js +12 -18
  34. package/external/@socketsecurity/registry/manifest.json +7 -7
  35. package/package.json +7 -7
package/dist/cli.js CHANGED
@@ -14,12 +14,12 @@ var prompts = require('../external/@socketsecurity/registry/lib/prompts');
14
14
  var fs$1 = require('node:fs');
15
15
  var path = require('node:path');
16
16
  var spawn = require('../external/@socketsecurity/registry/lib/spawn');
17
+ var strings = require('../external/@socketsecurity/registry/lib/strings');
17
18
  var arrays = require('../external/@socketsecurity/registry/lib/arrays');
18
19
  var registry = require('../external/@socketsecurity/registry');
19
20
  var npm = require('../external/@socketsecurity/registry/lib/npm');
20
21
  var packages = require('../external/@socketsecurity/registry/lib/packages');
21
22
  var sorts = require('../external/@socketsecurity/registry/lib/sorts');
22
- var strings = require('../external/@socketsecurity/registry/lib/strings');
23
23
  var regexps = require('../external/@socketsecurity/registry/lib/regexps');
24
24
  var fs$2 = require('../external/@socketsecurity/registry/lib/fs');
25
25
  var shadowNpmInject = require('./shadow-npm-inject.js');
@@ -30,7 +30,6 @@ var require$$1 = require('node:util');
30
30
  var os = require('node:os');
31
31
  var promises = require('node:stream/promises');
32
32
 
33
- var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
34
33
  async function fetchOrgAnalyticsData(time) {
35
34
  const sockSdkCResult = await utils.setupSdk();
36
35
  if (!sockSdkCResult.ok) {
@@ -51,7 +50,7 @@ async function fetchRepoAnalyticsData(repo, time) {
51
50
 
52
51
  // Note: Widgets does not seem to actually work as code :'(
53
52
 
54
- const require$5 = require$$5.createRequire((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
53
+ const require$5 = require$$5.createRequire(require('node:url').pathToFileURL(__filename).href);
55
54
  const METRICS = ['total_critical_alerts', 'total_high_alerts', 'total_medium_alerts', 'total_low_alerts', 'total_critical_added', 'total_medium_added', 'total_low_added', 'total_high_added', 'total_critical_prevented', 'total_high_prevented', 'total_medium_prevented', 'total_low_prevented'];
56
55
 
57
56
  // Note: This maps `new Date(date).getMonth()` to English three letters
@@ -130,12 +129,12 @@ ${utils.mdTableStringNumber('Name', 'Counts', data['top_five_alert_types'])}
130
129
  `.trim() + '\n';
131
130
  }
132
131
  function displayAnalyticsScreen(data) {
133
- const ScreenWidget = require$5('../external/blessed/lib/widgets/screen.js');
132
+ const ScreenWidget = /*@__PURE__*/require$5('../external/blessed/lib/widgets/screen.js');
134
133
  // Lazily access constants.blessedOptions.
135
134
  const screen = new ScreenWidget({
136
135
  ...constants.blessedOptions
137
136
  });
138
- const GridLayout = require$5('../external/blessed-contrib/lib/layout/grid.js');
137
+ const GridLayout = /*@__PURE__*/require$5('../external/blessed-contrib/lib/layout/grid.js');
139
138
  const grid = new GridLayout({
140
139
  rows: 5,
141
140
  cols: 4,
@@ -149,7 +148,7 @@ function displayAnalyticsScreen(data) {
149
148
  renderLineCharts(grid, screen, 'Total high alerts prevented from the main branch', [2, 2, 1, 2], data['total_high_prevented']);
150
149
  renderLineCharts(grid, screen, 'Total medium alerts prevented from the main branch', [3, 0, 1, 2], data['total_medium_prevented']);
151
150
  renderLineCharts(grid, screen, 'Total low alerts prevented from the main branch', [3, 2, 1, 2], data['total_low_prevented']);
152
- const BarChart = require$5('../external/blessed-contrib/lib/widget/charts/bar.js');
151
+ const BarChart = /*@__PURE__*/require$5('../external/blessed-contrib/lib/widget/charts/bar.js');
153
152
  const bar = grid.set(4, 0, 1, 2, BarChart, {
154
153
  label: 'Top 5 alert types',
155
154
  barWidth: 10,
@@ -242,7 +241,7 @@ function formatDate(date) {
242
241
  return `${Months[new Date(date).getMonth()]} ${new Date(date).getDate()}`;
243
242
  }
244
243
  function renderLineCharts(grid, screen, title, coords, data) {
245
- const LineChart = require$5('../external/blessed-contrib/lib/widget/charts/line.js');
244
+ const LineChart = /*@__PURE__*/require$5('../external/blessed-contrib/lib/widget/charts/line.js');
246
245
  const line = grid.set(...coords, LineChart, {
247
246
  style: {
248
247
  line: 'cyan',
@@ -303,7 +302,7 @@ async function handleAnalytics({
303
302
  const {
304
303
  DRY_RUN_BAILING_NOW: DRY_RUN_BAILING_NOW$M
305
304
  } = constants;
306
- const config$P = {
305
+ const config$M = {
307
306
  commandName: 'analytics',
308
307
  description: `Look up analytics data`,
309
308
  hidden: false,
@@ -341,8 +340,8 @@ const config$P = {
341
340
  `
342
341
  };
343
342
  const cmdAnalytics = {
344
- description: config$P.description,
345
- hidden: config$P.hidden,
343
+ description: config$M.description,
344
+ hidden: config$M.hidden,
346
345
  run: run$P
347
346
  };
348
347
  async function run$P(argv, importMeta, {
@@ -350,7 +349,7 @@ async function run$P(argv, importMeta, {
350
349
  }) {
351
350
  const cli = utils.meowOrExit({
352
351
  argv,
353
- config: config$P,
352
+ config: config$M,
354
353
  importMeta,
355
354
  parentName
356
355
  });
@@ -471,7 +470,7 @@ async function fetchAuditLog({
471
470
  }), `audit log for ${orgSlug}`);
472
471
  }
473
472
 
474
- const require$4 = require$$5.createRequire((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
473
+ const require$4 = require$$5.createRequire(require('node:url').pathToFileURL(__filename).href);
475
474
  const {
476
475
  REDACTED
477
476
  } = constants;
@@ -603,7 +602,7 @@ async function outputWithBlessed(data, orgSlug) {
603
602
  const headers = [' Event id', ' Created at', ' Event type', ' User email', ' IP address', ' User agent'];
604
603
 
605
604
  // Note: this temporarily takes over the terminal (just like `man` does).
606
- const ScreenWidget = require$4('../external/blessed/lib/widgets/screen.js');
605
+ const ScreenWidget = /*@__PURE__*/require$4('../external/blessed/lib/widgets/screen.js');
607
606
  // Lazily access constants.blessedOptions.
608
607
  const screen = new ScreenWidget({
609
608
  ...constants.blessedOptions
@@ -613,7 +612,7 @@ async function outputWithBlessed(data, orgSlug) {
613
612
  // node process just to exit it. That's very bad UX.
614
613
  // eslint-disable-next-line n/no-process-exit
615
614
  screen.key(['escape', 'q', 'C-c'], () => process.exit(0));
616
- const TableWidget = require$4('../external/blessed-contrib/lib/widget/table.js');
615
+ const TableWidget = /*@__PURE__*/require$4('../external/blessed-contrib/lib/widget/table.js');
617
616
  const tipsBoxHeight = 1; // 1 row for tips box
618
617
  const detailsBoxHeight = 20; // bottom N rows for details box. 20 gives 4 lines for condensed payload before it scrolls out of view
619
618
 
@@ -643,7 +642,7 @@ async function outputWithBlessed(data, orgSlug) {
643
642
  columnSpacing: 4,
644
643
  truncate: '_'
645
644
  });
646
- const BoxWidget = require$4('../external/blessed/lib/widgets/box.js');
645
+ const BoxWidget = /*@__PURE__*/require$4('../external/blessed/lib/widgets/box.js');
647
646
  const tipsBox = new BoxWidget({
648
647
  bottom: detailsBoxHeight,
649
648
  // sits just above the details box
@@ -728,7 +727,7 @@ const {
728
727
  DRY_RUN_BAILING_NOW: DRY_RUN_BAILING_NOW$L,
729
728
  SOCKET_WEBSITE_URL: SOCKET_WEBSITE_URL$3
730
729
  } = constants;
731
- const config$O = {
730
+ const config$L = {
732
731
  commandName: 'audit-log',
733
732
  description: 'Look up the audit log for an organization',
734
733
  hidden: false,
@@ -786,8 +785,8 @@ const config$O = {
786
785
  `
787
786
  };
788
787
  const cmdAuditLog = {
789
- description: config$O.description,
790
- hidden: config$O.hidden,
788
+ description: config$L.description,
789
+ hidden: config$L.hidden,
791
790
  run: run$O
792
791
  };
793
792
  async function run$O(argv, importMeta, {
@@ -795,7 +794,7 @@ async function run$O(argv, importMeta, {
795
794
  }) {
796
795
  const cli = utils.meowOrExit({
797
796
  argv,
798
- config: config$O,
797
+ config: config$L,
799
798
  importMeta,
800
799
  parentName
801
800
  });
@@ -1465,7 +1464,7 @@ async function outputCreateNewScan(result, outputKind, interactive) {
1465
1464
  return;
1466
1465
  }
1467
1466
  if (!result.data.id) {
1468
- logger.logger.fail('Did not receive a scan ID from the API...');
1467
+ logger.logger.fail('Did not receive a scan ID from the API.');
1469
1468
  process.exitCode = 1;
1470
1469
  }
1471
1470
  if (outputKind === 'markdown') {
@@ -1745,20 +1744,23 @@ async function convertSbtToMaven({
1745
1744
  }
1746
1745
  }
1747
1746
 
1747
+ function prepareContent(content) {
1748
+ return strings.stripAnsi(content.trim());
1749
+ }
1748
1750
  async function convertCondaToRequirements(filename, cwd, verbose) {
1749
- let contents;
1751
+ let content;
1750
1752
  if (filename === '-') {
1751
1753
  if (verbose) {
1752
1754
  logger.logger.info(`[VERBOSE] reading input from stdin`);
1753
1755
  }
1754
- const buf = [];
1755
- contents = await new Promise((resolve, reject) => {
1756
+ const strings = [];
1757
+ content = await new Promise((resolve, reject) => {
1756
1758
  process.stdin.on('data', chunk => {
1757
1759
  const input = chunk.toString();
1758
- buf.push(input);
1760
+ strings.push(input);
1759
1761
  });
1760
1762
  process.stdin.on('end', () => {
1761
- resolve(buf.join(''));
1763
+ resolve(prepareContent(strings.join('')));
1762
1764
  });
1763
1765
  process.stdin.on('error', e => {
1764
1766
  if (verbose) {
@@ -1767,20 +1769,20 @@ async function convertCondaToRequirements(filename, cwd, verbose) {
1767
1769
  reject(e);
1768
1770
  });
1769
1771
  process.stdin.on('close', () => {
1770
- if (buf.length === 0) {
1772
+ if (strings.length) {
1771
1773
  if (verbose) {
1772
- logger.logger.error('stdin closed explicitly without data received');
1774
+ logger.logger.error('warning: stdin closed explicitly with some data received');
1773
1775
  }
1774
- reject(new Error('No data received from stdin'));
1776
+ resolve(prepareContent(strings.join('')));
1775
1777
  } else {
1776
1778
  if (verbose) {
1777
- logger.logger.error('warning: stdin closed explicitly with some data received');
1779
+ logger.logger.error('stdin closed explicitly without data received');
1778
1780
  }
1779
- resolve(buf.join(''));
1781
+ reject(new Error('No data received from stdin'));
1780
1782
  }
1781
1783
  });
1782
1784
  });
1783
- if (!contents) {
1785
+ if (!content) {
1784
1786
  return {
1785
1787
  ok: false,
1786
1788
  message: 'Manifest Generation Failed',
@@ -1799,8 +1801,8 @@ async function convertCondaToRequirements(filename, cwd, verbose) {
1799
1801
  cause: `The file was not found at ${filepath}`
1800
1802
  };
1801
1803
  }
1802
- contents = fs$1.readFileSync(filepath, 'utf8');
1803
- if (!contents) {
1804
+ content = fs$1.readFileSync(filepath, 'utf8');
1805
+ if (!content) {
1804
1806
  return {
1805
1807
  ok: false,
1806
1808
  message: 'Manifest Generation Failed',
@@ -1811,60 +1813,59 @@ async function convertCondaToRequirements(filename, cwd, verbose) {
1811
1813
  return {
1812
1814
  ok: true,
1813
1815
  data: {
1814
- contents,
1815
- pip: convertCondaToRequirementsFromInput(contents)
1816
+ content,
1817
+ pip: convertCondaToRequirementsFromInput(content)
1816
1818
  }
1817
1819
  };
1818
1820
  }
1819
1821
 
1820
1822
  // Just extract the first pip block, if one exists at all.
1821
1823
  function convertCondaToRequirementsFromInput(input) {
1822
- const keeping = [];
1823
1824
  let collecting = false;
1824
1825
  let delim = '-';
1825
1826
  let indent = '';
1826
- input.split('\n').some(line => {
1827
- if (!line) {
1828
- // Ignore empty lines
1829
- return;
1827
+ const keeping = [];
1828
+ for (const line of input.split('\n')) {
1829
+ const trimmed = line.trim();
1830
+ if (!trimmed) {
1831
+ // Ignore empty lines.
1832
+ continue;
1830
1833
  }
1831
1834
  if (collecting) {
1832
1835
  if (line.startsWith('#')) {
1833
- // Ignore comment lines (keep?)
1834
- return;
1836
+ // Ignore comment lines (keep?).
1837
+ continue;
1835
1838
  }
1836
1839
  if (line.startsWith(delim)) {
1837
1840
  // In this case we have a line with the same indentation as the
1838
1841
  // `- pip:` line, so we have reached the end of the pip block.
1839
- return true; // the end
1840
- } else {
1841
- if (!indent) {
1842
- // Store the indentation of the block
1843
- if (line.trim().startsWith('-')) {
1844
- indent = line.split('-')[0] + '-';
1845
- if (indent.length <= delim.length) {
1846
- // The first line after the `pip:` line does not indent further
1847
- // than that so the block is empty?
1848
- return true;
1849
- }
1842
+ break;
1843
+ }
1844
+ if (!indent) {
1845
+ // Store the indentation of the block.
1846
+ if (trimmed.startsWith('-')) {
1847
+ indent = line.split('-')[0] + '-';
1848
+ if (indent.length <= delim.length) {
1849
+ // The first line after the `pip:` line does not indent further
1850
+ // than that so the block is empty?
1851
+ break;
1850
1852
  }
1851
1853
  }
1852
- if (line.startsWith(indent)) {
1853
- keeping.push(line.slice(indent.length).trim());
1854
- } else {
1855
- // Unexpected input. bail.
1856
- return true;
1857
- }
1858
1854
  }
1859
- } else {
1860
- // Note: the line may end with a line comment so don't === it.
1861
- if (line.trim().startsWith('- pip:')) {
1862
- delim = line.split('-')[0] + '-';
1863
- collecting = true;
1855
+ if (line.startsWith(indent)) {
1856
+ keeping.push(line.slice(indent.length).trim());
1857
+ } else {
1858
+ // Unexpected input. bail.
1859
+ break;
1864
1860
  }
1865
1861
  }
1866
- });
1867
- return keeping.join('\n');
1862
+ // Note: the line may end with a line comment so don't === it.
1863
+ else if (trimmed.startsWith('- pip:')) {
1864
+ delim = line.split('-')[0] + '-';
1865
+ collecting = true;
1866
+ }
1867
+ }
1868
+ return prepareContent(keeping.join('\n'));
1868
1869
  }
1869
1870
 
1870
1871
  async function outputRequirements(result, outputKind, out) {
@@ -2113,7 +2114,7 @@ async function handleCI(autoManifest) {
2113
2114
  const {
2114
2115
  DRY_RUN_BAILING_NOW: DRY_RUN_BAILING_NOW$K
2115
2116
  } = constants;
2116
- const config$N = {
2117
+ const config$K = {
2117
2118
  commandName: 'ci',
2118
2119
  description: 'Create a new scan and report whether it passes your security policy',
2119
2120
  hidden: true,
@@ -2131,7 +2132,7 @@ const config$N = {
2131
2132
  $ ${command} [options]
2132
2133
 
2133
2134
  Options
2134
- ${utils.getFlagListOutput(config$N.flags)}
2135
+ ${utils.getFlagListOutput(config$K.flags)}
2135
2136
 
2136
2137
  This command is intended to use in CI runs to allow automated systems to
2137
2138
  accept or reject a current build. When the scan does not pass your security
@@ -2150,8 +2151,8 @@ const config$N = {
2150
2151
  `
2151
2152
  };
2152
2153
  const cmdCI = {
2153
- description: config$N.description,
2154
- hidden: config$N.hidden,
2154
+ description: config$K.description,
2155
+ hidden: config$K.hidden,
2155
2156
  run: run$N
2156
2157
  };
2157
2158
  async function run$N(argv, importMeta, {
@@ -2159,7 +2160,7 @@ async function run$N(argv, importMeta, {
2159
2160
  }) {
2160
2161
  const cli = utils.meowOrExit({
2161
2162
  argv,
2162
- config: config$N,
2163
+ config: config$K,
2163
2164
  importMeta,
2164
2165
  parentName
2165
2166
  });
@@ -2175,7 +2176,7 @@ async function discoverConfigValue(key) {
2175
2176
  // keys should request information from particular API endpoints while
2176
2177
  // others should simply return their default value, like endpoint URL.
2177
2178
 
2178
- if (!utils.supportedConfigKeys.has(key)) {
2179
+ if (key !== 'test' && !utils.isSupportedConfigKey(key)) {
2179
2180
  return {
2180
2181
  ok: false,
2181
2182
  message: 'Auto discover failed',
@@ -2410,49 +2411,43 @@ async function handleConfigAuto({
2410
2411
  const {
2411
2412
  DRY_RUN_BAILING_NOW: DRY_RUN_BAILING_NOW$J
2412
2413
  } = constants;
2413
- const config$M = {
2414
- commandName: 'auto',
2415
- description: 'Automatically discover and set the correct value config item',
2416
- hidden: false,
2417
- flags: {
2418
- ...utils.commonFlags,
2419
- ...utils.outputFlags
2420
- },
2421
- help: (command, config) => `
2414
+ const description$a = 'Automatically discover and set the correct value config item';
2415
+ const hidden$2 = false;
2416
+ const cmdConfigAuto = {
2417
+ description: description$a,
2418
+ hidden: hidden$2,
2419
+ run: run$M
2420
+ };
2421
+ async function run$M(argv, importMeta, {
2422
+ parentName
2423
+ }) {
2424
+ const config = {
2425
+ commandName: 'auto',
2426
+ description: description$a,
2427
+ hidden: hidden$2,
2428
+ flags: {
2429
+ ...utils.commonFlags,
2430
+ ...utils.outputFlags
2431
+ },
2432
+ help: (command, config) => `
2422
2433
  Usage
2423
2434
  $ ${command} [options] KEY
2424
2435
 
2425
2436
  Options
2426
2437
  ${utils.getFlagListOutput(config.flags)}
2427
2438
 
2428
- Attempt to automatically discover the correct value for given config KEY.
2429
-
2430
- Keys:
2431
-
2432
- ${Array.from(utils.supportedConfigKeys.entries()).map(([key, desc]) => ` - ${key} -- ${desc}`).join('\n')}
2433
-
2434
- For certain keys it will request the value from server, for others it will
2435
- reset the value to the default. For some keys this has no effect.
2436
-
2437
- Keys:
2438
-
2439
- ${Array.from(utils.supportedConfigKeys.entries()).map(([key, desc]) => ` - ${key} -- ${desc}`).join('\n')}
2439
+ Attempt to automatically discover the correct value for a given config KEY.
2440
2440
 
2441
2441
  Examples
2442
2442
  $ ${command} defaultOrg
2443
+
2444
+ Keys:
2445
+ ${utils.getSupportedConfigEntries().map(([key, desc]) => ` - ${key} -- ${desc}`).join('\n')}
2443
2446
  `
2444
- };
2445
- const cmdConfigAuto = {
2446
- description: config$M.description,
2447
- hidden: config$M.hidden,
2448
- run: run$M
2449
- };
2450
- async function run$M(argv, importMeta, {
2451
- parentName
2452
- }) {
2447
+ };
2453
2448
  const cli = utils.meowOrExit({
2454
2449
  argv,
2455
- config: config$M,
2450
+ config,
2456
2451
  importMeta,
2457
2452
  parentName
2458
2453
  });
@@ -2463,7 +2458,7 @@ async function run$M(argv, importMeta, {
2463
2458
  const [key = ''] = cli.input;
2464
2459
  const outputKind = utils.getOutputKind(json, markdown);
2465
2460
  const wasValidInput = utils.checkCommandInput(outputKind, {
2466
- test: utils.supportedConfigKeys.has(key) && key !== 'test',
2461
+ test: key !== 'test' && utils.isSupportedConfigKey(key),
2467
2462
  message: 'Config key should be the first arg',
2468
2463
  pass: 'ok',
2469
2464
  fail: key ? 'invalid config key' : 'missing'
@@ -2528,7 +2523,7 @@ async function handleConfigGet({
2528
2523
  const {
2529
2524
  DRY_RUN_BAILING_NOW: DRY_RUN_BAILING_NOW$I
2530
2525
  } = constants;
2531
- const config$L = {
2526
+ const config$J = {
2532
2527
  commandName: 'get',
2533
2528
  description: 'Get the value of a local CLI config item',
2534
2529
  hidden: false,
@@ -2548,15 +2543,15 @@ const config$L = {
2548
2543
 
2549
2544
  KEY is an enum. Valid keys:
2550
2545
 
2551
- ${Array.from(utils.supportedConfigKeys.entries()).map(([key, desc]) => ` - ${key} -- ${desc}`).join('\n')}
2546
+ ${utils.getSupportedConfigEntries().map(([key, desc]) => ` - ${key} -- ${desc}`).join('\n')}
2552
2547
 
2553
2548
  Examples
2554
2549
  $ ${command} defaultOrg
2555
2550
  `
2556
2551
  };
2557
2552
  const cmdConfigGet = {
2558
- description: config$L.description,
2559
- hidden: config$L.hidden,
2553
+ description: config$J.description,
2554
+ hidden: config$J.hidden,
2560
2555
  run: run$L
2561
2556
  };
2562
2557
  async function run$L(argv, importMeta, {
@@ -2564,7 +2559,7 @@ async function run$L(argv, importMeta, {
2564
2559
  }) {
2565
2560
  const cli = utils.meowOrExit({
2566
2561
  argv,
2567
- config: config$L,
2562
+ config: config$J,
2568
2563
  importMeta,
2569
2564
  parentName
2570
2565
  });
@@ -2575,7 +2570,7 @@ async function run$L(argv, importMeta, {
2575
2570
  const [key = ''] = cli.input;
2576
2571
  const outputKind = utils.getOutputKind(json, markdown);
2577
2572
  const wasValidInput = utils.checkCommandInput(outputKind, {
2578
- test: utils.supportedConfigKeys.has(key) || key === 'test',
2573
+ test: key === 'test' || utils.isSupportedConfigKey(key),
2579
2574
  message: 'Config key should be the first arg',
2580
2575
  pass: 'ok',
2581
2576
  fail: key ? 'invalid config key' : 'missing'
@@ -2604,16 +2599,17 @@ async function outputConfigList({
2604
2599
  outputKind
2605
2600
  }) {
2606
2601
  const readOnly = utils.isReadOnlyConfig();
2602
+ const supportedConfigKeys = utils.getSupportedConfigKeys();
2607
2603
  if (outputKind === 'json') {
2608
2604
  let failed = false;
2609
2605
  const obj = {};
2610
- for (const key of utils.supportedConfigKeys.keys()) {
2606
+ for (const key of supportedConfigKeys) {
2611
2607
  const result = utils.getConfigValue(key);
2612
2608
  let value = result.data;
2613
2609
  if (!result.ok) {
2614
2610
  value = `Failed to retrieve: ${result.message}`;
2615
2611
  failed = true;
2616
- } else if (!full && utils.sensitiveConfigKeys.has(key)) {
2612
+ } else if (!full && utils.isSensitiveConfigKey(key)) {
2617
2613
  value = '********';
2618
2614
  }
2619
2615
  if (full || value !== undefined) {
@@ -2640,18 +2636,18 @@ async function outputConfigList({
2640
2636
  }
2641
2637
  }));
2642
2638
  } else {
2643
- const maxWidth = Array.from(utils.supportedConfigKeys.keys()).reduce((a, b) => Math.max(a, b.length), 0);
2639
+ const maxWidth = supportedConfigKeys.reduce((a, b) => Math.max(a, b.length), 0);
2644
2640
  logger.logger.log('# Local CLI Config');
2645
2641
  logger.logger.log('');
2646
2642
  logger.logger.log(`This is the local CLI config (full=${!!full}):`);
2647
2643
  logger.logger.log('');
2648
- for (const key of utils.supportedConfigKeys.keys()) {
2644
+ for (const key of supportedConfigKeys) {
2649
2645
  const result = utils.getConfigValue(key);
2650
2646
  if (!result.ok) {
2651
2647
  logger.logger.log(`- ${key}: failed to read: ${result.message}`);
2652
2648
  } else {
2653
2649
  let value = result.data;
2654
- if (!full && utils.sensitiveConfigKeys.has(key)) {
2650
+ if (!full && utils.isSensitiveConfigKey(key)) {
2655
2651
  value = '********';
2656
2652
  }
2657
2653
  if (full || value !== undefined) {
@@ -2669,7 +2665,7 @@ async function outputConfigList({
2669
2665
  const {
2670
2666
  DRY_RUN_BAILING_NOW: DRY_RUN_BAILING_NOW$H
2671
2667
  } = constants;
2672
- const config$K = {
2668
+ const config$I = {
2673
2669
  commandName: 'list',
2674
2670
  description: 'Show all local CLI config items and their values',
2675
2671
  hidden: false,
@@ -2694,8 +2690,8 @@ const config$K = {
2694
2690
  `
2695
2691
  };
2696
2692
  const cmdConfigList = {
2697
- description: config$K.description,
2698
- hidden: config$K.hidden,
2693
+ description: config$I.description,
2694
+ hidden: config$I.hidden,
2699
2695
  run: run$K
2700
2696
  };
2701
2697
  async function run$K(argv, importMeta, {
@@ -2703,7 +2699,7 @@ async function run$K(argv, importMeta, {
2703
2699
  }) {
2704
2700
  const cli = utils.meowOrExit({
2705
2701
  argv,
2706
- config: config$K,
2702
+ config: config$I,
2707
2703
  importMeta,
2708
2704
  parentName
2709
2705
  });
@@ -2775,15 +2771,25 @@ async function handleConfigSet({
2775
2771
  const {
2776
2772
  DRY_RUN_BAILING_NOW: DRY_RUN_BAILING_NOW$G
2777
2773
  } = constants;
2778
- const config$J = {
2779
- commandName: 'set',
2780
- description: 'Update the value of a local CLI config item',
2781
- hidden: false,
2782
- flags: {
2783
- ...utils.commonFlags,
2784
- ...utils.outputFlags
2785
- },
2786
- help: (command, config) => `
2774
+ const description$9 = 'Update the value of a local CLI config item';
2775
+ const hidden$1 = false;
2776
+ const cmdConfigSet = {
2777
+ description: description$9,
2778
+ hidden: hidden$1,
2779
+ run: run$J
2780
+ };
2781
+ async function run$J(argv, importMeta, {
2782
+ parentName
2783
+ }) {
2784
+ const config = {
2785
+ commandName: 'set',
2786
+ description: description$9,
2787
+ hidden: hidden$1,
2788
+ flags: {
2789
+ ...utils.commonFlags,
2790
+ ...utils.outputFlags
2791
+ },
2792
+ help: (command, config) => `
2787
2793
  Usage
2788
2794
  $ ${command} [options] <KEY> <VALUE>
2789
2795
 
@@ -2801,23 +2807,15 @@ const config$J = {
2801
2807
 
2802
2808
  Keys:
2803
2809
 
2804
- ${Array.from(utils.supportedConfigKeys.entries()).map(([key, desc]) => ` - ${key} -- ${desc}`).join('\n')}
2810
+ ${utils.getSupportedConfigEntries().map(([key, desc]) => ` - ${key} -- ${desc}`).join('\n')}
2805
2811
 
2806
2812
  Examples
2807
2813
  $ ${command} apiProxy https://example.com
2808
2814
  `
2809
- };
2810
- const cmdConfigSet = {
2811
- description: config$J.description,
2812
- hidden: config$J.hidden,
2813
- run: run$J
2814
- };
2815
- async function run$J(argv, importMeta, {
2816
- parentName
2817
- }) {
2815
+ };
2818
2816
  const cli = utils.meowOrExit({
2819
2817
  argv,
2820
- config: config$J,
2818
+ config,
2821
2819
  importMeta,
2822
2820
  parentName
2823
2821
  });
@@ -2829,7 +2827,7 @@ async function run$J(argv, importMeta, {
2829
2827
  const value = rest.join(' ');
2830
2828
  const outputKind = utils.getOutputKind(json, markdown);
2831
2829
  const wasValidInput = utils.checkCommandInput(outputKind, {
2832
- test: key === 'test' || utils.supportedConfigKeys.has(key),
2830
+ test: key === 'test' || utils.isSupportedConfigKey(key),
2833
2831
  message: 'Config key should be the first arg',
2834
2832
  pass: 'ok',
2835
2833
  fail: key ? 'invalid config key' : 'missing'
@@ -2901,15 +2899,25 @@ async function handleConfigUnset({
2901
2899
  const {
2902
2900
  DRY_RUN_BAILING_NOW: DRY_RUN_BAILING_NOW$F
2903
2901
  } = constants;
2904
- const config$I = {
2905
- commandName: 'unset',
2906
- description: 'Clear the value of a local CLI config item',
2907
- hidden: false,
2908
- flags: {
2909
- ...utils.commonFlags,
2910
- ...utils.outputFlags
2911
- },
2912
- help: (command, config) => `
2902
+ const description$8 = 'Clear the value of a local CLI config item';
2903
+ const hidden = false;
2904
+ const cmdConfigUnset = {
2905
+ description: description$8,
2906
+ hidden,
2907
+ run: run$I
2908
+ };
2909
+ async function run$I(argv, importMeta, {
2910
+ parentName
2911
+ }) {
2912
+ const config = {
2913
+ commandName: 'unset',
2914
+ description: description$8,
2915
+ hidden,
2916
+ flags: {
2917
+ ...utils.commonFlags,
2918
+ ...utils.outputFlags
2919
+ },
2920
+ help: (command, config) => `
2913
2921
  Usage
2914
2922
  $ ${command} [options] <KEY> <VALUE>
2915
2923
 
@@ -2921,23 +2929,15 @@ const config$I = {
2921
2929
 
2922
2930
  Keys:
2923
2931
 
2924
- ${Array.from(utils.supportedConfigKeys.entries()).map(([key, desc]) => ` - ${key} -- ${desc}`).join('\n')}
2932
+ ${utils.getSupportedConfigEntries().map(([key, desc]) => ` - ${key} -- ${desc}`).join('\n')}
2925
2933
 
2926
2934
  Examples
2927
2935
  $ ${command} defaultOrg
2928
2936
  `
2929
- };
2930
- const cmdConfigUnset = {
2931
- description: config$I.description,
2932
- hidden: config$I.hidden,
2933
- run: run$I
2934
- };
2935
- async function run$I(argv, importMeta, {
2936
- parentName
2937
- }) {
2937
+ };
2938
2938
  const cli = utils.meowOrExit({
2939
2939
  argv,
2940
- config: config$I,
2940
+ config,
2941
2941
  importMeta,
2942
2942
  parentName
2943
2943
  });
@@ -2948,7 +2948,7 @@ async function run$I(argv, importMeta, {
2948
2948
  const [key = ''] = cli.input;
2949
2949
  const outputKind = utils.getOutputKind(json, markdown);
2950
2950
  const wasValidInput = utils.checkCommandInput(outputKind, {
2951
- test: key === 'test' || utils.supportedConfigKeys.has(key),
2951
+ test: key === 'test' || utils.isSupportedConfigKey(key),
2952
2952
  message: 'Config key should be the first arg',
2953
2953
  pass: 'ok',
2954
2954
  fail: key ? 'invalid config key' : 'missing'
@@ -4819,7 +4819,7 @@ async function setupTabCompletion(targetName) {
4819
4819
  };
4820
4820
  }
4821
4821
  function getTabCompletionScriptRaw() {
4822
- const sourceDir = path.dirname(require$$0.fileURLToPath((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href))));
4822
+ const sourceDir = path.dirname(require$$0.fileURLToPath(require('node:url').pathToFileURL(__filename).href));
4823
4823
  const sourcePath = path.join(sourceDir, 'socket-completion.bash');
4824
4824
  if (!fs$1.existsSync(sourcePath)) {
4825
4825
  return {
@@ -6847,7 +6847,7 @@ async function run$v(argv, importMeta, {
6847
6847
  });
6848
6848
  }
6849
6849
 
6850
- const require$3 = require$$5.createRequire((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
6850
+ const require$3 = require$$5.createRequire(require('node:url').pathToFileURL(__filename).href);
6851
6851
  const {
6852
6852
  DRY_RUN_BAILING_NOW: DRY_RUN_BAILING_NOW$u
6853
6853
  } = constants;
@@ -6896,11 +6896,11 @@ async function run$u(argv, importMeta, {
6896
6896
  }
6897
6897
 
6898
6898
  // Lazily access constants.shadowNpmBinPath.
6899
- const shadowBin = require$3(constants.shadowNpmBinPath);
6899
+ const shadowBin = /*@__PURE__*/require$3(constants.shadowNpmBinPath);
6900
6900
  await shadowBin('npm', argv);
6901
6901
  }
6902
6902
 
6903
- const require$2 = require$$5.createRequire((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
6903
+ const require$2 = require$$5.createRequire(require('node:url').pathToFileURL(__filename).href);
6904
6904
  const {
6905
6905
  DRY_RUN_BAILING_NOW: DRY_RUN_BAILING_NOW$t
6906
6906
  } = constants;
@@ -6949,7 +6949,7 @@ async function run$t(argv, importMeta, {
6949
6949
  }
6950
6950
 
6951
6951
  // Lazily access constants.shadowNpmBinPath.
6952
- const shadowBin = require$2(constants.shadowNpmBinPath);
6952
+ const shadowBin = /*@__PURE__*/require$2(constants.shadowNpmBinPath);
6953
6953
  await shadowBin('npx', argv);
6954
6954
  }
6955
6955
 
@@ -8096,7 +8096,10 @@ async function outputLicensePolicy(result, outputKind) {
8096
8096
  logger.logger.log('');
8097
8097
  const rules = result.data['license_policy'];
8098
8098
  const entries = rules ? Object.entries(rules) : [];
8099
- const mapped = entries.map(([key, value]) => [key, value?.['allowed'] ? ' yes' : ' no']);
8099
+ const mapped = entries.map(({
8100
+ 0: key,
8101
+ 1: value
8102
+ }) => [key, value?.['allowed'] ? ' yes' : ' no']);
8100
8103
  mapped.sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
8101
8104
  logger.logger.log(utils.mdTableOfPairs(mapped, ['License Name', 'Allowed']));
8102
8105
  logger.logger.log('');
@@ -8222,7 +8225,10 @@ async function outputSecurityPolicy(result, outputKind) {
8222
8225
  logger.logger.log('');
8223
8226
  const rules = result.data.securityPolicyRules;
8224
8227
  const entries = rules ? Object.entries(rules) : [];
8225
- const mapped = entries.map(([key, value]) => [key, value.action]);
8228
+ const mapped = entries.map(({
8229
+ 0: key,
8230
+ 1: value
8231
+ }) => [key, value.action]);
8226
8232
  mapped.sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
8227
8233
  logger.logger.log(utils.mdTableOfPairs(mapped, ['name', 'action']));
8228
8234
  logger.logger.log('');
@@ -13361,7 +13367,7 @@ async function fetchThreatFeed({
13361
13367
  return await utils.queryApiSafeJson(`orgs/${orgSlug}/threat-feed?${queryParams}`, 'the Threat Feed data');
13362
13368
  }
13363
13369
 
13364
- const require$1 = require$$5.createRequire((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
13370
+ const require$1 = require$$5.createRequire(require('node:url').pathToFileURL(__filename).href);
13365
13371
  async function outputThreatFeed(result, outputKind) {
13366
13372
  if (!result.ok) {
13367
13373
  process.exitCode = result.code ?? 1;
@@ -13382,7 +13388,7 @@ async function outputThreatFeed(result, outputKind) {
13382
13388
  const descriptions = result.data.results.map(d => d.description);
13383
13389
 
13384
13390
  // Note: this temporarily takes over the terminal (just like `man` does).
13385
- const ScreenWidget = require$1('../external/blessed/lib/widgets/screen.js');
13391
+ const ScreenWidget = /*@__PURE__*/require$1('../external/blessed/lib/widgets/screen.js');
13386
13392
  // Lazily access constants.blessedOptions.
13387
13393
  const screen = new ScreenWidget({
13388
13394
  ...constants.blessedOptions
@@ -13392,7 +13398,7 @@ async function outputThreatFeed(result, outputKind) {
13392
13398
  // node process just to exit it. That's very bad UX.
13393
13399
  // eslint-disable-next-line n/no-process-exit
13394
13400
  screen.key(['escape', 'q', 'C-c'], () => process.exit(0));
13395
- const TableWidget = require$1('../external/blessed-contrib/lib/widget/table.js');
13401
+ const TableWidget = /*@__PURE__*/require$1('../external/blessed-contrib/lib/widget/table.js');
13396
13402
  const detailsBoxHeight = 20; // bottom N rows for details box
13397
13403
  const tipsBoxHeight = 1; // 1 row for tips box
13398
13404
 
@@ -13416,7 +13422,7 @@ async function outputThreatFeed(result, outputKind) {
13416
13422
  columnSpacing: 1,
13417
13423
  truncate: '_'
13418
13424
  });
13419
- const BoxWidget = require$1('../external/blessed/lib/widgets/box.js');
13425
+ const BoxWidget = /*@__PURE__*/require$1('../external/blessed/lib/widgets/box.js');
13420
13426
  const tipsBox = new BoxWidget({
13421
13427
  bottom: detailsBoxHeight,
13422
13428
  // sits just above the details box
@@ -14143,7 +14149,7 @@ async function run(argv, importMeta, {
14143
14149
  }
14144
14150
  }
14145
14151
 
14146
- const __filename$1 = require$$0.fileURLToPath((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
14152
+ const __filename$1 = require$$0.fileURLToPath(require('node:url').pathToFileURL(__filename).href);
14147
14153
  const {
14148
14154
  SOCKET_CLI_BIN_NAME
14149
14155
  } = constants;
@@ -14339,5 +14345,5 @@ void (async () => {
14339
14345
  await utils.captureException(e);
14340
14346
  }
14341
14347
  })();
14342
- //# debugId=9f81fe97-c2db-4ad9-9cf7-ae11682e5f3c
14348
+ //# debugId=6c157721-65fa-49fb-ac36-a3c9bac032c6
14343
14349
  //# sourceMappingURL=cli.js.map