github-repository-provider 7.25.64 → 7.26.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/README.md CHANGED
@@ -68,6 +68,8 @@ console.log(entry.name);
68
68
  * [open](#open)
69
69
  * [Parameters](#parameters-10)
70
70
  * [GithubRepository](#githubrepository)
71
+ * [commits](#commits)
72
+ * [Parameters](#parameters-11)
71
73
  * [initializeBranches](#initializebranches)
72
74
  * [initializeTags](#initializetags)
73
75
  * [urls](#urls)
@@ -75,9 +77,9 @@ console.log(entry.name);
75
77
  * [homePageURL](#homepageurl)
76
78
  * [update](#update)
77
79
  * [refId](#refid)
78
- * [Parameters](#parameters-11)
79
- * [deletePullRequest](#deletepullrequest)
80
80
  * [Parameters](#parameters-12)
81
+ * [deletePullRequest](#deletepullrequest)
82
+ * [Parameters](#parameters-13)
81
83
  * [initializeHooks](#initializehooks)
82
84
 
83
85
  ## GithubBranch
@@ -278,6 +280,16 @@ Returns **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Glob
278
280
 
279
281
  Repository on GitHub.
280
282
 
283
+ ### commits
284
+
285
+ <https://docs.github.com/en/rest/reference/commits#list-commits>
286
+
287
+ #### Parameters
288
+
289
+ * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
290
+
291
+ Returns **AsyncIterator\<Commit>**
292
+
281
293
  ### initializeBranches
282
294
 
283
295
  <https://developer.github.com/v3/repos/branches/#list-branches>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "github-repository-provider",
3
- "version": "7.25.64",
3
+ "version": "7.26.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -36,17 +36,17 @@
36
36
  "matching-iterator": "^2.0.4",
37
37
  "node-fetch": "^3.2.3",
38
38
  "one-time-execution-method": "^2.0.13",
39
- "repository-provider": "^27.0.6"
39
+ "repository-provider": "^28.0.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "ava": "^4.1.0",
43
43
  "c8": "^7.11.0",
44
44
  "documentation": "^13.2.5",
45
- "repository-provider-test-support": "^1.12.11",
45
+ "repository-provider-test-support": "^2.0.0",
46
46
  "semantic-release": "^19.0.2"
47
47
  },
48
48
  "engines": {
49
- "node": ">=14.19.0"
49
+ "node": ">=16.14.2"
50
50
  },
51
51
  "repository": {
52
52
  "type": "git",
@@ -109,17 +109,25 @@ export class GithubBranch extends Branch {
109
109
  this._entries = new Map();
110
110
  }
111
111
 
112
- const { json } = await this.provider.fetchJSON(
113
- `repos/${this.slug}/contents/${name}?ref=${this.ref}`
114
- );
112
+ const f = async () => {
113
+ const { json } = await this.provider.fetchJSON(
114
+ `repos/${this.slug}/contents/${name}?ref=${this.ref}`
115
+ );
115
116
 
116
- const entry = new this.entryClass(
117
- name,
118
- Buffer.from(json.content, "base64")
119
- );
117
+ const entry = new this.entryClass(
118
+ name,
119
+ Buffer.from(json.content, "base64")
120
+ );
120
121
 
121
- this._entries.set(name, entry);
122
- return entry;
122
+ this._entries.set(name, entry);
123
+ return entry;
124
+ };
125
+
126
+ const p = f();
127
+
128
+ this._entries.set(name, p);
129
+
130
+ return p;
123
131
  }
124
132
 
125
133
  /**
@@ -232,11 +240,17 @@ class LazyBufferContentEntry extends BufferContentEntryMixin(ContentEntry) {
232
240
  }
233
241
 
234
242
  const branch = this.branch;
235
- const { json } = await branch.provider.fetchJSON(
236
- `repos/${branch.slug}/contents/${this.name}?ref=${branch.ref}`
237
- );
238
243
 
239
- this._buffer = Buffer.from(json.content, "base64");
244
+ const f = async () => {
245
+ const { json } = await branch.provider.fetchJSON(
246
+ `repos/${branch.slug}/contents/${this.name}?ref=${branch.ref}`
247
+ );
248
+
249
+ this._buffer = Buffer.from(json.content, "base64");
250
+ return this._buffer;
251
+ };
252
+
253
+ this._buffer = f();
240
254
  return this._buffer;
241
255
  }
242
256
  }
@@ -37,6 +37,29 @@ export class GithubRepository extends Repository {
37
37
  return "main";
38
38
  }
39
39
 
40
+ /**
41
+ * {@link https://docs.github.com/en/rest/reference/commits#list-commits}
42
+ * @param {Object} options
43
+ * @returns {AsyncIterator<Commit>}
44
+ */
45
+ async *commits(options) {
46
+ let next = `repos/${this.slug}/commits`;
47
+
48
+ do {
49
+ const { response, json } = await this.provider.fetchJSON(next);
50
+
51
+ for(const c of json) {
52
+ yield {
53
+ sha: c.sha,
54
+ message: c.message,
55
+ author: c.author,
56
+ committer: c.committer,
57
+ };
58
+ }
59
+ next = getHeaderLink(response.headers);
60
+ } while (next);
61
+ }
62
+
40
63
  async _initializeSlot(typeName, addMethodName) {
41
64
  let next = `repos/${this.slug}/${typeName}`;
42
65