@gitkraken/core-gitlens 0.52.0 → 0.53.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +8 -1
  2. package/dist/_types/provider-apis/types/exportedTypes/github.d.ts +75 -0
  3. package/dist/_types/provider-apis/types/exportedTypes/types.d.ts +7 -0
  4. package/dist/plus/git-github/api/issueWrites.js +1 -1
  5. package/dist/plus/git-github/api/issueWrites.js.map +1 -1
  6. package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.d.ts +5 -1
  7. package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.js +44 -20
  8. package/dist/plus/integrations/authentication/cloudIntegrationAuthenticationProvider.js.map +1 -1
  9. package/dist/plus/integrations/authentication/cloudIntegrationObservations.d.ts +49 -0
  10. package/dist/plus/integrations/authentication/cloudIntegrationObservations.js +118 -0
  11. package/dist/plus/integrations/authentication/cloudIntegrationObservations.js.map +1 -0
  12. package/dist/plus/integrations/authentication/configuredIntegrationService.d.ts +38 -25
  13. package/dist/plus/integrations/authentication/configuredIntegrationService.js +376 -141
  14. package/dist/plus/integrations/authentication/configuredIntegrationService.js.map +1 -1
  15. package/dist/plus/integrations/authentication/integrationAuthenticationService.d.ts +8 -2
  16. package/dist/plus/integrations/authentication/integrationAuthenticationService.js +34 -4
  17. package/dist/plus/integrations/authentication/integrationAuthenticationService.js.map +1 -1
  18. package/dist/plus/integrations/authentication/models.d.ts +6 -0
  19. package/dist/plus/integrations/authentication/models.js +9 -1
  20. package/dist/plus/integrations/authentication/models.js.map +1 -1
  21. package/dist/plus/integrations/authentication/observedAuthenticationProvider.d.ts +13 -2
  22. package/dist/plus/integrations/authentication/observedAuthenticationProvider.js +68 -30
  23. package/dist/plus/integrations/authentication/observedAuthenticationProvider.js.map +1 -1
  24. package/dist/plus/integrations/index.d.ts +2 -1
  25. package/dist/plus/integrations/index.js.map +1 -1
  26. package/dist/plus/integrations/integrationService.d.ts +8 -0
  27. package/dist/plus/integrations/integrationService.js +148 -36
  28. package/dist/plus/integrations/integrationService.js.map +1 -1
  29. package/dist/plus/integrations/manager.d.ts +3 -0
  30. package/dist/plus/integrations/models/integration.d.ts +4 -0
  31. package/dist/plus/integrations/models/integration.js +61 -16
  32. package/dist/plus/integrations/models/integration.js.map +1 -1
  33. package/dist/plus/integrations/models/issueRelationships.d.ts +31 -0
  34. package/dist/plus/integrations/models/issueRelationships.js +0 -0
  35. package/dist/plus/integrations/models/publicIntegration.d.ts +0 -1
  36. package/dist/plus/integrations/providers/github.d.ts +8 -0
  37. package/dist/plus/integrations/providers/github.js +162 -2
  38. package/dist/plus/integrations/providers/github.js.map +1 -1
  39. package/dist/plus/integrations/providers/issueSorts.d.ts +0 -1
  40. package/dist/plus/integrations/providers/providerApiClient.d.ts +1 -1
  41. package/dist/plus/integrations/providers/providerApiClient.js +33 -14
  42. package/dist/plus/integrations/providers/providerApiClient.js.map +1 -1
  43. package/dist/plus/integrations/providers/providerErrors.d.ts +1 -0
  44. package/dist/plus/integrations/providers/providerErrors.js +1 -2
  45. package/dist/plus/integrations/providers/providerErrors.js.map +1 -1
  46. package/dist/plus/integrations/providers/providersApi.d.ts +2 -1
  47. package/dist/plus/integrations/providers/providersApi.js +2 -0
  48. package/dist/plus/integrations/providers/providersApi.js.map +1 -1
  49. package/dist/plus/integrations/reads/drains.d.ts +0 -1
  50. package/docs/integrations.md +36 -0
  51. package/package.json +2 -2
