repository-provider 31.2.7 → 31.2.8

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
@@ -200,7 +200,6 @@ console.log(await readme.getString());
200
200
  * [fullName](#fullname-1)
201
201
  * [toJSON](#tojson-1)
202
202
  * [attributes](#attributes-1)
203
- * [avatarURL](#avatarurl)
204
203
  * [homePageURL](#homepageurl)
205
204
  * [OwnedObject](#ownedobject)
206
205
  * [Parameters](#parameters-45)
@@ -268,6 +267,7 @@ console.log(await readme.getString());
268
267
  * [type](#type-1)
269
268
  * [url](#url-3)
270
269
  * [url](#url-4)
270
+ * [avatarURL](#avatarurl)
271
271
  * [RepositoryOwner](#repositoryowner)
272
272
  * [Parameters](#parameters-57)
273
273
  * [Repository](#repository-3)
@@ -1193,12 +1193,6 @@ Provided name and all defined attributes.
1193
1193
 
1194
1194
  options
1195
1195
 
1196
- ## avatarURL
1197
-
1198
- Avatar.
1199
-
1200
- Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
1201
-
1202
1196
  ## homePageURL
1203
1197
 
1204
1198
  The url of home page.
@@ -1591,6 +1585,12 @@ URL of the repository
1591
1585
 
1592
1586
  Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
1593
1587
 
1588
+ ## avatarURL
1589
+
1590
+ Avatar.
1591
+
1592
+ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
1593
+
1594
1594
  ## RepositoryOwner
1595
1595
 
1596
1596
  Mixin to define a class able to handle a collection of repositories.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repository-provider",
3
- "version": "31.2.7",
3
+ "version": "31.2.8",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -36,9 +36,9 @@
36
36
  "ava": "^4.3.0",
37
37
  "c8": "^7.11.3",
38
38
  "documentation": "^13.2.5",
39
- "repository-provider-test-support": "^2.2.4",
39
+ "repository-provider-test-support": "^2.2.5",
40
40
  "semantic-release": "^19.0.3",
41
- "typescript": "^4.7.3"
41
+ "typescript": "^4.7.4"
42
42
  },
43
43
  "engines": {
44
44
  "node": ">=16.15.1"
@@ -81,7 +81,15 @@ export function RepositoryOwner(base) {
81
81
  );
82
82
  }
83
83
 
84
- async _lookup(type, name, split, defaultItem) {
84
+ /**
85
+ * Lookup entity of a given type and name.
86
+ * @param {string} type
87
+ * @param {string} name
88
+ * @param {function} split
89
+ * @param {Object} defaultItem
90
+ * @returns {NamedObject} from a repository
91
+ */
92
+ async lookup(type, name, split, defaultItem) {
85
93
  if (name !== undefined) {
86
94
  await this.initializeRepositories();
87
95
 
@@ -100,7 +108,15 @@ export function RepositoryOwner(base) {
100
108
  }
101
109
  }
102
110
 
103
- async *_list(type, patterns, split, defaultItem) {
111
+ /**
112
+ * List entities for a given type and pattern.
113
+ * @param {string} type
114
+ * @param {string|string[]} patterns
115
+ * @param {function} split
116
+ * @param {Object} defaultItem
117
+ * @return {AsyncIterator<NamedObject>} matching type and pattern
118
+ */
119
+ async *list(type, patterns, split, defaultItem) {
104
120
  await this.initializeRepositories();
105
121
 
106
122
  patterns = stripBaseNames(patterns, this.provider.repositoryBases);
@@ -175,7 +191,7 @@ export function RepositoryOwner(base) {
175
191
  * @return {Promise<Branch|undefined>}
176
192
  */
177
193
  async branch(name) {
178
- return this._lookup(
194
+ return this.lookup(
179
195
  "branch",
180
196
  name,
181
197
  name => name.split(/#/),
@@ -189,7 +205,7 @@ export function RepositoryOwner(base) {
189
205
  * @return {AsyncIterator<Branch>} all matching branches of the owner
190
206
  */
191
207
  async *branches(patterns) {
192
- yield* this._list(
208
+ yield* this.list(
193
209
  "branches",
194
210
  patterns,
195
211
  pattern => pattern.split(/#/),
@@ -198,51 +214,51 @@ export function RepositoryOwner(base) {
198
214
  }
199
215
 
200
216
  async tag(name) {
201
- return this._lookup("tag", name, name => name.split(/#/));
217
+ return this.lookup("tag", name, name => name.split(/#/));
202
218
  }
203
219
 
204
220
  async *tags(patterns) {
205
- yield* this._list("tags", patterns, pattern => pattern.split(/#/));
221
+ yield* this.list("tags", patterns, pattern => pattern.split(/#/));
206
222
  }
207
223
 
208
224
  async pullRequest(name) {
209
- return this._lookup("pullRequest", name);
225
+ return this.lookup("pullRequest", name);
210
226
  }
211
227
 
212
228
  async *pullRequests(patterns) {
213
- yield* this._list("pullRequests", patterns);
229
+ yield* this.list("pullRequests", patterns);
214
230
  }
215
231
 
216
232
  async project(name) {
217
- return this._lookup("project", name);
233
+ return this.lookup("project", name);
218
234
  }
219
235
 
220
236
  async *projects(patterns) {
221
- yield* this._list("projects", patterns);
237
+ yield* this.list("projects", patterns);
222
238
  }
223
239
 
224
240
  async application(name) {
225
- return this._lookup("application", name);
241
+ return this.lookup("application", name);
226
242
  }
227
243
 
228
244
  async *applications(patterns) {
229
- yield* this._list("applications", patterns);
245
+ yield* this.list("applications", patterns);
230
246
  }
231
247
 
232
248
  async milestone(name) {
233
- return this._lookup("milestone", name);
249
+ return this.lookup("milestone", name);
234
250
  }
235
251
 
236
252
  async *milestones(patterns) {
237
- yield* this._list("milestones", patterns);
253
+ yield* this.list("milestones", patterns);
238
254
  }
239
255
 
240
256
  async hook(name) {
241
- return this._lookup("hook", name);
257
+ return this.lookup("hook", name);
242
258
  }
243
259
 
244
260
  async *hooks(patterns) {
245
- yield* this._list("hooks", patterns);
261
+ yield* this.list("hooks", patterns);
246
262
  }
247
263
  };
248
264
  }
@@ -465,16 +465,6 @@ export class Repository extends OwnedObject {
465
465
  */
466
466
  async refId(ref) {}
467
467
 
468
- /**
469
- * Provide name and all defined attributes
470
- */
471
- toJSON() {
472
- return optionJSON(this, {
473
- name: this.name,
474
- fullName: this.fullName,
475
- });
476
- }
477
-
478
468
  initialize() {}
479
469
 
480
470
  initializeHooks() {