@sap-ux/axios-extension 1.7.0 → 1.7.1

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.
@@ -73,6 +73,7 @@ export declare const abapUrlReplaceMap: Map<RegExp, string>;
73
73
  export declare class Ui5AbapRepositoryService extends ODataService {
74
74
  static readonly PATH = "/sap/opu/odata/UI5/ABAP_REPOSITORY_SRV";
75
75
  private readonly publicUrl;
76
+ private readonly isDest;
76
77
  /**
77
78
  * Extension of the base constructor to set preferred response format if not provided by caller.
78
79
  *
@@ -166,12 +167,10 @@ export declare class Ui5AbapRepositoryService extends ODataService {
166
167
  * @param e error thrown by Axios after sending a request
167
168
  * @param e.error error from Axios
168
169
  * @param e.host hostname
169
- * @param e.isDest
170
170
  */
171
- protected logError({ error, host, isDest }: {
171
+ protected logError({ error, host }: {
172
172
  error: Error;
173
173
  host?: string;
174
- isDest?: boolean;
175
174
  }): void;
176
175
  /**
177
176
  * Get ErrorMessage object from response contain an error as a string.
@@ -52,6 +52,7 @@ class Ui5AbapRepositoryService extends odata_service_1.ODataService {
52
52
  config.headers['Accept'] = (_b = config.headers['Accept']) !== null && _b !== void 0 ? _b : 'application/json,application/xml,text/plain,*/*';
53
53
  super(config);
54
54
  this.publicUrl = config.publicUrl || this.defaults.baseURL;
55
+ this.isDest = /\.dest\//.test(this.defaults.baseURL);
55
56
  }
56
57
  /**
57
58
  * Get information about a deployed application. Returns undefined if the application cannot be found.
@@ -121,7 +122,6 @@ class Ui5AbapRepositoryService extends odata_service_1.ODataService {
121
122
  this.log.debug(`Payload:\n${payload}`);
122
123
  const config = this.createConfig(bsp.transport, testMode, safeMode);
123
124
  const frontendUrl = this.getAbapFrontendUrl();
124
- const isDest = /\.dest\//.test(config.baseURL);
125
125
  try {
126
126
  const response = yield this.updateRepoRequest(!!info, bsp.name, payload, config);
127
127
  // An app can be successfully deployed after a timeout exception, no value in showing exception headers
@@ -130,7 +130,7 @@ class Ui5AbapRepositoryService extends odata_service_1.ODataService {
130
130
  msg: response.headers['sap-message'],
131
131
  log: this.log,
132
132
  host: frontendUrl,
133
- isDest
133
+ isDest: this.isDest
134
134
  });
135
135
  }
136
136
  if (!testMode) {
@@ -147,13 +147,13 @@ class Ui5AbapRepositoryService extends odata_service_1.ODataService {
147
147
  error: this.getErrorMessageFromString(response === null || response === void 0 ? void 0 : response.data),
148
148
  log: this.log,
149
149
  host: frontendUrl,
150
- isDest
150
+ isDest: this.isDest
151
151
  }, false);
152
152
  }
153
153
  return response;
154
154
  }
155
155
  catch (error) {
156
- this.logError({ error, host: frontendUrl, isDest });
156
+ this.logError({ error, host: frontendUrl });
157
157
  throw error;
158
158
  }
159
159
  });
@@ -172,7 +172,6 @@ class Ui5AbapRepositoryService extends odata_service_1.ODataService {
172
172
  const config = this.createConfig(bsp.transport, testMode);
173
173
  const host = this.getAbapFrontendUrl();
174
174
  const info = yield this.getInfo(bsp.name);
175
- const isDest = /\.dest\//.test(config.baseURL);
176
175
  try {
177
176
  if (info) {
178
177
  const response = yield this.deleteRepoRequest(bsp.name, config);
@@ -181,7 +180,7 @@ class Ui5AbapRepositoryService extends odata_service_1.ODataService {
181
180
  msg: response.headers['sap-message'],
182
181
  log: this.log,
183
182
  host,
184
- isDest
183
+ isDest: this.isDest
185
184
  });
186
185
  }
187
186
  return response;
@@ -192,7 +191,7 @@ class Ui5AbapRepositoryService extends odata_service_1.ODataService {
192
191
  }
193
192
  }
194
193
  catch (error) {
195
- this.logError({ error, host, isDest });
194
+ this.logError({ error, host });
196
195
  throw error;
197
196
  }
198
197
  });
@@ -366,15 +365,14 @@ class Ui5AbapRepositoryService extends odata_service_1.ODataService {
366
365
  * @param e error thrown by Axios after sending a request
367
366
  * @param e.error error from Axios
368
367
  * @param e.host hostname
369
- * @param e.isDest
370
368
  */
371
- logError({ error, host, isDest }) {
369
+ logError({ error, host }) {
372
370
  var _a, _b;
373
371
  this.log.error(error.message);
374
372
  if ((0, odata_request_error_1.isAxiosError)(error) && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.data)) {
375
373
  const errorMessage = this.getErrorMessageFromString((_b = error.response) === null || _b === void 0 ? void 0 : _b.data);
376
374
  if (errorMessage) {
377
- (0, message_1.prettyPrintError)({ error: errorMessage, host, log: this.log, isDest });
375
+ (0, message_1.prettyPrintError)({ error: errorMessage, host, log: this.log, isDest: this.isDest });
378
376
  }
379
377
  else {
380
378
  this.log.error(error.response.data.toString());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap-ux/axios-extension",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "Extension of the Axios module adding convenience methods to interact with SAP systems especially with OData services.",
5
5
  "repository": {
6
6
  "type": "git",