-
Notifications
You must be signed in to change notification settings - Fork 292
Expand file tree
/
Copy pathconstants.ts
More file actions
111 lines (97 loc) · 3.58 KB
/
Copy pathconstants.ts
File metadata and controls
111 lines (97 loc) · 3.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import type { ClientID, Hostname, Link } from './types';
type OAuthScope = 'NOTIFICATIONS' | 'READ_USER' | 'REPO' | 'PUBLIC_REPO';
type OAuthScopeDetails = {
readonly name: string;
readonly description: string;
};
/**
* Structured OAuth scope definitions. Co-locate name + description so they
* can never drift apart. Import OAUTH_SCOPE directly when you need to reference
* a specific scope object (e.g. to access its description in the UI).
*/
export const OAUTH_SCOPE: Record<OAuthScope, OAuthScopeDetails> = {
NOTIFICATIONS: {
name: 'notifications',
description: 'Access GitHub notification inbox',
},
READ_USER: {
name: 'read:user',
description: 'Account details (name, avatar, profile)',
},
REPO: {
name: 'repo',
description: 'Enriched notifications for private and public repositories',
},
PUBLIC_REPO: {
name: 'public_repo',
description: 'Enriched notifications for public repositories only',
},
};
export const Constants = {
// Local storage keys
STORAGE: {
// Legacy storage key (soon to be deprecated)
LEGACY: 'gitify-storage',
// ACCOUNTS: 'gitify-accounts',
FILTERS: 'gitify-filters',
// SETTINGS: 'gitify-settings',
},
// GitHub OAuth Scopes — each tier is an ordered array of OAUTH_SCOPE objects.
// REQUIRED: minimum scopes Gitify needs to function.
// RECOMMENDED: recommended enrichment (private + public repos).
// ALTERNATE: lighter path — public repos only.
OAUTH_SCOPES: {
REQUIRED: [OAUTH_SCOPE.NOTIFICATIONS, OAUTH_SCOPE.READ_USER],
RECOMMENDED: [
OAUTH_SCOPE.NOTIFICATIONS,
OAUTH_SCOPE.READ_USER,
OAUTH_SCOPE.REPO,
],
ALTERNATE: [
OAUTH_SCOPE.NOTIFICATIONS,
OAUTH_SCOPE.READ_USER,
OAUTH_SCOPE.PUBLIC_REPO,
],
},
GITHUB_HOSTNAME: 'github.com' as Hostname,
OAUTH_DEVICE_FLOW_CLIENT_ID: process.env.OAUTH_CLIENT_ID as ClientID,
// GitHub Enterprise Cloud with Data Residency uses *.ghe.com domains
GITHUB_ENTERPRISE_CLOUD_DATA_RESIDENCY_HOSTNAME: 'ghe.com',
GITHUB_API_BASE_URL: 'https://api.github.com',
GITHUB_API_GRAPHQL_URL: 'https://api.github.com/graphql',
GITHUB_API_MERGE_BATCH_SIZE: 100,
// Emojis for different states and events
EMOJIS: {
ALL_READ: ['🎉', '🎊', '🥳', '👏', '🙌', '😎', '🏖️', '🚀', '✨', '🏆'],
ERRORS: {
BAD_CREDENTIALS: ['🔓'],
MISSING_SCOPES: ['🔭'],
NETWORK: ['🛜'],
RATE_LIMITED: ['😮💨'],
UNKNOWN: ['🤔', '🥲', '😳', '🫠', '🙃', '🙈'],
},
},
DEFAULT_FETCH_NOTIFICATIONS_INTERVAL_MS: 60 * 1000, // 1 minute
MIN_FETCH_NOTIFICATIONS_INTERVAL_MS: 60 * 1000, // 1 minute
MAX_FETCH_NOTIFICATIONS_INTERVAL_MS: 60 * 60 * 1000, // 1 hour
FETCH_NOTIFICATIONS_INTERVAL_STEP_MS: 60 * 1000, // 1 minute
REFRESH_ACCOUNTS_INTERVAL_MS: 60 * 60 * 1000, // 1 hour
// GraphQL Argument Defaults
GRAPHQL_ARGS: {
FIRST_LABELS: 100,
FIRST_CLOSING_ISSUES: 100,
LAST_COMMENTS: 1,
LAST_THREADED_COMMENTS: 10,
LAST_REPLIES: 10,
LAST_REVIEWS: 100,
},
// GitHub Docs
GITHUB_DOCS: {
OAUTH_URL:
'https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/authenticating-to-the-rest-api-with-an-oauth-app' as Link,
PAT_URL:
'https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens' as Link,
PARTICIPATING_URL:
'https://docs.github.com/en/account-and-profile/managing-subscriptions-and-notifications-on-github/setting-up-notifications/configuring-notifications#about-participating-and-watching-notifications' as Link,
},
};