jscrambler 6.4.15 → 6.4.17

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
@@ -29,11 +29,13 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread n
29
29
  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); }
30
30
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
31
31
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
32
- 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; }
32
+ 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; }
33
33
  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; }
34
34
  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; }
35
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
36
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
35
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
36
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
37
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
38
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
37
39
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
38
40
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
39
41
  var intoObjectType = introspection.intoObjectType;
@@ -116,95 +118,93 @@ var _default = {
116
118
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
117
119
  var sources, filesSrc, cwd, appProfiling, removeSourceRes, zipped, source, _filesSrc, i, l, content;
118
120
  return _regeneratorRuntime().wrap(function _callee$(_context) {
119
- while (1) {
120
- switch (_context.prev = _context.next) {
121
- case 0:
122
- sources = _ref.sources, filesSrc = _ref.filesSrc, cwd = _ref.cwd, appProfiling = _ref.appProfiling;
123
- if (!(sources || filesSrc && filesSrc.length)) {
124
- _context.next = 8;
125
- break;
126
- }
127
- if (!(appProfiling && appProfiling.data && appProfiling.data.state === 'READY')) {
128
- _context.next = 4;
129
- break;
130
- }
131
- 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*.');
132
- case 4:
133
- _context.next = 6;
134
- return _this.removeSourceFromApplication(client, '', applicationId);
135
- case 6:
136
- removeSourceRes = _context.sent;
137
- errorHandler(removeSourceRes);
138
- case 8:
139
- if (!(filesSrc && filesSrc.length)) {
140
- _context.next = 17;
141
- break;
142
- }
143
- _filesSrc = [];
144
- for (i = 0, l = filesSrc.length; i < l; i += 1) {
145
- if (typeof filesSrc[i] === 'string') {
146
- _filesSrc = _filesSrc.concat((0, _utils.getMatchedFiles)(filesSrc[i]));
147
- } else {
148
- _filesSrc.push(filesSrc[i]);
149
- }
150
- }
151
- if (debug) {
152
- console.log('Creating zip from source files');
121
+ while (1) switch (_context.prev = _context.next) {
122
+ case 0:
123
+ sources = _ref.sources, filesSrc = _ref.filesSrc, cwd = _ref.cwd, appProfiling = _ref.appProfiling;
124
+ if (!(sources || filesSrc && filesSrc.length)) {
125
+ _context.next = 8;
126
+ break;
127
+ }
128
+ if (!(appProfiling && appProfiling.data && appProfiling.data.state === 'READY')) {
129
+ _context.next = 4;
130
+ break;
131
+ }
132
+ 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*.');
133
+ case 4:
134
+ _context.next = 6;
135
+ return _this.removeSourceFromApplication(client, '', applicationId);
136
+ case 6:
137
+ removeSourceRes = _context.sent;
138
+ errorHandler(removeSourceRes);
139
+ case 8:
140
+ if (!(filesSrc && filesSrc.length)) {
141
+ _context.next = 17;
142
+ break;
143
+ }
144
+ _filesSrc = [];
145
+ for (i = 0, l = filesSrc.length; i < l; i += 1) {
146
+ if (typeof filesSrc[i] === 'string') {
147
+ _filesSrc = _filesSrc.concat((0, _utils.getMatchedFiles)(filesSrc[i]));
148
+ } else {
149
+ _filesSrc.push(filesSrc[i]);
153
150
  }
154
- _context.next = 14;
155
- return (0, _zip.zip)(_filesSrc, cwd);
156
- case 14:
157
- zipped = _context.sent;
151
+ }
152
+ if (debug) {
153
+ console.log('Creating zip from source files');
154
+ }
155
+ _context.next = 14;
156
+ return (0, _zip.zip)(_filesSrc, cwd);
157
+ case 14:
158
+ zipped = _context.sent;
159
+ _context.next = 22;
160
+ break;
161
+ case 17:
162
+ if (!sources) {
158
163
  _context.next = 22;
159
164
  break;
160
- case 17:
161
- if (!sources) {
162
- _context.next = 22;
163
- break;
164
- }
165
- if (debug) {
166
- console.log('Creating zip from sources');
167
- }
168
- _context.next = 21;
169
- return (0, _zip.zipSources)(sources);
170
- case 21:
171
- zipped = _context.sent;
172
- case 22:
173
- if (!zipped) {
174
- _context.next = 33;
175
- break;
176
- }
177
- _context.next = 25;
178
- return zipped.generateAsync({
179
- type: 'base64',
180
- compression: 'DEFLATE',
181
- compressionOptions: {
182
- // 1 - 9 (max compression)
183
- level: 5
184
- }
185
- });
186
- case 25:
187
- content = _context.sent;
188
- if (debug) {
189
- console.log('Adding sources to application');
165
+ }
166
+ if (debug) {
167
+ console.log('Creating zip from sources');
168
+ }
169
+ _context.next = 21;
170
+ return (0, _zip.zipSources)(sources);
171
+ case 21:
172
+ zipped = _context.sent;
173
+ case 22:
174
+ if (!zipped) {
175
+ _context.next = 33;
176
+ break;
177
+ }
178
+ _context.next = 25;
179
+ return zipped.generateAsync({
180
+ type: 'base64',
181
+ compression: 'DEFLATE',
182
+ compressionOptions: {
183
+ // 1 - 9 (max compression)
184
+ level: 5
190
185
  }
191
- source = {
192
- content: content,
193
- filename: 'application.zip',
194
- extension: 'zip'
195
- };
196
- _context.t0 = errorHandler;
197
- _context.next = 31;
198
- return _this.addApplicationSource(client, applicationId, source);
199
- case 31:
200
- _context.t1 = _context.sent;
201
- (0, _context.t0)(_context.t1);
202
- case 33:
203
- return _context.abrupt("return", source);
204
- case 34:
205
- case "end":
206
- return _context.stop();
207
- }
186
+ });
187
+ case 25:
188
+ content = _context.sent;
189
+ if (debug) {
190
+ console.log('Adding sources to application');
191
+ }
192
+ source = {
193
+ content: content,
194
+ filename: 'application.zip',
195
+ extension: 'zip'
196
+ };
197
+ _context.t0 = errorHandler;
198
+ _context.next = 31;
199
+ return _this.addApplicationSource(client, applicationId, source);
200
+ case 31:
201
+ _context.t1 = _context.sent;
202
+ (0, _context.t0)(_context.t1);
203
+ case 33:
204
+ return _context.abrupt("return", source);
205
+ case 34:
206
+ case "end":
207
+ return _context.stop();
208
208
  }
209
209
  }, _callee);
210
210
  }))();
@@ -257,368 +257,367 @@ var _default = {
257
257
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
258
258
  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, ensureCodeAnnotation, forceAppEnvironment, accessKey, secretKey, client, filesSrc, filesDest, source, appProfiling, updateData, dataToValidate, prop, value, applicationUpdate, updateApplicationRes, protectionOptions, inputSymbolTableContents, createApplicationProtectionRes, protectionIds, onExitCancelProtection, processedProtections, handleProtection, i, protection;
259
259
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
260
- while (1) {
261
- switch (_context4.prev = _context4.next) {
262
- case 0:
263
- start = Date.now();
264
- finalConfig = buildFinalConfig(configPathOrObject);
265
- 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 === void 0 ? 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 === void 0 ? 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, ensureCodeAnnotation = finalConfig.ensureCodeAnnotation, forceAppEnvironment = finalConfig.forceAppEnvironment;
266
- accessKey = keys.accessKey, secretKey = keys.secretKey;
267
- client = new _this2.Client({
268
- accessKey: accessKey,
269
- secretKey: secretKey,
270
- host: host,
271
- port: port,
272
- basePath: basePath,
273
- protocol: protocol,
274
- cafile: cafile,
275
- jscramblerVersion: jscramblerVersion,
276
- proxy: proxy,
277
- utc: utc,
278
- clientId: clientId
279
- });
280
- filesSrc = finalConfig.filesSrc;
281
- filesDest = finalConfig.filesDest;
282
- if (sources) {
283
- filesSrc = undefined;
284
- }
285
- if (destCallback) {
286
- filesDest = undefined;
287
- }
288
- if (applicationId) {
289
- _context4.next = 11;
290
- break;
291
- }
292
- throw new Error('Required *applicationId* not provided');
293
- case 11:
294
- if (!(!filesDest && !destCallback)) {
295
- _context4.next = 13;
296
- break;
260
+ while (1) switch (_context4.prev = _context4.next) {
261
+ case 0:
262
+ start = Date.now();
263
+ finalConfig = buildFinalConfig(configPathOrObject);
264
+ 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 === void 0 ? 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 === void 0 ? 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, ensureCodeAnnotation = finalConfig.ensureCodeAnnotation, forceAppEnvironment = finalConfig.forceAppEnvironment;
265
+ accessKey = keys.accessKey, secretKey = keys.secretKey;
266
+ client = new _this2.Client({
267
+ accessKey: accessKey,
268
+ secretKey: secretKey,
269
+ host: host,
270
+ port: port,
271
+ basePath: basePath,
272
+ protocol: protocol,
273
+ cafile: cafile,
274
+ jscramblerVersion: jscramblerVersion,
275
+ proxy: proxy,
276
+ utc: utc,
277
+ clientId: clientId
278
+ });
279
+ filesSrc = finalConfig.filesSrc;
280
+ filesDest = finalConfig.filesDest;
281
+ if (sources) {
282
+ filesSrc = undefined;
283
+ }
284
+ if (destCallback) {
285
+ filesDest = undefined;
286
+ }
287
+ if (applicationId) {
288
+ _context4.next = 11;
289
+ break;
290
+ }
291
+ throw new Error('Required *applicationId* not provided');
292
+ case 11:
293
+ if (!(!filesDest && !destCallback)) {
294
+ _context4.next = 13;
295
+ break;
296
+ }
297
+ throw new Error('Required *filesDest* not provided');
298
+ case 13:
299
+ if (skipSources) {
300
+ _context4.next = 26;
301
+ break;
302
+ }
303
+ _context4.next = 16;
304
+ return _this2.getApplicationProfiling(client, applicationId).catch(function (e) {
305
+ if (typeof profilingDataMode === 'string' && profilingDataMode !== 'off') {
306
+ switch (e.statusCode) {
307
+ case _constants.HTTP_STATUS_CODES.FORBIDDEN:
308
+ throw new Error("No ".concat(profilingDataMode, " profiling feature in your plan. Please set profilingDataMode to \"off\" or contact the Jscrambler Support."));
309
+ case _constants.HTTP_STATUS_CODES.NOT_FOUND:
310
+ if (profilingDataMode === 'automatic') {
311
+ throw new Error('You can not use the automatic mode without previous profiling having been done.');
312
+ }
313
+ break;
314
+ case _constants.HTTP_STATUS_CODES.SERVICE_UNAVAILABLE:
315
+ if (profilingDataMode === 'automatic') {
316
+ throw e;
317
+ }
318
+ }
297
319
  }
298
- throw new Error('Required *filesDest* not provided');
299
- case 13:
300
- if (skipSources) {
301
- _context4.next = 26;
302
- break;
320
+ });
321
+ case 16:
322
+ appProfiling = _context4.sent;
323
+ if (!(appProfiling && removeProfilingData)) {
324
+ _context4.next = 21;
325
+ break;
326
+ }
327
+ _context4.next = 20;
328
+ return _this2.deleteProfiling(client, appProfiling.data.id);
329
+ case 20:
330
+ appProfiling.data.state = 'DELETED';
331
+ case 21:
332
+ _context4.next = 23;
333
+ return _this2.updateApplicationSources(client, applicationId, {
334
+ sources: sources,
335
+ filesSrc: filesSrc,
336
+ cwd: cwd,
337
+ appProfiling: appProfiling
338
+ });
339
+ case 23:
340
+ source = _context4.sent;
341
+ _context4.next = 27;
342
+ break;
343
+ case 26:
344
+ console.log('Update source files SKIPPED');
345
+ case 27:
346
+ updateData = {
347
+ _id: applicationId,
348
+ debugMode: !!debugMode,
349
+ tolerateMinification: tolerateMinification,
350
+ codeHardeningThreshold: codeHardeningThreshold
351
+ };
352
+ if (params && Object.keys(params).length) {
353
+ updateData.parameters = normalizeParameters(params);
354
+ updateData.areSubscribersOrdered = Array.isArray(params);
355
+ }
356
+ dataToValidate = {
357
+ applicationTypes: applicationTypes,
358
+ areSubscribersOrdered: areSubscribersOrdered,
359
+ browsers: browsers,
360
+ languageSpecifications: languageSpecifications,
361
+ profilingDataMode: profilingDataMode,
362
+ sourceMaps: sourceMaps,
363
+ useAppClassification: useAppClassification,
364
+ ensureCodeAnnotation: ensureCodeAnnotation,
365
+ useProfilingData: useProfilingData,
366
+ useRecommendedOrder: useRecommendedOrder
367
+ };
368
+ for (prop in dataToValidate) {
369
+ value = dataToValidate[prop];
370
+ if (typeof value !== 'undefined') {
371
+ updateData[prop] = value;
303
372
  }
304
- _context4.next = 16;
305
- return _this2.getApplicationProfiling(client, applicationId).catch(function (e) {
306
- if (typeof profilingDataMode === 'string' && profilingDataMode !== 'off') {
307
- switch (e.statusCode) {
308
- case _constants.HTTP_STATUS_CODES.FORBIDDEN:
309
- throw new Error("No ".concat(profilingDataMode, " profiling feature in your plan. Please set profilingDataMode to \"off\" or contact the Jscrambler Support."));
310
- case _constants.HTTP_STATUS_CODES.NOT_FOUND:
311
- if (profilingDataMode === 'automatic') {
312
- throw new Error('You can not use the automatic mode without previous profiling having been done.');
373
+ }
374
+ if (!(updateData.parameters || updateData.applicationTypes || updateData.languageSpecifications || updateData.browsers || typeof updateData.areSubscribersOrdered !== 'undefined')) {
375
+ _context4.next = 41;
376
+ break;
377
+ }
378
+ if (debug) {
379
+ console.log('Updating parameters of protection');
380
+ }
381
+ _context4.next = 35;
382
+ return intoObjectType(client, updateData, 'Application');
383
+ case 35:
384
+ applicationUpdate = _context4.sent;
385
+ _context4.next = 38;
386
+ return _this2.updateApplication(client, applicationUpdate);
387
+ case 38:
388
+ updateApplicationRes = _context4.sent;
389
+ if (debug) {
390
+ console.log('Finished updating parameters of protection');
391
+ console.error(updateApplicationRes);
392
+ }
393
+ errorHandler(updateApplicationRes);
394
+ case 41:
395
+ if (debug) {
396
+ console.log('Creating Application Protection');
397
+ }
398
+ delete updateData._id;
399
+ protectionOptions = _objectSpread(_objectSpread({}, updateData), {}, {
400
+ bail: bail,
401
+ entryPoint: entryPoint,
402
+ excludeList: excludeList,
403
+ inputSymbolTable: inputSymbolTable,
404
+ randomizationSeed: randomizationSeed,
405
+ source: source,
406
+ tolerateMinification: tolerateMinification,
407
+ numberOfProtections: numberOfProtections,
408
+ forceAppEnvironment: forceAppEnvironment
409
+ });
410
+ if (finalConfig.inputSymbolTable) {
411
+ // Note: we can not use the fs.promises API because some users may not have node 10.
412
+ // Once node 10 is old enough to be safe to assume that all users will have it, this
413
+ // should be safe to replace with `await fs.promises.readFile`.
414
+ inputSymbolTableContents = _fs.default.readFileSync(finalConfig.inputSymbolTable, 'utf-8');
415
+ protectionOptions.inputSymbolTable = inputSymbolTableContents;
416
+ }
417
+ _context4.next = 47;
418
+ return _this2.createApplicationProtections(client, applicationId, protectionOptions);
419
+ case 47:
420
+ createApplicationProtectionRes = _context4.sent;
421
+ errorHandler(createApplicationProtectionRes);
422
+ protectionIds = createApplicationProtectionRes.data.protections.map(function (_ref2) {
423
+ var _id = _ref2._id;
424
+ return _id;
425
+ });
426
+ onExitCancelProtection = /*#__PURE__*/function () {
427
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
428
+ var i, protectionId;
429
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
430
+ while (1) switch (_context2.prev = _context2.next) {
431
+ case 0:
432
+ i = 0;
433
+ case 1:
434
+ if (!(i < protectionIds.length)) {
435
+ _context2.next = 15;
436
+ break;
313
437
  }
438
+ protectionId = protectionIds[i];
439
+ _context2.prev = 3;
440
+ _context2.next = 6;
441
+ return _this2.cancelProtection(client, protectionId, applicationId);
442
+ case 6:
443
+ console.log('** Protection %s WAS CANCELLED **', protectionId);
444
+ _context2.next = 12;
314
445
  break;
315
- case _constants.HTTP_STATUS_CODES.SERVICE_UNAVAILABLE:
316
- if (profilingDataMode === 'automatic') {
317
- throw e;
446
+ case 9:
447
+ _context2.prev = 9;
448
+ _context2.t0 = _context2["catch"](3);
449
+ if (debug) {
450
+ console.error(_context2.t0);
318
451
  }
452
+ case 12:
453
+ i++;
454
+ _context2.next = 1;
455
+ break;
456
+ case 15:
457
+ process.exit(1);
458
+ case 16:
459
+ case "end":
460
+ return _context2.stop();
319
461
  }
320
- }
321
- });
322
- case 16:
323
- appProfiling = _context4.sent;
324
- if (!(appProfiling && removeProfilingData)) {
325
- _context4.next = 21;
326
- break;
327
- }
328
- _context4.next = 20;
329
- return _this2.deleteProfiling(client, appProfiling.data.id);
330
- case 20:
331
- appProfiling.data.state = 'DELETED';
332
- case 21:
333
- _context4.next = 23;
334
- return _this2.updateApplicationSources(client, applicationId, {
335
- sources: sources,
336
- filesSrc: filesSrc,
337
- cwd: cwd,
338
- appProfiling: appProfiling
339
- });
340
- case 23:
341
- source = _context4.sent;
342
- _context4.next = 27;
343
- break;
344
- case 26:
345
- console.log('Update source files SKIPPED');
346
- case 27:
347
- updateData = {
348
- _id: applicationId,
349
- debugMode: !!debugMode,
350
- tolerateMinification: tolerateMinification,
351
- codeHardeningThreshold: codeHardeningThreshold
352
- };
353
- if (params && Object.keys(params).length) {
354
- updateData.parameters = normalizeParameters(params);
355
- updateData.areSubscribersOrdered = Array.isArray(params);
356
- }
357
- dataToValidate = {
358
- applicationTypes: applicationTypes,
359
- areSubscribersOrdered: areSubscribersOrdered,
360
- browsers: browsers,
361
- languageSpecifications: languageSpecifications,
362
- profilingDataMode: profilingDataMode,
363
- sourceMaps: sourceMaps,
364
- useAppClassification: useAppClassification,
365
- ensureCodeAnnotation: ensureCodeAnnotation,
366
- useProfilingData: useProfilingData,
367
- useRecommendedOrder: useRecommendedOrder
462
+ }, _callee2, null, [[3, 9]]);
463
+ }));
464
+ return function onExitCancelProtection() {
465
+ return _ref3.apply(this, arguments);
368
466
  };
369
- for (prop in dataToValidate) {
370
- value = dataToValidate[prop];
371
- if (typeof value !== 'undefined') {
372
- updateData[prop] = value;
373
- }
374
- }
375
- if (!(updateData.parameters || updateData.applicationTypes || updateData.languageSpecifications || updateData.browsers || typeof updateData.areSubscribersOrdered !== 'undefined')) {
376
- _context4.next = 41;
377
- break;
378
- }
379
- if (debug) {
380
- console.log('Updating parameters of protection');
381
- }
382
- _context4.next = 35;
383
- return intoObjectType(client, updateData, 'Application');
384
- case 35:
385
- applicationUpdate = _context4.sent;
386
- _context4.next = 38;
387
- return _this2.updateApplication(client, applicationUpdate);
388
- case 38:
389
- updateApplicationRes = _context4.sent;
390
- if (debug) {
391
- console.log('Finished updating parameters of protection');
392
- console.error(updateApplicationRes);
393
- }
394
- errorHandler(updateApplicationRes);
395
- case 41:
396
- if (debug) {
397
- console.log('Creating Application Protection');
398
- }
399
- delete updateData._id;
400
- protectionOptions = _objectSpread(_objectSpread({}, updateData), {}, {
401
- bail: bail,
402
- entryPoint: entryPoint,
403
- excludeList: excludeList,
404
- inputSymbolTable: inputSymbolTable,
405
- randomizationSeed: randomizationSeed,
406
- source: source,
407
- tolerateMinification: tolerateMinification,
408
- numberOfProtections: numberOfProtections,
409
- forceAppEnvironment: forceAppEnvironment
410
- });
411
- if (finalConfig.inputSymbolTable) {
412
- // Note: we can not use the fs.promises API because some users may not have node 10.
413
- // Once node 10 is old enough to be safe to assume that all users will have it, this
414
- // should be safe to replace with `await fs.promises.readFile`.
415
- inputSymbolTableContents = _fs.default.readFileSync(finalConfig.inputSymbolTable, 'utf-8');
416
- protectionOptions.inputSymbolTable = inputSymbolTableContents;
417
- }
418
- _context4.next = 47;
419
- return _this2.createApplicationProtections(client, applicationId, protectionOptions);
420
- case 47:
421
- createApplicationProtectionRes = _context4.sent;
422
- errorHandler(createApplicationProtectionRes);
423
- protectionIds = createApplicationProtectionRes.data.protections.map(function (_ref2) {
424
- var _id = _ref2._id;
425
- return _id;
426
- });
427
- onExitCancelProtection = /*#__PURE__*/function () {
428
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
429
- var i, protectionId;
430
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
431
- while (1) {
432
- switch (_context2.prev = _context2.next) {
433
- case 0:
434
- i = 0;
435
- case 1:
436
- if (!(i < protectionIds.length)) {
437
- _context2.next = 15;
438
- break;
439
- }
440
- protectionId = protectionIds[i];
441
- _context2.prev = 3;
442
- _context2.next = 6;
443
- return _this2.cancelProtection(client, protectionId, applicationId);
444
- case 6:
445
- console.log('** Protection %s WAS CANCELLED **', protectionId);
446
- _context2.next = 12;
447
- break;
448
- case 9:
449
- _context2.prev = 9;
450
- _context2.t0 = _context2["catch"](3);
451
- if (debug) {
452
- console.error(_context2.t0);
453
- }
454
- case 12:
455
- i++;
456
- _context2.next = 1;
457
- break;
458
- case 15:
459
- process.exit(1);
460
- case 16:
461
- case "end":
462
- return _context2.stop();
467
+ }();
468
+ process.once('SIGINT', onExitCancelProtection).once('SIGTERM', onExitCancelProtection);
469
+ _context4.t0 = _this2;
470
+ _context4.t1 = client;
471
+ _context4.t2 = applicationId;
472
+ _context4.t3 = protectionIds;
473
+ _context4.next = 58;
474
+ return (0, _getProtectionDefaultFragments.default)(client);
475
+ case 58:
476
+ _context4.t4 = _context4.sent;
477
+ _context4.next = 61;
478
+ return _context4.t0.pollProtections.call(_context4.t0, _context4.t1, _context4.t2, _context4.t3, _context4.t4);
479
+ case 61:
480
+ processedProtections = _context4.sent;
481
+ process.removeListener('SIGINT', onExitCancelProtection).removeListener('SIGTERM', onExitCancelProtection);
482
+ handleProtection = /*#__PURE__*/function () {
483
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(protection) {
484
+ var _ref5,
485
+ _ref5$outPrefix,
486
+ outPrefix,
487
+ _ref5$printProtection,
488
+ printProtectionId,
489
+ sourcesErrors,
490
+ download,
491
+ _args3 = arguments;
492
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
493
+ while (1) switch (_context3.prev = _context3.next) {
494
+ case 0:
495
+ _ref5 = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {}, _ref5$outPrefix = _ref5.outPrefix, outPrefix = _ref5$outPrefix === void 0 ? '' : _ref5$outPrefix, _ref5$printProtection = _ref5.printProtectionId, printProtectionId = _ref5$printProtection === void 0 ? true : _ref5$printProtection;
496
+ if (protection.growthWarning) {
497
+ 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: ".concat(APP_URL, "."));
463
498
  }
464
- }
465
- }, _callee2, null, [[3, 9]]);
466
- }));
467
- return function onExitCancelProtection() {
468
- return _ref3.apply(this, arguments);
469
- };
470
- }();
471
- process.once('SIGINT', onExitCancelProtection).once('SIGTERM', onExitCancelProtection);
472
- _context4.t0 = _this2;
473
- _context4.t1 = client;
474
- _context4.t2 = applicationId;
475
- _context4.t3 = protectionIds;
476
- _context4.next = 58;
477
- return (0, _getProtectionDefaultFragments.default)(client);
478
- case 58:
479
- _context4.t4 = _context4.sent;
480
- _context4.next = 61;
481
- return _context4.t0.pollProtections.call(_context4.t0, _context4.t1, _context4.t2, _context4.t3, _context4.t4);
482
- case 61:
483
- processedProtections = _context4.sent;
484
- process.removeListener('SIGINT', onExitCancelProtection).removeListener('SIGTERM', onExitCancelProtection);
485
- handleProtection = /*#__PURE__*/function () {
486
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(protection) {
487
- var _ref5,
488
- _ref5$outPrefix,
489
- outPrefix,
490
- _ref5$printProtection,
491
- printProtectionId,
492
- sourcesErrors,
493
- download,
494
- _args3 = arguments;
495
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
496
- while (1) {
497
- switch (_context3.prev = _context3.next) {
498
- case 0:
499
- _ref5 = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {}, _ref5$outPrefix = _ref5.outPrefix, outPrefix = _ref5$outPrefix === void 0 ? '' : _ref5$outPrefix, _ref5$printProtection = _ref5.printProtectionId, printProtectionId = _ref5$printProtection === void 0 ? true : _ref5$printProtection;
500
- if (protection.growthWarning) {
501
- 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: ".concat(APP_URL, "."));
502
- }
503
- if (debug) {
504
- console.log('Finished protecting');
505
- }
506
- if (protection.deprecations) {
507
- protection.deprecations.forEach(function (deprecation) {
508
- if (deprecation.type === 'Transformation') {
509
- console.warn("Warning: ".concat(deprecation.type, " ").concat(deprecation.entity, " is no longer maintained. Please consider removing it from your configuration."));
510
- } else if (deprecation.type && deprecation.entity) {
511
- console.warn("Warning: ".concat(deprecation.type, " ").concat(deprecation.entity, " is deprecated."));
512
- }
513
- });
514
- }
515
- sourcesErrors = [];
516
- protection.sources.forEach(function (s) {
517
- if (s.isSource && s.errorMessages && s.errorMessages.length > 0) {
518
- sourcesErrors.push.apply(sourcesErrors, _toConsumableArray(s.errorMessages.map(function (e) {
519
- return _objectSpread({
520
- filename: s.filename
521
- }, e);
522
- })));
523
- }
524
- });
525
- if (!(protection.state === 'errored')) {
526
- _context3.next = 14;
527
- break;
528
- }
529
- console.error('Global protection errors:');
530
- console.error("- ".concat(protection.errorMessage));
531
- console.error('');
532
- if (sourcesErrors.length > 0) {
533
- printSourcesErrors(sourcesErrors);
534
- }
535
- throw new Error("Protection failed. For more information visit: ".concat(APP_URL, "."));
536
- case 14:
537
- if (!(sourcesErrors.length > 0)) {
538
- _context3.next = 21;
539
- break;
540
- }
541
- if (!protection.bail) {
542
- _context3.next = 20;
543
- break;
544
- }
545
- printSourcesErrors(sourcesErrors);
546
- throw new Error('Your protection has failed.');
547
- case 20:
548
- sourcesErrors.forEach(function (e) {
549
- return console.warn("Non-fatal error: \"".concat(e.message, "\" in ").concat(e.filename));
550
- });
551
- case 21:
552
- if (debug) {
553
- console.log('Downloading protection result');
554
- }
555
- _context3.next = 24;
556
- return _this2.downloadApplicationProtection(client, protection._id);
557
- case 24:
558
- download = _context3.sent;
559
- errorHandler(download);
560
- if (debug) {
561
- console.log('Unzipping files');
562
- }
563
- _context3.next = 29;
564
- return (0, _zip.unzip)(download, (filesDest ? "".concat(filesDest).concat(outPrefix) : filesDest) || destCallback, stream);
565
- case 29:
566
- if (debug) {
567
- console.log('Finished unzipping files');
568
- }
569
- if (printProtectionId) {
570
- console.log(protection._id);
499
+ if (protection.hasForcedDateLock) {
500
+ console.warn("Warning: Since your plan is a Trial, your protected files will stop working on ".concat(protection.parameters.find(function (p) {
501
+ return p.name === 'dateLock' && p.options.endDate;
502
+ }).options.endDate));
503
+ }
504
+ if (debug) {
505
+ console.log('Finished protecting');
506
+ }
507
+ if (protection.deprecations) {
508
+ protection.deprecations.forEach(function (deprecation) {
509
+ if (deprecation.type === 'Transformation') {
510
+ console.warn("Warning: ".concat(deprecation.type, " ").concat(deprecation.entity, " is no longer maintained. Please consider removing it from your configuration."));
511
+ } else if (deprecation.type && deprecation.entity) {
512
+ console.warn("Warning: ".concat(deprecation.type, " ").concat(deprecation.entity, " is deprecated."));
571
513
  }
572
- return _context3.abrupt("return", protection._id);
573
- case 32:
574
- case "end":
575
- return _context3.stop();
514
+ });
576
515
  }
577
- }
578
- }, _callee3);
579
- }));
580
- return function handleProtection(_x) {
581
- return _ref4.apply(this, arguments);
582
- };
583
- }();
584
- if (!(processedProtections.length === 1)) {
585
- _context4.next = 66;
586
- break;
587
- }
588
- return _context4.abrupt("return", handleProtection(processedProtections[0]));
589
- case 66:
590
- console.log("Protections stored in ".concat(filesDest, "/[protection-id]"));
591
- i = 0;
592
- case 68:
593
- if (!(i < processedProtections.length)) {
594
- _context4.next = 81;
595
- break;
596
- }
597
- protection = processedProtections[i];
598
- _context4.prev = 70;
599
- _context4.next = 73;
600
- return handleProtection(protection, {
601
- outPrefix: "/".concat(protection._id, "/"),
602
- printProtectionId: false
603
- });
604
- case 73:
605
- _context4.next = 78;
516
+ sourcesErrors = [];
517
+ protection.sources.forEach(function (s) {
518
+ if (s.isSource && s.errorMessages && s.errorMessages.length > 0) {
519
+ sourcesErrors.push.apply(sourcesErrors, _toConsumableArray(s.errorMessages.map(function (e) {
520
+ return _objectSpread({
521
+ filename: s.filename
522
+ }, e);
523
+ })));
524
+ }
525
+ });
526
+ if (!(protection.state === 'errored')) {
527
+ _context3.next = 15;
528
+ break;
529
+ }
530
+ console.error('Global protection errors:');
531
+ console.error("- ".concat(protection.errorMessage));
532
+ console.error('');
533
+ if (sourcesErrors.length > 0) {
534
+ printSourcesErrors(sourcesErrors);
535
+ }
536
+ throw new Error("Protection failed. For more information visit: ".concat(APP_URL, "."));
537
+ case 15:
538
+ if (!(sourcesErrors.length > 0)) {
539
+ _context3.next = 22;
540
+ break;
541
+ }
542
+ if (!protection.bail) {
543
+ _context3.next = 21;
544
+ break;
545
+ }
546
+ printSourcesErrors(sourcesErrors);
547
+ throw new Error('Your protection has failed.');
548
+ case 21:
549
+ sourcesErrors.forEach(function (e) {
550
+ return console.warn("Non-fatal error: \"".concat(e.message, "\" in ").concat(e.filename));
551
+ });
552
+ case 22:
553
+ if (debug) {
554
+ console.log('Downloading protection result');
555
+ }
556
+ _context3.next = 25;
557
+ return _this2.downloadApplicationProtection(client, protection._id);
558
+ case 25:
559
+ download = _context3.sent;
560
+ errorHandler(download);
561
+ if (debug) {
562
+ console.log('Unzipping files');
563
+ }
564
+ _context3.next = 30;
565
+ return (0, _zip.unzip)(download, (filesDest ? "".concat(filesDest).concat(outPrefix) : filesDest) || destCallback, stream);
566
+ case 30:
567
+ if (debug) {
568
+ console.log('Finished unzipping files');
569
+ }
570
+ if (printProtectionId) {
571
+ console.log(protection._id);
572
+ }
573
+ return _context3.abrupt("return", protection._id);
574
+ case 33:
575
+ case "end":
576
+ return _context3.stop();
577
+ }
578
+ }, _callee3);
579
+ }));
580
+ return function handleProtection(_x) {
581
+ return _ref4.apply(this, arguments);
582
+ };
583
+ }();
584
+ if (!(processedProtections.length === 1)) {
585
+ _context4.next = 66;
606
586
  break;
607
- case 75:
608
- _context4.prev = 75;
609
- _context4.t5 = _context4["catch"](70);
610
- console.error(_context4.t5);
611
- case 78:
612
- i++;
613
- _context4.next = 68;
587
+ }
588
+ return _context4.abrupt("return", handleProtection(processedProtections[0]));
589
+ case 66:
590
+ console.log("Protections stored in ".concat(filesDest, "/[protection-id]"));
591
+ i = 0;
592
+ case 68:
593
+ if (!(i < processedProtections.length)) {
594
+ _context4.next = 81;
614
595
  break;
615
- case 81:
616
- console.log("Runtime: ".concat(processedProtections.length, " protections in ").concat(Math.round((Date.now() - start) / 1000), "s"));
617
- return _context4.abrupt("return", protectionIds);
618
- case 83:
619
- case "end":
620
- return _context4.stop();
621
- }
596
+ }
597
+ protection = processedProtections[i];
598
+ _context4.prev = 70;
599
+ _context4.next = 73;
600
+ return handleProtection(protection, {
601
+ outPrefix: "/".concat(protection._id, "/"),
602
+ printProtectionId: false
603
+ });
604
+ case 73:
605
+ _context4.next = 78;
606
+ break;
607
+ case 75:
608
+ _context4.prev = 75;
609
+ _context4.t5 = _context4["catch"](70);
610
+ console.error(_context4.t5);
611
+ case 78:
612
+ i++;
613
+ _context4.next = 68;
614
+ break;
615
+ case 81:
616
+ console.log("Runtime: ".concat(processedProtections.length, " protections in ").concat(Math.round((Date.now() - start) / 1000), "s"));
617
+ return _context4.abrupt("return", protectionIds);
618
+ case 83:
619
+ case "end":
620
+ return _context4.stop();
622
621
  }
