@gitkraken/provider-apis 0.25.4 → 0.25.6

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,23 @@ 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
- export interface PullRequestBucket {
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
+ faIconName?: string;
99
+ teamData?: Team;
100
+ }
101
+ export type OrganizationMemberIdentityPrProvider = 'github' | 'gitlab' | 'bitbucket' | 'azure';
102
+ export type OrganizationMemberIdentityIssueProvider = 'github' | 'gitlab' | 'jira' | 'azure' | 'trello';
92
103
  export type EnrichedItemsByUniqueId = {
93
104
  [uuid: string]: EnrichedItem[];
94
105
  };
@@ -136,3 +147,51 @@ export type ActionablePullRequest = PullRequestWithUniqueID & {
136
147
  approvalReviewCount: number;
137
148
  };
138
149
  export type PullRequestBuckets = Record<PullRequestBucketID, PullRequestBucket>;
150
+ export type IssueWithUniqueID = Issue & {
151
+ uuid: string;
152
+ };
153
+ export interface IssueGroupByBucket {
154
+ name: string;
155
+ priority: number;
156
+ issues: IssueWithUniqueID[];
157
+ id: string;
158
+ accountData?: Account;
159
+ }
160
+ export interface PullRequestGroupByCategory {
161
+ [bucketId: string]: PullRequestGroupByBucket;
162
+ }
163
+ export interface IssueGroupByCategory {
164
+ [bucketId: string]: IssueGroupByBucket;
165
+ }
166
+ export interface Workspace {
167
+ id: string;
168
+ name: string;
169
+ azureOrganizationId?: string | null;
170
+ azureProject?: string | null;
171
+ provider: string;
172
+ providerData?: {
173
+ repositories: {
174
+ nodes: {
175
+ name: string;
176
+ id: string;
177
+ repositoryId?: string | null;
178
+ providerOrganizationId?: string | null;
179
+ providerProjectName?: string | null;
180
+ }[];
181
+ };
182
+ } | null;
183
+ }
184
+ export interface OrganizationMemberIdentitiesMap {
185
+ [gkId: string]: Record<OrganizationMemberIdentityPrProvider | OrganizationMemberIdentityIssueProvider, {
186
+ providerID: string;
187
+ }> | undefined;
188
+ }
189
+ export interface Team {
190
+ id: string;
191
+ iconUrl?: string | null;
192
+ members?: {
193
+ id: string;
194
+ }[];
195
+ name: string;
196
+ }
197
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitkraken/provider-apis",
3
- "version": "0.25.4",
3
+ "version": "0.25.6",
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",