@dlenroc/testrail
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -5,2 +5,10 @@ # Changelog | ||
### [1.0.1](https://github.com/dlenroc/node-testrail-api/compare/v1.0.0...v1.0.1) (2020-11-16) | ||
### Bug Fixes | ||
* `response.clone()` from node-fetch causes nodejs to crash ([8e650d6](https://github.com/dlenroc/node-testrail-api/commit/8e650d63d3a948bfb3f13d9e7a0126c5216af2cb)) | ||
* remove `_filter` suffix from type declaration ([38b2cf6](https://github.com/dlenroc/node-testrail-api/commit/38b2cf6d52a82b9469de7d4df190a7a3175d74eb)) | ||
## 1.0.0 (2020-10-09) | ||
@@ -7,0 +15,0 @@ |
@@ -282,3 +282,3 @@ /// <reference types="node" /> | ||
priority_id?: string; | ||
refs_filter?: string; | ||
refs?: string; | ||
section_id?: number; | ||
@@ -308,3 +308,3 @@ template_id?: string; | ||
interface ResultFilters extends UnknownObject { | ||
defects_filter?: string; | ||
defects?: string; | ||
limit?: number; | ||
@@ -318,3 +318,3 @@ offset?: number; | ||
created_by?: string; | ||
defects_filter?: string; | ||
defects?: string; | ||
limit?: number; | ||
@@ -332,3 +332,3 @@ offset?: number; | ||
milestone_id?: string; | ||
refs_filter?: string; | ||
refs?: string; | ||
suite_id?: string; | ||
@@ -335,0 +335,0 @@ } |
@@ -1,2 +0,2 @@ | ||
"use strict";const t=require("node-fetch"),e=require("form-data");class r extends Error{constructor(t){super(t),this.name="TestRailException"}}class s{constructor(t){this.username=(null==t?void 0:t.username)||(null==t?void 0:t.user),this.password=null==t?void 0:t.password,this.baseURL=((null==t?void 0:t.host)||"")+"/index.php?/api/v2/"}addAttachmentToPlan(t,e){return this._api("POST","add_attachment_to_plan/"+t,{form:{attachment:e}})}addAttachmentToPlanEntry(t,e,r){return this._api("POST",`add_attachment_to_plan_entry/${t}/${e}`,{form:{attachment:r}})}addAttachmentToResult(t,e){return this._api("POST","add_attachment_to_result/"+t,{form:{attachment:e}})}addAttachmentToRun(t,e){return this._api("POST","add_attachment_to_run/"+t,{form:{attachment:e}})}getAttachmentsForCase(t){return this._api("GET","get_attachments_for_case/"+t)}getAttachmentsForPlan(t){return this._api("GET","get_attachments_for_plan/"+t)}getAttachmentsForPlanEntry(t,e){return this._api("GET",`get_attachments_for_plan_entry/${t}/${e}`)}getAttachmentsForRun(t){return this._api("GET","get_attachments_for_run/"+t)}getAttachmentsForTest(t){return this._api("GET","get_attachments_for_test/"+t)}getAttachment(t){return this._api("GET","get_attachment/"+t)}deleteAttachment(t){return this._api("POST","delete_attachment/"+t)}getCase(t){return this._api("GET","get_case/"+t)}getCases(t,e){return this._api("GET","get_cases/"+t,{query:e})}getHistoryForCase(t){return this._api("GET","get_history_for_case/"+t)}addCase(t,e){return this._api("POST","add_case/"+t,{json:e})}updateCase(t,e){return this._api("POST","update_case/"+t,{json:e})}updateCases(t,e){return this._api("POST","update_cases/"+t,{json:e})}deleteCase(t){return this._api("POST","delete_case/"+t)}deleteCases(t,e){return this._api("POST","delete_cases/"+t,{json:e})}getCaseFields(){return this._api("GET","get_case_fields")}addCaseField(t){return this._api("POST","add_case_field",{json:t})}getCaseTypes(){return this._api("GET","get_case_types")}getConfigs(t){return this._api("GET","get_configs/"+t)}addConfigGroup(t,e){return this._api("POST","add_config_group/"+t,{json:e})}addConfig(t,e){return this._api("POST","add_config/"+t,{json:e})}updateConfigGroup(t,e){return this._api("POST","update_config_group/"+t,{json:e})}updateConfig(t,e){return this._api("POST","update_config/"+t,{json:e})}deleteConfigGroup(t){return this._api("POST","delete_config_group/"+t)}deleteConfig(t){return this._api("POST","delete_config/"+t)}getMilestone(t){return this._api("GET","get_milestone/"+t)}getMilestones(t,e){return this._api("GET","get_milestones/"+t,{query:e})}addMilestone(t,e){return this._api("POST","add_milestone/"+t,{json:e})}updateMilestone(t,e){return this._api("POST","update_milestone/"+t,{json:e})}deleteMilestone(t){return this._api("POST","delete_milestone/"+t)}getPlan(t){return this._api("GET","get_plan/"+t)}getPlans(t,e){return this._api("GET","get_plans/"+t,{query:e})}addPlan(t,e){return this._api("POST","add_plan/"+t,{json:e})}addPlanEntry(t,e){return this._api("POST","add_plan_entry/"+t,{json:e})}addRunToPlanEntry(t,e,r){return this._api("POST",`add_run_to_plan_entry/${t}/${e}`,{json:r})}updatePlan(t,e){return this._api("POST","update_plan/"+t,{json:e})}updatePlanEntry(t,e,r){return this._api("POST",`update_plan_entry/${t}/${e}`,{json:r})}updateRunInPlanEntry(t,e,r){return this._api("POST",`update_run_in_plan_entry/${t}/${e}`,{json:r})}closePlan(t){return this._api("POST","close_plan/"+t)}deletePlan(t){return this._api("POST","delete_plan/"+t)}deletePlanEntry(t,e){return this._api("POST",`delete_plan_entry/${t}/${e}`)}deleteRunFromPlanEntry(t){return this._api("POST","delete_run_from_plan_entry/"+t)}getPriorities(){return this._api("GET","get_priorities")}getProject(t){return this._api("GET","get_project/"+t)}getProjects(t){return this._api("GET","get_projects",{query:t})}addProject(t){return this._api("POST","add_project",{json:t})}updateProject(t,e){return this._api("POST","update_project/"+t,{json:e})}deleteProject(t){return this._api("POST","delete_project/"+t)}getReports(t){return this._api("GET","get_reports/"+t)}runReport(t){return this._api("POST","run_report/"+t)}getResults(t,e){return this._api("GET","get_results/"+t,{query:e})}getResultsForCase(t,e,r){return this._api("GET",`get_results_for_case/${t}/${e}`,{query:r})}getResultsForRun(t,e){return this._api("GET","get_results_for_run/"+t,{query:e})}addResult(t,e){return this._api("POST","add_result/"+t,{json:e})}addResultForCase(t,e,r){return this._api("POST",`add_result_for_case/${t}/${e}`,{json:r})}addResults(t,e){return this._api("POST","add_results/"+t,{json:e})}addResultsForCases(t,e){return this._api("POST","add_results_for_cases/"+t,{json:e})}getResultFields(){return this._api("GET","get_result_fields")}getRun(t){return this._api("GET","get_run/"+t)}getRuns(t,e){return this._api("GET","get_runs/"+t,{query:e})}addRun(t,e){return this._api("POST","add_run/"+t,{json:e})}updateRun(t,e){return this._api("POST","update_run/"+t,{json:e})}closeRun(t){return this._api("POST","close_run/"+t)}deleteRun(t){return this._api("POST","delete_run/"+t)}getSection(t){return this._api("GET","get_section/"+t)}getSections(t,e){return this._api("GET","get_sections/"+t,{query:e})}addSection(t,e){return this._api("POST","add_section/"+t,{json:e})}updateSection(t,e){return this._api("POST","update_section/"+t,{json:e})}deleteSection(t){return this._api("POST","delete_section/"+t)}getStatuses(){return this._api("GET","get_statuses")}getSuite(t){return this._api("GET","get_suite/"+t)}getSuites(t){return this._api("GET","get_suites/"+t)}addSuite(t,e){return this._api("POST","add_suite/"+t,{json:e})}updateSuite(t,e){return this._api("POST","update_suite/"+t,{json:e})}deleteSuite(t){return this._api("POST","delete_suite/"+t)}getTemplates(t){return this._api("GET","get_templates/"+t)}getTest(t){return this._api("GET","get_test/"+t)}getTests(t,e){return this._api("GET","get_tests/"+t,{query:e})}getUser(t){return this._api("GET","get_user/"+t)}getCurrentUser(){return this._api("GET","get_current_user")}getUserByEmail(t){return this._api("GET","get_user_by_email",{query:{email:t}})}getUsers(t){return this._api("GET","get_users",{query:t})}async _api(r,i,{query:_,json:u,form:o}={}){const p={},d=this.baseURL+i+((h=_)?"&"+new URLSearchParams(h):"");var h,l;let c;if(this.username&&this.password&&(p.Authorization="Basic "+(l=`${this.username}:${this.password}`,"undefined"!=typeof btoa?btoa(l):Buffer.from(l).toString("base64"))),o||(p["Content-Type"]="application/json"),u)c=JSON.stringify(u);else if(o){c=new e;for(const[t,e]of Object.entries(o))e.name&&e.value?n(c,t,e.value,e.name):n(c,t,e)}for(;;){const e=await t(d,{method:r,body:c,headers:p});if(429===e.status){const t=1e3*parseInt(e.headers.get("Retry-After")||"1");await a(t);continue}if(409===e.status){await a(1e4);continue}const n=(e.headers.get("Content-Type")||"").includes("json")?await e.clone().json().catch(()=>e.text()):await e.blob();if(e.ok)return n;throw new s.Exception(n.error||"No additional error message received")}}}function n(t,e,r,s){if(s&&"undefined"!=typeof Blob){const n=r instanceof Blob?r:new Blob([r]);t.append(e,n,s)}else t.append(e,r,s)}function a(t){return new Promise(e=>setTimeout(e,t))}s.default=s,s.Exception=r,module.exports=s; | ||
"use strict";const t=require("node-fetch"),e=require("form-data");class r extends Error{constructor(t){super(t),this.name="TestRailException"}}class s{constructor(t){this.username=(null==t?void 0:t.username)||(null==t?void 0:t.user),this.password=null==t?void 0:t.password,this.baseURL=((null==t?void 0:t.host)||"")+"/index.php?/api/v2/"}addAttachmentToPlan(t,e){return this._api("POST","add_attachment_to_plan/"+t,{form:{attachment:e}})}addAttachmentToPlanEntry(t,e,r){return this._api("POST",`add_attachment_to_plan_entry/${t}/${e}`,{form:{attachment:r}})}addAttachmentToResult(t,e){return this._api("POST","add_attachment_to_result/"+t,{form:{attachment:e}})}addAttachmentToRun(t,e){return this._api("POST","add_attachment_to_run/"+t,{form:{attachment:e}})}getAttachmentsForCase(t){return this._api("GET","get_attachments_for_case/"+t)}getAttachmentsForPlan(t){return this._api("GET","get_attachments_for_plan/"+t)}getAttachmentsForPlanEntry(t,e){return this._api("GET",`get_attachments_for_plan_entry/${t}/${e}`)}getAttachmentsForRun(t){return this._api("GET","get_attachments_for_run/"+t)}getAttachmentsForTest(t){return this._api("GET","get_attachments_for_test/"+t)}getAttachment(t){return this._api("GET","get_attachment/"+t)}deleteAttachment(t){return this._api("POST","delete_attachment/"+t)}getCase(t){return this._api("GET","get_case/"+t)}getCases(t,e){return this._api("GET","get_cases/"+t,{query:e})}getHistoryForCase(t){return this._api("GET","get_history_for_case/"+t)}addCase(t,e){return this._api("POST","add_case/"+t,{json:e})}updateCase(t,e){return this._api("POST","update_case/"+t,{json:e})}updateCases(t,e){return this._api("POST","update_cases/"+t,{json:e})}deleteCase(t){return this._api("POST","delete_case/"+t)}deleteCases(t,e){return this._api("POST","delete_cases/"+t,{json:e})}getCaseFields(){return this._api("GET","get_case_fields")}addCaseField(t){return this._api("POST","add_case_field",{json:t})}getCaseTypes(){return this._api("GET","get_case_types")}getConfigs(t){return this._api("GET","get_configs/"+t)}addConfigGroup(t,e){return this._api("POST","add_config_group/"+t,{json:e})}addConfig(t,e){return this._api("POST","add_config/"+t,{json:e})}updateConfigGroup(t,e){return this._api("POST","update_config_group/"+t,{json:e})}updateConfig(t,e){return this._api("POST","update_config/"+t,{json:e})}deleteConfigGroup(t){return this._api("POST","delete_config_group/"+t)}deleteConfig(t){return this._api("POST","delete_config/"+t)}getMilestone(t){return this._api("GET","get_milestone/"+t)}getMilestones(t,e){return this._api("GET","get_milestones/"+t,{query:e})}addMilestone(t,e){return this._api("POST","add_milestone/"+t,{json:e})}updateMilestone(t,e){return this._api("POST","update_milestone/"+t,{json:e})}deleteMilestone(t){return this._api("POST","delete_milestone/"+t)}getPlan(t){return this._api("GET","get_plan/"+t)}getPlans(t,e){return this._api("GET","get_plans/"+t,{query:e})}addPlan(t,e){return this._api("POST","add_plan/"+t,{json:e})}addPlanEntry(t,e){return this._api("POST","add_plan_entry/"+t,{json:e})}addRunToPlanEntry(t,e,r){return this._api("POST",`add_run_to_plan_entry/${t}/${e}`,{json:r})}updatePlan(t,e){return this._api("POST","update_plan/"+t,{json:e})}updatePlanEntry(t,e,r){return this._api("POST",`update_plan_entry/${t}/${e}`,{json:r})}updateRunInPlanEntry(t,e,r){return this._api("POST",`update_run_in_plan_entry/${t}/${e}`,{json:r})}closePlan(t){return this._api("POST","close_plan/"+t)}deletePlan(t){return this._api("POST","delete_plan/"+t)}deletePlanEntry(t,e){return this._api("POST",`delete_plan_entry/${t}/${e}`)}deleteRunFromPlanEntry(t){return this._api("POST","delete_run_from_plan_entry/"+t)}getPriorities(){return this._api("GET","get_priorities")}getProject(t){return this._api("GET","get_project/"+t)}getProjects(t){return this._api("GET","get_projects",{query:t})}addProject(t){return this._api("POST","add_project",{json:t})}updateProject(t,e){return this._api("POST","update_project/"+t,{json:e})}deleteProject(t){return this._api("POST","delete_project/"+t)}getReports(t){return this._api("GET","get_reports/"+t)}runReport(t){return this._api("POST","run_report/"+t)}getResults(t,e){return this._api("GET","get_results/"+t,{query:e})}getResultsForCase(t,e,r){return this._api("GET",`get_results_for_case/${t}/${e}`,{query:r})}getResultsForRun(t,e){return this._api("GET","get_results_for_run/"+t,{query:e})}addResult(t,e){return this._api("POST","add_result/"+t,{json:e})}addResultForCase(t,e,r){return this._api("POST",`add_result_for_case/${t}/${e}`,{json:r})}addResults(t,e){return this._api("POST","add_results/"+t,{json:e})}addResultsForCases(t,e){return this._api("POST","add_results_for_cases/"+t,{json:e})}getResultFields(){return this._api("GET","get_result_fields")}getRun(t){return this._api("GET","get_run/"+t)}getRuns(t,e){return this._api("GET","get_runs/"+t,{query:e})}addRun(t,e){return this._api("POST","add_run/"+t,{json:e})}updateRun(t,e){return this._api("POST","update_run/"+t,{json:e})}closeRun(t){return this._api("POST","close_run/"+t)}deleteRun(t){return this._api("POST","delete_run/"+t)}getSection(t){return this._api("GET","get_section/"+t)}getSections(t,e){return this._api("GET","get_sections/"+t,{query:e})}addSection(t,e){return this._api("POST","add_section/"+t,{json:e})}updateSection(t,e){return this._api("POST","update_section/"+t,{json:e})}deleteSection(t){return this._api("POST","delete_section/"+t)}getStatuses(){return this._api("GET","get_statuses")}getSuite(t){return this._api("GET","get_suite/"+t)}getSuites(t){return this._api("GET","get_suites/"+t)}addSuite(t,e){return this._api("POST","add_suite/"+t,{json:e})}updateSuite(t,e){return this._api("POST","update_suite/"+t,{json:e})}deleteSuite(t){return this._api("POST","delete_suite/"+t)}getTemplates(t){return this._api("GET","get_templates/"+t)}getTest(t){return this._api("GET","get_test/"+t)}getTests(t,e){return this._api("GET","get_tests/"+t,{query:e})}getUser(t){return this._api("GET","get_user/"+t)}getCurrentUser(){return this._api("GET","get_current_user")}getUserByEmail(t){return this._api("GET","get_user_by_email",{query:{email:t}})}getUsers(t){return this._api("GET","get_users",{query:t})}async _api(r,i,{query:u,json:_,form:o}={}){var p;const d={},h=this.baseURL+i+((l=u)?"&"+new URLSearchParams(l):"");var l,c;let T;if(this.username&&this.password&&(d.Authorization="Basic "+(c=`${this.username}:${this.password}`,"undefined"!=typeof btoa?btoa(c):Buffer.from(c).toString("base64"))),o||(d["Content-Type"]="application/json"),_)T=JSON.stringify(_);else if(o){T=new e;for(const[t,e]of Object.entries(o))e.name&&e.value?n(T,t,e.value,e.name):n(T,t,e)}for(;;){const e=await t(h,{method:r,body:T,headers:d});if(429===e.status){const t=1e3*parseInt(e.headers.get("Retry-After")||"1");await a(t);continue}if(409===e.status){await a(1e4);continue}const n=(null===(p=e.headers.get("Content-Type"))||void 0===p?void 0:p.includes("json"))?await e.json().catch(()=>({})):await e.blob();if(e.ok)return n;throw new s.Exception(n.error||"No additional error message received")}}}function n(t,e,r,s){if(s&&"undefined"!=typeof Blob){const n=r instanceof Blob?r:new Blob([r]);t.append(e,n,s)}else t.append(e,r,s)}function a(t){return new Promise(e=>setTimeout(e,t))}s.default=s,s.Exception=r,module.exports=s; | ||
//# sourceMappingURL=TestRail.node.js.map |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).TestRail=e()}(this,(function(){"use strict";class t extends Error{constructor(t){super(t),this.name="TestRailException"}}class e{constructor(t){this.username=(null==t?void 0:t.username)||(null==t?void 0:t.user),this.password=null==t?void 0:t.password,this.baseURL=((null==t?void 0:t.host)||"")+"/index.php?/api/v2/"}addAttachmentToPlan(t,e){return this._api("POST","add_attachment_to_plan/"+t,{form:{attachment:e}})}addAttachmentToPlanEntry(t,e,r){return this._api("POST",`add_attachment_to_plan_entry/${t}/${e}`,{form:{attachment:r}})}addAttachmentToResult(t,e){return this._api("POST","add_attachment_to_result/"+t,{form:{attachment:e}})}addAttachmentToRun(t,e){return this._api("POST","add_attachment_to_run/"+t,{form:{attachment:e}})}getAttachmentsForCase(t){return this._api("GET","get_attachments_for_case/"+t)}getAttachmentsForPlan(t){return this._api("GET","get_attachments_for_plan/"+t)}getAttachmentsForPlanEntry(t,e){return this._api("GET",`get_attachments_for_plan_entry/${t}/${e}`)}getAttachmentsForRun(t){return this._api("GET","get_attachments_for_run/"+t)}getAttachmentsForTest(t){return this._api("GET","get_attachments_for_test/"+t)}getAttachment(t){return this._api("GET","get_attachment/"+t)}deleteAttachment(t){return this._api("POST","delete_attachment/"+t)}getCase(t){return this._api("GET","get_case/"+t)}getCases(t,e){return this._api("GET","get_cases/"+t,{query:e})}getHistoryForCase(t){return this._api("GET","get_history_for_case/"+t)}addCase(t,e){return this._api("POST","add_case/"+t,{json:e})}updateCase(t,e){return this._api("POST","update_case/"+t,{json:e})}updateCases(t,e){return this._api("POST","update_cases/"+t,{json:e})}deleteCase(t){return this._api("POST","delete_case/"+t)}deleteCases(t,e){return this._api("POST","delete_cases/"+t,{json:e})}getCaseFields(){return this._api("GET","get_case_fields")}addCaseField(t){return this._api("POST","add_case_field",{json:t})}getCaseTypes(){return this._api("GET","get_case_types")}getConfigs(t){return this._api("GET","get_configs/"+t)}addConfigGroup(t,e){return this._api("POST","add_config_group/"+t,{json:e})}addConfig(t,e){return this._api("POST","add_config/"+t,{json:e})}updateConfigGroup(t,e){return this._api("POST","update_config_group/"+t,{json:e})}updateConfig(t,e){return this._api("POST","update_config/"+t,{json:e})}deleteConfigGroup(t){return this._api("POST","delete_config_group/"+t)}deleteConfig(t){return this._api("POST","delete_config/"+t)}getMilestone(t){return this._api("GET","get_milestone/"+t)}getMilestones(t,e){return this._api("GET","get_milestones/"+t,{query:e})}addMilestone(t,e){return this._api("POST","add_milestone/"+t,{json:e})}updateMilestone(t,e){return this._api("POST","update_milestone/"+t,{json:e})}deleteMilestone(t){return this._api("POST","delete_milestone/"+t)}getPlan(t){return this._api("GET","get_plan/"+t)}getPlans(t,e){return this._api("GET","get_plans/"+t,{query:e})}addPlan(t,e){return this._api("POST","add_plan/"+t,{json:e})}addPlanEntry(t,e){return this._api("POST","add_plan_entry/"+t,{json:e})}addRunToPlanEntry(t,e,r){return this._api("POST",`add_run_to_plan_entry/${t}/${e}`,{json:r})}updatePlan(t,e){return this._api("POST","update_plan/"+t,{json:e})}updatePlanEntry(t,e,r){return this._api("POST",`update_plan_entry/${t}/${e}`,{json:r})}updateRunInPlanEntry(t,e,r){return this._api("POST",`update_run_in_plan_entry/${t}/${e}`,{json:r})}closePlan(t){return this._api("POST","close_plan/"+t)}deletePlan(t){return this._api("POST","delete_plan/"+t)}deletePlanEntry(t,e){return this._api("POST",`delete_plan_entry/${t}/${e}`)}deleteRunFromPlanEntry(t){return this._api("POST","delete_run_from_plan_entry/"+t)}getPriorities(){return this._api("GET","get_priorities")}getProject(t){return this._api("GET","get_project/"+t)}getProjects(t){return this._api("GET","get_projects",{query:t})}addProject(t){return this._api("POST","add_project",{json:t})}updateProject(t,e){return this._api("POST","update_project/"+t,{json:e})}deleteProject(t){return this._api("POST","delete_project/"+t)}getReports(t){return this._api("GET","get_reports/"+t)}runReport(t){return this._api("POST","run_report/"+t)}getResults(t,e){return this._api("GET","get_results/"+t,{query:e})}getResultsForCase(t,e,r){return this._api("GET",`get_results_for_case/${t}/${e}`,{query:r})}getResultsForRun(t,e){return this._api("GET","get_results_for_run/"+t,{query:e})}addResult(t,e){return this._api("POST","add_result/"+t,{json:e})}addResultForCase(t,e,r){return this._api("POST",`add_result_for_case/${t}/${e}`,{json:r})}addResults(t,e){return this._api("POST","add_results/"+t,{json:e})}addResultsForCases(t,e){return this._api("POST","add_results_for_cases/"+t,{json:e})}getResultFields(){return this._api("GET","get_result_fields")}getRun(t){return this._api("GET","get_run/"+t)}getRuns(t,e){return this._api("GET","get_runs/"+t,{query:e})}addRun(t,e){return this._api("POST","add_run/"+t,{json:e})}updateRun(t,e){return this._api("POST","update_run/"+t,{json:e})}closeRun(t){return this._api("POST","close_run/"+t)}deleteRun(t){return this._api("POST","delete_run/"+t)}getSection(t){return this._api("GET","get_section/"+t)}getSections(t,e){return this._api("GET","get_sections/"+t,{query:e})}addSection(t,e){return this._api("POST","add_section/"+t,{json:e})}updateSection(t,e){return this._api("POST","update_section/"+t,{json:e})}deleteSection(t){return this._api("POST","delete_section/"+t)}getStatuses(){return this._api("GET","get_statuses")}getSuite(t){return this._api("GET","get_suite/"+t)}getSuites(t){return this._api("GET","get_suites/"+t)}addSuite(t,e){return this._api("POST","add_suite/"+t,{json:e})}updateSuite(t,e){return this._api("POST","update_suite/"+t,{json:e})}deleteSuite(t){return this._api("POST","delete_suite/"+t)}getTemplates(t){return this._api("GET","get_templates/"+t)}getTest(t){return this._api("GET","get_test/"+t)}getTests(t,e){return this._api("GET","get_tests/"+t,{query:e})}getUser(t){return this._api("GET","get_user/"+t)}getCurrentUser(){return this._api("GET","get_current_user")}getUserByEmail(t){return this._api("GET","get_user_by_email",{query:{email:t}})}getUsers(t){return this._api("GET","get_users",{query:t})}async _api(t,n,{query:a,json:i,form:u}={}){const _={},o=this.baseURL+n+((p=a)?"&"+new URLSearchParams(p):"");var p,d;let h;if(this.username&&this.password&&(_.Authorization="Basic "+(d=`${this.username}:${this.password}`,"undefined"!=typeof btoa?btoa(d):Buffer.from(d).toString("base64"))),u||(_["Content-Type"]="application/json"),i)h=JSON.stringify(i);else if(u){h=new FormData;for(const[t,e]of Object.entries(u))e.name&&e.value?r(h,t,e.value,e.name):r(h,t,e)}for(;;){const r=await fetch(o,{method:t,body:h,headers:_});if(429===r.status){const t=1e3*parseInt(r.headers.get("Retry-After")||"1");await s(t);continue}if(409===r.status){await s(1e4);continue}const n=(r.headers.get("Content-Type")||"").includes("json")?await r.clone().json().catch(()=>r.text()):await r.blob();if(r.ok)return n;throw new e.Exception(n.error||"No additional error message received")}}}function r(t,e,r,s){if(s&&"undefined"!=typeof Blob){const n=r instanceof Blob?r:new Blob([r]);t.append(e,n,s)}else t.append(e,r,s)}function s(t){return new Promise(e=>setTimeout(e,t))}return e.default=e,e.Exception=t,e})); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).TestRail=e()}(this,(function(){"use strict";class t extends Error{constructor(t){super(t),this.name="TestRailException"}}class e{constructor(t){this.username=(null==t?void 0:t.username)||(null==t?void 0:t.user),this.password=null==t?void 0:t.password,this.baseURL=((null==t?void 0:t.host)||"")+"/index.php?/api/v2/"}addAttachmentToPlan(t,e){return this._api("POST","add_attachment_to_plan/"+t,{form:{attachment:e}})}addAttachmentToPlanEntry(t,e,r){return this._api("POST",`add_attachment_to_plan_entry/${t}/${e}`,{form:{attachment:r}})}addAttachmentToResult(t,e){return this._api("POST","add_attachment_to_result/"+t,{form:{attachment:e}})}addAttachmentToRun(t,e){return this._api("POST","add_attachment_to_run/"+t,{form:{attachment:e}})}getAttachmentsForCase(t){return this._api("GET","get_attachments_for_case/"+t)}getAttachmentsForPlan(t){return this._api("GET","get_attachments_for_plan/"+t)}getAttachmentsForPlanEntry(t,e){return this._api("GET",`get_attachments_for_plan_entry/${t}/${e}`)}getAttachmentsForRun(t){return this._api("GET","get_attachments_for_run/"+t)}getAttachmentsForTest(t){return this._api("GET","get_attachments_for_test/"+t)}getAttachment(t){return this._api("GET","get_attachment/"+t)}deleteAttachment(t){return this._api("POST","delete_attachment/"+t)}getCase(t){return this._api("GET","get_case/"+t)}getCases(t,e){return this._api("GET","get_cases/"+t,{query:e})}getHistoryForCase(t){return this._api("GET","get_history_for_case/"+t)}addCase(t,e){return this._api("POST","add_case/"+t,{json:e})}updateCase(t,e){return this._api("POST","update_case/"+t,{json:e})}updateCases(t,e){return this._api("POST","update_cases/"+t,{json:e})}deleteCase(t){return this._api("POST","delete_case/"+t)}deleteCases(t,e){return this._api("POST","delete_cases/"+t,{json:e})}getCaseFields(){return this._api("GET","get_case_fields")}addCaseField(t){return this._api("POST","add_case_field",{json:t})}getCaseTypes(){return this._api("GET","get_case_types")}getConfigs(t){return this._api("GET","get_configs/"+t)}addConfigGroup(t,e){return this._api("POST","add_config_group/"+t,{json:e})}addConfig(t,e){return this._api("POST","add_config/"+t,{json:e})}updateConfigGroup(t,e){return this._api("POST","update_config_group/"+t,{json:e})}updateConfig(t,e){return this._api("POST","update_config/"+t,{json:e})}deleteConfigGroup(t){return this._api("POST","delete_config_group/"+t)}deleteConfig(t){return this._api("POST","delete_config/"+t)}getMilestone(t){return this._api("GET","get_milestone/"+t)}getMilestones(t,e){return this._api("GET","get_milestones/"+t,{query:e})}addMilestone(t,e){return this._api("POST","add_milestone/"+t,{json:e})}updateMilestone(t,e){return this._api("POST","update_milestone/"+t,{json:e})}deleteMilestone(t){return this._api("POST","delete_milestone/"+t)}getPlan(t){return this._api("GET","get_plan/"+t)}getPlans(t,e){return this._api("GET","get_plans/"+t,{query:e})}addPlan(t,e){return this._api("POST","add_plan/"+t,{json:e})}addPlanEntry(t,e){return this._api("POST","add_plan_entry/"+t,{json:e})}addRunToPlanEntry(t,e,r){return this._api("POST",`add_run_to_plan_entry/${t}/${e}`,{json:r})}updatePlan(t,e){return this._api("POST","update_plan/"+t,{json:e})}updatePlanEntry(t,e,r){return this._api("POST",`update_plan_entry/${t}/${e}`,{json:r})}updateRunInPlanEntry(t,e,r){return this._api("POST",`update_run_in_plan_entry/${t}/${e}`,{json:r})}closePlan(t){return this._api("POST","close_plan/"+t)}deletePlan(t){return this._api("POST","delete_plan/"+t)}deletePlanEntry(t,e){return this._api("POST",`delete_plan_entry/${t}/${e}`)}deleteRunFromPlanEntry(t){return this._api("POST","delete_run_from_plan_entry/"+t)}getPriorities(){return this._api("GET","get_priorities")}getProject(t){return this._api("GET","get_project/"+t)}getProjects(t){return this._api("GET","get_projects",{query:t})}addProject(t){return this._api("POST","add_project",{json:t})}updateProject(t,e){return this._api("POST","update_project/"+t,{json:e})}deleteProject(t){return this._api("POST","delete_project/"+t)}getReports(t){return this._api("GET","get_reports/"+t)}runReport(t){return this._api("POST","run_report/"+t)}getResults(t,e){return this._api("GET","get_results/"+t,{query:e})}getResultsForCase(t,e,r){return this._api("GET",`get_results_for_case/${t}/${e}`,{query:r})}getResultsForRun(t,e){return this._api("GET","get_results_for_run/"+t,{query:e})}addResult(t,e){return this._api("POST","add_result/"+t,{json:e})}addResultForCase(t,e,r){return this._api("POST",`add_result_for_case/${t}/${e}`,{json:r})}addResults(t,e){return this._api("POST","add_results/"+t,{json:e})}addResultsForCases(t,e){return this._api("POST","add_results_for_cases/"+t,{json:e})}getResultFields(){return this._api("GET","get_result_fields")}getRun(t){return this._api("GET","get_run/"+t)}getRuns(t,e){return this._api("GET","get_runs/"+t,{query:e})}addRun(t,e){return this._api("POST","add_run/"+t,{json:e})}updateRun(t,e){return this._api("POST","update_run/"+t,{json:e})}closeRun(t){return this._api("POST","close_run/"+t)}deleteRun(t){return this._api("POST","delete_run/"+t)}getSection(t){return this._api("GET","get_section/"+t)}getSections(t,e){return this._api("GET","get_sections/"+t,{query:e})}addSection(t,e){return this._api("POST","add_section/"+t,{json:e})}updateSection(t,e){return this._api("POST","update_section/"+t,{json:e})}deleteSection(t){return this._api("POST","delete_section/"+t)}getStatuses(){return this._api("GET","get_statuses")}getSuite(t){return this._api("GET","get_suite/"+t)}getSuites(t){return this._api("GET","get_suites/"+t)}addSuite(t,e){return this._api("POST","add_suite/"+t,{json:e})}updateSuite(t,e){return this._api("POST","update_suite/"+t,{json:e})}deleteSuite(t){return this._api("POST","delete_suite/"+t)}getTemplates(t){return this._api("GET","get_templates/"+t)}getTest(t){return this._api("GET","get_test/"+t)}getTests(t,e){return this._api("GET","get_tests/"+t,{query:e})}getUser(t){return this._api("GET","get_user/"+t)}getCurrentUser(){return this._api("GET","get_current_user")}getUserByEmail(t){return this._api("GET","get_user_by_email",{query:{email:t}})}getUsers(t){return this._api("GET","get_users",{query:t})}async _api(t,n,{query:a,json:i,form:u}={}){var _;const o={},p=this.baseURL+n+((d=a)?"&"+new URLSearchParams(d):"");var d,h;let l;if(this.username&&this.password&&(o.Authorization="Basic "+(h=`${this.username}:${this.password}`,"undefined"!=typeof btoa?btoa(h):Buffer.from(h).toString("base64"))),u||(o["Content-Type"]="application/json"),i)l=JSON.stringify(i);else if(u){l=new FormData;for(const[t,e]of Object.entries(u))e.name&&e.value?r(l,t,e.value,e.name):r(l,t,e)}for(;;){const r=await fetch(p,{method:t,body:l,headers:o});if(429===r.status){const t=1e3*parseInt(r.headers.get("Retry-After")||"1");await s(t);continue}if(409===r.status){await s(1e4);continue}const n=(null===(_=r.headers.get("Content-Type"))||void 0===_?void 0:_.includes("json"))?await r.json().catch(()=>({})):await r.blob();if(r.ok)return n;throw new e.Exception(n.error||"No additional error message received")}}}function r(t,e,r,s){if(s&&"undefined"!=typeof Blob){const n=r instanceof Blob?r:new Blob([r]);t.append(e,n,s)}else t.append(e,r,s)}function s(t){return new Promise(e=>setTimeout(e,t))}return e.default=e,e.Exception=t,e})); | ||
//# sourceMappingURL=TestRail.umd.js.map |
{ | ||
"name": "@dlenroc/testrail", | ||
"description": "TestRail API client with error handling and typing", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"author": "Corneliu Duplachi", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -455,8 +455,4 @@ import { Readable } from 'stream'; | ||
// Content-Type based response | ||
const contentType = response.headers.get('Content-Type') || ''; | ||
const result = contentType.includes('json') | ||
? await response | ||
.clone() | ||
.json() | ||
.catch(() => response.text()) | ||
const result = response.headers.get('Content-Type')?.includes('json') | ||
? await response.json().catch(() => ({})) | ||
: await response.blob(); | ||
@@ -714,3 +710,3 @@ | ||
priority_id?: string; | ||
refs_filter?: string; | ||
refs?: string; | ||
section_id?: number; | ||
@@ -744,3 +740,3 @@ template_id?: string; | ||
interface ResultFilters extends UnknownObject { | ||
defects_filter?: string; | ||
defects?: string; | ||
limit?: number; | ||
@@ -755,3 +751,3 @@ offset?: number; | ||
created_by?: string; | ||
defects_filter?: string; | ||
defects?: string; | ||
limit?: number; | ||
@@ -770,3 +766,3 @@ offset?: number; | ||
milestone_id?: string; | ||
refs_filter?: string; | ||
refs?: string; | ||
suite_id?: string; | ||
@@ -773,0 +769,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
320481
1997