gitlab-radiator 3.4.0 → 3.4.1

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.
@@ -1,117 +1,388 @@
1
- import _ from 'lodash'
2
- import {gitlabRequest} from './client'
3
-
4
- export async function fetchLatestPipelines(projectId, gitlab) {
5
- const pipelines = await fetchLatestAndMasterPipeline(projectId, gitlab)
6
-
7
- return Promise.all(pipelines.map(async ({id, ref, status}) => {
8
- const {commit, stages} = await fetchJobs(projectId, id, gitlab)
9
- const downstreamStages = await fetchDownstreamJobs(projectId, id, gitlab)
10
- return {
11
- id,
12
- ref,
13
- status,
14
- commit,
15
- stages: stages.concat(downstreamStages)
16
- }
17
- }))
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.fetchLatestPipelines = fetchLatestPipelines;
9
+
10
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
+
12
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
+
14
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
15
+
16
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
17
+
18
+ var _lodash = _interopRequireDefault(require("lodash"));
19
+
20
+ var _client = require("./client");
21
+
22
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
23
+
24
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
25
+
26
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
27
+
28
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
29
+
30
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
31
+
32
+ function fetchLatestPipelines(_x, _x2) {
33
+ return _fetchLatestPipelines.apply(this, arguments);
34
+ } // eslint-disable-next-line max-statements
35
+
36
+
37
+ function _fetchLatestPipelines() {
38
+ _fetchLatestPipelines = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(projectId, gitlab) {
39
+ var pipelines;
40
+ return _regenerator.default.wrap(function _callee2$(_context2) {
41
+ while (1) {
42
+ switch (_context2.prev = _context2.next) {
43
+ case 0:
44
+ _context2.next = 2;
45
+ return fetchLatestAndMasterPipeline(projectId, gitlab);
46
+
47
+ case 2:
48
+ pipelines = _context2.sent;
49
+ return _context2.abrupt("return", Promise.all(pipelines.map( /*#__PURE__*/function () {
50
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref) {
51
+ var id, ref, status, _yield$fetchJobs, commit, stages, downstreamStages;
52
+
53
+ return _regenerator.default.wrap(function _callee$(_context) {
54
+ while (1) {
55
+ switch (_context.prev = _context.next) {
56
+ case 0:
57
+ id = _ref.id, ref = _ref.ref, status = _ref.status;
58
+ _context.next = 3;
59
+ return fetchJobs(projectId, id, gitlab);
60
+
61
+ case 3:
62
+ _yield$fetchJobs = _context.sent;
63
+ commit = _yield$fetchJobs.commit;
64
+ stages = _yield$fetchJobs.stages;
65
+ _context.next = 8;
66
+ return fetchDownstreamJobs(projectId, id, gitlab);
67
+
68
+ case 8:
69
+ downstreamStages = _context.sent;
70
+ return _context.abrupt("return", {
71
+ id,
72
+ ref,
73
+ status,
74
+ commit,
75
+ stages: stages.concat(downstreamStages)
76
+ });
77
+
78
+ case 10:
79
+ case "end":
80
+ return _context.stop();
81
+ }
82
+ }
83
+ }, _callee);
84
+ }));
85
+
86
+ return function (_x14) {
87
+ return _ref2.apply(this, arguments);
88
+ };
89
+ }())));
90
+
91
+ case 4:
92
+ case "end":
93
+ return _context2.stop();
94
+ }
95
+ }
96
+ }, _callee2);
97
+ }));
98
+ return _fetchLatestPipelines.apply(this, arguments);
18
99
  }
19
100
 
