UNPKG

@scalar/api-client

Version:

the open source API testing client

38 lines (37 loc) 821 B
import { convert as r } from "@scalar/postman-to-openapi"; function e(o) { try { const n = JSON.parse(o); return n.info?._postman_id !== void 0 && new URL(n.info?.schema).host === "schema.getpostman.com"; } catch { return !1; } } async function c(o) { try { const n = JSON.parse(o), t = r(n); return JSON.stringify(t, null, 2); } catch { throw new Error("Failed to convert Postman collection to OpenAPI"); } } function i(o) { try { if (e(o)) { const n = JSON.parse(o); return { type: "json", title: n.info?.name || "Postman Collection", version: n.info?.version || "1.0" }; } return null; } catch { return null; } } export { c as convertPostmanToOpenApi, i as getPostmanDocumentDetails, e as isPostmanCollection };