UNPKG

@capgo/cli

Version:
49 lines (48 loc) • 2.73 kB
import type { UploadBundleResult } from '../schemas/bundle'; import type { UploadReporter, UploadSpinner } from './reporter'; import type { OptionsUpload } from './upload_interface'; import { CliUserError } from '../shared/cli-user-error'; export type { UploadBundleResult }; export type { UploadReporter, UploadSpinner }; /** * Thrown when `--fail-on-incompatible` aborts an upload because the bundle is * incompatible with the channel's current native packages. A dedicated type lets * `uploadBundle` skip the generic "retry the upload?" prompt — retrying an * incompatible bundle is pointless. * * Extends `CliUserError` so `shouldCapturePosthogException` skips it: the * `--fail-on-incompatible` abort is a state the user asked for, not a crash, so * it must not open an error tracking `$exception` issue. The non-zero exit, the * printed message, and the `Bundle Upload Blocked` event stay unchanged. */ export declare class IncompatibleBundleError extends CliUserError { } /** Upload details reported once on `App Uploaded` instead of one event per upload step. */ export interface UploadTelemetry { encryption: 'none' | 'v1' | 'v2'; uploadMethod?: 'tus' | 'http' | 's3' | 'external' | 'dry-run'; uploadSeconds?: number; deltaFiles?: number; deltaBrotliFiles?: number; deltaUploadSeconds?: number; } /** * Encryption reported on `App Uploaded`. External bundles skip local preparation, * so an IV session key is the only sign that the caller encrypted them. */ export declare function uploadedEncryption(options: Pick<OptionsUpload, 'external' | 'ivSessionKey' | 'oldEncryption'>, preparedEncryption: UploadTelemetry['encryption']): UploadTelemetry['encryption']; /** Event properties (not person properties) describing how a bundle was uploaded. */ export declare function appUploadedTelemetryTags(telemetry: UploadTelemetry): Record<string, string | number | boolean>; export declare function getDefaultUploadChannel(appId: string, apikey: string, hostWeb: string, httpOptions?: { apiHost?: string; }): Promise<string>; export declare function uploadBundleInternal(preAppid: string, options: OptionsUpload, silent?: boolean, reporter?: UploadReporter): Promise<UploadBundleResult>; /** * Validate mutually-exclusive and dependent upload options, failing fast (via * `uploadFail`) before any network call. Exported so the option-conflict guards * (e.g. `--fail-on-incompatible` + `--ignore-metadata-check`, or * `--accept-incompatible` + `--fail-on-incompatible`) can be unit-tested * directly. */ export declare function checkValidOptions(options: OptionsUpload): void; export declare function uploadBundle(appid: string, options: OptionsUpload): Promise<UploadBundleResult>;