@@ -36,7 +36,7 @@ type RoomConfigurationPayload = ValueToSnakeCase<
3636
3737
3838export abstract class TokenSourceBase {
39- abstract getTokenValue ( ) : Promise < TokenSourceResponseObject > ;
39+ abstract generate ( ) : Promise < TokenSourceResponseObject > ;
4040}
4141
4242export abstract class TokenSourceInFlexible extends TokenSourceBase { }
@@ -52,8 +52,6 @@ export type TokenSourceOptions = {
5252} ;
5353
5454export abstract class TokenSourceFlexible extends TokenSourceBase {
55- abstract getTokenValue ( ) : Promise < TokenSourceResponseObject > ;
56-
5755 abstract setOptions ( options : TokenSourceOptions ) : void ;
5856 abstract clearOptions ( ) : void ;
5957}
@@ -139,22 +137,22 @@ export abstract class TokenSourceRefreshable extends TokenSourceFlexible {
139137 this . cachedResponse = null ;
140138 }
141139
142- async getTokenValue ( ) : Promise < TokenSourceResponseObject > {
140+ async generate ( ) : Promise < TokenSourceResponseObject > {
143141 if ( this . cachedResponse && ! isResponseExpired ( this . cachedResponse ) ) {
144142 return this . cachedResponse ! . toJson ( ) as TokenSourceResponseObject ;
145143 }
146144
147145 const unlock = await this . fetchMutex . lock ( ) ;
148146 try {
149- const tokenResponse = await this . generate ( this . options ) ;
147+ const tokenResponse = await this . update ( this . options ) ;
150148 this . cachedResponse = tokenResponse ;
151149 return tokenResponse ;
152150 } finally {
153151 unlock ( ) ;
154152 }
155153 }
156154
157- abstract generate ( options : TokenSourceOptions ) : Promise < TokenSourceResponse > ;
155+ abstract update ( options : TokenSourceOptions ) : Promise < TokenSourceResponse > ;
158156}
159157
160158
@@ -170,7 +168,7 @@ export class TokenSourceLiteral extends TokenSourceInFlexible {
170168 this . literalOrFn = literalOrFn ;
171169 }
172170
173- async getTokenValue ( ) : Promise < TokenSourceResponseObject > {
171+ async generate ( ) : Promise < TokenSourceResponseObject > {
174172 if ( typeof this . literalOrFn === 'function' ) {
175173 return this . literalOrFn ( ) ;
176174 } else {
@@ -189,7 +187,7 @@ class TokenSourceCustom extends TokenSourceRefreshable {
189187 this . customFn = customFn ;
190188 }
191189
192- async generate ( options : TokenSourceOptions ) {
190+ async update ( options : TokenSourceOptions ) {
193191 const resultMaybePromise = this . customFn ( options ) ;
194192
195193 let result ;
@@ -220,7 +218,7 @@ class TokenSourceEndpoint extends TokenSourceRefreshable {
220218 this . endpointOptions = options ;
221219 }
222220
223- async generate ( options : TokenSourceOptions ) {
221+ async update ( options : TokenSourceOptions ) {
224222 // NOTE: I don't like the repetitive nature of this, `options` shouldn't be a thing,
225223 // `request` should just be passed through instead...
226224 const request = new TokenSourceRequest ( ) ;
0 commit comments