@scalar/api-reference 1.25.102 → 1.25.104
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 +41 -0
- package/dist/blocks/constants.d.ts +9 -0
- package/dist/blocks/constants.d.ts.map +1 -0
- package/dist/blocks/constants.js +8 -0
- package/dist/blocks/helpers/getPointer.d.ts +22 -0
- package/dist/blocks/helpers/getPointer.d.ts.map +1 -0
- package/dist/blocks/helpers/getPointer.js +12 -0
- package/dist/blocks/hooks/useBlockProps.d.ts +32 -0
- package/dist/blocks/hooks/useBlockProps.d.ts.map +1 -0
- package/dist/blocks/hooks/useBlockProps.js +28 -0
- package/dist/browser/standalone.js +12846 -12739
- package/dist/browser/webpack-stats.json +1 -1
- package/dist/components/ApiReference.vue.js +31 -31
- package/dist/components/ApiReferenceLayout.vue.d.ts.map +1 -1
- package/dist/components/ApiReferenceLayout.vue.js +2 -2
- package/dist/components/ApiReferenceLayout.vue2.js +2 -1
- package/dist/components/Content/Introduction/Introduction.vue.d.ts.map +1 -1
- package/dist/components/Content/Introduction/Introduction.vue.js +1 -1
- package/dist/components/Content/Introduction/Introduction.vue2.js +84 -70
- package/dist/components/Content/Schema/SchemaProperty.vue.d.ts +2 -0
- package/dist/components/Content/Schema/SchemaProperty.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaProperty.vue.js +2 -2
- package/dist/components/Content/Schema/SchemaProperty.vue2.js +118 -111
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue.js +3 -3
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue2.js +91 -77
- package/dist/components/Content/Schema/helpers/formatExample.d.ts +5 -0
- package/dist/components/Content/Schema/helpers/formatExample.d.ts.map +1 -0
- package/dist/components/Content/Schema/helpers/formatExample.js +6 -0
- package/dist/components/Content/Schema/helpers/optimizeValueForDisplay.d.ts +9 -0
- package/dist/components/Content/Schema/helpers/optimizeValueForDisplay.d.ts.map +1 -0
- package/dist/components/Content/Schema/helpers/optimizeValueForDisplay.js +20 -0
- package/dist/components/HttpMethod/HttpMethod.vue.d.ts +2 -1
- package/dist/components/HttpMethod/HttpMethod.vue.d.ts.map +1 -1
- package/dist/components/Layouts/ClassicLayout.vue.d.ts.map +1 -1
- package/dist/components/Layouts/ClassicLayout.vue.js +30 -27
- package/dist/components/Layouts/ModernLayout.vue.d.ts.map +1 -1
- package/dist/components/Layouts/ModernLayout.vue.js +2 -2
- package/dist/components/Layouts/ModernLayout.vue2.js +55 -50
- package/dist/features/ApiClientModal/useApiClient.d.ts +336 -254
- package/dist/features/ApiClientModal/useApiClient.d.ts.map +1 -1
- package/dist/features/DownloadLink/DownloadLink.vue.d.ts.map +1 -1
- package/dist/features/DownloadLink/DownloadLink.vue.js +2 -2
- package/dist/features/DownloadLink/DownloadLink.vue2.js +10 -3
- package/dist/features/Operation/Operation.vue.d.ts.map +1 -1
- package/dist/features/Operation/Operation.vue.js +37 -26
- package/dist/features/Operation/components/OperationResponses.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/OperationResponses.vue.js +8 -7
- package/dist/features/Operation/components/ParameterList.vue.d.ts +2 -0
- package/dist/features/Operation/components/ParameterList.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/ParameterList.vue.js +2 -2
- package/dist/features/Operation/components/ParameterList.vue2.js +18 -16
- package/dist/features/Operation/components/ParameterListItem.vue.d.ts +2 -0
- package/dist/features/Operation/components/ParameterListItem.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/ParameterListItem.vue.js +1 -1
- package/dist/features/Operation/components/ParameterListItem.vue2.js +27 -25
- package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts +3 -0
- package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
- package/dist/features/Operation/layouts/ClassicLayout.vue.js +1 -1
- package/dist/features/Operation/layouts/ClassicLayout.vue2.js +108 -101
- package/dist/features/Operation/layouts/ModernLayout.vue.d.ts +3 -0
- package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue.js +2 -2
- package/dist/features/Operation/layouts/ModernLayout.vue2.js +54 -50
- package/dist/helpers/get-request.d.ts +2 -0
- package/dist/helpers/get-request.d.ts.map +1 -1
- package/dist/helpers/parse.d.ts.map +1 -1
- package/dist/helpers/parse.js +88 -68
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +79 -83
- package/dist/style.css +1 -1
- package/package.json +11 -12
- package/dist/components/DarkModeToggle/DarkModeIconToggle.vue.d.ts +0 -10
- package/dist/components/DarkModeToggle/DarkModeIconToggle.vue.d.ts.map +0 -1
- package/dist/components/DarkModeToggle/DarkModeIconToggle.vue.js +0 -7
- package/dist/components/DarkModeToggle/DarkModeIconToggle.vue2.js +0 -30
- package/dist/components/DarkModeToggle/DarkModeToggle.vue.d.ts +0 -11
- package/dist/components/DarkModeToggle/DarkModeToggle.vue.d.ts.map +0 -1
- package/dist/components/DarkModeToggle/DarkModeToggle.vue.js +0 -7
- package/dist/components/DarkModeToggle/DarkModeToggle.vue2.js +0 -31
- package/dist/components/DarkModeToggle/index.d.ts +0 -3
- package/dist/components/DarkModeToggle/index.d.ts.map +0 -1
- package/dist/embeds/ExampleRequest/ExampleRequest.vue.d.ts +0 -10
- package/dist/embeds/ExampleRequest/ExampleRequest.vue.d.ts.map +0 -1
- package/dist/embeds/ExampleRequest/index.d.ts +0 -2
- package/dist/embeds/ExampleRequest/index.d.ts.map +0 -1
- package/dist/embeds/ExampleResponses/ExampleResponses.vue.d.ts +0 -7
- package/dist/embeds/ExampleResponses/ExampleResponses.vue.d.ts.map +0 -1
- package/dist/embeds/ExampleResponses/index.d.ts +0 -2
- package/dist/embeds/ExampleResponses/index.d.ts.map +0 -1
- package/dist/embeds/OpenApiDocument/OpenApiDocument.vue.d.ts +0 -782
- package/dist/embeds/OpenApiDocument/OpenApiDocument.vue.d.ts.map +0 -1
- package/dist/embeds/OpenApiDocument/index.d.ts +0 -3
- package/dist/embeds/OpenApiDocument/index.d.ts.map +0 -1
- package/dist/embeds/OpenApiDocument/types.d.ts +0 -3
- package/dist/embeds/OpenApiDocument/types.d.ts.map +0 -1
- package/dist/embeds/index.d.ts +0 -4
- package/dist/embeds/index.d.ts.map +0 -1
package/dist/helpers/parse.js
CHANGED
|
@@ -1,76 +1,94 @@
|
|
|
1
|
-
import { redirectToProxy as R } from "@scalar/oas-utils/helpers";
|
|
2
|
-
import { load as
|
|
3
|
-
import { fetchUrls as
|
|
4
|
-
import { createEmptySpecification as
|
|
5
|
-
import { normalizeRequestMethod as
|
|
6
|
-
import { validRequestMethods as
|
|
7
|
-
const
|
|
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 C } from "@scalar/openapi-parser/plugins/fetch-urls";
|
|
4
|
+
import { createEmptySpecification as O } from "./createEmptySpecification.js";
|
|
5
|
+
import { normalizeRequestMethod as k } from "../legacy/helpers/normalizeRequestMethod.js";
|
|
6
|
+
import { validRequestMethods as F } from "../legacy/fixtures/httpRequestMethods.js";
|
|
7
|
+
const H = (m, {
|
|
8
8
|
proxyUrl: e
|
|
9
|
-
} = {}) => new Promise(async (
|
|
10
|
-
var
|
|
9
|
+
} = {}) => new Promise(async (o, E) => {
|
|
10
|
+
var h;
|
|
11
11
|
try {
|
|
12
|
-
if (!
|
|
13
|
-
return
|
|
14
|
-
|
|
12
|
+
if (!m)
|
|
13
|
+
return o(
|
|
14
|
+
I(O())
|
|
15
15
|
);
|
|
16
|
-
const
|
|
16
|
+
const s = performance.now(), { filesystem: i } = await M(m, {
|
|
17
17
|
plugins: [
|
|
18
|
-
|
|
19
|
-
fetch: (
|
|
18
|
+
C({
|
|
19
|
+
fetch: (c) => fetch(e ? R(e, c) : c)
|
|
20
20
|
})
|
|
21
21
|
]
|
|
22
|
-
}), { schema:
|
|
23
|
-
return console.log(`dereference: ${Math.round(
|
|
22
|
+
}), { schema: r, errors: t } = await q(i), n = performance.now();
|
|
23
|
+
return console.log(`dereference: ${Math.round(n - s)} ms`), t != null && t.length && console.warn(
|
|
24
24
|
`Please open an issue on https://github.com/scalar/scalar
|
|
25
25
|
`,
|
|
26
26
|
`Scalar OpenAPI Parser Warning:
|
|
27
27
|
`,
|
|
28
|
-
|
|
29
|
-
),
|
|
30
|
-
|
|
31
|
-
)) :
|
|
32
|
-
} catch (
|
|
28
|
+
t
|
|
29
|
+
), r === void 0 ? (E(((h = t == null ? void 0 : t[0]) == null ? void 0 : h.message) ?? "Failed to parse the OpenAPI file."), o(
|
|
30
|
+
I(O())
|
|
31
|
+
)) : o(I(r));
|
|
32
|
+
} catch (s) {
|
|
33
33
|
console.error(
|
|
34
34
|
"[@scalar/api-reference]",
|
|
35
35
|
"Failed to parse the OpenAPI document. It might be invalid?"
|
|
36
|
-
), console.error(
|
|
36
|
+
), console.error(s), E(s);
|
|
37
37
|
}
|
|
38
|
-
return
|
|
39
|
-
|
|
38
|
+
return o(
|
|
39
|
+
I(O())
|
|
40
40
|
);
|
|
41
|
-
}),
|
|
41
|
+
}), I = (m) => {
|
|
42
|
+
var h;
|
|
42
43
|
let e = {};
|
|
43
|
-
|
|
44
|
-
const
|
|
44
|
+
m && typeof m == "object" ? e = structuredClone(m) : e = O(), e.tags || (e.tags = []), e.paths || (e.paths = {});
|
|
45
|
+
const o = {};
|
|
45
46
|
return Object.keys(e.webhooks ?? {}).forEach((s) => {
|
|
46
|
-
var
|
|
47
|
-
Object.keys(((
|
|
48
|
-
var
|
|
49
|
-
const t = (
|
|
50
|
-
(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
47
|
+
var i;
|
|
48
|
+
Object.keys(((i = e.webhooks) == null ? void 0 : i[s]) ?? {}).forEach((r) => {
|
|
49
|
+
var n, c, l, g;
|
|
50
|
+
const t = (n = e.webhooks) == null ? void 0 : n[s][r];
|
|
51
|
+
if (!(!t || u(t))) {
|
|
52
|
+
if (Array.isArray(t.tags)) {
|
|
53
|
+
const a = (c = t.tags) == null ? void 0 : c.map((f) => {
|
|
54
|
+
var y;
|
|
55
|
+
return (y = e.tags) == null ? void 0 : y.find((w) => w.name === f);
|
|
56
|
+
});
|
|
57
|
+
if (t.tags = a == null ? void 0 : a.filter(
|
|
58
|
+
(f) => !u(f)
|
|
59
|
+
), a != null && a.some(
|
|
60
|
+
(f) => u(f)
|
|
61
|
+
))
|
|
62
|
+
return;
|
|
61
63
|
}
|
|
62
|
-
|
|
64
|
+
o[s] === void 0 && (o[s] = {}), o[s][r] = {
|
|
65
|
+
// Transformed data
|
|
66
|
+
httpVerb: k(r),
|
|
67
|
+
path: s,
|
|
68
|
+
operationId: (t == null ? void 0 : t.operationId) || s,
|
|
69
|
+
name: (t == null ? void 0 : t.summary) || s || "",
|
|
70
|
+
description: (t == null ? void 0 : t.description) || "",
|
|
71
|
+
pathParameters: (g = (l = e.paths) == null ? void 0 : l[s]) == null ? void 0 : g.parameters,
|
|
72
|
+
// Original webhook
|
|
73
|
+
information: {
|
|
74
|
+
...t
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}
|
|
63
78
|
});
|
|
79
|
+
}), Object.keys(((h = e.components) == null ? void 0 : h.schemas) ?? {}).forEach((s) => {
|
|
80
|
+
var i, r, t, n;
|
|
81
|
+
u((r = (i = e.components) == null ? void 0 : i.schemas) == null ? void 0 : r[s]) && ((n = (t = e.components) == null ? void 0 : t.schemas) == null || delete n[s]);
|
|
64
82
|
}), Object.keys(e.paths).forEach((s) => {
|
|
65
83
|
Object.keys(e.paths[s]).filter(
|
|
66
|
-
(
|
|
67
|
-
).forEach((
|
|
68
|
-
var c,
|
|
69
|
-
const t = e.paths[s][
|
|
70
|
-
if (t === void 0 || t
|
|
84
|
+
(r) => F.includes(r.toUpperCase())
|
|
85
|
+
).forEach((r) => {
|
|
86
|
+
var c, l, g, a, f, y, w;
|
|
87
|
+
const t = e.paths[s][r];
|
|
88
|
+
if (t === void 0 || u(t))
|
|
71
89
|
return;
|
|
72
|
-
const
|
|
73
|
-
httpVerb:
|
|
90
|
+
const n = {
|
|
91
|
+
httpVerb: k(r),
|
|
74
92
|
path: s,
|
|
75
93
|
operationId: t.operationId || s,
|
|
76
94
|
name: t.summary || s || "",
|
|
@@ -78,40 +96,42 @@ const D = (p, {
|
|
|
78
96
|
information: {
|
|
79
97
|
...t
|
|
80
98
|
},
|
|
81
|
-
pathParameters: (
|
|
99
|
+
pathParameters: (l = (c = e.paths) == null ? void 0 : c[s]) == null ? void 0 : l.parameters
|
|
82
100
|
};
|
|
83
101
|
if (!t.tags || t.tags.length === 0) {
|
|
84
102
|
(g = e.tags) != null && g.find(
|
|
85
|
-
(
|
|
86
|
-
) || (
|
|
103
|
+
(d) => d.name === "default"
|
|
104
|
+
) || (a = e.tags) == null || a.push({
|
|
87
105
|
name: "default",
|
|
88
106
|
description: "",
|
|
89
107
|
operations: []
|
|
90
108
|
});
|
|
91
|
-
const
|
|
92
|
-
(
|
|
109
|
+
const p = (f = e.tags) == null ? void 0 : f.findIndex(
|
|
110
|
+
(d) => d.name === "default"
|
|
93
111
|
);
|
|
94
|
-
|
|
112
|
+
p >= 0 && ((y = e.tags[p]) == null || y.operations.push(n));
|
|
95
113
|
} else
|
|
96
|
-
t.tags.forEach((
|
|
97
|
-
var
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
(b) => b.name === d
|
|
114
|
+
t.tags.forEach((p) => {
|
|
115
|
+
var b, x, j;
|
|
116
|
+
const d = (b = e.tags) == null ? void 0 : b.findIndex(
|
|
117
|
+
(A) => A.name === p
|
|
101
118
|
);
|
|
102
|
-
|
|
103
|
-
name:
|
|
119
|
+
d === -1 && ((x = e.tags) == null || x.push({
|
|
120
|
+
name: p,
|
|
104
121
|
description: ""
|
|
105
122
|
}));
|
|
106
|
-
const
|
|
107
|
-
typeof ((
|
|
123
|
+
const P = d !== -1 ? d : e.tags.length - 1;
|
|
124
|
+
typeof ((j = e.tags[P]) == null ? void 0 : j.operations) > "u" && (e.tags[P].operations = []), e.tags[P].operations.push(n);
|
|
108
125
|
});
|
|
126
|
+
e.tags = (w = e.tags) == null ? void 0 : w.filter(
|
|
127
|
+
(p) => !u(p)
|
|
128
|
+
);
|
|
109
129
|
});
|
|
110
130
|
}), {
|
|
111
131
|
...e,
|
|
112
|
-
webhooks:
|
|
132
|
+
webhooks: o
|
|
113
133
|
};
|
|
114
134
|
};
|
|
115
135
|
export {
|
|
116
|
-
|
|
136
|
+
H as parse
|
|
117
137
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ export * from './features/Search';
|
|
|
5
5
|
export { default as GettingStarted } from './components/GettingStarted.vue.js';
|
|
6
6
|
export { createScalarReferences } from './esm.js';
|
|
7
7
|
export { useReactiveSpec } from './hooks/useReactiveSpec.js';
|
|
8
|
-
export * from './components/DarkModeToggle';
|
|
9
8
|
export * from './components/Sidebar';
|
|
10
9
|
export * from './components/Card';
|
|
11
10
|
export * from './components/Layouts';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AACnF,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,uCAAuC,CAAA;AAC/E,cAAc,mBAAmB,CAAA;AACjC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAEzD,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AACnF,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,uCAAuC,CAAA;AAC/E,cAAc,mBAAmB,CAAA;AACjC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAEzD,cAAc,sBAAsB,CAAA;AACpC,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AAEpC,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
|