mobbdev 0.0.108 → 0.0.110

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 (2) hide show
  1. package/dist/index.mjs +26 -13
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -360,9 +360,16 @@ var SubmitVulnerabilityReportDocument = `
360
360
  var CreateCommunityUserDocument = `
361
361
  mutation CreateCommunityUser {
362
362
  initOrganizationAndProject {
363
- userId
364
- projectId
365
- organizationId
363
+ __typename
364
+ ... on InitOrganizationAndProjectGoodResponse {
365
+ projectId
366
+ userId
367
+ organizationId
368
+ }
369
+ ... on UserAlreadyInProjectError {
370
+ error
371
+ status
372
+ }
366
373
  }
367
374
  }
368
375
  `;
@@ -3613,6 +3620,16 @@ async function sendReport({
3613
3620
  }
3614
3621
  }
3615
3622
 
3623
+ // src/features/analysis/utils/index.ts
3624
+ function getFromArraySafe(array) {
3625
+ return array.reduce((acc, nullableItem) => {
3626
+ if (nullableItem) {
3627
+ acc.push(nullableItem);
3628
+ }
3629
+ return acc;
3630
+ }, []);
3631
+ }
3632
+
3616
3633
  // src/features/analysis/handle_finished_analysis.ts
3617
3634
  var debug5 = Debug5("mobbdev:handle-finished-analysis");
3618
3635
  var contactUsMarkdown = `For specific requests [contact us](https://mobb.ai/contact) and we'll do the most to answer your need quickly.`;
@@ -4456,12 +4473,10 @@ async function _scan(params, { skipPrompts = false } = {}) {
4456
4473
  throw new Error("repo is required in case srcPath is not provided");
4457
4474
  }
4458
4475
  const userInfo = await gqlClient.getUserInfo();
4459
- const scmConfigs = [];
4460
- for (const scmConfig of userInfo?.scmConfigs || []) {
4461
- if (scmConfig?.__typename === "ScmConfig") {
4462
- scmConfigs.push(scmConfig);
4463
- }
4476
+ if (!userInfo) {
4477
+ throw new Error("userInfo is null");
4464
4478
  }
4479
+ const scmConfigs = getFromArraySafe(userInfo.scmConfigs);
4465
4480
  const tokenInfo = getScmConfig({
4466
4481
  url: repo,
4467
4482
  scmConfigs,
@@ -4693,12 +4708,10 @@ async function _scan(params, { skipPrompts = false } = {}) {
4693
4708
  await open2(scmAuthUrl2);
4694
4709
  for (let i = 0; i < LOGIN_MAX_WAIT / LOGIN_CHECK_DELAY; i++) {
4695
4710
  const userInfo2 = await gqlClient.getUserInfo();
4696
- const scmConfigs2 = [];
4697
- for (const scmConfig of userInfo2?.scmConfigs || []) {
4698
- if (scmConfig?.__typename === "ScmConfig") {
4699
- scmConfigs2.push(scmConfig);
4700
- }
4711
+ if (!userInfo2) {
4712
+ throw new CliError2("User info not found");
4701
4713
  }
4714
+ const scmConfigs2 = getFromArraySafe(userInfo2.scmConfigs);
4702
4715
  const tokenInfo2 = getScmConfig({
4703
4716
  url: repoUrl,
4704
4717
  scmConfigs: scmConfigs2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobbdev",
3
- "version": "0.0.108",
3
+ "version": "0.0.110",
4
4
  "description": "Automated secure code remediation tool",
5
5
  "repository": "https://github.com/mobb-dev/bugsy",
6
6
  "main": "dist/index.js",