repository-provider 30.3.1 → 30.3.4

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
@@ -88,6 +88,8 @@ console.log(await readme.getString());
88
88
  * [tagClass](#tagclass)
89
89
  * [entryClass](#entryclass)
90
90
  * [hookClass](#hookclass)
91
+ * [type](#type)
92
+ * [collectionName](#collectionname)
91
93
  * [attributes](#attributes)
92
94
  * [writableAttributes](#writableattributes)
93
95
  * [attributeMapping](#attributemapping)
@@ -176,48 +178,46 @@ console.log(await readme.getString());
176
178
  * [Parameters](#parameters-36)
177
179
  * [Properties](#properties-5)
178
180
  * [Hook](#hook)
179
- * [Parameters](#parameters-37)
180
- * [toJSON](#tojson-1)
181
181
  * [Issue](#issue)
182
182
  * [Milestone](#milestone)
183
183
  * [MultiGroupProvider](#multigroupprovider)
184
184
  * [repository](#repository)
185
- * [Parameters](#parameters-38)
185
+ * [Parameters](#parameters-37)
186
186
  * [branch](#branch-1)
187
- * [Parameters](#parameters-39)
187
+ * [Parameters](#parameters-38)
188
188
  * [repositoryGroup](#repositorygroup)
189
- * [Parameters](#parameters-40)
189
+ * [Parameters](#parameters-39)
190
190
  * [repositoryGroups](#repositorygroups)
191
- * [Parameters](#parameters-41)
191
+ * [Parameters](#parameters-40)
192
192
  * [createRepositoryGroup](#createrepositorygroup)
193
- * [Parameters](#parameters-42)
193
+ * [Parameters](#parameters-41)
194
194
  * [addRepositoryGroup](#addrepositorygroup)
195
- * [Parameters](#parameters-43)
195
+ * [Parameters](#parameters-42)
196
196
  * [NamedObject](#namedobject)
197
- * [Parameters](#parameters-44)
197
+ * [Parameters](#parameters-43)
198
198
  * [Properties](#properties-6)
199
199
  * [equals](#equals-2)
200
- * [Parameters](#parameters-45)
200
+ * [Parameters](#parameters-44)
201
201
  * [fullName](#fullname-1)
202
- * [toJSON](#tojson-2)
202
+ * [toJSON](#tojson-1)
203
203
  * [OwnedObject](#ownedobject)
204
- * [Parameters](#parameters-46)
204
+ * [Parameters](#parameters-45)
205
205
  * [equals](#equals-3)
206
- * [Parameters](#parameters-47)
206
+ * [Parameters](#parameters-46)
207
207
  * [addMethodName](#addmethodname)
208
208
  * [Project](#project)
209
209
  * [PullRequest](#pullrequest)
210
- * [Parameters](#parameters-48)
210
+ * [Parameters](#parameters-47)
211
211
  * [Properties](#properties-7)
212
212
  * [fullName](#fullname-2)
213
213
  * [url](#url-2)
214
214
  * [repository](#repository-1)
215
215
  * [provider](#provider-2)
216
216
  * [equals](#equals-4)
217
- * [Parameters](#parameters-49)
217
+ * [Parameters](#parameters-48)
218
218
  * [delete](#delete-1)
219
219
  * [merge](#merge)
220
- * [Parameters](#parameters-50)
220
+ * [Parameters](#parameters-49)
221
221
  * [decline](#decline)
222
222
  * [reviews](#reviews)
223
223
  * [identifier](#identifier-1)
@@ -225,9 +225,9 @@ console.log(await readme.getString());
225
225
  * [defaultListStates](#defaultliststates)
226
226
  * [validMergeMethods](#validmergemethods)
227
227
  * [list](#list-1)
228
- * [Parameters](#parameters-51)
228
+ * [Parameters](#parameters-50)
229
229
  * [open](#open)
230
- * [Parameters](#parameters-52)
230
+ * [Parameters](#parameters-51)
231
231
  * [title](#title)
232
232
  * [body](#body)
233
233
  * [state](#state)
@@ -239,14 +239,14 @@ console.log(await readme.getString());
239
239
  * [Ref](#ref)
240
240
  * [ref](#ref-1)
241
241
  * [refId](#refid)
242
- * [Parameters](#parameters-53)
242
+ * [Parameters](#parameters-52)
243
243
  * [entries](#entries)
244
- * [Parameters](#parameters-54)
244
+ * [Parameters](#parameters-53)
245
245
  * [asyncIterator](#asynciterator)
246
246
  * [maybeEntry](#maybeentry)
247
- * [Parameters](#parameters-55)
247
+ * [Parameters](#parameters-54)
248
248
  * [entry](#entry)
249
- * [Parameters](#parameters-56)
249
+ * [Parameters](#parameters-55)
250
250
  * [repository](#repository-2)
251
251
  * [fullName](#fullname-3)
252
252
  * [fullCondensedName](#fullcondensedname-1)
@@ -260,26 +260,26 @@ console.log(await readme.getString());
260
260
  * [attributes](#attributes-1)
261
261
  * [isProtected](#isprotected-1)
262
262
  * [RepositoryGroup](#repositorygroup-1)
263
- * [Parameters](#parameters-57)
263
+ * [Parameters](#parameters-56)
264
264
  * [Properties](#properties-9)
265
265
  * [attributeMapping](#attributemapping-1)
266
- * [type](#type)
266
+ * [type](#type-1)
267
267
  * [url](#url-3)
268
268
  * [RepositoryOwner](#repositoryowner)
269
- * [Parameters](#parameters-58)
269
+ * [Parameters](#parameters-57)
270
270
  * [Repository](#repository-3)
271
- * [Parameters](#parameters-59)
271
+ * [Parameters](#parameters-58)
272
272
  * [Properties](#properties-10)
273
273
  * [fullName](#fullname-4)
274
274
  * [slug](#slug)
275
275
  * [entry](#entry-1)
276
- * [Parameters](#parameters-60)
276
+ * [Parameters](#parameters-59)
277
277
  * [entries](#entries-1)
278
- * [Parameters](#parameters-61)
278
+ * [Parameters](#parameters-60)
279
279
  * [maybeEntry](#maybeentry-1)
280
- * [Parameters](#parameters-62)
280
+ * [Parameters](#parameters-61)
281
281
  * [commits](#commits)
282
- * [Parameters](#parameters-63)
282
+ * [Parameters](#parameters-62)
283
283
  * [urls](#urls)
284
284
  * [url](#url-4)
285
285
  * [cloneURL](#cloneurl)
@@ -293,41 +293,42 @@ console.log(await readme.getString());
293
293
  * [delete](#delete-2)
294
294
  * [defaultBranch](#defaultbranch)
295
295
  * [branch](#branch-2)
296
- * [Parameters](#parameters-64)
296
+ * [Parameters](#parameters-63)
297
+ * [hasBranches](#hasbranches)
297
298
  * [branches](#branches-1)
298
- * [Parameters](#parameters-65)
299
+ * [Parameters](#parameters-64)
299
300
  * [createBranch](#createbranch-1)
300
- * [Parameters](#parameters-66)
301
+ * [Parameters](#parameters-65)
301
302
  * [addBranch](#addbranch)
302
- * [Parameters](#parameters-67)
303
+ * [Parameters](#parameters-66)
303
304
  * [deleteBranch](#deletebranch)
304
- * [Parameters](#parameters-68)
305
+ * [Parameters](#parameters-67)
305
306
  * [tag](#tag)
306
- * [Parameters](#parameters-69)
307
+ * [Parameters](#parameters-68)
307
308
  * [tags](#tags-1)
308
- * [Parameters](#parameters-70)
309
+ * [Parameters](#parameters-69)
309
310
  * [addTag](#addtag)
310
- * [Parameters](#parameters-71)
311
+ * [Parameters](#parameters-70)
311
312
  * [createPullRequest](#createpullrequest-1)
312
- * [Parameters](#parameters-72)
313
+ * [Parameters](#parameters-71)
313
314
  * [addPullRequest](#addpullrequest)
314
- * [Parameters](#parameters-73)
315
+ * [Parameters](#parameters-72)
315
316
  * [pullRequests](#pullrequests-1)
316
317
  * [pullRequest](#pullrequest-1)
317
- * [Parameters](#parameters-74)
318
+ * [Parameters](#parameters-73)
318
319
  * [deletePullRequest](#deletepullrequest)
319
- * [Parameters](#parameters-75)
320
+ * [Parameters](#parameters-74)
320
321
  * [addHook](#addhook)
321
- * [Parameters](#parameters-76)
322
+ * [Parameters](#parameters-75)
322
323
  * [createHook](#createhook)
323
- * [Parameters](#parameters-77)
324
+ * [Parameters](#parameters-76)
324
325
  * [hooks](#hooks-1)
325
326
  * [hook](#hook-1)
326
- * [Parameters](#parameters-78)
327
- * [type](#type-1)
327
+ * [Parameters](#parameters-77)
328
+ * [type](#type-2)
328
329
  * [refId](#refid-1)
329
- * [Parameters](#parameters-79)
330
- * [toJSON](#tojson-3)
330
+ * [Parameters](#parameters-78)
331
+ * [toJSON](#tojson-2)
331
332
  * [attributes](#attributes-2)
332
333
  * [defaultBranchName](#defaultbranchname)
333
334
  * [urls](#urls-1)
@@ -335,21 +336,21 @@ console.log(await readme.getString());
335
336
  * [Review](#review)
336
337
  * [SingleGroupProvider](#singlegroupprovider)
337
338
  * [repository](#repository-4)
338
- * [Parameters](#parameters-80)
339
+ * [Parameters](#parameters-79)
339
340
  * [repositoryGroup](#repositorygroup-2)
340
- * [Parameters](#parameters-81)
341
+ * [Parameters](#parameters-80)
341
342
  * [repositoryGroups](#repositorygroups-1)
342
- * [Parameters](#parameters-82)
343
+ * [Parameters](#parameters-81)
343
344
  * [Tag](#tag-1)
344
345
  * [refType](#reftype-1)
345
346
  * [asArray](#asarray)
346
- * [Parameters](#parameters-83)
347
+ * [Parameters](#parameters-82)
347
348
  * [stripBaseName](#stripbasename)
348
- * [Parameters](#parameters-84)
349
+ * [Parameters](#parameters-83)
349
350
  * [stripBaseNames](#stripbasenames)
350
- * [Parameters](#parameters-85)
351
+ * [Parameters](#parameters-84)
351
352
  * [generateBranchName](#generatebranchname)
352
- * [Parameters](#parameters-86)
353
+ * [Parameters](#parameters-85)
353
354
 
354
355
  ## Application
355
356
 
@@ -604,6 +605,14 @@ By default we use the owners implementation.
604
605
 
605
606
  Returns **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** as defined in the owner
606
607
 
608
+ ### type
609
+
610
+ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** type we represent
611
+
612
+ ### collectionName
613
+
614
+ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name of the collection holding us in the owner
615
+
607
616
  ### attributes
608
617
 
609
618
  Attributes definitions
@@ -744,7 +753,7 @@ base, group, repository and branch.
744
753
  #### Parameters
745
754
 
746
755
  * `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
747
- * `groupFocus` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** if only one path component is given (optional, default `false`)
756
+ * `focus` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** where lies the focus if only one path component is given (optional, default `"repository"`)
748
757
 
749
758
  Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** with separated attributes
750
759
 
@@ -950,10 +959,9 @@ Abstract branch.
950
959
 
951
960
  ### Parameters
952
961
 
953
- * `owner`
962
+ * `owner` **[RepositoryOwner](#repositoryowner)**
954
963
  * `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** (optional, default `owner.defaultBranchName`)
955
964
  * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
956
- * `repository` **[Repository](#repository)**
957
965
 
958
966
  ### Properties
959
967
 
@@ -1077,17 +1085,6 @@ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Globa
1077
1085
 
1078
1086
  Repository hook.
1079
1087
 
1080
- ### Parameters
1081
-
1082
- * `owner`
1083
- * `name`
1084
- * `events` (optional, default `new Set(["*"])`)
1085
- * `options`
1086
-
1087
- ### toJSON
1088
-
1089
- Provide name, events and all defined attributes.
1090
-
1091
1088
  ## Issue
1092
1089
 
1093
1090
  **Extends OwnedObject**
@@ -1243,7 +1240,7 @@ Abstract pull request.
1243
1240
  ### Parameters
1244
1241
 
1245
1242
  * `source` **[Branch](#branch)** merge source
1246
- * `owner`
1243
+ * `owner` **[Branch](#branch)** merge target
1247
1244
  * `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
1248
1245
  * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
1249
1246
 
@@ -1251,7 +1248,6 @@ Abstract pull request.
1251
1248
  * `options.state` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?**
1252
1249
  * `options.merged` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?**
1253
1250
  * `options.locked` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?**
1254
- * `destination` **[Branch](#branch)** merge target
1255
1251
 
1256
1252
  ### Properties
1257
1253
 
@@ -1750,6 +1746,10 @@ Lookup branch by name.
1750
1746
 
1751
1747
  Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Branch](#branch)>**
1752
1748
 
1749
+ ### hasBranches
1750
+
1751
+ Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if there is at least one branch
1752
+
1753
1753
  ### branches
1754
1754
 
1755
1755
  #### Parameters
@@ -1874,11 +1874,14 @@ Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
1874
1874
 
1875
1875
  ### addHook
1876
1876
 
1877
- Add a Hook.
1877
+ Add a new [Hook](#hook).
1878
1878
 
1879
1879
  #### Parameters
1880
1880
 
1881
- * `hook` **[Hook](#hook)**
1881
+ * `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** of the new hoook name
1882
+ * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
1883
+
1884
+ Returns **[Hook](#hook)** newly created hook
1882
1885
 
1883
1886
  ### createHook
1884
1887
 
@@ -1948,7 +1951,7 @@ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
1948
1951
 
1949
1952
  ## Review
1950
1953
 
1951
- **Extends BaseObject**
1954
+ **Extends OwnedObject**
1952
1955
 
1953
1956
  ## SingleGroupProvider
1954
1957
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repository-provider",
3
- "version": "30.3.1",
3
+ "version": "30.3.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -36,7 +36,7 @@
36
36
  "ava": "^4.2.0",
37
37
  "c8": "^7.11.3",
38
38
  "documentation": "^13.2.5",
39
- "repository-provider-test-support": "^2.1.22",
39
+ "repository-provider-test-support": "^2.1.24",
40
40
  "semantic-release": "^19.0.2",
41
41
  "typescript": "^4.7.2"
42
42
  },
package/src/attribute.mjs CHANGED
@@ -193,17 +193,19 @@ export function optionJSON(
193
193
  initial = {},
194
194
  attributes = object.constructor.attributes
195
195
  ) {
196
- return attributes ? Object.keys(attributes).reduce((a, c) => {
197
- const value = object[c];
198
- if (value !== undefined && !(value instanceof Function)) {
199
- if (value instanceof Set) {
200
- a[c] = [...value];
201
- } else {
202
- a[c] = value;
203
- }
204
- }
205
- return a;
206
- }, initial) : initial;
196
+ return attributes
197
+ ? Object.keys(attributes).reduce((a, c) => {
198
+ const value = object[c];
199
+ if (value !== undefined && !(value instanceof Function)) {
200
+ if (value instanceof Set) {
201
+ a[c] = [...value];
202
+ } else {
203
+ a[c] = value;
204
+ }
205
+ }
206
+ return a;
207
+ }, initial)
208
+ : initial;
207
209
  }
208
210
 
209
211
  /**
@@ -10,6 +10,18 @@ import { BaseObject } from "./base-object.mjs";
10
10
  * @property {string} name
11
11
  */
12
12
  export class NamedObject extends BaseObject {
13
+ /**
14
+ * options
15
+ */
16
+ static get attributes() {
17
+ return {
18
+ ...super.attributes,
19
+ name: {
20
+ type: "string"
21
+ }
22
+ };
23
+ }
24
+
13
25
  constructor(name, options, additionalProperties) {
14
26
  super(options, {
15
27
  name: { value: name },
@@ -35,7 +47,7 @@ export class NamedObject extends BaseObject {
35
47
  get fullName() {
36
48
  return this.owner ? this.owner.name + "/" + this.name : this.name;
37
49
  }
38
-
50
+
39
51
  /**
40
52
  * Provided name and all defined attributes.
41
53
  */
@@ -31,6 +31,10 @@ export class PullRequest extends OwnedObject {
31
31
  return "_addPullRequest";
32
32
  }
33
33
 
34
+ static get type() {
35
+ return "pull-request";
36
+ }
37
+
34
38
  static get collectionName() {
35
39
  return "pullRequests";
36
40
  }
@@ -146,6 +150,10 @@ export class PullRequest extends OwnedObject {
146
150
 
147
151
  empty: {
148
152
  type: "boolean"
153
+ },
154
+
155
+ url: {
156
+ type: "string"
149
157
  }
150
158
  };
151
159
  }
@@ -196,6 +204,7 @@ export class PullRequest extends OwnedObject {
196
204
  * @return {string} url
197
205
  */
198
206
  get url() {
207
+ // TODO repo url
199
208
  return `${this.provider.url}${this.repository.fullName}/pull/${this.name}`;
200
209
  }
201
210
 
@@ -271,7 +280,7 @@ export class PullRequest extends OwnedObject {
271
280
  ...Object.keys(this.constructor.attributes)
272
281
  .filter(
273
282
  k =>
274
- k !== "id" && k !== "title" && k !== "body" && this[k] !== undefined
283
+ k !== "id" && k !== "title" && k !== "body" && k !== "url" && k !== "name" && this[k] !== undefined
275
284
  )
276
285
  .map(k => [k, this[k]])
277
286
  ]
@@ -282,8 +291,7 @@ export class PullRequest extends OwnedObject {
282
291
  toJSON() {
283
292
  return optionJSON(this, {
284
293
  source: this.source,
285
- destination: this.owner,
286
- name: this.name
294
+ destination: this.owner
287
295
  });
288
296
  }
289
297