@gitkraken/provider-apis 0.29.6 → 0.29.7

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,20 @@
1
+ import { Options } from '../../types/exportedTypes/gitProvider';
2
+ import { GetIssueInput, Issue } from '../../types/exportedTypes/issueProvider';
3
+ import { Result } from '../../types/exportedTypes/types';
4
+ import { CursorPageInput } from '../../types/exportedTypes/gitProvider';
5
+ import { LinearOrganization, LinearTeam } from '../../types/exportedTypes/linear';
6
+ import { PagedResult } from '../../types/exportedTypes/types';
7
+ import { IssueProvider } from '../issueProvider';
8
+ import { Provider } from '../provider';
9
+ export declare class Linear extends Provider implements IssueProvider {
10
+ private makeGraphQLRequest;
11
+ private fetchIssue;
12
+ private fetchOrganization;
13
+ private fetchTeams;
14
+ private rawRequest;
15
+ private fetchViewer;
16
+ getIssue(input: GetIssueInput, options?: Options): Promise<Result<Issue>>;
17
+ getLinearOrganization(options?: Options): Promise<Result<LinearOrganization>>;
18
+ getTeamsForCurrentUser(options?: Options): Promise<Result<LinearTeam[]>>;
19
+ getIssuesForCurrentUser(input: CursorPageInput, options?: Options): Promise<PagedResult<Issue>>;
20
+ }
@@ -0,0 +1,9 @@
1
+ export declare class UniqueIdsArr<T extends {
2
+ id: string;
3
+ }> {
4
+ private readonly set;
5
+ private readonly arr;
6
+ push(...items: T[]): void;
7
+ get length(): number;
8
+ get items(): T[];
9
+ }
@@ -0,0 +1,13 @@
1
+ export declare enum UserIssueCategory {
2
+ None = 0,
3
+ Assignee = 1,
4
+ Creator = 2,
5
+ Mention = 3,
6
+ MentionInDescription = 4,
7
+ MentionInComments = 5
8
+ }
9
+ export declare function formatUserIssueCursor(category: UserIssueCategory | undefined | null, cursor: string | null | undefined): string | null;
10
+ export declare function parseUserIssueCursor(cursor: string | null | undefined): {
11
+ category: UserIssueCategory;
12
+ cursor?: string;
13
+ };
@@ -5,6 +5,7 @@ import { GitHub } from './github/github';
5
5
  import { GitLab } from './gitlab/gitlab';
6
6
  import { Jira } from './jira/jira';
7
7
  import { JiraServer } from './jira/jiraServer';
8
+ import { Linear } from './linear/linear';
8
9
  import { Trello } from './trello/trello';
9
10
  import type { Config } from '../types/exportedTypes/types';
10
11
  export declare const makeProviderAPIs: (config?: Partial<Config>) => {
@@ -15,5 +16,6 @@ export declare const makeProviderAPIs: (config?: Partial<Config>) => {
15
16
  gitlab: GitLab;
16
17
  jira: Jira;
17
18
  jiraServer: JiraServer;
19
+ linear: Linear;
18
20
  trello: Trello;
19
21
  };
@@ -17,6 +17,7 @@ export declare enum EntityIdentifierProviderType {
17
17
  BitbucketServer = "bitbucketServer",
18
18
  Jira = "jira",
19
19
  JiraServer = "jiraServer",
20
+ Linear = "linear",
20
21
  Trello = "trello"
21
22
  }
22
23
  export type EntityIdentifier = {
@@ -0,0 +1,12 @@
1
+ export interface LinearTeam {
2
+ id: string;
3
+ name: string;
4
+ key: string;
5
+ iconUrl?: string;
6
+ }
7
+ export interface LinearOrganization {
8
+ id: string;
9
+ name: string;
10
+ key: string;
11
+ url: string;
12
+ }
@@ -12,6 +12,7 @@ export interface Config extends SharedConfig {
12
12
  azureDevOps?: ProviderBaseConfig;
13
13
  jira?: ProviderBaseConfig;
14
14
  jiraServer?: ProviderBaseConfig & EnterpriseConfig;
15
+ linear?: ProviderBaseConfig;
15
16
  trello?: ProviderBaseConfig;
16
17
  }
17
18
  export interface SharedConfig {
@@ -99,7 +100,7 @@ export interface PullRequestGroupByBucket extends PullRequestBucketBase {
99
100
  teamData?: Team;
100
101
  }
101
102
  export type OrganizationMemberIdentityPrProvider = 'github' | 'gitlab' | 'bitbucket' | 'azure';
102
- export type OrganizationMemberIdentityIssueProvider = 'github' | 'gitlab' | 'jira' | 'azure' | 'trello';
103
+ export type OrganizationMemberIdentityIssueProvider = 'github' | 'gitlab' | 'jira' | 'linear' | 'azure' | 'trello';
103
104
  export type EnrichedItemsByUniqueId = {
104
105
  [uuid: string]: EnrichedItem[];
105
106
  };
@@ -113,7 +114,7 @@ export type EnrichedItem = {
113
114
  id: string;
114
115
  userId?: string;
115
116
  type: 'pin' | 'snooze';
116
- provider: 'azure' | 'bitbucket' | 'github' | 'gitlab' | 'jira' | 'trello' | 'gitkraken';
117
+ provider: 'azure' | 'bitbucket' | 'github' | 'gitlab' | 'jira' | 'linear' | 'trello' | 'gitkraken';
117
118
  entityType: 'issue' | 'pr';
118
119
  entityId: string;
119
120
  entityUrl: string;
package/dist/utils.d.ts CHANGED
@@ -13,3 +13,8 @@ export declare const followCursors: <T>(fn: (cursor?: number | string | null) =>
13
13
  pageInfo?: CursorPageInfo | NumberedPageInfo | undefined;
14
14
  data: T[];
15
15
  }>) => Promise<T[]>;
16
+ export type MaybePromiseArr<T> = (Promise<T | undefined> | T | undefined)[];
17
+ export declare function nonnullSettled<T>(arr: MaybePromiseArr<T>): Promise<T[]>;
18
+ export declare function flatSettled<T>(arr: MaybePromiseArr<(T | undefined)[]>): Promise<T[]>;
19
+ export declare function getSettledValue<T>(promise: PromiseSettledResult<Awaited<T | undefined>>): T | undefined;
20
+ 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.29.6",
3
+ "version": "0.29.7",
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",
@@ -35,6 +35,7 @@
35
35
  "watch": "yarn clean && node ./scripts/build.mjs --watch & tsc -w"
36
36
  },
37
37
  "dependencies": {
38
+ "@linear/sdk": "58.1.0",
38
39
  "js-base64": "3.7.5",
39
40
  "node-fetch": "2.7.0"
40
41
  },