UNPKG

2.12 kBTypeScriptView Raw
1import { Goal, GoalDefinition } from "./Goal";
2/**
3 * Represents goals set in response to a push
4 */
5export declare class Goals {
6 name: string;
7 readonly goals: Goal[];
8 /**
9 * Return a Goal set that contains these goals and one more goal,
10 * with an appropriate name
11 * @param {Goal} g goal to add
12 * @return {Goals}
13 */
14 and(g: Goal): Goals;
15 /**
16 * Return a form of these goals that is locked, so that more goals cannot be
17 * added through contribution model
18 * @return {Goals}
19 */
20 andLock(): Goals;
21 constructor(name: string, ...goals: Goal[]);
22}
23export declare function isGoals(a: any): a is Goals;
24/**
25 * Builder to build Goals instances.
26 */
27export interface GoalsBuilder {
28 /**
29 * Plan the given goal or goals to this Goals instance.
30 * @param {GoalDefinition | Goal | Goals} goals
31 * @returns {Goals & GoalsAndPreConditionBuilder}
32 */
33 plan(...goals: Array<GoalDefinition | Goal | Goals>): Goals & GoalsAndPreConditionBuilder;
34}
35/**
36 * Extension to GoalsBuilder allowing to add preConditions.
37 */
38export interface GoalsAndPreConditionBuilder extends GoalsBuilder {
39 /**
40 * Add preCondition(s) to previously planned goal or goals.
41 * Note:
42 * This only will affect the goal or goals that were planned immediately
43 * before calling `after`.
44 * Only call this once; an additional call will remove other preconditions
45 * that may have existed on the original goal.
46 * @param {Goal} goals
47 * @returns {Goals & GoalsBuilder}
48 */
49 after(...goals: Array<Goals | GoalDefinition | Goal>): Goals & GoalsBuilder;
50}
51/**
52 * Create Goals instance using a fluent API.
53 *
54 * const simpleGoals = goals("Simple Goals")
55 * .plan(CodeInspectionGoal)
56 * .plan(BuildGoal, Autofix).after(CodeInspectionGoal)
57 * .plan(StagingEndpointGoal).after(BuildGoal)
58 * .plan(ProductionDeploymentGoal).after(BuildGoal, StagingEndpointGoal);
59 *
60 * @param {string} name
61 * @returns {Goals & GoalsBuilder}
62 */
63export declare function goals(name: string): Goals & GoalsBuilder;
64//# sourceMappingURL=Goals.d.ts.map
\No newline at end of file