@gitkraken/provider-apis 0.52.0 → 0.54.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,6 @@
1
1
  import { RefreshTokenResponse } from '../../types/exportedTypes/bitbucket';
2
2
  import { Account, CursorPageInput, GetRepoErrorData, GetRepoInput, GetReposInput, GitMergeStrategy, GitPullRequest, GitPullRequestState, GitRepository, GitRepositoryPermissions, NumberedPageInput, Options, SetAccountInput, SetPullRequestInput } from '../../types/exportedTypes/gitProvider';
3
- import { NumberedPageInfo } from '../../types/exportedTypes/types';
3
+ import { NumberedPageInfo, Result } from '../../types/exportedTypes/types';
4
4
  import { BitbucketRepositoryRole } from '../../types/internalTypes/bitbucket';
5
5
  import { GitProvider } from '../gitProvider';
6
6
  import { Provider } from '../provider';
@@ -159,6 +159,19 @@ export declare class Bitbucket extends Provider implements GitProvider {
159
159
  pageInfo: NumberedPageInfo;
160
160
  data: GitPullRequest[];
161
161
  }>;
162
+ /**
163
+ * Bitbucket Cloud exposes no native workspace-level "PRs where this user is a reviewer" endpoint.
164
+ * This helper provides a workspace-scoped call surface by fanning out the existing repo-scoped
165
+ * reviewer query across either the provided repo subset or every accessible repo in the workspace.
166
+ */
167
+ getPullRequestsForReviewerAndWorkspace(input: {
168
+ reviewerId: string;
169
+ workspaceSlug: string;
170
+ repos?: GetRepoInput[];
171
+ states?: GitPullRequestState[];
172
+ query?: string;
173
+ pageSize?: number;
174
+ }, options?: Options): Promise<Result<GitPullRequest[]>>;
162
175
  private getPullRequestsForRepoBase;
163
176
  getPullRequestsForRepo(input: {
164
177
  repo: GetRepoInput;
@@ -1,6 +1,6 @@
1
1
  import { BitbucketServerMergeStrategy } from '../../types/exportedTypes/bitbucket';
2
2
  import { Account, EnterpriseOptions, GetRepoErrorData, GetRepoInput, GetReposInput, GitPullRequest, GitPullRequestState, GitRepository, NumberedPageInput, Options, SetPullRequestInput, User } from '../../types/exportedTypes/gitProvider';
3
- import { Result } from '../../types/exportedTypes/types';
3
+ import { NumberedPageInfo, Result } from '../../types/exportedTypes/types';
4
4
  import { BitbucketServerPullRequest } from '../../types/internalTypes/bitbucketServer';
5
5
  import { GitProvider } from '../gitProvider';
6
6
  import { EnterpriseProvider } from '../provider';
@@ -58,11 +58,7 @@ export declare class BitbucketServer extends EnterpriseProvider implements GitPr
58
58
  reviewerLogin?: string;
59
59
  states?: GitPullRequestState[];
60
60
  } & NumberedPageInput, options?: EnterpriseOptions): Promise<{
61
- pageInfo: {
62
- hasNextPage: boolean;
63
- nextPage: number | null;
64
- currentPage: number | null;
65
- };
61
+ pageInfo: NumberedPageInfo;
66
62
  data: GitPullRequest[];
67
63
  }>;
68
64
  getPullRequestsForRepos(input: {
@@ -78,11 +74,7 @@ export declare class BitbucketServer extends EnterpriseProvider implements GitPr
78
74
  reviewerLogin?: string;
79
75
  states?: GitPullRequestState[];
80
76
  } & NumberedPageInput, options?: EnterpriseOptions): Promise<{
81
- pageInfo: {
82
- hasNextPage: boolean;
83
- nextPage: number | null;
84
- currentPage: number | null;
85
- };
77
+ pageInfo: NumberedPageInfo;
86
78
  data: GitPullRequest[];
87
79
  }>;