623
622
  }, _callee4, null, [[70, 75]]);
624
623
  }))();
@@ -634,104 +633,102 @@ var _default = {
634
633
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
635
634
  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;
636
635
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
637
- while (1) {
638
- switch (_context5.prev = _context5.next) {
639
- case 0:
640
- finalConfig = buildFinalConfig(configPathOrObject);
641
- 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 === void 0 ? true : _finalConfig$stream2, cwd = finalConfig.cwd, jscramblerVersion = finalConfig.jscramblerVersion, proxy = finalConfig.proxy, utc = finalConfig.utc, skipSources = finalConfig.skipSources, clientId = finalConfig.clientId;
642
- accessKey = keys.accessKey, secretKey = keys.secretKey;
643
- client = new _this3.Client({
644
- accessKey: accessKey,
645
- secretKey: secretKey,
646
- host: host,
647
- port: port,
648
- basePath: basePath,
649
- protocol: protocol,
650
- cafile: cafile,
651
- jscramblerVersion: jscramblerVersion,
652
- proxy: proxy,
653
- utc: utc,
654
- clientId: clientId
655
- });
656
- filesSrc = finalConfig.filesSrc, filesDest = finalConfig.filesDest;
657
- if (sources) {
658
- filesSrc = undefined;
659
- }
660
- if (destCallback) {
661
- filesDest = undefined;
662
- }
663
- if (applicationId) {
664
- _context5.next = 9;
665
- break;
666
- }
667
- throw new Error('Required *applicationId* not provided');
668
- case 9:
669
- if (!(!filesDest && !destCallback)) {
670
- _context5.next = 11;
671
- break;
672
- }
673
- throw new Error('Required *filesDest* not provided');
674
- case 11:
675
- if (skipSources) {
676
- _context5.next = 16;
677
- break;
678
- }
679
- _context5.next = 14;
680
- return _this3.updateApplicationSources(client, applicationId, {
681
- sources: sources,
682
- filesSrc: filesSrc,
683
- cwd: cwd
684
- });
685
- case 14:
686
- _context5.next = 17;
636
+ while (1) switch (_context5.prev = _context5.next) {
637
+ case 0:
638
+ finalConfig = buildFinalConfig(configPathOrObject);
639
+ 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 === void 0 ? true : _finalConfig$stream2, cwd = finalConfig.cwd, jscramblerVersion = finalConfig.jscramblerVersion, proxy = finalConfig.proxy, utc = finalConfig.utc, skipSources = finalConfig.skipSources, clientId = finalConfig.clientId;
640
+ accessKey = keys.accessKey, secretKey = keys.secretKey;
641
+ client = new _this3.Client({
642
+ accessKey: accessKey,
643
+ secretKey: secretKey,
644
+ host: host,
645
+ port: port,
646
+ basePath: basePath,
647
+ protocol: protocol,
648
+ cafile: cafile,
649
+ jscramblerVersion: jscramblerVersion,
650
+ proxy: proxy,
651
+ utc: utc,
652
+ clientId: clientId
653
+ });
654
+ filesSrc = finalConfig.filesSrc, filesDest = finalConfig.filesDest;
655
+ if (sources) {
656
+ filesSrc = undefined;
657
+ }
658
+ if (destCallback) {
659
+ filesDest = undefined;
660
+ }
661
+ if (applicationId) {
662
+ _context5.next = 9;
687
663
  break;
688
- case 16:
689
- console.log('Update source files SKIPPED');
690
- case 17:
691
- _context5.next = 19;
692
- return _this3.startInstrumentation(client, applicationId);
693
- case 19:
694
- instrumentation = _context5.sent;
695
- errorHandler(instrumentation);
696
- onExitCancelInstrumentation = function onExitCancelInstrumentation() {
697
- _this3.deleteProfiling(client, instrumentation.data.id).then(function () {
698
- return console.log('\n** Instrumentation %s WAS CANCELLED **', instrumentation.data.id);
699
- }).catch(function () {
700
- return debug && console.error(e);
701
- }).finally(function () {
702
- return process.exit(1);
703
- });
704
- };
705
- process.once('SIGINT', onExitCancelInstrumentation).once('SIGTERM', onExitCancelInstrumentation);
706
- _context5.next = 25;
707
- return _this3.pollInstrumentation(client, instrumentation.data.id);
708
- case 25:
709
- instrumentation = _context5.sent;
710
- process.removeListener('SIGINT', onExitCancelInstrumentation).removeListener('SIGTERM', onExitCancelInstrumentation);
711
- if (debug) {
712
- console.log("Finished instrumention with id ".concat(instrumentation.data.id, ". Downloading..."));
713
- }
714
- _context5.next = 30;
715
- return _this3.downloadApplicationInstrumented(client, instrumentation.data.id);
716
- case 30:
717
- download = _context5.sent;
718
- errorHandler(download);
719
- if (debug) {
720
- console.log('Unzipping files');
721
- }
722
- _context5.next = 35;
723
- return (0, _zip.unzip)(download, filesDest || destCallback, stream);
724
- case 35:
725
- if (debug) {
726
- console.log('Finished unzipping files');
727
- }
728
- console.warn("\n WARNING: DO NOT SEND THIS CODE TO PRODUCTION AS IT IS NOT PROTECTED\n ");
729
- console.log("Application ".concat(applicationId, " was instrumented. Bootstrap your instrumented application and run *--start-profiling* command."));
730
- return _context5.abrupt("return", instrumentation.data.id);
731
- case 39:
732
- case "end":
733
- return _context5.stop();
734
- }
664
+ }
665
+ throw new Error('Required *applicationId* not provided');
666
+ case 9:
667
+ if (!(!filesDest && !destCallback)) {
668
+ _context5.next = 11;
669
+ break;
670
+ }
671
+ throw new Error('Required *filesDest* not provided');
672
+ case 11:
673
+ if (skipSources) {
674
+ _context5.next = 16;
675
+ break;
676
+ }
677
+ _context5.next = 14;
678
+ return _this3.updateApplicationSources(client, applicationId, {
679
+ sources: sources,
680
+ filesSrc: filesSrc,
681
+ cwd: cwd
682
+ });
683
+ case 14:
684
+ _context5.next = 17;
685
+ break;
686
+ case 16:
687
+ console.log('Update source files SKIPPED');
688
+ case 17:
689
+ _context5.next = 19;
690
+ return _this3.startInstrumentation(client, applicationId);
691
+ case 19:
692
+ instrumentation = _context5.sent;
693
+ errorHandler(instrumentation);
694
+ onExitCancelInstrumentation = function onExitCancelInstrumentation() {
695
+ _this3.deleteProfiling(client, instrumentation.data.id).then(function () {
696
+ return console.log('\n** Instrumentation %s WAS CANCELLED **', instrumentation.data.id);
697
+ }).catch(function () {
698
+ return debug && console.error(e);
699
+ }).finally(function () {
700
+ return process.exit(1);
701
+ });
702
+ };
703
+ process.once('SIGINT', onExitCancelInstrumentation).once('SIGTERM', onExitCancelInstrumentation);
704
+ _context5.next = 25;
705
+ return _this3.pollInstrumentation(client, instrumentation.data.id);
706
+ case 25:
707
+ instrumentation = _context5.sent;
708
+ process.removeListener('SIGINT', onExitCancelInstrumentation).removeListener('SIGTERM', onExitCancelInstrumentation);
709
+ if (debug) {
710
+ console.log("Finished instrumention with id ".concat(instrumentation.data.id, ". Downloading..."));
711
+ }
712
+ _context5.next = 30;
713
+ return _this3.downloadApplicationInstrumented(client, instrumentation.data.id);
714
+ case 30:
715
+ download = _context5.sent;
716
+ errorHandler(download);
717
+ if (debug) {
718
+ console.log('Unzipping files');
719
+ }
720
+ _context5.next = 35;
721
+ return (0, _zip.unzip)(download, filesDest || destCallback, stream);
722
+ case 35:
723
+ if (debug) {
724
+ console.log('Finished unzipping files');
725
+ }
726
+ console.warn("\n WARNING: DO NOT SEND THIS CODE TO PRODUCTION AS IT IS NOT PROTECTED\n ");
727
+ console.log("Application ".concat(applicationId, " was instrumented. Bootstrap your instrumented application and run *--start-profiling* command."));
728
+ return _context5.abrupt("return", instrumentation.data.id);
729
+ case 39:
730
+ case "end":
731
+ return _context5.stop();
735
732
  }
736
733
  }, _callee5);
