UNPKG

@atomist/sdm

Version:

Atomist Software Delivery Machine SDK

56 lines 2.54 kB
"use strict"; /* * Copyright © 2019 Atomist, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.Cancel = exports.DefaultCancelOptions = void 0; const executeCancel_1 = require("../../../api-helper/listener/executeCancel"); const logInterpreters_1 = require("../../../api-helper/log/logInterpreters"); const types_1 = require("../../../typings/types"); const GoalNameGenerator_1 = require("../GoalNameGenerator"); const GoalWithFulfillment_1 = require("../GoalWithFulfillment"); const environment_1 = require("../support/environment"); exports.DefaultCancelOptions = { goals: [], goalFilter: g => g.state === types_1.SdmGoalState.in_process || g.state === types_1.SdmGoalState.planned || g.state === types_1.SdmGoalState.requested || g.state === types_1.SdmGoalState.waiting_for_pre_approval || g.state === types_1.SdmGoalState.pre_approved, }; /** * Goal to cancel pending goals in goal sets of the previous commit on the same branch */ class Cancel extends GoalWithFulfillment_1.FulfillableGoal { constructor(options = exports.DefaultCancelOptions, ...dependsOn) { super(Object.assign({}, GoalWithFulfillment_1.getGoalDefinitionFrom(options, GoalNameGenerator_1.DefaultGoalNameGenerator.generateName("cancel"), CancelDefinition)), ...dependsOn); this.options = options; this.addFulfillment({ name: `cancel-${this.definition.uniqueName}`, logInterpreter: logInterpreters_1.LogSuppressor, goalExecutor: executeCancel_1.executeCancelGoalSets(this.options, this.definition.uniqueName), }); } } exports.Cancel = Cancel; const CancelDefinition = { uniqueName: "cancel", displayName: "cancel goals", environment: environment_1.IndependentOfEnvironment, workingDescription: "Canceling goals", completedDescription: "No goals canceled", failedDescription: "Failed to cancel goals", }; //# sourceMappingURL=Cancel.js.map