UNPKG

railflow

Version:

Railflow is a command line interface for TestRail. Railflow comes with out-of-the-box functionality for processing a wide variety of test frameworks and tools such as JUnit, TestNG, Pytest, XUnit, NUnit, Postman, Katalon, MSTest, Cucumber, SpecFlow, and m

2 lines 288 kB
/*! For license information please see index.bundle.js.LICENSE.txt */ (()=>{"use strict";var e={4964:function(e,t,s){var i=this&&this.__createBinding||(Object.create?function(e,t,s,i){void 0===i&&(i=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,i,r)}:function(e,t,s,i){void 0===i&&(i=s),e[i]=t[s]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)"default"!==s&&Object.prototype.hasOwnProperty.call(e,s)&&i(t,e,s);return r(t,e),t},n=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(r,o){function n(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(n,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.TestRailClient=void 0;const a=o(s(7147)),l=s(2961),c=s(229),u=s(9213),d=s(5760),h=s(6317),p=s(2781),f=s(5555),m=s(7267),g=s(4435),v=s(6425);class _ extends h.AbstractClient{constructor(e,t,s,i,r,o){super(e,r,!0,((e,t,s)=>this.onRetry(e,t,s))),this.attachmentFilters=[],this.errorsCollector=o,this.axiosInstance.defaults.auth={username:t,password:s},this.axiosInstance.defaults.headers["Content-Type"]="application/json",this.axiosInstance.defaults.baseURL=e.concat(e.endsWith("/")?"":"/").concat(_.URL_INDEX_SECTION),i&&i>0&&(this.axiosInstance.defaults.timeout=1e3*i),this.axiosInstance.interceptors.request.use((e=>(e.headers["request-startTime"]=process.hrtime(),e.url=this.complementUrl(e.url),e))),this.axiosInstance.interceptors.response.use((e=>(this.showRequestDuration(e),e)),(e=>n(this,void 0,void 0,(function*(){var t,s,i,r,o,n,a,u;if(e.config&&429===(null===(t=e.response)||void 0===t?void 0:t.status)){let t=_.DEFAULT_RECONNECTION_INTERVALS;if(e.response.headers)for(const s of Object.keys(e.response.headers))if("RETRY-AFTER"===s.toUpperCase()){t=parseInt(e.response.headers[s],10);break}return l.Logger.info('HTTP 429 "Too Many Requests" received from TestRail, retrying request after: '+t+" seconds"),yield c.SleepUtils.sleep(1e3*t),this.axiosInstance.request(e.config)}if("get"===(null===(s=e.config)||void 0===s?void 0:s.method)&&(null===(o=null===(r=null===(i=e.response)||void 0===i?void 0:i.data)||void 0===r?void 0:r.error)||void 0===o?void 0:o.indexOf("is not a valid"))>0)return e.response.data=void 0,this.showRequestDuration(e.response),e.response;if(this.isAttachmentUploadRequest(null===(n=e.config)||void 0===n?void 0:n.headers))return this.showRequestDuration(e.response),void this.showAttachmentUploadFailure(e.config.headers,e.message,null===(u=null===(a=e.response)||void 0===a?void 0:a.data)||void 0===u?void 0:u.error);{const t="Error happened during HTTP call: "+this.createErrorMessage(e);return Promise.reject(new Error(t))}}))))}get(e){return n(this,void 0,void 0,(function*(){u.ExportingStats.countGetRequest();const t=yield this.handleResponse(this.axiosInstance.get(e));return d.BulkGetApiResponseUtils.isBulkResponse(t)?this.getBulkGetApiResponseData(t):t}))}post(e,t){return u.ExportingStats.countPostRequest(),this.handleResponse(this.axiosInstance.post(e,t))}uploadAttachment(e,t,s){for(const e of this.attachmentFilters)if(e.filter(s))return this.createEmptyAttachmentUploadResult();try{const i=this.createEncoder(t,s),r=this.createHeaders(i,t,s);return this.handleAttachmentUploadResponse(this.axiosInstance.post(e,p.Readable.from(i),{headers:r}))}catch(e){throw l.Logger.error(e.stack),e}}downloadAttachment(e,t){return this.handleResponse(this.axiosInstance.get(e,{responseType:"stream"})).then((e=>{e.pipe(a.createWriteStream(t))}))}addAttachmentFilter(e){this.attachmentFilters.push(e)}complementUrl(e){return!e||e.startsWith(_.URL_API_SECTION)?e:e.startsWith(_.URL_API_SECTION.substring(1))?"/".concat(e):_.URL_API_SECTION.concat(e.startsWith("/")?"":"/").concat(e)}onRetry(e,t,s){var i;if(s.url&&this.isAttachmentUploadRequest(s.headers)){s.headers=null!==(i=s.headers)&&void 0!==i?i:{};const e=s.headers[_.HEADER_FILE_NAME],t=s.headers[_.HEADER_FILE_PATH],r=this.createEncoder(e,t),o=this.createHeaders(r,e,t);s.data=p.Readable.from(r),s.headers=o}}isAttachmentUploadRequest(e){if(!e)return!1;const t=e[_.HEADER_FILE_NAME],s=e[_.HEADER_FILE_PATH];return v.StringUtils.isNotBlank(t)&&v.StringUtils.isNotBlank(s)}showAttachmentUploadFailure(e,t,s){const i=e[_.HEADER_FILE_PATH];this.errorsCollector.warn("Failed to upload the attachment file [%s], reason: [%s], details: [%s]",i,t,s)}showRequestDuration(e){if(null==e?void 0:e.config){const t=e.config.headers["request-startTime"],s=process.hrtime(t);l.Logger.debug("duration(ms) = ",Math.round(1e3*s[0]+s[1]/1e6)," , method = ",e.config.method," , url = ",e.config.url)}}handleResponse(e){return e.then((e=>e.data))}handleAttachmentUploadResponse(e){return e.then((e=>{var t;return null!==(t=null==e?void 0:e.data)&&void 0!==t?t:this.createEmptyAttachmentUploadResult()}))}createEmptyAttachmentUploadResult(){return new Promise((e=>{e({attachment_id:""})}))}getBulkGetApiResponseData(e){return n(this,void 0,void 0,(function*(){const t=[];Array.prototype.push.apply(t,d.BulkGetApiResponseUtils.getData(e));const s=d.BulkGetApiResponseUtils.getNextLink(e);if(s){const e=yield this.get(s);Array.prototype.push.apply(t,e)}return t}))}createEncoder(e,t){const s=new m.FormData;return s.set("attachment",(0,g.fileFromPathSync)(t),e),new f.FormDataEncoder(s)}createHeaders(e,t,s){const i={};return Object.entries(e.headers).forEach((([e,t])=>{i[e]=t})),i[_.HEADER_FILE_NAME]=t,i[_.HEADER_FILE_PATH]=s,i}}t.TestRailClient=_,_.URL_INDEX_SECTION="index.php?",_.URL_API_SECTION="/api/v2",_.DEFAULT_RECONNECTION_INTERVALS=20,_.HEADER_FILE_NAME="tr-upload-file-name",_.HEADER_FILE_PATH="tr-upload-file-path"},5980:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TestRailClientFactory=void 0;const i=s(4964);class r{constructor(){}create(e,t,s,r,o,n){return new i.TestRailClient(e,t,s,r,o,n)}}t.TestRailClientFactory=r,r.THE_INSTANCE=new r},8423:function(e,t,s){var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(r,o){function n(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(n,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.TestRailRepository=void 0;const r=s(1932),o=s(9062),n=s(2069),a=s(5046),l=s(6522),c=s(6718),u=s(2455),d=s(1276),h=s(4763),p=s(8026),f=s(2675);t.TestRailRepository=class{constructor(e){this.testRailClient=e,this.sections=new d.CachingSections(e),this.cases=new u.CachingCases(e),this.milestones=new r.Milestones(e),this.plans=new o.Plans(e),this.projects=new n.Projects(e),this.runs=new a.Runs(e),this.suites=new l.Suites(e),this.attachments=new c.Attachments(e),this.users=new h.Users(e),this.configurations=new p.Configurations(e)}getTests(e){return i(this,void 0,void 0,(function*(){const t=e.id;if(t<=0)throw new Error("Run must have an id");return yield this.testRailClient.get("get_tests/"+t.toString())}))}getCaseTypes(){return i(this,void 0,void 0,(function*(){return yield this.testRailClient.get("get_case_types")}))}getPriorities(){return i(this,void 0,void 0,(function*(){return yield this.testRailClient.get("get_priorities")}))}getTemplates(e){return i(this,void 0,void 0,(function*(){const t=e.id;if(!t||t<=0)throw new Error(f.CommonConstants.ERROR_PROJECT_ID_MISSING);return yield this.testRailClient.get("get_templates/"+t.toString())}))}getCaseFields(){return i(this,void 0,void 0,(function*(){return yield this.testRailClient.get("get_case_fields")}))}getResultFields(){return i(this,void 0,void 0,(function*(){return yield this.testRailClient.get("get_result_fields")}))}getStatuses(){return i(this,void 0,void 0,(function*(){return yield this.testRailClient.get("get_statuses")}))}getMilestones(e){return i(this,void 0,void 0,(function*(){const t=e.id;if(!t||t<=0)throw new Error(f.CommonConstants.ERROR_PROJECT_ID_MISSING);return yield this.testRailClient.get("get_milestones/"+t.toString())}))}getUsers(){return i(this,void 0,void 0,(function*(){return yield this.testRailClient.get("get_users")}))}}},4520:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TestRailRepositoryFactory=void 0;const i=s(8423);t.TestRailRepositoryFactory=class{constructor(){}static create(e){return new i.TestRailRepository(e)}}},1172:function(e,t,s){var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(r,o){function n(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(n,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.MilestoneHelper=void 0;const r=s(2961);class o{constructor(e){this.milestones=e.milestones}findOrCreateMilestone(e,t){return i(this,void 0,void 0,(function*(){if(!t)return;const s=t.split("/"),i=s.splice(0,1)[0];let n=yield this.milestones.getMilestoneByName(e,i);return n?yield this.findOrCreateMilestoneRec(e,n,s):(r.Logger.info(o.LOGGING_MESSAGE_CREATING_MILESTONE,t),n=yield this.milestones.createMilestone(e,n,i),this.createMilestoneHierarchy(e,n,s))}))}findOrCreateMilestoneRec(e,t,s){var n;return i(this,void 0,void 0,(function*(){if(0===s.length)return t;const i=s.splice(0,1)[0];let a=null===(n=t.milestones)||void 0===n?void 0:n.find((e=>0===(e.name&&e.name.localeCompare(i,void 0,{sensitivity:"accent"}))));return a?(r.Logger.info("Adding to existing Milestone: %s/%s",t.name,i),yield this.findOrCreateMilestoneRec(e,a,s)):(r.Logger.info(o.LOGGING_MESSAGE_CREATING_MILESTONE,i),a=yield this.milestones.createMilestone(e,t,i),this.createMilestoneHierarchy(e,a,s))}))}createMilestoneHierarchy(e,t,s){return i(this,void 0,void 0,(function*(){let i=t;for(;s.length>0;){const t=s.splice(0,1)[0];i=yield this.milestones.createMilestone(e,i,t)}return i}))}}t.MilestoneHelper=o,o.LOGGING_MESSAGE_CREATING_MILESTONE="Creating Milestone: %s"},6414:function(e,t){var s=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(r,o){function n(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(n,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.TestRailConfigurationFactory=void 0;class i{static getDefaultFactory(){return this.defaultFactory}create(e,t){return s(this,void 0,void 0,(function*(){const s=yield e.getCaseFields(),i=this.extractSystemName(s,10,"custom_steps_separated",t),r=yield e.getResultFields(),o=this.extractSystemName(r,11,"custom_step_results",t);return{getStepResultsFieldName:()=>o,getStepsFieldName:()=>i}}))}extractSystemName(e,t,s,i){for(const s of e)if(s.type_id===t)return s.system_name;return i.warn("Could not find the field for test steps with type=%s, use the default field value '%s'",t,s),s}}t.TestRailConfigurationFactory=i,i.defaultFactory=new i},6718:function(e,t,s){var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(r,o){function n(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(n,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Attachments=void 0;const r=s(9213);t.Attachments=class{constructor(e){this.client=e}addAttachment(e,t,s){return i(this,void 0,void 0,(function*(){if(e.id<=0)throw new Error("Result ID is not set");return r.ExportingStats.countUploadedAttachment(),(yield this.client.uploadAttachment("add_attachment_to_result/"+e.id,t,s)).attachment_id}))}getAttachment(e,t){return i(this,void 0,void 0,(function*(){yield this.client.downloadAttachment("get_attachment/"+e.toString(),t)}))}getAttachmentsForCase(e){return i(this,void 0,void 0,(function*(){return yield this.client.get("get_attachments_for_case/"+e.toString())}))}}},2455:function(e,t,s){var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(r,o){function n(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(n,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.CachingCases=void 0;const r=s(2767),o=s(2961),n=s(4027);class a extends r.Cases{constructor(e){super(e),this.lock=new n.Lock,this.queriedCases=new Map}getCases(e,t){const s=Object.create(null,{getCases:{get:()=>super.getCases}});return i(this,void 0,void 0,(function*(){let i=this.queriedCases.get(t.id);if(i)o.Logger.debug("Get cases from cache. section id = "+t.id);else{yield this.lock.acquire();try{i=this.queriedCases.get(t.id),i?o.Logger.debug("Get cases from cache. section id = "+t.id):(i=yield s.getCases.call(this,e,t),this.queriedCases.set(t.id,i))}finally{this.lock.release()}}return i}))}save(e,t,s){const r=Object.create(null,{save:{get:()=>super.save}});return i(this,void 0,void 0,(function*(){if(!(yield r.save.call(this,e,t,s)))return!1;yield this.lock.acquire();try{const s=this.queriedCases.get(e.id);if(!s)return!0;for(let e=0;e<s.length;e++)if(s[e].id===t.id)return s[e]=t,!0;s.push(t)}finally{this.lock.release()}return!0}))}}t.CachingCases=a},1276:function(e,t,s){var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(r,o){function n(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(n,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.CachingSections=void 0;const r=s(330),o=s(2961),n=s(4027);class a extends r.Sections{constructor(e){super(e),this.lock=new n.Lock,this.queriedSections=new Map}getSections(e,t){const s=Object.create(null,{getSections:{get:()=>super.getSections}});return i(this,void 0,void 0,(function*(){let i=this.queriedSections.get(t);if(i)o.Logger.debug("Get sections from cache. suite id = "+t);else{yield this.lock.acquire();try{i=this.queriedSections.get(t),i?o.Logger.debug("Get sections from cache. suite id = "+t):(i=yield s.getSections.call(this,e,t),this.queriedSections.set(t,i))}finally{this.lock.release()}}return i}))}save(e,t){const s=Object.create(null,{save:{get:()=>super.save}});return i(this,void 0,void 0,(function*(){yield s.save.call(this,e,t),yield this.lock.acquire();try{const e=t.suite_id,s=this.queriedSections.get(e);if(!s)return;for(let e=0;e<s.length;e++)if(s[e].id===t.id)return void(s[e]=t);s.push(t)}finally{this.lock.release()}}))}}t.CachingSections=a},2767:function(e,t,s){var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(r,o){function n(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(n,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Cases=void 0;const r=s(4491),o=s(9213),n=s(2961),a=s(6425);class l{constructor(e){this.client=e}getCaseById(e){return i(this,void 0,void 0,(function*(){return yield this.client.get("get_case/"+e.toString())}))}getCases(e,t){return i(this,void 0,void 0,(function*(){if(this.checkSuite(e),!t)throw new Error("Section is null");if(t.id<=0)throw new Error("Section id must be set");const s="get_cases/"+e.project_id.toString()+"&suite_id="+e.id.toString()+"&section_id="+t.id.toString();return yield this.client.get(s)}))}getCaseByField(e,t,s,r){return i(this,void 0,void 0,(function*(){const i=yield this.getCasesByField(e,t,s,r);return i.length>0?i[0]:void 0}))}getCasesByField(e,t,s,o){return i(this,void 0,void 0,(function*(){const i=t?yield this.getCases(e,t):yield this.getCasesInSuite(e,s===r.Case.TITLE?o:void 0),n=this.prepareCaseName(o);return i.filter((e=>a.StringUtils.equalsIgnoreCase(e[s],n)))}))}getCasesInSuite(e,t){return i(this,void 0,void 0,(function*(){this.checkSuite(e);let s="get_cases/"+e.project_id.toString()+"&suite_id="+e.id.toString();return t&&t.length>0&&(s+="&filter="+encodeURI(this.prepareCaseName(t))),yield this.client.get(s)}))}save(e,t,s){return i(this,void 0,void 0,(function*(){const i=t.id,r=e.id;if(r<=0)throw new Error("Section id must be set");if(t.title=this.prepareCaseName(t.title),t.id>0&&!s)return n.Logger.info("Skipping updating test case %s, ID: %s",t.title,t.id),!1;o.ExportingStats.countUpdatedCase();const a=yield this.client.post(t.id>0?"update_case/"+i.toString():"add_case/"+r.toString(),t);return t.id=a.id,t.section_id=a.section_id,t.suite_id=a.suite_id,!0}))}checkSuite(e){if(!e)throw new Error("Suite is null");if(e.project_id<=0)throw new Error("Project id must be set");if(e.id<=0)throw new Error("Suite id must be set")}prepareCaseName(e){return(e=e.trim()).length>l.CASE_TITLE_MAX_LENGTH?e.substr(0,l.CASE_TITLE_MAX_LENGTH-3).concat("..."):e}}t.Cases=l,l.CASE_TITLE_MAX_LENGTH=250},8026:function(e,t,s){var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(r,o){function n(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(n,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Configurations=void 0;const r=s(9419),o=s(3937),n=s(2675);t.Configurations=class{constructor(e){this.client=e}addConfigurationGroup(e,t){return i(this,void 0,void 0,(function*(){if(t.id<=0)throw new Error(n.CommonConstants.ERROR_PROJECT_ID_MISSING);if(""===e.trim())throw new Error("GroupName should not be null or empty");const s=new r.ConfigGroup;return s.name=e,yield this.client.post("add_config_group/"+t.id.toString(),s)}))}addConfiguration(e,t){return i(this,void 0,void 0,(function*(){if(t.id<=0)throw new Error("ConfigGroup must have an id");if(""===e.trim())throw new Error("ConfigName should not be null or empty");const s=new o.Config;return s.name=e,yield this.client.post("add_config/"+t.id.toString(),s)}))}getConfigGroups(e){return i(this,void 0,void 0,(function*(){const t=e.id;if(t<=0)throw new Error(n.CommonConstants.ERROR_PROJECT_ID_MISSING);return yield this.client.get("get_configs/"+t.toString())}))}}},1932:function(e,t,s){var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(r,o){function n(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(n,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Milestones=void 0;const r=s(7799),o=s(2675);t.Milestones=class{constructor(e){this.client=e}getActiveMilestones(e){return i(this,void 0,void 0,(function*(){if(e.id<=0)throw new Error(o.CommonConstants.ERROR_PROJECT_ID_MISSING);return yield this.client.get("get_milestones/"+e.id+"&is_completed=0")}))}getMilestoneById(e){return i(this,void 0,void 0,(function*(){return yield this.client.get("get_milestone/"+e.toString())}))}getMilestoneByName(e,t){return i(this,void 0,void 0,(function*(){const s=yield this.getActiveMilestones(e);if(0!==s.length)for(const e of s)if(e.name===t)return yield this.getMilestoneById(e.id)}))}createMilestone(e,t,s){var n;return i(this,void 0,void 0,(function*(){if(e.id<=0)throw new Error(o.CommonConstants.ERROR_PROJECT_ID_MISSING);const i=new r.Milestone;if(t){if((null!==(n=t.id)&&void 0!==n?n:0)<=0)throw new Error("Milestone must have an id");i.parent_id=t.id}return i.name=s,yield this.client.post("add_milestone/"+e.id.toString(),i)}))}delete(e){var t;return i(this,void 0,void 0,(function*(){if((null!==(t=e.id)&&void 0!==t?t:0)<=0)throw new Error("Milestone must have an id");yield this.client.post("delete_milestone/"+e.id,"")}))}}},9062:function(e,t,s){var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(r,o){function n(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(n,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Plans=void 0;const r=s(5174),o=s(8555),n=s(6280),a=s(2961),l=s(2675);t.Plans=class{constructor(e){this.client=e}createPlan(e,t,s){var o;return i(this,void 0,void 0,(function*(){if(e.id<=0)throw new Error(l.CommonConstants.ERROR_PROJECT_ID_MISSING);const i=new r.Plan;if(i.name=s,t){if((null!==(o=t.id)&&void 0!==o?o:0)<=0)throw new Error("Milestone must have an id");i.milestone_id=t.id}return a.Logger.info("Creating Test Plan: %s",s),yield this.client.post("add_plan/"+e.id.toString(),i)}))}getPlanByName(e,t){return i(this,void 0,void 0,(function*(){if(e.id<=0)throw new Error(l.CommonConstants.ERROR_PROJECT_ID_MISSING);const s=yield this.client.get("get_plans/"+e.id.toString()+"&is_completed=0");for(const e of s)if(e.name===t)return yield this.getPlan(e.id)}))}updatePlan(e){return i(this,void 0,void 0,(function*(){if(e.id<=0)throw new Error("Plan must have an id");yield this.client.post("update_plan/"+e.id.toString(),e)}))}getPlan(e){return i(this,void 0,void 0,(function*(){return yield this.client.get("get_plan/"+e.toString())}))}addPlanEntry(e,t,s,r,a){return i(this,void 0,void 0,(function*(){if(e.id<=0)throw new Error("Plan must have an id");if(t.id<=0)throw new Error("Suite must have an id");const i=t.id,l=new o.PlanEntry;l.suite_id=i,l.name=s,l.case_ids=r,l.config_ids=a;const c=new n.Run;return c.suite_id=i,c.name=s,c.case_ids=r,c.config_ids=a,l.runs=Array.of(c),yield this.client.post("add_plan_entry/"+e.id.toString(),l)}))}updatePlanEntry(e,t,s){return i(this,void 0,void 0,(function*(){if(e.id<=0)throw new Error("Plan must have an id");const i=t.id;if(i.length<=0)throw new Error("Plan entry must have an id");const r={include_all:!1,case_ids:s,id:t.id,name:t.name,suite_id:t.suite_id,runs:[]};yield this.client.post("update_plan_entry/"+e.id.toString()+"/"+i.toString(),r)}))}updateRunInPlanEntry(e,t){return i(this,void 0,void 0,(function*(){if(e.id<=0)throw new Error("Run must have an id");const s=new n.Run;s.case_ids=t,yield this.client.post("update_run_in_plan_entry/"+e.id.toString(),s),e.case_ids=t}))}closePlan(e){return i(this,void 0,void 0,(function*(){const t=e.id;if(t<=0)throw new Error("Plan must have an id");yield this.client.post("close_plan/"+t.toString(),"")}))}}},2069:function(e,t){var s=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(r,o){function n(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(n,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Projects=void 0,t.Projects=class{constructor(e){this.client=e}getProjectById(e){return s(this,void 0,void 0,(function*(){return yield this.client.get("get_project/"+e.toString())}))}getProjectByName(e){return s(this,void 0,void 0,(function*(){const t=yield this.client.get("get_projects&is_completed=0");for(const s of t)if(s.name===e)return s}))}save(e){return s(this,void 0,void 0,(function*(){if(!e)throw new Error("Project is undefined");const t=yield this.client.post(e.id<=0?"add_project":"update_project/"+e.id.toString(),e);e.id=t.id}))}}},5046:function(e,t,s){var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(r,o){function n(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(n,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Runs=void 0;const r=s(6280),o=s(869),n=s(9213),a=s(2675);t.Runs=class{constructor(e){this.client=e}addRun(e,t,s,o,l){return i(this,void 0,void 0,(function*(){if(e.id<=0)throw new Error(a.CommonConstants.ERROR_PROJECT_ID_MISSING);if(t.id<=0)throw new Error("Suite must have an id");const i=new r.Run;if(i.case_ids=l,i.name=s,i.suite_id=t.id,i.include_all=!1,o){if(!o.id||o.id<=0)throw new Error("Milestone must have an id");i.milestone_id=o.id}return n.ExportingStats.countUpdatedRun(),yield this.client.post("add_run/"+e.id.toString(),i)}))}updateRun(e){return i(this,void 0,void 0,(function*(){if(e.id<=0)throw new Error("Run must have an id");n.ExportingStats.countUpdatedRun(),yield this.client.post("update_run/"+e.id.toString(),e)}))}addResults(e,t){return i(this,void 0,void 0,(function*(){const s=e.id;if(s<=0)throw new Error("Run must have an id");const i=new o.Results;i.results=t,n.ExportingStats.countExportedResult(t.length),(yield this.client.post("add_results_for_cases/"+s.toString(),i)).forEach(((e,s)=>{t[s].id=e.id}))}))}closeRun(e){return i(this,void 0,void 0,(function*(){const t=e.id;if(t<=0)throw new Error("Run must have an id");(yield this.getRunById(t)).completed||(yield this.client.post("close_run/"+t.toString(),""))}))}delete(e){return i(this,void 0,void 0,(function*(){const t=e.id;if(t<=0)throw new Error("Run must have an id");yield this.client.post("delete_run/"+t.toString(),"")}))}getRunById(e){return i(this,void 0,void 0,(function*(){return yield this.client.get("get_run/"+e.toString())}))}getRunByName(e,t,s){return i(this,void 0,void 0,(function*(){if(t.id<=0)throw new Error("Suite must have an id");const i=yield this.getNotCompletedRuns(e,t);if(0!==i.length)for(const e of i)if(e.name===s)return e}))}getNotCompletedRuns(e,t){return i(this,void 0,void 0,(function*(){const s=e.id;if(s<=0)throw new Error(a.CommonConstants.ERROR_PROJECT_ID_MISSING);return yield this.client.get("get_runs/"+s.toString()+"&suite_id="+t.id.toString()+"&is_completed=0")}))}}},330:function(e,t,s){var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(r,o){function n(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(n,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Sections=void 0;const r=s(9213);t.Sections=class{constructor(e){this.client=e}getChildSectionByName(e,t,s){return i(this,void 0,void 0,(function*(){return t?yield this.filterSection(e.project_id,e.id,((e,i)=>e===s&&i===t.id)):yield this.filterSection(e.project_id,e.id,((e,t)=>e===s&&(!t||0===t)))}))}getSectionById(e){return i(this,void 0,void 0,(function*(){return yield this.client.get("get_section/"+e.toString())}))}getSectionByName(e,t){return i(this,void 0,void 0,(function*(){return yield this.filterSection(e.project_id,e.id,(e=>e===t))}))}getSections(e,t){return i(this,void 0,void 0,(function*(){return yield this.client.get("get_sections/"+e.toString()+"&suite_id="+t.toString())}))}save(e,t){return i(this,void 0,void 0,(function*(){if(t.suite_id<=0)throw new Error("Suite id must be set");const s=t.id,i=e.id;if(i<=0)throw new Error("Project id must be set");r.ExportingStats.countUpdatedSection();const o=yield this.client.post(s>0?"update_section/"+s.toString():"add_section/"+i.toString(),t);t.id=o.id}))}filterSection(e,t,s){return i(this,void 0,void 0,(function*(){const i=yield this.getSections(e,t);for(const e of i)if(e.name&&s(e.name,e.parent_id))return e}))}}},6522:function(e,t,s){var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(r,o){function n(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(n,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Suites=void 0;const r=s(9213),o=s(2675);t.Suites=class{constructor(e){this.client=e}getSuiteById(e){return i(this,void 0,void 0,(function*(){return yield this.client.get("get_suite/"+e.toString())}))}getSuiteByName(e,t){return i(this,void 0,void 0,(function*(){const s=yield this.getSuites(e);for(const e of s)if(e.name===t)return e}))}getSuites(e){return i(this,void 0,void 0,(function*(){if(e.id<=0)throw new Error(o.CommonConstants.ERROR_PROJECT_ID_MISSING);return yield this.client.get("get_suites/"+e.id.toString())}))}save(e){return i(this,void 0,void 0,(function*(){const t=e.id,s=e.project_id;r.ExportingStats.countUpdatedSuite();const i=yield this.client.post(t<=0?"add_suite/"+s.toString():"update_suite/"+t.toString(),e);e.id=i.id,e.url=i.url}))}}},4763:function(e,t){var s=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(r,o){function n(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(n,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Users=void 0,t.Users=class{constructor(e){this.client=e}getUsers(e){return s(this,void 0,void 0,(function*(){return yield this.client.get("get_users/"+e.toString())}))}}},6317:function(e,t,s){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractClient=void 0;const r=s(4983),o=i(s(2167)),n=i(s(7188)),a=s(2961),l=s(2675);t.AbstractClient=class{constructor(e,t,s=!0,i){this.url=e,this.axiosInstance=o.default.create({maxContentLength:1/0,maxBodyLength:1/0}),this.retryCallback=i,s&&this.configRetry(),this.proxy=r.ProxyUtil.configProxy(e,t),r.ProxyUtil.setUpProxy(this.axiosInstance.defaults,this.proxy)}createErrorMessage(e){var t,s,i,r,o;const n=null===(t=e.response)||void 0===t?void 0:t.data;return e.message+l.CommonConstants.NEWLINE_DELIMITER+"error data: "+(null==n?void 0:n.error)+l.CommonConstants.NEWLINE_DELIMITER+"URL: "+(null===(s=e.config)||void 0===s?void 0:s.url)+l.CommonConstants.NEWLINE_DELIMITER+"method: "+(null===(i=e.config)||void 0===i?void 0:i.method)+l.CommonConstants.NEWLINE_DELIMITER+"status: "+(null===(r=e.response)||void 0===r?void 0:r.status)+l.CommonConstants.NEWLINE_DELIMITER+"data sent: "+(null===(o=e.config)||void 0===o?void 0:o.data)+l.CommonConstants.NEWLINE_DELIMITER+e.stack}configRetry(){(0,n.default)(this.axiosInstance,{retries:3,shouldResetTimeout:!0,retryCondition:e=>{var t;const s=void 0===(null==e?void 0:e.response)||e.response.status>=500;return s&&(a.Logger.warn("Request failed: %s, reason: %s",null===(t=e.config)||void 0===t?void 0:t.url,this.createErrorMessage(e)),a.Logger.warn("Retrying request...")),s},retryDelay:n.default.exponentialDelay,onRetry:this.retryCallback})}}},2675:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CommonConstants=void 0;class s{}t.CommonConstants=s,s.NEWLINE_DELIMITER="\n",s.TEST_STEPS_DEFAULT_TEMPLATE_NAME="Test Case (Steps)",s.ERROR_PROJECT_ID_MISSING="Project must have an id"},6337:(e,t)=>{var s;Object.defineProperty(t,"__esModule",{value:!0}),t.SuiteMode=void 0,(s=t.SuiteMode||(t.SuiteMode={}))[s.SINGLE=1]="SINGLE",s[s.SINGLE_BASELINES=2]="SINGLE_BASELINES",s[s.MULTIPLE=3]="MULTIPLE",function(e){const t=new Map([[1,e.SINGLE],[2,e.SINGLE_BASELINES],[3,e.MULTIPLE]]);e.cast=function(e){if(!e||e<1||e>3)throw new Error("Invalid suite mode: "+e);return t.get(e)}}(t.SuiteMode||(t.SuiteMode={}))},6655:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AvailableCustomizations=void 0;const i=s(962),r=s(5514),o=s(8500),n=s(4666);class a{constructor(e,t,s,i,r,o,l,c=n.Status.UNTESTED){if(!e)throw new Error("TestRail project is null");if(!t)throw new Error("Custom case fields object is null");if(!s)throw new Error("Custom result fields object is null");if(!i)throw new Error("Case types list is null");if(!r)throw new Error("Priorities list is null");if(!o)throw new Error("Template is null");if(!l)throw new Error("Active user list is null");this.project=e,this.caseFields=a.SYSTEM_CASE_FIELDS.concat(t),this.resultFields=a.SYSTEM_RESULT_FIELDS.concat(s),this.caseTypes=a.cloneArray(i),this.priorities=a.cloneArray(r),this.template=o,this.projectUsers=a.cloneArray(l),this.untestedStatus=c}static createField(e,t,s){return new i.Field(e,t,s,new o.Options)}static cloneArray(e){const t=[];return e.forEach((e=>t.push(Object.assign({},e)))),t}}t.AvailableCustomizations=a,a.SYSTEM_CASE_FIELDS=[a.createField("refs","references",r.FieldType.STRING),a.createField("estimate","estimate",r.FieldType.STRING),a.createField("milestone_id","milestone",r.FieldType.INTEGER)],a.SYSTEM_RESULT_FIELDS=[a.createField("version","version",r.FieldType.STRING),a.createField("elapsed","elapsed",r.FieldType.STRING),a.createField("defects","defects",r.FieldType.STRING)]},1422:function(e,t,s){var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(r,o){function n(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(n,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.AvailableCustomizationsFactory=void 0;const r=s(6655),o=s(1581),n=s(962),a=s(5514),l=s(2104);t.AvailableCustomizationsFactory=class{constructor(e){this.templateFactory=e||o.TemplateFactory.THE_INSTANCE}create(e,t,s,o,n){return i(this,void 0,void 0,(function*(){if(!e)throw new Error("TestRail project is null");const i=yield this.templateFactory.getTemplate(t,e,s,n);let a;return o&&(a=yield l.StatusUtils.getUntestedStatus(o,s,n)),new r.AvailableCustomizations(e,this.getActiveFields(yield s.getCaseFields(),e.id,i.id),this.getActiveFields(yield s.getResultFields(),e.id,i.id),yield s.getCaseTypes(),yield s.getPriorities(),i,yield s.users.getUsers(e.id),a)}))}getActiveFields(e,t,s){const i=[];return e.forEach((e=>{const r=this.findOptionsObject(e,t,s);r&&i.push(new n.Field(e.system_name,e.label,a.FieldType.cast(e.type_id),r))})),i}findOptionsObject(e,t,s){if(!e.is_active)return;if(s&&!e.include_all&&e.template_ids.indexOf(s)<0)return;const i=e.configs.find((e=>{if(!e.context||!e.options)return;const s=e.context;return s.is_global||s.project_ids.indexOf(t)>=0}));return i?i.options:void 0}}},962:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Field=void 0,t.Field=class{constructor(e,t,s,i){this.systemName=e,this.label=t,this.type=s,this.options=i}}},5514:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FieldType=void 0;const i=s(6425);var r;(r=t.FieldType||(t.FieldType={}))[r.STRING=1]="STRING",r[r.INTEGER=2]="INTEGER",r[r.TEXT=3]="TEXT",r[r.URL=4]="URL",r[r.CHECKBOX=5]="CHECKBOX",r[r.DROPDOWN=6]="DROPDOWN",r[r.USER=7]="USER",r[r.DATE=8]="DATE",r[r.MILESTONE=9]="MILESTONE",r[r.STEPS=10]="STEPS",r[r.STEP_RESULTS=11]="STEP_RESULTS",r[r.MULTI_SELECT=12]="MULTI_SELECT",r[r.UNKNOWN=-1]="UNKNOWN",function(e){const t=new Map(Object.keys(e).filter(i.StringUtils.isNumeric).map((e=>[parseInt(e,10),parseInt(e,10)])));e.cast=function(s){return t.get(s)||e.UNKNOWN}}(t.FieldType||(t.FieldType={}))},1581:function(e,t,s){var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(r,o){function n(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(n,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.TemplateFactory=void 0;const r=s(6425),o=s(2675);class n{getTemplate(e,t,s,n){return i(this,void 0,void 0,(function*(){const i=yield s.getTemplates(t);if(!i||0===i.length)throw new Error("Cannot find any templates for project: "+t.name);if(e){const s=i.find((t=>r.StringUtils.equalsIgnoreCase(e,t.name)));if(s)return s;n.warn("Invalid Test Case Template: ["+e+"]. Valid Test Case Templates for Project: ["+t.name+"] are: ["+i.map((e=>r.StringUtils.doubleQuoted(e.name)))+"]")}let a,l;for(const e of i)e.name.toLowerCase()===o.CommonConstants.TEST_STEPS_DEFAULT_TEMPLATE_NAME.toLowerCase()&&(a=e),e.is_default&&(l=e);if(a)return a;if(!l)throw new Error("Cannot find default template in TestRail project: "+t.name);return l}))}}t.TemplateFactory=n,n.THE_INSTANCE=new n},4491:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Case=void 0;class s{constructor(){this.id=0,this.title="",this.created_by=0,this.updated_by=0,this.section_id=0,this.suite_id=0,this.template_id=0}}t.Case=s,s.TITLE="title"},3937:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Config=void 0,t.Config=class{constructor(){this.id=0,this.name=""}}},9419:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ConfigGroup=void 0,t.ConfigGroup=class{constructor(){this.id=0,this.name="",this.configs=[]}}},8500:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Options=t.Context=t.Config=t.Field=void 0,t.Field=class{constructor(){this.id=0,this.name="",this.label="",this.system_name="",this.description="",this.type_id=0,this.is_active=!1,this.include_all=!1,this.template_ids=[],this.configs=[],this.display_order=0}},t.Config=class{},t.Context=class{constructor(){this.is_global=!1,this.project_ids=[]}},t.Options=class{constructor(){this.is_required=!1,this.default_value="",this.items=""}}},7799:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Milestone=void 0,t.Milestone=class{constructor(){this.id=0,this.name=""}}},5174:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Plan=void 0,t.Plan=class{constructor(){this.entries=[],this.id=0,this.name="",this.project_id=0}}},8555:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PlanEntry=void 0,t.PlanEntry=class{constructor(){this.id="",this.name="",this.runs=[],this.suite_id=0,this.case_ids=[],this.include_all=!1}}},1397:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Result=void 0,t.Result=class{constructor(){this.id=0}}},869:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Results=void 0,t.Results=class{constructor(){this.results=[]}}},6280:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Run=void 0,t.Run=class{constructor(){this.case_ids=[],this.completed=!1,this.config_ids=[],this.id=0,this.suite_id=0,this.include_all=!1}}},1038:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RunContext=void 0,t.RunContext=class{constructor(e,t){this.run=e,this.planEntry=t}}},2635:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Section=void 0,t.Section=class{constructor(){this.id=0,this.suite_id=0}}},4666:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Status=void 0;class s{constructor(e,t){this.id=e,this.name=t,this.label=t}static fromString(e){return this.DEFAULT_TR_STATUS_MAP.get(e.toUpperCase())}static getTRDefaultStatusName(e){return s.PASSED_ID===e?s.PASSED:s.FAILED_ID===e?s.FAILED:s.UNTESTED}}t.Status=s,s.PASSED_ID=1,s.BLOCKED_ID=2,s.UNTESTED_ID=3,s.RETEST_ID=4,s.FAILED_ID=5,s.UNTESTED=new s(s.UNTESTED_ID,"Untested"),s.PASSED=new s(s.PASSED_ID,"Passed"),s.FAILED=new s(s.FAILED_ID,"Failed"),s.BLOCKED=new s(s.BLOCKED_ID,"Blocked"),s.RETEST=new s(s.RETEST_ID,"Retest"),s.DEFAULT_TR_STATUS_MAP=new Map([[s.PASSED.name.toUpperCase(),s.PASSED],[s.BLOCKED.name.toUpperCase(),s.BLOCKED],[s.UNTESTED.name.toUpperCase(),s.UNTESTED],[s.RETEST.name.toUpperCase(),s.RETEST],[s.FAILED.name.toUpperCase(),s.FAILED]])},7875:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Suite=void 0,t.Suite=class{constructor(){this.id=0,this.is_baseline=!1,this.is_completed=!1,this.is_master=!1,this.project_id=0}}},5760:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BulkGetApiResponseUtils=void 0,t.BulkGetApiResponseUtils=class{constructor(){}static isBulkResponse(e){return!!e&&!Array.isArray(e)&&"_links"in e&&"next"in e._links}static getNextLink(e){return e._links.next}static getData(e){for(const[t,s]of Object.entries(e))if(Array.isArray(s))return s;return[]}}},4027:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Lock=void 0;const i=s(1239);t.Lock=class{constructor(){this.lock=!1,this.eventEmitter=new i.EventEmitter}acquire(){return new Promise((e=>{if(!this.lock)return this.lock=!0,e();const t=()=>{if(!this.lock)return this.lock=!0,this.eventEmitter.removeListener("release",t),e()};this.eventEmitter.on("release",t)}))}release(){this.lock=!1,setImmediate((()=>this.eventEmitter.emit("release")))}}},4983:function(e,t,s){var i=this&&this.__createBinding||(Object.create?function(e,t,s,i){void 0===i&&(i=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,i,r)}:function(e,t,s,i){void 0===i&&(i=s),e[i]=t[s]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)"default"!==s&&Object.prototype.hasOwnProperty.call(e,s)&&i(t,e,s);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ProxyUtil=void 0;const n=s(768),a=s(3510),l=o(s(9834));class c{constructor(){}static setUpProxy(e,t){if(t)t instanceof n.SocksProxyAgent?e.httpAgent=e.httpsAgent=t:t instanceof a.HttpsProxyAgent?e.httpsAgent=t:e.proxy=t;else{const t={timeout:0};e.httpAgent=new l.default(t),e.httpsAgent=new l.HttpsAgent(t)}}static configProxy(e,t){if(!t)return;const s=c.createSocksOrHttpsProxyAgent(e,t);if(s)return s;const i=new RegExp("https?://(?:([\\-\\w\\.]+):?(.+)?@)?([\\-\\w\\.]+):(\\d+)").exec(t);return!i||i.length<5?void 0:{host:i[3],port:parseInt(i[4],10),auth:{username:i[1]?i[1]:"",password:i[2]?i[2]:""}}}static createSocksOrHttpsProxyAgent(e,t){let s;if(t.toLowerCase().startsWith("socks"))s=new n.SocksProxyAgent(t),c.initSockAgent(s);else{if(!e.toLowerCase().startsWith("https://"))return;s=new a.HttpsProxyAgent(t),c.initHttpsAgent(s)}return s}static initHttpsAgent(e){e.timeout=0,e.options.keepAlive=!1,e.options.maxSockets=0,e.options.maxFreeSockets=256,e.options.keepAliveMsecs=0,e.options.timeout=0}static initSockAgent(e){e.timeout=0,e.options.keepAlive=!0,e.options.maxSockets=0,e.options.maxFreeSockets=256,e.options.keepAliveMsecs=0,e.options.timeout=0}}t.ProxyUtil=c},2104:function(e,t,s){var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(r,o){function n(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(n,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.StatusUtils=void 0;const r=s(4666);t.StatusUtils=class{static getUntestedStatus(e,t,s){return i(this,void 0,void 0,(function*(){let i;if(e.length>0){if(i=r.Status.fromString(e),i)return i;const o=yield t.getStatuses();for(const t of o)if(t.label.toUpperCase()===e.toUpperCase())return t;s.warn("Could not find the status with label '%s', continue with the default 'Untested' status",e)}return r.Status.UNTESTED}))}}},7160:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorsCollector=void 0;const i=s(2961),r=s(6425);t.ErrorsCollector=class{constructor(){this.warnings=[]}warn(e,...t){i.Logger.warn(e,...t),this.warnings.push(r.StringUtils.format(e,...t))}logAllWarnings(){this.warnings.forEach((e=>i.Logger.warn(e)))}}},9213:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExportingStats=void 0;const i=s(592),r=s(2961);class o{constructor(){}static startStats(e){o.projectName=e,o.startTime=(new Date).getTime()}static countGetRequest(){o.getRequestCount++}static countPostRequest(){o.postRequestCount++}static countUpdatedSuite(){o.updatedSuiteCount++}static countUpdatedSection(){o.updatedSectionCount++}static countUpdatedCase(){o.updatedCaseCount++}static countUpdatedRun(){o.updatedRunCount++}static countExportedResult(e){o.exportedResultCount+=e}static countUploadedAttachment(){o.uploadedAttachmentCount++}static showStats(){o.stopTime=(new Date).getTime(),r.Logger.debug(i.PromptUtils.buildHeader("Exporting Project Statistics")),r.Logger.debug(i.PromptUtils.buildLine("Project Name = "+o.projectName)),r.Logger.debug(i.PromptUtils.buildLine("Updated Suite Count = "+o.updatedSuiteCount.toString())),r.Logger.debug(i.PromptUtils.buildLine("Updated Section Count = "+o.updatedSectionCount.toString())),r.Logger.debug(i.PromptUtils.buildLine("Updated Case Count = "+o.updatedCaseCount.toString())),r.Logger.debug(i.PromptUtils.buildLine("Updated Run Count = "+o.updatedRunCount.toString())),r.Logger.debug(i.PromptUtils.buildLine("Exported Result Count = "+o.exportedResultCount.toString())),r.Logger.debug(i.PromptUtils.buildLine("Uploaded Attachment Count = "+o.uploadedAttachmentCount.toString())),r.Logger.debug(i.PromptUtils.buildLine("Total Get Request Count = "+o.getRequestCount.toString())),r.Logger.debug(i.PromptUtils.buildLine("Total Post Request Count = "+o.postRequestCount.toString())),r.Logger.debug(i.PromptUtils.buildLine("Exporting Time (sec) = "+((this.stopTime-this.startTime)/1e3).toString())),r.Logger.debug(i.PromptUtils.buildBottom())}}t.ExportingStats=o,o.stopTime=0,o.projectName="",o.getRequestCount=0,o.postRequestCount=0,o.updatedSuiteCount=0,o.updatedSectionCount=0,o.updatedCaseCount=0,o.updatedRunCount=0,o.exportedResultCount=0,o.uploadedAttachmentCount=0},6205:function(e,t,s){var i=this&&this.__createBinding||(Object.create?function(e,t,s,i){void 0===i&&(i=s);var r=Object.getOwnPropertyDescriptor(t,s);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,i,r)}:function(e,t,s,i){void 0===i&&(i=s),e[i]=t[s]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)"default"!==s&&Object.prototype.hasOwnProperty.call(e,s)&&i(t,e,s);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.FileUtils=void 0;const n=o(s(7147)),a=o(s(1017));t.FileUtils=class{static base64ToFile(e,t){n.writeFileSync(t,e,{encoding:"base64"})}static createUniqueName(e){const t=a.extname(e),s=e.substring(0,e.length-t.length);let i=!1,r=e,o=0;for(;;){if(o++,i=n.existsSync(r),!i)return r;r=s+"_"+o+t}}constructor(){}}},2961:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Logger=void 0;const i=s(8094);class r{constructor(){}static debug(e,...t){r.logger.debug(e,...t)}static info(e,...t){r.logger.info(e,...t)}static warn(e,...t){r.logger.warn(e,...t)}static error(e,...t){r.logger.error(e,...t)}static config(e){i.configure(e)}}t.Logger=r,r.logger=i.getLogger("")},3506:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PrimitiveUtils=void 0;class s{constructor(){}static getBoolean(e){return"boolean"==typeof e?e:s.TRUE_VALUES.indexOf(e)>=0}}t.PrimitiveUtils=s,s.TRUE_VALUES=["true","1",1,"on","yes"]},592:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PromptUtils=void 0;class s{static buildHeader(e){if(e.length>s.MAX_LINE_LENGTH)return"# "+e;const t=(s.MAX_LINE_LENGTH-e.length)/2,i=s.MAX_LINE_LENGTH-t-e.length;let r="";for(let e=0;e<t;e++)r+="#";r+=" ",r+=e,r+=" ";for(let e=0;e<i;e++)r+="#";return r}static buildBottom(){return"####################################################################################################"}static buildLine(e){if(e.length>s.MAX_LINE_LENGTH)return"# "+e;let t=e;for(;t.length<s.MAX_LINE_LENGTH;)t+=" ";return"# "+t+"#"}static buildAsciiHeader(){return"\n ____ _ _ __ _ \n| _ \\ __ _ (_)| | / _|| | ___ __ __\n| |_) |/ _` || || || |_ | | / _ \\\\ \\ /\\ / /\n| _ <| (_| || || || _|| || (_) |\\ V V / \n|_| \\_\\\\__,_||_||_||_| |_| \\___/ \\_/\\_/ \n "}}t.PromptUtils=s,s.MAX_LINE_LENGTH=97},229:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SleepUtils=void 0,t.SleepUtils=class{constructor(){}static sleep(e){return new Promise((t=>setTimeout(t,e)))}}},6425:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StringUtils=void 0;class s{static equalsIgnoreCase(e,t){return e?0===e.localeCompare(t,void 0,{sensitivity:"accent"}):!t}static isNotBlank(e){return void 0!==e&&e.trim().length>0}static format(e,...t){let s=e;return t.forEach((e=>{s=s.replace("%s",e)})),s}static doubleQuoted(e){return'"'+e+'"'}static isNumeric(e){return void 0!==e&&!isNaN(parseInt(e,10))}static getNumber(e,t){return s.isNumeric(e)?parseInt(e,10):t}static trimOrDefault(e,t){if(!e)return t;const s=e.trim();return 0===s.length?t:s}}t.StringUtils=s},5171:function(e,t,s){var i=this&&this.__awaiter||function(e,t,s,i){return new(s||(s=Promise))((function(r,o){function n(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(n,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.EventClient=void 0;const r=s(3780),o=s(6317);class n extends o.AbstractClient{constructor(e,t){super(e&&e.length>0?e:n.REGISTER_EVENT_URL,t,!1),this.axiosInstance.interceptors.request.use((e=>(e.timeout=n.REGISTER_TIMEOUT,e.headers["Content-Type"]="application/json",e)))}register(e,t,s,o,n){return i(this,void 0,void 0,(function*(){const i=new r.RegisterEvent(e,t,s,o,n);return this.handleResponse(this.axiosInstance.post(this.url,i))}))}handleResponse(e){return e.then((e=>e.data)).catch((e=>({result:1,m