repository-provider 29.1.2 → 29.1.5

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
@@ -1224,7 +1224,7 @@ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
1224
1224
 
1225
1225
  ## PullRequest
1226
1226
 
1227
- **Extends NamedObject**
1227
+ **Extends OwnedObject**
1228
1228
 
1229
1229
  Abstract pull request.
1230
1230
  [Repository#addPullRequest](#repositoryaddpullrequest)
@@ -1232,7 +1232,7 @@ Abstract pull request.
1232
1232
  ### Parameters
1233
1233
 
1234
1234
  * `source` **[Branch](#branch)** merge source
1235
- * `destination` **[Branch](#branch)** merge target
1235
+ * `owner`
1236
1236
  * `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
1237
1237
  * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
1238
1238
 
@@ -1240,6 +1240,7 @@ Abstract pull request.
1240
1240
  * `options.state` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?**
1241
1241
  * `options.merged` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?**
1242
1242
  * `options.locked` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?**
1243
+ * `destination` **[Branch](#branch)** merge target
1243
1244
 
1244
1245
  ### Properties
1245
1246
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repository-provider",
3
- "version": "29.1.2",
3
+ "version": "29.1.5",
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.15",
39
+ "repository-provider-test-support": "^2.1.17",
40
40
  "semantic-release": "^19.0.2",
41
41
  "typescript": "^4.6.3"
42
42
  },
@@ -1,5 +1,5 @@
1
1
  import { optionJSON } from "./attribute.mjs";
2
- import { NamedObject } from "./named-object.mjs";
2
+ import { OwnedObject } from "./owned-object.mjs";
3
3
  import { Branch } from "./branch.mjs";
4
4
  import { Repository } from "./repository.mjs";
5
5
  import { Review } from "./review.mjs";
@@ -26,7 +26,12 @@ import { BaseProvider } from "./base-provider.mjs";
26
26
  * @property {boolean} [locked]
27
27
  * @property {string} url
28
28
  */
29
- export class PullRequest extends NamedObject {
29
+ export class PullRequest extends OwnedObject {
30
+
31
+ static get registerInstanceMethodName() {
32
+ return "_addPullRequest";
33
+ }
34
+
30
35
  /**
31
36
  * All valid states
32
37
  * @return {Set<string>} valid states
@@ -145,9 +150,8 @@ export class PullRequest extends NamedObject {
145
150
  constructor(source, owner, name, options) {
146
151
  let state = "OPEN";
147
152
 
148
- super(name, options, {
153
+ super(owner, name, options, {
149
154
  source: { value: source },
150
- owner: { value: owner },
151
155
  state: {
152
156
  set(value) {
153
157
  value = value.toUpperCase();
@@ -170,10 +174,6 @@ export class PullRequest extends NamedObject {
170
174
  }
171
175
  }
172
176
  });
173
-
174
- if (owner !== undefined) {
175
- owner._addPullRequest(this);
176
- }
177
177
  }
178
178
 
179
179
  get destination()
@@ -186,7 +186,7 @@ export class PullRequest extends NamedObject {
186
186
  * @return {string} PR full name
187
187
  */
188
188
  get fullName() {
189
- return `${this.owner.repository.fullName}/${this.name}`;
189
+ return `${this.repository.fullName}/${this.name}`;
190
190
  }
191
191
 
192
192
  /**
@@ -194,7 +194,7 @@ export class PullRequest extends NamedObject {
194
194
  * @return {string} url
195
195
  */
196
196
  get url() {
197
- return `${this.provider.url}${this.owner.repository.fullName}/pull/${this.name}`;
197
+ return `${this.provider.url}${this.repository.fullName}/pull/${this.name}`;
198
198
  }
199
199
 
200
200
  get number() {
@@ -240,7 +240,7 @@ export class PullRequest extends NamedObject {
240
240
  async delete() {
241
241
  return this.owner === undefined
242
242
  ? undefined
243
- : this.owner.deletePullRequest(this.number);
243
+ : this.owner.deletePullRequest(this.name);
244
244
  }
245
245
 
246
246
  /**
@@ -271,7 +271,7 @@ export class PullRequest extends NamedObject {
271
271
  return [
272
272
  [this.name, this.title],
273
273
  ["source", this.source.identifier],
274
- ["destination", this.destination.identifier],
274
+ ["destination", this.owner.identifier],
275
275
  ...Object.keys(this.constructor.attributes)
276
276
  .filter(
277
277
  k =>
@@ -286,7 +286,7 @@ export class PullRequest extends NamedObject {
286
286
  toJSON() {
287
287
  return optionJSON(this, {
288
288
  source: this.source,
289
- destination: this.destination,
289
+ destination: this.owner,
290
290
  name: this.name
291
291
  });
292
292
  }