swagger-client 3.14.1 → 3.17.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.
@@ -11,7 +11,6 @@ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance
11
11
  import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
12
12
  import getIn from 'lodash/get';
13
13
  import isPlainObject from 'lodash/isPlainObject';
14
- import isArray from 'lodash/isArray';
15
14
  import url from 'url';
16
15
  import cookie from 'cookie';
17
16
  import stockHttp, { mergeInQueryOrForm } from '../http';
@@ -91,7 +90,7 @@ export function execute(_ref) {
91
90
  http: http
92
91
  }, extras));
93
92
 
94
- if (request.body && (isPlainObject(request.body) || isArray(request.body))) {
93
+ if (request.body && (isPlainObject(request.body) || Array.isArray(request.body))) {
95
94
  request.body = _JSON$stringify(request.body);
96
95
  } // Build request and execute it
97
96
 
@@ -1,3 +1,4 @@
1
+ import _objectSpread from "@babel/runtime-corejs3/helpers/objectSpread2";
1
2
  import _typeof from "@babel/runtime-corejs3/helpers/typeof";
2
3
  import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
3
4
  import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
@@ -6,7 +7,6 @@ import _Object$entries from "@babel/runtime-corejs3/core-js-stable/object/entrie
6
7
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
7
8
  // This function runs after the common function,
8
9
  // `src/execute/index.js#buildRequest`
9
- import assign from 'lodash/assign';
10
10
  import get from 'lodash/get';
11
11
  import isPlainObject from 'lodash/isPlainObject';
12
12
  import btoa from 'btoa';
@@ -107,7 +107,9 @@ export function applySecurities(_ref5) {
107
107
  _ref5$operation = _ref5.operation,
108
108
  operation = _ref5$operation === void 0 ? {} : _ref5$operation,
109
109
  spec = _ref5.spec;
110
- var result = assign({}, request);
110
+
111
+ var result = _objectSpread({}, request);
112
+
111
113
  var _securities$authorize = securities.authorized,
112
114
  authorized = _securities$authorize === void 0 ? {} : _securities$authorize;
113
115
  var security = operation.security || spec.security || [];
@@ -1,7 +1,6 @@
1
1
  import _typeof from "@babel/runtime-corejs3/helpers/typeof";
2
2
  import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
3
3
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
4
- import pick from 'lodash/pick';
5
4
  import stylize, { encodeDisallowedCharacters } from './style-serializer';
6
5
  import serialize from './content-serializer';
7
6
  export function path(_ref) {
@@ -53,9 +52,16 @@ export function query(_ref2) {
53
52
  }
54
53
 
55
54
  if (value) {
55
+ var style = parameter.style,
56
+ explode = parameter.explode,
57
+ allowReserved = parameter.allowReserved;
56
58
  req.query[parameter.name] = {
57
59
  value: value,
58
- serializationOption: pick(parameter, ['style', 'explode', 'allowReserved'])
60
+ serializationOption: {
61
+ style: style,
62
+ explode: explode,
63
+ allowReserved: allowReserved
64
+ }
59
65
  };
60
66
  } else if (parameter.allowEmptyValue && value !== undefined) {
61
67
  var paramName = parameter.name;
@@ -1,13 +1,11 @@
1
1
  import _typeof from "@babel/runtime-corejs3/helpers/typeof";
2
2
  import _toConsumableArray from "@babel/runtime-corejs3/helpers/toConsumableArray";
3
3
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
4
+ import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
4
5
  import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
5
6
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
6
7
  import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
7
8
 
8
- var _require = require('buffer'),
9
- Buffer = _require.Buffer;
10
-
11
9
  var isRfc3986Reserved = function isRfc3986Reserved(char) {
12
10
  return ":/?#[]@!$&'()*+,;=".indexOf(char) > -1;
13
11
  };
@@ -55,7 +53,9 @@ export function encodeDisallowedCharacters(str) {
55
53
  return char;
56
54
  }
57
55
 
58
- var encoded = _mapInstanceProperty(_context2 = _mapInstanceProperty(_context3 = Buffer.from(char).toJSON().data || []).call(_context3, function (byte) {
56
+ var encoder = new TextEncoder();
57
+
58
+ var encoded = _mapInstanceProperty(_context2 = _mapInstanceProperty(_context3 = _Array$from(encoder.encode(char))).call(_context3, function (byte) {
59
59
  var _context4;
60
60
 
61
61
  return _sliceInstanceProperty(_context4 = "0".concat(byte.toString(16).toUpperCase())).call(_context4, -2);
@@ -1,9 +1,9 @@
1
+ import _objectSpread from "@babel/runtime-corejs3/helpers/objectSpread2";
1
2
  import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
2
3
  import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
3
4
  import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
4
5
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
5
- import btoa from 'btoa';
6
- import assign from 'lodash/assign'; // This function runs after the common function,
6
+ import btoa from 'btoa'; // This function runs after the common function,
7
7
  // `src/execute/index.js#buildRequest`
8
8
 
9
9
  export default function buildRequest(options, req) {
@@ -73,7 +73,9 @@ export function applySecurities(_ref) {
73
73
  _ref$operation = _ref.operation,
74
74
  operation = _ref$operation === void 0 ? {} : _ref$operation,
75
75
  spec = _ref.spec;
76
- var result = assign({}, request);
76
+
77
+ var result = _objectSpread({}, request);
78
+
77
79
  var _securities$authorize = securities.authorized,
78
80
  authorized = _securities$authorize === void 0 ? {} : _securities$authorize,
79
81
  _securities$specSecur = securities.specSecurity,
package/es/helpers.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import _createForOfIteratorHelper from "@babel/runtime-corejs3/helpers/createForOfIteratorHelper";
2
2
  import _typeof from "@babel/runtime-corejs3/helpers/typeof";
3
+ import _startsWithInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/starts-with";
3
4
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
4
5
  import isObject from 'lodash/isObject';
5
- import startsWith from 'lodash/startsWith';
6
6
 
7
7
  var toLower = function toLower(str) {
8
8
  return String.prototype.toLowerCase.call(str);
@@ -20,7 +20,7 @@ export function isOAS3(spec) {
20
20
  return false;
21
21
  }
22
22
 
23
- return startsWith(oasVersion, '3');
23
+ return _startsWithInstanceProperty(oasVersion).call(oasVersion, '3');
24
24
  }
25
25
  export function isSwagger2(spec) {
26
26
  var swaggerVersion = spec.swagger;
@@ -29,7 +29,7 @@ export function isSwagger2(spec) {
29
29
  return false;
30
30
  }
31
31
 
32
- return startsWith(swaggerVersion, '2');
32
+ return _startsWithInstanceProperty(swaggerVersion).call(swaggerVersion, '2');
33
33
  } // Strategy for determining operationId
34
34
 
35
35
  export function opId(operation, pathName) {
@@ -1,6 +1,6 @@
1
1
  import _objectSpread from "@babel/runtime-corejs3/helpers/objectSpread2";
2
2
  import { Readable } from 'stream';
3
- import { Encoder } from 'form-data-encoder';
3
+ import { FormDataEncoder } from 'form-data-encoder';
4
4
  /**
5
5
  * formdata-node works in node-fetch@2.x via form-data-encoder only.
6
6
  * FormData instance is converted to Encoder instance which gets converted
@@ -10,7 +10,7 @@ import { Encoder } from 'form-data-encoder';
10
10
  */
11
11
 
12
12
  var foldFormDataToRequest = function foldFormDataToRequest(formdata, request) {
13
- var encoder = new Encoder(formdata);
13
+ var encoder = new FormDataEncoder(formdata);
14
14
  var readableStream = Readable.from(encoder); // get rid of previous headers
15
15
 
16
16
  delete request.headers['content-type'];
package/es/http/index.js CHANGED
@@ -17,10 +17,7 @@ import 'cross-fetch/polyfill';
17
17
 
18
18
  import qs from 'qs';
19
19
  import jsYaml from 'js-yaml';
20
- import pick from 'lodash/pick';
21
- import isFunction from 'lodash/isFunction';
22
- import { Buffer } from 'buffer';
23
- import { FormData } from 'formdata-node';
20
+ import { FormData, File, Blob } from 'formdata-node';
24
21
  import { encodeDisallowedCharacters } from '../execute/oas3/style-serializer';
25
22
  import foldFormDataToRequest from './fold-formdata-to-request.node'; // For testing
26
23
 
@@ -197,7 +194,7 @@ function parseBody(body, contentType) {
197
194
  return JSON.parse(body);
198
195
  }
199
196
 
200
- return jsYaml.safeLoad(body);
197
+ return jsYaml.load(body);
201
198
  } // Serialize the response, returns a promise with headers and the body part of the hash
202
199
 
203
200
 
@@ -247,7 +244,7 @@ function serializeHeaderValue(value) {
247
244
 
248
245
  export function serializeHeaders() {
249
246
  var headers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
250
- if (!isFunction(_entriesInstanceProperty(headers))) return {};
247
+ if (typeof _entriesInstanceProperty(headers) !== 'function') return {};
251
248
  return _Array$from(_entriesInstanceProperty(headers).call(headers)).reduce(function (acc, _ref2) {
252
249
  var _ref3 = _slicedToArray(_ref2, 2),
253
250
  header = _ref3[0],
@@ -272,16 +269,14 @@ export function isFile(obj, navigatorObj) {
272
269
  }
273
270
 
274
271
  if (typeof File !== 'undefined' && obj instanceof File) {
275
- // eslint-disable-line no-undef
276
272
  return true;
277
273
  }
278
274
 
279
275
  if (typeof Blob !== 'undefined' && obj instanceof Blob) {
280
- // eslint-disable-line no-undef
281
276
  return true;
282
277
  }
283
278
 
284
- if (typeof Buffer !== 'undefined' && obj instanceof Buffer) {
279
+ if (ArrayBuffer.isView(obj)) {
285
280
  return true;
286
281
  }
287
282
 
@@ -347,7 +342,14 @@ function formatKeyValue(key, input) {
347
342
  if ([_typeof(encoding.style), _typeof(encoding.explode), _typeof(encoding.allowReserved)].some(function (type) {
348
343
  return type !== 'undefined';
349
344
  })) {
350
- return formatKeyValueBySerializationOption(key, value, skipEncoding, pick(encoding, ['style', 'explode', 'allowReserved']));
345
+ var style = encoding.style,
346
+ explode = encoding.explode,
347
+ allowReserved = encoding.allowReserved;
348
+ return formatKeyValueBySerializationOption(key, value, skipEncoding, {
349
+ style: style,
350
+ explode: explode,
351
+ allowReserved: allowReserved
352
+ });
351
353
  }
352
354
 
353
355
  if (encoding.contentType) {
@@ -465,6 +467,11 @@ function buildFormData(reqForm) {
465
467
  * Build a new FormData instance, support array as field value
466
468
  * OAS2.0 - when collectionFormat is multi
467
469
  * OAS3.0 - when explode of Encoding Object is true
470
+ *
471
+ * This function explicitly handles Buffers (for backward compatibility)
472
+ * if provided as a values to FormData. FormData can only handle USVString
473
+ * or Blob.
474
+ *
468
475
  * @param {Object} reqForm - ori req.form
469
476
  * @return {FormData} - new FormData instance
470
477
  */
@@ -491,13 +498,23 @@ function buildFormData(reqForm) {
491
498
  try {
492
499
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
493
500
  var v = _step2.value;
494
- formData.append(key, v);
501
+
502
+ if (ArrayBuffer.isView(v)) {
503
+ var blob = new Blob([v]);
504
+ formData.append(key, blob);
505
+ } else {
506
+ formData.append(key, v);
507
+ }
495
508
  }
496
509
  } catch (err) {
497
510
  _iterator2.e(err);
498
511
  } finally {
499
512
  _iterator2.f();
500
513
  }
514
+ } else if (ArrayBuffer.isView(value)) {
515
+ var _blob = new Blob([value]);
516
+
517
+ formData.append(key, _blob);
501
518
  } else {
502
519
  formData.append(key, value);
503
520
  }
package/es/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import _objectSpread from "@babel/runtime-corejs3/helpers/objectSpread2";
2
- import assign from 'lodash/assign';
3
- import startsWith from 'lodash/startsWith';
2
+ import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
3
+ import _startsWithInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/starts-with";
4
4
  import Url from 'url';
5
5
  import Http, { makeHttp, serializeRes, serializeHeaders } from './http';
6
6
  import Resolver, { clearCache } from './resolver';
@@ -39,10 +39,11 @@ function Swagger(url) {
39
39
  return new Swagger(opts);
40
40
  }
41
41
 
42
- assign(this, opts);
42
+ _Object$assign(this, opts);
43
+
43
44
  var prom = this.resolve().then(function () {
44
45
  if (!_this.disableInterfaces) {
45
- assign(_this, Swagger.makeApisTagOperation(_this));
46
+ _Object$assign(_this, Swagger.makeApisTagOperation(_this));
46
47
  }
47
48
 
48
49
  return _this;
@@ -93,7 +94,7 @@ Swagger.prototype.applyDefaults = function applyDefaults() {
93
94
  var spec = this.spec;
94
95
  var specUrl = this.url; // TODO: OAS3: support servers here
95
96
 
96
- if (specUrl && startsWith(specUrl, 'http')) {
97
+ if (specUrl && _startsWithInstanceProperty(specUrl).call(specUrl, 'http')) {
97
98
  var parsed = Url.parse(specUrl);
98
99
 
99
100
  if (!spec.host) {
package/es/interfaces.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import _objectSpread from "@babel/runtime-corejs3/helpers/objectSpread2";
2
2
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
3
- import pick from 'lodash/pick';
4
3
  import { eachOperation, opId } from './helpers';
5
4
 
6
5
  var nullFn = function nullFn() {
@@ -25,9 +24,14 @@ export function makeExecute() {
25
24
  operationId = _ref.operationId;
26
25
  return function (parameters) {
27
26
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
28
- return swaggerJs.execute(_objectSpread(_objectSpread({
29
- spec: swaggerJs.spec
30
- }, pick(swaggerJs, 'requestInterceptor', 'responseInterceptor', 'userFetch')), {}, {
27
+ var requestInterceptor = swaggerJs.requestInterceptor,
28
+ responseInterceptor = swaggerJs.responseInterceptor,
29
+ userFetch = swaggerJs.userFetch;
30
+ return swaggerJs.execute(_objectSpread({
31
+ spec: swaggerJs.spec,
32
+ requestInterceptor: requestInterceptor,
33
+ responseInterceptor: responseInterceptor,
34
+ userFetch: userFetch,
31
35
  pathName: pathName,
32
36
  method: method,
33
37
  parameters: parameters,
@@ -3,8 +3,7 @@ import _toConsumableArray from "@babel/runtime-corejs3/helpers/toConsumableArray
3
3
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
4
4
  import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
5
5
  import traverse from 'traverse';
6
- import URL from 'url';
7
- import isString from 'lodash/isString'; // This will match if the direct parent's key exactly matches an item.
6
+ import URL from 'url'; // This will match if the direct parent's key exactly matches an item.
8
7
 
9
8
  var freelyNamedKeyParents = ['properties']; // This will match if the grandparent's key exactly matches an item.
10
9
  // NOTE that this is for finding non-free paths!
@@ -46,7 +45,7 @@ export function generateAbsoluteRefPatches(obj, basePath) {
46
45
 
47
46
  var patches = [];
48
47
  traverse(obj).forEach(function callback() {
49
- if (_includesInstanceProperty(targetKeys).call(targetKeys, this.key) && isString(this.node)) {
48
+ if (_includesInstanceProperty(targetKeys).call(targetKeys, this.key) && typeof this.node === 'string') {
50
49
  var nodePath = this.path; // this node's path, relative to `obj`
51
50
 
52
51
  var fullPath = _concatInstanceProperty(basePath).call(basePath, this.path);
@@ -9,11 +9,10 @@ import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/insta
9
9
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
10
10
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
11
11
  import _Object$keys2 from "@babel/runtime-corejs3/core-js-stable/object/keys";
12
+ import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
12
13
  import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
13
14
  import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/splice";
14
15
  import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
15
- import find from 'lodash/find';
16
- import noop from 'lodash/noop';
17
16
  import lib from './lib';
18
17
  import refs from './lib/refs';
19
18
  import allOf from './lib/all-of';
@@ -22,6 +21,8 @@ import properties from './lib/properties';
22
21
  import ContextTree from './lib/context-tree';
23
22
  var HARD_LIMIT = 100;
24
23
 
24
+ var noop = function noop() {};
25
+
25
26
  var SpecMap = /*#__PURE__*/function () {
26
27
  function SpecMap(opts) {
27
28
  var _this = this,
@@ -279,10 +280,10 @@ var SpecMap = /*#__PURE__*/function () {
279
280
  }, {
280
281
  key: "nextPlugin",
281
282
  value: function nextPlugin() {
282
- var _this2 = this;
283
+ var _context6,
284
+ _this2 = this;
283
285
 
284
- // Array.prototype.find doesn't work in IE 11 :(
285
- return find(this.wrappedPlugins, function (plugin) {
286
+ return _findInstanceProperty(_context6 = this.wrappedPlugins).call(_context6, function (plugin) {
286
287
  var mutations = _this2.getMutationsForPlugin(plugin);
287
288
 
288
289
  return mutations.length > 0;
@@ -292,9 +293,9 @@ var SpecMap = /*#__PURE__*/function () {
292
293
  key: "nextPromisedPatch",
293
294
  value: function nextPromisedPatch() {
294
295
  if (this.promisedPatches.length > 0) {
295
- var _context6;
296
+ var _context7;
296
297
 
297
- return _Promise.race(_mapInstanceProperty(_context6 = this.promisedPatches).call(_context6, function (patch) {
298
+ return _Promise.race(_mapInstanceProperty(_context7 = this.promisedPatches).call(_context7, function (patch) {
298
299
  return patch.value;
299
300
  }));
300
301
  }
@@ -400,7 +401,7 @@ var SpecMap = /*#__PURE__*/function () {
400
401
  }, {
401
402
  key: "removePromisedPatch",
402
403
  value: function removePromisedPatch(patch) {
403
- var _context7;
404
+ var _context8;
404
405
 
405
406
  var index = this.promisedPatches.indexOf(patch);
406
407
 
@@ -409,7 +410,7 @@ var SpecMap = /*#__PURE__*/function () {
409
410
  return;
410
411
  }
411
412
 
412
- _spliceInstanceProperty(_context7 = this.promisedPatches).call(_context7, index, 1);
413
+ _spliceInstanceProperty(_context8 = this.promisedPatches).call(_context8, index, 1);
413
414
  }
414
415
  }, {
415
416
  key: "promisedPatchThen",
@@ -434,7 +435,7 @@ var SpecMap = /*#__PURE__*/function () {
434
435
  }, {
435
436
  key: "getMutations",
436
437
  value: function getMutations(from, to) {
437
- var _context8;
438
+ var _context9;
438
439
 
439
440
  from = from || 0;
440
441
 
@@ -442,7 +443,7 @@ var SpecMap = /*#__PURE__*/function () {
442
443
  to = this.mutations.length;
443
444
  }
444
445
 
445
- return _sliceInstanceProperty(_context8 = this.mutations).call(_context8, from, to);
446
+ return _sliceInstanceProperty(_context9 = this.mutations).call(_context9, from, to);
446
447
  }
447
448
  }, {
448
449
  key: "getCurrentMutations",
@@ -526,19 +527,19 @@ var SpecMap = /*#__PURE__*/function () {
526
527
  that.pluginCount[plugin] = (that.pluginCount[plugin] || 0) + 1;
527
528
 
528
529
  if (that.pluginCount[plugin] > HARD_LIMIT) {
529
- var _context9;
530
+ var _context10;
530
531
 
531
532
  return _Promise.resolve({
532
533
  spec: that.state,
533
- errors: _concatInstanceProperty(_context9 = that.errors).call(_context9, new Error("We've reached a hard limit of ".concat(HARD_LIMIT, " plugin runs")))
534
+ errors: _concatInstanceProperty(_context10 = that.errors).call(_context10, new Error("We've reached a hard limit of ".concat(HARD_LIMIT, " plugin runs")))
534
535
  });
535
536
  } // A different plugin runs, wait for all promises to resolve, then retry
536
537
 
537
538
 
538
539
  if (plugin !== this.currentPlugin && this.promisedPatches.length) {
539
- var _context10;
540
+ var _context11;
540
541
 
541
- var promises = _mapInstanceProperty(_context10 = this.promisedPatches).call(_context10, function (p) {
542
+ var promises = _mapInstanceProperty(_context11 = this.promisedPatches).call(_context11, function (p) {
542
543
  return p.value;
543
544
  }); // Waits for all to settle instead of Promise.all which stops on rejection
544
545
 
@@ -6,9 +6,11 @@ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/insta
6
6
  import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
7
7
  import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
8
8
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
9
- import { fetch } from 'cross-fetch';
9
+ import _URLSearchParams from "@babel/runtime-corejs3/core-js-stable/url-search-params";
10
+ import 'cross-fetch/polyfill';
11
+ /* global fetch */
12
+
10
13
  import jsYaml from 'js-yaml';
11
- import qs from 'querystring-browser';
12
14
  import url from 'url';
13
15
  import lib from '.';
14
16
  import createError from './create-error';
@@ -391,7 +393,7 @@ function fetchJSON(docPath) {
391
393
  }).then(function (res) {
392
394
  return res.text();
393
395
  }).then(function (text) {
394
- return jsYaml.safeLoad(text);
396
+ return jsYaml.load(text);
395
397
  });
396
398
  }
397
399
  /**
@@ -454,7 +456,8 @@ function unescapeJsonPointerToken(token) {
454
456
  return token;
455
457
  }
456
458
 
457
- return qs.unescape(token.replace(/~1/g, '/').replace(/~0/g, '~'));
459
+ var params = new _URLSearchParams("=".concat(token.replace(/~1/g, '/').replace(/~0/g, '~')));
460
+ return params.get('');
458
461
  }
459
462
  /**
460
463
  * Escapes a JSON pointer.
@@ -463,7 +466,10 @@ function unescapeJsonPointerToken(token) {
463
466
 
464
467
 
465
468
  function escapeJsonPointerToken(token) {
466
- return qs.escape(token.replace(/~/g, '~0').replace(/\//g, '~1'));
469
+ var _context4;
470
+
471
+ var params = new _URLSearchParams([['', token.replace(/~/g, '~0').replace(/\//g, '~1')]]);
472
+ return _sliceInstanceProperty(_context4 = params.toString()).call(_context4, 1);
467
473
  }
468
474
 
469
475
  function arrayToJsonPointer(arr) {
@@ -499,7 +505,7 @@ function pointerIsAParent(pointer, parentPointer) {
499
505
 
500
506
 
501
507
  function pointerAlreadyInPath(pointer, basePath, parent, specmap) {
502
- var _context4, _context6;
508
+ var _context5, _context7;
503
509
 
504
510
  var refs = specmapRefs.get(specmap);
505
511
 
@@ -512,7 +518,7 @@ function pointerAlreadyInPath(pointer, basePath, parent, specmap) {
512
518
 
513
519
  var parentPointer = arrayToJsonPointer(parent);
514
520
 
515
- var fullyQualifiedPointer = _concatInstanceProperty(_context4 = "".concat(basePath || '<specmap-base>', "#")).call(_context4, pointer); // dirty hack to strip `allof/[index]` from the path, in order to avoid cases
521
+ var fullyQualifiedPointer = _concatInstanceProperty(_context5 = "".concat(basePath || '<specmap-base>', "#")).call(_context5, pointer); // dirty hack to strip `allof/[index]` from the path, in order to avoid cases
516
522
  // where we get false negatives because:
517
523
  // - we resolve a path, then
518
524
  // - allOf plugin collapsed `allOf/[index]` out of the path, then
@@ -530,7 +536,7 @@ function pointerAlreadyInPath(pointer, basePath, parent, specmap) {
530
536
 
531
537
  var rootDoc = specmap.contextTree.get([]).baseDoc;
532
538
 
533
- if (basePath == rootDoc && pointerIsAParent(safeParentPointer, pointer)) {
539
+ if (basePath === rootDoc && pointerIsAParent(safeParentPointer, pointer)) {
534
540
  // eslint-disable-line
535
541
  return true;
536
542
  } // Case 2: indirect cycle
@@ -542,9 +548,9 @@ function pointerAlreadyInPath(pointer, basePath, parent, specmap) {
542
548
 
543
549
  var currPath = '';
544
550
  var hasIndirectCycle = parent.some(function (token) {
545
- var _context5;
551
+ var _context6;
546
552
 
547
- currPath = _concatInstanceProperty(_context5 = "".concat(currPath, "/")).call(_context5, escapeJsonPointerToken(token));
553
+ currPath = _concatInstanceProperty(_context6 = "".concat(currPath, "/")).call(_context6, escapeJsonPointerToken(token));
548
554
  return refs[currPath] && refs[currPath].some(function (ref) {
549
555
  return pointerIsAParent(ref, fullyQualifiedPointer) || pointerIsAParent(fullyQualifiedPointer, ref);
550
556
  });
@@ -556,7 +562,7 @@ function pointerAlreadyInPath(pointer, basePath, parent, specmap) {
556
562
  // No need to store if has cycle, as parent path is a dead-end and won't be checked again.
557
563
 
558
564
 
559
- refs[safeParentPointer] = _concatInstanceProperty(_context6 = refs[safeParentPointer] || []).call(_context6, fullyQualifiedPointer);
565
+ refs[safeParentPointer] = _concatInstanceProperty(_context7 = refs[safeParentPointer] || []).call(_context7, fullyQualifiedPointer);
560
566
  return undefined;
561
567
  }
562
568
  /**
@@ -1,17 +1,15 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.execute = execute;
5
- exports.buildRequest = buildRequest;
6
4
  exports.baseUrl = baseUrl;
5
+ exports.buildRequest = buildRequest;
6
+ exports.execute = execute;
7
7
  exports.self = void 0;
8
8
 
9
9
  var _get = _interopRequireDefault(require("lodash/get"));
10
10
 
11
11
  var _isPlainObject = _interopRequireDefault(require("lodash/isPlainObject"));
12
12
 
13
- var _isArray = _interopRequireDefault(require("lodash/isArray"));
14
-
15
13
  var _url = _interopRequireDefault(require("url"));
16
14
 
17
15
  var _cookie = _interopRequireDefault(require("cookie"));
@@ -113,7 +111,7 @@ function execute(_ref) {
113
111
  http
114
112
  }, extras));
115
113
 
116
- if (request.body && ((0, _isPlainObject.default)(request.body) || (0, _isArray.default)(request.body))) {
114
+ if (request.body && ((0, _isPlainObject.default)(request.body) || Array.isArray(request.body))) {
117
115
  request.body = JSON.stringify(request.body);
118
116
  } // Build request and execute it
119
117
 
@@ -1,10 +1,8 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.default = buildRequest;
5
4
  exports.applySecurities = applySecurities;
6
-
7
- var _assign = _interopRequireDefault(require("lodash/assign"));
5
+ exports.default = buildRequest;
8
6
 
9
7
  var _get = _interopRequireDefault(require("lodash/get"));
10
8
 
@@ -14,8 +12,12 @@ var _btoa = _interopRequireDefault(require("btoa"));
14
12
 
15
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
14
 
17
- // This function runs after the common function,
18
- // `src/execute/index.js#buildRequest`
15
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
16
+
17
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
18
+
19
+ 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; }
20
+
19
21
  function buildRequest(options, req) {
20
22
  const {
21
23
  operation,
@@ -103,7 +105,8 @@ function applySecurities({
103
105
  operation = {},
104
106
  spec
105
107
  }) {
106
- const result = (0, _assign.default)({}, request);
108
+ const result = _objectSpread({}, request);
109
+
107
110
  const {
108
111
  authorized = {}
109
112
  } = securities;
@@ -1,23 +1,21 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
+ exports.cookie = cookie;
5
+ exports.header = header;
4
6
  exports.path = path;
5
7
  exports.query = query;
6
- exports.header = header;
7
- exports.cookie = cookie;
8
-
9
- var _pick = _interopRequireDefault(require("lodash/pick"));
10
8
 
11
9
  var _styleSerializer = _interopRequireWildcard(require("./style-serializer"));
12
10
 
13
11
  var _contentSerializer = _interopRequireDefault(require("./content-serializer"));
14
12
 
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+
15
15
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
16
16
 
17
17
  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; }
18
18
 
19
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
-
21
19
  function path({
22
20
  req,
23
21
  value,
@@ -70,9 +68,18 @@ function query({
70
68
  }
71
69
 
72
70
  if (value) {
71
+ const {
72
+ style,
73
+ explode,
74
+ allowReserved
75
+ } = parameter;
73
76
  req.query[parameter.name] = {
74
77
  value,
75
- serializationOption: (0, _pick.default)(parameter, ['style', 'explode', 'allowReserved'])
78
+ serializationOption: {
79
+ style,
80
+ explode,
81
+ allowReserved
82
+ }
76
83
  };
77
84
  } else if (parameter.allowEmptyValue && value !== undefined) {
78
85
  const paramName = parameter.name;