737
734
  }))();
@@ -749,57 +746,55 @@ var _default = {
749
746
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
750
747
  var finalConfig, keys, host, port, basePath, protocol, cafile, applicationId, proxy, utc, jscramblerVersion, clientId, accessKey, secretKey, client, instrumentation, previousState;
751
748
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
752
- while (1) {
753
- switch (_context6.prev = _context6.next) {
754
- case 0:
755
- finalConfig = buildFinalConfig(configPathOrObject);
756
- 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;
757
- accessKey = keys.accessKey, secretKey = keys.secretKey;
758
- client = new _this4.Client({
759
- accessKey: accessKey,
760
- secretKey: secretKey,
761
- host: host,
762
- port: port,
763
- basePath: basePath,
764
- protocol: protocol,
765
- cafile: cafile,
766
- proxy: proxy,
767
- utc: utc,
768
- jscramblerVersion: jscramblerVersion,
769
- clientId: clientId
770
- });
771
- _context6.next = 6;
772
- return client.get('/profiling-run', {
773
- applicationId: applicationId
774
- }).catch(function (e) {
775
- if (e.statusCode !== 404) throw e;
776
- });
777
- case 6:
778
- instrumentation = _context6.sent;
779
- if (instrumentation) {
780
- _context6.next = 9;
781
- break;
782
- }
783
- throw new Error('There is no active profiling run. Instrument your application first.');
784
- case 9:
785
- previousState = instrumentation.data.state;
786
- if (!(previousState === state)) {
787
- _context6.next = 13;
788
- break;
789
- }
790
- console.log("Profiling was already ".concat(label, " for application ").concat(applicationId, ". ").concat(nextStepMessage));
791
- return _context6.abrupt("return");
792
- case 13:
793
- _context6.next = 15;
794
- return client.patch("/profiling-run/".concat(instrumentation.data.id), {
795
- state: state
796
- });
797
- case 15:
798
- console.log("Profiling was ".concat(label, " for application ").concat(applicationId, ". ").concat(nextStepMessage));
799
- case 16:
800
- case "end":
801
- return _context6.stop();
802
- }
749
+ while (1) switch (_context6.prev = _context6.next) {
750
+ case 0:
751
+ finalConfig = buildFinalConfig(configPathOrObject);
752
+ 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;
753
+ accessKey = keys.accessKey, secretKey = keys.secretKey;
754
+ client = new _this4.Client({
755
+ accessKey: accessKey,
756
+ secretKey: secretKey,
757
+ host: host,
758
+ port: port,
759
+ basePath: basePath,
760
+ protocol: protocol,
761
+ cafile: cafile,
762
+ proxy: proxy,
763
+ utc: utc,
764
+ jscramblerVersion: jscramblerVersion,
765
+ clientId: clientId
766
+ });
767
+ _context6.next = 6;
768
+ return client.get('/profiling-run', {
769
+ applicationId: applicationId
770
+ }).catch(function (e) {
771
+ if (e.statusCode !== 404) throw e;
772
+ });
773
+ case 6:
774
+ instrumentation = _context6.sent;
775
+ if (instrumentation) {
776
+ _context6.next = 9;
777
+ break;
778
+ }
779
+ throw new Error('There is no active profiling run. Instrument your application first.');
780
+ case 9:
781
+ previousState = instrumentation.data.state;
782
+ if (!(previousState === state)) {
783
+ _context6.next = 13;
784
+ break;
785
+ }
786
+ console.log("Profiling was already ".concat(label, " for application ").concat(applicationId, ". ").concat(nextStepMessage));
787
+ return _context6.abrupt("return");
788
+ case 13:
789
+ _context6.next = 15;
790
+ return client.patch("/profiling-run/".concat(instrumentation.data.id), {
791
+ state: state
792
+ });
793
+ case 15:
794
+ console.log("Profiling was ".concat(label, " for application ").concat(applicationId, ". ").concat(nextStepMessage));
795
+ case 16:
796
+ case "end":
797
+ return _context6.stop();
803
798
  }
804
799
  }, _callee6);
