@gitkraken/provider-apis 0.19.1 → 0.20.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 (40) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/defaults.d.ts +1 -1
  3. package/dist/fetchWrapper.d.ts +1 -1
  4. package/dist/index.d.ts +11 -13
  5. package/dist/index.js +116 -147
  6. package/dist/providerUtils/gitProvider.d.ts +20 -3
  7. package/dist/providerUtils/shared.d.ts +1 -1
  8. package/dist/providers/azureDevops/azureDevOps.d.ts +7 -53
  9. package/dist/providers/azureDevops/azureDevOpsHelpers.d.ts +3 -3
  10. package/dist/providers/bitbucket/bitbucket.d.ts +4 -11
  11. package/dist/providers/bitbucket/bitbucketHelpers.d.ts +2 -2
  12. package/dist/providers/bitbucketServer/bitbucketServer.d.ts +4 -4
  13. package/dist/providers/gitProvider.d.ts +3 -306
  14. package/dist/providers/github/github.d.ts +5 -3
  15. package/dist/providers/github/githubHelpers.d.ts +3 -3
  16. package/dist/providers/gitlab/gitlab.d.ts +6 -15
  17. package/dist/providers/gitlab/gitlabHelpers.d.ts +3 -3
  18. package/dist/providers/issueProvider.d.ts +3 -91
  19. package/dist/providers/jira/jira.d.ts +9 -24
  20. package/dist/providers/jira/{sharedHelpers.d.ts → jiraHelpers.d.ts} +5 -4
  21. package/dist/providers/{jiraServer → jira}/jiraServer.d.ts +8 -11
  22. package/dist/providers/provider.d.ts +1 -1
  23. package/dist/providers/trello/trello.d.ts +5 -26
  24. package/dist/types/exportedTypes/azureDevOps.d.ts +100 -0
  25. package/dist/types/exportedTypes/bitbucket.d.ts +15 -0
  26. package/dist/types/exportedTypes/gitProvider.d.ts +301 -0
  27. package/dist/types/exportedTypes/github.d.ts +23 -0
  28. package/dist/types/exportedTypes/gitlab.d.ts +7 -0
  29. package/dist/types/exportedTypes/issueProvider.d.ts +90 -0
  30. package/dist/types/exportedTypes/jira.d.ts +58 -0
  31. package/dist/types/exportedTypes/trello.d.ts +22 -0
  32. package/dist/{types.d.ts → types/exportedTypes/types.d.ts} +44 -3
  33. package/dist/{providers/azureDevops/azureDevOpsTypes.d.ts → types/internalTypes/azureDevOps.d.ts} +0 -51
  34. package/dist/{providers/bitbucketServer/bitbucketServerTypes.d.ts → types/internalTypes/bitbucketServer.d.ts} +0 -7
  35. package/dist/{providers/github/githubTypes.d.ts → types/internalTypes/github.d.ts} +0 -23
  36. package/dist/{providers/jira/sharedTypes.d.ts → types/internalTypes/jira.d.ts} +1 -38
  37. package/dist/utils.d.ts +3 -3
  38. package/package.json +1 -1
  39. /package/dist/{providers/bitbucket/bitbucketTypes.d.ts → types/internalTypes/bitbucket.d.ts} +0 -0
  40. /package/dist/{providers/gitlab/gitlabTypes.d.ts → types/internalTypes/gitlab.d.ts} +0 -0
