@gitkraken/provider-apis 0.16.0 → 0.17.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.
@@ -0,0 +1,13 @@
1
+ import { type Account, type GitPullRequest } from '../providers/gitProvider';
2
+ import type { PullRequestBuckets } from '../types';
3
+ export declare const READY_TO_MERGE_BUCKET_ID = "readyToMerge";
4
+ export declare const UNASSIGNED_REVIEWERS_BUCKET_ID = "unassignedReviewers";
5
+ export declare const FAILING_CI_BUCKET_ID = "failingCI";
6
+ export declare const CONFLICTS_BUCKET_ID = "conflicts";
7
+ export declare const NEEDS_MY_REVIEW_BUCKET_ID = "needsMyReview";
8
+ export declare const CHANGES_REQUESTED_BUCKET_ID = "changesRequested";
9
+ export declare const REVIEWER_COMMENTED_BUCKET_ID = "reviewerCommented";
10
+ export declare const WAITING_FOR_REVIEW_BUCKET_ID = "waitingForReview";
11
+ export declare const DRAFT_BUCKET_ID = "draft";
12
+ export declare const OTHER_BUCKET_ID = "other";
13
+ export declare const groupPullRequestsIntoBuckets: (pullRequests: GitPullRequest[], currentUser: Pick<Account, 'id'>) => PullRequestBuckets;
@@ -2,7 +2,7 @@ import { PagedResult, Result } from '../../types';
2
2
  import { CursorPageInput, EnterpriseOptions, GetRepoErrorData, GetRepoInput, GitMergeStrategy, GitProvider, GitPullRequest, GitRepository, NumberedPageInput, Options } from '../gitProvider';
3
3
  import { Issue } from '../issueProvider';
4
4
  import { Provider } from '../provider';
5
- import { PullRequestAsyncStatus, WorkItemType } from './azureDevOpsTypes';
5
+ import { AzureGraphAccount, PullRequestAsyncStatus, WorkItemType } from './azureDevOpsTypes';
6
6
  export interface AzureGetRepoInput extends GetRepoInput {
7
7
  project: string;
8
8
  }
@@ -73,16 +73,45 @@ export declare class AzureDevOps extends Provider implements GitProvider {
73
73
  scope: string;
74
74
  };
75
75
  }>;
