diff --git a/lib/entry-points.js b/lib/entry-points.js index 218f450b1..78af79614 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -145241,14 +145241,6 @@ function asHTTPError(arg) { } return void 0; } -function isVersionInfo(x) { - const candidate = x; - return typeof candidate === "object" && candidate !== null && typeof candidate.version === "string" && (candidate.features === void 0 || typeof candidate.features === "object" && candidate.features !== null) && (candidate.overlayVersion === void 0 || typeof candidate.overlayVersion === "number"); -} -function isPersistedVersionInfo(x) { - const candidate = x; - return typeof candidate === "object" && candidate !== null && typeof candidate.cmd === "string" && isVersionInfo(candidate.version); -} async function codeQlVersionAtLeast(codeql, requiredVersion) { return semver.gte((await codeql.getVersion()).version, requiredVersion); } @@ -146292,6 +146284,14 @@ function getCachedCodeQlVersion(cmd, env = getEnv()) { cachedCodeQlVersion = persisted.version; return cachedCodeQlVersion; } +function isVersionInfo(x) { + const candidate = x; + return typeof candidate === "object" && candidate !== null && typeof candidate.version === "string" && (candidate.features === void 0 || typeof candidate.features === "object" && candidate.features !== null) && (candidate.overlayVersion === void 0 || typeof candidate.overlayVersion === "number"); +} +function isPersistedVersionInfo(x) { + const candidate = x; + return typeof candidate === "object" && candidate !== null && typeof candidate.cmd === "string" && isVersionInfo(candidate.version); +} // src/config/pack-registries.ts function parseRegistries(registriesInput) { @@ -157827,7 +157827,7 @@ var import_async = __toESM(require_async(), 1); var import_path7 = require("path"); // node_modules/archiver/lib/error.js -var import_util35 = __toESM(require("util"), 1); +var import_util34 = __toESM(require("util"), 1); var ERROR_CODES = { ABORTED: "archive was aborted", DIRECTORYDIRPATHREQUIRED: "diretory dirpath argument must be a non-empty string value", @@ -157852,7 +157852,7 @@ function ArchiverError(code, data) { this.code = code; this.data = data; } -import_util35.default.inherits(ArchiverError, Error); +import_util34.default.inherits(ArchiverError, Error); // node_modules/archiver/lib/core.js var import_readable_stream2 = __toESM(require_ours(), 1); diff --git a/src/cli/output-cache.ts b/src/cli/output-cache.ts index 957dfd3b4..ccf2666d4 100644 --- a/src/cli/output-cache.ts +++ b/src/cli/output-cache.ts @@ -3,10 +3,15 @@ import path from "path"; import { getTemporaryDirectory } from "../actions-util"; import { Env, getEnv } from "../environment"; -import { isPersistedVersionInfo } from "../util"; import type { VersionInfo } from "./types"; +/** The persisted version together with the CLI path it was obtained from. */ +interface PersistedVersionInfo { + cmd: string; + version: VersionInfo; +} + /** * The name of the temporary file that backs the on-disk cache of * CLI responses between workflow steps. @@ -99,3 +104,35 @@ export function getCachedCodeQlVersion( cachedCodeQlVersion = persisted.version; return cachedCodeQlVersion; } + +/** + * Determines whether a value is a `VersionInfo` object. + * @param x The value to test + */ +function isVersionInfo(x: unknown): x is VersionInfo { + const candidate = x as Partial | null; + return ( + typeof candidate === "object" && + candidate !== null && + typeof candidate.version === "string" && + (candidate.features === undefined || + (typeof candidate.features === "object" && + candidate.features !== null)) && + (candidate.overlayVersion === undefined || + typeof candidate.overlayVersion === "number") + ); +} + +/** + * Determines whether a value is a `PersistedVersionInfo` object. + * @param x The value to test + */ +function isPersistedVersionInfo(x: unknown): x is PersistedVersionInfo { + const candidate = x as Partial | null; + return ( + typeof candidate === "object" && + candidate !== null && + typeof candidate.cmd === "string" && + isVersionInfo(candidate.version) + ); +} diff --git a/src/util.ts b/src/util.ts index e691a7c17..2d910dec3 100644 --- a/src/util.ts +++ b/src/util.ts @@ -10,7 +10,6 @@ import * as yaml from "js-yaml"; import * as semver from "semver"; import * as apiCompatibility from "./api-compatibility.json"; -import type { VersionInfo } from "./cli/types"; import type { CodeQL } from "./codeql"; import type { Pack } from "./config/db-config"; import type { Config } from "./config-utils"; @@ -599,36 +598,6 @@ export function asHTTPError(arg: any): HTTPError | undefined { return undefined; } -/** The persisted version together with the CLI path it was obtained from. */ -interface PersistedVersionInfo { - cmd: string; - version: VersionInfo; -} - -function isVersionInfo(x: unknown): x is VersionInfo { - const candidate = x as Partial | null; - return ( - typeof candidate === "object" && - candidate !== null && - typeof candidate.version === "string" && - (candidate.features === undefined || - (typeof candidate.features === "object" && - candidate.features !== null)) && - (candidate.overlayVersion === undefined || - typeof candidate.overlayVersion === "number") - ); -} - -export function isPersistedVersionInfo(x: unknown): x is PersistedVersionInfo { - const candidate = x as Partial | null; - return ( - typeof candidate === "object" && - candidate !== null && - typeof candidate.cmd === "string" && - isVersionInfo(candidate.version) - ); -} - export async function codeQlVersionAtLeast( codeql: CodeQL, requiredVersion: string,