repository-provider 26.0.2 → 26.0.3

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
@@ -425,8 +425,7 @@ In other words only produce key value pairs if value is defined.
425
425
 
426
426
  * `object` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
427
427
  * `initial` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `{}`)
428
- * `attributes` (optional, default `object.constructor.attributes`)
429
- * `attibutes` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** to operator on
428
+ * `attributes` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** to operator on (optional, default `object.constructor.attributes`)
430
429
 
431
430
  Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** initial + defined values
432
431
 
@@ -776,7 +775,7 @@ Creates a new provider for a given set of options.
776
775
  * `options.instanceIdentifier` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?**
777
776
  * `env` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** taken from process.env
778
777
 
779
- Returns **Provider** newly created provider or undefined if options are not sufficient to construct a provider
778
+ Returns **[BaseProvider](#baseprovider)** newly created provider or undefined if options are not sufficient to construct a provider
780
779
 
781
780
  ## priority
782
781
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repository-provider",
3
- "version": "26.0.2",
3
+ "version": "26.0.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -25,8 +25,9 @@
25
25
  "test:ava": "ava --timeout 2m tests/*.mjs",
26
26
  "cover": "c8 -x 'tests/**/*' --temp-directory build/tmp ava --timeout 2m tests/*.mjs && c8 report -r lcov -o build/coverage --temp-directory build/tmp",
27
27
  "docs": "documentation readme --section=API ./src/**/*.mjs",
28
- "lint": "npm run lint:docs",
29
- "lint:docs": "documentation lint ./src/**/*.mjs"
28
+ "lint": "npm run lint:docs && npm run lint:tsc",
29
+ "lint:docs": "documentation lint ./src/**/*.mjs",
30
+ "lint:tsc": "tsc --allowJs --checkJs --noEmit -module nodenext -t es2022 ./src/*.mjs"
30
31
  },
31
32
  "dependencies": {
32
33
  "matching-iterator": "^2.0.0"
@@ -35,8 +36,9 @@
35
36
  "ava": "^3.15.0",
36
37
  "c8": "^7.10.0",
37
38
  "documentation": "^13.2.5",
38
- "repository-provider-test-support": "^1.8.11",
39
- "semantic-release": "^18.0.1"
39
+ "repository-provider-test-support": "^1.8.14",
40
+ "semantic-release": "^18.0.1",
41
+ "typescript": "^4.6.0-dev.20211228"
40
42
  },
41
43
  "engines": {
42
44
  "node": ">=14.18.1"
@@ -52,7 +54,8 @@
52
54
  "template": {
53
55
  "inheritFrom": [
54
56
  "arlac77/template-arlac77-github",
55
- "arlac77/template-esm-only"
57
+ "arlac77/template-esm-only",
58
+ "arlac77/template-typescript"
56
59
  ]
57
60
  }
58
61
  }
