cumulocity-cypress
Version:
Cypress commands for Cumulocity IoT
57 lines (56 loc) • 3.38 kB
TypeScript
import * as semver from "semver";
export type RequireConfigKeys = "shell" | "system";
export type RequireConfigVersions = (string | null)[];
/**
* A configuration option for required versions to run an annotated test. Supported versions are `system` and `shell`.
* Each version is defined by and array of semver ranges or `null` to allow versions without specifying a range.
*/
export type C8yRequireConfigOption = RequireConfigVersions | {
shell?: RequireConfigVersions;
system?: RequireConfigVersions;
};
/**
* Checks if the given version satisfies the requirements provided as an array of semver ranges.
* If no required ranges are provided or range is empty, `true` is returned.
* @param version - The version to check as a string or SemVer object.
* @param requires - The required versions as semver ranges or `null` to allow version without specifying a range.
* @returns `true` if the version satisfies the requirements, `false` otherwise.
*/
export declare function isVersionSatisfyingRequirements(version?: string | semver.SemVer, requires?: RequireConfigVersions): boolean;
/**
* Returns the required semver ranges that are satisfied by the given version.
* @param version - The version to check as a string or SemVer object.
* @param requires - The required versions as semver ranges or `null` to allow version without specifying a range.
* @returns The ranges that are satisfied by the version.
*/
export declare function getRangesSatisfyingVersion(version: semver.SemVer | string, requires?: RequireConfigVersions): string[];
/**
* Returns the minimum satisfying version for the given version and required ranges. If there is
* more than one range that is satisfied by the version, the minimum version is returned.
* @param version - The version to check as a string or SemVer object.
* @param ranges - The required versions as semver ranges or `null` to allow version without specifying a range.
* @returns The minimum satisfying version.
*/
export declare function getMinSatisfyingVersion(version: string | semver.SemVer, ranges: RequireConfigVersions): semver.SemVer | undefined;
/**
* Returns all minimum satisfying versions for the given version and required ranges.
* @param version - The version to check as a string or SemVer object.
* @param ranges - The required versions as semver ranges or `null` to allow version without specifying a range.
* @returns All minimum satisfying versions for the given ranges sorted in ascending order.
*/
export declare function getMinSatisfyingVersions(version: string | semver.SemVer, ranges: RequireConfigVersions): semver.SemVer[];
/**
* Returns the minimized version string for the given version. Trailing `.0` patch versions or
* `.0.0` minor versions and patch versions are omitted. If the version is a prerelease or build version,
* the full version is returned.
* @param version - The version to minimize as a string or SemVer object.
* @returns The minimized version string.
*/
export declare function getMinimizedVersionString(version: string | semver.SemVer): string | undefined;
/**
* Converts the given version to a semver compatible version string. This is for
* example converting `1.2` to `1.2.0`.
* @param version - The version to convert.
* @returns The semver version string.
*/
export declare function toSemverVersion(version: string): string | undefined;