88
80
  closePullRequest(input: {
@@ -233,6 +233,7 @@ export declare class GitHub extends EnterpriseProvider implements GitProvider, I
233
233
  endCursor: string | null;
234
234
  };
235
235
  data: GitPullRequest[];
236
+ metadata: import("../../types/exportedTypes/types").CollectionMetadata | undefined;
236
237
  }>;
237
238
  searchIssues(input: {
238
239
  query: string;
@@ -245,6 +246,7 @@ export declare class GitHub extends EnterpriseProvider implements GitProvider, I
245
246
  endCursor: string | null;
246
247
  };
247
248
  data: Issue[];
249
+ metadata: import("../../types/exportedTypes/types").CollectionMetadata | undefined;
248
250
  }>;
249
251
  /**
250
252
  * Returns pull requests that were created by, are assigned to, or have been requested to be reviewed by the user.
@@ -255,12 +257,14 @@ export declare class GitHub extends EnterpriseProvider implements GitProvider, I
255
257
  includeFromArchivedRepos?: boolean;
256
258
  labelNames?: string[];
257
259
  maxPageSize?: number;
260
+ states?: GitPullRequestState[];
258
261
  } & CursorPageInput, options?: EnterpriseOptions): Promise<{
259
262
  pageInfo: {
260
263
  hasNextPage: boolean;
261
264
  endCursor: string | null;
262
265
  };
263
266
  data: GitPullRequest[];
267
+ metadata: import("../../types/exportedTypes/types").CollectionMetadata | undefined;
264
268
  }>;
265
269
  getPullRequestsForRepos(input: FetchPullRequestsData & CursorPageInput, options?: EnterpriseOptions): Promise<{
266
270
  pageInfo: {
@@ -268,6 +272,7 @@ export declare class GitHub extends EnterpriseProvider implements GitProvider, I
268
272
  endCursor: string | null;
269
273
  };
270
274
  data: GitPullRequest[];
275
+ metadata: import("../../types/exportedTypes/types").CollectionMetadata | undefined;
271
276
  }>;
272
277
  getPullRequestForRepo(input: {
273
278
  repo: GetRepoInput;
@@ -400,12 +405,14 @@ export declare class GitHub extends EnterpriseProvider implements GitProvider, I
400
405
  includeFromArchivedRepos?: boolean;
401
406
  maxPageSize?: number;
402
407
  labelNames?: string[];
408
+ states?: GitIssueState[];
403
409
  } & CursorPageInput, options?: EnterpriseOptions): Promise<{
404
410
  pageInfo: {
405
411
  hasNextPage: boolean;
406
412
  endCursor: string;
407
413
  };
408
414
  data: Issue[];
415
+ metadata: import("../../types/exportedTypes/types").CollectionMetadata | undefined;
409
416
  }>;
410
417
  setPullRequestLabels(input: {
411
418
  pullRequest: SetPullRequestInput;
@@ -417,6 +424,7 @@ export declare class GitHub extends EnterpriseProvider implements GitProvider, I
417
424
  endCursor: string | null;
418
425
  };
419
426
  data: Issue[];
427
+ metadata: import("../../types/exportedTypes/types").CollectionMetadata | undefined;
420
428
  }>;
421
429
  closeIssueWithReason(input: {
422
430
  issue: SetIssueInput;
@@ -12,7 +12,7 @@ export declare const minimumFeatureVersions: {
12
12
  PR_REVIEW_FULL_DATABASE_ID: number[];
13
13
  PR_REVIEW_COMMENT_FULL_DATABASE_ID: number[];
14
14
  };
15
- export declare const MAX_PR_PAGE_SIZE = 15;
15
+ export declare const MAX_PR_PAGE_SIZE = 100;
16
16
  export declare const MAX_ISSUE_PAGE_SIZE = 100;
17
17
  type MinimumFeatureVersions = typeof minimumFeatureVersions;
18
18
  export declare const GHOST_AUTHOR: GraphQLUser;
@@ -1,7 +1,7 @@
1
1
  import { Account, AddInlineCommentInput, CursorPageInput, DeleteCommentInput, EditCommentInput, EnterpriseOptions, GetMergeBaseInput, GetPullRequestDescriptionInput, GetRepoErrorData, GetRepoInput, GetReposInput, GitComment, GitLabel, GitMergeStrategy, GitPullRequest, GitPullRequestReview, GitPullRequestState, GitRepository, GitTreeItem, NumberedPageInput, PullRequestDescription, ResolveReviewThreadInput, SetAccountInput, SetLabelInput, SetMilestoneInput, SetPullRequestDescriptionInput, SetPullRequestInput } from '../../types/exportedTypes/gitProvider';
2
2
  import { GitLabGetIssueInput, PullRequestAssociation } from '../../types/exportedTypes/gitlab';
3
- import { GitIssueState, Issue, SetIssueInput } from '../../types/exportedTypes/issueProvider';
4
- import { NumberedPageInfo, Result } from '../../types/exportedTypes/types';
3
+ import { GetIssuesForCurrentUserInput, GitIssueState, Issue, SetIssueInput } from '../../types/exportedTypes/issueProvider';
4
+ import { NumberedPageInfo, PagedResult, Result } from '../../types/exportedTypes/types';
5
5
  import { GitProvider } from '../gitProvider';
6
6
  import { IssueProvider } from '../issueProvider';
7
7
  import { EnterpriseProvider } from '../provider';
@@ -154,6 +154,7 @@ export declare class GitLab extends EnterpriseProvider implements GitProvider, I
154
154
  includeFromArchivedRepos?: boolean;
155
155
  labelNames?: string[];
156
156
  repos?: GetRepoInput[];
157
+ states?: GitPullRequestState[];
157
158
  } & CursorPageInput, options?: EnterpriseOptions): Promise<{
158
159
  pageInfo: {
159
160
  hasNextPage: false;
@@ -273,6 +274,20 @@ export declare class GitLab extends EnterpriseProvider implements GitProvider, I
273
274
  };
274
275
  data: Issue[];
275
276
  }>;
277
+ /**
278
+ * Account-wide "my issues" read via REST `GET /issues` (GitLab's GraphQL API has no top-level, cross-project
279
+ * issue field, so this is the only account-wide issue endpoint). Open issues only (`state=opened`).
280
+ *
281
+ * `scope` controls breadth: `assigned_to_me` returns issues assigned to the token's user (GitLab scopes to the
282
+ * current user server-side, no username needed); `all` returns every issue visible to the user and is combined
283
+ * with `assigneeUsername` and/or `authorUsername` to narrow the read.
284
+ * Without `scope`, GitLab defaults to `created_by_me`, which is too narrow for a "my issues" read.
285
+ * GitLab's REST endpoint has no first-class mention filter here, so mentions are intentionally unsupported rather
286
+ * than approximated via search.
287
+ *
288
+ * Numbered pagination (`page`/`per_page` + the `x-next-page` header); one page per call — follow `pageInfo`.
289
+ */
290
+ getIssuesForCurrentUser(input?: GetIssuesForCurrentUserInput, options?: EnterpriseOptions): Promise<PagedResult<Issue>>;
276
291
  private setIssueState;
