native-update
Version:
Foundation package for building a comprehensive update system for Capacitor apps. Provides architecture and interfaces but requires backend implementation.
85 lines (84 loc) • 2.41 kB
TypeScript
import type { LatestVersion } from '../definitions';
/**
* Manages version checking and comparison
*/
export declare class VersionManager {
private readonly VERSION_CHECK_CACHE_KEY;
private readonly CACHE_DURATION;
private readonly logger;
private readonly configManager;
private readonly securityValidator;
private preferences;
private memoryCache;
constructor();
/**
* Compare two semantic versions
*/
static compareVersions(version1: string, version2: string): number;
/**
* Validate semantic version format
*/
static isValidVersion(version: string): boolean;
/**
* Check if update should be performed
*/
static shouldUpdate(currentVersion: string, newVersion: string, minAppVersion?: string): boolean;
/**
* Initialize the version manager
*/
initialize(): Promise<void>;
/**
* Check for latest version from server
*/
checkForUpdates(serverUrl: string, channel: string, currentVersion: string, appId: string): Promise<LatestVersion | null>;
/**
* Compare two versions
*/
isNewerVersion(version1: string, version2: string): boolean;
/**
* Check if update is mandatory based on minimum version
*/
isUpdateMandatory(currentVersion: string, minimumVersion?: string): boolean;
/**
* Parse version metadata
*/
parseVersion(version: string): {
major: number;
minor: number;
patch: number;
prerelease?: string;
build?: string;
};
/**
* Generate version string from components
*/
buildVersionString(components: {
major: number;
minor: number;
patch: number;
prerelease?: string;
build?: string;
}): string;
/**
* Check if version is compatible with native version requirements
*/
isCompatibleWithNativeVersion(bundleVersion: string, nativeVersion: string, compatibility?: {
[key: string]: string;
}): boolean;
/**
* Get version from cache
*/
private getCachedVersionInfo;
/**
* Cache version info
*/
private cacheVersionInfo;
/**
* Clear version cache
*/
clearVersionCache(): Promise<void>;
/**
* Check if downgrade protection should block update
*/
shouldBlockDowngrade(currentVersion: string, newVersion: string): boolean;
}