swagger-client 3.26.5 → 3.26.6

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.
@@ -774,7 +774,8 @@ function cookie({
774
774
  __webpack_require__.r(__webpack_exports__);
775
775
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
776
776
  /* harmony export */ "default": () => (/* binding */ stylize),
777
- /* harmony export */ encodeDisallowedCharacters: () => (/* binding */ encodeDisallowedCharacters)
777
+ /* harmony export */ encodeDisallowedCharacters: () => (/* binding */ encodeDisallowedCharacters),
778
+ /* harmony export */ valueEncoder: () => (/* binding */ valueEncoder)
778
779
  /* harmony export */ });
779
780
  const isRfc3986Reserved = char => ":/?#[]@!$&'()*+,;=".indexOf(char) > -1;
780
781
  const isRrc3986Unreserved = char => /^[a-z0-9\-._~]+$/i.test(char);
@@ -824,6 +825,14 @@ function stylize(config) {
824
825
  }
825
826
  return encodePrimitive(config);
826
827
  }
828
+ function valueEncoder(value, escape) {
829
+ if (Array.isArray(value) || value !== null && typeof value === 'object') {
830
+ value = JSON.stringify(value);
831
+ }
832
+ return encodeDisallowedCharacters(value, {
833
+ escape
834
+ });
835
+ }
827
836
  function encodeArray({
828
837
  key,
829
838
  value,
@@ -831,17 +840,14 @@ function encodeArray({
831
840
  explode,
832
841
  escape
833
842
  }) {
834
- const valueEncoder = str => encodeDisallowedCharacters(str, {
835
- escape
836
- });
837
843
  if (style === 'simple') {
838
- return value.map(val => valueEncoder(val)).join(',');
844
+ return value.map(val => valueEncoder(val, escape)).join(',');
839
845
  }
840
846
  if (style === 'label') {
841
- return `.${value.map(val => valueEncoder(val)).join('.')}`;
847
+ return `.${value.map(val => valueEncoder(val, escape)).join('.')}`;
842
848
  }
843
849
  if (style === 'matrix') {
844
- return value.map(val => valueEncoder(val)).reduce((prev, curr) => {
850
+ return value.map(val => valueEncoder(val, escape)).reduce((prev, curr) => {
845
851
  if (!prev || explode) {
846
852
  return `${prev || ''};${key}=${curr}`;
847
853
  }
@@ -850,15 +856,15 @@ function encodeArray({
850
856
  }
851
857
  if (style === 'form') {
852
858
  const after = explode ? `&${key}=` : ',';
853
- return value.map(val => valueEncoder(val)).join(after);
859
+ return value.map(val => valueEncoder(val, escape)).join(after);
854
860
  }
855
861
  if (style === 'spaceDelimited') {
856
862
  const after = explode ? `${key}=` : '';
857
- return value.map(val => valueEncoder(val)).join(` ${after}`);
863
+ return value.map(val => valueEncoder(val, escape)).join(` ${after}`);
858
864
  }
859
865
  if (style === 'pipeDelimited') {
860
866
  const after = explode ? `${key}=` : '';
861
- return value.map(val => valueEncoder(val)).join(`|${after}`);
867
+ return value.map(val => valueEncoder(val, escape)).join(`|${after}`);
862
868
  }
863
869
  return undefined;
864
870
  }
@@ -869,13 +875,10 @@ function encodeObject({
869
875
  explode,
870
876
  escape
871
877
  }) {
872
- const valueEncoder = str => encodeDisallowedCharacters(str, {
873
- escape
874
- });
875
878
  const valueKeys = Object.keys(value);
876
879
  if (style === 'simple') {
877
880
  return valueKeys.reduce((prev, curr) => {
878
- const val = valueEncoder(value[curr]);
881
+ const val = valueEncoder(value[curr], escape);
879
882
  const middleChar = explode ? '=' : ',';
880
883
  const prefix = prev ? `${prev},` : '';
881
884
  return `${prefix}${curr}${middleChar}${val}`;
@@ -883,7 +886,7 @@ function encodeObject({
883
886
  }
884
887
  if (style === 'label') {
885
888
  return valueKeys.reduce((prev, curr) => {
886
- const val = valueEncoder(value[curr]);
889
+ const val = valueEncoder(value[curr], escape);
887
890
  const middleChar = explode ? '=' : '.';
888
891
  const prefix = prev ? `${prev}.` : '.';
889
892
  return `${prefix}${curr}${middleChar}${val}`;
@@ -891,7 +894,7 @@ function encodeObject({
891
894
  }
892
895
  if (style === 'matrix' && explode) {
893
896
  return valueKeys.reduce((prev, curr) => {
894
- const val = valueEncoder(value[curr]);
897
+ const val = valueEncoder(value[curr], escape);
895
898
  const prefix = prev ? `${prev};` : ';';
896
899
  return `${prefix}${curr}=${val}`;
897
900
  }, '');
@@ -899,14 +902,14 @@ function encodeObject({
899
902
  if (style === 'matrix') {
900
903
  // no explode
901
904
  return valueKeys.reduce((prev, curr) => {
902
- const val = valueEncoder(value[curr]);
905
+ const val = valueEncoder(value[curr], escape);
903
906
  const prefix = prev ? `${prev},` : `;${key}=`;
904
907
  return `${prefix}${curr},${val}`;
905
908
  }, '');
906
909
  }
907
910
  if (style === 'form') {
908
911
  return valueKeys.reduce((prev, curr) => {
909
- const val = valueEncoder(value[curr]);
912
+ const val = valueEncoder(value[curr], escape);
910
913
  const prefix = prev ? `${prev}${explode ? '&' : ','}` : '';
911
914
  const separator = explode ? '=' : ',';
912
915
  return `${prefix}${curr}${separator}${val}`;
@@ -920,23 +923,20 @@ function encodePrimitive({
920
923
  style,
921
924
  escape
922
925
  }) {
923
- const valueEncoder = str => encodeDisallowedCharacters(str, {
924
- escape
925
- });
926
926
  if (style === 'simple') {
927
- return valueEncoder(value);
927
+ return valueEncoder(value, escape);
928
928
  }
929
929
  if (style === 'label') {
930
- return `.${valueEncoder(value)}`;
930
+ return `.${valueEncoder(value, escape)}`;
931
931
  }
932
932
  if (style === 'matrix') {
933
- return `;${key}=${valueEncoder(value)}`;
933
+ return `;${key}=${valueEncoder(value, escape)}`;
934
934
  }
935
935
  if (style === 'form') {
936
- return valueEncoder(value);
936
+ return valueEncoder(value, escape);
937
937
  }
938
938
  if (style === 'deepObject') {
939
- return valueEncoder(value, {}, true);
939
+ return valueEncoder(value, escape);
940
940
  }
941
941
  return undefined;
942
942
  }
@@ -1857,12 +1857,8 @@ function formatKeyValueBySerializationOption(key, value, skipEncoding, serializa
1857
1857
  const explode = typeof serializationOption.explode === 'undefined' ? style === 'form' : serializationOption.explode;
1858
1858
  // eslint-disable-next-line no-nested-ternary
1859
1859
  const escape = skipEncoding ? false : serializationOption && serializationOption.allowReserved ? 'unsafe' : 'reserved';
1860
- const encodeFn = v => (0,_execute_oas3_style_serializer_js__WEBPACK_IMPORTED_MODULE_2__.encodeDisallowedCharacters)(v, {
1861
- escape
1862
- });
1863
- const encodeKeyFn = skipEncoding ? k => k : k => (0,_execute_oas3_style_serializer_js__WEBPACK_IMPORTED_MODULE_2__.encodeDisallowedCharacters)(k, {
1864
- escape
1865
- });
1860
+ const encodeFn = v => (0,_execute_oas3_style_serializer_js__WEBPACK_IMPORTED_MODULE_2__.valueEncoder)(v, escape);
1861
+ const encodeKeyFn = skipEncoding ? k => k : k => encodeFn(k);
1866
1862
 
1867
1863
  // Primitive
1868
1864
  if (typeof value !== 'object') {