@gitkraken/provider-apis 0.38.0 → 0.40.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.
- package/CHANGELOG.md +35 -0
- package/dist/index.js +166 -144
- package/dist/index.providers.js +142 -120
- package/dist/providers/bitbucket/bitbucket.d.ts +75 -0
- package/dist/providers/gitProvider.d.ts +7 -1
- package/dist/providers/github/github.d.ts +3 -1
- package/dist/providers/github/githubMutations.d.ts +2 -0
- package/dist/types/exportedTypes/bitbucket.d.ts +1 -1
- package/dist/types/exportedTypes/gitProvider.d.ts +3 -0
- package/dist/types/internalTypes/bitbucket.d.ts +14 -0
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { RefreshTokenResponse } from '../../types/exportedTypes/bitbucket';
|
|
2
2
|
import { Account, CursorPageInput, GetRepoErrorData, GetRepoInput, GetReposInput, GitMergeStrategy, GitPullRequest, GitRepository, GitRepositoryPermissions, NumberedPageInput, Options, SetAccountInput, SetPullRequestInput } from '../../types/exportedTypes/gitProvider';
|
|
3
|
+
import { BitbucketRepositoryRole } from '../../types/internalTypes/bitbucket';
|
|
3
4
|
import { GitProvider } from '../gitProvider';
|
|
4
5
|
import { Provider } from '../provider';
|
|
5
6
|
export declare class Bitbucket extends Provider implements GitProvider {
|
|
@@ -29,6 +30,56 @@ export declare class Bitbucket extends Provider implements GitProvider {
|
|
|
29
30
|
data: GitRepository[];
|
|
30
31
|
errors: GetRepoErrorData[];
|
|
31
32
|
}>;
|
|
33
|
+
/**
|
|
34
|
+
* Note: The repos returned by this method do not include permissions info. If you need
|
|
35
|
+
* permissions info, use `getAllReposForWorkspaceWithPermissions` instead.
|
|
36
|
+
*/
|
|
37
|
+
getReposForWorkspace(input: {
|
|
38
|
+
workspace: string;
|
|
39
|
+
minimumRole?: BitbucketRepositoryRole;
|
|
40
|
+
} & NumberedPageInput, options?: Options): Promise<{
|
|
41
|
+
pageInfo: {
|
|
42
|
+
hasNextPage: boolean;
|
|
43
|
+
nextPage: number | null;
|
|
44
|
+
};
|
|
45
|
+
data: GitRepository[];
|
|
46
|
+
}>;
|
|
47
|
+
/**
|
|
48
|
+
* Note: The repos returned by this method do not include permissions info. If you need
|
|
49
|
+
* permissions info, use `getAllReposForWorkspaceWithPermissions` instead.
|
|
50
|
+
*/
|
|
51
|
+
getAllReposForWorkspace(input: {
|
|
52
|
+
workspace: string;
|
|
53
|
+
minimumRole?: BitbucketRepositoryRole;
|
|
54
|
+
}, options?: Options): Promise<GitRepository[]>;
|
|
55
|
+
/**
|
|
56
|
+
* Fetches all repositories for a workspace with permissions. This method queries the workspace repos endpoint
|
|
57
|
+
* with multiple role filters (admin, contributor, member) and deduces permissions from the highest role found.
|
|
58
|
+
* All pages are fetched internally for accuracy (since with paging, this method could result in incorrect
|
|
59
|
+
* permissions being returned).
|
|
60
|
+
*/
|
|
61
|
+
getAllReposForWorkspaceWithPermissions(input: {
|
|
62
|
+
workspace: string;
|
|
63
|
+
minimumRole?: 'admin' | 'contributor' | 'member';
|
|
64
|
+
}, options?: Options): Promise<{
|
|
65
|
+
data: {
|
|
66
|
+
permissions: GitRepositoryPermissions;
|
|
67
|
+
id: string;
|
|
68
|
+
graphQLId?: string | undefined;
|
|
69
|
+
namespace: string;
|
|
70
|
+
name: string;
|
|
71
|
+
project?: string | undefined;
|
|
72
|
+
projectId?: string | undefined;
|
|
73
|
+
webUrl: string | null;
|
|
74
|
+
httpsUrl: string | null;
|
|
75
|
+
sshUrl: string | null;
|
|
76
|
+
defaultBranch: import("../../types/exportedTypes/gitProvider").GitRef | null;
|
|
77
|
+
}[];
|
|
78
|
+
}>;
|
|
79
|
+
/**
|
|
80
|
+
* @deprecated Use `getWorkspacesForCurrentUser` + `getReposForWorkspace` instead.
|
|
81
|
+
* This method uses the deprecated `/repositories` endpoint.
|
|
82
|
+
*/
|
|
32
83
|
getReposForCurrentUser(input: CursorPageInput, options?: Options): Promise<{
|
|
33
84
|
pageInfo: {
|
|
34
85
|
hasNextPage: boolean;
|
|
@@ -68,6 +119,22 @@ export declare class Bitbucket extends Provider implements GitProvider {
|
|
|
68
119
|
};
|
|
69
120
|
}[];
|
|
70
121
|
}>;
|
|
122
|
+
getWorkspacesForCurrentUser(input?: {
|
|
123
|
+
administrator?: boolean;
|
|
124
|
+
} & NumberedPageInput, options?: Options): Promise<{
|
|
125
|
+
pageInfo: {
|
|
126
|
+
hasNextPage: boolean;
|
|
127
|
+
nextPage: number | null;
|
|
128
|
+
};
|
|
129
|
+
data: {
|
|
130
|
+
id: string;
|
|
131
|
+
slug: string;
|
|
132
|
+
}[];
|
|
133
|
+
}>;
|
|
134
|
+
/**
|
|
135
|
+
* @deprecated Use `getWorkspacesForCurrentUser` instead.
|
|
136
|
+
* This method uses the deprecated `/user/permissions/workspaces` endpoint.
|
|
137
|
+
*/
|
|
71
138
|
getWorkspacesForUser(input: {
|
|
72
139
|
userId: string;
|
|
73
140
|
} & NumberedPageInput, options?: Options): Promise<{
|
|
@@ -121,6 +188,10 @@ export declare class Bitbucket extends Provider implements GitProvider {
|
|
|
121
188
|
};
|
|
122
189
|
data: Account[];
|
|
123
190
|
}>;
|
|
191
|
+
/**
|
|
192
|
+
* @deprecated Use `getAllReposForWorkspaceWithPermissions` instead.
|
|
193
|
+
* This method uses the deprecated `/user/permissions/repositories` endpoint.
|
|
194
|
+
*/
|
|
124
195
|
getReposPermissionsForCurrentUser(input: NumberedPageInput, options?: Options): Promise<{
|
|
125
196
|
pageInfo: {
|
|
126
197
|
hasNextPage: boolean;
|
|
@@ -128,6 +199,10 @@ export declare class Bitbucket extends Provider implements GitProvider {
|
|
|
128
199
|
};
|
|
129
200
|
data: Record<string, GitRepositoryPermissions>;
|
|
130
201
|
}>;
|
|
202
|
+
/**
|
|
203
|
+
* @deprecated Use `getAllReposForWorkspaceWithPermissions` instead.
|
|
204
|
+
* This method uses the deprecated `/user/permissions/repositories` endpoint.
|
|
205
|
+
*/
|
|
131
206
|
decorateReposWithPermissions(input: {
|
|
132
207
|
repos: GitRepository[];
|
|
133
208
|
}, options?: Options): Promise<{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Account, AddInlineCommentInput, CreateCommitInput, GetPRForRepoInput, GetRepoErrorData, GetRepoInput, GetReposInput, GitBlame, GitComment, GitLabel, GitMergeStrategy, GitPullRequest, GitRefWithCommit, GitRepository, Options, PageInput, SetAccountInput, SetLabelInput, SetMilestoneInput, SetPullRequestInput, User } from '../types/exportedTypes/gitProvider';
|
|
1
|
+
import { Account, AddInlineCommentInput, CreateCommitInput, DeleteCommentInput, EditCommentInput, GetPRForRepoInput, GetRepoErrorData, GetRepoInput, GetReposInput, GitBlame, GitComment, GitLabel, GitMergeStrategy, GitPullRequest, GitRefWithCommit, GitRepository, Options, PageInput, ResolveReviewThreadInput, SetAccountInput, SetLabelInput, SetMilestoneInput, SetPullRequestInput, User } from '../types/exportedTypes/gitProvider';
|
|
2
2
|
import { PagedResult, Result } from '../types/exportedTypes/types';
|
|
3
3
|
export interface GitProvider {
|
|
4
4
|
getCurrentUser?(input: Record<string, never>, options: Options): Promise<Result<Account>>;
|
|
@@ -95,5 +95,11 @@ export interface GitProvider {
|
|
|
95
95
|
repo: GetRepoInput;
|
|
96
96
|
pullRequestNumber: number;
|
|
97
97
|
} & PageInput, options: Options): Promise<PagedResult<GitComment>>;
|
|
98
|
+
deleteComment?(input: DeleteCommentInput, options: Options): Promise<void>;
|
|
99
|
+
editComment?(input: EditCommentInput, options: Options): Promise<void>;
|
|
100
|
+
deleteInlineComment?(input: DeleteCommentInput, options: Options): Promise<void>;
|
|
101
|
+
editInlineComment?(input: EditCommentInput, options: Options): Promise<void>;
|
|
102
|
+
resolveReviewThread?(input: ResolveReviewThreadInput, options: Options): Promise<void>;
|
|
103
|
+
unresolveReviewThread?(input: ResolveReviewThreadInput, options: Options): Promise<void>;
|
|
98
104
|
}
|
|
99
105
|
export declare const MAX_PAGE_SIZE = 100;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Account, AddInlineCommentInput, CreateCommitInput, CursorPageInput, DeleteCommentInput, EditCommentInput, EnterpriseOptions, GetRepoErrorData, GetRepoInput, GitComment, GitLabel, GitMergeStrategy, GitMilestone, GitPullRequest, GitPullRequestReviewComment, GitPullRequestReviewState, GitRepository, GitTreeItem, NumberedPageInput, Organization, SetAccountInput, SetLabelInput, SetMilestoneInput, SetPullRequestInput } from '../../types/exportedTypes/gitProvider';
|
|
1
|
+
import { Account, AddInlineCommentInput, CreateCommitInput, CursorPageInput, DeleteCommentInput, EditCommentInput, EnterpriseOptions, GetRepoErrorData, GetRepoInput, GitComment, GitLabel, GitMergeStrategy, GitMilestone, GitPullRequest, GitPullRequestReviewComment, GitPullRequestReviewState, GitRepository, GitTreeItem, NumberedPageInput, Organization, ResolveReviewThreadInput, SetAccountInput, SetLabelInput, SetMilestoneInput, SetPullRequestInput } from '../../types/exportedTypes/gitProvider';
|
|
2
2
|
import { FetchIssuesData, FetchPullRequestsData, GitHubIssueCloseReason } from '../../types/exportedTypes/github';
|
|
3
3
|
import { Issue, SetIssueInput } from '../../types/exportedTypes/issueProvider';
|
|
4
4
|
import { GitProvider } from '../gitProvider';
|
|
@@ -296,6 +296,8 @@ export declare class GitHub extends EnterpriseProvider implements GitProvider, I
|
|
|
296
296
|
deleteComment(input: DeleteCommentInput, options?: EnterpriseOptions): Promise<void>;
|
|
297
297
|
editComment(input: EditCommentInput, options?: EnterpriseOptions): Promise<void>;
|
|
298
298
|
editInlineComment(input: EditCommentInput, options?: EnterpriseOptions): Promise<void>;
|
|
299
|
+
resolveReviewThread(input: ResolveReviewThreadInput, options?: EnterpriseOptions): Promise<void>;
|
|
300
|
+
unresolveReviewThread(input: ResolveReviewThreadInput, options?: EnterpriseOptions): Promise<void>;
|
|
299
301
|
private addReplyToReviewThread;
|
|
300
302
|
private createReviewThread;
|
|
301
303
|
setPullRequestMilestone(input: {
|
|
@@ -7,4 +7,6 @@
|
|
|
7
7
|
export declare const DELETE_ISSUE_COMMENT = "mutation DeleteIssueComment(\n $issueCommentId: ID!\n) {\n deleteIssueComment(input: {\n id: $issueCommentId\n }) {\n clientMutationId\n }\n}";
|
|
8
8
|
export declare const DELETE_PULL_REQUEST_REVIEW_COMMENT = "mutation DeletePullRequestReviewComment(\n $pullRequestReviewCommentId: ID!\n) {\n deletePullRequestReviewComment(input: {\n id: $pullRequestReviewCommentId\n }) {\n pullRequestReview {\n id\n }\n }\n}";
|
|
9
9
|
export declare const UPDATE_ISSUE_COMMENT = "mutation UpdateIssueComment(\n $issueCommentId: ID!,\n $body: String!\n) {\n updateIssueComment(input: {\n id: $issueCommentId,\n body: $body\n }) {\n issueComment {\n id\n body\n }\n }\n}";
|
|
10
|
+
export declare const RESOLVE_REVIEW_THREAD = "mutation ResolveReviewThread(\n $pullRequestReviewThreadId: ID!\n) {\n resolveReviewThread(input: {\n threadId: $pullRequestReviewThreadId\n }) {\n thread {\n id\n isResolved\n }\n }\n}";
|
|
11
|
+
export declare const UNRESOLVE_REVIEW_THREAD = "mutation UnresolveReviewThread(\n $pullRequestReviewThreadId: ID!\n) {\n unresolveReviewThread(input: {\n threadId: $pullRequestReviewThreadId\n }) {\n thread {\n id\n isResolved\n }\n }\n}";
|
|
10
12
|
export declare const UPDATE_PULL_REQUEST_REVIEW_COMMENT = "mutation UpdatePullRequestReviewComment(\n $pullRequestReviewCommentId: ID!,\n $body: String!\n) {\n updatePullRequestReviewComment(input: {\n pullRequestReviewCommentId: $pullRequestReviewCommentId,\n body: $body\n }) {\n pullRequestReviewComment {\n id\n body\n }\n }\n}";
|
|
@@ -201,6 +201,19 @@ export interface BitbucketWorkspace {
|
|
|
201
201
|
slug: string;
|
|
202
202
|
};
|
|
203
203
|
}
|
|
204
|
+
export interface BitbucketWorkspaceAccess {
|
|
205
|
+
type: 'workspace_access';
|
|
206
|
+
administrator: boolean;
|
|
207
|
+
workspace: {
|
|
208
|
+
type: 'workspace_base';
|
|
209
|
+
uuid: string;
|
|
210
|
+
slug: string;
|
|
211
|
+
links: {
|
|
212
|
+
avatar: Link;
|
|
213
|
+
self: Link;
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
}
|
|
204
217
|
export type BitbucketAccount = {
|
|
205
218
|
type: string;
|
|
206
219
|
permission: string;
|
|
@@ -223,4 +236,5 @@ export type BitbucketRepositoryPermissions = {
|
|
|
223
236
|
permission: 'owner' | 'admin' | 'write' | 'read' | 'none';
|
|
224
237
|
user: UserStub;
|
|
225
238
|
};
|
|
239
|
+
export type BitbucketRepositoryRole = 'owner' | 'admin' | 'contributor' | 'member';
|
|
226
240
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitkraken/provider-apis",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.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",
|