@gitkraken/core-gitlens 0.41.0 → 0.44.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 +34 -1
- package/dist/git/errors.d.ts +1 -0
- package/dist/git/errors.js +7 -1
- package/dist/git/errors.js.map +1 -1
- package/dist/git/models/issue.d.ts +2 -0
- package/dist/git/models/issue.js.map +1 -1
- package/dist/git/models/issueOrPullRequest.d.ts +4 -0
- package/dist/git/models/pullRequest.d.ts +2 -0
- package/dist/git/models/pullRequest.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/aliasedQuery.d.ts +3 -2
- package/dist/plus/git-github/api/aliasedQuery.js +7 -3
- package/dist/plus/git-github/api/aliasedQuery.js.map +1 -1
- package/dist/plus/git-github/api/github.d.ts +7 -4
- package/dist/plus/git-github/api/github.js +112 -14
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/api/issueWrites.d.ts +5 -1
- package/dist/plus/git-github/api/issueWrites.js +15 -5
- package/dist/plus/git-github/api/issueWrites.js.map +1 -1
- package/dist/plus/git-github/models.js +7 -3
- package/dist/plus/git-github/models.js.map +1 -1
- package/dist/plus/integrations/collectionMetadata.js +2 -1
- package/dist/plus/integrations/collectionMetadata.js.map +1 -1
- package/dist/plus/integrations/context.d.ts +3 -3
- package/dist/plus/integrations/errors.d.ts +4 -0
- package/dist/plus/integrations/errors.js +8 -1
- package/dist/plus/integrations/errors.js.map +1 -1
- package/dist/plus/integrations/index.d.ts +3 -2
- package/dist/plus/integrations/index.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +18 -1
- package/dist/plus/integrations/integrationService.js +19 -0
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/lite.js +11 -1
- package/dist/plus/integrations/lite.js.map +1 -1
- package/dist/plus/integrations/manager.d.ts +93 -0
- package/dist/plus/integrations/models/gitHostIntegration.d.ts +21 -2
- package/dist/plus/integrations/models/gitHostIntegration.js +182 -14
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
- package/dist/plus/integrations/models/integration.d.ts +9 -1
- package/dist/plus/integrations/models/integration.js +43 -3
- package/dist/plus/integrations/models/integration.js.map +1 -1
- package/dist/plus/integrations/providers/apiClients.d.ts +1 -0
- package/dist/plus/integrations/providers/apiClients.js +3 -0
- package/dist/plus/integrations/providers/apiClients.js.map +1 -1
- package/dist/plus/integrations/providers/azure/azure.d.ts +3 -0
- package/dist/plus/integrations/providers/azure/azure.js +130 -33
- package/dist/plus/integrations/providers/azure/azure.js.map +1 -1
- package/dist/plus/integrations/providers/azure/models.js +7 -3
- package/dist/plus/integrations/providers/azure/models.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOps.d.ts +12 -0
- package/dist/plus/integrations/providers/azureDevOps.js +22 -0
- package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket/bitbucket.d.ts +21 -2
- package/dist/plus/integrations/providers/bitbucket/bitbucket.js +77 -32
- package/dist/plus/integrations/providers/bitbucket/bitbucket.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket/models.js +5 -2
- package/dist/plus/integrations/providers/bitbucket/models.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket-server/models.js +3 -1
- package/dist/plus/integrations/providers/bitbucket-server/models.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket-server.d.ts +2 -0
- package/dist/plus/integrations/providers/bitbucket-server.js +11 -3
- package/dist/plus/integrations/providers/bitbucket-server.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket.d.ts +14 -0
- package/dist/plus/integrations/providers/bitbucket.js +30 -2
- package/dist/plus/integrations/providers/bitbucket.js.map +1 -1
- package/dist/plus/integrations/providers/github.d.ts +9 -4
- package/dist/plus/integrations/providers/github.js +12 -1
- package/dist/plus/integrations/providers/github.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.d.ts +19 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.js +128 -23
- package/dist/plus/integrations/providers/gitlab/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/models.js +5 -2
- package/dist/plus/integrations/providers/gitlab/models.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab.d.ts +15 -2
- package/dist/plus/integrations/providers/gitlab.js +34 -4
- package/dist/plus/integrations/providers/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/jiraIssueByKey.js +3 -1
- package/dist/plus/integrations/providers/jiraIssueByKey.js.map +1 -1
- package/dist/plus/integrations/providers/models.js +9 -4
- package/dist/plus/integrations/providers/models.js.map +1 -1
- package/dist/plus/integrations/providers/providerApiClient.js +10 -7
- package/dist/plus/integrations/providers/providerApiClient.js.map +1 -1
- package/dist/plus/integrations/providers/providerErrors.d.ts +8 -0
- package/dist/plus/integrations/providers/providerErrors.js +15 -2
- package/dist/plus/integrations/providers/providerErrors.js.map +1 -1
- package/dist/plus/integrations/providers/providersApi.js +3 -1
- package/dist/plus/integrations/providers/providersApi.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestsForCommits.d.ts +45 -0
- package/dist/plus/integrations/reads/pullRequestsForCommits.js +97 -0
- package/dist/plus/integrations/reads/pullRequestsForCommits.js.map +1 -0
- package/dist/plus/integrations/utils/domain.utils.d.ts +1 -0
- package/dist/plus/integrations/utils/domain.utils.js +5 -1
- package/dist/plus/integrations/utils/domain.utils.js.map +1 -1
- package/dist/plus/integrations/utils/failureBackoff.d.ts +13 -0
- package/dist/plus/integrations/utils/failureBackoff.js +47 -0
- package/dist/plus/integrations/utils/failureBackoff.js.map +1 -0
- package/dist/utils/env/node/exec.js +2 -2
- package/docs/integrations.md +105 -15
- package/package.json +2 -2
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { PullRequestShape } from "../../../git/models/pullRequest.js";
|
|
2
|
+
import { IntegrationIds } from "../constants.js";
|
|
3
|
+
import { ProviderResult } from "../results.js";
|
|
4
|
+
import { ProviderReadContext } from "./context.js";
|
|
5
|
+
//#region ../plus/integrations/src/reads/pullRequestsForCommits.d.ts
|
|
6
|
+
/** The answer for one SHA of {@link getPullRequestsForCommits}'s input. */
|
|
7
|
+
export interface PullRequestForCommitResult {
|
|
8
|
+
/** The SHA as the caller passed it (trimmed), echoed so no positional matching is needed. */
|
|
9
|
+
sha: string;
|
|
10
|
+
/**
|
|
11
|
+
* The pull request the commit belongs to, or `undefined` when the host ANSWERED that it has none (or when the SHA
|
|
12
|
+
* is the working tree's all-zero one, which is never sent): a resolved "none" a caller can cache. A SHA whose read
|
|
13
|
+
* FAILED is not returned at all and sets `fetchFailed`.
|
|
14
|
+
*
|
|
15
|
+
* When a commit belongs to several, the one the single-commit lookup returns, which each host picks its own way —
|
|
16
|
+
* see {@link IntegrationManager.getPullRequestsForCommits}.
|
|
17
|
+
*/
|
|
18
|
+
pullRequest?: PullRequestShape;
|
|
19
|
+
}
|
|
20
|
+
export declare function getPullRequestsForCommits(ctx: ProviderReadContext, options: {
|
|
21
|
+
providerId: IntegrationIds;
|
|
22
|
+
/**
|
|
23
|
+
* GitHub owner, GitLab namespace path (may be nested), Bitbucket workspace, Bitbucket Data Center project key, or
|
|
24
|
+
* Azure DevOps organization.
|
|
25
|
+
*/
|
|
26
|
+
owner: string;
|
|
27
|
+
/** Repository name or slug. */
|
|
28
|
+
repo: string;
|
|
29
|
+
/** Azure DevOps project. Required there, ignored elsewhere. */
|
|
30
|
+
project?: string;
|
|
31
|
+
/** See {@link IntegrationManager.getPullRequestsForCommits}. Repeats (ignoring case) are resolved once. */
|
|
32
|
+
shas: readonly string[];
|
|
33
|
+
connectionId?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Explicit self-managed host domain. Used only when the requested connection has no configured domain;
|
|
36
|
+
* it must come from the trusted authentication configuration, not repository or remote data.
|
|
37
|
+
*/
|
|
38
|
+
domain?: string;
|
|
39
|
+
/** See {@link IntegrationManager.getPullRequestsForCommits}. */
|
|
40
|
+
mergeQueue?: boolean;
|
|
41
|
+
/** See {@link IntegrationManager.getPullRequestsForCommits}. */
|
|
42
|
+
cancellation?: AbortSignal;
|
|
43
|
+
}): Promise<ProviderResult<PullRequestForCommitResult>>;
|
|
44
|
+
//#endregion
|
|
45
|
+
//# sourceMappingURL=pullRequestsForCommits.d.ts.map
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { CancellationError } from "../../../utils/cancellation.js";
|
|
2
|
+
import { isAzureProviderId } from "../providers/providerErrors.js";
|
|
3
|
+
import { appendDedupedWarning } from "../results.js";
|
|
4
|
+
import { isGitHostIntegration, isIssuesHostIntegrationId } from "../utils/integration.utils.js";
|
|
5
|
+
import { gitHostOnlySurfaceWarning, otherWarning, unsupportedWarning } from "./warnings.js";
|
|
6
|
+
import { runCaptured } from "./drains.js";
|
|
7
|
+
import { appendBatchSlotWarning } from "./batchEtags.js";
|
|
8
|
+
import { trimCoordinateFields, unresolvedIntegration } from "./issueBatch.js";
|
|
9
|
+
//#region ../plus/integrations/src/reads/pullRequestsForCommits.ts
|
|
10
|
+
async function getPullRequestsForCommits(ctx, options) {
|
|
11
|
+
const cancellation = options.cancellation;
|
|
12
|
+
if (cancellation?.aborted) throw new CancellationError();
|
|
13
|
+
const refused = (warning) => ({
|
|
14
|
+
items: [],
|
|
15
|
+
warnings: [warning],
|
|
16
|
+
fetchFailed: true
|
|
17
|
+
});
|
|
18
|
+
const surface = "Pull requests by commit";
|
|
19
|
+
if (isIssuesHostIntegrationId(options.providerId)) return refused(gitHostOnlySurfaceWarning(options.providerId, void 0, options.connectionId, surface));
|
|
20
|
+
if (options.shas.length === 0) return {
|
|
21
|
+
items: [],
|
|
22
|
+
warnings: []
|
|
23
|
+
};
|
|
24
|
+
const repo = trimCoordinateFields({
|
|
25
|
+
owner: options.owner,
|
|
26
|
+
repo: options.repo,
|
|
27
|
+
project: options.project
|
|
28
|
+
});
|
|
29
|
+
const invalid = findInvalidRepository(options.providerId, repo) ?? findInvalidSha(options.shas);
|
|
30
|
+
if (invalid != null) return refused(otherWarning(options.providerId, void 0, options.connectionId, invalid));
|
|
31
|
+
const shas = [];
|
|
32
|
+
const asked = [];
|
|
33
|
+
const seen = /* @__PURE__ */ new Set();
|
|
34
|
+
for (const sha of options.shas) {
|
|
35
|
+
const trimmed = sha.trim();
|
|
36
|
+
const normalized = trimmed.toLowerCase();
|
|
37
|
+
if (seen.has(normalized)) continue;
|
|
38
|
+
seen.add(normalized);
|
|
39
|
+
shas.push(trimmed);
|
|
40
|
+
asked.push(normalized);
|
|
41
|
+
}
|
|
42
|
+
const integration = await ctx.getIntegrationForRead(options.providerId, options.connectionId, options.domain);
|
|
43
|
+
if (cancellation?.aborted) throw new CancellationError();
|
|
44
|
+
if (integration == null) return unresolvedIntegration(ctx, options.providerId, options.connectionId, options.domain);
|
|
45
|
+
if (!isGitHostIntegration(integration)) return refused(gitHostOnlySurfaceWarning(options.providerId, void 0, options.connectionId, surface));
|
|
46
|
+
const domain = ctx.domainForRead(integration, options.providerId, options.connectionId, options.domain);
|
|
47
|
+
const mergeQueue = options.mergeQueue ?? ctx.getPullRequestReadOptions().mergeQueue === true;
|
|
48
|
+
const warnings = [];
|
|
49
|
+
let fetchFailed = false;
|
|
50
|
+
const { value: slots, warning } = await runCaptured(options.providerId, domain, options.connectionId, () => integration.getPullRequestsForCommitsResult(repo, asked, { mergeQueue }, cancellation, options.connectionId), { warnOnMissingSession: true });
|
|
51
|
+
if (cancellation?.aborted) throw new CancellationError();
|
|
52
|
+
if (warning != null) appendDedupedWarning(warnings, {
|
|
53
|
+
...warning,
|
|
54
|
+
targetKeys: shas
|
|
55
|
+
});
|
|
56
|
+
if (slots == null) {
|
|
57
|
+
if (warning == null) appendDedupedWarning(warnings, {
|
|
58
|
+
...unsupportedWarning(options.providerId, domain, options.connectionId, `${surface} is not supported by '${options.providerId}'.`),
|
|
59
|
+
targetKeys: shas
|
|
60
|
+
});
|
|
61
|
+
return {
|
|
62
|
+
items: [],
|
|
63
|
+
warnings,
|
|
64
|
+
fetchFailed: true
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
const items = [];
|
|
68
|
+
for (let i = 0; i < shas.length; i++) {
|
|
69
|
+
const slot = slots[i];
|
|
70
|
+
if (slot.status === "rejected") {
|
|
71
|
+
appendBatchSlotWarning(warnings, options.providerId, domain, options.connectionId, slot, shas[i]);
|
|
72
|
+
fetchFailed = true;
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
items.push({
|
|
76
|
+
sha: shas[i],
|
|
77
|
+
...slot.value != null ? { pullRequest: slot.value } : {}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
items,
|
|
82
|
+
warnings,
|
|
83
|
+
fetchFailed: fetchFailed || void 0
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function findInvalidRepository(providerId, repo) {
|
|
87
|
+
if (repo.owner.length === 0 || repo.repo.length === 0) return `Pull requests by commit requires a non-empty owner and repo.`;
|
|
88
|
+
if (isAzureProviderId(providerId) && !repo.project) return `Pull requests by commit requires a project for '${providerId}'.`;
|
|
89
|
+
}
|
|
90
|
+
const fullShaRegex = /^[0-9a-f]{40}$/i;
|
|
91
|
+
function findInvalidSha(shas) {
|
|
92
|
+
for (const sha of shas) if (!fullShaRegex.test(sha.trim())) return `Pull requests by commit got '${sha}'; pass each commit as its full 40-character SHA.`;
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
export { getPullRequestsForCommits };
|
|
96
|
+
|
|
97
|
+
//# sourceMappingURL=pullRequestsForCommits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pullRequestsForCommits.js","names":[],"sources":["../../../../../plus/integrations/src/reads/pullRequestsForCommits.ts"],"sourcesContent":["import type { PullRequestShape } from '@gitlens/git/models/pullRequest.js';\nimport { CancellationError } from '@gitlens/utils/cancellation.js';\nimport type { IntegrationIds } from '../constants.js';\nimport { isAzureProviderId } from '../providers/providerErrors.js';\nimport type { ProviderResult, ProviderWarning } from '../results.js';\nimport { appendDedupedWarning } from '../results.js';\nimport { isGitHostIntegration, isIssuesHostIntegrationId } from '../utils/integration.utils.js';\nimport { appendBatchSlotWarning } from './batchEtags.js';\nimport type { ProviderReadContext } from './context.js';\nimport { runCaptured } from './drains.js';\nimport { trimCoordinateFields, unresolvedIntegration } from './issueBatch.js';\nimport { gitHostOnlySurfaceWarning, otherWarning, unsupportedWarning } from './warnings.js';\n\n/** The answer for one SHA of {@link getPullRequestsForCommits}'s input. */\nexport interface PullRequestForCommitResult {\n\t/** The SHA as the caller passed it (trimmed), echoed so no positional matching is needed. */\n\tsha: string;\n\t/**\n\t * The pull request the commit belongs to, or `undefined` when the host ANSWERED that it has none (or when the SHA\n\t * is the working tree's all-zero one, which is never sent): a resolved \"none\" a caller can cache. A SHA whose read\n\t * FAILED is not returned at all and sets `fetchFailed`.\n\t *\n\t * When a commit belongs to several, the one the single-commit lookup returns, which each host picks its own way —\n\t * see {@link IntegrationManager.getPullRequestsForCommits}.\n\t */\n\tpullRequest?: PullRequestShape;\n}\n\nexport async function getPullRequestsForCommits(\n\tctx: ProviderReadContext,\n\toptions: {\n\t\tproviderId: IntegrationIds;\n\t\t/**\n\t\t * GitHub owner, GitLab namespace path (may be nested), Bitbucket workspace, Bitbucket Data Center project key, or\n\t\t * Azure DevOps organization.\n\t\t */\n\t\towner: string;\n\t\t/** Repository name or slug. */\n\t\trepo: string;\n\t\t/** Azure DevOps project. Required there, ignored elsewhere. */\n\t\tproject?: string;\n\t\t/** See {@link IntegrationManager.getPullRequestsForCommits}. Repeats (ignoring case) are resolved once. */\n\t\tshas: readonly string[];\n\t\tconnectionId?: string;\n\t\t/**\n\t\t * Explicit self-managed host domain. Used only when the requested connection has no configured domain;\n\t\t * it must come from the trusted authentication configuration, not repository or remote data.\n\t\t */\n\t\tdomain?: string;\n\t\t/** See {@link IntegrationManager.getPullRequestsForCommits}. */\n\t\tmergeQueue?: boolean;\n\t\t/** See {@link IntegrationManager.getPullRequestsForCommits}. */\n\t\tcancellation?: AbortSignal;\n\t},\n): Promise<ProviderResult<PullRequestForCommitResult>> {\n\tconst cancellation = options.cancellation;\n\tif (cancellation?.aborted) throw new CancellationError();\n\n\tconst refused = (warning: ProviderWarning): ProviderResult<PullRequestForCommitResult> => ({\n\t\titems: [],\n\t\twarnings: [warning],\n\t\tfetchFailed: true,\n\t});\n\tconst surface = 'Pull requests by commit';\n\n\tif (isIssuesHostIntegrationId(options.providerId)) {\n\t\treturn refused(gitHostOnlySurfaceWarning(options.providerId, undefined, options.connectionId, surface));\n\t}\n\n\tif (options.shas.length === 0) return { items: [], warnings: [] };\n\n\tconst repo = trimCoordinateFields({ owner: options.owner, repo: options.repo, project: options.project });\n\tconst invalid = findInvalidRepository(options.providerId, repo) ?? findInvalidSha(options.shas);\n\tif (invalid != null) {\n\t\treturn refused(otherWarning(options.providerId, undefined, options.connectionId, invalid));\n\t}\n\n\tconst shas: string[] = [];\n\tconst asked: string[] = [];\n\tconst seen = new Set<string>();\n\tfor (const sha of options.shas) {\n\t\tconst trimmed = sha.trim();\n\t\tconst normalized = trimmed.toLowerCase();\n\t\tif (seen.has(normalized)) continue;\n\n\t\tseen.add(normalized);\n\t\tshas.push(trimmed);\n\t\tasked.push(normalized);\n\t}\n\n\tconst integration = await ctx.getIntegrationForRead(options.providerId, options.connectionId, options.domain);\n\tif (cancellation?.aborted) throw new CancellationError();\n\tif (integration == null) {\n\t\treturn unresolvedIntegration(ctx, options.providerId, options.connectionId, options.domain);\n\t}\n\tif (!isGitHostIntegration(integration)) {\n\t\treturn refused(gitHostOnlySurfaceWarning(options.providerId, undefined, options.connectionId, surface));\n\t}\n\n\tconst domain = ctx.domainForRead(integration, options.providerId, options.connectionId, options.domain);\n\tconst mergeQueue = options.mergeQueue ?? ctx.getPullRequestReadOptions().mergeQueue === true;\n\n\tconst warnings: ProviderWarning[] = [];\n\tlet fetchFailed = false;\n\n\tconst { value: slots, warning } = await runCaptured(\n\t\toptions.providerId,\n\t\tdomain,\n\t\toptions.connectionId,\n\t\t() =>\n\t\t\tintegration.getPullRequestsForCommitsResult(\n\t\t\t\trepo,\n\t\t\t\tasked,\n\t\t\t\t{ mergeQueue: mergeQueue },\n\t\t\t\tcancellation,\n\t\t\t\toptions.connectionId,\n\t\t\t),\n\t\t// KEEP: a missing session must warn on the primary path too, which otherwise reads it as not connected.\n\t\t{ warnOnMissingSession: true },\n\t);\n\tif (cancellation?.aborted) throw new CancellationError();\n\n\tif (warning != null) {\n\t\tappendDedupedWarning(warnings, { ...warning, targetKeys: shas });\n\t}\n\n\tif (slots == null) {\n\t\tif (warning == null) {\n\t\t\tappendDedupedWarning(warnings, {\n\t\t\t\t...unsupportedWarning(\n\t\t\t\t\toptions.providerId,\n\t\t\t\t\tdomain,\n\t\t\t\t\toptions.connectionId,\n\t\t\t\t\t`${surface} is not supported by '${options.providerId}'.`,\n\t\t\t\t),\n\t\t\t\ttargetKeys: shas,\n\t\t\t});\n\t\t}\n\t\treturn { items: [], warnings: warnings, fetchFailed: true };\n\t}\n\n\tconst items: PullRequestForCommitResult[] = [];\n\tfor (let i = 0; i < shas.length; i++) {\n\t\tconst slot = slots[i];\n\t\tif (slot.status === 'rejected') {\n\t\t\tappendBatchSlotWarning(warnings, options.providerId, domain, options.connectionId, slot, shas[i]);\n\t\t\tfetchFailed = true;\n\t\t\tcontinue;\n\t\t}\n\n\t\titems.push({ sha: shas[i], ...(slot.value != null ? { pullRequest: slot.value } : {}) });\n\t}\n\n\treturn { items: items, warnings: warnings, fetchFailed: fetchFailed || undefined };\n}\n\nfunction findInvalidRepository(\n\tproviderId: IntegrationIds,\n\trepo: { owner: string; repo: string; project?: string },\n): string | undefined {\n\tif (repo.owner.length === 0 || repo.repo.length === 0) {\n\t\treturn `Pull requests by commit requires a non-empty owner and repo.`;\n\t}\n\tif (isAzureProviderId(providerId) && !repo.project) {\n\t\treturn `Pull requests by commit requires a project for '${providerId}'.`;\n\t}\n\treturn undefined;\n}\n\nconst fullShaRegex = /^[0-9a-f]{40}$/i;\n\nfunction findInvalidSha(shas: readonly string[]): string | undefined {\n\tfor (const sha of shas) {\n\t\tif (!fullShaRegex.test(sha.trim())) {\n\t\t\treturn `Pull requests by commit got '${sha}'; pass each commit as its full 40-character SHA.`;\n\t\t}\n\t}\n\treturn undefined;\n}\n"],"mappings":";;;;;;;;;AA4BA,eAAsB,0BACrB,KACA,SAwBsD;CACtD,MAAM,eAAe,QAAQ;CAC7B,IAAI,cAAc,SAAS,MAAM,IAAI,kBAAkB;CAEvD,MAAM,WAAW,aAA0E;EAC1F,OAAO,CAAC;EACR,UAAU,CAAC,OAAO;EAClB,aAAa;CACd;CACA,MAAM,UAAU;CAEhB,IAAI,0BAA0B,QAAQ,UAAU,GAC/C,OAAO,QAAQ,0BAA0B,QAAQ,YAAY,KAAA,GAAW,QAAQ,cAAc,OAAO,CAAC;CAGvG,IAAI,QAAQ,KAAK,WAAW,GAAG,OAAO;EAAE,OAAO,CAAC;EAAG,UAAU,CAAC;CAAE;CAEhE,MAAM,OAAO,qBAAqB;EAAE,OAAO,QAAQ;EAAO,MAAM,QAAQ;EAAM,SAAS,QAAQ;CAAQ,CAAC;CACxG,MAAM,UAAU,sBAAsB,QAAQ,YAAY,IAAI,KAAK,eAAe,QAAQ,IAAI;CAC9F,IAAI,WAAW,MACd,OAAO,QAAQ,aAAa,QAAQ,YAAY,KAAA,GAAW,QAAQ,cAAc,OAAO,CAAC;CAG1F,MAAM,OAAiB,CAAC;CACxB,MAAM,QAAkB,CAAC;CACzB,MAAM,uBAAO,IAAI,IAAY;CAC7B,KAAK,MAAM,OAAO,QAAQ,MAAM;EAC/B,MAAM,UAAU,IAAI,KAAK;EACzB,MAAM,aAAa,QAAQ,YAAY;EACvC,IAAI,KAAK,IAAI,UAAU,GAAG;EAE1B,KAAK,IAAI,UAAU;EACnB,KAAK,KAAK,OAAO;EACjB,MAAM,KAAK,UAAU;CACtB;CAEA,MAAM,cAAc,MAAM,IAAI,sBAAsB,QAAQ,YAAY,QAAQ,cAAc,QAAQ,MAAM;CAC5G,IAAI,cAAc,SAAS,MAAM,IAAI,kBAAkB;CACvD,IAAI,eAAe,MAClB,OAAO,sBAAsB,KAAK,QAAQ,YAAY,QAAQ,cAAc,QAAQ,MAAM;CAE3F,IAAI,CAAC,qBAAqB,WAAW,GACpC,OAAO,QAAQ,0BAA0B,QAAQ,YAAY,KAAA,GAAW,QAAQ,cAAc,OAAO,CAAC;CAGvG,MAAM,SAAS,IAAI,cAAc,aAAa,QAAQ,YAAY,QAAQ,cAAc,QAAQ,MAAM;CACtG,MAAM,aAAa,QAAQ,cAAc,IAAI,0BAA0B,CAAC,CAAC,eAAe;CAExF,MAAM,WAA8B,CAAC;CACrC,IAAI,cAAc;CAElB,MAAM,EAAE,OAAO,OAAO,YAAY,MAAM,YACvC,QAAQ,YACR,QACA,QAAQ,oBAEP,YAAY,gCACX,MACA,OACA,EAAc,WAAW,GACzB,cACA,QAAQ,YACT,GAED,EAAE,sBAAsB,KAAK,CAC9B;CACA,IAAI,cAAc,SAAS,MAAM,IAAI,kBAAkB;CAEvD,IAAI,WAAW,MACd,qBAAqB,UAAU;EAAE,GAAG;EAAS,YAAY;CAAK,CAAC;CAGhE,IAAI,SAAS,MAAM;EAClB,IAAI,WAAW,MACd,qBAAqB,UAAU;GAC9B,GAAG,mBACF,QAAQ,YACR,QACA,QAAQ,cACR,GAAG,QAAQ,wBAAwB,QAAQ,WAAW,GACvD;GACA,YAAY;EACb,CAAC;EAEF,OAAO;GAAE,OAAO,CAAC;GAAa;GAAU,aAAa;EAAK;CAC3D;CAEA,MAAM,QAAsC,CAAC;CAC7C,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;EACrC,MAAM,OAAO,MAAM;EACnB,IAAI,KAAK,WAAW,YAAY;GAC/B,uBAAuB,UAAU,QAAQ,YAAY,QAAQ,QAAQ,cAAc,MAAM,KAAK,EAAE;GAChG,cAAc;GACd;EACD;EAEA,MAAM,KAAK;GAAE,KAAK,KAAK;GAAI,GAAI,KAAK,SAAS,OAAO,EAAE,aAAa,KAAK,MAAM,IAAI,CAAC;EAAG,CAAC;CACxF;CAEA,OAAO;EAAS;EAAiB;EAAU,aAAa,eAAe,KAAA;CAAU;AAClF;AAEA,SAAS,sBACR,YACA,MACqB;CACrB,IAAI,KAAK,MAAM,WAAW,KAAK,KAAK,KAAK,WAAW,GACnD,OAAO;CAER,IAAI,kBAAkB,UAAU,KAAK,CAAC,KAAK,SAC1C,OAAO,mDAAmD,WAAW;AAGvE;AAEA,MAAM,eAAe;AAErB,SAAS,eAAe,MAA6C;CACpE,KAAK,MAAM,OAAO,MACjB,IAAI,CAAC,aAAa,KAAK,IAAI,KAAK,CAAC,GAChC,OAAO,gCAAgC,IAAI;AAI9C"}
|
|
@@ -39,6 +39,7 @@ export declare function baseUrlFromDomain(domain: string | undefined, protocol:
|
|
|
39
39
|
* connection gaining or losing one.
|
|
40
40
|
*/
|
|
41
41
|
export declare function sameConfiguredBaseUrl(first: string | undefined, second: string | undefined): boolean;
|
|
42
|
+
export declare function encodePathSegment(value: string): string;
|
|
42
43
|
/** Decodes one percent-encoded URL path segment, keeping a malformed one as written. */
|
|
43
44
|
export declare function decodePathSegment(segment: string): string;
|
|
44
45
|
//#endregion
|
|
@@ -82,6 +82,10 @@ function sameConfiguredBaseUrl(first, second) {
|
|
|
82
82
|
const secondUrl = baseUrlFromDomain(second, void 0);
|
|
83
83
|
return firstUrl != null && secondUrl != null && firstUrl === secondUrl;
|
|
84
84
|
}
|
|
85
|
+
function encodePathSegment(value) {
|
|
86
|
+
if (value === "." || value === "..") throw new Error(`Invalid path segment '${value}'.`);
|
|
87
|
+
return encodeURIComponent(value);
|
|
88
|
+
}
|
|
85
89
|
/** Decodes one percent-encoded URL path segment, keeping a malformed one as written. */
|
|
86
90
|
function decodePathSegment(segment) {
|
|
87
91
|
try {
|
|
@@ -91,6 +95,6 @@ function decodePathSegment(segment) {
|
|
|
91
95
|
}
|
|
92
96
|
}
|
|
93
97
|
//#endregion
|
|
94
|
-
export { areDomainsOnSameHost, areDomainsOnSameHostname, baseUrlFromDomain, decodePathSegment, getRemoteHostMatcher, getSingleConfiguredDomain, hostFromDomain, isWebRemoteScheme, sameConfiguredBaseUrl };
|
|
98
|
+
export { areDomainsOnSameHost, areDomainsOnSameHostname, baseUrlFromDomain, decodePathSegment, encodePathSegment, getRemoteHostMatcher, getSingleConfiguredDomain, hostFromDomain, isWebRemoteScheme, sameConfiguredBaseUrl };
|
|
95
99
|
|
|
96
100
|
//# sourceMappingURL=domain.utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain.utils.js","names":[],"sources":["../../../../../plus/integrations/src/utils/domain.utils.ts"],"sourcesContent":["import { trimTrailingSlashes } from '@gitlens/utils/path.js';\n\n/** Extracts the host from a domain expressed as either a URL or a bare host. */\nexport function hostFromDomain(domain: string | undefined): string | undefined {\n\tconst value = domain?.trim();\n\tif (!value) return undefined;\n\n\tif (/^[a-z][a-z\\d+\\-.]*:\\/\\//i.test(value)) {\n\t\ttry {\n\t\t\treturn new URL(value).host || undefined;\n\t\t} catch {\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\ttry {\n\t\treturn new URL(`https://${value}`).host || undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n/** Multiple accounts on the same host are unambiguous; an unknown configured host is not. */\nexport function getSingleConfiguredDomain(configured: readonly { domain?: string }[]): string | undefined {\n\tconst hosts = new Set(configured.map(connection => hostFromDomain(connection.domain)));\n\treturn hosts.size === 1 ? hosts.values().next().value : undefined;\n}\n\n/** Whether two URL-or-host domain values identify the same normalized host and port. */\nexport function areDomainsOnSameHost(first: string | undefined, second: string | undefined): boolean {\n\tconst firstHost = hostFromDomain(first);\n\tconst secondHost = hostFromDomain(second);\n\treturn firstHost != null && secondHost != null && firstHost === secondHost;\n}\n\n/**\n * Whether two URL-or-host domain values name the same machine, ignoring the port. For comparing an SSH remote\n * against a web address: an SSH port says nothing about the port the host serves its web UI and API on.\n */\nexport function areDomainsOnSameHostname(first: string | undefined, second: string | undefined): boolean {\n\tconst firstHost = hostFromDomain(first);\n\tconst secondHost = hostFromDomain(second);\n\tif (firstHost == null || secondHost == null) return false;\n\n\treturn new URL(`https://${firstHost}`).hostname === new URL(`https://${secondHost}`).hostname;\n}\n\n/** Whether a git remote was addressed over the host's web protocol (`https://`/`http://`) rather than SSH/git. */\nexport function isWebRemoteScheme(scheme: string | undefined): boolean {\n\treturn scheme === 'https://' || scheme === 'http://';\n}\n\n/**\n * The comparison to use when matching a git remote's host against a configured (web) host. A web remote names\n * the very host and port the API is served on, so it must match exactly; an SSH or git remote's port — which\n * `parseGitRemoteUrl` drops anyway — says nothing about the web port, so only the hostname can be compared.\n */\nexport function getRemoteHostMatcher(\n\tscheme: string | undefined,\n): (first: string | undefined, second: string | undefined) => boolean {\n\treturn isWebRemoteScheme(scheme) ? areDomainsOnSameHost : areDomainsOnSameHostname;\n}\n\n/**\n * Builds the API base URL for a self-managed host from a domain expressed as either a URL or a bare host.\n *\n * Distinct from {@link hostFromDomain}, which exists to collapse a domain to the identity the connection is\n * keyed by and therefore DROPS the path. An instance mounted below a context path — Jira Data Center's\n * `/jira`, a reverse-proxied GitLab or Bitbucket — has to be addressed at that path, so the value a request\n * is built from must keep it. Callers pass the session's own domain (the unnormalized one the backend\n * stored) rather than the integration's host-keyed `domain`, and fall back to the latter.\n */\nexport function baseUrlFromDomain(domain: string | undefined, protocol: string | undefined): string | undefined {\n\tconst value = domain?.trim();\n\tif (!value) return undefined;\n\n\tconst scheme = /^[a-z][a-z\\d+\\-.]*:\\/\\//i.test(value) ? undefined : (protocol ?? 'https:');\n\ttry {\n\t\tconst url = new URL(scheme == null ? value : `${scheme}//${value}`);\n\t\treturn `${url.protocol}//${url.host}${trimTrailingSlashes(url.pathname)}`;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n/**\n * Whether two configured addresses point at the same place, comparing them the way a request would.\n *\n * Both sides are run through {@link baseUrlFromDomain} first, so the shapes a domain legitimately arrives in\n * — a bare host, a full URL, a trailing slash — compare equal, while a genuinely different context path does\n * not. Two absent values are the same address (neither names a path); one absent is not, since that is a\n * connection gaining or losing one.\n */\nexport function sameConfiguredBaseUrl(first: string | undefined, second: string | undefined): boolean {\n\tif (!first?.trim() && !second?.trim()) return true;\n\n\tconst firstUrl = baseUrlFromDomain(first, undefined);\n\tconst secondUrl = baseUrlFromDomain(second, undefined);\n\treturn firstUrl != null && secondUrl != null && firstUrl === secondUrl;\n}\n\n/** Decodes one percent-encoded URL path segment, keeping a malformed one as written. */\nexport function decodePathSegment(segment: string): string {\n\ttry {\n\t\treturn decodeURIComponent(segment);\n\t} catch {\n\t\treturn segment;\n\t}\n}\n"],"mappings":";;;AAGA,SAAgB,eAAe,QAAgD;CAC9E,MAAM,QAAQ,QAAQ,KAAK;CAC3B,IAAI,CAAC,OAAO,OAAO,KAAA;CAEnB,IAAI,2BAA2B,KAAK,KAAK,GACxC,IAAI;EACH,OAAO,IAAI,IAAI,KAAK,CAAC,CAAC,QAAQ,KAAA;CAC/B,QAAQ;EACP;CACD;CAGD,IAAI;EACH,OAAO,IAAI,IAAI,WAAW,OAAO,CAAC,CAAC,QAAQ,KAAA;CAC5C,QAAQ;EACP;CACD;AACD;;AAGA,SAAgB,0BAA0B,YAAgE;CACzG,MAAM,QAAQ,IAAI,IAAI,WAAW,KAAI,eAAc,eAAe,WAAW,MAAM,CAAC,CAAC;CACrF,OAAO,MAAM,SAAS,IAAI,MAAM,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,KAAA;AACzD;;AAGA,SAAgB,qBAAqB,OAA2B,QAAqC;CACpG,MAAM,YAAY,eAAe,KAAK;CACtC,MAAM,aAAa,eAAe,MAAM;CACxC,OAAO,aAAa,QAAQ,cAAc,QAAQ,cAAc;AACjE;;;;;AAMA,SAAgB,yBAAyB,OAA2B,QAAqC;CACxG,MAAM,YAAY,eAAe,KAAK;CACtC,MAAM,aAAa,eAAe,MAAM;CACxC,IAAI,aAAa,QAAQ,cAAc,MAAM,OAAO;CAEpD,OAAO,IAAI,IAAI,WAAW,WAAW,CAAC,CAAC,aAAa,IAAI,IAAI,WAAW,YAAY,CAAC,CAAC;AACtF;;AAGA,SAAgB,kBAAkB,QAAqC;CACtE,OAAO,WAAW,cAAc,WAAW;AAC5C;;;;;;AAOA,SAAgB,qBACf,QACqE;CACrE,OAAO,kBAAkB,MAAM,IAAI,uBAAuB;AAC3D;;;;;;;;;;AAWA,SAAgB,kBAAkB,QAA4B,UAAkD;CAC/G,MAAM,QAAQ,QAAQ,KAAK;CAC3B,IAAI,CAAC,OAAO,OAAO,KAAA;CAEnB,MAAM,SAAS,2BAA2B,KAAK,KAAK,IAAI,KAAA,IAAa,YAAY;CACjF,IAAI;EACH,MAAM,MAAM,IAAI,IAAI,UAAU,OAAO,QAAQ,GAAG,OAAO,IAAI,OAAO;EAClE,OAAO,GAAG,IAAI,SAAS,IAAI,IAAI,OAAO,oBAAoB,IAAI,QAAQ;CACvE,QAAQ;EACP;CACD;AACD;;;;;;;;;AAUA,SAAgB,sBAAsB,OAA2B,QAAqC;CACrG,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,QAAQ,KAAK,GAAG,OAAO;CAE9C,MAAM,WAAW,kBAAkB,OAAO,KAAA,CAAS;CACnD,MAAM,YAAY,kBAAkB,QAAQ,KAAA,CAAS;CACrD,OAAO,YAAY,QAAQ,aAAa,QAAQ,aAAa;AAC9D;;AAGA,SAAgB,kBAAkB,SAAyB;CAC1D,IAAI;EACH,OAAO,mBAAmB,OAAO;CAClC,QAAQ;EACP,OAAO;CACR;AACD"}
|
|
1
|
+
{"version":3,"file":"domain.utils.js","names":[],"sources":["../../../../../plus/integrations/src/utils/domain.utils.ts"],"sourcesContent":["import { trimTrailingSlashes } from '@gitlens/utils/path.js';\n\n/** Extracts the host from a domain expressed as either a URL or a bare host. */\nexport function hostFromDomain(domain: string | undefined): string | undefined {\n\tconst value = domain?.trim();\n\tif (!value) return undefined;\n\n\tif (/^[a-z][a-z\\d+\\-.]*:\\/\\//i.test(value)) {\n\t\ttry {\n\t\t\treturn new URL(value).host || undefined;\n\t\t} catch {\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\ttry {\n\t\treturn new URL(`https://${value}`).host || undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n/** Multiple accounts on the same host are unambiguous; an unknown configured host is not. */\nexport function getSingleConfiguredDomain(configured: readonly { domain?: string }[]): string | undefined {\n\tconst hosts = new Set(configured.map(connection => hostFromDomain(connection.domain)));\n\treturn hosts.size === 1 ? hosts.values().next().value : undefined;\n}\n\n/** Whether two URL-or-host domain values identify the same normalized host and port. */\nexport function areDomainsOnSameHost(first: string | undefined, second: string | undefined): boolean {\n\tconst firstHost = hostFromDomain(first);\n\tconst secondHost = hostFromDomain(second);\n\treturn firstHost != null && secondHost != null && firstHost === secondHost;\n}\n\n/**\n * Whether two URL-or-host domain values name the same machine, ignoring the port. For comparing an SSH remote\n * against a web address: an SSH port says nothing about the port the host serves its web UI and API on.\n */\nexport function areDomainsOnSameHostname(first: string | undefined, second: string | undefined): boolean {\n\tconst firstHost = hostFromDomain(first);\n\tconst secondHost = hostFromDomain(second);\n\tif (firstHost == null || secondHost == null) return false;\n\n\treturn new URL(`https://${firstHost}`).hostname === new URL(`https://${secondHost}`).hostname;\n}\n\n/** Whether a git remote was addressed over the host's web protocol (`https://`/`http://`) rather than SSH/git. */\nexport function isWebRemoteScheme(scheme: string | undefined): boolean {\n\treturn scheme === 'https://' || scheme === 'http://';\n}\n\n/**\n * The comparison to use when matching a git remote's host against a configured (web) host. A web remote names\n * the very host and port the API is served on, so it must match exactly; an SSH or git remote's port — which\n * `parseGitRemoteUrl` drops anyway — says nothing about the web port, so only the hostname can be compared.\n */\nexport function getRemoteHostMatcher(\n\tscheme: string | undefined,\n): (first: string | undefined, second: string | undefined) => boolean {\n\treturn isWebRemoteScheme(scheme) ? areDomainsOnSameHost : areDomainsOnSameHostname;\n}\n\n/**\n * Builds the API base URL for a self-managed host from a domain expressed as either a URL or a bare host.\n *\n * Distinct from {@link hostFromDomain}, which exists to collapse a domain to the identity the connection is\n * keyed by and therefore DROPS the path. An instance mounted below a context path — Jira Data Center's\n * `/jira`, a reverse-proxied GitLab or Bitbucket — has to be addressed at that path, so the value a request\n * is built from must keep it. Callers pass the session's own domain (the unnormalized one the backend\n * stored) rather than the integration's host-keyed `domain`, and fall back to the latter.\n */\nexport function baseUrlFromDomain(domain: string | undefined, protocol: string | undefined): string | undefined {\n\tconst value = domain?.trim();\n\tif (!value) return undefined;\n\n\tconst scheme = /^[a-z][a-z\\d+\\-.]*:\\/\\//i.test(value) ? undefined : (protocol ?? 'https:');\n\ttry {\n\t\tconst url = new URL(scheme == null ? value : `${scheme}//${value}`);\n\t\treturn `${url.protocol}//${url.host}${trimTrailingSlashes(url.pathname)}`;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n/**\n * Whether two configured addresses point at the same place, comparing them the way a request would.\n *\n * Both sides are run through {@link baseUrlFromDomain} first, so the shapes a domain legitimately arrives in\n * — a bare host, a full URL, a trailing slash — compare equal, while a genuinely different context path does\n * not. Two absent values are the same address (neither names a path); one absent is not, since that is a\n * connection gaining or losing one.\n */\nexport function sameConfiguredBaseUrl(first: string | undefined, second: string | undefined): boolean {\n\tif (!first?.trim() && !second?.trim()) return true;\n\n\tconst firstUrl = baseUrlFromDomain(first, undefined);\n\tconst secondUrl = baseUrlFromDomain(second, undefined);\n\treturn firstUrl != null && secondUrl != null && firstUrl === secondUrl;\n}\n\nexport function encodePathSegment(value: string): string {\n\tif (value === '.' || value === '..') throw new Error(`Invalid path segment '${value}'.`);\n\n\treturn encodeURIComponent(value);\n}\n\n/** Decodes one percent-encoded URL path segment, keeping a malformed one as written. */\nexport function decodePathSegment(segment: string): string {\n\ttry {\n\t\treturn decodeURIComponent(segment);\n\t} catch {\n\t\treturn segment;\n\t}\n}\n"],"mappings":";;;AAGA,SAAgB,eAAe,QAAgD;CAC9E,MAAM,QAAQ,QAAQ,KAAK;CAC3B,IAAI,CAAC,OAAO,OAAO,KAAA;CAEnB,IAAI,2BAA2B,KAAK,KAAK,GACxC,IAAI;EACH,OAAO,IAAI,IAAI,KAAK,CAAC,CAAC,QAAQ,KAAA;CAC/B,QAAQ;EACP;CACD;CAGD,IAAI;EACH,OAAO,IAAI,IAAI,WAAW,OAAO,CAAC,CAAC,QAAQ,KAAA;CAC5C,QAAQ;EACP;CACD;AACD;;AAGA,SAAgB,0BAA0B,YAAgE;CACzG,MAAM,QAAQ,IAAI,IAAI,WAAW,KAAI,eAAc,eAAe,WAAW,MAAM,CAAC,CAAC;CACrF,OAAO,MAAM,SAAS,IAAI,MAAM,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,KAAA;AACzD;;AAGA,SAAgB,qBAAqB,OAA2B,QAAqC;CACpG,MAAM,YAAY,eAAe,KAAK;CACtC,MAAM,aAAa,eAAe,MAAM;CACxC,OAAO,aAAa,QAAQ,cAAc,QAAQ,cAAc;AACjE;;;;;AAMA,SAAgB,yBAAyB,OAA2B,QAAqC;CACxG,MAAM,YAAY,eAAe,KAAK;CACtC,MAAM,aAAa,eAAe,MAAM;CACxC,IAAI,aAAa,QAAQ,cAAc,MAAM,OAAO;CAEpD,OAAO,IAAI,IAAI,WAAW,WAAW,CAAC,CAAC,aAAa,IAAI,IAAI,WAAW,YAAY,CAAC,CAAC;AACtF;;AAGA,SAAgB,kBAAkB,QAAqC;CACtE,OAAO,WAAW,cAAc,WAAW;AAC5C;;;;;;AAOA,SAAgB,qBACf,QACqE;CACrE,OAAO,kBAAkB,MAAM,IAAI,uBAAuB;AAC3D;;;;;;;;;;AAWA,SAAgB,kBAAkB,QAA4B,UAAkD;CAC/G,MAAM,QAAQ,QAAQ,KAAK;CAC3B,IAAI,CAAC,OAAO,OAAO,KAAA;CAEnB,MAAM,SAAS,2BAA2B,KAAK,KAAK,IAAI,KAAA,IAAa,YAAY;CACjF,IAAI;EACH,MAAM,MAAM,IAAI,IAAI,UAAU,OAAO,QAAQ,GAAG,OAAO,IAAI,OAAO;EAClE,OAAO,GAAG,IAAI,SAAS,IAAI,IAAI,OAAO,oBAAoB,IAAI,QAAQ;CACvE,QAAQ;EACP;CACD;AACD;;;;;;;;;AAUA,SAAgB,sBAAsB,OAA2B,QAAqC;CACrG,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,QAAQ,KAAK,GAAG,OAAO;CAE9C,MAAM,WAAW,kBAAkB,OAAO,KAAA,CAAS;CACnD,MAAM,YAAY,kBAAkB,QAAQ,KAAA,CAAS;CACrD,OAAO,YAAY,QAAQ,aAAa,QAAQ,aAAa;AAC9D;AAEA,SAAgB,kBAAkB,OAAuB;CACxD,IAAI,UAAU,OAAO,UAAU,MAAM,MAAM,IAAI,MAAM,yBAAyB,MAAM,GAAG;CAEvF,OAAO,mBAAmB,KAAK;AAChC;;AAGA,SAAgB,kBAAkB,SAAyB;CAC1D,IAAI;EACH,OAAO,mBAAmB,OAAO;CAClC,QAAQ;EACP,OAAO;CACR;AACD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region ../plus/integrations/src/utils/failureBackoff.d.ts
|
|
2
|
+
export declare const failureBackoffInitialMs: number;
|
|
3
|
+
export declare const failureBackoffMaxMs: number;
|
|
4
|
+
export declare class FailureBackoff {
|
|
5
|
+
private readonly entries;
|
|
6
|
+
backedOffUntil(key: string, now: number): number | undefined;
|
|
7
|
+
isBackedOff(key: string, now: number): boolean;
|
|
8
|
+
fail(key: string, now: number, until?: number): number;
|
|
9
|
+
clear(key: string): void;
|
|
10
|
+
clearAll(): void;
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
//# sourceMappingURL=failureBackoff.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//#region ../plus/integrations/src/utils/failureBackoff.ts
|
|
2
|
+
const failureBackoffInitialMs = 3e4;
|
|
3
|
+
const failureBackoffMaxMs = 6e5;
|
|
4
|
+
const failureBackoffCapacity = 500;
|
|
5
|
+
var FailureBackoff = class {
|
|
6
|
+
entries = /* @__PURE__ */ new Map();
|
|
7
|
+
backedOffUntil(key, now) {
|
|
8
|
+
const entry = this.entries.get(key);
|
|
9
|
+
return entry != null && entry.until > now ? entry.until : void 0;
|
|
10
|
+
}
|
|
11
|
+
isBackedOff(key, now) {
|
|
12
|
+
return this.backedOffUntil(key, now) != null;
|
|
13
|
+
}
|
|
14
|
+
fail(key, now, until) {
|
|
15
|
+
const previous = this.entries.get(key);
|
|
16
|
+
if (previous != null && previous.until > now) {
|
|
17
|
+
if (until != null && until > previous.until) previous.until = until;
|
|
18
|
+
return previous.until;
|
|
19
|
+
}
|
|
20
|
+
const failures = previous != null && !isStale(previous, now) ? previous.failures + 1 : 1;
|
|
21
|
+
const next = until != null && until > now ? until : now + Math.min(failureBackoffInitialMs * 2 ** (failures - 1), failureBackoffMaxMs);
|
|
22
|
+
this.entries.delete(key);
|
|
23
|
+
for (const [k, entry] of this.entries) if (isStale(entry, now)) this.entries.delete(k);
|
|
24
|
+
for (const k of this.entries.keys()) {
|
|
25
|
+
if (this.entries.size < failureBackoffCapacity) break;
|
|
26
|
+
this.entries.delete(k);
|
|
27
|
+
}
|
|
28
|
+
this.entries.set(key, {
|
|
29
|
+
until: next,
|
|
30
|
+
failures
|
|
31
|
+
});
|
|
32
|
+
return next;
|
|
33
|
+
}
|
|
34
|
+
clear(key) {
|
|
35
|
+
this.entries.delete(key);
|
|
36
|
+
}
|
|
37
|
+
clearAll() {
|
|
38
|
+
this.entries.clear();
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
function isStale(entry, now) {
|
|
42
|
+
return entry.until + failureBackoffMaxMs <= now;
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { FailureBackoff, failureBackoffInitialMs, failureBackoffMaxMs };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=failureBackoff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"failureBackoff.js","names":[],"sources":["../../../../../plus/integrations/src/utils/failureBackoff.ts"],"sourcesContent":["export const failureBackoffInitialMs = 30 * 1000;\nexport const failureBackoffMaxMs = 10 * 60 * 1000;\nconst failureBackoffCapacity = 500;\n\nexport class FailureBackoff {\n\tprivate readonly entries = new Map<string, { until: number; failures: number }>();\n\n\tbackedOffUntil(key: string, now: number): number | undefined {\n\t\tconst entry = this.entries.get(key);\n\t\treturn entry != null && entry.until > now ? entry.until : undefined;\n\t}\n\n\tisBackedOff(key: string, now: number): boolean {\n\t\treturn this.backedOffUntil(key, now) != null;\n\t}\n\n\tfail(key: string, now: number, until?: number): number {\n\t\tconst previous = this.entries.get(key);\n\t\tif (previous != null && previous.until > now) {\n\t\t\tif (until != null && until > previous.until) {\n\t\t\t\tprevious.until = until;\n\t\t\t}\n\t\t\treturn previous.until;\n\t\t}\n\n\t\tconst failures = previous != null && !isStale(previous, now) ? previous.failures + 1 : 1;\n\t\tconst next =\n\t\t\tuntil != null && until > now\n\t\t\t\t? until\n\t\t\t\t: now + Math.min(failureBackoffInitialMs * 2 ** (failures - 1), failureBackoffMaxMs);\n\n\t\tthis.entries.delete(key);\n\t\tfor (const [k, entry] of this.entries) {\n\t\t\tif (isStale(entry, now)) {\n\t\t\t\tthis.entries.delete(k);\n\t\t\t}\n\t\t}\n\t\tfor (const k of this.entries.keys()) {\n\t\t\tif (this.entries.size < failureBackoffCapacity) break;\n\n\t\t\tthis.entries.delete(k);\n\t\t}\n\n\t\tthis.entries.set(key, { until: next, failures: failures });\n\t\treturn next;\n\t}\n\n\tclear(key: string): void {\n\t\tthis.entries.delete(key);\n\t}\n\n\tclearAll(): void {\n\t\tthis.entries.clear();\n\t}\n}\n\nfunction isStale(entry: { until: number }, now: number): boolean {\n\treturn entry.until + failureBackoffMaxMs <= now;\n}\n"],"mappings":";AAAA,MAAa,0BAA0B;AACvC,MAAa,sBAAsB;AACnC,MAAM,yBAAyB;AAE/B,IAAa,iBAAb,MAA4B;CAC3B,0BAA2B,IAAI,IAAiD;CAEhF,eAAe,KAAa,KAAiC;EAC5D,MAAM,QAAQ,KAAK,QAAQ,IAAI,GAAG;EAClC,OAAO,SAAS,QAAQ,MAAM,QAAQ,MAAM,MAAM,QAAQ,KAAA;CAC3D;CAEA,YAAY,KAAa,KAAsB;EAC9C,OAAO,KAAK,eAAe,KAAK,GAAG,KAAK;CACzC;CAEA,KAAK,KAAa,KAAa,OAAwB;EACtD,MAAM,WAAW,KAAK,QAAQ,IAAI,GAAG;EACrC,IAAI,YAAY,QAAQ,SAAS,QAAQ,KAAK;GAC7C,IAAI,SAAS,QAAQ,QAAQ,SAAS,OACrC,SAAS,QAAQ;GAElB,OAAO,SAAS;EACjB;EAEA,MAAM,WAAW,YAAY,QAAQ,CAAC,QAAQ,UAAU,GAAG,IAAI,SAAS,WAAW,IAAI;EACvF,MAAM,OACL,SAAS,QAAQ,QAAQ,MACtB,QACA,MAAM,KAAK,IAAI,0BAA0B,MAAM,WAAW,IAAI,mBAAmB;EAErF,KAAK,QAAQ,OAAO,GAAG;EACvB,KAAK,MAAM,CAAC,GAAG,UAAU,KAAK,SAC7B,IAAI,QAAQ,OAAO,GAAG,GACrB,KAAK,QAAQ,OAAO,CAAC;EAGvB,KAAK,MAAM,KAAK,KAAK,QAAQ,KAAK,GAAG;GACpC,IAAI,KAAK,QAAQ,OAAO,wBAAwB;GAEhD,KAAK,QAAQ,OAAO,CAAC;EACtB;EAEA,KAAK,QAAQ,IAAI,KAAK;GAAE,OAAO;GAAgB;EAAS,CAAC;EACzD,OAAO;CACR;CAEA,MAAM,KAAmB;EACxB,KAAK,QAAQ,OAAO,GAAG;CACxB;CAEA,WAAiB;EAChB,KAAK,QAAQ,MAAM;CACpB;AACD;AAEA,SAAS,QAAQ,OAA0B,KAAsB;CAChE,OAAO,MAAM,QAAQ,uBAAuB;AAC7C"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { getScopedLogger, maybeStartScopedLogger } from "../../logger.scoped.js";
|
|
2
2
|
import { isWindows } from "./platform.js";
|
|
3
3
|
import { join } from "path";
|
|
4
|
-
import { execFile, spawn } from "child_process";
|
|
5
|
-
import { access, constants } from "fs";
|
|
6
4
|
import { stat } from "fs/promises";
|
|
7
5
|
import * as process from "process";
|
|
6
|
+
import { execFile, spawn } from "child_process";
|
|
7
|
+
import { access, constants } from "fs";
|
|
8
8
|
//#region ../utils/src/env/node/exec.ts
|
|
9
9
|
var RunError = class extends Error {
|
|
10
10
|
cmd;
|
package/docs/integrations.md
CHANGED
|
@@ -130,6 +130,7 @@ it with `page` + `hasMore` + `cursor?`. **No read throws for a provider-side fai
|
|
|
130
130
|
| `getPullRequestsForBranches` | `PullRequestBranchResult` | Each branch's PRs, in any state and fork-aware; an empty list is a proven none. |
|
|
131
131
|
| `getPullRequestCheckLogs` | `PullRequestCheckLogResult` | The tail of each check's log, by the `PullRequestCheckRun.id` a batch read returned. |
|
|
132
132
|
| `getPullRequestActivity` | `PullRequestActivityResult` | New reviews, inline review comments and conversation comments after a caller-held cursor. |
|
|
133
|
+
| `getPullRequestsForCommits` | `PullRequestForCommitResult` | The PR each of N commits of one repo belongs to; a row without one is a resolved none. |
|
|
133
134
|
| `listIssueTrackerIssuesPage` | `IssueShape` | Jira (Cloud + Data Center) / Linear / Trello / Asana (issues live under resource → project). |
|
|
134
135
|
| `sweepPullRequests` | `ProviderSweepResult` | Drains **every** page across providers (`maxPages`, default 100). |
|
|
135
136
|
| `sweepClosedPullRequests` | `ProviderSweepResult` | Same, pinned to `['closed','merged']`. |
|
|
@@ -299,16 +300,17 @@ fields on GitHub/GHE and Bitbucket DC and the by-id read's on Bitbucket Cloud. B
|
|
|
299
300
|
`IntegrationCacheProvider.getPullRequestForBranch`.
|
|
300
301
|
|
|
301
302
|
`listPullRequestsPage`, `searchPullRequestsPage`, `getPullRequestsBatch`, `getPullRequestsForBranches`,
|
|
302
|
-
`sweepPullRequests` and `sweepClosedPullRequests` also take `mergeQueue`, a per-read override of the host's
|
|
303
|
+
`getPullRequestsForCommits`, `sweepPullRequests` and `sweepClosedPullRequests` also take `mergeQueue`, a per-read override of the host's
|
|
303
304
|
`getPullRequestReadOptions().mergeQueue`, for a host that wants queue state on one surface without paying for it on
|
|
304
305
|
all of them. `true` selects merge-queue data on GitHub.com for that read, `false` doesn't, and omitting it follows the
|
|
305
306
|
host's setting (off when the host has none). Enterprise and every other provider ignore it, as does a read that goes
|
|
306
307
|
through provider-apis, which selects none: the repo-scoped `listPullRequestsPage` and the repo-scoped targets of the
|
|
307
308
|
sweeps. The point reads on the integration classes (`getPullRequest`, `getPullRequestForBranch`,
|
|
308
309
|
`getPullRequestForCommit` and `getIssueOrPullRequest`) don't take it: the host caches their rows under a key that
|
|
309
|
-
doesn't carry it, so they follow the host's setting alone. `getPullRequestsBatch
|
|
310
|
-
resolve it once per call, so the batch's cheap check and full read,
|
|
311
|
-
read that settles a truncated target,
|
|
310
|
+
doesn't carry it, so they follow the host's setting alone. `getPullRequestsBatch`, `getPullRequestsForBranches` and
|
|
311
|
+
`getPullRequestsForCommits` resolve it once per call, so the batch's cheap check and full read, the branch read's
|
|
312
|
+
by-name query and the batch read that settles a truncated target, and the commit read's chunks, always select the same
|
|
313
|
+
data. A read that selects merge-queue data adds a
|
|
312
314
|
marker to every etag it computes, so an etag from such a read never equals one from a read that doesn't, even for a
|
|
313
315
|
pull request that was never queued. Changing either the per-read option or the host's setting therefore costs one
|
|
314
316
|
full read per held target, and a row held without the data is read in full again to gain it. A read that doesn't
|
|
@@ -393,6 +395,79 @@ charges for the page size asked for rather than the items returned, which at the
|
|
|
393
395
|
point per pull request. A new comment or review moves the pull request's update time, so a caller
|
|
394
396
|
can gate this read on a batch read's `etag` or `updatedDate`; that was not verified for every kind of activity.
|
|
395
397
|
|
|
398
|
+
`getPullRequestsForCommits` answers "which pull request does each of these commits belong to" for N commits of one
|
|
399
|
+
repository (`owner`, `repo` and, on Azure DevOps, `project`), echoed under each commit's `sha`. A row with a
|
|
400
|
+
`pullRequest` found one; a row without one is a resolved none (the host answered, or the SHA is the working tree's
|
|
401
|
+
all-zero one, which is never sent), which a caller may cache per SHA; a SHA whose read failed has no row, and the call
|
|
402
|
+
sets `fetchFailed` with a warning naming it in `targetKeys`. Bitbucket Cloud answers `404` alike for a commit it doesn't
|
|
403
|
+
have (an unpushed one) and for a repository it doesn't have, so its `404` is a none only once another commit of the
|
|
404
|
+
repository answered, in the same call, whatever settled first, or in an earlier lookup with the same token;
|
|
405
|
+
until then the SHA fails on its own, and a `404` never stops the call. So on Bitbucket Cloud a caller shouldn't pass
|
|
406
|
+
commits the remote doesn't have (unpushed ones): a window made only of those can't resolve. An answer without a list,
|
|
407
|
+
or with `repo_indexed: false`, means the repository's pull request links aren't indexed yet: it fails the SHA, never
|
|
408
|
+
as a none, and stops the call as the missing commit links app does. Every SHA must be a full 40-character commit SHA
|
|
409
|
+
in either letter case: anything else, a branch name or a short SHA included, refuses the whole call with a warning,
|
|
410
|
+
since a ref the host can't resolve as a commit would otherwise come back as a cacheable none. It takes
|
|
411
|
+
`cancellation`, with `searchPullRequestsPage`'s contract: an aborted read sends nothing more and rejects with a
|
|
412
|
+
`CancellationError`.
|
|
413
|
+
|
|
414
|
+
A commit that belongs to several pull requests resolves to the one the single-commit lookup picks, each host its own
|
|
415
|
+
way, which the batch keeps rather than normalizes:
|
|
416
|
+
|
|
417
|
+
| Host | Pull request a commit with several resolves to |
|
|
418
|
+
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
419
|
+
| GitHub/GHE | Of the two most recently updated GitHub associates with the commit (a fork's only when the fork is `owner`'s): `owner`'s own (ignoring case), then a merged one, then the most recently updated. A third is never considered. |
|
|
420
|
+
| GitLab | Of the first page GitLab lists: an open one, then the most recently updated. |
|
|
421
|
+
| Bitbucket Cloud and DC | Of the first page the host lists: the most recently updated. |
|
|
422
|
+
| Azure DevOps | The first the pull request query lists. |
|
|
423
|
+
|
|
424
|
+
Request cost for N commits, each fan-out run with bounded concurrency:
|
|
425
|
+
|
|
426
|
+
| Host | Requests |
|
|
427
|
+
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
428
|
+
| GitHub/GHE | ⌈N / 25⌉ aliased GraphQL requests. |
|
|
429
|
+
| Azure DevOps | ⌈N / 100⌉ pull request queries (the query takes a list of commits; Azure DevOps documents no limit on it), then one read per distinct pull request found. |
|
|
430
|
+
| GitLab | One project lookup (kept per token), then N. |
|
|
431
|
+
| Bitbucket Cloud and DC | N. |
|
|
432
|
+
|
|
433
|
+
There is no cap on N. After the first rate limit or refused credential in a call, the requests it hasn't sent yet are
|
|
434
|
+
never sent: their SHAs fail with that reason, under one warning. A `403` stops the call the same way when none of its
|
|
435
|
+
SHAs has answered yet, since it is then the repository's refusal, which every SHA would meet; its SHAs fail under one
|
|
436
|
+
warning, scoped to the repository on a host that can check the credential (see §6) and the connection's on GitLab. A
|
|
437
|
+
`403` after a SHA answered is that commit's own and stops nothing. A credential refused after some SHAs answered is
|
|
438
|
+
still the credential's failure: the SHAs it failed carry the connection's `auth` warning, not a scoped one, and it runs
|
|
439
|
+
the credential's recovery once for the call. Bitbucket Cloud stops the same way at the first commit it refuses because
|
|
440
|
+
the pull request commit links app isn't installed, which every commit then answers, fails the call with a warning that
|
|
441
|
+
names the app, and shows the host's `onBitbucketCommitLinksAppMissing` notice once. The reads are a strict form of the
|
|
442
|
+
single-commit lookup's own (one that throws on a failed request where the lookup answers `undefined`, so a failure is
|
|
443
|
+
never a resolved none), and a host without one reports the surface `unsupported`. Rows are that lookup's (the `point`
|
|
444
|
+
projection, without `authoredByMe` or `viewer`). It is uncached and bypasses
|
|
445
|
+
`IntegrationCacheProvider.getPullRequestForSha`.
|
|
446
|
+
|
|
447
|
+
The integration's single-commit lookup (`getPullRequestForCommit`) never caches a failure as a commit without a pull
|
|
448
|
+
request, and backs off from asking again: after a failed lookup it sends no request, spends no strike and shows no
|
|
449
|
+
notice, and answers `undefined` (or, with `throwOnError`, rejects with a `LookupBackedOffError`) for 30 seconds
|
|
450
|
+
after the first failure, doubling with each consecutive failure up to 10 minutes, or until a rate limit's reset time
|
|
451
|
+
when the host gives one. A server error, a network failure (a transport `TimeoutError` included), a cancellation whose reason is `timeout`, a
|
|
452
|
+
rate limit, Bitbucket Cloud's
|
|
453
|
+
missing commit links app or links not indexed yet, a failed GitLab project lookup, and an API client that failed to
|
|
454
|
+
load back off the repository; every other failure (Bitbucket
|
|
455
|
+
Cloud's `404` before the repository answered, a `403` or another `4xx`, an unrecognized failure) backs off only that
|
|
456
|
+
commit. Once a Bitbucket Cloud repository answered for the token, a `404` there is a commit without a pull
|
|
457
|
+
request, cached and not backed off. A refused credential (`401`) and any other cancellation never back off, so a
|
|
458
|
+
host `fetch` that enforces its own deadline by aborting with a plain `AbortError` reads as a cancellation and is asked
|
|
459
|
+
again.
|
|
460
|
+
The backoff is kept per credential and host, is cleared by a lookup that succeeds and by a disconnect, reconnect or
|
|
461
|
+
refresh, and is bypassed by `expiryOverride: true`. An answer already cached is served during a backoff. GitLab's project lookup backs
|
|
462
|
+
off the same way for every read of the project, so for that long a read that answers `undefined` for a failed lookup
|
|
463
|
+
(a commit's author, the repository's issues) answers it without asking. The merge request lookup and the repository
|
|
464
|
+
metadata read instead never keep a failed lookup as a missing project: the merge request lookup fails on it, and the
|
|
465
|
+
repository metadata read (`getRepositoryMetadata`) answers `undefined` without keeping that answer. During the backoff
|
|
466
|
+
they send no request, and they ask again once it has passed; `expiryOverride: true` bypasses the backoff for
|
|
467
|
+
both. A `401` of the project lookup backs off only the reads that swallow it; these two still ask, so that its refusal
|
|
468
|
+
reaches the credential's recovery. The token-scoped read (§10) rejects on a failed lookup and is never backed off.
|
|
469
|
+
`getPullRequestsForCommits` is not backed off.
|
|
470
|
+
|
|
396
471
|
`getCurrentAccount` answers who a connection is signed in as. It returns a single `account?` rather than
|
|
397
472
|
`items`, and `account` is never absent without a warning: no session, a failed request, or a provider that refuses
|
|
398
473
|
(see §8). Jira Cloud answers with the first site's account, since an Atlassian account id is the same on every site. It goes through the host-supplied
|
|
@@ -431,7 +506,8 @@ read), `search` and `search-summary` (the filtered search, and on the host its "
|
|
|
431
506
|
`text-search` (the host's free-text `searchPullRequests`), `account` and `account-summary` (the account-wide list and
|
|
432
507
|
sweeps, `account` being a sweep's `includeReviews`, and a tracker's "my issues"), `repos` and `repos-summary` (the
|
|
433
508
|
repository-scoped list and sweeps), `project` (a tracker project's issues: `listIssueTrackerIssuesPage`,
|
|
434
|
-
`getIssuesForProject`), and `batch` (`getPullRequestsBatch`, `getPullRequestsForBranches`, `getIssuesBatch`).
|
|
509
|
+
`getIssuesForProject`), and `batch` (`getPullRequestsBatch`, `getPullRequestsForBranches`, `getIssuesBatch`).
|
|
510
|
+
`getPullRequestsForCommits` rows carry `point`, the single-commit lookup's tag, since they are its rows. Issues
|
|
435
511
|
have no `-summary` reads; `broadenIssues` rows carry the tag of the read that served each org. The tag names a read,
|
|
436
512
|
not a field set: the same tag can carry different fields on different providers.
|
|
437
513
|
|
|
@@ -754,17 +830,23 @@ Core resolves the repository and issue with that account before sending the muta
|
|
|
754
830
|
are scoped to their repository. For an existing issue, pass its `number` and the `expectedNodeId` from the
|
|
755
831
|
issue read. Core verifies that the node still belongs to the requested repository and number.
|
|
756
832
|
|
|
757
|
-
| Method
|
|
758
|
-
|
|
|
759
|
-
| `
|
|
760
|
-
| `writeIssue`
|
|
761
|
-
| `writeIssue`
|
|
762
|
-
| `
|
|
833
|
+
| Method | Operation |
|
|
834
|
+
| ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
835
|
+
| `resolveIssueWriteTarget` | Verify an existing issue and return its canonical `nodeId`. Use it to serialize writes and publication across aliases or transfers. |
|
|
836
|
+
| `writeIssue` | Pass `action: 'create'` with a `title` and an optional `body`. |
|
|
837
|
+
| `writeIssue` | Pass `action: 'edit'` with at least one of `title` or `body`. An empty body clears the description. |
|
|
838
|
+
| `writeIssue` | Pass `action: 'set-state'`. Use `state: 'open'` to reopen, or `state: 'closed'` with `reason: 'completed'` or `'not_planned'`. |
|
|
839
|
+
| `deleteIssue` | Permanently delete the issue if GitHub grants the selected account permission. Obtain confirmation in the calling UI before invoking it. |
|
|
763
840
|
|
|
764
841
|
An `IssueWriteResult` with `ok: true` contains the canonical owner, repository, issue number, node ID, URL,
|
|
765
|
-
title, body, and state. Deletion returns the issue snapshot
|
|
766
|
-
a
|
|
767
|
-
|
|
842
|
+
title, body, and state. Deletion returns the last verified issue snapshot. GitHub deletes by node ID and can
|
|
843
|
+
report a different repository if a transfer happened after preflight. In that case
|
|
844
|
+
`deletedFromDifferentRepository: true` preserves the confirmation. Use the node ID to reconcile deletion
|
|
845
|
+
and refresh affected lists and details. The snapshot still describes the earlier address.
|
|
846
|
+
|
|
847
|
+
An `ok: false` result contains a typed reason. GitHub can report inaccessible private resources as
|
|
848
|
+
`not-found`. Check GitHub before retrying an `unknown` result, since GitHub may have applied the mutation
|
|
849
|
+
before the response was lost.
|
|
768
850
|
|
|
769
851
|
## 5. Paging
|
|
770
852
|
|
|
@@ -1062,7 +1144,8 @@ keeps its existing behavior. It is set only on warnings derived from a structure
|
|
|
1062
1144
|
least one ID when present; a failure attributed to nothing below the provider carries none. A warning built
|
|
1063
1145
|
from a caught exception never carries one, even when that call targeted a single organization, and an omission
|
|
1064
1146
|
keeps its attribution in `omission.scope` instead. The batch reads (`getIssuesBatch`, `getPullRequestsBatch`,
|
|
1065
|
-
`getPullRequestsForBranches`) are the exception: a refused target's warning names the
|
|
1147
|
+
`getPullRequestsForBranches`, `getPullRequestsForCommits`) are the exception: a refused target's warning names the
|
|
1148
|
+
scope its target names (for the commit read, every SHA names its one repository) —
|
|
1066
1149
|
the Azure DevOps organization and project, the repository on other git hosts, or the tracker's resource. So is
|
|
1067
1150
|
`resolveRepository`: a `401`/`403` for the one repository it resolves settles as a batch read's refused target does,
|
|
1068
1151
|
so on a host that can check the credential (Azure DevOps, Azure DevOps Server, Bitbucket, Bitbucket Data Center,
|
|
@@ -1077,6 +1160,12 @@ organizations, workspaces or sites, and their projects), or an SDK fan-out acros
|
|
|
1077
1160
|
with one uncached check before reporting them; a batch read does so only when every target was refused, since a
|
|
1078
1161
|
target that answered already proved the credential. A refused credential fails the whole read instead: an
|
|
1079
1162
|
unscoped `auth` warning, `fetchFailed`, no results served from the cache, and the usual connection recovery.
|
|
1163
|
+
In a batch read, a `401` for a target of a repository another target of the same call answered from is the
|
|
1164
|
+
credential dying mid-call, never that repository's refusal: those targets fail under the connection's unscoped
|
|
1165
|
+
`auth` warning while the answered ones keep their results, the connection recovery runs once for the call, and the
|
|
1166
|
+
call doesn't reset the failure budget. Every other `401` of that call is then the credential's too, its repository
|
|
1167
|
+
answered or not. A `401` beside answers from other repositories only stays scoped when the call holds no such `401`,
|
|
1168
|
+
and a `403` always does.
|
|
1080
1169
|
A refusal the provider pins on the credential itself, like Bitbucket's or Jira Cloud's for a token missing the
|
|
1081
1170
|
OAuth scopes the read needs, is published unscoped too, once for the connection, because a reconnect (consenting
|
|
1082
1171
|
to them again) is what fixes it; the scopes that answered keep their results.
|
|
@@ -1466,6 +1555,7 @@ footnote says otherwise.
|
|
|
1466
1555
|
| `getPullRequestsForBranches` | ✓ | ✓ | ✓ | ✓¹ | ✓¹ | ✗ | ✗ | ✗ | ✗ |
|
|
1467
1556
|
| `getPullRequestCheckLogs` | ✓ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ |
|
|
1468
1557
|
| `getPullRequestActivity` | ✓ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ |
|
|
1558
|
+
| `getPullRequestsForCommits` | ✓ | ✓ | ✓ | ✓ | ✓ | ✗ | ✗ | ✗ | ✗ |
|
|
1469
1559
|
| Issues by `org`/`project` | ✗ | ✗ | ✗ | ✗ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
1470
1560
|
| `listIssueTrackerIssuesPage` | — | — | — | — | — | ✓ | ✓ | ✓ | ✓ |
|
|
1471
1561
|
| `broadenIssues` | ✓ | ✓ | ✗ | ✗ | ✓ | ✗ | ✗ | ✗ | ✗ |
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitkraken/core-gitlens",
|
|
3
3
|
"description": "GitLens core — shared Git / AI / GitHub primitives for internal GitKraken consumption",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.44.0",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "GitKraken",
|
|
@@ -259,7 +259,7 @@
|
|
|
259
259
|
}
|
|
260
260
|
},
|
|
261
261
|
"dependencies": {
|
|
262
|
-
"@gitkraken/provider-apis": "0.
|
|
262
|
+
"@gitkraken/provider-apis": "0.70.0",
|
|
263
263
|
"@octokit/graphql": "9.0.4",
|
|
264
264
|
"@octokit/request": "10.0.14",
|
|
265
265
|
"@octokit/request-error": "7.1.1",
|