@scalar/api-client 2.1.13 → 2.1.15

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,23 @@
1
1
  # @scalar/api-client
2
2
 
3
+ ## 2.1.15
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [9dc2ab7]
8
+ - @scalar/types@0.0.13
9
+ - @scalar/oas-utils@0.2.52
10
+ - @scalar/themes@0.9.34
11
+ - @scalar/components@0.12.50
12
+
13
+ ## 2.1.14
14
+
15
+ ### Patch Changes
16
+
17
+ - dea7b57: feat: adds open api document content import from command palette
18
+ - 008eca4: fix: Basic Auth should still include a colon after the username
19
+ - 9ba2c9f: fix: updates sidebar call to action position
20
+
3
21
  ## 2.1.13
4
22
 
5
23
  ### Patch Changes
@@ -1,11 +1,15 @@
1
1
  declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<{
2
2
  modelValue?: string;
3
+ placeholder?: string;
3
4
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
4
5
  "update:modelValue": (v: string) => void;
5
6
  onDelete: (event: KeyboardEvent) => void;
7
+ paste: (event: ClipboardEvent) => void;
6
8
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
7
9
  modelValue?: string;
10
+ placeholder?: string;
8
11
  }>>> & {
12
+ onPaste?: ((event: ClipboardEvent) => any) | undefined;
9
13
  "onUpdate:modelValue"?: ((v: string) => any) | undefined;
10
14
  onOnDelete?: ((event: KeyboardEvent) => any) | undefined;
11
15
  }, {}, {}>;
