Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/import{
PullRequestCheck,
PullRequestChecks,
PullRequestCheckSuite,
PullRequestComment,
PullRequestCore,
PullRequestFragment,
PullRequestInlineComment,
PullRequestMergeability,
PullRequestParticipant,
PullRequestParticipants,
PullRequestRef,
PullRequestReview,
PullRequestReviewThread,
PullRequestSubscriptionOptions,}from'./githubPullRequestService.js';import{ GitHubHostCapabilities, IGitHubEndpointProvider }from'./githubTypes.js';import{ GitHubCredential }from'./githubCredentialService.js';import{ IGitHubCapabilities }from'./githubHostCapabilitiesService.js';import{ GitHubGraphQLError, GitHubRequestError IGitHubTransport
ILogService
PullRequestRequestPlanner
fragment value PullRequestCore complete
fragment value PullRequestComment complete
fragment value PullRequestReview complete
fragment value PullRequestInlineComment complete
fragment value PullRequestReviewThread complete headSha
fragment value PullRequestChecks complete headSha
fragment value PullRequestMergeability complete headSha
fragment value PullRequestParticipants complete
fragment PullRequestFragment
ref PullRequestRef
core PullRequestCore
options PullRequestSubscriptionOptions
credential GitHubCredential
signal AbortSignal
PullRequestFragmentResult
maximumPaginationPages
reviewThreadsQuery
reviewThreadCommentsQuery
includeRequiredness includeWorkflowNames
expectedCheckSuitesQuery
includeMergeQueue
_planner
_workflowNamesUnavailable
_transport IGitHubTransport
_capabilities IGitHubCapabilities
_endpoint IGitHubEndpointProvider
_logService ILogService
fragment PullRequestFragment
ref PullRequestRef
core PullRequestCore
options PullRequestSubscriptionOptions
credential GitHubCredential
signal AbortSignal
PullRequestFragmentResult
capabilities fragment
_capabilitiescredential signal
restCapabilities
plan _plannerfragment optionspriority capabilities
fragment
fragment value ref credential signal planpriority complete
fragment
value ref credential signal planpriority
item item optionsconversationincludeBodies
complete
fragment
value ref credential signal planpriority
item item optionsconversationincludeBodies
complete
fragment
value ref credential signal planpriority
item item optionsconversationincludeBodies
complete
core
planstrategy
fragment value complete headSha coreheadSha
fragment
value ref core credential signal planpriority optionsconversationincludeBodies
complete
headSha coreheadSha
core
planstrategy
fragment
value ref core credential signal planpriority
complete
headSha coreheadSha
fragment
value
ref
core
credential
signal
planpriority
capabilitiescheckContextRequiredness
optionschecksrequired
optionschecksincludeOptional
complete plancompleteWhenSuccessful
headSha coreheadSha
core
planstrategy
fragment
value ref core credential signal planpriority
complete
headSha coreheadSha
mergeability ref core credential signal planpriority capabilitiesmergeQueue
fragment
value mergeability
complete mergeabilitymergeable mergeabilityqueueRequirementKnown
headSha mergeabilityheadSha
fragment
value ref core credential signal planpriority
complete
ref PullRequestRef credential GitHubCredential signal AbortSignal priority GitHubRequestPriority PullRequestCore
response _transportcredentialaccount credentialtoken
method
url ref
etag
priority
signal
responsedata ref
ref PullRequestRef
credential GitHubCredential
route
signal AbortSignal
priority GitHubRequestPriority
result
url ref route
page url page maximumPaginationPages page
response _transportcredentialaccount credentialtoken
method
url
etag
priority
signal
responsedata
resultresponsedata
url responselink
url
result
ref PullRequestRef
core PullRequestCore
credential GitHubCredential
signal AbortSignal
priority GitHubRequestPriority
includeBodies
PullRequestReviewThread
result PullRequestReviewThread
after
page page maximumPaginationPages page
response _transport
credentialaccount
credentialtoken
_endpoint
reviewThreadsQuery
owner refowner repo refrepo ref after
signal
priority
responseerrors
pullRequest responsedata
pullRequest coreheadSha
connection pullRequest
node connection
thread node credential signal priority includeBodies
resultthread
pageInfo connection
pageInfohasNextPage
result
after pageInfoendCursor
value
credential GitHubCredential
signal AbortSignal
priority GitHubRequestPriority
includeBodies
PullRequestReviewThread
thread value
id thread
diffSide thread
connection thread
comments connection item item includeBodies diffSide
pageInfo connection
after pageInfoendCursor
page pageInfohasNextPage page maximumPaginationPages page
response _transport
credentialaccount
credentialtoken
_endpoint
reviewThreadCommentsQuery
threadId id after after
signal
priority
responseerrors
nextConnection responsedata
commentsnextConnection item item includeBodies diffSide
pageInfo nextConnection
after pageInfoendCursor
pageInfohasNextPage
id
isResolved thread
isOutdated thread
path thread
diffSide
line thread
originalLine thread
comments
ref PullRequestRef
core PullRequestCore
credential GitHubCredential
signal AbortSignal
priority GitHubRequestPriority
includeRequiredness
loadExpectedSuites
includeOptional
PullRequestChecks
rollup ref core credential signal priority includeRequiredness includeOptional
expected loadExpectedSuites
ref coreheadSha credential signal priority
suites complete
headSha rollupheadSha
checks rollupchecks
requirednessComplete includeRequiredness
expectedSuites expectedsuites
expectedSuitesComplete expectedcomplete
ref PullRequestRef
core PullRequestCore
credential GitHubCredential
signal AbortSignal
priority GitHubRequestPriority
includeRequiredness
includeOptional
headSha checks PullRequestCheck
repositoryKey
includeWorkflowNames _workflowNamesUnavailablerepositoryKey
ref core credential signal priority includeRequiredness includeOptional includeWorkflowNames
error
includeWorkflowNames error errorkind
error
_workflowNamesUnavailablerepositoryKey
_logService
ref core credential signal priority includeRequiredness includeOptional
ref PullRequestRef
headSha
credential GitHubCredential
signal AbortSignal
priority GitHubRequestPriority
suites PullRequestCheckSuite complete
suites ref headSha credential signal priority complete
error
error errorkind
error
_logService
suites complete
ref PullRequestRef
core PullRequestCore
credential GitHubCredential
signal AbortSignal
priority GitHubRequestPriority
includeRequiredness
includeOptional
includeWorkflowNames
headSha checks PullRequestCheck
checks PullRequestCheck
after
page page maximumPaginationPages page
response _transport
credentialaccount
credentialtoken
_endpoint
includeRequiredness includeWorkflowNames
owner refowner repo refrepo ref after
signal
priority
responseerrors
pullRequest responsedata
observedHead pullRequest
observedHead coreheadSha
commits pullRequest
commitNode commits
commit commitNode
rollup commit
rollup
headSha observedHead checks
contexts rollup
checkscontexts toCheck
pageInfo contexts
pageInfohasNextPage
headSha observedHead checks checks includeRequiredness includeOptional
after pageInfoendCursor
ref PullRequestRef
headSha
credential GitHubCredential
signal AbortSignal
priority GitHubRequestPriority
PullRequestCheckSuite
suites PullRequestCheckSuite
after
page page maximumPaginationPages page
response _transport
credentialaccount
credentialtoken
_endpoint
expectedCheckSuitesQuery
owner refowner repo refrepo headSha after
signal
priority
responseerrors
commit responsedata
commit headSha
connection commit
suitesconnection toCheckSuite
pageInfo connection
pageInfohasNextPage
suites
after pageInfoendCursor
ref PullRequestRef
core PullRequestCore
credential GitHubCredential
signal AbortSignal
priority GitHubRequestPriority
PullRequestChecks
checks PullRequestCheck
url ref
page url actor roles roles
left right leftloginrightlogin
ref PullRequestRef route
restCapabilities GitHubHostCapabilities
graphql
mergeQueue
internalMergeStatus
reviewThreads
checkContextRequiredness
fragment PullRequestFragment
fragment fragment fragment
mergePermissions ReadonlySet
repository object
permission repository
permission mergePermissionspermission
value ref PullRequestRef PullRequestCore
item value
base item
head item
repository base
repositoryNameWithOwner repository
merged item item
id item
repositoryId repository repository
repositoryNameWithOwner
item ref
title item
body item
url item
state merged item
draft item
headSha head
headRef head
headRepositoryNameWithOwner head head
maintainerCanModify item
baseSha base
baseRef base
author item item
createdAt item
updatedAt item
closedAt item
mergedAt item
value includeBody PullRequestComment
item value
id item
nodeId item
author item item
body includeBody item
url item
createdAt item
updatedAt item
value includeBody PullRequestReview
item value
id item
nodeId item
author item item
state item
body includeBody item
commitId item
submittedAt item
value includeBody PullRequestInlineComment
item value
value includeBody
reviewId item
replyToId item
path item
line item
originalLine item
side item
commitId item
originalCommitId item
value includeBody diffSide PullRequestInlineComment
item value
commit item
originalCommit item
id item
nodeId item
author item item
body includeBody item
url item
createdAt item
updatedAt item
path item
line item
originalLine item
side diffSide
commitId commit commit
originalCommitId originalCommit originalCommit
value PullRequestCheck
item value
type item
type
suite item
workflowRun suite suite
workflow workflowRun workflowRun
id item
type
name item
status item
conclusion item
required item
detailsUrl item
workflowName workflow workflow
id item
type
name item
status item
required item
detailsUrl item
value PullRequestCheck
item value
id item
type
name item
status item
conclusion item
detailsUrl item
value PullRequestCheck
item value
id item
type
name item
status item
detailsUrl item
value PullRequestCheckSuite
item value
app item
checkRuns item
id item
name app app app
status item
conclusion item
checkRunsReported checkRuns
checks PullRequestCheck requirednessAvailable includeOptional PullRequestCheck
includeOptional requirednessAvailable checks checkscheck checkrequired
value object association id login association
value
login value
login
id value value
id id
login
association association
participants Map actor PullRequestParticipant roles Set
actor id login
role
key actorid actorlogin
participant participantskey
participant
participant actor actor roles roles
participantskey participant
participantrolesrole
errors GitHubGraphQLError
errorslength
kinds errorserror errortype
kind kinds
kindstype type type
kindstype type
kindstype type
kind
errors
link
link
part link
match part
matchgroupsrel
matchgroupsurl
connection object hasNextPage endCursor
pageInfo connection
hasNextPage pageInfo
endCursor pageInfo
cursor
cursor
cursor
value path object
current value
part path
current current part
current
values message object
valueslength
message
values message
value message object
value value value
message
value
value object key object
Reflectvalue key
value object key object
property Reflectvalue key
property property property
value object key
property Reflectvalue key
property
property
value object key
property value key
property
property
value object key
property Reflectvalue key
property property
value object key
property Reflectvalue key
property property property
value object key
value key
value object key
property Reflectvalue key
property Numberproperty property
value object key
property Reflectvalue key
property property
value object key
property Reflectvalue key
property property property
value object keys
key keys
id value key
id
id
value object key allowed fallback
property value key
property allowedproperty property fallback
/** Repositories whose host refused the workflow-name subselection, keyed by `owner/repo`. */
private
readonly
=
new
Set<string>
(
)
;
constructor
(
private
readonly
:
,
private
readonly
:
,
private
readonly
:
,
private
readonly
?
:
,
)
{
}
async
fetch
(
:
,
:
,
:
|
undefined
,
:
,
:
,
:
,
)
:
Promise
<
>
{
const
=
needsCapabilities
(
)
?
await
this
.
.
getCapabilities
(
,
undefined
,
)
:
;
const
=
this
.
.
plan
(
,
.
,
)
;
switch
(
)
{
case
'core'
:
return
{
,
:
await
this
.
_fetchCore
(
,
,
,
.
)
,
:
true
}
;
case
'topLevelComments'
:
return
{
,
:
(
await
this
.
_fetchRestArray
(
,
,
`issues/${ref.number}/comments?per_page=100`
,
,
.
)
)
.
map
(
=>
toComment
(
,
.
?.
===
true
)
)
,
:
true
,
}
;
case
'submittedReviews'
:
return
{
,
:
(
await
this
.
_fetchRestArray
(
,
,
`pulls/${ref.number}/reviews?per_page=100`
,
,
.
)
)
.
map
(
=>
toReview
(
,
.
?.
===
true
)
)
,
:
true
,
}
;
case
'inlineComments'
:
return
{
,
:
(
await
this
.
_fetchRestArray
(
,
,
`pulls/${ref.number}/comments?per_page=100`
,
,
.
)
)
.
map
(
=>
toInlineComment
(
,
.
?.
===
true
)
)
,
:
true
,
}
;
case
'reviewThreads'
:
if
(
!
)
{
throw
new
GitHubRequestError
(
'Pull request core is required before review threads'
,
'malformedResponse'
)
;
}
if
(
.
===
'unavailable'
)
{
return
{
,
:
[
]
,
:
false
,
:
.
}
;
}
return
{
,
:
await
this
.
_fetchReviewThreads
(
,
,
,
,
.
,
.
?.
===
true
)
,
:
true
,
:
.
,
}
;
case
'checks'
:
if
(
!
)
{
throw
new
GitHubRequestError
(
'Pull request core is required before checks'
,
'malformedResponse'
)
;
}
if
(
.
===
'restChecksFallback'
)
{
return
{
,
:
await
this
.
_fetchChecksFallback
(
,
,
,
,
.
)
,
:
false
,
:
.
,
}
;
}
return
{
,
:
await
this
.
_fetchChecks
(
,
,
,
,
.
,
.
,
.
?.
===
true
,
.
?.
===
true
,
)
,
:
.
,
:
.
,
}
;
case
'mergeability'
:
{
if
(
!
)
{
throw
new
GitHubRequestError
(
'Pull request core is required before mergeability'
,
'malformedResponse'
)
;
}
if
(
.
===
'restMergeabilityFallback'
)
{
return
{
,
:
await
this
.
_fetchMergeabilityFallback
(
,
,
,
,
.
)
,
:
false
,
:
.
,
}
;
}
const
=
await
this
.
_fetchMergeability
(
,
,
,
,
.
,
.
)
;
return
{
,
:
,
:
.
!==
'UNKNOWN'
&&
.
,
:
.
,
}
;
}
case
'participants'
:
return
{
,
:
await
this
.
_fetchParticipants
(
,
,
,
,
.
)
,
:
true
,
}
;
}
}
private
async
_fetchCore
(
:
,
:
,
:
,
:
import
(
'./githubTypes.js'
)
.
)
:
Promise
<
>
{
const
=
await
this
.
.
rest<unknown>
(
.
,
.
,
{
:
'GET'
,
:
this
.
_restUrl
(
,
`pulls/${ref.number}`
)
,
:
true
,
,
}
,
)
;
return
toCore
(
.
,
)
;
}
private
async
_fetchRestArray
(
:
,
:
,
:
string
,
:
,
:
import
(
'./githubTypes.js'
)
.
,
)
:
Promise
<
readonly
unknown
[
]
>
{
const
:
unknown
[
]
=
[
]
;
let
:
string
|
undefined
=
this
.
_restUrl
(
,
)
;
for
(
let
=
0
;
&&
<
;
++
)
{
const
=
await
this
.
.
rest<unknown>
(
.
,
.
,
{
:
'GET'
,
,
:
true
,
,
}
,
)
;
if
(
!
Array
.
isArray
(
.
)
)
{
throw
new
GitHubRequestError
(
'GitHub paginated response was not an array'
,
'malformedResponse'
)
;
}
.
push
(
...
.
)
;
=
nextLink
(
.
)
;
}
if
(
)
{
throw
new
GitHubRequestError
(
'GitHub pagination exceeded its page limit'
,
'malformedResponse'
)
;
}
return
;
}
private
async
_fetchReviewThreads
(
:
,
:
,
:
,
:
,
:
import
(
'./githubTypes.js'
)
.
,
:
boolean
,
)
:
Promise
<
readonly
[
]
>
{
const
:
[
]
=
[
]
;
let
:
string
|
undefined
;
for
(
let
=
0
;
<
;
++
)
{
const
=
await
this
.
.
graphql<unknown>
(
.
,
.
,
this
.
.
getGraphQlUri
(
)
,
,
{
:
.
,
:
.
,
number
:
.
number
,
}
,
,
,
)
;
throwGraphQLErrors
(
.
)
;
const
=
objectAt
(
.
,
'repository'
,
'pullRequest'
)
;
if
(
requiredString
(
,
'headRefOid'
)
!==
.
)
{
throw
new
GitHubRequestError
(
'GitHub review threads response was for an old pull request head'
,
'unknown'
)
;
}
const
=
objectProperty
(
,
'reviewThreads'
)
;
for
(
const
of
arrayProperty
(
,
'nodes'
)
)
{
const
=
await
this
.
_toReviewThread
(
,
,
,
,
)
;
.
push
(
)
;
}
const
=
pageInfoFrom
(
)
;
if
(
!
.
)
{
return
;
}
=
requiredCursor
(
.
)
;
}
throw
new
GitHubRequestError
(
'GitHub review-thread pagination exceeded its page limit'
,
'malformedResponse'
)
;
}
private
async
_toReviewThread
(
:
unknown
,
:
,
:
,
:
import
(
'./githubTypes.js'
)
.
,
:
boolean
,
)
:
Promise
<
>
{
const
=
asObject
(
,
'GitHub review thread was malformed'
)
;
const
=
requiredString
(
,
'id'
)
;
const
=
stringProperty
(
,
'diffSide'
)
;
const
=
objectProperty
(
,
'comments'
)
;
const
=
arrayProperty
(
,
'nodes'
)
.
map
(
=>
toGraphQLInlineComment
(
,
,
)
)
;
let
=
pageInfoFrom
(
)
;
let
=
.
;
for
(
let
=
1
;
.
&&
<
;
++
)
{
const
=
await
this
.
.
graphql<unknown>
(
.
,
.
,
this
.
.
getGraphQlUri
(
)
,
,
{
:
,
:
requiredCursor
(
)
}
,
,
,
)
;
throwGraphQLErrors
(
.
)
;
const
=
objectAt
(
.
,
'node'
,
'comments'
)
;
.
push
(
...
arrayProperty
(
,
'nodes'
)
.
map
(
=>
toGraphQLInlineComment
(
,
,
)
)
)
;
=
pageInfoFrom
(
)
;
=
.
;
}
if
(
.
)
{
throw
new
GitHubRequestError
(
'GitHub review-thread comment pagination exceeded its page limit'
,
'malformedResponse'
)
;
}
return
{
,
:
booleanProperty
(
,
'isResolved'
)
??
false
,
:
booleanProperty
(
,
'isOutdated'
)
,
:
stringProperty
(
,
'path'
)
,
,
:
numberProperty
(
,
'line'
)
,
:
numberProperty
(
,
'originalLine'
)
,
,
}
;
}
private
async
_fetchChecks
(
:
,
:
,
:
,
:
,
:
import
(
'./githubTypes.js'
)
.
,
:
boolean
,
:
boolean
,
:
boolean
,
)
:
Promise
<
>
{
const
=
await
this
.
_fetchCheckRollupWithWorkflowNames
(
,
,
,
,
,
,
)
;
const
=
?
await
this
.
_fetchExpectedCheckSuitesWhenPermitted
(
,
.
,
,
,
)
:
{
:
[
]
,
:
false
}
;
return
{
:
.
,
:
.
,
:
,
:
.
,
:
.
,
}
;
}
/**
* Loads the check rollup, dropping the workflow-name subselection for a
* repository whose host refuses it so the rest of the checks stay readable.
*/
private
async
_fetchCheckRollupWithWorkflowNames
(
:
,
:
,
:
,
:
,
:
import
(
'./githubTypes.js'
)
.
,
:
boolean
,
:
boolean
,
)
:
Promise
<
{
readonly
:
string
;
readonly
:
readonly
[
]
}
>
{
const
=
`${ref.owner}/${ref.repo}`
.
toLowerCase
(
)
;
const
=
!
this
.
.
has
(
)
;
try
{
return
await
this
.
_fetchCheckRollup
(
,
,
,
,
,
,
,
)
;
}
catch
(
)
{
if
(
!
||
!
(
instanceof
GitHubRequestError
)
||
.
!==
'authorization'
)
{
throw
;
}
this
.
.
add
(
)
;
this
.
?.
warn
(
`[PullRequestQueryService] Retrying checks for ${ref.owner}/${ref.repo}#${ref.number} without workflow names because GitHub refused them: ${error.message}`
)
;
return
await
this
.
_fetchCheckRollup
(
,
,
,
,
,
,
,
false
)
;
}
}
/** Loads the expected check suites, reporting them absent and incomplete when the host refuses them. */
private
async
_fetchExpectedCheckSuitesWhenPermitted
(
:
,
:
string
,
:
,
:
,
:
import
(
'./githubTypes.js'
)
.
,
)
:
Promise
<
{
readonly
:
readonly
[
]
;
readonly
:
boolean
}
>
{
try
{
return
{
:
await
this
.
_fetchExpectedCheckSuites
(
,
,
,
,
)
,
:
true
}
;
}
catch
(
)
{
if
(
!
(
instanceof
GitHubRequestError
)
||
.
!==
'authorization'
)
{
throw
;
}
this
.
?.
warn
(
`[PullRequestQueryService] Reporting expected check suites for ${ref.owner}/${ref.repo}#${ref.number} as unavailable because GitHub refused them: ${error.message}`
)
;
return
{
:
[
]
,
:
false
}
;
}
}
private
async
_fetchCheckRollup
(
:
,
:
,
:
,
:
,
:
import
(
'./githubTypes.js'
)
.
,
:
boolean
,
:
boolean
,
:
boolean
,
)
:
Promise
<
{
readonly
:
string
;
readonly
:
readonly
[
]
}
>
{
const
:
[
]
=
[
]
;
let
:
string
|
undefined
;
for
(
let
=
0
;
<
;
++
)
{
const
=
await
this
.
.
graphql<unknown>
(
.
,
.
,
this
.
.
getGraphQlUri
(
)
,
checksQuery
(
,
)
,
{
:
.
,
:
.
,
number
:
.
number
,
}
,
,
,
)
;
throwGraphQLErrors
(
.
)
;
const
=
objectAt
(
.
,
'repository'
,
'pullRequest'
)
;
const
=
requiredString
(
,
'headRefOid'
)
;
if
(
!==
.
)
{
throw
new
GitHubRequestError
(
'GitHub checks response was for an old pull request head'
,
'unknown'
)
;
}
const
=
objectProperty
(
,
'commits'
)
;
const
=
firstObject
(
arrayProperty
(
,
'nodes'
)
,
'GitHub checks response did not contain the current commit'
)
;
const
=
objectProperty
(
,
'commit'
)
;
const
=
optionalObjectProperty
(
,
'statusCheckRollup'
)
;
if
(
!
)
{
return
{
:
,
:
[
]
}
;
}
const
=
objectProperty
(
,
'contexts'
)
;
.
push
(
...
arrayProperty
(
,
'nodes'
)
.
map
(
)
)
;
const
=
pageInfoFrom
(
)
;
if
(
!
.
)
{
return
{
:
,
:
filterChecks
(
,
,
)
}
;
}
=
requiredCursor
(
.
)
;
}
throw
new
GitHubRequestError
(
'GitHub check pagination exceeded its page limit'
,
'malformedResponse'
)
;
}
private
async
_fetchExpectedCheckSuites
(
:
,
:
string
,
:
,
:
,
:
import
(
'./githubTypes.js'
)
.
,
)
:
Promise
<
readonly
[
]
>
{
const
:
[
]
=
[
]
;
let
:
string
|
undefined
;
for
(
let
=
0
;
<
;
++
)
{
const
=
await
this
.
.
graphql<unknown>
(
.
,
.
,
this
.
.
getGraphQlUri
(
)
,
,
{
:
.
,
:
.
,
,
}
,
,
,
)
;
throwGraphQLErrors
(
.
)
;
const
=
objectAt
(
.
,
'repository'
,
'object'
)
;
if
(
requiredString
(
,
'oid'
)
!==
)
{
throw
new
GitHubRequestError
(
'GitHub expected check suites were for an old pull request head'
,
'unknown'
)
;
}
const
=
objectProperty
(
,
'checkSuites'
)
;
.
push
(
...
arrayProperty
(
,
'nodes'
)
.
map
(
)
)
;
const
=
pageInfoFrom
(
)
;
if
(
!
.
)
{
return
;
}
=
requiredCursor
(
.
)
;
}
throw
new
GitHubRequestError
(
'GitHub expected check-suite pagination exceeded its page limit'
/** `RepositoryPermission` values that grant push access, and therefore permission to merge a pull request. */
const
:
<
string
>
=
new
Set
(
[
'ADMIN'
,
'MAINTAIN'
,
'WRITE'
]
)
;
/**
* GitHub's GraphQL schema has no `PullRequest.viewerCanMerge`, so merge permission is derived from the
* viewer's permission on the base repository. `Repository.viewerPermission` is null when the request is
* authenticated as a GitHub App, which fails closed the same way the REST fallback does.
*/
function
canViewerMerge
(
:
)
:
boolean
{
const
=
normalizedEnumProperty
(
,
'viewerPermission'
)
;
return
!==
undefined
&&
.
has
(
)
;
}
function
toCore
(
:
unknown
,
:
)
:
{
const
=
asObject
(
,
'GitHub pull request response was malformed'
)
;
const
=
objectProperty
(
,
'base'
)
;
const
=
objectProperty
(
,
'head'
)
;
const
=
objectProperty
(
,
'repo'
)
;
const
=
requiredString
(
,
'full_name'
)
;
const
=
booleanProperty
(
,
'merged'
)
===
true
||
stringProperty
(
,
'state'
)
===
'merged'
;
return
{
:
idProperty
(
,
'node_id'
)
,
:
idProperty
(
,
'node_id'
)
??
idProperty
(
,
'id'
)
,
,
number
:
numberProperty
(
,
'number'
)
??
.
number
,
:
requiredString
(
,
'title'
)
,
:
nullableStringProperty
(
,
'body'
)
,
:
requiredString
(
,
'html_url'
)
,
:
?
'merged'
:
stringProperty
(
,
'state'
)
===
'open'
?
'open'
:
'closed'
,
:
booleanProperty
(
,
'draft'
)
??
false
,
:
requiredString
(
,
'sha'
)
,
:
requiredString
(
,
'ref'
)
,
:
optionalObjectProperty
(
,
'repo'
)
?
stringProperty
(
objectProperty
(
,
'repo'
)
,
'full_name'
)
:
undefined
,
:
booleanProperty
(
,
'maintainer_can_modify'
)
??
false
,
:
requiredString
(
,
'sha'
)
,
:
requiredString
(
,
'ref'
)
,
:
toActor
(
optionalObjectProperty
(
,
'user'
)
,
stringProperty
(
,
'author_association'
)
)
,
:
stringProperty
(
,
'created_at'
)
,
:
stringProperty
(
,
'updated_at'
)
,
:
nullableStringProperty
(
,
'closed_at'
)
,
:
nullableStringProperty
(
,
'merged_at'
)
,
}
;
}
function
toComment
(
:
unknown
,
:
boolean
)
:
{
const
=
asObject
(
,
'GitHub issue comment was malformed'
)
;
return
{
:
requiredId
(
,
'id'
)
,
:
idProperty
(
,
'node_id'
)
,
:
toActor
(
optionalObjectProperty
(
,
'user'
)
,
stringProperty
(
,
'author_association'
)
)
,
:
?
nullableStringProperty
(
,
'body'
)
:
undefined
,
:
stringProperty
(
,
'html_url'
)
,
:
stringProperty
(
,
'created_at'
)
,
:
stringProperty
(
,
'updated_at'
)
,
}
;
}
function
toReview
(
:
unknown
,
:
boolean
)
:
{
const
=
asObject
(
,
'GitHub pull request review was malformed'
)
;
return
{
:
requiredId
(
,
'id'
)
,
:
idProperty
(
,
'node_id'
)
,
:
toActor
(
optionalObjectProperty
(
,
'user'
)
,
stringProperty
(
,
'author_association'
)
)
,
:
stringProperty
(
,
'state'
)
??
'UNKNOWN'
,
:
?
nullableStringProperty
(
,
'body'
)
:
undefined
,
:
stringProperty
(
,
'commit_id'
)
,
:
stringProperty
(
,
'submitted_at'
)
,
}
;
}
function
toInlineComment
(
:
unknown
,
:
boolean
)
:
{
const
=
asObject
(
,
'GitHub pull request inline comment was malformed'