UNPKG

1.85 kBTypeScriptView Raw
1import { RemoteRepoRef } from "@atomist/automation-client/lib/operations/common/RepoId";
2import { NoParameters } from "@atomist/automation-client/lib/SmartParameters";
3import { ParameterPromptOptions } from "../context/parameterPrompt";
4import { ParametersDefinition } from "../registration/ParametersDefinition";
5import { SdmListener } from "./Listener";
6import { ParametersInvocation } from "./ParametersInvocation";
7/**
8 * Context for a command
9 */
10export interface CommandListenerInvocation<PARAMS = NoParameters> extends ParametersInvocation<PARAMS> {
11 commandName: string;
12 /**
13 * The repos this command relates to, if available.
14 */
15 ids?: RemoteRepoRef[];
16 /**
17 * If the intent was a regular expression, the matches to the supplied intent are found here
18 */
19 matches?: RegExpExecArray;
20 /**
21 * Prompt for additional parameters needed during execution of the command listener.
22 *
23 * Callers should wait for the returned Promise to resolve. It will resolve with the requested
24 * parameters if those have already been collected. If not, a parameter prompt request to the backend
25 * will be sent and the Promise will reject. Once the new parameters are collected, a new
26 * command invocation will be sent and the command listener will restart.
27 *
28 * This requires that any state that gets created before calling promptFor can be re-created when
29 * re-entering the listener function. Also any action taken before calling promptFor needs to be
30 * implemented using idempotency patterns.
31 */
32 promptFor<NEWPARAMS>(parameters: ParametersDefinition<NEWPARAMS>, options?: ParameterPromptOptions): Promise<NEWPARAMS>;
33}
34export declare type CommandListener<PARAMS = NoParameters> = SdmListener<CommandListenerInvocation<PARAMS>>;
35//# sourceMappingURL=CommandListener.d.ts.map
\No newline at end of file