@gitkraken/provider-apis 0.17.5 → 0.19.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.
@@ -1,6 +1,11 @@
1
- import { Account, CursorPageInput, EnterpriseOptions, GetRepoErrorData, GetRepoInput, GitLabel, GitMergeStrategy, GitProvider, GitPullRequest, GitRepository, NumberedPageInput } from '../gitProvider';
2
- import { GetIssueInput, Issue, IssueProvider } from '../issueProvider';
1
+ import { Account, CursorPageInput, EnterpriseOptions, GetRepoErrorData, GetRepoInput, GitLabel, GitMergeStrategy, GitProvider, GitPullRequest, GitRepository, NumberedPageInput, SetAccountInput, SetLabelInput, SetMilestoneInput, SetPullRequestInput } from '../gitProvider';
2
+ import { Issue, IssueProvider, SetIssueInput } from '../issueProvider';
3
3
  import { EnterpriseProvider } from '../provider';
4
+ export interface GitLabGetIssueInput {
5
+ namespace: string;
6
+ name: string;
7
+ number: string;
8
+ }
4
9
  export type PullRequestState = 'opened' | 'merged' | 'closed';
5
10
  export type PullRequestAssociation = 'assigned' | 'authored' | 'reviewRequested';
6
11
  export declare class GitLab extends EnterpriseProvider implements GitProvider, IssueProvider {
@@ -44,7 +49,7 @@ export declare class GitLab extends EnterpriseProvider implements GitProvider, I
44
49
  data: GitRepository[];
45
50
  errors: GetRepoErrorData[];
46
51
  }>;
