@scalar/api-reference 1.28.8 → 1.28.10
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 +33 -0
- package/dist/browser/standalone.js +6124 -6035
- package/dist/browser/webpack-stats.json +1 -1
- package/dist/components/ApiReferenceLayout.vue.js +2 -2
- package/dist/components/ApiReferenceLayout.vue2.js +1 -1
- package/dist/components/Content/Models/Models.vue.d.ts.map +1 -1
- package/dist/components/Content/Models/Models.vue.js +2 -2
- package/dist/components/Content/Schema/Schema.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/Schema.vue.js +4 -4
- package/dist/components/Content/Schema/SchemaProperty.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaProperty.vue.js +1 -1
- package/dist/components/Content/Schema/SchemaProperty.vue2.js +96 -114
- package/dist/components/Content/Schema/SchemaPropertyExamples.vue.d.ts +8 -0
- package/dist/components/Content/Schema/SchemaPropertyExamples.vue.d.ts.map +1 -0
- package/dist/components/Content/Schema/SchemaPropertyExamples.vue.js +7 -0
- package/dist/components/Content/Schema/SchemaPropertyExamples.vue2.js +71 -0
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue.d.ts +2 -0
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue.js +1 -1
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue2.js +139 -130
- package/dist/components/GettingStarted.vue.js +1 -1
- package/dist/components/GettingStarted.vue2.js +25 -25
- package/dist/components/Sidebar/SidebarElement.vue.js +1 -1
- package/dist/components/Sidebar/SidebarElement.vue2.js +1 -1
- package/dist/components/SingleApiReference.vue.d.ts +1 -1
- package/dist/components/SingleApiReference.vue.d.ts.map +1 -1
- package/dist/features/ApiClientModal/useApiClient.d.ts +1374 -1004
- package/dist/features/ApiClientModal/useApiClient.d.ts.map +1 -1
- package/dist/features/ExampleResponses/ExampleResponses.vue.d.ts.map +1 -1
- package/dist/features/ExampleResponses/ExampleResponses.vue.js +2 -2
- package/dist/features/ExampleResponses/ExampleResponses.vue2.js +86 -85
- package/dist/helpers/get-request.d.ts +4 -4
- package/dist/helpers/get-request.d.ts.map +1 -1
- package/dist/hooks/useMultipleDocuments.d.ts +24 -22
- package/dist/hooks/useMultipleDocuments.d.ts.map +1 -1
- package/dist/hooks/useMultipleDocuments.js +53 -51
- package/dist/hooks/useReactiveSpec.d.ts +220 -3
- package/dist/hooks/useReactiveSpec.d.ts.map +1 -1
- package/dist/hooks/useReactiveSpec.js +30 -28
- package/dist/index.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +9 -9
|
@@ -1,81 +1,83 @@
|
|
|
1
|
-
import { isDefined as
|
|
2
|
-
import { isConfigurationWithSources as
|
|
3
|
-
import
|
|
4
|
-
import { computed as
|
|
5
|
-
const
|
|
1
|
+
import { isDefined as S } from "@scalar/oas-utils/helpers";
|
|
2
|
+
import { isConfigurationWithSources as m } from "@scalar/types/api-reference";
|
|
3
|
+
import h from "github-slugger";
|
|
4
|
+
import { computed as p, ref as y, watch as b } from "vue";
|
|
5
|
+
const w = "api", g = new h(), I = (l, a = 0) => {
|
|
6
|
+
const e = {
|
|
7
|
+
...l,
|
|
8
|
+
// @ts-expect-error this is before parsing so we transform the old style
|
|
9
|
+
...l.spec ?? {}
|
|
10
|
+
};
|
|
6
11
|
if (!(!(e != null && e.url) && !(e != null && e.content)))
|
|
7
|
-
return
|
|
12
|
+
return g.reset(), e.title ? {
|
|
8
13
|
...e,
|
|
9
|
-
slug: e.slug ||
|
|
14
|
+
slug: e.slug || g.slug(e.title),
|
|
10
15
|
title: e.title
|
|
11
16
|
} : e.slug ? {
|
|
12
17
|
...e,
|
|
13
18
|
title: e.slug
|
|
14
19
|
} : {
|
|
15
20
|
...e,
|
|
16
|
-
slug: `api-${
|
|
17
|
-
title: `API #${
|
|
21
|
+
slug: `api-${a + 1}`,
|
|
22
|
+
title: `API #${a + 1}`
|
|
18
23
|
};
|
|
19
|
-
},
|
|
20
|
-
configuration:
|
|
21
|
-
initialIndex:
|
|
22
|
-
isIntersectionEnabled:
|
|
23
|
-
hash:
|
|
24
|
-
hashPrefix:
|
|
24
|
+
}, P = ({
|
|
25
|
+
configuration: l,
|
|
26
|
+
initialIndex: a,
|
|
27
|
+
isIntersectionEnabled: e,
|
|
28
|
+
hash: c,
|
|
29
|
+
hashPrefix: d
|
|
25
30
|
}) => {
|
|
26
|
-
const r =
|
|
31
|
+
const r = p(() => l.value ? (m(l.value) ? (
|
|
27
32
|
// This IFFE is needed for the type guard as it doens't persist into the callback scope
|
|
28
33
|
(() => {
|
|
29
|
-
const { sources: t, ...
|
|
30
|
-
return (t == null ? void 0 : t.map((n) => ({ ...
|
|
34
|
+
const { sources: t, ...u } = l.value;
|
|
35
|
+
return (t == null ? void 0 : t.map((n) => ({ ...u, ...n }))) ?? [];
|
|
31
36
|
})()
|
|
32
|
-
) : [
|
|
37
|
+
) : [l.value].flat()).map((t, u) => t && I(t, u)).filter(S) : []), o = y((() => {
|
|
33
38
|
if (typeof window > "u")
|
|
34
|
-
return typeof
|
|
35
|
-
const t = new URL(window.location.href).searchParams.get(
|
|
39
|
+
return typeof a == "number" ? a : 0;
|
|
40
|
+
const t = new URL(window.location.href).searchParams.get(w);
|
|
36
41
|
if (t) {
|
|
37
|
-
const n = r.value.findIndex((
|
|
42
|
+
const n = r.value.findIndex((f) => f.slug === t);
|
|
38
43
|
if (n !== -1)
|
|
39
44
|
return n;
|
|
40
|
-
const
|
|
41
|
-
if (!isNaN(
|
|
42
|
-
return
|
|
45
|
+
const s = Number.parseInt(t, 10);
|
|
46
|
+
if (!isNaN(s) && s >= 0 && s < r.value.length)
|
|
47
|
+
return s;
|
|
43
48
|
}
|
|
44
|
-
const
|
|
45
|
-
return
|
|
46
|
-
})()),
|
|
47
|
-
var t,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
...f,
|
|
57
|
-
...r.value[i.value]
|
|
58
|
-
});
|
|
49
|
+
const u = r.value.findIndex((n) => "default" in n && n.default === !0);
|
|
50
|
+
return u !== -1 ? u : typeof a == "number" ? a : 0;
|
|
51
|
+
})()), v = p(() => {
|
|
52
|
+
var t, u;
|
|
53
|
+
return l.value && m(l.value) ? {
|
|
54
|
+
...l.value,
|
|
55
|
+
...(u = (t = l.value) == null ? void 0 : t.sources) == null ? void 0 : u[o.value],
|
|
56
|
+
...r.value[o.value]
|
|
57
|
+
} : {
|
|
58
|
+
...[l.value].flat()[o.value] ?? {},
|
|
59
|
+
...r.value[o.value]
|
|
60
|
+
};
|
|
59
61
|
});
|
|
60
62
|
return b(
|
|
61
|
-
|
|
62
|
-
(
|
|
63
|
-
var
|
|
63
|
+
o,
|
|
64
|
+
(i) => {
|
|
65
|
+
var s, f;
|
|
64
66
|
if (typeof window > "u" || r.value.length === 1)
|
|
65
67
|
return;
|
|
66
|
-
const t = new URL(window.location.href),
|
|
67
|
-
t.searchParams.set(
|
|
68
|
+
const t = new URL(window.location.href), u = r.value[i], n = (u == null ? void 0 : u.slug) ?? i.toString();
|
|
69
|
+
t.searchParams.set(w, n), t.hash = "", window.history.replaceState({}, "", t.toString()), c.value = "", d.value = "", e.value = !1, typeof window < "u" && window.scrollTo({ top: 0, behavior: "instant" }), (f = (s = v.value).onDocumentSelect) == null || f.call(s);
|
|
68
70
|
},
|
|
69
71
|
{ flush: "sync" }
|
|
70
72
|
), {
|
|
71
|
-
selectedConfiguration:
|
|
73
|
+
selectedConfiguration: v,
|
|
72
74
|
availableDocuments: r,
|
|
73
|
-
selectedDocumentIndex:
|
|
74
|
-
isIntersectionEnabled:
|
|
75
|
-
hash:
|
|
76
|
-
hashPrefix:
|
|
75
|
+
selectedDocumentIndex: o,
|
|
76
|
+
isIntersectionEnabled: e,
|
|
77
|
+
hash: c,
|
|
78
|
+
hashPrefix: d
|
|
77
79
|
};
|
|
78
80
|
};
|
|
79
81
|
export {
|
|
80
|
-
|
|
82
|
+
P as useMultipleDocuments
|
|
81
83
|
};
|
|
@@ -8,7 +8,7 @@ export declare function useReactiveSpec({ specConfig, proxyUrl, }: {
|
|
|
8
8
|
proxyUrl?: MaybeRefOrGetter<string>;
|
|
9
9
|
}): {
|
|
10
10
|
rawSpec: import("vue").Ref<string, string>;
|
|
11
|
-
parsedSpec: {
|
|
11
|
+
parsedSpec: import("vue").Ref<{
|
|
12
12
|
tags?: {
|
|
13
13
|
name: string;
|
|
14
14
|
description: string;
|
|
@@ -166,15 +166,232 @@ export declare function useReactiveSpec({ specConfig, proxyUrl, }: {
|
|
|
166
166
|
description?: string | undefined;
|
|
167
167
|
} | undefined;
|
|
168
168
|
servers?: {
|
|
169
|
+
url?: string | undefined;
|
|
170
|
+
description?: string | undefined;
|
|
171
|
+
variables?: Record<string, import("@scalar/openapi-types").OpenAPIV3_1.ServerVariableObject> | undefined;
|
|
172
|
+
}[] | {
|
|
169
173
|
url?: string | undefined;
|
|
170
174
|
description?: string | undefined;
|
|
171
175
|
variables?: {
|
|
172
176
|
[variable: string]: import("@scalar/openapi-types").OpenAPIV3.ServerVariableObject;
|
|
173
177
|
} | undefined;
|
|
174
|
-
}[] |
|
|
178
|
+
}[] | undefined;
|
|
179
|
+
components?: {
|
|
180
|
+
schemas?: {
|
|
181
|
+
[key: string]: import("@scalar/openapi-types").OpenAPIV3.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3.SchemaObject;
|
|
182
|
+
} | undefined;
|
|
183
|
+
responses?: {
|
|
184
|
+
[key: string]: import("@scalar/openapi-types").OpenAPIV3.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3.ResponseObject;
|
|
185
|
+
} | undefined;
|
|
186
|
+
parameters?: {
|
|
187
|
+
[key: string]: import("@scalar/openapi-types").OpenAPIV3.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3.ParameterObject;
|
|
188
|
+
} | undefined;
|
|
189
|
+
examples?: {
|
|
190
|
+
[key: string]: import("@scalar/openapi-types").OpenAPIV3.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3.ExampleObject;
|
|
191
|
+
} | undefined;
|
|
192
|
+
requestBodies?: {
|
|
193
|
+
[key: string]: import("@scalar/openapi-types").OpenAPIV3.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3.RequestBodyObject;
|
|
194
|
+
} | undefined;
|
|
195
|
+
headers?: {
|
|
196
|
+
[key: string]: import("@scalar/openapi-types").OpenAPIV3.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3.HeaderObject;
|
|
197
|
+
} | undefined;
|
|
198
|
+
securitySchemes?: {
|
|
199
|
+
[key: string]: import("@scalar/openapi-types").OpenAPIV3.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3.SecuritySchemeObject;
|
|
200
|
+
} | undefined;
|
|
201
|
+
links?: {
|
|
202
|
+
[key: string]: import("@scalar/openapi-types").OpenAPIV3.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3.LinkObject;
|
|
203
|
+
} | undefined;
|
|
204
|
+
callbacks?: {
|
|
205
|
+
[key: string]: import("@scalar/openapi-types").OpenAPIV3.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3.CallbackObject;
|
|
206
|
+
} | undefined;
|
|
207
|
+
} | {
|
|
208
|
+
schemas?: Record<string, import("@scalar/openapi-types").OpenAPIV3_1.SchemaObject> | undefined;
|
|
209
|
+
responses?: Record<string, import("@scalar/openapi-types").OpenAPIV3_1.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3_1.ResponseObject> | undefined;
|
|
210
|
+
parameters?: Record<string, import("@scalar/openapi-types").OpenAPIV3_1.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3_1.ParameterObject> | undefined;
|
|
211
|
+
examples?: Record<string, import("@scalar/openapi-types").OpenAPIV3_1.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3_1.ExampleObject> | undefined;
|
|
212
|
+
requestBodies?: Record<string, import("@scalar/openapi-types").OpenAPIV3_1.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3_1.RequestBodyObject> | undefined;
|
|
213
|
+
headers?: Record<string, import("@scalar/openapi-types").OpenAPIV3_1.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3_1.HeaderObject> | undefined;
|
|
214
|
+
securitySchemes?: Record<string, import("@scalar/openapi-types").OpenAPIV3_1.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3_1.SecuritySchemeObject> | undefined;
|
|
215
|
+
links?: Record<string, import("@scalar/openapi-types").OpenAPIV3_1.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3_1.LinkObject> | undefined;
|
|
216
|
+
callbacks?: Record<string, import("@scalar/openapi-types").OpenAPIV3_1.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3_1.CallbackObject> | undefined;
|
|
217
|
+
pathItems?: Record<string, import("@scalar/openapi-types").OpenAPIV3_1.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3_1.PathItemObject> | undefined;
|
|
218
|
+
} | undefined;
|
|
219
|
+
webhooks?: import("@scalar/types").Webhooks | undefined;
|
|
220
|
+
definitions?: import("@scalar/types").Definitions | undefined;
|
|
221
|
+
swagger?: import("@scalar/openapi-types").OpenAPIV2.Document["swagger"];
|
|
222
|
+
openapi?: import("@scalar/openapi-types").OpenAPIV3.Document["openapi"] | import("@scalar/openapi-types").OpenAPIV3_1.Document["openapi"];
|
|
223
|
+
'x-tagGroups'?: {
|
|
224
|
+
name: string;
|
|
225
|
+
tags: string[];
|
|
226
|
+
}[] | undefined;
|
|
227
|
+
security?: import("@scalar/openapi-types").OpenAPIV3.SecurityRequirementObject[] | undefined;
|
|
228
|
+
}, import("@scalar/types").Spec | {
|
|
229
|
+
tags?: {
|
|
230
|
+
name: string;
|
|
231
|
+
description: string;
|
|
232
|
+
operations: {
|
|
233
|
+
httpVerb: "GET" | "HEAD" | "PATCH" | "POST" | "PUT" | "TRACE" | "CONNECT" | "DELETE" | "OPTIONS";
|
|
234
|
+
path: string;
|
|
235
|
+
operationId?: string | undefined;
|
|
236
|
+
name?: string | undefined;
|
|
237
|
+
description?: string | undefined;
|
|
238
|
+
information?: {
|
|
239
|
+
description?: string | undefined;
|
|
240
|
+
operationId?: (string | number) | undefined;
|
|
241
|
+
parameters?: {
|
|
242
|
+
name: string;
|
|
243
|
+
in?: string | undefined;
|
|
244
|
+
description?: string | undefined;
|
|
245
|
+
required?: boolean | undefined;
|
|
246
|
+
deprecated?: boolean | undefined;
|
|
247
|
+
allowEmptyValue?: boolean | undefined;
|
|
248
|
+
style?: ("form" | "simple") | undefined;
|
|
249
|
+
explode?: boolean | undefined;
|
|
250
|
+
allowReserved?: boolean | undefined;
|
|
251
|
+
schema?: {
|
|
252
|
+
type: string;
|
|
253
|
+
name?: string | undefined;
|
|
254
|
+
example?: any;
|
|
255
|
+
default?: any;
|
|
256
|
+
format?: string | undefined;
|
|
257
|
+
description?: string | undefined;
|
|
258
|
+
properties?: Record<string, import("@scalar/types").Schema> | undefined;
|
|
259
|
+
} | undefined;
|
|
260
|
+
example?: any;
|
|
261
|
+
examples?: (Map<string, any> & Omit<Map<string, any>, keyof Map<any, any>>) | undefined;
|
|
262
|
+
content?: import("@scalar/types").RequestBodyMimeTypes | undefined;
|
|
263
|
+
headers?: {
|
|
264
|
+
[key: string]: import("@scalar/openapi-types").OpenAPI.HeaderObject;
|
|
265
|
+
} | undefined;
|
|
266
|
+
}[] | undefined;
|
|
267
|
+
responses?: Record<string, import("@scalar/openapi-types").OpenAPI.ResponseObject> | undefined;
|
|
268
|
+
security?: import("@scalar/openapi-types").OpenAPIV3.SecurityRequirementObject[] | undefined;
|
|
269
|
+
requestBody?: {
|
|
270
|
+
description?: string | undefined;
|
|
271
|
+
required?: boolean | undefined;
|
|
272
|
+
content?: import("@scalar/types").RequestBodyMimeTypes | undefined;
|
|
273
|
+
} | undefined;
|
|
274
|
+
summary?: string | undefined;
|
|
275
|
+
tags?: string[] | undefined;
|
|
276
|
+
deprecated?: boolean | undefined;
|
|
277
|
+
servers?: {
|
|
278
|
+
url?: string | undefined;
|
|
279
|
+
description?: string | undefined;
|
|
280
|
+
variables?: Record<string, import("@scalar/openapi-types").OpenAPIV3_1.ServerVariableObject> | undefined;
|
|
281
|
+
}[] | undefined;
|
|
282
|
+
'x-custom-examples'?: {
|
|
283
|
+
lang: string;
|
|
284
|
+
label: string;
|
|
285
|
+
source: string;
|
|
286
|
+
}[] | undefined;
|
|
287
|
+
'x-scalar-stability'?: import("@scalar/types").XScalarStability | undefined;
|
|
288
|
+
'x-codeSamples'?: {
|
|
289
|
+
lang: string;
|
|
290
|
+
label: string;
|
|
291
|
+
source: string;
|
|
292
|
+
}[] | undefined;
|
|
293
|
+
'x-code-samples'?: {
|
|
294
|
+
lang: string;
|
|
295
|
+
label: string;
|
|
296
|
+
source: string;
|
|
297
|
+
}[] | undefined;
|
|
298
|
+
} | undefined;
|
|
299
|
+
servers?: {
|
|
300
|
+
url?: string | undefined;
|
|
301
|
+
description?: string | undefined;
|
|
302
|
+
variables?: Record<string, import("@scalar/openapi-types").OpenAPIV3_1.ServerVariableObject> | undefined;
|
|
303
|
+
}[] | undefined;
|
|
304
|
+
pathParameters?: {
|
|
305
|
+
name: string;
|
|
306
|
+
in?: string | undefined;
|
|
307
|
+
description?: string | undefined;
|
|
308
|
+
required?: boolean | undefined;
|
|
309
|
+
deprecated?: boolean | undefined;
|
|
310
|
+
allowEmptyValue?: boolean | undefined;
|
|
311
|
+
style?: ("form" | "simple") | undefined;
|
|
312
|
+
explode?: boolean | undefined;
|
|
313
|
+
allowReserved?: boolean | undefined;
|
|
314
|
+
schema?: {
|
|
315
|
+
type: string;
|
|
316
|
+
name?: string | undefined;
|
|
317
|
+
example?: any;
|
|
318
|
+
default?: any;
|
|
319
|
+
format?: string | undefined;
|
|
320
|
+
description?: string | undefined;
|
|
321
|
+
properties?: Record<string, import("@scalar/types").Schema> | undefined;
|
|
322
|
+
} | undefined;
|
|
323
|
+
example?: any;
|
|
324
|
+
examples?: (Map<string, any> & Omit<Map<string, any>, keyof Map<any, any>>) | undefined;
|
|
325
|
+
content?: import("@scalar/types").RequestBodyMimeTypes | undefined;
|
|
326
|
+
headers?: {
|
|
327
|
+
[key: string]: import("@scalar/openapi-types").OpenAPI.HeaderObject;
|
|
328
|
+
} | undefined;
|
|
329
|
+
}[] | undefined;
|
|
330
|
+
}[];
|
|
331
|
+
'x-displayName'?: string | undefined;
|
|
332
|
+
}[] | undefined;
|
|
333
|
+
info: {
|
|
334
|
+
title?: string | undefined;
|
|
335
|
+
description?: string | undefined;
|
|
336
|
+
termsOfService?: string | undefined;
|
|
337
|
+
contact?: {
|
|
338
|
+
name?: string | undefined;
|
|
339
|
+
url?: string | undefined;
|
|
340
|
+
email?: string | undefined;
|
|
341
|
+
} | undefined;
|
|
342
|
+
license?: {
|
|
343
|
+
name?: string | undefined;
|
|
344
|
+
url?: string | undefined;
|
|
345
|
+
} | undefined;
|
|
346
|
+
version?: string | undefined;
|
|
347
|
+
} | {
|
|
348
|
+
title?: string | undefined;
|
|
349
|
+
description?: string | undefined;
|
|
350
|
+
termsOfService?: string | undefined;
|
|
351
|
+
contact?: {
|
|
352
|
+
name?: string | undefined;
|
|
353
|
+
url?: string | undefined;
|
|
354
|
+
email?: string | undefined;
|
|
355
|
+
} | undefined;
|
|
356
|
+
license?: {
|
|
357
|
+
name?: string | undefined;
|
|
358
|
+
url?: string | undefined;
|
|
359
|
+
} | undefined;
|
|
360
|
+
version?: string | undefined;
|
|
361
|
+
} | {
|
|
362
|
+
title?: string | undefined;
|
|
363
|
+
description?: string | undefined;
|
|
364
|
+
termsOfService?: string | undefined;
|
|
365
|
+
contact?: {
|
|
366
|
+
name?: string | undefined;
|
|
367
|
+
url?: string | undefined;
|
|
368
|
+
email?: string | undefined;
|
|
369
|
+
} | undefined;
|
|
370
|
+
version?: string | undefined;
|
|
371
|
+
summary?: string | undefined;
|
|
372
|
+
license?: {
|
|
373
|
+
name?: string | undefined;
|
|
374
|
+
url?: string | undefined;
|
|
375
|
+
identifier?: string | undefined;
|
|
376
|
+
} | undefined;
|
|
377
|
+
} | undefined;
|
|
378
|
+
host?: import("@scalar/openapi-types").OpenAPIV2.Document["host"];
|
|
379
|
+
basePath?: import("@scalar/openapi-types").OpenAPIV2.Document["basePath"];
|
|
380
|
+
schemes?: import("@scalar/openapi-types").OpenAPIV2.Document["schemes"];
|
|
381
|
+
externalDocs?: {
|
|
382
|
+
url: string;
|
|
383
|
+
description?: string | undefined;
|
|
384
|
+
} | undefined;
|
|
385
|
+
servers?: {
|
|
175
386
|
url?: string | undefined;
|
|
176
387
|
description?: string | undefined;
|
|
177
388
|
variables?: Record<string, import("@scalar/openapi-types").OpenAPIV3_1.ServerVariableObject> | undefined;
|
|
389
|
+
}[] | {
|
|
390
|
+
url?: string | undefined;
|
|
391
|
+
description?: string | undefined;
|
|
392
|
+
variables?: {
|
|
393
|
+
[variable: string]: import("@scalar/openapi-types").OpenAPIV3.ServerVariableObject;
|
|
394
|
+
} | undefined;
|
|
178
395
|
}[] | undefined;
|
|
179
396
|
components?: {
|
|
180
397
|
schemas?: {
|
|
@@ -225,7 +442,7 @@ export declare function useReactiveSpec({ specConfig, proxyUrl, }: {
|
|
|
225
442
|
tags: string[];
|
|
226
443
|
}[] | undefined;
|
|
227
444
|
security?: import("@scalar/openapi-types").OpenAPIV3.SecurityRequirementObject[] | undefined;
|
|
228
|
-
}
|
|
445
|
+
}>;
|
|
229
446
|
specErrors: import("vue").Ref<string | null, string | null>;
|
|
230
447
|
};
|
|
231
448
|
//# sourceMappingURL=useReactiveSpec.d.ts.map
|
|
@@ -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,
|
|
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;AAoDhE;;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,46 +1,48 @@
|
|
|
1
|
-
import { isValidUrl as d, fetchSpecFromUrl as
|
|
2
|
-
import { ref as
|
|
1
|
+
import { isValidUrl as d, fetchSpecFromUrl as u, prettyPrintJson as h } from "@scalar/oas-utils/helpers";
|
|
2
|
+
import { ref as s, watch as m, toValue as p } from "vue";
|
|
3
3
|
import { parse as v } from "../helpers/parse.js";
|
|
4
4
|
import { createEmptySpecification as l } from "../helpers/createEmptySpecification.js";
|
|
5
|
-
const y = async ({ url: e, content:
|
|
5
|
+
const y = async ({ url: e, content: o }, n) => {
|
|
6
6
|
if (e) {
|
|
7
|
-
const
|
|
7
|
+
const i = performance.now();
|
|
8
8
|
try {
|
|
9
|
-
const c = d(e) ? await
|
|
10
|
-
return console.log(`fetch: ${Math.round(
|
|
9
|
+
const c = d(e) ? await u(e, n) : await u(e), r = performance.now();
|
|
10
|
+
return console.log(`fetch: ${Math.round(r - i)} ms (${e})`), console.log("size:", Math.round(c.length / 1024), "kB"), c;
|
|
11
11
|
} catch (c) {
|
|
12
12
|
console.error("Failed to fetch spec from URL:", c);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
const t = typeof
|
|
15
|
+
const t = typeof o == "function" ? o() : o;
|
|
16
16
|
if (typeof t == "string")
|
|
17
17
|
return t;
|
|
18
18
|
if (typeof t == "object")
|
|
19
19
|
return h(t);
|
|
20
20
|
};
|
|
21
|
-
function
|
|
21
|
+
function E({
|
|
22
22
|
specConfig: e,
|
|
23
|
-
proxyUrl:
|
|
23
|
+
proxyUrl: o
|
|
24
24
|
}) {
|
|
25
|
-
const n =
|
|
26
|
-
function c(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}).
|
|
34
|
-
|
|
35
|
-
})
|
|
25
|
+
const n = s(""), t = s(l()), i = s(null);
|
|
26
|
+
function c(r) {
|
|
27
|
+
if (!r) {
|
|
28
|
+
t.value = l();
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
v(r, {
|
|
32
|
+
proxyUrl: o ? p(o) : void 0
|
|
33
|
+
}).then((a) => {
|
|
34
|
+
i.value = null, t.value = a;
|
|
35
|
+
}).catch((a) => {
|
|
36
|
+
i.value = a.toString();
|
|
37
|
+
});
|
|
36
38
|
}
|
|
37
39
|
return m(
|
|
38
|
-
() =>
|
|
39
|
-
async (
|
|
40
|
-
var
|
|
41
|
-
if (
|
|
42
|
-
const
|
|
43
|
-
typeof
|
|
40
|
+
() => p(e),
|
|
41
|
+
async (r) => {
|
|
42
|
+
var a;
|
|
43
|
+
if (r) {
|
|
44
|
+
const f = (a = await y(r, p(o))) == null ? void 0 : a.trim();
|
|
45
|
+
typeof f == "string" && (n.value = f);
|
|
44
46
|
}
|
|
45
47
|
},
|
|
46
48
|
{ immediate: !0, deep: !0 }
|
|
@@ -49,9 +51,9 @@ function C({
|
|
|
49
51
|
}), {
|
|
50
52
|
rawSpec: n,
|
|
51
53
|
parsedSpec: t,
|
|
52
|
-
specErrors:
|
|
54
|
+
specErrors: i
|
|
53
55
|
};
|
|
54
56
|
}
|
|
55
57
|
export {
|
|
56
|
-
|
|
58
|
+
E as useReactiveSpec
|
|
57
59
|
};
|