@paklo/core 0.7.1 → 0.7.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.
@@ -1,4 +1,4 @@
1
- import { Dn as VariableFinderFn, N as DependabotUpdatePullRequest, St as DependabotExistingPR, a as DependabotCreatePullRequest, bt as DependabotExistingGroupPR, t as DependabotClosePullRequest, tn as DependabotConfig, vt as DependabotDependency } from "../index-B1zTACpP.mjs";
1
+ import { Dn as VariableFinderFn, N as DependabotUpdatePullRequest, St as DependabotExistingPR, a as DependabotCreatePullRequest, bt as DependabotExistingGroupPR, t as DependabotClosePullRequest, tn as DependabotConfig, vt as DependabotDependency } from "../index--PMbsXAm.mjs";
2
2
  import "../index-BWftXTYB.mjs";
3
3
  import * as zod0 from "zod";
4
4
  import * as zod_v4_core0 from "zod/v4/core";
@@ -1,7 +1,7 @@
1
1
  import { r as isErrorTemporaryFailure, t as HttpRequestError } from "../http-D2wwAKQ-.mjs";
2
2
  import { t as logger } from "../logger-IPTn7PT9.mjs";
3
3
  import { F as parseDependabotConfig, M as POSSIBLE_CONFIG_FILE_PATHS, c as DependabotExistingGroupPRSchema, l as DependabotExistingPRSchema } from "../job-BuCBKP9L.mjs";
4
- import "../dependabot-BM3oAx2C.mjs";
4
+ import "../dependabot-BdrOiAWj.mjs";
5
5
  import * as path from "node:path";
6
6
  import { existsSync } from "node:fs";
7
7
  import { readFile } from "node:fs/promises";
@@ -129,7 +129,7 @@ function getPullRequestChangedFilesForOutputData(data) {
129
129
  changeType,
130
130
  path: path.join(file.directory, file.name),
131
131
  content: file.content ?? void 0,
132
- encoding: file.content_encoding ?? void 0
132
+ encoding: file.content_encoding || "utf-8"
133
133
  };
134
134
  });
