swagger-client 3.21.0 → 3.22.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.
@@ -1,4 +1,4 @@
1
- import { fetch, Headers, Request, Response } from './fetch-ponyfill.browser.js';
1
+ import { fetch, Headers, Request, Response, FormData, File, Blob } from './fetch-ponyfill.browser.js';
2
2
  if (typeof globalThis.fetch === 'undefined') {
3
3
  globalThis.fetch = fetch;
4
4
  }
@@ -10,4 +10,13 @@ if (typeof globalThis.Request === 'undefined') {
10
10
  }
11
11
  if (typeof globalThis.Response === 'undefined') {
12
12
  globalThis.Response = Response;
13
+ }
14
+ if (typeof globalThis.FormData === 'undefined') {
15
+ globalThis.FormData = FormData;
16
+ }
17
+ if (typeof globalThis.File === 'undefined') {
18
+ globalThis.File = File;
19
+ }
20
+ if (typeof globalThis.Blob === 'undefined') {
21
+ globalThis.Blob = Blob;
13
22
  }
@@ -1,5 +1,5 @@
1
- import { fetch as fetchU, Headers as HeaderU, Request as RequestU, Response as ResponseU } from './fetch-ponyfill-undici.node.js';
2
- import { fetch as fetchNF, Headers as HeadersNF, Request as RequestNF, Response as ResponseNF } from './fetch-ponyfill-node-fetch.node.js';
1
+ import { fetch as fetchU, Headers as HeaderU, Request as RequestU, Response as ResponseU, FormData as FormDataU, File as FileU, Blob as BlobU } from './fetch-ponyfill-undici.node.js';
2
+ import { fetch as fetchNF, Headers as HeadersNF, Request as RequestNF, Response as ResponseNF, FormData as FormDataNF, File as FileNF, Blob as BlobNF } from './fetch-ponyfill-node-fetch.node.js';
3
3
  if (typeof globalThis.fetch === 'undefined') {
4
4
  globalThis.fetch = fetchU || fetchNF;
5
5
  }
@@ -11,4 +11,13 @@ if (typeof globalThis.Request === 'undefined') {
11
11
  }
12
12
  if (typeof globalThis.Response === 'undefined') {
13
13
  globalThis.Response = ResponseU || ResponseNF;
14
+ }
15
+ if (typeof globalThis.FormData === 'undefined') {
16
+ globalThis.FormData = FormDataU || FormDataNF;
17
+ }
18
+ if (typeof globalThis.File === 'undefined') {
19
+ globalThis.File = FileU || FileNF;
20
+ }
21
+ if (typeof globalThis.Blob === 'undefined') {
22
+ globalThis.Blob = BlobU || BlobNF;
14
23
  }
@@ -1,3 +1,3 @@
1
1
  // we cannot use `node-fetch@3` as it's pure ESM package not compatible with CommonJS
2
- import fetch, { Response, Headers, Request } from 'node-fetch-commonjs';
3
- export { fetch, Response, Headers, Request };
2
+ import fetch, { Response, Headers, Request, FormData, File, Blob } from 'node-fetch-commonjs';
3
+ export { fetch, Response, Headers, Request, FormData, File, Blob };
@@ -1,2 +1,4 @@
1
- import { fetch, Response, Headers, Request } from 'undici';
2
- export { fetch, Response, Headers, Request };
1
+ import { Blob } from 'buffer';
2
+ import { fetch, Response, Headers, Request, FormData, File } from 'undici';
3
+ const BlobU = typeof fetch === 'undefined' ? undefined : Blob;
4
+ export { fetch, Response, Headers, Request, FormData, File, BlobU as Blob };
@@ -3,6 +3,9 @@ const {
3
3
  fetch,
4
4
  Response,
5
5
  Headers,
6
- Request
6
+ Request,
7
+ FormData,
8
+ File,
9
+ Blob
7
10
  } = globalThis;
8
- export { fetch, Response, Headers, Request };
11
+ export { fetch, Response, Headers, Request, FormData, File, Blob };
package/es/http/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import qs from 'qs';
2
2
  import jsYaml from 'js-yaml';
3
- import { FormData, File, Blob } from 'formdata-node';
4
3
  import '../helpers/fetch-polyfill.node.js';
5
4
  import { encodeDisallowedCharacters } from '../execute/oas3/style-serializer.js';
6
5
 
@@ -12,4 +12,13 @@ if (typeof globalThis.Request === 'undefined') {
12
12
  }
13
13
  if (typeof globalThis.Response === 'undefined') {
14
14
  globalThis.Response = _fetchPonyfillBrowser.Response;
15
+ }
16
+ if (typeof globalThis.FormData === 'undefined') {
17
+ globalThis.FormData = _fetchPonyfillBrowser.FormData;
18
+ }
19
+ if (typeof globalThis.File === 'undefined') {
20
+ globalThis.File = _fetchPonyfillBrowser.File;
21
+ }
22
+ if (typeof globalThis.Blob === 'undefined') {
23
+ globalThis.Blob = _fetchPonyfillBrowser.Blob;
15
24
  }
@@ -13,4 +13,13 @@ if (typeof globalThis.Request === 'undefined') {
13
13
  }
14
14
  if (typeof globalThis.Response === 'undefined') {
15
15
  globalThis.Response = _fetchPonyfillUndiciNode.Response || _fetchPonyfillNodeFetchNode.Response;
16
+ }
17
+ if (typeof globalThis.FormData === 'undefined') {
18
+ globalThis.FormData = _fetchPonyfillUndiciNode.FormData || _fetchPonyfillNodeFetchNode.FormData;
19
+ }
20
+ if (typeof globalThis.File === 'undefined') {
21
+ globalThis.File = _fetchPonyfillUndiciNode.File || _fetchPonyfillNodeFetchNode.File;
22
+ }
23
+ if (typeof globalThis.Blob === 'undefined') {
24
+ globalThis.Blob = _fetchPonyfillUndiciNode.Blob || _fetchPonyfillNodeFetchNode.Blob;
16
25
  }
