UNPKG

@scalar/api-client

Version:

the open source API testing client

30 lines (29 loc) 567 B
import { isUrl as f } from "./is-url.js"; async function U({ store: t, workspace: i, source: o, watchMode: n, onSuccess: m, onError: p }) { try { if (o && i) { if (f(o)) { const [c, l] = await t.importSpecFromUrl(o, i.uid, { proxyUrl: i.proxyUrl, watchMode: n }); c || m(l == null ? void 0 : l.collection); return; } const r = await t.importSpecFile(o, i.uid); m(r == null ? void 0 : r.collection); } } catch (r) { p(r); } } export { U as importCollection };