@gitkraken/provider-apis 0.22.4 → 0.22.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/CHANGELOG.md +39 -13
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.22.5
|
|
4
|
+
|
|
5
|
+
- exclude data from archived repos in the results of functions that return PRs and issues: `searchPullRequests`, `getPullRequestsAssociatedWithUser`, `getPullRequestsForRepos`, `searchIssues`, `getIssuesAssociatedWithUser`, `getIssuesForRepos` (GitHub)
|
|
6
|
+
|
|
2
7
|
## 0.22.4
|
|
3
8
|
|
|
4
9
|
- added `key` to `Issue.project` object (Jira, Jira Server)
|
|
@@ -21,15 +26,17 @@
|
|
|
21
26
|
## 0.22.0
|
|
22
27
|
|
|
23
28
|
### ⚠️ Breaking Changes
|
|
29
|
+
|
|
24
30
|
```ts
|
|
25
31
|
import { EntityIdentifier } from '@gitkraken/provider-apis';
|
|
26
32
|
```
|
|
33
|
+
|
|
27
34
|
is now:
|
|
35
|
+
|
|
28
36
|
```ts
|
|
29
37
|
import { EntityIdentifierUtils } from '@gitkraken/provider-apis';
|
|
30
38
|
```
|
|
31
39
|
|
|
32
|
-
|
|
33
40
|
- `EntityProviderType` and `EntityType` are now names instead of numbers
|
|
34
41
|
- EntityIdentifier `encode` and `decode` now optionally takes in more specific provider entity types
|
|
35
42
|
- Fix trello entityIdentifier error message
|
|
@@ -40,15 +47,17 @@ import { EntityIdentifierUtils } from '@gitkraken/provider-apis';
|
|
|
40
47
|
|
|
41
48
|
Added new entity ID API for encoding/decoding entity IDs (previously known as unique IDs). This API replaces the `getPullRequestUniqueId` and `getIssueUniqueId` utility functions in older versions of this library.
|
|
42
49
|
|
|
43
|
-
The `EntityIdentifier` type represents a particular pull request or issue for a particular provider. The information stored in this type is enough to query the provider's REST or GraphQL API to fetch additional information about the entity (i.e. title, description, assignees, etc) or mutate the entity. `EntityIdentifier` is designed to be
|
|
50
|
+
The `EntityIdentifier` type represents a particular pull request or issue for a particular provider. The information stored in this type is enough to query the provider's REST or GraphQL API to fetch additional information about the entity (i.e. title, description, assignees, etc) or mutate the entity. `EntityIdentifier` is designed to be
|
|
44
51
|
serialized so we can send it to our backend services, giving us a portable way to communicate about pull requests or issues.
|
|
45
52
|
|
|
46
53
|
These are the new functions provided by the API:
|
|
54
|
+
|
|
47
55
|
- `validate`: takes an `EntityIdentifier` as input and validates that it is correctly formed
|
|
48
56
|
- `encode`: takes an `EntityIdentifier` as input and encodes it to an array of strings, which can be serialized and sent to our REST APIs
|
|
49
57
|
- `decode`: takes an array string and decodes it to an `EntityIdentifier`
|
|
50
58
|
|
|
51
59
|
Conversion guide:
|
|
60
|
+
|
|
52
61
|
```ts
|
|
53
62
|
const pullRequest: GitPullRequest = { /* ... pr from somewhere ... */ };
|
|
54
63
|
const githubEnterpriseDomain: string | undefined = ...; // undefined if this PR exists on https://github.com
|
|
@@ -88,6 +97,7 @@ encode({
|
|
|
88
97
|
- changed `pullRequests` argument type from `GitPullRequest[]` to `PullRequestWithUniqueID[]` (groupPullRequestsIntoBuckets)
|
|
89
98
|
|
|
90
99
|
We re-organized provider-specific types into a new directory structure. The types that were moved will have broken imports, but they can be fixed by importing the type from "@gitkraken/provider-apis". Example
|
|
100
|
+
|
|
91
101
|
```ts
|
|
92
102
|
// provider-specific type import that is broken by v0.20.0
|
|
93
103
|
import type { WorkItemState } from '@gitkraken/provider-apis/dist/providers/azureDevops/azureDevOpsTypes';
|
|
@@ -122,7 +132,9 @@ This version refactors all of the mutation functions for all providers. The muta
|
|
|
122
132
|
Examples of how to call the new functions:
|
|
123
133
|
|
|
124
134
|
```ts
|
|
125
|
-
const pullRequest: GitPullRequest = {
|
|
135
|
+
const pullRequest: GitPullRequest = {
|
|
136
|
+
/* ... some PR object from your app's state ... */
|
|
137
|
+
};
|
|
126
138
|
|
|
127
139
|
// pre-v0.18.0 way of merging a pull request for gitlab
|
|
128
140
|
await gitlab.mergePullRequest({
|
|
@@ -143,8 +155,14 @@ await gitlab.mergePullRequest({
|
|
|
143
155
|
```
|
|
144
156
|
|
|
145
157
|
```ts
|
|
146
|
-
const issue: Issue = {
|
|
147
|
-
|
|
158
|
+
const issue: Issue = {
|
|
159
|
+
/* ... some issue object from your app's state ... */
|
|
160
|
+
};
|
|
161
|
+
const labels: GitLabel[] = [
|
|
162
|
+
{
|
|
163
|
+
/* ... some label objects from your app's state ... */
|
|
164
|
+
},
|
|
165
|
+
];
|
|
148
166
|
|
|
149
167
|
// pre-v0.18.0 way of setting issue labels for gitlab
|
|
150
168
|
await gitlab.setIssueLabels({
|
|
@@ -181,18 +199,19 @@ interface GitProvider {
|
|
|
181
199
|
|
|
182
200
|
The `Set*Input` interfaces are designed to take their corresponding provider library object. `SetPullRequestInput` is designed to take a `GitPullRequest` object. `SetMilestoneInput` is designed to take a `GitMilestone` object. Here's a quick reference of the various `Set*Input` interfaces and the objects that they are designed to take:
|
|
183
201
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|SetPullRequestInput
|
|
187
|
-
|SetIssueInput
|
|
188
|
-
|SetMilestoneInput
|
|
189
|
-
|SetAccountInput
|
|
190
|
-
|SetLabelInput
|
|
191
|
-
|SetStatusInput
|
|
202
|
+
| `Set*Input` interface | Provider library object |
|
|
203
|
+
| --------------------- | ------------------------------------------- |
|
|
204
|
+
| SetPullRequestInput | GitPullRequest |
|
|
205
|
+
| SetIssueInput | Issue |
|
|
206
|
+
| SetMilestoneInput | GitMilestone |
|
|
207
|
+
| SetAccountInput | Account |
|
|
208
|
+
| SetLabelInput | GitLabel |
|
|
209
|
+
| SetStatusInput | IssueTransition, TrelloBoard, WorkItemState |
|
|
192
210
|
|
|
193
211
|
Now, wih all of that explained, here's the list of updated mutation functions:
|
|
194
212
|
|
|
195
213
|
Azure Dev Ops:
|
|
214
|
+
|
|
196
215
|
- closePullRequest
|
|
197
216
|
- mergePullRequest
|
|
198
217
|
- addPullRequestLabel
|
|
@@ -208,16 +227,19 @@ Azure Dev Ops:
|
|
|
208
227
|
- setPullRequestLabels **(new)**
|
|
209
228
|
|
|
210
229
|
Bitbucket:
|
|
230
|
+
|
|
211
231
|
- closePullRequest
|
|
212
232
|
- mergePullRequest
|
|
213
233
|
- setPullRequestReviewers
|
|
214
234
|
|
|
215
235
|
Bitbucket Server:
|
|
236
|
+
|
|
216
237
|
- closePullRequest
|
|
217
238
|
- mergePullRequest
|
|
218
239
|
- setPullRequestReviewers
|
|
219
240
|
|
|
220
241
|
GitHub/GitHub Enterprise:
|
|
242
|
+
|
|
221
243
|
- closePullRequest
|
|
222
244
|
- mergePullRequest
|
|
223
245
|
- setPullRequestMilestone
|
|
@@ -237,6 +259,7 @@ GitHub/GitHub Enterprise:
|
|
|
237
259
|
- setIssueStatus was **removed**
|
|
238
260
|
|
|
239
261
|
GitLab/GitLab Self-Managed:
|
|
262
|
+
|
|
240
263
|
- closePullRequest
|
|
241
264
|
- mergePullRequest
|
|
242
265
|
- setPullRequestMilestone
|
|
@@ -256,17 +279,20 @@ GitLab/GitLab Self-Managed:
|
|
|
256
279
|
- setIssueStatus was **removed**
|
|
257
280
|
|
|
258
281
|
Jira:
|
|
282
|
+
|
|
259
283
|
- setIssueStatus
|
|
260
284
|
- setIssueAssignee
|
|
261
285
|
- setIssueComponents
|
|
262
286
|
- setIssueLabels
|
|
263
287
|
|
|
264
288
|
Jira Server:
|
|
289
|
+
|
|
265
290
|
- setIssueStatus
|
|
266
291
|
- setIssueComponents
|
|
267
292
|
- setIssueLabels
|
|
268
293
|
|
|
269
294
|
Trello:
|
|
295
|
+
|
|
270
296
|
- setIssueStatus
|
|
271
297
|
- setIssueAssignees
|
|
272
298
|
- setIssueLabels
|
package/dist/index.js
CHANGED
|
@@ -160,7 +160,7 @@ labels(first: 100) {
|
|
|
160
160
|
${Re}
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
|
-
${!t||me(t,"VIEWER_CAN_MERGE_AS_ADMIN")?"viewerCanMergeAsAdmin":""}
|
|
163
|
+
${!t||me(t,"VIEWER_CAN_MERGE_AS_ADMIN")?"viewerCanMergeAsAdmin":""}
|
|
164
164
|
`,Nr=(s=!1)=>`
|
|
165
165
|
id
|
|
166
166
|
databaseId
|
|
@@ -219,7 +219,7 @@ query SearchIssuesOrPullRequests($query: String! $after: String) {
|
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
-
}`,variables:{query:`is:${s} is:open ${e}`,after:t}}},Br="Field 'isDraft' doesn't exist on type 'PullRequest'",be=(s=[])=>s.some(e=>(e==null?void 0:e.message)===Br),jr=/@@ -(\d+)(?:,\d+ | )\+(\d+)(?:,\d+ | )@@(?:\\n)?/,Mr=`
|
|
222
|
+
}`,variables:{query:`is:${s} is:open archived:false ${e}`,after:t}}},Br="Field 'isDraft' doesn't exist on type 'PullRequest'",be=(s=[])=>s.some(e=>(e==null?void 0:e.message)===Br),jr=/@@ -(\d+)(?:,\d+ | )\+(\d+)(?:,\d+ | )@@(?:\\n)?/,Mr=`
|
|
223
223
|
\
|
|
224
224
|
+`,er=(s,e,t,r)=>{let n=jr.exec(s);if(!n||!n[0]||!n[1])return[];let o=parseInt(n[1],10),i=parseInt(n[2],10),a=s.replace(Mr,`
|
|
225
225
|
+`).split(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitkraken/provider-apis",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.5",
|
|
4
4
|
"description": "An SDK around different third-party APIs that accepts and returns data in a common format.",
|
|
5
5
|
"author": "Axosoft, LLC dba GitKraken",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|