@gitkraken/core-gitlens 0.3.1 → 0.4.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 +13 -1
- package/README.md +13 -10
- package/dist/git/context.d.ts +4 -3
- package/dist/git/context.d.ts.map +1 -1
- package/dist/git/context.js.map +1 -1
- package/dist/git/providers/operations.d.ts +1 -0
- package/dist/git/providers/operations.d.ts.map +1 -1
- package/dist/git/providers/worktrees.d.ts +2 -0
- package/dist/git/providers/worktrees.d.ts.map +1 -1
- package/dist/git/utils/conflictResolution.utils.d.ts +32 -0
- package/dist/git/utils/conflictResolution.utils.d.ts.map +1 -1
- package/dist/git/utils/conflictResolution.utils.js +95 -0
- package/dist/git/utils/conflictResolution.utils.js.map +1 -1
- package/dist/git-cli/providers/operations.d.ts +1 -0
- package/dist/git-cli/providers/operations.d.ts.map +1 -1
- package/dist/git-cli/providers/operations.js +22 -1
- package/dist/git-cli/providers/operations.js.map +1 -1
- package/dist/git-cli/providers/worktrees.d.ts +2 -0
- package/dist/git-cli/providers/worktrees.d.ts.map +1 -1
- package/dist/git-cli/providers/worktrees.js +3 -0
- package/dist/git-cli/providers/worktrees.js.map +1 -1
- package/dist/plus/ai/utils/ai.utils.js +5 -5
- package/dist/plus/ai/utils/ai.utils.js.map +1 -1
- package/dist/plus/git-github/api/github.d.ts +6 -13
- package/dist/plus/git-github/api/github.d.ts.map +1 -1
- package/dist/plus/git-github/api/github.js +5 -10
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/integrations/authentication/cloudIntegrationService.d.ts +11 -0
- package/dist/plus/integrations/authentication/cloudIntegrationService.d.ts.map +1 -0
- package/dist/plus/integrations/authentication/cloudIntegrationService.js +90 -0
- package/dist/plus/integrations/authentication/cloudIntegrationService.js.map +1 -0
- package/dist/plus/integrations/authentication/configuredIntegrationService.d.ts +67 -0
- package/dist/plus/integrations/authentication/configuredIntegrationService.d.ts.map +1 -0
- package/dist/plus/integrations/authentication/configuredIntegrationService.js +295 -0
- package/dist/plus/integrations/authentication/configuredIntegrationService.js.map +1 -0
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.d.ts +92 -0
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.d.ts.map +1 -0
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.js +185 -0
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.js.map +1 -0
- package/dist/plus/integrations/authentication/integrationAuthenticationService.d.ts +62 -0
- package/dist/plus/integrations/authentication/integrationAuthenticationService.d.ts.map +1 -0
- package/dist/plus/integrations/authentication/integrationAuthenticationService.js +122 -0
- package/dist/plus/integrations/authentication/integrationAuthenticationService.js.map +1 -0
- package/dist/plus/integrations/authentication/manualTokenProvider.d.ts +15 -0
- package/dist/plus/integrations/authentication/manualTokenProvider.d.ts.map +1 -0
- package/dist/plus/integrations/authentication/manualTokenProvider.js +49 -0
- package/dist/plus/integrations/authentication/manualTokenProvider.js.map +1 -0
- package/dist/plus/integrations/authentication/models.d.ts +87 -0
- package/dist/plus/integrations/authentication/models.d.ts.map +1 -0
- package/dist/plus/integrations/authentication/models.js +64 -0
- package/dist/plus/integrations/authentication/models.js.map +1 -0
- package/dist/plus/integrations/constants.d.ts +47 -0
- package/dist/plus/integrations/constants.d.ts.map +1 -0
- package/dist/plus/integrations/constants.js +128 -0
- package/dist/plus/integrations/constants.js.map +1 -0
- package/dist/plus/integrations/context.d.ts +354 -0
- package/dist/plus/integrations/context.d.ts.map +1 -0
- package/dist/plus/integrations/context.js +2 -0
- package/dist/plus/integrations/context.js.map +1 -0
- package/dist/plus/integrations/errors.d.ts +14 -0
- package/dist/plus/integrations/errors.d.ts.map +1 -0
- package/dist/plus/integrations/errors.js +19 -0
- package/dist/plus/integrations/errors.js.map +1 -0
- package/dist/plus/integrations/index.d.ts +32 -0
- package/dist/plus/integrations/index.d.ts.map +1 -0
- package/dist/plus/integrations/index.js +62 -0
- package/dist/plus/integrations/index.js.map +1 -0
- package/dist/plus/integrations/integrationService.d.ts +98 -0
- package/dist/plus/integrations/integrationService.d.ts.map +1 -0
- package/dist/plus/integrations/integrationService.js +627 -0
- package/dist/plus/integrations/integrationService.js.map +1 -0
- package/dist/plus/integrations/models/gitHostIntegration.d.ts +82 -0
- package/dist/plus/integrations/models/gitHostIntegration.d.ts.map +1 -0
- package/dist/plus/integrations/models/gitHostIntegration.js +522 -0
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -0
- package/dist/plus/integrations/models/integration.d.ts +127 -0
- package/dist/plus/integrations/models/integration.d.ts.map +1 -0
- package/dist/plus/integrations/models/integration.js +456 -0
- package/dist/plus/integrations/models/integration.js.map +1 -0
- package/dist/plus/integrations/models/issuesIntegration.d.ts +28 -0
- package/dist/plus/integrations/models/issuesIntegration.d.ts.map +1 -0
- package/dist/plus/integrations/models/issuesIntegration.js +101 -0
- package/dist/plus/integrations/models/issuesIntegration.js.map +1 -0
- package/dist/plus/integrations/providers/apiClients.d.ts +25 -0
- package/dist/plus/integrations/providers/apiClients.d.ts.map +1 -0
- package/dist/plus/integrations/providers/apiClients.js +39 -0
- package/dist/plus/integrations/providers/apiClients.js.map +1 -0
- package/dist/plus/integrations/providers/azure/azure.d.ts +47 -0
- package/dist/plus/integrations/providers/azure/azure.d.ts.map +1 -0
- package/dist/plus/integrations/providers/azure/azure.js +444 -0
- package/dist/plus/integrations/providers/azure/azure.js.map +1 -0
- package/dist/plus/integrations/providers/azure/models.d.ts +286 -0
- package/dist/plus/integrations/providers/azure/models.d.ts.map +1 -0
- package/dist/plus/integrations/providers/azure/models.js +203 -0
- package/dist/plus/integrations/providers/azure/models.js.map +1 -0
- package/dist/plus/integrations/providers/azureDevOps.d.ts +95 -0
- package/dist/plus/integrations/providers/azureDevOps.d.ts.map +1 -0
- package/dist/plus/integrations/providers/azureDevOps.js +432 -0
- package/dist/plus/integrations/providers/azureDevOps.js.map +1 -0
- package/dist/plus/integrations/providers/bitbucket/bitbucket.d.ts +42 -0
- package/dist/plus/integrations/providers/bitbucket/bitbucket.d.ts.map +1 -0
- package/dist/plus/integrations/providers/bitbucket/bitbucket.js +513 -0
- package/dist/plus/integrations/providers/bitbucket/bitbucket.js.map +1 -0
- package/dist/plus/integrations/providers/bitbucket/models.d.ts +222 -0
- package/dist/plus/integrations/providers/bitbucket/models.d.ts.map +1 -0
- package/dist/plus/integrations/providers/bitbucket/models.js +158 -0
- package/dist/plus/integrations/providers/bitbucket/models.js.map +1 -0
- package/dist/plus/integrations/providers/bitbucket-server/models.d.ts +120 -0
- package/dist/plus/integrations/providers/bitbucket-server/models.d.ts.map +1 -0
- package/dist/plus/integrations/providers/bitbucket-server/models.js +111 -0
- package/dist/plus/integrations/providers/bitbucket-server/models.js.map +1 -0
- package/dist/plus/integrations/providers/bitbucket-server.d.ts +60 -0
- package/dist/plus/integrations/providers/bitbucket-server.d.ts.map +1 -0
- package/dist/plus/integrations/providers/bitbucket-server.js +138 -0
- package/dist/plus/integrations/providers/bitbucket-server.js.map +1 -0
- package/dist/plus/integrations/providers/bitbucket.d.ts +50 -0
- package/dist/plus/integrations/providers/bitbucket.d.ts.map +1 -0
- package/dist/plus/integrations/providers/bitbucket.js +181 -0
- package/dist/plus/integrations/providers/bitbucket.js.map +1 -0
- package/dist/plus/integrations/providers/github/github.d.ts +5 -0
- package/dist/plus/integrations/providers/github/github.d.ts.map +1 -0
- package/dist/plus/integrations/providers/github/github.js +47 -0
- package/dist/plus/integrations/providers/github/github.js.map +1 -0
- package/dist/plus/integrations/providers/github/github.utils.d.ts +11 -0
- package/dist/plus/integrations/providers/github/github.utils.d.ts.map +1 -0
- package/dist/plus/integrations/providers/github/github.utils.js +6 -0
- package/dist/plus/integrations/providers/github/github.utils.js.map +1 -0
- package/dist/plus/integrations/providers/github/models.d.ts +3 -0
- package/dist/plus/integrations/providers/github/models.d.ts.map +1 -0
- package/dist/plus/integrations/providers/github/models.js +2 -0
- package/dist/plus/integrations/providers/github/models.js.map +1 -0
- package/dist/plus/integrations/providers/github.d.ts +73 -0
- package/dist/plus/integrations/providers/github.d.ts.map +1 -0
- package/dist/plus/integrations/providers/github.js +160 -0
- package/dist/plus/integrations/providers/github.js.map +1 -0
- package/dist/plus/integrations/providers/gitlab/gitlab.d.ts +63 -0
- package/dist/plus/integrations/providers/gitlab/gitlab.d.ts.map +1 -0
- package/dist/plus/integrations/providers/gitlab/gitlab.js +828 -0
- package/dist/plus/integrations/providers/gitlab/gitlab.js.map +1 -0
- package/dist/plus/integrations/providers/gitlab/gitlab.utils.d.ts +21 -0
- package/dist/plus/integrations/providers/gitlab/gitlab.utils.d.ts.map +1 -0
- package/dist/plus/integrations/providers/gitlab/gitlab.utils.js +45 -0
- package/dist/plus/integrations/providers/gitlab/gitlab.utils.js.map +1 -0
- package/dist/plus/integrations/providers/gitlab/models.d.ts +128 -0
- package/dist/plus/integrations/providers/gitlab/models.d.ts.map +1 -0
- package/dist/plus/integrations/providers/gitlab/models.js +96 -0
- package/dist/plus/integrations/providers/gitlab/models.js.map +1 -0
- package/dist/plus/integrations/providers/gitlab.d.ts +79 -0
- package/dist/plus/integrations/providers/gitlab.d.ts.map +1 -0
- package/dist/plus/integrations/providers/gitlab.js +253 -0
- package/dist/plus/integrations/providers/gitlab.js.map +1 -0
- package/dist/plus/integrations/providers/jira.d.ts +46 -0
- package/dist/plus/integrations/providers/jira.d.ts.map +1 -0
- package/dist/plus/integrations/providers/jira.js +255 -0
- package/dist/plus/integrations/providers/jira.js.map +1 -0
- package/dist/plus/integrations/providers/linear.d.ts +47 -0
- package/dist/plus/integrations/providers/linear.d.ts.map +1 -0
- package/dist/plus/integrations/providers/linear.js +198 -0
- package/dist/plus/integrations/providers/linear.js.map +1 -0
- package/dist/plus/integrations/providers/models.d.ts +433 -0
- package/dist/plus/integrations/providers/models.d.ts.map +1 -0
- package/dist/plus/integrations/providers/models.js +602 -0
- package/dist/plus/integrations/providers/models.js.map +1 -0
- package/dist/plus/integrations/providers/providersApi.d.ts +129 -0
- package/dist/plus/integrations/providers/providersApi.d.ts.map +1 -0
- package/dist/plus/integrations/providers/providersApi.js +602 -0
- package/dist/plus/integrations/providers/providersApi.js.map +1 -0
- package/dist/plus/integrations/providers/utils.d.ts +54 -0
- package/dist/plus/integrations/providers/utils.d.ts.map +1 -0
- package/dist/plus/integrations/providers/utils.js +262 -0
- package/dist/plus/integrations/providers/utils.js.map +1 -0
- package/dist/plus/integrations/telemetry.d.ts +26 -0
- package/dist/plus/integrations/telemetry.d.ts.map +1 -0
- package/dist/plus/integrations/telemetry.js +11 -0
- package/dist/plus/integrations/telemetry.js.map +1 -0
- package/dist/plus/integrations/utils/integration.utils.d.ts +14 -0
- package/dist/plus/integrations/utils/integration.utils.d.ts.map +1 -0
- package/dist/plus/integrations/utils/integration.utils.js +111 -0
- package/dist/plus/integrations/utils/integration.utils.js.map +1 -0
- package/dist/utils/disposable.d.ts +15 -2
- package/dist/utils/disposable.d.ts.map +1 -1
- package/dist/utils/disposable.js.map +1 -1
- package/package.json +43 -2
- package/src/git/context.ts +4 -3
- package/src/git/providers/operations.ts +1 -1
- package/src/git/providers/worktrees.ts +14 -2
- package/src/git/utils/conflictResolution.utils.ts +126 -0
- package/src/git-cli/providers/operations.ts +22 -2
- package/src/git-cli/providers/worktrees.ts +17 -2
- package/src/plus/ai/utils/ai.utils.ts +5 -5
- package/src/plus/git-github/api/github.ts +13 -25
- package/src/plus/integrations/authentication/cloudIntegrationService.ts +120 -0
- package/src/plus/integrations/authentication/configuredIntegrationService.ts +414 -0
- package/src/plus/integrations/authentication/integrationAuthenticationProvider.ts +289 -0
- package/src/plus/integrations/authentication/integrationAuthenticationService.ts +144 -0
- package/src/plus/integrations/authentication/manualTokenProvider.ts +72 -0
- package/src/plus/integrations/authentication/models.ts +168 -0
- package/src/plus/integrations/constants.ts +169 -0
- package/src/plus/integrations/context.ts +383 -0
- package/src/plus/integrations/errors.ts +35 -0
- package/src/plus/integrations/index.ts +119 -0
- package/src/plus/integrations/integrationService.ts +924 -0
- package/src/plus/integrations/models/gitHostIntegration.ts +738 -0
- package/src/plus/integrations/models/integration.ts +657 -0
- package/src/plus/integrations/models/issuesIntegration.ts +124 -0
- package/src/plus/integrations/providers/apiClients.ts +72 -0
- package/src/plus/integrations/providers/azure/azure.ts +691 -0
- package/src/plus/integrations/providers/azure/models.ts +605 -0
- package/src/plus/integrations/providers/azureDevOps.ts +677 -0
- package/src/plus/integrations/providers/bitbucket/bitbucket.ts +774 -0
- package/src/plus/integrations/providers/bitbucket/models.ts +445 -0
- package/src/plus/integrations/providers/bitbucket-server/models.ts +252 -0
- package/src/plus/integrations/providers/bitbucket-server.ts +282 -0
- package/src/plus/integrations/providers/bitbucket.ts +350 -0
- package/src/plus/integrations/providers/github/github.ts +64 -0
- package/src/plus/integrations/providers/github/github.utils.ts +23 -0
- package/src/plus/integrations/providers/github/models.ts +29 -0
- package/src/plus/integrations/providers/github.ts +366 -0
- package/src/plus/integrations/providers/gitlab/gitlab.ts +1210 -0
- package/src/plus/integrations/providers/gitlab/gitlab.utils.ts +71 -0
- package/src/plus/integrations/providers/gitlab/models.ts +257 -0
- package/src/plus/integrations/providers/gitlab.ts +473 -0
- package/src/plus/integrations/providers/jira.ts +359 -0
- package/src/plus/integrations/providers/linear.ts +275 -0
- package/src/plus/integrations/providers/models.ts +1114 -0
- package/src/plus/integrations/providers/providersApi.ts +1126 -0
- package/src/plus/integrations/providers/utils.ts +359 -0
- package/src/plus/integrations/telemetry.ts +29 -0
- package/src/plus/integrations/utils/integration.utils.ts +138 -0
- package/src/utils/disposable.ts +15 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disposable.js","sourceRoot":"","sources":["../../src/utils/disposable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"disposable.js","sourceRoot":"","sources":["../../src/utils/disposable.ts"],"names":[],"mappings":"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"}
|
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.4.0",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "GitKraken",
|
|
@@ -138,6 +138,46 @@
|
|
|
138
138
|
"types": "./dist/plus/git-github/providers/github/*.d.ts",
|
|
139
139
|
"default": "./dist/plus/git-github/providers/github/*.js"
|
|
140
140
|
},
|
|
141
|
+
"./plus/integrations/*.js": {
|
|
142
|
+
"types": "./dist/plus/integrations/*.d.ts",
|
|
143
|
+
"default": "./dist/plus/integrations/*.js"
|
|
144
|
+
},
|
|
145
|
+
"./plus/integrations/authentication/*.js": {
|
|
146
|
+
"types": "./dist/plus/integrations/authentication/*.d.ts",
|
|
147
|
+
"default": "./dist/plus/integrations/authentication/*.js"
|
|
148
|
+
},
|
|
149
|
+
"./plus/integrations/models/*.js": {
|
|
150
|
+
"types": "./dist/plus/integrations/models/*.d.ts",
|
|
151
|
+
"default": "./dist/plus/integrations/models/*.js"
|
|
152
|
+
},
|
|
153
|
+
"./plus/integrations/providers/*.js": {
|
|
154
|
+
"types": "./dist/plus/integrations/providers/*.d.ts",
|
|
155
|
+
"default": "./dist/plus/integrations/providers/*.js"
|
|
156
|
+
},
|
|
157
|
+
"./plus/integrations/providers/azure/*.js": {
|
|
158
|
+
"types": "./dist/plus/integrations/providers/azure/*.d.ts",
|
|
159
|
+
"default": "./dist/plus/integrations/providers/azure/*.js"
|
|
160
|
+
},
|
|
161
|
+
"./plus/integrations/providers/bitbucket-server/*.js": {
|
|
162
|
+
"types": "./dist/plus/integrations/providers/bitbucket-server/*.d.ts",
|
|
163
|
+
"default": "./dist/plus/integrations/providers/bitbucket-server/*.js"
|
|
164
|
+
},
|
|
165
|
+
"./plus/integrations/providers/bitbucket/*.js": {
|
|
166
|
+
"types": "./dist/plus/integrations/providers/bitbucket/*.d.ts",
|
|
167
|
+
"default": "./dist/plus/integrations/providers/bitbucket/*.js"
|
|
168
|
+
},
|
|
169
|
+
"./plus/integrations/providers/github/*.js": {
|
|
170
|
+
"types": "./dist/plus/integrations/providers/github/*.d.ts",
|
|
171
|
+
"default": "./dist/plus/integrations/providers/github/*.js"
|
|
172
|
+
},
|
|
173
|
+
"./plus/integrations/providers/gitlab/*.js": {
|
|
174
|
+
"types": "./dist/plus/integrations/providers/gitlab/*.d.ts",
|
|
175
|
+
"default": "./dist/plus/integrations/providers/gitlab/*.js"
|
|
176
|
+
},
|
|
177
|
+
"./plus/integrations/utils/*.js": {
|
|
178
|
+
"types": "./dist/plus/integrations/utils/*.d.ts",
|
|
179
|
+
"default": "./dist/plus/integrations/utils/*.js"
|
|
180
|
+
},
|
|
141
181
|
"./utils/*.js": {
|
|
142
182
|
"types": "./dist/utils/*.d.ts",
|
|
143
183
|
"default": "./dist/utils/*.js"
|
|
@@ -156,8 +196,9 @@
|
|
|
156
196
|
}
|
|
157
197
|
},
|
|
158
198
|
"dependencies": {
|
|
199
|
+
"@gitkraken/provider-apis": "0.40.0",
|
|
159
200
|
"@octokit/graphql": "9.0.3",
|
|
160
|
-
"@octokit/request": "10.0.
|
|
201
|
+
"@octokit/request": "10.0.10",
|
|
161
202
|
"@octokit/request-error": "7.1.0",
|
|
162
203
|
"@octokit/types": "16.0.0",
|
|
163
204
|
"fast-string-truncated-width": "3.0.3",
|
package/src/git/context.ts
CHANGED
|
@@ -137,9 +137,10 @@ export interface GitServiceHooks {
|
|
|
137
137
|
/**
|
|
138
138
|
* Called when a commit is signed successfully.
|
|
139
139
|
*
|
|
140
|
-
* Note: currently fired only from explicit-sign paths
|
|
141
|
-
*
|
|
142
|
-
* that sign implicitly via
|
|
140
|
+
* Note: currently fired only from explicit-sign paths — the patch provider's
|
|
141
|
+
* `commit-tree -S` and the commit operation when the host signing override
|
|
142
|
+
* (`config.signing.enabled`) adds `-S`. Operations that sign implicitly via
|
|
143
|
+
* `commit.gpgsign=true` (`commit` without the override, `merge`, `pull`,
|
|
143
144
|
* `rebase`, `revert`, `cherryPick`) do not fire this hook because the
|
|
144
145
|
* library cannot cheaply confirm that signing actually occurred without an
|
|
145
146
|
* extra `git config`/`log --show-signature` call.
|
|
@@ -28,7 +28,7 @@ export interface GitOperationsSubProvider {
|
|
|
28
28
|
checkout(
|
|
29
29
|
repoPath: string,
|
|
30
30
|
ref: string,
|
|
31
|
-
options?: { createBranch?: string | undefined },
|
|
31
|
+
options?: { createBranch?: string | undefined; noTracking?: boolean },
|
|
32
32
|
runOptions?: GitOperationRunOptions,
|
|
33
33
|
): Promise<void>;
|
|
34
34
|
cherryPick(
|
|
@@ -5,12 +5,24 @@ export interface GitWorktreesSubProvider {
|
|
|
5
5
|
createWorktree(
|
|
6
6
|
repoPath: string,
|
|
7
7
|
path: string,
|
|
8
|
-
options?: {
|
|
8
|
+
options?: {
|
|
9
|
+
commitish?: string;
|
|
10
|
+
createBranch?: string;
|
|
11
|
+
detach?: boolean;
|
|
12
|
+
force?: boolean;
|
|
13
|
+
noTracking?: boolean;
|
|
14
|
+
},
|
|
9
15
|
): Promise<void>;
|
|
10
16
|
createWorktreeWithResult(
|
|
11
17
|
repoPath: string,
|
|
12
18
|
path: string,
|
|
13
|
-
options?: {
|
|
19
|
+
options?: {
|
|
20
|
+
commitish?: string;
|
|
21
|
+
createBranch?: string;
|
|
22
|
+
detach?: boolean;
|
|
23
|
+
force?: boolean;
|
|
24
|
+
noTracking?: boolean;
|
|
25
|
+
},
|
|
14
26
|
): Promise<GitWorktree | undefined>;
|
|
15
27
|
getWorktree(
|
|
16
28
|
repoPath: string,
|
|
@@ -2,6 +2,71 @@ import type { GitFileConflictStatus } from '../models/fileStatus.js';
|
|
|
2
2
|
|
|
3
3
|
export type ConflictResolutionAction = 'take-ours' | 'take-theirs' | 'delete' | 'unsupported';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* A richer description of a conflict than the raw XY status code — used to label conflicts the
|
|
7
|
+
* AI text resolver can't parse (binary, symlink, submodule, mode-only, add/add) and to surface
|
|
8
|
+
* rename conflicts. Derived by {@link classifyConflictKind} from the XY status plus, when
|
|
9
|
+
* available, the per-stage file modes/oids and rename/binary hints the caller computes.
|
|
10
|
+
*/
|
|
11
|
+
export type ConflictKind =
|
|
12
|
+
| 'text'
|
|
13
|
+
| 'binary'
|
|
14
|
+
| 'symlink'
|
|
15
|
+
| 'submodule'
|
|
16
|
+
| 'mode-only'
|
|
17
|
+
| 'add-add'
|
|
18
|
+
| 'delete-modify'
|
|
19
|
+
| 'both-deleted'
|
|
20
|
+
| 'rename-rename'
|
|
21
|
+
| 'rename-delete'
|
|
22
|
+
| 'rename-modify'
|
|
23
|
+
| 'unknown';
|
|
24
|
+
|
|
25
|
+
export type ConflictRenameKind = 'rename-rename' | 'rename-delete' | 'rename-modify';
|
|
26
|
+
|
|
27
|
+
const symlinkMode = '120000';
|
|
28
|
+
const submoduleMode = '160000';
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Classifies a conflict into a {@link ConflictKind}. Pure — all detection that needs git/IO
|
|
32
|
+
* (rename correlation, binary sniffing) is computed by the caller and passed via `hints`. When
|
|
33
|
+
* `modes`/`oids` are omitted (e.g. a webview caller that only has the XY status), it still returns
|
|
34
|
+
* a useful coarse kind; pass the per-stage data for the fine-grained symlink/submodule/mode-only split.
|
|
35
|
+
*/
|
|
36
|
+
export function classifyConflictKind(
|
|
37
|
+
status: GitFileConflictStatus,
|
|
38
|
+
modes?: { base?: string; current?: string; incoming?: string },
|
|
39
|
+
oids?: { base?: string; current?: string; incoming?: string },
|
|
40
|
+
hints?: { binary?: boolean; rename?: ConflictRenameKind },
|
|
41
|
+
): ConflictKind {
|
|
42
|
+
if (hints?.rename != null) return hints.rename;
|
|
43
|
+
|
|
44
|
+
if (status === 'DD') return 'both-deleted';
|
|
45
|
+
if (status === 'UD' || status === 'DU') return 'delete-modify';
|
|
46
|
+
|
|
47
|
+
const presentModes = [modes?.current, modes?.incoming, modes?.base].filter((m): m is string => m != null);
|
|
48
|
+
if (presentModes.includes(submoduleMode)) return 'submodule';
|
|
49
|
+
if (presentModes.includes(symlinkMode)) return 'symlink';
|
|
50
|
+
|
|
51
|
+
if (hints?.binary) return 'binary';
|
|
52
|
+
|
|
53
|
+
// Both sides present with identical content (same oid) but different mode → only the file mode
|
|
54
|
+
// conflicts (e.g. one side flipped the executable bit).
|
|
55
|
+
if (
|
|
56
|
+
modes?.current != null &&
|
|
57
|
+
modes?.incoming != null &&
|
|
58
|
+
modes.current !== modes.incoming &&
|
|
59
|
+
oids?.current != null &&
|
|
60
|
+
oids.current === oids?.incoming
|
|
61
|
+
) {
|
|
62
|
+
return 'mode-only';
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (status === 'AA' || status === 'AU' || status === 'UA') return 'add-add';
|
|
66
|
+
|
|
67
|
+
return 'text';
|
|
68
|
+
}
|
|
69
|
+
|
|
5
70
|
export function classifyConflictAction(
|
|
6
71
|
status: GitFileConflictStatus,
|
|
7
72
|
resolution: 'current' | 'incoming',
|
|
@@ -29,3 +94,64 @@ export function canStageCurrent(status: GitFileConflictStatus): boolean {
|
|
|
29
94
|
export function canStageIncoming(status: GitFileConflictStatus): boolean {
|
|
30
95
|
return status !== 'AU' && status !== 'DD';
|
|
31
96
|
}
|
|
97
|
+
|
|
98
|
+
/** A short label + one-line description for a {@link ConflictKind}, used to explain conflicts the AI
|
|
99
|
+
* resolver can't auto-merge (and rename conflicts) wherever they're surfaced. */
|
|
100
|
+
export function getConflictKindLabel(kind: ConflictKind, renameOf?: string): { label: string; description: string } {
|
|
101
|
+
const named = renameOf ? `"${renameOf}"` : 'The file';
|
|
102
|
+
switch (kind) {
|
|
103
|
+
case 'binary':
|
|
104
|
+
return {
|
|
105
|
+
label: 'Binary conflict',
|
|
106
|
+
description: 'Binary file changed on both sides — choose a side to keep',
|
|
107
|
+
};
|
|
108
|
+
case 'symlink':
|
|
109
|
+
return {
|
|
110
|
+
label: 'Symlink conflict',
|
|
111
|
+
description: 'Symbolic link changed on both sides — choose a side to keep',
|
|
112
|
+
};
|
|
113
|
+
case 'submodule':
|
|
114
|
+
return {
|
|
115
|
+
label: 'Submodule conflict',
|
|
116
|
+
description: 'Submodule reference changed on both sides — choose a side to keep',
|
|
117
|
+
};
|
|
118
|
+
case 'mode-only':
|
|
119
|
+
return {
|
|
120
|
+
label: 'File mode conflict',
|
|
121
|
+
description: 'Only the file mode differs (e.g. the executable bit) — choose a side to keep',
|
|
122
|
+
};
|
|
123
|
+
case 'add-add':
|
|
124
|
+
// Covers AA (added on both sides) as well as AU/UA (added on one side) — keep the wording
|
|
125
|
+
// accurate for all three rather than asserting "both sides".
|
|
126
|
+
return {
|
|
127
|
+
label: 'Add conflict',
|
|
128
|
+
description: 'Conflicting file additions — choose a side to keep',
|
|
129
|
+
};
|
|
130
|
+
case 'delete-modify':
|
|
131
|
+
return {
|
|
132
|
+
label: 'Modified and deleted',
|
|
133
|
+
description: 'Deleted on one side and modified on the other — keep the file or delete it',
|
|
134
|
+
};
|
|
135
|
+
case 'both-deleted':
|
|
136
|
+
return { label: 'Deleted on both sides', description: 'Deleted on both sides — confirm the deletion' };
|
|
137
|
+
case 'rename-rename':
|
|
138
|
+
return {
|
|
139
|
+
label: 'Renamed differently',
|
|
140
|
+
description: `${named} was renamed differently on each side — choose which name to keep`,
|
|
141
|
+
};
|
|
142
|
+
case 'rename-delete':
|
|
143
|
+
return {
|
|
144
|
+
label: 'Renamed and deleted',
|
|
145
|
+
description: `${named} was renamed on one side and deleted on the other — keep the file or delete it`,
|
|
146
|
+
};
|
|
147
|
+
case 'rename-modify':
|
|
148
|
+
return {
|
|
149
|
+
label: 'Renamed and modified',
|
|
150
|
+
description: `${named} was renamed on one side and modified on the other`,
|
|
151
|
+
};
|
|
152
|
+
case 'text':
|
|
153
|
+
return { label: 'Text conflict', description: 'Conflicting changes on both sides' };
|
|
154
|
+
default:
|
|
155
|
+
return { label: 'Conflict', description: 'Resolve this conflict manually' };
|
|
156
|
+
}
|
|
157
|
+
}
|
|
@@ -52,14 +52,18 @@ export class OperationsGitSubProvider implements GitOperationsSubProvider {
|
|
|
52
52
|
async checkout(
|
|
53
53
|
repoPath: string,
|
|
54
54
|
ref: string,
|
|
55
|
-
options?: { createBranch?: string },
|
|
55
|
+
options?: { createBranch?: string; noTracking?: boolean },
|
|
56
56
|
runOptions?: GitOperationRunOptions,
|
|
57
57
|
): Promise<void> {
|
|
58
58
|
const scope = getScopedLogger();
|
|
59
59
|
|
|
60
60
|
const params = ['checkout'];
|
|
61
61
|
if (options?.createBranch) {
|
|
62
|
-
params.push('-b', options.createBranch
|
|
62
|
+
params.push('-b', options.createBranch);
|
|
63
|
+
if (options.noTracking) {
|
|
64
|
+
params.push('--no-track');
|
|
65
|
+
}
|
|
66
|
+
params.push(ref, '--');
|
|
63
67
|
} else {
|
|
64
68
|
params.push(ref, '--');
|
|
65
69
|
}
|
|
@@ -183,6 +187,13 @@ export class OperationsGitSubProvider implements GitOperationsSubProvider {
|
|
|
183
187
|
if (options?.date) {
|
|
184
188
|
params.push(`--date=${options.date}`);
|
|
185
189
|
}
|
|
190
|
+
// Host-level override (e.g. VS Code's `git.enableCommitSigning`) — request signing explicitly
|
|
191
|
+
// via `-S`. Implicit repo-config signing (`commit.gpgsign=true`) needs no flag, and `-S`
|
|
192
|
+
// alongside it is harmless, so the override can only enable signing, never force it off.
|
|
193
|
+
const sign = this.context.config?.signing?.enabled === true;
|
|
194
|
+
if (sign) {
|
|
195
|
+
params.push('-S');
|
|
196
|
+
}
|
|
186
197
|
// Read commit message from stdin via -F - to avoid shell escaping issues
|
|
187
198
|
params.push('-F', '-');
|
|
188
199
|
|
|
@@ -193,6 +204,15 @@ export class OperationsGitSubProvider implements GitOperationsSubProvider {
|
|
|
193
204
|
);
|
|
194
205
|
this.context.hooks?.cache?.onReset?.(repoPath, 'branches', 'status');
|
|
195
206
|
this.context.hooks?.repository?.onChanged?.(repoPath, ['head', 'heads', 'index']);
|
|
207
|
+
if (sign) {
|
|
208
|
+
// `-S` was passed and the commit succeeded, so signing is confirmed — fire the
|
|
209
|
+
// explicit-sign hook (same contract as the patch provider's `commit-tree -S` path).
|
|
210
|
+
let format: SigningFormat | undefined;
|
|
211
|
+
try {
|
|
212
|
+
format = (await this.provider.config.getSigningConfig?.(repoPath))?.format;
|
|
213
|
+
} catch {}
|
|
214
|
+
this.context.hooks?.commits?.onSigned?.(format ?? 'gpg', options?.source);
|
|
215
|
+
}
|
|
196
216
|
} catch (ex) {
|
|
197
217
|
scope?.error(ex);
|
|
198
218
|
await this.throwIfSigningError(repoPath, params, ex, options?.source);
|
|
@@ -29,7 +29,13 @@ export class WorktreesGitSubProvider implements GitWorktreesSubProvider {
|
|
|
29
29
|
async createWorktree(
|
|
30
30
|
repoPath: string,
|
|
31
31
|
path: string,
|
|
32
|
-
options?: {
|
|
32
|
+
options?: {
|
|
33
|
+
commitish?: string;
|
|
34
|
+
createBranch?: string;
|
|
35
|
+
detach?: boolean;
|
|
36
|
+
force?: boolean;
|
|
37
|
+
noTracking?: boolean;
|
|
38
|
+
},
|
|
33
39
|
): Promise<void> {
|
|
34
40
|
const scope = getScopedLogger();
|
|
35
41
|
|
|
@@ -40,6 +46,9 @@ export class WorktreesGitSubProvider implements GitWorktreesSubProvider {
|
|
|
40
46
|
if (options?.createBranch) {
|
|
41
47
|
args.push('-b', options.createBranch);
|
|
42
48
|
}
|
|
49
|
+
if (options?.createBranch && options.noTracking) {
|
|
50
|
+
args.push('--no-track');
|
|
51
|
+
}
|
|
43
52
|
if (options?.detach) {
|
|
44
53
|
args.push('--detach');
|
|
45
54
|
}
|
|
@@ -76,7 +85,13 @@ export class WorktreesGitSubProvider implements GitWorktreesSubProvider {
|
|
|
76
85
|
async createWorktreeWithResult(
|
|
77
86
|
repoPath: string,
|
|
78
87
|
path: string,
|
|
79
|
-
options?: {
|
|
88
|
+
options?: {
|
|
89
|
+
commitish?: string;
|
|
90
|
+
createBranch?: string;
|
|
91
|
+
detach?: boolean;
|
|
92
|
+
force?: boolean;
|
|
93
|
+
noTracking?: boolean;
|
|
94
|
+
},
|
|
80
95
|
): Promise<GitWorktree | undefined> {
|
|
81
96
|
await this.createWorktree(repoPath, path, options);
|
|
82
97
|
const normalized = normalizePath(path);
|
|
@@ -11,19 +11,19 @@ export function getActionName(action: AIActionType): string {
|
|
|
11
11
|
case 'generate-stashMessage':
|
|
12
12
|
return 'Generate Stash Message';
|
|
13
13
|
case 'generate-changelog':
|
|
14
|
-
return 'Generate Changelog
|
|
14
|
+
return 'Generate Changelog';
|
|
15
15
|
case 'generate-create-cloudPatch':
|
|
16
16
|
return 'Create Cloud Patch Details';
|
|
17
17
|
case 'generate-create-codeSuggestion':
|
|
18
18
|
return 'Create Code Suggestion Details';
|
|
19
19
|
case 'generate-create-pullRequest':
|
|
20
|
-
return 'Create Pull Request Details
|
|
20
|
+
return 'Create Pull Request Details';
|
|
21
21
|
case 'generate-commits':
|
|
22
|
-
return 'Generate Commits
|
|
22
|
+
return 'Generate Commits';
|
|
23
23
|
case 'conflict-resolution':
|
|
24
|
-
return 'Resolve Conflicts
|
|
24
|
+
return 'Resolve Conflicts (Preview)';
|
|
25
25
|
case 'generate-searchQuery':
|
|
26
|
-
return 'Generate Search Query
|
|
26
|
+
return 'Generate Search Query';
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -66,11 +66,6 @@ import {
|
|
|
66
66
|
import type { GitHubApiConfig } from './config.js';
|
|
67
67
|
import type { GitHubTokenInfo } from './token.js';
|
|
68
68
|
|
|
69
|
-
interface CancellationToken {
|
|
70
|
-
isCancellationRequested: boolean;
|
|
71
|
-
onCancellationRequested(fn: () => void): { dispose(): void };
|
|
72
|
-
}
|
|
73
|
-
|
|
74
69
|
const emptyPagedResult: PagedResult<any> = Object.freeze({ values: [] });
|
|
75
70
|
const emptyBlameResult: GitHubBlame = Object.freeze({ ranges: [] });
|
|
76
71
|
|
|
@@ -959,7 +954,7 @@ export class GitHubApi {
|
|
|
959
954
|
baseUrl?: string;
|
|
960
955
|
avatarSize?: number;
|
|
961
956
|
},
|
|
962
|
-
cancellation?:
|
|
957
|
+
cancellation?: AbortSignal,
|
|
963
958
|
): Promise<PullRequest | undefined> {
|
|
964
959
|
const scope = getScopedLogger();
|
|
965
960
|
|
|
@@ -1049,7 +1044,7 @@ export class GitHubApi {
|
|
|
1049
1044
|
options?: {
|
|
1050
1045
|
baseUrl?: string;
|
|
1051
1046
|
},
|
|
1052
|
-
cancellation?:
|
|
1047
|
+
cancellation?: AbortSignal,
|
|
1053
1048
|
): Promise<RepositoryMetadata | undefined> {
|
|
1054
1049
|
const scope = getScopedLogger();
|
|
1055
1050
|
|
|
@@ -2965,10 +2960,9 @@ export class GitHubApi {
|
|
|
2965
2960
|
query: string,
|
|
2966
2961
|
variables: RequestParameters,
|
|
2967
2962
|
scope: ScopedLogger | undefined,
|
|
2968
|
-
cancellation?:
|
|
2963
|
+
cancellation?: AbortSignal | undefined,
|
|
2969
2964
|
): Promise<T | undefined> {
|
|
2970
2965
|
const { accessToken, ...tokenInfo } = token;
|
|
2971
|
-
|
|
2972
2966
|
// Only dedupe when no cancellation/request option is in play — sharing a promise that
|
|
2973
2967
|
// carries one caller's AbortSignal would let one cancellation cancel for everyone.
|
|
2974
2968
|
const dedupable = cancellation == null && variables?.request == null;
|
|
@@ -2988,16 +2982,12 @@ export class GitHubApi {
|
|
|
2988
2982
|
|
|
2989
2983
|
const run = async (): Promise<T | undefined> => {
|
|
2990
2984
|
try {
|
|
2991
|
-
let aborter: AbortController | undefined;
|
|
2992
2985
|
if (cancellation != null) {
|
|
2993
|
-
if (cancellation.
|
|
2994
|
-
|
|
2995
|
-
aborter = new AbortController();
|
|
2996
|
-
cancellation.onCancellationRequested(() => aborter!.abort());
|
|
2986
|
+
if (cancellation.aborted) throw new CancellationError();
|
|
2997
2987
|
|
|
2998
2988
|
variables = {
|
|
2999
2989
|
...variables,
|
|
3000
|
-
request: { ...variables?.request, signal:
|
|
2990
|
+
request: { ...variables?.request, signal: cancellation },
|
|
3001
2991
|
};
|
|
3002
2992
|
}
|
|
3003
2993
|
|
|
@@ -3010,7 +3000,7 @@ export class GitHubApi {
|
|
|
3010
3000
|
this.getDefaults(accessToken, graphql)(query, variables),
|
|
3011
3001
|
),
|
|
3012
3002
|
retryable,
|
|
3013
|
-
|
|
3003
|
+
cancellation,
|
|
3014
3004
|
scope,
|
|
3015
3005
|
);
|
|
3016
3006
|
} catch (ex) {
|
|
@@ -3071,17 +3061,15 @@ export class GitHubApi {
|
|
|
3071
3061
|
route: R,
|
|
3072
3062
|
options: (Endpoints[R]['parameters'] & RequestParameters) | undefined,
|
|
3073
3063
|
scope: ScopedLogger | undefined,
|
|
3074
|
-
cancellation?:
|
|
3064
|
+
cancellation?: AbortSignal | undefined,
|
|
3075
3065
|
): Promise<Endpoints[R]['response']> {
|
|
3076
3066
|
const { accessToken } = token;
|
|
3077
3067
|
try {
|
|
3078
3068
|
let signal: AbortSignal | undefined;
|
|
3079
3069
|
if (cancellation != null) {
|
|
3080
|
-
if (cancellation.
|
|
3070
|
+
if (cancellation.aborted) throw new CancellationError();
|
|
3081
3071
|
|
|
3082
|
-
|
|
3083
|
-
cancellation.onCancellationRequested(() => aborter.abort());
|
|
3084
|
-
signal = aborter.signal;
|
|
3072
|
+
signal = cancellation;
|
|
3085
3073
|
options = { ...options, request: { ...options?.request, signal: signal } };
|
|
3086
3074
|
}
|
|
3087
3075
|
|
|
@@ -3330,7 +3318,7 @@ export class GitHubApi {
|
|
|
3330
3318
|
avatarSize?: number;
|
|
3331
3319
|
silent?: boolean;
|
|
3332
3320
|
},
|
|
3333
|
-
cancellation?:
|
|
3321
|
+
cancellation?: AbortSignal,
|
|
3334
3322
|
): Promise<PullRequest[]> {
|
|
3335
3323
|
const scope = getScopedLogger();
|
|
3336
3324
|
|
|
@@ -3445,7 +3433,7 @@ export class GitHubApi {
|
|
|
3445
3433
|
avatarSize?: number;
|
|
3446
3434
|
includeBody?: boolean;
|
|
3447
3435
|
},
|
|
3448
|
-
cancellation?:
|
|
3436
|
+
cancellation?: AbortSignal,
|
|
3449
3437
|
): Promise<IssueShape[] | undefined> {
|
|
3450
3438
|
const scope = getScopedLogger();
|
|
3451
3439
|
|
|
@@ -3548,7 +3536,7 @@ export class GitHubApi {
|
|
|
3548
3536
|
provider: Provider,
|
|
3549
3537
|
token: GitHubTokenInfo,
|
|
3550
3538
|
options?: { search?: string; user?: string; repos?: string[]; baseUrl?: string; avatarSize?: number },
|
|
3551
|
-
cancellation?:
|
|
3539
|
+
cancellation?: AbortSignal,
|
|
3552
3540
|
): Promise<PullRequest[]> {
|
|
3553
3541
|
const scope = getScopedLogger();
|
|
3554
3542
|
|
|
@@ -3618,7 +3606,7 @@ export class GitHubApi {
|
|
|
3618
3606
|
nodeId: string,
|
|
3619
3607
|
expectedSourceSha: string,
|
|
3620
3608
|
options?: { mergeMethod?: PullRequestMergeMethod; baseUrl?: string },
|
|
3621
|
-
cancellation?:
|
|
3609
|
+
cancellation?: AbortSignal,
|
|
3622
3610
|
): Promise<boolean> {
|
|
3623
3611
|
const scope = getScopedLogger();
|
|
3624
3612
|
interface QueryResult {
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { getScopedLogger } from '../../../utils/logger.scoped.js';
|
|
2
|
+
import type { IntegrationIds } from '../constants.js';
|
|
3
|
+
import type { IntegrationServiceContext } from '../context.js';
|
|
4
|
+
import type { CloudIntegrationAuthenticationSession, CloudIntegrationConnection } from './models.js';
|
|
5
|
+
import { toCloudIntegrationType } from './models.js';
|
|
6
|
+
|
|
7
|
+
export class CloudIntegrationService {
|
|
8
|
+
constructor(private readonly ctx: IntegrationServiceContext) {}
|
|
9
|
+
|
|
10
|
+
async getConnections(): Promise<CloudIntegrationConnection[] | undefined> {
|
|
11
|
+
const scope = getScopedLogger();
|
|
12
|
+
|
|
13
|
+
const providersRsp = await this.ctx.account.fetchGkApi('v1/provider-tokens', { method: 'GET' });
|
|
14
|
+
if (!providersRsp.ok) {
|
|
15
|
+
const error = ((await providersRsp.json()) as { error?: unknown })?.error;
|
|
16
|
+
const errorMessage =
|
|
17
|
+
typeof error === 'string'
|
|
18
|
+
? error
|
|
19
|
+
: ((error as { message?: string })?.message ?? providersRsp.statusText);
|
|
20
|
+
if (error != null) {
|
|
21
|
+
scope?.error(undefined, `Failed to get connected providers from cloud: ${errorMessage}`);
|
|
22
|
+
}
|
|
23
|
+
this.ctx.hooks?.connection?.onConnectionsFetchFailed?.({ code: providersRsp.status });
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return ((await providersRsp.json()) as { data?: unknown })?.data as CloudIntegrationConnection[] | undefined;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async getConnectionSession(
|
|
31
|
+
id: IntegrationIds,
|
|
32
|
+
refreshToken?: string,
|
|
33
|
+
): Promise<CloudIntegrationAuthenticationSession | undefined> {
|
|
34
|
+
const scope = getScopedLogger();
|
|
35
|
+
|
|
36
|
+
const refresh = Boolean(refreshToken);
|
|
37
|
+
const cloudIntegrationType = toCloudIntegrationType[id];
|
|
38
|
+
if (cloudIntegrationType == null) {
|
|
39
|
+
scope?.error(undefined, `Unsupported cloud integration type: ${id}`);
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const reqInitOptions = refreshToken
|
|
44
|
+
? {
|
|
45
|
+
method: 'POST',
|
|
46
|
+
body: JSON.stringify({
|
|
47
|
+
access_token: refreshToken,
|
|
48
|
+
}),
|
|
49
|
+
}
|
|
50
|
+
: { method: 'GET' };
|
|
51
|
+
|
|
52
|
+
const tokenRsp = await this.ctx.account.fetchGkApi(
|
|
53
|
+
`v1/provider-tokens/${cloudIntegrationType}${refresh ? '/refresh' : ''}`,
|
|
54
|
+
reqInitOptions,
|
|
55
|
+
);
|
|
56
|
+
if (!tokenRsp.ok) {
|
|
57
|
+
const error = ((await tokenRsp.json()) as { error?: unknown })?.error;
|
|
58
|
+
const errorMessage =
|
|
59
|
+
typeof error === 'string' ? error : ((error as { message?: string })?.message ?? tokenRsp.statusText);
|
|
60
|
+
if (error != null) {
|
|
61
|
+
scope?.error(
|
|
62
|
+
undefined,
|
|
63
|
+
`Failed to ${refresh ? 'refresh' : 'get'} ${id} token from cloud: ${errorMessage}`,
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
this.ctx.hooks?.connection?.onConnectionFetchFailed?.({
|
|
67
|
+
id: id,
|
|
68
|
+
code: tokenRsp.status,
|
|
69
|
+
refreshing: refresh,
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
if (refresh) {
|
|
73
|
+
// try once to just get the latest token if the refresh fails, and give up if that fails too
|
|
74
|
+
const newTokenRsp = await this.ctx.account.fetchGkApi(`v1/provider-tokens/${cloudIntegrationType}`, {
|
|
75
|
+
method: 'GET',
|
|
76
|
+
});
|
|
77
|
+
if (newTokenRsp.ok) {
|
|
78
|
+
return ((await newTokenRsp.json()) as { data?: unknown })?.data as
|
|
79
|
+
| CloudIntegrationAuthenticationSession
|
|
80
|
+
| undefined;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return ((await tokenRsp.json()) as { data?: unknown })?.data as
|
|
88
|
+
| CloudIntegrationAuthenticationSession
|
|
89
|
+
| undefined;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async disconnect(id: IntegrationIds): Promise<boolean> {
|
|
93
|
+
const scope = getScopedLogger();
|
|
94
|
+
|
|
95
|
+
const cloudIntegrationType = toCloudIntegrationType[id];
|
|
96
|
+
if (cloudIntegrationType == null) {
|
|
97
|
+
scope?.error(undefined, `Unsupported cloud integration type: ${id}`);
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const tokenRsp = await this.ctx.account.fetchGkApi(`v1/provider-tokens/${cloudIntegrationType}`, {
|
|
102
|
+
method: 'DELETE',
|
|
103
|
+
});
|
|
104
|
+
if (!tokenRsp.ok) {
|
|
105
|
+
const error = ((await tokenRsp.json()) as { error?: unknown })?.error;
|
|
106
|
+
const errorMessage =
|
|
107
|
+
typeof error === 'string' ? error : ((error as { message?: string })?.message ?? tokenRsp.statusText);
|
|
108
|
+
if (error != null) {
|
|
109
|
+
scope?.error(undefined, `Failed to disconnect ${id} token from cloud: ${errorMessage}`);
|
|
110
|
+
}
|
|
111
|
+
this.ctx.hooks?.connection?.onDisconnectFailed?.({
|
|
112
|
+
id: id,
|
|
113
|
+
code: tokenRsp.status,
|
|
114
|
+
});
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
}
|