github-repository-provider 7.23.29 → 7.23.33
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/README.md +2 -0
- package/package.json +5 -5
- package/src/github-branch.mjs +21 -18
package/README.md
CHANGED
|
@@ -141,6 +141,8 @@ Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
|
|
|
141
141
|
|
|
142
142
|
* `tree_sha`
|
|
143
143
|
|
|
144
|
+
Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>**
|
|
145
|
+
|
|
144
146
|
### removeEntries
|
|
145
147
|
|
|
146
148
|
<https://developer.github.com/v3/repos/contents/>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "github-repository-provider",
|
|
3
|
-
"version": "7.23.
|
|
3
|
+
"version": "7.23.33",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -30,20 +30,20 @@
|
|
|
30
30
|
"lint:docs": "documentation lint ./src/**/*.mjs"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"content-entry": "^2.9.
|
|
33
|
+
"content-entry": "^2.9.6",
|
|
34
34
|
"fetch-link-util": "^1.0.4",
|
|
35
35
|
"fetch-rate-limit-util": "^1.1.6",
|
|
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": "^25.5.
|
|
39
|
+
"repository-provider": "^25.5.11"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"ava": "^3.15.0",
|
|
43
43
|
"c8": "^7.10.0",
|
|
44
44
|
"documentation": "^13.2.5",
|
|
45
|
-
"repository-provider-test-support": "^1.8.
|
|
46
|
-
"semantic-release": "^18.0.
|
|
45
|
+
"repository-provider-test-support": "^1.8.4",
|
|
46
|
+
"semantic-release": "^18.0.1"
|
|
47
47
|
},
|
|
48
48
|
"engines": {
|
|
49
49
|
"node": ">=14.18.1"
|
package/src/github-branch.mjs
CHANGED
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
* Branch on GitHub.
|
|
12
12
|
*/
|
|
13
13
|
export class GithubBranch extends Branch {
|
|
14
|
-
|
|
15
14
|
/**
|
|
16
15
|
* Writes content into the branch
|
|
17
16
|
* {@link https://developer.github.com/v3/git/blobs/#get-a-blob}
|
|
@@ -22,7 +21,7 @@ export class GithubBranch extends Branch {
|
|
|
22
21
|
const res = await this.provider.fetch(`repos/${this.slug}/git/blobs`, {
|
|
23
22
|
method: "POST",
|
|
24
23
|
body: JSON.stringify({
|
|
25
|
-
content: await entry.
|
|
24
|
+
content: await entry.string,
|
|
26
25
|
encoding: "utf8"
|
|
27
26
|
})
|
|
28
27
|
});
|
|
@@ -41,9 +40,9 @@ export class GithubBranch extends Branch {
|
|
|
41
40
|
const res = await this.provider.fetch(
|
|
42
41
|
`repos/${this.slug}/git/commits/${sha}`
|
|
43
42
|
);
|
|
44
|
-
if(res.ok) {
|
|
43
|
+
if (res.ok) {
|
|
45
44
|
const json = await res.json();
|
|
46
|
-
return json.tree.sha;
|
|
45
|
+
return json.tree.sha;
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
throw new Error(`Unable to decode ${res.url}`);
|
|
@@ -131,7 +130,7 @@ export class GithubBranch extends Branch {
|
|
|
131
130
|
const json = await res.json();
|
|
132
131
|
return new this.entryClass(name, Buffer.from(json.content, "base64"));
|
|
133
132
|
}
|
|
134
|
-
|
|
133
|
+
|
|
135
134
|
throw new Error(res.status);
|
|
136
135
|
}
|
|
137
136
|
|
|
@@ -140,29 +139,33 @@ export class GithubBranch extends Branch {
|
|
|
140
139
|
const res = await this.provider.fetch(
|
|
141
140
|
`repos/${this.slug}/contents/${name}?ref=${this.ref}`
|
|
142
141
|
);
|
|
143
|
-
if(res.ok) {
|
|
142
|
+
if (res.ok) {
|
|
144
143
|
const json = await res.json();
|
|
145
|
-
return new this.entryClass(name, Buffer.from(json.content, "base64"));
|
|
144
|
+
return new this.entryClass(name, Buffer.from(json.content, "base64"));
|
|
146
145
|
}
|
|
147
146
|
}
|
|
148
147
|
|
|
149
148
|
/**
|
|
150
149
|
* @see https://developer.github.com/v3/git/trees/
|
|
151
150
|
* @param tree_sha
|
|
151
|
+
* @return {Object[]}
|
|
152
152
|
*/
|
|
153
153
|
async tree(tree_sha) {
|
|
154
154
|
const url = `repos/${this.slug}/git/trees/${tree_sha}?recursive=1`;
|
|
155
|
-
let res;
|
|
156
155
|
|
|
157
|
-
|
|
156
|
+
let res;
|
|
157
|
+
for (const i = 0; i < 3; i++) {
|
|
158
158
|
res = await this.provider.fetch(url);
|
|
159
|
-
if(res.ok) {
|
|
160
|
-
|
|
161
|
-
|
|
159
|
+
if (res.ok) {
|
|
160
|
+
const json = await res.json();
|
|
161
|
+
return json.tree;
|
|
162
|
+
}
|
|
162
163
|
}
|
|
163
164
|
|
|
164
|
-
|
|
165
|
-
|
|
165
|
+
// errno: 'ERR_STREAM_PREMATURE_CLOSE',
|
|
166
|
+
// code: 'ERR_STREAM_PREMATURE_CLOSE',
|
|
167
|
+
|
|
168
|
+
throw new Error(res.status);
|
|
166
169
|
}
|
|
167
170
|
|
|
168
171
|
async *entries(patterns) {
|
|
@@ -198,9 +201,7 @@ export class GithubBranch extends Branch {
|
|
|
198
201
|
class LazyBufferContentEntry extends BufferContentEntryMixin(ContentEntry) {
|
|
199
202
|
constructor(name, branch) {
|
|
200
203
|
super(name);
|
|
201
|
-
|
|
202
|
-
branch: { value: branch }
|
|
203
|
-
});
|
|
204
|
+
this.branch = branch;
|
|
204
205
|
}
|
|
205
206
|
|
|
206
207
|
get buffer() {
|
|
@@ -208,7 +209,9 @@ class LazyBufferContentEntry extends BufferContentEntryMixin(ContentEntry) {
|
|
|
208
209
|
}
|
|
209
210
|
|
|
210
211
|
async getBuffer() {
|
|
211
|
-
if(this._buffer) {
|
|
212
|
+
if (this._buffer) {
|
|
213
|
+
return this._buffer;
|
|
214
|
+
}
|
|
212
215
|
|
|
213
216
|
const branch = this.branch;
|
|
214
217
|
const res = await branch.provider.fetch(
|