805
800
  }))();
@@ -809,56 +804,54 @@ var _default = {
809
804
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
810
805
  var keys, host, port, basePath, protocol, cafile, _configs$stream, stream, filesDest, filesSrc, protectionId, jscramblerVersion, utc, proxy, accessKey, secretKey, client, download;
811
806
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
812
- while (1) {
813
- switch (_context7.prev = _context7.next) {
814
- case 0:
815
- 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 === void 0 ? true : _configs$stream, filesDest = configs.filesDest, filesSrc = configs.filesSrc, protectionId = configs.protectionId, jscramblerVersion = configs.jscramblerVersion, utc = configs.utc, proxy = configs.proxy;
816
- accessKey = keys.accessKey, secretKey = keys.secretKey;
817
- client = new _this5.Client({
818
- accessKey: accessKey,
819
- secretKey: secretKey,
820
- host: host,
821
- port: port,
822
- basePath: basePath,
823
- protocol: protocol,
824
- cafile: cafile,
825
- jscramblerVersion: jscramblerVersion,
826
- utc: utc,
827
- proxy: proxy
828
- });
829
- if (!(!filesDest && !destCallback)) {
830
- _context7.next = 5;
831
- break;
832
- }
833
- throw new Error('Required *filesDest* not provided');
834
- case 5:
835
- if (protectionId) {
836
- _context7.next = 7;
837
- break;
838
- }
839
- throw new Error('Required *protectionId* not provided');
840
- case 7:
841
- if (filesSrc) {
842
- console.warn('[Warning] Ignoring sources supplied. Downloading source maps of given protection');
843
- }
844
- _context7.prev = 8;
845
- _context7.next = 11;
846
- return _this5.downloadSourceMapsRequest(client, protectionId);
847
- case 11:
848
- download = _context7.sent;
849
- _context7.next = 17;
807
+ while (1) switch (_context7.prev = _context7.next) {
808
+ case 0:
809
+ 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 === void 0 ? true : _configs$stream, filesDest = configs.filesDest, filesSrc = configs.filesSrc, protectionId = configs.protectionId, jscramblerVersion = configs.jscramblerVersion, utc = configs.utc, proxy = configs.proxy;
810
+ accessKey = keys.accessKey, secretKey = keys.secretKey;
811
+ client = new _this5.Client({
812
+ accessKey: accessKey,
813
+ secretKey: secretKey,
814
+ host: host,
815
+ port: port,
816
+ basePath: basePath,
817
+ protocol: protocol,
818
+ cafile: cafile,
819
+ jscramblerVersion: jscramblerVersion,
820
+ utc: utc,
821
+ proxy: proxy
822
+ });
823
+ if (!(!filesDest && !destCallback)) {
824
+ _context7.next = 5;
850
825
  break;
851
- case 14:
852
- _context7.prev = 14;
853
- _context7.t0 = _context7["catch"](8);
854
- errorHandler(_context7.t0);
855
- case 17:
856
- _context7.next = 19;
857
- return (0, _zip.unzip)(download, filesDest || destCallback, stream);
858
- case 19:
859
- case "end":
860
- return _context7.stop();
861
- }
826
+ }
827
+ throw new Error('Required *filesDest* not provided');
828
+ case 5:
829
+ if (protectionId) {
830
+ _context7.next = 7;
831
+ break;
832
+ }
833
+ throw new Error('Required *protectionId* not provided');
834
+ case 7:
835
+ if (filesSrc) {
836
+ console.warn('[Warning] Ignoring sources supplied. Downloading source maps of given protection');
837
+ }
838
+ _context7.prev = 8;
839
+ _context7.next = 11;
840
+ return _this5.downloadSourceMapsRequest(client, protectionId);
841
+ case 11:
842
+ download = _context7.sent;
843
+ _context7.next = 17;
844
+ break;
845
+ case 14:
846
+ _context7.prev = 14;
847
+ _context7.t0 = _context7["catch"](8);
848
+ errorHandler(_context7.t0);
849
+ case 17:
850
+ _context7.next = 19;
851
+ return (0, _zip.unzip)(download, filesDest || destCallback, stream);
852
+ case 19:
853
+ case "end":
854
+ return _context7.stop();
862
855
  }
863
856
  }, _callee7, null, [[8, 14]]);
864
857
  }))();
@@ -868,59 +861,57 @@ var _default = {
868
861
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
869
862
  var keys, host, port, basePath, protocol, cafile, _configs$stream2, stream, filesDest, filesSrc, protectionId, jscramblerVersion, utc, proxy, accessKey, secretKey, client, download;
870
863
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
871
- while (1) {
872
- switch (_context8.prev = _context8.next) {
873
- case 0:
874
- 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 === void 0 ? true : _configs$stream2, filesDest = configs.filesDest, filesSrc = configs.filesSrc, protectionId = configs.protectionId, jscramblerVersion = configs.jscramblerVersion, utc = configs.utc, proxy = configs.proxy;
875
- accessKey = keys.accessKey, secretKey = keys.secretKey;
876
- client = new _this6.Client({
877
- accessKey: accessKey,
878
- secretKey: secretKey,
879
- host: host,
880
- port: port,
881
- basePath: basePath,
882
- protocol: protocol,
883
- cafile: cafile,
884
- jscramblerVersion: jscramblerVersion,
885
- utc: utc,
886
- proxy: proxy
887
- });
888
- if (!(!filesDest && !destCallback)) {
889
- _context8.next = 5;
890
- break;
891
- }
892
- throw new Error('Required *filesDest* not provided');
893
- case 5:
894
- if (protectionId) {
895
- _context8.next = 7;
896
- break;
897
- }
898
- throw new Error('Required *protectionId* not provided');
899
- case 7:
900
- if (filesSrc) {
901
- console.warn('[Warning] Ignoring sources supplied. Downloading symbol table of given protection');
902
- }
903
- _context8.prev = 8;
904
- _context8.next = 11;
905
- return _this6.downloadSymbolTableRequest(client, protectionId);
906
- case 11:
907
- download = _context8.sent;
908
- _context8.next = 17;
864
+ while (1) switch (_context8.prev = _context8.next) {
865
+ case 0:
866
+ 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 === void 0 ? true : _configs$stream2, filesDest = configs.filesDest, filesSrc = configs.filesSrc, protectionId = configs.protectionId, jscramblerVersion = configs.jscramblerVersion, utc = configs.utc, proxy = configs.proxy;
867
+ accessKey = keys.accessKey, secretKey = keys.secretKey;
868
+ client = new _this6.Client({
869
+ accessKey: accessKey,
870
+ secretKey: secretKey,
871
+ host: host,
872
+ port: port,
873
+ basePath: basePath,
874
+ protocol: protocol,
875
+ cafile: cafile,
876
+ jscramblerVersion: jscramblerVersion,
877
+ utc: utc,
878
+ proxy: proxy
879
+ });
880
+ if (!(!filesDest && !destCallback)) {
881
+ _context8.next = 5;
909
882
  break;
910
- case 14:
911
- _context8.prev = 14;
912
- _context8.t0 = _context8["catch"](8);
913
- errorHandler(_context8.t0);
914
- case 17:
915
- if (typeof destCallback === 'function') {
916
- destCallback(download, filesDest);
917
- } else {
918
- (0, _zip.outputFileSync)(_path.default.join(filesDest, "".concat(protectionId, "_symbolTable.json")), download);
919
- }
920
- case 18:
921
- case "end":
922
- return _context8.stop();
923
- }
883
+ }
884
+ throw new Error('Required *filesDest* not provided');
885
+ case 5:
886
+ if (protectionId) {
887
+ _context8.next = 7;
888
+ break;
889
+ }
890
+ throw new Error('Required *protectionId* not provided');
891
+ case 7:
892
+ if (filesSrc) {
893
+ console.warn('[Warning] Ignoring sources supplied. Downloading symbol table of given protection');
894
+ }
895
+ _context8.prev = 8;
896
+ _context8.next = 11;
897
+ return _this6.downloadSymbolTableRequest(client, protectionId);
898
+ case 11:
899
+ download = _context8.sent;
900
+ _context8.next = 17;
901
+ break;
902
+ case 14:
903
+ _context8.prev = 14;
904
+ _context8.t0 = _context8["catch"](8);
905
+ errorHandler(_context8.t0);
906
+ case 17:
907
+ if (typeof destCallback === 'function') {
908
+ destCallback(download, filesDest);
909
+ } else {
910
+ (0, _zip.outputFileSync)(_path.default.join(filesDest, "".concat(protectionId, "_symbolTable.json")), download);
911
+ }
912
+ case 18:
913
+ case "end":
914
+ return _context8.stop();
924
915
  }
925
916
  }, _callee8, null, [[8, 14]]);
926
917
  }))();
