@scalar/api-client 2.1.26 → 2.1.27
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 +17 -0
- package/dist/components/CommandPalette/CommandPaletteImport.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPaletteImport.vue.js +149 -89
- package/dist/components/ImportCollection/ImportNowButton.vue.d.ts.map +1 -1
- package/dist/components/ImportCollection/ImportNowButton.vue.js +7 -9
- package/dist/layouts/App/create-api-client-app.d.ts +77 -20
- package/dist/layouts/App/create-api-client-app.d.ts.map +1 -1
- package/dist/layouts/App/create-api-client-app.js +14 -12
- package/dist/layouts/Modal/create-api-client-modal.d.ts +154 -40
- package/dist/layouts/Modal/create-api-client-modal.d.ts.map +1 -1
- package/dist/layouts/Modal/create-api-client-modal.js +23 -26
- package/dist/layouts/Web/create-api-client-web.d.ts +77 -20
- package/dist/layouts/Web/create-api-client-web.d.ts.map +1 -1
- package/dist/layouts/Web/create-api-client-web.js +12 -10
- package/dist/libs/create-client.d.ts +77 -20
- package/dist/libs/create-client.d.ts.map +1 -1
- package/dist/libs/create-client.js +60 -58
- package/dist/store/collections.d.ts +34 -4
- package/dist/store/collections.d.ts.map +1 -1
- package/dist/store/import-spec.d.ts +43 -4
- package/dist/store/import-spec.d.ts.map +1 -1
- package/dist/store/import-spec.js +60 -36
- package/dist/store/requests.d.ts +4 -1
- package/dist/store/requests.d.ts.map +1 -1
- package/dist/store/requests.js +76 -76
- package/dist/store/security-schemes.d.ts +2 -2
- package/dist/store/security-schemes.d.ts.map +1 -1
- package/dist/store/security-schemes.js +35 -37
- package/dist/store/servers.d.ts +10 -10
- package/dist/store/servers.d.ts.map +1 -1
- package/dist/store/store.d.ts +154 -40
- package/dist/store/store.d.ts.map +1 -1
- package/dist/store/store.js +27 -27
- package/dist/style.css +1 -1
- package/dist/views/Request/Request.vue.d.ts.map +1 -1
- package/dist/views/Request/Request.vue.js +1 -1
- package/dist/views/Request/Request.vue2.js +39 -38
- package/dist/views/Request/RequestSection/RequestAuth/DeleteRequestAuthModal.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/DeleteRequestAuthModal.vue.js +12 -12
- package/dist/views/Request/RequestSidebar.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebar.vue.js +4 -4
- package/dist/views/Request/RequestSidebar.vue2.js +107 -102
- package/dist/views/Request/RequestSidebarItem.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebarItem.vue.js +1 -1
- package/dist/views/Request/RequestSidebarItem.vue2.js +165 -135
- package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts +3 -1
- package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebarItemMenu.vue.js +4 -4
- package/dist/views/Request/RequestSidebarItemMenu.vue2.js +96 -71
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/dist/views/Request/hooks/useOpenApiWatcher.d.ts +9 -0
- package/dist/views/Request/hooks/useOpenApiWatcher.d.ts.map +1 -0
- package/dist/views/Request/hooks/useOpenApiWatcher.js +86 -0
- package/dist/views/Request/libs/live-sync.d.ts +59 -0
- package/dist/views/Request/libs/live-sync.d.ts.map +1 -0
- package/dist/views/Request/libs/live-sync.js +289 -0
- package/dist/views/Request/types/sidebar-item.d.ts +2 -0
- package/dist/views/Request/types/sidebar-item.d.ts.map +1 -1
- package/package.json +10 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @scalar/api-client
|
|
2
2
|
|
|
3
|
+
## 2.1.27
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4e50d65: feat: added openapi watcher to live update the api client
|
|
8
|
+
- 4e50d65: feat: adds watch toggle in request sidebar item menu
|
|
9
|
+
- Updated dependencies [4e50d65]
|
|
10
|
+
- Updated dependencies [4e50d65]
|
|
11
|
+
- Updated dependencies [4e50d65]
|
|
12
|
+
- Updated dependencies [4e50d65]
|
|
13
|
+
- Updated dependencies [4e50d65]
|
|
14
|
+
- Updated dependencies [6bbb815]
|
|
15
|
+
- @scalar/components@0.12.56
|
|
16
|
+
- @scalar/oas-utils@0.2.59
|
|
17
|
+
- @scalar/themes@0.9.40
|
|
18
|
+
- @scalar/use-codemirror@0.11.23
|
|
19
|
+
|
|
3
20
|
## 2.1.26
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandPaletteImport.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteImport.vue"],"names":[],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"CommandPaletteImport.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteImport.vue"],"names":[],"mappings":";;;;;;;AA6sBA,wBASG"}
|
|
@@ -1,133 +1,193 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useLoadingState as
|
|
3
|
-
import { useToasts as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { getOpenApiDocumentDetails as
|
|
7
|
-
import { isUrl as
|
|
8
|
-
import { useFileDialog as
|
|
9
|
-
import { useWorkspace as
|
|
10
|
-
const
|
|
1
|
+
import { defineComponent as M, ref as U, computed as w, watch as O, openBlock as a, createBlock as h, unref as l, withCtx as c, createElementVNode as d, createVNode as f, createTextVNode as n, normalizeClass as V, createElementBlock as i, Fragment as g, toDisplayString as _, createCommentVNode as N } from "vue";
|
|
2
|
+
import { useLoadingState as $, ScalarButton as F, ScalarIcon as L, ScalarTooltip as j, ScalarToggle as E, ScalarCodeBlock as J } from "@scalar/components";
|
|
3
|
+
import { useToasts as Y } from "@scalar/use-toasts";
|
|
4
|
+
import q from "./CommandActionForm.vue.js";
|
|
5
|
+
import G from "./CommandActionInput.vue.js";
|
|
6
|
+
import { getOpenApiDocumentDetails as H } from "../../libs/getOpenApiDocumentDetails.js";
|
|
7
|
+
import { isUrl as k } from "../../libs/isUrl.js";
|
|
8
|
+
import { useFileDialog as K } from "../../hooks/useFileDialog.js";
|
|
9
|
+
import { useWorkspace as Q } from "../../store/store.js";
|
|
10
|
+
const X = { class: "flex justify-between" }, Z = { class: "flex flex-row items-center justify-between gap-3 w-full" }, ee = { class: "grid gap-1.5 pointer-events-none max-w-[320px] w-content shadow-lg rounded bg-b-1 z-100 p-2 text-xxs leading-5 z-10 text-c-1" }, te = { class: "flex items-center text-c-2" }, oe = { key: 0 }, ae = {
|
|
11
|
+
key: 1,
|
|
12
|
+
class: "text-pretty"
|
|
13
|
+
}, ve = /* @__PURE__ */ M({
|
|
11
14
|
__name: "CommandPaletteImport",
|
|
12
15
|
emits: ["close", "back"],
|
|
13
|
-
setup(
|
|
14
|
-
const
|
|
15
|
-
() =>
|
|
16
|
-
),
|
|
17
|
-
() =>
|
|
18
|
-
),
|
|
19
|
-
onChange: async (
|
|
20
|
-
const e =
|
|
16
|
+
setup(le, { emit: A }) {
|
|
17
|
+
const b = A, { activeWorkspace: x, importSpecFile: C, importSpecFromUrl: D } = Q(), { toast: m } = Y(), u = $(), t = U(""), p = U(!0), r = w(
|
|
18
|
+
() => H(t.value)
|
|
19
|
+
), S = w(
|
|
20
|
+
() => r.value ? r.value.type : "json"
|
|
21
|
+
), v = w(() => k(t.value)), R = w(() => !!r.value), { open: z } = K({
|
|
22
|
+
onChange: async (o) => {
|
|
23
|
+
const e = o == null ? void 0 : o[0];
|
|
21
24
|
if (e) {
|
|
22
|
-
const
|
|
23
|
-
|
|
25
|
+
const s = new FileReader();
|
|
26
|
+
s.onload = async (T) => {
|
|
24
27
|
var I;
|
|
25
|
-
const
|
|
28
|
+
const W = (I = T.target) == null ? void 0 : I.result;
|
|
26
29
|
try {
|
|
27
|
-
await
|
|
28
|
-
} catch (
|
|
29
|
-
console.error(
|
|
30
|
-
const
|
|
31
|
-
|
|
30
|
+
await C(W, x.value.uid), m("Import successful", "info"), b("close");
|
|
31
|
+
} catch (y) {
|
|
32
|
+
console.error(y);
|
|
33
|
+
const B = (y == null ? void 0 : y.message) || "Unknown error";
|
|
34
|
+
m(`Import failed: ${B}`, "error");
|
|
32
35
|
}
|
|
33
|
-
},
|
|
36
|
+
}, s.readAsText(e);
|
|
34
37
|
}
|
|
35
38
|
},
|
|
36
39
|
multiple: !1,
|
|
37
40
|
accept: ".json,.yaml,.yml"
|
|
38
41
|
});
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
O(v, (o) => {
|
|
43
|
+
o || (p.value = !1);
|
|
44
|
+
}), O(t, (o) => {
|
|
45
|
+
k(o) || (p.value = !1);
|
|
46
|
+
});
|
|
47
|
+
async function P() {
|
|
48
|
+
if (!(!t.value || u.isLoading)) {
|
|
49
|
+
u.startLoading();
|
|
42
50
|
try {
|
|
43
|
-
if (
|
|
44
|
-
await
|
|
51
|
+
if (v.value) {
|
|
52
|
+
const [o] = await D(
|
|
45
53
|
t.value,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
54
|
+
x.value.uid,
|
|
55
|
+
{
|
|
56
|
+
proxy: x.value.proxyUrl,
|
|
57
|
+
watchForChanges: p.value
|
|
58
|
+
}
|
|
49
59
|
);
|
|
50
|
-
|
|
51
|
-
|
|
60
|
+
if (o) {
|
|
61
|
+
m(
|
|
62
|
+
"There was a possible CORS error while importing your spec, please make sure this server is allowed in the CORS policy of your OpenAPI document.",
|
|
63
|
+
"error",
|
|
64
|
+
{ timeout: 5e3 }
|
|
65
|
+
), u.invalidate(2e3, !0);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
} else if (R.value)
|
|
69
|
+
await C(
|
|
52
70
|
String(t.value),
|
|
53
|
-
|
|
71
|
+
x.value.uid
|
|
54
72
|
);
|
|
55
73
|
else {
|
|
56
|
-
|
|
74
|
+
m("Import failed: Invalid URL or OpenAPI document", "error"), u.invalidate(2e3, !0);
|
|
57
75
|
return;
|
|
58
76
|
}
|
|
59
|
-
|
|
60
|
-
} catch (
|
|
61
|
-
console.error("[importCollection]",
|
|
62
|
-
const e = (
|
|
63
|
-
|
|
77
|
+
u.clear(), b("close"), m("Import successful", "info");
|
|
78
|
+
} catch (o) {
|
|
79
|
+
console.error("[importCollection]", o);
|
|
80
|
+
const e = (o == null ? void 0 : o.message) || "Unknown error";
|
|
81
|
+
u.invalidate(2e3, !0), m(`Import failed: ${e}`, "error");
|
|
64
82
|
}
|
|
65
83
|
}
|
|
66
84
|
}
|
|
67
|
-
return (
|
|
85
|
+
return (o, e) => (a(), h(q, {
|
|
68
86
|
disabled: !t.value.trim(),
|
|
69
|
-
loading:
|
|
70
|
-
onSubmit:
|
|
87
|
+
loading: l(u),
|
|
88
|
+
onSubmit: P
|
|
71
89
|
}, {
|
|
72
|
-
options:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
90
|
+
options: c(() => [
|
|
91
|
+
d("div", Z, [
|
|
92
|
+
f(l(F), {
|
|
93
|
+
class: "p-2 max-h-8 gap-1.5 text-xs hover:bg-b-2 relative",
|
|
94
|
+
variant: "outlined",
|
|
95
|
+
onClick: l(z)
|
|
96
|
+
}, {
|
|
97
|
+
default: c(() => [
|
|
98
|
+
e[6] || (e[6] = n(" JSON, or YAML File ")),
|
|
99
|
+
f(l(L), {
|
|
100
|
+
class: "text-c-3",
|
|
101
|
+
icon: "UploadSimple",
|
|
102
|
+
size: "md"
|
|
103
|
+
})
|
|
104
|
+
]),
|
|
105
|
+
_: 1
|
|
106
|
+
}, 8, ["onClick"]),
|
|
107
|
+
f(l(j), {
|
|
108
|
+
as: "div",
|
|
109
|
+
class: "z-[10001]",
|
|
110
|
+
side: "bottom",
|
|
111
|
+
sideOffset: 5
|
|
112
|
+
}, {
|
|
113
|
+
trigger: c(() => [
|
|
114
|
+
d("label", {
|
|
115
|
+
class: V([
|
|
116
|
+
"p-3 py-1.5 rounded flex items-center text-sm text-c-2 gap-2 select-none",
|
|
117
|
+
t.value && !v.value ? "cursor-default" : "cursor-pointer"
|
|
118
|
+
]),
|
|
119
|
+
for: "watch-toggle"
|
|
120
|
+
}, [
|
|
121
|
+
d("span", {
|
|
122
|
+
class: V(["text-c-1 flex gap-1 items-center font-medium text-xs", { "text-c-3": !p.value }])
|
|
123
|
+
}, [
|
|
124
|
+
f(l(L), {
|
|
125
|
+
icon: "Watch",
|
|
126
|
+
size: "sm"
|
|
127
|
+
}),
|
|
128
|
+
e[7] || (e[7] = n(" Watch Mode "))
|
|
129
|
+
], 2),
|
|
130
|
+
f(l(E), {
|
|
131
|
+
id: "watch-toggle",
|
|
132
|
+
modelValue: p.value,
|
|
133
|
+
"onUpdate:modelValue": e[3] || (e[3] = (s) => p.value = s),
|
|
134
|
+
disabled: !!t.value && !v.value
|
|
135
|
+
}, null, 8, ["modelValue", "disabled"])
|
|
136
|
+
], 2)
|
|
137
|
+
]),
|
|
138
|
+
content: c(() => [
|
|
139
|
+
d("div", ee, [
|
|
140
|
+
d("div", te, [
|
|
141
|
+
t.value && !v.value ? (a(), i("span", oe, "Watch Mode is only supported with URL")) : (a(), i("span", ae, "Watch your OpenAPI URL for changes. Enabled it will update the API client for you."))
|
|
142
|
+
])
|
|
143
|
+
])
|
|
144
|
+
]),
|
|
145
|
+
_: 1
|
|
146
|
+
})
|
|
147
|
+
])
|
|
88
148
|
]),
|
|
89
|
-
submit:
|
|
90
|
-
e[
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
], 64)) :
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
], 64)) : (
|
|
97
|
-
|
|
149
|
+
submit: c(() => [
|
|
150
|
+
e[8] || (e[8] = n(" Import ")),
|
|
151
|
+
v.value ? (a(), i(g, { key: 0 }, [
|
|
152
|
+
n(" from URL ")
|
|
153
|
+
], 64)) : r.value && S.value ? (a(), i(g, { key: 1 }, [
|
|
154
|
+
r.value.title ? (a(), i(g, { key: 0 }, [
|
|
155
|
+
n(' "' + _(r.value.title) + '" ', 1)
|
|
156
|
+
], 64)) : (a(), i(g, { key: 1 }, [
|
|
157
|
+
n(_(r.value.version) + " Spec", 1)
|
|
98
158
|
], 64))
|
|
99
|
-
], 64)) : (
|
|
100
|
-
|
|
159
|
+
], 64)) : (a(), i(g, { key: 2 }, [
|
|
160
|
+
n("Collection")
|
|
101
161
|
], 64))
|
|
102
162
|
]),
|
|
103
|
-
default:
|
|
104
|
-
!
|
|
163
|
+
default: c(() => [
|
|
164
|
+
!r.value || l(k)(t.value) ? (a(), h(G, {
|
|
105
165
|
key: 0,
|
|
106
166
|
modelValue: t.value,
|
|
107
|
-
"onUpdate:modelValue": e[0] || (e[0] = (
|
|
167
|
+
"onUpdate:modelValue": e[0] || (e[0] = (s) => t.value = s),
|
|
108
168
|
placeholder: "OpenAPI/Swagger URL or document",
|
|
109
|
-
onOnDelete: e[1] || (e[1] = (
|
|
110
|
-
}, null, 8, ["modelValue"])) : (
|
|
111
|
-
|
|
112
|
-
e[
|
|
113
|
-
|
|
169
|
+
onOnDelete: e[1] || (e[1] = (s) => b("back", s))
|
|
170
|
+
}, null, 8, ["modelValue"])) : (a(), i(g, { key: 1 }, [
|
|
171
|
+
d("div", X, [
|
|
172
|
+
e[5] || (e[5] = d("div", { class: "pl-8 text-xs min-h-8 py-2 text-c-2" }, "Preview", -1)),
|
|
173
|
+
f(l(F), {
|
|
114
174
|
class: "ml-auto p-2 max-h-8 gap-1.5 text-xs hover:bg-b-2 relative",
|
|
115
175
|
variant: "ghost",
|
|
116
|
-
onClick: e[2] || (e[2] = (
|
|
176
|
+
onClick: e[2] || (e[2] = (s) => t.value = "")
|
|
117
177
|
}, {
|
|
118
|
-
default:
|
|
119
|
-
|
|
178
|
+
default: c(() => e[4] || (e[4] = [
|
|
179
|
+
n(" Clear ")
|
|
120
180
|
])),
|
|
121
181
|
_: 1
|
|
122
182
|
})
|
|
123
183
|
]),
|
|
124
|
-
|
|
184
|
+
r.value && !l(k)(t.value) ? (a(), h(l(J), {
|
|
125
185
|
key: 0,
|
|
126
186
|
class: "border max-h-[40dvh] mt-1 bg-b-2 rounded [--scalar-small:--scalar-font-size-4]",
|
|
127
187
|
content: t.value,
|
|
128
188
|
copy: !1,
|
|
129
|
-
lang:
|
|
130
|
-
}, null, 8, ["content", "lang"])) :
|
|
189
|
+
lang: S.value
|
|
190
|
+
}, null, 8, ["content", "lang"])) : N("", !0)
|
|
131
191
|
], 64))
|
|
132
192
|
]),
|
|
133
193
|
_: 1
|
|
@@ -135,5 +195,5 @@ const q = { class: "flex justify-between" }, le = /* @__PURE__ */ P({
|
|
|
135
195
|
}
|
|
136
196
|
});
|
|
137
197
|
export {
|
|
138
|
-
|
|
198
|
+
ve as default
|
|
139
199
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImportNowButton.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ImportCollection/ImportNowButton.vue"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"ImportNowButton.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ImportCollection/ImportNowButton.vue"],"names":[],"mappings":";aA2GW,MAAM,GAAG,IAAI;cACZ,QAAQ,GAAG,MAAM;;;;aADlB,MAAM,GAAG,IAAI;cACZ,QAAQ,GAAG,MAAM;;;;AAgL7B,wBASG"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as b, openBlock as s, createElementBlock as v, Fragment as w, createBlock as m, unref as a, withCtx as p, createTextVNode as c, createCommentVNode as g } from "vue";
|
|
2
2
|
import { isUrl as h } from "./utils/isUrl.js";
|
|
3
3
|
import { ScalarButton as l } from "@scalar/components";
|
|
4
4
|
import { useToasts as F } from "@scalar/use-toasts";
|
|
5
5
|
import { useRouter as B } from "vue-router";
|
|
6
6
|
import { useWorkspace as I } from "../../store/store.js";
|
|
7
|
-
const R = /* @__PURE__ */
|
|
7
|
+
const R = /* @__PURE__ */ b({
|
|
8
8
|
__name: "ImportNowButton",
|
|
9
9
|
props: {
|
|
10
10
|
source: {},
|
|
@@ -12,20 +12,18 @@ const R = /* @__PURE__ */ x({
|
|
|
12
12
|
},
|
|
13
13
|
emits: ["importFinished"],
|
|
14
14
|
setup(f, { emit: d }) {
|
|
15
|
-
const o = f, k = d, y = B(), { importSpecFromUrl:
|
|
15
|
+
const o = f, k = d, y = B(), { importSpecFromUrl: C, importSpecFile: x, activeWorkspace: r } = I(), { toast: i } = F();
|
|
16
16
|
async function n() {
|
|
17
17
|
try {
|
|
18
18
|
if (o.source) {
|
|
19
19
|
if (h(o.source)) {
|
|
20
|
-
const t = await
|
|
20
|
+
const [t, e] = await C(
|
|
21
21
|
o.source,
|
|
22
|
-
void 0,
|
|
23
|
-
void 0,
|
|
24
22
|
r.value.uid
|
|
25
23
|
);
|
|
26
|
-
u(
|
|
24
|
+
t || u(e);
|
|
27
25
|
} else {
|
|
28
|
-
const t = await
|
|
26
|
+
const t = await x(
|
|
29
27
|
o.source,
|
|
30
28
|
r.value.uid
|
|
31
29
|
);
|
|
@@ -48,7 +46,7 @@ const R = /* @__PURE__ */ x({
|
|
|
48
46
|
}
|
|
49
47
|
});
|
|
50
48
|
}
|
|
51
|
-
return (t, e) => t.source ? (s(),
|
|
49
|
+
return (t, e) => t.source ? (s(), v(w, { key: 0 }, [
|
|
52
50
|
t.variant === "button" ? (s(), m(a(l), {
|
|
53
51
|
key: 0,
|
|
54
52
|
class: "text-[21px] py-2.5 px-6 rounded-lg font-bold h-fit mt-3 mb-1.5",
|