@@ -1 +1 @@
1
- {"version":3,"file":"CommandActionInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandActionInput.vue"],"names":[],"mappings":";iBAqDe,MAAM;;;;;iBAAN,MAAM;;;;;AA0FrB,wBAOG;AAOH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
1
+ {"version":3,"file":"CommandActionInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandActionInput.vue"],"names":[],"mappings":";iBA6De,MAAM;kBACL,MAAM;;;;;;iBADP,MAAM;kBACL,MAAM;;;;;;AAoGtB,wBAOG;AAOH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
@@ -1,42 +1,47 @@
1
- import { defineComponent as f, ref as c, onMounted as h, nextTick as y, computed as v, openBlock as w, createElementBlock as V, Fragment as _, createElementVNode as a, unref as s, withDirectives as k, mergeProps as g, withKeys as x, withModifiers as D, vModelDynamic as b } from "vue";
2
- import { nanoid as B } from "nanoid";
3
- const M = ["for"], A = ["id"], K = /* @__PURE__ */ f({
1
+ import { defineComponent as f, ref as h, onMounted as y, nextTick as v, computed as w, openBlock as V, createElementBlock as k, Fragment as g, createElementVNode as u, unref as d, withDirectives as x, mergeProps as D, withKeys as _, withModifiers as b, vModelDynamic as B } from "vue";
2
+ import { nanoid as M } from "nanoid";
3
+ const P = ["for"], A = ["id", "placeholder"], K = /* @__PURE__ */ f({
4
4
  inheritAttrs: !1,
5
5
  __name: "CommandActionInput",
6
6
  props: {
7
- modelValue: {}
7
+ modelValue: {},
8
+ placeholder: {}
8
9
  },
9
- emits: ["update:modelValue", "onDelete"],
10
- setup(i, { emit: d }) {
11
- const m = i, l = d, r = B(), u = c(null);
12
- h(() => y(() => {
10
+ emits: ["update:modelValue", "onDelete", "paste"],
11
+ setup(i, { emit: p }) {
12
+ const r = i, l = p, a = M(), s = h(null);
13
+ y(() => v(() => {
13
14
  var e;
14
- return (e = u.value) == null ? void 0 : e.focus();
15
+ return (e = s.value) == null ? void 0 : e.focus();
15
16
  }));
16
- const o = v({
17
- get: () => m.modelValue ?? "",
17
+ const n = w({
18
+ get: () => r.modelValue ?? "",
18
19
  set: (e) => l("update:modelValue", e)
19
- }), p = (e) => {
20
- o.value === "" && l("onDelete", e);
20
+ }), m = (e) => {
21
+ n.value === "" && l("onDelete", e);
22
+ }, c = (e) => {
23
+ l("paste", e);
21
24
  };
22
- return (e, t) => (w(), V(_, null, [
23
- a("label", {
25
+ return (e, t) => (V(), k(g, null, [
26
+ u("label", {
24
27
  class: "absolute w-full h-full opacity-0 cursor-text",
25
- for: s(r)
26
- }, null, 8, M),
27
- k(a("input", g({
28
- id: s(r),
28
+ for: d(a)
29
+ }, null, 8, P),
30
+ x(u("input", D({
31
+ id: d(a),
29
32
  ref_key: "input",
30
- ref: u,
31
- "onUpdate:modelValue": t[0] || (t[0] = (n) => o.value = n),
33
+ ref: s,
34
+ "onUpdate:modelValue": t[0] || (t[0] = (o) => n.value = o),
32
35
  autocomplete: "off",
33
36
  class: "border-transparent outline-none w-full pl-8 text-sm min-h-8 py-1.5",
34
37
  "data-form-type": "other",
35
- "data-lpignore": "true"
38
+ "data-lpignore": "true",
39
+ placeholder: r.placeholder
36
40
  }, e.$attrs, {
37
- onKeydown: t[1] || (t[1] = x(D((n) => p(n), ["stop"]), ["delete"]))
41
+ onKeydown: t[1] || (t[1] = _(b((o) => m(o), ["stop"]), ["delete"])),
42
+ onPaste: t[2] || (t[2] = (o) => c(o))
38
43
  }), null, 16, A), [
39
- [b, o.value]
44
+ [B, n.value]
40
45
  ])
41
46
  ], 64));
42
47
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CommandPaletteImport.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteImport.vue"],"names":[],"mappings":";;;;;;;AA6RA,wBAMG"}
1
+ {"version":3,"file":"CommandPaletteImport.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteImport.vue"],"names":[],"mappings":";;;;;;;AA0bA,wBAMG"}
@@ -1,78 +1,119 @@
1
- import { defineComponent as w, ref as b, openBlock as F, createBlock as h, withCtx as l, createVNode as c, unref as i, createTextVNode as p } from "vue";
2
- import { ScalarButton as y, ScalarIcon as C } from "@scalar/components";
3
- import { useToasts as I } from "@scalar/use-toasts";
4
- import U from "./CommandActionForm.vue.js";
5
- import V from "./CommandActionInput.vue.js";
6
- import { useFileDialog as R } from "../../hooks/useFileDialog.js";
7
- import { useWorkspace as $ } from "../../store/store.js";
8
- const O = /* @__PURE__ */ w({
1
+ import { defineComponent as V, ref as _, openBlock as s, createBlock as u, withCtx as l, createVNode as p, unref as r, createTextVNode as d, createElementBlock as h, Fragment as A, createCommentVNode as O } from "vue";
2
+ import { ScalarButton as x, ScalarIcon as P, ScalarCodeBlock as B } from "@scalar/components";
3
+ import { useToasts as $ } from "@scalar/use-toasts";
4
+ import N from "./CommandActionForm.vue.js";
5
+ import T from "./CommandActionInput.vue.js";
6
+ import { useFileDialog as L } from "../../hooks/useFileDialog.js";
7
+ import { getOpenApiDocumentVersion as f } from "../../libs/getOpenApiDocumentVersion.js";
8
+ import { isUrl as v } from "../../libs/isUrl.js";
9
+ import { isDocument as M } from "../../libs/isDocument.js";
10
+ import { useWorkspace as R } from "../../store/store.js";
11
+ const X = /* @__PURE__ */ V({
9
12
  __name: "CommandPaletteImport",
10
13
  emits: ["close", "back"],
11
- setup(A, { emit: u }) {
12
- const n = u, { activeWorkspace: f, importSpecFile: d, importSpecFromUrl: g } = $(), r = b(""), { toast: a } = I(), { open: k } = R({
13
- onChange: async (e) => {
14
- const o = e == null ? void 0 : e[0];
14
+ setup(j, { emit: b }) {
15
+ const m = b, { activeWorkspace: c, importSpecFile: g, importSpecFromUrl: C } = R(), { toast: n } = $(), e = _(""), { open: y } = L({
16
+ onChange: async (a) => {
17
+ const o = a == null ? void 0 : a[0];
15
18
  if (o) {
16
19
  const t = new FileReader();
17
- t.onload = async (S) => {
18
- var m;
19
- const _ = (m = S.target) == null ? void 0 : m.result;
20
+ t.onload = async (w) => {
21
+ var k;
22
+ const F = (k = w.target) == null ? void 0 : k.result;
20
23
  try {
21
- await d(_, f.value.uid), a("Import successful", "info"), n("close");
22
- } catch (s) {
23
- console.error(s);
24
- const v = (s == null ? void 0 : s.message) || "Unknown error";
25
- a(`Import failed: ${v}`, "error");
24
+ await g(F, c.value.uid), n("Import successful", "info"), m("close");
25
+ } catch (i) {
26
+ console.error(i);
27
+ const U = (i == null ? void 0 : i.message) || "Unknown error";
28
+ n(`Import failed: ${U}`, "error");
26
29
  }
27
30
  }, t.readAsText(o);
28
31
  }
29
32
  },
30
33
  multiple: !1,
31
34
  accept: ".json,.yaml,.yml"
32
- }), x = async () => {
33
- if (r.value)
34
- try {
35
- await g(r.value), a("Import successful", "info"), n("close");
36
- } catch (e) {
37
- console.error("the error ", e);
38
- const o = (e == null ? void 0 : e.message) || "Unknown error";
39
- a(`Import failed: ${o}`, "error");
40
- }
41
- };
42
- return (e, o) => (F(), h(U, { onSubmit: x }, {
35
+ });
36
+ async function I() {
37
+ try {
38
+ e.value && (v(e.value) ? await C(
39
+ e.value,
40
+ void 0,
41
+ void 0,
42
+ c.value.uid
43
+ ) : M(e.value) ? await g(
44
+ String(e.value),
45
+ c.value.uid
46
+ ) : n("Import failed: Invalid URL or OpenAPI document", "error")), m("close"), n("Import successful", "info");
47
+ } catch (a) {
48
+ console.error("[importCollection]", a);
49
+ const o = (a == null ? void 0 : a.message) || "Unknown error";
50
+ n(`Import failed: ${o}`, "error");
51
+ }
52
+ }
53
+ function S() {
54
+ return (f(e.value) || {}).type ?? "json";
55
+ }
56
+ function D(a) {
57
+ var t;
58
+ const o = (t = a.clipboardData) == null ? void 0 : t.getData("text");
59
+ o && (e.value = o);
60
+ }
61
+ return (a, o) => (s(), u(N, {
62
+ disabled: !e.value.trim(),
63
+ onSubmit: I
64
+ }, {
43
65
  options: l(() => [
44
- c(i(y), {
45
- class: "p-2 max-h-8 gap-1 text-xs hover:bg-b-2 relative",
66
+ p(r(x), {
67
+ class: "p-2 max-h-8 gap-1.5 text-xs hover:bg-b-2 relative",
46
68
  variant: "outlined",
47
- onClick: i(k)
69
+ onClick: r(y)
48
70
  }, {
49
71
  default: l(() => [
50
- p(" JSON, or YAML Files "),
51
- c(i(C), {
52
- class: "text-c-3 -rotate-90",
53
- icon: "ArrowRight",
54
- size: "sm"
72
+ d(" JSON, or YAML File "),
73
+ p(r(P), {
74
+ class: "text-c-3",
75
+ icon: "UploadSimple",
76
+ size: "md"
55
77
  })
56
78
  ]),
57
79
  _: 1
58
80
  }, 8, ["onClick"])
59
81
  ]),
60
82
  submit: l(() => [
61
- p("Import Collection")
83
+ d("Import Collection")
62
84
  ]),
63
85
  default: l(() => [
64
- c(V, {
65
- modelValue: r.value,
66
- "onUpdate:modelValue": o[0] || (o[0] = (t) => r.value = t),
67
- label: "Paste Swagger File URL",
68
- placeholder: "Paste Swagger File URL",
69
- onOnDelete: o[1] || (o[1] = (t) => n("back", t))
70
- }, null, 8, ["modelValue"])
86
+ !r(f)(e.value) || r(v)(e.value) ? (s(), u(T, {
87
+ key: 0,
88
+ modelValue: e.value,
89
+ "onUpdate:modelValue": o[0] || (o[0] = (t) => e.value = t),
90
+ placeholder: "Paste Swagger/OpenAPI File URL or content",
91
+ onOnDelete: o[1] || (o[1] = (t) => m("back", t)),
92
+ onPaste: o[2] || (o[2] = (t) => D(t))
93
+ }, null, 8, ["modelValue"])) : (s(), h(A, { key: 1 }, [
94
+ p(r(x), {
95
+ class: "ml-auto p-2 max-h-8 gap-1.5 text-xs hover:bg-b-2 relative",
96
+ variant: "ghost",
97
+ onClick: o[3] || (o[3] = (t) => e.value = "")
98
+ }, {
99
+ default: l(() => [
100
+ d(" Clear ")
101
+ ]),
102
+ _: 1
103
+ }),
104
+ r(f)(e.value) && !r(v)(e.value) ? (s(), u(r(B), {
105
+ key: 0,
106
+ class: "bg-backdropdark border max-h-[25dvh] mt-2 rounded",
107
+ content: e.value,
108
+ copy: !1,
109
+ lang: S()
110
+ }, null, 8, ["content", "lang"])) : O("", !0)
111
+ ], 64))
71
112
  ]),
72
113
  _: 1
73
- }));
114
+ }, 8, ["disabled"]));
74
115
  }
75
116
  });
76
117
  export {
77
- O as default
118
+ X as default
78
119
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Sidebar.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Sidebar/Sidebar.vue"],"names":[],"mappings":"AAmNA,iBAAS,cAAc;oBAkGK,GAAG;oBACH,GAAG;oBAEH,GAAG;qBADF,GAAG;EAsB/B;AACD,QAAA,MAAM,eAAe;YA5LT,MAAM;kBACA,OAAO;;;;YADb,MAAM;kBACA,OAAO;;;;iBAAP,OAAO;MAiMvB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAAvG,wBAAwG;A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ar.vue2.js";
2
2
  /* empty css */
3
3
  import r from "../../_virtual/_plugin-vue_export-helper.js";
4
- const p = /* @__PURE__ */ r(o, [["__scopeId", "data-v-4610d0c0"]]);
4
+ const m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-c7a612bc"]]);
5
5
  export {
6
- p as default
6
+ m as default
7
7
  };
@@ -1,50 +1,55 @@
1
- import { defineComponent as L, ref as b, withDirectives as B, openBlock as a, createElementBlock as l, normalizeClass as g, normalizeStyle as W, unref as t, renderSlot as r, createElementVNode as w, toDisplayString as _, createCommentVNode as n, vShow as $ } from "vue";
1
+ import { defineComponent as _, ref as b, withDirectives as L, openBlock as r, createElementBlock as i, normalizeClass as g, normalizeStyle as B, unref as t, renderSlot as n, createElementVNode as w, toDisplayString as W, createCommentVNode as d, vShow as $ } from "vue";
2
2
  import { useMediaQuery as y } from "@vueuse/core";
3
- import { useWorkspace as C } from "../../store/store.js";
4
- const z = {
3
+ import { useWorkspace as z } from "../../store/store.js";
4
+ const C = {
5
5
  key: 0,
6
6
  class: "xl:min-h-header flex items-center justify-between border-b-1/2 p-2 md:px-4 md:py-2.5 text-sm"
7
- }, I = { class: "font-medium m-0 text-sm whitespace-nowrap" }, X = /* @__PURE__ */ L({
7
+ }, I = { class: "font-medium m-0 text-sm whitespace-nowrap" }, M = {
8
+ key: 1,
9
+ class: "relative z-10 pt-0 md:px-2.5 md:pb-2.5 -translate-y-full w-[inherit] has-[.empty-sidebar-item]:border-t-1/2"
10
+ }, V = /* @__PURE__ */ _({
8
11
  __name: "Sidebar",
9
12
  props: {
10
13
  title: {},
11
14
  showSideBar: { type: Boolean, default: !0 }
12
15
  },
13
16
  setup(x) {
14
- const E = x, { isReadOnly: m, sidebarWidth: o, setSidebarWidth: i } = C(), d = b(!1), u = y("(max-width: 780px)"), c = b(null), p = y("(max-width: 800px)"), k = (e) => {
17
+ const E = x, { isReadOnly: m, sidebarWidth: o, setSidebarWidth: a } = z(), l = b(!1), u = y("(max-width: 780px)"), c = b(null), p = y("(max-width: 800px)"), k = (e) => {
15
18
  e.preventDefault();
16
19
  const f = e.clientX, S = parseInt(
17
20
  getComputedStyle(c.value).width || o.value,
18
21
  10
19
22
  ), v = (D) => {
20
- d.value = !0, document.body.classList.add("dragging");
23
+ l.value = !0, document.body.classList.add("dragging");
21
24
  let s = S + D.clientX - f;
22
- s > 420 && (s = 420 + (s - 420) * 0.2), s < 240 && (s = 240), i(`${s}px`);
25
+ s > 420 && (s = 420 + (s - 420) * 0.2), s < 240 && (s = 240), a(`${s}px`);
23
26
  }, h = () => {
24
- d.value = !1, document.body.classList.remove("dragging"), document.documentElement.removeEventListener("mousemove", v, !1), document.documentElement.removeEventListener("mouseup", h, !1), parseInt(o.value, 10) > 420 ? i("360px") : parseInt(o.value, 10) < 240 && i("240px");
27
+ l.value = !1, document.body.classList.remove("dragging"), document.documentElement.removeEventListener("mousemove", v, !1), document.documentElement.removeEventListener("mouseup", h, !1), parseInt(o.value, 10) > 420 ? a("360px") : parseInt(o.value, 10) < 240 && a("240px");
25
28
  };
26
29
  document.documentElement.addEventListener("mousemove", v, !1), document.documentElement.addEventListener("mouseup", h, !1);
27
30
  };
28
- return (e, f) => B((a(), l("aside", {
31
+ return (e, f) => L((r(), i("aside", {
29
32
  ref_key: "sidebarRef",
30
33
  ref: c,
31
- class: g(["sidebar overflow-hidden relative flex flex-col flex-1 md:flex-none bg-b-1 md:border-b-0 md:border-r-1/2 min-w-full md:min-w-fit", { dragging: d.value }]),
32
- style: W({ width: t(u) ? "100%" : t(o) })
34
+ class: g(["sidebar overflow-hidden relative flex flex-col flex-1 md:flex-none bg-b-1 md:border-b-0 md:border-r-1/2 min-w-full md:min-w-fit", { dragging: l.value }]),
35
+ style: B({ width: t(u) ? "100%" : t(o) })
33
36
  }, [
34
- r(e.$slots, "header", {}, void 0, !0),
35
- !t(m) && e.title ? (a(), l("div", z, [
36
- w("h2", I, _(e.title), 1),
37
- t(p) ? r(e.$slots, "button", { key: 0 }, void 0, !0) : n("", !0)
38
- ])) : n("", !0),
37
+ n(e.$slots, "header", {}, void 0, !0),
38
+ !t(m) && e.title ? (r(), i("div", C, [
39
+ w("h2", I, W(e.title), 1),
40
+ t(p) ? n(e.$slots, "button", { key: 0 }, void 0, !0) : d("", !0)
41
+ ])) : d("", !0),
39
42
  w("div", {
40
43
  class: g(["custom-scroll sidebar-height pb-0 md:pb-[37px] w-[inherit]", {
41
44
  "sidebar-mask": !t(m)
42
45
  }])
43
46
  }, [
44
- r(e.$slots, "content", {}, void 0, !0)
47
+ n(e.$slots, "content", {}, void 0, !0)
45
48
  ], 2),
46
- t(p) ? n("", !0) : r(e.$slots, "button", { key: 1 }, void 0, !0),
47
- t(u) ? n("", !0) : (a(), l("div", {
49
+ t(p) ? d("", !0) : (r(), i("div", M, [
50
+ n(e.$slots, "button", {}, void 0, !0)
51
+ ])),
52
+ t(u) ? d("", !0) : (r(), i("div", {
48
53
  key: 2,
49
54
  class: "resizer",
50
55
  onMousedown: k
@@ -55,5 +60,5 @@ const z = {
55
60
  }
56
61
  });
57
62
  export {
58
- X as default
63
+ V as default
59
64
  };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Get the Swagger/OpenAPI version and format from the given string
3
+ */
4
+ export declare function getOpenApiDocumentVersion(input: string | null): false | {
5
+ version: string;
6
+ type: string;
7
+ };
8
+ //# sourceMappingURL=getOpenApiDocumentVersion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getOpenApiDocumentVersion.d.ts","sourceRoot":"","sources":["../../src/libs/getOpenApiDocumentVersion.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;;;EAsC7D"}
@@ -0,0 +1,20 @@
1
+ import { json as n, yaml as o } from "@scalar/oas-utils/helpers";
2
+ import { isDocument as t } from "./isDocument.js";
3
+ function i(r) {
4
+ if (!t(r))
5
+ return !1;
6
+ try {
7
+ const e = n.parse(r ?? "");
8
+ return typeof (e == null ? void 0 : e.openapi) == "string" ? { version: `OpenAPI ${e.openapi}`, type: "json" } : typeof (e == null ? void 0 : e.swagger) == "string" ? { version: `Swagger ${e.swagger}`, type: "json" } : !1;
9
+ } catch {
10
+ }
11
+ try {
12
+ const e = o.parse(r ?? "");
13
+ return typeof (e == null ? void 0 : e.openapi) == "string" ? { version: `OpenAPI ${e.openapi}`, type: "yaml" } : typeof (e == null ? void 0 : e.swagger) == "string" ? { version: `Swagger ${e.swagger}`, type: "yaml" } : !1;
14
+ } catch {
15
+ }
16
+ return !1;
17
+ }
18
+ export {
19
+ i as getOpenApiDocumentVersion
20
+ };
@@ -6,5 +6,8 @@ export * from './errors.js';
6
6
  export * from './normalize-headers.js';
7
7
  export * from './local-storage.js';
8
8
  export * from './environment-parser.js';
9
+ export * from './isUrl.js';
10
+ export * from './isDocument.js';
11
+ export * from './getOpenApiDocumentVersion.js';
9
12
  export { createRequestOperation } from './send-request.js';
10
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/libs/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA;AACpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/libs/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA;AACpC,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,6BAA6B,CAAA;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA"}
@@ -1,33 +1,39 @@
1
1
  import { createApiClient as o } from "./create-client.js";
2
- import { formatBytes as a, formatMs as s } from "./formatters.js";
3
- import { ERRORS as f, normalizeError as p, prettyErrorMessage as x } from "./errors.js";
4
- import { formatHeaderKey as l, normalizeHeaders as n } from "./normalize-headers.js";
2
+ import { formatBytes as m, formatMs as s } from "./formatters.js";
3
+ import { ERRORS as a, normalizeError as f, prettyErrorMessage as x } from "./errors.js";
4
+ import { formatHeaderKey as n, normalizeHeaders as i } from "./normalize-headers.js";
5
5
  import { loadAllResources as c } from "./local-storage.js";
6
6
  import { parseEnvVariables as d } from "./environment-parser.js";
7
- import { createRequestOperation as E } from "./send-request.js";
8
- import { commandPaletteBus as q } from "./event-busses/command-palette-bus.js";
9
- import { DEFAULT_HOTKEYS as K, getModifiers as A, handleHotKeyDown as M, hotKeyBus as O } from "./event-busses/hot-keys-bus.js";
10
- import { executeRequestBus as g } from "./event-busses/execute-request-bus.js";
11
- import { cancelRequestBus as z } from "./event-busses/cancel-request-bus.js";
12
- import { requestStatusBus as T } from "./event-busses/request-status-bus.js";
7
+ import { isUrl as E } from "./isUrl.js";
8
+ import { isDocument as q } from "./isDocument.js";
9
+ import { getOpenApiDocumentVersion as D } from "./getOpenApiDocumentVersion.js";
10
+ import { createRequestOperation as K } from "./send-request.js";
11
+ import { commandPaletteBus as g } from "./event-busses/command-palette-bus.js";
12
+ import { DEFAULT_HOTKEYS as S, getModifiers as h, handleHotKeyDown as z, hotKeyBus as T } from "./event-busses/hot-keys-bus.js";
13
+ import { executeRequestBus as V } from "./event-busses/execute-request-bus.js";
14
+ import { cancelRequestBus as v } from "./event-busses/cancel-request-bus.js";
15
+ import { requestStatusBus as C } from "./event-busses/request-status-bus.js";
13
16
  export {
14
- K as DEFAULT_HOTKEYS,
15
- f as ERRORS,
16
- z as cancelRequestBus,
17
- q as commandPaletteBus,
17
+ S as DEFAULT_HOTKEYS,
18
+ a as ERRORS,
19
+ v as cancelRequestBus,
20
+ g as commandPaletteBus,
18
21
  o as createApiClient,
19
- E as createRequestOperation,
20
- g as executeRequestBus,
21
- a as formatBytes,
22
- l as formatHeaderKey,
22
+ K as createRequestOperation,
23
+ V as executeRequestBus,
24
+ m as formatBytes,
25
+ n as formatHeaderKey,
23
26
  s as formatMs,
24
- A as getModifiers,
25
- M as handleHotKeyDown,
26
- O as hotKeyBus,
27
+ h as getModifiers,
28
+ D as getOpenApiDocumentVersion,
29
+ z as handleHotKeyDown,
30
+ T as hotKeyBus,
31
+ q as isDocument,
32
+ E as isUrl,
27
33
  c as loadAllResources,
28
- p as normalizeError,
29
- n as normalizeHeaders,
34
+ f as normalizeError,
35
+ i as normalizeHeaders,
30
36
  d as parseEnvVariables,
31
37
  x as prettyErrorMessage,
32
- T as requestStatusBus
38
+ C as requestStatusBus
33
39
  };
@@ -0,0 +1,3 @@
1
+ /** Checks whether the given string could be an OpenAPI document */
2
+ export declare function isDocument(input: string | null): boolean | "" | null;
3
+ //# sourceMappingURL=isDocument.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isDocument.d.ts","sourceRoot":"","sources":["../../src/libs/isDocument.ts"],"names":[],"mappings":"AAEA,mEAAmE;AACnE,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,uBAE9C"}
@@ -0,0 +1,7 @@
1
+ import { isUrl as o } from "./isUrl.js";
2
+ function e(r) {
3
+ return r && !o(r);
4
+ }
5
+ export {
6
+ e as isDocument
7
+ };
@@ -0,0 +1,3 @@
1
+ /** Checks whether the given string is an URL */
2
+ export declare function isUrl(input: string | null): boolean | "" | null;
3
+ //# sourceMappingURL=isUrl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isUrl.d.ts","sourceRoot":"","sources":["../../src/libs/isUrl.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,uBAEzC"}
@@ -0,0 +1,6 @@
1
+ function r(t) {
2
+ return t && (t.startsWith("http://") || t.startsWith("https://"));
3
+ }
4
+ export {
5
+ r as isUrl
6
+ };