@capgo/cli
Version:
A CLI to upload to capgo servers
46 lines (45 loc) • 2.06 kB
TypeScript
import type { ManifestUploadFileHashFormat, ManifestUploadRequestEntry } from './manifest-upload';
import type { OptionsUpload } from './upload_interface';
import { Buffer } from 'node:buffer';
import { MANIFEST_UPLOAD_PROTOCOL_VERSION } from './manifest-upload';
/**
* Offline "delta pack": the exact per-file bytes the online delta upload
* (`bundle upload --delta`) would send, plus the manifest request entries it
* would post, so an agent can upload them through signed URLs.
*
* Layout (ZIP, STORE / no compression):
* - `capgo-delta-manifest.json` (see DeltaPackManifest)
* - `files/<id>`: uploaded bytes for entry `id` (brotli and/or encrypted exactly as uploaded)
*/
export declare const DELTA_PACK_MANIFEST_FILE = "capgo-delta-manifest.json";
export interface DeltaPackEntry extends ManifestUploadRequestEntry {
/** Path of the uploaded bytes inside the pack. */
pack_path: string;
}
export interface DeltaPackManifest {
protocol_version: typeof MANIFEST_UPLOAD_PROTOCOL_VERSION;
file_hash_format: ManifestUploadFileHashFormat;
delta_encryption: {
enabled: boolean;
};
/** `compression` is 'none' | 'brotli' (backend manifest upload protocol values; brotli entries end in `.br`). */
entries: DeltaPackEntry[];
}
export interface DeltaPackResult {
filename: string;
manifest: DeltaPackManifest;
}
export interface DeltaPackBundleInput {
encryptionMethod: 'none' | 'v2' | 'v1';
finalKeyData: string;
sessionKey?: Buffer;
ivSessionKey?: string;
}
/**
* Build the delta pack with the same steps as the online delta upload:
* delta encryption settings, manifest generation, then entry preparation
* (skip rules, brotli rules, encryption, validation, MAX_MANIFEST_ENTRIES).
* `options` must be the upload-shaped options (with `delta: true`); it is
* mutated the same way `bundle upload` mutates it (encryptDelta folding).
*/
export declare function writeDeltaPack(filename: string, path: string, bundle: DeltaPackBundleInput, options: OptionsUpload): Promise<DeltaPackResult>;