UNPKG

@atomist/sdm

Version:

Atomist Software Delivery Machine SDK

105 lines 6.09 kB
import { HandleCommand } from "@atomist/automation-client/lib/HandleCommand"; import { HandleEvent } from "@atomist/automation-client/lib/HandleEvent"; import { NoParameters } from "@atomist/automation-client/lib/SmartParameters"; import { Maker } from "@atomist/automation-client/lib/util/constructionUtils"; import { GoalContribution } from "../../api/dsl/goalContribution"; import { Goal } from "../../api/goal/Goal"; import { ExecuteGoal, GoalProjectListenerRegistration } from "../../api/goal/GoalInvocation"; import { Goals } from "../../api/goal/Goals"; import { ReportProgress } from "../../api/goal/progress/ReportProgress"; import { ExtensionPack } from "../../api/machine/ExtensionPack"; import { SoftwareDeliveryMachine } from "../../api/machine/SoftwareDeliveryMachine"; import { SoftwareDeliveryMachineConfiguration } from "../../api/machine/SoftwareDeliveryMachineOptions"; import { GoalSetter } from "../../api/mapping/GoalSetter"; import { PushMapping } from "../../api/mapping/PushMapping"; import { PushTest } from "../../api/mapping/PushTest"; import { CodeInspectionRegistration } from "../../api/registration/CodeInspectionRegistration"; import { CodeTransformRegistration } from "../../api/registration/CodeTransformRegistration"; import { CommandHandlerRegistration } from "../../api/registration/CommandHandlerRegistration"; import { EventHandlerRegistration } from "../../api/registration/EventHandlerRegistration"; import { GeneratorRegistration } from "../../api/registration/GeneratorRegistration"; import { GoalApprovalRequestVoteDecisionManager, GoalApprovalRequestVoter } from "../../api/registration/goalApprovalRequestVote"; import { IngesterRegistration } from "../../api/registration/IngesterRegistration"; import { InterpretLog } from "../../spi/log/InterpretedLog"; import { DefaultGoalImplementationMapper } from "../goal/DefaultGoalImplementationMapper"; import { HandlerRegistrationManagerSupport } from "./HandlerRegistrationManagerSupport"; import { ListenerRegistrationManagerSupport } from "./ListenerRegistrationManagerSupport"; /** * Abstract support class for implementing a SoftwareDeliveryMachine. */ export declare abstract class AbstractSoftwareDeliveryMachine<O extends SoftwareDeliveryMachineConfiguration = SoftwareDeliveryMachineConfiguration> extends ListenerRegistrationManagerSupport implements SoftwareDeliveryMachine<O> { readonly name: string; readonly configuration: O; abstract readonly commandHandlers: Array<Maker<HandleCommand>>; abstract readonly eventHandlers: Array<Maker<HandleEvent<any>>>; abstract readonly ingesters: string[]; readonly extensionPacks: ExtensionPack[]; protected readonly registrationManager: HandlerRegistrationManagerSupport; protected readonly disposalGoalSetters: GoalSetter[]; protected readonly goalApprovalRequestVoters: GoalApprovalRequestVoter[]; protected goalApprovalRequestVoteDecisionManager: GoalApprovalRequestVoteDecisionManager; private pushMap; private fulfillmentMapper; get goalFulfillmentMapper(): DefaultGoalImplementationMapper; /** * Return the PushMapping that will be used on pushes. * Useful in testing goal setting. * @return {PushMapping<Goals>} */ get pushMapping(): PushMapping<Goals>; /** * Provide the implementation for a goal. * The SDM will run it as soon as the goal is ready (all preconditions are met). * If you provide a PushTest, then the SDM can assign different implementations * to the same goal based on the code in the project. * @param {string} implementationName * @param {Goal} goal * @param {ExecuteGoal} goalExecutor * @param options PushTest to narrow matching & InterpretLog that can handle * the log from the goalExecutor function * @return {this} */ addGoalImplementation(implementationName: string, goal: Goal, goalExecutor: ExecuteGoal, options?: Partial<{ pushTest: PushTest; logInterpreter: InterpretLog; progressReporter: ReportProgress; projectListeners: GoalProjectListenerRegistration | GoalProjectListenerRegistration[]; }>): this; addGoalApprovalRequestVoter(vote: GoalApprovalRequestVoter): this; setGoalApprovalRequestVoteDecisionManager(manager: GoalApprovalRequestVoteDecisionManager): this; addCommand<P>(cmd: CommandHandlerRegistration<P>): this; addGeneratorCommand<P = NoParameters>(gen: GeneratorRegistration<P>): this; addCodeTransformCommand<P>(ct: CodeTransformRegistration<P>): this; addCodeInspectionCommand<R, P>(cir: CodeInspectionRegistration<R, P>): this; addEvent<T, P>(e: EventHandlerRegistration<T, P>): this; addIngester(i: string | IngesterRegistration): this; /** * Declare that a goal will become successful based on something outside. * For instance, ArtifactGoal succeeds because of an ImageLink event. * This tells the SDM that it does not need to run anything when this * goal becomes ready. */ addGoalSideEffect(goal: Goal, sideEffectName: string, registration?: string, pushTest?: PushTest): this; addGoalContributions(goalContributions: GoalSetter): this; withPushRules(contributor: GoalContribution<any>, ...contributors: Array<GoalContribution<any>>): this; addExtensionPacks(...packs: ExtensionPack[]): this; private addExtensionPack; /** * Invoke StartupListeners. */ notifyStartupListeners(): Promise<void>; /** * Schedule the triggered listeners */ scheduleTriggeredListeners(): void; /** * Construct a new software delivery machine, with zero or * more goal setters. * @param {string} name * @param configuration automation client configuration we're running in * @param {GoalSetter} goalSetters tell me what to do on a push. Hint: start with "whenPushSatisfies(...)" */ protected constructor(name: string, configuration: O, goalSetters: Array<GoalSetter | GoalSetter[]>); private shouldRegister; } //# sourceMappingURL=AbstractSoftwareDeliveryMachine.d.ts.map