UNPKG

native-update

Version:

Foundation package for building a comprehensive update system for Capacitor apps. Provides architecture and interfaces but requires backend implementation.

95 lines (94 loc) 2.25 kB
import type { BundleInfo } from '../definitions'; /** * Manages bundle storage and lifecycle */ export declare class BundleManager { private readonly STORAGE_KEY; private readonly ACTIVE_BUNDLE_KEY; private preferences; private readonly logger; private readonly configManager; private cache; private cacheExpiry; constructor(); /** * Initialize the bundle manager with preferences */ initialize(): Promise<void>; /** * Load cache from preferences */ private loadCache; /** * Save cache to preferences */ private saveCache; /** * Save bundle information */ saveBundleInfo(bundle: BundleInfo): Promise<void>; /** * Validate bundle information */ private validateBundleInfo; /** * Get all bundles */ getAllBundles(): Promise<BundleInfo[]>; /** * Get bundle by ID */ getBundle(bundleId: string): Promise<BundleInfo | null>; /** * Delete bundle */ deleteBundle(bundleId: string): Promise<void>; /** * Get active bundle */ getActiveBundle(): Promise<BundleInfo | null>; /** * Set active bundle */ setActiveBundle(bundleId: string): Promise<void>; /** * Get active bundle ID */ getActiveBundleId(): Promise<string | null>; /** * Clear active bundle */ clearActiveBundle(): Promise<void>; /** * Clear all bundles */ clearAllBundles(): Promise<void>; /** * Clean up old bundles */ cleanupOldBundles(keepCount: number): Promise<void>; /** * Get bundles older than specified time */ getBundlesOlderThan(timestamp: number): Promise<BundleInfo[]>; /** * Mark bundle as verified */ markBundleAsVerified(bundleId: string): Promise<void>; /** * Get total storage used by bundles */ getTotalStorageUsed(): Promise<number>; /** * Check if storage limit is exceeded */ isStorageLimitExceeded(additionalSize?: number): Promise<boolean>; /** * Create default bundle */ createDefaultBundle(): BundleInfo; /** * Clean expired cache entries */ cleanExpiredBundles(): Promise<void>; }