{
  "version": 3,
  "sources": ["../../src/cli-commands-jira.ts"],
  "sourcesContent": ["/**\n * QCObjects CLI 2.4.x\n * ________________\n *\n * Author: Jean Machuca <correojean@gmail.com>\n *\n * Cross Browser Javascript Framework for MVC Patterns\n * QuickCorp/QCObjects is licensed under the\n * GNU Lesser General Public License v3.0\n * [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)\n *\n * Permissions of this copyleft license are conditioned on making available\n * complete source code of licensed works and modifications under the same\n * license or the GNU GPLv3. Copyright and license notices must be preserved.\n * Contributors provide an express grant of patent rights. However, a larger\n * work using the licensed work through interfaces provided by the licensed\n * work may be distributed under different terms and without source code for\n * the larger work.\n *\n * Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>\n *\n * Everyone is permitted to copy and distribute verbatim copies of this\n * license document, but changing it is not allowed.\n*/\n/*eslint no-unused-vars: \"off\"*/\n/*eslint no-redeclare: \"off\"*/\n/*eslint no-empty: \"off\"*/\n/*eslint strict: \"off\"*/\n/*eslint no-mixed-operators: \"off\"*/\n/*eslint no-undef: \"off\"*/\n\"use strict\";\nimport path from \"node:path\";\n\nimport { JiraCloud } from \"./client_services\";\nimport { Package, InheritClass, _DataStringify, New, CONFIG, logger } from \"qcobjects\";\nconst absolutePath = path.resolve(__dirname, \"./\");\n\nexport class CommandHandler extends InheritClass {\n  choiceOption: {\n    [x: string]: any; issues: () => void;\n  };\n  constructor({\n    switchCommander\n  }: { switchCommander: any }) {\n    super({ switchCommander });\n    this.choiceOption = {\n      issues: function () {\n\n        this.getIssueList().then(function (response: any) {\n          console.log(_DataStringify(response));\n        }).catch((e: any) => {\n          console.log(e);\n          process.exit(1);\n        });\n\n      }\n    };\n\n    const commandHandler = this;\n\n    switchCommander.program.command(\"jira <subcommand>\")\n      .option(\"-u, --from-user [username]\", \"User name\")\n      .option(\"-fp,--from-project <projectName>\", \"Project name\")\n      .option(\"-p, --pwd <password>\", \"Password\")\n      .option(\"-f, --format <format>\", \"Format (json, table)\")\n      .description(`Jira Integration:\n                            Sub-Commands can be:\n                                issues: To get the issues list from JIRA\n        `)\n      .action(function (subcommand: string | number, options: any) {\n        if (commandHandler.choiceOption.hasOwnProperty.call(commandHandler.choiceOption, subcommand)) {\n          commandHandler.choiceOption[subcommand].call(commandHandler, subcommand, options);\n        } else {\n          console.error(`Sub-Command (jira ${subcommand}... ) is not available`);\n          process.exit(1);\n        }\n      });\n\n  }\n\n  getIssueList() {\n    return new Promise<void>(function (resolve, reject) {\n      logger.info(\"I'm going to get the issue list from the jira cloud...\");\n      const jira_config = CONFIG.get(\"jira\", null);\n      if (jira_config !== null) {\n        const jira_username = jira_config.username;\n        const jira_password = jira_config.auth_token;\n        const jira_project = jira_config.project;\n        const jira_domain = jira_config.domain;\n        const jira_issue_fields = [\"id\", \"key\", \"summary\", \"timetracking\"];\n        const cloudClient = New(JiraCloud, {\n          domain: `${jira_domain}`,\n          username: `${jira_username}`,\n          password: `${jira_password}`,\n          apiMethod: \"rest/api/latest/search\",\n          data: {\n            \"jql\": `project = ${jira_project}`,\n            \"startAt\": 0,\n            \"maxResults\": 5000,\n            \"fields\": jira_issue_fields\n          }\n        });\n        try {\n        } catch (e) {\n          console.error(\"\\u{1F926} Something went wrong \\u{1F926} when trying to get jira issues from the cloud\");\n          reject(e as Error);\n        }\n\n      } else {\n        console.error(\"\\u{1F926} Something went wrong \\u{1F926} You need to set the jira config settings\");\n        reject(new Error(\"\\u{1F926} Something went wrong \\u{1F926} You need to set the jira config settings\"));\n      }\n\n    });\n  }\n\n\n}\n\n\nPackage(\"com.qcobjects.cli.commands.jira\", [\n  CommandHandler\n]);\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA+BA,uBAAiB;AAEjB,6BAA0B;AAC1B,uBAA2E;AAC3E,MAAM,eAAe,iBAAAA,QAAK,QAAQ,WAAW,IAAI;AAE1C,MAAM,uBAAuB,8BAAa;AAAA,EArCjD,OAqC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