@scalar/oas-utils 0.2.51 → 0.2.53
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.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @scalar/oas-utils
|
|
2
2
|
|
|
3
|
+
## 0.2.53
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 46a55ae: feat(api-client): improve client import ux
|
|
8
|
+
- Updated dependencies [b26144c]
|
|
9
|
+
- @scalar/themes@0.9.35
|
|
10
|
+
|
|
11
|
+
## 0.2.52
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [9dc2ab7]
|
|
16
|
+
- @scalar/types@0.0.13
|
|
17
|
+
- @scalar/themes@0.9.34
|
|
18
|
+
|
|
3
19
|
## 0.2.51
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Fetches an OpenAPI/Swagger specification from a given URL.
|
|
3
|
+
*
|
|
4
|
+
* @throws an error if the fetch fails
|
|
5
|
+
*/
|
|
2
6
|
export declare function fetchSpecFromUrl(url: string, proxy?: string): Promise<string>;
|
|
3
7
|
//# sourceMappingURL=fetchSpecFromUrl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchSpecFromUrl.d.ts","sourceRoot":"","sources":["../../src/helpers/fetchSpecFromUrl.ts"],"names":[],"mappings":"AASA
|
|
1
|
+
{"version":3,"file":"fetchSpecFromUrl.d.ts","sourceRoot":"","sources":["../../src/helpers/fetchSpecFromUrl.ts"],"names":[],"mappings":"AASA;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,MAAM,EACX,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC,CA6BjB"}
|
|
@@ -5,7 +5,11 @@ import { formatJsonOrYamlString } from './parse.js';
|
|
|
5
5
|
const OLD_PROXY_URL = 'https://api.scalar.com/request-proxy';
|
|
6
6
|
// Does work
|
|
7
7
|
const NEW_PROXY_URL = 'https://proxy.scalar.com';
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Fetches an OpenAPI/Swagger specification from a given URL.
|
|
10
|
+
*
|
|
11
|
+
* @throws an error if the fetch fails
|
|
12
|
+
*/
|
|
9
13
|
async function fetchSpecFromUrl(url, proxy) {
|
|
10
14
|
// This replaces the OLD_PROXY_URL with the NEW_PROXY_URL on the fly.
|
|
11
15
|
if (proxy === OLD_PROXY_URL) {
|
|
@@ -20,6 +24,7 @@ async function fetchSpecFromUrl(url, proxy) {
|
|
|
20
24
|
if (!proxy) {
|
|
21
25
|
console.warn(`[fetchSpecFromUrl] Tried to fetch the specification (url: ${url}) without a proxy. Are the CORS headers configured to allow cross-domain requests? https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS`);
|
|
22
26
|
}
|
|
27
|
+
throw new Error(`Failed to fetch the specification (Status: ${response.status})`);
|
|
23
28
|
}
|
|
24
29
|
// If it’s JSON, make it pretty
|
|
25
30
|
return formatJsonOrYamlString(await response.text());
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"specification",
|
|
17
17
|
"yaml"
|
|
18
18
|
],
|
|
19
|
-
"version": "0.2.
|
|
19
|
+
"version": "0.2.53",
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": ">=18"
|
|
22
22
|
},
|
|
@@ -94,8 +94,8 @@
|
|
|
94
94
|
"zod": "^3.23.8",
|
|
95
95
|
"@scalar/object-utils": "1.1.9",
|
|
96
96
|
"@scalar/openapi-types": "0.1.1",
|
|
97
|
-
"@scalar/types": "0.0.
|
|
98
|
-
"@scalar/themes": "0.9.
|
|
97
|
+
"@scalar/types": "0.0.13",
|
|
98
|
+
"@scalar/themes": "0.9.35"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
101
|
"rollup": "^4.16.4",
|