135
135
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["path","reason: string | undefined","reviewers: IdentityRefWithVote[]","body: string | undefined","configPath: undefined | string","configContents: undefined | string","organisation: string","path"],"sources":["../../src/azure/types.ts","../../src/azure/models.ts","../../src/azure/utils.ts","../../src/azure/client.ts","../../src/azure/config.ts","../../src/azure/url-parts.ts"],"sourcesContent":["export enum VersionControlChangeType {\n None = 0,\n Add = 1,\n Edit = 2,\n Encoding = 4,\n Rename = 8,\n Delete = 16,\n Undelete = 32,\n Branch = 64,\n Merge = 128,\n Lock = 256,\n Rollback = 512,\n SourceRename = 1024,\n TargetRename = 2048,\n Property = 4096,\n All = 8191,\n}\n\nexport enum GitPullRequestMergeStrategy {\n NoFastForward = 1,\n Squash = 2,\n Rebase = 3,\n RebaseMerge = 4,\n}\n\nexport enum CommentThreadStatus {\n Unknown = 0,\n Active = 1,\n Fixed = 2,\n WontFix = 3,\n Closed = 4,\n ByDesign = 5,\n Pending = 6,\n}\nexport enum CommentType {\n Unknown = 0,\n Text = 1,\n CodeChange = 2,\n System = 3,\n}\nexport enum ItemContentType {\n RawText = 0,\n Base64Encoded = 1,\n}\nexport enum PullRequestAsyncStatus {\n NotSet = 0,\n Queued = 1,\n Conflicts = 2,\n Succeeded = 3,\n RejectedByPolicy = 4,\n Failure = 5,\n}\nexport enum PullRequestStatus {\n NotSet = 0,\n Active = 1,\n Abandoned = 2,\n Completed = 3,\n All = 4,\n}\n\nexport type IdentityRefWithVote = {\n id?: string;\n displayName?: string;\n uniqueName?: string;\n url?: string;\n imageUrl?: string;\n vote?: number;\n hasDeclined?: boolean;\n isFlagged?: boolean;\n isRequired?: boolean;\n};\n\nexport type AzdoProject = {\n id: string;\n name: string;\n description?: string;\n url: string;\n state: 'deleting' | 'new' | 'wellFormed' | 'createPending' | 'all' | 'unchanged' | 'deleted';\n _links?: {\n self: { href: string };\n collection: { href: string };\n web: { href: string };\n };\n};\n\nexport type AzdoRepository = {\n id: string;\n name: string;\n defaultBranch?: string;\n project: AzdoProject;\n isDisabled?: boolean;\n isFork?: boolean;\n url: string;\n remoteUrl: string;\n webUrl: string;\n};\n\nexport type AzdoListResponse<T> = {\n value: T[];\n count: number;\n};\n\nexport type AzdoRepositoryItem = {\n latestProcessedChange?: {\n commitId?: string;\n };\n content?: string;\n};\n","import type { GitPullRequestMergeStrategy, VersionControlChangeType } from './types';\n\n/**\n * Pull request property names used to store metadata about the pull request.\n * https://learn.microsoft.com/en-us/rest/api/azure/devops/git/pull-request-properties\n */\nexport const DEVOPS_PR_PROPERTY_MICROSOFT_GIT_SOURCE_REF_NAME = 'Microsoft.Git.PullRequest.SourceRefName';\nexport const DEVOPS_PR_PROPERTY_DEPENDABOT_PACKAGE_MANAGER = 'Dependabot.PackageManager';\nexport const DEVOPS_PR_PROPERTY_DEPENDABOT_DEPENDENCIES = 'Dependabot.Dependencies';\n\n/** File change */\nexport interface IFileChange {\n changeType: VersionControlChangeType;\n path: string;\n content?: string;\n encoding?: string;\n}\n\n/** Pull request properties */\nexport interface IPullRequestProperties {\n id: number;\n properties?: {\n name: string;\n value: string;\n }[];\n}\n\n/** Pull request creation request */\nexport interface ICreatePullRequest {\n project: string;\n repository: string;\n source: {\n commit: string;\n branch: string;\n };\n target: {\n branch: string;\n };\n author?: {\n email: string;\n name: string;\n };\n title: string;\n description: string;\n commitMessage: string;\n autoComplete?: {\n ignorePolicyConfigIds?: number[];\n mergeStrategy?: GitPullRequestMergeStrategy;\n };\n assignees?: string[];\n labels?: string[];\n workItems?: string[];\n changes: IFileChange[];\n properties?: {\n name: string;\n value: string;\n }[];\n}\n\n/** Pull request update request */\nexport interface IUpdatePullRequest {\n project: string;\n repository: string;\n pullRequestId: number;\n commit: string;\n author?: {\n email: string;\n name: string;\n };\n changes: IFileChange[];\n skipIfDraft?: boolean;\n skipIfCommitsFromAuthorsOtherThan?: string;\n skipIfNotBehindTargetBranch?: boolean;\n}\n\n/** Pull request approval request */\nexport interface IApprovePullRequest {\n project: string;\n repository: string;\n pullRequestId: number;\n}\n\n/** Pull request abandon request */\nexport interface IAbandonPullRequest {\n project: string;\n repository: string;\n pullRequestId: number;\n comment?: string;\n deleteSourceBranch?: boolean;\n}\n\n/** Pull request comment */\nexport interface IPullRequestComment {\n project: string;\n repository: string;\n pullRequestId: number;\n content: string;\n userId?: string;\n}\n","import * as path from 'node:path';\n\nimport {\n type DependabotClosePullRequest,\n type DependabotCreatePullRequest,\n type DependabotDependency,\n type DependabotExistingGroupPR,\n DependabotExistingGroupPRSchema,\n type DependabotExistingPR,\n DependabotExistingPRSchema,\n type DependabotUpdatePullRequest,\n} from '@/dependabot';\nimport {\n DEVOPS_PR_PROPERTY_DEPENDABOT_DEPENDENCIES,\n DEVOPS_PR_PROPERTY_DEPENDABOT_PACKAGE_MANAGER,\n type IFileChange,\n type IPullRequestProperties,\n} from './models';\nimport { VersionControlChangeType } from './types';\n\nexport function normalizeFilePath(path: string): string {\n // Convert backslashes to forward slashes, convert './' => '/' and ensure the path starts with a forward slash if it doesn't already, this is how DevOps paths are formatted\n return path\n ?.replace(/\\\\/g, '/')\n ?.replace(/^\\.\\//, '/')\n ?.replace(/^([^/])/, '/$1');\n}\n\nexport function normalizeBranchName(branch?: string): string | undefined {\n // Strip the 'refs/heads/' prefix from the branch name, if present\n return branch?.replace(/^refs\\/heads\\//i, '');\n}\n\nexport const DependenciesPrPropertySchema = DependabotExistingPRSchema.array().or(DependabotExistingGroupPRSchema);\n\nexport function buildPullRequestProperties(\n packageManager: string,\n dependencies: DependabotExistingPR[] | DependabotExistingGroupPR,\n) {\n return [\n {\n name: DEVOPS_PR_PROPERTY_DEPENDABOT_PACKAGE_MANAGER,\n value: packageManager,\n },\n {\n name: DEVOPS_PR_PROPERTY_DEPENDABOT_DEPENDENCIES,\n value: JSON.stringify(dependencies),\n },\n ];\n}\n\nexport function parsePullRequestProperties(\n pullRequests: IPullRequestProperties[],\n packageManager: string | null,\n): Record<string, DependabotExistingPR[] | DependabotExistingGroupPR> {\n return Object.fromEntries(\n pullRequests\n .filter((pr) => {\n return pr.properties?.find(\n (p) =>\n p.name === DEVOPS_PR_PROPERTY_DEPENDABOT_PACKAGE_MANAGER &&\n (packageManager === null || p.value === packageManager),\n );\n })\n .map((pr) => {\n return [\n pr.id,\n DependenciesPrPropertySchema.parse(\n JSON.parse(pr.properties!.find((p) => p.name === DEVOPS_PR_PROPERTY_DEPENDABOT_DEPENDENCIES)!.value),\n ),\n ];\n }),\n );\n}\n\nexport function getPullRequestForDependencyNames(\n existingPullRequests: IPullRequestProperties[],\n packageManager: string,\n dependencyNames: string[],\n): IPullRequestProperties | undefined {\n return existingPullRequests.find((pr) => {\n return (\n pr.properties?.find(\n (p) => p.name === DEVOPS_PR_PROPERTY_DEPENDABOT_PACKAGE_MANAGER && p.value === packageManager,\n ) &&\n pr.properties?.find(\n (p) =>\n p.name === DEVOPS_PR_PROPERTY_DEPENDABOT_DEPENDENCIES &&\n areEqual(getDependencyNames(DependenciesPrPropertySchema.parse(JSON.parse(p.value))), dependencyNames),\n )\n );\n });\n}\n\nfunction getDependencyNames(dependencies: DependabotExistingPR[] | DependabotExistingGroupPR): string[] {\n const deps = Array.isArray(dependencies) ? dependencies : dependencies.dependencies;\n return deps.map((dep) => dep['dependency-name']?.toString());\n}\n\nfunction areEqual(a: string[], b: string[]): boolean {\n if (a.length !== b.length) return false;\n return a.every((name) => b.includes(name));\n}\n\nexport function getPullRequestChangedFilesForOutputData(\n data: DependabotCreatePullRequest | DependabotUpdatePullRequest,\n): IFileChange[] {\n return data['updated-dependency-files']\n .filter((file) => file.type === 'file')\n .map((file) => {\n let changeType = VersionControlChangeType.None;\n if (file.deleted === true || file.operation === 'delete') {\n changeType = VersionControlChangeType.Delete;\n } else if (file.operation === 'update') {\n changeType = VersionControlChangeType.Edit;\n } else {\n changeType = VersionControlChangeType.Add;\n }\n return {\n changeType: changeType,\n path: path.join(file.directory, file.name),\n content: file.content ?? undefined,\n encoding: file.content_encoding ?? undefined,\n } satisfies IFileChange;\n });\n}\n\nexport function getPullRequestCloseReasonForOutputData(data: DependabotClosePullRequest): string | undefined {\n // The first dependency is the \"lead\" dependency in a multi-dependency update\n const leadDependencyName = data['dependency-names'][0];\n let reason: string | undefined;\n switch (data.reason) {\n case 'dependencies_changed':\n reason = `Looks like the dependencies have changed`;\n break;\n case 'dependency_group_empty':\n reason = `Looks like the dependencies in this group are now empty`;\n break;\n case 'dependency_removed':\n reason = `Looks like ${leadDependencyName} is no longer a dependency`;\n break;\n case 'up_to_date':\n reason = `Looks like ${leadDependencyName} is up-to-date now`;\n break;\n case 'update_no_longer_possible':\n reason = `Looks like ${leadDependencyName} can no longer be updated`;\n break;\n }\n if (reason && reason.length > 0) {\n reason += ', so this is no longer needed.';\n }\n return reason;\n}\n\nexport function getPullRequestDependenciesPropertyValueForOutputData(\n data: DependabotCreatePullRequest,\n): DependabotExistingPR[] | DependabotExistingGroupPR {\n const dependencies = data.dependencies?.map((dep) => {\n return {\n 'dependency-name': dep.name,\n 'dependency-version': dep.version,\n directory: dep.directory,\n };\n });\n const dependencyGroupName = data['dependency-group']?.name;\n if (!dependencyGroupName) return dependencies;\n return {\n 'dependency-group-name': dependencyGroupName,\n dependencies: dependencies,\n } as DependabotExistingGroupPR;\n}\n\nexport function getPullRequestDescription(\n packageManager: string,\n body: string | null | undefined,\n dependencies: DependabotDependency[],\n): string {\n let header = '';\n const footer = '';\n\n // Fix up GitHub mentions encoding issues by removing instances of the zero-width space '\\u200B' as it does not render correctly in Azure DevOps.\n // https://github.com/dependabot/dependabot-core/issues/9572\n // https://github.com/dependabot/dependabot-core/blob/313fcff149b3126cb78b38d15f018907d729f8cc/common/lib/dependabot/pull_request_creator/message_builder/link_and_mention_sanitizer.rb#L245-L252\n const description = (body || '').replace(new RegExp(decodeURIComponent('%EF%BF%BD%EF%BF%BD%EF%BF%BD'), 'g'), '');\n\n // If there is exactly one dependency, add a compatibility score badge to the description header.\n // Compatibility scores are intended for single dependency security updates, not group updates.\n // https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores\n if (dependencies.length === 1) {\n const compatibilityScoreBadges = dependencies.map((dep) => {\n return `![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=${dep.name}&package-manager=${packageManager}&previous-version=${dep['previous-version']}&new-version=${dep.version})`;\n });\n header += `${compatibilityScoreBadges.join(' ')}\\n\\n`;\n }\n\n // Build the full pull request description.\n // The header/footer must not be truncated. If the description is too long, we truncate the body.\n const maxDescriptionLength = 4000;\n const maxDescriptionLengthAfterHeaderAndFooter = maxDescriptionLength - header.length - footer.length;\n return `${header}${description.substring(0, maxDescriptionLengthAfterHeaderAndFooter)}${footer}`;\n}\n","import { HttpRequestError, isErrorTemporaryFailure } from '@/http';\nimport { logger } from '@/logger';\nimport type {\n IAbandonPullRequest,\n IApprovePullRequest,\n ICreatePullRequest,\n IPullRequestComment,\n IPullRequestProperties,\n IUpdatePullRequest,\n} from './models';\nimport {\n type AzdoListResponse,\n type AzdoProject,\n type AzdoRepository,\n type AzdoRepositoryItem,\n CommentThreadStatus,\n CommentType,\n type IdentityRefWithVote,\n ItemContentType,\n PullRequestAsyncStatus,\n PullRequestStatus,\n VersionControlChangeType,\n} from './types';\nimport type { AzureDevOpsOrganizationUrl } from './url-parts';\nimport { normalizeBranchName, normalizeFilePath } from './utils';\n\n/** Returned from AzureDevOpsWebApiClient.getUserId() when no user is authenticated */\nexport const ANONYMOUS_USER_ID = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa';\n\n/** Azure DevOps REST API client. */\nexport class AzureDevOpsWebApiClient {\n private readonly organisationApiUrl: string;\n private readonly identityApiUrl: string;\n private readonly accessToken: string;\n private readonly debug: boolean;\n\n private authenticatedUserId?: string;\n private resolvedUserIds: Record<string, string>;\n\n public static API_VERSION = '5.0'; // this is the same version used by dependabot-core\n public static API_VERSION_PREVIEW = '5.0-preview';\n\n constructor(url: AzureDevOpsOrganizationUrl, accessToken: string, debug: boolean = false) {\n const organisationApiUrl = url.value.toString();\n this.organisationApiUrl = organisationApiUrl.replace(/\\/$/, ''); // trim trailing slash\n this.identityApiUrl = getIdentityApiUrl(organisationApiUrl).replace(/\\/$/, ''); // trim trailing slash\n this.accessToken = accessToken;\n this.debug = debug;\n this.resolvedUserIds = {};\n }\n\n /**\n * Get the identity of the authenticated user.\n * @returns\n */\n public async getUserId(): Promise<string> {\n if (!this.authenticatedUserId) {\n const connectionData = await this.restApiGet(\n `${this.organisationApiUrl}/_apis/connectiondata`,\n undefined,\n AzureDevOpsWebApiClient.API_VERSION_PREVIEW,\n );\n this.authenticatedUserId = connectionData?.authenticatedUser?.id;\n if (!this.authenticatedUserId) {\n throw new Error('Failed to get authenticated user ID');\n }\n }\n return this.authenticatedUserId;\n }\n\n /**\n * Get the identity id from a user name, email, or group name.\n * Requires scope \"Identity (Read)\" (vso.identity).\n * @param userNameEmailOrGroupName\n * @returns\n */\n public async resolveIdentityId(userNameEmailOrGroupName: string): Promise<string | undefined> {\n if (this.resolvedUserIds[userNameEmailOrGroupName]) {\n return this.resolvedUserIds[userNameEmailOrGroupName];\n }\n try {\n const identities = await this.restApiGet(`${this.identityApiUrl}/_apis/identities`, {\n searchFilter: 'General',\n filterValue: userNameEmailOrGroupName,\n queryMembership: 'None',\n });\n if (!identities?.value || identities.value.length === 0) {\n return undefined;\n }\n this.resolvedUserIds[userNameEmailOrGroupName] = identities.value[0]?.id;\n return this.resolvedUserIds[userNameEmailOrGroupName];\n } catch (e) {\n logger.error(`Failed to resolve user id: ${e}`);\n logger.debug(e); // Dump the error stack trace to help with debugging\n return undefined;\n }\n }\n\n public async getProjects(): Promise<AzdoListResponse<AzdoProject> | undefined> {\n try {\n const projects = await this.restApiGet(`${this.organisationApiUrl}/_apis/projects`);\n return projects;\n } catch (e) {\n logger.error(`Failed to get projects: ${e}`);\n logger.debug(e); // Dump the error stack trace to help with debugging\n return undefined;\n }\n }\n\n public async getProject(idOrName: string): Promise<AzdoProject | undefined> {\n try {\n const project = await this.restApiGet(\n `${this.organisationApiUrl}/_apis/projects/${encodeURIComponent(idOrName)}`,\n );\n return project;\n } catch (e) {\n logger.error(`Failed to get project: ${e}`);\n logger.debug(e); // Dump the error stack trace to help with debugging\n return undefined;\n }\n }\n\n public async getRepositories(projectIdOrName: string): Promise<AzdoListResponse<AzdoRepository> | undefined> {\n try {\n const repos = await this.restApiGet(\n `${this.organisationApiUrl}/${encodeURIComponent(projectIdOrName)}/_apis/git/repositories`,\n );\n return repos;\n } catch (e) {\n logger.error(`Failed to get repositories: ${e}`);\n logger.debug(e); // Dump the error stack trace to help with debugging\n return undefined;\n }\n }\n\n public async getRepository(projectIdOrName: string, repositoryIdOrName: string): Promise<AzdoRepository | undefined> {\n try {\n const repo = await this.restApiGet(\n `${this.organisationApiUrl}/${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}`,\n );\n return repo;\n } catch (e) {\n if (e instanceof HttpRequestError && e.code === 404) {\n // repository no longer exists\n return undefined;\n } else {\n logger.error(`Failed to get repository: ${e}`);\n logger.debug(e); // Dump the error stack trace to help with debugging\n }\n return undefined;\n }\n }\n\n public async getRepositoryItem(\n projectIdOrName: string,\n repositoryIdOrName: string,\n path: string,\n includeContent: boolean = true,\n latestProcessedChange: boolean = true,\n ): Promise<AzdoRepositoryItem | undefined> {\n try {\n const item = await this.restApiGet(\n `${this.organisationApiUrl}/${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/items`,\n {\n path,\n includeContent,\n latestProcessedChange,\n },\n );\n return item;\n } catch (e) {\n if (e instanceof HttpRequestError && e.code === 404) {\n // item does not exist\n return undefined;\n } else {\n logger.error(`Failed to get repository item: ${e}`);\n logger.debug(e); // Dump the error stack trace to help with debugging\n }\n return undefined;\n }\n }\n\n /**\n * Get the default branch for a repository.\n * Requires scope \"Code (Read)\" (vso.code).\n * @param project\n * @param repository\n * @returns\n */\n public async getDefaultBranch(project: string, repository: string): Promise<string | undefined> {\n try {\n const repo = await this.restApiGet(`${this.organisationApiUrl}/${project}/_apis/git/repositories/${repository}`);\n if (!repo) {\n throw new Error(`Repository '${project}/${repository}' not found`);\n }\n\n return normalizeBranchName(repo.defaultBranch);\n } catch (e) {\n logger.error(`Failed to get default branch for '${project}/${repository}': ${e}`);\n logger.debug(e); // Dump the error stack trace to help with debugging\n return undefined;\n }\n }\n\n /**\n * Get the list of branch names for a repository.\n * Requires scope \"Code (Read)\" (vso.code).\n * @param project\n * @param repository\n * @returns\n */\n public async getBranchNames(project: string, repository: string): Promise<string[] | undefined> {\n try {\n const refs = await this.restApiGet(\n `${this.organisationApiUrl}/${project}/_apis/git/repositories/${repository}/refs`,\n );\n if (!refs) {\n throw new Error(`Repository '${project}/${repository}' not found`);\n }\n\n return refs.value?.map((r: { name?: string }) => normalizeBranchName(r.name)) || [];\n } catch (e) {\n logger.error(`Failed to list branch names for '${project}/${repository}': ${e}`);\n logger.debug(e); // Dump the error stack trace to help with debugging\n return undefined;\n }\n }\n\n /**\n * Get the properties for all active pull request created by the supplied user.\n * Requires scope \"Code (Read)\" (vso.code).\n * @param project\n * @param repository\n * @param creator\n * @returns\n */\n public async getActivePullRequestProperties(\n project: string,\n repository: string,\n creator: string,\n ): Promise<IPullRequestProperties[]> {\n try {\n const pullRequests = await this.restApiGet(\n `${this.organisationApiUrl}/${project}/_apis/git/repositories/${repository}/pullrequests`,\n {\n 'searchCriteria.creatorId': isGuid(creator) ? creator : await this.getUserId(),\n 'searchCriteria.status': 'Active',\n },\n );\n if (!pullRequests?.value || pullRequests.value.length === 0) {\n return [];\n }\n\n return await Promise.all(\n pullRequests.value.map(async (pr: { pullRequestId: number }) => {\n const properties = await this.restApiGet(\n `${this.organisationApiUrl}/${project}/_apis/git/repositories/${repository}/pullrequests/${pr.pullRequestId}/properties`,\n );\n return {\n id: pr.pullRequestId,\n properties:\n Object.keys(properties?.value || {}).map((key) => {\n return {\n name: key,\n value: properties.value[key]?.$value,\n };\n }) || [],\n };\n }),\n );\n } catch (e) {\n logger.error(`Failed to list active pull request properties: ${e}`);\n logger.debug(e); // Dump the error stack trace to help with debugging\n return [];\n }\n }\n\n /**\n * Create a new pull request.\n * Requires scope \"Code (Write)\" (vso.code_write).\n * Requires scope \"Identity (Read)\" (vso.identity), if assignees are specified.\n * @param pr\n * @returns\n */\n public async createPullRequest(pr: ICreatePullRequest): Promise<number | null> {\n logger.info(`Creating pull request '${pr.title}'...`);\n try {\n const userId = await this.getUserId();\n\n // Map the list of the pull request reviewer ids\n // NOTE: Azure DevOps does not have a concept of assignees.\n // We treat them as optional reviewers. Branch policies should be used for required reviewers.\n const reviewers: IdentityRefWithVote[] = [];\n if (pr.assignees && pr.assignees.length > 0) {\n for (const assignee of pr.assignees) {\n const identityId = isGuid(assignee) ? assignee : await this.resolveIdentityId(assignee);\n if (identityId && !reviewers.some((r) => r.id === identityId)) {\n reviewers.push({\n id: identityId,\n });\n } else {\n logger.warn(`Unable to resolve assignee identity '${assignee}'`);\n }\n }\n }\n\n // Create the source branch and push a commit with the dependency file changes\n logger.info(` - Pushing ${pr.changes.length} file change(s) to branch '${pr.source.branch}'...`);\n const push = await this.restApiPost(\n `${this.organisationApiUrl}/${pr.project}/_apis/git/repositories/${pr.repository}/pushes`,\n {\n refUpdates: [\n {\n name: `refs/heads/${pr.source.branch}`,\n oldObjectId: pr.source.commit,\n },\n ],\n commits: [\n {\n comment: pr.commitMessage,\n author: pr.author,\n changes: pr.changes\n .filter((change) => change.changeType !== VersionControlChangeType.None)\n .map(({ changeType, ...change }) => {\n return {\n changeType,\n item: { path: normalizeFilePath(change.path) },\n newContent:\n changeType !== VersionControlChangeType.Delete\n ? {\n content: Buffer.from(change.content!, <BufferEncoding>change.encoding).toString('base64'),\n contentType: ItemContentType.Base64Encoded,\n }\n : undefined,\n };\n }),\n },\n ],\n },\n );\n if (!push?.commits?.length) {\n throw new Error('Failed to push changes to source branch, no commits were created');\n }\n logger.info(` - Pushed commit: ${push.commits.map((c: { commitId: string }) => c.commitId).join(', ')}.`);\n\n // Create the pull request\n logger.info(` - Creating pull request to merge '${pr.source.branch}' into '${pr.target.branch}'...`);\n const pullRequest = await this.restApiPost(\n `${this.organisationApiUrl}/${pr.project}/_apis/git/repositories/${pr.repository}/pullrequests`,\n {\n sourceRefName: `refs/heads/${pr.source.branch}`,\n targetRefName: `refs/heads/${pr.target.branch}`,\n title: pr.title,\n description: pr.description,\n reviewers: reviewers,\n workItemRefs: pr.workItems?.map((id) => ({ id: id })),\n labels: pr.labels?.map((label) => ({ name: label })),\n },\n );\n if (!pullRequest?.pullRequestId) {\n throw new Error('Failed to create pull request, no pull request id was returned');\n }\n logger.info(` - Created pull request: #${pullRequest.pullRequestId}.`);\n\n // Add the pull request properties\n if (pr.properties && pr.properties.length > 0) {\n logger.info(` - Adding dependency metadata to pull request properties...`);\n const newProperties = await this.restApiPatch(\n `${this.organisationApiUrl}/${pr.project}/_apis/git/repositories/${pr.repository}/pullrequests/${pullRequest.pullRequestId}/properties`,\n pr.properties.map((property) => {\n return {\n op: 'add',\n path: `/${property.name}`,\n value: property.value,\n };\n }),\n 'application/json-patch+json',\n );\n if (!newProperties?.count) {\n throw new Error('Failed to add dependency metadata properties to pull request');\n }\n }\n\n // TODO: Upload the pull request description as a 'changes.md' file attachment?\n // This might be a way to work around the 4000 character limit for PR descriptions, but needs more investigation.\n // https://learn.microsoft.com/en-us/rest/api/azure/devops/git/pull-request-attachments/create?view=azure-devops-rest-7.1\n\n // Set the pull request auto-complete status\n if (pr.autoComplete) {\n logger.info(` - Updating auto-complete options...`);\n const updatedPullRequest = await this.restApiPatch(\n `${this.organisationApiUrl}/${pr.project}/_apis/git/repositories/${pr.repository}/pullrequests/${pullRequest.pullRequestId}`,\n {\n autoCompleteSetBy: {\n id: userId,\n },\n completionOptions: {\n autoCompleteIgnoreConfigIds: pr.autoComplete.ignorePolicyConfigIds,\n deleteSourceBranch: true,\n mergeCommitMessage: mergeCommitMessage(pullRequest.pullRequestId, pr.title, pr.description),\n mergeStrategy: pr.autoComplete.mergeStrategy,\n transitionWorkItems: false,\n },\n },\n );\n if (!updatedPullRequest || updatedPullRequest.autoCompleteSetBy?.id !== userId) {\n throw new Error('Failed to set auto-complete on pull request');\n }\n }\n\n logger.info(` - Pull request was created successfully.`);\n return pullRequest.pullRequestId;\n } catch (e) {\n logger.error(`Failed to create pull request: ${e}`);\n logger.debug(e); // Dump the error stack trace to help with debugging\n return null;\n }\n }\n\n /**\n * Update a pull request.\n * Requires scope \"Code (Read & Write)\" (vso.code, vso.code_write).\n * @param pr\n * @returns\n */\n public async updatePullRequest(pr: IUpdatePullRequest): Promise<boolean> {\n logger.info(`Updating pull request #${pr.pullRequestId}...`);\n try {\n // Get the pull request details\n const pullRequest = await this.restApiGet(\n `${this.organisationApiUrl}/${pr.project}/_apis/git/repositories/${pr.repository}/pullrequests/${pr.pullRequestId}`,\n );\n if (!pullRequest) {\n throw new Error(`Pull request #${pr.pullRequestId} not found`);\n }\n\n // Skip if the pull request is a draft\n if (pr.skipIfDraft && pullRequest.isDraft) {\n logger.info(` - Skipping update as pull request is currently marked as a draft.`);\n return true;\n }\n\n // Skip if the pull request has been modified by another author\n if (pr.skipIfCommitsFromAuthorsOtherThan) {\n const commits = await this.restApiGet(\n `${this.organisationApiUrl}/${pr.project}/_apis/git/repositories/${pr.repository}/pullrequests/${pr.pullRequestId}/commits`,\n );\n if (\n commits?.value?.some(\n (c: { author?: { email?: string } }) => c.author?.email !== pr.skipIfCommitsFromAuthorsOtherThan,\n )\n ) {\n logger.info(` - Skipping update as pull request has been modified by another user.`);\n return true;\n }\n }\n\n // Get the branch stats to check if the source branch is behind the target branch\n const stats = await this.restApiGet(\n `${this.organisationApiUrl}/${pr.project}/_apis/git/repositories/${pr.repository}/stats/branches`,\n {\n name: normalizeBranchName(pullRequest.sourceRefName),\n },\n );\n if (stats?.behindCount === undefined) {\n throw new Error(`Failed to get branch stats for '${pullRequest.sourceRefName}'`);\n }\n\n // Skip if the source branch is not behind the target branch\n if (pr.skipIfNotBehindTargetBranch && stats.behindCount === 0) {\n logger.info(` - Skipping update as source branch is not behind target branch.`);\n return true;\n }\n\n // Rebase the target branch into the source branch to reset the \"behind\" count\n const sourceBranchName = normalizeBranchName(pullRequest.sourceRefName);\n const targetBranchName = normalizeBranchName(pullRequest.targetRefName);\n if (stats.behindCount > 0) {\n logger.info(\n ` - Rebasing '${targetBranchName}' into '${sourceBranchName}' (${stats.behindCount} commit(s) behind)...`,\n );\n const rebase = await this.restApiPost(\n `${this.organisationApiUrl}/${pr.project}/_apis/git/repositories/${pr.repository}/refs`,\n [\n {\n name: pullRequest.sourceRefName,\n oldObjectId: pullRequest.lastMergeSourceCommit.commitId,\n newObjectId: pr.commit,\n },\n ],\n );\n if (rebase?.value?.[0]?.success !== true) {\n throw new Error('Failed to rebase the target branch into the source branch');\n }\n }\n\n // Push all file changes to the source branch\n logger.info(` - Pushing ${pr.changes.length} file change(s) to branch '${pullRequest.sourceRefName}'...`);\n const push = await this.restApiPost(\n `${this.organisationApiUrl}/${pr.project}/_apis/git/repositories/${pr.repository}/pushes`,\n {\n refUpdates: [\n {\n name: pullRequest.sourceRefName,\n oldObjectId: pr.commit,\n },\n ],\n commits: [\n {\n comment:\n pullRequest.mergeStatus === PullRequestAsyncStatus.Conflicts\n ? 'Resolve merge conflicts'\n : `Rebase '${sourceBranchName}' onto '${targetBranchName}'`,\n author: pr.author,\n changes: pr.changes\n .filter((change) => change.changeType !== VersionControlChangeType.None)\n .map(({ changeType, ...change }) => {\n return {\n changeType,\n item: { path: normalizeFilePath(change.path) },\n newContent:\n changeType !== VersionControlChangeType.Delete\n ? {\n content: Buffer.from(change.content!, <BufferEncoding>change.encoding).toString('base64'),\n contentType: ItemContentType.Base64Encoded,\n }\n : undefined,\n };\n }),\n },\n ],\n },\n );\n if (!push?.commits?.length) {\n throw new Error('Failed to push changes to source branch, no commits were created');\n }\n logger.info(` - Pushed commit: ${push.commits.map((c: { commitId: string }) => c.commitId).join(', ')}.`);\n\n logger.info(` - Pull request was updated successfully.`);\n return true;\n } catch (e) {\n logger.error(`Failed to update pull request: ${e}`);\n logger.debug(e); // Dump the error stack trace to help with debugging\n return false;\n }\n }\n\n /**\n * Approve a pull request.\n * Requires scope \"Code (Write)\" (vso.code_write).\n * @param pr\n * @returns\n */\n public async approvePullRequest(pr: IApprovePullRequest): Promise<boolean> {\n logger.info(`Approving pull request #${pr.pullRequestId}...`);\n try {\n // Approve the pull request\n logger.info(` - Updating reviewer vote on pull request...`);\n const userId = await this.getUserId();\n const userVote = await this.restApiPut(\n `${this.organisationApiUrl}/${pr.project}/_apis/git/repositories/${pr.repository}/pullrequests/${pr.pullRequestId}/reviewers/${userId}`,\n {\n // Vote 10 = \"approved\"; 5 = \"approved with suggestions\"; 0 = \"no vote\"; -5 = \"waiting for author\"; -10 = \"rejected\"\n vote: 10,\n // Reapprove must be set to true after the 2023 August 23 update;\n // Approval of a previous PR iteration does not count in later iterations, which means we must (re)approve every after push to the source branch\n // See: https://learn.microsoft.com/en-us/azure/devops/release-notes/2023/sprint-226-update#new-branch-policy-preventing-users-to-approve-their-own-changes\n // https://github.com/mburumaxwell/dependabot-azure-devops/issues/1069\n isReapprove: true,\n },\n // API version 7.1 is required to use the 'isReapprove' parameter\n // See: https://learn.microsoft.com/en-us/rest/api/azure/devops/git/pull-request-reviewers/create-pull-request-reviewer?view=azure-devops-rest-7.1&tabs=HTTP#request-body\n // https://learn.microsoft.com/en-us/azure/devops/integrate/concepts/rest-api-versioning?view=azure-devops#supported-versions\n '7.1',\n );\n if (userVote?.vote !== 10) {\n throw new Error('Failed to approve pull request, vote was not recorded');\n }\n\n logger.info(` - Pull request was approved successfully.`);\n return true;\n } catch (e) {\n logger.error(`Failed to approve pull request: ${e}`);\n logger.debug(e); // Dump the error stack trace to help with debugging\n return false;\n }\n }\n\n /**\n * Abandon a pull request.\n * Requires scope \"Code (Write)\" (vso.code_write).\n * @param pr\n * @returns\n */\n public async abandonPullRequest(pr: IAbandonPullRequest): Promise<boolean> {\n logger.info(`Abandoning pull request #${pr.pullRequestId}...`);\n try {\n const userId = await this.getUserId();\n\n // Add a comment to the pull request, if supplied\n if (pr.comment) {\n logger.info(` - Adding abandonment reason comment to pull request...`);\n const threadId = await this.addCommentThread({\n ...pr,\n content: pr.comment,\n userId,\n });\n if (!threadId) {\n throw new Error('Failed to add comment to pull request, thread was not created');\n }\n }\n\n // Abandon the pull request\n logger.info(` - Abandoning pull request...`);\n const abandonedPullRequest = await this.restApiPatch(\n `${this.organisationApiUrl}/${pr.project}/_apis/git/repositories/${pr.repository}/pullrequests/${pr.pullRequestId}`,\n {\n status: PullRequestStatus.Abandoned,\n closedBy: {\n id: userId,\n },\n },\n );\n if (abandonedPullRequest?.status?.toLowerCase() !== 'abandoned') {\n throw new Error('Failed to abandon pull request, status was not updated');\n }\n\n // Delete the source branch if required\n if (pr.deleteSourceBranch) {\n logger.info(` - Deleting source branch...`);\n const deletedBranch = await this.restApiPost(\n `${this.organisationApiUrl}/${pr.project}/_apis/git/repositories/${pr.repository}/refs`,\n [\n {\n name: abandonedPullRequest.sourceRefName,\n oldObjectId: abandonedPullRequest.lastMergeSourceCommit.commitId,\n newObjectId: '0000000000000000000000000000000000000000',\n isLocked: false,\n },\n ],\n );\n if (deletedBranch?.value?.[0]?.success !== true) {\n throw new Error('Failed to delete the source branch');\n }\n }\n\n logger.info(` - Pull request was abandoned successfully.`);\n return true;\n } catch (e) {\n logger.error(`Failed to abandon pull request: ${e}`);\n logger.debug(e); // Dump the error stack trace to help with debugging\n return false;\n }\n }\n\n /**\n * Add a comment thread on a pull request.\n * Requires scope \"Code (Write)\" (vso.code_write).\n */\n public async addCommentThread(comment: IPullRequestComment): Promise<number | undefined> {\n const userId = comment.userId ?? (await this.getUserId());\n const thread = await this.restApiPost(\n `${this.organisationApiUrl}/${comment.project}/_apis/git/repositories/${comment.repository}/pullrequests/${comment.pullRequestId}/threads`,\n {\n status: CommentThreadStatus.Closed,\n comments: [\n {\n author: {\n id: userId,\n },\n content: comment.content,\n commentType: CommentType.System,\n },\n ],\n },\n );\n return thread?.id;\n }\n\n private async restApiGet(\n url: string,\n params?: Record<string, unknown>,\n apiVersion: string = AzureDevOpsWebApiClient.API_VERSION,\n ) {\n params ??= {};\n const queryString = Object.keys(params)\n .map((key) => `${key}=${params[key]}`)\n .join('&');\n const fullUrl = `${url}?api-version=${apiVersion}${queryString ? `&${queryString}` : ''}`;\n\n return await sendRestApiRequestWithRetry(\n 'GET',\n fullUrl,\n undefined,\n async () => {\n return await fetch(fullUrl, {\n method: 'GET',\n headers: {\n Accept: 'application/json',\n Authorization: `Basic ${Buffer.from(`:${this.accessToken}`).toString('base64')}`,\n },\n });\n },\n this.debug,\n );\n }\n\n private async restApiPost(url: string, data?: unknown, apiVersion: string = AzureDevOpsWebApiClient.API_VERSION) {\n const fullUrl = `${url}?api-version=${apiVersion}`;\n return await sendRestApiRequestWithRetry(\n 'POST',\n fullUrl,\n data,\n async () => {\n return await fetch(fullUrl, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Basic ${Buffer.from(`:${this.accessToken}`).toString('base64')}`,\n },\n body: JSON.stringify(data),\n });\n },\n this.debug,\n );\n }\n\n private async restApiPut(url: string, data?: unknown, apiVersion: string = AzureDevOpsWebApiClient.API_VERSION) {\n const fullUrl = `${url}?api-version=${apiVersion}`;\n return await sendRestApiRequestWithRetry(\n 'PUT',\n fullUrl,\n data,\n async () => {\n return await fetch(fullUrl, {\n method: 'PUT',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Basic ${Buffer.from(`:${this.accessToken}`).toString('base64')}`,\n },\n body: JSON.stringify(data),\n });\n },\n this.debug,\n );\n }\n\n private async restApiPatch(\n url: string,\n data?: unknown,\n contentType?: string,\n apiVersion: string = AzureDevOpsWebApiClient.API_VERSION,\n ) {\n const fullUrl = `${url}?api-version=${apiVersion}`;\n return await sendRestApiRequestWithRetry(\n 'PATCH',\n fullUrl,\n data,\n async () => {\n return await fetch(fullUrl, {\n method: 'PATCH',\n headers: {\n 'Content-Type': contentType || 'application/json',\n Authorization: `Basic ${Buffer.from(`:${this.accessToken}`).toString('base64')}`,\n },\n body: JSON.stringify(data),\n });\n },\n this.debug,\n );\n }\n}\n\nfunction mergeCommitMessage(id: number, title: string, description: string): string {\n //\n // The merge commit message should contain the PR number and title for tracking.\n // This is the default behaviour in Azure DevOps.\n // Example:\n // Merged PR 24093: Bump Tingle.Extensions.Logging.LogAnalytics from 3.4.2-ci0005 to 3.4.2-ci0006\n //\n // Bumps [Tingle.Extensions.Logging.LogAnalytics](...) from 3.4.2-ci0005 to 3.4.2-ci0006\n // - [Release notes](....)\n // - [Changelog](....)\n // - [Commits](....)\n //\n // There appears to be a DevOps bug when setting \"completeOptions\" with a \"mergeCommitMessage\" even when truncated to 4000 characters.\n // The error message is:\n // Invalid argument value.\n // Parameter name: Completion options have exceeded the maximum encoded length (4184/4000)\n //\n // The effective limit seems to be about 3500 characters:\n // https://developercommunity.visualstudio.com/t/raise-the-character-limit-for-pull-request-descrip/365708#T-N424531\n //\n return `Merged PR ${id}: ${title}\\n\\n${description}`.slice(0, 3500);\n}\n\nfunction isGuid(guid: string): boolean {\n const regex = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;\n return regex.test(guid);\n}\n\nfunction getIdentityApiUrl(organisationApiUrl: string): string {\n const uri = new URL(organisationApiUrl);\n const hostname = uri.hostname.toLowerCase();\n\n // If the organisation is hosted on Azure DevOps, use the 'vssps.dev.azure.com' domain\n if (hostname === 'dev.azure.com' || hostname.endsWith('.visualstudio.com')) {\n uri.host = 'vssps.dev.azure.com';\n }\n return uri.toString();\n}\n\nexport async function sendRestApiRequestWithRetry(\n method: string,\n url: string,\n payload: unknown,\n requestAsync: () => Promise<Response>,\n isDebug: boolean = false,\n retryCount: number = 3,\n retryDelay: number = 3000,\n) {\n let body: string | undefined;\n try {\n // Send the request, ready the response\n if (isDebug) logger.debug(`🌎 🠊 [${method}] ${url}`);\n const response = await requestAsync();\n body = await response.text();\n const { status: statusCode, statusText: statusMessage } = response;\n if (isDebug) logger.debug(`🌎 🠈 [${statusCode}] ${statusMessage}`);\n\n // Check that the request was successful\n if (statusCode < 200 || statusCode > 299) {\n throw new HttpRequestError(`HTTP ${method} '${url}' failed: ${statusCode} ${statusMessage}`, statusCode);\n }\n\n // Parse the response\n return JSON.parse(body);\n } catch (e) {\n const err = e as Error;\n // Retry the request if the error is a temporary failure\n if (retryCount > 1 && isErrorTemporaryFailure(err)) {\n logger.warn(err.message);\n if (isDebug) logger.debug(`⏳ Retrying request in ${retryDelay}ms...`);\n await new Promise((resolve) => setTimeout(resolve, retryDelay));\n return sendRestApiRequestWithRetry(method, url, payload, requestAsync, isDebug, retryCount - 1, retryDelay);\n }\n\n // In debug mode, log the error, request, and response for debugging\n if (isDebug) {\n if (payload) {\n logger.debug(`REQUEST: ${JSON.stringify(payload)}`);\n }\n if (body) {\n logger.debug(`RESPONSE: ${body}`);\n }\n }\n\n logger.trace(`THROW${e}`);\n throw e;\n }\n}\n","import { existsSync } from 'node:fs';\nimport { readFile } from 'node:fs/promises';\nimport * as path from 'node:path';\n\nimport {\n type DependabotConfig,\n POSSIBLE_CONFIG_FILE_PATHS,\n parseDependabotConfig,\n type VariableFinderFn,\n} from '@/dependabot';\nimport { logger } from '@/logger';\nimport type { AzureDevOpsRepositoryUrl } from './url-parts';\n\n/**\n * Parse the dependabot config YAML file to specify update configuration.\n * The file should be located at any of `POSSIBLE_CONFIG_FILE_PATHS`.\n *\n * To view YAML file format, visit\n * https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#allow\n *\n * @returns {DependabotConfig} config - the dependabot configuration\n */\nexport async function getDependabotConfig({\n url,\n token,\n remote,\n rootDir = process.cwd(),\n variableFinder,\n}: {\n url: AzureDevOpsRepositoryUrl;\n token: string;\n /**\n * Whether to fetch the configuration file via the REST API (true) or look for it locally (false).\n */\n remote: boolean;\n rootDir?: string;\n variableFinder: VariableFinderFn;\n}): Promise<DependabotConfig> {\n let configPath: undefined | string;\n let configContents: undefined | string;\n\n /*\n * The configuration file can be available locally if the repository is cloned.\n * Otherwise, we should get it via the API which supports 2 scenarios:\n * 1. Running the pipeline without cloning, which is useful for huge repositories (multiple submodules or large commit log)\n * 2. Running a single pipeline to update multiple repositories https://github.com/mburumaxwell/dependabot-azure-devops/issues/328\n */\n\n if (remote) {\n logger.debug(`Attempting to fetch configuration file via REST API ...`);\n for (const fp of POSSIBLE_CONFIG_FILE_PATHS) {\n // make HTTP request\n const requestUrl = `${url.value}${url.project}/_apis/git/repositories/${url.repository}/items?path=/${fp}`;\n logger.debug(`GET ${requestUrl}`);\n\n try {\n const authHeader = `Basic ${Buffer.from(`x-access-token:${token}`).toString('base64')}`;\n const response = await fetch(requestUrl, {\n headers: {\n Authorization: authHeader,\n Accept: '*/*', // Gotcha!!! without this SH*T fails terribly\n },\n });\n if (response.ok) {\n logger.debug(`Found configuration file at '${requestUrl}'`);\n configContents = await response.text();\n configPath = fp;\n break;\n } else if (response.status === 404) {\n logger.trace(`No configuration file at '${requestUrl}'`);\n // biome-ignore lint/complexity/noUselessContinue: continue is useful here for clarity\n continue;\n } else if (response.status === 401) {\n throw new Error(`No or invalid access token has been provided to access '${requestUrl}'`);\n } else if (response.status === 403) {\n throw new Error(`The access token provided does not have permissions to access '${requestUrl}'`);\n }\n } catch (error) {\n if (error instanceof Error && error.message.includes('access token')) {\n throw error;\n } else {\n throw error;\n }\n }\n }\n } else {\n for (const fp of POSSIBLE_CONFIG_FILE_PATHS) {\n const filePath = path.join(rootDir, fp);\n if (existsSync(filePath)) {\n logger.debug(`Found configuration file cloned at ${filePath}`);\n configContents = await readFile(filePath, 'utf-8');\n configPath = filePath;\n break;\n } else {\n logger.trace(`No configuration file cloned at ${filePath}`);\n }\n }\n }\n\n // Ensure we have file contents. Otherwise throw a well readable error.\n if (!configContents || !configPath || typeof configContents !== 'string') {\n throw new Error(`Configuration file not found at possible locations: ${POSSIBLE_CONFIG_FILE_PATHS.join(', ')}`);\n } else {\n logger.trace('Configuration file contents read.');\n }\n\n return await parseDependabotConfig({ configContents, configPath, variableFinder });\n}\n","export type AzureDevOpsOrganizationUrl = {\n /** URL of the organisation. This may lack the project name */\n value: URL;\n\n /** Organisation URL hostname */\n hostname: string;\n\n /** Organisation API endpoint URL */\n 'api-endpoint': string;\n\n /** Organisation name/slug */\n organisation: string;\n\n /** Virtual directory if present (on-premises only) */\n 'virtual-directory'?: string;\n};\n\nexport type AzureDevOpsProjectUrl = AzureDevOpsOrganizationUrl & {\n /** Project ID or Name */\n project: string;\n};\n\nexport type AzureDevOpsRepositoryUrl = AzureDevOpsProjectUrl & {\n /** Repository ID or Name */\n repository: string;\n\n /** Slug of the repository e.g. `contoso/prj1/_git/repo1`, `tfs/contoso/prj1/_git/repo1` */\n 'repository-slug': string;\n};\n\nexport function extractOrganizationUrl({ organisationUrl }: { organisationUrl: string }): AzureDevOpsOrganizationUrl {\n // convert url string into a valid JS URL object\n const value = new URL(organisationUrl);\n const protocol = value.protocol.slice(0, -1);\n let { hostname } = value;\n const visualStudioUrlRegex = /^(?<prefix>\\S+)\\.visualstudio\\.com$/iu;\n if (visualStudioUrlRegex.test(hostname)) hostname = 'dev.azure.com';\n\n const organisation: string = extractOrganisation(organisationUrl);\n\n const virtualDirectory = extractVirtualDirectory(value);\n const apiEndpoint = `${protocol}://${hostname}${value.port ? `:${value.port}` : ''}/${virtualDirectory ? `${virtualDirectory}/` : ''}`;\n\n return {\n value,\n hostname,\n 'api-endpoint': apiEndpoint,\n organisation,\n 'virtual-directory': virtualDirectory,\n };\n}\n\nexport function extractProjectUrl({\n organisationUrl,\n project,\n}: {\n organisationUrl: string;\n project: string;\n}): AzureDevOpsProjectUrl {\n const extracted = extractOrganizationUrl({ organisationUrl });\n const escapedProject = encodeURI(project); // encode special characters like spaces\n\n return {\n ...extracted,\n project: escapedProject,\n };\n}\n\nexport function extractRepositoryUrl({\n organisationUrl,\n project,\n repository,\n}: {\n organisationUrl: string;\n project: string;\n repository: string;\n}): AzureDevOpsRepositoryUrl {\n const extracted = extractProjectUrl({ organisationUrl, project });\n const { organisation, 'virtual-directory': virtualDirectory, project: escapedProject } = extracted;\n\n const escapedRepository = encodeURI(repository); // encode special characters like spaces\n const repoSlug = `${virtualDirectory ? `${virtualDirectory}/` : ''}${organisation}/${escapedProject}/_git/${escapedRepository}`;\n\n return {\n ...extracted,\n repository: escapedRepository,\n 'repository-slug': repoSlug,\n };\n}\n\n/**\n * Extract organisation name from organisation URL\n *\n * @param organisationUrl\n *\n * @returns organisation name\n */\nfunction extractOrganisation(organisationUrl: string): string {\n const url = new URL(organisationUrl);\n const { hostname, pathname } = url;\n\n // Check for old style: https://x.visualstudio.com/\n if (hostname.endsWith('.visualstudio.com')) {\n return hostname.split('.')[0]!;\n }\n\n // For new style and on-premise, parse the pathname\n // pathname examples: '/contoso/', '/contoso', '/tfs/contoso/', '/tfs/contoso', '/contoso/Core'\n const pathSegments = pathname.split('/').filter((segment) => segment !== '');\n\n // Check for on-premise style: https://server.domain.com/tfs/contoso/\n if (pathSegments.length >= 2 && hostname !== 'dev.azure.com') {\n return pathSegments[1]!; // Return 'contoso' from '/tfs/contoso/'\n }\n\n // Check for new style: https://dev.azure.com/contoso/ or https://dev.azure.com/contoso or https://dev.azure.com/contoso/Core\n if (pathSegments.length >= 1) {\n return pathSegments[0]!; // Always return the first path segment for dev.azure.com\n }\n\n throw new Error(`Error parsing organisation from organisation url: '${organisationUrl}'.`);\n}\n\n/**\n * Extract virtual directory from organisation URL\n *\n * Virtual Directories are sometimes used in on-premises\n * @param organisationUrl\n *\n * @returns virtual directory\n *\n * @example URLs typically are like this:`https://server.domain.com/tfs/x/` and `tfs` is the virtual directory\n */\nfunction extractVirtualDirectory(organisationUrl: URL) {\n // extract the pathname from the url then split\n // pathname takes the shape '/tfs/x/'\n const path = organisationUrl.pathname.split('/');\n\n // Virtual Directories are sometimes used in on-premises\n // URLs typically are like this: https://server.domain.com/tfs/x/\n // The pathname extracted looks like this: '/tfs/x/'\n return path.length === 4 ? path[1]! : undefined;\n}\n"],"mappings":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,qBAAqB,kBAAkB,SAAS,mBAAmB;CAEzF,MAAM,oBAAoB,UAAU,WAAW;CAC/C,MAAM,WAAW,GAAG,mBAAmB,GAAG,iBAAiB,KAAK,KAAK,aAAa,GAAG,eAAe,QAAQ;AAE5G,QAAO;EACL,GAAG;EACH,YAAY;EACZ,mBAAmB;EACpB;;;;;;;;;AAUH,SAAS,oBAAoB,iBAAiC;CAE5D,MAAM,EAAE,UAAU,aADN,IAAI,IAAI,gBAAgB;AAIpC,KAAI,SAAS,SAAS,oBAAoB,CACxC,QAAO,SAAS,MAAM,IAAI,CAAC;CAK7B,MAAM,eAAe,SAAS,MAAM,IAAI,CAAC,QAAQ,YAAY,YAAY,GAAG;AAG5E,KAAI,aAAa,UAAU,KAAK,aAAa,gBAC3C,QAAO,aAAa;AAItB,KAAI,aAAa,UAAU,EACzB,QAAO,aAAa;AAGtB,OAAM,IAAI,MAAM,sDAAsD,gBAAgB,IAAI;;;;;;;;;;;;AAa5F,SAAS,wBAAwB,iBAAsB;CAGrD,MAAMC,SAAO,gBAAgB,SAAS,MAAM,IAAI;AAKhD,QAAOA,OAAK,WAAW,IAAIA,OAAK,KAAM"}
1
+ {"version":3,"file":"index.mjs","names":["path","reason: string | undefined","reviewers: IdentityRefWithVote[]","body: string | undefined","configPath: undefined | string","configContents: undefined | string","organisation: string","path"],"sources":["../../src/azure/types.ts","../../src/azure/models.ts","../../src/azure/utils.ts","../../src/azure/client.ts","../../src/azure/config.ts","../../src/azure/url-parts.ts"],"sourcesContent":["export enum VersionControlChangeType {\n None = 0,\n Add = 1,\n Edit = 2,\n Encoding = 4,\n Rename = 8,\n Delete = 16,\n Undelete = 32,\n Branch = 64,\n Merge = 128,\n Lock = 256,\n Rollback = 512,\n SourceRename = 1024,\n TargetRename = 2048,\n Property = 4096,\n All = 8191,\n}\n\nexport enum GitPullRequestMergeStrategy {\n NoFastForward = 1,\n Squash = 2,\n Rebase = 3,\n RebaseMerge = 4,\n}\n\nexport enum CommentThreadStatus {\n Unknown = 0,\n Active = 1,\n Fixed = 2,\n WontFix = 3,\n Closed = 4,\n ByDesign = 5,\n Pending = 6,\n}\nexport enum CommentType {\n Unknown = 0,\n Text = 1,\n CodeChange = 2,\n System = 3,\n}\nexport enum ItemContentType {\n RawText = 0,\n Base64Encoded = 1,\n}\nexport enum PullRequestAsyncStatus {\n NotSet = 0,\n Queued = 1,\n Conflicts = 2,\n Succeeded = 3,\n RejectedByPolicy = 4,\n Failure = 5,\n}\nexport enum PullRequestStatus {\n NotSet = 0,\n Active = 1,\n Abandoned = 2,\n Completed = 3,\n All = 4,\n}\n\nexport type IdentityRefWithVote = {\n id?: string;\n displayName?: string;\n uniqueName?: string;\n url?: string;\n imageUrl?: string;\n vote?: number;\n hasDeclined?: boolean;\n isFlagged?: boolean;\n isRequired?: boolean;\n};\n\nexport type AzdoProject = {\n id: string;\n name: string;\n description?: string;\n url: string;\n state: 'deleting' | 'new' | 'wellFormed' | 'createPending' | 'all' | 'unchanged' | 'deleted';\n _links?: {\n self: { href: string };\n collection: { href: string };\n web: { href: string };\n };\n};\n\nexport type AzdoRepository = {\n id: string;\n name: string;\n defaultBranch?: string;\n project: AzdoProject;\n isDisabled?: boolean;\n isFork?: boolean;\n url: string;\n remoteUrl: string;\n webUrl: string;\n};\n\nexport type AzdoListResponse<T> = {\n value: T[];\n count: number;\n};\n\nexport type AzdoRepositoryItem = {\n latestProcessedChange?: {\n commitId?: string;\n };\n content?: string;\n};\n","import type { GitPullRequestMergeStrategy, VersionControlChangeType } from './types';\n\n/**\n * Pull request property names used to store metadata about the pull request.\n * https://learn.microsoft.com/en-us/rest/api/azure/devops/git/pull-request-properties\n */\nexport const DEVOPS_PR_PROPERTY_MICROSOFT_GIT_SOURCE_REF_NAME = 'Microsoft.Git.PullRequest.SourceRefName';\nexport const DEVOPS_PR_PROPERTY_DEPENDABOT_PACKAGE_MANAGER = 'Dependabot.PackageManager';\nexport const DEVOPS_PR_PROPERTY_DEPENDABOT_DEPENDENCIES = 'Dependabot.Dependencies';\n\n/** File change */\nexport interface IFileChange {\n changeType: VersionControlChangeType;\n path: string;\n content?: string;\n encoding?: string;\n}\n\n/** Pull request properties */\nexport interface IPullRequestProperties {\n id: number;\n properties?: {\n name: string;\n value: string;\n }[];\n}\n\n/** Pull request creation request */\nexport interface ICreatePullRequest {\n project: string;\n repository: string;\n source: {\n commit: string;\n branch: string;\n };\n target: {\n branch: string;\n };\n author?: {\n email: string;\n name: string;\n };\n title: string;\n description: string;\n commitMessage: string;\n autoComplete?: {\n ignorePolicyConfigIds?: number[];\n mergeStrategy?: GitPullRequestMergeStrategy;\n };\n assignees?: string[];\n labels?: string[];\n workItems?: string[];\n changes: IFileChange[];\n properties?: {\n name: string;\n value: string;\n }[];\n}\n\n/** Pull request update request */\nexport interface IUpdatePullRequest {\n project: string;\n repository: string;\n pullRequestId: number;\n commit: string;\n author?: {\n email: string;\n name: string;\n };\n changes: IFileChange[];\n skipIfDraft?: boolean;\n skipIfCommitsFromAuthorsOtherThan?: string;\n skipIfNotBehindTargetBranch?: boolean;\n}\n\n/** Pull request approval request */\nexport interface IApprovePullRequest {\n project: string;\n repository: string;\n pullRequestId: number;\n}\n\n/** Pull request abandon request */\nexport interface IAbandonPullRequest {\n project: string;\n repository: string;\n pullRequestId: number;\n comment?: string;\n deleteSourceBranch?: boolean;\n}\n\n/** Pull request comment */\nexport interface IPullRequestComment {\n project: string;\n repository: string;\n pullRequestId: number;\n content: string;\n userId?: string;\n}\n","import * as path from 'node:path';\n\nimport {\n type DependabotClosePullRequest,\n type DependabotCreatePullRequest,\n type DependabotDependency,\n type DependabotExistingGroupPR,\n DependabotExistingGroupPRSchema,\n type DependabotExistingPR,\n DependabotExistingPRSchema,\n type DependabotUpdatePullRequest,\n} from '@/dependabot';\nimport {\n DEVOPS_PR_PROPERTY_DEPENDABOT_DEPENDENCIES,\n DEVOPS_PR_PROPERTY_DEPENDABOT_PACKAGE_MANAGER,\n type IFileChange,\n type IPullRequestProperties,\n} from './models';\nimport { VersionControlChangeType } from './types';\n\nexport function normalizeFilePath(path: string): string {\n // Convert backslashes to forward slashes, convert './' => '/' and ensure the path starts with a forward slash if it doesn't already, this is how DevOps paths are formatted\n return path\n ?.replace(/\\\\/g, '/')\n ?.replace(/^\\.\\//, '/')\n ?.replace(/^([^/])/, '/$1');\n}\n\nexport function normalizeBranchName(branch?: string): string | undefined {\n // Strip the 'refs/heads/' prefix from the branch name, if present\n return branch?.replace(/^refs\\/heads\\//i, '');\n}\n\nexport const DependenciesPrPropertySchema = DependabotExistingPRSchema.array().or(DependabotExistingGroupPRSchema);\n\nexport function buildPullRequestProperties(\n packageManager: string,\n dependencies: DependabotExistingPR[] | DependabotExistingGroupPR,\n) {\n return [\n {\n name: DEVOPS_PR_PROPERTY_DEPENDABOT_PACKAGE_MANAGER,\n value: packageManager,\n },\n {\n name: DEVOPS_PR_PROPERTY_DEPENDABOT_DEPENDENCIES,\n value: JSON.stringify(dependencies),\n },\n ];\n}\n\nexport function parsePullRequestProperties(\n pullRequests: IPullRequestProperties[],\n packageManager: string | null,\n): Record<string, DependabotExistingPR[] | DependabotExistingGroupPR> {\n return Object.fromEntries(\n pullRequests\n .filter((pr) => {\n return pr.properties?.find(\n (p) =>\n p.name === DEVOPS_PR_PROPERTY_DEPENDABOT_PACKAGE_MANAGER &&\n (packageManager === null || p.value === packageManager),\n );\n })\n .map((pr) => {\n return [\n pr.id,\n DependenciesPrPropertySchema.parse(\n JSON.parse(pr.properties!.find((p) => p.name === DEVOPS_PR_PROPERTY_DEPENDABOT_DEPENDENCIES)!.value),\n ),\n ];\n }),\n );\n}\n\nexport function getPullRequestForDependencyNames(\n existingPullRequests: IPullRequestProperties[],\n packageManager: string,\n dependencyNames: string[],\n): IPullRequestProperties | undefined {\n return existingPullRequests.find((pr) => {\n return (\n pr.properties?.find(\n (p) => p.name === DEVOPS_PR_PROPERTY_DEPENDABOT_PACKAGE_MANAGER && p.value === packageManager,\n ) &&\n pr.properties?.find(\n (p) =>\n p.name === DEVOPS_PR_PROPERTY_DEPENDABOT_DEPENDENCIES &&\n areEqual(getDependencyNames(DependenciesPrPropertySchema.parse(JSON.parse(p.value))), dependencyNames),\n )\n );\n });\n}\n\nfunction getDependencyNames(dependencies: DependabotExistingPR[] | DependabotExistingGroupPR): string[] {\n const deps = Array.isArray(dependencies) ? dependencies : dependencies.dependencies;\n return deps.map((dep) => dep['dependency-name']?.toString());\n}\n\nfunction areEqual(a: string[], b: string[]): boolean {\n if (a.length !== b.length) return false;\n return a.every((name) => b.includes(name));\n}\n\nexport function getPullRequestChangedFilesForOutputData(\n data: DependabotCreatePullRequest | DependabotUpdatePullRequest,\n): IFileChange[] {\n return data['updated-dependency-files']\n .filter((file) => file.type === 'file')\n .map((file) => {\n let changeType = VersionControlChangeType.None;\n if (file.deleted === true || file.operation === 'delete') {\n changeType = VersionControlChangeType.Delete;\n } else if (file.operation === 'update') {\n changeType = VersionControlChangeType.Edit;\n } else {\n changeType = VersionControlChangeType.Add;\n }\n return {\n changeType: changeType,\n path: path.join(file.directory, file.name),\n content: file.content ?? undefined,\n encoding: file.content_encoding || 'utf-8', // default to 'utf-8' if nullish or empty string\n } satisfies IFileChange;\n });\n}\n\nexport function getPullRequestCloseReasonForOutputData(data: DependabotClosePullRequest): string | undefined {\n // The first dependency is the \"lead\" dependency in a multi-dependency update\n const leadDependencyName = data['dependency-names'][0];\n let reason: string | undefined;\n switch (data.reason) {\n case 'dependencies_changed':\n reason = `Looks like the dependencies have changed`;\n break;\n case 'dependency_group_empty':\n reason = `Looks like the dependencies in this group are now empty`;\n break;\n case 'dependency_removed':\n reason = `Looks like ${leadDependencyName} is no longer a dependency`;\n break;\n case 'up_to_date':\n reason = `Looks like ${leadDependencyName} is up-to-date now`;\n break;\n case 'update_no_longer_possible':\n reason = `Looks like ${leadDependencyName} can no longer be updated`;\n break;\n }\n if (reason && reason.length > 0) {\n reason += ', so this is no longer needed.';\n }\n return reason;\n}\n\nexport function getPullRequestDependenciesPropertyValueForOutputData(\n data: DependabotCreatePullRequest,\n): DependabotExistingPR[] | DependabotExistingGroupPR {\n const dependencies = data.dependencies?.map((dep) => {\n return {\n 'dependency-name': dep.name,\n 'dependency-version': dep.version,\n directory: dep.directory,\n };\n });\n const dependencyGroupName = data['dependency-group']?.name;\n if (!dependencyGroupName) return dependencies;\n return {\n 'dependency-group-name': dependencyGroupName,\n dependencies: dependencies,\n } as DependabotExistingGroupPR;\n}\n\nexport function getPullRequestDescription(\n packageManager: string,\n body: string | null | undefined,\n dependencies: DependabotDependency[],\n): string {\n let header = '';\n const footer = '';\n\n // Fix up GitHub mentions encoding issues by removing instances of the zero-width space '\\u200B' as it does not render correctly in Azure DevOps.\n // https://github.com/dependabot/dependabot-core/issues/9572\n // https://github.com/dependabot/dependabot-core/blob/313fcff149b3126cb78b38d15f018907d729f8cc/common/lib/dependabot/pull_request_creator/message_builder/link_and_mention_sanitizer.rb#L245-L252\n const description = (body || '').replace(new RegExp(decodeURIComponent('%EF%BF%BD%EF%BF%BD%EF%BF%BD'), 'g'), '');\n\n // If there is exactly one dependency, add a compatibility score badge to the description header.\n // Compatibility scores are intended for single dependency security updates, not group updates.\n // https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores\n if (dependencies.length === 1) {\n const compatibilityScoreBadges = dependencies.map((dep) => {\n return `![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=${dep.name}&package-manager=${packageManager}&previous-version=${dep['previous-version']}&new-version=${dep.version})`;\n });\n header += `${compatibilityScoreBadges.join(' ')}\\n\\n`;\n }\n\n // Build the full pull request description.\n // The header/footer must not be truncated. If the description is too long, we truncate the body.\n const maxDescriptionLength = 4000;\n const maxDescriptionLengthAfterHeaderAndFooter = maxDescriptionLength - header.length - footer.length;\n return `${header}${description.substring(0, maxDescriptionLengthAfterHeaderAndFooter)}${footer}`;\n}\n","import { HttpRequestError, isErrorTemporaryFailure } from '@/http';\nimport { logger } from '@/logger';\nimport type {\n IAbandonPullRequest,\n IApprovePullRequest,\n ICreatePullRequest,\n IPullRequestComment,\n IPullRequestProperties,\n IUpdatePullRequest,\n} from './models';\nimport {\n type AzdoListResponse,\n type AzdoProject,\n type AzdoRepository,\n type AzdoRepositoryItem,\n CommentThreadStatus,\n CommentType,\n type IdentityRefWithVote,\n ItemContentType,\n PullRequestAsyncStatus,\n PullRequestStatus,\n VersionControlChangeType,\n} from './types';\nimport type { AzureDevOpsOrganizationUrl } from './url-parts';\nimport { normalizeBranchName, normalizeFilePath } from './utils';\n\n/** Returned from AzureDevOpsWebApiClient.getUserId() when no user is authenticated */\nexport const ANONYMOUS_USER_ID = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa';\n\n/** Azure DevOps REST API client. */\nexport class AzureDevOpsWebApiClient {\n private readonly organisationApiUrl: string;\n private readonly identityApiUrl: string;\n private readonly accessToken: string;\n private readonly debug: boolean;\n\n private authenticatedUserId?: string;\n private resolvedUserIds: Record<string, string>;\n\n public static API_VERSION = '5.0'; // this is the same version used by dependabot-core\n public static API_VERSION_PREVIEW = '5.0-preview';\n\n constructor(url: AzureDevOpsOrganizationUrl, accessToken: string, debug: boolean = false) {\n const organisationApiUrl = url.value.toString();\n this.organisationApiUrl = organisationApiUrl.replace(/\\/$/, ''); // trim trailing slash\n this.identityApiUrl = getIdentityApiUrl(organisationApiUrl).replace(/\\/$/, ''); // trim trailing slash\n this.accessToken = accessToken;\n this.debug = debug;\n this.resolvedUserIds = {};\n }\n\n /**\n * Get the identity of the authenticated user.\n * @returns\n */\n public async getUserId(): Promise<string> {\n if (!this.authenticatedUserId) {\n const connectionData = await this.restApiGet(\n `${this.organisationApiUrl}/_apis/connectiondata`,\n undefined,\n AzureDevOpsWebApiClient.API_VERSION_PREVIEW,\n );\n this.authenticatedUserId = connectionData?.authenticatedUser?.id;\n if (!this.authenticatedUserId) {\n throw new Error('Failed to get authenticated user ID');\n }\n }\n return this.authenticatedUserId;\n }\n\n /**\n * Get the identity id from a user name, email, or group name.\n * Requires scope \"Identity (Read)\" (vso.identity).\n * @param userNameEmailOrGroupName\n * @returns\n */\n public async resolveIdentityId(userNameEmailOrGroupName: string): Promise<string | undefined> {\n if (this.resolvedUserIds[userNameEmailOrGroupName]) {\n return this.resolvedUserIds[userNameEmailOrGroupName];\n }\n try {\n const identities = await this.restApiGet(`${this.identityApiUrl}/_apis/identities`, {\n searchFilter: 'General',\n filterValue: userNameEmailOrGroupName,\n queryMembership: 'None',\n });\n if (!identities?.value || identities.value.length === 0) {\n return undefined;\n }\n this.resolvedUserIds[userNameEmailOrGroupName] = identities.value[0]?.id;\n return this.resolvedUserIds[userNameEmailOrGroupName];\n } catch (e) {\n logger.error(`Failed to resolve user id: ${e}`);\n logger.debug(e); // Dump the error stack trace to help with debugging\n return undefined;\n }\n }\n\n public async getProjects(): Promise<AzdoListResponse<AzdoProject> | undefined> {\n try {\n const projects = await this.restApiGet(`${this.organisationApiUrl}/_apis/projects`);\n return projects;\n } catch (e) {\n logger.error(`Failed to get projects: ${e}`);\n logger.debug(e); // Dump the error stack trace to help with debugging\n return undefined;\n }\n }\n\n public async getProject(idOrName: string): Promise<AzdoProject | undefined> {\n try {\n const project = await this.restApiGet(\n `${this.organisationApiUrl}/_apis/projects/${encodeURIComponent(idOrName)}`,\n );\n return project;\n } catch (e) {\n logger.error(`Failed to get project: ${e}`);\n logger.debug(e); // Dump the error stack trace to help with debugging\n return undefined;\n }\n }\n\n public async getRepositories(projectIdOrName: string): Promise<AzdoListResponse<AzdoRepository> | undefined> {\n try {\n const repos = await this.restApiGet(\n `${this.organisationApiUrl}/${encodeURIComponent(projectIdOrName)}/_apis/git/repositories`,\n );\n return repos;\n } catch (e) {\n logger.error(`Failed to get repositories: ${e}`);\n logger.debug(e); // Dump the error stack trace to help with debugging\n return undefined;\n }\n }\n\n public async getRepository(projectIdOrName: string, repositoryIdOrName: string): Promise<AzdoRepository | undefined> {\n try {\n const repo = await this.restApiGet(\n `${this.organisationApiUrl}/${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}`,\n );\n return repo;\n } catch (e) {\n if (e instanceof HttpRequestError && e.code === 404) {\n // repository no longer exists\n return undefined;\n } else {\n logger.error(`Failed to get repository: ${e}`);\n logger.debug(e); // Dump the error stack trace to help with debugging\n }\n return undefined;\n }\n }\n\n public async getRepositoryItem(\n projectIdOrName: string,\n repositoryIdOrName: string,\n path: string,\n includeContent: boolean = true,\n latestProcessedChange: boolean = true,\n ): Promise<AzdoRepositoryItem | undefined> {\n try {\n const item = await this.restApiGet(\n `${this.organisationApiUrl}/${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/items`,\n {\n path,\n includeContent,\n latestProcessedChange,\n },\n );\n return item;\n } catch (e) {\n if (e instanceof HttpRequestError && e.code === 404) {\n // item does not exist\n return undefined;\n } else {\n logger.error(`Failed to get repository item: ${e}`);\n logger.debug(e); // Dump the error stack trace to help with debugging\n }\n return undefined;\n }\n }\n\n /**\n * Get the default branch for a repository.\n * Requires scope \"Code (Read)\" (vso.code).\n * @param project\n * @param repository\n * @returns\n */\n public async getDefaultBranch(project: string, repository: string): Promise<string | undefined> {\n try {\n const repo = await this.restApiGet(`${this.organisationApiUrl}/${project}/_apis/git/repositories/${repository}`);\n if (!repo) {\n throw new Error(`Repository '${project}/${repository}' not found`);\n }\n\n return normalizeBranchName(repo.defaultBranch);\n } catch (e) {\n logger.error(`Failed to get default branch for '${project}/${repository}': ${e}`);\n logger.debug(e); // Dump the error stack trace to help with debugging\n return undefined;\n }\n }\n\n /**\n * Get the list of branch names for a repository.\n * Requires scope \"Code (Read)\" (vso.code).\n * @param project\n * @param repository\n * @returns\n */\n public async getBranchNames(project: string, repository: string): Promise<string[] | undefined> {\n try {\n const refs = await this.restApiGet(\n `${this.organisationApiUrl}/${project}/_apis/git/repositories/${repository}/refs`,\n );\n if (!refs) {\n throw new Error(`Repository '${project}/${repository}' not found`);\n }\n\n return refs.value?.map((r: { name?: string }) => normalizeBranchName(r.name)) || [];\n } catch (e) {\n logger.error(`Failed to list branch names for '${project}/${repository}': ${e}`);\n logger.debug(e); // Dump the error stack trace to help with debugging\n return undefined;\n }\n }\n\n /**\n * Get the properties for all active pull request created by the supplied user.\n * Requires scope \"Code (Read)\" (vso.code).\n * @param project\n * @param repository\n * @param creator\n * @returns\n */\n public async getActivePullRequestProperties(\n project: string,\n repository: string,\n creator: string,\n ): Promise<IPullRequestProperties[]> {\n try {\n const pullRequests = await this.restApiGet(\n `${this.organisationApiUrl}/${project}/_apis/git/repositories/${repository}/pullrequests`,\n {\n 'searchCriteria.creatorId': isGuid(creator) ? creator : await this.getUserId(),\n 'searchCriteria.status': 'Active',\n },\n );\n if (!pullRequests?.value || pullRequests.value.length === 0) {\n return [];\n }\n\n return await Promise.all(\n pullRequests.value.map(async (pr: { pullRequestId: number }) => {\n const properties = await this.restApiGet(\n `${this.organisationApiUrl}/${project}/_apis/git/repositories/${repository}/pullrequests/${pr.pullRequestId}/properties`,\n );\n return {\n id: pr.pullRequestId,\n properties:\n Object.keys(properties?.value || {}).map((key) => {\n return {\n name: key,\n value: properties.value[key]?.$value,\n };\n }) || [],\n };\n }),\n );\n } catch (e) {\n logger.error(`Failed to list active pull request properties: ${e}`);\n logger.debug(e); // Dump the error stack trace to help with debugging\n return [];\n }\n }\n\n /**\n * Create a new pull request.\n * Requires scope \"Code (Write)\" (vso.code_write).\n * Requires scope \"Identity (Read)\" (vso.identity), if assignees are specified.\n * @param pr\n * @returns\n */\n public async createPullRequest(pr: ICreatePullRequest): Promise<number | null> {\n logger.info(`Creating pull request '${pr.title}'...`);\n try {\n const userId = await this.getUserId();\n\n // Map the list of the pull request reviewer ids\n // NOTE: Azure DevOps does not have a concept of assignees.\n // We treat them as optional reviewers. Branch policies should be used for required reviewers.\n const reviewers: IdentityRefWithVote[] = [];\n if (pr.assignees && pr.assignees.length > 0) {\n for (const assignee of pr.assignees) {\n const identityId = isGuid(assignee) ? assignee : await this.resolveIdentityId(assignee);\n if (identityId && !reviewers.some((r) => r.id === identityId)) {\n reviewers.push({\n id: identityId,\n });\n } else {\n logger.warn(`Unable to resolve assignee identity '${assignee}'`);\n }\n }\n }\n\n // Create the source branch and push a commit with the dependency file changes\n logger.info(` - Pushing ${pr.changes.length} file change(s) to branch '${pr.source.branch}'...`);\n const push = await this.restApiPost(\n `${this.organisationApiUrl}/${pr.project}/_apis/git/repositories/${pr.repository}/pushes`,\n {\n refUpdates: [\n {\n name: `refs/heads/${pr.source.branch}`,\n oldObjectId: pr.source.commit,\n },\n ],\n commits: [\n {\n comment: pr.commitMessage,\n author: pr.author,\n changes: pr.changes\n .filter((change) => change.changeType !== VersionControlChangeType.None)\n .map(({ changeType, ...change }) => {\n return {\n changeType,\n item: { path: normalizeFilePath(change.path) },\n newContent:\n changeType !== VersionControlChangeType.Delete\n ? {\n content: Buffer.from(change.content!, <BufferEncoding>change.encoding).toString('base64'),\n contentType: ItemContentType.Base64Encoded,\n }\n : undefined,\n };\n }),\n },\n ],\n },\n );\n if (!push?.commits?.length) {\n throw new Error('Failed to push changes to source branch, no commits were created');\n }\n logger.info(` - Pushed commit: ${push.commits.map((c: { commitId: string }) => c.commitId).join(', ')}.`);\n\n // Create the pull request\n logger.info(` - Creating pull request to merge '${pr.source.branch}' into '${pr.target.branch}'...`);\n const pullRequest = await this.restApiPost(\n `${this.organisationApiUrl}/${pr.project}/_apis/git/repositories/${pr.repository}/pullrequests`,\n {\n sourceRefName: `refs/heads/${pr.source.branch}`,\n targetRefName: `refs/heads/${pr.target.branch}`,\n title: pr.title,\n description: pr.description,\n reviewers: reviewers,\n workItemRefs: pr.workItems?.map((id) => ({ id: id })),\n labels: pr.labels?.map((label) => ({ name: label })),\n },\n );\n if (!pullRequest?.pullRequestId) {\n throw new Error('Failed to create pull request, no pull request id was returned');\n }\n logger.info(` - Created pull request: #${pullRequest.pullRequestId}.`);\n\n // Add the pull request properties\n if (pr.properties && pr.properties.length > 0) {\n logger.info(` - Adding dependency metadata to pull request properties...`);\n const newProperties = await this.restApiPatch(\n `${this.organisationApiUrl}/${pr.project}/_apis/git/repositories/${pr.repository}/pullrequests/${pullRequest.pullRequestId}/properties`,\n pr.properties.map((property) => {\n return {\n op: 'add',\n path: `/${property.name}`,\n value: property.value,\n };\n }),\n 'application/json-patch+json',\n );\n if (!newProperties?.count) {\n throw new Error('Failed to add dependency metadata properties to pull request');\n }\n }\n\n // TODO: Upload the pull request description as a 'changes.md' file attachment?\n // This might be a way to work around the 4000 character limit for PR descriptions, but needs more investigation.\n // https://learn.microsoft.com/en-us/rest/api/azure/devops/git/pull-request-attachments/create?view=azure-devops-rest-7.1\n\n // Set the pull request auto-complete status\n if (pr.autoComplete) {\n logger.info(` - Updating auto-complete options...`);\n const updatedPullRequest = await this.restApiPatch(\n `${this.organisationApiUrl}/${pr.project}/_apis/git/repositories/${pr.repository}/pullrequests/${pullRequest.pullRequestId}`,\n {\n autoCompleteSetBy: {\n id: userId,\n },\n completionOptions: {\n autoCompleteIgnoreConfigIds: pr.autoComplete.ignorePolicyConfigIds,\n deleteSourceBranch: true,\n mergeCommitMessage: mergeCommitMessage(pullRequest.pullRequestId, pr.title, pr.description),\n mergeStrategy: pr.autoComplete.mergeStrategy,\n transitionWorkItems: false,\n },\n },\n );\n if (!updatedPullRequest || updatedPullRequest.autoCompleteSetBy?.id !== userId) {\n throw new Error('Failed to set auto-complete on pull request');\n }\n }\n\n logger.info(` - Pull request was created successfully.`);\n return pullRequest.pullRequestId;\n } catch (e) {\n logger.error(`Failed to create pull request: ${e}`);\n logger.debug(e); // Dump the error stack trace to help with debugging\n return null;\n }\n }\n\n /**\n * Update a pull request.\n * Requires scope \"Code (Read & Write)\" (vso.code, vso.code_write).\n * @param pr\n * @returns\n */\n public async updatePullRequest(pr: IUpdatePullRequest): Promise<boolean> {\n logger.info(`Updating pull request #${pr.pullRequestId}...`);\n try {\n // Get the pull request details\n const pullRequest = await this.restApiGet(\n `${this.organisationApiUrl}/${pr.project}/_apis/git/repositories/${pr.repository}/pullrequests/${pr.pullRequestId}`,\n );\n if (!pullRequest) {\n throw new Error(`Pull request #${pr.pullRequestId} not found`);\n }\n\n // Skip if the pull request is a draft\n if (pr.skipIfDraft && pullRequest.isDraft) {\n logger.info(` - Skipping update as pull request is currently marked as a draft.`);\n return true;\n }\n\n // Skip if the pull request has been modified by another author\n if (pr.skipIfCommitsFromAuthorsOtherThan) {\n const commits = await this.restApiGet(\n `${this.organisationApiUrl}/${pr.project}/_apis/git/repositories/${pr.repository}/pullrequests/${pr.pullRequestId}/commits`,\n );\n if (\n commits?.value?.some(\n (c: { author?: { email?: string } }) => c.author?.email !== pr.skipIfCommitsFromAuthorsOtherThan,\n )\n ) {\n logger.info(` - Skipping update as pull request has been modified by another user.`);\n return true;\n }\n }\n\n // Get the branch stats to check if the source branch is behind the target branch\n const stats = await this.restApiGet(\n `${this.organisationApiUrl}/${pr.project}/_apis/git/repositories/${pr.repository}/stats/branches`,\n {\n name: normalizeBranchName(pullRequest.sourceRefName),\n },\n );\n if (stats?.behindCount === undefined) {\n throw new Error(`Failed to get branch stats for '${pullRequest.sourceRefName}'`);\n }\n\n // Skip if the source branch is not behind the target branch\n if (pr.skipIfNotBehindTargetBranch && stats.behindCount === 0) {\n logger.info(` - Skipping update as source branch is not behind target branch.`);\n return true;\n }\n\n // Rebase the target branch into the source branch to reset the \"behind\" count\n const sourceBranchName = normalizeBranchName(pullRequest.sourceRefName);\n const targetBranchName = normalizeBranchName(pullRequest.targetRefName);\n if (stats.behindCount > 0) {\n logger.info(\n ` - Rebasing '${targetBranchName}' into '${sourceBranchName}' (${stats.behindCount} commit(s) behind)...`,\n );\n const rebase = await this.restApiPost(\n `${this.organisationApiUrl}/${pr.project}/_apis/git/repositories/${pr.repository}/refs`,\n [\n {\n name: pullRequest.sourceRefName,\n oldObjectId: pullRequest.lastMergeSourceCommit.commitId,\n newObjectId: pr.commit,\n },\n ],\n );\n if (rebase?.value?.[0]?.success !== true) {\n throw new Error('Failed to rebase the target branch into the source branch');\n }\n }\n\n // Push all file changes to the source branch\n logger.info(` - Pushing ${pr.changes.length} file change(s) to branch '${pullRequest.sourceRefName}'...`);\n const push = await this.restApiPost(\n `${this.organisationApiUrl}/${pr.project}/_apis/git/repositories/${pr.repository}/pushes`,\n {\n refUpdates: [\n {\n name: pullRequest.sourceRefName,\n oldObjectId: pr.commit,\n },\n ],\n commits: [\n {\n comment:\n pullRequest.mergeStatus === PullRequestAsyncStatus.Conflicts\n ? 'Resolve merge conflicts'\n : `Rebase '${sourceBranchName}' onto '${targetBranchName}'`,\n author: pr.author,\n changes: pr.changes\n .filter((change) => change.changeType !== VersionControlChangeType.None)\n .map(({ changeType, ...change }) => {\n return {\n changeType,\n item: { path: normalizeFilePath(change.path) },\n newContent:\n changeType !== VersionControlChangeType.Delete\n ? {\n content: Buffer.from(change.content!, <BufferEncoding>change.encoding).toString('base64'),\n contentType: ItemContentType.Base64Encoded,\n }\n : undefined,\n };\n }),\n },\n ],\n },\n );\n if (!push?.commits?.length) {\n throw new Error('Failed to push changes to source branch, no commits were created');\n }\n logger.info(` - Pushed commit: ${push.commits.map((c: { commitId: string }) => c.commitId).join(', ')}.`);\n\n logger.info(` - Pull request was updated successfully.`);\n return true;\n } catch (e) {\n logger.error(`Failed to update pull request: ${e}`);\n logger.debug(e); // Dump the error stack trace to help with debugging\n return false;\n }\n }\n\n /**\n * Approve a pull request.\n * Requires scope \"Code (Write)\" (vso.code_write).\n * @param pr\n * @returns\n */\n public async approvePullRequest(pr: IApprovePullRequest): Promise<boolean> {\n logger.info(`Approving pull request #${pr.pullRequestId}...`);\n try {\n // Approve the pull request\n logger.info(` - Updating reviewer vote on pull request...`);\n const userId = await this.getUserId();\n const userVote = await this.restApiPut(\n `${this.organisationApiUrl}/${pr.project}/_apis/git/repositories/${pr.repository}/pullrequests/${pr.pullRequestId}/reviewers/${userId}`,\n {\n // Vote 10 = \"approved\"; 5 = \"approved with suggestions\"; 0 = \"no vote\"; -5 = \"waiting for author\"; -10 = \"rejected\"\n vote: 10,\n // Reapprove must be set to true after the 2023 August 23 update;\n // Approval of a previous PR iteration does not count in later iterations, which means we must (re)approve every after push to the source branch\n // See: https://learn.microsoft.com/en-us/azure/devops/release-notes/2023/sprint-226-update#new-branch-policy-preventing-users-to-approve-their-own-changes\n // https://github.com/mburumaxwell/dependabot-azure-devops/issues/1069\n isReapprove: true,\n },\n // API version 7.1 is required to use the 'isReapprove' parameter\n // See: https://learn.microsoft.com/en-us/rest/api/azure/devops/git/pull-request-reviewers/create-pull-request-reviewer?view=azure-devops-rest-7.1&tabs=HTTP#request-body\n // https://learn.microsoft.com/en-us/azure/devops/integrate/concepts/rest-api-versioning?view=azure-devops#supported-versions\n '7.1',\n );\n if (userVote?.vote !== 10) {\n throw new Error('Failed to approve pull request, vote was not recorded');\n }\n\n logger.info(` - Pull request was approved successfully.`);\n return true;\n } catch (e) {\n logger.error(`Failed to approve pull request: ${e}`);\n logger.debug(e); // Dump the error stack trace to help with debugging\n return false;\n }\n }\n\n /**\n * Abandon a pull request.\n * Requires scope \"Code (Write)\" (vso.code_write).\n * @param pr\n * @returns\n */\n public async abandonPullRequest(pr: IAbandonPullRequest): Promise<boolean> {\n logger.info(`Abandoning pull request #${pr.pullRequestId}...`);\n try {\n const userId = await this.getUserId();\n\n // Add a comment to the pull request, if supplied\n if (pr.comment) {\n logger.info(` - Adding abandonment reason comment to pull request...`);\n const threadId = await this.addCommentThread({\n ...pr,\n content: pr.comment,\n userId,\n });\n if (!threadId) {\n throw new Error('Failed to add comment to pull request, thread was not created');\n }\n }\n\n // Abandon the pull request\n logger.info(` - Abandoning pull request...`);\n const abandonedPullRequest = await this.restApiPatch(\n `${this.organisationApiUrl}/${pr.project}/_apis/git/repositories/${pr.repository}/pullrequests/${pr.pullRequestId}`,\n {\n status: PullRequestStatus.Abandoned,\n closedBy: {\n id: userId,\n },\n },\n );\n if (abandonedPullRequest?.status?.toLowerCase() !== 'abandoned') {\n throw new Error('Failed to abandon pull request, status was not updated');\n }\n\n // Delete the source branch if required\n if (pr.deleteSourceBranch) {\n logger.info(` - Deleting source branch...`);\n const deletedBranch = await this.restApiPost(\n `${this.organisationApiUrl}/${pr.project}/_apis/git/repositories/${pr.repository}/refs`,\n [\n {\n name: abandonedPullRequest.sourceRefName,\n oldObjectId: abandonedPullRequest.lastMergeSourceCommit.commitId,\n newObjectId: '0000000000000000000000000000000000000000',\n isLocked: false,\n },\n ],\n );\n if (deletedBranch?.value?.[0]?.success !== true) {\n throw new Error('Failed to delete the source branch');\n }\n }\n\n logger.info(` - Pull request was abandoned successfully.`);\n return true;\n } catch (e) {\n logger.error(`Failed to abandon pull request: ${e}`);\n logger.debug(e); // Dump the error stack trace to help with debugging\n return false;\n }\n }\n\n /**\n * Add a comment thread on a pull request.\n * Requires scope \"Code (Write)\" (vso.code_write).\n */\n public async addCommentThread(comment: IPullRequestComment): Promise<number | undefined> {\n const userId = comment.userId ?? (await this.getUserId());\n const thread = await this.restApiPost(\n `${this.organisationApiUrl}/${comment.project}/_apis/git/repositories/${comment.repository}/pullrequests/${comment.pullRequestId}/threads`,\n {\n status: CommentThreadStatus.Closed,\n comments: [\n {\n author: {\n id: userId,\n },\n content: comment.content,\n commentType: CommentType.System,\n },\n ],\n },\n );\n return thread?.id;\n }\n\n private async restApiGet(\n url: string,\n params?: Record<string, unknown>,\n apiVersion: string = AzureDevOpsWebApiClient.API_VERSION,\n ) {\n params ??= {};\n const queryString = Object.keys(params)\n .map((key) => `${key}=${params[key]}`)\n .join('&');\n const fullUrl = `${url}?api-version=${apiVersion}${queryString ? `&${queryString}` : ''}`;\n\n return await sendRestApiRequestWithRetry(\n 'GET',\n fullUrl,\n undefined,\n async () => {\n return await fetch(fullUrl, {\n method: 'GET',\n headers: {\n Accept: 'application/json',\n Authorization: `Basic ${Buffer.from(`:${this.accessToken}`).toString('base64')}`,\n },\n });\n },\n this.debug,\n );\n }\n\n private async restApiPost(url: string, data?: unknown, apiVersion: string = AzureDevOpsWebApiClient.API_VERSION) {\n const fullUrl = `${url}?api-version=${apiVersion}`;\n return await sendRestApiRequestWithRetry(\n 'POST',\n fullUrl,\n data,\n async () => {\n return await fetch(fullUrl, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Basic ${Buffer.from(`:${this.accessToken}`).toString('base64')}`,\n },\n body: JSON.stringify(data),\n });\n },\n this.debug,\n );\n }\n\n private async restApiPut(url: string, data?: unknown, apiVersion: string = AzureDevOpsWebApiClient.API_VERSION) {\n const fullUrl = `${url}?api-version=${apiVersion}`;\n return await sendRestApiRequestWithRetry(\n 'PUT',\n fullUrl,\n data,\n async () => {\n return await fetch(fullUrl, {\n method: 'PUT',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Basic ${Buffer.from(`:${this.accessToken}`).toString('base64')}`,\n },\n body: JSON.stringify(data),\n });\n },\n this.debug,\n );\n }\n\n private async restApiPatch(\n url: string,\n data?: unknown,\n contentType?: string,\n apiVersion: string = AzureDevOpsWebApiClient.API_VERSION,\n ) {\n const fullUrl = `${url}?api-version=${apiVersion}`;\n return await sendRestApiRequestWithRetry(\n 'PATCH',\n fullUrl,\n data,\n async () => {\n return await fetch(fullUrl, {\n method: 'PATCH',\n headers: {\n 'Content-Type': contentType || 'application/json',\n Authorization: `Basic ${Buffer.from(`:${this.accessToken}`).toString('base64')}`,\n },\n body: JSON.stringify(data),\n });\n },\n this.debug,\n );\n }\n}\n\nfunction mergeCommitMessage(id: number, title: string, description: string): string {\n //\n // The merge commit message should contain the PR number and title for tracking.\n // This is the default behaviour in Azure DevOps.\n // Example:\n // Merged PR 24093: Bump Tingle.Extensions.Logging.LogAnalytics from 3.4.2-ci0005 to 3.4.2-ci0006\n //\n // Bumps [Tingle.Extensions.Logging.LogAnalytics](...) from 3.4.2-ci0005 to 3.4.2-ci0006\n // - [Release notes](....)\n // - [Changelog](....)\n // - [Commits](....)\n //\n // There appears to be a DevOps bug when setting \"completeOptions\" with a \"mergeCommitMessage\" even when truncated to 4000 characters.\n // The error message is:\n // Invalid argument value.\n // Parameter name: Completion options have exceeded the maximum encoded length (4184/4000)\n //\n // The effective limit seems to be about 3500 characters:\n // https://developercommunity.visualstudio.com/t/raise-the-character-limit-for-pull-request-descrip/365708#T-N424531\n //\n return `Merged PR ${id}: ${title}\\n\\n${description}`.slice(0, 3500);\n}\n\nfunction isGuid(guid: string): boolean {\n const regex = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;\n return regex.test(guid);\n}\n\nfunction getIdentityApiUrl(organisationApiUrl: string): string {\n const uri = new URL(organisationApiUrl);\n const hostname = uri.hostname.toLowerCase();\n\n // If the organisation is hosted on Azure DevOps, use the 'vssps.dev.azure.com' domain\n if (hostname === 'dev.azure.com' || hostname.endsWith('.visualstudio.com')) {\n uri.host = 'vssps.dev.azure.com';\n }\n return uri.toString();\n}\n\nexport async function sendRestApiRequestWithRetry(\n method: string,\n url: string,\n payload: unknown,\n requestAsync: () => Promise<Response>,\n isDebug: boolean = false,\n retryCount: number = 3,\n retryDelay: number = 3000,\n) {\n let body: string | undefined;\n try {\n // Send the request, ready the response\n if (isDebug) logger.debug(`🌎 🠊 [${method}] ${url}`);\n const response = await requestAsync();\n body = await response.text();\n const { status: statusCode, statusText: statusMessage } = response;\n if (isDebug) logger.debug(`🌎 🠈 [${statusCode}] ${statusMessage}`);\n\n // Check that the request was successful\n if (statusCode < 200 || statusCode > 299) {\n throw new HttpRequestError(`HTTP ${method} '${url}' failed: ${statusCode} ${statusMessage}`, statusCode);\n }\n\n // Parse the response\n return JSON.parse(body);\n } catch (e) {\n const err = e as Error;\n // Retry the request if the error is a temporary failure\n if (retryCount > 1 && isErrorTemporaryFailure(err)) {\n logger.warn(err.message);\n if (isDebug) logger.debug(`⏳ Retrying request in ${retryDelay}ms...`);\n await new Promise((resolve) => setTimeout(resolve, retryDelay));\n return sendRestApiRequestWithRetry(method, url, payload, requestAsync, isDebug, retryCount - 1, retryDelay);\n }\n\n // In debug mode, log the error, request, and response for debugging\n if (isDebug) {\n if (payload) {\n logger.debug(`REQUEST: ${JSON.stringify(payload)}`);\n }\n if (body) {\n logger.debug(`RESPONSE: ${body}`);\n }\n }\n\n logger.trace(`THROW${e}`);\n throw e;\n }\n}\n","import { existsSync } from 'node:fs';\nimport { readFile } from 'node:fs/promises';\nimport * as path from 'node:path';\n\nimport {\n type DependabotConfig,\n POSSIBLE_CONFIG_FILE_PATHS,\n parseDependabotConfig,\n type VariableFinderFn,\n} from '@/dependabot';\nimport { logger } from '@/logger';\nimport type { AzureDevOpsRepositoryUrl } from './url-parts';\n\n/**\n * Parse the dependabot config YAML file to specify update configuration.\n * The file should be located at any of `POSSIBLE_CONFIG_FILE_PATHS`.\n *\n * To view YAML file format, visit\n * https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#allow\n *\n * @returns {DependabotConfig} config - the dependabot configuration\n */\nexport async function getDependabotConfig({\n url,\n token,\n remote,\n rootDir = process.cwd(),\n variableFinder,\n}: {\n url: AzureDevOpsRepositoryUrl;\n token: string;\n /**\n * Whether to fetch the configuration file via the REST API (true) or look for it locally (false).\n */\n remote: boolean;\n rootDir?: string;\n variableFinder: VariableFinderFn;\n}): Promise<DependabotConfig> {\n let configPath: undefined | string;\n let configContents: undefined | string;\n\n /*\n * The configuration file can be available locally if the repository is cloned.\n * Otherwise, we should get it via the API which supports 2 scenarios:\n * 1. Running the pipeline without cloning, which is useful for huge repositories (multiple submodules or large commit log)\n * 2. Running a single pipeline to update multiple repositories https://github.com/mburumaxwell/dependabot-azure-devops/issues/328\n */\n\n if (remote) {\n logger.debug(`Attempting to fetch configuration file via REST API ...`);\n for (const fp of POSSIBLE_CONFIG_FILE_PATHS) {\n // make HTTP request\n const requestUrl = `${url.value}${url.project}/_apis/git/repositories/${url.repository}/items?path=/${fp}`;\n logger.debug(`GET ${requestUrl}`);\n\n try {\n const authHeader = `Basic ${Buffer.from(`x-access-token:${token}`).toString('base64')}`;\n const response = await fetch(requestUrl, {\n headers: {\n Authorization: authHeader,\n Accept: '*/*', // Gotcha!!! without this SH*T fails terribly\n },\n });\n if (response.ok) {\n logger.debug(`Found configuration file at '${requestUrl}'`);\n configContents = await response.text();\n configPath = fp;\n break;\n } else if (response.status === 404) {\n logger.trace(`No configuration file at '${requestUrl}'`);\n // biome-ignore lint/complexity/noUselessContinue: continue is useful here for clarity\n continue;\n } else if (response.status === 401) {\n throw new Error(`No or invalid access token has been provided to access '${requestUrl}'`);\n } else if (response.status === 403) {\n throw new Error(`The access token provided does not have permissions to access '${requestUrl}'`);\n }\n } catch (error) {\n if (error instanceof Error && error.message.includes('access token')) {\n throw error;\n } else {\n throw error;\n }\n }\n }\n } else {\n for (const fp of POSSIBLE_CONFIG_FILE_PATHS) {\n const filePath = path.join(rootDir, fp);\n if (existsSync(filePath)) {\n logger.debug(`Found configuration file cloned at ${filePath}`);\n configContents = await readFile(filePath, 'utf-8');\n configPath = filePath;\n break;\n } else {\n logger.trace(`No configuration file cloned at ${filePath}`);\n }\n }\n }\n\n // Ensure we have file contents. Otherwise throw a well readable error.\n if (!configContents || !configPath || typeof configContents !== 'string') {\n throw new Error(`Configuration file not found at possible locations: ${POSSIBLE_CONFIG_FILE_PATHS.join(', ')}`);\n } else {\n logger.trace('Configuration file contents read.');\n }\n\n return await parseDependabotConfig({ configContents, configPath, variableFinder });\n}\n","export type AzureDevOpsOrganizationUrl = {\n /** URL of the organisation. This may lack the project name */\n value: URL;\n\n /** Organisation URL hostname */\n hostname: string;\n\n /** Organisation API endpoint URL */\n 'api-endpoint': string;\n\n /** Organisation name/slug */\n organisation: string;\n\n /** Virtual directory if present (on-premises only) */\n 'virtual-directory'?: string;\n};\n\nexport type AzureDevOpsProjectUrl = AzureDevOpsOrganizationUrl & {\n /** Project ID or Name */\n project: string;\n};\n\nexport type AzureDevOpsRepositoryUrl = AzureDevOpsProjectUrl & {\n /** Repository ID or Name */\n repository: string;\n\n /** Slug of the repository e.g. `contoso/prj1/_git/repo1`, `tfs/contoso/prj1/_git/repo1` */\n 'repository-slug': string;\n};\n\nexport function extractOrganizationUrl({ organisationUrl }: { organisationUrl: string }): AzureDevOpsOrganizationUrl {\n // convert url string into a valid JS URL object\n const value = new URL(organisationUrl);\n const protocol = value.protocol.slice(0, -1);\n let { hostname } = value;\n const visualStudioUrlRegex = /^(?<prefix>\\S+)\\.visualstudio\\.com$/iu;\n if (visualStudioUrlRegex.test(hostname)) hostname = 'dev.azure.com';\n\n const organisation: string = extractOrganisation(organisationUrl);\n\n const virtualDirectory = extractVirtualDirectory(value);\n const apiEndpoint = `${protocol}://${hostname}${value.port ? `:${value.port}` : ''}/${virtualDirectory ? `${virtualDirectory}/` : ''}`;\n\n return {\n value,\n hostname,\n 'api-endpoint': apiEndpoint,\n organisation,\n 'virtual-directory': virtualDirectory,\n };\n}\n\nexport function extractProjectUrl({\n organisationUrl,\n project,\n}: {\n organisationUrl: string;\n project: string;\n}): AzureDevOpsProjectUrl {\n const extracted = extractOrganizationUrl({ organisationUrl });\n const escapedProject = encodeURI(project); // encode special characters like spaces\n\n return {\n ...extracted,\n project: escapedProject,\n };\n}\n\nexport function extractRepositoryUrl({\n organisationUrl,\n project,\n repository,\n}: {\n organisationUrl: string;\n project: string;\n repository: string;\n}): AzureDevOpsRepositoryUrl {\n const extracted = extractProjectUrl({ organisationUrl, project });\n const { organisation, 'virtual-directory': virtualDirectory, project: escapedProject } = extracted;\n\n const escapedRepository = encodeURI(repository); // encode special characters like spaces\n const repoSlug = `${virtualDirectory ? `${virtualDirectory}/` : ''}${organisation}/${escapedProject}/_git/${escapedRepository}`;\n\n return {\n ...extracted,\n repository: escapedRepository,\n 'repository-slug': repoSlug,\n };\n}\n\n/**\n * Extract organisation name from organisation URL\n *\n * @param organisationUrl\n *\n * @returns organisation name\n */\nfunction extractOrganisation(organisationUrl: string): string {\n const url = new URL(organisationUrl);\n const { hostname, pathname } = url;\n\n // Check for old style: https://x.visualstudio.com/\n if (hostname.endsWith('.visualstudio.com')) {\n return hostname.split('.')[0]!;\n }\n\n // For new style and on-premise, parse the pathname\n // pathname examples: '/contoso/', '/contoso', '/tfs/contoso/', '/tfs/contoso', '/contoso/Core'\n const pathSegments = pathname.split('/').filter((segment) => segment !== '');\n\n // Check for on-premise style: https://server.domain.com/tfs/contoso/\n if (pathSegments.length >= 2 && hostname !== 'dev.azure.com') {\n return pathSegments[1]!; // Return 'contoso' from '/tfs/contoso/'\n }\n\n // Check for new style: https://dev.azure.com/contoso/ or https://dev.azure.com/contoso or https://dev.azure.com/contoso/Core\n if (pathSegments.length >= 1) {\n return pathSegments[0]!; // Always return the first path segment for dev.azure.com\n }\n\n throw new Error(`Error parsing organisation from organisation url: '${organisationUrl}'.`);\n}\n\n/**\n * Extract virtual directory from organisation URL\n *\n * Virtual Directories are sometimes used in on-premises\n * @param organisationUrl\n *\n * @returns virtual directory\n *\n * @example URLs typically are like this:`https://server.domain.com/tfs/x/` and `tfs` is the virtual directory\n */\nfunction extractVirtualDirectory(organisationUrl: URL) {\n // extract the pathname from the url then split\n // pathname takes the shape '/tfs/x/'\n const path = organisationUrl.pathname.split('/');\n\n // Virtual Directories are sometimes used in on-premises\n // URLs typically are like this: https://server.domain.com/tfs/x/\n // The pathname extracted looks like this: '/tfs/x/'\n return path.length === 4 ? path[1]! : undefined;\n}\n"],"mappings":";;;;;;;;;AAAA,IAAY,gFAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGF,IAAY,sFAAL;AACL;AACA;AACA;AACA;;;AAGF,IAAY,sEAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEF,IAAY,sDAAL;AACL;AACA;AACA;AACA;;;AAEF,IAAY,8DAAL;AACL;AACA;;;AAEF,IAAY,4EAAL;AACL;AACA;AACA;AACA;AACA;AACA;;;AAEF,IAAY,kEAAL;AACL;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MAAM,IAAI,CAAC;CAK7B,MAAM,eAAe,SAAS,MAAM,IAAI,CAAC,QAAQ,YAAY,YAAY,GAAG;AAG5E,KAAI,aAAa,UAAU,KAAK,aAAa,gBAC3C,QAAO,aAAa;AAItB,KAAI,aAAa,UAAU,EACzB,QAAO,aAAa;AAGtB,OAAM,IAAI,MAAM,sDAAsD,gBAAgB,IAAI;;;;;;;;;;;;AAa5F,SAAS,wBAAwB,iBAAsB;CAGrD,MAAMC,SAAO,gBAAgB,SAAS,MAAM,IAAI;AAKhD,QAAOA,OAAK,WAAW,IAAIA,OAAK,KAAM"}
@@ -1,3 +1,3 @@
1
- import { $ as mapSourceFromDependabotConfigToJobConfig, $t as DependabotCommitMessage, A as DependabotRecordUpdateJobWarningSchema, An as DEPENDABOT_DEFAULT_AUTHOR_EMAIL, At as DependabotJobConfig, B as DependabotTokenType, Bt as DependabotRequirementSource, C as DependabotRecordEcosystemVersions, Cn as parseDependabotConfig, Ct as DependabotExistingPRSchema, D as DependabotRecordUpdateJobUnknownError, Dn as VariableFinderFn, Dt as DependabotGroupJobSchema, E as DependabotRecordUpdateJobErrorSchema, En as validateConfiguration, Et as DependabotGroupJob, F as CreateApiServerAppOptions, Ft as DependabotPackageManagerSchema, G as makeRandomJobId, Gt as DependabotSourceProvider, H as DependabotJobBuilder, Ht as DependabotSecurityAdvisory, I as DependabotRequest, It as DependabotProxyConfig, J as mapExperiments, Jt as FetchedFiles, K as mapAllowedUpdatesFromDependabotConfigToJobConfig, Kt as DependabotSourceProviderSchema, L as DependabotRequestSchema, Lt as DependabotProxyConfigSchema, M as DependabotUpdateDependencyListSchema, Mn as GitAuthor, Mt as DependabotJobFile, N as DependabotUpdatePullRequest, Nt as DependabotJobFileSchema, O as DependabotRecordUpdateJobUnknownErrorSchema, On as convertPlaceholder, Ot as DependabotGroupRuleJob, P as DependabotUpdatePullRequestSchema, Pt as DependabotPackageManager, Q as mapSecurityAdvisories, Qt as DependabotAllowConditionSchema, R as DependabotRequestType, Rt as DependabotRequirement, S as DependabotRecordEcosystemMetaSchema, Sn as VersioningStrategySchema, St as DependabotExistingPR, T as DependabotRecordUpdateJobError, Tn as parseUpdates, Tt as DependabotExperimentsSchema, U as DependabotJobBuilderOutput, Ut as DependabotSecurityAdvisorySchema, V as createApiServerApp, Vt as DependabotRequirementSourceSchema, W as DependabotSourceInfo, Wt as DependabotSource, X as mapIgnoreConditionsFromDependabotConfigToJobConfig, Xt as FileUpdaterInput, Y as mapGroupsFromDependabotConfigToJobConfig, Yt as FileFetcherInput, Z as mapPackageEcosystemToPackageManager, Zt as DependabotAllowCondition, _ as DependabotMarkAsProcessed, _n as DependabotUpdateSchema, _t as DependabotCredentialSchema, a as DependabotCreatePullRequest, an as DependabotGroup, at as sanitizeRef, b as DependabotMetricSchema, bn as PackageEcosystemSchema, bt as DependabotExistingGroupPR, c as DependabotDependencyFileSchema, cn as DependabotIgnoreConditionSchema, ct as DependabotAllowed, d as DependabotEcosystemMeta, dn as DependabotPullRequestBranchName, dt as DependabotCommandSchema, en as DependabotCommitMessageSchema, et as mapVersionStrategyToRequirementsUpdateStrategy, f as DependabotEcosystemMetaSchema, fn as DependabotRegistry, ft as DependabotCommitOptions, g as DependabotIncrementMetricSchema, gn as DependabotUpdate, gt as DependabotCredential, h as DependabotIncrementMetric, hn as DependabotScheduleSchema, ht as DependabotConditionSchema, i as DependabotClosePullRequestSchema, in as DependabotCooldownSchema, it as getBranchNameForUpdate, j as DependabotUpdateDependencyList, jn as DEPENDABOT_DEFAULT_AUTHOR_NAME, jt as DependabotJobConfigSchema, k as DependabotRecordUpdateJobWarning, kn as extractPlaceholder, kt as DependabotGroupRuleJobSchema, l as DependabotDependencySubmission, ln as DependabotMultiEcosystemGroup, lt as DependabotAllowedSchema, m as DependabotEcosystemVersionManagerSchema, mn as DependabotSchedule, mt as DependabotCondition, n as DependabotClosePullRequestReason, nn as DependabotConfigSchema, nt as parseExperiments, o as DependabotCreatePullRequestSchema, on as DependabotGroupSchema, ot as CertificateAuthority, p as DependabotEcosystemVersionManager, pn as DependabotRegistrySchema, pt as DependabotCommitOptionsSchema, q as mapCredentials, qt as DependabotSourceSchema, r as DependabotClosePullRequestReasonEnum, rn as DependabotCooldown, rt as makeDirectoryKey, s as DependabotDependencyFile, sn as DependabotIgnoreCondition, st as CertificateAuthoritySchema, t as DependabotClosePullRequest, tn as DependabotConfig, tt as DEFAULT_EXPERIMENTS, u as DependabotDependencySubmissionSchema, un as DependabotMultiEcosystemGroupSchema, ut as DependabotCommand, v as DependabotMarkAsProcessedSchema, vn as POSSIBLE_CONFIG_FILE_PATHS, vt as DependabotDependency, w as DependabotRecordEcosystemVersionsSchema, wn as parseRegistries, wt as DependabotExperiments, x as DependabotRecordEcosystemMeta, xn as VersioningStrategy, xt as DependabotExistingGroupPRSchema, y as DependabotMetric, yn as PackageEcosystem, yt as DependabotDependencySchema, z as DependabotRequestTypeSchema, zt as DependabotRequirementSchema } from "../index-B1zTACpP.mjs";
1
+ import { $ as mapSourceFromDependabotConfigToJobConfig, $t as DependabotCommitMessage, A as DependabotRecordUpdateJobWarningSchema, An as DEPENDABOT_DEFAULT_AUTHOR_EMAIL, At as DependabotJobConfig, B as DependabotTokenType, Bt as DependabotRequirementSource, C as DependabotRecordEcosystemVersions, Cn as parseDependabotConfig, Ct as DependabotExistingPRSchema, D as DependabotRecordUpdateJobUnknownError, Dn as VariableFinderFn, Dt as DependabotGroupJobSchema, E as DependabotRecordUpdateJobErrorSchema, En as validateConfiguration, Et as DependabotGroupJob, F as CreateApiServerAppOptions, Ft as DependabotPackageManagerSchema, G as makeRandomJobId, Gt as DependabotSourceProvider, H as DependabotJobBuilder, Ht as DependabotSecurityAdvisory, I as DependabotRequest, It as DependabotProxyConfig, J as mapExperiments, Jt as FetchedFiles, K as mapAllowedUpdatesFromDependabotConfigToJobConfig, Kt as DependabotSourceProviderSchema, L as DependabotRequestSchema, Lt as DependabotProxyConfigSchema, M as DependabotUpdateDependencyListSchema, Mn as GitAuthor, Mt as DependabotJobFile, N as DependabotUpdatePullRequest, Nt as DependabotJobFileSchema, O as DependabotRecordUpdateJobUnknownErrorSchema, On as convertPlaceholder, Ot as DependabotGroupRuleJob, P as DependabotUpdatePullRequestSchema, Pt as DependabotPackageManager, Q as mapSecurityAdvisories, Qt as DependabotAllowConditionSchema, R as DependabotRequestType, Rt as DependabotRequirement, S as DependabotRecordEcosystemMetaSchema, Sn as VersioningStrategySchema, St as DependabotExistingPR, T as DependabotRecordUpdateJobError, Tn as parseUpdates, Tt as DependabotExperimentsSchema, U as DependabotJobBuilderOutput, Ut as DependabotSecurityAdvisorySchema, V as createApiServerApp, Vt as DependabotRequirementSourceSchema, W as DependabotSourceInfo, Wt as DependabotSource, X as mapIgnoreConditionsFromDependabotConfigToJobConfig, Xt as FileUpdaterInput, Y as mapGroupsFromDependabotConfigToJobConfig, Yt as FileFetcherInput, Z as mapPackageEcosystemToPackageManager, Zt as DependabotAllowCondition, _ as DependabotMarkAsProcessed, _n as DependabotUpdateSchema, _t as DependabotCredentialSchema, a as DependabotCreatePullRequest, an as DependabotGroup, at as sanitizeRef, b as DependabotMetricSchema, bn as PackageEcosystemSchema, bt as DependabotExistingGroupPR, c as DependabotDependencyFileSchema, cn as DependabotIgnoreConditionSchema, ct as DependabotAllowed, d as DependabotEcosystemMeta, dn as DependabotPullRequestBranchName, dt as DependabotCommandSchema, en as DependabotCommitMessageSchema, et as mapVersionStrategyToRequirementsUpdateStrategy, f as DependabotEcosystemMetaSchema, fn as DependabotRegistry, ft as DependabotCommitOptions, g as DependabotIncrementMetricSchema, gn as DependabotUpdate, gt as DependabotCredential, h as DependabotIncrementMetric, hn as DependabotScheduleSchema, ht as DependabotConditionSchema, i as DependabotClosePullRequestSchema, in as DependabotCooldownSchema, it as getBranchNameForUpdate, j as DependabotUpdateDependencyList, jn as DEPENDABOT_DEFAULT_AUTHOR_NAME, jt as DependabotJobConfigSchema, k as DependabotRecordUpdateJobWarning, kn as extractPlaceholder, kt as DependabotGroupRuleJobSchema, l as DependabotDependencySubmission, ln as DependabotMultiEcosystemGroup, lt as DependabotAllowedSchema, m as DependabotEcosystemVersionManagerSchema, mn as DependabotSchedule, mt as DependabotCondition, n as DependabotClosePullRequestReason, nn as DependabotConfigSchema, nt as parseExperiments, o as DependabotCreatePullRequestSchema, on as DependabotGroupSchema, ot as CertificateAuthority, p as DependabotEcosystemVersionManager, pn as DependabotRegistrySchema, pt as DependabotCommitOptionsSchema, q as mapCredentials, qt as DependabotSourceSchema, r as DependabotClosePullRequestReasonEnum, rn as DependabotCooldown, rt as makeDirectoryKey, s as DependabotDependencyFile, sn as DependabotIgnoreCondition, st as CertificateAuthoritySchema, t as DependabotClosePullRequest, tn as DependabotConfig, tt as DEFAULT_EXPERIMENTS, u as DependabotDependencySubmissionSchema, un as DependabotMultiEcosystemGroupSchema, ut as DependabotCommand, v as DependabotMarkAsProcessedSchema, vn as POSSIBLE_CONFIG_FILE_PATHS, vt as DependabotDependency, w as DependabotRecordEcosystemVersionsSchema, wn as parseRegistries, wt as DependabotExperiments, x as DependabotRecordEcosystemMeta, xn as VersioningStrategy, xt as DependabotExistingGroupPRSchema, y as DependabotMetric, yn as PackageEcosystem, yt as DependabotDependencySchema, z as DependabotRequestTypeSchema, zt as DependabotRequirementSchema } from "../index--PMbsXAm.mjs";
2
2
  import "../index-BWftXTYB.mjs";
