jscrambler 5.5.35 → 6.1.0

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/dist/index.js CHANGED
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
+ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
8
+
7
9
  require('babel-polyfill');
8
10
 
9
11
  var _path = require('path');
@@ -154,45 +156,43 @@ exports.default = {
154
156
  */
155
157
  updateApplicationSources: function () {
156
158
  var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(client, applicationId, _ref) {
159
+ var _this = this;
160
+
157
161
  var sources = _ref.sources,
158
162
  filesSrc = _ref.filesSrc,
159
163
  cwd = _ref.cwd,
160
164
  appProfiling = _ref.appProfiling;
161
165
 
162
- var removeSourceRes, zipped, source, _filesSrc, i, l, content;
166
+ var promise, zipped, source, _filesSrc, i, l, content;
163
167
 
164
168
  return regeneratorRuntime.wrap(function _callee$(_context) {
165
169
  while (1) {
166
170
  switch (_context.prev = _context.next) {
167
171
  case 0:
172
+ promise = null;
173
+
168
174
  if (!(sources || filesSrc && filesSrc.length)) {
169
- _context.next = 7;
175
+ _context.next = 5;
170
176
  break;
171
177
  }
172
178
 
173
179
  if (!(appProfiling && appProfiling.data && appProfiling.data.state === 'READY')) {
174
- _context.next = 3;
180
+ _context.next = 4;
175
181
  break;
176
182
  }
177
183
 
178
184
  throw new Error('You have a finished Profiling for this application so you are NOT ALLOWED to update sources. To override this behavior use *--remove-profiling-data* or *--skip-sources*.');
179
185
 
180
- case 3:
181
- _context.next = 5;
182
- return this.removeSourceFromApplication(client, '', applicationId);
183
-
184
- case 5:
185
- removeSourceRes = _context.sent;
186
-
186
+ case 4:
187
187
 
188
- errorHandler(removeSourceRes);
188
+ promise = this.removeSourceFromApplication(client, '', applicationId);
189
189
 
190
- case 7:
190
+ case 5:
191
191
  zipped = void 0;
192
192
  source = void 0;
193
193
 
194
194
  if (!(filesSrc && filesSrc.length)) {
195
- _context.next = 18;
195
+ _context.next = 16;
196
196
  break;
197
197
  }
198
198
 
@@ -210,17 +210,17 @@ exports.default = {
210
210
  console.log('Creating zip from source files');
211
211
  }
212
212
 
213
- _context.next = 15;
213
+ _context.next = 13;
214
214
  return (0, _zip.zip)(_filesSrc, cwd);
215
215
 
216
- case 15:
216
+ case 13:
217
217
  zipped = _context.sent;
218
- _context.next = 23;
218
+ _context.next = 21;
219
219
  break;
220
220
 
221
- case 18:
221
+ case 16:
222
222
  if (!sources) {
223
- _context.next = 23;
223
+ _context.next = 21;
224
224
  break;
225
225
  }
226
226
 
@@ -228,24 +228,24 @@ exports.default = {
228
228
  console.log('Creating zip from sources');
229
229
  }
230
230
 
231
- _context.next = 22;
231
+ _context.next = 20;
232
232
  return (0, _zip.zipSources)(sources);
233
233
 
234
- case 22:
234
+ case 20:
235
235
  zipped = _context.sent;
236
236
 
237
- case 23:
237
+ case 21:
238
238
  if (!zipped) {
239
- _context.next = 34;
239
+ _context.next = 28;
240
240
  break;
241
241
  }
242
242
 
243
- _context.next = 26;
243
+ _context.next = 24;
244
244
  return zipped.generateAsync({
245
245
  type: 'base64'
246
246
  });
247
247
 
248
- case 26:
248
+ case 24:
249
249
  content = _context.sent;
250
250
 
251
251
 
@@ -259,18 +259,18 @@ exports.default = {
259
259
  extension: 'zip'
260
260
  };
261
261
 
262
- _context.t0 = errorHandler;
263
- _context.next = 32;
264
- return this.addApplicationSource(client, applicationId, source);
262
+ promise.then(function (removeRes) {
263
+ errorHandler(removeRes);
265
264
 
266
- case 32:
267
- _context.t1 = _context.sent;
268
- (0, _context.t0)(_context.t1);
265
+ return _this.addApplicationSource(client, applicationId, source);
266
+ }).then(errorHandler).catch(function (e) {
267
+ console.warn('Update application sources failed with ' + e.message);
268
+ });
269
269
 
270
- case 34:
271
- return _context.abrupt('return', source);
270
+ case 28:
271
+ return _context.abrupt('return', { source: source, promise: promise });
272
272
 
273
- case 35:
273
+ case 29:
274
274
  case 'end':
275
275
  return _context.stop();
276
276
  }
@@ -329,17 +329,18 @@ exports.default = {
329
329
  // Jscrambler or if you're provided access to beta features of our product.
330
330
  //
331
331
  protectAndDownload: function () {
332
- var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(configPathOrObject, destCallback) {
333
- var _this = this;
332
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(configPathOrObject, destCallback) {
333
+ var _this2 = this;
334
334
 
335
- var finalConfig, applicationId, host, port, basePath, protocol, cafile, keys, sources, _finalConfig$stream, stream, cwd, params, applicationTypes, languageSpecifications, sourceMaps, randomizationSeed, areSubscribersOrdered, useRecommendedOrder, _finalConfig$bail, bail, jscramblerVersion, debugMode, proxy, utc, clientId, tolerateMinification, codeHardeningThreshold, useProfilingData, browsers, useAppClassification, profilingDataMode, removeProfilingData, skipSources, inputSymbolTable, entryPoint, excludeList, forceAppEnvironment, accessKey, secretKey, client, filesSrc, filesDest, source, appProfiling, updateData, dataToValidate, prop, value, applicationUpdate, updateApplicationRes, protectionOptions, inputSymbolTableContents, createApplicationProtectionRes, protectionId, onExitCancelProtection, protection, sourcesErrors, download;
335
+ var start, finalConfig, applicationId, host, port, basePath, protocol, cafile, keys, sources, _finalConfig$stream, stream, cwd, params, applicationTypes, languageSpecifications, sourceMaps, randomizationSeed, areSubscribersOrdered, useRecommendedOrder, _finalConfig$bail, bail, jscramblerVersion, debugMode, proxy, utc, clientId, tolerateMinification, codeHardeningThreshold, useProfilingData, browsers, useAppClassification, profilingDataMode, removeProfilingData, skipSources, inputSymbolTable, entryPoint, excludeList, numberOfProtections, forceAppEnvironment, accessKey, secretKey, client, filesSrc, filesDest, source, updateApplicationSourcePromise, appProfiling, _ref4, updateData, dataToValidate, prop, value, applicationUpdate, updateApplicationRes, protectionOptions, inputSymbolTableContents, _ref5, _ref6, createApplicationProtectionRes, protectionIds, onExitCancelProtection, processedProtections, handleProtection, i, protection;
336
336
 
337
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
337
+ return regeneratorRuntime.wrap(function _callee4$(_context4) {
338
338
  while (1) {
339
- switch (_context2.prev = _context2.next) {
339
+ switch (_context4.prev = _context4.next) {
340
340
  case 0:
341
+ start = Date.now();
341
342
  finalConfig = buildFinalConfig(configPathOrObject);
342
- applicationId = finalConfig.applicationId, host = finalConfig.host, port = finalConfig.port, basePath = finalConfig.basePath, protocol = finalConfig.protocol, cafile = finalConfig.cafile, keys = finalConfig.keys, sources = finalConfig.sources, _finalConfig$stream = finalConfig.stream, stream = _finalConfig$stream === undefined ? true : _finalConfig$stream, cwd = finalConfig.cwd, params = finalConfig.params, applicationTypes = finalConfig.applicationTypes, languageSpecifications = finalConfig.languageSpecifications, sourceMaps = finalConfig.sourceMaps, randomizationSeed = finalConfig.randomizationSeed, areSubscribersOrdered = finalConfig.areSubscribersOrdered, useRecommendedOrder = finalConfig.useRecommendedOrder, _finalConfig$bail = finalConfig.bail, bail = _finalConfig$bail === undefined ? true : _finalConfig$bail, jscramblerVersion = finalConfig.jscramblerVersion, debugMode = finalConfig.debugMode, proxy = finalConfig.proxy, utc = finalConfig.utc, clientId = finalConfig.clientId, tolerateMinification = finalConfig.tolerateMinification, codeHardeningThreshold = finalConfig.codeHardeningThreshold, useProfilingData = finalConfig.useProfilingData, browsers = finalConfig.browsers, useAppClassification = finalConfig.useAppClassification, profilingDataMode = finalConfig.profilingDataMode, removeProfilingData = finalConfig.removeProfilingData, skipSources = finalConfig.skipSources, inputSymbolTable = finalConfig.inputSymbolTable, entryPoint = finalConfig.entryPoint, excludeList = finalConfig.excludeList, forceAppEnvironment = finalConfig.forceAppEnvironment;
343
+ applicationId = finalConfig.applicationId, host = finalConfig.host, port = finalConfig.port, basePath = finalConfig.basePath, protocol = finalConfig.protocol, cafile = finalConfig.cafile, keys = finalConfig.keys, sources = finalConfig.sources, _finalConfig$stream = finalConfig.stream, stream = _finalConfig$stream === undefined ? true : _finalConfig$stream, cwd = finalConfig.cwd, params = finalConfig.params, applicationTypes = finalConfig.applicationTypes, languageSpecifications = finalConfig.languageSpecifications, sourceMaps = finalConfig.sourceMaps, randomizationSeed = finalConfig.randomizationSeed, areSubscribersOrdered = finalConfig.areSubscribersOrdered, useRecommendedOrder = finalConfig.useRecommendedOrder, _finalConfig$bail = finalConfig.bail, bail = _finalConfig$bail === undefined ? true : _finalConfig$bail, jscramblerVersion = finalConfig.jscramblerVersion, debugMode = finalConfig.debugMode, proxy = finalConfig.proxy, utc = finalConfig.utc, clientId = finalConfig.clientId, tolerateMinification = finalConfig.tolerateMinification, codeHardeningThreshold = finalConfig.codeHardeningThreshold, useProfilingData = finalConfig.useProfilingData, browsers = finalConfig.browsers, useAppClassification = finalConfig.useAppClassification, profilingDataMode = finalConfig.profilingDataMode, removeProfilingData = finalConfig.removeProfilingData, skipSources = finalConfig.skipSources, inputSymbolTable = finalConfig.inputSymbolTable, entryPoint = finalConfig.entryPoint, excludeList = finalConfig.excludeList, numberOfProtections = finalConfig.numberOfProtections, forceAppEnvironment = finalConfig.forceAppEnvironment;
343
344
  accessKey = keys.accessKey, secretKey = keys.secretKey;
344
345
  client = new this.Client({
345
346
  accessKey: accessKey,
@@ -367,49 +368,49 @@ exports.default = {
367
368
  }
368
369
 
369
370
  if (applicationId) {
370
- _context2.next = 10;
371
+ _context4.next = 11;
371
372
  break;
372
373
  }
373
374
 
374
375
  throw new Error('Required *applicationId* not provided');
375
376
 
376
- case 10:
377
+ case 11:
377
378
  if (!(!filesDest && !destCallback)) {
378
- _context2.next = 12;
379
+ _context4.next = 13;
379
380
  break;
380
381
  }
381
382
 
382
383
  throw new Error('Required *filesDest* not provided');
383
384
 
384
- case 12:
385
- source = void 0;
385
+ case 13:
386
+ source = void 0, updateApplicationSourcePromise = void 0;
386
387
 
387
388
  if (skipSources) {
388
- _context2.next = 26;
389
+ _context4.next = 29;
389
390
  break;
390
391
  }
391
392
 
392
- _context2.next = 16;
393
+ _context4.next = 17;
393
394
  return this.getApplicationProfiling(client, applicationId).catch(function (e) {
394
395
  if (![_constants.HTTP_STATUS_CODES.NOT_FOUND, _constants.HTTP_STATUS_CODES.FORBIDDEN, _constants.HTTP_STATUS_CODES.SERVICE_UNAVAILABLE].includes(e.statusCode)) throw e;
395
396
  });
396
397
 
397
- case 16:
398
- appProfiling = _context2.sent;
398
+ case 17:
399
+ appProfiling = _context4.sent;
399
400
 
400
401
  if (!(appProfiling && removeProfilingData)) {
401
- _context2.next = 21;
402
+ _context4.next = 22;
402
403
  break;
403
404
  }
404
405
 
405
- _context2.next = 20;
406
+ _context4.next = 21;
406
407
  return this.deleteProfiling(client, appProfiling.data.id);
407
408
 
408
- case 20:
409
+ case 21:
409
410
  appProfiling.data.state = 'DELETED';
410
411
 
411
- case 21:
412
- _context2.next = 23;
412
+ case 22:
413
+ _context4.next = 24;
413
414
  return this.updateApplicationSources(client, applicationId, {
414
415
  sources: sources,
415
416
  filesSrc: filesSrc,
@@ -417,15 +418,17 @@ exports.default = {
417
418
  appProfiling: appProfiling
418
419
  });
419
420
 
420
- case 23:
421
- source = _context2.sent;
422
- _context2.next = 27;
421
+ case 24:
422
+ _ref4 = _context4.sent;
423
+ source = _ref4.source;
424
+ updateApplicationSourcePromise = _ref4.promise;
425
+ _context4.next = 30;
423
426
  break;
424
427
 
425
- case 26:
428
+ case 29:
426
429
  console.log('Update source files SKIPPED');
427
430
 
428
- case 27:
431
+ case 30:
429
432
  updateData = {
430
433
  _id: applicationId,
431
434
  debugMode: !!debugMode,
@@ -461,7 +464,7 @@ exports.default = {
461
464
  }
462
465
 
463
466
  if (!(updateData.parameters || updateData.applicationTypes || updateData.languageSpecifications || updateData.browsers || typeof updateData.areSubscribersOrdered !== 'undefined')) {
464
- _context2.next = 41;
467
+ _context4.next = 44;
465
468
  break;
466
469
  }
467
470
 
@@ -469,16 +472,16 @@ exports.default = {
469
472
  console.log('Updating parameters of protection');
470
473
  }
471
474
 
472
- _context2.next = 35;
475
+ _context4.next = 38;
473
476
  return intoObjectType(client, updateData, 'Application');
474
477
 
475
- case 35:
476
- applicationUpdate = _context2.sent;
477
- _context2.next = 38;
478
+ case 38:
479
+ applicationUpdate = _context4.sent;
480
+ _context4.next = 41;
478
481
  return this.updateApplication(client, applicationUpdate);
479
482
 
480
- case 38:
481
- updateApplicationRes = _context2.sent;
483
+ case 41:
484
+ updateApplicationRes = _context4.sent;
482
485
 
483
486
  if (debug) {
484
487
  console.log('Finished updating parameters of protection');
@@ -486,7 +489,7 @@ exports.default = {
486
489
  }
487
490
  errorHandler(updateApplicationRes);
488
491
 
489
- case 41:
492
+ case 44:
490
493
 
491
494
  if (debug) {
492
495
  console.log('Creating Application Protection');
@@ -501,6 +504,7 @@ exports.default = {
501
504
  randomizationSeed: randomizationSeed,
502
505
  source: source,
503
506
  tolerateMinification: tolerateMinification,
507
+ numberOfProtections: numberOfProtections,
504
508
  forceAppEnvironment: forceAppEnvironment
505
509
  });
506
510
 
@@ -514,145 +518,267 @@ exports.default = {
514
518
  protectionOptions.inputSymbolTable = inputSymbolTableContents;
515
519
  }
516
520
 
517
- _context2.next = 47;
518
- return this.createApplicationProtection(client, applicationId, protectionOptions);
521
+ _context4.next = 50;
522
+ return Promise.all([this.createApplicationProtections(client, applicationId, protectionOptions), updateApplicationSourcePromise]);
519
523
 
520
- case 47:
521
- createApplicationProtectionRes = _context2.sent;
524
+ case 50:
525
+ _ref5 = _context4.sent;
526
+ _ref6 = _slicedToArray(_ref5, 1);
527
+ createApplicationProtectionRes = _ref6[0];
522
528
 
523
529
  errorHandler(createApplicationProtectionRes);
524
530
 
525
- protectionId = createApplicationProtectionRes.data.createApplicationProtection._id;
531
+ protectionIds = createApplicationProtectionRes.data.protections.map(function (_ref7) {
532
+ var _id = _ref7._id;
533
+ return _id;
534
+ });
526
535
 
527
- onExitCancelProtection = function onExitCancelProtection() {
528
- _this.cancelProtection(client, protectionId, applicationId).then(function () {
529
- return console.log('\n** Protection %s WAS CANCELLED **', protectionId);
530
- }).catch(function () {
531
- return debug && console.error(e);
532
- }).finally(function () {
533
- return process.exit(0);
534
- });
535
- };
536
+ onExitCancelProtection = function () {
537
+ var _ref8 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
538
+ var i, protectionId;
539
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
540
+ while (1) {
541
+ switch (_context2.prev = _context2.next) {
542
+ case 0:
543
+ i = 0;
544
+
545
+ case 1:
546
+ if (!(i < protectionIds.length)) {
547
+ _context2.next = 15;
548
+ break;
549
+ }
550
+
551
+ protectionId = protectionIds[i];
552
+ _context2.prev = 3;
553
+ _context2.next = 6;
554
+ return _this2.cancelProtection(client, protectionId, applicationId);
555
+
556
+ case 6:
557
+ console.log('** Protection %s WAS CANCELLED **', protectionId);
558
+ _context2.next = 12;
559
+ break;
560
+
561
+ case 9:
562
+ _context2.prev = 9;
563
+ _context2.t0 = _context2['catch'](3);
564
+
565
+ if (debug) {
566
+ console.error(_context2.t0);
567
+ }
568
+
569
+ case 12:
570
+ i++;
571
+ _context2.next = 1;
572
+ break;
573
+
574
+ case 15:
575
+ process.exit(1);
576
+
577
+ case 16:
578
+ case 'end':
579
+ return _context2.stop();
580
+ }
581
+ }
582
+ }, _callee2, _this2, [[3, 9]]);
583
+ }));
584
+
585
+ return function onExitCancelProtection() {
586
+ return _ref8.apply(this, arguments);
587
+ };
588
+ }();
536
589
 
537
590
  process.once('SIGINT', onExitCancelProtection).once('SIGTERM', onExitCancelProtection);
538
591
 
539
- _context2.t0 = this;
540
- _context2.t1 = client;
541
- _context2.t2 = applicationId;
542
- _context2.t3 = protectionId;
543
- _context2.next = 58;
592
+ _context4.t0 = this;
593
+ _context4.t1 = client;
594
+ _context4.t2 = applicationId;
595
+ _context4.t3 = protectionIds;
596
+ _context4.next = 63;
544
597
  return (0, _getProtectionDefaultFragments2.default)(client);
545
598
 
546
- case 58:
547
- _context2.t4 = _context2.sent;
548
- _context2.next = 61;
549
- return _context2.t0.pollProtection.call(_context2.t0, _context2.t1, _context2.t2, _context2.t3, _context2.t4);
599
+ case 63:
600
+ _context4.t4 = _context4.sent;
601
+ _context4.next = 66;
602
+ return _context4.t0.pollProtections.call(_context4.t0, _context4.t1, _context4.t2, _context4.t3, _context4.t4);
550
603
 
551
- case 61:
552
- protection = _context2.sent;
604
+ case 66:
605
+ processedProtections = _context4.sent;
553
606
 
554
607
 
555
608
  process.removeListener('SIGINT', onExitCancelProtection).removeListener('SIGTERM', onExitCancelProtection);
556
609
 
557
- if (protection.growthWarning) {
558
- console.warn('Warning: Your protected application has surpassed a reasonable file growth.\nFor more information on what might have caused this, please see the Protection Report.\nLink: ' + APP_URL + '.');
559
- }
560
- if (debug) {
561
- console.log('Finished protecting');
562
- }
610
+ handleProtection = function () {
611
+ var _ref9 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(protection) {
612
+ var _ref10 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
613
+ _ref10$outPrefix = _ref10.outPrefix,
614
+ outPrefix = _ref10$outPrefix === undefined ? '' : _ref10$outPrefix,
615
+ _ref10$printProtectio = _ref10.printProtectionId,
616
+ printProtectionId = _ref10$printProtectio === undefined ? true : _ref10$printProtectio;
563
617
 
564
- if (protection.deprecations) {
565
- protection.deprecations.forEach(function (deprecation) {
566
- if (deprecation.type === 'Transformation') {
567
- console.warn('Warning: ' + deprecation.type + ' ' + deprecation.entity + ' is no longer maintained. Please consider removing it from your configuration.');
568
- } else if (deprecation.type && deprecation.entity) {
569
- console.warn('Warning: ' + deprecation.type + ' ' + deprecation.entity + ' is deprecated.');
570
- }
571
- });
572
- }
618
+ var sourcesErrors, download;
619
+ return regeneratorRuntime.wrap(function _callee3$(_context3) {
620
+ while (1) {
621
+ switch (_context3.prev = _context3.next) {
622
+ case 0:
623
+ if (protection.growthWarning) {
624
+ console.warn('Warning: Your protected application has surpassed a reasonable file growth.\nFor more information on what might have caused this, please see the Protection Report.\nLink: ' + APP_URL + '.');
625
+ }
626
+ if (debug) {
627
+ console.log('Finished protecting');
628
+ }
573
629
 
574
- sourcesErrors = [];
630
+ if (protection.deprecations) {
631
+ protection.deprecations.forEach(function (deprecation) {
632
+ if (deprecation.type === 'Transformation') {
633
+ console.warn('Warning: ' + deprecation.type + ' ' + deprecation.entity + ' is no longer maintained. Please consider removing it from your configuration.');
634
+ } else if (deprecation.type && deprecation.entity) {
635
+ console.warn('Warning: ' + deprecation.type + ' ' + deprecation.entity + ' is deprecated.');
636
+ }
637
+ });
638
+ }
575
639
 
640
+ sourcesErrors = [];
576
641
 
577
- protection.sources.forEach(function (s) {
578
- if (s.errorMessages && s.errorMessages.length > 0) {
579
- sourcesErrors.push.apply(sourcesErrors, _toConsumableArray(s.errorMessages.map(function (e) {
580
- return Object.assign({
581
- filename: s.filename
582
- }, e);
583
- })));
584
- }
585
- });
586
642
 
587
- if (!(protection.state === 'errored')) {
588
- _context2.next = 76;
589
- break;
590
- }
643
+ protection.sources.forEach(function (s) {
644
+ if (s.errorMessages && s.errorMessages.length > 0) {
645
+ sourcesErrors.push.apply(sourcesErrors, _toConsumableArray(s.errorMessages.map(function (e) {
646
+ return Object.assign({
647
+ filename: s.filename
648
+ }, e);
649
+ })));
650
+ }
651
+ });
591
652
 
592
- console.error('Global protection errors:');
593
- console.error('- ' + protection.errorMessage);
594
- console.error('');
595
- if (sourcesErrors.length > 0) {
596
- printSourcesErrors(sourcesErrors);
597
- }
598
- throw new Error('Protection failed. For more information visit: ' + APP_URL + '.');
653
+ if (!(protection.state === 'errored')) {
654
+ _context3.next = 13;
655
+ break;
656
+ }
599
657
 
600
- case 76:
601
- if (!(sourcesErrors.length > 0)) {
602
- _context2.next = 83;
603
- break;
604
- }
658
+ console.error('Global protection errors:');
659
+ console.error('- ' + protection.errorMessage);
660
+ console.error('');
661
+ if (sourcesErrors.length > 0) {
662
+ printSourcesErrors(sourcesErrors);
663
+ }
664
+ throw new Error('Protection failed. For more information visit: ' + APP_URL + '.');
605
665
 
606
- if (!protection.bail) {
607
- _context2.next = 82;
608
- break;
609
- }
666
+ case 13:
667
+ if (!(sourcesErrors.length > 0)) {
668
+ _context3.next = 20;
669
+ break;
670
+ }
610
671
 
611
- printSourcesErrors(sourcesErrors);
612
- throw new Error('Your protection has failed.');
672
+ if (!protection.bail) {
673
+ _context3.next = 19;
674
+ break;
675
+ }
613
676
 
614
- case 82:
615
- sourcesErrors.forEach(function (e) {
616
- return console.warn('Non-fatal error: "' + e.message + '" in ' + e.filename);
617
- });
677
+ printSourcesErrors(sourcesErrors);
678
+ throw new Error('Your protection has failed.');
618
679
 
619
- case 83:
680
+ case 19:
681
+ sourcesErrors.forEach(function (e) {
682
+ return console.warn('Non-fatal error: "' + e.message + '" in ' + e.filename);
683
+ });
620
684
 
621
- if (debug) {
622
- console.log('Downloading protection result');
623
- }
624
- _context2.next = 86;
625
- return this.downloadApplicationProtection(client, protectionId);
685
+ case 20:
626
686
 
627
- case 86:
628
- download = _context2.sent;
687
+ if (debug) {
688
+ console.log('Downloading protection result');
689
+ }
690
+ _context3.next = 23;
691
+ return _this2.downloadApplicationProtection(client, protection._id);
629
692
 
693
+ case 23:
694
+ download = _context3.sent;
630
695
 
631
- errorHandler(download);
632
696
 
633
- if (debug) {
634
- console.log('Unzipping files');
697
+ errorHandler(download);
698
+
699
+ if (debug) {
700
+ console.log('Unzipping files');
701
+ }
702
+
703
+ _context3.next = 28;
704
+ return (0, _zip.unzip)(download, (filesDest ? '' + filesDest + outPrefix : filesDest) || destCallback, stream);
705
+
706
+ case 28:
707
+
708
+ if (debug) {
709
+ console.log('Finished unzipping files');
710
+ }
711
+
712
+ if (printProtectionId) {
713
+ console.log(protection._id);
714
+ }
715
+
716
+ return _context3.abrupt('return', protection._id);
717
+
718
+ case 31:
719
+ case 'end':
720
+ return _context3.stop();
721
+ }
722
+ }
723
+ }, _callee3, _this2);
724
+ }));
725
+
726
+ return function handleProtection(_x7) {
727
+ return _ref9.apply(this, arguments);
728
+ };
729
+ }();
730
+
731
+ if (!(processedProtections.length === 1)) {
732
+ _context4.next = 71;
733
+ break;
635
734
  }
636
735
 
637
- _context2.next = 91;
638
- return (0, _zip.unzip)(download, filesDest || destCallback, stream);
736
+ return _context4.abrupt('return', handleProtection(processedProtections[0]));
639
737
 
640
- case 91:
738
+ case 71:
641
739
 
642
- if (debug) {
643
- console.log('Finished unzipping files');
740
+ console.log('Protections stored in ' + filesDest + '/[protection-id]');
741
+
742
+ i = 0;
743
+
744
+ case 73:
745
+ if (!(i < processedProtections.length)) {
746
+ _context4.next = 86;
747
+ break;
644
748
  }
645
749
 
646
- console.log(protectionId);
750
+ protection = processedProtections[i];
751
+ _context4.prev = 75;
752
+ _context4.next = 78;
753
+ return handleProtection(protection, { outPrefix: '/' + protection._id + '/', printProtectionId: false });
754
+
755
+ case 78:
756
+ _context4.next = 83;
757
+ break;
758
+
759
+ case 80:
760
+ _context4.prev = 80;
761
+ _context4.t5 = _context4['catch'](75);
762
+
763
+ console.error(_context4.t5);
764
+
765
+ case 83:
766
+ i++;
767
+ _context4.next = 73;
768
+ break;
769
+
770
+ case 86:
647
771
 
648
- return _context2.abrupt('return', protectionId);
772
+ console.log('Runtime: ' + processedProtections.length + ' protections in ' + Math.round((Date.now() - start) / 1000) + 's');
649
773
 
650
- case 94:
774
+ return _context4.abrupt('return', protectionIds);
775
+
776
+ case 88:
651
777
  case 'end':
652
- return _context2.stop();
778
+ return _context4.stop();
653
779
  }
654
780
  }
655
- }, _callee2, this);
781
+ }, _callee4, this, [[75, 80]]);
656
782
  }));
657
783
 
658
784
  function protectAndDownload(_x4, _x5) {
@@ -669,14 +795,14 @@ exports.default = {
669
795
  * @returns {Promise<string>}
670
796
  */
671
797
  instrumentAndDownload: function () {
672
- var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(configPathOrObject, destCallback) {
673
- var _this2 = this;
798
+ var _ref11 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(configPathOrObject, destCallback) {
799
+ var _this3 = this;
674
800
 
675
- var finalConfig, applicationId, host, port, basePath, protocol, cafile, keys, sources, _finalConfig$stream2, stream, cwd, jscramblerVersion, proxy, utc, skipSources, clientId, accessKey, secretKey, client, filesSrc, filesDest, instrumentation, onExitCancelInstrumentation, download;
801
+ var finalConfig, applicationId, host, port, basePath, protocol, cafile, keys, sources, _finalConfig$stream2, stream, cwd, jscramblerVersion, proxy, utc, skipSources, clientId, accessKey, secretKey, client, filesSrc, filesDest, _ref12, updateApplicationSourcePromise, instrumentation, onExitCancelInstrumentation, download;
676
802
 
677
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
803
+ return regeneratorRuntime.wrap(function _callee5$(_context5) {
678
804
  while (1) {
679
- switch (_context3.prev = _context3.next) {
805
+ switch (_context5.prev = _context5.next) {
680
806
  case 0:
681
807
  finalConfig = buildFinalConfig(configPathOrObject);
682
808
  applicationId = finalConfig.applicationId, host = finalConfig.host, port = finalConfig.port, basePath = finalConfig.basePath, protocol = finalConfig.protocol, cafile = finalConfig.cafile, keys = finalConfig.keys, sources = finalConfig.sources, _finalConfig$stream2 = finalConfig.stream, stream = _finalConfig$stream2 === undefined ? true : _finalConfig$stream2, cwd = finalConfig.cwd, jscramblerVersion = finalConfig.jscramblerVersion, proxy = finalConfig.proxy, utc = finalConfig.utc, skipSources = finalConfig.skipSources, clientId = finalConfig.clientId;
@@ -706,7 +832,7 @@ exports.default = {
706
832
  }
707
833
 
708
834
  if (applicationId) {
709
- _context3.next = 9;
835
+ _context5.next = 9;
710
836
  break;
711
837
  }
712
838
 
@@ -714,7 +840,7 @@ exports.default = {
714
840
 
715
841
  case 9:
716
842
  if (!(!filesDest && !destCallback)) {
717
- _context3.next = 11;
843
+ _context5.next = 11;
718
844
  break;
719
845
  }
720
846
 
@@ -722,11 +848,11 @@ exports.default = {
722
848
 
723
849
  case 11:
724
850
  if (skipSources) {
725
- _context3.next = 16;
851
+ _context5.next = 20;
726
852
  break;
727
853
  }
728
854
 
729
- _context3.next = 14;
855
+ _context5.next = 14;
730
856
  return this.updateApplicationSources(client, applicationId, {
731
857
  sources: sources,
732
858
  filesSrc: filesSrc,
@@ -734,38 +860,44 @@ exports.default = {
734
860
  });
735
861
 
736
862
  case 14:
737
- _context3.next = 17;
863
+ _ref12 = _context5.sent;
864
+ updateApplicationSourcePromise = _ref12.promise;
865
+ _context5.next = 18;
866
+ return updateApplicationSourcePromise;
867
+
868
+ case 18:
869
+ _context5.next = 21;
738
870
  break;
739
871
 
740
- case 16:
872
+ case 20:
741
873
  console.log('Update source files SKIPPED');
742
874
 
743
- case 17:
744
- _context3.next = 19;
875
+ case 21:
876
+ _context5.next = 23;
745
877
  return this.startInstrumentation(client, applicationId);
746
878
 
747
- case 19:
748
- instrumentation = _context3.sent;
879
+ case 23:
880
+ instrumentation = _context5.sent;
749
881
 
750
882
  errorHandler(instrumentation);
751
883
 
752
884
  onExitCancelInstrumentation = function onExitCancelInstrumentation() {
753
- _this2.deleteProfiling(client, instrumentation.data.id).then(function () {
885
+ _this3.deleteProfiling(client, instrumentation.data.id).then(function () {
754
886
  return console.log('\n** Instrumentation %s WAS CANCELLED **', instrumentation.data.id);
755
887
  }).catch(function () {
756
888
  return debug && console.error(e);
757
889
  }).finally(function () {
758
- return process.exit(0);
890
+ return process.exit(1);
759
891
  });
760
892
  };
761
893
 
762
894
  process.once('SIGINT', onExitCancelInstrumentation).once('SIGTERM', onExitCancelInstrumentation);
763
895
 
764
- _context3.next = 25;
896
+ _context5.next = 29;
765
897
  return this.pollInstrumentation(client, instrumentation.data.id);
766
898
 
767
- case 25:
768
- instrumentation = _context3.sent;
899
+ case 29:
900
+ instrumentation = _context5.sent;
769
901
 
770
902
 
771
903
  process.removeListener('SIGINT', onExitCancelInstrumentation).removeListener('SIGTERM', onExitCancelInstrumentation);
@@ -774,11 +906,11 @@ exports.default = {
774
906
  console.log('Finished instrumention with id ' + instrumentation.data.id + '. Downloading...');
775
907
  }
776
908
 
777
- _context3.next = 30;
909
+ _context5.next = 34;
778
910
  return this.downloadApplicationInstrumented(client, instrumentation.data.id);
779
911
 
780
- case 30:
781
- download = _context3.sent;
912
+ case 34:
913
+ download = _context5.sent;
782
914
 
783
915
  errorHandler(download);
784
916
 
@@ -786,10 +918,10 @@ exports.default = {
786
918
  console.log('Unzipping files');
787
919
  }
788
920
 
789
- _context3.next = 35;
921
+ _context5.next = 39;
790
922
  return (0, _zip.unzip)(download, filesDest || destCallback, stream);
791
923
 
792
- case 35:
924
+ case 39:
793
925
 
794
926
  if (debug) {
795
927
  console.log('Finished unzipping files');
@@ -799,18 +931,18 @@ exports.default = {
799
931
 
800
932
  console.log('Application ' + applicationId + ' was instrumented. Bootstrap your instrumented application and run *--start-profiling* command.');
801
933
 
802
- return _context3.abrupt('return', instrumentation.data.id);
934
+ return _context5.abrupt('return', instrumentation.data.id);
803
935
 
804
- case 39:
936
+ case 43:
805
937
  case 'end':
806
- return _context3.stop();
938
+ return _context5.stop();
807
939
  }
808
940
  }
809
- }, _callee3, this);
941
+ }, _callee5, this);
810
942
  }));
811
943
 
812
- function instrumentAndDownload(_x6, _x7) {
813
- return _ref4.apply(this, arguments);
944
+ function instrumentAndDownload(_x8, _x9) {
945
+ return _ref11.apply(this, arguments);
814
946
  }
815
947
 
816
948
  return instrumentAndDownload;
@@ -826,11 +958,11 @@ exports.default = {
826
958
  * @returns {Promise<string>} The previous state
827
959
  */
828
960
  setProfilingState: function () {
829
- var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(configPathOrObject, state, label, nextStepMessage) {
961
+ var _ref13 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(configPathOrObject, state, label, nextStepMessage) {
830
962
  var finalConfig, keys, host, port, basePath, protocol, cafile, applicationId, proxy, utc, jscramblerVersion, clientId, accessKey, secretKey, client, instrumentation, previousState;
831
- return regeneratorRuntime.wrap(function _callee4$(_context4) {
963
+ return regeneratorRuntime.wrap(function _callee6$(_context6) {
832
964
  while (1) {
833
- switch (_context4.prev = _context4.next) {
965
+ switch (_context6.prev = _context6.next) {
834
966
  case 0:
835
967
  finalConfig = buildFinalConfig(configPathOrObject);
836
968
  keys = finalConfig.keys, host = finalConfig.host, port = finalConfig.port, basePath = finalConfig.basePath, protocol = finalConfig.protocol, cafile = finalConfig.cafile, applicationId = finalConfig.applicationId, proxy = finalConfig.proxy, utc = finalConfig.utc, jscramblerVersion = finalConfig.jscramblerVersion, clientId = finalConfig.clientId;
@@ -848,16 +980,16 @@ exports.default = {
848
980
  jscramblerVersion: jscramblerVersion,
849
981
  clientId: clientId
850
982
  });
851
- _context4.next = 6;
983
+ _context6.next = 6;
852
984
  return client.get('/profiling-run', { applicationId: applicationId }).catch(function (e) {
853
985
  if (e.statusCode !== 404) throw e;
854
986
  });
855
987
 
856
988
  case 6:
857
- instrumentation = _context4.sent;
989
+ instrumentation = _context6.sent;
858
990
 
859
991
  if (instrumentation) {
860
- _context4.next = 9;
992
+ _context6.next = 9;
861
993
  break;
862
994
  }
863
995
 
@@ -867,15 +999,15 @@ exports.default = {
867
999
  previousState = instrumentation.data.state;
868
1000
 
869
1001
  if (!(previousState === state)) {
870
- _context4.next = 13;
1002
+ _context6.next = 13;
871
1003
  break;
872
1004
  }
873
1005
 
874
1006
  console.log('Profiling was already ' + label + ' for application ' + applicationId + '. ' + nextStepMessage);
875
- return _context4.abrupt('return');
1007
+ return _context6.abrupt('return');
876
1008
 
877
1009
  case 13:
878
- _context4.next = 15;
1010
+ _context6.next = 15;
879
1011
  return client.patch('/profiling-run/' + instrumentation.data.id, {
880
1012
  state: state
881
1013
  });
@@ -886,25 +1018,25 @@ exports.default = {
886
1018
 
887
1019
  case 16:
888
1020
  case 'end':
889
- return _context4.stop();
1021
+ return _context6.stop();
890
1022
  }
891
1023
  }
892
- }, _callee4, this);
1024
+ }, _callee6, this);
893
1025
  }));
894
1026
 
895
- function setProfilingState(_x8, _x9, _x10, _x11) {
896
- return _ref5.apply(this, arguments);
1027
+ function setProfilingState(_x10, _x11, _x12, _x13) {
1028
+ return _ref13.apply(this, arguments);
897
1029
  }
898
1030
 
899
1031
  return setProfilingState;
900
1032
  }(),
901
1033
  downloadSourceMaps: function () {
902
- var _ref6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(configs, destCallback) {
1034
+ var _ref14 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(configs, destCallback) {
903
1035
  var keys, host, port, basePath, protocol, cafile, _configs$stream, stream, filesDest, filesSrc, protectionId, jscramblerVersion, utc, proxy, accessKey, secretKey, client, download;
904
1036
 
905
- return regeneratorRuntime.wrap(function _callee5$(_context5) {
1037
+ return regeneratorRuntime.wrap(function _callee7$(_context7) {
906
1038
  while (1) {
907
- switch (_context5.prev = _context5.next) {
1039
+ switch (_context7.prev = _context7.next) {
908
1040
  case 0:
909
1041
  keys = configs.keys, host = configs.host, port = configs.port, basePath = configs.basePath, protocol = configs.protocol, cafile = configs.cafile, _configs$stream = configs.stream, stream = _configs$stream === undefined ? true : _configs$stream, filesDest = configs.filesDest, filesSrc = configs.filesSrc, protectionId = configs.protectionId, jscramblerVersion = configs.jscramblerVersion, utc = configs.utc, proxy = configs.proxy;
910
1042
  accessKey = keys.accessKey, secretKey = keys.secretKey;
@@ -922,7 +1054,7 @@ exports.default = {
922
1054
  });
923
1055
 
924
1056
  if (!(!filesDest && !destCallback)) {
925
- _context5.next = 5;
1057
+ _context7.next = 5;
926
1058
  break;
927
1059
  }
928
1060
 
@@ -930,7 +1062,7 @@ exports.default = {
930
1062
 
931
1063
  case 5:
932
1064
  if (protectionId) {
933
- _context5.next = 7;
1065
+ _context7.next = 7;
934
1066
  break;
935
1067
  }
936
1068
 
@@ -942,46 +1074,46 @@ exports.default = {
942
1074
  console.warn('[Warning] Ignoring sources supplied. Downloading source maps of given protection');
943
1075
  }
944
1076
  download = void 0;
945
- _context5.prev = 9;
946
- _context5.next = 12;
1077
+ _context7.prev = 9;
1078
+ _context7.next = 12;
947
1079
  return this.downloadSourceMapsRequest(client, protectionId);
948
1080
 
949
1081
  case 12:
950
- download = _context5.sent;
951
- _context5.next = 18;
1082
+ download = _context7.sent;
1083
+ _context7.next = 18;
952
1084
  break;
953
1085
 
954
1086
  case 15:
955
- _context5.prev = 15;
956
- _context5.t0 = _context5['catch'](9);
1087
+ _context7.prev = 15;
1088
+ _context7.t0 = _context7['catch'](9);
957
1089
 
958
- errorHandler(_context5.t0);
1090
+ errorHandler(_context7.t0);
959
1091
 
960
1092
  case 18:
961
- _context5.next = 20;
1093
+ _context7.next = 20;
962
1094
  return (0, _zip.unzip)(download, filesDest || destCallback, stream);
963
1095
 
964
1096
  case 20:
965
1097
  case 'end':
966
- return _context5.stop();
1098
+ return _context7.stop();
967
1099
  }
968
1100
  }
969
- }, _callee5, this, [[9, 15]]);
1101
+ }, _callee7, this, [[9, 15]]);
970
1102
  }));
971
1103
 
972
- function downloadSourceMaps(_x12, _x13) {
973
- return _ref6.apply(this, arguments);
1104
+ function downloadSourceMaps(_x14, _x15) {
1105
+ return _ref14.apply(this, arguments);
974
1106
  }
975
1107
 
976
1108
  return downloadSourceMaps;
977
1109
  }(),
978
1110
  downloadSymbolTable: function () {
979
- var _ref7 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(configs, destCallback) {
1111
+ var _ref15 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8(configs, destCallback) {
980
1112
  var keys, host, port, basePath, protocol, cafile, _configs$stream2, stream, filesDest, filesSrc, protectionId, jscramblerVersion, utc, proxy, accessKey, secretKey, client, download;
981
1113
 
982
- return regeneratorRuntime.wrap(function _callee6$(_context6) {
1114
+ return regeneratorRuntime.wrap(function _callee8$(_context8) {
983
1115
  while (1) {
984
- switch (_context6.prev = _context6.next) {
1116
+ switch (_context8.prev = _context8.next) {
985
1117
  case 0:
986
1118
  keys = configs.keys, host = configs.host, port = configs.port, basePath = configs.basePath, protocol = configs.protocol, cafile = configs.cafile, _configs$stream2 = configs.stream, stream = _configs$stream2 === undefined ? true : _configs$stream2, filesDest = configs.filesDest, filesSrc = configs.filesSrc, protectionId = configs.protectionId, jscramblerVersion = configs.jscramblerVersion, utc = configs.utc, proxy = configs.proxy;
987
1119
  accessKey = keys.accessKey, secretKey = keys.secretKey;
@@ -999,7 +1131,7 @@ exports.default = {
999
1131
  });
1000
1132
 
1001
1133
  if (!(!filesDest && !destCallback)) {
1002
- _context6.next = 5;
1134
+ _context8.next = 5;
1003
1135
  break;
1004
1136
  }
1005
1137
 
@@ -1007,7 +1139,7 @@ exports.default = {
1007
1139
 
1008
1140
  case 5:
1009
1141
  if (protectionId) {
1010
- _context6.next = 7;
1142
+ _context8.next = 7;
1011
1143
  break;
1012
1144
  }
1013
1145
 
@@ -1019,20 +1151,20 @@ exports.default = {
1019
1151
  console.warn('[Warning] Ignoring sources supplied. Downloading symbol table of given protection');
1020
1152
  }
1021
1153
  download = void 0;
1022
- _context6.prev = 9;
1023
- _context6.next = 12;
1154
+ _context8.prev = 9;
1155
+ _context8.next = 12;
1024
1156
  return this.downloadSymbolTableRequest(client, protectionId);
1025
1157
 
1026
1158
  case 12:
1027
- download = _context6.sent;
1028
- _context6.next = 18;
1159
+ download = _context8.sent;
1160
+ _context8.next = 18;
1029
1161
  break;
1030
1162
 
1031
1163
  case 15:
1032
- _context6.prev = 15;
1033
- _context6.t0 = _context6['catch'](9);
1164
+ _context8.prev = 15;
1165
+ _context8.t0 = _context8['catch'](9);
1034
1166
 
1035
- errorHandler(_context6.t0);
1167
+ errorHandler(_context8.t0);
1036
1168
 
1037
1169
  case 18:
1038
1170
 
@@ -1044,14 +1176,14 @@ exports.default = {
1044
1176
 
1045
1177
  case 19:
1046
1178
  case 'end':
1047
- return _context6.stop();
1179
+ return _context8.stop();
1048
1180
  }
1049
1181
  }
1050
- }, _callee6, this, [[9, 15]]);
1182
+ }, _callee8, this, [[9, 15]]);
1051
1183
  }));
1052
1184
 
1053
- function downloadSymbolTable(_x14, _x15) {
1054
- return _ref7.apply(this, arguments);
1185
+ function downloadSymbolTable(_x16, _x17) {
1186
+ return _ref15.apply(this, arguments);
1055
1187
  }
1056
1188
 
1057
1189
  return downloadSymbolTable;
@@ -1066,30 +1198,30 @@ exports.default = {
1066
1198
  * @throws {Error} due to errors in instrumentation process or user cancel the operation
1067
1199
  */
1068
1200
  pollInstrumentation: function () {
1069
- var _ref8 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8(client, instrumentationId) {
1070
- var _this3 = this;
1201
+ var _ref16 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10(client, instrumentationId) {
1202
+ var _this4 = this;
1071
1203
 
1072
1204
  var start, poll;
1073
- return regeneratorRuntime.wrap(function _callee8$(_context8) {
1205
+ return regeneratorRuntime.wrap(function _callee10$(_context10) {
1074
1206
  while (1) {
1075
- switch (_context8.prev = _context8.next) {
1207
+ switch (_context10.prev = _context10.next) {
1076
1208
  case 0:
1077
1209
  start = Date.now();
1078
1210
 
1079
1211
  poll = function () {
1080
- var _ref9 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7() {
1212
+ var _ref17 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9() {
1081
1213
  var instrumentation;
1082
- return regeneratorRuntime.wrap(function _callee7$(_context7) {
1214
+ return regeneratorRuntime.wrap(function _callee9$(_context9) {
1083
1215
  while (1) {
1084
- switch (_context7.prev = _context7.next) {
1216
+ switch (_context9.prev = _context9.next) {
1085
1217
  case 0:
1086
- _context7.next = 2;
1087
- return _this3.getInstrumentation(client, instrumentationId);
1218
+ _context9.next = 2;
1219
+ return _this4.getInstrumentation(client, instrumentationId);
1088
1220
 
1089
1221
  case 2:
1090
- instrumentation = _context7.sent;
1091
- _context7.t0 = instrumentation.data.state;
1092
- _context7.next = _context7.t0 === 'DELETED' ? 6 : _context7.t0 === 'FAILED_INSTRUMENTATION' ? 7 : _context7.t0 === 'FINISHED_INSTRUMENTATION' ? 9 : 10;
1222
+ instrumentation = _context9.sent;
1223
+ _context9.t0 = instrumentation.data.state;
1224
+ _context9.next = _context9.t0 === 'DELETED' ? 6 : _context9.t0 === 'FAILED_INSTRUMENTATION' ? 7 : _context9.t0 === 'FINISHED_INSTRUMENTATION' ? 9 : 10;
1093
1225
  break;
1094
1226
 
1095
1227
  case 6:
@@ -1101,84 +1233,84 @@ exports.default = {
1101
1233
  message: e.message + ' at ' + e.fileName + ':' + e.lineNumber
1102
1234
  };
1103
1235
  }));
1104
- return _context7.abrupt('return', errorHandler(instrumentation));
1236
+ return _context9.abrupt('return', errorHandler(instrumentation));
1105
1237
 
1106
1238
  case 9:
1107
- return _context7.abrupt('return', instrumentation);
1239
+ return _context9.abrupt('return', instrumentation);
1108
1240
 
1109
1241
  case 10:
1110
- _context7.next = 12;
1242
+ _context9.next = 12;
1111
1243
  return new Promise(function (resolve) {
1112
1244
  return setTimeout(resolve, getPollingInterval(start));
1113
1245
  });
1114
1246
 
1115
1247
  case 12:
1116
- return _context7.abrupt('return', poll());
1248
+ return _context9.abrupt('return', poll());
1117
1249
 
1118
1250
  case 13:
1119
1251
  case 'end':
1120
- return _context7.stop();
1252
+ return _context9.stop();
1121
1253
  }
1122
1254
  }
1123
- }, _callee7, _this3);
1255
+ }, _callee9, _this4);
1124
1256
  }));
1125
1257
 
1126
1258
  return function poll() {
1127
- return _ref9.apply(this, arguments);
1259
+ return _ref17.apply(this, arguments);
1128
1260
  };
1129
1261
  }();
1130
1262
 
1131
- return _context8.abrupt('return', poll());
1263
+ return _context10.abrupt('return', poll());
1132
1264
 
1133
1265
  case 3:
1134
1266
  case 'end':
1135
- return _context8.stop();
1267
+ return _context10.stop();
1136
1268
  }
1137
1269
  }
1138
- }, _callee8, this);
1270
+ }, _callee10, this);
1139
1271
  }));
1140
1272
 
1141
- function pollInstrumentation(_x16, _x17) {
1142
- return _ref8.apply(this, arguments);
1273
+ function pollInstrumentation(_x18, _x19) {
1274
+ return _ref16.apply(this, arguments);
1143
1275
  }
1144
1276
 
1145
1277
  return pollInstrumentation;
1146
1278
  }(),
1147
1279
  withRetries: function () {
1148
- var _ref10 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9(action) {
1280
+ var _ref18 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11(action) {
1149
1281
  var retriesLeft;
1150
- return regeneratorRuntime.wrap(function _callee9$(_context9) {
1282
+ return regeneratorRuntime.wrap(function _callee11$(_context11) {
1151
1283
  while (1) {
1152
- switch (_context9.prev = _context9.next) {
1284
+ switch (_context11.prev = _context11.next) {
1153
1285
  case 0:
1154
1286
  retriesLeft = _config3.default.maxRetries;
1155
1287
 
1156
1288
  case 1:
1157
- _context9.prev = 1;
1158
- _context9.next = 4;
1289
+ _context11.prev = 1;
1290
+ _context11.next = 4;
1159
1291
  return action();
1160
1292
 
1161
1293
  case 4:
1162
- return _context9.abrupt('return', _context9.sent);
1294
+ return _context11.abrupt('return', _context11.sent);
1163
1295
 
1164
1296
  case 7:
1165
- _context9.prev = 7;
1166
- _context9.t0 = _context9['catch'](1);
1297
+ _context11.prev = 7;
1298
+ _context11.t0 = _context11['catch'](1);
1167
1299
 
1168
1300
  if (!(retriesLeft <= 0)) {
1169
- _context9.next = 11;
1301
+ _context11.next = 11;
1170
1302
  break;
1171
1303
  }
1172
1304
 
1173
- throw _context9.t0;
1305
+ throw _context11.t0;
1174
1306
 
1175
1307
  case 11:
1176
- if (!(_context9.t0.statusCode !== _constants.HTTP_STATUS_CODES.SERVICE_UNAVAILABLE && _context9.t0.statusCode !== _constants.HTTP_STATUS_CODES.GATEWAY_TIMEOUT)) {
1177
- _context9.next = 13;
1308
+ if (!(_context11.t0.statusCode !== _constants.HTTP_STATUS_CODES.SERVICE_UNAVAILABLE && _context11.t0.statusCode !== _constants.HTTP_STATUS_CODES.GATEWAY_TIMEOUT)) {
1309
+ _context11.next = 13;
1178
1310
  break;
1179
1311
  }
1180
1312
 
1181
- throw _context9.t0;
1313
+ throw _context11.t0;
1182
1314
 
1183
1315
  case 13:
1184
1316
  // Retry
@@ -1188,51 +1320,51 @@ exports.default = {
1188
1320
  retriesLeft--;
1189
1321
 
1190
1322
  case 15:
1191
- _context9.next = 1;
1323
+ _context11.next = 1;
1192
1324
  break;
1193
1325
 
1194
1326
  case 17:
1195
1327
  case 'end':
1196
- return _context9.stop();
1328
+ return _context11.stop();
1197
1329
  }
1198
1330
  }
1199
- }, _callee9, this, [[1, 7]]);
1331
+ }, _callee11, this, [[1, 7]]);
1200
1332
  }));
1201
1333
 
1202
- function withRetries(_x18) {
1203
- return _ref10.apply(this, arguments);
1334
+ function withRetries(_x20) {
1335
+ return _ref18.apply(this, arguments);
1204
1336
  }
1205
1337
 
1206
1338
  return withRetries;
1207
1339
  }(),
1208
1340
  pollProtection: function () {
1209
- var _ref11 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11(client, applicationId, protectionId, fragments) {
1210
- var _this4 = this;
1341
+ var _ref19 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13(client, applicationId, protectionId, fragments) {
1342
+ var _this5 = this;
1211
1343
 
1212
1344
  var start, poll;
1213
- return regeneratorRuntime.wrap(function _callee11$(_context11) {
1345
+ return regeneratorRuntime.wrap(function _callee13$(_context13) {
1214
1346
  while (1) {
1215
- switch (_context11.prev = _context11.next) {
1347
+ switch (_context13.prev = _context13.next) {
1216
1348
  case 0:
1217
1349
  start = Date.now();
1218
1350
 
1219
1351
  poll = function () {
1220
- var _ref12 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10() {
1352
+ var _ref20 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12() {
1221
1353
  var applicationProtection, state;
1222
- return regeneratorRuntime.wrap(function _callee10$(_context10) {
1354
+ return regeneratorRuntime.wrap(function _callee12$(_context12) {
1223
1355
  while (1) {
1224
- switch (_context10.prev = _context10.next) {
1356
+ switch (_context12.prev = _context12.next) {
1225
1357
  case 0:
1226
- _context10.next = 2;
1227
- return _this4.withRetries(function () {
1228
- return _this4.getApplicationProtection(client, applicationId, protectionId, fragments);
1358
+ _context12.next = 2;
1359
+ return _this5.withRetries(function () {
1360
+ return _this5.getApplicationProtection(client, applicationId, protectionId, fragments);
1229
1361
  });
1230
1362
 
1231
1363
  case 2:
1232
- applicationProtection = _context10.sent;
1364
+ applicationProtection = _context12.sent;
1233
1365
 
1234
1366
  if (!applicationProtection.errors) {
1235
- _context10.next = 8;
1367
+ _context12.next = 8;
1236
1368
  break;
1237
1369
  }
1238
1370
 
@@ -1244,126 +1376,241 @@ exports.default = {
1244
1376
  state = applicationProtection.data.applicationProtection.state;
1245
1377
 
1246
1378
  if (!(state !== 'finished' && state !== 'errored' && state !== 'canceled')) {
1247
- _context10.next = 15;
1379
+ _context12.next = 15;
1248
1380
  break;
1249
1381
  }
1250
1382
 
1251
- _context10.next = 12;
1383
+ _context12.next = 12;
1252
1384
  return new Promise(function (resolve) {
1253
1385
  return setTimeout(resolve, getPollingInterval(start));
1254
1386
  });
1255
1387
 
1256
1388
  case 12:
1257
- return _context10.abrupt('return', poll());
1389
+ return _context12.abrupt('return', poll());
1258
1390
 
1259
1391
  case 15:
1260
1392
  if (!(state === 'canceled')) {
1261
- _context10.next = 19;
1393
+ _context12.next = 19;
1262
1394
  break;
1263
1395
  }
1264
1396
 
1265
1397
  throw new Error('Protection canceled by user');
1266
1398
 
1267
1399
  case 19:
1268
- return _context10.abrupt('return', applicationProtection.data.applicationProtection);
1400
+ return _context12.abrupt('return', applicationProtection.data.applicationProtection);
1269
1401
 
1270
1402
  case 20:
1271
1403
  case 'end':
1272
- return _context10.stop();
1404
+ return _context12.stop();
1273
1405
  }
1274
1406
  }
1275
- }, _callee10, _this4);
1407
+ }, _callee12, _this5);
1276
1408
  }));
1277
1409
 
1278
1410
  return function poll() {
1279
- return _ref12.apply(this, arguments);
1411
+ return _ref20.apply(this, arguments);
1280
1412
  };
1281
1413
  }();
1282
1414
 
1283
- return _context11.abrupt('return', poll());
1415
+ return _context13.abrupt('return', poll());
1284
1416
 
1285
1417
  case 3:
1286
1418
  case 'end':
1287
- return _context11.stop();
1419
+ return _context13.stop();
1288
1420
  }
1289
1421
  }
1290
- }, _callee11, this);
1422
+ }, _callee13, this);
1291
1423
  }));
1292
1424
 
1293
- function pollProtection(_x19, _x20, _x21, _x22) {
1294
- return _ref11.apply(this, arguments);
1425
+ function pollProtection(_x21, _x22, _x23, _x24) {
1426
+ return _ref19.apply(this, arguments);
1295
1427
  }
1296
1428
 
1297
1429
  return pollProtection;
1298
1430
  }(),
1431
+ pollProtections: function () {
1432
+ var _ref21 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee15(client, applicationId, protectionIds, fragments) {
1433
+ var _this6 = this;
1299
1434
 
1300
- //
1301
- createApplication: function () {
1302
- var _ref13 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12(client, data, fragments) {
1303
- return regeneratorRuntime.wrap(function _callee12$(_context12) {
1435
+ var start, seen, poll;
1436
+ return regeneratorRuntime.wrap(function _callee15$(_context15) {
1304
1437
  while (1) {
1305
- switch (_context12.prev = _context12.next) {
1438
+ switch (_context15.prev = _context15.next) {
1306
1439
  case 0:
1307
- return _context12.abrupt('return', client.post('/application', mutations.createApplication(data, fragments)));
1440
+ if (!(protectionIds.length === 1)) {
1441
+ _context15.next = 5;
1442
+ break;
1443
+ }
1308
1444
 
1309
- case 1:
1310
- case 'end':
1311
- return _context12.stop();
1312
- }
1313
- }
1314
- }, _callee12, this);
1315
- }));
1445
+ _context15.next = 3;
1446
+ return this.pollProtection(client, applicationId, protectionIds[0], fragments);
1316
1447
 
1317
- function createApplication(_x23, _x24, _x25) {
1318
- return _ref13.apply(this, arguments);
1319
- }
1448
+ case 3:
1449
+ _context15.t0 = _context15.sent;
1450
+ return _context15.abrupt('return', [_context15.t0]);
1320
1451
 
1321
- return createApplication;
1322
- }(),
1452
+ case 5:
1453
+ start = Date.now();
1454
+ seen = {};
1323
1455
 
1324
- //
1325
- duplicateApplication: function () {
1326
- var _ref14 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13(client, data, fragments) {
1327
- return regeneratorRuntime.wrap(function _callee13$(_context13) {
1328
- while (1) {
1329
- switch (_context13.prev = _context13.next) {
1330
- case 0:
1331
- return _context13.abrupt('return', client.post('/application', mutations.duplicateApplication(data, fragments)));
1456
+ poll = function () {
1457
+ var _ref22 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee14() {
1458
+ var applicationProtections, ended;
1459
+ return regeneratorRuntime.wrap(function _callee14$(_context14) {
1460
+ while (1) {
1461
+ switch (_context14.prev = _context14.next) {
1462
+ case 0:
1463
+ _context14.next = 2;
1464
+ return _this6.withRetries(function () {
1465
+ return _this6.getApplicationProtections(client, applicationId, { protectionIds: protectionIds }, fragments.applicationProtection, ["$protectionIds: [String]"]);
1466
+ });
1332
1467
 
1333
- case 1:
1334
- case 'end':
1335
- return _context13.stop();
1336
- }
1337
- }
1338
- }, _callee13, this);
1339
- }));
1468
+ case 2:
1469
+ applicationProtections = _context14.sent;
1340
1470
 
1341
- function duplicateApplication(_x26, _x27, _x28) {
1342
- return _ref14.apply(this, arguments);
1343
- }
1471
+ if (!applicationProtections.errors) {
1472
+ _context14.next = 8;
1473
+ break;
1474
+ }
1475
+
1476
+ console.log('Error polling protection', applicationProtections.errors);
1477
+
1478
+ throw new Error('Protection failed. For more information visit: ' + APP_URL + '.');
1479
+
1480
+ case 8:
1481
+ ended = applicationProtections.data.applicationProtections.filter(function (_ref23) {
1482
+ var state = _ref23.state;
1483
+ return state === 'finished' || state === 'errored' || state === 'canceled';
1484
+ });
1485
+ // print progress
1486
+
1487
+ ended.filter(function (_ref24) {
1488
+ var _id = _ref24._id,
1489
+ state = _ref24.state;
1490
+ return !seen[_id] && state !== 'canceled';
1491
+ }).forEach(function (_ref25) {
1492
+ var _id = _ref25._id,
1493
+ startedAt = _ref25.startedAt,
1494
+ finishedAt = _ref25.finishedAt,
1495
+ state = _ref25.state;
1496
+
1497
+ seen[_id] = true;
1498
+ console.log('[' + Object.keys(seen).length + '/' + protectionIds.length + '] Protection=' + _id + ', state=' + state + ', build-time=' + Math.round((new Date(finishedAt) - new Date(startedAt)) / 1000) + 's');
1499
+ });
1500
+
1501
+ if (!(ended.length < protectionIds.length)) {
1502
+ _context14.next = 14;
1503
+ break;
1504
+ }
1505
+
1506
+ _context14.next = 13;
1507
+ return new Promise(function (resolve) {
1508
+ return setTimeout(resolve, getPollingInterval(start));
1509
+ });
1510
+
1511
+ case 13:
1512
+ return _context14.abrupt('return', poll());
1513
+
1514
+ case 14:
1515
+ return _context14.abrupt('return', applicationProtections.data.applicationProtections);
1516
+
1517
+ case 15:
1518
+ case 'end':
1519
+ return _context14.stop();
1520
+ }
1521
+ }
1522
+ }, _callee14, _this6);
1523
+ }));
1524
+
1525
+ return function poll() {
1526
+ return _ref22.apply(this, arguments);
1527
+ };
1528
+ }();
1529
+
1530
+ return _context15.abrupt('return', poll());
1531
+
1532
+ case 9:
1533
+ case 'end':
1534
+ return _context15.stop();
1535
+ }
1536
+ }
1537
+ }, _callee15, this);
1538
+ }));
1539
+
1540
+ function pollProtections(_x25, _x26, _x27, _x28) {
1541
+ return _ref21.apply(this, arguments);
1542
+ }
1543
+
1544
+ return pollProtections;
1545
+ }(),
1546
+
1547
+ //
1548
+ createApplication: function () {
1549
+ var _ref26 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee16(client, data, fragments) {
1550
+ return regeneratorRuntime.wrap(function _callee16$(_context16) {
1551
+ while (1) {
1552
+ switch (_context16.prev = _context16.next) {
1553
+ case 0:
1554
+ return _context16.abrupt('return', client.post('/application', mutations.createApplication(data, fragments)));
1555
+
1556
+ case 1:
1557
+ case 'end':
1558
+ return _context16.stop();
1559
+ }
1560
+ }
1561
+ }, _callee16, this);
1562
+ }));
1563
+
1564
+ function createApplication(_x29, _x30, _x31) {
1565
+ return _ref26.apply(this, arguments);
1566
+ }
1567
+
1568
+ return createApplication;
1569
+ }(),
1570
+
1571
+ //
1572
+ duplicateApplication: function () {
1573
+ var _ref27 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee17(client, data, fragments) {
1574
+ return regeneratorRuntime.wrap(function _callee17$(_context17) {
1575
+ while (1) {
1576
+ switch (_context17.prev = _context17.next) {
1577
+ case 0:
1578
+ return _context17.abrupt('return', client.post('/application', mutations.duplicateApplication(data, fragments)));
1579
+
1580
+ case 1:
1581
+ case 'end':
1582
+ return _context17.stop();
1583
+ }
1584
+ }
1585
+ }, _callee17, this);
1586
+ }));
1587
+
1588
+ function duplicateApplication(_x32, _x33, _x34) {
1589
+ return _ref27.apply(this, arguments);
1590
+ }
1344
1591
 
1345
1592
  return duplicateApplication;
1346
1593
  }(),
1347
1594
 
1348
1595
  //
1349
1596
  removeApplication: function () {
1350
- var _ref15 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee14(client, id) {
1351
- return regeneratorRuntime.wrap(function _callee14$(_context14) {
1597
+ var _ref28 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee18(client, id) {
1598
+ return regeneratorRuntime.wrap(function _callee18$(_context18) {
1352
1599
  while (1) {
1353
- switch (_context14.prev = _context14.next) {
1600
+ switch (_context18.prev = _context18.next) {
1354
1601
  case 0:
1355
- return _context14.abrupt('return', client.post('/application', mutations.removeApplication(id)));
1602
+ return _context18.abrupt('return', client.post('/application', mutations.removeApplication(id)));
1356
1603
 
1357
1604
  case 1:
1358
1605
  case 'end':
1359
- return _context14.stop();
1606
+ return _context18.stop();
1360
1607
  }
1361
1608
  }
1362
- }, _callee14, this);
1609
+ }, _callee18, this);
1363
1610
  }));
1364
1611
 
1365
- function removeApplication(_x29, _x30) {
1366
- return _ref15.apply(this, arguments);
1612
+ function removeApplication(_x35, _x36) {
1613
+ return _ref28.apply(this, arguments);
1367
1614
  }
1368
1615
 
1369
1616
  return removeApplication;
@@ -1371,23 +1618,23 @@ exports.default = {
1371
1618
 
1372
1619
  //
1373
1620
  removeProtection: function () {
1374
- var _ref16 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee15(client, id, appId, fragments) {
1375
- return regeneratorRuntime.wrap(function _callee15$(_context15) {
1621
+ var _ref29 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(client, id, appId, fragments) {
1622
+ return regeneratorRuntime.wrap(function _callee19$(_context19) {
1376
1623
  while (1) {
1377
- switch (_context15.prev = _context15.next) {
1624
+ switch (_context19.prev = _context19.next) {
1378
1625
  case 0:
1379
- return _context15.abrupt('return', client.post('/application', mutations.removeProtection(id, appId, fragments)));
1626
+ return _context19.abrupt('return', client.post('/application', mutations.removeProtection(id, appId, fragments)));
1380
1627
 
1381
1628
  case 1:
1382
1629
  case 'end':
1383
- return _context15.stop();
1630
+ return _context19.stop();
1384
1631
  }
1385
1632
  }
1386
- }, _callee15, this);
1633
+ }, _callee19, this);
1387
1634
  }));
1388
1635
 
1389
- function removeProtection(_x31, _x32, _x33, _x34) {
1390
- return _ref16.apply(this, arguments);
1636
+ function removeProtection(_x37, _x38, _x39, _x40) {
1637
+ return _ref29.apply(this, arguments);
1391
1638
  }
1392
1639
 
1393
1640
  return removeProtection;
@@ -1395,29 +1642,29 @@ exports.default = {
1395
1642
 
1396
1643
  //
1397
1644
  cancelProtection: function () {
1398
- var _ref17 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee16(client, id, appId, fragments) {
1645
+ var _ref30 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee20(client, id, appId, fragments) {
1399
1646
  var mutation;
1400
- return regeneratorRuntime.wrap(function _callee16$(_context16) {
1647
+ return regeneratorRuntime.wrap(function _callee20$(_context20) {
1401
1648
  while (1) {
1402
- switch (_context16.prev = _context16.next) {
1649
+ switch (_context20.prev = _context20.next) {
1403
1650
  case 0:
1404
- _context16.next = 2;
1651
+ _context20.next = 2;
1405
1652
  return mutations.cancelProtection(id, appId, fragments);
1406
1653
 
1407
1654
  case 2:
1408
- mutation = _context16.sent;
1409
- return _context16.abrupt('return', client.post('/application', mutation));
1655
+ mutation = _context20.sent;
1656
+ return _context20.abrupt('return', client.post('/application', mutation));
1410
1657
 
1411
1658
  case 4:
1412
1659
  case 'end':
1413
- return _context16.stop();
1660
+ return _context20.stop();
1414
1661
  }
1415
1662
  }
1416
- }, _callee16, this);
1663
+ }, _callee20, this);
1417
1664
  }));
1418
1665
 
1419
- function cancelProtection(_x35, _x36, _x37, _x38) {
1420
- return _ref17.apply(this, arguments);
1666
+ function cancelProtection(_x41, _x42, _x43, _x44) {
1667
+ return _ref30.apply(this, arguments);
1421
1668
  }
1422
1669
 
1423
1670
  return cancelProtection;
@@ -1425,29 +1672,29 @@ exports.default = {
1425
1672
 
1426
1673
  //
1427
1674
  updateApplication: function () {
1428
- var _ref18 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee17(client, application, fragments) {
1675
+ var _ref31 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee21(client, application, fragments) {
1429
1676
  var mutation;
1430
- return regeneratorRuntime.wrap(function _callee17$(_context17) {
1677
+ return regeneratorRuntime.wrap(function _callee21$(_context21) {
1431
1678
  while (1) {
1432
- switch (_context17.prev = _context17.next) {
1679
+ switch (_context21.prev = _context21.next) {
1433
1680
  case 0:
1434
- _context17.next = 2;
1681
+ _context21.next = 2;
1435
1682
  return mutations.updateApplication(application, fragments);
1436
1683
 
1437
1684
  case 2:
1438
- mutation = _context17.sent;
1439
- return _context17.abrupt('return', client.post('/application', mutation));
1685
+ mutation = _context21.sent;
1686
+ return _context21.abrupt('return', client.post('/application', mutation));
1440
1687
 
1441
1688
  case 4:
1442
1689
  case 'end':
1443
- return _context17.stop();
1690
+ return _context21.stop();
1444
1691
  }
1445
1692
  }
1446
- }, _callee17, this);
1693
+ }, _callee21, this);
1447
1694
  }));
1448
1695
 
1449
- function updateApplication(_x39, _x40, _x41) {
1450
- return _ref18.apply(this, arguments);
1696
+ function updateApplication(_x45, _x46, _x47) {
1697
+ return _ref31.apply(this, arguments);
1451
1698
  }
1452
1699
 
1453
1700
  return updateApplication;
@@ -1455,29 +1702,29 @@ exports.default = {
1455
1702
 
1456
1703
  //
1457
1704
  unlockApplication: function () {
1458
- var _ref19 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee18(client, application, fragments) {
1705
+ var _ref32 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee22(client, application, fragments) {
1459
1706
  var mutation;
1460
- return regeneratorRuntime.wrap(function _callee18$(_context18) {
1707
+ return regeneratorRuntime.wrap(function _callee22$(_context22) {
1461
1708
  while (1) {
1462
- switch (_context18.prev = _context18.next) {
1709
+ switch (_context22.prev = _context22.next) {
1463
1710
  case 0:
1464
- _context18.next = 2;
1711
+ _context22.next = 2;
1465
1712
  return mutations.unlockApplication(application, fragments);
1466
1713
 
1467
1714
  case 2:
1468
- mutation = _context18.sent;
1469
- return _context18.abrupt('return', client.post('/application', mutation));
1715
+ mutation = _context22.sent;
1716
+ return _context22.abrupt('return', client.post('/application', mutation));
1470
1717
 
1471
1718
  case 4:
1472
1719
  case 'end':
1473
- return _context18.stop();
1720
+ return _context22.stop();
1474
1721
  }
1475
1722
  }
1476
- }, _callee18, this);
1723
+ }, _callee22, this);
1477
1724
  }));
1478
1725
 
1479
- function unlockApplication(_x42, _x43, _x44) {
1480
- return _ref19.apply(this, arguments);
1726
+ function unlockApplication(_x48, _x49, _x50) {
1727
+ return _ref32.apply(this, arguments);
1481
1728
  }
1482
1729
 
1483
1730
  return unlockApplication;
@@ -1485,29 +1732,29 @@ exports.default = {
1485
1732
 
1486
1733
  //
1487
1734
  getApplication: function () {
1488
- var _ref20 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(client, applicationId, fragments, params) {
1735
+ var _ref33 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee23(client, applicationId, fragments, params) {
1489
1736
  var query;
1490
- return regeneratorRuntime.wrap(function _callee19$(_context19) {
1737
+ return regeneratorRuntime.wrap(function _callee23$(_context23) {
1491
1738
  while (1) {
1492
- switch (_context19.prev = _context19.next) {
1739
+ switch (_context23.prev = _context23.next) {
1493
1740
  case 0:
1494
- _context19.next = 2;
1741
+ _context23.next = 2;
1495
1742
  return queries.getApplication(applicationId, fragments, params);
1496
1743
 
1497
1744
  case 2:
1498
- query = _context19.sent;
1499
- return _context19.abrupt('return', client.get('/application', query));
1745
+ query = _context23.sent;
1746
+ return _context23.abrupt('return', client.get('/application', query));
1500
1747
 
1501
1748
  case 4:
1502
1749
  case 'end':
1503
- return _context19.stop();
1750
+ return _context23.stop();
1504
1751
  }
1505
1752
  }
1506
- }, _callee19, this);
1753
+ }, _callee23, this);
1507
1754
  }));
1508
1755
 
1509
- function getApplication(_x45, _x46, _x47, _x48) {
1510
- return _ref20.apply(this, arguments);
1756
+ function getApplication(_x51, _x52, _x53, _x54) {
1757
+ return _ref33.apply(this, arguments);
1511
1758
  }
1512
1759
 
1513
1760
  return getApplication;
@@ -1515,29 +1762,29 @@ exports.default = {
1515
1762
 
1516
1763
  //
1517
1764
  getApplicationSource: function () {
1518
- var _ref21 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee20(client, sourceId, fragments, limits) {
1765
+ var _ref34 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee24(client, sourceId, fragments, limits) {
1519
1766
  var query;
1520
- return regeneratorRuntime.wrap(function _callee20$(_context20) {
1767
+ return regeneratorRuntime.wrap(function _callee24$(_context24) {
1521
1768
  while (1) {
1522
- switch (_context20.prev = _context20.next) {
1769
+ switch (_context24.prev = _context24.next) {
1523
1770
  case 0:
1524
- _context20.next = 2;
1771
+ _context24.next = 2;
1525
1772
  return queries.getApplicationSource(sourceId, fragments, limits);
1526
1773
 
1527
1774
  case 2:
1528
- query = _context20.sent;
1529
- return _context20.abrupt('return', client.get('/application', query));
1775
+ query = _context24.sent;
1776
+ return _context24.abrupt('return', client.get('/application', query));
1530
1777
 
1531
1778
  case 4:
1532
1779
  case 'end':
1533
- return _context20.stop();
1780
+ return _context24.stop();
1534
1781
  }
1535
1782
  }
1536
- }, _callee20, this);
1783
+ }, _callee24, this);
1537
1784
  }));
1538
1785
 
1539
- function getApplicationSource(_x49, _x50, _x51, _x52) {
1540
- return _ref21.apply(this, arguments);
1786
+ function getApplicationSource(_x55, _x56, _x57, _x58) {
1787
+ return _ref34.apply(this, arguments);
1541
1788
  }
1542
1789
 
1543
1790
  return getApplicationSource;
@@ -1545,29 +1792,25 @@ exports.default = {
1545
1792
 
1546
1793
  //
1547
1794
  getApplicationProtections: function () {
1548
- var _ref22 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee21(client, applicationId, params, fragments) {
1795
+ var _ref35 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee25(client, applicationId, params, fragments, queryArgs) {
1549
1796
  var query;
1550
- return regeneratorRuntime.wrap(function _callee21$(_context21) {
1797
+ return regeneratorRuntime.wrap(function _callee25$(_context25) {
1551
1798
  while (1) {
1552
- switch (_context21.prev = _context21.next) {
1799
+ switch (_context25.prev = _context25.next) {
1553
1800
  case 0:
1554
- _context21.next = 2;
1555
- return queries.getApplicationProtections(applicationId, params, fragments);
1801
+ query = queries.getApplicationProtections(applicationId, params, fragments, queryArgs);
1802
+ return _context25.abrupt('return', client.get('/application', query));
1556
1803
 
1557
1804
  case 2:
1558
- query = _context21.sent;
1559
- return _context21.abrupt('return', client.get('/application', query));
1560
-
1561
- case 4:
1562
1805
  case 'end':
1563
- return _context21.stop();
1806
+ return _context25.stop();
1564
1807
  }
1565
1808
  }
1566
- }, _callee21, this);
1809
+ }, _callee25, this);
1567
1810
  }));
1568
1811
 
1569
- function getApplicationProtections(_x53, _x54, _x55, _x56) {
1570
- return _ref22.apply(this, arguments);
1812
+ function getApplicationProtections(_x59, _x60, _x61, _x62, _x63) {
1813
+ return _ref35.apply(this, arguments);
1571
1814
  }
1572
1815
 
1573
1816
  return getApplicationProtections;
@@ -1575,29 +1818,29 @@ exports.default = {
1575
1818
 
1576
1819
  //
1577
1820
  getApplicationProtectionsCount: function () {
1578
- var _ref23 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee22(client, applicationId, fragments) {
1821
+ var _ref36 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee26(client, applicationId, fragments) {
1579
1822
  var query;
1580
- return regeneratorRuntime.wrap(function _callee22$(_context22) {
1823
+ return regeneratorRuntime.wrap(function _callee26$(_context26) {
1581
1824
  while (1) {
1582
- switch (_context22.prev = _context22.next) {
1825
+ switch (_context26.prev = _context26.next) {
1583
1826
  case 0:
1584
- _context22.next = 2;
1827
+ _context26.next = 2;
1585
1828
  return queries.getApplicationProtectionsCount(applicationId, fragments);
1586
1829
 
1587
1830
  case 2:
1588
- query = _context22.sent;
1589
- return _context22.abrupt('return', client.get('/application', query));
1831
+ query = _context26.sent;
1832
+ return _context26.abrupt('return', client.get('/application', query));
1590
1833
 
1591
1834
  case 4:
1592
1835
  case 'end':
1593
- return _context22.stop();
1836
+ return _context26.stop();
1594
1837
  }
1595
1838
  }
1596
- }, _callee22, this);
1839
+ }, _callee26, this);
1597
1840
  }));
1598
1841
 
1599
- function getApplicationProtectionsCount(_x57, _x58, _x59) {
1600
- return _ref23.apply(this, arguments);
1842
+ function getApplicationProtectionsCount(_x64, _x65, _x66) {
1843
+ return _ref36.apply(this, arguments);
1601
1844
  }
1602
1845
 
1603
1846
  return getApplicationProtectionsCount;
@@ -1605,29 +1848,29 @@ exports.default = {
1605
1848
 
1606
1849
  //
1607
1850
  createTemplate: function () {
1608
- var _ref24 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee23(client, template, fragments) {
1851
+ var _ref37 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee27(client, template, fragments) {
1609
1852
  var mutation;
1610
- return regeneratorRuntime.wrap(function _callee23$(_context23) {
1853
+ return regeneratorRuntime.wrap(function _callee27$(_context27) {
1611
1854
  while (1) {
1612
- switch (_context23.prev = _context23.next) {
1855
+ switch (_context27.prev = _context27.next) {
1613
1856
  case 0:
1614
- _context23.next = 2;
1857
+ _context27.next = 2;
1615
1858
  return mutations.createTemplate(template, fragments);
1616
1859
 
1617
1860
  case 2:
1618
- mutation = _context23.sent;
1619
- return _context23.abrupt('return', client.post('/application', mutation));
1861
+ mutation = _context27.sent;
1862
+ return _context27.abrupt('return', client.post('/application', mutation));
1620
1863
 
1621
1864
  case 4:
1622
1865
  case 'end':
1623
- return _context23.stop();
1866
+ return _context27.stop();
1624
1867
  }
1625
1868
  }
1626
- }, _callee23, this);
1869
+ }, _callee27, this);
1627
1870
  }));
1628
1871
 
1629
- function createTemplate(_x60, _x61, _x62) {
1630
- return _ref24.apply(this, arguments);
1872
+ function createTemplate(_x67, _x68, _x69) {
1873
+ return _ref37.apply(this, arguments);
1631
1874
  }
1632
1875
 
1633
1876
  return createTemplate;
@@ -1635,29 +1878,29 @@ exports.default = {
1635
1878
 
1636
1879
  //
1637
1880
  removeTemplate: function () {
1638
- var _ref25 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee24(client, id) {
1881
+ var _ref38 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee28(client, id) {
1639
1882
  var mutation;
1640
- return regeneratorRuntime.wrap(function _callee24$(_context24) {
1883
+ return regeneratorRuntime.wrap(function _callee28$(_context28) {
1641
1884
  while (1) {
1642
- switch (_context24.prev = _context24.next) {
1885
+ switch (_context28.prev = _context28.next) {
1643
1886
  case 0:
1644
- _context24.next = 2;
1887
+ _context28.next = 2;
1645
1888
  return mutations.removeTemplate(id);
1646
1889
 
1647
1890
  case 2:
1648
- mutation = _context24.sent;
1649
- return _context24.abrupt('return', client.post('/application', mutation));
1891
+ mutation = _context28.sent;
1892
+ return _context28.abrupt('return', client.post('/application', mutation));
1650
1893
 
1651
1894
  case 4:
1652
1895
  case 'end':
1653
- return _context24.stop();
1896
+ return _context28.stop();
1654
1897
  }
1655
1898
  }
1656
- }, _callee24, this);
1899
+ }, _callee28, this);
1657
1900
  }));
1658
1901
 
1659
- function removeTemplate(_x63, _x64) {
1660
- return _ref25.apply(this, arguments);
1902
+ function removeTemplate(_x70, _x71) {
1903
+ return _ref38.apply(this, arguments);
1661
1904
  }
1662
1905
 
1663
1906
  return removeTemplate;
@@ -1665,29 +1908,29 @@ exports.default = {
1665
1908
 
1666
1909
  //
1667
1910
  getTemplates: function () {
1668
- var _ref26 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee25(client, fragments) {
1911
+ var _ref39 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee29(client, fragments) {
1669
1912
  var query;
1670
- return regeneratorRuntime.wrap(function _callee25$(_context25) {
1913
+ return regeneratorRuntime.wrap(function _callee29$(_context29) {
1671
1914
  while (1) {
1672
- switch (_context25.prev = _context25.next) {
1915
+ switch (_context29.prev = _context29.next) {
1673
1916
  case 0:
1674
- _context25.next = 2;
1917
+ _context29.next = 2;
1675
1918
  return queries.getTemplates(fragments);
1676
1919
 
1677
1920
  case 2:
1678
- query = _context25.sent;
1679
- return _context25.abrupt('return', client.get('/application', query));
1921
+ query = _context29.sent;
1922
+ return _context29.abrupt('return', client.get('/application', query));
1680
1923
 
1681
1924
  case 4:
1682
1925
  case 'end':
1683
- return _context25.stop();
1926
+ return _context29.stop();
1684
1927
  }
1685
1928
  }
1686
- }, _callee25, this);
1929
+ }, _callee29, this);
1687
1930
  }));
1688
1931
 
1689
- function getTemplates(_x65, _x66) {
1690
- return _ref26.apply(this, arguments);
1932
+ function getTemplates(_x72, _x73) {
1933
+ return _ref39.apply(this, arguments);
1691
1934
  }
1692
1935
 
1693
1936
  return getTemplates;
@@ -1695,29 +1938,29 @@ exports.default = {
1695
1938
 
1696
1939
  //
1697
1940
  getApplications: function () {
1698
- var _ref27 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee26(client, fragments, params) {
1941
+ var _ref40 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee30(client, fragments, params) {
1699
1942
  var query;
1700
- return regeneratorRuntime.wrap(function _callee26$(_context26) {
1943
+ return regeneratorRuntime.wrap(function _callee30$(_context30) {
1701
1944
  while (1) {
1702
- switch (_context26.prev = _context26.next) {
1945
+ switch (_context30.prev = _context30.next) {
1703
1946
  case 0:
1704
- _context26.next = 2;
1947
+ _context30.next = 2;
1705
1948
  return queries.getApplications(fragments, params);
1706
1949
 
1707
1950
  case 2:
1708
- query = _context26.sent;
1709
- return _context26.abrupt('return', client.get('/application', query));
1951
+ query = _context30.sent;
1952
+ return _context30.abrupt('return', client.get('/application', query));
1710
1953
 
1711
1954
  case 4:
1712
1955
  case 'end':
1713
- return _context26.stop();
1956
+ return _context30.stop();
1714
1957
  }
1715
1958
  }
1716
- }, _callee26, this);
1959
+ }, _callee30, this);
1717
1960
  }));
1718
1961
 
1719
- function getApplications(_x67, _x68, _x69) {
1720
- return _ref27.apply(this, arguments);
1962
+ function getApplications(_x74, _x75, _x76) {
1963
+ return _ref40.apply(this, arguments);
1721
1964
  }
1722
1965
 
1723
1966
  return getApplications;
@@ -1725,31 +1968,31 @@ exports.default = {
1725
1968
 
1726
1969
  //
1727
1970
  addApplicationSource: function () {
1728
- var _ref28 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee27(client, applicationId, applicationSource, fragments) {
1971
+ var _ref41 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee31(client, applicationId, applicationSource, fragments) {
1729
1972
  var mutation;
1730
- return regeneratorRuntime.wrap(function _callee27$(_context27) {
1973
+ return regeneratorRuntime.wrap(function _callee31$(_context31) {
1731
1974
  while (1) {
1732
- switch (_context27.prev = _context27.next) {
1975
+ switch (_context31.prev = _context31.next) {
1733
1976
  case 0:
1734
- _context27.next = 2;
1977
+ _context31.next = 2;
1735
1978
  return mutations.addApplicationSource(applicationId, applicationSource, fragments);
1736
1979
 
1737
1980
  case 2:
1738
- mutation = _context27.sent;
1739
- return _context27.abrupt('return', this.withRetries(function () {
1981
+ mutation = _context31.sent;
1982
+ return _context31.abrupt('return', this.withRetries(function () {
1740
1983
  return client.post('/application', mutation);
1741
1984
  }));
1742
1985
 
1743
1986
  case 4:
1744
1987
  case 'end':
1745
- return _context27.stop();
1988
+ return _context31.stop();
1746
1989
  }
1747
1990
  }
1748
- }, _callee27, this);
1991
+ }, _callee31, this);
1749
1992
  }));
1750
1993
 
1751
- function addApplicationSource(_x70, _x71, _x72, _x73) {
1752
- return _ref28.apply(this, arguments);
1994
+ function addApplicationSource(_x77, _x78, _x79, _x80) {
1995
+ return _ref41.apply(this, arguments);
1753
1996
  }
1754
1997
 
1755
1998
  return addApplicationSource;
@@ -1757,34 +2000,34 @@ exports.default = {
1757
2000
 
1758
2001
  //
1759
2002
  addApplicationSourceFromURL: function () {
1760
- var _ref29 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee28(client, applicationId, url, fragments) {
2003
+ var _ref42 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee32(client, applicationId, url, fragments) {
1761
2004
  var file, mutation;
1762
- return regeneratorRuntime.wrap(function _callee28$(_context28) {
2005
+ return regeneratorRuntime.wrap(function _callee32$(_context32) {
1763
2006
  while (1) {
1764
- switch (_context28.prev = _context28.next) {
2007
+ switch (_context32.prev = _context32.next) {
1765
2008
  case 0:
1766
- _context28.next = 2;
2009
+ _context32.next = 2;
1767
2010
  return getFileFromUrl(client, url);
1768
2011
 
1769
2012
  case 2:
1770
- file = _context28.sent;
1771
- _context28.next = 5;
2013
+ file = _context32.sent;
2014
+ _context32.next = 5;
1772
2015
  return mutations.addApplicationSource(applicationId, file, fragments);
1773
2016
 
1774
2017
  case 5:
1775
- mutation = _context28.sent;
1776
- return _context28.abrupt('return', client.post('/application', mutation));
2018
+ mutation = _context32.sent;
2019
+ return _context32.abrupt('return', client.post('/application', mutation));
1777
2020
 
1778
2021
  case 7:
1779
2022
  case 'end':
1780
- return _context28.stop();
2023
+ return _context32.stop();
1781
2024
  }
1782
2025
  }
1783
- }, _callee28, this);
2026
+ }, _callee32, this);
1784
2027
  }));
1785
2028
 
1786
- function addApplicationSourceFromURL(_x74, _x75, _x76, _x77) {
1787
- return _ref29.apply(this, arguments);
2029
+ function addApplicationSourceFromURL(_x81, _x82, _x83, _x84) {
2030
+ return _ref42.apply(this, arguments);
1788
2031
  }
1789
2032
 
1790
2033
  return addApplicationSourceFromURL;
@@ -1792,29 +2035,29 @@ exports.default = {
1792
2035
 
1793
2036
  //
1794
2037
  updateApplicationSource: function () {
1795
- var _ref30 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee29(client, applicationSource, fragments) {
2038
+ var _ref43 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee33(client, applicationSource, fragments) {
1796
2039
  var mutation;
1797
- return regeneratorRuntime.wrap(function _callee29$(_context29) {
2040
+ return regeneratorRuntime.wrap(function _callee33$(_context33) {
1798
2041
  while (1) {
1799
- switch (_context29.prev = _context29.next) {
2042
+ switch (_context33.prev = _context33.next) {
1800
2043
  case 0:
1801
- _context29.next = 2;
2044
+ _context33.next = 2;
1802
2045
  return mutations.updateApplicationSource(applicationSource, fragments);
1803
2046
 
1804
2047
  case 2:
1805
- mutation = _context29.sent;
1806
- return _context29.abrupt('return', client.post('/application', mutation));
2048
+ mutation = _context33.sent;
2049
+ return _context33.abrupt('return', client.post('/application', mutation));
1807
2050
 
1808
2051
  case 4:
1809
2052
  case 'end':
1810
- return _context29.stop();
2053
+ return _context33.stop();
1811
2054
  }
1812
2055
  }
1813
- }, _callee29, this);
2056
+ }, _callee33, this);
1814
2057
  }));
1815
2058
 
1816
- function updateApplicationSource(_x78, _x79, _x80) {
1817
- return _ref30.apply(this, arguments);
2059
+ function updateApplicationSource(_x85, _x86, _x87) {
2060
+ return _ref43.apply(this, arguments);
1818
2061
  }
1819
2062
 
1820
2063
  return updateApplicationSource;
@@ -1822,31 +2065,31 @@ exports.default = {
1822
2065
 
1823
2066
  //
1824
2067
  removeSourceFromApplication: function () {
1825
- var _ref31 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee30(client, sourceId, applicationId, fragments) {
2068
+ var _ref44 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee34(client, sourceId, applicationId, fragments) {
1826
2069
  var mutation;
1827
- return regeneratorRuntime.wrap(function _callee30$(_context30) {
2070
+ return regeneratorRuntime.wrap(function _callee34$(_context34) {
1828
2071
  while (1) {
1829
- switch (_context30.prev = _context30.next) {
2072
+ switch (_context34.prev = _context34.next) {
1830
2073
  case 0:
1831
- _context30.next = 2;
2074
+ _context34.next = 2;
1832
2075
  return mutations.removeSourceFromApplication(sourceId, applicationId, fragments);
1833
2076
 
1834
2077
  case 2:
1835
- mutation = _context30.sent;
1836
- return _context30.abrupt('return', this.withRetries(function () {
2078
+ mutation = _context34.sent;
2079
+ return _context34.abrupt('return', this.withRetries(function () {
1837
2080
  return client.post('/application', mutation);
1838
2081
  }));
1839
2082
 
1840
2083
  case 4:
1841
2084
  case 'end':
1842
- return _context30.stop();
2085
+ return _context34.stop();
1843
2086
  }
1844
2087
  }
1845
- }, _callee30, this);
2088
+ }, _callee34, this);
1846
2089
  }));
1847
2090
 
1848
- function removeSourceFromApplication(_x81, _x82, _x83, _x84) {
1849
- return _ref31.apply(this, arguments);
2091
+ function removeSourceFromApplication(_x88, _x89, _x90, _x91) {
2092
+ return _ref44.apply(this, arguments);
1850
2093
  }
1851
2094
 
1852
2095
  return removeSourceFromApplication;
@@ -1854,29 +2097,29 @@ exports.default = {
1854
2097
 
1855
2098
  //
1856
2099
  applyTemplate: function () {
1857
- var _ref32 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee31(client, templateId, appId, fragments) {
2100
+ var _ref45 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee35(client, templateId, appId, fragments) {
1858
2101
  var mutation;
1859
- return regeneratorRuntime.wrap(function _callee31$(_context31) {
2102
+ return regeneratorRuntime.wrap(function _callee35$(_context35) {
1860
2103
  while (1) {
1861
- switch (_context31.prev = _context31.next) {
2104
+ switch (_context35.prev = _context35.next) {
1862
2105
  case 0:
1863
- _context31.next = 2;
2106
+ _context35.next = 2;
1864
2107
  return mutations.applyTemplate(templateId, appId, fragments);
1865
2108
 
1866
2109
  case 2:
1867
- mutation = _context31.sent;
1868
- return _context31.abrupt('return', client.post('/application', mutation));
2110
+ mutation = _context35.sent;
2111
+ return _context35.abrupt('return', client.post('/application', mutation));
1869
2112
 
1870
2113
  case 4:
1871
2114
  case 'end':
1872
- return _context31.stop();
2115
+ return _context35.stop();
1873
2116
  }
1874
2117
  }
1875
- }, _callee31, this);
2118
+ }, _callee35, this);
1876
2119
  }));
1877
2120
 
1878
- function applyTemplate(_x85, _x86, _x87, _x88) {
1879
- return _ref32.apply(this, arguments);
2121
+ function applyTemplate(_x92, _x93, _x94, _x95) {
2122
+ return _ref45.apply(this, arguments);
1880
2123
  }
1881
2124
 
1882
2125
  return applyTemplate;
@@ -1884,75 +2127,75 @@ exports.default = {
1884
2127
 
1885
2128
  //
1886
2129
  updateTemplate: function () {
1887
- var _ref33 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee32(client, template, fragments) {
2130
+ var _ref46 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee36(client, template, fragments) {
1888
2131
  var mutation;
1889
- return regeneratorRuntime.wrap(function _callee32$(_context32) {
2132
+ return regeneratorRuntime.wrap(function _callee36$(_context36) {
1890
2133
  while (1) {
1891
- switch (_context32.prev = _context32.next) {
2134
+ switch (_context36.prev = _context36.next) {
1892
2135
  case 0:
1893
- _context32.next = 2;
2136
+ _context36.next = 2;
1894
2137
  return mutations.updateTemplate(template, fragments);
1895
2138
 
1896
2139
  case 2:
1897
- mutation = _context32.sent;
1898
- return _context32.abrupt('return', client.post('/application', mutation));
2140
+ mutation = _context36.sent;
2141
+ return _context36.abrupt('return', client.post('/application', mutation));
1899
2142
 
1900
2143
  case 4:
1901
2144
  case 'end':
1902
- return _context32.stop();
2145
+ return _context36.stop();
1903
2146
  }
1904
2147
  }
1905
- }, _callee32, this);
2148
+ }, _callee36, this);
1906
2149
  }));
1907
2150
 
1908
- function updateTemplate(_x89, _x90, _x91) {
1909
- return _ref33.apply(this, arguments);
2151
+ function updateTemplate(_x96, _x97, _x98) {
2152
+ return _ref46.apply(this, arguments);
1910
2153
  }
1911
2154
 
1912
2155
  return updateTemplate;
1913
2156
  }(),
1914
2157
  getApplicationProfiling: function () {
1915
- var _ref34 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee33(client, applicationId) {
1916
- return regeneratorRuntime.wrap(function _callee33$(_context33) {
2158
+ var _ref47 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee37(client, applicationId) {
2159
+ return regeneratorRuntime.wrap(function _callee37$(_context37) {
1917
2160
  while (1) {
1918
- switch (_context33.prev = _context33.next) {
2161
+ switch (_context37.prev = _context37.next) {
1919
2162
  case 0:
1920
- return _context33.abrupt('return', client.get('/profiling-run', { applicationId: applicationId }));
2163
+ return _context37.abrupt('return', client.get('/profiling-run', { applicationId: applicationId }));
1921
2164
 
1922
2165
  case 1:
1923
2166
  case 'end':
1924
- return _context33.stop();
2167
+ return _context37.stop();
1925
2168
  }
1926
2169
  }
1927
- }, _callee33, this);
2170
+ }, _callee37, this);
1928
2171
  }));
1929
2172
 
1930
- function getApplicationProfiling(_x92, _x93) {
1931
- return _ref34.apply(this, arguments);
2173
+ function getApplicationProfiling(_x99, _x100) {
2174
+ return _ref47.apply(this, arguments);
1932
2175
  }
1933
2176
 
1934
2177
  return getApplicationProfiling;
1935
2178
  }(),
1936
2179
  deleteProfiling: function () {
1937
- var _ref35 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee34(client, profilingId) {
1938
- return regeneratorRuntime.wrap(function _callee34$(_context34) {
2180
+ var _ref48 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee38(client, profilingId) {
2181
+ return regeneratorRuntime.wrap(function _callee38$(_context38) {
1939
2182
  while (1) {
1940
- switch (_context34.prev = _context34.next) {
2183
+ switch (_context38.prev = _context38.next) {
1941
2184
  case 0:
1942
- return _context34.abrupt('return', client.patch('/profiling-run/' + profilingId, {
2185
+ return _context38.abrupt('return', client.patch('/profiling-run/' + profilingId, {
1943
2186
  state: 'DELETED'
1944
2187
  }));
1945
2188
 
1946
2189
  case 1:
1947
2190
  case 'end':
1948
- return _context34.stop();
2191
+ return _context38.stop();
1949
2192
  }
1950
2193
  }
1951
- }, _callee34, this);
2194
+ }, _callee38, this);
1952
2195
  }));
1953
2196
 
1954
- function deleteProfiling(_x94, _x95) {
1955
- return _ref35.apply(this, arguments);
2197
+ function deleteProfiling(_x101, _x102) {
2198
+ return _ref48.apply(this, arguments);
1956
2199
  }
1957
2200
 
1958
2201
  return deleteProfiling;
@@ -1966,41 +2209,41 @@ exports.default = {
1966
2209
  * @returns {Promise<*>}
1967
2210
  */
1968
2211
  startInstrumentation: function () {
1969
- var _ref36 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee35(client, applicationId) {
2212
+ var _ref49 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee39(client, applicationId) {
1970
2213
  var instrumentation;
1971
- return regeneratorRuntime.wrap(function _callee35$(_context35) {
2214
+ return regeneratorRuntime.wrap(function _callee39$(_context39) {
1972
2215
  while (1) {
1973
- switch (_context35.prev = _context35.next) {
2216
+ switch (_context39.prev = _context39.next) {
1974
2217
  case 0:
1975
- _context35.next = 2;
2218
+ _context39.next = 2;
1976
2219
  return this.getApplicationProfiling(client, applicationId).catch(function (e) {
1977
2220
  if (e.statusCode !== 404) throw e;
1978
2221
  });
1979
2222
 
1980
2223
  case 2:
1981
- instrumentation = _context35.sent;
2224
+ instrumentation = _context39.sent;
1982
2225
 
1983
2226
  if (!instrumentation) {
1984
- _context35.next = 6;
2227
+ _context39.next = 6;
1985
2228
  break;
1986
2229
  }
1987
2230
 
1988
- _context35.next = 6;
2231
+ _context39.next = 6;
1989
2232
  return this.deleteProfiling(client, instrumentation.data.id);
1990
2233
 
1991
2234
  case 6:
1992
- return _context35.abrupt('return', client.post('/profiling-run', { applicationId: applicationId }));
2235
+ return _context39.abrupt('return', client.post('/profiling-run', { applicationId: applicationId }));
1993
2236
 
1994
2237
  case 7:
1995
2238
  case 'end':
1996
- return _context35.stop();
2239
+ return _context39.stop();
1997
2240
  }
1998
2241
  }
1999
- }, _callee35, this);
2242
+ }, _callee39, this);
2000
2243
  }));
2001
2244
 
2002
- function startInstrumentation(_x96, _x97) {
2003
- return _ref36.apply(this, arguments);
2245
+ function startInstrumentation(_x103, _x104) {
2246
+ return _ref49.apply(this, arguments);
2004
2247
  }
2005
2248
 
2006
2249
  return startInstrumentation;
@@ -2008,64 +2251,147 @@ exports.default = {
2008
2251
 
2009
2252
  //
2010
2253
  createApplicationProtection: function () {
2011
- var _ref37 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee36(client, applicationId, protectionOptions, fragments) {
2012
- var _ref38, args, mutation;
2254
+ var _ref50 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee40(client, applicationId, protectionOptions, fragments) {
2255
+ var _ref51, args, mutation;
2013
2256
 
2014
- return regeneratorRuntime.wrap(function _callee36$(_context36) {
2257
+ return regeneratorRuntime.wrap(function _callee40$(_context40) {
2015
2258
  while (1) {
2016
- switch (_context36.prev = _context36.next) {
2259
+ switch (_context40.prev = _context40.next) {
2017
2260
  case 0:
2018
- _context36.next = 2;
2261
+ _context40.next = 2;
2019
2262
  return introspection.mutation(client, 'createApplicationProtection');
2020
2263
 
2021
2264
  case 2:
2022
- _ref38 = _context36.sent;
2023
- args = _ref38.args;
2024
- _context36.next = 6;
2265
+ _ref51 = _context40.sent;
2266
+ args = _ref51.args;
2267
+ _context40.next = 6;
2025
2268
  return mutations.createApplicationProtection(applicationId, fragments, protectionOptions, args);
2026
2269
 
2027
2270
  case 6:
2028
- mutation = _context36.sent;
2029
- return _context36.abrupt('return', client.post('/application', mutation));
2271
+ mutation = _context40.sent;
2272
+ return _context40.abrupt('return', client.post('/application', mutation));
2030
2273
 
2031
2274
  case 8:
2032
2275
  case 'end':
2033
- return _context36.stop();
2276
+ return _context40.stop();
2034
2277
  }
2035
2278
  }
2036
- }, _callee36, this);
2279
+ }, _callee40, this);
2037
2280
  }));
2038
2281
 
2039
- function createApplicationProtection(_x98, _x99, _x100, _x101) {
2040
- return _ref37.apply(this, arguments);
2282
+ function createApplicationProtection(_x105, _x106, _x107, _x108) {
2283
+ return _ref50.apply(this, arguments);
2041
2284
  }
2042
2285
 
2043
2286
  return createApplicationProtection;
2044
2287
  }(),
2045
2288
 
2289
+ /**
2290
+ * Create one or more application protections at once
2291
+ * @param {JscramblerClient} client
2292
+ * @param {string} applicationId
2293
+ * @param {object} protectionOptions
2294
+ * @param {number} [protectionOptions.numberOfProtections]
2295
+ * @param {object} fragments
2296
+ * @returns {Promise<{data: {protections: Array.<{_id}>}, errors: Array}>}
2297
+ */
2298
+ createApplicationProtections: function () {
2299
+ var _ref52 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee41(client, applicationId, protectionOptions, fragments) {
2300
+ var result, mutationType, mutation;
2301
+ return regeneratorRuntime.wrap(function _callee41$(_context41) {
2302
+ while (1) {
2303
+ switch (_context41.prev = _context41.next) {
2304
+ case 0:
2305
+ result = void 0;
2306
+
2307
+ if (!(!protectionOptions.numberOfProtections || protectionOptions.numberOfProtections < 2)) {
2308
+ _context41.next = 8;
2309
+ break;
2310
+ }
2311
+
2312
+ _context41.next = 4;
2313
+ return this.createApplicationProtection(client, applicationId, protectionOptions, fragments);
2314
+
2315
+ case 4:
2316
+ result = _context41.sent;
2317
+
2318
+ if (result.data && result.data.createApplicationProtection) {
2319
+ result.data.protections = [result.data.createApplicationProtection];
2320
+ delete result.data.createApplicationProtection;
2321
+ }
2322
+ _context41.next = 19;
2323
+ break;
2324
+
2325
+ case 8:
2326
+ _context41.next = 10;
2327
+ return introspection.mutation(client, 'createApplicationProtections');
2328
+
2329
+ case 10:
2330
+ mutationType = _context41.sent;
2331
+
2332
+
2333
+ if (!mutationType) {
2334
+ console.error('"Create multiple protections at once" it\'s only available on Jscrambler version 7.2 and above.');
2335
+ process.exit(1);
2336
+ }
2337
+
2338
+ _context41.next = 14;
2339
+ return mutations.createApplicationProtections(applicationId, fragments, protectionOptions, mutationType.args);
2340
+
2341
+ case 14:
2342
+ mutation = _context41.sent;
2343
+ _context41.next = 17;
2344
+ return client.post('/application', mutation);
2345
+
2346
+ case 17:
2347
+ result = _context41.sent;
2348
+
2349
+ if (result.data && result.data.createApplicationProtections) {
2350
+ result.data.protections = result.data.createApplicationProtections.protections;
2351
+ delete result.data.createApplicationProtections;
2352
+ }
2353
+
2354
+ case 19:
2355
+ return _context41.abrupt('return', result);
2356
+
2357
+ case 20:
2358
+ case 'end':
2359
+ return _context41.stop();
2360
+ }
2361
+ }
2362
+ }, _callee41, this);
2363
+ }));
2364
+
2365
+ function createApplicationProtections(_x109, _x110, _x111, _x112) {
2366
+ return _ref52.apply(this, arguments);
2367
+ }
2368
+
2369
+ return createApplicationProtections;
2370
+ }(),
2371
+
2046
2372
  /**
2047
2373
  * @param {object} client
2048
2374
  * @param {string} instrumentationId
2049
2375
  * @returns {Promise<object>}
2050
2376
  */
2051
2377
  getInstrumentation: function () {
2052
- var _ref39 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee37(client, instrumentationId) {
2053
- return regeneratorRuntime.wrap(function _callee37$(_context37) {
2378
+ var _ref53 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee42(client, instrumentationId) {
2379
+ return regeneratorRuntime.wrap(function _callee42$(_context42) {
2054
2380
  while (1) {
2055
- switch (_context37.prev = _context37.next) {
2381
+ switch (_context42.prev = _context42.next) {
2056
2382
  case 0:
2057
- return _context37.abrupt('return', client.get('/profiling-run/' + instrumentationId));
2383
+ return _context42.abrupt('return', client.get('/profiling-run/' + instrumentationId));
2058
2384
 
2059
2385
  case 1:
2060
2386
  case 'end':
2061
- return _context37.stop();
2387
+ return _context42.stop();
2062
2388
  }
2063
2389
  }
2064
- }, _callee37, this);
2390
+ }, _callee42, this);
2065
2391
  }));
2066
2392
 
2067
- function getInstrumentation(_x102, _x103) {
2068
- return _ref39.apply(this, arguments);
2393
+ function getInstrumentation(_x113, _x114) {
2394
+ return _ref53.apply(this, arguments);
2069
2395
  }
2070
2396
 
2071
2397
  return getInstrumentation;
@@ -2073,29 +2399,29 @@ exports.default = {
2073
2399
 
2074
2400
  //
2075
2401
  getApplicationProtection: function () {
2076
- var _ref40 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee38(client, applicationId, protectionId, fragments) {
2402
+ var _ref54 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee43(client, applicationId, protectionId, fragments) {
2077
2403
  var query;
2078
- return regeneratorRuntime.wrap(function _callee38$(_context38) {
2404
+ return regeneratorRuntime.wrap(function _callee43$(_context43) {
2079
2405
  while (1) {
2080
- switch (_context38.prev = _context38.next) {
2406
+ switch (_context43.prev = _context43.next) {
2081
2407
  case 0:
2082
- _context38.next = 2;
2408
+ _context43.next = 2;
2083
2409
  return queries.getProtection(applicationId, protectionId, fragments);
2084
2410
 
2085
2411
  case 2:
2086
- query = _context38.sent;
2087
- return _context38.abrupt('return', client.get('/application', query));
2412
+ query = _context43.sent;
2413
+ return _context43.abrupt('return', client.get('/application', query));
2088
2414
 
2089
2415
  case 4:
2090
2416
  case 'end':
2091
- return _context38.stop();
2417
+ return _context43.stop();
2092
2418
  }
2093
2419
  }
2094
- }, _callee38, this);
2420
+ }, _callee43, this);
2095
2421
  }));
2096
2422
 
2097
- function getApplicationProtection(_x104, _x105, _x106, _x107) {
2098
- return _ref40.apply(this, arguments);
2423
+ function getApplicationProtection(_x115, _x116, _x117, _x118) {
2424
+ return _ref54.apply(this, arguments);
2099
2425
  }
2100
2426
 
2101
2427
  return getApplicationProtection;
@@ -2103,45 +2429,45 @@ exports.default = {
2103
2429
 
2104
2430
  //
2105
2431
  downloadSourceMapsRequest: function () {
2106
- var _ref41 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee39(client, protectionId) {
2107
- return regeneratorRuntime.wrap(function _callee39$(_context39) {
2432
+ var _ref55 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee44(client, protectionId) {
2433
+ return regeneratorRuntime.wrap(function _callee44$(_context44) {
2108
2434
  while (1) {
2109
- switch (_context39.prev = _context39.next) {
2435
+ switch (_context44.prev = _context44.next) {
2110
2436
  case 0:
2111
- return _context39.abrupt('return', client.get('/application/sourceMaps/' + protectionId, null, false));
2437
+ return _context44.abrupt('return', client.get('/application/sourceMaps/' + protectionId, null, false));
2112
2438
 
2113
2439
  case 1:
2114
2440
  case 'end':
2115
- return _context39.stop();
2441
+ return _context44.stop();
2116
2442
  }
2117
2443
  }
2118
- }, _callee39, this);
2444
+ }, _callee44, this);
2119
2445
  }));
2120
2446
 
2121
- function downloadSourceMapsRequest(_x108, _x109) {
2122
- return _ref41.apply(this, arguments);
2447
+ function downloadSourceMapsRequest(_x119, _x120) {
2448
+ return _ref55.apply(this, arguments);
2123
2449
  }
2124
2450
 
2125
2451
  return downloadSourceMapsRequest;
2126
2452
  }(),
2127
2453
  downloadSymbolTableRequest: function () {
2128
- var _ref42 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee40(client, protectionId) {
2129
- return regeneratorRuntime.wrap(function _callee40$(_context40) {
2454
+ var _ref56 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee45(client, protectionId) {
2455
+ return regeneratorRuntime.wrap(function _callee45$(_context45) {
2130
2456
  while (1) {
2131
- switch (_context40.prev = _context40.next) {
2457
+ switch (_context45.prev = _context45.next) {
2132
2458
  case 0:
2133
- return _context40.abrupt('return', client.get('/application/symbolTable/' + protectionId, null, false));
2459
+ return _context45.abrupt('return', client.get('/application/symbolTable/' + protectionId, null, false));
2134
2460
 
2135
2461
  case 1:
2136
2462
  case 'end':
2137
- return _context40.stop();
2463
+ return _context45.stop();
2138
2464
  }
2139
2465
  }
2140
- }, _callee40, this);
2466
+ }, _callee45, this);
2141
2467
  }));
2142
2468
 
2143
- function downloadSymbolTableRequest(_x110, _x111) {
2144
- return _ref42.apply(this, arguments);
2469
+ function downloadSymbolTableRequest(_x121, _x122) {
2470
+ return _ref56.apply(this, arguments);
2145
2471
  }
2146
2472
 
2147
2473
  return downloadSymbolTableRequest;
@@ -2149,23 +2475,23 @@ exports.default = {
2149
2475
 
2150
2476
  //
2151
2477
  downloadApplicationProtection: function () {
2152
- var _ref43 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee41(client, protectionId) {
2153
- return regeneratorRuntime.wrap(function _callee41$(_context41) {
2478
+ var _ref57 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee46(client, protectionId) {
2479
+ return regeneratorRuntime.wrap(function _callee46$(_context46) {
2154
2480
  while (1) {
2155
- switch (_context41.prev = _context41.next) {
2481
+ switch (_context46.prev = _context46.next) {
2156
2482
  case 0:
2157
- return _context41.abrupt('return', client.get('/application/download/' + protectionId, null, false));
2483
+ return _context46.abrupt('return', client.get('/application/download/' + protectionId, null, false));
2158
2484
 
2159
2485
  case 1:
2160
2486
  case 'end':
2161
- return _context41.stop();
2487
+ return _context46.stop();
2162
2488
  }
2163
2489
  }
2164
- }, _callee41, this);
2490
+ }, _callee46, this);
2165
2491
  }));
2166
2492
 
2167
- function downloadApplicationProtection(_x112, _x113) {
2168
- return _ref43.apply(this, arguments);
2493
+ function downloadApplicationProtection(_x123, _x124) {
2494
+ return _ref57.apply(this, arguments);
2169
2495
  }
2170
2496
 
2171
2497
  return downloadApplicationProtection;
@@ -2189,27 +2515,27 @@ exports.default = {
2189
2515
  * @returns {Boolean} true if the field is supported, false otherwise
2190
2516
  */
2191
2517
  introspectFieldOnMethod: function () {
2192
- var _ref44 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee42(config, queryOrMutation, methodName, field) {
2518
+ var _ref58 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee47(config, queryOrMutation, methodName, field) {
2193
2519
  var instrospectionType, client, result, dataArg, isFieldSupported;
2194
- return regeneratorRuntime.wrap(function _callee42$(_context42) {
2520
+ return regeneratorRuntime.wrap(function _callee47$(_context47) {
2195
2521
  while (1) {
2196
- switch (_context42.prev = _context42.next) {
2522
+ switch (_context47.prev = _context47.next) {
2197
2523
  case 0:
2198
2524
  instrospectionType = queryOrMutation.toLowerCase() === 'mutation' ? introspection.mutation : introspection.query;
2199
2525
  client = new this.Client(Object.assign({}, config));
2200
- _context42.next = 4;
2526
+ _context47.next = 4;
2201
2527
  return instrospectionType(client, methodName);
2202
2528
 
2203
2529
  case 4:
2204
- result = _context42.sent;
2530
+ result = _context47.sent;
2205
2531
 
2206
2532
  if (!(!result || !result.args)) {
2207
- _context42.next = 8;
2533
+ _context47.next = 8;
2208
2534
  break;
2209
2535
  }
2210
2536
 
2211
2537
  debug && console.log('Method *' + methodName + '* not found.');
2212
- return _context42.abrupt('return', false);
2538
+ return _context47.abrupt('return', false);
2213
2539
 
2214
2540
  case 8:
2215
2541
  dataArg = result.args.find(function (arg) {
@@ -2218,18 +2544,18 @@ exports.default = {
2218
2544
  isFieldSupported = dataArg && dataArg.type.inputFields.some(function (e) {
2219
2545
  return e.name === field;
2220
2546
  });
2221
- return _context42.abrupt('return', isFieldSupported);
2547
+ return _context47.abrupt('return', isFieldSupported);
2222
2548
 
2223
2549
  case 11:
2224
2550
  case 'end':
2225
- return _context42.stop();
2551
+ return _context47.stop();
2226
2552
  }
2227
2553
  }
2228
- }, _callee42, this);
2554
+ }, _callee47, this);
2229
2555
  }));
2230
2556
 
2231
- function introspectFieldOnMethod(_x114, _x115, _x116, _x117) {
2232
- return _ref44.apply(this, arguments);
2557
+ function introspectFieldOnMethod(_x125, _x126, _x127, _x128) {
2558
+ return _ref58.apply(this, arguments);
2233
2559
  }
2234
2560
 
2235
2561
  return introspectFieldOnMethod;