sailpoint-api-client 1.0.3 → 1.1.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.
package/cc/common.ts CHANGED
@@ -134,8 +134,8 @@ export const toPathString = function (url: URL) {
134
134
  export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
135
135
  return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
136
136
  axiosRetry(globalAxios, configuration.retriesConfig)
137
- axiosArgs.axiosOptions.headers['X-SailPoint-SDK'] = 'typescript-1.0.3'
138
- axiosArgs.axiosOptions.headers['User-Agent'] = 'OpenAPI-Generator/1.0.3/ts'
137
+ axiosArgs.axiosOptions.headers['X-SailPoint-SDK'] = 'typescript-1.1.0'
138
+ axiosArgs.axiosOptions.headers['User-Agent'] = 'OpenAPI-Generator/1.1.0/ts'
139
139
  const axiosRequestArgs = {...axiosArgs.axiosOptions, url: (configuration?.basePathCC || basePath) + axiosArgs.url};
140
140
  return axios.request<T, R>(axiosRequestArgs);
141
141
  };
package/cc/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sailpoint-sdk",
3
- "version": "1.0.3",
3
+ "version": "1.1.0",
4
4
  "description": "OpenAPI client for sailpoint-sdk",
5
5
  "author": "OpenAPI-Generator Contributors",
6
6
  "repository": {
package/configuration.ts CHANGED
@@ -162,7 +162,7 @@ export class Configuration {
162
162
 
163
163
  }
164
164
 
165
- private getParams(): ConfigurationParameters {
165
+ private getHomeParams(): ConfigurationParameters {
166
166
  const config: ConfigurationParameters = {}
167
167
  try {
168
168
  const homeDir = os.homedir()
@@ -172,19 +172,59 @@ export class Configuration {
172
172
  config.baseurl = doc.environments[doc.activeenvironment].baseurl
173
173
  config.clientId = doc.environments[doc.activeenvironment].pat.clientid
174
174
  config.clientSecret = doc.environments[doc.activeenvironment].pat.clientsecret
175
+ config.tokenUrl = config.baseurl + '/oauth/token'
175
176
  }
176
177
  } catch (error) {
177
- console.log('unable to find config file')
178
+ console.log('unable to find config file in home directory')
179
+ }
180
+ return config
181
+ }
182
+
183
+ private getLocalParams(): ConfigurationParameters {
184
+ const config: ConfigurationParameters = {}
185
+ try {
186
+ const configPath = './config.json'
187
+ const jsonString = fs.readFileSync(configPath, 'utf-8');
188
+ const jsonData = JSON.parse(jsonString);
189
+ config.baseurl = jsonData.BaseURL
190
+ config.clientId = jsonData.ClientId
191
+ config.clientSecret = jsonData.ClientSecret
192
+ config.tokenUrl = config.baseurl + '/oauth/token'
193
+ } catch (error) {
194
+ console.log('unable to find config file in local directory')
178
195
  }
179
- config.baseurl = process.env["SAIL_BASE_URL"] ? process.env["SAIL_BASE_URL"] : config.baseurl
180
- config.clientId = process.env["SAIL_CLIENT_ID"] ? process.env["SAIL_CLIENT_ID"] : config.clientId
181
- config.clientSecret = process.env["SAIL_CLIENT_SECRET"] ? process.env["SAIL_CLIENT_SECRET"] : config.clientSecret
196
+ return config
197
+ }
198
+
199
+ private getEnvParams(): ConfigurationParameters {
200
+ const config: ConfigurationParameters = {}
201
+ config.baseurl = process.env["SAIL_BASE_URL"] ? process.env["SAIL_BASE_URL"] : ""
202
+ config.clientId = process.env["SAIL_CLIENT_ID"] ? process.env["SAIL_CLIENT_ID"] : ""
203
+ config.clientSecret = process.env["SAIL_CLIENT_SECRET"] ? process.env["SAIL_CLIENT_SECRET"] : ""
182
204
 
183
205
  config.tokenUrl = config.baseurl + '/oauth/token'
184
206
 
185
207
  return config
186
208
  }
187
209
 
210
+ private getParams(): ConfigurationParameters {
211
+ const envConfig = this.getEnvParams()
212
+ if (envConfig.baseurl) {
213
+ return envConfig
214
+ }
215
+ const localConfig = this.getLocalParams()
216
+ if (localConfig.baseurl) {
217
+ return localConfig
218
+ }
219
+ const homeConfig = this.getHomeParams()
220
+ if (homeConfig.baseurl) {
221
+ console.log("Configuration file found in home directory, this approach of loading configuration will be deprecated in future releases, please upgrade the CLI and use the new 'sail sdk init config' command to create a local configuration file")
222
+ return homeConfig
223
+ }
224
+ return {}
225
+
226
+ }
227
+
188
228
  private async getAccessToken(url: string): Promise<string> {
189
229
  try {
190
230
  const {data, status} = await axios.post(url)