@gitkraken/core-gitlens 0.62.0 → 0.63.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.
Files changed (67) hide show
  1. package/CHANGELOG.md +15 -1
  2. package/dist/git/cache.d.ts +1 -0
  3. package/dist/git/cache.js +11 -0
  4. package/dist/git/cache.js.map +1 -1
  5. package/dist/git/errors.d.ts +15 -0
  6. package/dist/git/errors.js +9 -1
  7. package/dist/git/errors.js.map +1 -1
  8. package/dist/git/models/pullRequest.d.ts +3 -0
  9. package/dist/git/models/pullRequest.js.map +1 -1
  10. package/dist/git/providers/operations.d.ts +4 -3
  11. package/dist/git/providers/staging.d.ts +16 -8
  12. package/dist/git/run.types.d.ts +6 -0
  13. package/dist/git/utils/hiddenRefs.utils.d.ts +15 -0
  14. package/dist/git/utils/hiddenRefs.utils.js +68 -2
  15. package/dist/git/utils/hiddenRefs.utils.js.map +1 -1
  16. package/dist/git/utils/pullRequest.utils.d.ts +3 -6
  17. package/dist/git/utils/pullRequest.utils.js +6 -7
  18. package/dist/git/utils/pullRequest.utils.js.map +1 -1
  19. package/dist/git/watching/gitIgnoreFilter.d.ts +12 -5
  20. package/dist/git/watching/gitIgnoreFilter.js +26 -32
  21. package/dist/git/watching/gitIgnoreFilter.js.map +1 -1
  22. package/dist/git/watching/provider.d.ts +18 -3
  23. package/dist/git/watching/watchGroup.d.ts +7 -2
  24. package/dist/git/watching/watchGroup.js +51 -3
  25. package/dist/git/watching/watchGroup.js.map +1 -1
  26. package/dist/git/watching/watchService.d.ts +6 -3
  27. package/dist/git/watching/watchService.js +94 -64
  28. package/dist/git/watching/watchService.js.map +1 -1
  29. package/dist/git-cli/cliGitProvider.d.ts +2 -0
  30. package/dist/git-cli/cliGitProvider.js +85 -24
  31. package/dist/git-cli/cliGitProvider.js.map +1 -1
  32. package/dist/git-cli/exec/git.js +4 -4
  33. package/dist/git-cli/exec/git.js.map +1 -1
  34. package/dist/git-cli/exec/indexLock.d.ts +7 -5
  35. package/dist/git-cli/exec/indexLock.js +19 -15
  36. package/dist/git-cli/exec/indexLock.js.map +1 -1
  37. package/dist/git-cli/providers/config.d.ts +1 -0
  38. package/dist/git-cli/providers/config.js +15 -5
  39. package/dist/git-cli/providers/config.js.map +1 -1
  40. package/dist/git-cli/providers/pausedOperations.js +2 -2
  41. package/dist/git-cli/providers/pausedOperations.js.map +1 -1
  42. package/dist/git-cli/providers/staging.d.ts +8 -8
  43. package/dist/git-cli/providers/staging.js +120 -25
  44. package/dist/git-cli/providers/staging.js.map +1 -1
  45. package/dist/ipc/discovery.js +1 -1
  46. package/dist/plus/agents/providers/claudeCodeTranscript.js +6 -6
  47. package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -1
  48. package/dist/plus/ai/providers/openAICompatibleProviderBase.js +1 -1
  49. package/dist/plus/git-github/api/config.d.ts +5 -0
  50. package/dist/plus/git-github/api/config.js.map +1 -1
  51. package/dist/plus/git-github/api/github.js +24 -4
  52. package/dist/plus/git-github/api/github.js.map +1 -1
  53. package/dist/plus/git-github/models.d.ts +12 -0
  54. package/dist/plus/git-github/models.js +8 -3
  55. package/dist/plus/git-github/models.js.map +1 -1
  56. package/dist/plus/integrations/context.d.ts +5 -0
  57. package/dist/plus/integrations/providers/azure/azure.js +1 -1
  58. package/dist/plus/integrations/providers/github.js +7 -3
  59. package/dist/plus/integrations/providers/github.js.map +1 -1
  60. package/dist/plus/integrations/reads/etag.d.ts +5 -0
  61. package/dist/plus/integrations/reads/etag.js +2 -0
  62. package/dist/plus/integrations/reads/etag.js.map +1 -1
  63. package/dist/utils/env/node/exec.d.ts +2 -0
  64. package/dist/utils/env/node/exec.js +4 -2
  65. package/dist/utils/env/node/exec.js.map +1 -1
  66. package/docs/integrations.md +9 -9
  67. package/package.json +1 -1
@@ -430,6 +430,9 @@ export interface PullRequestStackInfo {
430
430
  position: number;
431
431
  /** The branch the bottom of the stack targets. */
432
432
  baseRef: string;
433
+ /** How many of the stack's layers have merged; they stay counted in {@link size} and `position`.
434
+ * `undefined` when the read didn't fetch it. */
435
+ mergedLayers?: number;
433
436
  }
