github-repository-provider 7.25.53 → 7.25.56

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
@@ -125,6 +125,8 @@ Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
125
125
 
126
126
  * `sha` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
127
127
 
128
+ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** sha
129
+
128
130
  ### tree
129
131
 
130
132
  * **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.53",
3
+ "version": "7.25.56",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -31,8 +31,8 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "content-entry": "^4.1.9",
34
- "fetch-link-util": "^1.0.6",
35
- "fetch-rate-limit-util": "^2.4.10",
34
+ "fetch-link-util": "^1.0.7",
35
+ "fetch-rate-limit-util": "^2.4.11",
36
36
  "matching-iterator": "^2.0.3",
37
37
  "node-fetch": "^3.2.3",
38
38
  "one-time-execution-method": "^2.0.13",
@@ -55,14 +55,14 @@ export class GithubBranch extends Branch {
55
55
  */
56
56
 
57
57
  const shaLatestCommit = await this.refId();
58
- const shaBaseTree = await this.baseTreeSha(shaLatestCommit);
58
+ const commit = await this.commitForSha(shaLatestCommit);
59
59
 
60
60
  let { json } = await this.provider.fetchJSON(
61
61
  `repos/${this.slug}/git/trees`,
62
62
  {
63
63
  method: "POST",
64
64
  body: JSON.stringify({
65
- base_tree: shaBaseTree,
65
+ base_tree: commit.tree.sha,
66
66
  tree: updates.map(u => {
67
67
  return {
68
68
  path: u.name,
@@ -113,26 +113,25 @@ export class GithubBranch extends Branch {
113
113
  /**
114
114
  * {@link https://developer.github.com/v3/git/commits/#get-a-commit}
115
115
  * @param {string} sha
116
+ * @return {Object} response
116
117
  */
117
- async baseTreeSha(sha) {
118
- if (this._baseTreeSha) {
119
- const r = this._baseTreeSha.get(sha);
120
- if (r) {
121
- console.log("HIT", sha, r);
122
- return r;
118
+ async commitForSha(sha) {
119
+ if (this._commitForSha) {
120
+ const json = this._commitForSha.get(sha);
121
+ if (json) {
122
+ return json;
123
123
  }
124
124
  } else {
125
- this._baseTreeSha = new Map();
125
+ this._commitForSha = new Map();
126
126
  }
127
127
 
128
128
  const { json } = await this.provider.fetchJSON(
129
129
  `repos/${this.slug}/git/commits/${sha}`
130
130
  );
131
131
 
132
- const r = json.tree.sha;
133
- this._baseTreeSha.set(sha, r);
134
-
135
- return r;
132
+ this._commitForSha.set(sha, json);
133
+
134
+ return json;
136
135
  }
137
136
 
138
137
  /**
@@ -148,9 +147,9 @@ export class GithubBranch extends Branch {
148
147
  }
149
148
 
150
149
  async *entries(patterns) {
151
- const shaBaseTree = await this.baseTreeSha(await this.refId());
150
+ const commit = await this.commitForSha(await this.refId());
152
151
 
153
- for (const entry of matcher(await this.tree(shaBaseTree), patterns, {
152
+ for (const entry of matcher(await this.tree(commit.tree.sha), patterns, {
154
153
  name: "path"
155
154
  })) {
156
155
  switch (entry.type) {