@gitkraken/provider-apis 0.25.3 → 0.25.5
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Account } from '../types/exportedTypes/gitProvider';
|
|
2
|
-
import type { ActionablePullRequest, CodeSuggestionsCountByPrUuid, EnrichedItemsByUniqueId, PullRequestBuckets, PullRequestWithUniqueID } from '../types/exportedTypes/types';
|
|
2
|
+
import type { ActionablePullRequest, CodeSuggestionsCountByPrUuid, EnrichedItemsByUniqueId, OrganizationMemberIdentitiesMap, OrganizationMemberIdentityPrProvider, PullRequestBuckets, PullRequestGroupByCategory, PullRequestWithUniqueID, Team, Workspace } from '../types/exportedTypes/types';
|
|
3
3
|
export declare const PINNED_BUCKET_ID = "pinned";
|
|
4
4
|
export declare const READY_TO_MERGE_BUCKET_ID = "readyToMerge";
|
|
5
5
|
export declare const UNASSIGNED_REVIEWERS_BUCKET_ID = "unassignedReviewers";
|
|
@@ -30,3 +30,47 @@ export declare const groupPullRequestsIntoBuckets: (pullRequests: PullRequestWit
|
|
|
30
30
|
enrichedItemsByUniqueId?: EnrichedItemsByUniqueId;
|
|
31
31
|
codeSuggestionsCountByPrUuid?: CodeSuggestionsCountByPrUuid;
|
|
32
32
|
}) => PullRequestBuckets;
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* @param pullRequests the list of PRs with unique IDs from provider package
|
|
36
|
+
* @returns PullRequestGroupByCategory - similar structure to status buckets where the bucketId is the repo's unique id
|
|
37
|
+
*/
|
|
38
|
+
export declare const groupPullRequestsByRepo: (pullRequests: PullRequestWithUniqueID[]) => PullRequestGroupByCategory | import("../types/exportedTypes/types").IssueGroupByCategory;
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* @param pullRequests the list of PRs with unique IDs from provider package
|
|
42
|
+
* @returns PullRequestGroupByCategory - similar structure to status buckets where the bucketId is the assignee's unique id
|
|
43
|
+
* If PR has multiple assignees, it will end up in all relevant assignee groups
|
|
44
|
+
*/
|
|
45
|
+
export declare const groupPullRequestsByAssignee: (pullRequests: PullRequestWithUniqueID[]) => PullRequestGroupByCategory | import("../types/exportedTypes/types").IssueGroupByCategory;
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
* @param pullRequests the list of PRs with unique IDs from provider package
|
|
49
|
+
* @returns PullRequestGroupByCategory - similar structure to status buckets where the bucketId is the author's unique id
|
|
50
|
+
*/
|
|
51
|
+
export declare const groupPullRequestsByAuthor: (pullRequests: PullRequestWithUniqueID[]) => PullRequestGroupByCategory | import("../types/exportedTypes/types").IssueGroupByCategory;
|
|
52
|
+
/**
|
|
53
|
+
*
|
|
54
|
+
* @param pullRequests the list of PRs with unique IDs from provider package
|
|
55
|
+
* @returns PullRequestGroupByCategory - similar structure to status buckets where the bucketId is the reviewer's unique id
|
|
56
|
+
* If PR has multiple reviewers, it will end up in all relevant reviewer groups
|
|
57
|
+
*/
|
|
58
|
+
export declare const groupPullRequestsByReviewer: (pullRequests: PullRequestWithUniqueID[]) => PullRequestGroupByCategory | import("../types/exportedTypes/types").IssueGroupByCategory;
|
|
59
|
+
/**
|
|
60
|
+
*
|
|
61
|
+
* @param pullRequests the list of PRs with unique IDs from provider package
|
|
62
|
+
* @param workspaces the list of workspaces. This should match the value returned from the /workspaces API
|
|
63
|
+
* @returns PullRequestGroupByCategory - similar structure to status buckets where the bucketId is the workspace's unique id
|
|
64
|
+
* If repo for PR belongs to multiple workspaces, it will end up in all relevant workspace groups
|
|
65
|
+
*/
|
|
66
|
+
export declare const groupPullRequestsByWorkspace: (pullRequests: PullRequestWithUniqueID[], workspaces: Workspace[]) => PullRequestGroupByCategory | import("../types/exportedTypes/types").IssueGroupByCategory;
|
|
67
|
+
/**
|
|
68
|
+
*
|
|
69
|
+
* @param pullRequests the list of PRs with unique IDs from provider package
|
|
70
|
+
* @param organizationMemberIdentities the response from the member-identities route. map of GK id to provider ids
|
|
71
|
+
* @param provider the provider name to get the user id from
|
|
72
|
+
* @param teams a list of organization teams
|
|
73
|
+
* @returns similar structure to status buckets where the bucketId is the team's unique id
|
|
74
|
+
* @todo future improvement is to let surface define relationship of users. So surface could say 'team member is author' or something
|
|
75
|
+
*/
|
|
76
|
+
export declare const groupPullRequestsByGitKrakenTeam: (pullRequests: PullRequestWithUniqueID[], organizationMemberIdentities: OrganizationMemberIdentitiesMap, provider: OrganizationMemberIdentityPrProvider, teams: Team[]) => PullRequestGroupByCategory | import("../types/exportedTypes/types").IssueGroupByCategory;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { IssueGroupByCategory, IssueWithUniqueID, OrganizationMemberIdentitiesMap, OrganizationMemberIdentityIssueProvider, Team } from '../types/exportedTypes/types';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param issues the list of issues with unique IDs from provider package
|
|
5
|
+
* @returns IssueGroupByCategory - where the bucketId is the repo's unique id
|
|
6
|
+
*/
|
|
7
|
+
export declare const groupIssuesByRepo: (issues: IssueWithUniqueID[]) => import("../types/exportedTypes/types").PullRequestGroupByCategory | IssueGroupByCategory;
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param issues the list of issues with unique IDs from provider package
|
|
11
|
+
* @returns IssueGroupByCategory - where the bucketId is the assignee's unique id
|
|
12
|
+
* If issue has multiple assignees, item will end up in all relevant assignee groups
|
|
13
|
+
*/
|
|
14
|
+
export declare const groupIssuesByAssignee: (issues: IssueWithUniqueID[]) => import("../types/exportedTypes/types").PullRequestGroupByCategory | IssueGroupByCategory;
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @param issues the list of issues with unique IDs from provider package
|
|
18
|
+
* @returns IssueGroupByCategory - where the bucketId is the author's unique id
|
|
19
|
+
*/
|
|
20
|
+
export declare const groupIssuesByAuthor: (issues: IssueWithUniqueID[]) => import("../types/exportedTypes/types").PullRequestGroupByCategory | IssueGroupByCategory;
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @param issues the list of issues with unique IDs from provider package
|
|
24
|
+
* @param organizationMemberIdentities the response from the member-identities route. map of GK id to provider ids
|
|
25
|
+
* @param provider the provider name to get the user id from
|
|
26
|
+
* @param teams a list of organization teams
|
|
27
|
+
* @returns IssueGroupByCategory - where the bucketId is the team's unique id
|
|
28
|
+
* @todo future improvement is to let surface define relationship of users. So surface could say 'team member is author' or something
|
|
29
|
+
*/
|
|
30
|
+
export declare const groupIssuesByGitKrakenTeam: (issues: IssueWithUniqueID[], organizationMemberIdentities: OrganizationMemberIdentitiesMap, provider: OrganizationMemberIdentityIssueProvider, teams: Team[]) => import("../types/exportedTypes/types").PullRequestGroupByCategory | IssueGroupByCategory;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { GitPullRequestReviewState } from '../types/exportedTypes/gitProvider';
|
|
1
|
+
import { Account, GitPullRequestReviewState } from '../types/exportedTypes/gitProvider';
|
|
2
|
+
import { IssueGroupByCategory, PullRequestGroupByCategory } from '../types/exportedTypes/types';
|
|
2
3
|
export declare const summarizeReviewDecision: (reviews: {
|
|
3
4
|
state: GitPullRequestReviewState;
|
|
4
5
|
}[] | null) => GitPullRequestReviewState | null;
|
|
6
|
+
export declare const getAccountNameWithFallback: (account: Account, fallback: string) => string;
|
|
7
|
+
export declare const setGroupPriorityAlphabetically: (groupedItems: PullRequestGroupByCategory | IssueGroupByCategory) => PullRequestGroupByCategory | IssueGroupByCategory;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="node-fetch" />
|
|
2
|
-
import { GitPullRequest } from './gitProvider';
|
|
2
|
+
import { Account, GitPullRequest } from './gitProvider';
|
|
3
|
+
import { Issue } from './issueProvider';
|
|
3
4
|
export type Fetch = typeof import('node-fetch').default;
|
|
4
5
|
export declare const isFetch: (fetch: Fetch | RequestFunction, forceIsFetch?: boolean) => fetch is typeof import("node-fetch").default;
|
|
5
6
|
export type RequestFunction = <T>(options: RequestOptions) => Promise<Response<T>>;
|
|
@@ -82,13 +83,21 @@ export type FullFieldMap<T> = Record<keyof T, boolean>;
|
|
|
82
83
|
export type FieldMap<T> = Partial<FullFieldMap<T>>;
|
|
83
84
|
export type PullRequestActionCategory = 'readyToMerge' | 'unassignedReviewers' | 'failingCI' | 'conflicts' | 'needsMyReview' | 'changesRequested' | 'reviewerCommented' | 'waitingForReview' | 'draft' | 'other';
|
|
84
85
|
export type PullRequestBucketID = PullRequestActionCategory | 'pinned' | 'snoozed';
|
|
85
|
-
|
|
86
|
-
id: PullRequestBucketID;
|
|
87
|
-
faIconName: string;
|
|
86
|
+
interface PullRequestBucketBase {
|
|
88
87
|
name: string;
|
|
89
88
|
priority: number;
|
|
90
89
|
pullRequests: PullRequestWithUniqueID[];
|
|
91
90
|
}
|
|
91
|
+
export interface PullRequestBucket extends PullRequestBucketBase {
|
|
92
|
+
id: PullRequestBucketID;
|
|
93
|
+
faIconName: string;
|
|
94
|
+
}
|
|
95
|
+
export interface PullRequestGroupByBucket extends PullRequestBucketBase {
|
|
96
|
+
id: string;
|
|
97
|
+
accountData?: Account;
|
|
98
|
+
}
|
|
99
|
+
export type OrganizationMemberIdentityPrProvider = 'github' | 'gitlab' | 'bitbucket' | 'azure';
|
|
100
|
+
export type OrganizationMemberIdentityIssueProvider = 'github' | 'gitlab' | 'jira' | 'azure' | 'trello';
|
|
92
101
|
export type EnrichedItemsByUniqueId = {
|
|
93
102
|
[uuid: string]: EnrichedItem[];
|
|
94
103
|
};
|
|
@@ -136,3 +145,52 @@ export type ActionablePullRequest = PullRequestWithUniqueID & {
|
|
|
136
145
|
approvalReviewCount: number;
|
|
137
146
|
};
|
|
138
147
|
export type PullRequestBuckets = Record<PullRequestBucketID, PullRequestBucket>;
|
|
148
|
+
export type IssueWithUniqueID = Issue & {
|
|
149
|
+
uuid: string;
|
|
150
|
+
};
|
|
151
|
+
export interface IssueGroupByBucket {
|
|
152
|
+
name: string;
|
|
153
|
+
priority: number;
|
|
154
|
+
issues: IssueWithUniqueID[];
|
|
155
|
+
id: string;
|
|
156
|
+
accountData?: Account;
|
|
157
|
+
}
|
|
158
|
+
export interface PullRequestGroupByCategory {
|
|
159
|
+
[bucketId: string]: PullRequestGroupByBucket;
|
|
160
|
+
}
|
|
161
|
+
export interface IssueGroupByCategory {
|
|
162
|
+
[bucketId: string]: IssueGroupByBucket;
|
|
163
|
+
}
|
|
164
|
+
export interface Workspace {
|
|
165
|
+
id: string;
|
|
166
|
+
name: string;
|
|
167
|
+
azureOrganizationId?: string | null;
|
|
168
|
+
azureProject?: string;
|
|
169
|
+
provider: string;
|
|
170
|
+
providerData?: {
|
|
171
|
+
repositories: {
|
|
172
|
+
nodes: {
|
|
173
|
+
name: string;
|
|
174
|
+
id: string;
|
|
175
|
+
repositoryId?: string;
|
|
176
|
+
providerOrganizationId?: string;
|
|
177
|
+
providerProjectName?: string;
|
|
178
|
+
}[];
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
export interface OrganizationMemberIdentitiesMap {
|
|
183
|
+
[gkId: string]: {
|
|
184
|
+
[provider in OrganizationMemberIdentityPrProvider | OrganizationMemberIdentityIssueProvider]: {
|
|
185
|
+
providerID: string;
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
export interface Team {
|
|
190
|
+
id: string;
|
|
191
|
+
members: {
|
|
192
|
+
id: string;
|
|
193
|
+
}[];
|
|
194
|
+
name: string;
|
|
195
|
+
}
|
|
196
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitkraken/provider-apis",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.5",
|
|
4
4
|
"description": "An SDK around different third-party APIs that accepts and returns data in a common format.",
|
|
5
5
|
"author": "Axosoft, LLC dba GitKraken",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|