1- import { Authorization } from '@advanced-rest-client/events' ;
2- import { ProcessingOptions } from './types' ;
1+ import { ProcessingOptions , OAuth2Authorization as OAuth2Config , TokenInfo } from './types' ;
32
43export declare const resolveFunction : unique symbol ;
54export declare const rejectFunction : unique symbol ;
@@ -38,16 +37,13 @@ export declare const grantResponseMapping: Record<string, string>;
3837
3938/**
4039 * A library that performs OAuth 2 authorization.
41- *
42- * It is build for API components ecosystem and the configuration is defined in `@advanced-rest-client/events`
43- * so all components use the same configuration.
4440 */
4541export class OAuth2Authorization {
4642 /**
4743 * The authorization settings used to initialize this class.
4844 */
49- get settings ( ) : Authorization . OAuth2Authorization ;
50- [ settingsValue ] : Authorization . OAuth2Authorization ;
45+ get settings ( ) : OAuth2Config ;
46+ [ settingsValue ] : OAuth2Config ;
5147
5248 /**
5349 * The processing options used to initialize this object.
@@ -70,12 +66,12 @@ export class OAuth2Authorization {
7066 * @param settings The authorization configuration.
7167 * @param options Additional processing options to configure the behavior of this library.
7268 */
73- constructor ( settings : Authorization . OAuth2Authorization , options ?: ProcessingOptions ) ;
69+ constructor ( settings : OAuth2Config , options ?: ProcessingOptions ) ;
7470
7571 /**
7672 * @returns Processed settings
7773 */
78- [ prepareSettings ] ( settings : Authorization . OAuth2Authorization ) : Authorization . OAuth2Authorization ;
74+ [ prepareSettings ] ( settings : OAuth2Config ) : OAuth2Config ;
7975
8076 /**
8177 * @returns Processed options
@@ -93,7 +89,7 @@ export class OAuth2Authorization {
9389 * Performs the authorization.
9490 * @returns Promise resolved to the token info.
9591 */
96- authorize ( ) : Promise < Authorization . TokenInfo | any > ;
92+ authorize ( ) : Promise < TokenInfo | any > ;
9793
9894 /**
9995 * Reports authorization error back to the application.
@@ -204,14 +200,14 @@ export class OAuth2Authorization {
204200 /**
205201 * Creates a token info object from query parameters
206202 */
207- [ tokenInfoFromParams ] ( oauthParams : URLSearchParams ) : Authorization . TokenInfo ;
203+ [ tokenInfoFromParams ] ( oauthParams : URLSearchParams ) : TokenInfo ;
208204
209205 /**
210206 * Processes token info object when it's ready.
211207 *
212208 * @param info Token info returned from the server.
213209 */
214- [ handleTokenInfo ] ( info : Authorization . TokenInfo ) : void ;
210+ [ handleTokenInfo ] ( info : TokenInfo ) : void ;
215211
216212 /**
217213 * Computes token expiration time.
@@ -221,7 +217,7 @@ export class OAuth2Authorization {
221217 * @param tokenInfo Token info object
222218 * @returns A copy with updated properties.
223219 */
224- [ computeExpires ] ( tokenInfo : Authorization . TokenInfo ) : Authorization . TokenInfo ;
220+ [ computeExpires ] ( tokenInfo : TokenInfo ) : TokenInfo ;
225221
226222 /**
227223 * Computes the final list of granted scopes.
@@ -260,15 +256,15 @@ export class OAuth2Authorization {
260256 * @param info
261257 * @returns The token info when the request was a success.
262258 */
263- mapCodeResponse ( info : Record < string , any > ) : Authorization . TokenInfo ;
259+ mapCodeResponse ( info : Record < string , any > ) : TokenInfo ;
264260
265261 /**
266262 * Exchanges the authorization code for authorization token.
267263 *
268264 * @param code Returned code from the authorization endpoint.
269265 * @returns The token info when the request was a success.
270266 */
271- exchangeCode ( code : string ) : Promise < Authorization . TokenInfo > ;
267+ exchangeCode ( code : string ) : Promise < TokenInfo > ;
272268
273269 /**
274270 * Returns a body value for the code exchange request.
@@ -305,7 +301,7 @@ export class OAuth2Authorization {
305301 *
306302 * @param settings The OAuth 2 settings to use
307303 */
308- getClientCredentialsHeader ( settings : Authorization . OAuth2Authorization ) : string ;
304+ getClientCredentialsHeader ( settings : OAuth2Config ) : string ;
309305
310306 /**
311307 * Requests a token for `client_credentials` request type.
0 commit comments