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