3
3
  export { CertificateAuthority, CertificateAuthoritySchema, CreateApiServerAppOptions, DEFAULT_EXPERIMENTS, DEPENDABOT_DEFAULT_AUTHOR_EMAIL, DEPENDABOT_DEFAULT_AUTHOR_NAME, DependabotAllowCondition, DependabotAllowConditionSchema, DependabotAllowed, DependabotAllowedSchema, DependabotClosePullRequest, DependabotClosePullRequestReason, DependabotClosePullRequestReasonEnum, DependabotClosePullRequestSchema, DependabotCommand, DependabotCommandSchema, DependabotCommitMessage, DependabotCommitMessageSchema, DependabotCommitOptions, DependabotCommitOptionsSchema, DependabotCondition, DependabotConditionSchema, DependabotConfig, DependabotConfigSchema, DependabotCooldown, DependabotCooldownSchema, DependabotCreatePullRequest, DependabotCreatePullRequestSchema, DependabotCredential, DependabotCredentialSchema, DependabotDependency, DependabotDependencyFile, DependabotDependencyFileSchema, DependabotDependencySchema, DependabotDependencySubmission, DependabotDependencySubmissionSchema, DependabotEcosystemMeta, DependabotEcosystemMetaSchema, DependabotEcosystemVersionManager, DependabotEcosystemVersionManagerSchema, DependabotExistingGroupPR, DependabotExistingGroupPRSchema, DependabotExistingPR, DependabotExistingPRSchema, DependabotExperiments, DependabotExperimentsSchema, DependabotGroup, DependabotGroupJob, DependabotGroupJobSchema, DependabotGroupRuleJob, DependabotGroupRuleJobSchema, DependabotGroupSchema, DependabotIgnoreCondition, DependabotIgnoreConditionSchema, DependabotIncrementMetric, DependabotIncrementMetricSchema, DependabotJobBuilder, DependabotJobBuilderOutput, DependabotJobConfig, DependabotJobConfigSchema, DependabotJobFile, DependabotJobFileSchema, DependabotMarkAsProcessed, DependabotMarkAsProcessedSchema, DependabotMetric, DependabotMetricSchema, DependabotMultiEcosystemGroup, DependabotMultiEcosystemGroupSchema, DependabotPackageManager, DependabotPackageManagerSchema, DependabotProxyConfig, DependabotProxyConfigSchema, DependabotPullRequestBranchName, DependabotRecordEcosystemMeta, DependabotRecordEcosystemMetaSchema, DependabotRecordEcosystemVersions, DependabotRecordEcosystemVersionsSchema, DependabotRecordUpdateJobError, DependabotRecordUpdateJobErrorSchema, DependabotRecordUpdateJobUnknownError, DependabotRecordUpdateJobUnknownErrorSchema, DependabotRecordUpdateJobWarning, DependabotRecordUpdateJobWarningSchema, DependabotRegistry, DependabotRegistrySchema, DependabotRequest, DependabotRequestSchema, DependabotRequestType, DependabotRequestTypeSchema, DependabotRequirement, DependabotRequirementSchema, DependabotRequirementSource, DependabotRequirementSourceSchema, DependabotSchedule, DependabotScheduleSchema, DependabotSecurityAdvisory, DependabotSecurityAdvisorySchema, DependabotSource, DependabotSourceInfo, DependabotSourceProvider, DependabotSourceProviderSchema, DependabotSourceSchema, DependabotTokenType, DependabotUpdate, DependabotUpdateDependencyList, DependabotUpdateDependencyListSchema, DependabotUpdatePullRequest, DependabotUpdatePullRequestSchema, DependabotUpdateSchema, FetchedFiles, FileFetcherInput, FileUpdaterInput, GitAuthor, POSSIBLE_CONFIG_FILE_PATHS, PackageEcosystem, PackageEcosystemSchema, VariableFinderFn, VersioningStrategy, VersioningStrategySchema, convertPlaceholder, createApiServerApp, extractPlaceholder, getBranchNameForUpdate, makeDirectoryKey, makeRandomJobId, mapAllowedUpdatesFromDependabotConfigToJobConfig, mapCredentials, mapExperiments, mapGroupsFromDependabotConfigToJobConfig, mapIgnoreConditionsFromDependabotConfigToJobConfig, mapPackageEcosystemToPackageManager, mapSecurityAdvisories, mapSourceFromDependabotConfigToJobConfig, mapVersionStrategyToRequirementsUpdateStrategy, parseDependabotConfig, parseExperiments, parseRegistries, parseUpdates, sanitizeRef, validateConfiguration };
