@@ -47,7 +47,9 @@ export interface IntegrationAuthenticationProvider extends Disposable {
47
47
deleteSession ( descriptor ?: IntegrationAuthenticationSessionDescriptor ) : Promise < void > ;
48
48
getSession (
49
49
descriptor ?: IntegrationAuthenticationSessionDescriptor ,
50
- options ?: { createIfNeeded ?: boolean ; forceNewSession ?: boolean ; source ?: Sources } ,
50
+ options ?:
51
+ | { createIfNeeded ?: boolean ; forceNewSession ?: boolean ; sync ?: never ; source ?: Sources }
52
+ | { createIfNeeded ?: never ; forceNewSession ?: never ; sync : boolean ; source ?: Sources } ,
51
53
) : Promise < ProviderAuthenticationSession | undefined > ;
52
54
get onDidChange ( ) : Event < void > ;
53
55
}
@@ -73,7 +75,21 @@ abstract class IntegrationAuthenticationProviderBase<ID extends IntegrationId =
73
75
protected abstract fetchOrCreateSession (
74
76
storedSession : ProviderAuthenticationSession | undefined ,
75
77
descriptor ?: IntegrationAuthenticationSessionDescriptor ,
76
- options ?: { createIfNeeded ?: boolean ; forceNewSession ?: boolean ; refreshIfExpired ?: boolean ; source ?: Sources } ,
78
+ options ?:
79
+ | {
80
+ createIfNeeded ?: boolean ;
81
+ forceNewSession ?: boolean ;
82
+ sync ?: never ;
83
+ refreshIfExpired ?: boolean ;
84
+ source ?: Sources ;
85
+ }
86
+ | {
87
+ createIfNeeded ?: never ;
88
+ forceNewSession ?: never ;
89
+ sync : boolean ;
90
+ refreshIfExpired ?: boolean ;
91
+ source ?: Sources ;
92
+ } ,
77
93
) : Promise < ProviderAuthenticationSession | undefined > ;
78
94
79
95
protected abstract deleteAllSecrets ( sessionId : string ) : Promise < void > ;
@@ -129,7 +145,9 @@ abstract class IntegrationAuthenticationProviderBase<ID extends IntegrationId =
129
145
@debug ( )
130
146
async getSession (
131
147
descriptor ?: IntegrationAuthenticationSessionDescriptor ,
132
- options ?: { createIfNeeded ?: boolean ; forceNewSession ?: boolean ; source ?: Sources } ,
148
+ options ?:
149
+ | { createIfNeeded ?: boolean ; forceNewSession ?: boolean ; sync ?: never ; source ?: Sources }
150
+ | { createIfNeeded ?: never ; forceNewSession ?: never ; sync : boolean ; source ?: Sources } ,
133
151
) : Promise < ProviderAuthenticationSession | undefined > {
134
152
const sessionId = this . getSessionId ( descriptor ) ;
135
153
@@ -254,13 +272,27 @@ export abstract class CloudIntegrationAuthenticationProvider<
254
272
protected override async fetchOrCreateSession (
255
273
storedSession : ProviderAuthenticationSession | undefined ,
256
274
descriptor ?: IntegrationAuthenticationSessionDescriptor ,
257
- options ?: { createIfNeeded ?: boolean ; forceNewSession ?: boolean ; refreshIfExpired ?: boolean ; source ?: Sources } ,
275
+ options ?:
276
+ | {
277
+ createIfNeeded ?: boolean ;
278
+ forceNewSession ?: boolean ;
279
+ sync ?: never ;
280
+ refreshIfExpired ?: boolean ;
281
+ source ?: Sources ;
282
+ }
283
+ | {
284
+ createIfNeeded ?: never ;
285
+ forceNewSession ?: never ;
286
+ sync : boolean ;
287
+ refreshIfExpired ?: boolean ;
288
+ source ?: Sources ;
289
+ } ,
258
290
) : Promise < ProviderAuthenticationSession | undefined > {
259
291
// TODO: This is a stopgap to make sure we're not hammering the api on automatic calls to get the session.
260
292
// Ultimately we want to timestamp calls to syncCloudIntegrations and use that to determine whether we should
261
293
// make the call or not.
262
294
let session =
263
- options ?. refreshIfExpired || options ?. createIfNeeded || options ?. forceNewSession
295
+ options ?. refreshIfExpired || options ?. createIfNeeded || options ?. forceNewSession || options ?. sync
264
296
? await this . fetchSession ( descriptor )
265
297
: undefined ;
266
298
0 commit comments