20
- // eslint-disable-next-line max-statements
21
- async function fetchLatestAndMasterPipeline(projectId, config) {
22
- const pipelines = await fetchPipelines(projectId, config, {per_page: 100})
23
- if (pipelines.length === 0) {
24
- return []
25
- }
26
- const latestPipeline = _.take(pipelines, 1)
27
- if (latestPipeline[0].ref === 'master') {
28
- return latestPipeline
29
- }
30
- const latestMasterPipeline = _(pipelines).filter({ref: 'master'}).take(1).value()
31
- if (latestMasterPipeline.length > 0) {
32
- return latestPipeline.concat(latestMasterPipeline)
33
- }
34
- const masterPipelines = await fetchPipelines(projectId, config, {per_page: 50, ref: 'master'})
35
- return latestPipeline.concat(_.take(masterPipelines, 1))
101
+ function fetchLatestAndMasterPipeline(_x3, _x4) {
102
+ return _fetchLatestAndMasterPipeline.apply(this, arguments);
36
103
  }
37
104
 
38
- async function fetchPipelines(projectId, config, options) {
39
- const {data: pipelines} = await gitlabRequest(`/projects/${projectId}/pipelines`, options, config)
40
- return pipelines.filter(pipeline => pipeline.status !== 'skipped')
105
+ function _fetchLatestAndMasterPipeline() {
106
+ _fetchLatestAndMasterPipeline = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(projectId, config) {
107
+ var pipelines, latestPipeline, latestMasterPipeline, masterPipelines;
108
+ return _regenerator.default.wrap(function _callee3$(_context3) {
109
+ while (1) {
110
+ switch (_context3.prev = _context3.next) {
111
+ case 0:
112
+ _context3.next = 2;
113
+ return fetchPipelines(projectId, config, {
114
+ per_page: 100
115
+ });
116
+
117
+ case 2:
118
+ pipelines = _context3.sent;
119
+
120
+ if (!(pipelines.length === 0)) {
121
+ _context3.next = 5;
122
+ break;
123
+ }
124
+
125
+ return _context3.abrupt("return", []);
126
+
127
+ case 5:
128
+ latestPipeline = _lodash.default.take(pipelines, 1);
129
+
130
+ if (!(latestPipeline[0].ref === 'master')) {
131
+ _context3.next = 8;
132
+ break;
133
+ }
134
+
135
+ return _context3.abrupt("return", latestPipeline);
136
+
137
+ case 8:
138
+ latestMasterPipeline = (0, _lodash.default)(pipelines).filter({
139
+ ref: 'master'
140
+ }).take(1).value();
141
+
142
+ if (!(latestMasterPipeline.length > 0)) {
143
+ _context3.next = 11;
144
+ break;
145
+ }
146
+
147
+ return _context3.abrupt("return", latestPipeline.concat(latestMasterPipeline));
148
+
149
+ case 11:
150
+ _context3.next = 13;
151
+ return fetchPipelines(projectId, config, {
152
+ per_page: 50,
153
+ ref: 'master'
154
+ });
155
+
156
+ case 13:
157
+ masterPipelines = _context3.sent;
158
+ return _context3.abrupt("return", latestPipeline.concat(_lodash.default.take(masterPipelines, 1)));
159
+
160
+ case 15:
161
+ case "end":
162
+ return _context3.stop();
163
+ }
164
+ }
165
+ }, _callee3);
166
+ }));
167
+ return _fetchLatestAndMasterPipeline.apply(this, arguments);
41
168
  }
42
169
 
