@gitkraken/provider-apis 0.14.2 → 0.15.1
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.
- package/CHANGELOG.md +30 -0
- package/dist/index.js +167 -147
- package/dist/providers/azureDevops/azureDevOps.d.ts +1 -1
- package/dist/providers/azureDevops/azureDevOpsTypes.d.ts +3 -1
- package/dist/providers/bitbucket/bitbucket.d.ts +1 -1
- package/dist/providers/bitbucketServer/bitbucketServer.d.ts +25 -1
- package/dist/providers/bitbucketServer/bitbucketServerTypes.d.ts +89 -0
- package/dist/providers/gitProvider.d.ts +9 -2
- package/dist/providers/github/github.d.ts +9 -5
- package/dist/providers/github/githubHelpers.d.ts +6 -5
- package/dist/providers/github/githubTypes.d.ts +13 -4
- package/dist/providers/gitlab/gitlab.d.ts +2 -1
- package/dist/providers/issueProvider.d.ts +9 -0
- package/dist/providers/jira/sharedTypes.d.ts +1 -0
- package/dist/types.d.ts +2 -0
- package/dist/utils.d.ts +10 -0
- package/package.json +1 -1
|
@@ -28,7 +28,7 @@ export type StatusByWorkItemIdByStatusId = {
|
|
|
28
28
|
};
|
|
29
29
|
export declare class AzureDevOps extends Provider implements GitProvider {
|
|
30
30
|
/** Note: PATs are not supported for this function, only OAuth tokens are. */
|
|
31
|
-
getCurrentUser(options?: EnterpriseOptions): Promise<{
|
|
31
|
+
getCurrentUser(input?: Record<string, never>, options?: EnterpriseOptions): Promise<{
|
|
32
32
|
data: {
|
|
33
33
|
id: string;
|
|
34
34
|
name: string;
|
|
@@ -226,7 +226,9 @@ export interface WorkItemType {
|
|
|
226
226
|
xmlForm: string;
|
|
227
227
|
fields: WorkItemTypeField[];
|
|
228
228
|
fieldInstances: WorkItemTypeField[];
|
|
229
|
-
transitions:
|
|
229
|
+
transitions: {
|
|
230
|
+
[index: string]: WorkItemTypeTransition;
|
|
231
|
+
};
|
|
230
232
|
states: WorkItemState[];
|
|
231
233
|
url: string;
|
|
232
234
|
}
|
|
@@ -15,7 +15,7 @@ export declare class Bitbucket extends Provider implements GitProvider {
|
|
|
15
15
|
}): Promise<{
|
|
16
16
|
data: RefreshTokenResponse;
|
|
17
17
|
}>;
|
|
18
|
-
getCurrentUser(options?: Options): Promise<{
|
|
18
|
+
getCurrentUser(input?: Record<string, never>, options?: Options): Promise<{
|
|
19
19
|
data: Account;
|
|
20
20
|
}>;
|
|
21
21
|
getUserForCommit(input: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EnterpriseOptions, GetRepoErrorData, GetRepoInput, GitProvider, GitRepository } from '../gitProvider';
|
|
1
|
+
import { EnterpriseOptions, GetRepoErrorData, GetRepoInput, GitProvider, GitPullRequest, GitRepository, NumberedPageInput } from '../gitProvider';
|
|
2
2
|
import { EnterpriseProvider } from '../provider';
|
|
3
3
|
import { BitbucketServerMergeStrategy } from './bitbucketServerTypes';
|
|
4
4
|
export declare class BitbucketServer extends EnterpriseProvider implements GitProvider {
|
|
@@ -20,6 +20,30 @@ export declare class BitbucketServer extends EnterpriseProvider implements GitPr
|
|
|
20
20
|
data: GitRepository[];
|
|
21
21
|
errors: GetRepoErrorData[];
|
|
22
22
|
}>;
|
|
23
|
+
private getPullRequestsForRepoBase;
|
|
24
|
+
getPullRequestsForRepo(input: {
|
|
25
|
+
repo: GetRepoInput;
|
|
26
|
+
authorLogin?: string;
|
|
27
|
+
} & NumberedPageInput, options?: EnterpriseOptions): Promise<{
|
|
28
|
+
pageInfo: {
|
|
29
|
+
hasNextPage: boolean;
|
|
30
|
+
nextPage: number | null;
|
|
31
|
+
};
|
|
32
|
+
data: GitPullRequest[];
|
|
33
|
+
}>;
|
|
34
|
+
getPullRequestsForRepos(input: {
|
|
35
|
+
repos: GetRepoInput[];
|
|
36
|
+
authorLogin?: string;
|
|
37
|
+
}, options?: EnterpriseOptions): Promise<{
|
|
38
|
+
data: GitPullRequest[];
|
|
39
|
+
}>;
|
|
40
|
+
getPullRequestsForCurrentUser(input: NumberedPageInput, options?: EnterpriseOptions): Promise<{
|
|
41
|
+
pageInfo: {
|
|
42
|
+
hasNextPage: boolean;
|
|
43
|
+
nextPage: number | null;
|
|
44
|
+
};
|
|
45
|
+
data: GitPullRequest[];
|
|
46
|
+
}>;
|
|
23
47
|
closePullRequest(input: {
|
|
24
48
|
repo: GetRepoInput;
|
|
25
49
|
pullRequestId: string;
|
|
@@ -11,3 +11,92 @@ export interface BitbucketServerMergeStrategy {
|
|
|
11
11
|
id: string;
|
|
12
12
|
name: string;
|
|
13
13
|
}
|
|
14
|
+
export interface BitbucketServerPagedResponse<T> {
|
|
15
|
+
values: T[];
|
|
16
|
+
size: number;
|
|
17
|
+
limit: number;
|
|
18
|
+
isLastPage: boolean;
|
|
19
|
+
nextPageStart: number;
|
|
20
|
+
start: number;
|
|
21
|
+
}
|
|
22
|
+
export interface BitbucketServerPullRequestRef {
|
|
23
|
+
id: string;
|
|
24
|
+
displayId: string;
|
|
25
|
+
latestCommit: string;
|
|
26
|
+
type: string;
|
|
27
|
+
repository: {
|
|
28
|
+
slug: string;
|
|
29
|
+
id: number;
|
|
30
|
+
name: string;
|
|
31
|
+
hierarchyId: string;
|
|
32
|
+
scmId: string;
|
|
33
|
+
state: string;
|
|
34
|
+
statusMessage: string;
|
|
35
|
+
forkable: boolean;
|
|
36
|
+
project: {
|
|
37
|
+
key: string;
|
|
38
|
+
id: number;
|
|
39
|
+
name: string;
|
|
40
|
+
public: boolean;
|
|
41
|
+
type: string;
|
|
42
|
+
links: {
|
|
43
|
+
self: Link[];
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
public: boolean;
|
|
47
|
+
archived: boolean;
|
|
48
|
+
links: {
|
|
49
|
+
clone: NamedLink[];
|
|
50
|
+
self: Link[];
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export interface BitbucketServerUser {
|
|
55
|
+
name: string;
|
|
56
|
+
emailAddress: string;
|
|
57
|
+
active: boolean;
|
|
58
|
+
displayName: string;
|
|
59
|
+
id: number;
|
|
60
|
+
slug: string;
|
|
61
|
+
type: string;
|
|
62
|
+
links: {
|
|
63
|
+
self: Link[];
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
export interface BitbucketServerPullRequestUser {
|
|
67
|
+
user: BitbucketServerUser;
|
|
68
|
+
lastReviewedCommit?: string;
|
|
69
|
+
role: 'REVIEWER' | 'AUTHOR' | 'PARTICIPANT';
|
|
70
|
+
approved: boolean;
|
|
71
|
+
status: 'UNAPPROVED' | 'NEEDS_WORK' | 'APPROVED';
|
|
72
|
+
}
|
|
73
|
+
export interface BitbucketServerPullRequest {
|
|
74
|
+
id: number;
|
|
75
|
+
version: number;
|
|
76
|
+
title: string;
|
|
77
|
+
description: string;
|
|
78
|
+
state: 'OPEN' | 'MERGED' | 'DECLINED';
|
|
79
|
+
open: boolean;
|
|
80
|
+
closed: boolean;
|
|
81
|
+
createdDate: number;
|
|
82
|
+
updatedDate: number;
|
|
83
|
+
closedDate: number | null;
|
|
84
|
+
fromRef: BitbucketServerPullRequestRef;
|
|
85
|
+
toRef: BitbucketServerPullRequestRef;
|
|
86
|
+
locked: boolean;
|
|
87
|
+
author: BitbucketServerPullRequestUser;
|
|
88
|
+
reviewers: BitbucketServerPullRequestUser[];
|
|
89
|
+
participants: BitbucketServerPullRequestUser[];
|
|
90
|
+
properties: {
|
|
91
|
+
mergeResult: {
|
|
92
|
+
outcome: string;
|
|
93
|
+
current: boolean;
|
|
94
|
+
};
|
|
95
|
+
resolvedTaskCount: number;
|
|
96
|
+
commentCount: number;
|
|
97
|
+
openTaskCount: number;
|
|
98
|
+
};
|
|
99
|
+
links: {
|
|
100
|
+
self: Link[];
|
|
101
|
+
};
|
|
102
|
+
}
|
|
@@ -61,10 +61,12 @@ export declare enum GitLabCiJobStatus {
|
|
|
61
61
|
WaitingForResource = "WAITING_FOR_RESOURCE"
|
|
62
62
|
}
|
|
63
63
|
export interface GitBuildStatus {
|
|
64
|
+
completedAt: Date | null;
|
|
64
65
|
description: string | null;
|
|
65
66
|
name: string | null;
|
|
66
67
|
state: GitHubCheckRunState | GitHubStatusState | GitLabCiJobStatus | null;
|
|
67
68
|
stage: GitBuildStatusStage | null;
|
|
69
|
+
startedAt: Date | null;
|
|
68
70
|
url: string;
|
|
69
71
|
}
|
|
70
72
|
export interface GitLabel {
|
|
@@ -177,6 +179,8 @@ export interface GitPullRequest {
|
|
|
177
179
|
}[] | null;
|
|
178
180
|
reviewDecision: GitPullRequestReviewState | null;
|
|
179
181
|
repository: {
|
|
182
|
+
id: string;
|
|
183
|
+
graphQLId?: string;
|
|
180
184
|
name: string;
|
|
181
185
|
project?: string;
|
|
182
186
|
owner: {
|
|
@@ -188,14 +192,17 @@ export interface GitPullRequest {
|
|
|
188
192
|
} | null;
|
|
189
193
|
};
|
|
190
194
|
headRepository: {
|
|
195
|
+
id: string;
|
|
196
|
+
graphQLId?: string;
|
|
191
197
|
name: string;
|
|
198
|
+
project?: string;
|
|
192
199
|
owner: {
|
|
193
200
|
login: string;
|
|
194
201
|
};
|
|
195
202
|
remoteInfo: {
|
|
196
203
|
cloneUrlHTTPS: string;
|
|
197
204
|
cloneUrlSSH: string;
|
|
198
|
-
};
|
|
205
|
+
} | null;
|
|
199
206
|
} | null;
|
|
200
207
|
headCommit: {
|
|
201
208
|
buildStatuses: GitBuildStatus[] | null;
|
|
@@ -256,7 +263,7 @@ export interface GetRepoErrorData {
|
|
|
256
263
|
error?: Error;
|
|
257
264
|
}
|
|
258
265
|
export interface GitProvider {
|
|
259
|
-
getCurrentUser?(options: Options): Promise<Result<Account>>;
|
|
266
|
+
getCurrentUser?(input: Record<string, never>, options: Options): Promise<Result<Account>>;
|
|
260
267
|
getUserForCommit?(input: {
|
|
261
268
|
repo: GetRepoInput;
|
|
262
269
|
oid: string;
|
|
@@ -4,10 +4,14 @@ import { EnterpriseProvider } from '../provider';
|
|
|
4
4
|
import { FetchIssuesData, FetchPullRequestsData } from './githubTypes';
|
|
5
5
|
export declare class GitHub extends EnterpriseProvider implements GitProvider {
|
|
6
6
|
private _scopesCache;
|
|
7
|
+
private _enterpriseVersionsCache;
|
|
7
8
|
private getScopes;
|
|
9
|
+
private getEnterpriseVersion;
|
|
8
10
|
private getEnterpriseAvatarUrlIfNeeded;
|
|
9
|
-
getCurrentUser(
|
|
10
|
-
|
|
11
|
+
getCurrentUser<F extends keyof Account>(input?: {
|
|
12
|
+
fields?: F[];
|
|
13
|
+
}, options?: EnterpriseOptions): Promise<{
|
|
14
|
+
data: Pick<Account, F>;
|
|
11
15
|
}>;
|
|
12
16
|
getAccountsForRepo(input: {
|
|
13
17
|
repo: GetRepoInput;
|
|
@@ -16,7 +20,7 @@ export declare class GitHub extends EnterpriseProvider implements GitProvider {
|
|
|
16
20
|
endCursor: string | null;
|
|
17
21
|
hasNextPage: boolean;
|
|
18
22
|
};
|
|
19
|
-
data: Account[];
|
|
23
|
+
data: Pick<Account, keyof Account>[];
|
|
20
24
|
}>;
|
|
21
25
|
getUserForCommit(input: {
|
|
22
26
|
repo: GetRepoInput;
|
|
@@ -36,13 +40,13 @@ export declare class GitHub extends EnterpriseProvider implements GitProvider {
|
|
|
36
40
|
email: string;
|
|
37
41
|
avatarSize?: number;
|
|
38
42
|
}, options?: EnterpriseOptions): Promise<{
|
|
39
|
-
data: Account
|
|
43
|
+
data: Pick<Account, keyof Account>;
|
|
40
44
|
}>;
|
|
41
45
|
getAccountForUsername(input: {
|
|
42
46
|
username: string;
|
|
43
47
|
avatarSize?: number;
|
|
44
48
|
}, options?: EnterpriseOptions): Promise<{
|
|
45
|
-
data: Account
|
|
49
|
+
data: Pick<Account, keyof Account>;
|
|
46
50
|
}>;
|
|
47
51
|
getOrgsForCurrentUser(input?: CursorPageInput, options?: EnterpriseOptions): Promise<{
|
|
48
52
|
pageInfo: {
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { GraphQLBody, GraphQLError, GraphQLResponse, ProviderConfig } from '../../types';
|
|
2
|
-
import { EnterpriseOptions, GitDiffLineType } from '../gitProvider';
|
|
1
|
+
import { FieldMap, GraphQLBody, GraphQLError, GraphQLResponse, ProviderConfig } from '../../types';
|
|
2
|
+
import { Account, 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";
|
|
6
6
|
export declare const GRAPHQL_LABEL_FIELDS = "\ncolor\ndescription\nid\nname\n";
|
|
7
7
|
export declare const getGraphQLEndpoint: (config: ProviderConfig, options: EnterpriseOptions) => string;
|
|
8
|
+
export declare const getRESTBaseUrl: (config: ProviderConfig, options: EnterpriseOptions) => string;
|
|
8
9
|
export declare const makeGitHubGraphQLRequest: <T>(config: ProviderConfig, data: GraphQLBody, options: EnterpriseOptions) => Promise<import("../../types").Response<GraphQLResponse<T>>>;
|
|
9
10
|
export declare const hasEmailScope: (scopes: string[]) => boolean;
|
|
10
|
-
export declare const getAccountFields: (withAvatarSizeVar?: boolean, includeEmail?: boolean) => string;
|
|
11
|
+
export declare const getAccountFields: (withAvatarSizeVar?: boolean, includeEmail?: boolean, fields?: FieldMap<Account>) => string;
|
|
11
12
|
export declare const getBotFields: (withAvatarSizeVar?: boolean) => string;
|
|
12
|
-
export declare const getPullRequestFields: (isDraftPullRequestSupported: boolean, includeEmail
|
|
13
|
+
export declare const getPullRequestFields: (isDraftPullRequestSupported: boolean, includeEmail: boolean | undefined, supportsEnterpriseVersion3: boolean) => string;
|
|
13
14
|
export declare const getIssueFields: (includeEmail?: boolean) => string;
|
|
14
15
|
export declare const GithubSearchSyntaxQualifiers: Record<string, string>;
|
|
15
16
|
export declare const getProjectGithubSearchSyntax: (search: string) => string[];
|
|
16
|
-
export declare const makeSearchIssuesOrPRsGraphQLBody: (type: 'issue' | 'pr', query: string, cursor: string | null | undefined, supportsEmail: boolean, supportsDrafts?: boolean) => GraphQLBody;
|
|
17
|
+
export declare const makeSearchIssuesOrPRsGraphQLBody: (type: 'issue' | 'pr', query: string, cursor: string | null | undefined, supportsEmail: boolean, supportsDrafts?: boolean, supportsEnterpriseVersion3?: boolean) => GraphQLBody;
|
|
17
18
|
export declare const hasDraftsNotSupportedError: (errors?: GraphQLError[]) => boolean;
|
|
18
19
|
export declare const getDiffLinesFromDiffHunk: (diffHunk: string, originalLine: number | null, originalStartLine: number | null, startDiffSide: 'LEFT' | 'RIGHT' | null) => {
|
|
19
20
|
line: string;
|
|
@@ -69,12 +69,15 @@ export interface GraphQLOrganization {
|
|
|
69
69
|
}
|
|
70
70
|
export type PullRequestState = 'OPEN' | 'CLOSED' | 'MERGED';
|
|
71
71
|
export interface GraphQLCheckRun {
|
|
72
|
+
completedAt: string | null;
|
|
72
73
|
name: string;
|
|
73
|
-
status: GitHubCheckRunState;
|
|
74
74
|
permalink: string;
|
|
75
|
+
startedAt: string | null;
|
|
76
|
+
status: GitHubCheckRunState;
|
|
75
77
|
}
|
|
76
78
|
export interface GraphQLContext {
|
|
77
79
|
context: string;
|
|
80
|
+
createdAt: string;
|
|
78
81
|
description: string;
|
|
79
82
|
state: GitHubStatusState;
|
|
80
83
|
targetUrl: string;
|
|
@@ -129,6 +132,8 @@ export interface GraphQLPullRequest {
|
|
|
129
132
|
} | null;
|
|
130
133
|
} | null;
|
|
131
134
|
headRepository: {
|
|
135
|
+
id: string;
|
|
136
|
+
databaseId: string;
|
|
132
137
|
name: string;
|
|
133
138
|
owner: {
|
|
134
139
|
login: string;
|
|
@@ -137,6 +142,8 @@ export interface GraphQLPullRequest {
|
|
|
137
142
|
url: string;
|
|
138
143
|
};
|
|
139
144
|
repository: {
|
|
145
|
+
id: string;
|
|
146
|
+
databaseId: string;
|
|
140
147
|
name: string;
|
|
141
148
|
owner: {
|
|
142
149
|
login: string;
|
|
@@ -146,11 +153,11 @@ export interface GraphQLPullRequest {
|
|
|
146
153
|
};
|
|
147
154
|
reviewRequests: {
|
|
148
155
|
nodes: {
|
|
149
|
-
asCodeOwner
|
|
150
|
-
requestedReviewer: GraphQLUser;
|
|
156
|
+
asCodeOwner?: boolean;
|
|
157
|
+
requestedReviewer: GraphQLUser | Record<string, never> | null;
|
|
151
158
|
}[] | null;
|
|
152
159
|
} | null;
|
|
153
|
-
latestReviews
|
|
160
|
+
latestReviews?: {
|
|
154
161
|
nodes: {
|
|
155
162
|
author: GraphQLUser;
|
|
156
163
|
state: GitHubPullRequestReviewState;
|
|
@@ -172,6 +179,8 @@ export interface GraphQLIssue {
|
|
|
172
179
|
url: string;
|
|
173
180
|
state: GithubIssueState;
|
|
174
181
|
repository: {
|
|
182
|
+
databaseId: string;
|
|
183
|
+
id: string;
|
|
175
184
|
name: string;
|
|
176
185
|
owner: {
|
|
177
186
|
login: string;
|
|
@@ -4,7 +4,8 @@ import { EnterpriseProvider } from '../provider';
|
|
|
4
4
|
export type PullRequestState = 'opened' | 'merged' | 'closed';
|
|
5
5
|
export type PullRequestAssociation = 'assigned' | 'authored' | 'reviewRequested';
|
|
6
6
|
export declare class GitLab extends EnterpriseProvider implements GitProvider, IssueProvider {
|
|
7
|
-
|
|
7
|
+
private getIsSelfHosted;
|
|
8
|
+
getCurrentUser(input?: Record<string, never>, options?: EnterpriseOptions): Promise<{
|
|
8
9
|
data: Account;
|
|
9
10
|
}>;
|
|
10
11
|
getUserForCommit(input: {
|
|
@@ -16,6 +16,12 @@ export type GetIssuesForReposInput = GetReposInput | {
|
|
|
16
16
|
export interface IssueTransition {
|
|
17
17
|
id: string;
|
|
18
18
|
name: string;
|
|
19
|
+
to: {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
color: string;
|
|
23
|
+
category: IssueStatusCategory;
|
|
24
|
+
};
|
|
19
25
|
}
|
|
20
26
|
export interface IssueComponent {
|
|
21
27
|
description: string | null;
|
|
@@ -35,12 +41,15 @@ export interface Issue {
|
|
|
35
41
|
labels: GitLabel[];
|
|
36
42
|
number: string;
|
|
37
43
|
repository: {
|
|
44
|
+
id: string;
|
|
45
|
+
graphQLId?: string;
|
|
38
46
|
name: string;
|
|
39
47
|
owner: {
|
|
40
48
|
login?: string;
|
|
41
49
|
};
|
|
42
50
|
} | null;
|
|
43
51
|
state: {
|
|
52
|
+
id?: string;
|
|
44
53
|
name: string;
|
|
45
54
|
color: string | null;
|
|
46
55
|
category?: IssueStatusCategory;
|
package/dist/types.d.ts
CHANGED
package/dist/utils.d.ts
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
|
+
import { FieldMap } from './types';
|
|
1
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;
|
|
4
|
+
/**
|
|
5
|
+
* Returns providerQueryString if requestedFields is undefined or if any of the normalized fields depend on the query string.
|
|
6
|
+
* @param requestedFields
|
|
7
|
+
* @param normalizedFields
|
|
8
|
+
* @param providerQueryString
|
|
9
|
+
* @returns string
|
|
10
|
+
*/
|
|
11
|
+
export declare const fieldQuery: <T>(requestedFields: Partial<import("./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.
|
|
3
|
+
"version": "0.15.1",
|
|
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",
|