import { IActivityContext, Abortable } from "../../IActivityHandler";
import { Task } from "../../Task";
/**
 * A promise that can be cancelled.
 */
export interface Cancellable {
    cancel(): void;
}
export declare function isAbortable(task: Task<any> | (Task<any> & Abortable)): boolean;
/**
 * Returns true if the supplied promise has a `cancel()` method, false otherwise.
 * @param promise A promise to check if it supports cancellation.
 */
export declare function isCancellable(promise: PromiseLike<any>): promise is PromiseLike<any> & Cancellable;
/**
 * Schedules the cancellation of the supplied promise for when the activity's cancellation token is resolved.
 * This does not do anything if the cancellation token contains an `AbortSignal` as we assume in such cases
 * we're passing that to the Esri API for cancellation.
 * Also, if the promise does not support cancellation, it is not cancelled.
 * @param context The context of an activity being executed.
 * @param promise A promise to be cancelled when the workflow is cancelled.
 */
export declare function schedulePromiseCancellation(context: IActivityContext, promise: PromiseLike<any>): void;
/**
 * Calls the given `fulfilledCallback` function if the promise has already been fulfilled.
 * Calls the given `rejectedCallback` function if the promise has already been rejected.
 * Otherwise, attaches the supplied callbacks to the promise.
 * @param value The promise to be inspected.
 * @param fulfilledCallback The function to call when the promise is fulfilled.
 * @param rejectedCallback The function to call when the promise is rejected.
 * */
export declare function inline<T, TResult>(value: PromiseLike<T> | T, fulfilledCallback: (result: T) => PromiseLike<TResult> | TResult, rejectedCallback?: (error: any) => PromiseLike<TResult> | TResult): PromiseLike<TResult> | TResult;
export declare function addToPath(url: string, pathSuffix: string): string;
export interface ExtentLike extends __esri.Geometry {
    xmin?: number;
    xmax?: number;
    ymin?: number;
    ymax?: number;
}
/**
 * Turns an extent into a polygon with the same perimeter and spatial reference. If the input is not an extent, it is returned unchanged.
 * @param geom The geometry whose extent will be rendered into a polygon.
 */
export declare function polygonFromExtent(geometry: __esri.Geometry, type: typeof __esri.Polygon): __esri.Geometry;
export declare function fetch(url: string, query: {}, timeout: number, signal?: AbortSignal): PromiseLike<{}>;
export declare function post(url: string, query: {}, timeout: number, signal?: AbortSignal): PromiseLike<{}>;
export declare function isFeatureSet(fs: (Partial<__esri.FeatureSet> & Partial<__esri.Graphic>) | any[]): fs is __esri.FeatureSet;
export declare function featuresToArray(fs: __esri.Graphic | __esri.FeatureSet | __esri.Graphic[]): esri.Graphic[];
export declare function extentOf(array: __esri.Geometry[]): __esri.Extent;
/**
 * Converts a well known unit to its corresponding esri type.
 * This is strictly only needed for 3.x as 4.x accepts the names and performs
 * this same conversion itself.
 *
 * The full list of accepted units is contained in the following two pages:
 * http://resources.arcgis.com/en/help/arcobjects-cpp/componenthelp/index.html#/esriSRUnitType_Constants/000w00000042000000/
 * http://resources.arcgis.com/en/help/arcobjects-cpp/componenthelp/index.html#/esriSRUnit2Type_Constants/000w00000041000000/
 */
export declare function toEsriUnit(unit: string): string;
