UNPKG

netstorage

Version:

A TypeScript API and CLI for the Akamai NetStorage REST interface

44 lines (43 loc) 3.08 kB
import { type NetStorageStat, type NetStorageFile, type TransferPermissionInput, type ShouldTransferFileInput, type DeleteExtraneousFilesParams, type FormatSyncDirectionLogInput, type ResolveConflictActionInput, type SyncSingleEntryParams } from '../index'; /** * Determines whether a file transfer is permitted based on strategy and conflict settings. * @param input - Transfer permission parameters including strategy, direction, action, and conflict resolution * @returns True if the transfer is permitted, false otherwise */ export declare function isTransferAllowed({ compareStrategy, direction, action, conflictResolution, }: TransferPermissionInput): boolean; /** * Wraps a NetStorageFile object into a NetStorageStat structure for compatibility. * @param file - Remote file metadata from NetStorage * @returns A NetStorageStat-compliant object */ export declare function toNetStorageStat(file?: NetStorageFile): NetStorageStat; /** * Evaluates whether a file should be transferred based on the configured comparison strategy. * @param input - Object containing paths, strategy, direction, and remote metadata * @returns Promise resolving to true if transfer is needed, false otherwise */ export declare function shouldTransferFile({ config, direction, localAbsPath, remoteFile, compareStrategy, }: ShouldTransferFileInput): Promise<boolean>; /** * Resolves how to handle file conflicts using the specified conflict rules. * @param input - Relative path and optional conflict rules mapping * @returns The resolved action ('upload', 'download', 'skip') or undefined */ export declare function resolveConflictAction({ relativePath, conflictRules, }: ResolveConflictActionInput): 'upload' | 'download' | 'skip' | undefined; /** * Generates a human-readable string describing a file sync direction. * @param input - Object containing local/remote paths and sync direction * @returns A formatted log string representing the sync operation */ export declare function formatSyncDirectionLog({ localPath, remotePath, syncDirection, }: FormatSyncDirectionLogInput): string; /** * Synchronizes a single file entry based on direction, comparison strategy, and conflict rules. * Handles dry-run mode and emits transfer/skip events as appropriate. * @param params - Sync configuration and callbacks for a single file */ export declare function syncSingleEntry({ config, direction, localPath, remotePath, remoteFileMeta, dryRun, compareStrategy, conflictRules, conflictResolution, onTransfer, onSkip, }: SyncSingleEntryParams): Promise<void>; /** * Removes files and directories that are no longer present on the opposite side of sync. * Can optionally perform dry-run and emit deletion events. Handles both local and remote clean-up. * @param params - Configuration including paths, maps of files and directories, and control flags */ export declare function deleteExtraneous({ config, deleteExtraneous, dryRun, localPath, remotePath, localFiles, remoteFiles, onDelete, singleFile, localDirs, remoteDirs, }: DeleteExtraneousFilesParams): Promise<void>;