mobbdev 0.0.167 → 0.0.168
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/index.mjs +72 -36
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4042,10 +4042,17 @@ function getGithubSdk(parmas = {}) {
|
|
|
4042
4042
|
|
|
4043
4043
|
// src/features/analysis/scm/gitlab/gitlab.ts
|
|
4044
4044
|
import querystring2 from "node:querystring";
|
|
4045
|
+
import { setTimeout as setTimeout2 } from "node:timers/promises";
|
|
4046
|
+
import {
|
|
4047
|
+
createRequesterFn
|
|
4048
|
+
} from "@gitbeaker/requester-utils";
|
|
4045
4049
|
import {
|
|
4046
4050
|
Gitlab
|
|
4047
4051
|
} from "@gitbeaker/rest";
|
|
4048
|
-
import {
|
|
4052
|
+
import {
|
|
4053
|
+
fetch as undiciFetch,
|
|
4054
|
+
ProxyAgent as ProxyAgent2
|
|
4055
|
+
} from "undici";
|
|
4049
4056
|
|
|
4050
4057
|
// src/features/analysis/scm/gitlab/types.ts
|
|
4051
4058
|
import { z as z12 } from "zod";
|
|
@@ -4065,9 +4072,23 @@ function getGitBeaker(options) {
|
|
|
4065
4072
|
const url = options.url;
|
|
4066
4073
|
const host = url ? new URL(url).origin : "https://gitlab.com";
|
|
4067
4074
|
if (token?.startsWith("glpat-") || token === "") {
|
|
4068
|
-
return new Gitlab({
|
|
4075
|
+
return new Gitlab({
|
|
4076
|
+
token,
|
|
4077
|
+
host,
|
|
4078
|
+
requesterFn: createRequesterFn(
|
|
4079
|
+
(_, reqo) => Promise.resolve(reqo),
|
|
4080
|
+
brokerRequestHandler
|
|
4081
|
+
)
|
|
4082
|
+
});
|
|
4069
4083
|
}
|
|
4070
|
-
return new Gitlab({
|
|
4084
|
+
return new Gitlab({
|
|
4085
|
+
oauthToken: token,
|
|
4086
|
+
host,
|
|
4087
|
+
requesterFn: createRequesterFn(
|
|
4088
|
+
(_, reqo) => Promise.resolve(reqo),
|
|
4089
|
+
brokerRequestHandler
|
|
4090
|
+
)
|
|
4091
|
+
});
|
|
4071
4092
|
}
|
|
4072
4093
|
async function gitlabValidateParams({
|
|
4073
4094
|
url,
|
|
@@ -4317,41 +4338,56 @@ async function getGitlabBlameRanges({ ref, gitlabUrl, path: path9 }, options) {
|
|
|
4317
4338
|
};
|
|
4318
4339
|
});
|
|
4319
4340
|
}
|
|
4320
|
-
function
|
|
4321
|
-
|
|
4322
|
-
const
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4341
|
+
async function processBody(response) {
|
|
4342
|
+
const headers = response.headers;
|
|
4343
|
+
const type2 = headers.get("content-type")?.split(";")[0]?.trim();
|
|
4344
|
+
if (type2 === "application/json") {
|
|
4345
|
+
return await response.json();
|
|
4346
|
+
}
|
|
4347
|
+
return await response.text();
|
|
4348
|
+
}
|
|
4349
|
+
async function brokerRequestHandler(endpoint, options) {
|
|
4350
|
+
const retryCodes = [429, 502];
|
|
4351
|
+
const maxRetries = 10;
|
|
4352
|
+
const { prefixUrl, searchParams } = options || {};
|
|
4353
|
+
let baseUrl;
|
|
4354
|
+
if (prefixUrl)
|
|
4355
|
+
baseUrl = prefixUrl.endsWith("/") ? prefixUrl : `${prefixUrl}/`;
|
|
4356
|
+
const url = new URL(endpoint, baseUrl);
|
|
4357
|
+
url.search = searchParams || "";
|
|
4358
|
+
const dispatcher = url && isBrokerUrl(url.href) ? new ProxyAgent2({
|
|
4359
|
+
uri: GIT_PROXY_HOST,
|
|
4360
|
+
requestTls: {
|
|
4361
|
+
rejectUnauthorized: false
|
|
4362
|
+
}
|
|
4363
|
+
}) : void 0;
|
|
4364
|
+
for (let i = 0; i < maxRetries; i += 1) {
|
|
4365
|
+
const response = await undiciFetch(url, {
|
|
4366
|
+
headers: options?.headers,
|
|
4367
|
+
method: options?.method,
|
|
4368
|
+
body: options?.body ? String(options?.body) : void 0,
|
|
4369
|
+
dispatcher
|
|
4370
|
+
}).catch((e) => {
|
|
4371
|
+
if (e.name === "TimeoutError" || e.name === "AbortError") {
|
|
4372
|
+
throw new Error("Query timeout was reached");
|
|
4373
|
+
}
|
|
4374
|
+
throw e;
|
|
4375
|
+
});
|
|
4376
|
+
if (response.ok)
|
|
4377
|
+
return {
|
|
4378
|
+
body: await processBody(response),
|
|
4379
|
+
headers: Object.fromEntries(response.headers.entries()),
|
|
4380
|
+
status: response.status
|
|
4381
|
+
};
|
|
4382
|
+
if (!retryCodes.includes(response.status))
|
|
4383
|
+
throw new Error(`gitbeaker: ${response.statusText}`);
|
|
4384
|
+
await setTimeout2(2 ** i * 0.25);
|
|
4385
|
+
continue;
|
|
4350
4386
|
}
|
|
4351
|
-
|
|
4352
|
-
|
|
4387
|
+
throw new Error(
|
|
4388
|
+
`Could not successfully complete this request due to Error 429. Check the applicable rate limits for this endpoint.`
|
|
4389
|
+
);
|
|
4353
4390
|
}
|
|
4354
|
-
initGitlabFetchMock();
|
|
4355
4391
|
|
|
4356
4392
|
// src/features/analysis/scm/scmSubmit/index.ts
|
|
4357
4393
|
import fs from "node:fs/promises";
|