@atomist/sdm
Version:
Atomist Software Delivery Machine SDK
46 lines • 2.26 kB
TypeScript
import { Destination, MessageOptions } from "@atomist/automation-client/lib/spi/message/MessageClient";
import { SdmContext } from "../../api/context/SdmContext";
import { SdmGoalEvent } from "../../api/goal/SdmGoalEvent";
import { GoalCompletionListener, GoalCompletionListenerInvocation } from "../../api/listener/GoalCompletionListener";
import { ExtensionPack } from "../../api/machine/ExtensionPack";
import { CommandHandlerRegistration } from "../../api/registration/CommandHandlerRegistration";
/**
* Factory to create message destinations for goal notifications
*/
export declare type DestinationFactory = (goal: SdmGoalEvent, context: SdmContext) => Promise<Destination | Destination[] | undefined>;
/**
* Factory to create notification messages
*/
export declare type NotificationFactory = (gi: GoalCompletionListenerInvocation) => Promise<{
message: any;
options: MessageOptions;
}>;
/**
* Options to configure the notification support
*/
export interface NotificationOptions {
destination?: DestinationFactory | DestinationFactory[];
notification?: NotificationFactory;
}
/**
* Extension pack to send notifications on certain conditions.
* Recipients and notification messages can be customized by providing options
* with DestinationFactory and NotificationFactory.
* @param options
*/
export declare function notificationSupport(options?: NotificationOptions): ExtensionPack;
/**
* Default DestinationFactory that would send every commit author a direct message in Slack / MS Teams.
*/
export declare function defaultDestinationFactory(goal: SdmGoalEvent): Promise<Destination | Destination[] | undefined>;
/**
* Default NotificationFactory that sends messages with restart, start and approve buttons where appropriate.
*/
export declare function defaultNotificationFactory(updateGoalCommand: CommandHandlerRegistration<any>): NotificationFactory;
/**
* GoalCompletionListener that delegates to the NotificationFactory and DestinationFactory to
* create notifications and send them out.
*/
export declare function notifyGoalCompletionListener(options: NotificationOptions): GoalCompletionListener;
export declare function truncateCommitMessage(message: string): string;
//# sourceMappingURL=notification.d.ts.map