github-repository-provider 7.27.0 → 7.27.1

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.27.0",
3
+ "version": "7.27.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -10,6 +10,12 @@ import {
10
10
  * Branch on GitHub.
11
11
  */
12
12
  export class GithubBranch extends Branch {
13
+
14
+ get api()
15
+ {
16
+ return this.repository.api;
17
+ }
18
+
13
19
  /**
14
20
  * Writes content into the branch
15
21
  * {@link https://developer.github.com/v3/git/blobs/#get-a-blob}
@@ -18,7 +24,7 @@ export class GithubBranch extends Branch {
18
24
  */
19
25
  async writeEntry(entry) {
20
26
  const { json } = await this.provider.fetchJSON(
21
- `repos/${this.slug}/git/blobs`,
27
+ `${this.api}/git/blobs`,
22
28
  {
23
29
  method: "POST",
24
30
  body: JSON.stringify({
@@ -58,7 +64,7 @@ export class GithubBranch extends Branch {
58
64
  const commit = await this.commitForSha(shaLatestCommit);
59
65
 
60
66
  let { json } = await this.provider.fetchJSON(
61
- `repos/${this.slug}/git/trees`,
67
+ `${this.api}/git/trees`,
62
68
  {
63
69
  method: "POST",
64
70
  body: JSON.stringify({
@@ -75,7 +81,7 @@ export class GithubBranch extends Branch {
75
81
  }
76
82
  );
77
83
 
78
- let r = await this.provider.fetchJSON(`repos/${this.slug}/git/commits`, {
84
+ let r = await this.provider.fetchJSON(`${this.api}/git/commits`, {
79
85
  method: "POST",
80
86
  body: JSON.stringify({
81
87
  message,
@@ -84,7 +90,7 @@ export class GithubBranch extends Branch {
84
90
  })
85
91
  });
86
92
 
87
- r = await this.provider.fetchJSON(`repos/${this.slug}/git/${this.ref}`, {
93
+ r = await this.provider.fetchJSON(`${this.api}/git/${this.ref}`, {
88
94
  method: "PATCH",
89
95
  body: JSON.stringify({
90
96
  ...options,
@@ -114,9 +120,7 @@ export class GithubBranch extends Branch {
114
120
  }
115
121
 
116
122
  const f = async () => {
117
- const { json } = await this.provider.fetchJSON(
118
- `repos/${this.slug}/contents/${name}?ref=${this.ref}`
119
- );
123
+ const { json } = await this.provider.fetchJSON(`${this.api}/contents/${name}?ref=${this.ref}`);
120
124
 
121
125
  const entry = new this.entryClass(
122
126
  name,
@@ -149,9 +153,7 @@ export class GithubBranch extends Branch {
149
153
  this.#commitForSha = new Map();
150
154
  }
151
155
 
152
- const { json } = await this.provider.fetchJSON(
153
- `repos/${this.slug}/git/commits/${sha}`
154
- );
156
+ const { json } = await this.provider.fetchJSON(`${this.api}/git/commits/${sha}`);
155
157
 
156
158
  this.#commitForSha.set(sha, json);
157
159
 
@@ -173,9 +175,7 @@ export class GithubBranch extends Branch {
173
175
  this.#tree = new Map();
174
176
  }
175
177
 
176
- const { json } = await this.provider.fetchJSON(
177
- `repos/${this.slug}/git/trees/${sha}?recursive=1`
178
- );
178
+ const { json } = await this.provider.fetchJSON(`${this.api}/git/trees/${sha}?recursive=1`);
179
179
 
180
180
  const tree = json.tree;
181
181
 
@@ -219,7 +219,7 @@ export class GithubBranch extends Branch {
219
219
  */
220
220
  async removeEntries(entries) {
221
221
  for await (const entry of entries) {
222
- await this.provider.fetch(`repos/${this.slug}/contents/${entry.name}`, {
222
+ await this.provider.fetch(`${this.api}/contents/${entry.name}`, {
223
223
  method: "DELETE",
224
224
  body: JSON.stringify({ branch: this.name, message: "", sha: "" })
225
225
  });
@@ -249,7 +249,7 @@ class LazyBufferContentEntry extends BufferContentEntryMixin(ContentEntry) {
249
249
 
250
250
  const f = async () => {
251
251
  const { json } = await branch.provider.fetchJSON(
252
- `repos/${branch.slug}/contents/${this.name}?ref=${branch.ref}`
252
+ `${branch.api}/contents/${this.name}?ref=${branch.ref}`
253
253
  );
254
254
 
255
255
  this.#buffer = Buffer.from(json.content, "base64");