import type { HttpHeader, HttpOptions, UpdateInfo, UpdateOptions, VelopackLocatorConfig, VelopackAsset } from "./types";
export { HttpHeader, HttpOptions, UpdateInfo, UpdateOptions, VelopackLocatorConfig, VelopackAsset };
type UpdateManagerOpaque = {};
declare module "./load" {
    function js_new_update_manager(source: string | null, options: string | null, locator: string | null): UpdateManagerOpaque;
    function js_get_current_version(um: UpdateManagerOpaque): string;
    function js_get_app_id(um: UpdateManagerOpaque): string;
    function js_is_portable(um: UpdateManagerOpaque): boolean;
    function js_update_pending_restart(um: UpdateManagerOpaque): string | null;
    function js_check_for_updates_async(um: UpdateManagerOpaque): Promise<string | null>;
    function js_download_update_async(um: UpdateManagerOpaque, update: string, progress: (perc: number) => void): Promise<void>;
    function js_wait_exit_then_apply_update(um: UpdateManagerOpaque, update: string, silent?: boolean, restart?: boolean, restartArgs?: string[]): void;
    function js_appbuilder_run(cb: (hook_name: string, current_version: string) => void, customArgs: string[] | null, locator: string | null, autoApply: boolean): void;
    function js_set_logger_callback(cb: (loglevel: LogLevel, msg: string) => void): void;
}
type VelopackHook = (version: string) => void;
type LogLevel = "info" | "warn" | "error" | "debug" | "trace";
/**
 * VelopackApp helps you to handle app activation events correctly.
 * This should be used as early as possible in your application startup code.
 * (eg. the beginning of main() or wherever your entry point is)
 */
export declare class VelopackApp {
    private _hooks;
    private _customArgs;
    private _customLocator;
    private _autoApply;
    /**
     * Build a new VelopackApp instance.
     */
    static build(): VelopackApp;
    /**
     * WARNING: FastCallback hooks are run during critical stages of Velopack operations.
     * Your code will be run and then the process will exit.
     * If your code has not completed within 30 seconds, it will be terminated.
     * Only supported on windows; On other operating systems, this will never be called.
     */
    onAfterInstallFastCallback(callback: VelopackHook): VelopackApp;
    /**
     * WARNING: FastCallback hooks are run during critical stages of Velopack operations.
     * Your code will be run and then the process will exit.
     * If your code has not completed within 30 seconds, it will be terminated.
     * Only supported on windows; On other operating systems, this will never be called.
     */
    onBeforeUninstallFastCallback(callback: VelopackHook): VelopackApp;
    /**
     * WARNING: FastCallback hooks are run during critical stages of Velopack operations.
     * Your code will be run and then the process will exit.
     * If your code has not completed within 15 seconds, it will be terminated.
     * Only supported on windows; On other operating systems, this will never be called.
     */
    onBeforeUpdateFastCallback(callback: VelopackHook): VelopackApp;
    /**
     * WARNING: FastCallback hooks are run during critical stages of Velopack operations.
     * Your code will be run and then the process will exit.
     * If your code has not completed within 15 seconds, it will be terminated.
     * Only supported on windows; On other operating systems, this will never be called.
     */
    onAfterUpdateFastCallback(callback: VelopackHook): VelopackApp;
    /**
     * This hook is triggered when the application is restarted by Velopack after installing updates.
     */
    onRestarted(callback: VelopackHook): VelopackApp;
    /**
     * This hook is triggered when the application is started for the first time after installation.
     */
    onFirstRun(callback: VelopackHook): VelopackApp;
    /**
     * Override the command line arguments used by VelopackApp. (by default this is env::args().skip(1))
     */
    setArgs(args: string[]): VelopackApp;
    /**
     * VelopackLocator provides some utility functions for locating the current app important paths (eg. path to packages, update binary, and so forth).
     */
    setLocator(locator: VelopackLocatorConfig): VelopackApp;
    /**
     * Set a callback to receive log messages from VelopackApp.
     */
    setLogger(callback: (loglevel: LogLevel, msg: string) => void): VelopackApp;
    /**
     * Set whether to automatically apply downloaded updates on startup. This is ON by default.
     */
    setAutoApplyOnStartup(autoApply: boolean): VelopackApp;
    /**
     * Runs the Velopack startup logic. This should be the first thing to run in your app.
     * In some circumstances it may terminate/restart the process to perform tasks.
     */
    run(): void;
}
/**
 * A built-in update source that retrieves release feeds and downloads assets from a local or network directory.
 */
export declare class FileSource {
    readonly path: string;
    /**
     * Create a new FileSource.
     * @param path The path to the directory containing the releases.
     */
    constructor(path: string);
}
/**
 * Retrieves updates from a static file host or other web server.
 */
export declare class HttpSource {
    readonly url: string;
    readonly options?: Partial<HttpOptions> | undefined;
    /**
     * Create a new HttpSource.
     * @param url The base URL of the releases feed.
     * @param options Optional HTTP options (custom headers, timeout) applied to all requests made by this source.
     */
    constructor(url: string, options?: Partial<HttpOptions> | undefined);
}
/**
 * Retrieves available releases from a GitHub repository. Supports both github.com
 * and GitHub Enterprise instances.
 */
