repository-provider 32.4.10 → 32.5.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repository-provider",
3
- "version": "32.4.10",
3
+ "version": "32.5.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -35,10 +35,10 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "ava": "^5.1.0",
38
- "browser-ava": "^1.3.14",
38
+ "browser-ava": "^1.3.15",
39
39
  "c8": "^7.12.0",
40
40
  "documentation": "^14.0.1",
41
- "repository-provider-test-support": "^2.2.30",
41
+ "repository-provider-test-support": "^2.2.32",
42
42
  "semantic-release": "^19.0.5",
43
43
  "typescript": "^4.9.4"
44
44
  },
@@ -59,6 +59,14 @@ export class BaseObject {
59
59
  * @param {object} additionalProperties
60
60
  */
61
61
  constructor(options, additionalProperties) {
62
+ this.updateAttributes(options, additionalProperties);
63
+ }
64
+
65
+ /**
66
+ * Takes values from options.
67
+ * @param {object} options
68
+ */
69
+ updateAttributes(options, additionalProperties) {
62
70
  definePropertiesFromOptions(
63
71
  this,
64
72
  mapAttributes(options, this.constructor.attributeMapping),
@@ -4,7 +4,13 @@ import { Hook } from "./hook.mjs";
4
4
  import { Tag } from "./tag.mjs";
5
5
  import { Branch } from "./branch.mjs";
6
6
  import { PullRequest } from "./pull-request.mjs";
7
- import { url_attribute, size_attribute, language_attribute, boolean_attribute, boolean_read_only_attribute } from "./attributes.mjs";
7
+ import {
8
+ url_attribute,
9
+ size_attribute,
10
+ language_attribute,
11
+ boolean_attribute,
12
+ boolean_read_only_attribute
13
+ } from "./attributes.mjs";
8
14
 
9
15
  /**
10
16
  * Abstract repository
@@ -28,9 +34,8 @@ export class Repository extends OwnedObject {
28
34
  return "_addRepository";
29
35
  }
30
36
 
31
- static get deleteMethodName()
32
- {
33
- return "_deleteRepository";
37
+ static get deleteMethodName() {
38
+ return "_deleteRepository";
34
39
  }
35
40
 
36
41
  static get collectionName() {
@@ -55,11 +60,6 @@ export class Repository extends OwnedObject {
55
60
 
56
61
  cloneURL: url_attribute,
57
62
 
58
- /**
59
- * The url of issue tracking system.
60
- * @return {string}
61
- */
62
- issuesURL: url_attribute,
63
63
  isArchived: boolean_attribute,
64
64
  isLocked: boolean_attribute,
65
65
  isDisabled: boolean_attribute,
@@ -256,13 +256,20 @@ export class Repository extends OwnedObject {
256
256
  * Add a new {@link Branch}.
257
257
  * Internal branch creation does not call repository.initialize()
258
258
  * @param {string} name of the new branch
259
- * @param {Object} options
259
+ * @param {Object} options to be passed to the branch
260
260
  * @return {Branch} newly created branch
261
261
  */
262
262
  addBranch(name, options) {
263
- return (
264
- this.#branches.get(name) || new this.branchClass(this, name, options)
265
- );
263
+ const branch = this.#branches.get(name);
264
+ if (branch) {
265
+ if (options) {
266
+ branch.updateAttributes(options);
267
+ }
268
+
269
+ return branch;
270
+ }
271
+
272
+ return new this.branchClass(this, name, options);
266
273
  }
267
274
 
268
275
  _addBranch(branch) {