1 | import { RetryOptions } from "@atomist/automation-client/lib/util/retry";
|
2 | import { InterpretLog } from "../../spi/log/InterpretedLog";
|
3 | import { DefaultFacts, StatefulPushListenerInvocation } from "../dsl/goalContribution";
|
4 | import { GoalExecutionListener } from "../listener/GoalStatusListener";
|
5 | import { Registerable } from "../machine/Registerable";
|
6 | import { SoftwareDeliveryMachine } from "../machine/SoftwareDeliveryMachine";
|
7 | import { PushTest } from "../mapping/PushTest";
|
8 | import { ServiceRegistration } from "../registration/ServiceRegistration";
|
9 | import { WaitRules } from "./common/createGoal";
|
10 | import { Goal, GoalDefinition, GoalWithPrecondition } from "./Goal";
|
11 | import { ExecuteGoal, GoalProjectListenerRegistration } from "./GoalInvocation";
|
12 | import { Goals } from "./Goals";
|
13 | import { ReportProgress } from "./progress/ReportProgress";
|
14 | import { GoalEnvironment } from "./support/environment";
|
15 | import { GoalFulfillmentCallback } from "./support/GoalImplementationMapper";
|
16 | export declare type Fulfillment = Implementation | SideEffect;
|
17 |
|
18 |
|
19 |
|
20 | export interface FulfillmentRegistration {
|
21 | |
22 |
|
23 |
|
24 | name: string;
|
25 | |
26 |
|
27 |
|
28 |
|
29 | pushTest?: PushTest;
|
30 | }
|
31 |
|
32 |
|
33 |
|
34 | export interface ImplementationRegistration extends FulfillmentRegistration {
|
35 | |
36 |
|
37 |
|
38 | logInterpreter?: InterpretLog;
|
39 | |
40 |
|
41 |
|
42 | progressReporter?: ReportProgress;
|
43 | }
|
44 | export interface Implementation extends ImplementationRegistration {
|
45 | goalExecutor: ExecuteGoal;
|
46 | }
|
47 | export declare function isImplementation(f: Fulfillment): f is Implementation;
|
48 | export interface SideEffect {
|
49 | name: string;
|
50 | registration: string;
|
51 | pushTest?: PushTest;
|
52 | }
|
53 | export declare function isSideEffect(f: Fulfillment): f is SideEffect;
|
54 |
|
55 |
|
56 |
|
57 |
|
58 | export interface FulfillableGoalDetails {
|
59 | displayName?: string;
|
60 | uniqueName?: string;
|
61 | environment?: string | GoalEnvironment;
|
62 | approval?: boolean;
|
63 | preApproval?: boolean;
|
64 | retry?: boolean;
|
65 | isolate?: boolean;
|
66 | descriptions?: {
|
67 | planned?: string;
|
68 | requested?: string;
|
69 | completed?: string;
|
70 | inProcess?: string;
|
71 | failed?: string;
|
72 | waitingForApproval?: string;
|
73 | waitingForPreApproval?: string;
|
74 | canceled?: string;
|
75 | stopped?: string;
|
76 | };
|
77 | preCondition?: WaitRules;
|
78 | retryCondition?: RetryOptions;
|
79 | }
|
80 |
|
81 |
|
82 |
|
83 | export interface PredicatedGoalDefinition extends GoalDefinition {
|
84 | preCondition?: WaitRules;
|
85 | retryCondition?: RetryOptions;
|
86 | }
|
87 | export interface Parameterized {
|
88 | parameters?: DefaultFacts;
|
89 | }
|
90 | export interface PlannedGoal extends Parameterized {
|
91 | details?: Omit<FulfillableGoalDetails, "uniqueName" | "environment">;
|
92 | fulfillment?: {
|
93 | registration: string;
|
94 | name: string;
|
95 | };
|
96 | }
|
97 | export declare type PlannedGoals = Record<string, {
|
98 | goals: PlannedGoal | Array<PlannedGoal | PlannedGoal[]>;
|
99 | dependsOn?: string | string[];
|
100 | }>;
|
101 | export interface PlannableGoal {
|
102 | plan?(pli: StatefulPushListenerInvocation, goals: Goals): Promise<PlannedGoals | PlannedGoal>;
|
103 | }
|
104 |
|
105 |
|
106 |
|
107 |
|
108 | export declare abstract class FulfillableGoal extends GoalWithPrecondition implements Registerable, PlannableGoal {
|
109 | definitionOrGoal: PredicatedGoalDefinition | Goal;
|
110 | readonly fulfillments: Fulfillment[];
|
111 | readonly callbacks: GoalFulfillmentCallback[];
|
112 | readonly projectListeners: GoalProjectListenerRegistration[];
|
113 | readonly goalListeners: GoalExecutionListener[];
|
114 | sdm: SoftwareDeliveryMachine;
|
115 | constructor(definitionOrGoal: PredicatedGoalDefinition | Goal, ...dependsOn: Goal[]);
|
116 | register(sdm: SoftwareDeliveryMachine): void;
|
117 | withProjectListener(listener: GoalProjectListenerRegistration): this;
|
118 | withExecutionListener(listener: GoalExecutionListener): this;
|
119 | withService(registration: ServiceRegistration<any>): this;
|
120 | protected addFulfillmentCallback(cb: GoalFulfillmentCallback): this;
|
121 | protected addFulfillment(fulfillment: Fulfillment): this;
|
122 | private registerFulfillment;
|
123 | plan(pli: StatefulPushListenerInvocation, goals: Goals): Promise<PlannedGoals | PlannedGoal>;
|
124 | private registerCallback;
|
125 | }
|
126 | /**
|
127 | * Goal that accepts registrations of R.
|
128 | */
|
129 | export declare abstract class FulfillableGoalWithRegistrations<R> extends FulfillableGoal {
|
130 | definitionOrGoal: PredicatedGoalDefinition | Goal;
|
131 | readonly registrations: R[];
|
132 | constructor(definitionOrGoal: PredicatedGoalDefinition | Goal, ...dependsOn: Goal[]);
|
133 | with(registration: R): this;
|
134 | }
|
135 | /**
|
136 | * Goal that accepts registrations of R and listeners of L.
|
137 | */
|
138 | export declare abstract class FulfillableGoalWithRegistrationsAndListeners<R, L> extends FulfillableGoalWithRegistrations<R> {
|
139 | definitionOrGoal: PredicatedGoalDefinition | Goal;
|
140 | readonly listeners: L[];
|
141 | constructor(definitionOrGoal: PredicatedGoalDefinition | Goal, ...dependsOn: Goal[]);
|
142 | withListener(listener: L): this;
|
143 | }
|
144 | /**
|
145 | * Generic goal that can be used with a GoalDefinition.
|
146 | * Register goal implementations or side effects to this goal instance.
|
147 | */
|
148 | export declare class GoalWithFulfillment extends FulfillableGoal {
|
149 | withCallback(cb: GoalFulfillmentCallback): this;
|
150 | with(fulfillment: Fulfillment): this;
|
151 | }
|
152 |
|
153 |
|
154 |
|
155 |
|
156 |
|
157 |
|
158 |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 |
|
164 | export declare function goal(details?: FulfillableGoalDetails, goalExecutor?: ExecuteGoal, options?: {
|
165 | pushTest?: PushTest;
|
166 | logInterpreter?: InterpretLog;
|
167 | progressReporter?: ReportProgress;
|
168 | plan?: (pli: StatefulPushListenerInvocation, goals: Goals) => Promise<PlannedGoals | PlannedGoal>;
|
169 | }): GoalWithFulfillment;
|
170 |
|
171 |
|
172 |
|
173 |
|
174 |
|
175 |
|
176 | export declare function getGoalDefinitionFrom(goalDetails: FulfillableGoalDetails | string, uniqueName: string, definition?: GoalDefinition): {
|
177 | uniqueName: string;
|
178 | } | PredicatedGoalDefinition;
|
179 |
|
180 |
|
181 |
|
182 |
|
183 |
|
184 |
|
185 |
|
186 |
|
187 | export declare function mergeOptions<OPTIONS>(defaults: OPTIONS, explicit: OPTIONS, configurationPath?: string): OPTIONS;
|
188 |
|
\ | No newline at end of file |