43
- async function fetchDownstreamJobs(projectId, pipelineId, config) {
44
- const {data: gitlabBridgeJobs} = await gitlabRequest(`/projects/${projectId}/pipelines/${pipelineId}/bridges`, {per_page: 100}, config)
45
- const childPipelines = gitlabBridgeJobs.filter(bridge => bridge.downstream_pipeline.status !== 'skipped')
46
-
47
- const downstreamStages = []
48
- for(const childPipeline of childPipelines) {
49
- const {stages} = await fetchJobs(projectId, childPipeline.downstream_pipeline.id, config)
50
- downstreamStages.push(stages.map(stage => ({
51
- ...stage,
52
- name: `${childPipeline.stage}:${stage.name}`
53
- })))
54
- }
55
- return downstreamStages.flat()
170
+ function fetchPipelines(_x5, _x6, _x7) {
171
+ return _fetchPipelines.apply(this, arguments);
56
172
  }
57
173
 
58
- async function fetchJobs(projectId, pipelineId, config) {
59
- const {data: gitlabJobs} = await gitlabRequest(`/projects/${projectId}/pipelines/${pipelineId}/jobs?include_retried=true`, {per_page: 100}, config)
60
- if (gitlabJobs.length === 0) {
61
- return {}
62
- }
174
+ function _fetchPipelines() {
175
+ _fetchPipelines = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(projectId, config, options) {
176
+ var _yield$gitlabRequest, pipelines;
63
177
 
64
- const commit = findCommit(gitlabJobs)
65
- const stages = _(gitlabJobs)
66
- .map(job => ({
67
- id: job.id,
68
- status: job.status,
69
- stage: job.stage,
70
- name: job.name,
71
- startedAt: job.started_at,
72
- finishedAt: job.finished_at,
73
- url: job.web_url
74
- }))
75
- .orderBy('id')
76
- .groupBy('stage')
77
- .mapValues(mergeRetriedJobs)
78
- .mapValues(cleanup)
79
- .toPairs()
80
- .map(([name, jobs]) => ({name, jobs: _.sortBy(jobs, 'name')}))
81
- .value()
178
+ return _regenerator.default.wrap(function _callee4$(_context4) {
179
+ while (1) {
180
+ switch (_context4.prev = _context4.next) {
181
+ case 0:
182
+ _context4.next = 2;
183
+ return (0, _client.gitlabRequest)("/projects/".concat(projectId, "/pipelines"), options, config);
82
184
 
83
- return {
84
- commit,
85
- stages
86
- }
185
+ case 2:
186
+ _yield$gitlabRequest = _context4.sent;
187
+ pipelines = _yield$gitlabRequest.data;
188
+ return _context4.abrupt("return", pipelines.filter(pipeline => pipeline.status !== 'skipped'));
189
+
190
+ case 5:
191
+ case "end":
192
+ return _context4.stop();
193
+ }
194
+ }
195
+ }, _callee4);
196
+ }));
197
+ return _fetchPipelines.apply(this, arguments);
198
+ }
199
+
200
+ function fetchDownstreamJobs(_x8, _x9, _x10) {
201
+ return _fetchDownstreamJobs.apply(this, arguments);
202
+ }
203
+
204
+ function _fetchDownstreamJobs() {
205
+ _fetchDownstreamJobs = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(projectId, pipelineId, config) {
206
+ var _yield$gitlabRequest2, gitlabBridgeJobs, childPipelines, downstreamStages, _iterator, _step, _loop;
207
+
208
+ return _regenerator.default.wrap(function _callee5$(_context6) {
209
+ while (1) {
210
+ switch (_context6.prev = _context6.next) {
211
+ case 0:
212
+ _context6.next = 2;
213
+ return (0, _client.gitlabRequest)("/projects/".concat(projectId, "/pipelines/").concat(pipelineId, "/bridges"), {
214
+ per_page: 100
215
+ }, config);
216
+
217
+ case 2:
218
+ _yield$gitlabRequest2 = _context6.sent;
219
+ gitlabBridgeJobs = _yield$gitlabRequest2.data;
220
+ childPipelines = gitlabBridgeJobs.filter(bridge => bridge.downstream_pipeline.status !== 'skipped');
221
+ downstreamStages = [];
222
+ _iterator = _createForOfIteratorHelper(childPipelines);
223
+ _context6.prev = 7;
224
+ _loop = /*#__PURE__*/_regenerator.default.mark(function _loop() {
225
+ var childPipeline, _yield$fetchJobs2, stages;
226
+
227
+ return _regenerator.default.wrap(function _loop$(_context5) {
228
+ while (1) {
229
+ switch (_context5.prev = _context5.next) {
230
+ case 0:
231
+ childPipeline = _step.value;
232
+ _context5.next = 3;
233
+ return fetchJobs(projectId, childPipeline.downstream_pipeline.id, config);
234
+
235
+ case 3:
236
+ _yield$fetchJobs2 = _context5.sent;
237
+ stages = _yield$fetchJobs2.stages;
238
+ downstreamStages.push(stages.map(stage => _objectSpread(_objectSpread({}, stage), {}, {
239
+ name: "".concat(childPipeline.stage, ":").concat(stage.name)
240
+ })));
241
+
242
+ case 6:
243
+ case "end":
244
+ return _context5.stop();
245
+ }
246
+ }
247
+ }, _loop);
248
+ });
249
+
250
+ _iterator.s();
251
+
252
+ case 10:
253
+ if ((_step = _iterator.n()).done) {
254
+ _context6.next = 14;
255
+ break;
256
+ }
257
+
258
+ return _context6.delegateYield(_loop(), "t0", 12);
259
+
260
+ case 12:
261
+ _context6.next = 10;
262
+ break;
263
+
264
+ case 14:
265
+ _context6.next = 19;
266
+ break;
267
+
268
+ case 16:
269
+ _context6.prev = 16;
270
+ _context6.t1 = _context6["catch"](7);
271
+
272
+ _iterator.e(_context6.t1);
273
+
274
+ case 19:
275
+ _context6.prev = 19;
276
+
277
+ _iterator.f();
278
+
279
+ return _context6.finish(19);
280
+
281
+ case 22:
282
+ return _context6.abrupt("return", downstreamStages.flat());
283
+
284
+ case 23:
285
+ case "end":
286
+ return _context6.stop();
287
+ }
288
+ }
289
+ }, _callee5, null, [[7, 16, 19, 22]]);
290
+ }));
291
+ return _fetchDownstreamJobs.apply(this, arguments);
292
+ }
293
+
294
+ function fetchJobs(_x11, _x12, _x13) {
295
+ return _fetchJobs.apply(this, arguments);
296
+ }
297
+
298
+ function _fetchJobs() {
299
+ _fetchJobs = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(projectId, pipelineId, config) {
300
+ var _yield$gitlabRequest3, gitlabJobs, commit, stages;
301
+
302
+ return _regenerator.default.wrap(function _callee6$(_context7) {
303
+ while (1) {
304
+ switch (_context7.prev = _context7.next) {
305
+ case 0:
306
+ _context7.next = 2;
307
+ return (0, _client.gitlabRequest)("/projects/".concat(projectId, "/pipelines/").concat(pipelineId, "/jobs?include_retried=true"), {
308
+ per_page: 100
309
+ }, config);
310
+
311
+ case 2:
312
+ _yield$gitlabRequest3 = _context7.sent;
313
+ gitlabJobs = _yield$gitlabRequest3.data;
314
+
315
+ if (!(gitlabJobs.length === 0)) {
316
+ _context7.next = 6;
317
+ break;
318
+ }
319
+
320
+ return _context7.abrupt("return", {});
321
+
322
+ case 6:
323
+ commit = findCommit(gitlabJobs);
324
+ stages = (0, _lodash.default)(gitlabJobs).map(job => ({
325
+ id: job.id,
326
+ status: job.status,
327
+ stage: job.stage,
328
+ name: job.name,
329
+ startedAt: job.started_at,
330
+ finishedAt: job.finished_at,
331
+ url: job.web_url
332
+ })).orderBy('id').groupBy('stage').mapValues(mergeRetriedJobs).mapValues(cleanup).toPairs().map(_ref3 => {
333
+ var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
334
+ name = _ref4[0],
335
+ jobs = _ref4[1];
336
+
337
+ return {
338
+ name,
339
+ jobs: _lodash.default.sortBy(jobs, 'name')
340
+ };
341
+ }).value();
342
+ return _context7.abrupt("return", {
343
+ commit,
344
+ stages
345
+ });
346
+
347
+ case 9:
348
+ case "end":
349
+ return _context7.stop();
350
+ }
351
+ }
352
+ }, _callee6);
353
+ }));
354
+ return _fetchJobs.apply(this, arguments);
87
355
  }
