@gitkraken/provider-apis 0.20.0 → 0.22.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.
Files changed (23) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/dist/index.d.ts +4 -1
  3. package/dist/index.js +152 -152
  4. package/dist/providerUtils/azureDevops.d.ts +2 -2
  5. package/dist/providerUtils/bitbucket.d.ts +2 -2
  6. package/dist/providerUtils/bitbucketServer.d.ts +2 -2
  7. package/dist/providerUtils/entityIdentifiers/entityIdentifier.d.ts +5 -0
  8. package/dist/providerUtils/entityIdentifiers/providerEntityIdentifiers/azureDevopsIssueEntityIdentifier.d.ts +7 -0
  9. package/dist/providerUtils/entityIdentifiers/providerEntityIdentifiers/azureDevopsPullRequestEntityIdentifier.d.ts +7 -0
  10. package/dist/providerUtils/entityIdentifiers/providerEntityIdentifiers/bitbucketIssueEntityIdentifier.d.ts +7 -0
  11. package/dist/providerUtils/entityIdentifiers/providerEntityIdentifiers/bitbucketPullRequestEntityIdentifier.d.ts +7 -0
  12. package/dist/providerUtils/entityIdentifiers/providerEntityIdentifiers/githubIssueEntityIdentifier.d.ts +7 -0
  13. package/dist/providerUtils/entityIdentifiers/providerEntityIdentifiers/githubPullRequestEntityIdentifier.d.ts +7 -0
  14. package/dist/providerUtils/entityIdentifiers/providerEntityIdentifiers/gitlabIssueEntityIdentifier.d.ts +7 -0
  15. package/dist/providerUtils/entityIdentifiers/providerEntityIdentifiers/gitlabPullRequestEntityIdentifier.d.ts +7 -0
  16. package/dist/providerUtils/entityIdentifiers/providerEntityIdentifiers/jiraIssueEntityIdentifier.d.ts +7 -0
  17. package/dist/providerUtils/entityIdentifiers/providerEntityIdentifiers/trelloIssueEntityIdentifier.d.ts +7 -0
  18. package/dist/providerUtils/github.d.ts +0 -2
  19. package/dist/providerUtils/gitlab.d.ts +2 -2
  20. package/dist/providerUtils/jira.d.ts +2 -2
  21. package/dist/providerUtils/trello.d.ts +2 -1
  22. package/dist/types/exportedTypes/entityIdentifierTypes.d.ts +118 -0
  23. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,4 +1,59 @@
1
1
  # Changelog
2
+ ## 0.22.0
3
+
4
+ ### ⚠️ Breaking Changes
5
+ ```ts
6
+ import { EntityIdentifier } from '@gitkraken/provider-apis';
7
+ ```
8
+ is now:
9
+ ```ts
10
+ import { EntityIdentifierUtils } from '@gitkraken/provider-apis';
11
+ ```
12
+
13
+
14
+ - `EntityProviderType` and `EntityType` are now names instead of numbers
15
+ - EntityIdentifier `encode` and `decode` now optionally takes in more specific provider entity types
16
+ - Fix trello entityIdentifier error message
17
+
18
+ ## 0.21.0
19
+
20
+ ### ⚠️ Breaking Changes
21
+
22
+ Added new entity ID API for encoding/decoding entity IDs (previously known as unique IDs). This API replaces the `getPullRequestUniqueId` and `getIssueUniqueId` utility functions in older versions of this library.
23
+
24
+ The `EntityIdentifier` type represents a particular pull request or issue for a particular provider. The information stored in this type is enough to query the provider's REST or GraphQL API to fetch additional information about the entity (i.e. title, description, assignees, etc) or mutate the entity. `EntityIdentifier` is designed to be
25
+ serialized so we can send it to our backend services, giving us a portable way to communicate about pull requests or issues.
26
+
27
+ These are the new functions provided by the API:
28
+ - `validate`: takes an `EntityIdentifier` as input and validates that it is correctly formed
29
+ - `encode`: takes an `EntityIdentifier` as input and encodes it to an array of strings, which can be serialized and sent to our REST APIs
30
+ - `decode`: takes an array string and decodes it to an `EntityIdentifier`
31
+
32
+ Conversion guide:
33
+ ```ts
34
+ const pullRequest: GitPullRequest = { /* ... pr from somewhere ... */ };
35
+ const githubEnterpriseDomain: string | undefined = ...; // undefined if this PR exists on https://github.com
36
+
37
+ // pre-v0.21.0 way to encode a unique ID (now called a V0 entity ID)
38
+ Utils.github.getPullRequestUniqueId({
39
+ pullRequest.id,
40
+ githubEnterpriseDomain,
41
+ });
42
+
43
+ // v0.21.0 way to encode an entity ID
44
+ encode({
45
+ provider: EntityIdentifierProviderType.Github,
46
+ entityType: EntityType.PullRequest,
47
+ version: EntityVersion.One,
48
+ domain: githubEnterpriseDomain ?? null,
49
+ resourceId: null,
50
+ accountOrOrgId: null,
51
+ organizationName: null,
52
+ projectId: null,
53
+ repoId: null,
54
+ entityId: pullRequest.id,
55
+ });
56
+ ```
2
57
 
3
58
  ## 0.20.0
4
59
 
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ import { Trello } from './providers/trello/trello';
9
9
  import * as AzureDevopsUtils from './providerUtils/azureDevops';
10
10
  import * as BitbucketUtils from './providerUtils/bitbucket';
11
11
  import * as BitbucketServerUtils from './providerUtils/bitbucketServer';
12
+ import * as EntityIdentifierUtils from './providerUtils/entityIdentifiers/entityIdentifier';
12
13
  import * as GitProviderUtils from './providerUtils/gitProvider';
13
14
  import * as GitHubUtils from './providerUtils/github';
14
15
  import * as GitLabUtils from './providerUtils/gitlab';
@@ -29,6 +30,7 @@ export default makeProviderAPIs;
29
30
  export { AzureDevOps, Bitbucket, BitbucketServer, GitHub, GitLab, Jira, JiraServer, Trello };
30
31
  export * from './types/exportedTypes/azureDevOps';
31
32
  export * from './types/exportedTypes/bitbucket';
33
+ export * from './types/exportedTypes/entityIdentifierTypes';
32
34
  export * from './types/exportedTypes/gitProvider';
33
35
  export * from './types/exportedTypes/github';
34
36
  export * from './types/exportedTypes/gitlab';
@@ -45,5 +47,6 @@ declare const Utils: {
45
47
  gitProvider: typeof GitProviderUtils;
46
48
  jira: typeof JiraUtils;
47
49
  trello: typeof TrelloUtils;
50
+ entityIdentifier: typeof EntityIdentifierUtils;
48
51
  };
49
- export { AzureDevopsUtils, BitbucketServerUtils, BitbucketUtils, GitHubUtils, GitLabUtils, GitProviderUtils, JiraUtils, TrelloUtils, Utils, };
52
+ export { AzureDevopsUtils, BitbucketServerUtils, BitbucketUtils, EntityIdentifierUtils, GitHubUtils, GitLabUtils, GitProviderUtils, JiraUtils, TrelloUtils, Utils, };