277
292
  closeIssue(input: {
278
293
  issue: SetIssueInput;
@@ -1,8 +1,9 @@
1
1
  import { GetRepoInput, Options, SetAccountInput, SetLabelInput, SetMilestoneInput } from '../types/exportedTypes/gitProvider';
2
- import { GetIssueInput, GetIssuesForReposInput, Issue, SetIssueInput, SetStatusInput } from '../types/exportedTypes/issueProvider';
2
+ import { GetIssueInput, GetIssuesForCurrentUserInput, GetIssuesForReposInput, Issue, SetIssueInput, SetStatusInput } from '../types/exportedTypes/issueProvider';
3
3
  import { PagedResult, Result } from '../types/exportedTypes/types';
4
4
  export interface IssueProvider {
5
5
  getIssue?(input: GetIssueInput, options: Options): Promise<Result<Issue>>;
6
+ getIssuesForCurrentUser?(input: GetIssuesForCurrentUserInput, options: Options): Promise<PagedResult<Issue>>;
6
7
  getIssuesForRepo?(input: {
7
8
  repo: GetRepoInput;
8
9
  }, options: Options): Promise<PagedResult<Issue>>;
@@ -349,6 +349,12 @@ export interface CursorPageInput {
349
349
  cursor?: string | null;
350
350
  }
351
351
  export interface NumberedPageInput {
352
+ /**
353
+ * The 1-based page number to request. Numbered-page providers translate this to their native
354
+ * pagination unit where needed (for example Bitbucket Server's `start` offset). Note that some
355
+ * Bitbucket Server endpoints still consume `page` as a raw `start` offset and have not yet been
356
+ * migrated to this contract.
357
+ */
352
358
  page?: number | null;
353
359
  /**
354
360
  * The number of items to request per page. Honored by all numbered-page providers (Bitbucket,
@@ -1,4 +1,4 @@
1
- import { Account, GetReposInput, GitLabel, GitMilestone } from './gitProvider';
1
+ import { Account, CursorPageInput, GetReposInput, GitLabel, GitMilestone, NumberedPageInput } from './gitProvider';
2
2
  export declare enum GitIssueState {
3
3
  Open = "OPEN",
4
4
  Closed = "CLOSED"
@@ -13,6 +13,11 @@ export interface GetIssueInput {
13
13
  export type GetIssuesForReposInput = GetReposInput | {
14
14
  repoIds: (string | number)[];
15
15
  };
16
+ export interface GetIssuesForCurrentUserInput extends CursorPageInput, NumberedPageInput {
17
+ scope?: 'assigned_to_me' | 'all';
18
+ assigneeUsername?: string;
19
+ authorUsername?: string;
20
+ }
16
21
  export interface IssueTransition {
17
22
  id: string;
18
23
  name: string;
package/dist/utils.d.ts CHANGED
@@ -63,11 +63,17 @@ export interface CollectAcrossScopesResult<S, R> {
63
63
  * and is returned in `successes` for the caller to shape into its own data type.
64
64
  *
65
65
  * An empty `scopes` list yields `complete` metadata with no failures.
66
+ *
67
+ * By default every scope runs concurrently (`Promise.all`). Pass `concurrency` to cap the number of
68
+ * in-flight `run` calls via `runInParallelBatches`, which avoids thundering-herd rate limiting when a
69
+ * caller fans out over a large scope list (a workspace's repos, projects, or resources). Scope order
70
+ * in `successes` is preserved either way. A `concurrency` that isn't a positive integer throws.
66
71
  */
67
- export declare function collectAcrossScopes<S, R>(scopes: S[], { run, failureScope, completeness, }: {
72
+ export declare function collectAcrossScopes<S, R>(scopes: S[], { run, failureScope, completeness, concurrency, }: {
68
73
  run: (scope: S) => Promise<R | undefined>;
69
74
  failureScope: (scope: S) => CollectionScope;
70
75
  completeness?: (result: Exclude<R, undefined>) => CollectionCompleteness;
76
+ concurrency?: number;
71
77
  }): Promise<CollectAcrossScopesResult<S, R>>;
72
78
  export declare function getSettledValue<T>(promise: PromiseSettledResult<Awaited<T | undefined>>): T | undefined;
73
79
  export declare function getSettledValue<T>(promise: PromiseSettledResult<Awaited<T | undefined>> | undefined, defaultValue: NonNullable<T>): NonNullable<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitkraken/provider-apis",
3
- "version": "0.52.0",
3
+ "version": "0.54.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",