/** * Shape of the relevant slice of `package.json` consulted for compatibility * metadata. `cuneiform.requiredAppVersion` is the minimum-required Cuneiform * For Salesforce package version; `version` is the CLI plugin's own version * (always populated by oclif/npm). Namespace/name are sourced from * `namespace-constants.ts`. */ export type CompatibilityManifest = { version?: string; cuneiform?: { requiredAppVersion?: string; }; }; /** Required Cuneiform For Salesforce app version, parsed from the manifest. */ export type RequiredAppVersion = { /** Version string in Major.Minor (or Major.Minor.Patch.Build) form. */ version: string; }; /** * Comparison outcome produced by {@link CompatibilityService.compare} or set * by the operation layer when the org is detected via namespace fallback but * the version is unavailable (`installed-version-unknown`). * * Exit-code contract (set by the command layer): `installed-match`, * `installed-newer`, and `installed-version-unknown` exit 0. `installed-older` * and `not-installed` exit 1. */ export type CompatibilityState = 'installed-match' | 'installed-newer' | 'installed-older' | 'installed-version-unknown' | 'not-installed'; /** * Configuration for {@link CompatibilityService}. */ export type ICompatibilityServiceConfig = { /** * Optional injectable manifest reader. Defaults to reading the CLI plugin's * `package.json` from disk. Tests inject a deterministic reader to avoid * touching the filesystem. */ manifestReader?: () => CompatibilityManifest; }; /** * Service for evaluating compatibility between the running CLI version and the * Cuneiform For Salesforce managed package installed in a target org. * * Stateless. The required version is sourced from `package.json`; the installed * version is supplied by the caller (typically via * `OrgInfoService.getCuneiformPackageInfo`). * * Comparison semantics: version strings are parsed as integer tuples padded to * four parts (`Major.Minor.Patch.Build`). Equality on the padded tuple yields * `installed-match`; lexicographic order on the padded tuple yields * `installed-newer` / `installed-older`. A null/undefined installed version * yields `not-installed`. */ export declare class CompatibilityService { private readonly manifestReader; constructor(config?: ICompatibilityServiceConfig); /** * Compare a required version to an installed version. Pure function — exposed * as a static method since it does not depend on instance state. * * @param required - required version string (`Major.Minor` or `Major.Minor.Patch.Build`) * @param installed - installed version string, or `null`/`undefined` if absent * @returns one of `installed-match`, `installed-newer`, `installed-older`, `not-installed` * @throws SfError (E4682) when either version string contains a non-numeric component */ static compare(required: string, installed: string | null | undefined): CompatibilityState; /** * Load the required Cuneiform For Salesforce app version from the manifest. * * @returns the parsed required version * @throws SfError (E4681) when `cuneiform.requiredAppVersion` is missing or empty */ loadRequired(): RequiredAppVersion; /** * Load the CLI plugin's own version from the manifest (`package.json` `version` field). * * @returns the CLI version string verbatim (e.g., "1.0.4-beta.1") * @throws SfError (E4684) when `version` is missing or empty (should never happen for npm-published packages) */ loadCliVersion(): string; }