@gitkraken/provider-apis 0.24.2 → 0.25.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.
@@ -240,6 +240,7 @@ export declare class AzureDevOps extends Provider implements GitProvider, IssueP
240
240
  assigneeLogins?: string[];
241
241
  authorLogin?: string;
242
242
  mentionLogin?: string;
243
+ labelNames?: string[];
243
244
  statusByWorkItemIdByStatusId?: StatusByWorkItemIdByStatusId;
244
245
  } & NumberedPageInput, options?: EnterpriseOptions): Promise<{
245
246
  pageInfo: {
@@ -82,12 +82,7 @@ export declare class GitHub extends EnterpriseProvider implements GitProvider, I
82
82
  endCursor: string | null;
83
83
  hasNextPage: boolean;
84
84
  };
85
- data: {
86
- name: string | null;
87
- email: string | null;
88
- username: string | null;
89
- avatarUrl: string | null;
90
- }[];
85
+ data: Pick<Account, keyof Account>[];
91
86
  }>;
92
87
  getRepo(input: GetRepoInput, options?: EnterpriseOptions): Promise<{
93
88
  data: GitRepository;
@@ -190,6 +185,7 @@ export declare class GitHub extends EnterpriseProvider implements GitProvider, I
190
185
  query: string;
191
186
  isDraft?: boolean;
192
187
  includeFromArchivedRepos?: boolean;
188
+ maxPageSize?: number;
193
189
  } & CursorPageInput, options?: EnterpriseOptions): Promise<{
194
190
  pageInfo: {
195
191
  hasNextPage: boolean;
@@ -200,6 +196,7 @@ export declare class GitHub extends EnterpriseProvider implements GitProvider, I
200
196
  searchIssues(input: {
201
197
  query: string;
202
198
  includeFromArchivedRepos?: boolean;
199
+ maxPageSize?: number;
203
200
  } & CursorPageInput, options?: EnterpriseOptions): Promise<{
204
201
  pageInfo: {
205
202
  hasNextPage: boolean;
@@ -213,6 +210,8 @@ export declare class GitHub extends EnterpriseProvider implements GitProvider, I
213
210
  getPullRequestsAssociatedWithUser(input: {
214
211
  username: string;
215
212
  includeFromArchivedRepos?: boolean;
213
+ labelNames?: string[];
214
+ maxPageSize?: number;
216
215
  } & CursorPageInput, options?: EnterpriseOptions): Promise<{
217
216
  pageInfo: {
218
217
  hasNextPage: boolean;
@@ -308,6 +307,8 @@ export declare class GitHub extends EnterpriseProvider implements GitProvider, I
308
307
  getIssuesAssociatedWithUser(input: {
309
308
  username: string;
310
309
  includeFromArchivedRepos?: boolean;
310
+ maxPageSize?: number;
311
+ labelNames?: string[];
311
312
  } & CursorPageInput, options?: EnterpriseOptions): Promise<{
312
313
  pageInfo: {
313
314
  hasNextPage: boolean;
@@ -6,7 +6,10 @@ export declare const minimumFeatureVersions: {
6
6
  LATEST_REVIEWS: number[];
7
7
  VIEWER_CAN_MERGE_AS_ADMIN: number[];
8
8
  };
9
+ export declare const MAX_PR_PAGE_SIZE = 15;
10
+ export declare const MAX_ISSUE_PAGE_SIZE = 100;
9
11
  type MinimumFeatureVersions = typeof minimumFeatureVersions;
12
+ export declare const isNotNull: <T>(item: T | null) => item is T;
10
13
  export declare const doesEnterpriseSupportFeature: (enterpriseVersion: [number, number, number], feature: keyof MinimumFeatureVersions) => boolean;
11
14
  export declare const GITHUB_API_URL = "https://api.github.com";
12
15
  export declare const GITHUB_GRAPHQL_API_URL: string;
@@ -23,6 +26,7 @@ export declare const getIssueFields: (includeEmail?: boolean) => string;
23
26
  export declare const GithubSearchSyntaxQualifiers: Record<string, string>;
24
27
  export declare const getProjectGithubSearchSyntax: (search: string) => string[];
25
28
  export declare const makeSearchIssuesOrPRsGraphQLBody: (type: 'issue' | 'pr', query: string, cursor: string | null | undefined, options: {
29
+ maxPageSize: number;
26
30
  supportsEmail: boolean;
27
31
  supportsDrafts?: boolean;
28
32
  enterpriseVersion?: [number, number, number] | null;
@@ -122,6 +122,7 @@ export declare class GitLab extends EnterpriseProvider implements GitProvider, I
122
122
  username: string;
123
123
  association: PullRequestAssociation;
124
124
  includeFromArchivedRepos?: boolean;
125
+ labelNames?: string[];
125
126
  } & CursorPageInput, options?: EnterpriseOptions): Promise<{
126
127
  pageInfo: {
127
128
  endCursor: string | null;
@@ -135,6 +136,7 @@ export declare class GitLab extends EnterpriseProvider implements GitProvider, I
135
136
  getPullRequestsAssociatedWithUser(input: {
136
137
  username: string;
137
138
  includeFromArchivedRepos?: boolean;
139
+ labelNames?: string[];
138
140
  } & CursorPageInput, options?: EnterpriseOptions): Promise<{
139
141
  pageInfo: {
140
142
  hasNextPage: boolean;
@@ -149,6 +151,7 @@ export declare class GitLab extends EnterpriseProvider implements GitProvider, I
149
151
  assigneeLogins?: string[];
150
152
  updatedBefore?: string;
151
153
  authorLogin?: string;
154
+ labelNames?: string[];
152
155
  isDraft?: boolean;
153
156
  reviewRequestedLogin?: string;
154
157
  } & CursorPageInput, options?: EnterpriseOptions): Promise<{
@@ -165,6 +168,7 @@ export declare class GitLab extends EnterpriseProvider implements GitProvider, I
165
168
  assigneeLogins?: string[];
166
169
  updatedBefore?: string;
167
170
  authorLogin?: string;
171
+ labelNames?: string[];
168
172
  isDraft?: boolean;
169
173
  reviewRequestedLogin?: string;
170
174
  includeFromArchivedRepos?: boolean;
@@ -222,6 +226,7 @@ export declare class GitLab extends EnterpriseProvider implements GitProvider, I
222
226
  assigneeLogins?: string[];
223
227
  updatedBefore?: string;
224
228
  authorLogin?: string;
229
+ labelNames?: string[];
225
230
  } & CursorPageInput, options?: EnterpriseOptions): Promise<{
226
231
  pageInfo: {
227
232
  endCursor: string | null;
@@ -234,6 +239,7 @@ export declare class GitLab extends EnterpriseProvider implements GitProvider, I
234
239
  assigneeLogins?: string[];
235
240
  updatedBefore?: string;
236
241
  authorLogin?: string;
242
+ labelNames?: string[];
237
243
  includeFromArchivedRepos?: boolean;
238
244
  } & CursorPageInput, options?: EnterpriseOptions): Promise<{
239
245
  pageInfo: {
@@ -69,6 +69,7 @@ export declare class Jira extends Provider implements IssueProvider {
69
69
  assigneeLogins?: string[];
70
70
  authorLogin?: string;
71
71
  mentionLogin?: string;
72
+ labelNames?: string[];
72
73
  } & NumberedPageInput, options?: EnterpriseOptions): Promise<{
73
74
  data: import("../../types/exportedTypes/issueProvider").Issue[];
74
75
  pageInfo: {
@@ -82,6 +83,7 @@ export declare class Jira extends Provider implements IssueProvider {
82
83
  assigneeLogins?: string[];
83
84
  authorLogin?: string;
84
85
  mentionLogin?: string;
86
+ labelNames?: string[];
85
87
  } & NumberedPageInput, options?: EnterpriseOptions): Promise<{
86
88
  data: import("../../types/exportedTypes/issueProvider").Issue[];
87
89
  pageInfo: {
@@ -91,6 +93,7 @@ export declare class Jira extends Provider implements IssueProvider {
91
93
  }>;
92
94
  getIssuesForResourceForCurrentUser(input: {
93
95
  resourceId: string;
96
+ labelNames?: string[];
94
97
  } & NumberedPageInput, options?: EnterpriseOptions): Promise<{
95
98
  data: import("../../types/exportedTypes/issueProvider").Issue[];
96
99
  pageInfo: {
@@ -23,6 +23,7 @@ export declare const getIssue: (config: ProviderConfig, input: {
23
23
  }>;
24
24
  export declare const getIssuesForResourceForCurrentUser: (config: ProviderConfig, input: {
25
25
  resourceId?: string;
26
+ labelNames?: string[];
26
27
  } & NumberedPageInput, resourceUrl: string | null, options?: EnterpriseOptions) => Promise<{
27
28
  data: Issue[];
28
29
  pageInfo: {
@@ -36,6 +37,7 @@ export declare const getIssuesForProject: (config: ProviderConfig, input: {
36
37
  assigneeLogins?: string[];
37
38
  authorLogin?: string;
38
39
  mentionLogin?: string;
40
+ labelNames?: string[];
39
41
  } & NumberedPageInput, resourceUrl: string | null, options?: EnterpriseOptions) => Promise<{
40
42
  data: Issue[];
41
43
  pageInfo: {
@@ -49,6 +51,7 @@ export declare const getIssuesForProjects: (config: ProviderConfig, input: {
49
51
  assigneeLogins?: string[];
50
52
  authorLogin?: string;
51
53
  mentionLogin?: string;
54
+ labelNames?: string[];
52
55
  } & NumberedPageInput, resourceUrl: string | null, options?: EnterpriseOptions) => Promise<{
53
56
  data: Issue[];
54
57
  pageInfo: {
@@ -30,6 +30,7 @@ export declare class JiraServer extends EnterpriseProvider implements IssueProvi
30
30
  assigneeLogins?: string[];
31
31
  authorLogin?: string;
32
32
  mentionLogin?: string;
33
+ labelNames?: string[];
33
34
  } & NumberedPageInput, options?: EnterpriseOptions): Promise<{
34
35
  data: import("../../types/exportedTypes/issueProvider").Issue[];
35
36
  pageInfo: {
@@ -42,6 +43,7 @@ export declare class JiraServer extends EnterpriseProvider implements IssueProvi
42
43
  assigneeLogins?: string[];
43
44
  authorLogin?: string;
44
45
  mentionLogin?: string;
46
+ labelNames?: string[];
45
47
  } & NumberedPageInput, options?: EnterpriseOptions): Promise<{
46
48
  data: import("../../types/exportedTypes/issueProvider").Issue[];
47
49
  pageInfo: {
@@ -49,7 +51,9 @@ export declare class JiraServer extends EnterpriseProvider implements IssueProvi
49
51
  nextPage: number | null;
50
52
  };
51
53
  }>;
52
- getIssuesForResourceForCurrentUser(input: NumberedPageInput, options?: EnterpriseOptions): Promise<{
54
+ getIssuesForResourceForCurrentUser(input: {
55
+ labelNames?: string[];
56
+ } & NumberedPageInput, options?: EnterpriseOptions): Promise<{
53
57
  data: import("../../types/exportedTypes/issueProvider").Issue[];
54
58
  pageInfo: {
55
59
  hasNextPage: boolean;
@@ -44,6 +44,7 @@ export declare class Trello extends Provider implements IssueProvider {
44
44
  boardId: string;
45
45
  filterText?: string;
46
46
  assigneeLogins?: string[];
47
+ labelNamesOrColors?: string[];
47
48
  trelloBoardListsById?: Record<string, {
48
49
  name: string;
49
50
  }>;
@@ -31,8 +31,8 @@ export type EntityIdentifier = {
31
31
  entityId: string;
32
32
  };
33
33
  export type AzureIssueEntityIdentifierInput = {
34
- provider: EntityIdentifierProviderType;
35
- entityType: EntityType;
34
+ provider: EntityIdentifierProviderType.Azure;
35
+ entityType: EntityType.Issue;
36
36
  version?: EntityVersion;
37
37
  organizationName: string;
38
38
  projectId: string;
@@ -40,8 +40,8 @@ export type AzureIssueEntityIdentifierInput = {
40
40
  domain?: string;
41
41
  };
42
42
  export type AzurePullRequestEntityIdentifierInput = {
43
- provider: EntityIdentifierProviderType;
44
- entityType: EntityType;
43
+ provider: EntityIdentifierProviderType.Azure;
44
+ entityType: EntityType.PullRequest;
45
45
  version?: EntityVersion;
46
46
  organizationName: string;
47
47
  projectId: string;
@@ -50,61 +50,83 @@ export type AzurePullRequestEntityIdentifierInput = {
50
50
  domain?: string;
51
51
  };
52
52
  export type BitbucketIssueEntityIdentifierInput = {
53
- provider: EntityIdentifierProviderType;
54
- entityType: EntityType;
53
+ entityType: EntityType.Issue;
55
54
  version?: EntityVersion;
56
55
  repoId: string;
57
56
  entityId: string;
58
- domain?: string;
59
- };
57
+ } & ({
58
+ provider: EntityIdentifierProviderType.Bitbucket;
59
+ } | {
60
+ provider: EntityIdentifierProviderType.BitbucketServer;
61
+ domain: string;
62
+ });
60
63
  export type BitbucketPullRequestEntityIdentifierInput = {
61
- provider: EntityIdentifierProviderType;
62
- entityType: EntityType;
64
+ entityType: EntityType.PullRequest;
63
65
  version?: EntityVersion;
64
66
  repoId: string;
65
67
  entityId: string;
66
- domain?: string;
67
- };
68
+ } & ({
69
+ provider: EntityIdentifierProviderType.Bitbucket;
70
+ } | {
71
+ provider: EntityIdentifierProviderType.BitbucketServer;
72
+ domain: string;
73
+ });
68
74
  export type GithubIssueEntityIdentifierInput = {
69
- provider: EntityIdentifierProviderType;
70
- entityType: EntityType;
75
+ entityType: EntityType.Issue;
71
76
  version?: EntityVersion;
72
77
  entityId: string;
73
- domain?: string;
74
- };
78
+ } & ({
79
+ provider: EntityIdentifierProviderType.Github;
80
+ } | {
81
+ provider: EntityIdentifierProviderType.GithubEnterprise;
82
+ domain: string;
83
+ });
75
84
  export type GithubPullRequestEntityIdentifierInput = {
76
- provider: EntityIdentifierProviderType;
77
- entityType: EntityType;
85
+ entityType: EntityType.PullRequest;
78
86
  version?: EntityVersion;
79
87
  entityId: string;
80
- domain?: string;
81
- };
88
+ } & ({
89
+ provider: EntityIdentifierProviderType.Github;
90
+ } | {
91
+ provider: EntityIdentifierProviderType.GithubEnterprise;
92
+ domain: string;
93
+ });
82
94
  export type GitlabIssueEntityIdentifierInput = {
83
- provider: EntityIdentifierProviderType;
84
- entityType: EntityType;
95
+ entityType: EntityType.Issue;
85
96
  version?: EntityVersion;
86
97
  entityId: string;
87
98
  domain?: string;
88
- };
99
+ } & ({
100
+ provider: EntityIdentifierProviderType.Gitlab;
101
+ } | {
102
+ provider: EntityIdentifierProviderType.GitlabSelfHosted;
103
+ domain: string;
104
+ });
89
105
  export type GitlabPullRequestEntityIdentifierInput = {
90
- provider: EntityIdentifierProviderType;
91
- entityType: EntityType;
106
+ entityType: EntityType.PullRequest;
92
107
  version?: EntityVersion;
93
108
  entityId: string;
94
- domain?: string;
95
- };
109
+ } & ({
110
+ provider: EntityIdentifierProviderType.Gitlab;
111
+ } | {
112
+ provider: EntityIdentifierProviderType.GitlabSelfHosted;
113
+ domain: string;
114
+ });
96
115
  export type JiraIssueEntityIdentifierInput = {
97
- provider: EntityIdentifierProviderType;
98
- entityType: EntityType;
116
+ entityType: EntityType.Issue;
99
117
  version?: EntityVersion;
100
- resourceId?: string;
101
118
  projectId: string;
102
119
  entityId: string;
103
- domain?: string;
104
- };
120
+ } & ({
121
+ provider: EntityIdentifierProviderType.Jira;
122
+ resourceId: string;
123
+ } | {
124
+ provider: EntityIdentifierProviderType.JiraServer;
125
+ domain: string;
126
+ });
105
127
  export type TrelloIssueEntityIdentifierInput = {
106
- provider: EntityIdentifierProviderType;
107
- entityType: EntityType;
128
+ provider: EntityIdentifierProviderType.Trello;
129
+ entityType: EntityType.Issue;
108
130
  version?: EntityVersion;
109
131
  accountOrOrgId: string;
110
132
  projectId: string;
@@ -10,9 +10,21 @@ export interface FetchPullRequestsData {
10
10
  isDraft?: boolean;
11
11
  authorLogin?: string;
12
12
  mentionLogin?: string;
13
+ labelNames?: string[];
13
14
  reviewRequestedLogin?: string;
14
15
  startQuery?: string;
15
16
  includeFromArchivedRepos?: boolean;
17
+ /**
18
+ * GitHub is temperamental when it comes to fetching a lot of PRs at the same time. GitHub times-out API requests if
19
+ * they take longer than 10 seconds to complete. So, if the PR page size is too big, GitHub will cancel the request.
20
+ * We default to fetching 15 PRs at the same time, which ensures the API will not time-out. Some repos seem to be more
21
+ * susceptible to time-outs than others, so while you may be able to fetch 50 PRs per-page for one repo, it does not
22
+ * guarantee that you will be able to fetch 50 PRs per-page from another.
23
+ *
24
+ * So basically, use this option at your own risk. If you set it much too much higher than 15, GitHub will stop being
25
+ * able to consistently complete API calls.
26
+ */
27
+ maxPageSize?: number;
16
28
  }
17
29
  export interface FetchIssuesData {
18
30
  repos: GetRepoInput[];
@@ -20,6 +32,12 @@ export interface FetchIssuesData {
20
32
  updatedBefore?: string;
21
33
  authorLogin?: string;
22
34
  mentionLogin?: string;
35
+ labelNames?: string[];
23
36
  startQuery?: string;
24
37
  includeFromArchivedRepos?: boolean;
38
+ /**
39
+ * While GitHub is temperamental when it comes to fetching a lot of PRs, it does not have the same problem when
40
+ * fetching a lot of issues. This value defaults to 100.
41
+ */
42
+ maxPageSize?: number;
25
43
  }
@@ -145,21 +145,21 @@ export interface GraphQLPullRequest {
145
145
  additions: number;
146
146
  deletions: number;
147
147
  assignees: {
148
- nodes: GraphQLUser[] | null;
148
+ nodes: (GraphQLUser | null)[] | null;
149
149
  };
150
150
  author: GraphQLUser | GraphQLBot | Record<string, never> | null;
151
151
  commits: {
152
- nodes: {
152
+ nodes: ({
153
153
  commit: {
154
154
  oid: string;
155
155
  statusCheckRollup: {
156
156
  contexts: {
157
157
  totalCount: number;
158
- nodes: (GraphQLCheckRun | GraphQLContext)[] | null;
158
+ nodes: (GraphQLCheckRun | GraphQLContext | null)[] | null;
159
159
  };
160
160
  } | null;
161
161
  };
162
- }[] | null;
162
+ } | null)[] | null;
163
163
  totalCount: number;
164
164
  };
165
165
  baseRef: {
@@ -196,16 +196,16 @@ export interface GraphQLPullRequest {
196
196
  viewerPermission: GitHubRepositoryPermission;
197
197
  };
198
198
  reviewRequests: {
199
- nodes: {
199
+ nodes: ({
200
200
  asCodeOwner?: boolean;
201
201
  requestedReviewer: GraphQLUser | Record<string, never> | null;
202
- }[] | null;
202
+ } | null)[] | null;
203
203
  } | null;
204
204
  latestReviews?: {
205
- nodes: {
205
+ nodes: ({
206
206
  author: GraphQLUser;
207
207
  state: GitHubPullRequestReviewState;
208
- }[] | null;
208
+ } | null)[] | null;
209
209
  } | null;
210
210
  url: string;
211
211
  updatedAt: string;
@@ -213,7 +213,7 @@ export interface GraphQLPullRequest {
213
213
  mergeStateStatus: GitHubPullRequestMergeStateStatus;
214
214
  milestone: GraphQLMilestone | null;
215
215
  labels: {
216
- nodes: GraphQLLabel[] | null;
216
+ nodes: (GraphQLLabel | null)[] | null;
217
217
  } | null;
218
218
  viewerCanMergeAsAdmin?: boolean;
219
219
  }
@@ -233,7 +233,7 @@ export interface GraphQLIssue {
233
233
  };
234
234
  };
235
235
  assignees: {
236
- nodes: GraphQLUser[] | null;
236
+ nodes: (GraphQLUser | null)[] | null;
237
237
  };
238
238
  author: GraphQLUser | GraphQLBot | Record<string, never> | null;
239
239
  closedAt: string | null;
@@ -247,7 +247,7 @@ export interface GraphQLIssue {
247
247
  };
248
248
  milestone: GraphQLMilestone | null;
249
249
  labels: {
250
- nodes: GraphQLLabel[] | null;
250
+ nodes: (GraphQLLabel | null)[] | null;
251
251
  } | null;
252
252
  }
253
253
  export interface GraphQLMilestone {
@@ -261,7 +261,7 @@ export interface GraphQLMilestone {
261
261
  }
262
262
  export interface GraphQLReviewThread {
263
263
  comments: {
264
- nodes: GraphQLReviewComment[];
264
+ nodes: (GraphQLReviewComment | null)[] | null;
265
265
  };
266
266
  isOutdated: boolean;
267
267
  isResolved: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitkraken/provider-apis",
3
- "version": "0.24.2",
3
+ "version": "0.25.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",