import { AsperaSdkInfo, TransferResponse } from '../models/aspera-sdk.model'; import { CustomBrandingOptions, DataTransferResponse, DropzoneEventData, DropzoneOptions, AsperaSdkSpec, AsperaSdkTransfer, FileDialogOptions, FolderDialogOptions, SaveFileDialogOptions, InitOptions, ModifyTransferOptions, Pagination, PaginatedFilesResponse, ResumeTransferOptions, TransferSpec, ReadChunkAsArrayBufferResponse, ReadAsArrayBufferResponse, SdkCapabilities, SdkStatus, GetChecksumOptions, ChecksumFileResponse, ReadDirectoryOptions, ReadDirectoryResponse, ShowPreferencesPageOptions, TestSshPortsOptions, TransferClient } from '../models/models'; /** * Check if IBM Aspera for Desktop connection works. This function is called by init * when initializing the SDK. This function can be used at any point for checking. * * @returns a promise that resolves if server can connect or rejects if not */ export declare const testConnection: () => Promise; /** * Initialize drag and drop. HTTP Gateway and Connect does not need to init. * Ignore if only HTTP Gateway * @param initCall - Indicate if called via init flow and should not reject * * @returns a promise that resolves if the initialization was successful or not */ export declare const initDragDrop: (initCall?: boolean) => Promise; /** * Get the current SDK lifecycle status synchronously. * * @returns the current status, or undefined if no init has been called yet */ export declare const getStatus: () => SdkStatus | undefined; /** * Update HTTP Gateway settings. * * Partial updates are supported — fields left undefined keep their current value. * * @param settings the settings to update * * @example * // Before init: * updateHttpGatewaySettings({chunkSize: 5_000_000, concurrentUploads: 4}); * initSession({appId: 'my-app', httpGatewaySettings: {url: '...', forceGateway: true}}); * * @example * // At runtime: * updateHttpGatewaySettings({chunkSize: 5_000_000}); */ export declare const updateHttpGatewaySettings: (settings: { chunkSize?: number; concurrentUploads?: number; }) => void; /** * Initialize the SDK and connect to a transfer client. Returns a promise that resolves * when the transfer client is ready, or rejects if it cannot be reached. * * By default, the SDK connects to IBM Aspera for desktop. Set `connectSettings.useConnect` * to use IBM Aspera Connect instead. If `httpGatewaySettings` is provided, the gateway is * set up first — when `forceGateway` is true it becomes the sole transport; when false it * is set up as a supplementary transport and the primary client (Desktop or Connect) is * still initialized afterward. * * Note that the promise behavior varies by transfer client. For Desktop, the promise * remains pending until the application is detected. For Connect, the promise resolves * immediately after initialization begins — use {@link registerStatusCallback} to track * when Connect is actually ready. For a non-blocking alternative that provides consistent * lifecycle status events across all transfer clients, see {@link initSession}. * * @param options - Initialization options. See {@link InitOptions}. * * @returns a promise that resolves with SDK metadata when the transfer client is ready * * @example * init({ appId: 'my-app' }) * .then(() => { * // Transfer client is ready — enable UI * }) * .catch(error => { * // Could not connect — prompt user to install or launch * }); */ export declare const init: (options?: InitOptions) => Promise; /** * Initialize the SDK and begin detecting a transfer client. This function returns * immediately — lifecycle status is communicated asynchronously via {@link registerStatusCallback}. * * The SDK supports three transfer clients. By default, IBM Aspera for desktop is used. * Set `connectSettings.useConnect` to use IBM Aspera Connect instead. Desktop and Connect * are mutually exclusive — one or the other is detected, not both. * * ## HTTP Gateway * * HTTP Gateway is a server-side component that enables browser-based transfers without * a desktop application. It can be used in two modes: * * - **Sole transport** (`forceGateway: true`): HTTP Gateway is the only transport. * No Desktop or Connect detection occurs. Status transitions to `RUNNING` when the * gateway responds successfully, or `FAILED` if it does not. * * - **Supplementary transport** (`forceGateway: false`): HTTP Gateway is set up first * as an additional transport for browser-based uploads and downloads. The primary * transfer client (Desktop or Connect) is then detected separately. If HTTP Gateway * setup fails, the primary client is still detected. Features that require a desktop * application (native file dialogs, drag and drop, etc.) are only available when the * primary client is running. * * ## Status lifecycle * * Use {@link registerStatusCallback} to receive status updates. Use {@link getStatus} to * read the current status synchronously at any time. * * **Desktop path**: `INITIALIZING` → `RUNNING` (app detected), `DEGRADED` (timeout but * HTTP Gateway is available as a supplementary transport), or `FAILED` (timeout, no * fallback). Detection continues in the background after `DEGRADED` or `FAILED` — if the * user launches the app later, the status transitions to `RUNNING`. * * **Connect path**: `INITIALIZING` → `RUNNING`, `FAILED`, `OUTDATED`, or * `EXTENSION_INSTALL` depending on the state of the Connect browser extension * and application. * * **HTTP Gateway path** (`forceGateway: true`): `INITIALIZING` → `RUNNING` or `FAILED`. * * @param options - Initialization options. See {@link InitOptions}. * * @example * // Use IBM Aspera for desktop (default) * registerStatusCallback(status => { * if (status === 'RUNNING') { * // Transfer client is ready — enable UI * } else if (status === 'FAILED') { * // Not detected — prompt user to install or launch * } * }); * * initSession({ appId: 'my-app' }); * * @example * // Use IBM Aspera Connect * initSession({ * appId: 'my-app', * connectSettings: { * useConnect: true, * }, * }); * * * @example * // Use HTTP Gateway only * initSession({ * appId: 'my-app', * httpGatewaySettings: { * url: 'https://example.com/aspera/http-gwy', * forceGateway: true, * }, * }); * * * @example * // Use IBM Aspera for desktop with automatic fallback to IBM Aspera Connect * initSession({ * appId: 'my-app', * connectSettings: { * fallback: true, * }, * }); * * @example * // Use IBM Aspera for desktop with automatic fallback to HTTP Gateway * initSession({ * appId: 'my-app', * httpGatewaySettings: { * url: 'https://example.com/aspera/http-gwy', * }, * }); * * * @example * // Use IBM Aspera for desktop or IBM Aspera Connect with automatic fallback to HTTP Gateway * initSession({ * appId: 'my-app', * connectSettings: { * fallback: true, * }, * httpGatewaySettings: { * url: 'https://example.com/aspera/http-gwy', * }, * }); */ export declare const initSession: (options?: InitOptions) => void; /** * Tests SSH port connectivity to a transfer server. * * Supported for Connect and IBM Aspera for desktop. Not supported for HTTP Gateway. * * @param options options including the remote host, SSH port, and timeout. * * @returns a promise that resolves if the SSH port test is successful and rejects otherwise. */ export declare const testSshPorts: (options: TestSshPortsOptions) => Promise; /** * Authenticates a transfer specification against the remote server. * * Supported for Connect and IBM Aspera for desktop. Not supported for HTTP Gateway. * * @param transferSpec the transfer specification to authenticate. * * @returns a promise that resolves if authentication is successful and rejects otherwise. */ export declare const authenticate: (transferSpec: TransferSpec) => Promise; /** * Start a transfer * * @param transferSpec standard transferSpec for transfer * @param asperaSdkSpec IBM Aspera settings when starting a transfer. * * @returns a promise that resolves if transfer initiation is successful and rejects if transfer cannot be started */ export declare const startTransfer: (transferSpec: TransferSpec, asperaSdkSpec?: AsperaSdkSpec) => Promise; /** * Register a callback event for getting transfer updates * * @param callback callback function to receive transfers * * @returns ID representing the callback for deregistration purposes */ export declare const registerActivityCallback: (callback: (transfers: TransferResponse) => void) => string; /** * Remove a callback from the transfer callback * * @param id the ID returned by `registerActivityCallback` */ export declare const deregisterActivityCallback: (id: string) => void; /** * Register a callback for SDK lifecycle status changes. The callback fires immediately * with the current status (if one exists) and again whenever the status changes. * * Status values: * * - `INITIALIZING` — The SDK is detecting a transfer client. * - `RUNNING` — A transfer client is ready. Full functionality is available. * - `DEGRADED` — The primary transfer client (IBM Aspera for desktop) was not detected, but HTTP * Gateway is available as a fallback. This is only available if XXX... * - `FAILED` — No transfer client could be reached. This could be because the user does * not have a transfer client installed, it is not running, or in the case of HTTP Gateway, * it was not reachable. * - `DISCONNECTED` — The transfer client was previously running but lost connection. This is specific * to IBM Aspera for desktop. For example, if the user quits the app this status will trigger. * - `OUTDATED` — (Connect only) The Connect installation needs updating. * - `EXTENSION_INSTALL` — (Connect only) The browser extension needs to be installed. * * For IBM Aspera for desktop, detection continues in the background after `FAILED` or `DEGRADED`. * If the user launches the application later, the status transitions to `RUNNING`. * * @param callback callback function to receive status events * * @returns ID representing the callback for deregistration purposes * * @example * const id = registerStatusCallback(status => { * if (status === 'RUNNING') { * // Full functionality — enable all UI * } else if (status === 'DEGRADED') { * // Transfers work via HTTP Gateway * } else if (status === 'FAILED') { * // Nothing available — prompt user to install * } * }); * * // Later, to stop listening: * deregisterStatusCallback(id); */ export declare const registerStatusCallback: (callback: (status: SdkStatus) => void) => string; /** * Remove a callback from getting connection status events. * * @param id the ID returned by `registerStatusCallback` */ export declare const deregisterStatusCallback: (id: string) => void; /** * Remove a transfer. This will stop the transfer if it is in progress. * * @param id transfer uuid * * @returns a promise that resolves if transfer is removed and rejects if transfer cannot be removed */ export declare const removeTransfer: (id: string) => Promise; /** * Stop a transfer. * * @param id transfer uuid * * @returns a promise that resolves if transfer is stopped and rejects if transfer cannot be stopped */ export declare const stopTransfer: (id: string) => Promise; /** * Resume a paused or failed transfer. * * @param id transfer uuid * @param options resume transfer options * * @returns a promise that resolves with the new transfer object if transfer is resumed */ export declare const resumeTransfer: (id: string, options?: ResumeTransferOptions) => Promise; /** * Displays a file browser dialog for the user to select files. * * @param options file dialog options * * @returns a promise that resolves with the selected file(s) and rejects if user cancels dialog */ export declare const showSelectFileDialog: (options?: FileDialogOptions) => Promise; /** * Displays a folder browser dialog for the user to select folders. * * @param options folder dialog options * * @returns a promise that resolves with the selected folder(s) and rejects if user cancels dialog */ export declare const showSelectFolderDialog: (options?: FolderDialogOptions) => Promise; /** * Displays a save file dialog for the user to choose a save location and filename. * * Supported for Connect and IBM Aspera for desktop. Not supported for HTTP Gateway. * * @param options save file dialog options * * @returns a promise that resolves with the selected save path and rejects if user cancels dialog */ export declare const showSaveFileDialog: (options?: SaveFileDialogOptions) => Promise; /** * Shows the about page of the transfer client. * * This is supported when using Connect or IBM Aspera for desktop, but not HTTP Gateway. * * @returns a promise that resolves when the about page is shown. */ export declare const showAbout: () => Promise; /** * Opens the IBM Aspera preferences page. * * @returns a promise that resolves when the preferences page is opened. */ export declare const showPreferences: () => Promise; /** * Opens the transfer manager UI of the native transfer client. * * Supported for Connect and IBM Aspera for desktop. Not supported for HTTP Gateway. * * @returns a promise that resolves when the transfer manager is opened. */ export declare const showTransferManager: () => Promise; /** * Opens the preferences page of the transfer client to a specific tab. * * Supported for Connect and IBM Aspera for desktop. Not supported for HTTP Gateway. * * @param options options including the page (tab) to open * * @returns a promise that resolves when the preferences page is opened. */ export declare const showPreferencesPage: (options: ShowPreferencesPageOptions) => Promise; /** * Opens the transfer rate monitor graph for a specific transfer. * * Supported for Connect and IBM Aspera for desktop. Not supported for HTTP Gateway. * * @param transferId the unique identifier of the transfer to monitor. * * @returns a promise that resolves when the transfer monitor is opened. */ export declare const showTransferMonitor: (transferId: string) => Promise; /** * Get all transfers associated with the current application. * * @returns a promise that resolves with an array of transfers. */ export declare const getAllTransfers: () => Promise; /** * Get a specific transfer by ID. * * @param id transfer uuid * * @returns a promise that resolves with the transfer. */ export declare const getTransfer: (id: string) => Promise; /** * Get paginated file-level progress for a specific transfer. * * @param id transfer uuid * @param pagination optional pagination options (limit and offset) * * @returns a promise that resolves with the paginated file progress list */ export declare const getFilesList: (id: string, pagination?: Pagination) => Promise; /** * Opens and highlights the downloaded file in Finder or Windows Explorer. If multiple files, * then only the first file will be selected. * * @param id transfer uuid * * @returns a promise that resolves if the file can be shown and rejects if not */ export declare const showDirectory: (id: string) => Promise; /** * Modify the speed of a running transfer. * * @param id transfer uuid * @param options transfer rate options * * @returns a promise that resolves if the transfer rate can be modified and rejects if not */ export declare const modifyTransfer: (id: string, options: ModifyTransferOptions) => Promise; /** * Set the custom branding template to be used by IBM Aspera. If the app is already * configured to use a different branding, then the branding template you specify will be * stored by the app, allowing the end user to switch at any point. * * @param id custom branding template id. This should be consistent across page loads. * @param options custom branding options * * @returns a promise that resolves if the branding was properly set. */ export declare const setBranding: (id: string, options: CustomBrandingOptions) => Promise; /** * Create a dropzone for the given element selector. * * @param callback the function to call once the files are dropped * @param elementSelector the selector of the element on the page that should watch for drop events * @param options options to configure which drag and drop events trigger the listener */ export declare const createDropzone: (callback: (data: DropzoneEventData) => void, elementSelector: string, options?: DropzoneOptions) => void; /** * Remove dropzone. * * @param elementSelector the selector of the element on the page that should remove */ export declare const removeDropzone: (elementSelector: string) => void; /** * Get metadata about the IBM Aspera installation. * * @returns a promise that returns information about the user's IBM Aspera installation. */ export declare const getInfo: () => Promise; /** * Read an entire file as an array buffer (base64-encoded). * * Note: The maximum file size allowed is 50 MiB. * * @param path path to the file to read * * @returns a promise that resolves with the file data as a base64-encoded string and mime type */ export declare const readAsArrayBuffer: (path: string) => Promise; /** * Read a chunk of a file as an array buffer (base64-encoded). * * Note: The maximum chunk size allowed is 50 MiB. * * @param path path to the file to read * @param offset offset to start reading the file, in bytes * @param chunkSize the size of the chunk to read, in bytes * * @returns a promise that resolves with the file chunk data as a base64-encoded string and mime type */ export declare const readChunkAsArrayBuffer: (path: string, offset: number, chunkSize: number) => Promise; /** * Get a checksum of the specified chunk size of the file. * * @param options checksum options including path, offset, chunkSize, and checksumMethod * * @returns a promise that resolves with the checksum information */ export declare const getChecksum: (options: GetChecksumOptions) => Promise; /** * Read the contents of a directory, returning all entries as a flat list. * * This API is only supported when using IBM Aspera for desktop. * * @param options options including the directory path, optional recursion depth, and filters * * @returns a promise that resolves with the directory entries and total count */ export declare const readDirectory: (options: ReadDirectoryOptions) => Promise; /** * Returns an object describing the high-level capabilities supported by the user's * transfer client (e.g. IBM Aspera for desktop, Connect, or HTTP Gateway). * * Use this for feature detection at a semantic level as capabilities may change depending on the * transfer client. * * Rather than caching the return value of this function, it's recommended to call it on the fly as * capabilities may change if your application supports multiple transfer clients. As a result, it's * recommend to use the slightly more ergonomic {@link hasCapability}. * * @returns an object with boolean flags for each capability. * * @example * // Conditionally render UI based on capabilities * const caps = asperaSdk.getCapabilities(); * // Determine if your web application can render image previews for user selected files * if (caps.imagePreview) { * asperaSdk.readAsArrayBuffer(path); * } */ export declare const getCapabilities: () => SdkCapabilities; /** * Check if the SDK and underlying transfer client supports a specific capability or feature. * * Capabilities depend on the transfer client being used (HTTP Gateway, Connect, or IBM Aspera for desktop). * * This function may be useful if you want to conditionally perform certain actions rather than * potentially getting an error. * * For example, only IBM Aspera for desktop supports traversing a folder's contents. An application can * check `hasCapability('readDirectory')` to optionally show a folder browser only when the feature is available. * For example, when a user does not have IBM Aspera for desktop installed and is using HTTP Gateway, your * application can disable this feature. Later, if that same user installs IBM Aspera for desktop, your application * will show the feature as enabled without any additional changes. * * @param capability the capability to check. * * @returns `true` if the capability is supported, `false` otherwise * * @example * ```typescript * // Determine if your web application can render image previews for user selected files * if (asperaSdk.hasCapability('imagePreview')) { * const response = await asperaSdk.readAsArrayBuffer(path); * } * ``` */ export declare const hasCapability: (capability: keyof SdkCapabilities) => boolean; export declare const currentTransferClient: () => TransferClient | undefined;