@gitkraken/provider-apis 0.19.1 → 0.21.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.
Files changed (58) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/dist/defaults.d.ts +1 -1
  3. package/dist/fetchWrapper.d.ts +1 -1
  4. package/dist/index.d.ts +14 -14
  5. package/dist/index.js +153 -184
  6. package/dist/providerUtils/azureDevops.d.ts +2 -2
  7. package/dist/providerUtils/bitbucket.d.ts +2 -2
  8. package/dist/providerUtils/bitbucketServer.d.ts +2 -2
  9. package/dist/providerUtils/entityIdentifiers/entityIdentifier.d.ts +5 -0
  10. package/dist/providerUtils/entityIdentifiers/providerEntityIdentifiers/azureDevopsIssueEntityIdentifier.d.ts +9 -0
  11. package/dist/providerUtils/entityIdentifiers/providerEntityIdentifiers/azureDevopsPullRequestEntityIdentifier.d.ts +9 -0
  12. package/dist/providerUtils/entityIdentifiers/providerEntityIdentifiers/bitbucketIssueEntityIdentifier.d.ts +9 -0
  13. package/dist/providerUtils/entityIdentifiers/providerEntityIdentifiers/bitbucketPullRequestEntityIdentifier.d.ts +9 -0
  14. package/dist/providerUtils/entityIdentifiers/providerEntityIdentifiers/githubIssueEntityIdentifier.d.ts +9 -0
  15. package/dist/providerUtils/entityIdentifiers/providerEntityIdentifiers/githubPullRequestEntityIdentifier.d.ts +9 -0
  16. package/dist/providerUtils/entityIdentifiers/providerEntityIdentifiers/gitlabIssueEntityIdentifier.d.ts +9 -0
  17. package/dist/providerUtils/entityIdentifiers/providerEntityIdentifiers/gitlabPullRequestEntityIdentifier.d.ts +9 -0
  18. package/dist/providerUtils/entityIdentifiers/providerEntityIdentifiers/jiraIssueEntityIdentifier.d.ts +9 -0
  19. package/dist/providerUtils/entityIdentifiers/providerEntityIdentifiers/trelloIssueEntityIdentifier.d.ts +9 -0
  20. package/dist/providerUtils/gitProvider.d.ts +20 -3
  21. package/dist/providerUtils/github.d.ts +0 -2
  22. package/dist/providerUtils/gitlab.d.ts +2 -2
  23. package/dist/providerUtils/jira.d.ts +2 -2
  24. package/dist/providerUtils/shared.d.ts +1 -1
  25. package/dist/providerUtils/trello.d.ts +2 -1
  26. package/dist/providers/azureDevops/azureDevOps.d.ts +7 -53
  27. package/dist/providers/azureDevops/azureDevOpsHelpers.d.ts +3 -3
  28. package/dist/providers/bitbucket/bitbucket.d.ts +4 -11
  29. package/dist/providers/bitbucket/bitbucketHelpers.d.ts +2 -2
  30. package/dist/providers/bitbucketServer/bitbucketServer.d.ts +4 -4
  31. package/dist/providers/gitProvider.d.ts +3 -306
  32. package/dist/providers/github/github.d.ts +5 -3
  33. package/dist/providers/github/githubHelpers.d.ts +3 -3
  34. package/dist/providers/gitlab/gitlab.d.ts +6 -15
  35. package/dist/providers/gitlab/gitlabHelpers.d.ts +3 -3
  36. package/dist/providers/issueProvider.d.ts +3 -91
  37. package/dist/providers/jira/jira.d.ts +9 -24
  38. package/dist/providers/jira/{sharedHelpers.d.ts → jiraHelpers.d.ts} +5 -4
  39. package/dist/providers/{jiraServer → jira}/jiraServer.d.ts +8 -11
  40. package/dist/providers/provider.d.ts +1 -1
  41. package/dist/providers/trello/trello.d.ts +5 -26
  42. package/dist/types/exportedTypes/azureDevOps.d.ts +100 -0
  43. package/dist/types/exportedTypes/bitbucket.d.ts +15 -0
  44. package/dist/types/exportedTypes/gitProvider.d.ts +301 -0
  45. package/dist/types/exportedTypes/github.d.ts +23 -0
  46. package/dist/types/exportedTypes/gitlab.d.ts +7 -0
  47. package/dist/types/exportedTypes/issueProvider.d.ts +90 -0
  48. package/dist/types/exportedTypes/jira.d.ts +58 -0
  49. package/dist/types/exportedTypes/trello.d.ts +22 -0
  50. package/dist/{types.d.ts → types/exportedTypes/types.d.ts} +81 -3
  51. package/dist/{providers/azureDevops/azureDevOpsTypes.d.ts → types/internalTypes/azureDevOps.d.ts} +0 -51
  52. package/dist/{providers/bitbucketServer/bitbucketServerTypes.d.ts → types/internalTypes/bitbucketServer.d.ts} +0 -7
  53. package/dist/{providers/github/githubTypes.d.ts → types/internalTypes/github.d.ts} +0 -23
  54. package/dist/{providers/jira/sharedTypes.d.ts → types/internalTypes/jira.d.ts} +1 -38
  55. package/dist/utils.d.ts +3 -3
  56. package/package.json +1 -1
  57. /package/dist/{providers/bitbucket/bitbucketTypes.d.ts → types/internalTypes/bitbucket.d.ts} +0 -0
  58. /package/dist/{providers/gitlab/gitlabTypes.d.ts → types/internalTypes/gitlab.d.ts} +0 -0
