@gitkraken/provider-apis 0.30.0 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.31.0
4
+
5
+ - Added `approvePullRequest` to Github
6
+ - Added `requestPullRequestChanges` to Github
7
+ - Added `commentOnPullRequest` to Github
8
+
3
9
  ## 0.30.0
4
10
 
5
11
  - Removed `node-fetch` usage
@@ -1 +1 @@
1
- "use strict";var g=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var w=(t,r)=>{for(var e in r)g(t,e,{get:r[e],enumerable:!0})},O=(t,r,e,u)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of T(r))!b.call(t,s)&&s!==e&&g(t,s,{get:()=>r[s],enumerable:!(u=q(r,s))||u.enumerable});return t};var P=t=>O(g({},"__esModule",{value:!0}),t);var j={};w(j,{EntityIdentifierUtils:()=>m});module.exports=P(j);var m={};w(m,{decode:()=>R,decodeV0:()=>S,encode:()=>k,validate:()=>G});var d=class{constructor(){}validate(r){if(!r.organizationName)throw new Error("organizationName is required");if(!r.projectId)throw new Error("projectId is required");if(!r.entityId)throw new Error("issueId is required")}encode(r){if(this.validate(r),!r.organizationName||!r.projectId||!r.entityId)throw new Error("Missing required fields for Azure DevOps issue uniqueId");let e=[];return e.push(r.provider),e.push("issue"),e.push("1"),r.provider==="azureDevOpsServer"?e.push(r.domain):e.push(""),e.push(r.organizationName),e.push(r.projectId),e.push(r.entityId),JSON.stringify(e)}decode(r){if(r.length<7)throw new Error("Invalid Azure DevOps issue uniqueId, check version");return{provider:r[0],entityType:r[1],version:r[2],domain:r[3]==""?null:r[3],resourceId:null,accountOrOrgId:null,organizationName:r[4],projectId:r[5],repoId:null,entityId:r[6]}}};var p=class{constructor(){}validate(r){if(!r.organizationName)throw new Error("organizationName is required");if(!r.projectId)throw new Error("projectId is required");if(!r.repoId)throw new Error("repoId is required");if(!r.entityId)throw new Error("entityId is required")}encode(r){if(this.validate(r),!r.organizationName||!r.projectId||!r.repoId||!r.entityId)throw new Error("Missing required fields for Azure DevOps pull request uniqueId");let e=[];return e.push(r.provider),e.push("pr"),e.push("1"),r.provider==="azureDevOpsServer"?e.push(r.domain):e.push(""),e.push(r.organizationName),e.push(r.projectId),e.push(r.repoId),e.push(r.entityId),JSON.stringify(e)}decode(r){if(r.length<8)throw new Error("Invalid Azure DevOps pull request uniqueId, check version");return{provider:r[0],entityType:r[1],version:r[2],domain:r[3]==""?null:r[3],resourceId:null,accountOrOrgId:null,organizationName:r[4],projectId:r[5],repoId:r[6],entityId:r[7]}}};var I=class{constructor(){}validate(r){if(!r.repoId)throw new Error("repoId is required");if(!r.entityId)throw new Error("issueId is required")}encode(r){if(this.validate(r),!r.repoId||!r.entityId)throw new Error("Missing required fields for Bitbucket DevOps issue uniqueId");let e=[];return e.push(r.provider),e.push("issue"),e.push("1"),r.provider==="bitbucketServer"?e.push(r.domain):e.push(""),e.push(r.repoId),e.push(r.entityId),JSON.stringify(e)}decode(r){if(r.length<6)throw new Error("Invalid Bitbucket DevOps issue uniqueId, check version");return{provider:r[0],entityType:r[1],version:r[2],domain:r[3]==""?null:r[3],resourceId:null,accountOrOrgId:null,organizationName:null,projectId:null,repoId:r[4],entityId:r[5]}}};var a=class{constructor(){}validate(r){if(!r.repoId)throw new Error("repoId is required");if(!r.entityId)throw new Error("entityId is required")}encode(r){if(this.validate(r),!r.repoId||!r.entityId)throw new Error("Missing required fields for Bitbucket DevOps pull request uniqueId");let e=[];return e.push(r.provider),e.push("pr"),e.push("1"),r.provider==="bitbucketServer"?e.push(r.domain):e.push(""),e.push(r.repoId),e.push(r.entityId),JSON.stringify(e)}decode(r){if(r.length<6)throw new Error("Invalid Bitbucket DevOps pull request uniqueId, check version");return{provider:r[0],entityType:r[1],version:r[2],domain:r[3]==""?null:r[3],resourceId:null,accountOrOrgId:null,organizationName:null,projectId:null,repoId:r[4],entityId:r[5]}}};var l=class{constructor(){}validate(r){if(!r.entityId)throw new Error("entityId is required")}encode(r){if(this.validate(r),!r.entityId)throw new Error("Missing required fields for Github issue uniqueId");let e=[];return e.push(r.provider),e.push("issue"),e.push("1"),r.provider==="githubEnterprise"?e.push(r.domain):e.push(""),e.push(r.entityId),JSON.stringify(e)}decode(r){if(r.length<5)throw new Error("Invalid Github issue uniqueId, check version");return{provider:r[0],entityType:r[1],version:r[2],domain:r[3]==""?null:r[3],resourceId:null,accountOrOrgId:null,organizationName:null,projectId:null,repoId:null,entityId:r[4]}}};var E=class{constructor(){}validate(r){if(!r.entityId)throw new Error("entityId is required")}encode(r){if(this.validate(r),!r.entityId)throw new Error("Missing required fields for Github pull request uniqueId");let e=[];return e.push(r.provider),e.push("pr"),e.push("1"),r.provider==="githubEnterprise"?e.push(r.domain):e.push(""),e.push(r.entityId),JSON.stringify(e)}decode(r){if(r.length<5)throw new Error("Invalid Github pull request uniqueId, check version");return{provider:r[0],entityType:r[1],version:r[2],domain:r[3]==""?null:r[3],resourceId:null,accountOrOrgId:null,organizationName:null,projectId:null,repoId:null,entityId:r[4]}}};var c=class{constructor(){}validate(r){if(!r.entityId)throw new Error("entityId is required")}encode(r){if(this.validate(r),!r.entityId)throw new Error("Missing required fields for Gitlab issue uniqueId");let e=[];return e.push(r.provider),e.push("issue"),e.push("1"),r.provider==="gitlabSelfHosted"?e.push(r.domain):e.push(""),e.push(r.entityId),JSON.stringify(e)}decode(r){if(r.length<5)throw new Error("Invalid Gitlab issue uniqueId, check version");return{provider:r[0],entityType:r[1],version:r[2],domain:r[3]==""?null:r[3],resourceId:null,accountOrOrgId:null,organizationName:null,projectId:null,repoId:null,entityId:r[4]}}};var y=class{constructor(){}validate(r){if(!r.entityId)throw new Error("entityId is required")}encode(r){if(this.validate(r),!r.entityId)throw new Error("Missing required fields for Gitlab pull request uniqueId");let e=[];return e.push(r.provider),e.push("pr"),e.push("1"),r.provider==="gitlabSelfHosted"?e.push(r.domain):e.push(""),e.push(r.entityId),JSON.stringify(e)}decode(r){if(r.length<5)throw new Error("Invalid Gitlab pull request uniqueId, check version");return{provider:r[0],entityType:r[1],version:r[2],domain:r[3]==""?null:r[3],resourceId:null,accountOrOrgId:null,organizationName:null,projectId:null,repoId:null,entityId:r[4]}}};var f=class{constructor(){}validate(r){if(!r.projectId)throw new Error("projectId is required");if(!r.entityId)throw new Error("entityId is required")}encode(r){if(this.validate(r),!r.projectId||!r.entityId)throw new Error("Missing required fields for Jira issue uniqueId");let e=[];return e.push(r.provider),e.push("issue"),e.push("1"),r.provider=="jira"?(e.push(""),e.push(r.resourceId)):(e.push(r.domain),e.push("")),e.push(r.projectId),e.push(r.entityId),JSON.stringify(e)}decode(r){if(r.length<7)throw new Error("Invalid Jira issue uniqueId, check version");return{provider:r[0],entityType:r[1],version:r[2],domain:r[3]==""?null:r[3],resourceId:r[4]==""?null:r[4],accountOrOrgId:null,organizationName:null,projectId:r[5],repoId:null,entityId:r[6]}}};var v=class{constructor(){}validate(r){if(!r.accountOrOrgId)throw new Error("accountOrOrgId is required");if(!r.projectId)throw new Error("projectId is required");if(!r.entityId)throw new Error("entityId is required")}encode(r){if(this.validate(r),!r.accountOrOrgId||!r.projectId||!r.entityId)throw new Error("Missing required fields for Trello issue uniqueId");let e=[];return e.push("trello"),e.push("issue"),e.push("1"),e.push(""),e.push(r.accountOrOrgId),e.push(r.projectId),e.push(r.entityId),JSON.stringify(e)}decode(r){if(r.length<7)throw new Error("Invalid Trello issue uniqueId, check version");return{provider:r[0],entityType:r[1],version:r[2],domain:r[3]==""?null:r[3],resourceId:null,accountOrOrgId:r[4],organizationName:null,projectId:r[5],repoId:null,entityId:r[6]}}};var h=(t,r)=>{if(r!=="issue"&&r!=="pr")throw new Error("unknown entityType");switch(t){case"azure":case"azureDevOpsServer":return r==="pr"?new p:new d;case"bitbucket":case"bitbucketServer":return r==="pr"?new a:new I;case"github":case"githubEnterprise":return r==="pr"?new E:new l;case"gitlab":case"gitlabSelfHosted":return r==="pr"?new y:new c;case"jira":case"jiraServer":if(r==="pr")throw new Error("EntityType PullRequest is not valid for Jira");return new f;case"trello":if(r==="pr")throw new Error("EntityType PullRequest is not valid for Jira");return new v;default:throw new Error("unknown provider")}},z=t=>{if(!t.entityType)throw new Error("entityType is required");if(!t.provider)throw new Error("provider is required");if(!t.entityId)throw new Error("entityID is required")},G=t=>{if(t.version==="0"){z(t);return}h(t.provider,t.entityType).validate(t)},k=t=>h(t.provider,t.entityType).encode(t),R=t=>{let r=JSON.parse(t);if(!r||!r.length)throw new Error("invalid issue unique id");return h(r[0],r[1]).decode(r)},S=(t,r,e)=>{if(!e)throw new Error("entityID is required");try{let u=JSON.parse(e);if(!u||!u.length)throw new Error("Invalid pull request uniqueId");let s=[t,r,"0",...u];return h(t,r).decode(s)}catch{return{provider:t,entityType:r,version:"0",domain:"",resourceId:null,accountOrOrgId:null,organizationName:null,projectId:null,repoId:null,entityId:e}}};
1
+ "use strict";var g=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var w=(t,r)=>{for(var e in r)g(t,e,{get:r[e],enumerable:!0})},O=(t,r,e,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let u of T(r))!b.call(t,u)&&u!==e&&g(t,u,{get:()=>r[u],enumerable:!(s=q(r,u))||s.enumerable});return t};var P=t=>O(g({},"__esModule",{value:!0}),t);var j={};w(j,{EntityIdentifierUtils:()=>m});module.exports=P(j);var m={};w(m,{decode:()=>R,decodeV0:()=>S,encode:()=>k,validate:()=>G});var d=class{constructor(){}validate(r){if(!r.organizationName)throw new Error("organizationName is required");if(!r.projectId)throw new Error("projectId is required");if(!r.entityId)throw new Error("issueId is required")}encode(r){if(this.validate(r),!r.organizationName||!r.projectId||!r.entityId)throw new Error("Missing required fields for Azure DevOps issue uniqueId");let e=[];return e.push(r.provider),e.push("issue"),e.push("1"),r.provider==="azureDevOpsServer"?e.push(r.domain):e.push(""),e.push(r.organizationName),e.push(r.projectId),e.push(r.entityId),JSON.stringify(e)}decode(r){if(r.length<7)throw new Error("Invalid Azure DevOps issue uniqueId, check version");return{provider:r[0],entityType:r[1],version:r[2],domain:r[3]==""?null:r[3],resourceId:null,accountOrOrgId:null,organizationName:r[4],projectId:r[5],repoId:null,entityId:r[6]}}};var p=class{constructor(){}validate(r){if(!r.organizationName)throw new Error("organizationName is required");if(!r.projectId)throw new Error("projectId is required");if(!r.repoId)throw new Error("repoId is required");if(!r.entityId)throw new Error("entityId is required")}encode(r){if(this.validate(r),!r.organizationName||!r.projectId||!r.repoId||!r.entityId)throw new Error("Missing required fields for Azure DevOps pull request uniqueId");let e=[];return e.push(r.provider),e.push("pr"),e.push("1"),r.provider==="azureDevOpsServer"?e.push(r.domain):e.push(""),e.push(r.organizationName),e.push(r.projectId),e.push(r.repoId),e.push(r.entityId),JSON.stringify(e)}decode(r){if(r.length<8)throw new Error("Invalid Azure DevOps pull request uniqueId, check version");return{provider:r[0],entityType:r[1],version:r[2],domain:r[3]==""?null:r[3],resourceId:null,accountOrOrgId:null,organizationName:r[4],projectId:r[5],repoId:r[6],entityId:r[7]}}};var I=class{constructor(){}validate(r){if(!r.repoId)throw new Error("repoId is required");if(!r.entityId)throw new Error("issueId is required")}encode(r){if(this.validate(r),!r.repoId||!r.entityId)throw new Error("Missing required fields for Bitbucket DevOps issue uniqueId");let e=[];return e.push(r.provider),e.push("issue"),e.push("1"),r.provider==="bitbucketServer"?e.push(r.domain):e.push(""),e.push(r.repoId),e.push(r.entityId),JSON.stringify(e)}decode(r){if(r.length<6)throw new Error("Invalid Bitbucket DevOps issue uniqueId, check version");return{provider:r[0],entityType:r[1],version:r[2],domain:r[3]==""?null:r[3],resourceId:null,accountOrOrgId:null,organizationName:null,projectId:null,repoId:r[4],entityId:r[5]}}};var a=class{constructor(){}validate(r){if(!r.repoId)throw new Error("repoId is required");if(!r.entityId)throw new Error("entityId is required")}encode(r){if(this.validate(r),!r.repoId||!r.entityId)throw new Error("Missing required fields for Bitbucket DevOps pull request uniqueId");let e=[];return e.push(r.provider),e.push("pr"),e.push("1"),r.provider==="bitbucketServer"?e.push(r.domain):e.push(""),e.push(r.repoId),e.push(r.entityId),JSON.stringify(e)}decode(r){if(r.length<6)throw new Error("Invalid Bitbucket DevOps pull request uniqueId, check version");return{provider:r[0],entityType:r[1],version:r[2],domain:r[3]==""?null:r[3],resourceId:null,accountOrOrgId:null,organizationName:null,projectId:null,repoId:r[4],entityId:r[5]}}};var l=class{constructor(){}validate(r){if(!r.entityId)throw new Error("entityId is required")}encode(r){if(this.validate(r),!r.entityId)throw new Error("Missing required fields for Github issue uniqueId");let e=[];return e.push(r.provider),e.push("issue"),e.push("1"),r.provider==="githubEnterprise"?e.push(r.domain):e.push(""),e.push(r.entityId),JSON.stringify(e)}decode(r){if(r.length<5)throw new Error("Invalid Github issue uniqueId, check version");return{provider:r[0],entityType:r[1],version:r[2],domain:r[3]==""?null:r[3],resourceId:null,accountOrOrgId:null,organizationName:null,projectId:null,repoId:null,entityId:r[4]}}};var E=class{constructor(){}validate(r){if(!r.entityId)throw new Error("entityId is required")}encode(r){if(this.validate(r),!r.entityId)throw new Error("Missing required fields for Github pull request uniqueId");let e=[];return e.push(r.provider),e.push("pr"),e.push("1"),r.provider==="githubEnterprise"?e.push(r.domain):e.push(""),e.push(r.entityId),JSON.stringify(e)}decode(r){if(r.length<5)throw new Error("Invalid Github pull request uniqueId, check version");return{provider:r[0],entityType:r[1],version:r[2],domain:r[3]==""?null:r[3],resourceId:null,accountOrOrgId:null,organizationName:null,projectId:null,repoId:null,entityId:r[4]}}};var c=class{constructor(){}validate(r){if(!r.entityId)throw new Error("entityId is required")}encode(r){if(this.validate(r),!r.entityId)throw new Error("Missing required fields for Gitlab issue uniqueId");let e=[];return e.push(r.provider),e.push("issue"),e.push("1"),r.provider==="gitlabSelfHosted"?e.push(r.domain):e.push(""),e.push(r.entityId),JSON.stringify(e)}decode(r){if(r.length<5)throw new Error("Invalid Gitlab issue uniqueId, check version");return{provider:r[0],entityType:r[1],version:r[2],domain:r[3]==""?null:r[3],resourceId:null,accountOrOrgId:null,organizationName:null,projectId:null,repoId:null,entityId:r[4]}}};var y=class{constructor(){}validate(r){if(!r.entityId)throw new Error("entityId is required")}encode(r){if(this.validate(r),!r.entityId)throw new Error("Missing required fields for Gitlab pull request uniqueId");let e=[];return e.push(r.provider),e.push("pr"),e.push("1"),r.provider==="gitlabSelfHosted"?e.push(r.domain):e.push(""),e.push(r.entityId),JSON.stringify(e)}decode(r){if(r.length<5)throw new Error("Invalid Gitlab pull request uniqueId, check version");return{provider:r[0],entityType:r[1],version:r[2],domain:r[3]==""?null:r[3],resourceId:null,accountOrOrgId:null,organizationName:null,projectId:null,repoId:null,entityId:r[4]}}};var f=class{constructor(){}validate(r){if(!r.projectId)throw new Error("projectId is required");if(!r.entityId)throw new Error("entityId is required")}encode(r){if(this.validate(r),!r.projectId||!r.entityId)throw new Error("Missing required fields for Jira issue uniqueId");let e=[];return e.push(r.provider),e.push("issue"),e.push("1"),r.provider=="jira"?(e.push(""),e.push(r.resourceId)):(e.push(r.domain),e.push("")),e.push(r.projectId),e.push(r.entityId),JSON.stringify(e)}decode(r){if(r.length<7)throw new Error("Invalid Jira issue uniqueId, check version");return{provider:r[0],entityType:r[1],version:r[2],domain:r[3]==""?null:r[3],resourceId:r[4]==""?null:r[4],accountOrOrgId:null,organizationName:null,projectId:r[5],repoId:null,entityId:r[6]}}};var v=class{constructor(){}validate(r){if(!r.accountOrOrgId)throw new Error("accountOrOrgId is required");if(!r.projectId)throw new Error("projectId is required");if(!r.entityId)throw new Error("entityId is required")}encode(r){if(this.validate(r),!r.accountOrOrgId||!r.projectId||!r.entityId)throw new Error("Missing required fields for Trello issue uniqueId");let e=[];return e.push("trello"),e.push("issue"),e.push("1"),e.push(""),e.push(r.accountOrOrgId),e.push(r.projectId),e.push(r.entityId),JSON.stringify(e)}decode(r){if(r.length<7)throw new Error("Invalid Trello issue uniqueId, check version");return{provider:r[0],entityType:r[1],version:r[2],domain:r[3]==""?null:r[3],resourceId:null,accountOrOrgId:r[4],organizationName:null,projectId:r[5],repoId:null,entityId:r[6]}}};var h=(t,r)=>{if(r!=="issue"&&r!=="pr")throw new Error("unknown entityType");switch(t){case"azure":case"azureDevOpsServer":return r==="pr"?new p:new d;case"bitbucket":case"bitbucketServer":return r==="pr"?new a:new I;case"github":case"githubEnterprise":return r==="pr"?new E:new l;case"gitlab":case"gitlabSelfHosted":return r==="pr"?new y:new c;case"jira":case"jiraServer":if(r==="pr")throw new Error("EntityType PullRequest is not valid for Jira");return new f;case"trello":if(r==="pr")throw new Error("EntityType PullRequest is not valid for Jira");return new v;default:throw new Error("unknown provider")}},z=t=>{if(!t.entityType)throw new Error("entityType is required");if(!t.provider)throw new Error("provider is required");if(!t.entityId)throw new Error("entityID is required")},G=t=>{if(t.version==="0"){z(t);return}h(t.provider,t.entityType).validate(t)},k=t=>h(t.provider,t.entityType).encode(t),R=t=>{let r=JSON.parse(t);if(!r||!r.length)throw new Error("invalid issue unique id");return h(r[0],r[1]).decode(r)},S=(t,r,e)=>{if(!e)throw new Error("entityID is required");try{let s=JSON.parse(e);if(!s||!s.length)throw new Error("Invalid pull request uniqueId");let u=[t,r,"0",...s];return h(t,r).decode(u)}catch{return{provider:t,entityType:r,version:"0",domain:"",resourceId:null,accountOrOrgId:null,organizationName:null,projectId:null,repoId:null,entityId:e}}};