UNPKG

2.65 kBTypeScriptView Raw
1import { SdmContext } from "../context/SdmContext";
2import { GoalContribution } from "../dsl/goalContribution";
3import { Goals } from "../goal/Goals";
4import { GoalImplementationMapper } from "../goal/support/GoalImplementationMapper";
5import { PushListenerInvocation } from "../listener/PushListener";
6import { GoalSetter } from "../mapping/GoalSetter";
7import { PushMapping } from "../mapping/PushMapping";
8import { GoalApprovalRequestVoteDecisionManager, GoalApprovalRequestVoter } from "../registration/goalApprovalRequestVote";
9import { MachineConfiguration } from "./MachineConfiguration";
10import { SoftwareDeliveryMachineConfiguration } from "./SoftwareDeliveryMachineOptions";
11/**
12 * Interface for machines driven by configurable goals.
13 * Goals and goal "implementations" can be defined by users.
14 */
15export interface GoalDrivenMachine<O extends SoftwareDeliveryMachineConfiguration> extends MachineConfiguration<O> {
16 /**
17 * Return the PushMapping that will be used on pushes.
18 * Useful in testing goal setting.
19 * @return {PushMapping<Goals>}
20 */
21 pushMapping: PushMapping<Goals>;
22 readonly goalFulfillmentMapper: GoalImplementationMapper;
23 /**
24 * (hint: prefer `withPushRules`)
25 *
26 * Add goal setting contributions that will be added into SDM goal setting.
27 * Decorates other goal setting behavior.
28 *
29 * For example, always do fingerprints:
30 * sdm.addGoalContributions(onAnyPush().setGoals(FingerprintGoal))
31 *
32 * Or, sometimes do a custom local deploy goal:
33 * sdm.addGoalContributions(
34 * whenPushSatisfies(IsSdm, IsInLocalMode).setGoals(
35 * new Goals("delivery", LocalSdmDelivery)));
36 *
37 * @param goalContributions contributions to goals
38 */
39 addGoalContributions(goalContributions: GoalSetter): this;
40 /**
41 * Add to the list of things an SDM
42 * can do on a push.
43 *
44 * @param contributor contributor to set
45 * @param contributors additional contributors
46 */
47 withPushRules<F extends SdmContext = PushListenerInvocation>(contributor: GoalContribution<F>, ...contributors: Array<GoalContribution<F>>): this;
48 /**
49 * Add vote that gets to decide whether to deny or grant goal approval requests.
50 * @param vote
51 */
52 addGoalApprovalRequestVoter(vote: GoalApprovalRequestVoter): this;
53 /**
54 * Set the decision manager used to make final decision on GoalApprovalRequestVoteResult instances.
55 * @param manager
56 */
57 setGoalApprovalRequestVoteDecisionManager(manager: GoalApprovalRequestVoteDecisionManager): this;
58}
59//# sourceMappingURL=GoalDrivenMachine.d.ts.map
\No newline at end of file