434
437
  /**
435
438
  * One layer of a stack — the pull request occupying it, and the head ref a rebase or push needs to act
@@ -1 +1 @@
1
- {"version":3,"file":"pullRequest.js","names":[],"sources":["../../../../git/src/models/pullRequest.ts"],"sourcesContent":["import { formatDate, fromNow } from '@gitlens/utils/date.js';\nimport { loggable } from '@gitlens/utils/decorators/log.js';\nimport { serializable } from '@gitlens/utils/decorators/serializable.js';\nimport type { RequireSome, RequireSomeWithProps } from '@gitlens/utils/types.js';\nimport type { IssueProject, IssueRepository } from './issue.js';\nimport type {\n\tIssueMilestone,\n\tIssueOrPullRequest,\n\tIssueOrPullRequestState as PullRequestState,\n} from './issueOrPullRequest.js';\nimport type { ProviderReference } from './remoteProvider.js';\nimport type { RepositoryIdentityDescriptor } from './repositoryIdentities.js';\n\nexport type { PullRequestState };\n\n/**\n * The read that produced a pull request row, as a key for `getPullRequestFieldPresence` (`@gitlens/integrations`). It\n * names a READ, not a field set: the same tag can carry different fields on different providers.\n */\nexport type PullRequestProjection =\n\t/** A single-item read: by number, for a branch, or for a commit. */\n\t| 'point'\n\t/** The filtered search with the full projection, and the host's \"my pull requests\" search. */\n\t| 'search'\n\t/** The filtered search with `summary`. */\n\t| 'search-summary'\n\t/** The free-text search (`searchPullRequests`). */\n\t| 'text-search'\n\t/** An account-wide sweep with the full projection (`includeReviews`). */\n\t| 'account'\n\t/** An account-wide list or sweep with the lightweight projection. */\n\t| 'account-summary'\n\t/** A repository-scoped list or sweep. */\n\t| 'repos'\n\t/** A repository-scoped list with `summary`. */\n\t| 'repos-summary'\n\t/** The coordinate and branch batch reads. */\n\t| 'batch';\n\nexport interface PullRequestShape extends IssueOrPullRequest {\n\treadonly state: PullRequestState;\n\treadonly author: PullRequestMember;\n\t/**\n\t * Canonical base-repository identity returned by the provider. Some providers\n\t * scope pull-request ids to a repository, so consumers must not have to infer\n\t * identity from optional refs or URLs.\n\t */\n\treadonly repository?: IssueRepository;\n\treadonly mergedDate?: Date;\n\treadonly refs?: PullRequestRefs;\n\treadonly isDraft?: boolean;\n\treadonly additions?: number;\n\treadonly deletions?: number;\n\treadonly filesChanged?: number;\n\treadonly body?: string;\n\treadonly mergeableState?: PullRequestMergeableState;\n\treadonly reviewDecision?: PullRequestReviewDecision;\n\treadonly reviewRequests?: PullRequestReviewer[];\n\t/**\n\t * Reviews already submitted, as opposed to the still-pending {@link reviewRequests}. Absent means the read\n\t * didn't fetch reviews; empty means nobody has reviewed — but only where the read actually fetched them, which\n\t * is provider- and read-dependent: ask `getPullRequestFieldPresence` (`@gitlens/integrations`) for the row's\n\t * `reviews` group rather than trusting an empty array.\n\t * {@link PullRequestReviewer.commitOid} is the narrower promise: only the full GitHub/GHE projection has it.\n\t */\n\treadonly latestReviews?: PullRequestReviewer[];\n\treadonly assignees?: PullRequestMember[];\n\treadonly project?: IssueProject;\n\treadonly stack?: PullRequestStackInfo;\n\t/**\n\t * The pull request's place in its base branch's merge queue. Absent means either not queued or not fetched — ask\n\t * `getPullRequestFieldPresence` (`@gitlens/integrations`) for the row's `mergeQueue` group to tell them apart.\n\t * Only GitHub.com reports one.\n\t */\n\treadonly mergeQueue?: PullRequestMergeQueueEntry;\n\t/**\n\t * Whether the base branch accepts this pull request only through a merge queue, so merging it means adding it to\n\t * the queue. `undefined` means not read; read wherever `mergeQueue` is (the same `mergeQueue` field group).\n\t */\n\treadonly mergeQueueRequired?: boolean;\n\t/**\n\t * The pull request's latest removal from its merge queue, set only while that removal is its latest merge-queue\n\t * event (it hasn't rejoined since) and the removal didn't merge it. It stays set however much later the pull\n\t * request changes, so ask `isPullRequestMergeQueueRemovalCurrent` whether it still describes the pull request.\n\t * Read wherever `mergeQueue` is (the same `mergeQueue` field group); absent there means no such removal.\n\t */\n\treadonly mergeQueueRemoval?: PullRequestMergeQueueRemoval;\n\t/**\n\t * The head commit's individual check results. `undefined` means not read; empty means read and the head has no\n\t * checks. Only GitHub and GitHub Enterprise read them, and only for a read that asks (`checkRuns`); ask\n\t * `getPullRequestFieldPresence` (`@gitlens/integrations`) for the row's `checkRuns` group.\n\t */\n\treadonly checkRuns?: readonly PullRequestCheckRun[];\n\t/** Set when the head has more checks than {@link checkRuns} holds. Read wherever `checkRuns` is. */\n\treadonly checkRunsTruncated?: true;\n\treadonly number?: number;\n\treadonly authoredByMe?: boolean;\n\t/**\n\t * The current account as this pull request's members identify it: the identity its people were matched against,\n\t * present whenever it was resolved (see {@link viewerUnresolved} for an Azure DevOps row it couldn't be for). {@link authoredByMe} is matched against it too, and stays `undefined` when the\n\t * row has no author, though its reviewers or assignees still get this. A consumer matching {@link reviewRequests}\n\t * or {@link latestReviews} entries to the current user compares against this, not the account `getCurrentAccount`\n\t * returns: Azure DevOps can know one person by another id in each organization (Azure DevOps Server: collection)\n\t * than the account's, and the members carry the organization's. Core matches `username` too only on GitHub and\n\t * GitHub Enterprise, whose rows key people by login.\n\t */\n\treadonly viewer?: { readonly id: string; readonly username?: string };\n\t/**\n\t * Set, and only ever `true`, on an Azure DevOps row that names someone (its author, a reviewer or an assignee)\n\t * whose organization's (Azure DevOps Server: collection's) identity the read tried and failed to resolve: its\n\t * `ConnectionData` failed, answered without an identity, or didn't answer within 10 seconds. Such a row has neither\n\t * {@link viewer} nor {@link authoredByMe}, and neither the account `getCurrentAccount` returns nor anyone else can\n\t * be matched against its people: whether it is the current user's, or asks for their review, is unknown, not \"no\".\n\t * Absent everywhere else, so a row with neither field is still one whose identity wasn't resolved for another\n\t * reason (a read that doesn't resolve it, or a failed account read), as before.\n\t */\n\treadonly viewerUnresolved?: true;\n\t/** The read that produced this row. Absent means unknown: a legacy row, or a provider or read not yet tagged. */\n\treadonly projection?: PullRequestProjection;\n\t/**\n\t * The change stamp `getPullRequestsBatch` (`@gitlens/integrations`) would give this row. Set only by a sweep asked\n\t * for `etagIncludes`, and only on a row as complete as that batch read's.\n\t */\n\treadonly etag?: string;\n}\n\n@loggable(i => i.id)\n@serializable\nexport class PullRequest implements PullRequestShape {\n\tdeclare readonly capturedAt?: number;\n\tdeclare readonly captureId?: string;\n\tdeclare readonly etag?: string;\n\treadonly type = 'pullrequest';\n\n\tconstructor(\n\t\tpublic readonly provider: ProviderReference,\n\t\tpublic readonly author: PullRequestMember,\n\t\tpublic readonly id: string,\n\t\tpublic readonly nodeId: string | undefined,\n\t\tpublic readonly title: string,\n\t\tpublic readonly url: string,\n\t\tpublic readonly repository: IssueRepository,\n\t\tpublic readonly state: PullRequestState,\n\t\tpublic readonly createdDate: Date,\n\t\tpublic readonly updatedDate: Date,\n\t\tpublic readonly closedDate?: Date,\n\t\tpublic readonly mergedDate?: Date,\n\t\tpublic readonly mergeableState?: PullRequestMergeableState,\n\t\tpublic readonly viewerCanUpdate?: boolean,\n\t\tpublic readonly refs?: PullRequestRefs,\n\t\tpublic readonly isDraft?: boolean,\n\t\tpublic readonly additions?: number,\n\t\tpublic readonly deletions?: number,\n\t\tpublic readonly commentsCount?: number,\n\t\tpublic readonly thumbsUpCount?: number,\n\t\tpublic readonly reviewDecision?: PullRequestReviewDecision,\n\t\tpublic readonly reviewRequests?: PullRequestReviewer[],\n\t\tpublic readonly latestReviews?: PullRequestReviewer[],\n\t\tpublic readonly assignees?: PullRequestMember[],\n\t\tpublic readonly statusCheckRollupState?: PullRequestStatusCheckRollupState,\n\t\tpublic readonly project?: IssueProject,\n\t\tpublic readonly version?: number,\n\t\t/** Commits on the head that aren't on the base. Appended rather than slotted with the other counts:\n\t\t * this constructor is positional and every mapper passes through it. */\n\t\tpublic readonly commitCount?: number,\n\t\tpublic readonly stack?: PullRequestStackInfo,\n\t\tpublic readonly filesChanged?: number,\n\t\t/** The pull request's description, as markdown. */\n\t\tpublic readonly body?: string,\n\t\tpublic readonly number?: number,\n\t\tpublic readonly authoredByMe?: boolean,\n\t\tpublic readonly projection?: PullRequestProjection,\n\t\tpublic readonly viewer?: { readonly id: string; readonly username?: string },\n\t\tpublic readonly viewerUnresolved?: true,\n\t\tpublic readonly milestone?: IssueMilestone | null,\n\t\tpublic readonly mergeQueue?: PullRequestMergeQueueEntry,\n\t\tpublic readonly mergeQueueRequired?: boolean,\n\t\tpublic readonly mergeQueueRemoval?: PullRequestMergeQueueRemoval,\n\t\tpublic readonly checkRuns?: readonly PullRequestCheckRun[],\n\t\tpublic readonly checkRunsTruncated?: true,\n\t) {}\n\n\tget closed(): boolean {\n\t\treturn this.state === 'closed';\n\t}\n\n\tstatic is(pr: unknown): pr is PullRequest {\n\t\treturn pr instanceof PullRequest;\n\t}\n\n\tstatic formatDate(pr: PullRequestShape, format?: string | null): string {\n\t\treturn formatDate(pr.mergedDate ?? pr.closedDate ?? pr.updatedDate, format ?? 'MMMM Do, YYYY h:mma');\n\t}\n\n\tstatic formatDateFromNow(pr: PullRequestShape): string {\n\t\treturn fromNow(pr.mergedDate ?? pr.closedDate ?? pr.updatedDate);\n\t}\n\n\tstatic formatDateWithStyle(\n\t\tpr: PullRequestShape,\n\t\tformatting: { dateStyle: string; dateFormat: string | null },\n\t): string {\n\t\treturn formatting.dateStyle === 'absolute'\n\t\t\t? PullRequest.formatDate(pr, formatting.dateFormat)\n\t\t\t: PullRequest.formatDateFromNow(pr);\n\t}\n}\n\nexport const enum PullRequestReviewDecision {\n\tApproved = 'Approved',\n\tChangesRequested = 'ChangesRequested',\n\tReviewRequired = 'ReviewRequired',\n}\n\nexport const enum PullRequestMergeableState {\n\tUnknown = 'Unknown',\n\tMergeable = 'Mergeable',\n\tConflicting = 'Conflicting',\n\tFailingChecks = 'FailingChecks',\n\tBlockedByPolicy = 'BlockedByPolicy',\n}\n\n/** Where a queued pull request stands in its merge queue. Mirrors GitHub's `MergeQueueEntryState`. */\nexport const enum PullRequestMergeQueueState {\n\tQueued = 'Queued',\n\t/** Waiting for its required checks to pass. */\n\tAwaitingChecks = 'AwaitingChecks',\n\tMergeable = 'Mergeable',\n\tUnmergeable = 'Unmergeable',\n\tLocked = 'Locked',\n}\n\nexport const enum PullRequestStatusCheckRollupState {\n\tSuccess = 'success',\n\tPending = 'pending',\n\tFailed = 'failed',\n}\n\nexport const enum PullRequestMergeMethod {\n\tMerge = 'merge',\n\tSquash = 'squash',\n\tRebase = 'rebase',\n}\n\nexport const enum PullRequestReviewState {\n\tApproved = 'APPROVED',\n\tChangesRequested = 'CHANGES_REQUESTED',\n\tCommented = 'COMMENTED',\n\tDismissed = 'DISMISSED',\n\tPending = 'PENDING',\n\tReviewRequested = 'REVIEW_REQUESTED',\n}\n\nexport interface PullRequestComparisonRefs {\n\trepoPath: string;\n\tbase: { ref: string; label: string };\n\thead: { ref: string; label: string };\n}\n\nexport interface PullRequestMember {\n\tid: string;\n\t/**\n\t * Absent when the provider exposes no display name for the member — same contract as `IssueMember.name`: a\n\t * fallback invented here can't be told apart from a real name downstream, so each consumer picks its own\n\t * presentation.\n\t */\n\tname?: string;\n\t/** The provider's handle for this person, when it has one — GitHub's login, Azure's `uniqueName` (a UPN,\n\t * so an email), Bitbucket's mutable `nickname`. Display/labelling only: it is neither guaranteed present\n\t * (GitLab's native mapper has none) nor a stable identity, so never key a match off it. */\n\tusername?: string;\n\tavatarUrl?: string;\n\turl?: string;\n}\n\n/** Provider-neutral relationship facets shared by PR listings and filtered PR search. */\nexport enum PullRequestFilter {\n\tAuthor = 'author',\n\tAssignee = 'assignee',\n\tReviewRequested = 'review-requested',\n\t/**\n\t * PRs the user has already reviewed (GitHub `reviewed-by:@me`), as opposed to `ReviewRequested` (a\n\t * still-pending request). Distinguishes \"waiting on the author after my review\" from \"waiting for my\n\t * review\". Not expressible on the repo-scoped listing — no provider SDK exposes a reviewed-by axis there —\n\t * so it is advertised for the account-wide read and for the filtered search (which can still bound itself\n\t * to repositories or an org), never under `supportedPullRequestFilters`.\n\t */\n\tReviewed = 'reviewed-by',\n\tMention = 'mention',\n}\n\n/** Selects which pull request states a read should include. `all` covers open + closed + merged. */\nexport type PullRequestStateFilter = 'open' | 'closed' | 'merged' | 'all';\n\n/**\n * A field a pull-request read can be ordered by, provider-neutral.\n *\n * Only two, and deliberately so — unlike {@link IssueSortField} this is the INTERSECTION of what GitHub's PR\n * search can order by server-side and what a {@link PullRequestShape} carries, because the filtered PR search\n * always merges its relationship × state facets in the facade and so must re-order the union itself (see\n * `getPullRequestComparator`). `created` and `updated` are both. A field GitHub cannot order PRs by, or one a\n * merged page can't reproduce, is left out rather than advertised and then approximated: relevance is unstable\n * and has no comparable value on a merge, and priority is not a pull-request concept on any provider that has PRs.\n */\nexport type PullRequestSortField =\n\t/** Creation date. */\n\t| 'created'\n\t/** Last activity. */\n\t| 'updated';\n\n/**\n * How a pull-request read is ordered, as `field:direction` — the same serializable shape {@link IssueSorting}\n * and `BranchSorting` use, so a consumer can persist it, compare it, or bind it straight to a setting or dropdown.\n */\nexport type PullRequestSorting = `${PullRequestSortField}:asc` | `${PullRequestSortField}:desc`;\n\n/**\n * The order the filtered pull-request search applies when the caller asks for none: most recently updated first,\n * which is what it served before ordering was an option. Named once rather than per layer — the criteria model\n * documents it, the GitHub query emits it, and the result-ceiling warning quotes it — so the three cannot\n * disagree about what \"the default\" is.\n */\nexport const defaultPullRequestSort: PullRequestSorting = 'updated:desc';\n\n/**\n * What the filtered pull-request search narrows on.\n *\n * Structured rather than a provider query string so callers can send free text without giving it a qualifier\n * channel, and can check {@link PullRequestSearchCapabilities} before issuing a read. Every requested criterion\n * is validated all-or-nothing before the provider runs; unsupported criteria never fall through to a wider\n * result set whose paging would no longer describe the returned items.\n *\n * Relationships are OR-ed, as are states. Omitting `relationships` removes the current-user constraint, which is\n * only safe when the manager call supplies a repository or organization scope. Omitting `states` reads open PRs.\n */\nexport interface PullRequestSearchCriteria {\n\t/**\n\t * Free text matched by the provider's own relevance rules. Tokens that look like provider qualifiers are\n\t * removed before the query is built, so text cannot change the search's scope or state.\n\t */\n\ttext?: string;\n\t/** Current-user relationship facets to union. Empty/omitted means no relationship constraint. */\n\trelationships?: PullRequestFilter[];\n\t/** Pull request states to union. Empty/omitted reads open PRs; `all` subsumes every other member. */\n\tstates?: PullRequestStateFilter[];\n\t/** ISO date (`YYYY-MM-DD`). The most effective narrowing criterion by far on a large scope. */\n\tupdatedAfter?: string;\n\t/** ISO date (`YYYY-MM-DD`). */\n\tcreatedAfter?: string;\n\t/** Includes PRs from archived repositories. They are excluded by default. */\n\tincludeArchived?: boolean;\n\t/**\n\t * Narrows on draft state: `true` returns only drafts, `false` only ready-for-review PRs. Omitted places no\n\t * constraint. A boolean rather than a truthy flag because `false` is a distinct request, not the absence of one.\n\t */\n\tdraft?: boolean;\n\t/**\n\t * How to order the results. Omitted means `updated:desc`, which is what this search has always served.\n\t *\n\t * Validated all-or-nothing against {@link PullRequestSearchCapabilities.sorts} like every other criterion: a\n\t * key the provider can't express server-side refuses the WHOLE read rather than falling back to the default,\n\t * because combined with the provider's result ceiling another order returns a different subset than was asked\n\t * for and the paging that comes with it describes that other subset. Do not change it mid-pagination — a\n\t * cursor carries the sort it was produced under; drop the cursor instead of threading it under a new key.\n\t */\n\tsort?: PullRequestSorting;\n\t/**\n\t * UTC timestamp (`YYYY-MM-DDTHH:MM:SSZ`). Returns pull requests in every state updated at or after it, oldest\n\t * update first, and the result's `openCount`. Requires `states` omitted or `['all']`, `sort` omitted or\n\t * `updated:asc`, and at most one relationship; anything else is refused.\n\t */\n\tchangedSince?: string;\n}\n\n/**\n * Which {@link PullRequestSearchCriteria} fields and manager-level scopes a provider can express server-side.\n * An empty `relationships` means the provider has no filtered PR search at all.\n */\nexport interface PullRequestSearchCapabilities {\n\t/** Current-user relationship facets the provider can union. Empty means the search itself is unsupported. */\n\trelationships: PullRequestFilter[];\n\t/** Individual state values the provider can union in one logical search. */\n\tstates: PullRequestStateFilter[];\n\ttext: boolean;\n\tupdatedAfter: boolean;\n\tcreatedAfter: boolean;\n\tincludeArchived: boolean;\n\t/** Whether the provider can constrain the search by draft state server-side. */\n\tdraft: boolean;\n\t/** Whether the manager's repository-descriptor scope is supported. */\n\trepositoryScope: boolean;\n\t/** Whether the manager's organization scope is supported. */\n\torganizationScope: boolean;\n\t/**\n\t * Sort keys the search can express server-side. Always contains at least `updated:desc` — the historical\n\t * default — when the search exists at all, so it is never empty for a usable surface; a provider without a\n\t * filtered PR search reports an empty `relationships`, which is already the signal there is no surface to order.\n\t */\n\tsorts: PullRequestSorting[];\n\t/** Whether {@link PullRequestSearchCriteria.changedSince} and the open count it returns are supported. */\n\tchangedSince: boolean;\n}\n\nexport interface PullRequestRef {\n\t/**\n\t * `undefined` when the ref's repository was deleted (a removed fork): GitHub's rows say so, with `exists` false.\n\t * provider-apis' converters fill `''` instead, so test for a value rather than for `undefined`.\n\t */\n\towner: string | undefined;\n\t/**\n\t * The repository's name, never a path: a GitLab nested group is all {@link owner}. `undefined` (or `''`) when the\n\t * ref's repository was deleted, as {@link owner}.\n\t */\n\trepo: string | undefined;\n\tbranch: string;\n\tsha: string;\n\texists: boolean;\n\t/**\n\t * Web URL of the ref's repository. `undefined` when the provider cannot resolve it — Azure DevOps embeds an\n\t * abbreviated repository reference in a pull request, so a fork's URL may need a lookup that can fail.\n\t */\n\turl: string | undefined;\n\t/** HTTPS clone URL of the ref's repository, when the provider exposes it. */\n\tcloneHttps?: string;\n\t/** SSH clone URL of the ref's repository, when the provider exposes it. */\n\tcloneSsh?: string;\n\t/** Best-effort flag: whether the ref's repository is a fork. `undefined` when the provider can't tell. */\n\tisFork?: boolean;\n}\n\nexport interface PullRequestRefs {\n\tbase: PullRequestRef & { url: string };\n\thead: PullRequestRef;\n\tisCrossRepository: boolean;\n}\n\n/**\n * A pull request's membership in a stack — an ordered chain of dependent pull requests where each\n * targets the branch of the one below it.\n *\n * `baseRef` is the stack's ultimate target (its trunk) and is NOT the same as `refs.base`, which for\n * anything above the bottom layer names the layer below. Use `refs.base` to diff a single layer; use\n * `baseRef` to answer where the work ultimately lands.\n */\nexport interface PullRequestStackInfo {\n\t/**\n\t * Opaque, and NOT comparable across read paths: GitHub's GraphQL selection returns a node id\n\t * (`PRS_kwDO…`) while its REST stacks endpoint returns a numeric id (`1347135`) that we stringify —\n\t * both verified against the same live stack. Use {@link number} to identify a stack; two views of one\n\t * stack agree there and will not agree here.\n\t */\n\tid: string;\n\t/** Identifies the stack within its repository. */\n\tnumber: number;\n\t/** Total pull requests in the stack. */\n\tsize: number;\n\t/** This pull request's layer, 1-based, where 1 is closest to `baseRef`. */\n\tposition: number;\n\t/** The branch the bottom of the stack targets. */\n\tbaseRef: string;\n}\n\n/**\n * One layer of a stack — the pull request occupying it, and the head ref a rebase or push needs to act\n * on. Unlike {@link PullRequestStackInfo}, which locates a single pull request within a stack, this is\n * the per-layer detail a caller walking the whole stack needs, e.g. to cascade a rebase bottom to top.\n */\nexport interface PullRequestStackLayer {\n\t/** The pull request's number. */\n\tnumber: number;\n\t/** The pull request's head branch name, without a remote prefix. */\n\theadRef: string;\n\t/** The head branch's tip when the stack was read. */\n\theadSha: string;\n\t/** `true` once this layer has landed. */\n\tmerged: boolean;\n\t/** `true` while this layer is still a draft. */\n\tdraft: boolean;\n}\n\n/**\n * A stack's layers, ordered bottom to top. `baseRef` is the stack's ultimate target (its trunk), the\n * same distinction drawn on {@link PullRequestStackInfo} — it is NOT the base of any individual layer\n * above the bottom, which targets the layer below it instead.\n */\nexport interface PullRequestStackLayers {\n\t/** Opaque and not comparable across read paths — see {@link PullRequestStackInfo.id}. */\n\tid: string;\n\tnumber: number;\n\t/** The branch the bottom of the stack targets. */\n\tbaseRef: string;\n\t/** The stack's layers, ordered bottom (closest to {@link baseRef}) to top. */\n\tlayers: PullRequestStackLayer[];\n}\n\n/** A pull request's entry in its base branch's merge queue. */\nexport interface PullRequestMergeQueueEntry {\n\tstate: PullRequestMergeQueueState;\n\t/** When the pull request joined the queue. */\n\tenqueuedAt: Date;\n\t/**\n\t * When the provider expects it to merge: its estimate of the time remaining, fixed to a date when the entry was\n\t * read, so it counts down while the entry is held rather than restarting at each render. Absent when the provider\n\t * gives none; may already be past on an entry held a while.\n\t */\n\testimatedMergeAt?: Date;\n\t/** The merge queue's web URL. */\n\turl?: string;\n\t/**\n\t * The entry's 1-based place in the queue, in enqueue order. Absent when the provider gives none. It moves as the\n\t * entries ahead of it merge or leave, so it is never an etag input: an `unchanged` row's position can be stale.\n\t */\n\tposition?: number;\n}\n\n/** A pull request's removal from its base branch's merge queue, other than by merging. */\nexport interface PullRequestMergeQueueRemoval {\n\t/**\n\t * The provider's own reason, passed through as given — GitHub's include `failed_checks` and `manual`, and others\n\t * are undocumented. Empty when the provider gives none. Classify it with `getPullRequestMergeQueueRemovalKind`.\n\t */\n\treason: string;\n\t/** When the pull request was removed. */\n\tremovedAt: Date;\n}\n\n/** One check on a pull request's head commit: a check run, or a commit status. */\nexport interface PullRequestCheckRun {\n\t/** Opaque: compare for equality or hand back to core, never parse. */\n\treadonly id: string;\n\treadonly kind: 'check-run' | 'status';\n\t/** A check run's name, or a commit status's context. */\n\treadonly name: string;\n\t/** The workflow an Actions check run belongs to. */\n\treadonly workflowName?: string;\n\treadonly status: PullRequestCheckRunStatus;\n\t/** Set once `status` is `completed`. */\n\treadonly conclusion?: PullRequestCheckRunConclusion;\n\treadonly url?: string;\n\t/** Whether the base branch requires it to pass. `undefined` means not read (only GitHub.com reads it). */\n\treadonly required?: boolean;\n\treadonly startedAt?: Date;\n\treadonly completedAt?: Date;\n\t/** Whether the check has output or a job log to read. */\n\treadonly hasLog: boolean;\n}\n\nexport type PullRequestCheckRunStatus = 'queued' | 'in-progress' | 'waiting' | 'pending' | 'requested' | 'completed';\n\nexport type PullRequestCheckRunConclusion =\n\t| 'success'\n\t| 'failure'\n\t| 'neutral'\n\t| 'cancelled'\n\t| 'skipped'\n\t| 'timed-out'\n\t| 'action-required'\n\t| 'stale'\n\t| 'startup-failure'\n\t| 'error';\n\n/** A check's log tail, or why it has none. Exactly one of `log` and `unavailable` is set. */\nexport type PullRequestCheckLog =\n\t| { readonly log: PullRequestCheckLogText; readonly unavailable?: never }\n\t| { readonly unavailable: PullRequestCheckLogUnavailableReason; readonly log?: never };\n\n/** The last lines of a check's log. `truncated` means earlier lines exist that `text` doesn't hold. */\nexport interface PullRequestCheckLogText {\n\treadonly text: string;\n\treadonly lineCount: number;\n\treadonly truncated: boolean;\n\t/** An Actions job's log, or another check run's output (its title, summary and text). */\n\treadonly source: 'actions-job-log' | 'check-run-output';\n}\n\n/**\n * `'no-log'`: the check has nothing to read. `'log-not-ready'`: its job is still running. `'log-expired'`: its job\n * finished but the host no longer keeps the log. `'log-too-large'`: the host would only serve the log whole, and it is\n * larger than a read takes, so its last lines can't be told apart from its middle.\n */\nexport type PullRequestCheckLogUnavailableReason = 'no-log' | 'log-not-ready' | 'log-expired' | 'log-too-large';\n\n/** Why adding a pull request to its merge queue, or removing it, failed. */\nexport type PullRequestMergeQueueActionFailureReason =\n\t/** Adding a pull request that is already queued. */\n\t| 'already-queued'\n\t/** The pull request's head moved since it was read, so the head it was asked to queue is stale. */\n\t| 'head-changed'\n\t/** The host refused the action for the pull request's own state: its base branch has no merge queue, it is a\n\t * draft or closed, or it doesn't meet the queue's requirements. */\n\t| 'not-allowed'\n\t/** The account may not add to or remove from this queue. */\n\t| 'permission'\n\t/** The host (or this integration) has no merge queue to act on. */\n\t| 'unsupported'\n\t/** Anything else, including a failure to reach the host. */\n\t| 'unknown';\n\n/**\n * What adding a pull request to its merge queue, or removing it, did. A failure says why, with the host's own message\n * when it gave one — for logs and diagnostics, not for display.\n */\nexport type PullRequestMergeQueueActionResult =\n\t| {\n\t\t\treadonly status: 'queued';\n\t\t\t/** The new entry, when the host returned one. */\n\t\t\treadonly entry?: PullRequestMergeQueueEntry;\n\t }\n\t| { readonly status: 'dequeued' }\n\t| {\n\t\t\treadonly status: 'failed';\n\t\t\treadonly reason: PullRequestMergeQueueActionFailureReason;\n\t\t\treadonly message?: string;\n\t };\n\nexport interface PullRequestReviewer {\n\tisCodeOwner?: boolean;\n\treviewer: PullRequestMember;\n\tstate: PullRequestReviewState;\n\t/**\n\t * The head commit oid this review was submitted against (GitHub). Lets a consumer tell \"the PR moved past\n\t * my review\" (oid !== the PR's current head) from a review still at the tip — without a per-review\n\t * timestamp. Only populated where the full GitHub/GHE projection is selected: the filtered search read, and\n\t * an account-wide sweep that opts in with `includeReviews`. Undefined elsewhere, including reviews the\n\t * repo-scoped read carries natively.\n\t */\n\tcommitOid?: string;\n\t/**\n\t * The reviewer is a group the current user is a member of (a team or another group, directly or through a group\n\t * nested in it) rather than a person: a request to it is one the user can answer as a member, not one addressed to\n\t * them by name. Only the Azure DevOps reads that resolve the user's groups set it; absent elsewhere, including for\n\t * groups a read could not tell the user belongs to.\n\t */\n\tisMyGroup?: boolean;\n}\n\nexport type PullRequestRepositoryIdentityDescriptor = RequireSomeWithProps<\n\tRequireSome<RepositoryIdentityDescriptor<string>, 'provider'>,\n\t'provider',\n\t'id' | 'domain' | 'repoDomain' | 'repoName'\n> &\n\tRequireSomeWithProps<RequireSome<RepositoryIdentityDescriptor<string>, 'remote'>, 'remote', 'domain'>;\n"],"mappings":";;;;;;AAgIO,IAAM,cAAA,eAAN,MAAM,YAAwC;CAOnC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CA/CjB,OAAgB;CAEhB,YACC,UACA,QACA,IACA,QACA,OACA,KACA,YACA,OACA,aACA,aACA,YACA,YACA,gBACA,iBACA,MACA,SACA,WACA,WACA,eACA,eACA,gBACA,gBACA,eACA,WACA,wBACA,SACA,SAGA,aACA,OACA,cAEA,MACA,QACA,cACA,YACA,QACA,kBACA,WACA,YACA,oBACA,mBACA,WACA,oBACC;EA7Ce,KAAA,WAAA;EACA,KAAA,SAAA;EACA,KAAA,KAAA;EACA,KAAA,SAAA;EACA,KAAA,QAAA;EACA,KAAA,MAAA;EACA,KAAA,aAAA;EACA,KAAA,Q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,yBAAA,2BAAA;CACN,0BAAA,aAAA;CACA,0BAAA,eAAA;CACA,0BAAA,iBAAA;CACA,0BAAA,mBAAA;CACA,0BAAA,qBAAA;;AACD,EAAA,CAAA,CAAA;;AAGA,IAAkB,6BAAX,yBAAA,4BAAA;CACN,2BAAA,YAAA;;CAEA,2BAAA,oBAAA;CACA,2BAAA,eAAA;CACA,2BAAA,iBAAA;CACA,2BAAA,YAAA;;AACD,EAAA,CAAA,CAAA;AAEA,IAAkB,oCAAX,yBAAA,mCAAA;CACN,kCAAA,aAAA;CACA,kCAAA,aAAA;CACA,kCAAA,YAAA;;AACD,EAAA,CAAA,CAAA;AAEA,IAAkB,yBAAX,yBAAA,wBAAA;CACN,uBAAA,WAAA;CACA,uBAAA,YAAA;CACA,uBAAA,YAAA;;AACD,EAAA,CAAA,CAAA;AAEA,IAAkB,yBAAX,yBAAA,wBAAA;CACN,uBAAA,cAAA;CACA,uBAAA,sBAAA;CACA,uBAAA,eAAA;CACA,uBAAA,eAAA;CACA,uBAAA,aAAA;CACA,uBAAA,qBAAA;;AACD,EAAA,CAAA,CAAA;;AAyBA,IAAY,oBAAL,yBAAA,mBAAA;CACN,kBAAA,YAAA;CACA,kBAAA,cAAA;CACA,kBAAA,qBAAA;;;;;;;;CAQA,kBAAA,cAAA;CACA,kBAAA,aAAA;;AACD,EAAA,CAAA,CAAA;;;;;;;AAiCA,MAAa,yBAA6C"}
1
+ {"version":3,"file":"pullRequest.js","names":[],"sources":["../../../../git/src/models/pullRequest.ts"],"sourcesContent":["import { formatDate, fromNow } from '@gitlens/utils/date.js';\nimport { loggable } from '@gitlens/utils/decorators/log.js';\nimport { serializable } from '@gitlens/utils/decorators/serializable.js';\nimport type { RequireSome, RequireSomeWithProps } from '@gitlens/utils/types.js';\nimport type { IssueProject, IssueRepository } from './issue.js';\nimport type {\n\tIssueMilestone,\n\tIssueOrPullRequest,\n\tIssueOrPullRequestState as PullRequestState,\n} from './issueOrPullRequest.js';\nimport type { ProviderReference } from './remoteProvider.js';\nimport type { RepositoryIdentityDescriptor } from './repositoryIdentities.js';\n\nexport type { PullRequestState };\n\n/**\n * The read that produced a pull request row, as a key for `getPullRequestFieldPresence` (`@gitlens/integrations`). It\n * names a READ, not a field set: the same tag can carry different fields on different providers.\n */\nexport type PullRequestProjection =\n\t/** A single-item read: by number, for a branch, or for a commit. */\n\t| 'point'\n\t/** The filtered search with the full projection, and the host's \"my pull requests\" search. */\n\t| 'search'\n\t/** The filtered search with `summary`. */\n\t| 'search-summary'\n\t/** The free-text search (`searchPullRequests`). */\n\t| 'text-search'\n\t/** An account-wide sweep with the full projection (`includeReviews`). */\n\t| 'account'\n\t/** An account-wide list or sweep with the lightweight projection. */\n\t| 'account-summary'\n\t/** A repository-scoped list or sweep. */\n\t| 'repos'\n\t/** A repository-scoped list with `summary`. */\n\t| 'repos-summary'\n\t/** The coordinate and branch batch reads. */\n\t| 'batch';\n\nexport interface PullRequestShape extends IssueOrPullRequest {\n\treadonly state: PullRequestState;\n\treadonly author: PullRequestMember;\n\t/**\n\t * Canonical base-repository identity returned by the provider. Some providers\n\t * scope pull-request ids to a repository, so consumers must not have to infer\n\t * identity from optional refs or URLs.\n\t */\n\treadonly repository?: IssueRepository;\n\treadonly mergedDate?: Date;\n\treadonly refs?: PullRequestRefs;\n\treadonly isDraft?: boolean;\n\treadonly additions?: number;\n\treadonly deletions?: number;\n\treadonly filesChanged?: number;\n\treadonly body?: string;\n\treadonly mergeableState?: PullRequestMergeableState;\n\treadonly reviewDecision?: PullRequestReviewDecision;\n\treadonly reviewRequests?: PullRequestReviewer[];\n\t/**\n\t * Reviews already submitted, as opposed to the still-pending {@link reviewRequests}. Absent means the read\n\t * didn't fetch reviews; empty means nobody has reviewed — but only where the read actually fetched them, which\n\t * is provider- and read-dependent: ask `getPullRequestFieldPresence` (`@gitlens/integrations`) for the row's\n\t * `reviews` group rather than trusting an empty array.\n\t * {@link PullRequestReviewer.commitOid} is the narrower promise: only the full GitHub/GHE projection has it.\n\t */\n\treadonly latestReviews?: PullRequestReviewer[];\n\treadonly assignees?: PullRequestMember[];\n\treadonly project?: IssueProject;\n\treadonly stack?: PullRequestStackInfo;\n\t/**\n\t * The pull request's place in its base branch's merge queue. Absent means either not queued or not fetched — ask\n\t * `getPullRequestFieldPresence` (`@gitlens/integrations`) for the row's `mergeQueue` group to tell them apart.\n\t * Only GitHub.com reports one.\n\t */\n\treadonly mergeQueue?: PullRequestMergeQueueEntry;\n\t/**\n\t * Whether the base branch accepts this pull request only through a merge queue, so merging it means adding it to\n\t * the queue. `undefined` means not read; read wherever `mergeQueue` is (the same `mergeQueue` field group).\n\t */\n\treadonly mergeQueueRequired?: boolean;\n\t/**\n\t * The pull request's latest removal from its merge queue, set only while that removal is its latest merge-queue\n\t * event (it hasn't rejoined since) and the removal didn't merge it. It stays set however much later the pull\n\t * request changes, so ask `isPullRequestMergeQueueRemovalCurrent` whether it still describes the pull request.\n\t * Read wherever `mergeQueue` is (the same `mergeQueue` field group); absent there means no such removal.\n\t */\n\treadonly mergeQueueRemoval?: PullRequestMergeQueueRemoval;\n\t/**\n\t * The head commit's individual check results. `undefined` means not read; empty means read and the head has no\n\t * checks. Only GitHub and GitHub Enterprise read them, and only for a read that asks (`checkRuns`); ask\n\t * `getPullRequestFieldPresence` (`@gitlens/integrations`) for the row's `checkRuns` group.\n\t */\n\treadonly checkRuns?: readonly PullRequestCheckRun[];\n\t/** Set when the head has more checks than {@link checkRuns} holds. Read wherever `checkRuns` is. */\n\treadonly checkRunsTruncated?: true;\n\treadonly number?: number;\n\treadonly authoredByMe?: boolean;\n\t/**\n\t * The current account as this pull request's members identify it: the identity its people were matched against,\n\t * present whenever it was resolved (see {@link viewerUnresolved} for an Azure DevOps row it couldn't be for). {@link authoredByMe} is matched against it too, and stays `undefined` when the\n\t * row has no author, though its reviewers or assignees still get this. A consumer matching {@link reviewRequests}\n\t * or {@link latestReviews} entries to the current user compares against this, not the account `getCurrentAccount`\n\t * returns: Azure DevOps can know one person by another id in each organization (Azure DevOps Server: collection)\n\t * than the account's, and the members carry the organization's. Core matches `username` too only on GitHub and\n\t * GitHub Enterprise, whose rows key people by login.\n\t */\n\treadonly viewer?: { readonly id: string; readonly username?: string };\n\t/**\n\t * Set, and only ever `true`, on an Azure DevOps row that names someone (its author, a reviewer or an assignee)\n\t * whose organization's (Azure DevOps Server: collection's) identity the read tried and failed to resolve: its\n\t * `ConnectionData` failed, answered without an identity, or didn't answer within 10 seconds. Such a row has neither\n\t * {@link viewer} nor {@link authoredByMe}, and neither the account `getCurrentAccount` returns nor anyone else can\n\t * be matched against its people: whether it is the current user's, or asks for their review, is unknown, not \"no\".\n\t * Absent everywhere else, so a row with neither field is still one whose identity wasn't resolved for another\n\t * reason (a read that doesn't resolve it, or a failed account read), as before.\n\t */\n\treadonly viewerUnresolved?: true;\n\t/** The read that produced this row. Absent means unknown: a legacy row, or a provider or read not yet tagged. */\n\treadonly projection?: PullRequestProjection;\n\t/**\n\t * The change stamp `getPullRequestsBatch` (`@gitlens/integrations`) would give this row. Set only by a sweep asked\n\t * for `etagIncludes`, and only on a row as complete as that batch read's.\n\t */\n\treadonly etag?: string;\n}\n\n@loggable(i => i.id)\n@serializable\nexport class PullRequest implements PullRequestShape {\n\tdeclare readonly capturedAt?: number;\n\tdeclare readonly captureId?: string;\n\tdeclare readonly etag?: string;\n\treadonly type = 'pullrequest';\n\n\tconstructor(\n\t\tpublic readonly provider: ProviderReference,\n\t\tpublic readonly author: PullRequestMember,\n\t\tpublic readonly id: string,\n\t\tpublic readonly nodeId: string | undefined,\n\t\tpublic readonly title: string,\n\t\tpublic readonly url: string,\n\t\tpublic readonly repository: IssueRepository,\n\t\tpublic readonly state: PullRequestState,\n\t\tpublic readonly createdDate: Date,\n\t\tpublic readonly updatedDate: Date,\n\t\tpublic readonly closedDate?: Date,\n\t\tpublic readonly mergedDate?: Date,\n\t\tpublic readonly mergeableState?: PullRequestMergeableState,\n\t\tpublic readonly viewerCanUpdate?: boolean,\n\t\tpublic readonly refs?: PullRequestRefs,\n\t\tpublic readonly isDraft?: boolean,\n\t\tpublic readonly additions?: number,\n\t\tpublic readonly deletions?: number,\n\t\tpublic readonly commentsCount?: number,\n\t\tpublic readonly thumbsUpCount?: number,\n\t\tpublic readonly reviewDecision?: PullRequestReviewDecision,\n\t\tpublic readonly reviewRequests?: PullRequestReviewer[],\n\t\tpublic readonly latestReviews?: PullRequestReviewer[],\n\t\tpublic readonly assignees?: PullRequestMember[],\n\t\tpublic readonly statusCheckRollupState?: PullRequestStatusCheckRollupState,\n\t\tpublic readonly project?: IssueProject,\n\t\tpublic readonly version?: number,\n\t\t/** Commits on the head that aren't on the base. Appended rather than slotted with the other counts:\n\t\t * this constructor is positional and every mapper passes through it. */\n\t\tpublic readonly commitCount?: number,\n\t\tpublic readonly stack?: PullRequestStackInfo,\n\t\tpublic readonly filesChanged?: number,\n\t\t/** The pull request's description, as markdown. */\n\t\tpublic readonly body?: string,\n\t\tpublic readonly number?: number,\n\t\tpublic readonly authoredByMe?: boolean,\n\t\tpublic readonly projection?: PullRequestProjection,\n\t\tpublic readonly viewer?: { readonly id: string; readonly username?: string },\n\t\tpublic readonly viewerUnresolved?: true,\n\t\tpublic readonly milestone?: IssueMilestone | null,\n\t\tpublic readonly mergeQueue?: PullRequestMergeQueueEntry,\n\t\tpublic readonly mergeQueueRequired?: boolean,\n\t\tpublic readonly mergeQueueRemoval?: PullRequestMergeQueueRemoval,\n\t\tpublic readonly checkRuns?: readonly PullRequestCheckRun[],\n\t\tpublic readonly checkRunsTruncated?: true,\n\t) {}\n\n\tget closed(): boolean {\n\t\treturn this.state === 'closed';\n\t}\n\n\tstatic is(pr: unknown): pr is PullRequest {\n\t\treturn pr instanceof PullRequest;\n\t}\n\n\tstatic formatDate(pr: PullRequestShape, format?: string | null): string {\n\t\treturn formatDate(pr.mergedDate ?? pr.closedDate ?? pr.updatedDate, format ?? 'MMMM Do, YYYY h:mma');\n\t}\n\n\tstatic formatDateFromNow(pr: PullRequestShape): string {\n\t\treturn fromNow(pr.mergedDate ?? pr.closedDate ?? pr.updatedDate);\n\t}\n\n\tstatic formatDateWithStyle(\n\t\tpr: PullRequestShape,\n\t\tformatting: { dateStyle: string; dateFormat: string | null },\n\t): string {\n\t\treturn formatting.dateStyle === 'absolute'\n\t\t\t? PullRequest.formatDate(pr, formatting.dateFormat)\n\t\t\t: PullRequest.formatDateFromNow(pr);\n\t}\n}\n\nexport const enum PullRequestReviewDecision {\n\tApproved = 'Approved',\n\tChangesRequested = 'ChangesRequested',\n\tReviewRequired = 'ReviewRequired',\n}\n\nexport const enum PullRequestMergeableState {\n\tUnknown = 'Unknown',\n\tMergeable = 'Mergeable',\n\tConflicting = 'Conflicting',\n\tFailingChecks = 'FailingChecks',\n\tBlockedByPolicy = 'BlockedByPolicy',\n}\n\n/** Where a queued pull request stands in its merge queue. Mirrors GitHub's `MergeQueueEntryState`. */\nexport const enum PullRequestMergeQueueState {\n\tQueued = 'Queued',\n\t/** Waiting for its required checks to pass. */\n\tAwaitingChecks = 'AwaitingChecks',\n\tMergeable = 'Mergeable',\n\tUnmergeable = 'Unmergeable',\n\tLocked = 'Locked',\n}\n\nexport const enum PullRequestStatusCheckRollupState {\n\tSuccess = 'success',\n\tPending = 'pending',\n\tFailed = 'failed',\n}\n\nexport const enum PullRequestMergeMethod {\n\tMerge = 'merge',\n\tSquash = 'squash',\n\tRebase = 'rebase',\n}\n\nexport const enum PullRequestReviewState {\n\tApproved = 'APPROVED',\n\tChangesRequested = 'CHANGES_REQUESTED',\n\tCommented = 'COMMENTED',\n\tDismissed = 'DISMISSED',\n\tPending = 'PENDING',\n\tReviewRequested = 'REVIEW_REQUESTED',\n}\n\nexport interface PullRequestComparisonRefs {\n\trepoPath: string;\n\tbase: { ref: string; label: string };\n\thead: { ref: string; label: string };\n}\n\nexport interface PullRequestMember {\n\tid: string;\n\t/**\n\t * Absent when the provider exposes no display name for the member — same contract as `IssueMember.name`: a\n\t * fallback invented here can't be told apart from a real name downstream, so each consumer picks its own\n\t * presentation.\n\t */\n\tname?: string;\n\t/** The provider's handle for this person, when it has one — GitHub's login, Azure's `uniqueName` (a UPN,\n\t * so an email), Bitbucket's mutable `nickname`. Display/labelling only: it is neither guaranteed present\n\t * (GitLab's native mapper has none) nor a stable identity, so never key a match off it. */\n\tusername?: string;\n\tavatarUrl?: string;\n\turl?: string;\n}\n\n/** Provider-neutral relationship facets shared by PR listings and filtered PR search. */\nexport enum PullRequestFilter {\n\tAuthor = 'author',\n\tAssignee = 'assignee',\n\tReviewRequested = 'review-requested',\n\t/**\n\t * PRs the user has already reviewed (GitHub `reviewed-by:@me`), as opposed to `ReviewRequested` (a\n\t * still-pending request). Distinguishes \"waiting on the author after my review\" from \"waiting for my\n\t * review\". Not expressible on the repo-scoped listing — no provider SDK exposes a reviewed-by axis there —\n\t * so it is advertised for the account-wide read and for the filtered search (which can still bound itself\n\t * to repositories or an org), never under `supportedPullRequestFilters`.\n\t */\n\tReviewed = 'reviewed-by',\n\tMention = 'mention',\n}\n\n/** Selects which pull request states a read should include. `all` covers open + closed + merged. */\nexport type PullRequestStateFilter = 'open' | 'closed' | 'merged' | 'all';\n\n/**\n * A field a pull-request read can be ordered by, provider-neutral.\n *\n * Only two, and deliberately so — unlike {@link IssueSortField} this is the INTERSECTION of what GitHub's PR\n * search can order by server-side and what a {@link PullRequestShape} carries, because the filtered PR search\n * always merges its relationship × state facets in the facade and so must re-order the union itself (see\n * `getPullRequestComparator`). `created` and `updated` are both. A field GitHub cannot order PRs by, or one a\n * merged page can't reproduce, is left out rather than advertised and then approximated: relevance is unstable\n * and has no comparable value on a merge, and priority is not a pull-request concept on any provider that has PRs.\n */\nexport type PullRequestSortField =\n\t/** Creation date. */\n\t| 'created'\n\t/** Last activity. */\n\t| 'updated';\n\n/**\n * How a pull-request read is ordered, as `field:direction` — the same serializable shape {@link IssueSorting}\n * and `BranchSorting` use, so a consumer can persist it, compare it, or bind it straight to a setting or dropdown.\n */\nexport type PullRequestSorting = `${PullRequestSortField}:asc` | `${PullRequestSortField}:desc`;\n\n/**\n * The order the filtered pull-request search applies when the caller asks for none: most recently updated first,\n * which is what it served before ordering was an option. Named once rather than per layer — the criteria model\n * documents it, the GitHub query emits it, and the result-ceiling warning quotes it — so the three cannot\n * disagree about what \"the default\" is.\n */\nexport const defaultPullRequestSort: PullRequestSorting = 'updated:desc';\n\n/**\n * What the filtered pull-request search narrows on.\n *\n * Structured rather than a provider query string so callers can send free text without giving it a qualifier\n * channel, and can check {@link PullRequestSearchCapabilities} before issuing a read. Every requested criterion\n * is validated all-or-nothing before the provider runs; unsupported criteria never fall through to a wider\n * result set whose paging would no longer describe the returned items.\n *\n * Relationships are OR-ed, as are states. Omitting `relationships` removes the current-user constraint, which is\n * only safe when the manager call supplies a repository or organization scope. Omitting `states` reads open PRs.\n */\nexport interface PullRequestSearchCriteria {\n\t/**\n\t * Free text matched by the provider's own relevance rules. Tokens that look like provider qualifiers are\n\t * removed before the query is built, so text cannot change the search's scope or state.\n\t */\n\ttext?: string;\n\t/** Current-user relationship facets to union. Empty/omitted means no relationship constraint. */\n\trelationships?: PullRequestFilter[];\n\t/** Pull request states to union. Empty/omitted reads open PRs; `all` subsumes every other member. */\n\tstates?: PullRequestStateFilter[];\n\t/** ISO date (`YYYY-MM-DD`). The most effective narrowing criterion by far on a large scope. */\n\tupdatedAfter?: string;\n\t/** ISO date (`YYYY-MM-DD`). */\n\tcreatedAfter?: string;\n\t/** Includes PRs from archived repositories. They are excluded by default. */\n\tincludeArchived?: boolean;\n\t/**\n\t * Narrows on draft state: `true` returns only drafts, `false` only ready-for-review PRs. Omitted places no\n\t * constraint. A boolean rather than a truthy flag because `false` is a distinct request, not the absence of one.\n\t */\n\tdraft?: boolean;\n\t/**\n\t * How to order the results. Omitted means `updated:desc`, which is what this search has always served.\n\t *\n\t * Validated all-or-nothing against {@link PullRequestSearchCapabilities.sorts} like every other criterion: a\n\t * key the provider can't express server-side refuses the WHOLE read rather than falling back to the default,\n\t * because combined with the provider's result ceiling another order returns a different subset than was asked\n\t * for and the paging that comes with it describes that other subset. Do not change it mid-pagination — a\n\t * cursor carries the sort it was produced under; drop the cursor instead of threading it under a new key.\n\t */\n\tsort?: PullRequestSorting;\n\t/**\n\t * UTC timestamp (`YYYY-MM-DDTHH:MM:SSZ`). Returns pull requests in every state updated at or after it, oldest\n\t * update first, and the result's `openCount`. Requires `states` omitted or `['all']`, `sort` omitted or\n\t * `updated:asc`, and at most one relationship; anything else is refused.\n\t */\n\tchangedSince?: string;\n}\n\n/**\n * Which {@link PullRequestSearchCriteria} fields and manager-level scopes a provider can express server-side.\n * An empty `relationships` means the provider has no filtered PR search at all.\n */\nexport interface PullRequestSearchCapabilities {\n\t/** Current-user relationship facets the provider can union. Empty means the search itself is unsupported. */\n\trelationships: PullRequestFilter[];\n\t/** Individual state values the provider can union in one logical search. */\n\tstates: PullRequestStateFilter[];\n\ttext: boolean;\n\tupdatedAfter: boolean;\n\tcreatedAfter: boolean;\n\tincludeArchived: boolean;\n\t/** Whether the provider can constrain the search by draft state server-side. */\n\tdraft: boolean;\n\t/** Whether the manager's repository-descriptor scope is supported. */\n\trepositoryScope: boolean;\n\t/** Whether the manager's organization scope is supported. */\n\torganizationScope: boolean;\n\t/**\n\t * Sort keys the search can express server-side. Always contains at least `updated:desc` — the historical\n\t * default — when the search exists at all, so it is never empty for a usable surface; a provider without a\n\t * filtered PR search reports an empty `relationships`, which is already the signal there is no surface to order.\n\t */\n\tsorts: PullRequestSorting[];\n\t/** Whether {@link PullRequestSearchCriteria.changedSince} and the open count it returns are supported. */\n\tchangedSince: boolean;\n}\n\nexport interface PullRequestRef {\n\t/**\n\t * `undefined` when the ref's repository was deleted (a removed fork): GitHub's rows say so, with `exists` false.\n\t * provider-apis' converters fill `''` instead, so test for a value rather than for `undefined`.\n\t */\n\towner: string | undefined;\n\t/**\n\t * The repository's name, never a path: a GitLab nested group is all {@link owner}. `undefined` (or `''`) when the\n\t * ref's repository was deleted, as {@link owner}.\n\t */\n\trepo: string | undefined;\n\tbranch: string;\n\tsha: string;\n\texists: boolean;\n\t/**\n\t * Web URL of the ref's repository. `undefined` when the provider cannot resolve it — Azure DevOps embeds an\n\t * abbreviated repository reference in a pull request, so a fork's URL may need a lookup that can fail.\n\t */\n\turl: string | undefined;\n\t/** HTTPS clone URL of the ref's repository, when the provider exposes it. */\n\tcloneHttps?: string;\n\t/** SSH clone URL of the ref's repository, when the provider exposes it. */\n\tcloneSsh?: string;\n\t/** Best-effort flag: whether the ref's repository is a fork. `undefined` when the provider can't tell. */\n\tisFork?: boolean;\n}\n\nexport interface PullRequestRefs {\n\tbase: PullRequestRef & { url: string };\n\thead: PullRequestRef;\n\tisCrossRepository: boolean;\n}\n\n/**\n * A pull request's membership in a stack — an ordered chain of dependent pull requests where each\n * targets the branch of the one below it.\n *\n * `baseRef` is the stack's ultimate target (its trunk) and is NOT the same as `refs.base`, which for\n * anything above the bottom layer names the layer below. Use `refs.base` to diff a single layer; use\n * `baseRef` to answer where the work ultimately lands.\n */\nexport interface PullRequestStackInfo {\n\t/**\n\t * Opaque, and NOT comparable across read paths: GitHub's GraphQL selection returns a node id\n\t * (`PRS_kwDO…`) while its REST stacks endpoint returns a numeric id (`1347135`) that we stringify —\n\t * both verified against the same live stack. Use {@link number} to identify a stack; two views of one\n\t * stack agree there and will not agree here.\n\t */\n\tid: string;\n\t/** Identifies the stack within its repository. */\n\tnumber: number;\n\t/** Total pull requests in the stack. */\n\tsize: number;\n\t/** This pull request's layer, 1-based, where 1 is closest to `baseRef`. */\n\tposition: number;\n\t/** The branch the bottom of the stack targets. */\n\tbaseRef: string;\n\t/** How many of the stack's layers have merged; they stay counted in {@link size} and `position`.\n\t * `undefined` when the read didn't fetch it. */\n\tmergedLayers?: number;\n}\n\n/**\n * One layer of a stack — the pull request occupying it, and the head ref a rebase or push needs to act\n * on. Unlike {@link PullRequestStackInfo}, which locates a single pull request within a stack, this is\n * the per-layer detail a caller walking the whole stack needs, e.g. to cascade a rebase bottom to top.\n */\nexport interface PullRequestStackLayer {\n\t/** The pull request's number. */\n\tnumber: number;\n\t/** The pull request's head branch name, without a remote prefix. */\n\theadRef: string;\n\t/** The head branch's tip when the stack was read. */\n\theadSha: string;\n\t/** `true` once this layer has landed. */\n\tmerged: boolean;\n\t/** `true` while this layer is still a draft. */\n\tdraft: boolean;\n}\n\n/**\n * A stack's layers, ordered bottom to top. `baseRef` is the stack's ultimate target (its trunk), the\n * same distinction drawn on {@link PullRequestStackInfo} — it is NOT the base of any individual layer\n * above the bottom, which targets the layer below it instead.\n */\nexport interface PullRequestStackLayers {\n\t/** Opaque and not comparable across read paths — see {@link PullRequestStackInfo.id}. */\n\tid: string;\n\tnumber: number;\n\t/** The branch the bottom of the stack targets. */\n\tbaseRef: string;\n\t/** The stack's layers, ordered bottom (closest to {@link baseRef}) to top. */\n\tlayers: PullRequestStackLayer[];\n}\n\n/** A pull request's entry in its base branch's merge queue. */\nexport interface PullRequestMergeQueueEntry {\n\tstate: PullRequestMergeQueueState;\n\t/** When the pull request joined the queue. */\n\tenqueuedAt: Date;\n\t/**\n\t * When the provider expects it to merge: its estimate of the time remaining, fixed to a date when the entry was\n\t * read, so it counts down while the entry is held rather than restarting at each render. Absent when the provider\n\t * gives none; may already be past on an entry held a while.\n\t */\n\testimatedMergeAt?: Date;\n\t/** The merge queue's web URL. */\n\turl?: string;\n\t/**\n\t * The entry's 1-based place in the queue, in enqueue order. Absent when the provider gives none. It moves as the\n\t * entries ahead of it merge or leave, so it is never an etag input: an `unchanged` row's position can be stale.\n\t */\n\tposition?: number;\n}\n\n/** A pull request's removal from its base branch's merge queue, other than by merging. */\nexport interface PullRequestMergeQueueRemoval {\n\t/**\n\t * The provider's own reason, passed through as given — GitHub's include `failed_checks` and `manual`, and others\n\t * are undocumented. Empty when the provider gives none. Classify it with `getPullRequestMergeQueueRemovalKind`.\n\t */\n\treason: string;\n\t/** When the pull request was removed. */\n\tremovedAt: Date;\n}\n\n/** One check on a pull request's head commit: a check run, or a commit status. */\nexport interface PullRequestCheckRun {\n\t/** Opaque: compare for equality or hand back to core, never parse. */\n\treadonly id: string;\n\treadonly kind: 'check-run' | 'status';\n\t/** A check run's name, or a commit status's context. */\n\treadonly name: string;\n\t/** The workflow an Actions check run belongs to. */\n\treadonly workflowName?: string;\n\treadonly status: PullRequestCheckRunStatus;\n\t/** Set once `status` is `completed`. */\n\treadonly conclusion?: PullRequestCheckRunConclusion;\n\treadonly url?: string;\n\t/** Whether the base branch requires it to pass. `undefined` means not read (only GitHub.com reads it). */\n\treadonly required?: boolean;\n\treadonly startedAt?: Date;\n\treadonly completedAt?: Date;\n\t/** Whether the check has output or a job log to read. */\n\treadonly hasLog: boolean;\n}\n\nexport type PullRequestCheckRunStatus = 'queued' | 'in-progress' | 'waiting' | 'pending' | 'requested' | 'completed';\n\nexport type PullRequestCheckRunConclusion =\n\t| 'success'\n\t| 'failure'\n\t| 'neutral'\n\t| 'cancelled'\n\t| 'skipped'\n\t| 'timed-out'\n\t| 'action-required'\n\t| 'stale'\n\t| 'startup-failure'\n\t| 'error';\n\n/** A check's log tail, or why it has none. Exactly one of `log` and `unavailable` is set. */\nexport type PullRequestCheckLog =\n\t| { readonly log: PullRequestCheckLogText; readonly unavailable?: never }\n\t| { readonly unavailable: PullRequestCheckLogUnavailableReason; readonly log?: never };\n\n/** The last lines of a check's log. `truncated` means earlier lines exist that `text` doesn't hold. */\nexport interface PullRequestCheckLogText {\n\treadonly text: string;\n\treadonly lineCount: number;\n\treadonly truncated: boolean;\n\t/** An Actions job's log, or another check run's output (its title, summary and text). */\n\treadonly source: 'actions-job-log' | 'check-run-output';\n}\n\n/**\n * `'no-log'`: the check has nothing to read. `'log-not-ready'`: its job is still running. `'log-expired'`: its job\n * finished but the host no longer keeps the log. `'log-too-large'`: the host would only serve the log whole, and it is\n * larger than a read takes, so its last lines can't be told apart from its middle.\n */\nexport type PullRequestCheckLogUnavailableReason = 'no-log' | 'log-not-ready' | 'log-expired' | 'log-too-large';\n\n/** Why adding a pull request to its merge queue, or removing it, failed. */\nexport type PullRequestMergeQueueActionFailureReason =\n\t/** Adding a pull request that is already queued. */\n\t| 'already-queued'\n\t/** The pull request's head moved since it was read, so the head it was asked to queue is stale. */\n\t| 'head-changed'\n\t/** The host refused the action for the pull request's own state: its base branch has no merge queue, it is a\n\t * draft or closed, or it doesn't meet the queue's requirements. */\n\t| 'not-allowed'\n\t/** The account may not add to or remove from this queue. */\n\t| 'permission'\n\t/** The host (or this integration) has no merge queue to act on. */\n\t| 'unsupported'\n\t/** Anything else, including a failure to reach the host. */\n\t| 'unknown';\n\n/**\n * What adding a pull request to its merge queue, or removing it, did. A failure says why, with the host's own message\n * when it gave one — for logs and diagnostics, not for display.\n */\nexport type PullRequestMergeQueueActionResult =\n\t| {\n\t\t\treadonly status: 'queued';\n\t\t\t/** The new entry, when the host returned one. */\n\t\t\treadonly entry?: PullRequestMergeQueueEntry;\n\t }\n\t| { readonly status: 'dequeued' }\n\t| {\n\t\t\treadonly status: 'failed';\n\t\t\treadonly reason: PullRequestMergeQueueActionFailureReason;\n\t\t\treadonly message?: string;\n\t };\n\nexport interface PullRequestReviewer {\n\tisCodeOwner?: boolean;\n\treviewer: PullRequestMember;\n\tstate: PullRequestReviewState;\n\t/**\n\t * The head commit oid this review was submitted against (GitHub). Lets a consumer tell \"the PR moved past\n\t * my review\" (oid !== the PR's current head) from a review still at the tip — without a per-review\n\t * timestamp. Only populated where the full GitHub/GHE projection is selected: the filtered search read, and\n\t * an account-wide sweep that opts in with `includeReviews`. Undefined elsewhere, including reviews the\n\t * repo-scoped read carries natively.\n\t */\n\tcommitOid?: string;\n\t/**\n\t * The reviewer is a group the current user is a member of (a team or another group, directly or through a group\n\t * nested in it) rather than a person: a request to it is one the user can answer as a member, not one addressed to\n\t * them by name. Only the Azure DevOps reads that resolve the user's groups set it; absent elsewhere, including for\n\t * groups a read could not tell the user belongs to.\n\t */\n\tisMyGroup?: boolean;\n}\n\nexport type PullRequestRepositoryIdentityDescriptor = RequireSomeWithProps<\n\tRequireSome<RepositoryIdentityDescriptor<string>, 'provider'>,\n\t'provider',\n\t'id' | 'domain' | 'repoDomain' | 'repoName'\n> &\n\tRequireSomeWithProps<RequireSome<RepositoryIdentityDescriptor<string>, 'remote'>, 'remote', 'domain'>;\n"],"mappings":";;;;;;AAgIO,IAAM,cAAA,eAAN,MAAM,YAAwC;CAOnC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CA/CjB,OAAgB;CAEhB,YACC,UACA,QACA,IACA,QACA,OACA,KACA,YACA,OACA,aACA,aACA,YACA,YACA,gBACA,iBACA,MACA,SACA,WACA,WACA,eACA,eACA,gBACA,gBACA,eACA,WACA,wBACA,SACA,SAGA,aACA,OACA,cAEA,MACA,QACA,cACA,YACA,QACA,kBACA,WACA,YACA,oBACA,mBACA,WACA,oBACC;EA7Ce,KAAA,WAAA;EACA,KAAA,SAAA;EACA,KAAA,KAAA;EACA,KAAA,SAAA;EACA,KAAA,QAAA;EACA,KAAA,MAAA;EACA,KAAA,aAAA;EACA,KAAA,QAAA;EACA,KAAA,cAAA;EACA,KAAA,cAAA;EACA,KAAA,aAAA;EACA,KAAA,aAAA;EACA,KAAA,iBAAA;EACA,KAAA,kBAAA;EACA,KAAA,OAAA;EACA,KAAA,UAAA;EACA,KAAA,YAAA;EACA,KAAA,YAAA;EACA,KAAA,gBAAA;EACA,KAAA,gBAAA;EACA,KAAA,iBAAA;EACA,KAAA,iBAAA;EACA,KAAA,gBAAA;EACA,KAAA,YAAA;EACA,KAAA,yBAAA;EACA,KAAA,UAAA;EACA,KAAA,UAAA;EAGA,KAAA,cAAA;EACA,KAAA,QAAA;EACA,KAAA,eAAA;EAEA,KAAA,OAAA;EACA,KAAA,S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BAAX,yBAAA,wBAAA;CACN,uBAAA,WAAA;CACA,uBAAA,YAAA;CACA,uBAAA,YAAA;;AACD,EAAA,CAAA,CAAA;AAEA,IAAkB,yBAAX,yBAAA,wBAAA;CACN,uBAAA,cAAA;CACA,uBAAA,sBAAA;CACA,uBAAA,eAAA;CACA,uBAAA,eAAA;CACA,uBAAA,aAAA;CACA,uBAAA,qBAAA;;AACD,EAAA,CAAA,CAAA;;AAyBA,IAAY,oBAAL,yBAAA,mBAAA;CACN,kBAAA,YAAA;CACA,kBAAA,cAAA;CACA,kBAAA,qBAAA;;;;;;;;CAQA,kBAAA,cAAA;CACA,kBAAA,aAAA;;AACD,EAAA,CAAA,CAAA;;;;;;;AAiCA,MAAa,yBAA6C"}
@@ -9,8 +9,9 @@ export interface GitOperationResult {
9
9
  }
