@paklo/core 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/azure/index.d.mts +19 -31
- package/dist/azure/index.mjs +74 -68
- package/dist/azure/index.mjs.map +1 -1
- package/dist/dependabot/index.d.mts +3 -3
- package/dist/dependabot/index.mjs +3 -3
- package/dist/{dependabot-KMy1H3XS.mjs → dependabot-Epqz07Sy.mjs} +109 -29
- package/dist/dependabot-Epqz07Sy.mjs.map +1 -0
- package/dist/github/index.d.mts +1 -1
- package/dist/github/index.mjs +2 -2
- package/dist/github/index.mjs.map +1 -1
- package/dist/hono.d.mts +0 -1
- package/dist/{index-BfwWezjJ.d.mts → index-BKTxy7XU.d.mts} +1 -2
- package/dist/{index-flzaUkHI.d.mts → index-CviS_2Dy.d.mts} +142 -68
- package/dist/{job-ClEevC5P.mjs → job-CNRfJDsF.mjs} +15 -10
- package/dist/{job-ClEevC5P.mjs.map → job-CNRfJDsF.mjs.map} +1 -1
- package/dist/keygen.d.mts +1 -3
- package/dist/{logger-3Qfh9NUj.mjs → logger-BV4N2wBl.mjs} +1 -1
- package/dist/{logger-3Qfh9NUj.mjs.map → logger-BV4N2wBl.mjs.map} +1 -1
- package/dist/logger.d.mts +1 -2
- package/dist/logger.mjs +1 -1
- package/dist/usage.d.mts +1 -2
- package/dist/usage.mjs +1 -1
- package/package.json +8 -9
- package/dist/dependabot-KMy1H3XS.mjs.map +0 -1
package/dist/azure/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["path","path"],"sources":["../../src/azure/client/constants.ts","../../src/azure/client/client-base.ts","../../src/azure/client/client-connection.ts","../../src/azure/client/client-git.ts","../../src/azure/client/client-identity.ts","../../src/azure/client/client-projects.ts","../../src/azure/client/client-pull-requests.ts","../../src/azure/client/client-repositories.ts","../../src/azure/client/client-subscriptions.ts","../../src/azure/client/client.ts","../../src/azure/client/types.ts","../../src/azure/client/utils.ts","../../src/azure/client/wrapper.ts","../../src/azure/config.ts","../../src/azure/events.ts","../../src/azure/url-parts.ts"],"sourcesContent":["export const API_VERSION = '5.0'; // this is the same version used by dependabot-core\nexport const API_VERSION_PREVIEW = '5.0-preview';\n\n/** Returned when no user is authenticated */\nexport const ANONYMOUS_USER_ID = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa';\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 PR_PROPERTY_MICROSOFT_GIT_SOURCE_REF_NAME = 'Microsoft.Git.PullRequest.SourceRefName';\nexport const PR_PROPERTY_DEPENDABOT_PACKAGE_MANAGER = 'Dependabot.PackageManager';\nexport const PR_PROPERTY_DEPENDABOT_DEPENDENCIES = 'Dependabot.Dependencies';\n\nexport const PR_DESCRIPTION_MAX_LENGTH = 4_000;\n","import type { KyInstance } from 'ky';\nimport { API_VERSION } from './constants';\n\nexport class BaseAzureDevOpsClient {\n constructor(protected readonly client: KyInstance) {}\n\n protected makeUrl(path: string): string;\n protected makeUrl(path: string, apiVersion: string): string;\n protected makeUrl(path: string, params: Record<string, unknown>): string;\n protected makeUrl(path: string, params: Record<string, unknown>, apiVersion: string): string;\n protected makeUrl(path: string, params?: Record<string, unknown> | string, apiVersion: string = API_VERSION): string {\n if (typeof params === 'string') {\n apiVersion = params;\n params = {};\n }\n\n const queryString = Object.entries({ 'api-version': apiVersion, ...params })\n .filter(([, value]) => value)\n .map(([key, value]) => `${key}=${value}`)\n .join('&');\n return `${path}?${queryString}`;\n }\n}\n","import { BaseAzureDevOpsClient } from './client-base';\nimport { API_VERSION_PREVIEW } from './constants';\nimport type { AzdoConnectionData } from './types';\n\nexport class ConnectionClient extends BaseAzureDevOpsClient {\n /**\n * Get the connection data for the current user.\n */\n public async get(): Promise<AzdoConnectionData> {\n return await this.client.get<AzdoConnectionData>(this.makeUrl('_apis/connectiondata', API_VERSION_PREVIEW)).json();\n }\n}\n","import { isHTTPError } from 'ky';\nimport { BaseAzureDevOpsClient } from './client-base';\nimport type {\n AzdoGitCommitDiffs,\n AzdoGitPush,\n AzdoGitPushCreate,\n AzdoGitRefUpdate,\n AzdoGitRefUpdateResult,\n AzdoRepositoryItem,\n AzdoResponse,\n} from './types';\n\nexport class GitClient extends BaseAzureDevOpsClient {\n public async getItem(\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.client\n .get<AzdoRepositoryItem>(\n this.makeUrl(\n `${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/items`,\n {\n path,\n includeContent,\n latestProcessedChange,\n },\n ),\n )\n .json();\n return item;\n } catch (e) {\n if (isHTTPError(e) && e.response.status === 404) {\n // item does not exist\n return undefined;\n }\n throw e;\n }\n }\n\n public async getPush(\n projectIdOrName: string,\n repositoryIdOrName: string,\n pushId: number,\n includeCommits?: number,\n includeRefUpdates?: boolean,\n ): Promise<AzdoGitPush> {\n return await this.client\n .get<AzdoGitPush>(\n this.makeUrl(\n `${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pushes/${pushId}`,\n {\n includeCommits,\n includeRefUpdates,\n },\n ),\n )\n .json();\n }\n\n public async createPush(\n projectIdOrName: string,\n repositoryIdOrName: string,\n push: AzdoGitPushCreate,\n ): Promise<AzdoGitPush> {\n return await this.client\n .post<AzdoGitPush>(\n this.makeUrl(\n `${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pushes`,\n ),\n { json: push },\n )\n .json();\n }\n\n public async getDiffCommits(\n projectIdOrName: string,\n repositoryIdOrName: string,\n baseVersion: string,\n targetVersion: string,\n ): Promise<AzdoGitCommitDiffs> {\n return await this.client\n .get<AzdoGitCommitDiffs>(\n this.makeUrl(\n `${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/diffs/commits`,\n {\n baseVersion,\n baseVersionType: 'commit',\n targetVersion,\n targetVersionType: 'commit',\n },\n ),\n )\n .json();\n }\n\n public async updateRef(\n projectIdOrName: string,\n repositoryIdOrName: string,\n ref: AzdoGitRefUpdate[],\n ): Promise<AzdoGitRefUpdateResult[] | undefined> {\n const response = await this.client\n .post<AzdoResponse<AzdoGitRefUpdateResult[]>>(\n this.makeUrl(\n `${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/refs`,\n ),\n { json: ref },\n )\n .json();\n return response.value;\n }\n}\n","import { BaseAzureDevOpsClient } from './client-base';\nimport type { AzdoIdentity, AzdoResponse } from './types';\n\nexport class IdentityClient extends BaseAzureDevOpsClient {\n /**\n * Get the identities that match the given user name, email, or group name.\n * Requires scope \"Identity (Read)\" (vso.identity).\n * @param filterValue username, email, or group name\n * @returns\n */\n public async get(filterValue: string): Promise<AzdoIdentity[] | undefined> {\n const response = await this.client\n .get<AzdoResponse<AzdoIdentity[]>>(\n this.makeUrl('_apis/identities', {\n searchFilter: 'General',\n filterValue,\n queryMembership: 'None',\n }),\n )\n .json();\n return response?.value;\n }\n}\n","import { BaseAzureDevOpsClient } from './client-base';\nimport type { AzdoProject, AzdoResponse } from './types';\n\nexport class ProjectsClient extends BaseAzureDevOpsClient {\n public async list(): Promise<AzdoProject[] | undefined> {\n const response = await this.client.get<AzdoResponse<AzdoProject[]>>(this.makeUrl('_apis/projects')).json();\n return response?.value;\n }\n\n public async get(idOrName: string): Promise<AzdoProject | undefined> {\n return await this.client.get<AzdoProject>(this.makeUrl(`_apis/projects/${encodeURIComponent(idOrName)}`)).json();\n }\n}\n","import { BaseAzureDevOpsClient } from './client-base';\nimport type {\n AzdoGitCommitRef,\n AzdoIdentityRefWithVote,\n AzdoProperties,\n AzdoPullRequest,\n AzdoPullRequestCommentThread,\n AzdoPullRequestStatus,\n AzdoResponse,\n} from './types';\n\nexport class PullRequestsClient extends BaseAzureDevOpsClient {\n /**\n * List pull requests\n * Requires scope \"Code (Read)\" (vso.code).\n * @param projectIdOrName\n * @param repositoryIdOrName\n * @param creatorId ID of the user who created the pull requests\n * @param status The status of the pull requests to filter by\n */\n public async list(\n projectIdOrName: string,\n repositoryIdOrName: string,\n creatorId: string,\n status: AzdoPullRequestStatus,\n ): Promise<AzdoPullRequest[] | undefined> {\n const response = await this.client\n .get<AzdoResponse<AzdoPullRequest[]>>(\n this.makeUrl(\n `${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pullrequests`,\n {\n 'searchCriteria.creatorId': creatorId,\n 'searchCriteria.status': status,\n },\n ),\n )\n .json();\n return response?.value;\n }\n\n public async get(\n projectIdOrName: string,\n repositoryIdOrName: string,\n pullRequestId: number,\n ): Promise<AzdoPullRequest | undefined> {\n return await this.client\n .get<AzdoPullRequest>(\n this.makeUrl(\n `${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pullrequests/${pullRequestId}`,\n ),\n )\n .json();\n }\n\n public async create(\n projectIdOrName: string,\n repositoryIdOrName: string,\n pr: Partial<AzdoPullRequest>,\n ): Promise<AzdoPullRequest> {\n return await this.client\n .post<AzdoPullRequest>(\n this.makeUrl(\n `${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pullrequests`,\n ),\n { json: pr },\n )\n .json();\n }\n\n public async update(\n projectIdOrName: string,\n repositoryIdOrName: string,\n pullRequestId: number,\n pr: Partial<AzdoPullRequest>,\n ): Promise<AzdoPullRequest> {\n return await this.client\n .patch<AzdoPullRequest>(\n this.makeUrl(\n `${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pullrequests/${pullRequestId}`,\n ),\n { json: pr },\n )\n .json();\n }\n\n public async getProperties(\n projectIdOrName: string,\n repositoryIdOrName: string,\n pullRequestId: number,\n ): Promise<{ name: string; value: string }[]> {\n const response = await this.client\n .get<AzdoResponse<AzdoProperties>>(\n this.makeUrl(\n `${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pullrequests/${pullRequestId}/properties`,\n ),\n )\n .json();\n\n return Object.entries(response?.value || {})\n .filter(([, val]) => val?.$value)\n .map(([key, val]) => ({\n name: key,\n value: val.$value,\n }));\n }\n\n public async setProperties(\n projectIdOrName: string,\n repositoryIdOrName: string,\n pullRequestId: number,\n properties: { name: string; value: string }[],\n ): Promise<AzdoResponse<AzdoProperties>> {\n return await this.client\n .patch<AzdoResponse<AzdoProperties>>(\n this.makeUrl(\n `${projectIdOrName}/_apis/git/repositories/${repositoryIdOrName}/pullrequests/${pullRequestId}/properties`,\n ),\n {\n headers: { 'Content-Type': 'application/json-patch+json' },\n json: properties.map((property) => {\n return {\n op: 'add',\n path: `/${property.name}`,\n value: property.value,\n };\n }),\n },\n )\n .json();\n }\n\n /**\n * Approve a pull request.\n * Requires scope \"Code (Write)\" (vso.code_write).\n */\n public async approve(\n projectIdOrName: string,\n repositoryIdOrName: string,\n pullRequestId: number,\n userId: string,\n ): Promise<AzdoIdentityRefWithVote> {\n return await this.client\n .put<AzdoIdentityRefWithVote>(\n this.makeUrl(\n `${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pullrequests/${pullRequestId}/reviewers/${userId}`,\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 {\n json: {\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/paklo/issues/1069\n isReapprove: true,\n },\n },\n )\n .json();\n }\n\n /**\n * Abandon a pull request.\n * Requires scope \"Code (Write)\" (vso.code_write).\n */\n public async abandon(\n projectIdOrName: string,\n repositoryIdOrName: string,\n pullRequestId: number,\n userId: string,\n ): Promise<AzdoPullRequest> {\n return await this.client\n .patch<AzdoPullRequest>(\n this.makeUrl(\n `${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pullrequests/${pullRequestId}`,\n ),\n {\n json: {\n status: 'abandoned',\n closedBy: { id: userId },\n } satisfies Pick<AzdoPullRequest, 'status' | 'closedBy'>,\n },\n )\n .json();\n }\n\n /**\n * Get commits of a pull request.\n * Requires scope \"Code (Read)\" (vso.code_read).\n */\n public async getCommits(\n projectIdOrName: string,\n repositoryIdOrName: string,\n pullRequestId: number,\n ): Promise<AzdoGitCommitRef[] | undefined> {\n const response = await this.client\n .get<AzdoResponse<AzdoGitCommitRef[]>>(\n this.makeUrl(\n `${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pullrequests/${pullRequestId}/commits`,\n ),\n )\n .json();\n return response?.value;\n }\n\n /**\n * Create a comment thread on a pull request.\n * Requires scope \"Code (Write)\" (vso.code_write).\n */\n public async createCommentThread(\n projectIdOrName: string,\n repositoryIdOrName: string,\n pullRequestId: number,\n thread: Partial<AzdoPullRequestCommentThread>,\n ): Promise<AzdoPullRequestCommentThread> {\n return await this.client\n .post<AzdoPullRequestCommentThread>(\n this.makeUrl(\n `${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pullrequests/${pullRequestId}/threads`,\n ),\n { json: thread },\n )\n .json();\n }\n}\n","import { isHTTPError } from 'ky';\nimport { BaseAzureDevOpsClient } from './client-base';\nimport type { AzdoGitBranchStats, AzdoGitRef, AzdoRepository, AzdoResponse } from './types';\n\nexport class RepositoriesClient extends BaseAzureDevOpsClient {\n public async list(projectIdOrName: string): Promise<AzdoRepository[] | undefined> {\n const repos = await this.client\n .get<AzdoResponse<AzdoRepository[]>>(\n this.makeUrl(`${encodeURIComponent(projectIdOrName)}/_apis/git/repositories`),\n )\n .json();\n return repos?.value;\n }\n\n public async get(projectIdOrName: string, repositoryIdOrName: string): Promise<AzdoRepository | undefined> {\n try {\n const repo = await this.client\n .get<AzdoRepository>(\n this.makeUrl(\n `${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}`,\n ),\n )\n .json();\n return repo;\n } catch (e) {\n if (isHTTPError(e) && e.response.status === 404) {\n // repository no longer exists\n return undefined;\n }\n throw e;\n }\n }\n\n /**\n * Get the list of refs (a.k.a branch names) for a repository.\n * Requires scope \"Code (Read)\" (vso.code).\n * @param projectIdOrName\n * @param repositoryIdOrName\n * @returns\n */\n public async getRefs(projectIdOrName: string, repositoryIdOrName: string): Promise<AzdoGitRef[] | undefined> {\n const refs = await this.client\n .get<AzdoResponse<AzdoGitRef[]>>(\n this.makeUrl(`${projectIdOrName}/_apis/git/repositories/${repositoryIdOrName}/refs`),\n )\n .json();\n\n return refs?.value;\n }\n\n public async getBranchStats(\n projectIdOrName: string,\n repositoryIdOrName: string,\n branchName: string,\n ): Promise<AzdoGitBranchStats | undefined> {\n return await this.client\n .get<AzdoGitBranchStats>(\n this.makeUrl(`${projectIdOrName}/_apis/git/repositories/${repositoryIdOrName}/stats/branches`, {\n name: branchName,\n }),\n )\n .json();\n }\n}\n","import { BaseAzureDevOpsClient } from './client-base';\nimport type { AzdoSubscription, AzdoSubscriptionsQuery, AzdoSubscriptionsQueryResponse } from './types';\n\nexport class HookSubscriptionsClient extends BaseAzureDevOpsClient {\n public async query(query: AzdoSubscriptionsQuery): Promise<AzdoSubscription[]> {\n const response = await this.client\n .post<AzdoSubscriptionsQueryResponse>(this.makeUrl('_apis/hooks/subscriptionsquery'), { json: query })\n .json();\n return response?.results;\n }\n\n public async create(subscription: Partial<AzdoSubscription>): Promise<AzdoSubscription> {\n const response = await this.client\n .post<AzdoSubscription>(this.makeUrl('_apis/hooks/subscriptions'), { json: subscription })\n .json();\n return response;\n }\n\n public async replace(subscriptionId: string, subscription: AzdoSubscription): Promise<AzdoSubscription> {\n const response = await this.client\n .put<AzdoSubscription>(this.makeUrl(`_apis/hooks/subscriptions/${subscriptionId}`), { json: subscription })\n .json();\n return response;\n }\n\n public async delete(subscriptionId: string): Promise<void> {\n await this.client.delete(this.makeUrl(`_apis/hooks/subscriptions/${subscriptionId}`)).json();\n }\n}\n","import ky, { isHTTPError, type Options as KyOptions } from 'ky';\nimport { logger } from '@/logger';\nimport type { AzureDevOpsOrganizationUrl } from '../url-parts';\nimport { ConnectionClient } from './client-connection';\nimport { GitClient } from './client-git';\nimport { IdentityClient } from './client-identity';\nimport { ProjectsClient } from './client-projects';\nimport { PullRequestsClient } from './client-pull-requests';\nimport { RepositoriesClient } from './client-repositories';\nimport { HookSubscriptionsClient } from './client-subscriptions';\n\nexport class AzureDevOpsClient {\n public readonly organizationSlug: string;\n public readonly organizationUrl: string;\n public readonly connection: ConnectionClient;\n public readonly identity: IdentityClient;\n public readonly projects: ProjectsClient;\n public readonly repositories: RepositoriesClient;\n public readonly git: GitClient;\n public readonly pullRequests: PullRequestsClient;\n public readonly subscriptions: HookSubscriptionsClient;\n\n constructor(url: AzureDevOpsOrganizationUrl, accessToken: string, debug: boolean = false) {\n this.organizationSlug = url.organization;\n const organizationUrl = url.value.toString().replace(/\\/$/, ''); // trim trailing slash\n this.organizationUrl = organizationUrl;\n const mainClientOptions = AzureDevOpsClient.createClientOptions(accessToken, debug, {\n prefixUrl: organizationUrl,\n });\n const mainClient = ky.create(mainClientOptions);\n this.connection = new ConnectionClient(mainClient);\n this.projects = new ProjectsClient(mainClient);\n this.repositories = new RepositoriesClient(mainClient);\n this.git = new GitClient(mainClient);\n this.pullRequests = new PullRequestsClient(mainClient);\n this.subscriptions = new HookSubscriptionsClient(mainClient);\n\n const identityApiUrl = url['identity-api-url'].toString().replace(/\\/$/, ''); // trim trailing slash\n const identityClient = ky.create({ ...mainClientOptions, prefixUrl: identityApiUrl });\n this.identity = new IdentityClient(identityClient);\n }\n\n private static createClientOptions(accessToken: string, debug: boolean, options?: KyOptions): KyOptions {\n return {\n headers: {\n Authorization: `Basic ${Buffer.from(`:${accessToken}`).toString('base64')}`,\n Accept: 'application/json',\n },\n hooks: {\n beforeRequest: [\n async (request, options) => {\n if (debug) logger.debug(`🌎 🠊 [${request.method}] ${request.url}`);\n },\n ],\n afterResponse: [\n async (request, options, response) => {\n if (debug) {\n logger.debug(`🌎 🠈 [${response.status}] ${response.statusText}`);\n\n // log the request and response for debugging\n if (request.body) {\n logger.debug(`REQUEST: ${JSON.stringify(request.body)}`);\n }\n // const body = await response.text();\n // if (body) {\n // logger.debug(`RESPONSE: ${body}`);\n // }\n }\n },\n ],\n beforeRetry: [\n async ({ request, options, error, retryCount }) => {\n if (debug && isHTTPError(error)) {\n logger.debug(`⏳ Retrying failed request with status code: ${error.response.status}`);\n }\n },\n ],\n },\n retry: {\n limit: 3,\n delay: (attempt) => 3000, // all attempts after 3 seconds\n },\n ...options,\n };\n }\n}\n","import { z } from 'zod';\n\nexport const AzdoVersionControlChangeTypeSchema = z.enum([\n 'none',\n 'add',\n 'edit',\n 'encoding',\n 'rename',\n 'delete',\n 'undelete',\n 'branch',\n 'merge',\n 'lock',\n 'rollback',\n 'sourceRename',\n 'targetRename',\n 'property',\n 'all',\n]);\nexport type AzdoVersionControlChangeType = z.infer<typeof AzdoVersionControlChangeTypeSchema>;\n\nexport const AZDO_PULL_REQUEST_MERGE_STRATEGIES = ['noFastForward', 'squash', 'rebase', 'rebaseMerge'] as const;\nexport const AzdoPullRequestMergeStrategySchema = z.enum(AZDO_PULL_REQUEST_MERGE_STRATEGIES);\nexport type AzdoPullRequestMergeStrategy = z.infer<typeof AzdoPullRequestMergeStrategySchema>;\n\nexport const AzdoCommentThreadStatusSchema = z.enum([\n 'unknown',\n 'active',\n 'fixed',\n 'wontFix',\n 'closed',\n 'byDesign',\n 'pending',\n]);\nexport type AzdoCommentThreadStatus = z.infer<typeof AzdoCommentThreadStatusSchema>;\nexport const AzdoCommentTypeSchema = z.enum(['unknown', 'text', 'codeChange', 'system']);\nexport type AzdoCommentType = z.infer<typeof AzdoCommentTypeSchema>;\n\nexport const AzdoPullRequestAsyncStatusSchema = z.enum([\n 'notSet',\n 'queued',\n 'conflicts',\n 'succeeded',\n 'rejectedByPolicy',\n 'failure',\n]);\nexport type AzdoPullRequestAsyncStatus = z.infer<typeof AzdoPullRequestAsyncStatusSchema>;\nexport const AzdoPullRequestStatusSchema = z.enum(['notSet', 'active', 'abandoned', 'completed', 'all']);\nexport type AzdoPullRequestStatus = z.infer<typeof AzdoPullRequestStatusSchema>;\n\nexport const AzdoProjectSchema = z.object({\n id: z.string(),\n name: z.string(),\n description: z.string().optional(),\n url: z.string(),\n state: z.enum(['deleting', 'new', 'wellFormed', 'createPending', 'all', 'unchanged', 'deleted']),\n _links: z\n .object({\n self: z.object({ href: z.string() }),\n collection: z.object({ href: z.string() }),\n web: z.object({ href: z.string() }),\n })\n .optional(),\n});\nexport type AzdoProject = z.infer<typeof AzdoProjectSchema>;\n\nexport const AzdoRepositorySchema = z.object({\n id: z.string(),\n name: z.string(),\n defaultBranch: z.string().optional(),\n project: AzdoProjectSchema,\n isDisabled: z.boolean().optional(),\n isFork: z.boolean().optional(),\n url: z.string(),\n remoteUrl: z.string(),\n webUrl: z.string(),\n});\nexport type AzdoRepository = z.infer<typeof AzdoRepositorySchema>;\n\nexport type AzdoResponse<T> = {\n value?: T;\n count: number;\n};\n\nexport const AzdoIdentitySchema = z.object({\n id: z.string(),\n displayName: z.string(),\n url: z.string(),\n});\nexport type AzdoIdentity = z.infer<typeof AzdoIdentitySchema>;\nexport const AzdoIdentityRefSchema = z.object({\n id: z.string().optional(),\n displayName: z.string().optional(),\n uniqueName: z.string().optional(),\n url: z.string().optional(),\n});\nexport type AzdoIdentityRef = z.infer<typeof AzdoIdentityRefSchema>;\n\nexport const AzdoConnectionDataSchema = z.object({\n authenticatedUser: AzdoIdentitySchema,\n authorizedUser: AzdoIdentitySchema,\n});\nexport type AzdoConnectionData = z.infer<typeof AzdoConnectionDataSchema>;\n\nexport const AzdoGitUserDateSchema = z.object({\n name: z.string(),\n email: z.string(),\n date: z.string().optional(),\n});\nexport type AzdoGitUserDate = z.infer<typeof AzdoGitUserDateSchema>;\nexport const AzdoGitRefSchema = z.object({\n name: z.string(),\n objectId: z.string(),\n isLocked: z.boolean().optional(),\n});\nexport type AzdoGitRef = z.infer<typeof AzdoGitRefSchema>;\nexport const AzdoGitRefUpdateResultSchema = AzdoGitRefSchema.extend({\n oldObjectId: z.string(),\n newObjectId: z.string(),\n success: z.boolean(),\n customMessage: z.string().optional(),\n});\nexport type AzdoGitRefUpdateResult = z.infer<typeof AzdoGitRefUpdateResultSchema>;\nexport const AzdoGitChangeSchema = z.object({\n changeType: AzdoVersionControlChangeTypeSchema,\n item: z.object({ path: z.string() }).optional(), // current version (path)\n newContent: z\n .object({\n content: z.string(),\n contentType: z.enum(['rawtext', 'base64encoded']),\n })\n .optional(),\n originalPath: z.string().optional(), // original path of the item if different from current path\n});\nexport type AzdoGitChange = z.infer<typeof AzdoGitChangeSchema>;\nexport const AzdoGitCommitRefSchema = z.object({\n commitId: z.string(),\n author: AzdoGitUserDateSchema.optional(),\n committer: AzdoGitUserDateSchema.optional(),\n changes: AzdoGitChangeSchema.array().optional(),\n});\nexport type AzdoGitCommitRef = z.infer<typeof AzdoGitCommitRefSchema>;\nexport const AzdoGitPushSchema = z.object({\n commits: AzdoGitCommitRefSchema.array(),\n refUpdates: AzdoGitRefSchema.array(),\n});\nexport type AzdoGitPush = z.infer<typeof AzdoGitPushSchema>;\nexport const AzdoGitRefUpdateSchema = z.object({\n name: z.string(),\n oldObjectId: z.string(),\n newObjectId: z.string().optional(),\n isLocked: z.boolean().optional(),\n});\nexport type AzdoGitRefUpdate = z.infer<typeof AzdoGitRefUpdateSchema>;\nexport const AzdoGitPushCreateSchema = z.object({\n refUpdates: AzdoGitRefUpdateSchema.array(),\n commits: z\n .object({\n comment: z.string(),\n author: AzdoGitUserDateSchema.optional(),\n changes: AzdoGitChangeSchema.array(),\n })\n .array(),\n});\nexport type AzdoGitPushCreate = z.infer<typeof AzdoGitPushCreateSchema>;\nexport const AzdoGitBranchStatsSchema = z.object({\n aheadCount: z.number(),\n behindCount: z.number(),\n});\nexport type AzdoGitBranchStats = z.infer<typeof AzdoGitBranchStatsSchema>;\nexport const AzdoGitCommitDiffsSchema = z.object({\n allChangesIncluded: z.boolean(),\n baseCommit: z.string(),\n changes: AzdoGitChangeSchema.array(),\n targetCommit: z.string(),\n});\nexport type AzdoGitCommitDiffs = z.infer<typeof AzdoGitCommitDiffsSchema>;\n\nexport const AzdoRepositoryItemSchema = z.object({\n latestProcessedChange: AzdoGitCommitRefSchema.optional(),\n content: z.string().optional(),\n});\nexport type AzdoRepositoryItem = z.infer<typeof AzdoRepositoryItemSchema>;\n\nexport const AzdoIdentityRefWithVoteSchema = z.object({\n id: z.string().optional(),\n displayName: z.string().optional(),\n vote: z.number().optional(),\n hasDeclined: z.boolean().optional(),\n isFlagged: z.boolean().optional(),\n isRequired: z.boolean().optional(),\n});\nexport type AzdoIdentityRefWithVote = z.infer<typeof AzdoIdentityRefWithVoteSchema>;\n\nexport const AzdoPullRequestSchema = z.object({\n pullRequestId: z.number(),\n status: AzdoPullRequestStatusSchema,\n isDraft: z.boolean(),\n sourceRefName: z.string(),\n targetRefName: z.string(),\n title: z.string(),\n description: z.string().optional(),\n lastMergeCommit: AzdoGitCommitRefSchema,\n lastMergeSourceCommit: AzdoGitCommitRefSchema,\n mergeStatus: AzdoPullRequestAsyncStatusSchema,\n reviewers: AzdoIdentityRefWithVoteSchema.array().optional(),\n workItemRefs: z.object({ id: z.string() }).array().optional(),\n labels: z.object({ name: z.string() }).array().optional(),\n autoCompleteSetBy: AzdoIdentityRefSchema.optional(),\n completionOptions: z\n .object({\n autoCompleteIgnoreConfigIds: z.number().array().optional(),\n deleteSourceBranch: z.boolean().optional(),\n mergeCommitMessage: z.string().optional(),\n mergeStrategy: AzdoPullRequestMergeStrategySchema.optional(),\n transitionWorkItems: z.boolean().optional(),\n })\n .optional(),\n closedBy: AzdoIdentityRefSchema.optional(),\n});\nexport type AzdoPullRequest = z.infer<typeof AzdoPullRequestSchema>;\n\nexport const AzdoPropertiesSchema = z.record(\n z.string(),\n z.object({\n $type: z.string(),\n $value: z.string(),\n }),\n);\nexport type AzdoProperties = z.infer<typeof AzdoPropertiesSchema>;\n\nexport const AzdoPullRequestCommentSchema = z.object({\n id: z.number().optional(),\n parentCommentId: z.number().optional(),\n content: z.string(),\n commentType: AzdoCommentTypeSchema,\n publishedDate: z.string().optional(),\n author: AzdoIdentityRefSchema,\n});\nexport type AzdoPullRequestComment = z.infer<typeof AzdoPullRequestCommentSchema>;\nexport const AzdoPullRequestCommentThreadSchema = z.object({\n id: z.number(),\n comments: AzdoPullRequestCommentSchema.array(),\n status: AzdoCommentThreadStatusSchema,\n});\nexport type AzdoPullRequestCommentThread = z.infer<typeof AzdoPullRequestCommentThreadSchema>;\n\nexport const AzdoSubscriptionSchema = z.object({\n id: z.string(),\n status: z.enum(['enabled', 'onProbation', 'disabledByUser', 'disabledBySystem', 'disabledByInactiveIdentity']),\n publisherId: z.string(),\n publisherInputs: z.record(z.string(), z.string()),\n consumerId: z.string().optional(),\n consumerActionId: z.string().optional(),\n consumerInputs: z.record(z.string(), z.string()),\n eventType: z.string(), // not enum because we do not know all the values\n resourceVersion: z.string(),\n eventDescription: z.string().optional(),\n actionDescription: z.string().optional(),\n});\nexport type AzdoSubscription = z.infer<typeof AzdoSubscriptionSchema>;\n\nexport const AzdoSubscriptionsQueryResponseSchema = z.object({\n results: AzdoSubscriptionSchema.array(),\n});\nexport type AzdoSubscriptionsQueryResponse = z.infer<typeof AzdoSubscriptionsQueryResponseSchema>;\n\nexport const AzdoSubscriptionsQueryInputFilterSchema = z.object({\n conditions: z\n .object({\n caseSensitive: z.boolean().optional(),\n inputId: z.string().optional(),\n inputValue: z.string().optional(),\n operator: z.enum(['equals', 'notEquals']),\n })\n .array()\n .optional(),\n});\nexport type AzdoSubscriptionsQueryInputFilter = z.infer<typeof AzdoSubscriptionsQueryInputFilterSchema>;\n\nexport const AzdoSubscriptionsQuerySchema = z.object({\n consumerActionId: z.string().optional(),\n consumerId: z.string().optional(),\n consumerInputFilters: AzdoSubscriptionsQueryInputFilterSchema.array().optional(),\n eventType: z.string().optional(),\n publisherId: z.string().optional(),\n publisherInputFilters: AzdoSubscriptionsQueryInputFilterSchema.array().optional(),\n subscriberId: z.string().optional(),\n});\nexport type AzdoSubscriptionsQuery = z.infer<typeof AzdoSubscriptionsQuerySchema>;\n\nexport type AzdoPrExtractedWithProperties = {\n pullRequestId: number;\n properties?: { name: string; value: string }[];\n};\n\nexport type AzdoFileChange = {\n changeType: AzdoVersionControlChangeType;\n path: string;\n content?: string;\n encoding?: 'utf-8' | 'base64';\n};\n","import * as path from 'node:path';\n\nimport {\n areEqual,\n type DependabotCreatePullRequest,\n type DependabotPersistedPr,\n DependabotPersistedPrSchema,\n type DependabotUpdatePullRequest,\n getDependencyNames,\n} from '@/dependabot';\nimport { PR_PROPERTY_DEPENDABOT_DEPENDENCIES, PR_PROPERTY_DEPENDABOT_PACKAGE_MANAGER } from './constants';\nimport type { AzdoFileChange, AzdoPrExtractedWithProperties, AzdoVersionControlChangeType } from './types';\n\nexport function buildPullRequestProperties(packageManager: string, dependencies: DependabotPersistedPr) {\n return [\n {\n name: PR_PROPERTY_DEPENDABOT_PACKAGE_MANAGER,\n value: packageManager,\n },\n {\n name: PR_PROPERTY_DEPENDABOT_DEPENDENCIES,\n value: JSON.stringify(dependencies),\n },\n ];\n}\n\nexport function parsePullRequestProperties(\n pullRequests: AzdoPrExtractedWithProperties[],\n packageManager: string | null,\n): Record<string, DependabotPersistedPr> {\n return Object.fromEntries(\n pullRequests\n .filter((pr) => {\n return pr.properties?.find(\n (p) =>\n p.name === PR_PROPERTY_DEPENDABOT_PACKAGE_MANAGER &&\n (packageManager === null || p.value === packageManager),\n );\n })\n .map((pr) => {\n return [\n pr.pullRequestId,\n DependabotPersistedPrSchema.parse(\n JSON.parse(pr.properties!.find((p) => p.name === PR_PROPERTY_DEPENDABOT_DEPENDENCIES)!.value),\n ),\n ];\n }),\n );\n}\n\nexport function getPullRequestForDependencyNames(\n existingPullRequests: AzdoPrExtractedWithProperties[],\n packageManager: string,\n dependencyNames: string[],\n): AzdoPrExtractedWithProperties | undefined {\n return existingPullRequests.find((pr) => {\n return (\n pr.properties?.find((p) => p.name === PR_PROPERTY_DEPENDABOT_PACKAGE_MANAGER && p.value === packageManager) &&\n pr.properties?.find(\n (p) =>\n p.name === PR_PROPERTY_DEPENDABOT_DEPENDENCIES &&\n areEqual(getDependencyNames(DependabotPersistedPrSchema.parse(JSON.parse(p.value))), dependencyNames),\n )\n );\n });\n}\n\nexport function getPullRequestChangedFiles(data: DependabotCreatePullRequest | DependabotUpdatePullRequest) {\n return data['updated-dependency-files']\n .filter((file) => file.type === 'file')\n .map((file) => {\n let changeType: AzdoVersionControlChangeType = 'none';\n if (file.deleted === true || file.operation === 'delete') {\n changeType = 'delete';\n } else if (file.operation === 'update') {\n changeType = 'edit';\n } else {\n changeType = '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 AzdoFileChange;\n });\n}\n","import { normalizeBranchName, normalizeFilePath } from '@/dependabot';\nimport { logger } from '@/logger';\nimport type { AzdoEvent, AzdoEventType } from '../events';\nimport type { AzureDevOpsOrganizationUrl } from '../url-parts';\nimport { AzureDevOpsClient } from './client';\nimport type {\n AzdoFileChange,\n AzdoGitUserDate,\n AzdoIdentityRefWithVote,\n AzdoPrExtractedWithProperties,\n AzdoPullRequestMergeStrategy,\n AzdoSubscriptionsQuery,\n} from './types';\n\ntype AzdoRepositoryOptions = { project: string; repository: string };\n\ntype AzdoPullRequestCreateOptions = AzdoRepositoryOptions & {\n source: { branch: string; commit: string };\n target: { branch: string };\n author: AzdoGitUserDate;\n title: string;\n description: string;\n commitMessage: string;\n autoComplete?: {\n ignorePolicyConfigIds?: number[];\n mergeStrategy?: AzdoPullRequestMergeStrategy;\n };\n assignees?: string[];\n labels?: string[];\n workItems?: string[];\n changes: AzdoFileChange[];\n properties?: { name: string; value: string }[];\n};\n\ntype AzdoPullRequestOptions = AzdoRepositoryOptions & { pullRequestId: number };\n\ntype AzdoPullRequestUpdateOptions = AzdoPullRequestOptions & {\n commit: string;\n author: AzdoGitUserDate;\n changes: AzdoFileChange[];\n};\n\ntype AzdoPullRequestAbandonOptions = AzdoPullRequestOptions & {\n comment?: string;\n deleteSourceBranch?: boolean;\n};\n\ntype AzdoPullRequestCommentCreateOptions = AzdoPullRequestOptions & {\n content: string;\n userId?: string;\n};\n\nexport class AzureDevOpsClientWrapper {\n public readonly inner: AzureDevOpsClient;\n\n private authenticatedUserId?: string;\n private resolvedUserIds: Record<string, string> = {};\n\n /**\n * Create a new Azure DevOps client wrapper.\n * @param url The Azure DevOps organization URL\n * @param accessToken The personal access token for authentication\n * @param debug Enable debug logging for API requests (default: false)\n */\n constructor(url: AzureDevOpsOrganizationUrl, accessToken: string, debug: boolean = false) {\n this.inner = new AzureDevOpsClient(url, accessToken, debug);\n }\n\n /**\n * Get the identity of the authenticated user.\n * The result is cached after the first call to avoid repeated API requests.\n */\n public async getUserId(): Promise<string> {\n if (!this.authenticatedUserId) {\n const connectionData = await this.inner.connection.get();\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 * Results are cached to avoid repeated API requests for the same identifier.\n *\n * Requires scope \"Identity (Read)\" (vso.identity).\n * @param identifier Username, email, or group name to resolve\n * @returns The resolved identity ID, or undefined if not found or on error\n */\n public async resolveIdentityId(identifier: string): Promise<string | undefined> {\n if (this.resolvedUserIds[identifier]) {\n return this.resolvedUserIds[identifier];\n }\n try {\n const identities = await this.inner.identity.get(identifier);\n if (!identities || identities.length === 0) {\n return undefined;\n }\n this.resolvedUserIds[identifier] = identities[0]!.id;\n return this.resolvedUserIds[identifier];\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 /**\n * Get the default branch for a repository.\n *\n * Requires scope \"Code (Read)\" (vso.code).\n * @param options Repository identification options (project and repository)\n * @returns The normalized default branch name (e.g., \"main\"), or undefined if not found\n */\n public async getDefaultBranch(options: AzdoRepositoryOptions): Promise<string | undefined> {\n return normalizeBranchName((await this.inner.repositories.get(options.project, options.repository))?.defaultBranch);\n }\n\n /**\n * Get the list of branch names for a repository.\n *\n * Requires scope \"Code (Read)\" (vso.code).\n * @param options Repository identification options (project and repository)\n * @returns Array of normalized branch names, or undefined if not found\n */\n public async getBranchNames(options: AzdoRepositoryOptions): Promise<string[] | undefined> {\n return (await this.inner.repositories.getRefs(options.project, options.repository))?.map((r) =>\n normalizeBranchName(r.name),\n );\n }\n\n /**\n * Get the properties for all active pull requests created by the specified user.\n * This retrieves both the pull request IDs and their associated properties.\n *\n * Requires scope \"Code (Read)\" (vso.code).\n * @param options Repository identification options including the creator user ID\n * @returns Array of pull request IDs with their properties, empty array on error\n */\n public async getActivePullRequestProperties({\n project,\n repository,\n creatorId,\n }: AzdoRepositoryOptions & { creatorId: string }): Promise<AzdoPrExtractedWithProperties[]> {\n try {\n const pullRequests = await this.inner.pullRequests.list(project, repository, creatorId, 'active');\n if (!pullRequests || pullRequests.length === 0) {\n return [];\n }\n\n return await Promise.all(\n pullRequests.map(async (pr) => {\n const properties = await this.inner.pullRequests.getProperties(project, repository, pr.pullRequestId);\n return { pullRequestId: pr.pullRequestId, properties };\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 with the specified changes.\n * This method performs the following operations:\n * 1. Resolves assignee identities for assignees (if specified)\n * 2. Creates a new branch and pushes changes\n * 3. Creates the pull request with assignees (optional reviewers), labels, and work items\n * 4. Sets pull request properties for dependency metadata\n * 5. Configures auto-complete options (if specified)\n *\n * Requires scope \"Code (Write)\" (vso.code_write).\n * Requires scope \"Identity (Read)\" (vso.identity), if assignees are specified.\n * @param options Pull request creation options including changes, assignees, and auto-complete settings\n * @returns The created pull request ID, or null on error\n */\n public async createPullRequest(options: AzdoPullRequestCreateOptions): Promise<number | null> {\n logger.info(`Creating pull request '${options.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: AzdoIdentityRefWithVote[] = [];\n if (options.assignees && options.assignees.length > 0) {\n for (const assignee of options.assignees) {\n const identityId = this.isGuid(assignee) ? assignee : await this.resolveIdentityId(assignee);\n if (identityId && !reviewers.some((r) => r.id === identityId)) {\n reviewers.push({ id: identityId });\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 ${options.changes.length} file change(s) to branch '${options.source.branch}'...`);\n const push = await this.inner.git.createPush(options.project, options.repository, {\n refUpdates: [\n {\n name: `refs/heads/${options.source.branch}`,\n oldObjectId: options.source.commit,\n },\n ],\n commits: [\n {\n comment: options.commitMessage,\n author: options.author,\n changes: options.changes\n .filter((change) => change.changeType !== 'none')\n .map(({ changeType, ...change }) => {\n return {\n changeType,\n item: { path: normalizeFilePath(change.path) },\n newContent:\n changeType !== 'delete'\n ? {\n content: Buffer.from(change.content!, <BufferEncoding>change.encoding).toString('base64'),\n contentType: 'base64encoded',\n }\n : undefined,\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) => c.commitId).join(', ')}.`);\n\n // Create the pull request\n logger.info(` - Creating pull request to merge '${options.source.branch}' into '${options.target.branch}'...`);\n const pullRequest = await this.inner.pullRequests.create(options.project, options.repository, {\n sourceRefName: `refs/heads/${options.source.branch}`,\n targetRefName: `refs/heads/${options.target.branch}`,\n title: options.title,\n description: options.description,\n reviewers,\n workItemRefs: options.workItems?.map((id) => ({ id: id })),\n labels: options.labels?.map((label) => ({ name: label })),\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 (options.properties && options.properties.length > 0) {\n logger.info(` - Adding dependency metadata to pull request properties...`);\n const newProperties = await this.inner.pullRequests.setProperties(\n options.project,\n options.repository,\n pullRequest.pullRequestId,\n options.properties,\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 (options.autoComplete) {\n logger.info(` - Updating auto-complete options...`);\n const updatedPullRequest = await this.inner.pullRequests.update(\n options.project,\n options.repository,\n pullRequest.pullRequestId,\n {\n autoCompleteSetBy: { id: userId },\n completionOptions: {\n autoCompleteIgnoreConfigIds: options.autoComplete.ignorePolicyConfigIds,\n deleteSourceBranch: true,\n mergeCommitMessage: this.mergeCommitMessage(\n pullRequest.pullRequestId,\n options.title,\n options.description,\n ),\n mergeStrategy: options.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 an existing pull request with new changes.\n * This method performs the following operations:\n * 1. Validates the pull request hasn't been modified by another author\n * 2. Checks if the source branch is behind the target branch\n * 3. Rebases the target branch into the source branch if needed\n * 4. Pushes the new changes to the source branch\n *\n * Requires scope \"Code (Read & Write)\" (vso.code, vso.code_write).\n * @param options Pull request update options including the commit and changes\n * @returns True if successful, false on error\n */\n public async updatePullRequest(options: AzdoPullRequestUpdateOptions): Promise<boolean> {\n logger.info(`Updating pull request #${options.pullRequestId}...`);\n try {\n // Get the pull request details\n const pullRequest = await this.inner.pullRequests.get(options.project, options.repository, options.pullRequestId);\n if (!pullRequest) {\n throw new Error(`Pull request #${options.pullRequestId} not found`);\n }\n\n // Skip if the pull request has been modified by another author\n const commits = await this.inner.pullRequests.getCommits(\n options.project,\n options.repository,\n options.pullRequestId,\n );\n if (commits?.some((c) => c.author?.email !== options.author.email)) {\n logger.info(` - Skipping update as pull request has been modified by another user.`);\n return true;\n }\n\n // Get the branch stats to check if the source branch is behind the target branch\n const stats = await this.inner.repositories.getBranchStats(\n options.project,\n options.repository,\n normalizeBranchName(pullRequest.sourceRefName),\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 (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.inner.git.updateRef(options.project, options.repository, [\n {\n name: pullRequest.sourceRefName,\n oldObjectId: pullRequest.lastMergeSourceCommit.commitId,\n newObjectId: options.commit,\n },\n ]);\n if (rebase?.[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 ${options.changes.length} file change(s) to branch '${pullRequest.sourceRefName}'...`);\n const push = await this.inner.git.createPush(options.project, options.repository, {\n refUpdates: [\n {\n name: pullRequest.sourceRefName,\n oldObjectId: options.commit,\n },\n ],\n commits: [\n {\n comment:\n pullRequest.mergeStatus === 'conflicts'\n ? 'Resolve merge conflicts'\n : `Rebase '${sourceBranchName}' onto '${targetBranchName}'`,\n author: options.author,\n changes: options.changes\n .filter((change) => change.changeType !== 'none')\n .map(({ changeType, ...change }) => {\n return {\n changeType,\n item: { path: normalizeFilePath(change.path) },\n newContent:\n changeType !== 'delete'\n ? {\n content: Buffer.from(change.content!, <BufferEncoding>change.encoding).toString('base64'),\n contentType: 'base64encoded',\n }\n : undefined,\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) => 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 as the authenticated user.\n * Sets the reviewer vote to 10 (approved).\n *\n * Requires scope \"Code (Write)\" (vso.code_write).\n * @param options Pull request identification options\n * @returns True if successful, false on error\n */\n public async approvePullRequest(options: AzdoPullRequestOptions): Promise<boolean> {\n logger.info(`Approving pull request #${options.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.inner.pullRequests.approve(\n options.project,\n options.repository,\n options.pullRequestId,\n userId,\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 and optionally delete its source branch.\n * This method performs the following operations:\n * 1. Adds an optional comment explaining the abandonment reason\n * 2. Sets the pull request status to abandoned\n * 3. Deletes the source branch if requested\n *\n * Requires scope \"Code (Write)\" (vso.code_write).\n * @param options Pull request abandonment options including optional comment and branch deletion flag\n * @returns True if successful, false on error\n */\n public async abandonPullRequest(options: AzdoPullRequestAbandonOptions): Promise<boolean> {\n logger.info(`Abandoning pull request #${options.pullRequestId}...`);\n try {\n const userId = await this.getUserId();\n\n // Add a comment to the pull request, if supplied\n if (options.comment) {\n logger.info(` - Adding abandonment reason comment to pull request...`);\n const threadId = await this.addCommentThread({\n ...options,\n content: options.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.inner.pullRequests.abandon(\n options.project,\n options.repository,\n options.pullRequestId,\n userId,\n );\n if (abandonedPullRequest?.status !== '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 (options.deleteSourceBranch) {\n logger.info(` - Deleting source branch...`);\n const deletedBranch = await this.inner.git.updateRef(options.project, options.repository, [\n {\n name: abandonedPullRequest.sourceRefName,\n oldObjectId: abandonedPullRequest.lastMergeSourceCommit.commitId,\n newObjectId: '0000000000000000000000000000000000000000',\n isLocked: false,\n },\n ]);\n if (deletedBranch?.[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 * The comment thread is created with a closed status and system comment type.\n *\n * Requires scope \"Code (Write)\" (vso.code_write).\n * @param options Comment creation options including content and optional user ID\n * @returns The created thread ID, or undefined on error\n */\n public async addCommentThread(options: AzdoPullRequestCommentCreateOptions): Promise<number | undefined> {\n const userId = options.userId ?? (await this.getUserId());\n const thread = await this.inner.pullRequests.createCommentThread(\n options.project,\n options.repository,\n options.pullRequestId,\n {\n status: 'closed',\n comments: [\n {\n author: { id: userId },\n content: options.content,\n commentType: 'system',\n },\n ],\n },\n );\n return thread?.id;\n }\n\n /**\n * Create or update webhook subscriptions for Azure DevOps events.\n * This sets up subscriptions for various git events (push, pull request updates, repository changes, etc.)\n * and ensures they are configured to send webhooks to the specified URL.\n * Existing subscriptions matching the URL will be updated, otherwise new subscriptions are created.\n *\n * Requires scope \"Service Hooks (Read & Write)\" (vso.hooks_write).\n * @returns Array of subscription IDs that were created or updated\n */\n public async createOrUpdateHookSubscriptions({\n url,\n headers,\n project,\n }: {\n url: string;\n headers: Record<string, string>;\n project: string;\n }) {\n // events are registered per project because, the git.repo.* events do not support global subscriptions\n const subscriptionTypes = new Map<AzdoEventType, AzdoEvent['resourceVersion']>([\n ['git.push', '1.0'],\n ['git.pullrequest.updated', '1.0'],\n ['git.pullrequest.merged', '1.0'],\n ['git.repo.created', '1.0-preview.1'],\n ['git.repo.deleted', '1.0-preview.1'],\n ['git.repo.renamed', '1.0-preview.1'],\n ['git.repo.statuschanged', '1.0-preview.1'],\n ['ms.vss-code.git-pullrequest-comment-event', '2.0'],\n ]);\n\n const query = this.buildSubscriptionsQuery({ url, project });\n const subscriptions = await this.inner.subscriptions.query(query);\n\n // iterate each subscription checking if creation or update is required\n const ids: string[] = [];\n for (const [eventType, resourceVersion] of subscriptionTypes) {\n // find existing one\n const existing = subscriptions.find((sub) => {\n return sub.eventType === eventType && sub.resourceVersion === resourceVersion;\n });\n\n let subscription: typeof existing;\n\n // if we have an existing one, update it, otherwise create a new one\n if (existing) {\n // publisherId, consumerId, and consumerActionId cannot be updated\n existing.status = 'enabled';\n existing.eventType = eventType;\n existing.resourceVersion = resourceVersion;\n existing.publisherInputs = this.makeTfsPublisherInputs({ eventType, project });\n existing.consumerInputs = this.makeWebhookConsumerInputs({ url, headers });\n subscription = await this.inner.subscriptions.replace(existing.id, existing);\n } else {\n subscription = await this.inner.subscriptions.create({\n status: 'enabled',\n eventType,\n resourceVersion,\n\n publisherId: 'tfs',\n publisherInputs: this.makeTfsPublisherInputs({ eventType, project }),\n consumerId: 'webHooks',\n consumerActionId: 'httpRequest',\n consumerInputs: this.makeWebhookConsumerInputs({ url, headers }),\n });\n }\n\n ids.push(subscription.id);\n }\n\n // delete any other existing subscriptions that are not in our desired list\n for (const sub of subscriptions) {\n if (!ids.includes(sub.id)) {\n await this.inner.subscriptions.delete(sub.id);\n }\n }\n }\n\n /**\n * Remove all webhook subscriptions for a specific URL.\n * This finds all subscriptions matching the provided URL and deletes them.\n *\n * Requires scope \"Service Hooks (Read & Write)\" (vso.hooks_write).\n */\n public async deleteHookSubscriptions({ url, project }: { url: string; project: string }) {\n const query = this.buildSubscriptionsQuery({ url, project });\n const subscriptions = await this.inner.subscriptions.query(query);\n\n // iterate each subscription and delete it\n for (const sub of subscriptions) {\n await this.inner.subscriptions.delete(sub.id);\n }\n }\n\n private 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\n private 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\n private buildSubscriptionsQuery({ url, project }: { url: string; project: string }): AzdoSubscriptionsQuery {\n return {\n publisherId: 'tfs',\n publisherInputFilters: [\n {\n conditions: [{ operator: 'equals', inputId: 'projectId', caseSensitive: false, inputValue: project }],\n },\n ],\n consumerId: 'webHooks',\n consumerActionId: 'httpRequest',\n consumerInputFilters: [\n {\n conditions: [{ operator: 'equals', inputId: 'url', caseSensitive: false, inputValue: url }],\n },\n ],\n };\n }\n\n private makeTfsPublisherInputs({\n eventType,\n project,\n }: {\n eventType: AzdoEventType;\n project: string;\n }): Record<string, string> {\n // possible inputs are available via an authenticated request to\n // https://dev.azure.com/{organization}/_apis/hooks/publishers/tfs\n\n return {\n projectId: project, // project to restrict events to\n\n ...(eventType === 'git.pullrequest.updated' && {\n // only trigger on updates to the pull request status (e.g. active, abandoned, completed)\n notificationType: 'StatusUpdateNotification',\n }),\n ...(eventType === 'git.pullrequest.merged' && {\n // only trigger on conflicts\n mergeResult: 'Conflicts',\n }),\n };\n }\n\n private makeWebhookConsumerInputs({\n url,\n headers,\n }: {\n url: string;\n headers: Record<string, string>;\n }): Record<string, string> {\n return {\n // possible inputs are available via an authenticated request to\n // https://dev.azure.com/{organization}/_apis/hooks/consumers/webHooks\n\n url,\n acceptUntrustedCerts: 'false',\n httpHeaders: Object.entries(headers)\n .map(([key, value]) => `${key}:${value}`)\n .join('\\n'),\n messagesToSend: 'none',\n detailedMessagesToSend: 'none',\n };\n }\n}\n","import { existsSync } from 'node:fs';\nimport { readFile } from 'node:fs/promises';\nimport * as path from 'node:path';\nimport ky from 'ky';\n\nimport {\n CONFIG_FILE_PATHS_AZURE,\n type DependabotConfig,\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 `CONFIG_FILE_PATHS_AZURE`.\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/paklo/issues/328\n */\n\n if (remote) {\n logger.debug(`Attempting to fetch configuration file via REST API ...`);\n for (const fp of CONFIG_FILE_PATHS_AZURE) {\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 ky.get(requestUrl, {\n headers: {\n Authorization: authHeader,\n Accept: '*/*', // Gotcha!!! without this SH*T fails terribly\n },\n // 401, 403 and 404 are handled explicitly\n throwHttpErrors: (status) => ![401, 403, 404].includes(status),\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 CONFIG_FILE_PATHS_AZURE) {\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: ${CONFIG_FILE_PATHS_AZURE.join(', ')}`);\n } else {\n logger.trace('Configuration file contents read.');\n }\n\n return await parseDependabotConfig({ configContents, configPath, variableFinder });\n}\n","import { z } from 'zod';\nimport {\n AzdoGitCommitRefSchema,\n AzdoIdentityRefSchema,\n AzdoPullRequestAsyncStatusSchema,\n AzdoPullRequestCommentSchema,\n AzdoPullRequestStatusSchema,\n} from './client/types';\n\nexport const AzdoEventTypeSchema = z.enum([\n // Code is pushed to a Git repository.\n 'git.push',\n // Pull request is updated – status, review list, reviewer vote\n // changed or the source branch is updated with a push.\n 'git.pullrequest.updated',\n // Pull request - Branch merge attempted.\n 'git.pullrequest.merged',\n // A repository is created.\n 'git.repo.created',\n // A repository is deleted.\n 'git.repo.deleted',\n // A repository is renamed.\n 'git.repo.renamed',\n // A repository's status is changed.\n 'git.repo.statuschanged',\n // Comments are added to a pull request.\n 'ms.vss-code.git-pullrequest-comment-event',\n]);\nexport type AzdoEventType = z.infer<typeof AzdoEventTypeSchema>;\n\nconst AzdoEventProjectSchema = z.object({\n id: z.string(),\n name: z.string(),\n url: z.string(),\n});\n\nexport const AzdoEventRepositorySchema = z.object({\n id: z.string(),\n name: z.string(),\n project: AzdoEventProjectSchema,\n defaultBranch: z.string().optional(),\n remoteUrl: z.string(),\n});\n\nexport const AzdoEventCodePushResourceSchema = z.object({\n repository: AzdoEventRepositorySchema,\n commits: AzdoGitCommitRefSchema.array(),\n refUpdates: z\n .object({\n name: z.string(),\n oldObjectId: z.string().nullish(),\n newObjectId: z.string().nullish(),\n })\n .array(),\n pushId: z.number(),\n url: z.string(), // e.g. \"https://dev.azure.com/fabrikam/_apis/git/repositories/2856c8c5-6f6b-4e6d-8a9f-4cf0d33f2f2a/pushes/22\"\n});\nexport type AzdoEventCodePushResource = z.infer<typeof AzdoEventCodePushResourceSchema>;\n\nexport const AzdoEventPullRequestResourceSchema = z.object({\n repository: AzdoEventRepositorySchema,\n pullRequestId: z.number(),\n status: AzdoPullRequestStatusSchema,\n createdBy: AzdoIdentityRefSchema,\n title: z.string(),\n sourceRefName: z.string(),\n targetRefName: z.string(),\n mergeStatus: AzdoPullRequestAsyncStatusSchema,\n mergeId: z.string(),\n url: z.string(),\n});\nexport type AzdoEventPullRequestResource = z.infer<typeof AzdoEventPullRequestResourceSchema>;\n\nexport const AzdoEventRepositoryCreatedResourceSchema = z.object({\n repository: AzdoEventRepositorySchema,\n});\nexport type AzdoEventRepositoryCreatedResource = z.infer<typeof AzdoEventRepositoryCreatedResourceSchema>;\n\nexport const AzdoEventRepositoryDeletedResourceSchema = z.object({\n project: AzdoEventProjectSchema,\n repositoryId: z.string(),\n repositoryName: z.string(),\n isHardDelete: z.boolean(),\n});\nexport type AzdoEventRepositoryDeletedResource = z.infer<typeof AzdoEventRepositoryDeletedResourceSchema>;\n\nexport const AzdoEventRepositoryRenamedResourceSchema = z.object({\n oldName: z.string(),\n newName: z.string(),\n repository: AzdoEventRepositorySchema,\n});\nexport type AzdoEventRepositoryRenamedResource = z.infer<typeof AzdoEventRepositoryRenamedResourceSchema>;\n\nexport const AzdoEventRepositoryStatusChangedResourceSchema = z.object({\n disabled: z.boolean(),\n repository: AzdoEventRepositorySchema,\n});\nexport type AzdoEventRepositoryStatusChangedResource = z.infer<typeof AzdoEventRepositoryStatusChangedResourceSchema>;\n\nexport const AzdoEventPullRequestCommentEventResourceSchema = z.object({\n pullRequest: AzdoEventPullRequestResourceSchema,\n comment: AzdoPullRequestCommentSchema,\n});\nexport type AzdoEventPullRequestCommentEventResource = z.infer<typeof AzdoEventPullRequestCommentEventResourceSchema>;\n\nexport const AzdoEventSchema = z\n .object({\n subscriptionId: z.string(),\n notificationId: z.number(),\n id: z.string(),\n publisherId: z.string(),\n resourceVersion: z.enum(['1.0', '1.0-preview.1', '2.0']),\n createdDate: z.coerce.date(),\n })\n .and(\n z.discriminatedUnion('eventType', [\n z.object({ eventType: z.literal('git.push'), resource: AzdoEventCodePushResourceSchema }),\n z.object({ eventType: z.literal('git.pullrequest.updated'), resource: AzdoEventPullRequestResourceSchema }),\n z.object({ eventType: z.literal('git.pullrequest.merged'), resource: AzdoEventPullRequestResourceSchema }),\n z.object({ eventType: z.literal('git.repo.created'), resource: AzdoEventRepositoryCreatedResourceSchema }),\n z.object({ eventType: z.literal('git.repo.deleted'), resource: AzdoEventRepositoryDeletedResourceSchema }),\n z.object({ eventType: z.literal('git.repo.renamed'), resource: AzdoEventRepositoryRenamedResourceSchema }),\n z.object({\n eventType: z.literal('git.repo.statuschanged'),\n resource: AzdoEventRepositoryStatusChangedResourceSchema,\n }),\n z.object({\n eventType: z.literal('ms.vss-code.git-pullrequest-comment-event'),\n resource: AzdoEventPullRequestCommentEventResourceSchema,\n }),\n ]),\n );\nexport type AzdoEvent = z.infer<typeof AzdoEventSchema>;\n","export type AzureDevOpsOrganizationUrl = {\n /** URL of the organization. This may lack the project name */\n value: URL;\n\n /** Organization URL hostname */\n hostname: string;\n\n /** Organization API endpoint URL */\n 'api-endpoint': string;\n\n /** Organization name/slug */\n organization: string;\n\n /** Virtual directory if present (on-premises only) */\n 'virtual-directory'?: string;\n\n /**\n * Organization Identity API URL (different from the API endpoint).\n * Used for querying user identities.\n */\n 'identity-api-url': URL;\n};\n\nexport type AzureDevOpsProjectUrl = AzureDevOpsOrganizationUrl & {\n /**\n * Project ID or Name.\n * This value is not URL-encoded, clients must encode it when constructing URLs.\n */\n project: string;\n};\n\nexport type AzureDevOpsRepositoryUrl = AzureDevOpsProjectUrl & {\n /**\n * Repository ID or Name.\n * This value is not URL-encoded, clients must encode it when constructing URLs.\n */\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({ organizationUrl }: { organizationUrl: string }): AzureDevOpsOrganizationUrl {\n // convert url string into a valid JS URL object\n const value = new URL(organizationUrl);\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 organization: string = extractOrganization(organizationUrl);\n\n const virtualDirectory = extractVirtualDirectory(value);\n const apiEndpoint = `${protocol}://${hostname}${value.port ? `:${value.port}` : ''}/${virtualDirectory ? `${virtualDirectory}/` : ''}`;\n\n // determine identity api url\n // if hosted on Azure DevOps, use the 'vssps.dev.azure.com' domain\n const identityApiUrl =\n hostname === 'dev.azure.com' || hostname.endsWith('.visualstudio.com')\n ? // https://learn.microsoft.com/en-us/rest/api/azure/devops/ims/identities/read-identities\n new URL(`https://vssps.dev.azure.com/${organization}/`)\n : value;\n\n return {\n value,\n hostname,\n 'api-endpoint': apiEndpoint,\n organization,\n 'virtual-directory': virtualDirectory,\n 'identity-api-url': identityApiUrl,\n };\n}\n\nexport function extractProjectUrl({\n organizationUrl,\n project,\n}: {\n organizationUrl: string;\n project: string;\n}): AzureDevOpsProjectUrl {\n const extracted = extractOrganizationUrl({ organizationUrl });\n // Decode to handle already-encoded inputs, store raw for client methods to encode\n const decodedProject = decodeURIComponent(project);\n\n return {\n ...extracted,\n project: decodedProject,\n };\n}\n\nexport function extractRepositoryUrl({\n organizationUrl,\n project,\n repository,\n}: {\n organizationUrl: string;\n project: string;\n repository: string;\n}): AzureDevOpsRepositoryUrl {\n const extracted = extractProjectUrl({ organizationUrl, project });\n const { organization, 'virtual-directory': virtualDirectory, project: decodedProject } = extracted;\n\n // Decode to handle already-encoded inputs, store raw for client methods to encode\n const decodedRepository = decodeURIComponent(repository);\n // For the slug, encode since it's used in display/logging contexts\n const repoSlug = `${virtualDirectory ? `${virtualDirectory}/` : ''}${organization}/${encodeURI(decodedProject)}/_git/${encodeURI(decodedRepository)}`;\n\n return {\n ...extracted,\n repository: decodedRepository,\n 'repository-slug': repoSlug,\n };\n}\n\n/**\n * Extract organization name from organization URL\n *\n * @param organizationUrl\n *\n * @returns organization name\n */\nfunction extractOrganization(organizationUrl: string): string {\n const url = new URL(organizationUrl);\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 organization from organization url: '${organizationUrl}'.`);\n}\n\n/**\n * Extract virtual directory from organization URL\n *\n * Virtual Directories are sometimes used in on-premises\n * @param organizationUrl\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(organizationUrl: URL) {\n // extract the pathname from the url then split\n // pathname takes the shape '/tfs/x/'\n const path = organizationUrl.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,MAAa,cAAc;AAC3B,MAAa,sBAAsB;;AAGnC,MAAa,oBAAoB;;;;;AAMjC,MAAa,4CAA4C;AACzD,MAAa,yCAAyC;AACtD,MAAa,sCAAsC;AAEnD,MAAa,4BAA4B;;;;ACXzC,IAAa,wBAAb,MAAmC;CACjC,YAAY,AAAmB,QAAoB;EAApB;;CAM/B,AAAU,QAAQ,QAAc,QAA2C,aAAqB,aAAqB;AACnH,MAAI,OAAO,WAAW,UAAU;AAC9B,gBAAa;AACb,YAAS,EAAE;;AAOb,SAAO,GAAGA,OAAK,GAJK,OAAO,QAAQ;GAAE,eAAe;GAAY,GAAG;GAAQ,CAAC,CACzE,QAAQ,GAAG,WAAW,MAAM,CAC5B,KAAK,CAAC,KAAK,WAAW,GAAG,IAAI,GAAG,QAAQ,CACxC,KAAK,IAAI;;;;;;ACfhB,IAAa,mBAAb,cAAsC,sBAAsB;;;;CAI1D,MAAa,MAAmC;AAC9C,SAAO,MAAM,KAAK,OAAO,IAAwB,KAAK,QAAQ,wBAAwB,oBAAoB,CAAC,CAAC,MAAM;;;;;;ACGtH,IAAa,YAAb,cAA+B,sBAAsB;CACnD,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U,kBAAkB;AAEnJ,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":[],"sources":["../../src/azure/client/constants.ts","../../src/azure/client/client-base.ts","../../src/azure/client/client-connection.ts","../../src/azure/client/client-git.ts","../../src/azure/client/client-identity.ts","../../src/azure/client/client-projects.ts","../../src/azure/client/client-pull-requests.ts","../../src/azure/client/client-repositories.ts","../../src/azure/client/client-subscriptions.ts","../../src/azure/client/client.ts","../../src/azure/client/types.ts","../../src/azure/client/utils.ts","../../src/azure/client/wrapper.ts","../../src/azure/config.ts","../../src/azure/events.ts","../../src/azure/url-parts.ts"],"sourcesContent":["export const API_VERSION = '5.0'; // this is the same version used by dependabot-core\nexport const API_VERSION_PREVIEW = '5.0-preview';\n\n/** Returned when no user is authenticated */\nexport const ANONYMOUS_USER_ID = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa';\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 PR_PROPERTY_MICROSOFT_GIT_SOURCE_REF_NAME = 'Microsoft.Git.PullRequest.SourceRefName';\nexport const PR_PROPERTY_DEPENDABOT_PACKAGE_MANAGER = 'Dependabot.PackageManager';\nexport const PR_PROPERTY_DEPENDABOT_DEPENDENCIES = 'Dependabot.Dependencies';\n\nexport const PR_DESCRIPTION_MAX_LENGTH = 4_000;\n","import type { KyInstance } from 'ky';\nimport { API_VERSION } from './constants';\n\nexport class BaseAzureDevOpsClient {\n constructor(protected readonly client: KyInstance) {}\n\n protected makeUrl(path: string): string;\n protected makeUrl(path: string, apiVersion: string): string;\n protected makeUrl(path: string, params: Record<string, unknown>): string;\n protected makeUrl(path: string, params: Record<string, unknown>, apiVersion: string): string;\n protected makeUrl(path: string, params?: Record<string, unknown> | string, apiVersion: string = API_VERSION): string {\n if (typeof params === 'string') {\n apiVersion = params;\n params = {};\n }\n\n const queryString = Object.entries({ 'api-version': apiVersion, ...params })\n .filter(([, value]) => value)\n .map(([key, value]) => `${key}=${value}`)\n .join('&');\n return `${path}?${queryString}`;\n }\n}\n","import { BaseAzureDevOpsClient } from './client-base';\nimport { API_VERSION_PREVIEW } from './constants';\nimport type { AzdoConnectionData } from './types';\n\nexport class ConnectionClient extends BaseAzureDevOpsClient {\n /**\n * Get the connection data for the current user.\n */\n public async get(): Promise<AzdoConnectionData> {\n return await this.client.get<AzdoConnectionData>(this.makeUrl('_apis/connectiondata', API_VERSION_PREVIEW)).json();\n }\n}\n","import { isHTTPError } from 'ky';\nimport { BaseAzureDevOpsClient } from './client-base';\nimport type {\n AzdoGitCommitDiffs,\n AzdoGitPush,\n AzdoGitPushCreate,\n AzdoGitRefUpdate,\n AzdoGitRefUpdateResult,\n AzdoRepositoryItem,\n AzdoResponse,\n} from './types';\n\nexport class GitClient extends BaseAzureDevOpsClient {\n public async getItem(\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.client\n .get<AzdoRepositoryItem>(\n this.makeUrl(\n `${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/items`,\n {\n path,\n includeContent,\n latestProcessedChange,\n },\n ),\n )\n .json();\n return item;\n } catch (e) {\n if (isHTTPError(e) && e.response.status === 404) {\n // item does not exist\n return undefined;\n }\n throw e;\n }\n }\n\n public async getPush(\n projectIdOrName: string,\n repositoryIdOrName: string,\n pushId: number,\n includeCommits?: number,\n includeRefUpdates?: boolean,\n ): Promise<AzdoGitPush> {\n return await this.client\n .get<AzdoGitPush>(\n this.makeUrl(\n `${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pushes/${pushId}`,\n {\n includeCommits,\n includeRefUpdates,\n },\n ),\n )\n .json();\n }\n\n public async createPush(\n projectIdOrName: string,\n repositoryIdOrName: string,\n push: AzdoGitPushCreate,\n ): Promise<AzdoGitPush> {\n return await this.client\n .post<AzdoGitPush>(\n this.makeUrl(\n `${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pushes`,\n ),\n { json: push },\n )\n .json();\n }\n\n public async getDiffCommits(\n projectIdOrName: string,\n repositoryIdOrName: string,\n baseVersion: string,\n targetVersion: string,\n ): Promise<AzdoGitCommitDiffs> {\n return await this.client\n .get<AzdoGitCommitDiffs>(\n this.makeUrl(\n `${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/diffs/commits`,\n {\n baseVersion,\n baseVersionType: 'commit',\n targetVersion,\n targetVersionType: 'commit',\n },\n ),\n )\n .json();\n }\n\n public async updateRef(\n projectIdOrName: string,\n repositoryIdOrName: string,\n ref: AzdoGitRefUpdate[],\n ): Promise<AzdoGitRefUpdateResult[] | undefined> {\n const response = await this.client\n .post<AzdoResponse<AzdoGitRefUpdateResult[]>>(\n this.makeUrl(\n `${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/refs`,\n ),\n { json: ref },\n )\n .json();\n return response.value;\n }\n}\n","import { BaseAzureDevOpsClient } from './client-base';\nimport type { AzdoIdentity, AzdoResponse } from './types';\n\nexport class IdentityClient extends BaseAzureDevOpsClient {\n /**\n * Get the identities that match the given user name, email, or group name.\n * Requires scope \"Identity (Read)\" (vso.identity).\n * @param filterValue username, email, or group name\n * @returns\n */\n public async get(filterValue: string): Promise<AzdoIdentity[] | undefined> {\n const response = await this.client\n .get<AzdoResponse<AzdoIdentity[]>>(\n this.makeUrl('_apis/identities', {\n searchFilter: 'General',\n filterValue,\n queryMembership: 'None',\n }),\n )\n .json();\n return response?.value;\n }\n}\n","import { BaseAzureDevOpsClient } from './client-base';\nimport type { AzdoProject, AzdoResponse } from './types';\n\nexport class ProjectsClient extends BaseAzureDevOpsClient {\n public async list(): Promise<AzdoProject[] | undefined> {\n const response = await this.client.get<AzdoResponse<AzdoProject[]>>(this.makeUrl('_apis/projects')).json();\n return response?.value;\n }\n\n public async get(idOrName: string): Promise<AzdoProject | undefined> {\n return await this.client.get<AzdoProject>(this.makeUrl(`_apis/projects/${encodeURIComponent(idOrName)}`)).json();\n }\n}\n","import { BaseAzureDevOpsClient } from './client-base';\nimport type {\n AzdoGitCommitRef,\n AzdoIdentityRefWithVote,\n AzdoProperties,\n AzdoPullRequest,\n AzdoPullRequestCommentThread,\n AzdoPullRequestStatus,\n AzdoResponse,\n} from './types';\n\nexport class PullRequestsClient extends BaseAzureDevOpsClient {\n /**\n * List pull requests\n * Requires scope \"Code (Read)\" (vso.code).\n * @param projectIdOrName\n * @param repositoryIdOrName\n * @param creatorId ID of the user who created the pull requests\n * @param status The status of the pull requests to filter by\n */\n public async list(\n projectIdOrName: string,\n repositoryIdOrName: string,\n creatorId: string,\n status: AzdoPullRequestStatus,\n ): Promise<AzdoPullRequest[] | undefined> {\n const response = await this.client\n .get<AzdoResponse<AzdoPullRequest[]>>(\n this.makeUrl(\n `${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pullrequests`,\n {\n 'searchCriteria.creatorId': creatorId,\n 'searchCriteria.status': status,\n },\n ),\n )\n .json();\n return response?.value;\n }\n\n public async get(\n projectIdOrName: string,\n repositoryIdOrName: string,\n pullRequestId: number,\n ): Promise<AzdoPullRequest | undefined> {\n return await this.client\n .get<AzdoPullRequest>(\n this.makeUrl(\n `${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pullrequests/${pullRequestId}`,\n ),\n )\n .json();\n }\n\n public async create(\n projectIdOrName: string,\n repositoryIdOrName: string,\n pr: Partial<AzdoPullRequest>,\n ): Promise<AzdoPullRequest> {\n return await this.client\n .post<AzdoPullRequest>(\n this.makeUrl(\n `${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pullrequests`,\n ),\n { json: pr },\n )\n .json();\n }\n\n public async update(\n projectIdOrName: string,\n repositoryIdOrName: string,\n pullRequestId: number,\n pr: Partial<AzdoPullRequest>,\n ): Promise<AzdoPullRequest> {\n return await this.client\n .patch<AzdoPullRequest>(\n this.makeUrl(\n `${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pullrequests/${pullRequestId}`,\n ),\n { json: pr },\n )\n .json();\n }\n\n public async getProperties(\n projectIdOrName: string,\n repositoryIdOrName: string,\n pullRequestId: number,\n ): Promise<{ name: string; value: string }[]> {\n const response = await this.client\n .get<AzdoResponse<AzdoProperties>>(\n this.makeUrl(\n `${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pullrequests/${pullRequestId}/properties`,\n ),\n )\n .json();\n\n return Object.entries(response?.value || {})\n .filter(([, val]) => val?.$value)\n .map(([key, val]) => ({\n name: key,\n value: val.$value,\n }));\n }\n\n public async setProperties(\n projectIdOrName: string,\n repositoryIdOrName: string,\n pullRequestId: number,\n properties: { name: string; value: string }[],\n ): Promise<AzdoResponse<AzdoProperties>> {\n return await this.client\n .patch<AzdoResponse<AzdoProperties>>(\n this.makeUrl(\n `${projectIdOrName}/_apis/git/repositories/${repositoryIdOrName}/pullrequests/${pullRequestId}/properties`,\n ),\n {\n headers: { 'Content-Type': 'application/json-patch+json' },\n json: properties.map((property) => {\n return {\n op: 'add',\n path: `/${property.name}`,\n value: property.value,\n };\n }),\n },\n )\n .json();\n }\n\n /**\n * Approve a pull request.\n * Requires scope \"Code (Write)\" (vso.code_write).\n */\n public async approve(\n projectIdOrName: string,\n repositoryIdOrName: string,\n pullRequestId: number,\n userId: string,\n ): Promise<AzdoIdentityRefWithVote> {\n return await this.client\n .put<AzdoIdentityRefWithVote>(\n this.makeUrl(\n `${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pullrequests/${pullRequestId}/reviewers/${userId}`,\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 {\n json: {\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/paklo/issues/1069\n isReapprove: true,\n },\n },\n )\n .json();\n }\n\n /**\n * Abandon a pull request.\n * Requires scope \"Code (Write)\" (vso.code_write).\n */\n public async abandon(\n projectIdOrName: string,\n repositoryIdOrName: string,\n pullRequestId: number,\n userId: string,\n ): Promise<AzdoPullRequest> {\n return await this.client\n .patch<AzdoPullRequest>(\n this.makeUrl(\n `${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pullrequests/${pullRequestId}`,\n ),\n {\n json: {\n status: 'abandoned',\n closedBy: { id: userId },\n } satisfies Pick<AzdoPullRequest, 'status' | 'closedBy'>,\n },\n )\n .json();\n }\n\n /**\n * Get commits of a pull request.\n * Requires scope \"Code (Read)\" (vso.code_read).\n */\n public async getCommits(\n projectIdOrName: string,\n repositoryIdOrName: string,\n pullRequestId: number,\n ): Promise<AzdoGitCommitRef[] | undefined> {\n const response = await this.client\n .get<AzdoResponse<AzdoGitCommitRef[]>>(\n this.makeUrl(\n `${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pullrequests/${pullRequestId}/commits`,\n ),\n )\n .json();\n return response?.value;\n }\n\n /**\n * Create a comment thread on a pull request.\n * Requires scope \"Code (Write)\" (vso.code_write).\n */\n public async createCommentThread(\n projectIdOrName: string,\n repositoryIdOrName: string,\n pullRequestId: number,\n thread: Partial<AzdoPullRequestCommentThread>,\n ): Promise<AzdoPullRequestCommentThread> {\n return await this.client\n .post<AzdoPullRequestCommentThread>(\n this.makeUrl(\n `${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}/pullrequests/${pullRequestId}/threads`,\n ),\n { json: thread },\n )\n .json();\n }\n}\n","import { isHTTPError } from 'ky';\nimport { BaseAzureDevOpsClient } from './client-base';\nimport type { AzdoGitBranchStats, AzdoGitRef, AzdoRepository, AzdoResponse } from './types';\n\nexport class RepositoriesClient extends BaseAzureDevOpsClient {\n public async list(projectIdOrName: string): Promise<AzdoRepository[] | undefined> {\n const repos = await this.client\n .get<AzdoResponse<AzdoRepository[]>>(\n this.makeUrl(`${encodeURIComponent(projectIdOrName)}/_apis/git/repositories`),\n )\n .json();\n return repos?.value;\n }\n\n public async get(projectIdOrName: string, repositoryIdOrName: string): Promise<AzdoRepository | undefined> {\n try {\n const repo = await this.client\n .get<AzdoRepository>(\n this.makeUrl(\n `${encodeURIComponent(projectIdOrName)}/_apis/git/repositories/${encodeURIComponent(repositoryIdOrName)}`,\n ),\n )\n .json();\n return repo;\n } catch (e) {\n if (isHTTPError(e) && e.response.status === 404) {\n // repository no longer exists\n return undefined;\n }\n throw e;\n }\n }\n\n /**\n * Get the list of refs (a.k.a branch names) for a repository.\n * Requires scope \"Code (Read)\" (vso.code).\n * @param projectIdOrName\n * @param repositoryIdOrName\n * @returns\n */\n public async getRefs(projectIdOrName: string, repositoryIdOrName: string): Promise<AzdoGitRef[] | undefined> {\n const refs = await this.client\n .get<AzdoResponse<AzdoGitRef[]>>(\n this.makeUrl(`${projectIdOrName}/_apis/git/repositories/${repositoryIdOrName}/refs`),\n )\n .json();\n\n return refs?.value;\n }\n\n public async getBranchStats(\n projectIdOrName: string,\n repositoryIdOrName: string,\n branchName: string,\n ): Promise<AzdoGitBranchStats | undefined> {\n return await this.client\n .get<AzdoGitBranchStats>(\n this.makeUrl(`${projectIdOrName}/_apis/git/repositories/${repositoryIdOrName}/stats/branches`, {\n name: branchName,\n }),\n )\n .json();\n }\n}\n","import { BaseAzureDevOpsClient } from './client-base';\nimport type { AzdoSubscription, AzdoSubscriptionsQuery, AzdoSubscriptionsQueryResponse } from './types';\n\nexport class HookSubscriptionsClient extends BaseAzureDevOpsClient {\n public async query(query: AzdoSubscriptionsQuery): Promise<AzdoSubscription[]> {\n const response = await this.client\n .post<AzdoSubscriptionsQueryResponse>(this.makeUrl('_apis/hooks/subscriptionsquery'), { json: query })\n .json();\n return response?.results;\n }\n\n public async create(subscription: Partial<AzdoSubscription>): Promise<AzdoSubscription> {\n const response = await this.client\n .post<AzdoSubscription>(this.makeUrl('_apis/hooks/subscriptions'), { json: subscription })\n .json();\n return response;\n }\n\n public async replace(subscriptionId: string, subscription: AzdoSubscription): Promise<AzdoSubscription> {\n const response = await this.client\n .put<AzdoSubscription>(this.makeUrl(`_apis/hooks/subscriptions/${subscriptionId}`), { json: subscription })\n .json();\n return response;\n }\n\n public async delete(subscriptionId: string): Promise<void> {\n await this.client.delete(this.makeUrl(`_apis/hooks/subscriptions/${subscriptionId}`)).json();\n }\n}\n","import ky, { isHTTPError, type Options as KyOptions } from 'ky';\nimport { logger } from '@/logger';\nimport type { AzureDevOpsOrganizationUrl } from '../url-parts';\nimport { ConnectionClient } from './client-connection';\nimport { GitClient } from './client-git';\nimport { IdentityClient } from './client-identity';\nimport { ProjectsClient } from './client-projects';\nimport { PullRequestsClient } from './client-pull-requests';\nimport { RepositoriesClient } from './client-repositories';\nimport { HookSubscriptionsClient } from './client-subscriptions';\n\nexport class AzureDevOpsClient {\n public readonly organizationSlug: string;\n public readonly organizationUrl: string;\n public readonly connection: ConnectionClient;\n public readonly identity: IdentityClient;\n public readonly projects: ProjectsClient;\n public readonly repositories: RepositoriesClient;\n public readonly git: GitClient;\n public readonly pullRequests: PullRequestsClient;\n public readonly subscriptions: HookSubscriptionsClient;\n\n constructor(url: AzureDevOpsOrganizationUrl, accessToken: string, debug: boolean = false) {\n this.organizationSlug = url.organization;\n const organizationUrl = url.value.toString().replace(/\\/$/, ''); // trim trailing slash\n this.organizationUrl = organizationUrl;\n const mainClientOptions = AzureDevOpsClient.createClientOptions(accessToken, debug, {\n prefixUrl: organizationUrl,\n });\n const mainClient = ky.create(mainClientOptions);\n this.connection = new ConnectionClient(mainClient);\n this.projects = new ProjectsClient(mainClient);\n this.repositories = new RepositoriesClient(mainClient);\n this.git = new GitClient(mainClient);\n this.pullRequests = new PullRequestsClient(mainClient);\n this.subscriptions = new HookSubscriptionsClient(mainClient);\n\n const identityApiUrl = url['identity-api-url'].toString().replace(/\\/$/, ''); // trim trailing slash\n const identityClient = ky.create({ ...mainClientOptions, prefixUrl: identityApiUrl });\n this.identity = new IdentityClient(identityClient);\n }\n\n private static createClientOptions(accessToken: string, debug: boolean, options?: KyOptions): KyOptions {\n return {\n headers: {\n Authorization: `Basic ${Buffer.from(`:${accessToken}`).toString('base64')}`,\n Accept: 'application/json',\n },\n hooks: {\n beforeRequest: [\n async (request, options) => {\n if (debug) logger.debug(`🌎 🠊 [${request.method}] ${request.url}`);\n },\n ],\n afterResponse: [\n async (request, options, response) => {\n if (debug) {\n logger.debug(`🌎 🠈 [${response.status}] ${response.statusText}`);\n\n // log the request and response for debugging\n if (request.body) {\n logger.debug(`REQUEST: ${JSON.stringify(request.body)}`);\n }\n // const body = await response.text();\n // if (body) {\n // logger.debug(`RESPONSE: ${body}`);\n // }\n }\n },\n ],\n beforeRetry: [\n async ({ request, options, error, retryCount }) => {\n if (debug && isHTTPError(error)) {\n logger.debug(`⏳ Retrying failed request with status code: ${error.response.status}`);\n }\n },\n ],\n },\n retry: {\n limit: 3,\n delay: (attempt) => 3000, // all attempts after 3 seconds\n },\n ...options,\n };\n }\n}\n","import { z } from 'zod';\n\nexport const AzdoVersionControlChangeTypeSchema = z.enum([\n 'none',\n 'add',\n 'edit',\n 'encoding',\n 'rename',\n 'delete',\n 'undelete',\n 'branch',\n 'merge',\n 'lock',\n 'rollback',\n 'sourceRename',\n 'targetRename',\n 'property',\n 'all',\n]);\nexport type AzdoVersionControlChangeType = z.infer<typeof AzdoVersionControlChangeTypeSchema>;\n\nexport const AZDO_PULL_REQUEST_MERGE_STRATEGIES = ['noFastForward', 'squash', 'rebase', 'rebaseMerge'] as const;\nexport const AzdoPullRequestMergeStrategySchema = z.enum(AZDO_PULL_REQUEST_MERGE_STRATEGIES);\nexport type AzdoPullRequestMergeStrategy = z.infer<typeof AzdoPullRequestMergeStrategySchema>;\n\nexport const AzdoCommentThreadStatusSchema = z.enum([\n 'unknown',\n 'active',\n 'fixed',\n 'wontFix',\n 'closed',\n 'byDesign',\n 'pending',\n]);\nexport type AzdoCommentThreadStatus = z.infer<typeof AzdoCommentThreadStatusSchema>;\nexport const AzdoCommentTypeSchema = z.enum(['unknown', 'text', 'codeChange', 'system']);\nexport type AzdoCommentType = z.infer<typeof AzdoCommentTypeSchema>;\n\nexport const AzdoPullRequestAsyncStatusSchema = z.enum([\n 'notSet',\n 'queued',\n 'conflicts',\n 'succeeded',\n 'rejectedByPolicy',\n 'failure',\n]);\nexport type AzdoPullRequestAsyncStatus = z.infer<typeof AzdoPullRequestAsyncStatusSchema>;\nexport const AzdoPullRequestStatusSchema = z.enum(['notSet', 'active', 'abandoned', 'completed', 'all']);\nexport type AzdoPullRequestStatus = z.infer<typeof AzdoPullRequestStatusSchema>;\n\nexport const AzdoProjectSchema = z.object({\n id: z.string(),\n name: z.string(),\n description: z.string().optional(),\n url: z.string(),\n state: z.enum(['deleting', 'new', 'wellFormed', 'createPending', 'all', 'unchanged', 'deleted']),\n _links: z\n .object({\n self: z.object({ href: z.string() }),\n collection: z.object({ href: z.string() }),\n web: z.object({ href: z.string() }),\n })\n .optional(),\n});\nexport type AzdoProject = z.infer<typeof AzdoProjectSchema>;\n\nexport const AzdoRepositorySchema = z.object({\n id: z.string(),\n name: z.string(),\n defaultBranch: z.string().optional(),\n project: AzdoProjectSchema,\n isDisabled: z.boolean().optional(),\n isFork: z.boolean().optional(),\n url: z.string(),\n remoteUrl: z.string(),\n webUrl: z.string(),\n});\nexport type AzdoRepository = z.infer<typeof AzdoRepositorySchema>;\n\nexport type AzdoResponse<T> = {\n value?: T;\n count: number;\n};\n\nexport const AzdoIdentitySchema = z.object({\n id: z.string(),\n displayName: z.string(),\n url: z.string(),\n});\nexport type AzdoIdentity = z.infer<typeof AzdoIdentitySchema>;\nexport const AzdoIdentityRefSchema = z.object({\n id: z.string().optional(),\n displayName: z.string().optional(),\n uniqueName: z.string().optional(),\n url: z.string().optional(),\n});\nexport type AzdoIdentityRef = z.infer<typeof AzdoIdentityRefSchema>;\n\nexport const AzdoConnectionDataSchema = z.object({\n authenticatedUser: AzdoIdentitySchema,\n authorizedUser: AzdoIdentitySchema,\n});\nexport type AzdoConnectionData = z.infer<typeof AzdoConnectionDataSchema>;\n\nexport const AzdoGitUserDateSchema = z.object({\n name: z.string(),\n email: z.string(),\n date: z.string().optional(),\n});\nexport type AzdoGitUserDate = z.infer<typeof AzdoGitUserDateSchema>;\nexport const AzdoGitRefSchema = z.object({\n name: z.string(),\n objectId: z.string(),\n isLocked: z.boolean().optional(),\n});\nexport type AzdoGitRef = z.infer<typeof AzdoGitRefSchema>;\nexport const AzdoGitRefUpdateResultSchema = AzdoGitRefSchema.extend({\n oldObjectId: z.string(),\n newObjectId: z.string(),\n success: z.boolean(),\n customMessage: z.string().optional(),\n});\nexport type AzdoGitRefUpdateResult = z.infer<typeof AzdoGitRefUpdateResultSchema>;\nexport const AzdoGitChangeSchema = z.object({\n changeType: AzdoVersionControlChangeTypeSchema,\n item: z.object({ path: z.string() }).optional(), // current version (path)\n newContent: z\n .object({\n content: z.string(),\n contentType: z.enum(['rawtext', 'base64encoded']),\n })\n .optional(),\n originalPath: z.string().optional(), // original path of the item if different from current path\n});\nexport type AzdoGitChange = z.infer<typeof AzdoGitChangeSchema>;\nexport const AzdoGitCommitRefSchema = z.object({\n commitId: z.string(),\n author: AzdoGitUserDateSchema.optional(),\n committer: AzdoGitUserDateSchema.optional(),\n changes: AzdoGitChangeSchema.array().optional(),\n});\nexport type AzdoGitCommitRef = z.infer<typeof AzdoGitCommitRefSchema>;\nexport const AzdoGitPushSchema = z.object({\n commits: AzdoGitCommitRefSchema.array(),\n refUpdates: AzdoGitRefSchema.array(),\n});\nexport type AzdoGitPush = z.infer<typeof AzdoGitPushSchema>;\nexport const AzdoGitRefUpdateSchema = z.object({\n name: z.string(),\n oldObjectId: z.string(),\n newObjectId: z.string().optional(),\n isLocked: z.boolean().optional(),\n});\nexport type AzdoGitRefUpdate = z.infer<typeof AzdoGitRefUpdateSchema>;\nexport const AzdoGitPushCreateSchema = z.object({\n refUpdates: AzdoGitRefUpdateSchema.array(),\n commits: z\n .object({\n comment: z.string(),\n author: AzdoGitUserDateSchema.optional(),\n changes: AzdoGitChangeSchema.array(),\n })\n .array(),\n});\nexport type AzdoGitPushCreate = z.infer<typeof AzdoGitPushCreateSchema>;\nexport const AzdoGitBranchStatsSchema = z.object({\n aheadCount: z.number(),\n behindCount: z.number(),\n});\nexport type AzdoGitBranchStats = z.infer<typeof AzdoGitBranchStatsSchema>;\nexport const AzdoGitCommitDiffsSchema = z.object({\n allChangesIncluded: z.boolean(),\n baseCommit: z.string(),\n changes: AzdoGitChangeSchema.array(),\n targetCommit: z.string(),\n});\nexport type AzdoGitCommitDiffs = z.infer<typeof AzdoGitCommitDiffsSchema>;\n\nexport const AzdoRepositoryItemSchema = z.object({\n latestProcessedChange: AzdoGitCommitRefSchema.optional(),\n content: z.string().optional(),\n});\nexport type AzdoRepositoryItem = z.infer<typeof AzdoRepositoryItemSchema>;\n\nexport const AzdoIdentityRefWithVoteSchema = z.object({\n id: z.string().optional(),\n displayName: z.string().optional(),\n vote: z.number().optional(),\n hasDeclined: z.boolean().optional(),\n isFlagged: z.boolean().optional(),\n isRequired: z.boolean().optional(),\n});\nexport type AzdoIdentityRefWithVote = z.infer<typeof AzdoIdentityRefWithVoteSchema>;\n\nexport const AzdoPullRequestSchema = z.object({\n pullRequestId: z.number(),\n status: AzdoPullRequestStatusSchema,\n isDraft: z.boolean(),\n sourceRefName: z.string(),\n targetRefName: z.string(),\n title: z.string(),\n description: z.string().optional(),\n lastMergeCommit: AzdoGitCommitRefSchema,\n lastMergeSourceCommit: AzdoGitCommitRefSchema,\n mergeStatus: AzdoPullRequestAsyncStatusSchema,\n reviewers: AzdoIdentityRefWithVoteSchema.array().optional(),\n workItemRefs: z.object({ id: z.string() }).array().optional(),\n labels: z.object({ name: z.string() }).array().optional(),\n autoCompleteSetBy: AzdoIdentityRefSchema.optional(),\n completionOptions: z\n .object({\n autoCompleteIgnoreConfigIds: z.number().array().optional(),\n deleteSourceBranch: z.boolean().optional(),\n mergeCommitMessage: z.string().optional(),\n mergeStrategy: AzdoPullRequestMergeStrategySchema.optional(),\n transitionWorkItems: z.boolean().optional(),\n })\n .optional(),\n closedBy: AzdoIdentityRefSchema.optional(),\n});\nexport type AzdoPullRequest = z.infer<typeof AzdoPullRequestSchema>;\n\nexport const AzdoPropertiesSchema = z.record(\n z.string(),\n z.object({\n $type: z.string(),\n $value: z.string(),\n }),\n);\nexport type AzdoProperties = z.infer<typeof AzdoPropertiesSchema>;\n\nexport const AzdoPullRequestCommentSchema = z.object({\n id: z.number().optional(),\n parentCommentId: z.number().optional(),\n content: z.string(),\n commentType: AzdoCommentTypeSchema,\n publishedDate: z.string().optional(),\n author: AzdoIdentityRefSchema,\n});\nexport type AzdoPullRequestComment = z.infer<typeof AzdoPullRequestCommentSchema>;\nexport const AzdoPullRequestCommentThreadSchema = z.object({\n id: z.number(),\n comments: AzdoPullRequestCommentSchema.array(),\n status: AzdoCommentThreadStatusSchema,\n});\nexport type AzdoPullRequestCommentThread = z.infer<typeof AzdoPullRequestCommentThreadSchema>;\n\nexport const AzdoSubscriptionSchema = z.object({\n id: z.string(),\n status: z.enum(['enabled', 'onProbation', 'disabledByUser', 'disabledBySystem', 'disabledByInactiveIdentity']),\n publisherId: z.string(),\n publisherInputs: z.record(z.string(), z.string()),\n consumerId: z.string().optional(),\n consumerActionId: z.string().optional(),\n consumerInputs: z.record(z.string(), z.string()),\n eventType: z.string(), // not enum because we do not know all the values\n resourceVersion: z.string(),\n eventDescription: z.string().optional(),\n actionDescription: z.string().optional(),\n});\nexport type AzdoSubscription = z.infer<typeof AzdoSubscriptionSchema>;\n\nexport const AzdoSubscriptionsQueryResponseSchema = z.object({\n results: AzdoSubscriptionSchema.array(),\n});\nexport type AzdoSubscriptionsQueryResponse = z.infer<typeof AzdoSubscriptionsQueryResponseSchema>;\n\nexport const AzdoSubscriptionsQueryInputFilterSchema = z.object({\n conditions: z\n .object({\n caseSensitive: z.boolean().optional(),\n inputId: z.string().optional(),\n inputValue: z.string().optional(),\n operator: z.enum(['equals', 'notEquals']),\n })\n .array()\n .optional(),\n});\nexport type AzdoSubscriptionsQueryInputFilter = z.infer<typeof AzdoSubscriptionsQueryInputFilterSchema>;\n\nexport const AzdoSubscriptionsQuerySchema = z.object({\n consumerActionId: z.string().optional(),\n consumerId: z.string().optional(),\n consumerInputFilters: AzdoSubscriptionsQueryInputFilterSchema.array().optional(),\n eventType: z.string().optional(),\n publisherId: z.string().optional(),\n publisherInputFilters: AzdoSubscriptionsQueryInputFilterSchema.array().optional(),\n subscriberId: z.string().optional(),\n});\nexport type AzdoSubscriptionsQuery = z.infer<typeof AzdoSubscriptionsQuerySchema>;\n\nexport type AzdoPrExtractedWithProperties = {\n pullRequestId: number;\n properties?: { name: string; value: string }[];\n};\n\nexport type AzdoFileChange = {\n changeType: AzdoVersionControlChangeType;\n path: string;\n content?: string;\n encoding?: 'utf-8' | 'base64';\n};\n","import * as path from 'node:path';\nimport { z } from 'zod';\n\nimport {\n areEqual,\n type DependabotCreatePullRequest,\n type DependabotExistingGroupPr,\n type DependabotExistingPr,\n DependabotExistingPrDependencySchema,\n type DependabotPersistedPr,\n DependabotPersistedPrSchema,\n type DependabotUpdatePullRequest,\n getDependencyNames,\n} from '@/dependabot';\nimport { PR_PROPERTY_DEPENDABOT_DEPENDENCIES, PR_PROPERTY_DEPENDABOT_PACKAGE_MANAGER } from './constants';\nimport type { AzdoFileChange, AzdoPrExtractedWithProperties, AzdoVersionControlChangeType } from './types';\n\nexport function buildPullRequestProperties(packageManager: string, dependencies: DependabotPersistedPr) {\n return [\n { name: PR_PROPERTY_DEPENDABOT_PACKAGE_MANAGER, value: packageManager },\n { name: PR_PROPERTY_DEPENDABOT_DEPENDENCIES, value: JSON.stringify(dependencies) },\n ];\n}\n\nexport function parsePullRequestProps(\n pr: AzdoPrExtractedWithProperties,\n): DependabotExistingPr | DependabotExistingGroupPr {\n // TODO: remove legacy format support on or after 2026-03-26 (it would be 90 days later)\n const WithLegacySchema = z.union([\n DependabotPersistedPrSchema,\n // legacy format to be removed in the future\n DependabotExistingPrDependencySchema.array(),\n ]);\n\n const parsed = WithLegacySchema.parse(\n JSON.parse(pr.properties!.find((p) => p.name === PR_PROPERTY_DEPENDABOT_DEPENDENCIES)!.value),\n );\n if (Array.isArray(parsed)) {\n return { 'pr-number': pr.pullRequestId, dependencies: parsed };\n } else {\n return { 'pr-number': pr.pullRequestId, ...parsed };\n }\n}\n\nfunction filterPullRequestsByPackageManager(pr: AzdoPrExtractedWithProperties, packageManager: string) {\n return pr.properties?.find((p) => p.name === PR_PROPERTY_DEPENDABOT_PACKAGE_MANAGER && p.value === packageManager);\n}\n\nexport function parsePullRequestProperties(\n pullRequests: AzdoPrExtractedWithProperties[],\n packageManager: string,\n): (DependabotExistingPr | DependabotExistingGroupPr)[] {\n return pullRequests.filter((pr) => filterPullRequestsByPackageManager(pr, packageManager)).map(parsePullRequestProps);\n}\n\nexport function getPullRequestForDependencyNames(\n existingPullRequests: AzdoPrExtractedWithProperties[],\n packageManager: string,\n dependencyNames: string[],\n dependencyGroupName?: string | null,\n): AzdoPrExtractedWithProperties | undefined {\n return existingPullRequests\n .filter((pr) => filterPullRequestsByPackageManager(pr, packageManager))\n .find((pr) => {\n const parsedPr = parsePullRequestProps(pr);\n const prGroupName = 'dependency-group-name' in parsedPr ? parsedPr['dependency-group-name'] : null;\n\n // For grouped PRs: match by group name (dependencies can vary)\n if (dependencyGroupName) {\n return prGroupName === dependencyGroupName;\n }\n\n // For non-grouped PRs: match by exact dependency names\n return !prGroupName && areEqual(getDependencyNames(parsedPr), dependencyNames);\n });\n}\n\nexport function getPullRequestChangedFiles(data: DependabotCreatePullRequest | DependabotUpdatePullRequest) {\n return data['updated-dependency-files']\n .filter((file) => file.type === 'file')\n .map((file) => {\n let changeType: AzdoVersionControlChangeType = 'none';\n if (file.deleted === true || file.operation === 'delete') {\n changeType = 'delete';\n } else if (file.operation === 'update') {\n changeType = 'edit';\n } else {\n changeType = '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 AzdoFileChange;\n });\n}\n","import { normalizeBranchName, normalizeFilePath } from '@/dependabot';\nimport { logger } from '@/logger';\nimport type { AzdoEvent, AzdoEventType } from '../events';\nimport type { AzureDevOpsOrganizationUrl } from '../url-parts';\nimport { AzureDevOpsClient } from './client';\nimport type {\n AzdoFileChange,\n AzdoGitUserDate,\n AzdoIdentityRefWithVote,\n AzdoPrExtractedWithProperties,\n AzdoPullRequestMergeStrategy,\n AzdoSubscriptionsQuery,\n} from './types';\n\ntype AzdoRepositoryOptions = { project: string; repository: string };\n\ntype AzdoPullRequestCreateOptions = AzdoRepositoryOptions & {\n source: { branch: string; commit: string };\n target: { branch: string };\n author: AzdoGitUserDate;\n title: string;\n description: string;\n commitMessage: string;\n autoComplete?: {\n ignorePolicyConfigIds?: number[];\n mergeStrategy?: AzdoPullRequestMergeStrategy;\n };\n assignees?: string[];\n labels?: string[];\n workItems?: string[];\n changes: AzdoFileChange[];\n properties?: { name: string; value: string }[];\n};\n\ntype AzdoPullRequestOptions = AzdoRepositoryOptions & { pullRequestId: number };\n\ntype AzdoPullRequestUpdateOptions = AzdoPullRequestOptions & {\n commit: string;\n author: AzdoGitUserDate;\n changes: AzdoFileChange[];\n};\n\ntype AzdoPullRequestAbandonOptions = AzdoPullRequestOptions & {\n comment?: string;\n deleteSourceBranch?: boolean;\n};\n\ntype AzdoPullRequestCommentCreateOptions = AzdoPullRequestOptions & {\n content: string;\n userId?: string;\n};\n\nexport class AzureDevOpsClientWrapper {\n public readonly inner: AzureDevOpsClient;\n\n private authenticatedUserId?: string;\n private resolvedUserIds: Record<string, string> = {};\n\n /**\n * Create a new Azure DevOps client wrapper.\n * @param url The Azure DevOps organization URL\n * @param accessToken The personal access token for authentication\n * @param debug Enable debug logging for API requests (default: false)\n */\n constructor(url: AzureDevOpsOrganizationUrl, accessToken: string, debug: boolean = false) {\n this.inner = new AzureDevOpsClient(url, accessToken, debug);\n }\n\n /**\n * Get the identity of the authenticated user.\n * The result is cached after the first call to avoid repeated API requests.\n */\n public async getUserId(): Promise<string> {\n if (!this.authenticatedUserId) {\n const connectionData = await this.inner.connection.get();\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 * Results are cached to avoid repeated API requests for the same identifier.\n *\n * Requires scope \"Identity (Read)\" (vso.identity).\n * @param identifier Username, email, or group name to resolve\n * @returns The resolved identity ID, or undefined if not found or on error\n */\n public async resolveIdentityId(identifier: string): Promise<string | undefined> {\n if (this.resolvedUserIds[identifier]) {\n return this.resolvedUserIds[identifier];\n }\n try {\n const identities = await this.inner.identity.get(identifier);\n if (!identities || identities.length === 0) {\n return undefined;\n }\n this.resolvedUserIds[identifier] = identities[0]!.id;\n return this.resolvedUserIds[identifier];\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 /**\n * Get the default branch for a repository.\n *\n * Requires scope \"Code (Read)\" (vso.code).\n * @param options Repository identification options (project and repository)\n * @returns The normalized default branch name (e.g., \"main\"), or undefined if not found\n */\n public async getDefaultBranch(options: AzdoRepositoryOptions): Promise<string | undefined> {\n return normalizeBranchName((await this.inner.repositories.get(options.project, options.repository))?.defaultBranch);\n }\n\n /**\n * Get the list of branch names for a repository.\n *\n * Requires scope \"Code (Read)\" (vso.code).\n * @param options Repository identification options (project and repository)\n * @returns Array of normalized branch names, or undefined if not found\n */\n public async getBranchNames(options: AzdoRepositoryOptions): Promise<string[] | undefined> {\n return (await this.inner.repositories.getRefs(options.project, options.repository))?.map((r) =>\n normalizeBranchName(r.name),\n );\n }\n\n /**\n * Get the properties for all active pull requests created by the specified user.\n * This retrieves both the pull request IDs and their associated properties.\n *\n * Requires scope \"Code (Read)\" (vso.code).\n * @param options Repository identification options including the creator user ID\n * @returns Array of pull request IDs with their properties, empty array on error\n */\n public async getActivePullRequestProperties({\n project,\n repository,\n creatorId,\n }: AzdoRepositoryOptions & { creatorId: string }): Promise<AzdoPrExtractedWithProperties[]> {\n try {\n const pullRequests = await this.inner.pullRequests.list(project, repository, creatorId, 'active');\n if (!pullRequests || pullRequests.length === 0) {\n return [];\n }\n\n return await Promise.all(\n pullRequests.map(async (pr) => {\n const properties = await this.inner.pullRequests.getProperties(project, repository, pr.pullRequestId);\n return { pullRequestId: pr.pullRequestId, properties };\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 with the specified changes.\n * This method performs the following operations:\n * 1. Resolves assignee identities for assignees (if specified)\n * 2. Creates a new branch and pushes changes\n * 3. Creates the pull request with assignees (optional reviewers), labels, and work items\n * 4. Sets pull request properties for dependency metadata\n * 5. Configures auto-complete options (if specified)\n *\n * Requires scope \"Code (Write)\" (vso.code_write).\n * Requires scope \"Identity (Read)\" (vso.identity), if assignees are specified.\n * @param options Pull request creation options including changes, assignees, and auto-complete settings\n * @returns The created pull request ID, or null on error\n */\n public async createPullRequest(options: AzdoPullRequestCreateOptions): Promise<number | null> {\n logger.info(`Creating pull request '${options.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: AzdoIdentityRefWithVote[] = [];\n if (options.assignees && options.assignees.length > 0) {\n for (const assignee of options.assignees) {\n const identityId = this.isGuid(assignee) ? assignee : await this.resolveIdentityId(assignee);\n if (identityId && !reviewers.some((r) => r.id === identityId)) {\n reviewers.push({ id: identityId });\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 ${options.changes.length} file change(s) to branch '${options.source.branch}'...`);\n const push = await this.inner.git.createPush(options.project, options.repository, {\n refUpdates: [\n {\n name: `refs/heads/${options.source.branch}`,\n oldObjectId: options.source.commit,\n },\n ],\n commits: [\n {\n comment: options.commitMessage,\n author: options.author,\n changes: options.changes\n .filter((change) => change.changeType !== 'none')\n .map(({ changeType, ...change }) => {\n return {\n changeType,\n item: { path: normalizeFilePath(change.path) },\n newContent:\n changeType !== 'delete'\n ? {\n content: Buffer.from(change.content!, <BufferEncoding>change.encoding).toString('base64'),\n contentType: 'base64encoded',\n }\n : undefined,\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) => c.commitId).join(', ')}.`);\n\n // Create the pull request\n logger.info(` - Creating pull request to merge '${options.source.branch}' into '${options.target.branch}'...`);\n const pullRequest = await this.inner.pullRequests.create(options.project, options.repository, {\n sourceRefName: `refs/heads/${options.source.branch}`,\n targetRefName: `refs/heads/${options.target.branch}`,\n title: options.title,\n description: options.description,\n reviewers,\n workItemRefs: options.workItems?.map((id) => ({ id: id })),\n labels: options.labels?.map((label) => ({ name: label })),\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 (options.properties && options.properties.length > 0) {\n logger.info(` - Adding dependency metadata to pull request properties...`);\n const newProperties = await this.inner.pullRequests.setProperties(\n options.project,\n options.repository,\n pullRequest.pullRequestId,\n options.properties,\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 (options.autoComplete) {\n logger.info(` - Updating auto-complete options...`);\n const updatedPullRequest = await this.inner.pullRequests.update(\n options.project,\n options.repository,\n pullRequest.pullRequestId,\n {\n autoCompleteSetBy: { id: userId },\n completionOptions: {\n autoCompleteIgnoreConfigIds: options.autoComplete.ignorePolicyConfigIds,\n deleteSourceBranch: true,\n mergeCommitMessage: this.mergeCommitMessage(\n pullRequest.pullRequestId,\n options.title,\n options.description,\n ),\n mergeStrategy: options.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 an existing pull request with new changes.\n * This method performs the following operations:\n * 1. Validates the pull request hasn't been modified by another author\n * 2. Checks if the source branch is behind the target branch\n * 3. Rebases the target branch into the source branch if needed\n * 4. Pushes the new changes to the source branch\n *\n * Requires scope \"Code (Read & Write)\" (vso.code, vso.code_write).\n * @param options Pull request update options including the commit and changes\n * @returns True if successful, false on error\n */\n public async updatePullRequest(options: AzdoPullRequestUpdateOptions): Promise<boolean> {\n logger.info(`Updating pull request #${options.pullRequestId}...`);\n try {\n // Get the pull request details\n const pullRequest = await this.inner.pullRequests.get(options.project, options.repository, options.pullRequestId);\n if (!pullRequest) {\n throw new Error(`Pull request #${options.pullRequestId} not found`);\n }\n\n // Skip if the pull request has been modified by another author\n const commits = await this.inner.pullRequests.getCommits(\n options.project,\n options.repository,\n options.pullRequestId,\n );\n if (commits?.some((c) => c.author?.email !== options.author.email)) {\n logger.info(` - Skipping update as pull request has been modified by another user.`);\n return true;\n }\n\n // Get the branch stats to check if the source branch is behind the target branch\n const stats = await this.inner.repositories.getBranchStats(\n options.project,\n options.repository,\n normalizeBranchName(pullRequest.sourceRefName),\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 (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.inner.git.updateRef(options.project, options.repository, [\n {\n name: pullRequest.sourceRefName,\n oldObjectId: pullRequest.lastMergeSourceCommit.commitId,\n newObjectId: options.commit,\n },\n ]);\n if (rebase?.[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 ${options.changes.length} file change(s) to branch '${pullRequest.sourceRefName}'...`);\n const push = await this.inner.git.createPush(options.project, options.repository, {\n refUpdates: [\n {\n name: pullRequest.sourceRefName,\n oldObjectId: options.commit,\n },\n ],\n commits: [\n {\n comment:\n pullRequest.mergeStatus === 'conflicts'\n ? 'Resolve merge conflicts'\n : `Rebase '${sourceBranchName}' onto '${targetBranchName}'`,\n author: options.author,\n changes: options.changes\n .filter((change) => change.changeType !== 'none')\n .map(({ changeType, ...change }) => {\n return {\n changeType,\n item: { path: normalizeFilePath(change.path) },\n newContent:\n changeType !== 'delete'\n ? {\n content: Buffer.from(change.content!, <BufferEncoding>change.encoding).toString('base64'),\n contentType: 'base64encoded',\n }\n : undefined,\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) => 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 as the authenticated user.\n * Sets the reviewer vote to 10 (approved).\n *\n * Requires scope \"Code (Write)\" (vso.code_write).\n * @param options Pull request identification options\n * @returns True if successful, false on error\n */\n public async approvePullRequest(options: AzdoPullRequestOptions): Promise<boolean> {\n logger.info(`Approving pull request #${options.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.inner.pullRequests.approve(\n options.project,\n options.repository,\n options.pullRequestId,\n userId,\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 and optionally delete its source branch.\n * This method performs the following operations:\n * 1. Adds an optional comment explaining the abandonment reason\n * 2. Sets the pull request status to abandoned\n * 3. Deletes the source branch if requested\n *\n * Requires scope \"Code (Write)\" (vso.code_write).\n * @param options Pull request abandonment options including optional comment and branch deletion flag\n * @returns True if successful, false on error\n */\n public async abandonPullRequest(options: AzdoPullRequestAbandonOptions): Promise<boolean> {\n logger.info(`Abandoning pull request #${options.pullRequestId}...`);\n try {\n const userId = await this.getUserId();\n\n // Add a comment to the pull request, if supplied\n if (options.comment) {\n logger.info(` - Adding abandonment reason comment to pull request...`);\n const threadId = await this.addCommentThread({\n ...options,\n content: options.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.inner.pullRequests.abandon(\n options.project,\n options.repository,\n options.pullRequestId,\n userId,\n );\n if (abandonedPullRequest?.status !== '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 (options.deleteSourceBranch) {\n logger.info(` - Deleting source branch...`);\n const deletedBranch = await this.inner.git.updateRef(options.project, options.repository, [\n {\n name: abandonedPullRequest.sourceRefName,\n oldObjectId: abandonedPullRequest.lastMergeSourceCommit.commitId,\n newObjectId: '0000000000000000000000000000000000000000',\n isLocked: false,\n },\n ]);\n if (deletedBranch?.[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 * The comment thread is created with a closed status and system comment type.\n *\n * Requires scope \"Code (Write)\" (vso.code_write).\n * @param options Comment creation options including content and optional user ID\n * @returns The created thread ID, or undefined on error\n */\n public async addCommentThread(options: AzdoPullRequestCommentCreateOptions): Promise<number | undefined> {\n const userId = options.userId ?? (await this.getUserId());\n const thread = await this.inner.pullRequests.createCommentThread(\n options.project,\n options.repository,\n options.pullRequestId,\n {\n status: 'closed',\n comments: [\n {\n author: { id: userId },\n content: options.content,\n commentType: 'system',\n },\n ],\n },\n );\n return thread?.id;\n }\n\n /**\n * Create or update webhook subscriptions for Azure DevOps events.\n * This sets up subscriptions for various git events (push, pull request updates, repository changes, etc.)\n * and ensures they are configured to send webhooks to the specified URL.\n * Existing subscriptions matching the URL will be updated, otherwise new subscriptions are created.\n *\n * Requires scope \"Service Hooks (Read & Write)\" (vso.hooks_write).\n * @returns Array of subscription IDs that were created or updated\n */\n public async createOrUpdateHookSubscriptions({\n url,\n headers,\n project,\n }: {\n url: string;\n headers: Record<string, string>;\n project: string;\n }) {\n // events are registered per project because, the git.repo.* events do not support global subscriptions\n const subscriptionTypes = new Map<AzdoEventType, AzdoEvent['resourceVersion']>([\n ['git.push', '1.0'],\n ['git.pullrequest.updated', '1.0'],\n ['git.pullrequest.merged', '1.0'],\n ['git.repo.created', '1.0-preview.1'],\n ['git.repo.deleted', '1.0-preview.1'],\n ['git.repo.renamed', '1.0-preview.1'],\n ['git.repo.statuschanged', '1.0-preview.1'],\n ['ms.vss-code.git-pullrequest-comment-event', '2.0'],\n ]);\n\n const query = this.buildSubscriptionsQuery({ url, project });\n const subscriptions = await this.inner.subscriptions.query(query);\n\n // iterate each subscription checking if creation or update is required\n const ids: string[] = [];\n for (const [eventType, resourceVersion] of subscriptionTypes) {\n // find existing one\n const existing = subscriptions.find((sub) => {\n return sub.eventType === eventType && sub.resourceVersion === resourceVersion;\n });\n\n let subscription: typeof existing;\n\n // if we have an existing one, update it, otherwise create a new one\n if (existing) {\n // publisherId, consumerId, and consumerActionId cannot be updated\n existing.status = 'enabled';\n existing.eventType = eventType;\n existing.resourceVersion = resourceVersion;\n existing.publisherInputs = this.makeTfsPublisherInputs({ eventType, project });\n existing.consumerInputs = this.makeWebhookConsumerInputs({ url, headers });\n subscription = await this.inner.subscriptions.replace(existing.id, existing);\n } else {\n subscription = await this.inner.subscriptions.create({\n status: 'enabled',\n eventType,\n resourceVersion,\n\n publisherId: 'tfs',\n publisherInputs: this.makeTfsPublisherInputs({ eventType, project }),\n consumerId: 'webHooks',\n consumerActionId: 'httpRequest',\n consumerInputs: this.makeWebhookConsumerInputs({ url, headers }),\n });\n }\n\n ids.push(subscription.id);\n }\n\n // delete any other existing subscriptions that are not in our desired list\n for (const sub of subscriptions) {\n if (!ids.includes(sub.id)) {\n await this.inner.subscriptions.delete(sub.id);\n }\n }\n }\n\n /**\n * Remove all webhook subscriptions for a specific URL.\n * This finds all subscriptions matching the provided URL and deletes them.\n *\n * Requires scope \"Service Hooks (Read & Write)\" (vso.hooks_write).\n */\n public async deleteHookSubscriptions({ url, project }: { url: string; project: string }) {\n const query = this.buildSubscriptionsQuery({ url, project });\n const subscriptions = await this.inner.subscriptions.query(query);\n\n // iterate each subscription and delete it\n for (const sub of subscriptions) {\n await this.inner.subscriptions.delete(sub.id);\n }\n }\n\n private 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\n private 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\n private buildSubscriptionsQuery({ url, project }: { url: string; project: string }): AzdoSubscriptionsQuery {\n return {\n publisherId: 'tfs',\n publisherInputFilters: [\n {\n conditions: [{ operator: 'equals', inputId: 'projectId', caseSensitive: false, inputValue: project }],\n },\n ],\n consumerId: 'webHooks',\n consumerActionId: 'httpRequest',\n consumerInputFilters: [\n {\n conditions: [{ operator: 'equals', inputId: 'url', caseSensitive: false, inputValue: url }],\n },\n ],\n };\n }\n\n private makeTfsPublisherInputs({\n eventType,\n project,\n }: {\n eventType: AzdoEventType;\n project: string;\n }): Record<string, string> {\n // possible inputs are available via an authenticated request to\n // https://dev.azure.com/{organization}/_apis/hooks/publishers/tfs\n\n return {\n projectId: project, // project to restrict events to\n\n ...(eventType === 'git.pullrequest.updated' && {\n // only trigger on updates to the pull request status (e.g. active, abandoned, completed)\n notificationType: 'StatusUpdateNotification',\n }),\n ...(eventType === 'git.pullrequest.merged' && {\n // only trigger on conflicts\n mergeResult: 'Conflicts',\n }),\n };\n }\n\n private makeWebhookConsumerInputs({\n url,\n headers,\n }: {\n url: string;\n headers: Record<string, string>;\n }): Record<string, string> {\n return {\n // possible inputs are available via an authenticated request to\n // https://dev.azure.com/{organization}/_apis/hooks/consumers/webHooks\n\n url,\n acceptUntrustedCerts: 'false',\n httpHeaders: Object.entries(headers)\n .map(([key, value]) => `${key}:${value}`)\n .join('\\n'),\n messagesToSend: 'none',\n detailedMessagesToSend: 'none',\n };\n }\n}\n","import { existsSync } from 'node:fs';\nimport { readFile } from 'node:fs/promises';\nimport * as path from 'node:path';\nimport ky from 'ky';\n\nimport {\n CONFIG_FILE_PATHS_AZURE,\n type DependabotConfig,\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 `CONFIG_FILE_PATHS_AZURE`.\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/paklo/issues/328\n */\n\n if (remote) {\n logger.debug(`Attempting to fetch configuration file via REST API ...`);\n for (const fp of CONFIG_FILE_PATHS_AZURE) {\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 ky.get(requestUrl, {\n headers: {\n Authorization: authHeader,\n Accept: '*/*', // Gotcha!!! without this SH*T fails terribly\n },\n // 401, 403 and 404 are handled explicitly\n throwHttpErrors: (status) => ![401, 403, 404].includes(status),\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 CONFIG_FILE_PATHS_AZURE) {\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: ${CONFIG_FILE_PATHS_AZURE.join(', ')}`);\n } else {\n logger.trace('Configuration file contents read.');\n }\n\n return await parseDependabotConfig({ configContents, configPath, variableFinder });\n}\n","import { z } from 'zod';\nimport {\n AzdoGitCommitRefSchema,\n AzdoIdentityRefSchema,\n AzdoPullRequestAsyncStatusSchema,\n AzdoPullRequestCommentSchema,\n AzdoPullRequestStatusSchema,\n} from './client/types';\n\nexport const AzdoEventTypeSchema = z.enum([\n // Code is pushed to a Git repository.\n 'git.push',\n // Pull request is updated – status, review list, reviewer vote\n // changed or the source branch is updated with a push.\n 'git.pullrequest.updated',\n // Pull request - Branch merge attempted.\n 'git.pullrequest.merged',\n // A repository is created.\n 'git.repo.created',\n // A repository is deleted.\n 'git.repo.deleted',\n // A repository is renamed.\n 'git.repo.renamed',\n // A repository's status is changed.\n 'git.repo.statuschanged',\n // Comments are added to a pull request.\n 'ms.vss-code.git-pullrequest-comment-event',\n]);\nexport type AzdoEventType = z.infer<typeof AzdoEventTypeSchema>;\n\nconst AzdoEventProjectSchema = z.object({\n id: z.string(),\n name: z.string(),\n url: z.string(),\n});\n\nexport const AzdoEventRepositorySchema = z.object({\n id: z.string(),\n name: z.string(),\n project: AzdoEventProjectSchema,\n defaultBranch: z.string().optional(),\n remoteUrl: z.string(),\n});\n\nexport const AzdoEventCodePushResourceSchema = z.object({\n repository: AzdoEventRepositorySchema,\n commits: AzdoGitCommitRefSchema.array(),\n refUpdates: z\n .object({\n name: z.string(),\n oldObjectId: z.string().nullish(),\n newObjectId: z.string().nullish(),\n })\n .array(),\n pushId: z.number(),\n url: z.string(), // e.g. \"https://dev.azure.com/fabrikam/_apis/git/repositories/2856c8c5-6f6b-4e6d-8a9f-4cf0d33f2f2a/pushes/22\"\n});\nexport type AzdoEventCodePushResource = z.infer<typeof AzdoEventCodePushResourceSchema>;\n\nexport const AzdoEventPullRequestResourceSchema = z.object({\n repository: AzdoEventRepositorySchema,\n pullRequestId: z.number(),\n status: AzdoPullRequestStatusSchema,\n createdBy: AzdoIdentityRefSchema,\n title: z.string(),\n sourceRefName: z.string(),\n targetRefName: z.string(),\n mergeStatus: AzdoPullRequestAsyncStatusSchema,\n mergeId: z.string(),\n url: z.string(),\n});\nexport type AzdoEventPullRequestResource = z.infer<typeof AzdoEventPullRequestResourceSchema>;\n\nexport const AzdoEventRepositoryCreatedResourceSchema = z.object({\n repository: AzdoEventRepositorySchema,\n});\nexport type AzdoEventRepositoryCreatedResource = z.infer<typeof AzdoEventRepositoryCreatedResourceSchema>;\n\nexport const AzdoEventRepositoryDeletedResourceSchema = z.object({\n project: AzdoEventProjectSchema,\n repositoryId: z.string(),\n repositoryName: z.string(),\n isHardDelete: z.boolean(),\n});\nexport type AzdoEventRepositoryDeletedResource = z.infer<typeof AzdoEventRepositoryDeletedResourceSchema>;\n\nexport const AzdoEventRepositoryRenamedResourceSchema = z.object({\n oldName: z.string(),\n newName: z.string(),\n repository: AzdoEventRepositorySchema,\n});\nexport type AzdoEventRepositoryRenamedResource = z.infer<typeof AzdoEventRepositoryRenamedResourceSchema>;\n\nexport const AzdoEventRepositoryStatusChangedResourceSchema = z.object({\n disabled: z.boolean(),\n repository: AzdoEventRepositorySchema,\n});\nexport type AzdoEventRepositoryStatusChangedResource = z.infer<typeof AzdoEventRepositoryStatusChangedResourceSchema>;\n\nexport const AzdoEventPullRequestCommentEventResourceSchema = z.object({\n pullRequest: AzdoEventPullRequestResourceSchema,\n comment: AzdoPullRequestCommentSchema,\n});\nexport type AzdoEventPullRequestCommentEventResource = z.infer<typeof AzdoEventPullRequestCommentEventResourceSchema>;\n\nexport const AzdoEventSchema = z\n .object({\n subscriptionId: z.string(),\n notificationId: z.number(),\n id: z.string(),\n publisherId: z.string(),\n resourceVersion: z.enum(['1.0', '1.0-preview.1', '2.0']),\n createdDate: z.coerce.date(),\n })\n .and(\n z.discriminatedUnion('eventType', [\n z.object({ eventType: z.literal('git.push'), resource: AzdoEventCodePushResourceSchema }),\n z.object({ eventType: z.literal('git.pullrequest.updated'), resource: AzdoEventPullRequestResourceSchema }),\n z.object({ eventType: z.literal('git.pullrequest.merged'), resource: AzdoEventPullRequestResourceSchema }),\n z.object({ eventType: z.literal('git.repo.created'), resource: AzdoEventRepositoryCreatedResourceSchema }),\n z.object({ eventType: z.literal('git.repo.deleted'), resource: AzdoEventRepositoryDeletedResourceSchema }),\n z.object({ eventType: z.literal('git.repo.renamed'), resource: AzdoEventRepositoryRenamedResourceSchema }),\n z.object({\n eventType: z.literal('git.repo.statuschanged'),\n resource: AzdoEventRepositoryStatusChangedResourceSchema,\n }),\n z.object({\n eventType: z.literal('ms.vss-code.git-pullrequest-comment-event'),\n resource: AzdoEventPullRequestCommentEventResourceSchema,\n }),\n ]),\n );\nexport type AzdoEvent = z.infer<typeof AzdoEventSchema>;\n","export type AzureDevOpsOrganizationUrl = {\n /** URL of the organization. This may lack the project name */\n value: URL;\n\n /** Organization URL hostname */\n hostname: string;\n\n /** Organization API endpoint URL */\n 'api-endpoint': string;\n\n /** Organization name/slug */\n organization: string;\n\n /** Virtual directory if present (on-premises only) */\n 'virtual-directory'?: string;\n\n /**\n * Organization Identity API URL (different from the API endpoint).\n * Used for querying user identities.\n */\n 'identity-api-url': URL;\n};\n\nexport type AzureDevOpsRepositoryUrl = AzureDevOpsOrganizationUrl & {\n /**\n * Project ID or Name.\n * This value is not URL-encoded, clients must encode it when constructing URLs.\n */\n project: string;\n /**\n * Repository ID or Name.\n * This value is not URL-encoded, clients must encode it when constructing URLs.\n */\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\n/**\n * Extract organization details from any Azure DevOps URL.\n * Accepts organization, project, or repository URLs.\n */\nexport function extractOrganizationUrl({ organizationUrl }: { organizationUrl: string }): AzureDevOpsOrganizationUrl {\n const value = new URL(organizationUrl);\n const protocol = value.protocol.slice(0, -1);\n if (protocol !== 'https' && protocol !== 'http') {\n throw new Error(`Invalid URL protocol: '${protocol}'. Only 'http' and 'https' are supported.`);\n }\n\n let { hostname } = value;\n\n // Handle old Visual Studio URLs: contoso.visualstudio.com -> dev.azure.com\n const visualStudioMatch = hostname.match(/^(\\S+)\\.visualstudio\\.com$/i);\n if (visualStudioMatch) {\n hostname = 'dev.azure.com';\n }\n\n // Parse path segments, ignoring everything after _git if present\n const allSegments = value.pathname.split('/').filter(Boolean);\n const gitIndex = allSegments.indexOf('_git');\n const segments = gitIndex >= 0 ? allSegments.slice(0, gitIndex) : allSegments;\n\n // Extract organization based on URL structure\n let organization: string;\n let virtualDirectory: string | undefined;\n\n if (visualStudioMatch) {\n // Visual Studio URL: org is in subdomain\n organization = visualStudioMatch[1]!;\n } else if (segments.length >= 2 && hostname !== 'dev.azure.com') {\n // On-premise with virtual directory: /virtualDir/org/...\n virtualDirectory = segments[0];\n organization = segments[1]!;\n } else if (segments.length >= 1) {\n // Azure DevOps or simple on-premise: /org/...\n organization = segments[0]!;\n } else {\n throw new Error(`Error parsing organization from url: '${organizationUrl}'.`);\n }\n\n const apiEndpoint = `${protocol}://${hostname}${value.port ? `:${value.port}` : ''}/${virtualDirectory ? `${virtualDirectory}/` : ''}`;\n\n // Identity API URL for Azure DevOps cloud\n const identityApiUrl =\n hostname === 'dev.azure.com' || hostname.endsWith('.visualstudio.com')\n ? new URL(`https://vssps.dev.azure.com/${organization}/`)\n : value;\n\n return {\n value,\n hostname,\n 'api-endpoint': apiEndpoint,\n organization,\n 'virtual-directory': virtualDirectory,\n 'identity-api-url': identityApiUrl,\n };\n}\n\nexport function extractRepositoryUrl(\n options: { repositoryUrl: string } | { organizationUrl: string; project: string; repository: string },\n): AzureDevOpsRepositoryUrl {\n let project: string;\n let repository: string;\n let extracted: AzureDevOpsOrganizationUrl;\n\n if ('repositoryUrl' in options) {\n // Parse full repository URL\n const url = new URL(options.repositoryUrl);\n if (!url.pathname.includes('/_git/')) {\n throw new Error(`Invalid repository URL: '${options.repositoryUrl}'. URL must contain '/_git/'.`);\n }\n\n // Split path into segments\n const segments = url.pathname.split('/').filter(Boolean);\n const gitIndex = segments.indexOf('_git');\n if (gitIndex === -1 || gitIndex >= segments.length - 1) {\n throw new Error(`Invalid repository URL: '${options.repositoryUrl}'. Repository name must follow '/_git/'.`);\n }\n\n // Extract project and repository\n project = decodeURIComponent(segments[gitIndex - 1]!);\n repository = decodeURIComponent(segments.slice(gitIndex + 1).join('/'));\n\n // Build organization URL and extract its details\n const orgSegments = segments.slice(0, gitIndex - 1);\n const orgPath = orgSegments.length > 0 ? `/${orgSegments.join('/')}/` : '/';\n const organizationUrl = `${url.protocol}//${url.host}${orgPath}`;\n extracted = extractOrganizationUrl({ organizationUrl });\n } else {\n // Build from separate components\n project = decodeURIComponent(options.project);\n repository = decodeURIComponent(options.repository);\n extracted = extractOrganizationUrl({ organizationUrl: options.organizationUrl });\n }\n\n // Build slug - encodeURI preserves forward slashes in repository names\n const virtualDirectory = extracted['virtual-directory'];\n const repoSlug = `${virtualDirectory ? `${virtualDirectory}/` : ''}${extracted.organization}/${encodeURI(project)}/_git/${encodeURI(repository)}`;\n\n return {\n ...extracted,\n project,\n repository,\n 'repository-slug': repoSlug,\n };\n}\n"],"mappings":";;;;;;;;;;AAAA,MAAa,cAAc;AAC3B,MAAa,sBAAsB;;AAGnC,MAAa,oBAAoB;;;;;AAMjC,MAAa,4CAA4C;AACzD,MAAa,yCAAyC;AACtD,MAAa,sCAAsC;AAEnD,MAAa,4BAA4B;;;;ACXzC,IAAa,wBAAb,MAAmC;CACjC,YAAY,AAAmB,QAAoB;EAApB;;CAM/B,AAAU,QAAQ,MAAc,QAA2C,aAAqB,aAAqB;AACnH,MAAI,OAAO,WAAW,UAAU;AAC9B,gBAAa;AACb,YAAS,EAAE;;AAOb,SAAO,GAAG,KAAK,GAJK,OAAO,QAAQ;GAAE,eAAe;GAAY,GAAG;GAAQ,CAAC,CACzE,QAAQ,GAAG,WAAW,MAAM,CAC5B,KAAK,CAAC,KAAK,WAAW,GAAG,IAAI,GAAG,QAAQ,CACxC,KAAK,IAAI;;;;;;ACfhB,IAAa,mBAAb,cAAsC,sBAAsB;;;;CAI1D,MAAa,MAAmC;AAC9C,SAAO,MAAM,KAAK,OAAO,IAAwB,KAAK,QAAQ,wBAAwB,oBAAoB,CAAC,CAAC,MAAM;;;;;;ACGtH,IAAa,YAAb,cAA+B,sBAAsB;CACnD,MAAa,QACX,iBACA,oBACA,MACA,iBAA0B,MAC1B,wBAAiC,MACQ;AACzC,MAAI;AAaF,UAZa,MAAM,KAAK,OACrB,I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 as
|
|
2
|
-
import "../index-
|
|
3
|
-
export { BETA_ECOSYSTEMS, CONFIG_FILE_NAMES, CONFIG_FILE_PATHS_AZURE, CONFIG_FILE_PATHS_GITHUB, CertificateAuthority, CertificateAuthoritySchema, CreateApiServerAppOptions, DEFAULT_EXPERIMENTS, DEPENDABOT_COMMANDS, 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,
|
|
1
|
+
import { $ as createApiServerApp, $t as DependabotProxyConfig, A as DependabotMetricSchema, An as DependabotMultiEcosystemGroup, At as DependabotCredentialSchema, B as DependabotRecordUpdateJobUnknownErrorSchema, Bn as PackageEcosystemSchema, Bt as DependabotExperimentsSchema, C as DependabotIncrementMetric, Cn as DependabotConfigSchema, Ct as DependabotCommand, D as DependabotMarkAsProcessed, Dn as DependabotGroupSchema, Dt as DependabotCondition, E as DependabotJobErrorSchema, En as DependabotGroup, Et as DependabotCommitOptionsSchema, F as DependabotRecordEcosystemVersions, Fn as DependabotSchedule, Ft as DependabotExistingPr, G as DependabotUpdatePullRequest, Gn as parseUpdates, Gt as DependabotJobConfig, H as DependabotRecordUpdateJobWarningSchema, Hn as VersioningStrategySchema, Ht as DependabotGroupJobSchema, I as DependabotRecordEcosystemVersionsSchema, In as DependabotScheduleSchema, It as DependabotExistingPrDependency, J as DependabotRequest, Jn as convertPlaceholder, Jt as DependabotJobFileSchema, K as DependabotUpdatePullRequestSchema, Kn as validateConfiguration, Kt as DependabotJobConfigSchema, L as DependabotRecordUpdateJobError, Ln as DependabotUpdate, Lt as DependabotExistingPrDependencySchema, M as DependabotRecordCooldownMetaSchema, Mn as DependabotPullRequestBranchName, Mt as DependabotDependencySchema, N as DependabotRecordEcosystemMeta, Nn as DependabotRegistry, Nt as DependabotExistingGroupPr, O as DependabotMarkAsProcessedSchema, On as DependabotIgnoreCondition, Ot as DependabotConditionSchema, P as DependabotRecordEcosystemMetaSchema, Pn as DependabotRegistrySchema, Pt as DependabotExistingGroupPrSchema, Q as DependabotTokenType, Qn as GitAuthor, Qt as DependabotPersistedPrSchema, R as DependabotRecordUpdateJobErrorSchema, Rn as DependabotUpdateSchema, Rt as DependabotExistingPrSchema, S as DependabotEcosystemVersionManagerSchema, Sn as DependabotConfig, St as DependabotAllowedSchema, T as DependabotJobError, Tn as DependabotCooldownSchema, Tt as DependabotCommitOptions, U as DependabotUpdateDependencyList, Un as parseDependabotConfig, Ut as DependabotGroupRuleJob, V as DependabotRecordUpdateJobWarning, Vn as VersioningStrategy, Vt as DependabotGroupJob, W as DependabotUpdateDependencyListSchema, Wn as parseRegistries, Wt as DependabotGroupRuleJobSchema, X as DependabotRequestType, Xn as DEPENDABOT_DEFAULT_AUTHOR_EMAIL, Xt as DependabotPackageManagerSchema, Y as DependabotRequestSchema, Yn as extractPlaceholder, Yt as DependabotPackageManager, Z as DependabotRequestTypeSchema, Zn as DEPENDABOT_DEFAULT_AUTHOR_NAME, Zt as DependabotPersistedPr, _ as DependabotDependencySubmission, _n as CONFIG_FILE_PATHS_GITHUB, _t as sanitizeRef, a as getPullRequestDescription, an as DependabotSecurityAdvisory, at as mapExperiments, b as DependabotEcosystemMetaSchema, bn as DependabotCommitMessage, bt as DEPENDABOT_COMMANDS, c as shouldSupersede, cn as DependabotSourceProvider, ct as mapPackageEcosystemToPackageManager, d as DependabotClosePullRequestReasonEnum, dn as FetchedFiles, dt as mapVersionStrategyToRequirementsUpdateStrategy, en as DependabotProxyConfigSchema, et as DependabotJobBuilder, f as DependabotClosePullRequestSchema, fn as FileFetcherInput, ft as DEFAULT_EXPERIMENTS, g as DependabotDependencyFileSchema, gn as CONFIG_FILE_PATHS_AZURE, gt as getBranchNameForUpdate, h as DependabotDependencyFile, hn as CONFIG_FILE_NAMES, ht as makeDirectoryKey, i as getPullRequestCloseReason, in as DependabotRequirementSourceSchema, it as mapCredentials, j as DependabotRecordCooldownMeta, jn as DependabotMultiEcosystemGroupSchema, jt as DependabotDependency, k as DependabotMetric, kn as DependabotIgnoreConditionSchema, kt as DependabotCredential, l as DependabotClosePullRequest, ln as DependabotSourceProviderSchema, lt as mapSecurityAdvisories, m as DependabotCreatePullRequestSchema, mn as BETA_ECOSYSTEMS, mt as setExperiment, n as getDependencyNames, nn as DependabotRequirementSchema, nt as DependabotSourceInfo, o as normalizeBranchName, on as DependabotSecurityAdvisorySchema, ot as mapGroupsFromDependabotConfigToJobConfig, p as DependabotCreatePullRequest, pn as FileUpdaterInput, pt as parseExperiments, q as CreateApiServerAppOptions, qn as VariableFinderFn, qt as DependabotJobFile, r as getPersistedPr, rn as DependabotRequirementSource, rt as mapAllowedUpdatesFromDependabotConfigToJobConfig, s as normalizeFilePath, sn as DependabotSource, st as mapIgnoreConditionsFromDependabotConfigToJobConfig, t as areEqual, tn as DependabotRequirement, tt as DependabotJobBuilderOutput, u as DependabotClosePullRequestReason, un as DependabotSourceSchema, ut as mapSourceFromDependabotConfigToJobConfig, v as DependabotDependencySubmissionSchema, vn as DependabotAllowCondition, vt as CertificateAuthority, w as DependabotIncrementMetricSchema, wn as DependabotCooldown, wt as DependabotCommandSchema, x as DependabotEcosystemVersionManager, xn as DependabotCommitMessageSchema, xt as DependabotAllowed, y as DependabotEcosystemMeta, yn as DependabotAllowConditionSchema, yt as CertificateAuthoritySchema, z as DependabotRecordUpdateJobUnknownError, zn as PackageEcosystem, zt as DependabotExperiments } from "../index-CviS_2Dy.mjs";
|
|
2
|
+
import "../index-BKTxy7XU.mjs";
|
|
3
|
+
export { BETA_ECOSYSTEMS, CONFIG_FILE_NAMES, CONFIG_FILE_PATHS_AZURE, CONFIG_FILE_PATHS_GITHUB, CertificateAuthority, CertificateAuthoritySchema, CreateApiServerAppOptions, DEFAULT_EXPERIMENTS, DEPENDABOT_COMMANDS, 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, DependabotExistingPrDependency, DependabotExistingPrDependencySchema, DependabotExistingPrSchema, DependabotExperiments, DependabotExperimentsSchema, DependabotGroup, DependabotGroupJob, DependabotGroupJobSchema, DependabotGroupRuleJob, DependabotGroupRuleJobSchema, DependabotGroupSchema, DependabotIgnoreCondition, DependabotIgnoreConditionSchema, DependabotIncrementMetric, DependabotIncrementMetricSchema, DependabotJobBuilder, DependabotJobBuilderOutput, DependabotJobConfig, DependabotJobConfigSchema, DependabotJobError, DependabotJobErrorSchema, DependabotJobFile, DependabotJobFileSchema, DependabotMarkAsProcessed, DependabotMarkAsProcessedSchema, DependabotMetric, DependabotMetricSchema, DependabotMultiEcosystemGroup, DependabotMultiEcosystemGroupSchema, DependabotPackageManager, DependabotPackageManagerSchema, DependabotPersistedPr, DependabotPersistedPrSchema, DependabotProxyConfig, DependabotProxyConfigSchema, DependabotPullRequestBranchName, DependabotRecordCooldownMeta, DependabotRecordCooldownMetaSchema, 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, PackageEcosystem, PackageEcosystemSchema, VariableFinderFn, VersioningStrategy, VersioningStrategySchema, areEqual, convertPlaceholder, createApiServerApp, extractPlaceholder, getBranchNameForUpdate, getDependencyNames, getPersistedPr, getPullRequestCloseReason, getPullRequestDescription, makeDirectoryKey, mapAllowedUpdatesFromDependabotConfigToJobConfig, mapCredentials, mapExperiments, mapGroupsFromDependabotConfigToJobConfig, mapIgnoreConditionsFromDependabotConfigToJobConfig, mapPackageEcosystemToPackageManager, mapSecurityAdvisories, mapSourceFromDependabotConfigToJobConfig, mapVersionStrategyToRequirementsUpdateStrategy, normalizeBranchName, normalizeFilePath, parseDependabotConfig, parseExperiments, parseRegistries, parseUpdates, sanitizeRef, setExperiment, shouldSupersede, validateConfiguration };
|