Skip to content

Commit

Permalink
Use the provider-api package's encode function for generating PR uuids
Browse files Browse the repository at this point in the history
  • Loading branch information
jdgarcia committed May 31, 2024
1 parent 5ed4e5e commit 4a107f5
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/providers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { AzureDevOps, Bitbucket, GitHub, GitLab } from '@gitkraken/provider-apis';
import {
AzureDevOps,
Bitbucket,
EntityIdentifierProviderType,
EntityIdentifierUtils,
EntityType,
GitHub,
GitLab,
} from '@gitkraken/provider-apis';
import { fetchProviderToken } from './gkApi';
import type { FocusViewData, FocusViewSupportedProvider, Provider, ProviderToken } from './types';

Expand Down Expand Up @@ -27,13 +35,14 @@ const fetchGitHubFocusViewData = async (token: ProviderToken) => {
providerUser: providerUser,
pullRequests: pullRequests.map(pr => ({
...pr,
uuid: JSON.stringify([
token.domain ? 'githubEnterprise' : 'github',
'pr',
'1',
token.domain || '',
pr.graphQLId || pr.id,
]),
uuid: EntityIdentifierUtils.encode({
provider: token.domain
? EntityIdentifierProviderType.GithubEnterprise
: EntityIdentifierProviderType.Github,
entityType: EntityType.PullRequest,
domain: token.domain,
entityId: pr.graphQLId || pr.id,
}),
})),
};
};
Expand Down

0 comments on commit 4a107f5

Please sign in to comment.