Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sap-ux/project-input-validator

Package Overview
Dependencies
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sap-ux/project-input-validator - npm Package Compare versions

Comparing version 0.3.3 to 0.3.4

dist/flp/validators.d.ts

7

dist/adp/validators.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isDataSourceURI = exports.hasCustomerPrefix = exports.hasContentDuplication = void 0;
exports.hasContentDuplication = hasContentDuplication;
exports.hasCustomerPrefix = hasCustomerPrefix;
exports.isDataSourceURI = isDataSourceURI;
/**

@@ -18,3 +20,2 @@ * Validates a value for duplication in existing change files.

}
exports.hasContentDuplication = hasContentDuplication;
/**

@@ -29,3 +30,2 @@ * Validates a value for starting with a customer prefix.

}
exports.hasCustomerPrefix = hasCustomerPrefix;
/**

@@ -40,3 +40,2 @@ * Validates if a value is a valid data source URI.

}
exports.isDataSourceURI = isDataSourceURI;
//# sourceMappingURL=validators.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.validatePackage = exports.validateTransportRequestNumber = exports.validateAppDescription = exports.validateAppName = void 0;
exports.validateAppName = validateAppName;
exports.validateAppDescription = validateAppDescription;
exports.validateTransportRequestNumber = validateTransportRequestNumber;
exports.validatePackage = validatePackage;
const i18n_1 = require("../i18n");

@@ -49,3 +52,2 @@ const os_1 = require("os");

}
exports.validateAppName = validateAppName;
/**

@@ -83,3 +85,2 @@ * Helper function to format an array of error messages to a single string.

}
exports.validateAppDescription = validateAppDescription;
/**

@@ -101,3 +102,2 @@ * Transport request number is not required for local package.

}
exports.validateTransportRequestNumber = validateTransportRequestNumber;
/**

@@ -117,3 +117,2 @@ * Validate package name cannot be empty.

}
exports.validatePackage = validatePackage;
//# sourceMappingURL=validators.js.map

@@ -0,1 +1,2 @@

export type AllowedCharacters = '_';
/**

@@ -30,2 +31,18 @@ * SAP client number is either empty or 3 digit string.

/**
* Validates that the given string does not exceed the specified maximum length.
*
* @param {string} value - The string value to validate.
* @param {number} [maxLength] - The maximum allowed length of the string. If 0 or not provided, no length validation is performed.
* @returns {boolean | string} Returns `true` if the validation passes, or an error message string if it fails.
*/
export declare function validateMaxLength(value: string, maxLength?: number): boolean | string;
/**
* Validates whether the input contains only alphanumeric characters and allowed special characters.
*
* @param {string} value - The input string to validate.
* @param {string[]} allowedCharacters - An array of allowed special characters.
* @returns {boolean | string} Returns `true` if validation passes, or an error message string if validation fails.
*/
export declare function validateAllowedCharacters(value: string, allowedCharacters?: AllowedCharacters[]): boolean | string;
/**
* Validate input is valid JSON.

@@ -32,0 +49,0 @@ *

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateSpecialChars = exports.validateJSON = exports.validateEmptySpaces = exports.validateEmptyString = exports.validateUrl = exports.validateClient = void 0;
exports.validateClient = validateClient;
exports.validateUrl = validateUrl;
exports.validateEmptyString = validateEmptyString;
exports.validateEmptySpaces = validateEmptySpaces;
exports.validateMaxLength = validateMaxLength;
exports.validateAllowedCharacters = validateAllowedCharacters;
exports.validateJSON = validateJSON;
exports.validateSpecialChars = validateSpecialChars;
const i18n_1 = require("../i18n");

@@ -21,3 +28,2 @@ /**

}
exports.validateClient = validateClient;
/**

@@ -38,3 +44,2 @@ * Validate url input is valid url format.

}
exports.validateUrl = validateUrl;
/**

@@ -53,3 +58,2 @@ * Validate input is not empty string.

}
exports.validateEmptyString = validateEmptyString;
/**

@@ -67,4 +71,36 @@ * Validate input does not contain any whitespace characters.

}
exports.validateEmptySpaces = validateEmptySpaces;
/**
* Validates that the given string does not exceed the specified maximum length.
*
* @param {string} value - The string value to validate.
* @param {number} [maxLength] - The maximum allowed length of the string. If 0 or not provided, no length validation is performed.
* @returns {boolean | string} Returns `true` if the validation passes, or an error message string if it fails.
*/
function validateMaxLength(value, maxLength = 0) {
if (maxLength > 0 && value.length > maxLength) {
return (0, i18n_1.t)('general.maxLength', { maxLength });
}
return true;
}
/**
* Validates whether the input contains only alphanumeric characters and allowed special characters.
*
* @param {string} value - The input string to validate.
* @param {string[]} allowedCharacters - An array of allowed special characters.
* @returns {boolean | string} Returns `true` if validation passes, or an error message string if validation fails.
*/
function validateAllowedCharacters(value, allowedCharacters) {
// Asterisks is supported for the semantic object and action field but not the inbound title
if (allowedCharacters && allowedCharacters.length > 0) {
const escapedChars = allowedCharacters.map((char) => `\\${char}`).join('');
const regex = new RegExp(`^[a-zA-Z0-9${escapedChars}]+$`);
if (!regex.test(value)) {
return (0, i18n_1.t)('general.supportedFormats', {
allowedCharacters: allowedCharacters.join('')
});
}
}
return true;
}
/**
* Validate input is valid JSON.

@@ -84,3 +120,2 @@ *

}
exports.validateJSON = validateJSON;
/**

@@ -100,3 +135,2 @@ * Validates a value for special characters.

}
exports.validateSpecialChars = validateSpecialChars;
//# sourceMappingURL=validators.js.map
import type { TOptions } from 'i18next';
export declare const PROJECT_INPUT_VALIDATOR_NS = "project-input-validator";
/**
* Adds the `project-input-validator` resource bundle to i18next.
* May be required to load i18n translations after initialising in the consumer module.
*/
export declare function addi18nResourceBundle(): void;
/**
* Initialize i18next with the translations for this module.

@@ -5,0 +10,0 @@ */

