@pact-foundation/pact
Advanced tools
Comparing version 13.2.0 to 14.0.0
@@ -8,17 +8,17 @@ # Pact-js migration guide | ||
All CLI/API functionality provided by the Pact CLI tools (ruby based) now migrated to | ||
* Repo | ||
* https://github.com/pact-foundation/pact-js-cli/ | ||
* NPM Package | ||
* https://www.npmjs.com/package/@pact-foundation/pact-cli | ||
* imports | ||
* `@pact-foundation/pact-core` imports will now become `@pact-foundation/pact-cli` for programatic usage of the CLI tools | ||
* `@pact-foundation/pact-core` imports will now become `@pact-foundation/pact-cli` for programmatic usage of the CLI tools | ||
* npx usage | ||
* `npx --package=@pact-foundation/pact-cli@15.0.0 -c pact-broker` | ||
@@ -57,3 +57,3 @@ | ||
* Remove all Ruby dependencies in DSLs | ||
* `pactfileWriteMode` still supports the same options, however the behaviour of `overwrite` is such now that it will overwrite the pact file _per test_, not pact run of Pact. This is because there is no longer a single long running mock server as per previous versions. Set to `merge` or leave blank for a sensible default. | ||
* `pactfileWriteMode` still supports the same options, however the behaviour of `overwrite` is such now that it will overwrite the pact file _per test_, not pact run of Pact. This is because there is no longer a single long running mock server as per previous versions. Set to `merge` or leave blank for a sensible default. | ||
* As per the change to `pactfileWriteMode` this also means pact files should be cleared out prior to each test, to avoid extraneous interactions in a pact file. | ||
@@ -60,0 +60,0 @@ * Array matcher currently doesn't work on query strings (see https://github.com/pact-foundation/pact-reference/issues/205). However, an array with matchers is supported (see jest spec) |
108
package.json
{ | ||
"name": "@pact-foundation/pact", | ||
"version": "13.2.0", | ||
"version": "14.0.0", | ||
"description": "Pact for all things Javascript", | ||
@@ -10,4 +10,5 @@ "main": "./src/index.js", | ||
"clean": "rimraf dist coverage .nyc_output logs pacts", | ||
"coverage": "nyc report --reporter=lcov", | ||
"predist": "npm run clean", | ||
"dist": "tsc && copyfiles package.json ./dist", | ||
"install-plugins": "./scripts/install-plugins", | ||
"lint": "eslint --config .eslintrc.json \"{src,test}/**/*.ts\"", | ||
@@ -18,7 +19,6 @@ "lint:fix": "npm run lint -- --fix", | ||
"format:check": "npm run format:base -- --check", | ||
"postdist": "npm test", | ||
"predist": "npm run clean && npm run format:check && npm run lint", | ||
"release": "commit-and-tag-version", | ||
"test": "nyc --check-coverage --reporter=html --reporter=text-summary mocha -t 120000", | ||
"pretest": "bash scripts/install-plugins.sh", | ||
"test": "mocha", | ||
"coverage": "nyc npm run test", | ||
"pretest": "npm run install-plugins", | ||
"docker:alpine:build": "docker build --build-arg NODE_VERSION=${NODE_VERSION:-current} -f Dockerfile.alpine -t pact-js:alpine .", | ||
@@ -106,9 +106,7 @@ "docker:debian:build": "docker build --build-arg NODE_VERSION=${NODE_VERSION:-current} -f Dockerfile.debian -t pact-js:debian .", | ||
"dependencies": { | ||
"@pact-foundation/pact-core": "^15.1.0", | ||
"@types/express": "^4.17.11", | ||
"axios": "^1.7.4", | ||
"@pact-foundation/pact-core": "^16.0.0", | ||
"axios": "^1.7.8", | ||
"body-parser": "^1.20.3", | ||
"chalk": "4.1.2", | ||
"express": "^4.21.1", | ||
"graphql": "^14.0.0", | ||
"graphql-tag": "^2.9.1", | ||
@@ -119,7 +117,2 @@ "http-proxy": "^1.18.1", | ||
"lodash": "^4.17.21", | ||
"lodash.isfunction": "3.0.8", | ||
"lodash.isnil": "4.0.0", | ||
"lodash.isundefined": "3.0.1", | ||
"lodash.omit": "^4.5.0", | ||
"pkginfo": "^0.4.1", | ||
"ramda": "^0.30.0", | ||
@@ -129,48 +122,43 @@ "randexp": "^0.5.3" | ||
"devDependencies": { | ||
"@babel/cli": "^7.18.6", | ||
"@babel/core": "^7.18.6", | ||
"@babel/preset-env": "^7.18.6", | ||
"@pact-foundation/pact-js-prettier-config": "^1.0.0", | ||
"@types/chai": "^4.3.1", | ||
"@types/chai-as-promised": "^7.1.1", | ||
"@types/http-proxy": "^1.17.9", | ||
"@types/lodash": "^4.14.182", | ||
"@types/lodash.isnil": "^4.0.7", | ||
"@types/mocha": "^8.0.4", | ||
"@types/nock": "^9.1.2", | ||
"@types/node": "^18.11.9", | ||
"@types/ramda": "^0.26.43", | ||
"@types/sinon": "^7.0.6", | ||
"@types/sinon-chai": "^2.7.29", | ||
"@types/tough-cookie": "^2.3.2", | ||
"@typescript-eslint/eslint-plugin": "^5.30.4", | ||
"@typescript-eslint/parser": "^5.30.4", | ||
"chai": "~4.1.2", | ||
"chai-as-promised": "^7.1.1", | ||
"commit-and-tag-version": "^10.1.0", | ||
"copyfiles": "^2.4.1", | ||
"eslint": "^8.19.0", | ||
"eslint-config-airbnb-base": "^15.0.0", | ||
"eslint-config-airbnb-typescript": "^17.0.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-import-resolver-typescript": "^3.2.1", | ||
"eslint-plugin-chai-friendly": "^0.7.2", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-mocha": "^10.0.5", | ||
"lodash.clone": "^4.5.0", | ||
"mocha": "^9.1.1", | ||
"mocha-lcov-reporter": "^1.3.0", | ||
"neon-cli": "^0.9.1", | ||
"nock": "^9.1.6", | ||
"nyc": "^15.1.0", | ||
"prettier": "^2.7.1", | ||
"proxyquire": "^2.0.1", | ||
"rimraf": "^2.7.1", | ||
"sinon": "^7.2.4", | ||
"sinon-chai": "^3.3.0", | ||
"source-map-support": "^0.4.18", | ||
"ts-mock-imports": "^1.2.6", | ||
"ts-node": "^3.3.0", | ||
"typescript": "^4.7.4" | ||
"@babel/cli": "7.26.4", | ||
"@babel/core": "7.26.8", | ||
"@babel/preset-env": "7.26.8", | ||
"@pact-foundation/pact-js-prettier-config": "1.0.0", | ||
"@types/chai": "5.0.1", | ||
"@types/chai-as-promised": "8.0.1", | ||
"@types/express": "4.17.21", | ||
"@types/http-proxy": "1.17.16", | ||
"@types/lodash": "4.17.15", | ||
"@types/mocha": "10.0.10", | ||
"@types/nock": "11.1.0", | ||
"@types/node": "22.13.4", | ||
"@types/ramda": "0.30.2", | ||
"@types/sinon": "17.0.3", | ||
"@types/sinon-chai": "2.7.42", | ||
"@typescript-eslint/eslint-plugin": "5.62.0", | ||
"@typescript-eslint/parser": "5.62.0", | ||
"chai": "5.1.2", | ||
"chai-as-promised": "8.0.1", | ||
"commit-and-tag-version": "12.5.0", | ||
"copyfiles": "2.4.1", | ||
"eslint": "8.57.1", | ||
"eslint-config-airbnb-base": "15.0.0", | ||
"eslint-config-airbnb-typescript": "17.1.0", | ||
"eslint-config-prettier": "10.0.1", | ||
"eslint-import-resolver-typescript": "3.7.0", | ||
"eslint-plugin-chai-friendly": "1.0.1", | ||
"eslint-plugin-import": "2.31.0", | ||
"eslint-plugin-mocha": "10.5.0", | ||
"mocha": "11.1.0", | ||
"nock": "14.0.1", | ||
"nyc": "17.1.0", | ||
"prettier": "3.5.1", | ||
"proxyquire": "2.1.3", | ||
"rimraf": "6.0.1", | ||
"sinon": "19.0.2", | ||
"sinon-chai": "4.0.0", | ||
"source-map-support": "0.5.21", | ||
"tsx": "4.19.2", | ||
"typescript": "5.7.3" | ||
} | ||
} |
@@ -99,3 +99,3 @@ <span align="center"> | ||
Looking for the previous [stable 9.x.x release](https://github.com/pact-foundation/pact-js/tree/9.x.x)? | ||
Looking for the previous [stable 9.x.x release](https://github.com/pact-foundation/pact-js/tree/9.x.x)? | ||
@@ -140,3 +140,3 @@ ### Requirements | ||
// API Client that will fetch dogs from the Dog API | ||
// API Client that will fetch dogs from the Dog API | ||
// This is the target of our Pact test | ||
@@ -179,4 +179,4 @@ public getMeDogs = (from: string): AxiosPromise => { | ||
// | ||
// Note we configure the DogService API client dynamically to | ||
// point to the mock service Pact created for us, instead of | ||
// Note we configure the DogService API client dynamically to | ||
// point to the mock service Pact created for us, instead of | ||
// the real one | ||
@@ -208,4 +208,3 @@ dogService = new DogService(mockserver.url); | ||
1. Change into the examples folder `cd examples` | ||
2. Install all the examples dependencies `./installAll.sh` | ||
3. Run all the examples `./runAll.sh` | ||
2. Run all examples `./run-all` | ||
@@ -212,0 +211,0 @@  |
@@ -7,3 +7,3 @@ # Releasing | ||
Releases trigger when the repository recieves the custom repository_dispatch event | ||
Releases trigger when the repository receives the custom repository_dispatch event | ||
`release-triggered`. | ||
@@ -10,0 +10,0 @@ |
@@ -7,32 +7,12 @@ "use strict"; | ||
*/ | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.freePort = exports.isPortAvailable = exports.portCheck = exports.localAddresses = void 0; | ||
var net = __importStar(require("net")); | ||
var net_1 = __importDefault(require("net")); | ||
exports.localAddresses = ['127.0.0.1', 'localhost', '0.0.0.0', '::1']; | ||
var portCheck = function (port, host) { | ||
return new Promise(function (resolve, reject) { | ||
var server = net | ||
var server = net_1.default | ||
.createServer() | ||
@@ -67,3 +47,3 @@ .listen({ port: port, host: host, exclusive: true }) | ||
return new Promise(function (res) { | ||
var s = net.createServer(); | ||
var s = net_1.default.createServer(); | ||
s.listen(0, function () { | ||
@@ -70,0 +50,0 @@ var addr = s.address(); |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -6,3 +39,3 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var chai_1 = __importDefault(require("chai")); | ||
var chai = __importStar(require("chai")); | ||
var chai_as_promised_1 = __importDefault(require("chai-as-promised")); | ||
@@ -12,4 +45,4 @@ var net_1 = __importDefault(require("net")); | ||
var logger_1 = __importDefault(require("./logger")); | ||
var expect = chai_1.default.expect; | ||
chai_1.default.use(chai_as_promised_1.default); | ||
var expect = chai.expect; | ||
chai.use(chai_as_promised_1.default); | ||
describe('Net', function () { | ||
@@ -16,0 +49,0 @@ var port = 4567; |
@@ -12,4 +12,4 @@ "use strict"; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); | ||
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
@@ -65,3 +65,3 @@ function step(op) { | ||
HTTPMethods["REPORT"] = "REPORT"; | ||
})(HTTPMethods = exports.HTTPMethods || (exports.HTTPMethods = {})); | ||
})(HTTPMethods || (exports.HTTPMethods = HTTPMethods = {})); | ||
var Request = /** @class */ (function () { | ||
@@ -68,0 +68,0 @@ function Request() { |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -6,8 +39,8 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var chai_1 = __importDefault(require("chai")); | ||
var chai = __importStar(require("chai")); | ||
var chai_as_promised_1 = __importDefault(require("chai-as-promised")); | ||
var nock_1 = __importDefault(require("nock")); | ||
var request_1 = require("./request"); | ||
chai_1.default.use(chai_as_promised_1.default); | ||
var expect = chai_1.default.expect; | ||
chai.use(chai_as_promised_1.default); | ||
var expect = chai.expect; | ||
describe('Request', function () { | ||
@@ -14,0 +47,0 @@ var request; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -6,7 +39,7 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var chai_1 = __importDefault(require("chai")); | ||
var chai = __importStar(require("chai")); | ||
var chai_as_promised_1 = __importDefault(require("chai-as-promised")); | ||
var apolloGraphql_1 = require("./apolloGraphql"); | ||
chai_1.default.use(chai_as_promised_1.default); | ||
var expect = chai_1.default.expect; | ||
chai.use(chai_as_promised_1.default); | ||
var expect = chai.expect; | ||
describe('ApolloGraphQLInteraction', function () { | ||
@@ -57,3 +90,3 @@ var interaction; | ||
describe('#withOperation', function () { | ||
describe('when no operationNaame is presented', function () { | ||
describe('when no operationName is presented', function () { | ||
it('adds a null operationName property to the payload', function () { | ||
@@ -60,0 +93,0 @@ interaction.uponReceiving('a request'); |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -6,8 +39,8 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var chai_1 = __importDefault(require("chai")); | ||
var chai = __importStar(require("chai")); | ||
var chai_as_promised_1 = __importDefault(require("chai-as-promised")); | ||
var graphql_1 = require("./graphql"); | ||
var matchers_1 = require("./matchers"); | ||
chai_1.default.use(chai_as_promised_1.default); | ||
var expect = chai_1.default.expect; | ||
chai.use(chai_as_promised_1.default); | ||
var expect = chai.expect; | ||
describe('GraphQLInteraction', function () { | ||
@@ -14,0 +47,0 @@ var interaction; |
@@ -64,3 +64,3 @@ /** | ||
* @param {string} requestOpts.query - Any query string in the interaction | ||
* @param {Object} requestOpts.headers - A key-value pair oject of headers | ||
* @param {Object} requestOpts.headers - A key-value pair object of headers | ||
* @param {Object} requestOpts.body - The body, in {@link String} format or {@link Object} format | ||
@@ -67,0 +67,0 @@ * @returns {Interaction} interaction |
@@ -63,3 +63,3 @@ "use strict"; | ||
* @param {string} requestOpts.query - Any query string in the interaction | ||
* @param {Object} requestOpts.headers - A key-value pair oject of headers | ||
* @param {Object} requestOpts.headers - A key-value pair object of headers | ||
* @param {Object} requestOpts.body - The body, in {@link String} format or {@link Object} format | ||
@@ -66,0 +66,0 @@ * @returns {Interaction} interaction |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -6,3 +39,3 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var chai_1 = __importDefault(require("chai")); | ||
var chai = __importStar(require("chai")); | ||
var chai_as_promised_1 = __importDefault(require("chai-as-promised")); | ||
@@ -12,4 +45,4 @@ var request_1 = require("../common/request"); | ||
var matchers_1 = require("./matchers"); | ||
chai_1.default.use(chai_as_promised_1.default); | ||
var expect = chai_1.default.expect; | ||
chai.use(chai_as_promised_1.default); | ||
var expect = chai.expect; | ||
describe('Interaction', function () { | ||
@@ -16,0 +49,0 @@ describe('#given', function () { |
@@ -22,3 +22,26 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.matcherValueOrString = exports.extractPayload = exports.regex = exports.like = exports.string = exports.boolean = exports.integer = exports.decimal = exports.hexadecimal = exports.rfc1123Timestamp = exports.iso8601Time = exports.iso8601Date = exports.iso8601DateTimeWithMillis = exports.iso8601DateTime = exports.ipv6Address = exports.ipv4Address = exports.uuid = exports.email = exports.term = exports.somethingLike = exports.eachLike = exports.validateExample = exports.isMatcher = exports.HEX_FORMAT = exports.IPV6_FORMAT = exports.IPV4_FORMAT = exports.UUID_V4_FORMAT = exports.RFC1123_TIMESTAMP_FORMAT = exports.ISO8601_TIME_FORMAT = exports.ISO8601_DATETIME_WITH_MILLIS_FORMAT = exports.ISO8601_DATETIME_FORMAT = exports.ISO8601_DATE_FORMAT = exports.EMAIL_FORMAT = void 0; | ||
exports.HEX_FORMAT = exports.IPV6_FORMAT = exports.IPV4_FORMAT = exports.UUID_V4_FORMAT = exports.RFC1123_TIMESTAMP_FORMAT = exports.ISO8601_TIME_FORMAT = exports.ISO8601_DATETIME_WITH_MILLIS_FORMAT = exports.ISO8601_DATETIME_FORMAT = exports.ISO8601_DATE_FORMAT = exports.EMAIL_FORMAT = void 0; | ||
exports.isMatcher = isMatcher; | ||
exports.validateExample = validateExample; | ||
exports.eachLike = eachLike; | ||
exports.somethingLike = somethingLike; | ||
exports.like = somethingLike; | ||
exports.term = term; | ||
exports.regex = term; | ||
exports.email = email; | ||
exports.uuid = uuid; | ||
exports.ipv4Address = ipv4Address; | ||
exports.ipv6Address = ipv6Address; | ||
exports.iso8601DateTime = iso8601DateTime; | ||
exports.iso8601DateTimeWithMillis = iso8601DateTimeWithMillis; | ||
exports.iso8601Date = iso8601Date; | ||
exports.iso8601Time = iso8601Time; | ||
exports.rfc1123Timestamp = rfc1123Timestamp; | ||
exports.hexadecimal = hexadecimal; | ||
exports.decimal = decimal; | ||
exports.integer = integer; | ||
exports.boolean = boolean; | ||
exports.string = string; | ||
exports.extractPayload = extractPayload; | ||
exports.matcherValueOrString = matcherValueOrString; | ||
var lodash_1 = require("lodash"); | ||
@@ -42,3 +65,2 @@ var ramda_1 = require("ramda"); | ||
} | ||
exports.isMatcher = isMatcher; | ||
/** | ||
@@ -54,3 +76,2 @@ * Validates the given example against the regex. | ||
} | ||
exports.validateExample = validateExample; | ||
/** | ||
@@ -77,3 +98,2 @@ * The eachLike matcher | ||
} | ||
exports.eachLike = eachLike; | ||
/** | ||
@@ -93,4 +113,2 @@ * The somethingLike matcher | ||
} | ||
exports.somethingLike = somethingLike; | ||
exports.like = somethingLike; | ||
/** | ||
@@ -117,4 +135,2 @@ * The term matcher. Also aliased to 'regex' for discoverability. | ||
} | ||
exports.term = term; | ||
exports.regex = term; | ||
/** | ||
@@ -130,3 +146,2 @@ * Email address matcher. | ||
} | ||
exports.email = email; | ||
/** | ||
@@ -142,3 +157,2 @@ * UUID v4 matcher. | ||
} | ||
exports.uuid = uuid; | ||
/** | ||
@@ -154,3 +168,2 @@ * IPv4 matcher. | ||
} | ||
exports.ipv4Address = ipv4Address; | ||
/** | ||
@@ -166,3 +179,2 @@ * IPv6 matcher. | ||
} | ||
exports.ipv6Address = ipv6Address; | ||
/** | ||
@@ -179,3 +191,2 @@ * ISO8601 DateTime matcher. | ||
} | ||
exports.iso8601DateTime = iso8601DateTime; | ||
/** | ||
@@ -191,3 +202,2 @@ * ISO8601 DateTime matcher with required millisecond precision | ||
} | ||
exports.iso8601DateTimeWithMillis = iso8601DateTimeWithMillis; | ||
/** | ||
@@ -203,3 +213,2 @@ * ISO8601 Date matcher. | ||
} | ||
exports.iso8601Date = iso8601Date; | ||
/** | ||
@@ -215,3 +224,2 @@ * ISO8601 Time Matcher, matches a pattern of the format "'T'HH:mm:ss". | ||
} | ||
exports.iso8601Time = iso8601Time; | ||
/** | ||
@@ -228,3 +236,2 @@ * RFC1123 Timestamp matcher "DAY, DD MON YYY hh:mm:ss" | ||
} | ||
exports.rfc1123Timestamp = rfc1123Timestamp; | ||
/** | ||
@@ -240,3 +247,2 @@ * Hexadecimal Matcher. | ||
} | ||
exports.hexadecimal = hexadecimal; | ||
/** | ||
@@ -249,3 +255,2 @@ * Decimal Matcher. | ||
} | ||
exports.decimal = decimal; | ||
/** | ||
@@ -258,3 +263,2 @@ * Integer Matcher. | ||
} | ||
exports.integer = integer; | ||
/** | ||
@@ -267,3 +271,2 @@ * Boolean Matcher. | ||
} | ||
exports.boolean = boolean; | ||
/** | ||
@@ -276,3 +279,2 @@ * String Matcher. | ||
} | ||
exports.string = string; | ||
// Recurse the object removing any underlying matching guff, returning | ||
@@ -295,3 +297,2 @@ // the raw example content | ||
} | ||
exports.extractPayload = extractPayload; | ||
// Gets a matcher as JSON or the string value if it's not a matcher | ||
@@ -303,3 +304,2 @@ function matcherValueOrString(obj) { | ||
} | ||
exports.matcherValueOrString = matcherValueOrString; | ||
//# sourceMappingURL=matchers.js.map |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { AnyJson } from '../common/jsonTypes'; | ||
@@ -3,0 +2,0 @@ import { Matcher } from './matchers'; |
@@ -12,4 +12,4 @@ "use strict"; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); | ||
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
@@ -46,88 +46,82 @@ function step(op) { | ||
var registerHookStateTracking = function (hooksState) { | ||
return function (_a, res, next) { | ||
var body = _a.body; | ||
return __awaiter(void 0, void 0, void 0, function () { | ||
return __generator(this, function (_b) { | ||
if ((body === null || body === void 0 ? void 0 : body.action) === 'setup') | ||
hooksState.setupCounter += 1; | ||
if ((body === null || body === void 0 ? void 0 : body.action) === 'teardown') | ||
hooksState.setupCounter -= 1; | ||
logger_1.default.debug("hooks state counter is ".concat(hooksState.setupCounter, " after receiving \"").concat(body === null || body === void 0 ? void 0 : body.action, "\" action")); | ||
next(); | ||
return [2 /*return*/]; | ||
}); | ||
return function (_a, res_1, next_1) { return __awaiter(void 0, [_a, res_1, next_1], void 0, function (_b, res, next) { | ||
var body = _b.body; | ||
return __generator(this, function (_c) { | ||
if ((body === null || body === void 0 ? void 0 : body.action) === 'setup') | ||
hooksState.setupCounter += 1; | ||
if ((body === null || body === void 0 ? void 0 : body.action) === 'teardown') | ||
hooksState.setupCounter -= 1; | ||
logger_1.default.debug("hooks state counter is ".concat(hooksState.setupCounter, " after receiving \"").concat(body === null || body === void 0 ? void 0 : body.action, "\" action")); | ||
next(); | ||
return [2 /*return*/]; | ||
}); | ||
}; | ||
}); }; | ||
}; | ||
exports.registerHookStateTracking = registerHookStateTracking; | ||
var registerBeforeHook = function (beforeEach, hooksState) { | ||
return function (_a, res, next) { | ||
var body = _a.body; | ||
return __awaiter(void 0, void 0, void 0, function () { | ||
var e_1; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
if (!((body === null || body === void 0 ? void 0 : body.action) === 'setup' && hooksState.setupCounter === 1)) return [3 /*break*/, 5]; | ||
logger_1.default.debug("executing 'beforeEach' hook"); | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 3, , 4]); | ||
return [4 /*yield*/, beforeEach()]; | ||
case 2: | ||
_b.sent(); | ||
next(); | ||
return [3 /*break*/, 4]; | ||
case 3: | ||
e_1 = _b.sent(); | ||
logger_1.default.error("error executing 'beforeEach' hook: ".concat(e_1.message)); | ||
logger_1.default.debug("Stack trace was: ".concat(e_1.stack)); | ||
next(new Error("error executing 'beforeEach' hook: ".concat(e_1.message))); | ||
return [3 /*break*/, 4]; | ||
case 4: return [3 /*break*/, 6]; | ||
case 5: | ||
next(); | ||
_b.label = 6; | ||
case 6: return [2 /*return*/]; | ||
} | ||
}); | ||
return function (_a, res_1, next_1) { return __awaiter(void 0, [_a, res_1, next_1], void 0, function (_b, res, next) { | ||
var e_1; | ||
var body = _b.body; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: | ||
if (!((body === null || body === void 0 ? void 0 : body.action) === 'setup' && hooksState.setupCounter === 1)) return [3 /*break*/, 5]; | ||
logger_1.default.debug("executing 'beforeEach' hook"); | ||
_c.label = 1; | ||
case 1: | ||
_c.trys.push([1, 3, , 4]); | ||
return [4 /*yield*/, beforeEach()]; | ||
case 2: | ||
_c.sent(); | ||
next(); | ||
return [3 /*break*/, 4]; | ||
case 3: | ||
e_1 = _c.sent(); | ||
logger_1.default.error("error executing 'beforeEach' hook: ".concat(e_1.message)); | ||
logger_1.default.debug("Stack trace was: ".concat(e_1.stack)); | ||
next(new Error("error executing 'beforeEach' hook: ".concat(e_1.message))); | ||
return [3 /*break*/, 4]; | ||
case 4: return [3 /*break*/, 6]; | ||
case 5: | ||
next(); | ||
_c.label = 6; | ||
case 6: return [2 /*return*/]; | ||
} | ||
}); | ||
}; | ||
}); }; | ||
}; | ||
exports.registerBeforeHook = registerBeforeHook; | ||
var registerAfterHook = function (afterEach, hooksState) { | ||
return function (_a, res, next) { | ||
var body = _a.body; | ||
return __awaiter(void 0, void 0, void 0, function () { | ||
var e_2; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
if (!((body === null || body === void 0 ? void 0 : body.action) === 'teardown' && hooksState.setupCounter === 0)) return [3 /*break*/, 5]; | ||
logger_1.default.debug("executing 'afterEach' hook"); | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 3, , 4]); | ||
return [4 /*yield*/, afterEach()]; | ||
case 2: | ||
_b.sent(); | ||
next(); | ||
return [3 /*break*/, 4]; | ||
case 3: | ||
e_2 = _b.sent(); | ||
logger_1.default.error("error executing 'afterEach' hook: ".concat(e_2.message)); | ||
logger_1.default.debug("Stack trace was: ".concat(e_2.stack)); | ||
next(new Error("error executing 'afterEach' hook: ".concat(e_2.message))); | ||
return [3 /*break*/, 4]; | ||
case 4: return [3 /*break*/, 6]; | ||
case 5: | ||
next(); | ||
_b.label = 6; | ||
case 6: return [2 /*return*/]; | ||
} | ||
}); | ||
return function (_a, res_1, next_1) { return __awaiter(void 0, [_a, res_1, next_1], void 0, function (_b, res, next) { | ||
var e_2; | ||
var body = _b.body; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: | ||
if (!((body === null || body === void 0 ? void 0 : body.action) === 'teardown' && hooksState.setupCounter === 0)) return [3 /*break*/, 5]; | ||
logger_1.default.debug("executing 'afterEach' hook"); | ||
_c.label = 1; | ||
case 1: | ||
_c.trys.push([1, 3, , 4]); | ||
return [4 /*yield*/, afterEach()]; | ||
case 2: | ||
_c.sent(); | ||
next(); | ||
return [3 /*break*/, 4]; | ||
case 3: | ||
e_2 = _c.sent(); | ||
logger_1.default.error("error executing 'afterEach' hook: ".concat(e_2.message)); | ||
logger_1.default.debug("Stack trace was: ".concat(e_2.stack)); | ||
next(new Error("error executing 'afterEach' hook: ".concat(e_2.message))); | ||
return [3 /*break*/, 4]; | ||
case 4: return [3 /*break*/, 6]; | ||
case 5: | ||
next(); | ||
_c.label = 6; | ||
case 6: return [2 /*return*/]; | ||
} | ||
}); | ||
}; | ||
}); }; | ||
}; | ||
exports.registerAfterHook = registerAfterHook; | ||
//# sourceMappingURL=hooks.js.map |
@@ -12,4 +12,4 @@ "use strict"; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); | ||
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
@@ -16,0 +16,0 @@ function step(op) { |
@@ -6,3 +6,3 @@ import express from 'express'; | ||
export declare const providerWithMetadata: (provider: MessageProvider, metadata: Record<string, string>) => MessageProvider; | ||
export declare const createProxyMessageHandler: (config: ProxyOptions) => (req: express.Request, res: express.Response) => void; | ||
export declare const createProxyMessageHandler: (config: ProxyOptions) => ((req: express.Request, res: express.Response) => void); | ||
export declare const setupMessageProxyApplication: (config: ProxyOptions) => express.Express; |
@@ -1,4 +0,2 @@ | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import * as http from 'http'; | ||
import http from 'http'; | ||
interface ReqBodyExtended extends http.IncomingMessage { | ||
@@ -5,0 +3,0 @@ body?: Buffer | Record<string, unknown>; |
@@ -10,3 +10,3 @@ "use strict"; | ||
if (Buffer.isBuffer(req.body)) { | ||
bodyData = req.body; | ||
bodyData = Buffer.from(req.body); | ||
} | ||
@@ -13,0 +13,0 @@ else if (typeof req.body === 'object') { |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -12,4 +45,4 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); | ||
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
@@ -43,7 +76,7 @@ function step(op) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var chai_1 = __importDefault(require("chai")); | ||
var chai = __importStar(require("chai")); | ||
var chai_as_promised_1 = __importDefault(require("chai-as-promised")); | ||
var parseBody_1 = require("./parseBody"); | ||
chai_1.default.use(chai_as_promised_1.default); | ||
var expect = chai_1.default.expect; | ||
chai.use(chai_as_promised_1.default); | ||
var expect = chai.expect; | ||
describe('Verifier', function () { | ||
@@ -50,0 +83,0 @@ describe('#parseBody', function () { |
@@ -1,4 +0,4 @@ | ||
import * as http from 'http'; | ||
import http from 'http'; | ||
import { ProxyOptions } from './types'; | ||
export declare const waitForServerReady: (server: http.Server) => Promise<http.Server>; | ||
export declare const createProxy: (config: ProxyOptions, stateSetupPath: string, messageTransportPath: string) => http.Server; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -33,3 +10,3 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
var body_parser_1 = __importDefault(require("body-parser")); | ||
var http = __importStar(require("http")); | ||
var http_1 = __importDefault(require("http")); | ||
var logger_1 = __importDefault(require("../../../common/logger")); | ||
@@ -101,3 +78,3 @@ var stateHandler_1 = require("./stateHandler/stateHandler"); | ||
// TODO: node is now using ipv6 as a default. This should be customised | ||
return http | ||
return http_1.default | ||
.createServer(app) | ||
@@ -104,0 +81,0 @@ .listen(undefined, config.proxyHost || '127.0.0.1'); |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -6,7 +39,7 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var chai_1 = __importDefault(require("chai")); | ||
var chai = __importStar(require("chai")); | ||
var chai_as_promised_1 = __importDefault(require("chai-as-promised")); | ||
var proxy_1 = require("./proxy"); | ||
chai_1.default.use(chai_as_promised_1.default); | ||
var expect = chai_1.default.expect; | ||
chai.use(chai_as_promised_1.default); | ||
var expect = chai.expect; | ||
// Little function to mock out an Event Emitter | ||
@@ -13,0 +46,0 @@ var fakeServer = function (event) { return ({ |
@@ -13,10 +13,40 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var chai_1 = __importDefault(require("chai")); | ||
var chai = __importStar(require("chai")); | ||
var stream_1 = require("stream"); | ||
var proxyRequest_1 = require("./proxyRequest"); | ||
var expect = chai_1.default.expect; | ||
var expect = chai.expect; | ||
describe('#toServerOptions', function () { | ||
@@ -23,0 +53,0 @@ var toServerOptions = function (opts, req) { |
@@ -13,2 +13,35 @@ "use strict"; | ||
}; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -24,4 +57,4 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); | ||
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
@@ -55,3 +88,3 @@ function step(op) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var chai_1 = __importDefault(require("chai")); | ||
var chai = __importStar(require("chai")); | ||
var chai_as_promised_1 = __importDefault(require("chai-as-promised")); | ||
@@ -61,4 +94,4 @@ var sinon_1 = __importDefault(require("sinon")); | ||
var setupStates_1 = require("./setupStates"); | ||
chai_1.default.use(chai_as_promised_1.default); | ||
var expect = chai_1.default.expect; | ||
chai.use(chai_as_promised_1.default); | ||
var expect = chai.expect; | ||
describe('#setupStates', function () { | ||
@@ -65,0 +98,0 @@ var state = { |
@@ -18,9 +18,19 @@ "use strict"; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -36,4 +46,4 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); | ||
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
@@ -67,10 +77,12 @@ function step(op) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var chai_1 = __importDefault(require("chai")); | ||
var chai = __importStar(require("chai")); | ||
var chai_as_promised_1 = __importDefault(require("chai-as-promised")); | ||
var sinon_1 = __importDefault(require("sinon")); | ||
var stateHandler_1 = require("./stateHandler"); | ||
var setupStatesModule = __importStar(require("./setupStates")); | ||
chai_1.default.use(chai_as_promised_1.default); | ||
var expect = chai_1.default.expect; | ||
chai.use(chai_as_promised_1.default); | ||
var expect = chai.expect; | ||
describe('#createProxyStateHandler', function () { | ||
var state = { | ||
state: 'thing exists', | ||
action: 'setup', | ||
}; | ||
var res; | ||
@@ -87,20 +99,14 @@ var mockResponse = { | ||
context('when valid state handlers are provided', function () { | ||
beforeEach(function () { | ||
sinon_1.default.stub(setupStatesModule, 'setupStates').returns(Promise.resolve({})); | ||
}); | ||
afterEach(function () { | ||
setupStatesModule.setupStates.restore(); | ||
}); | ||
it('returns a 200', function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var h, data; | ||
var stateHandlers, h; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
h = (0, stateHandler_1.createProxyStateHandler)({}); | ||
return [4 /*yield*/, h({}, mockResponse)]; | ||
case 1: | ||
data = _a.sent(); | ||
expect(data).to.deep.eq({}); | ||
return [2 /*return*/]; | ||
} | ||
stateHandlers = { | ||
'thing exists': function () { return Promise.resolve(); }, | ||
}; | ||
h = (0, stateHandler_1.createProxyStateHandler)({ | ||
stateHandlers: stateHandlers, | ||
}); | ||
return [2 /*return*/, expect(h({ | ||
body: state, | ||
}, mockResponse)).to.eventually.be.fulfilled]; | ||
}); | ||
@@ -110,10 +116,7 @@ }); }); | ||
context('when there is a problem with a state handler', function () { | ||
beforeEach(function () { | ||
sinon_1.default | ||
.stub(setupStatesModule, 'setupStates') | ||
.returns(Promise.reject(new Error('state error'))); | ||
}); | ||
afterEach(function () { | ||
setupStatesModule.setupStates.restore(); | ||
}); | ||
var badStateHandlers = { | ||
'thing exists': { | ||
setup: function () { return Promise.reject(new Error('bad')); }, | ||
}, | ||
}; | ||
it('returns a 500', function () { return __awaiter(void 0, void 0, void 0, function () { | ||
@@ -124,4 +127,8 @@ var h; | ||
case 0: | ||
h = (0, stateHandler_1.createProxyStateHandler)({}); | ||
return [4 /*yield*/, h({}, mockResponse)]; | ||
h = (0, stateHandler_1.createProxyStateHandler)({ | ||
stateHandlers: badStateHandlers, | ||
}); | ||
return [4 /*yield*/, h({ | ||
body: state, | ||
}, mockResponse)]; | ||
case 1: | ||
@@ -128,0 +135,0 @@ _a.sent(); |
@@ -1,2 +0,2 @@ | ||
import * as express from 'express'; | ||
import express from 'express'; | ||
import { LogLevel } from '../../options'; | ||
@@ -3,0 +3,0 @@ import { JsonMap, AnyJson } from '../../../common/jsonTypes'; |
@@ -29,9 +29,19 @@ "use strict"; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -48,3 +58,3 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
var lodash_1 = require("lodash"); | ||
var url = __importStar(require("url")); | ||
var url_1 = __importDefault(require("url")); | ||
var logger_1 = __importStar(require("../../common/logger")); | ||
@@ -143,3 +153,3 @@ var configurationError_1 = __importDefault(require("../../errors/configurationError")); | ||
} | ||
var u = new url.URL(this.config.providerBaseUrl); | ||
var u = new url_1.default.URL(this.config.providerBaseUrl); | ||
return (net_1.localAddresses.includes(u.host) || net_1.localAddresses.includes(u.hostname)); | ||
@@ -146,0 +156,0 @@ }; |
@@ -29,9 +29,19 @@ "use strict"; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
@@ -52,40 +62,54 @@ var t = {}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var chai_1 = __importDefault(require("chai")); | ||
var proxyquire_1 = __importDefault(require("proxyquire")); | ||
var chai = __importStar(require("chai")); | ||
var chai_as_promised_1 = __importDefault(require("chai-as-promised")); | ||
var sinon_1 = __importDefault(require("sinon")); | ||
var pact_core_1 = __importDefault(require("@pact-foundation/pact-core")); | ||
var proxy = __importStar(require("./proxy/proxy")); | ||
var logger_1 = __importDefault(require("../../common/logger")); | ||
var verifier_1 = require("./verifier"); | ||
chai_1.default.use(chai_as_promised_1.default); | ||
var expect = chai_1.default.expect; | ||
chai.use(chai_as_promised_1.default); | ||
var expect = chai.expect; | ||
describe('Verifier', function () { | ||
var _a; | ||
afterEach(function () { | ||
sinon_1.default.restore(); | ||
}); | ||
var executed; | ||
var state = 'thing exists'; | ||
var v; | ||
var opts; | ||
var executed; | ||
var providerBaseUrl = 'http://not.exists'; | ||
beforeEach(function () { | ||
var _a; | ||
executed = false; | ||
opts = { | ||
providerBaseUrl: providerBaseUrl, | ||
requestFilter: function (req, res, next) { | ||
next(); | ||
var opts = { | ||
providerBaseUrl: providerBaseUrl, | ||
requestFilter: function (req, res, next) { | ||
next(); | ||
}, | ||
stateHandlers: (_a = {}, | ||
_a[state] = function () { | ||
executed = true; | ||
return Promise.resolve(); | ||
}, | ||
stateHandlers: (_a = {}, | ||
_a[state] = function () { | ||
executed = true; | ||
return Promise.resolve(); | ||
}, | ||
_a), | ||
}; | ||
}); | ||
_a), | ||
}; | ||
// Mock the module and replace the proxy | ||
var Verifier = (0, proxyquire_1.default)('./verifier', { | ||
'./proxy': { | ||
createProxy: function () { | ||
return ({ | ||
close: function () { | ||
executed = true; | ||
return {}; | ||
}, | ||
address: function () { return ({ | ||
port: 1234, | ||
family: 'https', | ||
address: 'mock.server.example.com', | ||
}); }, | ||
}); | ||
}, | ||
waitForServerReady: function () { return Promise.resolve(); }, | ||
}, | ||
}).Verifier; | ||
var v; | ||
describe('#constructor', function () { | ||
describe('when given configuration', function () { | ||
it('sets the configuration on the object', function () { | ||
v = new verifier_1.Verifier(opts); | ||
v = new Verifier(opts); | ||
expect(v).to.have.deep.property('config').includes({ | ||
@@ -106,3 +130,3 @@ providerBaseUrl: providerBaseUrl, | ||
it('sets the log level on pact node', function () { | ||
v = new verifier_1.Verifier(__assign(__assign({}, opts), { logLevel: 'debug' })); | ||
v = new Verifier(__assign(__assign({}, opts), { logLevel: 'debug' })); | ||
expect(spy.callCount).to.eql(1); | ||
@@ -114,3 +138,3 @@ }); | ||
var rest = __rest(opts, []); | ||
v = new verifier_1.Verifier(__assign({}, rest)); | ||
v = new Verifier(__assign({}, rest)); | ||
expect(spy.callCount).to.eql(0); | ||
@@ -122,3 +146,3 @@ }); | ||
spy = sinon_1.default.spy(logger_1.default, 'warn'); | ||
v = new verifier_1.Verifier(__assign(__assign({}, opts), { providerStatesSetupUrl: 'http://foo.com' })); | ||
v = new Verifier(__assign(__assign({}, opts), { providerStatesSetupUrl: 'http://foo.com' })); | ||
expect(spy.callCount).to.eql(1); | ||
@@ -129,19 +153,6 @@ }); | ||
describe('#verifyProvider', function () { | ||
beforeEach(function () { | ||
sinon_1.default.stub(proxy, 'createProxy').returns({ | ||
close: function () { | ||
executed = true; | ||
return {}; | ||
}, | ||
address: function () { return ({ | ||
port: 1234, | ||
family: 'https', | ||
address: 'mock.server.example.com', | ||
}); }, | ||
}); | ||
sinon_1.default.stub(proxy, 'waitForServerReady').returns(Promise.resolve()); | ||
}); | ||
beforeEach(function () { }); | ||
describe('when no configuration has been given', function () { | ||
it('fails with an error', function () { | ||
return expect(function () { return new verifier_1.Verifier(undefined); }).to.throw(); | ||
return expect(function () { return new Verifier(undefined); }).to.throw(); | ||
}); | ||
@@ -151,3 +162,3 @@ }); | ||
beforeEach(function () { | ||
v = new verifier_1.Verifier(__assign(__assign({}, opts), { logLevel: 'trace' })); | ||
v = new Verifier(__assign(__assign({}, opts), { logLevel: 'trace' })); | ||
}); | ||
@@ -154,0 +165,0 @@ context('and the verification runs successfully', function () { |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -6,3 +39,3 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var chai_1 = __importDefault(require("chai")); | ||
var chai = __importStar(require("chai")); | ||
var chai_as_promised_1 = __importDefault(require("chai-as-promised")); | ||
@@ -12,5 +45,5 @@ var sinon_1 = __importDefault(require("sinon")); | ||
var ffi_1 = require("./ffi"); | ||
chai_1.default.use(sinon_chai_1.default); | ||
chai_1.default.use(chai_as_promised_1.default); | ||
var expect = chai_1.default.expect; | ||
chai.use(sinon_chai_1.default); | ||
chai.use(chai_as_promised_1.default); | ||
var expect = chai.expect; | ||
describe('Pact FFI', function () { | ||
@@ -17,0 +50,0 @@ describe('#contentTypeFromHeaders', function () { |
@@ -29,9 +29,19 @@ "use strict"; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -47,4 +57,4 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); | ||
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
@@ -81,3 +91,3 @@ function step(op) { | ||
var chalk_1 = __importDefault(require("chalk")); | ||
var path = __importStar(require("path")); | ||
var path_1 = __importDefault(require("path")); | ||
var process_1 = __importDefault(require("process")); | ||
@@ -299,5 +309,5 @@ var lodash_1 = require("lodash"); | ||
cors: false, | ||
dir: path.resolve(process_1.default.cwd(), 'pacts'), | ||
dir: path_1.default.resolve(process_1.default.cwd(), 'pacts'), | ||
host: '127.0.0.1', | ||
log: path.resolve(process_1.default.cwd(), 'logs', 'pact.log'), | ||
log: path_1.default.resolve(process_1.default.cwd(), 'logs', 'pact.log'), | ||
logLevel: 'info', | ||
@@ -304,0 +314,0 @@ pactfileWriteMode: 'merge', |
@@ -13,2 +13,35 @@ "use strict"; | ||
}; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -24,4 +57,4 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); | ||
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
@@ -55,3 +88,3 @@ function step(op) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var chai_1 = __importDefault(require("chai")); | ||
var chai = __importStar(require("chai")); | ||
var chai_as_promised_1 = __importDefault(require("chai-as-promised")); | ||
@@ -61,5 +94,5 @@ var sinon_1 = __importDefault(require("sinon")); | ||
var _1 = require("."); | ||
chai_1.default.use(sinon_chai_1.default); | ||
chai_1.default.use(chai_as_promised_1.default); | ||
var expect = chai_1.default.expect; | ||
chai.use(sinon_chai_1.default); | ||
chai.use(chai_as_promised_1.default); | ||
var expect = chai.expect; | ||
describe('Pact', function () { | ||
@@ -66,0 +99,0 @@ var fullOpts = { |
@@ -22,9 +22,19 @@ "use strict"; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
@@ -31,0 +41,0 @@ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); |
/** | ||
* @module Message | ||
*/ | ||
/// <reference types="node" /> | ||
import { AnyJson } from './common/jsonTypes'; | ||
@@ -9,3 +8,3 @@ import { Metadata, Message, MessageConsumer, ProviderState } from './dsl/message'; | ||
/** | ||
* A Message Consumer is analagous to a Provider in the HTTP Interaction model. | ||
* A Message Consumer is analogous to a Provider in the HTTP Interaction model. | ||
* It is the receiver of an interaction, and needs to be able to handle whatever | ||
@@ -12,0 +11,0 @@ * request was provided. |
@@ -21,9 +21,19 @@ "use strict"; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -33,3 +43,5 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.asynchronousBodyHandler = exports.synchronousBodyHandler = exports.MessageConsumerPact = void 0; | ||
exports.MessageConsumerPact = void 0; | ||
exports.synchronousBodyHandler = synchronousBodyHandler; | ||
exports.asynchronousBodyHandler = asynchronousBodyHandler; | ||
var lodash_1 = require("lodash"); | ||
@@ -51,3 +63,3 @@ var pact_core_1 = __importStar(require("@pact-foundation/pact-core")); | ||
/** | ||
* A Message Consumer is analagous to a Provider in the HTTP Interaction model. | ||
* A Message Consumer is analogous to a Provider in the HTTP Interaction model. | ||
* It is the receiver of an interaction, and needs to be able to handle whatever | ||
@@ -213,3 +225,2 @@ * request was provided. | ||
} | ||
exports.synchronousBodyHandler = synchronousBodyHandler; | ||
// bodyHandler takes an asynchronous (promisified) function and returns | ||
@@ -221,3 +232,2 @@ // a wrapped function that accepts a Message and returns a Promise | ||
} | ||
exports.asynchronousBodyHandler = asynchronousBodyHandler; | ||
//# sourceMappingURL=messageConsumerPact.js.map |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -6,9 +39,9 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var chai_1 = __importDefault(require("chai")); | ||
var chai = __importStar(require("chai")); | ||
var chai_as_promised_1 = __importDefault(require("chai-as-promised")); | ||
var sinon_chai_1 = __importDefault(require("sinon-chai")); | ||
var messageConsumerPact_1 = require("./messageConsumerPact"); | ||
chai_1.default.use(sinon_chai_1.default); | ||
chai_1.default.use(chai_as_promised_1.default); | ||
var expect = chai_1.default.expect; | ||
chai.use(sinon_chai_1.default); | ||
chai.use(chai_as_promised_1.default); | ||
var expect = chai.expect; | ||
describe('MessageConsumer', function () { | ||
@@ -15,0 +48,0 @@ var consumer; |
/** | ||
* @module Message | ||
*/ | ||
import * as http from 'http'; | ||
import http from 'http'; | ||
import { MessageProvider } from './dsl/message'; | ||
@@ -11,3 +11,3 @@ import { PactMessageProviderOptions } from './dsl/options'; | ||
/** | ||
* A Message Provider is analagous to Consumer in the HTTP Interaction model. | ||
* A Message Provider is analogous to Consumer in the HTTP Interaction model. | ||
* | ||
@@ -14,0 +14,0 @@ * It is the initiator of an interaction, and expects something on the other end |
@@ -32,9 +32,19 @@ "use strict"; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -48,3 +58,3 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
var express_1 = __importDefault(require("express")); | ||
var http = __importStar(require("http")); | ||
var http_1 = __importDefault(require("http")); | ||
var body_parser_1 = __importDefault(require("body-parser")); | ||
@@ -63,3 +73,3 @@ var js_base64_1 = require("js-base64"); | ||
// Get the Proxy we'll pass to the CLI for verification | ||
var setupProxyServer = function (app) { return http.createServer(app).listen(); }; | ||
var setupProxyServer = function (app) { return http_1.default.createServer(app).listen(); }; | ||
exports.setupProxyServer = setupProxyServer; | ||
@@ -83,3 +93,3 @@ var hasMetadata = function (o) { | ||
/** | ||
* A Message Provider is analagous to Consumer in the HTTP Interaction model. | ||
* A Message Provider is analogous to Consumer in the HTTP Interaction model. | ||
* | ||
@@ -86,0 +96,0 @@ * It is the initiator of an interaction, and expects something on the other end |
@@ -18,9 +18,19 @@ "use strict"; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -34,3 +44,3 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
var express_1 = __importDefault(require("express")); | ||
var http = __importStar(require("http")); | ||
var http_1 = __importDefault(require("http")); | ||
var messageProviderPact_1 = require("./messageProviderPact"); | ||
@@ -40,3 +50,3 @@ chai.use(sinon_chai_1.default); | ||
var expect = chai.expect; | ||
describe('MesageProvider', function () { | ||
describe('MessageProvider', function () { | ||
var provider; | ||
@@ -164,3 +174,3 @@ var successfulRequest = 'successfulRequest'; | ||
it('returns a resolved promise', function () { | ||
var server = http.createServer(function () { }).listen(); | ||
var server = http_1.default.createServer(function () { }).listen(); | ||
return expect((0, messageProviderPact_1.waitForServerReady)(server)).to.eventually.be.fulfilled; | ||
@@ -174,3 +184,3 @@ }); | ||
var app = (0, express_1.default)(); | ||
expect((0, messageProviderPact_1.setupProxyServer)(app)).to.be.an.instanceOf(http.Server); | ||
expect((0, messageProviderPact_1.setupProxyServer)(app)).to.be.an.instanceOf(http_1.default.Server); | ||
}); | ||
@@ -177,0 +187,0 @@ }); |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -12,4 +45,4 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); | ||
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
@@ -44,3 +77,3 @@ function step(op) { | ||
/* tslint:disable:no-unused-expression no-empty */ | ||
var chai_1 = __importDefault(require("chai")); | ||
var chai = __importStar(require("chai")); | ||
var chai_as_promised_1 = __importDefault(require("chai-as-promised")); | ||
@@ -53,5 +86,5 @@ var sinon_chai_1 = __importDefault(require("sinon-chai")); | ||
var v4_1 = require("./v4"); | ||
var expect = chai_1.default.expect; | ||
chai_1.default.use(sinon_chai_1.default); | ||
chai_1.default.use(chai_as_promised_1.default); | ||
var expect = chai.expect; | ||
chai.use(sinon_chai_1.default); | ||
chai.use(chai_as_promised_1.default); | ||
describe('V4 Pact', function () { | ||
@@ -169,2 +202,3 @@ var pact; | ||
resolve(parseMattMessage(data.toString())); | ||
socket.destroy(); | ||
}); | ||
@@ -171,0 +205,0 @@ }); |
@@ -12,3 +12,8 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.generateMockServerError = exports.printMismatches = exports.printMismatch = exports.filterMissingFeatureFlag = exports.displayRequest = exports.displayQuery = void 0; | ||
exports.displayQuery = displayQuery; | ||
exports.displayRequest = displayRequest; | ||
exports.filterMissingFeatureFlag = filterMissingFeatureFlag; | ||
exports.printMismatch = printMismatch; | ||
exports.printMismatches = printMismatches; | ||
exports.generateMockServerError = generateMockServerError; | ||
var ramda_1 = require("ramda"); | ||
@@ -41,3 +46,2 @@ // TODO: update Matching in the rust core to have a `type` property | ||
} | ||
exports.displayQuery = displayQuery; | ||
function displayHeaders(headers, indent) { | ||
@@ -65,3 +69,2 @@ return (0, ramda_1.join)("\n".concat(indent), (0, ramda_1.map)(function (_a) { | ||
} | ||
exports.displayRequest = displayRequest; | ||
function filterMissingFeatureFlag(mismatches) { | ||
@@ -73,3 +76,2 @@ if (process.env.PACT_EXPERIMENTAL_FEATURE_ALLOW_MISSING_REQUESTS) { | ||
} | ||
exports.filterMissingFeatureFlag = filterMissingFeatureFlag; | ||
function printMismatch(m) { | ||
@@ -96,3 +98,2 @@ if (isPluginContentMismatch(m)) { | ||
} | ||
exports.printMismatch = printMismatch; | ||
function printMismatches(mismatches) { | ||
@@ -102,3 +103,2 @@ var errors = mismatches.map(function (m) { return printMismatch(m); }); | ||
} | ||
exports.printMismatches = printMismatches; | ||
function generateMockServerError(mismatches, indent) { | ||
@@ -126,3 +126,2 @@ return __spreadArray([ | ||
} | ||
exports.generateMockServerError = generateMockServerError; | ||
//# sourceMappingURL=display.js.map |
@@ -18,9 +18,19 @@ "use strict"; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -27,0 +37,0 @@ exports.contentTypeFromHeaders = exports.setResponseDetails = exports.setRequestDetails = void 0; |
@@ -21,9 +21,19 @@ "use strict"; | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -30,0 +40,0 @@ exports.MatchersV3 = void 0; |
@@ -40,3 +40,20 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.extractPayload = exports.reify = exports.matcherValueOrString = exports.uuid = exports.fromProviderState = exports.arrayContaining = exports.url = exports.url2 = exports.nullValue = exports.includes = exports.date = exports.time = exports.timestamp = exports.datetime = exports.equal = exports.regex = exports.string = exports.number = exports.decimal = exports.integer = exports.boolean = exports.constrainedArrayLike = exports.atMostLike = exports.atLeastLike = exports.atLeastOneLike = exports.eachLike = exports.eachValueMatches = exports.eachKeyMatches = exports.eachKeyLike = exports.like = exports.isMatcher = void 0; | ||
exports.matcherValueOrString = exports.equal = exports.decimal = exports.integer = exports.boolean = exports.constrainedArrayLike = exports.atMostLike = exports.atLeastLike = exports.atLeastOneLike = exports.eachLike = exports.eachValueMatches = exports.eachKeyMatches = exports.eachKeyLike = exports.like = void 0; | ||
exports.isMatcher = isMatcher; | ||
exports.number = number; | ||
exports.string = string; | ||
exports.regex = regex; | ||
exports.datetime = datetime; | ||
exports.timestamp = timestamp; | ||
exports.time = time; | ||
exports.date = date; | ||
exports.includes = includes; | ||
exports.nullValue = nullValue; | ||
exports.url2 = url2; | ||
exports.url = url; | ||
exports.arrayContaining = arrayContaining; | ||
exports.fromProviderState = fromProviderState; | ||
exports.uuid = uuid; | ||
exports.reify = reify; | ||
exports.extractPayload = reify; | ||
var ramda_1 = require("ramda"); | ||
@@ -50,3 +67,2 @@ var randexp_1 = __importDefault(require("randexp")); | ||
} | ||
exports.isMatcher = isMatcher; | ||
/** | ||
@@ -281,3 +297,2 @@ * Value must match the given template | ||
} | ||
exports.number = number; | ||
/** | ||
@@ -294,3 +309,2 @@ * Value must be a string | ||
} | ||
exports.string = string; | ||
/** | ||
@@ -315,3 +329,2 @@ * Value that must match the given regular expression | ||
} | ||
exports.regex = regex; | ||
/** | ||
@@ -342,3 +355,2 @@ * Value that must be equal to the example. This is mainly used to reset the matching rules which cascade. | ||
} | ||
exports.datetime = datetime; | ||
/** | ||
@@ -355,3 +367,2 @@ * String value that must match the provided datetime format string. | ||
} | ||
exports.timestamp = timestamp; | ||
/** | ||
@@ -373,3 +384,2 @@ * String value that must match the provided time format string. | ||
} | ||
exports.time = time; | ||
/** | ||
@@ -391,3 +401,2 @@ * String value that must match the provided date format string. | ||
} | ||
exports.date = date; | ||
/** | ||
@@ -403,3 +412,2 @@ * Value that must include the example value as a substring. | ||
} | ||
exports.includes = includes; | ||
/** | ||
@@ -415,3 +423,2 @@ * Value that must be null. This will only match the JSON Null value. For other content types, it will | ||
} | ||
exports.nullValue = nullValue; | ||
function stringFromRegex(r) { | ||
@@ -448,3 +455,3 @@ return new randexp_1.default(r).gen(); | ||
}), true).join(''); | ||
// Temporary fix for inconsistancies between matchers and generators. Matchers use "value" attribute for | ||
// Temporary fix for inconsistencies between matchers and generators. Matchers use "value" attribute for | ||
// example values, while generators use "example" | ||
@@ -466,3 +473,2 @@ if (basePath == null) { | ||
} | ||
exports.url2 = url2; | ||
/** | ||
@@ -475,3 +481,2 @@ * Matches a URL composed of a list of path fragments. The base URL from the mock server will be used. | ||
} | ||
exports.url = url; | ||
/** | ||
@@ -491,3 +496,2 @@ * Matches the items in an array against a number of variants. Matching is successful if each variant | ||
} | ||
exports.arrayContaining = arrayContaining; | ||
/** | ||
@@ -506,3 +510,2 @@ * Marks an item to be injected from the provider state | ||
} | ||
exports.fromProviderState = fromProviderState; | ||
/** | ||
@@ -531,3 +534,2 @@ * Match a universally unique identifier (UUID). Random values will be used for examples if no example is given. | ||
} | ||
exports.uuid = uuid; | ||
var matcherValueOrString = function (obj) { | ||
@@ -566,4 +568,2 @@ if (typeof obj === 'string') | ||
} | ||
exports.reify = reify; | ||
exports.extractPayload = reify; | ||
//# sourceMappingURL=matchers.js.map |
@@ -29,9 +29,19 @@ "use strict"; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -512,3 +522,3 @@ var chai = __importStar(require("chai")); | ||
var object = { | ||
value: 'data', | ||
value: 'data', // field name of value should not be only determination of isMatcher() | ||
more: 'strings', | ||
@@ -515,0 +525,0 @@ an: ['array'], |
@@ -12,4 +12,4 @@ "use strict"; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); | ||
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
@@ -16,0 +16,0 @@ function step(op) { |
@@ -9,3 +9,3 @@ "use strict"; | ||
SpecificationVersion[SpecificationVersion["SPECIFICATION_VERSION_V4"] = 5] = "SPECIFICATION_VERSION_V4"; | ||
})(SpecificationVersion = exports.SpecificationVersion || (exports.SpecificationVersion = {})); | ||
})(SpecificationVersion || (exports.SpecificationVersion = SpecificationVersion = {})); | ||
//# sourceMappingURL=types.js.map |
@@ -18,9 +18,19 @@ "use strict"; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -27,0 +37,0 @@ var chai = __importStar(require("chai")); |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { ConsumerInteraction, ConsumerPact } from '@pact-foundation/pact-core'; | ||
@@ -3,0 +2,0 @@ import { JsonMap } from '../../common/jsonTypes'; |
@@ -27,4 +27,4 @@ "use strict"; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); | ||
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
@@ -31,0 +31,0 @@ function step(op) { |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { JsonMap } from '../../common/jsonTypes'; | ||
@@ -3,0 +2,0 @@ import { Path, SpecificationVersion, TemplateHeaders, TemplateQuery, V3MockServer, V3ProviderState, V3Request, V3Response } from '../../v3'; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { Metadata } from '../../dsl/message'; | ||
@@ -3,0 +2,0 @@ import { AnyJson, JsonMap } from '../../common/jsonTypes'; |
@@ -12,4 +12,4 @@ "use strict"; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); | ||
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
@@ -16,0 +16,0 @@ function step(op) { |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { AnyJson, JsonMap } from '../../common/jsonTypes'; | ||
@@ -3,0 +2,0 @@ import { Metadata } from '../../dsl/message'; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
971081
12
40
10475
303
+ Added@pact-foundation/pact-core@16.0.0(transitive)
+ Added@pact-foundation/pact-core-darwin-arm64@16.0.0(transitive)
+ Added@pact-foundation/pact-core-darwin-x64@16.0.0(transitive)
+ Added@pact-foundation/pact-core-linux-arm64-glibc@16.0.0(transitive)
+ Added@pact-foundation/pact-core-linux-arm64-musl@16.0.0(transitive)
+ Added@pact-foundation/pact-core-linux-x64-glibc@16.0.0(transitive)
+ Added@pact-foundation/pact-core-linux-x64-musl@16.0.0(transitive)
+ Added@pact-foundation/pact-core-windows-x64@16.0.0(transitive)
+ Addedcheck-types@7.4.0(transitive)
+ Addeddetect-libc@2.0.3(transitive)
+ Addedgraphql@16.10.0(transitive)
+ Addedunderscore@1.13.7(transitive)
- Removed@types/express@^4.17.11
- Removedgraphql@^14.0.0
- Removedlodash.isfunction@3.0.8
- Removedlodash.isnil@4.0.0
- Removedlodash.isundefined@3.0.1
- Removedlodash.omit@^4.5.0
- Removedpkginfo@^0.4.1
- Removed@pact-foundation/pact-core@15.2.1(transitive)
- Removed@types/body-parser@1.19.5(transitive)
- Removed@types/connect@3.4.38(transitive)
- Removed@types/express@4.17.21(transitive)
- Removed@types/express-serve-static-core@4.19.6(transitive)
- Removed@types/http-errors@2.0.4(transitive)
- Removed@types/mime@1.3.5(transitive)
- Removed@types/node@22.13.5(transitive)
- Removed@types/qs@6.9.18(transitive)
- Removed@types/range-parser@1.2.7(transitive)
- Removed@types/send@0.17.4(transitive)
- Removed@types/serve-static@1.15.7(transitive)
- Removedcheck-types@7.3.0(transitive)
- Removedgraphql@14.7.0(transitive)
- Removediterall@1.3.0(transitive)
- Removedlodash.isfunction@3.0.8(transitive)
- Removedlodash.isnil@4.0.0(transitive)
- Removedlodash.isundefined@3.0.1(transitive)
- Removedlodash.omit@4.5.0(transitive)
- Removedpkginfo@0.4.1(transitive)
- Removedunderscore@1.12.1(transitive)
- Removedundici-types@6.20.0(transitive)
Updatedaxios@^1.7.8