swagger-client 3.21.0 → 3.22.1

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.
@@ -0,0 +1,7 @@
1
+ import { AbortController, AbortSignal } from './abortcontroller-ponyfill.browser.js';
2
+ if (typeof globalThis.AbortController === 'undefined') {
3
+ globalThis.AbortController = AbortController;
4
+ }
5
+ if (typeof globalThis.AbortSignal === 'undefined') {
6
+ globalThis.AbortSignal = AbortSignal;
7
+ }
@@ -0,0 +1,7 @@
1
+ import { AbortController, AbortSignal } from './abortcontroller-ponyfill.node.js';
2
+ if (typeof globalThis.AbortController === 'undefined') {
3
+ globalThis.AbortController = AbortController;
4
+ }
5
+ if (typeof globalThis.AbortSignal === 'undefined') {
6
+ globalThis.AbortSignal = AbortSignal;
7
+ }
@@ -0,0 +1,6 @@
1
+ // we're targeting browsers that already support fetch API
2
+ const {
3
+ AbortController,
4
+ AbortSignal
5
+ } = globalThis;
6
+ export { AbortController, AbortSignal };
@@ -0,0 +1 @@
1
+ export { AbortController, AbortSignal } from 'node-abort-controller';
@@ -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
 
@@ -1,6 +1,6 @@
1
- import AbortController from 'abort-controller';
2
1
  import { ResolverError, HttpResolver } from '@swagger-api/apidom-reference/configuration/empty';
3
2
  import '../../../../../../helpers/fetch-polyfill.node.js';
3
+ import '../../../../../../helpers/abortcontroller-polyfill.node.js';
4
4
  import Http from '../../../../../../http/index.js';
5
5
  const HttpResolverSwaggerClient = HttpResolver.compose({
6
6
  props: {
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ var _abortcontrollerPonyfillBrowser = require("./abortcontroller-ponyfill.browser.js");
4
+ if (typeof globalThis.AbortController === 'undefined') {
5
+ globalThis.AbortController = _abortcontrollerPonyfillBrowser.AbortController;
6
+ }
7
+ if (typeof globalThis.AbortSignal === 'undefined') {
8
+ globalThis.AbortSignal = _abortcontrollerPonyfillBrowser.AbortSignal;
9
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ var _abortcontrollerPonyfillNode = require("./abortcontroller-ponyfill.node.js");
4
+ if (typeof globalThis.AbortController === 'undefined') {
5
+ globalThis.AbortController = _abortcontrollerPonyfillNode.AbortController;
6
+ }
7
+ if (typeof globalThis.AbortSignal === 'undefined') {
8
+ globalThis.AbortSignal = _abortcontrollerPonyfillNode.AbortSignal;
9
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.AbortSignal = exports.AbortController = void 0;
5
+ // we're targeting browsers that already support fetch API
6
+ const {
7
+ AbortController,
8
+ AbortSignal
9
+ } = globalThis;
10
+ exports.AbortSignal = AbortSignal;
11
+ exports.AbortController = AbortController;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.AbortSignal = exports.AbortController = void 0;
5
+ var _nodeAbortController = require("node-abort-controller");
6
+ exports.AbortController = _nodeAbortController.AbortController;
7
+ exports.AbortSignal = _nodeAbortController.AbortSignal;
@@ -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.
@@ -3,9 +3,9 @@
3
3
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4
4
  exports.__esModule = true;
5
5
  exports.default = void 0;
6
- var _abortController = _interopRequireDefault(require("abort-controller"));
7
6
  var _empty = require("@swagger-api/apidom-reference/configuration/empty");
8
7
  require("../../../../../../helpers/fetch-polyfill.node.js");
8
+ require("../../../../../../helpers/abortcontroller-polyfill.node.js");
9
9
  var _index = _interopRequireDefault(require("../../../../../../http/index.js"));
10
10
  const HttpResolverSwaggerClient = _empty.HttpResolver.compose({
11
11
  props: {
@@ -25,7 +25,7 @@ const HttpResolverSwaggerClient = _empty.HttpResolver.compose({
25
25
  },
26
26
  async read(file) {
27
27
  const client = this.getHttpClient();
28
- const controller = new _abortController.default();
28
+ const controller = new AbortController();
29
29
  const {
30
30
  signal
31
31
  } = controller;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swagger-client",
3
- "version": "3.21.0",
3
+ "version": "3.22.1",
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",
@@ -8,7 +8,10 @@
8
8
  "./es/helpers/btoa.node.js": "./es/helpers/btoa.browser.js",
9
9
  "./src/helpers/fetch-polyfill.node.js": "./src/helpers/fetch-polyfill.browser.js",
10
10
  "./es/helpers/fetch-polyfill.node.js": "./es/helpers/fetch-polyfill.browser.js",
11
- "./lib/helpers/fetch-polyfill.node.js": "./lib/helpers/fetch-polyfill.browser.js"
11
+ "./lib/helpers/fetch-polyfill.node.js": "./lib/helpers/fetch-polyfill.browser.js",
12
+ "./src/helpers/abortcontroller-polyfill.node.js": "./src/helpers/abortcontroller-polyfill.browser.js",
13
+ "./es/helpers/abortcontroller-polyfill.node.js": "./es/helpers/abortcontroller-polyfill.browser.js",
14
+ "./lib/helpers/abortcontroller-polyfill.node.js": "./lib/helpers/abortcontroller-polyfill.browser.js"
12
15
  },
13
16
  "main": "lib/commonjs.js",
14
17
  "module": "es/index.js",
@@ -110,14 +113,13 @@
110
113
  "@swagger-api/apidom-json-pointer": ">=0.76.2 <1.0.0",
111
114
  "@swagger-api/apidom-ns-openapi-3-1": ">=0.76.2 <1.0.0",
112
115
  "@swagger-api/apidom-reference": ">=0.76.2 <1.0.0",
113
- "abort-controller": "^3.0.0",
114
116
  "cookie": "~0.5.0",
115
117
  "deepmerge": "~4.3.0",
116
118
  "fast-json-patch": "^3.0.0-1",
117
- "formdata-node": "^4.0.0",
118
119
  "is-plain-object": "^5.0.0",
119
120
  "js-yaml": "^4.1.0",
120
121
  "node-fetch-commonjs": "^3.3.1",
122
+ "node-abort-controller": "^3.1.1",
121
123
  "qs": "^6.10.2",
122
124
  "traverse": "~0.6.6",
123
125
  "undici": "^5.24.0"