@pact-foundation/pact 16.3.1 → 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 +7 -0
- package/CONTRIBUTING.md +2 -2
- package/package.json +16 -24
- 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 +243 -313
- 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.js +15 -15
- package/src/v3/ffi.js.map +1 -1
- package/src/v3/ffi.spec.js +8 -8
- package/src/v3/ffi.spec.js.map +1 -1
- 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
package/src/v3/xml/xmlElement.js
CHANGED
|
@@ -1,53 +1,38 @@
|
|
|
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.XmlElement = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
4
|
+
const matchers_1 = require("../matchers");
|
|
5
|
+
const xmlNode_1 = require("./xmlNode");
|
|
6
|
+
const xmlText_1 = require("./xmlText");
|
|
7
|
+
const modifyElementWithCallback = (el, cb) => {
|
|
23
8
|
if (cb) {
|
|
24
9
|
cb(el);
|
|
25
10
|
}
|
|
26
11
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
12
|
+
class XmlElement extends xmlNode_1.XmlNode {
|
|
13
|
+
name;
|
|
14
|
+
children = [];
|
|
15
|
+
attributes;
|
|
16
|
+
constructor(name) {
|
|
17
|
+
super();
|
|
18
|
+
this.name = name;
|
|
34
19
|
}
|
|
35
|
-
|
|
20
|
+
setName(name) {
|
|
36
21
|
this.name = name;
|
|
37
22
|
return this;
|
|
38
|
-
}
|
|
39
|
-
|
|
23
|
+
}
|
|
24
|
+
setAttributes(attributes) {
|
|
40
25
|
this.attributes = attributes;
|
|
41
26
|
return this;
|
|
42
|
-
}
|
|
27
|
+
}
|
|
43
28
|
/**
|
|
44
29
|
* Creates a new element with the given name and attributes and then sets it's text content (can be a matcher)
|
|
45
30
|
* @param name Element name
|
|
46
31
|
* @param attributes Map of element attributes
|
|
47
32
|
* @param arg Callback to configure the new element, or text content to create the new element with (can be a matcher)
|
|
48
33
|
*/
|
|
49
|
-
|
|
50
|
-
|
|
34
|
+
appendElement(name, attributes, arg) {
|
|
35
|
+
const el = new XmlElement(name).setAttributes(attributes);
|
|
51
36
|
if (arg) {
|
|
52
37
|
if (typeof arg !== 'function') {
|
|
53
38
|
el.appendText(arg);
|
|
@@ -58,8 +43,8 @@ var XmlElement = /** @class */ (function (_super) {
|
|
|
58
43
|
}
|
|
59
44
|
this.children.push(el);
|
|
60
45
|
return this;
|
|
61
|
-
}
|
|
62
|
-
|
|
46
|
+
}
|
|
47
|
+
appendText(content) {
|
|
63
48
|
if (typeof content === 'object' && content['pact:matcher:type']) {
|
|
64
49
|
this.children.push(new xmlText_1.XmlText((0, matchers_1.isMatcher)(content) &&
|
|
65
50
|
'value' in content &&
|
|
@@ -72,10 +57,9 @@ var XmlElement = /** @class */ (function (_super) {
|
|
|
72
57
|
this.children.push(new xmlText_1.XmlText(content.toString()));
|
|
73
58
|
}
|
|
74
59
|
return this;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
var el = new XmlElement(name).setAttributes(attributes);
|
|
60
|
+
}
|
|
61
|
+
eachLike(name, attributes, cb, options = { examples: 1 }) {
|
|
62
|
+
const el = new XmlElement(name).setAttributes(attributes);
|
|
79
63
|
modifyElementWithCallback(el, cb);
|
|
80
64
|
this.children.push({
|
|
81
65
|
'pact:matcher:type': 'type',
|
|
@@ -83,8 +67,7 @@ var XmlElement = /** @class */ (function (_super) {
|
|
|
83
67
|
examples: options.examples,
|
|
84
68
|
});
|
|
85
69
|
return this;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
}(xmlNode_1.XmlNode));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
89
72
|
exports.XmlElement = XmlElement;
|
|
90
73
|
//# sourceMappingURL=xmlElement.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xmlElement.js","sourceRoot":"","sources":["../../../../src/v3/xml/xmlElement.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"xmlElement.js","sourceRoot":"","sources":["../../../../src/v3/xml/xmlElement.ts"],"names":[],"mappings":";;;AAAA,0CAAwC;AAExC,uCAAoC;AACpC,uCAAoC;AAKpC,MAAM,yBAAyB,GAAG,CAAC,EAAc,EAAE,EAAgB,EAAE,EAAE;IACrE,IAAI,EAAE,EAAE,CAAC;QACP,EAAE,CAAC,EAAE,CAAC,CAAC;IACT,CAAC;AACH,CAAC,CAAC;AACF,MAAa,UAAW,SAAQ,iBAAO;IAIlB;IAHnB,QAAQ,GAAc,EAAE,CAAC;IACzB,UAAU,CAAiB;IAE3B,YAAmB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iBAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;QACtD,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,QAAQ,CACb,IAAY,EACZ,UAAyB,EACzB,EAAgB,EAChB,UAA2B,EAAE,QAAQ,EAAE,CAAC,EAAE;QAE1C,MAAM,EAAE,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QAC1D,yBAAyB,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAClC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;YACjB,mBAAmB,EAAE,MAAM;YAC3B,KAAK,EAAE,EAAE;YACT,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC3B,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA/ED,gCA+EC"}
|
|
@@ -33,16 +33,16 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
(0, mocha_1.describe)('xml element',
|
|
43
|
-
(0, mocha_1.describe)('appendText',
|
|
44
|
-
it('can be called with a string',
|
|
45
|
-
|
|
36
|
+
const chai = __importStar(require("chai"));
|
|
37
|
+
const mocha_1 = require("mocha");
|
|
38
|
+
const xmlText_1 = require("./xmlText");
|
|
39
|
+
const xmlElement_1 = require("./xmlElement");
|
|
40
|
+
const MatchersV3 = __importStar(require("../matchers"));
|
|
41
|
+
const { expect } = chai;
|
|
42
|
+
(0, mocha_1.describe)('xml element', () => {
|
|
43
|
+
(0, mocha_1.describe)('appendText', () => {
|
|
44
|
+
it('can be called with a string', () => {
|
|
45
|
+
const xml = new xmlElement_1.XmlElement('my name')
|
|
46
46
|
.appendText('some string')
|
|
47
47
|
.appendText('second string');
|
|
48
48
|
expect(xml, 'XML element').to.have.property('name');
|
|
@@ -56,9 +56,8 @@ var expect = chai.expect;
|
|
|
56
56
|
expect(xml.children[0].matcher, 'matcher of the first child')
|
|
57
57
|
.to.be.undefined;
|
|
58
58
|
});
|
|
59
|
-
it('can be called with a Matcher',
|
|
60
|
-
|
|
61
|
-
var xml = new xmlElement_1.XmlElement('my name')
|
|
59
|
+
it('can be called with a Matcher', () => {
|
|
60
|
+
const xml = new xmlElement_1.XmlElement('my name')
|
|
62
61
|
.appendText(MatchersV3.string('string matcher'))
|
|
63
62
|
.appendText(MatchersV3.regex(/^.*$/, 'regex matcher'))
|
|
64
63
|
.appendText(MatchersV3.date('yyyy-MM-dd HH:mm:ss.SSSX', '2016-02-11T09:46:56.023Z'))
|
|
@@ -70,34 +69,33 @@ var expect = chai.expect;
|
|
|
70
69
|
expect(xml.name, 'name of XML element').to.equal('my name');
|
|
71
70
|
expect(xml, 'XML element').to.have.property('children');
|
|
72
71
|
expect(xml.children, 'children of XML element').to.be.lengthOf(7);
|
|
73
|
-
for (
|
|
74
|
-
|
|
72
|
+
for (let i = 0; i < 7; i += 1) {
|
|
73
|
+
const child = xml.children[i];
|
|
75
74
|
expect(child).to.be.instanceOf(xmlText_1.XmlText);
|
|
76
75
|
expect(child).to.have.property('content');
|
|
77
76
|
expect(child.content).not.to.be.empty;
|
|
78
77
|
expect(child.content).to.be.a('string');
|
|
79
78
|
expect(child).to.have.property('matcher');
|
|
80
79
|
expect(child.matcher).to.have.property('value');
|
|
81
|
-
expect(
|
|
82
|
-
expect(
|
|
80
|
+
expect(child.matcher?.value).to.be.a('string');
|
|
81
|
+
expect(child.matcher?.value).not.to.be.empty;
|
|
83
82
|
expect(child.matcher).to.have.property('pact:matcher:type');
|
|
84
|
-
expect(
|
|
85
|
-
expect(
|
|
83
|
+
expect(child.matcher?.['pact:matcher:type']).to.be.a('string');
|
|
84
|
+
expect(child.matcher?.['pact:matcher:type']).not.to.be.empty;
|
|
86
85
|
}
|
|
87
86
|
});
|
|
88
|
-
it('sets content to an empty string if the Matcher has no value',
|
|
89
|
-
var _a, _b;
|
|
87
|
+
it('sets content to an empty string if the Matcher has no value', () => {
|
|
90
88
|
function noValueMatcher() {
|
|
91
89
|
return {
|
|
92
90
|
'pact:matcher:type': 'no-value',
|
|
93
91
|
};
|
|
94
92
|
}
|
|
95
|
-
|
|
93
|
+
const xml = new xmlElement_1.XmlElement('my name').appendText(noValueMatcher());
|
|
96
94
|
expect(xml, 'XML element').to.have.property('name');
|
|
97
95
|
expect(xml.name, 'name of XML element').to.equal('my name');
|
|
98
96
|
expect(xml, 'XML element').to.have.property('children');
|
|
99
97
|
expect(xml.children, 'children of XML element').to.be.lengthOf(1);
|
|
100
|
-
|
|
98
|
+
const child = xml.children[0];
|
|
101
99
|
expect(child).to.be.instanceOf(xmlText_1.XmlText);
|
|
102
100
|
expect(child).to.have.property('content');
|
|
103
101
|
expect(child.content).to.be.empty;
|
|
@@ -105,8 +103,8 @@ var expect = chai.expect;
|
|
|
105
103
|
expect(child).to.have.property('matcher');
|
|
106
104
|
expect(child.matcher).not.to.have.property('value');
|
|
107
105
|
expect(child.matcher).to.have.property('pact:matcher:type');
|
|
108
|
-
expect(
|
|
109
|
-
expect(
|
|
106
|
+
expect(child.matcher?.['pact:matcher:type']).to.be.a('string');
|
|
107
|
+
expect(child.matcher?.['pact:matcher:type']).not.to.be.empty;
|
|
110
108
|
});
|
|
111
109
|
});
|
|
112
110
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xmlElement.spec.js","sourceRoot":"","sources":["../../../../src/v3/xml/xmlElement.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"xmlElement.spec.js","sourceRoot":"","sources":["../../../../src/v3/xml/xmlElement.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;A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AC;YAClC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;YACxC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;YAC1C,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YACpD,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;YAC5D,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;YAC/D,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;QAC/D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/src/v3/xml/xmlNode.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.XmlNode = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
return XmlNode;
|
|
8
|
-
}());
|
|
4
|
+
class XmlNode {
|
|
5
|
+
}
|
|
9
6
|
exports.XmlNode = XmlNode;
|
|
10
7
|
//# sourceMappingURL=xmlNode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xmlNode.js","sourceRoot":"","sources":["../../../../src/v3/xml/xmlNode.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"xmlNode.js","sourceRoot":"","sources":["../../../../src/v3/xml/xmlNode.ts"],"names":[],"mappings":";;;AAAA,MAAa,OAAO;CAAG;AAAvB,0BAAuB"}
|
package/src/v3/xml/xmlText.d.ts
CHANGED
package/src/v3/xml/xmlText.js
CHANGED
|
@@ -1,31 +1,15 @@
|
|
|
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.XmlText = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
4
|
+
const xmlNode_1 = require("./xmlNode");
|
|
5
|
+
class XmlText extends xmlNode_1.XmlNode {
|
|
6
|
+
content;
|
|
7
|
+
matcher;
|
|
8
|
+
constructor(content, matcher) {
|
|
9
|
+
super();
|
|
10
|
+
this.content = content;
|
|
11
|
+
this.matcher = matcher;
|
|
27
12
|
}
|
|
28
|
-
|
|
29
|
-
}(xmlNode_1.XmlNode));
|
|
13
|
+
}
|
|
30
14
|
exports.XmlText = XmlText;
|
|
31
15
|
//# sourceMappingURL=xmlText.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xmlText.js","sourceRoot":"","sources":["../../../../src/v3/xml/xmlText.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"xmlText.js","sourceRoot":"","sources":["../../../../src/v3/xml/xmlText.ts"],"names":[],"mappings":";;;AACA,uCAAoC;AAEpC,MAAa,OAAQ,SAAQ,iBAAO;IAEzB;IACA;IAFT,YACS,OAAe,EACf,OAAyB;QAEhC,KAAK,EAAE,CAAC;QAHD,YAAO,GAAP,OAAO,CAAQ;QACf,YAAO,GAAP,OAAO,CAAkB;IAGlC,CAAC;CACF;AAPD,0BAOC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ConsumerPact, ConsumerInteraction } from '@pact-foundation/pact-core';
|
|
2
|
-
import { ASTNode } from 'graphql';
|
|
3
|
-
import { PactV4Options, V4InteractionWithRequest } from '../http/types';
|
|
4
|
-
import { V4GraphQLInteractionWithRequest, GraphqlRequest } from './types';
|
|
1
|
+
import type { ConsumerPact, ConsumerInteraction } from '@pact-foundation/pact-core';
|
|
2
|
+
import type { ASTNode } from 'graphql';
|
|
3
|
+
import type { PactV4Options, V4InteractionWithRequest } from '../http/types';
|
|
4
|
+
import { type V4GraphQLInteractionWithRequest, type GraphqlRequest } from './types';
|
|
5
5
|
export declare class GraphQLInteractionWithRequest implements V4GraphQLInteractionWithRequest {
|
|
6
6
|
protected pact: ConsumerPact;
|
|
7
7
|
protected interaction: ConsumerInteraction;
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GraphQLInteractionWithRequest = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const ramda_1 = require("ramda");
|
|
6
|
+
const graphQL_1 = require("../../common/graphQL/graphQL");
|
|
7
|
+
const interactionWithRequest_1 = require("../http/interactionWithRequest");
|
|
8
|
+
const types_1 = require("./types");
|
|
9
|
+
const matchers_1 = require("../../v3/matchers");
|
|
10
|
+
class GraphQLInteractionWithRequest {
|
|
11
|
+
pact;
|
|
12
|
+
interaction;
|
|
13
|
+
opts;
|
|
14
|
+
cleanupFn;
|
|
15
|
+
graphQLRequest;
|
|
11
16
|
// tslint:disable:no-empty-function
|
|
12
|
-
|
|
17
|
+
constructor(pact, interaction, opts, cleanupFn, graphQLRequest) {
|
|
13
18
|
this.pact = pact;
|
|
14
19
|
this.interaction = interaction;
|
|
15
20
|
this.opts = opts;
|
|
@@ -36,22 +41,21 @@ var GraphQLInteractionWithRequest = /** @class */ (function () {
|
|
|
36
41
|
* @param query {string|ASTNode} parsed or unparsed query
|
|
37
42
|
* @return this object
|
|
38
43
|
*/
|
|
39
|
-
|
|
44
|
+
withQuery(query) {
|
|
40
45
|
return this.setQueryDetails(query, types_1.OperationType.Query);
|
|
41
|
-
}
|
|
42
|
-
|
|
46
|
+
}
|
|
47
|
+
withMutation(mutation) {
|
|
43
48
|
return this.setQueryDetails(mutation, types_1.OperationType.Mutation);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
49
|
+
}
|
|
50
|
+
setQueryDetails(query, type) {
|
|
51
|
+
const validatedQuery = (0, graphQL_1.validateQuery)(query, type);
|
|
47
52
|
this.interaction.withRequestBody(JSON.stringify((0, ramda_1.reject)(lodash_1.isUndefined, {
|
|
48
53
|
operationName: this.graphQLRequest.operation,
|
|
49
54
|
query: (0, matchers_1.regex)((0, graphQL_1.escapeGraphQlQuery)(validatedQuery), validatedQuery),
|
|
50
55
|
variables: this.graphQLRequest.variables,
|
|
51
56
|
})), 'application/json');
|
|
52
57
|
return new interactionWithRequest_1.InteractionWithRequest(this.pact, this.interaction, this.opts, this.cleanupFn);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
}());
|
|
58
|
+
}
|
|
59
|
+
}
|
|
56
60
|
exports.GraphQLInteractionWithRequest = GraphQLInteractionWithRequest;
|
|
57
61
|
//# sourceMappingURL=graphQLInteractionWithRequest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphQLInteractionWithRequest.js","sourceRoot":"","sources":["../../../../src/v4/graphql/graphQLInteractionWithRequest.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"graphQLInteractionWithRequest.js","sourceRoot":"","sources":["../../../../src/v4/graphql/graphQLInteractionWithRequest.ts"],"names":[],"mappings":";;;AAKA,mCAAqC;AACrC,iCAA+B;AAE/B,0DAGsC;AACtC,2EAAwE;AAExE,mCAIiB;AACjB,gDAA0C;AAE1C,MAAa,6BAA6B;IAK5B;IACA;IACA;IACA;IACA;IANZ,mCAAmC;IACnC,YACY,IAAkB,EAClB,WAAgC,EAChC,IAAmB,EACnB,SAAqB,EACrB,cAA8B;QAJ9B,SAAI,GAAJ,IAAI,CAAc;QAClB,gBAAW,GAAX,WAAW,CAAqB;QAChC,SAAI,GAAJ,IAAI,CAAe;QACnB,cAAS,GAAT,SAAS,CAAY;QACrB,mBAAc,GAAd,cAAc,CAAgB;IACvC,CAAC;IAEJ;;;;;;;;;;;;;;;;;;;OAmBG;IACH,SAAS,CAAC,KAAuB;QAC/B,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,qBAAa,CAAC,KAAK,CAAC,CAAC;IAC1D,CAAC;IAED,YAAY,CAAC,QAA0B;QACrC,OAAO,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,qBAAa,CAAC,QAAQ,CAAC,CAAC;IAChE,CAAC;IAEO,eAAe,CACrB,KAAuB,EACvB,IAAmB;QAEnB,MAAM,cAAc,GAAG,IAAA,uBAAa,EAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAElD,IAAI,CAAC,WAAW,CAAC,eAAe,CAC9B,IAAI,CAAC,SAAS,CACZ,IAAA,cAAM,EAAC,oBAAW,EAAE;YAClB,aAAa,EAAE,IAAI,CAAC,cAAc,CAAC,SAAS;YAC5C,KAAK,EAAE,IAAA,gBAAK,EAAC,IAAA,4BAAkB,EAAC,cAAc,CAAC,EAAE,cAAc,CAAC;YAChE,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,SAAS;SACzC,CAAC,CACH,EACD,kBAAkB,CACnB,CAAC;QAEF,OAAO,IAAI,+CAAsB,CAC/B,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,SAAS,CACf,CAAC;IACJ,CAAC;CACF;AAhED,sEAgEC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ConsumerInteraction } from '@pact-foundation/pact-core';
|
|
2
|
-
import { TemplateQuery, TemplateHeaders } from '../../v3';
|
|
3
|
-
import { V4GraphQLRequestBuilder } from './types';
|
|
1
|
+
import type { ConsumerInteraction } from '@pact-foundation/pact-core';
|
|
2
|
+
import type { TemplateQuery, TemplateHeaders } from '../../v3';
|
|
3
|
+
import type { V4GraphQLRequestBuilder } from './types';
|
|
4
4
|
export declare class GraphQLRequestBuilder implements V4GraphQLRequestBuilder {
|
|
5
5
|
protected interaction: ConsumerInteraction;
|
|
6
6
|
constructor(interaction: ConsumerInteraction);
|
|
@@ -1,42 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GraphQLRequestBuilder = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const ramda_1 = require("ramda");
|
|
5
|
+
const matchers_1 = require("../../v3/matchers");
|
|
6
|
+
class GraphQLRequestBuilder {
|
|
7
|
+
interaction;
|
|
7
8
|
// tslint:disable:no-empty-function
|
|
8
|
-
|
|
9
|
+
constructor(interaction) {
|
|
9
10
|
this.interaction = interaction;
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
(0, ramda_1.forEachObjIndexed)(function (v, k) {
|
|
12
|
+
query(query) {
|
|
13
|
+
(0, ramda_1.forEachObjIndexed)((v, k) => {
|
|
14
14
|
if (Array.isArray(v)) {
|
|
15
|
-
v.forEach(
|
|
16
|
-
|
|
15
|
+
v.forEach((vv, i) => {
|
|
16
|
+
this.interaction.withQuery(k, i, (0, matchers_1.matcherValueOrString)(vv));
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
else {
|
|
20
|
-
|
|
20
|
+
this.interaction.withQuery(k, 0, (0, matchers_1.matcherValueOrString)(v));
|
|
21
21
|
}
|
|
22
22
|
}, query);
|
|
23
23
|
return this;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
(0, ramda_1.forEachObjIndexed)(function (v, k) {
|
|
24
|
+
}
|
|
25
|
+
headers(headers) {
|
|
26
|
+
(0, ramda_1.forEachObjIndexed)((v, k) => {
|
|
28
27
|
if (Array.isArray(v)) {
|
|
29
|
-
v.forEach(
|
|
30
|
-
|
|
28
|
+
v.forEach((header, index) => {
|
|
29
|
+
this.interaction.withRequestHeader(`${k}`, index, (0, matchers_1.matcherValueOrString)(header));
|
|
31
30
|
});
|
|
32
31
|
}
|
|
33
32
|
else {
|
|
34
|
-
|
|
33
|
+
this.interaction.withRequestHeader(`${k}`, 0, (0, matchers_1.matcherValueOrString)(v));
|
|
35
34
|
}
|
|
36
35
|
}, headers);
|
|
37
36
|
return this;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
}());
|
|
37
|
+
}
|
|
38
|
+
}
|
|
41
39
|
exports.GraphQLRequestBuilder = GraphQLRequestBuilder;
|
|
42
40
|
//# sourceMappingURL=graphQLRequestBuilder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphQLRequestBuilder.js","sourceRoot":"","sources":["../../../../src/v4/graphql/graphQLRequestBuilder.ts"],"names":[],"mappings":";;;AACA
|
|
1
|
+
{"version":3,"file":"graphQLRequestBuilder.js","sourceRoot":"","sources":["../../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AAA,+BAAoB,EAAC,CAAC,CAAC,CAAC,CAAC;YACzE,CAAC;QACH,CAAC,EAAE,OAAO,CAAC,CAAC;QAEZ,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AArCD,sDAqCC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ConsumerInteraction, ConsumerPact } from '@pact-foundation/pact-core';
|
|
2
|
-
import { V4GraphQLInteractionWithRequest, V4GraphQLRequestBuilderFunc, V4UnconfiguredGraphQLInteraction } from './types';
|
|
3
|
-
import { PactV4Options } from '../http/types';
|
|
4
|
-
import { JsonMap } from '../../common/jsonTypes';
|
|
5
|
-
import { Path } from '../../v3';
|
|
6
|
-
import { GraphQLVariables } from '../../common/graphQL/graphQL';
|
|
1
|
+
import type { ConsumerInteraction, ConsumerPact } from '@pact-foundation/pact-core';
|
|
2
|
+
import type { V4GraphQLInteractionWithRequest, V4GraphQLRequestBuilderFunc, V4UnconfiguredGraphQLInteraction } from './types';
|
|
3
|
+
import type { PactV4Options } from '../http/types';
|
|
4
|
+
import type { JsonMap } from '../../common/jsonTypes';
|
|
5
|
+
import type { Path } from '../../v3';
|
|
6
|
+
import type { GraphQLVariables } from '../../common/graphQL/graphQL';
|
|
7
7
|
export declare class UnconfiguredGraphQLInteraction implements V4UnconfiguredGraphQLInteraction {
|
|
8
8
|
protected pact: ConsumerPact;
|
|
9
9
|
protected interaction: ConsumerInteraction;
|
package/src/v4/graphql/index.js
CHANGED
|
@@ -1,31 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UnconfiguredGraphQLInteraction = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const matchers_1 = require("../../v3/matchers");
|
|
5
|
+
const graphQLRequestBuilder_1 = require("./graphQLRequestBuilder");
|
|
6
|
+
const graphQLInteractionWithRequest_1 = require("./graphQLInteractionWithRequest");
|
|
7
|
+
class UnconfiguredGraphQLInteraction {
|
|
8
|
+
pact;
|
|
9
|
+
interaction;
|
|
10
|
+
opts;
|
|
11
|
+
cleanupFn;
|
|
12
|
+
graphQLRequest;
|
|
8
13
|
// tslint:disable:no-empty-function
|
|
9
|
-
|
|
14
|
+
constructor(pact, interaction, opts, cleanupFn) {
|
|
10
15
|
this.pact = pact;
|
|
11
16
|
this.interaction = interaction;
|
|
12
17
|
this.opts = opts;
|
|
13
18
|
this.cleanupFn = cleanupFn;
|
|
14
19
|
this.graphQLRequest = {};
|
|
15
20
|
}
|
|
16
|
-
|
|
21
|
+
withOperation(operation) {
|
|
17
22
|
this.graphQLRequest.operation = operation;
|
|
18
23
|
return this;
|
|
19
|
-
}
|
|
20
|
-
|
|
24
|
+
}
|
|
25
|
+
withVariables(variables) {
|
|
21
26
|
this.graphQLRequest.variables = variables;
|
|
22
27
|
return this;
|
|
23
|
-
}
|
|
24
|
-
|
|
28
|
+
}
|
|
29
|
+
uponReceiving(description) {
|
|
25
30
|
this.interaction.uponReceiving(description);
|
|
26
31
|
return this;
|
|
27
|
-
}
|
|
28
|
-
|
|
32
|
+
}
|
|
33
|
+
given(state, parameters) {
|
|
29
34
|
if (parameters) {
|
|
30
35
|
this.interaction.givenWithParams(state, JSON.stringify(parameters));
|
|
31
36
|
}
|
|
@@ -33,15 +38,14 @@ var UnconfiguredGraphQLInteraction = /** @class */ (function () {
|
|
|
33
38
|
this.interaction.given(state);
|
|
34
39
|
}
|
|
35
40
|
return this;
|
|
36
|
-
}
|
|
37
|
-
|
|
41
|
+
}
|
|
42
|
+
withRequest(method, path, builder) {
|
|
38
43
|
this.interaction.withRequest(method, (0, matchers_1.matcherValueOrString)(path));
|
|
39
44
|
if (builder) {
|
|
40
45
|
builder(new graphQLRequestBuilder_1.GraphQLRequestBuilder(this.interaction));
|
|
41
46
|
}
|
|
42
47
|
return new graphQLInteractionWithRequest_1.GraphQLInteractionWithRequest(this.pact, this.interaction, this.opts, this.cleanupFn, this.graphQLRequest);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
}());
|
|
48
|
+
}
|
|
49
|
+
}
|
|
46
50
|
exports.UnconfiguredGraphQLInteraction = UnconfiguredGraphQLInteraction;
|
|
47
51
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/v4/graphql/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/v4/graphql/index.ts"],"names":[],"mappings":";;;AAcA,gDAAyD;AAEzD,mEAAgE;AAChE,mFAAgF;AAEhF,MAAa,8BAA8B;IAO7B;IACA;IACA;IACA;IAPJ,cAAc,CAAiB;IAEvC,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;QAE/B,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;IAC3B,CAAC;IAED,aAAa,CAAC,SAAiB;QAC7B,IAAI,CAAC,cAAc,CAAC,SAAS,GAAG,SAAS,CAAC;QAE1C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,aAAa,CAAC,SAA2B;QACvC,IAAI,CAAC,cAAc,CAAC,SAAS,GAAG,SAAS,CAAC;QAE1C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,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,WAAW,CACT,MAAc,EACd,IAAU,EACV,OAAqC;QAErC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,MAAM,EAAE,IAAA,+BAAoB,EAAC,IAAI,CAAC,CAAC,CAAC;QAEjE,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,IAAI,6CAAqB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;QACvD,CAAC;QACD,OAAO,IAAI,6DAA6B,CACtC,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,cAAc,CACpB,CAAC;IACJ,CAAC;CACF;AA7DD,wEA6DC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ASTNode } from 'graphql';
|
|
2
|
-
import { JsonMap } from '../../common/jsonTypes';
|
|
3
|
-
import { Path, TemplateHeaders, TemplateQuery } from '../../v3';
|
|
4
|
-
import { V4InteractionWithRequest } from '../http/types';
|
|
5
|
-
import { GraphQLVariables } from '../../common/graphQL/graphQL';
|
|
1
|
+
import type { ASTNode } from 'graphql';
|
|
2
|
+
import type { JsonMap } from '../../common/jsonTypes';
|
|
3
|
+
import type { Path, TemplateHeaders, TemplateQuery } from '../../v3';
|
|
4
|
+
import type { V4InteractionWithRequest } from '../http/types';
|
|
5
|
+
import type { GraphQLVariables } from '../../common/graphQL/graphQL';
|
|
6
6
|
export declare enum OperationType {
|
|
7
7
|
Mutation = "Mutation",
|
|
8
8
|
Query = "Query"
|
package/src/v4/http/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConsumerPact } from '@pact-foundation/pact-core';
|
|
2
|
-
import { PactV4Options, TestFunction } from './types';
|
|
1
|
+
import type { ConsumerPact } from '@pact-foundation/pact-core';
|
|
2
|
+
import type { PactV4Options, TestFunction } from './types';
|
|
3
3
|
export declare const readBinaryData: (file: string) => Buffer;
|
|
4
4
|
export declare const executeTest: <T>(pact: ConsumerPact, opts: PactV4Options, testFn: TestFunction<T>, cleanupFn: () => void) => Promise<T | undefined>;
|