@sap/ux-ui5-tooling 1.4.7 → 1.5.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.
@@ -110193,7 +110193,7 @@ class Ui5AbapRepository extends oDataClient_1.ODataClient {
110193
110193
  if (tryCount === 2) {
110194
110194
  this.log.warn('Warning: retry undeploy to handle a backend rejection...');
110195
110195
  }
110196
- return await httpClient.delete(`/Repositories('${appName}')`, config);
110196
+ return await httpClient.delete(`/Repositories('${encodeURIComponent(appName)}')`, config);
110197
110197
  }
110198
110198
  catch (error) {
110199
110199
  if (((_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.status) === 400) {
@@ -110487,14 +110487,14 @@ async function fetchDestinations() {
110487
110487
  * @param destination name of the destination
110488
110488
  * @param destinationInstance name of the destination instance as provided in the mta.yaml
110489
110489
  */
110490
- async function getUrlForInstanceBasedDest(destination, destinationInstance) {
110490
+ async function getAuthHeaderForInstanceBasedDest(destinationInstance) {
110491
110491
  var _a, _b;
110492
110492
  try {
110493
- const credentials = await cf_tools_1.apiGetInstanceCredentials(destinationInstance);
110493
+ const credentials = (await cf_tools_1.apiGetInstanceCredentials(destinationInstance)).credentials;
110494
110494
  const clientId = ((_a = credentials.uaa) === null || _a === void 0 ? void 0 : _a.clientid) || credentials.clientid;
110495
110495
  const clientSecret = ((_b = credentials.uaa) === null || _b === void 0 ? void 0 : _b.clientsecret) || credentials.clientsecret;
110496
- const base64Host = Buffer.from(`${clientId}:${clientSecret}`).toString('base64');
110497
- return `https://${base64Host}@${destination}${DEST}`;
110496
+ const base64Header = Buffer.from(`${encodeURIComponent(clientId)}:${encodeURIComponent(clientSecret)}`).toString('base64');
110497
+ return base64Header;
110498
110498
  }
110499
110499
  catch (error) {
110500
110500
  throw new Error(`An error occurred while retrieving service key for the destination instance ${destinationInstance}: ${error}`);
@@ -110524,7 +110524,8 @@ async function replaceUrlForAppStudio(systemConfig, destinationName, destination
110524
110524
  var _a, _b;
110525
110525
  systemConfig.originalUrl = systemConfig.url;
110526
110526
  if (destinationName && destinationInstance) {
110527
- systemConfig.url = await getUrlForInstanceBasedDest(destinationName, destinationInstance);
110527
+ systemConfig.url = `https://${destinationName}${DEST}`;
110528
+ systemConfig.basDestinationInstanceCred = await getAuthHeaderForInstanceBasedDest(destinationInstance);
110528
110529
  }
110529
110530
  else {
110530
110531
  systemConfig.url = ux_common_utils_1.getAppStudioBaseURL();
@@ -110702,8 +110703,7 @@ function throwIfHtmlLoginForm(response) {
110702
110703
  if ((response === null || response === void 0 ? void 0 : response.status) !== 200) {
110703
110704
  return;
110704
110705
  }
110705
- if (response.headers['sap-err-id'] === 'ICFLOGONREQUIRED' ||
110706
- isHtmlLoginForm(response.headers['content-type'], response.data)) {
110706
+ if (response.headers['sap-err-id'] === 'ICFLOGONREQUIRED' || isHtmlLoginForm(response)) {
110707
110707
  const err = new Error();
110708
110708
  err.response = { status: 401 };
110709
110709
  err.isAxiosError = true;
@@ -110713,9 +110713,11 @@ function throwIfHtmlLoginForm(response) {
110713
110713
  throw err;
110714
110714
  }
110715
110715
  }
110716
- function isHtmlLoginForm(contentTypeHeader, responseData) {
110717
- const contentType = getContentType(contentTypeHeader, responseData);
110718
- return contentType.startsWith('text/html') && typeof responseData === 'string' && !!responseData.match(/log[io]n/i);
110716
+ function isHtmlResponse(response) {
110717
+ return getContentType(response.headers['content-type'], response.data).startsWith('text/html');
110718
+ }
110719
+ function isHtmlLoginForm(response) {
110720
+ return isHtmlResponse(response) && typeof response.data === 'string' && !!response.data.match(/log[io]n/i);
110719
110721
  }
110720
110722
  /**
110721
110723
  * Given a possibly missing content-type header and response data,
@@ -110739,10 +110741,10 @@ function getContentType(contentTypeHeader, responseData) {
110739
110741
  * Did we get a SAML login form?
110740
110742
  */
110741
110743
  function isSamlLogonNeeded(response) {
110742
- var _a;
110743
- return ((response === null || response === void 0 ? void 0 : response.status) === 200 && ((_a = response.headers['content-type']) === null || _a === void 0 ? void 0 : _a.toLowerCase().startsWith('text/html')) &&
110744
+ return ((response === null || response === void 0 ? void 0 : response.status) === 200 &&
110745
+ isHtmlResponse(response) &&
110744
110746
  typeof response.data === 'string' &&
110745
- !!(response === null || response === void 0 ? void 0 : response.data.match(/saml/i)));
110747
+ !!response.data.match(/saml/i));
110746
110748
  }
110747
110749
  /**
110748
110750
  * Generic connect method that will be used as abstraction of different authentication methods.
@@ -112068,6 +112070,68 @@ function guessAuthType({ credentials, fallback = false }) {
112068
112070
  return authType;
112069
112071
  }
112070
112072
  exports.guessAuthType = guessAuthType;
112073
+ /**
112074
+ * Gets onPrem system from store and creates one if none present
112075
+ * @param system system details
112076
+ * @returns sap system from store, and boolean if it's a new system
112077
+ */
112078
+ async function getOnPremSystem(system) {
112079
+ let sapSystem = await __1.getSapSystem(system.url, system.client);
112080
+ let isNewSystem = false;
112081
+ const creds = {
112082
+ username: system.credentials.systemUsername,
112083
+ password: system.credentials.systemPassword
112084
+ };
112085
+ if (sapSystem) {
112086
+ sapSystem.name = system.name || '';
112087
+ sapSystem.setCredentials(creds);
112088
+ }
112089
+ else {
112090
+ sapSystem = __1.newSapSystem(system.name || '', system.url, system.client, creds, true);
112091
+ isNewSystem = true;
112092
+ }
112093
+ return [sapSystem, isNewSystem];
112094
+ }
112095
+ exports.getOnPremSystem = getOnPremSystem;
112096
+ /**
112097
+ * Gets BTP system from store and creates one if none present
112098
+ * @param system system details
112099
+ * @returns sap system from store, and boolean if it's a new system
112100
+ */
112101
+ async function getBTPSystem(system, savedSapSystemServiceKey) {
112102
+ let sapSystem;
112103
+ let isNewSystem = false;
112104
+ if (system.url && system.credentials === savedSapSystemServiceKey) {
112105
+ sapSystem = await __1.getSapSystem(system.url, system.client);
112106
+ }
112107
+ if (sapSystem) {
112108
+ sapSystem.name = system.name || '';
112109
+ }
112110
+ else {
112111
+ sapSystem = __1.newSapSystemForSteampunk(system.name || '', system.credentials);
112112
+ if (sapSystem) {
112113
+ isNewSystem = true;
112114
+ }
112115
+ }
112116
+ return [sapSystem, isNewSystem];
112117
+ }
112118
+ exports.getBTPSystem = getBTPSystem;
112119
+ async function isSystemNameValid(newName, savedSystemName) {
112120
+ if (newName && newName !== savedSystemName && (await __1.isSystemNameInUse(newName))) {
112121
+ return false;
112122
+ }
112123
+ return true;
112124
+ }
112125
+ exports.isSystemNameValid = isSystemNameValid;
112126
+ async function isSapSystemConnected(sapSystem) {
112127
+ const catalogV2 = await sapSystem.getCatalog(__1.ODataVersion.v2);
112128
+ const catalogV4 = await sapSystem.getCatalog(__1.ODataVersion.v4);
112129
+ if (catalogV2 || catalogV4) {
112130
+ return true;
112131
+ }
112132
+ return false;
112133
+ }
112134
+ exports.isSapSystemConnected = isSapSystemConnected;
112071
112135
 
112072
112136
 
112073
112137
  /***/ }),
@@ -140983,7 +141047,7 @@ module.exports = JSON.parse('{"ERROR_SPECIFICATION_MISSING":"Seems specification
140983
141047
  /***/ ((module) => {
140984
141048
 
140985
141049
  "use strict";
140986
- module.exports = JSON.parse('{"name":"@sap/ux-telemetry","version":"1.4.7","description":"SAP Fiori tools telemetry library","main":"dist/src/index.js","author":"SAP SE","license":"MIT","private":true,"azureInstrumentationKey":"0a65e45d-6bf4-421d-b845-61e888c50e9e","azureProdKey":"0a65e45d-6bf4-421d-b845-61e888c50e9e","scripts":{"pre-commit":"lint-staged --quiet","clean":"rimraf ./dist","build":"ts-node ./build-script/ && yarn run clean && tsc --project ./","test":"jest --maxWorkers=1 --silent --ci --forceExit --detectOpenHandles","lint":"eslint . --ext .ts","lint:summary":"eslint . --ext .ts -f summary","lint:fix":"eslint --fix","lint:fix:all":"eslint . --ext .ts --fix","lint:report":"eslint . --ext .ts -f multiple --report-unused-disable-directives","format:fix":"prettier --write --loglevel silent --ignore-path ../../../.prettierignore","format:fix:all":"prettier --write \'**/*.{css,scss,html,js,json,ts,tsx,yaml,yml}\' \'!**/{out,dist,node_modules}/**\' \'!**/*.{svg,png,xml}\' --ignore-path ../../../.prettierignore","madge":"madge --warning --circular --extensions ts ./"},"dependencies":{"@sap/ux-cds":"1.4.7","@sap/ux-common-utils":"1.4.7","@sap/ux-feature-toggle":"1.4.7","@sap/ux-project-access":"1.4.7","applicationinsights":"1.4.1","performance-now":"2.1.0","yaml":"2.0.0-10"},"devDependencies":{"ts-node":"8.5.2","typescript":"3.8.3"},"files":["dist/"],"jestSonar":{"reportPath":"reports/test/unit","reportFile":"test-report.xml"},"eslint-formatter-multiple":{"formatters":[{"name":"stylish","output":"console"},{"name":"json","output":"file","path":"reports/lint/eslint.json"},{"name":"checkstyle","output":"file","path":"reports/lint/eslint.checkstyle.xml"}]}}');
141050
+ module.exports = JSON.parse('{"name":"@sap/ux-telemetry","version":"1.5.0","description":"SAP Fiori tools telemetry library","main":"dist/src/index.js","author":"SAP SE","license":"MIT","private":true,"azureInstrumentationKey":"0a65e45d-6bf4-421d-b845-61e888c50e9e","azureProdKey":"0a65e45d-6bf4-421d-b845-61e888c50e9e","scripts":{"pre-commit":"lint-staged --quiet","clean":"rimraf ./dist","build":"ts-node ./build-script/ && yarn run clean && tsc --project ./","test":"jest --maxWorkers=1 --silent --ci --forceExit --detectOpenHandles","lint":"eslint . --ext .ts","lint:summary":"eslint . --ext .ts -f summary","lint:fix":"eslint --fix","lint:fix:all":"eslint . --ext .ts --fix","lint:report":"eslint . --ext .ts -f multiple --report-unused-disable-directives","format:fix":"prettier --write --loglevel silent --ignore-path ../../../.prettierignore","format:fix:all":"prettier --write \'**/*.{css,scss,html,js,json,ts,tsx,yaml,yml}\' \'!**/{out,dist,node_modules}/**\' \'!**/*.{svg,png,xml}\' --ignore-path ../../../.prettierignore","madge":"madge --warning --circular --extensions ts ./"},"dependencies":{"@sap/ux-cds":"1.5.0","@sap/ux-common-utils":"1.5.0","@sap/ux-feature-toggle":"1.5.0","@sap/ux-project-access":"1.5.0","applicationinsights":"1.4.1","performance-now":"2.1.0","yaml":"2.0.0-10"},"devDependencies":{"ts-node":"8.5.2","typescript":"3.8.3"},"files":["dist/"],"jestSonar":{"reportPath":"reports/test/unit","reportFile":"test-report.xml"},"eslint-formatter-multiple":{"formatters":[{"name":"stylish","output":"console"},{"name":"json","output":"file","path":"reports/lint/eslint.json"},{"name":"checkstyle","output":"file","path":"reports/lint/eslint.checkstyle.xml"}]}}');
140987
141051
 
140988
141052
  /***/ }),
140989
141053