10
10
  /**
11
11
  * Spawn-layer overrides callers can pass to user-initiated git operations to inject per-call
12
- * environment variables, an `AbortSignal` for cancellation, a custom `timeout`, or a `beforeIndexLockRetry`
13
- * hook to re-verify state before an index write is retried. Forwarded
12
+ * environment variables, an `AbortSignal` for cancellation, a custom `timeout`, a `beforeIndexLockRetry`
13
+ * hook to re-verify state before an index write is retried, or an `indexLockWait` to wait longer for a held
14
+ * `index.lock`. Forwarded
14
15
  * verbatim to the underlying `git.run(...)` invocation; cannot override op-owned fields like
15
16
  * `cwd`, `configs`, `errors`, or `stdin`.
16
17
  *
@@ -18,7 +19,7 @@ export interface GitOperationResult {
18
19
  * intentionally disable the timeout (set it to 0) because those operations can take a long
19
20
  * time; a caller-supplied `timeout` will replace that "no timeout" setting, so use with care.
20
21
  */
21
- export type GitOperationRunOptions = Pick<GitRunOptions, 'env' | 'cancellation' | 'timeout' | 'beforeIndexLockRetry'>;
22
+ export type GitOperationRunOptions = Pick<GitRunOptions, 'env' | 'cancellation' | 'timeout' | 'beforeIndexLockRetry' | 'indexLockWait'>;
22
23
  export interface GitOperationsSubProvider {
23
24
  /**
24
25
  * Switches the repository to a branch or ref. Pure branch/ref switching — does not accept
@@ -11,15 +11,21 @@ export interface DisposableTemporaryGitIndex extends UnifiedAsyncDisposable {
11
11
  export interface GitStagingSubProvider {
12
12
  createTemporaryIndex(repoPath: string, from: 'empty' | 'current'): Promise<DisposableTemporaryGitIndex>;
13
13
  createTemporaryIndex(repoPath: string, from: 'ref', ref: string): Promise<DisposableTemporaryGitIndex>;
14
- stageFile(repoPath: string, pathOrUri: string | Uri): Promise<void>;
14
+ /** @throws {StageError} `'indexLocked'` when another process held `index.lock` past the wait; other failures reject as git reported them */
15
+ stageFile(repoPath: string, pathOrUri: string | Uri, runOptions?: GitOperationRunOptions): Promise<void>;
16
+ /** @throws {StageError} `'indexLocked'` when another process held `index.lock` past the wait; other failures reject as git reported them */
15
17
  stageFiles(repoPath: string, pathsOrUris: (string | Uri)[], options?: {
16
18
  index?: DisposableTemporaryGitIndex;
17
19
  intentToAdd?: boolean;
18
- }): Promise<void>;
19
- stageDirectory(repoPath: string, directoryOrUri: string | Uri): Promise<void>;
20
- unstageFile(repoPath: string, pathOrUri: string | Uri): Promise<void>;
21
- unstageFiles(repoPath: string, pathsOrUris: (string | Uri)[]): Promise<void>;
22
- unstageDirectory(repoPath: string, directoryOrUri: string | Uri): Promise<void>;
20
+ }, runOptions?: GitOperationRunOptions): Promise<void>;
21
+ /** @throws {StageError} `'indexLocked'` when another process held `index.lock` past the wait; other failures reject as git reported them */
22
+ stageDirectory(repoPath: string, directoryOrUri: string | Uri, runOptions?: GitOperationRunOptions): Promise<void>;
23
+ /** @throws {StageError} `'indexLocked'` when another process held `index.lock` past the wait; other failures reject as git reported them */
24
+ unstageFile(repoPath: string, pathOrUri: string | Uri, runOptions?: GitOperationRunOptions): Promise<void>;
25
+ /** @throws {StageError} `'indexLocked'` when another process held `index.lock` past the wait; other failures reject as git reported them */
26
+ unstageFiles(repoPath: string, pathsOrUris: (string | Uri)[], runOptions?: GitOperationRunOptions): Promise<void>;
27
+ /** @throws {StageError} `'indexLocked'` when another process held `index.lock` past the wait; other failures reject as git reported them */
28
+ unstageDirectory(repoPath: string, directoryOrUri: string | Uri, runOptions?: GitOperationRunOptions): Promise<void>;
23
29
  /**
24
30
  * Removes a file from both the working tree and the index in a single operation
25
31
  * (`git rm [-f] -- <path>`). Use during conflict resolution when the user has chosen a
@@ -36,8 +42,10 @@ export interface GitStagingSubProvider {
36
42
  removeFiles(repoPath: string, pathsOrUris: (string | Uri)[], options?: {
37
43
  force?: boolean;
38
44
  }): Promise<void>;
39
- stageAll(repoPath: string): Promise<void>;
40
- unstageAll(repoPath: string): Promise<void>;
45
+ /** @throws {StageError} `'indexLocked'` when another process held `index.lock` past the wait; other failures reject as git reported them */
46
+ stageAll(repoPath: string, runOptions?: GitOperationRunOptions): Promise<void>;
47
+ /** @throws {StageError} `'indexLocked'` when another process held `index.lock` past the wait; other failures reject as git reported them */
48
+ unstageAll(repoPath: string, runOptions?: GitOperationRunOptions): Promise<void>;
41
49
  /**
42
50
  * Removes untracked files from the working tree (`git clean`). `force` defaults to `true`, since git
43
51
  * refuses to clean without `-f` unless `clean.requireForce` is `false`. Pass
@@ -104,6 +104,12 @@ export interface GitRunOptions {
104
104
  * index-lock retry calls it, not the config-lock retry.
105
105
  */
