github-repository-provider 7.25.1 → 7.25.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "github-repository-provider",
3
- "version": "7.25.1",
3
+ "version": "7.25.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -32,7 +32,7 @@
32
32
  "dependencies": {
33
33
  "content-entry": "^3.0.2",
34
34
  "fetch-link-util": "^1.0.4",
35
- "fetch-rate-limit-util": "^2.0.2",
35
+ "fetch-rate-limit-util": "^2.1.0",
36
36
  "matching-iterator": "^2.0.0",
37
37
  "node-fetch": "3.1.0",
38
38
  "one-time-execution-method": "^2.0.9",
@@ -42,7 +42,7 @@
42
42
  "ava": "^3.15.0",
43
43
  "c8": "^7.11.0",
44
44
  "documentation": "^13.2.5",
45
- "repository-provider-test-support": "^1.9.1",
45
+ "repository-provider-test-support": "^1.9.2",
46
46
  "semantic-release": "^18.0.1"
47
47
  },
48
48
  "engines": {
@@ -34,17 +34,6 @@ export class GithubBranch extends Branch {
34
34
  return entry;
35
35
  }
36
36
 
37
- /**
38
- * {@link https://developer.github.com/v3/git/commits/#get-a-commit}
39
- * @param {string} sha
40
- */
41
- async baseTreeSha(sha) {
42
- const { json } = await this.provider.fetchJSON(
43
- `repos/${this.slug}/git/commits/${sha}`
44
- );
45
- return json.tree.sha;
46
- }
47
-
48
37
  /**
49
38
  * {@link https://developer.github.com/v3/git/trees/#create-a-tree}
50
39
  * {@link https://developer.github.com/v3/git/commits/#create-a-commit}
@@ -135,6 +124,17 @@ export class GithubBranch extends Branch {
135
124
  }
136
125
  }
137
126
 
127
+ /**
128
+ * {@link https://developer.github.com/v3/git/commits/#get-a-commit}
129
+ * @param {string} sha
130
+ */
131
+ async baseTreeSha(sha) {
132
+ const { json } = await this.provider.fetchJSON(
133
+ `repos/${this.slug}/git/commits/${sha}`
134
+ );
135
+ return json.tree.sha;
136
+ }
137
+
138
138
  /**
139
139
  * @see https://developer.github.com/v3/git/trees/
140
140
  * @param {string } treeSha
@@ -1,6 +1,6 @@
1
1
  import fetch from "node-fetch";
2
2
  import { replaceWithOneTimeExecutionMethod } from "one-time-execution-method";
3
- import { rateLimitHandler, defaultWaitDecide } from "fetch-rate-limit-util";
3
+ import { stateActionHandler } from "fetch-rate-limit-util";
4
4
 
5
5
  import { MultiGroupProvider } from "repository-provider";
6
6
  import { GithubRepository } from "./github-repository.mjs";
@@ -98,32 +98,13 @@ export class GithubProvider extends MultiGroupProvider {
98
98
  }
99
99
 
100
100
  fetch(url, options = {}) {
101
- return rateLimitHandler(
102
- fetch,
103
- new URL(url, this.api),
104
- {
105
- ...options,
106
- headers: {
107
- authorization: `token ${this.authentication.token}`,
108
- ...options.headers
109
- }
110
- },
111
- (millisecondsToWait, rateLimitRemaining, nthTry, response) => {
112
- this.rateLimitRemaining = rateLimitRemaining;
113
-
114
- const msecs = defaultWaitDecide(
115
- millisecondsToWait,
116
- rateLimitRemaining,
117
- nthTry,
118
- response
119
- );
120
-
121
- if (msecs > 0) {
122
- this.warn(`Rate limit reached: waiting for ${msecs / 1000}s`);
123
- }
124
- return msecs;
101
+ return stateActionHandler(fetch, new URL(url, this.api), {
102
+ ...options,
103
+ headers: {
104
+ authorization: `token ${this.authentication.token}`,
105
+ ...options.headers
125
106
  }
126
- );
107
+ });
127
108
  }
128
109
 
129
110
  async fetchJSON(url, options) {