88
356
 
89
357
  function findCommit(jobs) {
90
- const [job] = jobs.filter(j => j.commit)
358
+ var _jobs$filter = jobs.filter(j => j.commit),
359
+ _jobs$filter2 = (0, _slicedToArray2.default)(_jobs$filter, 1),
360
+ job = _jobs$filter2[0];
361
+
91
362
  if (!job) {
92
- return null
363
+ return null;
93
364
  }
365
+
94
366
  return {
95
367
  title: job.commit.title,
96
368
  author: job.commit.author_name
97
- }
369
+ };
98
370
  }
99
371
 
100
372
  function mergeRetriedJobs(jobs) {
101
373
  return jobs.reduce((mergedJobs, job) => {
102
- const index = mergedJobs.findIndex(mergedJob => mergedJob.name === job.name)
374
+ var index = mergedJobs.findIndex(mergedJob => mergedJob.name === job.name);
375
+
103
376
  if (index >= 0) {
104
- mergedJobs[index] = job
377
+ mergedJobs[index] = job;
105
378
  } else {
106
- mergedJobs.push(job)
379
+ mergedJobs.push(job);
107
380
  }
108
- return mergedJobs
109
- }, [])
381
+
382
+ return mergedJobs;
383
+ }, []);
110
384
  }
111
385
 
