import { IFile } from '../../../../../shared/index'; /** * Utility class for handling deployment operations in the VTEX CMS context. * * The `DeployUtils` class provides methods to: * - Retrieve local VTEX account and token information. * - Prepare and upload files to a specified VTEX site, with optional user confirmation. * - Select files from the local directory for upload, with interactive prompts if required. * - Upload individual files to the VTEX CMS using authenticated HTTP requests. * * @remarks * This class depends on several utility classes (`DirectoryUtils`, `PromptsUtils`) and external modules * such as `axios` for HTTP requests and `fs` for file system operations. * * @example * ```typescript * const deployUtils = new DeployUtils('mysite', false); * await deployUtils.getLocalInformation(); * const files = await deployUtils.getFilesToUpload('.json', false); * await deployUtils.prepare(files); * ``` * * @public */ export declare class DeployUtils { private readonly directoryUtils; private readonly promptUtils; private token; private account; private userInfo; private readonly site; private readonly preConfirm; constructor(site: string, preConfirm: boolean); /** * Retrieves and sets local VTEX account information and authentication token. * * This method performs the following actions: * 1. Obtains an authentication token using the `GET_TOKEN` command. * 2. Retrieves user account information using the `GET_ACCOUNT` command. * 3. Extracts and sets the account name from the user information. * 4. Logs the account name for debugging purposes. * * @returns {Promise} A promise that resolves when the local information has been retrieved and set. */ getLocalInformation: () => Promise; /** * Prepares and uploads a list of files to a remote server for the specified account and site configuration. * * If the `preConfirm` flag is not set, prompts the user for confirmation before proceeding with the upload. * For each file, reads its contents and uploads it using the provided upload endpoint and authentication token. * Logs the progress and completion of the upload process. * * @param files - An array of file objects to be uploaded. Each file should conform to the `IFile` interface. * @returns A Promise that resolves when all files have been uploaded. */ prepare: (files: IFile[]) => Promise; /** * Retrieves a list of files from the current directory, optionally filtered by extension, * and allows the user to select which files to upload unless pre-confirmed. * * @param extension - The file extension to filter files by (e.g., 'js', 'ts'). If undefined, all files are considered. * @param preConfirm - If true, skips the file selection prompt and uploads all found files. If false, prompts the user to select files. * @returns A promise that resolves to an array of selected file objects to upload. * @throws Will throw an error if no files are found in the directory. */ getFilesToUpload: (extension: string | undefined, preConfirm: boolean) => Promise; /** * Uploads a file to a specified URL using an HTTP PUT request. * * @param params - The parameters for the file upload. * @param params.token - The authentication token to be sent as a cookie. * @param params.url - The destination URL for the file upload. * @param params.data - The file content as a string. * @param params.name - The name or path of the file to be uploaded. * @returns A Promise resolving to the Axios response of the upload request. */ uploadFile: ({ token, url, data, name }: { token: string; url: string; data: string; name: string; }) => Promise>; }