@@ -0,0 +1,23 @@
1
+ import { GetRepoInput } from './gitProvider';
2
+ export declare enum GitHubIssueCloseReason {
3
+ Completed = "COMPLETED",
4
+ NotPlanned = "NOT_PLANNED"
5
+ }
6
+ export interface FetchPullRequestsData {
7
+ repos: GetRepoInput[];
8
+ assigneeLogins?: string[];
9
+ updatedBefore?: string;
10
+ isDraft?: boolean;
11
+ authorLogin?: string;
12
+ mentionLogin?: string;
13
+ reviewRequestedLogin?: string;
14
+ startQuery?: string;
15
+ }
16
+ export interface FetchIssuesData {
17
+ repos: GetRepoInput[];
18
+ assigneeLogins?: string[];
19
+ updatedBefore?: string;
20
+ authorLogin?: string;
21
+ mentionLogin?: string;
22
+ startQuery?: string;
23
+ }
@@ -0,0 +1,7 @@
1
+ export type PullRequestState = 'opened' | 'merged' | 'closed';
2
+ export type PullRequestAssociation = 'assigned' | 'authored' | 'reviewRequested';
3
+ export interface GitLabGetIssueInput {
4
+ namespace: string;
5
+ name: string;
6
+ number: string;
7
+ }
@@ -0,0 +1,90 @@
1
+ import { Account, GetReposInput, GitLabel, GitMilestone } from './gitProvider';
2
+ export declare enum GitIssueState {
3
+ Open = "OPEN",
4
+ Closed = "CLOSED"
5
+ }
6
+ export interface GetIssueInput {
7
+ resourceId?: string;
8
+ namespace?: string;
9
+ project?: string;
10
+ name?: string;
11
+ number: string;
12
+ }
13
+ export type GetIssuesForReposInput = GetReposInput | {
14
+ repoIds: (string | number)[];
15
+ };
16
+ export interface IssueTransition {
17
+ id: string;
18
+ name: string;
19
+ to: {
20
+ id: string;
21
+ name: string;
22
+ color: string;
23
+ category: IssueStatusCategory;
24
+ };
25
+ }
26
+ export interface IssueComponent {
27
+ description: string | null;
28
+ id: string;
29
+ name: string;
30
+ }
31
+ export type IssueStatusCategory = 'TO_DO' | 'IN_PROGRESS' | 'DONE';
32
+ export interface Issue {
33
+ author: Account | null;
34
+ assignees: Account[];
35
+ commentCount: number | null;
36
+ closedDate: Date | null;
37
+ createdDate: Date;
38
+ description: string | null;
39
+ graphQLId?: string;
40
+ id: string;
41
+ labels: GitLabel[];
42
+ number: string;
43
+ repository: {
44
+ id: string;
45
+ graphQLId?: string;
46
+ name: string;
47
+ owner: {
48
+ login?: string;
49
+ };
50
+ } | null;
51
+ project?: {
52
+ namespace: string | null;
53
+ resourceId: string | null;
54
+ name: string;
55
+ };
56
+ state: {
57
+ id?: string;
58
+ name: string;
59
+ color: string | null;
60
+ category?: IssueStatusCategory;
61
+ } | null;
62
+ statusTransitions?: IssueTransition[];
63
+ components?: IssueComponent[];
64
+ title: string;
65
+ type: string | null;
66
+ updatedDate: Date | null;
67
+ upvoteCount: number | null;
68
+ url: string | null;
69
+ milestone?: GitMilestone | null;
70
+ }
71
+ export interface SetIssueInput {
72
+ id: string;
73
+ graphQLId?: string;
74
+ number: string;
75
+ repository: {
76
+ name: string;
77
+ owner: {
78
+ login?: string;
79
+ };
80
+ } | null;
81
+ project?: {
82
+ namespace: string | null;
83
+ resourceId: string | null;
84
+ name: string;
85
+ };
86
+ }
87
+ export interface SetStatusInput {
88
+ name: string;
89
+ id?: string;
90
+ }
@@ -0,0 +1,58 @@
1
+ export interface JiraResource {
2
+ id: string;
3
+ name: string;
4
+ url: string;
5
+ avatarUrl: string;
6
+ }
7
+ export interface JiraProject {
8
+ id: string;
9
+ key: string;
10
+ name: string;
11
+ resourceId: string;
12
+ }
13
+ export interface JiraGetIssueInput {
14
+ resourceId: string;
15
+ number: string;
16
+ }
17
+ export interface JiraServerProject {
18
+ id: string;
19
+ name: string;
20
+ }
21
+ export interface SetComponentInput {
22
+ id: string;
23
+ }
24
+ export interface AvatarUrls {
25
+ '16x16': string;
26
+ '24x24': string;
27
+ '32x32': string;
28
+ '48x48': string;
29
+ }
30
+ export interface JiraUser {
31
+ accountId?: string;
32
+ accountType: string;
33
+ active: boolean;
34
+ avatarUrls: AvatarUrls;
35
+ displayName: string;
36
+ emailAddress: string;
37
+ key?: string;
38
+ self: string;
39
+ timeZone: string;
40
+ name?: string;
41
+ }
42
+ export interface JiraComponent {
43
+ ari?: string;
44
+ assignee?: JiraUser;
45
+ assigneeType: string;
46
+ description?: string;
47
+ id: string;
48
+ isAssigneeTypeValid: boolean;
49
+ lead?: JiraUser;
50
+ leadUserName?: string;
51
+ metadata?: unknown;
52
+ name: string;
53
+ project: string;
54
+ projectId: string;
55
+ realAssignee?: JiraUser;
56
+ realAssigneeType: string;
57
+ self: string;
58
+ }
@@ -0,0 +1,22 @@
1
+ export interface TrelloBoard {
2
+ id: string;
3
+ name: string;
4
+ }
5
+ export interface TrelloList {
6
+ id: string;
7
+ name: string;
8
+ closed: boolean;
9
+ pos: number;
10
+ softLimit: string;
11
+ idBoard: string;
12
+ subscribed: boolean;
13
+ limits: {
14
+ attachments: {
15
+ perBoard: {
16
+ status: string;
17
+ disableAt: number;
18
+ warnAt: number;
19
+ };
20
+ };
21
+ };
22
+ }
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node-fetch" />
2
- import { type GitPullRequest } from './providers/gitProvider';
2
+ import { GitPullRequest } from './gitProvider';
3
3
  export type Fetch = typeof import('node-fetch').default;
