github-repository-provider 7.30.17 → 7.30.18
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 +11 -11
- package/package.json +1 -1
- package/src/github-repository.mjs +7 -11
package/README.md
CHANGED
|
@@ -38,11 +38,11 @@ console.log(entry.name);
|
|
|
38
38
|
* [Parameters](#parameters)
|
|
39
39
|
* [commit](#commit)
|
|
40
40
|
* [Parameters](#parameters-1)
|
|
41
|
-
* [entry](#entry)
|
|
42
|
-
* [Parameters](#parameters-2)
|
|
43
41
|
* [commitForSha](#commitforsha)
|
|
44
|
-
* [Parameters](#parameters-
|
|
42
|
+
* [Parameters](#parameters-2)
|
|
45
43
|
* [tree](#tree)
|
|
44
|
+
* [Parameters](#parameters-3)
|
|
45
|
+
* [entry](#entry)
|
|
46
46
|
* [Parameters](#parameters-4)
|
|
47
47
|
* [removeEntries](#removeentries)
|
|
48
48
|
* [Parameters](#parameters-5)
|
|
@@ -113,14 +113,6 @@ Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
|
|
|
113
113
|
* `entries` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<ContentEntry>**
|
|
114
114
|
* `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
|
|
115
115
|
|
|
116
|
-
### entry
|
|
117
|
-
|
|
118
|
-
<https://developer.github.com/v3/repos/contents/#get-repository-content>
|
|
119
|
-
|
|
120
|
-
#### Parameters
|
|
121
|
-
|
|
122
|
-
* `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
|
123
|
-
|
|
124
116
|
### commitForSha
|
|
125
117
|
|
|
126
118
|
<https://developer.github.com/v3/git/commits/#get-a-commit>
|
|
@@ -141,6 +133,14 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
|
|
|
141
133
|
|
|
142
134
|
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)>**
|
|
143
135
|
|
|
136
|
+
### entry
|
|
137
|
+
|
|
138
|
+
<https://developer.github.com/v3/repos/contents/#get-repository-content>
|
|
139
|
+
|
|
140
|
+
#### Parameters
|
|
141
|
+
|
|
142
|
+
* `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
|
143
|
+
|
|
144
144
|
### removeEntries
|
|
145
145
|
|
|
146
146
|
<https://developer.github.com/v3/repos/contents/>
|
package/package.json
CHANGED
|
@@ -12,6 +12,8 @@ const conflictErrorActions = {
|
|
|
12
12
|
* Repository on GitHub.
|
|
13
13
|
*/
|
|
14
14
|
export class GithubRepository extends Repository {
|
|
15
|
+
#ref = new Map();
|
|
16
|
+
|
|
15
17
|
static get attributeMapping() {
|
|
16
18
|
return {
|
|
17
19
|
...super.attributeMapping,
|
|
@@ -140,8 +142,6 @@ export class GithubRepository extends Repository {
|
|
|
140
142
|
});
|
|
141
143
|
}
|
|
142
144
|
|
|
143
|
-
#ref;
|
|
144
|
-
|
|
145
145
|
/**
|
|
146
146
|
* Get sha of a ref.
|
|
147
147
|
* {@link https://developer.github.com/v3/git/refs/}
|
|
@@ -151,13 +151,9 @@ export class GithubRepository extends Repository {
|
|
|
151
151
|
async refId(ref) {
|
|
152
152
|
ref = ref.replace(/^refs\//, "");
|
|
153
153
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
return sha;
|
|
158
|
-
}
|
|
159
|
-
} else {
|
|
160
|
-
this.#ref = new Map();
|
|
154
|
+
let sha = this.#ref.get(ref);
|
|
155
|
+
if (sha) {
|
|
156
|
+
return sha;
|
|
161
157
|
}
|
|
162
158
|
|
|
163
159
|
const { response, json } = await this.provider.fetchJSON(
|
|
@@ -169,7 +165,7 @@ export class GithubRepository extends Repository {
|
|
|
169
165
|
throw new Error(`No refId for '${this.fullName}' '${ref}'`);
|
|
170
166
|
}
|
|
171
167
|
|
|
172
|
-
|
|
168
|
+
sha = json.object.sha;
|
|
173
169
|
|
|
174
170
|
this.#ref.set(ref, sha);
|
|
175
171
|
|
|
@@ -192,7 +188,7 @@ export class GithubRepository extends Repository {
|
|
|
192
188
|
this.#ref.set(ref, sha);
|
|
193
189
|
}
|
|
194
190
|
|
|
195
|
-
//console.log(r.response.ok, r.response.status, r.json);
|
|
191
|
+
//console.log(ref, sha, r.response.ok, r.response.status, r.json);
|
|
196
192
|
|
|
197
193
|
return r.json;
|
|
198
194
|
}
|