mobbdev 1.0.40 → 1.0.43

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 +51 -31
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -842,6 +842,11 @@ var FixPageFixReportZ = z3.object({
842
842
  count: z3.number()
843
843
  })
844
844
  }),
845
+ fixableIssuesCount: z3.object({
846
+ aggregate: z3.object({
847
+ count: z3.number()
848
+ })
849
+ }),
845
850
  repo: z3.object({
846
851
  name: z3.string().nullable(),
847
852
  originalUrl: z3.string(),
@@ -1151,6 +1156,9 @@ var AnalysisReportDigestedZ = z7.object({
1151
1156
  });
1152
1157
  var ReportQueryResultZ = z7.object({
1153
1158
  fixReport_by_pk: z7.object({
1159
+ fixableIssuesCount: z7.object({
1160
+ aggregate: z7.object({ count: z7.number() })
1161
+ }),
1154
1162
  id: z7.string().uuid(),
1155
1163
  analysisUrl: z7.string(),
1156
1164
  fixesCommitted: z7.object({
@@ -1361,6 +1369,9 @@ var FixPageQueryZ = z7.object({
1361
1369
  var GetReportFixesQueryZ = z7.object({
1362
1370
  fixReport: z7.array(
1363
1371
  z7.object({
1372
+ fixableIssuesCount: z7.object({
1373
+ aggregate: z7.object({ count: z7.number() })
1374
+ }),
1364
1375
  fixes: z7.array(ReportFixesQueryFixZ),
1365
1376
  fixes_aggregate: z7.object({
1366
1377
  aggregate: z7.object({ count: z7.number() })
@@ -5737,7 +5748,6 @@ var GithubSCMLib = class extends SCMLib {
5737
5748
 
5738
5749
  // src/features/analysis/scm/gitlab/gitlab.ts
5739
5750
  import querystring3 from "node:querystring";
5740
- import { setTimeout as setTimeout4 } from "node:timers/promises";
5741
5751
  import {
5742
5752
  createRequesterFn
5743
5753
  } from "@gitbeaker/requester-utils";
@@ -5763,8 +5773,15 @@ var debug4 = Debug4("scm:gitlab");
5763
5773
  function removeTrailingSlash2(str) {
5764
5774
  return str.trim().replace(/\/+$/, "");
5765
5775
  }
5776
+ function getRandomGitlabCloudAnonToken() {
5777
+ if (!GITLAB_API_TOKEN || typeof GITLAB_API_TOKEN !== "string") {
5778
+ return void 0;
5779
+ }
5780
+ const tokens = GITLAB_API_TOKEN.split(",");
5781
+ return tokens[Math.floor(Math.random() * tokens.length)];
5782
+ }
5766
5783
  function getGitBeaker(options) {
5767
- const token = options?.gitlabAuthToken ?? GITLAB_API_TOKEN ?? "";
5784
+ const token = options?.gitlabAuthToken ?? getRandomGitlabCloudAnonToken() ?? "";
5768
5785
  const url = options.url;
5769
5786
  const host = url ? new URL(url).origin : "https://gitlab.com";
5770
5787
  if (token?.startsWith("glpat-") || token === "") {
@@ -6065,8 +6082,6 @@ async function processBody(response) {
6065
6082
  return await response.text();
6066
6083
  }
6067
6084
  async function brokerRequestHandler(endpoint, options) {
6068
- const retryCodes = [429, 502];
6069
- const maxRetries = 10;
6070
6085
  const { prefixUrl, searchParams } = options || {};
6071
6086
  let baseUrl;
6072
6087
  if (prefixUrl)
@@ -6079,32 +6094,24 @@ async function brokerRequestHandler(endpoint, options) {
6079
6094
  rejectUnauthorized: false
6080
6095
  }
6081
6096
  }) : void 0;
6082
- for (let i = 0; i < maxRetries; i += 1) {
6083
- const response = await undiciFetch(url, {
6084
- headers: options?.headers,
6085
- method: options?.method,
6086
- body: options?.body ? String(options?.body) : void 0,
6087
- dispatcher
6088
- }).catch((e) => {
6089
- if (e.name === "TimeoutError" || e.name === "AbortError") {
6090
- throw new Error("Query timeout was reached");
6091
- }
6092
- throw e;
6093
- });
6094
- if (response.ok)
6095
- return {
6096
- body: await processBody(response),
6097
- headers: Object.fromEntries(response.headers.entries()),
6098
- status: response.status
6099
- };
6100
- if (!retryCodes.includes(response.status))
6101
- throw new Error(`gitbeaker: ${response.statusText}`);
6102
- await setTimeout4(2 ** i * 0.25);
6103
- continue;
6104
- }
6105
- throw new Error(
6106
- `Could not successfully complete this request due to Error 429. Check the applicable rate limits for this endpoint.`
6107
- );
6097
+ const response = await undiciFetch(url, {
6098
+ headers: options?.headers,
6099
+ method: options?.method,
6100
+ body: options?.body ? String(options?.body) : void 0,
6101
+ dispatcher
6102
+ }).catch((e) => {
6103
+ if (e.name === "TimeoutError" || e.name === "AbortError") {
6104
+ throw new Error("Query timeout was reached");
6105
+ }
6106
+ throw e;
6107
+ });
6108
+ if (response.ok)
6109
+ return {
6110
+ body: await processBody(response),
6111
+ headers: Object.fromEntries(response.headers.entries()),
6112
+ status: response.status
6113
+ };
6114
+ throw new Error(`gitbeaker: ${response.statusText}`);
6108
6115
  }
6109
6116
 
6110
6117
  // src/features/analysis/scm/gitlab/GitlabSCMLib.ts
@@ -6437,8 +6444,15 @@ function getFetch(url) {
6437
6444
  }
6438
6445
  return fetch2;
6439
6446
  }
6447
+ function getRandomGithubCloudAnonToken() {
6448
+ if (!GITHUB_API_TOKEN || typeof GITHUB_API_TOKEN !== "string") {
6449
+ return void 0;
6450
+ }
6451
+ const tokens = GITHUB_API_TOKEN.split(",");
6452
+ return tokens[Math.floor(Math.random() * tokens.length)];
6453
+ }
6440
6454
  function getOctoKit(options) {
6441
- const token = !options?.auth && !isGithubOnPrem(options?.url) ? GITHUB_API_TOKEN : options?.auth;
6455
+ const token = !options?.auth && !isGithubOnPrem(options?.url) ? getRandomGithubCloudAnonToken() : options?.auth;
6442
6456
  const baseUrl = options?.url && isGithubOnPrem(options.url) ? `${new URL(options.url).origin}/api/v3` : void 0;
6443
6457
  return new Octokit({
6444
6458
  ...options,
@@ -6449,6 +6463,12 @@ function getOctoKit(options) {
6449
6463
  log: GITHUB_API_TOKEN ? console : void 0,
6450
6464
  request: {
6451
6465
  fetch: getFetch(baseUrl)
6466
+ },
6467
+ retry: {
6468
+ enabled: false
6469
+ },
6470
+ throttle: {
6471
+ enabled: false
6452
6472
  }
6453
6473
  });
6454
6474
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobbdev",
3
- "version": "1.0.40",
3
+ "version": "1.0.43",
4
4
  "description": "Automated secure code remediation tool",
5
5
  "repository": "git+https://github.com/mobb-dev/bugsy.git",
6
6
  "main": "dist/index.js",