@scalar/api-reference 1.28.8 → 1.28.9

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.
@@ -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,EAAiC,MAAM,KAAK,CAAA;AAoD1E;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyDA"}
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 f, prettyPrintJson as h } from "@scalar/oas-utils/helpers";
2
- import { ref as u, reactive as g, watch as m, toValue as s } from "vue";
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: r }, n) => {
5
+ const y = async ({ url: e, content: o }, n) => {
6
6
  if (e) {
7
- const a = performance.now();
7
+ const i = performance.now();
8
8
  try {
9
- const c = d(e) ? await f(e, n) : await f(e), o = performance.now();
10
- return console.log(`fetch: ${Math.round(o - a)} ms (${e})`), console.log("size:", Math.round(c.length / 1024), "kB"), c;
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 r == "function" ? r() : r;
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 C({
21
+ function E({
22
22
  specConfig: e,
23
- proxyUrl: r
23
+ proxyUrl: o
24
24
  }) {
25
- const n = u(""), t = g(l()), a = u(null);
26
- function c(o) {
27
- return o ? v(o, {
28
- proxyUrl: r ? s(r) : void 0
29
- }).then((i) => {
30
- a.value = null, Object.assign(t, {
31
- ...i
32
- });
33
- }).catch((i) => {
34
- a.value = i.toString();
35
- }) : Object.assign(t, l());
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
- () => s(e),
39
- async (o) => {
40
- var i;
41
- if (o) {
42
- const p = (i = await y(o, s(r))) == null ? void 0 : i.trim();
43
- typeof p == "string" && (n.value = p);
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: a
54
+ specErrors: i
53
55
  };
54
56
  }
55
57
  export {
56
- C as useReactiveSpec
58
+ E as useReactiveSpec
57
59
  };