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 +2 -2
- package/src/pull-request.mjs +18 -13
- package/src/repository.mjs +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "repository-provider",
|
|
3
|
-
"version": "29.
|
|
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.
|
|
39
|
+
"repository-provider-test-support": "^2.1.15",
|
|
40
40
|
"semantic-release": "^19.0.2",
|
|
41
41
|
"typescript": "^4.6.3"
|
|
42
42
|
},
|
package/src/pull-request.mjs
CHANGED
|
@@ -142,12 +142,12 @@ export class PullRequest extends NamedObject {
|
|
|
142
142
|
};
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
constructor(source,
|
|
145
|
+
constructor(source, owner, name, options) {
|
|
146
146
|
let state = "OPEN";
|
|
147
147
|
|
|
148
148
|
super(name, options, {
|
|
149
149
|
source: { value: source },
|
|
150
|
-
|
|
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 (
|
|
175
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
212
|
+
return this.owner === undefined
|
|
208
213
|
? undefined
|
|
209
|
-
: this.
|
|
214
|
+
: this.owner.repository;
|
|
210
215
|
}
|
|
211
216
|
|
|
212
217
|
/**
|
|
213
218
|
* @return {BaseProvider}
|
|
214
219
|
*/
|
|
215
220
|
get provider() {
|
|
216
|
-
return this.
|
|
221
|
+
return this.owner === undefined
|
|
217
222
|
? undefined
|
|
218
|
-
: this.
|
|
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.
|
|
241
|
+
return this.owner === undefined
|
|
237
242
|
? undefined
|
|
238
|
-
: this.
|
|
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.
|
|
299
|
+
return `${this.owner.identifier}[${this.name}]`;
|
|
295
300
|
}
|
|
296
301
|
}
|
package/src/repository.mjs
CHANGED