UNPKG

@scalar/api-client

Version:

the open source API testing client

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