repository-provider 26.1.2 → 26.3.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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2017-2021 by arlac77
1
+ Copyright (c) 2017-2022 by arlac77
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
package/README.md CHANGED
@@ -51,20 +51,22 @@ console.log(await readme.getString());
51
51
  * [Properties](#properties)
52
52
  * [definePropertiesFromOptions](#definepropertiesfromoptions)
53
53
  * [Parameters](#parameters-1)
54
- * [setAttribute](#setattribute)
54
+ * [defaultValues](#defaultvalues)
55
55
  * [Parameters](#parameters-2)
56
- * [getAttribute](#getattribute)
56
+ * [setAttribute](#setattribute)
57
57
  * [Parameters](#parameters-3)
58
- * [optionJSON](#optionjson)
58
+ * [getAttribute](#getattribute)
59
59
  * [Parameters](#parameters-4)
60
- * [mapAttributes](#mapattributes)
60
+ * [optionJSON](#optionjson)
61
61
  * [Parameters](#parameters-5)
62
- * [mapAttributesInverse](#mapattributesinverse)
62
+ * [mapAttributes](#mapattributes)
63
63
  * [Parameters](#parameters-6)
64
- * [BaseObject](#baseobject)
64
+ * [mapAttributesInverse](#mapattributesinverse)
65
65
  * [Parameters](#parameters-7)
66
+ * [BaseObject](#baseobject)
67
+ * [Parameters](#parameters-8)
66
68
  * [equals](#equals)
67
- * [Parameters](#parameters-8)
69
+ * [Parameters](#parameters-9)
68
70
  * [attributes](#attributes)
69
71
  * [writableAttributes](#writableattributes)
70
72
  * [attributeMapping](#attributemapping)
@@ -74,129 +76,131 @@ console.log(await readme.getString());
74
76
  * [avatarURL](#avatarurl)
75
77
  * [homePageURL](#homepageurl)
76
78
  * [MessageDestination](#messagedestination)
77
- * [Parameters](#parameters-9)
78
- * [BaseProvider](#baseprovider)
79
79
  * [Parameters](#parameters-10)
80
+ * [BaseProvider](#baseprovider)
81
+ * [Parameters](#parameters-11)
80
82
  * [Properties](#properties-1)
81
83
  * [equals](#equals-1)
82
- * [Parameters](#parameters-11)
84
+ * [Parameters](#parameters-12)
83
85
  * [repositoryBases](#repositorybases)
84
86
  * [normalizeRepositoryName](#normalizerepositoryname)
85
- * [Parameters](#parameters-12)
86
- * [normalizeGroupName](#normalizegroupname)
87
87
  * [Parameters](#parameters-13)
88
+ * [normalizeGroupName](#normalizegroupname)
89
+ * [Parameters](#parameters-14)
88
90
  * [areRepositoryNamesCaseSensitive](#arerepositorynamescasesensitive)
89
91
  * [areGroupNamesCaseSensitive](#aregroupnamescasesensitive)
90
92
  * [supportsBase](#supportsbase)
91
- * [Parameters](#parameters-14)
92
- * [parseName](#parsename)
93
93
  * [Parameters](#parameters-15)
94
- * [list](#list)
94
+ * [parseName](#parsename)
95
95
  * [Parameters](#parameters-16)
96
- * [projects](#projects)
96
+ * [createRepository](#createrepository)
97
97
  * [Parameters](#parameters-17)
98
- * [milestones](#milestones)
98
+ * [list](#list)
99
99
  * [Parameters](#parameters-18)
100
- * [repositories](#repositories)
100
+ * [projects](#projects)
101
101
  * [Parameters](#parameters-19)
102
- * [branches](#branches)
102
+ * [milestones](#milestones)
103
103
  * [Parameters](#parameters-20)
104
- * [tags](#tags)
104
+ * [repositories](#repositories)
105
105
  * [Parameters](#parameters-21)
106
- * [hooks](#hooks)
106
+ * [branches](#branches)
107
107
  * [Parameters](#parameters-22)
108
- * [pullRequests](#pullrequests)
108
+ * [tags](#tags)
109
109
  * [Parameters](#parameters-23)
110
- * [repositoryGroupClass](#repositorygroupclass)
111
- * [hookClass](#hookclass)
110
+ * [hooks](#hooks)
111
+ * [Parameters](#parameters-24)
112
+ * [pullRequests](#pullrequests)
113
+ * [Parameters](#parameters-25)
112
114
  * [name](#name)
113
115
  * [provider](#provider)
114
116
  * [url](#url)
115
117
  * [toJSON](#tojson)
118
+ * [repositoryGroupClass](#repositorygroupclass)
119
+ * [hookClass](#hookclass)
116
120
  * [repositoryClass](#repositoryclass)
117
121
  * [branchClass](#branchclass)
118
122
  * [entryClass](#entryclass)
119
123
  * [pullRequestClass](#pullrequestclass)
120
124
  * [instanceIdentifier](#instanceidentifier)
121
125
  * [optionsFromEnvironment](#optionsfromenvironment)
122
- * [Parameters](#parameters-24)
126
+ * [Parameters](#parameters-26)
123
127
  * [areOptionsSufficcient](#areoptionssufficcient)
124
- * [Parameters](#parameters-25)
128
+ * [Parameters](#parameters-27)
125
129
  * [initialize](#initialize)
126
- * [Parameters](#parameters-26)
130
+ * [Parameters](#parameters-28)
127
131
  * [priority](#priority)
128
132
  * [name](#name-1)
129
133
  * [messageDestination](#messagedestination-1)
130
134
  * [Commit](#commit)
131
135
  * [Properties](#properties-2)
132
136
  * [Commit](#commit-1)
133
- * [Parameters](#parameters-27)
137
+ * [Parameters](#parameters-29)
134
138
  * [Properties](#properties-3)
135
139
  * [CommitResult](#commitresult)
136
140
  * [Properties](#properties-4)
137
141
  * [Branch](#branch)
138
- * [Parameters](#parameters-28)
142
+ * [Parameters](#parameters-30)
139
143
  * [Properties](#properties-5)
140
144
  * [url](#url-1)
141
145
  * [refType](#reftype)
142
146
  * [isDefault](#isdefault)
143
147
  * [delete](#delete)
144
148
  * [commit](#commit-2)
145
- * [Parameters](#parameters-29)
149
+ * [Parameters](#parameters-31)
146
150
  * [commitIntoPullRequest](#commitintopullrequest)
147
- * [Parameters](#parameters-30)
151
+ * [Parameters](#parameters-32)
148
152
  * [removeEntries](#removeentries)
149
- * [Parameters](#parameters-31)
153
+ * [Parameters](#parameters-33)
150
154
  * [entryClass](#entryclass-1)
151
155
  * [createPullRequest](#createpullrequest)
152
- * [Parameters](#parameters-32)
156
+ * [Parameters](#parameters-34)
153
157
  * [pullRequestClass](#pullrequestclass-1)
154
158
  * [createBranch](#createbranch)
155
- * [Parameters](#parameters-33)
159
+ * [Parameters](#parameters-35)
156
160
  * [Hook](#hook)
157
- * [Parameters](#parameters-34)
161
+ * [Parameters](#parameters-36)
158
162
  * [Properties](#properties-6)
159
163
  * [equals](#equals-2)
160
- * [Parameters](#parameters-35)
164
+ * [Parameters](#parameters-37)
161
165
  * [toJSON](#tojson-1)
162
166
  * [Issue](#issue)
163
- * [Parameters](#parameters-36)
167
+ * [Parameters](#parameters-38)
164
168
  * [Milestone](#milestone)
165
- * [Parameters](#parameters-37)
169
+ * [Parameters](#parameters-39)
166
170
  * [MultiGroupProvider](#multigroupprovider)
167
- * [Parameters](#parameters-38)
171
+ * [Parameters](#parameters-40)
168
172
  * [repository](#repository)
169
- * [Parameters](#parameters-39)
173
+ * [Parameters](#parameters-41)
170
174
  * [repositoryGroup](#repositorygroup)
171
- * [Parameters](#parameters-40)
175
+ * [Parameters](#parameters-42)
172
176
  * [repositoryGroups](#repositorygroups)
173
- * [Parameters](#parameters-41)
177
+ * [Parameters](#parameters-43)
174
178
  * [createRepositoryGroup](#createrepositorygroup)
175
- * [Parameters](#parameters-42)
179
+ * [Parameters](#parameters-44)
176
180
  * [addRepositoryGroup](#addrepositorygroup)
177
- * [Parameters](#parameters-43)
181
+ * [Parameters](#parameters-45)
178
182
  * [NamedObject](#namedobject)
179
- * [Parameters](#parameters-44)
183
+ * [Parameters](#parameters-46)
180
184
  * [Properties](#properties-7)
181
185
  * [equals](#equals-3)
182
- * [Parameters](#parameters-45)
186
+ * [Parameters](#parameters-47)
183
187
  * [displayName](#displayname)
184
188
  * [update](#update)
185
189
  * [toJSON](#tojson-2)
186
190
  * [Project](#project)
187
- * [Parameters](#parameters-46)
191
+ * [Parameters](#parameters-48)
188
192
  * [PullRequest](#pullrequest)
189
- * [Parameters](#parameters-47)
193
+ * [Parameters](#parameters-49)
190
194
  * [Properties](#properties-8)
191
195
  * [fullName](#fullname)
192
196
  * [url](#url-2)
193
197
  * [repository](#repository-1)
194
198
  * [provider](#provider-1)
195
199
  * [equals](#equals-4)
196
- * [Parameters](#parameters-48)
200
+ * [Parameters](#parameters-50)
197
201
  * [delete](#delete-1)
198
202
  * [merge](#merge)
199
- * [Parameters](#parameters-49)
203
+ * [Parameters](#parameters-51)
200
204
  * [decline](#decline)
201
205
  * [reviews](#reviews)
202
206
  * [identifier](#identifier)
@@ -204,9 +208,9 @@ console.log(await readme.getString());
204
208
  * [defaultListStates](#defaultliststates)
205
209
  * [validMergeMethods](#validmergemethods)
206
210
  * [list](#list-1)
207
- * [Parameters](#parameters-50)
211
+ * [Parameters](#parameters-52)
208
212
  * [open](#open)
209
- * [Parameters](#parameters-51)
213
+ * [Parameters](#parameters-53)
210
214
  * [title](#title)
211
215
  * [body](#body)
212
216
  * [state](#state)
@@ -216,19 +220,19 @@ console.log(await readme.getString());
216
220
  * [ContentEntry](#contententry)
217
221
  * [Properties](#properties-9)
218
222
  * [Ref](#ref)
219
- * [Parameters](#parameters-52)
223
+ * [Parameters](#parameters-54)
220
224
  * [equals](#equals-5)
221
- * [Parameters](#parameters-53)
225
+ * [Parameters](#parameters-55)
222
226
  * [ref](#ref-1)
223
227
  * [refId](#refid)
224
- * [Parameters](#parameters-54)
228
+ * [Parameters](#parameters-56)
225
229
  * [entries](#entries)
226
- * [Parameters](#parameters-55)
230
+ * [Parameters](#parameters-57)
227
231
  * [asyncIterator](#asynciterator)
228
232
  * [maybeEntry](#maybeentry)
229
- * [Parameters](#parameters-56)
233
+ * [Parameters](#parameters-58)
230
234
  * [entry](#entry)
231
- * [Parameters](#parameters-57)
235
+ * [Parameters](#parameters-59)
232
236
  * [provider](#provider-2)
233
237
  * [owner](#owner)
234
238
  * [fullName](#fullname-1)
@@ -244,7 +248,7 @@ console.log(await readme.getString());
244
248
  * [attributes](#attributes-1)
245
249
  * [isProtected](#isprotected-1)
246
250
  * [RepositoryGroup](#repositorygroup-1)
247
- * [Parameters](#parameters-58)
251
+ * [Parameters](#parameters-60)
248
252
  * [Properties](#properties-10)
249
253
  * [repositoryClass](#repositoryclass-1)
250
254
  * [branchClass](#branchclass-1)
@@ -255,22 +259,22 @@ console.log(await readme.getString());
255
259
  * [type](#type)
256
260
  * [url](#url-3)
257
261
  * [RepositoryOwner](#repositoryowner)
258
- * [Parameters](#parameters-59)
262
+ * [Parameters](#parameters-61)
259
263
  * [Repository](#repository-2)
260
- * [Parameters](#parameters-60)
264
+ * [Parameters](#parameters-62)
261
265
  * [Properties](#properties-11)
262
266
  * [fullName](#fullname-2)
263
267
  * [slug](#slug)
264
268
  * [provider](#provider-3)
265
269
  * [identifier](#identifier-2)
266
270
  * [equals](#equals-6)
267
- * [Parameters](#parameters-61)
271
+ * [Parameters](#parameters-63)
268
272
  * [entry](#entry-1)
269
- * [Parameters](#parameters-62)
273
+ * [Parameters](#parameters-64)
270
274
  * [entries](#entries-1)
271
- * [Parameters](#parameters-63)
275
+ * [Parameters](#parameters-65)
272
276
  * [maybeEntry](#maybeentry-1)
273
- * [Parameters](#parameters-64)
277
+ * [Parameters](#parameters-66)
274
278
  * [urls](#urls)
275
279
  * [url](#url-4)
276
280
  * [cloneURL](#cloneurl)
@@ -282,40 +286,40 @@ console.log(await readme.getString());
282
286
  * [isDisabled](#isdisabled-1)
283
287
  * [isTemplate](#istemplate)
284
288
  * [branch](#branch-1)
285
- * [Parameters](#parameters-65)
289
+ * [Parameters](#parameters-67)
286
290
  * [defaultBranch](#defaultbranch)
287
291
  * [branches](#branches-1)
288
- * [Parameters](#parameters-66)
292
+ * [Parameters](#parameters-68)
289
293
  * [createBranch](#createbranch-1)
290
- * [Parameters](#parameters-67)
294
+ * [Parameters](#parameters-69)
291
295
  * [addBranch](#addbranch)
292
- * [Parameters](#parameters-68)
296
+ * [Parameters](#parameters-70)
293
297
  * [deleteBranch](#deletebranch)
294
- * [Parameters](#parameters-69)
298
+ * [Parameters](#parameters-71)
295
299
  * [tags](#tags-1)
296
- * [Parameters](#parameters-70)
300
+ * [Parameters](#parameters-72)
297
301
  * [tag](#tag)
298
- * [Parameters](#parameters-71)
302
+ * [Parameters](#parameters-73)
299
303
  * [delete](#delete-2)
300
304
  * [createPullRequest](#createpullrequest-1)
301
- * [Parameters](#parameters-72)
305
+ * [Parameters](#parameters-74)
302
306
  * [addPullRequest](#addpullrequest)
303
- * [Parameters](#parameters-73)
307
+ * [Parameters](#parameters-75)
304
308
  * [pullRequests](#pullrequests-1)
305
309
  * [pullRequest](#pullrequest-1)
306
- * [Parameters](#parameters-74)
310
+ * [Parameters](#parameters-76)
307
311
  * [deletePullRequest](#deletepullrequest)
308
- * [Parameters](#parameters-75)
312
+ * [Parameters](#parameters-77)
309
313
  * [addHook](#addhook)
310
- * [Parameters](#parameters-76)
314
+ * [Parameters](#parameters-78)
311
315
  * [createHook](#createhook)
312
- * [Parameters](#parameters-77)
316
+ * [Parameters](#parameters-79)
313
317
  * [hooks](#hooks-1)
314
318
  * [hook](#hook-1)
315
- * [Parameters](#parameters-78)
319
+ * [Parameters](#parameters-80)
316
320
  * [type](#type-1)
317
321
  * [refId](#refid-1)
318
- * [Parameters](#parameters-79)
322
+ * [Parameters](#parameters-81)
319
323
  * [repositoryClass](#repositoryclass-2)
320
324
  * [pullRequestClass](#pullrequestclass-3)
321
325
  * [branchClass](#branchclass-2)
@@ -329,23 +333,23 @@ console.log(await readme.getString());
329
333
  * [Review](#review)
330
334
  * [SingleGroupProvider](#singlegroupprovider)
331
335
  * [repository](#repository-3)
332
- * [Parameters](#parameters-80)
336
+ * [Parameters](#parameters-82)
333
337
  * [repositoryGroup](#repositorygroup-2)
334
- * [Parameters](#parameters-81)
338
+ * [Parameters](#parameters-83)
335
339
  * [repositoryGroups](#repositorygroups-1)
336
- * [Parameters](#parameters-82)
340
+ * [Parameters](#parameters-84)
337
341
  * [Tag](#tag-1)
338
- * [Parameters](#parameters-83)
342
+ * [Parameters](#parameters-85)
339
343
  * [refType](#reftype-1)
340
344
  * [isWritable](#iswritable-1)
341
345
  * [asArray](#asarray)
342
- * [Parameters](#parameters-84)
346
+ * [Parameters](#parameters-86)
343
347
  * [stripBaseName](#stripbasename)
344
- * [Parameters](#parameters-85)
348
+ * [Parameters](#parameters-87)
345
349
  * [stripBaseNames](#stripbasenames)
346
- * [Parameters](#parameters-86)
350
+ * [Parameters](#parameters-88)
347
351
  * [generateBranchName](#generatebranchname)
348
- * [Parameters](#parameters-87)
352
+ * [Parameters](#parameters-89)
349
353
 
350
354
  ## Application
351
355
 
@@ -397,6 +401,17 @@ Object.definedProperties(new aClass(),{ with_default: { value: 77 }})
397
401
  * `properties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** object properties (optional, default `{}`)
398
402
  * `attributes` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `object.constructor.attributes`)
399
403
 
404
+ ## defaultValues
405
+
406
+ Get default values.
407
+
408
+ ### Parameters
409
+
410
+ * `attributes` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
411
+ * `object`
412
+
413
+ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** filled with default values
414
+
400
415
  ## setAttribute
401
416
 
402
417
  Set Object attribute.
@@ -553,7 +568,7 @@ Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
553
568
 
554
569
  ### repositoryBases
555
570
 
556
- All possible base urls.
571
+ All supported base urls.
557
572
  For github something like:
558
573
 
559
574
  * <git@github.com>
@@ -624,6 +639,17 @@ base, group, repository and branch.
624
639
 
625
640
  Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** with separated attributes
626
641
 
642
+ ### createRepository
643
+
644
+ Create a repository.
645
+
646
+ #### Parameters
647
+
648
+ * `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** of group and repository
649
+ * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
650
+
651
+ Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Repository](#repository)>**
652
+
627
653
  ### list
628
654
 
629
655
  List provider objects of a given type.
@@ -703,14 +729,6 @@ List pull requests.
703
729
 
704
730
  Returns **AsyncIterator<[PullRequest](#pullrequest)>** all matching pullRequests of the provider
705
731
 
706
- ### repositoryGroupClass
707
-
708
- Returns **Class** repository group class used by the Provider
709
-
710
- ### hookClass
711
-
712
- Returns **Class** hook class used by the Provider
713
-
714
732
  ### name
715
733
 
716
734
  Deliver the provider name.
@@ -732,6 +750,14 @@ Returns **any** url otf the provider.
732
750
  List all defined entries from attributes.
733
751
  return {object}
734
752
 
753
+ ### repositoryGroupClass
754
+
755
+ Returns **Class** repository group class used by the Provider
756
+
757
+ ### hookClass
758
+
759
+ Returns **Class** hook class used by the Provider
760
+
735
761
  ### repositoryClass
736
762
 
737
763
  Returns **Class** repository class used by the Provider
@@ -782,7 +808,7 @@ Creates a new provider for a given set of options.
782
808
 
783
809
  * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** additional options (optional, default `{}`)
784
810
 
785
- * `options.instanceIdentifier` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?**
811
+ * `options.instanceIdentifier` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** name of the provider instance
786
812
  * `env` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** taken from process.env
787
813
 
788
814
  Returns **[BaseProvider](#baseprovider)** newly created provider or undefined if options are not sufficient to construct a provider
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repository-provider",
3
- "version": "26.1.2",
3
+ "version": "26.3.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -33,15 +33,15 @@
33
33
  "matching-iterator": "^2.0.0"
34
34
  },
35
35
  "devDependencies": {
36
- "ava": "^3.15.0",
36
+ "ava": "^4.0.1",
37
37
  "c8": "^7.11.0",
38
38
  "documentation": "^13.2.5",
39
- "repository-provider-test-support": "^1.9.1",
40
- "semantic-release": "^18.0.1",
41
- "typescript": "^4.6.0-dev.20211231"
39
+ "repository-provider-test-support": "^1.9.8",
40
+ "semantic-release": "^19.0.2",
41
+ "typescript": "^4.6.0-dev.20220124"
42
42
  },
43
43
  "engines": {
44
- "node": ">=14.18.1"
44
+ "node": ">=14.18.3"
45
45
  },
46
46
  "repository": {
47
47
  "type": "git",
@@ -71,6 +71,11 @@ export class BaseObject {
71
71
  );
72
72
  }
73
73
 
74
+ /**
75
+ * Save object attributes in the backing store.
76
+ */
77
+ async update() {}
78
+
74
79
  /**
75
80
  * Check for equality
76
81
  * @param {BaseObject} other
@@ -79,4 +84,36 @@ export class BaseObject {
79
84
  equals(other) {
80
85
  return other !== undefined;
81
86
  }
87
+
88
+ /**
89
+ * The provider we live in.
90
+ * @return {BaseProvider}
91
+ */
92
+ get provider() {
93
+ return this.owner.provider;
94
+ }
95
+
96
+ /**
97
+ * Forwarded to the owner.
98
+ * @param {...any} args
99
+ */
100
+ info(...args) {
101
+ return this.owner.info(...args);
102
+ }
103
+
104
+ /**
105
+ * Forwarded to the owner.
106
+ * @param {...any} args
107
+ */
108
+ warn(...args) {
109
+ return this.owner.warn(...args);
110
+ }
111
+
112
+ /**
113
+ * Forwarded to the owner.
114
+ * @param {...any} args
115
+ */
116
+ error(...args) {
117
+ return this.owner.error(...args);
118
+ }
82
119
  }
@@ -482,6 +482,13 @@ export class BaseProvider {
482
482
  return Branch;
483
483
  }
484
484
 
485
+ /**
486
+ * @return {Class} branch class used by the Provider
487
+ */
488
+ get tagClass() {
489
+ return Tag;
490
+ }
491
+
485
492
  /**
486
493
  * @return {Class} entry class used by the Provider
487
494
  */
package/src/branch.mjs CHANGED
@@ -82,6 +82,7 @@ export class Branch extends Ref {
82
82
  * @param {boolean} options.dry do not create a branch and do not commit only create dummy PR
83
83
  * @param {boolean} options.skipWithoutCommits do not create a PR if no commits are given
84
84
  * @param {boolean} options.bodyFromCommitMessages generate body from commit messages
85
+ * @param {string} [options.body] body of the PR
85
86
  * @return {Promise<PullRequest>}
86
87
  */
87
88
  async commitIntoPullRequest(commits, options) {
package/src/hook.mjs CHANGED
@@ -36,6 +36,11 @@ export class Hook extends BaseObject {
36
36
  repository._addHook(this);
37
37
  }
38
38
 
39
+ get owner()
40
+ {
41
+ return this.repository;
42
+ }
43
+
39
44
  get fullName() {
40
45
  return `${this.repository.fullName}/${this.id}`;
41
46
  }
@@ -59,16 +64,4 @@ export class Hook extends BaseObject {
59
64
  toJSON() {
60
65
  return optionJSON(this, { id: this.id, events: [...this.events] });
61
66
  }
62
-
63
- info(...args) {
64
- return this.repository.info(...args);
65
- }
66
-
67
- warn(...args) {
68
- return this.repository.warn(...args);
69
- }
70
-
71
- error(...args) {
72
- return this.repository.error(...args);
73
- }
74
67
  }
@@ -34,13 +34,6 @@ export class NamedObject extends BaseObject {
34
34
  return this.name;
35
35
  }
36
36
 
37
- /**
38
- * Save object attributes in the backing store.
39
- */
40
- async update()
41
- {
42
- }
43
-
44
37
  toString() {
45
38
  return this.name;
46
39
  }
package/src/ref.mjs CHANGED
@@ -96,14 +96,6 @@ export class Ref extends NamedObject {
96
96
  return e;
97
97
  }
98
98
 
99
- /**
100
- * The provider we live in.
101
- * @return {BaseProvider}
102
- */
103
- get provider() {
104
- return this.repository.provider;
105
- }
106
-
107
99
  /**
108
100
  * Branch owner.
109
101
  * By default we provide the repository owner
@@ -208,16 +200,4 @@ export class Ref extends NamedObject {
208
200
  !this.isProtected
209
201
  );
210
202
  }
211
-
212
- info(...args) {
213
- return this.repository.info(...args);
214
- }
215
-
216
- warn(...args) {
217
- return this.repository.warn(...args);
218
- }
219
-
220
- error(...args) {
221
- return this.repository.error(...args);
222
- }
223
203
  }
@@ -49,6 +49,11 @@ export class RepositoryGroup extends RepositoryOwner(NamedObject) {
49
49
  });
50
50
  }
51
51
 
52
+ get owner()
53
+ {
54
+ return this.provider;
55
+ }
56
+
52
57
  get isAdmin() {
53
58
  return false;
54
59
  }
@@ -77,6 +82,14 @@ export class RepositoryGroup extends RepositoryOwner(NamedObject) {
77
82
  return this.provider.branchClass;
78
83
  }
79
84
 
85
+ /**
86
+ * By default we use the providers implementation.
87
+ * @return {Class} as defined in the provider
88
+ */
89
+ get tagClass() {
90
+ return this.provider.tagClass;
91
+ }
92
+
80
93
  /**
81
94
  * By default we use the providers implementation.
82
95
  * @return {Class} as defined in the provider
@@ -100,16 +113,4 @@ export class RepositoryGroup extends RepositoryOwner(NamedObject) {
100
113
  get hookClass() {
101
114
  return this.provider.hookClass;
102
115
  }
103
-
104
- info(...args) {
105
- return this.provider.info(...args);
106
- }
107
-
108
- warn(...args) {
109
- return this.provider.warn(...args);
110
- }
111
-
112
- error(...args) {
113
- return this.provider.error(...args);
114
- }
115
116
  }
@@ -42,7 +42,7 @@ export class Repository extends NamedObject {
42
42
  * URLs of the repository
43
43
  * @return {string[]}
44
44
  */
45
- urls: { },
45
+ urls: {},
46
46
 
47
47
  cloneURL: { type: "url" },
48
48
 
@@ -229,6 +229,14 @@ export class Repository extends NamedObject {
229
229
  return false;
230
230
  }
231
231
 
232
+ /**
233
+ * Lookup the default branch.
234
+ * @return {Promise<Branch>} branch named after defaultBranchName
235
+ */
236
+ get defaultBranch() {
237
+ return this.branch(this.defaultBranchName);
238
+ }
239
+
232
240
  /**
233
241
  * Lookup branch by name.
234
242
  * @param {string} name
@@ -239,14 +247,6 @@ export class Repository extends NamedObject {
239
247
  return this._branches.get(name);
240
248
  }
241
249
 
242
- /**
243
- * Lookup the default branch.
244
- * @return {Promise<Branch>} branch named after defaultBranchName
245
- */
246
- get defaultBranch() {
247
- return this.branch(this.defaultBranchName);
248
- }
249
-
250
250
  /**
251
251
  * @return {AsyncIterator<Branch>} of all branches
252
252
  */
@@ -274,7 +274,7 @@ export class Repository extends NamedObject {
274
274
  * Internal branch creation does not call repository.initialize()
275
275
  * @param {string} name of the new branch
276
276
  * @param {Object} options
277
- * @return {Promise<Branch>} newly created branch
277
+ * @return {Branch} newly created branch
278
278
  */
279
279
  addBranch(name, options) {
280
280
  let branch = this._branches.get(name);
@@ -298,8 +298,14 @@ export class Repository extends NamedObject {
298
298
  this._branches.delete(name);
299
299
  }
300
300
 
301
- _addTag(tag) {
302
- this._tags.set(tag.name, tag);
301
+ /**
302
+ * Get a Tag.
303
+ * @param {string} name
304
+ * @return {Promise<Tag>}
305
+ */
306
+ async tag(name) {
307
+ await this.initializeTags();
308
+ return this._tags.get(name);
303
309
  }
304
310
 
305
311
  /**
@@ -315,13 +321,23 @@ export class Repository extends NamedObject {
315
321
  }
316
322
 
317
323
  /**
318
- * Get a Tag.
319
- * @param {string} name
320
- * @return {Promise<Tag>}
324
+ * Add a new {@link Tag}.
325
+ * Internal tag creation does not call repository.initialize()
326
+ * @param {string} name of the new tag
327
+ * @param {Object} options
328
+ * @return {Tag} newly created tag
321
329
  */
322
- async tag(name) {
323
- await this.initializeTags();
324
- return this._tags.get(name);
330
+ addTag(name, options) {
331
+ let tag = this._tags.get(name);
332
+ if (tag === undefined) {
333
+ tag = new this.tagClass(this, name, options);
334
+ }
335
+
336
+ return tag;
337
+ }
338
+
339
+ _addTag(tag) {
340
+ this._tags.set(tag.name, tag);
325
341
  }
326
342
 
327
343
  /**
@@ -498,6 +514,14 @@ export class Repository extends NamedObject {
498
514
  return this.owner.branchClass;
499
515
  }
500
516
 
517
+ /**
518
+ * By default we use the owners implementation.
519
+ * @return {Class} as defined in the owner
520
+ */
521
+ get tagClass() {
522
+ return this.owner.tagClass;
523
+ }
524
+
501
525
  /**
502
526
  * By default we use the owners implementation.
503
527
  * @return {Class} as defined in the owner
@@ -529,18 +553,6 @@ export class Repository extends NamedObject {
529
553
  });
530
554
  }
531
555
 
532
- info(...args) {
533
- return this.owner.info(...args);
534
- }
535
-
536
- warn(...args) {
537
- return this.owner.warn(...args);
538
- }
539
-
540
- error(...args) {
541
- return this.owner.error(...args);
542
- }
543
-
544
556
  initialize() {}
545
557
 
546
558
  initializeHooks() {