4
4
  export declare const isFetch: (fetch: Fetch | RequestFunction, forceIsFetch?: boolean) => fetch is typeof import("node-fetch").default;
5
5
  export type RequestFunction = <T>(options: RequestOptions) => Promise<Response<T>>;
@@ -80,12 +80,53 @@ export type PagedResult<T> = {
80
80
  };
81
81
  export type FullFieldMap<T> = Record<keyof T, boolean>;
82
82
  export type FieldMap<T> = Partial<FullFieldMap<T>>;
83
- export type PullRequestBucketID = 'readyToMerge' | 'unassignedReviewers' | 'failingCI' | 'conflicts' | 'needsMyReview' | 'changesRequested' | 'reviewerCommented' | 'waitingForReview' | 'draft' | 'other';
83
+ export type PullRequestActionCategory = 'readyToMerge' | 'unassignedReviewers' | 'failingCI' | 'conflicts' | 'needsMyReview' | 'changesRequested' | 'reviewerCommented' | 'waitingForReview' | 'draft' | 'other';
84
+ export type PullRequestBucketID = PullRequestActionCategory | 'pinned' | 'snoozed';
84
85
  export interface PullRequestBucket {
85
86
  id: PullRequestBucketID;
86
87
  faIconName: string;
87
88
  name: string;
88
89
  priority: number;
89
- pullRequests: GitPullRequest[];
90
+ pullRequests: PullRequestWithUniqueID[];
90
91
  }
