diff --git a/lib/modules/manager/composer/utils.ts b/lib/modules/manager/composer/utils.ts index 353f2b7d0365c2..89328f611ef24d 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 38a571314a286d..f8a61fd9f708d7 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 8c4a98d7ff625f..a111c9ade7ea7d 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 48cf641bd9602c..996b73f1ee7276 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 19e3addbb0444b..de5ea2bd2796c7 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 {};