106
106
  beforeIndexLockRetry?: (lockError: Error) => void | Promise<void>;
107
+ /**
108
+ * How long a write that finds `index.lock` held by another process keeps retrying before it fails. Left unset, it
109
+ * gives up after about 0.7s; `'extended'` waits about 3s, for a write the user started and is waiting on. A run is
110
+ * only shared with an identical concurrent run asking for the same wait.
111
+ */
112
+ indexLockWait?: 'extended';
107
113
  /**
108
114
  * Non-zero exit codes that are answers rather than failures (e.g. `1` from `diff --quiet`, "has differences");
109
115
  * a listed code resolves as `exited` with that `exitCode` in every `errors` mode.
@@ -22,5 +22,20 @@ export interface HiddenRefPatternDisable {
22
22
  readonly value: Record<string, boolean>;
23
23
  }
24
24
  export declare function getHiddenRefPatternDisable(values: HiddenRefPatternValues, pattern: string): HiddenRefPatternDisable | undefined;
25
+ export type HiddenRefPatternScope = 'global' | 'workspace';
26
+ export interface HiddenRefPatternEdit {
27
+ readonly pattern: string;
28
+ readonly value: boolean | undefined;
29
+ }
30
+ export interface HiddenRefPatternWrite {
31
+ readonly target: HiddenRefPatternScope;
32
+ readonly value: Record<string, boolean> | undefined;
33
+ }
34
+ export declare function getHiddenRefPatternSource(values: HiddenRefPatternValues, pattern: string): {
35
+ readonly scope: HiddenRefPatternScope;
36
+ readonly overridesGlobal: boolean;
37
+ } | undefined;
38
+ export declare function getHiddenRefPatternTarget(values: HiddenRefPatternValues, pattern: string, scope: HiddenRefPatternScope): HiddenRefPatternScope;
39
+ export declare function getHiddenRefPatternWrites(values: HiddenRefPatternValues, edits: readonly HiddenRefPatternEdit[], scope: HiddenRefPatternScope): HiddenRefPatternWrite[];
25
40
  //#endregion
26
41
  //# sourceMappingURL=hiddenRefs.utils.d.ts.map
@@ -72,7 +72,7 @@ function getHiddenRefPatternDisable(values, pattern) {
72
72
  };
73
73
  const members = getHiddenRefPatternGroups(normalizeHiddenRefPatterns(effective).patterns).get(pattern);
74
74
  if (members == null) return void 0;
75
- const keys = Object.keys(effective).filter((k) => effective[k] === true && normalizeHiddenRefPatterns({ [k]: true }).patterns.some((p) => members.includes(p)));
75
+ const keys = getEnabledKeysForMembers(effective, members);
76
76
  if (!keys.length) return void 0;
77
77
  const target = keys.some((k) => workspace[k] === true) ? "workspace" : "global";
78
78
  const value = { ...target === "workspace" ? workspace : global };
@@ -83,7 +83,73 @@ function getHiddenRefPatternDisable(values, pattern) {
83
83
  value
84
84
  };
85
85
  }
86
+ function getEnabledKeysForMembers(effective, members) {
87
+ return Object.keys(effective).filter((k) => effective[k] === true && normalizeHiddenRefPatterns({ [k]: true }).patterns.some((p) => members.includes(p)));
88
+ }
89
+ function getHiddenRefPatternSource(values, pattern) {
90
+ const inGlobal = values.globalValue != null && Object.hasOwn(values.globalValue, pattern);
91
+ if (values.workspaceValue != null && Object.hasOwn(values.workspaceValue, pattern)) return {
92
+ scope: "workspace",
93
+ overridesGlobal: inGlobal
94
+ };
95
+ return inGlobal ? {
96
+ scope: "global",
97
+ overridesGlobal: false
98
+ } : void 0;
99
+ }
100
+ function getHiddenRefPatternTarget(values, pattern, scope) {
101
+ return scope === "workspace" || getHiddenRefPatternSource(values, pattern)?.scope === "workspace" ? "workspace" : "global";
102
+ }
103
+ function getHiddenRefPatternWrites(values, edits, scope) {
104
+ const defaults = values.defaultValue ?? {};
105
+ const layers = {
106
+ global: { ...values.globalValue },
107
+ workspace: { ...values.workspaceValue }
108
+ };
109
+ const changed = /* @__PURE__ */ new Set();
110
+ const remove = (target, key) => {
111
+ if (!Object.hasOwn(layers[target], key)) return;
112
+ layers[target] = Object.fromEntries(Object.entries(layers[target]).filter(([k]) => k !== key));
113
+ changed.add(target);
114
+ };
115
+ for (const edit of edits) {
116
+ if (edit.value === void 0) {
117
+ remove("global", edit.pattern);
118
+ remove("workspace", edit.pattern);
119
+ continue;
120
+ }
121
+ let keys = [edit.pattern];
122
+ if (!edit.value && Object.hasOwn(defaults, edit.pattern)) {
123
+ const effective = {
124
+ ...defaults,
125
+ ...layers.global,
126
+ ...layers.workspace
127
+ };
128
+ const own = normalizeHiddenRefPatterns({ [edit.pattern]: true }).patterns;
129
+ const members = [...getHiddenRefPatternGroups(normalizeHiddenRefPatterns({
130
+ ...effective,
131
+ [edit.pattern]: true
132
+ }).patterns).values()].filter((m) => m.some((p) => own.includes(p))).flat();
133
+ keys = [.../* @__PURE__ */ new Set([edit.pattern, ...getEnabledKeysForMembers(effective, members)])];
134
+ }
135
+ for (const key of keys) {
136
+ const target = getHiddenRefPatternTarget({
137
+ globalValue: layers.global,
138
+ workspaceValue: layers.workspace
139
+ }, key, scope);
140
+ if ((target === "workspace" && Object.hasOwn(layers.global, key) ? layers.global[key] : defaults[key]) === edit.value) remove(target, key);
141
+ else if (layers[target][key] !== edit.value) {
142
+ layers[target][key] = edit.value;
143
+ changed.add(target);
144
+ }
145
+ }
146
+ }
147
+ return ["global", "workspace"].filter((target) => changed.has(target)).map((target) => ({
148
+ target,
149
+ value: Object.keys(layers[target]).length ? layers[target] : void 0
150
+ }));
151
+ }
86
152
  //#endregion