92
+ export type EnrichedItemsByUniqueId = {
93
+ [uuid: string]: EnrichedItem[];
94
+ };
95
+ export type EnrichedItem = {
96
+ id: string;
97
+ userId?: string;
98
+ type: 'pin' | 'snooze';
99
+ provider: 'azure' | 'bitbucket' | 'github' | 'gitlab' | 'jira' | 'trello' | 'gitkraken';
100
+ entityType: 'issue' | 'pr';
101
+ entityId: string;
102
+ entityUrl: string;
103
+ createdAt: string;
104
+ updatedAt: string;
105
+ expiresAt?: string;
106
+ };
107
+ export type PullRequestWithUniqueID = GitPullRequest & {
108
+ uuid: string;
109
+ };
110
+ export type ActionablePullRequest = PullRequestWithUniqueID & {
111
+ suggestedActionCategory: PullRequestActionCategory;
112
+ priority: number;
113
+ viewer: {
114
+ canMerge: boolean;
115
+ isAuthor: boolean;
116
+ isAssignee: boolean;
117
+ isReviewer: boolean;
118
+ shouldMerge: boolean;
119
+ shouldAssignReviewer: boolean;
120
+ waitingOnReviews: boolean;
121
+ shouldReview: boolean;
122
+ pinned?: boolean;
123
+ snoozed?: boolean;
124
+ enrichedItems?: EnrichedItem[];
125
+ };
126
+ failingCI: boolean;
127
+ hasConflicts: boolean;
128
+ changeRequestReviewCount: number;
129
+ commentReviewCount: number;
130
+ approvalReviewCount: number;
131
+ };
91
132
  export type PullRequestBuckets = Record<PullRequestBucketID, PullRequestBucket>;
@@ -197,58 +197,7 @@ export interface AzureIssue {
197
197
  };
198
198
  url: string;
199
199
  }
200
- export interface WorkItemTypeField {
201
- helpText: string;
202
- alwaysRequired: boolean;
203
- referenceName: string;
204
- name: string;
205
- url: string;
206
- }
207
- export interface WorkItemTypeTransition {
208
- to: string;
209
- actions: string[] | null;
210
- }
211
- export interface WorkItemState {
212
- category: 'Proposed' | 'InProgress' | 'Resolved' | 'Completed' | 'Removed';
213
- color: string;
214
- name: string;
215
- }
216
- export interface WorkItemType {
217
- name: string;
218
- referenceName: string;
219
- description: string;
220
- color: string;
221
- icon: {
222
- id: string;
223
- url: string;
224
- };
225
- isDisabled: boolean;
226
- xmlForm: string;
227
- fields: WorkItemTypeField[];
228
- fieldInstances: WorkItemTypeField[];
229
- transitions: {
230
- [index: string]: WorkItemTypeTransition;
231
- };
232
- states: WorkItemState[];
233
- url: string;
234
- }
235
- export interface AzureGraphAccount {
236
- avatarUrl: string | null;
237
- descriptor: string;
238
- email: string | null;
239
- name: string;
240
- storageKeyURL: string;
241
- username: string;
242
- }
243
200
  export interface UpdatePullRequestResponse {
244
201
  status: string;
245
202
  }
246
- export declare enum PullRequestAsyncStatus {
247
- Conflicts = "conflicts",
248
- Failure = "failure",
249
- NotSet = "notSet",
250
- Queued = "queued",
251
- RejectedByPolicy = "rejectedByPolicy",
252
- Succeeded = "succeeded"
253
- }
254
203
  export {};
