@kud/gh 0.4.1 → 0.5.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/inbox.d.ts +23 -1
- package/dist/inbox.d.ts.map +1 -1
- package/dist/inbox.js +42 -25
- package/dist/inbox.js.map +1 -1
- package/package.json +1 -1
package/dist/inbox.d.ts
CHANGED
|
@@ -1,9 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How much of each row to ask for.
|
|
3
|
+
*
|
|
4
|
+
* `full` carries health, conversation and labels — everything `computeHealth`
|
|
5
|
+
* and a conversation line need. `minimal` carries identity only: type, number,
|
|
6
|
+
* title, url, draft, timestamp, repo.
|
|
7
|
+
*
|
|
8
|
+
* This is a cost axis, not a taste one. Measured against GitHub's own
|
|
9
|
+
* `rateLimit { cost }`: the full query costs **111 points** of a 5000/hour
|
|
10
|
+
* budget, at a nodeCount of ~25,550 — because `statusCheckRollup.contexts`
|
|
11
|
+
* appears in five PR fragments and `reviewThreads(first: 50)` multiplies
|
|
12
|
+
* beneath each one. A caller that renders a title and a link was paying for
|
|
13
|
+
* every check run on every open PR. At 111 a poller gets 45 refreshes an hour.
|
|
14
|
+
*/
|
|
15
|
+
export type InboxShape = "full" | "minimal";
|
|
1
16
|
/** A repo-scoped or account-wide inbox. */
|
|
2
17
|
export type InboxQueryOptions = {
|
|
3
18
|
/** `owner/name`. Scopes every search to one repository. */
|
|
4
19
|
repo?: string;
|
|
5
20
|
/** How far back `recentlyDone` looks. Defaults to 14 days. */
|
|
6
21
|
doneWithinDays?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Defaults to `full`, so every existing caller keeps what it had. Reach for
|
|
24
|
+
* `minimal` only when nothing downstream reads health, conversation or
|
|
25
|
+
* labels — those fields do not degrade, they vanish, and `computeHealth`
|
|
26
|
+
* falls through to a wrong answer rather than an absent one.
|
|
27
|
+
*/
|
|
28
|
+
shape?: InboxShape;
|
|
7
29
|
};
|
|
8
30
|
/**
|
|
9
31
|
* Build the inbox query. Without `repo`, it is account-wide.
|
|
@@ -14,5 +36,5 @@ export type InboxQueryOptions = {
|
|
|
14
36
|
* render empty and read as "nothing to do here". So `repo:` REPLACES
|
|
15
37
|
* `user:@me` rather than joining it.
|
|
16
38
|
*/
|
|
17
|
-
export declare const buildInboxQuery: ({ repo, doneWithinDays, }?: InboxQueryOptions) => string;
|
|
39
|
+
export declare const buildInboxQuery: ({ repo, doneWithinDays, shape, }?: InboxQueryOptions) => string;
|
|
18
40
|
//# sourceMappingURL=inbox.d.ts.map
|
package/dist/inbox.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inbox.d.ts","sourceRoot":"","sources":["../src/inbox.ts"],"names":[],"mappings":"AAQA,2CAA2C;AAC3C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,2DAA2D;IAC3D,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,8DAA8D;IAC9D,cAAc,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"inbox.d.ts","sourceRoot":"","sources":["../src/inbox.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,SAAS,CAAA;AAE3C,2CAA2C;AAC3C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,2DAA2D;IAC3D,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,8DAA8D;IAC9D,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,UAAU,CAAA;CACnB,CAAA;AA6DD;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,GAAI,mCAI7B,iBAAsB,WA6FxB,CAAA"}
|
package/dist/inbox.js
CHANGED
|
@@ -8,10 +8,20 @@
|
|
|
8
8
|
// computeHealth's precedence needs reviewDecision, mergeable and the check
|
|
9
9
|
// rollup. A fragment that omits them does NOT degrade gracefully — it falls
|
|
10
10
|
// straight through to whatever token is left, so a PR you already sent back
|
|
11
|
-
// renders as "awaiting review" and a failing one renders as quiet.
|
|
12
|
-
//
|
|
11
|
+
// renders as "awaiting review" and a failing one renders as quiet.
|
|
12
|
+
//
|
|
13
|
+
// So this set is all-or-nothing, which is exactly why `shape` drops it whole
|
|
14
|
+
// rather than field by field: a caller either computes health and needs every
|
|
15
|
+
// one of these, or renders none of it and should pay for none of it. There is
|
|
16
|
+
// no coherent middle, and the `minimal` shape is not a smaller health — it is
|
|
17
|
+
// the absence of health.
|
|
18
|
+
//
|
|
19
|
+
// `isDraft` is deliberately NOT in here. It is identity, not health, and a
|
|
20
|
+
// minimal caller still has to tell a draft from an open PR, so it sits in the
|
|
21
|
+
// base field list beside `number` and `title` where dropping health cannot
|
|
22
|
+
// take it with them.
|
|
13
23
|
const PR_HEALTH = `
|
|
14
|
-
|
|
24
|
+
reviewDecision mergeable
|
|
15
25
|
statusCheckRollup { contexts(first: 20) { nodes {
|
|
16
26
|
... on CheckRun { name conclusion status }
|
|
17
27
|
... on StatusContext { context state }
|
|
@@ -57,38 +67,45 @@ const sinceDay = (days) => new Date(Date.now() - days * 86400 * 1000).toISOStrin
|
|
|
57
67
|
* render empty and read as "nothing to do here". So `repo:` REPLACES
|
|
58
68
|
* `user:@me` rather than joining it.
|
|
59
69
|
*/
|
|
60
|
-
export const buildInboxQuery = ({ repo, doneWithinDays = 14, } = {}) => {
|
|
70
|
+
export const buildInboxQuery = ({ repo, doneWithinDays = 14, shape = "full", } = {}) => {
|
|
61
71
|
const scope = repo ? `repo:${repo} ` : "";
|
|
62
72
|
const owned = repo ? "" : "user:@me ";
|
|
63
73
|
const doneSince = sinceDay(doneWithinDays);
|
|
74
|
+
/* Interpolated as empty strings rather than branching the query text, so the
|
|
75
|
+
two shapes cannot drift into two separately-maintained queries. */
|
|
76
|
+
const full = shape === "full";
|
|
77
|
+
const health = full ? PR_HEALTH : "";
|
|
78
|
+
const conversation = full ? PR_CONVERSATION : "";
|
|
79
|
+
const issueConversation = full ? ISSUE_CONVERSATION : "";
|
|
80
|
+
const issueLabels = full ? ISSUE_LABELS : "";
|
|
64
81
|
return `
|
|
65
82
|
{
|
|
66
83
|
viewer { login }
|
|
67
84
|
myPRs: search(query: "${scope}is:pr is:open author:@me", type: ISSUE, first: 100) {
|
|
68
85
|
nodes { __typename ... on PullRequest {
|
|
69
|
-
number title createdAt url headRefName
|
|
86
|
+
number title createdAt url headRefName isDraft
|
|
70
87
|
repository { nameWithOwner }
|
|
71
88
|
author { login }
|
|
72
|
-
${
|
|
73
|
-
${
|
|
89
|
+
${health}
|
|
90
|
+
${conversation}
|
|
74
91
|
}}
|
|
75
92
|
}
|
|
76
93
|
reviewRequests: search(query: "${scope}is:pr is:open review-requested:@me", type: ISSUE, first: 20) {
|
|
77
94
|
nodes { __typename ... on PullRequest {
|
|
78
|
-
number title createdAt url headRefName
|
|
95
|
+
number title createdAt url headRefName isDraft
|
|
79
96
|
repository { nameWithOwner }
|
|
80
97
|
author { login }
|
|
81
|
-
${
|
|
82
|
-
${
|
|
98
|
+
${health}
|
|
99
|
+
${conversation}
|
|
83
100
|
}}
|
|
84
101
|
}
|
|
85
102
|
reviewed: search(query: "${scope}is:pr is:open reviewed-by:@me -author:@me -review-requested:@me", type: ISSUE, first: 20) {
|
|
86
103
|
nodes { __typename ... on PullRequest {
|
|
87
|
-
number title createdAt url headRefName
|
|
104
|
+
number title createdAt url headRefName isDraft
|
|
88
105
|
repository { nameWithOwner }
|
|
89
106
|
author { login }
|
|
90
|
-
${
|
|
91
|
-
${
|
|
107
|
+
${health}
|
|
108
|
+
${conversation}
|
|
92
109
|
}}
|
|
93
110
|
}
|
|
94
111
|
assigned: search(query: "${scope}is:open assignee:@me", type: ISSUE, first: 30) {
|
|
@@ -96,13 +113,13 @@ export const buildInboxQuery = ({ repo, doneWithinDays = 14, } = {}) => {
|
|
|
96
113
|
__typename
|
|
97
114
|
... on Issue {
|
|
98
115
|
number title createdAt url repository { nameWithOwner } author { login }
|
|
99
|
-
${
|
|
100
|
-
${
|
|
116
|
+
${issueConversation}
|
|
117
|
+
${issueLabels}
|
|
101
118
|
}
|
|
102
119
|
... on PullRequest {
|
|
103
|
-
number title createdAt url headRefName repository { nameWithOwner } author { login }
|
|
104
|
-
${
|
|
105
|
-
${
|
|
120
|
+
number title createdAt url headRefName isDraft repository { nameWithOwner } author { login }
|
|
121
|
+
${health}
|
|
122
|
+
${conversation}
|
|
106
123
|
}
|
|
107
124
|
}
|
|
108
125
|
}
|
|
@@ -111,8 +128,8 @@ export const buildInboxQuery = ({ repo, doneWithinDays = 14, } = {}) => {
|
|
|
111
128
|
number title createdAt url
|
|
112
129
|
repository { nameWithOwner }
|
|
113
130
|
author { login }
|
|
114
|
-
${
|
|
115
|
-
${
|
|
131
|
+
${issueConversation}
|
|
132
|
+
${issueLabels}
|
|
116
133
|
}}
|
|
117
134
|
}
|
|
118
135
|
authoredIssues: search(query: "${scope}is:issue is:open author:@me archived:false", type: ISSUE, first: 30) {
|
|
@@ -120,17 +137,17 @@ export const buildInboxQuery = ({ repo, doneWithinDays = 14, } = {}) => {
|
|
|
120
137
|
number title createdAt url
|
|
121
138
|
repository { nameWithOwner }
|
|
122
139
|
author { login }
|
|
123
|
-
${
|
|
124
|
-
${
|
|
140
|
+
${issueConversation}
|
|
141
|
+
${issueLabels}
|
|
125
142
|
}}
|
|
126
143
|
}
|
|
127
144
|
repoPRs: search(query: "${scope}${owned}is:pr is:open -author:@me archived:false", type: ISSUE, first: 30) {
|
|
128
145
|
nodes { __typename ... on PullRequest {
|
|
129
|
-
number title createdAt url headRefName
|
|
146
|
+
number title createdAt url headRefName isDraft
|
|
130
147
|
repository { nameWithOwner }
|
|
131
148
|
author { login }
|
|
132
|
-
${
|
|
133
|
-
${
|
|
149
|
+
${health}
|
|
150
|
+
${conversation}
|
|
134
151
|
}}
|
|
135
152
|
}
|
|
136
153
|
recentlyDone: search(query: "${scope}is:pr author:@me -is:open closed:>=${doneSince}", type: ISSUE, first: 30) {
|
package/dist/inbox.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inbox.js","sourceRoot":"","sources":["../src/inbox.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,6EAA6E;AAC7E,qCAAqC;AACrC,EAAE;AACF,6EAA6E;AAC7E,+EAA+E;AAC/E,uDAAuD;
|
|
1
|
+
{"version":3,"file":"inbox.js","sourceRoot":"","sources":["../src/inbox.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,6EAA6E;AAC7E,qCAAqC;AACrC,EAAE;AACF,6EAA6E;AAC7E,+EAA+E;AAC/E,uDAAuD;AAiCvD,2EAA2E;AAC3E,4EAA4E;AAC5E,4EAA4E;AAC5E,mEAAmE;AACnE,EAAE;AACF,6EAA6E;AAC7E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,yBAAyB;AACzB,EAAE;AACF,2EAA2E;AAC3E,8EAA8E;AAC9E,2EAA2E;AAC3E,qBAAqB;AACrB,MAAM,SAAS,GAAG;;;;;YAKN,CAAA;AAEZ,6EAA6E;AAC7E,gFAAgF;AAChF,8EAA8E;AAC9E,2DAA2D;AAC3D,EAAE;AACF,8EAA8E;AAC9E,8EAA8E;AAC9E,4EAA4E;AAC5E,gFAAgF;AAChF,8EAA8E;AAC9E,+DAA+D;AAC/D,MAAM,eAAe,GAAG;;;;;;;8DAOsC,CAAA;AAE9D,MAAM,kBAAkB,GAAG;uFAC4D,CAAA;AAEvF,+EAA+E;AAC/E,qEAAqE;AACrE,MAAM,YAAY,GAAG;2CACsB,CAAA;AAE3C;;;;;GAKG;AACH,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,EAAE,CAChC,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AAEvE;;;;;;;;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