swagger-client 3.26.6 → 3.26.7

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.
@@ -658,16 +658,14 @@ function path({
658
658
  if (value === undefined) return;
659
659
  if (content) {
660
660
  const effectiveMediaType = Object.keys(content)[0];
661
- req.url = req.url.split(`{${name}}`).join((0,_style_serializer_js__WEBPACK_IMPORTED_MODULE_0__.encodeDisallowedCharacters)((0,_content_serializer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(value, effectiveMediaType), {
662
- escape: true
663
- }));
661
+ req.url = req.url.split(`{${name}}`).join((0,_style_serializer_js__WEBPACK_IMPORTED_MODULE_0__.encodeCharacters)((0,_content_serializer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(value, effectiveMediaType)));
664
662
  } else {
665
663
  const styledValue = (0,_style_serializer_js__WEBPACK_IMPORTED_MODULE_0__["default"])({
666
664
  key: parameter.name,
667
665
  value,
668
666
  style: style || 'simple',
669
667
  explode: explode || false,
670
- escape: true
668
+ escape: 'reserved'
671
669
  });
672
670
  req.url = req.url.replace(new RegExp(`{${name}}`, 'g'), styledValue);
673
671
  }
@@ -774,38 +772,23 @@ function cookie({
774
772
  __webpack_require__.r(__webpack_exports__);
775
773
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
776
774
  /* harmony export */ "default": () => (/* binding */ stylize),
777
- /* harmony export */ encodeDisallowedCharacters: () => (/* binding */ encodeDisallowedCharacters),
775
+ /* harmony export */ encodeCharacters: () => (/* binding */ encodeCharacters),
778
776
  /* harmony export */ valueEncoder: () => (/* binding */ valueEncoder)
779
777
  /* harmony export */ });
780
778
  const isRfc3986Reserved = char => ":/?#[]@!$&'()*+,;=".indexOf(char) > -1;
781
- const isRrc3986Unreserved = char => /^[a-z0-9\-._~]+$/i.test(char);
779
+ const isRfc3986Unreserved = char => /^[a-z0-9\-._~]+$/i.test(char);
782
780
 
783
781
  // eslint-disable-next-line default-param-last
784
- function encodeDisallowedCharacters(str, {
785
- escape
786
- } = {}, parse) {
787
- if (typeof str === 'number') {
788
- str = str.toString();
789
- }
790
- if (typeof str !== 'string' || !str.length) {
791
- return str;
792
- }
793
- if (!escape) {
794
- return str;
795
- }
796
- if (parse) {
797
- return JSON.parse(str);
798
- }
799
-
782
+ function encodeCharacters(str, characterSet = 'reserved') {
800
783
  // In ES6 you can do this quite easily by using the new ... spread operator.
801
784
  // This causes the string iterator (another new ES6 feature) to be used internally,
802
785
  // and because that iterator is designed to deal with
803
786
  // code points rather than UCS-2/UTF-16 code units.
804
787
  return [...str].map(char => {
805
- if (isRrc3986Unreserved(char)) {
788
+ if (isRfc3986Unreserved(char)) {
806
789
  return char;
807
790
  }
808
- if (isRfc3986Reserved(char) && escape === 'unsafe') {
791
+ if (isRfc3986Reserved(char) && characterSet === 'unsafe') {
809
792
  return char;
810
793
  }
811
794
  const encoder = new TextEncoder();
@@ -825,13 +808,16 @@ function stylize(config) {
825
808
  }
826
809
  return encodePrimitive(config);
827
810
  }
828
- function valueEncoder(value, escape) {
811
+ function valueEncoder(value, escape = false) {
829
812
  if (Array.isArray(value) || value !== null && typeof value === 'object') {
830
813
  value = JSON.stringify(value);
814
+ } else if (typeof value === 'number' || typeof value === 'boolean') {
815
+ value = String(value);
831
816
  }
832
- return encodeDisallowedCharacters(value, {
833
- escape
834
- });
817
+ if (escape && value.length > 0) {
818
+ return encodeCharacters(value, escape);
819
+ }
820
+ return value;
835
821
  }
836
822
  function encodeArray({
837
823
  key,
@@ -20650,6 +20636,14 @@ const mergeAll = (visitors, {
20650
20636
  const visitFn = visitFnGetter(visitors[i], nodeTypeGetter(currentNode), false);
20651
20637
  if (typeof visitFn === 'function') {
20652
20638
  const result = visitFn.call(visitors[i], currentNode, ...rest);
20639
+
20640
+ // check if the visitor is async
20641
+ if (typeof (result === null || result === void 0 ? void 0 : result.then) === 'function') {
20642
+ throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_0__["default"]('Async visitor not supported in sync mode', {
20643
+ visitor: visitors[i],
20644
+ visitFn
20645
+ });
20646
+ }
20653
20647
  if (result === skipVisitingNodeSymbol) {
20654
20648
  skipping[i] = node;
20655
20649
  } else if (result === breakSymbol) {
@@ -20675,6 +20669,14 @@ const mergeAll = (visitors, {
20675
20669
  const visitFn = visitFnGetter(visitors[i], nodeTypeGetter(node), true);
20676
20670
  if (typeof visitFn === 'function') {
20677
20671
  const result = visitFn.call(visitors[i], node, ...rest);
20672
+
20673
+ // check if the visitor is async
20674
+ if (typeof (result === null || result === void 0 ? void 0 : result.then) === 'function') {
20675
+ throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_0__["default"]('Async visitor not supported in sync mode', {
20676
+ visitor: visitors[i],
20677
+ visitFn
20678
+ });
20679
+ }
20678
20680
  if (result === breakSymbol) {
20679
20681
  skipping[i] = breakSymbol;
20680
20682
  } else if (result !== undefined && result !== skipVisitingNodeSymbol) {
@@ -20918,6 +20920,7 @@ visitor, {
20918
20920
  }
20919
20921
  let result;
20920
20922
  if (!Array.isArray(node)) {
20923
+ var _result;
20921
20924
  if (!nodePredicate(node)) {
20922
20925
  throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_0__["default"](`Invalid AST Node: ${String(node)}`, {
20923
20926
  node
@@ -20939,6 +20942,14 @@ visitor, {
20939
20942
  // retrieve result
20940
20943
  result = visitFn.call(visitor, node, key, parent, path, ancestors);
20941
20944
  }
20945
+
20946
+ // check if the visitor is async
20947
+ if (typeof ((_result = result) === null || _result === void 0 ? void 0 : _result.then) === 'function') {
20948
+ throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_0__["default"]('Async visitor not supported in sync mode', {
20949
+ visitor,
20950
+ visitFn
20951
+ });
20952
+ }
20942
20953
  if (result === breakSymbol) {
20943
20954
  break;
20944
20955
  }