UNPKG

@intuitionrobotics/bug-report

Version:
42 lines 2.46 kB
"use strict"; 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()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.JiraBugReportIntegrator = exports.JiraBugReportIntegrator_Class = void 0; const ts_common_1 = require("@intuitionrobotics/ts-common"); const jira_1 = require("@intuitionrobotics/jira"); const __1 = require("../.."); class JiraBugReportIntegrator_Class extends ts_common_1.Module { constructor() { super("JiraBugReportIntegrator"); this.parser = (name) => `Bug: ${name}`; this.openTicket = (bugReport, logs, reporter) => __awaiter(this, void 0, void 0, function* () { var _a; if (bugReport.platforms && !bugReport.platforms.includes(__1.Platform_Jira)) return; if (!this.config.jiraProject) throw new ts_common_1.ImplementationMissingException("missing Jira project in bug report configurations"); const description = logs.reduce((carry, log, i) => { carry.push({ href: log.path, text: "\nClick to view logs (" + i + ")" }); return carry; }, [bugReport.description]); if (reporter) description.push("\nReported by: " + reporter); const issue = yield jira_1.JiraModule.issue.create(this.config.jiraProject, this.config.issueType, this.parser(bugReport.subject), description, (_a = this.config.label) === null || _a === void 0 ? void 0 : _a.label); return { platform: __1.Platform_Jira, issueId: issue.url }; }); } setIssueTitleProcessor(parser) { this.parser = parser; } } exports.JiraBugReportIntegrator_Class = JiraBugReportIntegrator_Class; exports.JiraBugReportIntegrator = new JiraBugReportIntegrator_Class(); //# sourceMappingURL=JiraBugReportIntegrator.js.map