repository-provider 32.7.5 → 32.7.7

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
@@ -228,6 +228,7 @@ console.log(await readme.getString());
228
228
  * [reviews](#reviews)
229
229
  * [identifier](#identifier-1)
230
230
  * [defaultListStates](#defaultliststates)
231
+ * [states](#states)
231
232
  * [validMergeMethods](#validmergemethods)
232
233
  * [list](#list-1)
233
234
  * [Parameters](#parameters-52)
@@ -258,6 +259,7 @@ console.log(await readme.getString());
258
259
  * [isArchived](#isarchived)
259
260
  * [isDisabled](#isdisabled)
260
261
  * [isProtected](#isprotected)
262
+ * [isDefault](#isdefault-1)
261
263
  * [attributes](#attributes-1)
262
264
  * [isProtected](#isprotected-1)
263
265
  * [RepositoryGroup](#repositorygroup-1)
@@ -1351,11 +1353,15 @@ States to list pull request by default
1351
1353
 
1352
1354
  Returns **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** states to list by default
1353
1355
 
1356
+ ### states
1357
+
1358
+ possible states
1359
+
1354
1360
  ### validMergeMethods
1355
1361
 
1356
1362
  All valid merge methods
1357
1363
 
1358
- Returns **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** valid merge methods
1364
+ Returns **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** valid merge methods.
1359
1365
 
1360
1366
  ### list
1361
1367
 
@@ -1527,6 +1533,12 @@ Forwarded from the repository
1527
1533
 
1528
1534
  Returns **any** false
1529
1535
 
1536
+ ### isDefault
1537
+
1538
+ Are we the default ref.
1539
+
1540
+ Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** false
1541
+
1530
1542
  ### attributes
1531
1543
 
1532
1544
  options
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repository-provider",
3
- "version": "32.7.5",
3
+ "version": "32.7.7",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -34,11 +34,11 @@
34
34
  },
35
35
  "devDependencies": {
36
36
  "ava": "^5.2.0",
37
- "browser-ava": "^1.3.37",
37
+ "browser-ava": "^1.3.38",
38
38
  "c8": "^7.13.0",
39
39
  "documentation": "^14.0.1",
40
40
  "repository-provider-test-support": "^2.3.2",
41
- "semantic-release": "^21.0.1",
41
+ "semantic-release": "^21.0.2",
42
42
  "typescript": "^5.0.4"
43
43
  },
44
44
  "engines": {
package/src/hook.mjs CHANGED
@@ -11,6 +11,9 @@ import {
11
11
  * Repository hook.
12
12
  */
13
13
  export class Hook extends OwnedObject {
14
+
15
+ static defaultEvents = new Set(["*"]);
16
+
14
17
  static get attributes() {
15
18
  return {
16
19
  ...super.attributes,
@@ -19,7 +22,7 @@ export class Hook extends OwnedObject {
19
22
  url: { ...url_attribute, description: "target url", writable: true },
20
23
  content_type: { ...default_attribute, default: "json", writable: true },
21
24
  insecure_ssl: boolean_attribute,
22
- events: { type: "set", default: new Set(["*"]) }
25
+ events: { type: "set", default: this.defaultEvents }
23
26
  };
24
27
  }
25
28
 
@@ -54,17 +54,18 @@ export class PullRequest extends OwnedObject {
54
54
  * States to list pull request by default
55
55
  * @return {Set<string>} states to list by default
56
56
  */
57
- static get defaultListStates() {
58
- return new Set(["OPEN"]);
59
- }
57
+ static defaultListStates = new Set(["OPEN"]);
58
+
59
+ /**
60
+ * possible states
61
+ */
62
+ static states = new Set(["OPEN", "MERGED", "CLOSED"]);
60
63
 
61
64
  /**
62
65
  * All valid merge methods
63
- * @return {Set<string>} valid merge methods
66
+ * @return {Set<string>} valid merge methods.
64
67
  */
65
- static get validMergeMethods() {
66
- return new Set(/*["MERGE", "SQUASH", "REBASE"]*/);
67
- }
68
+ static validMergeMethods = new Set(/*["MERGE", "SQUASH", "REBASE"]*/);
68
69
 
69
70
  /**
70
71
  * List all pull request for a given repo.
@@ -106,7 +107,7 @@ export class PullRequest extends OwnedObject {
106
107
  state: {
107
108
  ...state_attribute,
108
109
  default: "OPEN",
109
- values: new Set(["OPEN", "MERGED", "CLOSED"])
110
+ values: this.states
110
111
  },
111
112
 
112
113
  /**
@@ -11,7 +11,7 @@ export class SingleGroupProvider extends RepositoryOwner(BaseProvider) {
11
11
  /**
12
12
  * Lookup a repository in the provider and all of its repository groups.
13
13
  * @param {string} name of the repository
14
- * @return {Promise<Repository>}
14
+ * @return {Promise<Repository|undefined>}
15
15
  */
16
16
  async repository(name) {
17
17
  const { base, repository } = this.parseName(name);
@@ -23,7 +23,7 @@ export class SingleGroupProvider extends RepositoryOwner(BaseProvider) {
23
23
  /**
24
24
  * Get a single group.
25
25
  * @param {string} name
26
- * @return {Promise<RepositoryGroup>} deliver the one and only present group
26
+ * @return {Promise<RepositoryGroup|undefined>} deliver the one and only present group
27
27
  */
28
28
  async repositoryGroup(name) {
29
29
  const { base } = this.parseName(name);
package/src/util.mjs CHANGED
@@ -38,7 +38,7 @@ export function stripBaseName(name, repositoryBases, whenFound) {
38
38
  * @param {string|string[]} names
39
39
  * @param {string[]} repositoryBases all possible bases
40
40
  * @param {Function} [whenFound] to be called with the found base name
41
- * @return {string[]|undefined} names without base
41
+ * @return {string[]|string|undefined} names without base
42
42
  */
43
43
  export function stripBaseNames(names, repositoryBases, whenFound) {
44
44
  return Array.isArray(names)
@@ -61,5 +61,5 @@ export async function generateBranchName(repository, pattern) {
61
61
  n++;
62
62
  }
63
63
 
64
- return pattern.replace(/\*/, n);
64
+ return pattern.replace(/\*/, n.toString());
65
65
  }