repository-provider 29.0.0 → 29.1.2

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.0.0",
3
+ "version": "29.1.2",
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.12",
39
+ "repository-provider-test-support": "^2.1.15",
40
40
  "semantic-release": "^19.0.2",
41
41
  "typescript": "^4.6.3"
42
42
  },
@@ -142,12 +142,12 @@ export class PullRequest extends NamedObject {
142
142
  };
143
143
  }
144
144
 
145
- constructor(source, destination, name, options) {
145
+ constructor(source, owner, name, options) {
146
146
  let state = "OPEN";
147
147
 
148
148
  super(name, options, {
149
149
  source: { value: source },
150
- destination: { value: destination },
150
+ owner: { value: owner },
151
151
  state: {
152
152
  set(value) {
153
153
  value = value.toUpperCase();
@@ -171,17 +171,22 @@ export class PullRequest extends NamedObject {
171
171
  }
172
172
  });
173
173
 
174
- if (destination !== undefined) {
175
- destination._addPullRequest(this);
174
+ if (owner !== undefined) {
175
+ owner._addPullRequest(this);
176
176
  }
177
177
  }
178
178
 
179
+ get destination()
180
+ {
181
+ return this.owner;
182
+ }
183
+
179
184
  /**
180
185
  * Name of the PR together with the repository.
181
186
  * @return {string} PR full name
182
187
  */
183
188
  get fullName() {
184
- return `${this.destination.repository.fullName}/${this.name}`;
189
+ return `${this.owner.repository.fullName}/${this.name}`;
185
190
  }
186
191
 
187
192
  /**
@@ -189,7 +194,7 @@ export class PullRequest extends NamedObject {
189
194
  * @return {string} url
190
195
  */
191
196
  get url() {
192
- return `${this.provider.url}${this.destination.repository.fullName}/pull/${this.name}`;
197
+ return `${this.provider.url}${this.owner.repository.fullName}/pull/${this.name}`;
193
198
  }
194
199
 
195
200
  get number() {
@@ -204,18 +209,18 @@ export class PullRequest extends NamedObject {
204
209
  * @return {Repository} destination repository
205
210
  */
206
211
  get repository() {
207
- return this.destination === undefined
212
+ return this.owner === undefined
208
213
  ? undefined
209
- : this.destination.repository;
214
+ : this.owner.repository;
210
215
  }
211
216
 
212
217
  /**
213
218
  * @return {BaseProvider}
214
219
  */
215
220
  get provider() {
216
- return this.destination === undefined
221
+ return this.owner === undefined
217
222
  ? undefined
218
- : this.destination.provider;
223
+ : this.owner.provider;
219
224
  }
220
225
 
221
226
  /**
@@ -233,9 +238,9 @@ export class PullRequest extends NamedObject {
233
238
  * @return {Promise}
234
239
  */
235
240
  async delete() {
236
- return this.destination === undefined
241
+ return this.owner === undefined
237
242
  ? undefined
238
- : this.destination.deletePullRequest(this.number);
243
+ : this.owner.deletePullRequest(this.number);
239
244
  }
240
245
 
241
246
  /**
@@ -291,6 +296,6 @@ export class PullRequest extends NamedObject {
291
296
  * @return {string}
292
297
  */
293
298
  get identifier() {
294
- return `${this.destination.identifier}[${this.name}]`;
299
+ return `${this.owner.identifier}[${this.name}]`;
295
300
  }
296
301
  }
@@ -249,6 +249,11 @@ export class Repository extends OwnedObject {
249
249
  return this.#branches.get(name);
250
250
  }
251
251
 
252
+ get hasBranches()
253
+ {
254
+ return this.#branches.size > 0;
255
+ }
256
+
252
257
  /**
253
258
  * @return {AsyncIterator<Branch>} of all branches
254
259
  */