bjira 0.0.22 → 0.0.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/create.js +1 -1
- package/src/init.js +1 -1
- package/src/jira.js +5 -0
- package/src/query.js +13 -7
- package/src/sprint.js +7 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bjira",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.23",
|
|
4
4
|
"description": "A simple jira CLI tool",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"inquirer": "^8.2.0",
|
|
31
31
|
"inquirer-autocomplete-prompt": "^1.4.0",
|
|
32
32
|
"inquirer-checkbox-plus-prompt": "^1.0.1",
|
|
33
|
-
"jira-client": "^6.
|
|
33
|
+
"jira-client": "^6.23.0",
|
|
34
34
|
"ora": "^6.0.1",
|
|
35
35
|
"temp": "^0.9.4"
|
|
36
36
|
}
|
package/src/create.js
CHANGED
package/src/init.js
CHANGED
|
@@ -21,7 +21,7 @@ class Init extends Command {
|
|
|
21
21
|
protocol: await Ask.askBoolean('Enable HTTPS Protocol?') ? 'https' : 'http',
|
|
22
22
|
username: (await Ask.askString('Please provide your jira username:')).trim(),
|
|
23
23
|
password: (await Ask.askPassword('API token:')).trim(),
|
|
24
|
-
apiVersion: '
|
|
24
|
+
apiVersion: '3',
|
|
25
25
|
strictSSL: true,
|
|
26
26
|
},
|
|
27
27
|
presets: {},
|
package/src/jira.js
CHANGED
|
@@ -20,6 +20,11 @@ class Jira {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
this._config = JSON.parse(fs.readFileSync(this.configFile));
|
|
23
|
+
if (this._config.jira.apiVersion !== 3) {
|
|
24
|
+
this._config.jira.apiVersion = 3;
|
|
25
|
+
this.syncConfig();
|
|
26
|
+
}
|
|
27
|
+
|
|
23
28
|
this._jiraClient = new jiraClient(this._config.jira);
|
|
24
29
|
}
|
|
25
30
|
|
package/src/query.js
CHANGED
|
@@ -149,12 +149,18 @@ class Query extends Command {
|
|
|
149
149
|
|
|
150
150
|
static async runQuery(jira, query, expectedResult) {
|
|
151
151
|
let issues = [];
|
|
152
|
-
let
|
|
152
|
+
let nextPageToken = null;
|
|
153
153
|
while (issues.length < (expectedResult === undefined ? issues.length + 1 : expectedResult)) {
|
|
154
154
|
const result = await jira.spin('Running query...',
|
|
155
|
-
jira.
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
jira.apiRequest('/search/jql', {
|
|
156
|
+
method: 'POST',
|
|
157
|
+
followAllRedirects: true,
|
|
158
|
+
body: {
|
|
159
|
+
jql: query,
|
|
160
|
+
nextPageToken,
|
|
161
|
+
fields: ['*all'],
|
|
162
|
+
maxResults: Math.min(5000, expectedResult - issues.length)
|
|
163
|
+
}
|
|
158
164
|
}));
|
|
159
165
|
|
|
160
166
|
if (result.warningMessages) {
|
|
@@ -162,14 +168,14 @@ class Query extends Command {
|
|
|
162
168
|
return;
|
|
163
169
|
}
|
|
164
170
|
|
|
165
|
-
total = result.total;
|
|
166
171
|
issues = issues.concat(result.issues);
|
|
172
|
+
nextPageToken = result.nextPageToken;
|
|
167
173
|
|
|
168
|
-
if (
|
|
174
|
+
if (result.isLast) break;
|
|
169
175
|
}
|
|
170
176
|
|
|
171
177
|
return {
|
|
172
|
-
total,
|
|
178
|
+
total: issues.length,
|
|
173
179
|
issues
|
|
174
180
|
};
|
|
175
181
|
}
|
package/src/sprint.js
CHANGED
|
@@ -156,10 +156,14 @@ class Sprint extends Command {
|
|
|
156
156
|
value: board.id
|
|
157
157
|
})));
|
|
158
158
|
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
let sprintList = [];
|
|
160
|
+
while (true) {
|
|
161
|
+
const sprints = await jira.spin('Retrieving sprints...', jira.api.getAllSprints(boardId, sprintList.length));
|
|
162
|
+
sprintList = sprintList.concat(sprints.values);
|
|
163
|
+
if (sprintList.length >= sprints.total) break;
|
|
164
|
+
}
|
|
161
165
|
|
|
162
|
-
const sprints = sprintList.
|
|
166
|
+
const sprints = sprintList.filter(sprint => sprint.state === 'active' || sprint.state === 'future');
|
|
163
167
|
|
|
164
168
|
if (sprints.length === 0) {
|
|
165
169
|
return null;
|