@@ -6,3 +6,6 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.t = exports.initI18nProjectValidators = exports.PROJECT_INPUT_VALIDATOR_NS = void 0;
exports.PROJECT_INPUT_VALIDATOR_NS = void 0;
exports.addi18nResourceBundle = addi18nResourceBundle;
exports.initI18nProjectValidators = initI18nProjectValidators;
exports.t = t;
const i18next_1 = __importDefault(require("i18next"));

@@ -12,8 +15,15 @@ const project_input_validator_i18n_json_1 = __importDefault(require("./translations/project-input-validator.i18n.json"));

/**
* Adds the `project-input-validator` resource bundle to i18next.
* May be required to load i18n translations after initialising in the consumer module.
*/
function addi18nResourceBundle() {
i18next_1.default.addResourceBundle('en', exports.PROJECT_INPUT_VALIDATOR_NS, project_input_validator_i18n_json_1.default);
}
/**
* Initialize i18next with the translations for this module.
*/
async function initI18nProjectValidators() {
await i18next_1.default.init({ lng: 'en', fallbackLng: 'en' }, () => i18next_1.default.addResourceBundle('en', exports.PROJECT_INPUT_VALIDATOR_NS, project_input_validator_i18n_json_1.default));
await i18next_1.default.init({ lng: 'en', fallbackLng: 'en' });
addi18nResourceBundle();
}
exports.initI18nProjectValidators = initI18nProjectValidators;
/**

@@ -32,3 +42,2 @@ * Helper function facading the call to i18next. Unless a namespace option is provided the local namespace will be used.

}
exports.t = t;
initI18nProjectValidators().catch(() => {

@@ -35,0 +44,0 @@ // needed by lint

@@ -5,2 +5,4 @@ export * from './deploy/validators';

export * from './adp/validators';
export * from './flp/validators';
export { addi18nResourceBundle } from './i18n';
//# sourceMappingURL=index.d.ts.map

@@ -17,2 +17,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.addi18nResourceBundle = void 0;
__exportStar(require("./deploy/validators"), exports);

@@ -22,2 +23,5 @@ __exportStar(require("./ui5/validators"), exports);

__exportStar(require("./adp/validators"), exports);
__exportStar(require("./flp/validators"), exports);
var i18n_1 = require("./i18n");
Object.defineProperty(exports, "addi18nResourceBundle", { enumerable: true, get: function () { return i18n_1.addi18nResourceBundle; } });
//# sourceMappingURL=index.js.map

@@ -51,4 +51,6 @@ {

"invalidJSON": "Invalid JSON",
"invalidValueForSpecialChars": "Input must contain only Latin alphanumeric characters or the following symbols: '-','_','$' and '.'"
"invalidValueForSpecialChars": "Input must contain only Latin alphanumeric characters or the following symbols: '-','_','$' and '.'",
"maxLength": "Maximum length: {{maxLength}} characters",
"supportedFormats": "Only alphanumeric and '{{allowedCharacters}}' characters are allowed"
}
}

@@ -6,3 +6,6 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.validateModuleName = exports.validateProjectFolder = exports.validateLibModuleName = exports.validateNamespace = void 0;
exports.validateNamespace = validateNamespace;
exports.validateLibModuleName = validateLibModuleName;
exports.validateProjectFolder = validateProjectFolder;
exports.validateModuleName = validateModuleName;
const path_1 = require("path");

@@ -66,3 +69,2 @@ const i18n_1 = require("../i18n");

}
exports.validateNamespace = validateNamespace;
/**

@@ -84,3 +86,2 @@ * Validator: UI5 library module name.

}
exports.validateLibModuleName = validateLibModuleName;
/**

@@ -110,3 +111,2 @@ * Validator: UI5 project directory can be used to create a UI5 application.

}
exports.validateProjectFolder = validateProjectFolder;
/**

@@ -155,3 +155,2 @@ * Validator: UI5 package json module name validator. Validates a module name accoding to npm package rules and some additional UI5 specific rules.

}
exports.validateModuleName = validateModuleName;
/**

@@ -158,0 +157,0 @@ * Test for existence of specified directory path.

{
"name": "@sap-ux/project-input-validator",
"version": "0.3.3",
"version": "0.3.4",
"description": "Library to validate Fiori project input formats",

@@ -5,0 +5,0 @@ "repository": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc