renovate 44.70.0 → 44.70.2

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.
@@ -60,7 +60,7 @@ function prepareError(err) {
60
60
  }
61
61
  if (err instanceof RequestError) {
62
62
  const options = {
63
- headers: structuredClone(err.options.headers),
63
+ headers: structuredClone({ ...err.options.headers }),
64
64
  url: err.options.url?.toString(),
65
65
  hostType: err.options.context.hostType
66
66
  };
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":["HttpError"],"sources":["../../lib/logger/utils.ts"],"sourcesContent":["import {\n isArray,\n isBuffer,\n isDate,\n isEmptyObject,\n isError,\n isFunction,\n isNonEmptyObject,\n isNonEmptyStringAndNotWhitespace,\n isObject,\n isPlainObject,\n isString,\n} from '@sindresorhus/is';\nimport { RequestError as HttpError } from 'got';\nimport { DateTime } from 'luxon';\nimport { ZodError } from 'zod/v4';\nimport { ExecError } from '../util/exec/exec-error.ts';\nimport { regEx } from '../util/regex.ts';\nimport { redactedFields, sanitize } from '../util/sanitize.ts';\n\nconst contentFields = [\n 'content',\n 'contents',\n 'packageLockParsed',\n 'yarnLockParsed',\n];\n\ntype ZodShortenedIssue =\n | null\n | string\n | string[]\n | {\n [key: string]: ZodShortenedIssue;\n };\n\nexport function prepareZodIssues(input: unknown): ZodShortenedIssue {\n if (!isPlainObject(input)) {\n return null;\n }\n\n let err: null | string | string[] = null;\n // v8 ignore else -- TODO: add test #40625\n if (isArray(input._errors, isString)) {\n if (input._errors.length === 1) {\n err = input._errors[0];\n } else if (input._errors.length > 1) {\n err = input._errors;\n } else {\n err = null;\n }\n }\n delete input._errors;\n\n if (isEmptyObject(input)) {\n return err;\n }\n\n const output: Record<string, ZodShortenedIssue> = {};\n const entries = Object.entries(input);\n for (const [key, value] of entries.slice(0, 3)) {\n const child = prepareZodIssues(value);\n // v8 ignore else -- TODO: add test #40625\n if (child !== null) {\n output[key] = child;\n }\n }\n\n if (entries.length > 3) {\n output.___ = `... ${entries.length - 3} more`;\n }\n\n return output;\n}\n\nexport function prepareZodError(err: ZodError): Record<string, unknown> {\n Object.defineProperty(err, 'message', {\n get: () => 'Schema error',\n /* v8 ignore start -- TODO: drop set? */\n set: () => {\n /* intentionally empty */\n },\n // v8 ignore stop -- TODO: drop set? */\n });\n\n return {\n message: err.message,\n stack: err.stack,\n issues: prepareZodIssues(err.format()),\n };\n}\n\nexport default function prepareError(err: Error): Record<string, unknown> {\n if (err instanceof ZodError) {\n return prepareZodError(err);\n }\n\n const response: Record<string, unknown> = {\n // We want to loose class information, but keep enumerable properties of the error\n // oxlint-disable-next-line typescript/no-misused-spread\n ...err,\n };\n\n // Required as message is non-enumerable\n if (!response.message && err.message) {\n response.message = err.message;\n }\n\n // Required as stack is non-enumerable\n if (!response.stack && err.stack) {\n response.stack = err.stack;\n }\n\n if (err instanceof AggregateError) {\n response.errors = err.errors.map((error) => prepareError(error));\n }\n\n // handle rawExec error\n if (err instanceof ExecError && isNonEmptyObject(err.options?.env)) {\n const env = Object.keys(err.options.env);\n response.options = { ...err.options, env };\n }\n\n // handle got error\n if (err instanceof HttpError) {\n const options: Record<string, unknown> = {\n headers: structuredClone(err.options.headers),\n url: err.options.url?.toString(),\n hostType: err.options.context.hostType,\n };\n response.options = options;\n\n options.username = err.options.username;\n options.password = err.options.password;\n options.method = err.options.method;\n options.http2 = err.options.http2;\n\n // v8 ignore else -- TODO: add test #40625\n if (err.response) {\n response.response = {\n statusCode: err.response.statusCode,\n statusMessage: err.response.statusMessage,\n body:\n err.name === 'TimeoutError'\n ? undefined\n : structuredClone(err.response.body),\n headers: structuredClone(err.response.headers),\n httpVersion: err.response.httpVersion,\n retryCount: err.response.retryCount,\n };\n }\n }\n\n return response;\n}\n\ntype NestedValue = unknown[] | object;\n\nfunction isNested(value: unknown): value is NestedValue {\n return isArray(value) || isObject(value);\n}\n\nexport function sanitizeValue(\n value: unknown,\n seen = new WeakMap<NestedValue, unknown>(),\n): any {\n if (isString(value)) {\n return sanitize(sanitizeUrls(value));\n }\n\n // Handle boxed String objects (e.g. from `new String()`), which `isString`\n // rejects but `isObject` would iterate character-by-character producing\n // `{\"0\":\"h\",\"1\":\"e\",...}` in log output.\n if (value instanceof String) {\n return sanitize(sanitizeUrls(value.toString()));\n }\n\n if (isDate(value)) {\n return value;\n }\n\n if (DateTime.isDateTime(value)) {\n return value.toISO();\n }\n\n if (isFunction(value)) {\n return '[function]';\n }\n\n if (isBuffer(value)) {\n return '[content]';\n }\n\n if (isError(value)) {\n const err = prepareError(value);\n return sanitizeValue(err, seen);\n }\n\n if (isArray(value)) {\n const length = value.length;\n const arrayResult = Array(length);\n seen.set(value, arrayResult);\n for (let idx = 0; idx < length; idx += 1) {\n const val = value[idx];\n arrayResult[idx] =\n isNested(val) && seen.has(val)\n ? seen.get(val)\n : sanitizeValue(val, seen);\n }\n return arrayResult;\n }\n\n if (isObject(value)) {\n const objectResult: Record<string, any> = {};\n seen.set(value, objectResult);\n for (const [key, val] of Object.entries<any>(value)) {\n let curValue: any;\n if (!val) {\n curValue = val;\n } else if (redactedFields.includes(key)) {\n // Do not mask/sanitize secrets templates\n if (isString(val) && regEx(/^{{\\s*secrets\\..*}}$/).test(val)) {\n curValue = val;\n } else {\n curValue = '***********';\n }\n } else if (contentFields.includes(key)) {\n curValue = '[content]';\n } else if (key === 'secrets') {\n curValue = {};\n Object.keys(val).forEach((secretKey) => {\n curValue[secretKey] = '***********';\n });\n } else {\n curValue = seen.has(val) ? seen.get(val) : sanitizeValue(val, seen);\n }\n\n const sanitizedKey = sanitizeValue(key, seen);\n objectResult[sanitizedKey] = curValue;\n }\n\n return objectResult;\n }\n\n return value;\n}\n\nconst urlRe = regEx(/[a-z]{3,9}:\\/\\/[^@/]+@[a-z0-9.-]+/gi);\nconst urlCredRe = regEx(/\\/\\/[^@]+@/g);\nconst dataUriCredRe = regEx(/^(?<prefix>data:[0-9a-z-]+\\/[0-9a-z-]+;).+/i);\n\nexport function sanitizeUrls(text: string): string {\n return text\n .replace(urlRe, (url) => {\n return url.replace(urlCredRe, '//**redacted**@');\n })\n .replace(dataUriCredRe, '$<prefix>**redacted**');\n}\n\nexport function getEnv(key: string): string | undefined {\n return [process.env[`RENOVATE_${key}`], process.env[key]]\n .map((v) => v?.toLowerCase().trim())\n .find(isNonEmptyStringAndNotWhitespace);\n}\n\nexport function getMessage(\n p1: string | Record<string, any>,\n p2?: string,\n): string | undefined {\n return isString(p1) ? p1 : p2;\n}\n\nexport function toMeta(\n p1: string | Record<string, any>,\n): Record<string, unknown> {\n return isObject(p1) ? p1 : {};\n}\n"],"mappings":";;;;;;;;AAoBA,MAAM,gBAAgB;CACpB;CACA;CACA;CACA;AACF;AAUA,SAAgB,iBAAiB,OAAmC;CAClE,IAAI,CAAC,cAAc,KAAK,GACtB,OAAO;CAGT,IAAI,MAAgC;;CAEpC,IAAI,QAAQ,MAAM,SAAS,QAAQ,GAAG;EACpC,IAAI,MAAM,QAAQ,WAAW,GAC3B,MAAM,MAAM,QAAQ;OACf,IAAI,MAAM,QAAQ,SAAS,GAChC,MAAM,MAAM;OAEZ,MAAM;CAEV;CACA,OAAO,MAAM;CAEb,IAAI,cAAc,KAAK,GACrB,OAAO;CAGT,MAAM,SAA4C,CAAC;CACnD,MAAM,UAAU,OAAO,QAAQ,KAAK;CACpC,KAAK,MAAM,CAAC,KAAK,UAAU,QAAQ,MAAM,GAAG,CAAC,GAAG;EAC9C,MAAM,QAAQ,iBAAiB,KAAK;;EAEpC,IAAI,UAAU,MACZ,OAAO,OAAO;CAElB;CAEA,IAAI,QAAQ,SAAS,GACnB,OAAO,MAAM,OAAO,QAAQ,SAAS,EAAE;CAGzC,OAAO;AACT;AAEA,SAAgB,gBAAgB,KAAwC;CACtE,OAAO,eAAe,KAAK,WAAW;EACpC,WAAW;;EAEX,WAAW,CAEX;CAEF,CAAC;CAED,OAAO;EACL,SAAS,IAAI;EACb,OAAO,IAAI;EACX,QAAQ,iBAAiB,IAAI,OAAO,CAAC;CACvC;A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AAc,KAAK,IAAI;GAC5C,aAAa,gBAAgB;EAC/B;EAEA,OAAO;CACT;CAEA,OAAO;AACT;AAEA,MAAM,QAAQ,MAAM,qCAAqC;AACzD,MAAM,YAAY,MAAM,aAAa;AACrC,MAAM,gBAAgB,MAAM,6CAA6C;AAEzE,SAAgB,aAAa,MAAsB;CACjD,OAAO,KACJ,QAAQ,QAAQ,QAAQ;EACvB,OAAO,IAAI,QAAQ,WAAW,iBAAiB;CACjD,CAAC,CAAC,CACD,QAAQ,eAAe,uBAAuB;AACnD;AAEA,SAAgB,OAAO,KAAiC;CACtD,OAAO,CAAC,QAAQ,IAAI,YAAY,QAAQ,QAAQ,IAAI,IAAI,CAAC,CACtD,KAAK,MAAM,GAAG,YAAY,CAAC,CAAC,KAAK,CAAC,CAAC,CACnC,KAAK,gCAAgC;AAC1C;AAEA,SAAgB,WACd,IACA,IACoB;CACpB,OAAO,SAAS,EAAE,IAAI,KAAK;AAC7B;AAEA,SAAgB,OACd,IACyB;CACzB,OAAO,SAAS,EAAE,IAAI,KAAK,CAAC;AAC9B"}
1
+ {"version":3,"file":"utils.js","names":["HttpError"],"sources":["../../lib/logger/utils.ts"],"sourcesContent":["import {\n isArray,\n isBuffer,\n isDate,\n isEmptyObject,\n isError,\n isFunction,\n isNonEmptyObject,\n isNonEmptyStringAndNotWhitespace,\n isObject,\n isPlainObject,\n isString,\n} from '@sindresorhus/is';\nimport { RequestError as HttpError } from 'got';\nimport { DateTime } from 'luxon';\nimport { ZodError } from 'zod/v4';\nimport { ExecError } from '../util/exec/exec-error.ts';\nimport { regEx } from '../util/regex.ts';\nimport { redactedFields, sanitize } from '../util/sanitize.ts';\n\nconst contentFields = [\n 'content',\n 'contents',\n 'packageLockParsed',\n 'yarnLockParsed',\n];\n\ntype ZodShortenedIssue =\n | null\n | string\n | string[]\n | {\n [key: string]: ZodShortenedIssue;\n };\n\nexport function prepareZodIssues(input: unknown): ZodShortenedIssue {\n if (!isPlainObject(input)) {\n return null;\n }\n\n let err: null | string | string[] = null;\n // v8 ignore else -- TODO: add test #40625\n if (isArray(input._errors, isString)) {\n if (input._errors.length === 1) {\n err = input._errors[0];\n } else if (input._errors.length > 1) {\n err = input._errors;\n } else {\n err = null;\n }\n }\n delete input._errors;\n\n if (isEmptyObject(input)) {\n return err;\n }\n\n const output: Record<string, ZodShortenedIssue> = {};\n const entries = Object.entries(input);\n for (const [key, value] of entries.slice(0, 3)) {\n const child = prepareZodIssues(value);\n // v8 ignore else -- TODO: add test #40625\n if (child !== null) {\n output[key] = child;\n }\n }\n\n if (entries.length > 3) {\n output.___ = `... ${entries.length - 3} more`;\n }\n\n return output;\n}\n\nexport function prepareZodError(err: ZodError): Record<string, unknown> {\n Object.defineProperty(err, 'message', {\n get: () => 'Schema error',\n /* v8 ignore start -- TODO: drop set? */\n set: () => {\n /* intentionally empty */\n },\n // v8 ignore stop -- TODO: drop set? */\n });\n\n return {\n message: err.message,\n stack: err.stack,\n issues: prepareZodIssues(err.format()),\n };\n}\n\nexport default function prepareError(err: Error): Record<string, unknown> {\n if (err instanceof ZodError) {\n return prepareZodError(err);\n }\n\n const response: Record<string, unknown> = {\n // We want to loose class information, but keep enumerable properties of the error\n // oxlint-disable-next-line typescript/no-misused-spread\n ...err,\n };\n\n // Required as message is non-enumerable\n if (!response.message && err.message) {\n response.message = err.message;\n }\n\n // Required as stack is non-enumerable\n if (!response.stack && err.stack) {\n response.stack = err.stack;\n }\n\n if (err instanceof AggregateError) {\n response.errors = err.errors.map((error) => prepareError(error));\n }\n\n // handle rawExec error\n if (err instanceof ExecError && isNonEmptyObject(err.options?.env)) {\n const env = Object.keys(err.options.env);\n response.options = { ...err.options, env };\n }\n\n // handle got error\n if (err instanceof HttpError) {\n const options: Record<string, unknown> = {\n headers: structuredClone({ ...err.options.headers }),\n url: err.options.url?.toString(),\n hostType: err.options.context.hostType,\n };\n response.options = options;\n\n options.username = err.options.username;\n options.password = err.options.password;\n options.method = err.options.method;\n options.http2 = err.options.http2;\n\n // v8 ignore else -- TODO: add test #40625\n if (err.response) {\n response.response = {\n statusCode: err.response.statusCode,\n statusMessage: err.response.statusMessage,\n body:\n err.name === 'TimeoutError'\n ? undefined\n : structuredClone(err.response.body),\n headers: structuredClone(err.response.headers),\n httpVersion: err.response.httpVersion,\n retryCount: err.response.retryCount,\n };\n }\n }\n\n return response;\n}\n\ntype NestedValue = unknown[] | object;\n\nfunction isNested(value: unknown): value is NestedValue {\n return isArray(value) || isObject(value);\n}\n\nexport function sanitizeValue(\n value: unknown,\n seen = new WeakMap<NestedValue, unknown>(),\n): any {\n if (isString(value)) {\n return sanitize(sanitizeUrls(value));\n }\n\n // Handle boxed String objects (e.g. from `new String()`), which `isString`\n // rejects but `isObject` would iterate character-by-character producing\n // `{\"0\":\"h\",\"1\":\"e\",...}` in log output.\n if (value instanceof String) {\n return sanitize(sanitizeUrls(value.toString()));\n }\n\n if (isDate(value)) {\n return value;\n }\n\n if (DateTime.isDateTime(value)) {\n return value.toISO();\n }\n\n if (isFunction(value)) {\n return '[function]';\n }\n\n if (isBuffer(value)) {\n return '[content]';\n }\n\n if (isError(value)) {\n const err = prepareError(value);\n return sanitizeValue(err, seen);\n }\n\n if (isArray(value)) {\n const length = value.length;\n const arrayResult = Array(length);\n seen.set(value, arrayResult);\n for (let idx = 0; idx < length; idx += 1) {\n const val = value[idx];\n arrayResult[idx] =\n isNested(val) && seen.has(val)\n ? seen.get(val)\n : sanitizeValue(val, seen);\n }\n return arrayResult;\n }\n\n if (isObject(value)) {\n const objectResult: Record<string, any> = {};\n seen.set(value, objectResult);\n for (const [key, val] of Object.entries<any>(value)) {\n let curValue: any;\n if (!val) {\n curValue = val;\n } else if (redactedFields.includes(key)) {\n // Do not mask/sanitize secrets templates\n if (isString(val) && regEx(/^{{\\s*secrets\\..*}}$/).test(val)) {\n curValue = val;\n } else {\n curValue = '***********';\n }\n } else if (contentFields.includes(key)) {\n curValue = '[content]';\n } else if (key === 'secrets') {\n curValue = {};\n Object.keys(val).forEach((secretKey) => {\n curValue[secretKey] = '***********';\n });\n } else {\n curValue = seen.has(val) ? seen.get(val) : sanitizeValue(val, seen);\n }\n\n const sanitizedKey = sanitizeValue(key, seen);\n objectResult[sanitizedKey] = curValue;\n }\n\n return objectResult;\n }\n\n return value;\n}\n\nconst urlRe = regEx(/[a-z]{3,9}:\\/\\/[^@/]+@[a-z0-9.-]+/gi);\nconst urlCredRe = regEx(/\\/\\/[^@]+@/g);\nconst dataUriCredRe = regEx(/^(?<prefix>data:[0-9a-z-]+\\/[0-9a-z-]+;).+/i);\n\nexport function sanitizeUrls(text: string): string {\n return text\n .replace(urlRe, (url) => {\n return url.replace(urlCredRe, '//**redacted**@');\n })\n .replace(dataUriCredRe, '$<prefix>**redacted**');\n}\n\nexport function getEnv(key: string): string | undefined {\n return [process.env[`RENOVATE_${key}`], process.env[key]]\n .map((v) => v?.toLowerCase().trim())\n .find(isNonEmptyStringAndNotWhitespace);\n}\n\nexport function getMessage(\n p1: string | Record<string, any>,\n p2?: string,\n): string | undefined {\n return isString(p1) ? p1 : p2;\n}\n\nexport function toMeta(\n p1: string | Record<string, any>,\n): Record<string, unknown> {\n return isObject(p1) ? p1 : {};\n}\n"],"mappings":";;;;;;;;AAoBA,MAAM,gBAAgB;CACpB;CACA;CACA;CACA;AACF;AAUA,SAAgB,iBAAiB,OAAmC;CAClE,IAAI,CAAC,cAAc,KAAK,GACtB,OAAO;CAGT,IAAI,MAAgC;;CAEpC,IAAI,QAAQ,MAAM,SAAS,QAAQ,GAAG;EACpC,IAAI,MAAM,QAAQ,WAAW,GAC3B,MAAM,MAAM,QAAQ;OACf,IAAI,MAAM,QAAQ,SAAS,GAChC,MAAM,MAAM;OAEZ,MAAM;CAEV;CACA,OAAO,MAAM;CAEb,IAAI,cAAc,KAAK,GACrB,OAAO;CAGT,MAAM,SAA4C,CAAC;CACnD,MAAM,UAAU,OAAO,QAAQ,KAAK;CACpC,KAAK,MAAM,CAAC,KAAK,UAAU,QAAQ,MAAM,GAAG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eAAe,SAAS,GAAG,GAAG;IAEvC,IAAI,SAAS,GAAG,KAAK,MAAM,sBAAsB,CAAC,CAAC,KAAK,GAAG,GACzD,WAAW;SAEX,WAAW;GAEf,OAAO,IAAI,cAAc,SAAS,GAAG,GACnC,WAAW;QACN,IAAI,QAAQ,WAAW;IAC5B,WAAW,CAAC;IACZ,OAAO,KAAK,GAAG,CAAC,CAAC,SAAS,cAAc;KACtC,SAAS,aAAa;IACxB,CAAC;GACH,OACE,WAAW,KAAK,IAAI,GAAG,IAAI,KAAK,IAAI,GAAG,IAAI,cAAc,KAAK,IAAI;GAGpE,MAAM,eAAe,cAAc,KAAK,IAAI;GAC5C,aAAa,gBAAgB;EAC/B;EAEA,OAAO;CACT;CAEA,OAAO;AACT;AAEA,MAAM,QAAQ,MAAM,qCAAqC;AACzD,MAAM,YAAY,MAAM,aAAa;AACrC,MAAM,gBAAgB,MAAM,6CAA6C;AAEzE,SAAgB,aAAa,MAAsB;CACjD,OAAO,KACJ,QAAQ,QAAQ,QAAQ;EACvB,OAAO,IAAI,QAAQ,WAAW,iBAAiB;CACjD,CAAC,CAAC,CACD,QAAQ,eAAe,uBAAuB;AACnD;AAEA,SAAgB,OAAO,KAAiC;CACtD,OAAO,CAAC,QAAQ,IAAI,YAAY,QAAQ,QAAQ,IAAI,IAAI,CAAC,CACtD,KAAK,MAAM,GAAG,YAAY,CAAC,CAAC,KAAK,CAAC,CAAC,CACnC,KAAK,gCAAgC;AAC1C;AAEA,SAAgB,WACd,IACA,IACoB;CACpB,OAAO,SAAS,EAAE,IAAI,KAAK;AAC7B;AAEA,SAAgB,OACd,IACyB;CACzB,OAAO,SAAS,EAAE,IAAI,KAAK,CAAC;AAC9B"}
@@ -95,9 +95,9 @@ var GitlabHttp = class extends HttpBase {
95
95
  */
96
96
  function isRetryablePostError(error) {
97
97
  const { response } = error;
98
- if (response?.statusCode === 409) return response.rawBody.toString().includes("Resource lock");
98
+ if (response?.statusCode === 409) return Buffer.from(response.rawBody).toString().includes("Resource lock");
99
99
  if (response?.statusCode === 400) {
100
- const rawBody = response.rawBody.toString();
100
+ const rawBody = Buffer.from(response.rawBody).toString();
101
101
  return rawBody.includes("source_branch") && rawBody.includes("does not exist");
102
102
  }
103
103
  return false;
@@ -1 +1 @@
1
- {"version":3,"file":"gitlab.js","names":[],"sources":["../../../lib/util/http/gitlab.ts"],"sourcesContent":["import { isArray, isString } from '@sindresorhus/is';\nimport { RequestError, type RetryObject } from 'got';\nimport { logger } from '../../logger/index.ts';\nimport { ExternalHostError } from '../../types/errors/external-host-error.ts';\nimport { getEnv } from '../env.ts';\nimport { parseLinkHeader, parseUrl } from '../url.ts';\nimport { HttpBase, type InternalJsonUnsafeOptions } from './http.ts';\nimport type { HttpMethod, HttpOptions, HttpResponse } from './types.ts';\n\nlet baseUrl = 'https://gitlab.com/api/v4/';\nexport function setBaseUrl(url: string): void {\n baseUrl = url;\n}\n\nexport interface GitlabHttpOptions extends HttpOptions {\n paginate?: boolean;\n}\n\nexport class GitlabHttp extends HttpBase<GitlabHttpOptions> {\n protected override get baseUrl(): string | undefined {\n return baseUrl;\n }\n\n constructor(type = 'gitlab', options?: GitlabHttpOptions) {\n super(type, options);\n }\n\n protected override extraOptions(): readonly string[] {\n return super\n .extraOptions()\n .concat(['paginate'] as (keyof GitlabHttpOptions)[]);\n }\n\n protected override async requestJsonUnsafe<T = unknown>(\n method: HttpMethod,\n options: InternalJsonUnsafeOptions<GitlabHttpOptions>,\n ): Promise<HttpResponse<T>> {\n const resolvedUrl = this.resolveUrl(options.url, options.httpOptions);\n const opts = {\n ...options,\n url: resolvedUrl,\n };\n opts.httpOptions ??= {};\n opts.httpOptions.throwHttpErrors = true;\n\n const result = await super.requestJsonUnsafe<T>(method, opts);\n if (opts.httpOptions.paginate && isArray(result.body)) {\n opts.httpOptions.memCache = false;\n\n // Check if result is paginated\n try {\n const linkHeader = parseLinkHeader(result.headers.link);\n const nextUrl = linkHeader?.next?.url\n ? parseUrl(linkHeader.next.url)\n : null;\n if (nextUrl) {\n if (getEnv().GITLAB_IGNORE_REPO_URL) {\n const defaultEndpoint = parseUrl(baseUrl)!;\n nextUrl.protocol = defaultEndpoint.protocol;\n nextUrl.host = defaultEndpoint.host;\n }\n\n // Don't follow a cross-origin request, unless we've been explicitly requested to do so with `RENOVATE_X_REBASE_PAGINATION_LINKS`\n if (nextUrl.origin === resolvedUrl.origin) {\n opts.url = nextUrl;\n\n const nextResult = await this.requestJsonUnsafe<T>(method, opts);\n // v8 ignore else -- TODO: add test #40625\n if (isArray(nextResult.body)) {\n result.body.push(...nextResult.body);\n }\n } else {\n // make sure that users are aware if there are any (potentially malicious, or misconfigured) pagination links being returned\n logger.once.warn(\n { requestHost: resolvedUrl.host, paginationHost: nextUrl.host },\n 'Ignoring cross-origin GitLab pagination link. Set GITLAB_IGNORE_REPO_URL if this is a self-hosted instance that returns a different host in pagination links.',\n );\n }\n }\n } catch (err) {\n logger.warn({ err }, 'Pagination error');\n }\n }\n return result;\n }\n\n protected override handleError(\n url: string | URL,\n _httpOptions: HttpOptions,\n err: Error,\n ): never {\n if (err instanceof RequestError && err.response?.statusCode) {\n if (err.response.statusCode === 404) {\n logger.trace({ err }, 'GitLab 404');\n logger.debug({ url }, 'GitLab API 404');\n throw err;\n }\n logger.debug({ err }, 'Gitlab API error');\n if (\n err.response.statusCode === 429 ||\n (err.response.statusCode >= 500 && err.response.statusCode < 600)\n ) {\n throw new ExternalHostError(err, 'gitlab');\n }\n }\n const platformFailureCodes = [\n 'EAI_AGAIN',\n 'ECONNRESET',\n 'ETIMEDOUT',\n 'UNABLE_TO_VERIFY_LEAF_SIGNATURE',\n ];\n // TODO: fix test, should be `RequestError`\n if (\n 'code' in err &&\n isString(err.code) &&\n platformFailureCodes.includes(err.code)\n ) {\n throw new ExternalHostError(err, 'gitlab');\n }\n if (err.name === 'ParseError') {\n throw new ExternalHostError(err, 'gitlab');\n }\n throw err;\n }\n\n protected override calculateRetryDelay(retryObject: RetryObject): number {\n const { error, attemptCount, retryOptions } = retryObject;\n if (\n attemptCount <= retryOptions.limit &&\n error.options.method === 'POST' &&\n isRetryablePostError(error)\n ) {\n const noise = Math.random() * 100;\n return 2 ** (attemptCount - 1) * 1000 + noise;\n }\n\n return super.calculateRetryDelay(retryObject);\n }\n}\n\n/**\n * Detects transient GitLab errors on POST requests that are safe to retry:\n *\n * - `409` with a `Resource lock` message, which happens when concurrent\n * requests conflict.\n * - `400` with a `source_branch does not exist` message, which happens when a\n * freshly pushed branch is not yet visible to the API due to Gitaly eventual\n * consistency.\n */\nfunction isRetryablePostError(error: RequestError): boolean {\n const { response } = error;\n if (response?.statusCode === 409) {\n return response.rawBody.toString().includes('Resource lock');\n }\n\n if (response?.statusCode === 400) {\n const rawBody = response.rawBody.toString();\n return (\n rawBody.includes('source_branch') && rawBody.includes('does not exist')\n );\n }\n\n return false;\n}\n"],"mappings":";;;;;;;;AASA,IAAI,UAAU;AACd,SAAgB,WAAW,KAAmB;CAC5C,UAAU;AACZ;AAMA,IAAa,aAAb,cAAgC,SAA4B;CAC1D,IAAuB,UAA8B;EACnD,OAAO;CACT;CAEA,YAAY,OAAO,UAAU,SAA6B;EACxD,MAAM,MAAM,OAAO;CACrB;CAEA,eAAqD;EACnD,OAAO,MACJ,aAAa,CAAC,CACd,OAAO,CAAC,UAAU,CAAgC;CACvD;CAEA,MAAyB,kBACvB,QACA,SAC0B;EAC1B,MAAM,cAAc,KAAK,WAAW,QAAQ,KAAK,QAAQ,WAAW;EACpE,MAAM,OAAO;GACX,GAAG;GACH,KAAK;EACP;EACA,KAAK,gBAAgB,CAAC;EACtB,KAAK,YAAY,kBAAkB;EAEnC,MAAM,SAAS,MAAM,MAAM,kBAAqB,QAAQ,IAAI;EAC5D,IAAI,KAAK,YAAY,YAAY,QAAQ,OAAO,IAAI,GAAG;GACrD,KAAK,YAAY,WAAW;GAG5B,IAAI;IACF,MAAM,aAAa,gBAAgB,OAAO,QAAQ,IAAI;IACtD,MAAM,UAAU,YAAY,MAA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E,gBAAgB,aAAa,SAC7B,MAAM,QAAQ,WAAW,UACzB,qBAAqB,KAAK,GAC1B;GACA,MAAM,QAAQ,KAAK,OAAO,IAAI;GAC9B,OAAO,MAAM,eAAe,KAAK,MAAO;EAC1C;EAEA,OAAO,MAAM,oBAAoB,WAAW;CAC9C;AACF;;;;;;;;;;AAWA,SAAS,qBAAqB,OAA8B;CAC1D,MAAM,EAAE,aAAa;CACrB,IAAI,UAAU,eAAe,KAC3B,OAAO,SAAS,QAAQ,SAAS,CAAC,CAAC,SAAS,eAAe;CAG7D,IAAI,UAAU,eAAe,KAAK;EAChC,MAAM,UAAU,SAAS,QAAQ,SAAS;EAC1C,OACE,QAAQ,SAAS,eAAe,KAAK,QAAQ,SAAS,gBAAgB;CAE1E;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"gitlab.js","names":[],"sources":["../../../lib/util/http/gitlab.ts"],"sourcesContent":["import { isArray, isString } from '@sindresorhus/is';\nimport { RequestError, type RetryObject } from 'got';\nimport { logger } from '../../logger/index.ts';\nimport { ExternalHostError } from '../../types/errors/external-host-error.ts';\nimport { getEnv } from '../env.ts';\nimport { parseLinkHeader, parseUrl } from '../url.ts';\nimport { HttpBase, type InternalJsonUnsafeOptions } from './http.ts';\nimport type { HttpMethod, HttpOptions, HttpResponse } from './types.ts';\n\nlet baseUrl = 'https://gitlab.com/api/v4/';\nexport function setBaseUrl(url: string): void {\n baseUrl = url;\n}\n\nexport interface GitlabHttpOptions extends HttpOptions {\n paginate?: boolean;\n}\n\nexport class GitlabHttp extends HttpBase<GitlabHttpOptions> {\n protected override get baseUrl(): string | undefined {\n return baseUrl;\n }\n\n constructor(type = 'gitlab', options?: GitlabHttpOptions) {\n super(type, options);\n }\n\n protected override extraOptions(): readonly string[] {\n return super\n .extraOptions()\n .concat(['paginate'] as (keyof GitlabHttpOptions)[]);\n }\n\n protected override async requestJsonUnsafe<T = unknown>(\n method: HttpMethod,\n options: InternalJsonUnsafeOptions<GitlabHttpOptions>,\n ): Promise<HttpResponse<T>> {\n const resolvedUrl = this.resolveUrl(options.url, options.httpOptions);\n const opts = {\n ...options,\n url: resolvedUrl,\n };\n opts.httpOptions ??= {};\n opts.httpOptions.throwHttpErrors = true;\n\n const result = await super.requestJsonUnsafe<T>(method, opts);\n if (opts.httpOptions.paginate && isArray(result.body)) {\n opts.httpOptions.memCache = false;\n\n // Check if result is paginated\n try {\n const linkHeader = parseLinkHeader(result.headers.link);\n const nextUrl = linkHeader?.next?.url\n ? parseUrl(linkHeader.next.url)\n : null;\n if (nextUrl) {\n if (getEnv().GITLAB_IGNORE_REPO_URL) {\n const defaultEndpoint = parseUrl(baseUrl)!;\n nextUrl.protocol = defaultEndpoint.protocol;\n nextUrl.host = defaultEndpoint.host;\n }\n\n // Don't follow a cross-origin request, unless we've been explicitly requested to do so with `RENOVATE_X_REBASE_PAGINATION_LINKS`\n if (nextUrl.origin === resolvedUrl.origin) {\n opts.url = nextUrl;\n\n const nextResult = await this.requestJsonUnsafe<T>(method, opts);\n // v8 ignore else -- TODO: add test #40625\n if (isArray(nextResult.body)) {\n result.body.push(...nextResult.body);\n }\n } else {\n // make sure that users are aware if there are any (potentially malicious, or misconfigured) pagination links being returned\n logger.once.warn(\n { requestHost: resolvedUrl.host, paginationHost: nextUrl.host },\n 'Ignoring cross-origin GitLab pagination link. Set GITLAB_IGNORE_REPO_URL if this is a self-hosted instance that returns a different host in pagination links.',\n );\n }\n }\n } catch (err) {\n logger.warn({ err }, 'Pagination error');\n }\n }\n return result;\n }\n\n protected override handleError(\n url: string | URL,\n _httpOptions: HttpOptions,\n err: Error,\n ): never {\n if (err instanceof RequestError && err.response?.statusCode) {\n if (err.response.statusCode === 404) {\n logger.trace({ err }, 'GitLab 404');\n logger.debug({ url }, 'GitLab API 404');\n throw err;\n }\n logger.debug({ err }, 'Gitlab API error');\n if (\n err.response.statusCode === 429 ||\n (err.response.statusCode >= 500 && err.response.statusCode < 600)\n ) {\n throw new ExternalHostError(err, 'gitlab');\n }\n }\n const platformFailureCodes = [\n 'EAI_AGAIN',\n 'ECONNRESET',\n 'ETIMEDOUT',\n 'UNABLE_TO_VERIFY_LEAF_SIGNATURE',\n ];\n // TODO: fix test, should be `RequestError`\n if (\n 'code' in err &&\n isString(err.code) &&\n platformFailureCodes.includes(err.code)\n ) {\n throw new ExternalHostError(err, 'gitlab');\n }\n if (err.name === 'ParseError') {\n throw new ExternalHostError(err, 'gitlab');\n }\n throw err;\n }\n\n protected override calculateRetryDelay(retryObject: RetryObject): number {\n const { error, attemptCount, retryOptions } = retryObject;\n if (\n attemptCount <= retryOptions.limit &&\n error.options.method === 'POST' &&\n isRetryablePostError(error)\n ) {\n const noise = Math.random() * 100;\n return 2 ** (attemptCount - 1) * 1000 + noise;\n }\n\n return super.calculateRetryDelay(retryObject);\n }\n}\n\n/**\n * Detects transient GitLab errors on POST requests that are safe to retry:\n *\n * - `409` with a `Resource lock` message, which happens when concurrent\n * requests conflict.\n * - `400` with a `source_branch does not exist` message, which happens when a\n * freshly pushed branch is not yet visible to the API due to Gitaly eventual\n * consistency.\n */\nfunction isRetryablePostError(error: RequestError): boolean {\n const { response } = error;\n if (response?.statusCode === 409) {\n return Buffer.from(response.rawBody).toString().includes('Resource lock');\n }\n\n if (response?.statusCode === 400) {\n const rawBody = Buffer.from(response.rawBody).toString();\n return (\n rawBody.includes('source_branch') && rawBody.includes('does not exist')\n );\n }\n\n return false;\n}\n"],"mappings":";;;;;;;;AASA,IAAI,UAAU;AACd,SAAgB,WAAW,KAAmB;CAC5C,UAAU;AACZ;AAMA,IAAa,aAAb,cAAgC,SAA4B;CAC1D,IAAuB,UAA8B;EACnD,OAAO;CACT;CAEA,YAAY,OAAO,UAAU,SAA6B;EACxD,MAAM,MAAM,OAAO;CACrB;CAEA,eAAqD;EACnD,OAAO,MACJ,aAAa,CAAC,CACd,OAAO,CAAC,UAAU,CAAgC;CACvD;CAEA,MAAyB,kBACvB,QACA,SAC0B;EAC1B,MAAM,cAAc,KAAK,WAAW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KAE7D,MAAM,IAAI,kBAAkB,KAAK,QAAQ;EAE7C;EAQA,IACE,UAAU,OACV,SAAS,IAAI,IAAI,KACjB;GATA;GACA;GACA;GACA;EAMmB,CAAC,CAAC,SAAS,IAAI,IAAI,GAEtC,MAAM,IAAI,kBAAkB,KAAK,QAAQ;EAE3C,IAAI,IAAI,SAAS,cACf,MAAM,IAAI,kBAAkB,KAAK,QAAQ;EAE3C,MAAM;CACR;CAEA,oBAAuC,aAAkC;EACvE,MAAM,EAAE,OAAO,cAAc,iBAAiB;EAC9C,IACE,gBAAgB,aAAa,SAC7B,MAAM,QAAQ,WAAW,UACzB,qBAAqB,KAAK,GAC1B;GACA,MAAM,QAAQ,KAAK,OAAO,IAAI;GAC9B,OAAO,MAAM,eAAe,KAAK,MAAO;EAC1C;EAEA,OAAO,MAAM,oBAAoB,WAAW;CAC9C;AACF;;;;;;;;;;AAWA,SAAS,qBAAqB,OAA8B;CAC1D,MAAM,EAAE,aAAa;CACrB,IAAI,UAAU,eAAe,KAC3B,OAAO,OAAO,KAAK,SAAS,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,eAAe;CAG1E,IAAI,UAAU,eAAe,KAAK;EAChC,MAAM,UAAU,OAAO,KAAK,SAAS,OAAO,CAAC,CAAC,SAAS;EACvD,OACE,QAAQ,SAAS,eAAe,KAAK,QAAQ,SAAS,gBAAgB;CAE1E;CAEA,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"host-rules.js","names":["hostRules.find"],"sources":["../../../lib/util/http/host-rules.ts"],"sourcesContent":["import { isNonEmptyString } from '@sindresorhus/is';\nimport { GlobalConfig } from '../../config/global.ts';\nimport {\n BITBUCKET_API_USING_HOST_TYPES,\n BITBUCKET_SERVER_API_USING_HOST_TYPES,\n FORGEJO_API_USING_HOST_TYPES,\n GITEA_API_USING_HOST_TYPES,\n GITHUB_API_USING_HOST_TYPES,\n GITLAB_API_USING_HOST_TYPES,\n} from '../../constants/index.ts';\nimport { logger } from '../../logger/index.ts';\nimport { hasProxy } from '../../proxy.ts';\nimport type { HostRule } from '../../types/index.ts';\nimport * as hostRules from '../host-rules.ts';\nimport { matchRegexOrGlobList } from '../string-match.ts';\nimport { parseUrl } from '../url.ts';\nimport type { InternalHttpOptions } from './http.ts';\nimport { keepAliveAgents } from './keep-alive.ts';\nimport type { GotOptions } from './types.ts';\n\nexport type HostRulesGotOptions = Pick<\n GotOptions & InternalHttpOptions,\n | 'hostType'\n | 'url'\n | 'noAuth'\n | 'headers'\n | 'token'\n | 'username'\n | 'password'\n | 'context'\n | 'enabled'\n | 'abortOnError'\n | 'abortIgnoreStatusCodes'\n | 'timeout'\n | 'agent'\n | 'http2'\n | 'https'\n | 'readOnly'\n>;\n\nexport function findMatchingRule<GotOptions extends HostRulesGotOptions>(\n url: string,\n options: GotOptions,\n): HostRule {\n const { hostType, readOnly } = options;\n let res = hostRules.find({ hostType, url, readOnly });\n\n if (\n isNonEmptyString(res.token) ||\n isNonEmptyString(res.username) ||\n isNonEmptyString(res.password)\n ) {\n // do not fallback if we already have auth infos\n return res;\n }\n\n // Fallback to `github` hostType\n if (\n hostType &&\n GITHUB_API_USING_HOST_TYPES.includes(hostType) &&\n hostType !== 'github'\n ) {\n res = {\n ...hostRules.find({\n hostType: 'github',\n url,\n }),\n ...res,\n };\n }\n\n const platform = GlobalConfig.get('platform');\n const platformEndpoint = GlobalConfig.get('endpoint');\n\n // in the case that an API URL is used for GitHub.com, fallback to `github` hostType, and use the `url`'s host to find a `matchHost: api.github.com` (or `matchHost: github.com`)\n if (url.startsWith('https://api.github.com/')) {\n res = {\n ...hostRules.find({\n hostType: 'github',\n url,\n }),\n ...res,\n };\n } else if (platform === 'github' && platformEndpoint) {\n // Fallback to `github` hostType when the request URL targets the same host\n // as the configured GitHub platform endpoint.\n //\n // This covers GitHub Enterprise Server without hardcoding URLs.\n const requestHost = parseUrl(url)?.hostname;\n const endpointHost = parseUrl(platformEndpoint)?.hostname;\n if (requestHost && endpointHost && requestHost === endpointHost) {\n res = {\n ...hostRules.find({ hostType: 'github', url }),\n ...res,\n };\n }\n }\n\n // Fallback to `gitlab` hostType\n if (\n hostType &&\n GITLAB_API_USING_HOST_TYPES.includes(hostType) &&\n hostType !== 'gitlab'\n ) {\n res = {\n ...hostRules.find({\n hostType: 'gitlab',\n url,\n }),\n ...res,\n };\n }\n\n // Fallback to `bitbucket` hostType\n if (\n hostType &&\n BITBUCKET_API_USING_HOST_TYPES.includes(hostType) &&\n hostType !== 'bitbucket'\n ) {\n res = {\n ...hostRules.find({\n hostType: 'bitbucket',\n url,\n }),\n ...res,\n };\n }\n\n // Fallback to `bitbucket-server` hostType\n if (\n hostType &&\n BITBUCKET_SERVER_API_USING_HOST_TYPES.includes(hostType) &&\n hostType !== 'bitbucket-server'\n ) {\n res = {\n ...hostRules.find({\n hostType: 'bitbucket-server',\n url,\n }),\n ...res,\n };\n }\n\n // Fallback to `forgejo` hostType\n if (\n hostType &&\n FORGEJO_API_USING_HOST_TYPES.includes(hostType) &&\n hostType !== 'forgejo'\n ) {\n res = {\n ...hostRules.find({\n hostType: 'forgejo',\n url,\n }),\n ...res,\n };\n }\n\n // Fallback to `gitea` hostType\n if (\n hostType &&\n GITEA_API_USING_HOST_TYPES.includes(hostType) &&\n hostType !== 'gitea'\n ) {\n res = {\n ...hostRules.find({\n hostType: 'gitea',\n url,\n }),\n ...res,\n };\n }\n\n return res;\n}\n\n// Apply host rules to requests\nexport function applyHostRule<GotOptions extends HostRulesGotOptions>(\n url: string,\n options: GotOptions,\n hostRule: HostRule,\n): GotOptions {\n if (hostRule.enabled === false) {\n options.enabled = false;\n return options;\n }\n\n const { username, password, token, authType } = hostRule;\n const host = parseUrl(url)?.host;\n if (options.noAuth) {\n logger.trace({ url }, `Authorization disabled`);\n } else if (\n isNonEmptyString(options.headers?.authorization) ||\n isNonEmptyString(options.password) ||\n isNonEmptyString(options.token)\n ) {\n logger.once.debug(`hostRules: authentication already set for ${host}`);\n logger.trace({ url }, `Authorization already set`);\n } else if (password !== undefined) {\n logger.once.debug(`hostRules: applying Basic authentication for ${host}`);\n logger.trace({ url }, `Applying Basic authentication`);\n options.username = username;\n options.password = password;\n } else if (token) {\n logger.once.debug(`hostRules: applying Bearer authentication for ${host}`);\n logger.trace({ url }, `Applying Bearer authentication`);\n options.token = token;\n options.context = { ...options.context, authType };\n } else {\n logger.once.debug(`hostRules: no authentication for ${host}`);\n }\n // Apply optional params\n if (hostRule.abortOnError) {\n options.abortOnError = hostRule.abortOnError;\n }\n\n if (hostRule.abortIgnoreStatusCodes) {\n options.abortIgnoreStatusCodes = hostRule.abortIgnoreStatusCodes;\n }\n\n if (hostRule.timeout) {\n options.timeout = hostRule.timeout;\n }\n\n if (hostRule.headers) {\n const allowedHeaders = GlobalConfig.get('allowedHeaders');\n const filteredHeaders: Record<string, string> = {};\n\n for (const [header, value] of Object.entries(hostRule.headers)) {\n if (matchRegexOrGlobList(header, allowedHeaders)) {\n filteredHeaders[header] = value;\n } else {\n logger.once.error(\n { allowedHeaders, header },\n 'Disallowed hostRules headers',\n );\n }\n }\n\n options.headers = {\n ...options.headers,\n ...filteredHeaders,\n };\n }\n\n if (hostRule.keepAlive) {\n options.agent = keepAliveAgents;\n }\n\n if (!hasProxy() && hostRule.enableHttp2 === true) {\n options.http2 = true;\n }\n\n if (isNonEmptyString(hostRule.httpsCertificateAuthority)) {\n options.https = {\n ...options.https,\n certificateAuthority: hostRule.httpsCertificateAuthority,\n };\n }\n\n if (isNonEmptyString(hostRule.httpsPrivateKey)) {\n options.https = {\n ...options.https,\n key: hostRule.httpsPrivateKey,\n };\n }\n\n if (isNonEmptyString(hostRule.httpsCertificate)) {\n options.https = {\n ...options.https,\n certificate: hostRule.httpsCertificate,\n };\n }\n\n return options;\n}\n"],"mappings":";;;;;;;;;;AAwCA,SAAgB,iBACd,KACA,SACU;CACV,MAAM,EAAE,UAAU,aAAa;CAC/B,IAAI,MAAMA,KAAe;EAAE;EAAU;EAAK;CAAS,CAAC;C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O,KAAK,MACV;GAAE;GAAgB;EAAO,GACzB,8BACF;EAIJ,QAAQ,UAAU;GAChB,GAAG,QAAQ;GACX,GAAG;EACL;CACF;CAEA,IAAI,SAAS,WACX,QAAQ,QAAQ;CAGlB,IAAI,CAAC,SAAS,KAAK,SAAS,gBAAgB,MAC1C,QAAQ,QAAQ;CAGlB,IAAI,iBAAiB,SAAS,yBAAyB,GACrD,QAAQ,QAAQ;EACd,GAAG,QAAQ;EACX,sBAAsB,SAAS;CACjC;CAGF,IAAI,iBAAiB,SAAS,eAAe,GAC3C,QAAQ,QAAQ;EACd,GAAG,QAAQ;EACX,KAAK,SAAS;CAChB;CAGF,IAAI,iBAAiB,SAAS,gBAAgB,GAC5C,QAAQ,QAAQ;EACd,GAAG,QAAQ;EACX,aAAa,SAAS;CACxB;CAGF,OAAO;AACT"}
1
+ {"version":3,"file":"host-rules.js","names":["hostRules.find"],"sources":["../../../lib/util/http/host-rules.ts"],"sourcesContent":["import { isNonEmptyString } from '@sindresorhus/is';\nimport { GlobalConfig } from '../../config/global.ts';\nimport {\n BITBUCKET_API_USING_HOST_TYPES,\n BITBUCKET_SERVER_API_USING_HOST_TYPES,\n FORGEJO_API_USING_HOST_TYPES,\n GITEA_API_USING_HOST_TYPES,\n GITHUB_API_USING_HOST_TYPES,\n GITLAB_API_USING_HOST_TYPES,\n} from '../../constants/index.ts';\nimport { logger } from '../../logger/index.ts';\nimport { hasProxy } from '../../proxy.ts';\nimport type { HostRule } from '../../types/index.ts';\nimport * as hostRules from '../host-rules.ts';\nimport { matchRegexOrGlobList } from '../string-match.ts';\nimport { parseUrl } from '../url.ts';\nimport type { InternalHttpOptions } from './http.ts';\nimport { keepAliveAgents } from './keep-alive.ts';\nimport type { GotOptions } from './types.ts';\n\nexport type HostRulesGotOptions = Pick<\n GotOptions & InternalHttpOptions,\n | 'hostType'\n | 'noAuth'\n | 'headers'\n | 'token'\n | 'username'\n | 'password'\n | 'context'\n | 'enabled'\n | 'abortOnError'\n | 'abortIgnoreStatusCodes'\n | 'timeout'\n | 'agent'\n | 'http2'\n | 'https'\n | 'readOnly'\n>;\n\nexport function findMatchingRule<GotOptions extends HostRulesGotOptions>(\n url: string,\n options: GotOptions,\n): HostRule {\n const { hostType, readOnly } = options;\n let res = hostRules.find({ hostType, url, readOnly });\n\n if (\n isNonEmptyString(res.token) ||\n isNonEmptyString(res.username) ||\n isNonEmptyString(res.password)\n ) {\n // do not fallback if we already have auth infos\n return res;\n }\n\n // Fallback to `github` hostType\n if (\n hostType &&\n GITHUB_API_USING_HOST_TYPES.includes(hostType) &&\n hostType !== 'github'\n ) {\n res = {\n ...hostRules.find({\n hostType: 'github',\n url,\n }),\n ...res,\n };\n }\n\n const platform = GlobalConfig.get('platform');\n const platformEndpoint = GlobalConfig.get('endpoint');\n\n // in the case that an API URL is used for GitHub.com, fallback to `github` hostType, and use the `url`'s host to find a `matchHost: api.github.com` (or `matchHost: github.com`)\n if (url.startsWith('https://api.github.com/')) {\n res = {\n ...hostRules.find({\n hostType: 'github',\n url,\n }),\n ...res,\n };\n } else if (platform === 'github' && platformEndpoint) {\n // Fallback to `github` hostType when the request URL targets the same host\n // as the configured GitHub platform endpoint.\n //\n // This covers GitHub Enterprise Server without hardcoding URLs.\n const requestHost = parseUrl(url)?.hostname;\n const endpointHost = parseUrl(platformEndpoint)?.hostname;\n if (requestHost && endpointHost && requestHost === endpointHost) {\n res = {\n ...hostRules.find({ hostType: 'github', url }),\n ...res,\n };\n }\n }\n\n // Fallback to `gitlab` hostType\n if (\n hostType &&\n GITLAB_API_USING_HOST_TYPES.includes(hostType) &&\n hostType !== 'gitlab'\n ) {\n res = {\n ...hostRules.find({\n hostType: 'gitlab',\n url,\n }),\n ...res,\n };\n }\n\n // Fallback to `bitbucket` hostType\n if (\n hostType &&\n BITBUCKET_API_USING_HOST_TYPES.includes(hostType) &&\n hostType !== 'bitbucket'\n ) {\n res = {\n ...hostRules.find({\n hostType: 'bitbucket',\n url,\n }),\n ...res,\n };\n }\n\n // Fallback to `bitbucket-server` hostType\n if (\n hostType &&\n BITBUCKET_SERVER_API_USING_HOST_TYPES.includes(hostType) &&\n hostType !== 'bitbucket-server'\n ) {\n res = {\n ...hostRules.find({\n hostType: 'bitbucket-server',\n url,\n }),\n ...res,\n };\n }\n\n // Fallback to `forgejo` hostType\n if (\n hostType &&\n FORGEJO_API_USING_HOST_TYPES.includes(hostType) &&\n hostType !== 'forgejo'\n ) {\n res = {\n ...hostRules.find({\n hostType: 'forgejo',\n url,\n }),\n ...res,\n };\n }\n\n // Fallback to `gitea` hostType\n if (\n hostType &&\n GITEA_API_USING_HOST_TYPES.includes(hostType) &&\n hostType !== 'gitea'\n ) {\n res = {\n ...hostRules.find({\n hostType: 'gitea',\n url,\n }),\n ...res,\n };\n }\n\n return res;\n}\n\n// Apply host rules to requests\nexport function applyHostRule<GotOptions extends HostRulesGotOptions>(\n url: string,\n options: GotOptions,\n hostRule: HostRule,\n): GotOptions {\n if (hostRule.enabled === false) {\n options.enabled = false;\n return options;\n }\n\n const { username, password, token, authType } = hostRule;\n const host = parseUrl(url)?.host;\n if (options.noAuth) {\n logger.trace({ url }, `Authorization disabled`);\n } else if (\n isNonEmptyString(options.headers?.authorization) ||\n isNonEmptyString(options.password) ||\n isNonEmptyString(options.token)\n ) {\n logger.once.debug(`hostRules: authentication already set for ${host}`);\n logger.trace({ url }, `Authorization already set`);\n } else if (password !== undefined) {\n logger.once.debug(`hostRules: applying Basic authentication for ${host}`);\n logger.trace({ url }, `Applying Basic authentication`);\n options.username = username;\n options.password = password;\n } else if (token) {\n logger.once.debug(`hostRules: applying Bearer authentication for ${host}`);\n logger.trace({ url }, `Applying Bearer authentication`);\n options.token = token;\n options.context = { ...options.context, authType };\n } else {\n logger.once.debug(`hostRules: no authentication for ${host}`);\n }\n // Apply optional params\n if (hostRule.abortOnError) {\n options.abortOnError = hostRule.abortOnError;\n }\n\n if (hostRule.abortIgnoreStatusCodes) {\n options.abortIgnoreStatusCodes = hostRule.abortIgnoreStatusCodes;\n }\n\n if (hostRule.timeout) {\n options.timeout = hostRule.timeout;\n }\n\n if (hostRule.headers) {\n const allowedHeaders = GlobalConfig.get('allowedHeaders');\n const filteredHeaders: Record<string, string> = {};\n\n for (const [header, value] of Object.entries(hostRule.headers)) {\n if (matchRegexOrGlobList(header, allowedHeaders)) {\n filteredHeaders[header] = value;\n } else {\n logger.once.error(\n { allowedHeaders, header },\n 'Disallowed hostRules headers',\n );\n }\n }\n\n options.headers = {\n ...options.headers,\n ...filteredHeaders,\n };\n }\n\n if (hostRule.keepAlive) {\n options.agent = keepAliveAgents;\n }\n\n if (!hasProxy() && hostRule.enableHttp2 === true) {\n options.http2 = true;\n }\n\n if (isNonEmptyString(hostRule.httpsCertificateAuthority)) {\n options.https = {\n ...options.https,\n certificateAuthority: hostRule.httpsCertificateAuthority,\n };\n }\n\n if (isNonEmptyString(hostRule.httpsPrivateKey)) {\n options.https = {\n ...options.https,\n key: hostRule.httpsPrivateKey,\n };\n }\n\n if (isNonEmptyString(hostRule.httpsCertificate)) {\n options.https = {\n ...options.https,\n certificate: hostRule.httpsCertificate,\n };\n }\n\n return options;\n}\n"],"mappings":";;;;;;;;;;AAuCA,SAAgB,iBACd,KACA,SACU;CACV,MAAM,EAAE,UAAU,aAAa;CAC/B,IAAI,MAAMA,KAAe;EAAE;EAAU;EAAK;CAAS,CAAC;CAEpD,IACE,iBAAiB,IAAI,KAAK,KAC1B,iBAAiB,IAAI,QAAQ,KAC7B,iBAAiB,IAAI,QAAQ,GAG7B,OAAO;CAIT,IACE,YACA,4BAA4B,SAAS,QAAQ,KAC7C,aAAa,UAEb,MAAM;EACJ,GAAGA,KAAe;GAChB,UAAU;GACV;EACF,CAAC;EACD,GAAG;CACL;CAGF,MAAM,WAAW,aAAa,IAAI,UAAU;CAC5C,MAAM,mBAAmB,aAAa,IAAI,UAAU;CAGpD,IAAI,IAAI,WAAW,yBAAyB,GAC1C,MAAM;EACJ,GAAGA,KAAe;GAChB,UAAU;G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ACX,KAAK,SAAS;CAChB;CAGF,IAAI,iBAAiB,SAAS,gBAAgB,GAC5C,QAAQ,QAAQ;EACd,GAAG,QAAQ;EACX,aAAa,SAAS;CACxB;CAGF,OAAO;AACT"}
@@ -30,10 +30,10 @@ declare abstract class HttpBase<JSONOpts extends HttpOptions = HttpOptions, Opts
30
30
  protected handleResponse(_url: URL, _res: HttpResponse<unknown>): void;
31
31
  resolveUrl(requestUrl: string | URL, options?: HttpOptions): URL;
32
32
  protected calculateRetryDelay({ computedValue }: RetryObject): number;
33
- get(url: string, options?: HttpOptions): Promise<HttpResponse<string | Buffer>>;
33
+ get(url: string, options?: HttpOptions): Promise<HttpResponse<string | Uint8Array>>;
34
34
  head(url: string, options?: HttpOptions): Promise<HttpResponse<never>>;
35
35
  getText(url: string | URL, options?: HttpOptions): Promise<HttpResponse>;
36
- getBuffer(url: string | URL, options?: HttpOptions): Promise<HttpResponse<Buffer>>;
36
+ getBuffer(url: string | URL, options?: HttpOptions): Promise<HttpResponse<Uint8Array>>;
37
37
  protected requestJsonUnsafe<ResT>(method: HttpMethod, { url, httpOptions: requestOptions }: InternalJsonUnsafeOptions<JSONOpts>): Promise<HttpResponse<ResT>>;
38
38
  private requestJson;
39
39
  private resolveArgs;
@@ -44,7 +44,8 @@ var HttpBase = class {
44
44
  retry: {
45
45
  calculateDelay: (retryObject) => this.calculateRetryDelay(retryObject),
46
46
  limit: retryLimit,
47
- maxRetryAfter: 0
47
+ maxRetryAfter: 0,
48
+ enforceRetryRules: false
48
49
  }
49
50
  }, { isMergeableObject: isPlainObject });
50
51
  }
@@ -1 +1 @@
1
- {"version":3,"file":"http.js","names":["memCache.get"],"sources":["../../../lib/util/http/http.ts"],"sourcesContent":["import { isPlainObject, isUndefined } from '@sindresorhus/is';\nimport merge from 'deepmerge';\nimport type { Options, OptionsInit, RetryObject } from 'got';\nimport type { Merge, SetRequired } from 'type-fest';\nimport type { z } from 'zod/v4';\nimport { ZodType } from 'zod/v4';\nimport { GlobalConfig } from '../../config/global.ts';\nimport { HOST_DISABLED } from '../../constants/error-messages.ts';\nimport { logger } from '../../logger/index.ts';\nimport { ExternalHostError } from '../../types/errors/external-host-error.ts';\nimport * as memCache from '../cache/memory/index.ts';\nimport { getEnv } from '../env.ts';\nimport { hash } from '../hash.ts';\nimport { acquireLock } from '../mutex.ts';\nimport { coerceObject } from '../object.ts';\nimport { type AsyncResult, Result } from '../result.ts';\nimport { Toml } from '../schema-utils/index.ts';\nimport { ObsoleteCacheHitLogger } from '../stats.ts';\nimport { compile } from '../template/index.ts';\nimport { isHttpUrl, parseUrl, resolveBaseUrl } from '../url.ts';\nimport { parseSingleYaml } from '../yaml.ts';\nimport { applyAuthorization } from './auth.ts';\nimport type { HttpCacheProvider } from './cache/types.ts';\nimport { fetch, normalize, stream } from './got.ts';\nimport { applyHostRule, findMatchingRule } from './host-rules.ts';\nimport { getQueue } from './queue.ts';\nimport { getRetryAfter, wrapWithRetry } from './retry-after.ts';\nimport { getThrottle } from './throttle.ts';\nimport type {\n GotOptions,\n GotStreamOptions,\n GotTask,\n HttpMethod,\n HttpOptions,\n HttpResponse,\n SafeJsonError,\n} from './types.ts';\nimport { copyResponse } from './util.ts';\n\nexport interface InternalJsonUnsafeOptions<\n Opts extends HttpOptions = HttpOptions,\n> {\n url: string | URL;\n httpOptions?: Opts;\n}\n\nexport interface InternalJsonOptions<\n Opts extends HttpOptions,\n ResT = unknown,\n Schema extends ZodType<ResT, any> = ZodType<ResT, any>,\n> extends InternalJsonUnsafeOptions<Opts> {\n schema?: Schema;\n}\n\nexport type InternalGotOptions = SetRequired<GotOptions, 'method' | 'context'>;\n\nexport interface InternalHttpOptions extends HttpOptions {\n json?: HttpOptions['body'];\n\n method?: HttpMethod;\n\n parseJson?: Options['parseJson'];\n}\n\nexport function applyDefaultHeaders(options: OptionsInit): void {\n const userAgentTemplate = GlobalConfig.get('userAgent');\n options.headers = {\n ...options.headers,\n 'user-agent': compile(userAgentTemplate, {}),\n };\n}\n\nexport abstract class HttpBase<\n JSONOpts extends HttpOptions = HttpOptions,\n Opts extends HttpOptions = HttpOptions,\n> {\n private readonly options: InternalGotOptions;\n\n protected get baseUrl(): string | undefined {\n return undefined;\n }\n\n protected hostType: string;\n\n constructor(hostType: string, options: HttpOptions = {}) {\n this.hostType = hostType;\n const retryLimit = getEnv().NODE_ENV === 'test' ? 0 : 2;\n this.options = merge<InternalGotOptions>(\n options,\n {\n method: 'get',\n context: { hostType },\n retry: {\n calculateDelay: (retryObject) =>\n this.calculateRetryDelay(retryObject),\n limit: retryLimit,\n maxRetryAfter: 0, // Don't rely on `got` retry-after handling, just let it fail and then we'll handle it\n },\n },\n { isMergeableObject: isPlainObject },\n );\n }\n\n private async request(\n requestUrl: string | URL,\n httpOptions: InternalHttpOptions,\n ): Promise<HttpResponse>;\n private async request(\n requestUrl: string | URL,\n httpOptions: InternalHttpOptions & { responseType: 'text' },\n ): Promise<HttpResponse>;\n private async request(\n requestUrl: string | URL,\n httpOptions: InternalHttpOptions & { responseType: 'buffer' },\n ): Promise<HttpResponse<Buffer>>;\n private async request<T = unknown>(\n requestUrl: string | URL,\n httpOptions: InternalHttpOptions & { responseType: 'json' },\n ): Promise<HttpResponse<T>>;\n\n private async request(\n requestUrl: string | URL,\n httpOptions: InternalHttpOptions,\n ): Promise<HttpResponse<unknown>> {\n const resolvedUrl = this.resolveUrl(requestUrl, httpOptions);\n const url = resolvedUrl.toString();\n\n this.processOptions(resolvedUrl, httpOptions);\n\n let options = merge<InternalGotOptions, InternalHttpOptions>(\n {\n ...this.options,\n hostType: this.hostType,\n },\n httpOptions,\n { isMergeableObject: isPlainObject },\n );\n\n const method = options.method.toLowerCase();\n const isReadMethod = ['head', 'get'].includes(method);\n\n logger.trace(`HTTP request: ${method.toUpperCase()} ${url}`);\n\n applyDefaultHeaders(options);\n\n if (isUndefined(options.readOnly) && isReadMethod) {\n options.readOnly = true;\n }\n\n const hostRule = findMatchingRule(url, options);\n options = applyHostRule(url, options, hostRule);\n if (options.enabled === false) {\n logger.debug(`Host is disabled - rejecting request. HostUrl: ${url}`);\n throw new Error(HOST_DISABLED);\n }\n options = applyAuthorization(options);\n const timeout = options.timeout ?? 60000;\n options.timeout = timeout;\n\n let cacheProvider: HttpCacheProvider | undefined;\n if (isReadMethod && options.cacheProvider) {\n cacheProvider = options.cacheProvider;\n }\n\n const memCacheKey =\n !process.env.RENOVATE_X_DISABLE_HTTP_MEMCACHE &&\n !cacheProvider &&\n options.memCache !== false &&\n isReadMethod\n ? hash(\n `got-${JSON.stringify({\n url,\n headers: options.headers,\n method,\n })}`,\n )\n : null;\n\n let resPromise: Promise<HttpResponse<unknown>> | null = null;\n\n // Cache GET requests unless memCache=false\n if (memCacheKey) {\n resPromise = memCache.get(memCacheKey);\n\n /* v8 ignore next: temporary code */\n if (resPromise && !cacheProvider) {\n ObsoleteCacheHitLogger.write(url);\n }\n }\n\n // v8 ignore else -- TODO: add test #40625\n if (!resPromise) {\n if (cacheProvider) {\n await cacheProvider.setCacheHeaders(method, url, options);\n }\n\n const startTime = Date.now();\n const httpTask: GotTask = async () => {\n let releaseLock: undefined | (() => void);\n if (isReadMethod) {\n releaseLock = await acquireLock(\n `${options.method} ${url}`,\n 'http-mutex',\n timeout * 2,\n );\n }\n try {\n const cachedResponse = await cacheProvider?.bypassServer<unknown>(\n options.method,\n url,\n );\n if (cachedResponse) {\n return cachedResponse;\n }\n\n const queueMs = Date.now() - startTime;\n return fetch(url, this._normalizeOptions(options), {\n queueMs,\n });\n } finally {\n releaseLock?.();\n }\n };\n\n const throttle = getThrottle(url);\n const throttledTask = throttle ? () => throttle.add(httpTask) : httpTask;\n\n const queue = getQueue(url);\n const queuedTask = queue ? () => queue.add(throttledTask) : throttledTask;\n\n const { maxRetryAfter = 60 } = hostRule;\n resPromise = wrapWithRetry(queuedTask, url, getRetryAfter, maxRetryAfter);\n\n if (memCacheKey) {\n memCache.set(memCacheKey, resPromise);\n }\n }\n\n try {\n const res = await resPromise;\n const deepCopyNeeded = !!memCacheKey && res.statusCode !== 304;\n const resCopy = copyResponse(res, deepCopyNeeded);\n resCopy.authorization = !!options?.headers?.authorization;\n\n this.handleResponse(resolvedUrl, resCopy);\n\n if (cacheProvider) {\n return await cacheProvider.wrapServerResponse(method, url, resCopy);\n }\n\n return resCopy;\n } catch (err) {\n const { abortOnError, abortIgnoreStatusCodes } = options;\n if (abortOnError && !abortIgnoreStatusCodes?.includes(err.statusCode)) {\n throw new ExternalHostError(err);\n }\n\n const staleResponse = await cacheProvider?.bypassServer<string | Buffer>(\n method,\n url,\n true,\n );\n if (staleResponse) {\n logger.debug(\n { err },\n `Request error: returning stale cache instead for ${url}`,\n );\n return staleResponse;\n }\n\n this.handleError(requestUrl, httpOptions, err);\n }\n }\n\n private _normalizeOptions<T extends OptionsInit>(options: T): T {\n return normalize(options, this.extraOptions());\n }\n\n /**\n * Returns Renovate extra options which needs to be removed before passing to got.\n * @returns extra Renovate options.\n */\n protected extraOptions(): readonly string[] {\n return ['baseUrl', 'cacheProvider', 'readOnly'] as (keyof HttpOptions)[];\n }\n\n protected processOptions(_url: URL, _options: InternalHttpOptions): void {\n // noop\n }\n\n protected handleError(\n _url: string | URL,\n _httpOptions: HttpOptions,\n err: Error,\n ): never {\n throw err;\n }\n\n protected handleResponse(_url: URL, _res: HttpResponse<unknown>): void {\n // noop\n }\n\n resolveUrl(requestUrl: string | URL, options?: HttpOptions): URL {\n let url = requestUrl;\n\n if (url instanceof URL) {\n // already a aboslute URL\n return url;\n }\n\n const baseUrl = options?.baseUrl ?? this.baseUrl;\n if (baseUrl) {\n url = resolveBaseUrl(baseUrl, url);\n }\n\n const parsedUrl = parseUrl(url);\n if (!parsedUrl || !isHttpUrl(parsedUrl)) {\n logger.error(\n { url: requestUrl, baseUrl, resolvedUrl: url },\n 'Request Error: cannot parse url',\n );\n throw new Error('Invalid URL');\n }\n return parsedUrl;\n }\n\n protected calculateRetryDelay({ computedValue }: RetryObject): number {\n return computedValue;\n }\n\n get(\n url: string,\n options: HttpOptions = {},\n ): Promise<HttpResponse<string | Buffer>> {\n return this.request(url, options);\n }\n\n head(url: string, options: HttpOptions = {}): Promise<HttpResponse<never>> {\n // to complex to validate\n return this.request(url, {\n ...options,\n responseType: 'text',\n method: 'head',\n }) as Promise<HttpResponse<never>>;\n }\n\n getText(url: string | URL, options: HttpOptions = {}): Promise<HttpResponse> {\n return this.request(url, { ...options, responseType: 'text' });\n }\n\n getBuffer(\n url: string | URL,\n options: HttpOptions = {},\n ): Promise<HttpResponse<Buffer>> {\n return this.request(url, { ...options, responseType: 'buffer' });\n }\n\n protected requestJsonUnsafe<ResT>(\n method: HttpMethod,\n { url, httpOptions: requestOptions }: InternalJsonUnsafeOptions<JSONOpts>,\n ): Promise<HttpResponse<ResT>> {\n const { body: json, ...httpOptions } = { ...requestOptions };\n const opts: InternalHttpOptions = {\n ...httpOptions,\n method,\n };\n // signal that we expect a json response\n opts.headers = {\n accept: 'application/json',\n ...opts.headers,\n };\n if (json) {\n opts.json = json;\n }\n return this.request<ResT>(url, { ...opts, responseType: 'json' });\n }\n\n private async requestJson<\n ResT,\n Schema extends ZodType<ResT, any> = ZodType<ResT, any>,\n >(\n method: HttpMethod,\n options: InternalJsonOptions<JSONOpts, ResT, Schema>,\n ): Promise<HttpResponse<ResT>> {\n const res = await this.requestJsonUnsafe<ResT>(method, options);\n\n if (options.schema) {\n res.body = await options.schema.parseAsync(res.body);\n }\n\n return res;\n }\n\n private resolveArgs<ResT = unknown>(\n arg1: string,\n arg2: JSONOpts | ZodType<ResT> | undefined,\n arg3: ZodType<ResT> | undefined,\n ): InternalJsonOptions<JSONOpts, ResT> {\n const res: InternalJsonOptions<JSONOpts, ResT> = { url: arg1 };\n\n if (arg2 instanceof ZodType) {\n res.schema = arg2;\n } else if (arg2) {\n res.httpOptions = arg2;\n }\n\n if (arg3) {\n res.schema = arg3;\n }\n\n return res;\n }\n\n async getPlain(url: string, options?: Opts): Promise<HttpResponse> {\n const opt = coerceObject(options);\n return await this.getText(url, {\n headers: {\n Accept: 'text/plain',\n },\n ...opt,\n });\n }\n\n /**\n * @deprecated use `getYaml` instead\n */\n async getYamlUnchecked<ResT>(\n url: string,\n options?: Opts,\n ): Promise<HttpResponse<ResT>> {\n const res = await this.getText(url, options);\n const body = parseSingleYaml<ResT>(res.body);\n return { ...res, body };\n }\n\n async getYaml<Schema extends ZodType<any, any, any>>(\n url: string,\n schema: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>>;\n async getYaml<Schema extends ZodType<any, any, any>>(\n url: string,\n options: Opts,\n schema: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>>;\n async getYaml<Schema extends ZodType<any, any, any>>(\n arg1: string,\n arg2?: Opts | Schema,\n arg3?: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>> {\n const url = arg1;\n let schema: Schema;\n let httpOptions: Opts | undefined;\n if (arg3) {\n schema = arg3;\n httpOptions = arg2 as Opts;\n } else {\n schema = arg2 as Schema;\n }\n\n const opts: InternalHttpOptions = {\n ...httpOptions,\n method: 'get',\n };\n\n const res = await this.getText(url, opts);\n const body = await schema.parseAsync(parseSingleYaml(res.body));\n return { ...res, body };\n }\n\n getYamlSafe<\n ResT extends NonNullable<unknown>,\n Schema extends ZodType<ResT> = ZodType<ResT>,\n >(url: string, schema: Schema): AsyncResult<z.infer<Schema>, SafeJsonError>;\n getYamlSafe<\n ResT extends NonNullable<unknown>,\n Schema extends ZodType<ResT> = ZodType<ResT>,\n >(\n url: string,\n options: Opts,\n schema: Schema,\n ): AsyncResult<z.infer<Schema>, SafeJsonError>;\n getYamlSafe<\n ResT extends NonNullable<unknown>,\n Schema extends ZodType<ResT> = ZodType<ResT>,\n >(\n arg1: string,\n arg2: Opts | Schema,\n arg3?: Schema,\n ): AsyncResult<ResT, SafeJsonError> {\n const url = arg1;\n let schema: Schema;\n let httpOptions: Opts | undefined;\n if (arg3) {\n schema = arg3;\n httpOptions = arg2 as Opts;\n } else {\n schema = arg2 as Schema;\n }\n\n let res: AsyncResult<HttpResponse<ResT>, SafeJsonError>;\n if (httpOptions) {\n res = Result.wrap(this.getYaml(url, httpOptions, schema));\n } else {\n res = Result.wrap(this.getYaml(url, schema));\n }\n\n return res.transform((response) => Result.ok(response.body));\n }\n\n /**\n * Request JSON and return the response without any validation.\n *\n * The usage of this method is discouraged, please use `getJson` instead.\n *\n * If you're new to Zod schema validation library:\n * - consult the [documentation of Zod library](https://github.com/colinhacks/zod?tab=readme-ov-file#basic-usage)\n * - search the Renovate codebase for 'zod' module usage\n * - take a look at the `schema-utils.ts` file for Renovate-specific schemas and utilities\n */\n getJsonUnchecked<ResT = unknown>(\n url: string,\n options?: JSONOpts,\n ): Promise<HttpResponse<ResT>> {\n return this.requestJson<ResT>('get', { url, httpOptions: options });\n }\n\n /**\n * Request JSON with a Zod schema for the response,\n * throwing an error if the response is not valid.\n *\n * @param url\n * @param schema Zod schema for the response\n */\n getJson<Schema extends ZodType<any, any, any>>(\n url: string,\n schema: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>>;\n getJson<Schema extends ZodType<any, any, any>>(\n url: string,\n options: JSONOpts,\n schema: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>>;\n getJson<Schema extends ZodType<any, any, any>>(\n arg1: string,\n arg2?: JSONOpts | Schema,\n arg3?: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>> {\n const args = this.resolveArgs<z.infer<Schema>>(arg1, arg2, arg3);\n return this.requestJson<z.infer<Schema>>('get', args);\n }\n\n /**\n * Request JSON with a Zod schema for the response,\n * wrapping response data in a `Result` class.\n *\n * @param url\n * @param schema Zod schema for the response\n */\n getJsonSafe<ResT extends NonNullable<unknown>, Schema extends ZodType<ResT>>(\n url: string,\n schema: Schema,\n ): AsyncResult<z.infer<Schema>, SafeJsonError>;\n getJsonSafe<ResT extends NonNullable<unknown>, Schema extends ZodType<ResT>>(\n url: string,\n options: JSONOpts,\n schema: Schema,\n ): AsyncResult<z.infer<Schema>, SafeJsonError>;\n getJsonSafe<ResT extends NonNullable<unknown>, Schema extends ZodType<ResT>>(\n arg1: string,\n arg2?: JSONOpts | Schema,\n arg3?: Schema,\n ): AsyncResult<ResT, SafeJsonError> {\n const args = this.resolveArgs<ResT>(arg1, arg2, arg3);\n return Result.wrap(this.requestJson<ResT>('get', args)).transform(\n (response) => Result.ok(response.body),\n );\n }\n\n /**\n * @deprecated use `head` instead\n */\n headJson(url: string, httpOptions?: JSONOpts): Promise<HttpResponse<never>> {\n return this.requestJson<never>('head', { url, httpOptions });\n }\n\n postJson<T>(url: string, options?: JSONOpts): Promise<HttpResponse<T>>;\n postJson<T, Schema extends ZodType<T> = ZodType<T>>(\n url: string,\n schema: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>>;\n postJson<T, Schema extends ZodType<T> = ZodType<T>>(\n url: string,\n options: JSONOpts,\n schema: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>>;\n postJson<T = unknown, Schema extends ZodType<T> = ZodType<T>>(\n arg1: string,\n arg2?: JSONOpts | Schema,\n arg3?: Schema,\n ): Promise<HttpResponse<T>> {\n const args = this.resolveArgs(arg1, arg2, arg3);\n return this.requestJson<T>('post', args);\n }\n\n putJson<T>(url: string, options?: JSONOpts): Promise<HttpResponse<T>>;\n putJson<T, Schema extends ZodType<T> = ZodType<T>>(\n url: string,\n schema: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>>;\n putJson<T, Schema extends ZodType<T> = ZodType<T>>(\n url: string,\n options: JSONOpts,\n schema: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>>;\n putJson<T = unknown, Schema extends ZodType<T> = ZodType<T>>(\n arg1: string,\n arg2?: JSONOpts | Schema,\n arg3?: Schema,\n ): Promise<HttpResponse<T>> {\n const args = this.resolveArgs<T>(arg1, arg2, arg3);\n return this.requestJson<T>('put', args);\n }\n\n patchJson<T>(url: string, options?: JSONOpts): Promise<HttpResponse<T>>;\n patchJson<T, Schema extends ZodType<T> = ZodType<T>>(\n url: string,\n schema: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>>;\n patchJson<T, Schema extends ZodType<T> = ZodType<T>>(\n url: string,\n options: JSONOpts,\n schema: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>>;\n patchJson<T = unknown, Schema extends ZodType<T> = ZodType<T>>(\n arg1: string,\n arg2?: JSONOpts | Schema,\n arg3?: Schema,\n ): Promise<HttpResponse<T>> {\n const args = this.resolveArgs(arg1, arg2, arg3);\n return this.requestJson<T>('patch', args);\n }\n\n deleteJson<T>(url: string, options?: JSONOpts): Promise<HttpResponse<T>>;\n deleteJson<T, Schema extends ZodType<T> = ZodType<T>>(\n url: string,\n schema: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>>;\n deleteJson<T, Schema extends ZodType<T> = ZodType<T>>(\n url: string,\n options: JSONOpts,\n schema: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>>;\n deleteJson<T = unknown, Schema extends ZodType<T> = ZodType<T>>(\n arg1: string,\n arg2?: JSONOpts | Schema,\n arg3?: Schema,\n ): Promise<HttpResponse<T>> {\n const args = this.resolveArgs(arg1, arg2, arg3);\n return this.requestJson<T>('delete', args);\n }\n\n stream(url: string, options?: HttpOptions): NodeJS.ReadableStream {\n let combinedOptions: Merge<\n GotStreamOptions,\n SetRequired<InternalHttpOptions, 'method'>\n > = {\n ...this.options,\n hostType: this.hostType,\n ...options,\n method: 'get',\n };\n\n const resolvedUrl = this.resolveUrl(url, options).toString();\n\n applyDefaultHeaders(combinedOptions);\n\n // v8 ignore else -- TODO: add test #40625\n if (\n isUndefined(combinedOptions.readOnly) &&\n ['head', 'get'].includes(combinedOptions.method)\n ) {\n combinedOptions.readOnly = true;\n }\n\n const hostRule = findMatchingRule(url, combinedOptions);\n combinedOptions = applyHostRule(resolvedUrl, combinedOptions, hostRule);\n if (combinedOptions.enabled === false) {\n throw new Error(HOST_DISABLED);\n }\n combinedOptions = applyAuthorization(combinedOptions);\n\n return stream(resolvedUrl, this._normalizeOptions(combinedOptions));\n }\n\n async getToml<Schema extends ZodType<any, any, any>>(\n url: string,\n schema?: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>>;\n async getToml<Schema extends ZodType<any, any, any>>(\n url: string,\n options: JSONOpts,\n schema: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>>;\n async getToml<Schema extends ZodType<any, any, any>>(\n arg1: string,\n arg2?: JSONOpts | Schema,\n arg3?: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>> {\n const { url, schema, httpOptions } = this.resolveArgs<z.infer<Schema>>(\n arg1,\n arg2,\n arg3,\n );\n\n const opts: InternalHttpOptions = {\n ...httpOptions,\n method: 'get',\n headers: {\n 'Content-Type': 'application/toml',\n ...httpOptions?.headers,\n },\n };\n\n const res = await this.getText(url, opts);\n if (schema) {\n res.body = await Toml.pipe(schema).parseAsync(res.body);\n } else {\n res.body = (await Toml.parseAsync(res.body)) as z.infer<Schema>;\n }\n\n return res as HttpResponse<z.infer<Schema>>;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAgEA,SAAgB,oBAAoB,SAA4B;CAC9D,MAAM,oBAAoB,aAAa,IAAI,WAAW;CACtD,QAAQ,UAAU;EAChB,GAAG,QAAQ;EACX,cAAc,QAAQ,mBAAmB,CAAC,CAAC;CAC7C;AACF;AAEA,IAAsB,WAAtB,MAGE;CACA;CAEA,IAAc,UAA8B,CAE5C;CAEA;CAEA,YAAY,UAAkB,UAAuB,CAAC,GAAG;EACvD,KAAK,WAAW;EAChB,MAAM,aAAa,OAAO,CAAC,CAAC,aAAa,SAAS,IAAI;EACtD,KAAK,UAAU,MACb,SACA;GACE,QAAQ;GACR,SAAS,EAAE,SAAS;GACpB,OAAO;IACL,iBAAiB,gBACf,KAAK,oBAAoB,WAAW;IACtC,OAAO;IACP,eAAe;GACjB;EACF,GACA,EAAE,mBAAmB,cAAc,CACrC;CACF;CAmBA,MAAc,QACZ,YACA,aACgC;EAChC,MAAM,cAAc,KAAK,WAAW,YAAY,WAAW;EAC3D,MAAM,M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WAAW,KAAK,OAAO,CAAC,CAAC,SAAS;EAE3D,oBAAoB,eAAe;;EAGnC,IACE,YAAY,gBAAgB,QAAQ,KACpC,CAAC,QAAQ,KAAK,CAAC,CAAC,SAAS,gBAAgB,MAAM,GAE/C,gBAAgB,WAAW;EAG7B,MAAM,WAAW,iBAAiB,KAAK,eAAe;EACtD,kBAAkB,cAAc,aAAa,iBAAiB,QAAQ;EACtE,IAAI,gBAAgB,YAAY,OAC9B,MAAM,IAAI,MAAM,aAAa;EAE/B,kBAAkB,mBAAmB,eAAe;EAEpD,OAAO,OAAO,aAAa,KAAK,kBAAkB,eAAe,CAAC;CACpE;CAWA,MAAM,QACJ,MACA,MACA,MACwC;EACxC,MAAM,EAAE,KAAK,QAAQ,gBAAgB,KAAK,YACxC,MACA,MACA,IACF;EAEA,MAAM,OAA4B;GAChC,GAAG;GACH,QAAQ;GACR,SAAS;IACP,gBAAgB;IAChB,GAAG,aAAa;GAClB;EACF;EAEA,MAAM,MAAM,MAAM,KAAK,QAAQ,KAAK,IAAI;EACxC,IAAI,QACF,IAAI,OAAO,MAAM,KAAK,KAAK,MAAM,CAAC,CAAC,WAAW,IAAI,IAAI;OAEtD,IAAI,OAAQ,MAAM,KAAK,WAAW,IAAI,IAAI;EAG5C,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"http.js","names":["memCache.get"],"sources":["../../../lib/util/http/http.ts"],"sourcesContent":["import { isPlainObject, isUndefined } from '@sindresorhus/is';\nimport merge from 'deepmerge';\nimport type { Options, OptionsInit, RetryObject } from 'got';\nimport type { Merge, SetRequired } from 'type-fest';\nimport type { z } from 'zod/v4';\nimport { ZodType } from 'zod/v4';\nimport { GlobalConfig } from '../../config/global.ts';\nimport { HOST_DISABLED } from '../../constants/error-messages.ts';\nimport { logger } from '../../logger/index.ts';\nimport { ExternalHostError } from '../../types/errors/external-host-error.ts';\nimport * as memCache from '../cache/memory/index.ts';\nimport { getEnv } from '../env.ts';\nimport { hash } from '../hash.ts';\nimport { acquireLock } from '../mutex.ts';\nimport { coerceObject } from '../object.ts';\nimport { type AsyncResult, Result } from '../result.ts';\nimport { Toml } from '../schema-utils/index.ts';\nimport { ObsoleteCacheHitLogger } from '../stats.ts';\nimport { compile } from '../template/index.ts';\nimport { isHttpUrl, parseUrl, resolveBaseUrl } from '../url.ts';\nimport { parseSingleYaml } from '../yaml.ts';\nimport { applyAuthorization } from './auth.ts';\nimport type { HttpCacheProvider } from './cache/types.ts';\nimport { fetch, normalize, stream } from './got.ts';\nimport { applyHostRule, findMatchingRule } from './host-rules.ts';\nimport { getQueue } from './queue.ts';\nimport { getRetryAfter, wrapWithRetry } from './retry-after.ts';\nimport { getThrottle } from './throttle.ts';\nimport type {\n GotOptions,\n GotStreamOptions,\n GotTask,\n HttpMethod,\n HttpOptions,\n HttpResponse,\n SafeJsonError,\n} from './types.ts';\nimport { copyResponse } from './util.ts';\n\nexport interface InternalJsonUnsafeOptions<\n Opts extends HttpOptions = HttpOptions,\n> {\n url: string | URL;\n httpOptions?: Opts;\n}\n\nexport interface InternalJsonOptions<\n Opts extends HttpOptions,\n ResT = unknown,\n Schema extends ZodType<ResT, any> = ZodType<ResT, any>,\n> extends InternalJsonUnsafeOptions<Opts> {\n schema?: Schema;\n}\n\nexport type InternalGotOptions = SetRequired<GotOptions, 'method' | 'context'>;\n\nexport interface InternalHttpOptions extends HttpOptions {\n json?: HttpOptions['body'];\n\n method?: HttpMethod;\n\n parseJson?: Options['parseJson'];\n}\n\nexport function applyDefaultHeaders(options: OptionsInit): void {\n const userAgentTemplate = GlobalConfig.get('userAgent');\n options.headers = {\n ...options.headers,\n 'user-agent': compile(userAgentTemplate, {}),\n };\n}\n\nexport abstract class HttpBase<\n JSONOpts extends HttpOptions = HttpOptions,\n Opts extends HttpOptions = HttpOptions,\n> {\n private readonly options: InternalGotOptions;\n\n protected get baseUrl(): string | undefined {\n return undefined;\n }\n\n protected hostType: string;\n\n constructor(hostType: string, options: HttpOptions = {}) {\n this.hostType = hostType;\n const retryLimit = getEnv().NODE_ENV === 'test' ? 0 : 2;\n this.options = merge<InternalGotOptions>(\n options,\n {\n method: 'get',\n context: { hostType },\n retry: {\n calculateDelay: (retryObject) =>\n this.calculateRetryDelay(retryObject),\n limit: retryLimit,\n maxRetryAfter: 0, // Don't rely on `got` retry-after handling, just let it fail and then we'll handle it\n enforceRetryRules: false,\n },\n },\n { isMergeableObject: isPlainObject },\n );\n }\n\n private async request(\n requestUrl: string | URL,\n httpOptions: InternalHttpOptions,\n ): Promise<HttpResponse>;\n private async request(\n requestUrl: string | URL,\n httpOptions: InternalHttpOptions & { responseType: 'text' },\n ): Promise<HttpResponse>;\n private async request(\n requestUrl: string | URL,\n httpOptions: InternalHttpOptions & { responseType: 'buffer' },\n ): Promise<HttpResponse<Uint8Array>>;\n private async request<T = unknown>(\n requestUrl: string | URL,\n httpOptions: InternalHttpOptions & { responseType: 'json' },\n ): Promise<HttpResponse<T>>;\n\n private async request(\n requestUrl: string | URL,\n httpOptions: InternalHttpOptions,\n ): Promise<HttpResponse<unknown>> {\n const resolvedUrl = this.resolveUrl(requestUrl, httpOptions);\n const url = resolvedUrl.toString();\n\n this.processOptions(resolvedUrl, httpOptions);\n\n let options = merge<InternalGotOptions, InternalHttpOptions>(\n {\n ...this.options,\n hostType: this.hostType,\n },\n httpOptions,\n { isMergeableObject: isPlainObject },\n );\n\n const method = options.method.toLowerCase();\n const isReadMethod = ['head', 'get'].includes(method);\n\n logger.trace(`HTTP request: ${method.toUpperCase()} ${url}`);\n\n applyDefaultHeaders(options);\n\n if (isUndefined(options.readOnly) && isReadMethod) {\n options.readOnly = true;\n }\n\n const hostRule = findMatchingRule(url, options);\n options = applyHostRule(url, options, hostRule);\n if (options.enabled === false) {\n logger.debug(`Host is disabled - rejecting request. HostUrl: ${url}`);\n throw new Error(HOST_DISABLED);\n }\n options = applyAuthorization(options);\n const timeout = options.timeout ?? 60000;\n options.timeout = timeout;\n\n let cacheProvider: HttpCacheProvider | undefined;\n if (isReadMethod && options.cacheProvider) {\n cacheProvider = options.cacheProvider;\n }\n\n const memCacheKey =\n !process.env.RENOVATE_X_DISABLE_HTTP_MEMCACHE &&\n !cacheProvider &&\n options.memCache !== false &&\n isReadMethod\n ? hash(\n `got-${JSON.stringify({\n url,\n headers: options.headers,\n method,\n })}`,\n )\n : null;\n\n let resPromise: Promise<HttpResponse<unknown>> | null = null;\n\n // Cache GET requests unless memCache=false\n if (memCacheKey) {\n resPromise = memCache.get(memCacheKey);\n\n /* v8 ignore next: temporary code */\n if (resPromise && !cacheProvider) {\n ObsoleteCacheHitLogger.write(url);\n }\n }\n\n // v8 ignore else -- TODO: add test #40625\n if (!resPromise) {\n if (cacheProvider) {\n await cacheProvider.setCacheHeaders(method, url, options);\n }\n\n const startTime = Date.now();\n const httpTask: GotTask = async () => {\n let releaseLock: undefined | (() => void);\n if (isReadMethod) {\n releaseLock = await acquireLock(\n `${options.method} ${url}`,\n 'http-mutex',\n timeout * 2,\n );\n }\n try {\n const cachedResponse = await cacheProvider?.bypassServer<unknown>(\n options.method,\n url,\n );\n if (cachedResponse) {\n return cachedResponse;\n }\n\n const queueMs = Date.now() - startTime;\n return fetch(url, this._normalizeOptions(options), {\n queueMs,\n });\n } finally {\n releaseLock?.();\n }\n };\n\n const throttle = getThrottle(url);\n const throttledTask = throttle ? () => throttle.add(httpTask) : httpTask;\n\n const queue = getQueue(url);\n const queuedTask = queue ? () => queue.add(throttledTask) : throttledTask;\n\n const { maxRetryAfter = 60 } = hostRule;\n resPromise = wrapWithRetry(queuedTask, url, getRetryAfter, maxRetryAfter);\n\n if (memCacheKey) {\n memCache.set(memCacheKey, resPromise);\n }\n }\n\n try {\n const res = await resPromise;\n const deepCopyNeeded = !!memCacheKey && res.statusCode !== 304;\n const resCopy = copyResponse(res, deepCopyNeeded);\n resCopy.authorization = !!options?.headers?.authorization;\n\n this.handleResponse(resolvedUrl, resCopy);\n\n if (cacheProvider) {\n return await cacheProvider.wrapServerResponse(method, url, resCopy);\n }\n\n return resCopy;\n } catch (err) {\n const { abortOnError, abortIgnoreStatusCodes } = options;\n if (abortOnError && !abortIgnoreStatusCodes?.includes(err.statusCode)) {\n throw new ExternalHostError(err);\n }\n\n const staleResponse = await cacheProvider?.bypassServer<\n string | Uint8Array\n >(method, url, true);\n if (staleResponse) {\n logger.debug(\n { err },\n `Request error: returning stale cache instead for ${url}`,\n );\n return staleResponse;\n }\n\n this.handleError(requestUrl, httpOptions, err);\n }\n }\n\n private _normalizeOptions<T extends OptionsInit>(options: T): T {\n return normalize(options, this.extraOptions());\n }\n\n /**\n * Returns Renovate extra options which needs to be removed before passing to got.\n * @returns extra Renovate options.\n */\n protected extraOptions(): readonly string[] {\n return ['baseUrl', 'cacheProvider', 'readOnly'] as (keyof HttpOptions)[];\n }\n\n protected processOptions(_url: URL, _options: InternalHttpOptions): void {\n // noop\n }\n\n protected handleError(\n _url: string | URL,\n _httpOptions: HttpOptions,\n err: Error,\n ): never {\n throw err;\n }\n\n protected handleResponse(_url: URL, _res: HttpResponse<unknown>): void {\n // noop\n }\n\n resolveUrl(requestUrl: string | URL, options?: HttpOptions): URL {\n let url = requestUrl;\n\n if (url instanceof URL) {\n // already a aboslute URL\n return url;\n }\n\n const baseUrl = options?.baseUrl ?? this.baseUrl;\n if (baseUrl) {\n url = resolveBaseUrl(baseUrl, url);\n }\n\n const parsedUrl = parseUrl(url);\n if (!parsedUrl || !isHttpUrl(parsedUrl)) {\n logger.error(\n { url: requestUrl, baseUrl, resolvedUrl: url },\n 'Request Error: cannot parse url',\n );\n throw new Error('Invalid URL');\n }\n return parsedUrl;\n }\n\n protected calculateRetryDelay({ computedValue }: RetryObject): number {\n return computedValue;\n }\n\n get(\n url: string,\n options: HttpOptions = {},\n ): Promise<HttpResponse<string | Uint8Array>> {\n return this.request(url, options);\n }\n\n head(url: string, options: HttpOptions = {}): Promise<HttpResponse<never>> {\n // to complex to validate\n return this.request(url, {\n ...options,\n responseType: 'text',\n method: 'head',\n }) as Promise<HttpResponse<never>>;\n }\n\n getText(url: string | URL, options: HttpOptions = {}): Promise<HttpResponse> {\n return this.request(url, { ...options, responseType: 'text' });\n }\n\n getBuffer(\n url: string | URL,\n options: HttpOptions = {},\n ): Promise<HttpResponse<Uint8Array>> {\n return this.request(url, { ...options, responseType: 'buffer' });\n }\n\n protected requestJsonUnsafe<ResT>(\n method: HttpMethod,\n { url, httpOptions: requestOptions }: InternalJsonUnsafeOptions<JSONOpts>,\n ): Promise<HttpResponse<ResT>> {\n const { body: json, ...httpOptions } = { ...requestOptions };\n const opts: InternalHttpOptions = {\n ...httpOptions,\n method,\n };\n // signal that we expect a json response\n opts.headers = {\n accept: 'application/json',\n ...opts.headers,\n };\n if (json) {\n opts.json = json;\n }\n return this.request<ResT>(url, { ...opts, responseType: 'json' });\n }\n\n private async requestJson<\n ResT,\n Schema extends ZodType<ResT, any> = ZodType<ResT, any>,\n >(\n method: HttpMethod,\n options: InternalJsonOptions<JSONOpts, ResT, Schema>,\n ): Promise<HttpResponse<ResT>> {\n const res = await this.requestJsonUnsafe<ResT>(method, options);\n\n if (options.schema) {\n res.body = await options.schema.parseAsync(res.body);\n }\n\n return res;\n }\n\n private resolveArgs<ResT = unknown>(\n arg1: string,\n arg2: JSONOpts | ZodType<ResT> | undefined,\n arg3: ZodType<ResT> | undefined,\n ): InternalJsonOptions<JSONOpts, ResT> {\n const res: InternalJsonOptions<JSONOpts, ResT> = { url: arg1 };\n\n if (arg2 instanceof ZodType) {\n res.schema = arg2;\n } else if (arg2) {\n res.httpOptions = arg2;\n }\n\n if (arg3) {\n res.schema = arg3;\n }\n\n return res;\n }\n\n async getPlain(url: string, options?: Opts): Promise<HttpResponse> {\n const opt = coerceObject(options);\n return await this.getText(url, {\n headers: {\n Accept: 'text/plain',\n },\n ...opt,\n });\n }\n\n /**\n * @deprecated use `getYaml` instead\n */\n async getYamlUnchecked<ResT>(\n url: string,\n options?: Opts,\n ): Promise<HttpResponse<ResT>> {\n const res = await this.getText(url, options);\n const body = parseSingleYaml<ResT>(res.body);\n return { ...res, body };\n }\n\n async getYaml<Schema extends ZodType<any, any, any>>(\n url: string,\n schema: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>>;\n async getYaml<Schema extends ZodType<any, any, any>>(\n url: string,\n options: Opts,\n schema: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>>;\n async getYaml<Schema extends ZodType<any, any, any>>(\n arg1: string,\n arg2?: Opts | Schema,\n arg3?: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>> {\n const url = arg1;\n let schema: Schema;\n let httpOptions: Opts | undefined;\n if (arg3) {\n schema = arg3;\n httpOptions = arg2 as Opts;\n } else {\n schema = arg2 as Schema;\n }\n\n const opts: InternalHttpOptions = {\n ...httpOptions,\n method: 'get',\n };\n\n const res = await this.getText(url, opts);\n const body = await schema.parseAsync(parseSingleYaml(res.body));\n return { ...res, body };\n }\n\n getYamlSafe<\n ResT extends NonNullable<unknown>,\n Schema extends ZodType<ResT> = ZodType<ResT>,\n >(url: string, schema: Schema): AsyncResult<z.infer<Schema>, SafeJsonError>;\n getYamlSafe<\n ResT extends NonNullable<unknown>,\n Schema extends ZodType<ResT> = ZodType<ResT>,\n >(\n url: string,\n options: Opts,\n schema: Schema,\n ): AsyncResult<z.infer<Schema>, SafeJsonError>;\n getYamlSafe<\n ResT extends NonNullable<unknown>,\n Schema extends ZodType<ResT> = ZodType<ResT>,\n >(\n arg1: string,\n arg2: Opts | Schema,\n arg3?: Schema,\n ): AsyncResult<ResT, SafeJsonError> {\n const url = arg1;\n let schema: Schema;\n let httpOptions: Opts | undefined;\n if (arg3) {\n schema = arg3;\n httpOptions = arg2 as Opts;\n } else {\n schema = arg2 as Schema;\n }\n\n let res: AsyncResult<HttpResponse<ResT>, SafeJsonError>;\n if (httpOptions) {\n res = Result.wrap(this.getYaml(url, httpOptions, schema));\n } else {\n res = Result.wrap(this.getYaml(url, schema));\n }\n\n return res.transform((response) => Result.ok(response.body));\n }\n\n /**\n * Request JSON and return the response without any validation.\n *\n * The usage of this method is discouraged, please use `getJson` instead.\n *\n * If you're new to Zod schema validation library:\n * - consult the [documentation of Zod library](https://github.com/colinhacks/zod?tab=readme-ov-file#basic-usage)\n * - search the Renovate codebase for 'zod' module usage\n * - take a look at the `schema-utils.ts` file for Renovate-specific schemas and utilities\n */\n getJsonUnchecked<ResT = unknown>(\n url: string,\n options?: JSONOpts,\n ): Promise<HttpResponse<ResT>> {\n return this.requestJson<ResT>('get', { url, httpOptions: options });\n }\n\n /**\n * Request JSON with a Zod schema for the response,\n * throwing an error if the response is not valid.\n *\n * @param url\n * @param schema Zod schema for the response\n */\n getJson<Schema extends ZodType<any, any, any>>(\n url: string,\n schema: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>>;\n getJson<Schema extends ZodType<any, any, any>>(\n url: string,\n options: JSONOpts,\n schema: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>>;\n getJson<Schema extends ZodType<any, any, any>>(\n arg1: string,\n arg2?: JSONOpts | Schema,\n arg3?: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>> {\n const args = this.resolveArgs<z.infer<Schema>>(arg1, arg2, arg3);\n return this.requestJson<z.infer<Schema>>('get', args);\n }\n\n /**\n * Request JSON with a Zod schema for the response,\n * wrapping response data in a `Result` class.\n *\n * @param url\n * @param schema Zod schema for the response\n */\n getJsonSafe<ResT extends NonNullable<unknown>, Schema extends ZodType<ResT>>(\n url: string,\n schema: Schema,\n ): AsyncResult<z.infer<Schema>, SafeJsonError>;\n getJsonSafe<ResT extends NonNullable<unknown>, Schema extends ZodType<ResT>>(\n url: string,\n options: JSONOpts,\n schema: Schema,\n ): AsyncResult<z.infer<Schema>, SafeJsonError>;\n getJsonSafe<ResT extends NonNullable<unknown>, Schema extends ZodType<ResT>>(\n arg1: string,\n arg2?: JSONOpts | Schema,\n arg3?: Schema,\n ): AsyncResult<ResT, SafeJsonError> {\n const args = this.resolveArgs<ResT>(arg1, arg2, arg3);\n return Result.wrap(this.requestJson<ResT>('get', args)).transform(\n (response) => Result.ok(response.body),\n );\n }\n\n /**\n * @deprecated use `head` instead\n */\n headJson(url: string, httpOptions?: JSONOpts): Promise<HttpResponse<never>> {\n return this.requestJson<never>('head', { url, httpOptions });\n }\n\n postJson<T>(url: string, options?: JSONOpts): Promise<HttpResponse<T>>;\n postJson<T, Schema extends ZodType<T> = ZodType<T>>(\n url: string,\n schema: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>>;\n postJson<T, Schema extends ZodType<T> = ZodType<T>>(\n url: string,\n options: JSONOpts,\n schema: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>>;\n postJson<T = unknown, Schema extends ZodType<T> = ZodType<T>>(\n arg1: string,\n arg2?: JSONOpts | Schema,\n arg3?: Schema,\n ): Promise<HttpResponse<T>> {\n const args = this.resolveArgs(arg1, arg2, arg3);\n return this.requestJson<T>('post', args);\n }\n\n putJson<T>(url: string, options?: JSONOpts): Promise<HttpResponse<T>>;\n putJson<T, Schema extends ZodType<T> = ZodType<T>>(\n url: string,\n schema: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>>;\n putJson<T, Schema extends ZodType<T> = ZodType<T>>(\n url: string,\n options: JSONOpts,\n schema: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>>;\n putJson<T = unknown, Schema extends ZodType<T> = ZodType<T>>(\n arg1: string,\n arg2?: JSONOpts | Schema,\n arg3?: Schema,\n ): Promise<HttpResponse<T>> {\n const args = this.resolveArgs<T>(arg1, arg2, arg3);\n return this.requestJson<T>('put', args);\n }\n\n patchJson<T>(url: string, options?: JSONOpts): Promise<HttpResponse<T>>;\n patchJson<T, Schema extends ZodType<T> = ZodType<T>>(\n url: string,\n schema: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>>;\n patchJson<T, Schema extends ZodType<T> = ZodType<T>>(\n url: string,\n options: JSONOpts,\n schema: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>>;\n patchJson<T = unknown, Schema extends ZodType<T> = ZodType<T>>(\n arg1: string,\n arg2?: JSONOpts | Schema,\n arg3?: Schema,\n ): Promise<HttpResponse<T>> {\n const args = this.resolveArgs(arg1, arg2, arg3);\n return this.requestJson<T>('patch', args);\n }\n\n deleteJson<T>(url: string, options?: JSONOpts): Promise<HttpResponse<T>>;\n deleteJson<T, Schema extends ZodType<T> = ZodType<T>>(\n url: string,\n schema: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>>;\n deleteJson<T, Schema extends ZodType<T> = ZodType<T>>(\n url: string,\n options: JSONOpts,\n schema: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>>;\n deleteJson<T = unknown, Schema extends ZodType<T> = ZodType<T>>(\n arg1: string,\n arg2?: JSONOpts | Schema,\n arg3?: Schema,\n ): Promise<HttpResponse<T>> {\n const args = this.resolveArgs(arg1, arg2, arg3);\n return this.requestJson<T>('delete', args);\n }\n\n stream(url: string, options?: HttpOptions): NodeJS.ReadableStream {\n let combinedOptions: Merge<\n GotStreamOptions,\n SetRequired<InternalHttpOptions, 'method'>\n > = {\n ...this.options,\n hostType: this.hostType,\n ...options,\n method: 'get',\n };\n\n const resolvedUrl = this.resolveUrl(url, options).toString();\n\n applyDefaultHeaders(combinedOptions);\n\n // v8 ignore else -- TODO: add test #40625\n if (\n isUndefined(combinedOptions.readOnly) &&\n ['head', 'get'].includes(combinedOptions.method)\n ) {\n combinedOptions.readOnly = true;\n }\n\n const hostRule = findMatchingRule(url, combinedOptions);\n combinedOptions = applyHostRule(resolvedUrl, combinedOptions, hostRule);\n if (combinedOptions.enabled === false) {\n throw new Error(HOST_DISABLED);\n }\n combinedOptions = applyAuthorization(combinedOptions);\n\n return stream(resolvedUrl, this._normalizeOptions(combinedOptions));\n }\n\n async getToml<Schema extends ZodType<any, any, any>>(\n url: string,\n schema?: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>>;\n async getToml<Schema extends ZodType<any, any, any>>(\n url: string,\n options: JSONOpts,\n schema: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>>;\n async getToml<Schema extends ZodType<any, any, any>>(\n arg1: string,\n arg2?: JSONOpts | Schema,\n arg3?: Schema,\n ): Promise<HttpResponse<z.infer<Schema>>> {\n const { url, schema, httpOptions } = this.resolveArgs<z.infer<Schema>>(\n arg1,\n arg2,\n arg3,\n );\n\n const opts: InternalHttpOptions = {\n ...httpOptions,\n method: 'get',\n headers: {\n 'Content-Type': 'application/toml',\n ...httpOptions?.headers,\n },\n };\n\n const res = await this.getText(url, opts);\n if (schema) {\n res.body = await Toml.pipe(schema).parseAsync(res.body);\n } else {\n res.body = (await Toml.parseAsync(res.body)) as z.infer<Schema>;\n }\n\n return res as HttpResponse<z.infer<Schema>>;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAgEA,SAAgB,oBAAoB,SAA4B;CAC9D,MAAM,oBAAoB,aAAa,IAAI,WAAW;CACtD,QAAQ,UAAU;EAChB,GAAG,QAAQ;EACX,cAAc,QAAQ,mBAAmB,CAAC,CAAC;CAC7C;AACF;AAEA,IAAsB,WAAtB,MAGE;CACA;CAEA,IAAc,UAA8B,CAE5C;CAEA;CAEA,YAAY,UAAkB,UAAuB,CAAC,GAAG;EACvD,KAAK,WAAW;EAChB,MAAM,aAAa,OAAO,CAAC,CAAC,aAAa,SAAS,IAAI;EACtD,KAAK,UAAU,MACb,SACA;GACE,QAAQ;GACR,SAAS,EAAE,SAAS;GACpB,OAAO;IACL,iBAAiB,gBACf,KAAK,oBAAoB,WAAW;IACtC,OAAO;IACP,eAAe;IACf,mBAAmB;GACrB;EACF,GACA,EAAE,mBAAmB,cAAc,CACrC;CACF;CAmBA,MAAc,QACZ,YACA,aACgC;EAChC,MAAM,cAAc,KAAK,WAAW,YAAY,WAAW;EAC3D,MAAM,MAAM,YAAY,SAAS;EAEjC,KAAK,eAAe,aAAa,WAAW;EAE5C,IAAI,UAAU,MACZ;GACE,GAAG,KAAK;GACR,UAAU,KAAK;EACjB,GACA,aACA,EAAE,mBAAmB,cAAc,CACrC;EAEA,MA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GAE/C,gBAAgB,WAAW;EAG7B,MAAM,WAAW,iBAAiB,KAAK,eAAe;EACtD,kBAAkB,cAAc,aAAa,iBAAiB,QAAQ;EACtE,IAAI,gBAAgB,YAAY,OAC9B,MAAM,IAAI,MAAM,aAAa;EAE/B,kBAAkB,mBAAmB,eAAe;EAEpD,OAAO,OAAO,aAAa,KAAK,kBAAkB,eAAe,CAAC;CACpE;CAWA,MAAM,QACJ,MACA,MACA,MACwC;EACxC,MAAM,EAAE,KAAK,QAAQ,gBAAgB,KAAK,YACxC,MACA,MACA,IACF;EAEA,MAAM,OAA4B;GAChC,GAAG;GACH,QAAQ;GACR,SAAS;IACP,gBAAgB;IAChB,GAAG,aAAa;GAClB;EACF;EAEA,MAAM,MAAM,MAAM,KAAK,QAAQ,KAAK,IAAI;EACxC,IAAI,QACF,IAAI,OAAO,MAAM,KAAK,KAAK,MAAM,CAAC,CAAC,WAAW,IAAI,IAAI;OAEtD,IAAI,OAAQ,MAAM,KAAK,WAAW,IAAI,IAAI;EAG5C,OAAO;CACT;AACF"}
@@ -8,7 +8,7 @@ function copyResponse({ statusCode, headers, body, cached }, deep) {
8
8
  };
9
9
  if (deep) {
10
10
  res.headers = clone(headers);
11
- res.body = body instanceof Buffer ? body.subarray() : clone(body);
11
+ res.body = body instanceof Uint8Array ? body.subarray() : clone(body);
12
12
  }
13
13
  if (cached) res.cached = true;
14
14
  return res;
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","names":[],"sources":["../../../lib/util/http/util.ts"],"sourcesContent":["import { clone } from '../clone.ts';\nimport type { HttpResponse } from './types.ts';\n\n// Copying will help to avoid circular structure\n// and mutation of the cached response.\nexport function copyResponse<T>(\n { statusCode, headers, body, cached }: HttpResponse<T>,\n deep: boolean,\n): HttpResponse<T> {\n const res: HttpResponse<T> = { statusCode, headers, body };\n\n if (deep) {\n res.headers = clone(headers);\n res.body = body instanceof Buffer ? (body.subarray() as T) : clone<T>(body);\n }\n\n if (cached) {\n res.cached = true;\n }\n\n return res;\n}\n"],"mappings":";;AAKA,SAAgB,aACd,EAAE,YAAY,SAAS,MAAM,UAC7B,MACiB;CACjB,MAAM,MAAuB;EAAE;EAAY;EAAS;CAAK;CAEzD,IAAI,MAAM;EACR,IAAI,UAAU,MAAM,OAAO;EAC3B,IAAI,OAAO,gBAAgB,SAAU,KAAK,SAAS,IAAU,MAAS,IAAI;CAC5E;CAEA,IAAI,QACF,IAAI,SAAS;CAGf,OAAO;AACT"}
1
+ {"version":3,"file":"util.js","names":[],"sources":["../../../lib/util/http/util.ts"],"sourcesContent":["import { clone } from '../clone.ts';\nimport type { HttpResponse } from './types.ts';\n\n// Copying will help to avoid circular structure\n// and mutation of the cached response.\nexport function copyResponse<T>(\n { statusCode, headers, body, cached }: HttpResponse<T>,\n deep: boolean,\n): HttpResponse<T> {\n const res: HttpResponse<T> = { statusCode, headers, body };\n\n if (deep) {\n res.headers = clone(headers);\n res.body =\n body instanceof Uint8Array ? (body.subarray() as T) : clone<T>(body);\n }\n\n if (cached) {\n res.cached = true;\n }\n\n return res;\n}\n"],"mappings":";;AAKA,SAAgB,aACd,EAAE,YAAY,SAAS,MAAM,UAC7B,MACiB;CACjB,MAAM,MAAuB;EAAE;EAAY;EAAS;CAAK;CAEzD,IAAI,MAAM;EACR,IAAI,UAAU,MAAM,OAAO;EAC3B,IAAI,OACF,gBAAgB,aAAc,KAAK,SAAS,IAAU,MAAS,IAAI;CACvE;CAEA,IAAI,QACF,IAAI,SAAS;CAGf,OAAO;AACT"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "renovate",
3
3
  "description": "Automated dependency updates. Flexible so you don't need to be.",
4
- "version": "44.70.0",
4
+ "version": "44.70.2",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "renovate": "dist/renovate.js",
@@ -132,7 +132,7 @@
132
132
  "agentkeepalive": "4.6.0",
133
133
  "async-mutex": "0.5.0",
134
134
  "aws4": "1.13.2",
135
- "azure-devops-node-api": "15.1.3",
135
+ "azure-devops-node-api": "17.0.0",
136
136
  "bunyan": "1.8.15",
137
137
  "cacache": "20.0.4",
138
138
  "changelog-filename-regex": "2.0.1",
@@ -158,7 +158,7 @@
158
158
  "glob": "13.0.6",
159
159
  "global-agent": "3.0.0",
160
160
  "google-auth-library": "10.9.1",
161
- "got": "14.6.6",
161
+ "got": "15.0.5",
162
162
  "graph-data-structure": "4.5.0",
163
163
  "handlebars": "4.7.9",
164
164
  "ignore": "7.0.8",
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$id": "https://docs.renovatebot.com/renovate-schema.json",
3
- "title": "JSON schema for Renovate 44.70.0 config files (https://renovatebot.com/)",
3
+ "title": "JSON schema for Renovate 44.70.2 config files (https://renovatebot.com/)",
4
4
  "$schema": "http://json-schema.org/draft-07/schema#",
5
- "x-renovate-version": "44.70.0",
5
+ "x-renovate-version": "44.70.2",
6
6
  "allowComments": true,
7
7
  "type": "object",
8
8
  "definitions": {