@pact-foundation/pact 16.3.0 → 16.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -3
- package/CONTRIBUTING.md +2 -2
- package/README.md +6 -2
- package/package.json +25 -28
- package/src/common/graphQL/configurationError.js +2 -22
- package/src/common/graphQL/configurationError.js.map +1 -1
- package/src/common/graphQL/graphQL.d.ts +2 -2
- package/src/common/graphQL/graphQL.js +11 -14
- package/src/common/graphQL/graphQL.js.map +1 -1
- package/src/common/graphQL/graphQLQueryError.js +2 -22
- package/src/common/graphQL/graphQLQueryError.js.map +1 -1
- package/src/common/logger.js +9 -9
- package/src/common/logger.js.map +1 -1
- package/src/common/matchingRules.d.ts +1 -1
- package/src/common/matchingRules.js +21 -21
- package/src/common/matchingRules.js.map +1 -1
- package/src/common/net.js +36 -42
- package/src/common/net.js.map +1 -1
- package/src/common/net.spec.js +41 -53
- package/src/common/net.spec.js.map +1 -1
- package/src/common/request.js +33 -82
- package/src/common/request.js.map +1 -1
- package/src/common/request.spec.js +26 -26
- package/src/common/request.spec.js.map +1 -1
- package/src/common/spec.js +3 -4
- package/src/common/spec.js.map +1 -1
- package/src/dsl/apolloGraphql.js +7 -25
- package/src/dsl/apolloGraphql.js.map +1 -1
- package/src/dsl/apolloGraphql.spec.js +21 -18
- package/src/dsl/apolloGraphql.spec.js.map +1 -1
- package/src/dsl/graphql.d.ts +2 -2
- package/src/dsl/graphql.js +29 -48
- package/src/dsl/graphql.js.map +1 -1
- package/src/dsl/graphql.spec.js +81 -66
- package/src/dsl/graphql.spec.js.map +1 -1
- package/src/dsl/interaction.d.ts +2 -2
- package/src/dsl/interaction.js +41 -48
- package/src/dsl/interaction.js.map +1 -1
- package/src/dsl/interaction.spec.js +77 -70
- package/src/dsl/interaction.spec.js.map +1 -1
- package/src/dsl/matchers.d.ts +1 -1
- package/src/dsl/matchers.js +19 -31
- package/src/dsl/matchers.js.map +1 -1
- package/src/dsl/matchers.spec.js +199 -208
- package/src/dsl/matchers.spec.js.map +1 -1
- package/src/dsl/message.d.ts +3 -3
- package/src/dsl/options.d.ts +3 -3
- package/src/dsl/verifier/proxy/hooks.d.ts +2 -2
- package/src/dsl/verifier/proxy/hooks.js +42 -112
- package/src/dsl/verifier/proxy/hooks.js.map +1 -1
- package/src/dsl/verifier/proxy/hooks.spec.js +84 -199
- package/src/dsl/verifier/proxy/hooks.spec.js.map +1 -1
- package/src/dsl/verifier/proxy/messages.d.ts +2 -2
- package/src/dsl/verifier/proxy/messages.js +88 -106
- package/src/dsl/verifier/proxy/messages.js.map +1 -1
- package/src/dsl/verifier/proxy/parseBody.d.ts +1 -1
- package/src/dsl/verifier/proxy/parseBody.js +2 -2
- package/src/dsl/verifier/proxy/parseBody.js.map +1 -1
- package/src/dsl/verifier/proxy/parseBody.spec.js +31 -76
- package/src/dsl/verifier/proxy/parseBody.spec.js.map +1 -1
- package/src/dsl/verifier/proxy/proxy.d.ts +2 -2
- package/src/dsl/verifier/proxy/proxy.js +22 -26
- package/src/dsl/verifier/proxy/proxy.js.map +1 -1
- package/src/dsl/verifier/proxy/proxy.spec.js +14 -14
- package/src/dsl/verifier/proxy/proxy.spec.js.map +1 -1
- package/src/dsl/verifier/proxy/proxyRequest.d.ts +3 -3
- package/src/dsl/verifier/proxy/proxyRequest.js +7 -7
- package/src/dsl/verifier/proxy/proxyRequest.js.map +1 -1
- package/src/dsl/verifier/proxy/proxyRequest.spec.js +49 -64
- package/src/dsl/verifier/proxy/proxyRequest.spec.js.map +1 -1
- package/src/dsl/verifier/proxy/stateHandler/setupStates.d.ts +3 -3
- package/src/dsl/verifier/proxy/stateHandler/setupStates.js +14 -18
- package/src/dsl/verifier/proxy/stateHandler/setupStates.js.map +1 -1
- package/src/dsl/verifier/proxy/stateHandler/setupStates.spec.js +76 -159
- package/src/dsl/verifier/proxy/stateHandler/setupStates.spec.js.map +1 -1
- package/src/dsl/verifier/proxy/stateHandler/stateHandler.d.ts +2 -2
- package/src/dsl/verifier/proxy/stateHandler/stateHandler.js +23 -72
- package/src/dsl/verifier/proxy/stateHandler/stateHandler.js.map +1 -1
- package/src/dsl/verifier/proxy/stateHandler/stateHandler.spec.js +37 -85
- package/src/dsl/verifier/proxy/stateHandler/stateHandler.spec.js.map +1 -1
- package/src/dsl/verifier/proxy/tracer.d.ts +1 -1
- package/src/dsl/verifier/proxy/tracer.js +42 -35
- package/src/dsl/verifier/proxy/tracer.js.map +1 -1
- package/src/dsl/verifier/proxy/types.d.ts +5 -5
- package/src/dsl/verifier/types.d.ts +3 -3
- package/src/dsl/verifier/verifier.d.ts +1 -1
- package/src/dsl/verifier/verifier.js +49 -56
- package/src/dsl/verifier/verifier.js.map +1 -1
- package/src/dsl/verifier/verifier.spec.js +76 -93
- package/src/dsl/verifier/verifier.spec.js.map +1 -1
- package/src/errors/configurationError.js +2 -22
- package/src/errors/configurationError.js.map +1 -1
- package/src/errors/graphQLQueryError.js +2 -22
- package/src/errors/graphQLQueryError.js.map +1 -1
- package/src/errors/matcherError.js +2 -22
- package/src/errors/matcherError.js.map +1 -1
- package/src/errors/verificationError.js +2 -22
- package/src/errors/verificationError.js.map +1 -1
- package/src/httpPact/ffi.d.ts +2 -2
- package/src/httpPact/ffi.js +28 -29
- package/src/httpPact/ffi.js.map +1 -1
- package/src/httpPact/ffi.spec.js +30 -31
- package/src/httpPact/ffi.spec.js.map +1 -1
- package/src/httpPact/index.d.ts +3 -3
- package/src/httpPact/index.js +92 -149
- package/src/httpPact/index.js.map +1 -1
- package/src/httpPact/index.spec.js +75 -125
- package/src/httpPact/index.spec.js.map +1 -1
- package/src/httpPact/tracing.js +20 -28
- package/src/httpPact/tracing.js.map +1 -1
- package/src/index.js +1 -1
- package/src/index.js.map +1 -1
- package/src/messageConsumerPact.d.ts +3 -3
- package/src/messageConsumerPact.js +50 -51
- package/src/messageConsumerPact.js.map +1 -1
- package/src/messageConsumerPact.spec.js +50 -49
- package/src/messageConsumerPact.spec.js.map +1 -1
- package/src/messageProviderPact.d.ts +3 -3
- package/src/messageProviderPact.js +68 -85
- package/src/messageProviderPact.js.map +1 -1
- package/src/messageProviderPact.spec.js +75 -66
- package/src/messageProviderPact.spec.js.map +1 -1
- package/src/pact.integration.spec.js +250 -268
- package/src/pact.integration.spec.js.map +1 -1
- package/src/v3/display.d.ts +1 -1
- package/src/v3/display.js +44 -58
- package/src/v3/display.js.map +1 -1
- package/src/v3/ffi.d.ts +2 -2
- package/src/v3/ffi.js +18 -16
- package/src/v3/ffi.js.map +1 -1
- package/src/v3/ffi.spec.d.ts +1 -0
- package/src/v3/ffi.spec.js +50 -0
- package/src/v3/ffi.spec.js.map +1 -0
- package/src/v3/graphql/graphQL.d.ts +4 -4
- package/src/v3/graphql/graphQL.js +50 -75
- package/src/v3/graphql/graphQL.js.map +1 -1
- package/src/v3/matchers.d.ts +2 -2
- package/src/v3/matchers.js +112 -147
- package/src/v3/matchers.js.map +1 -1
- package/src/v3/matchers.spec.js +168 -187
- package/src/v3/matchers.spec.js.map +1 -1
- package/src/v3/pact.d.ts +2 -2
- package/src/v3/pact.js +103 -151
- package/src/v3/pact.js.map +1 -1
- package/src/v3/types.d.ts +1 -1
- package/src/v3/xml/xmlBuilder.d.ts +1 -3
- package/src/v3/xml/xmlBuilder.js +7 -9
- package/src/v3/xml/xmlBuilder.js.map +1 -1
- package/src/v3/xml/xmlElement.d.ts +2 -2
- package/src/v3/xml/xmlElement.js +24 -41
- package/src/v3/xml/xmlElement.js.map +1 -1
- package/src/v3/xml/xmlElement.spec.js +23 -25
- package/src/v3/xml/xmlElement.spec.js.map +1 -1
- package/src/v3/xml/xmlNode.js +2 -5
- package/src/v3/xml/xmlNode.js.map +1 -1
- package/src/v3/xml/xmlText.d.ts +1 -1
- package/src/v3/xml/xmlText.js +9 -25
- package/src/v3/xml/xmlText.js.map +1 -1
- package/src/v4/graphql/graphQLInteractionWithRequest.d.ts +4 -4
- package/src/v4/graphql/graphQLInteractionWithRequest.js +21 -17
- package/src/v4/graphql/graphQLInteractionWithRequest.js.map +1 -1
- package/src/v4/graphql/graphQLRequestBuilder.d.ts +3 -3
- package/src/v4/graphql/graphQLRequestBuilder.js +18 -20
- package/src/v4/graphql/graphQLRequestBuilder.js.map +1 -1
- package/src/v4/graphql/index.d.ts +6 -6
- package/src/v4/graphql/index.js +21 -17
- package/src/v4/graphql/index.js.map +1 -1
- package/src/v4/graphql/types.d.ts +5 -5
- package/src/v4/http/index.d.ts +2 -2
- package/src/v4/http/index.js +48 -93
- package/src/v4/http/index.js.map +1 -1
- package/src/v4/http/interactionWithCompleteRequest.d.ts +4 -7
- package/src/v4/http/interactionWithCompleteRequest.js +6 -10
- package/src/v4/http/interactionWithCompleteRequest.js.map +1 -1
- package/src/v4/http/interactionWithPlugin.d.ts +3 -3
- package/src/v4/http/interactionWithPlugin.js +14 -11
- package/src/v4/http/interactionWithPlugin.js.map +1 -1
- package/src/v4/http/interactionWithPluginRequest.d.ts +2 -2
- package/src/v4/http/interactionWithPluginRequest.js +11 -8
- package/src/v4/http/interactionWithPluginRequest.js.map +1 -1
- package/src/v4/http/interactionWithPluginResponse.d.ts +2 -2
- package/src/v4/http/interactionWithPluginResponse.js +10 -48
- package/src/v4/http/interactionWithPluginResponse.js.map +1 -1
- package/src/v4/http/interactionWithRequest.d.ts +2 -2
- package/src/v4/http/interactionWithRequest.js +11 -8
- package/src/v4/http/interactionWithRequest.js.map +1 -1
- package/src/v4/http/interactionWithResponse.d.ts +2 -2
- package/src/v4/http/interactionWithResponse.js +10 -48
- package/src/v4/http/interactionWithResponse.js.map +1 -1
- package/src/v4/http/requestBuilder.d.ts +3 -3
- package/src/v4/http/requestBuilder.js +32 -34
- package/src/v4/http/requestBuilder.js.map +1 -1
- package/src/v4/http/requestWithPluginBuilder.d.ts +2 -2
- package/src/v4/http/requestWithPluginBuilder.js +26 -46
- package/src/v4/http/requestWithPluginBuilder.js.map +1 -1
- package/src/v4/http/responseBuilder.d.ts +3 -3
- package/src/v4/http/responseBuilder.js +24 -25
- package/src/v4/http/responseBuilder.js.map +1 -1
- package/src/v4/http/responseWithPluginBuilder.d.ts +1 -1
- package/src/v4/http/responseWithPluginBuilder.js +5 -25
- package/src/v4/http/responseWithPluginBuilder.js.map +1 -1
- package/src/v4/http/types.d.ts +3 -2
- package/src/v4/http/unconfiguredInteraction.d.ts +6 -5
- package/src/v4/http/unconfiguredInteraction.js +31 -26
- package/src/v4/http/unconfiguredInteraction.js.map +1 -1
- package/src/v4/index.d.ts +4 -4
- package/src/v4/index.js +31 -35
- package/src/v4/index.js.map +1 -1
- package/src/v4/message/asynchronousMessage.d.ts +7 -6
- package/src/v4/message/asynchronousMessage.js +157 -190
- package/src/v4/message/asynchronousMessage.js.map +1 -1
- package/src/v4/message/index.d.ts +7 -6
- package/src/v4/message/index.js +188 -217
- package/src/v4/message/index.js.map +1 -1
- package/src/v4/message/types.d.ts +5 -3
- package/src/v4/types.d.ts +3 -3
|
@@ -1,52 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RequestBuilder = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
const ramda_1 = require("ramda");
|
|
5
|
+
const matchers_1 = require("../../v3/matchers");
|
|
6
|
+
const _1 = require(".");
|
|
7
|
+
const matchingRules_1 = require("../../common/matchingRules");
|
|
8
|
+
class RequestBuilder {
|
|
9
|
+
interaction;
|
|
9
10
|
// tslint:disable:no-empty-function
|
|
10
|
-
|
|
11
|
+
constructor(interaction) {
|
|
11
12
|
this.interaction = interaction;
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
(0, ramda_1.forEachObjIndexed)(function (v, k) {
|
|
14
|
+
query(query) {
|
|
15
|
+
(0, ramda_1.forEachObjIndexed)((v, k) => {
|
|
16
16
|
if (Array.isArray(v)) {
|
|
17
|
-
v.forEach(
|
|
18
|
-
|
|
17
|
+
v.forEach((vv, i) => {
|
|
18
|
+
this.interaction.withQuery(k, i, (0, matchers_1.matcherValueOrString)(vv));
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
21
|
else {
|
|
22
|
-
|
|
22
|
+
this.interaction.withQuery(k, 0, (0, matchers_1.matcherValueOrString)(v));
|
|
23
23
|
}
|
|
24
24
|
}, query);
|
|
25
25
|
return this;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
(0, ramda_1.forEachObjIndexed)(function (v, k) {
|
|
26
|
+
}
|
|
27
|
+
headers(headers) {
|
|
28
|
+
(0, ramda_1.forEachObjIndexed)((v, k) => {
|
|
30
29
|
if (Array.isArray(v)) {
|
|
31
|
-
v.forEach(
|
|
32
|
-
|
|
30
|
+
v.forEach((header, index) => {
|
|
31
|
+
this.interaction.withRequestHeader(`${k}`, index, (0, matchers_1.matcherValueOrString)(header));
|
|
33
32
|
});
|
|
34
33
|
}
|
|
35
34
|
else {
|
|
36
|
-
|
|
35
|
+
this.interaction.withRequestHeader(`${k}`, 0, (0, matchers_1.matcherValueOrString)(v));
|
|
37
36
|
}
|
|
38
37
|
}, headers);
|
|
39
38
|
return this;
|
|
40
|
-
}
|
|
41
|
-
|
|
39
|
+
}
|
|
40
|
+
jsonBody(body) {
|
|
42
41
|
this.interaction.withRequestBody((0, matchers_1.matcherValueOrString)(body), 'application/json');
|
|
43
42
|
return this;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
}
|
|
44
|
+
binaryFile(contentType, file) {
|
|
45
|
+
const body = (0, _1.readBinaryData)(file);
|
|
47
46
|
this.interaction.withRequestBinaryBody(body, contentType);
|
|
48
47
|
return this;
|
|
49
|
-
}
|
|
48
|
+
}
|
|
50
49
|
/**
|
|
51
50
|
* Sets the request body as multipart/form-data content.
|
|
52
51
|
* This is useful for testing APIs that accept file uploads or multipart form submissions.
|
|
@@ -57,10 +56,10 @@ var RequestBuilder = /** @class */ (function () {
|
|
|
57
56
|
* @param boundary - Optional boundary string for the multipart content. If not provided, will be passed as undefined.
|
|
58
57
|
* @returns The V4RequestBuilder instance for method chaining
|
|
59
58
|
*/
|
|
60
|
-
|
|
59
|
+
multipartBody(contentType, file, mimePartName, boundary) {
|
|
61
60
|
this.interaction.withRequestMultipartBody(contentType, file, mimePartName, boundary);
|
|
62
61
|
return this;
|
|
63
|
-
}
|
|
62
|
+
}
|
|
64
63
|
/**
|
|
65
64
|
* Applies matching rules to the consumer request.
|
|
66
65
|
* Matching rules allow you to define flexible matching criteria for request attributes
|
|
@@ -69,17 +68,16 @@ var RequestBuilder = /** @class */ (function () {
|
|
|
69
68
|
* @param rules - The matching rules as a strongly typed Rules object. Rules should follow the Pact matching rules format.
|
|
70
69
|
* @returns The V4RequestBuilder instance for method chaining
|
|
71
70
|
*/
|
|
72
|
-
|
|
71
|
+
matchingRules(rules) {
|
|
73
72
|
(0, matchingRules_1.validateRules)(rules);
|
|
74
|
-
|
|
73
|
+
const ffiRules = (0, matchingRules_1.convertRulesToFFI)(rules);
|
|
75
74
|
this.interaction.withRequestMatchingRules(JSON.stringify(ffiRules));
|
|
76
75
|
return this;
|
|
77
|
-
}
|
|
78
|
-
|
|
76
|
+
}
|
|
77
|
+
body(contentType, body) {
|
|
79
78
|
this.interaction.withRequestBinaryBody(body, contentType);
|
|
80
79
|
return this;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
}());
|
|
80
|
+
}
|
|
81
|
+
}
|
|
84
82
|
exports.RequestBuilder = RequestBuilder;
|
|
85
83
|
//# sourceMappingURL=requestBuilder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestBuilder.js","sourceRoot":"","sources":["../../../../src/v4/http/requestBuilder.ts"],"names":[],"mappings":";;;AACA
|
|
1
|
+
{"version":3,"file":"requestBuilder.js","sourceRoot":"","sources":["../../../../src/v4/http/requestBuilder.ts"],"names":[],"mappings":";;;AACA,iCAA0C;AAE1C,g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} from '../../v3';
|
|
2
2
|
import { RequestBuilder } from './requestBuilder';
|
|
3
|
-
import { V4RequestWithPluginBuilder } from './types';
|
|
3
|
+
import type { V4RequestWithPluginBuilder } from './types';
|
|
4
4
|
export declare class RequestWithPluginBuilder extends RequestBuilder implements V4RequestWithPluginBuilder {
|
|
5
5
|
pluginContents(contentType: string, contents: string): V4RequestWithPluginBuilder;
|
|
6
6
|
query(query: TemplateQuery): V4RequestWithPluginBuilder;
|
|
@@ -1,47 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
3
|
exports.RequestWithPluginBuilder = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
function RequestWithPluginBuilder() {
|
|
23
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
24
|
-
}
|
|
25
|
-
RequestWithPluginBuilder.prototype.pluginContents = function (contentType, contents) {
|
|
4
|
+
const requestBuilder_1 = require("./requestBuilder");
|
|
5
|
+
class RequestWithPluginBuilder extends requestBuilder_1.RequestBuilder {
|
|
6
|
+
pluginContents(contentType, contents) {
|
|
26
7
|
this.interaction.withPluginRequestInteractionContents(contentType, contents);
|
|
27
8
|
return this;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
9
|
+
}
|
|
10
|
+
query(query) {
|
|
11
|
+
super.query(query);
|
|
31
12
|
return this;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
13
|
+
}
|
|
14
|
+
headers(headers) {
|
|
15
|
+
super.headers(headers);
|
|
35
16
|
return this;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
17
|
+
}
|
|
18
|
+
jsonBody(body) {
|
|
19
|
+
super.jsonBody(body);
|
|
39
20
|
return this;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
21
|
+
}
|
|
22
|
+
binaryFile(contentType, file) {
|
|
23
|
+
super.binaryFile(contentType, file);
|
|
43
24
|
return this;
|
|
44
|
-
}
|
|
25
|
+
}
|
|
45
26
|
/**
|
|
46
27
|
* Sets the request body as multipart/form-data content for plugin-based interactions.
|
|
47
28
|
* This is useful for testing APIs that accept file uploads or multipart form submissions.
|
|
@@ -52,10 +33,10 @@ var RequestWithPluginBuilder = /** @class */ (function (_super) {
|
|
|
52
33
|
* @param boundary - Optional boundary string for the multipart content. If not provided, will be passed as undefined.
|
|
53
34
|
* @returns The V4RequestWithPluginBuilder instance for method chaining
|
|
54
35
|
*/
|
|
55
|
-
|
|
56
|
-
|
|
36
|
+
multipartBody(contentType, file, mimePartName, boundary) {
|
|
37
|
+
super.multipartBody(contentType, file, mimePartName, boundary);
|
|
57
38
|
return this;
|
|
58
|
-
}
|
|
39
|
+
}
|
|
59
40
|
/**
|
|
60
41
|
* Applies matching rules to the consumer request.
|
|
61
42
|
* Matching rules allow you to define flexible matching criteria for request attributes
|
|
@@ -64,15 +45,14 @@ var RequestWithPluginBuilder = /** @class */ (function (_super) {
|
|
|
64
45
|
* @param rules - The matching rules as a strongly typed Rules object. Rules should follow the Pact matching rules format.
|
|
65
46
|
* @returns The V4RequestWithPluginBuilder instance for method chaining
|
|
66
47
|
*/
|
|
67
|
-
|
|
68
|
-
|
|
48
|
+
matchingRules(rules) {
|
|
49
|
+
super.matchingRules(rules);
|
|
69
50
|
return this;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
51
|
+
}
|
|
52
|
+
body(contentType, body) {
|
|
53
|
+
super.body(contentType, body);
|
|
73
54
|
return this;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
}(requestBuilder_1.RequestBuilder));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
77
57
|
exports.RequestWithPluginBuilder = RequestWithPluginBuilder;
|
|
78
58
|
//# sourceMappingURL=requestWithPluginBuilder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestWithPluginBuilder.js","sourceRoot":"","sources":["../../../../src/v4/http/requestWithPluginBuilder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"requestWithPluginBuilder.js","sourceRoot":"","sources":["../../../../src/v4/http/requestWithPluginBuilder.ts"],"names":[],"mappings":";;;AACA,qDAAkD;AAGlD,MAAa,wBACX,SAAQ,+BAAc;IAGtB,cAAc,CACZ,WAAmB,EACnB,QAAgB;QAEhB,IAAI,CAAC,WAAW,CAAC,oCAAoC,CACnD,WAAW,EACX,QAAQ,CACT,CAAC;QAEF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,KAAoB;QACxB,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAEnB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CAAC,OAAwB;QAC9B,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAEvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,QAAQ,CAAC,IAAa;QACpB,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAErB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,UAAU,CAAC,WAAmB,EAAE,IAAY;QAC1C,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAEpC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;OASG;IACH,aAAa,CACX,WAAmB,EACnB,IAAY,EACZ,YAAoB,EACpB,QAAiB;QAEjB,KAAK,CAAC,aAAa,CAAC,WAAW,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;QAE/D,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;OAOG;IACH,aAAa,CAAC,KAAY;QACxB,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC,WAAmB,EAAE,IAAY;QACpC,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAE9B,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA/ED,4DA+EC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ConsumerInteraction } from '@pact-foundation/pact-core';
|
|
2
|
-
import { TemplateHeaders, Rules } from '../../v3';
|
|
3
|
-
import { V4ResponseBuilder } from './types';
|
|
1
|
+
import type { ConsumerInteraction } from '@pact-foundation/pact-core';
|
|
2
|
+
import type { TemplateHeaders, Rules } from '../../v3';
|
|
3
|
+
import type { V4ResponseBuilder } from './types';
|
|
4
4
|
export declare class ResponseBuilder implements V4ResponseBuilder {
|
|
5
5
|
protected interaction: ConsumerInteraction;
|
|
6
6
|
constructor(interaction: ConsumerInteraction);
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ResponseBuilder = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
const ramda_1 = require("ramda");
|
|
5
|
+
const _1 = require(".");
|
|
6
|
+
const matchers_1 = require("../../v3/matchers");
|
|
7
|
+
const matchingRules_1 = require("../../common/matchingRules");
|
|
8
|
+
class ResponseBuilder {
|
|
9
|
+
interaction;
|
|
10
|
+
constructor(interaction) {
|
|
10
11
|
this.interaction = interaction;
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
_this.interaction.withResponseHeader("".concat(k), 0, (0, matchers_1.matcherValueOrString)(v));
|
|
13
|
+
headers(headers) {
|
|
14
|
+
(0, ramda_1.forEachObjIndexed)((v, k) => {
|
|
15
|
+
this.interaction.withResponseHeader(`${k}`, 0, (0, matchers_1.matcherValueOrString)(v));
|
|
16
16
|
}, headers);
|
|
17
17
|
return this;
|
|
18
|
-
}
|
|
19
|
-
|
|
18
|
+
}
|
|
19
|
+
jsonBody(body) {
|
|
20
20
|
this.interaction.withResponseBody((0, matchers_1.matcherValueOrString)(body), 'application/json');
|
|
21
21
|
return this;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
}
|
|
23
|
+
binaryFile(contentType, file) {
|
|
24
|
+
const body = (0, _1.readBinaryData)(file);
|
|
25
25
|
this.interaction.withResponseBinaryBody(body, contentType);
|
|
26
26
|
return this;
|
|
27
|
-
}
|
|
27
|
+
}
|
|
28
28
|
/**
|
|
29
29
|
* Sets the response body as multipart/form-data content.
|
|
30
30
|
* This is useful for testing APIs that respond with multipart/form-data.
|
|
@@ -35,10 +35,10 @@ var ResponseBuilder = /** @class */ (function () {
|
|
|
35
35
|
* @param boundary - Optional boundary string for the multipart content. If not provided, will be passed as undefined.
|
|
36
36
|
* @returns The V4ResponseBuilder instance for method chaining
|
|
37
37
|
*/
|
|
38
|
-
|
|
38
|
+
multipartBody(contentType, file, mimePartName, boundary) {
|
|
39
39
|
this.interaction.withResponseMultipartBody(contentType, file, mimePartName, boundary);
|
|
40
40
|
return this;
|
|
41
|
-
}
|
|
41
|
+
}
|
|
42
42
|
/**
|
|
43
43
|
* Applies matching rules to the provider response.
|
|
44
44
|
* Matching rules allow you to define flexible matching criteria for response attributes
|
|
@@ -47,17 +47,16 @@ var ResponseBuilder = /** @class */ (function () {
|
|
|
47
47
|
* @param rules - The matching rules as a strongly typed Rules object. Rules should follow the Pact matching rules format.
|
|
48
48
|
* @returns The V4ResponseBuilder instance for method chaining
|
|
49
49
|
*/
|
|
50
|
-
|
|
50
|
+
matchingRules(rules) {
|
|
51
51
|
(0, matchingRules_1.validateRules)(rules);
|
|
52
|
-
|
|
52
|
+
const ffiRules = (0, matchingRules_1.convertRulesToFFI)(rules);
|
|
53
53
|
this.interaction.withResponseMatchingRules(JSON.stringify(ffiRules));
|
|
54
54
|
return this;
|
|
55
|
-
}
|
|
56
|
-
|
|
55
|
+
}
|
|
56
|
+
body(contentType, body) {
|
|
57
57
|
this.interaction.withResponseBinaryBody(body, contentType);
|
|
58
58
|
return this;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
}());
|
|
59
|
+
}
|
|
60
|
+
}
|
|
62
61
|
exports.ResponseBuilder = ResponseBuilder;
|
|
63
62
|
//# sourceMappingURL=responseBuilder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responseBuilder.js","sourceRoot":"","sources":["../../../../src/v4/http/responseBuilder.ts"],"names":[],"mappings":";;;AACA
|
|
1
|
+
{"version":3,"file":"responseBuilder.js","sourceRoot":"","sources":["../../../../src/v4/http/responseBuilder.ts"],"names":[],"mappings":";;;AACA,iCAA0C;AAC1C,wBAAmC;AAEnC,gDAAyD;AAEzD,8DAA8E;AAE9E,MAAa,eAAe;IAChB,WAAW,CAAsB;IAE3C,YAAY,WAAgC;QAC1C,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED,OAAO,CAAC,OAAwB;QAC9B,IAAA,yBAAiB,EAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YACzB,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE,IAAA,+BAAoB,EAA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V4ResponseBuilder } from './types';
|
|
2
|
+
import type { V4ResponseWithPluginBuilder, V4ResponseBuilder } from './types';
|
|
3
3
|
export declare class ResponseWithPluginBuilder extends ResponseBuilder implements V4ResponseWithPluginBuilder {
|
|
4
4
|
pluginContents(contentType: string, contents: string): V4ResponseBuilder;
|
|
5
5
|
}
|
|
@@ -1,32 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
3
|
exports.ResponseWithPluginBuilder = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
function ResponseWithPluginBuilder() {
|
|
23
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
24
|
-
}
|
|
25
|
-
ResponseWithPluginBuilder.prototype.pluginContents = function (contentType, contents) {
|
|
4
|
+
const responseBuilder_1 = require("./responseBuilder");
|
|
5
|
+
class ResponseWithPluginBuilder extends responseBuilder_1.ResponseBuilder {
|
|
6
|
+
pluginContents(contentType, contents) {
|
|
26
7
|
this.interaction.withPluginResponseInteractionContents(contentType, contents);
|
|
27
8
|
return this;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
}(responseBuilder_1.ResponseBuilder));
|
|
9
|
+
}
|
|
10
|
+
}
|
|
31
11
|
exports.ResponseWithPluginBuilder = ResponseWithPluginBuilder;
|
|
32
12
|
//# sourceMappingURL=responseWithPluginBuilder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responseWithPluginBuilder.js","sourceRoot":"","sources":["../../../../src/v4/http/responseWithPluginBuilder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"responseWithPluginBuilder.js","sourceRoot":"","sources":["../../../../src/v4/http/responseWithPluginBuilder.ts"],"names":[],"mappings":";;;AAAA,uDAAoD;AAGpD,MAAa,yBACX,SAAQ,iCAAe;IAGvB,cAAc,CAAC,WAAmB,EAAE,QAAgB;QAClD,IAAI,CAAC,WAAW,CAAC,qCAAqC,CACpD,WAAW,EACX,QAAQ,CACT,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAXD,8DAWC"}
|
package/src/v4/http/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { JsonMap } from '../../common/jsonTypes';
|
|
2
|
-
import { Matcher, Path, Rules, SpecificationVersion, TemplateHeaders, TemplateQuery, V3MockServer, V3ProviderState, V3Request, V3Response } from '../../v3';
|
|
1
|
+
import type { JsonMap } from '../../common/jsonTypes';
|
|
2
|
+
import type { Matcher, Path, Rules, SpecificationVersion, TemplateHeaders, TemplateQuery, V3MockServer, V3ProviderState, V3Request, V3Response } from '../../v3';
|
|
3
3
|
export type V4ProviderState = V3ProviderState;
|
|
4
4
|
export type V4MockServer = V3MockServer;
|
|
5
5
|
export type V4Request = V3Request;
|
|
@@ -50,6 +50,7 @@ export interface V4UnconfiguredInteraction {
|
|
|
50
50
|
pending(pending?: boolean): V4UnconfiguredInteraction;
|
|
51
51
|
comment(comment: Comment | CustomComment): V4UnconfiguredInteraction;
|
|
52
52
|
testName(name: string): V4UnconfiguredInteraction;
|
|
53
|
+
reference(group: string, name: string, value: string): V4UnconfiguredInteraction;
|
|
53
54
|
withCompleteRequest(request: V4Request): V4InteractionWithCompleteRequest;
|
|
54
55
|
withRequest(method: string, path: Path, builder?: V4RequestBuilderFunc): V4InteractionWithRequest;
|
|
55
56
|
usingPlugin(config: PluginConfig): V4InteractionWithPlugin;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ConsumerPact, ConsumerInteraction } from '@pact-foundation/pact-core';
|
|
2
|
-
import { JsonMap } from '../../common/jsonTypes';
|
|
3
|
-
import { Path } from '../../v3';
|
|
4
|
-
import { V4UnconfiguredInteraction, PactV4Options, V4Request, V4InteractionWithCompleteRequest, V4RequestBuilderFunc, V4InteractionWithRequest, PluginConfig, V4InteractionWithPlugin, Comment, CustomComment } from './types';
|
|
1
|
+
import type { ConsumerPact, ConsumerInteraction } from '@pact-foundation/pact-core';
|
|
2
|
+
import type { JsonMap } from '../../common/jsonTypes';
|
|
3
|
+
import type { Path } from '../../v3';
|
|
4
|
+
import type { V4UnconfiguredInteraction, PactV4Options, V4Request, V4InteractionWithCompleteRequest, V4RequestBuilderFunc, V4InteractionWithRequest, PluginConfig, V4InteractionWithPlugin, Comment, CustomComment } from './types';
|
|
5
5
|
export declare class UnconfiguredInteraction implements V4UnconfiguredInteraction {
|
|
6
6
|
protected pact: ConsumerPact;
|
|
7
7
|
protected interaction: ConsumerInteraction;
|
|
@@ -13,7 +13,8 @@ export declare class UnconfiguredInteraction implements V4UnconfiguredInteractio
|
|
|
13
13
|
pending(pending?: boolean): V4UnconfiguredInteraction;
|
|
14
14
|
comment(comment: Comment | CustomComment): V4UnconfiguredInteraction;
|
|
15
15
|
testName(name: string): V4UnconfiguredInteraction;
|
|
16
|
-
|
|
16
|
+
reference(group: string, name: string, value: string): V4UnconfiguredInteraction;
|
|
17
|
+
withCompleteRequest(_request: V4Request): V4InteractionWithCompleteRequest;
|
|
17
18
|
withRequest(method: string, path: Path, builder?: V4RequestBuilderFunc): V4InteractionWithRequest;
|
|
18
19
|
usingPlugin(config: PluginConfig): V4InteractionWithPlugin;
|
|
19
20
|
}
|
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UnconfiguredInteraction = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
const interactionWithPlugin_1 = require("./interactionWithPlugin");
|
|
5
|
+
const requestBuilder_1 = require("./requestBuilder");
|
|
6
|
+
const interactionWithRequest_1 = require("./interactionWithRequest");
|
|
7
|
+
const matchers_1 = require("../../v3/matchers");
|
|
8
|
+
class UnconfiguredInteraction {
|
|
9
|
+
pact;
|
|
10
|
+
interaction;
|
|
11
|
+
opts;
|
|
12
|
+
cleanupFn;
|
|
9
13
|
// tslint:disable:no-empty-function
|
|
10
|
-
|
|
14
|
+
constructor(pact, interaction, opts, cleanupFn) {
|
|
11
15
|
this.pact = pact;
|
|
12
16
|
this.interaction = interaction;
|
|
13
17
|
this.opts = opts;
|
|
14
18
|
this.cleanupFn = cleanupFn;
|
|
15
19
|
}
|
|
16
|
-
|
|
20
|
+
uponReceiving(description) {
|
|
17
21
|
this.interaction.uponReceiving(description);
|
|
18
22
|
return this;
|
|
19
|
-
}
|
|
20
|
-
|
|
23
|
+
}
|
|
24
|
+
given(state, parameters) {
|
|
21
25
|
if (parameters) {
|
|
22
26
|
this.interaction.givenWithParams(state, JSON.stringify(parameters));
|
|
23
27
|
}
|
|
@@ -25,40 +29,41 @@ var UnconfiguredInteraction = /** @class */ (function () {
|
|
|
25
29
|
this.interaction.given(state);
|
|
26
30
|
}
|
|
27
31
|
return this;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (pending === void 0) { pending = true; }
|
|
32
|
+
}
|
|
33
|
+
pending(pending = true) {
|
|
31
34
|
this.interaction.setPending(pending);
|
|
32
35
|
return this;
|
|
33
|
-
}
|
|
34
|
-
|
|
36
|
+
}
|
|
37
|
+
comment(comment) {
|
|
35
38
|
if (typeof comment === 'string') {
|
|
36
39
|
this.interaction.addTextComment(comment);
|
|
37
40
|
return this;
|
|
38
41
|
}
|
|
39
42
|
this.interaction.setComment(comment.key, comment.value);
|
|
40
43
|
return this;
|
|
41
|
-
}
|
|
42
|
-
|
|
44
|
+
}
|
|
45
|
+
testName(name) {
|
|
43
46
|
this.interaction.setInteractionTestName(name);
|
|
44
47
|
return this;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
}
|
|
49
|
+
reference(group, name, value) {
|
|
50
|
+
this.interaction.addInteractionReference(group, name, value);
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
withCompleteRequest(_request) {
|
|
48
54
|
throw new Error('withCompleteRequest is not implemented');
|
|
49
|
-
}
|
|
50
|
-
|
|
55
|
+
}
|
|
56
|
+
withRequest(method, path, builder) {
|
|
51
57
|
this.interaction.withRequest(method, (0, matchers_1.matcherValueOrString)(path));
|
|
52
58
|
if (builder) {
|
|
53
59
|
builder(new requestBuilder_1.RequestBuilder(this.interaction));
|
|
54
60
|
}
|
|
55
61
|
return new interactionWithRequest_1.InteractionWithRequest(this.pact, this.interaction, this.opts, this.cleanupFn);
|
|
56
|
-
}
|
|
57
|
-
|
|
62
|
+
}
|
|
63
|
+
usingPlugin(config) {
|
|
58
64
|
this.pact.addPlugin(config.plugin, config.version);
|
|
59
65
|
return new interactionWithPlugin_1.InteractionWithPlugin(this.pact, this.interaction, this.opts, this.cleanupFn);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
}());
|
|
66
|
+
}
|
|
67
|
+
}
|
|
63
68
|
exports.UnconfiguredInteraction = UnconfiguredInteraction;
|
|
64
69
|
//# sourceMappingURL=unconfiguredInteraction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unconfiguredInteraction.js","sourceRoot":"","sources":["../../../../src/v4/http/unconfiguredInteraction.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"unconfiguredInteraction.js","sourceRoot":"","sources":["../../../../src/v4/http/unconfiguredInteraction.ts"],"names":[],"mappings":";;;AAIA,mEAAgE;AAChE,qDAAkD;AAClD,qEAAkE;AAGlE,gDAAyD;AAczD,MAAa,uBAAuB;IAGtB;IACA;IACA;IACA;IALZ,mCAAmC;IACnC,YACY,IAAkB,EAClB,WAAgC,EAChC,IAAmB,EACnB,SAAqB;QAHrB,SAAI,GAAJ,IAAI,CAAc;QAClB,gBAAW,GAAX,WAAW,CAAqB;QAChC,SAAI,GAAJ,IAAI,CAAe;QACnB,cAAS,GAAT,SAAS,CAAY;IAC9B,CAAC;IAEJ,aAAa,CAAC,WAAmB;QAC/B,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;QAE5C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,KAAa,EAAE,UAAoB;QACvC,IAAI,UAAU,EAAE,CAAC;YACf,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;QACtE,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CAAC,OAAO,GAAG,IAAI;QACpB,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAErC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CAAC,OAAgC;QACtC,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAChC,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;YACzC,OAAO,IAAI,CAAC;QACd,CAAC;QAED,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,KAAK,CAAC,CAA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erPact } from './types';
|
|
3
|
-
import { V4UnconfiguredAsynchronousMessage, V4UnconfiguredSynchronousMessage } from './message/types';
|
|
4
|
-
import { V4UnconfiguredGraphQLInteraction } from './graphql/types';
|
|
1
|
+
import { PactV4Options, type V4UnconfiguredInteraction } from './http/types';
|
|
2
|
+
import type { V4ConsumerPact } from './types';
|
|
3
|
+
import type { V4UnconfiguredAsynchronousMessage, V4UnconfiguredSynchronousMessage } from './message/types';
|
|
4
|
+
import type { V4UnconfiguredGraphQLInteraction } from './graphql/types';
|
|
5
5
|
export declare class PactV4 implements V4ConsumerPact {
|
|
6
6
|
private opts;
|
|
7
7
|
private pact;
|