@@ -6,4 +6,7 @@ var _nodeFetchCommonjs = _interopRequireWildcard(require("node-fetch-commonjs"))
6
6
  exports.fetch = _nodeFetchCommonjs.default;
7
7
  exports.Response = _nodeFetchCommonjs.Response;
8
8
  exports.Headers = _nodeFetchCommonjs.Headers;
9
- exports.Request = _nodeFetchCommonjs.Request;
9
+ exports.Request = _nodeFetchCommonjs.Request;
10
+ exports.FormData = _nodeFetchCommonjs.FormData;
11
+ exports.File = _nodeFetchCommonjs.File;
12
+ exports.Blob = _nodeFetchCommonjs.Blob;
@@ -1,8 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
+ exports.Blob = void 0;
5
+ var _buffer = require("buffer");
4
6
  var _undici = require("undici");
5
7
  exports.fetch = _undici.fetch;
6
8
  exports.Response = _undici.Response;
7
9
  exports.Headers = _undici.Headers;
8
- exports.Request = _undici.Request;
10
+ exports.Request = _undici.Request;
11
+ exports.FormData = _undici.FormData;
12
+ exports.File = _undici.File;
13
+ const BlobU = typeof _undici.fetch === 'undefined' ? undefined : _buffer.Blob;
14
+ exports.Blob = BlobU;
@@ -1,14 +1,20 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.fetch = exports.Response = exports.Request = exports.Headers = void 0;
4
+ exports.fetch = exports.Response = exports.Request = exports.Headers = exports.FormData = exports.File = exports.Blob = void 0;
5
5
  // we're targeting browsers that already support fetch API
6
6
  const {
7
7
  fetch,
8
8
  Response,
9
9
  Headers,
10
- Request
10
+ Request,
11
+ FormData,
12
+ File,
13
+ Blob
11
14
  } = globalThis;
15
+ exports.Blob = Blob;
16
+ exports.File = File;
17
+ exports.FormData = FormData;
12
18
  exports.Request = Request;
13
19
  exports.Headers = Headers;
14
20
  exports.Response = Response;
package/lib/http/index.js CHANGED
@@ -13,7 +13,6 @@ exports.serializeRes = serializeRes;
13
13
  exports.shouldDownloadAsText = void 0;
14
14
  var _qs = _interopRequireDefault(require("qs"));
15
15
  var _jsYaml = _interopRequireDefault(require("js-yaml"));
16
- var _formdataNode = require("formdata-node");
17
16
  require("../helpers/fetch-polyfill.node.js");
18
17
  var _styleSerializer = require("../execute/oas3/style-serializer.js");
19
18
  // For testing
@@ -176,10 +175,10 @@ function isFile(obj, navigatorObj) {
176
175
  }
177
176
  return false;
178
177
  }
179
- if (typeof _formdataNode.File !== 'undefined' && obj instanceof _formdataNode.File) {
178
+ if (typeof File !== 'undefined' && obj instanceof File) {
180
179
  return true;
181
180
  }
182
- if (typeof _formdataNode.Blob !== 'undefined' && obj instanceof _formdataNode.Blob) {
181
+ if (typeof Blob !== 'undefined' && obj instanceof Blob) {
183
182
  return true;
184
183
  }
185
184
  if (ArrayBuffer.isView(obj)) {
@@ -210,7 +209,7 @@ const SEPARATORS = {
210
209
  * This sub-class is exclusively used only when Encoding Object
211
210
  * is defined within the Media Type Object (OpenAPI 3.x.y).
212
211
  */
213
- class FileWithData extends _formdataNode.File {
212
+ class FileWithData extends File {
214
213
  constructor(data, name, options) {
215
214
  if (name === void 0) {
216
215
  name = '';
@@ -386,21 +385,21 @@ function buildFormData(reqForm) {
386
385
  // eslint-disable-next-line no-restricted-syntax
387
386
  for (const v of value) {
388
387
  if (ArrayBuffer.isView(v)) {
389
- const blob = new _formdataNode.Blob([v]);
388
+ const blob = new Blob([v]);
390
389
  formData.append(key, blob);
391
390
  } else {
392
391
  formData.append(key, v);
393
392
  }
394
393
  }
395
394
  } else if (ArrayBuffer.isView(value)) {
396
- const blob = new _formdataNode.Blob([value]);
395
+ const blob = new Blob([value]);
397
396
  formData.append(key, blob);
398
397
  } else {
399
398
  formData.append(key, value);
400
399
  }
401
400
  }
402
401
  return formData;
403
- }, new _formdataNode.FormData());
402
+ }, new FormData());
404
403
  }
405
404
 
406
405
  // Encodes an object using appropriate serializer.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swagger-client",
3
- "version": "3.21.0",
3
+ "version": "3.22.0",
4
4
  "description": "SwaggerJS - a collection of interfaces for OAI specs",
5
5
  "browser": {
6
6
  "./src/helpers/btoa.node.js": "./src/helpers/btoa.browser.js",
@@ -114,7 +114,6 @@
114
114
  "cookie": "~0.5.0",
115
115
  "deepmerge": "~4.3.0",
116
116
  "fast-json-patch": "^3.0.0-1",
117
- "formdata-node": "^4.0.0",
118
117
  "is-plain-object": "^5.0.0",
119
118
  "js-yaml": "^4.1.0",
120
119
  "node-fetch-commonjs": "^3.3.1",