@gitkraken/provider-apis 0.14.0 → 0.14.2

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.
@@ -0,0 +1,4 @@
1
+ import { GitPullRequestReviewState } from '../providers/gitProvider';
2
+ export declare const summarizeReviewDecision: (reviews: {
3
+ state: GitPullRequestReviewState;
4
+ }[] | null) => GitPullRequestReviewState | null;
@@ -35,6 +35,7 @@ export declare class AzureDevOps extends Provider implements GitProvider {
35
35
  username: string;
36
36
  email: string;
37
37
  avatarUrl: null;
38
+ url: null;
38
39
  };
39
40
  }>;
40
41
  getCurrentUserForInstance(input: {
@@ -146,6 +147,29 @@ export declare class AzureDevOps extends Provider implements GitProvider {
146
147
  }, options?: EnterpriseOptions): Promise<{
147
148
  data: GitPullRequest[];
148
149
  }>;
150
+ private getPullRequestsForProjectBase;
151
+ getPullRequestsForProject(input: {
152
+ namespace: string;
153
+ project: string;
154
+ assigneeLogins?: string[];
155
+ authorLogin?: string;
156
+ } & NumberedPageInput, options?: EnterpriseOptions): Promise<{
157
+ pageInfo: {
158
+ hasNextPage: boolean;
159
+ nextPage: number;
160
+ };
161
+ data: GitPullRequest[];
162
+ }>;
163
+ getPullRequestsForProjects(input: {
164
+ projects: {
165
+ namespace: string;
166
+ project: string;
167
+ }[];
168
+ assigneeLogins?: string[];
169
+ authorLogin?: string;
170
+ }, options?: EnterpriseOptions): Promise<{
171
+ data: GitPullRequest[];
172
+ }>;
149
173
  getAzurePullRequestLastMergeStatus(input: {
150
174
  repo: GetRepoInput;
151
175
  pullRequestId: string;
@@ -208,6 +208,11 @@ export interface WorkItemTypeTransition {
208
208
  to: string;
209
209
  actions: string[] | null;
210
210
  }
211
+ export interface WorkItemState {
212
+ category: 'Proposed' | 'InProgress' | 'Resolved' | 'Completed' | 'Removed';
213
+ color: string;
214
+ name: string;
215
+ }
211
216
  export interface WorkItemType {
212
217
  name: string;
213
218
  referenceName: string;
@@ -222,6 +227,7 @@ export interface WorkItemType {
222
227
  fields: WorkItemTypeField[];
223
228
  fieldInstances: WorkItemTypeField[];
224
229
  transitions: [string: WorkItemTypeTransition];
230
+ states: WorkItemState[];
225
231
  url: string;
226
232
  }
227
233
  export interface UpdatePullRequestResponse {
@@ -15,6 +15,7 @@ export interface Account extends User {
15
15
  id: string;
16
16
  graphQLId?: string;
17
17
  username: string | null;
18
+ url: string | null;
18
19
  }
19
20
  export interface Organization {
20
21
  id: string;
@@ -159,6 +160,7 @@ export interface GitPullRequest {
159
160
  createdDate: Date;
160
161
  updatedDate: Date;
161
162
  closedDate: Date | null;
163
+ mergedDate: Date | null;
162
164
  baseRef: GitRefWithOID | null;
163
165
  headRef: GitRefWithOID | null;
164
166
  commentCount: number | null;
@@ -173,11 +175,17 @@ export interface GitPullRequest {
173
175
  reviewer: Account;
174
176
  state: GitPullRequestReviewState;
175
177
  }[] | null;
178
+ reviewDecision: GitPullRequestReviewState | null;
176
179
  repository: {
177
180
  name: string;
181
+ project?: string;
178
182
  owner: {
179
183
  login?: string;
180
184
  };
185
+ remoteInfo: {
186
+ cloneUrlHTTPS: string;
187
+ cloneUrlSSH: string;
188
+ } | null;
181
189
  };
182
190
  headRepository: {
183
191
  name: string;
@@ -196,6 +204,35 @@ export interface GitPullRequest {
196
204
  milestone?: GitMilestone | null;
197
205
  labels?: GitLabel[];
198
206
  }
207
+ export interface GitComment {
208
+ author: Account | User | null;
209
+ body: string;
210
+ createdAt: Date | null;
211
+ id: string;
212
+ graphQLId?: string;
213
+ url: string;
214
+ }
215
+ export declare enum GitDiffLineType {
216
+ ADDED = "ADDED",
217
+ DELETED = "DELETED",
218
+ UNMODIFIED = "UNMODIFIED"
219
+ }
220
+ export interface GitDiffLine {
221
+ line: string;
222
+ oldLineNumber: number | null;
223
+ newLineNumber: number | null;
224
+ type: GitDiffLineType;
225
+ }
226
+ export interface GitPullRequestReviewComment extends GitComment {
227
+ diffLines: GitDiffLine[];
228
+ filename: string;
229
+ replies: GitComment[];
230
+ isOutdated: boolean;
231
+ isResolved: boolean;
232
+ }
233
+ export interface GitPullRequestReview extends GitComment {
234
+ reviewComments: GitPullRequestReviewComment[];
235
+ }
199
236
  export interface GetRepoInput {
200
237
  namespace: string;
201
238
  name: string;
@@ -1,4 +1,4 @@
1
- import { Account, CursorPageInput, EnterpriseOptions, GetRepoErrorData, GetRepoInput, GitLabel, GitMergeStrategy, GitMilestone, GitProvider, GitPullRequest, GitRepository, Organization } from '../gitProvider';
1
+ import { Account, CursorPageInput, EnterpriseOptions, GetRepoErrorData, GetRepoInput, GitLabel, GitMergeStrategy, GitMilestone, GitProvider, GitPullRequest, GitPullRequestReviewComment, GitRepository, Organization } from '../gitProvider';
2
2
  import { Issue } from '../issueProvider';
3
3
  import { EnterpriseProvider } from '../provider';
4
4
  import { FetchIssuesData, FetchPullRequestsData } from './githubTypes';
@@ -212,6 +212,24 @@ export declare class GitHub extends EnterpriseProvider implements GitProvider {
212
212
  pullRequestGraphQLId: string;
213
213
  assigneeGraphQLIds: string[];
214
214
  }, options?: EnterpriseOptions): Promise<void>;
215
+ getReviewsForPullRequest(input: {
216
+ repo: GetRepoInput;
217
+ pullRequestId: number;
218
+ }, options?: EnterpriseOptions): Promise<{
219
+ data: {
220
+ author: {
221
+ avatarUrl: string;
222
+ email: null;
223
+ name: string;
224
+ } | null;
225
+ body: string;
226
+ createdAt: Date | null;
227
+ id: string;
228
+ graphQLId: string;
229
+ reviewComments: GitPullRequestReviewComment[];
230
+ url: string;
231
+ }[];
232
+ }>;
215
233
  /**
216
234
  * Returns issues that were created by or are assigned to the user.
217
235
  */
@@ -1,5 +1,5 @@
1
1
  import { GraphQLBody, GraphQLError, GraphQLResponse, ProviderConfig } from '../../types';
2
- import { EnterpriseOptions } from '../gitProvider';
2
+ import { EnterpriseOptions, GitDiffLineType } from '../gitProvider';
3
3
  export declare const GITHUB_API_URL = "https://api.github.com";
4
4
  export declare const GITHUB_GRAPHQL_API_URL: string;
5
5
  export declare const GRAPHQL_MILESTONE_FIELDS = "\ndescription\ndueOn\nid\nnumber\nstate\ntitle\nurl\n";
@@ -15,3 +15,9 @@ export declare const GithubSearchSyntaxQualifiers: Record<string, string>;
15
15
  export declare const getProjectGithubSearchSyntax: (search: string) => string[];
16
16
  export declare const makeSearchIssuesOrPRsGraphQLBody: (type: 'issue' | 'pr', query: string, cursor: string | null | undefined, supportsEmail: boolean, supportsDrafts?: boolean) => GraphQLBody;
17
17
  export declare const hasDraftsNotSupportedError: (errors?: GraphQLError[]) => boolean;
18
+ export declare const getDiffLinesFromDiffHunk: (diffHunk: string, originalLine: number | null, originalStartLine: number | null, startDiffSide: 'LEFT' | 'RIGHT' | null) => {
19
+ line: string;
20
+ oldLineNumber: number | null;
21
+ newLineNumber: number | null;
22
+ type: GitDiffLineType;
23
+ }[];
@@ -49,6 +49,7 @@ export interface GraphQLUser {
49
49
  login: string;
50
50
  email?: string;
51
51
  avatarUrl: string;
52
+ url: string;
52
53
  }
53
54
  export interface GraphQLBot {
54
55
  __typename: 'Bot';
@@ -56,6 +57,7 @@ export interface GraphQLBot {
56
57
  databaseId: number;
57
58
  login: string;
58
59
  avatarUrl: string;
60
+ url: string;
59
61
  }
60
62
  export interface GraphQLOrganization {
61
63
  id: string;
@@ -91,6 +93,7 @@ export interface GraphQLPullRequest {
91
93
  };
92
94
  createdAt: string;
93
95
  closedAt: string | null;
96
+ mergedAt: string | null;
94
97
  isDraft: boolean;
95
98
  changedFiles: number;
96
99
  additions: number;
@@ -138,6 +141,8 @@ export interface GraphQLPullRequest {
138
141
  owner: {
139
142
  login: string;
140
143
  };
144
+ sshUrl: string;
145
+ url: string;
141
146
  };
142
147
  reviewRequests: {
143
148
  nodes: {
@@ -176,6 +181,7 @@ export interface GraphQLIssue {
176
181
  nodes: GraphQLUser[] | null;
177
182
  };
178
183
  author: GraphQLUser | GraphQLBot | Record<string, never> | null;
184
+ closedAt: string | null;
179
185
  createdAt: string;
180
186
  updatedAt: string;
181
187
  comments: {
@@ -216,3 +222,29 @@ export interface FetchIssuesData {
216
222
  mentionLogin?: string;
217
223
  startQuery?: string;
218
224
  }
225
+ export interface GraphQLReviewThread {
226
+ comments: {
227
+ nodes: GraphQLReviewComment[];
228
+ };
229
+ isOutdated: boolean;
230
+ isResolved: boolean;
231
+ originalLine: number | null;
232
+ originalStartLine: number | null;
233
+ startDiffSide: 'LEFT' | 'RIGHT' | null;
234
+ }
235
+ export interface GraphQLReviewComment {
236
+ author: {
237
+ avatarUrl: string;
238
+ login: string;
239
+ } | null;
240
+ body: string;
241
+ databaseId: string;
242
+ diffHunk: string;
243
+ id: string;
244
+ path: string;
245
+ publishedAt: string | null;
246
+ pullRequestReview: {
247
+ id: string;
248
+ } | null;
249
+ url: string;
250
+ }
@@ -22,10 +22,12 @@ export interface IssueComponent {
22
22
  id: string;
23
23
  name: string;
24
24
  }
25
+ export type IssueStatusCategory = 'TO_DO' | 'IN_PROGRESS' | 'DONE';
25
26
  export interface Issue {
26
27
  author: Account | null;
27
28
  assignees: Account[];
28
29
  commentCount: number | null;
30
+ closedDate: Date | null;
29
31
  createdDate: Date;
30
32
  description: string | null;
31
33
  graphQLId?: string;
@@ -41,6 +43,7 @@ export interface Issue {
41
43
  state: {
42
44
  name: string;
43
45
  color: string | null;
46
+ category?: IssueStatusCategory;
44
47
  } | null;
45
48
  statusTransitions?: IssueTransition[];
46
49
  components?: IssueComponent[];
@@ -1,40 +1,6 @@
1
1
  import { Result } from '../../types';
2
2
  import { CursorPageInput, EnterpriseOptions } from '../gitProvider';
3
- import { Issue } from '../issueProvider';
4
3
  import { Provider } from '../provider';
5
- interface AvatarUrls {
6
- '16x16': string;
7
- '24x24': string;
8
- '32x32': string;
9
- '48x48': string;
10
- }
11
- interface JiraUser {
12
- accountId: string;
13
- accountType: string;
14
- active: boolean;
15
- avatarUrls: AvatarUrls;
16
- displayName: string;
17
- emailAddress: string;
18
- self: string;
19
- timeZone: string;
20
- }
21
- interface JiraComponent {
22
- ari?: string;
23
- assignee?: JiraUser;
24
- assigneeType: string;
25
- description?: string;
26
- id: string;
27
- isAssigneeTypeValid: boolean;
28
- lead?: JiraUser;
29
- leadUserName?: string;
30
- metadata?: unknown;
31
- name: string;
32
- project: string;
33
- projectId: string;
34
- realAssignee?: JiraUser;
35
- realAssigneeType: string;
36
- self: string;
37
- }
38
4
  export interface JiraResource {
39
5
  id: string;
40
6
  name: string;
@@ -59,6 +25,7 @@ export declare class Jira extends Provider {
59
25
  avatarUrl: string;
60
26
  id: string;
61
27
  username: string;
28
+ url: string | null;
62
29
  };
63
30
  }>;
64
31
  getJiraResourcesForCurrentUser(options?: EnterpriseOptions): Promise<Result<JiraResource[]>>;
@@ -93,13 +60,14 @@ export declare class Jira extends Provider {
93
60
  email: string;
94
61
  avatarUrl: string;
95
62
  username: string;
63
+ url: string;
96
64
  }[];
97
65
  }>;
98
66
  getComponentsForJiraProject(input: {
99
67
  resourceId: string;
100
68
  projectIdOrKey: string;
101
69
  }, options?: EnterpriseOptions): Promise<{
102
- data: JiraComponent[];
70
+ data: import("./sharedTypes").JiraComponent[];
103
71
  }>;
104
72
  getIssuesForProject(input: {
105
73
  project: string;
@@ -108,7 +76,7 @@ export declare class Jira extends Provider {
108
76
  authorLogin?: string;
109
77
  mentionLogin?: string;
110
78
  }, options?: EnterpriseOptions): Promise<{
111
- data: Issue[];
79
+ data: import("../issueProvider").Issue[];
112
80
  }>;
113
81
  setIssueStatus(input: {
114
82
  resourceId: string;
@@ -145,4 +113,3 @@ export declare class Jira extends Provider {
145
113
  }[];
146
114
  }>;
147
115
  }
148
- export {};
@@ -0,0 +1,46 @@
1
+ import { ProviderConfig } from '../../types';
2
+ import { EnterpriseOptions } from '../gitProvider';
3
+ import { Issue, IssueComponent, IssueTransition } from '../issueProvider';
4
+ import { JiraComponent, JiraComponentStub, JiraIssue, JiraTransition, JiraUser } from './sharedTypes';
5
+ export declare const normalizeIssue: (issue: JiraIssue, resourceUrl: string | null, isServer: boolean) => Issue;
6
+ export declare const normalizeTransition: (transition: JiraTransition) => IssueTransition;
7
+ export declare const normalizeComponentStub: (component: JiraComponentStub) => IssueComponent;
8
+ export declare const normalizeUserURL: (user: JiraUser, resourceUrl: string | null, isServer: boolean) => string;
9
+ export declare const normalizeUser: (user: JiraUser, resourceUrl: string | null, isServer: boolean) => {
10
+ id: string;
11
+ name: string;
12
+ email: string;
13
+ avatarUrl: string;
14
+ username: string;
15
+ url: string;
16
+ };
17
+ export declare const getIssuesForProject: (config: ProviderConfig, input: {
18
+ resourceId?: string;
19
+ project: string;
20
+ assigneeLogins?: string[];
21
+ authorLogin?: string;
22
+ mentionLogin?: string;
23
+ }, resourceUrl: string | null, options?: EnterpriseOptions) => Promise<{
24
+ data: Issue[];
25
+ }>;
26
+ export declare const setIssueLabels: (config: ProviderConfig, input: {
27
+ resourceId?: string;
28
+ issueId: string;
29
+ labelNames: string[];
30
+ }, options?: EnterpriseOptions) => Promise<void>;
31
+ export declare const setIssueComponents: (config: ProviderConfig, input: {
32
+ resourceId?: string;
33
+ issueId: string;
34
+ componentIds: string[];
35
+ }, options?: EnterpriseOptions) => Promise<void>;
36
+ export declare const setIssueStatus: (config: ProviderConfig, input: {
37
+ resourceId?: string;
38
+ issueId: string;
39
+ status: string;
40
+ }, options?: EnterpriseOptions) => Promise<void>;
41
+ export declare const getComponentsForJiraProject: (config: ProviderConfig, input: {
42
+ resourceId?: string;
43
+ projectIdOrKey: string;
44
+ }, options?: EnterpriseOptions) => Promise<{
45
+ data: JiraComponent[];
46
+ }>;
@@ -0,0 +1,115 @@
1
+ export interface AvatarUrls {
2
+ '16x16': string;
3
+ '24x24': string;
4
+ '32x32': string;
5
+ '48x48': string;
6
+ }
7
+ export interface JiraUser {
8
+ accountId?: string;
9
+ accountType: string;
10
+ active: boolean;
11
+ avatarUrls: AvatarUrls;
12
+ displayName: string;
13
+ emailAddress: string;
14
+ key?: string;
15
+ self: string;
16
+ timeZone: string;
17
+ name?: string;
18
+ }
19
+ export interface JiraTransition {
20
+ id: string;
21
+ name: string;
22
+ to: {
23
+ self: string;
24
+ description: string;
25
+ iconUrl: string;
26
+ name: string;
27
+ id: string;
28
+ statusCategory: {
29
+ self: string;
30
+ id: number;
31
+ key: string;
32
+ colorName: string;
33
+ name: string;
34
+ };
35
+ };
36
+ hasScreen: boolean;
37
+ isGlobal: boolean;
38
+ isInitial: boolean;
39
+ isAvailable: boolean;
40
+ isConditional: boolean;
41
+ isLooped: boolean;
42
+ }
43
+ export interface JiraComponentStub {
44
+ description?: string;
45
+ id: string;
46
+ name: string;
47
+ self: string;
48
+ }
49
+ export interface JiraComponent {
50
+ ari?: string;
51
+ assignee?: JiraUser;
52
+ assigneeType: string;
53
+ description?: string;
54
+ id: string;
55
+ isAssigneeTypeValid: boolean;
56
+ lead?: JiraUser;
57
+ leadUserName?: string;
58
+ metadata?: unknown;
59
+ name: string;
60
+ project: string;
61
+ projectId: string;
62
+ realAssignee?: JiraUser;
63
+ realAssigneeType: string;
64
+ self: string;
65
+ }
66
+ export interface JiraIssueStatus {
67
+ name: string;
68
+ statusCategory: {
69
+ colorName: string;
70
+ id: number;
71
+ key: string;
72
+ name: 'To Do' | 'In Progress' | 'Done';
73
+ self: string;
74
+ };
75
+ }
76
+ export interface JiraIssue {
77
+ expand: string;
78
+ fields: {
79
+ components?: JiraComponentStub[];
80
+ status: JiraIssueStatus;
81
+ assignee?: JiraUser;
82
+ comment: {
83
+ comments: {
84
+ author: JiraUser;
85
+ body: string;
86
+ created: string;
87
+ id: string;
88
+ jsdPublic: boolean;
89
+ self: string;
90
+ updateAuthor: JiraUser;
91
+ }[];
92
+ maxResults: number;
93
+ self: string;
94
+ startAt: number;
95
+ total: number;
96
+ };
97
+ created: string;
98
+ creator: JiraUser;
99
+ issuetype: {
100
+ name: string;
101
+ };
102
+ labels?: string[];
103
+ summary: string;
104
+ updated: string;
105
+ votes: {
106
+ hasVoted: boolean;
107
+ self: string;
108
+ votes: number;
109
+ };
110
+ };
111
+ id: string;
112
+ key: string;
113
+ self: string;
114
+ transitions?: JiraTransition[];
115
+ }
@@ -0,0 +1,57 @@
1
+ import { EnterpriseOptions } from '../gitProvider';
2
+ import { EnterpriseProvider } from '../provider';
3
+ export interface JiraServerProject {
4
+ id: string;
5
+ name: string;
6
+ }
7
+ export declare class JiraServer extends EnterpriseProvider {
8
+ getCurrentUser(options?: EnterpriseOptions): Promise<{
9
+ data: {
10
+ name: string;
11
+ email: string;
12
+ avatarUrl: string;
13
+ id: string;
14
+ username: string;
15
+ url: null;
16
+ };
17
+ }>;
18
+ getJiraProjects(options?: EnterpriseOptions): Promise<{
19
+ data: {
20
+ id: string;
21
+ name: string;
22
+ }[];
23
+ }>;
24
+ getIssuesForProject(input: {
25
+ project: string;
26
+ assigneeLogins?: string[];
27
+ authorLogin?: string;
28
+ mentionLogin?: string;
29
+ }, options?: EnterpriseOptions): Promise<{
30
+ data: import("../issueProvider").Issue[];
31
+ }>;
32
+ setIssueStatus(input: {
33
+ issueId: string;
34
+ status: string;
35
+ }, options?: EnterpriseOptions): Promise<void>;
36
+ setIssueLabels(input: {
37
+ issueId: string;
38
+ labelNames: string[];
39
+ }, options?: EnterpriseOptions): Promise<void>;
40
+ setIssueComponents(input: {
41
+ issueId: string;
42
+ componentIds: string[];
43
+ }, options?: EnterpriseOptions): Promise<void>;
44
+ getLabels(options?: EnterpriseOptions): Promise<{
45
+ data: {
46
+ color: null;
47
+ description: null;
48
+ id: null;
49
+ name: string;
50
+ }[];
51
+ }>;
52
+ getComponentsForJiraProject(input: {
53
+ projectIdOrKey: string;
54
+ }, options?: EnterpriseOptions): Promise<{
55
+ data: import("../jira/sharedTypes").JiraComponent[];
56
+ }>;
57
+ }
@@ -34,6 +34,7 @@ export declare class Trello extends Provider {
34
34
  avatarUrl: string | null;
35
35
  id: string;
36
36
  username: string;
37
+ url: string;
37
38
  };
38
39
  }>;
39
40
  getBoardsForCurrentUser(input: {
@@ -55,6 +56,7 @@ export declare class Trello extends Provider {
55
56
  username: string;
56
57
  email: null;
57
58
  avatarUrl: null;
59
+ url: null;
58
60
  }[];
59
61
  }>;
60
62
  getIssuesForBoard(input: {
package/dist/types.d.ts CHANGED
@@ -9,6 +9,7 @@ export interface Config extends SharedConfig {
9
9
  bitbucketServer?: ProviderBaseConfig & EnterpriseConfig;
10
10
  azureDevOps?: ProviderBaseConfig;
11
11
  jira?: ProviderBaseConfig;
12
+ jiraServer?: ProviderBaseConfig & EnterpriseConfig;
12
13
  trello?: ProviderBaseConfig;
13
14
  }
14
15
  export interface SharedConfig {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitkraken/provider-apis",
3
- "version": "0.14.0",
3
+ "version": "0.14.2",
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",