@brunolemos/devhub-core 0.102.0 → 0.103.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.
- package/dist/helpers/github/events.d.ts +9 -2
- package/dist/helpers/github/events.js +108 -4
- package/dist/helpers/github/events.js.map +1 -1
- package/dist/helpers/github/issues.d.ts +4 -4
- package/dist/helpers/github/issues.js +1 -4
- package/dist/helpers/github/issues.js.map +1 -1
- package/dist/helpers/github/notifications.js +2 -1
- package/dist/helpers/github/notifications.js.map +1 -1
- package/dist/helpers/github/shared.d.ts +12 -12
- package/dist/helpers/github/shared.js +6 -3
- package/dist/helpers/github/shared.js.map +1 -1
- package/dist/helpers/oauth.js.map +1 -1
- package/dist/helpers/shared.js +11 -8
- package/dist/helpers/shared.js.map +1 -1
- package/dist/helpers/state.d.ts +2 -2
- package/dist/helpers/state.js +1 -0
- package/dist/helpers/state.js.map +1 -1
- package/dist/mappers/notifications.js +1 -1
- package/dist/mappers/notifications.js.map +1 -1
- package/dist/mappers/repository.js +4 -0
- package/dist/mappers/repository.js.map +1 -1
- package/dist/styles/helpers.d.ts +1 -1
- package/dist/types/devhub.d.ts +4 -1
- package/dist/types/github.d.ts +6 -4
- package/dist/utils/constants.js.map +1 -1
- package/package.json +5 -5
- package/src/helpers/filters.ts +1 -1
- package/src/helpers/github/events.ts +156 -10
- package/src/helpers/github/issues.ts +2 -4
- package/src/helpers/github/notifications.ts +5 -4
- package/src/helpers/github/shared.ts +28 -30
- package/src/helpers/oauth.ts +4 -3
- package/src/helpers/shared.ts +27 -32
- package/src/types/devhub.ts +18 -19
- package/src/types/github.ts +16 -3
- package/src/utils/constants.ts +4 -5
- package/tsconfig.tsbuildinfo +0 -5946
package/src/types/devhub.ts
CHANGED
|
@@ -77,6 +77,10 @@ export type IssueOrPullRequestPayloadEnhancement =
|
|
|
77
77
|
| IssuePayloadEnhancement
|
|
78
78
|
| PullRequestPayloadEnhancement
|
|
79
79
|
|
|
80
|
+
export interface EventPayloadEnhancement extends BaseEnhancement {
|
|
81
|
+
enrichedPullRequest?: GitHubPullRequest
|
|
82
|
+
}
|
|
83
|
+
|
|
80
84
|
export interface EnhancedGitHubNotification
|
|
81
85
|
extends Omit<GitHubNotification, 'reason'>,
|
|
82
86
|
NotificationPayloadEnhancement {
|
|
@@ -95,7 +99,7 @@ export interface MultipleStarEvent
|
|
|
95
99
|
}
|
|
96
100
|
|
|
97
101
|
export type EnhancedGitHubEvent = (GitHubEvent | MultipleStarEvent) &
|
|
98
|
-
|
|
102
|
+
EventPayloadEnhancement
|
|
99
103
|
|
|
100
104
|
export type EnhancedGitHubIssue = GitHubIssue & IssuePayloadEnhancement
|
|
101
105
|
|
|
@@ -330,19 +334,17 @@ export type GenericColumnCreation<
|
|
|
330
334
|
ColumnType extends
|
|
331
335
|
| ActivityColumn
|
|
332
336
|
| IssueOrPullRequestColumn
|
|
333
|
-
| NotificationColumn
|
|
337
|
+
| NotificationColumn,
|
|
334
338
|
> = Omit<ColumnType, 'createdAt' | 'updatedAt'> & {
|
|
335
339
|
createdAt?: string
|
|
336
340
|
updatedAt?: string
|
|
337
341
|
}
|
|
338
342
|
|
|
339
343
|
export type ActivityColumnCreation = GenericColumnCreation<ActivityColumn>
|
|
340
|
-
export type IssueOrPullRequestColumnCreation =
|
|
341
|
-
IssueOrPullRequestColumn
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
NotificationColumn
|
|
345
|
-
>
|
|
344
|
+
export type IssueOrPullRequestColumnCreation =
|
|
345
|
+
GenericColumnCreation<IssueOrPullRequestColumn>
|
|
346
|
+
export type NotificationColumnCreation =
|
|
347
|
+
GenericColumnCreation<NotificationColumn>
|
|
346
348
|
|
|
347
349
|
export type ColumnCreation =
|
|
348
350
|
| ActivityColumnCreation
|
|
@@ -353,7 +355,7 @@ export type GenericColumnSubscriptionCreation<
|
|
|
353
355
|
ColumnSubscriptionType extends
|
|
354
356
|
| ActivityColumnSubscription
|
|
355
357
|
| IssueOrPullRequestColumnSubscription
|
|
356
|
-
| NotificationColumnSubscription
|
|
358
|
+
| NotificationColumnSubscription,
|
|
357
359
|
> = Omit<ColumnSubscriptionType, 'id' | 'data' | 'createdAt' | 'updatedAt'> & {
|
|
358
360
|
id?: string | undefined
|
|
359
361
|
data?: ColumnSubscriptionType['data'] | undefined
|
|
@@ -361,15 +363,12 @@ export type GenericColumnSubscriptionCreation<
|
|
|
361
363
|
updatedAt?: string | undefined
|
|
362
364
|
}
|
|
363
365
|
|
|
364
|
-
export type ActivityColumnSubscriptionCreation =
|
|
365
|
-
ActivityColumnSubscription
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
>
|
|
370
|
-
export type NotificationColumnSubscriptionCreation = GenericColumnSubscriptionCreation<
|
|
371
|
-
NotificationColumnSubscription
|
|
372
|
-
>
|
|
366
|
+
export type ActivityColumnSubscriptionCreation =
|
|
367
|
+
GenericColumnSubscriptionCreation<ActivityColumnSubscription>
|
|
368
|
+
export type IssueOrPullRequestColumnSubscriptionCreation =
|
|
369
|
+
GenericColumnSubscriptionCreation<IssueOrPullRequestColumnSubscription>
|
|
370
|
+
export type NotificationColumnSubscriptionCreation =
|
|
371
|
+
GenericColumnSubscriptionCreation<NotificationColumnSubscription>
|
|
373
372
|
|
|
374
373
|
export type ColumnSubscriptionCreation =
|
|
375
374
|
| ActivityColumnSubscriptionCreation
|
|
@@ -600,7 +599,7 @@ export interface Plan {
|
|
|
600
599
|
export type UserPlan = GraphQLUserPlan
|
|
601
600
|
|
|
602
601
|
export interface ItemPushNotification<
|
|
603
|
-
A extends { type: string; payload: any } = { type: string; payload: any }
|
|
602
|
+
A extends { type: string; payload: any } = { type: string; payload: any },
|
|
604
603
|
> {
|
|
605
604
|
title: string
|
|
606
605
|
subtitle?: string
|
package/src/types/github.ts
CHANGED
|
@@ -259,6 +259,14 @@ export interface GitHubPullRequest {
|
|
|
259
259
|
repository_url: string // https://api.github.com/repos/devhubapp/devhub
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
+
// The Events API returns an abbreviated pull_request with only a few
|
|
263
|
+
// guaranteed fields. Everything else from GitHubPullRequest is optional.
|
|
264
|
+
export type GitHubEventPullRequest = Pick<
|
|
265
|
+
GitHubPullRequest,
|
|
266
|
+
'id' | 'number' | 'head' | 'base' | 'url'
|
|
267
|
+
> &
|
|
268
|
+
Partial<Omit<GitHubPullRequest, 'id' | 'number' | 'head' | 'base' | 'url'>>
|
|
269
|
+
|
|
262
270
|
export interface GitHubRepo {
|
|
263
271
|
id: number | string
|
|
264
272
|
name: string
|
|
@@ -499,9 +507,10 @@ export interface GitHubPullRequestEvent {
|
|
|
499
507
|
| 'opened'
|
|
500
508
|
| 'edited'
|
|
501
509
|
| 'closed'
|
|
510
|
+
| 'merged'
|
|
502
511
|
| 'reopened'
|
|
503
512
|
number: number
|
|
504
|
-
pull_request:
|
|
513
|
+
pull_request: GitHubEventPullRequest
|
|
505
514
|
sender: object
|
|
506
515
|
}
|
|
507
516
|
public?: boolean
|
|
@@ -518,7 +527,7 @@ export interface GitHubPullRequestReviewEvent {
|
|
|
518
527
|
repo: GitHubRepo
|
|
519
528
|
payload: {
|
|
520
529
|
action: 'submitted'
|
|
521
|
-
pull_request:
|
|
530
|
+
pull_request: GitHubEventPullRequest
|
|
522
531
|
review: object
|
|
523
532
|
}
|
|
524
533
|
public?: boolean
|
|
@@ -538,7 +547,7 @@ export interface GitHubPullRequestReviewCommentEvent {
|
|
|
538
547
|
payload: {
|
|
539
548
|
action: 'created' | 'edited' | 'deleted'
|
|
540
549
|
changes?: object
|
|
541
|
-
pull_request:
|
|
550
|
+
pull_request: GitHubEventPullRequest
|
|
542
551
|
comment: GitHubComment
|
|
543
552
|
}
|
|
544
553
|
public?: boolean
|
|
@@ -670,6 +679,10 @@ export type GitHubStateType = 'open' | 'closed' | 'merged'
|
|
|
670
679
|
|
|
671
680
|
export type GitHubIssueOrPullRequest = GitHubIssue | GitHubPullRequest
|
|
672
681
|
|
|
682
|
+
export type GitHubIssueOrPullRequestFromEvent =
|
|
683
|
+
| GitHubIssue
|
|
684
|
+
| GitHubEventPullRequest
|
|
685
|
+
|
|
673
686
|
export type GitHubIssueOrPullRequestSubjectType = 'Issue' | 'PullRequest'
|
|
674
687
|
|
|
675
688
|
export type GitHubItemSubjectType =
|
package/src/utils/constants.ts
CHANGED
|
@@ -29,11 +29,10 @@ export const DEFAULT_THEME_PAIR: ThemePair = {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export const DEFAULT_GITHUB_OAUTH_SCOPES = ['notifications', 'user:email']
|
|
32
|
-
export const FULL_ACCESS_GITHUB_OAUTH_SCOPES =
|
|
33
|
-
'repo'
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
: [...DEFAULT_GITHUB_OAUTH_SCOPES, 'repo']
|
|
32
|
+
export const FULL_ACCESS_GITHUB_OAUTH_SCOPES =
|
|
33
|
+
DEFAULT_GITHUB_OAUTH_SCOPES.includes('repo')
|
|
34
|
+
? DEFAULT_GITHUB_OAUTH_SCOPES
|
|
35
|
+
: [...DEFAULT_GITHUB_OAUTH_SCOPES, 'repo']
|
|
37
36
|
|
|
38
37
|
// unfortunately github permissions are still not granular enough.
|
|
39
38
|
// code permission is required to support some events, e.g. commits
|