UNPKG

unmock-core

Version:

[![npm](https://img.shields.io/npm/v/unmock-core.svg)][npmjs] [![CircleCI](https://circleci.com/gh/unmock/unmock-js.svg?style=svg)](https://circleci.com/gh/unmock/unmock-js) [![codecov](https://codecov.io/gh/unmock/unmock-js/branch/dev/graph/badge.svg)](h

26 lines 800 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const full_1 = require("loas3/dist/generated/full"); const serviceCore_1 = require("./serviceCore"); class Service { constructor(core) { this.core = core; this.spy = core.spy; } static fromOpenAPI({ schema, name, }) { const core = new serviceCore_1.ServiceCore({ schema, name }); return new Service(core); } static isOpenAPIObject(schema) { return full_1.isOpenAPIObject(schema); } state(a0, ...i) { this.core.transformer = (req, o) => i.reduce((a, b) => b(req, a), a0(req, o)); } reset() { this.spy.resetHistory(); this.core.transformer = (_, b) => b; } } exports.Service = Service; //# sourceMappingURL=service.js.map