112
386
  function cleanup(jobs) {
113
- return _(jobs)
114
- .map(job => _.omitBy(job, _.isNull))
115
- .map(job => _.omit(job, 'stage'))
116
- .value()
117
- }
387
+ return (0, _lodash.default)(jobs).map(job => _lodash.default.omitBy(job, _lodash.default.isNull)).map(job => _lodash.default.omit(job, 'stage')).value();
388
+ }
@@ -1,28 +1,105 @@
1
- import {gitlabRequest} from './client'
2
-
3
- export async function fetchProjects(gitlab) {
4
- const projects = await fetchOwnProjects(gitlab)
5
- return projects
6
- // Ignore projects for which CI/CD is not enabled
7
- .filter(project => project.jobs_enabled)
8
- .map(projectMapper)
9
- .filter(includeRegexFilter(gitlab))
10
- .filter(excludeRegexFilter(gitlab))
11
- .filter(archivedFilter(gitlab))
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.fetchProjects = fetchProjects;
9
+
10
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
+
12
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
+
14
+ var _client = require("./client");
15
+
16
+ function fetchProjects(_x) {
17
+ return _fetchProjects.apply(this, arguments);
12
18
  }
13
19
 
14
- async function fetchOwnProjects(gitlab) {
15
- const projects = []
16
- const SAFETY_MAX_PAGE = 10
17
- for (let page = 1; page <= SAFETY_MAX_PAGE; page += 1) {
18
- // eslint-disable-next-line no-await-in-loop
19
- const {data, headers} = await gitlabRequest('/projects', {page, per_page: 100, membership: true}, gitlab)
20
- projects.push(data)
21
- if (data.length === 0 || !headers['x-next-page']) {
22
- break
23
- }
24
- }
25
- return projects.flat()
20
+ function _fetchProjects() {
21
+ _fetchProjects = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(gitlab) {
22
+ var projects;
23
+ return _regenerator.default.wrap(function _callee$(_context) {
24
+ while (1) {
25
+ switch (_context.prev = _context.next) {
26
+ case 0:
27
+ _context.next = 2;
28
+ return fetchOwnProjects(gitlab);
29
+
30
+ case 2:
31
+ projects = _context.sent;
32
+ return _context.abrupt("return", projects // Ignore projects for which CI/CD is not enabled
33
+ .filter(project => project.jobs_enabled).map(projectMapper).filter(includeRegexFilter(gitlab)).filter(excludeRegexFilter(gitlab)).filter(archivedFilter(gitlab)));
34
+
35
+ case 4:
36
+ case "end":
37
+ return _context.stop();
38
+ }
39
+ }
40
+ }, _callee);
41
+ }));
42
+ return _fetchProjects.apply(this, arguments);
43
+ }
44
+
45
+ function fetchOwnProjects(_x2) {
46
+ return _fetchOwnProjects.apply(this, arguments);
47
+ }
48
+
49
+ function _fetchOwnProjects() {
50
+ _fetchOwnProjects = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(gitlab) {
51
+ var projects, SAFETY_MAX_PAGE, page, _yield$gitlabRequest, data, headers;
52
+
53
+ return _regenerator.default.wrap(function _callee2$(_context2) {
54
+ while (1) {
55
+ switch (_context2.prev = _context2.next) {
56
+ case 0:
57
+ projects = [];
58
+ SAFETY_MAX_PAGE = 10;
59
+ page = 1;
60
+
61
+ case 3:
62
+ if (!(page <= SAFETY_MAX_PAGE)) {
63
+ _context2.next = 15;
64
+ break;
65
+ }
66
+
67
+ _context2.next = 6;
68
+ return (0, _client.gitlabRequest)('/projects', {
69
+ page,
70
+ per_page: 100,
71
+ membership: true
72
+ }, gitlab);
73
+
74
+ case 6:
75
+ _yield$gitlabRequest = _context2.sent;
76
+ data = _yield$gitlabRequest.data;
77
+ headers = _yield$gitlabRequest.headers;
78
+ projects.push(data);
79
+
80
+ if (!(data.length === 0 || !headers['x-next-page'])) {
81
+ _context2.next = 12;
82
+ break;
83
+ }
84
+
85
+ return _context2.abrupt("break", 15);
86
+
87
+ case 12:
88
+ page += 1;
89
+ _context2.next = 3;
90
+ break;
91
+
92
+ case 15:
93
+ return _context2.abrupt("return", projects.flat());
94
+
95
+ case 16:
96
+ case "end":
97
+ return _context2.stop();
98
+ }
99
+ }
100
+ }, _callee2);
101
+ }));
102
+ return _fetchOwnProjects.apply(this, arguments);
26
103
  }
