swagger-client 3.23.0 → 3.23.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.
@@ -1,13 +1,20 @@
1
1
  import Http from '../../http/index.js';
2
2
  export const retrievalURI = options => {
3
+ var _ref, _globalThis$document;
4
+ /**
5
+ * Swagger-UI uses baseDoc instead of url, this helper function exists
6
+ * to allow both.
7
+ *
8
+ * In browser environment, we allow to pass a relative URI Reference,
9
+ * and we resolve it against the document's baseURI before passing it deeper
10
+ * to swagger-client code.
11
+ */
3
12
  const {
4
13
  baseDoc,
5
14
  url
6
15
  } = options;
7
-
8
- // @TODO Swagger-UI uses baseDoc instead of url, this is to allow both
9
- // need to fix and pick one.
10
- return baseDoc || url || '';
16
+ const retrievalURL = (_ref = baseDoc !== null && baseDoc !== void 0 ? baseDoc : url) !== null && _ref !== void 0 ? _ref : '';
17
+ return typeof ((_globalThis$document = globalThis.document) === null || _globalThis$document === void 0 ? void 0 : _globalThis$document.baseURI) === 'string' ? String(new URL(retrievalURL, globalThis.document.baseURI)) : retrievalURL;
11
18
  };
12
19
  export const httpClient = options => {
13
20
  const {
@@ -5,14 +5,21 @@ exports.__esModule = true;
5
5
  exports.retrievalURI = exports.httpClient = void 0;
6
6
  var _index = _interopRequireDefault(require("../../http/index.js"));
7
7
  const retrievalURI = options => {
8
+ var _ref, _globalThis$document;
9
+ /**
10
+ * Swagger-UI uses baseDoc instead of url, this helper function exists
11
+ * to allow both.
12
+ *
13
+ * In browser environment, we allow to pass a relative URI Reference,
14
+ * and we resolve it against the document's baseURI before passing it deeper
15
+ * to swagger-client code.
16
+ */
8
17
  const {
9
18
  baseDoc,
10
19
  url
11
20
  } = options;
12
-
13
- // @TODO Swagger-UI uses baseDoc instead of url, this is to allow both
14
- // need to fix and pick one.
15
- return baseDoc || url || '';
21
+ const retrievalURL = (_ref = baseDoc != null ? baseDoc : url) != null ? _ref : '';
22
+ return typeof ((_globalThis$document = globalThis.document) == null ? void 0 : _globalThis$document.baseURI) === 'string' ? String(new URL(retrievalURL, globalThis.document.baseURI)) : retrievalURL;
16
23
  };
17
24
  exports.retrievalURI = retrievalURI;
18
25
  const httpClient = options => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swagger-client",
3
- "version": "3.23.0",
3
+ "version": "3.23.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",
@@ -87,7 +87,7 @@
87
87
  "eslint-plugin-import": "=2.28.1",
88
88
  "eslint-plugin-prettier": "=5.0.0",
89
89
  "expect": "^29.0.3",
90
- "glob": "=10.3.5",
90
+ "glob": "=10.3.10",
91
91
  "husky": "^8.0.1",
92
92
  "inspectpack": "=4.7.1",
93
93
  "install": "=0.13.0",