@@ -1,2 +1,2 @@
1
- export declare const getIssueUniqueId: (organizationName: string, projectId: string, issueId: string, domain?: string) => string;
2
- export declare const getPullRequestUniqueId: (organizationName: string, projectId: string, repoId: string, pullRequestId: string, domain?: string) => string;
1
+ declare const _default: {};
2
+ export default _default;
@@ -1,2 +1,2 @@
1
- export declare const getIssueUniqueId: (repoId: string, issueId: string) => string;
2
- export declare const getPullRequestUniqueId: (repoId: string, pullRequestId: string) => string;
1
+ declare const _default: {};
2
+ export default _default;
@@ -1,2 +1,2 @@
1
- export declare const getIssueUniqueId: (repoId: string, issueId: string, domain: string) => string;
2
- export declare const getPullRequestUniqueId: (repoId: string, pullRequestId: string, domain: string) => string;
1
+ declare const _default: {};
2
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { EntityIdentifier, EntityIdentifierProviderType, EntityType } from '../../types/exportedTypes/types';
2
+ export declare const validate: (entityIdentifier: EntityIdentifier) => void;
3
+ export declare const encode: (entityIdentifier: EntityIdentifier) => string;
4
+ export declare const decode: (entityID: string) => EntityIdentifier;
5
+ export declare const decodeV0: (provider: EntityIdentifierProviderType, entityType: EntityType, entityID: string) => EntityIdentifier;
@@ -0,0 +1,9 @@
1
+ import { EntityIdentifier, EntityIdentifierInterface } from '../../../types/exportedTypes/types';
2
+ type AzureIssueEntityIdentifierInput = Pick<EntityIdentifier, 'organizationName' | 'projectId' | 'entityId' | 'domain'>;
3
+ export declare class AzureDevopsIssueEntityIdentifier implements EntityIdentifierInterface {
4
+ constructor();
5
+ validate(entityIdentifier: AzureIssueEntityIdentifierInput): void;
6
+ encode(entityIdentifier: AzureIssueEntityIdentifierInput): string;
7
+ decode(entityFields: string[]): EntityIdentifier;
8
+ }
9
+ export {};
@@ -0,0 +1,9 @@
1
+ import { EntityIdentifier, EntityIdentifierInterface } from '../../../types/exportedTypes/types';
2
+ type AzurePullRequestEntityIdentifierInput = Pick<EntityIdentifier, 'organizationName' | 'projectId' | 'repoId' | 'entityId' | 'domain'>;
3
+ export declare class AzureDevopsPullRequestEntityIdentifier implements EntityIdentifierInterface {
4
+ constructor();
5
+ validate(entityIdentifier: AzurePullRequestEntityIdentifierInput): void;
6
+ encode(entityIdentifier: AzurePullRequestEntityIdentifierInput): string;
7
+ decode(entityFields: string[]): EntityIdentifier;
8
+ }
9
+ export {};
@@ -0,0 +1,9 @@
1
+ import { EntityIdentifier, EntityIdentifierInterface } from '../../../types/exportedTypes/types';
2
+ type BitbucketIssueEntityIdentifierInput = Pick<EntityIdentifier, 'repoId' | 'entityId' | 'domain'>;
3
+ export declare class BitbucketIssueEntityIdentifier implements EntityIdentifierInterface {
4
+ constructor();
5
+ validate(entityIdentifier: BitbucketIssueEntityIdentifierInput): void;
6
+ encode(entityIdentifier: BitbucketIssueEntityIdentifierInput): string;
7
+ decode(entityFields: string[]): EntityIdentifier;
8
+ }
9
+ export {};
@@ -0,0 +1,9 @@
1
+ import { EntityIdentifier, EntityIdentifierInterface } from '../../../types/exportedTypes/types';
2
+ type BitbucketPullRequestEntityIdentifierInput = Pick<EntityIdentifier, 'repoId' | 'entityId' | 'domain'>;
3
+ export declare class BitbucketPullRequestEntityIdentifier implements EntityIdentifierInterface {
4
+ constructor();
5
+ validate(entityIdentifier: BitbucketPullRequestEntityIdentifierInput): void;
6
+ encode(entityIdentifier: BitbucketPullRequestEntityIdentifierInput): string;
7
+ decode(entityFields: string[]): EntityIdentifier;
8
+ }
9
+ export {};
@@ -0,0 +1,9 @@
1
+ import { EntityIdentifier, EntityIdentifierInterface } from '../../../types/exportedTypes/types';
2
+ type GithubIssueEntityIdentifierInput = Pick<EntityIdentifier, 'entityId' | 'domain'>;
3
+ export declare class GithubIssueEntityIdentifier implements EntityIdentifierInterface {
4
+ constructor();
5
+ validate(entityIdentifier: GithubIssueEntityIdentifierInput): void;
6
+ encode(entityIdentifier: GithubIssueEntityIdentifierInput): string;
7
+ decode(entityFields: string[]): EntityIdentifier;
8
+ }
9
+ export {};
@@ -0,0 +1,9 @@
1
+ import { EntityIdentifier, EntityIdentifierInterface } from '../../../types/exportedTypes/types';
2
+ type GithubPullRequestEntityIdentifierInput = Pick<EntityIdentifier, 'entityId' | 'domain'>;
3
+ export declare class GithubPullRequestEntityIdentifier implements EntityIdentifierInterface {
4
+ constructor();
5
+ validate(entityIdentifier: GithubPullRequestEntityIdentifierInput): void;
6
+ encode(entityIdentifier: GithubPullRequestEntityIdentifierInput): string;
7
+ decode(entityFields: string[]): EntityIdentifier;
8
+ }
9
+ export {};
@@ -0,0 +1,9 @@
1
+ import { EntityIdentifier, EntityIdentifierInterface } from '../../../types/exportedTypes/types';
2
+ type GitlabIssueEntityIdentifierInput = Pick<EntityIdentifier, 'entityId' | 'domain'>;
3
+ export declare class GitlabIssueEntityIdentifier implements EntityIdentifierInterface {
4
+ constructor();
5
+ validate(entityIdentifier: GitlabIssueEntityIdentifierInput): void;
6
+ encode(entityIdentifier: GitlabIssueEntityIdentifierInput): string;
7
+ decode(entityFields: string[]): EntityIdentifier;
8
+ }
9
+ export {};
@@ -0,0 +1,9 @@
1
+ import { EntityIdentifier, EntityIdentifierInterface } from '../../../types/exportedTypes/types';
2
+ type GitlabPullRequestEntityIdentifierInput = Pick<EntityIdentifier, 'entityId' | 'domain'>;
3
+ export declare class GitlabPullRequestEntityIdentifier implements EntityIdentifierInterface {
4
+ constructor();
5
+ validate(entityIdentifier: GitlabPullRequestEntityIdentifierInput): void;
6
+ encode(entityIdentifier: GitlabPullRequestEntityIdentifierInput): string;
7
+ decode(entityFields: string[]): EntityIdentifier;
8
+ }
9
+ export {};
@@ -0,0 +1,9 @@
1
+ import { EntityIdentifier, EntityIdentifierInterface } from '../../../types/exportedTypes/types';
2
+ type JiraIssueEntityIdentifierInput = Pick<EntityIdentifier, 'resourceId' | 'projectId' | 'entityId' | 'domain'>;
3
+ export declare class JiraIssueEntityIdentifier implements EntityIdentifierInterface {
4
+ constructor();
5
+ validate(entityIdentifier: JiraIssueEntityIdentifierInput): void;
6
+ encode(entityIdentifier: JiraIssueEntityIdentifierInput): string;
7
+ decode(entityFields: string[]): EntityIdentifier;
8
+ }
9
+ export {};
@@ -0,0 +1,9 @@
1
+ import { EntityIdentifier, EntityIdentifierInterface } from '../../../types/exportedTypes/types';
2
+ type TrelloIssueEntityIdentifierInput = Pick<EntityIdentifier, 'accountOrOrgId' | 'projectId' | 'entityId' | 'domain'>;
3
+ export declare class TrelloIssueEntityIdentifier implements EntityIdentifierInterface {
4
+ constructor();
5
+ validate(entityIdentifier: TrelloIssueEntityIdentifierInput): void;
6
+ encode(entityIdentifier: TrelloIssueEntityIdentifierInput): string;
7
+ decode(entityFields: string[]): EntityIdentifier;
8
+ }
9
+ export {};
@@ -1,5 +1,6 @@
1
- import { type Account, type GitPullRequest } from '../providers/gitProvider';
2
- import type { PullRequestBuckets } from '../types';
1
+ import { type Account } from '../types/exportedTypes/gitProvider';
2
+ import type { ActionablePullRequest, EnrichedItemsByUniqueId, PullRequestBuckets, PullRequestWithUniqueID } from '../types/exportedTypes/types';
3
+ export declare const PINNED_BUCKET_ID = "pinned";
3
4
  export declare const READY_TO_MERGE_BUCKET_ID = "readyToMerge";