76
- getAccountsForAzureProject(input: {
76
+ getAzureGraphAccountsForAzureProject(input: {
77
77
  namespace: string;
78
78
  projectScopeDescriptor?: string;
79
+ } & CursorPageInput, options?: Options): Promise<{
80
+ pageInfo: {
81
+ endCursor: string | null;
82
+ hasNextPage: boolean;
83
+ };
84
+ data: {
85
+ avatarUrl: string | null;
86
+ descriptor: string;
87
+ email: string;
88
+ name: string;
89
+ storageKeyURL: string;
90
+ username: string;
91
+ }[];
92
+ }>;
93
+ getAccountFromAzureGraphAccount(input: {
94
+ azureGraphAccount: AzureGraphAccount;
79
95
  }, options?: Options): Promise<{
80
96
  data: {
97
+ avatarUrl: string | null;
98
+ email: string | null;
81
99
  id: string;
82
100
  name: string;
83
101
  username: string;
84
- email: string;
85
- avatarUrl: string | undefined;
102
+ url: null;
103
+ };
104
+ }>;
105
+ getAccountsFromAzureGraphAccounts(input: {
106
+ azureGraphAccounts: AzureGraphAccount[];
107
+ }, options?: Options): Promise<{
108
+ data: {
109
+ avatarUrl: string | null;
110
+ email: string | null;
111
+ id: string;
112
+ name: string;
113
+ username: string;
114
+ url: null;
86
115
  }[];
87
116
  }>;
88
117
  getRepo(input: AzureGetRepoInput, options?: Options): Promise<{
@@ -232,6 +232,14 @@ export interface WorkItemType {
232
232
  states: WorkItemState[];
233
233
  url: string;
234
234
  }
235
+ export interface AzureGraphAccount {
236
+ avatarUrl: string | null;
237
+ descriptor: string;
238
+ email: string | null;
239
+ name: string;
240
+ storageKeyURL: string;
241
+ username: string;
242
+ }
235
243
  export interface UpdatePullRequestResponse {
236
244
  status: string;
237
245
  }
@@ -40,7 +40,8 @@ export declare enum GitBuildStatusState {
40
40
  Running = "RUNNING",
41
41
  Skipped = "SKIPPED",
42
42
  Success = "SUCCESS",
43
- Warning = "WARNING"
43
+ Warning = "WARNING",
44
+ OptionalActionRequired = "OPTIONAL_ACTION_REQUIRED"
44
45
  }
45
46
  export interface GitBuildStatus {
46
47
  completedAt: Date | null;
@@ -137,6 +138,10 @@ export declare enum GitPullRequestMergeableState {
137
138
  UnknownAndBlocked = "UNKNOWN_AND_BLOCKED",
138
139
  Unstable = "UNSTABLE"
139
140
  }
141
+ export interface GitPullRequestPermissions {
142
+ canMerge: boolean;
143
+ canMergeAndBypassProtections: boolean;
144
+ }
140
145
  export interface GitPullRequest {
141
146
  id: string;
142
147
  graphQLId?: string;
@@ -196,6 +201,7 @@ export interface GitPullRequest {
196
201
  mergeableState: GitPullRequestMergeableState;
197
202
  milestone?: GitMilestone | null;
198
203
  labels?: GitLabel[];
204
+ permissions: GitPullRequestPermissions | null;
199
205
  }
200
206
  export interface GitComment {
201
207
  author: Account | User | null;
@@ -51,6 +51,13 @@ export declare enum GitHubPullRequestMergeStateStatus {
51
51
  Unknown = "UNKNOWN",
52
52
  Unstable = "UNSTABLE"
53
53
  }
54
+ export declare enum GitHubRepositoryPermission {
55
+ Admin = "ADMIN",
56
+ Maintain = "MAINTAIN",
57
+ Read = "READ",
58
+ Triage = "TRIAGE",
59
+ Write = "WRITE"
60
+ }
54
61
  export interface GraphQLUser {
55
62
  __typename: 'User';
56
63
  id: string;
@@ -187,6 +194,7 @@ export interface GraphQLPullRequest {
187
194
  };
188
195
  sshUrl: string;
189
196
  url: string;
197
+ viewerPermission: GitHubRepositoryPermission;
190
198
  };
191
199
  reviewRequests: {
192
200
  nodes: {
@@ -208,6 +216,7 @@ export interface GraphQLPullRequest {
208
216
  labels: {
209
217
  nodes: GraphQLLabel[] | null;
210
218
  } | null;
219
+ viewerCanMergeAsAdmin: boolean;
211
220
  }
212
221
  export interface GraphQLIssue {
213
222
  id: string;
package/dist/types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node-fetch" />
2
+ import { type GitPullRequest } from './providers/gitProvider';
2
3
  export type Fetch = typeof import('node-fetch').default;
3
4
  export declare const isFetch: (fetch: Fetch | RequestFunction) => fetch is typeof import("node-fetch").default;
4
5
  export type RequestFunction = <T>(options: RequestOptions) => Promise<Response<T>>;
@@ -78,3 +79,12 @@ export type PagedResult<T> = {
78
79
  };
79
80
  export type FullFieldMap<T> = Record<keyof T, boolean>;
80
81
  export type FieldMap<T> = Partial<FullFieldMap<T>>;
82
+ export type PullRequestBucketID = 'readyToMerge' | 'unassignedReviewers' | 'failingCI' | 'conflicts' | 'needsMyReview' | 'changesRequested' | 'reviewerCommented' | 'waitingForReview' | 'draft' | 'other';
83
+ export interface PullRequestBucket {
84
+ id: PullRequestBucketID;
85
+ faIconName: string;
86
+ name: string;
87
+ priority: number;
88
+ pullRequests: GitPullRequest[];
89
+ }
90
+ export type PullRequestBuckets = Record<PullRequestBucketID, PullRequestBucket>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitkraken/provider-apis",
3
- "version": "0.16.0",
3
+ "version": "0.17.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",
@@ -29,7 +29,6 @@
29
29
  "watch": "yarn clean && node ./scripts/build.mjs --watch & tsc -w"
30
30
  },
31
31
  "dependencies": {
32
- "js-base64": "3.7.5",
33
32
  "node-fetch": "2.7.0"
34
33
  },
35
34
  "devDependencies": {