jscrambler 6.2.6 → 6.3.0

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/client.js CHANGED
@@ -1,88 +1,50 @@
1
1
  "use strict";
2
2
 
3
3
  var _lodash = _interopRequireDefault(require("lodash.defaults"));
4
-
5
4
  var _fs = _interopRequireDefault(require("fs"));
6
-
7
5
  var _lodash2 = _interopRequireDefault(require("lodash.keys"));
8
-
9
6
  var _axios = _interopRequireDefault(require("axios"));
10
-
11
7
  var _zlib = require("zlib");
12
-
13
8
  var _url = _interopRequireDefault(require("url"));
14
-
15
9
  var _https = _interopRequireDefault(require("https"));
16
-
17
10
  var _http = _interopRequireDefault(require("http"));
18
-
19
11
  var _httpsProxyAgent = _interopRequireDefault(require("@jscrambler/https-proxy-agent"));
20
-
21
12
  var _httpProxyAgent = _interopRequireDefault(require("http-proxy-agent"));
22
-
23
13
  var _config = _interopRequireDefault(require("./config"));
24
-
25
14
  var _generateSignedParams = _interopRequireDefault(require("./generate-signed-params"));
26
-
27
15
  var _constants = require("./constants");
28
-
29
16
  var _package = require("../package.json");
30
-
31
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
32
-
33
18
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
34
-
35
19
  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; }
36
-
37
20
  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; }
38
-
39
21
  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); }
40
-
41
22
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
42
-
43
23
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
44
-
45
24
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
46
-
47
25
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
48
-
49
26
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
50
-
51
27
  function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
52
-
53
28
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
54
-
55
29
  function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
56
-
57
30
  function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
58
-
59
31
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
60
-
61
32
  function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
62
-
63
33
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
64
-
65
34
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
66
-
67
35
  var debug = !!process.env.DEBUG;
68
36
  var metrics = !!process.env.METRICS;
69
37
  var noCompression = !!process.env.NO_COMPRESSION;
70
-
71
38
  var ClientError = /*#__PURE__*/function (_Error) {
72
39
  _inherits(ClientError, _Error);
73
-
74
40
  var _super = _createSuper(ClientError);
75
-
76
41
  function ClientError(message, statusCode) {
77
42
  var _this;
78
-
79
43
  _classCallCheck(this, ClientError);
80
-
81
44
  _this = _super.call(this, message);
82
45
  _this.statusCode = statusCode;
83
46
  return _this;
84
47
  }
85
-
86
48
  return _createClass(ClientError);
87
49
  }( /*#__PURE__*/_wrapNativeSuper(Error));