@@ -1,5 +1,5 @@
1
1
  import "../logger-IPTn7PT9.mjs";
2
2
  import { A as DependabotScheduleSchema, B as extractPlaceholder, C as DependabotCommitMessageSchema, D as DependabotIgnoreConditionSchema, E as DependabotGroupSchema, F as parseDependabotConfig, I as parseRegistries, L as parseUpdates, M as POSSIBLE_CONFIG_FILE_PATHS, N as PackageEcosystemSchema, O as DependabotMultiEcosystemGroupSchema, P as VersioningStrategySchema, R as validateConfiguration, S as DependabotAllowConditionSchema, T as DependabotCooldownSchema, V as makeDirectoryKey, _ as DependabotRequirementSchema, a as DependabotConditionSchema, b as DependabotSourceProviderSchema, c as DependabotExistingGroupPRSchema, d as DependabotGroupJobSchema, f as DependabotGroupRuleJobSchema, g as DependabotProxyConfigSchema, h as DependabotPackageManagerSchema, i as DependabotCommitOptionsSchema, j as DependabotUpdateSchema, k as DependabotRegistrySchema, l as DependabotExistingPRSchema, m as DependabotJobFileSchema, n as DependabotAllowedSchema, o as DependabotCredentialSchema, p as DependabotJobConfigSchema, r as DependabotCommandSchema, s as DependabotDependencySchema, t as CertificateAuthoritySchema, u as DependabotExperimentsSchema, v as DependabotRequirementSourceSchema, w as DependabotConfigSchema, x as DependabotSourceSchema, y as DependabotSecurityAdvisorySchema, z as convertPlaceholder } from "../job-BuCBKP9L.mjs";
