UNPKG

@har-sdk/core

Version:

The base package can be used to import specification files (i.e. HAR, OAS and Postman Collection) and detect their type.

27 lines 798 B
import { first } from '../utils'; import { OASV3Importer } from './OASV3Importer'; import { PostmanImporter } from './PostmanImporter'; import { OASV2Importer } from './OASV2Importer'; import { HARImporter } from './HARImporter'; export class SpecImporter { constructor(importers = [ new HARImporter(), new OASV3Importer(), new PostmanImporter(), new OASV2Importer() ]) { this.importers = importers; } async import(value, format) { let spec; try { const promises = this.importers.map((importer) => importer.import(value, format)); spec = await first(promises, (val) => !!val); } catch { // noop } return spec; } } //# sourceMappingURL=SpecImporter.js.map