import type { B2CInstance } from '../../instance/index.js'; import { type CartridgeMapping, type FindCartridgesOptions } from './cartridges.js'; /** * Options for deploying cartridges. */ /** Progress info passed to the upload onProgress callback. */ export interface UploadProgressInfo { /** Current operation phase */ phase: 'archiving' | 'uploading' | 'unzipping' | 'cleanup'; /** Seconds elapsed since the current phase started */ elapsedSeconds: number; } /** * Options for upload progress reporting. */ export interface UploadOptions { /** Callback for progress updates. Called when a phase starts (elapsedSeconds=0) and periodically thereafter. */ onProgress?: (info: UploadProgressInfo) => void; } export interface DeployOptions extends FindCartridgesOptions { /** Activate the code version after deploy */ activate?: boolean; /** Reload (toggle activation to force reload) the code version after deploy */ reload?: boolean; /** Delete existing cartridges before uploading */ delete?: boolean; /** Callback for progress updates during long-running operations */ onProgress?: UploadOptions['onProgress']; } /** * Result of a cartridge deployment. */ export interface DeployResult { /** Cartridges that were deployed */ cartridges: CartridgeMapping[]; /** Code version deployed to */ codeVersion: string; /** Whether the code version was activated after deploy */ activated: boolean; /** Whether the code version was reloaded after deploy */ reloaded: boolean; } /** * Deletes cartridges from an instance via WebDAV. * * This is a low-level function that deletes cartridge directories * from the specified code version. Errors are silently ignored for * cartridges that don't exist. * * Requires `instance.config.codeVersion` to be set. * * @param instance - B2C instance to delete from * @param cartridges - Cartridge mappings to delete * @throws Error if code version not set * * @example * ```typescript * const cartridges = findCartridges('./cartridges'); * await deleteCartridges(instance, cartridges); * ``` */ export declare function deleteCartridges(instance: B2CInstance, cartridges: CartridgeMapping[]): Promise; /** * Uploads cartridges to an instance via WebDAV. * * This is a low-level upload function that: * 1. Creates a zip archive of the cartridges * 2. Uploads it to WebDAV * 3. Unzips on the server * 4. Cleans up the temporary zip file * * Requires `instance.config.codeVersion` to be set. * * @param instance - B2C instance to upload to * @param cartridges - Cartridge mappings to upload * @throws Error if code version not set or upload fails * * @example * ```typescript * const cartridges = findCartridges('./cartridges'); * await uploadCartridges(instance, cartridges); * ``` */ export declare function uploadCartridges(instance: B2CInstance, cartridges: CartridgeMapping[], options?: UploadOptions): Promise; /** * Finds and deploys cartridges from a directory to an instance. * * This is a high-level function that orchestrates the deployment process: * 1. Finds cartridges in the specified directory (by .project files) * 2. Applies include/exclude filters * 3. Optionally deletes existing cartridges first * 4. Creates a zip archive and uploads via WebDAV * 5. Optionally reloads the code version * * Requires `instance.config.codeVersion` to be set. * * @param instance - B2C instance to deploy to (must have codeVersion set) * @param directory - Directory to search for cartridges * @param options - Deploy options (filters, reload, delete) * @returns Deploy result with cartridges and status * @throws Error if code version not set, no cartridges found, or deployment fails * * @example * ```typescript * // Simple deploy * const result = await findAndDeployCartridges(instance, './cartridges'); * * // Deploy specific cartridges with reload * const result = await findAndDeployCartridges(instance, '.', { * include: ['app_storefront_base'], * reload: true, * }); * * // Delete existing cartridges before upload * const result = await findAndDeployCartridges(instance, './cartridges', { * delete: true, * reload: true, * }); * ``` */ export declare function findAndDeployCartridges(instance: B2CInstance, directory: string, options?: DeployOptions): Promise;