repository-provider 28.1.1 → 28.3.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)
@@ -94,36 +96,36 @@ console.log(await readme.getString());
94
96
  * [BaseProvider](#baseprovider)
95
97
  * [Properties](#properties-2)
96
98
  * [equals](#equals-1)
97
- * [Parameters](#parameters-13)
99
+ * [Parameters](#parameters-14)
98
100
  * [repositoryBases](#repositorybases)
99
101
  * [normalizeRepositoryName](#normalizerepositoryname)
100
- * [Parameters](#parameters-14)
101
- * [normalizeGroupName](#normalizegroupname)
102
102
  * [Parameters](#parameters-15)
103
+ * [normalizeGroupName](#normalizegroupname)
104
+ * [Parameters](#parameters-16)
103
105
  * [areRepositoryNamesCaseSensitive](#arerepositorynamescasesensitive)
104
106
  * [areGroupNamesCaseSensitive](#aregroupnamescasesensitive)
105
107
  * [supportsBase](#supportsbase)
106
- * [Parameters](#parameters-16)
107
- * [parseName](#parsename)
108
108
  * [Parameters](#parameters-17)
109
- * [createRepository](#createrepository)
109
+ * [parseName](#parsename)
110
110
  * [Parameters](#parameters-18)
111
- * [list](#list)
111
+ * [createRepository](#createrepository)
112
112
  * [Parameters](#parameters-19)
113
- * [projects](#projects)
113
+ * [list](#list)
114
114
  * [Parameters](#parameters-20)
115
- * [milestones](#milestones)
115
+ * [projects](#projects)
116
116
  * [Parameters](#parameters-21)
117
- * [repositories](#repositories)
117
+ * [milestones](#milestones)
118
118
  * [Parameters](#parameters-22)
119
- * [branches](#branches)
119
+ * [repositories](#repositories)
120
120
  * [Parameters](#parameters-23)
121
- * [tags](#tags)
121
+ * [branches](#branches)
122
122
  * [Parameters](#parameters-24)
123
- * [hooks](#hooks)
123
+ * [tags](#tags)
124
124
  * [Parameters](#parameters-25)
125
- * [pullRequests](#pullrequests)
125
+ * [hooks](#hooks)
126
126
  * [Parameters](#parameters-26)
127
+ * [pullRequests](#pullrequests)
128
+ * [Parameters](#parameters-27)
127
129
  * [name](#name)
128
130
  * [fullName](#fullname)
129
131
  * [provider](#provider-1)
@@ -138,82 +140,82 @@ console.log(await readme.getString());
138
140
  * [pullRequestClass](#pullrequestclass-1)
139
141
  * [instanceIdentifier](#instanceidentifier)
140
142
  * [optionsFromEnvironment](#optionsfromenvironment)
141
- * [Parameters](#parameters-27)
142
- * [areOptionsSufficcient](#areoptionssufficcient)
143
143
  * [Parameters](#parameters-28)
144
- * [initialize](#initialize)
144
+ * [areOptionsSufficcient](#areoptionssufficcient)
145
145
  * [Parameters](#parameters-29)
146
+ * [initialize](#initialize)
147
+ * [Parameters](#parameters-30)
146
148
  * [priority](#priority)
147
149
  * [name](#name-1)
148
150
  * [messageDestination](#messagedestination-1)
149
151
  * [Branch](#branch)
150
- * [Parameters](#parameters-30)
152
+ * [Parameters](#parameters-31)
151
153
  * [Properties](#properties-3)
152
154
  * [url](#url-1)
153
155
  * [refType](#reftype)
154
156
  * [isDefault](#isdefault)
155
157
  * [delete](#delete)
156
158
  * [commit](#commit)
157
- * [Parameters](#parameters-31)
158
- * [commitIntoPullRequest](#commitintopullrequest)
159
159
  * [Parameters](#parameters-32)
160
- * [removeEntries](#removeentries)
160
+ * [commitIntoPullRequest](#commitintopullrequest)
161
161
  * [Parameters](#parameters-33)
162
- * [createPullRequest](#createpullrequest)
162
+ * [removeEntries](#removeentries)
163
163
  * [Parameters](#parameters-34)
164
- * [createBranch](#createbranch)
164
+ * [createPullRequest](#createpullrequest)
165
165
  * [Parameters](#parameters-35)
166
+ * [createBranch](#createbranch)
167
+ * [Parameters](#parameters-36)
166
168
  * [CommitResult](#commitresult)
167
169
  * [Properties](#properties-4)
168
170
  * [Commit](#commit-1)
169
- * [Parameters](#parameters-36)
171
+ * [Parameters](#parameters-37)
170
172
  * [Properties](#properties-5)
171
173
  * [Hook](#hook)
172
- * [Parameters](#parameters-37)
174
+ * [Parameters](#parameters-38)
173
175
  * [Properties](#properties-6)
174
176
  * [equals](#equals-2)
175
- * [Parameters](#parameters-38)
177
+ * [Parameters](#parameters-39)
176
178
  * [toJSON](#tojson-1)
177
179
  * [Issue](#issue)
178
- * [Parameters](#parameters-39)
179
- * [Milestone](#milestone)
180
180
  * [Parameters](#parameters-40)
181
- * [MultiGroupProvider](#multigroupprovider)
181
+ * [Milestone](#milestone)
182
182
  * [Parameters](#parameters-41)
183
+ * [MultiGroupProvider](#multigroupprovider)
184
+ * [Parameters](#parameters-42)
183
185
  * [repository](#repository)
184
- * [Parameters](#parameters-42)
185
- * [branch](#branch-1)
186
186
  * [Parameters](#parameters-43)
187
- * [repositoryGroup](#repositorygroup)
187
+ * [branch](#branch-1)
188
188
  * [Parameters](#parameters-44)
189
- * [repositoryGroups](#repositorygroups)
189
+ * [repositoryGroup](#repositorygroup)
190
190
  * [Parameters](#parameters-45)
191
- * [createRepositoryGroup](#createrepositorygroup)
191
+ * [repositoryGroups](#repositorygroups)
192
192
  * [Parameters](#parameters-46)
193
- * [addRepositoryGroup](#addrepositorygroup)
193
+ * [createRepositoryGroup](#createrepositorygroup)
194
194
  * [Parameters](#parameters-47)
195
+ * [addRepositoryGroup](#addrepositorygroup)
196
+ * [Parameters](#parameters-48)
195
197
  * [NamedObject](#namedobject)
196
- * [Parameters](#parameters-48)
198
+ * [Parameters](#parameters-49)
197
199
  * [Properties](#properties-7)
198
200
  * [equals](#equals-3)
199
- * [Parameters](#parameters-49)
201
+ * [Parameters](#parameters-50)
200
202
  * [displayName](#displayname)
201
203
  * [fullName](#fullname-1)
202
204
  * [toJSON](#tojson-2)
203
205
  * [Project](#project)
204
- * [Parameters](#parameters-50)
205
- * [PullRequest](#pullrequest)
206
206
  * [Parameters](#parameters-51)
207
+ * [PullRequest](#pullrequest)
208
+ * [Parameters](#parameters-52)
207
209
  * [Properties](#properties-8)
208
210
  * [fullName](#fullname-2)
209
211
  * [url](#url-2)
210
212
  * [repository](#repository-1)
211
213
  * [provider](#provider-2)
212
214
  * [equals](#equals-4)
213
- * [Parameters](#parameters-52)
215
+ * [Parameters](#parameters-53)
214
216
  * [delete](#delete-1)
215
217
  * [merge](#merge)
216
- * [Parameters](#parameters-53)
218
+ * [Parameters](#parameters-54)
217
219
  * [decline](#decline)
218
220
  * [reviews](#reviews)
219
221
  * [identifier](#identifier)
@@ -221,9 +223,9 @@ console.log(await readme.getString());
221
223
  * [defaultListStates](#defaultliststates)
222
224
  * [validMergeMethods](#validmergemethods)
223
225
  * [list](#list-1)
224
- * [Parameters](#parameters-54)
225
- * [open](#open)
226
226
  * [Parameters](#parameters-55)
227
+ * [open](#open)
228
+ * [Parameters](#parameters-56)
227
229
  * [title](#title)
228
230
  * [body](#body)
229
231
  * [state](#state)
@@ -233,19 +235,19 @@ console.log(await readme.getString());
233
235
  * [ContentEntry](#contententry)
234
236
  * [Properties](#properties-9)
235
237
  * [Ref](#ref)
236
- * [Parameters](#parameters-56)
238
+ * [Parameters](#parameters-57)
237
239
  * [equals](#equals-5)
238
- * [Parameters](#parameters-57)
240
+ * [Parameters](#parameters-58)
239
241
  * [ref](#ref-1)
240
242
  * [refId](#refid)
241
- * [Parameters](#parameters-58)
242
- * [entries](#entries)
243
243
  * [Parameters](#parameters-59)
244
+ * [entries](#entries)
245
+ * [Parameters](#parameters-60)
244
246
  * [asyncIterator](#asynciterator)
245
247
  * [maybeEntry](#maybeentry)
246
- * [Parameters](#parameters-60)
247
- * [entry](#entry)
248
248
  * [Parameters](#parameters-61)
249
+ * [entry](#entry)
250
+ * [Parameters](#parameters-62)
249
251
  * [owner](#owner)
250
252
  * [fullName](#fullname-3)
251
253
  * [fullCondensedName](#fullcondensedname)
@@ -261,30 +263,30 @@ console.log(await readme.getString());
261
263
  * [attributes](#attributes-1)
262
264
  * [isProtected](#isprotected-1)
263
265
  * [RepositoryGroup](#repositorygroup-1)
264
- * [Parameters](#parameters-62)
266
+ * [Parameters](#parameters-63)
265
267
  * [Properties](#properties-10)
266
268
  * [attributeMapping](#attributemapping-1)
267
269
  * [type](#type)
268
270
  * [url](#url-3)
269
271
  * [RepositoryOwner](#repositoryowner)
270
- * [Parameters](#parameters-63)
271
- * [Repository](#repository-2)
272
272
  * [Parameters](#parameters-64)
273
+ * [Repository](#repository-2)
274
+ * [Parameters](#parameters-65)
273
275
  * [Properties](#properties-11)
274
276
  * [fullName](#fullname-4)
275
277
  * [slug](#slug)
276
278
  * [provider](#provider-3)
277
279
  * [identifier](#identifier-2)
278
280
  * [equals](#equals-6)
279
- * [Parameters](#parameters-65)
280
- * [entry](#entry-1)
281
281
  * [Parameters](#parameters-66)
282
- * [entries](#entries-1)
282
+ * [entry](#entry-1)
283
283
  * [Parameters](#parameters-67)
284
- * [maybeEntry](#maybeentry-1)
284
+ * [entries](#entries-1)
285
285
  * [Parameters](#parameters-68)
286
- * [commits](#commits)
286
+ * [maybeEntry](#maybeentry-1)
287
287
  * [Parameters](#parameters-69)
288
+ * [commits](#commits)
289
+ * [Parameters](#parameters-70)
288
290
  * [urls](#urls)
289
291
  * [url](#url-4)
290
292
  * [cloneURL](#cloneurl)
@@ -298,40 +300,40 @@ console.log(await readme.getString());
298
300
  * [delete](#delete-2)
299
301
  * [defaultBranch](#defaultbranch)
300
302
  * [branch](#branch-2)
301
- * [Parameters](#parameters-70)
302
- * [branches](#branches-1)
303
303
  * [Parameters](#parameters-71)
304
- * [createBranch](#createbranch-1)
304
+ * [branches](#branches-1)
305
305
  * [Parameters](#parameters-72)
306
- * [addBranch](#addbranch)
306
+ * [createBranch](#createbranch-1)
307
307
  * [Parameters](#parameters-73)
308
- * [deleteBranch](#deletebranch)
308
+ * [addBranch](#addbranch)
309
309
  * [Parameters](#parameters-74)
310
- * [tag](#tag)
310
+ * [deleteBranch](#deletebranch)
311
311
  * [Parameters](#parameters-75)
312
- * [tags](#tags-1)
312
+ * [tag](#tag)
313
313
  * [Parameters](#parameters-76)
314
- * [addTag](#addtag)
314
+ * [tags](#tags-1)
315
315
  * [Parameters](#parameters-77)
316
- * [createPullRequest](#createpullrequest-1)
316
+ * [addTag](#addtag)
317
317
  * [Parameters](#parameters-78)
318
- * [addPullRequest](#addpullrequest)
318
+ * [createPullRequest](#createpullrequest-1)
319
319
  * [Parameters](#parameters-79)
320
+ * [addPullRequest](#addpullrequest)
321
+ * [Parameters](#parameters-80)
320
322
  * [pullRequests](#pullrequests-1)
321
323
  * [pullRequest](#pullrequest-1)
322
- * [Parameters](#parameters-80)
323
- * [deletePullRequest](#deletepullrequest)
324
324
  * [Parameters](#parameters-81)
325
- * [addHook](#addhook)
325
+ * [deletePullRequest](#deletepullrequest)
326
326
  * [Parameters](#parameters-82)
327
- * [createHook](#createhook)
327
+ * [addHook](#addhook)
328
328
  * [Parameters](#parameters-83)
329
+ * [createHook](#createhook)
330
+ * [Parameters](#parameters-84)
329
331
  * [hooks](#hooks-1)
330
332
  * [hook](#hook-1)
331
- * [Parameters](#parameters-84)
333
+ * [Parameters](#parameters-85)
332
334
  * [type](#type-1)
333
335
  * [refId](#refid-1)
334
- * [Parameters](#parameters-85)
336
+ * [Parameters](#parameters-86)
335
337
  * [toString](#tostring-1)
336
338
  * [toJSON](#tojson-3)
337
339
  * [attributes](#attributes-2)
@@ -341,23 +343,23 @@ console.log(await readme.getString());
341
343
  * [Review](#review)
342
344
  * [SingleGroupProvider](#singlegroupprovider)
343
345
  * [repository](#repository-3)
344
- * [Parameters](#parameters-86)
345
- * [repositoryGroup](#repositorygroup-2)
346
346
  * [Parameters](#parameters-87)
347
- * [repositoryGroups](#repositorygroups-1)
347
+ * [repositoryGroup](#repositorygroup-2)
348
348
  * [Parameters](#parameters-88)
349
+ * [repositoryGroups](#repositorygroups-1)
350
+ * [Parameters](#parameters-89)
349
351
  * [Tag](#tag-1)
350
- * [Parameters](#parameters-89)
352
+ * [Parameters](#parameters-90)
351
353
  * [refType](#reftype-1)
352
354
  * [isWritable](#iswritable-1)
353
355
  * [asArray](#asarray)
354
- * [Parameters](#parameters-90)
355
- * [stripBaseName](#stripbasename)
356
356
  * [Parameters](#parameters-91)
357
- * [stripBaseNames](#stripbasenames)
357
+ * [stripBaseName](#stripbasename)
358
358
  * [Parameters](#parameters-92)
359
- * [generateBranchName](#generatebranchname)
359
+ * [stripBaseNames](#stripbasenames)
360
360
  * [Parameters](#parameters-93)
361
+ * [generateBranchName](#generatebranchname)
362
+ * [Parameters](#parameters-94)
361
363
 
362
364
  ## Application
363
365
 
@@ -516,6 +518,14 @@ The provider we live in.
516
518
 
517
519
  Returns **[BaseProvider](#baseprovider)**
518
520
 
521
+ ### trace
522
+
523
+ Forwarded to the owner.
524
+
525
+ #### Parameters
526
+
527
+ * `args` **...any**
528
+
519
529
  ### info
520
530
 
521
531
  Forwarded to the owner.
@@ -870,10 +880,11 @@ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
870
880
 
871
881
  Extract options suitable for the constructor
872
882
  form the given set of environment variables.
883
+ Object with the detected key value pairs is delivered.
873
884
 
874
885
  #### Parameters
875
886
 
876
- * `env` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** as of from process.env
887
+ * `env` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** as from process.env
877
888
  * `instanceIdentifier` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** part of variable name. (optional, default `this.instanceIdentifier`)
878
889
 
879
890
  Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** undefined if no suitable environment variables have been found
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repository-provider",
3
- "version": "28.1.1",
3
+ "version": "28.3.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -36,7 +36,7 @@
36
36
  "ava": "^4.2.0",
37
37
  "c8": "^7.11.2",
38
38
  "documentation": "^13.2.5",
39
- "repository-provider-test-support": "^2.1.1",
39
+ "repository-provider-test-support": "^2.1.2",
40
40
  "semantic-release": "^19.0.2",
41
41
  "typescript": "^4.6.3"
42
42
  },
@@ -1,15 +1,7 @@
1
- import { NamedObject } from "./named-object.mjs";
1
+ import { OwnedObject } from "./owned-object.mjs";
2
2
 
3
3
  /**
4
4
  *
5
5
  */
6
- export class Application extends NamedObject {
7
-
8
- constructor(owner, name, options) {
9
- super(name, options, {
10
- owner: { value: owner }
11
- });
12
-
13
- owner._addApplication(this);
14
- }
6
+ export class Application extends OwnedObject {
15
7
  }
@@ -15,6 +15,7 @@ import { BaseObject } from "./base-object.mjs";
15
15
  * @property {Function} info
16
16
  * @property {Function} warn
17
17
  * @property {Function} error
18
+ * @property {Function} trace
18
19
  */
19
20
 
20
21
  /**
package/src/index.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from "./base-object.mjs";
2
2
  export * from "./named-object.mjs";
3
+ export * from "./owned-object.mjs";
3
4
  export * from "./repository-owner.mjs";
4
5
  export * from "./base-provider.mjs";
5
6
  export * from "./single-group-provider.mjs";
package/src/issue.mjs CHANGED
@@ -1,18 +1,9 @@
1
- import { NamedObject } from "./named-object.mjs";
1
+ import { OwnedObject } from "./owned-object.mjs";
2
2
 
3
3
  /**
4
4
  *
5
5
  */
6
- export class Issue extends NamedObject {
7
-
8
- constructor(owner, name, options) {
9
- super(name, options, {
10
- owner: { value: owner }
11
- });
12
-
13
- owner._addIssue(this);
14
- }
15
-
6
+ export class Issue extends OwnedObject {
16
7
  async *labels() {}
17
8
  async *assignees() {}
18
9
  async assignee() {}
package/src/milestone.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { NamedObject } from "./named-object.mjs";
1
+ import { OwnedObject } from "./owned-object.mjs";
2
2
 
3
3
  /**
4
4
  */
5
- export class Milestone extends NamedObject {
5
+ export class Milestone extends OwnedObject {
6
6
  static get attributes() {
7
7
  return {
8
8
  ...super.attributes,
@@ -10,13 +10,5 @@ export class Milestone extends NamedObject {
10
10
  };
11
11
  }
12
12
 
13
- constructor(owner, name, options) {
14
- super(name, options, {
15
- owner: { value: owner }
16
- });
17
-
18
- owner._addMilestone(this);
19
- }
20
-
21
13
  async *issues() {}
22
14
  }
@@ -23,7 +23,7 @@ export class NamedObject extends BaseObject {
23
23
  * @return {boolean} true if names are equal and have the same owner
24
24
  */
25
25
  equals(other) {
26
- return super.equals(other) && this.name === other.name;
26
+ return super.equals(other) && this.fullName === other.fullName && this.provider.equals(other.provider);
27
27
  }
28
28
 
29
29
  /**
@@ -0,0 +1,23 @@
1
+ import { NamedObject } from "./named-object.mjs";
2
+
3
+ /**
4
+ * Named Object registering itself in the owner.
5
+ */
6
+ export class OwnedObject extends NamedObject {
7
+ /**
8
+ * Method name to be called to register one instance in the owner.
9
+ * sample: Application => _addApplication
10
+ * @return {string}
11
+ */
12
+ static get registerInstanceMethodName() {
13
+ return "_add" + this.name;
14
+ }
15
+
16
+ constructor(owner, name, options) {
17
+ super(name, options, {
18
+ owner: { value: owner }
19
+ });
20
+
21
+ owner[this.constructor.registerInstanceMethodName](this);
22
+ }
23
+ }
package/src/project.mjs CHANGED
@@ -1,13 +1,6 @@
1
- import { NamedObject } from "./named-object.mjs";
1
+ import { OwnedObject } from "./owned-object.mjs";
2
2
 
3
3
  /**
4
- *
4
+ *
5
5
  */
6
- export class Project extends NamedObject {
7
- constructor(owner, name, options) {
8
- super(name, options, {
9
- owner: { value: owner }
10
- });
11
-
12
- owner._addProject(this);
13
- }}
6
+ export class Project extends OwnedObject {}
package/src/ref.mjs CHANGED
@@ -120,7 +120,7 @@ export class Ref extends NamedObject {
120
120
 
121
121
  /**
122
122
  * Repository fullName and branch name combined.
123
- * But skipping the branch name if it is the default branch
123
+ * But skipping the branch name if it is the default branch.
124
124
  * @return {string} 'user/repo#branch'
125
125
  */
126
126
  get fullCondensedName() {
@@ -91,14 +91,6 @@ export class Repository extends NamedObject {
91
91
  return `${this.owner.name}/${this.name}`;
92
92
  }
93
93
 
94
- /**
95
- * The owners provider.
96
- * @return {BaseProvider}
97
- */
98
- get provider() {
99
- return this.owner.provider;
100
- }
101
-
102
94
  /**
103
95
  * Short human readable identifier with provider and branch.
104
96
  * @return {string}
@@ -107,21 +99,6 @@ export class Repository extends NamedObject {
107
99
  return `${this.provider.name}:${this.fullName}`;
108
100
  }
109
101
 
110
- /**
111
- * Check for equality.
112
- * @param {Repository} other
113
- * @return {boolean} true if name and provider are equal
114
- */
115
- equals(other) {
116
- if (other === undefined) {
117
- return false;
118
- }
119
-
120
- return (
121
- this.fullName === other.fullName && this.provider.equals(other.provider)
122
- );
123
- }
124
-
125
102
  /**
126
103
  * Lookup entries form the head of the default branch.
127
104
  * {@link Branch#entry}
@@ -260,6 +237,15 @@ export class Repository extends NamedObject {
260
237
  * @return {Promise<Branch>}
261
238
  */
262
239
  async branch(name) {
240
+ if(name === this.defaultBranchName) {
241
+ const branch = this._branches.get(name);
242
+ if(branch) {
243
+ return branch;
244
+ }
245
+
246
+ return this.addBranch(name);
247
+ }
248
+
263
249
  await this.initializeBranches();
264
250
  return this._branches.get(name);
265
251
  }