@scalar/api-reference 1.28.20 → 1.28.22
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 +21 -0
- package/dist/browser/standalone.js +5526 -5537
- package/dist/browser/webpack-stats.json +1 -1
- package/dist/components/ApiReferenceLayout.vue.d.ts.map +1 -1
- package/dist/components/ApiReferenceLayout.vue.js +3 -3
- package/dist/components/ApiReferenceLayout.vue2.js +17 -16
- package/dist/components/DocumentSelector/DocumentSelector.vue.js +2 -2
- package/dist/features/ApiClientModal/ApiClientModal.vue.d.ts.map +1 -1
- package/dist/features/ApiClientModal/ApiClientModal.vue.js +27 -22
- package/dist/features/ApiClientModal/useApiClient.d.ts +18 -12
- package/dist/features/ApiClientModal/useApiClient.d.ts.map +1 -1
- package/dist/helpers/parse.d.ts +1 -2
- package/dist/helpers/parse.d.ts.map +1 -1
- package/dist/helpers/parse.js +54 -59
- package/dist/hooks/useMultipleDocuments.d.ts.map +1 -1
- package/dist/hooks/useMultipleDocuments.js +29 -27
- package/dist/hooks/useReactiveSpec.d.ts.map +1 -1
- package/dist/hooks/useReactiveSpec.js +25 -27
- package/dist/index.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +9 -9
- package/dist/browser/examples/openapi-3.1/openapi.yaml +0 -18
- package/dist/browser/examples/openapi-3.1/pathItems.yaml +0 -12
- package/dist/browser/examples/swagger-2.0/openapi.yaml +0 -17
- package/dist/browser/examples/swagger-2.0/pathItems.yaml +0 -6
- package/dist/examples/openapi-3.1/openapi.yaml +0 -18
- package/dist/examples/openapi-3.1/pathItems.yaml +0 -12
- package/dist/examples/swagger-2.0/openapi.yaml +0 -17
- package/dist/examples/swagger-2.0/pathItems.yaml +0 -6
package/dist/helpers/parse.js
CHANGED
|
@@ -1,68 +1,63 @@
|
|
|
1
|
-
import { redirectToProxy as
|
|
2
|
-
import { load as M, dereference as
|
|
3
|
-
import { fetchUrls as
|
|
1
|
+
import { redirectToProxy as R, shouldIgnoreEntity as u } from "@scalar/oas-utils/helpers";
|
|
2
|
+
import { load as M, dereference as q } from "@scalar/openapi-parser";
|
|
3
|
+
import { fetchUrls as D } from "@scalar/openapi-parser/plugins/fetch-urls";
|
|
4
4
|
import { createEmptySpecification as O } from "./createEmptySpecification.js";
|
|
5
|
-
import { normalizeRequestMethod as
|
|
6
|
-
import { validRequestMethods as
|
|
5
|
+
import { normalizeRequestMethod as j } from "../legacy/helpers/normalizeRequestMethod.js";
|
|
6
|
+
import { validRequestMethods as C } from "../legacy/fixtures/httpRequestMethods.js";
|
|
7
7
|
const G = (m, {
|
|
8
|
-
proxyUrl: e
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var y;
|
|
8
|
+
proxyUrl: e
|
|
9
|
+
} = {}) => new Promise(async (n, b) => {
|
|
10
|
+
var h;
|
|
12
11
|
try {
|
|
13
12
|
if (!m)
|
|
14
|
-
return
|
|
15
|
-
const
|
|
16
|
-
source: h,
|
|
13
|
+
return n(I(O()));
|
|
14
|
+
const f = performance.now(), { filesystem: s } = await M(m, {
|
|
17
15
|
plugins: [
|
|
18
|
-
|
|
19
|
-
fetch:
|
|
20
|
-
const n = await fetch(e ? A(e, a) : a);
|
|
21
|
-
return n.ok ? console.info(`fetch($ref): ${a} (${Math.round((await n.clone().text()).length / 1024)} kB)`) : console.error(`fetch($ref): ${a} (${n.status} ${n.statusText})`), n;
|
|
22
|
-
}
|
|
16
|
+
D({
|
|
17
|
+
fetch: (o) => fetch(e ? R(e, o) : o)
|
|
23
18
|
})
|
|
24
19
|
]
|
|
25
|
-
}), { schema:
|
|
26
|
-
return console.
|
|
20
|
+
}), { schema: a, errors: r } = await q(s), t = performance.now();
|
|
21
|
+
return console.log(`dereference: ${Math.round(t - f)} ms`), r != null && r.length && console.warn(
|
|
27
22
|
`Please open an issue on https://github.com/scalar/scalar
|
|
28
23
|
`,
|
|
29
24
|
`Scalar OpenAPI Parser Warning:
|
|
30
25
|
`,
|
|
31
|
-
|
|
32
|
-
),
|
|
33
|
-
} catch (
|
|
34
|
-
console.error("[@scalar/api-reference]", "Failed to parse the OpenAPI document. It might be invalid?"), console.error(
|
|
26
|
+
r
|
|
27
|
+
), a === void 0 ? (b(((h = r == null ? void 0 : r[0]) == null ? void 0 : h.message) ?? "Failed to parse the OpenAPI file."), n(I(O()))) : n(I(a));
|
|
28
|
+
} catch (f) {
|
|
29
|
+
console.error("[@scalar/api-reference]", "Failed to parse the OpenAPI document. It might be invalid?"), console.error(f), b(f);
|
|
35
30
|
}
|
|
36
|
-
return
|
|
37
|
-
}),
|
|
38
|
-
var
|
|
31
|
+
return n(I(O()));
|
|
32
|
+
}), I = (m) => {
|
|
33
|
+
var h, f;
|
|
39
34
|
let e = {};
|
|
40
35
|
m && typeof m == "object" ? e = structuredClone(m) : e = O(), e.tags || (e.tags = []), e.paths || (e.paths = {}), e.components || (e.components = {}), e.webhooks || (e.webhooks = {}), e.servers || (e.servers = []), e.security || (e.security = []), e.externalDocs || (e.externalDocs = {});
|
|
41
|
-
const
|
|
36
|
+
const n = {};
|
|
42
37
|
return Object.keys(e.webhooks ?? {}).forEach((s) => {
|
|
43
|
-
var
|
|
44
|
-
Object.keys(((
|
|
45
|
-
var
|
|
46
|
-
const t = (
|
|
38
|
+
var a;
|
|
39
|
+
Object.keys(((a = e.webhooks) == null ? void 0 : a[s]) ?? {}).forEach((r) => {
|
|
40
|
+
var o, l, g, y;
|
|
41
|
+
const t = (o = e.webhooks) == null ? void 0 : o[s][r];
|
|
47
42
|
if (!(!t || u(t))) {
|
|
48
43
|
if (Array.isArray(t.tags)) {
|
|
49
|
-
const i = (
|
|
50
|
-
(
|
|
51
|
-
var
|
|
52
|
-
return (
|
|
44
|
+
const i = (l = t.tags) == null ? void 0 : l.map(
|
|
45
|
+
(c) => {
|
|
46
|
+
var w;
|
|
47
|
+
return (w = e.tags) == null ? void 0 : w.find((p) => p.name === c);
|
|
53
48
|
}
|
|
54
49
|
);
|
|
55
|
-
if (t.tags = i == null ? void 0 : i.filter((
|
|
50
|
+
if (t.tags = i == null ? void 0 : i.filter((c) => !u(c)), i != null && i.some((c) => u(c)))
|
|
56
51
|
return;
|
|
57
52
|
}
|
|
58
|
-
|
|
53
|
+
n[s] === void 0 && (n[s] = {}), n[s][r] = {
|
|
59
54
|
// Transformed data
|
|
60
|
-
httpVerb:
|
|
55
|
+
httpVerb: j(r),
|
|
61
56
|
path: s,
|
|
62
57
|
operationId: (t == null ? void 0 : t.operationId) || s,
|
|
63
58
|
name: (t == null ? void 0 : t.summary) || s || "",
|
|
64
59
|
description: (t == null ? void 0 : t.description) || "",
|
|
65
|
-
pathParameters: (
|
|
60
|
+
pathParameters: (y = (g = e.paths) == null ? void 0 : g[s]) == null ? void 0 : y.parameters,
|
|
66
61
|
// Original webhook
|
|
67
62
|
information: {
|
|
68
63
|
...t
|
|
@@ -70,19 +65,19 @@ const G = (m, {
|
|
|
70
65
|
};
|
|
71
66
|
}
|
|
72
67
|
});
|
|
73
|
-
}), Object.keys(((
|
|
74
|
-
var
|
|
75
|
-
u((
|
|
68
|
+
}), Object.keys(((h = e.components) == null ? void 0 : h.schemas) ?? {}).forEach((s) => {
|
|
69
|
+
var a, r, t, o;
|
|
70
|
+
u((r = (a = e.components) == null ? void 0 : a.schemas) == null ? void 0 : r[s]) && ((o = (t = e.components) == null ? void 0 : t.schemas) == null || delete o[s]);
|
|
76
71
|
}), Object.keys(e.paths).forEach((s) => {
|
|
77
72
|
Object.keys(e.paths[s]).filter(
|
|
78
|
-
(
|
|
79
|
-
).forEach((
|
|
80
|
-
var
|
|
81
|
-
const t = e.paths[s][
|
|
73
|
+
(r) => C.includes(r.toUpperCase())
|
|
74
|
+
).forEach((r) => {
|
|
75
|
+
var l, g, y, i, c, w;
|
|
76
|
+
const t = e.paths[s][r];
|
|
82
77
|
if (t === void 0 || u(t))
|
|
83
78
|
return;
|
|
84
|
-
const
|
|
85
|
-
httpVerb:
|
|
79
|
+
const o = {
|
|
80
|
+
httpVerb: j(r),
|
|
86
81
|
path: s,
|
|
87
82
|
operationId: t.operationId || s,
|
|
88
83
|
name: t.summary || s || "",
|
|
@@ -90,33 +85,33 @@ const G = (m, {
|
|
|
90
85
|
information: {
|
|
91
86
|
...t
|
|
92
87
|
},
|
|
93
|
-
pathParameters: (
|
|
88
|
+
pathParameters: (g = (l = e.paths) == null ? void 0 : l[s]) == null ? void 0 : g.parameters
|
|
94
89
|
};
|
|
95
90
|
if (!t.tags || t.tags.length === 0) {
|
|
96
|
-
(
|
|
91
|
+
(y = e.tags) != null && y.find((d) => d.name === "default") || (i = e.tags) == null || i.push({
|
|
97
92
|
name: "default",
|
|
98
93
|
description: "",
|
|
99
94
|
operations: []
|
|
100
95
|
});
|
|
101
|
-
const p = (
|
|
96
|
+
const p = (c = e.tags) == null ? void 0 : c.findIndex(
|
|
102
97
|
(d) => d.name === "default"
|
|
103
98
|
);
|
|
104
|
-
p >= 0 && ((
|
|
99
|
+
p >= 0 && ((w = e.tags[p]) == null || w.operations.push(o));
|
|
105
100
|
} else
|
|
106
101
|
t.tags.forEach((p) => {
|
|
107
|
-
var
|
|
108
|
-
const d = (
|
|
109
|
-
d === -1 && ((
|
|
102
|
+
var E, P, k;
|
|
103
|
+
const d = (E = e.tags) == null ? void 0 : E.findIndex((A) => A.name === p);
|
|
104
|
+
d === -1 && ((P = e.tags) == null || P.push({
|
|
110
105
|
name: p,
|
|
111
106
|
description: ""
|
|
112
107
|
}));
|
|
113
|
-
const
|
|
114
|
-
typeof ((
|
|
108
|
+
const x = d !== -1 ? d : e.tags.length - 1;
|
|
109
|
+
typeof ((k = e.tags[x]) == null ? void 0 : k.operations) > "u" && (e.tags[x].operations = []), e.tags[x].operations.push(o);
|
|
115
110
|
});
|
|
116
111
|
});
|
|
117
|
-
}), e.tags = (
|
|
112
|
+
}), e.tags = (f = e.tags) == null ? void 0 : f.filter((s) => !u(s)), {
|
|
118
113
|
...e,
|
|
119
|
-
webhooks:
|
|
114
|
+
webhooks: n
|
|
120
115
|
};
|
|
121
116
|
};
|
|
122
117
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMultipleDocuments.d.ts","sourceRoot":"","sources":["../../src/hooks/useMultipleDocuments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAEnD,OAAO,EACL,KAAK,4BAA4B,EACjC,KAAK,iBAAiB,EAEvB,MAAM,6BAA6B,CAAA;AAGpC,OAAO,EAAE,KAAK,GAAG,EAAwB,MAAM,KAAK,CAAA;AAKpD,KAAK,yBAAyB,GAAG;IAC/B;;;OAGG;IACH,aAAa,EAAE,GAAG,CAAC,4BAA4B,GAAG,SAAS,CAAC,CAAA;IAC5D,2FAA2F;IAC3F,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,GAAG,QAAQ,CAAA;AAIZ;;GAEG;AACH,eAAO,MAAM,uBAAuB,kBACnB,4BAA4B,GAAG,SAAS,KACtD,iBAAiB,EA6BnB,CAAA;AA0CD,eAAO,MAAM,oBAAoB,8EAM9B,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useMultipleDocuments.d.ts","sourceRoot":"","sources":["../../src/hooks/useMultipleDocuments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAEnD,OAAO,EACL,KAAK,4BAA4B,EACjC,KAAK,iBAAiB,EAEvB,MAAM,6BAA6B,CAAA;AAGpC,OAAO,EAAE,KAAK,GAAG,EAAwB,MAAM,KAAK,CAAA;AAKpD,KAAK,yBAAyB,GAAG;IAC/B;;;OAGG;IACH,aAAa,EAAE,GAAG,CAAC,4BAA4B,GAAG,SAAS,CAAC,CAAA;IAC5D,2FAA2F;IAC3F,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,GAAG,QAAQ,CAAA;AAIZ;;GAEG;AACH,eAAO,MAAM,uBAAuB,kBACnB,4BAA4B,GAAG,SAAS,KACtD,iBAAiB,EA6BnB,CAAA;AA0CD,eAAO,MAAM,oBAAoB,8EAM9B,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;0CAmIgooB,GAAI;oBAAuF,GAAG;;;;yBAAiH,CAAC;;;;;;;;;;;;;yCAAymB,GAAI;2CAA6E,GAAI;6BAAgE,GAAG;qBAAwE,GAAG;uCAAyF,GAAI;2CAA6F,GAAI;;;;;gBAA0K,CAAC;WAA4B,GAAI;;gBAAyF,CAAC;WAA4B,GAAI;;gBAAuF,CAAC;WAA4B,GAAI;;;;uBAAkJ,CAAC;mBAAqC,CAAC;WAA4B,GAAI;;;kBAAmH,CAAC;WAA4B,GAAI;qCAAyE,GAAI;;2DAAgK,GAAI;4EAAgH,GAAI;;;uDApLl9sB,GAAG;;;;;;;;;mDAAH,GAAG;;;;;;;;CAmLrD,CAAA"}
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import { isDefined as
|
|
1
|
+
import { isDefined as S } from "@scalar/oas-utils/helpers";
|
|
2
2
|
import { isConfigurationWithSources as y } from "@scalar/types/api-reference";
|
|
3
|
-
import
|
|
4
|
-
import { computed as
|
|
5
|
-
const w = "api",
|
|
3
|
+
import R from "github-slugger";
|
|
4
|
+
import { computed as g, ref as b, watch as A } from "vue";
|
|
5
|
+
const w = "api", h = new R(), C = (t) => t ? (Array.isArray(t) ? t : [t]).flatMap((u) => {
|
|
6
6
|
if (y(u)) {
|
|
7
|
-
const { sources:
|
|
8
|
-
return (
|
|
7
|
+
const { sources: s, ...r } = u;
|
|
8
|
+
return (s == null ? void 0 : s.map((m) => ({ ...r, ...m }))) ?? [];
|
|
9
9
|
}
|
|
10
10
|
return [u];
|
|
11
|
-
}).map((u,
|
|
11
|
+
}).map((u, s) => u && I(u, s)).filter(S) : [], I = (t, a = 0) => {
|
|
12
12
|
const e = {
|
|
13
13
|
...t,
|
|
14
14
|
// @ts-expect-error this is before parsing so we transform the old style
|
|
15
15
|
...t.spec ?? {}
|
|
16
16
|
};
|
|
17
17
|
if (!(!(e != null && e.url) && !(e != null && e.content)))
|
|
18
|
-
return
|
|
18
|
+
return h.reset(), e.title ? {
|
|
19
19
|
...e,
|
|
20
|
-
slug: e.slug ||
|
|
20
|
+
slug: e.slug || h.slug(e.title),
|
|
21
21
|
title: e.title
|
|
22
22
|
} : e.slug ? {
|
|
23
23
|
...e,
|
|
24
24
|
title: e.slug
|
|
25
25
|
} : {
|
|
26
26
|
...e,
|
|
27
|
-
slug: `api-${
|
|
28
|
-
title: `API #${
|
|
27
|
+
slug: `api-${a + 1}`,
|
|
28
|
+
title: `API #${a + 1}`
|
|
29
29
|
};
|
|
30
|
-
},
|
|
30
|
+
}, T = ({
|
|
31
31
|
configuration: t,
|
|
32
|
-
initialIndex:
|
|
32
|
+
initialIndex: a,
|
|
33
33
|
isIntersectionEnabled: e,
|
|
34
34
|
hash: u,
|
|
35
|
-
hashPrefix:
|
|
35
|
+
hashPrefix: s
|
|
36
36
|
}) => {
|
|
37
|
-
const r =
|
|
37
|
+
const r = g(() => C(t.value)), f = b((() => {
|
|
38
38
|
if (typeof window > "u")
|
|
39
|
-
return typeof
|
|
39
|
+
return typeof a == "number" ? a : 0;
|
|
40
40
|
const n = new URL(window.location.href).searchParams.get(w);
|
|
41
41
|
if (n) {
|
|
42
|
-
const o = r.value.findIndex((
|
|
42
|
+
const o = r.value.findIndex((p) => p.slug === n);
|
|
43
43
|
if (o !== -1)
|
|
44
44
|
return o;
|
|
45
45
|
const i = Number.parseInt(n, 10);
|
|
@@ -47,8 +47,8 @@ const w = "api", g = new S(), C = (t) => t ? (Array.isArray(t) ? t : [t]).flatMa
|
|
|
47
47
|
return i;
|
|
48
48
|
}
|
|
49
49
|
const l = r.value.findIndex((o) => "default" in o && o.default === !0);
|
|
50
|
-
return l !== -1 ? l : typeof
|
|
51
|
-
})()),
|
|
50
|
+
return l !== -1 ? l : typeof a == "number" ? a : 0;
|
|
51
|
+
})()), c = g(() => {
|
|
52
52
|
var n, l;
|
|
53
53
|
return t.value && y(t.value) ? {
|
|
54
54
|
...t.value,
|
|
@@ -59,26 +59,28 @@ const w = "api", g = new S(), C = (t) => t ? (Array.isArray(t) ? t : [t]).flatMa
|
|
|
59
59
|
...r.value[f.value]
|
|
60
60
|
};
|
|
61
61
|
});
|
|
62
|
-
return
|
|
62
|
+
return A(
|
|
63
63
|
f,
|
|
64
|
-
(
|
|
65
|
-
var i,
|
|
64
|
+
(d) => {
|
|
65
|
+
var i, p, v;
|
|
66
66
|
if (typeof window > "u" || r.value.length === 1)
|
|
67
67
|
return;
|
|
68
|
-
const n = new URL(window.location.href), l = r.value[
|
|
69
|
-
|
|
68
|
+
const n = new URL(window.location.href), l = r.value[d];
|
|
69
|
+
c.value.pathRouting && (n.pathname = ((i = c.value.pathRouting) == null ? void 0 : i.basePath) ?? "");
|
|
70
|
+
const o = (l == null ? void 0 : l.slug) ?? d.toString();
|
|
71
|
+
n.searchParams.set(w, o), n.hash = "", window.history.replaceState({}, "", n.toString()), u.value = "", s.value = "", e.value = !1, typeof window < "u" && window.scrollTo({ top: 0, behavior: "instant" }), (v = (p = c.value).onDocumentSelect) == null || v.call(p);
|
|
70
72
|
},
|
|
71
73
|
{ flush: "sync" }
|
|
72
74
|
), {
|
|
73
|
-
selectedConfiguration:
|
|
75
|
+
selectedConfiguration: c,
|
|
74
76
|
availableDocuments: r,
|
|
75
77
|
selectedDocumentIndex: f,
|
|
76
78
|
isIntersectionEnabled: e,
|
|
77
79
|
hash: u,
|
|
78
|
-
hashPrefix:
|
|
80
|
+
hashPrefix: s
|
|
79
81
|
};
|
|
80
82
|
};
|
|
81
83
|
export {
|
|
82
84
|
C as normalizeConfigurations,
|
|
83
|
-
|
|
85
|
+
T as useMultipleDocuments
|
|
84
86
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useReactiveSpec.d.ts","sourceRoot":"","sources":["../../src/hooks/useReactiveSpec.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,EAAE,KAAK,gBAAgB,EAAuB,MAAM,KAAK,CAAA;AAgDhE;;GAEG;AACH,wBAAgB,eAAe,CAAC,EAC9B,UAAU,EACV,QAAQ,GACT,EAAE;IACD,UAAU,CAAC,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,CAAA;IAChD,QAAQ,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;CACpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useReactiveSpec.d.ts","sourceRoot":"","sources":["../../src/hooks/useReactiveSpec.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,EAAE,KAAK,gBAAgB,EAAuB,MAAM,KAAK,CAAA;AAgDhE;;GAEG;AACH,wBAAgB,eAAe,CAAC,EAC9B,UAAU,EACV,QAAQ,GACT,EAAE;IACD,UAAU,CAAC,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,CAAA;IAChD,QAAQ,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;CACpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwDA"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { fetchDocument as l, prettyPrintJson as d } from "@scalar/oas-utils/helpers";
|
|
2
|
-
import { ref as
|
|
2
|
+
import { ref as s, watch as u, toValue as f } from "vue";
|
|
3
3
|
import { parse as h } from "../helpers/parse.js";
|
|
4
4
|
import { createEmptySpecification as m } from "../helpers/createEmptySpecification.js";
|
|
5
|
-
const v = async ({ url:
|
|
6
|
-
if (
|
|
5
|
+
const v = async ({ url: a, content: e }, r) => {
|
|
6
|
+
if (a) {
|
|
7
7
|
const i = performance.now();
|
|
8
8
|
try {
|
|
9
|
-
const
|
|
10
|
-
return console.log(`fetch: ${Math.round(o - i)} ms (${
|
|
11
|
-
} catch (
|
|
12
|
-
console.error("Failed to fetch OpenAPI document from URL:",
|
|
9
|
+
const n = await l(a, r), o = performance.now();
|
|
10
|
+
return console.log(`fetch: ${Math.round(o - i)} ms (${a})`), console.log("size:", Math.round(n.length / 1024), "kB"), n;
|
|
11
|
+
} catch (n) {
|
|
12
|
+
console.error("Failed to fetch OpenAPI document from URL:", n);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
const t = typeof e == "function" ? e() : e;
|
|
@@ -18,44 +18,42 @@ const v = async ({ url: r, content: e }, n) => {
|
|
|
18
18
|
if (typeof t == "object")
|
|
19
19
|
return d(t);
|
|
20
20
|
};
|
|
21
|
-
function
|
|
22
|
-
specConfig:
|
|
21
|
+
function C({
|
|
22
|
+
specConfig: a,
|
|
23
23
|
proxyUrl: e
|
|
24
24
|
}) {
|
|
25
|
-
const
|
|
26
|
-
function
|
|
27
|
-
var s;
|
|
25
|
+
const r = s(""), t = s(m()), i = s(null);
|
|
26
|
+
function n(o) {
|
|
28
27
|
if (!o) {
|
|
29
28
|
t.value = m();
|
|
30
29
|
return;
|
|
31
30
|
}
|
|
32
31
|
h(o, {
|
|
33
|
-
proxyUrl: e ?
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
i.value = a.toString();
|
|
32
|
+
proxyUrl: e ? f(e) : void 0
|
|
33
|
+
}).then((c) => {
|
|
34
|
+
i.value = null, t.value = c;
|
|
35
|
+
}).catch((c) => {
|
|
36
|
+
i.value = c.toString();
|
|
39
37
|
});
|
|
40
38
|
}
|
|
41
|
-
return
|
|
42
|
-
() =>
|
|
39
|
+
return u(
|
|
40
|
+
() => f(a),
|
|
43
41
|
async (o) => {
|
|
44
|
-
var
|
|
42
|
+
var c;
|
|
45
43
|
if (o) {
|
|
46
|
-
const
|
|
47
|
-
typeof
|
|
44
|
+
const p = (c = await v(o, f(e))) == null ? void 0 : c.trim();
|
|
45
|
+
typeof p == "string" && (r.value = p);
|
|
48
46
|
}
|
|
49
47
|
},
|
|
50
48
|
{ immediate: !0, deep: !0 }
|
|
51
|
-
),
|
|
52
|
-
|
|
49
|
+
), u(r, () => {
|
|
50
|
+
n(r.value);
|
|
53
51
|
}), {
|
|
54
|
-
rawSpec:
|
|
52
|
+
rawSpec: r,
|
|
55
53
|
parsedSpec: t,
|
|
56
54
|
specErrors: i
|
|
57
55
|
};
|
|
58
56
|
}
|
|
59
57
|
export {
|
|
60
|
-
|
|
58
|
+
C as useReactiveSpec
|
|
61
59
|
};
|