UNPKG

2.04 kBTypeScriptView Raw
1import { PushImpactListenerInvocation } from "../listener/PushImpactListener";
2import { PushRegistration } from "./PushRegistration";
3/**
4 * A code action response that affects delivery:
5 * failing the current goal or requiring approval,
6 * causing dependent goals to fail or wait.
7 */
8export declare enum PushImpactResponse {
9 /**
10 * Everything's good. Keep going.
11 */
12 proceed = "proceed",
13 /**
14 * Fail execution of the present goalset. Any dependent goals will stop.
15 * Will not stop execution of non-dependent goals.
16 */
17 failGoals = "fail",
18 /**
19 * Require approval to proceed to dependent goals in the present goalset.
20 */
21 requireApprovalToProceed = "requireApproval"
22}
23declare type DefaultPushImpactListenerResult = void | PushImpactResponse;
24/**
25 * Reaction on a push, with the code available.
26 * Can optionally return a response that
27 * determines whether to ask for approval or terminate current delivery flow.
28 */
29export declare type PushImpactListener<R = DefaultPushImpactListenerResult> = (i: PushImpactListenerInvocation) => Promise<R>;
30/**
31 * Used to register actions on a push that can potentially
32 * influence downstream goals. Will be invoked if a PushReactionGoal has
33 * been set for the given push.
34 * Use ReviewerRegistration if you want to return a structured review.
35 */
36export declare type PushImpactListenerRegistration<R = DefaultPushImpactListenerResult> = PushRegistration<PushImpactListener<R>>;
37/**
38 * Something we can register as a push reaction
39 */
40export declare type PushImpactListenerRegisterable<R = DefaultPushImpactListenerResult> = PushImpactListenerRegistration<R> | PushImpactListener<R>;
41/**
42 * Convert an action function to a PushImpactListener if necessary
43 * @param {PushImpactListenerRegisterable<any>} prr
44 * @return {PushImpactListenerRegistration}
45 */
46export declare function toPushReactionRegistration(prr: PushImpactListenerRegisterable): PushImpactListenerRegistration;
47export {};
48//# sourceMappingURL=PushImpactListenerRegistration.d.ts.map
\No newline at end of file