@atomist/sdm
Version:
Atomist Software Delivery Machine SDK
57 lines • 2.29 kB
TypeScript
import { GitProject } from "@atomist/automation-client/lib/project/git/GitProject";
import { ProgressLog } from "../../spi/log/ProgressLog";
import { RepoContext } from "../context/SdmContext";
import { SoftwareDeliveryMachineConfiguration } from "../machine/SoftwareDeliveryMachineOptions";
import { PushTest } from "../mapping/PushTest";
import { ExecuteGoalResult } from "./ExecuteGoalResult";
import { Goal } from "./Goal";
import { Parameterized } from "./GoalWithFulfillment";
import { SdmGoalEvent } from "./SdmGoalEvent";
/**
* Type of all goal invocation functions. This is a key extension
* point for SDMs.
*/
export declare type ExecuteGoal = (r: GoalInvocation) => Promise<void | ExecuteGoalResult>;
export declare type PrepareForGoalExecution = (p: GitProject, r: GoalInvocation) => Promise<void | ExecuteGoalResult>;
export declare enum GoalProjectListenerEvent {
before = "before",
after = "after"
}
export declare type GoalProjectListener = (p: GitProject, r: GoalInvocation, event: GoalProjectListenerEvent) => Promise<void | ExecuteGoalResult>;
export interface GoalProjectListenerRegistration {
name: string;
listener: GoalProjectListener;
pushTest?: PushTest;
events?: GoalProjectListenerEvent[];
}
export interface GoalInvocation extends RepoContext, Parameterized {
/**
* This SDM's current configuration
*/
configuration: SoftwareDeliveryMachineConfiguration;
/**
* The goal that we are currently executing
*/
goal: Goal;
/**
* The goal event that triggered this execution
*/
goalEvent: SdmGoalEvent;
/**
* Progress log to write output to
*
* Use this to write user-level log messages that you want to see in the log stream
*/
progressLog: ProgressLog;
}
/**
* Convenience function that takes a PrepareForGoalExecution and invokes it for after goal project events.
* @param listener
*/
export declare function afterListener(listener: PrepareForGoalExecution): GoalProjectListener;
/**
* Convenience function that takes a PrepareForGoalExecution and invokes it for before goal project events.
* @param listener
*/
export declare function beforeListener(listener: PrepareForGoalExecution): GoalProjectListener;
//# sourceMappingURL=GoalInvocation.d.ts.map