repository-provider 28.0.0 → 28.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/README.md CHANGED
@@ -69,12 +69,14 @@ console.log(await readme.getString());
69
69
  * [equals](#equals)
70
70
  * [Parameters](#parameters-9)
71
71
  * [provider](#provider)
72
- * [info](#info)
72
+ * [trace](#trace)
73
73
  * [Parameters](#parameters-10)
74
- * [warn](#warn)
74
+ * [info](#info)
75
75
  * [Parameters](#parameters-11)
76
- * [error](#error)
76
+ * [warn](#warn)
77
77
  * [Parameters](#parameters-12)
78
+ * [error](#error)
79
+ * [Parameters](#parameters-13)
78
80
  * [repositoryClass](#repositoryclass)
79
81
  * [pullRequestClass](#pullrequestclass)
80
82
  * [branchClass](#branchclass)
@@ -90,9 +92,9 @@ console.log(await readme.getString());
90
92
  * [avatarURL](#avatarurl)
91
93
  * [homePageURL](#homepageurl)
92
94
  * [MessageDestination](#messagedestination)
93
- * [Parameters](#parameters-13)
94
- * [BaseProvider](#baseprovider)
95
95
  * [Properties](#properties-1)
96
+ * [BaseProvider](#baseprovider)
97
+ * [Properties](#properties-2)
96
98
  * [equals](#equals-1)
97
99
  * [Parameters](#parameters-14)
98
100
  * [repositoryBases](#repositorybases)
@@ -148,7 +150,7 @@ console.log(await readme.getString());
148
150
  * [messageDestination](#messagedestination-1)
149
151
  * [Branch](#branch)
150
152
  * [Parameters](#parameters-31)
151
- * [Properties](#properties-2)
153
+ * [Properties](#properties-3)
152
154
  * [url](#url-1)
153
155
  * [refType](#reftype)
154
156
  * [isDefault](#isdefault)
@@ -164,13 +166,13 @@ console.log(await readme.getString());
164
166
  * [createBranch](#createbranch)
165
167
  * [Parameters](#parameters-36)
166
168
  * [CommitResult](#commitresult)
167
- * [Properties](#properties-3)
169
+ * [Properties](#properties-4)
168
170
  * [Commit](#commit-1)
169
171
  * [Parameters](#parameters-37)
170
- * [Properties](#properties-4)
172
+ * [Properties](#properties-5)
171
173
  * [Hook](#hook)
172
174
  * [Parameters](#parameters-38)
173
- * [Properties](#properties-5)
175
+ * [Properties](#properties-6)
174
176
  * [equals](#equals-2)
175
177
  * [Parameters](#parameters-39)
176
178
  * [toJSON](#tojson-1)
@@ -194,7 +196,7 @@ console.log(await readme.getString());
194
196
  * [Parameters](#parameters-48)
195
197
  * [NamedObject](#namedobject)
196
198
  * [Parameters](#parameters-49)
197
- * [Properties](#properties-6)
199
+ * [Properties](#properties-7)
198
200
  * [equals](#equals-3)
199
201
  * [Parameters](#parameters-50)
200
202
  * [displayName](#displayname)
@@ -204,7 +206,7 @@ console.log(await readme.getString());
204
206
  * [Parameters](#parameters-51)
205
207
  * [PullRequest](#pullrequest)
206
208
  * [Parameters](#parameters-52)
207
- * [Properties](#properties-7)
209
+ * [Properties](#properties-8)
208
210
  * [fullName](#fullname-2)
209
211
  * [url](#url-2)
210
212
  * [repository](#repository-1)
@@ -231,7 +233,7 @@ console.log(await readme.getString());
231
233
  * [merged](#merged)
232
234
  * [draft](#draft)
233
235
  * [ContentEntry](#contententry)
234
- * [Properties](#properties-8)
236
+ * [Properties](#properties-9)
235
237
  * [Ref](#ref)
236
238
  * [Parameters](#parameters-57)
237
239
  * [equals](#equals-5)
@@ -262,7 +264,7 @@ console.log(await readme.getString());
262
264
  * [isProtected](#isprotected-1)
263
265
  * [RepositoryGroup](#repositorygroup-1)
264
266
  * [Parameters](#parameters-63)
265
- * [Properties](#properties-9)
267
+ * [Properties](#properties-10)
266
268
  * [attributeMapping](#attributemapping-1)
267
269
  * [type](#type)
268
270
  * [url](#url-3)
@@ -270,7 +272,7 @@ console.log(await readme.getString());
270
272
  * [Parameters](#parameters-64)
271
273
  * [Repository](#repository-2)
272
274
  * [Parameters](#parameters-65)
273
- * [Properties](#properties-10)
275
+ * [Properties](#properties-11)
274
276
  * [fullName](#fullname-4)
275
277
  * [slug](#slug)
276
278
  * [provider](#provider-3)
@@ -283,6 +285,8 @@ console.log(await readme.getString());
283
285
  * [Parameters](#parameters-68)
284
286
  * [maybeEntry](#maybeentry-1)
285
287
  * [Parameters](#parameters-69)
288
+ * [commits](#commits)
289
+ * [Parameters](#parameters-70)
286
290
  * [urls](#urls)
287
291
  * [url](#url-4)
288
292
  * [cloneURL](#cloneurl)
@@ -296,40 +300,40 @@ console.log(await readme.getString());
296
300
  * [delete](#delete-2)
297
301
  * [defaultBranch](#defaultbranch)
298
302
  * [branch](#branch-2)
299
- * [Parameters](#parameters-70)
300
- * [branches](#branches-1)
301
303
  * [Parameters](#parameters-71)
302
- * [createBranch](#createbranch-1)
304
+ * [branches](#branches-1)
303
305
  * [Parameters](#parameters-72)
304
- * [addBranch](#addbranch)
306
+ * [createBranch](#createbranch-1)
305
307
  * [Parameters](#parameters-73)
306
- * [deleteBranch](#deletebranch)
308
+ * [addBranch](#addbranch)
307
309
  * [Parameters](#parameters-74)
308
- * [tag](#tag)
310
+ * [deleteBranch](#deletebranch)
309
311
  * [Parameters](#parameters-75)
310
- * [tags](#tags-1)
312
+ * [tag](#tag)
311
313
  * [Parameters](#parameters-76)
312
- * [addTag](#addtag)
314
+ * [tags](#tags-1)
313
315
  * [Parameters](#parameters-77)
314
- * [createPullRequest](#createpullrequest-1)
316
+ * [addTag](#addtag)
315
317
  * [Parameters](#parameters-78)
316
- * [addPullRequest](#addpullrequest)
318
+ * [createPullRequest](#createpullrequest-1)
317
319
  * [Parameters](#parameters-79)
320
+ * [addPullRequest](#addpullrequest)
321
+ * [Parameters](#parameters-80)
318
322
  * [pullRequests](#pullrequests-1)
319
323
  * [pullRequest](#pullrequest-1)
320
- * [Parameters](#parameters-80)
321
- * [deletePullRequest](#deletepullrequest)
322
324
  * [Parameters](#parameters-81)
323
- * [addHook](#addhook)
325
+ * [deletePullRequest](#deletepullrequest)
324
326
  * [Parameters](#parameters-82)
325
- * [createHook](#createhook)
327
+ * [addHook](#addhook)
326
328
  * [Parameters](#parameters-83)
329
+ * [createHook](#createhook)
330
+ * [Parameters](#parameters-84)
327
331
  * [hooks](#hooks-1)
328
332
  * [hook](#hook-1)
329
- * [Parameters](#parameters-84)
333
+ * [Parameters](#parameters-85)
330
334
  * [type](#type-1)
331
335
  * [refId](#refid-1)
332
- * [Parameters](#parameters-85)
336
+ * [Parameters](#parameters-86)
333
337
  * [toString](#tostring-1)
334
338
  * [toJSON](#tojson-3)
335
339
  * [attributes](#attributes-2)
@@ -339,23 +343,23 @@ console.log(await readme.getString());
339
343
  * [Review](#review)
340
344
  * [SingleGroupProvider](#singlegroupprovider)
341
345
  * [repository](#repository-3)
342
- * [Parameters](#parameters-86)
343
- * [repositoryGroup](#repositorygroup-2)
344
346
  * [Parameters](#parameters-87)
345
- * [repositoryGroups](#repositorygroups-1)
347
+ * [repositoryGroup](#repositorygroup-2)
346
348
  * [Parameters](#parameters-88)
349
+ * [repositoryGroups](#repositorygroups-1)
350
+ * [Parameters](#parameters-89)
347
351
  * [Tag](#tag-1)
348
- * [Parameters](#parameters-89)
352
+ * [Parameters](#parameters-90)
349
353
  * [refType](#reftype-1)
350
354
  * [isWritable](#iswritable-1)
351
355
  * [asArray](#asarray)
352
- * [Parameters](#parameters-90)
353
- * [stripBaseName](#stripbasename)
354
356
  * [Parameters](#parameters-91)
355
- * [stripBaseNames](#stripbasenames)
357
+ * [stripBaseName](#stripbasename)
356
358
  * [Parameters](#parameters-92)
357
- * [generateBranchName](#generatebranchname)
359
+ * [stripBaseNames](#stripbasenames)
358
360
  * [Parameters](#parameters-93)
361
+ * [generateBranchName](#generatebranchname)
362
+ * [Parameters](#parameters-94)
359
363
 
360
364
  ## Application
361
365
 
@@ -514,6 +518,14 @@ The provider we live in.
514
518
 
515
519
  Returns **[BaseProvider](#baseprovider)**
516
520
 
521
+ ### trace
522
+
523
+ Forwarded to the owner.
524
+
525
+ #### Parameters
526
+
527
+ * `args` **...any**
528
+
517
529
  ### info
518
530
 
519
531
  Forwarded to the owner.
@@ -622,7 +634,7 @@ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
622
634
 
623
635
  Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
624
636
 
625
- ### Parameters
637
+ ### Properties
626
638
 
627
639
  * `info` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**
628
640
  * `warn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**
@@ -868,11 +880,12 @@ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
868
880
 
869
881
  Extract options suitable for the constructor
870
882
  form the given set of environment variables.
883
+ Object with the detected key value pairs is delivered.
871
884
 
872
885
  #### Parameters
873
886
 
874
- * `env` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** taken from process.env
875
- * `instanceIdentifier` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** (optional, default `this.instanceIdentifier`)
887
+ * `env` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** as from process.env
888
+ * `instanceIdentifier` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** part of variable name. (optional, default `this.instanceIdentifier`)
876
889
 
877
890
  Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** undefined if no suitable environment variables have been found
878
891
 
@@ -901,16 +914,16 @@ Returns **[BaseProvider](#baseprovider)** newly created provider or undefined if
901
914
 
902
915
  ## priority
903
916
 
904
- In case there are several provider able to support a given source which one sould be used ?
917
+ In case there are several providers able to support a given source which one sould be used ?
905
918
  this defines the order
906
919
 
907
920
  ## name
908
921
 
909
- Name of the provider
922
+ Name of the provider.
910
923
 
911
924
  ## messageDestination
912
925
 
913
- to forward info/warn and error messages to
926
+ To forward info/warn and error messages to
914
927
 
915
928
  ## Branch
916
929
 
@@ -940,7 +953,7 @@ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
940
953
 
941
954
  ### refType
942
955
 
943
- Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** tags
956
+ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** heades
944
957
 
945
958
  ### isDefault
946
959
 
@@ -1035,6 +1048,8 @@ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Globa
1035
1048
  * `repository` **[Repository](#repository)**
1036
1049
  * `message` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
1037
1050
  * `sha` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
1051
+ * `author` **User**
1052
+ * `committer` **User**
1038
1053
 
1039
1054
  ## Hook
1040
1055
 
@@ -1322,8 +1337,8 @@ Returns **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Glob
1322
1337
 
1323
1338
  ### list
1324
1339
 
1325
- List all pull request for a given repo
1326
- result will be filtered by source branch, destination branch and states
1340
+ List all pull request for a given repo.
1341
+ Result will be filtered by source branch, destination branch and states
1327
1342
 
1328
1343
  #### Parameters
1329
1344
 
@@ -1683,6 +1698,16 @@ Get exactly one matching entry by name or undefined if no such entry is found.
1683
1698
 
1684
1699
  Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[ContentEntry](#contententry)>**
1685
1700
 
1701
+ ### commits
1702
+
1703
+ List commits of the default branch.
1704
+
1705
+ #### Parameters
1706
+
1707
+ * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
1708
+
1709
+ Returns **AsyncIterator<[Commit](#commit)>** all matching commits in the repository
1710
+
1686
1711
  ### urls
1687
1712
 
1688
1713
  Urls to access the repo.
@@ -1840,7 +1865,7 @@ Returns **[Tag](#tag)** newly created tag
1840
1865
 
1841
1866
  ### createPullRequest
1842
1867
 
1843
- Create a pull request (or deliver an already present for thefiven name).
1868
+ Create a pull request (or deliver an already present for the given name).
1844
1869
 
1845
1870
  #### Parameters
1846
1871
 
@@ -2026,6 +2051,8 @@ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
2026
2051
 
2027
2052
  ### isWritable
2028
2053
 
2054
+ Tags cannot be written to.
2055
+
2029
2056
  Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** false
2030
2057
 
2031
2058
  ## asArray
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repository-provider",
3
- "version": "28.0.0",
3
+ "version": "28.2.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -33,10 +33,10 @@
33
33
  "matching-iterator": "^2.0.4"
34
34
  },
35
35
  "devDependencies": {
36
- "ava": "^4.1.0",
37
- "c8": "^7.11.0",
36
+ "ava": "^4.2.0",
37
+ "c8": "^7.11.2",
38
38
  "documentation": "^13.2.5",
39
- "repository-provider-test-support": "^1.12.11",
39
+ "repository-provider-test-support": "^2.1.2",
40
40
  "semantic-release": "^19.0.2",
41
41
  "typescript": "^4.6.3"
42
42
  },
@@ -98,6 +98,14 @@ export class BaseObject {
98
98
  return this.owner.provider;
99
99
  }
100
100
 
101
+ /**
102
+ * Forwarded to the owner.
103
+ * @param {...any} args
104
+ */
105
+ trace(...args) {
106
+ return this.owner.trace(...args);
107
+ }
108
+
101
109
  /**
102
110
  * Forwarded to the owner.
103
111
  * @param {...any} args
@@ -166,7 +174,7 @@ export class BaseObject {
166
174
  * By default we use the owners implementation.
167
175
  * @return {Function} as defined in the owner
168
176
  */
169
- get hookClass() {
177
+ get hookClass() {
170
178
  return this.owner.hookClass;
171
179
  }
172
180
  }
@@ -31,7 +31,8 @@ export class BaseProvider extends BaseObject {
31
31
  /**
32
32
  * Extract options suitable for the constructor
33
33
  * form the given set of environment variables.
34
- * @param {Object} env as of from process.env
34
+ * Object with the detected key value pairs is delivered.
35
+ * @param {Object} env as from process.env
35
36
  * @param {string} instanceIdentifier part of variable name.
36
37
  * @return {Object} undefined if no suitable environment variables have been found
37
38
  */
@@ -58,8 +59,11 @@ export class BaseProvider extends BaseObject {
58
59
  if (options === undefined) {
59
60
  options = {};
60
61
  }
61
- options[name] = value;
62
- Object.assign(options, attribute.additionalAttributes);
62
+
63
+ if(options[name] === undefined) {
64
+ options[name] = value;
65
+ Object.assign(options, attribute.additionalAttributes);
66
+ }
63
67
  break;
64
68
  }
65
69
  }
@@ -449,6 +453,10 @@ export class BaseProvider extends BaseObject {
449
453
 
450
454
  initializeRepositories() {}
451
455
 
456
+ trace(...args) {
457
+ return this.messageDestination.trace(...args);
458
+ }
459
+
452
460
  info(...args) {
453
461
  return this.messageDestination.info(...args);
454
462
  }
@@ -52,8 +52,8 @@ export class PullRequest extends NamedObject {
52
52
  }
53
53
 
54
54
  /**
55
- * List all pull request for a given repo
56
- * result will be filtered by source branch, destination branch and states
55
+ * List all pull request for a given repo.
56
+ * Result will be filtered by source branch, destination branch and states
57
57
  * @param {Repository} repository
58
58
  * @param {Object} filter
59
59
  * @param {Branch?} filter.source
@@ -260,6 +260,15 @@ export class Repository extends NamedObject {
260
260
  * @return {Promise<Branch>}
261
261
  */
262
262
  async branch(name) {
263
+ if(name === this.defaultBranchName) {
264
+ const branch = this._branches.get(name);
265
+ if(branch) {
266
+ return branch;
267
+ }
268
+
269
+ return this.addBranch(name);
270
+ }
271
+
263
272
  await this.initializeBranches();
264
273
  return this._branches.get(name);
265
274
  }
@@ -358,7 +367,7 @@ export class Repository extends NamedObject {
358
367
  }
359
368
 
360
369
  /**
361
- * Create a pull request (or deliver an already present for thefiven name).
370
+ * Create a pull request (or deliver an already present for the given name).
362
371
  * @param {string} name of the pr
363
372
  * @param {Branch} source branch
364
373
  * @param {Object} options