repository-provider 29.1.2 → 29.1.3

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": "29.1.2",
3
+ "version": "29.1.3",
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.16",
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() {
@@ -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
  }