github-repository-provider 7.26.22 → 7.26.23
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/package.json +5 -5
- package/src/github-provider.mjs +11 -6
- package/src/github-repository.mjs +15 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "github-repository-provider",
|
|
3
|
-
"version": "7.26.
|
|
3
|
+
"version": "7.26.23",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -32,17 +32,17 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"content-entry": "^5.0.0",
|
|
34
34
|
"fetch-link-util": "^1.0.8",
|
|
35
|
-
"fetch-rate-limit-util": "^2.
|
|
35
|
+
"fetch-rate-limit-util": "^2.10.0",
|
|
36
36
|
"matching-iterator": "^2.0.4",
|
|
37
|
-
"node-fetch": "^3.2.
|
|
37
|
+
"node-fetch": "^3.2.4",
|
|
38
38
|
"one-time-execution-method": "^2.0.13",
|
|
39
|
-
"repository-provider": "^28.3.
|
|
39
|
+
"repository-provider": "^28.3.5"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"ava": "^4.2.0",
|
|
43
43
|
"c8": "^7.11.2",
|
|
44
44
|
"documentation": "^13.2.5",
|
|
45
|
-
"repository-provider-test-support": "^2.1.
|
|
45
|
+
"repository-provider-test-support": "^2.1.8",
|
|
46
46
|
"semantic-release": "^19.0.2"
|
|
47
47
|
},
|
|
48
48
|
"engines": {
|
package/src/github-provider.mjs
CHANGED
|
@@ -92,7 +92,7 @@ export class GithubProvider extends MultiGroupProvider {
|
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
fetch(url, options = {}, responseHandler) {
|
|
95
|
+
fetch(url, options = {}, responseHandler, actions) {
|
|
96
96
|
return stateActionHandler(
|
|
97
97
|
fetch,
|
|
98
98
|
new URL(url, this.api),
|
|
@@ -104,15 +104,20 @@ export class GithubProvider extends MultiGroupProvider {
|
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
106
|
responseHandler,
|
|
107
|
-
|
|
107
|
+
actions,
|
|
108
108
|
(url, ...args) => this.trace(url.toString(), ...args)
|
|
109
109
|
);
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
fetchJSON(url, options) {
|
|
113
|
-
return this.fetch(
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
fetchJSON(url, options, actions) {
|
|
113
|
+
return this.fetch(
|
|
114
|
+
url,
|
|
115
|
+
options,
|
|
116
|
+
async response => {
|
|
117
|
+
return { response, json: await response.json() };
|
|
118
|
+
},
|
|
119
|
+
actions
|
|
120
|
+
);
|
|
116
121
|
}
|
|
117
122
|
|
|
118
123
|
/**
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { replaceWithOneTimeExecutionMethod } from "one-time-execution-method";
|
|
2
2
|
import { Repository } from "repository-provider";
|
|
3
3
|
import { getHeaderLink } from "fetch-link-util";
|
|
4
|
+
import { defaultStateActions, errorHandler } from "fetch-rate-limit-util";
|
|
5
|
+
|
|
6
|
+
const confictErrorActions = {
|
|
7
|
+
...defaultStateActions,
|
|
8
|
+
409: errorHandler
|
|
9
|
+
};
|
|
4
10
|
|
|
5
11
|
/**
|
|
6
12
|
* Repository on GitHub.
|
|
@@ -39,7 +45,7 @@ export class GithubRepository extends Repository {
|
|
|
39
45
|
|
|
40
46
|
/**
|
|
41
47
|
* {@link https://docs.github.com/en/rest/reference/commits#list-commits}
|
|
42
|
-
* @param {Object} options
|
|
48
|
+
* @param {Object} options
|
|
43
49
|
* @returns {AsyncIterator<Commit>}
|
|
44
50
|
*/
|
|
45
51
|
async *commits(options) {
|
|
@@ -48,12 +54,12 @@ export class GithubRepository extends Repository {
|
|
|
48
54
|
do {
|
|
49
55
|
const { response, json } = await this.provider.fetchJSON(next);
|
|
50
56
|
|
|
51
|
-
for(const c of json) {
|
|
57
|
+
for (const c of json) {
|
|
52
58
|
yield {
|
|
53
59
|
sha: c.sha,
|
|
54
60
|
message: c.message,
|
|
55
61
|
author: c.author,
|
|
56
|
-
committer: c.committer
|
|
62
|
+
committer: c.committer
|
|
57
63
|
};
|
|
58
64
|
}
|
|
59
65
|
next = getHeaderLink(response.headers);
|
|
@@ -142,7 +148,9 @@ export class GithubRepository extends Repository {
|
|
|
142
148
|
|
|
143
149
|
// TODO: 409 -> none repeatable
|
|
144
150
|
const { response, json } = await this.provider.fetchJSON(
|
|
145
|
-
`repos/${this.slug}/git/ref/${ref}
|
|
151
|
+
`repos/${this.slug}/git/ref/${ref}`,
|
|
152
|
+
undefined,
|
|
153
|
+
confictErrorActions
|
|
146
154
|
);
|
|
147
155
|
|
|
148
156
|
// TODO why does this happen ?
|
|
@@ -182,7 +190,9 @@ export class GithubRepository extends Repository {
|
|
|
182
190
|
console.log(res);
|
|
183
191
|
*/
|
|
184
192
|
} else {
|
|
185
|
-
sha = await this.refId(
|
|
193
|
+
sha = await this.refId(
|
|
194
|
+
`heads/${from ? from.name : this.defaultBranchName}`
|
|
195
|
+
);
|
|
186
196
|
}
|
|
187
197
|
|
|
188
198
|
const res = await this.provider.fetch(`repos/${this.slug}/git/refs`, {
|