87
- export { getHiddenRefExcludeArgs, getHiddenRefPatternDisable, getHiddenRefPatternGroups, normalizeHiddenRefPatterns };
153
+ export { getHiddenRefExcludeArgs, getHiddenRefPatternDisable, getHiddenRefPatternGroups, getHiddenRefPatternSource, getHiddenRefPatternTarget, getHiddenRefPatternWrites, normalizeHiddenRefPatterns };
88
154
 
89
155
  //# sourceMappingURL=hiddenRefs.utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hiddenRefs.utils.js","names":[],"sources":["../../../../git/src/utils/hiddenRefs.utils.ts"],"sourcesContent":["export type HiddenRefRefusalReason = 'coreNamespace' | 'negation' | 'invalid';\n\nexport interface NormalizedHiddenRefPatterns {\n\treadonly patterns: string[];\n\treadonly key: string;\n\treadonly refused: { pattern: string; reason: HiddenRefRefusalReason }[];\n}\n\nconst coreNamespaces = new Set(['heads', 'remotes', 'tags', 'stash']);\nconst namespacePattern = /^refs\\/([^/*?[\\]\\\\]+)(?:\\/.+)?$/;\nconst globPattern = /[*?[]/;\n\nexport function normalizeHiddenRefPatterns(raw: unknown): NormalizedHiddenRefPatterns {\n\tconst output = new Set<string>();\n\tconst refused: { pattern: string; reason: HiddenRefRefusalReason }[] = [];\n\n\tif (raw != null && typeof raw === 'object' && !Array.isArray(raw)) {\n\t\tfor (const [pattern, enabled] of Object.entries(raw)) {\n\t\t\tif (typeof enabled !== 'boolean') {\n\t\t\t\trefused.push({ pattern: pattern, reason: 'invalid' });\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (!enabled) continue;\n\n\t\t\tlet key = pattern.trim().replace(/\\\\/g, '/').replace(/\\/+$/, '');\n\t\t\tif (!key) continue;\n\n\t\t\tif (key.startsWith('!')) {\n\t\t\t\trefused.push({ pattern: pattern, reason: 'negation' });\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (!key.startsWith('refs/')) {\n\t\t\t\tkey = `refs/${key}`;\n\t\t\t}\n\n\t\t\tconst match = namespacePattern.exec(key);\n\t\t\tif (match == null || coreNamespaces.has(match[1])) {\n\t\t\t\trefused.push({ pattern: pattern, reason: 'coreNamespace' });\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\toutput.add(key);\n\t\t\tif (!globPattern.test(key)) {\n\t\t\t\toutput.add(`${key}/*`);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst patterns = [...output].sort();\n\treturn { patterns: patterns, key: JSON.stringify(patterns), refused: refused };\n}\n\nexport function getHiddenRefExcludeArgs(patterns: readonly string[]): string[] {\n\treturn patterns.map(p => `--exclude=${p}`);\n}\n\nexport function getHiddenRefPatternGroups(patterns: readonly string[]): Map<string, string[]> {\n\tconst groups = new Map<string, string[]>();\n\tfor (const pattern of patterns) {\n\t\tif (pattern.endsWith('/*')) {\n\t\t\tconst base = pattern.slice(0, -2);\n\t\t\tif (!globPattern.test(base) && patterns.includes(base)) continue;\n\t\t}\n\n\t\tconst nested = `${pattern}/*`;\n\t\tgroups.set(pattern, !globPattern.test(pattern) && patterns.includes(nested) ? [pattern, nested] : [pattern]);\n\t}\n\treturn groups;\n}\n\nexport interface HiddenRefPatternValues {\n\treadonly defaultValue?: Readonly<Record<string, boolean>>;\n\treadonly globalValue?: Readonly<Record<string, boolean>>;\n\treadonly workspaceValue?: Readonly<Record<string, boolean>>;\n}\n\nexport interface HiddenRefPatternDisable {\n\treadonly target: 'global' | 'workspace';\n\treadonly keys: string[];\n\treadonly value: Record<string, boolean>;\n}\n\nexport function getHiddenRefPatternDisable(\n\tvalues: HiddenRefPatternValues,\n\tpattern: string,\n): HiddenRefPatternDisable | undefined {\n\tconst global = values.globalValue ?? {};\n\tconst workspace = values.workspaceValue ?? {};\n\tconst effective: Record<string, boolean> = { ...values.defaultValue, ...global, ...workspace };\n\n\tconst members = getHiddenRefPatternGroups(normalizeHiddenRefPatterns(effective).patterns).get(pattern);\n\tif (members == null) return undefined;\n\n\tconst keys = Object.keys(effective).filter(\n\t\tk => effective[k] === true && normalizeHiddenRefPatterns({ [k]: true }).patterns.some(p => members.includes(p)),\n\t);\n\tif (!keys.length) return undefined;\n\n\tconst target = keys.some(k => workspace[k] === true) ? 'workspace' : 'global';\n\tconst value: Record<string, boolean> = { ...(target === 'workspace' ? workspace : global) };\n\tfor (const k of keys) {\n\t\tvalue[k] = false;\n\t}\n\treturn { target: target, keys: keys, value: value };\n}\n"],"mappings":";AAQA,MAAM,iCAAiB,IAAI,IAAI;CAAC;CAAS;CAAW;CAAQ;AAAO,CAAC;AACpE,MAAM,mBAAmB;AACzB,MAAM,cAAc;AAEpB,SAAgB,2BAA2B,KAA2C;CACrF,MAAM,yBAAS,IAAI,IAAY;CAC/B,MAAM,UAAiE,CAAC;CAExE,IAAI,OAAO,QAAQ,OAAO,QAAQ,YAAY,CAAC,MAAM,QAAQ,GAAG,GAC/D,KAAK,MAAM,CAAC,SAAS,YAAY,OAAO,QAAQ,GAAG,GAAG;EACrD,IAAI,OAAO,YAAY,WAAW;GACjC,QAAQ,KAAK;IAAW;IAAS,QAAQ;GAAU,CAAC;GACpD;EACD;EACA,IAAI,CAAC,SAAS;EAEd,IAAI,MAAM,QAAQ,KAAK,CAAC,CAAC,QAAQ,OAAO,GAAG,CAAC,CAAC,QAAQ,QAAQ,EAAE;EAC/D,IAAI,CAAC,KAAK;EAEV,IAAI,IAAI,WAAW,GAAG,GAAG;GACxB,QAAQ,KAAK;IAAW;IAAS,QAAQ;GAAW,CAAC;GACrD;EACD;EAEA,IAAI,CAAC,IAAI,WAAW,OAAO,GAC1B,MAAM,QAAQ;EAGf,MAAM,QAAQ,iBAAiB,KAAK,GAAG;EACvC,IAAI,SAAS,QAAQ,eAAe,IAAI,MAAM,EAAE,GAAG;GAClD,QAAQ,KAAK;IAAW;IAAS,QAAQ;GAAgB,CAAC;GAC1D;EACD;EAEA,OAAO,IAAI,GAAG;EACd,IAAI,CAAC,YA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AAK,UAAU,OAAO,IAAI,IAAI,cAAc;CACrE,MAAM,QAAiC,EAAE,GAAI,WAAW,cAAc,YAAY,OAAQ;CAC1F,KAAK,MAAM,KAAK,MACf,MAAM,KAAK;CAEZ,OAAO;EAAU;EAAc;EAAa;CAAM;AACnD"}
