@sap-ux/project-input-validator 0.5.4 → 0.5.6

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.
@@ -65,4 +65,12 @@ export declare function validateDuplicateProjectName(value: string, destinationP
65
65
  * @returns {string | boolean} If project namespace is valid returns true otherwise error message.
66
66
  */
67
67
  export declare function validateNamespaceAdp(namespace: string, projectName: string, isCustomerBase: boolean): string | boolean;
68
+ /**
69
+ * Validates that application ACH is not empty and it is in correct format.
70
+ *
71
+ * @param {string} value - The application component hierarchy.
72
+ * @param {boolean} isCustomerBase - Whether the layer is customer base.
73
+ * @returns {string | boolean} If application ACH is valid returns true otherwise error message.
74
+ */
75
+ export declare function validateAch(value: string, isCustomerBase: boolean): string | boolean;
68
76
  //# sourceMappingURL=validators.d.ts.map
@@ -8,6 +8,7 @@ exports.validateProjectNameExternal = validateProjectNameExternal;
8
8
  exports.validateProjectNameInternal = validateProjectNameInternal;
9
9
  exports.validateDuplicateProjectName = validateDuplicateProjectName;
10
10
  exports.validateNamespaceAdp = validateNamespaceAdp;
11
+ exports.validateAch = validateAch;
11
12
  const path_1 = require("path");
12
13
  const fs_1 = require("fs");
13
14
  const i18n_1 = require("../i18n");
@@ -148,4 +149,22 @@ function validateNamespaceAdp(namespace, projectName, isCustomerBase) {
148
149
  }
149
150
  return true;
150
151
  }
152
+ /**
153
+ * Validates that application ACH is not empty and it is in correct format.
154
+ *
155
+ * @param {string} value - The application component hierarchy.
156
+ * @param {boolean} isCustomerBase - Whether the layer is customer base.
157
+ * @returns {string | boolean} If application ACH is valid returns true otherwise error message.
158
+ */
159
+ function validateAch(value, isCustomerBase) {
160
+ const validationResult = (0, validators_1.validateEmptyString)(value);
161
+ if (typeof validationResult === 'string') {
162
+ return validationResult;
163
+ }
164
+ const isValid = /^([A-Z0-9]{2,3})(-[A-Z0-9]{1,6})*$/.exec(value.toUpperCase());
165
+ if (!isCustomerBase && !isValid) {
166
+ return (0, i18n_1.t)('adp.achMandatoryError');
167
+ }
168
+ return true;
169
+ }
151
170
  //# sourceMappingURL=validators.js.map
@@ -65,6 +65,7 @@
65
65
  "differentNamespaceThanProjectName": "The namespace must be the same as the project name.",
66
66
  "namespaceSameAsProjectNameError": "The namespace must be the same as the project name.",
67
67
  "namespaceLengthError": "The namespace cannot contain more than 61 characters or end with the word 'component'.",
68
- "namespaceValidationError": "The namespace must contain only latin alphanumeric characters. Different parts can be separated by a period and every part must start with a letter."
68
+ "namespaceValidationError": "The namespace must contain only latin alphanumeric characters. Different parts can be separated by a period and every part must start with a letter.",
69
+ "achMandatoryError": "Application Component Hierarchy can contain only capital letters, digits, and dashes."
69
70
  }
70
71
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap-ux/project-input-validator",
3
- "version": "0.5.4",
3
+ "version": "0.5.6",
4
4
  "description": "Library to validate Fiori project input formats",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,7 +16,7 @@
16
16
  "dependencies": {
17
17
  "i18next": "23.5.1",
18
18
  "validate-npm-package-name": "5.0.0",
19
- "@sap-ux/project-access": "1.29.21"
19
+ "@sap-ux/project-access": "1.29.22"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/validate-npm-package-name": "4.0.1",