47
- getReposForCurrentUser(input?: CursorPageInput, options?: EnterpriseOptions): Promise<{
52
+ getReposForCurrentUser(input: CursorPageInput, options?: EnterpriseOptions): Promise<{
48
53
  pageInfo: {
49
54
  endCursor: string | null;
50
55
  hasNextPage: boolean;
@@ -168,41 +173,48 @@ export declare class GitLab extends EnterpriseProvider implements GitProvider, I
168
173
  data: GitPullRequest[];
169
174
  }>;
170
175
  closePullRequest(input: {
171
- repo: GetRepoInput;
172
- pullRequestId: string;
176
+ pullRequest: SetPullRequestInput;
173
177
  }, options?: EnterpriseOptions): Promise<void>;
174
178
  mergePullRequest(input: {
175
- repo: GetRepoInput;
176
- pullRequestId: string;
177
- expectedSourceSha: string;
179
+ pullRequest: {
180
+ headRef: {
181
+ oid: string | null;
182
+ } | null;
183
+ } & SetPullRequestInput;
178
184
  mergeStrategy?: GitMergeStrategy.Squash;
179
185
  }, options?: EnterpriseOptions): Promise<void>;
180
186
  setPullRequestMilestone(input: {
181
- repo: GetRepoInput;
182
- pullRequestId: string;
183
- milestoneGraphQLId: string | null;
187
+ pullRequest: SetPullRequestInput;
188
+ milestone: SetMilestoneInput | null;
184
189
  }, options?: EnterpriseOptions): Promise<void>;
185
190
  setPullRequestAsDraft(input: {
186
- repo: GetRepoInput;
187
- pullRequestId: string;
191
+ pullRequest: SetPullRequestInput;
188
192
  isDraft: boolean;
189
193
  }, options?: EnterpriseOptions): Promise<void>;
190
194
  setPullRequestReviewers(input: {
191
- repo: GetRepoInput;
192
- pullRequestId: string;
193
- reviewerUsernames: string[];
195
+ pullRequest: SetPullRequestInput;
196
+ reviewers: SetAccountInput[];
197
+ }, options?: EnterpriseOptions): Promise<void>;
198
+ private reRequestPullRequestReview;
199
+ reRequestPullRequestReviews(input: {
200
+ pullRequest: {
201
+ reviews: {
202
+ reviewer: {
203
+ graphQLId?: string;
204
+ };
205
+ }[] | null;
206
+ } & SetPullRequestInput;
207
+ reviewers: SetAccountInput[];
194
208
  }, options?: EnterpriseOptions): Promise<void>;
195
209
  setPullRequestAssignees(input: {
196
- repo: GetRepoInput;
197
- pullRequestId: string;
198
- assigneeUsernames: string[];
210
+ pullRequest: SetPullRequestInput;
211
+ assignees: SetAccountInput[];
199
212
  }, options?: EnterpriseOptions): Promise<void>;
200
213
  setPullRequestLabels(input: {
201
- repo: GetRepoInput;
202
- pullRequestId: string;
203
- labelGraphQLIds: string[];
214
+ pullRequest: SetPullRequestInput;
215
+ labels: SetLabelInput[];
204
216
  }, options?: EnterpriseOptions): Promise<void>;
205
- getIssue(input: GetIssueInput, options?: EnterpriseOptions): Promise<{
217
+ getIssue(input: GitLabGetIssueInput, options?: EnterpriseOptions): Promise<{
206
218
  data: Issue;
207
219
  }>;
208
220
  private getVariablesForIssues;
@@ -215,7 +227,7 @@ export declare class GitLab extends EnterpriseProvider implements GitProvider, I
215
227
  pageInfo: {
216
228
  endCursor: string | null;
217
229
  hasNextPage: boolean;
218
- } | undefined;
230
+ };
219
231
  data: Issue[];
220
232
  }>;
221
233
  getIssuesForRepos(input: {
@@ -227,28 +239,27 @@ export declare class GitLab extends EnterpriseProvider implements GitProvider, I
227
239
  pageInfo: {
228
240
  endCursor: string | null;
229
241
  hasNextPage: boolean;
230
- } | undefined;
242
+ };
231
243
  data: Issue[];
232
244
  }>;
233
- setIssueStatus(input: {
234
- repo: GetRepoInput;
235
- issueId: string;
236
- status: 'CLOSE' | 'REOPEN';
245
+ private setIssueState;
246
+ closeIssue(input: {
247
+ issue: SetIssueInput;
248
+ }, options?: EnterpriseOptions): Promise<void>;
249
+ reOpenIssue(input: {
250
+ issue: SetIssueInput;
237
251
  }, options?: EnterpriseOptions): Promise<void>;
238
252
  setIssueLabels(input: {
239
- repo: GetRepoInput;
240
- issueId: string;
241
- labelGraphQLIds: string[];
253
+ issue: SetIssueInput;
254
+ labels: SetLabelInput[];
242
255
  }, options?: EnterpriseOptions): Promise<void>;
243
256
  setIssueMilestone(input: {
244
- repo: GetRepoInput;
245
- issueId: string;
246
- milestoneGraphQLId: string | null;
257
+ issue: SetIssueInput;
258
+ milestone: SetMilestoneInput | null;
247
259
  }, options?: EnterpriseOptions): Promise<void>;
248
260
  setIssueAssignees(input: {
249
- repo: GetRepoInput;
250
- issueId: string;
251
- assigneeUsernames: string[];
261
+ issue: SetIssueInput;
262
+ assignees: SetAccountInput[];
252
263
  }, options?: EnterpriseOptions): Promise<void>;
253
264
  getMilestonesForRepo(input: {
254
265
  repo: GetRepoInput;
@@ -1,13 +1,14 @@
1
- import { Result } from '../types';
2
- import { Account, GetReposInput, GitLabel, GitMilestone, Options } from './gitProvider';
1
+ import { PagedResult, Result } from '../types';
2
+ import { Account, GetRepoInput, GetReposInput, GitLabel, GitMilestone, Options, SetAccountInput, SetLabelInput, SetMilestoneInput } from './gitProvider';
3
3
  export declare enum GitIssueState {
4
4
  Open = "OPEN",
5
5
  Closed = "CLOSED"
6
6
  }
7
7
  export interface GetIssueInput {
8
- namespace: string;
8
+ resourceId?: string;
9
+ namespace?: string;
9
10
  project?: string;
10
- name: string;
11
+ name?: string;
11
12
  number: string;
12
13
  }
13
14
  export type GetIssuesForReposInput = GetReposInput | {
@@ -48,6 +49,11 @@ export interface Issue {
48
49
  login?: string;
49
50
  };
50
51
  } | null;
52
+ project?: {
53
+ namespace: string | null;
54
+ resourceId: string | null;
55
+ name: string;
56
+ };
51
57
  state: {
52
58
  id?: string;
53
59
  name: string;
@@ -63,7 +69,56 @@ export interface Issue {
63
69
  url: string | null;
64
70
  milestone?: GitMilestone | null;
65
71
  }
72
+ export interface SetIssueInput {
73
+ id: string;
74
+ graphQLId?: string;
75
+ number: string;
76
+ repository: {
77
+ name: string;
78
+ owner: {
79
+ login?: string;
80
+ };
81
+ } | null;
82
+ project?: {
83
+ namespace: string | null;
84
+ resourceId: string | null;
85
+ name: string;
86
+ };
87
+ }
88
+ export interface SetStatusInput {
89
+ name: string;
90
+ id?: string;
91
+ }
66
92
  export interface IssueProvider {
67
- getIssue(input: GetIssueInput, options: Options): Promise<Result<Issue>>;
68
- getIssuesForRepos(input: GetIssuesForReposInput, options: Options): Promise<Result<Issue[]>>;
93
+ getIssue?(input: GetIssueInput, options: Options): Promise<Result<Issue>>;
94
+ getIssuesForRepo?(input: {
95
+ repo: GetRepoInput;
96
+ }, options: Options): Promise<PagedResult<Issue>>;
97
+ getIssuesForRepos?(input: GetIssuesForReposInput, options: Options): Promise<PagedResult<Issue>>;
98
+ setIssueLabels?(input: {
99
+ issue: SetIssueInput;
100
+ labels: SetLabelInput[];
101
+ }, options: Options): Promise<void>;
102
+ setIssueAssignee?(input: {
103
+ issue: SetIssueInput;
104
+ assignee: SetAccountInput | null;
105
+ }, options: Options): Promise<void>;
106
+ setIssueAssignees?(input: {
107
+ issue: SetIssueInput;
108
+ assignees: SetAccountInput[];
109
+ }, options: Options): Promise<void>;
110
+ setIssueMilestone?(input: {
111
+ issue: SetIssueInput;
112
+ milestone: SetMilestoneInput;
113
+ }, options: Options): Promise<void>;
114
+ setIssueStatus?(input: {
115
+ issue: SetIssueInput;
116
+ status: SetStatusInput;
117
+ }, options: Options): Promise<void>;
118
+ closeIssue?(input: {
119
+ issue: SetIssueInput;
120
+ }): Promise<void>;
121
+ reOpenIssue?(input: {
122
+ issue: SetIssueInput;
123
+ }): Promise<void>;
69
124
  }
@@ -1,6 +1,8 @@
1
1
  import { Result } from '../../types';
2
- import { CursorPageInput, EnterpriseOptions, NumberedPageInput } from '../gitProvider';
2
+ import { CursorPageInput, EnterpriseOptions, NumberedPageInput, SetAccountInput, SetLabelInput } from '../gitProvider';
3
+ import { IssueProvider, SetIssueInput, SetStatusInput } from '../issueProvider';
3
4
  import { Provider } from '../provider';
5
+ import { SetComponentInput } from './sharedTypes';
4
6
  export interface JiraResource {
5
7
  id: string;
6
8
  name: string;
@@ -13,7 +15,11 @@ export interface JiraProject {
13
15
  name: string;
14
16
  resourceId: string;
15
17
  }
16
- export declare class Jira extends Provider {
18
+ export interface JiraGetIssueInput {
19
+ resourceId: string;
20
+ number: string;
21
+ }
22
+ export declare class Jira extends Provider implements IssueProvider {
17
23
  private _resourceUrlCache;
18
24
  private getResourceUrl;
19
25
  getCurrentUserForResource(input: {
@@ -69,10 +75,7 @@ export declare class Jira extends Provider {
69
75
  }, options?: EnterpriseOptions): Promise<{
70
76
  data: import("./sharedTypes").JiraComponent[];
71
77
  }>;
72
- getIssue(input: {
73
- resourceId: string;
74
- number: string;
75
- }, options?: EnterpriseOptions): Promise<{
78
+ getIssue(input: JiraGetIssueInput, options?: EnterpriseOptions): Promise<{
76
79
  data: import("../issueProvider").Issue;
77
80
  }>;
78
81
  getIssuesForProject(input: {
@@ -98,24 +101,20 @@ export declare class Jira extends Provider {
98
101
  };
99
102
  }>;
100
103
  setIssueStatus(input: {
101
- resourceId: string;
102
- issueId: string;
103
- status: string;
104
+ issue: SetIssueInput;
105
+ status: SetStatusInput;
104
106
  }, options?: EnterpriseOptions): Promise<void>;
105
107
  setIssueAssignee(input: {
106
- resourceId: string;
107
- issueId: string;
108
- assigneeId: string | null;
108
+ issue: SetIssueInput;
109
+ assignee: SetAccountInput | null;
109
110
  }, options?: EnterpriseOptions): Promise<void>;
110
111
  setIssueComponents(input: {
111
- resourceId: string;
112
- issueId: string;
113
- componentIds: string[];
112
+ issue: SetIssueInput;
113
+ components: SetComponentInput[];
114
114
  }, options?: EnterpriseOptions): Promise<void>;
115
115
  setIssueLabels(input: {
116
- resourceId: string;
117
- issueId: string;
118
- labelNames: string[];
116
+ issue: SetIssueInput;
117
+ labels: SetLabelInput[];
119
118
  }, options?: EnterpriseOptions): Promise<void>;
120
119
  getLabelsForResource(input: {
121
120
  resourceId: string;
@@ -1,8 +1,8 @@
1
1
  import { ProviderConfig } from '../../types';
2
- import { EnterpriseOptions, NumberedPageInput } 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;
2
+ import { EnterpriseOptions, NumberedPageInput, SetLabelInput } from '../gitProvider';
3
+ import { Issue, IssueComponent, IssueTransition, SetIssueInput, SetStatusInput } from '../issueProvider';
4
+ import { JiraComponent, JiraComponentStub, JiraIssue, JiraTransition, JiraUser, SetComponentInput } from './sharedTypes';
5
+ export declare const normalizeIssue: (issue: JiraIssue, resourceUrl: string | null, resourceId?: string) => Issue;
6
6
  export declare const normalizeTransition: (transition: JiraTransition) => IssueTransition;
7
7
  export declare const normalizeComponentStub: (component: JiraComponentStub) => IssueComponent;
8
8
  export declare const normalizeUserURL: (user: JiraUser, resourceUrl: string | null, isServer: boolean) => string;
@@ -43,19 +43,16 @@ export declare const getIssuesForProject: (config: ProviderConfig, input: {
43
43
  };
44
44
  }>;
45
45
  export declare const setIssueLabels: (config: ProviderConfig, input: {
46
- resourceId?: string;
47
- issueId: string;
48
- labelNames: string[];
46
+ issue: SetIssueInput;
47
+ labels: SetLabelInput[];
49
48
  }, options?: EnterpriseOptions) => Promise<void>;
50
49
  export declare const setIssueComponents: (config: ProviderConfig, input: {
51
- resourceId?: string;
52
- issueId: string;
53
- componentIds: string[];
50
+ issue: SetIssueInput;
51
+ components: SetComponentInput[];
54
52
  }, options?: EnterpriseOptions) => Promise<void>;
55
53
  export declare const setIssueStatus: (config: ProviderConfig, input: {
56
- resourceId?: string;
57
- issueId: string;
58
- status: string;
54
+ issue: SetIssueInput;
55
+ status: SetStatusInput;
59
56
  }, options?: EnterpriseOptions) => Promise<void>;
60
57
  export declare const getComponentsForJiraProject: (config: ProviderConfig, input: {
61
58
  resourceId?: string;
@@ -1,3 +1,6 @@
1
+ export interface SetComponentInput {
2
+ id: string;
3
+ }
1
4
  export interface AvatarUrls {
2
5
  '16x16': string;
3
6
  '24x24': string;
@@ -78,6 +81,15 @@ export interface JiraIssue {
78
81
  expand: string;
79
82
  fields: {
80
83
  components?: JiraComponentStub[];
84
+ project: {
85
+ avatarUrls: AvatarUrls;
86
+ id: string;
87
+ key: string;
88
+ name: string;
89
+ projectTypeKey: string;
90
+ self: string;
91
+ simplified: boolean;
92
+ };
81
93
  status: JiraIssueStatus;
82
94
  assignee?: JiraUser;
83
95
  comment: {
@@ -1,10 +1,12 @@
1
- import { EnterpriseOptions, NumberedPageInput } from '../gitProvider';
1
+ import { EnterpriseOptions, NumberedPageInput, SetLabelInput } from '../gitProvider';
2
+ import { IssueProvider, SetIssueInput, SetStatusInput } from '../issueProvider';
3
+ import { SetComponentInput } from '../jira/sharedTypes';
2
4
  import { EnterpriseProvider } from '../provider';
3
5
  export interface JiraServerProject {
4
6
  id: string;
5
7
  name: string;
6
8
  }
7
- export declare class JiraServer extends EnterpriseProvider {
9
+ export declare class JiraServer extends EnterpriseProvider implements IssueProvider {
8
10
  getCurrentUser(options?: EnterpriseOptions): Promise<{
9
11
  data: {
10
12
  name: string;
@@ -46,16 +48,16 @@ export declare class JiraServer extends EnterpriseProvider {
46
48
  };
47
49
  }>;
48
50
  setIssueStatus(input: {
49
- issueId: string;
50
- status: string;
51
+ issue: SetIssueInput;
52
+ status: SetStatusInput;
51
53
  }, options?: EnterpriseOptions): Promise<void>;
52
54
  setIssueLabels(input: {
53
- issueId: string;
54
- labelNames: string[];
55
+ issue: SetIssueInput;
56
+ labels: SetLabelInput[];
55
57
  }, options?: EnterpriseOptions): Promise<void>;
56
58
  setIssueComponents(input: {
57
- issueId: string;
58
- componentIds: string[];
59
+ issue: SetIssueInput;
60
+ components: SetComponentInput[];
59
61
  }, options?: EnterpriseOptions): Promise<void>;
60
62
  getLabels(options?: EnterpriseOptions): Promise<{
61
63
  data: {
@@ -1,6 +1,6 @@
1
1
  import { Result } from '../../types';
2
- import { EnterpriseOptions } from '../gitProvider';
3
- import { Issue } from '../issueProvider';
2
+ import { EnterpriseOptions, SetAccountInput, SetLabelInput } from '../gitProvider';
3
+ import { Issue, IssueProvider, SetIssueInput, SetStatusInput } from '../issueProvider';
4
4
  import { Provider } from '../provider';
5
5
  interface TrelloList {
6
6
  id: string;
@@ -24,7 +24,7 @@ export interface TrelloBoard {
24
24
  id: string;
25
25
  name: string;
26
26
  }
27
- export declare class Trello extends Provider {
27
+ export declare class Trello extends Provider implements IssueProvider {
28
28
  getCurrentUser(input: {
29
29
  appKey: string;
30
30
  }, options?: EnterpriseOptions): Promise<{
@@ -73,23 +73,27 @@ export declare class Trello extends Provider {
73
73
  private updateIssue;
74
74
  setIssueStatus(input: {
75
75
  appKey: string;
76
- cardId: string;
77
- status: string;
76
+ issue: SetIssueInput;
77
+ status: SetStatusInput;
78
78
  }, options?: EnterpriseOptions): Promise<void>;
79
79
  setIssueAssignees(input: {
80
80
  appKey: string;
81
- cardId: string;
82
- assigneeIds: string[];
81
+ issue: SetIssueInput;
82
+ assignees: SetAccountInput[];
83
83
  }, options?: EnterpriseOptions): Promise<void>;
84
84
  setIssueLabels(input: {
85
85
  appKey: string;
86
- cardId: string;
87
- labelIds: string[];
86
+ issue: SetIssueInput;
87
+ labels: SetLabelInput[];
88
88
  }, options?: EnterpriseOptions): Promise<void>;
89
- setIssueArchived(input: {
89
+ private setIssueArchived;
90
+ archiveIssue(input: {
90
91
  appKey: string;
91
- cardId: string;
92
- archived: boolean;
92
+ issue: SetIssueInput;
93
+ }, options?: EnterpriseOptions): Promise<void>;
94
+ unArchiveIssue(input: {
95
+ appKey: string;
96
+ issue: SetIssueInput;
93
97
  }, options?: EnterpriseOptions): Promise<void>;
94
98
  getLabelsForBoard(input: {
95
99
  appKey: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitkraken/provider-apis",
3
- "version": "0.17.5",
3
+ "version": "0.19.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",
@@ -29,6 +29,7 @@
29
29
  "watch": "yarn clean && node ./scripts/build.mjs --watch & tsc -w"
30
30
  },
31
31
  "dependencies": {
32
+ "js-base64": "3.7.5",
32
33
  "node-fetch": "2.7.0"
33
34
  },
34
35
  "devDependencies": {