3
- import { A as mapSourceFromDependabotConfigToJobConfig, C as mapAllowedUpdatesFromDependabotConfigToJobConfig, D as mapIgnoreConditionsFromDependabotConfigToJobConfig, E as mapGroupsFromDependabotConfigToJobConfig, F as sanitizeRef, I as DEPENDABOT_DEFAULT_AUTHOR_EMAIL, L as DEPENDABOT_DEFAULT_AUTHOR_NAME, M as DEFAULT_EXPERIMENTS, N as parseExperiments, O as mapPackageEcosystemToPackageManager, P as getBranchNameForUpdate, S as makeRandomJobId, T as mapExperiments, _ as DependabotRecordUpdateJobUnknownErrorSchema, a as DependabotClosePullRequestSchema, b as DependabotUpdatePullRequestSchema, c as DependabotDependencySubmissionSchema, d as DependabotIncrementMetricSchema, f as DependabotMarkAsProcessedSchema, g as DependabotRecordUpdateJobErrorSchema, h as DependabotRecordEcosystemVersionsSchema, i as DependabotClosePullRequestReasonEnum, j as mapVersionStrategyToRequirementsUpdateStrategy, k as mapSecurityAdvisories, l as DependabotEcosystemMetaSchema, m as DependabotRecordEcosystemMetaSchema, n as DependabotRequestTypeSchema, o as DependabotCreatePullRequestSchema, p as DependabotMetricSchema, r as createApiServerApp, s as DependabotDependencyFileSchema, t as DependabotRequestSchema, u as DependabotEcosystemVersionManagerSchema, v as DependabotRecordUpdateJobWarningSchema, w as mapCredentials, x as DependabotJobBuilder, y as DependabotUpdateDependencyListSchema } from "../dependabot-BM3oAx2C.mjs";
3
+ import { A as mapSourceFromDependabotConfigToJobConfig, C as mapAllowedUpdatesFromDependabotConfigToJobConfig, D as mapIgnoreConditionsFromDependabotConfigToJobConfig, E as mapGroupsFromDependabotConfigToJobConfig, F as sanitizeRef, I as DEPENDABOT_DEFAULT_AUTHOR_EMAIL, L as DEPENDABOT_DEFAULT_AUTHOR_NAME, M as DEFAULT_EXPERIMENTS, N as parseExperiments, O as mapPackageEcosystemToPackageManager, P as getBranchNameForUpdate, S as makeRandomJobId, T as mapExperiments, _ as DependabotRecordUpdateJobUnknownErrorSchema, a as DependabotClosePullRequestSchema, b as DependabotUpdatePullRequestSchema, c as DependabotDependencySubmissionSchema, d as DependabotIncrementMetricSchema, f as DependabotMarkAsProcessedSchema, g as DependabotRecordUpdateJobErrorSchema, h as DependabotRecordEcosystemVersionsSchema, i as DependabotClosePullRequestReasonEnum, j as mapVersionStrategyToRequirementsUpdateStrategy, k as mapSecurityAdvisories, l as DependabotEcosystemMetaSchema, m as DependabotRecordEcosystemMetaSchema, n as DependabotRequestTypeSchema, o as DependabotCreatePullRequestSchema, p as DependabotMetricSchema, r as createApiServerApp, s as DependabotDependencyFileSchema, t as DependabotRequestSchema, u as DependabotEcosystemVersionManagerSchema, v as DependabotRecordUpdateJobWarningSchema, w as mapCredentials, x as DependabotJobBuilder, y as DependabotUpdateDependencyListSchema } from "../dependabot-BdrOiAWj.mjs";
4
4
 
5
5
  export { CertificateAuthoritySchema, DEFAULT_EXPERIMENTS, DEPENDABOT_DEFAULT_AUTHOR_EMAIL, DEPENDABOT_DEFAULT_AUTHOR_NAME, DependabotAllowConditionSchema, DependabotAllowedSchema, DependabotClosePullRequestReasonEnum, DependabotClosePullRequestSchema, DependabotCommandSchema, DependabotCommitMessageSchema, DependabotCommitOptionsSchema, DependabotConditionSchema, DependabotConfigSchema, DependabotCooldownSchema, DependabotCreatePullRequestSchema, DependabotCredentialSchema, DependabotDependencyFileSchema, DependabotDependencySchema, DependabotDependencySubmissionSchema, DependabotEcosystemMetaSchema, DependabotEcosystemVersionManagerSchema, DependabotExistingGroupPRSchema, DependabotExistingPRSchema, DependabotExperimentsSchema, DependabotGroupJobSchema, DependabotGroupRuleJobSchema, DependabotGroupSchema, DependabotIgnoreConditionSchema, DependabotIncrementMetricSchema, DependabotJobBuilder, DependabotJobConfigSchema, DependabotJobFileSchema, DependabotMarkAsProcessedSchema, DependabotMetricSchema, DependabotMultiEcosystemGroupSchema, DependabotPackageManagerSchema, DependabotProxyConfigSchema, DependabotRecordEcosystemMetaSchema, DependabotRecordEcosystemVersionsSchema, DependabotRecordUpdateJobErrorSchema, DependabotRecordUpdateJobUnknownErrorSchema, DependabotRecordUpdateJobWarningSchema, DependabotRegistrySchema, DependabotRequestSchema, DependabotRequestTypeSchema, DependabotRequirementSchema, DependabotRequirementSourceSchema, DependabotScheduleSchema, DependabotSecurityAdvisorySchema, DependabotSourceProviderSchema, DependabotSourceSchema, DependabotUpdateDependencyListSchema, DependabotUpdatePullRequestSchema, DependabotUpdateSchema, POSSIBLE_CONFIG_FILE_PATHS, PackageEcosystemSchema, VersioningStrategySchema, convertPlaceholder, createApiServerApp, extractPlaceholder, getBranchNameForUpdate, makeDirectoryKey, makeRandomJobId, mapAllowedUpdatesFromDependabotConfigToJobConfig, mapCredentials, mapExperiments, mapGroupsFromDependabotConfigToJobConfig, mapIgnoreConditionsFromDependabotConfigToJobConfig, mapPackageEcosystemToPackageManager, mapSecurityAdvisories, mapSourceFromDependabotConfigToJobConfig, mapVersionStrategyToRequirementsUpdateStrategy, parseDependabotConfig, parseExperiments, parseRegistries, parseUpdates, sanitizeRef, validateConfiguration };
