@gitkraken/core-gitlens 0.63.0 → 0.64.1
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 +19 -1
- package/dist/git/watching/provider.d.ts +1 -1
- package/dist/git/watching/watchService.js +6 -1
- package/dist/git/watching/watchService.js.map +1 -1
- package/dist/git-cli/cliGitProvider.js +3 -3
- package/dist/git-cli/cliGitProvider.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/integrations/extensionManager.d.ts +6 -0
- package/dist/plus/integrations/extensionManager.js +10 -0
- package/dist/plus/integrations/extensionManager.js.map +1 -0
- package/dist/plus/integrations/index.d.ts +5 -63
- package/dist/plus/integrations/index.js +4 -53
- package/dist/plus/integrations/index.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +14 -2
- package/dist/plus/integrations/integrationService.js +48 -12
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/manager.d.ts +10 -0
- package/dist/plus/integrations/managerContext.d.ts +69 -0
- package/dist/plus/integrations/managerContext.js +59 -0
- package/dist/plus/integrations/managerContext.js.map +1 -0
- package/dist/plus/integrations/models/gitlabMergeRequestWrites.d.ts +167 -0
- package/dist/plus/integrations/models/gitlabMergeRequestWrites.js +0 -0
- package/dist/plus/integrations/providers/azure/azure.js +1 -1
- package/dist/plus/integrations/providers/github.js +1 -1
- package/dist/plus/integrations/providers/gitlab/gitlab.d.ts +2 -2
- package/dist/plus/integrations/providers/gitlab/gitlab.js +3 -3
- package/dist/plus/integrations/providers/gitlab/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/issueWrites.d.ts +4 -13
- package/dist/plus/integrations/providers/gitlab/issueWrites.js +33 -136
- package/dist/plus/integrations/providers/gitlab/issueWrites.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab/mergeRequestWrites.d.ts +30 -0
- package/dist/plus/integrations/providers/gitlab/mergeRequestWrites.js +569 -0
- package/dist/plus/integrations/providers/gitlab/mergeRequestWrites.js.map +1 -0
- package/dist/plus/integrations/providers/gitlab/writeErrors.d.ts +12 -0
- package/dist/plus/integrations/providers/gitlab/writeErrors.js +101 -0
- package/dist/plus/integrations/providers/gitlab/writeErrors.js.map +1 -0
- package/dist/plus/integrations/providers/gitlab/writeTransport.d.ts +47 -0
- package/dist/plus/integrations/providers/gitlab/writeTransport.js +135 -0
- package/dist/plus/integrations/providers/gitlab/writeTransport.js.map +1 -0
- package/dist/plus/integrations/providers/gitlab.d.ts +6 -1
- package/dist/plus/integrations/providers/gitlab.js +9 -1
- package/dist/plus/integrations/providers/gitlab.js.map +1 -1
- package/dist/plus/integrations/reads/sweeps.js +1 -1
- package/dist/utils/env/node/exec.js +2 -2
- package/docs/integrations.md +77 -0
- package/package.json +1 -1
- package/dist/plus/integrations/providers/gitlab/issueWriteErrors.d.ts +0 -11
- package/dist/plus/integrations/providers/gitlab/issueWriteErrors.js +0 -73
- package/dist/plus/integrations/providers/gitlab/issueWriteErrors.js.map +0 -1
|
@@ -14,6 +14,7 @@ import { AzurePullRequestCreateCapabilityOptions, AzurePullRequestCreateCapabili
|
|
|
14
14
|
import { BitbucketPullRequestCreateCapabilityOptions, BitbucketPullRequestCreateCapabilityResult, BitbucketPullRequestMergeStatusOptions, BitbucketPullRequestMergeStatusResult, BitbucketPullRequestWriteOptions, BitbucketPullRequestWriteReleaseOptions, BitbucketPullRequestWriteReleaseResult, BitbucketPullRequestWriteResult, BitbucketPullRequestWriteTargetOptions, BitbucketPullRequestWriteTargetResult } from "./models/bitbucketPullRequestWrites.js";
|
|
15
15
|
import { BitbucketServerPullRequestCreateCapabilityResult, BitbucketServerPullRequestWriteOptions, BitbucketServerPullRequestWriteResult, BitbucketServerPullRequestWriteScope, BitbucketServerPullRequestWriteTargetOptions, BitbucketServerPullRequestWriteTargetResult } from "./models/bitbucketServerPullRequestWrites.js";
|
|
16
16
|
import { GitLabIssueCreateOptions, GitLabIssueCreateOptionsResult, GitLabIssueDeleteOptions, GitLabIssueWriteAddress, GitLabIssueWriteOptions, GitLabIssueWriteOptionsResult, GitLabIssueWriteResult, GitLabIssueWriteTargetOptions, GitLabIssueWriteTargetResult } from "./models/gitlabIssueWrites.js";
|
|
17
|
+
import { GitLabMergeRequestCreateOptions, GitLabMergeRequestCreateOptionsResult, GitLabMergeRequestDeleteOptions, GitLabMergeRequestWriteAddress, GitLabMergeRequestWriteOptions, GitLabMergeRequestWriteOptionsResult, GitLabMergeRequestWriteResult, GitLabMergeRequestWriteTargetOptions, GitLabMergeRequestWriteTargetResult } from "./models/gitlabMergeRequestWrites.js";
|
|
17
18
|
import { CaptureRelationshipCurrency, IssueRelationshipWriteOptions, IssueRelationshipWriteResult, IssueRelationshipsOptions, IssueRelationshipsResult } from "./models/issueRelationships.js";
|
|
18
19
|
import { IssueFilter, SupportedFilters } from "./providerFilters.js";
|
|
19
20
|
import { IssueEtagInclude, PullRequestEtagInclude } from "./reads/etag.js";
|
|
@@ -1202,6 +1203,15 @@ export interface IntegrationManager {
|
|
|
1202
1203
|
resolveGitLabIssueWriteTarget(options: GitLabIssueWriteTargetOptions): Promise<GitLabIssueWriteTargetResult>;
|
|
1203
1204
|
writeGitLabIssue(options: GitLabIssueWriteOptions): Promise<GitLabIssueWriteResult>;
|
|
1204
1205
|
deleteGitLabIssue(options: GitLabIssueDeleteOptions): Promise<GitLabIssueWriteResult>;
|
|
1206
|
+
getGitLabMergeRequestCreateOptions(options: GitLabMergeRequestCreateOptions): Promise<GitLabMergeRequestCreateOptionsResult>;
|
|
1207
|
+
getGitLabMergeRequestWriteOptions(options: GitLabMergeRequestWriteAddress): Promise<GitLabMergeRequestWriteOptionsResult>;
|
|
1208
|
+
resolveGitLabMergeRequestWriteTarget(options: GitLabMergeRequestWriteTargetOptions): Promise<GitLabMergeRequestWriteTargetResult>;
|
|
1209
|
+
/**
|
|
1210
|
+
* Creates, edits, closes, reopens or merges a GitLab.com merge request. A merge lands directly or joins the
|
|
1211
|
+
* project's merge train, as `expectedExecution` pins; `applied: 'maybe'` is never retried by Core.
|
|
1212
|
+
*/
|
|
1213
|
+
writeGitLabMergeRequest(options: GitLabMergeRequestWriteOptions): Promise<GitLabMergeRequestWriteResult>;
|
|
1214
|
+
deleteGitLabMergeRequest(options: GitLabMergeRequestDeleteOptions): Promise<GitLabMergeRequestWriteResult>;
|
|
1205
1215
|
getIssueTrackerCreateOptions(options: IssueTrackerCreateOptions): Promise<IssueTrackerCreateOptionsResult>;
|
|
1206
1216
|
getIssueTrackerIssueWriteOptions(options: IssueTrackerIssueWriteOptions): Promise<IssueTrackerIssueWriteOptionsResult>;
|
|
1207
1217
|
writeIssueTrackerIssue(options: IssueTrackerWriteOptions): Promise<IssueTrackerWriteResult>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { CacheController } from "../../utils/promiseCache.js";
|
|
2
|
+
import { ResourceDescriptor } from "../../git/models/resourceDescriptor.js";
|
|
3
|
+
import { IssueOrPullRequest, IssueOrPullRequestType } from "../../git/models/issueOrPullRequest.js";
|
|
4
|
+
import { Issue } from "../../git/models/issue.js";
|
|
5
|
+
import { PullRequest } from "../../git/models/pullRequest.js";
|
|
6
|
+
import { Account } from "../../git/models/author.js";
|
|
7
|
+
import { DefaultBranch } from "../../git/models/defaultBranch.js";
|
|
8
|
+
import { RepositoryMetadata } from "../../git/models/repositoryMetadata.js";
|
|
9
|
+
import { IntegrationCacheDescriptor } from "./models/publicIntegration.js";
|
|
10
|
+
import { AccountProvider, ConfigProvider, HttpProvider, IntegrationServiceContext, IntegrationServiceHooks, IntegrationStorageProvider, RepositoriesProvider } from "./context.js";
|
|
11
|
+
//#region ../plus/integrations/src/managerContext.d.ts
|
|
12
|
+
/** A cached provider value, which may still be resolving. */
|
|
13
|
+
export type IntegrationManagerCacheResult<T> = Promise<T | undefined> | T | undefined;
|
|
14
|
+
/** Produces an account value on a cache miss. */
|
|
15
|
+
export type IntegrationManagerCacheLoader<T> = (cacheable: CacheController) => {
|
|
16
|
+
value: IntegrationManagerCacheResult<T>;
|
|
17
|
+
expiresAt?: number;
|
|
18
|
+
};
|
|
19
|
+
/** The integration identity supplied to the consumer-owned account cache. */
|
|
20
|
+
export type IntegrationAccountCacheDescriptor = IntegrationCacheDescriptor;
|
|
21
|
+
/** Cache controls attached to a provider account lookup. */
|
|
22
|
+
export interface IntegrationManagerCacheOptions {
|
|
23
|
+
readonly connectionId?: string;
|
|
24
|
+
readonly etag?: string;
|
|
25
|
+
readonly expiryOverride?: boolean | number;
|
|
26
|
+
readonly expireOnError?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Optional consumer-owned cache for values reused by the public manager facade.
|
|
30
|
+
*
|
|
31
|
+
* Only `getCurrentAccount` is required. Each other lookup is optional: one the cache omits runs its loader on every
|
|
32
|
+
* call, uncached. A cache that keys entries by integration should key them by the descriptor's `id` and `domain`,
|
|
33
|
+
* and treat `maybeConnected` and `sessionFingerprint` as the entry's etag, so a reconnect or a token change misses.
|
|
34
|
+
*
|
|
35
|
+
* The manager calls each method on the cache object itself, so a class instance (methods on its prototype) works.
|
|
36
|
+
*/
|
|
37
|
+
export interface IntegrationManagerCacheProvider {
|
|
38
|
+
getCurrentAccount(integration: IntegrationAccountCacheDescriptor, cacheable: IntegrationManagerCacheLoader<Account>, options?: IntegrationManagerCacheOptions): IntegrationManagerCacheResult<Account>;
|
|
39
|
+
getRepositoryMetadata?(repo: ResourceDescriptor, integration: IntegrationCacheDescriptor | undefined, cacheable: IntegrationManagerCacheLoader<RepositoryMetadata>, options?: IntegrationManagerCacheOptions): IntegrationManagerCacheResult<RepositoryMetadata>;
|
|
40
|
+
getRepositoryDefaultBranch?(repo: ResourceDescriptor, integration: IntegrationCacheDescriptor | undefined, cacheable: IntegrationManagerCacheLoader<DefaultBranch>, options?: IntegrationManagerCacheOptions): IntegrationManagerCacheResult<DefaultBranch>;
|
|
41
|
+
getPullRequestForSha?(sha: string, repo: ResourceDescriptor, integration: IntegrationCacheDescriptor | undefined, cacheable: IntegrationManagerCacheLoader<PullRequest>, options?: IntegrationManagerCacheOptions): IntegrationManagerCacheResult<PullRequest>;
|
|
42
|
+
getPullRequestForBranch?(branch: string, repo: ResourceDescriptor, integration: IntegrationCacheDescriptor | undefined, cacheable: IntegrationManagerCacheLoader<PullRequest>, options?: IntegrationManagerCacheOptions): IntegrationManagerCacheResult<PullRequest>;
|
|
43
|
+
getPullRequest?(id: string, resource: ResourceDescriptor, integration: IntegrationCacheDescriptor | undefined, cacheable: IntegrationManagerCacheLoader<PullRequest>, options?: IntegrationManagerCacheOptions): IntegrationManagerCacheResult<PullRequest>;
|
|
44
|
+
getIssueOrPullRequest?(id: string, type: IssueOrPullRequestType | undefined, resource: ResourceDescriptor, integration: IntegrationCacheDescriptor | undefined, cacheable: IntegrationManagerCacheLoader<IssueOrPullRequest>, options?: IntegrationManagerCacheOptions): IntegrationManagerCacheResult<IssueOrPullRequest>;
|
|
45
|
+
getIssue?(id: string, resource: ResourceDescriptor, integration: IntegrationCacheDescriptor | undefined, cacheable: IntegrationManagerCacheLoader<Issue>, options?: IntegrationManagerCacheOptions): IntegrationManagerCacheResult<Issue>;
|
|
46
|
+
/** Evicts cached pull requests for the given installation origin, or all pull requests when omitted. */
|
|
47
|
+
deletePullRequests?(scope?: {
|
|
48
|
+
id: IntegrationCacheDescriptor['id'];
|
|
49
|
+
domain: string;
|
|
50
|
+
}): void;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Consumer-facing runtime for `createIntegrationManager`.
|
|
54
|
+
*
|
|
55
|
+
* External consumers may omit `cache`; reads then execute their loaders directly without cross-call caching.
|
|
56
|
+
* The extension host's broader integration context remains private to the implementation.
|
|
57
|
+
*/
|
|
58
|
+
export interface IntegrationManagerContext {
|
|
59
|
+
readonly storage: IntegrationStorageProvider;
|
|
60
|
+
readonly account: AccountProvider;
|
|
61
|
+
readonly config: ConfigProvider;
|
|
62
|
+
readonly http: HttpProvider;
|
|
63
|
+
readonly cache?: IntegrationManagerCacheProvider;
|
|
64
|
+
readonly repositories: RepositoriesProvider;
|
|
65
|
+
readonly hooks?: IntegrationServiceHooks;
|
|
66
|
+
}
|
|
67
|
+
export declare function toIntegrationServiceContext(ctx: IntegrationManagerContext): IntegrationServiceContext;
|
|
68
|
+
//#endregion
|
|
69
|
+
//# sourceMappingURL=managerContext.d.ts.map
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { CacheController } from "../../utils/promiseCache.js";
|
|
2
|
+
//#region ../plus/integrations/src/managerContext.ts
|
|
3
|
+
function loadUncached(loader) {
|
|
4
|
+
return loader(new CacheController()).value;
|
|
5
|
+
}
|
|
6
|
+
function toCacheDescriptor(integration) {
|
|
7
|
+
if (integration == null) return void 0;
|
|
8
|
+
return {
|
|
9
|
+
id: integration.id,
|
|
10
|
+
domain: integration.domain,
|
|
11
|
+
...integration.installationOrigin != null && { installationOrigin: integration.installationOrigin },
|
|
12
|
+
get maybeConnected() {
|
|
13
|
+
return integration.maybeConnected;
|
|
14
|
+
},
|
|
15
|
+
get sessionFingerprint() {
|
|
16
|
+
return integration.sessionFingerprint;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const uncachedIntegrationCacheProvider = {
|
|
21
|
+
getRepositoryMetadata: (_repo, _integration, loader) => loadUncached(loader),
|
|
22
|
+
getRepositoryDefaultBranch: (_repo, _integration, loader) => loadUncached(loader),
|
|
23
|
+
getPullRequestForSha: (_sha, _repo, _integration, loader) => loadUncached(loader),
|
|
24
|
+
getPullRequestForBranch: (_branch, _repo, _integration, loader) => loadUncached(loader),
|
|
25
|
+
getPullRequest: (_id, _resource, _integration, loader) => loadUncached(loader),
|
|
26
|
+
getIssueOrPullRequest: (_id, _type, _resource, _integration, loader) => loadUncached(loader),
|
|
27
|
+
getIssue: (_id, _resource, _integration, loader) => loadUncached(loader),
|
|
28
|
+
getCurrentAccount: (_integration, loader) => loadUncached(loader),
|
|
29
|
+
deletePullRequests: () => {}
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Adapts the consumer's cache to the internal one: each lookup the consumer supplies is called on `cache` itself (never
|
|
33
|
+
* spread or detached, which would lose a class instance's prototype methods and `this`), and every other lookup runs
|
|
34
|
+
* uncached.
|
|
35
|
+
*/
|
|
36
|
+
function toIntegrationCacheProvider(cache) {
|
|
37
|
+
if (cache == null) return uncachedIntegrationCacheProvider;
|
|
38
|
+
return {
|
|
39
|
+
getRepositoryMetadata: (repo, integration, loader, options) => cache.getRepositoryMetadata != null ? cache.getRepositoryMetadata(repo, toCacheDescriptor(integration), loader, options) : loadUncached(loader),
|
|
40
|
+
getRepositoryDefaultBranch: (repo, integration, loader, options) => cache.getRepositoryDefaultBranch != null ? cache.getRepositoryDefaultBranch(repo, toCacheDescriptor(integration), loader, options) : loadUncached(loader),
|
|
41
|
+
getPullRequestForSha: (sha, repo, integration, loader, options) => cache.getPullRequestForSha != null ? cache.getPullRequestForSha(sha, repo, toCacheDescriptor(integration), loader, options) : loadUncached(loader),
|
|
42
|
+
getPullRequestForBranch: (branch, repo, integration, loader, options) => cache.getPullRequestForBranch != null ? cache.getPullRequestForBranch(branch, repo, toCacheDescriptor(integration), loader, options) : loadUncached(loader),
|
|
43
|
+
getPullRequest: (id, resource, integration, loader, options) => cache.getPullRequest != null ? cache.getPullRequest(id, resource, toCacheDescriptor(integration), loader, options) : loadUncached(loader),
|
|
44
|
+
getIssueOrPullRequest: (id, type, resource, integration, loader, options) => cache.getIssueOrPullRequest != null ? cache.getIssueOrPullRequest(id, type, resource, toCacheDescriptor(integration), loader, options) : loadUncached(loader),
|
|
45
|
+
getIssue: (id, resource, integration, loader, options) => cache.getIssue != null ? cache.getIssue(id, resource, toCacheDescriptor(integration), loader, options) : loadUncached(loader),
|
|
46
|
+
getCurrentAccount: (integration, loader, options) => cache.getCurrentAccount(toCacheDescriptor(integration), loader, options),
|
|
47
|
+
deletePullRequests: (scope) => cache.deletePullRequests?.(scope)
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function toIntegrationServiceContext(ctx) {
|
|
51
|
+
return {
|
|
52
|
+
...ctx,
|
|
53
|
+
cache: toIntegrationCacheProvider(ctx.cache)
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
export { toIntegrationServiceContext };
|
|
58
|
+
|
|
59
|
+
//# sourceMappingURL=managerContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"managerContext.js","names":[],"sources":["../../../../plus/integrations/src/managerContext.ts"],"sourcesContent":["import type { Account } from '@gitlens/git/models/author.js';\nimport type { DefaultBranch } from '@gitlens/git/models/defaultBranch.js';\nimport type { Issue } from '@gitlens/git/models/issue.js';\nimport type { IssueOrPullRequest, IssueOrPullRequestType } from '@gitlens/git/models/issueOrPullRequest.js';\nimport type { PullRequest } from '@gitlens/git/models/pullRequest.js';\nimport type { RepositoryMetadata } from '@gitlens/git/models/repositoryMetadata.js';\nimport type { ResourceDescriptor } from '@gitlens/git/models/resourceDescriptor.js';\nimport { CacheController } from '@gitlens/utils/promiseCache.js';\nimport type {\n\tAccountProvider,\n\tConfigProvider,\n\tHttpProvider,\n\tIntegrationCacheProvider,\n\tIntegrationServiceContext,\n\tIntegrationServiceHooks,\n\tIntegrationStorageProvider,\n\tRepositoriesProvider,\n} from './context.js';\nimport type { IntegrationCacheDescriptor } from './models/publicIntegration.js';\n\n/** A cached provider value, which may still be resolving. */\nexport type IntegrationManagerCacheResult<T> = Promise<T | undefined> | T | undefined;\n\n/** Produces an account value on a cache miss. */\nexport type IntegrationManagerCacheLoader<T> = (cacheable: CacheController) => {\n\tvalue: IntegrationManagerCacheResult<T>;\n\texpiresAt?: number;\n};\n\n/** The integration identity supplied to the consumer-owned account cache. */\nexport type IntegrationAccountCacheDescriptor = IntegrationCacheDescriptor;\n\n/** Cache controls attached to a provider account lookup. */\nexport interface IntegrationManagerCacheOptions {\n\treadonly connectionId?: string;\n\treadonly etag?: string;\n\treadonly expiryOverride?: boolean | number;\n\treadonly expireOnError?: boolean;\n}\n\n/**\n * Optional consumer-owned cache for values reused by the public manager facade.\n *\n * Only `getCurrentAccount` is required. Each other lookup is optional: one the cache omits runs its loader on every\n * call, uncached. A cache that keys entries by integration should key them by the descriptor's `id` and `domain`,\n * and treat `maybeConnected` and `sessionFingerprint` as the entry's etag, so a reconnect or a token change misses.\n *\n * The manager calls each method on the cache object itself, so a class instance (methods on its prototype) works.\n */\nexport interface IntegrationManagerCacheProvider {\n\tgetCurrentAccount(\n\t\tintegration: IntegrationAccountCacheDescriptor,\n\t\tcacheable: IntegrationManagerCacheLoader<Account>,\n\t\toptions?: IntegrationManagerCacheOptions,\n\t): IntegrationManagerCacheResult<Account>;\n\tgetRepositoryMetadata?(\n\t\trepo: ResourceDescriptor,\n\t\tintegration: IntegrationCacheDescriptor | undefined,\n\t\tcacheable: IntegrationManagerCacheLoader<RepositoryMetadata>,\n\t\toptions?: IntegrationManagerCacheOptions,\n\t): IntegrationManagerCacheResult<RepositoryMetadata>;\n\tgetRepositoryDefaultBranch?(\n\t\trepo: ResourceDescriptor,\n\t\tintegration: IntegrationCacheDescriptor | undefined,\n\t\tcacheable: IntegrationManagerCacheLoader<DefaultBranch>,\n\t\toptions?: IntegrationManagerCacheOptions,\n\t): IntegrationManagerCacheResult<DefaultBranch>;\n\tgetPullRequestForSha?(\n\t\tsha: string,\n\t\trepo: ResourceDescriptor,\n\t\tintegration: IntegrationCacheDescriptor | undefined,\n\t\tcacheable: IntegrationManagerCacheLoader<PullRequest>,\n\t\toptions?: IntegrationManagerCacheOptions,\n\t): IntegrationManagerCacheResult<PullRequest>;\n\tgetPullRequestForBranch?(\n\t\tbranch: string,\n\t\trepo: ResourceDescriptor,\n\t\tintegration: IntegrationCacheDescriptor | undefined,\n\t\tcacheable: IntegrationManagerCacheLoader<PullRequest>,\n\t\toptions?: IntegrationManagerCacheOptions,\n\t): IntegrationManagerCacheResult<PullRequest>;\n\tgetPullRequest?(\n\t\tid: string,\n\t\tresource: ResourceDescriptor,\n\t\tintegration: IntegrationCacheDescriptor | undefined,\n\t\tcacheable: IntegrationManagerCacheLoader<PullRequest>,\n\t\toptions?: IntegrationManagerCacheOptions,\n\t): IntegrationManagerCacheResult<PullRequest>;\n\tgetIssueOrPullRequest?(\n\t\tid: string,\n\t\ttype: IssueOrPullRequestType | undefined,\n\t\tresource: ResourceDescriptor,\n\t\tintegration: IntegrationCacheDescriptor | undefined,\n\t\tcacheable: IntegrationManagerCacheLoader<IssueOrPullRequest>,\n\t\toptions?: IntegrationManagerCacheOptions,\n\t): IntegrationManagerCacheResult<IssueOrPullRequest>;\n\tgetIssue?(\n\t\tid: string,\n\t\tresource: ResourceDescriptor,\n\t\tintegration: IntegrationCacheDescriptor | undefined,\n\t\tcacheable: IntegrationManagerCacheLoader<Issue>,\n\t\toptions?: IntegrationManagerCacheOptions,\n\t): IntegrationManagerCacheResult<Issue>;\n\t/** Evicts cached pull requests for the given installation origin, or all pull requests when omitted. */\n\tdeletePullRequests?(scope?: { id: IntegrationCacheDescriptor['id']; domain: string }): void;\n}\n\nfunction loadUncached<T>(loader: IntegrationManagerCacheLoader<T>): IntegrationManagerCacheResult<T> {\n\treturn loader(new CacheController()).value;\n}\n\n/**\n * What a consumer cache is handed in place of the integration itself. The getters read through to the integration\n * when the cache reads them, as reading the integration did, without handing a consumer the class.\n */\nfunction toCacheDescriptor(integration: IntegrationCacheDescriptor): IntegrationCacheDescriptor;\nfunction toCacheDescriptor(integration: IntegrationCacheDescriptor | undefined): IntegrationCacheDescriptor | undefined;\nfunction toCacheDescriptor(\n\tintegration: IntegrationCacheDescriptor | undefined,\n): IntegrationCacheDescriptor | undefined {\n\tif (integration == null) return undefined;\n\n\treturn {\n\t\tid: integration.id,\n\t\tdomain: integration.domain,\n\t\t...(integration.installationOrigin != null && { installationOrigin: integration.installationOrigin }),\n\t\tget maybeConnected() {\n\t\t\treturn integration.maybeConnected;\n\t\t},\n\t\tget sessionFingerprint() {\n\t\t\treturn integration.sessionFingerprint;\n\t\t},\n\t};\n}\n\nconst uncachedIntegrationCacheProvider: IntegrationCacheProvider = {\n\tgetRepositoryMetadata: (_repo, _integration, loader) => loadUncached(loader),\n\tgetRepositoryDefaultBranch: (_repo, _integration, loader) => loadUncached(loader),\n\tgetPullRequestForSha: (_sha, _repo, _integration, loader) => loadUncached(loader),\n\tgetPullRequestForBranch: (_branch, _repo, _integration, loader) => loadUncached(loader),\n\tgetPullRequest: (_id, _resource, _integration, loader) => loadUncached(loader),\n\tgetIssueOrPullRequest: (_id, _type, _resource, _integration, loader) => loadUncached(loader),\n\tgetIssue: (_id, _resource, _integration, loader) => loadUncached(loader),\n\tgetCurrentAccount: (_integration, loader) => loadUncached(loader),\n\tdeletePullRequests: () => {},\n};\n\n/**\n * Adapts the consumer's cache to the internal one: each lookup the consumer supplies is called on `cache` itself (never\n * spread or detached, which would lose a class instance's prototype methods and `this`), and every other lookup runs\n * uncached.\n */\nfunction toIntegrationCacheProvider(cache: IntegrationManagerCacheProvider | undefined): IntegrationCacheProvider {\n\tif (cache == null) return uncachedIntegrationCacheProvider;\n\n\treturn {\n\t\tgetRepositoryMetadata: (repo, integration, loader, options) =>\n\t\t\tcache.getRepositoryMetadata != null\n\t\t\t\t? cache.getRepositoryMetadata(repo, toCacheDescriptor(integration), loader, options)\n\t\t\t\t: loadUncached(loader),\n\t\tgetRepositoryDefaultBranch: (repo, integration, loader, options) =>\n\t\t\tcache.getRepositoryDefaultBranch != null\n\t\t\t\t? cache.getRepositoryDefaultBranch(repo, toCacheDescriptor(integration), loader, options)\n\t\t\t\t: loadUncached(loader),\n\t\tgetPullRequestForSha: (sha, repo, integration, loader, options) =>\n\t\t\tcache.getPullRequestForSha != null\n\t\t\t\t? cache.getPullRequestForSha(sha, repo, toCacheDescriptor(integration), loader, options)\n\t\t\t\t: loadUncached(loader),\n\t\tgetPullRequestForBranch: (branch, repo, integration, loader, options) =>\n\t\t\tcache.getPullRequestForBranch != null\n\t\t\t\t? cache.getPullRequestForBranch(branch, repo, toCacheDescriptor(integration), loader, options)\n\t\t\t\t: loadUncached(loader),\n\t\tgetPullRequest: (id, resource, integration, loader, options) =>\n\t\t\tcache.getPullRequest != null\n\t\t\t\t? cache.getPullRequest(id, resource, toCacheDescriptor(integration), loader, options)\n\t\t\t\t: loadUncached(loader),\n\t\tgetIssueOrPullRequest: (id, type, resource, integration, loader, options) =>\n\t\t\tcache.getIssueOrPullRequest != null\n\t\t\t\t? cache.getIssueOrPullRequest(id, type, resource, toCacheDescriptor(integration), loader, options)\n\t\t\t\t: loadUncached(loader),\n\t\tgetIssue: (id, resource, integration, loader, options) =>\n\t\t\tcache.getIssue != null\n\t\t\t\t? cache.getIssue(id, resource, toCacheDescriptor(integration), loader, options)\n\t\t\t\t: loadUncached(loader),\n\t\tgetCurrentAccount: (integration, loader, options) =>\n\t\t\tcache.getCurrentAccount(toCacheDescriptor(integration), loader, options),\n\t\tdeletePullRequests: scope => cache.deletePullRequests?.(scope),\n\t};\n}\n\n/**\n * Consumer-facing runtime for `createIntegrationManager`.\n *\n * External consumers may omit `cache`; reads then execute their loaders directly without cross-call caching.\n * The extension host's broader integration context remains private to the implementation.\n */\nexport interface IntegrationManagerContext {\n\treadonly storage: IntegrationStorageProvider;\n\treadonly account: AccountProvider;\n\treadonly config: ConfigProvider;\n\treadonly http: HttpProvider;\n\treadonly cache?: IntegrationManagerCacheProvider;\n\treadonly repositories: RepositoriesProvider;\n\treadonly hooks?: IntegrationServiceHooks;\n}\n\nexport function toIntegrationServiceContext(ctx: IntegrationManagerContext): IntegrationServiceContext {\n\treturn { ...ctx, cache: toIntegrationCacheProvider(ctx.cache) };\n}\n"],"mappings":";;AA2GA,SAAS,aAAgB,QAA4E;CACpG,OAAO,OAAO,IAAI,gBAAgB,CAAC,CAAC,CAAC;AACtC;AAQA,SAAS,kBACR,aACyC;CACzC,IAAI,eAAe,MAAM,OAAO,KAAA;CAEhC,OAAO;EACN,IAAI,YAAY;EAChB,QAAQ,YAAY;EACpB,GAAI,YAAY,sBAAsB,QAAQ,EAAE,oBAAoB,YAAY,mBAAmB;EACnG,IAAI,iBAAiB;GACpB,OAAO,YAAY;EACpB;EACA,IAAI,qBAAqB;GACxB,OAAO,YAAY;EACpB;CACD;AACD;AAEA,MAAM,mCAA6D;CAClE,wBAAwB,OAAO,cAAc,WAAW,aAAa,MAAM;CAC3E,6BAA6B,OAAO,cAAc,WAAW,aAAa,MAAM;CAChF,uBAAuB,MAAM,OAAO,cAAc,WAAW,aAAa,MAAM;CAChF,0BAA0B,SAAS,OAAO,cAAc,WAAW,aAAa,MAAM;CACtF,iBAAiB,KAAK,WAAW,cAAc,WAAW,aAAa,MAAM;CAC7E,wBAAwB,KAAK,OAAO,WAAW,cAAc,WAAW,aAAa,MAAM;CAC3F,WAAW,KAAK,WAAW,cAAc,WAAW,aAAa,MAAM;CACvE,oBAAoB,cAAc,WAAW,aAAa,MAAM;CAChE,0BAA0B,CAAC;AAC5B;;;;;;AAOA,SAAS,2BAA2B,OAA8E;CACjH,IAAI,SAAS,MAAM,OAAO;CAE1B,OAAO;EACN,wBAAwB,MAAM,aAAa,QAAQ,YAClD,MAAM,yBAAyB,OAC5B,MAAM,sBAAsB,MAAM,kBAAkB,WAAW,GAAG,QAAQ,OAAO,IACjF,aAAa,MAAM;EACvB,6BAA6B,MAAM,aAAa,QAAQ,YACvD,MAAM,8BAA8B,OACjC,MAAM,2BAA2B,MAAM,kBAAkB,WAAW,GAAG,QAAQ,OAAO,IACtF,aAAa,MAAM;EACvB,uBAAuB,KAAK,MAAM,aAAa,QAAQ,YACtD,MAAM,wBAAwB,OAC3B,MAAM,qBAAqB,KAAK,MAAM,kBAAkB,WAAW,GAAG,QAAQ,OAAO,IACrF,aAAa,MAAM;EACvB,0BAA0B,QAAQ,MAAM,aAAa,QAAQ,YAC5D,MAAM,2BAA2B,OAC9B,MAAM,wBAAwB,QAAQ,MAAM,kBAAkB,WAAW,GAAG,QAAQ,OAAO,IAC3F,aAAa,MAAM;EACvB,iBAAiB,IAAI,UAAU,aAAa,QAAQ,YACnD,MAAM,kBAAkB,OACrB,MAAM,eAAe,IAAI,UAAU,kBAAkB,WAAW,GAAG,QAAQ,OAAO,IAClF,aAAa,MAAM;EACvB,wBAAwB,IAAI,MAAM,UAAU,aAAa,QAAQ,YAChE,MAAM,yBAAyB,OAC5B,MAAM,sBAAsB,IAAI,MAAM,UAAU,kBAAkB,WAAW,GAAG,QAAQ,OAAO,IAC/F,aAAa,MAAM;EACvB,WAAW,IAAI,UAAU,aAAa,QAAQ,YAC7C,MAAM,YAAY,OACf,MAAM,SAAS,IAAI,UAAU,kBAAkB,WAAW,GAAG,QAAQ,OAAO,IAC5E,aAAa,MAAM;EACvB,oBAAoB,aAAa,QAAQ,YACxC,MAAM,kBAAkB,kBAAkB,WAAW,GAAG,QAAQ,OAAO;EACxE,qBAAoB,UAAS,MAAM,qBAAqB,KAAK;CAC9D;AACD;AAkBA,SAAgB,4BAA4B,KAA2D;CACtG,OAAO;EAAE,GAAG;EAAK,OAAO,2BAA2B,IAAI,KAAK;CAAE;AAC/D"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { GitLabIssueWriteFailure, GitLabIssueWriteScope } from "./gitlabIssueWrites.js";
|
|
2
|
+
//#region ../plus/integrations/src/models/gitlabMergeRequestWrites.d.ts
|
|
3
|
+
export type GitLabMergeRequestWriteScope = GitLabIssueWriteScope;
|
|
4
|
+
/** SEE: https://docs.gitlab.com/api/projects/ (`merge_method`); the project owns it and a merge cannot choose another. */
|
|
5
|
+
export type GitLabMergeMethod = 'merge' | 'rebase_merge' | 'ff';
|
|
6
|
+
export type GitLabMergeExecution = 'merge' | 'train';
|
|
7
|
+
/**
|
|
8
|
+
* Whether a merge squashes: `required` always does and must pass `squash: true`, `unavailable` never does and must
|
|
9
|
+
* pass `false`, and `optional` lets the caller choose. A merge request already set to squash is `required`.
|
|
10
|
+
*/
|
|
11
|
+
export type GitLabMergeSquash = 'required' | 'optional' | 'unavailable';
|
|
12
|
+
export type GitLabMergeBlocker = 'conflicts' | 'pipeline' | 'approvals' | 'discussions' | 'draft' | 'rebase' | 'status-checks' |
|
|
13
|
+
/** GitLab is still computing mergeability; read again. */
|
|
14
|
+
'checking' |
|
|
15
|
+
/** The project merges through a train this merge request cannot join yet. */
|
|
16
|
+
'merge-train' |
|
|
17
|
+
/** The merge request is already set to auto-merge or is on a merge train. */
|
|
18
|
+
'auto-merge' | 'other';
|
|
19
|
+
export type GitLabMergeRequestProject = {
|
|
20
|
+
id: string;
|
|
21
|
+
fullPath: string;
|
|
22
|
+
url: string;
|
|
23
|
+
};
|
|
24
|
+
export type GitLabMergeRequestCreateOptions = GitLabMergeRequestWriteScope & {
|
|
25
|
+
/** The target project: its numeric id or full nested path. */
|
|
26
|
+
project: string;
|
|
27
|
+
/** The project holding the source branch, when it is a fork of the target: its numeric id or full nested path. */
|
|
28
|
+
sourceProject?: string;
|
|
29
|
+
};
|
|
30
|
+
export type GitLabMergeRequestWriteAddress = GitLabMergeRequestWriteScope & {
|
|
31
|
+
project: string;
|
|
32
|
+
iid: string;
|
|
33
|
+
expectedMergeRequestId?: string;
|
|
34
|
+
};
|
|
35
|
+
export type GitLabMergeRequestWriteTargetOptions = GitLabMergeRequestWriteAddress & {
|
|
36
|
+
intent?: 'merge' | 'delete';
|
|
37
|
+
};
|
|
38
|
+
type GitLabMergeRequestMutationScope = GitLabMergeRequestWriteScope & {
|
|
39
|
+
projectId: string;
|
|
40
|
+
/** The target project's full path the write was approved for; a moved or renamed project reports `conflict`. */
|
|
41
|
+
expectedProjectPath?: string;
|
|
42
|
+
expectedAccountId: string;
|
|
43
|
+
};
|
|
44
|
+
type GitLabExistingMergeRequest = GitLabMergeRequestMutationScope & {
|
|
45
|
+
iid: string;
|
|
46
|
+
expectedMergeRequestId: string;
|
|
47
|
+
};
|
|
48
|
+
export type GitLabMergeRequestDeleteOptions = GitLabExistingMergeRequest & {
|
|
49
|
+
/** The state the delete was approved for; Core also deletes only if GitLab recorded no update since its read. */
|
|
50
|
+
expectedState?: GitLabMergeRequestReceipt['state'];
|
|
51
|
+
};
|
|
52
|
+
export type GitLabMergeRequestWriteOptions = (GitLabMergeRequestMutationScope & {
|
|
53
|
+
action: 'create';
|
|
54
|
+
sourceProjectId?: string;
|
|
55
|
+
sourceBranch: string;
|
|
56
|
+
targetBranch: string;
|
|
57
|
+
title: string;
|
|
58
|
+
description?: string;
|
|
59
|
+
/** GitLab marks a draft by its title, so Core prefixes the title with `Draft:`. */
|
|
60
|
+
draft?: boolean;
|
|
61
|
+
}) | (GitLabExistingMergeRequest & {
|
|
62
|
+
action: 'edit';
|
|
63
|
+
/** Keeps the draft state: Core carries the `Draft:` prefix over and refuses a title that would add one. */
|
|
64
|
+
title?: string;
|
|
65
|
+
description?: string;
|
|
66
|
+
}) | (GitLabExistingMergeRequest & {
|
|
67
|
+
action: 'close' | 'reopen';
|
|
68
|
+
}) | (GitLabExistingMergeRequest & {
|
|
69
|
+
action: 'merge';
|
|
70
|
+
squash: boolean;
|
|
71
|
+
expectedExecution: GitLabMergeExecution;
|
|
72
|
+
expectedMergeMethod: GitLabMergeMethod;
|
|
73
|
+
expectedRemovesSourceBranch: boolean;
|
|
74
|
+
expectedSourceProjectId: string;
|
|
75
|
+
expectedSourceBranch: string;
|
|
76
|
+
expectedTargetBranch: string;
|
|
77
|
+
/** GitLab checks this one atomically; the target branch and its tip are only read right before dispatch. */
|
|
78
|
+
expectedSourceSha: string;
|
|
79
|
+
expectedTargetSha: string;
|
|
80
|
+
});
|
|
81
|
+
export type GitLabMergeRequestReceipt = {
|
|
82
|
+
/** The merge request's global id. */
|
|
83
|
+
id: string;
|
|
84
|
+
iid: string;
|
|
85
|
+
url: string;
|
|
86
|
+
title: string;
|
|
87
|
+
description: string;
|
|
88
|
+
state: 'opened' | 'closed' | 'merged' | 'locked';
|
|
89
|
+
draft: boolean;
|
|
90
|
+
targetProjectId: string;
|
|
91
|
+
/** Absent once the source project, such as a fork, is gone. */
|
|
92
|
+
sourceProjectId?: string;
|
|
93
|
+
sourceBranch: string;
|
|
94
|
+
targetBranch: string;
|
|
95
|
+
/** The head commit GitLab's merge compares; absent while GitLab prepares the diff. */
|
|
96
|
+
sourceSha?: string;
|
|
97
|
+
/** The live tip of the target branch, present only where Core read it for an open merge request. */
|
|
98
|
+
targetSha?: string;
|
|
99
|
+
updatedAt?: string;
|
|
100
|
+
};
|
|
101
|
+
export type GitLabMergeRequestWriteFailure = Omit<GitLabIssueWriteFailure, 'reason'> & {
|
|
102
|
+
reason: GitLabIssueWriteFailure['reason'] | 'policy-blocked' | 'source-changed' | 'target-changed';
|
|
103
|
+
blocker?: GitLabMergeBlocker;
|
|
104
|
+
/** With a refused merge, GitLab's `detailed_merge_status`. */
|
|
105
|
+
mergeStatus?: string;
|
|
106
|
+
/** With `conflict` for a create, the open merge request GitLab already has between the two branches. */
|
|
107
|
+
mergeRequest?: GitLabMergeRequestReceipt;
|
|
108
|
+
};
|
|
109
|
+
export type GitLabMergeRequestWriteCapability = {
|
|
110
|
+
allowed: true;
|
|
111
|
+
} | {
|
|
112
|
+
allowed: false;
|
|
113
|
+
reason: Extract<GitLabMergeRequestWriteFailure['reason'], 'forbidden' | 'insufficient-scope' | 'provider-policy' | 'unsupported' | 'transition-unavailable'>;
|
|
114
|
+
};
|
|
115
|
+
export type GitLabMergeRequestMergeCapability = {
|
|
116
|
+
kind: 'available';
|
|
117
|
+
execution: GitLabMergeExecution;
|
|
118
|
+
method: GitLabMergeMethod;
|
|
119
|
+
squash: GitLabMergeSquash;
|
|
120
|
+
removesSourceBranch: boolean;
|
|
121
|
+
} | {
|
|
122
|
+
kind: 'unavailable';
|
|
123
|
+
reason: GitLabMergeRequestWriteFailure['reason'];
|
|
124
|
+
blocker?: GitLabMergeBlocker;
|
|
125
|
+
mergeStatus?: string;
|
|
126
|
+
};
|
|
127
|
+
export type GitLabMergeRequestWriteField = {
|
|
128
|
+
id: 'title' | 'description';
|
|
129
|
+
required: boolean;
|
|
130
|
+
};
|
|
131
|
+
export type GitLabMergeRequestWriteContext = Omit<GitLabMergeRequestWriteScope, 'expectedAccountId'> & {
|
|
132
|
+
accountId: string;
|
|
133
|
+
project: GitLabMergeRequestProject;
|
|
134
|
+
};
|
|
135
|
+
export type GitLabMergeRequestCreateOptionsResult = GitLabMergeRequestWriteFailure | (GitLabMergeRequestWriteContext & {
|
|
136
|
+
ok: true;
|
|
137
|
+
/** The target project itself unless the options named a fork. */
|
|
138
|
+
sourceProject: GitLabMergeRequestProject;
|
|
139
|
+
defaultBranch?: string;
|
|
140
|
+
fields: readonly GitLabMergeRequestWriteField[];
|
|
141
|
+
draft: boolean;
|
|
142
|
+
createCapability: GitLabMergeRequestWriteCapability;
|
|
143
|
+
});
|
|
144
|
+
export type GitLabMergeRequestWriteOptionsResult = GitLabMergeRequestWriteFailure | (GitLabMergeRequestWriteContext & {
|
|
145
|
+
ok: true;
|
|
146
|
+
mergeRequest: GitLabMergeRequestReceipt;
|
|
147
|
+
fields: readonly GitLabMergeRequestWriteField[];
|
|
148
|
+
capabilities: Record<'edit' | 'close' | 'reopen' | 'delete', GitLabMergeRequestWriteCapability> & {
|
|
149
|
+
merge: GitLabMergeRequestMergeCapability;
|
|
150
|
+
};
|
|
151
|
+
});
|
|
152
|
+
export type GitLabMergeRequestWriteTargetResult = GitLabMergeRequestWriteFailure | (GitLabMergeRequestWriteContext & {
|
|
153
|
+
ok: true;
|
|
154
|
+
mergeRequest: GitLabMergeRequestReceipt;
|
|
155
|
+
/** With `intent: 'merge'`, what the merge would do, for the caller to pin in its write. */
|
|
156
|
+
merge?: Extract<GitLabMergeRequestMergeCapability, {
|
|
157
|
+
kind: 'available';
|
|
158
|
+
}>;
|
|
159
|
+
});
|
|
160
|
+
export type GitLabMergeRequestWriteResult = GitLabMergeRequestWriteFailure | (GitLabMergeRequestWriteContext & {
|
|
161
|
+
ok: true;
|
|
162
|
+
/** `queued` means the merge request joined its merge train and is still open. */
|
|
163
|
+
status: 'created' | 'updated' | 'closed' | 'reopened' | 'merged' | 'queued' | 'deleted';
|
|
164
|
+
mergeRequest: GitLabMergeRequestReceipt;
|
|
165
|
+
});
|
|
166
|
+
//#endregion
|
|
167
|
+
//# sourceMappingURL=gitlabMergeRequestWrites.d.ts.map
|
|
File without changes
|
|
@@ -7,9 +7,9 @@ import { trace } from "../../../../utils/decorators/log.js";
|
|
|
7
7
|
import { PromiseCache } from "../../../../utils/promiseCache.js";
|
|
8
8
|
import __decorate from "../../../../_virtual/@oxc-project+runtime/helpers/esm/decorate.js";
|
|
9
9
|
import { AuthenticationError, RequestClientError, RequestNotFoundError, RequestRateLimitError, getDeferredRequestFailure, reportRequestFailure } from "../../../../git/errors.js";
|
|
10
|
-
import { sha256, uuid } from "../../../../utils/crypto.js";
|
|
11
10
|
import { maybeStopWatch } from "../../../../utils/stopwatch.js";
|
|
12
11
|
import { base64 } from "../../../../utils/base64.js";
|
|
12
|
+
import { sha256, uuid } from "../../../../utils/crypto.js";
|
|
13
13
|
import { effectiveIssueSort } from "../../../../git/utils/issue.utils.js";
|
|
14
14
|
import { ProviderFetchError, isRateLimitResponse, toRateLimitError } from "../../errors.js";
|
|
15
15
|
import { CommitReadRefusedError, isCommitReadRefusal, isNotFoundResponse, throwProviderError } from "../providerErrors.js";
|
|
@@ -2,9 +2,9 @@ import { chunk } from "../../../utils/array.js";
|
|
|
2
2
|
import { isCancellationError } from "../../../utils/cancellation.js";
|
|
3
3
|
import { batch, mapBounded, mapSettledBounded } from "../../../utils/promise.js";
|
|
4
4
|
import { AuthenticationError, RequestNotFoundError } from "../../../git/errors.js";
|
|
5
|
-
import { uuid } from "../../../utils/crypto.js";
|
|
6
5
|
import { parseGitRemoteUrl } from "../../../git/utils/remote.utils.js";
|
|
7
6
|
import { getGitHubNoReplyAddressParts } from "../../../git/remotes/github.js";
|
|
7
|
+
import { uuid } from "../../../utils/crypto.js";
|
|
8
8
|
import "../../../git/models/pullRequest.js";
|
|
9
9
|
import { countGitHubStackMergedLayers, decodeGitHubCheckRunId, fromGitHubCheckContextState, fromGitHubIssueOrPullRequestState, fromGitHubMergeQueueEntryState, fromGitHubMergeQueueRemoval, fromGitHubPullRequestMergeableState, fromGitHubPullRequestReviewDecision, fromGitHubPullRequestStatusCheckRollupState, toGitHubCheckRunId } from "../../git-github/models.js";
|
|
10
10
|
import { IntegrationReadUnavailableError } from "../errors.js";
|
|
@@ -10,8 +10,8 @@ import { GitLabIssueWriteScope } from "../../models/gitlabIssueWrites.js";
|
|
|
10
10
|
import { IssueEtagInclude, PullRequestEtagInclude } from "../../reads/etag.js";
|
|
11
11
|
import { IntegrationServiceContext } from "../../context.js";
|
|
12
12
|
import { ProviderApiConfig } from "../apiConfig.js";
|
|
13
|
-
import { GitLabIssueWriter } from "./issueWrites.js";
|
|
14
13
|
import { GitLabIssueEtagNode, GitLabMergeRequestEtagNode, GitLabMergeRequestState, GitLabSshKey } from "./models.js";
|
|
14
|
+
import { GitLabWriteTransport } from "./writeTransport.js";
|
|
15
15
|
//#region ../plus/integrations/src/providers/gitlab/gitlab.d.ts
|
|
16
16
|
export declare class GitLabApi implements Disposable {
|
|
17
17
|
private readonly config;
|
|
@@ -22,7 +22,7 @@ export declare class GitLabApi implements Disposable {
|
|
|
22
22
|
private _projectLookupBackoffs;
|
|
23
23
|
private _reauthenticationPrompted;
|
|
24
24
|
constructor(config: ProviderApiConfig);
|
|
25
|
-
|
|
25
|
+
getWriteTransport(scope: GitLabIssueWriteScope, session: ProviderAuthenticationSession, isCurrent: () => Promise<boolean>, isRetired: () => boolean): GitLabWriteTransport;
|
|
26
26
|
dispose(): void;
|
|
27
27
|
clearProjectLookupBackoff(provider: Provider): void;
|
|
28
28
|
private resetCaches;
|
|
@@ -13,9 +13,9 @@ import { LookupBackedOffError, ProviderFetchError, isRateLimitResponse, toRateLi
|
|
|
13
13
|
import { isNotFoundResponse } from "../providerErrors.js";
|
|
14
14
|
import { selectBranchPullRequests } from "../utils/providerPaging.js";
|
|
15
15
|
import { FailureBackoff } from "../../utils/failureBackoff.js";
|
|
16
|
+
import { GitLabWriteTransport } from "./writeTransport.js";
|
|
16
17
|
import { selectGitLabUserForCommit } from "./gitlab.utils.js";
|
|
17
18
|
import { baseProviderApiConfig } from "../apiConfig.js";
|
|
18
|
-
import { GitLabIssueWriter } from "./issueWrites.js";
|
|
19
19
|
import { fromGitLabMergeRequest, fromGitLabMergeRequestREST, fromGitLabMergeRequestState, getRepoName, getRepoNamespace, toGitLabMergeRequestState } from "./models.js";
|
|
20
20
|
import * as l10n from "@vscode/l10n";
|
|
21
21
|
import { captureReadNodes, copyReadProvenance, createReadCapture } from "@gitkraken/provider-apis/read-provenance";
|
|
@@ -59,8 +59,8 @@ var GitLabApi = class {
|
|
|
59
59
|
this.config = config;
|
|
60
60
|
this._disposable = config.onConfigChanged?.(() => this.resetCaches());
|
|
61
61
|
}
|
|
62
|
-
|
|
63
|
-
return new
|
|
62
|
+
getWriteTransport(scope, session, isCurrent, isRetired) {
|
|
63
|
+
return new GitLabWriteTransport(this.config, scope, session, isCurrent, isRetired);
|
|
64
64
|
}
|
|
65
65
|
dispose() {
|
|
66
66
|
this._disposable?.dispose();
|