@gitkraken/provider-apis 0.25.7 → 0.25.9

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,43 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.25.9
4
+
5
+ - fixed GraphQL errors (GitHub)
6
+
7
+ ## 0.25.8
8
+
9
+ - added `getReposForOrg` (GitHub)
10
+ - added `getReposForCurrentUser` (GitHub)
11
+
12
+ - fix null dereference error that sometimes happens when fetching issues (GitHub)
13
+
14
+ This version of the package introduces code-splitting. There are three new entry points that you can import code from:
15
+
16
+ ```
17
+ // the main entry point exports everything in this package. this results in the largest bundle size when imported
18
+ import { ... } from '@gitkraken/provider-apis';
19
+
20
+ // the entity identifiers entry point exports entity identifier functions only. this results in a much smaller bundle
21
+ // size when imported on its own
22
+ import { EntityIdentifierUtils } from '@gitkraken/provider-apis/entity-identifiers';
23
+
24
+ // the provider utils entry point exports provider utility functions only, which includes all the bucketing functions
25
+ // used by the launchpad. this results in a much smaller bundle size when imported on its own
26
+ import { ... } from '@gitkraken/provider-apis/provider-utils';
27
+
28
+ // the providers entry point exports all provider API classes only, which are used to perform API calls to the various
29
+ // providers. this results in a smaller bundle size when imported on its own, but not by much
30
+ import { ... } from '@gitkraken/provider-apis/providers';
31
+ ```
32
+
33
+ Table of bundle sizes for each entry point for v0.25.8:
34
+ |Entry point |Parsed size|Gzipped size|
35
+ |--------------------------------------------|-----------|------------|
36
+ |@gitkraken/provider-apis |160 KB |36 KB |
37
+ |@gitkraken/provider-apis/entity-identifiers |8.97 KB |1.42 KB |
38
+ |@gitkraken/provider-apis/provider-utils |34 KB |9.21 KB |
39
+ |@gitkraken/provider-apis/providers |142 KB |32 KB |
40
+
3
41
  ## 0.25.7
4
42
 
5
43
  - fetch description field for issues when using any Jira or Jira Server issue fetching functions
package/dist/index.d.ts CHANGED
@@ -15,17 +15,7 @@ import * as GitHubUtils from './providerUtils/github';
15
15
  import * as GitLabUtils from './providerUtils/gitlab';
16
16
  import * as JiraUtils from './providerUtils/jira';
17
17
  import * as TrelloUtils from './providerUtils/trello';
18
- import { Config } from './types/exportedTypes/types';
19
- declare const makeProviderAPIs: (config?: Partial<Config>) => {
20
- azureDevOps: AzureDevOps;
21
- bitbucket: Bitbucket;
22
- bitbucketServer: BitbucketServer;
23
- github: GitHub;
24
- gitlab: GitLab;
25
- jira: Jira;
26
- jiraServer: JiraServer;
27
- trello: Trello;
28
- };
18
+ import { makeProviderAPIs } from './providers/makeProviderAPIs';
29
19
  export default makeProviderAPIs;
30
20
  export { AzureDevOps, Bitbucket, BitbucketServer, GitHub, GitLab, Jira, JiraServer, Trello };
31
21
  export * from './types/exportedTypes/azureDevOps';
@@ -38,6 +28,7 @@ export * from './types/exportedTypes/issueProvider';
38
28
  export * from './types/exportedTypes/jira';
39
29
  export * from './types/exportedTypes/trello';
40
30
  export * from './types/exportedTypes/types';
31
+ export * from './providers/errors';
41
32
  declare const Utils: {
42
33
  azureDevOps: typeof AzureDevopsUtils;
43
34
  bitbucket: typeof BitbucketUtils;
@@ -0,0 +1,2 @@
1
+ import * as EntityIdentifierUtils from './providerUtils/entityIdentifiers/entityIdentifier';
2
+ export { EntityIdentifierUtils };
@@ -0,0 +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})},P=(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 O=t=>P(g({},"__esModule",{value:!0}),t);var N={};w(N,{EntityIdentifierUtils:()=>m});module.exports=O(N);var m={};w(m,{decode:()=>R,decodeV0:()=>j,encode:()=>k,validate:()=>z});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("azure"),e.push("issue"),e.push("1"),e.push(r.domain||""),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("azure"),e.push("pr"),e.push("1"),e.push(r.domain||""),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 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 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 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 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":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 c:new y;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")}},G=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")},z=t=>{if(t.version==="0"){G(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)},j=(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}}};