bitbucket-repository-provider 4.4.22 → 4.4.23
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/bitbucket-pull-request.mjs +35 -25
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bitbucket-repository-provider",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.23",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"matching-iterator": "^2.0.11",
|
|
36
36
|
"node-fetch": "^3.3.0",
|
|
37
37
|
"one-time-execution-method": "^3.0.6",
|
|
38
|
-
"repository-provider": "^32.3.
|
|
38
|
+
"repository-provider": "^32.3.19"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"ava": "^5.1.0",
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { PullRequest } from "repository-provider";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Pull request inside bitbucket
|
|
4
|
+
* Pull request inside bitbucket
|
|
5
5
|
*/
|
|
6
6
|
export class BitbucketPullRequest extends PullRequest {
|
|
7
|
-
static get
|
|
8
|
-
return
|
|
7
|
+
static get attributes() {
|
|
8
|
+
return {
|
|
9
|
+
...super.attributes,
|
|
10
|
+
state: {
|
|
11
|
+
type: "string",
|
|
12
|
+
values: new Set(["OPEN", "MERGED", "SUPERSEDED", "DECLINED"]),
|
|
13
|
+
writeable: true
|
|
14
|
+
},
|
|
15
|
+
close_source_branch: { type: "boolean" },
|
|
16
|
+
task_count: { type: "integer" }
|
|
17
|
+
};
|
|
9
18
|
}
|
|
10
19
|
|
|
11
20
|
/**
|
|
@@ -24,10 +33,9 @@ export class BitbucketPullRequest extends PullRequest {
|
|
|
24
33
|
[u.repository.full_name, u.branch.name].join("#")
|
|
25
34
|
);
|
|
26
35
|
|
|
27
|
-
const query =
|
|
28
|
-
filter.states
|
|
29
|
-
|
|
30
|
-
: "";
|
|
36
|
+
const query = filter.states?.size
|
|
37
|
+
? "?" + [...filter.states].map(state => `state=${state}`).join("&")
|
|
38
|
+
: "";
|
|
31
39
|
let url = `${repository.api}/pullrequests${query}`;
|
|
32
40
|
|
|
33
41
|
do {
|
|
@@ -70,23 +78,26 @@ export class BitbucketPullRequest extends PullRequest {
|
|
|
70
78
|
return p;
|
|
71
79
|
}
|
|
72
80
|
|
|
73
|
-
const { response, json } = await destination.provider.fetchJSON(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
81
|
+
const { response, json } = await destination.provider.fetchJSON(
|
|
82
|
+
`${destination.api}/pullrequests`,
|
|
83
|
+
{
|
|
84
|
+
method: "POST",
|
|
85
|
+
data: {
|
|
86
|
+
source: {
|
|
87
|
+
branch: {
|
|
88
|
+
name: source.name
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
destination: {
|
|
92
|
+
branch: {
|
|
93
|
+
name: destination.name
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
...options,
|
|
97
|
+
description: options.body
|
|
98
|
+
}
|
|
88
99
|
}
|
|
89
|
-
|
|
100
|
+
);
|
|
90
101
|
|
|
91
102
|
if (!response.ok) {
|
|
92
103
|
throw new Error(response.statusText);
|
|
@@ -119,8 +130,7 @@ export class BitbucketPullRequest extends PullRequest {
|
|
|
119
130
|
});
|
|
120
131
|
}
|
|
121
132
|
|
|
122
|
-
get url()
|
|
123
|
-
{
|
|
133
|
+
get url() {
|
|
124
134
|
return `${this.provider.url}/${this.destination.slug}/pull-requests/${this.name}`;
|
|
125
135
|
}
|
|
126
136
|
}
|