@@ -0,0 +1,118 @@
1
+ import { uuid } from "../../../utils/crypto.js";
2
+ import { hostFromDomain } from "../utils/domain.utils.js";
3
+ import { isSelfManagedHostIntegrationId } from "../utils/integration.utils.js";
4
+ //#region ../plus/integrations/src/authentication/cloudIntegrationObservations.ts
5
+ var CloudIntegrationObservations = class {
6
+ owner = uuid();
7
+ acquisitions = /* @__PURE__ */ new Map();
8
+ inheritedLogout;
9
+ _logout;
10
+ get hasLogout() {
11
+ return this._logout != null;
12
+ }
13
+ snapshotLogout() {
14
+ return this._logout && {
15
+ ...this._logout,
16
+ departures: [...this.departures.keys()]
17
+ };
18
+ }
19
+ constructor(previousLogout) {
20
+ this._logout = previousLogout;
21
+ if (previousLogout != null) {
22
+ this.inheritedLogout = `${previousLogout.owner}:${previousLogout.mark}`;
23
+ for (const scope of previousLogout.departures) this.departures.set(scope, 0);
24
+ }
25
+ }
26
+ origin(mark) {
27
+ return {
28
+ owner: this.owner,
29
+ mark,
30
+ after: this.inheritedLogout
31
+ };
32
+ }
33
+ allows(origin) {
34
+ const logout = this._logout;
35
+ return logout == null || origin != null && (origin.owner === logout.owner ? origin.mark > logout.mark : origin.after === `${logout.owner}:${logout.mark}`);
36
+ }
37
+ published(scope, mark) {
38
+ this.acquisitions.set(scope, mark);
39
+ }
40
+ acquiredAfter(scope, mark) {
41
+ return (this.acquisitions.get(scope) ?? 0) > mark;
42
+ }
43
+ latestSync = 0;
44
+ _lastLogout = 0;
45
+ get lastLogout() {
46
+ return this._lastLogout;
47
+ }
48
+ connections = /* @__PURE__ */ new Map();
49
+ departures = /* @__PURE__ */ new Map();
50
+ primaries = /* @__PURE__ */ new Map();
51
+ acceptLogout(request, mark, connections) {
52
+ if (this._logout?.owner === this.owner && request <= this._logout.mark) return void 0;
53
+ for (const connection of connections) this.depart(connection.integrationId, connection.domain, connection.id, mark);
54
+ this._logout = {
55
+ owner: this.owner,
56
+ mark: request
57
+ };
58
+ this._lastLogout = mark;
59
+ this.latestSync = Math.max(this.latestSync, request);
60
+ return {
61
+ mark,
62
+ isCurrent: () => this.latestSync === request
63
+ };
64
+ }
65
+ accept(mark, connections) {
66
+ if (mark <= this.latestSync) return void 0;
67
+ this.latestSync = mark;
68
+ for (const [id, entries] of connections) for (const connection of entries) {
69
+ if (connection.id == null) continue;
70
+ this.observe(`${id}|connection:${connection.id}`, mark);
71
+ if (connection.primary) this.observePrimary(id, connection.domain, connection.id, mark);
72
+ }
73
+ return {
74
+ mark,
75
+ isCurrent: () => this.latestSync === mark
76
+ };
77
+ }
78
+ loggedOutSince(mark) {
79
+ return this.lastLogout > mark;
80
+ }
81
+ observe(scope, mark) {
82
+ this.connections.set(scope, Math.max(mark, this.connections.get(scope) ?? 0));
83
+ }
84
+ observedSince(scope, mark) {
85
+ return (this.connections.get(scope) ?? 0) > mark;
86
+ }
87
+ remove(scope) {
88
+ this.connections.delete(scope);
89
+ this.acquisitions.delete(scope);
90
+ }
91
+ depart(id, domain, connectionId, mark) {
92
+ const scope = JSON.stringify([this.primaryScope(id, domain), connectionId]);
93
+ const previous = this.departures.get(scope);
94
+ this.departures.set(scope, Math.max(mark, previous ?? 0));
95
+ return previous == null;
96
+ }
97
+ departedAt(id, domain, connectionId) {
98
+ return this.departures.get(JSON.stringify([this.primaryScope(id, domain), connectionId]));
99
+ }
100
+ observePrimary(id, domain, connectionId, mark) {
101
+ const scope = this.primaryScope(id, domain);
102
+ if ((this.primaries.get(scope)?.mark ?? 0) <= mark) this.primaries.set(scope, {
103
+ connectionId,
104
+ mark
105
+ });
106
+ }
107
+ supersedingPrimary(id, domain, connectionId, mark) {
108
+ const primary = this.primaries.get(this.primaryScope(id, domain));
109
+ return primary != null && primary.mark > mark && primary.connectionId !== connectionId ? primary.connectionId : void 0;
110
+ }
111
+ primaryScope(id, domain) {
112
+ return isSelfManagedHostIntegrationId(id) && domain ? `${id}|host:${hostFromDomain(domain) ?? domain}` : id;
113
+ }
114
+ };
115
+ //#endregion
116
+ export { CloudIntegrationObservations };
117
+
118
+ //# sourceMappingURL=cloudIntegrationObservations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloudIntegrationObservations.js","names":[],"sources":["../../../../../plus/integrations/src/authentication/cloudIntegrationObservations.ts"],"sourcesContent":["import { uuid } from '@gitlens/utils/crypto.js';\nimport type { IntegrationIds } from '../constants.js';\nimport { hostFromDomain } from '../utils/domain.utils.js';\nimport { isSelfManagedHostIntegrationId } from '../utils/integration.utils.js';\nimport type { CloudIntegrationConnection, ConfiguredIntegrationDescriptor } from './models.js';\n\nexport interface CloudIntegrationSync {\n\treadonly mark: number;\n\tisCurrent(): boolean;\n}\n\ntype CloudOrder = { owner: string; mark: number };\ntype CloudLogout = CloudOrder & { departures: readonly string[] };\nexport type CloudCredentialOrigin = CloudOrder & { after?: string };\n\nexport class CloudIntegrationObservations {\n\tprivate readonly owner = uuid();\n\tprivate readonly acquisitions = new Map<string, number>();\n\t// KEEP: Request ordinals belong to one storage owner; a reopened owner records which durable logout it followed.\n\tprivate readonly inheritedLogout?: string;\n\tprivate _logout?: CloudOrder;\n\tget hasLogout(): boolean {\n\t\treturn this._logout != null;\n\t}\n\n\tsnapshotLogout(): CloudLogout | undefined {\n\t\treturn this._logout && { ...this._logout, departures: [...this.departures.keys()] };\n\t}\n\n\tconstructor(previousLogout?: CloudLogout) {\n\t\tthis._logout = previousLogout;\n\t\tif (previousLogout != null) {\n\t\t\tthis.inheritedLogout = `${previousLogout.owner}:${previousLogout.mark}`;\n\t\t\tfor (const scope of previousLogout.departures) {\n\t\t\t\tthis.departures.set(scope, 0);\n\t\t\t}\n\t\t}\n\t}\n\n\torigin(mark: number): CloudCredentialOrigin {\n\t\treturn { owner: this.owner, mark: mark, after: this.inheritedLogout };\n\t}\n\n\tallows(origin: CloudCredentialOrigin | undefined): boolean {\n\t\tconst logout = this._logout;\n\t\treturn (\n\t\t\tlogout == null ||\n\t\t\t(origin != null &&\n\t\t\t\t(origin.owner === logout.owner\n\t\t\t\t\t? origin.mark > logout.mark\n\t\t\t\t\t: origin.after === `${logout.owner}:${logout.mark}`))\n\t\t);\n\t}\n\n\tpublished(scope: string, mark: number): void {\n\t\tthis.acquisitions.set(scope, mark);\n\t}\n\n\tacquiredAfter(scope: string, mark: number): boolean {\n\t\treturn (this.acquisitions.get(scope) ?? 0) > mark;\n\t}\n\n\tprivate latestSync = 0;\n\tprivate _lastLogout = 0;\n\tget lastLogout(): number {\n\t\treturn this._lastLogout;\n\t}\n\tprivate readonly connections = new Map<string, number>();\n\tprivate readonly departures = new Map<string, number>();\n\tprivate readonly primaries = new Map<string, { connectionId: string; mark: number }>();\n\n\tacceptLogout(\n\t\trequest: number,\n\t\tmark: number,\n\t\tconnections: readonly ConfiguredIntegrationDescriptor[],\n\t): CloudIntegrationSync | undefined {\n\t\tif (this._logout?.owner === this.owner && request <= this._logout.mark) return undefined;\n\n\t\tfor (const connection of connections) {\n\t\t\tthis.depart(connection.integrationId, connection.domain, connection.id, mark);\n\t\t}\n\t\tthis._logout = { owner: this.owner, mark: request };\n\t\tthis._lastLogout = mark;\n\t\tthis.latestSync = Math.max(this.latestSync, request);\n\t\treturn { mark: mark, isCurrent: () => this.latestSync === request };\n\t}\n\n\taccept(\n\t\tmark: number,\n\t\tconnections: ReadonlyMap<IntegrationIds, readonly CloudIntegrationConnection[]>,\n\t): CloudIntegrationSync | undefined {\n\t\tif (mark <= this.latestSync) return undefined;\n\n\t\tthis.latestSync = mark;\n\t\tfor (const [id, entries] of connections) {\n\t\t\tfor (const connection of entries) {\n\t\t\t\tif (connection.id == null) continue;\n\n\t\t\t\tthis.observe(`${id}|connection:${connection.id}`, mark);\n\t\t\t\tif (connection.primary) {\n\t\t\t\t\tthis.observePrimary(id, connection.domain, connection.id, mark);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn { mark: mark, isCurrent: () => this.latestSync === mark };\n\t}\n\n\tloggedOutSince(mark: number): boolean {\n\t\treturn this.lastLogout > mark;\n\t}\n\n\tobserve(scope: string, mark: number): void {\n\t\tthis.connections.set(scope, Math.max(mark, this.connections.get(scope) ?? 0));\n\t}\n\n\tobservedSince(scope: string, mark: number): boolean {\n\t\treturn (this.connections.get(scope) ?? 0) > mark;\n\t}\n\n\tremove(scope: string): void {\n\t\tthis.connections.delete(scope);\n\t\tthis.acquisitions.delete(scope);\n\t}\n\n\tdepart(id: IntegrationIds, domain: string | undefined, connectionId: string, mark: number): boolean {\n\t\tconst scope = JSON.stringify([this.primaryScope(id, domain), connectionId]);\n\t\tconst previous = this.departures.get(scope);\n\t\tthis.departures.set(scope, Math.max(mark, previous ?? 0));\n\t\treturn previous == null;\n\t}\n\n\tdepartedAt(id: IntegrationIds, domain: string, connectionId: string): number | undefined {\n\t\treturn this.departures.get(JSON.stringify([this.primaryScope(id, domain), connectionId]));\n\t}\n\n\tobservePrimary(id: IntegrationIds, domain: string | undefined, connectionId: string, mark: number): void {\n\t\tconst scope = this.primaryScope(id, domain);\n\t\tif ((this.primaries.get(scope)?.mark ?? 0) <= mark) {\n\t\t\tthis.primaries.set(scope, { connectionId: connectionId, mark: mark });\n\t\t}\n\t}\n\n\tsupersedingPrimary(\n\t\tid: IntegrationIds,\n\t\tdomain: string | undefined,\n\t\tconnectionId: string,\n\t\tmark: number,\n\t): string | undefined {\n\t\tconst primary = this.primaries.get(this.primaryScope(id, domain));\n\t\treturn primary != null && primary.mark > mark && primary.connectionId !== connectionId\n\t\t\t? primary.connectionId\n\t\t\t: undefined;\n\t}\n\n\tprivate primaryScope(id: IntegrationIds, domain?: string): string {\n\t\treturn isSelfManagedHostIntegrationId(id) && domain ? `${id}|host:${hostFromDomain(domain) ?? domain}` : id;\n\t}\n}\n"],"mappings":";;;;AAeA,IAAa,+BAAb,MAA0C;CACzC,QAAyB,KAAK;CAC9B,+BAAgC,IAAI,IAAoB;CAExD;CACA;CACA,IAAI,YAAqB;EACxB,OAAO,KAAK,WAAW;CACxB;CAEA,iBAA0C;EACzC,OAAO,KAAK,WAAW;GAAE,GAAG,KAAK;GAAS,YAAY,CAAC,GAAG,KAAK,WAAW,KAAK,CAAC;EAAE;CACnF;CAEA,YAAY,gBAA8B;EACzC,KAAK,UAAU;EACf,IAAI,kBAAkB,MAAM;GAC3B,KAAK,kBAAkB,GAAG,eAAe,MAAM,GAAG,eAAe;GACjE,KAAK,MAAM,SAAS,eAAe,YAClC,KAAK,WAAW,IAAI,OAAO,CAAC;EAE9B;CACD;CAEA,OAAO,MAAqC;EAC3C,OAAO;GAAE,OAAO,KAAK;GAAa;GAAM,OAA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AAQ,eAAe,MAAM,KAAK,WAAW;CAC1G;AACD"}
@@ -1,7 +1,8 @@
1
1
  import { Disposable } from "../../../utils/disposable.js";