@@ -333,7 +333,11 @@ function makeRandomJobId() {
333
333
  //#region src/dependabot/update.ts
334
334
  const DependabotDependencyFileSchema = z.object({
335
335
  content: z.string().nullish(),
336
- content_encoding: z.enum(["utf-8", "base64"]).nullish(),
336
+ content_encoding: z.enum([
337
+ "utf-8",
338
+ "base64",
339
+ ""
340
+ ]).nullish(),
337
341
  deleted: z.boolean().nullish(),
338
342
  directory: z.string(),
339
343
  name: z.string(),
@@ -436,6 +440,7 @@ const DependabotEcosystemVersionManagerSchema = z.object({
436
440
  const DependabotEcosystemMetaSchema = z.object({
437
441
  name: z.string(),
438
442
  package_manager: DependabotEcosystemVersionManagerSchema.nullish(),
443
+ language: DependabotEcosystemVersionManagerSchema.nullish(),
439
444
  version: DependabotEcosystemVersionManagerSchema.nullish()
440
445
  });
441
446
  const DependabotRecordEcosystemMetaSchema = z.object({ ecosystem: DependabotEcosystemMetaSchema });
@@ -604,4 +609,4 @@ function createApiServerApp({ basePath = `/api/update_jobs`, authenticate, getJo
604
609
 
605
610
  //#endregion
606
611
  export { mapSourceFromDependabotConfigToJobConfig as A, mapAllowedUpdatesFromDependabotConfigToJobConfig as C, mapIgnoreConditionsFromDependabotConfigToJobConfig as D, mapGroupsFromDependabotConfigToJobConfig as E, sanitizeRef as F, DEPENDABOT_DEFAULT_AUTHOR_EMAIL as I, DEPENDABOT_DEFAULT_AUTHOR_NAME as L, DEFAULT_EXPERIMENTS as M, parseExperiments as N, mapPackageEcosystemToPackageManager as O, getBranchNameForUpdate as P, makeRandomJobId as S, mapExperiments as T, DependabotRecordUpdateJobUnknownErrorSchema as _, DependabotClosePullRequestSchema as a, DependabotUpdatePullRequestSchema as b, DependabotDependencySubmissionSchema as c, DependabotIncrementMetricSchema as d, DependabotMarkAsProcessedSchema as f, DependabotRecordUpdateJobErrorSchema as g, DependabotRecordEcosystemVersionsSchema as h, DependabotClosePullRequestReasonEnum as i, mapVersionStrategyToRequirementsUpdateStrategy as j, mapSecurityAdvisories as k, DependabotEcosystemMetaSchema as l, DependabotRecordEcosystemMetaSchema as m, DependabotRequestTypeSchema as n, DependabotCreatePullRequestSchema as o, DependabotMetricSchema as p, createApiServerApp as r, DependabotDependencyFileSchema as s, DependabotRequestSchema as t, DependabotEcosystemVersionManagerSchema as u, DependabotRecordUpdateJobWarningSchema as v, mapCredentials as w, DependabotJobBuilder as x, DependabotUpdateDependencyListSchema as y };
607
- //# sourceMappingURL=dependabot-BM3oAx2C.mjs.map
612
+ //# sourceMappingURL=dependabot-BdrOiAWj.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dependabot-BdrOiAWj.mjs","names":["branchName: string","crypto","DEFAULT_EXPERIMENTS: DependabotExperiments","updatingPullRequest: boolean","updateDependencyGroupName: string | null","updateDependencyNames: string[] | null","vulnerabilities: SecurityVulnerability[] | undefined","success: boolean"],"sources":["../src/dependabot/author.ts","../src/dependabot/branch-name.ts","../src/dependabot/experiments.ts","../src/dependabot/job-builder.ts","../src/dependabot/update.ts","../src/dependabot/server.ts"],"sourcesContent":["export type GitAuthor = {\n name: string;\n email: string;\n};\n\nexport const DEPENDABOT_DEFAULT_AUTHOR_EMAIL = 'noreply@github.com';\nexport const DEPENDABOT_DEFAULT_AUTHOR_NAME = 'dependabot[bot]';\n","import * as crypto from 'node:crypto';\nimport type { PackageEcosystem } from './config';\nimport type { DependabotExistingPR } from './job';\n\n// TODO: figure out how to handle IDENTIFIER field (in a group) in branch naming\n// Docs: https://docs.github.com/en/code-security/dependabot/working-with-dependabot/dependabot-options-reference#groups--\n// -> An identifier for a group is used in branch names and pull request titles.\n\nexport function getBranchNameForUpdate(\n packageEcosystem: PackageEcosystem,\n targetBranchName: string | undefined,\n directory: string | undefined,\n dependencyGroupName: string | undefined,\n dependencies: DependabotExistingPR[],\n separator: string = '/',\n): string {\n // Based on dependabot-core implementation:\n // https://github.com/dependabot/dependabot-core/blob/main/common/lib/dependabot/pull_request_creator/branch_namer/solo_strategy.rb\n // https://github.com/dependabot/dependabot-core/blob/main/common/lib/dependabot/pull_request_creator/branch_namer/dependency_group_strategy.rb\n let branchName: string;\n const branchNameMightBeTooLong = dependencyGroupName || dependencies.length > 1;\n if (branchNameMightBeTooLong) {\n // Group/multi dependency update\n // e.g. dependabot/nuget/main/microsoft-3b49c54d9e\n const dependencyDigest = crypto\n .createHash('md5')\n .update(dependencies.map((d) => `${d['dependency-name']}-${d['dependency-version']}`).join(','))\n .digest('hex')\n .substring(0, 10);\n branchName = `${dependencyGroupName || 'multi'}-${dependencyDigest}`;\n } else {\n // Single dependency update\n // e.g. dependabot/nuget/main/Microsoft.Extensions.Logging-1.0.0\n const dependencyNames = dependencies\n .map((d) => d['dependency-name'])\n .join('-and-')\n .replace(/[:[]]/g, '-') // Replace `:` and `[]` with `-`\n .replace(/@/g, ''); // Remove `@`\n const versionSuffix = dependencies[0]?.removed ? 'removed' : dependencies[0]?.['dependency-version'];\n branchName = `${dependencyNames}-${versionSuffix}`;\n }\n\n return sanitizeRef(\n [\n 'dependabot',\n packageEcosystem,\n targetBranchName,\n // normalize directory to remove leading/trailing slashes and replace remaining ones with the separator\n directory\n ? directory\n .split('/')\n .filter((part) => part.length > 0)\n .join(separator)\n : undefined,\n branchName,\n ],\n separator,\n );\n}\n\nexport function sanitizeRef(refParts: (string | undefined)[], separator: string): string {\n // Based on dependabot-core implementation:\n // https://github.com/dependabot/dependabot-core/blob/fc31ae64f492dc977cfe6773ab13fb6373aabec4/common/lib/dependabot/pull_request_creator/branch_namer/base.rb#L99\n\n // This isn't a complete implementation of git's ref validation, but it\n // covers most cases that crop up. Its list of allowed characters is a\n // bit stricter than git's, but that's for cosmetic reasons.\n return (\n refParts\n // Join the parts with the separator, ignore empty parts\n .filter((p) => p && p.trim().length > 0)\n .join(separator)\n // Remove forbidden characters (those not already replaced elsewhere)\n .replace(/[^A-Za-z0-9/\\-_.(){}]/g, '')\n // Slashes can't be followed by periods\n .replace(/\\/\\./g, '/dot-')\n // Squeeze out consecutive periods and slashes\n .replace(/\\.+/g, '.')\n .replace(/\\/+/g, '/')\n // Trailing periods are forbidden\n .replace(/\\.$/, '')\n );\n}\n","import type { DependabotExperiments } from './job';\n\n// The default experiments known to be used by the GitHub Dependabot service.\n// This changes often, update as needed by extracting them from a Dependabot GitHub Action run.\n// e.g. https://github.com/mburumaxwell/dependabot-azure-devops/actions/workflows/dependabot/dependabot-updates\nexport const DEFAULT_EXPERIMENTS: DependabotExperiments = {\n 'record-ecosystem-versions': true,\n 'record-update-job-unknown-error': true,\n 'proxy-cached': true,\n 'dependency-change-validation': true,\n 'enable-file-parser-python-local': true,\n 'npm-fallback-version-above-v6': true,\n 'enable-record-ecosystem-meta': true,\n 'enable-corepack-for-npm-and-yarn': true,\n 'enable-shared-helpers-command-timeout': true,\n 'enable-dependabot-setting-up-cronjob': true,\n 'enable-engine-version-detection': true,\n 'avoid-duplicate-updates-package-json': true,\n 'allow-refresh-for-existing-pr-dependencies': true,\n 'allow-refresh-group-with-all-dependencies': true,\n 'exclude-local-composer-packages': true,\n 'enable-enhanced-error-details-for-updater': true,\n 'gradle-lockfile-updater': true,\n 'enable-exclude-paths-subdirectory-manifest-files': true,\n 'group-membership-enforcement': true,\n 'deprecate-close-command': true,\n 'deprecate-reopen-command': true,\n 'deprecate-merge-command': true,\n 'deprecate-cancel-merge-command': true,\n 'deprecate-squash-merge-command': true,\n};\n\n/**\n * Parses a comma-separated list of key=value pairs representing experiments.\n * @param raw A comma-separated list of key=value pairs representing experiments.\n * @returns A map of experiment names to their values.\n */\nexport function parseExperiments(raw?: string): DependabotExperiments | undefined {\n return raw\n ?.split(',')\n .filter((entry) => entry.trim() !== '') // <-- filter out empty entries\n .reduce((acc, cur) => {\n const [key, value] = cur.split('=', 2);\n acc[key!] = value || true;\n return acc;\n }, {} as DependabotExperiments);\n}\n","import type { SecurityVulnerability } from '@/github';\nimport type {\n DependabotAllowCondition,\n DependabotConfig,\n DependabotGroup,\n DependabotIgnoreCondition,\n DependabotRegistry,\n DependabotUpdate,\n PackageEcosystem,\n VersioningStrategy,\n} from './config';\nimport type {\n DependabotAllowed,\n DependabotCondition,\n DependabotCredential,\n DependabotExistingGroupPR,\n DependabotExistingPR,\n DependabotExperiments,\n DependabotGroupJob,\n DependabotJobConfig,\n DependabotPackageManager,\n DependabotSecurityAdvisory,\n DependabotSource,\n DependabotSourceProvider,\n} from './job';\n\nexport type DependabotSourceInfo = {\n provider: DependabotSourceProvider;\n hostname: string;\n 'api-endpoint': string;\n 'repository-slug': string;\n};\n\nexport type DependabotJobBuilderOutput = {\n job: DependabotJobConfig;\n credentials: DependabotCredential[];\n};\n\n/**\n * Class for building dependabot job objects\n */\nexport class DependabotJobBuilder {\n private readonly config: DependabotConfig;\n private readonly update: DependabotUpdate;\n private readonly experiments: DependabotExperiments;\n private readonly debug: boolean;\n\n private readonly packageManager: DependabotPackageManager;\n private readonly source: DependabotSource;\n private readonly credentials: DependabotCredential[];\n\n constructor({\n source,\n config,\n update,\n systemAccessUser,\n systemAccessToken,\n githubToken,\n experiments,\n debug,\n }: {\n source: DependabotSourceInfo;\n config: DependabotConfig;\n update: DependabotUpdate;\n experiments: DependabotExperiments;\n systemAccessUser?: string;\n systemAccessToken?: string;\n githubToken?: string;\n /** Determines if verbose log messages are logged */\n debug: boolean;\n }) {\n this.config = config;\n this.update = update;\n this.experiments = experiments;\n this.debug = debug;\n\n this.packageManager = mapPackageEcosystemToPackageManager(update['package-ecosystem']);\n this.source = mapSourceFromDependabotConfigToJobConfig(source, update);\n this.credentials = mapCredentials({\n sourceHostname: source.hostname,\n systemAccessUser,\n systemAccessToken,\n githubToken,\n registries: config.registries,\n });\n }\n\n /**\n * Create a dependabot update job that updates nothing, but will discover the dependency list for a package ecosystem\n */\n public forDependenciesList({\n id,\n command,\n }: {\n id?: string;\n command: DependabotJobConfig['command'];\n }): DependabotJobBuilderOutput {\n id ??= makeRandomJobId();\n return {\n job: {\n id: id,\n command: command,\n 'package-manager': this.packageManager,\n 'updating-a-pull-request': false,\n dependencies: null,\n 'allowed-updates': [{ 'dependency-type': 'direct', 'update-type': 'all' }],\n 'ignore-conditions': [{ 'dependency-name': '*' }],\n 'security-updates-only': false,\n 'security-advisories': [],\n source: this.source,\n 'update-subdependencies': false,\n 'existing-pull-requests': [],\n 'existing-group-pull-requests': [],\n experiments: this.experiments,\n 'requirements-update-strategy': null,\n 'lockfile-only': false,\n 'commit-message-options': {\n prefix: null,\n 'prefix-development': null,\n 'include-scope': null,\n },\n 'vendor-dependencies': false,\n 'repo-private': true,\n debug: this.debug,\n },\n credentials: this.credentials,\n };\n }\n\n /**\n * Create a dependabot update job that updates all dependencies for a package ecosystem\n */\n public forUpdate({\n id,\n command,\n dependencyNamesToUpdate,\n existingPullRequests,\n pullRequestToUpdate,\n securityVulnerabilities,\n }: {\n id?: string;\n command: DependabotJobConfig['command'];\n dependencyNamesToUpdate?: string[];\n existingPullRequests: (DependabotExistingPR[] | DependabotExistingGroupPR)[];\n pullRequestToUpdate?: DependabotExistingPR[] | DependabotExistingGroupPR;\n securityVulnerabilities?: SecurityVulnerability[];\n }): DependabotJobBuilderOutput {\n id ??= makeRandomJobId();\n const securityOnlyUpdate = this.update['open-pull-requests-limit'] === 0;\n\n let updatingPullRequest: boolean;\n let updateDependencyGroupName: string | null = null;\n let updateDependencyNames: string[] | null;\n let vulnerabilities: SecurityVulnerability[] | undefined;\n\n if (pullRequestToUpdate) {\n updatingPullRequest = true;\n updateDependencyGroupName = Array.isArray(pullRequestToUpdate)\n ? null\n : pullRequestToUpdate['dependency-group-name'];\n updateDependencyNames = (\n Array.isArray(pullRequestToUpdate) ? pullRequestToUpdate : pullRequestToUpdate.dependencies\n )?.map((d) => d['dependency-name']);\n vulnerabilities = securityVulnerabilities?.filter((v) => updateDependencyNames?.includes(v.package.name));\n } else {\n updatingPullRequest = false;\n const names = dependencyNamesToUpdate?.length ? dependencyNamesToUpdate : null;\n updateDependencyNames =\n securityOnlyUpdate && names\n ? names?.filter((d) => securityVulnerabilities?.find((v) => v.package.name === d))\n : names;\n vulnerabilities = securityVulnerabilities;\n }\n\n return {\n job: {\n id: id,\n command: command,\n 'package-manager': this.packageManager,\n 'updating-a-pull-request': updatingPullRequest || false,\n 'dependency-group-to-refresh': updateDependencyGroupName,\n 'dependency-groups': mapGroupsFromDependabotConfigToJobConfig(this.update.groups),\n dependencies: updateDependencyNames,\n 'allowed-updates': mapAllowedUpdatesFromDependabotConfigToJobConfig(this.update.allow, securityOnlyUpdate),\n 'ignore-conditions': mapIgnoreConditionsFromDependabotConfigToJobConfig(this.update.ignore),\n 'security-updates-only': securityOnlyUpdate,\n 'security-advisories': mapSecurityAdvisories(vulnerabilities),\n source: this.source,\n 'update-subdependencies': false,\n 'existing-pull-requests': existingPullRequests.filter((pr) => Array.isArray(pr)),\n 'existing-group-pull-requests': existingPullRequests.filter(\n (pr): pr is DependabotExistingGroupPR => !Array.isArray(pr),\n ),\n 'commit-message-options': {\n prefix: this.update['commit-message']?.prefix ?? null,\n 'prefix-development': this.update['commit-message']?.['prefix-development'] ?? null,\n 'include-scope':\n this.update['commit-message']?.include?.toLocaleLowerCase()?.trim() === 'scope' ? true : null,\n },\n cooldown: this.update.cooldown,\n experiments: mapExperiments(this.experiments),\n 'reject-external-code':\n this.update['insecure-external-code-execution']?.toLocaleLowerCase()?.trim() === 'allow',\n 'requirements-update-strategy': mapVersionStrategyToRequirementsUpdateStrategy(\n this.update['versioning-strategy'],\n ),\n 'lockfile-only': this.update['versioning-strategy'] === 'lockfile-only',\n 'vendor-dependencies': this.update.vendor ?? false,\n 'repo-private': true,\n debug: this.debug,\n 'proxy-log-response-body-on-auth-failure': true,\n 'max-updater-run-time': 2700,\n 'enable-beta-ecosystems': this.config['enable-beta-ecosystems'] || false,\n // Updates across ecosystems is still in development\n // See https://github.com/dependabot/dependabot-core/issues/8126\n // https://github.com/dependabot/dependabot-core/pull/12339\n // It needs to merged in the core repo first before we support it\n // However, to match current job configs and to prevent surprises, we disable it\n 'multi-ecosystem-update': false,\n 'exclude-paths': this.update['exclude-paths'],\n },\n credentials: this.credentials,\n };\n }\n}\n\nexport function mapPackageEcosystemToPackageManager(ecosystem: PackageEcosystem): DependabotPackageManager {\n // Map the dependabot config \"package ecosystem\" to the equivalent dependabot-core/cli \"package manager\".\n // Config values: https://docs.github.com/en/code-security/dependabot/working-with-dependabot/dependabot-options-reference#package-ecosystem-\n // Core/CLI values: https://github.com/dependabot/dependabot-core/blob/main/common/lib/dependabot/config/file.rb#L60-L81\n switch (ecosystem) {\n case 'docker-compose':\n return 'docker_compose';\n case 'dotnet-sdk':\n return 'dotnet_sdk';\n case 'github-actions':\n return 'github_actions';\n case 'gitsubmodule':\n return 'submodules';\n case 'gomod':\n return 'go_modules';\n case 'mix':\n return 'hex';\n case 'npm':\n return 'npm_and_yarn';\n // Additional aliases, sometimes used for convenience\n case 'pipenv':\n return 'pip';\n case 'pip-compile':\n return 'pip';\n case 'poetry':\n return 'pip';\n case 'pnpm':\n return 'npm_and_yarn';\n case 'rust-toolchain':\n return 'rust_toolchain';\n case 'yarn':\n return 'npm_and_yarn';\n default:\n return ecosystem;\n }\n}\n\nexport function mapSourceFromDependabotConfigToJobConfig(\n source: DependabotSourceInfo,\n update: DependabotUpdate,\n): DependabotSource {\n return {\n provider: source.provider,\n 'api-endpoint': source['api-endpoint'],\n hostname: source.hostname,\n repo: source['repository-slug'],\n branch: update['target-branch'],\n commit: null, // use latest commit of target branch\n directory: update.directory,\n directories: update.directories,\n };\n}\n\nexport function mapVersionStrategyToRequirementsUpdateStrategy(strategy?: VersioningStrategy): string | null {\n if (!strategy) return null;\n switch (strategy) {\n case 'auto':\n return null;\n case 'increase':\n return 'bump_versions';\n case 'increase-if-necessary':\n return 'bump_versions_if_necessary';\n case 'lockfile-only':\n return 'lockfile_only';\n case 'widen':\n return 'widen_ranges';\n default:\n throw new Error(`Invalid dependabot.yaml versioning strategy option '${strategy}'`);\n }\n}\n\nexport function mapGroupsFromDependabotConfigToJobConfig(\n dependencyGroups?: Record<string, DependabotGroup | null>,\n): DependabotGroupJob[] {\n if (!dependencyGroups || !Object.keys(dependencyGroups).length) return [];\n return Object.keys(dependencyGroups)\n .filter((name) => dependencyGroups[name])\n .map((name) => {\n const group = dependencyGroups[name]!;\n return {\n name: name,\n 'applies-to': group['applies-to'],\n rules: {\n patterns: group.patterns?.length ? group.patterns : ['*'],\n 'exclude-patterns': group['exclude-patterns'],\n 'dependency-type': group['dependency-type'],\n 'update-types': group['update-types'],\n },\n } satisfies DependabotGroupJob;\n });\n}\n\nexport function mapAllowedUpdatesFromDependabotConfigToJobConfig(\n allowedUpdates?: DependabotAllowCondition[],\n securityOnlyUpdate?: boolean,\n): DependabotAllowed[] {\n // If no allow conditions are specified, update direct dependencies by default; This is what GitHub does.\n // NOTE: 'update-type' appears to be a deprecated config, but still appears in the dependabot-core model and GitHub Dependabot job logs.\n // See: https://github.com/dependabot/dependabot-core/blob/b3a0c1f86c20729494097ebc695067099f5b4ada/updater/lib/dependabot/job.rb#L253C1-L257C78\n if (!allowedUpdates) {\n return [\n {\n 'dependency-type': 'direct',\n 'update-type': securityOnlyUpdate ? 'security' : 'all',\n },\n ];\n }\n return allowedUpdates.map((allow) => {\n return {\n 'dependency-name': allow['dependency-name'],\n 'dependency-type': allow['dependency-type'],\n 'update-type': allow['update-type'],\n };\n });\n}\n\nexport function mapIgnoreConditionsFromDependabotConfigToJobConfig(\n ignoreConditions?: DependabotIgnoreCondition[],\n): DependabotCondition[] {\n if (!ignoreConditions) return [];\n return ignoreConditions.map((ignore) => {\n return {\n source: ignore.source,\n 'updated-at': ignore['updated-at'],\n 'dependency-name': ignore['dependency-name'] ?? '*',\n 'update-types': ignore['update-types'],\n\n // The dependabot.yml config docs are not very clear about acceptable values; after scanning dependabot-core and dependabot-cli,\n // this could either be a single version string (e.g. '>1.0.0'), or multiple version strings separated by commas (e.g. '>1.0.0, <2.0.0')\n 'version-requirement': Array.isArray(ignore.versions) ? (<string[]>ignore.versions)?.join(', ') : ignore.versions,\n } satisfies DependabotCondition;\n });\n}\n\nexport function mapExperiments(experiments?: DependabotExperiments): DependabotExperiments {\n experiments ??= {};\n return Object.keys(experiments).reduce((acc, key) => {\n // Experiment values are known to be either 'true', 'false', or a string value.\n // If the value is 'true' or 'false', convert it to a boolean type so that dependabot-core handles it correctly.\n const value = experiments[key];\n if (typeof value === 'string' && value?.toLocaleLowerCase() === 'true') {\n acc[key] = true;\n } else if (typeof value === 'string' && value?.toLocaleLowerCase() === 'false') {\n acc[key] = false;\n } else {\n if (typeof value === 'string' || typeof value === 'boolean') acc[key] = value;\n }\n return acc;\n }, {} as DependabotExperiments);\n}\n\nexport function mapSecurityAdvisories(securityVulnerabilities?: SecurityVulnerability[]): DependabotSecurityAdvisory[] {\n if (!securityVulnerabilities) return [];\n\n // A single security advisory can cause a vulnerability in multiple versions of a package.\n // We need to map each unique security advisory to a list of affected-versions and patched-versions.\n const vulnerabilitiesGroupedByPackageNameAndAdvisoryId = new Map<string, SecurityVulnerability[]>();\n for (const vuln of securityVulnerabilities) {\n const key = `${vuln.package.name}/${vuln.advisory.identifiers.map((i) => `${i.type}:${i.value}`).join('/')}`;\n if (!vulnerabilitiesGroupedByPackageNameAndAdvisoryId.has(key)) {\n vulnerabilitiesGroupedByPackageNameAndAdvisoryId.set(key, []);\n }\n vulnerabilitiesGroupedByPackageNameAndAdvisoryId.get(key)!.push(vuln);\n }\n return Array.from(vulnerabilitiesGroupedByPackageNameAndAdvisoryId.values()).map((vulns) => {\n return {\n 'dependency-name': vulns[0]!.package.name,\n 'affected-versions': vulns.map((v) => v.vulnerableVersionRange).filter((v) => v && v.length > 0),\n 'patched-versions': vulns\n .map((v) => v.firstPatchedVersion?.identifier)\n .filter((v) => v && v.length > 0)\n .map((v) => v!),\n 'unaffected-versions': [],\n } satisfies DependabotSecurityAdvisory;\n });\n}\n\nexport function mapCredentials({\n sourceHostname,\n systemAccessUser,\n systemAccessToken,\n githubToken,\n registries,\n}: {\n sourceHostname: string;\n systemAccessUser?: string;\n systemAccessToken?: string;\n githubToken?: string;\n registries?: Record<string, DependabotRegistry>;\n}): DependabotCredential[] {\n const credentials = [];\n\n // Required to authenticate with the git repository when cloning the source code\n if (systemAccessToken) {\n credentials.push({\n type: 'git_source',\n host: sourceHostname,\n username: (systemAccessUser ?? '').trim()?.length > 0 ? systemAccessUser : 'x-access-token',\n password: systemAccessToken,\n });\n }\n\n // Required to avoid rate-limiting errors when generating pull request descriptions (e.g. fetching release notes, commit messages, etc)\n if (githubToken) {\n credentials.push({\n type: 'git_source',\n host: 'github.com',\n username: 'x-access-token',\n password: githubToken,\n });\n }\n if (registries) {\n // TODO: only registries for the current update should be set\n // Required to authenticate with private package feeds when finding the latest version of dependencies.\n // The registries have already been worked on (see parseRegistries) so there is no need to do anything else.\n credentials.push(...Object.values(registries));\n }\n\n return credentials;\n}\n\nexport function makeRandomJobId(): string {\n const array = new Uint32Array(1);\n crypto.getRandomValues(array);\n return `${array[0]! % 10000000000}`; // Limit to 10 digits to match GitHub's job IDs\n}\n","import { z } from 'zod';\nimport { DependabotDependencySchema, DependabotPackageManagerSchema } from './job';\n\n// we use nullish() because it does optional() and allows the value to be set to null\n\nexport const DependabotDependencyFileSchema = z.object({\n // https://github.com/dependabot/dependabot-core/blob/5e2711f9913cc387acb7cb0d29d51fb52d235ef2/common/lib/dependabot/dependency_file.rb#L14-L15\n content: z.string().nullish(),\n content_encoding: z\n .enum([\n 'utf-8',\n 'base64',\n // for some reason, some files (e.g. txt in gomod) are marked as empty string encoding\n '',\n ])\n .nullish(),\n deleted: z.boolean().nullish(),\n directory: z.string(),\n name: z.string(),\n operation: z.enum(['update', 'create', 'delete']),\n support_file: z.boolean().nullish(),\n vendored_file: z.boolean().nullish(),\n symlink_target: z.string().nullish(),\n type: z.string().nullish(),\n mode: z\n .enum({\n executable: '100755',\n file: '100644',\n directory: '040000',\n submodule: '160000',\n symlink: '120000',\n })\n .or(z.string())\n .nullish(),\n});\nexport type DependabotDependencyFile = z.infer<typeof DependabotDependencyFileSchema>;\n\nexport const DependabotUpdateDependencyListSchema = z.object({\n dependencies: DependabotDependencySchema.array(),\n dependency_files: z.string().array().nullish(),\n});\nexport type DependabotUpdateDependencyList = z.infer<typeof DependabotUpdateDependencyListSchema>;\n\nexport const DependabotDependencySubmissionSchema = z.object({\n version: z.number(),\n sha: z.string(),\n ref: z.string(),\n job: z.object({\n correlator: z.string(),\n id: z.string(),\n }),\n detector: z.object({\n name: z.string(),\n version: z.string(),\n url: z.string(),\n }),\n manifests: z.object({\n name: z.string().nullish(),\n file: z.object({ source_location: z.string() }).nullish(),\n metadata: z.object({ ecosystem: DependabotPackageManagerSchema }).nullish(),\n resolved: z\n .object({\n package_url: z.string(),\n relationship: z.enum(['direct', 'indirect']),\n scope: z.enum(['runtime', 'development']),\n dependencies: DependabotDependencySchema.array(),\n })\n .nullish(),\n }),\n});\nexport type DependabotDependencySubmission = z.infer<typeof DependabotDependencySubmissionSchema>;\n\nexport const DependabotCreatePullRequestSchema = z.object({\n 'base-commit-sha': z.string(),\n dependencies: DependabotDependencySchema.array(),\n 'updated-dependency-files': DependabotDependencyFileSchema.array(),\n 'pr-title': z.string(),\n 'pr-body': z.string().nullish(),\n 'commit-message': z.string(),\n 'dependency-group': z.record(z.string(), z.any()).nullish(),\n});\nexport type DependabotCreatePullRequest = z.infer<typeof DependabotCreatePullRequestSchema>;\n\nexport const DependabotUpdatePullRequestSchema = z.object({\n 'base-commit-sha': z.string(),\n 'dependency-names': z.string().array(),\n 'updated-dependency-files': DependabotDependencyFileSchema.array(),\n 'pr-title': z.string().nullish(), // this is usually excluded when working with dependabot-cli and an empty string if the API\n 'pr-body': z.string().nullish(), // this is usually excluded when working with dependabot-cli and an empty string if the API\n 'commit-message': z.string().nullish(), // this is usually excluded when working with dependabot-cli and an empty string if the API\n 'dependency-group': z.record(z.string(), z.any()).nullish(),\n});\nexport type DependabotUpdatePullRequest = z.infer<typeof DependabotUpdatePullRequestSchema>;\n\nexport const DependabotClosePullRequestReasonEnum = z.enum([\n 'dependencies_changed',\n 'dependency_group_empty',\n 'dependency_removed',\n 'up_to_date',\n 'update_no_longer_possible',\n]);\nexport type DependabotClosePullRequestReason = z.infer<typeof DependabotClosePullRequestReasonEnum>;\nexport const DependabotClosePullRequestSchema = z.object({\n 'dependency-names': z.string().array(),\n reason: DependabotClosePullRequestReasonEnum.nullish(),\n});\nexport type DependabotClosePullRequest = z.infer<typeof DependabotClosePullRequestSchema>;\n\nexport const DependabotMarkAsProcessedSchema = z.object({\n 'base-commit-sha': z.string().nullish(),\n});\nexport type DependabotMarkAsProcessed = z.infer<typeof DependabotMarkAsProcessedSchema>;\n\nexport const DependabotRecordUpdateJobErrorSchema = z.object({\n 'error-type': z.string(),\n 'error-details': z.record(z.string(), z.any()).nullish(),\n});\nexport type DependabotRecordUpdateJobError = z.infer<typeof DependabotRecordUpdateJobErrorSchema>;\n\nexport const DependabotRecordUpdateJobWarningSchema = z.object({\n 'warn-type': z.string(),\n 'warn-title': z.string(),\n 'warn-description': z.string(),\n});\nexport type DependabotRecordUpdateJobWarning = z.infer<typeof DependabotRecordUpdateJobWarningSchema>;\n\nexport const DependabotRecordUpdateJobUnknownErrorSchema = z.object({\n 'error-type': z.string(),\n 'error-details': z.record(z.string(), z.any()).nullish(),\n});\nexport type DependabotRecordUpdateJobUnknownError = z.infer<typeof DependabotRecordUpdateJobUnknownErrorSchema>;\n\nexport const DependabotRecordEcosystemVersionsSchema = z.object({\n ecosystem_versions: z.record(z.string(), z.any()).nullish(),\n});\nexport type DependabotRecordEcosystemVersions = z.infer<typeof DependabotRecordEcosystemVersionsSchema>;\n\nexport const DependabotEcosystemVersionManagerSchema = z.object({\n name: z.string(),\n version: z.string(),\n raw_version: z.string(),\n requirement: z.record(z.string(), z.any()).nullish(),\n});\nexport type DependabotEcosystemVersionManager = z.infer<typeof DependabotEcosystemVersionManagerSchema>;\n\nexport const DependabotEcosystemMetaSchema = z.object({\n name: z.string(),\n package_manager: DependabotEcosystemVersionManagerSchema.nullish(),\n language: DependabotEcosystemVersionManagerSchema.nullish(),\n version: DependabotEcosystemVersionManagerSchema.nullish(),\n});\nexport type DependabotEcosystemMeta = z.infer<typeof DependabotEcosystemMetaSchema>;\n\nexport const DependabotRecordEcosystemMetaSchema = z.object({\n ecosystem: DependabotEcosystemMetaSchema,\n});\nexport type DependabotRecordEcosystemMeta = z.infer<typeof DependabotRecordEcosystemMetaSchema>;\n\nexport const DependabotIncrementMetricSchema = z.object({\n metric: z.string(),\n tags: z.record(z.string(), z.any()).nullish(),\n});\nexport type DependabotIncrementMetric = z.infer<typeof DependabotIncrementMetricSchema>;\n\nexport const DependabotMetricSchema = z.object({\n metric: z.string(),\n type: z.enum(['increment', 'gauge', 'distribution', 'histogram']),\n value: z.number().nullish(),\n values: z.number().array().nullish(),\n tags: z.record(z.string(), z.string()).nullish(),\n});\nexport type DependabotMetric = z.infer<typeof DependabotMetricSchema>;\n","import { zValidator } from '@hono/zod-validator';\nimport { Hono } from 'hono';\nimport { type ZodType, z } from 'zod';\nimport { logger } from '@/logger';\nimport type { DependabotCredential, DependabotJobConfig } from './job';\nimport {\n DependabotClosePullRequestSchema,\n DependabotCreatePullRequestSchema,\n DependabotDependencySubmissionSchema,\n DependabotIncrementMetricSchema,\n DependabotMarkAsProcessedSchema,\n DependabotMetricSchema,\n DependabotRecordEcosystemMetaSchema,\n DependabotRecordEcosystemVersionsSchema,\n DependabotRecordUpdateJobErrorSchema,\n DependabotRecordUpdateJobUnknownErrorSchema,\n DependabotRecordUpdateJobWarningSchema,\n DependabotUpdateDependencyListSchema,\n DependabotUpdatePullRequestSchema,\n} from './update';\n\nexport const DependabotRequestTypeSchema = z.enum([\n 'create_pull_request',\n 'update_pull_request',\n 'close_pull_request',\n 'record_update_job_error',\n 'record_update_job_warning',\n 'record_update_job_unknown_error',\n 'mark_as_processed',\n 'update_dependency_list',\n 'create_dependency_submission',\n 'record_ecosystem_versions',\n 'record_ecosystem_meta',\n 'increment_metric',\n 'record_metrics',\n]);\nexport type DependabotRequestType = z.infer<typeof DependabotRequestTypeSchema>;\n\nexport const DependabotRequestSchema = z.discriminatedUnion('type', [\n z.object({ type: z.literal('create_pull_request'), data: DependabotCreatePullRequestSchema }),\n z.object({ type: z.literal('update_pull_request'), data: DependabotUpdatePullRequestSchema }),\n z.object({ type: z.literal('close_pull_request'), data: DependabotClosePullRequestSchema }),\n z.object({ type: z.literal('record_update_job_error'), data: DependabotRecordUpdateJobErrorSchema }),\n z.object({ type: z.literal('record_update_job_warning'), data: DependabotRecordUpdateJobWarningSchema }),\n z.object({ type: z.literal('record_update_job_unknown_error'), data: DependabotRecordUpdateJobUnknownErrorSchema }),\n z.object({ type: z.literal('mark_as_processed'), data: DependabotMarkAsProcessedSchema }),\n z.object({ type: z.literal('update_dependency_list'), data: DependabotUpdateDependencyListSchema }),\n z.object({ type: z.literal('create_dependency_submission'), data: DependabotDependencySubmissionSchema }),\n z.object({ type: z.literal('record_ecosystem_versions'), data: DependabotRecordEcosystemVersionsSchema }),\n z.object({ type: z.literal('record_ecosystem_meta'), data: DependabotRecordEcosystemMetaSchema.array() }),\n z.object({ type: z.literal('increment_metric'), data: DependabotIncrementMetricSchema }),\n z.object({ type: z.literal('record_metrics'), data: DependabotMetricSchema.array() }),\n]);\nexport type DependabotRequest = z.infer<typeof DependabotRequestSchema>;\n\nexport type DependabotTokenType = 'job' | 'credentials';\n\n/**\n * Function type for authenticating requests.\n * @param type - The type of authentication ('job' or 'credentials').\n * @param id - The ID of the dependabot job.\n * @param value - The authentication value (e.g., API key).\n * @returns A promise that resolves to a boolean indicating whether the authentication was successful.\n */\ntype AuthenticatorFunc = (type: DependabotTokenType, id: string, value: string) => Promise<boolean>;\n\n/**\n * Handler function for processing dependabot requests.\n * @param id - The ID of the dependabot job.\n * @param request - The dependabot request to handle.\n * @returns A promise that resolves to the result of handling the request.\n */\ntype HandlerFunc = (id: string, request: DependabotRequest) => Promise<boolean>;\n\n/**\n * Function for inspecting raw dependabot requests.\n * @param id - The ID of the dependabot job.\n * @param type - The type of dependabot request.\n * @param raw - The raw JSON data of the request.\n * @returns A promise that resolves when the operation is complete.\n */\ntype InspectRequestFunc = (id: string, type: DependabotRequestType, raw: unknown) => Promise<void>;\n\n/**\n * Function for getting a dependabot job config by ID.\n * @param id - The ID of the dependabot job.\n * @returns A promise that resolves to the dependabot job config, or undefined if not found.\n */\ntype GetJobFunc = (id: string) => Promise<DependabotJobConfig | undefined>;\n\n/**\n * Function for getting dependabot credentials by job ID.\n * @param id - The ID of the dependabot job.\n * @returns A promise that resolves to an array of dependabot credentials, or undefined if not found.\n */\ntype GetCredentialsFunc = (id: string) => Promise<DependabotCredential[] | undefined>;\n\nexport type CreateApiServerAppOptions = {\n /**\n * Base path for the endpoints.\n * @default `/api/update_jobs`\n */\n basePath?: string;\n\n /** Handler function for authenticating requests. */\n authenticate: AuthenticatorFunc;\n\n /** Function for getting a dependabot job by ID. */\n getJob: GetJobFunc;\n\n /** Function for getting dependabot credentials by job ID. */\n getCredentials: GetCredentialsFunc;\n\n /**\n * Optional function for inspecting raw dependabot requests.\n * Should only be used for troubleshooting.\n * */\n inspect?: InspectRequestFunc;\n\n /** Handler function for processing the operations. */\n handle: HandlerFunc;\n};\n\n/**\n * Creates an API server application for handling dependabot update jobs.\n * The endpoints in the server application have paths in the format: `/api/update_jobs/:id/{operation}`,\n * where `:id` is the job ID and `{operation}` is one of the defined operations e.g. `create_pull_request`.\n *\n * You should set the job endpoint URL in the job container to\n * `http://<host>:<port>/api/update_jobs/:id` where `<host>` and `<port>` are the host and port\n *\n * These endpoints are protected using the provided API key.\n * @param params - The parameters for creating the API server application.\n * @returns The created API server application.\n */\nexport function createApiServerApp({\n basePath = `/api/update_jobs`,\n authenticate,\n getJob,\n getCredentials,\n inspect,\n handle,\n}: CreateApiServerAppOptions): Hono {\n // Setup app with base path and middleware\n const app = new Hono().basePath(basePath);\n\n // Handle endpoints:\n // - POST request to /create_pull_request\n // - POST request to /update_pull_request\n // - POST request to /close_pull_request\n // - POST request to /record_update_job_error\n // - POST request to /record_update_job_warning\n // - POST request to /record_update_job_unknown_error\n // - PATCH request to /mark_as_processed\n // - POST request to /update_dependency_list\n // - POST request to /create_dependency_submission\n // - POST request to /record_ecosystem_versions\n // - POST request to /record_ecosystem_meta\n // - POST request to /increment_metric\n\n function operation<T extends ZodType>(type: DependabotRequestType, schema: T, method?: string) {\n app.on(\n method || 'post',\n `/:id/${type}`,\n zValidator('param', z.object({ id: z.string() })),\n async (context, next) => {\n /**\n * Do not authenticate in scenarios where the server is not using HTTPS because the\n * dependabot proxy will not send the job token over HTTP, yet trying to get HTTPS to work\n * with localhost (self-signed certs) against docker (host.docker.internal) is complicated.\n */\n const url = new URL(context.req.url);\n const isHTTPS = url.protocol === 'https:';\n const { id } = context.req.valid('param');\n if (isHTTPS) {\n const value = context.req.header('Authorization');\n if (!value) return context.body(null, 401);\n const valid = await authenticate('job', id, value);\n if (!valid) return context.body(null, 403);\n } else {\n logger.trace(`Skipping authentication because it is not secure ${context.req.url}`);\n }\n\n // if inspection is provided, call it with the raw request data\n if (inspect) {\n await inspect(id, type, await context.req.json());\n }\n\n await next();\n },\n zValidator('json', z.object({ data: schema })),\n async (context) => {\n const { id } = context.req.valid('param');\n const { data } = context.req.valid('json') as { data: z.infer<typeof schema> };\n // biome-ignore lint/suspicious/noExplicitAny: generic\n const success: boolean = await handle(id, { type, data: data as any });\n return context.body(null, success ? 204 : 400);\n },\n );\n }\n\n operation('create_pull_request', DependabotCreatePullRequestSchema);\n operation('update_pull_request', DependabotUpdatePullRequestSchema);\n operation('close_pull_request', DependabotClosePullRequestSchema);\n operation('record_update_job_error', DependabotRecordUpdateJobErrorSchema);\n operation('record_update_job_warning', DependabotRecordUpdateJobWarningSchema);\n operation('record_update_job_unknown_error', DependabotRecordUpdateJobUnknownErrorSchema);\n operation('mark_as_processed', DependabotMarkAsProcessedSchema, 'patch');\n operation('update_dependency_list', DependabotUpdateDependencyListSchema);\n operation('create_dependency_submission', DependabotDependencySubmissionSchema);\n operation('record_ecosystem_versions', DependabotRecordEcosystemVersionsSchema);\n operation('record_ecosystem_meta', DependabotRecordEcosystemMetaSchema.array());\n operation('increment_metric', DependabotIncrementMetricSchema);\n operation('record_metrics', DependabotMetricSchema.array());\n\n // Handle endpoints:\n // - GET request to /details\n // - GET request to /credentials\n app.on(\n 'get',\n '/:id/details',\n zValidator('param', z.object({ id: z.string() })),\n async (context, next) => {\n const { id } = context.req.valid('param');\n const value = context.req.header('Authorization');\n if (!value) return context.body(null, 401);\n const valid = await authenticate('job', id, value);\n if (!valid) return context.body(null, 403);\n await next();\n },\n async (context) => {\n const { id } = context.req.valid('param');\n const job = await getJob(id);\n if (!job) return context.body(null, 204);\n return context.json(job);\n },\n );\n app.on(\n 'get',\n '/:id/credentials',\n zValidator('param', z.object({ id: z.string() })),\n async (context, next) => {\n const { id } = context.req.valid('param');\n const value = context.req.header('Authorization');\n if (!value) return context.body(null, 401);\n const valid = await authenticate('credentials', id, value);\n if (!valid) return context.body(null, 403);\n await next();\n },\n async (context) => {\n const { id } = context.req.valid('param');\n const credentials = await getCredentials(id);\n if (!credentials) return context.body(null, 204);\n return context.json(credentials);\n },\n );\n\n return app;\n}\n"],"mappings":";;;;;;;;AAKA,MAAa,kCAAkC;AAC/C,MAAa,iCAAiC;;;;ACE9C,SAAgB,uBACd,kBACA,kBACA,WACA,qBACA,cACA,YAAoB,KACZ;CAIR,IAAIA;AAEJ,KADiC,uBAAuB,aAAa,SAAS,GAChD;EAG5B,MAAM,mBAAmBC,SACtB,WAAW,MAAM,CACjB,OAAO,aAAa,KAAK,MAAM,GAAG,EAAE,mBAAmB,GAAG,EAAE,wBAAwB,CAAC,KAAK,IAAI,CAAC,CAC/F,OAAO,MAAM,CACb,UAAU,GAAG,GAAG;AACnB,eAAa,GAAG,uBAAuB,QAAQ,GAAG;OAUlD,cAAa,GANW,aACrB,KAAK,MAAM,EAAE,mBAAmB,CAChC,KAAK,QAAQ,CACb,QAAQ,UAAU,IAAI,CACtB,QAAQ,MAAM,GAAG,CAEY,GADV,aAAa,IAAI,UAAU,YAAY,aAAa,KAAK;AAIjF,QAAO,YACL;EACE;EACA;EACA;EAEA,YACI,UACG,MAAM,IAAI,CACV,QAAQ,SAAS,KAAK,SAAS,EAAE,CACjC,KAAK,UAAU,GAClB;EACJ;EACD,EACD,UACD;;AAGH,SAAgB,YAAY,UAAkC,WAA2B;AAOvF,QACE,SAEG,QAAQ,MAAM,KAAK,EAAE,MAAM,CAAC,SAAS,EAAE,CACvC,KAAK,UAAU,CAEf,QAAQ,0BAA0B,GAAG,CAErC,QAAQ,SAAS,QAAQ,CAEzB,QAAQ,QAAQ,IAAI,CACpB,QAAQ,QAAQ,IAAI,CAEpB,QAAQ,OAAO,GAAG;;;;;AC3EzB,MAAaC,sBAA6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IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,EACjD,OAAO,SAAS,SAAS;EACvB,MAAM,EAAE,OAAO,QAAQ,IAAI,MAAM,QAAQ;EACzC,MAAM,QAAQ,QAAQ,IAAI,OAAO,gBAAgB;AACjD,MAAI,CAAC,MAAO,QAAO,QAAQ,KAAK,MAAM,IAAI;AAE1C,MAAI,CADU,MAAM,aAAa,eAAe,IAAI,MAAM,CAC9C,QAAO,QAAQ,KAAK,MAAM,IAAI;AAC1C,QAAM,MAAM;IAEd,OAAO,YAAY;EACjB,MAAM,EAAE,OAAO,QAAQ,IAAI,MAAM,QAAQ;EACzC,MAAM,cAAc,MAAM,eAAe,GAAG;AAC5C,MAAI,CAAC,YAAa,QAAO,QAAQ,KAAK,MAAM,IAAI;AAChD,SAAO,QAAQ,KAAK,YAAY;GAEnC;AAED,QAAO"}
@@ -114,9 +114,9 @@ declare const DependabotAllowConditionSchema: z.ZodObject<{
114
114
  'dependency-name': z.ZodOptional<z.ZodString>;
115
115
  'dependency-type': z.ZodOptional<z.ZodEnum<{
116
116
  production: "production";
117
+ development: "development";
117
118
  direct: "direct";
118
119
  indirect: "indirect";
119
- development: "development";
120
120
  all: "all";
121
121
  }>>;
122
122
  'update-type': z.ZodOptional<z.ZodEnum<{
@@ -277,9 +277,9 @@ declare const DependabotUpdateSchema: z.ZodPipe<z.ZodObject<{
277
277
  'dependency-name': z.ZodOptional<z.ZodString>;
278
278
  'dependency-type': z.ZodOptional<z.ZodEnum<{
279
279
  production: "production";
280
+ development: "development";
280
281
  direct: "direct";
281
282
  indirect: "indirect";
282
- development: "development";
283
283
  all: "all";
284
284
  }>>;
285
285
  'update-type': z.ZodOptional<z.ZodEnum<{
@@ -393,7 +393,7 @@ declare const DependabotUpdateSchema: z.ZodPipe<z.ZodObject<{
393
393
  'exclude-paths'?: string[] | undefined;
394
394
  allow?: {
395
395
  'dependency-name'?: string | undefined;
396
- 'dependency-type'?: "production" | "direct" | "indirect" | "development" | "all" | undefined;
396
+ 'dependency-type'?: "production" | "development" | "direct" | "indirect" | "all" | undefined;
397
397
  'update-type'?: "all" | "security" | undefined;
398
398
  }[] | undefined;
399
399
  assignees?: string[] | undefined;
@@ -451,7 +451,7 @@ declare const DependabotUpdateSchema: z.ZodPipe<z.ZodObject<{
451
451
  'exclude-paths'?: string[] | undefined;
452
452
  allow?: {
453
453
  'dependency-name'?: string | undefined;
454
- 'dependency-type'?: "production" | "direct" | "indirect" | "development" | "all" | undefined;
454
+ 'dependency-type'?: "production" | "development" | "direct" | "indirect" | "all" | undefined;
455
455
  'update-type'?: "all" | "security" | undefined;
456
456
  }[] | undefined;
457
457
  assignees?: string[] | undefined;
@@ -652,9 +652,9 @@ declare const DependabotConfigSchema: z.ZodPipe<z.ZodObject<{
652
652
  'dependency-name': z.ZodOptional<z.ZodString>;
653
653
  'dependency-type': z.ZodOptional<z.ZodEnum<{
654
654
  production: "production";
655
+ development: "development";
655
656
  direct: "direct";
656
657
  indirect: "indirect";
657
- development: "development";
658
658
  all: "all";
659
659
  }>>;
660
660
  'update-type': z.ZodOptional<z.ZodEnum<{
@@ -768,7 +768,7 @@ declare const DependabotConfigSchema: z.ZodPipe<z.ZodObject<{
768
768
  'exclude-paths'?: string[] | undefined;
769
769
  allow?: {
770
770
  'dependency-name'?: string | undefined;
771
- 'dependency-type'?: "production" | "direct" | "indirect" | "development" | "all" | undefined;
771
+ 'dependency-type'?: "production" | "development" | "direct" | "indirect" | "all" | undefined;
772
772
  'update-type'?: "all" | "security" | undefined;
773
773
  }[] | undefined;
774
774
  assignees?: string[] | undefined;
@@ -826,7 +826,7 @@ declare const DependabotConfigSchema: z.ZodPipe<z.ZodObject<{
826
826
  'exclude-paths'?: string[] | undefined;
827
827
  allow?: {
828
828
  'dependency-name'?: string | undefined;
829
- 'dependency-type'?: "production" | "direct" | "indirect" | "development" | "all" | undefined;
829
+ 'dependency-type'?: "production" | "development" | "direct" | "indirect" | "all" | undefined;
830
830
  'update-type'?: "all" | "security" | undefined;
831
831
  }[] | undefined;
832
832
  assignees?: string[] | undefined;
@@ -956,7 +956,7 @@ declare const DependabotConfigSchema: z.ZodPipe<z.ZodObject<{
956
956
  'exclude-paths'?: string[] | undefined;
957
957
  allow?: {
958
958
  'dependency-name'?: string | undefined;
959
- 'dependency-type'?: "production" | "direct" | "indirect" | "development" | "all" | undefined;
959
+ 'dependency-type'?: "production" | "development" | "direct" | "indirect" | "all" | undefined;
960
960
  'update-type'?: "all" | "security" | undefined;
961
961
  }[] | undefined;
962
962
  assignees?: string[] | undefined;
@@ -1057,7 +1057,7 @@ declare const DependabotConfigSchema: z.ZodPipe<z.ZodObject<{
1057
1057
  'exclude-paths'?: string[] | undefined;
1058
1058
  allow?: {
1059
1059
  'dependency-name'?: string | undefined;
1060
- 'dependency-type'?: "production" | "direct" | "indirect" | "development" | "all" | undefined;
1060
+ 'dependency-type'?: "production" | "development" | "direct" | "indirect" | "all" | undefined;
1061
1061
  'update-type'?: "all" | "security" | undefined;
1062
1062
  }[] | undefined;
1063
1063
  assignees?: string[] | undefined;
@@ -1838,6 +1838,7 @@ declare const DependabotRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1838
1838
  'updated-dependency-files': z.ZodArray<z.ZodObject<{
1839
1839
  content: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1840
1840
  content_encoding: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
1841
+ "": "";
1841
1842
  "utf-8": "utf-8";
1842
1843
  base64: "base64";
1843
1844
  }>>>;
@@ -1874,6 +1875,7 @@ declare const DependabotRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1874
1875
  'updated-dependency-files': z.ZodArray<z.ZodObject<{
1875
1876
  content: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1876
1877
  content_encoding: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
1878
+ "": "";
1877
1879
  "utf-8": "utf-8";
1878
1880
  base64: "base64";
1879
1881
  }>>>;
@@ -2027,8 +2029,8 @@ declare const DependabotRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2027
2029
  indirect: "indirect";
2028
2030
  }>;
2029
2031
  scope: z.ZodEnum<{
2030
- runtime: "runtime";
2031
2032
  development: "development";
2033
+ runtime: "runtime";
2032
2034
  }>;
2033
2035
  dependencies: z.ZodArray<z.ZodObject<{
2034
2036
  name: z.ZodString;
@@ -2074,6 +2076,12 @@ declare const DependabotRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2074
2076
  raw_version: z.ZodString;
2075
2077
  requirement: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
2076
2078
  }, z.core.$strip>>>;
2079
+ language: z.ZodOptional<z.ZodNullable<z.ZodObject<{
2080
+ name: z.ZodString;
2081
+ version: z.ZodString;
2082
+ raw_version: z.ZodString;
2083
+ requirement: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
2084
+ }, z.core.$strip>>>;
2077
2085
  version: z.ZodOptional<z.ZodNullable<z.ZodObject<{
2078
2086
  name: z.ZodString;
2079
2087
  version: z.ZodString;
@@ -2185,6 +2193,7 @@ declare function createApiServerApp({
2185
2193
  declare const DependabotDependencyFileSchema: z.ZodObject<{
2186
2194
  content: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2187
2195
  content_encoding: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
2196
+ "": "";
2188
2197
  "utf-8": "utf-8";
2189
2198
  base64: "base64";
2190
2199
  }>>>;
@@ -2295,8 +2304,8 @@ declare const DependabotDependencySubmissionSchema: z.ZodObject<{
2295
2304
  indirect: "indirect";
2296
2305
  }>;
2297
2306
  scope: z.ZodEnum<{
2298
- runtime: "runtime";
2299
2307
  development: "development";
2308
+ runtime: "runtime";
2300
2309
  }>;
2301
2310
  dependencies: z.ZodArray<z.ZodObject<{
2302
2311
  name: z.ZodString;
@@ -2357,6 +2366,7 @@ declare const DependabotCreatePullRequestSchema: z.ZodObject<{
2357
2366
  'updated-dependency-files': z.ZodArray<z.ZodObject<{
2358
2367
  content: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2359
2368
  content_encoding: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
2369
+ "": "";
2360
2370
  "utf-8": "utf-8";
2361
2371
  base64: "base64";
2362
2372
  }>>>;
@@ -2392,6 +2402,7 @@ declare const DependabotUpdatePullRequestSchema: z.ZodObject<{
2392
2402
  'updated-dependency-files': z.ZodArray<z.ZodObject<{
2393
2403
  content: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2394
2404
  content_encoding: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
2405
+ "": "";
2395
2406
  "utf-8": "utf-8";
2396
2407
  base64: "base64";
2397
2408
  }>>>;
@@ -2479,6 +2490,12 @@ declare const DependabotEcosystemMetaSchema: z.ZodObject<{
2479
2490
  raw_version: z.ZodString;
2480
2491
  requirement: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
2481
2492
  }, z.core.$strip>>>;
2493
+ language: z.ZodOptional<z.ZodNullable<z.ZodObject<{
2494
+ name: z.ZodString;
2495
+ version: z.ZodString;
2496
+ raw_version: z.ZodString;
2497
+ requirement: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
2498
+ }, z.core.$strip>>>;
2482
2499
  version: z.ZodOptional<z.ZodNullable<z.ZodObject<{
2483
2500
  name: z.ZodString;
2484
2501
  version: z.ZodString;
@@ -2496,6 +2513,12 @@ declare const DependabotRecordEcosystemMetaSchema: z.ZodObject<{
2496
2513
  raw_version: z.ZodString;
2497
2514
  requirement: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
2498
2515
  }, z.core.$strip>>>;
2516
+ language: z.ZodOptional<z.ZodNullable<z.ZodObject<{
2517
+ name: z.ZodString;
2518
+ version: z.ZodString;
2519
+ raw_version: z.ZodString;
2520
+ requirement: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
2521
+ }, z.core.$strip>>>;
2499
2522
  version: z.ZodOptional<z.ZodNullable<z.ZodObject<{
2500
2523
  name: z.ZodString;
2501
2524
  version: z.ZodString;
@@ -2525,4 +2548,4 @@ declare const DependabotMetricSchema: z.ZodObject<{
2525
2548
  type DependabotMetric = z.infer<typeof DependabotMetricSchema>;
2526
2549
  //#endregion
2527
2550
  export { mapSourceFromDependabotConfigToJobConfig as $, DependabotCommitMessage as $t, DependabotRecordUpdateJobWarningSchema as A, DEPENDABOT_DEFAULT_AUTHOR_EMAIL as An, DependabotJobConfig as At, DependabotTokenType as B, DependabotRequirementSource as Bt, DependabotRecordEcosystemVersions as C, parseDependabotConfig as Cn, DependabotExistingPRSchema as Ct, DependabotRecordUpdateJobUnknownError as D, VariableFinderFn as Dn, DependabotGroupJobSchema as Dt, DependabotRecordUpdateJobErrorSchema as E, validateConfiguration as En, DependabotGroupJob as Et, CreateApiServerAppOptions as F, DependabotPackageManagerSchema as Ft, makeRandomJobId as G, DependabotSourceProvider as Gt, DependabotJobBuilder as H, DependabotSecurityAdvisory as Ht, DependabotRequest as I, DependabotProxyConfig as It, mapExperiments as J, FetchedFiles as Jt, mapAllowedUpdatesFromDependabotConfigToJobConfig as K, DependabotSourceProviderSchema as Kt, DependabotRequestSchema as L, DependabotProxyConfigSchema as Lt, DependabotUpdateDependencyListSchema as M, GitAuthor as Mn, DependabotJobFile as Mt, DependabotUpdatePullRequest as N, DependabotJobFileSchema as Nt, DependabotRecordUpdateJobUnknownErrorSchema as O, convertPlaceholder as On, DependabotGroupRuleJob as Ot, DependabotUpdatePullRequestSchema as P, DependabotPackageManager as Pt, mapSecurityAdvisories as Q, DependabotAllowConditionSchema as Qt, DependabotRequestType as R, DependabotRequirement as Rt, DependabotRecordEcosystemMetaSchema as S, VersioningStrategySchema as Sn, DependabotExistingPR as St, DependabotRecordUpdateJobError as T, parseUpdates as Tn, DependabotExperimentsSchema as Tt, DependabotJobBuilderOutput as U, DependabotSecurityAdvisorySchema as Ut, createApiServerApp as V, DependabotRequirementSourceSchema as Vt, DependabotSourceInfo as W, DependabotSource as Wt, mapIgnoreConditionsFromDependabotConfigToJobConfig as X, FileUpdaterInput as Xt, mapGroupsFromDependabotConfigToJobConfig as Y, FileFetcherInput as Yt, mapPackageEcosystemToPackageManager as Z, DependabotAllowCondition as Zt, DependabotMarkAsProcessed as _, DependabotUpdateSchema as _n, DependabotCredentialSchema as _t, DependabotCreatePullRequest as a, DependabotGroup as an, sanitizeRef as at, DependabotMetricSchema as b, PackageEcosystemSchema as bn, DependabotExistingGroupPR as bt, DependabotDependencyFileSchema as c, DependabotIgnoreConditionSchema as cn, DependabotAllowed as ct, DependabotEcosystemMeta as d, DependabotPullRequestBranchName as dn, DependabotCommandSchema as dt, DependabotCommitMessageSchema as en, mapVersionStrategyToRequirementsUpdateStrategy as et, DependabotEcosystemMetaSchema as f, DependabotRegistry as fn, DependabotCommitOptions as ft, DependabotIncrementMetricSchema as g, DependabotUpdate as gn, DependabotCredential as gt, DependabotIncrementMetric as h, DependabotScheduleSchema as hn, DependabotConditionSchema as ht, DependabotClosePullRequestSchema as i, DependabotCooldownSchema as in, getBranchNameForUpdate as it, DependabotUpdateDependencyList as j, DEPENDABOT_DEFAULT_AUTHOR_NAME as jn, DependabotJobConfigSchema as jt, DependabotRecordUpdateJobWarning as k, extractPlaceholder as kn, DependabotGroupRuleJobSchema as kt, DependabotDependencySubmission as l, DependabotMultiEcosystemGroup as ln, DependabotAllowedSchema as lt, DependabotEcosystemVersionManagerSchema as m, DependabotSchedule as mn, DependabotCondition as mt, DependabotClosePullRequestReason as n, DependabotConfigSchema as nn, parseExperiments as nt, DependabotCreatePullRequestSchema as o, DependabotGroupSchema as on, CertificateAuthority as ot, DependabotEcosystemVersionManager as p, DependabotRegistrySchema as pn, DependabotCommitOptionsSchema as pt, mapCredentials as q, DependabotSourceSchema as qt, DependabotClosePullRequestReasonEnum as r, DependabotCooldown as rn, makeDirectoryKey as rt, DependabotDependencyFile as s, DependabotIgnoreCondition as sn, CertificateAuthoritySchema as st, DependabotClosePullRequest as t, DependabotConfig as tn, DEFAULT_EXPERIMENTS as tt, DependabotDependencySubmissionSchema as u, DependabotMultiEcosystemGroupSchema as un, DependabotCommand as ut, DependabotMarkAsProcessedSchema as v, POSSIBLE_CONFIG_FILE_PATHS as vn, DependabotDependency as vt, DependabotRecordEcosystemVersionsSchema as w, parseRegistries as wn, DependabotExperiments as wt, DependabotRecordEcosystemMeta as x, VersioningStrategy as xn, DependabotExistingGroupPRSchema as xt, DependabotMetric as y, PackageEcosystem as yn, DependabotDependencySchema as yt, DependabotRequestTypeSchema as z, DependabotRequirementSchema as zt };
2528
- //# sourceMappingURL=index-B1zTACpP.d.mts.map
2551
+ //# sourceMappingURL=index--PMbsXAm.d.mts.map
package/dist/usage.d.mts CHANGED
@@ -10,7 +10,8 @@ import { z } from "zod";
10
10
  * "platform": "darwin",
11
11
  * "os": "25.0.0",
12
12
  * "arch": "arm64",
13
- * "machine-hash": "d3bbb66be2ad9dfab10af69b450f7e7e814ef7bbf1277a6d0df9e1db44ba4f5c"
13
+ * "machine-hash": "d3bbb66be2ad9dfab10af69b450f7e7e814ef7bbf1277a6d0df9e1db44ba4f5c",
14
+ * "docker-container": false
14
15
  * },
15
16
  * "trigger": "user",
16
17
  * "provider": "azure",
@@ -33,6 +34,7 @@ declare const UsageTelemetryRequestDataSchema: z.ZodObject<{
33
34
  release: z.ZodString;
34
35
  arch: z.ZodString;
35
36
  'machine-hash': z.ZodString;
37
+ 'docker-container': z.ZodOptional<z.ZodBoolean>;
36
38
  }, z.core.$strip>;
37
39
  version: z.ZodString;
38
40
  trigger: z.ZodEnum<{
@@ -92,7 +94,8 @@ declare const UsageTelemetryRequestDataSchema: z.ZodObject<{
92
94
  * "platform": "darwin",
93
95
  * "os": "25.0.0",
94
96
  * "arch": "arm64",
95
- * "machine-hash": "d3bbb66be2ad9dfab10af69b450f7e7e814ef7bbf1277a6d0df9e1db44ba4f5c"
97
+ * "machine-hash": "d3bbb66be2ad9dfab10af69b450f7e7e814ef7bbf1277a6d0df9e1db44ba4f5c",
98
+ * "docker-container": false
96
99
  * },
97
100
  * "trigger": "user",
98
101
  * "provider": "azure",
package/dist/usage.mjs CHANGED
@@ -10,7 +10,8 @@ import { z } from "zod";
10
10
  * "platform": "darwin",
11
11
  * "os": "25.0.0",
12
12
  * "arch": "arm64",
13
- * "machine-hash": "d3bbb66be2ad9dfab10af69b450f7e7e814ef7bbf1277a6d0df9e1db44ba4f5c"
13
+ * "machine-hash": "d3bbb66be2ad9dfab10af69b450f7e7e814ef7bbf1277a6d0df9e1db44ba4f5c",
14
+ * "docker-container": false
14
15
  * },
15
16
  * "trigger": "user",
16
17
  * "provider": "azure",
@@ -32,7 +33,8 @@ const UsageTelemetryRequestDataSchema = z.object({
32
33
  platform: z.string().max(50),
33
34
  release: z.string().max(100),
34
35
  arch: z.string().max(50),
35
- "machine-hash": z.string().max(250)
36
+ "machine-hash": z.string().max(250),
37
+ "docker-container": z.boolean().optional()
36
38
  }),
37
39
  version: z.string().max(50),
38
40
  trigger: z.enum(["user", "service"]),
@@ -1 +1 @@
1
- {"version":3,"file":"usage.mjs","names":[],"sources":["../src/usage.ts"],"sourcesContent":["import { z } from 'zod';\nimport { DependabotPackageManagerSchema, DependabotSourceProviderSchema } from '@/dependabot/job';\n\n/**\n * @example\n * ```json\n * {\n * \"host\": {\n * \"platform\": \"darwin\",\n * \"os\": \"25.0.0\",\n * \"arch\": \"arm64\",\n * \"machine-hash\": \"d3bbb66be2ad9dfab10af69b450f7e7e814ef7bbf1277a6d0df9e1db44ba4f5c\"\n * },\n * \"trigger\": \"user\",\n * \"provider\": \"azure\",\n * \"owner\": \"https://dev.azure.com/tingle/\",\n * \"package-manager\": \"terraform\",\n * \"version\": \"0.9.0\",\n * \"id\": 2850677077,\n * \"started\": \"2025-10-03T14:44:00.191Z\",\n * \"duration\": 31812,\n * \"success\": true,\n * \"error\": {\n * \"message\": \"An error occurred\"\n * }\n * }\n * ```\n */\nexport const UsageTelemetryRequestDataSchema = z.object({\n host: z.object({\n platform: z.string().max(50), // e.g. linux, darwin, win32\n release: z.string().max(100), // e.g. 26.0.0, 10.0.19043\n arch: z.string().max(50), // e.g. x64, arm64\n 'machine-hash': z.string().max(250), // e.g. \"d3bbb66be2ad9dfab10af69b450f7e7e814ef7bbf1277a6d0df9e1db44ba4f5c\" for \"Maxwells-MacBook-Pro.local\"\n }),\n version: z.string().max(50),\n trigger: z.enum(['user', 'service']),\n provider: DependabotSourceProviderSchema,\n owner: z.url(),\n project: z.url().optional(), // was added later hence optional for backward compatibility\n 'package-manager': DependabotPackageManagerSchema,\n id: z.string(), // job identifier, for correlation\n started: z.coerce.date(),\n duration: z.number().min(0), // in milliseconds\n success: z.boolean(),\n error: z.object({ message: z.string() }).optional(),\n});\n\n/**\n * @example\n * ```json\n * {\n * \"host\": {\n * \"platform\": \"darwin\",\n * \"os\": \"25.0.0\",\n * \"arch\": \"arm64\",\n * \"machine-hash\": \"d3bbb66be2ad9dfab10af69b450f7e7e814ef7bbf1277a6d0df9e1db44ba4f5c\"\n * },\n * \"trigger\": \"user\",\n * \"provider\": \"azure\",\n * \"owner\": \"https://dev.azure.com/tingle/\",\n * \"package-manager\": \"terraform\",\n * \"version\": \"0.9.0\",\n * \"id\": 2850677077,\n * \"started\": \"2025-10-03T14:44:00.191Z\",\n * \"duration\": 31812,\n * \"success\": true\n * }\n * ```\n */\nexport type UsageTelemetryRequestData = z.infer<typeof UsageTelemetryRequestDataSchema>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAa,kCAAkC,EAAE,OAAO;CACtD,MAAM,EAAE,OAAO;EACb,UAAU,EAAE,QAAQ,CAAC,IAAI,GAAG;EAC5B,SAAS,EAAE,QAAQ,CAAC,IAAI,IAAI;EAC5B,MAAM,EAAE,QAAQ,CAAC,IAAI,GAAG;EACxB,gBAAgB,EAAE,QAAQ,CAAC,IAAI,IAAI;EACpC,CAAC;CACF,SAAS,EAAE,QAAQ,CAAC,IAAI,GAAG;CAC3B,SAAS,EAAE,KAAK,CAAC,QAAQ,UAAU,CAAC;CACpC,UAAU;CACV,OAAO,EAAE,KAAK;CACd,SAAS,EAAE,KAAK,CAAC,UAAU;CAC3B,mBAAmB;CACnB,IAAI,EAAE,QAAQ;CACd,SAAS,EAAE,OAAO,MAAM;CACxB,UAAU,EAAE,QAAQ,CAAC,IAAI,EAAE;CAC3B,SAAS,EAAE,SAAS;CACpB,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC,UAAU;CACpD,CAAC"}
1
+ {"version":3,"file":"usage.mjs","names":[],"sources":["../src/usage.ts"],"sourcesContent":["import { z } from 'zod';\nimport { DependabotPackageManagerSchema, DependabotSourceProviderSchema } from '@/dependabot/job';\n\n/**\n * @example\n * ```json\n * {\n * \"host\": {\n * \"platform\": \"darwin\",\n * \"os\": \"25.0.0\",\n * \"arch\": \"arm64\",\n * \"machine-hash\": \"d3bbb66be2ad9dfab10af69b450f7e7e814ef7bbf1277a6d0df9e1db44ba4f5c\",\n * \"docker-container\": false\n * },\n * \"trigger\": \"user\",\n * \"provider\": \"azure\",\n * \"owner\": \"https://dev.azure.com/tingle/\",\n * \"package-manager\": \"terraform\",\n * \"version\": \"0.9.0\",\n * \"id\": 2850677077,\n * \"started\": \"2025-10-03T14:44:00.191Z\",\n * \"duration\": 31812,\n * \"success\": true,\n * \"error\": {\n * \"message\": \"An error occurred\"\n * }\n * }\n * ```\n */\nexport const UsageTelemetryRequestDataSchema = z.object({\n host: z.object({\n platform: z.string().max(50), // e.g. linux, darwin, win32\n release: z.string().max(100), // e.g. 26.0.0, 10.0.19043\n arch: z.string().max(50), // e.g. x64, arm64\n 'machine-hash': z.string().max(250), // e.g. \"d3bbb66be2ad9dfab10af69b450f7e7e814ef7bbf1277a6d0df9e1db44ba4f5c\" for \"Maxwells-MacBook-Pro.local\"\n 'docker-container': z.boolean().optional(), // whether running inside a Docker container\n }),\n version: z.string().max(50),\n trigger: z.enum(['user', 'service']),\n provider: DependabotSourceProviderSchema,\n owner: z.url(),\n project: z.url().optional(), // was added later hence optional for backward compatibility\n 'package-manager': DependabotPackageManagerSchema,\n id: z.string(), // job identifier, for correlation\n started: z.coerce.date(),\n duration: z.number().min(0), // in milliseconds\n success: z.boolean(),\n error: z.object({ message: z.string() }).optional(),\n});\n\n/**\n * @example\n * ```json\n * {\n * \"host\": {\n * \"platform\": \"darwin\",\n * \"os\": \"25.0.0\",\n * \"arch\": \"arm64\",\n * \"machine-hash\": \"d3bbb66be2ad9dfab10af69b450f7e7e814ef7bbf1277a6d0df9e1db44ba4f5c\",\n * \"docker-container\": false\n * },\n * \"trigger\": \"user\",\n * \"provider\": \"azure\",\n * \"owner\": \"https://dev.azure.com/tingle/\",\n * \"package-manager\": \"terraform\",\n * \"version\": \"0.9.0\",\n * \"id\": 2850677077,\n * \"started\": \"2025-10-03T14:44:00.191Z\",\n * \"duration\": 31812,\n * \"success\": true\n * }\n * ```\n */\nexport type UsageTelemetryRequestData = z.infer<typeof UsageTelemetryRequestDataSchema>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAa,kCAAkC,EAAE,OAAO;CACtD,MAAM,EAAE,OAAO;EACb,UAAU,EAAE,QAAQ,CAAC,IAAI,GAAG;EAC5B,SAAS,EAAE,QAAQ,CAAC,IAAI,IAAI;EAC5B,MAAM,EAAE,QAAQ,CAAC,IAAI,GAAG;EACxB,gBAAgB,EAAE,QAAQ,CAAC,IAAI,IAAI;EACnC,oBAAoB,EAAE,SAAS,CAAC,UAAU;EAC3C,CAAC;CACF,SAAS,EAAE,QAAQ,CAAC,IAAI,GAAG;CAC3B,SAAS,EAAE,KAAK,CAAC,QAAQ,UAAU,CAAC;CACpC,UAAU;CACV,OAAO,EAAE,KAAK;CACd,SAAS,EAAE,KAAK,CAAC,UAAU;CAC3B,mBAAmB;CACnB,IAAI,EAAE,QAAQ;CACd,SAAS,EAAE,OAAO,MAAM;CACxB,UAAU,EAAE,QAAQ,CAAC,IAAI,EAAE;CAC3B,SAAS,EAAE,SAAS;CACpB,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC,UAAU;CACpD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paklo/core",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "sideEffects": false,
5
5
  "type": "module",
6
6
  "author": "mburumaxwell",
@@ -1 +0,0 @@
1
- {"version":3,"file":"dependabot-BM3oAx2C.mjs","names":["branchName: string","crypto","DEFAULT_EXPERIMENTS: DependabotExperiments","updatingPullRequest: boolean","updateDependencyGroupName: string | null","updateDependencyNames: string[] | null","vulnerabilities: SecurityVulnerability[] | undefined","success: boolean"],"sources":["../src/dependabot/author.ts","../src/dependabot/branch-name.ts","../src/dependabot/experiments.ts","../src/dependabot/job-builder.ts","../src/dependabot/update.ts","../src/dependabot/server.ts"],"sourcesContent":["export type GitAuthor = {\n name: string;\n email: string;\n};\n\nexport const DEPENDABOT_DEFAULT_AUTHOR_EMAIL = 'noreply@github.com';\nexport const DEPENDABOT_DEFAULT_AUTHOR_NAME = 'dependabot[bot]';\n","import * as crypto from 'node:crypto';\nimport type { PackageEcosystem } from './config';\nimport type { DependabotExistingPR } from './job';\n\n// TODO: figure out how to handle IDENTIFIER field (in a group) in branch naming\n// Docs: https://docs.github.com/en/code-security/dependabot/working-with-dependabot/dependabot-options-reference#groups--\n// -> An identifier for a group is used in branch names and pull request titles.\n\nexport function getBranchNameForUpdate(\n packageEcosystem: PackageEcosystem,\n targetBranchName: string | undefined,\n directory: string | undefined,\n dependencyGroupName: string | undefined,\n dependencies: DependabotExistingPR[],\n separator: string = '/',\n): string {\n // Based on dependabot-core implementation:\n // https://github.com/dependabot/dependabot-core/blob/main/common/lib/dependabot/pull_request_creator/branch_namer/solo_strategy.rb\n // https://github.com/dependabot/dependabot-core/blob/main/common/lib/dependabot/pull_request_creator/branch_namer/dependency_group_strategy.rb\n let branchName: string;\n const branchNameMightBeTooLong = dependencyGroupName || dependencies.length > 1;\n if (branchNameMightBeTooLong) {\n // Group/multi dependency update\n // e.g. dependabot/nuget/main/microsoft-3b49c54d9e\n const dependencyDigest = crypto\n .createHash('md5')\n .update(dependencies.map((d) => `${d['dependency-name']}-${d['dependency-version']}`).join(','))\n .digest('hex')\n .substring(0, 10);\n branchName = `${dependencyGroupName || 'multi'}-${dependencyDigest}`;\n } else {\n // Single dependency update\n // e.g. dependabot/nuget/main/Microsoft.Extensions.Logging-1.0.0\n const dependencyNames = dependencies\n .map((d) => d['dependency-name'])\n .join('-and-')\n .replace(/[:[]]/g, '-') // Replace `:` and `[]` with `-`\n .replace(/@/g, ''); // Remove `@`\n const versionSuffix = dependencies[0]?.removed ? 'removed' : dependencies[0]?.['dependency-version'];\n branchName = `${dependencyNames}-${versionSuffix}`;\n }\n\n return sanitizeRef(\n [\n 'dependabot',\n packageEcosystem,\n targetBranchName,\n // normalize directory to remove leading/trailing slashes and replace remaining ones with the separator\n directory\n ? directory\n .split('/')\n .filter((part) => part.length > 0)\n .join(separator)\n : undefined,\n branchName,\n ],\n separator,\n );\n}\n\nexport function sanitizeRef(refParts: (string | undefined)[], separator: string): string {\n // Based on dependabot-core implementation:\n // https://github.com/dependabot/dependabot-core/blob/fc31ae64f492dc977cfe6773ab13fb6373aabec4/common/lib/dependabot/pull_request_creator/branch_namer/base.rb#L99\n\n // This isn't a complete implementation of git's ref validation, but it\n // covers most cases that crop up. Its list of allowed characters is a\n // bit stricter than git's, but that's for cosmetic reasons.\n return (\n refParts\n // Join the parts with the separator, ignore empty parts\n .filter((p) => p && p.trim().length > 0)\n .join(separator)\n // Remove forbidden characters (those not already replaced elsewhere)\n .replace(/[^A-Za-z0-9/\\-_.(){}]/g, '')\n // Slashes can't be followed by periods\n .replace(/\\/\\./g, '/dot-')\n // Squeeze out consecutive periods and slashes\n .replace(/\\.+/g, '.')\n .replace(/\\/+/g, '/')\n // Trailing periods are forbidden\n .replace(/\\.$/, '')\n );\n}\n","import type { DependabotExperiments } from './job';\n\n// The default experiments known to be used by the GitHub Dependabot service.\n// This changes often, update as needed by extracting them from a Dependabot GitHub Action run.\n// e.g. https://github.com/mburumaxwell/dependabot-azure-devops/actions/workflows/dependabot/dependabot-updates\nexport const DEFAULT_EXPERIMENTS: DependabotExperiments = {\n 'record-ecosystem-versions': true,\n 'record-update-job-unknown-error': true,\n 'proxy-cached': true,\n 'dependency-change-validation': true,\n 'enable-file-parser-python-local': true,\n 'npm-fallback-version-above-v6': true,\n 'enable-record-ecosystem-meta': true,\n 'enable-corepack-for-npm-and-yarn': true,\n 'enable-shared-helpers-command-timeout': true,\n 'enable-dependabot-setting-up-cronjob': true,\n 'enable-engine-version-detection': true,\n 'avoid-duplicate-updates-package-json': true,\n 'allow-refresh-for-existing-pr-dependencies': true,\n 'allow-refresh-group-with-all-dependencies': true,\n 'exclude-local-composer-packages': true,\n 'enable-enhanced-error-details-for-updater': true,\n 'gradle-lockfile-updater': true,\n 'enable-exclude-paths-subdirectory-manifest-files': true,\n 'group-membership-enforcement': true,\n 'deprecate-close-command': true,\n 'deprecate-reopen-command': true,\n 'deprecate-merge-command': true,\n 'deprecate-cancel-merge-command': true,\n 'deprecate-squash-merge-command': true,\n};\n\n/**\n * Parses a comma-separated list of key=value pairs representing experiments.\n * @param raw A comma-separated list of key=value pairs representing experiments.\n * @returns A map of experiment names to their values.\n */\nexport function parseExperiments(raw?: string): DependabotExperiments | undefined {\n return raw\n ?.split(',')\n .filter((entry) => entry.trim() !== '') // <-- filter out empty entries\n .reduce((acc, cur) => {\n const [key, value] = cur.split('=', 2);\n acc[key!] = value || true;\n return acc;\n }, {} as DependabotExperiments);\n}\n","import type { SecurityVulnerability } from '@/github';\nimport type {\n DependabotAllowCondition,\n DependabotConfig,\n DependabotGroup,\n DependabotIgnoreCondition,\n DependabotRegistry,\n DependabotUpdate,\n PackageEcosystem,\n VersioningStrategy,\n} from './config';\nimport type {\n DependabotAllowed,\n DependabotCondition,\n DependabotCredential,\n DependabotExistingGroupPR,\n DependabotExistingPR,\n DependabotExperiments,\n DependabotGroupJob,\n DependabotJobConfig,\n DependabotPackageManager,\n DependabotSecurityAdvisory,\n DependabotSource,\n DependabotSourceProvider,\n} from './job';\n\nexport type DependabotSourceInfo = {\n provider: DependabotSourceProvider;\n hostname: string;\n 'api-endpoint': string;\n 'repository-slug': string;\n};\n\nexport type DependabotJobBuilderOutput = {\n job: DependabotJobConfig;\n credentials: DependabotCredential[];\n};\n\n/**\n * Class for building dependabot job objects\n */\nexport class DependabotJobBuilder {\n private readonly config: DependabotConfig;\n private readonly update: DependabotUpdate;\n private readonly experiments: DependabotExperiments;\n private readonly debug: boolean;\n\n private readonly packageManager: DependabotPackageManager;\n private readonly source: DependabotSource;\n private readonly credentials: DependabotCredential[];\n\n constructor({\n source,\n config,\n update,\n systemAccessUser,\n systemAccessToken,\n githubToken,\n experiments,\n debug,\n }: {\n source: DependabotSourceInfo;\n config: DependabotConfig;\n update: DependabotUpdate;\n experiments: DependabotExperiments;\n systemAccessUser?: string;\n systemAccessToken?: string;\n githubToken?: string;\n /** Determines if verbose log messages are logged */\n debug: boolean;\n }) {\n this.config = config;\n this.update = update;\n this.experiments = experiments;\n this.debug = debug;\n\n this.packageManager = mapPackageEcosystemToPackageManager(update['package-ecosystem']);\n this.source = mapSourceFromDependabotConfigToJobConfig(source, update);\n this.credentials = mapCredentials({\n sourceHostname: source.hostname,\n systemAccessUser,\n systemAccessToken,\n githubToken,\n registries: config.registries,\n });\n }\n\n /**\n * Create a dependabot update job that updates nothing, but will discover the dependency list for a package ecosystem\n */\n public forDependenciesList({\n id,\n command,\n }: {\n id?: string;\n command: DependabotJobConfig['command'];\n }): DependabotJobBuilderOutput {\n id ??= makeRandomJobId();\n return {\n job: {\n id: id,\n command: command,\n 'package-manager': this.packageManager,\n 'updating-a-pull-request': false,\n dependencies: null,\n 'allowed-updates': [{ 'dependency-type': 'direct', 'update-type': 'all' }],\n 'ignore-conditions': [{ 'dependency-name': '*' }],\n 'security-updates-only': false,\n 'security-advisories': [],\n source: this.source,\n 'update-subdependencies': false,\n 'existing-pull-requests': [],\n 'existing-group-pull-requests': [],\n experiments: this.experiments,\n 'requirements-update-strategy': null,\n 'lockfile-only': false,\n 'commit-message-options': {\n prefix: null,\n 'prefix-development': null,\n 'include-scope': null,\n },\n 'vendor-dependencies': false,\n 'repo-private': true,\n debug: this.debug,\n },\n credentials: this.credentials,\n };\n }\n\n /**\n * Create a dependabot update job that updates all dependencies for a package ecosystem\n */\n public forUpdate({\n id,\n command,\n dependencyNamesToUpdate,\n existingPullRequests,\n pullRequestToUpdate,\n securityVulnerabilities,\n }: {\n id?: string;\n command: DependabotJobConfig['command'];\n dependencyNamesToUpdate?: string[];\n existingPullRequests: (DependabotExistingPR[] | DependabotExistingGroupPR)[];\n pullRequestToUpdate?: DependabotExistingPR[] | DependabotExistingGroupPR;\n securityVulnerabilities?: SecurityVulnerability[];\n }): DependabotJobBuilderOutput {\n id ??= makeRandomJobId();\n const securityOnlyUpdate = this.update['open-pull-requests-limit'] === 0;\n\n let updatingPullRequest: boolean;\n let updateDependencyGroupName: string | null = null;\n let updateDependencyNames: string[] | null;\n let vulnerabilities: SecurityVulnerability[] | undefined;\n\n if (pullRequestToUpdate) {\n updatingPullRequest = true;\n updateDependencyGroupName = Array.isArray(pullRequestToUpdate)\n ? null\n : pullRequestToUpdate['dependency-group-name'];\n updateDependencyNames = (\n Array.isArray(pullRequestToUpdate) ? pullRequestToUpdate : pullRequestToUpdate.dependencies\n )?.map((d) => d['dependency-name']);\n vulnerabilities = securityVulnerabilities?.filter((v) => updateDependencyNames?.includes(v.package.name));\n } else {\n updatingPullRequest = false;\n const names = dependencyNamesToUpdate?.length ? dependencyNamesToUpdate : null;\n updateDependencyNames =\n securityOnlyUpdate && names\n ? names?.filter((d) => securityVulnerabilities?.find((v) => v.package.name === d))\n : names;\n vulnerabilities = securityVulnerabilities;\n }\n\n return {\n job: {\n id: id,\n command: command,\n 'package-manager': this.packageManager,\n 'updating-a-pull-request': updatingPullRequest || false,\n 'dependency-group-to-refresh': updateDependencyGroupName,\n 'dependency-groups': mapGroupsFromDependabotConfigToJobConfig(this.update.groups),\n dependencies: updateDependencyNames,\n 'allowed-updates': mapAllowedUpdatesFromDependabotConfigToJobConfig(this.update.allow, securityOnlyUpdate),\n 'ignore-conditions': mapIgnoreConditionsFromDependabotConfigToJobConfig(this.update.ignore),\n 'security-updates-only': securityOnlyUpdate,\n 'security-advisories': mapSecurityAdvisories(vulnerabilities),\n source: this.source,\n 'update-subdependencies': false,\n 'existing-pull-requests': existingPullRequests.filter((pr) => Array.isArray(pr)),\n 'existing-group-pull-requests': existingPullRequests.filter(\n (pr): pr is DependabotExistingGroupPR => !Array.isArray(pr),\n ),\n 'commit-message-options': {\n prefix: this.update['commit-message']?.prefix ?? null,\n 'prefix-development': this.update['commit-message']?.['prefix-development'] ?? null,\n 'include-scope':\n this.update['commit-message']?.include?.toLocaleLowerCase()?.trim() === 'scope' ? true : null,\n },\n cooldown: this.update.cooldown,\n experiments: mapExperiments(this.experiments),\n 'reject-external-code':\n this.update['insecure-external-code-execution']?.toLocaleLowerCase()?.trim() === 'allow',\n 'requirements-update-strategy': mapVersionStrategyToRequirementsUpdateStrategy(\n this.update['versioning-strategy'],\n ),\n 'lockfile-only': this.update['versioning-strategy'] === 'lockfile-only',\n 'vendor-dependencies': this.update.vendor ?? false,\n 'repo-private': true,\n debug: this.debug,\n 'proxy-log-response-body-on-auth-failure': true,\n 'max-updater-run-time': 2700,\n 'enable-beta-ecosystems': this.config['enable-beta-ecosystems'] || false,\n // Updates across ecosystems is still in development\n // See https://github.com/dependabot/dependabot-core/issues/8126\n // https://github.com/dependabot/dependabot-core/pull/12339\n // It needs to merged in the core repo first before we support it\n // However, to match current job configs and to prevent surprises, we disable it\n 'multi-ecosystem-update': false,\n 'exclude-paths': this.update['exclude-paths'],\n },\n credentials: this.credentials,\n };\n }\n}\n\nexport function mapPackageEcosystemToPackageManager(ecosystem: PackageEcosystem): DependabotPackageManager {\n // Map the dependabot config \"package ecosystem\" to the equivalent dependabot-core/cli \"package manager\".\n // Config values: https://docs.github.com/en/code-security/dependabot/working-with-dependabot/dependabot-options-reference#package-ecosystem-\n // Core/CLI values: https://github.com/dependabot/dependabot-core/blob/main/common/lib/dependabot/config/file.rb#L60-L81\n switch (ecosystem) {\n case 'docker-compose':\n return 'docker_compose';\n case 'dotnet-sdk':\n return 'dotnet_sdk';\n case 'github-actions':\n return 'github_actions';\n case 'gitsubmodule':\n return 'submodules';\n case 'gomod':\n return 'go_modules';\n case 'mix':\n return 'hex';\n case 'npm':\n return 'npm_and_yarn';\n // Additional aliases, sometimes used for convenience\n case 'pipenv':\n return 'pip';\n case 'pip-compile':\n return 'pip';\n case 'poetry':\n return 'pip';\n case 'pnpm':\n return 'npm_and_yarn';\n case 'rust-toolchain':\n return 'rust_toolchain';\n case 'yarn':\n return 'npm_and_yarn';\n default:\n return ecosystem;\n }\n}\n\nexport function mapSourceFromDependabotConfigToJobConfig(\n source: DependabotSourceInfo,\n update: DependabotUpdate,\n): DependabotSource {\n return {\n provider: source.provider,\n 'api-endpoint': source['api-endpoint'],\n hostname: source.hostname,\n repo: source['repository-slug'],\n branch: update['target-branch'],\n commit: null, // use latest commit of target branch\n directory: update.directory,\n directories: update.directories,\n };\n}\n\nexport function mapVersionStrategyToRequirementsUpdateStrategy(strategy?: VersioningStrategy): string | null {\n if (!strategy) return null;\n switch (strategy) {\n case 'auto':\n return null;\n case 'increase':\n return 'bump_versions';\n case 'increase-if-necessary':\n return 'bump_versions_if_necessary';\n case 'lockfile-only':\n return 'lockfile_only';\n case 'widen':\n return 'widen_ranges';\n default:\n throw new Error(`Invalid dependabot.yaml versioning strategy option '${strategy}'`);\n }\n}\n\nexport function mapGroupsFromDependabotConfigToJobConfig(\n dependencyGroups?: Record<string, DependabotGroup | null>,\n): DependabotGroupJob[] {\n if (!dependencyGroups || !Object.keys(dependencyGroups).length) return [];\n return Object.keys(dependencyGroups)\n .filter((name) => dependencyGroups[name])\n .map((name) => {\n const group = dependencyGroups[name]!;\n return {\n name: name,\n 'applies-to': group['applies-to'],\n rules: {\n patterns: group.patterns?.length ? group.patterns : ['*'],\n 'exclude-patterns': group['exclude-patterns'],\n 'dependency-type': group['dependency-type'],\n 'update-types': group['update-types'],\n },\n } satisfies DependabotGroupJob;\n });\n}\n\nexport function mapAllowedUpdatesFromDependabotConfigToJobConfig(\n allowedUpdates?: DependabotAllowCondition[],\n securityOnlyUpdate?: boolean,\n): DependabotAllowed[] {\n // If no allow conditions are specified, update direct dependencies by default; This is what GitHub does.\n // NOTE: 'update-type' appears to be a deprecated config, but still appears in the dependabot-core model and GitHub Dependabot job logs.\n // See: https://github.com/dependabot/dependabot-core/blob/b3a0c1f86c20729494097ebc695067099f5b4ada/updater/lib/dependabot/job.rb#L253C1-L257C78\n if (!allowedUpdates) {\n return [\n {\n 'dependency-type': 'direct',\n 'update-type': securityOnlyUpdate ? 'security' : 'all',\n },\n ];\n }\n return allowedUpdates.map((allow) => {\n return {\n 'dependency-name': allow['dependency-name'],\n 'dependency-type': allow['dependency-type'],\n 'update-type': allow['update-type'],\n };\n });\n}\n\nexport function mapIgnoreConditionsFromDependabotConfigToJobConfig(\n ignoreConditions?: DependabotIgnoreCondition[],\n): DependabotCondition[] {\n if (!ignoreConditions) return [];\n return ignoreConditions.map((ignore) => {\n return {\n source: ignore.source,\n 'updated-at': ignore['updated-at'],\n 'dependency-name': ignore['dependency-name'] ?? '*',\n 'update-types': ignore['update-types'],\n\n // The dependabot.yml config docs are not very clear about acceptable values; after scanning dependabot-core and dependabot-cli,\n // this could either be a single version string (e.g. '>1.0.0'), or multiple version strings separated by commas (e.g. '>1.0.0, <2.0.0')\n 'version-requirement': Array.isArray(ignore.versions) ? (<string[]>ignore.versions)?.join(', ') : ignore.versions,\n } satisfies DependabotCondition;\n });\n}\n\nexport function mapExperiments(experiments?: DependabotExperiments): DependabotExperiments {\n experiments ??= {};\n return Object.keys(experiments).reduce((acc, key) => {\n // Experiment values are known to be either 'true', 'false', or a string value.\n // If the value is 'true' or 'false', convert it to a boolean type so that dependabot-core handles it correctly.\n const value = experiments[key];\n if (typeof value === 'string' && value?.toLocaleLowerCase() === 'true') {\n acc[key] = true;\n } else if (typeof value === 'string' && value?.toLocaleLowerCase() === 'false') {\n acc[key] = false;\n } else {\n if (typeof value === 'string' || typeof value === 'boolean') acc[key] = value;\n }\n return acc;\n }, {} as DependabotExperiments);\n}\n\nexport function mapSecurityAdvisories(securityVulnerabilities?: SecurityVulnerability[]): DependabotSecurityAdvisory[] {\n if (!securityVulnerabilities) return [];\n\n // A single security advisory can cause a vulnerability in multiple versions of a package.\n // We need to map each unique security advisory to a list of affected-versions and patched-versions.\n const vulnerabilitiesGroupedByPackageNameAndAdvisoryId = new Map<string, SecurityVulnerability[]>();\n for (const vuln of securityVulnerabilities) {\n const key = `${vuln.package.name}/${vuln.advisory.identifiers.map((i) => `${i.type}:${i.value}`).join('/')}`;\n if (!vulnerabilitiesGroupedByPackageNameAndAdvisoryId.has(key)) {\n vulnerabilitiesGroupedByPackageNameAndAdvisoryId.set(key, []);\n }\n vulnerabilitiesGroupedByPackageNameAndAdvisoryId.get(key)!.push(vuln);\n }\n return Array.from(vulnerabilitiesGroupedByPackageNameAndAdvisoryId.values()).map((vulns) => {\n return {\n 'dependency-name': vulns[0]!.package.name,\n 'affected-versions': vulns.map((v) => v.vulnerableVersionRange).filter((v) => v && v.length > 0),\n 'patched-versions': vulns\n .map((v) => v.firstPatchedVersion?.identifier)\n .filter((v) => v && v.length > 0)\n .map((v) => v!),\n 'unaffected-versions': [],\n } satisfies DependabotSecurityAdvisory;\n });\n}\n\nexport function mapCredentials({\n sourceHostname,\n systemAccessUser,\n systemAccessToken,\n githubToken,\n registries,\n}: {\n sourceHostname: string;\n systemAccessUser?: string;\n systemAccessToken?: string;\n githubToken?: string;\n registries?: Record<string, DependabotRegistry>;\n}): DependabotCredential[] {\n const credentials = [];\n\n // Required to authenticate with the git repository when cloning the source code\n if (systemAccessToken) {\n credentials.push({\n type: 'git_source',\n host: sourceHostname,\n username: (systemAccessUser ?? '').trim()?.length > 0 ? systemAccessUser : 'x-access-token',\n password: systemAccessToken,\n });\n }\n\n // Required to avoid rate-limiting errors when generating pull request descriptions (e.g. fetching release notes, commit messages, etc)\n if (githubToken) {\n credentials.push({\n type: 'git_source',\n host: 'github.com',\n username: 'x-access-token',\n password: githubToken,\n });\n }\n if (registries) {\n // TODO: only registries for the current update should be set\n // Required to authenticate with private package feeds when finding the latest version of dependencies.\n // The registries have already been worked on (see parseRegistries) so there is no need to do anything else.\n credentials.push(...Object.values(registries));\n }\n\n return credentials;\n}\n\nexport function makeRandomJobId(): string {\n const array = new Uint32Array(1);\n crypto.getRandomValues(array);\n return `${array[0]! % 10000000000}`; // Limit to 10 digits to match GitHub's job IDs\n}\n","import { z } from 'zod';\nimport { DependabotDependencySchema, DependabotPackageManagerSchema } from './job';\n\n// we use nullish() because it does optional() and allows the value to be set to null\n\nexport const DependabotDependencyFileSchema = z.object({\n // https://github.com/dependabot/dependabot-core/blob/5e2711f9913cc387acb7cb0d29d51fb52d235ef2/common/lib/dependabot/dependency_file.rb#L14-L15\n content: z.string().nullish(),\n content_encoding: z.enum(['utf-8', 'base64']).nullish(),\n deleted: z.boolean().nullish(),\n directory: z.string(),\n name: z.string(),\n operation: z.enum(['update', 'create', 'delete']),\n support_file: z.boolean().nullish(),\n vendored_file: z.boolean().nullish(),\n symlink_target: z.string().nullish(),\n type: z.string().nullish(),\n mode: z\n .enum({\n executable: '100755',\n file: '100644',\n directory: '040000',\n submodule: '160000',\n symlink: '120000',\n })\n .or(z.string())\n .nullish(),\n});\nexport type DependabotDependencyFile = z.infer<typeof DependabotDependencyFileSchema>;\n\nexport const DependabotUpdateDependencyListSchema = z.object({\n dependencies: DependabotDependencySchema.array(),\n dependency_files: z.string().array().nullish(),\n});\nexport type DependabotUpdateDependencyList = z.infer<typeof DependabotUpdateDependencyListSchema>;\n\nexport const DependabotDependencySubmissionSchema = z.object({\n version: z.number(),\n sha: z.string(),\n ref: z.string(),\n job: z.object({\n correlator: z.string(),\n id: z.string(),\n }),\n detector: z.object({\n name: z.string(),\n version: z.string(),\n url: z.string(),\n }),\n manifests: z.object({\n name: z.string().nullish(),\n file: z.object({ source_location: z.string() }).nullish(),\n metadata: z.object({ ecosystem: DependabotPackageManagerSchema }).nullish(),\n resolved: z\n .object({\n package_url: z.string(),\n relationship: z.enum(['direct', 'indirect']),\n scope: z.enum(['runtime', 'development']),\n dependencies: DependabotDependencySchema.array(),\n })\n .nullish(),\n }),\n});\nexport type DependabotDependencySubmission = z.infer<typeof DependabotDependencySubmissionSchema>;\n\nexport const DependabotCreatePullRequestSchema = z.object({\n 'base-commit-sha': z.string(),\n dependencies: DependabotDependencySchema.array(),\n 'updated-dependency-files': DependabotDependencyFileSchema.array(),\n 'pr-title': z.string(),\n 'pr-body': z.string().nullish(),\n 'commit-message': z.string(),\n 'dependency-group': z.record(z.string(), z.any()).nullish(),\n});\nexport type DependabotCreatePullRequest = z.infer<typeof DependabotCreatePullRequestSchema>;\n\nexport const DependabotUpdatePullRequestSchema = z.object({\n 'base-commit-sha': z.string(),\n 'dependency-names': z.string().array(),\n 'updated-dependency-files': DependabotDependencyFileSchema.array(),\n 'pr-title': z.string().nullish(), // this is usually excluded when working with dependabot-cli and an empty string if the API\n 'pr-body': z.string().nullish(), // this is usually excluded when working with dependabot-cli and an empty string if the API\n 'commit-message': z.string().nullish(), // this is usually excluded when working with dependabot-cli and an empty string if the API\n 'dependency-group': z.record(z.string(), z.any()).nullish(),\n});\nexport type DependabotUpdatePullRequest = z.infer<typeof DependabotUpdatePullRequestSchema>;\n\nexport const DependabotClosePullRequestReasonEnum = z.enum([\n 'dependencies_changed',\n 'dependency_group_empty',\n 'dependency_removed',\n 'up_to_date',\n 'update_no_longer_possible',\n]);\nexport type DependabotClosePullRequestReason = z.infer<typeof DependabotClosePullRequestReasonEnum>;\nexport const DependabotClosePullRequestSchema = z.object({\n 'dependency-names': z.string().array(),\n reason: DependabotClosePullRequestReasonEnum.nullish(),\n});\nexport type DependabotClosePullRequest = z.infer<typeof DependabotClosePullRequestSchema>;\n\nexport const DependabotMarkAsProcessedSchema = z.object({\n 'base-commit-sha': z.string().nullish(),\n});\nexport type DependabotMarkAsProcessed = z.infer<typeof DependabotMarkAsProcessedSchema>;\n\nexport const DependabotRecordUpdateJobErrorSchema = z.object({\n 'error-type': z.string(),\n 'error-details': z.record(z.string(), z.any()).nullish(),\n});\nexport type DependabotRecordUpdateJobError = z.infer<typeof DependabotRecordUpdateJobErrorSchema>;\n\nexport const DependabotRecordUpdateJobWarningSchema = z.object({\n 'warn-type': z.string(),\n 'warn-title': z.string(),\n 'warn-description': z.string(),\n});\nexport type DependabotRecordUpdateJobWarning = z.infer<typeof DependabotRecordUpdateJobWarningSchema>;\n\nexport const DependabotRecordUpdateJobUnknownErrorSchema = z.object({\n 'error-type': z.string(),\n 'error-details': z.record(z.string(), z.any()).nullish(),\n});\nexport type DependabotRecordUpdateJobUnknownError = z.infer<typeof DependabotRecordUpdateJobUnknownErrorSchema>;\n\nexport const DependabotRecordEcosystemVersionsSchema = z.object({\n ecosystem_versions: z.record(z.string(), z.any()).nullish(),\n});\nexport type DependabotRecordEcosystemVersions = z.infer<typeof DependabotRecordEcosystemVersionsSchema>;\n\nexport const DependabotEcosystemVersionManagerSchema = z.object({\n name: z.string(),\n version: z.string(),\n raw_version: z.string(),\n requirement: z.record(z.string(), z.any()).nullish(),\n});\nexport type DependabotEcosystemVersionManager = z.infer<typeof DependabotEcosystemVersionManagerSchema>;\n\nexport const DependabotEcosystemMetaSchema = z.object({\n name: z.string(),\n package_manager: DependabotEcosystemVersionManagerSchema.nullish(),\n version: DependabotEcosystemVersionManagerSchema.nullish(),\n});\nexport type DependabotEcosystemMeta = z.infer<typeof DependabotEcosystemMetaSchema>;\n\nexport const DependabotRecordEcosystemMetaSchema = z.object({\n ecosystem: DependabotEcosystemMetaSchema,\n});\nexport type DependabotRecordEcosystemMeta = z.infer<typeof DependabotRecordEcosystemMetaSchema>;\n\nexport const DependabotIncrementMetricSchema = z.object({\n metric: z.string(),\n tags: z.record(z.string(), z.any()).nullish(),\n});\nexport type DependabotIncrementMetric = z.infer<typeof DependabotIncrementMetricSchema>;\n\nexport const DependabotMetricSchema = z.object({\n metric: z.string(),\n type: z.enum(['increment', 'gauge', 'distribution', 'histogram']),\n value: z.number().nullish(),\n values: z.number().array().nullish(),\n tags: z.record(z.string(), z.string()).nullish(),\n});\nexport type DependabotMetric = z.infer<typeof DependabotMetricSchema>;\n","import { zValidator } from '@hono/zod-validator';\nimport { Hono } from 'hono';\nimport { type ZodType, z } from 'zod';\nimport { logger } from '@/logger';\nimport type { DependabotCredential, DependabotJobConfig } from './job';\nimport {\n DependabotClosePullRequestSchema,\n DependabotCreatePullRequestSchema,\n DependabotDependencySubmissionSchema,\n DependabotIncrementMetricSchema,\n DependabotMarkAsProcessedSchema,\n DependabotMetricSchema,\n DependabotRecordEcosystemMetaSchema,\n DependabotRecordEcosystemVersionsSchema,\n DependabotRecordUpdateJobErrorSchema,\n DependabotRecordUpdateJobUnknownErrorSchema,\n DependabotRecordUpdateJobWarningSchema,\n DependabotUpdateDependencyListSchema,\n DependabotUpdatePullRequestSchema,\n} from './update';\n\nexport const DependabotRequestTypeSchema = z.enum([\n 'create_pull_request',\n 'update_pull_request',\n 'close_pull_request',\n 'record_update_job_error',\n 'record_update_job_warning',\n 'record_update_job_unknown_error',\n 'mark_as_processed',\n 'update_dependency_list',\n 'create_dependency_submission',\n 'record_ecosystem_versions',\n 'record_ecosystem_meta',\n 'increment_metric',\n 'record_metrics',\n]);\nexport type DependabotRequestType = z.infer<typeof DependabotRequestTypeSchema>;\n\nexport const DependabotRequestSchema = z.discriminatedUnion('type', [\n z.object({ type: z.literal('create_pull_request'), data: DependabotCreatePullRequestSchema }),\n z.object({ type: z.literal('update_pull_request'), data: DependabotUpdatePullRequestSchema }),\n z.object({ type: z.literal('close_pull_request'), data: DependabotClosePullRequestSchema }),\n z.object({ type: z.literal('record_update_job_error'), data: DependabotRecordUpdateJobErrorSchema }),\n z.object({ type: z.literal('record_update_job_warning'), data: DependabotRecordUpdateJobWarningSchema }),\n z.object({ type: z.literal('record_update_job_unknown_error'), data: DependabotRecordUpdateJobUnknownErrorSchema }),\n z.object({ type: z.literal('mark_as_processed'), data: DependabotMarkAsProcessedSchema }),\n z.object({ type: z.literal('update_dependency_list'), data: DependabotUpdateDependencyListSchema }),\n z.object({ type: z.literal('create_dependency_submission'), data: DependabotDependencySubmissionSchema }),\n z.object({ type: z.literal('record_ecosystem_versions'), data: DependabotRecordEcosystemVersionsSchema }),\n z.object({ type: z.literal('record_ecosystem_meta'), data: DependabotRecordEcosystemMetaSchema.array() }),\n z.object({ type: z.literal('increment_metric'), data: DependabotIncrementMetricSchema }),\n z.object({ type: z.literal('record_metrics'), data: DependabotMetricSchema.array() }),\n]);\nexport type DependabotRequest = z.infer<typeof DependabotRequestSchema>;\n\nexport type DependabotTokenType = 'job' | 'credentials';\n\n/**\n * Function type for authenticating requests.\n * @param type - The type of authentication ('job' or 'credentials').\n * @param id - The ID of the dependabot job.\n * @param value - The authentication value (e.g., API key).\n * @returns A promise that resolves to a boolean indicating whether the authentication was successful.\n */\ntype AuthenticatorFunc = (type: DependabotTokenType, id: string, value: string) => Promise<boolean>;\n\n/**\n * Handler function for processing dependabot requests.\n * @param id - The ID of the dependabot job.\n * @param request - The dependabot request to handle.\n * @returns A promise that resolves to the result of handling the request.\n */\ntype HandlerFunc = (id: string, request: DependabotRequest) => Promise<boolean>;\n\n/**\n * Function for inspecting raw dependabot requests.\n * @param id - The ID of the dependabot job.\n * @param type - The type of dependabot request.\n * @param raw - The raw JSON data of the request.\n * @returns A promise that resolves when the operation is complete.\n */\ntype InspectRequestFunc = (id: string, type: DependabotRequestType, raw: unknown) => Promise<void>;\n\n/**\n * Function for getting a dependabot job config by ID.\n * @param id - The ID of the dependabot job.\n * @returns A promise that resolves to the dependabot job config, or undefined if not found.\n */\ntype GetJobFunc = (id: string) => Promise<DependabotJobConfig | undefined>;\n\n/**\n * Function for getting dependabot credentials by job ID.\n * @param id - The ID of the dependabot job.\n * @returns A promise that resolves to an array of dependabot credentials, or undefined if not found.\n */\ntype GetCredentialsFunc = (id: string) => Promise<DependabotCredential[] | undefined>;\n\nexport type CreateApiServerAppOptions = {\n /**\n * Base path for the endpoints.\n * @default `/api/update_jobs`\n */\n basePath?: string;\n\n /** Handler function for authenticating requests. */\n authenticate: AuthenticatorFunc;\n\n /** Function for getting a dependabot job by ID. */\n getJob: GetJobFunc;\n\n /** Function for getting dependabot credentials by job ID. */\n getCredentials: GetCredentialsFunc;\n\n /**\n * Optional function for inspecting raw dependabot requests.\n * Should only be used for troubleshooting.\n * */\n inspect?: InspectRequestFunc;\n\n /** Handler function for processing the operations. */\n handle: HandlerFunc;\n};\n\n/**\n * Creates an API server application for handling dependabot update jobs.\n * The endpoints in the server application have paths in the format: `/api/update_jobs/:id/{operation}`,\n * where `:id` is the job ID and `{operation}` is one of the defined operations e.g. `create_pull_request`.\n *\n * You should set the job endpoint URL in the job container to\n * `http://<host>:<port>/api/update_jobs/:id` where `<host>` and `<port>` are the host and port\n *\n * These endpoints are protected using the provided API key.\n * @param params - The parameters for creating the API server application.\n * @returns The created API server application.\n */\nexport function createApiServerApp({\n basePath = `/api/update_jobs`,\n authenticate,\n getJob,\n getCredentials,\n inspect,\n handle,\n}: CreateApiServerAppOptions): Hono {\n // Setup app with base path and middleware\n const app = new Hono().basePath(basePath);\n\n // Handle endpoints:\n // - POST request to /create_pull_request\n // - POST request to /update_pull_request\n // - POST request to /close_pull_request\n // - POST request to /record_update_job_error\n // - POST request to /record_update_job_warning\n // - POST request to /record_update_job_unknown_error\n // - PATCH request to /mark_as_processed\n // - POST request to /update_dependency_list\n // - POST request to /create_dependency_submission\n // - POST request to /record_ecosystem_versions\n // - POST request to /record_ecosystem_meta\n // - POST request to /increment_metric\n\n function operation<T extends ZodType>(type: DependabotRequestType, schema: T, method?: string) {\n app.on(\n method || 'post',\n `/:id/${type}`,\n zValidator('param', z.object({ id: z.string() })),\n async (context, next) => {\n /**\n * Do not authenticate in scenarios where the server is not using HTTPS because the\n * dependabot proxy will not send the job token over HTTP, yet trying to get HTTPS to work\n * with localhost (self-signed certs) against docker (host.docker.internal) is complicated.\n */\n const url = new URL(context.req.url);\n const isHTTPS = url.protocol === 'https:';\n const { id } = context.req.valid('param');\n if (isHTTPS) {\n const value = context.req.header('Authorization');\n if (!value) return context.body(null, 401);\n const valid = await authenticate('job', id, value);\n if (!valid) return context.body(null, 403);\n } else {\n logger.trace(`Skipping authentication because it is not secure ${context.req.url}`);\n }\n\n // if inspection is provided, call it with the raw request data\n if (inspect) {\n await inspect(id, type, await context.req.json());\n }\n\n await next();\n },\n zValidator('json', z.object({ data: schema })),\n async (context) => {\n const { id } = context.req.valid('param');\n const { data } = context.req.valid('json') as { data: z.infer<typeof schema> };\n // biome-ignore lint/suspicious/noExplicitAny: generic\n const success: boolean = await handle(id, { type, data: data as any });\n return context.body(null, success ? 204 : 400);\n },\n );\n }\n\n operation('create_pull_request', DependabotCreatePullRequestSchema);\n operation('update_pull_request', DependabotUpdatePullRequestSchema);\n operation('close_pull_request', DependabotClosePullRequestSchema);\n operation('record_update_job_error', DependabotRecordUpdateJobErrorSchema);\n operation('record_update_job_warning', DependabotRecordUpdateJobWarningSchema);\n operation('record_update_job_unknown_error', DependabotRecordUpdateJobUnknownErrorSchema);\n operation('mark_as_processed', DependabotMarkAsProcessedSchema, 'patch');\n operation('update_dependency_list', DependabotUpdateDependencyListSchema);\n operation('create_dependency_submission', DependabotDependencySubmissionSchema);\n operation('record_ecosystem_versions', DependabotRecordEcosystemVersionsSchema);\n operation('record_ecosystem_meta', DependabotRecordEcosystemMetaSchema.array());\n operation('increment_metric', DependabotIncrementMetricSchema);\n operation('record_metrics', DependabotMetricSchema.array());\n\n // Handle endpoints:\n // - GET request to /details\n // - GET request to /credentials\n app.on(\n 'get',\n '/:id/details',\n zValidator('param', z.object({ id: z.string() })),\n async (context, next) => {\n const { id } = context.req.valid('param');\n const value = context.req.header('Authorization');\n if (!value) return context.body(null, 401);\n const valid = await authenticate('job', id, value);\n if (!valid) return context.body(null, 403);\n await next();\n },\n async (context) => {\n const { id } = context.req.valid('param');\n const job = await getJob(id);\n if (!job) return context.body(null, 204);\n return context.json(job);\n },\n );\n app.on(\n 'get',\n '/:id/credentials',\n zValidator('param', z.object({ id: z.string() })),\n async (context, next) => {\n const { id } = context.req.valid('param');\n const value = context.req.header('Authorization');\n if (!value) return context.body(null, 401);\n const valid = await authenticate('credentials', id, value);\n if (!valid) return context.body(null, 403);\n await next();\n },\n async (context) => {\n const { id } = context.req.valid('param');\n const credentials = await getCredentials(id);\n if (!credentials) return context.body(null, 204);\n return context.json(credentials);\n },\n );\n\n return app;\n}\n"],"mappings":";;;;;;;;AAKA,MAAa,kCAAkC;AAC/C,MAAa,iCAAiC;;;;ACE9C,SAAgB,uBACd,kBACA,kBACA,WACA,qBACA,cACA,YAAoB,KACZ;CAIR,IAAIA;AAEJ,KADiC,uBAAuB,aAAa,SAAS,GAChD;EAG5B,MAAM,mBAAmBC,SACtB,WAAW,MAAM,CACjB,OAAO,aAAa,KAAK,MAAM,GAAG,EAAE,mBAAmB,GAAG,EAAE,wBAAwB,CAAC,KAAK,IAAI,CAAC,CAC/F,OAAO,MAAM,CACb,UAAU,GAAG,GAAG;AACnB,eAAa,GAAG,uBAAuB,QAAQ,GAAG;OAUlD,cAAa,GANW,aACrB,KAAK,MAAM,EAAE,mBAAmB,CAChC,KAAK,QAAQ,CACb,QAAQ,UAAU,IAAI,CACtB,QAAQ,MAAM,GAAG,CAEY,GADV,aAAa,IAAI,UAAU,YAAY,aAAa,KAAK;AAIjF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