import { ProtoFailure } from '../failure';
import { PayloadConverter } from './payload-converter';
/**
 * Cuts out the framework part of a stack trace, leaving only user code entries
 */
export declare function cutoffStackTrace(stack?: string): string;
/**
 * A `FailureConverter` is responsible for converting from proto `Failure` instances to JS `Errors` and back.
 *
 * We recommended using the {@link DefaultFailureConverter} instead of customizing the default implementation in order
 * to maintain cross-language Failure serialization compatibility.
 */
export interface FailureConverter {
    /**
     * Converts a caught error to a Failure proto message.
     */
    errorToFailure(err: unknown, payloadConverter: PayloadConverter): ProtoFailure;
    /**
     * Converts a Failure proto message to a JS Error object.
     *
     * The returned error must be an instance of `TemporalFailure`.
     */
    failureToError(err: ProtoFailure, payloadConverter: PayloadConverter): Error;
}
/**
 * The "shape" of the attributes set as the {@link ProtoFailure.encodedAttributes} payload in case
 * {@link DefaultEncodedFailureAttributes.encodeCommonAttributes} is set to `true`.
 */
export interface DefaultEncodedFailureAttributes {
    message: string;
    stack_trace: string;
}
/**
 * Options for the {@link DefaultFailureConverter} constructor.
 */
export interface DefaultFailureConverterOptions {
    /**
     * Whether to encode error messages and stack traces (for encrypting these attributes use a {@link PayloadCodec}).
     */
    encodeCommonAttributes: boolean;
}
/**
 * Default, cross-language-compatible Failure converter.
 *
 * By default, it will leave error messages and stack traces as plain text. In order to encrypt them, set
 * `encodeCommonAttributes` to `true` in the constructor options and use a {@link PayloadCodec} that can encrypt /
 * decrypt Payloads in your {@link WorkerOptions.dataConverter | Worker} and
 * {@link ClientOptions.dataConverter | Client options}.
 */
export declare class DefaultFailureConverter implements FailureConverter {
    readonly options: DefaultFailureConverterOptions;
    constructor(options?: Partial<DefaultFailureConverterOptions>);
    /**
     * Converts a Failure proto message to a JS Error object.
     *
     * Does not set common properties, that is done in {@link failureToError}.
     */
    failureToErrorInner(failure: ProtoFailure, payloadConverter: PayloadConverter): Error;
    failureToError(failure: ProtoFailure, payloadConverter: PayloadConverter): Error;
    errorToFailure(err: unknown, payloadConverter: PayloadConverter): ProtoFailure;
    errorToFailureInner(err: unknown, payloadConverter: PayloadConverter): ProtoFailure;
    /**
     * Converts a Failure proto message to a JS Error object if defined or returns undefined.
     */
    optionalFailureToOptionalError(failure: ProtoFailure | undefined | null, payloadConverter: PayloadConverter): Error | undefined;
    /**
     * Converts an error to a Failure proto message if defined or returns undefined
     */
    optionalErrorToOptionalFailure(err: unknown, payloadConverter: PayloadConverter): ProtoFailure | undefined;
    private nexusFailureToTemporalFailure;
    private temporalFailureToNexusFailure;
}
