@airplane/views
Version:
A React library for building Airplane views. Views components are optimized in style and functionality to produce internal apps that are easy to build and maintain.
20 lines (19 loc) • 1.35 kB
TypeScript
import type { ParamValues } from "airplane/api";
import type { ExecuteError } from "../components/query";
export type ExecuteTaskSuccess<TOutput = Record<string, unknown>> = {
output: TOutput;
runID: string;
};
export type ExecuteTaskError<TOutput = Record<string, unknown>> = {
output?: TOutput;
error: ExecuteError;
runID?: string;
};
export type ExecuteTaskResult<TOutput = Record<string, unknown>> = ExecuteTaskSuccess<TOutput> | ExecuteTaskError<TOutput>;
export { ParamValues };
export type DefaultParams = Record<string, any>;
export type DefaultOutput = any;
export declare const executeTask: <TParams extends ParamValues | undefined = ParamValues, TOutput = Record<string, unknown>>(slug: string, executeType: "query" | "mutation", params?: TParams | undefined, runID?: string, allowCachedMaxAge?: number) => Promise<ExecuteTaskResult<TOutput>>;
/** Execute the task but don't want for the run to complete. */
export declare const executeTaskBackground: <TParams extends ParamValues | undefined = ParamValues, TOutput = Record<string, unknown>>(slug: string, executeType: "query" | "mutation", params?: TParams | undefined, allowCachedMaxAge?: number) => Promise<string | ExecuteTaskError<TOutput>>;
export declare function isExecuteTaskError<TOutput>(value: ExecuteTaskResult<TOutput>): value is ExecuteTaskError<TOutput>;