UNPKG

2.29 kBTypeScriptView Raw
1import { GitProject } from "@atomist/automation-client/lib/project/git/GitProject";
2import { ProgressLog } from "../../spi/log/ProgressLog";
3import { RepoContext } from "../context/SdmContext";
4import { SoftwareDeliveryMachineConfiguration } from "../machine/SoftwareDeliveryMachineOptions";
5import { PushTest } from "../mapping/PushTest";
6import { ExecuteGoalResult } from "./ExecuteGoalResult";
7import { Goal } from "./Goal";
8import { Parameterized } from "./GoalWithFulfillment";
9import { SdmGoalEvent } from "./SdmGoalEvent";
10/**
11 * Type of all goal invocation functions. This is a key extension
12 * point for SDMs.
13 */
14export declare type ExecuteGoal = (r: GoalInvocation) => Promise<void | ExecuteGoalResult>;
15export declare type PrepareForGoalExecution = (p: GitProject, r: GoalInvocation) => Promise<void | ExecuteGoalResult>;
16export declare enum GoalProjectListenerEvent {
17 before = "before",
18 after = "after"
19}
20export declare type GoalProjectListener = (p: GitProject, r: GoalInvocation, event: GoalProjectListenerEvent) => Promise<void | ExecuteGoalResult>;
21export interface GoalProjectListenerRegistration {
22 name: string;
23 listener: GoalProjectListener;
24 pushTest?: PushTest;
25 events?: GoalProjectListenerEvent[];
26}
27export interface GoalInvocation extends RepoContext, Parameterized {
28 /**
29 * This SDM's current configuration
30 */
31 configuration: SoftwareDeliveryMachineConfiguration;
32 /**
33 * The goal that we are currently executing
34 */
35 goal: Goal;
36 /**
37 * The goal event that triggered this execution
38 */
39 goalEvent: SdmGoalEvent;
40 /**
41 * Progress log to write output to
42 *
43 * Use this to write user-level log messages that you want to see in the log stream
44 */
45 progressLog: ProgressLog;
46}
47/**
48 * Convenience function that takes a PrepareForGoalExecution and invokes it for after goal project events.
49 * @param listener
50 */
51export declare function afterListener(listener: PrepareForGoalExecution): GoalProjectListener;
52/**
53 * Convenience function that takes a PrepareForGoalExecution and invokes it for before goal project events.
54 * @param listener
55 */
56export declare function beforeListener(listener: PrepareForGoalExecution): GoalProjectListener;
57//# sourceMappingURL=GoalInvocation.d.ts.map
\No newline at end of file