UNPKG

@capgo/cli

Version:
43 lines (42 loc) • 2.63 kB
import type { manifestType } from '../utils'; import type { OptionsUpload } from './upload_interface'; import { Buffer } from 'node:buffer'; import { CliUserError } from '../shared/cli-user-error'; import type { ManifestUploadRequestEntry, ResolvedManifestUpload, ResolvedManifestUploadEntry } from './manifest-upload'; import type { ManifestPayloadCache } from './manifest-payload-cache'; /** * Fallback existence check for servers that answer `upload_if_doesnt_exist` * instead of deciding `reuse` themselves. Uses HEAD (metadata only) and falls * back to GET only when HEAD is not supported or carries no size receipt. */ export declare function fileExistsAtUploadTarget(existenceCheckUrlPrefix: string, filename: string): Promise<{ exists: boolean; receipt?: string; }>; /** * Build the delta manifest (per-file sha256, optionally signed with the v2 key). * Local only: shared by the online delta upload and the offline `bundle zip --delta-pack`. */ export declare function generateDeltaManifest(path: string, encryptionMethod: 'none' | 'v2' | 'v1', finalKeyData: string, supportsHexChecksum?: boolean): Promise<manifestType>; export interface PartialEncryptionOptions { sessionKey: Buffer; ivSessionKey: string; } export declare class PartialUploadValidationError extends CliUserError { constructor(message: string); } export declare function prepareManifestUploadEntries(manifest: manifestType, path: string, encryptionOptions: PartialEncryptionOptions | undefined, options: OptionsUpload, /** Receives the exact bytes the delta upload would send for each entry, in manifest order (used by the offline delta pack). */ onPayload?: (entry: ManifestUploadRequestEntry, uploadedBytes: Buffer) => void | Promise<void>, /** Keeps the prepared bytes on disk so `uploadPartial` does not compress and encrypt them again. */ payloadCache?: ManifestPayloadCache): Promise<ManifestUploadRequestEntry[]>; export declare function buildPartialUploadHeaders(manifestUploadEntry: ResolvedManifestUploadEntry): Record<string, string>; export declare function uploadPartial(apikey: string, manifest: manifestType, path: string, appId: string, orgId: string, encryptionOptions: PartialEncryptionOptions | undefined, options: OptionsUpload, manifestUpload: ResolvedManifestUpload, /** Bytes prepared by `prepareManifestUploadEntries`; entries missing from it are prepared again. */ payloadCache?: ManifestPayloadCache, /** Filled with delta upload details that `App Uploaded` reports. */ telemetry?: { deltaFiles?: number; deltaBrotliFiles?: number; deltaUploadSeconds?: number; }): Promise<any[] | null>;