UNPKG

wiremock-mapper

Version:
89 lines 3.13 kB
"use strict"; var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.MatchBuilder = void 0; var MatchBuilder = /** @class */ (function () { function MatchBuilder(requestBuilder) { var _this = this; this.requestBuilder = requestBuilder; this.matchType = ''; this.options = {}; this.toJSON = function () { var _a; return (__assign((_a = {}, _a[_this.matchType] = _this.value, _a), _this.options)); }; } Object.defineProperty(MatchBuilder.prototype, "absent", { get: function () { this.matchType = 'absent'; this.value = true; return this.requestBuilder; }, enumerable: false, configurable: true }); MatchBuilder.prototype.containing = function (value) { this.matchType = 'contains'; this.value = value; return this.requestBuilder; }; MatchBuilder.prototype.equalTo = function (value) { this.matchType = 'equalTo'; this.value = value; return this.requestBuilder; }; MatchBuilder.prototype.equalToJson = function (json, ignoreArrayOrder, ignoreExtraElements) { if (ignoreArrayOrder === void 0) { ignoreArrayOrder = false; } if (ignoreExtraElements === void 0) { ignoreExtraElements = false; } this.matchType = 'equalToJson'; if (typeof json === 'object') { json = JSON.stringify(json); // tslint:disable-line } this.value = json; if (ignoreArrayOrder) { this.options.ignoreArrayOrder = ignoreArrayOrder; } if (ignoreExtraElements) { this.options.ignoreExtraElements = ignoreExtraElements; } return this.requestBuilder; }; MatchBuilder.prototype.equalToXml = function (xml) { this.matchType = 'equalToXml'; this.value = xml; return this.requestBuilder; }; MatchBuilder.prototype.matching = function (value) { this.matchType = 'matches'; this.value = value; return this.requestBuilder; }; MatchBuilder.prototype.matchingJsonPath = function (value) { this.matchType = 'matchesJsonPath'; this.value = value; return this.requestBuilder; }; MatchBuilder.prototype.matchingXPath = function (xpath) { this.matchType = 'matchesXPath'; this.value = xpath; return this.requestBuilder; }; MatchBuilder.prototype.notMatching = function (value) { this.matchType = 'doesNotMatch'; this.value = value; return this.requestBuilder; }; return MatchBuilder; }()); exports.MatchBuilder = MatchBuilder; //# sourceMappingURL=match_builder.js.map