@adpt/cloud
Version:
AdaptJS cloud component library
37 lines • 1.54 kB
TypeScript
import { ExecaError } from "execa";
export declare function isExecaError(e: Error): e is ExecaError;
/**
* Minimum number of hex characters for the SHA portion of a resource name.
* Keeping this value higher ensures lower probability of name collisions.
* @internal
*/
export declare const minShaLen = 8;
/**
* Maximum number of hex characters for the SHA portion of a resource name.
* This value just keeps generated names from being annoyingly long to humans.
* @internal
*/
export declare const maxShaLen = 32;
/**
* Creates a function for generating unique names for Adapt Elements.
* @remarks
* The unique names are unique by probability, based on a SHA256 hash.
* They are are made up of:
*
* - The Element's key, with any invalid characters removed.
*
* - A separator character (or string)
*
* - A portion of the SHA256 hash of the Element's ID and the deployID.
*
* @param invalidChars - A regular expression that matches all invalid
* characters that should NOT be included in the resulting name. Must have
* the global flag set. For example, if only alphabetic characters and dashes
* are allowed, set `invalidChars` to: `/[^a-zA-Z-]/g`
* @param maxLen - The maximum allowed length of name that should be generated.
* @param sep - The separator string to be used between they key and the hash.
*
* @public
*/
export declare function makeResourceName(invalidChars: RegExp, maxLen: number, sep?: string): (elemKey: string, elemID: string, deployID: string) => string;
//# sourceMappingURL=common.d.ts.map