@sap-ux/deploy-config-generator-shared 0.0.17 → 0.0.18

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/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export { DeploymentGenerator } from './base/generator';
2
- export { initI18n, bail, handleErrorMessage, showOverwriteQuestion, ErrorHandler, ERROR_TYPE, ConnectedSystem, mtaExecutable } from './utils';
2
+ export * from './utils';
3
3
  export { getConfirmConfigUpdatePrompt } from './prompts';
4
4
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,16 +1,23 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getConfirmConfigUpdatePrompt = exports.mtaExecutable = exports.ERROR_TYPE = exports.ErrorHandler = exports.showOverwriteQuestion = exports.handleErrorMessage = exports.bail = exports.initI18n = exports.DeploymentGenerator = void 0;
17
+ exports.getConfirmConfigUpdatePrompt = exports.DeploymentGenerator = void 0;
4
18
  var generator_1 = require("./base/generator");
5
19
  Object.defineProperty(exports, "DeploymentGenerator", { enumerable: true, get: function () { return generator_1.DeploymentGenerator; } });
6
- var utils_1 = require("./utils");
7
- Object.defineProperty(exports, "initI18n", { enumerable: true, get: function () { return utils_1.initI18n; } });
8
- Object.defineProperty(exports, "bail", { enumerable: true, get: function () { return utils_1.bail; } });
9
- Object.defineProperty(exports, "handleErrorMessage", { enumerable: true, get: function () { return utils_1.handleErrorMessage; } });
10
- Object.defineProperty(exports, "showOverwriteQuestion", { enumerable: true, get: function () { return utils_1.showOverwriteQuestion; } });
11
- Object.defineProperty(exports, "ErrorHandler", { enumerable: true, get: function () { return utils_1.ErrorHandler; } });
12
- Object.defineProperty(exports, "ERROR_TYPE", { enumerable: true, get: function () { return utils_1.ERROR_TYPE; } });
13
- Object.defineProperty(exports, "mtaExecutable", { enumerable: true, get: function () { return utils_1.mtaExecutable; } });
20
+ __exportStar(require("./utils"), exports);
14
21
  var prompts_1 = require("./prompts");
15
22
  Object.defineProperty(exports, "getConfirmConfigUpdatePrompt", { enumerable: true, get: function () { return prompts_1.getConfirmConfigUpdatePrompt; } });
16
23
  //# sourceMappingURL=index.js.map
@@ -10,7 +10,8 @@
10
10
  "fileDoesNotExist": "File does not exist: {{- filePath}}",
11
11
  "folderDoesNotExist": "Folder path does not exist: {{- filePath}}",
12
12
  "noAppName": "Could not determine app name from manifest",
13
- "noBinary": "Cannot find the \"{{bin}}\" executable. Please add it to the path or use \"npm i -g {{pkg}}\" to install it.",
13
+ "noBaseConfig": "Error: could not read {{- baseConfig}}",
14
+ "noBinary": "Cannot find the \"{{bin}}\" executable. Please add it to the path or use \"npm i -g {{- pkg}}\" to install it.",
14
15
  "noManifest": "Error: could not read webapp/manifest.json",
15
16
  "unrecognizedTarget": "Unrecognized target: {{target}}",
16
17
  "unknownError": "Unknown error"
@@ -3,4 +3,8 @@ export declare const cdsPkg = "@sap/cds-dk";
3
3
  export declare const mtaExecutable = "mta";
4
4
  export declare const mtaPkg = "mta";
5
5
  export declare const mtaYaml = "mta.yaml";
6
+ export declare enum TargetName {
7
+ ABAP = "abap",
8
+ CF = "cf"
9
+ }
6
10
  //# sourceMappingURL=constants.d.ts.map
@@ -1,9 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mtaYaml = exports.mtaPkg = exports.mtaExecutable = exports.cdsPkg = exports.cdsExecutable = void 0;
3
+ exports.TargetName = exports.mtaYaml = exports.mtaPkg = exports.mtaExecutable = exports.cdsPkg = exports.cdsExecutable = void 0;
4
4
  exports.cdsExecutable = 'cds';
5
5
  exports.cdsPkg = '@sap/cds-dk';
6
6
  exports.mtaExecutable = 'mta';
7
7
  exports.mtaPkg = 'mta';
8
8
  exports.mtaYaml = 'mta.yaml';
9
+ var TargetName;
10
+ (function (TargetName) {
11
+ TargetName["ABAP"] = "abap";
12
+ TargetName["CF"] = "cf";
13
+ })(TargetName || (exports.TargetName = TargetName = {}));
9
14
  //# sourceMappingURL=constants.js.map
