@gitkraken/core-gitlens 0.45.0 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -1
- package/dist/git/models/remote.js +2 -2
- package/dist/git/models/remote.js.map +1 -1
- package/dist/git/remotes/matcher.js +25 -3
- package/dist/git/remotes/matcher.js.map +1 -1
- package/dist/git/utils/branchLanded.utils.d.ts +7 -0
- package/dist/git/utils/branchLanded.utils.js +10 -1
- package/dist/git/utils/branchLanded.utils.js.map +1 -1
- package/dist/git/utils/remote.utils.d.ts +1 -0
- package/dist/git/utils/remote.utils.js +14 -5
- package/dist/git/utils/remote.utils.js.map +1 -1
- package/dist/git-cli/parsers/logParser.js +227 -468
- package/dist/git-cli/parsers/logParser.js.map +1 -1
- package/dist/git-cli/parsers/refParser.js +4 -4
- package/dist/git-cli/parsers/refParser.js.map +1 -1
- package/dist/git-cli/providers/branches.d.ts +5 -0
- package/dist/git-cli/providers/branches.js +25 -21
- package/dist/git-cli/providers/branches.js.map +1 -1
- package/dist/git-cli/providers/config.js +2 -2
- package/dist/git-cli/providers/pausedOperations.js +2 -2
- package/dist/git-cli/providers/pausedOperations.js.map +1 -1
- package/dist/git-cli/providers/staging.js +1 -1
- package/dist/ipc/discovery.js +1 -1
- package/dist/plus/agents/providers/claudeCodeTranscript.js +6 -6
- package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -1
- package/dist/plus/ai/providers/openAICompatibleProviderBase.js +1 -1
- package/dist/plus/git-github/api/enterprisePullRequestMergePolicy.d.ts +31 -0
- package/dist/plus/git-github/api/enterprisePullRequestMergePolicy.js +166 -0
- package/dist/plus/git-github/api/enterprisePullRequestMergePolicy.js.map +1 -0
- package/dist/plus/git-github/api/github.d.ts +13 -5
- package/dist/plus/git-github/api/github.js +53 -13
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/api/issueWrites.d.ts +7 -1
- package/dist/plus/git-github/api/issueWrites.js +62 -32
- package/dist/plus/git-github/api/issueWrites.js.map +1 -1
- package/dist/plus/git-github/api/pullRequestWrites.d.ts +7 -3
- package/dist/plus/git-github/api/pullRequestWrites.js +120 -67
- package/dist/plus/git-github/api/pullRequestWrites.js.map +1 -1
- package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.d.ts +44 -0
- package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.js +199 -0
- package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.js.map +1 -0
- package/dist/plus/integrations/authentication/configuredIntegrationService.d.ts +7 -0
- package/dist/plus/integrations/authentication/configuredIntegrationService.js +53 -7
- package/dist/plus/integrations/authentication/configuredIntegrationService.js.map +1 -1
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.d.ts +2 -38
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.js +0 -199
- package/dist/plus/integrations/authentication/integrationAuthenticationService.d.ts +4 -2
- package/dist/plus/integrations/authentication/integrationAuthenticationService.js +12 -1
- package/dist/plus/integrations/authentication/integrationAuthenticationService.js.map +1 -1
- package/dist/plus/integrations/authentication/models.d.ts +0 -1
- package/dist/plus/integrations/authentication/models.js +1 -2
- package/dist/plus/integrations/authentication/models.js.map +1 -1
- package/dist/plus/integrations/constants.d.ts +0 -10
- package/dist/plus/integrations/constants.js +1 -95
- package/dist/plus/integrations/constants.js.map +1 -1
- package/dist/plus/integrations/context.d.ts +17 -17
- package/dist/plus/integrations/index.d.ts +44 -25
- package/dist/plus/integrations/index.js +41 -8
- package/dist/plus/integrations/index.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +24 -24
- package/dist/plus/integrations/integrationService.js +125 -34
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/lite.js +1 -1
- package/dist/plus/integrations/lite.js.map +1 -1
- package/dist/plus/integrations/manager.d.ts +81 -21
- package/dist/plus/integrations/models/actionablePullRequest.d.ts +213 -0
- package/dist/plus/integrations/models/actionablePullRequest.js +25 -0
- package/dist/plus/integrations/models/actionablePullRequest.js.map +1 -0
- package/dist/plus/integrations/models/gitHostIntegration.d.ts +13 -46
- package/dist/plus/integrations/models/gitHostIntegration.js +22 -8
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
- package/dist/plus/integrations/models/integration.d.ts +11 -175
- package/dist/plus/integrations/models/integration.js +22 -76
- package/dist/plus/integrations/models/integration.js.map +1 -1
- package/dist/plus/integrations/models/issueTrackerWrites.d.ts +128 -0
- package/dist/plus/integrations/models/issueTrackerWrites.js +0 -0
- package/dist/plus/integrations/models/issuesIntegration.d.ts +9 -5
- package/dist/plus/integrations/models/issuesIntegration.js +5 -3
- package/dist/plus/integrations/models/issuesIntegration.js.map +1 -1
- package/dist/plus/integrations/models/publicIntegration.d.ts +257 -0
- package/dist/plus/integrations/models/publicIntegration.js +21 -0
- package/dist/plus/integrations/models/publicIntegration.js.map +1 -0
- package/dist/plus/integrations/providerFilters.d.ts +58 -0
- package/dist/plus/integrations/providerFilters.js.map +1 -1
- package/dist/plus/integrations/providers/actionablePullRequests.d.ts +19 -0
- package/dist/plus/integrations/providers/actionablePullRequests.js +32 -0
- package/dist/plus/integrations/providers/actionablePullRequests.js.map +1 -0
- package/dist/plus/integrations/providers/apiClients.d.ts +1 -2
- package/dist/plus/integrations/providers/apiClients.js.map +1 -1
- package/dist/plus/integrations/providers/asana.d.ts +3 -2
- package/dist/plus/integrations/providers/asana.js +2 -1
- package/dist/plus/integrations/providers/asana.js.map +1 -1
- package/dist/plus/integrations/providers/azure/azure.d.ts +1 -1
- package/dist/plus/integrations/providers/azure/azure.js +1 -1
- package/dist/plus/integrations/providers/azure/azure.utils.d.ts +10 -3
- package/dist/plus/integrations/providers/azure/azure.utils.js +5 -1
- package/dist/plus/integrations/providers/azure/azure.utils.js.map +1 -1
- package/dist/plus/integrations/providers/azure/models.d.ts +1 -5
- package/dist/plus/integrations/providers/azure/models.js +1 -1
- package/dist/plus/integrations/providers/azure/models.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOps.d.ts +8 -5
- package/dist/plus/integrations/providers/azureDevOps.js +2 -1
- package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOpsServer.d.ts +5 -4
- package/dist/plus/integrations/providers/azureDevOpsServer.js +3 -1
- package/dist/plus/integrations/providers/azureDevOpsServer.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket/bitbucket.d.ts +2 -2
- package/dist/plus/integrations/providers/bitbucket/bitbucket.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket/models.d.ts +1 -1
- package/dist/plus/integrations/providers/bitbucket/models.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket-server.d.ts +5 -4
- package/dist/plus/integrations/providers/bitbucket-server.js +2 -1
- package/dist/plus/integrations/providers/bitbucket-server.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket.d.ts +4 -3
- package/dist/plus/integrations/providers/bitbucket.js +2 -1
- package/dist/plus/integrations/providers/bitbucket.js.map +1 -1
- package/dist/plus/integrations/providers/github/github.d.ts +0 -1
- package/dist/plus/integrations/providers/github/github.js +1 -1
- package/dist/plus/integrations/providers/github/github.js.map +1 -1
- package/dist/plus/integrations/providers/github.d.ts +29 -11
- package/dist/plus/integrations/providers/github.js +195 -78
- package/dist/plus/integrations/providers/github.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.d.ts +2 -2
- package/dist/plus/integrations/providers/gitlab/gitlab.js +1 -2
- package/dist/plus/integrations/providers/gitlab/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.utils.d.ts +14 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.utils.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/models.d.ts +2 -10
- package/dist/plus/integrations/providers/gitlab/models.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab.d.ts +7 -5
- package/dist/plus/integrations/providers/gitlab.js +2 -1
- package/dist/plus/integrations/providers/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/issueSorts.d.ts +1 -0
- package/dist/plus/integrations/providers/jira-server.d.ts +4 -4
- package/dist/plus/integrations/providers/jira-server.js +3 -2
- package/dist/plus/integrations/providers/jira-server.js.map +1 -1
- package/dist/plus/integrations/providers/jira.d.ts +3 -3
- package/dist/plus/integrations/providers/jira.js +4 -3
- package/dist/plus/integrations/providers/jira.js.map +1 -1
- package/dist/plus/integrations/providers/jiraIssueByKey.d.ts +3 -1
- package/dist/plus/integrations/providers/jiraIssueByKey.js +1 -1
- package/dist/plus/integrations/providers/jiraIssueByKey.js.map +1 -1
- package/dist/plus/integrations/providers/jiraIssueWriteErrors.d.ts +10 -0
- package/dist/plus/integrations/providers/jiraIssueWriteErrors.js +68 -0
- package/dist/plus/integrations/providers/jiraIssueWriteErrors.js.map +1 -0
- package/dist/plus/integrations/providers/jiraIssueWrites.d.ts +40 -0
- package/dist/plus/integrations/providers/jiraIssueWrites.js +397 -0
- package/dist/plus/integrations/providers/jiraIssueWrites.js.map +1 -0
- package/dist/plus/integrations/providers/linear.d.ts +4 -3
- package/dist/plus/integrations/providers/linear.js +3 -2
- package/dist/plus/integrations/providers/linear.js.map +1 -1
- package/dist/plus/integrations/providers/linearIssuesEtag.d.ts +1 -1
- package/dist/plus/integrations/providers/linearIssuesEtag.js +1 -1
- package/dist/plus/integrations/providers/linearIssuesEtag.js.map +1 -1
- package/dist/plus/integrations/providers/metadata.d.ts +136 -0
- package/dist/plus/integrations/providers/metadata.js +513 -0
- package/dist/plus/integrations/providers/metadata.js.map +1 -0
- package/dist/plus/integrations/providers/models.d.ts +10 -206
- package/dist/plus/integrations/providers/models.js +8 -539
- package/dist/plus/integrations/providers/models.js.map +1 -1
- package/dist/plus/integrations/providers/providersApi.d.ts +7 -3
- package/dist/plus/integrations/providers/providersApi.js +23 -11
- package/dist/plus/integrations/providers/providersApi.js.map +1 -1
- package/dist/plus/integrations/providers/trello.d.ts +1 -1
- package/dist/plus/integrations/providers/trello.js +2 -1
- package/dist/plus/integrations/providers/trello.js.map +1 -1
- package/dist/plus/integrations/providers/utils/providerPaging.d.ts +2 -0
- package/dist/plus/integrations/providers/utils/providerPaging.js +3 -2
- package/dist/plus/integrations/providers/utils/providerPaging.js.map +1 -1
- package/dist/plus/integrations/providers/utils.d.ts +119 -10
- package/dist/plus/integrations/providers/utils.js +57 -3
- package/dist/plus/integrations/providers/utils.js.map +1 -1
- package/dist/plus/integrations/reads/autolinks.d.ts +1 -1
- package/dist/plus/integrations/reads/autolinks.js +1 -1
- package/dist/plus/integrations/reads/autolinks.js.map +1 -1
- package/dist/plus/integrations/reads/broaden.d.ts +1 -1
- package/dist/plus/integrations/reads/broaden.js +3 -2
- package/dist/plus/integrations/reads/broaden.js.map +1 -1
- package/dist/plus/integrations/reads/context.d.ts +1 -1
- package/dist/plus/integrations/reads/counts.d.ts +1 -88
- package/dist/plus/integrations/reads/counts.js +4 -2
- package/dist/plus/integrations/reads/counts.js.map +1 -1
- package/dist/plus/integrations/reads/currentAccount.d.ts +1 -18
- package/dist/plus/integrations/reads/currentAccount.js.map +1 -1
- package/dist/plus/integrations/reads/drains.d.ts +4 -3
- package/dist/plus/integrations/reads/drains.js +1 -1
- package/dist/plus/integrations/reads/drains.js.map +1 -1
- package/dist/plus/integrations/reads/etag.d.ts +174 -3
- package/dist/plus/integrations/reads/etag.js +69 -14
- package/dist/plus/integrations/reads/etag.js.map +1 -1
- package/dist/plus/integrations/reads/filters.d.ts +3 -61
- package/dist/plus/integrations/reads/filters.js +1 -1
- package/dist/plus/integrations/reads/filters.js.map +1 -1
- package/dist/plus/integrations/reads/hierarchy.d.ts +1 -1
- package/dist/plus/integrations/reads/hierarchy.js +4 -2
- package/dist/plus/integrations/reads/hierarchy.js.map +1 -1
- package/dist/plus/integrations/reads/issueBatch.d.ts +2 -102
- package/dist/plus/integrations/reads/issueBatch.js +3 -4
- package/dist/plus/integrations/reads/issueBatch.js.map +1 -1
- package/dist/plus/integrations/reads/issueTracker.d.ts +1 -1
- package/dist/plus/integrations/reads/issueTracker.js +4 -3
- package/dist/plus/integrations/reads/issueTracker.js.map +1 -1
- package/dist/plus/integrations/reads/issues.d.ts +1 -1
- package/dist/plus/integrations/reads/issues.js +4 -2
- package/dist/plus/integrations/reads/issues.js.map +1 -1
- package/dist/plus/integrations/reads/paging.d.ts +1 -1
- package/dist/plus/integrations/reads/paging.js +1 -1
- package/dist/plus/integrations/reads/paging.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestActivity.d.ts +1 -24
- package/dist/plus/integrations/reads/pullRequestActivity.js +2 -1
- package/dist/plus/integrations/reads/pullRequestActivity.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestBatch.d.ts +2 -56
- package/dist/plus/integrations/reads/pullRequestBatch.js +23 -3
- package/dist/plus/integrations/reads/pullRequestBatch.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestBranches.d.ts +1 -47
- package/dist/plus/integrations/reads/pullRequestBranches.js +2 -1
- package/dist/plus/integrations/reads/pullRequestBranches.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestCheckLogs.d.ts +1 -15
- package/dist/plus/integrations/reads/pullRequestCheckLogs.js +2 -1
- package/dist/plus/integrations/reads/pullRequestCheckLogs.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequests.js +4 -2
- package/dist/plus/integrations/reads/pullRequests.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestsForCommits.d.ts +1 -16
- package/dist/plus/integrations/reads/pullRequestsForCommits.js +2 -1
- package/dist/plus/integrations/reads/pullRequestsForCommits.js.map +1 -1
- package/dist/plus/integrations/reads/resolveRepository.js +10 -5
- package/dist/plus/integrations/reads/resolveRepository.js.map +1 -1
- package/dist/plus/integrations/reads/searchIssues.js +2 -1
- package/dist/plus/integrations/reads/searchIssues.js.map +1 -1
- package/dist/plus/integrations/reads/searchPullRequests.js +2 -1
- package/dist/plus/integrations/reads/searchPullRequests.js.map +1 -1
- package/dist/plus/integrations/reads/sweeps.d.ts +1 -1
- package/dist/plus/integrations/reads/sweeps.js +3 -2
- package/dist/plus/integrations/reads/sweeps.js.map +1 -1
- package/dist/plus/integrations/reads/warnings.d.ts +1 -1
- package/dist/plus/integrations/reads/warnings.js +1 -1
- package/dist/plus/integrations/reads/warnings.js.map +1 -1
- package/dist/plus/integrations/results.d.ts +324 -2
- package/dist/plus/integrations/results.js.map +1 -1
- package/dist/plus/integrations/telemetry.d.ts +0 -10
- package/dist/plus/integrations/telemetry.js +0 -11
- package/dist/plus/integrations/utils/domain.utils.d.ts +1 -0
- package/dist/plus/integrations/utils/domain.utils.js +10 -2
- package/dist/plus/integrations/utils/domain.utils.js.map +1 -1
- package/dist/plus/integrations/utils/integration.utils.d.ts +2 -6
- package/dist/plus/integrations/utils/integration.utils.js +8 -9
- package/dist/plus/integrations/utils/integration.utils.js.map +1 -1
- package/dist/utils/env/node/exec.js +2 -2
- package/dist/utils/keys/chord.d.ts +13 -2
- package/dist/utils/keys/chord.js +76 -17
- package/dist/utils/keys/chord.js.map +1 -1
- package/dist/utils/keys/keybinding.d.ts +12 -0
- package/dist/utils/keys/keybinding.js +52 -2
- package/dist/utils/keys/keybinding.js.map +1 -1
- package/dist/utils/markdown.d.ts +21 -0
- package/dist/utils/markdown.js +33 -1
- package/dist/utils/markdown.js.map +1 -1
- package/docs/integrations.md +174 -19
- package/package.json +5 -1
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.js.map +0 -1
- package/dist/plus/integrations/telemetry.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sweeps.js","names":[],"sources":["../../../../../plus/integrations/src/reads/sweeps.ts"],"sourcesContent":["import type { PullRequestShape } from '@gitlens/git/models/pullRequest.js';\nimport { mapBounded } from '@gitlens/utils/promise.js';\nimport type { IntegrationIds } from '../constants.js';\nimport { providerFanOutConcurrency } from '../constants.js';\nimport type {\n\tClosedPullRequestSweepOptions,\n\tProviderSweepTarget,\n\tProviderSweepTargetEvent,\n\tPullRequestSweepOptions,\n} from '../manager.js';\nimport { toPullRequestRow } from '../providers/models.js';\nimport type { ProviderSweepResult, ProviderSweepTargetRef, ProviderWarning } from '../results.js';\nimport { appendDedupedWarning } from '../results.js';\nimport { isGitHostIntegration, isIssuesHostIntegrationId } from '../utils/integration.utils.js';\nimport type { ProviderReadContext } from './context.js';\nimport { drainPullRequests, getPullRequestViewers, resolvePullRequestSweepTargets } from './drains.js';\nimport { resolveAccountWidePullRequestFilters, resolvePullRequestFilters } from './filters.js';\nimport {\n\tgitHostOnlySurfaceWarning,\n\tnoConnectionWarning,\n\tunsupportedAccountWidePullRequestFiltersWarning,\n\tunsupportedFiltersWarning,\n} from './warnings.js';\n\n/**\n * The all-pages pull request reads: one drain per provider target, aggregated into a single sweep result.\n *\n * A sweep exposes no continuation of its own — it drains everything it can reach — so its whole contract lives in\n * the completeness signals it returns: `page.allPages` asserts every page of every target was read,\n * `page.truncated` says pages remain unread, and `failedTargets`/`incompleteTargets` (summarized per provider by\n * `failedProviderIds`/`incompleteProviderIds`) separate a target that produced nothing from one that produced a\n * slice with a gap. That split is why the aggregation below can't be collapsed into the generic fan-out merge\n * the hierarchy reads use.\n */\n\n/** One provider target's drained slice, before the cross-provider aggregation. */\ninterface SweepSlice {\n\titems: PullRequestShape[];\n\twarnings: ProviderWarning[];\n\tfetchFailed: boolean;\n\ttruncated: boolean;\n\tproviderId: IntegrationIds;\n\tfailedProvider: boolean;\n}\n\n/**\n * Drain ONE sweep target. Extracted from the fan-out so the fan-out callback has a single exit: every\n * per-target observation (see `onTargetSettled`) is then reported in one place instead of at each of this\n * function's several early returns, where a missed branch would silently drop a provider's attribution.\n *\n * `undefined` means the target resolved to no reachable connection and is deliberately not attributed in the\n * aggregate result.\n */\nasync function sweepTarget(\n\tctx: ProviderReadContext,\n\toptions: PullRequestSweepOptions | undefined,\n\ttarget: ProviderSweepTarget,\n\tattributeUnavailableProviders: boolean,\n): Promise<SweepSlice | undefined> {\n\tconst { providerId: id, connectionId, domain: requestedDomain } = target;\n\tconst repos = target.repos ?? options?.repos ?? [];\n\tconst maxPages = options?.maxPages ?? 100;\n\t/** A target that never reached a drain: the provider itself failed, so its slice is empty and attributed. */\n\tconst rejectedTarget = (warnings: ProviderWarning[]): SweepSlice => ({\n\t\titems: [],\n\t\twarnings: warnings,\n\t\tfetchFailed: true,\n\t\ttruncated: false,\n\t\tproviderId: id,\n\t\tfailedProvider: true,\n\t});\n\n\tif (isIssuesHostIntegrationId(id)) {\n\t\treturn rejectedTarget([gitHostOnlySurfaceWarning(id, requestedDomain, connectionId, 'pull request sweeps')]);\n\t}\n\n\tconst integration = await ctx.getIntegrationForRead(id, connectionId, requestedDomain);\n\tif (integration == null) {\n\t\t// A requested connection that can't be resolved is a broken connection — surface it as a\n\t\t// warning + fetchFailed rather than dropping the provider's slice silently.\n\t\tconst early = ctx.earlyReturnConnectionWarnings(id, connectionId, requestedDomain);\n\t\tif (early.warnings.length === 0 && !attributeUnavailableProviders) return undefined;\n\n\t\treturn rejectedTarget(\n\t\t\tearly.warnings.length !== 0 ? early.warnings : [noConnectionWarning(id, requestedDomain, connectionId)],\n\t\t);\n\t}\n\tif (!isGitHostIntegration(integration)) {\n\t\treturn rejectedTarget([gitHostOnlySurfaceWarning(id, requestedDomain, connectionId, 'pull request sweeps')]);\n\t}\n\n\tawait ctx.forceRefreshIfRequested(integration, options?.forceSync, connectionId);\n\n\tconst domain = ctx.domainForRead(integration, id, connectionId, requestedDomain);\n\tconst accountWide = repos.length === 0;\n\tconst requestedFilters = target.filters ?? options?.filters;\n\tconst resolved = accountWide\n\t\t? resolveAccountWidePullRequestFilters(id, requestedFilters)\n\t\t: resolvePullRequestFilters(id, requestedFilters);\n\tif (resolved.unsupported) {\n\t\treturn rejectedTarget([\n\t\t\taccountWide\n\t\t\t\t? unsupportedAccountWidePullRequestFiltersWarning(id, domain, connectionId, requestedFilters ?? [])\n\t\t\t\t: unsupportedFiltersWarning(id, domain, connectionId),\n\t\t]);\n\t}\n\n\tconst drain = await drainPullRequests(\n\t\tintegration,\n\t\tid,\n\t\tdomain,\n\t\trepos,\n\t\toptions?.states,\n\t\tresolved.filters,\n\t\toptions,\n\t\tconnectionId,\n\t\tmaxPages,\n\t\tattributeUnavailableProviders,\n\t);\n\tconst viewers = await getPullRequestViewers(integration, connectionId, drain.items);\n\t// Mirrors the projection `drainPullRequests` requests.\n\tconst projection = accountWide ? (options?.includeReviews ? 'account' : 'account-summary') : 'repos';\n\t// Normalize the raw rows to the GitLens-owned shape here, where the per-provider `integration` (the\n\t// mapper's provider reference) is in scope; the aggregation below only sees drains.\n\treturn {\n\t\t...drain,\n\t\titems: drain.items.map((pr, i) =>\n\t\t\ttoPullRequestRow(pr, integration, { currentAccount: viewers[i], projection: projection }),\n\t\t),\n\t\tproviderId: id,\n\t};\n}\n\n/**\n * How a target ended, as the consumer buckets it. `failedProvider` outranks `fetchFailed` because a target\n * whose provider failed produced no slice to be partial about, and `undefined` is the target that resolved to\n * no reachable connection at all.\n */\nfunction sliceOutcome(slice: SweepSlice | undefined): ProviderSweepTargetEvent['outcome'] {\n\tif (slice == null) return 'skipped';\n\tif (slice.failedProvider) return 'failed-provider';\n\tif (slice.fetchFailed) return 'fetch-failed';\n\treturn 'ok';\n}\n\n/**\n * Per-target reporting for a sweep's `onTargetSettled`, opened once per sweep: this stamps the fan-out start,\n * the returned function stamps one target's start, and the function IT returns is the only thing that can\n * report that target. The timestamps therefore never cross a boundary, so there is no pair of interchangeable\n * numbers for a call site to transpose, and the whole reporting concern is one value the fan-out either has or\n * does not. That is also what keeps the option free when it is omitted: with no observer there is nothing to\n * open, so no clock is read and no reporting object exists — do not \"simplify\" that into an unconditional\n * open, because a host whose perf gate is off (the default) is entitled to pay nothing for it.\n *\n * The try/catch is what makes the observer observation-only: called from the fan-out's success path, a throwing\n * callback would otherwise propagate out of the `mapBounded` task and reject the entire sweep — corrupting the\n * read, not just the metric. Swallowed silently; the consumer owns its own aggregation. The `void`-typed\n * callback also admits an `async` consumer, whose rejection is created only after `observe` returns — the\n * `Promise.resolve(...).catch` swallows that too, so it cannot escape as an unhandled rejection.\n *\n * The domain is resolved here rather than carried out of {@link sweepTarget}, so every target reports it by the\n * same rule no matter how far it got. `resolveDomainForRead` needs no integration instance, which is what makes\n * that possible: a target rejected by the first guard resolves the same host a fully drained one does.\n */\nfunction startSweepReporting(\n\tctx: ProviderReadContext,\n\tobserve: (event: ProviderSweepTargetEvent) => void | PromiseLike<unknown>,\n) {\n\tconst fanOutStartedAt = performance.now();\n\n\treturn function beginTarget(target: ProviderSweepTarget) {\n\t\tconst startedAt = performance.now();\n\n\t\treturn function reportSettled(slice: SweepSlice | undefined) {\n\t\t\ttry {\n\t\t\t\tvoid Promise.resolve(\n\t\t\t\t\tobserve({\n\t\t\t\t\t\tproviderId: target.providerId,\n\t\t\t\t\t\tdomain: ctx.resolveDomainForRead(target.providerId, target.connectionId, target.domain),\n\t\t\t\t\t\tconnectionId: target.connectionId,\n\t\t\t\t\t\tcount: slice?.items.length ?? 0,\n\t\t\t\t\t\tdurationMs: performance.now() - startedAt,\n\t\t\t\t\t\tqueueWaitMs: startedAt - fanOutStartedAt,\n\t\t\t\t\t\toutcome: sliceOutcome(slice),\n\t\t\t\t\t\ttruncated: slice?.truncated ?? false,\n\t\t\t\t\t}),\n\t\t\t\t).catch(() => {});\n\t\t\t} catch {}\n\t\t};\n\t};\n}\n\nexport async function sweepPullRequests(\n\tctx: ProviderReadContext,\n\toptions?: PullRequestSweepOptions,\n): Promise<ProviderSweepResult<PullRequestShape>> {\n\tconst { targets, attributeUnavailableProviders } = resolvePullRequestSweepTargets(options);\n\n\tconst observe = options?.onTargetSettled;\n\tconst beginTarget = observe != null ? startSweepReporting(ctx, observe) : undefined;\n\n\tconst results = await mapBounded(targets, providerFanOutConcurrency, async target => {\n\t\tconst reportSettled = beginTarget?.(target);\n\t\tconst slice = await sweepTarget(ctx, options, target, attributeUnavailableProviders);\n\t\treportSettled?.(slice);\n\t\treturn { target: target, slice: slice };\n\t});\n\n\tconst items: PullRequestShape[] = [];\n\tconst warnings: ProviderWarning[] = [];\n\tconst failedTargets: ProviderSweepTargetRef[] = [];\n\tconst incompleteTargets: ProviderSweepTargetRef[] = [];\n\t// Per provider: attributed (non-skipped) targets, and how many of them failed or came back incomplete.\n\tconst attributed = new Map<IntegrationIds, { total: number; failed: number; incomplete: number }>();\n\tlet fetchFailed = false;\n\tlet truncated = false;\n\tfor (const { target, slice: drain } of results) {\n\t\tif (drain == null) {\n\t\t\tcontinue;\n\t\t}\n\n\t\titems.push(...drain.items);\n\t\tfor (const w of drain.warnings) {\n\t\t\tappendDedupedWarning(warnings, w);\n\t\t}\n\t\tif (drain.fetchFailed) {\n\t\t\tfetchFailed = true;\n\t\t}\n\n\t\tlet counts = attributed.get(drain.providerId);\n\t\tif (counts == null) {\n\t\t\tcounts = { total: 0, failed: 0, incomplete: 0 };\n\t\t\tattributed.set(drain.providerId, counts);\n\t\t}\n\t\tcounts.total++;\n\n\t\tif (drain.failedProvider || drain.fetchFailed || drain.truncated) {\n\t\t\t// The same ref the target's settle event carries, so a consumer can join the two.\n\t\t\tconst ref: ProviderSweepTargetRef = {\n\t\t\t\tproviderId: target.providerId,\n\t\t\t\tconnectionId: target.connectionId,\n\t\t\t\tdomain: ctx.resolveDomainForRead(target.providerId, target.connectionId, target.domain),\n\t\t\t};\n\t\t\tif (drain.failedProvider) {\n\t\t\t\tcounts.failed++;\n\t\t\t\tfailedTargets.push(ref);\n\t\t\t} else {\n\t\t\t\tcounts.incomplete++;\n\t\t\t\tincompleteTargets.push(ref);\n\t\t\t}\n\t\t}\n\t\tif (drain.truncated) {\n\t\t\ttruncated = true;\n\t\t}\n\t}\n\n\t// A provider is failed only when every target of it failed; any lesser trouble leaves it incomplete.\n\tconst failedProviderIds: IntegrationIds[] = [];\n\tconst incompleteProviderIds: IntegrationIds[] = [];\n\tfor (const [providerId, { total, failed, incomplete }] of attributed) {\n\t\tif (failed === total) {\n\t\t\tfailedProviderIds.push(providerId);\n\t\t} else if (failed + incomplete !== 0) {\n\t\t\tincompleteProviderIds.push(providerId);\n\t\t}\n\t}\n\n\treturn {\n\t\titems: items,\n\t\twarnings: warnings,\n\t\t// `allPages` asserts completeness — it must be false when any provider truncated (a single-page\n\t\t// account-wide read that couldn't confirm it drained everything) OR a drain aborted on a read\n\t\t// failure (its slice is incomplete). Either way the sweep did not read every page.\n\t\tpage: {\n\t\t\tcurrentPage: 1,\n\t\t\titemsPerPage: items.length,\n\t\t\tallPages: !truncated && !fetchFailed,\n\t\t\ttruncated: truncated || undefined,\n\t\t},\n\t\t// A sweep drains every page itself and exposes no cursor to resume — so `hasMore` must be false even\n\t\t// when the read was incomplete. Terminal incompleteness is expressed through `page.truncated` +\n\t\t// `allPages: false` + warnings; setting `hasMore: true` here would make a consumer that drains while\n\t\t// `hasMore` re-run the identical sweep forever with no cursor to advance.\n\t\thasMore: false,\n\t\tfetchFailed: fetchFailed || undefined,\n\t\tfailedProviderIds: failedProviderIds,\n\t\tincompleteProviderIds: incompleteProviderIds,\n\t\tfailedTargets: failedTargets,\n\t\tincompleteTargets: incompleteTargets,\n\t};\n}\n\n/**\n * Closed/merged counterpart of {@link sweepPullRequests}, feeding Kepler's Kanban \"done\" column. Applies\n * the native cross-provider state filter (`Closed` + `Merged`) so it works beyond GitHub.\n */\nexport function sweepClosedPullRequests(\n\tctx: ProviderReadContext,\n\toptions?: ClosedPullRequestSweepOptions,\n): Promise<ProviderSweepResult<PullRequestShape>> {\n\treturn sweepPullRequests(ctx, { ...options, states: ['closed', 'merged'] });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAqDA,eAAe,YACd,KACA,SACA,QACA,+BACkC;CAClC,MAAM,EAAE,YAAY,IAAI,cAAc,QAAQ,oBAAoB;CAClE,MAAM,QAAQ,OAAO,SAAS,SAAS,SAAS,CAAC;CACjD,MAAM,WAAW,SAAS,YAAY;;CAEtC,MAAM,kBAAkB,cAA6C;EACpE,OAAO,CAAC;EACE;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EAAS,QAAQ,CAAC,UAAU,QAAQ;CAAE,CAAC;AAC3E"}
|
|
1
|
+
{"version":3,"file":"sweeps.js","names":[],"sources":["../../../../../plus/integrations/src/reads/sweeps.ts"],"sourcesContent":["import type { PullRequestShape } from '@gitlens/git/models/pullRequest.js';\nimport { mapBounded } from '@gitlens/utils/promise.js';\nimport type { IntegrationIds } from '../constants.js';\nimport type {\n\tClosedPullRequestSweepOptions,\n\tProviderSweepTarget,\n\tProviderSweepTargetEvent,\n\tPullRequestSweepOptions,\n} from '../manager.js';\nimport { isGitHostIntegration } from '../models/publicIntegration.js';\nimport { toPullRequestRow } from '../providers/models.js';\nimport { providerFanOutConcurrency } from '../providers/utils/providerPaging.js';\nimport type { ProviderSweepResult, ProviderSweepTargetRef, ProviderWarning } from '../results.js';\nimport { appendDedupedWarning } from '../results.js';\nimport { isIssuesHostIntegrationId } from '../utils/integration.utils.js';\nimport type { ProviderReadContext } from './context.js';\nimport { drainPullRequests, getPullRequestViewers, resolvePullRequestSweepTargets } from './drains.js';\nimport { resolveAccountWidePullRequestFilters, resolvePullRequestFilters } from './filters.js';\nimport {\n\tgitHostOnlySurfaceWarning,\n\tnoConnectionWarning,\n\tunsupportedAccountWidePullRequestFiltersWarning,\n\tunsupportedFiltersWarning,\n} from './warnings.js';\n\n/**\n * The all-pages pull request reads: one drain per provider target, aggregated into a single sweep result.\n *\n * A sweep exposes no continuation of its own — it drains everything it can reach — so its whole contract lives in\n * the completeness signals it returns: `page.allPages` asserts every page of every target was read,\n * `page.truncated` says pages remain unread, and `failedTargets`/`incompleteTargets` (summarized per provider by\n * `failedProviderIds`/`incompleteProviderIds`) separate a target that produced nothing from one that produced a\n * slice with a gap. That split is why the aggregation below can't be collapsed into the generic fan-out merge\n * the hierarchy reads use.\n */\n\n/** One provider target's drained slice, before the cross-provider aggregation. */\ninterface SweepSlice {\n\titems: PullRequestShape[];\n\twarnings: ProviderWarning[];\n\tfetchFailed: boolean;\n\ttruncated: boolean;\n\tproviderId: IntegrationIds;\n\tfailedProvider: boolean;\n}\n\n/**\n * Drain ONE sweep target. Extracted from the fan-out so the fan-out callback has a single exit: every\n * per-target observation (see `onTargetSettled`) is then reported in one place instead of at each of this\n * function's several early returns, where a missed branch would silently drop a provider's attribution.\n *\n * `undefined` means the target resolved to no reachable connection and is deliberately not attributed in the\n * aggregate result.\n */\nasync function sweepTarget(\n\tctx: ProviderReadContext,\n\toptions: PullRequestSweepOptions | undefined,\n\ttarget: ProviderSweepTarget,\n\tattributeUnavailableProviders: boolean,\n): Promise<SweepSlice | undefined> {\n\tconst { providerId: id, connectionId, domain: requestedDomain } = target;\n\tconst repos = target.repos ?? options?.repos ?? [];\n\tconst maxPages = options?.maxPages ?? 100;\n\t/** A target that never reached a drain: the provider itself failed, so its slice is empty and attributed. */\n\tconst rejectedTarget = (warnings: ProviderWarning[]): SweepSlice => ({\n\t\titems: [],\n\t\twarnings: warnings,\n\t\tfetchFailed: true,\n\t\ttruncated: false,\n\t\tproviderId: id,\n\t\tfailedProvider: true,\n\t});\n\n\tif (isIssuesHostIntegrationId(id)) {\n\t\treturn rejectedTarget([gitHostOnlySurfaceWarning(id, requestedDomain, connectionId, 'pull request sweeps')]);\n\t}\n\n\tconst integration = await ctx.getIntegrationForRead(id, connectionId, requestedDomain);\n\tif (integration == null) {\n\t\t// A requested connection that can't be resolved is a broken connection — surface it as a\n\t\t// warning + fetchFailed rather than dropping the provider's slice silently.\n\t\tconst early = ctx.earlyReturnConnectionWarnings(id, connectionId, requestedDomain);\n\t\tif (early.warnings.length === 0 && !attributeUnavailableProviders) return undefined;\n\n\t\treturn rejectedTarget(\n\t\t\tearly.warnings.length !== 0 ? early.warnings : [noConnectionWarning(id, requestedDomain, connectionId)],\n\t\t);\n\t}\n\tif (!isGitHostIntegration(integration)) {\n\t\treturn rejectedTarget([gitHostOnlySurfaceWarning(id, requestedDomain, connectionId, 'pull request sweeps')]);\n\t}\n\n\tawait ctx.forceRefreshIfRequested(integration, options?.forceSync, connectionId);\n\n\tconst domain = ctx.domainForRead(integration, id, connectionId, requestedDomain);\n\tconst accountWide = repos.length === 0;\n\tconst requestedFilters = target.filters ?? options?.filters;\n\tconst resolved = accountWide\n\t\t? resolveAccountWidePullRequestFilters(id, requestedFilters)\n\t\t: resolvePullRequestFilters(id, requestedFilters);\n\tif (resolved.unsupported) {\n\t\treturn rejectedTarget([\n\t\t\taccountWide\n\t\t\t\t? unsupportedAccountWidePullRequestFiltersWarning(id, domain, connectionId, requestedFilters ?? [])\n\t\t\t\t: unsupportedFiltersWarning(id, domain, connectionId),\n\t\t]);\n\t}\n\n\tconst drain = await drainPullRequests(\n\t\tintegration,\n\t\tid,\n\t\tdomain,\n\t\trepos,\n\t\toptions?.states,\n\t\tresolved.filters,\n\t\toptions,\n\t\tconnectionId,\n\t\tmaxPages,\n\t\tattributeUnavailableProviders,\n\t);\n\tconst viewers = await getPullRequestViewers(integration, connectionId, drain.items);\n\t// Mirrors the projection `drainPullRequests` requests.\n\tconst projection = accountWide ? (options?.includeReviews ? 'account' : 'account-summary') : 'repos';\n\t// Normalize the raw rows to the GitLens-owned shape here, where the per-provider `integration` (the\n\t// mapper's provider reference) is in scope; the aggregation below only sees drains.\n\treturn {\n\t\t...drain,\n\t\titems: drain.items.map((pr, i) =>\n\t\t\ttoPullRequestRow(pr, integration, { currentAccount: viewers[i], projection: projection }),\n\t\t),\n\t\tproviderId: id,\n\t};\n}\n\n/**\n * How a target ended, as the consumer buckets it. `failedProvider` outranks `fetchFailed` because a target\n * whose provider failed produced no slice to be partial about, and `undefined` is the target that resolved to\n * no reachable connection at all.\n */\nfunction sliceOutcome(slice: SweepSlice | undefined): ProviderSweepTargetEvent['outcome'] {\n\tif (slice == null) return 'skipped';\n\tif (slice.failedProvider) return 'failed-provider';\n\tif (slice.fetchFailed) return 'fetch-failed';\n\treturn 'ok';\n}\n\n/**\n * Per-target reporting for a sweep's `onTargetSettled`, opened once per sweep: this stamps the fan-out start,\n * the returned function stamps one target's start, and the function IT returns is the only thing that can\n * report that target. The timestamps therefore never cross a boundary, so there is no pair of interchangeable\n * numbers for a call site to transpose, and the whole reporting concern is one value the fan-out either has or\n * does not. That is also what keeps the option free when it is omitted: with no observer there is nothing to\n * open, so no clock is read and no reporting object exists — do not \"simplify\" that into an unconditional\n * open, because a host whose perf gate is off (the default) is entitled to pay nothing for it.\n *\n * The try/catch is what makes the observer observation-only: called from the fan-out's success path, a throwing\n * callback would otherwise propagate out of the `mapBounded` task and reject the entire sweep — corrupting the\n * read, not just the metric. Swallowed silently; the consumer owns its own aggregation. The `void`-typed\n * callback also admits an `async` consumer, whose rejection is created only after `observe` returns — the\n * `Promise.resolve(...).catch` swallows that too, so it cannot escape as an unhandled rejection.\n *\n * The domain is resolved here rather than carried out of {@link sweepTarget}, so every target reports it by the\n * same rule no matter how far it got. `resolveDomainForRead` needs no integration instance, which is what makes\n * that possible: a target rejected by the first guard resolves the same host a fully drained one does.\n */\nfunction startSweepReporting(\n\tctx: ProviderReadContext,\n\tobserve: (event: ProviderSweepTargetEvent) => void | PromiseLike<unknown>,\n) {\n\tconst fanOutStartedAt = performance.now();\n\n\treturn function beginTarget(target: ProviderSweepTarget) {\n\t\tconst startedAt = performance.now();\n\n\t\treturn function reportSettled(slice: SweepSlice | undefined) {\n\t\t\ttry {\n\t\t\t\tvoid Promise.resolve(\n\t\t\t\t\tobserve({\n\t\t\t\t\t\tproviderId: target.providerId,\n\t\t\t\t\t\tdomain: ctx.resolveDomainForRead(target.providerId, target.connectionId, target.domain),\n\t\t\t\t\t\tconnectionId: target.connectionId,\n\t\t\t\t\t\tcount: slice?.items.length ?? 0,\n\t\t\t\t\t\tdurationMs: performance.now() - startedAt,\n\t\t\t\t\t\tqueueWaitMs: startedAt - fanOutStartedAt,\n\t\t\t\t\t\toutcome: sliceOutcome(slice),\n\t\t\t\t\t\ttruncated: slice?.truncated ?? false,\n\t\t\t\t\t}),\n\t\t\t\t).catch(() => {});\n\t\t\t} catch {}\n\t\t};\n\t};\n}\n\nexport async function sweepPullRequests(\n\tctx: ProviderReadContext,\n\toptions?: PullRequestSweepOptions,\n): Promise<ProviderSweepResult<PullRequestShape>> {\n\tconst { targets, attributeUnavailableProviders } = resolvePullRequestSweepTargets(options);\n\n\tconst observe = options?.onTargetSettled;\n\tconst beginTarget = observe != null ? startSweepReporting(ctx, observe) : undefined;\n\n\tconst results = await mapBounded(targets, providerFanOutConcurrency, async target => {\n\t\tconst reportSettled = beginTarget?.(target);\n\t\tconst slice = await sweepTarget(ctx, options, target, attributeUnavailableProviders);\n\t\treportSettled?.(slice);\n\t\treturn { target: target, slice: slice };\n\t});\n\n\tconst items: PullRequestShape[] = [];\n\tconst warnings: ProviderWarning[] = [];\n\tconst failedTargets: ProviderSweepTargetRef[] = [];\n\tconst incompleteTargets: ProviderSweepTargetRef[] = [];\n\t// Per provider: attributed (non-skipped) targets, and how many of them failed or came back incomplete.\n\tconst attributed = new Map<IntegrationIds, { total: number; failed: number; incomplete: number }>();\n\tlet fetchFailed = false;\n\tlet truncated = false;\n\tfor (const { target, slice: drain } of results) {\n\t\tif (drain == null) {\n\t\t\tcontinue;\n\t\t}\n\n\t\titems.push(...drain.items);\n\t\tfor (const w of drain.warnings) {\n\t\t\tappendDedupedWarning(warnings, w);\n\t\t}\n\t\tif (drain.fetchFailed) {\n\t\t\tfetchFailed = true;\n\t\t}\n\n\t\tlet counts = attributed.get(drain.providerId);\n\t\tif (counts == null) {\n\t\t\tcounts = { total: 0, failed: 0, incomplete: 0 };\n\t\t\tattributed.set(drain.providerId, counts);\n\t\t}\n\t\tcounts.total++;\n\n\t\tif (drain.failedProvider || drain.fetchFailed || drain.truncated) {\n\t\t\t// The same ref the target's settle event carries, so a consumer can join the two.\n\t\t\tconst ref: ProviderSweepTargetRef = {\n\t\t\t\tproviderId: target.providerId,\n\t\t\t\tconnectionId: target.connectionId,\n\t\t\t\tdomain: ctx.resolveDomainForRead(target.providerId, target.connectionId, target.domain),\n\t\t\t};\n\t\t\tif (drain.failedProvider) {\n\t\t\t\tcounts.failed++;\n\t\t\t\tfailedTargets.push(ref);\n\t\t\t} else {\n\t\t\t\tcounts.incomplete++;\n\t\t\t\tincompleteTargets.push(ref);\n\t\t\t}\n\t\t}\n\t\tif (drain.truncated) {\n\t\t\ttruncated = true;\n\t\t}\n\t}\n\n\t// A provider is failed only when every target of it failed; any lesser trouble leaves it incomplete.\n\tconst failedProviderIds: IntegrationIds[] = [];\n\tconst incompleteProviderIds: IntegrationIds[] = [];\n\tfor (const [providerId, { total, failed, incomplete }] of attributed) {\n\t\tif (failed === total) {\n\t\t\tfailedProviderIds.push(providerId);\n\t\t} else if (failed + incomplete !== 0) {\n\t\t\tincompleteProviderIds.push(providerId);\n\t\t}\n\t}\n\n\treturn {\n\t\titems: items,\n\t\twarnings: warnings,\n\t\t// `allPages` asserts completeness — it must be false when any provider truncated (a single-page\n\t\t// account-wide read that couldn't confirm it drained everything) OR a drain aborted on a read\n\t\t// failure (its slice is incomplete). Either way the sweep did not read every page.\n\t\tpage: {\n\t\t\tcurrentPage: 1,\n\t\t\titemsPerPage: items.length,\n\t\t\tallPages: !truncated && !fetchFailed,\n\t\t\ttruncated: truncated || undefined,\n\t\t},\n\t\t// A sweep drains every page itself and exposes no cursor to resume — so `hasMore` must be false even\n\t\t// when the read was incomplete. Terminal incompleteness is expressed through `page.truncated` +\n\t\t// `allPages: false` + warnings; setting `hasMore: true` here would make a consumer that drains while\n\t\t// `hasMore` re-run the identical sweep forever with no cursor to advance.\n\t\thasMore: false,\n\t\tfetchFailed: fetchFailed || undefined,\n\t\tfailedProviderIds: failedProviderIds,\n\t\tincompleteProviderIds: incompleteProviderIds,\n\t\tfailedTargets: failedTargets,\n\t\tincompleteTargets: incompleteTargets,\n\t};\n}\n\n/**\n * Closed/merged counterpart of {@link sweepPullRequests}, feeding Kepler's Kanban \"done\" column. Applies\n * the native cross-provider state filter (`Closed` + `Merged`) so it works beyond GitHub.\n */\nexport function sweepClosedPullRequests(\n\tctx: ProviderReadContext,\n\toptions?: ClosedPullRequestSweepOptions,\n): Promise<ProviderSweepResult<PullRequestShape>> {\n\treturn sweepPullRequests(ctx, { ...options, states: ['closed', 'merged'] });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsDA,eAAe,YACd,KACA,SACA,QACA,+BACkC;CAClC,MAAM,EAAE,YAAY,IAAI,cAAc,QAAQ,oBAAoB;CAClE,MAAM,QAAQ,OAAO,SAAS,SAAS,SAAS,CAAC;CACjD,MAAM,WAAW,SAAS,YAAY;;CAEtC,MAAM,kBAAkB,cAA6C;EACpE,OAAO,CAAC;EACE;EACV,aAAa;EACb,WAAW;EACX,YAAY;EACZ,gBAAgB;CACjB;CAEA,IAAI,0BAA0B,EAAE,GAC/B,OAAO,eAAe,CAAC,0BAA0B,IAAI,iBAAiB,cAAc,qBAAqB,CAAC,CAAC;CAG5G,MAAM,cAAc,MAAM,IAAI,sBAAsB,IAAI,cAAc,eAAe;CACrF,IAAI,eAAe,MAAM;EAGxB,MAAM,QAAQ,IAAI,8BAA8B,IAAI,cAAc,eAAe;EACjF,IAAI,MAAM,SAAS,WAAW,KAAK,CAAC,+BAA+B,OAAO,KAAA;EAE1E,OAAO,eACN,MAAM,SAAS,WAAW,IAAI,MAAM,WAAW,CAAC,oBAAoB,IAAI,iBAAiB,YAAY,CAAC,CACvG;CACD;CACA,IAAI,CAAC,qBAAqB,WAAW,GACpC,OAAO,eAAe,CAAC,0BAA0B,IAAI,iBAAiB,cAAc,qBAAqB,CAAC,CAAC;CAG5G,MAAM,IAAI,wBAAwB,aAAa,SAAS,WAAW,YAAY;CAE/E,MAAM,SAAS,IAAI,cAAc,aAAa,IAAI,cAAc,eAAe;CAC/E,MAAM,cAAc,MAAM,WAAW;CACrC,MAAM,mBAAmB,OAAO,WAAW,SAAS;CACpD,MAAM,WAAW,cACd,qCAAqC,IAAI,gBAAgB,IACzD,0BAA0B,IAAI,gBAAgB;CACjD,IAAI,SAAS,aACZ,OAAO,eAAe,CACrB,cACG,gDA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Q,iBAAiB,YACzD,IAAI,WAAW,OACd,kBAAkB,KAAK,UAAU;MAC3B,IAAI,SAAS,eAAe,GAClC,sBAAsB,KAAK,UAAU;CAIvC,OAAO;EACC;EACG;EAIV,MAAM;GACL,aAAa;GACb,cAAc,MAAM;GACpB,UAAU,CAAC,aAAa,CAAC;GACzB,WAAW,aAAa,KAAA;EACzB;EAKA,SAAS;EACT,aAAa,eAAe,KAAA;EACT;EACI;EACR;EACI;CACpB;AACD;;;;;AAMA,SAAgB,wBACf,KACA,SACiD;CACjD,OAAO,kBAAkB,KAAK;EAAE,GAAG;EAAS,QAAQ,CAAC,UAAU,QAAQ;CAAE,CAAC;AAC3E"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { IssueSorting } from "../../../git/models/issue.js";
|
|
2
2
|
import { PullRequestFilter, PullRequestSorting } from "../../../git/models/pullRequest.js";
|
|
3
3
|
import { IntegrationIds } from "../constants.js";
|
|
4
|
-
import { ProviderWarning, ProviderWarningOmissionScope, ProviderWarningSelector } from "../results.js";
|
|
5
4
|
import { IssueFilter } from "../providerFilters.js";
|
|
5
|
+
import { ProviderWarning, ProviderWarningOmissionScope, ProviderWarningSelector } from "../results.js";
|
|
6
6
|
import { ProjectIssuesRecovery } from "../models/issueReads.js";
|
|
7
7
|
import { IssueSearchCriteriaRejection, PullRequestSearchCriteriaRejection } from "./filters.js";
|
|
8
8
|
import { UnmergeableIssueSort, UnsupportedIssueSortRejection } from "./ordering.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { providersMetadata } from "../providers/
|
|
1
|
+
import { providersMetadata } from "../providers/metadata.js";
|
|
2
2
|
//#region ../plus/integrations/src/reads/warnings.ts
|
|
3
3
|
/**
|
|
4
4
|
* The warnings the provider facade raises on its OWN terms, as opposed to the ones derived from a caught
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"warnings.js","names":[],"sources":["../../../../../plus/integrations/src/reads/warnings.ts"],"sourcesContent":["import type { IntegrationIds } from '../constants.js';\nimport type { ProjectIssuesRecovery } from '../models/issueReads.js';\nimport type {\n\tIssueFilter,\n\tIssueSearchCapabilities,\n\tIssueSorting,\n\tPullRequestFilter,\n\tPullRequestSearchCapabilities,\n\tPullRequestSorting,\n} from '../providerFilters.js';\nimport { providersMetadata } from '../providers/models.js';\nimport type {\n\tProviderWarning,\n\tProviderWarningOmissionRecovery,\n\tProviderWarningOmissionScope,\n\tProviderWarningSelector,\n} from '../results.js';\nimport type { IssueSearchCriteriaRejection, PullRequestSearchCriteriaRejection } from './filters.js';\nimport type { UnmergeableIssueSort, UnsupportedIssueSortRejection } from './ordering.js';\n\n/**\n * The warnings the provider facade raises on its OWN terms, as opposed to the ones derived from a caught\n * provider error ({@link toProviderWarning}) or from SDK collection metadata (`collectionMetadata.ts`).\n *\n * These are pure message builders, kept together and out of the service so a read method reads as the decision\n * it makes (\"this surface doesn't apply, refuse it\") rather than as the wording of the refusal, and so the same\n * refusal can't be phrased two ways in two reads.\n */\n\n/**\n * The single builder for a provider-neutral, non-auth `kind: 'other'` warning: a contradictory or malformed\n * request the caller fixes itself, or a read that couldn't confirm completeness. A refusal for a capability the\n * provider lacks goes through {@link unsupportedWarning} instead, so a consumer can tell the two apart without\n * reading `message`. Every `'other'` or `'unsupported'` warning the facade raises on its own terms goes through\n * one of the two (directly, or via a named builder below that pins a recurring message), so the discriminant is\n * assigned in one place. The warnings mapped from SDK collection metadata are the documented exception —\n * `collectionMetadata.ts` builds those from the structured failure/omission it is given.\n *\n * The kinds that carry a programmatic remedy — `auth`, `rate-limit`, `not-found`, `no-connection` — are derived\n * from the caught error's type or built by their own builders ({@link noConnectionWarning},\n * {@link unmatchedSelectorWarning}), never by this one; see `ProviderWarningKind`.\n */\nexport function otherWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\tmessage: string,\n): ProviderWarning {\n\treturn {\n\t\tproviderId: id,\n\t\tdomain: domain,\n\t\tconnectionId: connectionId,\n\t\tmessage: message,\n\t\tkind: 'other',\n\t\tisAuth: false,\n\t};\n}\n\n/**\n * Builds a `kind: 'unsupported'` warning: the provider — or this integration of it — lacks the capability the\n * request asked for: a surface (issues on Bitbucket, pull requests on an issue tracker, a batch read, org/repo\n * discovery, current-account lookup, project-scoped or account-wide issue reads), or a filter, sort, state,\n * search criterion or option combination it cannot express. Retrying the same request never succeeds; a\n * different provider, scope or request may.\n *\n * NOT for malformed or contradictory caller input the caller fixes in the request itself (a duplicate batch key,\n * invalid target numbers, an empty owner, an unusable scope), nor for incompleteness warnings; those are\n * {@link otherWarning}.\n */\nexport function unsupportedWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\tmessage: string,\n): ProviderWarning {\n\treturn {\n\t\tproviderId: id,\n\t\tdomain: domain,\n\t\tconnectionId: connectionId,\n\t\tmessage: message,\n\t\tkind: 'unsupported',\n\t\tisAuth: false,\n\t};\n}\n\n/**\n * Builds a `no-connection` warning for a per-connection read that resolved neither a session nor an error: the\n * requested `connectionId` no longer resolves (deleted, or its authentication is invalid). Consumers use this\n * to tell a truly empty account apart from a broken connection.\n */\nexport function noConnectionWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId?: string,\n): ProviderWarning {\n\treturn {\n\t\tproviderId: id,\n\t\tdomain: domain,\n\t\tconnectionId: connectionId,\n\t\tmessage:\n\t\t\tconnectionId != null\n\t\t\t\t? `Connection '${connectionId}' for '${id}' could not be resolved (deleted or invalid authentication).`\n\t\t\t\t: `No active connection for '${id}' could be resolved.`,\n\t\tkind: 'no-connection',\n\t\tisAuth: false,\n\t};\n}\n\n/**\n * Builds the `not-found` warning for an issue-tracker project read whose `org` or `project` selector matched\n * nothing a complete discovery returned; see {@link ProviderWarning.selector}. A `project` miss under an `org` names\n * the project, since the org matched.\n */\nexport function unmatchedSelectorWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\tselector: ProviderWarningSelector,\n\torg?: string,\n): ProviderWarning {\n\treturn {\n\t\tproviderId: id,\n\t\tdomain: domain,\n\t\tconnectionId: connectionId,\n\t\tmessage:\n\t\t\tselector.kind === 'org'\n\t\t\t\t? `No organization matches '${selector.value}' for '${id}'; it was removed or this connection can no longer see it.`\n\t\t\t\t: selector.kind === 'linearProject'\n\t\t\t\t\t? `No Linear Project matches '${selector.value}' for '${id}'; it was removed or this connection can no longer see it.`\n\t\t\t\t\t: `No project matches '${selector.value}'${org != null ? ` in '${org}'` : ''} for '${id}'; it was removed, renamed or this connection can no longer see it.`,\n\t\tkind: 'not-found',\n\t\tisAuth: false,\n\t\tselector: selector,\n\t};\n}\n\n/** Warning for an issue-tracker provider asked for a surface only a git host serves (repos, PRs, sweeps). */\nexport function gitHostOnlySurfaceWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\tsurface: string,\n): ProviderWarning {\n\treturn unsupportedWarning(\n\t\tid,\n\t\tdomain,\n\t\tconnectionId,\n\t\t`${surface} is not supported by '${id}'; use a git-host integration instead.`,\n\t);\n}\n\n/** Warning for a git host asked for a surface only an issue tracker serves (resource → project issue reads). */\nexport function issueTrackerOnlySurfaceWarning(\n\tid: IntegrationIds,\n\tconnectionId: string | undefined,\n\tsurface: string,\n): ProviderWarning {\n\treturn unsupportedWarning(\n\t\tid,\n\t\tundefined,\n\t\tconnectionId,\n\t\t`${surface} is not supported by '${id}'; use an issue-tracker integration instead.`,\n\t);\n}\n\n/** Why a facade-driven read returned fewer results than requested. */\nexport type IncompleteReadCause = 'interrupted' | 'page-budget' | 'exhausted' | 'scope-too-large';\n\nfunction recoveryForIncompleteReadCause(cause: IncompleteReadCause): ProviderWarningOmissionRecovery {\n\tswitch (cause) {\n\t\tcase 'page-budget':\n\t\t\treturn 'page-budget';\n\t\tcase 'scope-too-large':\n\t\t\treturn 'narrow-scope';\n\t\tcase 'interrupted':\n\t\tcase 'exhausted':\n\t\t\treturn 'none';\n\t\tdefault:\n\t\t\tcause satisfies never;\n\t\t\treturn 'none';\n\t}\n}\n\n/**\n * Builds the warning for a read that returned less than everything, carrying the two facts a consumer cannot\n * recover on its own: did the request succeed, and would anything fetch the rest?\n *\n * Every incompleteness warning the facade raises on its own terms goes through here, so no read can drift\n * into claiming success on a failure or offering a \"load more\" that cannot deliver. The omission it attaches\n * is the same shape `assessCollectionMetadata` derives from SDK metadata, so a consumer never has to care\n * which layer noticed the gap.\n *\n * `scope` names the one project (or repository) the gap is confined to, as an SDK-attributed omission does; without it\n * the warning applies to the whole read, so a consumer acting on `recovery` re-runs the read itself.\n */\nexport function incompleteReadWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\tmessage: string,\n\tcause: IncompleteReadCause,\n\tscope?: ProviderWarningOmissionScope,\n): ProviderWarning {\n\tconst warning = otherWarning(id, domain, connectionId, message);\n\tif (cause === 'interrupted') return warning;\n\n\treturn {\n\t\t...warning,\n\t\tomission: {\n\t\t\tkind: 'pagination-incomplete',\n\t\t\trecovery: recoveryForIncompleteReadCause(cause),\n\t\t\t...(scope != null ? { scope: { ...scope } } : {}),\n\t\t},\n\t};\n}\n\n/**\n * {@link incompleteReadWarning} for one project of a tracker read that stopped short with nothing in its metadata to say\n * why: a drain cut by its page backstop (`narrow-scope`) or otherwise left incomplete (`none`). Confined to `scope`,\n * which names the project the way the provider's own failures do.\n */\nexport function projectCutWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\tproject: string,\n\trecovery: ProjectIssuesRecovery,\n\tscope: ProviderWarningOmissionScope,\n): ProviderWarning {\n\tconst [message, cause]: [string, IncompleteReadCause] =\n\t\trecovery === 'narrow-scope'\n\t\t\t? [\n\t\t\t\t\t`Project '${project}' holds more issues than one read can return; narrow the scope to read the rest.`,\n\t\t\t\t\t'scope-too-large',\n\t\t\t\t]\n\t\t\t: [\n\t\t\t\t\t`Some issues of project '${project}' were omitted; the provider returned an incomplete result.`,\n\t\t\t\t\t'exhausted',\n\t\t\t\t];\n\treturn incompleteReadWarning(id, domain, connectionId, message, cause, scope);\n}\n\n/**\n * The read surfaces {@link truncationWarning} phrases for. `'Account-wide issue search'` names the composite\n * read that spans several provider searches rather than one surface.\n *\n * Deliberately not exported: every caller passes a literal, and publishing it would invite a consumer to switch\n * on a set that exists only to word a message.\n */\ntype TruncatedReadKind =\n\t| 'Pull request'\n\t| 'Issue'\n\t| 'Repository'\n\t| 'Organization'\n\t| 'Project'\n\t| 'Account-wide issue search'\n\t| 'Issue search'\n\t| 'Pull request search';\n\n/** {@link incompleteReadWarning} for a paged or drained read, phrased per surface. */\nexport function truncationWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\treadKind: TruncatedReadKind,\n\t/**\n\t * Deliberately REQUIRED and not defaulted: a default would make one of these the silent fallback at any\n\t * call site that forgot it, and both of the claims it carries — \"the request succeeded\" and \"more can be\n\t * fetched\" — are ones this warning must never make by accident.\n\t */\n\tcause: IncompleteReadCause,\n): ProviderWarning {\n\treturn incompleteReadWarning(id, domain, connectionId, truncationMessage(id, readKind, cause), cause);\n}\n\n/**\n * The part of a drain that paging could not reach, when that drain ALSO stopped at its page budget with a usable\n * cursor — one facet of a composite read reaching the provider's ceiling while a sibling can still page. Reported\n * beside the `page-budget` {@link truncationWarning}, never in place of it: raising the budget returns more of the\n * rest, and nothing returns this part, so each warning speaks only for its own.\n *\n * The message names no mechanism. The fact behind it is `paging.truncated`, which a provider cap sets but so does\n * `hasMore` with no usable cursor (GitHub's `structuralIncompleteness`) and any per-repository truncation on the\n * repo-scoped path, so \"capped by the provider\" would name a cause we cannot confirm.\n */\nexport function cappedBesideBudgetWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\treadKind: TruncatedReadKind,\n): ProviderWarning {\n\treturn incompleteReadWarning(\n\t\tid,\n\t\tdomain,\n\t\tconnectionId,\n\t\t`${readKind} read for '${id}' could not reach part of its results by paging; raising the page budget will not return those.`,\n\t\t'exhausted',\n\t);\n}\n\nfunction truncationMessage(id: IntegrationIds, readKind: TruncatedReadKind, cause: IncompleteReadCause): string {\n\tswitch (cause) {\n\t\tcase 'interrupted':\n\t\t\t// Deliberately does not name a mechanism. This fires both when a page was lost mid-drain and when a\n\t\t\t// drain that latched an earlier scope failure later stopped for its own reasons; \"was interrupted\"\n\t\t\t// would be false in the second. What is true in both is that something failed and results are gone.\n\t\t\treturn `${readKind} read for '${id}' did not complete; some results are missing and the read reported a failure.`;\n\t\tcase 'page-budget':\n\t\t\treturn `${readKind} read for '${id}' stopped at its page budget; more results can be read by raising it.`;\n\t\tcase 'exhausted':\n\t\t\treturn `${readKind} read for '${id}' was truncated and cannot be continued; results may be incomplete.`;\n\t\tcase 'scope-too-large':\n\t\t\t// Says what is true — the scope is larger than a read of it — rather than blaming the provider for a\n\t\t\t// ceiling that is ours, and names the remedy that exists, since no retry or budget has one.\n\t\t\treturn `${readKind} read for '${id}' covers more than one read can return; narrow the scope to read the rest.`;\n\t}\n\t// No `default`: `IncompleteReadCause` is declared in this file, so `noImplicitReturns` already fails the\n\t// build here if a cause is added without its own wording. (`collectionOmissionMessage`'s `satisfies never`\n\t// is not the same case — that union is the SDK's, and can widen under a dependency bump.)\n}\n\n/**\n * The one sentence every \"you asked for a narrowing this provider can't express\" refusal uses.\n *\n * Shared because the three callers below differ only in a noun: the wording is consumer-visible, and three\n * hand-written copies drift three ways — including the `(supported: …)` clause, which exists to avoid emitting an\n * empty parenthetical and has to be the same guard in all of them.\n */\nfunction unsupportedNarrowingMessage(id: IntegrationIds, noun: string, requested: string, supported: string): string {\n\treturn `The requested ${noun} (${requested}) are not supported by '${id}'${supported.length > 0 ? ` (supported: ${supported})` : ''}; skipped to avoid returning a wider result than requested.`;\n}\n\n/** Warning for an account-wide issue read whose requested filters the provider can't express server-side. */\nexport function unsupportedAccountWideIssueFiltersWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\tfilters: IssueFilter[],\n): ProviderWarning {\n\tconst supported = providersMetadata[id]?.supportedAccountWideIssueFilters ?? [];\n\treturn unsupportedWarning(\n\t\tid,\n\t\tdomain,\n\t\tconnectionId,\n\t\tunsupportedNarrowingMessage(id, 'account-wide issue filters', filters.join(', '), supported.join(', ')),\n\t);\n}\n\n/** Warning for an account-wide PR read whose requested relationship union cannot be expressed exactly. */\nexport function unsupportedAccountWidePullRequestFiltersWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\tfilters: PullRequestFilter[],\n): ProviderWarning {\n\tconst supported = providersMetadata[id]?.supportedAccountWidePullRequestFilters ?? [];\n\treturn unsupportedWarning(\n\t\tid,\n\t\tdomain,\n\t\tconnectionId,\n\t\tunsupportedNarrowingMessage(id, 'account-wide pull request filters', filters.join(', '), supported.join(', ')),\n\t);\n}\n\n/** Warning for a repo-scoped PR read whose requested filters the provider supports none of. */\nexport function unsupportedFiltersWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n): ProviderWarning {\n\treturn unsupportedWarning(\n\t\tid,\n\t\tdomain,\n\t\tconnectionId,\n\t\t`The requested pull request filters are not supported by '${id}'; skipped to avoid returning unfiltered results.`,\n\t);\n}\n\n/**\n * The one sentence every `unusable-scope` refusal uses — the five surfaces that validate a search scope (both\n * searches, both count probes, and issue broadening) differ only in the noun and in whether they name a count\n * key, so the reason a scope is unusable is written once. `prefix` is what the count probes put in front of it\n * to name their key.\n *\n * NAMES the offending values, because which failure mode applied is not deducible from the value: a quote makes\n * `git\"kraken` a request for the real and different org `gitkraken`, a space makes `my org` a search of `my`\n * filtered by the text `org`, and a value of only quotes or whitespace leaves no scope at all. The caller is the\n * only layer that knows which scope it meant.\n *\n * Says how to fix it rather than what was stripped: a consumer cannot mirror this rule (unlike free-text\n * sanitizing, whose rules are published for exactly that), so \"pass the scope as the provider names it\" is the\n * actionable half.\n */\nexport function unusableSearchScopeMessage(noun: string, scopes: readonly string[], prefix?: string): string {\n\treturn `${prefix != null ? `${prefix}: ` : ''}The requested ${noun} (${scopes.map(s => JSON.stringify(s)).join(', ')}) cannot be used as given: a scope name cannot contain quotes, or an inner space or control character, which a query would drop or read as a second qualifier — searching a different scope, or none. Pass the scope exactly as the provider names it.`;\n}\n\n/** Warning for a filtered pull-request search the provider cannot run as requested. */\nexport function unsupportedPullRequestSearchCriteriaWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\trejection: PullRequestSearchCriteriaRejection,\n): ProviderWarning {\n\tlet message: string;\n\tswitch (rejection.reason) {\n\t\tcase 'unsupported-search':\n\t\t\tmessage = `Filtered pull request search is not supported by '${id}'; use \\`listPullRequestsPage\\` for its own pull request reads.`;\n\t\t\tbreak;\n\t\tcase 'unsupported-criteria': {\n\t\t\tconst supported = providersMetadata[id]?.supportedPullRequestSearch;\n\t\t\tmessage = unsupportedNarrowingMessage(\n\t\t\t\tid,\n\t\t\t\t'pull request search criteria',\n\t\t\t\trejection.criteria.join(', '),\n\t\t\t\tsupported != null ? describePullRequestSearchCapabilities(supported) : '',\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn unsupportedWarning(id, domain, connectionId, message);\n}\n\nfunction describePullRequestSearchCapabilities(capabilities: PullRequestSearchCapabilities): string {\n\treturn [\n\t\t...(capabilities.relationships.length ? [`relationships:${capabilities.relationships.join('|')}`] : []),\n\t\t...(capabilities.states.length ? [`states:${capabilities.states.join('|')}`] : []),\n\t\t...(capabilities.text ? ['text'] : []),\n\t\t...(capabilities.updatedAfter ? ['updatedAfter'] : []),\n\t\t...(capabilities.createdAfter ? ['createdAfter'] : []),\n\t\t...(capabilities.includeArchived ? ['includeArchived'] : []),\n\t\t...(capabilities.draft ? ['draft'] : []),\n\t\t...(capabilities.repositoryScope ? ['repository scope'] : []),\n\t\t...(capabilities.organizationScope ? ['organization scope'] : []),\n\t\t...(capabilities.sorts.length ? [`sorts:${capabilities.sorts.join('|')}`] : []),\n\t].join(', ');\n}\n\n/**\n * Warning for a filtered issue search whose criteria the provider can't serve — either it has no such search at\n * all, or it can't express what was asked for, or the set contradicts itself.\n *\n * One builder for all three because they are one decision from the caller's side (\"this search can't be run as\n * asked\") and the remedy differs only in what the message says. The rejection shape carries which case it is, so\n * the wording can't drift from the check that produced it (see {@link resolveIssueSearchCriteria}). The kind\n * follows the reason: the first two are `'unsupported'` capabilities; a contradictory set is caller input and\n * stays `'other'`.\n */\nexport function unsupportedIssueSearchCriteriaWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\trejection: IssueSearchCriteriaRejection,\n): ProviderWarning {\n\tlet message: string;\n\tswitch (rejection.reason) {\n\t\tcase 'unsupported-search':\n\t\t\tmessage = `Filtered issue search is not supported by '${id}'; use \\`listIssuesPage\\` for its own issue reads.`;\n\t\t\tbreak;\n\t\tcase 'unsupported-criteria': {\n\t\t\tconst supported = providersMetadata[id]?.supportedIssueSearch;\n\t\t\tmessage = unsupportedNarrowingMessage(\n\t\t\t\tid,\n\t\t\t\t'issue search criteria',\n\t\t\t\trejection.criteria.join(', '),\n\t\t\t\tsupported != null ? describeIssueSearchCapabilities(supported) : '',\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase 'contradictory-relationships':\n\t\t\t// Caller input the caller fixes in the request itself, so `'other'` rather than `'unsupported'`.\n\t\t\treturn otherWarning(\n\t\t\t\tid,\n\t\t\t\tdomain,\n\t\t\t\tconnectionId,\n\t\t\t\t`The relationships \\`any-assignee\\` and \\`unassigned\\` are contradictory — they partition the scope between them, so no issue satisfies both; pass only one.`,\n\t\t\t);\n\t}\n\t// No `default`: the union is declared alongside the validator, so `noImplicitReturns` fails the build here if\n\t// a rejection reason is added without its own wording.\n\n\treturn unsupportedWarning(id, domain, connectionId, message);\n}\n\n/** The criteria a provider CAN express, for the \"supported: …\" half of a refusal message. */\nfunction describeIssueSearchCapabilities(capabilities: IssueSearchCapabilities): string {\n\tconst flags: [name: string, supported: boolean][] = [\n\t\t['text', capabilities.text],\n\t\t['labels', capabilities.labels],\n\t\t['milestone', capabilities.milestone],\n\t\t['updatedAfter', capabilities.updatedAfter],\n\t\t['createdAfter', capabilities.createdAfter],\n\t\t['withoutLinkedPullRequest', capabilities.withoutLinkedPullRequest],\n\t\t['state', capabilities.states],\n\t];\n\treturn [\n\t\t...capabilities.relationships.map(r => `relationships:${r}`),\n\t\t...flags.filter(([, supported]) => supported).map(([name]) => name),\n\t\t...capabilities.sorts.map(s => `sort:${s}`),\n\t].join(', ');\n}\n\n/**\n * Warning for an issue read asked to order by a key its provider can't express server-side.\n *\n * Separate from {@link unsupportedIssueSearchCriteriaWarning} because it serves the reads that take `sort` as an\n * OPTION rather than as a criterion — repo-scoped, account-wide, and issue-tracker — where there is no criteria\n * set to fold it into. The filtered search keeps reporting it as one more `unsupported-criteria` entry, so a\n * caller there still gets a single refusal listing everything at once.\n *\n * Takes the rejection the check produced rather than a re-read supported list: which of the two tables applies is\n * the caller's own branch (`repos` present or not), so reading it back here — or threading it by hand — would be\n * free to disagree with the check that refused.\n */\nexport function unsupportedIssueSortWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\trejection: UnsupportedIssueSortRejection,\n): ProviderWarning {\n\treturn unsupportedWarning(\n\t\tid,\n\t\tdomain,\n\t\tconnectionId,\n\t\tunsupportedNarrowingMessage(id, 'issue sort', rejection.requested, (rejection.supported ?? []).join(', ')),\n\t);\n}\n\n/**\n * Warning for a merged issue read asked to order by a key that no normalized issue carries.\n *\n * The distinction this exists to make is not about the provider: the provider orders by `priority` perfectly well\n * within ONE project. It is about the read, which fans out over several and merges the results here, where the\n * only fields available are the ones {@link IssueShape} models. Serving the concatenated per-scope runs would look\n * ordered without being so, which is why this refuses instead — and why the message says WHY, since the same key\n * against the same provider succeeds on a single-scope read.\n *\n * What a read fans out OVER differs by read, hence the `scope`: repositories, projects, or — where one query is\n * issued per requested relationship and the runs are unioned within a single project (Jira) — the filters\n * themselves. Naming the wrong one would tell a caller to narrow something that isn't what merged.\n */\nexport function unmergeableIssueSortWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\tunmergeable: UnmergeableIssueSort,\n\tscope: 'repositories' | 'projects' | 'filters',\n): ProviderWarning {\n\t// Both forms are spelled out rather than depluralized at runtime: the message needs each, and\n\t// `'repositories'.replace(/s$/, '')` is `'repositorie'`.\n\tconst nouns = {\n\t\trepositories: { many: 'repositories', one: 'repository' },\n\t\tprojects: { many: 'projects', one: 'project' },\n\t\tfilters: { many: 'issue relationships', one: 'relationship' },\n\t}[scope];\n\treturn unsupportedWarning(\n\t\tid,\n\t\tdomain,\n\t\tconnectionId,\n\t\t`Cannot order by '${unmergeable.requested}' across several ${nouns.many}: this read merges their results, and a normalized issue carries no such field to merge on. Read one ${nouns.one} at a time, or order by a date, title, comment or reaction count.`,\n\t);\n}\n\n/**\n * The omission for a filtered issue search that hit the provider's RESULT CEILING: more issues matched than the\n * provider will ever serve for one query, however it is paged.\n *\n * Distinct from {@link truncationWarning} because this is the one incompleteness this read can quantify —\n * `totalCount` is how many matched, `limit` how many are reachable — which is what lets a consumer say \"19.240\n * matched, showing the 1.000 most recently updated\" instead of a bare \"results may be incomplete\". `recovery:\n * 'none'` because the items past the ceiling are UNREACHABLE, not merely unfetched: no budget, no retry, and no\n * cursor would return them. Narrowing the criteria is the only way through, which is a decision for the caller.\n *\n * The message names the ORDER, and has to now that ordering is an option: the reachable window is the top `limit`\n * under that key, so \"the 1.000 most recent\" is a true sentence only while the key is the default one. The same\n * value goes on the omission, so a consumer wording its own sentence doesn't have to remember what it asked for.\n *\n * Returns `undefined` when the provider declares no ceiling, so the caller falls back to the generic wording\n * rather than reporting a limit it invented.\n */\nexport function issueSearchCapResultWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\ttotalCount: number | undefined,\n\tsort: IssueSorting,\n\t/** The provider proved the ceiling was reached without reporting how many matched; see `limitReached`. */\n\tlimitReached?: boolean,\n): ProviderWarning | undefined {\n\treturn searchCapResultWarning(\n\t\tid,\n\t\tdomain,\n\t\tconnectionId,\n\t\t'Issue search',\n\t\tprovidersMetadata[id]?.issueSearchResultLimit,\n\t\ttotalCount,\n\t\tsort,\n\t\tlimitReached,\n\t);\n}\n\n/**\n * The shared body of the two ceiling warnings. Only a ceiling that was actually reached warns: either a reported\n * total above it, or a provider that proved the ceiling was reached but can't count past it — in which case the\n * omission carries the limit and the order but no `totalCount`, since any figure would be invented.\n */\nfunction searchCapResultWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\treadKind: 'Issue search' | 'Pull request search',\n\tlimit: number | undefined,\n\ttotalCount: number | undefined,\n\tsort: IssueSorting | PullRequestSorting,\n\tlimitReached: boolean | undefined,\n): ProviderWarning | undefined {\n\tif (limit == null) return undefined;\n\n\t// Below the ceiling this warning would be a false claim; the caller's truncation had another cause.\n\tconst counted = totalCount != null && totalCount > limit;\n\tif (!counted && limitReached !== true) return undefined;\n\n\tconst [field, direction] = sort.split(':');\n\tconst matched = counted ? `matched ${totalCount} results` : `matched more than ${limit} results`;\n\treturn {\n\t\t...otherWarning(\n\t\t\tid,\n\t\t\tdomain,\n\t\t\tconnectionId,\n\t\t\t`${readKind} ${matched}, but '${id}' serves at most ${limit}, ordered by ${field} ${direction}ending; narrow the search to read the rest.`,\n\t\t),\n\t\tomission: {\n\t\t\tkind: 'provider-limit',\n\t\t\t// The items past the ceiling can't be fetched by anything, so never offer a \"load more\".\n\t\t\trecovery: 'none',\n\t\t\tlimit: limit,\n\t\t\t...(counted ? { totalCount: totalCount } : {}),\n\t\t\tsort: sort,\n\t\t},\n\t};\n}\n\n/** Quantified omission for a pull-request search that exceeded the provider's reachable result window. */\nexport function pullRequestSearchCapResultWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\ttotalCount: number | undefined,\n\tsort: PullRequestSorting,\n\t/** See {@link issueSearchCapResultWarning}. */\n\tlimitReached?: boolean,\n): ProviderWarning | undefined {\n\t// Named order for the same reason as the issue twin: the reachable window is the first `limit` under THIS sort.\n\treturn searchCapResultWarning(\n\t\tid,\n\t\tdomain,\n\t\tconnectionId,\n\t\t'Pull request search',\n\t\tprovidersMetadata[id]?.pullRequestSearchResultLimit,\n\t\ttotalCount,\n\t\tsort,\n\t\tlimitReached,\n\t);\n}\n\n/** Warning for a git host that doesn't expose issues on this surface (e.g. Bitbucket, deprecated in favor of Jira). */\nexport function issuesUnsupportedWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n): ProviderWarning {\n\treturn unsupportedWarning(\n\t\tid,\n\t\tdomain,\n\t\tconnectionId,\n\t\t`Issues are not supported by '${id}'; use a dedicated issue integration (e.g. Jira) instead.`,\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0CA,SAAgB,aACf,IACA,QACA,cACA,SACkB;CAClB,OAAO;EACN,YAAY;EACJ;EACM;EACL;EACT,MAAM;EACN,QAAQ;CACT;AACD;;;;;;;;;;;;AAaA,SAAgB,mBACf,IACA,QACA,cACA,SACkB;CAClB,OAAO;EACN,YAAY;EACJ;EACM;EACL;EACT,MAAM;EACN,QAAQ;CACT;AACD;;;;;;AAOA,SAAgB,oBACf,IACA,QACA,cACkB;CAClB,OAAO;EACN,YAAY;EACJ;EACM;EACd,SACC,gBAAgB,OACb,eAAe,aAAa,SAAS,GAAG,gEACxC,6BAA6B,GAAG;EACpC,MAAM;EACN,QAAQ;CACT;AACD;;;;;;AAOA,SAAgB,yBACf,IACA,QACA,cACA,UACA,KACkB;CAClB,OAAO;EACN,YAAY;EACJ;EACM;EACd,SACC,SAAS,SAAS,QACf,4BAA4B,SAAS,MAAM,SAAS,GAAG,8DACvD,SAAS,SAA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AK,uGAAuG,MAAM,IAAI,kEAC1L;AACD;;;;;;;;;;;;;;;;;;AAmBA,SAAgB,4BACf,IACA,QACA,cACA,YACA,MAEA,cAC8B;CAC9B,OAAO,uBACN,IACA,QACA,cACA,gBACA,kBAAkB,GAAG,EAAE,wBACvB,YACA,MACA,YACD;AACD;;;;;;AAOA,SAAS,uBACR,IACA,QACA,cACA,UACA,OACA,YACA,MACA,cAC8B;CAC9B,IAAI,SAAS,MAAM,OAAO,KAAA;CAG1B,MAAM,UAAU,cAAc,QAAQ,aAAa;CACnD,IAAI,CAAC,WAAW,iBAAiB,MAAM,OAAO,KAAA;CAE9C,MAAM,CAAC,OAAO,aAAa,KAAK,MAAM,GAAG;CAEzC,OAAO;EACN,GAAG,aACF,IACA,QACA,cACA,GAAG,SAAS,GANE,UAAU,WAAW,WAAW,YAAY,qBAAqB,MAAM,UAM9D,SAAS,GAAG,mBAAmB,MAAM,eAAe,MAAM,GAAG,UAAU,4CAC/F;EACA,UAAU;GACT,MAAM;GAEN,UAAU;GACH;GACP,GAAI,UAAU,EAAc,WAAW,IAAI,CAAC;GACtC;EACP;CACD;AACD;;AAGA,SAAgB,kCACf,IACA,QACA,cACA,YACA,MAEA,cAC8B;CAE9B,OAAO,uBACN,IACA,QACA,cACA,uBACA,kBAAkB,GAAG,EAAE,8BACvB,YACA,MACA,YACD;AACD;;AAGA,SAAgB,yBACf,IACA,QACA,cACkB;CAClB,OAAO,mBACN,IACA,QACA,cACA,gCAAgC,GAAG,0DACpC;AACD"}
|
|
1
|
+
{"version":3,"file":"warnings.js","names":[],"sources":["../../../../../plus/integrations/src/reads/warnings.ts"],"sourcesContent":["import type { IntegrationIds } from '../constants.js';\nimport type { ProjectIssuesRecovery } from '../models/issueReads.js';\nimport type {\n\tIssueFilter,\n\tIssueSearchCapabilities,\n\tIssueSorting,\n\tPullRequestFilter,\n\tPullRequestSearchCapabilities,\n\tPullRequestSorting,\n} from '../providerFilters.js';\nimport { providersMetadata } from '../providers/metadata.js';\nimport type {\n\tProviderWarning,\n\tProviderWarningOmissionRecovery,\n\tProviderWarningOmissionScope,\n\tProviderWarningSelector,\n} from '../results.js';\nimport type { IssueSearchCriteriaRejection, PullRequestSearchCriteriaRejection } from './filters.js';\nimport type { UnmergeableIssueSort, UnsupportedIssueSortRejection } from './ordering.js';\n\n/**\n * The warnings the provider facade raises on its OWN terms, as opposed to the ones derived from a caught\n * provider error ({@link toProviderWarning}) or from SDK collection metadata (`collectionMetadata.ts`).\n *\n * These are pure message builders, kept together and out of the service so a read method reads as the decision\n * it makes (\"this surface doesn't apply, refuse it\") rather than as the wording of the refusal, and so the same\n * refusal can't be phrased two ways in two reads.\n */\n\n/**\n * The single builder for a provider-neutral, non-auth `kind: 'other'` warning: a contradictory or malformed\n * request the caller fixes itself, or a read that couldn't confirm completeness. A refusal for a capability the\n * provider lacks goes through {@link unsupportedWarning} instead, so a consumer can tell the two apart without\n * reading `message`. Every `'other'` or `'unsupported'` warning the facade raises on its own terms goes through\n * one of the two (directly, or via a named builder below that pins a recurring message), so the discriminant is\n * assigned in one place. The warnings mapped from SDK collection metadata are the documented exception —\n * `collectionMetadata.ts` builds those from the structured failure/omission it is given.\n *\n * The kinds that carry a programmatic remedy — `auth`, `rate-limit`, `not-found`, `no-connection` — are derived\n * from the caught error's type or built by their own builders ({@link noConnectionWarning},\n * {@link unmatchedSelectorWarning}), never by this one; see `ProviderWarningKind`.\n */\nexport function otherWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\tmessage: string,\n): ProviderWarning {\n\treturn {\n\t\tproviderId: id,\n\t\tdomain: domain,\n\t\tconnectionId: connectionId,\n\t\tmessage: message,\n\t\tkind: 'other',\n\t\tisAuth: false,\n\t};\n}\n\n/**\n * Builds a `kind: 'unsupported'` warning: the provider — or this integration of it — lacks the capability the\n * request asked for: a surface (issues on Bitbucket, pull requests on an issue tracker, a batch read, org/repo\n * discovery, current-account lookup, project-scoped or account-wide issue reads), or a filter, sort, state,\n * search criterion or option combination it cannot express. Retrying the same request never succeeds; a\n * different provider, scope or request may.\n *\n * NOT for malformed or contradictory caller input the caller fixes in the request itself (a duplicate batch key,\n * invalid target numbers, an empty owner, an unusable scope), nor for incompleteness warnings; those are\n * {@link otherWarning}.\n */\nexport function unsupportedWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\tmessage: string,\n): ProviderWarning {\n\treturn {\n\t\tproviderId: id,\n\t\tdomain: domain,\n\t\tconnectionId: connectionId,\n\t\tmessage: message,\n\t\tkind: 'unsupported',\n\t\tisAuth: false,\n\t};\n}\n\n/**\n * Builds a `no-connection` warning for a per-connection read that resolved neither a session nor an error: the\n * requested `connectionId` no longer resolves (deleted, or its authentication is invalid). Consumers use this\n * to tell a truly empty account apart from a broken connection.\n */\nexport function noConnectionWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId?: string,\n): ProviderWarning {\n\treturn {\n\t\tproviderId: id,\n\t\tdomain: domain,\n\t\tconnectionId: connectionId,\n\t\tmessage:\n\t\t\tconnectionId != null\n\t\t\t\t? `Connection '${connectionId}' for '${id}' could not be resolved (deleted or invalid authentication).`\n\t\t\t\t: `No active connection for '${id}' could be resolved.`,\n\t\tkind: 'no-connection',\n\t\tisAuth: false,\n\t};\n}\n\n/**\n * Builds the `not-found` warning for an issue-tracker project read whose `org` or `project` selector matched\n * nothing a complete discovery returned; see {@link ProviderWarning.selector}. A `project` miss under an `org` names\n * the project, since the org matched.\n */\nexport function unmatchedSelectorWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\tselector: ProviderWarningSelector,\n\torg?: string,\n): ProviderWarning {\n\treturn {\n\t\tproviderId: id,\n\t\tdomain: domain,\n\t\tconnectionId: connectionId,\n\t\tmessage:\n\t\t\tselector.kind === 'org'\n\t\t\t\t? `No organization matches '${selector.value}' for '${id}'; it was removed or this connection can no longer see it.`\n\t\t\t\t: selector.kind === 'linearProject'\n\t\t\t\t\t? `No Linear Project matches '${selector.value}' for '${id}'; it was removed or this connection can no longer see it.`\n\t\t\t\t\t: `No project matches '${selector.value}'${org != null ? ` in '${org}'` : ''} for '${id}'; it was removed, renamed or this connection can no longer see it.`,\n\t\tkind: 'not-found',\n\t\tisAuth: false,\n\t\tselector: selector,\n\t};\n}\n\n/** Warning for an issue-tracker provider asked for a surface only a git host serves (repos, PRs, sweeps). */\nexport function gitHostOnlySurfaceWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\tsurface: string,\n): ProviderWarning {\n\treturn unsupportedWarning(\n\t\tid,\n\t\tdomain,\n\t\tconnectionId,\n\t\t`${surface} is not supported by '${id}'; use a git-host integration instead.`,\n\t);\n}\n\n/** Warning for a git host asked for a surface only an issue tracker serves (resource → project issue reads). */\nexport function issueTrackerOnlySurfaceWarning(\n\tid: IntegrationIds,\n\tconnectionId: string | undefined,\n\tsurface: string,\n): ProviderWarning {\n\treturn unsupportedWarning(\n\t\tid,\n\t\tundefined,\n\t\tconnectionId,\n\t\t`${surface} is not supported by '${id}'; use an issue-tracker integration instead.`,\n\t);\n}\n\n/** Why a facade-driven read returned fewer results than requested. */\nexport type IncompleteReadCause = 'interrupted' | 'page-budget' | 'exhausted' | 'scope-too-large';\n\nfunction recoveryForIncompleteReadCause(cause: IncompleteReadCause): ProviderWarningOmissionRecovery {\n\tswitch (cause) {\n\t\tcase 'page-budget':\n\t\t\treturn 'page-budget';\n\t\tcase 'scope-too-large':\n\t\t\treturn 'narrow-scope';\n\t\tcase 'interrupted':\n\t\tcase 'exhausted':\n\t\t\treturn 'none';\n\t\tdefault:\n\t\t\tcause satisfies never;\n\t\t\treturn 'none';\n\t}\n}\n\n/**\n * Builds the warning for a read that returned less than everything, carrying the two facts a consumer cannot\n * recover on its own: did the request succeed, and would anything fetch the rest?\n *\n * Every incompleteness warning the facade raises on its own terms goes through here, so no read can drift\n * into claiming success on a failure or offering a \"load more\" that cannot deliver. The omission it attaches\n * is the same shape `assessCollectionMetadata` derives from SDK metadata, so a consumer never has to care\n * which layer noticed the gap.\n *\n * `scope` names the one project (or repository) the gap is confined to, as an SDK-attributed omission does; without it\n * the warning applies to the whole read, so a consumer acting on `recovery` re-runs the read itself.\n */\nexport function incompleteReadWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\tmessage: string,\n\tcause: IncompleteReadCause,\n\tscope?: ProviderWarningOmissionScope,\n): ProviderWarning {\n\tconst warning = otherWarning(id, domain, connectionId, message);\n\tif (cause === 'interrupted') return warning;\n\n\treturn {\n\t\t...warning,\n\t\tomission: {\n\t\t\tkind: 'pagination-incomplete',\n\t\t\trecovery: recoveryForIncompleteReadCause(cause),\n\t\t\t...(scope != null ? { scope: { ...scope } } : {}),\n\t\t},\n\t};\n}\n\n/**\n * {@link incompleteReadWarning} for one project of a tracker read that stopped short with nothing in its metadata to say\n * why: a drain cut by its page backstop (`narrow-scope`) or otherwise left incomplete (`none`). Confined to `scope`,\n * which names the project the way the provider's own failures do.\n */\nexport function projectCutWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\tproject: string,\n\trecovery: ProjectIssuesRecovery,\n\tscope: ProviderWarningOmissionScope,\n): ProviderWarning {\n\tconst [message, cause]: [string, IncompleteReadCause] =\n\t\trecovery === 'narrow-scope'\n\t\t\t? [\n\t\t\t\t\t`Project '${project}' holds more issues than one read can return; narrow the scope to read the rest.`,\n\t\t\t\t\t'scope-too-large',\n\t\t\t\t]\n\t\t\t: [\n\t\t\t\t\t`Some issues of project '${project}' were omitted; the provider returned an incomplete result.`,\n\t\t\t\t\t'exhausted',\n\t\t\t\t];\n\treturn incompleteReadWarning(id, domain, connectionId, message, cause, scope);\n}\n\n/**\n * The read surfaces {@link truncationWarning} phrases for. `'Account-wide issue search'` names the composite\n * read that spans several provider searches rather than one surface.\n *\n * Deliberately not exported: every caller passes a literal, and publishing it would invite a consumer to switch\n * on a set that exists only to word a message.\n */\ntype TruncatedReadKind =\n\t| 'Pull request'\n\t| 'Issue'\n\t| 'Repository'\n\t| 'Organization'\n\t| 'Project'\n\t| 'Account-wide issue search'\n\t| 'Issue search'\n\t| 'Pull request search';\n\n/** {@link incompleteReadWarning} for a paged or drained read, phrased per surface. */\nexport function truncationWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\treadKind: TruncatedReadKind,\n\t/**\n\t * Deliberately REQUIRED and not defaulted: a default would make one of these the silent fallback at any\n\t * call site that forgot it, and both of the claims it carries — \"the request succeeded\" and \"more can be\n\t * fetched\" — are ones this warning must never make by accident.\n\t */\n\tcause: IncompleteReadCause,\n): ProviderWarning {\n\treturn incompleteReadWarning(id, domain, connectionId, truncationMessage(id, readKind, cause), cause);\n}\n\n/**\n * The part of a drain that paging could not reach, when that drain ALSO stopped at its page budget with a usable\n * cursor — one facet of a composite read reaching the provider's ceiling while a sibling can still page. Reported\n * beside the `page-budget` {@link truncationWarning}, never in place of it: raising the budget returns more of the\n * rest, and nothing returns this part, so each warning speaks only for its own.\n *\n * The message names no mechanism. The fact behind it is `paging.truncated`, which a provider cap sets but so does\n * `hasMore` with no usable cursor (GitHub's `structuralIncompleteness`) and any per-repository truncation on the\n * repo-scoped path, so \"capped by the provider\" would name a cause we cannot confirm.\n */\nexport function cappedBesideBudgetWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\treadKind: TruncatedReadKind,\n): ProviderWarning {\n\treturn incompleteReadWarning(\n\t\tid,\n\t\tdomain,\n\t\tconnectionId,\n\t\t`${readKind} read for '${id}' could not reach part of its results by paging; raising the page budget will not return those.`,\n\t\t'exhausted',\n\t);\n}\n\nfunction truncationMessage(id: IntegrationIds, readKind: TruncatedReadKind, cause: IncompleteReadCause): string {\n\tswitch (cause) {\n\t\tcase 'interrupted':\n\t\t\t// Deliberately does not name a mechanism. This fires both when a page was lost mid-drain and when a\n\t\t\t// drain that latched an earlier scope failure later stopped for its own reasons; \"was interrupted\"\n\t\t\t// would be false in the second. What is true in both is that something failed and results are gone.\n\t\t\treturn `${readKind} read for '${id}' did not complete; some results are missing and the read reported a failure.`;\n\t\tcase 'page-budget':\n\t\t\treturn `${readKind} read for '${id}' stopped at its page budget; more results can be read by raising it.`;\n\t\tcase 'exhausted':\n\t\t\treturn `${readKind} read for '${id}' was truncated and cannot be continued; results may be incomplete.`;\n\t\tcase 'scope-too-large':\n\t\t\t// Says what is true — the scope is larger than a read of it — rather than blaming the provider for a\n\t\t\t// ceiling that is ours, and names the remedy that exists, since no retry or budget has one.\n\t\t\treturn `${readKind} read for '${id}' covers more than one read can return; narrow the scope to read the rest.`;\n\t}\n\t// No `default`: `IncompleteReadCause` is declared in this file, so `noImplicitReturns` already fails the\n\t// build here if a cause is added without its own wording. (`collectionOmissionMessage`'s `satisfies never`\n\t// is not the same case — that union is the SDK's, and can widen under a dependency bump.)\n}\n\n/**\n * The one sentence every \"you asked for a narrowing this provider can't express\" refusal uses.\n *\n * Shared because the three callers below differ only in a noun: the wording is consumer-visible, and three\n * hand-written copies drift three ways — including the `(supported: …)` clause, which exists to avoid emitting an\n * empty parenthetical and has to be the same guard in all of them.\n */\nfunction unsupportedNarrowingMessage(id: IntegrationIds, noun: string, requested: string, supported: string): string {\n\treturn `The requested ${noun} (${requested}) are not supported by '${id}'${supported.length > 0 ? ` (supported: ${supported})` : ''}; skipped to avoid returning a wider result than requested.`;\n}\n\n/** Warning for an account-wide issue read whose requested filters the provider can't express server-side. */\nexport function unsupportedAccountWideIssueFiltersWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\tfilters: IssueFilter[],\n): ProviderWarning {\n\tconst supported = providersMetadata[id]?.supportedAccountWideIssueFilters ?? [];\n\treturn unsupportedWarning(\n\t\tid,\n\t\tdomain,\n\t\tconnectionId,\n\t\tunsupportedNarrowingMessage(id, 'account-wide issue filters', filters.join(', '), supported.join(', ')),\n\t);\n}\n\n/** Warning for an account-wide PR read whose requested relationship union cannot be expressed exactly. */\nexport function unsupportedAccountWidePullRequestFiltersWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\tfilters: PullRequestFilter[],\n): ProviderWarning {\n\tconst supported = providersMetadata[id]?.supportedAccountWidePullRequestFilters ?? [];\n\treturn unsupportedWarning(\n\t\tid,\n\t\tdomain,\n\t\tconnectionId,\n\t\tunsupportedNarrowingMessage(id, 'account-wide pull request filters', filters.join(', '), supported.join(', ')),\n\t);\n}\n\n/** Warning for a repo-scoped PR read whose requested filters the provider supports none of. */\nexport function unsupportedFiltersWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n): ProviderWarning {\n\treturn unsupportedWarning(\n\t\tid,\n\t\tdomain,\n\t\tconnectionId,\n\t\t`The requested pull request filters are not supported by '${id}'; skipped to avoid returning unfiltered results.`,\n\t);\n}\n\n/**\n * The one sentence every `unusable-scope` refusal uses — the five surfaces that validate a search scope (both\n * searches, both count probes, and issue broadening) differ only in the noun and in whether they name a count\n * key, so the reason a scope is unusable is written once. `prefix` is what the count probes put in front of it\n * to name their key.\n *\n * NAMES the offending values, because which failure mode applied is not deducible from the value: a quote makes\n * `git\"kraken` a request for the real and different org `gitkraken`, a space makes `my org` a search of `my`\n * filtered by the text `org`, and a value of only quotes or whitespace leaves no scope at all. The caller is the\n * only layer that knows which scope it meant.\n *\n * Says how to fix it rather than what was stripped: a consumer cannot mirror this rule (unlike free-text\n * sanitizing, whose rules are published for exactly that), so \"pass the scope as the provider names it\" is the\n * actionable half.\n */\nexport function unusableSearchScopeMessage(noun: string, scopes: readonly string[], prefix?: string): string {\n\treturn `${prefix != null ? `${prefix}: ` : ''}The requested ${noun} (${scopes.map(s => JSON.stringify(s)).join(', ')}) cannot be used as given: a scope name cannot contain quotes, or an inner space or control character, which a query would drop or read as a second qualifier — searching a different scope, or none. Pass the scope exactly as the provider names it.`;\n}\n\n/** Warning for a filtered pull-request search the provider cannot run as requested. */\nexport function unsupportedPullRequestSearchCriteriaWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\trejection: PullRequestSearchCriteriaRejection,\n): ProviderWarning {\n\tlet message: string;\n\tswitch (rejection.reason) {\n\t\tcase 'unsupported-search':\n\t\t\tmessage = `Filtered pull request search is not supported by '${id}'; use \\`listPullRequestsPage\\` for its own pull request reads.`;\n\t\t\tbreak;\n\t\tcase 'unsupported-criteria': {\n\t\t\tconst supported = providersMetadata[id]?.supportedPullRequestSearch;\n\t\t\tmessage = unsupportedNarrowingMessage(\n\t\t\t\tid,\n\t\t\t\t'pull request search criteria',\n\t\t\t\trejection.criteria.join(', '),\n\t\t\t\tsupported != null ? describePullRequestSearchCapabilities(supported) : '',\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn unsupportedWarning(id, domain, connectionId, message);\n}\n\nfunction describePullRequestSearchCapabilities(capabilities: PullRequestSearchCapabilities): string {\n\treturn [\n\t\t...(capabilities.relationships.length ? [`relationships:${capabilities.relationships.join('|')}`] : []),\n\t\t...(capabilities.states.length ? [`states:${capabilities.states.join('|')}`] : []),\n\t\t...(capabilities.text ? ['text'] : []),\n\t\t...(capabilities.updatedAfter ? ['updatedAfter'] : []),\n\t\t...(capabilities.createdAfter ? ['createdAfter'] : []),\n\t\t...(capabilities.includeArchived ? ['includeArchived'] : []),\n\t\t...(capabilities.draft ? ['draft'] : []),\n\t\t...(capabilities.repositoryScope ? ['repository scope'] : []),\n\t\t...(capabilities.organizationScope ? ['organization scope'] : []),\n\t\t...(capabilities.sorts.length ? [`sorts:${capabilities.sorts.join('|')}`] : []),\n\t].join(', ');\n}\n\n/**\n * Warning for a filtered issue search whose criteria the provider can't serve — either it has no such search at\n * all, or it can't express what was asked for, or the set contradicts itself.\n *\n * One builder for all three because they are one decision from the caller's side (\"this search can't be run as\n * asked\") and the remedy differs only in what the message says. The rejection shape carries which case it is, so\n * the wording can't drift from the check that produced it (see {@link resolveIssueSearchCriteria}). The kind\n * follows the reason: the first two are `'unsupported'` capabilities; a contradictory set is caller input and\n * stays `'other'`.\n */\nexport function unsupportedIssueSearchCriteriaWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\trejection: IssueSearchCriteriaRejection,\n): ProviderWarning {\n\tlet message: string;\n\tswitch (rejection.reason) {\n\t\tcase 'unsupported-search':\n\t\t\tmessage = `Filtered issue search is not supported by '${id}'; use \\`listIssuesPage\\` for its own issue reads.`;\n\t\t\tbreak;\n\t\tcase 'unsupported-criteria': {\n\t\t\tconst supported = providersMetadata[id]?.supportedIssueSearch;\n\t\t\tmessage = unsupportedNarrowingMessage(\n\t\t\t\tid,\n\t\t\t\t'issue search criteria',\n\t\t\t\trejection.criteria.join(', '),\n\t\t\t\tsupported != null ? describeIssueSearchCapabilities(supported) : '',\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase 'contradictory-relationships':\n\t\t\t// Caller input the caller fixes in the request itself, so `'other'` rather than `'unsupported'`.\n\t\t\treturn otherWarning(\n\t\t\t\tid,\n\t\t\t\tdomain,\n\t\t\t\tconnectionId,\n\t\t\t\t`The relationships \\`any-assignee\\` and \\`unassigned\\` are contradictory — they partition the scope between them, so no issue satisfies both; pass only one.`,\n\t\t\t);\n\t}\n\t// No `default`: the union is declared alongside the validator, so `noImplicitReturns` fails the build here if\n\t// a rejection reason is added without its own wording.\n\n\treturn unsupportedWarning(id, domain, connectionId, message);\n}\n\n/** The criteria a provider CAN express, for the \"supported: …\" half of a refusal message. */\nfunction describeIssueSearchCapabilities(capabilities: IssueSearchCapabilities): string {\n\tconst flags: [name: string, supported: boolean][] = [\n\t\t['text', capabilities.text],\n\t\t['labels', capabilities.labels],\n\t\t['milestone', capabilities.milestone],\n\t\t['updatedAfter', capabilities.updatedAfter],\n\t\t['createdAfter', capabilities.createdAfter],\n\t\t['withoutLinkedPullRequest', capabilities.withoutLinkedPullRequest],\n\t\t['state', capabilities.states],\n\t];\n\treturn [\n\t\t...capabilities.relationships.map(r => `relationships:${r}`),\n\t\t...flags.filter(([, supported]) => supported).map(([name]) => name),\n\t\t...capabilities.sorts.map(s => `sort:${s}`),\n\t].join(', ');\n}\n\n/**\n * Warning for an issue read asked to order by a key its provider can't express server-side.\n *\n * Separate from {@link unsupportedIssueSearchCriteriaWarning} because it serves the reads that take `sort` as an\n * OPTION rather than as a criterion — repo-scoped, account-wide, and issue-tracker — where there is no criteria\n * set to fold it into. The filtered search keeps reporting it as one more `unsupported-criteria` entry, so a\n * caller there still gets a single refusal listing everything at once.\n *\n * Takes the rejection the check produced rather than a re-read supported list: which of the two tables applies is\n * the caller's own branch (`repos` present or not), so reading it back here — or threading it by hand — would be\n * free to disagree with the check that refused.\n */\nexport function unsupportedIssueSortWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\trejection: UnsupportedIssueSortRejection,\n): ProviderWarning {\n\treturn unsupportedWarning(\n\t\tid,\n\t\tdomain,\n\t\tconnectionId,\n\t\tunsupportedNarrowingMessage(id, 'issue sort', rejection.requested, (rejection.supported ?? []).join(', ')),\n\t);\n}\n\n/**\n * Warning for a merged issue read asked to order by a key that no normalized issue carries.\n *\n * The distinction this exists to make is not about the provider: the provider orders by `priority` perfectly well\n * within ONE project. It is about the read, which fans out over several and merges the results here, where the\n * only fields available are the ones {@link IssueShape} models. Serving the concatenated per-scope runs would look\n * ordered without being so, which is why this refuses instead — and why the message says WHY, since the same key\n * against the same provider succeeds on a single-scope read.\n *\n * What a read fans out OVER differs by read, hence the `scope`: repositories, projects, or — where one query is\n * issued per requested relationship and the runs are unioned within a single project (Jira) — the filters\n * themselves. Naming the wrong one would tell a caller to narrow something that isn't what merged.\n */\nexport function unmergeableIssueSortWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\tunmergeable: UnmergeableIssueSort,\n\tscope: 'repositories' | 'projects' | 'filters',\n): ProviderWarning {\n\t// Both forms are spelled out rather than depluralized at runtime: the message needs each, and\n\t// `'repositories'.replace(/s$/, '')` is `'repositorie'`.\n\tconst nouns = {\n\t\trepositories: { many: 'repositories', one: 'repository' },\n\t\tprojects: { many: 'projects', one: 'project' },\n\t\tfilters: { many: 'issue relationships', one: 'relationship' },\n\t}[scope];\n\treturn unsupportedWarning(\n\t\tid,\n\t\tdomain,\n\t\tconnectionId,\n\t\t`Cannot order by '${unmergeable.requested}' across several ${nouns.many}: this read merges their results, and a normalized issue carries no such field to merge on. Read one ${nouns.one} at a time, or order by a date, title, comment or reaction count.`,\n\t);\n}\n\n/**\n * The omission for a filtered issue search that hit the provider's RESULT CEILING: more issues matched than the\n * provider will ever serve for one query, however it is paged.\n *\n * Distinct from {@link truncationWarning} because this is the one incompleteness this read can quantify —\n * `totalCount` is how many matched, `limit` how many are reachable — which is what lets a consumer say \"19.240\n * matched, showing the 1.000 most recently updated\" instead of a bare \"results may be incomplete\". `recovery:\n * 'none'` because the items past the ceiling are UNREACHABLE, not merely unfetched: no budget, no retry, and no\n * cursor would return them. Narrowing the criteria is the only way through, which is a decision for the caller.\n *\n * The message names the ORDER, and has to now that ordering is an option: the reachable window is the top `limit`\n * under that key, so \"the 1.000 most recent\" is a true sentence only while the key is the default one. The same\n * value goes on the omission, so a consumer wording its own sentence doesn't have to remember what it asked for.\n *\n * Returns `undefined` when the provider declares no ceiling, so the caller falls back to the generic wording\n * rather than reporting a limit it invented.\n */\nexport function issueSearchCapResultWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\ttotalCount: number | undefined,\n\tsort: IssueSorting,\n\t/** The provider proved the ceiling was reached without reporting how many matched; see `limitReached`. */\n\tlimitReached?: boolean,\n): ProviderWarning | undefined {\n\treturn searchCapResultWarning(\n\t\tid,\n\t\tdomain,\n\t\tconnectionId,\n\t\t'Issue search',\n\t\tprovidersMetadata[id]?.issueSearchResultLimit,\n\t\ttotalCount,\n\t\tsort,\n\t\tlimitReached,\n\t);\n}\n\n/**\n * The shared body of the two ceiling warnings. Only a ceiling that was actually reached warns: either a reported\n * total above it, or a provider that proved the ceiling was reached but can't count past it — in which case the\n * omission carries the limit and the order but no `totalCount`, since any figure would be invented.\n */\nfunction searchCapResultWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\treadKind: 'Issue search' | 'Pull request search',\n\tlimit: number | undefined,\n\ttotalCount: number | undefined,\n\tsort: IssueSorting | PullRequestSorting,\n\tlimitReached: boolean | undefined,\n): ProviderWarning | undefined {\n\tif (limit == null) return undefined;\n\n\t// Below the ceiling this warning would be a false claim; the caller's truncation had another cause.\n\tconst counted = totalCount != null && totalCount > limit;\n\tif (!counted && limitReached !== true) return undefined;\n\n\tconst [field, direction] = sort.split(':');\n\tconst matched = counted ? `matched ${totalCount} results` : `matched more than ${limit} results`;\n\treturn {\n\t\t...otherWarning(\n\t\t\tid,\n\t\t\tdomain,\n\t\t\tconnectionId,\n\t\t\t`${readKind} ${matched}, but '${id}' serves at most ${limit}, ordered by ${field} ${direction}ending; narrow the search to read the rest.`,\n\t\t),\n\t\tomission: {\n\t\t\tkind: 'provider-limit',\n\t\t\t// The items past the ceiling can't be fetched by anything, so never offer a \"load more\".\n\t\t\trecovery: 'none',\n\t\t\tlimit: limit,\n\t\t\t...(counted ? { totalCount: totalCount } : {}),\n\t\t\tsort: sort,\n\t\t},\n\t};\n}\n\n/** Quantified omission for a pull-request search that exceeded the provider's reachable result window. */\nexport function pullRequestSearchCapResultWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n\ttotalCount: number | undefined,\n\tsort: PullRequestSorting,\n\t/** See {@link issueSearchCapResultWarning}. */\n\tlimitReached?: boolean,\n): ProviderWarning | undefined {\n\t// Named order for the same reason as the issue twin: the reachable window is the first `limit` under THIS sort.\n\treturn searchCapResultWarning(\n\t\tid,\n\t\tdomain,\n\t\tconnectionId,\n\t\t'Pull request search',\n\t\tprovidersMetadata[id]?.pullRequestSearchResultLimit,\n\t\ttotalCount,\n\t\tsort,\n\t\tlimitReached,\n\t);\n}\n\n/** Warning for a git host that doesn't expose issues on this surface (e.g. Bitbucket, deprecated in favor of Jira). */\nexport function issuesUnsupportedWarning(\n\tid: IntegrationIds,\n\tdomain: string | undefined,\n\tconnectionId: string | undefined,\n): ProviderWarning {\n\treturn unsupportedWarning(\n\t\tid,\n\t\tdomain,\n\t\tconnectionId,\n\t\t`Issues are not supported by '${id}'; use a dedicated issue integration (e.g. Jira) instead.`,\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0CA,SAAgB,aACf,IACA,QACA,cACA,SACkB;CAClB,OAAO;EACN,YAAY;EACJ;EACM;EACL;EACT,MAAM;EACN,QAAQ;CACT;AACD;;;;;;;;;;;;AAaA,SAAgB,mBACf,IACA,QACA,cACA,SACkB;CAClB,OAAO;EACN,YAAY;EACJ;EACM;EACL;EACT,MAAM;EACN,QAAQ;CACT;AACD;;;;;;AAOA,SAAgB,oBACf,IACA,QACA,cACkB;CAClB,OAAO;EACN,YAAY;EACJ;EACM;EACd,SACC,gBAAgB,OACb,eAAe,aAAa,SAAS,GAAG,gEACxC,6BAA6B,GAAG;EACpC,MAAM;EACN,QAAQ;CACT;AACD;;;;;;AAOA,SAAgB,yBACf,IACA,QACA,cACA,UACA,KACkB;CAClB,OAAO;EACN,YAAY;EACJ;EACM;EACd,SACC,SAAS,SAAS,QACf,4BAA4B,SAAS,MAAM,SAAS,GAAG,8DACvD,SAAS,SAAS,kBACjB,8BAA8B,SAAS,MAAM,SAAS,GAAG,8DACzD,uBAAuB,SAAS,MAAM,GAAG,OAAO,OAAO,QAAQ,IAAI,KAAK,GAAG,QAAQ,GAAG;EAC3F,MAAM;EACN,QAAQ;EACE;CACX;AACD;;AAGA,SAAgB,0BACf,IACA,QACA,cACA,S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;AAOA,SAAS,uBACR,IACA,QACA,cACA,UACA,OACA,YACA,MACA,cAC8B;CAC9B,IAAI,SAAS,MAAM,OAAO,KAAA;CAG1B,MAAM,UAAU,cAAc,QAAQ,aAAa;CACnD,IAAI,CAAC,WAAW,iBAAiB,MAAM,OAAO,KAAA;CAE9C,MAAM,CAAC,OAAO,aAAa,KAAK,MAAM,GAAG;CAEzC,OAAO;EACN,GAAG,aACF,IACA,QACA,cACA,GAAG,SAAS,GANE,UAAU,WAAW,WAAW,YAAY,qBAAqB,MAAM,UAM9D,SAAS,GAAG,mBAAmB,MAAM,eAAe,MAAM,GAAG,UAAU,4CAC/F;EACA,UAAU;GACT,MAAM;GAEN,UAAU;GACH;GACP,GAAI,UAAU,EAAc,WAAW,IAAI,CAAC;GACtC;EACP;CACD;AACD;;AAGA,SAAgB,kCACf,IACA,QACA,cACA,YACA,MAEA,cAC8B;CAE9B,OAAO,uBACN,IACA,QACA,cACA,uBACA,kBAAkB,GAAG,EAAE,8BACvB,YACA,MACA,YACD;AACD;;AAGA,SAAgB,yBACf,IACA,QACA,cACkB;CAClB,OAAO,mBACN,IACA,QACA,cACA,gCAAgC,GAAG,0DACpC;AACD"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { IssueSorting } from "../../git/models/issue.js";
|
|
2
|
-
import { PullRequestSorting } from "../../git/models/pullRequest.js";
|
|
1
|
+
import { IssueSearchCriteria, IssueShape, IssueSorting } from "../../git/models/issue.js";
|
|
2
|
+
import { PullRequestCheckLog, PullRequestSearchCriteria, PullRequestShape, PullRequestSorting } from "../../git/models/pullRequest.js";
|
|
3
|
+
import { Account } from "../../git/models/author.js";
|
|
4
|
+
import { PullRequestActivityItem } from "../../git/models/pullRequestActivity.js";
|
|
3
5
|
import { IntegrationIds } from "./constants.js";
|
|
6
|
+
import { ProviderRepositoriesInput } from "./manager.js";
|
|
4
7
|
//#region ../plus/integrations/src/results.d.ts
|
|
5
8
|
export interface ConnectionStateChangeEvent {
|
|
6
9
|
key: string;
|
|
@@ -564,5 +567,324 @@ export declare function appendDedupedWarning(into: ProviderWarning[], warning: P
|
|
|
564
567
|
* `existing` when `next` adds nothing to it.
|
|
565
568
|
*/
|
|
566
569
|
export declare function mergeUnreadableItems(existing: ProviderWarningUnreadableItems, next: ProviderWarningUnreadableItems): ProviderWarningUnreadableItems;
|
|
570
|
+
/**
|
|
571
|
+
* One scope to count.
|
|
572
|
+
*
|
|
573
|
+
* `key` is caller-owned and echoed back verbatim, so a batch result needs no positional matching by the consumer.
|
|
574
|
+
* It never reaches the provider query — the aliases in the upstream document are generated — so it can be any
|
|
575
|
+
* string the caller finds meaningful.
|
|
576
|
+
*/
|
|
577
|
+
export interface IssueCountScope {
|
|
578
|
+
key: string;
|
|
579
|
+
/** Repositories to count over. Combines with `org`, exactly as in `searchIssuesPage`. */
|
|
580
|
+
repos?: ProviderRepositoriesInput;
|
|
581
|
+
org?: string;
|
|
582
|
+
/**
|
|
583
|
+
* Same criteria model as `searchIssuesPage`, validated against the same capability table.
|
|
584
|
+
*
|
|
585
|
+
* `criteria.sort` does not affect the count — a total is invariant under ordering — but it is still VALIDATED,
|
|
586
|
+
* and an unsupported key refuses this scope exactly as it would refuse the read. That is the point of the
|
|
587
|
+
* count: it previews the constraints the read will apply, so one that accepted what the read refuses would
|
|
588
|
+
* promise a fetch that can't happen, which is worse than no preview at all.
|
|
589
|
+
*/
|
|
590
|
+
criteria?: IssueSearchCriteria;
|
|
591
|
+
}
|
|
592
|
+
/** The count for one {@link IssueCountScope}, echoed back under the caller's own `key`. */
|
|
593
|
+
export interface IssueCountResult {
|
|
594
|
+
key: string;
|
|
595
|
+
/**
|
|
596
|
+
* Total matches the provider reports. `undefined` when the provider didn't report one for this scope — NEVER
|
|
597
|
+
* zero, which is a real answer. Render the difference: an unreported count means "unknown", and showing it as
|
|
598
|
+
* 0 would tell the user this filter matches nothing.
|
|
599
|
+
*/
|
|
600
|
+
count?: number;
|
|
601
|
+
/**
|
|
602
|
+
* True when `count` exceeds the provider's own result ceiling, so a full read CANNOT return everything no
|
|
603
|
+
* matter how it is paged. This is the signal to warn before starting an expensive fetch.
|
|
604
|
+
*/
|
|
605
|
+
exceedsProviderLimit: boolean;
|
|
606
|
+
/** The ceiling itself, when the provider declares one. */
|
|
607
|
+
providerLimit?: number;
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* One scope to count pull requests over — the PR twin of {@link IssueCountScope}.
|
|
611
|
+
*
|
|
612
|
+
* `key` is caller-owned and echoed back verbatim, never reaching the provider query (the aliases are generated), so
|
|
613
|
+
* it can be any string the caller finds meaningful.
|
|
614
|
+
*/
|
|
615
|
+
export interface PullRequestCountScope {
|
|
616
|
+
key: string;
|
|
617
|
+
/** Repositories to count over. Combines with `org`, exactly as in `searchPullRequestsPage`. */
|
|
618
|
+
repos?: ProviderRepositoriesInput;
|
|
619
|
+
org?: string;
|
|
620
|
+
/**
|
|
621
|
+
* Same criteria model as `searchPullRequestsPage`, validated against the same capability table — so a count
|
|
622
|
+
* refuses exactly what the read would, and never previews a fetch that can't happen.
|
|
623
|
+
*/
|
|
624
|
+
criteria?: PullRequestSearchCriteria;
|
|
625
|
+
}
|
|
626
|
+
/** The count for one {@link PullRequestCountScope}, echoed back under the caller's own `key`. */
|
|
627
|
+
export interface PullRequestCountResult {
|
|
628
|
+
key: string;
|
|
629
|
+
/**
|
|
630
|
+
* Total matches the provider reports. `undefined` when the provider didn't report one for this scope — NEVER
|
|
631
|
+
* zero, which is a real answer.
|
|
632
|
+
*
|
|
633
|
+
* For a multi-state scope, GitHub/GHE report the LARGEST of their per-state counts (the same total
|
|
634
|
+
* `searchPullRequestsPage` surfaces, since each state is its own capped search), not their sum. Bitbucket Data
|
|
635
|
+
* Center has no ceiling to stay under, so it reports the exact union — the number of rows the search returns —
|
|
636
|
+
* and so does Azure DevOps Server, which reads every state in one drain.
|
|
637
|
+
*/
|
|
638
|
+
count?: number;
|
|
639
|
+
/**
|
|
640
|
+
* True when `count` is a FLOOR rather than the total: the provider has no count query (Bitbucket Data Center),
|
|
641
|
+
* so it counts by reading within a budget, and this scope had more than the budget read. Render it as "N+", and
|
|
642
|
+
* treat the scope as at least that expensive. Absent means `count` is exact — the provider's own total, or for a
|
|
643
|
+
* provider that counts by reading, every match it read.
|
|
644
|
+
*/
|
|
645
|
+
lowerBound?: boolean;
|
|
646
|
+
/**
|
|
647
|
+
* True when `count` exceeds the provider's own per-search result ceiling, so a full read CANNOT return
|
|
648
|
+
* everything no matter how it is paged. This is the signal to warn before starting an expensive fetch.
|
|
649
|
+
*/
|
|
650
|
+
exceedsProviderLimit: boolean;
|
|
651
|
+
/** The ceiling itself, when the provider declares one. */
|
|
652
|
+
providerLimit?: number;
|
|
653
|
+
}
|
|
654
|
+
/** One issue to resolve, echoed back under the caller's own `key`. Which form a call takes depends on its provider. */
|
|
655
|
+
export type IssueBatchTarget =
|
|
656
|
+
/**
|
|
657
|
+
* A git host's issue, by repository coordinate. GitHub/GHE, GitLab (and self-managed) and Azure DevOps (and
|
|
658
|
+
* Server); Bitbucket and Bitbucket Data Center have no issues and refuse.
|
|
659
|
+
*/
|
|
660
|
+
{
|
|
661
|
+
key: string;
|
|
662
|
+
/** GitHub owner, GitLab namespace path (may be nested), or Azure DevOps organization (or collection). */
|
|
663
|
+
owner: string;
|
|
664
|
+
/**
|
|
665
|
+
* Repository name. Required, but ignored on Azure DevOps, whose work items belong to the project rather
|
|
666
|
+
* than to a repository; there it only names the project of a project-less Azure DevOps Server path read
|
|
667
|
+
* behind a virtual directory (`{vdir}/{collection}/_git/{repo}` as owner `{vdir}`, project `{collection}`).
|
|
668
|
+
*/
|
|
669
|
+
repo: string;
|
|
670
|
+
/** Issue number, GitLab issue iid, or Azure DevOps work item id. */
|
|
671
|
+
number: number;
|
|
672
|
+
/** Azure DevOps project. Required there, ignored elsewhere. */
|
|
673
|
+
project?: string;
|
|
674
|
+
/** The {@link IssueBatchResult.etag} of the copy the caller holds; see {@link IssueBatchResult}. */
|
|
675
|
+
etag?: string;
|
|
676
|
+
} |
|
|
677
|
+
/**
|
|
678
|
+
* An issue tracker's issue, by its own identifier (e.g. `ABC-123`) within a resource. Jira (Cloud and Data
|
|
679
|
+
* Center) and Linear. For Jira Data Center `resourceId` is the host — the instance's single resource, as
|
|
680
|
+
* `listOrgs` reports it — and `resourceUrl` is not needed, since the browser link is built from the
|
|
681
|
+
* connection's own base URL; Jira Cloud requires it.
|
|
682
|
+
*/
|
|
683
|
+
{
|
|
684
|
+
key: string;
|
|
685
|
+
resourceId: string;
|
|
686
|
+
resourceUrl?: string;
|
|
687
|
+
identifier: string;
|
|
688
|
+
/**
|
|
689
|
+
* The {@link IssueBatchResult.etag} of the copy the caller holds. Checked cheaply on Jira Cloud and Linear;
|
|
690
|
+
* every other tracker accepts it but reads the issue in full.
|
|
691
|
+
*/
|
|
692
|
+
etag?: string;
|
|
693
|
+
};
|
|
694
|
+
/**
|
|
695
|
+
* The answer for one {@link IssueBatchTarget}, in one of four states:
|
|
696
|
+
* - `{ key, issue, etag }` — read in full. Every fully read row carries an `etag`, whether or not the caller sent
|
|
697
|
+
* one, so a caller can seed its etags from the reads it already makes.
|
|
698
|
+
* - `{ key, unchanged: true, etag }` — the cheap check proved the caller's copy current, and nothing else was
|
|
699
|
+
* fetched. Only for a target that sent an `etag`, on a host with a cheap check.
|
|
700
|
+
* - `{ key }` — PROVEN ABSENT.
|
|
701
|
+
* - no row, with `fetchFailed` and a warning — the read could not check. Never treat that as absent.
|
|
702
|
+
*/
|
|
703
|
+
export interface IssueBatchResult {
|
|
704
|
+
key: string;
|
|
705
|
+
/**
|
|
706
|
+
* The resolved issue, or `undefined` when it PROVABLY does not exist (or is not visible to this connection) —
|
|
707
|
+
* or when it is `unchanged`.
|
|
708
|
+
*
|
|
709
|
+
* Absent is an answer here, unlike every paged read on this facade: a target that FAILED — its own request
|
|
710
|
+
* outright, or just its own alias within an otherwise-answering GitHub chunk (e.g. an org enforcing SAML SSO
|
|
711
|
+
* the token isn't authorized for) — is not returned at all and sets `fetchFailed`, so a caller can tell
|
|
712
|
+
* "proven absent" from "unknown" and cache the first without ever caching the second.
|
|
713
|
+
*/
|
|
714
|
+
issue?: IssueShape;
|
|
715
|
+
/**
|
|
716
|
+
* Opaque: compare for equality only, never parse. Computed by core from the issue's change state — its state and
|
|
717
|
+
* update time, plus each input the call's `etagIncludes` listed — and NOT the provider's HTTP ETag. Send it back
|
|
718
|
+
* as the target's `etag`. An etag from another scheme or another `etagIncludes` set simply compares unequal and
|
|
719
|
+
* costs a full read, never a false `unchanged`. A host can add a reaction without moving the update time, so
|
|
720
|
+
* unless `'reactions'` is listed, an `unchanged` copy's `thumbsUpCount` may be stale.
|
|
721
|
+
*/
|
|
722
|
+
etag?: string;
|
|
723
|
+
/** The caller's copy is current (its `etag` matched); `issue` is absent because nothing was read. */
|
|
724
|
+
unchanged?: true;
|
|
725
|
+
}
|
|
726
|
+
/** One pull request to resolve, identified by coordinate and echoed back under the caller's own `key`. */
|
|
727
|
+
export interface PullRequestBatchTarget {
|
|
728
|
+
/** Caller-owned identifier, echoed on the result so no positional matching is needed. Must be unique. */
|
|
729
|
+
key: string;
|
|
730
|
+
/**
|
|
731
|
+
* GitHub owner, GitLab namespace path (may be nested), Bitbucket workspace, Bitbucket Data Center project key, or
|
|
732
|
+
* Azure DevOps organization.
|
|
733
|
+
*/
|
|
734
|
+
owner: string;
|
|
735
|
+
/** Repository name or slug. */
|
|
736
|
+
repo: string;
|
|
737
|
+
/** Pull request number, GitLab merge request iid, or Azure DevOps pull request id. */
|
|
738
|
+
number: number;
|
|
739
|
+
/** Azure DevOps project. Required there, ignored elsewhere. */
|
|
740
|
+
project?: string;
|
|
741
|
+
/**
|
|
742
|
+
* The {@link PullRequestBatchResult.etag} of the copy the caller holds. When the host can check it cheaply and
|
|
743
|
+
* it still matches, the pull request isn't read again and comes back `unchanged`.
|
|
744
|
+
*/
|
|
745
|
+
etag?: string;
|
|
746
|
+
}
|
|
747
|
+
/**
|
|
748
|
+
* The answer for one {@link PullRequestBatchTarget}, in one of four states:
|
|
749
|
+
* - `{ key, pullRequest, etag }` — read in full, whatever its state. Every fully read row carries an `etag`,
|
|
750
|
+
* whether or not the caller sent one, so a caller can seed its etags from the reads it already makes.
|
|
751
|
+
* - `{ key, unchanged: true, etag }` — the cheap check proved the caller's copy current, and nothing else was
|
|
752
|
+
* fetched. Only for a target that sent an `etag`, on a host with a cheap check.
|
|
753
|
+
* - `{ key }` — PROVEN ABSENT: it does not exist, or is not visible to this connection.
|
|
754
|
+
* - no row, with `fetchFailed` and a warning — the read could not check. Never treat that as absent.
|
|
755
|
+
*/
|
|
756
|
+
export interface PullRequestBatchResult {
|
|
757
|
+
key: string;
|
|
758
|
+
/**
|
|
759
|
+
* The resolved pull request, whatever its state, or `undefined` when it PROVABLY does not exist (or is not
|
|
760
|
+
* visible to this connection) — or when it is `unchanged`. A target whose read FAILED is not returned at
|
|
761
|
+
* all and sets `fetchFailed`.
|
|
762
|
+
*/
|
|
763
|
+
pullRequest?: PullRequestShape;
|
|
764
|
+
/**
|
|
765
|
+
* Opaque: compare for equality only, never parse. Computed by core from the pull request's change state — its
|
|
766
|
+
* state, draft flag, update time and head commit (on Azure DevOps, also a revision of the fields it changes without
|
|
767
|
+
* an update time), plus each input the call's `etagIncludes` listed — and NOT the provider's HTTP ETag. Send it
|
|
768
|
+
* back as {@link PullRequestBatchTarget.etag}. An etag from another scheme or another `etagIncludes` set simply
|
|
769
|
+
* compares unequal and costs a full read, never a false `unchanged` — and so does one from a read that selected
|
|
770
|
+
* merge-queue data (see {@link IntegrationManager.getPullRequestsBatch}'s `mergeQueue`), or check runs
|
|
771
|
+
* (`checkRuns`), when the other didn't.
|
|
772
|
+
* Reactions are never an input: a host can add one without moving the update time, so an `unchanged` copy's
|
|
773
|
+
* `thumbsUpCount` may be stale.
|
|
774
|
+
*/
|
|
775
|
+
etag?: string;
|
|
776
|
+
/** The caller's copy is current (its `etag` matched); `pullRequest` is absent because nothing was read. */
|
|
777
|
+
unchanged?: true;
|
|
778
|
+
}
|
|
779
|
+
/** One branch whose pull requests to find, echoed back under the caller's own `key`. */
|
|
780
|
+
export interface PullRequestBranchTarget {
|
|
781
|
+
/** Caller-owned identifier, echoed on the result so no positional matching is needed. Must be unique. */
|
|
782
|
+
key: string;
|
|
783
|
+
/**
|
|
784
|
+
* The repository the pull requests are OPENED AGAINST (their base), as in `PullRequestBatchTarget`: GitHub
|
|
785
|
+
* owner, GitLab namespace path (may be nested), Bitbucket workspace, Bitbucket Data Center project key, or Azure
|
|
786
|
+
* DevOps organization.
|
|
787
|
+
*/
|
|
788
|
+
owner: string;
|
|
789
|
+
/** Repository name or slug. */
|
|
790
|
+
repo: string;
|
|
791
|
+
/** Azure DevOps project. Required there, ignored elsewhere. */
|
|
792
|
+
project?: string;
|
|
793
|
+
/** The head branch's short name, without `refs/heads/`. */
|
|
794
|
+
branch: string;
|
|
795
|
+
/**
|
|
796
|
+
* Owner (GitHub user or org, GitLab namespace, Bitbucket workspace) of the repository the branch lives in, when
|
|
797
|
+
* it's a fork. Omitted, or equal to `owner` (ignoring case), means the branch lives in the base repository itself,
|
|
798
|
+
* so a caller can pass the owner of whichever remote the branch was pushed to. On GitLab this is the whole
|
|
799
|
+
* namespace path, as `owner` is, so a remote's first-slash split can't be passed for either.
|
|
800
|
+
*
|
|
801
|
+
* A different owner is refused on Bitbucket Data Center and Azure DevOps, where a fork can't be found by its
|
|
802
|
+
* owner.
|
|
803
|
+
*/
|
|
804
|
+
headOwner?: string;
|
|
805
|
+
}
|
|
806
|
+
/** The answer for one {@link PullRequestBranchTarget}. */
|
|
807
|
+
export interface PullRequestBranchResult {
|
|
808
|
+
key: string;
|
|
809
|
+
/**
|
|
810
|
+
* Every pull request whose head is this branch, in ANY state — open, closed and merged — most recently updated
|
|
811
|
+
* first, up to a per-target cap. An empty array is a PROVEN "none" unless `truncated` is set. A target whose
|
|
812
|
+
* read failed is not returned at all.
|
|
813
|
+
*/
|
|
814
|
+
pullRequests: PullRequestShape[];
|
|
815
|
+
/**
|
|
816
|
+
* Set when a pull request that wasn't returned could still match: more matched than the cap, or the host held
|
|
817
|
+
* more pull requests of this branch name than it returned and couldn't rule them out. GitHub/GHE rule them out
|
|
818
|
+
* with a second request filtered by head owner, so there it means more than the cap truly match. That request
|
|
819
|
+
* can't see a pull request from a since-deleted fork, so on GitHub/GHE such a pull request outside the first
|
|
820
|
+
* request's page can be missing even when this is not set.
|
|
821
|
+
*/
|
|
822
|
+
truncated?: boolean;
|
|
823
|
+
}
|
|
824
|
+
/** The answer for one SHA of {@link IntegrationManager.getPullRequestsForCommits}'s input. */
|
|
825
|
+
export interface PullRequestForCommitResult {
|
|
826
|
+
/** The SHA as the caller passed it (trimmed), echoed so no positional matching is needed. */
|
|
827
|
+
sha: string;
|
|
828
|
+
/**
|
|
829
|
+
* The pull request the commit belongs to, or `undefined` when the host ANSWERED that it has none (or when the SHA
|
|
830
|
+
* is the working tree's all-zero one, which is never sent): a resolved "none" a caller can cache. A SHA whose read
|
|
831
|
+
* FAILED is not returned at all and sets `fetchFailed`.
|
|
832
|
+
*
|
|
833
|
+
* When a commit belongs to several, the one the single-commit lookup returns, which each host picks its own way —
|
|
834
|
+
* see {@link IntegrationManager.getPullRequestsForCommits}.
|
|
835
|
+
*/
|
|
836
|
+
pullRequest?: PullRequestShape;
|
|
837
|
+
}
|
|
838
|
+
/** One check whose log to read, echoed back under the caller's own `key`. */
|
|
839
|
+
export interface PullRequestCheckLogTarget {
|
|
840
|
+
/** Caller-owned identifier, echoed on the result. Must be unique. */
|
|
841
|
+
key: string;
|
|
842
|
+
owner: string;
|
|
843
|
+
repo: string;
|
|
844
|
+
/** A `PullRequestCheckRun.id` from a batch pull request read, as it came. */
|
|
845
|
+
checkRunId: string;
|
|
846
|
+
}
|
|
847
|
+
/** The answer for one {@link PullRequestCheckLogTarget}: exactly one of `log` and `unavailable` is set. */
|
|
848
|
+
export type PullRequestCheckLogResult = PullRequestCheckLog & {
|
|
849
|
+
readonly key: string;
|
|
850
|
+
};
|
|
851
|
+
/** One pull request whose activity to read, echoed back under the caller's own `key`. */
|
|
852
|
+
export interface PullRequestActivityTarget {
|
|
853
|
+
/** Caller-owned identifier, echoed on the result. Must be unique. */
|
|
854
|
+
key: string;
|
|
855
|
+
owner: string;
|
|
856
|
+
repo: string;
|
|
857
|
+
number: number;
|
|
858
|
+
/** The {@link PullRequestActivityResult.cursor} of this pull request's last read. Omit it, or send `''`, for a first read. */
|
|
859
|
+
cursor?: string;
|
|
860
|
+
}
|
|
861
|
+
/** The answer for one {@link PullRequestActivityTarget}. */
|
|
862
|
+
export interface PullRequestActivityResult {
|
|
863
|
+
key: string;
|
|
864
|
+
/** New activity after the target's cursor, in GitHub's timeline order. A review's inline comments follow the review. */
|
|
865
|
+
items: readonly PullRequestActivityItem[];
|
|
866
|
+
/** Opaque: send it back as the target's `cursor` on the next read. */
|
|
867
|
+
cursor: string;
|
|
868
|
+
/** More items follow this page; read again with `cursor`. */
|
|
869
|
+
hasMore: boolean;
|
|
870
|
+
/** The pull request (or its repository) does not exist or is not visible to this connection. */
|
|
871
|
+
notFound?: true;
|
|
872
|
+
}
|
|
873
|
+
/**
|
|
874
|
+
* "Who am I on this provider / connection" — {@link IntegrationBase.getCurrentAccount}'s own answer, exposed on
|
|
875
|
+
* the manager so a caller can ask for it directly instead of waiting for some other read to warm it as a side
|
|
876
|
+
* effect.
|
|
877
|
+
*/
|
|
878
|
+
export interface CurrentAccountResult {
|
|
879
|
+
/** The signed-in account, when the provider answered. */
|
|
880
|
+
account?: Account;
|
|
881
|
+
warnings: ProviderWarning[];
|
|
882
|
+
/**
|
|
883
|
+
* Set whenever `account` is absent. Unlike a list/batch read, this one has no benign empty answer — "who am
|
|
884
|
+
* I" is either resolved or it couldn't be told, never a legitimately empty result — so `account` is never
|
|
885
|
+
* missing without a warning explaining why.
|
|
886
|
+
*/
|
|
887
|
+
fetchFailed?: boolean;
|
|
888
|
+
}
|
|
567
889
|
//#endregion
|
|
568
890
|
//# sourceMappingURL=results.d.ts.map
|