4
5
  export declare const UNASSIGNED_REVIEWERS_BUCKET_ID = "unassignedReviewers";
5
6
  export declare const FAILING_CI_BUCKET_ID = "failingCI";
@@ -10,4 +11,20 @@ export declare const REVIEWER_COMMENTED_BUCKET_ID = "reviewerCommented";
10
11
  export declare const WAITING_FOR_REVIEW_BUCKET_ID = "waitingForReview";
11
12
  export declare const DRAFT_BUCKET_ID = "draft";
12
13
  export declare const OTHER_BUCKET_ID = "other";
13
- export declare const groupPullRequestsIntoBuckets: (pullRequests: GitPullRequest[], currentUser: Pick<Account, 'id'>) => PullRequestBuckets;
14
+ export declare const SNOOZED_BUCKET_ID = "snoozed";
15
+ export declare const READY_TO_MERGE_ACTION_CATEGORY = "readyToMerge";
16
+ export declare const UNASSIGNED_REVIEWERS_ACTION_CATEGORY = "unassignedReviewers";
17
+ export declare const FAILING_CI_ACTION_CATEGORY = "failingCI";
18
+ export declare const CONFLICTS_ACTION_CATEGORY = "conflicts";
19
+ export declare const NEEDS_MY_REVIEW_ACTION_CATEGORY = "needsMyReview";
20
+ export declare const CHANGES_REQUESTED_ACTION_CATEGORY = "changesRequested";
21
+ export declare const REVIEWER_COMMENTED_ACTION_CATEGORY = "reviewerCommented";
22
+ export declare const WAITING_FOR_REVIEW_ACTION_CATEGORY = "waitingForReview";
23
+ export declare const DRAFT_ACTION_CATEGORY = "draft";
24
+ export declare const OTHER_ACTION_CATEGORY = "other";
25
+ export declare const getActionablePullRequests: (pullRequests: PullRequestWithUniqueID[], currentUser: Pick<Account, 'id'>, options?: {
26
+ enrichedItemsByUniqueId?: EnrichedItemsByUniqueId;
27
+ }) => ActionablePullRequest[];
28
+ export declare const groupPullRequestsIntoBuckets: (pullRequests: PullRequestWithUniqueID[], currentUser: Pick<Account, 'id'>, options?: {
29
+ enrichedItemsByUniqueId?: EnrichedItemsByUniqueId;
30
+ }) => PullRequestBuckets;
@@ -1,4 +1,2 @@
1
1
  import { GitPullRequest } from '../index';