88
50
  /**
@@ -97,8 +59,6 @@ var ClientError = /*#__PURE__*/function (_Error) {
97
59
  * @author Jscrambler
98
60
  * @license MIT <http://opensource.org/licenses/MIT>
99
61
  */
100
-
101
-
102
62
  function JScramblerClient(options) {
103
63
  // Sluggish hack for backwards compatibility
104
64
  if (options && !options.keys && (options.accessKey || options.secretKey)) {
@@ -106,16 +66,15 @@ function JScramblerClient(options) {
106
66
  options.keys.accessKey = options.accessKey;
107
67
  options.keys.secretKey = options.secretKey;
108
68
  }
109
-
110
69
  options.keys = (0, _lodash.default)(options.keys || {}, _config.default.keys);
70
+
111
71
  /**
112
72
  * @member
113
73
  */
114
-
115
74
  this.options = (0, _lodash.default)(options || {}, _config.default);
116
75
  var _this$options = this.options,
117
- jscramblerVersion = _this$options.jscramblerVersion,
118
- clientId = _this$options.clientId;
76
+ jscramblerVersion = _this$options.jscramblerVersion,
77
+ clientId = _this$options.clientId;
119
78
  this.axiosInstance = _axios.default.create({
120
79
  headers: {
121
80
  jscramblerVersion: jscramblerVersion,
@@ -126,16 +85,13 @@ function JScramblerClient(options) {
126
85
  if (!noCompression && typeof data === 'string' && data.length > 1024) {
127
86
  headers['Content-Encoding'] = 'gzip';
128
87
  data = (0, _zlib.gzipSync)(data);
129
-
130
88
  if (metrics) {
131
89
  process.stdout.write("[gzip ".concat(data.length, "B] "));
132
90
  }
133
91
  }
134
-
135
92
  return data;
136
93
  }),
137
94
  maxBodyLength: 100 * 1000 * 1000 // 100 MB
138
-
139
95
  });
140
96
  }
141
97
  /**
@@ -144,8 +100,6 @@ function JScramblerClient(options) {
144
100
  * @param {Object} params
145
101
  * @param {Callback} callback
146
102
  */
147
-
148
-
149
103
  JScramblerClient.prototype.delete = function (path, params) {
150
104
  return this.request('DELETE', path, params);
151
105
  };
@@ -155,8 +109,6 @@ JScramblerClient.prototype.delete = function (path, params) {
155
109
  * @param {Object} params
156
110
  * @param {Callback} callback
157
111
  */
158
-
159
-
160
112
  JScramblerClient.prototype.get = function (path, params) {
161
113
  var isJSON = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
162
114
  return this.request('GET', path, params, isJSON);
@@ -168,15 +120,11 @@ JScramblerClient.prototype.get = function (path, params) {
168
120
  * @param {Object} params
169
121
  * @param {Callback} callback
170
122
  */
171
-
172
-
173
123
  JScramblerClient.prototype.request = function (method, path) {
174
124
  var _this2 = this;
175
-
176
125
  var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
177
126
  var isJSON = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
178
127
  var signedData;
179
-
180
128
  if (this.options.useHeaderAuth) {
181
129
  if (!this.token) {
182
130
  throw new Error('Generating auth token when useHeaderAuth === true is not yet supported. You need to set the jscramblerClient token property explicitly.');
@@ -188,121 +136,98 @@ JScramblerClient.prototype.request = function (method, path) {
188
136
  if (!this.options.keys.accessKey) {
189
137
  throw new Error('Required *accessKey* not provided');
190
138
  }
191
-
192
139
  if (!this.options.keys.secretKey) {
193
140
  throw new Error('Required *secretKey* not provided');
194
141
  }
195
142
  }
196
143
  }
197
-
198
144
  var _keys = (0, _lodash2.default)(params);
199
-
200
145
  for (var i = 0, l = _keys.length; i < l; i++) {
201
146
  if (params[_keys[i]] instanceof Array) {
202
147
  params[_keys[i]] = params[_keys[i]].join(',');
203
148
  }
204
- } // If post sign data and set the request as multipart
205
-
149
+ }
206
150
 
151
+ // If post sign data and set the request as multipart
207
152
  if (this.options.keys.accessKey && this.options.keys.secretKey) {
208
153
  signedData = (0, _generateSignedParams.default)(method, path, this.options.host, this.options.keys, params, this.options.utc);
209
154
  } else {
210
155
  signedData = params;
211
156
  }
212
-
213
157
  var _this$options2 = this.options,
214
- protocol = _this$options2.protocol,
215
- port = _this$options2.port,
216
- proxy = _this$options2.proxy;
217
-
158
+ protocol = _this$options2.protocol,
159
+ port = _this$options2.port,
160
+ proxy = _this$options2.proxy;
218
161
  if (!port && !protocol) {
219
162
  port = 443;
220
163
  protocol = 'https';
221
164
  }
222
-
223
165
  if (!port) {
224
166
  port = protocol === 'https' ? 443 : 80;
225
167
  }
226
-
227
168
  if (!protocol) {
228
169
  protocol = port === 443 ? 'https' : 'http';
229
170
  }
230
-
231
171
  var formattedUrl = _url.default.format({
232
172
  hostname: this.options.host,
233
173
  port: port,
234
174
  pathname: this.options.basePath + path,
235
175
  protocol: protocol
236
176
  });
237
-
238
177
  var data;
239
- var settings = {}; // Internal CA
178
+ var settings = {};
240
179
 
180
+ // Internal CA
241
181
  var agentOptions = {};
242
-
243
182
  if (this.options.cafile) {
244
183
  agentOptions = {
245
184
  ca: _fs.default.readFileSync(this.options.cafile)
246
185
  };
247
186
  }
248
-
249
187
  if (proxy || _typeof(proxy) === 'object') {
250
188
  var host = proxy.host,
251
- _proxy$port = proxy.port,
252
- _port = _proxy$port === void 0 ? 8080 : _proxy$port,
253
- auth = proxy.auth;
254
-
189
+ _proxy$port = proxy.port,
190
+ _port = _proxy$port === void 0 ? 8080 : _proxy$port,
191
+ auth = proxy.auth;
255
192
  if (!host) {
256
193
  throw new Error('Required *proxy.host* not provided');
257
194
  }
258
-
259
195
  var formattedAuth = undefined;
260
-
261
196
  if (auth) {
262
197
  var username = auth.username,
263
- password = auth.password;
264
-
198
+ password = auth.password;
265
199
  if (!username || !password) {
266
200
  throw new Error('Required *proxy.auth* username or/and password not provided');
267
201
  }
268
-
269
202
  formattedAuth = "".concat(username, ":").concat(password);
270
203
  }
204
+
271
205
  /**
272
206
  * Monkey-patch to inject a custom Cert CA into TLS.connect
273
207
  * options.
274
208
  */
275
-
276
-
277
209
  if (agentOptions.ca) {
278
210
  var oriCallback = _httpsProxyAgent.default.prototype.callback;
279
-
280
211
  _httpsProxyAgent.default.prototype.callback = function (req, opts) {
281
212
  return oriCallback.call(this, req, _objectSpread(_objectSpread({}, opts), agentOptions));
282
213
  };
283
214
  }
284
-
285
215
  settings.proxy = false;
286
-
287
216
  var proxyConfig = _objectSpread({
288
217
  host: host,
289
218
  port: _port,
290
219
  auth: formattedAuth
291
220
  }, agentOptions);
292
-
293
221
  settings.httpsAgent = new _httpsProxyAgent.default(proxyConfig);
294
222
  settings.httpAgent = new _httpProxyAgent.default(proxyConfig);
295
223
  } else if (agentOptions) {
296
224
  settings.httpsAgent = new _https.default.Agent(agentOptions);
297
225
  settings.httpAgent = new _http.default.Agent(agentOptions);
298
226
  }
299
-
300
227
  if (!isJSON) {
301
228
  settings.responseType = 'arraybuffer';
302
229
  }
303
-
304
230
  var promise;
305
-
306
231
  if (method === 'GET' || method === 'DELETE') {
307
232
  settings.params = signedData;
308
233
  promise = this.axiosInstance[method.toLowerCase()](formattedUrl, settings);
@@ -310,34 +235,29 @@ JScramblerClient.prototype.request = function (method, path) {
310
235
  data = signedData;
311
236
  promise = this.axiosInstance[method.toLowerCase()](formattedUrl, data, settings);
312
237
  }
313
-
314
238
  var start = Date.now();
315
239
  return promise.then(function (res) {
316
240
  if (metrics || debug) {
317
241
  console.log("".concat(method, " ").concat(path, " ").concat(((data || settings.params).query || '').split('(')[0].trim().replace(' ', '-'), " ").concat(JSON.stringify(data || settings.params).length, "B ").concat(Date.now() - start, "ms"));
318
242
  }
319
-
320
243
  return res.data;
321
244
  }).catch(function (err) {
322
245
  var errorMessage = 'Unexpected Response: ';
323
246
  var statusCode = 500;
324
-
325
247
  if (err.response) {
326
248
  if (debug) {
327
249
  console.error(err.response);
328
250
  }
329
-
330
251
  errorMessage += "".concat(err.response.status, " ").concat(err.response.statusText);
331
252
  statusCode = err.response.status;
332
253
  var incompatibleApi = false;
333
-
334
254
  if (statusCode === _constants.HTTP_STATUS_CODES.UNAUTHORIZED && /Invalid Signature/i.test(err.response.data.message)) {
335
255
  incompatibleApi = err.response.data.errorCode !== _constants.JSCRAMBLER_ERROR_CODES.INVALID_SIGNATURE;
336
256
  }
337
-
338
257
  if (incompatibleApi) {
339
258
  errorMessage = "Incompatible jscrambler CLI version (".concat(_package.version, "). Please downgrade to: \n\t$ npm install ").concat(_constants.CLIENT_PACKAGES[_this2.options.clientId], "@5");
340
- } else if ( // For when we have API error messages
259
+ } else if (
260
+ // For when we have API error messages
341
261
  err.response.data && err.response.data.error && err.response.data.message) {
342
262
  errorMessage += " - ".concat(err.response.data.message);
343
263
  } else if (err.response.data && err.response.data.errors && err.response.data.errors.length > 0) {
@@ -346,7 +266,6 @@ JScramblerClient.prototype.request = function (method, path) {
346
266
  } else {
347
267
  errorMessage += err.message;
348
268
  }
349
-
350
269
  throw new ClientError(errorMessage, statusCode);
351
270
  });
352
271
  };
@@ -356,8 +275,6 @@ JScramblerClient.prototype.request = function (method, path) {
356
275
  * @param {Object} params
357
276
  * @param {Callback} callback
358
277
  */
359
-
360
-
361
278
  JScramblerClient.prototype.post = function (path, params) {
362
279
  return this.request('POST', path, params);
363
280
  };
@@ -366,21 +283,16 @@ JScramblerClient.prototype.post = function (path, params) {
366
283
  * @param {string} path
367
284
  * @param {object} params
368
285
  */
369
-
370
-
371
286
  JScramblerClient.prototype.patch = function (path, params) {
372
287
  return this.request('PATCH', path, params);
373
288
  };
374
-
375
289
  var _token;
376
-
377
290
  Object.defineProperty(JScramblerClient.prototype, 'token', {
378
291
  get: function get() {
379
292
  return _token;
380
293
  },
381
294
  set: function set(value) {
382
295
  _token = value;
383
-
384
296
  if (value) {
385
297
  if (this.options.useHeaderAuth) {
386
298
  this.axiosInstance.defaults.headers['x-user-authentication'] = _token;
package/dist/config.js CHANGED
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _rc = _interopRequireDefault(require("rc"));
9
-
10
8
  var _constants = require("./constants");
11
-
12
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
10
  // Load RC configuration if present. Pass `[]` as last argument to avoid
15
11
  // getting variables from `argv`.
16
12
  var config = (0, _rc.default)('jscrambler', {
package/dist/constants.js CHANGED
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.JSCRAMBLER_ERROR_CODES = exports.HTTP_STATUS_CODES = exports.CLIENT_PACKAGES = exports.CLIENT_IDS = void 0;
7
-
8
7
  var _Object$freeze;
9
-
10
8
  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; }
11
-
12
9
  var HTTP_STATUS_CODES = Object.freeze({
13
10
  UNAUTHORIZED: 401,
14
11
  FORBIDDEN: 403,
@@ -4,21 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = signedParams;
7
-
8
7
  var _lodash = _interopRequireDefault(require("lodash.clone"));
9
-
10
8
  var _crypto = _interopRequireDefault(require("crypto"));
11
-
12
9
  var _lodash2 = _interopRequireDefault(require("lodash.defaults"));
13
-
14
10
  var _lodash3 = _interopRequireDefault(require("lodash.keys"));
15
-
16
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
18
12
  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); }
19
-
20
13
  var debug = !!process.env.DEBUG;
21
-
22
14
  function signedParams(method, path, host, keys) {
23
15
  var params = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
24
16
  var utc = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true;
@@ -29,30 +21,23 @@ function signedParams(method, path, host, keys) {
29
21
  params.signature = generateHmacSignature(method, path, host, keys, params);
30
22
  return params;
31
23
  }
32
-
33
24
  function generateHmacSignature(method, path, host, keys, params) {
34
25
  var paramsCopy = (0, _lodash.default)(params);
35
26
  var signatureData = "".concat(method.toUpperCase(), ";").concat(host.toLowerCase(), ";").concat(path, ";").concat(buildSortedQuery(paramsCopy));
36
27
  debug && console.log("Signature data: ".concat(signatureData));
37
-
38
28
  var hmac = _crypto.default.createHmac('sha256', keys.secretKey.toUpperCase());
39
-
40
29
  hmac.update(signatureData);
41
30
  return hmac.digest('base64');
42
31
  }
43
-
44
32
  function buildSortedQuery(params) {
45
33
  // Sorted keys
46
34
  var _keys = (0, _lodash3.default)(params).sort();
47
-
48
35
  var query = '';
49
-
50
36
  for (var i = 0, l = _keys.length; i < l; i++) {
51
37
  var value = _typeof(params[_keys[i]]) === 'object' ? JSON.stringify(params[_keys[i]]) : params[_keys[i]];
52
38
  query += "".concat(encodeURIComponent(_keys[i]), "=").concat(encodeURIComponent(value), "&");
53
39
  }
54
-
55
- query = query.replace(/\*/g, '%2A').replace(/[!'()]/g, escape).replace(/%7E/g, '~').replace(/\+/g, '%20'); // Strip the last separator and return
56
-
40
+ query = query.replace(/\*/g, '%2A').replace(/[!'()]/g, escape).replace(/%7E/g, '~').replace(/\+/g, '%20');
41
+ // Strip the last separator and return
57
42
  return query.substring(0, query.length - 1);
58
43
  }
@@ -4,29 +4,19 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = _default;
7
-
8
7
  var introspection = _interopRequireWildcard(require("./introspection"));
9
-
10
8
  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); }
11
-
12
9
  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; }
13
-
14
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
15
-
10
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
16
11
  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); }
17
-
18
12
  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); } }
19
-
20
13
  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); }); }; }
21
-
22
14
  function getIntrospection(_x, _x2) {
23
15
  return _getIntrospection.apply(this, arguments);
24
16
  }
25
-
26
17
  function _getIntrospection() {
27
18
  _getIntrospection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(client, typeName) {
28
19
  var _introspection;
29
-
30
20
  return _regeneratorRuntime().wrap(function _callee$(_context) {
31
21
  while (1) {
32
22
  switch (_context.prev = _context.next) {
@@ -34,19 +24,15 @@ function _getIntrospection() {
34
24
  _context.prev = 0;
35
25
  _context.next = 3;
36
26
  return introspection.type(client, typeName);
37
-
38
27
  case 3:
39
28
  _introspection = _context.sent;
40
29
  _context.next = 8;
41
30
  break;
42
-
43
31
  case 6:
44
32
  _context.prev = 6;
45
33
  _context.t0 = _context["catch"](0);
46
-
47
34
  case 8:
48
35
  return _context.abrupt("return", _introspection);
49
-
50
36
  case 9:
51
37
  case "end":
52
38
  return _context.stop();
@@ -56,33 +42,27 @@ function _getIntrospection() {
56
42
  }));
57
43
  return _getIntrospection.apply(this, arguments);
58
44
  }
59
-
60
45
  function fragmentToQL(fragment) {
61
46
  var iterate = function iterate(i) {
62
47
  return Object.keys(i).map(function (key) {
63
48
  var result;
64
49
  var value = i[key];
65
-
66
50
  if (_typeof(value) === 'object') {
67
51
  result = "".concat(key, " { ").concat(iterate(value), " }");
68
52
  } else {
69
53
  result = key;
70
54
  }
71
-
72
55
  return result;
73
56
  }).join(',');
74
57
  };
75
-
76
58
  return iterate(fragment);
77
59
  }
78
-
79
60
  function getAvaliableFragments(a, b) {
80
61
  var fragment = {};
81
62
  Object.keys(b).forEach(function (field) {
82
63
  var _field = a.find(function (f) {
83
64
  return f.name === field;
84
65
  });
85
-
86
66
  if (_field) {
87
67
  if (_typeof(b[field]) === 'object' && _field.type.ofType.kind === 'OBJECT') {
88
68
  fragment[field] = b[field];
@@ -93,7 +73,6 @@ function getAvaliableFragments(a, b) {
93
73
  });
94
74
  return fragment;
95
75
  }
96
-
97
76
  var protectionFields = {
98
77
  _id: 1,
99
78
  state: 1,
@@ -118,11 +97,9 @@ var errorMessageFields = {
118
97
  column: 1,
119
98
  fatal: 1
120
99
  };
121
-
122
100
  function _default(_x3) {
123
101
  return _ref.apply(this, arguments);
124
102
  }
125
-
126
103
  function _ref() {
127
104
  _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(client) {
128
105
  var appProtection, deprecation, source, errorMessage, fragments;
@@ -132,22 +109,18 @@ function _ref() {
132
109
  case 0:
133
110
  _context2.next = 2;
134
111
  return getIntrospection(client, 'ApplicationProtection');
135
-
136
112
  case 2:
137
113
  appProtection = _context2.sent;
138
114
  _context2.next = 5;
139
115
  return getIntrospection(client, 'Deprecation');
140
-
141
116
  case 5:
142
117
  deprecation = _context2.sent;
143
118
  _context2.next = 8;
144
119
  return getIntrospection(client, 'ApplicationSource');
145
-
146
120
  case 8:
147
121
  source = _context2.sent;
148
122
  _context2.next = 11;
149
123
  return getIntrospection(client, 'ErrorMessages');
150
-
151
124
  case 11:
152
125
  errorMessage = _context2.sent;
153
126
  fragments = {
@@ -164,7 +137,6 @@ function _ref() {
164
137
  application: fragmentToQL(fragments.application),
165
138
  applicationProtection: fragmentToQL(fragments.applicationProtection)
166
139
  });
167
-
168
140
  case 18:
169
141
  case "end":
170
142
  return _context2.stop();