@@ -0,0 +1,18 @@
1
+ import type { Destination } from '@sap-ux/btp-utils';
2
+ /**
3
+ * Generate a destination name based on the service path.
4
+ * Remove leading & trailing '/'. Substitute '/' for '_'.
5
+ *
6
+ * @param prefix - prefixes the dest name
7
+ * @param servicePath - used to create a meaningful dest name
8
+ * @returns destination name
9
+ */
10
+ export declare function generateDestinationName(prefix: string, servicePath?: string): string;
11
+ /**
12
+ * Get the destination with the specified name.
13
+ *
14
+ * @param destName - name of the destination
15
+ * @returns destination object
16
+ */
17
+ export declare function getDestination(destName?: string): Promise<Destination | undefined>;
18
+ //# sourceMappingURL=destination.d.ts.map
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDestination = exports.generateDestinationName = void 0;
4
+ const btp_utils_1 = require("@sap-ux/btp-utils");
5
+ /**
6
+ * Generate a destination name based on the service path.
7
+ * Remove leading & trailing '/'. Substitute '/' for '_'.
8
+ *
9
+ * @param prefix - prefixes the dest name
10
+ * @param servicePath - used to create a meaningful dest name
11
+ * @returns destination name
12
+ */
13
+ function generateDestinationName(prefix, servicePath) {
14
+ return `${prefix}_${servicePath?.replace(/(^\/)|(\/$)/g, '').replace(/\//g, '_')}`;
15
+ }
16
+ exports.generateDestinationName = generateDestinationName;
17
+ /**
18
+ * Get the destination with the specified name.
19
+ *
20
+ * @param destName - name of the destination
21
+ * @returns destination object
22
+ */
23
+ async function getDestination(destName) {
24
+ let destination;
25
+ if ((0, btp_utils_1.isAppStudio)() && destName) {
26
+ const destinations = await (0, btp_utils_1.listDestinations)({ stripS4HCApiHosts: true });
27
+ destination = destinations[destName];
28
+ }
29
+ return destination;
30
+ }
31
+ exports.getDestination = getDestination;
32
+ //# sourceMappingURL=destination.js.map
@@ -3,7 +3,6 @@ export declare enum ERROR_TYPE {
3
3
  ABORT_SIGNAL = "ABORT_SIGNAL",
4
4
  NO_MANIFEST = "NO_MANIFEST",
5
5
  NO_APP_NAME = "NO_APP_NAME",
6
- NO_UI5_CONFIG = "NO_UI5_CONFIG",
7
6
  NO_CDS_BIN = "NO_CDS_BIN",
8
7
  NO_MTA_BIN = "NO_MTA_BIN",
9
8
  CAP_DEPLOYMENT_NO_MTA = "CAP_DEPLOYMENT_NO_MTA"
@@ -21,6 +20,7 @@ export declare class ErrorHandler {
21
20
  */
22
21
  static getErrorMsgFromType(errorType?: ERROR_TYPE): string;
23
22
  private static readonly _errorTypeToMsg;
23
+ static readonly noBaseConfig: (baseConfig: string) => string;
24
24
  static readonly unrecognizedTarget: (target: string) => string;
25
25
  static readonly fileDoesNotExist: (filePath: string) => string;
26
26
  static readonly folderDoesNotExist: (filePath: string) => string;
@@ -11,7 +11,6 @@ var ERROR_TYPE;
11
11
  ERROR_TYPE["ABORT_SIGNAL"] = "ABORT_SIGNAL";
12
12
  ERROR_TYPE["NO_MANIFEST"] = "NO_MANIFEST";
13
13
  ERROR_TYPE["NO_APP_NAME"] = "NO_APP_NAME";
14
- ERROR_TYPE["NO_UI5_CONFIG"] = "NO_UI5_CONFIG";
15
14
  ERROR_TYPE["NO_CDS_BIN"] = "NO_CDS_BIN";
16
15
  ERROR_TYPE["NO_MTA_BIN"] = "NO_MTA_BIN";
17
16
  ERROR_TYPE["CAP_DEPLOYMENT_NO_MTA"] = "CAP_DEPLOYMENT_NO_MTA";
@@ -37,11 +36,11 @@ class ErrorHandler {
37
36
  [ERROR_TYPE.ABORT_SIGNAL]: () => (0, i18n_1.t)('errors.abortSignal'),
38
37
  [ERROR_TYPE.NO_MANIFEST]: () => (0, i18n_1.t)('errors.noManifest'),
39
38
  [ERROR_TYPE.NO_APP_NAME]: () => (0, i18n_1.t)('errors.noAppName'),
40
- [ERROR_TYPE.NO_UI5_CONFIG]: () => (0, i18n_1.t)('errors.noUi5Config'),
41
39
  [ERROR_TYPE.NO_CDS_BIN]: () => ErrorHandler.cannotFindBinary(constants_1.cdsExecutable, constants_1.cdsPkg),
42
40
  [ERROR_TYPE.NO_MTA_BIN]: () => ErrorHandler.cannotFindBinary(constants_1.mtaExecutable, constants_1.mtaPkg),
43
41
  [ERROR_TYPE.CAP_DEPLOYMENT_NO_MTA]: () => (0, i18n_1.t)('errors.capDeploymentNoMta')
44
42
  };
43
+ static noBaseConfig = (baseConfig) => (0, i18n_1.t)('errors.noBaseConfig', { baseConfig });
45
44
  static unrecognizedTarget = (target) => (0, i18n_1.t)('errors.unrecognizedTarget', { target });
46
45
  static fileDoesNotExist = (filePath) => (0, i18n_1.t)('errors.fileDoesNotExist', { filePath });
47
46
  static folderDoesNotExist = (filePath) => (0, i18n_1.t)('errors.folderDoesNotExist', { filePath });
@@ -1,6 +1,7 @@
1
1
  export { t, initI18n } from './i18n';
2
2
  export { showOverwriteQuestion } from './conditions';
3
3
  export { ErrorHandler, ERROR_TYPE, bail, handleErrorMessage } from './error-handler';
4
- export { mtaExecutable } from './constants';
4
+ export * from './constants';
5
+ export * from './destination';
5
6
  export * from './types';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.mtaExecutable = exports.handleErrorMessage = exports.bail = exports.ERROR_TYPE = exports.ErrorHandler = exports.showOverwriteQuestion = exports.initI18n = exports.t = void 0;
17
+ exports.handleErrorMessage = exports.bail = exports.ERROR_TYPE = exports.ErrorHandler = exports.showOverwriteQuestion = exports.initI18n = exports.t = void 0;
18
18
  var i18n_1 = require("./i18n");
19
19
  Object.defineProperty(exports, "t", { enumerable: true, get: function () { return i18n_1.t; } });
20
20
  Object.defineProperty(exports, "initI18n", { enumerable: true, get: function () { return i18n_1.initI18n; } });
@@ -25,7 +25,7 @@ Object.defineProperty(exports, "ErrorHandler", { enumerable: true, get: function
25
25
  Object.defineProperty(exports, "ERROR_TYPE", { enumerable: true, get: function () { return error_handler_1.ERROR_TYPE; } });
26
26
  Object.defineProperty(exports, "bail", { enumerable: true, get: function () { return error_handler_1.bail; } });
27
27
  Object.defineProperty(exports, "handleErrorMessage", { enumerable: true, get: function () { return error_handler_1.handleErrorMessage; } });
28
- var constants_1 = require("./constants");
29
- Object.defineProperty(exports, "mtaExecutable", { enumerable: true, get: function () { return constants_1.mtaExecutable; } });
28
+ __exportStar(require("./constants"), exports);
29
+ __exportStar(require("./destination"), exports);
30
30
  __exportStar(require("./types"), exports);
31
31
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/deploy-config-generator-shared",
3
3
  "description": "Commonly used shared functionality and types to support the deploy config generator.",
4
- "version": "0.0.17",
4
+ "version": "0.0.18",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -20,6 +20,7 @@
20
20
  "@vscode-logging/logger": "2.0.0",
21
21
  "i18next": "20.6.1",
22
22
  "yeoman-generator": "5.10.0",
23
+ "@sap-ux/btp-utils": "1.0.0",
23
24
  "@sap-ux/fiori-generator-shared": "0.7.25",
24
25
  "@sap-ux/nodejs-utils": "0.1.6"
25
26
  },
@@ -29,7 +30,6 @@
29
30
  "@types/yeoman-generator": "5.2.11",
30
31
  "typescript": "5.3.3",
31
32
  "@sap-ux/axios-extension": "1.18.4",
32
- "@sap-ux/btp-utils": "1.0.0",
33
33
  "@sap-ux/store": "1.0.0"
34
34
  },
35
35
  "engines": {