import { RawSourceMap } from 'source-map'; import { SymbolUploaderOptions, UploadResult } from '../SymbolUploader'; import { Asset, AssetWithContent } from '../models/Asset'; import { ProcessAssetError, ProcessAssetResult } from '../models/ProcessAssetResult'; import { Result } from '../models/Result'; interface BacktracePluginUploadOptions { /** * By default, `sourcesContent` in sourcemaps will not be uploaded to Backtrace, even if available in the sourcemap. * Set this to `true` to upload sourcemaps with `sourcesContent` if available. */ readonly includeSources: boolean; } /** * Determines what happens when an individual asset fails to process. * * - `'exit'` — abort the entire process and upload (default). * - `'skip'` — silently skip the failed asset; successfully processed assets are still uploaded. * - `'warn'` — log the failure via the `assetError` callback and continue uploading the rest. */ export type AssetErrorBehavior = 'exit' | 'skip' | 'warn'; export interface BacktracePluginOptions { /** * Upload URL for uploading sourcemap files. * See Source Maps Integration Guide for your instance for more information. * * If not set, the sourcemaps will not be uploaded. The sources will be still processed and ready for manual upload. */ readonly uploadUrl?: string | URL; /** * Additional upload options. */ readonly uploadOptions?: SymbolUploaderOptions & BacktracePluginUploadOptions; /** * What to do when an individual asset fails to process (e.g. a missing sourcemap file). * * - `'warn'` — report the failure via the `assetError` callback and continue uploading the rest. (default) * - `'skip'` — silently skip the failed asset. Successfully processed assets are still uploaded. * - `'exit'` — abort the entire process and upload. No sourcemaps will be uploaded. * * @default 'warn' */ readonly assetErrorBehavior?: AssetErrorBehavior; } interface ProcessResult { readonly assetResults: Result[]; readonly uploadResult?: Result; } export interface ProcessAndUploadAssetsCommandOptions { beforeAll?(assets: Asset[]): unknown; afterAll?(result: ProcessResult): unknown; beforeProcess?(asset: Asset): unknown; afterProcess?(asset: ProcessAssetResult): unknown; beforeWrite?(asset: ProcessAssetResult): unknown; afterWrite?(asset: ProcessAssetResult): unknown; assetFinished?(asset: ProcessAssetResult): unknown; beforeLoad?(asset: Asset): unknown; afterLoad?(asset: AssetWithContent): unknown; beforeUpload?(assets: AssetWithContent[]): unknown; afterUpload?(result: UploadResult): unknown; assetError?(error: ProcessAssetError): unknown; assetSkipped?(error: ProcessAssetError): unknown; processingSummary?(message: string): unknown; uploadError?(error: string): unknown; } export declare function processAndUploadAssetsCommand(pluginOptions: BacktracePluginOptions, options?: ProcessAndUploadAssetsCommandOptions): (assets: Asset[]) => Promise; export {};