@gitkraken/core-gitlens 0.10.0 → 0.10.2
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/plus/integrations/authentication/cloudIntegrationService.js +24 -7
- package/dist/plus/integrations/authentication/cloudIntegrationService.js.map +1 -1
- package/dist/plus/integrations/authentication/configuredIntegrationService.d.ts +40 -27
- package/dist/plus/integrations/authentication/configuredIntegrationService.js +92 -22
- package/dist/plus/integrations/authentication/configuredIntegrationService.js.map +1 -1
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.d.ts +7 -0
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.js +22 -8
- package/dist/plus/integrations/authentication/integrationAuthenticationProvider.js.map +1 -1
- package/dist/plus/integrations/integrationService.js +6 -3
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/models/gitHostIntegration.js +38 -36
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
- package/dist/plus/integrations/models/integration.d.ts +71 -7
- package/dist/plus/integrations/models/integration.js +201 -55
- package/dist/plus/integrations/models/integration.js.map +1 -1
- package/dist/plus/integrations/models/issuesIntegration.js +9 -9
- package/dist/plus/integrations/models/issuesIntegration.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOps.js +1 -1
- package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOpsServer.js +1 -1
- package/dist/plus/integrations/providers/azureDevOpsServer.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket-server.js +1 -1
- package/dist/plus/integrations/providers/bitbucket-server.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket.js +1 -1
- package/dist/plus/integrations/providers/bitbucket.js.map +1 -1
- package/dist/plus/integrations/providers/github.js +3 -6
- package/dist/plus/integrations/providers/github.js.map +1 -1
- package/dist/plus/integrations/providers/gitlab.js +1 -1
- package/dist/plus/integrations/providers/gitlab.js.map +1 -1
- package/dist/plus/integrations/providers/jira.js +1 -0
- package/dist/plus/integrations/providers/jira.js.map +1 -1
- package/dist/plus/integrations/providers/linear.js +1 -0
- package/dist/plus/integrations/providers/linear.js.map +1 -1
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ import { mergeCollectionMetadata, throwIfAllSettledFailed } from "../providers/u
|
|
|
17
17
|
import { areDomainsOnSameHost } from "../utils/domain.utils.js";
|
|
18
18
|
import { getSelfManagedBaseUrl, isGitSelfManagedHostIntegrationId } from "../utils/integration.utils.js";
|
|
19
19
|
import { toIssueShape, toProviderIssueStates, toProviderPullRequestStates } from "../providers/models.js";
|
|
20
|
-
import { IntegrationBase } from "./integration.js";
|
|
20
|
+
import { IntegrationBase, isReadSessionFailure } from "./integration.js";
|
|
21
21
|
//#region ../plus/integrations/src/models/gitHostIntegration.ts
|
|
22
22
|
/**
|
|
23
23
|
* Whether an SDK read for `providerId` must send the session's secret as an HTTP Basic credential.
|
|
@@ -76,8 +76,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
76
76
|
}
|
|
77
77
|
async getAccountForEmail(repo, email, options) {
|
|
78
78
|
const scope = getScopedLogger();
|
|
79
|
-
if (
|
|
80
|
-
await this.refreshSessionIfExpired(scope);
|
|
79
|
+
if (await this.prepareSessionLookup() != null) return void 0;
|
|
81
80
|
try {
|
|
82
81
|
const author = await this.getProviderAccountForEmail(this._session, repo, email, options);
|
|
83
82
|
this.resetRequestExceptionCount("getAccountForEmail");
|
|
@@ -94,8 +93,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
94
93
|
*/
|
|
95
94
|
async getSshSigningKeysForEmails(repo, emails) {
|
|
96
95
|
const scope = getScopedLogger();
|
|
97
|
-
if (
|
|
98
|
-
await this.refreshSessionIfExpired(scope);
|
|
96
|
+
if (await this.prepareSessionLookup() != null) return /* @__PURE__ */ new Map();
|
|
99
97
|
try {
|
|
100
98
|
const keys = await this.getProviderSshSigningKeysForEmails(this._session, repo, emails);
|
|
101
99
|
this.resetRequestExceptionCount("getSshSigningKeysForEmails");
|
|
@@ -111,8 +109,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
111
109
|
}
|
|
112
110
|
async getAccountForCommit(repo, rev, options) {
|
|
113
111
|
const scope = getScopedLogger();
|
|
114
|
-
if (
|
|
115
|
-
await this.refreshSessionIfExpired(scope);
|
|
112
|
+
if (await this.prepareSessionLookup() != null) return void 0;
|
|
116
113
|
try {
|
|
117
114
|
const author = await this.getProviderAccountForCommit(this._session, repo, rev, options);
|
|
118
115
|
this.resetRequestExceptionCount("getAccountForCommit");
|
|
@@ -124,8 +121,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
124
121
|
}
|
|
125
122
|
async getDefaultBranch(repo, options) {
|
|
126
123
|
const scope = getScopedLogger();
|
|
127
|
-
if (
|
|
128
|
-
await this.refreshSessionIfExpired(scope);
|
|
124
|
+
if (await this.prepareSessionLookup() != null) return void 0;
|
|
129
125
|
return this.ctx.cache.getRepositoryDefaultBranch(repo, this, () => ({ value: (async () => {
|
|
130
126
|
try {
|
|
131
127
|
const result = await this.getProviderDefaultBranch(this._session, repo, options?.cancellation);
|
|
@@ -144,7 +140,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
144
140
|
* its own error, which the caller reports for the connection instead of the repository's refusal.
|
|
145
141
|
*/
|
|
146
142
|
async settleRepositoryRefusal(repo, refusal) {
|
|
147
|
-
const session = await this.
|
|
143
|
+
const session = await this.resolveReadSessionOrThrow(repo.connectionId, void 0);
|
|
148
144
|
if (session == null) return void 0;
|
|
149
145
|
const [slot] = await this.settleBatchRefusals(session, [{
|
|
150
146
|
owner: repo.owner,
|
|
@@ -158,8 +154,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
158
154
|
}
|
|
159
155
|
async getRepositoryMetadata(repo, options) {
|
|
160
156
|
const scope = getScopedLogger();
|
|
161
|
-
if (
|
|
162
|
-
await this.refreshSessionIfExpired(scope);
|
|
157
|
+
if (await this.prepareSessionLookup() != null) return void 0;
|
|
163
158
|
return this.ctx.cache.getRepositoryMetadata(repo, this, () => ({ value: (async () => {
|
|
164
159
|
try {
|
|
165
160
|
const result = await this.getProviderRepositoryMetadata(this._session, repo, options?.cancellation);
|
|
@@ -235,7 +230,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
235
230
|
async getOrganizationsForUserResult(connectionId) {
|
|
236
231
|
const scope = getScopedLogger();
|
|
237
232
|
const session = await this.resolveReadSession(connectionId, scope);
|
|
238
|
-
if (session == null) return
|
|
233
|
+
if (session == null || isReadSessionFailure(session)) return session && { error: session.error };
|
|
239
234
|
const start = performance.now();
|
|
240
235
|
try {
|
|
241
236
|
const result = await this.getProviderOrganizationsForUser?.(session);
|
|
@@ -271,7 +266,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
271
266
|
async getProjectsForOrgResult(org, connectionId) {
|
|
272
267
|
const scope = getScopedLogger();
|
|
273
268
|
const session = await this.resolveReadSession(connectionId, scope);
|
|
274
|
-
if (session == null) return
|
|
269
|
+
if (session == null || isReadSessionFailure(session)) return session && { error: session.error };
|
|
275
270
|
if (this.getProviderProjectsForOrg == null) return;
|
|
276
271
|
const start = performance.now();
|
|
277
272
|
try {
|
|
@@ -307,7 +302,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
307
302
|
async getRepositoriesForOrgResult(org, options) {
|
|
308
303
|
const scope = getScopedLogger();
|
|
309
304
|
const session = await this.resolveReadSession(options?.connectionId, scope);
|
|
310
|
-
if (session == null) return
|
|
305
|
+
if (session == null || isReadSessionFailure(session)) return session && { error: session.error };
|
|
311
306
|
const start = performance.now();
|
|
312
307
|
try {
|
|
313
308
|
const result = await this.getProviderRepositoriesForOrg?.(session, org, options);
|
|
@@ -338,7 +333,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
338
333
|
async getRepositoriesForUserResult(options) {
|
|
339
334
|
const scope = getScopedLogger();
|
|
340
335
|
const session = await this.resolveReadSession(options?.connectionId, scope);
|
|
341
|
-
if (session == null) return
|
|
336
|
+
if (session == null || isReadSessionFailure(session)) return session && { error: session.error };
|
|
342
337
|
if (this.getProviderRepositoriesForUser == null) return;
|
|
343
338
|
const start = performance.now();
|
|
344
339
|
try {
|
|
@@ -362,8 +357,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
362
357
|
}
|
|
363
358
|
async mergePullRequest(pr, options, cancellation) {
|
|
364
359
|
const scope = getScopedLogger();
|
|
365
|
-
if (
|
|
366
|
-
await this.refreshSessionIfExpired(scope);
|
|
360
|
+
if (await this.prepareSessionLookup() != null) return false;
|
|
367
361
|
try {
|
|
368
362
|
const result = await this.mergeProviderPullRequest(this._session, pr, options, cancellation);
|
|
369
363
|
this.resetRequestExceptionCount("mergePullRequest");
|
|
@@ -378,9 +372,13 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
378
372
|
}
|
|
379
373
|
async getPullRequestForBranch(repo, branch, options) {
|
|
380
374
|
const scope = getScopedLogger();
|
|
381
|
-
|
|
382
|
-
|
|
375
|
+
const refreshFailure = await this.prepareSessionLookup();
|
|
376
|
+
if (refreshFailure === "unconnected") return void 0;
|
|
383
377
|
const { expiryOverride, throwOnError, ...opts } = options ?? {};
|
|
378
|
+
if (refreshFailure != null) {
|
|
379
|
+
if (throwOnError) throw refreshFailure;
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
384
382
|
return this.ctx.cache.getPullRequestForBranch(branch, repo, this, (cacheable) => ({ value: (async () => {
|
|
385
383
|
try {
|
|
386
384
|
const result = await this.getProviderPullRequestForBranch(this._session, repo, branch, opts);
|
|
@@ -396,9 +394,13 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
396
394
|
}
|
|
397
395
|
async getPullRequestForCommit(repo, rev, options) {
|
|
398
396
|
const scope = getScopedLogger();
|
|
399
|
-
|
|
400
|
-
|
|
397
|
+
const refreshFailure = await this.prepareSessionLookup();
|
|
398
|
+
if (refreshFailure === "unconnected") return void 0;
|
|
401
399
|
const { throwOnError, ...cacheOptions } = options ?? {};
|
|
400
|
+
if (refreshFailure != null) {
|
|
401
|
+
if (throwOnError) throw refreshFailure;
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
402
404
|
return this.ctx.cache.getPullRequestForSha(rev, repo, this, (cacheable) => ({ value: (async () => {
|
|
403
405
|
try {
|
|
404
406
|
const result = await this.getProviderPullRequestForCommit(this._session, repo, rev);
|
|
@@ -467,7 +469,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
467
469
|
const providerId = this.authProvider.id;
|
|
468
470
|
const states = toProviderIssueStates(options?.state);
|
|
469
471
|
const session = await this.resolveReadSession(connectionId, scope);
|
|
470
|
-
if (session == null) return
|
|
472
|
+
if (session == null || isReadSessionFailure(session)) return session && { error: session.error };
|
|
471
473
|
const start = performance.now();
|
|
472
474
|
let customUrl;
|
|
473
475
|
let api;
|
|
@@ -795,7 +797,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
795
797
|
const providerId = this.authProvider.id;
|
|
796
798
|
const states = toProviderPullRequestStates(options?.state);
|
|
797
799
|
const session = await this.resolveReadSession(connectionId, scope);
|
|
798
|
-
if (session == null) return
|
|
800
|
+
if (session == null || isReadSessionFailure(session)) return session && { error: session.error };
|
|
799
801
|
const start = performance.now();
|
|
800
802
|
let customUrl;
|
|
801
803
|
let api;
|
|
@@ -1002,7 +1004,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
1002
1004
|
const scope = getScopedLogger();
|
|
1003
1005
|
const { connectionId, ...searchOptions } = options ?? {};
|
|
1004
1006
|
const session = await this.resolveReadSession(connectionId, scope);
|
|
1005
|
-
if (session == null) return
|
|
1007
|
+
if (session == null || isReadSessionFailure(session)) return session && { error: session.error };
|
|
1006
1008
|
const start = performance.now();
|
|
1007
1009
|
try {
|
|
1008
1010
|
const prs = await this.searchProviderMyPullRequests(session, ensureArray(repos), cancellation, searchOptions);
|
|
@@ -1034,7 +1036,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
1034
1036
|
async getMyPullRequestsForUserResult(options, connectionId) {
|
|
1035
1037
|
const scope = getScopedLogger();
|
|
1036
1038
|
const session = await this.resolveReadSession(connectionId, scope);
|
|
1037
|
-
if (session == null) return
|
|
1039
|
+
if (session == null || isReadSessionFailure(session)) return session && { error: session.error };
|
|
1038
1040
|
if (this.getProviderMyPullRequestsForUser == null) return;
|
|
1039
1041
|
const start = performance.now();
|
|
1040
1042
|
try {
|
|
@@ -1092,7 +1094,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
1092
1094
|
async searchPullRequestsPageResult(options, cancellation, connectionId) {
|
|
1093
1095
|
const scope = getScopedLogger();
|
|
1094
1096
|
const session = await this.resolveReadSession(connectionId, scope);
|
|
1095
|
-
if (session == null) return
|
|
1097
|
+
if (session == null || isReadSessionFailure(session)) return session && { error: session.error };
|
|
1096
1098
|
const start = performance.now();
|
|
1097
1099
|
try {
|
|
1098
1100
|
const result = await this.searchProviderPullRequestsPage?.(session, options, cancellation);
|
|
@@ -1118,7 +1120,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
1118
1120
|
const scope = getScopedLogger();
|
|
1119
1121
|
const { connectionId, ...searchOptions } = options ?? {};
|
|
1120
1122
|
const session = await this.resolveReadSession(connectionId, scope);
|
|
1121
|
-
if (session == null) return void 0;
|
|
1123
|
+
if (session == null || isReadSessionFailure(session)) return void 0;
|
|
1122
1124
|
try {
|
|
1123
1125
|
const prs = await this.searchProviderPullRequests?.(session, searchQuery, ensureArray(repos), cancellation, searchOptions);
|
|
1124
1126
|
this.resetRequestExceptionCount("searchPullRequests");
|
|
@@ -1144,7 +1146,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
1144
1146
|
async searchIssuesPageResult(options, cancellation, connectionId) {
|
|
1145
1147
|
const scope = getScopedLogger();
|
|
1146
1148
|
const session = await this.resolveReadSession(connectionId, scope);
|
|
1147
|
-
if (session == null) return
|
|
1149
|
+
if (session == null || isReadSessionFailure(session)) return session && { error: session.error };
|
|
1148
1150
|
const start = performance.now();
|
|
1149
1151
|
try {
|
|
1150
1152
|
const result = await this.searchProviderIssuesPage?.(session, options, cancellation);
|
|
@@ -1175,7 +1177,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
1175
1177
|
async countIssuesResult(scopes, cancellation, connectionId) {
|
|
1176
1178
|
const scope = getScopedLogger();
|
|
1177
1179
|
const session = await this.resolveReadSession(connectionId, scope);
|
|
1178
|
-
if (session == null) return
|
|
1180
|
+
if (session == null || isReadSessionFailure(session)) return session && { error: session.error };
|
|
1179
1181
|
const start = performance.now();
|
|
1180
1182
|
try {
|
|
1181
1183
|
const counts = await this.countProviderIssues?.(session, scopes, cancellation);
|
|
@@ -1222,7 +1224,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
1222
1224
|
async getIssuesBatchResult(coordinates, cancellation, connectionId) {
|
|
1223
1225
|
const scope = getScopedLogger();
|
|
1224
1226
|
const session = await this.resolveReadSession(connectionId, scope);
|
|
1225
|
-
if (session == null) return
|
|
1227
|
+
if (session == null || isReadSessionFailure(session)) return session && { error: session.error };
|
|
1226
1228
|
const start = performance.now();
|
|
1227
1229
|
let slots;
|
|
1228
1230
|
try {
|
|
@@ -1273,7 +1275,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
1273
1275
|
async getPullRequestsBatchResult(coordinates, options, cancellation, connectionId) {
|
|
1274
1276
|
const scope = getScopedLogger();
|
|
1275
1277
|
const session = await this.resolveReadSession(connectionId, scope);
|
|
1276
|
-
if (session == null) return
|
|
1278
|
+
if (session == null || isReadSessionFailure(session)) return session && { error: session.error };
|
|
1277
1279
|
const start = performance.now();
|
|
1278
1280
|
let slots;
|
|
1279
1281
|
try {
|
|
@@ -1321,7 +1323,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
1321
1323
|
async getIssuesEtagFieldsResult(coordinates, options, cancellation, connectionId) {
|
|
1322
1324
|
const scope = getScopedLogger();
|
|
1323
1325
|
const session = await this.resolveReadSession(connectionId, scope);
|
|
1324
|
-
if (session == null) return
|
|
1326
|
+
if (session == null || isReadSessionFailure(session)) return session && { error: session.error };
|
|
1325
1327
|
const start = performance.now();
|
|
1326
1328
|
try {
|
|
1327
1329
|
const slots = await this.getProviderIssuesEtagFields?.(session, coordinates, options, cancellation);
|
|
@@ -1357,7 +1359,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
1357
1359
|
async getPullRequestsEtagFieldsResult(coordinates, options, cancellation, connectionId) {
|
|
1358
1360
|
const scope = getScopedLogger();
|
|
1359
1361
|
const session = await this.resolveReadSession(connectionId, scope);
|
|
1360
|
-
if (session == null) return
|
|
1362
|
+
if (session == null || isReadSessionFailure(session)) return session && { error: session.error };
|
|
1361
1363
|
const start = performance.now();
|
|
1362
1364
|
try {
|
|
1363
1365
|
const slots = await this.getProviderPullRequestsEtagFields?.(session, coordinates, options, cancellation);
|
|
@@ -1400,7 +1402,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
1400
1402
|
async getPullRequestsForBranchesResult(targets, options, cancellation, connectionId) {
|
|
1401
1403
|
const scope = getScopedLogger();
|
|
1402
1404
|
const session = await this.resolveReadSession(connectionId, scope);
|
|
1403
|
-
if (session == null) return
|
|
1405
|
+
if (session == null || isReadSessionFailure(session)) return session && { error: session.error };
|
|
1404
1406
|
const start = performance.now();
|
|
1405
1407
|
let slots;
|
|
1406
1408
|
try {
|
|
@@ -1440,7 +1442,7 @@ var GitHostIntegration = class extends IntegrationBase {
|
|
|
1440
1442
|
async countPullRequestsResult(scopes, cancellation, connectionId) {
|
|
1441
1443
|
const scope = getScopedLogger();
|
|
1442
1444
|
const session = await this.resolveReadSession(connectionId, scope);
|
|
1443
|
-
if (session == null) return
|
|
1445
|
+
if (session == null || isReadSessionFailure(session)) return session && { error: session.error };
|
|
1444
1446
|
const start = performance.now();
|
|
1445
1447
|
try {
|
|
1446
1448
|
const counts = await this.countProviderPullRequests?.(session, scopes, cancellation);
|