package/src/attribute.mjs CHANGED
@@ -146,7 +146,7 @@ export function getAttribute(object, name) {
146
146
  * In other words only produce key value pairs if value is defined.
147
147
  * @param {Object} object
148
148
  * @param {Object} initial
149
- * @param {Object} attibutes to operator on
149
+ * @param {Object} attributes to operator on
150
150
  * @return {Object} initial + defined values
151
151
  */
152
152
  export function optionJSON(object, initial = {}, attributes=object.constructor.attributes) {
@@ -38,6 +38,10 @@ export class BaseObject {
38
38
  */
39
39
  avatarURL: { type: "url" },
40
40
 
41
+ /**
42
+ * The url of home page.
43
+ * @return {string}
44
+ */
41
45
  homePageURL: { type: "url", writable: true }
42
46
  };
43
47
  }
@@ -4,7 +4,10 @@ import { PullRequest } from "./pull-request.mjs";
4
4
  import { RepositoryGroup } from "./repository-group.mjs";
5
5
  import { Repository } from "./repository.mjs";
6
6
  import { Branch } from "./branch.mjs";
7
+ import { Tag } from "./tag.mjs";
7
8
  import { Hook } from "./hook.mjs";
9
+ import { Project } from "./project.mjs";
10
+ import { Milestone } from "./milestone.mjs";
8
11
 
9
12
  /**
10
13
  * @typedef {Object} MessageDestination
@@ -125,7 +128,7 @@ export class BaseProvider {
125
128
  * @param {Object} options additional options
126
129
  * @param {string?} options.instanceIdentifier
127
130
  * @param {Object} env taken from process.env
128
- * @return {Provider} newly created provider or undefined if options are not sufficient to construct a provider
131
+ * @return {BaseProvider} newly created provider or undefined if options are not sufficient to construct a provider
129
132
  */
130
133
  static initialize(options = {}, env) {
131
134
  options = {
@@ -324,7 +327,7 @@ export class BaseProvider {
324
327
  /**
325
328
  * List projects.
326
329
  * @param {string[]|string} patterns
327
- * @return {Iterator<Projects>} all matching projects of the provider
330
+ * @return {AsyncIterator<Project>} all matching projects of the provider
328
331
  */
329
332
  async *projects(patterns) {
330
333
  yield* this.list("projects", patterns);
@@ -333,16 +336,16 @@ export class BaseProvider {
333
336
  /**
334
337
  * List milestones.
335
338
  * @param {string[]|string} patterns
336
- * @return {Iterator<Milestone>} all matching milestones of the provider
339
+ * @return {AsyncIterator<Milestone>} all matching milestones of the provider
337
340
  */
338
- async *projects(patterns) {
341
+ async *milestones(patterns) {
339
342
  yield* this.list("milestones", patterns);
340
343
  }
341
344
 
342
345
  /**
343
346
  * List repositories.
344
347
  * @param {string[]|string} patterns
345
- * @return {Iterator<Repository>} all matching repos of the provider
348
+ * @return {AsyncIterator<Repository>} all matching repos of the provider
346
349
  */
347
350
  async *repositories(patterns) {
348
351
  yield* this.list("repositories", patterns);
@@ -351,7 +354,7 @@ export class BaseProvider {
351
354
  /**
352
355
  * List branches.
353
356
  * @param {string[]|string} patterns
354
- * @return {Iterator<Branch>} all matching branches of the provider
357
+ * @return {AsyncIterator<Branch>} all matching branches of the provider
355
358
  */
356
359
  async *branches(patterns) {
357
360
  yield* this.list("branches", patterns);
@@ -360,7 +363,7 @@ export class BaseProvider {
360
363
  /**
361
364
  * List tags.
362
365
  * @param {string[]|string} patterns
363
- * @return {Iterator<Tag>} all matching tags of the provider
366
+ * @return {AsyncIterator<Tag>} all matching tags of the provider
364
367
  */
365
368
  async *tags(patterns) {
366
369
  yield* this.list("tags", patterns);
@@ -369,7 +372,7 @@ export class BaseProvider {
369
372
  /**
370
373
  * List hooks.
371
374
  * @param {string[]|string} patterns
372
- * @return {Iterator<Hook>} all matching hooks of the provider
375
+ * @return {AsyncIterator<Hook>} all matching hooks of the provider
373
376
  */
374
377
  async *hooks(patterns) {
375
378
  yield* this.list("hooks", patterns);
@@ -378,7 +381,7 @@ export class BaseProvider {
378
381
  /**
379
382
  * List pull requests.
380
383
  * @param {string[]|string} patterns
381
- * @return {Iterator<PullRequest>} all matching pullRequests of the provider
384
+ * @return {AsyncIterator<PullRequest>} all matching pullRequests of the provider
382
385
  */
383
386
  async *pullRequests(patterns) {
384
387
  yield* this.list("pullRequests", patterns);
@@ -408,7 +411,7 @@ export class BaseProvider {
408
411
 
409
412
  /**
410
413
  * We are our own provider.
411
- * @return {Provider} this
414
+ * @return {BaseProvider} this
412
415
  */
413
416
  get provider() {
414
417
  return this;
package/src/branch.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Ref } from "./ref.mjs";
2
2
  import { PullRequest } from "./pull-request.mjs";
3
+ import { Repository } from "./repository.mjs";
3
4
 
4
5
  /**
5
6
  * @typedef {Object} Commit
@@ -54,7 +55,7 @@ export class Branch extends Ref {
54
55
  /**
55
56
  * Delete the branch from the {@link Repository}.
56
57
  * @see {@link Repository#deleteBranch}
57
- * @return {Promise<undefined>}
58
+ * @return {Promise<any>}
58
59
  */
59
60
  async delete() {
60
61
  return this.repository.deleteBranch(this.name);
@@ -65,7 +66,7 @@ export class Branch extends Ref {
65
66
  * @param {string} message commit message
66
67
  * @param {ContentEntry[]} updates content to be commited
67
68
  * @param {Object} options
68
- * @return {CommitResult}
69
+ * @return {Promise<CommitResult>}
69
70
  */
70
71
  async commit(message, updates, options) {}
71
72
 
@@ -78,7 +79,7 @@ export class Branch extends Ref {
78
79
  * @param {boolean} options.dry do not create a branch and do not commit only create dummy PR
79
80
  * @param {boolean} options.skipWithoutCommits do not create a PR if no commits are given
80
81
  * @param {boolean} options.bodyFromCommitMessages generate body from commit messages
81
- * @return {PullRequest}
82
+ * @return {Promise<PullRequest>}
82
83
  */
83
84
  async commitIntoPullRequest(commits, options) {
84
85
  const isBranch = options.pullRequestBranch instanceof Branch;
@@ -148,7 +149,7 @@ export class Branch extends Ref {
148
149
 
149
150
  /**
150
151
  * Remove entries form the branch.
151
- * @param {Iterator <ContentEntry>} entries
152
+ * @param {AsyncIterator<ContentEntry>} entries
152
153
  */
153
154
  async removeEntries(entries) {}
154
155
 
package/src/hook.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import { optionJSON } from "./attribute.mjs";
2
2
  import { BaseObject } from "./base-object.mjs";
3
+ import { Repository } from "./repository.mjs";
3
4
 
4
5
  /**
5
6
  * Repository hook.
@@ -1,6 +1,8 @@
1
1
  import { matcher } from "matching-iterator";
2
2
  import { BaseProvider } from "./base-provider.mjs";
3
3
  import { stripBaseNames } from "./util.mjs";
4
+ import { Repository } from "./repository.mjs";
5
+ import { RepositoryGroup } from "./repository-group.mjs";
4
6
 
5
7
  /**
6
8
  * Provider supporting serveral repository groups.
@@ -16,7 +18,7 @@ export class MultiGroupProvider extends BaseProvider {
16
18
  /**
17
19
  * Lookup a repository in the provider and all of its repository groups.
18
20
  * @param {string} name of the repository
19
- * @return {Repository}
21
+ * @return {Promise<Repository>}
20
22
  */
21
23
  async repository(name) {
22
24
  const { base, group, repository } = this.parseName(name);
@@ -54,7 +56,7 @@ export class MultiGroupProvider extends BaseProvider {
54
56
  /**
55
57
  * Lookup a repository group.
56
58
  * @param {string} name of the group
57
- * @return {RepositoryGroup}
59
+ * @return {Promise<RepositoryGroup>}
58
60
  */
59
61
  async repositoryGroup(name) {
60
62
  const { base } = this.parseName(name);
@@ -69,7 +71,7 @@ export class MultiGroupProvider extends BaseProvider {
69
71
  /**
70
72
  * List groups.
71
73
  * @param {string[]|string} patterns
72
- * @return {Iterator<RepositoryGroup>} all matching repositories groups of the provider
74
+ * @return {AsyncIterator<RepositoryGroup>} all matching repositories groups of the provider
73
75
  */
74
76
  async *repositoryGroups(patterns) {
75
77
  await this.initializeRepositories();
@@ -89,7 +91,7 @@ export class MultiGroupProvider extends BaseProvider {
89
91
  * If there is already a group for the given name it will be returend instead
90
92
  * @param {string} name of the group
91
93
  * @param {Object} options
92
- * @return {RepositoryGroup}
94
+ * @return {Promise<RepositoryGroup>}
93
95
  */
94
96
  async createRepositoryGroup(name, options) {
95
97
  return this.addRepositoryGroup(name, options);
@@ -35,7 +35,7 @@ export class NamedObject extends BaseObject {
35
35
  }
36
36
 
37
37
  /**
38
- * Preserve object attributes in the backing store.
38
+ * Save object attributes in the backing store.
39
39
  */
40
40
  async update()
41
41
  {
@@ -1,5 +1,9 @@
1
1
  import { optionJSON } from "./attribute.mjs";
2
2
  import { NamedObject } from "./named-object.mjs";
3
+ import { Branch } from "./branch.mjs";
4
+ import { Repository } from "./repository.mjs";
5
+ import { Review } from "./review.mjs";
6
+ import { BaseProvider } from "./base-provider.mjs";
3
7
 
4
8
  /**
5
9
  * Abstract pull request.
@@ -55,7 +59,7 @@ export class PullRequest extends NamedObject {
55
59
  * @param {Branch?} filter.source
56
60
  * @param {Branch?} filter.destination
57
61
  * @param {Set<string>?} filter.states
58
- * @return {Iterator<PullRequest>}
62
+ * @return {AsyncIterator<PullRequest>}
59
63
  */
60
64
  static async *list(repository, filter) {}
61
65
 
@@ -206,7 +210,7 @@ export class PullRequest extends NamedObject {
206
210
  }
207
211
 
208
212
  /**
209
- * @return {Provider}
213
+ * @return {BaseProvider}
210
214
  */
211
215
  get provider() {
212
216
  return this.destination === undefined
@@ -260,7 +264,7 @@ export class PullRequest extends NamedObject {
260
264
  async decline() {}
261
265
 
262
266
  /**
263
- * @return {Interaor<Review>}
267
+ * @return {AsyncIterator<Review>}
264
268
  */
265
269
  async *reviews() {}
266
270
 
package/src/ref.mjs CHANGED
@@ -1,5 +1,11 @@
1
1
  import { NamedObject } from "./named-object.mjs";
2
2
 
3
+ /**
4
+ * @typedef {Object} ContentEntry
5
+ * @property {string} name
6
+ *
7
+ */
8
+
3
9
  /**
4
10
  * Base for Branch and Tag
5
11
  */
@@ -25,7 +31,7 @@ export class Ref extends NamedObject {
25
31
 
26
32
  /**
27
33
  * Check for equality.
28
- * @param {Branch} other
34
+ * @param {Ref} other
29
35
  * @return {boolean} true if name and repository are equal
30
36
  */
31
37
  equals(other) {
@@ -37,7 +43,7 @@ export class Ref extends NamedObject {
37
43
  }
38
44
 
39
45
  /**
40
- * ref name
46
+ * ref name.
41
47
  * @return {string} git ref of the Ref
42
48
  */
43
49
  get ref() {
@@ -47,7 +53,7 @@ export class Ref extends NamedObject {
47
53
  /**
48
54
  * Get sha of a ref.
49
55
  * @param {string} ref
50
- * @return {string} sha of the ref
56
+ * @return {Promise<string>} sha of the ref
51
57
  */
52
58
  async refId(ref = this.ref) {
53
59
  return this.repository.refId(ref);
@@ -56,13 +62,13 @@ export class Ref extends NamedObject {
56
62
  /**
57
63
  * List entries of the branch.
58
64
  * @param {string[]} matchingPatterns
59
- * @return {ContentEntry} all matching entries in the branch
65
+ * @return {AsyncIterator<ContentEntry>} all matching entries in the branch
60
66
  */
61
67
  async *entries(matchingPatterns) {}
62
68
 
63
69
  /**
64
70
  * List all entries of the branch.
65
- * @return {asyncIterator<ContentEntry>} all entries in the branch
71
+ * @return {AsyncIterator<ContentEntry>} all entries in the branch
66
72
  */
67
73
  async *[Symbol.asyncIterator]() {
68
74
  return yield* this.entries();
@@ -92,7 +98,7 @@ export class Ref extends NamedObject {
92
98
 
93
99
  /**
94
100
  * The provider we live in.
95
- * @return {Provider}
101
+ * @return {BaseProvider}
96
102
  */
97
103
  get provider() {
98
104
  return this.repository.provider;
@@ -1,9 +1,10 @@
1
1
  import { RepositoryOwner } from "./repository-owner.mjs";
2
2
  import { NamedObject } from "./named-object.mjs";
3
+ import { BaseProvider } from "./base-provider.mjs";
3
4
 
4
5
  /**
5
6
  * Abstract repository collection.
6
- * @param {Provider} provider
7
+ * @param {BaseProvider} provider
7
8
  * @param {string} name of the group
8
9
  * @param {Object} options
9
10
  * @param {string} [options.description] human readable description
@@ -11,7 +12,7 @@ import { NamedObject } from "./named-object.mjs";
11
12
  * @param {string} [options.uuid] internal id
12
13
  * @param {string} [options.url] home
13
14
  *
14
- * @property {Provider} provider
15
+ * @property {BaseProvider} provider
15
16
  * @property {string} name
16
17
  */
17
18
 
@@ -1,5 +1,6 @@
1
1
  import { matcher } from "matching-iterator";
2
2
  import { Branch } from "./branch.mjs";
3
+ import { Repository } from "./repository.mjs";
3
4
  import { asArray, stripBaseName, stripBaseNames } from "./util.mjs";
4
5
 
5
6
  /**
@@ -55,8 +56,8 @@ export function RepositoryOwner(base) {
55
56
 
56
57
  /**
57
58
  * List repositories for the owner.
58
- * @param {string[]|string} matchingPatterns
59
- * @return {Iterator<Repository>} all matching repositories of the owner
59
+ * @param {string[]|string} patterns
60
+ * @return {AsyncIterator<Repository>} all matching repositories of the owner
60
61
  */
61
62
  async *repositories(patterns) {
62
63
  patterns = asArray(patterns);
@@ -160,7 +161,7 @@ export function RepositoryOwner(base) {
160
161
  /**
161
162
  * Delete a repository.
162
163
  * @param {string} name
163
- * @return {Promise<undefined>}
164
+ * @return {Promise<any>}
164
165
  */
165
166
  async deleteRepository(name) {
166
167
  this._repositories.delete(this.normalizeRepositoryName(name, true));
@@ -188,7 +189,7 @@ export function RepositoryOwner(base) {
188
189
  /**
189
190
  * List branches for the owner.
190
191
  * @param {string[]|string} patterns
191
- * @return {Iterator<Branch>} all matching branches of the owner
192
+ * @return {AsyncIterator<Branch>} all matching branches of the owner
192
193
  */
193
194
  async *branches(patterns) {
194
195
  yield* this._list(
@@ -1,6 +1,11 @@
1
1
  import { matcher } from "matching-iterator";
2
2
  import { optionJSON } from "./attribute.mjs";
3
3
  import { NamedObject } from "./named-object.mjs";
4
+ import { Hook } from "./hook.mjs";
5
+ import { Tag } from "./tag.mjs";
6
+ import { Branch } from "./branch.mjs";
7
+ import { PullRequest } from "./pull-request.mjs";
8
+ import { BaseProvider } from "./base-provider.mjs";
4
9
 
5
10
  /**
6
11
  * Abstract repository
@@ -41,12 +46,6 @@ export class Repository extends NamedObject {
41
46
 
42
47
  cloneURL: { type: "url" },
43
48
 
44
- /**
45
- * The url of home page.
46
- * @return {string}
47
- */
48
- homePageURL: { type: "url" },
49
-
50
49
  /**
51
50
  * The url of issue tracking system.
52
51
  * @return {string}
@@ -94,7 +93,7 @@ export class Repository extends NamedObject {
94
93
 
95
94
  /**
96
95
  * The owners provider.
97
- * @return {Provider}
96
+ * @return {BaseProvider}
98
97
  */
99
98
  get provider() {
100
99
  return this.owner.provider;
@@ -126,7 +125,7 @@ export class Repository extends NamedObject {
126
125
  /**
127
126
  * Lookup entries form the head of the default branch.
128
127
  * {@link Branch#entry}
129
- * @return {Entry}
128
+ * @return {Promise<ContentEntry>}
130
129
  */
131
130
  async entry(name) {
132
131
  return (await this.defaultBranch).entry(name);
@@ -135,7 +134,7 @@ export class Repository extends NamedObject {
135
134
  /**
136
135
  * List entries of the default branch.
137
136
  * @param {string[]} matchingPatterns
138
- * @return {Entry} all matching entries in the branch
137
+ * @return {AsyncIterator<ContentEntry>} all matching entries in the branch
139
138
  */
140
139
  async *entries(matchingPatterns) {
141
140
  yield* (await this.defaultBranch).entries(matchingPatterns);
@@ -144,7 +143,7 @@ export class Repository extends NamedObject {
144
143
  /**
145
144
  * Get exactly one matching entry by name or undefined if no such entry is found.
146
145
  * @param {string} name
147
- * @return {Promise<Entry>}
146
+ * @return {Promise<ContentEntry>}
148
147
  */
149
148
  async maybeEntry(name) {
150
149
  return (await this.defaultBranch).maybeEntry(name);
@@ -249,7 +248,7 @@ export class Repository extends NamedObject {
249
248
  }
250
249
 
251
250
  /**
252
- * @return {Iterator<Branch>} of all branches
251
+ * @return {AsyncIterator<Branch>} of all branches
253
252
  */
254
253
  async *branches(patterns) {
255
254
  await this.initializeBranches();
@@ -293,7 +292,7 @@ export class Repository extends NamedObject {
293
292
  /**
294
293
  * Delete a {@link Branch}.
295
294
  * @param {string} name of the branch
296
- * @return {Promise<undefined>}
295
+ * @return {Promise<any>}
297
296
  */
298
297
  async deleteBranch(name) {
299
298
  this._branches.delete(name);
@@ -305,7 +304,7 @@ export class Repository extends NamedObject {
305
304
 
306
305
  /**
307
306
  * @param {string|string[]} patterns
308
- * @return {Iterator<Tag>} of all tags
307
+ * @return {AsyncIterator<Tag>} of all tags
309
308
  */
310
309
  async *tags(patterns) {
311
310
  await this.initializeTags();
@@ -318,7 +317,7 @@ export class Repository extends NamedObject {
318
317
  /**
319
318
  * Get a Tag.
320
319
  * @param {string} name
321
- * @return {Tag}
320
+ * @return {Promise<Tag>}
322
321
  */
323
322
  async tag(name) {
324
323
  await this.initializeTags();
@@ -328,7 +327,7 @@ export class Repository extends NamedObject {
328
327
  /**
329
328
  * Delete the repository from the {@link Provider}.
330
329
  * {@link Provider#deleteRepository}
331
- * @return {Promise<undefined>}
330
+ * @return {Promise<any>}
332
331
  */
333
332
  async delete() {
334
333
  return this.owner.deleteRepository(this.name);
@@ -339,7 +338,7 @@ export class Repository extends NamedObject {
339
338
  * @param {string} name of the pr
340
339
  * @param {Branch} source branch
341
340
  * @param {Object} options
342
- * @return {PullRequest}
341
+ * @return {Promise<PullRequest>}
343
342
  */
344
343
  async createPullRequest(name, source, options) {
345
344
  await this.initializePullRequests();
@@ -368,7 +367,7 @@ export class Repository extends NamedObject {
368
367
 
369
368
  /**
370
369
  * Deliver all {@link PullRequest}s.
371
- * @return {Iterator<PullRequest>} of all pull requests
370
+ * @return {AsyncIterator<PullRequest>} of all pull requests
372
371
  */
373
372
  async *pullRequests() {
374
373
  await this.initializePullRequests();
@@ -391,7 +390,7 @@ export class Repository extends NamedObject {
391
390
  /**
392
391
  * Delete a {@link PullRequest}.
393
392
  * @param {string} name
394
- * @return {Promise}
393
+ * @return {Promise<any>}
395
394
  */
396
395
  async deletePullRequest(name) {
397
396
  this._pullRequests.delete(name);
@@ -419,7 +418,7 @@ export class Repository extends NamedObject {
419
418
 
420
419
  /**
421
420
  * List hooks.
422
- * @return {Hook} all hooks of the repository
421
+ * @return {AsyncIterator<Hook>} all hooks of the repository
423
422
  */
424
423
  async *hooks() {
425
424
  await this.initializeHooks();
@@ -431,7 +430,7 @@ export class Repository extends NamedObject {
431
430
  /**
432
431
  * Get a Hook.
433
432
  * @param {string|number} id
434
- * @return {Hook} for the given id
433
+ * @return {Promise<Hook>} for the given id
435
434
  */
436
435
  async hook(id) {
437
436
  for await (const hook of this.hooks()) {
@@ -469,7 +468,7 @@ export class Repository extends NamedObject {
469
468
  /**
470
469
  * Get sha of a ref.
471
470
  * @param {string} ref
472
- * @return {string} sha of the ref
471
+ * @return {Promise<string>} sha of the ref
473
472
  */
474
473
  async refId(ref) {
475
474
  return undefined;
@@ -1,6 +1,8 @@
1
1
  import { BaseProvider } from "./base-provider.mjs";
2
2
  import { RepositoryOwner } from "./repository-owner.mjs";
3
3
  import { stripBaseNames } from "./util.mjs";
4
+ import { Repository } from "./repository.mjs";
5
+ import { RepositoryGroup } from "./repository-group.mjs";
4
6
 
5
7
  /**
6
8
  * Provider holding a single set of repositories (no repository groups).
@@ -9,7 +11,7 @@ export class SingleGroupProvider extends RepositoryOwner(BaseProvider) {
9
11
  /**
10
12
  * Lookup a repository in the provider and all of its repository groups.
11
13
  * @param {string} name of the repository
12
- * @return {Repository}
14
+ * @return {Promise<Repository>}
13
15
  */
14
16
  async repository(name) {
15
17
  const { base, repository } = this.parseName(name);
@@ -21,7 +23,7 @@ export class SingleGroupProvider extends RepositoryOwner(BaseProvider) {
21
23
  /**
22
24
  * Get a single group.
23
25
  * @param {string} name
24
- * @return {RepositoryGroup} deliver the one and only present group
26
+ * @return {Promise<RepositoryGroup>} deliver the one and only present group
25
27
  */
26
28
  async repositoryGroup(name) {
27
29
  if (name !== undefined) {
@@ -36,7 +38,7 @@ export class SingleGroupProvider extends RepositoryOwner(BaseProvider) {
36
38
  /**
37
39
  * List groups.
38
40
  * @param {string[]|string} patterns
39
- * @return {Iterator<RepositoryGroup>} always deliver the one and only present group
41
+ * @return {AsyncIterator<RepositoryGroup>} always deliver the one and only present group
40
42
  */
41
43
  async *repositoryGroups(patterns) {
42
44
  let found;
package/src/util.mjs CHANGED
@@ -1,3 +1,5 @@
1
+ import { Repository } from "./repository.mjs";
2
+
1
3
  /**
2
4
  * Convert scalar into an array.
3
5
  * The value undefined will be represented as an empty array.
@@ -13,7 +15,7 @@ export function asArray(value) {
13
15
  * A URL auth component will be removed to.
14
16
  * @param {string} name
15
17
  * @param {string[]} repositoryBases all possible bases
16
- * @param {Function} whenFound to be called with the found base name
18
+ * @param {Function} [whenFound] to be called with the found base name
17
19
  * @return {string} name without base
18
20
  */
19
21
  export function stripBaseName(name, repositoryBases, whenFound) {
@@ -36,10 +38,10 @@ export function stripBaseName(name, repositoryBases, whenFound) {
36
38
  /**
37
39
  * Loops over names and executes stripBaseName.
38
40
  *
39
- * @param {string[]} names
41
+ * @param {string|string[]} names
40
42
  * @param {*} repositoryBases
41
43
  * @param {string[]} repositoryBases all possible bases
42
- * @param {Function} whenFound to be called with the found base name
44
+ * @param {Function} [whenFound] to be called with the found base name
43
45
  * @return {string[]} names without base
44
46
  */
45
47
  export function stripBaseNames(names, repositoryBases, whenFound) {
@@ -56,6 +58,7 @@ export function stripBaseNames(names, repositoryBases, whenFound) {
56
58
  * 'something/*' will get to something/1 something/2 ...
57
59
  * @param {Repository} repository
58
60
  * @param {string} pattern
61
+ * @return {Promise<string>}
59
62
  */
60
63
  export async function generateBranchName(repository, pattern) {
61
64
  let n = 1;