From 902701b418599dfae9c8f11fbc4a2163a9e8ba35 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 18 Dec 2024 00:49:39 +0000 Subject: [PATCH] fix(deps): update dependency @octopusdeploy/api-client to v3.5.0 --- dist/index.js | 187 +++++++++++++++++++++++++++++++++++++++++++++- package-lock.json | 14 ++-- package.json | 2 +- 3 files changed, 194 insertions(+), 9 deletions(-) diff --git a/dist/index.js b/dist/index.js index 9574259..457f76e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -8255,6 +8255,24 @@ var RunbookProcessRepository = /** @class */ (function () { }); }); }; + RunbookProcessRepository.prototype.getWithGitRef = function (runbook, gitRef) { + return __awaiter(this, void 0, void 0, function () { + var response; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.client.request("".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/projects/{projectId}/{gitRef}/runbookProcesses{/id}"), { + spaceName: this.spaceName, + projectId: this.projectId, + id: runbook.RunbookProcessId, + gitRef: gitRef, + })]; + case 1: + response = _a.sent(); + return [2 /*return*/, response]; + } + }); + }); + }; RunbookProcessRepository.prototype.update = function (runbookProcess) { return __awaiter(this, void 0, void 0, function () { var response; @@ -8272,6 +8290,24 @@ var RunbookProcessRepository = /** @class */ (function () { }); }); }; + RunbookProcessRepository.prototype.updateWithGitRef = function (runbookProcess, gitRef) { + return __awaiter(this, void 0, void 0, function () { + var response; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.client.doUpdate("".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/projects/{projectId}/{gitRef}/runbookProcesses{/id}"), runbookProcess, { + spaceName: this.spaceName, + projectId: this.projectId, + id: runbookProcess.Id, + gitRef: gitRef, + })]; + case 1: + response = _a.sent(); + return [2 /*return*/, response]; + } + }); + }); + }; return RunbookProcessRepository; }()); exports.RunbookProcessRepository = RunbookProcessRepository; @@ -8299,6 +8335,42 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.RunbookRepository = void 0; var spaceScopedRoutePrefix_1 = __nccwpck_require__(7218); @@ -8306,8 +8378,81 @@ var spaceScopedBasicRepository_1 = __nccwpck_require__(3496); var RunbookRepository = /** @class */ (function (_super) { __extends(RunbookRepository, _super); function RunbookRepository(client, spaceName, project) { - return _super.call(this, client, spaceName, "".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/projects/").concat(project.Id, "/runbooks"), "skip,take,ids,partialName") || this; + var _this = _super.call(this, client, spaceName, "".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/projects/").concat(project.Id, "/runbooks"), "skip,take,ids,partialName") || this; + _this.projectId = project.Id; + return _this; } + RunbookRepository.prototype.getWithGitRef = function (slug, gitRef) { + return __awaiter(this, void 0, void 0, function () { + var response; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.client.request("".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/projects/{projectId}/{gitRef}/runbooks{/id}"), { + spaceName: this.spaceName, + projectId: this.projectId, + id: slug, + gitRef: gitRef, + })]; + case 1: + response = _a.sent(); + return [2 /*return*/, response]; + } + }); + }); + }; + RunbookRepository.prototype.createWithGitRef = function (runbook, gitRef) { + return __awaiter(this, void 0, void 0, function () { + var response; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.client.doCreate("".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/projects/{projectId}/{gitRef}/runbooks/v2"), runbook, { + spaceName: this.spaceName, + projectId: this.projectId, + gitRef: gitRef, + })]; + case 1: + response = _a.sent(); + return [2 /*return*/, response]; + } + }); + }); + }; + RunbookRepository.prototype.modifyWithGitRef = function (runbook, gitRef) { + return __awaiter(this, void 0, void 0, function () { + var response; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.client.doUpdate("".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/projects/{projectId}/{gitRef}/runbooks{/id}"), runbook, { + spaceName: this.spaceName, + projectId: this.projectId, + id: runbook.Id, + gitRef: gitRef, + })]; + case 1: + response = _a.sent(); + return [2 /*return*/, response]; + } + }); + }); + }; + RunbookRepository.prototype.deleteWithGitRef = function (runbook, gitRef) { + return __awaiter(this, void 0, void 0, function () { + var response; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.client.del("".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/projects/{projectId}/{gitRef}/runbooks{/id}"), { + spaceName: this.spaceName, + projectId: this.projectId, + id: runbook.Id, + gitRef: gitRef, + })]; + case 1: + response = _a.sent(); + return [2 /*return*/, response]; + } + }); + }); + }; return RunbookRepository; }(spaceScopedBasicRepository_1.SpaceScopedBasicRepository)); exports.RunbookRepository = RunbookRepository; @@ -8321,6 +8466,12 @@ exports.RunbookRepository = RunbookRepository; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.RunbookRetentionUnit = void 0; +var RunbookRetentionUnit; +(function (RunbookRetentionUnit) { + RunbookRetentionUnit["Days"] = "Days"; + RunbookRetentionUnit["Items"] = "Items"; +})(RunbookRetentionUnit = exports.RunbookRetentionUnit || (exports.RunbookRetentionUnit = {})); /***/ }), @@ -8566,6 +8717,40 @@ var RunbookRunRepository = /** @class */ (function () { }); }); }; + RunbookRunRepository.prototype.createGit = function (command, gitRef) { + var _a, _b; + return __awaiter(this, void 0, void 0, function () { + var serverInformation, response, mappedTasks; + return __generator(this, function (_c) { + switch (_c.label) { + case 0: return [4 /*yield*/, this.client.getServerInformation()]; + case 1: + serverInformation = _c.sent(); + if ((0, semver_1.lt)(serverInformation.version, "2022.3.5512")) { + (_b = (_a = this.client).error) === null || _b === void 0 ? void 0 : _b.call(_a, "The Octopus instance doesn't support running runbooks using the Executions API, it will need to be upgraded to at least 2022.3.5512 in order to access this API."); + throw new Error("The Octopus instance doesn't support running runbooks using the Executions API, it will need to be upgraded to at least 2022.3.5512 in order to access this API."); + } + this.client.debug("Running a runbook..."); + return [4 /*yield*/, this.client.doCreate("".concat(spaceScopedRoutePrefix_1.spaceScopedRoutePrefix, "/runbook-runs/git/create/v1"), __assign({ spaceIdOrName: command.spaceName, gitRef: gitRef }, command))]; + case 2: + response = _c.sent(); + if (response.RunbookRunServerTasks.length == 0) { + throw new Error("No server task details returned"); + } + mappedTasks = response.RunbookRunServerTasks.map(function (x) { + return { + RunbookRunId: x.RunbookRunId || x.runbookRunId, + ServerTaskId: x.ServerTaskId || x.serverTaskId, + }; + }); + this.client.debug("Runbook executed successfully. [".concat(mappedTasks.map(function (t) { return t.ServerTaskId; }).join(", "), "]")); + return [2 /*return*/, { + RunbookRunServerTasks: mappedTasks, + }]; + } + }); + }); + }; return RunbookRunRepository; }()); exports.RunbookRunRepository = RunbookRunRepository; diff --git a/package-lock.json b/package-lock.json index 3591b2e..c3bf80a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@actions/core": "1.10.1", "@actions/github": "5.1.1", "@octokit/webhooks-types": "6.10.0", - "@octopusdeploy/api-client": "3.4.1" + "@octopusdeploy/api-client": "3.5.0" }, "devDependencies": { "@types/jest": "29.5.14", @@ -1475,9 +1475,9 @@ "integrity": "sha512-lDNv83BeEyxxukdQ0UttiUXawk9+6DkdjjFtm2GFED+24IQhTVaoSbwV9vWWKONyGLzRmCQqZmoEWkDhkEmPlw==" }, "node_modules/@octopusdeploy/api-client": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@octopusdeploy/api-client/-/api-client-3.4.1.tgz", - "integrity": "sha512-j6FRgDNzc6AQoT3CAguYLWxoMR4W5TKCT1BCPpqjEN9mknmdMSKfYORs3djn/Yj/BhqtITTydDpBoREbzKY5+g==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/@octopusdeploy/api-client/-/api-client-3.5.0.tgz", + "integrity": "sha512-luxROAzLqOBG3fYQ2ztsVhHIBQ4YoUi9A1x8W4H4Mw23M+z4BNK/n1PflSvGUC6wjR2kZqjhZbvgVFJ6o08ekA==", "dependencies": { "adm-zip": "^0.5.9", "axios": "^1.2.1", @@ -8067,9 +8067,9 @@ "integrity": "sha512-lDNv83BeEyxxukdQ0UttiUXawk9+6DkdjjFtm2GFED+24IQhTVaoSbwV9vWWKONyGLzRmCQqZmoEWkDhkEmPlw==" }, "@octopusdeploy/api-client": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/@octopusdeploy/api-client/-/api-client-3.4.1.tgz", - "integrity": "sha512-j6FRgDNzc6AQoT3CAguYLWxoMR4W5TKCT1BCPpqjEN9mknmdMSKfYORs3djn/Yj/BhqtITTydDpBoREbzKY5+g==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/@octopusdeploy/api-client/-/api-client-3.5.0.tgz", + "integrity": "sha512-luxROAzLqOBG3fYQ2ztsVhHIBQ4YoUi9A1x8W4H4Mw23M+z4BNK/n1PflSvGUC6wjR2kZqjhZbvgVFJ6o08ekA==", "requires": { "adm-zip": "^0.5.9", "axios": "^1.2.1", diff --git a/package.json b/package.json index 578ad2b..0d56eca 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "@actions/core": "1.10.1", "@actions/github": "5.1.1", "@octokit/webhooks-types": "6.10.0", - "@octopusdeploy/api-client": "3.4.1" + "@octopusdeploy/api-client": "3.5.0" }, "description": "GitHub Action to Push Build Information to Octopus Deploy", "devDependencies": {