jscrambler 6.1.5 → 6.1.6

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.
Files changed (2) hide show
  1. package/dist/index.js +70 -82
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -49,22 +49,14 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableTo
49
49
 
50
50
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
51
51
 
52
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
53
+
52
54
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
53
55
 
54
56
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
55
57
 
56
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
57
-
58
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
59
-
60
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
61
-
62
58
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
63
59
 
64
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
65
-
66
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
67
-
68
60
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
69
61
 
70
62
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -165,33 +157,37 @@ var _default = {
165
157
  var _this = this;
166
158
 
167
159
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
168
- var sources, filesSrc, cwd, appProfiling, promise, zipped, source, _filesSrc, i, l, content;
160
+ var sources, filesSrc, cwd, appProfiling, removeSourceRes, zipped, source, _filesSrc, i, l, content;
169
161
 
170
162
  return regeneratorRuntime.wrap(function _callee$(_context) {
171
163
  while (1) {
172
164
  switch (_context.prev = _context.next) {
173
165
  case 0:
174
166
  sources = _ref.sources, filesSrc = _ref.filesSrc, cwd = _ref.cwd, appProfiling = _ref.appProfiling;
175
- promise = Promise.resolve();
176
167
 
177
168
  if (!(sources || filesSrc && filesSrc.length)) {
178
- _context.next = 6;
169
+ _context.next = 8;
179
170
  break;
180
171
  }
181
172
 
182
173
  if (!(appProfiling && appProfiling.data && appProfiling.data.state === 'READY')) {
183
- _context.next = 5;
174
+ _context.next = 4;
184
175
  break;
185
176
  }
186
177
 
187
178
  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*.');
188
179
 
189
- case 5:
190
- promise = _this.removeSourceFromApplication(client, '', applicationId);
180
+ case 4:
181
+ _context.next = 6;
182
+ return _this.removeSourceFromApplication(client, '', applicationId);
191
183
 
192
184
  case 6:
185
+ removeSourceRes = _context.sent;
186
+ errorHandler(removeSourceRes);
187
+
188
+ case 8:
193
189
  if (!(filesSrc && filesSrc.length)) {
194
- _context.next = 15;
190
+ _context.next = 17;
195
191
  break;
196
192
  }
197
193
 
@@ -209,17 +205,17 @@ var _default = {
209
205
  console.log('Creating zip from source files');
210
206
  }
211
207
 
212
- _context.next = 12;
208
+ _context.next = 14;
213
209
  return (0, _zip.zip)(_filesSrc, cwd);
214
210
 
215
- case 12:
211
+ case 14:
216
212
  zipped = _context.sent;
217
- _context.next = 20;
213
+ _context.next = 22;
218
214
  break;
219
215
 
220
- case 15:
216
+ case 17:
221
217
  if (!sources) {
222
- _context.next = 20;
218
+ _context.next = 22;
223
219
  break;
224
220
  }
225
221
 
@@ -227,19 +223,19 @@ var _default = {
227
223
  console.log('Creating zip from sources');
228
224
  }
229
225
 
230
- _context.next = 19;
226
+ _context.next = 21;
231
227
  return (0, _zip.zipSources)(sources);
232
228
 
233
- case 19:
229
+ case 21:
234
230
  zipped = _context.sent;
235
231
 
236
- case 20:
232
+ case 22:
237
233
  if (!zipped) {
238
- _context.next = 27;
234
+ _context.next = 33;
239
235
  break;
240
236
  }
241
237
 
242
- _context.next = 23;
238
+ _context.next = 25;
243
239
  return zipped.generateAsync({
244
240
  type: 'base64',
245
241
  compression: 'DEFLATE',
@@ -249,7 +245,7 @@ var _default = {
249
245
  }
250
246
  });
251
247
 
252
- case 23:
248
+ case 25:
253
249
  content = _context.sent;
254
250
 
255
251
  if (debug) {
@@ -261,22 +257,18 @@ var _default = {
261
257
  filename: 'application.zip',
262
258
  extension: 'zip'
263
259
  };
264
- promise = promise.then(function (removeRes) {
265
- errorHandler(removeRes);
266
- return _this.addApplicationSource(client, applicationId, source);
267
- }).then(errorHandler).catch(function (e) {
268
- if (debug) {
269
- console.warn("Warning: Update application sources failed with ".concat(e.message));
270
- }
271
- });
260
+ _context.t0 = errorHandler;
261
+ _context.next = 31;
262
+ return _this.addApplicationSource(client, applicationId, source);
272
263
 
273
- case 27:
274
- return _context.abrupt("return", {
275
- source: source,
276
- promise: promise
277
- });
264
+ case 31:
265
+ _context.t1 = _context.sent;
266
+ (0, _context.t0)(_context.t1);
278
267
 
279
- case 28:
268
+ case 33:
269
+ return _context.abrupt("return", source);
270
+
271
+ case 34:
280
272
  case "end":
281
273
  return _context.stop();
282
274
  }
@@ -331,7 +323,7 @@ var _default = {
331
323
  var _this2 = this;
332
324
 
333
325
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
334
- 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, _yield$_this2$updateA, updateData, dataToValidate, prop, value, applicationUpdate, updateApplicationRes, protectionOptions, inputSymbolTableContents, _yield$Promise$all, _yield$Promise$all2, createApplicationProtectionRes, protectionIds, onExitCancelProtection, processedProtections, handleProtection, i, protection;
326
+ 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, appProfiling, updateData, dataToValidate, prop, value, applicationUpdate, updateApplicationRes, protectionOptions, inputSymbolTableContents, createApplicationProtectionRes, protectionIds, onExitCancelProtection, processedProtections, handleProtection, i, protection;
335
327
 
336
328
  return regeneratorRuntime.wrap(function _callee4$(_context4) {
337
329
  while (1) {
@@ -382,7 +374,7 @@ var _default = {
382
374
 
383
375
  case 13:
384
376
  if (skipSources) {
385
- _context4.next = 28;
377
+ _context4.next = 26;
386
378
  break;
387
379
  }
388
380
 
@@ -415,16 +407,14 @@ var _default = {
415
407
  });
416
408
 
417
409
  case 23:
418
- _yield$_this2$updateA = _context4.sent;
419
- source = _yield$_this2$updateA.source;
420
- updateApplicationSourcePromise = _yield$_this2$updateA.promise;
421
- _context4.next = 29;
410
+ source = _context4.sent;
411
+ _context4.next = 27;
422
412
  break;
423
413
 
424
- case 28:
414
+ case 26:
425
415
  console.log('Update source files SKIPPED');
426
416
 
427
- case 29:
417
+ case 27:
428
418
  updateData = {
429
419
  _id: applicationId,
430
420
  debugMode: !!debugMode,
@@ -458,7 +448,7 @@ var _default = {
458
448
  }
459
449
 
460
450
  if (!(updateData.parameters || updateData.applicationTypes || updateData.languageSpecifications || updateData.browsers || typeof updateData.areSubscribersOrdered !== 'undefined')) {
461
- _context4.next = 43;
451
+ _context4.next = 41;
462
452
  break;
463
453
  }
464
454
 
@@ -466,15 +456,15 @@ var _default = {
466
456
  console.log('Updating parameters of protection');
467
457
  }
468
458
 
469
- _context4.next = 37;
459
+ _context4.next = 35;
470
460
  return intoObjectType(client, updateData, 'Application');
471
461
 
472
- case 37:
462
+ case 35:
473
463
  applicationUpdate = _context4.sent;
474
- _context4.next = 40;
464
+ _context4.next = 38;
475
465
  return _this2.updateApplication(client, applicationUpdate);
476
466
 
477
- case 40:
467
+ case 38:
478
468
  updateApplicationRes = _context4.sent;
479
469
 
480
470
  if (debug) {
@@ -484,7 +474,7 @@ var _default = {
484
474
 
485
475
  errorHandler(updateApplicationRes);
486
476
 
487
- case 43:
477
+ case 41:
488
478
  if (debug) {
489
479
  console.log('Creating Application Protection');
490
480
  }
@@ -510,13 +500,11 @@ var _default = {
510
500
  protectionOptions.inputSymbolTable = inputSymbolTableContents;
511
501
  }
512
502
 
513
- _context4.next = 49;
514
- return Promise.all([_this2.createApplicationProtections(client, applicationId, protectionOptions), updateApplicationSourcePromise]);
503
+ _context4.next = 47;
504
+ return _this2.createApplicationProtections(client, applicationId, protectionOptions);
515
505
 
516
- case 49:
517
- _yield$Promise$all = _context4.sent;
518
- _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 1);
519
- createApplicationProtectionRes = _yield$Promise$all2[0];
506
+ case 47:
507
+ createApplicationProtectionRes = _context4.sent;
520
508
  errorHandler(createApplicationProtectionRes);
521
509
  protectionIds = createApplicationProtectionRes.data.protections.map(function (_ref2) {
522
510
  var _id = _ref2._id;
@@ -582,15 +570,15 @@ var _default = {
582
570
  _context4.t1 = client;
583
571
  _context4.t2 = applicationId;
584
572
  _context4.t3 = protectionIds;
585
- _context4.next = 62;
573
+ _context4.next = 58;
586
574
  return (0, _getProtectionDefaultFragments.default)(client);
587
575
 
588
- case 62:
576
+ case 58:
589
577
  _context4.t4 = _context4.sent;
590
- _context4.next = 65;
578
+ _context4.next = 61;
591
579
  return _context4.t0.pollProtections.call(_context4.t0, _context4.t1, _context4.t2, _context4.t3, _context4.t4);
592
580
 
593
- case 65:
581
+ case 61:
594
582
  processedProtections = _context4.sent;
595
583
  process.removeListener('SIGINT', onExitCancelProtection).removeListener('SIGTERM', onExitCancelProtection);
596
584
 
@@ -718,54 +706,54 @@ var _default = {
718
706
  }();
719
707
 
720
708
  if (!(processedProtections.length === 1)) {
721
- _context4.next = 70;
709
+ _context4.next = 66;
722
710
  break;
723
711
  }
724
712
 
725
713
  return _context4.abrupt("return", handleProtection(processedProtections[0]));
726
714
 
727
- case 70:
715
+ case 66:
728
716
  console.log("Protections stored in ".concat(filesDest, "/[protection-id]"));
729
717
  i = 0;
730
718
 
731
- case 72:
719
+ case 68:
732
720
  if (!(i < processedProtections.length)) {
733
- _context4.next = 85;
721
+ _context4.next = 81;
734
722
  break;
735
723
  }
736
724
 
737
725
  protection = processedProtections[i];
738
- _context4.prev = 74;
739
- _context4.next = 77;
726
+ _context4.prev = 70;
727
+ _context4.next = 73;
740
728
  return handleProtection(protection, {
741
729
  outPrefix: "/".concat(protection._id, "/"),
742
730
  printProtectionId: false
743
731
  });
744
732
 
745
- case 77:
746
- _context4.next = 82;
733
+ case 73:
734
+ _context4.next = 78;
747
735
  break;
748
736
 
749
- case 79:
750
- _context4.prev = 79;
751
- _context4.t5 = _context4["catch"](74);
737
+ case 75:
738
+ _context4.prev = 75;
739
+ _context4.t5 = _context4["catch"](70);
752
740
  console.error(_context4.t5);
753
741
 
754
- case 82:
742
+ case 78:
755
743
  i++;
756
- _context4.next = 72;
744
+ _context4.next = 68;
757
745
  break;
758
746
 
759
- case 85:
747
+ case 81:
760
748
  console.log("Runtime: ".concat(processedProtections.length, " protections in ").concat(Math.round((Date.now() - start) / 1000), "s"));
761
749
  return _context4.abrupt("return", protectionIds);
762
750
 
763
- case 87:
751
+ case 83:
764
752
  case "end":
765
753
  return _context4.stop();
766
754
  }
767
755
  }
768
- }, _callee4, null, [[74, 79]]);
756
+ }, _callee4, null, [[70, 75]]);
769
757
  }))();
770
758
  },
771
759
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jscrambler",
3
3
  "description": "Jscrambler API client.",
4
- "version": "6.1.5",
4
+ "version": "6.1.6",
5
5
  "homepage": "https://github.com/jscrambler/jscrambler",
6
6
  "author": "Jscrambler <code@jscrambler.com>",
7
7
  "repository": {