repository-provider 32.4.10 → 32.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repository-provider",
3
- "version": "32.4.10",
3
+ "version": "32.5.0",
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.31",
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() {
@@ -256,13 +261,20 @@ export class Repository extends OwnedObject {
256
261
  * Add a new {@link Branch}.
257
262
  * Internal branch creation does not call repository.initialize()
258
263
  * @param {string} name of the new branch
259
- * @param {Object} options
264
+ * @param {Object} options to be passed to the branch
260
265
  * @return {Branch} newly created branch
261
266
  */
262
267
  addBranch(name, options) {
263
- return (
264
- this.#branches.get(name) || new this.branchClass(this, name, options)
265
- );
268
+ const branch = this.#branches.get(name);
269
+ if (branch) {
270
+ if (options) {
271
+ branch.updateAttributes(options);
272
+ }
273
+
274
+ return branch;
275
+ }
276
+
277
+ return new this.branchClass(this, name, options);
266
278
  }
267
279
 
268
280
  _addBranch(branch) {