github-repository-provider 7.25.2 → 7.25.6

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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2017-2021 by arlac77
1
+ Copyright (c) 2017-2022 by arlac77
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
package/README.md CHANGED
@@ -36,13 +36,13 @@ console.log(entry.name);
36
36
  * [GithubBranch](#githubbranch)
37
37
  * [writeEntry](#writeentry)
38
38
  * [Parameters](#parameters)
39
- * [baseTreeSha](#basetreesha)
40
- * [Parameters](#parameters-1)
41
39
  * [commit](#commit)
42
- * [Parameters](#parameters-2)
40
+ * [Parameters](#parameters-1)
43
41
  * [entry](#entry)
44
- * [Parameters](#parameters-3)
42
+ * [Parameters](#parameters-2)
45
43
  * [maybeEntry](#maybeentry)
44
+ * [Parameters](#parameters-3)
45
+ * [baseTreeSha](#basetreesha)
46
46
  * [Parameters](#parameters-4)
47
47
  * [tree](#tree)
48
48
  * [Parameters](#parameters-5)
@@ -99,14 +99,6 @@ Writes content into the branch
99
99
 
100
100
  Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<ConentEntry>** written content with sha values set
101
101
 
102
- ### baseTreeSha
103
-
104
- <https://developer.github.com/v3/git/commits/#get-a-commit>
105
-
106
- #### Parameters
107
-
108
- * `sha` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
109
-
110
102
  ### commit
111
103
 
112
104
  <https://developer.github.com/v3/git/trees/#create-a-tree>
@@ -133,6 +125,14 @@ Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
133
125
 
134
126
  * `name`
135
127
 
128
+ ### baseTreeSha
129
+
130
+ <https://developer.github.com/v3/git/commits/#get-a-commit>
131
+
132
+ #### Parameters
133
+
134
+ * `sha` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
135
+
136
136
  ### tree
137
137
 
138
138
  * **See**: <https://developer.github.com/v3/git/trees/>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "github-repository-provider",
3
- "version": "7.25.2",
3
+ "version": "7.25.6",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -32,14 +32,14 @@
32
32
  "dependencies": {
33
33
  "content-entry": "^3.0.2",
34
34
  "fetch-link-util": "^1.0.4",
35
- "fetch-rate-limit-util": "^2.1.0",
35
+ "fetch-rate-limit-util": "^2.4.2",
36
36
  "matching-iterator": "^2.0.0",
37
37
  "node-fetch": "3.1.0",
38
38
  "one-time-execution-method": "^2.0.9",
39
- "repository-provider": "^26.1.1"
39
+ "repository-provider": "^26.1.2"
40
40
  },
41
41
  "devDependencies": {
42
- "ava": "^3.15.0",
42
+ "ava": "^4.0.0",
43
43
  "c8": "^7.11.0",
44
44
  "documentation": "^13.2.5",
45
45
  "repository-provider-test-support": "^1.9.2",
@@ -107,30 +107,21 @@ export class GithubProvider extends MultiGroupProvider {
107
107
  });
108
108
  }
109
109
 
110
- async fetchJSON(url, options) {
111
- for (let i = 1; ; i++) {
112
- try {
113
- const response = await this.fetch(url, options);
114
- if (response.ok) {
115
- return { response, json: await response.json() };
110
+ fetchJSON(url, options = {}) {
111
+ return stateActionHandler(
112
+ fetch,
113
+ new URL(url, this.api),
114
+ {
115
+ ...options,
116
+ headers: {
117
+ authorization: `token ${this.authentication.token}`,
118
+ ...options.headers
116
119
  }
117
-
118
- if (i >= 3 || response.status == 401) {
119
- // none repeatable
120
- throw new Error(
121
- `Unable to fetch ${response.url} (${response.status})`
122
- );
123
- }
124
- this.info(
125
- `Unable to fetch ${response.url} (${response.status}) try #${i}`
126
- );
127
- } catch (e) {
128
- if (i >= 3) {
129
- throw e;
130
- }
131
- this.error(e);
120
+ },
121
+ async response => {
122
+ return { response, json: await response.json() };
132
123
  }
133
- }
124
+ );
134
125
  }
135
126
 
136
127
  /**