@osdlc/typed-gh 0.13.0 → 0.14.1
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/CHANGELOG.md +13 -0
- package/README.md +3 -2
- package/dist/async.js +1 -1
- package/dist/sync.js +1 -1
- package/dist/verbs.d.ts +8 -4
- package/dist/verbs.js +9 -4
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @osdlc/typed-gh
|
|
2
2
|
|
|
3
|
+
## 0.14.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [e0aaba5]
|
|
8
|
+
- @osdlc/typed-git@0.12.0
|
|
9
|
+
|
|
10
|
+
## 0.14.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- c58f58b: `pickPrForBranch` takes the `ListResult` that `openPrsForBranch` and `prList` return, as well as plain rows, so `pickPrForBranch(verb.parse(result), branch)` works without a `.rows` unwrap. It also accepts a readonly array.
|
|
15
|
+
|
|
3
16
|
## 0.13.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -605,8 +605,9 @@ Each verb takes an optional `GhTarget` last. Each client method has a verb of th
|
|
|
605
605
|
`createReview`, `issueList`, `issueView`, `labelList`, `setIssueLabel`, `createLabel`,
|
|
606
606
|
`editLabel`, `issueCommentEdit`, `repoList`, `repoView`, `searchPrs`, `api`, `graphql`,
|
|
607
607
|
`installed` and `authStatus`.
|
|
608
|
-
- `pickPrForBranch`: the first row whose head branch is exactly the one you name
|
|
609
|
-
|
|
608
|
+
- `pickPrForBranch`: the first row whose head branch is exactly the one you name. `prList({ head })`
|
|
609
|
+
already filters exactly. This is for rows from elsewhere, such as a `head:` search. It takes plain
|
|
610
|
+
rows or a `ListResult`, so `openPrsForBranch`'s or `prList`'s parsed answer passes straight in.
|
|
610
611
|
- `nodesAt`: one connection's nodes, joined across `graphql` pages.
|
|
611
612
|
- Field lists: `PR_REF_FIELDS` (enough to identify a PR), `PR_LIST_FIELDS` (for triage),
|
|
612
613
|
`PR_VIEW_FIELDS` (the full set), `REPO_FIELDS` and `SEARCH_PR_FIELDS`.
|
package/dist/async.js
CHANGED
|
@@ -133,7 +133,7 @@ export class AsyncGh {
|
|
|
133
133
|
timeoutMs: opts.timeoutMs,
|
|
134
134
|
signal: opts.signal,
|
|
135
135
|
});
|
|
136
|
-
return v.pickPrForBranch(rows
|
|
136
|
+
return v.pickPrForBranch(rows, branch);
|
|
137
137
|
}
|
|
138
138
|
/** {@link prView}, asked again until GitHub has computed the merge state. See `Gh.prViewSettled`. */
|
|
139
139
|
async prViewSettled(number, opts = {}) {
|
package/dist/sync.js
CHANGED
|
@@ -187,7 +187,7 @@ export class Gh {
|
|
|
187
187
|
fields: opts.fields ?? v.PR_REF_FIELDS,
|
|
188
188
|
timeoutMs: opts.timeoutMs,
|
|
189
189
|
});
|
|
190
|
-
return v.pickPrForBranch(rows
|
|
190
|
+
return v.pickPrForBranch(rows, branch);
|
|
191
191
|
}
|
|
192
192
|
/**
|
|
193
193
|
* {@link prView}, asked again until GitHub has computed the merge state.
|
package/dist/verbs.d.ts
CHANGED
|
@@ -487,11 +487,15 @@ export declare function createReview(number: number, opts: CreateReviewOptions,
|
|
|
487
487
|
/**
|
|
488
488
|
* The first row whose `headRefName` exactly equals `branch`, or null.
|
|
489
489
|
*
|
|
490
|
-
*
|
|
491
|
-
*
|
|
492
|
-
*
|
|
490
|
+
* Takes the rows, or the `ListResult` that {@link openPrsForBranch} and
|
|
491
|
+
* `prList` return, so their parsed answer passes straight in. Null (a failed
|
|
492
|
+
* call) stays null.
|
|
493
|
+
*
|
|
494
|
+
* `prList({ head })` already filters exactly. The filter here is for rows
|
|
495
|
+
* from anywhere else, such as a `search` query with gh's `head:` qualifier,
|
|
496
|
+
* which matches `task/foo-2` for `task/foo`.
|
|
493
497
|
*/
|
|
494
|
-
export declare function pickPrForBranch(rows: PullRequest[] | null, branch: string): PullRequest | null;
|
|
498
|
+
export declare function pickPrForBranch(rows: readonly PullRequest[] | ListResult<PullRequest> | null, branch: string): PullRequest | null;
|
|
495
499
|
/**
|
|
496
500
|
* The PR a branch names, from `prList({ head, state: 'all' })` rows: the open
|
|
497
501
|
* one, or else the first row (gh lists newest first). Null when there are no
|
package/dist/verbs.js
CHANGED
|
@@ -1078,14 +1078,19 @@ export function createReview(number, opts, target) {
|
|
|
1078
1078
|
/**
|
|
1079
1079
|
* The first row whose `headRefName` exactly equals `branch`, or null.
|
|
1080
1080
|
*
|
|
1081
|
-
*
|
|
1082
|
-
*
|
|
1083
|
-
*
|
|
1081
|
+
* Takes the rows, or the `ListResult` that {@link openPrsForBranch} and
|
|
1082
|
+
* `prList` return, so their parsed answer passes straight in. Null (a failed
|
|
1083
|
+
* call) stays null.
|
|
1084
|
+
*
|
|
1085
|
+
* `prList({ head })` already filters exactly. The filter here is for rows
|
|
1086
|
+
* from anywhere else, such as a `search` query with gh's `head:` qualifier,
|
|
1087
|
+
* which matches `task/foo-2` for `task/foo`.
|
|
1084
1088
|
*/
|
|
1085
1089
|
export function pickPrForBranch(rows, branch) {
|
|
1086
1090
|
if (rows === null)
|
|
1087
1091
|
return null;
|
|
1088
|
-
|
|
1092
|
+
const list = 'rows' in rows ? rows.rows : rows;
|
|
1093
|
+
return list.find((r) => r.headRefName === branch) ?? null;
|
|
1089
1094
|
}
|
|
1090
1095
|
/**
|
|
1091
1096
|
* The PR a branch names, from `prList({ head, state: 'all' })` rows: the open
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osdlc/typed-gh",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"description": "A typed GitHub client for TypeScript over the gh CLI. A total PullRequest/Review/CheckRun model, pure argv builders and parsers, and a tri-modal client — queries return parsed values, mutations throw, raw() is the escape hatch. Uses gh's own credentials; reads no token.",
|
|
5
5
|
"license": "MIT OR Apache-2.0",
|
|
6
6
|
"author": "sksizer",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"LICENSE-APACHE"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@osdlc/
|
|
30
|
-
"@osdlc/
|
|
31
|
-
"@osdlc/
|
|
29
|
+
"@osdlc/command-seam": "^0.14.0",
|
|
30
|
+
"@osdlc/typed-git": "^0.12.0",
|
|
31
|
+
"@osdlc/result": "^0.1.0"
|
|
32
32
|
},
|
|
33
33
|
"engines": {
|
|
34
34
|
"node": "^22.22.2 || ^24.15.0 || >=26.0.0"
|