2
- export declare const getIssueUniqueId: (issueGraphqlId: string, domain?: string) => string;
3
- export declare const getPullRequestUniqueId: (pullRequestGraphqlId: string, domain?: string) => string;
4
2
  export declare const getPullRequestRank: (pr: GitPullRequest, currentUsersGithubDatabaseId: string, isFromMentionedFilter: boolean) => number;
@@ -1,2 +1,2 @@
1
- export declare const getIssueUniqueId: (issueGraphqlId: string, domain?: string) => string;
2
- export declare const getPullRequestUniqueId: (pullRequestGraphqlId: string, domain?: string) => string;
1
+ declare const _default: {};
2
+ export default _default;
@@ -1,2 +1,2 @@
1
- export declare const getIssueUniqueId: (resourceId: string, projectId: string, issueId: string) => string;
2
- export declare const getJiraServerIssueUniqueId: (projectId: string, issueId: string, domain: string) => string;
1
+ declare const _default: {};
2
+ export default _default;
@@ -1,4 +1,4 @@
1
- import { GitPullRequestReviewState } from '../providers/gitProvider';
1
+ import { GitPullRequestReviewState } from '../types/exportedTypes/gitProvider';
2
2
  export declare const summarizeReviewDecision: (reviews: {
3
3
  state: GitPullRequestReviewState;
4
4
  }[] | null) => GitPullRequestReviewState | null;
