/*! * @license * Copyright Squiz Australia Pty Ltd. All Rights Reserved. */ import { zipDirectory } from '@squiz/dx-common-lib'; import { Logger } from '@squiz/dx-logger-lib'; import { AxiosInstance } from 'axios'; import { handleResponse } from './responseHandler'; export interface InitialUpload { zip: string; upload: any; // Keep as any to match the original API response } /** * Initialize upload by zipping folder and creating upload request * @param apiClient - Axios client for API calls * @param folderPath - Path to the job folder * @param tmpDir - Temporary directory for zip file * @param logger - Logger instance * @returns Upload information */ export async function initializeUpload( apiClient: AxiosInstance, folderPath: string, tmpDir: string, logger: Logger, ): Promise { logger.info('Initial scanning'); const zip = await zipDirectory(folderPath, tmpDir); const upload = await handleResponse(apiClient.post('/upload-job', {})); logger.info(`deployment id: ${upload.id} status: transferring`); return { zip, upload }; }