27
104
 
28
105
  function projectMapper(project) {
@@ -35,39 +112,42 @@ function projectMapper(project) {
35
112
  default_branch: project.default_branch || 'master',
36
113
  url: project.web_url,
37
114
  tags: (project.tag_list || []).map(t => t.toLowerCase())
38
- }
115
+ };
39
116
  }
40
117
 
41
118
  function getGroupName(project) {
42
- const pathWithNameSpace = project.path_with_namespace
43
- return pathWithNameSpace.split('/')[0]
119
+ var pathWithNameSpace = project.path_with_namespace;
120
+ return pathWithNameSpace.split('/')[0];
44
121
  }
45
122
 
46
123
  function includeRegexFilter(config) {
47
124
  return project => {
48
125
  if (config.projects && config.projects.include) {
49
- const includeRegex = new RegExp(config.projects.include, "i")
50
- return includeRegex.test(project.name)
126
+ var includeRegex = new RegExp(config.projects.include, "i");
127
+ return includeRegex.test(project.name);
51
128
  }
52
- return true
53
- }
129
+
130
+ return true;
131
+ };
54
132
  }
55
133
 
56
134
  function excludeRegexFilter(config) {
57
135
  return project => {
58
136
  if (config.projects && config.projects.exclude) {
59
- const excludeRegex = new RegExp(config.projects.exclude, "i")
60
- return !excludeRegex.test(project.name)
137
+ var excludeRegex = new RegExp(config.projects.exclude, "i");
138
+ return !excludeRegex.test(project.name);
61
139
  }
62
- return true
63
- }
140
+
141
+ return true;
142
+ };
64
143
  }
65
144
 
66
145
  function archivedFilter(config) {
67
146
  return project => {
68
147
  if (config.ignoreArchived) {
69
- return !project.archived
148
+ return !project.archived;
70
149
  }
71
- return true
72
- }
73
- }
150
+
151
+ return true;
152
+ };
153
+ }