@@ -938,58 +929,54 @@ var _default = {
938
929
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
939
930
  var start, poll;
940
931
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
941
- while (1) {
942
- switch (_context10.prev = _context10.next) {
943
- case 0:
944
- start = Date.now();
945
- poll = /*#__PURE__*/function () {
946
- var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
947
- var instrumentation;
948
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
949
- while (1) {
950
- switch (_context9.prev = _context9.next) {
951
- case 0:
952
- _context9.next = 2;
953
- return _this7.getInstrumentation(client, instrumentationId);
954
- case 2:
955
- instrumentation = _context9.sent;
956
- _context9.t0 = instrumentation.data.state;
957
- _context9.next = _context9.t0 === 'DELETED' ? 6 : _context9.t0 === 'FAILED_INSTRUMENTATION' ? 7 : _context9.t0 === 'FINISHED_INSTRUMENTATION' ? 9 : 10;
958
- break;
959
- case 6:
960
- throw new Error('Protection canceled by user');
961
- case 7:
962
- instrumentation.errors = instrumentation.errors.concat(instrumentation.data.instrumentationErrors.map(function (e) {
963
- return {
964
- message: "".concat(e.message, " at ").concat(e.fileName, ":").concat(e.lineNumber)
965
- };
966
- }));
967
- return _context9.abrupt("return", errorHandler(instrumentation));
968
- case 9:
969
- return _context9.abrupt("return", instrumentation);
970
- case 10:
971
- _context9.next = 12;
972
- return new Promise(function (resolve) {
973
- return setTimeout(resolve, getPollingInterval(start));
974
- });
975
- case 12:
976
- return _context9.abrupt("return", poll());
977
- case 13:
978
- case "end":
979
- return _context9.stop();
980
- }
981
- }
982
- }, _callee9);
983
- }));
984
- return function poll() {
985
- return _ref6.apply(this, arguments);
986
- };
987
- }();
988
- return _context10.abrupt("return", poll());
989
- case 3:
990
- case "end":
991
- return _context10.stop();
992
- }
932
+ while (1) switch (_context10.prev = _context10.next) {
933
+ case 0:
934
+ start = Date.now();
935
+ poll = /*#__PURE__*/function () {
936
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
937
+ var instrumentation;
938
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
939
+ while (1) switch (_context9.prev = _context9.next) {
940
+ case 0:
941
+ _context9.next = 2;
942
+ return _this7.getInstrumentation(client, instrumentationId);
943
+ case 2:
944
+ instrumentation = _context9.sent;
945
+ _context9.t0 = instrumentation.data.state;
946
+ _context9.next = _context9.t0 === 'DELETED' ? 6 : _context9.t0 === 'FAILED_INSTRUMENTATION' ? 7 : _context9.t0 === 'FINISHED_INSTRUMENTATION' ? 9 : 10;
947
+ break;
948
+ case 6:
949
+ throw new Error('Protection canceled by user');
950
+ case 7:
951
+ instrumentation.errors = instrumentation.errors.concat(instrumentation.data.instrumentationErrors.map(function (e) {
952
+ return {
953
+ message: "".concat(e.message, " at ").concat(e.fileName, ":").concat(e.lineNumber)
954
+ };
955
+ }));
956
+ return _context9.abrupt("return", errorHandler(instrumentation));
957
+ case 9:
958
+ return _context9.abrupt("return", instrumentation);
959
+ case 10:
960
+ _context9.next = 12;
961
+ return new Promise(function (resolve) {
962
+ return setTimeout(resolve, getPollingInterval(start));
963
+ });
964
+ case 12:
965
+ return _context9.abrupt("return", poll());
966
+ case 13:
967
+ case "end":
968
+ return _context9.stop();
969
+ }
970
+ }, _callee9);
971
+ }));
972
+ return function poll() {
973
+ return _ref6.apply(this, arguments);
974
+ };
975
+ }();
976
+ return _context10.abrupt("return", poll());
977
+ case 3:
978
+ case "end":
979
+ return _context10.stop();
993
980
  }
994
981
  }, _callee10);
995
982
  }))();
@@ -998,43 +985,41 @@ var _default = {
998
985
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
999
986
  var retriesLeft;
1000
987
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1001
- while (1) {
1002
- switch (_context11.prev = _context11.next) {
1003
- case 0:
1004
- retriesLeft = _config2.default.maxRetries;
1005
- case 1:
1006
- _context11.prev = 1;
1007
- _context11.next = 4;
1008
- return action();
1009
- case 4:
1010
- return _context11.abrupt("return", _context11.sent);
1011
- case 7:
1012
- _context11.prev = 7;
1013
- _context11.t0 = _context11["catch"](1);
1014
- if (!(retriesLeft <= 0)) {
1015
- _context11.next = 11;
1016
- break;
1017
- }
1018
- throw _context11.t0;
1019
- case 11:
1020
- if (!(_context11.t0.statusCode !== _constants.HTTP_STATUS_CODES.SERVICE_UNAVAILABLE && _context11.t0.statusCode !== _constants.HTTP_STATUS_CODES.GATEWAY_TIMEOUT)) {
1021
- _context11.next = 13;
1022
- break;
1023
- }
1024
- throw _context11.t0;
1025
- case 13:
1026
- // Retry
1027
- if (debug) {
1028
- console.log('Retrying request');
1029
- }
1030
- retriesLeft--;
1031
- case 15:
1032
- _context11.next = 1;
988
+ while (1) switch (_context11.prev = _context11.next) {
989
+ case 0:
990
+ retriesLeft = _config2.default.maxRetries;
991
+ case 1:
992
+ _context11.prev = 1;
993
+ _context11.next = 4;
994
+ return action();
995
+ case 4:
996
+ return _context11.abrupt("return", _context11.sent);
997
+ case 7:
998
+ _context11.prev = 7;
999
+ _context11.t0 = _context11["catch"](1);
1000
+ if (!(retriesLeft <= 0)) {
1001
+ _context11.next = 11;
1002
+ break;
1003
+ }
1004
+ throw _context11.t0;
1005
+ case 11:
1006
+ if (!(_context11.t0.statusCode !== _constants.HTTP_STATUS_CODES.SERVICE_UNAVAILABLE && _context11.t0.statusCode !== _constants.HTTP_STATUS_CODES.GATEWAY_TIMEOUT)) {
1007
+ _context11.next = 13;
1033
1008
  break;
1034
- case 17:
1035
- case "end":
1036
- return _context11.stop();
1037
- }
1009
+ }
1010
+ throw _context11.t0;
1011
+ case 13:
1012
+ // Retry
1013
+ if (debug) {
1014
+ console.log('Retrying request');
1015
+ }
1016
+ retriesLeft--;
1017
+ case 15:
1018
+ _context11.next = 1;
1019
+ break;
1020
+ case 17:
1021
+ case "end":
1022
+ return _context11.stop();
1038
1023
  }
1039
1024
  }, _callee11, null, [[1, 7]]);
1040
1025
  }))();
@@ -1044,65 +1029,61 @@ var _default = {
1044
1029
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
1045
1030
  var start, poll;
1046
1031
  return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1047
- while (1) {
1048
- switch (_context13.prev = _context13.next) {
1049
- case 0:
1050
- start = Date.now();
1051
- poll = /*#__PURE__*/function () {
1052
- var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
1053
- var applicationProtection, state;
1054
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1055
- while (1) {
1056
- switch (_context12.prev = _context12.next) {
1057
- case 0:
1058
- _context12.next = 2;
1059
- return _this8.withRetries(function () {
1060
- return _this8.getApplicationProtection(client, applicationId, protectionId, fragments);
1061
- });
1062
- case 2:
1063
- applicationProtection = _context12.sent;
1064
- if (!applicationProtection.errors) {
1065
- _context12.next = 8;
1066
- break;
1067
- }
1068
- console.log('Error polling protection', applicationProtection.errors);
1069
- throw new Error("Protection failed. For more information visit: ".concat(APP_URL, "."));
1070
- case 8:
1071
- state = applicationProtection.data.applicationProtection.state;
1072
- if (!(state !== 'finished' && state !== 'errored' && state !== 'canceled')) {
1073
- _context12.next = 15;
1074
- break;
1075
- }
1076
- _context12.next = 12;
1077
- return new Promise(function (resolve) {
1078
- return setTimeout(resolve, getPollingInterval(start));
1079
- });
1080
- case 12:
1081
- return _context12.abrupt("return", poll());
1082
- case 15:
1083
- if (!(state === 'canceled')) {
1084
- _context12.next = 19;
1085
- break;
1086
- }
1087
- throw new Error('Protection canceled by user');
1088
- case 19:
1089
- return _context12.abrupt("return", applicationProtection.data.applicationProtection);
1090
- case 20:
1091
- case "end":
1092
- return _context12.stop();
1032
+ while (1) switch (_context13.prev = _context13.next) {
1033
+ case 0:
1034
+ start = Date.now();
1035
+ poll = /*#__PURE__*/function () {
1036
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
1037
+ var applicationProtection, state;
1038
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1039
+ while (1) switch (_context12.prev = _context12.next) {
1040
+ case 0:
1041
+ _context12.next = 2;
1042
+ return _this8.withRetries(function () {
1043
+ return _this8.getApplicationProtection(client, applicationId, protectionId, fragments);
1044
+ });
1045
+ case 2:
1046
+ applicationProtection = _context12.sent;
1047
+ if (!applicationProtection.errors) {
1048
+ _context12.next = 8;
1049
+ break;
1093
1050
  }
1094
- }
1095
- }, _callee12);
1096
- }));
1097
- return function poll() {
1098
- return _ref7.apply(this, arguments);
1099
- };
1100
- }();
1101
- return _context13.abrupt("return", poll());
1102
- case 3:
1103
- case "end":
1104
- return _context13.stop();
1105
- }
1051
+ console.log('Error polling protection', applicationProtection.errors);
1052
+ throw new Error("Protection failed. For more information visit: ".concat(APP_URL, "."));
1053
+ case 8:
1054
+ state = applicationProtection.data.applicationProtection.state;
1055
+ if (!(state !== 'finished' && state !== 'errored' && state !== 'canceled')) {
1056
+ _context12.next = 15;
1057
+ break;
1058
+ }
1059
+ _context12.next = 12;
1060
+ return new Promise(function (resolve) {
1061
+ return setTimeout(resolve, getPollingInterval(start));
1062
+ });
1063
+ case 12:
1064
+ return _context12.abrupt("return", poll());
1065
+ case 15:
1066
+ if (!(state === 'canceled')) {
1067
+ _context12.next = 19;
1068
+ break;
1069
+ }
1070
+ throw new Error('Protection canceled by user');
1071
+ case 19:
1072
+ return _context12.abrupt("return", applicationProtection.data.applicationProtection);
1073
+ case 20:
1074
+ case "end":
1075
+ return _context12.stop();
1076
+ }
1077
+ }, _callee12);
1078
+ }));
1079
+ return function poll() {
1080
+ return _ref7.apply(this, arguments);
1081
+ };
1082
+ }();
1083
+ return _context13.abrupt("return", poll());
1084
+ case 3:
1085
+ case "end":
1086
+ return _context13.stop();
1106
1087
  }
1107
1088
  }, _callee13);
1108
1089
  }))();
