UNPKG

sfdx-hardis

Version:

Swiss-army-knife Toolbox for Salesforce. Allows you to define a complete CD/CD Pipeline. Orchestrate base commands and assist users with interactive wizards

199 lines (198 loc) • 7.49 kB
import { Connection } from '@salesforce/core'; export declare const filesFolderRoot: string; export declare class FilesExporter { private filesPath; private conn; private pollTimeout; private recordsChunkSize; private startChunkNumber; private parentRecordsChunkSize; private commandThis; private dtl; private exportedFilesFolder; private recordsChunk; private chunksNumber; private recordsChunkQueue; private recordsChunkQueueRunning; private queueInterval; private bulkApiRecordsEnded; private recordChunksNumber; private logFile; private hasExistingFiles; private resumeExport; private totalRestApiCalls; private totalBulkApiCalls; private totalParentRecords; private parentRecordsWithFiles; private recordsIgnored; private filesDownloaded; private filesErrors; private filesIgnoredType; private filesIgnoredExisting; private filesIgnoredSize; private filesValidationErrors; private filesValidated; private apiLimitsManager; constructor(filesPath: string, conn: Connection, options: { pollTimeout?: number; recordsChunkSize?: number; exportConfig?: any; startChunkNumber?: number; resumeExport?: boolean; }, commandThis: any); processExport(): Promise<{ stats: { filesValidated: number; filesDownloaded: number; filesErrors: number; filesIgnoredType: number; filesIgnoredExisting: number; filesIgnoredSize: number; filesValidationErrors: number; totalRestApiCalls: number; totalBulkApiCalls: number; totalParentRecords: number; parentRecordsWithFiles: number; recordsIgnored: number; restApiUsedBefore: number; restApiUsedAfter: number; restApiLimit: number; restApiCallsRemaining: number; bulkApiUsedBefore: number; bulkApiUsedAfter: number; bulkApiLimit: number; bulkApiCallsRemaining: number; }; logFile: string; }>; private calculateTotalFilesCount; private processDownloadsWithProgress; private calculateApiConsumption; private waitIfApiLimitApproached; private getApiUsageStatus; private startQueue; private queueCompleted; private processParentRecords; private addToRecordsChunk; private processRecordsChunk; private initializeCsvLog; private extractFileInfo; private logSkippedFile; private calculateMD5; private validateDownloadedFile; private writeCsvLogEntry; private downloadFile; private downloadAttachmentFile; private downloadContentVersionFile; private buildResult; } export declare class FilesImporter { private filesPath; private conn; private commandThis; private dtl; private exportedFilesFolder; private handleOverwrite; private logFile; private totalFolders; private totalFiles; private filesUploaded; private filesOverwritten; private filesErrors; private filesSkipped; private apiLimitsManager; constructor(filesPath: string, conn: Connection, options: { exportConfig?: any; handleOverwrite?: boolean; }, commandThis: any); private initializeCsvLog; private extractFileInfo; private writeCsvLogEntry; processImport(): Promise<{ stats: { filesUploaded: number; filesOverwritten: number; filesErrors: number; filesSkipped: number; totalFolders: number; totalFiles: number; restApiUsedBefore: number; restApiUsedAfter: number; restApiLimit: number; restApiCallsRemaining: number; bulkApiUsedBefore: number; bulkApiUsedAfter: number; bulkApiLimit: number; bulkApiCallsRemaining: number; }; logFile: string; }>; private buildResult; private calculateApiConsumption; } export declare function selectFilesWorkspace(opts?: { selectFilesLabel: string; }): Promise<any>; export declare function getFilesWorkspaceDetail(filesWorkspace: string): Promise<{ full_label: string; name: string; label: any; description: any; soqlQuery: any; fileTypes: any; outputFolderNameField: any; outputFileNameFormat: any; overwriteParentRecords: any; overwriteFiles: any; fileSizeMin: any; } | null>; export declare function promptFilesExportConfiguration(filesExportConfig: any, override?: boolean): Promise<any>; export declare function countLinesInFile(file: string): Promise<unknown>; /** * @description This function generates a report path for a given file name prefix. * It retrieves the report directory and the current branch name. * If the branch name is not available in the environment variable CI_COMMIT_REF_NAME, it tries to get the current git branch. * If both are not available, it uses the string "Missing CI_COMMIT_REF_NAME variable". * It then joins the report directory, file name prefix, and branch name to form the full path of the report. * * @param {string} fileNamePrefix - The prefix for the file name. * @param {string} outputFile - The output file path. If null, a new path is generated. * @param {Object} [options] - Additional options for generating the report path. * @param {boolean} [options.withDate=false] - Whether to append a timestamp to the file name. * @param {boolean} [options.withBranchName=true] - Whether to include the branch name in the file name. * @param {string} [options.fileExtension='csv'] - The file extension to use for the report file. * @param {string} [options.fileNamePartsSeparator='-'] - The separator to use between file name parts. * @returns {Promise<string>} - A Promise that resolves to the full path of the report. */ export declare function generateReportPath(fileNamePrefix: string, outputFile: string, options?: { withDate?: boolean; withBranchName?: boolean; fileExtension?: string; fileNamePartsSeparator?: string; }): Promise<string>; /** * @description This function generates a CSV file from the provided data and writes it to the specified output path. * If the operation is successful, it logs a message and requests to open the file. * If an error occurs during the operation, it logs the error message and stack trace. * * @param {any[]} data - The data to be written to the CSV file. * @param {string} outputPath - The path where the CSV file will be written. * @returns {Promise<void>} - A Promise that resolves when the operation is complete. */ export interface ExcelColumnStyle { wrap?: boolean; width?: number; hyperlinkFromValue?: boolean; maxHeight?: number; } export interface ExcelExportOptions { fileTitle?: string; csvFileTitle?: string; xlsFileTitle?: string; noExcel?: boolean; columnsCustomStyles?: Record<string, ExcelColumnStyle>; skipNotifyToWebSocket?: boolean; } export declare function generateCsvFile(data: any[], outputPath: string, options?: ExcelExportOptions): Promise<any>; export declare function createXlsxFromCsv(outputPath: string, options: ExcelExportOptions, result: any): Promise<void>; export declare function createXlsxFromCsvFiles(csvFilesPath: string[], outputPath: string, options?: ExcelExportOptions): Promise<void>;