UNPKG

@jameslnewell/buildkite-pipelines

Version:
161 lines 6.41 kB
"use strict"; var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); }; var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; }; var _BlockStep_label, _BlockStep_state, _BlockStep_keyHelper, _BlockStep_branchesHelper, _BlockStep_dependenciesHelper, _BlockStep_promptHelper, _BlockStep_conditionHelper; Object.defineProperty(exports, "__esModule", { value: true }); exports.BlockStep = void 0; const branches_1 = require("./helpers/branches"); const condition_1 = require("./helpers/condition"); const dependencies_1 = require("./helpers/dependencies"); const key_1 = require("./helpers/key"); const prompt_1 = require("./helpers/prompt"); class BlockStep { constructor() { _BlockStep_label.set(this, void 0); _BlockStep_state.set(this, void 0); _BlockStep_keyHelper.set(this, new key_1.KeyHelper()); _BlockStep_branchesHelper.set(this, new branches_1.BranchFilterHelper()); _BlockStep_dependenciesHelper.set(this, new dependencies_1.DependenciesHelper()); _BlockStep_promptHelper.set(this, new prompt_1.PromptHelper()); _BlockStep_conditionHelper.set(this, new condition_1.ConditionHelper()); } getLabel() { return __classPrivateFieldGet(this, _BlockStep_label, "f"); } /** * @deprecated Use .setLabel() instead */ label(label) { this.setLabel(label); return this; } setLabel(label) { __classPrivateFieldSet(this, _BlockStep_label, label, "f"); return this; } /** * @deprecated Use .setState() instead */ state(state) { return this.setState(state); } setState(state) { __classPrivateFieldSet(this, _BlockStep_state, state, "f"); return this; } getKey() { return __classPrivateFieldGet(this, _BlockStep_keyHelper, "f").getKey(); } /** * @deprecated Use .setKey() instead */ key(key) { this.setKey(key); return this; } setKey(key) { __classPrivateFieldGet(this, _BlockStep_keyHelper, "f").setKey(key); return this; } getBranches() { return __classPrivateFieldGet(this, _BlockStep_branchesHelper, "f").getBranches(); } /** * @deprecated Use .addBranch() instead */ branch(branch) { this.addBranch(branch); return this; } addBranch(branch) { __classPrivateFieldGet(this, _BlockStep_branchesHelper, "f").addBranch(branch); return this; } getDependencies() { return __classPrivateFieldGet(this, _BlockStep_dependenciesHelper, "f").getDependencies(); } /** * @deprecated Use .addDependency() instead */ dependOn(dependency) { return this.addDependency(dependency); } addDependency(dependency) { __classPrivateFieldGet(this, _BlockStep_dependenciesHelper, "f").addDependency(dependency); return this; } /** * @deprecated Use .setAllowDependencyFailure() instead */ allowDependencyFailure(allow) { return this.setAllowDependencyFailure(allow); } setAllowDependencyFailure(allow) { __classPrivateFieldGet(this, _BlockStep_dependenciesHelper, "f").setAllowDependencyFailure(allow); return this; } /** * @deprecated Use .setPrompt() instead */ prompt(prompt) { this.setPrompt(prompt); return this; } setPrompt(prompt) { __classPrivateFieldGet(this, _BlockStep_promptHelper, "f").setPrompt(prompt); return this; } /** * @deprecated Use .addField() instead */ field(field) { this.addField(field); return this; } addField(field) { __classPrivateFieldGet(this, _BlockStep_promptHelper, "f").addField(field); return this; } getCondition() { return __classPrivateFieldGet(this, _BlockStep_conditionHelper, "f").getCondition(); } /** * @deprecated Use .setCondition() instead */ condition(condition) { return this.setCondition(condition); } setCondition(condition) { __classPrivateFieldGet(this, _BlockStep_conditionHelper, "f").setCondition(condition); return this; } build() { if (!__classPrivateFieldGet(this, _BlockStep_label, "f")) { throw new Error('BlockStep must have a label.'); } const object = { block: __classPrivateFieldGet(this, _BlockStep_label, "f"), ...__classPrivateFieldGet(this, _BlockStep_keyHelper, "f").build(), ...__classPrivateFieldGet(this, _BlockStep_branchesHelper, "f").build(), ...__classPrivateFieldGet(this, _BlockStep_dependenciesHelper, "f").build(), ...__classPrivateFieldGet(this, _BlockStep_promptHelper, "f").build(), ...__classPrivateFieldGet(this, _BlockStep_conditionHelper, "f").build(), }; if (__classPrivateFieldGet(this, _BlockStep_state, "f")) { object.blocked_state = __classPrivateFieldGet(this, _BlockStep_state, "f"); } return object; } } exports.BlockStep = BlockStep; _BlockStep_label = new WeakMap(), _BlockStep_state = new WeakMap(), _BlockStep_keyHelper = new WeakMap(), _BlockStep_branchesHelper = new WeakMap(), _BlockStep_dependenciesHelper = new WeakMap(), _BlockStep_promptHelper = new WeakMap(), _BlockStep_conditionHelper = new WeakMap(); //# sourceMappingURL=BlockStep.js.map