github-repository-provider 7.26.36 → 7.26.39

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.26.36",
3
+ "version": "7.26.39",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -95,18 +95,22 @@ export class GithubBranch extends Branch {
95
95
  return r.json;
96
96
  }
97
97
 
98
+ #entries;
99
+ #tree;
100
+ #commitForSha;
101
+
98
102
  /**
99
103
  * {@link https://developer.github.com/v3/repos/contents/#get-repository-content}
100
104
  * @param {string} name
101
105
  */
102
106
  async entry(name) {
103
- if (this._entries) {
104
- const entry = this._entries.get(name);
107
+ if (this.#entries) {
108
+ const entry = this.#entries.get(name);
105
109
  if (entry) {
106
110
  return entry;
107
111
  }
108
112
  } else {
109
- this._entries = new Map();
113
+ this.#entries = new Map();
110
114
  }
111
115
 
112
116
  const f = async () => {
@@ -119,13 +123,13 @@ export class GithubBranch extends Branch {
119
123
  Buffer.from(json.content, "base64")
120
124
  );
121
125
 
122
- this._entries.set(name, entry);
126
+ this.#entries.set(name, entry);
123
127
  return entry;
124
128
  };
125
129
 
126
130
  const p = f();
127
131
 
128
- this._entries.set(name, p);
132
+ this.#entries.set(name, p);
129
133
 
130
134
  return p;
131
135
  }
@@ -136,20 +140,20 @@ export class GithubBranch extends Branch {
136
140
  * @return {Object} response
137
141
  */
138
142
  async commitForSha(sha) {
139
- if (this._commitForSha) {
140
- const json = this._commitForSha.get(sha);
143
+ if (this.#commitForSha) {
144
+ const json = this.#commitForSha.get(sha);
141
145
  if (json) {
142
146
  return json;
143
147
  }
144
148
  } else {
145
- this._commitForSha = new Map();
149
+ this.#commitForSha = new Map();
146
150
  }
147
151
 
148
152
  const { json } = await this.provider.fetchJSON(
149
153
  `repos/${this.slug}/git/commits/${sha}`
150
154
  );
151
155
 
152
- this._commitForSha.set(sha, json);
156
+ this.#commitForSha.set(sha, json);
153
157
 
154
158
  return json;
155
159
  }
@@ -160,13 +164,13 @@ export class GithubBranch extends Branch {
160
164
  * @return {Object[]}
161
165
  */
162
166
  async tree(sha) {
163
- if (this._tree) {
164
- const tree = this._tree.get(sha);
167
+ if (this.#tree) {
168
+ const tree = this.#tree.get(sha);
165
169
  if (tree) {
166
170
  return tree;
167
171
  }
168
172
  } else {
169
- this._tree = new Map();
173
+ this.#tree = new Map();
170
174
  }
171
175
 
172
176
  const { json } = await this.provider.fetchJSON(
@@ -175,7 +179,7 @@ export class GithubBranch extends Branch {
175
179
 
176
180
  const tree = json.tree;
177
181
 
178
- this._tree.set(sha, tree);
182
+ this.#tree.set(sha, tree);
179
183
 
180
184
  return tree;
181
185
  }
@@ -183,8 +187,8 @@ export class GithubBranch extends Branch {
183
187
  async *entries(patterns) {
184
188
  const commit = await this.commitForSha(await this.refId());
185
189
 
186
- if (!this._entries) {
187
- this._entries = new Map();
190
+ if (!this.#entries) {
191
+ this.#entries = new Map();
188
192
  }
189
193
 
190
194
  for (const entry of matcher(await this.tree(commit.tree.sha), patterns, {
@@ -200,7 +204,7 @@ export class GithubBranch extends Branch {
200
204
  parseInt(entry.mode, 8),
201
205
  this
202
206
  );
203
- this._entries.set(e.path, e);
207
+ this.#entries.set(e.path, e);
204
208
  yield e;
205
209
  break;
206
210
  /* case "commit":
@@ -234,9 +238,11 @@ class LazyBufferContentEntry extends BufferContentEntryMixin(ContentEntry) {
234
238
  return this.getBuffer();
235
239
  }
236
240
 
241
+ #buffer;
242
+
237
243
  async getBuffer() {
238
- if (this._buffer) {
239
- return this._buffer;
244
+ if (this.#buffer) {
245
+ return this.#buffer;
240
246
  }
241
247
 
242
248
  const branch = this.branch;
@@ -246,11 +252,11 @@ class LazyBufferContentEntry extends BufferContentEntryMixin(ContentEntry) {
246
252
  `repos/${branch.slug}/contents/${this.name}?ref=${branch.ref}`
247
253
  );
248
254
 
249
- this._buffer = Buffer.from(json.content, "base64");
250
- return this._buffer;
255
+ this.#buffer = Buffer.from(json.content, "base64");
256
+ return this.#buffer;
251
257
  };
252
258
 
253
- this._buffer = f();
254
- return this._buffer;
259
+ this.#buffer = f();
260
+ return this.#buffer;
255
261
  }
256
262
  }
@@ -128,6 +128,9 @@ export class GithubRepository extends Repository {
128
128
  });
129
129
  }
130
130
 
131
+
132
+ #ref;
133
+
131
134
  /**
132
135
  * Get sha of a ref.
133
136
  * {@link https://developer.github.com/v3/git/refs/}
@@ -137,13 +140,13 @@ export class GithubRepository extends Repository {
137
140
  async refId(ref) {
138
141
  ref = ref.replace(/^refs\//, "");
139
142
 
140
- if (this._ref) {
141
- const sha = this._ref.get(ref);
143
+ if (this.#ref) {
144
+ const sha = this.#ref.get(ref);
142
145
  if (sha) {
143
146
  return sha;
144
147
  }
145
148
  } else {
146
- this._ref = new Map();
149
+ this.#ref = new Map();
147
150
  }
148
151
 
149
152
  const { response, json } = await this.provider.fetchJSON(
@@ -158,7 +161,7 @@ export class GithubRepository extends Repository {
158
161
 
159
162
  const sha = json.object.sha;
160
163
 
161
- this._ref.set(ref, sha);
164
+ this.#ref.set(ref, sha);
162
165
 
163
166
  return sha;
164
167
  }
@@ -236,7 +239,7 @@ export class GithubRepository extends Repository {
236
239
  });
237
240
 
238
241
  if (res.ok) {
239
- this._pullRequests.delete(name);
242
+ super.deletePullRequest(name);
240
243
  }
241
244
  }
242
245