@atomist/automation-client
Version:
Atomist API for software low-level client
31 lines • 1.58 kB
TypeScript
import { ActionResult } from "../../action/ActionResult";
import { HandlerContext } from "../../HandlerContext";
import { Project } from "../../project/Project";
import { EditMode } from "./editModes";
/**
* Modifies the given project, returning information about the modification.
* @param p project to edit
* @param context context for the current command or event handler
* @param params params, if available
*/
export declare type ProjectEditor<P = any, ER extends EditResult = EditResult> = (p: Project, context?: HandlerContext, params?: P) => Promise<ER>;
export declare type SimpleProjectEditor<P = any> = (p: Project, context?: HandlerContext, params?: P) => Promise<Project>;
export declare type AnyProjectEditor<P = any> = ProjectEditor<P> | SimpleProjectEditor<P>;
/**
* Result of editing a project. More information may be added by instances.
*/
export interface EditResult<P extends Project = Project> extends ActionResult<P> {
/**
* Whether or not this project was edited.
* Undefined if we don't know, as not all editors keep track of their doings.
*/
readonly edited?: boolean;
/**
* Populated only if editing was successful
*/
readonly editMode?: EditMode;
}
export declare function toEditor<P = any>(ed: (SimpleProjectEditor<P> | ProjectEditor<P>)): ProjectEditor<P>;
export declare function successfulEdit<P extends Project>(p: P, edited: boolean): EditResult<P>;
export declare function failedEdit<P extends Project>(p: P, error: Error, edited?: boolean): EditResult<P>;
//# sourceMappingURL=projectEditor.d.ts.map