@scalar/api-client 2.2.7 → 2.2.8
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 +6 -0
- package/dist/components/CommandPalette/CommandPaletteImport.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPaletteImport.vue.js +108 -106
- package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts +1 -1
- package/dist/components/CommandPalette/TheCommandPalette.vue.js +2 -2
- package/dist/components/CommandPalette/TheCommandPalette.vue2.js +12 -12
- package/dist/libs/index.d.ts +1 -0
- package/dist/libs/index.d.ts.map +1 -1
- package/dist/libs/index.js +28 -24
- package/dist/libs/postman.d.ts +11 -0
- package/dist/libs/postman.d.ts.map +1 -0
- package/dist/libs/postman.js +39 -0
- package/dist/style.css +1 -1
- 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 +32 -30
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -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":";;;;;;;AA2pBA,wBAOG"}
|
|
@@ -1,42 +1,44 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useActiveEntities as
|
|
3
|
-
import { useLoadingState as
|
|
4
|
-
import { useToasts as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
1
|
+
import { defineComponent as B, ref as _, computed as k, watch as A, openBlock as a, createBlock as C, unref as s, withCtx as c, createElementVNode as g, createVNode as y, createTextVNode as m, createElementBlock as r, Fragment as p, toDisplayString as O, createCommentVNode as N } from "vue";
|
|
2
|
+
import { useActiveEntities as j } from "../../store/active-entities.js";
|
|
3
|
+
import { useLoadingState as E, ScalarButton as D, ScalarIcon as W, ScalarTooltip as J, ScalarCodeBlock as Y } from "@scalar/components";
|
|
4
|
+
import { useToasts as q } from "@scalar/use-toasts";
|
|
5
|
+
import G from "./CommandActionForm.vue.js";
|
|
6
|
+
import H from "./CommandActionInput.vue.js";
|
|
7
|
+
import K from "./WatchModeToggle.vue.js";
|
|
8
|
+
import { isPostmanCollection as S, getPostmanDocumentDetails as Q, convertPostmanToOpenApi as L } from "../../libs/postman.js";
|
|
9
|
+
import { getOpenApiDocumentDetails as X } from "../../libs/getOpenApiDocumentDetails.js";
|
|
10
|
+
import { isUrl as b } from "../../libs/isUrl.js";
|
|
11
|
+
import { useFileDialog as Z } from "../../hooks/useFileDialog.js";
|
|
12
|
+
import { useWorkspace as ee } from "../../store/store.js";
|
|
13
|
+
const te = { class: "flex justify-between" }, oe = { class: "flex flex-row items-center justify-between gap-3 w-full" }, ae = { 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" }, le = { class: "flex items-center text-c-2" }, ne = {
|
|
13
14
|
key: 0,
|
|
14
15
|
class: "text-pretty"
|
|
15
|
-
},
|
|
16
|
+
}, se = {
|
|
16
17
|
key: 1,
|
|
17
18
|
class: "text-pretty"
|
|
18
|
-
},
|
|
19
|
+
}, ke = /* @__PURE__ */ B({
|
|
19
20
|
__name: "CommandPaletteImport",
|
|
20
21
|
emits: ["close", "back"],
|
|
21
|
-
setup(
|
|
22
|
-
const
|
|
23
|
-
() => H(o.value)
|
|
24
|
-
), S = k(
|
|
22
|
+
setup(re, { emit: V }) {
|
|
23
|
+
const h = V, { activeWorkspace: d } = j(), { importSpecFile: x, importSpecFromUrl: R } = ee(), { toast: i } = q(), u = E(), t = _(""), v = _(!0), l = k(() => S(t.value) ? Q(t.value) : X(t.value)), U = k(
|
|
25
24
|
() => l.value ? l.value.type : "json"
|
|
26
|
-
),
|
|
27
|
-
onChange: async (
|
|
28
|
-
const e =
|
|
25
|
+
), f = k(() => b(t.value)), F = k(() => !!l.value), { open: T } = Z({
|
|
26
|
+
onChange: async (o) => {
|
|
27
|
+
const e = o == null ? void 0 : o[0];
|
|
29
28
|
if (e) {
|
|
30
29
|
const n = new FileReader();
|
|
31
|
-
n.onload = async (
|
|
32
|
-
var
|
|
33
|
-
const
|
|
30
|
+
n.onload = async ($) => {
|
|
31
|
+
var P;
|
|
32
|
+
const I = (P = $.target) == null ? void 0 : P.result;
|
|
34
33
|
try {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
S(I) ? await x(
|
|
35
|
+
await L(I),
|
|
36
|
+
d.value.uid
|
|
37
|
+
) : await x(I, d.value.uid), i("Import successful", "info"), h("close");
|
|
38
|
+
} catch (w) {
|
|
39
|
+
console.error(w);
|
|
40
|
+
const z = (w == null ? void 0 : w.message) || "Unknown error";
|
|
41
|
+
i(`Import failed: ${z}`, "error");
|
|
40
42
|
}
|
|
41
43
|
}, n.readAsText(e);
|
|
42
44
|
}
|
|
@@ -44,64 +46,64 @@ const X = { class: "flex justify-between" }, Z = { class: "flex flex-row items-c
|
|
|
44
46
|
multiple: !1,
|
|
45
47
|
accept: ".json,.yaml,.yml"
|
|
46
48
|
});
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}),
|
|
50
|
-
|
|
49
|
+
A(f, (o) => {
|
|
50
|
+
o || (v.value = !1);
|
|
51
|
+
}), A(t, (o) => {
|
|
52
|
+
b(o) || (v.value = !1);
|
|
51
53
|
});
|
|
52
|
-
async function
|
|
53
|
-
if (!(!
|
|
54
|
-
|
|
54
|
+
async function M() {
|
|
55
|
+
if (!(!t.value || u.isLoading)) {
|
|
56
|
+
u.startLoading();
|
|
55
57
|
try {
|
|
56
|
-
if (
|
|
57
|
-
const [
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
if (f.value) {
|
|
59
|
+
const [o] = await R(
|
|
60
|
+
t.value,
|
|
61
|
+
d.value.uid,
|
|
60
62
|
{
|
|
61
|
-
proxyUrl:
|
|
62
|
-
watchMode:
|
|
63
|
+
proxyUrl: d.value.proxyUrl,
|
|
64
|
+
watchMode: v.value
|
|
63
65
|
}
|
|
64
66
|
);
|
|
65
|
-
if (
|
|
66
|
-
|
|
67
|
+
if (o) {
|
|
68
|
+
i(
|
|
67
69
|
"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.",
|
|
68
70
|
"error",
|
|
69
71
|
{ timeout: 5e3 }
|
|
70
|
-
),
|
|
72
|
+
), u.invalidate(2e3, !0);
|
|
71
73
|
return;
|
|
72
74
|
}
|
|
73
|
-
} else if (
|
|
74
|
-
await
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
);
|
|
75
|
+
} else if (F.value)
|
|
76
|
+
S(t.value) ? (await x(
|
|
77
|
+
await L(t.value),
|
|
78
|
+
d.value.uid
|
|
79
|
+
), i("Successfully converted Postman collection", "info")) : await x(t.value, d.value.uid);
|
|
78
80
|
else {
|
|
79
|
-
|
|
81
|
+
i("Import failed: Invalid URL or OpenAPI document", "error"), u.invalidate(2e3, !0);
|
|
80
82
|
return;
|
|
81
83
|
}
|
|
82
|
-
|
|
83
|
-
} catch (
|
|
84
|
-
console.error("[importCollection]",
|
|
85
|
-
const e = (
|
|
86
|
-
|
|
84
|
+
u.clear(), h("close"), i("Import successful", "info");
|
|
85
|
+
} catch (o) {
|
|
86
|
+
console.error("[importCollection]", o);
|
|
87
|
+
const e = (o == null ? void 0 : o.message) || "Unknown error";
|
|
88
|
+
u.invalidate(2e3, !0), i(`Import failed: ${e}`, "error");
|
|
87
89
|
}
|
|
88
90
|
}
|
|
89
91
|
}
|
|
90
|
-
return (
|
|
91
|
-
disabled: !
|
|
92
|
-
loading:
|
|
93
|
-
onSubmit:
|
|
92
|
+
return (o, e) => (a(), C(G, {
|
|
93
|
+
disabled: !t.value.trim(),
|
|
94
|
+
loading: s(u),
|
|
95
|
+
onSubmit: M
|
|
94
96
|
}, {
|
|
95
|
-
options:
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
options: c(() => [
|
|
98
|
+
g("div", oe, [
|
|
99
|
+
y(s(D), {
|
|
98
100
|
class: "p-2 max-h-8 gap-1.5 text-xs hover:bg-b-2 relative",
|
|
99
101
|
variant: "outlined",
|
|
100
|
-
onClick:
|
|
102
|
+
onClick: s(T)
|
|
101
103
|
}, {
|
|
102
|
-
default:
|
|
103
|
-
e[6] || (e[6] =
|
|
104
|
-
|
|
104
|
+
default: c(() => [
|
|
105
|
+
e[6] || (e[6] = m(" JSON, or YAML File ")),
|
|
106
|
+
y(s(W), {
|
|
105
107
|
class: "text-c-3",
|
|
106
108
|
icon: "UploadSimple",
|
|
107
109
|
size: "md"
|
|
@@ -109,23 +111,23 @@ const X = { class: "flex justify-between" }, Z = { class: "flex flex-row items-c
|
|
|
109
111
|
]),
|
|
110
112
|
_: 1
|
|
111
113
|
}, 8, ["onClick"]),
|
|
112
|
-
|
|
114
|
+
y(s(J), {
|
|
113
115
|
as: "div",
|
|
114
116
|
class: "z-[10001]",
|
|
115
117
|
side: "bottom",
|
|
116
118
|
sideOffset: 5
|
|
117
119
|
}, {
|
|
118
|
-
trigger:
|
|
119
|
-
|
|
120
|
-
modelValue:
|
|
121
|
-
"onUpdate:modelValue": e[3] || (e[3] = (n) =>
|
|
122
|
-
disabled: !
|
|
120
|
+
trigger: c(() => [
|
|
121
|
+
y(K, {
|
|
122
|
+
modelValue: v.value,
|
|
123
|
+
"onUpdate:modelValue": e[3] || (e[3] = (n) => v.value = n),
|
|
124
|
+
disabled: !f.value
|
|
123
125
|
}, null, 8, ["modelValue", "disabled"])
|
|
124
126
|
]),
|
|
125
|
-
content:
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
content: c(() => [
|
|
128
|
+
g("div", ae, [
|
|
129
|
+
g("div", le, [
|
|
130
|
+
f.value ? (a(), r("span", ne, " Automatically updates the API client when the OpenAPI URL content changes, ensuring your client remains up-to-date. ")) : (a(), r("span", se, " Watch Mode is only available for URL imports. It automatically updates the API client when the OpenAPI URL content changes. "))
|
|
129
131
|
])
|
|
130
132
|
])
|
|
131
133
|
]),
|
|
@@ -133,48 +135,48 @@ const X = { class: "flex justify-between" }, Z = { class: "flex flex-row items-c
|
|
|
133
135
|
})
|
|
134
136
|
])
|
|
135
137
|
]),
|
|
136
|
-
submit:
|
|
137
|
-
e[7] || (e[7] =
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
], 64)) : l.value &&
|
|
141
|
-
l.value.title ? (a(),
|
|
142
|
-
|
|
143
|
-
], 64)) : (a(),
|
|
144
|
-
|
|
138
|
+
submit: c(() => [
|
|
139
|
+
e[7] || (e[7] = m(" Import ")),
|
|
140
|
+
f.value ? (a(), r(p, { key: 0 }, [
|
|
141
|
+
m(" from URL ")
|
|
142
|
+
], 64)) : l.value && U.value ? (a(), r(p, { key: 1 }, [
|
|
143
|
+
l.value.title ? (a(), r(p, { key: 0 }, [
|
|
144
|
+
m(' "' + O(l.value.title) + '" ', 1)
|
|
145
|
+
], 64)) : (a(), r(p, { key: 1 }, [
|
|
146
|
+
m(O(l.value.version) + " Spec", 1)
|
|
145
147
|
], 64))
|
|
146
|
-
], 64)) : (a(),
|
|
147
|
-
|
|
148
|
+
], 64)) : (a(), r(p, { key: 2 }, [
|
|
149
|
+
m("Collection")
|
|
148
150
|
], 64))
|
|
149
151
|
]),
|
|
150
|
-
default:
|
|
151
|
-
!l.value ||
|
|
152
|
+
default: c(() => [
|
|
153
|
+
!l.value || s(b)(t.value) ? (a(), C(H, {
|
|
152
154
|
key: 0,
|
|
153
|
-
modelValue:
|
|
154
|
-
"onUpdate:modelValue": e[0] || (e[0] = (n) =>
|
|
155
|
-
placeholder: "OpenAPI/Swagger URL or document",
|
|
156
|
-
onOnDelete: e[1] || (e[1] = (n) =>
|
|
157
|
-
}, null, 8, ["modelValue"])) : (a(),
|
|
158
|
-
|
|
159
|
-
e[5] || (e[5] =
|
|
160
|
-
|
|
155
|
+
modelValue: t.value,
|
|
156
|
+
"onUpdate:modelValue": e[0] || (e[0] = (n) => t.value = n),
|
|
157
|
+
placeholder: "OpenAPI/Swagger/Postman URL or document",
|
|
158
|
+
onOnDelete: e[1] || (e[1] = (n) => h("back", n))
|
|
159
|
+
}, null, 8, ["modelValue"])) : (a(), r(p, { key: 1 }, [
|
|
160
|
+
g("div", te, [
|
|
161
|
+
e[5] || (e[5] = g("div", { class: "pl-8 text-xs min-h-8 py-2 text-c-2" }, "Preview", -1)),
|
|
162
|
+
y(s(D), {
|
|
161
163
|
class: "ml-auto p-2 max-h-8 gap-1.5 text-xs hover:bg-b-2 relative",
|
|
162
164
|
variant: "ghost",
|
|
163
|
-
onClick: e[2] || (e[2] = (n) =>
|
|
165
|
+
onClick: e[2] || (e[2] = (n) => t.value = "")
|
|
164
166
|
}, {
|
|
165
|
-
default:
|
|
166
|
-
|
|
167
|
+
default: c(() => e[4] || (e[4] = [
|
|
168
|
+
m(" Clear ")
|
|
167
169
|
])),
|
|
168
170
|
_: 1
|
|
169
171
|
})
|
|
170
172
|
]),
|
|
171
|
-
l.value && !
|
|
173
|
+
l.value && !s(b)(t.value) ? (a(), C(s(Y), {
|
|
172
174
|
key: 0,
|
|
173
175
|
class: "border max-h-[40dvh] mt-1 bg-b-2 rounded [--scalar-small:--scalar-font-size-4]",
|
|
174
|
-
content:
|
|
176
|
+
content: t.value,
|
|
175
177
|
copy: !1,
|
|
176
|
-
lang:
|
|
177
|
-
}, null, 8, ["content", "lang"])) :
|
|
178
|
+
lang: U.value
|
|
179
|
+
}, null, 8, ["content", "lang"])) : N("", !0)
|
|
178
180
|
], 64))
|
|
179
181
|
]),
|
|
180
182
|
_: 1
|
|
@@ -182,5 +184,5 @@ const X = { class: "flex justify-between" }, Z = { class: "flex flex-row items-c
|
|
|
182
184
|
}
|
|
183
185
|
});
|
|
184
186
|
export {
|
|
185
|
-
|
|
187
|
+
ke as default
|
|
186
188
|
};
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
7
7
|
export default _default;
|
|
8
8
|
export declare const PaletteComponents: {
|
|
9
|
-
readonly 'Import from OpenAPI/Swagger': import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
9
|
+
readonly 'Import from OpenAPI/Swagger/Postman': import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
10
10
|
close: () => any;
|
|
11
11
|
back: (e: KeyboardEvent) => any;
|
|
12
12
|
}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
|
|
@@ -2,8 +2,8 @@ import o from "./TheCommandPalette.vue2.js";
|
|
|
2
2
|
import { PaletteComponents as s } from "./TheCommandPalette.vue2.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
5
|
-
const
|
|
5
|
+
const a = /* @__PURE__ */ t(o, [["__scopeId", "data-v-c09436db"]]);
|
|
6
6
|
export {
|
|
7
7
|
s as PaletteComponents,
|
|
8
|
-
|
|
8
|
+
a as default
|
|
9
9
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as q, ref as i, computed as T, watch as F, onMounted as G, onBeforeUnmount as Q, openBlock as a, createBlock as z, unref as r, withCtx as y, createElementVNode as u, createVNode as p, createTextVNode as K, createElementBlock as m, withDirectives as M, withKeys as w, withModifiers as g, vModelText as j, Fragment as
|
|
2
|
-
import { useModal as oe, ScalarIcon as
|
|
1
|
+
import { defineComponent as q, ref as i, computed as T, watch as F, onMounted as G, onBeforeUnmount as Q, openBlock as a, createBlock as z, unref as r, withCtx as y, createElementVNode as u, createVNode as p, createTextVNode as K, createElementBlock as m, withDirectives as M, withKeys as w, withModifiers as g, vModelText as j, Fragment as P, renderList as B, toDisplayString as N, vShow as J, normalizeClass as X, createCommentVNode as Y, resolveDynamicComponent as Z, mergeProps as ee, nextTick as V } from "vue";
|
|
2
|
+
import { useModal as oe, ScalarIcon as A } from "@scalar/components";
|
|
3
3
|
import { Dialog as te, DialogPanel as ne, DialogTitle as ae } from "@headlessui/vue";
|
|
4
4
|
import { useRouter as le } from "vue-router";
|
|
5
5
|
import { ROUTES as se } from "../../constants.js";
|
|
@@ -24,7 +24,7 @@ const he = {
|
|
|
24
24
|
}, we = {
|
|
25
25
|
name: "TheCommandPalette"
|
|
26
26
|
}, ge = {
|
|
27
|
-
"Import from OpenAPI/Swagger": ie,
|
|
27
|
+
"Import from OpenAPI/Swagger/Postman": ie,
|
|
28
28
|
"Create Request": ue,
|
|
29
29
|
"Create Workspace": fe,
|
|
30
30
|
"Add Tag": pe,
|
|
@@ -33,8 +33,8 @@ const he = {
|
|
|
33
33
|
"Add Example": ce
|
|
34
34
|
}, Ve = /* @__PURE__ */ q({
|
|
35
35
|
...we,
|
|
36
|
-
setup(
|
|
37
|
-
const
|
|
36
|
+
setup(Pe) {
|
|
37
|
+
const S = [
|
|
38
38
|
{
|
|
39
39
|
label: "",
|
|
40
40
|
commands: [
|
|
@@ -43,7 +43,7 @@ const he = {
|
|
|
43
43
|
icon: "ExternalLink"
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
|
-
name: "Import from OpenAPI/Swagger",
|
|
46
|
+
name: "Import from OpenAPI/Swagger/Postman",
|
|
47
47
|
icon: "Import"
|
|
48
48
|
},
|
|
49
49
|
{
|
|
@@ -92,7 +92,7 @@ const he = {
|
|
|
92
92
|
}))
|
|
93
93
|
}
|
|
94
94
|
], d = oe(), { push: W } = le(), { activeWorkspace: H } = re(), { events: f } = ve(), x = i(), l = i(""), s = i(null), c = i(-1), D = i([]), v = T(
|
|
95
|
-
() =>
|
|
95
|
+
() => S.reduce((e, o) => {
|
|
96
96
|
const t = o.commands.filter(
|
|
97
97
|
(n) => n.name.toLowerCase().includes(l.value.toLowerCase())
|
|
98
98
|
);
|
|
@@ -164,7 +164,7 @@ const he = {
|
|
|
164
164
|
type: "button",
|
|
165
165
|
onClick: o[3] || (o[3] = (t) => s.value = null)
|
|
166
166
|
}, [
|
|
167
|
-
p(r(
|
|
167
|
+
p(r(A), {
|
|
168
168
|
icon: "ChevronLeft",
|
|
169
169
|
size: "md",
|
|
170
170
|
thickness: "1.5"
|
|
@@ -177,7 +177,7 @@ const he = {
|
|
|
177
177
|
])) : (a(), m("div", he, [
|
|
178
178
|
u("div", Ce, [
|
|
179
179
|
u("label", xe, [
|
|
180
|
-
p(r(
|
|
180
|
+
p(r(A), {
|
|
181
181
|
class: "text-c-2 mr-2.5",
|
|
182
182
|
icon: "Search",
|
|
183
183
|
size: "md",
|
|
@@ -203,7 +203,7 @@ const he = {
|
|
|
203
203
|
[j, l.value]
|
|
204
204
|
])
|
|
205
205
|
]),
|
|
206
|
-
(a(), m(
|
|
206
|
+
(a(), m(P, null, B(S, (t) => (a(), m(P, {
|
|
207
207
|
key: t.label
|
|
208
208
|
}, [
|
|
209
209
|
M(u("div", { class: "text-c-3 font-medium text-xs px-2 mb-1 mt-2" }, N(t.label), 513), [
|
|
@@ -214,7 +214,7 @@ const he = {
|
|
|
214
214
|
).length > 0
|
|
215
215
|
]
|
|
216
216
|
]),
|
|
217
|
-
(a(!0), m(
|
|
217
|
+
(a(!0), m(P, null, B(t.commands.filter(
|
|
218
218
|
(n) => n.name.toLowerCase().includes(l.value.toLowerCase())
|
|
219
219
|
), (n, C) => {
|
|
220
220
|
var L;
|
|
@@ -229,7 +229,7 @@ const he = {
|
|
|
229
229
|
}]),
|
|
230
230
|
onClick: (b) => $(n)
|
|
231
231
|
}, [
|
|
232
|
-
p(r(
|
|
232
|
+
p(r(A), {
|
|
233
233
|
class: "text-c-2 mr-2.5",
|
|
234
234
|
icon: n.icon,
|
|
235
235
|
size: "md",
|
package/dist/libs/index.d.ts
CHANGED
package/dist/libs/index.d.ts.map
CHANGED
|
@@ -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,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,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,6BAA6B,CAAA;AAC3C,cAAc,cAAc,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,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,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,6BAA6B,CAAA;AAC3C,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA"}
|
package/dist/libs/index.js
CHANGED
|
@@ -1,37 +1,41 @@
|
|
|
1
1
|
import { createApiClient as o } from "./create-client.js";
|
|
2
2
|
import { formatBytes as a, formatMs as m } from "./formatters.js";
|
|
3
|
-
import { ERRORS as p, normalizeError as f, prettyErrorMessage as
|
|
4
|
-
import { DEFAULT_HOTKEYS as
|
|
3
|
+
import { ERRORS as p, normalizeError as f, prettyErrorMessage as n } from "./errors.js";
|
|
4
|
+
import { DEFAULT_HOTKEYS as c, getModifiers as l, handleHotKeyDown as x } from "./hot-keys.js";
|
|
5
5
|
import { createEventBus as u } from "./event-bus.js";
|
|
6
|
-
import { formatHeaderKey as y, normalizeHeaders as
|
|
7
|
-
import { loadAllResources as
|
|
8
|
-
import { parseEnvVariables as
|
|
9
|
-
import { isUrl as
|
|
10
|
-
import { getOpenApiDocumentDetails as
|
|
11
|
-
import { parseCurlCommand as
|
|
12
|
-
import {
|
|
6
|
+
import { formatHeaderKey as y, normalizeHeaders as D } from "./normalize-headers.js";
|
|
7
|
+
import { loadAllResources as A } from "./local-storage.js";
|
|
8
|
+
import { parseEnvVariables as H } from "./environment-parser.js";
|
|
9
|
+
import { isUrl as g } from "./isUrl.js";
|
|
10
|
+
import { getOpenApiDocumentDetails as B } from "./getOpenApiDocumentDetails.js";
|
|
11
|
+
import { parseCurlCommand as P } from "./parse-curl.js";
|
|
12
|
+
import { convertPostmanToOpenApi as K, getPostmanDocumentDetails as M, isPostmanCollection as T } from "./postman.js";
|
|
13
|
+
import { createFetchBody as z, createFetchHeaders as S, createFetchQueryParams as U, createRequestOperation as b, decodeBuffer as k, setRequestCookies as w } from "./send-request/send-request.js";
|
|
13
14
|
export {
|
|
14
|
-
|
|
15
|
+
c as DEFAULT_HOTKEYS,
|
|
15
16
|
p as ERRORS,
|
|
17
|
+
K as convertPostmanToOpenApi,
|
|
16
18
|
o as createApiClient,
|
|
17
19
|
u as createEventBus,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
z as createFetchBody,
|
|
21
|
+
S as createFetchHeaders,
|
|
22
|
+
U as createFetchQueryParams,
|
|
23
|
+
b as createRequestOperation,
|
|
24
|
+
k as decodeBuffer,
|
|
23
25
|
a as formatBytes,
|
|
24
26
|
y as formatHeaderKey,
|
|
25
27
|
m as formatMs,
|
|
26
28
|
l as getModifiers,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
B as getOpenApiDocumentDetails,
|
|
30
|
+
M as getPostmanDocumentDetails,
|
|
31
|
+
x as handleHotKeyDown,
|
|
32
|
+
T as isPostmanCollection,
|
|
33
|
+
g as isUrl,
|
|
34
|
+
A as loadAllResources,
|
|
31
35
|
f as normalizeError,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
D as normalizeHeaders,
|
|
37
|
+
P as parseCurlCommand,
|
|
38
|
+
H as parseEnvVariables,
|
|
39
|
+
n as prettyErrorMessage,
|
|
40
|
+
w as setRequestCookies
|
|
37
41
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Checks if the given content is a Postman collection */
|
|
2
|
+
export declare function isPostmanCollection(content: string): boolean;
|
|
3
|
+
/** Converts a Postman collection JSON string to an OpenAPI JSON string */
|
|
4
|
+
export declare function convertPostmanToOpenApi(postmanJson: string): Promise<string>;
|
|
5
|
+
/** Extracts details from a Postman collection JSON string */
|
|
6
|
+
export declare function getPostmanDocumentDetails(content: string): {
|
|
7
|
+
type: string;
|
|
8
|
+
title: string;
|
|
9
|
+
version: string;
|
|
10
|
+
} | null;
|
|
11
|
+
//# sourceMappingURL=postman.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postman.d.ts","sourceRoot":"","sources":["../../src/libs/postman.ts"],"names":[],"mappings":"AAEA,0DAA0D;AAC1D,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAU5D;AAED,0EAA0E;AAC1E,wBAAsB,uBAAuB,CAC3C,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC,CAQjB;AAED,6DAA6D;AAC7D,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG;IAC1D,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;CAChB,GAAG,IAAI,CAcP"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { convert as e } from "@scalar/postman-to-openapi";
|
|
2
|
+
function s(t) {
|
|
3
|
+
var n, o;
|
|
4
|
+
try {
|
|
5
|
+
const r = JSON.parse(t);
|
|
6
|
+
return ((n = r.info) == null ? void 0 : n._postman_id) !== void 0 && new URL((o = r.info) == null ? void 0 : o.schema).host === "schema.getpostman.com";
|
|
7
|
+
} catch {
|
|
8
|
+
return !1;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
async function a(t) {
|
|
12
|
+
try {
|
|
13
|
+
const n = JSON.parse(t), o = e(n);
|
|
14
|
+
return JSON.stringify(o, null, 2);
|
|
15
|
+
} catch {
|
|
16
|
+
throw new Error("Failed to convert Postman collection to OpenAPI");
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function l(t) {
|
|
20
|
+
var n, o;
|
|
21
|
+
try {
|
|
22
|
+
if (s(t)) {
|
|
23
|
+
const r = JSON.parse(t);
|
|
24
|
+
return {
|
|
25
|
+
type: "json",
|
|
26
|
+
title: ((n = r.info) == null ? void 0 : n.name) || "Postman Collection",
|
|
27
|
+
version: ((o = r.info) == null ? void 0 : o.version) || "1.0"
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
} catch {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
a as convertPostmanToOpenApi,
|
|
37
|
+
l as getPostmanDocumentDetails,
|
|
38
|
+
s as isPostmanCollection
|
|
39
|
+
};
|