1
+ {"version":3,"file":"hiddenRefs.utils.js","names":[],"sources":["../../../../git/src/utils/hiddenRefs.utils.ts"],"sourcesContent":["export type HiddenRefRefusalReason = 'coreNamespace' | 'negation' | 'invalid';\n\nexport interface NormalizedHiddenRefPatterns {\n\treadonly patterns: string[];\n\treadonly key: string;\n\treadonly refused: { pattern: string; reason: HiddenRefRefusalReason }[];\n}\n\nconst coreNamespaces = new Set(['heads', 'remotes', 'tags', 'stash']);\nconst namespacePattern = /^refs\\/([^/*?[\\]\\\\]+)(?:\\/.+)?$/;\nconst globPattern = /[*?[]/;\n\nexport function normalizeHiddenRefPatterns(raw: unknown): NormalizedHiddenRefPatterns {\n\tconst output = new Set<string>();\n\tconst refused: { pattern: string; reason: HiddenRefRefusalReason }[] = [];\n\n\tif (raw != null && typeof raw === 'object' && !Array.isArray(raw)) {\n\t\tfor (const [pattern, enabled] of Object.entries(raw)) {\n\t\t\tif (typeof enabled !== 'boolean') {\n\t\t\t\trefused.push({ pattern: pattern, reason: 'invalid' });\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (!enabled) continue;\n\n\t\t\tlet key = pattern.trim().replace(/\\\\/g, '/').replace(/\\/+$/, '');\n\t\t\tif (!key) continue;\n\n\t\t\tif (key.startsWith('!')) {\n\t\t\t\trefused.push({ pattern: pattern, reason: 'negation' });\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (!key.startsWith('refs/')) {\n\t\t\t\tkey = `refs/${key}`;\n\t\t\t}\n\n\t\t\tconst match = namespacePattern.exec(key);\n\t\t\tif (match == null || coreNamespaces.has(match[1])) {\n\t\t\t\trefused.push({ pattern: pattern, reason: 'coreNamespace' });\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\toutput.add(key);\n\t\t\tif (!globPattern.test(key)) {\n\t\t\t\toutput.add(`${key}/*`);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst patterns = [...output].sort();\n\treturn { patterns: patterns, key: JSON.stringify(patterns), refused: refused };\n}\n\nexport function getHiddenRefExcludeArgs(patterns: readonly string[]): string[] {\n\treturn patterns.map(p => `--exclude=${p}`);\n}\n\nexport function getHiddenRefPatternGroups(patterns: readonly string[]): Map<string, string[]> {\n\tconst groups = new Map<string, string[]>();\n\tfor (const pattern of patterns) {\n\t\tif (pattern.endsWith('/*')) {\n\t\t\tconst base = pattern.slice(0, -2);\n\t\t\tif (!globPattern.test(base) && patterns.includes(base)) continue;\n\t\t}\n\n\t\tconst nested = `${pattern}/*`;\n\t\tgroups.set(pattern, !globPattern.test(pattern) && patterns.includes(nested) ? [pattern, nested] : [pattern]);\n\t}\n\treturn groups;\n}\n\nexport interface HiddenRefPatternValues {\n\treadonly defaultValue?: Readonly<Record<string, boolean>>;\n\treadonly globalValue?: Readonly<Record<string, boolean>>;\n\treadonly workspaceValue?: Readonly<Record<string, boolean>>;\n}\n\nexport interface HiddenRefPatternDisable {\n\treadonly target: 'global' | 'workspace';\n\treadonly keys: string[];\n\treadonly value: Record<string, boolean>;\n}\n\nexport function getHiddenRefPatternDisable(\n\tvalues: HiddenRefPatternValues,\n\tpattern: string,\n): HiddenRefPatternDisable | undefined {\n\tconst global = values.globalValue ?? {};\n\tconst workspace = values.workspaceValue ?? {};\n\tconst effective: Record<string, boolean> = { ...values.defaultValue, ...global, ...workspace };\n\n\tconst members = getHiddenRefPatternGroups(normalizeHiddenRefPatterns(effective).patterns).get(pattern);\n\tif (members == null) return undefined;\n\n\tconst keys = getEnabledKeysForMembers(effective, members);\n\tif (!keys.length) return undefined;\n\n\tconst target = keys.some(k => workspace[k] === true) ? 'workspace' : 'global';\n\tconst value: Record<string, boolean> = { ...(target === 'workspace' ? workspace : global) };\n\tfor (const k of keys) {\n\t\tvalue[k] = false;\n\t}\n\treturn { target: target, keys: keys, value: value };\n}\n\nfunction getEnabledKeysForMembers(effective: Readonly<Record<string, unknown>>, members: readonly string[]): string[] {\n\treturn Object.keys(effective).filter(\n\t\tk => effective[k] === true && normalizeHiddenRefPatterns({ [k]: true }).patterns.some(p => members.includes(p)),\n\t);\n}\n\nexport type HiddenRefPatternScope = 'global' | 'workspace';\n\nexport interface HiddenRefPatternEdit {\n\treadonly pattern: string;\n\treadonly value: boolean | undefined;\n}\n\nexport interface HiddenRefPatternWrite {\n\treadonly target: HiddenRefPatternScope;\n\treadonly value: Record<string, boolean> | undefined;\n}\n\nexport function getHiddenRefPatternSource(\n\tvalues: HiddenRefPatternValues,\n\tpattern: string,\n): { readonly scope: HiddenRefPatternScope; readonly overridesGlobal: boolean } | undefined {\n\tconst inGlobal = values.globalValue != null && Object.hasOwn(values.globalValue, pattern);\n\tif (values.workspaceValue != null && Object.hasOwn(values.workspaceValue, pattern)) {\n\t\treturn { scope: 'workspace', overridesGlobal: inGlobal };\n\t}\n\treturn inGlobal ? { scope: 'global', overridesGlobal: false } : undefined;\n}\n\nexport function getHiddenRefPatternTarget(\n\tvalues: HiddenRefPatternValues,\n\tpattern: string,\n\tscope: HiddenRefPatternScope,\n): HiddenRefPatternScope {\n\treturn scope === 'workspace' || getHiddenRefPatternSource(values, pattern)?.scope === 'workspace'\n\t\t? 'workspace'\n\t\t: 'global';\n}\n\nexport function getHiddenRefPatternWrites(\n\tvalues: HiddenRefPatternValues,\n\tedits: readonly HiddenRefPatternEdit[],\n\tscope: HiddenRefPatternScope,\n): HiddenRefPatternWrite[] {\n\tconst defaults: Readonly<Record<string, boolean>> = values.defaultValue ?? {};\n\tconst layers: Record<HiddenRefPatternScope, Record<string, boolean>> = {\n\t\tglobal: { ...values.globalValue },\n\t\tworkspace: { ...values.workspaceValue },\n\t};\n\tconst changed = new Set<HiddenRefPatternScope>();\n\n\tconst remove = (target: HiddenRefPatternScope, key: string) => {\n\t\tif (!Object.hasOwn(layers[target], key)) return;\n\n\t\tlayers[target] = Object.fromEntries(Object.entries(layers[target]).filter(([k]) => k !== key));\n\t\tchanged.add(target);\n\t};\n\n\tfor (const edit of edits) {\n\t\tif (edit.value === undefined) {\n\t\t\tremove('global', edit.pattern);\n\t\t\tremove('workspace', edit.pattern);\n\t\t\tcontinue;\n\t\t}\n\n\t\tlet keys = [edit.pattern];\n\t\tif (!edit.value && Object.hasOwn(defaults, edit.pattern)) {\n\t\t\tconst effective = { ...defaults, ...layers.global, ...layers.workspace };\n\t\t\tconst own = normalizeHiddenRefPatterns({ [edit.pattern]: true }).patterns;\n\t\t\tconst groups = getHiddenRefPatternGroups(\n\t\t\t\tnormalizeHiddenRefPatterns({ ...effective, [edit.pattern]: true }).patterns,\n\t\t\t);\n\t\t\tconst members = [...groups.values()].filter(m => m.some(p => own.includes(p))).flat();\n\t\t\tkeys = [...new Set([edit.pattern, ...getEnabledKeysForMembers(effective, members)])];\n\t\t}\n\n\t\tfor (const key of keys) {\n\t\t\tconst target = getHiddenRefPatternTarget(\n\t\t\t\t{ globalValue: layers.global, workspaceValue: layers.workspace },\n\t\t\t\tkey,\n\t\t\t\tscope,\n\t\t\t);\n\t\t\tconst below =\n\t\t\t\ttarget === 'workspace' && Object.hasOwn(layers.global, key) ? layers.global[key] : defaults[key];\n\n\t\t\tif (below === edit.value) {\n\t\t\t\tremove(target, key);\n\t\t\t} else if (layers[target][key] !== edit.value) {\n\t\t\t\tlayers[target][key] = edit.value;\n\t\t\t\tchanged.add(target);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn (['global', 'workspace'] as const)\n\t\t.filter(target => changed.has(target))\n\t\t.map(target => ({\n\t\t\ttarget: target,\n\t\t\tvalue: Object.keys(layers[target]).length ? layers[target] : undefined,\n\t\t}));\n}\n"],"mappings":";AAQA,MAAM,iCAAiB,IAAI,IAAI;CAAC;CAAS;CAAW;CAAQ;AAAO,CAAC;AACpE,MAAM,mBAAmB;AACzB,MAAM,cAAc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CAAC,CAAC,CAAC,CAAC,CAAC,KAAK;GACpF,OAAO,CAAC,mBAAG,IAAI,IAAI,CAAC,KAAK,SAAS,GAAG,yBAAyB,WAAW,OAAO,CAAC,CAAC,CAAC;EACpF;EAEA,KAAK,MAAM,OAAO,MAAM;GACvB,MAAM,SAAS,0BACd;IAAE,aAAa,OAAO;IAAQ,gBAAgB,OAAO;GAAU,GAC/D,KACA,KACD;GAIA,KAFC,WAAW,eAAe,OAAO,OAAO,OAAO,QAAQ,GAAG,IAAI,OAAO,OAAO,OAAO,SAAS,UAE/E,KAAK,OAClB,OAAO,QAAQ,GAAG;QACZ,IAAI,OAAO,OAAO,CAAC,SAAS,KAAK,OAAO;IAC9C,OAAO,OAAO,CAAC,OAAO,KAAK;IAC3B,QAAQ,IAAI,MAAM;GACnB;EACD;CACD;CAEA,OAAQ,CAAC,UAAU,WAAW,CAAC,CAC7B,QAAO,WAAU,QAAQ,IAAI,MAAM,CAAC,CAAC,CACrC,KAAI,YAAW;EACP;EACR,OAAO,OAAO,KAAK,OAAO,OAAO,CAAC,CAAC,SAAS,OAAO,UAAU,KAAA;CAC9D,EAAE;AACJ"}
@@ -1,11 +1,8 @@
1
1
  import { PullRequest, PullRequestComparisonRefs, PullRequestMergeQueueEntry, PullRequestMergeQueueState, PullRequestRefs, PullRequestRepositoryIdentityDescriptor, PullRequestSearchCriteria, PullRequestShape, PullRequestSorting, PullRequestStackInfo } from "../models/pullRequest.js";
2
2
  //#region ../git/src/utils/pullRequest.utils.d.ts
