@sap-ux/generator-adp 1.2.3 → 1.3.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.
@@ -26,12 +26,12 @@ const validators_js_1 = require("../questions/helper/validators.js");
26
26
  * @returns {string} The resolved absolute project path.
27
27
  */
28
28
  function resolveCfProjectPath(mtaMode, targetFolder, logger, cfConfig, mtaId) {
29
- (0, validators_js_1.assertValidationPassed)((0, validators_js_1.validateProjectPath)(targetFolder, logger, mtaMode, cfConfig));
29
+ (0, validators_js_1.assertValidationPassed)((0, adp_tooling_1.validateProjectPath)(targetFolder, logger, mtaMode, cfConfig));
30
30
  if (mtaMode === types_js_1.MtaMode.New) {
31
31
  if (!mtaId) {
32
32
  throw new Error((0, i18n_js_1.t)('error.mtaIdRequired'));
33
33
  }
34
- (0, validators_js_1.assertValidationPassed)((0, validators_js_1.validateMtaId)(mtaId, targetFolder));
34
+ (0, validators_js_1.assertValidationPassed)((0, adp_tooling_1.validateMtaId)(mtaId, targetFolder));
35
35
  return (0, node_path_1.join)(targetFolder, mtaId);
36
36
  }
37
37
  return node_fs_1.default.realpathSync(targetFolder, 'utf-8');
@@ -778,7 +778,7 @@ class default_1 extends yeoman_generator_1.default {
778
778
  let businessSolution = businessSolutionName?.trim() ?? '';
779
779
  if (resolvedApprouter === adp_tooling_1.AppRouterType.MANAGED && !(0, cf_js_1.hasExistingApprouter)(mtaMode, projectPath)) {
780
780
  if (businessSolution) {
781
- (0, validators_js_1.assertValidationPassed)((0, validators_js_1.validateBusinessSolutionName)(businessSolution));
781
+ (0, validators_js_1.assertValidationPassed)((0, adp_tooling_1.validateBusinessSolutionName)(businessSolution));
782
782
  }
783
783
  else {
784
784
  businessSolution = (0, default_values_js_1.generateBusinessSolutionName)();
@@ -5,7 +5,6 @@ const adp_tooling_1 = require("@sap-ux/adp-tooling");
5
5
  const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
6
6
  const project_input_validator_1 = require("@sap-ux/project-input-validator");
7
7
  const i18n_js_1 = require("../../utils/i18n.js");
8
- const validators_js_1 = require("./helper/validators.js");
9
8
  const choices_js_1 = require("./helper/choices.js");
10
9
  const conditions_js_1 = require("./helper/conditions.js");
11
10
  /**
@@ -263,7 +262,7 @@ class CFServicesPrompter {
263
262
  answers.serviceInstance?.name ||
264
263
  this.reachableBusinessService ||
265
264
  this.serviceInstances[0]?.name),
266
- validate: (value) => (0, validators_js_1.validateBusinessSolutionName)(value),
265
+ validate: (value) => (0, adp_tooling_1.validateBusinessSolutionName)(value),
267
266
  guiOptions: {
268
267
  mandatory: true,
269
268
  hint: (0, i18n_js_1.t)('prompts.businessSolutionNameTooltip'),
@@ -1,6 +1,4 @@
1
- import type { ToolsLogger } from '@sap-ux/logger';
2
1
  import type { CfConfig, SystemLookup } from '@sap-ux/adp-tooling';
3
- import { MtaMode } from '../../types.js';
4
2
  interface JsonInputParams {
5
3
  projectName: string;
6
4
  targetFolder: string;
@@ -51,33 +49,6 @@ export declare function validateJsonInput(systemLookup: SystemLookup, isCustomer
51
49
  * @returns {Promise<string | boolean>} Returns true if the environment is valid, otherwise returns an error message.
52
50
  */
53
51
  export declare function validateEnvironment(value: string, isCFLoggedIn: boolean, cfConfig?: CfConfig): Promise<string | boolean>;
54
- /**
55
- * Validates the project path for the CF Project Path page.
56
- *
57
- * In `existing` mode the path must be an existing MTA project; a missing service definition is no
58
- * longer an error since the new service-instance dropdown lets the developer bind one. In `new`
59
- * mode the path is the parent folder in which a new MTA project will be scaffolded, so it only has
60
- * to exist (the MTA name/uniqueness is validated by the dedicated name prompt).
61
- *
62
- * @param {string} projectPath - The path to the project (existing MTA root, or parent folder for new).
63
- * @param {ToolsLogger} logger - The logger.
64
- * @param {MtaMode} [mtaMode] - The selected MTA mode defaults to `existing`.
65
- * @param {CfConfig} [cfConfig] - The current CF config used to block binding an MTA from a different space.
66
- * @returns {string | boolean} Returns true if the project path is valid, otherwise returns an error message.
67
- */
68
- export declare function validateProjectPath(projectPath: string, logger: ToolsLogger, mtaMode?: MtaMode, cfConfig?: CfConfig): string | boolean;
69
- /**
70
- * Validates the MTA project name entered when creating a new MTA project.
71
- *
72
- * Ensures the name is non-empty, at most 20 characters, uses only allowed characters (letters,
73
- * numbers, dots, underscores, hyphens; starting with a letter or number) and that no folder with
74
- * that name already exists in the selected parent location.
75
- *
76
- * @param {string} value - The MTA project name to validate.
77
- * @param {string} [parentPath] - The parent folder the new MTA project will be created in.
78
- * @returns {string | boolean} Returns true if valid, otherwise an error message.
79
- */
80
- export declare function validateMtaId(value: string, parentPath?: string): string | boolean;
81
52
  /**
82
53
  * Throws the error message of a failed validator result; does nothing when the result is `true`.
83
54
  *
@@ -85,12 +56,5 @@ export declare function validateMtaId(value: string, parentPath?: string): strin
85
56
  * @throws {Error} When the result is an error message string.
86
57
  */
87
58
  export declare function assertValidationPassed(result: string | boolean): void;
88
- /**
89
- * Validate business solution name.
90
- *
91
- * @param {string} value - Value to validate.
92
- * @returns {string | boolean} Validation result.
93
- */
94
- export declare function validateBusinessSolutionName(value: string): string | boolean;
95
59
  export {};
96
60
  //# sourceMappingURL=validators.d.ts.map
@@ -1,21 +1,11 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.validateExtensibilityExtension = validateExtensibilityExtension;
7
4
  exports.validateJsonInput = validateJsonInput;
8
5
  exports.validateEnvironment = validateEnvironment;
9
- exports.validateProjectPath = validateProjectPath;
10
- exports.validateMtaId = validateMtaId;
11
6
  exports.assertValidationPassed = assertValidationPassed;
12
- exports.validateBusinessSolutionName = validateBusinessSolutionName;
13
- const node_fs_1 = __importDefault(require("node:fs"));
14
- const node_path_1 = require("node:path");
15
- const adp_tooling_1 = require("@sap-ux/adp-tooling");
16
7
  const project_input_validator_1 = require("@sap-ux/project-input-validator");
17
8
  const i18n_js_1 = require("../../../utils/i18n.js");
18
- const types_js_1 = require("../../types.js");
19
9
  const type_guards_js_1 = require("../../../utils/type-guards.js");
20
10
  /**
21
11
  * Validates whether the extensibility extension is available. If the extension is not found,
@@ -84,74 +74,6 @@ async function validateEnvironment(value, isCFLoggedIn, cfConfig) {
84
74
  }
85
75
  return true;
86
76
  }
87
- /**
88
- * Validates the project path for the CF Project Path page.
89
- *
90
- * In `existing` mode the path must be an existing MTA project; a missing service definition is no
91
- * longer an error since the new service-instance dropdown lets the developer bind one. In `new`
92
- * mode the path is the parent folder in which a new MTA project will be scaffolded, so it only has
93
- * to exist (the MTA name/uniqueness is validated by the dedicated name prompt).
94
- *
95
- * @param {string} projectPath - The path to the project (existing MTA root, or parent folder for new).
96
- * @param {ToolsLogger} logger - The logger.
97
- * @param {MtaMode} [mtaMode] - The selected MTA mode defaults to `existing`.
98
- * @param {CfConfig} [cfConfig] - The current CF config used to block binding an MTA from a different space.
99
- * @returns {string | boolean} Returns true if the project path is valid, otherwise returns an error message.
100
- */
101
- function validateProjectPath(projectPath, logger, mtaMode = types_js_1.MtaMode.Existing, cfConfig) {
102
- const validationResult = (0, project_input_validator_1.validateEmptyString)(projectPath);
103
- if (typeof validationResult === 'string') {
104
- return validationResult;
105
- }
106
- if (!node_fs_1.default.existsSync(projectPath)) {
107
- return (0, i18n_js_1.t)('error.projectDoesNotExist');
108
- }
109
- if (mtaMode === types_js_1.MtaMode.New) {
110
- // New mode scaffolds a new MTA inside the selected folder an already-MTA folder is a conflicting
111
- // choice (it would nest or silently reuse the MTA), so block it and point the user at Existing mode.
112
- if ((0, adp_tooling_1.isMtaProject)(projectPath)) {
113
- return (0, i18n_js_1.t)('error.newModeFolderAlreadyMta');
114
- }
115
- return true;
116
- }
117
- if (!(0, adp_tooling_1.isMtaProject)(projectPath)) {
118
- return (0, i18n_js_1.t)('error.projectDoesNotExistMta');
119
- }
120
- // Block reusing an MTA that was created for a different CF space than the current login. The space the
121
- // MTA targets is persisted in its ui5.yaml an unknown space (non-CF project) is not treated as a mismatch.
122
- const projectSpaceGuid = (0, adp_tooling_1.getCfProjectSpaceGuid)(projectPath, logger);
123
- if (projectSpaceGuid && cfConfig && projectSpaceGuid !== cfConfig.space.GUID) {
124
- return (0, i18n_js_1.t)('error.projectSpaceMismatch');
125
- }
126
- return true;
127
- }
128
- /**
129
- * Validates the MTA project name entered when creating a new MTA project.
130
- *
131
- * Ensures the name is non-empty, at most 20 characters, uses only allowed characters (letters,
132
- * numbers, dots, underscores, hyphens; starting with a letter or number) and that no folder with
133
- * that name already exists in the selected parent location.
134
- *
135
- * @param {string} value - The MTA project name to validate.
136
- * @param {string} [parentPath] - The parent folder the new MTA project will be created in.
137
- * @returns {string | boolean} Returns true if valid, otherwise an error message.
138
- */
139
- function validateMtaId(value, parentPath) {
140
- const validationResult = (0, project_input_validator_1.validateEmptyString)(value);
141
- if (typeof validationResult === 'string') {
142
- return validationResult;
143
- }
144
- if (value.length > 20) {
145
- return (0, i18n_js_1.t)('error.mtaIdTooLong');
146
- }
147
- if (!/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(value)) {
148
- return (0, i18n_js_1.t)('error.mtaIdInvalid');
149
- }
150
- if (parentPath && node_fs_1.default.existsSync((0, node_path_1.join)(parentPath, value))) {
151
- return (0, i18n_js_1.t)('error.mtaIdAlreadyExists');
152
- }
153
- return true;
154
- }
155
77
  /**
156
78
  * Throws the error message of a failed validator result; does nothing when the result is `true`.
157
79
  *
@@ -163,20 +85,4 @@ function assertValidationPassed(result) {
163
85
  throw new Error(result);
164
86
  }
165
87
  }
166
- /**
167
- * Validate business solution name.
168
- *
169
- * @param {string} value - Value to validate.
170
- * @returns {string | boolean} Validation result.
171
- */
172
- function validateBusinessSolutionName(value) {
173
- const validationResult = (0, project_input_validator_1.validateEmptyString)(value);
174
- if (typeof validationResult === 'string') {
175
- return validationResult;
176
- }
177
- if (/^[a-z0-9][a-z0-9._-]*$/.test(value)) {
178
- return true;
179
- }
180
- return (0, i18n_js_1.t)('error.businessSolutionNameInvalid');
181
- }
182
88
  //# sourceMappingURL=validators.js.map
@@ -95,7 +95,7 @@ function getProjectPathPrompt(logger, vscode, cfConfig) {
95
95
  breadcrumb: (0, i18n_js_1.t)('prompts.projectLocationBreadcrumb')
96
96
  },
97
97
  message: (0, i18n_js_1.t)('prompts.projectLocationLabel'),
98
- validate: (value, answers) => (0, validators_js_1.validateProjectPath)(value, logger, answers?.mtaMode, cfConfig),
98
+ validate: (value, answers) => (0, adp_tooling_1.validateProjectPath)(value, logger, answers?.mtaMode, cfConfig),
99
99
  default: () => (0, fiori_generator_shared_1.getDefaultTargetFolder)(vscode),
100
100
  store: false
101
101
  };
@@ -113,7 +113,7 @@ function getMtaIdPrompt() {
113
113
  name: 'mtaId',
114
114
  message: (0, i18n_js_1.t)('prompts.mtaIdLabel'),
115
115
  when: (answers) => answers.mtaMode === types_js_1.MtaMode.New && !!answers.projectLocation && !(0, adp_tooling_1.isMtaProject)(answers.projectLocation),
116
- validate: (value, answers) => (0, validators_js_1.validateMtaId)(value, answers?.projectLocation),
116
+ validate: (value, answers) => (0, adp_tooling_1.validateMtaId)(value, answers?.projectLocation),
117
117
  guiOptions: {
118
118
  mandatory: true,
119
119
  hint: (0, i18n_js_1.t)('prompts.mtaIdTooltip'),
@@ -71,8 +71,8 @@
71
71
  "mtaModeLabel": "MTA Project",
72
72
  "mtaModeTooltip": "Choose whether to create a new MTA project or use an existing one for your Adaptation Project.",
73
73
  "mtaModeBreadcrumb": "MTA Project",
74
- "mtaModeNewLabel": "Create SAPUI5 Adaptation Project in a New MTA Project",
75
- "mtaModeExistingLabel": "Create SAPUI5 Adaptation Project in an Existing MTA Project",
74
+ "mtaModeNewLabel": "Use a New MTA Project for Creating an Adaptation Project",
75
+ "mtaModeExistingLabel": "Use an Existing MTA Project for Creating an Adaptation Project",
76
76
  "mtaIdLabel": "MTA Project Name",
77
77
  "mtaIdTooltip": "Enter the name of the new MTA project to create. It must be unique within the selected folder, be 20 characters or fewer, and use letters, numbers, dots (.), underscores (_), and hyphens (-) only.",
78
78
  "mtaIdBreadcrumb": "MTA Project Name",
@@ -144,7 +144,7 @@
144
144
  "projectDoesNotExist": "The project does not exist. Please select an MTA project.",
145
145
  "projectDoesNotExistMta": "Provide the path to the MTA project where you want to have your Adaptation Project created.",
146
146
  "projectSpaceMismatch": "The selected MTA project was created for a different Cloud Foundry space. Log in to that space, or choose another project.",
147
- "newModeFolderAlreadyMta": "The selected folder is already an MTA project. Choose an empty folder to create a new MTA project, or select 'Create SAPUI5 Adaptation Project in an Existing MTA Project'.",
147
+ "newModeFolderAlreadyMta": "The selected folder is already an MTA project. Choose an empty folder to create a new MTA project, or select 'Use an Existing MTA Project for Creating an Adaptation Project'.",
148
148
  "noAdaptableBusinessServiceFoundInMta": "No adaptable business service found in the MTA.",
149
149
  "noAppsFoundForBusinessService": "No applications were found for the selected business service. Please check the service configuration.",
150
150
  "fetchBaseInboundsFailed": "Fetching base application inbounds failed: {{error}}.",
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "displayName": "SAPUI5 Adaptation Project",
4
4
  "homepage": "https://help.sap.com/viewer/584e0bcbfd4a4aff91c815cefa0bce2d/Cloud/en-US/ada9567b767941aba8d49fdb4fdedea7.html",
5
5
  "description": "Adaptation project allows you to create an app variant for an existing SAP Fiori elements-based or SAPUI5 freestyle application, without changing the original application.",
6
- "version": "1.2.3",
6
+ "version": "1.3.1",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -30,19 +30,19 @@
30
30
  "i18next": "26.5.11",
31
31
  "uuid": "14.0.3",
32
32
  "yeoman-generator": "5.10.0",
33
- "@sap-ux/adp-tooling": "1.2.5",
34
- "@sap-ux/axios-extension": "2.1.9",
33
+ "@sap-ux/adp-tooling": "1.3.1",
34
+ "@sap-ux/axios-extension": "2.1.10",
35
35
  "@sap-ux/btp-utils": "2.0.9",
36
36
  "@sap-ux/feature-toggle": "1.0.5",
37
- "@sap-ux/fiori-generator-shared": "1.4.3",
38
- "@sap-ux/inquirer-common": "1.0.58",
37
+ "@sap-ux/fiori-generator-shared": "1.4.4",
38
+ "@sap-ux/inquirer-common": "1.0.59",
39
39
  "@sap-ux/logger": "1.0.3",
40
- "@sap-ux/odata-service-writer": "1.0.31",
41
- "@sap-ux/project-access": "2.3.6",
42
- "@sap-ux/project-input-validator": "1.0.29",
43
- "@sap-ux/store": "2.0.9",
44
- "@sap-ux/system-access": "1.0.23",
45
- "@sap-ux/telemetry": "2.0.17"
40
+ "@sap-ux/odata-service-writer": "1.0.32",
41
+ "@sap-ux/project-access": "2.3.7",
42
+ "@sap-ux/project-input-validator": "1.0.30",
43
+ "@sap-ux/system-access": "1.0.24",
44
+ "@sap-ux/telemetry": "2.0.18",
45
+ "@sap-ux/store": "2.0.9"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@jest/globals": "30.5.2",
@@ -57,7 +57,7 @@
57
57
  "fs-extra": "11.4.1",
58
58
  "rimraf": "6.1.3",
59
59
  "yeoman-test": "6.3.0",
60
- "@sap-ux/deploy-config-sub-generator": "1.0.97"
60
+ "@sap-ux/deploy-config-sub-generator": "1.0.99"
61
61
  },
62
62
  "engines": {
63
63
  "node": ">=22.x"