export declare class GithubSource {
    readonly repoUrl: string;
    readonly accessToken?: string | undefined;
    readonly prerelease: boolean;
    /**
     * Create a new GithubSource.
     * @param repoUrl The URL of the GitHub repository (e.g. "https://github.com/myuser/myrepo").
     * @param accessToken Optional GitHub access token. Without one, requests are rate limited to 60/hr per IP.
     * @param prerelease If true, pre-releases will also be searched/downloaded.
     */
    constructor(repoUrl: string, accessToken?: string | undefined, prerelease?: boolean);
}
/**
 * Retrieves available releases from a GitLab repository.
 */
export declare class GitlabSource {
    readonly repoUrl: string;
    readonly accessToken?: string | undefined;
    readonly prerelease: boolean;
    /**
     * Create a new GitlabSource.
     * @param repoUrl The GitLab API URL (e.g. "https://gitlab.com/api/v4/projects/ProjectId").
     * @param accessToken Optional GitLab access token (sent as PRIVATE-TOKEN header).
     * @param prerelease If true, upcoming/pre-releases will also be searched.
     */
    constructor(repoUrl: string, accessToken?: string | undefined, prerelease?: boolean);
}
/**
 * Retrieves available releases from a Gitea repository.
 */
export declare class GiteaSource {
    readonly repoUrl: string;
    readonly accessToken?: string | undefined;
    readonly prerelease: boolean;
    /**
     * Create a new GiteaSource.
     * @param repoUrl The URL of the Gitea repository (e.g. "https://gitea.com/myuser/myrepo").
     * @param accessToken Optional Gitea access token (sent as `Authorization: token {token}`).
     * @param prerelease If true, pre-releases will also be searched/downloaded.
     */
    constructor(repoUrl: string, accessToken?: string | undefined, prerelease?: boolean);
}
/**
 * Retrieves updates from the hosted Velopack Flow service (https://api.velopack.io/).
 */
export declare class VelopackFlowSource {
    readonly baseUri?: string | undefined;
    /**
     * Create a new VelopackFlowSource.
     * @param baseUri Optional base URI of the Velopack Flow service. Defaults to the hosted service (https://api.velopack.io/).
     */
    constructor(baseUri?: string | undefined);
}
/**
 * A source that UpdateManager can retrieve updates from. A plain string is auto-detected:
 * a local path uses FileSource, a github.com/gitlab.com/gitea.com URL uses the matching
 * git source, and any other URL uses HttpSource.
 */
export type UpdateSource = string | FileSource | HttpSource | GithubSource | GitlabSource | GiteaSource | VelopackFlowSource;
/**
 * Provides functionality for checking for updates, downloading updates, and applying updates to the current application.
 */
export declare class UpdateManager {
    private readonly opaque;
    /**
     * Create a new UpdateManager instance that retrieves updates from the hosted Velopack Flow service.
     * @param options Optional extra configuration for update manager.
     * @param locator Override the default locator configuration (usually used for testing / mocks).
     */
    constructor(options?: UpdateOptions, locator?: VelopackLocatorConfig);
    /**
     * Create a new UpdateManager instance.
     * @param source The source to check for updates: one of the update source classes, or a
     * URL / local path string which will be auto-detected.
     * @param options Optional extra configuration for update manager.
     * @param locator Override the default locator configuration (usually used for testing / mocks).
     */
    constructor(source: UpdateSource, options?: UpdateOptions, locator?: VelopackLocatorConfig);
    /**
     * Returns the currently installed version of the app.
     */
    getCurrentVersion(): string;
    /**
     * Returns the currently installed app id.
     */
    getAppId(): string;
    /**
     * Returns whether the app is in portable mode. On Windows this can be true or false.
     * On MacOS and Linux this will always be true.
     */
    isPortable(): boolean;
    /**
     * Returns an VelopackAsset object if there is an update downloaded which still needs to be applied.
     * You can pass the VelopackAsset object to waitExitThenApplyUpdate to apply the update.
     */
    getUpdatePendingRestart(): VelopackAsset | null;
    /**
     * Checks for updates, returning None if there are none available. If there are updates available, this method will return an
     * UpdateInfo object containing the latest available release, and any delta updates that can be applied if they are available.
     */
    checkForUpdatesAsync(): Promise<UpdateInfo | null>;
    /**
     * Downloads the specified updates to the local app packages directory. Progress is reported back to the caller via an optional Sender.
     * This function will acquire a global update lock so may fail if there is already another update operation in progress.
     * - If the update contains delta packages and the delta feature is enabled
     *   this method will attempt to unpack and prepare them.
     * - If there is no delta update available, or there is an error preparing delta
     *   packages, this method will fall back to downloading the full version of the update.
     */
    downloadUpdateAsync(update: UpdateInfo, progress?: (perc: number) => void): Promise<void>;
    /**
     * This will launch the Velopack updater and tell it to wait for this program to exit gracefully.
     * You should then clean up any state and exit your app. The updater will apply updates and then
     * optionally restart your app. The updater will only wait for 60 seconds before giving up.
     */
    waitExitThenApplyUpdate(update: UpdateInfo | VelopackAsset, silent?: boolean, restart?: boolean, restartArgs?: string[]): void;
}