3
- /** How many pull requests a merge action affects — unstacked is always 1; a stacked merge lands either
4
- * just this layer and everything below it (`position`), or the whole stack (`wholeStack`). The one
5
- * source every merge-confirmation and merge-action label counts from, so they can't drift apart.
6
- * Takes only the two fields it needs (not the full {@link PullRequestStackInfo}) since callers on the
7
- * webview side carry narrower serialized stack shapes. */
8
- export declare function getStackedMergeCount(stack: Pick<PullRequestStackInfo, 'position' | 'size'> | undefined, options?: {
3
+ /** How many pull requests a merge lands: 1 when unstacked; when stacked, this layer and every layer below it
4
+ * (every layer with `wholeStack`), less `mergedLayers`. Never less than 1. */
5
+ export declare function getStackedMergeCount(stack: Pick<PullRequestStackInfo, 'position' | 'size' | 'mergedLayers'> | undefined, options?: {
9
6
  wholeStack?: boolean;
10
7
  }): number;
11
8
  /** Whether an open pull request is waiting in a merge queue. `false` also when the read didn't fetch the queue —
@@ -4,14 +4,12 @@ import "../models/pullRequest.js";
4
4
  import { serializeMilestone } from "./issueOrPullRequest.utils.js";
5
5
  import * as l10n from "@vscode/l10n";
6
6
  //#region ../git/src/utils/pullRequest.utils.ts
7
- /** How many pull requests a merge action affects — unstacked is always 1; a stacked merge lands either
8
- * just this layer and everything below it (`position`), or the whole stack (`wholeStack`). The one
9
- * source every merge-confirmation and merge-action label counts from, so they can't drift apart.
10
- * Takes only the two fields it needs (not the full {@link PullRequestStackInfo}) since callers on the
11
- * webview side carry narrower serialized stack shapes. */
7
+ /** How many pull requests a merge lands: 1 when unstacked; when stacked, this layer and every layer below it
8
+ * (every layer with `wholeStack`), less `mergedLayers`. Never less than 1. */
12
9
  function getStackedMergeCount(stack, options) {
13
10
  if (stack == null) return 1;
14
- return options?.wholeStack ? stack.size : stack.position;
11
+ const count = options?.wholeStack ? stack.size : stack.position;
12
+ return Math.max(1, count - (stack.mergedLayers ?? 0));
15
13
  }
16
14
  /** Whether an open pull request is waiting in a merge queue. `false` also when the read didn't fetch the queue —
17
15
  * check the row's `mergeQueue` field presence before treating that as "not queued". Narrows to the shape's own entry
@@ -292,7 +290,8 @@ function serializePullRequest(value) {
292
290
  number: value.stack.number,
293
291
  size: value.stack.size,
294
292
  position: value.stack.position,
295
- baseRef: value.stack.baseRef
293
+ baseRef: value.stack.baseRef,
294
+ mergedLayers: value.stack.mergedLayers
296
295
  } : void 0,
297
296
  mergeQueue: value.mergeQueue ? {
298
297
  state: value.mergeQueue.state,
@@ -1 +1 @@
1
- {"version":3,"file":"pullRequest.utils.js","names":[],"sources":["../../../../git/src/utils/pullRequest.utils.ts"],"sourcesContent":["import * as l10n from '@vscode/l10n';\nimport { fromNow } from '@gitlens/utils/date.js';\nimport type {\n\tPullRequest,\n\tPullRequestComparisonRefs,\n\tPullRequestMergeQueueEntry,\n\tPullRequestRefs,\n\tPullRequestRepositoryIdentityDescriptor,\n\tPullRequestSearchCriteria,\n\tPullRequestShape,\n\tPullRequestSortField,\n\tPullRequestSorting,\n\tPullRequestStackInfo,\n} from '../models/pullRequest.js';\nimport { defaultPullRequestSort, PullRequestMergeQueueState } from '../models/pullRequest.js';\nimport { serializeMilestone } from './issueOrPullRequest.utils.js';\nimport { shortenRevision } from './revision.utils.js';\n\n/** How many pull requests a merge action affects — unstacked is always 1; a stacked merge lands either\n * just this layer and everything below it (`position`), or the whole stack (`wholeStack`). The one\n * source every merge-confirmation and merge-action label counts from, so they can't drift apart.\n * Takes only the two fields it needs (not the full {@link PullRequestStackInfo}) since callers on the\n * webview side carry narrower serialized stack shapes. */\nexport function getStackedMergeCount(\n\tstack: Pick<PullRequestStackInfo, 'position' | 'size'> | undefined,\n\toptions?: { wholeStack?: boolean },\n): number {\n\tif (stack == null) return 1;\n\treturn options?.wholeStack ? stack.size : stack.position;\n}\n\n/** Whether an open pull request is waiting in a merge queue. `false` also when the read didn't fetch the queue —\n * check the row's `mergeQueue` field presence before treating that as \"not queued\". Narrows to the shape's own entry\n * type, since webview shapes carry a serialized one, or to {@link PullRequestMergeQueueEntry} for a shape that\n * doesn't declare one (an `IssueOrPullRequest` that is a pull request). */\nexport function isPullRequestInMergeQueue<T extends { readonly state?: string; readonly mergeQueue?: unknown }>(\n\tpr: T,\n): pr is T & {\n\treadonly mergeQueue: 'mergeQueue' extends keyof T ? NonNullable<T['mergeQueue']> : PullRequestMergeQueueEntry;\n} {\n\treturn pr.state === 'opened' && pr.mergeQueue != null;\n}\n\n/** A pull request's state as shown to users: its provider state, except an open pull request waiting in a merge queue is `queued`. */\nexport function getPullRequestDisplayState<S extends string | undefined>(pr: {\n\treadonly state: S;\n\treadonly mergeQueue?: unknown;\n}): S | 'queued' {\n\treturn isPullRequestInMergeQueue(pr) ? 'queued' : pr.state;\n}\n\n/** A pull request's {@link getPullRequestDisplayState display state} paired with its\n * {@link formatPullRequestMergeQueueStatus merge-queue status}, place in line included, which is set only while it's\n * queued — the pair a pull request chip renders. */\nexport function getPullRequestDisplayStatus<S extends string | undefined>(pr: {\n\treadonly state: S;\n\treadonly mergeQueue?: Parameters<typeof formatPullRequestMergeQueueStatus>[0];\n}): { status: S | 'queued'; queueStatus: string | undefined } {\n\treturn isPullRequestInMergeQueue(pr)\n\t\t? { status: 'queued', queueStatus: formatPullRequestMergeQueueStatus(pr.mergeQueue) }\n\t\t: { status: pr.state, queueStatus: undefined };\n}\n\n/**\n * Describes where a queued pull request stands in its merge queue, with its place in line when the provider gave one\n * (\"#2 in the merge queue, checks running\"). Merging and failing entries read the same with or without a place, since\n * the place no longer says anything there. Takes only the fields it reads, and the estimate as a date or a timestamp\n * (ms), since webview shapes carry a serialized entry.\n */\nexport function formatPullRequestMergeQueueStatus(entry: {\n\treadonly state: PullRequestMergeQueueState;\n\treadonly estimatedMergeAt?: Date | number;\n\treadonly position?: number;\n}): string {\n\tconst position = entry.position;\n\n\tlet status: string;\n\tswitch (entry.state) {\n\t\tcase PullRequestMergeQueueState.AwaitingChecks:\n\t\t\tstatus =\n\t\t\t\tposition != null\n\t\t\t\t\t? l10n.t('#{position} in the merge queue, checks running', { position: position })\n\t\t\t\t\t: l10n.t('Queued to merge, checks running');\n\t\t\tbreak;\n\t\tcase PullRequestMergeQueueState.Mergeable:\n\t\t\tstatus =\n\t\t\t\tposition != null\n\t\t\t\t\t? l10n.t('#{position} in the merge queue, next up', { position: position })\n\t\t\t\t\t: l10n.t('Queued to merge, next up');\n\t\t\tbreak;\n\t\tcase PullRequestMergeQueueState.Locked:\n\t\t\t// The merge is already in flight, so an estimate adds nothing\n\t\t\treturn l10n.t('Merging');\n\t\tcase PullRequestMergeQueueState.Unmergeable:\n\t\t\treturn l10n.t('Failing in the merge queue');\n\t\tdefault:\n\t\t\tstatus =\n\t\t\t\tposition != null\n\t\t\t\t\t? l10n.t('#{position} in the merge queue', { position: position })\n\t\t\t\t\t: l10n.t('Queued to merge');\n\t\t\tbreak;\n\t}\n\n\tif (entry.estimatedMergeAt == null) return status;\n\n\t// An estimate already past is wrong, not late news: \"estimated to merge 2 minutes ago\" would only mislead\n\tconst estimatedMergeAt = new Date(entry.estimatedMergeAt).getTime();\n\tif (Number.isNaN(estimatedMergeAt) || estimatedMergeAt <= Date.now()) return status;\n\n\treturn l10n.t('{0}, estimated to merge {1}', status, fromNow(estimatedMergeAt));\n}\n\n/** When a queued pull request joined its merge queue, as the clause that follows its\n * {@link formatPullRequestMergeQueueStatus status} — \"queued 3 hours ago\" — so a status that ends in an estimate\n * doesn't run straight into a bare date. */\nexport function formatPullRequestMergeQueueEnqueuedFromNow(entry: { readonly enqueuedAt: Date | number }): string {\n\treturn l10n.t('queued {0}', fromNow(entry.enqueuedAt));\n}\n\n/** What a `PullRequestMergeQueueRemoval`'s reason says about the pull request: its queue run `failed`, someone\n * removed it (`manual`), or a reason this doesn't recognize (`other`), which the removal's raw reason still names. */\nexport type PullRequestMergeQueueRemovalKind = 'failed' | 'manual' | 'other';\n\n/**\n * Classifies a merge-queue removal's provider reason. Only the reasons seen from GitHub are recognized —\n * `failed_checks` (its queue run failed) and `manual` — matched without regard to case; every other reason is\n * `other` rather than guessed at, so a caller that shows one can fall back to the raw reason.\n */\nexport function getPullRequestMergeQueueRemovalKind(reason: string): PullRequestMergeQueueRemovalKind {\n\tswitch (reason.toLowerCase()) {\n\t\tcase 'failed_checks':\n\t\t\treturn 'failed';\n\t\tcase 'manual':\n\t\t\treturn 'manual';\n\t\tdefault:\n\t\t\treturn 'other';\n\t}\n}\n\n/**\n * Whether a pull request's merge-queue removal (`mergeQueueRemoval`) still describes it: it is set,\n * the pull request is open and not queued, and nothing has touched the pull request since — its update time is no\n * later than the removal, which GitHub's removal doesn't move. Narrows `mergeQueueRemoval` to set.\n *\n * The trade-off: any later update clears it, not only a push that may have fixed the failure, so a comment or a\n * label added after a failed queue run also stops it reading as failing. A provider's timeline can't say whether a\n * push followed the removal (GitHub orders commits by commit date, not push time), and a stale \"failing\" is worse\n * than a missed one. Takes dates or timestamps (ms), since webview shapes carry serialized ones.\n */\nexport function isPullRequestMergeQueueRemovalCurrent<\n\tT extends {\n\t\treadonly state?: string;\n\t\treadonly updatedDate: Date | number;\n\t\treadonly mergeQueue?: unknown;\n\t\treadonly mergeQueueRemoval?: { readonly removedAt: Date | number };\n\t},\n>(pr: T): pr is T & { readonly mergeQueueRemoval: NonNullable<T['mergeQueueRemoval']> } {\n\tif (pr.mergeQueueRemoval == null || pr.state !== 'opened' || pr.mergeQueue != null) return false;\n\n\tconst removedAt = new Date(pr.mergeQueueRemoval.removedAt).getTime();\n\tconst updatedAt = new Date(pr.updatedDate).getTime();\n\tif (Number.isNaN(removedAt) || Number.isNaN(updatedAt)) return false;\n\n\treturn removedAt >= updatedAt;\n}\n\n/**\n * How each sort field is read off a {@link PullRequestShape}, for the filtered PR search, which MERGES its\n * relationship × state facets in the facade and so has to order the union itself instead of trusting the\n * per-facet server order. Only the fields the shape carries appear — the same rule as `getIssueComparator`, and\n * the reason {@link PullRequestSortField} is just these two.\n */\nconst pullRequestSortValues: Partial<\n\tRecord<PullRequestSortField, (pr: PullRequestShape) => number | Date | string | undefined>\n> = {\n\tcreated: pr => pr.createdDate,\n\tupdated: pr => pr.updatedDate,\n};\n\n/**\n * A comparator for one sort key over normalized pull requests, or `undefined` when the field isn't derivable\n * from a {@link PullRequestShape} — the signal that the key is only honorable on a SINGLE-origin read where the\n * provider already ordered the page. Missing values sort LAST in both directions (partitioned before any\n * arithmetic so two missing values compare equal, exactly as `getIssueComparator` does).\n *\n * Note it orders whatever it is handed. Sorting a page already capped at the result ceiling does not make it the\n * top N.\n */\nexport function getPullRequestComparator(\n\tsort: PullRequestSorting,\n): ((a: PullRequestShape, b: PullRequestShape) => number) | undefined {\n\tconst [field, direction] = sort.split(':') as [PullRequestSortField, 'asc' | 'desc'];\n\tconst getValue = pullRequestSortValues[field];\n\tif (getValue == null) return undefined;\n\n\treturn (a, b) => {\n\t\tconst left = toComparable(getValue(a));\n\t\tconst right = toComparable(getValue(b));\n\t\tif (left == null || right == null) {\n\t\t\tif (left == null && right == null) return 0;\n\n\t\t\treturn left == null ? 1 : -1;\n\t\t}\n\n\t\tconst ordered = left < right ? -1 : left > right ? 1 : 0;\n\t\treturn direction === 'asc' ? ordered : -ordered;\n\t};\n}\n\nexport function effectivePullRequestSearchSort(criteria: PullRequestSearchCriteria | undefined): PullRequestSorting {\n\treturn criteria?.sort ?? (criteria?.changedSince != null ? 'updated:asc' : defaultPullRequestSort);\n}\n\nexport function isValidPullRequestChangedSince(value: string): boolean {\n\tif (!/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$/.test(value)) return false;\n\n\tconst time = Date.parse(value);\n\treturn !Number.isNaN(time) && new Date(time).toISOString() === `${value.slice(0, -1)}.000Z`;\n}\n\nfunction toComparable(value: number | Date | string | undefined): number | string | undefined {\n\treturn value instanceof Date ? value.getTime() : value;\n}\n\nexport interface PullRequestUrlIdentity<TProvider extends string = string> {\n\tprovider?: TProvider;\n\n\townerAndRepo?: string;\n\tprNumber: string;\n}\n\nexport function getComparisonRefsForPullRequest(repoPath: string, prRefs: PullRequestRefs): PullRequestComparisonRefs {\n\tconst refs: PullRequestComparisonRefs = {\n\t\trepoPath: repoPath,\n\t\tbase: { ref: prRefs.base.sha, label: `${prRefs.base.branch} (${shortenRevision(prRefs.base.sha)})` },\n\t\thead: { ref: prRefs.head.sha, label: prRefs.head.branch },\n\t};\n\treturn refs;\n}\n\nexport function getPullRequestIdentityFromMaybeUrl(search: string): PullRequestUrlIdentity | undefined {\n\tlet prNumber: string | undefined = undefined;\n\n\tlet match = search.match(/(?:\\/)(\\d+)/); // any number starting with \"/\"\n\tif (match != null) {\n\t\tprNumber = match[1];\n\t}\n\n\tif (prNumber == null) {\n\t\tmatch = search.match(/^#?(\\d+)$/); // just a number or with a leading \"#\"\n\t\tif (match != null) {\n\t\t\tprNumber = match[1];\n\t\t}\n\t}\n\n\treturn prNumber == null ? undefined : { ownerAndRepo: undefined, prNumber: prNumber, provider: undefined };\n}\n\n/** A pull request's display number from its url, or `undefined` for a url naming no pull request. Anchors\n * on the provider's pull request path segment (GitHub `pull`, Bitbucket `pull-requests`, GitLab\n * `merge_requests`, Azure `pullrequest`) so a digit-leading owner (`github.com/1Password/x/pull/123`)\n * can't win. */\nexport function getPullRequestNumberFromUrl(url: string): string | undefined {\n\t// No loose fallback: `getPullRequestIdentityFromMaybeUrl` scans for any `/<digits>`, which reads a bare\n\t// repository url like `github.com/1Password/sdk` as pull request #1. Callers that hold a real pull\n\t// request fall back to its id instead, and the one that asks whether a pasted url names a pull request\n\t// needs \"no\" for an answer.\n\treturn url.match(/(?:pull|pull-requests|merge_requests|pullrequest)\\/(\\d+)(?:\\b|\\/|$)/)?.[1];\n}\n\nexport function getRepositoryIdentityForPullRequest(\n\tpr: PullRequest,\n\theadRepo: boolean = true,\n): PullRequestRepositoryIdentityDescriptor {\n\tif (headRepo) {\n\t\treturn {\n\t\t\tremote: {\n\t\t\t\turl: pr.refs?.head?.url,\n\t\t\t\tdomain: pr.provider.domain,\n\t\t\t},\n\t\t\tname: `${pr.refs?.head?.owner ?? pr.repository.owner}/${pr.refs?.head?.repo ?? pr.repository.repo}`,\n\t\t\tprovider: {\n\t\t\t\tid: pr.provider.id,\n\t\t\t\tdomain: pr.provider.domain,\n\t\t\t\trepoDomain: pr.refs?.head?.owner ?? pr.repository.owner,\n\t\t\t\trepoName: pr.refs?.head?.repo ?? pr.repository.repo,\n\t\t\t},\n\t\t};\n\t}\n\n\treturn {\n\t\tremote: {\n\t\t\turl: pr.refs?.base?.url ?? pr.url,\n\t\t\tdomain: pr.provider.domain,\n\t\t},\n\t\tname: `${pr.refs?.base?.owner ?? pr.repository.owner}/${pr.refs?.base?.repo ?? pr.repository.repo}`,\n\t\tprovider: {\n\t\t\tid: pr.provider.id,\n\t\t\tdomain: pr.provider.domain,\n\t\t\trepoDomain: pr.refs?.base?.owner ?? pr.repository.owner,\n\t\t\trepoName: pr.refs?.base?.repo ?? pr.repository.repo,\n\t\t\trepoOwnerDomain: pr.refs?.base?.owner ?? pr.repository.owner,\n\t\t},\n\t};\n}\n\nexport function isMaybeNonSpecificPullRequestSearchUrl(search: string): boolean {\n\treturn getPullRequestIdentityFromMaybeUrl(search) != null;\n}\n\n/**\n * Deliberately leaves `projection` out: this copy drops `filesChanged`, `repository` and the class-only check rollup,\n * commit count and `viewerCanUpdate`, so a tag would have field presence report as fetched what the copy no longer has.\n */\nexport function serializePullRequest(value: PullRequest): PullRequestShape {\n\tconst serialized: PullRequestShape = {\n\t\ttype: value.type,\n\t\tprovider: {\n\t\t\tid: value.provider.id,\n\t\t\tname: value.provider.name,\n\t\t\tdomain: value.provider.domain,\n\t\t\ticon: value.provider.icon,\n\t\t},\n\t\tid: value.id,\n\t\tnodeId: value.nodeId,\n\t\tnumber: value.number,\n\t\ttitle: value.title,\n\t\tbody: value.body,\n\t\turl: value.url,\n\t\tcreatedDate: value.createdDate,\n\t\tupdatedDate: value.updatedDate,\n\t\tclosedDate: value.closedDate,\n\t\tclosed: value.closed,\n\t\tauthor: {\n\t\t\tid: value.author.id,\n\t\t\tname: value.author.name,\n\t\t\tusername: value.author.username,\n\t\t\tavatarUrl: value.author.avatarUrl,\n\t\t\turl: value.author.url,\n\t\t},\n\t\tstate: value.state,\n\t\tmergedDate: value.mergedDate,\n\t\tmergeableState: value.mergeableState,\n\t\trefs: value.refs\n\t\t\t? {\n\t\t\t\t\thead: {\n\t\t\t\t\t\texists: value.refs.head.exists,\n\t\t\t\t\t\towner: value.refs.head.owner,\n\t\t\t\t\t\trepo: value.refs.head.repo,\n\t\t\t\t\t\tsha: value.refs.head.sha,\n\t\t\t\t\t\tbranch: value.refs.head.branch,\n\t\t\t\t\t\turl: value.refs.head.url,\n\t\t\t\t\t\tcloneHttps: value.refs.head.cloneHttps,\n\t\t\t\t\t\tcloneSsh: value.refs.head.cloneSsh,\n\t\t\t\t\t\tisFork: value.refs.head.isFork,\n\t\t\t\t\t},\n\t\t\t\t\tbase: {\n\t\t\t\t\t\texists: value.refs.base.exists,\n\t\t\t\t\t\towner: value.refs.base.owner,\n\t\t\t\t\t\trepo: value.refs.base.repo,\n\t\t\t\t\t\tsha: value.refs.base.sha,\n\t\t\t\t\t\tbranch: value.refs.base.branch,\n\t\t\t\t\t\turl: value.refs.base.url,\n\t\t\t\t\t\tcloneHttps: value.refs.base.cloneHttps,\n\t\t\t\t\t\tcloneSsh: value.refs.base.cloneSsh,\n\t\t\t\t\t\tisFork: value.refs.base.isFork,\n\t\t\t\t\t},\n\t\t\t\t\tisCrossRepository: value.refs.isCrossRepository,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tisDraft: value.isDraft,\n\t\tadditions: value.additions,\n\t\tdeletions: value.deletions,\n\t\tcommentsCount: value.commentsCount,\n\t\tthumbsUpCount: value.thumbsUpCount,\n\t\treviewDecision: value.reviewDecision,\n\t\treviewRequests: value.reviewRequests,\n\t\tlatestReviews: value.latestReviews,\n\t\tassignees: value.assignees,\n\t\tauthoredByMe: value.authoredByMe,\n\t\tviewer: value.viewer != null ? { id: value.viewer.id, username: value.viewer.username } : undefined,\n\t\tviewerUnresolved: value.viewerUnresolved,\n\t\tmilestone: serializeMilestone(value.milestone),\n\t\tproject: value.project\n\t\t\t? {\n\t\t\t\t\tid: value.project.id,\n\t\t\t\t\tname: value.project.name,\n\t\t\t\t\tresourceId: value.project.resourceId,\n\t\t\t\t\tresourceName: value.project.resourceName,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tstack: value.stack\n\t\t\t? {\n\t\t\t\t\tid: value.stack.id,\n\t\t\t\t\tnumber: value.stack.number,\n\t\t\t\t\tsize: value.stack.size,\n\t\t\t\t\tposition: value.stack.position,\n\t\t\t\t\tbaseRef: value.stack.baseRef,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tmergeQueue: value.mergeQueue\n\t\t\t? {\n\t\t\t\t\tstate: value.mergeQueue.state,\n\t\t\t\t\tenqueuedAt: value.mergeQueue.enqueuedAt,\n\t\t\t\t\testimatedMergeAt: value.mergeQueue.estimatedMergeAt,\n\t\t\t\t\turl: value.mergeQueue.url,\n\t\t\t\t\tposition: value.mergeQueue.position,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tmergeQueueRequired: value.mergeQueueRequired,\n\t\tmergeQueueRemoval: value.mergeQueueRemoval\n\t\t\t? { reason: value.mergeQueueRemoval.reason, removedAt: value.mergeQueueRemoval.removedAt }\n\t\t\t: undefined,\n\t\tcheckRuns: value.checkRuns?.map(run => ({ ...run })),\n\t\tcheckRunsTruncated: value.checkRunsTruncated,\n\t};\n\treturn serialized;\n}\n"],"mappings":";;;;;;;;;;;AAuBA,SAAgB,qBACf,OACA,SACS;CACT,IAAI,SAAS,MAAM,OAAO;CAC1B,OAAO,SAAS,aAAa,MAAM,OAAO,MAAM;AACjD;;;;;AAMA,SAAgB,0BACf,IAGC;CACD,OAAO,GAAG,UAAU,YAAY,GAAG,cAAc;AAClD;;AAGA,SAAgB,2BAAyD,IAGxD;CAChB,OAAO,0BAA0B,EAAE,IAAI,WAAW,GAAG;AACtD;;;;AAKA,SAAgB,4BAA0D,IAGZ;CAC7D,OAAO,0BAA0B,EAAE,IAChC;EAAE,QAAQ;EAAU,aAAa,kCAAkC,GAAG,UAAU;CAAE,IAClF;EAAE,QAAQ,GAAG;EAAO,aAAa,KAAA;CAAU;AAC/C;;;;;;;AAQA,SAAgB,kCAAkC,OAIvC;CACV,MAAM,WAAW,MAAM;CAEvB,IAAI;CACJ,QAAQ,MAAM,OAAd;EACC,KAAA;GACC,SACC,YAAY,OACT,KAAK,EAAE,kDAAkD,EAAY,SAAS,CAAC,IAC/E,KAAK,EAAE,iCAA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,MAAM;EACrB,gBAAgB,MAAM;EACtB,gBAAgB,MAAM;EACtB,eAAe,MAAM;EACrB,WAAW,MAAM;EACjB,cAAc,MAAM;EACpB,QAAQ,MAAM,UAAU,OAAO;GAAE,IAAI,MAAM,OAAO;GAAI,UAAU,MAAM,OAAO;EAAS,IAAI,KAAA;EAC1F,kBAAkB,MAAM;EACxB,WAAW,mBAAmB,MAAM,SAAS;EAC7C,SAAS,MAAM,UACZ;GACA,IAAI,MAAM,QAAQ;GAClB,MAAM,MAAM,QAAQ;GACpB,YAAY,MAAM,QAAQ;GAC1B,cAAc,MAAM,QAAQ;EAC7B,IACC,KAAA;EACH,OAAO,MAAM,QACV;GACA,IAAI,MAAM,MAAM;GAChB,QAAQ,MAAM,MAAM;GACpB,MAAM,MAAM,MAAM;GAClB,UAAU,MAAM,MAAM;GACtB,SAAS,MAAM,MAAM;EACtB,IACC,KAAA;EACH,YAAY,MAAM,aACf;GACA,OAAO,MAAM,WAAW;GACxB,YAAY,MAAM,WAAW;GAC7B,kBAAkB,MAAM,WAAW;GACnC,KAAK,MAAM,WAAW;GACtB,UAAU,MAAM,WAAW;EAC5B,IACC,KAAA;EACH,oBAAoB,MAAM;EAC1B,mBAAmB,MAAM,oBACtB;GAAE,QAAQ,MAAM,kBAAkB;GAAQ,WAAW,MAAM,kBAAkB;EAAU,IACvF,KAAA;EACH,WAAW,MAAM,WAAW,KAAI,SAAQ,EAAE,GAAG,IAAI,EAAE;EACnD,oBAAoB,MAAM;CAEX;AACjB"}
1
+ {"version":3,"file":"pullRequest.utils.js","names":[],"sources":["../../../../git/src/utils/pullRequest.utils.ts"],"sourcesContent":["import * as l10n from '@vscode/l10n';\nimport { fromNow } from '@gitlens/utils/date.js';\nimport type {\n\tPullRequest,\n\tPullRequestComparisonRefs,\n\tPullRequestMergeQueueEntry,\n\tPullRequestRefs,\n\tPullRequestRepositoryIdentityDescriptor,\n\tPullRequestSearchCriteria,\n\tPullRequestShape,\n\tPullRequestSortField,\n\tPullRequestSorting,\n\tPullRequestStackInfo,\n} from '../models/pullRequest.js';\nimport { defaultPullRequestSort, PullRequestMergeQueueState } from '../models/pullRequest.js';\nimport { serializeMilestone } from './issueOrPullRequest.utils.js';\nimport { shortenRevision } from './revision.utils.js';\n\n/** How many pull requests a merge lands: 1 when unstacked; when stacked, this layer and every layer below it\n * (every layer with `wholeStack`), less `mergedLayers`. Never less than 1. */\nexport function getStackedMergeCount(\n\tstack: Pick<PullRequestStackInfo, 'position' | 'size' | 'mergedLayers'> | undefined,\n\toptions?: { wholeStack?: boolean },\n): number {\n\tif (stack == null) return 1;\n\n\tconst count = options?.wholeStack ? stack.size : stack.position;\n\treturn Math.max(1, count - (stack.mergedLayers ?? 0));\n}\n\n/** Whether an open pull request is waiting in a merge queue. `false` also when the read didn't fetch the queue —\n * check the row's `mergeQueue` field presence before treating that as \"not queued\". Narrows to the shape's own entry\n * type, since webview shapes carry a serialized one, or to {@link PullRequestMergeQueueEntry} for a shape that\n * doesn't declare one (an `IssueOrPullRequest` that is a pull request). */\nexport function isPullRequestInMergeQueue<T extends { readonly state?: string; readonly mergeQueue?: unknown }>(\n\tpr: T,\n): pr is T & {\n\treadonly mergeQueue: 'mergeQueue' extends keyof T ? NonNullable<T['mergeQueue']> : PullRequestMergeQueueEntry;\n} {\n\treturn pr.state === 'opened' && pr.mergeQueue != null;\n}\n\n/** A pull request's state as shown to users: its provider state, except an open pull request waiting in a merge queue is `queued`. */\nexport function getPullRequestDisplayState<S extends string | undefined>(pr: {\n\treadonly state: S;\n\treadonly mergeQueue?: unknown;\n}): S | 'queued' {\n\treturn isPullRequestInMergeQueue(pr) ? 'queued' : pr.state;\n}\n\n/** A pull request's {@link getPullRequestDisplayState display state} paired with its\n * {@link formatPullRequestMergeQueueStatus merge-queue status}, place in line included, which is set only while it's\n * queued — the pair a pull request chip renders. */\nexport function getPullRequestDisplayStatus<S extends string | undefined>(pr: {\n\treadonly state: S;\n\treadonly mergeQueue?: Parameters<typeof formatPullRequestMergeQueueStatus>[0];\n}): { status: S | 'queued'; queueStatus: string | undefined } {\n\treturn isPullRequestInMergeQueue(pr)\n\t\t? { status: 'queued', queueStatus: formatPullRequestMergeQueueStatus(pr.mergeQueue) }\n\t\t: { status: pr.state, queueStatus: undefined };\n}\n\n/**\n * Describes where a queued pull request stands in its merge queue, with its place in line when the provider gave one\n * (\"#2 in the merge queue, checks running\"). Merging and failing entries read the same with or without a place, since\n * the place no longer says anything there. Takes only the fields it reads, and the estimate as a date or a timestamp\n * (ms), since webview shapes carry a serialized entry.\n */\nexport function formatPullRequestMergeQueueStatus(entry: {\n\treadonly state: PullRequestMergeQueueState;\n\treadonly estimatedMergeAt?: Date | number;\n\treadonly position?: number;\n}): string {\n\tconst position = entry.position;\n\n\tlet status: string;\n\tswitch (entry.state) {\n\t\tcase PullRequestMergeQueueState.AwaitingChecks:\n\t\t\tstatus =\n\t\t\t\tposition != null\n\t\t\t\t\t? l10n.t('#{position} in the merge queue, checks running', { position: position })\n\t\t\t\t\t: l10n.t('Queued to merge, checks running');\n\t\t\tbreak;\n\t\tcase PullRequestMergeQueueState.Mergeable:\n\t\t\tstatus =\n\t\t\t\tposition != null\n\t\t\t\t\t? l10n.t('#{position} in the merge queue, next up', { position: position })\n\t\t\t\t\t: l10n.t('Queued to merge, next up');\n\t\t\tbreak;\n\t\tcase PullRequestMergeQueueState.Locked:\n\t\t\t// The merge is already in flight, so an estimate adds nothing\n\t\t\treturn l10n.t('Merging');\n\t\tcase PullRequestMergeQueueState.Unmergeable:\n\t\t\treturn l10n.t('Failing in the merge queue');\n\t\tdefault:\n\t\t\tstatus =\n\t\t\t\tposition != null\n\t\t\t\t\t? l10n.t('#{position} in the merge queue', { position: position })\n\t\t\t\t\t: l10n.t('Queued to merge');\n\t\t\tbreak;\n\t}\n\n\tif (entry.estimatedMergeAt == null) return status;\n\n\t// An estimate already past is wrong, not late news: \"estimated to merge 2 minutes ago\" would only mislead\n\tconst estimatedMergeAt = new Date(entry.estimatedMergeAt).getTime();\n\tif (Number.isNaN(estimatedMergeAt) || estimatedMergeAt <= Date.now()) return status;\n\n\treturn l10n.t('{0}, estimated to merge {1}', status, fromNow(estimatedMergeAt));\n}\n\n/** When a queued pull request joined its merge queue, as the clause that follows its\n * {@link formatPullRequestMergeQueueStatus status} — \"queued 3 hours ago\" — so a status that ends in an estimate\n * doesn't run straight into a bare date. */\nexport function formatPullRequestMergeQueueEnqueuedFromNow(entry: { readonly enqueuedAt: Date | number }): string {\n\treturn l10n.t('queued {0}', fromNow(entry.enqueuedAt));\n}\n\n/** What a `PullRequestMergeQueueRemoval`'s reason says about the pull request: its queue run `failed`, someone\n * removed it (`manual`), or a reason this doesn't recognize (`other`), which the removal's raw reason still names. */\nexport type PullRequestMergeQueueRemovalKind = 'failed' | 'manual' | 'other';\n\n/**\n * Classifies a merge-queue removal's provider reason. Only the reasons seen from GitHub are recognized —\n * `failed_checks` (its queue run failed) and `manual` — matched without regard to case; every other reason is\n * `other` rather than guessed at, so a caller that shows one can fall back to the raw reason.\n */\nexport function getPullRequestMergeQueueRemovalKind(reason: string): PullRequestMergeQueueRemovalKind {\n\tswitch (reason.toLowerCase()) {\n\t\tcase 'failed_checks':\n\t\t\treturn 'failed';\n\t\tcase 'manual':\n\t\t\treturn 'manual';\n\t\tdefault:\n\t\t\treturn 'other';\n\t}\n}\n\n/**\n * Whether a pull request's merge-queue removal (`mergeQueueRemoval`) still describes it: it is set,\n * the pull request is open and not queued, and nothing has touched the pull request since — its update time is no\n * later than the removal, which GitHub's removal doesn't move. Narrows `mergeQueueRemoval` to set.\n *\n * The trade-off: any later update clears it, not only a push that may have fixed the failure, so a comment or a\n * label added after a failed queue run also stops it reading as failing. A provider's timeline can't say whether a\n * push followed the removal (GitHub orders commits by commit date, not push time), and a stale \"failing\" is worse\n * than a missed one. Takes dates or timestamps (ms), since webview shapes carry serialized ones.\n */\nexport function isPullRequestMergeQueueRemovalCurrent<\n\tT extends {\n\t\treadonly state?: string;\n\t\treadonly updatedDate: Date | number;\n\t\treadonly mergeQueue?: unknown;\n\t\treadonly mergeQueueRemoval?: { readonly removedAt: Date | number };\n\t},\n>(pr: T): pr is T & { readonly mergeQueueRemoval: NonNullable<T['mergeQueueRemoval']> } {\n\tif (pr.mergeQueueRemoval == null || pr.state !== 'opened' || pr.mergeQueue != null) return false;\n\n\tconst removedAt = new Date(pr.mergeQueueRemoval.removedAt).getTime();\n\tconst updatedAt = new Date(pr.updatedDate).getTime();\n\tif (Number.isNaN(removedAt) || Number.isNaN(updatedAt)) return false;\n\n\treturn removedAt >= updatedAt;\n}\n\n/**\n * How each sort field is read off a {@link PullRequestShape}, for the filtered PR search, which MERGES its\n * relationship × state facets in the facade and so has to order the union itself instead of trusting the\n * per-facet server order. Only the fields the shape carries appear — the same rule as `getIssueComparator`, and\n * the reason {@link PullRequestSortField} is just these two.\n */\nconst pullRequestSortValues: Partial<\n\tRecord<PullRequestSortField, (pr: PullRequestShape) => number | Date | string | undefined>\n> = {\n\tcreated: pr => pr.createdDate,\n\tupdated: pr => pr.updatedDate,\n};\n\n/**\n * A comparator for one sort key over normalized pull requests, or `undefined` when the field isn't derivable\n * from a {@link PullRequestShape} — the signal that the key is only honorable on a SINGLE-origin read where the\n * provider already ordered the page. Missing values sort LAST in both directions (partitioned before any\n * arithmetic so two missing values compare equal, exactly as `getIssueComparator` does).\n *\n * Note it orders whatever it is handed. Sorting a page already capped at the result ceiling does not make it the\n * top N.\n */\nexport function getPullRequestComparator(\n\tsort: PullRequestSorting,\n): ((a: PullRequestShape, b: PullRequestShape) => number) | undefined {\n\tconst [field, direction] = sort.split(':') as [PullRequestSortField, 'asc' | 'desc'];\n\tconst getValue = pullRequestSortValues[field];\n\tif (getValue == null) return undefined;\n\n\treturn (a, b) => {\n\t\tconst left = toComparable(getValue(a));\n\t\tconst right = toComparable(getValue(b));\n\t\tif (left == null || right == null) {\n\t\t\tif (left == null && right == null) return 0;\n\n\t\t\treturn left == null ? 1 : -1;\n\t\t}\n\n\t\tconst ordered = left < right ? -1 : left > right ? 1 : 0;\n\t\treturn direction === 'asc' ? ordered : -ordered;\n\t};\n}\n\nexport function effectivePullRequestSearchSort(criteria: PullRequestSearchCriteria | undefined): PullRequestSorting {\n\treturn criteria?.sort ?? (criteria?.changedSince != null ? 'updated:asc' : defaultPullRequestSort);\n}\n\nexport function isValidPullRequestChangedSince(value: string): boolean {\n\tif (!/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$/.test(value)) return false;\n\n\tconst time = Date.parse(value);\n\treturn !Number.isNaN(time) && new Date(time).toISOString() === `${value.slice(0, -1)}.000Z`;\n}\n\nfunction toComparable(value: number | Date | string | undefined): number | string | undefined {\n\treturn value instanceof Date ? value.getTime() : value;\n}\n\nexport interface PullRequestUrlIdentity<TProvider extends string = string> {\n\tprovider?: TProvider;\n\n\townerAndRepo?: string;\n\tprNumber: string;\n}\n\nexport function getComparisonRefsForPullRequest(repoPath: string, prRefs: PullRequestRefs): PullRequestComparisonRefs {\n\tconst refs: PullRequestComparisonRefs = {\n\t\trepoPath: repoPath,\n\t\tbase: { ref: prRefs.base.sha, label: `${prRefs.base.branch} (${shortenRevision(prRefs.base.sha)})` },\n\t\thead: { ref: prRefs.head.sha, label: prRefs.head.branch },\n\t};\n\treturn refs;\n}\n\nexport function getPullRequestIdentityFromMaybeUrl(search: string): PullRequestUrlIdentity | undefined {\n\tlet prNumber: string | undefined = undefined;\n\n\tlet match = search.match(/(?:\\/)(\\d+)/); // any number starting with \"/\"\n\tif (match != null) {\n\t\tprNumber = match[1];\n\t}\n\n\tif (prNumber == null) {\n\t\tmatch = search.match(/^#?(\\d+)$/); // just a number or with a leading \"#\"\n\t\tif (match != null) {\n\t\t\tprNumber = match[1];\n\t\t}\n\t}\n\n\treturn prNumber == null ? undefined : { ownerAndRepo: undefined, prNumber: prNumber, provider: undefined };\n}\n\n/** A pull request's display number from its url, or `undefined` for a url naming no pull request. Anchors\n * on the provider's pull request path segment (GitHub `pull`, Bitbucket `pull-requests`, GitLab\n * `merge_requests`, Azure `pullrequest`) so a digit-leading owner (`github.com/1Password/x/pull/123`)\n * can't win. */\nexport function getPullRequestNumberFromUrl(url: string): string | undefined {\n\t// No loose fallback: `getPullRequestIdentityFromMaybeUrl` scans for any `/<digits>`, which reads a bare\n\t// repository url like `github.com/1Password/sdk` as pull request #1. Callers that hold a real pull\n\t// request fall back to its id instead, and the one that asks whether a pasted url names a pull request\n\t// needs \"no\" for an answer.\n\treturn url.match(/(?:pull|pull-requests|merge_requests|pullrequest)\\/(\\d+)(?:\\b|\\/|$)/)?.[1];\n}\n\nexport function getRepositoryIdentityForPullRequest(\n\tpr: PullRequest,\n\theadRepo: boolean = true,\n): PullRequestRepositoryIdentityDescriptor {\n\tif (headRepo) {\n\t\treturn {\n\t\t\tremote: {\n\t\t\t\turl: pr.refs?.head?.url,\n\t\t\t\tdomain: pr.provider.domain,\n\t\t\t},\n\t\t\tname: `${pr.refs?.head?.owner ?? pr.repository.owner}/${pr.refs?.head?.repo ?? pr.repository.repo}`,\n\t\t\tprovider: {\n\t\t\t\tid: pr.provider.id,\n\t\t\t\tdomain: pr.provider.domain,\n\t\t\t\trepoDomain: pr.refs?.head?.owner ?? pr.repository.owner,\n\t\t\t\trepoName: pr.refs?.head?.repo ?? pr.repository.repo,\n\t\t\t},\n\t\t};\n\t}\n\n\treturn {\n\t\tremote: {\n\t\t\turl: pr.refs?.base?.url ?? pr.url,\n\t\t\tdomain: pr.provider.domain,\n\t\t},\n\t\tname: `${pr.refs?.base?.owner ?? pr.repository.owner}/${pr.refs?.base?.repo ?? pr.repository.repo}`,\n\t\tprovider: {\n\t\t\tid: pr.provider.id,\n\t\t\tdomain: pr.provider.domain,\n\t\t\trepoDomain: pr.refs?.base?.owner ?? pr.repository.owner,\n\t\t\trepoName: pr.refs?.base?.repo ?? pr.repository.repo,\n\t\t\trepoOwnerDomain: pr.refs?.base?.owner ?? pr.repository.owner,\n\t\t},\n\t};\n}\n\nexport function isMaybeNonSpecificPullRequestSearchUrl(search: string): boolean {\n\treturn getPullRequestIdentityFromMaybeUrl(search) != null;\n}\n\n/**\n * Deliberately leaves `projection` out: this copy drops `filesChanged`, `repository` and the class-only check rollup,\n * commit count and `viewerCanUpdate`, so a tag would have field presence report as fetched what the copy no longer has.\n */\nexport function serializePullRequest(value: PullRequest): PullRequestShape {\n\tconst serialized: PullRequestShape = {\n\t\ttype: value.type,\n\t\tprovider: {\n\t\t\tid: value.provider.id,\n\t\t\tname: value.provider.name,\n\t\t\tdomain: value.provider.domain,\n\t\t\ticon: value.provider.icon,\n\t\t},\n\t\tid: value.id,\n\t\tnodeId: value.nodeId,\n\t\tnumber: value.number,\n\t\ttitle: value.title,\n\t\tbody: value.body,\n\t\turl: value.url,\n\t\tcreatedDate: value.createdDate,\n\t\tupdatedDate: value.updatedDate,\n\t\tclosedDate: value.closedDate,\n\t\tclosed: value.closed,\n\t\tauthor: {\n\t\t\tid: value.author.id,\n\t\t\tname: value.author.name,\n\t\t\tusername: value.author.username,\n\t\t\tavatarUrl: value.author.avatarUrl,\n\t\t\turl: value.author.url,\n\t\t},\n\t\tstate: value.state,\n\t\tmergedDate: value.mergedDate,\n\t\tmergeableState: value.mergeableState,\n\t\trefs: value.refs\n\t\t\t? {\n\t\t\t\t\thead: {\n\t\t\t\t\t\texists: value.refs.head.exists,\n\t\t\t\t\t\towner: value.refs.head.owner,\n\t\t\t\t\t\trepo: value.refs.head.repo,\n\t\t\t\t\t\tsha: value.refs.head.sha,\n\t\t\t\t\t\tbranch: value.refs.head.branch,\n\t\t\t\t\t\turl: value.refs.head.url,\n\t\t\t\t\t\tcloneHttps: value.refs.head.cloneHttps,\n\t\t\t\t\t\tcloneSsh: value.refs.head.cloneSsh,\n\t\t\t\t\t\tisFork: value.refs.head.isFork,\n\t\t\t\t\t},\n\t\t\t\t\tbase: {\n\t\t\t\t\t\texists: value.refs.base.exists,\n\t\t\t\t\t\towner: value.refs.base.owner,\n\t\t\t\t\t\trepo: value.refs.base.repo,\n\t\t\t\t\t\tsha: value.refs.base.sha,\n\t\t\t\t\t\tbranch: value.refs.base.branch,\n\t\t\t\t\t\turl: value.refs.base.url,\n\t\t\t\t\t\tcloneHttps: value.refs.base.cloneHttps,\n\t\t\t\t\t\tcloneSsh: value.refs.base.cloneSsh,\n\t\t\t\t\t\tisFork: value.refs.base.isFork,\n\t\t\t\t\t},\n\t\t\t\t\tisCrossRepository: value.refs.isCrossRepository,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tisDraft: value.isDraft,\n\t\tadditions: value.additions,\n\t\tdeletions: value.deletions,\n\t\tcommentsCount: value.commentsCount,\n\t\tthumbsUpCount: value.thumbsUpCount,\n\t\treviewDecision: value.reviewDecision,\n\t\treviewRequests: value.reviewRequests,\n\t\tlatestReviews: value.latestReviews,\n\t\tassignees: value.assignees,\n\t\tauthoredByMe: value.authoredByMe,\n\t\tviewer: value.viewer != null ? { id: value.viewer.id, username: value.viewer.username } : undefined,\n\t\tviewerUnresolved: value.viewerUnresolved,\n\t\tmilestone: serializeMilestone(value.milestone),\n\t\tproject: value.project\n\t\t\t? {\n\t\t\t\t\tid: value.project.id,\n\t\t\t\t\tname: value.project.name,\n\t\t\t\t\tresourceId: value.project.resourceId,\n\t\t\t\t\tresourceName: value.project.resourceName,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tstack: value.stack\n\t\t\t? {\n\t\t\t\t\tid: value.stack.id,\n\t\t\t\t\tnumber: value.stack.number,\n\t\t\t\t\tsize: value.stack.size,\n\t\t\t\t\tposition: value.stack.position,\n\t\t\t\t\tbaseRef: value.stack.baseRef,\n\t\t\t\t\tmergedLayers: value.stack.mergedLayers,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tmergeQueue: value.mergeQueue\n\t\t\t? {\n\t\t\t\t\tstate: value.mergeQueue.state,\n\t\t\t\t\tenqueuedAt: value.mergeQueue.enqueuedAt,\n\t\t\t\t\testimatedMergeAt: value.mergeQueue.estimatedMergeAt,\n\t\t\t\t\turl: value.mergeQueue.url,\n\t\t\t\t\tposition: value.mergeQueue.position,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tmergeQueueRequired: value.mergeQueueRequired,\n\t\tmergeQueueRemoval: value.mergeQueueRemoval\n\t\t\t? { reason: value.mergeQueueRemoval.reason, removedAt: value.mergeQueueRemoval.removedAt }\n\t\t\t: undefined,\n\t\tcheckRuns: value.checkRuns?.map(run => ({ ...run })),\n\t\tcheckRunsTruncated: value.checkRunsTruncated,\n\t};\n\treturn serialized;\n}\n"],"mappings":";;;;;;;;AAoBA,SAAgB,qBACf,OACA,SACS;CACT,IAAI,SAAS,MAAM,OAAO;CAE1B,MAAM,QAAQ,SAAS,aAAa,MAAM,OAAO,MAAM;CACvD,OAAO,KAAK,IAAI,GAAG,SAAS,MAAM,gBAAgB,EAAE;AACrD;;;;;AAMA,SAAgB,0BACf,IAGC;CACD,OAAO,GAAG,UAAU,YAAY,GAAG,cAAc;AAClD;;AAGA,SAAgB,2BAAyD,IAGxD;CAChB,OAAO,0BAA0B,EAAE,IAAI,WAAW,GAAG;AACtD;;;;AAKA,SAAgB,4BAA0D,IAGZ;CAC7D,OAAO,0BAA0B,EAAE,IAChC;EAAE,QAAQ;EAAU,aAAa,kCAAkC,GAAG,UAAU;CAAE,IAClF;EAAE,QAAQ,GAAG;EAAO,aAAa,KAAA;CAAU;AAC/C;;;;;;;AAQA,SAAgB,kCAAkC,OAIvC;CACV,MAAM,WAAW,MAAM;CAEvB,IAAI;CACJ,QAAQ,MAAM,OAAd;EACC,KAAA;GACC,SACC,YAAY,OACT,KAAK,EAAE,kDAAkD,EAAY,SAAS,CAAC,IAC/E,KAAK,EAAE,iCAAiC;GAC5C;EACD,KAAA;GACC,SACC,YAAY,OACT,KAAK,EAAE,2CAA2C,EAAY,SAAS,CAAC,IACxE,KAAK,EAAE,0BAA0B;GACrC;EACD,KAAA,UAEC,OAAO,KAAK,EAAE,SAAS;EACxB,KAAA,eACC,OAAO,KAAK,EAAE,4BA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