@@ -1112,87 +1093,83 @@ var _default = {
1112
1093
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
1113
1094
  var start, seen, poll;
1114
1095
  return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1115
- while (1) {
1116
- switch (_context15.prev = _context15.next) {
1117
- case 0:
1118
- if (!(protectionIds.length === 1)) {
1119
- _context15.next = 5;
1120
- break;
1121
- }
1122
- _context15.next = 3;
1123
- return _this9.pollProtection(client, applicationId, protectionIds[0], fragments);
1124
- case 3:
1125
- _context15.t0 = _context15.sent;
1126
- return _context15.abrupt("return", [_context15.t0]);
1127
- case 5:
1128
- start = Date.now();
1129
- seen = {};
1130
- poll = /*#__PURE__*/function () {
1131
- var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
1132
- var applicationProtections, ended;
1133
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1134
- while (1) {
1135
- switch (_context14.prev = _context14.next) {
1136
- case 0:
1137
- _context14.next = 2;
1138
- return _this9.withRetries(function () {
1139
- return _this9.getApplicationProtections(client, applicationId, {
1140
- protectionIds: protectionIds
1141
- }, fragments.applicationProtection, ["$protectionIds: [String]"]);
1142
- });
1143
- case 2:
1144
- applicationProtections = _context14.sent;
1145
- if (!applicationProtections.errors) {
1146
- _context14.next = 8;
1147
- break;
1148
- }
1149
- console.log('Error polling protection', applicationProtections.errors);
1150
- throw new Error("Protection failed. For more information visit: ".concat(APP_URL, "."));
1151
- case 8:
1152
- ended = applicationProtections.data.applicationProtections.filter(function (_ref9) {
1153
- var state = _ref9.state;
1154
- return state === 'finished' || state === 'errored' || state === 'canceled';
1155
- }); // print progress
1156
- ended.filter(function (_ref10) {
1157
- var _id = _ref10._id,
1158
- state = _ref10.state;
1159
- return !seen[_id] && state !== 'canceled';
1160
- }).forEach(function (_ref11) {
1161
- var _id = _ref11._id,
1162
- startedAt = _ref11.startedAt,
1163
- finishedAt = _ref11.finishedAt,
1164
- state = _ref11.state;
1165
- seen[_id] = true;
1166
- console.log("[".concat(Object.keys(seen).length, "/").concat(protectionIds.length, "] Protection=").concat(_id, ", state=").concat(state, ", build-time=").concat(Math.round((new Date(finishedAt) - new Date(startedAt)) / 1000), "s"));
1167
- });
1168
- if (!(ended.length < protectionIds.length)) {
1169
- _context14.next = 14;
1170
- break;
1171
- }
1172
- _context14.next = 13;
1173
- return new Promise(function (resolve) {
1174
- return setTimeout(resolve, getPollingInterval(start));
1175
- });
1176
- case 13:
1177
- return _context14.abrupt("return", poll());
1178
- case 14:
1179
- return _context14.abrupt("return", applicationProtections.data.applicationProtections);
1180
- case 15:
1181
- case "end":
1182
- return _context14.stop();
1096
+ while (1) switch (_context15.prev = _context15.next) {
1097
+ case 0:
1098
+ if (!(protectionIds.length === 1)) {
1099
+ _context15.next = 5;
1100
+ break;
1101
+ }
1102
+ _context15.next = 3;
1103
+ return _this9.pollProtection(client, applicationId, protectionIds[0], fragments);
1104
+ case 3:
1105
+ _context15.t0 = _context15.sent;
1106
+ return _context15.abrupt("return", [_context15.t0]);
1107
+ case 5:
1108
+ start = Date.now();
1109
+ seen = {};
1110
+ poll = /*#__PURE__*/function () {
1111
+ var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
1112
+ var applicationProtections, ended;
1113
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1114
+ while (1) switch (_context14.prev = _context14.next) {
1115
+ case 0:
1116
+ _context14.next = 2;
1117
+ return _this9.withRetries(function () {
1118
+ return _this9.getApplicationProtections(client, applicationId, {
1119
+ protectionIds: protectionIds
1120
+ }, fragments.applicationProtection, ["$protectionIds: [String]"]);
1121
+ });
1122
+ case 2:
1123
+ applicationProtections = _context14.sent;
1124
+ if (!applicationProtections.errors) {
1125
+ _context14.next = 8;
1126
+ break;
1183
1127
  }
1184
- }
1185
- }, _callee14);
1186
- }));
1187
- return function poll() {
1188
- return _ref8.apply(this, arguments);
1189
- };
1190
- }();
1191
- return _context15.abrupt("return", poll());
1192
- case 9:
1193
- case "end":
1194
- return _context15.stop();
1195
- }
1128
+ console.log('Error polling protection', applicationProtections.errors);
1129
+ throw new Error("Protection failed. For more information visit: ".concat(APP_URL, "."));
1130
+ case 8:
1131
+ ended = applicationProtections.data.applicationProtections.filter(function (_ref9) {
1132
+ var state = _ref9.state;
1133
+ return state === 'finished' || state === 'errored' || state === 'canceled';
1134
+ }); // print progress
1135
+ ended.filter(function (_ref10) {
1136
+ var _id = _ref10._id,
1137
+ state = _ref10.state;
1138
+ return !seen[_id] && state !== 'canceled';
1139
+ }).forEach(function (_ref11) {
1140
+ var _id = _ref11._id,
1141
+ startedAt = _ref11.startedAt,
1142
+ finishedAt = _ref11.finishedAt,
1143
+ state = _ref11.state;
1144
+ seen[_id] = true;
1145
+ console.log("[".concat(Object.keys(seen).length, "/").concat(protectionIds.length, "] Protection=").concat(_id, ", state=").concat(state, ", build-time=").concat(Math.round((new Date(finishedAt) - new Date(startedAt)) / 1000), "s"));
1146
+ });
1147
+ if (!(ended.length < protectionIds.length)) {
1148
+ _context14.next = 14;
1149
+ break;
1150
+ }
1151
+ _context14.next = 13;
1152
+ return new Promise(function (resolve) {
1153
+ return setTimeout(resolve, getPollingInterval(start));
1154
+ });
1155
+ case 13:
1156
+ return _context14.abrupt("return", poll());
1157
+ case 14:
1158
+ return _context14.abrupt("return", applicationProtections.data.applicationProtections);
1159
+ case 15:
1160
+ case "end":
1161
+ return _context14.stop();
1162
+ }
1163
+ }, _callee14);
1164
+ }));
1165
+ return function poll() {
1166
+ return _ref8.apply(this, arguments);
1167
+ };
1168
+ }();
1169
+ return _context15.abrupt("return", poll());
1170
+ case 9:
1171
+ case "end":
1172
+ return _context15.stop();
1196
1173
  }
1197
1174
  }, _callee15);
1198
1175
  }))();
@@ -1201,14 +1178,12 @@ var _default = {
1201
1178
  createApplication: function createApplication(client, data, fragments) {
1202
1179
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
1203
1180
  return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1204
- while (1) {
1205
- switch (_context16.prev = _context16.next) {
1206
- case 0:
1207
- return _context16.abrupt("return", client.post('/application', mutations.createApplication(data, fragments)));
1208
- case 1:
1209
- case "end":
1210
- return _context16.stop();
1211
- }
1181
+ while (1) switch (_context16.prev = _context16.next) {
1182
+ case 0:
1183
+ return _context16.abrupt("return", client.post('/application', mutations.createApplication(data, fragments)));
1184
+ case 1:
1185
+ case "end":
1186
+ return _context16.stop();
1212
1187
  }
1213
1188
  }, _callee16);
1214
1189
  }))();
@@ -1217,14 +1192,12 @@ var _default = {
1217
1192
  duplicateApplication: function duplicateApplication(client, data, fragments) {
1218
1193
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
1219
1194
  return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1220
- while (1) {
1221
- switch (_context17.prev = _context17.next) {
1222
- case 0:
1223
- return _context17.abrupt("return", client.post('/application', mutations.duplicateApplication(data, fragments)));
1224
- case 1:
1225
- case "end":
1226
- return _context17.stop();
1227
- }
1195
+ while (1) switch (_context17.prev = _context17.next) {
1196
+ case 0:
1197
+ return _context17.abrupt("return", client.post('/application', mutations.duplicateApplication(data, fragments)));
1198
+ case 1:
1199
+ case "end":
1200
+ return _context17.stop();
1228
1201
  }
1229
1202
  }, _callee17);
1230
1203
  }))();
@@ -1233,14 +1206,12 @@ var _default = {
1233
1206
  removeApplication: function removeApplication(client, id) {
1234
1207
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
1235
1208
  return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1236
- while (1) {
1237
- switch (_context18.prev = _context18.next) {
1238
- case 0:
1239
- return _context18.abrupt("return", client.post('/application', mutations.removeApplication(id)));
1240
- case 1:
1241
- case "end":
1242
- return _context18.stop();
1243
- }
1209
+ while (1) switch (_context18.prev = _context18.next) {
1210
+ case 0:
1211
+ return _context18.abrupt("return", client.post('/application', mutations.removeApplication(id)));
1212
+ case 1:
1213
+ case "end":
1214
+ return _context18.stop();
1244
1215
  }
1245
1216
  }, _callee18);
1246
1217
  }))();
@@ -1249,14 +1220,12 @@ var _default = {
1249
1220
  removeProtection: function removeProtection(client, id, appId, fragments) {
1250
1221
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
1251
1222
  return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1252
- while (1) {
1253
- switch (_context19.prev = _context19.next) {
1254
- case 0:
1255
- return _context19.abrupt("return", client.post('/application', mutations.removeProtection(id, appId, fragments)));
1256
- case 1:
1257
- case "end":
1258
- return _context19.stop();
1259
- }
1223
+ while (1) switch (_context19.prev = _context19.next) {
1224
+ case 0:
1225
+ return _context19.abrupt("return", client.post('/application', mutations.removeProtection(id, appId, fragments)));
1226
+ case 1:
1227
+ case "end":
1228
+ return _context19.stop();
1260
1229
  }
1261
1230
  }, _callee19);
1262
1231
  }))();
@@ -1266,18 +1235,16 @@ var _default = {
1266
1235
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1267
1236
  var mutation;
1268
1237
  return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1269
- while (1) {
1270
- switch (_context20.prev = _context20.next) {
1271
- case 0:
1272
- _context20.next = 2;
1273
- return mutations.cancelProtection(id, appId, fragments);
1274
- case 2:
1275
- mutation = _context20.sent;
1276
- return _context20.abrupt("return", client.post('/application', mutation));
1277
- case 4:
1278
- case "end":
1279
- return _context20.stop();
1280
- }
1238
+ while (1) switch (_context20.prev = _context20.next) {
1239
+ case 0:
1240
+ _context20.next = 2;
1241
+ return mutations.cancelProtection(id, appId, fragments);
1242
+ case 2:
1243
+ mutation = _context20.sent;
1244
+ return _context20.abrupt("return", client.post('/application', mutation));
1245
+ case 4:
1246
+ case "end":
1247
+ return _context20.stop();
1281
1248
  }
1282
1249
  }, _callee20);
1283
1250
  }))();
@@ -1287,18 +1254,16 @@ var _default = {
1287
1254
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1288
1255
  var mutation;
1289
1256
  return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1290
- while (1) {
1291
- switch (_context21.prev = _context21.next) {
1292
- case 0:
1293
- _context21.next = 2;
1294
- return mutations.updateApplication(application, fragments);
1295
- case 2:
1296
- mutation = _context21.sent;
1297
- return _context21.abrupt("return", client.post('/application', mutation));
1298
- case 4:
1299
- case "end":
1300
- return _context21.stop();
1301
- }
1257
+ while (1) switch (_context21.prev = _context21.next) {
1258
+ case 0:
1259
+ _context21.next = 2;
1260
+ return mutations.updateApplication(application, fragments);
1261
+ case 2:
1262
+ mutation = _context21.sent;
1263
+ return _context21.abrupt("return", client.post('/application', mutation));
1264
+ case 4:
1265
+ case "end":
1266
+ return _context21.stop();
1302
1267
  }
1303
1268
  }, _callee21);
1304
1269
  }))();
@@ -1308,18 +1273,16 @@ var _default = {
1308
1273
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1309
1274
  var mutation;
1310
1275
  return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1311
- while (1) {
1312
- switch (_context22.prev = _context22.next) {
1313
- case 0:
1314
- _context22.next = 2;
1315
- return mutations.unlockApplication(application, fragments);
1316
- case 2:
1317
- mutation = _context22.sent;
1318
- return _context22.abrupt("return", client.post('/application', mutation));
1319
- case 4:
1320
- case "end":
1321
- return _context22.stop();
1322
- }
1276
+ while (1) switch (_context22.prev = _context22.next) {
1277
+ case 0:
1278
+ _context22.next = 2;
1279
+ return mutations.unlockApplication(application, fragments);
1280
+ case 2:
1281
+ mutation = _context22.sent;
1282
+ return _context22.abrupt("return", client.post('/application', mutation));
1283
+ case 4:
1284
+ case "end":
1285
+ return _context22.stop();
1323
1286
  }
1324
1287
  }, _callee22);
1325
1288
  }))();
@@ -1329,18 +1292,16 @@ var _default = {
1329
1292
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
1330
1293
  var query;
1331
1294
  return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1332
- while (1) {
1333
- switch (_context23.prev = _context23.next) {
1334
- case 0:
1335
- _context23.next = 2;
1336
- return queries.getApplication(applicationId, fragments, params);
1337
- case 2:
1338
- query = _context23.sent;
1339
- return _context23.abrupt("return", client.get('/application', query));
1340
- case 4:
1341
- case "end":
1342
- return _context23.stop();
1343
- }
1295
+ while (1) switch (_context23.prev = _context23.next) {
1296
+ case 0:
1297
+ _context23.next = 2;
1298
+ return queries.getApplication(applicationId, fragments, params);
1299
+ case 2:
1300
+ query = _context23.sent;
1301
+ return _context23.abrupt("return", client.get('/application', query));
1302
+ case 4:
1303
+ case "end":
1304
+ return _context23.stop();
1344
1305
  }
1345
1306
  }, _callee23);
1346
1307
  }))();
@@ -1350,18 +1311,16 @@ var _default = {
1350
1311
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
1351
1312
  var query;
1352
1313
  return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1353
- while (1) {
1354
- switch (_context24.prev = _context24.next) {
1355
- case 0:
1356
- _context24.next = 2;
1357
- return queries.getApplicationSource(sourceId, fragments, limits);
1358
- case 2:
1359
- query = _context24.sent;
1360
- return _context24.abrupt("return", client.get('/application', query));
1361
- case 4:
1362
- case "end":
1363
- return _context24.stop();
1364
- }
1314
+ while (1) switch (_context24.prev = _context24.next) {
1315
+ case 0:
1316
+ _context24.next = 2;
1317
+ return queries.getApplicationSource(sourceId, fragments, limits);
1318
+ case 2:
1319
+ query = _context24.sent;
1320
+ return _context24.abrupt("return", client.get('/application', query));
1321
+ case 4:
1322
+ case "end":
1323
+ return _context24.stop();
1365
1324
  }
1366
1325
  }, _callee24);
1367
1326
  }))();
@@ -1371,15 +1330,13 @@ var _default = {
1371
1330
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1372
1331
  var query;
1373
1332
  return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1374
- while (1) {
1375
- switch (_context25.prev = _context25.next) {
1376
- case 0:
1377
- query = queries.getApplicationProtections(applicationId, params, fragments, queryArgs);
1378
- return _context25.abrupt("return", client.get('/application', query));
1379
- case 2:
1380
- case "end":
1381
- return _context25.stop();
1382
- }
1333
+ while (1) switch (_context25.prev = _context25.next) {
1334
+ case 0:
1335
+ query = queries.getApplicationProtections(applicationId, params, fragments, queryArgs);
1336
+ return _context25.abrupt("return", client.get('/application', query));
1337
+ case 2:
1338
+ case "end":
1339
+ return _context25.stop();
1383
1340
  }
1384
1341
  }, _callee25);
1385
1342
  }))();
@@ -1389,18 +1346,16 @@ var _default = {
1389
1346
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
1390
1347
  var query;
1391
1348
  return _regeneratorRuntime().wrap(function _callee26$(_context26) {
1392
- while (1) {
1393
- switch (_context26.prev = _context26.next) {
1394
- case 0:
1395
- _context26.next = 2;
1396
- return queries.getApplicationProtectionsCount(applicationId, fragments);
1397
- case 2:
1398
- query = _context26.sent;
1399
- return _context26.abrupt("return", client.get('/application', query));
1400
- case 4:
1401
- case "end":
1402
- return _context26.stop();
1403
- }
1349
+ while (1) switch (_context26.prev = _context26.next) {
1350
+ case 0:
1351
+ _context26.next = 2;
1352
+ return queries.getApplicationProtectionsCount(applicationId, fragments);
1353
+ case 2:
1354
+ query = _context26.sent;
1355
+ return _context26.abrupt("return", client.get('/application', query));
1356
+ case 4:
1357
+ case "end":
1358
+ return _context26.stop();
1404
1359
  }
1405
1360
  }, _callee26);
1406
1361
  }))();