@@ -1 +1,2 @@
1
- export declare const getIssueUniqueId: (accountOrOrgId: string, projectId: string, issueId: string, domain?: string) => string;
1
+ declare const _default: {};
2
+ export default _default;
@@ -1,55 +1,10 @@
1
- import { PagedResult, Result } from '../../types';
2
- import { CursorPageInput, EnterpriseOptions, GetRepoErrorData, GetRepoInput, GitMergeStrategy, GitProvider, GitPullRequest, GitRepository, NumberedPageInput, Options, SetAccountInput, SetLabelInput, SetPullRequestInput } from '../gitProvider';
3
- import { Issue, IssueProvider, SetIssueInput, SetStatusInput } from '../issueProvider';
1
+ import { AzureGetRepoInput, AzureGetReposInput, AzureGraphAccount, AzureOrganization, AzureProject, AzureSetAccountInput, AzureSetIssueInput, AzureSetPullRequestInput, PullRequestAsyncStatus, StatusByWorkItemIdByStatusId, WorkItemType } from '../../types/exportedTypes/azureDevOps';
2
+ import { CursorPageInput, EnterpriseOptions, GetRepoErrorData, GetRepoInput, GetReposInput, GitMergeStrategy, GitPullRequest, GitRepository, NumberedPageInput, Options, SetAccountInput, SetLabelInput, SetPullRequestInput } from '../../types/exportedTypes/gitProvider';
3
+ import { Issue, SetStatusInput } from '../../types/exportedTypes/issueProvider';
4
+ import { PagedResult, Result } from '../../types/exportedTypes/types';
5
+ import { GitProvider } from '../gitProvider';
6
+ import { IssueProvider } from '../issueProvider';
4
7
  import { Provider } from '../provider';
5
- import { AzureGraphAccount, PullRequestAsyncStatus, WorkItemType } from './azureDevOpsTypes';
6
- export interface AzureDevOpsProject {
7
- namespace: string;
8
- name: string;
9
- }
10
- export interface AzureGetRepoInput extends GetRepoInput {
11
- project: string;
12
- }
13
- export interface AzureGetReposInput {
14
- namespace: string;
15
- project: string;
16
- }
17
- export interface AzureSetAccountInput extends SetAccountInput {
18
- name: string;
19
- }
20
- export interface AzureSetIssueInput extends SetIssueInput {
21
- project: {
22
- namespace: string;
23
- resourceId: null;
24
- name: string;
25
- };
26
- }
27
- export interface AzureSetPullRequestInput extends SetPullRequestInput {
28
- repository: {
29
- id: string;
30
- name: string;
31
- project: string;
32
- owner: {
33
- login: string;
34
- };
35
- };
36
- }
37
- export interface AzureProject {
38
- id: string;
39
- name: string;
40
- namespace: string;
41
- }
42
- export interface AzureOrganization {
43
- id: string;
44
- name: string;
45
- }
46
- export type StatusByWorkItemIdByStatusId = {
47
- [workItemType: string]: {
48
- [statusId: string]: {
49
- title: string;
50
- };
51
- };
52
- };
53
8
  export declare class AzureDevOps extends Provider implements GitProvider, IssueProvider {
54
9
  /** Note: PATs are not supported for this function, only OAuth tokens are. */
55
10
  getCurrentUser(input?: Record<string, never>, options?: EnterpriseOptions): Promise<{
@@ -194,10 +149,9 @@ export declare class AzureDevOps extends Provider implements GitProvider, IssueP
194
149
  data: GitPullRequest[];
195
150
  }>;
196
151
  getPullRequestsForRepos(input: {
197
- repos: GetRepoInput[];
198
152
  assigneeLogins?: string[];
199
153
  authorLogin?: string;
200
- }, options?: EnterpriseOptions): Promise<{
154
+ } & GetReposInput, options?: EnterpriseOptions): Promise<{
201
155
  data: GitPullRequest[];
202
156
  }>;
203
157
  private getPullRequestsForProjectBase;
@@ -1,5 +1,5 @@
1
- import { ProviderConfig } from '../../types';
2
- import { Options } from '../gitProvider';
3
- import { AzurePullRequest } from './azureDevOpsTypes';
1
+ import { Options } from '../../types/exportedTypes/gitProvider';
2
+ import { ProviderConfig } from '../../types/exportedTypes/types';
3
+ import { AzurePullRequest } from '../../types/internalTypes/azureDevOps';
4
4
  export declare const getAzureRequestHeaders: (config: ProviderConfig, options?: Options) => Record<string, string>;
5
5
  export declare const getPullRequestUrl: (pullRequest: AzurePullRequest) => string;
