repository-provider 26.1.0 → 26.2.0

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,128 +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)
145
+ * [refType](#reftype)
141
146
  * [isDefault](#isdefault)
142
147
  * [delete](#delete)
143
148
  * [commit](#commit-2)
144
- * [Parameters](#parameters-29)
149
+ * [Parameters](#parameters-31)
145
150
  * [commitIntoPullRequest](#commitintopullrequest)
146
- * [Parameters](#parameters-30)
151
+ * [Parameters](#parameters-32)
147
152
  * [removeEntries](#removeentries)
148
- * [Parameters](#parameters-31)
153
+ * [Parameters](#parameters-33)
149
154
  * [entryClass](#entryclass-1)
150
155
  * [createPullRequest](#createpullrequest)
151
- * [Parameters](#parameters-32)
156
+ * [Parameters](#parameters-34)
152
157
  * [pullRequestClass](#pullrequestclass-1)
153
158
  * [createBranch](#createbranch)
154
- * [Parameters](#parameters-33)
159
+ * [Parameters](#parameters-35)
155
160
  * [Hook](#hook)
156
- * [Parameters](#parameters-34)
161
+ * [Parameters](#parameters-36)
157
162
  * [Properties](#properties-6)
158
163
  * [equals](#equals-2)
159
- * [Parameters](#parameters-35)
164
+ * [Parameters](#parameters-37)
160
165
  * [toJSON](#tojson-1)
161
166
  * [Issue](#issue)
162
- * [Parameters](#parameters-36)
167
+ * [Parameters](#parameters-38)
163
168
  * [Milestone](#milestone)
164
- * [Parameters](#parameters-37)
169
+ * [Parameters](#parameters-39)
165
170
  * [MultiGroupProvider](#multigroupprovider)
166
- * [Parameters](#parameters-38)
171
+ * [Parameters](#parameters-40)
167
172
  * [repository](#repository)
168
- * [Parameters](#parameters-39)
173
+ * [Parameters](#parameters-41)
169
174
  * [repositoryGroup](#repositorygroup)
170
- * [Parameters](#parameters-40)
175
+ * [Parameters](#parameters-42)
171
176
  * [repositoryGroups](#repositorygroups)
172
- * [Parameters](#parameters-41)
177
+ * [Parameters](#parameters-43)
173
178
  * [createRepositoryGroup](#createrepositorygroup)
174
- * [Parameters](#parameters-42)
179
+ * [Parameters](#parameters-44)
175
180
  * [addRepositoryGroup](#addrepositorygroup)
176
- * [Parameters](#parameters-43)
181
+ * [Parameters](#parameters-45)
177
182
  * [NamedObject](#namedobject)
178
- * [Parameters](#parameters-44)
183
+ * [Parameters](#parameters-46)
179
184
  * [Properties](#properties-7)
180
185
  * [equals](#equals-3)
181
- * [Parameters](#parameters-45)
186
+ * [Parameters](#parameters-47)
182
187
  * [displayName](#displayname)
183
188
  * [update](#update)
184
189
  * [toJSON](#tojson-2)
185
190
  * [Project](#project)
186
- * [Parameters](#parameters-46)
191
+ * [Parameters](#parameters-48)
187
192
  * [PullRequest](#pullrequest)
188
- * [Parameters](#parameters-47)
193
+ * [Parameters](#parameters-49)
189
194
  * [Properties](#properties-8)
190
195
  * [fullName](#fullname)
191
196
  * [url](#url-2)
192
197
  * [repository](#repository-1)
193
198
  * [provider](#provider-1)
194
199
  * [equals](#equals-4)
195
- * [Parameters](#parameters-48)
200
+ * [Parameters](#parameters-50)
196
201
  * [delete](#delete-1)
197
202
  * [merge](#merge)
198
- * [Parameters](#parameters-49)
203
+ * [Parameters](#parameters-51)
199
204
  * [decline](#decline)
200
205
  * [reviews](#reviews)
201
206
  * [identifier](#identifier)
@@ -203,9 +208,9 @@ console.log(await readme.getString());
203
208
  * [defaultListStates](#defaultliststates)
204
209
  * [validMergeMethods](#validmergemethods)
205
210
  * [list](#list-1)
206
- * [Parameters](#parameters-50)
211
+ * [Parameters](#parameters-52)
207
212
  * [open](#open)
208
- * [Parameters](#parameters-51)
213
+ * [Parameters](#parameters-53)
209
214
  * [title](#title)
210
215
  * [body](#body)
211
216
  * [state](#state)
@@ -215,19 +220,19 @@ console.log(await readme.getString());
215
220
  * [ContentEntry](#contententry)
216
221
  * [Properties](#properties-9)
217
222
  * [Ref](#ref)
218
- * [Parameters](#parameters-52)
223
+ * [Parameters](#parameters-54)
219
224
  * [equals](#equals-5)
220
- * [Parameters](#parameters-53)
225
+ * [Parameters](#parameters-55)
221
226
  * [ref](#ref-1)
222
227
  * [refId](#refid)
223
- * [Parameters](#parameters-54)
228
+ * [Parameters](#parameters-56)
224
229
  * [entries](#entries)
225
- * [Parameters](#parameters-55)
230
+ * [Parameters](#parameters-57)
226
231
  * [asyncIterator](#asynciterator)
227
232
  * [maybeEntry](#maybeentry)
228
- * [Parameters](#parameters-56)
233
+ * [Parameters](#parameters-58)
229
234
  * [entry](#entry)
230
- * [Parameters](#parameters-57)
235
+ * [Parameters](#parameters-59)
231
236
  * [provider](#provider-2)
232
237
  * [owner](#owner)
233
238
  * [fullName](#fullname-1)
@@ -243,7 +248,7 @@ console.log(await readme.getString());
243
248
  * [attributes](#attributes-1)
244
249
  * [isProtected](#isprotected-1)
245
250
  * [RepositoryGroup](#repositorygroup-1)
246
- * [Parameters](#parameters-58)
251
+ * [Parameters](#parameters-60)
247
252
  * [Properties](#properties-10)
248
253
  * [repositoryClass](#repositoryclass-1)
249
254
  * [branchClass](#branchclass-1)
@@ -254,22 +259,22 @@ console.log(await readme.getString());
254
259
  * [type](#type)
255
260
  * [url](#url-3)
256
261
  * [RepositoryOwner](#repositoryowner)
257
- * [Parameters](#parameters-59)
262
+ * [Parameters](#parameters-61)
258
263
  * [Repository](#repository-2)
259
- * [Parameters](#parameters-60)
264
+ * [Parameters](#parameters-62)
260
265
  * [Properties](#properties-11)
261
266
  * [fullName](#fullname-2)
262
267
  * [slug](#slug)
263
268
  * [provider](#provider-3)
264
269
  * [identifier](#identifier-2)
265
270
  * [equals](#equals-6)
266
- * [Parameters](#parameters-61)
271
+ * [Parameters](#parameters-63)
267
272
  * [entry](#entry-1)
268
- * [Parameters](#parameters-62)
273
+ * [Parameters](#parameters-64)
269
274
  * [entries](#entries-1)
270
- * [Parameters](#parameters-63)
275
+ * [Parameters](#parameters-65)
271
276
  * [maybeEntry](#maybeentry-1)
272
- * [Parameters](#parameters-64)
277
+ * [Parameters](#parameters-66)
273
278
  * [urls](#urls)
274
279
  * [url](#url-4)
275
280
  * [cloneURL](#cloneurl)
@@ -281,40 +286,40 @@ console.log(await readme.getString());
281
286
  * [isDisabled](#isdisabled-1)
282
287
  * [isTemplate](#istemplate)
283
288
  * [branch](#branch-1)
284
- * [Parameters](#parameters-65)
289
+ * [Parameters](#parameters-67)
285
290
  * [defaultBranch](#defaultbranch)
286
291
  * [branches](#branches-1)
287
- * [Parameters](#parameters-66)
292
+ * [Parameters](#parameters-68)
288
293
  * [createBranch](#createbranch-1)
289
- * [Parameters](#parameters-67)
294
+ * [Parameters](#parameters-69)
290
295
  * [addBranch](#addbranch)
291
- * [Parameters](#parameters-68)
296
+ * [Parameters](#parameters-70)
292
297
  * [deleteBranch](#deletebranch)
293
- * [Parameters](#parameters-69)
298
+ * [Parameters](#parameters-71)
294
299
  * [tags](#tags-1)
295
- * [Parameters](#parameters-70)
300
+ * [Parameters](#parameters-72)
296
301
  * [tag](#tag)
297
- * [Parameters](#parameters-71)
302
+ * [Parameters](#parameters-73)
298
303
  * [delete](#delete-2)
299
304
  * [createPullRequest](#createpullrequest-1)
300
- * [Parameters](#parameters-72)
305
+ * [Parameters](#parameters-74)
301
306
  * [addPullRequest](#addpullrequest)
302
- * [Parameters](#parameters-73)
307
+ * [Parameters](#parameters-75)
303
308
  * [pullRequests](#pullrequests-1)
304
309
  * [pullRequest](#pullrequest-1)
305
- * [Parameters](#parameters-74)
310
+ * [Parameters](#parameters-76)
306
311
  * [deletePullRequest](#deletepullrequest)
307
- * [Parameters](#parameters-75)
312
+ * [Parameters](#parameters-77)
308
313
  * [addHook](#addhook)
309
- * [Parameters](#parameters-76)
314
+ * [Parameters](#parameters-78)
310
315
  * [createHook](#createhook)
311
- * [Parameters](#parameters-77)
316
+ * [Parameters](#parameters-79)
312
317
  * [hooks](#hooks-1)
313
318
  * [hook](#hook-1)
314
- * [Parameters](#parameters-78)
319
+ * [Parameters](#parameters-80)
315
320
  * [type](#type-1)
316
321
  * [refId](#refid-1)
317
- * [Parameters](#parameters-79)
322
+ * [Parameters](#parameters-81)
318
323
  * [repositoryClass](#repositoryclass-2)
319
324
  * [pullRequestClass](#pullrequestclass-3)
320
325
  * [branchClass](#branchclass-2)
@@ -328,22 +333,23 @@ console.log(await readme.getString());
328
333
  * [Review](#review)
329
334
  * [SingleGroupProvider](#singlegroupprovider)
330
335
  * [repository](#repository-3)
331
- * [Parameters](#parameters-80)
336
+ * [Parameters](#parameters-82)
332
337
  * [repositoryGroup](#repositorygroup-2)
333
- * [Parameters](#parameters-81)
338
+ * [Parameters](#parameters-83)
334
339
  * [repositoryGroups](#repositorygroups-1)
335
- * [Parameters](#parameters-82)
340
+ * [Parameters](#parameters-84)
336
341
  * [Tag](#tag-1)
337
- * [Parameters](#parameters-83)
342
+ * [Parameters](#parameters-85)
343
+ * [refType](#reftype-1)
338
344
  * [isWritable](#iswritable-1)
339
345
  * [asArray](#asarray)
340
- * [Parameters](#parameters-84)
346
+ * [Parameters](#parameters-86)
341
347
  * [stripBaseName](#stripbasename)
342
- * [Parameters](#parameters-85)
348
+ * [Parameters](#parameters-87)
343
349
  * [stripBaseNames](#stripbasenames)
344
- * [Parameters](#parameters-86)
350
+ * [Parameters](#parameters-88)
345
351
  * [generateBranchName](#generatebranchname)
346
- * [Parameters](#parameters-87)
352
+ * [Parameters](#parameters-89)
347
353
 
348
354
  ## Application
349
355
 
@@ -395,6 +401,17 @@ Object.definedProperties(new aClass(),{ with_default: { value: 77 }})
395
401
  * `properties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** object properties (optional, default `{}`)
396
402
  * `attributes` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `object.constructor.attributes`)
397
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
+
398
415
  ## setAttribute
399
416
 
400
417
  Set Object attribute.
@@ -551,7 +568,7 @@ Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
551
568
 
552
569
  ### repositoryBases
553
570
 
554
- All possible base urls.
571
+ All supported base urls.
555
572
  For github something like:
556
573
 
557
574
  * <git@github.com>
@@ -564,7 +581,7 @@ Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Gl
564
581
 
565
582
  ### normalizeRepositoryName
566
583
 
567
- Bring a repository name into its normal form by removing any clutter
584
+ Bring a repository name into its normal form by removing any clutter.
568
585
  like .git suffix or #branch names.
569
586
 
570
587
  #### Parameters
@@ -576,7 +593,7 @@ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
576
593
 
577
594
  ### normalizeGroupName
578
595
 
579
- Bring a group name into its normal form by removing any clutter
596
+ Bring a group name into its normal form by removing any clutter.
580
597
  like .git suffix or #branch names.
581
598
 
582
599
  #### Parameters
@@ -588,7 +605,7 @@ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
588
605
 
589
606
  ### areRepositoryNamesCaseSensitive
590
607
 
591
- Are repositroy names case sensitive.
608
+ Are repository names case sensitive.
592
609
  Overwrite and return false if you want to have case insensitive repository lookup
593
610
 
594
611
  Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true
@@ -622,6 +639,17 @@ base, group, repository and branch.
622
639
 
623
640
  Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** with separated attributes
624
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
+
625
653
  ### list
626
654
 
627
655
  List provider objects of a given type.
@@ -701,14 +729,6 @@ List pull requests.
701
729
 
702
730
  Returns **AsyncIterator<[PullRequest](#pullrequest)>** all matching pullRequests of the provider
703
731
 
704
- ### repositoryGroupClass
705
-
706
- Returns **Class** repository group class used by the Provider
707
-
708
- ### hookClass
709
-
710
- Returns **Class** hook class used by the Provider
711
-
712
732
  ### name
713
733
 
714
734
  Deliver the provider name.
@@ -730,6 +750,14 @@ Returns **any** url otf the provider.
730
750
  List all defined entries from attributes.
731
751
  return {object}
732
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
+
733
761
  ### repositoryClass
734
762
 
735
763
  Returns **Class** repository class used by the Provider
@@ -780,7 +808,7 @@ Creates a new provider for a given set of options.
780
808
 
781
809
  * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** additional options (optional, default `{}`)
782
810
 
783
- * `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
784
812
  * `env` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** taken from process.env
785
813
 
786
814
  Returns **[BaseProvider](#baseprovider)** newly created provider or undefined if options are not sufficient to construct a provider
@@ -853,6 +881,10 @@ Deliver repository and branch url combined.
853
881
 
854
882
  Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 'repoUrl#branch'
855
883
 
884
+ ### refType
885
+
886
+ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** tags
887
+
856
888
  ### isDefault
857
889
 
858
890
  Are we the default branch.
@@ -1954,6 +1986,10 @@ Tag refs
1954
1986
  * `name`
1955
1987
  * `options`
1956
1988
 
1989
+ ### refType
1990
+
1991
+ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** tags
1992
+
1957
1993
  ### isWritable
1958
1994
 
1959
1995
  Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repository-provider",
3
- "version": "26.1.0",
3
+ "version": "26.2.0",
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.0",
40
- "semantic-release": "^18.0.1",
41
- "typescript": "^4.6.0-dev.20211230"
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",
package/src/attribute.mjs CHANGED
@@ -46,8 +46,8 @@ export function definePropertiesFromOptions(
46
46
 
47
47
  let value = options[name];
48
48
  if (value === undefined) {
49
- if (typeof attribute.default === "function") {
50
- value = attribute.default(attribute, object);
49
+ if (attribute.getDefault) {
50
+ value = attribute.getDefault(attribute, object);
51
51
  } else if (
52
52
  attribute.default !== undefined &&
53
53
  attribute.default !== getAttribute(object, name)
@@ -102,6 +102,28 @@ export function definePropertiesFromOptions(
102
102
  Object.assign(object, applyLater);
103
103
  }
104
104
 
105
+ /**
106
+ * Get default values.
107
+ * @param {Object} attributes
108
+ * @return {Object} filled with default values
109
+ */
110
+ export function defaultValues(attributes, object) {
111
+ return Object.fromEntries(
112
+ Object.entries(attributes).reduce((a, c) => {
113
+ const [name, attribute] = c;
114
+
115
+ if (attribute.default !== undefined) {
116
+ a.push([name, attribute.default]);
117
+ }
118
+ else if (attribute.getDefault !== undefined) {
119
+ a.push([name, attribute.getDefault(attribute, object)]);
120
+ }
121
+
122
+ return a;
123
+ }, [])
124
+ );
125
+ }
126
+
105
127
  /**
106
128
  * Set Object attribute.
107
129
  * The name may be a property path like 'a.b.c'.
@@ -126,7 +126,7 @@ export class BaseProvider {
126
126
  /**
127
127
  * Creates a new provider for a given set of options.
128
128
  * @param {Object} options additional options
129
- * @param {string} [options.instanceIdentifier]
129
+ * @param {string} [options.instanceIdentifier] name of the provider instance
130
130
  * @param {Object} env taken from process.env
131
131
  * @return {BaseProvider} newly created provider or undefined if options are not sufficient to construct a provider
132
132
  */
@@ -153,7 +153,7 @@ export class BaseProvider {
153
153
  }
154
154
 
155
155
  /**
156
- * All possible base urls.
156
+ * All supported base urls.
157
157
  * For github something like:
158
158
  * - git@github.com
159
159
  * - git://github.com
@@ -293,6 +293,12 @@ export class BaseProvider {
293
293
  return result;
294
294
  }
295
295
 
296
+ /**
297
+ * Create a repository.
298
+ * @param {string} name of group and repository
299
+ * @param {Object} options
300
+ * @returns {Promise<Repository>}
301
+ */
296
302
  async createRepository(name, options) {
297
303
  const { group, repository } = this.parseName(name);
298
304
  const rg = await this.repositoryGroup(group);
@@ -311,7 +317,7 @@ export class BaseProvider {
311
317
  yield* group[type]();
312
318
  }
313
319
  } else {
314
- for (let pattern of asArray(patterns)) {
320
+ for (const pattern of asArray(patterns)) {
315
321
  const [groupPattern, repoPattern] = stripBaseName(
316
322
  pattern,
317
323
  this.repositoryBases
@@ -387,20 +393,6 @@ export class BaseProvider {
387
393
  yield* this.list("pullRequests", patterns);
388
394
  }
389
395
 
390
- /**
391
- * @return {Class} repository group class used by the Provider
392
- */
393
- get repositoryGroupClass() {
394
- return RepositoryGroup;
395
- }
396
-
397
- /**
398
- * @return {Class} hook class used by the Provider
399
- */
400
- get hookClass() {
401
- return Hook;
402
- }
403
-
404
396
  /**
405
397
  * Deliver the provider name.
406
398
  * @return {string} class name by default
@@ -448,6 +440,34 @@ export class BaseProvider {
448
440
  return json;
449
441
  }
450
442
 
443
+ initializeRepositories() {}
444
+
445
+ info(...args) {
446
+ return this.messageDestination.info(...args);
447
+ }
448
+
449
+ warn(...args) {
450
+ return this.messageDestination.warn(...args);
451
+ }
452
+
453
+ error(...args) {
454
+ return this.messageDestination.error(...args);
455
+ }
456
+
457
+ /**
458
+ * @return {Class} repository group class used by the Provider
459
+ */
460
+ get repositoryGroupClass() {
461
+ return RepositoryGroup;
462
+ }
463
+
464
+ /**
465
+ * @return {Class} hook class used by the Provider
466
+ */
467
+ get hookClass() {
468
+ return Hook;
469
+ }
470
+
451
471
  /**
452
472
  * @return {Class} repository class used by the Provider
453
473
  */
@@ -462,6 +482,13 @@ export class BaseProvider {
462
482
  return Branch;
463
483
  }
464
484
 
485
+ /**
486
+ * @return {Class} branch class used by the Provider
487
+ */
488
+ get tagClass() {
489
+ return Tag;
490
+ }
491
+
465
492
  /**
466
493
  * @return {Class} entry class used by the Provider
467
494
  */
@@ -475,18 +502,4 @@ export class BaseProvider {
475
502
  get pullRequestClass() {
476
503
  return PullRequest;
477
504
  }
478
-
479
- initializeRepositories() {}
480
-
481
- info(...args) {
482
- return this.messageDestination.info(...args);
483
- }
484
-
485
- warn(...args) {
486
- return this.messageDestination.warn(...args);
487
- }
488
-
489
- error(...args) {
490
- return this.messageDestination.error(...args);
491
- }
492
505
  }
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) {
@@ -77,6 +77,14 @@ export class RepositoryGroup extends RepositoryOwner(NamedObject) {
77
77
  return this.provider.branchClass;
78
78
  }
79
79
 
80
+ /**
81
+ * By default we use the providers implementation.
82
+ * @return {Class} as defined in the provider
83
+ */
84
+ get tagClass() {
85
+ return this.provider.branchClass;
86
+ }
87
+
80
88
  /**
81
89
  * By default we use the providers implementation.
82
90
  * @return {Class} as defined in the provider
@@ -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