@@ -1410,18 +1365,16 @@ var _default = {
1410
1365
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
1411
1366
  var mutation;
1412
1367
  return _regeneratorRuntime().wrap(function _callee27$(_context27) {
1413
- while (1) {
1414
- switch (_context27.prev = _context27.next) {
1415
- case 0:
1416
- _context27.next = 2;
1417
- return mutations.createTemplate(template, fragments);
1418
- case 2:
1419
- mutation = _context27.sent;
1420
- return _context27.abrupt("return", client.post('/application', mutation));
1421
- case 4:
1422
- case "end":
1423
- return _context27.stop();
1424
- }
1368
+ while (1) switch (_context27.prev = _context27.next) {
1369
+ case 0:
1370
+ _context27.next = 2;
1371
+ return mutations.createTemplate(template, fragments);
1372
+ case 2:
1373
+ mutation = _context27.sent;
1374
+ return _context27.abrupt("return", client.post('/application', mutation));
1375
+ case 4:
1376
+ case "end":
1377
+ return _context27.stop();
1425
1378
  }
1426
1379
  }, _callee27);
1427
1380
  }))();
@@ -1431,18 +1384,16 @@ var _default = {
1431
1384
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
1432
1385
  var mutation;
1433
1386
  return _regeneratorRuntime().wrap(function _callee28$(_context28) {
1434
- while (1) {
1435
- switch (_context28.prev = _context28.next) {
1436
- case 0:
1437
- _context28.next = 2;
1438
- return mutations.removeTemplate(id);
1439
- case 2:
1440
- mutation = _context28.sent;
1441
- return _context28.abrupt("return", client.post('/application', mutation));
1442
- case 4:
1443
- case "end":
1444
- return _context28.stop();
1445
- }
1387
+ while (1) switch (_context28.prev = _context28.next) {
1388
+ case 0:
1389
+ _context28.next = 2;
1390
+ return mutations.removeTemplate(id);
1391
+ case 2:
1392
+ mutation = _context28.sent;
1393
+ return _context28.abrupt("return", client.post('/application', mutation));
1394
+ case 4:
1395
+ case "end":
1396
+ return _context28.stop();
1446
1397
  }
1447
1398
  }, _callee28);
1448
1399
  }))();
@@ -1452,18 +1403,16 @@ var _default = {
1452
1403
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
1453
1404
  var query;
1454
1405
  return _regeneratorRuntime().wrap(function _callee29$(_context29) {
1455
- while (1) {
1456
- switch (_context29.prev = _context29.next) {
1457
- case 0:
1458
- _context29.next = 2;
1459
- return queries.getTemplates(fragments);
1460
- case 2:
1461
- query = _context29.sent;
1462
- return _context29.abrupt("return", client.get('/application', query));
1463
- case 4:
1464
- case "end":
1465
- return _context29.stop();
1466
- }
1406
+ while (1) switch (_context29.prev = _context29.next) {
1407
+ case 0:
1408
+ _context29.next = 2;
1409
+ return queries.getTemplates(fragments);
1410
+ case 2:
1411
+ query = _context29.sent;
1412
+ return _context29.abrupt("return", client.get('/application', query));
1413
+ case 4:
1414
+ case "end":
1415
+ return _context29.stop();
1467
1416
  }
1468
1417
  }, _callee29);
1469
1418
  }))();
@@ -1473,18 +1422,16 @@ var _default = {
1473
1422
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
1474
1423
  var query;
1475
1424
  return _regeneratorRuntime().wrap(function _callee30$(_context30) {
1476
- while (1) {
1477
- switch (_context30.prev = _context30.next) {
1478
- case 0:
1479
- _context30.next = 2;
1480
- return queries.getApplications(fragments, params);
1481
- case 2:
1482
- query = _context30.sent;
1483
- return _context30.abrupt("return", client.get('/application', query));
1484
- case 4:
1485
- case "end":
1486
- return _context30.stop();
1487
- }
1425
+ while (1) switch (_context30.prev = _context30.next) {
1426
+ case 0:
1427
+ _context30.next = 2;
1428
+ return queries.getApplications(fragments, params);
1429
+ case 2:
1430
+ query = _context30.sent;
1431
+ return _context30.abrupt("return", client.get('/application', query));
1432
+ case 4:
1433
+ case "end":
1434
+ return _context30.stop();
1488
1435
  }
1489
1436
  }, _callee30);
1490
1437
  }))();
@@ -1495,20 +1442,18 @@ var _default = {
1495
1442
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
1496
1443
  var mutation;
1497
1444
  return _regeneratorRuntime().wrap(function _callee31$(_context31) {
1498
- while (1) {
1499
- switch (_context31.prev = _context31.next) {
1500
- case 0:
1501
- _context31.next = 2;
1502
- return mutations.addApplicationSource(applicationId, applicationSource, fragments);
1503
- case 2:
1504
- mutation = _context31.sent;
1505
- return _context31.abrupt("return", _this10.withRetries(function () {
1506
- return client.post('/application', mutation);
1507
- }));
1508
- case 4:
1509
- case "end":
1510
- return _context31.stop();
1511
- }
1445
+ while (1) switch (_context31.prev = _context31.next) {
1446
+ case 0:
1447
+ _context31.next = 2;
1448
+ return mutations.addApplicationSource(applicationId, applicationSource, fragments);
1449
+ case 2:
1450
+ mutation = _context31.sent;
1451
+ return _context31.abrupt("return", _this10.withRetries(function () {
1452
+ return client.post('/application', mutation);
1453
+ }));
1454
+ case 4:
1455
+ case "end":
1456
+ return _context31.stop();
1512
1457
  }
1513
1458
  }, _callee31);
1514
1459
  }))();
@@ -1518,22 +1463,20 @@ var _default = {
1518
1463
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
1519
1464
  var file, mutation;
1520
1465
  return _regeneratorRuntime().wrap(function _callee32$(_context32) {
1521
- while (1) {
1522
- switch (_context32.prev = _context32.next) {
1523
- case 0:
1524
- _context32.next = 2;
1525
- return getFileFromUrl(client, url);
1526
- case 2:
1527
- file = _context32.sent;
1528
- _context32.next = 5;
1529
- return mutations.addApplicationSource(applicationId, file, fragments);
1530
- case 5:
1531
- mutation = _context32.sent;
1532
- return _context32.abrupt("return", client.post('/application', mutation));
1533
- case 7:
1534
- case "end":
1535
- return _context32.stop();
1536
- }
1466
+ while (1) switch (_context32.prev = _context32.next) {
1467
+ case 0:
1468
+ _context32.next = 2;
1469
+ return getFileFromUrl(client, url);
1470
+ case 2:
1471
+ file = _context32.sent;
1472
+ _context32.next = 5;
1473
+ return mutations.addApplicationSource(applicationId, file, fragments);
1474
+ case 5:
1475
+ mutation = _context32.sent;
1476
+ return _context32.abrupt("return", client.post('/application', mutation));
1477
+ case 7:
1478
+ case "end":
1479
+ return _context32.stop();
1537
1480
  }
1538
1481
  }, _callee32);
1539
1482
  }))();
@@ -1543,18 +1486,16 @@ var _default = {
1543
1486
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
1544
1487
  var mutation;
1545
1488
  return _regeneratorRuntime().wrap(function _callee33$(_context33) {
1546
- while (1) {
1547
- switch (_context33.prev = _context33.next) {
1548
- case 0:
1549
- _context33.next = 2;
1550
- return mutations.updateApplicationSource(applicationSource, fragments);
1551
- case 2:
1552
- mutation = _context33.sent;
1553
- return _context33.abrupt("return", client.post('/application', mutation));
1554
- case 4:
1555
- case "end":
1556
- return _context33.stop();
1557
- }
1489
+ while (1) switch (_context33.prev = _context33.next) {
1490
+ case 0:
1491
+ _context33.next = 2;
1492
+ return mutations.updateApplicationSource(applicationSource, fragments);
1493
+ case 2:
1494
+ mutation = _context33.sent;
1495
+ return _context33.abrupt("return", client.post('/application', mutation));
1496
+ case 4:
1497
+ case "end":
1498
+ return _context33.stop();
1558
1499
  }
1559
1500
  }, _callee33);
1560
1501
  }))();
@@ -1565,20 +1506,18 @@ var _default = {
1565
1506
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
1566
1507
  var mutation;
1567
1508
  return _regeneratorRuntime().wrap(function _callee34$(_context34) {
1568
- while (1) {
1569
- switch (_context34.prev = _context34.next) {
1570
- case 0:
1571
- _context34.next = 2;
1572
- return mutations.removeSourceFromApplication(sourceId, applicationId, fragments);
1573
- case 2:
1574
- mutation = _context34.sent;
1575
- return _context34.abrupt("return", _this11.withRetries(function () {
1576
- return client.post('/application', mutation);
1577
- }));
1578
- case 4:
1579
- case "end":
1580
- return _context34.stop();
1581
- }
1509
+ while (1) switch (_context34.prev = _context34.next) {
1510
+ case 0:
1511
+ _context34.next = 2;
1512
+ return mutations.removeSourceFromApplication(sourceId, applicationId, fragments);
1513
+ case 2:
1514
+ mutation = _context34.sent;
1515
+ return _context34.abrupt("return", _this11.withRetries(function () {
1516
+ return client.post('/application', mutation);
1517
+ }));
1518
+ case 4:
1519
+ case "end":
1520
+ return _context34.stop();
1582
1521
  }
1583
1522
  }, _callee34);
1584
1523
  }))();
@@ -1588,18 +1527,16 @@ var _default = {
1588
1527
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
1589
1528
  var mutation;
1590
1529
  return _regeneratorRuntime().wrap(function _callee35$(_context35) {
1591
- while (1) {
1592
- switch (_context35.prev = _context35.next) {
1593
- case 0:
1594
- _context35.next = 2;
1595
- return mutations.applyTemplate(templateId, appId, fragments);
1596
- case 2:
1597
- mutation = _context35.sent;
1598
- return _context35.abrupt("return", client.post('/application', mutation));
1599
- case 4:
1600
- case "end":
1601
- return _context35.stop();
1602
- }
1530
+ while (1) switch (_context35.prev = _context35.next) {
1531
+ case 0:
1532
+ _context35.next = 2;
1533
+ return mutations.applyTemplate(templateId, appId, fragments);
1534
+ case 2:
1535
+ mutation = _context35.sent;
1536
+ return _context35.abrupt("return", client.post('/application', mutation));
1537
+ case 4:
1538
+ case "end":
1539
+ return _context35.stop();
1603
1540
  }
1604
1541
  }, _callee35);
1605
1542
  }))();
@@ -1609,18 +1546,16 @@ var _default = {
1609
1546
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
1610
1547
  var mutation;
1611
1548
  return _regeneratorRuntime().wrap(function _callee36$(_context36) {
1612
- while (1) {
1613
- switch (_context36.prev = _context36.next) {
1614
- case 0:
1615
- _context36.next = 2;
1616
- return mutations.updateTemplate(template, fragments);
1617
- case 2:
1618
- mutation = _context36.sent;
1619
- return _context36.abrupt("return", client.post('/application', mutation));
1620
- case 4:
1621
- case "end":
1622
- return _context36.stop();
1623
- }
1549
+ while (1) switch (_context36.prev = _context36.next) {
1550
+ case 0:
1551
+ _context36.next = 2;
1552
+ return mutations.updateTemplate(template, fragments);
1553
+ case 2:
1554
+ mutation = _context36.sent;
1555
+ return _context36.abrupt("return", client.post('/application', mutation));
1556
+ case 4:
1557
+ case "end":
1558
+ return _context36.stop();
1624
1559
  }
1625
1560
  }, _callee36);
1626
1561
  }))();
@@ -1628,16 +1563,14 @@ var _default = {
1628
1563
  getApplicationProfiling: function getApplicationProfiling(client, applicationId) {
1629
1564
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
1630
1565
  return _regeneratorRuntime().wrap(function _callee37$(_context37) {
1631
- while (1) {
1632
- switch (_context37.prev = _context37.next) {
1633
- case 0:
1634
- return _context37.abrupt("return", client.get('/profiling-run', {
1635
- applicationId: applicationId
1636
- }));
1637
- case 1:
1638
- case "end":
1639
- return _context37.stop();
1640
- }
1566
+ while (1) switch (_context37.prev = _context37.next) {
1567
+ case 0:
1568
+ return _context37.abrupt("return", client.get('/profiling-run', {
1569
+ applicationId: applicationId
1570
+ }));
1571
+ case 1:
1572
+ case "end":
1573
+ return _context37.stop();
1641
1574
  }
1642
1575
  }, _callee37);
1643
1576
  }))();
@@ -1645,16 +1578,14 @@ var _default = {
1645
1578
  deleteProfiling: function deleteProfiling(client, profilingId) {
1646
1579
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
1647
1580
  return _regeneratorRuntime().wrap(function _callee38$(_context38) {
1648
- while (1) {
1649
- switch (_context38.prev = _context38.next) {
1650
- case 0:
1651
- return _context38.abrupt("return", client.patch("/profiling-run/".concat(profilingId), {
1652
- state: 'DELETED'
1653
- }));
1654
- case 1:
1655
- case "end":
1656
- return _context38.stop();
1657
- }
1581
+ while (1) switch (_context38.prev = _context38.next) {
1582
+ case 0:
1583
+ return _context38.abrupt("return", client.patch("/profiling-run/".concat(profilingId), {
1584
+ state: 'DELETED'
1585
+ }));
1586
+ case 1:
1587
+ case "end":
1588
+ return _context38.stop();
1658
1589
  }
1659
1590
  }, _callee38);
1660
1591
  }))();
