repository-provider 31.2.6 → 31.2.9

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)
@@ -328,7 +328,6 @@ console.log(await readme.getString());
328
328
  * [type](#type-2)
329
329
  * [refId](#refid-1)
330
330
  * [Parameters](#parameters-78)
331
- * [toJSON](#tojson-2)
332
331
  * [attributes](#attributes-3)
333
332
  * [defaultBranchName](#defaultbranchname)
334
333
  * [issuesURL](#issuesurl-2)
@@ -1193,12 +1192,6 @@ Provided name and all defined attributes.
1193
1192
 
1194
1193
  options
1195
1194
 
1196
- ## avatarURL
1197
-
1198
- Avatar.
1199
-
1200
- Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
1201
-
1202
1195
  ## homePageURL
1203
1196
 
1204
1197
  The url of home page.
@@ -1591,6 +1584,12 @@ URL of the repository
1591
1584
 
1592
1585
  Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
1593
1586
 
1587
+ ## avatarURL
1588
+
1589
+ Avatar.
1590
+
1591
+ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
1592
+
1594
1593
  ## RepositoryOwner
1595
1594
 
1596
1595
  Mixin to define a class able to handle a collection of repositories.
@@ -1920,10 +1919,6 @@ Get sha of a ref.
1920
1919
 
1921
1920
  Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** sha of the ref
1922
1921
 
1923
- ### toJSON
1924
-
1925
- Provide name and all defined attributes
1926
-
1927
1922
  ### attributes
1928
1923
 
1929
1924
  options
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repository-provider",
3
- "version": "31.2.6",
3
+ "version": "31.2.9",
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.2",
40
- "semantic-release": "^19.0.2",
41
- "typescript": "^4.7.3"
39
+ "repository-provider-test-support": "^2.2.6",
40
+ "semantic-release": "^19.0.3",
41
+ "typescript": "^4.7.4"
42
42
  },
43
43
  "engines": {
44
44
  "node": ">=16.15.1"
@@ -20,11 +20,6 @@ export class NamedObject extends BaseObject {
20
20
  type: "string",
21
21
  isKey: true
22
22
  },
23
- /**
24
- * Avatar.
25
- * @return {string}
26
- */
27
- avatarURL: { type: "url" },
28
23
 
29
24
  /**
30
25
  * The url of home page.
package/src/ref.mjs CHANGED
@@ -39,11 +39,10 @@ export class Ref extends OwnedObject {
39
39
 
40
40
  /**
41
41
  * Get sha of a ref.
42
- * @param {string} ref
43
42
  * @return {Promise<string>} sha of the ref
44
43
  */
45
- async refId(ref = this.ref) {
46
- return this.owner.refId(ref);
44
+ async refId() {
45
+ return this.owner.refId(this.ref);
47
46
  }
48
47
 
49
48
  /**
@@ -45,6 +45,12 @@ export class RepositoryGroup extends RepositoryOwner(OwnedObject) {
45
45
  */
46
46
  url: { type: "url" },
47
47
 
48
+ /**
49
+ * Avatar.
50
+ * @return {string}
51
+ */
52
+ avatarURL: { type: "url" },
53
+
48
54
  isAdmin: { type: "boolean", default: false }
49
55
  };
50
56
  }
@@ -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() {