diff --git a/lib/modules/manager/composer/utils.ts b/lib/modules/manager/composer/utils.ts index 353f2b7d0365c2de6e346832f04be109d809dca9..89328f611ef24dae062116f81b3728135d8eeb0f 100644 --- a/lib/modules/manager/composer/utils.ts +++ b/lib/modules/manager/composer/utils.ts @@ -2,7 +2,7 @@ import { quote } from 'shlex'; import { GlobalConfig } from '../../../config/global'; import { logger } from '../../../logger'; -import type { HostRuleSearchResult } from '../../../types'; +import type { CombinedHostRule } from '../../../types'; import type { ToolConstraint } from '../../../util/exec/types'; import { coerceNumber } from '../../../util/number'; import { api, id as composerVersioningId } from '../../versioning/composer'; @@ -113,6 +113,6 @@ export function extractConstraints( return res; } -export function isArtifactAuthEnabled(rule: HostRuleSearchResult): boolean { +export function isArtifactAuthEnabled(rule: CombinedHostRule): boolean { return !rule.artifactAuth || rule.artifactAuth.includes('composer'); } diff --git a/lib/types/host-rules.ts b/lib/types/host-rules.ts index 38a571314a286da00c0f03f77da998780686dce6..f8a61fd9f708d75b97604613ef3208f0abb6a678 100644 --- a/lib/types/host-rules.ts +++ b/lib/types/host-rules.ts @@ -1,4 +1,4 @@ -export interface HostRuleSearchResult { +export interface HostRule { authType?: string; token?: string; username?: string; @@ -20,11 +20,14 @@ export interface HostRuleSearchResult { httpsCertificateAuthority?: string; httpsPrivateKey?: string; httpsCertificate?: string; -} -export interface HostRule extends HostRuleSearchResult { encrypted?: HostRule; hostType?: string; matchHost?: string; resolvedHost?: string; } + +export type CombinedHostRule = Omit< + HostRule, + 'encrypted' | 'hostType' | 'matchHost' | 'resolvedHost' +>; diff --git a/lib/types/index.ts b/lib/types/index.ts index 8c4a98d7ff625f1b3f35f4a1263e16e629ad153d..a111c9ade7ea7d1210fa02c020bac4bb3d642ec5 100644 --- a/lib/types/index.ts +++ b/lib/types/index.ts @@ -1,5 +1,5 @@ export type { CommitMessageJSON } from './commit-message-json'; -export type { HostRule, HostRuleSearchResult } from './host-rules'; +export type { HostRule, CombinedHostRule } from './host-rules'; export type { SkipReason } from './skip-reason'; export type { RangeStrategy } from './versioning'; export type { BranchStatus } from './branch-status'; diff --git a/lib/util/check-token.ts b/lib/util/check-token.ts index 48cf641bd9602c4b176a82f7fd6ccf57685beca3..996b73f1ee7276c38ed85dd60b55d14e54c72cfb 100644 --- a/lib/util/check-token.ts +++ b/lib/util/check-token.ts @@ -4,7 +4,7 @@ import { GithubReleaseAttachmentsDatasource } from '../modules/datasource/github import { GithubReleasesDatasource } from '../modules/datasource/github-releases'; import { GithubTagsDatasource } from '../modules/datasource/github-tags'; import type { PackageFileContent } from '../modules/manager/types'; -import type { HostRuleSearchResult } from '../types'; +import type { CombinedHostRule } from '../types'; import * as memCache from '../util/cache/memory'; import * as hostRules from './host-rules'; @@ -73,7 +73,7 @@ export function isGithubFineGrainedPersonalAccessToken(token: string): boolean { } export function findGithubToken( - searchResult: HostRuleSearchResult, + searchResult: CombinedHostRule, ): string | undefined { return searchResult?.token?.replace('x-access-token:', ''); } diff --git a/lib/util/host-rules.ts b/lib/util/host-rules.ts index 19e3addbb0444b06a63866783802bb8187da12a0..de5ea2bd2796c7088193faa6b21abd99273d4ab7 100644 --- a/lib/util/host-rules.ts +++ b/lib/util/host-rules.ts @@ -1,7 +1,7 @@ import is from '@sindresorhus/is'; import merge from 'deepmerge'; import { logger } from '../logger'; -import type { HostRule, HostRuleSearchResult } from '../types'; +import type { CombinedHostRule, HostRule } from '../types'; import { clone } from './clone'; import * as sanitize from './sanitize'; import { toBase64 } from './string'; @@ -123,7 +123,7 @@ function prioritizeLongestMatchHost(rule1: HostRule, rule2: HostRule): number { return rule1.matchHost.length - rule2.matchHost.length; } -export function find(search: HostRuleSearch): HostRuleSearchResult { +export function find(search: HostRuleSearch): CombinedHostRule { if (!(!!search.hostType || search.url)) { logger.warn({ search }, 'Invalid hostRules search'); return {};