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