@@ -1671,29 +1602,27 @@ var _default = {
1671
1602
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
1672
1603
  var instrumentation;
1673
1604
  return _regeneratorRuntime().wrap(function _callee39$(_context39) {
1674
- while (1) {
1675
- switch (_context39.prev = _context39.next) {
1676
- case 0:
1677
- _context39.next = 2;
1678
- return _this12.getApplicationProfiling(client, applicationId).catch(function (e) {
1679
- if (e.statusCode !== 404) throw e;
1680
- });
1681
- case 2:
1682
- instrumentation = _context39.sent;
1683
- if (!instrumentation) {
1684
- _context39.next = 6;
1685
- break;
1686
- }
1605
+ while (1) switch (_context39.prev = _context39.next) {
1606
+ case 0:
1607
+ _context39.next = 2;
1608
+ return _this12.getApplicationProfiling(client, applicationId).catch(function (e) {
1609
+ if (e.statusCode !== 404) throw e;
1610
+ });
1611
+ case 2:
1612
+ instrumentation = _context39.sent;
1613
+ if (!instrumentation) {
1687
1614
  _context39.next = 6;
1688
- return _this12.deleteProfiling(client, instrumentation.data.id);
1689
- case 6:
1690
- return _context39.abrupt("return", client.post('/profiling-run', {
1691
- applicationId: applicationId
1692
- }));
1693
- case 7:
1694
- case "end":
1695
- return _context39.stop();
1696
- }
1615
+ break;
1616
+ }
1617
+ _context39.next = 6;
1618
+ return _this12.deleteProfiling(client, instrumentation.data.id);
1619
+ case 6:
1620
+ return _context39.abrupt("return", client.post('/profiling-run', {
1621
+ applicationId: applicationId
1622
+ }));
1623
+ case 7:
1624
+ case "end":
1625
+ return _context39.stop();
1697
1626
  }
1698
1627
  }, _callee39);
1699
1628
  }))();
@@ -1703,23 +1632,21 @@ var _default = {
1703
1632
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
1704
1633
  var _yield$introspection$, args, mutation;
1705
1634
  return _regeneratorRuntime().wrap(function _callee40$(_context40) {
1706
- while (1) {
1707
- switch (_context40.prev = _context40.next) {
1708
- case 0:
1709
- _context40.next = 2;
1710
- return introspection.mutation(client, 'createApplicationProtection');
1711
- case 2:
1712
- _yield$introspection$ = _context40.sent;
1713
- args = _yield$introspection$.args;
1714
- _context40.next = 6;
1715
- return mutations.createApplicationProtection(applicationId, fragments, protectionOptions, args);
1716
- case 6:
1717
- mutation = _context40.sent;
1718
- return _context40.abrupt("return", client.post('/application', mutation));
1719
- case 8:
1720
- case "end":
1721
- return _context40.stop();
1722
- }
1635
+ while (1) switch (_context40.prev = _context40.next) {
1636
+ case 0:
1637
+ _context40.next = 2;
1638
+ return introspection.mutation(client, 'createApplicationProtection');
1639
+ case 2:
1640
+ _yield$introspection$ = _context40.sent;
1641
+ args = _yield$introspection$.args;
1642
+ _context40.next = 6;
1643
+ return mutations.createApplicationProtection(applicationId, fragments, protectionOptions, args);
1644
+ case 6:
1645
+ mutation = _context40.sent;
1646
+ return _context40.abrupt("return", client.post('/application', mutation));
1647
+ case 8:
1648
+ case "end":
1649
+ return _context40.stop();
1723
1650
  }
1724
1651
  }, _callee40);
1725
1652
  }))();
@@ -1738,52 +1665,50 @@ var _default = {
1738
1665
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
1739
1666
  var result, mutationType, mutation;
1740
1667
  return _regeneratorRuntime().wrap(function _callee41$(_context41) {
1741
- while (1) {
1742
- switch (_context41.prev = _context41.next) {
1743
- case 0:
1744
- if (!(!protectionOptions.numberOfProtections || protectionOptions.numberOfProtections < 2)) {
1745
- _context41.next = 7;
1746
- break;
1747
- }
1748
- _context41.next = 3;
1749
- return _this13.createApplicationProtection(client, applicationId, _objectSpread(_objectSpread({}, protectionOptions), {}, {
1750
- numberOfProtections: undefined
1751
- }), fragments);
1752
- case 3:
1753
- result = _context41.sent;
1754
- if (result.data && result.data.createApplicationProtection) {
1755
- result.data.protections = [result.data.createApplicationProtection];
1756
- delete result.data.createApplicationProtection;
1757
- }
1758
- _context41.next = 18;
1668
+ while (1) switch (_context41.prev = _context41.next) {
1669
+ case 0:
1670
+ if (!(!protectionOptions.numberOfProtections || protectionOptions.numberOfProtections < 2)) {
1671
+ _context41.next = 7;
1759
1672
  break;
1760
- case 7:
1761
- _context41.next = 9;
1762
- return introspection.mutation(client, 'createApplicationProtections');
1763
- case 9:
1764
- mutationType = _context41.sent;
1765
- if (!mutationType) {
1766
- console.error("\"Create multiple protections at once\" it's only available on Jscrambler version 7.2 and above.");
1767
- process.exit(1);
1768
- }
1769
- _context41.next = 13;
1770
- return mutations.createApplicationProtections(applicationId, fragments, protectionOptions, mutationType.args);
1771
- case 13:
1772
- mutation = _context41.sent;
1773
- _context41.next = 16;
1774
- return client.post('/application', mutation);
1775
- case 16:
1776
- result = _context41.sent;
1777
- if (result.data && result.data.createApplicationProtections) {
1778
- result.data.protections = result.data.createApplicationProtections.protections;
1779
- delete result.data.createApplicationProtections;
1780
- }
1781
- case 18:
1782
- return _context41.abrupt("return", result);
1783
- case 19:
1784
- case "end":
1785
- return _context41.stop();
1786
- }
1673
+ }
1674
+ _context41.next = 3;
1675
+ return _this13.createApplicationProtection(client, applicationId, _objectSpread(_objectSpread({}, protectionOptions), {}, {
1676
+ numberOfProtections: undefined
1677
+ }), fragments);
1678
+ case 3:
1679
+ result = _context41.sent;
1680
+ if (result.data && result.data.createApplicationProtection) {
1681
+ result.data.protections = [result.data.createApplicationProtection];
1682
+ delete result.data.createApplicationProtection;
1683
+ }
1684
+ _context41.next = 18;
1685
+ break;
1686
+ case 7:
1687
+ _context41.next = 9;
1688
+ return introspection.mutation(client, 'createApplicationProtections');
1689
+ case 9:
1690
+ mutationType = _context41.sent;
1691
+ if (!mutationType) {
1692
+ console.error("\"Create multiple protections at once\" it's only available on Jscrambler version 7.2 and above.");
1693
+ process.exit(1);
1694
+ }
1695
+ _context41.next = 13;
1696
+ return mutations.createApplicationProtections(applicationId, fragments, protectionOptions, mutationType.args);
1697
+ case 13:
1698
+ mutation = _context41.sent;
1699
+ _context41.next = 16;
1700
+ return client.post('/application', mutation);
1701
+ case 16:
1702
+ result = _context41.sent;
1703
+ if (result.data && result.data.createApplicationProtections) {
1704
+ result.data.protections = result.data.createApplicationProtections.protections;
1705
+ delete result.data.createApplicationProtections;
1706
+ }
1707
+ case 18:
1708
+ return _context41.abrupt("return", result);
1709
+ case 19:
1710
+ case "end":
1711
+ return _context41.stop();
1787
1712
  }
1788
1713
  }, _callee41);
1789
1714
  }))();
@@ -1796,14 +1721,12 @@ var _default = {
1796
1721
  getInstrumentation: function getInstrumentation(client, instrumentationId) {
1797
1722
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
1798
1723
  return _regeneratorRuntime().wrap(function _callee42$(_context42) {
1799
- while (1) {
1800
- switch (_context42.prev = _context42.next) {
1801
- case 0:
1802
- return _context42.abrupt("return", client.get("/profiling-run/".concat(instrumentationId)));
1803
- case 1:
1804
- case "end":
1805
- return _context42.stop();
1806
- }
1724
+ while (1) switch (_context42.prev = _context42.next) {
1725
+ case 0:
1726
+ return _context42.abrupt("return", client.get("/profiling-run/".concat(instrumentationId)));
1727
+ case 1:
1728
+ case "end":
1729
+ return _context42.stop();
1807
1730
  }
1808
1731
  }, _callee42);
1809
1732
  }))();
@@ -1813,18 +1736,16 @@ var _default = {
1813
1736
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43() {
1814
1737
  var query;
1815
1738
  return _regeneratorRuntime().wrap(function _callee43$(_context43) {
1816
- while (1) {
1817
- switch (_context43.prev = _context43.next) {
1818
- case 0:
1819
- _context43.next = 2;
1820
- return queries.getProtection(applicationId, protectionId, fragments);
1821
- case 2:
1822
- query = _context43.sent;
1823
- return _context43.abrupt("return", client.get('/application', query));
1824
- case 4:
1825
- case "end":
1826
- return _context43.stop();
1827
- }
1739
+ while (1) switch (_context43.prev = _context43.next) {
1740
+ case 0:
1741
+ _context43.next = 2;
1742
+ return queries.getProtection(applicationId, protectionId, fragments);
1743
+ case 2:
1744
+ query = _context43.sent;
1745
+ return _context43.abrupt("return", client.get('/application', query));
1746
+ case 4:
1747
+ case "end":
1748
+ return _context43.stop();
1828
1749
  }
1829
1750
  }, _callee43);
1830
1751
  }))();
@@ -1833,14 +1754,12 @@ var _default = {
1833
1754
  downloadSourceMapsRequest: function downloadSourceMapsRequest(client, protectionId) {
1834
1755
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44() {
1835
1756
  return _regeneratorRuntime().wrap(function _callee44$(_context44) {
1836
- while (1) {
1837
- switch (_context44.prev = _context44.next) {
1838
- case 0:
1839
- return _context44.abrupt("return", client.get("/application/sourceMaps/".concat(protectionId), null, false));
1840
- case 1:
1841
- case "end":
1842
- return _context44.stop();
1843
- }
1757
+ while (1) switch (_context44.prev = _context44.next) {
1758
+ case 0:
1759
+ return _context44.abrupt("return", client.get("/application/sourceMaps/".concat(protectionId), null, false));
1760
+ case 1:
1761
+ case "end":
1762
+ return _context44.stop();
1844
1763
  }
1845
1764
  }, _callee44);
1846
1765
  }))();
@@ -1848,14 +1767,12 @@ var _default = {
1848
1767
  downloadSymbolTableRequest: function downloadSymbolTableRequest(client, protectionId) {
1849
1768
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45() {
1850
1769
  return _regeneratorRuntime().wrap(function _callee45$(_context45) {
1851
- while (1) {
1852
- switch (_context45.prev = _context45.next) {
1853
- case 0:
1854
- return _context45.abrupt("return", client.get("/application/symbolTable/".concat(protectionId), null, false));
1855
- case 1:
1856
- case "end":
1857
- return _context45.stop();
1858
- }
1770
+ while (1) switch (_context45.prev = _context45.next) {
1771
+ case 0:
1772
+ return _context45.abrupt("return", client.get("/application/symbolTable/".concat(protectionId), null, false));
1773
+ case 1:
1774
+ case "end":
1775
+ return _context45.stop();
1859
1776
  }
1860
1777
  }, _callee45);
1861
1778
  }))();
@@ -1864,14 +1781,12 @@ var _default = {
1864
1781
  downloadApplicationProtection: function downloadApplicationProtection(client, protectionId) {
1865
1782
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46() {
1866
1783
  return _regeneratorRuntime().wrap(function _callee46$(_context46) {
1867
- while (1) {
1868
- switch (_context46.prev = _context46.next) {
1869
- case 0:
1870
- return _context46.abrupt("return", client.get("/application/download/".concat(protectionId), null, false));
1871
- case 1:
1872
- case "end":
1873
- return _context46.stop();
1874
- }
1784
+ while (1) switch (_context46.prev = _context46.next) {
1785
+ case 0:
1786
+ return _context46.abrupt("return", client.get("/application/download/".concat(protectionId), null, false));
1787
+ case 1:
1788
+ case "end":
1789
+ return _context46.stop();
1875
1790
  }
1876
1791
  }, _callee46);
1877
1792
  }))();
@@ -1897,33 +1812,31 @@ var _default = {
1897
1812
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47() {
1898
1813
  var instrospectionType, client, result, dataArg, isFieldSupported;
1899
1814
  return _regeneratorRuntime().wrap(function _callee47$(_context47) {
1900
- while (1) {
1901
- switch (_context47.prev = _context47.next) {
1902
- case 0:
1903
- instrospectionType = queryOrMutation.toLowerCase() === 'mutation' ? introspection.mutation : introspection.query;
1904
- client = new _this14.Client(_objectSpread({}, config));
1905
- _context47.next = 4;
1906
- return instrospectionType(client, methodName);
1907
- case 4:
1908
- result = _context47.sent;
1909
- if (!(!result || !result.args)) {
1910
- _context47.next = 8;
1911
- break;
1912
- }
1913
- debug && console.log("Method *".concat(methodName, "* not found."));
1914
- return _context47.abrupt("return", false);
1915
- case 8:
1916
- dataArg = result.args.find(function (arg) {
1917
- return arg.name === 'data';
1918
- });
1919
- isFieldSupported = dataArg && dataArg.type.inputFields.some(function (e) {
1920
- return e.name === field;
1921
- });
1922
- return _context47.abrupt("return", isFieldSupported);
1923
- case 11:
1924
- case "end":
1925
- return _context47.stop();
1926
- }
1815
+ while (1) switch (_context47.prev = _context47.next) {
1816
+ case 0:
1817
+ instrospectionType = queryOrMutation.toLowerCase() === 'mutation' ? introspection.mutation : introspection.query;
1818
+ client = new _this14.Client(_objectSpread({}, config));
1819
+ _context47.next = 4;
1820
+ return instrospectionType(client, methodName);
1821
+ case 4:
1822
+ result = _context47.sent;
1823
+ if (!(!result || !result.args)) {
1824
+ _context47.next = 8;
1825
+ break;
1826
+ }
1827
+ debug && console.log("Method *".concat(methodName, "* not found."));
1828
+ return _context47.abrupt("return", false);
1829
+ case 8:
1830
+ dataArg = result.args.find(function (arg) {
1831
+ return arg.name === 'data';
1832
+ });
1833
+ isFieldSupported = dataArg && dataArg.type.inputFields.some(function (e) {
1834
+ return e.name === field;
1835
+ });
1836
+ return _context47.abrupt("return", isFieldSupported);
1837
+ case 11:
1838
+ case "end":
1839
+ return _context47.stop();
1927
1840
  }
1928
1841
  }, _callee47);
1929
1842
  }))();