@@ -4,13 +4,6 @@ export interface Link {
4
4
  export interface NamedLink<T extends string = string> extends Link {
5
5
  name: T;
6
6
  }
7
- export interface BitbucketServerMergeStrategy {
8
- description: string;
9
- enabled: boolean;
10
- flag: string;
11
- id: string;
12
- name: string;
13
- }
14
7
  export interface BitbucketServerPagedResponse<T> {
15
8
  values: T[];
16
9
  size: number;
@@ -1,8 +1,3 @@
1
- import { GetRepoInput } from '../gitProvider';
2
- export declare enum GitHubIssueCloseReason {
3
- Completed = "COMPLETED",
4
- NotPlanned = "NOT_PLANNED"
5
- }
6
1
  export declare enum GraphQLViewerPermission {
7
2
  ADMIN = "ADMIN",
8
3
  MAINTAIN = "MAINTAIN",
@@ -264,24 +259,6 @@ export interface GraphQLMilestone {
264
259
  title: string;
265
260
  url: string;
266
261
  }
267
- export interface FetchPullRequestsData {
268
- repos: GetRepoInput[];
269
- assigneeLogins?: string[];
270
- updatedBefore?: string;
271
- isDraft?: boolean;
272
- authorLogin?: string;
273
- mentionLogin?: string;
274
- reviewRequestedLogin?: string;
275
- startQuery?: string;
276
- }
277
- export interface FetchIssuesData {
278
- repos: GetRepoInput[];
279
- assigneeLogins?: string[];
280
- updatedBefore?: string;
281
- authorLogin?: string;
282
- mentionLogin?: string;
283
- startQuery?: string;
284
- }
285
262
  export interface GraphQLReviewThread {
286
263
  comments: {
287
264
  nodes: GraphQLReviewComment[];
@@ -1,24 +1,4 @@
1
- export interface SetComponentInput {
2
- id: string;
3
- }
4
- export interface AvatarUrls {
5
- '16x16': string;
6
- '24x24': string;
7
- '32x32': string;
8
- '48x48': string;
9
- }
10
- export interface JiraUser {
11
- accountId?: string;
12
- accountType: string;
13
- active: boolean;
14
- avatarUrls: AvatarUrls;
15
- displayName: string;
16
- emailAddress: string;
17
- key?: string;
18
- self: string;
19
- timeZone: string;
20
- name?: string;
21
- }
1
+ import { AvatarUrls, JiraUser } from '../exportedTypes/jira';
22
2
  export interface JiraTransition {
23
3
  id: string;
24
4
  name: string;
@@ -49,23 +29,6 @@ export interface JiraComponentStub {
49
29
  name: string;
50
30
  self: string;
51
31
  }
52
- export interface JiraComponent {
53
- ari?: string;
54
- assignee?: JiraUser;
55
- assigneeType: string;
56
- description?: string;
57
- id: string;
58
- isAssigneeTypeValid: boolean;
59
- lead?: JiraUser;
60
- leadUserName?: string;
61
- metadata?: unknown;
62
- name: string;
63
- project: string;
64
- projectId: string;
65
- realAssignee?: JiraUser;
66
- realAssigneeType: string;
67
- self: string;
68
- }
69
32
  export interface JiraIssueStatus {
70
33
  id: string;
71
34
  name: string;
package/dist/utils.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { FieldMap } from './types';
1
+ import { FieldMap } from './types/exportedTypes/types';
2
2
  export declare const getRequestHeaders: (token?: string, basicAuth?: boolean) => Record<string, string>;
3
- export declare const toFieldMap: <T, K extends keyof T = keyof T>(fields?: K[] | undefined) => Partial<import("./types").FullFieldMap<T>> | undefined;
3
+ export declare const toFieldMap: <T, K extends keyof T = keyof T>(fields?: K[] | undefined) => Partial<import("./types/exportedTypes/types").FullFieldMap<T>> | undefined;
4
4
  /**
5
5
  * Returns providerQueryString if requestedFields is undefined or if any of the normalized fields depend on the query string.
6
6
  * @param requestedFields
@@ -8,4 +8,4 @@ export declare const toFieldMap: <T, K extends keyof T = keyof T>(fields?: K[] |
8
8
  * @param providerQueryString
9
9
  * @returns string
10
10
  */
11
- export declare const fieldQuery: <T>(requestedFields: Partial<import("./types").FullFieldMap<T>> | undefined, normalizedFields: (keyof T)[], providerQueryString: string) => string;
11
+ export declare const fieldQuery: <T>(requestedFields: Partial<import("./types/exportedTypes/types").FullFieldMap<T>> | undefined, normalizedFields: (keyof T)[], providerQueryString: string) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitkraken/provider-apis",
3
- "version": "0.19.1",
3
+ "version": "0.20.0",
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",