@@ -1,13 +1,7 @@
1
- import { Account, CursorPageInput, GetRepoErrorData, GetRepoInput, GitMergeStrategy, GitProvider, GitPullRequest, GitRepository, NumberedPageInput, Options, SetAccountInput, SetPullRequestInput } from '../gitProvider';
1
+ import { RefreshTokenResponse } from '../../types/exportedTypes/bitbucket';
2
+ import { Account, CursorPageInput, GetRepoErrorData, GetRepoInput, GetReposInput, GitMergeStrategy, GitPullRequest, GitRepository, NumberedPageInput, Options, SetAccountInput, SetPullRequestInput } from '../../types/exportedTypes/gitProvider';
3
+ import { GitProvider } from '../gitProvider';
2
4
  import { Provider } from '../provider';
3
- export interface RefreshTokenResponse {
4
- access_token: string;
5
- scopes: string;
6
- token_type: string;
7
- expires_in: number;
8
- state: string;
9
- refresh_token: string;
10
- }
11
5
  export declare class Bitbucket extends Provider implements GitProvider {
12
6
  refreshToken(data: {
13
7
  refreshToken: string;
@@ -95,9 +89,8 @@ export declare class Bitbucket extends Provider implements GitProvider {
95
89
  data: GitPullRequest[];
96
90
  }>;
97
91
  getPullRequestsForRepos(input: {
98
- repos: GetRepoInput[];
99
92
  authorLogin?: string;
100
- }, options?: Options): Promise<{
93
+ } & GetReposInput, options?: Options): Promise<{
101
94
  data: GitPullRequest[];
102
95
  }>;
103
96
  closePullRequest(input: {
@@ -1,3 +1,3 @@
1
- import { ProviderConfig } from '../../types';
2
- import { Options } from '../gitProvider';
1
+ import { Options } from '../../types/exportedTypes/gitProvider';
2
+ import { ProviderConfig } from '../../types/exportedTypes/types';
3
3
  export declare const getBitbucketRequestHeaders: (config: ProviderConfig, options?: Options) => Record<string, string>;
@@ -1,6 +1,7 @@
1
- import { Account, EnterpriseOptions, GetRepoErrorData, GetRepoInput, GitProvider, GitPullRequest, GitRepository, NumberedPageInput, SetPullRequestInput } from '../gitProvider';
1
+ import { BitbucketServerMergeStrategy } from '../../types/exportedTypes/bitbucket';
2
+ import { Account, EnterpriseOptions, GetRepoErrorData, GetRepoInput, GetReposInput, GitPullRequest, GitRepository, NumberedPageInput, SetPullRequestInput } from '../../types/exportedTypes/gitProvider';
3
+ import { GitProvider } from '../gitProvider';
2
4
  import { EnterpriseProvider } from '../provider';
3
- import { BitbucketServerMergeStrategy } from './bitbucketServerTypes';
4
5
  export declare class BitbucketServer extends EnterpriseProvider implements GitProvider {
5
6
  private getBaseUrl;
6
7
  private getRequestHeaders;
@@ -33,9 +34,8 @@ export declare class BitbucketServer extends EnterpriseProvider implements GitPr
33
34
  data: GitPullRequest[];
34
35
  }>;
35
36
  getPullRequestsForRepos(input: {
36
- repos: GetRepoInput[];
37
37
  authorLogin?: string;
38
- }, options?: EnterpriseOptions): Promise<{
38
+ } & GetReposInput, options?: EnterpriseOptions): Promise<{
39
39
  data: GitPullRequest[];
40
40
  }>;
41
41
  getPullRequestsForCurrentUser(input: NumberedPageInput, options?: EnterpriseOptions): Promise<{
@@ -1,308 +1,5 @@
1
- import { PagedResult, Result } from '../types';
2
- export interface Options {
3
- token?: string;
4
- isPAT?: boolean;
5
- }
6
- export interface EnterpriseOptions extends Options {
7
- baseUrl?: string;
8
- }
9
- export interface User {
10
- name: string | null;
11
- email: string | null;
12
- avatarUrl: string | null;
13
- }
14
- export interface Account extends User {
15
- id: string;
16
- graphQLId?: string;
17
- username: string | null;
18
- url: string | null;
19
- }
20
- export interface Organization {
21
- id: string;
22
- graphQLId?: string;
23
- username: string;
24
- name: string | null;
25
- email: string | null;
26
- avatarUrl: string;
27
- }
28
- export declare enum GitBuildStatusStage {
29
- Build = "build",
30
- Production = "production",
31
- Staging = "staging",
32
- Test = "test"
33
- }
34
- export declare enum GitBuildStatusState {
35
- ActionRequired = "ACTION_REQUIRED",
36
- Cancelled = "CANCELLED",
37
- Error = "ERROR",
38
- Failed = "FAILED",
39
- Pending = "PENDING",
40
- Running = "RUNNING",
41
- Skipped = "SKIPPED",
42
- Success = "SUCCESS",
43
- Warning = "WARNING",
44
- OptionalActionRequired = "OPTIONAL_ACTION_REQUIRED"
45
- }
46
- export interface GitBuildStatus {
47
- completedAt: Date | null;
48
- description: string | null;
49
- name: string | null;
50
- state: GitBuildStatusState | null;
51
- stage: GitBuildStatusStage | null;
52
- startedAt: Date | null;
53
- url: string;
54
- }
55
- export interface GitLabel {
56
- color: string | null;
57
- description: string | null;
58
- graphQLId?: string;
59
- id: string | null;
60
- name: string;
61
- }
62
- export interface GitMilestone {
63
- id: string;
64
- graphQLId?: string;
65
- number: number;
66
- title: string;
67
- description: string | null;
68
- isOpen: boolean;
69
- url: string;
70
- startDate: Date | null;
71
- dueDate: Date | null;
72
- }
73
- export interface GitRepository {
74
- id: string;
75
- graphQLId?: string;
76
- namespace: string;
77
- name: string;
78
- project?: string;
79
- webUrl: string | null;
80
- httpsUrl: string | null;
81
- sshUrl: string | null;
82
- defaultBranch: GitRef | null;
83
- permission: string | null;
84
- }
85
- export interface GitRef {
86
- name: string;
87
- }
88
- export interface GitRefWithOID extends GitRef {
89
- oid: string | null;
90
- }
91
- export interface GitRefWithCommit extends GitRef {
92
- commit: GitCommit | null;
93
- }
94
- export interface GitCommit {
95
- oid: string;
96
- authoredDate: Date | null;
97
- committedDate: Date | null;
98
- }
99
- export interface GitBlame {
100
- ranges: {
101
- startingLine: number;
102
- endingLine: number;
103
- commit: GitCommit & {
104
- parentOids: string[];
105
- message: string;
106
- author: User | null;
107
- committer: User | null;
108
- fileCount: number | null;
109
- additions: number | null;
110
- deletions: number | null;
111
- };
112
- }[];
113
- }
114
- export declare enum GitMergeStrategy {
115
- MergeCommit = "MERGE_COMMIT",
116
- Rebase = "REBASE",
117
- RebaseThenMergeCommit = "REBASE_THEN_MERGE_COMMIT",
118
- FastForward = "FAST_FORWARD",
119
- Squash = "SQUASH"
120
- }
121
- export declare enum GitPullRequestState {
122
- Open = "OPEN",
123
- Closed = "CLOSED",
124
- Merged = "MERGED"
125
- }
126
- export declare enum GitPullRequestReviewState {
127
- Approved = "APPROVED",
128
- ChangesRequested = "CHANGES_REQUESTED",
129
- Commented = "COMMENTED",
130
- ReviewRequested = "REVIEW_REQUESTED"
131
- }
132
- export declare enum GitPullRequestMergeableState {
133
- Behind = "BEHIND",
134
- Blocked = "BLOCKED",
135
- Conflicts = "CONFLICTS",
136
- Mergeable = "MERGEABLE",
137
- Unknown = "UNKNOWN",
138
- UnknownAndBlocked = "UNKNOWN_AND_BLOCKED",
139
- Unstable = "UNSTABLE"
140
- }
141
- export interface GitPullRequestPermissions {
142
- canMerge: boolean;
143
- canMergeAndBypassProtections: boolean;
144
- }
145
- export interface GitPullRequest {
146
- id: string;
147
- graphQLId?: string;
148
- number: number;
149
- title: string;
150
- url: string | null;
151
- state: GitPullRequestState;
152
- isDraft: boolean;
153
- createdDate: Date;
154
- updatedDate: Date;
155
- closedDate: Date | null;
156
- mergedDate: Date | null;
157
- baseRef: GitRefWithOID | null;
158
- headRef: GitRefWithOID | null;
159
- commentCount: number | null;
160
- upvoteCount: number | null;
161
- commitCount: number | null;
162
- fileCount: number | null;
163
- additions: number | null;
164
- deletions: number | null;
165
- author: Account | null;
166
- assignees: Account[] | null;
167
- reviews: {
168
- reviewer: Account;
169
- state: GitPullRequestReviewState;
170
- }[] | null;
171
- reviewDecision: GitPullRequestReviewState | null;
172
- repository: {
173
- id: string;
174
- graphQLId?: string;
175
- name: string;
176
- project?: string;
177
- owner: {
178
- login: string;
179
- };
180
- remoteInfo: {
181
- cloneUrlHTTPS: string;
182
- cloneUrlSSH: string;
183
- } | null;
184
- };
185
- headRepository: {
186
- id: string;
187
- graphQLId?: string;
188
- name: string;
189
- project?: string;
190
- owner: {
191
- login: string;
192
- };
193
- remoteInfo: {
194
- cloneUrlHTTPS: string;
195
- cloneUrlSSH: string;
196
- } | null;
197
- } | null;
198
- headCommit: {
199
- buildStatuses: GitBuildStatus[] | null;
200
- } | null;
201
- mergeableState: GitPullRequestMergeableState;
202
- milestone?: GitMilestone | null;
203
- labels?: GitLabel[];
204
- permissions: GitPullRequestPermissions | null;
205
- version?: number;
206
- }
207
- export interface GitComment {
208
- author: Account | User | null;
209
- body: string;
210
- createdAt: Date | null;
211
- id: string;
212
- graphQLId?: string;
213
- url: string;
214
- }
215
- export declare enum GitDiffLineType {
216
- ADDED = "ADDED",
217
- DELETED = "DELETED",
218
- UNMODIFIED = "UNMODIFIED"
219
- }
220
- export interface GitDiffLine {
221
- line: string;
222
- oldLineNumber: number | null;
223
- newLineNumber: number | null;
224
- type: GitDiffLineType;
225
- }
226
- export interface GitPullRequestReviewComment extends GitComment {
227
- diffLines: GitDiffLine[];
228
- filename: string;
229
- replies: GitComment[];
230
- isOutdated: boolean;
231
- isResolved: boolean;
232
- }
233
- export interface GitPullRequestReview extends GitComment {
234
- reviewComments: GitPullRequestReviewComment[];
235
- }
236
- export interface GetRepoInput {
237
- namespace: string;
238
- name: string;
239
- project?: string;
240
- }
241
- export interface GetReposInput {
242
- repos: GetRepoInput[];
243
- }
244
- export type GetPRsForReposInput = GetReposInput | {
245
- repoIds: (string | number)[];
246
- };
247
- export type GetPRForRepoInput = {
248
- repo: GetRepoInput;
249
- number: number;
250
- };
251
- export interface SetPullRequestInput {
252
- id: string;
253
- number: number;
254
- graphQLId?: string;
255
- repository: {
256
- id: string;
257
- name: string;
258
- project?: string;
259
- owner: {
260
- login: string;
261
- };
262
- };
263
- version?: number;
264
- }
265
- export interface SetMilestoneInput {
266
- id: string;
267
- graphQLId?: string;
268
- }
269
- export interface SetAccountInput {
270
- id: string;
271
- name: string | null;
272
- graphQLId?: string;
273
- username: string | null;
274
- }
275
- export interface CreateCommitInput {
276
- commitMessage: {
277
- description?: string;
278
- summary: string;
279
- };
280
- deletedFiles: string[];
281
- newOrModifiedFiles: {
282
- [filePath: string]: string;
283
- };
284
- repo: GetRepoInput;
285
- target: {
286
- name: string;
287
- oid: string;
288
- };
289
- }
290
- export interface SetLabelInput {
291
- id: string | null;
292
- graphQLId?: string;
293
- name: string;
294
- }
295
- export interface CursorPageInput {
296
- cursor?: string | null;
297
- }
298
- export interface NumberedPageInput {
299
- page?: number | null;
300
- }
301
- export type PageInput = CursorPageInput | NumberedPageInput;
302
- export interface GetRepoErrorData {
303
- input: GetRepoInput;
304
- error?: Error;
305
- }
1
+ import { Account, CreateCommitInput, GetPRForRepoInput, GetRepoErrorData, GetRepoInput, GetReposInput, GitBlame, GitLabel, GitMergeStrategy, GitPullRequest, GitRefWithCommit, GitRepository, Options, PageInput, SetAccountInput, SetLabelInput, SetMilestoneInput, SetPullRequestInput, User } from '../types/exportedTypes/gitProvider';
2
+ import { PagedResult, Result } from '../types/exportedTypes/types';
306
3
  export interface GitProvider {
307
4
  getCurrentUser?(input: Record<string, never>, options: Options): Promise<Result<Account>>;
308
5
  getUserForCommit?(input: {
@@ -332,7 +29,7 @@ export interface GitProvider {
332
29
  ref: string;
333
30
  path: string;
334
31
  }, options: Options): Promise<Result<GitBlame>>;
335
- getPullRequestsForRepos?(input: GetPRsForReposInput, options: Options): Promise<Result<GitPullRequest[]>>;
32
+ getPullRequestsForRepos?(input: GetReposInput, options: Options): Promise<Result<GitPullRequest[]>>;
336
33
  getPullRequestForRepo?(input: GetPRForRepoInput, options: Options): Promise<Result<GitPullRequest | null>>;
337
34
  setPullRequestAssignees?(input: {
338
35
  pullRequest: SetPullRequestInput;