2
2
  import { Event } from "../../../utils/event.js";
3
- import { ConfiguredIntegrationDescriptor, ConnectionResource, ProviderAuthenticationSession } from "./models.js";
3
+ import { CloudIntegrationConnection, ConfiguredIntegrationDescriptor, ConnectionResource, ProviderAuthenticationSession } from "./models.js";
4
4
  import { IntegrationIds } from "../constants.js";
5
+ import { CloudIntegrationSync } from "./cloudIntegrationObservations.js";
5
6
  import { IntegrationAuthenticationSessionDescriptor } from "./integrationAuthenticationProvider.js";
6
7
  import { IntegrationServiceContext } from "../context.js";
7
8
  //#region ../plus/integrations/src/authentication/configuredIntegrationService.d.ts
@@ -14,31 +15,23 @@ type IntegrationSessionChangeEvent = {
14
15
  readonly session: ProviderAuthenticationSession;
15
16
  readonly previousDomain?: string;
16
17
  };
18
+ type CloudLogoutConnection = ConfiguredIntegrationDescriptor & {
19
+ retained: boolean;
20
+ };
17
21
  export declare class ConfiguredIntegrationService implements Disposable {
18
22
  private readonly ctx;
19
23
  private readonly _onDidChange;
20
24
  private readonly _onWillChangeSession;
21
25
  private readonly _onWillRemoveSessions;
22
- private storeConfiguredQueue;
23
- /**
24
- * One provider's secret and descriptor mutations run one at a time, so a sign-out never interleaves with a
25
- * token being stored: storing writes the secret and then registers its descriptor, and a delete in between would
26
- * miss a connection it cannot see yet, or be undone by the pending write (#5948).
27
- */
28
- private readonly _locks;
29
26
  private readonly _acquisitions;
30
- /** Monotonic across providers; see {@link getSignOutMark}. */
31
- private _signOutEpoch;
32
- /** The latest retirement of pending stores per provider, self-managed host, or connection. */
33
- private readonly _signOuts;
34
- private readonly _storedWriteRetirements;
27
+ private readonly state;
35
28
  private _disposed;
36
29
  get onDidChange(): Event<ConfiguredIntegrationsChangeEvent>;
30
+ get onCloudLogout(): Event<readonly CloudLogoutConnection[]>;
37
31
  get onWillChangeSession(): Event<IntegrationSessionChangeEvent>;
38
32
  get onWillRemoveSessions(): typeof this._onWillRemoveSessions.event;
39
33
  constructor(ctx: IntegrationServiceContext);
40
34
  dispose(): void;
41
- private _configured?;
42
35
  private get configured();
43
36
  getConfigured(id?: IntegrationIds, options?: {
44
37
  cloud?: boolean;
@@ -60,11 +53,28 @@ export declare class ConfiguredIntegrationService implements Disposable {
60
53
  */
61
54
  getSignOutMark(): number;
62
55
  private retirePendingStores;
56
+ beginCloudSync(): number;
57
+ get lastCloudLogout(): number;
58
+ get hasCloudLogout(): boolean;
59
+ retireCloudAccount(mark: number): Promise<CloudIntegrationSync | undefined>;
60
+ private persistCloudLogout;
61
+ private clearDepartedCloudCredentials;
62
+ getCloudDeparture(id: IntegrationIds, session: ProviderAuthenticationSession): number | undefined;
63
+ confirmHostCloudSession(id: IntegrationIds, session: ProviderAuthenticationSession, logout: number): Promise<boolean>;
64
+ acceptCloudSync(mark: number, connections: ReadonlyMap<IntegrationIds, readonly CloudIntegrationConnection[]>): Promise<CloudIntegrationSync | undefined>;
65
+ supersedingPrimary(id: IntegrationIds, session: ProviderAuthenticationSession, mark: number): string | undefined;
66
+ hasNewCloudConnection(id: IntegrationIds, domain: string | undefined, mark: number): boolean;
67
+ dispatchHostListRetirement(id: IntegrationIds, domain: string, sync: CloudIntegrationSync, retire: () => Promise<void>): Promise<boolean>;
63
68
  getStoredWriteMark(): number;
64
- isStoredWriteRetiredSince(id: IntegrationIds, session: Pick<ProviderAuthenticationSession, 'id' | 'domain'>, mark: number): boolean;
69
+ isStoredWriteRetiredSince(id: IntegrationIds, session: Pick<ProviderAuthenticationSession, 'id' | 'domain' | 'cloud'>, mark: number): boolean;
70
+ captureConfiguredConnection(id: IntegrationIds, connectionId: string): Promise<(() => boolean) | undefined>;
71
+ private duringRemoval;
72
+ captureStoredRelationshipCurrency(id: IntegrationIds, session: ProviderAuthenticationSession): Promise<(() => boolean) | undefined>;
65
73
  private retireStoredWrites;
66
74
  private getHostScope;
67
- isSessionRetiredSince(id: IntegrationIds, session: Pick<ProviderAuthenticationSession, 'id' | 'domain'>, mark: number): boolean;
75
+ isSessionRetiredSince(id: IntegrationIds, session: Pick<ProviderAuthenticationSession, 'id' | 'domain'> & {
76
+ cloud?: boolean;
77
+ }, mark: number, acquisitionMark?: number): boolean;
68
78
  private hasRetirement;
69
79
  /**
70
80
  * Stores the session's secret and descriptor together. A pending store can be invalidated by a sign-out or a
@@ -72,10 +82,15 @@ export declare class ConfiguredIntegrationService implements Disposable {
72
82
  */
73
83
  storeSession(id: IntegrationIds, session: ProviderAuthenticationSession, options?: {
74
84
  signOutMark?: number;
85
+ acquisitionMark?: number;
75
86
  resource?: ConnectionResource;
76
87
  expectedStoredAccessToken?: string;
88
+ primaryResponse?: 'named' | 'legacy';
89
+ sync?: CloudIntegrationSync;
77
90
  }): Promise<boolean>;
78
91
  peekStoredSession(id: IntegrationIds, connectionId: string, cloud: boolean, domain: string): Promise<ProviderAuthenticationSession | undefined>;
92
+ private peekSecret;
93
+ private isRetiredSecret;
79
94
  getStoredSession(id: IntegrationIds, descriptor: IntegrationAuthenticationSessionDescriptor): Promise<ProviderAuthenticationSession | undefined>;
80
95
  /**
81
96
  * Deletes one connection's stored session. `signOut` is for a delete that signs the integration out (a forced new
@@ -86,16 +101,11 @@ export declare class ConfiguredIntegrationService implements Disposable {
86
101
  preserveConfigured?: boolean;
87
102
  signOut?: boolean;
88
103
  signOutMark?: number;
104
+ unobservedSince?: number;
105
+ sync?: CloudIntegrationSync;
89
106
  }): Promise<boolean>;
90
107
  /** Signs out of every stored session of the provider, or of one self-managed host when `domain` is given. */
91
- deleteAllStoredSessions(id: IntegrationIds, cloud?: boolean, domain?: string): Promise<void>;
92
- /**
93
- * Reclaims all stored configuration + secrets for the given (typically retired) integration ids.
94
- * Used to clean up state left behind when an id is removed from the model — e.g. the local
95
- * self-managed `github-enterprise`/`gitlab-self-hosted` ids dropped when integrations went cloud-only.
96
- * Domains are read from the stored config (secrets are keyed by domain); ids with no stored config
97
- * are a no-op.
98
- */
108
+ deleteAllStoredSessions(id: IntegrationIds, cloud?: boolean, domain?: string, sync?: CloudIntegrationSync): Promise<boolean>;
99
109
  purgeStoredConfiguration(ids: readonly string[]): Promise<void>;
100
110
  private deleteSecrets;
101
111
  private deleteAllSecrets;
@@ -152,7 +162,10 @@ export declare class ConfiguredIntegrationService implements Disposable {
152
162
  * Marks the given connection as the primary/default for the provider and clears the flag on its
153
163
  * siblings. Persists immediately instead of relying on a session re-store to carry the primary flag.
154
164
  */
155
- setPrimaryConnection(id: IntegrationIds, connectionId: string): Promise<void>;
165
+ setPrimaryConnection(id: IntegrationIds, connectionId: string, list?: {
166
+ sync: CloudIntegrationSync;
167
+ domain?: string;
168
+ }): Promise<void>;
156
169
  private setPrimaryConnectionCore;
157
170
  /**
158
171
  * Removes a single connection (its secret + configured descriptor). If it was the primary and other