@@ -111,15 +111,15 @@ export class Configuration {
111
111
this . apiHost = params . apiHost ! ;
112
112
this . storeId = params . storeId ! ;
113
113
114
- const credentialOpts = params . credentials ;
114
+ const credentialParams = params . credentials ;
115
115
116
- if ( credentialOpts ) {
117
- switch ( credentialOpts ?. method ) {
116
+ if ( credentialParams ) {
117
+ switch ( credentialParams ?. method ) {
118
118
case CredentialsMethod . ApiToken :
119
119
this . credentials = {
120
- method : credentialOpts . method ,
120
+ method : credentialParams . method ,
121
121
config : {
122
- token : credentialOpts . config . token ! ,
122
+ token : credentialParams . config . token ! ,
123
123
headerName : "Authorization" ,
124
124
headerValuePrefix : "Bearer" ,
125
125
}
@@ -129,11 +129,11 @@ export class Configuration {
129
129
this . credentials = {
130
130
method : CredentialsMethod . ClientCredentials ,
131
131
config : {
132
- // We are enforcing that they exist here, but validating that they set later in isValid
133
- clientId : credentialOpts . config . clientId ,
134
- clientSecret : credentialOpts . config . clientSecret ,
135
- apiAudience : credentialOpts . config . apiAudience ,
136
- apiTokenIssuer : credentialOpts . config . apiTokenIssuer ,
132
+ // We are only copying them from the passed in params here. We will be validating that they are valid in the Credentials constructor
133
+ clientId : credentialParams . config . clientId ,
134
+ clientSecret : credentialParams . config . clientSecret ,
135
+ apiAudience : credentialParams . config . apiAudience ,
136
+ apiTokenIssuer : credentialParams . config . apiTokenIssuer ,
137
137
}
138
138
} ;
139
139
break ;
@@ -156,10 +156,11 @@ export class Configuration {
156
156
}
157
157
158
158
/**
159
- * Ensures that the Configuration is valid
160
- * @return boolean
159
+ *
160
+ * @return {boolean }
161
+ * @throws {FgaValidationError }
161
162
*/
162
- public isValid ( ) {
163
+ public isValid ( ) : boolean {
163
164
assertParamExists ( "Configuration" , "apiScheme" , this . apiScheme ) ;
164
165
assertParamExists ( "Configuration" , "apiHost" , this . apiHost ) ;
165
166
0 commit comments