@atomist/sdm
Version:
Atomist Software Delivery Machine SDK
65 lines • 2.71 kB
TypeScript
import { InterpretLog } from "../../../spi/log/InterpretedLog";
import { RepoContext } from "../../context/SdmContext";
import { PushListenerInvocation } from "../../listener/PushListener";
import { PushTest } from "../../mapping/PushTest";
import { Goal } from "../Goal";
import { ExecuteGoal, GoalProjectListenerRegistration } from "../GoalInvocation";
import { PlannedGoal } from "../GoalWithFulfillment";
import { ReportProgress } from "../progress/ReportProgress";
import { SdmGoalEvent } from "../SdmGoalEvent";
export declare type GoalFulfillment = GoalImplementation | GoalSideEffect;
export interface GoalImplementation {
implementationName: string;
goal: Goal;
goalExecutor: ExecuteGoal;
pushTest: PushTest;
logInterpreter: InterpretLog;
progressReporter?: ReportProgress;
projectListeners: GoalProjectListenerRegistration | GoalProjectListenerRegistration[];
}
export declare function isGoalImplementation(f: GoalFulfillment): f is GoalImplementation;
/** Information needed to create a goal side effect. */
export interface GoalSideEffect {
/** Name of goal side effect. It should be unique. */
sideEffectName: string;
/** Goal on which to associated the side effect. */
goal: Goal;
/**
* Push test that when true the side effect will be triggered. If
* not provided, [[AnyPush]] is used.
*/
pushTest?: PushTest;
/**
* Name of SDM executing side effect. If not provided, the
* current SDM registration name will be used.
*/
registration?: string;
}
export declare function isGoalSideEffect(f: GoalFulfillment): f is GoalSideEffect;
export declare function isGoalFulfillment(g: {
fulfillment?: PlannedGoal["fulfillment"];
}): g is {
fulfillment: PlannedGoal["fulfillment"];
};
/**
* Callback to allow changes to the goal before it gets fullfilled.
*
* This is useful to add goal specific information to the data field.
*/
export interface GoalFulfillmentCallback {
goal: Goal;
callback: (goal: SdmGoalEvent, context: RepoContext) => Promise<SdmGoalEvent>;
}
/**
* Registers and looks up goal implementations
*/
export interface GoalImplementationMapper {
hasImplementation(): boolean;
addSideEffect(sideEffect: GoalSideEffect): this;
addFulfillmentCallback(callback: GoalFulfillmentCallback): this;
findImplementationBySdmGoal(goal: SdmGoalEvent): GoalImplementation;
findFulfillmentByPush(goal: Goal, inv: PushListenerInvocation): Promise<GoalFulfillment | undefined>;
findFulfillmentCallbackForGoal(g: SdmGoalEvent): GoalFulfillmentCallback[];
findGoalBySdmGoal(g: SdmGoalEvent): Goal | undefined;
}
//# sourceMappingURL=GoalImplementationMapper.d.ts.map