jscrambler 6.4.14 → 6.4.15
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/bin/jscrambler.js +95 -91
- package/dist/client.js +2 -4
- package/dist/constants.js +1 -4
- package/dist/get-protection-default-fragments.js +57 -53
- package/dist/index.js +1329 -1237
- package/dist/introspection.js +125 -115
- package/dist/mutations.js +2 -2
- package/dist/queries.js +1 -4
- package/dist/zip.js +144 -140
- package/package.json +1 -1
- package/dist/licenses.txt +0 -1921
package/dist/index.js
CHANGED
|
@@ -29,13 +29,11 @@ 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) {
|
|
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; }
|
|
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; }
|
|
39
37
|
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); } }
|
|
40
38
|
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); }); }; }
|
|
41
39
|
var intoObjectType = introspection.intoObjectType;
|
|
@@ -118,93 +116,95 @@ var _default = {
|
|
|
118
116
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
119
117
|
var sources, filesSrc, cwd, appProfiling, removeSourceRes, zipped, source, _filesSrc, i, l, content;
|
|
120
118
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
121
|
-
while (1)
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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]);
|
|
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;
|
|
150
130
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
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');
|
|
153
|
+
}
|
|
154
|
+
_context.next = 14;
|
|
155
|
+
return (0, _zip.zip)(_filesSrc, cwd);
|
|
156
|
+
case 14:
|
|
157
|
+
zipped = _context.sent;
|
|
163
158
|
_context.next = 22;
|
|
164
159
|
break;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
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
|
|
160
|
+
case 17:
|
|
161
|
+
if (!sources) {
|
|
162
|
+
_context.next = 22;
|
|
163
|
+
break;
|
|
185
164
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
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');
|
|
190
|
+
}
|
|
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
|
+
}
|
|
208
208
|
}
|
|
209
209
|
}, _callee);
|
|
210
210
|
}))();
|
|
@@ -257,362 +257,368 @@ 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
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
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
|
-
}
|
|
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;
|
|
319
284
|
}
|
|
320
|
-
|
|
321
|
-
|
|
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;
|
|
285
|
+
if (destCallback) {
|
|
286
|
+
filesDest = undefined;
|
|
372
287
|
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
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;
|
|
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;
|
|
297
|
+
}
|
|
298
|
+
throw new Error('Required *filesDest* not provided');
|
|
299
|
+
case 13:
|
|
300
|
+
if (skipSources) {
|
|
301
|
+
_context4.next = 26;
|
|
302
|
+
break;
|
|
303
|
+
}
|
|
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.');
|
|
437
313
|
}
|
|
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;
|
|
445
314
|
break;
|
|
446
|
-
case
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
if (debug) {
|
|
450
|
-
console.error(_context2.t0);
|
|
315
|
+
case _constants.HTTP_STATUS_CODES.SERVICE_UNAVAILABLE:
|
|
316
|
+
if (profilingDataMode === 'automatic') {
|
|
317
|
+
throw e;
|
|
451
318
|
}
|
|
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();
|
|
461
319
|
}
|
|
462
|
-
}
|
|
463
|
-
})
|
|
464
|
-
|
|
465
|
-
|
|
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
|
|
466
352
|
};
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
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
|
|
368
|
+
};
|
|
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;
|
|
508
439
|
}
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
case 14:
|
|
533
|
-
if (!(sourcesErrors.length > 0)) {
|
|
534
|
-
_context3.next = 21;
|
|
535
|
-
break;
|
|
536
|
-
}
|
|
537
|
-
if (!protection.bail) {
|
|
538
|
-
_context3.next = 20;
|
|
539
|
-
break;
|
|
540
|
-
}
|
|
541
|
-
printSourcesErrors(sourcesErrors);
|
|
542
|
-
throw new Error('Your protection has failed.');
|
|
543
|
-
case 20:
|
|
544
|
-
sourcesErrors.forEach(function (e) {
|
|
545
|
-
return console.warn("Non-fatal error: \"".concat(e.message, "\" in ").concat(e.filename));
|
|
546
|
-
});
|
|
547
|
-
case 21:
|
|
548
|
-
if (debug) {
|
|
549
|
-
console.log('Downloading protection result');
|
|
550
|
-
}
|
|
551
|
-
_context3.next = 24;
|
|
552
|
-
return _this2.downloadApplicationProtection(client, protection._id);
|
|
553
|
-
case 24:
|
|
554
|
-
download = _context3.sent;
|
|
555
|
-
errorHandler(download);
|
|
556
|
-
if (debug) {
|
|
557
|
-
console.log('Unzipping files');
|
|
558
|
-
}
|
|
559
|
-
_context3.next = 29;
|
|
560
|
-
return (0, _zip.unzip)(download, (filesDest ? "".concat(filesDest).concat(outPrefix) : filesDest) || destCallback, stream);
|
|
561
|
-
case 29:
|
|
562
|
-
if (debug) {
|
|
563
|
-
console.log('Finished unzipping files');
|
|
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();
|
|
564
463
|
}
|
|
565
|
-
|
|
566
|
-
|
|
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);
|
|
571
|
+
}
|
|
572
|
+
return _context3.abrupt("return", protection._id);
|
|
573
|
+
case 32:
|
|
574
|
+
case "end":
|
|
575
|
+
return _context3.stop();
|
|
567
576
|
}
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
}
|
|
574
|
-
})
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
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;
|
|
581
606
|
break;
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
_context4.next = 81;
|
|
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;
|
|
590
614
|
break;
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
});
|
|
599
|
-
case 73:
|
|
600
|
-
_context4.next = 78;
|
|
601
|
-
break;
|
|
602
|
-
case 75:
|
|
603
|
-
_context4.prev = 75;
|
|
604
|
-
_context4.t5 = _context4["catch"](70);
|
|
605
|
-
console.error(_context4.t5);
|
|
606
|
-
case 78:
|
|
607
|
-
i++;
|
|
608
|
-
_context4.next = 68;
|
|
609
|
-
break;
|
|
610
|
-
case 81:
|
|
611
|
-
console.log("Runtime: ".concat(processedProtections.length, " protections in ").concat(Math.round((Date.now() - start) / 1000), "s"));
|
|
612
|
-
return _context4.abrupt("return", protectionIds);
|
|
613
|
-
case 83:
|
|
614
|
-
case "end":
|
|
615
|
-
return _context4.stop();
|
|
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
|
+
}
|
|
616
622
|
}
|
|
617
623
|
}, _callee4, null, [[70, 75]]);
|
|
618
624
|
}))();
|
|
@@ -628,102 +634,104 @@ var _default = {
|
|
|
628
634
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
629
635
|
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;
|
|
630
636
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
631
|
-
while (1)
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
filesSrc = finalConfig.filesSrc, filesDest = finalConfig.filesDest;
|
|
650
|
-
if (sources) {
|
|
651
|
-
filesSrc = undefined;
|
|
652
|
-
}
|
|
653
|
-
if (destCallback) {
|
|
654
|
-
filesDest = undefined;
|
|
655
|
-
}
|
|
656
|
-
if (applicationId) {
|
|
657
|
-
_context5.next = 9;
|
|
658
|
-
break;
|
|
659
|
-
}
|
|
660
|
-
throw new Error('Required *applicationId* not provided');
|
|
661
|
-
case 9:
|
|
662
|
-
if (!(!filesDest && !destCallback)) {
|
|
663
|
-
_context5.next = 11;
|
|
664
|
-
break;
|
|
665
|
-
}
|
|
666
|
-
throw new Error('Required *filesDest* not provided');
|
|
667
|
-
case 11:
|
|
668
|
-
if (skipSources) {
|
|
669
|
-
_context5.next = 16;
|
|
670
|
-
break;
|
|
671
|
-
}
|
|
672
|
-
_context5.next = 14;
|
|
673
|
-
return _this3.updateApplicationSources(client, applicationId, {
|
|
674
|
-
sources: sources,
|
|
675
|
-
filesSrc: filesSrc,
|
|
676
|
-
cwd: cwd
|
|
677
|
-
});
|
|
678
|
-
case 14:
|
|
679
|
-
_context5.next = 17;
|
|
680
|
-
break;
|
|
681
|
-
case 16:
|
|
682
|
-
console.log('Update source files SKIPPED');
|
|
683
|
-
case 17:
|
|
684
|
-
_context5.next = 19;
|
|
685
|
-
return _this3.startInstrumentation(client, applicationId);
|
|
686
|
-
case 19:
|
|
687
|
-
instrumentation = _context5.sent;
|
|
688
|
-
errorHandler(instrumentation);
|
|
689
|
-
onExitCancelInstrumentation = function onExitCancelInstrumentation() {
|
|
690
|
-
_this3.deleteProfiling(client, instrumentation.data.id).then(function () {
|
|
691
|
-
return console.log('\n** Instrumentation %s WAS CANCELLED **', instrumentation.data.id);
|
|
692
|
-
}).catch(function () {
|
|
693
|
-
return debug && console.error(e);
|
|
694
|
-
}).finally(function () {
|
|
695
|
-
return process.exit(1);
|
|
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
|
|
696
655
|
});
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
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;
|
|
687
|
+
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
|
+
}
|
|
727
735
|
}
|
|
728
736
|
}, _callee5);
|
|
729
737
|
}))();
|
|
@@ -741,55 +749,57 @@ var _default = {
|
|
|
741
749
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
742
750
|
var finalConfig, keys, host, port, basePath, protocol, cafile, applicationId, proxy, utc, jscramblerVersion, clientId, accessKey, secretKey, client, instrumentation, previousState;
|
|
743
751
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
744
|
-
while (1)
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
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
|
+
}
|
|
793
803
|
}
|
|
794
804
|
}, _callee6);
|
|
795
805
|
}))();
|
|
@@ -799,54 +809,56 @@ var _default = {
|
|
|
799
809
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
800
810
|
var keys, host, port, basePath, protocol, cafile, _configs$stream, stream, filesDest, filesSrc, protectionId, jscramblerVersion, utc, proxy, accessKey, secretKey, client, download;
|
|
801
811
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
802
|
-
while (1)
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
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;
|
|
826
850
|
break;
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
_context7.next = 17;
|
|
839
|
-
break;
|
|
840
|
-
case 14:
|
|
841
|
-
_context7.prev = 14;
|
|
842
|
-
_context7.t0 = _context7["catch"](8);
|
|
843
|
-
errorHandler(_context7.t0);
|
|
844
|
-
case 17:
|
|
845
|
-
_context7.next = 19;
|
|
846
|
-
return (0, _zip.unzip)(download, filesDest || destCallback, stream);
|
|
847
|
-
case 19:
|
|
848
|
-
case "end":
|
|
849
|
-
return _context7.stop();
|
|
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
|
+
}
|
|
850
862
|
}
|
|
851
863
|
}, _callee7, null, [[8, 14]]);
|
|
852
864
|
}))();
|
|
@@ -856,57 +868,59 @@ var _default = {
|
|
|
856
868
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
857
869
|
var keys, host, port, basePath, protocol, cafile, _configs$stream2, stream, filesDest, filesSrc, protectionId, jscramblerVersion, utc, proxy, accessKey, secretKey, client, download;
|
|
858
870
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
859
|
-
while (1)
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
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;
|
|
883
909
|
break;
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
_context8.prev = 14;
|
|
899
|
-
_context8.t0 = _context8["catch"](8);
|
|
900
|
-
errorHandler(_context8.t0);
|
|
901
|
-
case 17:
|
|
902
|
-
if (typeof destCallback === 'function') {
|
|
903
|
-
destCallback(download, filesDest);
|
|
904
|
-
} else {
|
|
905
|
-
(0, _zip.outputFileSync)(_path.default.join(filesDest, "".concat(protectionId, "_symbolTable.json")), download);
|
|
906
|
-
}
|
|
907
|
-
case 18:
|
|
908
|
-
case "end":
|
|
909
|
-
return _context8.stop();
|
|
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
|
+
}
|
|
910
924
|
}
|
|
911
925
|
}, _callee8, null, [[8, 14]]);
|
|
912
926
|
}))();
|
|
@@ -924,54 +938,58 @@ var _default = {
|
|
|
924
938
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
925
939
|
var start, poll;
|
|
926
940
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
927
|
-
while (1)
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
var
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
_context9.
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
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
|
+
}
|
|
975
993
|
}
|
|
976
994
|
}, _callee10);
|
|
977
995
|
}))();
|
|
@@ -980,41 +998,43 @@ var _default = {
|
|
|
980
998
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
981
999
|
var retriesLeft;
|
|
982
1000
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
983
|
-
while (1)
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
_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;
|
|
1003
1033
|
break;
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
if (debug) {
|
|
1009
|
-
console.log('Retrying request');
|
|
1010
|
-
}
|
|
1011
|
-
retriesLeft--;
|
|
1012
|
-
case 15:
|
|
1013
|
-
_context11.next = 1;
|
|
1014
|
-
break;
|
|
1015
|
-
case 17:
|
|
1016
|
-
case "end":
|
|
1017
|
-
return _context11.stop();
|
|
1034
|
+
case 17:
|
|
1035
|
+
case "end":
|
|
1036
|
+
return _context11.stop();
|
|
1037
|
+
}
|
|
1018
1038
|
}
|
|
1019
1039
|
}, _callee11, null, [[1, 7]]);
|
|
1020
1040
|
}))();
|
|
@@ -1024,61 +1044,65 @@ var _default = {
|
|
|
1024
1044
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
1025
1045
|
var start, poll;
|
|
1026
1046
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1027
|
-
while (1)
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
var
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
_context12.
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
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();
|
|
1064
1093
|
}
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
}();
|
|
1078
|
-
return _context13.abrupt("return", poll());
|
|
1079
|
-
case 3:
|
|
1080
|
-
case "end":
|
|
1081
|
-
return _context13.stop();
|
|
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
|
+
}
|
|
1082
1106
|
}
|
|
1083
1107
|
}, _callee13);
|
|
1084
1108
|
}))();
|
|
@@ -1088,83 +1112,87 @@ var _default = {
|
|
|
1088
1112
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
1089
1113
|
var start, seen, poll;
|
|
1090
1114
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1091
|
-
while (1)
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
var
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
_context14.
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
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();
|
|
1145
1183
|
}
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
}, _callee14);
|
|
1159
|
-
}));
|
|
1160
|
-
return function poll() {
|
|
1161
|
-
return _ref8.apply(this, arguments);
|
|
1162
|
-
};
|
|
1163
|
-
}();
|
|
1164
|
-
return _context15.abrupt("return", poll());
|
|
1165
|
-
case 9:
|
|
1166
|
-
case "end":
|
|
1167
|
-
return _context15.stop();
|
|
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
|
+
}
|
|
1168
1196
|
}
|
|
1169
1197
|
}, _callee15);
|
|
1170
1198
|
}))();
|
|
@@ -1173,12 +1201,14 @@ var _default = {
|
|
|
1173
1201
|
createApplication: function createApplication(client, data, fragments) {
|
|
1174
1202
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
1175
1203
|
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1176
|
-
while (1)
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
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
|
+
}
|
|
1182
1212
|
}
|
|
1183
1213
|
}, _callee16);
|
|
1184
1214
|
}))();
|
|
@@ -1187,12 +1217,14 @@ var _default = {
|
|
|
1187
1217
|
duplicateApplication: function duplicateApplication(client, data, fragments) {
|
|
1188
1218
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
1189
1219
|
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1190
|
-
while (1)
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
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
|
+
}
|
|
1196
1228
|
}
|
|
1197
1229
|
}, _callee17);
|
|
1198
1230
|
}))();
|
|
@@ -1201,12 +1233,14 @@ var _default = {
|
|
|
1201
1233
|
removeApplication: function removeApplication(client, id) {
|
|
1202
1234
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
1203
1235
|
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1204
|
-
while (1)
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
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
|
+
}
|
|
1210
1244
|
}
|
|
1211
1245
|
}, _callee18);
|
|
1212
1246
|
}))();
|
|
@@ -1215,12 +1249,14 @@ var _default = {
|
|
|
1215
1249
|
removeProtection: function removeProtection(client, id, appId, fragments) {
|
|
1216
1250
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
1217
1251
|
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1218
|
-
while (1)
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
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
|
+
}
|
|
1224
1260
|
}
|
|
1225
1261
|
}, _callee19);
|
|
1226
1262
|
}))();
|
|
@@ -1230,16 +1266,18 @@ var _default = {
|
|
|
1230
1266
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
1231
1267
|
var mutation;
|
|
1232
1268
|
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1233
|
-
while (1)
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
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
|
+
}
|
|
1243
1281
|
}
|
|
1244
1282
|
}, _callee20);
|
|
1245
1283
|
}))();
|
|
@@ -1249,16 +1287,18 @@ var _default = {
|
|
|
1249
1287
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
1250
1288
|
var mutation;
|
|
1251
1289
|
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1252
|
-
while (1)
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
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
|
+
}
|
|
1262
1302
|
}
|
|
1263
1303
|
}, _callee21);
|
|
1264
1304
|
}))();
|
|
@@ -1268,16 +1308,18 @@ var _default = {
|
|
|
1268
1308
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
1269
1309
|
var mutation;
|
|
1270
1310
|
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1271
|
-
while (1)
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
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
|
+
}
|
|
1281
1323
|
}
|
|
1282
1324
|
}, _callee22);
|
|
1283
1325
|
}))();
|
|
@@ -1287,16 +1329,18 @@ var _default = {
|
|
|
1287
1329
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
1288
1330
|
var query;
|
|
1289
1331
|
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
1290
|
-
while (1)
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
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
|
+
}
|
|
1300
1344
|
}
|
|
1301
1345
|
}, _callee23);
|
|
1302
1346
|
}))();
|
|
@@ -1306,16 +1350,18 @@ var _default = {
|
|
|
1306
1350
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
1307
1351
|
var query;
|
|
1308
1352
|
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
1309
|
-
while (1)
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
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
|
+
}
|
|
1319
1365
|
}
|
|
1320
1366
|
}, _callee24);
|
|
1321
1367
|
}))();
|
|
@@ -1325,13 +1371,15 @@ var _default = {
|
|
|
1325
1371
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
1326
1372
|
var query;
|
|
1327
1373
|
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
1328
|
-
while (1)
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
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
|
+
}
|
|
1335
1383
|
}
|
|
1336
1384
|
}, _callee25);
|
|
1337
1385
|
}))();
|
|
@@ -1341,16 +1389,18 @@ var _default = {
|
|
|
1341
1389
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
|
|
1342
1390
|
var query;
|
|
1343
1391
|
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
1344
|
-
while (1)
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
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
|
+
}
|
|
1354
1404
|
}
|
|
1355
1405
|
}, _callee26);
|
|
1356
1406
|
}))();
|
|
@@ -1360,16 +1410,18 @@ var _default = {
|
|
|
1360
1410
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
1361
1411
|
var mutation;
|
|
1362
1412
|
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
1363
|
-
while (1)
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
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
|
+
}
|
|
1373
1425
|
}
|
|
1374
1426
|
}, _callee27);
|
|
1375
1427
|
}))();
|
|
@@ -1379,16 +1431,18 @@ var _default = {
|
|
|
1379
1431
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
1380
1432
|
var mutation;
|
|
1381
1433
|
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
1382
|
-
while (1)
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
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
|
+
}
|
|
1392
1446
|
}
|
|
1393
1447
|
}, _callee28);
|
|
1394
1448
|
}))();
|
|
@@ -1398,16 +1452,18 @@ var _default = {
|
|
|
1398
1452
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
1399
1453
|
var query;
|
|
1400
1454
|
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
1401
|
-
while (1)
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
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
|
+
}
|
|
1411
1467
|
}
|
|
1412
1468
|
}, _callee29);
|
|
1413
1469
|
}))();
|
|
@@ -1417,16 +1473,18 @@ var _default = {
|
|
|
1417
1473
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
1418
1474
|
var query;
|
|
1419
1475
|
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
1420
|
-
while (1)
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
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
|
+
}
|
|
1430
1488
|
}
|
|
1431
1489
|
}, _callee30);
|
|
1432
1490
|
}))();
|
|
@@ -1437,18 +1495,20 @@ var _default = {
|
|
|
1437
1495
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
1438
1496
|
var mutation;
|
|
1439
1497
|
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
1440
|
-
while (1)
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
return
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
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
|
+
}
|
|
1452
1512
|
}
|
|
1453
1513
|
}, _callee31);
|
|
1454
1514
|
}))();
|
|
@@ -1458,20 +1518,22 @@ var _default = {
|
|
|
1458
1518
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
|
|
1459
1519
|
var file, mutation;
|
|
1460
1520
|
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
1461
|
-
while (1)
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
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
|
+
}
|
|
1475
1537
|
}
|
|
1476
1538
|
}, _callee32);
|
|
1477
1539
|
}))();
|
|
@@ -1481,16 +1543,18 @@ var _default = {
|
|
|
1481
1543
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
1482
1544
|
var mutation;
|
|
1483
1545
|
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
1484
|
-
while (1)
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
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
|
+
}
|
|
1494
1558
|
}
|
|
1495
1559
|
}, _callee33);
|
|
1496
1560
|
}))();
|
|
@@ -1501,18 +1565,20 @@ var _default = {
|
|
|
1501
1565
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
1502
1566
|
var mutation;
|
|
1503
1567
|
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
1504
|
-
while (1)
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
return
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
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
|
+
}
|
|
1516
1582
|
}
|
|
1517
1583
|
}, _callee34);
|
|
1518
1584
|
}))();
|
|
@@ -1522,16 +1588,18 @@ var _default = {
|
|
|
1522
1588
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
1523
1589
|
var mutation;
|
|
1524
1590
|
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
1525
|
-
while (1)
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
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
|
+
}
|
|
1535
1603
|
}
|
|
1536
1604
|
}, _callee35);
|
|
1537
1605
|
}))();
|
|
@@ -1541,16 +1609,18 @@ var _default = {
|
|
|
1541
1609
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
|
|
1542
1610
|
var mutation;
|
|
1543
1611
|
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
1544
|
-
while (1)
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
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
|
+
}
|
|
1554
1624
|
}
|
|
1555
1625
|
}, _callee36);
|
|
1556
1626
|
}))();
|
|
@@ -1558,14 +1628,16 @@ var _default = {
|
|
|
1558
1628
|
getApplicationProfiling: function getApplicationProfiling(client, applicationId) {
|
|
1559
1629
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
|
|
1560
1630
|
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
1561
|
-
while (1)
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
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
|
+
}
|
|
1569
1641
|
}
|
|
1570
1642
|
}, _callee37);
|
|
1571
1643
|
}))();
|
|
@@ -1573,14 +1645,16 @@ var _default = {
|
|
|
1573
1645
|
deleteProfiling: function deleteProfiling(client, profilingId) {
|
|
1574
1646
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
|
|
1575
1647
|
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
1576
|
-
while (1)
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
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
|
+
}
|
|
1584
1658
|
}
|
|
1585
1659
|
}, _callee38);
|
|
1586
1660
|
}))();
|
|
@@ -1597,27 +1671,29 @@ var _default = {
|
|
|
1597
1671
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
|
|
1598
1672
|
var instrumentation;
|
|
1599
1673
|
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
1600
|
-
while (1)
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
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
|
+
}
|
|
1609
1687
|
_context39.next = 6;
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
case "end":
|
|
1620
|
-
return _context39.stop();
|
|
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
|
+
}
|
|
1621
1697
|
}
|
|
1622
1698
|
}, _callee39);
|
|
1623
1699
|
}))();
|
|
@@ -1627,21 +1703,23 @@ var _default = {
|
|
|
1627
1703
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
1628
1704
|
var _yield$introspection$, args, mutation;
|
|
1629
1705
|
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
1630
|
-
while (1)
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
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
|
+
}
|
|
1645
1723
|
}
|
|
1646
1724
|
}, _callee40);
|
|
1647
1725
|
}))();
|
|
@@ -1660,50 +1738,52 @@ var _default = {
|
|
|
1660
1738
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
|
|
1661
1739
|
var result, mutationType, mutation;
|
|
1662
1740
|
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
1663
|
-
while (1)
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
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;
|
|
1667
1759
|
break;
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
return client.post('/application', mutation);
|
|
1696
|
-
case 16:
|
|
1697
|
-
result = _context41.sent;
|
|
1698
|
-
if (result.data && result.data.createApplicationProtections) {
|
|
1699
|
-
result.data.protections = result.data.createApplicationProtections.protections;
|
|
1700
|
-
delete result.data.createApplicationProtections;
|
|
1701
|
-
}
|
|
1702
|
-
case 18:
|
|
1703
|
-
return _context41.abrupt("return", result);
|
|
1704
|
-
case 19:
|
|
1705
|
-
case "end":
|
|
1706
|
-
return _context41.stop();
|
|
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
|
+
}
|
|
1707
1787
|
}
|
|
1708
1788
|
}, _callee41);
|
|
1709
1789
|
}))();
|
|
@@ -1716,12 +1796,14 @@ var _default = {
|
|
|
1716
1796
|
getInstrumentation: function getInstrumentation(client, instrumentationId) {
|
|
1717
1797
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
|
|
1718
1798
|
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
1719
|
-
while (1)
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
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
|
+
}
|
|
1725
1807
|
}
|
|
1726
1808
|
}, _callee42);
|
|
1727
1809
|
}))();
|
|
@@ -1731,16 +1813,18 @@ var _default = {
|
|
|
1731
1813
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43() {
|
|
1732
1814
|
var query;
|
|
1733
1815
|
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
1734
|
-
while (1)
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
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
|
+
}
|
|
1744
1828
|
}
|
|
1745
1829
|
}, _callee43);
|
|
1746
1830
|
}))();
|
|
@@ -1749,12 +1833,14 @@ var _default = {
|
|
|
1749
1833
|
downloadSourceMapsRequest: function downloadSourceMapsRequest(client, protectionId) {
|
|
1750
1834
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44() {
|
|
1751
1835
|
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
1752
|
-
while (1)
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
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
|
+
}
|
|
1758
1844
|
}
|
|
1759
1845
|
}, _callee44);
|
|
1760
1846
|
}))();
|
|
@@ -1762,12 +1848,14 @@ var _default = {
|
|
|
1762
1848
|
downloadSymbolTableRequest: function downloadSymbolTableRequest(client, protectionId) {
|
|
1763
1849
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45() {
|
|
1764
1850
|
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
1765
|
-
while (1)
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
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
|
+
}
|
|
1771
1859
|
}
|
|
1772
1860
|
}, _callee45);
|
|
1773
1861
|
}))();
|
|
@@ -1776,12 +1864,14 @@ var _default = {
|
|
|
1776
1864
|
downloadApplicationProtection: function downloadApplicationProtection(client, protectionId) {
|
|
1777
1865
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46() {
|
|
1778
1866
|
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
1779
|
-
while (1)
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
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
|
+
}
|
|
1785
1875
|
}
|
|
1786
1876
|
}, _callee46);
|
|
1787
1877
|
}))();
|
|
@@ -1807,31 +1897,33 @@ var _default = {
|
|
|
1807
1897
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47() {
|
|
1808
1898
|
var instrospectionType, client, result, dataArg, isFieldSupported;
|
|
1809
1899
|
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
1810
|
-
while (1)
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
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
|
+
}
|
|
1835
1927
|
}
|
|
1836
1928
|
}, _callee47);
|
|
1837
1929
|
}))();
|