@smartthings/cli-lib
Advanced tools
@@ -28,2 +28,17 @@ import { ValidateFunction } from './user-query'; | ||
| export declare const integerValidateFn: (options?: IntegerValidationOptions) => ValidateFunction; | ||
| declare type URLValidateFnOptions = { | ||
| httpsRequired?: boolean; | ||
| /** | ||
| * Setting this to true (along with httpsRequired) will allow http protocol for localhost | ||
| * and 127.0.0.1. | ||
| */ | ||
| allowLocalhostHTTP?: boolean; | ||
| /** | ||
| * Required by default. | ||
| */ | ||
| required?: boolean; | ||
| minPort?: number; | ||
| maxPort?: number; | ||
| }; | ||
| export declare const urlValidateFn: (options?: URLValidateFnOptions) => ValidateFunction; | ||
| export declare const emailValidate: (input: string) => true | string; | ||
@@ -33,1 +48,2 @@ export declare const urlValidate: ValidateFunction; | ||
| export declare const localhostOrHTTPSValidate: ValidateFunction; | ||
| export {}; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.localhostOrHTTPSValidate = exports.httpsURLValidate = exports.urlValidate = exports.emailValidate = exports.integerValidateFn = exports.stringValidateFn = void 0; | ||
| exports.localhostOrHTTPSValidate = exports.httpsURLValidate = exports.urlValidate = exports.emailValidate = exports.urlValidateFn = exports.integerValidateFn = exports.stringValidateFn = void 0; | ||
| /** | ||
@@ -52,4 +52,13 @@ * Builds a function that conforms to `ValidateFunction` that requires a string to match the given | ||
| return (input) => { | ||
| var _a, _b; | ||
| try { | ||
| const url = new URL(input); | ||
| const minPort = (_a = options === null || options === void 0 ? void 0 : options.minPort) !== null && _a !== void 0 ? _a : 1; | ||
| const maxPort = (_b = options === null || options === void 0 ? void 0 : options.maxPort) !== null && _b !== void 0 ? _b : 65535; | ||
| if (url.port) { | ||
| const portNum = parseInt(url.port); | ||
| if (portNum < minPort || portNum > maxPort) { | ||
| return `Port must be between ${minPort} and ${maxPort} inclusive.`; | ||
| } | ||
| } | ||
| if (options === null || options === void 0 ? void 0 : options.httpsRequired) { | ||
@@ -75,2 +84,3 @@ if (options.allowLocalhostHTTP) { | ||
| }; | ||
| exports.urlValidateFn = urlValidateFn; | ||
| // Email regex found on Stack Overflow: | ||
@@ -82,4 +92,4 @@ // https://stackoverflow.com/questions/201323/how-can-i-validate-an-email-address-using-a-regular-expression | ||
| exports.emailValidate = emailValidate; | ||
| exports.urlValidate = urlValidateFn(); | ||
| exports.httpsURLValidate = urlValidateFn({ httpsRequired: true }); | ||
| exports.localhostOrHTTPSValidate = urlValidateFn({ httpsRequired: true, allowLocalhostHTTP: true }); | ||
| exports.urlValidate = (0, exports.urlValidateFn)(); | ||
| exports.httpsURLValidate = (0, exports.urlValidateFn)({ httpsRequired: true }); | ||
| exports.localhostOrHTTPSValidate = (0, exports.urlValidateFn)({ httpsRequired: true, allowLocalhostHTTP: true }); |
+1
-1
| { | ||
| "name": "@smartthings/cli-lib", | ||
| "version": "2.3.1", | ||
| "version": "2.3.2", | ||
| "description": "SmartThings CLI utility library", | ||
@@ -5,0 +5,0 @@ "author": "Samsung Electronics Co., LTD.", |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
193987
0.58%4102
0.64%